draw-libre 0.2.9 → 0.3.1
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/README.md +20 -8
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +46 -35
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,15 +1,23 @@
|
|
|
1
1
|
<section >
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
</section>
|
|
2
|
+
|
|
3
|
+
# Drawlibre
|
|
5
4
|
|
|
6
5
|
## Features
|
|
7
6
|
|
|
8
7
|
- Draw linestrings (including closed ones) and polygons
|
|
9
|
-
- Compatible with maplibre-gl
|
|
8
|
+
- Compatible with maplibre-gl(v2-v5) and mapbox-gl(v1-v3) and all projections
|
|
10
9
|
- Customizable UI and controls
|
|
11
10
|
- Event-driven architecture for easy integration
|
|
12
11
|
|
|
12
|
+
### Manual Point Generation (extra points are added when a line is clicked)
|
|
13
|
+
|
|
14
|
+
<img src="https://i.giphy.com/media/v1.Y2lkPTc5MGI3NjExaDZscnowMHNndmtiZzcwb3Bvc2Y2b29qbHdndndndGE3Mzk5Z2Q0cSZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/m6lig0ZCfL45FZQo7b/giphy.gif" width="800" alt="Manual Point Generation">
|
|
15
|
+
|
|
16
|
+
### Automatic Point Generation (an auxiliary point is generated between every two primary points.)
|
|
17
|
+
|
|
18
|
+
<img src="https://media2.giphy.com/media/v1.Y2lkPTc5MGI3NjExY2VieG1rd3ZkaWt5azVhYWpqaWEwZnVybGdjYW90d2xwNWwzeWtzayZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/6ohjkf9L1NWUESTaQA/giphy.gif" width="800" alt="Automatic Point Generation">
|
|
19
|
+
</section>
|
|
20
|
+
|
|
13
21
|
## Installation
|
|
14
22
|
|
|
15
23
|
```bash
|
|
@@ -41,6 +49,7 @@ map.on("load", (event) => {
|
|
|
41
49
|
|
|
42
50
|
```javascript
|
|
43
51
|
const draw = DrawLibre.getInstance({
|
|
52
|
+
pointGeneration: "manual", // or "auto"; pointGeneration controls whether additional points are automatically generated on the line or if you place them manually by clicking.
|
|
44
53
|
modes: {
|
|
45
54
|
initial: null, // default value; can be "line" or "polygon". Initial mode for drawing
|
|
46
55
|
breakGeometry: { visible: true }, // Controls visibility of the break geometry button
|
|
@@ -81,7 +90,7 @@ const draw = DrawLibre.getInstance({
|
|
|
81
90
|
polygon: {}, // FillLayerSpecification["paint"]
|
|
82
91
|
breakLine: {}, // LineLayerSpecification["paint"]
|
|
83
92
|
},
|
|
84
|
-
dynamicLine: true, // Whether to draw a dynamic line following the cursor after placing the first point
|
|
93
|
+
dynamicLine: true, // Whether to draw a dynamic line following the cursor after placing the first point. It's always false for mobile phones(when the viewport is less than 768)
|
|
85
94
|
initial: {
|
|
86
95
|
// Initialize with pre-existing GeoJSON data
|
|
87
96
|
closeGeometry: false, // Specify if the geometry is closed. Must be true if the geometry type is polygon.
|
|
@@ -128,10 +137,13 @@ Available events:
|
|
|
128
137
|
```javascript
|
|
129
138
|
const draw = DrawLibre.getInstance();
|
|
130
139
|
|
|
131
|
-
//
|
|
140
|
+
// Retrieves a step from the store by its ID.
|
|
132
141
|
draw.findStepById(id: string)
|
|
133
142
|
|
|
134
|
-
//
|
|
143
|
+
// Retrieves a node from the store by its ID.
|
|
144
|
+
draw.findNodeById(id: string)
|
|
145
|
+
|
|
146
|
+
// Get all steps, optionally specifying the return type. Selecting 'linkedlist' will return a circular doubly linked list. Have fun.
|
|
135
147
|
draw.getAllSteps(type?: "array" | "linkedlist")
|
|
136
148
|
|
|
137
149
|
// Set new steps. If ID is not provided, it will be generated automatically
|
|
@@ -162,4 +174,4 @@ draw.setOptions((options: RequiredDrawOptions) => {
|
|
|
162
174
|
|
|
163
175
|
## License
|
|
164
176
|
|
|
165
|
-
This project is licensed under the [MIT License](
|
|
177
|
+
This project is licensed under the [MIT License](https://opensource.org/licenses/MIT).
|
package/dist/index.css
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
.hide-panel{visibility:hidden}.undo{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='64 64 896 896' focusable='false' data-icon='undo' fill='currentColor' aria-hidden='true'%3E%3Cpath d='M511.4 124C290.5 124.3 112 303 112 523.9c0 128 60.2 242 153.8 315.2l-37.5 48c-4.1 5.3-.3 13 6.3 12.9l167-.8c5.2 0 9-4.9 7.7-9.9L369.8 727a8 8 0 00-14.1-3L315 776.1c-10.2-8-20-16.7-29.3-26a318.64 318.64 0 01-68.6-101.7C200.4 609 192 567.1 192 523.9s8.4-85.1 25.1-124.5c16.1-38.1 39.2-72.3 68.6-101.7 29.4-29.4 63.6-52.5 101.7-68.6C426.9 212.4 468.8 204 512 204s85.1 8.4 124.5 25.1c38.1 16.1 72.3 39.2 101.7 68.6 29.4 29.4 52.5 63.6 68.6 101.7 16.7 39.4 25.1 81.3 25.1 124.5s-8.4 85.1-25.1 124.5a318.64 318.64 0 01-68.6 101.7c-7.5 7.5-15.3 14.5-23.4 21.2a7.93 7.93 0 00-1.2 11.1l39.4 50.5c2.8 3.5 7.9 4.1 11.4 1.3C854.5 760.8 912 649.1 912 523.9c0-221.1-179.4-400.2-400.6-399.9z'%3E%3C/path%3E%3C/svg%3E")}.delete{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='64 64 896 896' focusable='false' data-icon='delete' fill='currentColor' aria-hidden='true'%3E%3Cpath d='M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z'%3E%3C/path%3E%3C/svg%3E")}.save{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='64 64 896 896' focusable='false' data-icon='check' fill='currentColor' aria-hidden='true'%3E%3Cpath d='M912 190h-69.9c-9.8 0-19.1 4.5-25.1 12.2L404.7 724.5 207 474a32 32 0 00-25.1-12.2H112c-6.7 0-10.4 7.7-6.3 12.9l273.9 347c12.8 16.2 37.4 16.2 50.3 0l488.4-618.9c4.1-5.1.4-12.8-6.3-12.8z'%3E%3C/path%3E%3C/svg%3E")}.dashboard{display:flex;align-items:center;background-color:#fff;border-radius:4px}.panel-button{background-color:transparent;border:0;box-sizing:border-box;cursor:pointer;display:block;height:28px;outline:none;padding:0;width:28px}.panel-button:hover{background-color:#0000000d}.icon{background-position:50%;background-repeat:no-repeat;display:block;height:18px}.panel-button:not(:last-child) .icon{border-right:1px solid #ddd}.panel-button-small{width:20px;height:20px}.panel-button-medium{width:24px;height:24px}.panel-button-large{width:28px;height:28px}.icon-small{height:14px}.icon-medium{height:16px}.icon-large{height:18px}.popup-container{display:block;position:absolute;z-index:1000;top:0;left:0
|
|
1
|
+
.hide-panel{visibility:hidden}.undo{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='64 64 896 896' focusable='false' data-icon='undo' fill='currentColor' aria-hidden='true'%3E%3Cpath d='M511.4 124C290.5 124.3 112 303 112 523.9c0 128 60.2 242 153.8 315.2l-37.5 48c-4.1 5.3-.3 13 6.3 12.9l167-.8c5.2 0 9-4.9 7.7-9.9L369.8 727a8 8 0 00-14.1-3L315 776.1c-10.2-8-20-16.7-29.3-26a318.64 318.64 0 01-68.6-101.7C200.4 609 192 567.1 192 523.9s8.4-85.1 25.1-124.5c16.1-38.1 39.2-72.3 68.6-101.7 29.4-29.4 63.6-52.5 101.7-68.6C426.9 212.4 468.8 204 512 204s85.1 8.4 124.5 25.1c38.1 16.1 72.3 39.2 101.7 68.6 29.4 29.4 52.5 63.6 68.6 101.7 16.7 39.4 25.1 81.3 25.1 124.5s-8.4 85.1-25.1 124.5a318.64 318.64 0 01-68.6 101.7c-7.5 7.5-15.3 14.5-23.4 21.2a7.93 7.93 0 00-1.2 11.1l39.4 50.5c2.8 3.5 7.9 4.1 11.4 1.3C854.5 760.8 912 649.1 912 523.9c0-221.1-179.4-400.2-400.6-399.9z'%3E%3C/path%3E%3C/svg%3E")}.delete{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='64 64 896 896' focusable='false' data-icon='delete' fill='currentColor' aria-hidden='true'%3E%3Cpath d='M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z'%3E%3C/path%3E%3C/svg%3E")}.save{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='64 64 896 896' focusable='false' data-icon='check' fill='currentColor' aria-hidden='true'%3E%3Cpath d='M912 190h-69.9c-9.8 0-19.1 4.5-25.1 12.2L404.7 724.5 207 474a32 32 0 00-25.1-12.2H112c-6.7 0-10.4 7.7-6.3 12.9l273.9 347c12.8 16.2 37.4 16.2 50.3 0l488.4-618.9c4.1-5.1.4-12.8-6.3-12.8z'%3E%3C/path%3E%3C/svg%3E")}.dashboard{display:flex;align-items:center;background-color:#fff;border-radius:4px}.panel-button{background-color:transparent;border:0;box-sizing:border-box;cursor:pointer;display:block;height:28px;outline:none;padding:0;width:28px}.panel-button:hover{background-color:#0000000d}.icon{background-position:50%;background-repeat:no-repeat;display:block;height:18px}.panel-button:not(:last-child) .icon{border-right:1px solid #ddd}.panel-button-small{width:20px;height:20px}.panel-button-medium{width:24px;height:24px}.panel-button-large{width:28px;height:28px}.icon-small{height:14px}.icon-medium{height:16px}.icon-large{height:18px}.popup-container{display:block;position:absolute;z-index:1000;top:0;left:0}.popup-text{display:inline-block;padding:4px 16px;background-color:#4d4d4d;border-radius:18px;color:#fff;font-size:14px}.popup-text-bottom{opacity:0;transform:translateY(16px);transition:all .2s ease-out;transition-delay:.25s}.popup-text-left{opacity:0;transform:translate(16px);transition:all .3s ease-out}.popup-text-active{transform:translate(0);opacity:1}.line{transform:rotate(44deg);background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg' xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns%23' xmlns:cc='http://creativecommons.org/ns%23' xmlns:dc='http://purl.org/dc/elements/1.1/' fill='%23000000' width='10' height='16' viewBox='-3 0 0.22850401 0.63333199' version='1.1' id='svg1' xml:space='preserve'%3E%3Cdefs id='defs1'/%3E%3Ctitle id='title1'%3Eline-chart%3C/title%3E%3Cmetadata id='metadata1'%3E%3Crdf:RDF%3E%3Ccc:Work rdf:about=''%3E%3Cdc:title%3Eline-chart%3C/dc:title%3E%3C/cc:Work%3E%3C/rdf:RDF%3E%3C/metadata%3E%3Cg style='fill:none' id='g1' transform='matrix(0.04,0,0,0.04,-3.48332,-0.48336)'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='m 14.9997,12.084 c -1.6109,0 -2.9167,1.3058 -2.9167,2.9167 0,1.3212 0.8786,2.4373 2.0833,2.7958 v 4.4083 c -1.2047,0.3585 -2.0833,1.4746 -2.0833,2.7959 0,1.6108 1.3058,2.9166 2.9167,2.9166 1.3212,0 2.4373,-0.8785 2.7959,-2.0833 V 14.1673 C 17.437,12.9625 16.3209,12.084 14.9997,12.084 Z m -1.25,2.9167 c 0,-0.6904 0.5596,-1.25 1.25,-1.25 0.6903,0 1.25,0.5596 1.25,1.25 0,0.6903 -0.5597,1.25 -1.25,1.25 -0.6904,0 -1.25,-0.5597 -1.25,-1.25 z m 2.0833,7.2041 c 0.9407,0.2799 1.6826,1.0218 1.9626,1.9625 V 15.834 c -0.28,0.9407 -1.0219,1.6826 -1.9626,1.9625 z m -0.8333,1.5459 c -0.6904,0 -1.25,0.5596 -1.25,1.25 0,0.6903 0.5596,1.25 1.25,1.25 0.6903,0 1.25,-0.5597 1.25,-1.25 0,-0.6904 -0.5597,-1.25 -1.25,-1.25 z' fill='%2315181a' id='path1'/%3E%3C/g%3E%3C/svg%3E")}.polygon{background-image:url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M4.99967 2.08398C3.38884 2.08398 2.08301 3.38982 2.08301 5.00065C2.08301 6.32191 2.96155 7.43797 4.16634 7.79654L4.16634 12.2048C2.96155 12.5633 2.08301 13.6794 2.08301 15.0007C2.08301 16.6115 3.38884 17.9173 4.99967 17.9173C6.32093 17.9173 7.437 17.0388 7.79556 15.834H12.2038C12.5624 17.0388 13.6784 17.9173 14.9997 17.9173C16.6105 17.9173 17.9163 16.6115 17.9163 15.0007C17.9163 13.6794 17.0378 12.5633 15.833 12.2048V7.79653C17.0378 7.43797 17.9163 6.32191 17.9163 5.00065C17.9163 3.38982 16.6105 2.08398 14.9997 2.08398C13.6784 2.08398 12.5624 2.96253 12.2038 4.16732L7.79556 4.16732C7.437 2.96253 6.32093 2.08398 4.99967 2.08398ZM3.74967 5.00065C3.74967 4.31029 4.30932 3.75065 4.99967 3.75065C5.69003 3.75065 6.24967 4.31029 6.24967 5.00065C6.24967 5.69101 5.69003 6.25065 4.99967 6.25065C4.30932 6.25065 3.74967 5.69101 3.74967 5.00065ZM5.83301 12.2048C6.77375 12.4847 7.51558 13.2266 7.79556 14.1673L12.2038 14.1673C12.4838 13.2266 13.2256 12.4847 14.1663 12.2048L14.1663 7.79654C13.2256 7.51656 12.4838 6.77473 12.2038 5.83398L7.79556 5.83398C7.51558 6.77472 6.77375 7.51656 5.83301 7.79653L5.83301 12.2048ZM13.7497 5.00065C13.7497 4.31029 14.3093 3.75065 14.9997 3.75065C15.69 3.75065 16.2497 4.31029 16.2497 5.00065C16.2497 5.69101 15.69 6.25065 14.9997 6.25065C14.3093 6.25065 13.7497 5.69101 13.7497 5.00065ZM4.99967 13.7507C4.30932 13.7507 3.74967 14.3103 3.74967 15.0007C3.74967 15.691 4.30932 16.2507 4.99967 16.2507C5.69003 16.2507 6.24967 15.691 6.24967 15.0007C6.24967 14.3103 5.69003 13.7507 4.99967 13.7507ZM13.7497 15.0007C13.7497 14.3103 14.3093 13.7507 14.9997 13.7507C15.69 13.7507 16.2497 14.3103 16.2497 15.0007C16.2497 15.691 15.69 16.2507 14.9997 16.2507C14.3093 16.2507 13.7497 15.691 13.7497 15.0007Z' fill='%2315181A'/%3E%3C/svg%3E%0A")}.break{background-image:url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4.16667 1.66602C4.6269 1.66602 5 2.03911 5 2.49935V5.83268H15V2.49935C15 2.03911 15.3731 1.66602 15.8333 1.66602C16.2936 1.66602 16.6667 2.03911 16.6667 2.49935V5.83268C16.6667 6.75316 15.9205 7.49935 15 7.49935H5C4.07953 7.49935 3.33333 6.75316 3.33333 5.83268V2.49935C3.33333 2.03911 3.70643 1.66602 4.16667 1.66602Z' fill='%2315181A'/%3E%3Cpath d='M4.16667 18.3327C4.6269 18.3327 5 17.9596 5 17.4993V14.166H15V17.4993C15 17.9596 15.3731 18.3327 15.8333 18.3327C16.2936 18.3327 16.6667 17.9596 16.6667 17.4993V14.166C16.6667 13.2455 15.9205 12.4993 15 12.4993H5C4.07953 12.4993 3.33333 13.2455 3.33333 14.166V17.4993C3.33333 17.9596 3.70643 18.3327 4.16667 18.3327Z' fill='%2315181A'/%3E%3Cpath d='M13.3333 9.16602H11.4583C10.9981 9.16602 10.625 9.53911 10.625 9.99935C10.625 10.4596 10.9981 10.8327 11.4583 10.8327H13.3333C13.7936 10.8327 14.1667 10.4596 14.1667 9.99935C14.1667 9.53911 13.7936 9.16602 13.3333 9.16602Z' fill='%2315181A'/%3E%3Cpath d='M8.54167 9.16602H6.66667C6.20643 9.16602 5.83333 9.53911 5.83333 9.99935C5.83333 10.4596 6.20643 10.8327 6.66667 10.8327H8.54167C9.0019 10.8327 9.375 10.4596 9.375 9.99935C9.375 9.53911 9.0019 9.16602 8.54167 9.16602Z' fill='%2315181A'/%3E%3Cpath d='M3.75 9.16601H2.08333C1.6231 9.16601 1.25 9.53911 1.25 9.99935C1.25 10.4596 1.6231 10.8327 2.08333 10.8327H3.75C4.21024 10.8327 4.58333 10.4596 4.58333 9.99935C4.58333 9.53911 4.21024 9.16601 3.75 9.16601Z' fill='%2315181A'/%3E%3Cpath d='M17.9167 9.16601H16.25C15.7898 9.16601 15.4167 9.53911 15.4167 9.99935C15.4167 10.4596 15.7898 10.8327 16.25 10.8327H17.9167C18.3769 10.8327 18.75 10.4596 18.75 9.99935C18.75 9.53911 18.3769 9.16601 17.9167 9.16601Z' fill='%2315181A'/%3E%3C/svg%3E%0A")}.control-button:first-child{border-top-left-radius:4px;border-top-right-radius:4px}.maplibregl-ctrl-group button.control-button-active{background-color:#edeaea}.control-button:disabled{opacity:.25}.maplibregl-popup-tip,.mapboxgl-popup-tip{display:none!important}.maplibregl-popup-content,.mapboxgl-popup-content{padding:0!important}
|
|
2
2
|
/*# sourceMappingURL=index.css.map */
|
package/dist/index.css.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/last-point-panel/panel.css","../src/components/tooltip/tooltip.css","../src/components/side-control/control.css","../src/draw.css"],"sourcesContent":[".hide-panel {\n visibility: hidden;\n}\n\n.undo {\n background-image: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='64 64 896 896' focusable='false' data-icon='undo' fill='currentColor' aria-hidden='true'%3E%3Cpath d='M511.4 124C290.5 124.3 112 303 112 523.9c0 128 60.2 242 153.8 315.2l-37.5 48c-4.1 5.3-.3 13 6.3 12.9l167-.8c5.2 0 9-4.9 7.7-9.9L369.8 727a8 8 0 00-14.1-3L315 776.1c-10.2-8-20-16.7-29.3-26a318.64 318.64 0 01-68.6-101.7C200.4 609 192 567.1 192 523.9s8.4-85.1 25.1-124.5c16.1-38.1 39.2-72.3 68.6-101.7 29.4-29.4 63.6-52.5 101.7-68.6C426.9 212.4 468.8 204 512 204s85.1 8.4 124.5 25.1c38.1 16.1 72.3 39.2 101.7 68.6 29.4 29.4 52.5 63.6 68.6 101.7 16.7 39.4 25.1 81.3 25.1 124.5s-8.4 85.1-25.1 124.5a318.64 318.64 0 01-68.6 101.7c-7.5 7.5-15.3 14.5-23.4 21.2a7.93 7.93 0 00-1.2 11.1l39.4 50.5c2.8 3.5 7.9 4.1 11.4 1.3C854.5 760.8 912 649.1 912 523.9c0-221.1-179.4-400.2-400.6-399.9z'%3E%3C/path%3E%3C/svg%3E\");\n}\n\n.delete {\n background-image: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='64 64 896 896' focusable='false' data-icon='delete' fill='currentColor' aria-hidden='true'%3E%3Cpath d='M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z'%3E%3C/path%3E%3C/svg%3E\");\n}\n\n.save {\n background-image: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='64 64 896 896' focusable='false' data-icon='check' fill='currentColor' aria-hidden='true'%3E%3Cpath d='M912 190h-69.9c-9.8 0-19.1 4.5-25.1 12.2L404.7 724.5 207 474a32 32 0 00-25.1-12.2H112c-6.7 0-10.4 7.7-6.3 12.9l273.9 347c12.8 16.2 37.4 16.2 50.3 0l488.4-618.9c4.1-5.1.4-12.8-6.3-12.8z'%3E%3C/path%3E%3C/svg%3E\");\n}\n\n.dashboard {\n display: flex;\n align-items: center;\n background-color: white;\n border-radius: 4px;\n}\n\n.panel-button {\n background-color: transparent;\n border: 0;\n box-sizing: border-box;\n cursor: pointer;\n display: block;\n height: 28px;\n outline: none;\n padding: 0;\n width: 28px;\n}\n\n.panel-button:hover {\n background-color: #0000000d;\n}\n\n.icon {\n background-position: 50%;\n background-repeat: no-repeat;\n display: block;\n height: 18px;\n}\n\n.panel-button:not(:last-child) .icon {\n border-right: 1px solid #ddd;\n}\n\n.panel-button-small {\n width: 20px;\n height: 20px;\n}\n\n.panel-button-medium {\n width: 24px;\n height: 24px;\n}\n.panel-button-large {\n width: 28px;\n height: 28px;\n}\n\n.icon-small {\n height: 14px;\n}\n\n.icon-medium {\n height: 16px;\n}\n\n.icon-large {\n height: 18px;\n}\n",".popup-container {\n display: block;\n position: absolute;\n z-index: 1000;\n top: 0;\n left: 0;\n height: 50px;\n}\n\n.popup-text {\n display: inline-block;\n padding: 4px 16px;\n background-color: #4d4d4d;\n border-radius: 18px;\n color: #fff;\n font-size: 14px;\n}\n\n.popup-text-bottom {\n opacity: 0;\n transform: translateY(16px);\n transition: all 0.2s ease-out;\n transition-delay: 0.25s;\n}\n\n.popup-text-left {\n opacity: 0;\n transform: translateX(16px);\n transition: all 0.3s ease-out;\n}\n\n.popup-text-active {\n transform: translate(0px);\n opacity: 1;\n}\n",".line {\n transform: rotate(44deg);\n background-image: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg' xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns%23' xmlns:cc='http://creativecommons.org/ns%23' xmlns:dc='http://purl.org/dc/elements/1.1/' fill='%23000000' width='10' height='16' viewBox='-3 0 0.22850401 0.63333199' version='1.1' id='svg1' xml:space='preserve'%3E%3Cdefs id='defs1'/%3E%3Ctitle id='title1'%3Eline-chart%3C/title%3E%3Cmetadata id='metadata1'%3E%3Crdf:RDF%3E%3Ccc:Work rdf:about=''%3E%3Cdc:title%3Eline-chart%3C/dc:title%3E%3C/cc:Work%3E%3C/rdf:RDF%3E%3C/metadata%3E%3Cg style='fill:none' id='g1' transform='matrix(0.04,0,0,0.04,-3.48332,-0.48336)'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='m 14.9997,12.084 c -1.6109,0 -2.9167,1.3058 -2.9167,2.9167 0,1.3212 0.8786,2.4373 2.0833,2.7958 v 4.4083 c -1.2047,0.3585 -2.0833,1.4746 -2.0833,2.7959 0,1.6108 1.3058,2.9166 2.9167,2.9166 1.3212,0 2.4373,-0.8785 2.7959,-2.0833 V 14.1673 C 17.437,12.9625 16.3209,12.084 14.9997,12.084 Z m -1.25,2.9167 c 0,-0.6904 0.5596,-1.25 1.25,-1.25 0.6903,0 1.25,0.5596 1.25,1.25 0,0.6903 -0.5597,1.25 -1.25,1.25 -0.6904,0 -1.25,-0.5597 -1.25,-1.25 z m 2.0833,7.2041 c 0.9407,0.2799 1.6826,1.0218 1.9626,1.9625 V 15.834 c -0.28,0.9407 -1.0219,1.6826 -1.9626,1.9625 z m -0.8333,1.5459 c -0.6904,0 -1.25,0.5596 -1.25,1.25 0,0.6903 0.5596,1.25 1.25,1.25 0.6903,0 1.25,-0.5597 1.25,-1.25 0,-0.6904 -0.5597,-1.25 -1.25,-1.25 z' fill='%2315181a' id='path1'/%3E%3C/g%3E%3C/svg%3E\");\n}\n\n.polygon {\n background-image: url(\"data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M4.99967 2.08398C3.38884 2.08398 2.08301 3.38982 2.08301 5.00065C2.08301 6.32191 2.96155 7.43797 4.16634 7.79654L4.16634 12.2048C2.96155 12.5633 2.08301 13.6794 2.08301 15.0007C2.08301 16.6115 3.38884 17.9173 4.99967 17.9173C6.32093 17.9173 7.437 17.0388 7.79556 15.834H12.2038C12.5624 17.0388 13.6784 17.9173 14.9997 17.9173C16.6105 17.9173 17.9163 16.6115 17.9163 15.0007C17.9163 13.6794 17.0378 12.5633 15.833 12.2048V7.79653C17.0378 7.43797 17.9163 6.32191 17.9163 5.00065C17.9163 3.38982 16.6105 2.08398 14.9997 2.08398C13.6784 2.08398 12.5624 2.96253 12.2038 4.16732L7.79556 4.16732C7.437 2.96253 6.32093 2.08398 4.99967 2.08398ZM3.74967 5.00065C3.74967 4.31029 4.30932 3.75065 4.99967 3.75065C5.69003 3.75065 6.24967 4.31029 6.24967 5.00065C6.24967 5.69101 5.69003 6.25065 4.99967 6.25065C4.30932 6.25065 3.74967 5.69101 3.74967 5.00065ZM5.83301 12.2048C6.77375 12.4847 7.51558 13.2266 7.79556 14.1673L12.2038 14.1673C12.4838 13.2266 13.2256 12.4847 14.1663 12.2048L14.1663 7.79654C13.2256 7.51656 12.4838 6.77473 12.2038 5.83398L7.79556 5.83398C7.51558 6.77472 6.77375 7.51656 5.83301 7.79653L5.83301 12.2048ZM13.7497 5.00065C13.7497 4.31029 14.3093 3.75065 14.9997 3.75065C15.69 3.75065 16.2497 4.31029 16.2497 5.00065C16.2497 5.69101 15.69 6.25065 14.9997 6.25065C14.3093 6.25065 13.7497 5.69101 13.7497 5.00065ZM4.99967 13.7507C4.30932 13.7507 3.74967 14.3103 3.74967 15.0007C3.74967 15.691 4.30932 16.2507 4.99967 16.2507C5.69003 16.2507 6.24967 15.691 6.24967 15.0007C6.24967 14.3103 5.69003 13.7507 4.99967 13.7507ZM13.7497 15.0007C13.7497 14.3103 14.3093 13.7507 14.9997 13.7507C15.69 13.7507 16.2497 14.3103 16.2497 15.0007C16.2497 15.691 15.69 16.2507 14.9997 16.2507C14.3093 16.2507 13.7497 15.691 13.7497 15.0007Z' fill='%2315181A'/%3E%3C/svg%3E%0A\");\n}\n\n.break {\n background-image: url(\"data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4.16667 1.66602C4.6269 1.66602 5 2.03911 5 2.49935V5.83268H15V2.49935C15 2.03911 15.3731 1.66602 15.8333 1.66602C16.2936 1.66602 16.6667 2.03911 16.6667 2.49935V5.83268C16.6667 6.75316 15.9205 7.49935 15 7.49935H5C4.07953 7.49935 3.33333 6.75316 3.33333 5.83268V2.49935C3.33333 2.03911 3.70643 1.66602 4.16667 1.66602Z' fill='%2315181A'/%3E%3Cpath d='M4.16667 18.3327C4.6269 18.3327 5 17.9596 5 17.4993V14.166H15V17.4993C15 17.9596 15.3731 18.3327 15.8333 18.3327C16.2936 18.3327 16.6667 17.9596 16.6667 17.4993V14.166C16.6667 13.2455 15.9205 12.4993 15 12.4993H5C4.07953 12.4993 3.33333 13.2455 3.33333 14.166V17.4993C3.33333 17.9596 3.70643 18.3327 4.16667 18.3327Z' fill='%2315181A'/%3E%3Cpath d='M13.3333 9.16602H11.4583C10.9981 9.16602 10.625 9.53911 10.625 9.99935C10.625 10.4596 10.9981 10.8327 11.4583 10.8327H13.3333C13.7936 10.8327 14.1667 10.4596 14.1667 9.99935C14.1667 9.53911 13.7936 9.16602 13.3333 9.16602Z' fill='%2315181A'/%3E%3Cpath d='M8.54167 9.16602H6.66667C6.20643 9.16602 5.83333 9.53911 5.83333 9.99935C5.83333 10.4596 6.20643 10.8327 6.66667 10.8327H8.54167C9.0019 10.8327 9.375 10.4596 9.375 9.99935C9.375 9.53911 9.0019 9.16602 8.54167 9.16602Z' fill='%2315181A'/%3E%3Cpath d='M3.75 9.16601H2.08333C1.6231 9.16601 1.25 9.53911 1.25 9.99935C1.25 10.4596 1.6231 10.8327 2.08333 10.8327H3.75C4.21024 10.8327 4.58333 10.4596 4.58333 9.99935C4.58333 9.53911 4.21024 9.16601 3.75 9.16601Z' fill='%2315181A'/%3E%3Cpath d='M17.9167 9.16601H16.25C15.7898 9.16601 15.4167 9.53911 15.4167 9.99935C15.4167 10.4596 15.7898 10.8327 16.25 10.8327H17.9167C18.3769 10.8327 18.75 10.4596 18.75 9.99935C18.75 9.53911 18.3769 9.16601 17.9167 9.16601Z' fill='%2315181A'/%3E%3C/svg%3E%0A\");\n}\n\n.control-button:first-child {\n border-top-left-radius: 4px;\n border-top-right-radius: 4px;\n}\n\n/* otherwise if we just .control-button-active, then maplibre will have higher importance */\n.maplibregl-ctrl-group button.control-button-active {\n background-color: #edeaea;\n}\n\n.control-button:disabled {\n opacity: 0.25;\n}\n",".maplibregl-popup-tip,\n.mapboxgl-popup-tip {\n display: none !important;\n}\n\n.maplibregl-popup-content,\n.mapboxgl-popup-content {\n padding: 0 !important;\n}\n"],"mappings":"AAAA,CAAC,WACC,WAAY,MACd,CAEA,CAAC,KACC,iBAAkB,g3BACpB,CAEA,CAAC,OACC,iBAAkB,iiBACpB,CAEA,CAAC,KACC,iBAAkB,qYACpB,CAEA,CAAC,UACC,QAAS,KACT,YAAa,OACb,iBAAkB,KAnBpB,cAoBiB,GACjB,CAEA,CAAC,aACC,iBAAkB,YAClB,OAAQ,EACR,WAAY,WACZ,OAAQ,QACR,QAAS,MACT,OAAQ,KACR,QAAS,KA9BX,QA+BW,EACT,MAAO,IACT,CAEA,CAZC,YAYY,OACX,iBAAkB,SACpB,CAEA,CAAC,KACC,oBAAqB,IACrB,kBAAmB,UACnB,QAAS,MACT,OAAQ,IACV,CAEA,CAvBC,YAuBY,KAAK,aAAa,CAP9B,KAQC,aAAc,IAAI,MAAM,IAC1B,CAEA,CAAC,mBACC,MAAO,KACP,OAAQ,IACV,CAEA,CAAC,oBACC,MAAO,KACP,OAAQ,IACV,CACA,CAAC,mBACC,MAAO,KACP,OAAQ,IACV,CAEA,CAAC,WACC,OAAQ,IACV,CAEA,CAAC,YACC,OAAQ,IACV,CAEA,CAAC,WACC,OAAQ,IACV,CC1EA,CAAC,gBACC,QAAS,MACT,SAAU,SACV,QAAS,KACT,IAAK,EACL,KAAM,EACN,OAAQ,IACV,CAEA,CAAC,WACC,QAAS,aAVX,QAWW,IAAI,KACb,iBAAkB,QAZpB,cAaiB,KACf,MAAO,KACP,UAAW,IACb,CAEA,CAAC,kBACC,QAAS,EACT,UAAW,WAAW,MACtB,WAAY,IAAI,IAAK,SACrB,iBAAkB,IACpB,CAEA,CAAC,gBACC,QAAS,EACT,UAAW,UAAW,MACtB,WAAY,IAAI,IAAK,QACvB,CAEA,CAAC,kBACC,UAAW,UAAU,GACrB,QAAS,CACX,CClCA,CAAC,KACC,UAAW,OAAO,OAClB,iBAAkB,m9CACpB,CAEA,CAAC,QACC,iBAAkB,u5DACpB,CAEA,CAAC,MACC,iBAAkB,syDACpB,CAEA,CAAC,cAAc,aACb,uBAAwB,IACxB,wBAAyB,GAC3B,CAGA,CAAC,sBAAsB,MAAM,CAAC,sBAC5B,iBAAkB,OACpB,CAEA,CAVC,cAUc,UACb,QAAS,GACX,CCzBA,CAAC,qBACD,CAAC,mBACC,QAAS,cACX,CAEA,CAAC,yBACD,CAAC,uBAND,QAOW,WACX","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/components/panel/panel.css","../src/components/tooltip/tooltip.css","../src/components/side-control/control.css","../src/draw.css"],"sourcesContent":[".hide-panel {\n visibility: hidden;\n}\n\n.undo {\n background-image: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='64 64 896 896' focusable='false' data-icon='undo' fill='currentColor' aria-hidden='true'%3E%3Cpath d='M511.4 124C290.5 124.3 112 303 112 523.9c0 128 60.2 242 153.8 315.2l-37.5 48c-4.1 5.3-.3 13 6.3 12.9l167-.8c5.2 0 9-4.9 7.7-9.9L369.8 727a8 8 0 00-14.1-3L315 776.1c-10.2-8-20-16.7-29.3-26a318.64 318.64 0 01-68.6-101.7C200.4 609 192 567.1 192 523.9s8.4-85.1 25.1-124.5c16.1-38.1 39.2-72.3 68.6-101.7 29.4-29.4 63.6-52.5 101.7-68.6C426.9 212.4 468.8 204 512 204s85.1 8.4 124.5 25.1c38.1 16.1 72.3 39.2 101.7 68.6 29.4 29.4 52.5 63.6 68.6 101.7 16.7 39.4 25.1 81.3 25.1 124.5s-8.4 85.1-25.1 124.5a318.64 318.64 0 01-68.6 101.7c-7.5 7.5-15.3 14.5-23.4 21.2a7.93 7.93 0 00-1.2 11.1l39.4 50.5c2.8 3.5 7.9 4.1 11.4 1.3C854.5 760.8 912 649.1 912 523.9c0-221.1-179.4-400.2-400.6-399.9z'%3E%3C/path%3E%3C/svg%3E\");\n}\n\n.delete {\n background-image: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='64 64 896 896' focusable='false' data-icon='delete' fill='currentColor' aria-hidden='true'%3E%3Cpath d='M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z'%3E%3C/path%3E%3C/svg%3E\");\n}\n\n.save {\n background-image: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='64 64 896 896' focusable='false' data-icon='check' fill='currentColor' aria-hidden='true'%3E%3Cpath d='M912 190h-69.9c-9.8 0-19.1 4.5-25.1 12.2L404.7 724.5 207 474a32 32 0 00-25.1-12.2H112c-6.7 0-10.4 7.7-6.3 12.9l273.9 347c12.8 16.2 37.4 16.2 50.3 0l488.4-618.9c4.1-5.1.4-12.8-6.3-12.8z'%3E%3C/path%3E%3C/svg%3E\");\n}\n\n.dashboard {\n display: flex;\n align-items: center;\n background-color: white;\n border-radius: 4px;\n}\n\n.panel-button {\n background-color: transparent;\n border: 0;\n box-sizing: border-box;\n cursor: pointer;\n display: block;\n height: 28px;\n outline: none;\n padding: 0;\n width: 28px;\n}\n\n.panel-button:hover {\n background-color: #0000000d;\n}\n\n.icon {\n background-position: 50%;\n background-repeat: no-repeat;\n display: block;\n height: 18px;\n}\n\n.panel-button:not(:last-child) .icon {\n border-right: 1px solid #ddd;\n}\n\n.panel-button-small {\n width: 20px;\n height: 20px;\n}\n\n.panel-button-medium {\n width: 24px;\n height: 24px;\n}\n.panel-button-large {\n width: 28px;\n height: 28px;\n}\n\n.icon-small {\n height: 14px;\n}\n\n.icon-medium {\n height: 16px;\n}\n\n.icon-large {\n height: 18px;\n}\n",".popup-container {\n display: block;\n position: absolute;\n z-index: 1000;\n top: 0;\n left: 0;\n}\n\n.popup-text {\n display: inline-block;\n padding: 4px 16px;\n background-color: #4d4d4d;\n border-radius: 18px;\n color: #fff;\n font-size: 14px;\n}\n\n.popup-text-bottom {\n opacity: 0;\n transform: translateY(16px);\n transition: all 0.2s ease-out;\n transition-delay: 0.25s;\n}\n\n.popup-text-left {\n opacity: 0;\n transform: translateX(16px);\n transition: all 0.3s ease-out;\n}\n\n.popup-text-active {\n transform: translate(0px);\n opacity: 1;\n}\n",".line {\n transform: rotate(44deg);\n background-image: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' xmlns:svg='http://www.w3.org/2000/svg' xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns%23' xmlns:cc='http://creativecommons.org/ns%23' xmlns:dc='http://purl.org/dc/elements/1.1/' fill='%23000000' width='10' height='16' viewBox='-3 0 0.22850401 0.63333199' version='1.1' id='svg1' xml:space='preserve'%3E%3Cdefs id='defs1'/%3E%3Ctitle id='title1'%3Eline-chart%3C/title%3E%3Cmetadata id='metadata1'%3E%3Crdf:RDF%3E%3Ccc:Work rdf:about=''%3E%3Cdc:title%3Eline-chart%3C/dc:title%3E%3C/cc:Work%3E%3C/rdf:RDF%3E%3C/metadata%3E%3Cg style='fill:none' id='g1' transform='matrix(0.04,0,0,0.04,-3.48332,-0.48336)'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='m 14.9997,12.084 c -1.6109,0 -2.9167,1.3058 -2.9167,2.9167 0,1.3212 0.8786,2.4373 2.0833,2.7958 v 4.4083 c -1.2047,0.3585 -2.0833,1.4746 -2.0833,2.7959 0,1.6108 1.3058,2.9166 2.9167,2.9166 1.3212,0 2.4373,-0.8785 2.7959,-2.0833 V 14.1673 C 17.437,12.9625 16.3209,12.084 14.9997,12.084 Z m -1.25,2.9167 c 0,-0.6904 0.5596,-1.25 1.25,-1.25 0.6903,0 1.25,0.5596 1.25,1.25 0,0.6903 -0.5597,1.25 -1.25,1.25 -0.6904,0 -1.25,-0.5597 -1.25,-1.25 z m 2.0833,7.2041 c 0.9407,0.2799 1.6826,1.0218 1.9626,1.9625 V 15.834 c -0.28,0.9407 -1.0219,1.6826 -1.9626,1.9625 z m -0.8333,1.5459 c -0.6904,0 -1.25,0.5596 -1.25,1.25 0,0.6903 0.5596,1.25 1.25,1.25 0.6903,0 1.25,-0.5597 1.25,-1.25 0,-0.6904 -0.5597,-1.25 -1.25,-1.25 z' fill='%2315181a' id='path1'/%3E%3C/g%3E%3C/svg%3E\");\n}\n\n.polygon {\n background-image: url(\"data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M4.99967 2.08398C3.38884 2.08398 2.08301 3.38982 2.08301 5.00065C2.08301 6.32191 2.96155 7.43797 4.16634 7.79654L4.16634 12.2048C2.96155 12.5633 2.08301 13.6794 2.08301 15.0007C2.08301 16.6115 3.38884 17.9173 4.99967 17.9173C6.32093 17.9173 7.437 17.0388 7.79556 15.834H12.2038C12.5624 17.0388 13.6784 17.9173 14.9997 17.9173C16.6105 17.9173 17.9163 16.6115 17.9163 15.0007C17.9163 13.6794 17.0378 12.5633 15.833 12.2048V7.79653C17.0378 7.43797 17.9163 6.32191 17.9163 5.00065C17.9163 3.38982 16.6105 2.08398 14.9997 2.08398C13.6784 2.08398 12.5624 2.96253 12.2038 4.16732L7.79556 4.16732C7.437 2.96253 6.32093 2.08398 4.99967 2.08398ZM3.74967 5.00065C3.74967 4.31029 4.30932 3.75065 4.99967 3.75065C5.69003 3.75065 6.24967 4.31029 6.24967 5.00065C6.24967 5.69101 5.69003 6.25065 4.99967 6.25065C4.30932 6.25065 3.74967 5.69101 3.74967 5.00065ZM5.83301 12.2048C6.77375 12.4847 7.51558 13.2266 7.79556 14.1673L12.2038 14.1673C12.4838 13.2266 13.2256 12.4847 14.1663 12.2048L14.1663 7.79654C13.2256 7.51656 12.4838 6.77473 12.2038 5.83398L7.79556 5.83398C7.51558 6.77472 6.77375 7.51656 5.83301 7.79653L5.83301 12.2048ZM13.7497 5.00065C13.7497 4.31029 14.3093 3.75065 14.9997 3.75065C15.69 3.75065 16.2497 4.31029 16.2497 5.00065C16.2497 5.69101 15.69 6.25065 14.9997 6.25065C14.3093 6.25065 13.7497 5.69101 13.7497 5.00065ZM4.99967 13.7507C4.30932 13.7507 3.74967 14.3103 3.74967 15.0007C3.74967 15.691 4.30932 16.2507 4.99967 16.2507C5.69003 16.2507 6.24967 15.691 6.24967 15.0007C6.24967 14.3103 5.69003 13.7507 4.99967 13.7507ZM13.7497 15.0007C13.7497 14.3103 14.3093 13.7507 14.9997 13.7507C15.69 13.7507 16.2497 14.3103 16.2497 15.0007C16.2497 15.691 15.69 16.2507 14.9997 16.2507C14.3093 16.2507 13.7497 15.691 13.7497 15.0007Z' fill='%2315181A'/%3E%3C/svg%3E%0A\");\n}\n\n.break {\n background-image: url(\"data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4.16667 1.66602C4.6269 1.66602 5 2.03911 5 2.49935V5.83268H15V2.49935C15 2.03911 15.3731 1.66602 15.8333 1.66602C16.2936 1.66602 16.6667 2.03911 16.6667 2.49935V5.83268C16.6667 6.75316 15.9205 7.49935 15 7.49935H5C4.07953 7.49935 3.33333 6.75316 3.33333 5.83268V2.49935C3.33333 2.03911 3.70643 1.66602 4.16667 1.66602Z' fill='%2315181A'/%3E%3Cpath d='M4.16667 18.3327C4.6269 18.3327 5 17.9596 5 17.4993V14.166H15V17.4993C15 17.9596 15.3731 18.3327 15.8333 18.3327C16.2936 18.3327 16.6667 17.9596 16.6667 17.4993V14.166C16.6667 13.2455 15.9205 12.4993 15 12.4993H5C4.07953 12.4993 3.33333 13.2455 3.33333 14.166V17.4993C3.33333 17.9596 3.70643 18.3327 4.16667 18.3327Z' fill='%2315181A'/%3E%3Cpath d='M13.3333 9.16602H11.4583C10.9981 9.16602 10.625 9.53911 10.625 9.99935C10.625 10.4596 10.9981 10.8327 11.4583 10.8327H13.3333C13.7936 10.8327 14.1667 10.4596 14.1667 9.99935C14.1667 9.53911 13.7936 9.16602 13.3333 9.16602Z' fill='%2315181A'/%3E%3Cpath d='M8.54167 9.16602H6.66667C6.20643 9.16602 5.83333 9.53911 5.83333 9.99935C5.83333 10.4596 6.20643 10.8327 6.66667 10.8327H8.54167C9.0019 10.8327 9.375 10.4596 9.375 9.99935C9.375 9.53911 9.0019 9.16602 8.54167 9.16602Z' fill='%2315181A'/%3E%3Cpath d='M3.75 9.16601H2.08333C1.6231 9.16601 1.25 9.53911 1.25 9.99935C1.25 10.4596 1.6231 10.8327 2.08333 10.8327H3.75C4.21024 10.8327 4.58333 10.4596 4.58333 9.99935C4.58333 9.53911 4.21024 9.16601 3.75 9.16601Z' fill='%2315181A'/%3E%3Cpath d='M17.9167 9.16601H16.25C15.7898 9.16601 15.4167 9.53911 15.4167 9.99935C15.4167 10.4596 15.7898 10.8327 16.25 10.8327H17.9167C18.3769 10.8327 18.75 10.4596 18.75 9.99935C18.75 9.53911 18.3769 9.16601 17.9167 9.16601Z' fill='%2315181A'/%3E%3C/svg%3E%0A\");\n}\n\n.control-button:first-child {\n border-top-left-radius: 4px;\n border-top-right-radius: 4px;\n}\n\n/* otherwise if we just .control-button-active, then maplibre will have higher importance */\n.maplibregl-ctrl-group button.control-button-active {\n background-color: #edeaea;\n}\n\n.control-button:disabled {\n opacity: 0.25;\n}\n",".maplibregl-popup-tip,\n.mapboxgl-popup-tip {\n display: none !important;\n}\n\n.maplibregl-popup-content,\n.mapboxgl-popup-content {\n padding: 0 !important;\n}\n"],"mappings":"AAAA,CAAC,WACC,WAAY,MACd,CAEA,CAAC,KACC,iBAAkB,g3BACpB,CAEA,CAAC,OACC,iBAAkB,iiBACpB,CAEA,CAAC,KACC,iBAAkB,qYACpB,CAEA,CAAC,UACC,QAAS,KACT,YAAa,OACb,iBAAkB,KAnBpB,cAoBiB,GACjB,CAEA,CAAC,aACC,iBAAkB,YAClB,OAAQ,EACR,WAAY,WACZ,OAAQ,QACR,QAAS,MACT,OAAQ,KACR,QAAS,KA9BX,QA+BW,EACT,MAAO,IACT,CAEA,CAZC,YAYY,OACX,iBAAkB,SACpB,CAEA,CAAC,KACC,oBAAqB,IACrB,kBAAmB,UACnB,QAAS,MACT,OAAQ,IACV,CAEA,CAvBC,YAuBY,KAAK,aAAa,CAP9B,KAQC,aAAc,IAAI,MAAM,IAC1B,CAEA,CAAC,mBACC,MAAO,KACP,OAAQ,IACV,CAEA,CAAC,oBACC,MAAO,KACP,OAAQ,IACV,CACA,CAAC,mBACC,MAAO,KACP,OAAQ,IACV,CAEA,CAAC,WACC,OAAQ,IACV,CAEA,CAAC,YACC,OAAQ,IACV,CAEA,CAAC,WACC,OAAQ,IACV,CC1EA,CAAC,gBACC,QAAS,MACT,SAAU,SACV,QAAS,KACT,IAAK,EACL,KAAM,CACR,CAEA,CAAC,WACC,QAAS,aATX,QAUW,IAAI,KACb,iBAAkB,QAXpB,cAYiB,KACf,MAAO,KACP,UAAW,IACb,CAEA,CAAC,kBACC,QAAS,EACT,UAAW,WAAW,MACtB,WAAY,IAAI,IAAK,SACrB,iBAAkB,IACpB,CAEA,CAAC,gBACC,QAAS,EACT,UAAW,UAAW,MACtB,WAAY,IAAI,IAAK,QACvB,CAEA,CAAC,kBACC,UAAW,UAAU,GACrB,QAAS,CACX,CCjCA,CAAC,KACC,UAAW,OAAO,OAClB,iBAAkB,m9CACpB,CAEA,CAAC,QACC,iBAAkB,u5DACpB,CAEA,CAAC,MACC,iBAAkB,syDACpB,CAEA,CAAC,cAAc,aACb,uBAAwB,IACxB,wBAAyB,GAC3B,CAGA,CAAC,sBAAsB,MAAM,CAAC,sBAC5B,iBAAkB,OACpB,CAEA,CAVC,cAUc,UACb,QAAS,GACX,CCzBA,CAAC,qBACD,CAAC,mBACC,QAAS,cACX,CAEA,CAAC,yBACD,CAAC,uBAND,QAOW,WACX","names":[]}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import mapboxgl from 'mapbox-gl';
|
|
2
1
|
import { CircleLayerSpecification, LineLayerSpecification, FillLayerSpecification } from 'maplibre-gl';
|
|
2
|
+
import mapboxgl from 'mapbox-gl';
|
|
3
3
|
|
|
4
4
|
type CustomMap = maplibregl.Map & mapboxgl.Map;
|
|
5
5
|
type IControl = maplibregl.IControl & mapboxgl.IControl;
|
|
@@ -22,33 +22,6 @@ declare class Observable<T> {
|
|
|
22
22
|
|
|
23
23
|
type Mode = "line" | "polygon" | null;
|
|
24
24
|
|
|
25
|
-
interface EventData {
|
|
26
|
-
STORE_CHANGED: {
|
|
27
|
-
head: ListNode | null;
|
|
28
|
-
tail: ListNode | null;
|
|
29
|
-
size: number;
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
type StoreChangeEvent = ChangeEvent<EventData>;
|
|
33
|
-
|
|
34
|
-
declare class ListNode {
|
|
35
|
-
val: Step | null;
|
|
36
|
-
next: ListNode | null;
|
|
37
|
-
constructor(val?: Step | null, next?: ListNode | null);
|
|
38
|
-
}
|
|
39
|
-
declare class Store extends Observable<StoreChangeEvent> {
|
|
40
|
-
head: ListNode | null;
|
|
41
|
-
tail: ListNode | null;
|
|
42
|
-
size: number;
|
|
43
|
-
constructor(options?: RequiredDrawOptions);
|
|
44
|
-
push(step: Step): void;
|
|
45
|
-
insert(step: Step, current: ListNode): void;
|
|
46
|
-
findStepById(id: StepId): ListNode["val"] | null;
|
|
47
|
-
removeStepById(id: string): ListNode | null;
|
|
48
|
-
reset(): void;
|
|
49
|
-
pingConsumers: () => void;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
25
|
type AnyFunction = (...args: any[]) => any;
|
|
53
26
|
type DeepRequired<T> = T extends AnyFunction ? T : {
|
|
54
27
|
[K in keyof T]-?: DeepRequired<T[K]>;
|
|
@@ -62,6 +35,7 @@ type Uuid = `${string}-${string}-${string}-${string}-${string}`;
|
|
|
62
35
|
type StepId = Uuid | string;
|
|
63
36
|
type Step = {
|
|
64
37
|
id: StepId;
|
|
38
|
+
isAuxiliary?: boolean;
|
|
65
39
|
} & LatLng;
|
|
66
40
|
interface PanelImpl {
|
|
67
41
|
size?: "small" | "medium" | "large";
|
|
@@ -92,6 +66,7 @@ interface LayersPaint {
|
|
|
92
66
|
onLinePoint?: CircleLayerSpecification["paint"];
|
|
93
67
|
firstPoint?: CircleLayerSpecification["paint"];
|
|
94
68
|
points?: CircleLayerSpecification["paint"];
|
|
69
|
+
auxiliaryPoint?: CircleLayerSpecification["paint"];
|
|
95
70
|
line?: LineLayerSpecification["paint"];
|
|
96
71
|
polygon?: FillLayerSpecification["paint"];
|
|
97
72
|
breakLine?: LineLayerSpecification["paint"];
|
|
@@ -107,6 +82,7 @@ interface Locale {
|
|
|
107
82
|
createPolygon?: string;
|
|
108
83
|
}
|
|
109
84
|
interface DrawOptions {
|
|
85
|
+
pointGeneration?: "manual" | "auto";
|
|
110
86
|
panel?: {
|
|
111
87
|
size?: PanelImpl["size"];
|
|
112
88
|
buttons?: PanelImpl["buttons"];
|
|
@@ -133,6 +109,37 @@ type RequiredDrawOptions = DeepRequired<Omit<DrawOptions, "layersPaint">> & {
|
|
|
133
109
|
layersPaint: LayersPaint;
|
|
134
110
|
};
|
|
135
111
|
|
|
112
|
+
interface EventData {
|
|
113
|
+
STORE_MUTATED: {
|
|
114
|
+
head: ListNode | null;
|
|
115
|
+
tail: ListNode | null;
|
|
116
|
+
size: number;
|
|
117
|
+
};
|
|
118
|
+
STORE_DETACHED: null;
|
|
119
|
+
}
|
|
120
|
+
type StoreChangeEvent = ChangeEvent<EventData>;
|
|
121
|
+
|
|
122
|
+
declare class ListNode {
|
|
123
|
+
val: Step | null;
|
|
124
|
+
prev: ListNode | null;
|
|
125
|
+
next: ListNode | null;
|
|
126
|
+
constructor(val?: Step | null, next?: ListNode | null, prev?: ListNode | null);
|
|
127
|
+
}
|
|
128
|
+
declare class Store extends Observable<StoreChangeEvent> {
|
|
129
|
+
head: ListNode | null;
|
|
130
|
+
tail: ListNode | null;
|
|
131
|
+
size: number;
|
|
132
|
+
map: Map<StepId, ListNode>;
|
|
133
|
+
constructor(options?: RequiredDrawOptions);
|
|
134
|
+
push(step: Step): void;
|
|
135
|
+
insert(step: Step, current: ListNode): void;
|
|
136
|
+
findStepById(id: StepId): ListNode["val"] | null;
|
|
137
|
+
findNodeById(id: StepId): ListNode | null;
|
|
138
|
+
removeNodeById(id: StepId): ListNode | null;
|
|
139
|
+
reset(): void;
|
|
140
|
+
pingConsumers: () => void;
|
|
141
|
+
}
|
|
142
|
+
|
|
136
143
|
interface ModeEvent {
|
|
137
144
|
geometry: Mode;
|
|
138
145
|
closedGeometry: boolean;
|
|
@@ -228,7 +235,7 @@ declare class DrawLibre implements IControl {
|
|
|
228
235
|
* to the DOM: the map will insert the control's element into the DOM
|
|
229
236
|
* as necessary.
|
|
230
237
|
*/
|
|
231
|
-
onAdd(map: CustomMap)
|
|
238
|
+
onAdd: (map: CustomMap) => HTMLElement;
|
|
232
239
|
/**
|
|
233
240
|
* DO NOT USE IMPLICITLY. PASS TO map.removeControl().
|
|
234
241
|
*
|
|
@@ -242,7 +249,7 @@ declare class DrawLibre implements IControl {
|
|
|
242
249
|
*
|
|
243
250
|
* @param map - the Map this control will be removed from
|
|
244
251
|
*/
|
|
245
|
-
onRemove()
|
|
252
|
+
onRemove: () => void;
|
|
246
253
|
/**
|
|
247
254
|
* Adds a series of steps to the store. If a step ID is not provided, it will be automatically generated.
|
|
248
255
|
*
|
|
@@ -250,17 +257,21 @@ declare class DrawLibre implements IControl {
|
|
|
250
257
|
*/
|
|
251
258
|
setSteps: (value: Step[] | LatLng[]) => void;
|
|
252
259
|
/**
|
|
253
|
-
* Retrieves a step from the store by its ID.
|
|
254
|
-
* internally.
|
|
260
|
+
* Retrieves a step from the store by its ID.
|
|
255
261
|
*
|
|
256
262
|
* @param id - The ID of the step to retrieve.
|
|
257
|
-
* @returns The step with the specified ID, or
|
|
263
|
+
* @returns The step with the specified ID, or null if not found.
|
|
258
264
|
*/
|
|
259
265
|
findStepById: (id: StepId) => Step | null | undefined;
|
|
266
|
+
/**
|
|
267
|
+
* Retrieves a node from the store by its ID.
|
|
268
|
+
*
|
|
269
|
+
* @param id - The ID of the node to retrieve.
|
|
270
|
+
* @returns The node with the specified ID, or null if not found.
|
|
271
|
+
*/
|
|
272
|
+
findNodeById: (id: StepId) => ListNode | null | undefined;
|
|
260
273
|
/**
|
|
261
274
|
* Retrieves all steps from the store, either as an array or as a linked list, based on the type specified.
|
|
262
|
-
* This method is called by {@link map.getAllSteps}
|
|
263
|
-
* internally.
|
|
264
275
|
*
|
|
265
276
|
* @param type - The type of collection to return, either "array" or "ll" (linked list).
|
|
266
277
|
* @returns An array of all steps or the linked list of steps.
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var l=class n{static docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style;static transformProp=n.testProp(["transform","WebkitTransform"]);static testProp(e){if(!n.docStyle)return e[0];for(let t=0;t<e.length;t++)if(e[t]in n.docStyle)return e[t];return e[0]}static create(e,t,i){let o=window.document.createElement(e);return t!==void 0&&(o.className=t),i&&i.appendChild(o),o}static remove(e){e.parentNode&&e.parentNode.removeChild(e);}static setTransform(e,t){n.transformProp&&e.style&&(e.style[n.transformProp]=t);}static manageEventListener(e,t,i,o,r={}){if(!t)return;let a=e==="add"?"addEventListener":"removeEventListener";"passive"in r?t[a](i,o,r):t[a](i,o,r.capture);}static mouseButton(e){return e.button}static addClassName(e,t){e.classList.contains(t)||e.classList.add(t);}static removeClassName(e,t){e.classList.contains(t)&&e.classList.remove(t);}};var R=class{#e;#t;#i;_undoButton;_deleteButton;_saveButton;_container;_updatePositionCallback;constructor(e){this.#e=e,this._container=void 0,this.#t=!0,this.#i=void 0,this.#r(),this.#o();}#o(){this.#e.mode?.addObserver(this.#n);}#n=e=>{let{store:t}=this.#e,{type:i,data:o}=e;i==="MODE_CHANGED"&&!o&&this.hidePanel(),i==="MODE_CHANGED"&&o&&t.tail?.val&&this.setPanelLocation({lat:t.tail?.val?.lat,lng:t.tail?.val?.lng});};#s(){this.#i&&(this.#i.className="dashboard-container",this.#i.style.position="absolute",this.#i.style.zIndex="1000000",this.#i.style.pointerEvents="auto",this.#i.style.display=this.#t?"none":"block");}#r=()=>{let{store:e}=this.#e;this.createPanel(),this.#i=document.createElement("div"),this.#s(),this._container&&this.#i.appendChild(this._container),document.body.appendChild(this.#i),e.tail?.val&&this.setPanelLocation({lat:e.tail?.val?.lat,lng:e.tail?.val?.lng});};setPanelLocation=e=>{if(!this.#i)return;this.#t&&this.showPanel();let t=this.#e.map.project(e);this.#a(t),this.#l(e);};#a=e=>{if(this.#t||!this.#i)return;let i=this.#e.map.getContainer().getBoundingClientRect(),o=i.left+e.x,r=i.top+e.y,a=36;this.#i.style.left=`${o-a}px`,this.#i.style.top=`${r-a}px`;};#l(e){this.#c(),this._updatePositionCallback=()=>{this.#t||!this.#i||this.#a(this.#e.map.project(e));},this.#e.map.on("move",this._updatePositionCallback),this.#e.map.on("zoom",this._updatePositionCallback);}#c(){this._updatePositionCallback&&(this.#e.map.off("move",this._updatePositionCallback),this.#e.map.off("zoom",this._updatePositionCallback),this._updatePositionCallback=void 0);}showPanel=()=>{this.#t&&this.#i&&(this.#t=!1,this.#i.style.display="block",this.#i.style.transition="opacity 0.2s",this.#i.style.opacity="1");};hidePanel=()=>{!this.#t&&this.#i&&(this.#t=!0,this.#i.style.display="none");};onPointRemove=e=>{e?this.setPanelLocation(e):this.hidePanel();};removePanel=()=>{this._updatePositionCallback&&(this.#e.map.off("move",this._updatePositionCallback),this.#e.map.off("zoom",this._updatePositionCallback),this._updatePositionCallback=void 0),this.#i&&(document.body.removeChild(this.#i),this.#i=void 0),this._container&&(l.remove(this._container),this._container=void 0);};createButton=(e,t,i,o)=>{let r=l.create("button",`panel-button panel-button-${i}`,o);return r.setAttribute("data-type",e),r.setAttribute("aria-label",t),l.create("span",`icon ${e} icon-${i}`,r),r};createPanel=()=>{let{options:e}=this.#e,{locale:t}=e,{undo:i,delete:o,save:r}=e.panel.buttons,a=e.panel.size,m=l.create("div","dashboard");i.visible&&(this._undoButton=this.createButton("undo",t.undo,a,m)),o.visible&&(this._deleteButton=this.createButton("delete",t.delete,a,m)),r.visible&&(this._saveButton=this.createButton("save",t.save,a,m)),this._container=m;}};var re={type:"FeatureCollection",features:[{type:"Feature",properties:{},geometry:{type:"LineString",coordinates:[]}}]};var s={LineDynamicLayer:"mdl-line-dynamic-layer",LineLayer:"mdl-line-layer",LineLayerTransparent:"mdl-line-layer-transparent",LineLayerBreak:"mdl-line-break-layer",PolygonLayer:"mdl-polygon-layer",PointsLayer:"mdl-points-layer",SinglePointLayer:"mdl-single-point-layer",FirstPointLayer:"mdl-first-point-layer"},d={UnifiedSource:"mdl-unified-source",LineDynamicSource:"mdl-line-dynamic-source",LineSourceBreak:"mdl-line-source-break",SinglePointSource:"mdl-single-point-source"},w={large:6.5,default:5.5},F={large:"#FF6464",default:"#666666"},O={"circle-radius":w.default,"circle-color":"#FEFFFE","circle-stroke-color":F.default,"circle-stroke-width":3},k={"circle-radius":w.large,"circle-color":"#FEFFFE","circle-stroke-color":"#666666","circle-stroke-width":3},A={"fill-color":"grey","fill-opacity":.4},_={"line-width":3,"line-color":"grey","line-opacity":.7},T={"circle-radius":w.default,"circle-color":"#FEFFFE","circle-stroke-color":"#666666","circle-stroke-width":3},x={"line-width":3,"line-color":"#FF6464","line-dasharray":[3,3]},G=n=>[{id:s.SinglePointLayer,source:d.SinglePointSource,type:"circle",paint:n.layersPaint.onLinePoint,layout:{visibility:"none"}},{id:s.PolygonLayer,source:d.UnifiedSource,type:"fill",paint:n.layersPaint.polygon,layout:{visibility:"none"},filter:["==","$type","Polygon"]},{id:s.LineDynamicLayer,source:d.LineDynamicSource,type:"line",paint:n.layersPaint.line,layout:{visibility:"none"}},{id:s.LineLayer,source:d.UnifiedSource,type:"line",paint:n.layersPaint.line,layout:{visibility:"visible"},filter:["==","$type","LineString"]},{id:s.LineLayerTransparent,source:d.UnifiedSource,type:"line",paint:{"line-width":4,"line-color":"transparent"},filter:["==","$type","LineString"]},{id:s.LineLayerBreak,source:d.LineSourceBreak,type:"line",paint:n.layersPaint.breakLine,layout:{visibility:"none"}},{id:s.PointsLayer,source:d.UnifiedSource,type:"circle",paint:n.layersPaint.points,filter:["all",["==","$type","Point"],["==","isFirst",!1]]},{id:s.FirstPointLayer,source:d.UnifiedSource,type:"circle",paint:n.layersPaint.firstPoint,filter:["==",["get","isFirst"],!0]}];var oe=0,ye=n=>{n.setPaintProperty(s.FirstPointLayer,"circle-radius",w.large),n.setPaintProperty(s.FirstPointLayer,"circle-stroke-color",F.large);},fe=n=>{n.setPaintProperty(s.FirstPointLayer,"circle-radius",w.default),n.setPaintProperty(s.FirstPointLayer,"circle-stroke-color",F.default);},E=(n,e)=>{e==="large"?ye(n):fe(n);},ae=n=>{n.getLayer(s.LineLayerTransparent)&&n.removeLayer(s.LineLayerTransparent);},le=(n,e)=>{if(n.getLayer(s.LineLayerTransparent))return;let i=G(e).find(o=>o.id===s.LineLayerTransparent);i&&n.addLayer(i);},ce=()=>{let e=Date.now();return e-oe<=400?(oe=e,!0):(oe=e,!1)};var h=class{static isFeatureTriggered(e,t){return e.target.queryRenderedFeatures(e.point,{layers:t}).some(o=>t.includes(o.layer.id))}static getPixelCoordinates=(e,t)=>{let{lat:i,lng:o}=t;return e.project([o,i])};static queryPointId=(e,t)=>e.queryRenderedFeatures(t,{layers:[s.PointsLayer,s.FirstPointLayer]})?.[0]?.properties.id},P=class{static#e(e){let t=[],i=e.head,o=new Set;for(;i!==null;){if(o.has(i.val?.id)){e.head&&e.head.val&&t.push([e.head.val.lng,e.head.val.lat]);break}o.add(i.val?.id),i.val&&t.push([i.val.lng,i.val.lat]),i=i.next;}return t}static getLine(e,t){return {type:"FeatureCollection",features:[{type:"Feature",properties:{},geometry:{type:"LineString",coordinates:[e,t]}}]}}static getAllLines(e){return {type:"FeatureCollection",features:[{type:"Feature",properties:{},geometry:{type:"LineString",coordinates:e}}]}}static getPolygon(e){return {type:"FeatureCollection",features:[{type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[e]}}]}}static getPoints(e){let t=e.head,i=[],o=new Set;for(;t!==null&&!o.has(t.val?.id);){if(t.val){let r=t.val,a=t.val.id===e.head?.val?.id;i.push({type:"Feature",properties:{id:r.id,lat:r.lat,lng:r.lng,isFirst:a},geometry:{type:"Point",coordinates:[r.lng,r.lat]}});}o.add(t.val?.id),t=t.next;}return {type:"FeatureCollection",features:i}}static getUnifiedFeatures(e){let t=this.getPoints(e).features,i=this.#e(e),o=this.getAllLines(i).features,r=this.getPolygon(i).features;return {type:"FeatureCollection",features:[...t,...o,...r]}}},c=class n{static getGeometryIndex=(e,t)=>{let i=e.head,o=0;for(;i!==null;){if(i.val?.id===t)return o;o++,i=i.next;}return -1};static isFirstPoint(e){let t=e.target,i=e.point;return !!t.queryRenderedFeatures(i,{layers:[s.FirstPointLayer]}).length}static distance=(e,t)=>Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2);static checkIfPointIsOnLine=(e,t,i)=>{let r=this.distance(e,t),a=this.distance(e,i),m=this.distance(i,t);return Math.abs(a+m-r)<.1};static isClosedGeometry=e=>e.tail?.next===e.head;static breakGeometry=(e,t)=>{if(!e.head)return;let i=e.head,o=e.tail;do{if(i?.val?.id===t){i!==e.head&&(o.next=i.next,e.head=i,e.tail=o),e.tail.next=null;return}o=i,i=i.next;}while(i!==e.head)};static closeGeometry=(e,t)=>{e.tail&&(e.tail.next=e.head),t.setClosedGeometry(!0);};static canCloseGeometry=e=>e.size>2&&!this.isClosedGeometry(e);static canBreakClosedGeometry=e=>e.size<=2;static switchToLineModeIfCan=e=>{let{mode:t,store:i,tiles:o,map:r}=e;n.canBreakClosedGeometry(i)&&(i.tail&&i.tail.val&&(i.tail.next=null),r.setLayoutProperty(s.PolygonLayer,"visibility","none"),t.reset(),E(r,"default"),o.render());}},g=()=>{if("crypto"in window&&"randomUUID"in window.crypto)return window.crypto.randomUUID();function n(){return "0123456789abcdef"[Math.floor(Math.random()*16)]}function e(o){let r="";for(let a=0;a<o;a++)r+=n();return r}function t(o){let r=o===0,a=o===4;return r?8:a?12:4}let i=[];for(let o=0;o<5;o++)i.push(e(t(o)));return i.join("-")},b=(n,e)=>{let t,i=!0;function o(){i&&t&&(n(...t),t=null,i=!1,setTimeout(()=>{i=!0,o();},e));}return function(...r){t=r,o();}};var D=class{#e;#t;constructor(e){this.#e=e,this.#t=P.getUnifiedFeatures(this.#e.store),this.#i(),this.render();}#i(){this.#o(),this.#n(),this.#s(s.LineLayer,s.SinglePointLayer),this.#s(s.LineLayerTransparent,s.SinglePointLayer),this.#s(s.LineLayerTransparent,s.FirstPointLayer),this.#s(s.LineLayerTransparent,s.PointsLayer),this.#s(s.PolygonLayer,s.LineLayer);}#o=()=>{let{map:e}=this.#e;for(let t of Object.values(d))e.getSource(t)||e.addSource(t,{type:"geojson",data:{type:"FeatureCollection",features:[]},promoteId:"id"});};#n=()=>{let{map:e,mode:t,options:i}=this.#e,o=G(i);for(let a of o)e.getLayer(a.id)||e.addLayer(a);let r=e.getLayoutProperty(s.PolygonLayer,"visibility")==="none";t.getMode()==="polygon"&&r&&e.setLayoutProperty(s.PolygonLayer,"visibility","visible");};#s=(e,t)=>{let{map:i}=this.#e,o=i.getLayer(e),r=i.getLayer(t);o&&r&&i.moveLayer(e,t);};#r=()=>{let{map:e}=this.#e;for(let t of Object.values(d))e.getSource(t)&&e.removeSource(t);};#a=()=>{let{map:e}=this.#e;for(let t of Object.values(s))e.getLayer(t)&&e.removeLayer(t);};updateLine(e,t){let{mode:i}=this.#e,o=this.#t.features.at(-2)?.geometry.coordinates;o&&(o[e]=[t.lng,t.lat],i.getClosedGeometry()&&e===0&&(o[o.length-1]=[t.lng,t.lat]));}updatePolygon(e,t){let{mode:i}=this.#e,o=this.#t.features.at(-1)?.geometry.coordinates;o&&(o[e]=[t.lng,t.lat],i.getClosedGeometry()&&e===0&&(o[o.length-1]=[t.lng,t.lat]));}removeTiles=()=>{this.#a(),this.#r();};render(){this.#t=P.getUnifiedFeatures(this.#e.store);let e=this.#e.map.getSource(d.UnifiedSource);e&&e.setData(this.#t);}renderOnMouseMove=(e,t)=>{let{mode:i,options:o}=this.#e,r=this.#t?.features?.[e];r?.geometry?.coordinates&&(r.geometry.coordinates=[t.lng,t.lat]),this.updateLine(e,t),o.modes.polygon.visible&&i.isPolygon()&&this.updatePolygon(e,t),this.render();};resetGeometries=()=>{let e=this.#e.map.getSource(d.UnifiedSource);e&&e.setData({type:"FeatureCollection",features:[]});}};var ve=8,Le=8,M=class{_container;_label;constructor(){this._container=void 0;}create=e=>{let t=l.create("div","popup-container",document.body),i=l.create("span",`popup-text popup-text-${e.placement}`,t);return i.textContent=e.label,this._container=t,this._label=i,this};#e=()=>{!this._label?.classList.value.includes("popup-text-active")&&this._label?.classList.add("popup-text-active");};#t=()=>this._label?{width:this._label.clientWidth,height:this._label.clientHeight}:{width:0,height:0};#i=e=>{let{bottom:t,left:i}=e.target.getBoundingClientRect(),{width:o,height:r}=this.#t();return {x:i-Le-o,y:t-r-2}};#o=e=>{let{bottom:t,left:i,right:o}=e.target.getBoundingClientRect(),{width:r}=this.#t();return {x:(o-i)/2+i-r/2,y:t+ve}};getPosition=(e,t)=>t==="left"?this.#i(e):this.#o(e);setPosition=e=>{let{x:t,y:i}=e;this._container&&(this._container.style.left=`${t}px`,this._container.style.top=`${i}px`),this.#e();};remove=()=>{this._container&&l.remove(this._container);}};var f={AUTO:"auto",DEFAULT:"default",POINTER:"pointer",CROSSHAIR:"crosshair",MOVE:"move",HELP:"help",GRAB:"grab",GRABBING:"grabbing"};var H=(n,e)=>{for(let[t,i]of Object.entries(e))l.manageEventListener("add",n,t,i);},U=(n,e)=>{for(let[t,i]of Object.entries(e))l.manageEventListener("remove",n,t,i);},pe=(n,e)=>{let t=e.locale.line,i=e.locale.polygon,o=e.locale.break;return {line:t,polygon:i,break:o}[n]};var y={DOUBLECLICK:"mdl:doubleclick",POINTENTER:"mdl:pointenter",POINTLEAVE:"mdl:pointleave",MOVEEND:"mdl:moveend",ADD:"mdl:add",UNDO:"mdl:undo",REMOVEALL:"mdl:removeall",SAVE:"mdl:save",BREAK:"mdl:break",MODECHANGED:"mdl:modechanged"};var p={panel:{size:"medium",buttons:{undo:{visible:!0},delete:{visible:!0},save:{visible:!0,clearOnSave:!0}}},modes:{initial:null,line:{visible:!0,closeGeometry:!0},polygon:{visible:!0},breakGeometry:{visible:!0}},layersPaint:{onLinePoint:k,firstPoint:O,points:T,line:_,polygon:A,breakLine:x},initial:null,dynamicLine:!0,locale:{save:"Save",delete:"Delete all",undo:"Undo",line:"Line",polygon:"Polygon",break:"Split",closeLine:"Close line",createPolygon:"Create polygon"}};var u=class{static addPoint(e,t,i){t.fire(y.ADD,{id:e.id,coordinates:{lat:e.lat,lng:e.lng},total:e.total,timestamp:Date.now(),mode:{geometry:i.getMode(),closedGeometry:i.getClosedGeometry()}});}static movePoint(e,t){t.fire(y.MOVEEND,{id:e.id,start_coordinates:{lat:e.start.lat,lng:e.start.lng},end_coordinates:{lat:e.end.lat,lng:e.end.lng},total:e.total,timestamp:Date.now()});}static pointDoubleClick(e,t){t.fire(y.DOUBLECLICK,{id:e.id,coordinates:{lat:e.lat,lng:e.lng},total:e.total,timestamp:Date.now()});}static enterPoint(e,t){t.fire(y.POINTENTER,{id:e.id,coordinates:{lat:e.lat,lng:e.lng},total:e.total,timestamp:Date.now()});}static leavePoint(e,t){t.fire(y.POINTLEAVE,{id:e.id,coordinates:{lat:e.lat,lng:e.lng},total:e.total,timestamp:Date.now()});}static undoPoint(e,t,i){t.fire(y.UNDO,{originalEvent:i,id:e.id,coordinates:{lat:e.lat,lng:e.lng},total:e.total,timestamp:Date.now()});}static modeChanged(e,t){e.fire(y.MODECHANGED,{mode:t});}static removeAllPoints(e,t){e.fire(y.REMOVEALL,{originalEvent:t});}static onSaveClick(e,t,i){let{map:o,mode:r}=e;o.fire(y.SAVE,{originalEvent:i,timestamp:Date.now(),steps:t,mode:{geometry:r.getMode(),closedGeometry:r.getClosedGeometry()}});}static onLineBreak(e){e.fire(y.BREAK);}};var q=class{#e;constructor(e){this.#e=e,this.#t();}#t=()=>{this.#e.mode.addObserver(this.#l);};removeConsumers=()=>{this.#e.mode.removeObserver(this.#l);};#i=()=>{let{_line:e,_polygon:t,_break:i}=this.#e.control;e?.classList.remove("control-button-active"),t?.classList.remove("control-button-active"),i?.classList.remove("control-button-active");};#o=e=>{this.#i(),e.classList.add("control-button-active");};#n=e=>{let{data:t}=e,{_line:i,_polygon:o,_break:r}=this.#e.control,{mode:a}=this.#e;if(u.modeChanged(this.#e.map,t),!(!i||!o||!r)){switch(t){case"line":this.#o(i);break;case"polygon":this.#o(o);break;}t?a.getClosedGeometry()&&this.#r(r):this.#s(r);}};#s=e=>{e.setAttribute("disabled","true"),e.setAttribute("aria-disabled","true");};#r=e=>{e.removeAttribute("disabled"),e.removeAttribute("aria-disabled");};#a=e=>{let{data:t}=e,{_break:i,_line:o,_polygon:r}=this.#e.control,{mode:a}=this.#e;t?(i&&this.#r(i),a.getMode()==="polygon"&&o&&this.#s(o),a.getMode()==="line"&&r&&this.#s(r)):(i&&this.#s(i),a.getMode()==="polygon"&&o&&this.#r(o),a.getMode()==="line"&&r&&this.#r(r));};#l=e=>{let{type:t,data:i}=e;if(t==="MODE_CHANGED"&&this.#n(e),t==="CLOSED_GEOMETRY_CHANGED"&&this.#a(e),t==="BREAK_CHANGED"&&i){let{_break:o}=this.#e.control;this.#o(o),u.modeChanged(this.#e.map,"break");}}};var z=class{#e;#t;#i;constructor(e){this.#e=e,this.#i=new q(e),this.#t=new M,this.#o();}#o(){let{control:e}=this.#e;if(e){let t={mouseenter:this.onButtonEnter,mouseleave:this.onButtonLeave};e._line&&H(e._line,{...t,click:this.onLineClick}),e._polygon&&H(e._polygon,{...t,click:this.onPolygonClick}),e._break&&H(e._break,{...t,click:this.onBreakClick});}}#n(){let{control:e}=this.#e;if(e){let t={mouseenter:this.onButtonEnter,mouseleave:this.onButtonLeave};e._line&&U(e._line,{...t,click:this.onLineClick}),e._polygon&&U(e._polygon,{...t,click:this.onPolygonClick}),e._break&&U(e._break,{...t,click:this.onBreakClick});}}remove(){this.#i.removeConsumers(),this.#n(),this.#t.remove();}onButtonEnter=e=>{let{options:t}=this.#e,i=e.target.getAttribute("data-type");if(i){let o=pe(i,t),r="left";this.#t.create({label:o,placement:r}).setPosition(this.#t.getPosition(e,r));}};onButtonLeave=()=>{this.#t.remove();};#s=()=>{let{control:e}=this.#e;e._line?.classList.remove("control-button-active"),e._polygon?.classList.remove("control-button-active"),e._break?.classList.remove("control-button-active");};#r=()=>{let{map:e,mode:t}=this.#e;t.getMode()||e.fire("mode:initialize");};onLineClick=()=>{let{map:e,mode:t,tiles:i,control:o}=this.#e;this.#r(),this.#s(),t.getMode()==="line"&&!t.getBreak()?(t.setMode(null),e.fire("mode:remove"),i.resetGeometries()):(o._line?.classList.add("control-button-active"),t.setMode("line"),i.render());};onPolygonClick=()=>{let{map:e,mode:t,tiles:i,control:o}=this.#e;this.#r(),this.#s(),t.getMode()==="polygon"&&!t.getBreak()?(t.setMode(null),e.fire("mode:remove"),e.setLayoutProperty(s.PolygonLayer,"visibility","visible"),i.resetGeometries()):(o._polygon?.classList.add("control-button-active"),t.setMode("polygon"),i.render());};onBreakClick=()=>{let{map:e,mode:t,control:i}=this.#e;t.getBreak()&&(t.setMode(null),e.fire("mode:remove")),this.#s(),i._break?.classList.add("control-button-active"),t.setBreak(!0),e.getCanvasContainer().style.cursor=f.POINTER;}};var C=class{observers;constructor(){this.observers=new Set;}addObserver(e){this.observers.add(e);}removeObserver(e){this.observers.delete(e);}unsubscribe(){this.observers.clear();}notify(e){this.observers.forEach(t=>t(e));}};var I={EMPTY_INITIAL_STATE:"You passed an empty initial array in the options. Please either remove the 'initial' property or include at least one element in the array.",MISSING_IDS:"You set 'generateId' to false but did not provide IDs for all steps. Please ensure all steps have IDs or set 'generateId' to true.",NOT_ENOUGH_POINTS_TO_CLOSE:"At least three points are required to close a polygon or a line. Please add more points or set 'closeGeometry' to false.",FIRST_LAST_POINT_NOT_EQUAL:"The first and last points of a polygon or a closed linestring must be the same. Please ensure the first and last points are equal or set 'closeGeometry' to false."};var Y=class{val;next;constructor(e=null,t=null){this.val=e,this.next=t;}},B=class extends C{head;tail;size;constructor(e){super();let t=v.initStore(e);this.head=t?t.head:null,this.tail=t?t.tail:null,this.size=t?t.size:0;}push(e){let t=new Y(e);this.head?this.tail&&(this.tail.next=t,this.tail=t):this.head=this.tail=t,this.size++,this.pingConsumers();}insert(e,t){let i=new Y(e,t.next);this.tail===t&&this.head===t.next&&(this.tail=i),t.next=i,this.size++;}findStepById(e){let t=this.head,i=new Set;for(;t!==null&&!i.has(t);){if(t.val&&t.val.id===e)return t.val;i.add(t),t=t.next;}return null}removeStepById(e){if(!this.head)return null;let t=this.head,i=null;for(;t!==null;){if(t?.val?.id===e)return t===this.head?(this.head=t.next,this.tail&&(this.tail.next=t.next)):i.next=t.next,t===this.tail&&(this.tail=i),this.size--,this.pingConsumers(),t;i=t,t.next&&(t=t.next);}return null}reset(){this.head=null,this.tail=null,this.size=0,this.pingConsumers();}pingConsumers=()=>{this.notify({type:"STORE_CHANGED",data:{head:this.head,tail:this.tail,size:this.size}});}},v=class n{static isLastPoint=(e,t)=>e.tail?.val?.id===t;static initStore(e){if(!e?.initial)return null;if(e&&e.initial&&!e.initial.steps.length)throw new Error(I.EMPTY_INITIAL_STATE);if(e&&e.initial.steps){let{steps:o,closeGeometry:r,generateId:a}=e.initial;return n.fromArray(o,r,a)}return null}static#e=e=>e.map(t=>({...t,id:g()}));static buildStepSequence(e){let t=new B;return e.forEach(i=>{t.push(i);}),t}static fromArray(e,t,i){let o=i?this.#e(e):e,r=this.buildStepSequence(o);return t&&r.tail&&(r.tail.next=r.head),r}static toArray(e){if(!e)return [];let t=new Set,i=[],o=e;for(;o!==null&&!t.has(o);)t.add(o),i.push(o.val),o=o.next;return i}};var V=class{#e;#t;constructor(e){this.#e=e,this.#t=new M;}initEvents(){let{panel:e}=this.#e;e&&(l.manageEventListener("add",e?._undoButton,"click",this.#n),l.manageEventListener("add",e?._undoButton,"mouseenter",this.onMouseEnter),l.manageEventListener("add",e?._undoButton,"mouseleave",this.onMouseLeave)),e&&(l.manageEventListener("add",e?._deleteButton,"click",this.#o),l.manageEventListener("add",e?._deleteButton,"mouseenter",this.onMouseEnter),l.manageEventListener("add",e?._deleteButton,"mouseleave",this.onMouseLeave)),e&&(l.manageEventListener("add",e?._saveButton,"click",this.onSaveClick),l.manageEventListener("add",e?._saveButton,"mouseenter",this.onMouseEnter),l.manageEventListener("add",e?._saveButton,"mouseleave",this.onMouseLeave));}removeEvents(){let{panel:e}=this.#e;e?._undoButton&&(l.manageEventListener("remove",e._undoButton,"click",this.#n),l.manageEventListener("remove",e._undoButton,"mouseenter",this.onMouseEnter),l.manageEventListener("remove",e._undoButton,"mouseleave",this.onMouseLeave)),e?._deleteButton&&(l.manageEventListener("remove",e._deleteButton,"click",this.#o),l.manageEventListener("remove",e._deleteButton,"mouseenter",this.onMouseEnter),l.manageEventListener("remove",e._deleteButton,"mouseleave",this.onMouseLeave)),e?._saveButton&&(l.manageEventListener("remove",e._saveButton,"click",this.onSaveClick),l.manageEventListener("remove",e._saveButton,"mouseenter",this.onMouseEnter),l.manageEventListener("remove",e._saveButton,"mouseleave",this.onMouseLeave));}#i=e=>{let{options:t}=this.#e;return {undo:t.locale.undo,delete:t.locale.delete,save:t.locale.save}[e]};onMouseEnter=e=>{let t=e.target.getAttribute("data-type");if(t){let i=this.#i(t);this.#t.create({label:i,placement:"bottom"}).setPosition(this.#t.getPosition(e,"bottom"));}};onMouseLeave=()=>{this.#t.remove();};#o=e=>{let{tiles:t,mode:i,panel:o,store:r,map:a}=this.#e;r.reset(),o.hidePanel(),i.reset(),E(a,"default"),a.setLayoutProperty(s.PolygonLayer,"visibility","none"),this.#t.remove(),t.resetGeometries(),u.removeAllPoints(a,e);};#n=e=>{let{store:t,panel:i,map:o,tiles:r}=this.#e,a=t.tail?.val;t.removeStepById(a.id);let m={...a,total:t.size};u.undoPoint(m,o,e),c.switchToLineModeIfCan(this.#e),i?.onPointRemove(t.tail?.val),this.#t.remove(),r.render();};onSaveClick=e=>{let{store:t,options:i}=this.#e;u.onSaveClick(this.#e,v.toArray(t.head),e),this.#t.remove(),i.panel.buttons.save.clearOnSave&&this.#o(e);}};var L={setSinglePointVisible(n){n.target.setLayoutProperty(s.SinglePointLayer,"visibility","visible");},setSinglePointHidden(n){let e=n.target;setTimeout(()=>{e.setLayoutProperty(s.SinglePointLayer,"visibility","none");},33);},triggerPostPointAddition(n,e){let{panel:t,store:i,map:o}=e;c.canCloseGeometry(i)&&E(o,"large"),t?.setPanelLocation(n.lngLat);},addPointToMap(n,e){let{store:t,tiles:i,map:o,mode:r}=e,a={...n.lngLat,id:g()};t.push(a),u.addPoint({...a,total:t.size},o,r),L.triggerPostPointAddition(n,e),i.render();}};var ne=(n,e)=>{let t=e.head,i=new Set;for(;t!==null&&!i.has(t);){if(t?.next?.val&&t?.val){let o=n.target,r=h.getPixelCoordinates(o,t.val),a=h.getPixelCoordinates(o,t.next.val),m=h.getPixelCoordinates(o,n.lngLat);if(c.checkIfPointIsOnLine(r,a,m))return t}i.add(t),t=t.next;}return null},ue=(n,e)=>{let t=ne(n,e);if(t){let i={...n.lngLat,id:g()};return e.insert(i,t),i}return null},de=(n,e)=>{let{store:t,tiles:i,panel:o}=e;t.tail?.val&&(o?.setPanelLocation(t.tail.val),L.setSinglePointHidden(n),i.render());},me=n=>h.isFeatureTriggered(n,[s.PointsLayer,s.FirstPointLayer]);var he=15,j=class{props;#e;#t;constructor(e){this.props=e,this.#e=null,this.#t=b(this.#o,he);}initBreakEvents=()=>{let{map:e}=this.props;e.on("click",s.LineLayerTransparent,this.#i),e.on("mouseenter",s.LineLayerTransparent,this.#t),e.on("mousemove",s.LineLayerTransparent,this.#t),e.on("mouseleave",s.LineLayerTransparent,this.#n);};removeBreakEvents=()=>{let{map:e}=this.props;e.off("click",s.LineLayerTransparent,this.#i),e.off("mouseenter",s.LineLayerTransparent,this.#t),e.off("mousemove",s.LineLayerTransparent,this.#t),e.off("mouseleave",s.LineLayerTransparent,this.#n);};hideBreakLine=()=>{let{map:e}=this.props;e.getLayoutProperty(s.LineLayerBreak,"visibility")!=="none"&&e.setLayoutProperty(s.LineLayerBreak,"visibility","none");};showBreakLine=()=>{let{map:e}=this.props;e.getLayoutProperty(s.LineLayerBreak,"visibility")!=="visible"&&e.setLayoutProperty(s.LineLayerBreak,"visibility","visible");};#i=()=>{let{store:e,mode:t,panel:i,map:o,tiles:r}=this.props,a=this.#e?.next?.val?.id;c.breakGeometry(e,a),e.tail?.val&&i.setPanelLocation({lat:e.tail?.val?.lat,lng:e.tail?.val?.lng}),this.#n(),o.setLayoutProperty(s.PolygonLayer,"visibility","none"),t.reset(),r.render(),u.onLineBreak(o);};#o=e=>{let{map:t,store:i}=this.props,o=ne(e,i);o?.val?.id!==this.#e?.val?.id&&(this.#e=o);let r=t.getSource(d.LineSourceBreak),a=[o?.val?.lng,o?.val?.lat],m=[o?.next?.val?.lng,o?.next?.val?.lat],S=P.getLine(a,m);S&&(r.setData(S),this.showBreakLine());};#n=()=>{setTimeout(()=>{this.hideBreakLine();},he+10);}};var ge=10,J=class{#e;#t;#i;#o;#n;#s;constructor(e){this.#e=e,this.#t=e.options.dynamicLine,this.#i=null,this.#o=null,this.#r(),this.#s=b(this.#u,ge);}#r(){this.#e.store.addObserver(this.#l),this.#e.mode.addObserver(this.#c),this.#e.mouseEvents.addObserver(this.#a);}removeLine=()=>{this.hideDynamicLine();};removeConsumers=()=>{this.#e.store.removeObserver(this.#l),this.#e.mode.removeObserver(this.#c),this.#e.mouseEvents.removeObserver(this.#a);};#a=e=>{let{mode:t}=this.#e;if(!t.getClosedGeometry()&&(e.type==="lastPointMouseClick"&&e.data?(this.hideDynamicLine(),this.#t=!1):e.type==="lastPointMouseClick"&&!e.data&&(this.#t=!0),!!this.#t&&((e.type==="pointMouseEnter"||e.type==="lineMouseEnter")&&e.data&&this.hideDynamicLine(),(e.type==="pointMouseLeave"||e.type==="lineMouseLeave")&&e.data))){let{store:i}=this.#e;this.#i=i.tail?.val,this.#o=i.tail?.val,this.showDynamicLine();}};#l=e=>{let{store:t}=this.#e;switch(e.type){case"STORE_CHANGED":e.data.tail?.val&&!c.isClosedGeometry(t)&&(this.#i=e.data.tail?.val,this.showDynamicLine());break;}};#c=e=>{let{store:t}=this.#e;e.type==="CLOSED_GEOMETRY_CHANGED"&&(e.data&&this.hideDynamicLine(),!e.data&&t?.tail?.val&&(this.#i=t?.tail?.val,this.showDynamicLine()));};initDynamicEvents=()=>{let{map:e}=this.#e;e.on("click",this.#f),e.on("mousemove",this.#s),e.on(y.REMOVEALL,this.hideDynamicLine),e.on(y.UNDO,this.#h),e.on(y.DOUBLECLICK,this.#v);};removeEvents=()=>{let{map:e}=this.#e;e.off("click",this.#f),e.off("mousemove",this.#s),e.off(y.REMOVEALL,this.hideDynamicLine),e.off(y.UNDO,this.#h),e.off(y.DOUBLECLICK,this.#v);};hideDynamicLine=()=>{let{map:e}=this.#e;this.#i=null,this.#o=null,this.#n=null,e.off("mousemove",this.#s);let t=e.getSource(d.LineDynamicSource);t&&t.setData(re),e.setLayoutProperty(s.LineDynamicLayer,"visibility","none");};showDynamicLine=()=>{let{map:e}=this.#e,t=[this.#i?.lng,this.#i?.lat],i=[this.#o?.lng,this.#o?.lat];this.#n=P.getLine(t,i),e.setLayoutProperty(s.LineDynamicLayer,"visibility","visible"),this.#o&&this.#p({lng:this.#o?.lng,lat:this.#o?.lat}),e.on("mousemove",this.#s);};#p=e=>{if(!this.#n)return;let{map:t}=this.#e;this.#n.features[0].geometry.coordinates[1]=[e.lng,e.lat];let i=t.getSource(d.LineDynamicSource);i&&i.setData(this.#n);};#u=e=>{this.#p(e.lngLat);};#f=e=>{let{mode:t}=this.#e,i=h.isFeatureTriggered(e,[s.LineLayerTransparent,s.LineLayer]);i&&t.getBreak()&&(this.#o={lng:e.lngLat.lng,lat:e.lngLat.lat}),!i&&this.hideDynamicLine();};#h=e=>{let{store:t,mode:i}=this.#e;if(!i.getClosedGeometry()){let o=e.target.unproject({x:e.originalEvent.x,y:e.originalEvent.y});this.#o={lng:o.lng,lat:o.lat},this.#i=t.tail?.val,this.showDynamicLine();}t.size===0&&this.hideDynamicLine();};#v=e=>{let{store:t,mode:i}=this.#e;i.getClosedGeometry()||(this.#o={lng:e.coordinates.lng,lat:e.coordinates.lat},this.#i=t.tail?.val,this.showDynamicLine()),t.size===0&&this.hideDynamicLine();}};var Ee=22,K=class{props;#e;#t;constructor(e){this.props=e,this.#e=!1,this.#t=null;}initEvents(){let{map:e}=this.props;e.on("click",s.LineLayerTransparent,this.#i),e.on("mousemove",s.LineLayerTransparent,this.#n),e.on("mouseenter",s.LineLayerTransparent,this.#s),e.on("mouseleave",s.LineLayerTransparent,this.#r);}removeEvents(){let{map:e}=this.props;e.off("click",s.LineLayerTransparent,this.#i),e.off("mousemove",s.LineLayerTransparent,this.#n),e.off("mouseenter",s.LineLayerTransparent,this.#s),e.off("mouseleave",s.LineLayerTransparent,this.#r);}#i=e=>{let{store:t,map:i,mode:o}=this.props;if(me(e))return;let r=ue(e,t);r&&(u.addPoint({...r,total:t.size},i,o),de(e,this.props));};#o=e=>{if(L.setSinglePointVisible(e),e.target.getLayer(s.SinglePointLayer)){let i=e.target.getSource(d.SinglePointSource);i&&i.setData({type:"Feature",geometry:{type:"Point",coordinates:[e.lngLat.lng,e.lngLat.lat]},properties:{}});}};#n=b(e=>{if(h.isFeatureTriggered(e,[s.PointsLayer,s.FirstPointLayer]))return;let{mouseEvents:t}=this.props;t.pointMouseDown||t.pointMouseEnter||(this.#t=e,!this.#e&&(this.#e=!0,requestAnimationFrame(()=>{this.#t&&(this.#o(this.#t),this.#e=!1);})));},Ee);#s=e=>{let{mouseEvents:t}=this.props;t.pointMouseDown||t.pointMouseEnter||h.isFeatureTriggered(e,[s.PointsLayer,s.FirstPointLayer])||(t.lineMouseEnter=!0,L.setSinglePointVisible(e));};#r=e=>{let{mouseEvents:t}=this.props;t.pointMouseDown||t.pointMouseEnter||(t.lineMouseLeave=!0,L.setSinglePointHidden(e));}};var $=class{props;#e;#t;#i;#o;constructor(e){this.props=e,this.#e=new j(e),this.#t=new K(e),this.#i=null,this.#o="default";}init(){this.#n(),this.#s(),this.#r();}#n=()=>{window.innerWidth<=768||this.props.options.dynamicLine&&(this.#i=new J(this.props));};#s(){!this.props.mode.getBreak()&&(this.#t.initEvents(),this.props.options.dynamicLine&&this.#i?.initDynamicEvents());}#r(){this.props.mode.addObserver(this.#p),this.props.mouseEvents.addObserver(this.#c);}remove(){this.#a(),this.#l();}#a(){this.props.mode.removeObserver(this.#p),this.props.mouseEvents.removeObserver(this.#c),this.props.options.dynamicLine&&this.#i?.removeConsumers();}#l(){this.#e.removeBreakEvents(),this.#t.removeEvents(),this.props.options.dynamicLine&&(this.#i?.removeEvents(),this.#i?.removeLine());}#c=e=>{let{type:t,data:i}=e,{mode:o}=this.props;if(!(!i||!o.getBreak()))switch(t){case"pointMouseDown":this.#e.removeBreakEvents(),this.#e.hideBreakLine();break;case"pointMouseUp":this.#e.initBreakEvents();break;}};#p=e=>{let{type:t,data:i}=e;t==="MODE_CHANGED"&&this.#o==="break"&&(this.#e.removeBreakEvents(),this.#t.initEvents(),this.#o="default"),t==="BREAK_CHANGED"&&i&&this.#o==="default"&&(this.#t.removeEvents(),this.#e.initBreakEvents(),this.#o="break");}};var Z=class{#e;#t;#i;constructor(e){this.#t=e,this.#e=!1,this.#i=new M,e.mode.addObserver(this.#o);}initEvents(){let{map:e}=this.#t;e.on("click",s.FirstPointLayer,this.#n),e.on("mouseenter",s.FirstPointLayer,this.#c),e.on("mouseleave",s.FirstPointLayer,this.#a),e.on("mouseup",s.FirstPointLayer,this.#r),e.on("mousedown",s.FirstPointLayer,this.#s);}removeEvents(){let{map:e}=this.#t;e.off("click",s.FirstPointLayer,this.#n),e.off("mouseenter",s.FirstPointLayer,this.#c),e.off("mouseleave",s.FirstPointLayer,this.#a),e.off("mouseup",s.FirstPointLayer,this.#r);}#o=e=>{let{map:t,store:i}=this.#t,{type:o,data:r}=e;o==="MODE_CHANGED"&&(r==="line"||r==="polygon"?t.on("click",s.FirstPointLayer,this.#n):t.off("click",s.FirstPointLayer,this.#n),c.canCloseGeometry(i)&&E(t,"large"));};#n=()=>{let{store:e,map:t,mode:i,tiles:o}=this.#t;if(i.getMode()==="polygon"&&t.setLayoutProperty(s.PolygonLayer,"visibility","visible"),c.canCloseGeometry(e)){c.closeGeometry(e,i);let r=Object.assign({},e.head?.val,{id:g(),total:e.size});u.addPoint(r,t,i),E(t,"default"),o.render();}};#s=()=>{this.#e=!0,this.#i.remove();};#r=()=>{this.#e=!1;};#a=()=>{let{mouseEvents:e}=this.#t;this.#e||(e.firstPointMouseLeave=!0,this.#i.remove());};#l=()=>{let{mode:e,options:t}=this.#t;return e.getMode()==="line"&&t.modes.line.closeGeometry?t.locale.closeLine:e.getMode()==="polygon"?t.locale.createPolygon:""};#c=e=>{let{mode:t,mouseEvents:i,store:o}=this.#t;if(!(t.getClosedGeometry()||this.#e)&&(i.firstPointMouseEnter=!0,c.canCloseGeometry(o))){let{x:r,y:a}=e.originalEvent;if(r&&a){this.#i.create({label:this.#l(),placement:"bottom"});let S=this.#i._label?this.#i._label.clientWidth/2:0;this.#i.setPosition({x:r-S,y:a+14});}}}};var W=class{#e;#t;#i;#o;#n;#s;#r;#a;constructor(e){this.#e=e,this.#t=void 0,this.#i=null,this.#o=null,this.#n=null,this.#s=new Z(e),this.#r=!1,this.#a=null;}#l=()=>{let{map:e}=this.#e;e.on("click",s.FirstPointLayer,this.#u),e.on("mouseenter",s.FirstPointLayer,this.#L),e.on("mouseleave",s.FirstPointLayer,this.#g),e.on("mousedown",s.FirstPointLayer,this.#m),e.on("mouseup",s.FirstPointLayer,this.#d),e.on("touchend",s.FirstPointLayer,this.#d),e.on("touchstart",s.FirstPointLayer,this.#m),this.#s.initEvents();};initEvents=()=>{let{map:e}=this.#e;e.on("click",this.#h),e.on("dblclick",this.#p),e.on("click",s.PointsLayer,this.#u),e.on("mouseenter",s.PointsLayer,this.#L),e.on("mouseleave",s.PointsLayer,this.#g),e.on("mousedown",s.PointsLayer,this.#m),e.on("mouseup",s.PointsLayer,this.#d),e.on("touchend",s.PointsLayer,this.#d),e.on("touchstart",s.PointsLayer,this.#m),this.#l();};#c=()=>{let{map:e}=this.#e;e.off("click",s.FirstPointLayer,this.#u),e.off("mouseenter",s.FirstPointLayer,this.#L),e.off("mouseleave",s.FirstPointLayer,this.#g),e.off("mousedown",s.FirstPointLayer,this.#m),e.off("mouseup",s.FirstPointLayer,this.#d),e.off("touchend",s.PointsLayer,this.#d),e.off("touchstart",s.PointsLayer,this.#m),this.#s.removeEvents();};removeEvents=()=>{let{map:e}=this.#e;e.off("click",this.#h),e.off("dblclick",this.#p),e.off("mousemove",this.#y),e.off("click",s.PointsLayer,this.#u),e.off("mouseenter",s.PointsLayer,this.#L),e.off("mouseleave",s.PointsLayer,this.#g),e.off("mousedown",s.PointsLayer,this.#m),e.off("mouseup",s.PointsLayer,this.#d),this.#c();};#p=e=>{e.preventDefault();};#u=e=>{let{store:t,tiles:i,panel:o,map:r,mouseEvents:a}=this.#e;ce()&&this.#o&&(t.removeStepById(this.#o.id),o.onPointRemove(t.tail?.val),u.pointDoubleClick({...this.#o,total:t.size},this.#e.map),c.switchToLineModeIfCan(this.#e));let m=h.queryPointId(r,e.point);v.isLastPoint(t,m)&&(a.lastPointMouseClick=!0,a.lastPointMouseUp=!1),i.render();};#f=e=>h.isFeatureTriggered(e,[s.PointsLayer,s.FirstPointLayer,s.LineLayerTransparent,s.LineLayerBreak]);#h=e=>{let{mode:t,mouseEvents:i,map:o}=this.#e;t.getClosedGeometry()||this.#f(e)||(i.lastPointMouseClick&&(i.lastPointMouseClick=!1),o.getCanvasContainer().style.cursor="grab",L.addPointToMap(e,this.#e),L.setSinglePointHidden(e));};#v=e=>{e.originalEvent.buttons===0&&this.#d();};#y=b(e=>{this.#r||(this.#a=e,this.#r=!0,requestAnimationFrame(()=>{if(!this.#o||!this.#a)return;this.#o.lat=e.lngLat.lat,this.#o.lng=e.lngLat.lng,this.#v(this.#a);let{tiles:t}=this.#e;t.renderOnMouseMove(this.#n,e.lngLat),this.#r=!1;}));},22);#L=e=>{let{mouseEvents:t,map:i,store:o}=this.#e;if(t&&(t.pointMouseEnter=!0,t.pointMouseDown))return;L.setSinglePointHidden(e);let r=h.queryPointId(i,e.point);v.isLastPoint(o,r)&&(t.lastPointMouseEnter=!0,t.lastPointMouseLeave=!1);let a=o.findStepById(r);a&&(this.#i=a,u.enterPoint(Object.assign({},a,{total:o.size}),i));};#g=e=>{let{mouseEvents:t,store:i,map:o}=this.#e;if(t&&(t.pointMouseEnter=!1,e.originalEvent.buttons===0&&(t.pointMouseLeave=!0),t.pointMouseDown))return;let r=h.queryPointId(o,e.point);v.isLastPoint(i,r)&&(t.lastPointMouseEnter=!1,t.lastPointMouseLeave=!0),u.leavePoint(Object.assign({},this.#i,{total:i.size}),o);};#E=()=>{let{store:e,panel:t}=this.#e;this.#o&&v.isLastPoint(e,this.#o.id)&&t.hidePanel();};#P=e=>{let{store:t,map:i}=this.#e,o=h.queryPointId(i,e.point),r=t.findStepById(o);r&&(this.#o=r);};#m=e=>{e.preventDefault();let{mouseEvents:t,map:i,store:o}=this.#e;ae(i),this.#P(e),this.#E();let r=h.queryPointId(i,e.point);this.#n=c.getGeometryIndex(o,r),t&&(t.pointMouseDown=!0),this.#t=e.lngLat,i.on("mousemove",this.#y),i.on("touchmove",this.#y);};#d=()=>{let{mouseEvents:e,store:t,panel:i,map:o,options:r}=this.#e;e.pointMouseUp=!0,this.#o&&(v.isLastPoint(t,this.#o.id)&&t.tail?.val&&i?.setPanelLocation(t.tail.val),i?.showPanel(),u.movePoint({id:this.#o.id,total:t.size,end:{lat:this.#o.lat,lng:this.#o.lng},start:this.#t},o)),e&&(e.pointMouseDown=!1),le(o,r),o.off("mousemove",this.#y),o.off("touchmove",this.#y);}};var X=class extends D{#e;#t;#i;#o;#n;constructor(e){super({...e}),this.#e=e,this.#t=new V(e),this.#i=new z(e),this.#o=new W(e),this.#n=new $(e),e.map.on("mode:initialize",this.#s),e.map.on("mode:remove",this.#r);}#s=()=>{this.#n.init(),this.#t?.initEvents(),this.#o?.initEvents();};#r=()=>{this.#t?.removeEvents(),this.#o?.removeEvents(),this.#n?.remove();};removeMapEventsAndConsumers=()=>{this.#t?.removeEvents(),this.#o?.removeEvents(),this.#i?.remove(),this.#n?.remove(),this.#e.map.off("mode:initialize",this.#s);}};var Q=class{#e;_line;_polygon;_break;_container;constructor(e){this.#e=e.options,this._line=void 0,this._polygon=void 0,this._break=void 0,this._container=l.create("div","mapboxgl-ctrl mapboxgl-ctrl-group maplibregl-ctrl maplibregl-ctrl-group"),this.createControl(e);}createControlButton=(e,t,i,o)=>{let r=this.#e.panel.size,a=l.create("button",`control-button control-button-${r}`,this._container);return a.setAttribute("aria-label",t),a.setAttribute("data-type",e),i&&a.classList.add("control-button-active"),o&&(a.setAttribute("disabled","true"),a.setAttribute("aria-disabled","true")),l.create("span",`icon ${e} icon-${r}`,a),a};#t=e=>{let{mode:t,options:i}=e,o=this.#e.modes.line.visible,r=i.locale.line;o&&(this._line=this.createControlButton("line",r,t.getMode()==="line"));};#i=e=>{let{mode:t,options:i}=e,o=this.#e.modes.polygon.visible,r=i.locale.polygon;o&&(this._polygon=this.createControlButton("polygon",r,t.getMode()==="polygon"));};#o=e=>{let{mode:t,options:i}=e,o=this.#e.modes.breakGeometry.visible,r=i.locale.break;if(o){let m=!this.#e?.initial?.closeGeometry,S=t.getBreak();this._break=this.createControlButton("break",r,S,m);}};createControl=e=>{this.#t(e),this.#i(e),this.#o(e);};getContainer=()=>this._container};function Pe(n){return n.initial?.geometry?n.initial?.geometry:n.modes.initial?n.modes.initial:null}var ee=class extends C{#e;#t;#i;constructor(e){super(),this.#e=Pe(e),this.#t=!1,this.#i=e.initial?.closeGeometry??!1;}getMode=()=>this.#e;setMode=e=>{this.#e=e,this.setBreak(!1),this.notify({type:"MODE_CHANGED",data:e});};getBreak=()=>this.#t;setBreak=e=>{this.#t=e,this.notify({type:"BREAK_CHANGED",data:e});};getClosedGeometry=()=>this.#i;setClosedGeometry=e=>{this.#i=e,this.notify({type:"CLOSED_GEOMETRY_CHANGED",data:this.#i});};isPolygon=()=>this.#e==="polygon"&&this.getClosedGeometry();reset=()=>{this.setMode(this.getMode()),this.setClosedGeometry(!1);};pingConsumers=()=>{this.notify({type:"MODE_CHANGED",data:this.getMode()}),this.notify({type:"CLOSED_GEOMETRY_CHANGED",data:this.getClosedGeometry()});}};var te=class{#e;#t;constructor(e){this.#e=e,this.#t=this.#e.map.getCanvasContainer(),this.#t.style.cursor=e.mode.getMode()?f.CROSSHAIR:f.AUTO,this.#i();}set=e=>{this.#t.style.cursor=e;};get=()=>this.#t.style.cursor;handleMouseLeave=()=>{let{mouseEvents:e,mode:t}=this.#e;if(!e.pointMouseDown){if(!t.getMode()){this.set(f.AUTO);return}t.getClosedGeometry()?this.set(f.AUTO):this.set(f.CROSSHAIR);}};handleFirstPointMouseEnter=()=>{let{mode:e,store:t}=this.#e;e.getClosedGeometry()&&this.set(f.MOVE),c.canCloseGeometry(t)&&this.set(f.POINTER);};#i(){let{mouseEvents:e}=this.#e;e.addObserver(this.#o);}removeConsumers(){let{mouseEvents:e}=this.#e;e.removeObserver(this.#o);}#o=e=>{let{mode:t,mouseEvents:i}=this.#e;if(t.getBreak())return;let{type:o,data:r}=e;if(r)switch(o){case"pointMouseDown":this.set(f.GRABBING);break;case"pointMouseUp":this.set(f.GRAB);break;case"pointMouseEnter":if(i.pointMouseDown)return;this.set(f.GRAB);break;case"pointMouseLeave":this.handleMouseLeave();break;case"lineMouseEnter":if(i.pointMouseDown)return;this.set(f.POINTER);break;case"lineMouseLeave":this.handleMouseLeave();break;case"firstPointMouseEnter":this.handleFirstPointMouseEnter();break;case"firstPointMouseLeave":this.handleMouseLeave();break;case"lastPointMouseEnter":this.set(f.POINTER);break;case"lastPointMouseLeave":this.handleMouseLeave();break;}}};var ie=class extends C{#e;#t;#i;#o;#n;#s;#r;#a;#l;#c;#p;#u;constructor(){super(),this.#e=!1,this.#t=!1,this.#i=!1,this.#o=!1,this.#n=!1,this.#s=!1,this.#r=!1,this.#a=!1,this.#l=!1,this.#c=!1,this.#p=!1,this.#u=!1;}get firstPointMouseEnter(){return this.#e}set firstPointMouseEnter(e){this.#e=e,this.notify({type:"firstPointMouseEnter",data:e});}get firstPointMouseLeave(){return this.#t}set firstPointMouseLeave(e){this.#t=e,this.notify({type:"firstPointMouseLeave",data:e});}get lastPointMouseClick(){return this.#i}set lastPointMouseClick(e){this.#i=e,this.notify({type:"lastPointMouseClick",data:e});}get lastPointMouseUp(){return this.#o}set lastPointMouseUp(e){this.#o=e,this.notify({type:"lastPointMouseUp",data:e});}get lastPointMouseEnter(){return this.#n}set lastPointMouseEnter(e){this.#n=e,this.notify({type:"lastPointMouseEnter",data:e});}get lastPointMouseLeave(){return this.#s}set lastPointMouseLeave(e){this.#s=e,this.notify({type:"lastPointMouseLeave",data:e});}get pointMouseDown(){return this.#r}set pointMouseDown(e){this.#r=e,this.notify({type:"pointMouseDown",data:e});}get pointMouseUp(){return this.#a}set pointMouseUp(e){this.#a=e,this.notify({type:"pointMouseUp",data:e});}get pointMouseEnter(){return this.#l}set pointMouseEnter(e){this.#l=e,this.notify({type:"pointMouseEnter",data:e});}get pointMouseLeave(){return this.#c}set pointMouseLeave(e){this.#c=e,this.notify({type:"pointMouseLeave",data:e});}get lineMouseEnter(){return this.#p}set lineMouseEnter(e){this.#p=e,this.notify({type:"lineMouseEnter",data:e});}get lineMouseLeave(){return this.#u}set lineMouseLeave(e){this.#u=e,this.notify({type:"lineMouseLeave",data:e});}};var N=class{static allStepsHaveIds(e){return e.every(t=>"id"in t&&t.id!==void 0)}static checkIfMissingIds(e,t){let i=!t,o=!this.allStepsHaveIds(e);if(i&&o)throw new Error(I.MISSING_IDS)}static checkIfEnoughPointsToClose(e,t){if(t&&e.length<3)throw new Error(I.NOT_ENOUGH_POINTS_TO_CLOSE)}static checkIfPolygonIsClosed(e){let{closeGeometry:t,steps:i}=e;if(i){let o=i[0]?.lng,r=i[i.length-1]?.lng,a=i[0]?.lat,m=i[i.length-1]?.lat;if((o!==r||a!==m)&&t)throw new Error(I.FIRST_LAST_POINT_NOT_EQUAL)}}static checkInitialStepsOption(e){let{closeGeometry:t,generateId:i,steps:o}=e;this.checkIfMissingIds(o,i),this.checkIfEnoughPointsToClose(o,t),this.checkIfPolygonIsClosed(e);}static init(e){return e?{panel:be(e),modes:Me(e),layersPaint:Ce(e),initial:e.initial||p.initial,locale:Se(e),dynamicLine:e.dynamicLine??p.dynamicLine}:p}};function be(n){return {size:n.panel?.size||p.panel.size,buttons:{undo:{visible:n.panel?.buttons?.undo?.visible??p.panel.buttons.undo.visible},delete:{visible:n.panel?.buttons?.delete?.visible??p.panel.buttons.delete.visible},save:{visible:n.panel?.buttons?.save?.visible??p.panel.buttons.save.visible,clearOnSave:n.panel?.buttons?.save?.clearOnSave??p.panel.buttons.save.clearOnSave}}}}function Me(n){return {initial:n.modes?.initial||p.modes.initial,line:{visible:n?.modes?.line?.visible!==void 0?n.modes.line.visible:n?.initial?.geometry==="line"||p.modes.line.visible,closeGeometry:n?.modes?.line?.closeGeometry??n?.initial?.closeGeometry??p.modes.line.closeGeometry},polygon:{visible:n?.modes?.polygon?.visible!==void 0?n.modes.polygon.visible:n?.initial?.geometry==="polygon"||p.modes.polygon.visible},breakGeometry:{visible:n?.modes?.breakGeometry?.visible??p.modes.breakGeometry.visible}}}function Ce(n){return {onLinePoint:{"circle-radius":n.layersPaint?.onLinePoint?.["circle-radius"]||k["circle-radius"],"circle-color":n.layersPaint?.onLinePoint?.["circle-color"]||k["circle-color"],"circle-stroke-color":n.layersPaint?.onLinePoint?.["circle-stroke-color"]||k["circle-stroke-color"],"circle-stroke-width":n.layersPaint?.onLinePoint?.["circle-stroke-width"]||k["circle-stroke-width"],...n.layersPaint?.onLinePoint},firstPoint:{"circle-radius":n.layersPaint?.firstPoint?.["circle-radius"]||O["circle-radius"],"circle-color":n.layersPaint?.firstPoint?.["circle-color"]||O["circle-color"],"circle-stroke-color":n.layersPaint?.firstPoint?.["circle-stroke-color"]||O["circle-stroke-color"],"circle-stroke-width":n.layersPaint?.firstPoint?.["circle-stroke-width"]||O["circle-stroke-width"],...n.layersPaint?.firstPoint},points:{"circle-radius":n.layersPaint?.points?.["circle-radius"]||T["circle-radius"],"circle-color":n.layersPaint?.points?.["circle-color"]||T["circle-color"],"circle-stroke-color":n.layersPaint?.points?.["circle-stroke-color"]||T["circle-stroke-color"],"circle-stroke-width":n.layersPaint?.points?.["circle-stroke-width"]||T["circle-stroke-width"],...n.layersPaint?.points},line:{"line-width":n.layersPaint?.line?.["line-width"]||_["line-width"],"line-color":n.layersPaint?.line?.["line-color"]||_["line-color"],"line-opacity":n.layersPaint?.line?.["line-opacity"]||_["line-opacity"],...n.layersPaint?.line},polygon:{"fill-color":n.layersPaint?.polygon?.["fill-color"]||A["fill-color"],"fill-opacity":n.layersPaint?.polygon?.["fill-opacity"]||A["fill-opacity"],...n.layersPaint?.polygon},breakLine:{"line-width":n.layersPaint?.breakLine?.["line-width"]||x["line-width"],"line-color":n.layersPaint?.breakLine?.["line-color"]||x["line-color"],"line-dasharray":n.layersPaint?.breakLine?.["line-dasharray"]||x["line-dasharray"],...n.layersPaint?.breakLine}}}function Se(n){return {save:n.locale?.save??p.locale.save,delete:n.locale?.delete??p.locale.delete,undo:n.locale?.undo??p.locale.undo,line:n.locale?.line??p.locale.line,polygon:n.locale?.polygon??p.locale.polygon,break:n.locale?.break??p.locale.break,closeLine:n.locale?.closeLine??p.locale.closeLine,createPolygon:n.locale?.createPolygon??p.locale.createPolygon}}var se=class n{#e;#t;#i;#o;#n;#s;#r;#a;#l;static#c=null;static#p=!1;constructor(e){if(this.#o=N.init(e),this.#o.initial&&N.checkInitialStepsOption(this.#o.initial),n.#p)throw new Error("Use 'DrawLibre.getInstance()' instead of 'new DrawLibre()'.");n.#p=!0,this.#t=void 0,this.#i=void 0,this.#n=void 0,this.#s=void 0,this.#r=void 0,this.#l=void 0,this.#a=void 0;}static getInstance(e){return n.#c||(n.#c=new n(e)),n.#c}onAdd(e){this.#t=new B(this.#o),this.#i=new ee(this.#o),this.#r=new R({map:e,mode:this.#i,options:this.#o,store:this.#t}),this.#s=new D({map:e,store:this.#t,options:this.#o,mode:this.#i});let t=new Q({options:this.#o,mode:this.#i});return this.#l=new ie,this.#a=new te({map:e,mode:this.#i,mouseEvents:this.#l,store:this.#t}),this.#n=new X({map:e,store:this.#t,options:this.#o,panel:this.#r,control:t,mode:this.#i,tiles:this.#s,mouseEvents:this.#l}),this.#i.getMode()&&e.fire("mode:initialize"),this.#i.pingConsumers(),this.#e=t.getContainer(),this.#e}onRemove(){this.#a?.removeConsumers(),this.#s?.removeTiles(),this.#n?.removeMapEventsAndConsumers(),this.#r?.removePanel(),this.#t?.reset(),this.#i?.unsubscribe(),this.#e&&l.remove(this.#e);}setSteps=e=>{if(Array.isArray(e))for(let t of e){let i={...t,id:t.id||g()};this.#t?.push(i);}else throw new Error("Invalid argument. Expected an array of steps.");this.#s?.render();};findStepById=e=>this.#t?.findStepById(e);getAllSteps=(e="array")=>{if(e==="array"&&this.#t)return v.toArray(this.#t.head);if(e==="linkedlist")return this.#t;throw new Error("Invalid type specified. Use 'array' or 'linkedlist'.")};setOptions=e=>{this.#o=e(this.#o);};removeAllSteps=()=>{this.#t?.reset(),this.#r?.removePanel(),this.#s?.render();}};
|
|
1
|
+
var p=class n{static docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style;static transformProp=n.testProp(["transform","WebkitTransform"]);static testProp(e){if(!n.docStyle)return e[0];for(let t=0;t<e.length;t++)if(e[t]in n.docStyle)return e[t];return e[0]}static create(e,t,i){let o=window.document.createElement(e);return t!==void 0&&(o.className=t),i&&i.appendChild(o),o}static remove(e){e.parentNode&&e.parentNode.removeChild(e);}static setTransform(e,t){n.transformProp&&e.style&&(e.style[n.transformProp]=t);}static manageEventListener(e,t,i,o,r={}){if(!t)return;let a=e==="add"?"addEventListener":"removeEventListener";"passive"in r?t[a](i,o,r):t[a](i,o,r.capture);}static mouseButton(e){return e.button}static addClassName(e,t){e.classList.contains(t)||e.classList.add(t);}static removeClassName(e,t){e.classList.contains(t)&&e.classList.remove(t);}};var H=class{#e;#t;#o;_undoButton;_deleteButton;_saveButton;_container;_updatePositionCallback;constructor(e){this.#e=e,this._container=void 0,this.#t=!0,this.#o=void 0,this.#r();}#i(){this.#o&&(this.#o.className="dashboard-container",this.#o.style.position="absolute",this.#o.style.zIndex="1000000",this.#o.style.pointerEvents="auto",this.#o.style.display=this.#t?"none":"block");}#r=()=>{let{store:e}=this.#e;this.createPanel(),this.#o=document.createElement("div"),this.#i(),this._container&&this.#o.appendChild(this._container),document.body.appendChild(this.#o),e.tail?.val&&this.setPanelLocation({lat:e.tail?.val?.lat,lng:e.tail?.val?.lng});};setPanelLocation=e=>{if(!this.#o)return;this.#t&&this.showPanel();let t=this.#e.map.project(e);this.#n(t),this.#s(e);};#n=e=>{if(this.#t||!this.#o)return;let i=this.#e.map.getContainer().getBoundingClientRect(),o=i.left+e.x,r=i.top+e.y,a=36;this.#o.style.left=`${o-a}px`,this.#o.style.top=`${r-a}px`;};#s(e){this.#l(),this._updatePositionCallback=()=>{this.#t||!this.#o||this.#n(this.#e.map.project(e));},this.#e.map.on("move",this._updatePositionCallback),this.#e.map.on("zoom",this._updatePositionCallback);}#l(){this._updatePositionCallback&&(this.#e.map.off("move",this._updatePositionCallback),this.#e.map.off("zoom",this._updatePositionCallback),this._updatePositionCallback=void 0);}showPanel=()=>{this.#t&&this.#o&&(this.#t=!1,this.#o.style.display="block",this.#o.style.transition="opacity 0.2s",this.#o.style.opacity="1");};hidePanel=()=>{!this.#t&&this.#o&&(this.#t=!0,this.#o.style.display="none");};removePanel=()=>{this._updatePositionCallback&&(this.#e.map.off("move",this._updatePositionCallback),this.#e.map.off("zoom",this._updatePositionCallback),this._updatePositionCallback=void 0),this.#o&&(document.body.removeChild(this.#o),this.#o=void 0),this._container&&(p.remove(this._container),this._container=void 0);};#a=(e,t,i,o)=>{let r=p.create("button",`panel-button panel-button-${i}`,o);return r.setAttribute("data-type",e),r.setAttribute("aria-label",t),p.create("span",`icon ${e} icon-${i}`,r),r};createPanel=()=>{let{options:e}=this.#e,{locale:t}=e,{undo:i,delete:o,save:r}=e.panel.buttons,a=e.panel.size,l=p.create("div","dashboard");i.visible&&(this._undoButton=this.#a("undo",t.undo,a,l)),o.visible&&(this._deleteButton=this.#a("delete",t.delete,a,l)),r.visible&&(this._saveButton=this.#a("save",t.save,a,l)),this._container=l;}};var ce={type:"FeatureCollection",features:[{type:"Feature",properties:{},geometry:{type:"LineString",coordinates:[]}}]};var s={LineDynamicLayer:"mdl-line-dynamic-layer",LineLayer:"mdl-line-layer",LineLayerTransparent:"mdl-line-layer-transparent",LineLayerBreak:"mdl-line-break-layer",PolygonLayer:"mdl-polygon-layer",PointsLayer:"mdl-points-layer",SinglePointLayer:"mdl-single-point-layer",FirstPointLayer:"mdl-first-point-layer",AuxiliaryPointLayer:"mdl-auxiliary-point-layer"},d={UnifiedSource:"mdl-unified-source",LineDynamicSource:"mdl-line-dynamic-source",LineSourceBreak:"mdl-line-source-break",SinglePointSource:"mdl-single-point-source"},T={large:6.5,default:5.5},U={large:"#FF6464",default:"#666666"},w={"circle-radius":T.default,"circle-color":"#FEFFFE","circle-stroke-color":U.default,"circle-stroke-width":3},B={"circle-radius":T.default-1.5,"circle-color":"#FEFFFE","circle-stroke-color":"#666666","circle-stroke-width":2},k={"circle-radius":T.large,"circle-color":"#FEFFFE","circle-stroke-color":"#666666","circle-stroke-width":3},R={"fill-color":"grey","fill-opacity":.4},D={"line-width":3,"line-color":"grey","line-opacity":.7},A={"circle-radius":T.default,"circle-color":"#FEFFFE","circle-stroke-color":"#666666","circle-stroke-width":3},_={"line-width":3,"line-color":"#FF6464","line-dasharray":[3,3]},q=n=>[{id:s.SinglePointLayer,source:d.SinglePointSource,type:"circle",paint:n.layersPaint.onLinePoint,layout:{visibility:"none"}},{id:s.PolygonLayer,source:d.UnifiedSource,type:"fill",paint:n.layersPaint.polygon,layout:{visibility:"none"},filter:["==","$type","Polygon"]},{id:s.LineDynamicLayer,source:d.LineDynamicSource,type:"line",paint:n.layersPaint.line,layout:{visibility:"none"}},{id:s.LineLayer,source:d.UnifiedSource,type:"line",paint:n.layersPaint.line,layout:{visibility:"visible"},filter:["==","$type","LineString"]},{id:s.LineLayerTransparent,source:d.UnifiedSource,type:"line",paint:{"line-width":4,"line-color":"transparent"},filter:["==","$type","LineString"]},{id:s.LineLayerBreak,source:d.LineSourceBreak,type:"line",paint:n.layersPaint.breakLine,layout:{visibility:"none"}},{id:s.PointsLayer,source:d.UnifiedSource,type:"circle",paint:n.layersPaint.points,filter:["all",["==","$type","Point"],["==","isFirst",!1],["==","isAuxiliary",!1]]},{id:s.FirstPointLayer,source:d.UnifiedSource,type:"circle",paint:n.layersPaint.firstPoint,filter:["==",["get","isFirst"],!0],layout:{visibility:"none"}},{id:s.AuxiliaryPointLayer,source:d.UnifiedSource,type:"circle",paint:n.layersPaint.auxiliaryPoint,filter:["==",["get","isAuxiliary"],!0]}];var m=class{static isFeatureTriggered(e,t){return e.target.queryRenderedFeatures(e.point,{layers:t}).some(o=>t.includes(o.layer.id))}static getPixelCoordinates=(e,t)=>{let{lat:i,lng:o}=t;return e.project([o,i])};static queryPointId=(e,t)=>e.queryRenderedFeatures(t,{layers:[s.PointsLayer,s.FirstPointLayer,s.AuxiliaryPointLayer,s.SinglePointLayer]})?.[0]?.properties.id;static queryPoint=(e,t)=>e.queryRenderedFeatures(t,{layers:[s.PointsLayer,s.FirstPointLayer,s.AuxiliaryPointLayer,s.SinglePointLayer]})?.[0]},b=class{static#e(e){let t=[],i=e.head,o=new Set;for(;i!==null;){if(o.has(i.val?.id)){e.head&&e.head.val&&t.push([e.head.val.lng,e.head.val.lat]);break}o.add(i.val?.id),i.val&&t.push([i.val.lng,i.val.lat]),i=i.next;}return t}static getLine(e,t){return {type:"FeatureCollection",features:[{type:"Feature",properties:{},geometry:{type:"LineString",coordinates:[e,t]}}]}}static getAllLines(e){return {type:"FeatureCollection",features:[{type:"Feature",properties:{},geometry:{type:"LineString",coordinates:e}}]}}static getPolygon(e){return {type:"FeatureCollection",features:[{type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[e]}}]}}static getPoints(e){let t=e.head,i=[],o=new Set;for(;t!==null&&!o.has(t.val?.id);){if(t.val){let r=t.val,a=t.val.id===e.head?.val?.id;i.push({type:"Feature",properties:{id:r.id,lat:r.lat,lng:r.lng,isFirst:a,isAuxiliary:r.isAuxiliary},geometry:{type:"Point",coordinates:[r.lng,r.lat]}});}o.add(t.val?.id),t=t.next;}return {type:"FeatureCollection",features:i}}static getUnifiedFeatures(e){let t=this.getPoints(e).features,i=this.#e(e),o=this.getAllLines(i).features,r=this.getPolygon(i).features;return {type:"FeatureCollection",features:[...t,...o,...r]}}},u=class n{static getGeometryIndex=(e,t)=>{let i=e.head,o=0,r=new Set;for(;i!==null&&!r.has(i.val?.id);){if(i.val?.id===t)return o;r.add(i.val?.id),o++,i=i.next;}return -1};static distance=(e,t)=>Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2);static checkIfPointIsOnLine=(e,t,i)=>{let r=this.distance(e,t),a=this.distance(e,i),l=this.distance(i,t);return Math.abs(a+l-r)<.1};static isClosedGeometry=(e,t)=>t.pointGeneration==="auto"?e.tail?.next?.val?.id===e.head?.val?.id&&e.tail?.next!==null:e.tail?.next===e.head;static breakGeometry=(e,t,i)=>{e.head&&(t.pointGeneration==="auto"?(i.val?.isAuxiliary?(e.head=i.next,e.head.prev=null,e.tail=i.prev,e.tail.next=null):(e.head=i.next?.next,e.head.prev=null,e.tail=i,e.tail.next=null),e.size=e.size-1):(e.head=i.next,e.head.prev=null,e.tail=i,e.tail.next=null));};static closeGeometry=(e,t)=>{e.tail&&e.head&&(e.tail.next=e.head,e.head.prev=e.tail),t.setClosedGeometry(!0);};static canCloseGeometry=(e,t)=>(t.pointGeneration==="auto"?e.size>3:e.size>2)&&!this.isClosedGeometry(e,t);static canBreakClosedGeometry=(e,t)=>t.pointGeneration==="auto"?e.size<=3:e.size<=2;static switchToLineModeIfCan=e=>{let{store:t,map:i,mode:o,options:r}=e,a=t.tail?.next===t.head;n.canBreakClosedGeometry(t,r)&&a&&(r.pointGeneration==="auto"?t.tail?.val?.isAuxiliary?(t.head&&(t.head.next=t.tail,t.head.prev=null),t.tail&&t.tail.prev&&t.head&&(t.tail=t.tail.prev,t.tail.prev=t.head.next,t.tail.next=null),t.head?.next&&(t.head.next.next=t.tail,t.head.next.prev=t.head)):(t.head&&(t.head.prev=null),t.tail&&t.head&&(t.tail.prev=t.head.next,t.tail.next=null)):t.tail&&(t.tail.next=null),o.reset());}},E=()=>{if("crypto"in window&&"randomUUID"in window.crypto)return window.crypto.randomUUID();function n(){return "0123456789abcdef"[Math.floor(Math.random()*16)]}function e(o){let r="";for(let a=0;a<o;a++)r+=n();return r}function t(o){let r=o===0,a=o===4;return r?8:a?12:4}let i=[];for(let o=0;o<5;o++)i.push(e(t(o)));return i.join("-")},S=(n,e)=>{let t,i=!0;function o(){i&&t&&(n(...t),t=null,i=!1,setTimeout(()=>{i=!0,o();},e));}return function(...r){t=r,o();}},C=(n,e)=>{let t;return function(...i){clearTimeout(t),t=window.setTimeout(()=>{n(...i);},e);}};var I=class{#e;#t;constructor(e){this.#e=e,this.#t=b.getUnifiedFeatures(this.#e.store),this.#o(),this.render();}#o(){this.#s(),this.#l(),this.#a(s.LineLayer,s.SinglePointLayer),this.#a(s.LineLayerTransparent,s.SinglePointLayer),this.#a(s.LineLayerTransparent,s.FirstPointLayer),this.#a(s.LineLayerTransparent,s.PointsLayer),this.#a(s.PolygonLayer,s.LineLayer),this.#i();}#i=()=>{let{store:e}=this.#e;e.addObserver(this.#n);};#r=()=>{let{store:e}=this.#e;e.removeObserver(this.#n);};#n=C(e=>{if(e.type==="STORE_MUTATED"||e.type==="STORE_DETACHED"){let{map:t,mode:i,options:o,store:r}=this.#e;i.getMode()==="polygon"&&u.isClosedGeometry(r,o)?t.setLayoutProperty(s.PolygonLayer,"visibility","visible"):t.setLayoutProperty(s.PolygonLayer,"visibility","none");}},10);#s=()=>{let{map:e}=this.#e;for(let t of Object.values(d))e.getSource(t)||e.addSource(t,{type:"geojson",data:{type:"FeatureCollection",features:[]},promoteId:"id"});};#l=()=>{let{map:e,options:t}=this.#e,i=q(t);for(let o of i)e.getLayer(o.id)||e.addLayer(o);};#a=(e,t)=>{let{map:i}=this.#e,o=i.getLayer(e),r=i.getLayer(t);o&&r&&i.moveLayer(e,t);};#p=()=>{let{map:e}=this.#e;for(let t of Object.values(d))e.getSource(t)&&e.removeSource(t);};#u=()=>{let{map:e}=this.#e;for(let t of Object.values(s))e.getLayer(t)&&e.removeLayer(t);};removeTiles=()=>{this.#u(),this.#p(),this.#r();};updateLine(e,t){let{mode:i}=this.#e,o=this.#t.features.at(-2)?.geometry.coordinates;o&&(o[e]=[t.lng,t.lat],i.getClosedGeometry()&&e===0&&(o[o.length-1]=[t.lng,t.lat]));}updatePolygon(e,t){let{mode:i}=this.#e,o=this.#t.features.at(-1)?.geometry.coordinates[0];o&&(o[e]=[t.lng,t.lat],i.getClosedGeometry()&&e===0&&(o[o.length-1]=[t.lng,t.lat]));}updatePoint(e,t){let i=this.#t?.features?.[e];i?.geometry?.coordinates&&(i.geometry.coordinates=[t.lng,t.lat]);}renderOnMouseMove=(e,t,i)=>{let{mode:o,options:r,store:a}=this.#e,l=e===0?a.size-1:e-1;this.updatePoint(e,t),i&&i.prev&&this.updatePoint(l,i.prev),i&&i.next&&this.updatePoint(e+1,i.next),this.updateLine(e,t),i&&i.prev&&this.updateLine(l,i.prev),i&&i.next&&this.updateLine(e+1,i.next),r.modes.polygon.visible&&o.isPolygon()&&(this.updatePolygon(e,t),i&&i.prev&&this.updatePolygon(l,i.prev),i&&i.next&&this.updatePolygon(e+1,i.next));let M=this.#e.map.getSource(d.UnifiedSource);M&&M.setData(this.#t);};render(){this.#t=b.getUnifiedFeatures(this.#e.store);let e=this.#e.map.getSource(d.UnifiedSource);e&&e.setData(this.#t);}resetGeometries=()=>{let e=this.#e.map.getSource(d.UnifiedSource);e&&e.setData({type:"FeatureCollection",features:[]});}};var Pe=8,Me=8,x=class{_container;_label;constructor(){this._container=void 0;}create=e=>{let t=p.create("div","popup-container",document.body),i=p.create("span",`popup-text popup-text-${e.placement}`,t);return i.textContent=e.label,this._container=t,this._label=i,this};#e=()=>{!this._label?.classList.value.includes("popup-text-active")&&this._label?.classList.add("popup-text-active");};#t=()=>this._label?{width:this._label.clientWidth,height:this._label.clientHeight}:{width:0,height:0};#o=e=>{let{bottom:t,left:i}=e.target.getBoundingClientRect(),{width:o,height:r}=this.#t();return {x:i-Me-o,y:t-r-2}};#i=e=>{let{bottom:t,left:i,right:o}=e.target.getBoundingClientRect(),{width:r}=this.#t();return {x:(o-i)/2+i-r/2,y:t+Pe}};getPosition=(e,t)=>t==="left"?this.#o(e):this.#i(e);setPosition=e=>{let{x:t,y:i}=e;this._container&&(this._container.style.left=`${t}px`,this._container.style.top=`${i}px`),this.#e();};remove=()=>{this._container&&p.remove(this._container);}};var f={AUTO:"auto",DEFAULT:"default",POINTER:"pointer",CROSSHAIR:"crosshair",MOVE:"move",HELP:"help",GRAB:"grab",GRABBING:"grabbing"};var z=(n,e)=>{for(let[t,i]of Object.entries(e))p.manageEventListener("add",n,t,i);},V=(n,e)=>{for(let[t,i]of Object.entries(e))p.manageEventListener("remove",n,t,i);},de=(n,e)=>{let t=e.locale.line,i=e.locale.polygon,o=e.locale.break;return {line:t,polygon:i,break:o}[n]};var y={DOUBLECLICK:"mdl:doubleclick",POINTENTER:"mdl:pointenter",POINTLEAVE:"mdl:pointleave",MOVEEND:"mdl:moveend",ADD:"mdl:add",UNDO:"mdl:undo",REMOVEALL:"mdl:removeall",SAVE:"mdl:save",BREAK:"mdl:break",MODECHANGED:"mdl:modechanged"},me=768,c={pointGeneration:"manual",panel:{size:"medium",buttons:{undo:{visible:!0},delete:{visible:!0},save:{visible:!0,clearOnSave:!0}}},modes:{initial:null,line:{visible:!0,closeGeometry:!0},polygon:{visible:!0},breakGeometry:{visible:!0}},layersPaint:{onLinePoint:k,firstPoint:w,points:A,line:D,polygon:R,breakLine:_},initial:null,dynamicLine:!0,locale:{save:"Save",delete:"Delete all",undo:"Undo",line:"Line",polygon:"Polygon",break:"Split",closeLine:"Close the line",createPolygon:"Create a polygon"}};var h=class{static addPoint(e,t,i){t.fire(y.ADD,{id:e.id,coordinates:{lat:e.lat,lng:e.lng},total:e.total,timestamp:Date.now(),mode:{geometry:i.getMode(),closedGeometry:i.getClosedGeometry()}});}static movePoint(e,t){t.fire(y.MOVEEND,{id:e.id,start_coordinates:{lat:e.start.lat,lng:e.start.lng},end_coordinates:{lat:e.end.lat,lng:e.end.lng},total:e.total,timestamp:Date.now()});}static pointDoubleClick(e,t){t.fire(y.DOUBLECLICK,{id:e.id,coordinates:{lat:e.lat,lng:e.lng},total:e.total,timestamp:Date.now()});}static enterPoint(e,t){t.fire(y.POINTENTER,{id:e.id,coordinates:{lat:e.lat,lng:e.lng},total:e.total,timestamp:Date.now()});}static leavePoint(e,t){t.fire(y.POINTLEAVE,{id:e.id,coordinates:{lat:e.lat,lng:e.lng},total:e.total,timestamp:Date.now()});}static undoPoint(e,t,i){t.fire(y.UNDO,{originalEvent:i,id:e.id,coordinates:{lat:e.lat,lng:e.lng},total:e.total,timestamp:Date.now()});}static modeChanged(e,t){e.fire(y.MODECHANGED,{mode:t});}static removeAllPoints(e,t){e.fire(y.REMOVEALL,{originalEvent:t});}static onSaveClick(e,t,i){let{map:o,mode:r}=e;o.fire(y.SAVE,{originalEvent:i,timestamp:Date.now(),steps:t,mode:{geometry:r.getMode(),closedGeometry:r.getClosedGeometry()}});}static onLineBreak(e){e.fire(y.BREAK);}};var Y=class{#e;constructor(e){this.#e=e,this.#t();}#t=()=>{this.#e.mode.addObserver(this.#a);};removeConsumers=()=>{this.#e.mode.removeObserver(this.#a);};#o=()=>{let{_line:e,_polygon:t,_break:i}=this.#e.control;e?.classList.remove("control-button-active"),t?.classList.remove("control-button-active"),i?.classList.remove("control-button-active");};#i=e=>{this.#o(),e.classList.add("control-button-active");};#r=e=>{let{data:t}=e,{_line:i,_polygon:o,_break:r}=this.#e.control,{mode:a}=this.#e;if(h.modeChanged(this.#e.map,t),!(!i||!o||!r)){switch(t){case"line":this.#i(i);break;case"polygon":this.#i(o);break;}t?a.getClosedGeometry()&&this.#s(r):this.#n(r);}};#n=e=>{e.setAttribute("disabled","true"),e.setAttribute("aria-disabled","true");};#s=e=>{e.removeAttribute("disabled"),e.removeAttribute("aria-disabled");};#l=e=>{let{data:t}=e,{_break:i,_line:o,_polygon:r}=this.#e.control,{mode:a}=this.#e;t?(i&&this.#s(i),a.getMode()==="polygon"&&o&&this.#n(o),a.getMode()==="line"&&r&&this.#n(r)):(i&&this.#n(i),a.getMode()==="polygon"&&o&&this.#s(o),a.getMode()==="line"&&r&&this.#s(r));};#a=e=>{let{type:t,data:i}=e;if(t==="MODE_CHANGED"&&this.#r(e),t==="CLOSED_GEOMETRY_CHANGED"&&this.#l(e),t==="BREAK_CHANGED"&&i){let{_break:o}=this.#e.control;this.#i(o),h.modeChanged(this.#e.map,"break");}}};var j=class{#e;#t;#o;constructor(e){this.#e=e,this.#o=new Y(e),this.#t=new x,this.#i();}#i(){let{control:e}=this.#e;if(e){let t={mouseenter:this.onButtonEnter,mouseleave:this.onButtonLeave};e._line&&z(e._line,{...t,click:this.onLineClick}),e._polygon&&z(e._polygon,{...t,click:this.onPolygonClick}),e._break&&z(e._break,{...t,click:this.onBreakClick});}}#r(){let{control:e}=this.#e;if(e){let t={mouseenter:this.onButtonEnter,mouseleave:this.onButtonLeave};e._line&&V(e._line,{...t,click:this.onLineClick}),e._polygon&&V(e._polygon,{...t,click:this.onPolygonClick}),e._break&&V(e._break,{...t,click:this.onBreakClick});}}remove(){this.#o.removeConsumers(),this.#r(),this.#t.remove();}onButtonEnter=e=>{let{options:t}=this.#e,i=e.target.getAttribute("data-type");if(i){let o=de(i,t),r="left";this.#t.create({label:o,placement:r}).setPosition(this.#t.getPosition(e,r));}};onButtonLeave=()=>{this.#t.remove();};#n=()=>{let{control:e}=this.#e;e._line?.classList.remove("control-button-active"),e._polygon?.classList.remove("control-button-active"),e._break?.classList.remove("control-button-active");};#s=()=>{let{map:e,mode:t}=this.#e;t.getMode()||e.fire("mode:initialize");};onLineClick=()=>{let{map:e,mode:t,tiles:i,control:o}=this.#e;this.#s(),this.#n(),t.getMode()==="line"&&!t.getBreak()?(t.setMode(null),e.fire("mode:remove"),i.resetGeometries()):(o._line?.classList.add("control-button-active"),t.setMode("line"),i.render());};onPolygonClick=()=>{let{map:e,mode:t,tiles:i,control:o}=this.#e;this.#s(),this.#n(),t.getMode()==="polygon"&&!t.getBreak()?(t.setMode(null),e.fire("mode:remove"),i.resetGeometries()):(o._polygon?.classList.add("control-button-active"),t.setMode("polygon"),i.render());};onBreakClick=()=>{let{map:e,mode:t,control:i}=this.#e;t.getBreak()&&(t.setMode(null),e.fire("mode:remove")),this.#n(),i._break?.classList.add("control-button-active"),t.setBreak(!0),e.getCanvasContainer().style.cursor=f.POINTER;}};var v={getMidpoint(n,e){return {lat:(n.lat+e.lat)/2,lng:(n.lng+e.lng)/2}},createAuxiliaryPoint(n,e){let t=v.getMidpoint(n,e);return {lat:t.lat,lng:t.lng,isAuxiliary:!0,id:E()}},addPointToMap(n,e){let{store:t}=e,i={...n.lngLat,isAuxiliary:!1,id:E()};return t.push(i),i}},g={setFirstPointVisible(n){n.setLayoutProperty(s.FirstPointLayer,"visibility","visible");},setFirstPointHidden(n){n.setLayoutProperty(s.FirstPointLayer,"visibility","none");},setSinglePointVisible(n){n.target.setLayoutProperty(s.SinglePointLayer,"visibility","visible");},setSinglePointHidden(n){let e=n.target;setTimeout(()=>{e.setLayoutProperty(s.SinglePointLayer,"visibility","none");},33);}},ae={default(n){n.setFilter(s.PointsLayer,["all",["==","$type","Point"],["==","isFirst",!1],["==","isAuxiliary",!1]]);},closedGeometry(n){n.setFilter(s.PointsLayer,["all",["==","$type","Point"],["==","isAuxiliary",!1]]);}};var O=class{observers;constructor(){this.observers=new Set;}addObserver(e){this.observers.add(e);}removeObserver(e){this.observers.delete(e);}unsubscribe(){this.observers.clear();}notify(e){this.observers.forEach(t=>t(e));}};var N={EMPTY_INITIAL_STATE:"You passed an empty initial array in the options. Please either remove the 'initial' property or include at least one element in the array.",MISSING_IDS:"You set 'generateId' to false but did not provide IDs for all steps. Please ensure all steps have IDs or set 'generateId' to true.",NOT_ENOUGH_POINTS_TO_CLOSE:"At least three points are required to close a polygon or a line. Please add more points or set 'closeGeometry' to false.",FIRST_LAST_POINT_NOT_EQUAL:"The first and last points of a polygon or a closed linestring must be the same. Please ensure the first and last points are equal or set 'closeGeometry' to false."};var J=class{val;prev;next;constructor(e=null,t=null,i=null){this.val=e,this.prev=i,this.next=t;}},G=class extends O{head;tail;size;map;constructor(e){super();let t=P.initStore(e);this.map=t?t.map:new Map,this.head=t?t.head:null,this.tail=t?t.tail:null,this.size=t?t.size:0;}push(e){let t=new J(e);this.head?this.tail&&(t.prev=this.tail,this.tail.next=t,this.tail=t):this.head=this.tail=t,this.map.set(e.id,t),this.size++,this.pingConsumers();}insert(e,t){if(!t)return;let i=new J(e);i.prev=t,i.next=t.next,this.tail===t&&this.head===t.next&&(this.tail=i),t.next&&(t.next.prev=i),t.next=i,this.map.set(e.id,i),this.size++,this.pingConsumers();}findStepById(e){let t=this.map.get(e);return t?t.val:null}findNodeById(e){let t=this.map.get(e);return t||null}removeNodeById(e){let t=this.map.get(e);return t?(this.size===1?(this.head=null,this.tail=null):(t.prev&&(t.prev.next=t.next),t.next&&(t.next.prev=t.prev),t===this.head&&(this.head=t.next,this.head?.prev&&this.tail&&(this.tail.next=this.head)),t===this.tail&&(this.tail=t.prev,this.head&&this.tail?.next&&(this.head.prev=this.tail))),this.map.delete(e),this.size--,this.pingConsumers(),t):null}reset(){this.head=null,this.tail=null,this.size=0,this.map.clear(),this.pingConsumers();}pingConsumers=()=>{this.notify({type:"STORE_MUTATED",data:{head:this.head,tail:this.tail,size:this.size}});}},P=class n{static isLastPoint=(e,t,i)=>t.pointGeneration==="auto"&&e.tail?.next===e.head?e.tail?.prev?.val?.id===i:e.tail?.val?.id===i;static initStore(e){if(!e?.initial)return null;if(e&&e.initial&&!e.initial.steps.length)throw new Error(N.EMPTY_INITIAL_STATE);return e&&e.initial.steps?n.fromArray(e.initial,e.pointGeneration):null}static#e=e=>e.map((t,i)=>({...t,isAuxiliary:!1,isFirst:i===0,id:E()}));static buildStepSequence(e,t,i){let o=new G,r=t?e.slice(0,-1):e;return r.forEach((a,l)=>{if(o.push(a),i==="auto"){if(r[l+1]){let M=v.createAuxiliaryPoint(a,r[l+1]);o.push(M);}else if(t){let M=v.createAuxiliaryPoint(a,r[0]);o.push(M);}}}),o}static fromArray(e,t){let{steps:i,closeGeometry:o,generateId:r}=e,a=r?this.#e(i):i,l=this.buildStepSequence(a,o,t);return o&&l.tail&&l.head&&(l.tail.next=l.head,l.head.prev=l.tail),l}static toArray(e){if(!e)return [];let t=new Set,i=[],o=e;for(;o!==null&&!t.has(o);)t.add(o),i.push(o.val),o=o.next;return i}};var K=class{#e;#t;constructor(e){this.#e=e,this.#t=new x;}initConsumers(){this.#e.store.addObserver(this.#o),this.#e.mode?.addObserver(this.#i);}removeConsumers(){this.#e.store.removeObserver(this.#o),this.#e.mode?.removeObserver(this.#i);}#o=e=>{if(e.type==="STORE_MUTATED"){let{data:t}=e;if(t.size===0)this.#e.panel.hidePanel();else {let i=Object.assign({},t);for(;i.tail;)if(i.tail?.val?.isAuxiliary)i.tail=i.tail?.prev;else {i.tail?.val&&this.#e.panel.setPanelLocation({lat:i.tail.val.lat,lng:i.tail.val.lng});break}}}};#i=e=>{let{store:t}=this.#e,{type:i,data:o}=e;i==="MODE_CHANGED"&&!o&&this.#e.panel.hidePanel(),i==="MODE_CHANGED"&&o&&t.tail?.val&&this.#e.panel.setPanelLocation({lat:t.tail?.val?.lat,lng:t.tail?.val?.lng});};initEvents(){let{panel:e}=this.#e;e._undoButton&&(p.manageEventListener("add",e._undoButton,"click",this.#l),p.manageEventListener("add",e._undoButton,"mouseenter",this.onMouseEnter),p.manageEventListener("add",e._undoButton,"mouseleave",this.onMouseLeave)),e._deleteButton&&(p.manageEventListener("add",e._deleteButton,"click",this.#n),p.manageEventListener("add",e._deleteButton,"mouseenter",this.onMouseEnter),p.manageEventListener("add",e._deleteButton,"mouseleave",this.onMouseLeave)),e._saveButton&&(p.manageEventListener("add",e._saveButton,"click",this.onSaveClick),p.manageEventListener("add",e._saveButton,"mouseenter",this.onMouseEnter),p.manageEventListener("add",e._saveButton,"mouseleave",this.onMouseLeave));}removeEvents(){let{panel:e}=this.#e;e._undoButton&&(p.manageEventListener("remove",e._undoButton,"click",this.#l),p.manageEventListener("remove",e._undoButton,"mouseenter",this.onMouseEnter),p.manageEventListener("remove",e._undoButton,"mouseleave",this.onMouseLeave)),e._deleteButton&&(p.manageEventListener("remove",e._deleteButton,"click",this.#n),p.manageEventListener("remove",e._deleteButton,"mouseenter",this.onMouseEnter),p.manageEventListener("remove",e._deleteButton,"mouseleave",this.onMouseLeave)),e._saveButton&&(p.manageEventListener("remove",e._saveButton,"click",this.onSaveClick),p.manageEventListener("remove",e._saveButton,"mouseenter",this.onMouseEnter),p.manageEventListener("remove",e._saveButton,"mouseleave",this.onMouseLeave));}#r=e=>{let{options:t}=this.#e;return {undo:t.locale.undo,delete:t.locale.delete,save:t.locale.save}[e]};onMouseEnter=e=>{let t=e.target.getAttribute("data-type");if(t){let i=this.#r(t);this.#t.create({label:i,placement:"bottom"}).setPosition(this.#t.getPosition(e,"bottom"));}};onMouseLeave=()=>{this.#t.remove();};#n=e=>{let{tiles:t,mode:i,panel:o,store:r,map:a}=this.#e;r.reset(),o.hidePanel(),i.reset(),this.#t.remove(),t.resetGeometries(),h.removeAllPoints(a,e);};#s=()=>{let{store:e,options:t}=this.#e;if(e.removeNodeById(e.tail?.val?.id),t.pointGeneration==="auto"&&(e.removeNodeById(e.tail?.val?.id),e.tail?.val?.isAuxiliary)){if(e.removeNodeById(e.tail?.val?.id),!u.canBreakClosedGeometry(e,t)){let i=v.createAuxiliaryPoint(e.tail.val,e.head?.val);e.push(i);}e.tail.next=e.head;}};#l=e=>{let{store:t,map:i,tiles:o,options:r}=this.#e;t.size==1&&t.reset(),this.#s(),u.switchToLineModeIfCan(this.#e),this.#t.remove();let a={...t.tail?.val,total:t.size};h.undoPoint(a,i,e),o.render();};onSaveClick=e=>{let{store:t,options:i}=this.#e;h.onSaveClick(this.#e,P.toArray(t.head),e),this.#t.remove(),i.panel.buttons.save.clearOnSave&&this.#n(e);}};var le=(n,e)=>{let t=e.head,i=new Set;for(;t!==null&&!i.has(t);){if(t?.next?.val&&t?.val){let o=n.target,r=m.getPixelCoordinates(o,t.val),a=m.getPixelCoordinates(o,t.next.val),l=m.getPixelCoordinates(o,n.lngLat);if(u.checkIfPointIsOnLine(r,a,l))return t}i.add(t),t=t.next;}return null},he=(n,e)=>{let t=le(n,e);if(t){let i={...n.lngLat,isAuxiliary:!1,id:E()};return e.insert(i,t),i}return null},ye=(n,e)=>{let{store:t,tiles:i}=e;t.tail?.val&&(g.setSinglePointHidden(n),i.render());},ve=n=>m.isFeatureTriggered(n,[s.PointsLayer,s.FirstPointLayer,s.AuxiliaryPointLayer]);var fe=15,$=class{props;#e;#t;constructor(e){this.props=e,this.#e=null,this.#t=S(this.#n,fe);}initBreakEvents=()=>{let{map:e}=this.props;e.on("click",s.LineLayerTransparent,this.#o),e.on("mouseenter",s.LineLayerTransparent,this.#t),e.on("mousemove",s.LineLayerTransparent,this.#t),e.on("mouseleave",s.LineLayerTransparent,this.#s);};removeBreakEvents=()=>{let{map:e}=this.props;e.off("click",s.LineLayerTransparent,this.#o),e.off("mouseenter",s.LineLayerTransparent,this.#t),e.off("mousemove",s.LineLayerTransparent,this.#t),e.off("mouseleave",s.LineLayerTransparent,this.#s);};hideBreakLine=()=>{let{map:e}=this.props;e.getLayoutProperty(s.LineLayerBreak,"visibility")!=="none"&&e.setLayoutProperty(s.LineLayerBreak,"visibility","none");};showBreakLine=()=>{let{map:e}=this.props;e.getLayoutProperty(s.LineLayerBreak,"visibility")!=="visible"&&e.setLayoutProperty(s.LineLayerBreak,"visibility","visible");};#o=()=>{let{store:e,mode:t,map:i,tiles:o,options:r}=this.props;this.#e&&(u.breakGeometry(e,r,this.#e),this.#s(),t.reset(),o.render(),e.notify({type:"STORE_DETACHED",data:null}),h.onLineBreak(i));};#i=e=>{let t=null,i=null;return e?.val?.isAuxiliary?(t=[e?.prev?.val?.lng,e?.prev?.val?.lat],i=[e?.next?.val?.lng,e?.next?.val?.lat]):(t=[e?.val?.lng,e?.val?.lat],i=[e?.next?.next?.val?.lng,e?.next?.next?.val?.lat]),{current:t,next:i}};#r=e=>{let{options:t}=this.props;if(t.pointGeneration==="manual"){let i=[e?.val?.lng,e?.val?.lat],o=[e?.next?.val?.lng,e?.next?.val?.lat];return {current:i,next:o}}return this.#i(e)};#n=e=>{let{map:t,store:i}=this.props,o=le(e,i);o?.val?.id!==this.#e?.val?.id&&(this.#e=o);let r=t.getSource(d.LineSourceBreak),{current:a,next:l}=this.#r(this.#e),L=b.getLine(a,l);L&&(r.setData(L),this.showBreakLine());};#s=()=>{setTimeout(()=>{this.hideBreakLine();},fe+10);}};var be=10,Z=class{#e;#t;#o;#i;#r;#n;#s;constructor(e){this.#e=e,this.#t=e.options.dynamicLine,this.#o=null,this.#i=null,this.#l(),this.#n=S(this.#h,be),this.#s=C(this.#p,10);}#l(){this.#e.store.addObserver(this.#u),this.#e.mode.addObserver(this.#c),this.#e.mouseEvents.addObserver(this.#a);}removeLine=()=>{this.hideDynamicLine();};removeConsumers=()=>{this.#e.store.removeObserver(this.#u),this.#e.mode.removeObserver(this.#c),this.#e.mouseEvents.removeObserver(this.#a);};#a=e=>{let{mode:t}=this.#e;if(!t.getClosedGeometry()&&(e.type==="lastPointMouseClick"&&e.data?(this.hideDynamicLine(),this.#t=!1):e.type==="lastPointMouseClick"&&!e.data&&(this.#t=!0),!!this.#t&&((e.type==="pointMouseEnter"||e.type==="lineMouseEnter")&&e.data&&this.hideDynamicLine(),(e.type==="pointMouseLeave"||e.type==="lineMouseLeave")&&e.data))){let{store:i}=this.#e;this.#o=i.tail?.val,this.#i=i.tail?.val,this.showDynamicLine();}};#p=e=>{let{store:t,options:i}=this.#e;e?.tail?.val&&!u.isClosedGeometry(t,i)&&(this.#o=t.tail?.val,this.showDynamicLine());};#u=e=>{e.type==="STORE_MUTATED"&&(this.#s(e.data),e.data.size||this.hideDynamicLine());};#c=e=>{let{store:t}=this.#e,i=e.data;e.type==="CLOSED_GEOMETRY_CHANGED"&&(i&&this.hideDynamicLine(),!i&&t?.tail?.val&&(this.#o=t?.tail?.val,this.showDynamicLine()));};initDynamicEvents=()=>{let{map:e}=this.#e;e.on("click",this.#y),e.on("mousemove",this.#n),e.on(y.REMOVEALL,this.hideDynamicLine),e.on(y.UNDO,this.#m),e.on(y.DOUBLECLICK,this.#f);};removeEvents=()=>{let{map:e}=this.#e;e.off("click",this.#y),e.off("mousemove",this.#n),e.off(y.REMOVEALL,this.hideDynamicLine),e.off(y.UNDO,this.#m),e.off(y.DOUBLECLICK,this.#f);};hideDynamicLine=()=>{let{map:e}=this.#e;this.#o=null,this.#i=null,this.#r=null,e.off("mousemove",this.#n);let t=e.getSource(d.LineDynamicSource);t&&t.setData(ce),e.setLayoutProperty(s.LineDynamicLayer,"visibility","none");};showDynamicLine=()=>{let{map:e,store:t}=this.#e;if(t.size){let i=[this.#o?.lng,this.#o?.lat],o=[this.#i?.lng,this.#i?.lat];this.#r=b.getLine(i,o),e.setLayoutProperty(s.LineDynamicLayer,"visibility","visible"),this.#i&&this.#d({lng:this.#i?.lng,lat:this.#i?.lat});}e.on("mousemove",this.#n);};#d=e=>{if(!this.#r)return;let{map:t}=this.#e;this.#r.features[0].geometry.coordinates[1]=[e.lng,e.lat];let i=t.getSource(d.LineDynamicSource);i&&i.setData(this.#r);};#h=e=>{this.#d(e.lngLat);};#y=e=>{let{mode:t}=this.#e,i=m.isFeatureTriggered(e,[s.LineLayerTransparent,s.LineLayer]);i&&t.getBreak()&&(this.#i={lng:e.lngLat.lng,lat:e.lngLat.lat}),!i&&this.hideDynamicLine();};#m=e=>{let{store:t,options:i}=this.#e;if(!u.isClosedGeometry(t,i)){let o=e.target.unproject({x:e.originalEvent.x,y:e.originalEvent.y});this.#i={lng:o.lng,lat:o.lat},this.#o=t.tail?.val,this.showDynamicLine();}t.size===0&&this.hideDynamicLine();};#f=e=>{let{store:t,mode:i,options:o}=this.#e;i.getClosedGeometry()||(this.#i={lng:e.coordinates.lng,lat:e.coordinates.lat},this.#o=t.tail?.val,this.showDynamicLine()),t.size===0&&this.hideDynamicLine();}};var Ce=22,W=class{props;#e;#t;constructor(e){this.props=e,this.#e=!1,this.#t=null;}initEvents(){let{map:e}=this.props;e.on("click",s.LineLayerTransparent,this.#o),e.on("mousemove",s.LineLayerTransparent,this.#r),e.on("mouseenter",s.LineLayerTransparent,this.#n),e.on("mouseleave",s.LineLayerTransparent,this.#s);}removeEvents(){let{map:e}=this.props;e.off("click",s.LineLayerTransparent,this.#o),e.off("mousemove",s.LineLayerTransparent,this.#r),e.off("mouseenter",s.LineLayerTransparent,this.#n),e.off("mouseleave",s.LineLayerTransparent,this.#s);}#o=e=>{let{store:t,map:i,mode:o}=this.props;if(ve(e))return;let r=he(e,t);r&&(ye(e,this.props),h.addPoint({...r,total:t.size},i,o));};#i=e=>{if(g.setSinglePointVisible(e),e.target.getLayer(s.SinglePointLayer)){let i=e.target.getSource(d.SinglePointSource);i&&i.setData({type:"Feature",geometry:{type:"Point",coordinates:[e.lngLat.lng,e.lngLat.lat]},properties:{}});}};#r=S(e=>{if(m.isFeatureTriggered(e,[s.PointsLayer,s.FirstPointLayer]))return;let{mouseEvents:t}=this.props;t.pointMouseDown||t.pointMouseEnter||(this.#t=e,!this.#e&&(this.#e=!0,requestAnimationFrame(()=>{this.#t&&(this.#i(this.#t),this.#e=!1);})));},Ce);#n=e=>{let{mouseEvents:t}=this.props;t.pointMouseDown||t.pointMouseEnter||m.isFeatureTriggered(e,[s.PointsLayer,s.FirstPointLayer])||(t.lineMouseEnter=!0,g.setSinglePointVisible(e));};#s=e=>{let{mouseEvents:t}=this.props;t.pointMouseDown||t.pointMouseEnter||(t.lineMouseLeave=!0,g.setSinglePointHidden(e));}};var X=class{props;#e;#t;#o;#i;constructor(e){this.props=e,this.#e=new $(e),this.#t=e.options.pointGeneration==="manual"?new W(e):null,this.#o=null,this.#i="default";}init(){this.#r(),this.#n(),this.#s();}#r=()=>{window.innerWidth<=me||this.props.options.dynamicLine&&(this.#o=new Z(this.props));};#n(){!this.props.mode.getBreak()&&(this.#t?.initEvents(),this.props.options.dynamicLine&&this.#o?.initDynamicEvents());}#s(){this.props.mode.addObserver(this.#u),this.props.mouseEvents.addObserver(this.#p);}remove(){this.#l(),this.#a();}#l(){this.props.mode.removeObserver(this.#u),this.props.mouseEvents.removeObserver(this.#p),this.props.options.dynamicLine&&this.#o?.removeConsumers();}#a(){this.#e.removeBreakEvents(),this.#t?.removeEvents(),this.props.options.dynamicLine&&(this.#o?.removeEvents(),this.#o?.removeLine());}#p=e=>{let{type:t,data:i}=e,{mode:o}=this.props;if(!(!i||!o.getBreak()))switch(t){case"pointMouseDown":this.#e.removeBreakEvents(),this.#e.hideBreakLine();break;case"pointMouseUp":this.#e.initBreakEvents();break;}};#u=e=>{let{type:t,data:i}=e;t==="MODE_CHANGED"&&this.#i==="break"&&(this.#e.removeBreakEvents(),this.#t?.initEvents(),this.#i="default"),t==="BREAK_CHANGED"&&i&&this.#i==="default"&&(this.#t?.removeEvents(),this.#e.initBreakEvents(),this.#i="break");}};var Se=n=>{n.setPaintProperty(s.FirstPointLayer,"circle-radius",T.large),n.setPaintProperty(s.FirstPointLayer,"circle-stroke-color",U.large);},xe=n=>{n.setPaintProperty(s.FirstPointLayer,"circle-radius",T.default),n.setPaintProperty(s.FirstPointLayer,"circle-stroke-color",U.default);},pe=(n,e)=>{e==="large"?Se(n):xe(n);},Le=n=>{n.getLayer(s.LineLayerTransparent)&&n.removeLayer(s.LineLayerTransparent);},Ee=(n,e)=>{if(n.getLayer(s.LineLayerTransparent))return;let i=q(e).find(o=>o.id===s.LineLayerTransparent);i&&n.addLayer(i);};var Q=class{#e;#t;#o;#i;constructor(e,t){this.#t=e,this.#e=!1,this.#i=t,this.#o=new x,this.initLayer();}#r=()=>{let{mode:e,store:t}=this.#t;e.addObserver(this.#a),t.addObserver(this.#p);};#n=()=>{let{mode:e,store:t}=this.#t;e.removeObserver(this.#a),t.removeObserver(this.#p);};initLayer(){let{map:e}=this.#t;e.setLayoutProperty(s.FirstPointLayer,"visibility","visible");}#s=()=>{let{map:e}=this.#t;e.on("mouseenter",s.FirstPointLayer,this.#i.onPointMouseEnter),e.on("mouseleave",s.FirstPointLayer,this.#i.onPointMouseLeave),e.on("mousedown",s.FirstPointLayer,this.#i.onPointMouseDown),e.on("mouseup",s.FirstPointLayer,this.#i.onPointMouseUp),e.on("touchend",s.FirstPointLayer,this.#i.onPointMouseUp),e.on("touchstart",s.FirstPointLayer,this.#i.onPointMouseDown);};initEvents(){let{map:e}=this.#t;e.on("click",s.FirstPointLayer,this.#u),e.on("mouseenter",s.FirstPointLayer,this.#m),e.on("mouseleave",s.FirstPointLayer,this.#h),e.on("mouseup",s.FirstPointLayer,this.#d),e.on("mousedown",s.FirstPointLayer,this.#c),this.#s(),this.#r();}#l=()=>{let{map:e}=this.#t;e.off("mouseenter",s.FirstPointLayer,this.#i.onPointMouseEnter),e.off("mouseleave",s.FirstPointLayer,this.#i.onPointMouseLeave),e.off("mousedown",s.FirstPointLayer,this.#i.onPointMouseDown),e.off("mouseup",s.FirstPointLayer,this.#i.onPointMouseUp),e.off("touchend",s.FirstPointLayer,this.#i.onPointMouseUp),e.off("touchstart",s.FirstPointLayer,this.#i.onPointMouseDown);};removeEvents(){let{map:e}=this.#t;e.off("click",s.FirstPointLayer,this.#u),e.off("mouseenter",s.FirstPointLayer,this.#m),e.off("mouseleave",s.FirstPointLayer,this.#h),e.off("mouseup",s.FirstPointLayer,this.#d),this.#l(),this.#n();}#a=e=>{let{map:t,options:i}=this.#t,{type:o,data:r}=e;o==="MODE_CHANGED"&&(r==="line"&&!i.modes.line.closeGeometry?(g.setFirstPointHidden(t),ae.closedGeometry(t)):(g.setFirstPointVisible(t),ae.default(t)));};#p=C(e=>{let{map:t,store:i,options:o}=this.#t,{type:r}=e;(r==="STORE_MUTATED"||r==="STORE_DETACHED")&&(u.canCloseGeometry(i,o)?pe(t,"large"):pe(t,"default"));},10);#u=()=>{let{store:e,map:t,mode:i,tiles:o,options:r}=this.#t;if(u.canCloseGeometry(e,r)){let a=Object.assign({},e.head?.val,{id:E(),total:e.size});if(r.pointGeneration==="auto"&&e.tail?.val){let l=v.createAuxiliaryPoint(e.tail?.val,a);e.push(l);}u.closeGeometry(e,i),h.addPoint(a,t,i),o.render();}};#c=()=>{this.#e=!0,this.#o.remove();};#d=()=>{this.#e=!1;};#h=()=>{let{mouseEvents:e}=this.#t;this.#e||(e.firstPointMouseLeave=!0,this.#o.remove());};#y=()=>{let{mode:e,options:t}=this.#t;return e.getMode()==="line"&&t.modes.line.closeGeometry?t.locale.closeLine:e.getMode()==="polygon"?t.locale.createPolygon:""};#m=e=>{let{mode:t,mouseEvents:i,store:o,options:r}=this.#t;if(i.firstPointMouseEnter=!0,!(t.getClosedGeometry()||this.#e)&&u.canCloseGeometry(o,r)){let{x:a,y:l}=e.originalEvent;if(a&&l){this.#o.create({label:this.#y(),placement:"bottom"});let M=this.#o._label?this.#o._label.clientWidth/2:0;this.#o.setPosition({x:a-M,y:l+14});}}}};var ee=class{#e;#t;constructor(e,t){this.#e=e,this.#t=t,this.#r();}#o=()=>{let{map:e}=this.#e;e.on("mouseenter",s.AuxiliaryPointLayer,this.#t.onPointMouseEnter),e.on("mouseleave",s.AuxiliaryPointLayer,this.#t.onPointMouseLeave),e.on("mousedown",s.AuxiliaryPointLayer,this.#t.onPointMouseDown),e.on("mouseup",s.AuxiliaryPointLayer,this.#t.onPointMouseUp),e.on("touchend",s.AuxiliaryPointLayer,this.#t.onPointMouseUp),e.on("touchstart",s.AuxiliaryPointLayer,this.#t.onPointMouseDown);};#i=()=>{let{map:e}=this.#e;e.off("mouseenter",s.AuxiliaryPointLayer,this.#t.onPointMouseEnter),e.off("mouseleave",s.AuxiliaryPointLayer,this.#t.onPointMouseLeave),e.off("mousedown",s.AuxiliaryPointLayer,this.#t.onPointMouseDown),e.off("mouseup",s.AuxiliaryPointLayer,this.#t.onPointMouseUp),e.off("touchend",s.AuxiliaryPointLayer,this.#t.onPointMouseUp),e.off("touchstart",s.AuxiliaryPointLayer,this.#t.onPointMouseDown);};#r(){let{map:e}=this.#e;e.on("mousedown",s.AuxiliaryPointLayer,this.#l),e.on("touchstart",s.AuxiliaryPointLayer,this.#l),e.on("mousedown",s.PointsLayer,this.#s),e.on("touchstart",s.PointsLayer,this.#s),this.#o();}removeEvents(){let{map:e}=this.#e;e.off("mousedown",s.AuxiliaryPointLayer,this.#l),e.off("touchstart",s.AuxiliaryPointLayer,this.#l),e.off("mousedown",s.PointsLayer,this.#s),e.off("touchstart",s.PointsLayer,this.#s),this.#i();}#n=e=>{if(!e)return;let{store:t}=this.#e,i=e.next,o=e.prev;if(o){let r=v.createAuxiliaryPoint(o.val,e.val);t.insert(r,o);}if(i){let r=v.createAuxiliaryPoint(e.val,i.val);t.insert(r,e);}};#s=e=>{e.preventDefault();};#l=e=>{let{store:t,tiles:i,map:o}=this.#e;if(e.originalEvent.button===2)return;let r=m.queryPointId(o,e.point),a=t.findNodeById(r);a&&a.val&&(a.val.isAuxiliary=!1,this.#n(a)),i.render();}};var te=class{#e;#t;#o;#i;#r;#n;#s;#l;#a;#p;constructor(e){this.#e=e,this.#t=null,this.#o=null,this.#i=null,this.#r=null,this.#p={onPointMouseEnter:this.#g,onPointMouseLeave:this.#P,onPointMouseDown:this.#E,onPointMouseUp:this.#L,onMapMouseMove:this.#v},this.#n=new Q(this.#e,this.#p),this.#s=new ee(this.#e,this.#p),this.#l=!1,this.#a=null;}#u=()=>{this.#e.mode.addObserver(this.#S),this.#e.store.addObserver(this.#C);};#c=()=>{this.#e.mode.removeObserver(this.#S),this.#e.store.removeObserver(this.#C);};initEvents=()=>{let{map:e}=this.#e;e.on("click",this.#f),e.on("dblclick",this.#d),e.on("mouseenter",s.PointsLayer,this.#g),e.on("mouseleave",s.PointsLayer,this.#P),e.on("mousedown",s.PointsLayer,this.#E),e.on("mouseup",s.PointsLayer,this.#L),e.on("touchend",s.PointsLayer,this.#L),e.on("touchstart",s.PointsLayer,this.#E),this.#n?.initEvents(),this.#u();};removeEvents=()=>{let{map:e}=this.#e;e.off("click",this.#f),e.off("dblclick",this.#d),e.off("mousemove",this.#v),e.off("mouseenter",s.PointsLayer,this.#g),e.off("mouseleave",s.PointsLayer,this.#P),e.off("mousedown",s.PointsLayer,this.#E),e.off("mouseup",s.PointsLayer,this.#L),this.#n?.removeEvents(),this.#s?.removeEvents(),this.#c();};#d=e=>{e.preventDefault();};#h=e=>{let{store:t}=this.#e,i=e?.next,o=e?.prev,r=e?.next?.next,a=e?.prev?.prev;i&&t.removeNodeById(i?.val?.id),o&&t.removeNodeById(o?.val?.id);let l=t.size!==3;if(r&&a&&l){let L=v.createAuxiliaryPoint(r.val,a.val);t.insert(L,a);}};#y=e=>{let{store:t,tiles:i,options:o,mouseEvents:r}=this.#e;if(t.size===1)t.reset();else {let a=m.queryPointId(this.#e.map,e.point),l=t.findNodeById(a);!l?.val?.isAuxiliary&&(t.removeNodeById(a),o.pointGeneration==="auto"&&this.#h(l),u.switchToLineModeIfCan(this.#e),h.pointDoubleClick({...l?.val,total:t.size},this.#e.map),P.isLastPoint(t,o,a)&&(r.lastPointMouseClick=!0,r.lastPointMouseUp=!1));}i.render();};#m=e=>m.isFeatureTriggered(e,[s.PointsLayer,s.FirstPointLayer,s.LineLayerTransparent,s.LineLayerBreak]);#f=e=>{let{mode:t,mouseEvents:i,map:o,options:r,store:a,tiles:l}=this.#e;if(t.getClosedGeometry()||this.#m(e))return;i.lastPointMouseClick&&(i.lastPointMouseClick=!1),o.getCanvasContainer().style.cursor="grab";let L={...e.lngLat,id:E()};if(r.pointGeneration==="auto"&&a?.tail?.val&&a.size>=1){let ge=v.createAuxiliaryPoint(a.tail.val,L);a.push(ge);}let M=v.addPointToMap(e,this.#e);h.addPoint({...M,total:a.size},o,t),g.setSinglePointHidden(e),l.render();};#x=e=>{if(e.originalEvent.buttons===0){this.#e;this.#L();}};#M=e=>{if(!this.#i)return null;let{options:t}=this.#e,i=this.#i?.prev?.prev,o=this.#i?.next?.next;return t.pointGeneration==="auto"?{next:o?v.getMidpoint(o?.val,e.lngLat):null,prev:i?v.getMidpoint(e.lngLat,i?.val):null}:null};#v=S(e=>{let{mouseEvents:t}=this.#e;t.pointMouseDown&&(this.#a=e,requestAnimationFrame(()=>{if(!this.#i||!this.#a)return;let{tiles:i}=this.#e;this.#x(this.#a);let o=this.#M(this.#a);i.renderOnMouseMove(this.#r,e.lngLat,o);}));},17);#g=e=>{let{mouseEvents:t,map:i,store:o,options:r}=this.#e;if(t&&(t.pointMouseEnter=!0,t.pointMouseDown))return;g.setSinglePointHidden(e);let a=m.queryPointId(i,e.point);P.isLastPoint(o,r,a)&&(t.lastPointMouseEnter=!0,t.lastPointMouseLeave=!1);let l=o.findStepById(a);l&&(this.#o=l,h.enterPoint(Object.assign({},l,{total:o.size}),i));};#P=e=>{let{mouseEvents:t,store:i,map:o,options:r}=this.#e;if(t&&(t.pointMouseEnter=!1,e.originalEvent.buttons===0&&(t.pointMouseLeave=!0),t.pointMouseDown))return;let a=m.queryPointId(o,e.point);P.isLastPoint(i,r,a)&&(t.lastPointMouseEnter=!1,t.lastPointMouseLeave=!0),h.leavePoint(Object.assign({},this.#o,{total:i.size}),o);};#b=()=>{this.#i=null,this.#r=null,this.#a=null,this.#t=null,this.#o=null,this.#l=!1;};#C=e=>{e.type==="STORE_MUTATED"&&e.data.size===0&&this.#b();};#S=e=>{(e.type==="BREAK_CHANGED"||e.type==="MODE_CHANGED")&&this.#b();};#O=()=>{let{store:e,panel:t,options:i}=this.#e;!this.#i||!this.#i.val||P.isLastPoint(e,i,this.#i.val.id)&&t.hidePanel();};#T=e=>{let{store:t,map:i}=this.#e,o=m.queryPointId(i,e.point),r=t.findNodeById(o);r&&(this.#i=r);};#E=e=>{this.#a=null;let{mouseEvents:t,map:i,store:o}=this.#e;if(e.originalEvent.button===2){this.#y(e);return}this.#T(e),e.preventDefault(),Le(i),this.#O();let r=m.queryPoint(i,e.point);this.#r=u.getGeometryIndex(o,r?.properties.id),t&&(t.pointMouseDown=!0),this.#t=e.lngLat,i.on("mousemove",this.#v),i.on("touchmove",this.#v);};#w=()=>{if(this.#a&&this.#i&&this.#i.val){this.#i.val.lat=this.#a?.lngLat.lat,this.#i.val.lng=this.#a.lngLat.lng;let e=this.#M(this.#a);e&&(this.#i.prev?.val&&e.prev&&(this.#i.prev.val.lat=e.prev.lat,this.#i.prev.val.lng=e.prev.lng),this.#i.next?.val&&e.next&&(this.#i.next.val.lat=e.next.lat,this.#i.next.val.lng=e.next.lng));}};#L=()=>{let{mouseEvents:e,store:t,panel:i,map:o,options:r}=this.#e;o.off("mousemove",this.#v),o.off("touchmove",this.#v),e.pointMouseUp=!0,this.#i&&this.#i.val&&(this.#a&&(this.#w(),this.#a=null),t.notify({type:"STORE_MUTATED",data:t}),i?.showPanel(),h.movePoint({id:this.#i.val.id,total:t.size,end:{lat:this.#i.val.lat,lng:this.#i.val.lng},start:this.#t},o),this.#r=null,this.#i=null),e&&(e.pointMouseDown=!1),Ee(o,r);}};var ie=class extends I{#e;#t;#o;#i;#r;constructor(e){super({...e}),this.#e=e,this.#t=new K(e),this.#o=new j(e),this.#i=new te(e),this.#r=new X(e),e.map.on("mode:initialize",this.#n),e.map.on("mode:remove",this.#s);}#n=()=>{this.#r.init(),this.#t?.initEvents(),this.#t?.initConsumers(),this.#i?.initEvents();};#s=()=>{this.#t?.removeEvents(),this.#t?.removeConsumers(),this.#i?.removeEvents(),this.#r?.remove();};removeMapEventsAndConsumers=()=>{this.#t?.removeEvents(),this.#i?.removeEvents(),this.#o?.remove(),this.#r?.remove(),this.#e.map.off("mode:initialize",this.#n);}};var oe=class{#e;_line;_polygon;_break;_container;constructor(e){this.#e=e.options,this._line=void 0,this._polygon=void 0,this._break=void 0,this._container=p.create("div","mapboxgl-ctrl mapboxgl-ctrl-group maplibregl-ctrl maplibregl-ctrl-group"),this.createControl(e);}createControlButton=(e,t,i,o)=>{let r=this.#e.panel.size,a=p.create("button",`control-button control-button-${r}`,this._container);return a.setAttribute("aria-label",t),a.setAttribute("data-type",e),i&&a.classList.add("control-button-active"),o&&(a.setAttribute("disabled","true"),a.setAttribute("aria-disabled","true")),p.create("span",`icon ${e} icon-${r}`,a),a};#t=e=>{let{mode:t,options:i}=e,o=this.#e.modes.line.visible,r=i.locale.line;o&&(this._line=this.createControlButton("line",r,t.getMode()==="line"));};#o=e=>{let{mode:t,options:i}=e,o=this.#e.modes.polygon.visible,r=i.locale.polygon;o&&(this._polygon=this.createControlButton("polygon",r,t.getMode()==="polygon"));};#i=e=>{let{mode:t,options:i}=e,o=this.#e.modes.breakGeometry.visible,r=i.locale.break;if(o){let l=!this.#e?.initial?.closeGeometry,L=t.getBreak();this._break=this.createControlButton("break",r,L,l);}};createControl=e=>{this.#t(e),this.#o(e),this.#i(e);};getContainer=()=>this._container};function Oe(n){return n.initial?.geometry?n.initial?.geometry:n.modes.initial?n.modes.initial:null}var ne=class extends O{#e;#t;#o;constructor(e){super(),this.#e=Oe(e),this.#t=!1,this.#o=e.initial?.closeGeometry??!1;}getMode=()=>this.#e;setMode=e=>{this.#e=e,this.setBreak(!1),this.notify({type:"MODE_CHANGED",data:e});};getBreak=()=>this.#t;setBreak=e=>{this.#t=e,this.notify({type:"BREAK_CHANGED",data:e});};getClosedGeometry=()=>this.#o;setClosedGeometry=e=>{this.#o=e,this.notify({type:"CLOSED_GEOMETRY_CHANGED",data:this.#o});};isPolygon=()=>this.#e==="polygon"&&this.getClosedGeometry();reset=()=>{this.setMode(this.getMode()),this.setClosedGeometry(!1);};pingConsumers=()=>{this.notify({type:"MODE_CHANGED",data:this.getMode()}),this.notify({type:"CLOSED_GEOMETRY_CHANGED",data:this.getClosedGeometry()});}};var se=class{#e;#t;constructor(e){this.#e=e,this.#t=this.#e.map.getCanvasContainer(),this.#t.style.cursor=e.mode.getMode()?f.CROSSHAIR:f.AUTO,this.#o();}set=e=>{this.#t.style.cursor=e;};get=()=>this.#t.style.cursor;handleMouseLeave=C(()=>{let{mouseEvents:e,mode:t}=this.#e;if(!e.pointMouseDown){if(!t.getMode()){this.set(f.AUTO);return}t.getClosedGeometry()?this.set(f.AUTO):this.set(f.CROSSHAIR);}},10);handleFirstPointMouseEnter=C(()=>{let{store:e,options:t}=this.#e;u.canCloseGeometry(e,t)&&this.set(f.POINTER);},10);#o(){let{mouseEvents:e}=this.#e;e.addObserver(this.#i);}removeConsumers(){let{mouseEvents:e}=this.#e;e.removeObserver(this.#i);}#i=e=>{let{mode:t,mouseEvents:i,store:o,options:r}=this.#e;if(t.getBreak())return;let{type:a,data:l}=e;if(l)switch(a){case"pointMouseDown":this.set(f.GRABBING);break;case"pointMouseUp":this.set(f.GRAB);break;case"pointMouseEnter":if(i.pointMouseDown)return;this.set(f.GRAB);break;case"pointMouseLeave":this.handleMouseLeave();break;case"lineMouseEnter":if(i.pointMouseDown)return;this.set(f.POINTER);break;case"lineMouseLeave":this.handleMouseLeave();break;case"firstPointMouseEnter":this.handleFirstPointMouseEnter();break;case"firstPointMouseLeave":this.handleMouseLeave();break;case"lastPointMouseEnter":u.isClosedGeometry(o,r)||this.set(f.POINTER);break;case"lastPointMouseLeave":this.handleMouseLeave();break;}}};var re=class extends O{#e;#t;#o;#i;#r;#n;#s;#l;#a;#p;#u;#c;constructor(){super(),this.#e=!1,this.#t=!1,this.#o=!1,this.#i=!1,this.#r=!1,this.#n=!1,this.#s=!1,this.#l=!1,this.#a=!1,this.#p=!1,this.#u=!1,this.#c=!1;}get firstPointMouseEnter(){return this.#e}set firstPointMouseEnter(e){this.#e=e,this.notify({type:"firstPointMouseEnter",data:e});}get firstPointMouseLeave(){return this.#t}set firstPointMouseLeave(e){this.#t=e,this.notify({type:"firstPointMouseLeave",data:e});}get lastPointMouseClick(){return this.#o}set lastPointMouseClick(e){this.#o=e,this.notify({type:"lastPointMouseClick",data:e});}get lastPointMouseUp(){return this.#i}set lastPointMouseUp(e){this.#i=e,this.notify({type:"lastPointMouseUp",data:e});}get lastPointMouseEnter(){return this.#r}set lastPointMouseEnter(e){this.#r=e,this.notify({type:"lastPointMouseEnter",data:e});}get lastPointMouseLeave(){return this.#n}set lastPointMouseLeave(e){this.#n=e,this.notify({type:"lastPointMouseLeave",data:e});}get pointMouseDown(){return this.#s}set pointMouseDown(e){this.#s=e,this.notify({type:"pointMouseDown",data:e});}get pointMouseUp(){return this.#l}set pointMouseUp(e){this.#l=e,this.notify({type:"pointMouseUp",data:e});}get pointMouseEnter(){return this.#a}set pointMouseEnter(e){this.#a=e,this.notify({type:"pointMouseEnter",data:e});}get pointMouseLeave(){return this.#p}set pointMouseLeave(e){this.#p=e,this.notify({type:"pointMouseLeave",data:e});}get lineMouseEnter(){return this.#u}set lineMouseEnter(e){this.#u=e,this.notify({type:"lineMouseEnter",data:e});}get lineMouseLeave(){return this.#c}set lineMouseLeave(e){this.#c=e,this.notify({type:"lineMouseLeave",data:e});}};var F=class{static allStepsHaveIds(e){return e.every(t=>"id"in t&&t.id!==void 0)}static checkIfMissingIds(e,t){let i=!t,o=!this.allStepsHaveIds(e);if(i&&o)throw new Error(N.MISSING_IDS)}static checkIfEnoughPointsToClose(e,t){if(t&&e.length<3)throw new Error(N.NOT_ENOUGH_POINTS_TO_CLOSE)}static checkIfPolygonIsClosed(e){let{closeGeometry:t,steps:i}=e;if(i){let o=i[0]?.lng,r=i[i.length-1]?.lng,a=i[0]?.lat,l=i[i.length-1]?.lat;if((o!==r||a!==l)&&t)throw new Error(N.FIRST_LAST_POINT_NOT_EQUAL)}}static checkInitialStepsOption(e){let{closeGeometry:t,generateId:i,steps:o}=e;this.checkIfMissingIds(o,i),this.checkIfEnoughPointsToClose(o,t),this.checkIfPolygonIsClosed(e);}static init(e){return e?{pointGeneration:e.pointGeneration??c.pointGeneration,panel:Te(e),modes:we(e),layersPaint:ke(e),initial:e.initial||c.initial,locale:Ae(e),dynamicLine:e.dynamicLine??c.dynamicLine}:c}};function Te(n){return {size:n.panel?.size||c.panel.size,buttons:{undo:{visible:n.panel?.buttons?.undo?.visible??c.panel.buttons.undo.visible},delete:{visible:n.panel?.buttons?.delete?.visible??c.panel.buttons.delete.visible},save:{visible:n.panel?.buttons?.save?.visible??c.panel.buttons.save.visible,clearOnSave:n.panel?.buttons?.save?.clearOnSave??c.panel.buttons.save.clearOnSave}}}}function we(n){return {initial:n.modes?.initial||c.modes.initial,line:{visible:n?.modes?.line?.visible!==void 0?n.modes.line.visible:n?.initial?.geometry==="line"||c.modes.line.visible,closeGeometry:n?.modes?.line?.closeGeometry??c.modes.line.closeGeometry},polygon:{visible:n?.modes?.polygon?.visible!==void 0?n.modes.polygon.visible:n?.initial?.geometry==="polygon"||c.modes.polygon.visible},breakGeometry:{visible:n?.modes?.breakGeometry?.visible??c.modes.breakGeometry.visible}}}function ke(n){return {onLinePoint:{"circle-radius":n.layersPaint?.onLinePoint?.["circle-radius"]||k["circle-radius"],"circle-color":n.layersPaint?.onLinePoint?.["circle-color"]||k["circle-color"],"circle-stroke-color":n.layersPaint?.onLinePoint?.["circle-stroke-color"]||k["circle-stroke-color"],"circle-stroke-width":n.layersPaint?.onLinePoint?.["circle-stroke-width"]||k["circle-stroke-width"],...n.layersPaint?.onLinePoint},firstPoint:{"circle-radius":n.layersPaint?.firstPoint?.["circle-radius"]||w["circle-radius"],"circle-color":n.layersPaint?.firstPoint?.["circle-color"]||w["circle-color"],"circle-stroke-color":n.layersPaint?.firstPoint?.["circle-stroke-color"]||w["circle-stroke-color"],"circle-stroke-width":n.layersPaint?.firstPoint?.["circle-stroke-width"]||w["circle-stroke-width"],...n.layersPaint?.firstPoint},points:{"circle-radius":n.layersPaint?.points?.["circle-radius"]||A["circle-radius"],"circle-color":n.layersPaint?.points?.["circle-color"]||A["circle-color"],"circle-stroke-color":n.layersPaint?.points?.["circle-stroke-color"]||A["circle-stroke-color"],"circle-stroke-width":n.layersPaint?.points?.["circle-stroke-width"]||A["circle-stroke-width"],...n.layersPaint?.points},auxiliaryPoint:{"circle-radius":n.layersPaint?.auxiliaryPoint?.["circle-radius"]||B["circle-radius"],"circle-color":n.layersPaint?.auxiliaryPoint?.["circle-color"]||B["circle-color"],"circle-stroke-color":n.layersPaint?.auxiliaryPoint?.["circle-stroke-color"]||B["circle-stroke-color"],"circle-stroke-width":n.layersPaint?.auxiliaryPoint?.["circle-stroke-width"]||B["circle-stroke-width"],...n.layersPaint?.auxiliaryPoint},line:{"line-width":n.layersPaint?.line?.["line-width"]||D["line-width"],"line-color":n.layersPaint?.line?.["line-color"]||D["line-color"],"line-opacity":n.layersPaint?.line?.["line-opacity"]||D["line-opacity"],...n.layersPaint?.line},polygon:{"fill-color":n.layersPaint?.polygon?.["fill-color"]||R["fill-color"],"fill-opacity":n.layersPaint?.polygon?.["fill-opacity"]||R["fill-opacity"],...n.layersPaint?.polygon},breakLine:{"line-width":n.layersPaint?.breakLine?.["line-width"]||_["line-width"],"line-color":n.layersPaint?.breakLine?.["line-color"]||_["line-color"],"line-dasharray":n.layersPaint?.breakLine?.["line-dasharray"]||_["line-dasharray"],...n.layersPaint?.breakLine}}}function Ae(n){return {save:n.locale?.save??c.locale.save,delete:n.locale?.delete??c.locale.delete,undo:n.locale?.undo??c.locale.undo,line:n.locale?.line??c.locale.line,polygon:n.locale?.polygon??c.locale.polygon,break:n.locale?.break??c.locale.break,closeLine:n.locale?.closeLine??c.locale.closeLine,createPolygon:n.locale?.createPolygon??c.locale.createPolygon}}var ue=class n{#e;#t;#o;#i;#r;#n;#s;#l;#a;static#p=null;static#u=!1;constructor(e){if(this.#i=F.init(e),this.#i.initial&&F.checkInitialStepsOption(this.#i.initial),n.#u)throw new Error("Use 'DrawLibre.getInstance()' instead of 'new DrawLibre()'.");n.#u=!0,this.#t=void 0,this.#o=void 0,this.#r=void 0,this.#n=void 0,this.#s=void 0,this.#a=void 0,this.#l=void 0;}static getInstance(e){return n.#p||(n.#p=new n(e)),n.#p}onAdd=e=>{this.#t=new G(this.#i),this.#o=new ne(this.#i),this.#s=new H({map:e,mode:this.#o,options:this.#i,store:this.#t}),this.#n=new I({map:e,store:this.#t,options:this.#i,mode:this.#o});let t=new oe({options:this.#i,mode:this.#o});return this.#a=new re,this.#l=new se({map:e,mode:this.#o,mouseEvents:this.#a,store:this.#t,options:this.#i}),this.#r=new ie({map:e,store:this.#t,options:this.#i,panel:this.#s,control:t,mode:this.#o,tiles:this.#n,mouseEvents:this.#a}),this.#o.getMode()&&e.fire("mode:initialize"),this.#o.pingConsumers(),this.#t.pingConsumers(),this.#e=t.getContainer(),this.#e};onRemove=()=>{this.#l?.removeConsumers(),this.#n?.removeTiles(),this.#r?.removeMapEventsAndConsumers(),this.#s?.removePanel(),this.#t?.reset(),this.#o?.unsubscribe(),this.#e&&p.remove(this.#e);};setSteps=e=>{if(Array.isArray(e))for(let t of e){let i={...t,id:t.id||E()};this.#t?.push(i);}else throw new Error("Invalid argument. Expected an array of steps.");this.#n?.render();};findStepById=e=>this.#t?.findStepById(e);findNodeById=e=>this.#t?.findNodeById(e);getAllSteps=(e="array")=>{if(e==="array"&&this.#t)return P.toArray(this.#t.head);if(e==="linkedlist")return this.#t;throw new Error("Invalid type specified. Use 'array' or 'linkedlist'.")};setOptions=e=>{this.#i=e(this.#i);};removeAllSteps=()=>{this.#t?.reset(),this.#s?.removePanel(),this.#n?.render();}};
|
|
2
2
|
|
|
3
|
-
export {
|
|
3
|
+
export { ue as default };
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
|
5
5
|
//# sourceMappingURL=index.js.map
|