@vaadin/bundles 25.3.0-alpha13 → 25.3.0-alpha14
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/node_modules_vaadin_map_node_modules_ol_control_MousePosition_js.js +6 -6
- package/node_modules_vaadin_map_node_modules_ol_control_MousePosition_js.js.map +1 -1
- package/node_modules_vaadin_map_node_modules_ol_control_ZoomToExtent_js.js +10 -1
- package/node_modules_vaadin_map_node_modules_ol_control_ZoomToExtent_js.js.map +1 -1
- package/node_modules_vaadin_map_node_modules_ol_events_SnapEvent_js.js +5 -0
- package/node_modules_vaadin_map_node_modules_ol_events_SnapEvent_js.js.map +1 -1
- package/node_modules_vaadin_map_node_modules_ol_featureloader_js.js +9 -8
- package/node_modules_vaadin_map_node_modules_ol_featureloader_js.js.map +1 -1
- package/node_modules_vaadin_map_node_modules_ol_geom_GeometryCollection_js.js +1 -1
- package/node_modules_vaadin_map_node_modules_ol_geom_GeometryCollection_js.js.map +1 -1
- package/node_modules_vaadin_map_node_modules_ol_geom_flat_clip_js.js +172 -0
- package/node_modules_vaadin_map_node_modules_ol_geom_flat_clip_js.js.map +1 -0
- package/node_modules_vaadin_map_node_modules_ol_geom_flat_length_js-_95bd5.js +58 -0
- package/node_modules_vaadin_map_node_modules_ol_geom_flat_length_js-_95bd5.js.map +1 -0
- package/{node_modules_vaadin_map_node_modules_ol_render_VectorContext_js-node_modules_vaadin_map_node_-a1378d.js → node_modules_vaadin_map_node_modules_ol_geom_flat_lineoffset_js-node_modules_vaadin_map_node_-304640.js} +244 -5
- package/node_modules_vaadin_map_node_modules_ol_geom_flat_lineoffset_js-node_modules_vaadin_map_node_-304640.js.map +1 -0
- package/node_modules_vaadin_map_node_modules_ol_geom_flat_lineoffset_js-node_modules_vaadin_map_node_-7a9288.js +383 -0
- package/node_modules_vaadin_map_node_modules_ol_geom_flat_lineoffset_js-node_modules_vaadin_map_node_-7a9288.js.map +1 -0
- package/node_modules_vaadin_map_node_modules_ol_geom_flat_lineoffset_js.js +243 -0
- package/node_modules_vaadin_map_node_modules_ol_geom_flat_lineoffset_js.js.map +1 -0
- package/node_modules_vaadin_map_node_modules_ol_geom_flat_textpath_js.js +18 -5
- package/node_modules_vaadin_map_node_modules_ol_geom_flat_textpath_js.js.map +1 -1
- package/node_modules_vaadin_map_node_modules_ol_interaction_DragAndDrop_js.js +8 -8
- package/node_modules_vaadin_map_node_modules_ol_interaction_DragAndDrop_js.js.map +1 -1
- package/{node_modules_vaadin_map_node_modules_ol_render_VectorContext_js-_279c0.js → node_modules_vaadin_map_node_modules_ol_render_VectorContext_js.js} +2 -2
- package/node_modules_vaadin_map_node_modules_ol_render_VectorContext_js.js.map +1 -0
- package/node_modules_vaadin_map_node_modules_ol_render_canvas_LineStringBuilder_js.js +17 -7
- package/node_modules_vaadin_map_node_modules_ol_render_canvas_LineStringBuilder_js.js.map +1 -1
- package/node_modules_vaadin_map_node_modules_ol_render_canvas_ZIndexContext_js-_abc10.js +18 -15
- package/node_modules_vaadin_map_node_modules_ol_render_canvas_ZIndexContext_js-_abc10.js.map +1 -1
- package/node_modules_vaadin_map_node_modules_ol_render_canvas_ZIndexContext_js-_abc11.js +18 -15
- package/node_modules_vaadin_map_node_modules_ol_render_canvas_ZIndexContext_js-_abc11.js.map +1 -1
- package/node_modules_vaadin_map_node_modules_ol_renderer_Layer_js.js +21 -1
- package/node_modules_vaadin_map_node_modules_ol_renderer_Layer_js.js.map +1 -1
- package/node_modules_vaadin_map_node_modules_ol_source_Source_js.js +34 -3
- package/node_modules_vaadin_map_node_modules_ol_source_Source_js.js.map +1 -1
- package/package.json +135 -135
- package/vaadin-bundle.json +1824 -1812
- package/vaadin.js +2725 -1726
- package/vaadin.js.map +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_Feature_js.js +30 -16
- package/vendors-node_modules_vaadin_map_node_modules_ol_Feature_js.js.map +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_Overlay_js.js +6 -6
- package/vendors-node_modules_vaadin_map_node_modules_ol_Overlay_js.js.map +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_control_FullScreen_js.js +7 -7
- package/vendors-node_modules_vaadin_map_node_modules_ol_control_FullScreen_js.js.map +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_control_OverviewMap_js.js +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_control_OverviewMap_js.js.map +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_control_ScaleLine_js.js +6 -6
- package/vendors-node_modules_vaadin_map_node_modules_ol_control_ScaleLine_js.js.map +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_control_ZoomSlider_js.js +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_control_ZoomSlider_js.js.map +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_control_js.js +34 -25
- package/vendors-node_modules_vaadin_map_node_modules_ol_control_js.js.map +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_Draw_js.js +146 -943
- package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_Draw_js.js.map +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_Extent_js.js +111 -34
- package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_Extent_js.js.map +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_Link_js.js +3 -3
- package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_Link_js.js.map +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_Modify_js.js +1055 -219
- package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_Modify_js.js.map +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_Select_js.js +129 -57
- package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_Select_js.js.map +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_Snap_js.js +74 -80
- package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_Snap_js.js.map +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_Translate_js.js +11 -11
- package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_Translate_js.js.map +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_js.js +54 -54
- package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_js.js.map +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_tracing_js.js +801 -0
- package/vendors-node_modules_vaadin_map_node_modules_ol_interaction_tracing_js.js.map +1 -0
- package/vendors-node_modules_vaadin_map_node_modules_ol_render_Feature_js.js +36 -20
- package/vendors-node_modules_vaadin_map_node_modules_ol_render_Feature_js.js.map +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_render_canvas_BuilderGroup_js.js +17 -279
- package/vendors-node_modules_vaadin_map_node_modules_ol_render_canvas_BuilderGroup_js.js.map +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_render_canvas_Builder_js.js +16 -7
- package/vendors-node_modules_vaadin_map_node_modules_ol_render_canvas_Builder_js.js.map +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_render_canvas_ExecutorGroup_js.js +53 -17
- package/vendors-node_modules_vaadin_map_node_modules_ol_render_canvas_ExecutorGroup_js.js.map +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_render_canvas_Executor_js.js +336 -38
- package/vendors-node_modules_vaadin_map_node_modules_ol_render_canvas_Executor_js.js.map +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_render_canvas_Immediate_js.js +75 -42
- package/vendors-node_modules_vaadin_map_node_modules_ol_render_canvas_Immediate_js.js.map +1 -1
- package/{node_modules_vaadin_map_node_modules_ol_render_canvas_PolygonBuilder_js.js → vendors-node_modules_vaadin_map_node_modules_ol_render_canvas_PolygonBuilder_js.js} +77 -11
- package/vendors-node_modules_vaadin_map_node_modules_ol_render_canvas_PolygonBuilder_js.js.map +1 -0
- package/vendors-node_modules_vaadin_map_node_modules_ol_render_canvas_TextBuilder_js.js +210 -16
- package/vendors-node_modules_vaadin_map_node_modules_ol_render_canvas_TextBuilder_js.js.map +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_renderer_canvas_Layer_js.js +88 -32
- package/vendors-node_modules_vaadin_map_node_modules_ol_renderer_canvas_Layer_js.js.map +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_renderer_canvas_VectorLayer_js.js +62 -22
- package/vendors-node_modules_vaadin_map_node_modules_ol_renderer_canvas_VectorLayer_js.js.map +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_renderer_vector_js.js +2 -2
- package/vendors-node_modules_vaadin_map_node_modules_ol_renderer_vector_js.js.map +1 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_source_Vector_js.js +135 -81
- package/vendors-node_modules_vaadin_map_node_modules_ol_source_Vector_js.js.map +1 -1
- package/node_modules_vaadin_map_node_modules_ol_render_VectorContext_js-_279c0.js.map +0 -1
- package/node_modules_vaadin_map_node_modules_ol_render_VectorContext_js-_279c1.js +0 -144
- package/node_modules_vaadin_map_node_modules_ol_render_VectorContext_js-_279c1.js.map +0 -1
- package/node_modules_vaadin_map_node_modules_ol_render_VectorContext_js-node_modules_vaadin_map_node_-a1378d.js.map +0 -1
- package/node_modules_vaadin_map_node_modules_ol_render_canvas_PolygonBuilder_js.js.map +0 -1
- package/node_modules_vaadin_map_node_modules_ol_style_js.js +0 -48
- package/node_modules_vaadin_map_node_modules_ol_style_js.js.map +0 -1
- package/vendors-node_modules_vaadin_map_node_modules_ol_geom_js-node_modules_vaadin_map_node_modules_-f0f4bb.js +0 -769
- package/vendors-node_modules_vaadin_map_node_modules_ol_geom_js-node_modules_vaadin_map_node_modules_-f0f4bb.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vendors-node_modules_vaadin_map_node_modules_ol_interaction_Modify_js.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AAC0C;AACkB;AACxB;AACwB;AACzB;AAOT;AACa;AACQ;AAMf;AAKV;AACe;AACS;AACD;AAOzB;AAC2B;AACY;AACnB;AACa;AACnB;AACY;;AAE9C;AACA;AACA;AACA,UAAU;AACV;AACA;;AAEA;AACA;AACA;AACA,UAAU;AACV;AACA;;AAEA;AACA;;AAEA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,aAAa,QAAQ;AACrB,cAAc,eAAe;AAC7B,cAAc,SAAS;AACvB,cAAc,6CAA6C;AAC3D,cAAc,QAAQ;AACtB,cAAc,sBAAsB;AACpC,cAAc,oBAAoB;AAClC;;AAEA;AACA,aAAa,uBAAuB;AACpC;;AAEA;AACA,aAAa,QAAQ;AACrB,cAAc,4CAA4C;AAC1D,YAAY,iDAAiD;AAC7D;AACA;AACA,IAAI,+CAA+C;AACnD,cAAc,4CAA4C;AAC1D,iBAAiB,iDAAiD;AAClE;AACA,IAAI,8CAA8C;AAClD,IAAI,6CAA6C;AACjD,cAAc,4CAA4C;AAC1D,0BAA0B,iDAAiD;AAC3E;AACA,yBAAyB,wCAAwC;AACjE,cAAc,QAAQ;AACtB;AACA,cAAc,gFAAgF;AAC9F;AACA;AACA,kEAAkE,kCAAkC;AACpG;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,cAAc;AAC5B;AACA;AACA,cAAc,+CAA+C;AAC7D;AACA,2DAA2D,kDAAkD;AAC7G;AACA,cAAc,qBAAqB;AACnC;AACA;AACA,cAAc,SAAS;AACvB;AACA,cAAc,SAAS;AACvB;AACA;;AAEA;AACA;AACA,sBAAsB,2CAA2C;AACjE;AACA;AACO,0BAA0B,wDAAK;AACtC;AACA,aAAa,iBAAiB;AAC9B,aAAa,qBAAqB;AAClC;AACA,aAAa,yCAAyC;AACtD,iBAAiB,gDAAgD;AACjE;AACA;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA,mBAAmB,gDAAgD;AACnE,cAAc;AACd;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,2DAA2D;AAC3D;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,mDAAkB;AACvC;AACA,aAAa,SAAS;AACtB;AACA;AACA,qBAAqB,gCAAgC;;AAErD;AACA,cAAc;AACd;AACA;;AAEA;AACA,cAAc;AACd;AACA;;AAEA;AACA,cAAc;AACd;AACA;;AAEA;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA,8DAA8D,+DAAa;;AAE3E;AACA;AACA,eAAe,yCAAyC;AACxD,gBAAgB,SAAS;AACzB;AACA;AACA,aAAa,gEAAU,qBAAqB,iEAAW;AACvD;;AAEA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA,QAAQ,wDAAM;;AAEd;AACA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA,8BAA8B,2BAA2B;AACzD,cAAc;AACd;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;AACA,sBAAsB,yDAAK;;AAE3B;AACA,cAAc;AACd;AACA;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;AACA,wBAAwB,wDAAW;AACnC,kBAAkB,yDAAY;AAC9B;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;;AAEA,eAAe,qBAAqB;AACpC;AACA;AACA;AACA,MAAM;AACN;AACA,qBAAqB,sDAAU;AAC/B;AACA,QAAQ,6EAA0B;AAClC;AACA;AACA;AACA,QAAQ,gFAA6B;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA,MAAM,mEAAuB;AAC7B;AACA;AACA;AACA,MAAM,sEAA0B;AAChC;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,aAAa,SAAS;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B,oEAAgB;AAC7C;;AAEA;AACA,aAAa,yCAAyC;AACtD,aAAa,oBAAoB;AACjC;AACA;AACA;AACA;AACA,wCAAwC,sDAAU;AAClD;AACA,4CAA4C,QAAQ;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,aAAa,SAAS;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,oEAAgB;AACtB;AACA;AACA;;AAEA;AACA,aAAa,SAAS;AACtB;AACA;AACA;AACA;AACA,eAAe,oBAAoB;AACnC;AACA;AACA;AACA,iBAAiB,aAAa;AAC9B;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,2CAA2C,QAAQ;AACnD;AACA,kDAAkD,QAAQ;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,SAAS;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa,6BAA6B;AAC1C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAc,aAAa;AAC3B;AACA;AACA;AACA;AACA;;AAEA;AACA,aAAa,iDAAiD;AAC9D;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,aAAa,iDAAiD;AAC9D;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,aAAa,qDAAqD;AAClE;AACA;AACA;AACA;AACA;;AAEA;AACA,aAAa,sCAAsC;AACnD;AACA;AACA;AACA;AACA,iCAAiC,SAAS;AAC1C;AACA;AACA;AACA;;AAEA;AACA,aAAa,qDAAqD;AAClE;AACA;AACA;AACA;AACA;;AAEA;AACA,aAAa,SAAS;AACtB,aAAa,OAAO;AACpB;AACA;AACA;AACA;;AAEA,eAAe,aAAa;AAC5B;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,aAAa,SAAS;AACtB,aAAa,yCAAyC;AACtD;AACA;AACA;AACA;AACA,wCAAwC,QAAQ;AAChD;;AAEA,iBAAiB,aAAa;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,aAAa,SAAS;AACtB,aAAa,yCAAyC;AACtD;AACA;AACA;AACA;AACA,iDAAiD,QAAQ;AACzD;;AAEA,iBAAiB,aAAa;AAC9B;AACA;AACA;AACA;AACA;AACA;;AAEA,yBAAyB,2DAAc;AACvC;AACA;;AAEA;AACA,aAAa,SAAS;AACtB,aAAa,8CAA8C;AAC3D;AACA;AACA;AACA;AACA,uCAAuC,QAAQ;AAC/C;AACA,mDAAmD,QAAQ;AAC3D;;AAEA,mBAAmB,aAAa;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,2BAA2B,2DAAc;AACzC;AACA;AACA;;AAEA;AACA,aAAa,SAAS;AACtB,aAAa,sCAAsC;AACnD;AACA;AACA;AACA;AACA,uCAAuC,QAAQ;AAC/C;AACA,mDAAmD,QAAQ;AAC3D;;AAEA,mBAAmB,aAAa;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,2BAA2B,2DAAc;AACzC;AACA;AACA;;AAEA;AACA,aAAa,SAAS;AACtB,aAAa,2CAA2C;AACxD;AACA;AACA;AACA;AACA,0CAA0C,QAAQ;AAClD;AACA,yCAAyC,QAAQ;AACjD;AACA,qDAAqD,QAAQ;AAC7D;;AAEA,qBAAqB,aAAa;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,6BAA6B,2DAAc;AAC3C;AACA;AACA;AACA;;AAEA;AACA;AACA,MAAM,2BAA2B;AACjC;AACA,MAAM,kCAAkC;AACxC;AACA;AACA,aAAa,SAAS;AACtB,aAAa,qCAAqC;AAClD;AACA;AACA;AACA;;AAEA,eAAe,aAAa;AAC5B;AACA;AACA;AACA;AACA;AACA;;AAEA,eAAe,aAAa;AAC5B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,uBAAuB,yEAAY;AACnC,oCAAoC,uCAAuC;AAC3E;AACA;AACA,2BAA2B,2DAAiB;AAC5C;AACA;AACA;AACA;AACA;AACA,uBAAuB,6DAAU;AACjC,mBAAmB,qCAAqC;AACxD;AACA;AACA;AACA;;AAEA;AACA,aAAa,SAAS;AACtB,aAAa,iDAAiD;AAC9D;AACA;AACA;AACA;AACA,oBAAoB,uBAAuB;AAC3C;AACA;AACA;AACA;AACA;;AAEA;AACA,aAAa,uCAAuC;AACpD,aAAa,gBAAgB;AAC7B,aAAa,oDAAoD;AACjE,aAAa,SAAS;AACtB,cAAc,SAAS;AACvB;AACA;AACA;AACA;AACA;AACA,0BAA0B,oDAAO,KAAK,uDAAK;AAC3C;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,kBAAkB,mEAAmE;AACrF,aAAa,yCAAyC;AACtD,cAAc,SAAS;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,8BAA8B,4EAA+B;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC,4EAA+B;AAC/D;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;;AAEA,gCAAgC,4EAA+B;AAC/D;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,yBAAyB,2DAAc;AACvC;AACA;AACA;AACA,oDAAoD,QAAQ;AAC5D;AACA;AACA,gBAAgB,iDAAM;AACtB;AACA;AACA,sCAAsC;AACtC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU,uDAAgB;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,UAAU,uDAAgB;AAC1B;AACA;AACA;AACA;;AAEA,UAAU,uDAAgB;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,QAAQ,iDAAM;AACd;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,aAAa,yCAAyC;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,oDAAoD,QAAQ;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC,qCAAqC;AACzE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA,yBAAyB,yDAAkB;AAC3C,cAAc,4DAAkB;AAChC,cAAc,4DAAkB;AAChC;AACA,mCAAmC,2DAAiB;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,yCAAyC;AACtD,cAAc,SAAS;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,gDAAgD,QAAQ;AACxD;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,aAAa,yCAAyC;AACtD,cAAc,SAAS;AACvB;AACA;AACA;AACA,gDAAgD,QAAQ;AACxD;AACA;AACA;AACA,kCAAkC,qCAAqC;AACvE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,yEAAY;AACvC,mBAAmB,4EAA4E;AAC/F;AACA,+BAA+B,2DAAiB;AAChD;AACA;AACA;AACA;AACA;AACA,2BAA2B,6DAAU;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR,2BAA2B,2DAAc;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,aAAa,yCAAyC;AACtD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,aAAa,uCAAuC;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,eAAe,8BAA8B;AAC7C;AACA,eAAe,iBAAiB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,uDAAK;AAChC,cAAc,0DAAgB;AAC9B;AACA;AACA;;AAEA;AACA;AACA;AACA,+BAA+B,oDAAO;AACtC;AACA;AACA,0CAA0C,OAAO;AACjD,0CAA0C,OAAO;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe;AACf;AACA;AACA;AACA,SAAS;AACT,SAAS,YAAY;AACrB;AACA;AACA;AACA,yBAAyB,wDAAc;AACvC,QAAQ,yEAAY;AACpB;AACA;AACA;AACA,kBAAkB,sDAAY;AAC9B,QAAQ,mDAAY;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iBAAiB,yDAAkB;AACnC;AACA,mBAAmB,yBAAyB;AAC5C;AACA,uBAAuB,iDAAM;;AAE7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA,+BAA+B,gEAAyB;AACxD,+BAA+B,gEAAyB;AACxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,iDAAM;AAC3B,6CAA6C,QAAQ;AACrD;AACA;AACA,eAAe,uDAAgB;AAC/B,gBAAgB,uDAAgB;AAChC,eAAe,uDAAgB;AAC/B,gBAAgB,uDAAgB;AAChC;AACA,kCAAkC,iDAAM;AACxC;AACA;AACA,+BAA+B,iDAAM;AACrC;AACA,cAAc;AACd;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,aAAa,aAAa;AAC1B,aAAa,uCAAuC;AACpD,cAAc,SAAS;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,eAAe,aAAa;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,iBAAiB,2DAAc;AAC/B;;AAEA,eAAe,aAAa;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,iBAAiB,2DAAc;AAC/B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAc,8CAA8C;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,0DAAgB;AAC3B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAc,SAAS;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6CAA6C,2DAAc;AAC3D;AACA,QAAQ,QAAQ;AAChB,QAAQ,uDAAgB;AACxB,QAAQ,uDAAgB;AACxB;AACA;;AAEA;AACA;AACA,aAAa,uCAAuC;AACpD;AACA,cAAc,SAAS;AACvB;AACA;AACA;AACA;AACA,mBAAmB,4DAAkB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,4EAA+B;AACtE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAc,SAAS;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC,QAAQ;AAC9C;AACA;AACA,YAAY,iDAAM;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,aAAa;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,YAAY,2DAAc;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAc,SAAS;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6CAA6C,2DAAc;AAC3D;AACA,QAAQ,QAAQ;AAChB;AACA,UAAU,uDAAgB;AAC1B,UAAU,uDAAgB;AAC1B;AACA;AACA;;AAEA;AACA;AACA,aAAa,uCAAuC;AACpD;AACA,cAAc,SAAS;AACvB;AACA;AACA;AACA;AACA,QAAQ,4DAAkB;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,aAAa,6CAA6C;AAC1D,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,aAAa,6CAA6C;AAC1D,aAAa,QAAQ;AACrB,aAAa,yBAAyB;AACtC,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,kDAAM;AAClB;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;;AAEA;AACA,WAAW,aAAa;AACxB,WAAW,aAAa;AACxB,YAAY,QAAQ;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,uCAAuC;AAClD;AACA,WAAW,aAAa;AACxB;AACA,WAAW,yCAAyC;AACpD,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,oCAAoC,qCAAqC;AACzE;AACA;;AAEA;AACA,6BAA6B,2DAAiB;AAC9C;AACA;AACA;AACA;AACA;AACA,sCAAsC,gEAAyB;AAC/D;AACA,QAAQ,4DAAkB;AAC1B;AACA;AACA;AACA;AACA;AACA;;AAEA,qBAAqB,4DAAkB;AACvC,mBAAmB,4DAAkB;AACrC,mBAAmB,4DAAkB;AACrC,SAAS,yEAAwB;AACjC;;AAEA;AACA;AACA;AACA,WAAW,uCAAuC;AAClD;AACA,WAAW,aAAa;AACxB;AACA,WAAW,yCAAyC;AACpD,YAAY,uCAAuC;AACnD;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,oCAAoC,qCAAqC;AACzE;AACA;AACA,2BAA2B,2DAAiB;AAC5C;AACA;AACA;AACA;AACA;AACA,WAAW,0DAAgB;AAC3B;AACA,QAAQ,4DAAkB;AAC1B;AACA;AACA;AACA;AACA,qBAAqB,4DAAkB;AACvC,mBAAmB,4DAAkB;AACrC,mBAAmB,4DAAkB;AACrC,SAAS,0DAAgB;AACzB,IAAI,iEAAgB;AACpB;AACA;AACA;;AAEA;AACA,YAAY,2CAA2C;AACvD;AACA;AACA,gBAAgB,oEAAkB;AAClC;AACA;AACA;AACA;;AAEA,iEAAe,MAAM,EAAC","sources":["webpack://@vaadin/bundles/./node_modules/@vaadin/map/node_modules/ol/interaction/Modify.js"],"sourcesContent":["/**\n * @module ol/interaction/Modify\n */\nimport Collection from '../Collection.js';\nimport CollectionEventType from '../CollectionEventType.js';\nimport Feature from '../Feature.js';\nimport MapBrowserEventType from '../MapBrowserEventType.js';\nimport {equals} from '../array.js';\nimport {\n closestOnSegment,\n distance as coordinateDistance,\n equals as coordinatesEqual,\n squaredDistance as squaredCoordinateDistance,\n squaredDistanceToSegment,\n} from '../coordinate.js';\nimport Event from '../events/Event.js';\nimport EventType from '../events/EventType.js';\nimport {\n altKeyOnly,\n always,\n primaryAction,\n singleClick,\n} from '../events/condition.js';\nimport {\n boundingExtent,\n buffer as bufferExtent,\n createOrUpdateFromCoordinate as createExtent,\n} from '../extent.js';\nimport Point from '../geom/Point.js';\nimport {fromCircle} from '../geom/Polygon.js';\nimport VectorLayer from '../layer/Vector.js';\nimport {\n fromUserCoordinate,\n fromUserExtent,\n getUserProjection,\n toUserCoordinate,\n toUserExtent,\n} from '../proj.js';\nimport VectorSource from '../source/Vector.js';\nimport VectorEventType from '../source/VectorEventType.js';\nimport RBush from '../structs/RBush.js';\nimport {createEditingStyle} from '../style/Style.js';\nimport {getUid} from '../util.js';\nimport PointerInteraction from './Pointer.js';\n\n/**\n * The segment index assigned to a circle's center when\n * breaking up a circle into ModifySegmentDataType segments.\n * @type {number}\n */\nconst CIRCLE_CENTER_INDEX = 0;\n\n/**\n * The segment index assigned to a circle's circumference when\n * breaking up a circle into ModifySegmentDataType segments.\n * @type {number}\n */\nconst CIRCLE_CIRCUMFERENCE_INDEX = 1;\n\nconst tempExtent = [0, 0, 0, 0];\nconst tempSegment = [];\n\n/**\n * @enum {string}\n */\nconst ModifyEventType = {\n /**\n * Triggered upon feature modification start\n * @event ModifyEvent#modifystart\n * @api\n */\n MODIFYSTART: 'modifystart',\n /**\n * Triggered upon feature modification end\n * @event ModifyEvent#modifyend\n * @api\n */\n MODIFYEND: 'modifyend',\n};\n\n/**\n * @typedef {Object} SegmentData\n * @property {Array<number>} [depth] Depth.\n * @property {Feature} feature Feature.\n * @property {import(\"../geom/SimpleGeometry.js\").default} geometry Geometry.\n * @property {number} [index] Index.\n * @property {Array<Array<number>>} segment Segment.\n * @property {Array<SegmentData>} [featureSegments] FeatureSegments.\n */\n\n/**\n * @typedef {[SegmentData, number]} DragSegment\n */\n\n/**\n * @typedef {Object} Options\n * @property {import(\"../events/condition.js\").Condition} [condition] A function that\n * takes a {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a\n * boolean to indicate whether that event will be considered to add or move a\n * vertex to the sketch. Default is\n * {@link module:ol/events/condition.primaryAction}.\n * @property {import(\"../events/condition.js\").Condition} [deleteCondition] A function\n * that takes a {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a\n * boolean to indicate whether that event should be handled. By default,\n * {@link module:ol/events/condition.singleClick} with\n * {@link module:ol/events/condition.altKeyOnly} results in a vertex deletion.\n * @property {import(\"../events/condition.js\").Condition} [insertVertexCondition] A\n * function that takes a {@link module:ol/MapBrowserEvent~MapBrowserEvent} and\n * returns a boolean to indicate whether a new vertex should be added to the sketch\n * features. Default is {@link module:ol/events/condition.always}.\n * @property {number} [pixelTolerance=10] Pixel tolerance for considering the\n * pointer close enough to a segment or vertex for editing.\n * @property {import(\"../style/Style.js\").StyleLike|import(\"../style/flat.js\").FlatStyleLike} [style]\n * Style used for the modification point or vertex. For linestrings and polygons, this will\n * be the affected vertex, for circles a point along the circle, and for points the actual\n * point. If not configured, the default edit style is used (see {@link module:ol/style/Style~Style}).\n * When using a style function, the point feature passed to the function will have an `existing` property -\n * indicating whether there is an existing vertex underneath or not, a `features`\n * property - an array whose entries are the features that are being modified, and a `geometries`\n * property - an array whose entries are the geometries that are being modified. Both arrays are\n * in the same order. The `geometries` are only useful when modifying geometry collections, where\n * the geometry will be the particular geometry from the collection that is being modified.\n * @property {VectorSource} [source] The vector source with\n * features to modify. If a vector source is not provided, a feature collection\n * must be provided with the `features` option.\n * @property {boolean|import(\"../layer/BaseVector\").default} [hitDetection] When configured, point\n * features will be considered for modification based on their visual appearance, instead of being within\n * the `pixelTolerance` from the pointer location. When a {@link module:ol/layer/BaseVector~BaseVectorLayer} is\n * provided, only the rendered representation of the features on that layer will be considered.\n * @property {Collection<Feature>} [features]\n * The features the interaction works on. If a feature collection is not\n * provided, a vector source must be provided with the `source` option.\n * @property {boolean} [wrapX=false] Wrap the world horizontally on the sketch\n * overlay.\n * @property {boolean} [snapToPointer=!hitDetection] The vertex, point or segment being modified snaps to the\n * pointer coordinate when clicked within the `pixelTolerance`.\n */\n\n/**\n * @classdesc\n * Events emitted by {@link module:ol/interaction/Modify~Modify} instances are\n * instances of this type.\n */\nexport class ModifyEvent extends Event {\n /**\n * @param {ModifyEventType} type Type.\n * @param {Collection<Feature>} features\n * The features modified.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent\n * Associated {@link module:ol/MapBrowserEvent~MapBrowserEvent}.\n */\n constructor(type, features, mapBrowserEvent) {\n super(type);\n\n /**\n * The features being modified.\n * @type {Collection<Feature>}\n * @api\n */\n this.features = features;\n\n /**\n * Associated {@link module:ol/MapBrowserEvent~MapBrowserEvent}.\n * @type {import(\"../MapBrowserEvent.js\").default}\n * @api\n */\n this.mapBrowserEvent = mapBrowserEvent;\n }\n}\n\n/***\n * @template Return\n * @typedef {import(\"../Observable\").OnSignature<import(\"../Observable\").EventTypes, import(\"../events/Event.js\").default, Return> &\n * import(\"../Observable\").OnSignature<import(\"../ObjectEventType\").Types|\n * 'change:active', import(\"../Object\").ObjectEvent, Return> &\n * import(\"../Observable\").OnSignature<'modifyend'|'modifystart', ModifyEvent, Return> &\n * import(\"../Observable\").CombinedOnSignature<import(\"../Observable\").EventTypes|import(\"../ObjectEventType\").Types|\n * 'change:active'|'modifyend'|'modifystart', Return>} ModifyOnSignature\n */\n\n/**\n * @classdesc\n * Interaction for modifying feature geometries. To modify features that have\n * been added to an existing source, construct the modify interaction with the\n * `source` option. If you want to modify features in a collection (for example,\n * the collection used by a select interaction), construct the interaction with\n * the `features` option. The interaction must be constructed with either a\n * `source` or `features` option.\n *\n * Cartesian distance from the pointer is used to determine the features that\n * will be modified. This means that geometries will only be considered for\n * modification when they are within the configured `pixelTolerance`. For point\n * geometries, the `hitDetection` option can be used to match their visual\n * appearance.\n *\n * By default, the interaction will allow deletion of vertices when the `alt`\n * key is pressed. To configure the interaction with a different condition\n * for deletion, use the `deleteCondition` option.\n * @fires ModifyEvent\n * @api\n */\nclass Modify extends PointerInteraction {\n /**\n * @param {Options} options Options.\n */\n constructor(options) {\n super(/** @type {import(\"./Pointer.js\").Options} */ (options));\n\n /***\n * @type {ModifyOnSignature<import(\"../events\").EventsKey>}\n */\n this.on;\n\n /***\n * @type {ModifyOnSignature<import(\"../events\").EventsKey>}\n */\n this.once;\n\n /***\n * @type {ModifyOnSignature<void>}\n */\n this.un;\n\n /** @private */\n this.boundHandleFeatureChange_ = this.handleFeatureChange_.bind(this);\n\n /**\n * @private\n * @type {import(\"../events/condition.js\").Condition}\n */\n this.condition_ = options.condition ? options.condition : primaryAction;\n\n /**\n * @private\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Browser event.\n * @return {boolean} Combined condition result.\n */\n this.defaultDeleteCondition_ = function (mapBrowserEvent) {\n return altKeyOnly(mapBrowserEvent) && singleClick(mapBrowserEvent);\n };\n\n /**\n * @type {import(\"../events/condition.js\").Condition}\n * @private\n */\n this.deleteCondition_ = options.deleteCondition\n ? options.deleteCondition\n : this.defaultDeleteCondition_;\n\n /**\n * @type {import(\"../events/condition.js\").Condition}\n * @private\n */\n this.insertVertexCondition_ = options.insertVertexCondition\n ? options.insertVertexCondition\n : always;\n\n /**\n * Editing vertex.\n * @type {Feature<Point>}\n * @private\n */\n this.vertexFeature_ = null;\n\n /**\n * Segments intersecting {@link this.vertexFeature_} by segment uid.\n * @type {Object<string, boolean>}\n * @private\n */\n this.vertexSegments_ = null;\n\n /**\n * @type {import(\"../pixel.js\").Pixel}\n * @private\n */\n this.lastPixel_ = [0, 0];\n\n /**\n * Tracks if the next `singleclick` event should be ignored to prevent\n * accidental deletion right after vertex creation.\n * @type {boolean}\n * @private\n */\n this.ignoreNextSingleClick_ = false;\n\n /**\n * @type {Collection<Feature>}\n * @private\n */\n this.featuresBeingModified_ = null;\n\n /**\n * Segment RTree for each layer\n * @type {RBush<SegmentData>}\n * @private\n */\n this.rBush_ = new RBush();\n\n /**\n * @type {number}\n * @private\n */\n this.pixelTolerance_ =\n options.pixelTolerance !== undefined ? options.pixelTolerance : 10;\n\n /**\n * @type {boolean}\n * @private\n */\n this.snappedToVertex_ = false;\n\n /**\n * Indicate whether the interaction is currently changing a feature's\n * coordinates.\n * @type {boolean}\n * @private\n */\n this.changingFeature_ = false;\n\n /**\n * @type {Array<DragSegment>}\n * @private\n */\n this.dragSegments_ = [];\n\n /**\n * Draw overlay where sketch features are drawn.\n * @type {VectorLayer}\n * @private\n */\n this.overlay_ = new VectorLayer({\n source: new VectorSource({\n useSpatialIndex: false,\n wrapX: !!options.wrapX,\n }),\n style: options.style ? options.style : getDefaultStyleFunction(),\n updateWhileAnimating: true,\n updateWhileInteracting: true,\n });\n\n /**\n * @const\n * @private\n * @type {!Object<string, function(Feature, import(\"../geom/Geometry.js\").default): void>}\n */\n this.SEGMENT_WRITERS_ = {\n 'Point': this.writePointGeometry_.bind(this),\n 'LineString': this.writeLineStringGeometry_.bind(this),\n 'LinearRing': this.writeLineStringGeometry_.bind(this),\n 'Polygon': this.writePolygonGeometry_.bind(this),\n 'MultiPoint': this.writeMultiPointGeometry_.bind(this),\n 'MultiLineString': this.writeMultiLineStringGeometry_.bind(this),\n 'MultiPolygon': this.writeMultiPolygonGeometry_.bind(this),\n 'Circle': this.writeCircleGeometry_.bind(this),\n 'GeometryCollection': this.writeGeometryCollectionGeometry_.bind(this),\n };\n\n /**\n * @type {VectorSource}\n * @private\n */\n this.source_ = null;\n\n /**\n * @type {boolean|import(\"../layer/BaseVector\").default}\n * @private\n */\n this.hitDetection_ = null;\n\n /** @type {Collection<Feature>} */\n let features;\n if (options.features) {\n features = options.features;\n } else if (options.source) {\n this.source_ = options.source;\n features = new Collection(this.source_.getFeatures());\n this.source_.addEventListener(\n VectorEventType.ADDFEATURE,\n this.handleSourceAdd_.bind(this),\n );\n this.source_.addEventListener(\n VectorEventType.REMOVEFEATURE,\n this.handleSourceRemove_.bind(this),\n );\n }\n if (!features) {\n throw new Error(\n 'The modify interaction requires features, a source or a layer',\n );\n }\n if (options.hitDetection) {\n this.hitDetection_ = options.hitDetection;\n }\n\n /**\n * @type {Collection<Feature>}\n * @private\n */\n this.features_ = features;\n\n this.features_.forEach(this.addFeature_.bind(this));\n this.features_.addEventListener(\n CollectionEventType.ADD,\n this.handleFeatureAdd_.bind(this),\n );\n this.features_.addEventListener(\n CollectionEventType.REMOVE,\n this.handleFeatureRemove_.bind(this),\n );\n\n /**\n * @type {import(\"../MapBrowserEvent.js\").default}\n * @private\n */\n this.lastPointerEvent_ = null;\n\n /**\n * Delta (x, y in map units) between matched rtree vertex and pointer vertex.\n * @type {Array<number>}\n * @private\n */\n this.delta_ = [0, 0];\n\n /**\n * @private\n */\n this.snapToPointer_ =\n options.snapToPointer === undefined\n ? !this.hitDetection_\n : options.snapToPointer;\n }\n\n /**\n * @param {Feature} feature Feature.\n * @private\n */\n addFeature_(feature) {\n const geometry = feature.getGeometry();\n if (geometry) {\n const writer = this.SEGMENT_WRITERS_[geometry.getType()];\n if (writer) {\n writer(feature, geometry);\n }\n }\n const map = this.getMap();\n if (map && map.isRendered() && this.getActive()) {\n this.handlePointerAtPixel_(map.getCoordinateFromPixel(this.lastPixel_));\n }\n feature.addEventListener(EventType.CHANGE, this.boundHandleFeatureChange_);\n }\n\n /**\n * @param {import(\"../MapBrowserEvent.js\").default} evt Map browser event.\n * @param {Array<SegmentData>} segments The segments subject to modification.\n * @private\n */\n willModifyFeatures_(evt, segments) {\n if (!this.featuresBeingModified_) {\n this.featuresBeingModified_ = new Collection();\n const features = this.featuresBeingModified_.getArray();\n for (let i = 0, ii = segments.length; i < ii; ++i) {\n const feature = segments[i].feature;\n if (feature && !features.includes(feature)) {\n this.featuresBeingModified_.push(feature);\n }\n }\n if (this.featuresBeingModified_.getLength() === 0) {\n this.featuresBeingModified_ = null;\n } else {\n this.dispatchEvent(\n new ModifyEvent(\n ModifyEventType.MODIFYSTART,\n this.featuresBeingModified_,\n evt,\n ),\n );\n }\n }\n }\n\n /**\n * @param {Feature} feature Feature.\n * @private\n */\n removeFeature_(feature) {\n this.removeFeatureSegmentData_(feature);\n // Remove the vertex feature if the collection of candidate features is empty.\n if (this.vertexFeature_ && this.features_.getLength() === 0) {\n this.overlay_.getSource().removeFeature(this.vertexFeature_);\n this.vertexFeature_ = null;\n }\n feature.removeEventListener(\n EventType.CHANGE,\n this.boundHandleFeatureChange_,\n );\n }\n\n /**\n * @param {Feature} feature Feature.\n * @private\n */\n removeFeatureSegmentData_(feature) {\n const rBush = this.rBush_;\n /** @type {Array<SegmentData>} */\n const nodesToRemove = [];\n rBush.forEach(\n /**\n * @param {SegmentData} node RTree node.\n */\n function (node) {\n if (feature === node.feature) {\n nodesToRemove.push(node);\n }\n },\n );\n for (let i = nodesToRemove.length - 1; i >= 0; --i) {\n const nodeToRemove = nodesToRemove[i];\n for (let j = this.dragSegments_.length - 1; j >= 0; --j) {\n if (this.dragSegments_[j][0] === nodeToRemove) {\n this.dragSegments_.splice(j, 1);\n }\n }\n rBush.remove(nodeToRemove);\n }\n }\n\n /**\n * Activate or deactivate the interaction.\n * @param {boolean} active Active.\n * @observable\n * @api\n * @override\n */\n setActive(active) {\n if (this.vertexFeature_ && !active) {\n this.overlay_.getSource().removeFeature(this.vertexFeature_);\n this.vertexFeature_ = null;\n }\n super.setActive(active);\n }\n\n /**\n * Remove the interaction from its current map and attach it to the new map.\n * Subclasses may set up event handlers to get notified about changes to\n * the map here.\n * @param {import(\"../Map.js\").default} map Map.\n * @override\n */\n setMap(map) {\n this.overlay_.setMap(map);\n super.setMap(map);\n }\n\n /**\n * Get the overlay layer that this interaction renders the modification point or vertex to.\n * @return {VectorLayer} Overlay layer.\n * @api\n */\n getOverlay() {\n return this.overlay_;\n }\n\n /**\n * @param {import(\"../source/Vector.js\").VectorSourceEvent} event Event.\n * @private\n */\n handleSourceAdd_(event) {\n if (event.feature) {\n this.features_.push(event.feature);\n }\n }\n\n /**\n * @param {import(\"../source/Vector.js\").VectorSourceEvent} event Event.\n * @private\n */\n handleSourceRemove_(event) {\n if (event.feature) {\n this.features_.remove(event.feature);\n }\n }\n\n /**\n * @param {import(\"../Collection.js\").CollectionEvent<Feature>} evt Event.\n * @private\n */\n handleFeatureAdd_(evt) {\n this.addFeature_(evt.element);\n }\n\n /**\n * @param {import(\"../events/Event.js\").default} evt Event.\n * @private\n */\n handleFeatureChange_(evt) {\n if (!this.changingFeature_) {\n const feature = /** @type {Feature} */ (evt.target);\n this.removeFeature_(feature);\n this.addFeature_(feature);\n }\n }\n\n /**\n * @param {import(\"../Collection.js\").CollectionEvent<Feature>} evt Event.\n * @private\n */\n handleFeatureRemove_(evt) {\n this.removeFeature_(evt.element);\n }\n\n /**\n * @param {Feature} feature Feature\n * @param {Point} geometry Geometry.\n * @private\n */\n writePointGeometry_(feature, geometry) {\n const coordinates = geometry.getCoordinates();\n\n /** @type {SegmentData} */\n const segmentData = {\n feature: feature,\n geometry: geometry,\n segment: [coordinates, coordinates],\n };\n\n this.rBush_.insert(geometry.getExtent(), segmentData);\n }\n\n /**\n * @param {Feature} feature Feature\n * @param {import(\"../geom/MultiPoint.js\").default} geometry Geometry.\n * @private\n */\n writeMultiPointGeometry_(feature, geometry) {\n const points = geometry.getCoordinates();\n for (let i = 0, ii = points.length; i < ii; ++i) {\n const coordinates = points[i];\n\n /** @type {SegmentData} */\n const segmentData = {\n feature: feature,\n geometry: geometry,\n depth: [i],\n index: i,\n segment: [coordinates, coordinates],\n };\n\n this.rBush_.insert(geometry.getExtent(), segmentData);\n }\n }\n\n /**\n * @param {Feature} feature Feature\n * @param {import(\"../geom/LineString.js\").default} geometry Geometry.\n * @private\n */\n writeLineStringGeometry_(feature, geometry) {\n const coordinates = geometry.getCoordinates();\n for (let i = 0, ii = coordinates.length - 1; i < ii; ++i) {\n const segment = coordinates.slice(i, i + 2);\n\n /** @type {SegmentData} */\n const segmentData = {\n feature: feature,\n geometry: geometry,\n index: i,\n segment: segment,\n };\n\n this.rBush_.insert(boundingExtent(segment), segmentData);\n }\n }\n\n /**\n * @param {Feature} feature Feature\n * @param {import(\"../geom/MultiLineString.js\").default} geometry Geometry.\n * @private\n */\n writeMultiLineStringGeometry_(feature, geometry) {\n const lines = geometry.getCoordinates();\n for (let j = 0, jj = lines.length; j < jj; ++j) {\n const coordinates = lines[j];\n for (let i = 0, ii = coordinates.length - 1; i < ii; ++i) {\n const segment = coordinates.slice(i, i + 2);\n\n /** @type {SegmentData} */\n const segmentData = {\n feature: feature,\n geometry: geometry,\n depth: [j],\n index: i,\n segment: segment,\n };\n\n this.rBush_.insert(boundingExtent(segment), segmentData);\n }\n }\n }\n\n /**\n * @param {Feature} feature Feature\n * @param {import(\"../geom/Polygon.js\").default} geometry Geometry.\n * @private\n */\n writePolygonGeometry_(feature, geometry) {\n const rings = geometry.getCoordinates();\n for (let j = 0, jj = rings.length; j < jj; ++j) {\n const coordinates = rings[j];\n for (let i = 0, ii = coordinates.length - 1; i < ii; ++i) {\n const segment = coordinates.slice(i, i + 2);\n\n /** @type {SegmentData} */\n const segmentData = {\n feature: feature,\n geometry: geometry,\n depth: [j],\n index: i,\n segment: segment,\n };\n\n this.rBush_.insert(boundingExtent(segment), segmentData);\n }\n }\n }\n\n /**\n * @param {Feature} feature Feature\n * @param {import(\"../geom/MultiPolygon.js\").default} geometry Geometry.\n * @private\n */\n writeMultiPolygonGeometry_(feature, geometry) {\n const polygons = geometry.getCoordinates();\n for (let k = 0, kk = polygons.length; k < kk; ++k) {\n const rings = polygons[k];\n for (let j = 0, jj = rings.length; j < jj; ++j) {\n const coordinates = rings[j];\n for (let i = 0, ii = coordinates.length - 1; i < ii; ++i) {\n const segment = coordinates.slice(i, i + 2);\n\n /** @type {SegmentData} */\n const segmentData = {\n feature: feature,\n geometry: geometry,\n depth: [j, k],\n index: i,\n segment: segment,\n };\n\n this.rBush_.insert(boundingExtent(segment), segmentData);\n }\n }\n }\n }\n\n /**\n * We convert a circle into two segments. The segment at index\n * {@link CIRCLE_CENTER_INDEX} is the\n * circle's center (a point). The segment at index\n * {@link CIRCLE_CIRCUMFERENCE_INDEX} is\n * the circumference, and is not a line segment.\n *\n * @param {Feature} feature Feature.\n * @param {import(\"../geom/Circle.js\").default} geometry Geometry.\n * @private\n */\n writeCircleGeometry_(feature, geometry) {\n const coordinates = geometry.getCenter();\n\n /** @type {SegmentData} */\n const centerSegmentData = {\n feature: feature,\n geometry: geometry,\n index: CIRCLE_CENTER_INDEX,\n segment: [coordinates, coordinates],\n };\n\n /** @type {SegmentData} */\n const circumferenceSegmentData = {\n feature: feature,\n geometry: geometry,\n index: CIRCLE_CIRCUMFERENCE_INDEX,\n segment: [coordinates, coordinates],\n };\n\n const featureSegments = [centerSegmentData, circumferenceSegmentData];\n centerSegmentData.featureSegments = featureSegments;\n circumferenceSegmentData.featureSegments = featureSegments;\n this.rBush_.insert(createExtent(coordinates), centerSegmentData);\n let circleGeometry = /** @type {import(\"../geom/Geometry.js\").default} */ (\n geometry\n );\n const userProjection = getUserProjection();\n if (userProjection && this.getMap()) {\n const projection = this.getMap().getView().getProjection();\n circleGeometry = circleGeometry\n .clone()\n .transform(userProjection, projection);\n circleGeometry = fromCircle(\n /** @type {import(\"../geom/Circle.js\").default} */ (circleGeometry),\n ).transform(projection, userProjection);\n }\n this.rBush_.insert(circleGeometry.getExtent(), circumferenceSegmentData);\n }\n\n /**\n * @param {Feature} feature Feature\n * @param {import(\"../geom/GeometryCollection.js\").default} geometry Geometry.\n * @private\n */\n writeGeometryCollectionGeometry_(feature, geometry) {\n const geometries = geometry.getGeometriesArray();\n for (let i = 0; i < geometries.length; ++i) {\n const geometry = geometries[i];\n const writer = this.SEGMENT_WRITERS_[geometry.getType()];\n writer(feature, geometry);\n }\n }\n\n /**\n * @param {import(\"../coordinate.js\").Coordinate} coordinates Coordinates.\n * @param {Array<Feature>} features The features being modified.\n * @param {Array<import(\"../geom/SimpleGeometry.js\").default>} geometries The geometries being modified.\n * @param {boolean} existing The vertex represents an existing vertex.\n * @return {Feature} Vertex feature.\n * @private\n */\n createOrUpdateVertexFeature_(coordinates, features, geometries, existing) {\n let vertexFeature = this.vertexFeature_;\n if (!vertexFeature) {\n vertexFeature = new Feature(new Point(coordinates));\n this.vertexFeature_ = vertexFeature;\n this.overlay_.getSource().addFeature(vertexFeature);\n } else {\n const geometry = vertexFeature.getGeometry();\n geometry.setCoordinates(coordinates);\n }\n vertexFeature.set('features', features);\n vertexFeature.set('geometries', geometries);\n vertexFeature.set('existing', existing);\n return vertexFeature;\n }\n\n /**\n * Handles the {@link module:ol/MapBrowserEvent~MapBrowserEvent map browser event} and may modify the geometry.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} `false` to stop event propagation.\n * @override\n */\n handleEvent(mapBrowserEvent) {\n if (!mapBrowserEvent.originalEvent) {\n return true;\n }\n this.lastPointerEvent_ = mapBrowserEvent;\n\n let handled;\n if (\n !mapBrowserEvent.map.getView().getInteracting() &&\n mapBrowserEvent.type == MapBrowserEventType.POINTERMOVE &&\n !this.handlingDownUpSequence\n ) {\n this.handlePointerMove_(mapBrowserEvent);\n }\n if (this.vertexFeature_ && this.deleteCondition_(mapBrowserEvent)) {\n if (\n mapBrowserEvent.type != MapBrowserEventType.SINGLECLICK ||\n !this.ignoreNextSingleClick_\n ) {\n handled = this.removePoint();\n } else {\n handled = true;\n }\n }\n\n if (mapBrowserEvent.type == MapBrowserEventType.SINGLECLICK) {\n this.ignoreNextSingleClick_ = false;\n }\n\n return super.handleEvent(mapBrowserEvent) && !handled;\n }\n\n findInsertVerticesAndUpdateDragSegments_(pixelCoordinate) {\n this.handlePointerAtPixel_(pixelCoordinate);\n this.dragSegments_.length = 0;\n this.featuresBeingModified_ = null;\n const vertexFeature = this.vertexFeature_;\n if (!vertexFeature) {\n return;\n }\n\n const projection = this.getMap().getView().getProjection();\n const insertVertices = [];\n const vertex = vertexFeature.getGeometry().getCoordinates();\n const vertexExtent = boundingExtent([vertex]);\n const segmentDataMatches = this.rBush_.getInExtent(vertexExtent);\n const componentSegments = {};\n segmentDataMatches.sort(compareIndexes);\n for (let i = 0, ii = segmentDataMatches.length; i < ii; ++i) {\n const segmentDataMatch = segmentDataMatches[i];\n const segment = segmentDataMatch.segment;\n let uid = getUid(segmentDataMatch.geometry);\n const depth = segmentDataMatch.depth;\n if (depth) {\n uid += '-' + depth.join('-'); // separate feature components\n }\n if (!componentSegments[uid]) {\n componentSegments[uid] = new Array(2);\n }\n\n if (\n segmentDataMatch.geometry.getType() === 'Circle' &&\n segmentDataMatch.index === CIRCLE_CIRCUMFERENCE_INDEX\n ) {\n const closestVertex = closestOnSegmentData(\n pixelCoordinate,\n segmentDataMatch,\n projection,\n );\n if (\n coordinatesEqual(closestVertex, vertex) &&\n !componentSegments[uid][0]\n ) {\n this.dragSegments_.push([segmentDataMatch, 0]);\n componentSegments[uid][0] = segmentDataMatch;\n }\n continue;\n }\n\n if (coordinatesEqual(segment[0], vertex) && !componentSegments[uid][0]) {\n this.dragSegments_.push([segmentDataMatch, 0]);\n componentSegments[uid][0] = segmentDataMatch;\n continue;\n }\n\n if (coordinatesEqual(segment[1], vertex) && !componentSegments[uid][1]) {\n if (\n componentSegments[uid][0] &&\n componentSegments[uid][0].index === 0\n ) {\n let coordinates = segmentDataMatch.geometry.getCoordinates();\n switch (segmentDataMatch.geometry.getType()) {\n // prevent dragging closed linestrings by the connecting node\n case 'LineString':\n case 'MultiLineString':\n continue;\n // if dragging the first vertex of a polygon, ensure the other segment\n // belongs to the closing vertex of the linear ring\n case 'MultiPolygon':\n coordinates = coordinates[depth[1]];\n /* falls through */\n case 'Polygon':\n if (segmentDataMatch.index !== coordinates[depth[0]].length - 2) {\n continue;\n }\n break;\n default:\n // pass\n }\n }\n\n this.dragSegments_.push([segmentDataMatch, 1]);\n componentSegments[uid][1] = segmentDataMatch;\n continue;\n }\n\n if (\n getUid(segment) in this.vertexSegments_ &&\n !componentSegments[uid][0] &&\n !componentSegments[uid][1]\n ) {\n insertVertices.push(segmentDataMatch);\n }\n }\n\n return insertVertices;\n }\n\n /**\n * Handle pointer drag events.\n * @param {import(\"../MapBrowserEvent.js\").default} evt Event.\n * @override\n */\n handleDragEvent(evt) {\n this.ignoreNextSingleClick_ = false;\n this.willModifyFeatures_(\n evt,\n this.dragSegments_.map(([segment]) => segment),\n );\n\n const vertex = [\n evt.coordinate[0] + this.delta_[0],\n evt.coordinate[1] + this.delta_[1],\n ];\n const features = [];\n const geometries = [];\n for (let i = 0, ii = this.dragSegments_.length; i < ii; ++i) {\n const dragSegment = this.dragSegments_[i];\n const segmentData = dragSegment[0];\n const feature = segmentData.feature;\n if (!features.includes(feature)) {\n features.push(feature);\n }\n const geometry = segmentData.geometry;\n if (!geometries.includes(geometry)) {\n geometries.push(geometry);\n }\n const depth = segmentData.depth;\n let coordinates;\n const segment = segmentData.segment;\n const index = dragSegment[1];\n\n while (vertex.length < geometry.getStride()) {\n vertex.push(segment[index][vertex.length]);\n }\n\n switch (geometry.getType()) {\n case 'Point':\n coordinates = vertex;\n segment[0] = vertex;\n segment[1] = vertex;\n break;\n case 'MultiPoint':\n coordinates = geometry.getCoordinates();\n coordinates[segmentData.index] = vertex;\n segment[0] = vertex;\n segment[1] = vertex;\n break;\n case 'LineString':\n coordinates = geometry.getCoordinates();\n coordinates[segmentData.index + index] = vertex;\n segment[index] = vertex;\n break;\n case 'MultiLineString':\n coordinates = geometry.getCoordinates();\n coordinates[depth[0]][segmentData.index + index] = vertex;\n segment[index] = vertex;\n break;\n case 'Polygon':\n coordinates = geometry.getCoordinates();\n coordinates[depth[0]][segmentData.index + index] = vertex;\n segment[index] = vertex;\n break;\n case 'MultiPolygon':\n coordinates = geometry.getCoordinates();\n coordinates[depth[1]][depth[0]][segmentData.index + index] = vertex;\n segment[index] = vertex;\n break;\n case 'Circle':\n const circle = /** @type {import(\"../geom/Circle.js\").default} */ (\n geometry\n );\n segment[0] = vertex;\n segment[1] = vertex;\n if (segmentData.index === CIRCLE_CENTER_INDEX) {\n this.changingFeature_ = true;\n circle.setCenter(vertex);\n this.changingFeature_ = false;\n } else {\n // We're dragging the circle's circumference:\n this.changingFeature_ = true;\n const projection = evt.map.getView().getProjection();\n let radius = coordinateDistance(\n fromUserCoordinate(circle.getCenter(), projection),\n fromUserCoordinate(vertex, projection),\n );\n const userProjection = getUserProjection();\n if (userProjection) {\n const circleGeometry = circle\n .clone()\n .transform(userProjection, projection);\n circleGeometry.setRadius(radius);\n radius = circleGeometry\n .transform(projection, userProjection)\n .getRadius();\n }\n circle.setRadius(radius);\n this.changingFeature_ = false;\n }\n break;\n default:\n // pass\n }\n\n if (coordinates) {\n this.setGeometryCoordinates_(geometry, coordinates);\n }\n }\n this.createOrUpdateVertexFeature_(vertex, features, geometries, true);\n }\n\n /**\n * Handle pointer down events.\n * @param {import(\"../MapBrowserEvent.js\").default} evt Event.\n * @return {boolean} If the event was consumed.\n * @override\n */\n handleDownEvent(evt) {\n if (!this.condition_(evt)) {\n return false;\n }\n const pixelCoordinate = evt.coordinate;\n const insertVertices =\n this.findInsertVerticesAndUpdateDragSegments_(pixelCoordinate);\n\n if (insertVertices?.length && this.insertVertexCondition_(evt)) {\n this.willModifyFeatures_(evt, insertVertices);\n\n if (this.vertexFeature_) {\n const vertex = this.vertexFeature_.getGeometry().getCoordinates();\n for (let j = insertVertices.length - 1; j >= 0; --j) {\n this.insertVertex_(insertVertices[j], vertex);\n }\n this.ignoreNextSingleClick_ = true;\n }\n }\n\n return !!this.vertexFeature_;\n }\n\n /**\n * Handle pointer up events.\n * @param {import(\"../MapBrowserEvent.js\").default} evt Event.\n * @return {boolean} If the event was consumed.\n * @override\n */\n handleUpEvent(evt) {\n for (let i = this.dragSegments_.length - 1; i >= 0; --i) {\n const segmentData = this.dragSegments_[i][0];\n const geometry = segmentData.geometry;\n if (geometry.getType() === 'Circle') {\n const circle = /** @type {import(\"../geom/Circle.js\").default} */ (\n geometry\n );\n // Update a circle object in the R* bush:\n const coordinates = circle.getCenter();\n const centerSegmentData = segmentData.featureSegments[0];\n const circumferenceSegmentData = segmentData.featureSegments[1];\n centerSegmentData.segment[0] = coordinates;\n centerSegmentData.segment[1] = coordinates;\n circumferenceSegmentData.segment[0] = coordinates;\n circumferenceSegmentData.segment[1] = coordinates;\n this.rBush_.update(createExtent(coordinates), centerSegmentData);\n /** @type {import(\"../geom/Circle.js\").default | import(\"../geom/Polygon.js\").default} */\n let circleGeometry = circle;\n const userProjection = getUserProjection();\n if (userProjection) {\n const projection = evt.map.getView().getProjection();\n circleGeometry = circleGeometry\n .clone()\n .transform(userProjection, projection);\n circleGeometry = fromCircle(circleGeometry).transform(\n projection,\n userProjection,\n );\n }\n this.rBush_.update(\n circleGeometry.getExtent(),\n circumferenceSegmentData,\n );\n } else {\n this.rBush_.update(boundingExtent(segmentData.segment), segmentData);\n }\n }\n if (this.featuresBeingModified_) {\n this.dispatchEvent(\n new ModifyEvent(\n ModifyEventType.MODIFYEND,\n this.featuresBeingModified_,\n evt,\n ),\n );\n this.featuresBeingModified_ = null;\n }\n return false;\n }\n\n /**\n * @param {import(\"../MapBrowserEvent.js\").default} evt Event.\n * @private\n */\n handlePointerMove_(evt) {\n this.lastPixel_ = evt.pixel;\n this.handlePointerAtPixel_(evt.coordinate);\n }\n\n /**\n * @param {import(\"../coordinate.js\").Coordinate} pixelCoordinate The pixel Coordinate.\n * @private\n */\n handlePointerAtPixel_(pixelCoordinate) {\n const map = this.getMap();\n const pixel = map.getPixelFromCoordinate(pixelCoordinate);\n const projection = map.getView().getProjection();\n const sortByDistance = function (a, b) {\n return (\n projectedDistanceToSegmentDataSquared(pixelCoordinate, a, projection) -\n projectedDistanceToSegmentDataSquared(pixelCoordinate, b, projection)\n );\n };\n\n /** @type {Array<SegmentData>|undefined} */\n let nodes;\n /** @type {Point|undefined} */\n let hitPointGeometry;\n if (this.hitDetection_) {\n const layerFilter =\n typeof this.hitDetection_ === 'object'\n ? (layer) => layer === this.hitDetection_\n : undefined;\n map.forEachFeatureAtPixel(\n pixel,\n (feature, layer, geometry) => {\n if (geometry && geometry.getType() === 'Point') {\n geometry = new Point(\n toUserCoordinate(geometry.getCoordinates(), projection),\n );\n }\n const geom = geometry || feature.getGeometry();\n\n if (\n geom &&\n geom.getType() === 'Point' &&\n feature instanceof Feature &&\n this.features_.getArray().includes(feature)\n ) {\n hitPointGeometry = /** @type {Point} */ (geom);\n const coordinate = /** @type {Point} */ (feature.getGeometry())\n .getFlatCoordinates()\n .slice(0, 2);\n nodes = [\n {\n feature,\n geometry: hitPointGeometry,\n segment: [coordinate, coordinate],\n },\n ];\n }\n return true;\n },\n {layerFilter},\n );\n }\n if (!nodes) {\n const viewExtent = fromUserExtent(\n createExtent(pixelCoordinate, tempExtent),\n projection,\n );\n const buffer = map.getView().getResolution() * this.pixelTolerance_;\n const box = toUserExtent(\n bufferExtent(viewExtent, buffer, tempExtent),\n projection,\n );\n nodes = this.rBush_.getInExtent(box);\n }\n\n if (nodes && nodes.length > 0) {\n const node = nodes.sort(sortByDistance)[0];\n const closestSegment = node.segment;\n let vertex = closestOnSegmentData(pixelCoordinate, node, projection);\n const vertexPixel = map.getPixelFromCoordinate(vertex);\n let dist = coordinateDistance(pixel, vertexPixel);\n if (hitPointGeometry || dist <= this.pixelTolerance_) {\n /** @type {Object<string, boolean>} */\n const vertexSegments = {};\n vertexSegments[getUid(closestSegment)] = true;\n\n if (!this.snapToPointer_) {\n this.delta_[0] = vertex[0] - pixelCoordinate[0];\n this.delta_[1] = vertex[1] - pixelCoordinate[1];\n }\n if (\n node.geometry.getType() === 'Circle' &&\n node.index === CIRCLE_CIRCUMFERENCE_INDEX\n ) {\n this.snappedToVertex_ = true;\n this.createOrUpdateVertexFeature_(\n vertex,\n [node.feature],\n [node.geometry],\n this.snappedToVertex_,\n );\n } else {\n const pixel1 = map.getPixelFromCoordinate(closestSegment[0]);\n const pixel2 = map.getPixelFromCoordinate(closestSegment[1]);\n const squaredDist1 = squaredCoordinateDistance(vertexPixel, pixel1);\n const squaredDist2 = squaredCoordinateDistance(vertexPixel, pixel2);\n dist = Math.sqrt(Math.min(squaredDist1, squaredDist2));\n this.snappedToVertex_ = dist <= this.pixelTolerance_;\n // Stop and cleanup overlay vertex feature if a segment was hit and new vertex creation is not allowed by the insertVertexCondition\n if (\n !this.snappedToVertex_ &&\n !this.insertVertexCondition_(this.lastPointerEvent_)\n ) {\n if (this.vertexFeature_) {\n this.overlay_.getSource().removeFeature(this.vertexFeature_);\n this.vertexFeature_ = null;\n }\n return;\n }\n if (this.snappedToVertex_) {\n vertex =\n squaredDist1 > squaredDist2\n ? closestSegment[1]\n : closestSegment[0];\n }\n this.createOrUpdateVertexFeature_(\n vertex,\n [node.feature],\n [node.geometry],\n this.snappedToVertex_,\n );\n const geometries = {};\n geometries[getUid(node.geometry)] = true;\n for (let i = 1, ii = nodes.length; i < ii; ++i) {\n const segment = nodes[i].segment;\n if (\n (coordinatesEqual(closestSegment[0], segment[0]) &&\n coordinatesEqual(closestSegment[1], segment[1])) ||\n (coordinatesEqual(closestSegment[0], segment[1]) &&\n coordinatesEqual(closestSegment[1], segment[0]))\n ) {\n const geometryUid = getUid(nodes[i].geometry);\n if (!(geometryUid in geometries)) {\n geometries[geometryUid] = true;\n vertexSegments[getUid(segment)] = true;\n }\n } else {\n break;\n }\n }\n }\n\n this.vertexSegments_ = vertexSegments;\n return;\n }\n }\n if (this.vertexFeature_) {\n this.overlay_.getSource().removeFeature(this.vertexFeature_);\n this.vertexFeature_ = null;\n }\n }\n\n /**\n * @param {SegmentData} segmentData Segment data.\n * @param {import(\"../coordinate.js\").Coordinate} vertex Vertex.\n * @return {boolean} A vertex was inserted.\n * @private\n */\n insertVertex_(segmentData, vertex) {\n const segment = segmentData.segment;\n const feature = segmentData.feature;\n const geometry = segmentData.geometry;\n const depth = segmentData.depth;\n const index = segmentData.index;\n let coordinates;\n\n while (vertex.length < geometry.getStride()) {\n vertex.push(0);\n }\n\n switch (geometry.getType()) {\n case 'MultiLineString':\n coordinates = geometry.getCoordinates();\n coordinates[depth[0]].splice(index + 1, 0, vertex);\n break;\n case 'Polygon':\n coordinates = geometry.getCoordinates();\n coordinates[depth[0]].splice(index + 1, 0, vertex);\n break;\n case 'MultiPolygon':\n coordinates = geometry.getCoordinates();\n coordinates[depth[1]][depth[0]].splice(index + 1, 0, vertex);\n break;\n case 'LineString':\n coordinates = geometry.getCoordinates();\n coordinates.splice(index + 1, 0, vertex);\n break;\n default:\n return false;\n }\n\n this.setGeometryCoordinates_(geometry, coordinates);\n const rTree = this.rBush_;\n rTree.remove(segmentData);\n this.updateSegmentIndices_(geometry, index, depth, 1);\n\n /** @type {SegmentData} */\n const newSegmentData = {\n segment: [segment[0], vertex],\n feature: feature,\n geometry: geometry,\n depth: depth,\n index: index,\n };\n\n rTree.insert(boundingExtent(newSegmentData.segment), newSegmentData);\n this.dragSegments_.push([newSegmentData, 1]);\n\n /** @type {SegmentData} */\n const newSegmentData2 = {\n segment: [vertex, segment[1]],\n feature: feature,\n geometry: geometry,\n depth: depth,\n index: index + 1,\n };\n\n rTree.insert(boundingExtent(newSegmentData2.segment), newSegmentData2);\n this.dragSegments_.push([newSegmentData2, 0]);\n return true;\n }\n\n updatePointer_(coordinate) {\n if (coordinate) {\n this.findInsertVerticesAndUpdateDragSegments_(coordinate);\n }\n return this.vertexFeature_?.getGeometry().getCoordinates();\n }\n\n /**\n * Get the current pointer position.\n * @return {import(\"../coordinate.js\").Coordinate | null} The current pointer coordinate.\n */\n getPoint() {\n const coordinate = this.vertexFeature_?.getGeometry().getCoordinates();\n if (!coordinate) {\n return null;\n }\n return toUserCoordinate(\n coordinate,\n this.getMap().getView().getProjection(),\n );\n }\n\n /**\n * Check if a point can be removed from the current linestring or polygon at the current\n * pointer position.\n * @return {boolean} A point can be deleted at the current pointer position.\n * @api\n */\n canRemovePoint() {\n if (!this.vertexFeature_) {\n return false;\n }\n if (\n this.vertexFeature_\n .get('geometries')\n .every(\n (geometry) =>\n geometry.getType() === 'Circle' ||\n geometry.getType().endsWith('Point'),\n )\n ) {\n return false;\n }\n const coordinate = this.vertexFeature_.getGeometry().getCoordinates();\n const segments = this.rBush_.getInExtent(boundingExtent([coordinate]));\n return segments.some(\n ({segment}) =>\n coordinatesEqual(segment[0], coordinate) ||\n coordinatesEqual(segment[1], coordinate),\n );\n }\n\n /**\n * Removes the vertex currently being pointed from the current linestring or polygon.\n * @param {import('../coordinate.js').Coordinate} [coordinate] If provided, the pointer\n * will be set to the provided coordinate. If not, the current pointer coordinate will be used.\n * @return {boolean} True when a vertex was removed.\n * @api\n */\n removePoint(coordinate) {\n if (coordinate) {\n coordinate = fromUserCoordinate(\n coordinate,\n this.getMap().getView().getProjection(),\n );\n this.updatePointer_(coordinate);\n }\n if (\n !this.lastPointerEvent_ ||\n (this.lastPointerEvent_ &&\n this.lastPointerEvent_.type != MapBrowserEventType.POINTERDRAG)\n ) {\n const evt = this.lastPointerEvent_;\n this.willModifyFeatures_(\n evt,\n this.dragSegments_.map(([segment]) => segment),\n );\n const removed = this.removeVertex_();\n if (this.featuresBeingModified_) {\n this.dispatchEvent(\n new ModifyEvent(\n ModifyEventType.MODIFYEND,\n this.featuresBeingModified_,\n evt,\n ),\n );\n }\n\n this.featuresBeingModified_ = null;\n return removed;\n }\n return false;\n }\n\n /**\n * Removes a vertex from all matching features.\n * @return {boolean} True when a vertex was removed.\n * @private\n */\n removeVertex_() {\n const dragSegments = this.dragSegments_;\n const segmentsByFeature = {};\n let deleted = false;\n let component, coordinates, dragSegment, geometry, i, index, left;\n let newIndex, right, segmentData, uid;\n for (i = dragSegments.length - 1; i >= 0; --i) {\n dragSegment = dragSegments[i];\n segmentData = dragSegment[0];\n uid = getUid(segmentData.feature);\n if (segmentData.depth) {\n // separate feature components\n uid += '-' + segmentData.depth.join('-');\n }\n if (!(uid in segmentsByFeature)) {\n segmentsByFeature[uid] = {};\n }\n if (dragSegment[1] === 0) {\n segmentsByFeature[uid].right = segmentData;\n segmentsByFeature[uid].index = segmentData.index;\n } else if (dragSegment[1] == 1) {\n segmentsByFeature[uid].left = segmentData;\n segmentsByFeature[uid].index = segmentData.index + 1;\n }\n }\n for (uid in segmentsByFeature) {\n right = segmentsByFeature[uid].right;\n left = segmentsByFeature[uid].left;\n index = segmentsByFeature[uid].index;\n newIndex = index - 1;\n if (left !== undefined) {\n segmentData = left;\n } else {\n segmentData = right;\n }\n if (newIndex < 0) {\n newIndex = 0;\n }\n geometry = segmentData.geometry;\n coordinates = geometry.getCoordinates();\n component = coordinates;\n deleted = false;\n switch (geometry.getType()) {\n case 'MultiLineString':\n if (coordinates[segmentData.depth[0]].length > 2) {\n coordinates[segmentData.depth[0]].splice(index, 1);\n deleted = true;\n }\n break;\n case 'LineString':\n if (coordinates.length > 2) {\n coordinates.splice(index, 1);\n deleted = true;\n }\n break;\n case 'MultiPolygon':\n component = component[segmentData.depth[1]];\n /* falls through */\n case 'Polygon':\n component = component[segmentData.depth[0]];\n if (component.length > 4) {\n if (index == component.length - 1) {\n index = 0;\n }\n component.splice(index, 1);\n deleted = true;\n if (index === 0) {\n // close the ring again\n component.pop();\n component.push(component[0]);\n newIndex = component.length - 1;\n }\n }\n break;\n default:\n // pass\n }\n\n if (deleted) {\n this.setGeometryCoordinates_(geometry, coordinates);\n const segments = [];\n if (left !== undefined) {\n this.rBush_.remove(left);\n segments.push(left.segment[0]);\n }\n if (right !== undefined) {\n this.rBush_.remove(right);\n segments.push(right.segment[1]);\n }\n if (left !== undefined && right !== undefined) {\n /** @type {SegmentData} */\n const newSegmentData = {\n depth: segmentData.depth,\n feature: segmentData.feature,\n geometry: segmentData.geometry,\n index: newIndex,\n segment: segments,\n };\n\n this.rBush_.insert(\n boundingExtent(newSegmentData.segment),\n newSegmentData,\n );\n }\n this.updateSegmentIndices_(geometry, index, segmentData.depth, -1);\n if (this.vertexFeature_) {\n this.overlay_.getSource().removeFeature(this.vertexFeature_);\n this.vertexFeature_ = null;\n }\n dragSegments.length = 0;\n }\n }\n return deleted;\n }\n\n /**\n * Check if a point can be inserted to the current linestring or polygon at the current\n * pointer position.\n * @return {boolean} A point can be inserted at the current pointer position.\n * @api\n */\n canInsertPoint() {\n if (!this.vertexFeature_) {\n return false;\n }\n if (\n this.vertexFeature_\n .get('geometries')\n .every(\n (geometry) =>\n geometry.getType() === 'Circle' ||\n geometry.getType().endsWith('Point'),\n )\n ) {\n return false;\n }\n const coordinate = this.vertexFeature_.getGeometry().getCoordinates();\n const segments = this.rBush_.getInExtent(boundingExtent([coordinate]));\n return segments.some(\n ({segment}) =>\n !(\n coordinatesEqual(segment[0], coordinate) ||\n coordinatesEqual(segment[1], coordinate)\n ),\n );\n }\n\n /**\n * Inserts the vertex currently being pointed to the current linestring or polygon.\n * @param {import('../coordinate.js').Coordinate} [coordinate] If provided, the pointer\n * will be set to the provided coordinate. If not, the current pointer coordinate will be used.\n * @return {boolean} A vertex was inserted.\n * @api\n */\n insertPoint(coordinate) {\n const pixelCoordinate = coordinate\n ? fromUserCoordinate(coordinate, this.getMap().getView().getProjection())\n : this.vertexFeature_?.getGeometry().getCoordinates();\n if (!pixelCoordinate) {\n return false;\n }\n const insertVertices =\n this.findInsertVerticesAndUpdateDragSegments_(pixelCoordinate);\n return insertVertices.reduce(\n (prev, segmentData) =>\n prev || this.insertVertex_(segmentData, pixelCoordinate),\n false,\n );\n }\n\n /**\n * @param {import(\"../geom/SimpleGeometry.js\").default} geometry Geometry.\n * @param {Array} coordinates Coordinates.\n * @private\n */\n setGeometryCoordinates_(geometry, coordinates) {\n this.changingFeature_ = true;\n geometry.setCoordinates(coordinates);\n this.changingFeature_ = false;\n }\n\n /**\n * @param {import(\"../geom/SimpleGeometry.js\").default} geometry Geometry.\n * @param {number} index Index.\n * @param {Array<number>|undefined} depth Depth.\n * @param {number} delta Delta (1 or -1).\n * @private\n */\n updateSegmentIndices_(geometry, index, depth, delta) {\n this.rBush_.forEachInExtent(\n geometry.getExtent(),\n function (segmentDataMatch) {\n if (\n segmentDataMatch.geometry === geometry &&\n (depth === undefined ||\n segmentDataMatch.depth === undefined ||\n equals(segmentDataMatch.depth, depth)) &&\n segmentDataMatch.index > index\n ) {\n segmentDataMatch.index += delta;\n }\n },\n );\n }\n}\n\n/**\n * @param {SegmentData} a The first segment data.\n * @param {SegmentData} b The second segment data.\n * @return {number} The difference in indexes.\n */\nfunction compareIndexes(a, b) {\n return a.index - b.index;\n}\n\n/**\n * Returns the distance from a point to a line segment.\n *\n * @param {import(\"../coordinate.js\").Coordinate} pointCoordinates The coordinates of the point from\n * which to calculate the distance.\n * @param {SegmentData} segmentData The object describing the line\n * segment we are calculating the distance to.\n * @param {import(\"../proj/Projection.js\").default} projection The view projection.\n * @return {number} The square of the distance between a point and a line segment.\n */\nfunction projectedDistanceToSegmentDataSquared(\n pointCoordinates,\n segmentData,\n projection,\n) {\n const geometry = segmentData.geometry;\n\n if (geometry.getType() === 'Circle') {\n let circleGeometry = /** @type {import(\"../geom/Circle.js\").default} */ (\n geometry\n );\n\n if (segmentData.index === CIRCLE_CIRCUMFERENCE_INDEX) {\n const userProjection = getUserProjection();\n if (userProjection) {\n circleGeometry = circleGeometry\n .clone()\n .transform(userProjection, projection);\n }\n const distanceToCenterSquared = squaredCoordinateDistance(\n circleGeometry.getCenter(),\n fromUserCoordinate(pointCoordinates, projection),\n );\n const distanceToCircumference =\n Math.sqrt(distanceToCenterSquared) - circleGeometry.getRadius();\n return distanceToCircumference * distanceToCircumference;\n }\n }\n\n const coordinate = fromUserCoordinate(pointCoordinates, projection);\n tempSegment[0] = fromUserCoordinate(segmentData.segment[0], projection);\n tempSegment[1] = fromUserCoordinate(segmentData.segment[1], projection);\n return squaredDistanceToSegment(coordinate, tempSegment);\n}\n\n/**\n * Returns the point closest to a given line segment.\n *\n * @param {import(\"../coordinate.js\").Coordinate} pointCoordinates The point to which a closest point\n * should be found.\n * @param {SegmentData} segmentData The object describing the line\n * segment which should contain the closest point.\n * @param {import(\"../proj/Projection.js\").default} projection The view projection.\n * @return {import(\"../coordinate.js\").Coordinate} The point closest to the specified line segment.\n */\nfunction closestOnSegmentData(pointCoordinates, segmentData, projection) {\n const geometry = segmentData.geometry;\n\n if (\n geometry.getType() === 'Circle' &&\n segmentData.index === CIRCLE_CIRCUMFERENCE_INDEX\n ) {\n let circleGeometry = /** @type {import(\"../geom/Circle.js\").default} */ (\n geometry\n );\n const userProjection = getUserProjection();\n if (userProjection) {\n circleGeometry = circleGeometry\n .clone()\n .transform(userProjection, projection);\n }\n return toUserCoordinate(\n circleGeometry.getClosestPoint(\n fromUserCoordinate(pointCoordinates, projection),\n ),\n projection,\n );\n }\n const coordinate = fromUserCoordinate(pointCoordinates, projection);\n tempSegment[0] = fromUserCoordinate(segmentData.segment[0], projection);\n tempSegment[1] = fromUserCoordinate(segmentData.segment[1], projection);\n return toUserCoordinate(\n closestOnSegment(coordinate, tempSegment),\n projection,\n );\n}\n\n/**\n * @return {import(\"../style/Style.js\").StyleFunction} Styles.\n */\nfunction getDefaultStyleFunction() {\n const style = createEditingStyle();\n return function (feature, resolution) {\n return style['Point'];\n };\n}\n\nexport default Modify;\n"],"names":[],"sourceRoot":""}
|
|
1
|
+
{"version":3,"file":"vendors-node_modules_vaadin_map_node_modules_ol_interaction_Modify_js.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AAC0C;AACkB;AACxB;AACwB;AACR;AACjB;AAOT;AACa;AACQ;AAOf;AAKV;AACe;AACS;AACD;AAOzB;AAC2B;AACY;AACnB;AACa;AACnB;AACY;AAMxB;;AAEtB;AACA;AACA;AACA,UAAU;AACV;AACA;;AAEA;AACA;AACA;AACA,UAAU;AACV;AACA;;AAEA;AACA;;AAEA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,aAAa,QAAQ;AACrB,cAAc,eAAe;AAC7B,cAAc,SAAS;AACvB,cAAc,6CAA6C;AAC3D,cAAc,QAAQ;AACtB,cAAc,sBAAsB;AACpC,cAAc,oBAAoB;AAClC;;AAEA;AACA,4BAA4B,iCAAiC;AAC7D;AACA,aAAa,2BAA2B;AACxC;;AAEA;AACA,aAAa,uBAAuB;AACpC;;AAEA;AACA,aAAa,QAAQ;AACrB,cAAc,4CAA4C;AAC1D,YAAY,iDAAiD;AAC7D;AACA;AACA,IAAI,+CAA+C;AACnD,cAAc,4CAA4C;AAC1D,iBAAiB,iDAAiD;AAClE;AACA,IAAI,8CAA8C;AAClD,IAAI,6CAA6C;AACjD;AACA;AACA,YAAY,0BAA0B;AACtC;AACA;AACA;AACA;AACA;AACA,cAAc,4CAA4C;AAC1D,0BAA0B,iDAAiD;AAC3E;AACA,yBAAyB,wCAAwC;AACjE,cAAc,QAAQ;AACtB;AACA,cAAc,gFAAgF;AAC9F;AACA;AACA,kEAAkE,kCAAkC;AACpG;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,cAAc;AAC5B;AACA;AACA,cAAc,kDAAkD;AAChE;AACA,2DAA2D,kDAAkD;AAC7G;AACA,cAAc,qBAAqB;AACnC;AACA;AACA,cAAc,gBAAgB,kCAAkC;AAChE;AACA,cAAc,oDAAoD;AAClE;AACA,cAAc,cAAc;AAC5B;AACA;AACA,cAAc,SAAS;AACvB;AACA,cAAc,SAAS;AACvB;AACA,cAAc,iGAAiG;AAC/G;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,sBAAsB,2CAA2C;AACjE;AACA;AACO,0BAA0B,wDAAK;AACtC;AACA,aAAa,iBAAiB;AAC9B,aAAa,qBAAqB;AAClC;AACA,aAAa,yCAAyC;AACtD,iBAAiB,gDAAgD;AACjE;AACA;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA,mBAAmB,gDAAgD;AACnE,cAAc;AACd;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,2DAA2D;AAC3D;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,mDAAkB;AACvC;AACA,aAAa,SAAS;AACtB;AACA;AACA,qBAAqB,gCAAgC;;AAErD;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,cAAc;AACd;AACA;;AAEA;AACA,cAAc;AACd;AACA;;AAEA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA,8DAA8D,+DAAa;;AAE3E;AACA;AACA,eAAe,yCAAyC;AACxD,gBAAgB,SAAS;AACzB;AACA;AACA,aAAa,gEAAU,qBAAqB,iEAAW;AACvD;;AAEA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA,QAAQ,wDAAM;;AAEd;AACA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA,8BAA8B,2BAA2B;AACzD,cAAc;AACd;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;AACA,sBAAsB,yDAAK;;AAE3B;AACA,cAAc;AACd;AACA;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;AACA,wBAAwB,wDAAW;AACnC,kBAAkB,yDAAY;AAC9B;AACA;AACA,OAAO;AACP;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA,wBAAwB;;AAExB;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA,QAAQ,kDAAgB;;AAExB;AACA;AACA;AACA;AACA;AACA,eAAe,gBAAgB;AAC/B;AACA;AACA;AACA;AACA;AACA,QAAQ,mEAAuB;AAC/B;AACA;AACA;AACA,QAAQ,sEAA0B;AAClC;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA,QAAQ,6EAA0B;AAClC;AACA;AACA;AACA,QAAQ,gFAA6B;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,oEAAgB;AAC/C;AACA;AACA;AACA,UAAU,2EAA8B;AACxC;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAc;AACd;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa,oDAAoD;AACjE;AACA;AACA;AACA;AACA;AACA,kBAAkB,uDAAK;AACvB,MAAM;AACN,kBAAkB,wDAAM;AACxB,MAAM;AACN;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,SAAS;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,aAAa,yCAAyC;AACtD,aAAa,oBAAoB;AACjC;AACA;AACA;AACA;AACA,wCAAwC,uDAAU;AAClD;AACA,4CAA4C,QAAQ;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa,SAAS;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,aAAa,SAAS;AACtB;AACA;AACA;AACA;AACA,eAAe,oBAAoB;AACnC;AACA;AACA;AACA,iBAAiB,aAAa;AAC9B;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,2CAA2C,QAAQ;AACnD;AACA,kDAAkD,QAAQ;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,SAAS;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa,6BAA6B;AAC1C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAc,aAAa;AAC3B;AACA;AACA;AACA;AACA;;AAEA;AACA,aAAa,iDAAiD;AAC9D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,aAAa,iDAAiD;AAC9D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,aAAa,4CAA4C;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,aAAa,4CAA4C;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa,SAAS;AACtB;AACA;AACA,6BAA6B,oEAAgB;AAC7C;AACA;AACA;AACA,QAAQ,2EAA8B;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa,SAAS;AACtB;AACA;AACA,gCAAgC,oEAAgB;AAChD;AACA;AACA,QAAQ,2EAA8B;AACtC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,aAAa,2EAA2E;AACxF;AACA;AACA;AACA;AACA,iCAAiC,SAAS;AAC1C;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,aAAa,SAAS;AACtB,aAAa,OAAO;AACpB;AACA;AACA;AACA;;AAEA,eAAe,aAAa;AAC5B;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA,aAAa,SAAS;AACtB,aAAa,yCAAyC;AACtD;AACA;AACA;AACA;AACA,wCAAwC,QAAQ;AAChD;;AAEA,iBAAiB,aAAa;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,aAAa,SAAS;AACtB,aAAa,yCAAyC;AACtD;AACA;AACA;AACA;AACA,iDAAiD,QAAQ;AACzD;;AAEA,iBAAiB,aAAa;AAC9B;AACA;AACA;AACA;AACA;AACA;;AAEA,yBAAyB,2DAAc;AACvC;AACA;;AAEA;AACA,aAAa,SAAS;AACtB,aAAa,8CAA8C;AAC3D;AACA;AACA;AACA;AACA,uCAAuC,QAAQ;AAC/C;AACA,mDAAmD,QAAQ;AAC3D;;AAEA,mBAAmB,aAAa;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,2BAA2B,2DAAc;AACzC;AACA;AACA;;AAEA;AACA,aAAa,SAAS;AACtB,aAAa,sCAAsC;AACnD;AACA;AACA;AACA;AACA,uCAAuC,QAAQ;AAC/C;AACA,mDAAmD,QAAQ;AAC3D;;AAEA,mBAAmB,aAAa;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,2BAA2B,2DAAc;AACzC;AACA;AACA;;AAEA;AACA,aAAa,SAAS;AACtB,aAAa,2CAA2C;AACxD;AACA;AACA;AACA;AACA,0CAA0C,QAAQ;AAClD;AACA,yCAAyC,QAAQ;AACjD;AACA,qDAAqD,QAAQ;AAC7D;;AAEA,qBAAqB,aAAa;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,6BAA6B,2DAAc;AAC3C;AACA;AACA;AACA;;AAEA;AACA;AACA,MAAM,2BAA2B;AACjC;AACA,MAAM,kCAAkC;AACxC;AACA;AACA,aAAa,SAAS;AACtB,aAAa,qCAAqC;AAClD;AACA;AACA;AACA;;AAEA,eAAe,aAAa;AAC5B;AACA;AACA;AACA;AACA;AACA;;AAEA,eAAe,aAAa;AAC5B;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,uBAAuB,yEAAY;AACnC,oCAAoC,uCAAuC;AAC3E;AACA;AACA,2BAA2B,2DAAiB;AAC5C;AACA;AACA;AACA;AACA;AACA,uBAAuB,6DAAU;AACjC,mBAAmB,qCAAqC;AACxD;AACA;AACA;AACA;;AAEA;AACA,aAAa,SAAS;AACtB,aAAa,iDAAiD;AAC9D;AACA;AACA;AACA;AACA,oBAAoB,uBAAuB;AAC3C;AACA;AACA;AACA;AACA;;AAEA;AACA,aAAa,uCAAuC;AACpD,aAAa,gBAAgB;AAC7B,aAAa,oDAAoD;AACjE,aAAa,SAAS;AACtB,cAAc,SAAS;AACvB;AACA;AACA;AACA;AACA;AACA,0BAA0B,oDAAO,KAAK,uDAAK;AAC3C;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,kBAAkB,mEAAmE;AACrF,aAAa,yCAAyC;AACtD,cAAc,SAAS;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,8BAA8B,4EAA+B;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC,4EAA+B;AAC/D;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;;AAEA,gCAAgC,4EAA+B;AAC/D;AACA;;AAEA;AACA;;AAEA;AACA,aAAa,uCAAuC;AACpD,cAAc,8BAA8B;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,eAAe,oBAAoB;AACnC;AACA;AACA,yBAAyB,2DAAc;AACvC;AACA;AACA;AACA,oDAAoD,QAAQ;AAC5D;AACA;AACA,gBAAgB,iDAAM;AACtB;AACA;AACA,sCAAsC;AACtC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,QAAQ,iDAAM;AACd;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,wBAAwB;AACxB;;AAEA;AACA;AACA;AACA,6BAA6B,4BAA4B;AACzD,aAAa,QAAQ;AACrB,aAAa,QAAQ;AACrB,cAAc,SAAS;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,yCAAyC;AACtD,cAAc,iDAAiD;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,UAAU,wDAAkB;AAC5B;AACA;AACA;;AAEA,+BAA+B,kEAAoB;AACnD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,0BAA0B,mEAAqB;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmB,2DAAc;AACjC;AACA;AACA;;AAEA;AACA;AACA,aAAa,yCAAyC;AACtD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,oBAAoB,6DAAe;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,aAAa,oCAAoC;AACjD,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,+CAA+C,uBAAuB;AACtE;AACA,aAAa,aAAa;AAC1B;AACA,aAAa,QAAQ;AACrB,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU,kDAAM;AAChB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,aAAa,QAAQ;AACrB,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,aAAa,oCAAoC;AACjD,aAAa,QAAQ;AACrB,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,UAAU;AACpC,4BAA4B,2DAAa;AACzC;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,UAAU;AACpC,4BAA4B,2DAAa;AACzC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,aAAa,uCAAuC;AACpD,aAAa,aAAa;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,oBAAoB,YAAY;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA,YAAY;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC,qCAAqC;AACvE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA,uBAAuB,wDAAkB;AACzC,YAAY,4DAAkB;AAC9B,YAAY,4DAAkB;AAC9B;AACA,iCAAiC,2DAAiB;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,yCAAyC;AACtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU,wDAAkB;AAC5B,YAAY,gEAAgB;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oDAAoD,QAAQ;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,yCAAyC;AACtD,cAAc,SAAS;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,gDAAgD,QAAQ;AACxD;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,aAAa,yCAAyC;AACtD,cAAc,SAAS;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gDAAgD,QAAQ;AACxD;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC,qCAAqC;AACvE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,yEAAY;AACvC,mBAAmB,4EAA4E;AAC/F;AACA,+BAA+B,2DAAiB;AAChD;AACA;AACA;AACA;AACA;AACA,2BAA2B,6DAAU;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR,2BAA2B,2DAAc;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,aAAa,yCAAyC;AACtD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,aAAa,uCAAuC;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,eAAe,8BAA8B;AAC7C;AACA,eAAe,iBAAiB;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,uDAAK;AAChC,cAAc,0DAAgB;AAC9B;AACA;AACA;;AAEA;AACA;AACA;AACA,+BAA+B,oDAAO;AACtC;AACA;AACA,0CAA0C,OAAO;AACjD,0CAA0C,OAAO;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe;AACf;AACA;AACA;AACA,SAAS;AACT,SAAS,YAAY;AACrB;AACA;AACA;AACA,yBAAyB,wDAAc;AACvC,QAAQ,yEAAY;AACpB;AACA;AACA;AACA,kBAAkB,sDAAY;AAC9B,QAAQ,mDAAY;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iBAAiB,wDAAkB;AACnC;AACA,mBAAmB,yBAAyB;AAC5C;AACA,uBAAuB,iDAAM;;AAE7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA,+BAA+B,+DAAyB;AACxD,+BAA+B,+DAAyB;AACxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,iDAAM;AAC3B,6CAA6C,QAAQ;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAkC,iDAAM;AACxC;AACA;AACA,+BAA+B,iDAAM;AACrC;AACA,cAAc;AACd;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,aAAa,aAAa;AAC1B,aAAa,uCAAuC;AACpD,cAAc,SAAS;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,eAAe,aAAa;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,iBAAiB,2DAAc;AAC/B;;AAEA,eAAe,aAAa;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,iBAAiB,2DAAc;AAC/B;AACA;AACA;;AAEA;AACA,aAAa,uCAAuC;AACpD,cAAc,uCAAuC;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAc,8CAA8C;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,0DAAgB;AAC3B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAc,SAAS;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6CAA6C,2DAAc;AAC3D;AACA,QAAQ,QAAQ;AAChB;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,uCAAuC;AACpD;AACA,cAAc,SAAS;AACvB;AACA;AACA;AACA;AACA,mBAAmB,4DAAkB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,4EAA+B;AACtE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAc,SAAS;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC,QAAQ;AAC9C;AACA;AACA,YAAY,iDAAM;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,aAAa;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,YAAY,2DAAc;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAc,SAAS;AACvB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6CAA6C,2DAAc;AAC3D;AACA,QAAQ,QAAQ;AAChB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,uCAAuC;AACpD;AACA,cAAc,SAAS;AACvB;AACA;AACA;AACA;AACA,QAAQ,4DAAkB;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,aAAa,6CAA6C;AAC1D,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,aAAa,6CAA6C;AAC1D,aAAa,QAAQ;AACrB,aAAa,yBAAyB;AACtC,aAAa,QAAQ;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,kDAAM;AAClB;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,mEAAuB;AAC/B;AACA;AACA;AACA,QAAQ,sEAA0B;AAClC;AACA;AACA;AACA;AACA;AACA;AACA,UAAU,oEAAgB;AAC1B;AACA;AACA;AACA;AACA,YAAY,2EAA8B;AAC1C;AACA;AACA;AACA;AACA,MAAM;AACN;AACA,QAAQ,6EAA0B;AAClC;AACA;AACA;AACA,QAAQ,gFAA6B;AACrC;AACA;AACA;AACA;AACA;AACA;AACA,UAAU,oEAAgB;AAC1B;AACA;AACA;AACA;AACA,YAAY,2EAA8B;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,WAAW,aAAa;AACxB,WAAW,aAAa;AACxB,YAAY,QAAQ;AACpB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,uCAAuC;AAClD;AACA,WAAW,aAAa;AACxB;AACA,WAAW,yCAAyC;AACpD,YAAY,QAAQ;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,oCAAoC,qCAAqC;AACzE;AACA;;AAEA;AACA,6BAA6B,2DAAiB;AAC9C;AACA;AACA;AACA;AACA;AACA,sCAAsC,+DAAyB;AAC/D;AACA,QAAQ,4DAAkB;AAC1B;AACA;AACA;AACA;AACA;AACA;;AAEA,qBAAqB,4DAAkB;AACvC,mBAAmB,4DAAkB;AACrC,mBAAmB,4DAAkB;AACrC,SAAS,wEAAwB;AACjC;;AAEA;AACA;AACA;AACA,WAAW,uCAAuC;AAClD;AACA,WAAW,aAAa;AACxB;AACA,WAAW,yCAAyC;AACpD,YAAY,uCAAuC;AACnD;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,oCAAoC,qCAAqC;AACzE;AACA;AACA,2BAA2B,2DAAiB;AAC5C;AACA;AACA;AACA;AACA;AACA,WAAW,0DAAgB;AAC3B;AACA,QAAQ,4DAAkB;AAC1B;AACA;AACA;AACA;AACA,qBAAqB,4DAAkB;AACvC,mBAAmB,4DAAkB;AACrC,mBAAmB,4DAAkB;AACrC,SAAS,0DAAgB;AACzB,IAAI,gEAAgB;AACpB;AACA;AACA;;AAEA;AACA,YAAY,2CAA2C;AACvD;AACA;AACA,gBAAgB,oEAAkB;AAClC;AACA;AACA;AACA;;AAEA,iEAAe,MAAM,EAAC;;;;;;;;;;;;;;;;;AC5/EtB;AACA;AACA;AAC0E;AAC5B;;AAE9C;AACA,cAAc,oDAAoD;AAClE,cAAc,qCAAqC;AACnD,aAAa,QAAQ;AACrB,cAAc,QAAQ;AACtB,cAAc,QAAQ;AACtB,cAAc,SAAS;AACvB,cAAc,+BAA+B;AAC7C;AACA,cAAc,QAAQ;AACtB;AACA;AACA;AACA,cAAc,QAAQ;AACtB;AACA,cAAc,QAAQ;AACtB;AACA,cAAc,QAAQ;AACtB;AACA,cAAc,QAAQ;AACtB;AACA,cAAc,sCAAsC;AACpD;AACA;AACA,cAAc,QAAQ;AACtB;AACA;AACA,cAAc,kBAAkB;AAChC,cAAc,6BAA6B;AAC3C;AACA;AACA,wBAAwB,2CAA2C;AACnE,cAAc,uBAAuB;AACrC;AACA;AACA;AACA;AACA,cAAc,qFAAqF;AACnG,6DAA6D,mCAAmC;AAChG;AACA,cAAc,qCAAqC;AACnD;AACA,cAAc,SAAS;AACvB;AACA;AACA;AACA,cAAc,SAAS;AACvB;AACA,cAAc,mBAAmB;AACjC;;AAEA;AACA;AACA;AACA;AACA;AACA,QAAQ,mDAAmD;AAC3D;AACA,0DAA0D;AAC1D,iCAAiC;AACjC;AACA;AACA,cAAc,oDAAoD;AAClE,cAAc,qCAAqC;AACnD,aAAa;AACb;AACA;AACA,0BAA0B,sDAAe;AACzC;AACA,aAAa,wCAAwC;AACrD;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,eAAe,uEAAyB;AACxC;AACA;;AAEA,iEAAe,WAAW,EAAC","sources":["webpack://@vaadin/bundles/./node_modules/@vaadin/map/node_modules/ol/interaction/Modify.js","webpack://@vaadin/bundles/./node_modules/@vaadin/map/node_modules/ol/layer/Vector.js"],"sourcesContent":["/**\n * @module ol/interaction/Modify\n */\nimport Collection from '../Collection.js';\nimport CollectionEventType from '../CollectionEventType.js';\nimport Feature from '../Feature.js';\nimport MapBrowserEventType from '../MapBrowserEventType.js';\nimport ObjectEventType from '../ObjectEventType.js';\nimport {equals} from '../array.js';\nimport {\n closestOnSegment,\n distance as coordinateDistance,\n equals as coordinatesEqual,\n squaredDistance as squaredCoordinateDistance,\n squaredDistanceToSegment,\n} from '../coordinate.js';\nimport Event from '../events/Event.js';\nimport EventType from '../events/EventType.js';\nimport {\n altKeyOnly,\n always,\n never,\n primaryAction,\n singleClick,\n} from '../events/condition.js';\nimport {\n boundingExtent,\n buffer as bufferExtent,\n createOrUpdateFromCoordinate as createExtent,\n} from '../extent.js';\nimport Point from '../geom/Point.js';\nimport {fromCircle} from '../geom/Polygon.js';\nimport VectorLayer from '../layer/Vector.js';\nimport {\n fromUserCoordinate,\n fromUserExtent,\n getUserProjection,\n toUserCoordinate,\n toUserExtent,\n} from '../proj.js';\nimport VectorSource from '../source/Vector.js';\nimport VectorEventType from '../source/VectorEventType.js';\nimport RBush from '../structs/RBush.js';\nimport {createEditingStyle} from '../style/Style.js';\nimport {getUid} from '../util.js';\nimport PointerInteraction from './Pointer.js';\nimport {\n getCoordinate,\n getTraceTargetUpdate,\n getTraceTargets,\n interpolateCoordinate,\n} from './tracing.js';\n\n/**\n * The segment index assigned to a circle's center when\n * breaking up a circle into ModifySegmentDataType segments.\n * @type {number}\n */\nconst CIRCLE_CENTER_INDEX = 0;\n\n/**\n * The segment index assigned to a circle's circumference when\n * breaking up a circle into ModifySegmentDataType segments.\n * @type {number}\n */\nconst CIRCLE_CIRCUMFERENCE_INDEX = 1;\n\nconst tempExtent = [0, 0, 0, 0];\nconst tempSegment = [];\n\n/**\n * @enum {string}\n */\nconst ModifyEventType = {\n /**\n * Triggered upon feature modification start\n * @event ModifyEvent#modifystart\n * @api\n */\n MODIFYSTART: 'modifystart',\n /**\n * Triggered upon feature modification end\n * @event ModifyEvent#modifyend\n * @api\n */\n MODIFYEND: 'modifyend',\n};\n\n/**\n * @typedef {Object} SegmentData\n * @property {Array<number>} [depth] Depth.\n * @property {Feature} feature Feature.\n * @property {import(\"../geom/SimpleGeometry.js\").default} geometry Geometry.\n * @property {number} [index] Index.\n * @property {Array<Array<number>>} segment Segment.\n * @property {Array<SegmentData>} [featureSegments] FeatureSegments.\n */\n\n/**\n * A function that takes a {@link module:ol/Feature~Feature} and returns `true` if\n * the feature may be modified or `false` otherwise.\n * @typedef {function(Feature):boolean} FilterFunction\n */\n\n/**\n * @typedef {[SegmentData, number]} DragSegment\n */\n\n/**\n * @typedef {Object} Options\n * @property {import(\"../events/condition.js\").Condition} [condition] A function that\n * takes a {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a\n * boolean to indicate whether that event will be considered to add or move a\n * vertex to the sketch. Default is\n * {@link module:ol/events/condition.primaryAction}.\n * @property {import(\"../events/condition.js\").Condition} [deleteCondition] A function\n * that takes a {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a\n * boolean to indicate whether that event should be handled. By default,\n * {@link module:ol/events/condition.singleClick} with\n * {@link module:ol/events/condition.altKeyOnly} results in a vertex deletion.\n * This combination is handled by wrapping the two condition checks in a single function:\n * ```js\n * import { altKeyOnly, singleClick } from 'ol/events/condition.js';\n *\n * function (event) {\n * return altKeyOnly(event) && singleClick(event)\n * }\n * ```\n * @property {import(\"../events/condition.js\").Condition} [insertVertexCondition] A\n * function that takes a {@link module:ol/MapBrowserEvent~MapBrowserEvent} and\n * returns a boolean to indicate whether a new vertex should be added to the sketch\n * features. Default is {@link module:ol/events/condition.always}.\n * @property {number} [pixelTolerance=10] Pixel tolerance for considering the\n * pointer close enough to a segment or vertex for editing.\n * @property {import(\"../style/Style.js\").StyleLike|import(\"../style/flat.js\").FlatStyleLike} [style]\n * Style used for the modification point or vertex. For linestrings and polygons, this will\n * be the affected vertex, for circles a point along the circle, and for points the actual\n * point. If not configured, the default edit style is used (see {@link module:ol/style/Style~Style}).\n * When using a style function, the point feature passed to the function will have an `existing` property -\n * indicating whether there is an existing vertex underneath or not, a `features`\n * property - an array whose entries are the features that are being modified, and a `geometries`\n * property - an array whose entries are the geometries that are being modified. Both arrays are\n * in the same order. The `geometries` are only useful when modifying geometry collections, where\n * the geometry will be the particular geometry from the collection that is being modified.\n * @property {VectorSource} [source] The vector source with\n * features to modify. If a vector source is not provided, a feature collection\n * must be provided with the `features` option.\n * @property {boolean|import(\"../layer/BaseVector.js\").default} [hitDetection] When configured, point\n * features will be considered for modification based on their visual appearance, instead of being within\n * the `pixelTolerance` from the pointer location. When a {@link module:ol/layer/BaseVector~BaseVectorLayer} is\n * provided, only the rendered representation of the features on that layer will be considered.\n * @property {Collection<Feature>} [features]\n * The features the interaction works on. If a feature collection is not\n * provided, a vector source must be provided with the `source` option.\n * @property {FilterFunction} [filter] A function that takes a {@link module:ol/Feature~Feature}\n * and returns `true` if the feature may be modified or `false` otherwise.\n * @property {boolean|import(\"../events/condition.js\").Condition} [trace=false] Trace a portion of another geometry.\n * Tracing starts when two neighboring vertices are dragged onto a trace target, without any other modification in between..\n * @property {VectorSource} [traceSource] Source for features to trace. If tracing is active and a `traceSource` is\n * not provided, the interaction's `source` will be used. Tracing requires that the interaction is configured with\n * either a `traceSource` or a `source`.\n * @property {boolean} [wrapX=false] Wrap the world horizontally on the sketch\n * overlay.\n * @property {boolean} [snapToPointer=!hitDetection] The vertex, point or segment being modified snaps to the\n * pointer coordinate when clicked within the `pixelTolerance`.\n * @property {function(import(\"../coordinate.js\").Coordinate, import(\"../coordinate.js\").Coordinate): boolean} [sharedVerticesEqual]\n * A function that takes two coordinates and returns whether they should be\n * considered equal for vertex matching purposes. By default, all coordinate\n * dimensions are compared. This is useful when features have mixed coordinate\n * dimensions (e.g., XY and XYZ) but should still be treated as sharing vertices\n * at the same 2D position.\n */\n\nfunction getCoordinatesArray(coordinates, geometryType, depth) {\n let coordinatesArray;\n switch (geometryType) {\n case 'LineString':\n coordinatesArray = coordinates;\n break;\n case 'MultiLineString':\n case 'Polygon':\n coordinatesArray = coordinates[depth[0]];\n break;\n case 'MultiPolygon':\n coordinatesArray = coordinates[depth[1]][depth[0]];\n break;\n default:\n // pass\n }\n return coordinatesArray;\n}\n\n/**\n * @classdesc\n * Events emitted by {@link module:ol/interaction/Modify~Modify} instances are\n * instances of this type.\n */\nexport class ModifyEvent extends Event {\n /**\n * @param {ModifyEventType} type Type.\n * @param {Collection<Feature>} features\n * The features modified.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent\n * Associated {@link module:ol/MapBrowserEvent~MapBrowserEvent}.\n */\n constructor(type, features, mapBrowserEvent) {\n super(type);\n\n /**\n * The features being modified.\n * @type {Collection<Feature>}\n * @api\n */\n this.features = features;\n\n /**\n * Associated {@link module:ol/MapBrowserEvent~MapBrowserEvent}.\n * @type {import(\"../MapBrowserEvent.js\").default}\n * @api\n */\n this.mapBrowserEvent = mapBrowserEvent;\n }\n}\n\n/***\n * @template Return\n * @typedef {import(\"../Observable.js\").OnSignature<import(\"../Observable.js\").EventTypes, import(\"../events/Event.js\").default, Return> &\n * import(\"../Observable.js\").OnSignature<import(\"../ObjectEventType.js\").Types|\n * 'change:active', import(\"../Object.js\").ObjectEvent, Return> &\n * import(\"../Observable.js\").OnSignature<'modifyend'|'modifystart', ModifyEvent, Return> &\n * import(\"../Observable.js\").CombinedOnSignature<import(\"../Observable.js\").EventTypes|import(\"../ObjectEventType.js\").Types|\n * 'change:active'|'modifyend'|'modifystart', Return>} ModifyOnSignature\n */\n\n/**\n * @classdesc\n * Interaction for modifying feature geometries. To modify features that have\n * been added to an existing source, construct the modify interaction with the\n * `source` option. If you want to modify features in a collection (for example,\n * the collection used by a select interaction), construct the interaction with\n * the `features` option. The interaction must be constructed with either a\n * `source` or `features` option.\n *\n * Cartesian distance from the pointer is used to determine the features that\n * will be modified. This means that geometries will only be considered for\n * modification when they are within the configured `pixelTolerance`. For point\n * geometries, the `hitDetection` option can be used to match their visual\n * appearance.\n *\n * By default, the interaction will allow deletion of vertices when the `alt`\n * key is pressed. To configure the interaction with a different condition\n * for deletion, use the `deleteCondition` option.\n * @fires ModifyEvent\n * @api\n */\nclass Modify extends PointerInteraction {\n /**\n * @param {Options} options Options.\n */\n constructor(options) {\n super(/** @type {import(\"./Pointer.js\").Options} */ (options));\n\n //Maintain a ref to event handlers for later unregistering\n /** @private */\n this.handleSourceAdd_ = this.handleSourceAdd_.bind(this);\n\n /** @private */\n this.handleSourceRemove_ = this.handleSourceRemove_.bind(this);\n\n /** @private */\n this.handleExternalCollectionAdd_ =\n this.handleExternalCollectionAdd_.bind(this);\n\n /** @private */\n this.handleExternalCollectionRemove_ =\n this.handleExternalCollectionRemove_.bind(this);\n\n /** @private */\n this.handleFeatureChange_ = this.handleFeatureChange_.bind(this);\n\n /***\n * @type {ModifyOnSignature<import(\"../events.js\").EventsKey>}\n */\n this.on;\n\n /***\n * @type {ModifyOnSignature<import(\"../events.js\").EventsKey>}\n */\n this.once;\n\n /***\n * @type {ModifyOnSignature<void>}\n */\n this.un;\n\n /**\n * @private\n * @type {import(\"../events/condition.js\").Condition}\n */\n this.condition_ = options.condition ? options.condition : primaryAction;\n\n /**\n * @private\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Browser event.\n * @return {boolean} Combined condition result.\n */\n this.defaultDeleteCondition_ = function (mapBrowserEvent) {\n return altKeyOnly(mapBrowserEvent) && singleClick(mapBrowserEvent);\n };\n\n /**\n * @type {import(\"../events/condition.js\").Condition}\n * @private\n */\n this.deleteCondition_ = options.deleteCondition\n ? options.deleteCondition\n : this.defaultDeleteCondition_;\n\n /**\n * @type {import(\"../events/condition.js\").Condition}\n * @private\n */\n this.insertVertexCondition_ = options.insertVertexCondition\n ? options.insertVertexCondition\n : always;\n\n /**\n * Editing vertex.\n * @type {Feature<Point>}\n * @private\n */\n this.vertexFeature_ = null;\n\n /**\n * Segments intersecting {@link this.vertexFeature_} by segment uid.\n * @type {Object<string, boolean>}\n * @private\n */\n this.vertexSegments_ = null;\n\n /**\n * @type {import(\"../coordinate.js\").Coordinate}\n * @private\n */\n this.lastCoordinate_ = [0, 0];\n\n /**\n * Tracks if the next `singleclick` event should be ignored to prevent\n * accidental deletion right after vertex creation.\n * @type {boolean}\n * @private\n */\n this.ignoreNextSingleClick_ = false;\n\n /**\n * @type {Collection<Feature>}\n * @private\n */\n this.featuresBeingModified_ = null;\n\n /**\n * Segment RTree for each layer\n * @type {RBush<SegmentData>}\n * @private\n */\n this.rBush_ = new RBush();\n\n /**\n * @type {number}\n * @private\n */\n this.pixelTolerance_ =\n options.pixelTolerance !== undefined ? options.pixelTolerance : 10;\n\n /**\n * @type {boolean}\n * @private\n */\n this.snappedToVertex_ = false;\n\n /**\n * Indicate whether the interaction is currently changing a feature's\n * coordinates.\n * @type {boolean}\n * @private\n */\n this.changingFeature_ = false;\n\n /**\n * @type {Array<DragSegment>}\n * @private\n */\n this.dragSegments_ = [];\n\n /**\n * Draw overlay where sketch features are drawn.\n * @type {VectorLayer}\n * @private\n */\n this.overlay_ = new VectorLayer({\n source: new VectorSource({\n useSpatialIndex: false,\n wrapX: !!options.wrapX,\n }),\n style: options.style ? options.style : getDefaultStyleFunction(),\n updateWhileAnimating: true,\n updateWhileInteracting: true,\n });\n\n /**\n * @const\n * @private\n * @type {!Object<string, function(Feature, import(\"../geom/Geometry.js\").default): void>}\n */\n this.SEGMENT_WRITERS_ = {\n Point: this.writePointGeometry_.bind(this),\n LineString: this.writeLineStringGeometry_.bind(this),\n LinearRing: this.writeLineStringGeometry_.bind(this),\n Polygon: this.writePolygonGeometry_.bind(this),\n MultiPoint: this.writeMultiPointGeometry_.bind(this),\n MultiLineString: this.writeMultiLineStringGeometry_.bind(this),\n MultiPolygon: this.writeMultiPolygonGeometry_.bind(this),\n Circle: this.writeCircleGeometry_.bind(this),\n GeometryCollection: this.writeGeometryCollectionGeometry_.bind(this),\n };\n\n /**\n * @type {VectorSource}\n * @private\n */\n this.source_ = null;\n\n /**\n * @type {VectorSource|null}\n * @private\n */\n this.traceSource_ = options.traceSource || options.source || null;\n\n /**\n * @type {import(\"../events/condition.js\").Condition}\n * @private\n */\n this.traceCondition_;\n this.setTrace(options.trace || false);\n\n /**\n * @type {import('./tracing.js').TraceState}\n * @private\n */\n this.traceState_ = {active: false};\n\n /**\n * @type {Array<DragSegment>|null}\n * @private\n */\n this.traceSegments_ = null;\n\n /**\n * @type {boolean|import(\"../layer/BaseVector.js\").default}\n * @private\n */\n this.hitDetection_ = null;\n\n /**\n * Useful for performance optimization\n * @private\n * @type boolean\n */\n this.filterFunctionWasSupplied_ =\n options.filter != undefined ? true : false;\n\n /**\n * @private\n * @type {FilterFunction}\n */\n this.filter_ = options.filter ? options.filter : () => true;\n\n /**\n * @private\n * @type {function(import(\"../coordinate.js\").Coordinate, import(\"../coordinate.js\").Coordinate): boolean}\n */\n this.coordinatesEqual_ = options.sharedVerticesEqual\n ? options.sharedVerticesEqual\n : coordinatesEqual;\n\n if (!(options.features || options.source)) {\n throw new Error(\n 'The modify interaction requires features collection or a source',\n );\n }\n /** @type {Array<Feature>} */\n let features;\n if (options.features) {\n features = options.features.getArray();\n //setup listeners on external features collection and features\n options.features.addEventListener(\n CollectionEventType.ADD,\n this.handleExternalCollectionAdd_,\n );\n options.features.addEventListener(\n CollectionEventType.REMOVE,\n this.handleExternalCollectionRemove_,\n );\n //keep ref for unsubscribe on dispose\n this.featuresCollection_ = options.features;\n } else if (options.source) {\n features = options.source.getFeatures();\n //setup listeners on external source and features\n options.source.addEventListener(\n VectorEventType.ADDFEATURE,\n this.handleSourceAdd_,\n );\n options.source.addEventListener(\n VectorEventType.REMOVEFEATURE,\n this.handleSourceRemove_,\n );\n //keep ref for unsubscribe on dispose\n this.source_ = options.source;\n }\n features.forEach((feature) => {\n //any modification to the feature requires filter to be re-run\n feature.addEventListener(EventType.CHANGE, this.handleFeatureChange_);\n //prop change handler is only to re-run the filter\n if (this.filterFunctionWasSupplied_) {\n feature.addEventListener(\n ObjectEventType.PROPERTYCHANGE,\n this.handleFeatureChange_,\n );\n }\n });\n\n if (options.hitDetection) {\n this.hitDetection_ = options.hitDetection;\n }\n\n /**\n * Internal features array. When adding or removing features, be sure to use\n * addFeature_()/removeFeature_() so that the the segment index is adjusted.\n * @type {Array<Feature>}\n * @private\n */\n this.features_ = [];\n features\n .filter(this.filter_)\n .forEach((feature) => this.addFeature_(feature));\n\n /**\n * @type {import(\"../MapBrowserEvent.js\").default}\n * @private\n */\n this.lastPointerEvent_ = null;\n\n /**\n * Delta (x, y in map units) between matched rtree vertex and pointer vertex.\n * @type {Array<number>}\n * @private\n */\n this.delta_ = [0, 0];\n\n /**\n * @private\n */\n this.snapToPointer_ =\n options.snapToPointer === undefined\n ? !this.hitDetection_\n : options.snapToPointer;\n }\n\n /**\n * Toggle tracing mode or set a tracing condition.\n *\n * @param {boolean|import(\"../events/condition.js\").Condition} trace A boolean to toggle tracing mode or an event\n * condition that will be checked when a feature is clicked to determine if tracing should be active.\n */\n setTrace(trace) {\n let condition;\n if (!trace) {\n condition = never;\n } else if (trace === true) {\n condition = always;\n } else {\n condition = trace;\n }\n this.traceCondition_ = condition;\n }\n\n /**\n * Called when a feature is added to the internal features collection\n * @param {Feature} feature Feature.\n * @private\n */\n addFeature_(feature) {\n this.features_.push(feature);\n const geometry = feature.getGeometry();\n if (geometry) {\n const writer = this.SEGMENT_WRITERS_[geometry.getType()];\n if (writer) {\n writer(feature, geometry);\n }\n }\n const map = this.getMap();\n if (map && map.isRendered() && this.getActive()) {\n this.handlePointerAtPixel_(this.lastCoordinate_);\n }\n }\n\n /**\n * @param {import(\"../MapBrowserEvent.js\").default} evt Map browser event.\n * @param {Array<SegmentData>} segments The segments subject to modification.\n * @private\n */\n willModifyFeatures_(evt, segments) {\n if (!this.featuresBeingModified_) {\n this.featuresBeingModified_ = new Collection();\n const features = this.featuresBeingModified_.getArray();\n for (let i = 0, ii = segments.length; i < ii; ++i) {\n const feature = segments[i].feature;\n if (feature && !features.includes(feature)) {\n this.featuresBeingModified_.push(feature);\n }\n }\n if (this.featuresBeingModified_.getLength() === 0) {\n this.featuresBeingModified_ = null;\n } else {\n this.dispatchEvent(\n new ModifyEvent(\n ModifyEventType.MODIFYSTART,\n this.featuresBeingModified_,\n evt,\n ),\n );\n }\n }\n }\n\n /**\n * Removes a feature from the internal features collection and updates internal state\n * accordingly.\n * @param {Feature} feature Feature.\n * @private\n */\n removeFeature_(feature) {\n const itemIndex = this.features_.indexOf(feature);\n this.features_.splice(itemIndex, 1);\n this.removeFeatureSegmentData_(feature);\n // Remove the vertex feature if the collection of candidate features is empty.\n if (this.vertexFeature_ && this.features_.length === 0) {\n this.overlay_.getSource().removeFeature(this.vertexFeature_);\n this.vertexFeature_ = null;\n }\n }\n\n /**\n * @param {Feature} feature Feature.\n * @private\n */\n removeFeatureSegmentData_(feature) {\n const rBush = this.rBush_;\n /** @type {Array<SegmentData>} */\n const nodesToRemove = [];\n rBush.forEach(\n /**\n * @param {SegmentData} node RTree node.\n */\n function (node) {\n if (feature === node.feature) {\n nodesToRemove.push(node);\n }\n },\n );\n for (let i = nodesToRemove.length - 1; i >= 0; --i) {\n const nodeToRemove = nodesToRemove[i];\n for (let j = this.dragSegments_.length - 1; j >= 0; --j) {\n if (this.dragSegments_[j][0] === nodeToRemove) {\n this.dragSegments_.splice(j, 1);\n }\n }\n rBush.remove(nodeToRemove);\n }\n }\n\n /**\n * Activate or deactivate the interaction.\n * @param {boolean} active Active.\n * @observable\n * @api\n * @override\n */\n setActive(active) {\n if (this.vertexFeature_ && !active) {\n this.overlay_.getSource().removeFeature(this.vertexFeature_);\n this.vertexFeature_ = null;\n }\n super.setActive(active);\n }\n\n /**\n * Remove the interaction from its current map and attach it to the new map.\n * Subclasses may set up event handlers to get notified about changes to\n * the map here.\n * @param {import(\"../Map.js\").default} map Map.\n * @override\n */\n setMap(map) {\n this.overlay_.setMap(map);\n super.setMap(map);\n }\n\n /**\n * Get the overlay layer that this interaction renders the modification point or vertex to.\n * @return {VectorLayer} Overlay layer.\n * @api\n */\n getOverlay() {\n return this.overlay_;\n }\n\n /**\n * @param {import(\"../source/Vector.js\").VectorSourceEvent} event Event.\n * @private\n */\n handleSourceAdd_(event) {\n const feature = event.feature;\n if (feature) {\n this.externalAddFeatureHandler_(feature);\n }\n }\n\n /**\n * @param {import(\"../source/Vector.js\").VectorSourceEvent} event Event.\n * @private\n */\n handleSourceRemove_(event) {\n const feature = event.feature;\n if (feature) {\n this.externalRemoveFeatureHandler_(feature);\n }\n }\n\n /**\n * @param {import(\"../Collection.js\").CollectionEvent} event Event.\n * @private\n */\n handleExternalCollectionAdd_(event) {\n const feature = event.element;\n if (feature) {\n this.externalAddFeatureHandler_(feature);\n }\n }\n\n /**\n * @param {import(\"../Collection.js\").CollectionEvent} event Event.\n * @private\n */\n handleExternalCollectionRemove_(event) {\n const feature = event.element;\n if (feature) {\n this.externalRemoveFeatureHandler_(feature);\n }\n }\n\n /**\n * Common handler for event signaling addition of feature to the supplied features source\n * or collection.\n * @param {Feature} feature Feature.\n */\n externalAddFeatureHandler_(feature) {\n feature.addEventListener(EventType.CHANGE, this.handleFeatureChange_);\n //prop change handler is only for reapplying the filter\n if (this.filterFunctionWasSupplied_) {\n feature.addEventListener(\n ObjectEventType.PROPERTYCHANGE,\n this.handleFeatureChange_,\n );\n }\n if (this.filter_(feature)) {\n this.addFeature_(feature);\n }\n }\n\n /**\n * Common handler for event signaling removal of feature from the supplied features source\n * or collection.\n * @param {Feature} feature Feature.\n */\n externalRemoveFeatureHandler_(feature) {\n feature.removeEventListener(EventType.CHANGE, this.handleFeatureChange_);\n if (this.filterFunctionWasSupplied_) {\n feature.removeEventListener(\n ObjectEventType.PROPERTYCHANGE,\n this.handleFeatureChange_,\n );\n }\n this.removeFeature_(feature);\n }\n\n /**\n * Listener for features in external source or features collection. Ensures the feature filter\n * is re-run and segment data is updated.\n * @param {import(\"../events/Event.js\").default | import(\"../Object.js\").ObjectEvent} evt Event.\n * @private\n */\n handleFeatureChange_(evt) {\n if (!this.changingFeature_) {\n const feature = /** @type {Feature} */ (evt.target);\n this.removeFeature_(feature);\n //safe to remove handler on a feature if there isn't one, but need to apply the filter\n // before adding the feature.\n this.filter_(feature) && this.addFeature_(feature);\n }\n }\n\n /**\n * @param {Feature} feature Feature\n * @param {Point} geometry Geometry.\n * @private\n */\n writePointGeometry_(feature, geometry) {\n const coordinates = geometry.getCoordinates();\n\n /** @type {SegmentData} */\n const segmentData = {\n feature: feature,\n geometry: geometry,\n segment: [coordinates, coordinates],\n };\n\n this.rBush_.insert(geometry.getExtent(), segmentData);\n }\n\n /**\n * @param {Feature} feature Feature\n * @param {import(\"../geom/MultiPoint.js\").default} geometry Geometry.\n * @private\n */\n writeMultiPointGeometry_(feature, geometry) {\n const points = geometry.getCoordinates();\n for (let i = 0, ii = points.length; i < ii; ++i) {\n const coordinates = points[i];\n\n /** @type {SegmentData} */\n const segmentData = {\n feature: feature,\n geometry: geometry,\n depth: [i],\n index: i,\n segment: [coordinates, coordinates],\n };\n\n this.rBush_.insert(geometry.getExtent(), segmentData);\n }\n }\n\n /**\n * @param {Feature} feature Feature\n * @param {import(\"../geom/LineString.js\").default} geometry Geometry.\n * @private\n */\n writeLineStringGeometry_(feature, geometry) {\n const coordinates = geometry.getCoordinates();\n for (let i = 0, ii = coordinates.length - 1; i < ii; ++i) {\n const segment = coordinates.slice(i, i + 2);\n\n /** @type {SegmentData} */\n const segmentData = {\n feature: feature,\n geometry: geometry,\n index: i,\n segment: segment,\n };\n\n this.rBush_.insert(boundingExtent(segment), segmentData);\n }\n }\n\n /**\n * @param {Feature} feature Feature\n * @param {import(\"../geom/MultiLineString.js\").default} geometry Geometry.\n * @private\n */\n writeMultiLineStringGeometry_(feature, geometry) {\n const lines = geometry.getCoordinates();\n for (let j = 0, jj = lines.length; j < jj; ++j) {\n const coordinates = lines[j];\n for (let i = 0, ii = coordinates.length - 1; i < ii; ++i) {\n const segment = coordinates.slice(i, i + 2);\n\n /** @type {SegmentData} */\n const segmentData = {\n feature: feature,\n geometry: geometry,\n depth: [j],\n index: i,\n segment: segment,\n };\n\n this.rBush_.insert(boundingExtent(segment), segmentData);\n }\n }\n }\n\n /**\n * @param {Feature} feature Feature\n * @param {import(\"../geom/Polygon.js\").default} geometry Geometry.\n * @private\n */\n writePolygonGeometry_(feature, geometry) {\n const rings = geometry.getCoordinates();\n for (let j = 0, jj = rings.length; j < jj; ++j) {\n const coordinates = rings[j];\n for (let i = 0, ii = coordinates.length - 1; i < ii; ++i) {\n const segment = coordinates.slice(i, i + 2);\n\n /** @type {SegmentData} */\n const segmentData = {\n feature: feature,\n geometry: geometry,\n depth: [j],\n index: i,\n segment: segment,\n };\n\n this.rBush_.insert(boundingExtent(segment), segmentData);\n }\n }\n }\n\n /**\n * @param {Feature} feature Feature\n * @param {import(\"../geom/MultiPolygon.js\").default} geometry Geometry.\n * @private\n */\n writeMultiPolygonGeometry_(feature, geometry) {\n const polygons = geometry.getCoordinates();\n for (let k = 0, kk = polygons.length; k < kk; ++k) {\n const rings = polygons[k];\n for (let j = 0, jj = rings.length; j < jj; ++j) {\n const coordinates = rings[j];\n for (let i = 0, ii = coordinates.length - 1; i < ii; ++i) {\n const segment = coordinates.slice(i, i + 2);\n\n /** @type {SegmentData} */\n const segmentData = {\n feature: feature,\n geometry: geometry,\n depth: [j, k],\n index: i,\n segment: segment,\n };\n\n this.rBush_.insert(boundingExtent(segment), segmentData);\n }\n }\n }\n }\n\n /**\n * We convert a circle into two segments. The segment at index\n * {@link CIRCLE_CENTER_INDEX} is the\n * circle's center (a point). The segment at index\n * {@link CIRCLE_CIRCUMFERENCE_INDEX} is\n * the circumference, and is not a line segment.\n *\n * @param {Feature} feature Feature.\n * @param {import(\"../geom/Circle.js\").default} geometry Geometry.\n * @private\n */\n writeCircleGeometry_(feature, geometry) {\n const coordinates = geometry.getCenter();\n\n /** @type {SegmentData} */\n const centerSegmentData = {\n feature: feature,\n geometry: geometry,\n index: CIRCLE_CENTER_INDEX,\n segment: [coordinates, coordinates],\n };\n\n /** @type {SegmentData} */\n const circumferenceSegmentData = {\n feature: feature,\n geometry: geometry,\n index: CIRCLE_CIRCUMFERENCE_INDEX,\n segment: [coordinates, coordinates],\n };\n\n const featureSegments = [centerSegmentData, circumferenceSegmentData];\n centerSegmentData.featureSegments = featureSegments;\n circumferenceSegmentData.featureSegments = featureSegments;\n this.rBush_.insert(createExtent(coordinates), centerSegmentData);\n let circleGeometry = /** @type {import(\"../geom/Geometry.js\").default} */ (\n geometry\n );\n const userProjection = getUserProjection();\n if (userProjection && this.getMap()) {\n const projection = this.getMap().getView().getProjection();\n circleGeometry = circleGeometry\n .clone()\n .transform(userProjection, projection);\n circleGeometry = fromCircle(\n /** @type {import(\"../geom/Circle.js\").default} */ (circleGeometry),\n ).transform(projection, userProjection);\n }\n this.rBush_.insert(circleGeometry.getExtent(), circumferenceSegmentData);\n }\n\n /**\n * @param {Feature} feature Feature\n * @param {import(\"../geom/GeometryCollection.js\").default} geometry Geometry.\n * @private\n */\n writeGeometryCollectionGeometry_(feature, geometry) {\n const geometries = geometry.getGeometriesArray();\n for (let i = 0; i < geometries.length; ++i) {\n const geometry = geometries[i];\n const writer = this.SEGMENT_WRITERS_[geometry.getType()];\n writer(feature, geometry);\n }\n }\n\n /**\n * @param {import(\"../coordinate.js\").Coordinate} coordinates Coordinates.\n * @param {Array<Feature>} features The features being modified.\n * @param {Array<import(\"../geom/SimpleGeometry.js\").default>} geometries The geometries being modified.\n * @param {boolean} existing The vertex represents an existing vertex.\n * @return {Feature} Vertex feature.\n * @private\n */\n createOrUpdateVertexFeature_(coordinates, features, geometries, existing) {\n let vertexFeature = this.vertexFeature_;\n if (!vertexFeature) {\n vertexFeature = new Feature(new Point(coordinates));\n this.vertexFeature_ = vertexFeature;\n this.overlay_.getSource().addFeature(vertexFeature);\n } else {\n const geometry = vertexFeature.getGeometry();\n geometry.setCoordinates(coordinates);\n }\n vertexFeature.set('features', features);\n vertexFeature.set('geometries', geometries);\n vertexFeature.set('existing', existing);\n return vertexFeature;\n }\n\n /**\n * Handles the {@link module:ol/MapBrowserEvent~MapBrowserEvent map browser event} and may modify the geometry.\n * @param {import(\"../MapBrowserEvent.js\").default} mapBrowserEvent Map browser event.\n * @return {boolean} `false` to stop event propagation.\n * @override\n */\n handleEvent(mapBrowserEvent) {\n if (!mapBrowserEvent.originalEvent) {\n return true;\n }\n this.lastPointerEvent_ = mapBrowserEvent;\n\n let handled;\n if (\n !mapBrowserEvent.map.getView().getInteracting() &&\n mapBrowserEvent.type == MapBrowserEventType.POINTERMOVE &&\n !this.handlingDownUpSequence\n ) {\n this.handlePointerMove_(mapBrowserEvent);\n }\n if (this.vertexFeature_ && this.deleteCondition_(mapBrowserEvent)) {\n if (\n mapBrowserEvent.type != MapBrowserEventType.SINGLECLICK ||\n !this.ignoreNextSingleClick_\n ) {\n handled = this.removePoint();\n } else {\n handled = true;\n }\n }\n\n if (mapBrowserEvent.type == MapBrowserEventType.SINGLECLICK) {\n this.ignoreNextSingleClick_ = false;\n }\n\n return super.handleEvent(mapBrowserEvent) && !handled;\n }\n\n /**\n * @param {import(\"../coordinate.js\").Coordinate} pixelCoordinate Pixel coordinate.\n * @return {Array<SegmentData>|undefined} Insert vertices and update drag segments.\n * @private\n */\n findInsertVerticesAndUpdateDragSegments_(pixelCoordinate) {\n this.handlePointerAtPixel_(pixelCoordinate);\n this.dragSegments_.length = 0;\n this.featuresBeingModified_ = null;\n const vertexFeature = this.vertexFeature_;\n if (!vertexFeature) {\n return;\n }\n\n const projection = this.getMap().getView().getProjection();\n /** @type {Array<SegmentData>} */\n const insertVertices = [];\n const vertex = this.vertexFeature_.getGeometry().getCoordinates();\n const vertexExtent = boundingExtent([vertex]);\n const segmentDataMatches = this.rBush_.getInExtent(vertexExtent);\n const componentSegments = {};\n segmentDataMatches.sort(compareIndexes);\n for (let i = 0, ii = segmentDataMatches.length; i < ii; ++i) {\n const segmentDataMatch = segmentDataMatches[i];\n const segment = segmentDataMatch.segment;\n let uid = getUid(segmentDataMatch.geometry);\n const depth = segmentDataMatch.depth;\n if (depth) {\n uid += '-' + depth.join('-'); // separate feature components\n }\n if (!componentSegments[uid]) {\n componentSegments[uid] = new Array(2);\n }\n\n if (\n segmentDataMatch.geometry.getType() === 'Circle' &&\n segmentDataMatch.index === CIRCLE_CIRCUMFERENCE_INDEX\n ) {\n const closestVertex = closestOnSegmentData(\n pixelCoordinate,\n segmentDataMatch,\n projection,\n );\n if (\n this.coordinatesEqual_(closestVertex, vertex) &&\n !componentSegments[uid][0]\n ) {\n this.dragSegments_.push([segmentDataMatch, 0]);\n componentSegments[uid][0] = segmentDataMatch;\n }\n continue;\n }\n\n if (\n this.coordinatesEqual_(segment[0], vertex) &&\n !componentSegments[uid][0]\n ) {\n this.dragSegments_.push([segmentDataMatch, 0]);\n componentSegments[uid][0] = segmentDataMatch;\n continue;\n }\n\n if (\n this.coordinatesEqual_(segment[1], vertex) &&\n !componentSegments[uid][1]\n ) {\n if (\n componentSegments[uid][0] &&\n componentSegments[uid][0].index === 0\n ) {\n let coordinates = segmentDataMatch.geometry.getCoordinates();\n switch (segmentDataMatch.geometry.getType()) {\n // prevent dragging closed linestrings by the connecting node\n case 'LineString':\n case 'MultiLineString':\n continue;\n // if dragging the first vertex of a polygon, ensure the other segment\n // belongs to the closing vertex of the linear ring\n case 'MultiPolygon':\n coordinates = coordinates[depth[1]];\n /* falls through */\n case 'Polygon':\n if (segmentDataMatch.index !== coordinates[depth[0]].length - 2) {\n continue;\n }\n break;\n default:\n // pass\n }\n }\n\n this.dragSegments_.push([segmentDataMatch, 1]);\n componentSegments[uid][1] = segmentDataMatch;\n continue;\n }\n\n if (\n getUid(segment) in this.vertexSegments_ &&\n !componentSegments[uid][0] &&\n !componentSegments[uid][1]\n ) {\n insertVertices.push(segmentDataMatch);\n }\n }\n\n return insertVertices;\n }\n\n /**\n * @private\n */\n deactivateTrace_() {\n this.traceState_ = {active: false};\n }\n\n /**\n * Determine whether a trace from `fromIndex` to `toIndex` passes at least one\n * vertex of the target (i.e. whether it would add any traced coordinates).\n * The index math mirrors {@link addTracedCoordinates_}.\n * @param {number} fromIndex The start index.\n * @param {number} toIndex The end index.\n * @return {boolean} At least one target vertex lies between the indices.\n * @private\n */\n tracePassesVertex_(fromIndex, toIndex) {\n if (fromIndex === toIndex) {\n return false;\n }\n if (fromIndex < toIndex) {\n const start = Math.ceil(fromIndex);\n let end = Math.floor(toIndex);\n if (end === toIndex) {\n end -= 1;\n }\n return start <= end;\n }\n const start = Math.floor(fromIndex);\n let end = Math.ceil(toIndex);\n if (end === toIndex) {\n end += 1;\n }\n return start >= end;\n }\n\n /**\n * Update the trace.\n * @param {import(\"../MapBrowserEvent.js\").default} event Event.\n * @return {import('../coordinate.js').Coordinate|undefined} The coordinate the\n * dragged vertex was snapped onto a target edge, if any.\n * @private\n */\n updateTrace_(event) {\n const traceState = this.traceState_;\n if (!traceState.active) {\n return;\n }\n\n if (traceState.targetIndex === -1) {\n // check if we are ready to pick a target\n const startPx = event.map.getPixelFromCoordinate(traceState.startCoord);\n if (coordinateDistance(startPx, event.pixel) < this.pixelTolerance_) {\n return;\n }\n }\n\n const updatedTraceTarget = getTraceTargetUpdate(\n event.coordinate,\n traceState,\n event.map,\n this.pixelTolerance_,\n );\n\n if (\n traceState.targetIndex === -1 &&\n Math.sqrt(updatedTraceTarget.closestTargetDistance) /\n event.map.getView().getResolution() >\n this.pixelTolerance_\n ) {\n return;\n }\n\n // Only commit to tracing a target once the drag has passed one of its\n // vertices. Before that we still snap the dragged vertex onto the target\n // edge (below), but we keep `targetIndex` at -1 so that pulling the pointer\n // beyond the tolerance releases the vertex instead of getting stuck on the\n // target.\n let commit = true;\n if (traceState.targetIndex === -1) {\n const candidateTarget = traceState.targets[updatedTraceTarget.index];\n commit = this.tracePassesVertex_(\n candidateTarget.startIndex,\n updatedTraceTarget.endIndex,\n );\n }\n\n if (commit) {\n if (traceState.targetIndex !== updatedTraceTarget.index) {\n // target changed\n if (traceState.targetIndex !== -1) {\n // remove points added during previous trace\n const oldTarget = traceState.targets[traceState.targetIndex];\n this.removeTracedCoordinates_(\n oldTarget.startIndex,\n oldTarget.endIndex,\n );\n }\n // add points for the new target\n const newTarget = traceState.targets[updatedTraceTarget.index];\n this.addTracedCoordinates_(\n newTarget,\n newTarget.startIndex,\n updatedTraceTarget.endIndex,\n );\n } else {\n // target stayed the same\n const target = traceState.targets[traceState.targetIndex];\n this.addOrRemoveTracedCoordinates_(target, updatedTraceTarget.endIndex);\n }\n\n // modify the state with updated info\n traceState.targetIndex = updatedTraceTarget.index;\n traceState.targets[traceState.targetIndex].endIndex =\n updatedTraceTarget.endIndex;\n }\n\n // Snap the dragged vertex (the moving end of the trace) onto the target\n // edge so that the trace follows edges, not only vertices, and the geometry\n // stays consistent with the vertex marker. Moving all of the dragged\n // vertex' segments keeps polygon rings closed.\n const snapTarget = traceState.targets[updatedTraceTarget.index];\n const snappedVertex = interpolateCoordinate(\n snapTarget.coordinates,\n updatedTraceTarget.endIndex,\n );\n for (const dragSegment of this.dragSegments_) {\n this.updateGeometry_(snappedVertex.slice(), dragSegment);\n }\n return snappedVertex;\n }\n\n getTraceCandidates_(event) {\n const map = this.getMap();\n const tolerance = this.pixelTolerance_;\n const lowerLeft = map.getCoordinateFromPixel([\n event.pixel[0] - tolerance,\n event.pixel[1] + tolerance,\n ]);\n const upperRight = map.getCoordinateFromPixel([\n event.pixel[0] + tolerance,\n event.pixel[1] - tolerance,\n ]);\n const extent = boundingExtent([lowerLeft, upperRight]);\n const features = this.traceSource_.getFeaturesInExtent(extent);\n return features;\n }\n\n /**\n * Activate or deactivate trace state based on a browser event.\n * @param {import(\"../MapBrowserEvent.js\").default} event Event.\n * @private\n */\n toggleTraceState_(event) {\n if (!this.traceSource_ || !this.traceCondition_(event)) {\n return;\n }\n\n if (this.traceState_.active) {\n this.deactivateTrace_();\n this.traceSegments_ = null;\n return;\n }\n\n const features = this.getTraceCandidates_(event);\n if (features.length === 0) {\n return;\n }\n\n const targets = getTraceTargets(event.coordinate, features);\n if (targets.length) {\n this.traceState_ = {\n active: true,\n startCoord: event.coordinate.slice(),\n targets: targets,\n targetIndex: -1,\n };\n }\n }\n\n /**\n * @param {import('./tracing.js').TraceTarget} target The trace target.\n * @param {number} endIndex The new end index of the trace.\n * @private\n */\n addOrRemoveTracedCoordinates_(target, endIndex) {\n // three cases to handle:\n // 1. traced in the same direction and points need adding\n // 2. traced in the same direction and points need removing\n // 3. traced in a new direction\n const previouslyForward = target.startIndex <= target.endIndex;\n const currentlyForward = target.startIndex <= endIndex;\n if (previouslyForward === currentlyForward) {\n // same direction\n if (\n (previouslyForward && endIndex > target.endIndex) ||\n (!previouslyForward && endIndex < target.endIndex)\n ) {\n // case 1 - add new points\n this.addTracedCoordinates_(target, target.endIndex, endIndex);\n } else if (\n (previouslyForward && endIndex < target.endIndex) ||\n (!previouslyForward && endIndex > target.endIndex)\n ) {\n // case 2 - remove old points\n this.removeTracedCoordinates_(endIndex, target.endIndex);\n }\n } else {\n // case 3 - remove old points, add new points\n this.removeTracedCoordinates_(target.startIndex, target.endIndex);\n this.addTracedCoordinates_(target, target.startIndex, endIndex);\n }\n }\n\n /**\n * Tracing splices coordinates into a ring next to the dragged vertex, but only\n * adjusts the index of the trace segment itself. The dragged vertex' other\n * segments in `dragSegments_` reference the same ring, so their stored index\n * must be shifted too - otherwise the next {@link updateGeometry_} writes the\n * dragged vertex to the wrong coordinate and scrambles the ring.\n * @param {SegmentData} traceSegmentData The trace segment (adjusted by the\n * caller and skipped here).\n * @param {number} atIndex Segments at or after this coordinate index shift.\n * @param {number} delta Coordinates added (positive) or removed (negative).\n * @private\n */\n shiftTracedSegmentIndices_(traceSegmentData, atIndex, delta) {\n for (const dragSegment of this.dragSegments_) {\n const segmentData = dragSegment[0];\n if (\n segmentData !== traceSegmentData &&\n segmentData.geometry === traceSegmentData.geometry &&\n (segmentData.depth === undefined ||\n traceSegmentData.depth === undefined ||\n equals(segmentData.depth, traceSegmentData.depth)) &&\n segmentData.index >= atIndex\n ) {\n segmentData.index += delta;\n }\n }\n }\n\n /**\n * @param {number} fromIndex The start index.\n * @param {number} toIndex The end index.\n * @private\n */\n removeTracedCoordinates_(fromIndex, toIndex) {\n if (fromIndex === toIndex) {\n return;\n }\n\n let remove = 0;\n if (fromIndex < toIndex) {\n const start = Math.ceil(fromIndex);\n let end = Math.floor(toIndex);\n if (end === toIndex) {\n end -= 1;\n }\n remove = end - start + 1;\n } else {\n const start = Math.floor(fromIndex);\n let end = Math.ceil(toIndex);\n if (end === toIndex) {\n end += 1;\n }\n remove = start - end + 1;\n }\n\n if (remove > 0) {\n for (const traceSegment of this.traceSegments_) {\n const segmentData = traceSegment[0];\n const geometry = segmentData.geometry;\n const index = traceSegment[1];\n let removeIndex = traceSegment[0].index + 1;\n if (index === 1) {\n removeIndex -= remove;\n }\n const coordinates = geometry.getCoordinates();\n const coordinatesArray = getCoordinatesArray(\n coordinates,\n geometry.getType(),\n segmentData.depth,\n );\n coordinatesArray.splice(removeIndex, remove);\n this.setGeometryCoordinates_(geometry, coordinates);\n this.shiftTracedSegmentIndices_(\n segmentData,\n removeIndex + remove,\n -remove,\n );\n if (index === 1) {\n segmentData.index -= remove;\n }\n }\n }\n }\n\n /**\n * @param {import('./tracing.js').TraceTarget} target The trace target.\n * @param {number} fromIndex The start index.\n * @param {number} toIndex The end index.\n * @private\n */\n addTracedCoordinates_(target, fromIndex, toIndex) {\n if (fromIndex === toIndex) {\n return;\n }\n\n const newCoordinates = [];\n if (fromIndex < toIndex) {\n // forward trace\n const start = Math.ceil(fromIndex);\n let end = Math.floor(toIndex);\n if (end === toIndex) {\n // if end is snapped to a vertex, it will be added later\n end -= 1;\n }\n for (let i = start; i <= end; ++i) {\n newCoordinates.push(getCoordinate(target.coordinates, i));\n }\n } else {\n // reverse trace\n const start = Math.floor(fromIndex);\n let end = Math.ceil(toIndex);\n if (end === toIndex) {\n end += 1;\n }\n for (let i = start; i >= end; --i) {\n newCoordinates.push(getCoordinate(target.coordinates, i));\n }\n }\n\n if (newCoordinates.length) {\n for (const traceSegment of this.traceSegments_) {\n const segmentData = traceSegment[0];\n const geometry = segmentData.geometry;\n const index = traceSegment[1];\n const insertIndex = segmentData.index + 1;\n if (index === 0) {\n newCoordinates.reverse();\n }\n const coordinates = geometry.getCoordinates();\n const coordinatesArray = getCoordinatesArray(\n coordinates,\n geometry.getType(),\n segmentData.depth,\n );\n coordinatesArray.splice(insertIndex, 0, ...newCoordinates);\n this.setGeometryCoordinates_(geometry, coordinates);\n this.shiftTracedSegmentIndices_(\n segmentData,\n insertIndex,\n newCoordinates.length,\n );\n if (index === 1) {\n segmentData.index += newCoordinates.length;\n }\n }\n }\n }\n\n /**\n * @param {import('../coordinate.js').Coordinate} vertex Vertex.\n * @param {DragSegment} dragSegment Drag segment.\n */\n updateGeometry_(vertex, dragSegment) {\n const segmentData = dragSegment[0];\n const depth = segmentData.depth;\n let coordinates;\n const segment = segmentData.segment;\n const geometry = segmentData.geometry;\n const index = dragSegment[1];\n\n const stride = geometry.getStride();\n for (let i = 2; i < stride; ++i) {\n vertex[i] = segment[index][i];\n }\n vertex.length = stride;\n switch (geometry.getType()) {\n case 'Point':\n coordinates = vertex;\n segment[0] = vertex;\n segment[1] = vertex;\n break;\n case 'MultiPoint':\n coordinates = geometry.getCoordinates();\n coordinates[segmentData.index] = vertex;\n segment[0] = vertex;\n segment[1] = vertex;\n break;\n case 'LineString':\n coordinates = geometry.getCoordinates();\n coordinates[segmentData.index + index] = vertex;\n segment[index] = vertex;\n break;\n case 'MultiLineString':\n coordinates = geometry.getCoordinates();\n coordinates[depth[0]][segmentData.index + index] = vertex;\n segment[index] = vertex;\n break;\n case 'Polygon': {\n coordinates = geometry.getCoordinates();\n const ring = coordinates[depth[0]];\n const targetIndex = segmentData.index + index;\n\n // Prevent duplicate change events when vertex already at position\n if (\n ring[targetIndex][0] === vertex[0] &&\n ring[targetIndex][1] === vertex[1]\n ) {\n coordinates = null;\n } else {\n ring[targetIndex] = vertex;\n if (targetIndex === 0) {\n ring[ring.length - 1] = vertex;\n } else if (targetIndex === ring.length - 1) {\n ring[0] = vertex;\n }\n }\n segment[index] = vertex;\n break;\n }\n case 'MultiPolygon': {\n coordinates = geometry.getCoordinates();\n const mRing = coordinates[depth[1]][depth[0]];\n const mTargetIndex = segmentData.index + index;\n\n // Prevent duplicate change events when vertex already at position\n if (\n mRing[mTargetIndex][0] === vertex[0] &&\n mRing[mTargetIndex][1] === vertex[1]\n ) {\n coordinates = null;\n } else {\n mRing[mTargetIndex] = vertex;\n if (mTargetIndex === 0) {\n mRing[mRing.length - 1] = vertex;\n } else if (mTargetIndex === mRing.length - 1) {\n mRing[0] = vertex;\n }\n }\n segment[index] = vertex;\n break;\n }\n case 'Circle':\n const circle = /** @type {import(\"../geom/Circle.js\").default} */ (\n geometry\n );\n segment[0] = vertex;\n segment[1] = vertex;\n if (segmentData.index === CIRCLE_CENTER_INDEX) {\n this.changingFeature_ = true;\n circle.setCenter(vertex);\n this.changingFeature_ = false;\n } else {\n // We're dragging the circle's circumference:\n this.changingFeature_ = true;\n const projection = this.getMap().getView().getProjection();\n let radius = coordinateDistance(\n fromUserCoordinate(circle.getCenter(), projection),\n fromUserCoordinate(vertex, projection),\n );\n const userProjection = getUserProjection();\n if (userProjection) {\n const circleGeometry = circle\n .clone()\n .transform(userProjection, projection);\n circleGeometry.setRadius(radius);\n radius = circleGeometry\n .transform(projection, userProjection)\n .getRadius();\n }\n circle.setRadius(radius);\n this.changingFeature_ = false;\n }\n break;\n default:\n // pass\n }\n if (coordinates) {\n this.setGeometryCoordinates_(geometry, coordinates);\n }\n }\n\n /**\n * Handle pointer drag events.\n * @param {import(\"../MapBrowserEvent.js\").default} evt Event.\n * @override\n */\n handleDragEvent(evt) {\n this.ignoreNextSingleClick_ = false;\n this.willModifyFeatures_(\n evt,\n this.dragSegments_.map(([segment]) => segment),\n );\n\n const vertex = [\n evt.coordinate[0] + this.delta_[0],\n evt.coordinate[1] + this.delta_[1],\n ];\n const features = [];\n const geometries = [];\n const startTraceCoord =\n this.traceState_.active && !this.traceSegments_\n ? this.traceState_.startCoord\n : null;\n if (startTraceCoord) {\n this.traceSegments_ = [];\n for (const dragSegment of this.dragSegments_) {\n const segmentData = dragSegment[0];\n const eligibleForTracing =\n coordinateDistance(\n closestOnSegment(startTraceCoord, segmentData.segment),\n startTraceCoord,\n ) /\n evt.map.getView().getResolution() <\n 1;\n if (eligibleForTracing) {\n this.traceSegments_.push(dragSegment);\n }\n }\n if (this.traceSegments_.length > 1) {\n // Both segments of the dragged vertex are anchored at the trace start,\n // i.e. the grabbed vertex is the anchor itself. Tracing needs a fixed\n // anchor distinct from the moving vertex, so cancel tracing and let this\n // drag move the vertex freely.\n this.deactivateTrace_();\n this.traceSegments_ = null;\n }\n }\n for (let i = 0, ii = this.dragSegments_.length; i < ii; ++i) {\n const dragSegment = this.dragSegments_[i];\n const segmentData = dragSegment[0];\n const feature = segmentData.feature;\n if (!features.includes(feature)) {\n features.push(feature);\n }\n const geometry = segmentData.geometry;\n if (!geometries.includes(geometry)) {\n geometries.push(geometry);\n }\n\n this.updateGeometry_(vertex, dragSegment);\n }\n // when tracing snaps the dragged vertex onto a target edge, show the vertex\n // marker at the snapped location rather than at the raw pointer\n const snappedVertex = this.updateTrace_(evt);\n this.createOrUpdateVertexFeature_(\n snappedVertex || vertex,\n features,\n geometries,\n true,\n );\n }\n\n /**\n * Handle pointer down events.\n * @param {import(\"../MapBrowserEvent.js\").default} evt Event.\n * @return {boolean} If the event was consumed.\n * @override\n */\n handleDownEvent(evt) {\n if (!this.condition_(evt)) {\n return false;\n }\n const pixelCoordinate = evt.coordinate;\n const insertVertices =\n this.findInsertVerticesAndUpdateDragSegments_(pixelCoordinate);\n\n if (insertVertices?.length && this.insertVertexCondition_(evt)) {\n this.willModifyFeatures_(evt, insertVertices);\n\n if (this.vertexFeature_) {\n const vertex = this.vertexFeature_.getGeometry().getCoordinates();\n for (let j = insertVertices.length - 1; j >= 0; --j) {\n this.insertVertex_(insertVertices[j], vertex);\n }\n this.ignoreNextSingleClick_ = true;\n }\n }\n\n return !!this.vertexFeature_;\n }\n\n /**\n * Handle pointer up events.\n * @param {import(\"../MapBrowserEvent.js\").default} evt Event.\n * @return {boolean} If the event was consumed.\n * @override\n */\n handleUpEvent(evt) {\n // Tracing inserts and removes vertices with guarded geometry mutations (so\n // that dragSegments_ survive the drag). Those guarded mutations skip the\n // segment rBush rebuild that handleFeatureChange_ would normally do, so the\n // rBush no longer matches the traced geometry. Collect the affected features\n // here and rebuild their segment data once the drag is over.\n const tracedFeatures = this.traceState_.active ? new Set() : null;\n for (let i = this.dragSegments_.length - 1; i >= 0; --i) {\n const segmentData = this.dragSegments_[i][0];\n if (tracedFeatures) {\n tracedFeatures.add(segmentData.feature);\n }\n const geometry = segmentData.geometry;\n if (geometry.getType() === 'Circle') {\n const circle = /** @type {import(\"../geom/Circle.js\").default} */ (\n geometry\n );\n // Update a circle object in the R* bush:\n const coordinates = circle.getCenter();\n const centerSegmentData = segmentData.featureSegments[0];\n const circumferenceSegmentData = segmentData.featureSegments[1];\n centerSegmentData.segment[0] = coordinates;\n centerSegmentData.segment[1] = coordinates;\n circumferenceSegmentData.segment[0] = coordinates;\n circumferenceSegmentData.segment[1] = coordinates;\n this.rBush_.update(createExtent(coordinates), centerSegmentData);\n /** @type {import(\"../geom/Circle.js\").default | import(\"../geom/Polygon.js\").default} */\n let circleGeometry = circle;\n const userProjection = getUserProjection();\n if (userProjection) {\n const projection = evt.map.getView().getProjection();\n circleGeometry = circleGeometry\n .clone()\n .transform(userProjection, projection);\n circleGeometry = fromCircle(circleGeometry).transform(\n projection,\n userProjection,\n );\n }\n this.rBush_.update(\n circleGeometry.getExtent(),\n circumferenceSegmentData,\n );\n } else {\n this.rBush_.update(boundingExtent(segmentData.segment), segmentData);\n }\n }\n if (tracedFeatures) {\n for (const feature of tracedFeatures) {\n this.removeFeature_(feature);\n if (this.filter_(feature)) {\n this.addFeature_(feature);\n }\n }\n }\n if (this.featuresBeingModified_) {\n this.toggleTraceState_(evt);\n this.dispatchEvent(\n new ModifyEvent(\n ModifyEventType.MODIFYEND,\n this.featuresBeingModified_,\n evt,\n ),\n );\n this.featuresBeingModified_ = null;\n }\n return false;\n }\n\n /**\n * @param {import(\"../MapBrowserEvent.js\").default} evt Event.\n * @private\n */\n handlePointerMove_(evt) {\n this.lastCoordinate_ = evt.coordinate;\n this.handlePointerAtPixel_(this.lastCoordinate_);\n }\n\n /**\n * @param {import(\"../coordinate.js\").Coordinate} pixelCoordinate The pixel Coordinate.\n * @private\n */\n handlePointerAtPixel_(pixelCoordinate) {\n const map = this.getMap();\n const pixel = map.getPixelFromCoordinate(pixelCoordinate);\n const projection = map.getView().getProjection();\n const sortByDistance = function (a, b) {\n return (\n projectedDistanceToSegmentDataSquared(pixelCoordinate, a, projection) -\n projectedDistanceToSegmentDataSquared(pixelCoordinate, b, projection)\n );\n };\n\n /** @type {Array<SegmentData>|undefined} */\n let nodes;\n /** @type {Point|undefined} */\n let hitPointGeometry;\n if (this.hitDetection_) {\n const layerFilter =\n typeof this.hitDetection_ === 'object'\n ? (layer) => layer === this.hitDetection_\n : undefined;\n map.forEachFeatureAtPixel(\n pixel,\n (feature, layer, geometry) => {\n if (geometry && geometry.getType() === 'Point') {\n geometry = new Point(\n toUserCoordinate(geometry.getCoordinates(), projection),\n );\n }\n const geom = geometry || feature.getGeometry();\n\n if (\n geom &&\n geom.getType() === 'Point' &&\n feature instanceof Feature &&\n this.features_.includes(feature)\n ) {\n hitPointGeometry = /** @type {Point} */ (geom);\n const coordinate = /** @type {Point} */ (feature.getGeometry())\n .getFlatCoordinates()\n .slice(0, 2);\n nodes = [\n {\n feature,\n geometry: hitPointGeometry,\n segment: [coordinate, coordinate],\n },\n ];\n }\n return true;\n },\n {layerFilter},\n );\n }\n if (!nodes) {\n const viewExtent = fromUserExtent(\n createExtent(pixelCoordinate, tempExtent),\n projection,\n );\n const buffer = map.getView().getResolution() * this.pixelTolerance_;\n const box = toUserExtent(\n bufferExtent(viewExtent, buffer, tempExtent),\n projection,\n );\n nodes = this.rBush_.getInExtent(box);\n }\n\n if (nodes && nodes.length > 0) {\n const node = nodes.sort(sortByDistance)[0];\n const closestSegment = node.segment;\n let vertex = closestOnSegmentData(pixelCoordinate, node, projection);\n const vertexPixel = map.getPixelFromCoordinate(vertex);\n let dist = coordinateDistance(pixel, vertexPixel);\n if (hitPointGeometry || dist <= this.pixelTolerance_) {\n /** @type {Object<string, boolean>} */\n const vertexSegments = {};\n vertexSegments[getUid(closestSegment)] = true;\n\n if (!this.snapToPointer_) {\n this.delta_[0] = vertex[0] - pixelCoordinate[0];\n this.delta_[1] = vertex[1] - pixelCoordinate[1];\n }\n if (\n node.geometry.getType() === 'Circle' &&\n node.index === CIRCLE_CIRCUMFERENCE_INDEX\n ) {\n this.snappedToVertex_ = true;\n this.createOrUpdateVertexFeature_(\n vertex,\n [node.feature],\n [node.geometry],\n this.snappedToVertex_,\n );\n } else {\n const pixel1 = map.getPixelFromCoordinate(closestSegment[0]);\n const pixel2 = map.getPixelFromCoordinate(closestSegment[1]);\n const squaredDist1 = squaredCoordinateDistance(vertexPixel, pixel1);\n const squaredDist2 = squaredCoordinateDistance(vertexPixel, pixel2);\n dist = Math.sqrt(Math.min(squaredDist1, squaredDist2));\n this.snappedToVertex_ = dist <= this.pixelTolerance_;\n // Stop and cleanup overlay vertex feature if a segment was hit and new vertex creation is not allowed by the insertVertexCondition\n if (\n !this.snappedToVertex_ &&\n !this.insertVertexCondition_(this.lastPointerEvent_)\n ) {\n if (this.vertexFeature_) {\n this.overlay_.getSource().removeFeature(this.vertexFeature_);\n this.vertexFeature_ = null;\n }\n return;\n }\n if (this.snappedToVertex_) {\n vertex =\n squaredDist1 > squaredDist2\n ? closestSegment[1]\n : closestSegment[0];\n }\n this.createOrUpdateVertexFeature_(\n vertex,\n [node.feature],\n [node.geometry],\n this.snappedToVertex_,\n );\n const geometries = {};\n geometries[getUid(node.geometry)] = true;\n for (let i = 1, ii = nodes.length; i < ii; ++i) {\n const segment = nodes[i].segment;\n if (\n (this.coordinatesEqual_(closestSegment[0], segment[0]) &&\n this.coordinatesEqual_(closestSegment[1], segment[1])) ||\n (this.coordinatesEqual_(closestSegment[0], segment[1]) &&\n this.coordinatesEqual_(closestSegment[1], segment[0]))\n ) {\n const geometryUid = getUid(nodes[i].geometry);\n if (!(geometryUid in geometries)) {\n geometries[geometryUid] = true;\n vertexSegments[getUid(segment)] = true;\n }\n } else {\n break;\n }\n }\n }\n\n this.vertexSegments_ = vertexSegments;\n return;\n }\n }\n if (this.vertexFeature_) {\n this.overlay_.getSource().removeFeature(this.vertexFeature_);\n this.vertexFeature_ = null;\n }\n }\n\n /**\n * @param {SegmentData} segmentData Segment data.\n * @param {import(\"../coordinate.js\").Coordinate} vertex Vertex.\n * @return {boolean} A vertex was inserted.\n * @private\n */\n insertVertex_(segmentData, vertex) {\n const segment = segmentData.segment;\n const feature = segmentData.feature;\n const geometry = segmentData.geometry;\n const depth = segmentData.depth;\n const index = segmentData.index;\n let coordinates;\n\n while (vertex.length < geometry.getStride()) {\n vertex.push(0);\n }\n\n switch (geometry.getType()) {\n case 'MultiLineString':\n coordinates = geometry.getCoordinates();\n coordinates[depth[0]].splice(index + 1, 0, vertex);\n break;\n case 'Polygon':\n coordinates = geometry.getCoordinates();\n coordinates[depth[0]].splice(index + 1, 0, vertex);\n break;\n case 'MultiPolygon':\n coordinates = geometry.getCoordinates();\n coordinates[depth[1]][depth[0]].splice(index + 1, 0, vertex);\n break;\n case 'LineString':\n coordinates = geometry.getCoordinates();\n coordinates.splice(index + 1, 0, vertex);\n break;\n default:\n return false;\n }\n\n this.setGeometryCoordinates_(geometry, coordinates);\n const rTree = this.rBush_;\n rTree.remove(segmentData);\n this.updateSegmentIndices_(geometry, index, depth, 1);\n\n /** @type {SegmentData} */\n const newSegmentData = {\n segment: [segment[0], vertex],\n feature: feature,\n geometry: geometry,\n depth: depth,\n index: index,\n };\n\n rTree.insert(boundingExtent(newSegmentData.segment), newSegmentData);\n this.dragSegments_.push([newSegmentData, 1]);\n\n /** @type {SegmentData} */\n const newSegmentData2 = {\n segment: [vertex, segment[1]],\n feature: feature,\n geometry: geometry,\n depth: depth,\n index: index + 1,\n };\n\n rTree.insert(boundingExtent(newSegmentData2.segment), newSegmentData2);\n this.dragSegments_.push([newSegmentData2, 0]);\n return true;\n }\n\n /**\n * @param {import(\"../coordinate.js\").Coordinate} coordinate The coordinate.\n * @return {import(\"../coordinate.js\").Coordinate} The updated pointer coordinate.\n * @private\n */\n updatePointer_(coordinate) {\n if (coordinate) {\n this.findInsertVerticesAndUpdateDragSegments_(coordinate);\n }\n return this.vertexFeature_?.getGeometry().getCoordinates();\n }\n\n /**\n * Get the current pointer position.\n * @return {import(\"../coordinate.js\").Coordinate | null} The current pointer coordinate.\n */\n getPoint() {\n const coordinate = this.vertexFeature_?.getGeometry().getCoordinates();\n if (!coordinate) {\n return null;\n }\n return toUserCoordinate(\n coordinate,\n this.getMap().getView().getProjection(),\n );\n }\n\n /**\n * Check if a point can be removed from the current linestring or polygon at the current\n * pointer position.\n * @return {boolean} A point can be deleted at the current pointer position.\n * @api\n */\n canRemovePoint() {\n if (!this.vertexFeature_) {\n return false;\n }\n if (\n this.vertexFeature_\n .get('geometries')\n .every(\n (geometry) =>\n geometry.getType() === 'Circle' ||\n geometry.getType().endsWith('Point'),\n )\n ) {\n return false;\n }\n const coordinate = this.vertexFeature_.getGeometry().getCoordinates();\n const segments = this.rBush_.getInExtent(boundingExtent([coordinate]));\n return segments.some(\n ({segment}) =>\n this.coordinatesEqual_(segment[0], coordinate) ||\n this.coordinatesEqual_(segment[1], coordinate),\n );\n }\n\n /**\n * Removes the vertex currently being pointed from the current linestring or polygon.\n * @param {import('../coordinate.js').Coordinate} [coordinate] If provided, the pointer\n * will be set to the provided coordinate. If not, the current pointer coordinate will be used.\n * @return {boolean} True when a vertex was removed.\n * @api\n */\n removePoint(coordinate) {\n if (coordinate) {\n coordinate = fromUserCoordinate(\n coordinate,\n this.getMap().getView().getProjection(),\n );\n this.updatePointer_(coordinate);\n }\n if (\n !this.lastPointerEvent_ ||\n (this.lastPointerEvent_ &&\n this.lastPointerEvent_.type != MapBrowserEventType.POINTERDRAG)\n ) {\n const evt = this.lastPointerEvent_;\n this.willModifyFeatures_(\n evt,\n this.dragSegments_.map(([segment]) => segment),\n );\n const removed = this.removeVertex_();\n if (this.featuresBeingModified_) {\n this.dispatchEvent(\n new ModifyEvent(\n ModifyEventType.MODIFYEND,\n this.featuresBeingModified_,\n evt,\n ),\n );\n }\n\n this.featuresBeingModified_ = null;\n return removed;\n }\n return false;\n }\n\n /**\n * Removes a vertex from all matching features.\n * @return {boolean} True when a vertex was removed.\n * @private\n */\n removeVertex_() {\n const dragSegments = this.dragSegments_;\n const segmentsByFeature = {};\n let deleted = false;\n let component, coordinates, dragSegment, geometry, i, index, left;\n let newIndex, right, segmentData, uid;\n for (i = dragSegments.length - 1; i >= 0; --i) {\n dragSegment = dragSegments[i];\n segmentData = dragSegment[0];\n uid = getUid(segmentData.feature);\n if (segmentData.depth) {\n // separate feature components\n uid += '-' + segmentData.depth.join('-');\n }\n if (!(uid in segmentsByFeature)) {\n segmentsByFeature[uid] = {};\n }\n if (dragSegment[1] === 0) {\n segmentsByFeature[uid].right = segmentData;\n segmentsByFeature[uid].index = segmentData.index;\n } else if (dragSegment[1] == 1) {\n segmentsByFeature[uid].left = segmentData;\n segmentsByFeature[uid].index = segmentData.index + 1;\n }\n }\n for (uid in segmentsByFeature) {\n right = segmentsByFeature[uid].right;\n left = segmentsByFeature[uid].left;\n index = segmentsByFeature[uid].index;\n newIndex = index - 1;\n if (left !== undefined) {\n segmentData = left;\n } else {\n segmentData = right;\n }\n if (newIndex < 0) {\n newIndex = 0;\n }\n geometry = segmentData.geometry;\n coordinates = geometry.getCoordinates();\n component = coordinates;\n deleted = false;\n switch (geometry.getType()) {\n case 'MultiLineString':\n if (coordinates[segmentData.depth[0]].length > 2) {\n coordinates[segmentData.depth[0]].splice(index, 1);\n deleted = true;\n }\n break;\n case 'LineString':\n if (coordinates.length > 2) {\n coordinates.splice(index, 1);\n deleted = true;\n }\n break;\n case 'MultiPolygon':\n component = component[segmentData.depth[1]];\n /* falls through */\n case 'Polygon':\n component = component[segmentData.depth[0]];\n if (component.length > 4) {\n if (index == component.length - 1) {\n index = 0;\n }\n component.splice(index, 1);\n deleted = true;\n if (index === 0) {\n // close the ring again\n component.pop();\n component.push(component[0]);\n newIndex = component.length - 1;\n }\n }\n break;\n default:\n // pass\n }\n\n if (deleted) {\n this.setGeometryCoordinates_(geometry, coordinates);\n const segments = [];\n if (left !== undefined) {\n this.rBush_.remove(left);\n segments.push(left.segment[0]);\n }\n if (right !== undefined) {\n this.rBush_.remove(right);\n segments.push(right.segment[1]);\n }\n if (left !== undefined && right !== undefined) {\n /** @type {SegmentData} */\n const newSegmentData = {\n depth: segmentData.depth,\n feature: segmentData.feature,\n geometry: segmentData.geometry,\n index: newIndex,\n segment: segments,\n };\n\n this.rBush_.insert(\n boundingExtent(newSegmentData.segment),\n newSegmentData,\n );\n }\n this.updateSegmentIndices_(geometry, index, segmentData.depth, -1);\n if (this.vertexFeature_) {\n this.overlay_.getSource().removeFeature(this.vertexFeature_);\n this.vertexFeature_ = null;\n }\n dragSegments.length = 0;\n }\n }\n return deleted;\n }\n\n /**\n * Check if a point can be inserted to the current linestring or polygon at the current\n * pointer position.\n * @return {boolean} A point can be inserted at the current pointer position.\n * @api\n */\n canInsertPoint() {\n if (!this.vertexFeature_) {\n return false;\n }\n if (\n this.vertexFeature_\n .get('geometries')\n .every(\n (geometry) =>\n geometry.getType() === 'Circle' ||\n geometry.getType().endsWith('Point'),\n )\n ) {\n return false;\n }\n const coordinate = this.vertexFeature_.getGeometry().getCoordinates();\n const segments = this.rBush_.getInExtent(boundingExtent([coordinate]));\n return segments.some(\n ({segment}) =>\n !(\n this.coordinatesEqual_(segment[0], coordinate) ||\n this.coordinatesEqual_(segment[1], coordinate)\n ),\n );\n }\n\n /**\n * Inserts the vertex currently being pointed to the current linestring or polygon.\n * @param {import('../coordinate.js').Coordinate} [coordinate] If provided, the pointer\n * will be set to the provided coordinate. If not, the current pointer coordinate will be used.\n * @return {boolean} A vertex was inserted.\n * @api\n */\n insertPoint(coordinate) {\n const pixelCoordinate = coordinate\n ? fromUserCoordinate(coordinate, this.getMap().getView().getProjection())\n : this.vertexFeature_?.getGeometry().getCoordinates();\n if (!pixelCoordinate) {\n return false;\n }\n const insertVertices =\n this.findInsertVerticesAndUpdateDragSegments_(pixelCoordinate);\n return insertVertices.reduce(\n (prev, segmentData) =>\n prev || this.insertVertex_(segmentData, pixelCoordinate),\n false,\n );\n }\n\n /**\n * @param {import(\"../geom/SimpleGeometry.js\").default} geometry Geometry.\n * @param {Array} coordinates Coordinates.\n * @private\n */\n setGeometryCoordinates_(geometry, coordinates) {\n this.changingFeature_ = true;\n geometry.setCoordinates(coordinates);\n this.changingFeature_ = false;\n }\n\n /**\n * @param {import(\"../geom/SimpleGeometry.js\").default} geometry Geometry.\n * @param {number} index Index.\n * @param {Array<number>|undefined} depth Depth.\n * @param {number} delta Delta (1 or -1).\n * @private\n */\n updateSegmentIndices_(geometry, index, depth, delta) {\n this.rBush_.forEachInExtent(\n geometry.getExtent(),\n function (segmentDataMatch) {\n if (\n segmentDataMatch.geometry === geometry &&\n (depth === undefined ||\n segmentDataMatch.depth === undefined ||\n equals(segmentDataMatch.depth, depth)) &&\n segmentDataMatch.index > index\n ) {\n segmentDataMatch.index += delta;\n }\n },\n );\n }\n\n /**\n * @override\n */\n disposeInternal() {\n super.disposeInternal();\n if (this.featuresCollection_) {\n this.featuresCollection_.removeEventListener(\n CollectionEventType.ADD,\n this.handleExternalCollectionAdd_,\n );\n this.featuresCollection_.removeEventListener(\n CollectionEventType.REMOVE,\n this.handleExternalCollectionRemove_,\n );\n //change and propertychange event handlers were placed on all features in the external\n // collection, not just the ones that passed the filter. Remove these too.\n for (const feature of this.featuresCollection_.getArray()) {\n feature.removeEventListener(\n EventType.CHANGE,\n this.handleFeatureChange_,\n );\n if (this.filterFunctionWasSupplied_) {\n feature.removeEventListener(\n ObjectEventType.PROPERTYCHANGE,\n this.handleFeatureChange_,\n );\n }\n }\n } else if (this.source_) {\n this.source_.removeEventListener(\n VectorEventType.ADDFEATURE,\n this.handleSourceAdd_,\n );\n this.source_.removeEventListener(\n VectorEventType.REMOVEFEATURE,\n this.handleSourceRemove_,\n );\n //change and propertychange event handlers were placed on all features in the source, not\n // just the ones that passed the filter. Remove these too.\n for (const feature of this.source_.getFeatures()) {\n feature.removeEventListener(\n EventType.CHANGE,\n this.handleFeatureChange_,\n );\n if (this.filterFunctionWasSupplied_) {\n feature.removeEventListener(\n ObjectEventType.PROPERTYCHANGE,\n this.handleFeatureChange_,\n );\n }\n }\n }\n }\n}\n\n/**\n * @param {SegmentData} a The first segment data.\n * @param {SegmentData} b The second segment data.\n * @return {number} The difference in indexes.\n */\nfunction compareIndexes(a, b) {\n return a.index - b.index;\n}\n\n/**\n * Returns the distance from a point to a line segment.\n *\n * @param {import(\"../coordinate.js\").Coordinate} pointCoordinates The coordinates of the point from\n * which to calculate the distance.\n * @param {SegmentData} segmentData The object describing the line\n * segment we are calculating the distance to.\n * @param {import(\"../proj/Projection.js\").default} projection The view projection.\n * @return {number} The square of the distance between a point and a line segment.\n */\nfunction projectedDistanceToSegmentDataSquared(\n pointCoordinates,\n segmentData,\n projection,\n) {\n const geometry = segmentData.geometry;\n\n if (geometry.getType() === 'Circle') {\n let circleGeometry = /** @type {import(\"../geom/Circle.js\").default} */ (\n geometry\n );\n\n if (segmentData.index === CIRCLE_CIRCUMFERENCE_INDEX) {\n const userProjection = getUserProjection();\n if (userProjection) {\n circleGeometry = circleGeometry\n .clone()\n .transform(userProjection, projection);\n }\n const distanceToCenterSquared = squaredCoordinateDistance(\n circleGeometry.getCenter(),\n fromUserCoordinate(pointCoordinates, projection),\n );\n const distanceToCircumference =\n Math.sqrt(distanceToCenterSquared) - circleGeometry.getRadius();\n return distanceToCircumference * distanceToCircumference;\n }\n }\n\n const coordinate = fromUserCoordinate(pointCoordinates, projection);\n tempSegment[0] = fromUserCoordinate(segmentData.segment[0], projection);\n tempSegment[1] = fromUserCoordinate(segmentData.segment[1], projection);\n return squaredDistanceToSegment(coordinate, tempSegment);\n}\n\n/**\n * Returns the point closest to a given line segment.\n *\n * @param {import(\"../coordinate.js\").Coordinate} pointCoordinates The point to which a closest point\n * should be found.\n * @param {SegmentData} segmentData The object describing the line\n * segment which should contain the closest point.\n * @param {import(\"../proj/Projection.js\").default} projection The view projection.\n * @return {import(\"../coordinate.js\").Coordinate} The point closest to the specified line segment.\n */\nfunction closestOnSegmentData(pointCoordinates, segmentData, projection) {\n const geometry = segmentData.geometry;\n\n if (\n geometry.getType() === 'Circle' &&\n segmentData.index === CIRCLE_CIRCUMFERENCE_INDEX\n ) {\n let circleGeometry = /** @type {import(\"../geom/Circle.js\").default} */ (\n geometry\n );\n const userProjection = getUserProjection();\n if (userProjection) {\n circleGeometry = circleGeometry\n .clone()\n .transform(userProjection, projection);\n }\n return toUserCoordinate(\n circleGeometry.getClosestPoint(\n fromUserCoordinate(pointCoordinates, projection),\n ),\n projection,\n );\n }\n const coordinate = fromUserCoordinate(pointCoordinates, projection);\n tempSegment[0] = fromUserCoordinate(segmentData.segment[0], projection);\n tempSegment[1] = fromUserCoordinate(segmentData.segment[1], projection);\n return toUserCoordinate(\n closestOnSegment(coordinate, tempSegment),\n projection,\n );\n}\n\n/**\n * @return {import(\"../style/Style.js\").StyleFunction} Styles.\n */\nfunction getDefaultStyleFunction() {\n const style = createEditingStyle();\n return function (feature, resolution) {\n return style['Point'];\n };\n}\n\nexport default Modify;\n","/**\n * @module ol/layer/Vector\n */\nimport CanvasVectorLayerRenderer from '../renderer/canvas/VectorLayer.js';\nimport BaseVectorLayer from './BaseVector.js';\n\n/**\n * @template {import(\"../source/Vector.js\").default<FeatureType>} [VectorSourceType=import(\"../source/Vector.js\").default<*>]\n * @template {import('../Feature.js').FeatureLike} [FeatureType=import(\"./BaseVector.js\").ExtractedFeatureType<VectorSourceType>]\n * @typedef {Object} Options\n * @property {string} [className='ol-layer'] A CSS class name to set to the layer element.\n * @property {number} [opacity=1] Opacity (0, 1).\n * @property {boolean} [visible=true] Visibility.\n * @property {import(\"../extent.js\").Extent} [extent] The bounding extent for layer rendering. The layer will not be\n * rendered outside of this extent.\n * @property {number} [zIndex] The z-index for layer rendering. At rendering time, the layers\n * will be ordered, first by Z-index and then by position. When `undefined`, a `zIndex` of 0 is assumed\n * for layers that are added to the map's `layers` collection, or `Infinity` when the layer's `setMap()`\n * method was used.\n * @property {number} [minResolution] The minimum resolution (inclusive) at which this layer will be\n * visible.\n * @property {number} [maxResolution] The maximum resolution (exclusive) below which this layer will\n * be visible.\n * @property {number} [minZoom] The minimum view zoom level (exclusive) above which this layer will be\n * visible.\n * @property {number} [maxZoom] The maximum view zoom level (inclusive) at which this layer will\n * be visible.\n * @property {import(\"../render.js\").OrderFunction} [renderOrder] Render order. Function to be used when sorting\n * features before rendering. By default features are drawn in the order that they are created. Use\n * `null` to avoid the sort, but get an undefined draw order.\n * @property {number} [renderBuffer=100] The buffer in pixels around the viewport extent used by the\n * renderer when getting features from the vector source for the rendering or hit-detection.\n * Recommended value: the size of the largest symbol, line width or label.\n * @property {VectorSourceType} [source] Source.\n * @property {import(\"../Map.js\").default} [map] Sets the layer as overlay on a map. The map will not manage\n * this layer in its layers collection, and the layer will be rendered on top. This is useful for\n * temporary layers. The standard way to add a layer to a map and have it managed by the map is to\n * use [map.addLayer()]{@link import(\"../Map.js\").default#addLayer}.\n * @property {boolean|string|number} [declutter=false] Declutter images and text. Any truthy value will enable\n * decluttering. Within a layer, a feature rendered before another has higher priority. All layers with the\n * same `declutter` value will be decluttered together. The priority is determined by the drawing order of the\n * layers with the same `declutter` value. Higher in the layer stack means higher priority. To declutter distinct\n * layers or groups of layers separately, use different truthy values for `declutter`.\n * @property {import(\"../style/Style.js\").StyleLike|import(\"../style/flat.js\").FlatStyleLike|null} [style] Layer style. When set to `null`, only\n * features that have their own style will be rendered. See {@link module:ol/style/Style~Style} for the default style\n * which will be used if this is not set.\n * @property {import(\"./Base.js\").BackgroundColor} [background] Background color for the layer. If not specified, no background\n * will be rendered.\n * @property {boolean} [updateWhileAnimating=false] When set to `true`, feature batches will\n * be recreated during animations. This means that no vectors will be shown clipped, but the\n * setting will have a performance impact for large amounts of vector data. When set to `false`,\n * batches will be recreated when no animation is active.\n * @property {boolean} [updateWhileInteracting=false] When set to `true`, feature batches will\n * be recreated during interactions. See also `updateWhileAnimating`.\n * @property {Object<string, *>} [properties] Arbitrary observable properties. Can be accessed with `#get()` and `#set()`.\n */\n\n/**\n * @classdesc\n * Vector data is rendered client-side, as vectors. This layer type provides most accurate rendering\n * even during animations. Points and labels stay upright on rotated views. For very large\n * amounts of vector data, performance may suffer during pan and zoom animations. In this case,\n * try {@link module:ol/layer/VectorImage~VectorImageLayer}.\n *\n * Note that any property set in the options is set as a {@link module:ol/Object~BaseObject}\n * property on the layer object; for example, setting `title: 'My Title'` in the\n * options means that `title` is observable, and has get/set accessors.\n *\n * @template {import(\"../source/Vector.js\").default<FeatureType>} [VectorSourceType=import(\"../source/Vector.js\").default<*>]\n * @template {import('../Feature.js').FeatureLike} [FeatureType=import(\"./BaseVector.js\").ExtractedFeatureType<VectorSourceType>]\n * @extends {BaseVectorLayer<FeatureType, VectorSourceType, CanvasVectorLayerRenderer>}\n * @api\n */\nclass VectorLayer extends BaseVectorLayer {\n /**\n * @param {Options<VectorSourceType, FeatureType>} [options] Options.\n */\n constructor(options) {\n super(options);\n }\n\n /**\n * @override\n */\n createRenderer() {\n return new CanvasVectorLayerRenderer(this);\n }\n}\n\nexport default VectorLayer;\n"],"names":[],"sourceRoot":""}
|