maplibre-gl-components 0.16.2 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -3
- package/dist/{ControlGrid-DQ4w_Nf9.js → ControlGrid-C6zp03Vq.js} +125375 -115454
- package/dist/ControlGrid-DIAcXRBe.cjs +17278 -0
- package/dist/DuckDBConverter-5a2FWwmf.js +354 -0
- package/dist/DuckDBConverter-pfXSUi_l.cjs +23 -0
- package/dist/ShapefileConverter-DGCXPY_S.cjs +1 -0
- package/dist/ShapefileConverter-DN3fVOuo.js +102 -0
- package/dist/basedecoder-BliCKuUS.js +62 -0
- package/dist/basedecoder-Zw0CbD9L.cjs +1 -0
- package/dist/deflate-DBL0msKQ.js +10 -0
- package/dist/deflate-DNeBKDsy.cjs +1 -0
- package/dist/esm-Bp6m44bk.js +811 -0
- package/dist/esm-oEp_aN1n.cjs +1 -0
- package/dist/geojson-Bnoe76Pm.js +2002 -0
- package/dist/geojson-CxMdRvJX.cjs +1 -0
- package/dist/geotiff-Bzy-Zyc2.js +1882 -0
- package/dist/geotiff-DYylEFA9.cjs +8 -0
- package/dist/globals-B4iCNAg9.cjs +1 -0
- package/dist/globals-BKIWameS.js +572 -0
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +150 -147
- package/dist/jpeg-B6Sg6W8k.cjs +1 -0
- package/dist/jpeg-CJcNvScS.js +545 -0
- package/dist/lerc-2QwcA_K7.js +840 -0
- package/dist/lerc-DQRITnja.cjs +1 -0
- package/dist/lib-B4jvG7hB.cjs +4 -0
- package/dist/lib-CNQtqzfc.js +4060 -0
- package/dist/lzw-1HaU0PJK.cjs +1 -0
- package/dist/lzw-DF5VHuii.js +76 -0
- package/dist/main-dist-CbHNdsir.js +18314 -0
- package/dist/main-dist-DOx_Axbx.cjs +2 -0
- package/dist/maplibre-geoman.es-C0F1ydoG.cjs +213 -0
- package/dist/maplibre-geoman.es-D1CztSQd.js +27213 -0
- package/dist/maplibre-gl-components.css +2 -1
- package/dist/packbits-CK8RPU_B.js +22 -0
- package/dist/packbits-D5Zovac7.cjs +1 -0
- package/dist/pako.esm-DFyPB7cO.cjs +1 -0
- package/dist/pako.esm-hTfpTBhd.js +1536 -0
- package/dist/raw-Brljg6vy.js +9 -0
- package/dist/raw-C-CSxCoU.cjs +1 -0
- package/dist/react.cjs +1 -1
- package/dist/react.mjs +1357 -1004
- package/dist/{types → src}/lib/core/CogLayer.d.ts.map +1 -1
- package/dist/{types → src}/lib/core/PMTilesLayer.d.ts.map +1 -1
- package/dist/{types → src}/lib/core/SpinGlobeControl.d.ts +6 -7
- package/dist/src/lib/core/SpinGlobeControl.d.ts.map +1 -0
- package/dist/{types → src}/lib/core/StacLayer.d.ts.map +1 -1
- package/dist/{types → src}/lib/core/types.d.ts +3 -1
- package/dist/{types → src}/lib/core/types.d.ts.map +1 -1
- package/dist/{types → src}/lib/utils/color.d.ts +8 -0
- package/dist/src/lib/utils/color.d.ts.map +1 -0
- package/dist/{types → src}/lib/utils/index.d.ts +1 -1
- package/dist/{types → src}/lib/utils/index.d.ts.map +1 -1
- package/dist/webimage-Bh2pNwjN.cjs +1 -0
- package/dist/webimage-rg-Z9Sbn.js +25 -0
- package/dist/zstd-B3Xa90HD.cjs +1 -0
- package/dist/zstd-BwwN0X3K.js +51 -0
- package/package.json +66 -53
- package/dist/ControlGrid-Bukna_at.cjs +0 -17062
- package/dist/DuckDBConverter-B98M0DFs.cjs +0 -23
- package/dist/DuckDBConverter-RPq48-t0.js +0 -434
- package/dist/ShapefileConverter-AjbEjEyq.cjs +0 -1
- package/dist/ShapefileConverter-trvt8J3z.js +0 -125
- package/dist/decoder-CLokFc0V.js +0 -8
- package/dist/decoder-D9LU4bUo.cjs +0 -1
- package/dist/deflate-Bay-vzHJ.cjs +0 -1
- package/dist/deflate-yeu3ogBn.js +0 -10
- package/dist/geojson-BQSVgKFt.cjs +0 -1
- package/dist/geojson-BSUuDj5k.js +0 -2551
- package/dist/geotiff-BNxc90fm.cjs +0 -8
- package/dist/geotiff-BUZniE5g.js +0 -3105
- package/dist/index-8ZZtuDTp.js +0 -705
- package/dist/index-DQXdX5y1.js +0 -4666
- package/dist/index-Dh1kpCb6.cjs +0 -1
- package/dist/index-IrsIiQNM.cjs +0 -4
- package/dist/jpeg-B7yImnpY.js +0 -533
- package/dist/jpeg-BiN8bMT5.cjs +0 -1
- package/dist/lerc-BvSjGMM2.cjs +0 -1
- package/dist/lerc-CqgA9njy.js +0 -1031
- package/dist/lzw-C-_B7Jis.cjs +0 -1
- package/dist/lzw-DL9RcHOz.js +0 -84
- package/dist/main-dist-Bymiy5aM.cjs +0 -2
- package/dist/main-dist-Cv8AKwrY.js +0 -629
- package/dist/maplibre-geoman.es-Bxdg-2EU.cjs +0 -129
- package/dist/maplibre-geoman.es-CFgM2ajb.js +0 -22827
- package/dist/packbits-DRGSjtn-.cjs +0 -1
- package/dist/packbits-YEJGULcy.js +0 -24
- package/dist/pako.esm-Bx5X36Wo.js +0 -1074
- package/dist/pako.esm-DZC2QrbJ.cjs +0 -1
- package/dist/raw-CoQHiEnn.js +0 -9
- package/dist/raw-D6OidBKc.cjs +0 -1
- package/dist/types/lib/core/SpinGlobeControl.d.ts.map +0 -1
- package/dist/types/lib/utils/color.d.ts.map +0 -1
- package/dist/webimage-BXLN-zu8.js +0 -19
- package/dist/webimage-mWTez3Wv.cjs +0 -1
- /package/dist/{types → src}/index.d.ts +0 -0
- /package/dist/{types → src}/index.d.ts.map +0 -0
- /package/dist/{types → src}/lib/adapters/AddVectorAdapter.d.ts +0 -0
- /package/dist/{types → src}/lib/adapters/AddVectorAdapter.d.ts.map +0 -0
- /package/dist/{types → src}/lib/adapters/CogLayerAdapter.d.ts +0 -0
- /package/dist/{types → src}/lib/adapters/CogLayerAdapter.d.ts.map +0 -0
- /package/dist/{types → src}/lib/adapters/PMTilesLayerAdapter.d.ts +0 -0
- /package/dist/{types → src}/lib/adapters/PMTilesLayerAdapter.d.ts.map +0 -0
- /package/dist/{types → src}/lib/adapters/StacLayerAdapter.d.ts +0 -0
- /package/dist/{types → src}/lib/adapters/StacLayerAdapter.d.ts.map +0 -0
- /package/dist/{types → src}/lib/adapters/ZarrLayerAdapter.d.ts +0 -0
- /package/dist/{types → src}/lib/adapters/ZarrLayerAdapter.d.ts.map +0 -0
- /package/dist/{types → src}/lib/adapters/index.d.ts +0 -0
- /package/dist/{types → src}/lib/adapters/index.d.ts.map +0 -0
- /package/dist/{types → src}/lib/addControlGrid.d.ts +0 -0
- /package/dist/{types → src}/lib/addControlGrid.d.ts.map +0 -0
- /package/dist/{types → src}/lib/colormaps/diverging.d.ts +0 -0
- /package/dist/{types → src}/lib/colormaps/diverging.d.ts.map +0 -0
- /package/dist/{types → src}/lib/colormaps/index.d.ts +0 -0
- /package/dist/{types → src}/lib/colormaps/index.d.ts.map +0 -0
- /package/dist/{types → src}/lib/colormaps/misc.d.ts +0 -0
- /package/dist/{types → src}/lib/colormaps/misc.d.ts.map +0 -0
- /package/dist/{types → src}/lib/colormaps/sequential.d.ts +0 -0
- /package/dist/{types → src}/lib/colormaps/sequential.d.ts.map +0 -0
- /package/dist/{types → src}/lib/converters/DuckDBConverter.d.ts +0 -0
- /package/dist/{types → src}/lib/converters/DuckDBConverter.d.ts.map +0 -0
- /package/dist/{types → src}/lib/converters/ShapefileConverter.d.ts +0 -0
- /package/dist/{types → src}/lib/converters/ShapefileConverter.d.ts.map +0 -0
- /package/dist/{types → src}/lib/converters/index.d.ts +0 -0
- /package/dist/{types → src}/lib/converters/index.d.ts.map +0 -0
- /package/dist/{types → src}/lib/converters/types.d.ts +0 -0
- /package/dist/{types → src}/lib/converters/types.d.ts.map +0 -0
- /package/dist/{types → src}/lib/core/AddVector.d.ts +0 -0
- /package/dist/{types → src}/lib/core/AddVector.d.ts.map +0 -0
- /package/dist/{types → src}/lib/core/Basemap.d.ts +0 -0
- /package/dist/{types → src}/lib/core/Basemap.d.ts.map +0 -0
- /package/dist/{types → src}/lib/core/BasemapReact.d.ts +0 -0
- /package/dist/{types → src}/lib/core/BasemapReact.d.ts.map +0 -0
- /package/dist/{types → src}/lib/core/BookmarkControl.d.ts +0 -0
- /package/dist/{types → src}/lib/core/BookmarkControl.d.ts.map +0 -0
- /package/dist/{types → src}/lib/core/ChoroplethControl.d.ts +0 -0
- /package/dist/{types → src}/lib/core/ChoroplethControl.d.ts.map +0 -0
- /package/dist/{types → src}/lib/core/CogLayer.d.ts +0 -0
- /package/dist/{types → src}/lib/core/CogLayerReact.d.ts +0 -0
- /package/dist/{types → src}/lib/core/CogLayerReact.d.ts.map +0 -0
- /package/dist/{types → src}/lib/core/Colorbar.d.ts +0 -0
- /package/dist/{types → src}/lib/core/Colorbar.d.ts.map +0 -0
- /package/dist/{types → src}/lib/core/ColorbarGuiControl.d.ts +0 -0
- /package/dist/{types → src}/lib/core/ColorbarGuiControl.d.ts.map +0 -0
- /package/dist/{types → src}/lib/core/ColorbarReact.d.ts +0 -0
- /package/dist/{types → src}/lib/core/ColorbarReact.d.ts.map +0 -0
- /package/dist/{types → src}/lib/core/ControlGrid.d.ts +0 -0
- /package/dist/{types → src}/lib/core/ControlGrid.d.ts.map +0 -0
- /package/dist/{types → src}/lib/core/ControlGridReact.d.ts +0 -0
- /package/dist/{types → src}/lib/core/ControlGridReact.d.ts.map +0 -0
- /package/dist/{types → src}/lib/core/HtmlControl.d.ts +0 -0
- /package/dist/{types → src}/lib/core/HtmlControl.d.ts.map +0 -0
- /package/dist/{types → src}/lib/core/HtmlControlReact.d.ts +0 -0
- /package/dist/{types → src}/lib/core/HtmlControlReact.d.ts.map +0 -0
- /package/dist/{types → src}/lib/core/HtmlGuiControl.d.ts +0 -0
- /package/dist/{types → src}/lib/core/HtmlGuiControl.d.ts.map +0 -0
- /package/dist/{types → src}/lib/core/InspectControl.d.ts +0 -0
- /package/dist/{types → src}/lib/core/InspectControl.d.ts.map +0 -0
- /package/dist/{types → src}/lib/core/InspectControlReact.d.ts +0 -0
- /package/dist/{types → src}/lib/core/InspectControlReact.d.ts.map +0 -0
- /package/dist/{types → src}/lib/core/Legend.d.ts +0 -0
- /package/dist/{types → src}/lib/core/Legend.d.ts.map +0 -0
- /package/dist/{types → src}/lib/core/LegendGuiControl.d.ts +0 -0
- /package/dist/{types → src}/lib/core/LegendGuiControl.d.ts.map +0 -0
- /package/dist/{types → src}/lib/core/LegendReact.d.ts +0 -0
- /package/dist/{types → src}/lib/core/LegendReact.d.ts.map +0 -0
- /package/dist/{types → src}/lib/core/MeasureControl.d.ts +0 -0
- /package/dist/{types → src}/lib/core/MeasureControl.d.ts.map +0 -0
- /package/dist/{types → src}/lib/core/MinimapControl.d.ts +0 -0
- /package/dist/{types → src}/lib/core/MinimapControl.d.ts.map +0 -0
- /package/dist/{types → src}/lib/core/MinimapControlReact.d.ts +0 -0
- /package/dist/{types → src}/lib/core/MinimapControlReact.d.ts.map +0 -0
- /package/dist/{types → src}/lib/core/PMTilesLayer.d.ts +0 -0
- /package/dist/{types → src}/lib/core/PrintControl.d.ts +0 -0
- /package/dist/{types → src}/lib/core/PrintControl.d.ts.map +0 -0
- /package/dist/{types → src}/lib/core/SearchControl.d.ts +0 -0
- /package/dist/{types → src}/lib/core/SearchControl.d.ts.map +0 -0
- /package/dist/{types → src}/lib/core/SearchControlReact.d.ts +0 -0
- /package/dist/{types → src}/lib/core/SearchControlReact.d.ts.map +0 -0
- /package/dist/{types → src}/lib/core/StacLayer.d.ts +0 -0
- /package/dist/{types → src}/lib/core/StacSearch.d.ts +0 -0
- /package/dist/{types → src}/lib/core/StacSearch.d.ts.map +0 -0
- /package/dist/{types → src}/lib/core/Terrain.d.ts +0 -0
- /package/dist/{types → src}/lib/core/Terrain.d.ts.map +0 -0
- /package/dist/{types → src}/lib/core/TerrainReact.d.ts +0 -0
- /package/dist/{types → src}/lib/core/TerrainReact.d.ts.map +0 -0
- /package/dist/{types → src}/lib/core/TileLayerControl.d.ts +0 -0
- /package/dist/{types → src}/lib/core/TileLayerControl.d.ts.map +0 -0
- /package/dist/{types → src}/lib/core/VectorDataset.d.ts +0 -0
- /package/dist/{types → src}/lib/core/VectorDataset.d.ts.map +0 -0
- /package/dist/{types → src}/lib/core/VectorDatasetReact.d.ts +0 -0
- /package/dist/{types → src}/lib/core/VectorDatasetReact.d.ts.map +0 -0
- /package/dist/{types → src}/lib/core/ViewStateControl.d.ts +0 -0
- /package/dist/{types → src}/lib/core/ViewStateControl.d.ts.map +0 -0
- /package/dist/{types → src}/lib/core/ViewStateControlReact.d.ts +0 -0
- /package/dist/{types → src}/lib/core/ViewStateControlReact.d.ts.map +0 -0
- /package/dist/{types → src}/lib/core/ZarrLayer.d.ts +0 -0
- /package/dist/{types → src}/lib/core/ZarrLayer.d.ts.map +0 -0
- /package/dist/{types → src}/lib/hooks/index.d.ts +0 -0
- /package/dist/{types → src}/lib/hooks/index.d.ts.map +0 -0
- /package/dist/{types → src}/lib/hooks/useBasemap.d.ts +0 -0
- /package/dist/{types → src}/lib/hooks/useBasemap.d.ts.map +0 -0
- /package/dist/{types → src}/lib/hooks/useCogLayer.d.ts +0 -0
- /package/dist/{types → src}/lib/hooks/useCogLayer.d.ts.map +0 -0
- /package/dist/{types → src}/lib/hooks/useColorbar.d.ts +0 -0
- /package/dist/{types → src}/lib/hooks/useColorbar.d.ts.map +0 -0
- /package/dist/{types → src}/lib/hooks/useControlGrid.d.ts +0 -0
- /package/dist/{types → src}/lib/hooks/useControlGrid.d.ts.map +0 -0
- /package/dist/{types → src}/lib/hooks/useHtmlControl.d.ts +0 -0
- /package/dist/{types → src}/lib/hooks/useHtmlControl.d.ts.map +0 -0
- /package/dist/{types → src}/lib/hooks/useInspectControl.d.ts +0 -0
- /package/dist/{types → src}/lib/hooks/useInspectControl.d.ts.map +0 -0
- /package/dist/{types → src}/lib/hooks/useLegend.d.ts +0 -0
- /package/dist/{types → src}/lib/hooks/useLegend.d.ts.map +0 -0
- /package/dist/{types → src}/lib/hooks/useMinimapControl.d.ts +0 -0
- /package/dist/{types → src}/lib/hooks/useMinimapControl.d.ts.map +0 -0
- /package/dist/{types → src}/lib/hooks/useSearchControl.d.ts +0 -0
- /package/dist/{types → src}/lib/hooks/useSearchControl.d.ts.map +0 -0
- /package/dist/{types → src}/lib/hooks/useTerrain.d.ts +0 -0
- /package/dist/{types → src}/lib/hooks/useTerrain.d.ts.map +0 -0
- /package/dist/{types → src}/lib/hooks/useVectorDataset.d.ts +0 -0
- /package/dist/{types → src}/lib/hooks/useVectorDataset.d.ts.map +0 -0
- /package/dist/{types → src}/lib/hooks/useViewState.d.ts +0 -0
- /package/dist/{types → src}/lib/hooks/useViewState.d.ts.map +0 -0
- /package/dist/{types → src}/lib/utils/fileHelpers.d.ts +0 -0
- /package/dist/{types → src}/lib/utils/fileHelpers.d.ts.map +0 -0
- /package/dist/{types → src}/lib/utils/helpers.d.ts +0 -0
- /package/dist/{types → src}/lib/utils/helpers.d.ts.map +0 -0
- /package/dist/{types → src}/lib/utils/providers.d.ts +0 -0
- /package/dist/{types → src}/lib/utils/providers.d.ts.map +0 -0
- /package/dist/{types → src}/react.d.ts +0 -0
- /package/dist/{types → src}/react.d.ts.map +0 -0
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
const gm=require("./ControlGrid-DIAcXRBe.cjs");let Gs=require("maplibre-gl");Gs=gm.__toESM(Gs,1);var dm="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAABhGlDQ1BJQ0MgcHJvZmlsZQAAKJF9kT1Iw0AYht+mLYpUHOwgopChOtlFRRxrFYpQIdQKrTqYXPoHTRqSFBdHwbXg4M9i1cHFWVcHV0EQ/AFxdnBSdJESv0sKLWK847iH97735e47QGhWmWaFEoCm22YmlRRz+VWx5xUhmmGMIi4zy5iTpDR8x9c9Any/i/Ms/7o/R79asBgQEIkTzDBt4g3imU3b4LxPHGVlWSU+J54w6YLEj1xXPH7jXHJZ4JlRM5uZJ44Si6UuVrqYlU2NeJo4pmo65Qs5j1XOW5y1ap2178lfGCnoK8tcpzWCFBaxBAkiFNRRQRU24rTrpFjI0HnSxz/s+iVyKeSqgJFjATVokF0/+B/87q1VnJr0kiJJIPziOB9jQM8u0Go4zvex47ROgOAzcKV3/LUmMPtJeqOjxY6AgW3g4rqjKXvA5Q4w9GTIpuxKQVpCsQi8n9E35YHBW6Bvzetb+xynD0CWepW+AQ4OgfESZa/7vLu3u2//1rT79wN2rHKoBaSKHQAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAAN1wAADdcBQiibeAAAAAd0SU1FB+gEBAUlKJesuC4AABWbSURBVHja7Z3fcxTHEce/t1ohYekA2QaBDBgocGLHNmW7Kg4pV9l5SeUleci/4b9H/0aeU3mJXXEF5yEmEOw4hgKFH7JBtpEQwhLS3eVhunV9w+7tHWh3e2Z7q64OyZJ18+Mz3+7pme4W7Bn6tBdXWwD4lYj3FMA0gCkAswCOAJihrw8AOAfgdwDOAmgDmKDf3YunB6ADYB3AdQB/BnANwEMAWwA2ANwH8Ii+3gSwA6BLv8vvvfWPD/VslPOflnVBLhQQYKQCiEl6zQCYB/AigGMA3gBwGMB+guQQgFfpfZKg2sunC2AbwCqA/9H7FoCfAKwA+ArAtwB+BHCPoNmmFwOzw6AAgMFigIyrFhMChgMERJu+PkJQHCNI5un7qfi9F+i9VUJf88TeBvCY3js06TcIih8Jkq9IUTZIde6R2myI3zNVMUBGAiOlST1NrwMAjgM4BeAtAUKbIJklxZim35WAJSXB4UPSlROcINkkRXlEcKwLcP4NYAnAHQJlk17bUlUMlIYDkgHGPpr8BwEcJWVYAPA2AXKcwGAza0ooRiL6s1Vx//Yy3rtCUbaEebVOYCwBuAJgmZTmOwBrBNETA6XBgAwBYw7ACYLhbYLjRYLlIP3MpOest2oAYhxgep5zvk0QrBEUPxIkVwia2wAeGCgNBGQEME4DeIcAOUHm1bRwztMaVWIv1WVHOOubZGbdJkAuAbhpoDQIELErlRSAcZq+nhNqMeEpReh91vOUpSNU5QGBcbMAlG5Tdr1aDYGjRROdYxZFYOzzHO4Y+8o3w3YIgCJQOLbSaYKatBoAR0JKsB/Ay2Q+nRkRjKaYoL0RQblBZtj3cPGWbQDdmCFpRQyGVI0DcFuybwL4FVx0+6SBMRYot+Ci9p8DuAq3dfwwdjVpRQxHCheoO0xKcY7geJNgaRsYY4GyTlBcJUiukbKswAUqd2KEpBUhHBM06WfgotznAVwgQE6TmbWffiYxMEYCpUsA/ETm1U0C5CKAy3DR+g36mU5MkLQiAsM3qeYJjg/pfZ6+P4X+wUEDYzxQOmRSPYSLyF8G8Cm934vR5GpFBEeWSXWB4DiGwXNSMDieCRJg8LzXtwTHxVhNrlZEcMzCRb59k+owgZOaauypmuwQCCsZJtcy3HZw8JCkEcHxCoB3AXxkJlUli2oqVHmGFqIZsRDdZUjai6vBBhXTwOHgo+gMx2/ofcEzqQyMvYfEP7YzhcGjOCBINgBshwpJGigciYBjwYPjFQFHYnCUDgovQKzi/rMsIAkuqJgGCscU+kfSz5NZxXDMmr9ROSS8YPmQsLrwUfqt0CBpBQrHS+SE/xzArwmSBYNDjfP+iJTjMoC/A/ianPgf4LaBg4GkFRAcLbjI9xyA1wH8Fu6G31m4yLjtVOmC5DFc5P063A3GvwD4D9yxlScIZHcrCQgO9jmOknK8Re9Hvd0Tg6N+5z0tGKtJAC1xDcEAeU44UuGQnyez6iz6x0ZsG1cfJBPon6A+65nCuwuadkiSQODIinMcMTiCgeTIsM0UzZCkyjvZh0PGOV4wOILwbydorBbQP67Cz24wMeO/GSAF6iE71o9z2G5VWJDIhc536u8A2Ggvrqp02lPFcEzBHV+wOEeckPBu1xYrSHtxVd1R+UQhHGxaHYA7bHghy7kzOIL0SfzNlgs0xge0+iOpwo7kTpyHCwaew2BaT4MjfCXxx3eFlKSrzR9RoyCe33EsZ4Wxs1XhQ5LkWAjHeONFk4okiuBIPL+DbwIexuCRdXvCh2SiYKwTLZAkSuDgSHnuqmJwRAlJnrWgJtKuxcSSAaU8v8Oe+CDJ8kdkALjZCuKZVi+jn7dqYGcDcWY19EsX5L3kz8YGiL9jyWmZXtZiaqVKVpFZuIyHfgfFYlrllSfojdFPdZZXqMIf4QVyDS5Dyjr6JRt6jQMk4wj7GfSPrquR2D2Cwi9BwAEyruxUpPI8ieROntbSC89rYp+luXAHlGurvbjaqiuAmNa8erANegIuV+5JuIyHIZtWWdnT/SI2G/DS4xT0Eacz4qPiecV7QuwzGR9p0xx4By5TCt8dqU1FagEkQz1O02uOvhdivMNP18n1N7LKoN2HuzwkA2S9HLOKt0NfR7+Sblb5t0mEm0aV2+rPh9t1q0haY4f46nEi0F2rvITPsoJTViHNFfTTdfZG6KcryC8gKitghZpvOGtO1K4ilQMygnqEMqhFJQOWMFgD0C/FvAWvDPOQnZ4HBJQsQX0VT9dQDLmUQ968qFVFUiUrRWjqIZ3tvFoaS/S1rCK74znrow42A8WmyAO4JNJchfc6ATKs5kkSCCSqVKRSQCJQDz+J8yMUly3z65Dv7nCNuhpSv3VF32yLv79GCnWL/nZW1Sz2VbRfMFOnIqmCFSIU9cjKSbsEV3WpsPDlOED4j/i9ngcM1xfMUjEG5Qypi8xRDOWQqFGRyjpJRM33w12a+RDAH+HO4cyhX15Zs0nVwWDOp4tk3txCTRVhCyr3noSLK8g7NbN4uq67tofLVT+gfv4TXJmFu3A1SirLq1W1giRkNx8lxzIE9fDriy8D+ALAJzR4XIqsllLJ9Hd6BMq25xc9FDtn/Nn44tmkYkh8FXkbwH8hEs/FaGLxsYJpsfuye3JT6UCxv8G1xLlozCcEyTKZW9vsY9QV8c0AhQOUm56pt4N+5vtp6DzO45/wXqA5M00K3qnKzKoEkIwj7bLBE8rh4AyBN5BdA6MDRak0BShyQ+GugGMD7tTsGfQzUmqFJGtBXYNLhF2Js55W2FiWzOMkmUep8YlSOLq0+t4H8E8AnwH4BoFUUVr/+FCvvbjKO2eP4M42bdFnfw3ABwDeo3HYr9Tc8k3ya7RjV5mzXvrkzEjEcIpeB5WaV9LneEjK8RmAfwD4EoMFK1Xnl2U1wWDJtC+pLZ9R2x5KE1GpmXVQzJtKEzykFa8E83B5Wo8rdc6lWbJBPsc1Uo5lAKu0CgdTyTXD5OLP/Q21ja+5tqHvZLBvebwFd4btB1KRbhUTt8qVoE2QtBWrh5++/yKZVWuhwZEBCgc416hNmTUFlapILXOnKvtfVoSSW4xanXJ/K3clZDhyIFlB9o5cB/puL9Y2f0r9IxnZ2Y8oVQ/2O4ZOnBjqfgtIhi0EmvwRX0WOoMLs8GlFELL/8QY1cEqZgkjTaikA02OvTcmsBWxS0QLG92L4mP9VuMOapQcNkwro5+uiL8LdX9CWW5cd1ydwRxtuwB0fuS9NjhjUI2N3S8Z5rlPbdytAKVkU/DIYfAemkpwFpQGSUd+j0oY9w2q6AXfQ7xLc2ard7c+Y4PAgkdvZt6jtuydnlZlZuQttmWZW2QriS+M8dAUHffW4icGTo1HCkQFJXvs1pRuqxVSvwsRi+/Yw9CWgzlIPjSto0/ugVTCXggSEG8WX8aehKzBYpB69mNUjwx8JQUUYkmkMJvcI1sSqvEGmHtGrSKULbimAZMQ/KpPEMdVjGy6qvESvRqnHEBXh/lhD/1CgFkgy51RZjnpSMnwyp9Nh6Ip/8Gnd7+CyjzRVPfJU5Ar1zSYqvKCkbU6V7YNwinttDro8cvEjXLCMt3UbpR4ZKsLbvpyuiFOk1t0nWVZJ6XdZkhIbw///FP00mZrMK44kf0sTYRM6zyHVsXBsop/wTp4k0GRmyVzFKGtuVXWaV5NzzubVFlwE+Su4Y+2aTAkNpuc99LNBbinqmxaeznYflpM+RFG0rJJsSqzDS2rQRPMqw8xiX4TzCWty1CudU0lD54LMUsLJ3Uw9rH8aD0hIK6RKhW1aHzVRQeS9D78EgT3WR40HRB7zXjH/o9AP4Qwujdzha6KJxSskV31qamBwlL6SfdT1+tAAacAE6JrvUeiLdJvcP4lNAnusjwwQe+wxQOyxxwCxp+qnZYDY4NuT3TeVnXkyQHROAG2HKLX1T2WnZg0QXYqh8Ri+iifnNqjWGiIGSEmQZF7kqiKdfkDzQvNtUAPEBl+FeaU1XVN0gGhLhKw9mbYW51xjuqZK51RSUUO0HekIoRyDBgXRmq6psiMwScl0azwUWGs6/QAddG2VwCo9RJmU3JDMY+UKQNGeM7juvtFYrqKWY/hlNlrrpZu8rPOaS1JX2Tey9LK2chWVz6lSAMm5dKMtjaVMp881uCebamYNqWWvqVxF7pwq67JbUlGDNtGvSqrFWfdrcJ+Azsq7VTvmM9QX2mrZS+f8Cc2p0hfcJLYGPYOjLmtwz9GuTaNURKjHPuoD7g9ttewrX3CrUpANhY66v2K+02AV0d4XtZnsZQOiOTuGv2qeplejVCRDPZ7qByWLRS1zqTRAAsnSZyoSRh/Ulg0zqYh8rVn6ilbPJGYVobYlAahHbfMoqZN8xSpyEv1t3yghEXDwtu5J5epRiyVSlYJoztLnq8gZAGfhIsi79yBigkT4HXzs/wi1+Yxi9ahlDpUKSEDZwmVk/RSACwDOwwXLZiP0R2R7F6itF6jt2tpbazb+pMIVQHO2cDY3+J7IeQAfAXiXJtALACZiUBFqAyvHArXxI2qzvBujqa21zZ+0xhVgjuzfnpLB8CeOVL/d08jtxdVOqDl8BRxDFwKF6lGbBVKlgoRQ0SnP9DgNF1WeClVJPDgOUptCMCVrrXhVuoKsf3yo115czasJOKtsxeLPMUE7OfMAzgF4Da48MuBKI2+1F1c7CCAjvOeQMxwL1KZz1MYZMQ7aqoHl1kysou+TihuaWVUW+kp7ye3PMwA+APA+gF/AHQEP4oJVxgWoY9SG96lNZyC2s6G3VF5tVXerPKXp1yW/A711yRmSabgt0PcA/B7AHwD8EsBxYZKojJOIOAebjMfps/+B2vIetW0aOpPDSd/jDmqq216Fky7NrG0yUZbo9aqYaD1lgySd9qPIrve+DHerbbu9uNrVYHIJ1WAVzNqtmifl0HpJTKqHnC9rqLiWfVrzivAzAC9Bb9odhmQ/nk40x6bLfTIBngDYoYWgclAEGPy59hEERzJ2q2aUmlXqLI7KAPFURNqUGp31PJ+kDeAVz66/DuAWOfEbVYOSA8YM3Db6SbgIub9bNaEcDt85H/BZq1x80pobzrsSh6ArJpIHSUvY85z04QaASwBuAridBwovEnsIBYaAcQJuG/cdcsRPoZ9CVHsCuDznfBM11ElMa+gAua/9Je2qvAz92Q1bos/YD2kTLKcJkCxQtmlguwQLxgXGA0ICO4F+fi8fjNP09RxBLe+Wa47jqHDOawEksJhIHiS+E+xPTgZliUB5SO3jK8d8TVQCM46C8c7UNL0O0N8+lQHGDClLijDKGKhxzutUkDz78qByMyvPL8kzb5Zo9WMT4Z5QlG0MJtPrFQDJGwSTAsp59DOyvE2AZIHRQlhpVVWFA1IlnXCWBnsf+kkCEAAkLRq0LFBepV069rX4mMQG3HmiUe5V+1kO2+jnFH4D/ZxeR2mBCRkMVc55bYAMiYmcFLZ9L6CBzQNlFm4Le4vMybcIDD50599r6OWolMxEz2lSOWUq+xbT4m+HCIY657xuBZGO2G2y2eVVz8kABzgLlCka3IO0EcHm1QaZRY9HVBAZpGQzi2Mycss25Az1/pyo1TmvFRChIk9ot+cmvU4EqiJ5oMidpin084TN0YTvjDD4/P+Y8pxtP+N6yHdVWD14PtTunNetILGqiA8KPFh4kCUw4+5iIRIoiubCbSg4q1db3EFcx/VV5AF9T9sp371QlUS8UmGKDXtNCuVIEF/h0cJ5UOf5tlThyhGTihSpC2BVrdSqR60K0kAVsScw9agdkBBWEHuaPfa1A2IqYuqhVT20KIipiKmH2jFXAYipiKmHRvXQpCCmIqYeKsdaDSCmIqYe2tRDm4KYiph6qBtjVYCMoCJdgyR4OLqhqIdGBclbYW7BHRXXVFfEnmczrXZoLG+FYCGoAyRDRW7AZQ65D+AnuBOw9oT5dGgM79OY3tCsHkD9Z7GKVOQR3LHnz9G/Mcf5nEK4Y23PoGm1BeB7AFdpTJcgcu1q/OAqs4jQShJkh9oz8oJ3lcZ2C0BXaxLwRHnHDpNkc9jDdMyDMpnVAuKVb5NOnTns4TvmA2OouYSEagURppY57HE65l3t9VXSADrYHHZzzE1BnsFhvwm9RXjsCdgxDwqQHKm+Ri8ztcwxN0CEw85JxW5mrUimIuaYN1ZBLDZijrkBsgedb5DUrh6dmBaxoAApiI2Yw67HtMo1g0NSjyAVpCA2UpTr1p5yAeFT2Pdi2UhJAx8M3kK8iH5cZIL+HVP2wVBMq8dwpR4u05gMbMWHph6h+iC+w75CA/IpvQ8rKWBPOXAUjkWIcAQLiICkcNUySCrxO+T2+0Uai29pbDqhwhE0IDHbvYE9WQFcLjcXvD8YNCDerpYFEOszrbKOAAUVEIxVQaSpZWe16jWt/IWpEzocUQBSIPVmall/GyAjntWqrRBkhOpRqNgxqEdUCjLCsXi7gbh3plVU0fJhTxrhIGZJ/2G4moBc+swCiM8OSKN2DWPyQfJMraf25U1Fnsu0ii5a3hhAMkytvMiuQfLsfkd00fJGASIgGbbamT/yfH5HVNHypvkgRfay+SN704/RRMsbpyCeP7Jj/khpfkcU0fJGAuKZWuaPlON3dGKGI3pAzB8xv8N8EPNHzO8wBTF/xPwOA8T8EfM7DJAA/JGm3h/hAGvj/Y7GAjKifd1poNPeE+rReL+j0YAU+CPLaGaWRpklZrnpfkfTFSTPH/kEwBc0QZrktEuzc5n64JMm+x3ySdHQZ/3jQ7324qqcGJxHK4Xb+uVt3wnEu/070kLRVDgaDUiOaZHCJZ07TO8MSYwFeoY55U01Nc3EyvFHRnFOe5HBMdJmRZPVo/GACEiGraSxQeLDkeeUd5sOhwEymtN+NzJzQ5qVd80pNx/keZx2floAjiP8pNhZO1Z/NafcAHnW1ZXhiGFnq0kqaSZWyU57oX0e2EQa2c8y9TBAxoUk9J2tkdtjcBgg40ASw86W7VgZIKVCMqrN3lMOh+1YmZNeDiRDdrYA4BUAs6IfW8rhsB0rA6SUyebvbOVB0lL6mSUctmNlgOy5imAIJNpiJMNiHQNwmHoYIGVDoi1GMrLfZHCYk16G0645RmKxDgNEHSRaYiQW6zBAVEGiKUZisQ4DRCUkGmIkFuswJ121415njMRiHQaI+mecGMleQlIEh8U6DBA1KoKKIRkLDlMPA6RJkBgcBohBYnAYIAbJeJAYHAaIQWJwGCAGyXiQGBwGiEGSA4nBYYAYJDmQGBwGiEGSAwkMDgPEIBkOicFhgBgkGZDM0L83DA4DxCDpP1xi4Sh9/R2ASwaHAdJkSPjuRgJgEv167QBwFcDfAPwLdhuw1sfug9QAiXDCH8Pd+Psa7v7GHXpdpu/do58xOGp6/g9eQPkxBqxc0wAAAABJRU5ErkJggg==",yu;try{yu=null}catch{yu=typeof process<"u"&&process.env.VITE_GEOMAN_VERSION||null}var se="_gm",st=yu==="pro",Rf={draw:{marker:{type:"draw",eventType:"toggle",targetMode:"marker",settings:{exclusive:!0}},circle_marker:{type:"draw",eventType:"toggle",targetMode:"circle_marker",settings:{exclusive:!0}},text_marker:{type:"draw",eventType:"toggle",targetMode:"text_marker",settings:{exclusive:!0}},circle:{type:"draw",eventType:"toggle",targetMode:"circle",settings:{exclusive:!0}},ellipse:{type:"draw",eventType:"toggle",targetMode:"ellipse",settings:{exclusive:!0}},line:{type:"draw",eventType:"toggle",targetMode:"line",settings:{exclusive:!0}},rectangle:{type:"draw",eventType:"toggle",targetMode:"rectangle",settings:{exclusive:!0}},polygon:{type:"draw",eventType:"toggle",targetMode:"polygon",settings:{exclusive:!0}},freehand:{type:"draw",eventType:"toggle",targetMode:"freehand",settings:{exclusive:!0}},custom_shape:{type:"draw",eventType:"toggle",targetMode:"custom_shape",settings:{exclusive:!0}}},edit:{drag:{type:"edit",eventType:"toggle",targetMode:"drag",settings:{exclusive:!0}},change:{type:"edit",eventType:"toggle",targetMode:"change",settings:{exclusive:!0}},rotate:{type:"edit",eventType:"toggle",targetMode:"rotate",settings:{exclusive:!0}},scale:{type:"edit",eventType:"toggle",targetMode:"scale",settings:{exclusive:!0}},copy:{type:"edit",eventType:"toggle",targetMode:"copy",settings:{exclusive:!0}},cut:{type:"edit",eventType:"toggle",targetMode:"cut",settings:{exclusive:!0}},split:{type:"edit",eventType:"toggle",targetMode:"split",settings:{exclusive:!0}},union:{type:"edit",eventType:"toggle",targetMode:"union",settings:{exclusive:!0}},difference:{type:"edit",eventType:"toggle",targetMode:"difference",settings:{exclusive:!0}},line_simplification:{type:"edit",eventType:"toggle",targetMode:"line_simplification",settings:{exclusive:!0}},lasso:{type:"edit",eventType:"toggle",targetMode:"lasso",settings:{exclusive:!0}},delete:{type:"edit",eventType:"toggle",targetMode:"delete",settings:{exclusive:!0}}},helper:{shape_markers:{type:"helper",eventType:"toggle",targetMode:"shape_markers",settings:{exclusive:!1,enabledBy:["change","rotate","scale","line_simplification"]}},snapping:{type:"helper",eventType:"toggle",targetMode:"snapping",settings:{exclusive:!1}},pin:{type:"helper",eventType:"toggle",targetMode:"pin",settings:{exclusive:!1}},snap_guides:{type:"helper",eventType:"toggle",targetMode:"snap_guides",settings:{exclusive:!1}},measurements:{type:"helper",eventType:"toggle",targetMode:"measurements",settings:{exclusive:!1}},auto_trace:{type:"helper",eventType:"toggle",targetMode:"auto_trace",settings:{exclusive:!1}},geofencing:{type:"helper",eventType:"toggle",targetMode:"geofencing",settings:{exclusive:!1}},zoom_to_features:{type:"helper",eventType:"click",targetMode:"zoom_to_features",settings:{exclusive:!1}},click_to_edit:{type:"helper",eventType:"toggle",targetMode:"click_to_edit",settings:{exclusive:!1}}}},pm=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
|
|
2
|
+
<path fill="currentColor"
|
|
3
|
+
d="m22.775 29.562 6.75-6.75-5.625-5.625-3.6 3.6-3.15-3.15 3.6-3.6-5.626-5.55-6.75 6.75zm25.95 26.101 6.75-6.825-5.624-5.625-3.6 3.6-3.15-3.15 3.6-3.6-5.55-5.55-6.75 6.75zm.6-46.126 5.25 5.25ZM16.7 59.039H5v-11.7l14.55-14.551L2 15.237l13.05-13.2 17.7 17.624L46.1 6.312q.676-.676 1.5-.976.826-.3 1.65-.3.826 0 1.65.3.826.3 1.5.976l5.326 5.325q.675.675.975 1.5.3.825.3 1.65t-.3 1.65q-.3.825-.975 1.5l-13.35 13.35L62 48.913l-13.125 13.05-17.551-17.55Zm-7.2-4.5h5.25l29.476-29.552-5.25-5.25L9.5 49.288Zm32.1-32.178-2.625-2.625 5.25 5.25Z"/>
|
|
4
|
+
</svg>`,Df=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
|
|
5
|
+
<path fill="none" d="M0 0h24v24H0Z"/>
|
|
6
|
+
<circle cx="32" cy="32" r="26" fill="currentColor" fill-opacity=".15" stroke="currentColor" stroke-width="7"/>
|
|
7
|
+
<circle cx="32" cy="32" r="5" fill="currentColor"/>
|
|
8
|
+
</svg>`,wt={marker:`<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 64 64">
|
|
9
|
+
<path d="M32 62.81s23.107-21.898 23.107-38.512a23.107 23.107 0 0 0-46.214 0C8.893 40.912 32 62.809 32 62.809m0-26.958a11.554 11.554 0 1 1 0-23.107 11.554 11.554 0 0 1 0 23.107"/>
|
|
10
|
+
</svg>
|
|
11
|
+
`,circle:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
|
|
12
|
+
<path fill="none" d="M0 0h24v24H0Z"/>
|
|
13
|
+
<circle cx="32" cy="32" r="26" fill="currentColor" fill-opacity=".15" stroke="currentColor" stroke-width="7"/>
|
|
14
|
+
<path stroke="currentColor" stroke-dasharray="3" stroke-width="4" d="M6 32h52M32 6v52"/>
|
|
15
|
+
</svg>`,ellipse:`<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
16
|
+
<svg
|
|
17
|
+
viewBox="0 0 64 64"
|
|
18
|
+
version="1.1"
|
|
19
|
+
id="svg2"
|
|
20
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
21
|
+
>
|
|
22
|
+
<defs
|
|
23
|
+
id="defs2" />
|
|
24
|
+
<path
|
|
25
|
+
fill="none"
|
|
26
|
+
d="M 0,0 H 24 V 24 H 0 Z"
|
|
27
|
+
id="path1"
|
|
28
|
+
style="display:inline" />
|
|
29
|
+
<ellipse
|
|
30
|
+
cx="32"
|
|
31
|
+
cy="32"
|
|
32
|
+
fill="currentColor"
|
|
33
|
+
fill-opacity="0.15"
|
|
34
|
+
stroke="currentColor"
|
|
35
|
+
stroke-width="7"
|
|
36
|
+
id="circle1"
|
|
37
|
+
rx="26.787416"
|
|
38
|
+
ry="15.158148" />
|
|
39
|
+
<path
|
|
40
|
+
stroke="currentColor"
|
|
41
|
+
stroke-dasharray="3"
|
|
42
|
+
stroke-width="4"
|
|
43
|
+
d="M 6.4966994,32 H 58 M 32,18.552705 v 30.15073"
|
|
44
|
+
id="path2"
|
|
45
|
+
style="stroke-width:3;stroke-dasharray:3;stroke-dashoffset:0" />
|
|
46
|
+
</svg>
|
|
47
|
+
`,circle_marker:Df,text_marker:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
|
|
48
|
+
<path fill="none" d="M0 0h24v24H0Z"/>
|
|
49
|
+
<path fill="currentColor"
|
|
50
|
+
d="M6.962 3.385h50.076a3.577 3.577 0 0 1 3.577 3.577v50.076a3.577 3.577 0 0 1-3.577 3.577H6.962a3.577 3.577 0 0 1-3.577-3.577V6.962a3.577 3.577 0 0 1 3.577-3.577Zm3.577 7.154v42.922h42.922V10.539Zm7.154 7.154h28.614v7.153H17.693Zm0 14.307h28.614v7.154H17.693Z"/>
|
|
51
|
+
</svg>
|
|
52
|
+
`,line:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
|
|
53
|
+
<line x1="8" y1="50" x2="24" y2="20" stroke="currentColor" stroke-width="8"/>
|
|
54
|
+
<line x1="24" y1="20" x2="40" y2="54" stroke="currentColor" stroke-width="8"/>
|
|
55
|
+
<line x1="40" y1="54" x2="54" y2="10" stroke="currentColor" stroke-width="8"/>
|
|
56
|
+
<circle cx="8" cy="50" r="6" fill="white" stroke="currentColor" stroke-width="4.5"/>
|
|
57
|
+
<circle cx="24" cy="20" r="6" fill="white" stroke="currentColor" stroke-width="4.5"/>
|
|
58
|
+
<circle cx="40" cy="54" r="6" fill="white" stroke="currentColor" stroke-width="4.5"/>
|
|
59
|
+
<circle cx="54" cy="10" r="6" fill="white" stroke="currentColor" stroke-width="4.5"/>
|
|
60
|
+
</svg>
|
|
61
|
+
`,rectangle:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
|
|
62
|
+
<!-- Rectangle -->
|
|
63
|
+
<polygon points="10,10 54,10 54,54 10,54" fill="none" stroke="currentColor" stroke-width="8"/>
|
|
64
|
+
|
|
65
|
+
<!-- Vertex Circles -->
|
|
66
|
+
<circle cx="10" cy="10" r="6" fill="white" stroke="currentColor" stroke-width="4.5"/>
|
|
67
|
+
<circle cx="54" cy="10" r="6" fill="white" stroke="currentColor" stroke-width="4.5"/>
|
|
68
|
+
<circle cx="54" cy="54" r="6" fill="white" stroke="currentColor" stroke-width="4.5"/>
|
|
69
|
+
<circle cx="10" cy="54" r="6" fill="white" stroke="currentColor" stroke-width="4.5"/>
|
|
70
|
+
</svg>
|
|
71
|
+
`,polygon:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
|
|
72
|
+
<!-- Polygon -->
|
|
73
|
+
<polygon points="8,28 40,6 55,35 51,55 18,54" fill="none" stroke="currentColor" stroke-width="8"/>
|
|
74
|
+
|
|
75
|
+
<!-- Vertex Circles -->
|
|
76
|
+
<circle cx="9" cy="28" r="6" fill="white" stroke="currentColor" stroke-width="4.5"/>
|
|
77
|
+
<circle cx="40" cy="8" r="6" fill="white" stroke="currentColor" stroke-width="4.5"/>
|
|
78
|
+
<circle cx="55" cy="35" r="6" fill="white" stroke="currentColor" stroke-width="4.5"/>
|
|
79
|
+
<circle cx="50" cy="55" r="6" fill="white" stroke="currentColor" stroke-width="4.5"/>
|
|
80
|
+
<circle cx="18" cy="54" r="6" fill="white" stroke="currentColor" stroke-width="4.5"/>
|
|
81
|
+
</svg>
|
|
82
|
+
`,freehand:`<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 64 64">
|
|
83
|
+
<path d="M44.698 2.661a1.644 1.644 0 0 1 2.328 0l9.866 9.866a1.644 1.644 0 0 1 0 2.329L24.004 47.744a1.644 1.644 0 0 1-.552.362L7.008 54.683a1.644 1.644 0 0 1-2.138-2.138l6.578-16.444a1.644 1.644 0 0 1 .362-.552zm-3.089 7.742 7.542 7.541 4.252-4.252-7.541-7.541zm5.216 9.866-7.54-7.54-21.378 21.376v.964h1.644a1.644 1.644 0 0 1 1.645 1.644v1.645h1.644a1.644 1.644 0 0 1 1.645 1.644v1.644h.963zM14.724 37.29l-.35.348L9.35 50.204l12.566-5.025.349-.35a1.644 1.644 0 0 1-1.07-1.538v-1.645h-1.644a1.644 1.644 0 0 1-1.644-1.644v-1.644h-1.644a1.644 1.644 0 0 1-1.54-1.07"/>
|
|
84
|
+
<path stroke="currentColor" stroke-width="5.107"
|
|
85
|
+
d="M6.298 59.53c3.44-1.692 6.88-3.384 10.558-4.319s7.594-1.111 11.719-.298c4.125.814 8.459 2.617 13.483 2.655 5.023.038 10.737-1.689 16.45-3.415"/>
|
|
86
|
+
</svg>
|
|
87
|
+
`,custom_shape:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
|
|
88
|
+
<circle cx="49.754" cy="50.219" r="10.098" fill="none" stroke="currentColor" stroke-width="5.1"/>
|
|
89
|
+
<path fill="none" stroke="currentColor" stroke-linejoin="round" stroke-width="4.491"
|
|
90
|
+
d="M44.516 26.657H17.842l6.669-11.55 6.668-11.55 6.669 11.55Z"/>
|
|
91
|
+
<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="6"
|
|
92
|
+
stroke-width="4.683" d="M4.481 40.605h20.761v19.093H4.481z"/>
|
|
93
|
+
</svg>
|
|
94
|
+
`,drag:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
|
|
95
|
+
<path
|
|
96
|
+
fill="currentColor"
|
|
97
|
+
d="M32 61.4 19.85 49.42l3.28-3.235 6.634 6.542V34.205H10.98l6.26 6.174-3.279 3.234L2.185 32l11.852-11.686 3.28 3.234-6.336 6.247h18.783V11.273l-6.261 6.174-3.28-3.234L32 2.6l11.777 11.613-3.28 3.234-6.26-6.174v18.522h18.782l-6.26-6.174 3.279-3.234L61.815 32 50.038 43.613l-3.28-3.234 6.261-6.174H34.236v18.522l6.634-6.542 3.28 3.234z"
|
|
98
|
+
/>
|
|
99
|
+
</svg>
|
|
100
|
+
`,change:pm,rotate:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
|
|
101
|
+
<path fill="currentColor"
|
|
102
|
+
d="M58.709 17.724c-.3-.6-.601-.901-.902-1.502l-.3-.601c-.301-.601-.602-.902-.902-1.503l-.3-.601c-.301-.601-.602-.902-1.203-1.503l-.6-.901 8.414-9.317-13.825.3-13.824.301 1.502 13.524 1.503 13.524 9.617-10.819v.3l.3.602c.301.3.301.6.602.6l.3.602c0 .6 0 .901.3 1.202.903 2.104 1.804 4.208 2.105 6.311.6 4.208 0 8.716-1.804 12.623l-.6 1.202-.301.3-.902 1.503-.3.601c-.601.601-1.202 1.503-1.804 2.104-1.502 1.503-3.305 3.005-5.109 3.907-1.803 1.202-3.907 1.803-6.311 2.404-2.104.301-4.508.601-6.612.301-2.404-.3-4.508-.902-6.612-1.503-2.103-.901-3.907-2.104-5.71-3.606l-1.202-1.202-.601-.902-.601-.601c-.3-.3-.601-.601-.601-.902l-.902-1.202-.3-.3-.602-1.203c0-.3-.3-.3-.3-.6l-.902-1.503-.3-.601-.902-2.705q-.901-3.607-.901-7.213V27.04c0-.601 0-.901.3-1.202l.3-1.803.602-1.803c.901-2.405 2.103-4.509 3.606-6.612q2.254-3.156 5.41-5.41c.6-.3.901-1.202.3-1.803-.3-.3-.6-.601-.901-.601h-.601l-.3.3c-2.706 1.202-4.81 3.006-6.913 4.809-2.104 2.104-3.607 4.508-5.11 7.213-2.704 5.41-3.606 11.42-2.404 17.431.3 1.503.601 2.705.902 4.207l.902 2.405c.3.3.6.6.6 1.202l.602 1.202c0 .3.3.601.3.601l.902 1.503c.3.601.6.901.901 1.503l.301.6c.3.301.601.902.902 1.203l2.103 1.803c2.104 2.104 4.809 3.907 7.514 5.41q4.057 2.254 9.016 2.705c1.503.3 3.005.3 4.508.3 1.803 0 3.306 0 4.809-.3 3.005-.602 6.311-1.503 9.016-3.006l.6-.3c.602-.3.903-.601 1.504-.902l2.103-1.202c.601-.3.902-.601 1.203-.902l.6-.6a3.622 3.622 0 0 0 1.503-1.504l.3-.3c.902-.902 2.105-2.104 2.706-3.005l1.803-2.705 1.202-1.804c3.005-5.71 4.208-12.322 3.306-18.633-.601-3.306-1.503-6.612-3.005-9.317z"/>
|
|
103
|
+
</svg>
|
|
104
|
+
`,scale:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
|
|
105
|
+
<g fill="currentColor" stroke="currentColor">
|
|
106
|
+
<path d="m37.62 5.028-.337.284-4.039 4.068 3.547 3.523L39.875 9.8l2.846.596 1.025-4.893-4.176-.877Zm9.995 6.393 9.787 2.053 1.026-4.895-9.787-2.05zm14.68 3.078 9.787 2.05 1.025-4.892-9.787-2.053zm-39.623 5.522 3.547 3.523 7.049-7.094-3.547-3.523zm-10.57 10.642 3.546 3.524 7.047-7.094-3.547-3.524zM1.529 41.306l3.55 3.523 7.046-7.096-3.547-3.523Zm70.977 4.027 3.91 3.115 3.44-4.387-1.118-6.55zM.947 48.319l5.617 8.274 4.137-2.809-5.617-8.273Zm62.211 8.744 3.91 3.116 6.233-7.82-3.91-3.116zM9.373 60.73l5.62 8.272 4.134-2.809-5.617-8.271zm44.438 8.067 3.91 3.115 6.232-7.82-3.91-3.117zM17.8 73.138l5.617 8.273 4.137-2.808-5.617-8.274zm26.662 7.388 3.91 3.116 6.232-7.82-3.91-3.116zm-18.236 5.022 5.617 8.273 4.136-2.81-5.617-8.272zm8.888 6.709 3.91 3.117 6.233-7.822-3.91-3.115z"
|
|
107
|
+
stroke-width="3"
|
|
108
|
+
transform="translate(2.517 1.586) scale(.60827)"/>
|
|
109
|
+
<path d="M22.672 20.02a3.5 3.5 0 0 0-2.506 1.034L-.514 41.872a3.5 3.5 0 0 0-.412 4.434L18 74.176a3.5 3.5 0 0 0 5.633.216l33.494-42.038a3.5 3.5 0 0 0-2.018-5.605l-31.742-6.654a3.5 3.5 0 0 0-.695-.074zm1.121 7.317 24.32 5.098-26.992 33.877L6.484 44.759Z"
|
|
110
|
+
stroke-width="3"
|
|
111
|
+
transform="translate(2.517 1.586) scale(.60827)"/>
|
|
112
|
+
<path d="m78.734 7.668 2.61 11.396-18.145 4.154 2.705 11.816L84.05 30.88l2.609 11.396L100 21.011Z"
|
|
113
|
+
stroke-width="3"
|
|
114
|
+
transform="translate(1.586 1.586) scale(.60827)"/>
|
|
115
|
+
</g>
|
|
116
|
+
</svg>
|
|
117
|
+
`,copy:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
|
|
118
|
+
<path fill="currentColor"
|
|
119
|
+
d="M41.687.926a2.173 2.173 0 0 0-.433.045c-4.075.232-7.358 3.618-7.358 7.747 0 .084.01.164.012.246l-12.987 4.261a7.842 7.842 0 0 0-6.126-3.563 2.173 2.173 0 0 0-.424-.043 2.173 2.173 0 0 0-.435.044c-4.073.232-7.358 3.618-7.358 7.747 0 3.143 1.901 5.869 4.604 7.097L8.377 35.11a2.173 2.173 0 0 0-.028.007C4.274 35.35.99 38.736.99 42.865c0 4.277 3.514 7.791 7.791 7.791 2.497 0 4.727-1.201 6.157-3.048l12.887 6.235a7.67 7.67 0 0 0-.139 1.44c0 4.277 3.515 7.791 7.792 7.791 4.278 0 7.793-3.514 7.793-7.792a7.67 7.67 0 0 0-1.885-5.027l.508-1.05-3.263-1.579 4.505-29.969.888-.29-.368-1.122a7.78 7.78 0 0 0 2.28-1.018l.447 1.364 4.72-1.547-.774-2.359-2.522.826a7.73 7.73 0 0 0 1.672-4.793c0-4.132-3.288-7.52-7.368-7.748a2.173 2.173 0 0 0-.424-.044zm0 4.346a3.414 3.414 0 0 1 3.447 3.446 3.415 3.415 0 0 1-3.446 3.447 3.414 3.414 0 0 1-3.446-3.447 3.414 3.414 0 0 1 3.445-3.446zm20.076 3.725a1.242 1.242 0 0 0-.382.062l-1.612.528.578 1.76-.293 1.94 2.456.37.486-3.234a1.242 1.242 0 0 0-1.233-1.426Zm-4.354 1.364-4.72 1.548.775 2.36 4.719-1.548-.774-2.36zm-22.153 2.732a7.877 7.877 0 0 0 3.735 2.922l-.062.408-.397.13.26.793-4.255 28.298-3.818-1.847-1.082 2.235 3.718 1.798a7.841 7.841 0 0 0-3.543 2.147l-13.272-6.42c.02-.23.035-.458.035-.692 0-2.888-1.609-5.408-3.969-6.745l2.912-11.012c3.74-.562 6.645-3.81 6.645-7.698l-.001-.02 13.094-4.297zm-20.885.87a3.414 3.414 0 0 1 3.445 3.447 3.414 3.414 0 0 1-3.445 3.447 3.414 3.414 0 0 1-3.447-3.447 3.414 3.414 0 0 1 3.446-3.446zm45.314 1.78-.738 4.912 2.456.37.738-4.912zM36.172 17.33l-1.793.588a1.242 1.242 0 0 0-.813.862l-.788 2.978 2.401.634.615-2.325 1.15-.377-.773-2.36zm22.405 5.781-.737 4.913 2.455.368.739-4.91zm-26.432 1.048-1.27 4.802 2.401.634 1.27-4.802zm25.325 6.32-.739 4.913 2.457.368.738-4.911-2.456-.37zm-27.23.882-1.27 4.802 2.402.634 1.27-4.801zm26.124 6.486-.739 4.91 2.455.37.74-4.912-2.457-.368zm-28.027.717-1.27 4.803 2.4.634 1.27-4.802-2.401-.634zm-19.555.856a3.414 3.414 0 0 1 3.446 3.446 3.414 3.414 0 0 1-3.446 3.447 3.414 3.414 0 0 1-3.445-3.447 3.414 3.414 0 0 1 3.445-3.446zm46.473 5.795-.739 4.91 2.456.37.74-4.911zm-11.124 5.072-1.082 2.236 4.47 2.164 1.083-2.237zm-8.651 1.55a3.414 3.414 0 0 1 3.445 3.446 3.414 3.414 0 0 1-3.445 3.447 3.414 3.414 0 0 1-3.447-3.447 3.414 3.414 0 0 1 3.446-3.446zm18.669.745-.358 2.378-2.953-1.428-1.083 2.236 4.472 2.163.541-1.117 1.228.183.608-4.046-2.455-.37z"/>
|
|
120
|
+
</svg>
|
|
121
|
+
`,cut:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
|
|
122
|
+
<path stroke="currentColor" fill="currentColor" stroke-width="2"
|
|
123
|
+
d="M44.095 2.247a2.285 2.285 0 0 0-.135.04L12.025 12.762a2.285 2.285 0 0 0-1.497 1.588l-7.772 29.4a2.285 2.285 0 0 0 1.213 2.641L35.397 61.6a2.285 2.285 0 0 0 2.873-.754l22.64-32.582a2.285 2.285 0 0 0 .05-2.534L46.6 3.23a2.285 2.285 0 0 0-2.504-.982ZM43.7 7.182l12.203 19.12-5.167 1.76 1.052 3.09 2.031-.693L38.07 53.122l.01-1.375-3.262-.023-.034 4.5-27.13-13.127 6.975-26.38Zm3.946 21.932-6.18 2.105 1.052 3.09 6.18-2.105zm-9.27 3.157-2.329.793a1.632 1.632 0 0 0-1.105 1.534l-.03 4.068 3.265.024.02-2.91 1.232-.419zm-3.488 9.66-.047 6.529 3.264.023.048-6.528z"/>
|
|
124
|
+
</svg>
|
|
125
|
+
`,split:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
|
|
126
|
+
<g fill="currentColor">
|
|
127
|
+
<path d="m4.879 2.684-2.832 2.8L7.65 11.15l2.832-2.801Zm8.403 8.495-2.832 2.802 5.603 5.662 2.831-2.802zm8.404 8.494-2.832 2.8 5.602 5.664 2.832-2.802z"
|
|
128
|
+
/>
|
|
129
|
+
<path d="M27.814 7.408a3.576 3.576 0 0 0-1.161-.176 3.2 3.2 0 0 0-.878.138l7.963 26.068L7.18 27.3c-.543 2.352 1.67 6.055 4.962 6.816l23.054 5.297 2.326 6.42c-2.27-.175-4.279 1.912-4.908 3.805-.535 1.698-.512 3.656.085 5.61.597 1.954 1.671 3.59 3.064 4.7 1.393 1.11 3.238 1.71 5.023 1.164 8.064-3.039 2.135-15.793.467-20.58 5.917 1.023 18.77 5.88 20.578-1.979.42-1.819-.306-3.616-1.509-4.929-1.203-1.313-2.909-2.27-4.9-2.73-1.99-.46-3.866-.547-5.602.303-1.737.849-3.768 2.642-3.468 4.73a6.17 6.17 0 0 0 .012.43l-6.563-1.794-6.88-22.632c-.702-2.297-3.445-3.99-5.108-4.523Zm26.824 26.88c1.36.315 2.472.99 3.116 1.692.644.703.795 1.307.684 1.79-.112.482-.511.956-1.399 1.305-.887.348-2.182.467-3.542.152-1.361-.314-2.472-.99-3.116-1.693-.644-.703-.797-1.304-.686-1.787.112-.482.513-.956 1.4-1.305a5.198 5.198 0 0 1 1.594-.327 6.98 6.98 0 0 1 1.949.173zM37.846 49.174c.333.069.71.25 1.13.585.746.594 1.497 1.654 1.905 2.99.408 1.335.379 2.635.092 3.545-.287.91-.731 1.34-1.205 1.484-.473.145-1.085.036-1.831-.558-.746-.594-1.496-1.655-1.904-2.99-.407-1.336-.378-2.637-.092-3.546.287-.91.732-1.342 1.206-1.486.118-.036.245-.057.38-.058.102 0 .207.011.319.034z"
|
|
130
|
+
/>
|
|
131
|
+
</g>
|
|
132
|
+
</svg>
|
|
133
|
+
`,delete:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
|
|
134
|
+
<path fill="currentColor"
|
|
135
|
+
d="M39.063 42.14 22.288 28.12 7.96 44.603l11.338 9.854h9.059zm-3.498 12.317h25.941v5.465h-44.25L4.377 48.726a5.465 5.465 0 0 1-.542-7.711L34.311 5.958a5.465 5.465 0 0 1 7.712-.538l16.496 14.343a5.465 5.465 0 0 1 .541 7.709z"/>
|
|
136
|
+
</svg>`,union:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
|
|
137
|
+
<path fill="currentColor"
|
|
138
|
+
d="M41.233 7.917c-5.5 0-10.519 2.077-14.328 5.482a21.443 21.443 0 0 0-4.138-.404c-11.88 0-21.544 9.664-21.544 21.544s9.664 21.544 21.544 21.544c5.5 0 10.519-2.077 14.328-5.482 1.34.263 2.722.404 4.138.404 11.88 0 21.544-9.664 21.544-21.544S53.113 7.917 41.233 7.917zm-9.969 6.791a21.61 21.61 0 0 1 5.598 3.499l-2.01 2.33a18.557 18.557 0 0 0-4.8-2.999Zm-7.927 2.765 2.557 1.714a18.558 18.558 0 0 0-2.396 5.128l-2.955-.86a21.614 21.614 0 0 1 2.794-5.982zm15.86 3.08a21.413 21.413 0 0 1 3.46 5.628l-2.839 1.188a18.357 18.357 0 0 0-2.963-4.817zm-19.334 6.142 3.053.399a18.348 18.348 0 0 0 .144 5.654l-3.027.552a21.407 21.407 0 0 1-.17-6.605Zm23.834 2.63a21.81 21.81 0 0 1 .548 3.263c.1 1.1.115 2.207.044 3.31l-3.07-.195c.12-1.888-.056-3.8-.511-5.64zm-19.918 6.172a18.37 18.37 0 0 0 2.64 5.003l-2.466 1.84a21.427 21.427 0 0 1-3.083-5.84Zm17.042 3.016 3.004.666a21.486 21.486 0 0 1-2.404 6.15l-2.66-1.547a18.434 18.434 0 0 0 2.06-5.27zm-12.535 4.124a18.554 18.554 0 0 0 4.6 3.302l-1.392 2.744a21.611 21.611 0 0 1-5.363-3.85Z"/>
|
|
139
|
+
</svg>
|
|
140
|
+
`,difference:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
|
|
141
|
+
<path fill="currentColor"
|
|
142
|
+
d="m41.478 7.967-.033 3.069c1.887.02 3.772.337 5.561.933l.97-2.913a21.337 21.337 0 0 0-6.498-1.09Zm-3.294.215a21.567 21.567 0 0 0-6.298 1.915l1.332 2.766a18.518 18.518 0 0 1 5.401-1.641zm12.836 2.155-1.402 2.73a18.497 18.497 0 0 1 4.572 3.312l2.16-2.179a21.548 21.548 0 0 0-5.331-3.863ZM22.783 13.06c-11.848 0-21.486 9.638-21.486 21.486 0 11.849 9.638 21.486 21.486 21.486a21.37 21.37 0 0 0 14.288-5.466c.003 0 .006 0 .009.002.04-.036.078-.075.117-.11l.077-.072a21.285 21.285 0 0 0 1.51-1.532 22.128 22.128 0 0 0 .867-1.025 19.557 19.557 0 0 1-.88-.095c-.196-.025-.389-.058-.582-.09-.097-.015-.194-.028-.29-.045a18.378 18.378 0 0 1-1.576-.359l-.118-.03c-7.753-2.172-13.422-9.271-13.422-17.728a18.34 18.34 0 0 1 5.867-13.478c.1-.093.199-.185.3-.276.153-.136.31-.268.467-.4.097-.08.193-.163.291-.242.255-.203.514-.402.78-.592a21.534 21.534 0 0 0-1.76-.592l-.018-.005c-.176-.05-.355-.095-.533-.141-.132-.035-.263-.073-.397-.105-.213-.051-.43-.095-.646-.14-.077-.016-.153-.035-.231-.05H26.9a21.37 21.37 0 0 0-4.118-.4Zm35.728 3.64-2.472 1.82a18.424 18.424 0 0 1 2.61 5.004l2.907-.986a21.474 21.474 0 0 0-3.045-5.839Zm3.864 9.034-3.022.534c.328 1.86.37 3.772.118 5.642l3.042.409a21.448 21.448 0 0 0-.138-6.585zm-3.496 8.943a18.539 18.539 0 0 1-2.416 5.104l2.543 1.72a21.586 21.586 0 0 0 2.815-5.952zM54.703 42a18.288 18.288 0 0 1-4.428 3.492l1.505 2.675a21.348 21.348 0 0 0 5.173-4.08zm-6.995 4.69a18.512 18.512 0 0 1-5.526 1.158l.163 3.065a21.56 21.56 0 0 0 6.444-1.35z"/>
|
|
143
|
+
</svg>
|
|
144
|
+
`,line_simplification:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
|
|
145
|
+
<path fill="currentColor"
|
|
146
|
+
d="M1.947 25.554c-2.176 3.77-.867 8.656 2.903 10.832 2.126 1.229 4.607 1.346 6.757.539l8.252 12.152a7.79 7.79 0 0 0-.701 1.005c-2.176 3.77-.867 8.656 2.903 10.833 3.77 2.177 8.655.867 10.832-2.903 2.1-3.64.93-8.294-2.543-10.572a2.211 2.211 0 0 0-.36-.26 2.211 2.211 0 0 0-.404-.181 7.955 7.955 0 0 0-6.086-.432l-8.348-12.292c.19-.252.369-.512.53-.79 1.457-2.526 1.339-5.537-.03-7.907l8.202-8.256c3.494 1.335 7.562.025 9.575-3.229l13.899 2.913c.266 2.435 1.634 4.721 3.899 6.03 3.77 2.176 8.655.866 10.832-2.904 2.101-3.64.93-8.294-2.543-10.572a2.211 2.211 0 0 0-.36-.26 2.211 2.211 0 0 0-.403-.181c-3.71-1.87-8.328-.556-10.429 3.083-.084.147-.155.297-.228.446l-13.5-2.83c-.053-2.55-1.329-5.023-3.58-6.499a2.211 2.211 0 0 0-.358-.259 2.211 2.211 0 0 0-.405-.181c-3.708-1.87-8.326-.556-10.428 3.083-1.61 2.79-1.307 6.19.486 8.652l-7.84 7.892a2.211 2.211 0 0 0-.094-.036c-3.71-1.87-8.328-.556-10.429 3.084zm3.83 2.211a3.473 3.473 0 0 1 4.79-1.282 3.472 3.472 0 0 1 1.284 4.789 3.473 3.473 0 0 1-4.79 1.284 3.475 3.475 0 0 1-1.283-4.79ZM23.656 8.173a3.474 3.474 0 0 1 4.79-1.283 3.472 3.472 0 0 1 1.283 4.79 3.473 3.473 0 0 1-4.789 1.284 3.475 3.475 0 0 1-1.284-4.791zm-.666 44.12a3.474 3.474 0 0 1 4.79-1.283 3.472 3.472 0 0 1 1.283 4.79 3.473 3.473 0 0 1-4.79 1.284 3.475 3.475 0 0 1-1.283-4.791zm29.166-37.88a3.474 3.474 0 0 1 4.79-1.283 3.472 3.472 0 0 1 1.283 4.79 3.473 3.473 0 0 1-4.79 1.284 3.475 3.475 0 0 1-1.283-4.791z"/>
|
|
147
|
+
<path fill="currentColor"
|
|
148
|
+
d="M12.9 13.516c-.63.177-.685.37-.88.95l-1.069 3.18 2.995 1.006.844-2.506 2.074-.882-1.236-2.908zm19.209 5.25 4.378 4.554 2.277-2.19-4.379-4.554zm8.132 3.106 1.441 2.812 5.623-2.882-1.441-2.812zM5.448 46.082l3.144.304.608-6.29-3.145-.303zm4.623 3.728 5.762 2.592 1.297-2.88-5.762-2.593z"/>
|
|
149
|
+
</svg>
|
|
150
|
+
`,lasso:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
|
|
151
|
+
<ellipse cx="4.907" cy="-32.051" fill="none" stroke="currentColor" stroke-dasharray="13.7543, 6.87718"
|
|
152
|
+
stroke-width="5.489" rx="20.4" ry="13.713" transform="matrix(-.71127 .70292 -.86047 -.5095 0 0)"/>
|
|
153
|
+
<path fill="currentColor"
|
|
154
|
+
d="M34.597 25.275a1.934 1.934 0 0 0-2.04 2.165l2.922 31.37c.188 1.523 1.989 2.235 3.165 1.249l6.169-5.004 2.765 4.79c1.59 2.756 4.115 3.431 6.87 1.841 2.756-1.59 3.433-4.114 1.841-6.87l-2.755-4.773 7.31-2.803c1.443-.525 1.728-2.44.503-3.365L35.64 25.66a1.93 1.93 0 0 0-1.042-.383z"/>
|
|
155
|
+
</svg>
|
|
156
|
+
`,shape_markers:null,snapping:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
|
|
157
|
+
<path fill="currentColor" fill-rule="evenodd"
|
|
158
|
+
d="M19.435 3.417c-4.478 0-8.96 1.693-12.343 5.076-6.766 6.766-6.766 17.913 0 24.679h.006c2.754 2.749 5.563 5.561 8.357 8.357 1.857 1.859 3.696 3.696 5.553 5.553l.949.949 1.892 1.898 9.496-9.49-1.898-1.898-6.502-6.502c-2.796-2.797-5.6-5.606-8.363-8.362-1.65-1.653-1.652-4.042 0-5.694 1.653-1.653 4.047-1.653 5.7 0l8.357 8.362 6.502 6.502 1.898 1.893 9.49-9.49-1.893-1.893-6.507-6.502-8.357-8.362c-3.384-3.383-7.86-5.076-12.337-5.076Zm0 2.68c3.789 0 7.577 1.432 10.439 4.294l8.357 8.362-5.694 5.694-8.357-8.362a6.7 6.7 0 0 0-9.496 0 6.697 6.697 0 0 0 0 9.49c2.76 2.755 5.566 5.564 8.363 8.362l-5.694 5.694c-2.795-2.796-5.601-5.607-8.357-8.357H8.99c-5.724-5.724-5.724-15.16 0-20.883 2.861-2.862 6.655-4.294 10.444-4.294ZM57.709 29.03a4.266 4.266 0 0 0-4.268 4.268c0 1.594.881 2.973 2.176 3.707-.714 4.997-1.424 10.107-2.176 15.037-.934 0-1.792.309-2.495.818l-7.115-5.07a4.25 4.25 0 0 0 .115-.965 4.27 4.27 0 1 0-4.268 4.268 4.23 4.23 0 0 0 2.732-1.012l6.973 4.965a4.22 4.22 0 0 0-.215 1.269 4.27 4.27 0 0 0 4.273 4.268 4.266 4.266 0 0 0 4.268-4.268 4.247 4.247 0 0 0-1.657-3.356l2.208-15.446c2.095-.273 3.722-2.045 3.722-4.215a4.27 4.27 0 0 0-4.273-4.268z"
|
|
159
|
+
/>
|
|
160
|
+
</svg>
|
|
161
|
+
`,pin:`\uFEFF<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
|
|
162
|
+
<path fill="currentColor"
|
|
163
|
+
d="M42.012 2.106a4.092 4.092 0 0 0-5.741.735 4.092 4.092 0 0 0 .572 5.607L23.964 23.45a8.185 8.185 0 0 0-10.458 2.142l5.18 4.005 5.454 4.218L7.87 59.22a1.124 7.304 37.712 0 0 1.54 1.19l20.494-22.138 5.454 4.217 5.18 4.005a8.185 8.185 0 0 0-.558-10.66l11.277-16.24a4.092 4.092 0 0 0 5.572-.858 4.092 4.092 0 0 0-.735-5.74z"/>
|
|
164
|
+
</svg>
|
|
165
|
+
`,snap_guides:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
|
|
166
|
+
<path stroke="currentColor"
|
|
167
|
+
stroke-width="3.8"
|
|
168
|
+
d="m2.155 32.345 42.35-29.82M18.963 60.919l42.35-29.82M31.443 2.332l29.82 42.35M2.207 19.515l29.82 42.35"/>
|
|
169
|
+
</svg>
|
|
170
|
+
`,measurements:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
|
|
171
|
+
<path fill="currentColor"
|
|
172
|
+
d="M1.717 38.645a2.675 2.668 79.7 0 0-.307 3.769L16.754 60.55a2.675 2.668 79.7 0 0 3.76.312l41.769-35.508a2.675 2.668 79.7 0 0 .307-3.769L47.246 3.45a2.675 2.668 79.7 0 0-3.76-.312zm5.486 2.352 37.702-32.05 11.892 14.056-2.717 2.31-4.458-5.269-2.033 1.729 4.457 5.269-3.11 2.643-4.457-5.268-2.034 1.728 4.458 5.27-3.106 2.64-4.458-5.27-2.033 1.73 4.457 5.268-3.11 2.644-6.194-7.32-2.033 1.728 6.193 7.32-3.11 2.645-4.457-5.269-2.034 1.729 4.458 5.268-3.106 2.64-4.458-5.268-2.033 1.73 4.457 5.268-3.11 2.643-4.457-5.268-2.034 1.729 4.458 5.268-2.098 1.783z"/>
|
|
173
|
+
</svg>
|
|
174
|
+
`,auto_trace:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
|
|
175
|
+
<path fill="currentColor"
|
|
176
|
+
d="M16.862 2.13 7.297 21.17a2.091 2.091 0 0 0-.193 1.288l4.107 24.166-7.618 13.15 3.619 2.096 7.997-13.804a2.091 2.091 0 0 0 .252-1.397l-4.119-24.235 9.256-18.428Zm40.876.255-1.25 2.49 2.668 1.341 1.25-2.49zm-2.593 5.16-2.68 5.337 2.668 1.341 2.682-5.338zm-4.022 8.007-2.682 5.338 2.67 1.34 2.681-5.337zm-18.67 5.83.055 6.984-11.118.087.056 7.242 11.12-.088.054 6.985 10.521-10.688zm18.927 2.817-2.945.5 1.001 5.89 2.945-.5zm1.502 8.835-2.945.5 1.001 5.89 2.945-.5zm1.502 8.834-2.945.5.74 4.355-.24.413 2.585 1.499.51-.881a1.494 1.494 0 0 0 .18-1zm-3.943 7.854-2.994 5.17 2.584 1.496 2.994-5.169zm-4.492 7.754-1.497 2.584 2.584 1.497 1.498-2.584z"/>
|
|
177
|
+
</svg>
|
|
178
|
+
`,geofencing:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
|
|
179
|
+
<path fill="currentColor"
|
|
180
|
+
d="M31.226 17.87c-4.69 0-8.532 3.832-8.532 8.508 0 1.812.58 3.495 1.558 4.88l5.932 10.255c.831 1.085 1.383.879 2.074-.058l6.543-11.135c.132-.24.236-.493.327-.753a8.396 8.396 0 0 0 .628-3.19c0-4.675-3.841-8.506-8.53-8.506zm0 3.987a4.5 4.5 0 0 1 4.532 4.52 4.5 4.5 0 0 1-4.532 4.521 4.5 4.5 0 0 1-4.534-4.52 4.5 4.5 0 0 1 4.533-4.52z"/>
|
|
181
|
+
<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="6"
|
|
182
|
+
stroke-width="5" d="M8.97 53.509 4.423 19.145 35.698 4.199l23.88 25.127L43.06 59.801Z"/>
|
|
183
|
+
</svg>
|
|
184
|
+
`,zoom_to_features:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
|
|
185
|
+
<path fill="currentColor"
|
|
186
|
+
d="M1.585 1.585V13.75h5.17v1.52H8.58v-1.52h5.17V1.585Zm3.041 3.041h6.083v6.083H4.626Zm9.429 2.13V8.58h3.65V6.755Zm5.475 0V8.58h3.65V6.755Zm5.474 0V8.58h3.65V6.755Zm5.475 0V8.58h3.65V6.755Zm5.475 0V8.58h3.65V6.755Zm5.475 0v1.597a1.521 1.521 0 0 0-.325.152l-15.686 9.758a1.52 1.52 0 0 0-.199 2.437l23.512 20.553a1.52 1.52 0 0 0 2.477-.78l4.212-17.037v.352h1.825v-3.65H55.42v1.524a1.52 1.52 0 0 0-.222-.296L43.002 8.741a1.521 1.521 0 0 0-.182-.16h2.259V6.754Zm5.475 0V8.58h3.65V6.755Zm5.474 0V8.58h3.65V6.755Zm3.042 2.432v3.65h1.825v-3.65Zm-13.752 2.549 10.757 11.137-3.57 14.446-20.087-17.559Zm13.752 2.926v3.65h1.825v-3.65ZM6.755 17.096v3.65H8.58v-3.65zm0 5.475v3.65h1.628a1.52 1.52 0 0 0 1.02.909l12.683 3.406 7.905 12.694c.168.27.417.481.712.602l13.39 4.576a1.52 1.52 0 0 0 1.157-2.814l-12.936-4.389L24.35 28.42a1.52 1.52 0 0 0-.896-.664L10.19 24.193a1.52 1.52 0 0 0-1.61.557v-2.178zm48.665 3.042v3.65h1.825v-3.65ZM6.755 28.046v3.65H8.58v-3.65zm48.665 3.042v3.65h1.825v-3.65ZM6.755 33.52v3.65H8.58v-3.65zm48.665 3.041v3.65h1.825v-3.65ZM6.755 38.996v3.65H8.58v-3.65zm48.665 3.041v3.65h1.825v-3.65zm-35.382.913c-3.454 0-6.287 2.833-6.287 6.287 0 3.076 2.248 5.654 5.179 6.183h-1.225v1.825h3.65V55.42h-.206c2.712-.5 4.777-2.796 5.055-5.59l.002-.002a1.52 1.52 0 0 0 0-1.18c-.314-3.168-2.922-5.698-6.168-5.698zM6.755 44.47v3.65H8.58v-3.65zm13.283 1.521a3.223 3.223 0 0 1 3.246 3.246 3.223 3.223 0 0 1-3.246 3.246 3.223 3.223 0 0 1-3.246-3.246 3.223 3.223 0 0 1 3.246-3.246zm35.382 1.52v2.738h-5.17v12.166h12.165V50.25h-5.17v-2.737ZM6.755 49.946v3.65H8.58v-3.65zm46.536 3.346h6.083v6.083H53.29ZM6.755 55.42v1.825h3.65V55.42H7.668Zm5.475 0v1.825h3.65V55.42zm10.95 0v1.825h3.65V55.42zm5.474 0v1.825h3.65V55.42zm5.475 0v1.825h3.65V55.42zm5.475 0v1.825h3.65V55.42zm5.475 0v1.825h3.65V55.42z"/>
|
|
187
|
+
</svg>
|
|
188
|
+
`,click_to_edit:`<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 64 64">
|
|
189
|
+
<path d="M7.839 34.833c-7.104-9.763-5.332-23.33 4.2-30.266C21.572-2.369 35.03.123 42.13 9.882L56.166 29.17c7.098 9.755 5.329 23.325-4.204 30.262-9.533 6.936-22.989 4.444-30.09-5.315L7.841 34.836Zm5.063-25.476c-6.079 5.766-7.006 15.598-1.634 22.98l.778 1.07 12.002-8.732zm3.43-2.495L27.476 22.18l12.002-8.733-.781-1.073c-5.37-7.38-15.01-9.522-22.367-5.512m25.643 10.014L14.54 36.836l10.762 14.79c5.818 7.997 16.653 9.842 24.163 4.378 7.51-5.465 9.088-16.342 3.267-24.342z"/>
|
|
190
|
+
</svg>
|
|
191
|
+
`},Uo=e=>[{type:"circle",paint:{"circle-radius":e.circleMarkerRadius,"circle-color":e.fillColor,"circle-opacity":e.fillOpacity,"circle-stroke-color":e.lineColor,"circle-stroke-width":e.lineWidth,"circle-stroke-opacity":e.lineOpacity}}],wi=e=>[{type:"circle",paint:{"circle-radius":7,"circle-color":"#ffffff","circle-opacity":1,"circle-stroke-color":e.lineColor,"circle-stroke-width":2,"circle-stroke-opacity":1}}],zo=e=>[{type:"line",paint:{"line-color":e.lineColor,"line-opacity":e.lineOpacity,"line-width":e.lineWidth}}],jo=()=>[{type:"symbol",layout:{"icon-image":"default-marker","icon-size":.18,"icon-allow-overlap":!0,"icon-anchor":"bottom"}}],Jt=e=>[{type:"fill",paint:{"fill-color":e.fillColor,"fill-opacity":e.fillOpacity}},{type:"line",paint:{"line-color":e.lineColor,"line-opacity":e.lineOpacity,"line-width":e.lineWidth}}],qo=e=>[{type:"circle",paint:{"circle-radius":6,"circle-color":"#ffffff","circle-opacity":.6,"circle-stroke-color":e.lineColor,"circle-stroke-width":2,"circle-stroke-opacity":1}}],pa=()=>[{type:"line",paint:{"line-color":"#00979f","line-width":1.8,"line-dasharray":[2,1]}}],rt="__gm_",Qt=`${rt}id`,_u=6e4,Z=Object.fromEntries(["standby","main","temporary","internal"].filter(e=>e!=="standby"||st).map(e=>[e,`gm_${e}`])),Yo=()=>[{type:"symbol",layout:{"text-field":["get",`${rt}text`],"text-justify":"center"},paint:{"text-color":"black","text-halo-color":"#fff","text-halo-width":2}}],Ge={[Z.main]:{lineColor:"#278cda",lineOpacity:.8,lineWidth:3,fillColor:"#4fb3ff",fillOpacity:.4,circleMarkerRadius:10},[Z.temporary]:{lineColor:"#ff5600",lineOpacity:.8,lineWidth:3,fillColor:"#4fb3ff",fillOpacity:.4,circleMarkerRadius:10},[Z.internal]:{lineColor:"#278cda",lineOpacity:.8,lineWidth:3,fillColor:"#4fb3ff",fillOpacity:.4,circleMarkerRadius:10},...st&&{[Z.standby]:{lineColor:"#787878",lineOpacity:.8,lineWidth:3,fillColor:"#a5a5a5",fillOpacity:.4,circleMarkerRadius:10}}},mm={polygon:{[Z.main]:Jt(Ge[Z.main]),[Z.temporary]:Jt(Ge[Z.temporary]),[Z.internal]:[],...st&&{[Z.standby]:Jt(Ge[Z.standby])}},ellipse:{[Z.main]:Jt(Ge[Z.main]),[Z.temporary]:Jt(Ge[Z.temporary]),[Z.internal]:[],...st&&{[Z.standby]:Jt(Ge[Z.standby])}},rectangle:{[Z.main]:Jt(Ge[Z.main]),[Z.temporary]:Jt(Ge[Z.temporary]),[Z.internal]:[],...st&&{[Z.standby]:Jt(Ge[Z.standby])}},circle:{[Z.main]:Jt(Ge[Z.main]),[Z.temporary]:Jt(Ge[Z.temporary]),[Z.internal]:[],...st&&{[Z.standby]:Jt(Ge[Z.standby])}},circle_marker:{[Z.main]:Uo(Ge[Z.main]),[Z.temporary]:Uo(Ge[Z.temporary]),[Z.internal]:[],...st&&{[Z.standby]:Uo(Ge[Z.standby])}},line:{[Z.main]:zo(Ge[Z.main]),[Z.temporary]:zo(Ge[Z.temporary]),[Z.internal]:[],...st&&{[Z.standby]:zo(Ge[Z.standby])}},marker:{[Z.temporary]:jo(),[Z.main]:jo(),[Z.internal]:[],...st&&{[Z.standby]:jo()}},text_marker:{[Z.main]:Yo(),[Z.temporary]:Yo(),[Z.internal]:[],...st&&{[Z.standby]:Yo()}},dom_marker:{[Z.main]:[],[Z.temporary]:[],[Z.internal]:[],...st&&{[Z.standby]:[]}},center_marker:{[Z.main]:[],[Z.temporary]:wi(Ge[Z.temporary]),[Z.internal]:wi(Ge[Z.internal]),...st&&{[Z.standby]:wi(Ge[Z.standby])}},vertex_marker:{[Z.main]:[],[Z.temporary]:wi(Ge[Z.temporary]),[Z.internal]:wi(Ge[Z.internal]),...st&&{[Z.standby]:wi(Ge[Z.standby])}},edge_marker:{[Z.main]:[],[Z.temporary]:qo(Ge[Z.temporary]),[Z.internal]:qo(Ge[Z.internal]),...st&&{[Z.standby]:qo(Ge[Z.standby])}},snap_guide:{[Z.main]:pa(),[Z.temporary]:pa(),[Z.internal]:pa(),...st&&{[Z.standby]:pa()}}},vm={settings:{throttlingDelay:10,awaitDataUpdatesOnEvents:!0,useDefaultLayers:!0,useControlsUi:!0,controlsPosition:"top-left",controlsUiEnabledByDefault:!0,controlsCollapsible:!1,controlsStyles:{controlGroupClass:"maplibregl-ctrl maplibregl-ctrl-group",controlContainerClass:"gm-control-container",controlButtonClass:"gm-control-button"},idGenerator:null,snapDistance:18,markerIcons:{default:`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="#0A95F0" class="bi bi-geo-alt-fill"
|
|
192
|
+
viewBox="0 0 16 16">
|
|
193
|
+
<path d="M8 16s6-5.686 6-10A6 6 0 0 0 2 6c0 4.314 6 10 6 10m0-7a3 3 0 1 1 0-6 3 3 0 0 1 0 6"/>
|
|
194
|
+
</svg>
|
|
195
|
+
`,control:`<svg xmlns="http://www.w3.org/2000/svg" width="21" height="21">
|
|
196
|
+
<circle cx="10.5" cy="10.5" r="9.213" fill="#fff" stroke="#278cda" stroke-width="2.303"/>
|
|
197
|
+
</svg>
|
|
198
|
+
`}},layerStyles:mm,controls:{draw:{marker:{title:"Marker",icon:wt.marker,uiEnabled:!0,active:!1},circle_marker:{title:"Circle Marker",icon:wt.circle_marker,uiEnabled:!0,active:!1},text_marker:{title:"Text Marker",icon:wt.text_marker,uiEnabled:!0,active:!1},circle:{title:"Circle",icon:wt.circle,uiEnabled:!0,active:!1},ellipse:{title:"Ellipse",icon:wt.ellipse,uiEnabled:!0,active:!1},line:{title:"Line",icon:wt.line,uiEnabled:!0,active:!1},rectangle:{title:"Rectangle",icon:wt.rectangle,uiEnabled:!0,active:!1},polygon:{title:"Polygon",icon:wt.polygon,uiEnabled:!0,active:!1}},edit:{drag:{title:"Drag",icon:wt.drag,uiEnabled:!0,active:!1},change:{title:"Change",icon:wt.change,uiEnabled:!0,active:!1,settings:{bodyDragEnabled:!1}},rotate:{title:"Rotate",icon:wt.rotate,uiEnabled:!0,active:!1,settings:{bodyDragEnabled:!1}},cut:{title:"Cut",icon:wt.cut,uiEnabled:!0,active:!1},delete:{title:"Delete",icon:wt.delete,uiEnabled:!0,active:!1}},helper:{shape_markers:{title:"Shape markers",icon:null,uiEnabled:!1,active:!1},snapping:{title:"Snapping",icon:wt.snapping,uiEnabled:!0,active:!1},zoom_to_features:{title:"Zoom to features",icon:wt.zoom_to_features,uiEnabled:!0,active:!1}}}},Ff=typeof global=="object"&&global&&global.Object===Object&&global,ym=typeof self=="object"&&self&&self.Object===Object&&self,En=Ff||ym||Function("return this")(),an=En.Symbol,Gf=Object.prototype,_m=Gf.hasOwnProperty,wm=Gf.toString,ls=an?an.toStringTag:void 0;function km(e){var t=_m.call(e,ls),i=e[ls];try{e[ls]=void 0;var s=!0}catch{}var u=wm.call(e);return s&&(t?e[ls]=i:delete e[ls]),u}var xm=Object.prototype.toString;function Em(e){return xm.call(e)}var bm="[object Null]",Sm="[object Undefined]",Fc=an?an.toStringTag:void 0;function ni(e){return e==null?e===void 0?Sm:bm:Fc&&Fc in Object(e)?km(e):Em(e)}function jn(e){return e!=null&&typeof e=="object"}var Im="[object Symbol]";function Pi(e){return typeof e=="symbol"||jn(e)&&ni(e)==Im}function Ni(e,t){for(var i=-1,s=e==null?0:e.length,u=Array(s);++i<s;)u[i]=t(e[i],i,e);return u}var bt=Array.isArray,Gc=an?an.prototype:void 0,Bc=Gc?Gc.toString:void 0;function Bf(e){if(typeof e=="string")return e;if(bt(e))return Ni(e,Bf)+"";if(Pi(e))return Bc?Bc.call(e):"";var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}var Mm=/\s/;function Nm(e){for(var t=e.length;t--&&Mm.test(e.charAt(t)););return t}var Lm=/^\s+/;function Cm(e){return e&&e.slice(0,Nm(e)+1).replace(Lm,"")}function St(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Uc=NaN,Am=/^[-+]0x[0-9a-f]+$/i,Tm=/^0b[01]+$/i,Pm=/^0o[0-7]+$/i,Om=parseInt;function zc(e){if(typeof e=="number")return e;if(Pi(e))return Uc;if(St(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=St(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=Cm(e);var i=Tm.test(e);return i||Pm.test(e)?Om(e.slice(2),i?2:8):Am.test(e)?Uc:+e}function lo(e){return e}var Rm="[object AsyncFunction]",Dm="[object Function]",Fm="[object GeneratorFunction]",Gm="[object Proxy]";function hl(e){if(!St(e))return!1;var t=ni(e);return t==Dm||t==Fm||t==Rm||t==Gm}var Ho=En["__core-js_shared__"],jc=(function(){var e=/[^.]+$/.exec(Ho&&Ho.keys&&Ho.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""})();function Bm(e){return!!jc&&jc in e}var Um=Function.prototype.toString;function ri(e){if(e!=null){try{return Um.call(e)}catch{}try{return e+""}catch{}}return""}var zm=/[\\^$.*+?()[\]{}|]/g,jm=/^\[object .+?Constructor\]$/,qm=Function.prototype,Ym=Object.prototype,Hm=qm.toString,Jm=Ym.hasOwnProperty,Vm=RegExp("^"+Hm.call(Jm).replace(zm,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Xm(e){return!St(e)||Bm(e)?!1:(hl(e)?Vm:jm).test(ri(e))}function $m(e,t){return e?.[t]}function ii(e,t){var i=$m(e,t);return Xm(i)?i:void 0}var wu=ii(En,"WeakMap"),qc=Object.create,Zm=(function(){function e(){}return function(t){if(!St(t))return{};if(qc)return qc(t);e.prototype=t;var i=new e;return e.prototype=void 0,i}})();function Wm(e,t,i){switch(i.length){case 0:return e.call(t);case 1:return e.call(t,i[0]);case 2:return e.call(t,i[0],i[1]);case 3:return e.call(t,i[0],i[1],i[2])}return e.apply(t,i)}function Km(){}function Qm(e,t){var i=-1,s=e.length;for(t||(t=Array(s));++i<s;)t[i]=e[i];return t}var ev=800,tv=16,nv=Date.now;function rv(e){var t=0,i=0;return function(){var s=nv(),u=tv-(s-i);if(i=s,u>0){if(++t>=ev)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function iv(e){return function(){return e}}var Ja=(function(){try{var e=ii(Object,"defineProperty");return e({},"",{}),e}catch{}})(),sv=rv(Ja?function(e,t){return Ja(e,"toString",{configurable:!0,enumerable:!1,value:iv(t),writable:!0})}:lo);function av(e,t){for(var i=-1,s=e==null?0:e.length;++i<s&&t(e[i],i,e)!==!1;);return e}function ov(e,t,i,s){for(var u=e.length,c=i+-1;++c<u;)if(t(e[c],c,e))return c;return-1}function uv(e){return e!==e}function lv(e,t,i){for(var s=i-1,u=e.length;++s<u;)if(e[s]===t)return s;return-1}function cv(e,t,i){return t===t?lv(e,t,i):ov(e,uv,i)}function Uf(e,t){return!!(e!=null&&e.length)&&cv(e,t,0)>-1}var hv=9007199254740991,fv=/^(?:0|[1-9]\d*)$/;function co(e,t){var i=typeof e;return t=t??hv,!!t&&(i=="number"||i!="symbol"&&fv.test(e))&&e>-1&&e%1==0&&e<t}function Ws(e,t,i){t=="__proto__"&&Ja?Ja(e,t,{configurable:!0,enumerable:!0,value:i,writable:!0}):e[t]=i}function Ks(e,t){return e===t||e!==e&&t!==t}var gv=Object.prototype.hasOwnProperty;function fl(e,t,i){var s=e[t];(!(gv.call(e,t)&&Ks(s,i))||i===void 0&&!(t in e))&&Ws(e,t,i)}function dv(e,t,i,s){var u=!i;i||(i={});for(var c=-1,f=t.length;++c<f;){var h=t[c],d=void 0;d===void 0&&(d=e[h]),u?Ws(i,h,d):fl(i,h,d)}return i}var Yc=Math.max;function pv(e,t,i){return t=Yc(t===void 0?e.length-1:t,0),function(){for(var s=arguments,u=-1,c=Yc(s.length-t,0),f=Array(c);++u<c;)f[u]=s[t+u];u=-1;for(var h=Array(t+1);++u<t;)h[u]=s[u];return h[t]=i(f),Wm(e,this,h)}}function gl(e,t){return sv(pv(e,t,lo),e+"")}var mv=9007199254740991;function dl(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=mv}function Hi(e){return e!=null&&dl(e.length)&&!hl(e)}function ku(e,t,i){if(!St(i))return!1;var s=typeof t;return(s=="number"?Hi(i)&&co(t,i.length):s=="string"&&t in i)?Ks(i[t],e):!1}function zf(e){return gl(function(t,i){var s=-1,u=i.length,c=u>1?i[u-1]:void 0,f=u>2?i[2]:void 0;for(c=e.length>3&&typeof c=="function"?(u--,c):void 0,f&&ku(i[0],i[1],f)&&(c=u<3?void 0:c,u=1),t=Object(t);++s<u;){var h=i[s];h&&e(t,h,s,c)}return t})}var vv=Object.prototype;function pl(e){var t=e&&e.constructor;return e===(typeof t=="function"&&t.prototype||vv)}function yv(e,t){for(var i=-1,s=Array(e);++i<e;)s[i]=t(i);return s}var _v="[object Arguments]";function Hc(e){return jn(e)&&ni(e)==_v}var jf=Object.prototype,wv=jf.hasOwnProperty,kv=jf.propertyIsEnumerable,Bs=Hc((function(){return arguments})())?Hc:function(e){return jn(e)&&wv.call(e,"callee")&&!kv.call(e,"callee")};function xv(){return!1}var qf=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Jc=qf&&typeof module=="object"&&module&&!module.nodeType&&module,Vc=Jc&&Jc.exports===qf?En.Buffer:void 0,Us=(Vc?Vc.isBuffer:void 0)||xv,Ev="[object Arguments]",bv="[object Array]",Sv="[object Boolean]",Iv="[object Date]",Mv="[object Error]",Nv="[object Function]",Lv="[object Map]",Cv="[object Number]",Av="[object Object]",Tv="[object RegExp]",Pv="[object Set]",Ov="[object String]",Rv="[object WeakMap]",Dv="[object ArrayBuffer]",Fv="[object DataView]",Gv="[object Float32Array]",Bv="[object Float64Array]",Uv="[object Int8Array]",zv="[object Int16Array]",jv="[object Int32Array]",qv="[object Uint8Array]",Yv="[object Uint8ClampedArray]",Hv="[object Uint16Array]",Jv="[object Uint32Array]",je={};je[Gv]=je[Bv]=je[Uv]=je[zv]=je[jv]=je[qv]=je[Yv]=je[Hv]=je[Jv]=!0;je[Ev]=je[bv]=je[Dv]=je[Sv]=je[Fv]=je[Iv]=je[Mv]=je[Nv]=je[Lv]=je[Cv]=je[Av]=je[Tv]=je[Pv]=je[Ov]=je[Rv]=!1;function Vv(e){return jn(e)&&dl(e.length)&&!!je[ni(e)]}function ho(e){return function(t){return e(t)}}var Yf=typeof exports=="object"&&exports&&!exports.nodeType&&exports,As=Yf&&typeof module=="object"&&module&&!module.nodeType&&module,Jo=As&&As.exports===Yf&&Ff.process,Oi=(function(){try{return As&&As.require&&As.require("util").types||Jo&&Jo.binding&&Jo.binding("util")}catch{}})(),Xc=Oi&&Oi.isTypedArray,ml=Xc?ho(Xc):Vv,Xv=Object.prototype.hasOwnProperty;function Hf(e,t){var i=bt(e),s=!i&&Bs(e),u=!i&&!s&&Us(e),c=!i&&!s&&!u&&ml(e),f=i||s||u||c,h=f?yv(e.length,String):[],d=h.length;for(var m in e)(t||Xv.call(e,m))&&!(f&&(m=="length"||u&&(m=="offset"||m=="parent")||c&&(m=="buffer"||m=="byteLength"||m=="byteOffset")||co(m,d)))&&h.push(m);return h}function Jf(e,t){return function(i){return e(t(i))}}var $v=Jf(Object.keys,Object),Zv=Object.prototype.hasOwnProperty;function Wv(e){if(!pl(e))return $v(e);var t=[];for(var i in Object(e))Zv.call(e,i)&&i!="constructor"&&t.push(i);return t}function fo(e){return Hi(e)?Hf(e):Wv(e)}function Kv(e){var t=[];if(e!=null)for(var i in Object(e))t.push(i);return t}var Qv=Object.prototype.hasOwnProperty;function e0(e){if(!St(e))return Kv(e);var t=pl(e),i=[];for(var s in e)s=="constructor"&&(t||!Qv.call(e,s))||i.push(s);return i}function Vf(e){return Hi(e)?Hf(e,!0):e0(e)}var t0=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n0=/^\w*$/;function vl(e,t){if(bt(e))return!1;var i=typeof e;return i=="number"||i=="symbol"||i=="boolean"||e==null||Pi(e)?!0:n0.test(e)||!t0.test(e)||t!=null&&e in Object(t)}var zs=ii(Object,"create");function r0(){this.__data__=zs?zs(null):{},this.size=0}function i0(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var s0="__lodash_hash_undefined__",a0=Object.prototype.hasOwnProperty;function o0(e){var t=this.__data__;if(zs){var i=t[e];return i===s0?void 0:i}return a0.call(t,e)?t[e]:void 0}var u0=Object.prototype.hasOwnProperty;function l0(e){var t=this.__data__;return zs?t[e]!==void 0:u0.call(t,e)}var c0="__lodash_hash_undefined__";function h0(e,t){var i=this.__data__;return this.size+=this.has(e)?0:1,i[e]=zs&&t===void 0?c0:t,this}function $r(e){var t=-1,i=e==null?0:e.length;for(this.clear();++t<i;){var s=e[t];this.set(s[0],s[1])}}$r.prototype.clear=r0;$r.prototype.delete=i0;$r.prototype.get=o0;$r.prototype.has=l0;$r.prototype.set=h0;function f0(){this.__data__=[],this.size=0}function go(e,t){for(var i=e.length;i--;)if(Ks(e[i][0],t))return i;return-1}var g0=Array.prototype.splice;function d0(e){var t=this.__data__,i=go(t,e);return i<0?!1:(i==t.length-1?t.pop():g0.call(t,i,1),--this.size,!0)}function p0(e){var t=this.__data__,i=go(t,e);return i<0?void 0:t[i][1]}function m0(e){return go(this.__data__,e)>-1}function v0(e,t){var i=this.__data__,s=go(i,e);return s<0?(++this.size,i.push([e,t])):i[s][1]=t,this}function ar(e){var t=-1,i=e==null?0:e.length;for(this.clear();++t<i;){var s=e[t];this.set(s[0],s[1])}}ar.prototype.clear=f0;ar.prototype.delete=d0;ar.prototype.get=p0;ar.prototype.has=m0;ar.prototype.set=v0;var js=ii(En,"Map");function y0(){this.size=0,this.__data__={hash:new $r,map:new(js||ar),string:new $r}}function _0(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function po(e,t){var i=e.__data__;return _0(t)?i[typeof t=="string"?"string":"hash"]:i.map}function w0(e){var t=po(this,e).delete(e);return this.size-=t?1:0,t}function k0(e){return po(this,e).get(e)}function x0(e){return po(this,e).has(e)}function E0(e,t){var i=po(this,e),s=i.size;return i.set(e,t),this.size+=i.size==s?0:1,this}function or(e){var t=-1,i=e==null?0:e.length;for(this.clear();++t<i;){var s=e[t];this.set(s[0],s[1])}}or.prototype.clear=y0;or.prototype.delete=w0;or.prototype.get=k0;or.prototype.has=x0;or.prototype.set=E0;var b0="Expected a function";function yl(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(b0);var i=function(){var s=arguments,u=t?t.apply(this,s):s[0],c=i.cache;if(c.has(u))return c.get(u);var f=e.apply(this,s);return i.cache=c.set(u,f)||c,f};return i.cache=new(yl.Cache||or),i}yl.Cache=or;var S0=500;function I0(e){var t=yl(e,function(s){return i.size===S0&&i.clear(),s}),i=t.cache;return t}var M0=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,N0=/\\(\\)?/g,L0=I0(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(M0,function(i,s,u,c){t.push(u?c.replace(N0,"$1"):s||i)}),t});function C0(e){return e==null?"":Bf(e)}function _l(e,t){return bt(e)?e:vl(e,t)?[e]:L0(C0(e))}function Qs(e){if(typeof e=="string"||Pi(e))return e;var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function wl(e,t){t=_l(t,e);for(var i=0,s=t.length;e!=null&&i<s;)e=e[Qs(t[i++])];return i&&i==s?e:void 0}function Ri(e,t,i){var s=e==null?void 0:wl(e,t);return s===void 0?i:s}function Xf(e,t){for(var i=-1,s=t.length,u=e.length;++i<s;)e[u+i]=t[i];return e}var $c=an?an.isConcatSpreadable:void 0;function A0(e){return bt(e)||Bs(e)||!!($c&&e&&e[$c])}function T0(e,t,i,s,u){var c=-1,f=e.length;for(i||(i=A0),u||(u=[]);++c<f;){var h=e[c];i(h)?Xf(u,h):u[u.length]=h}return u}var $f=Jf(Object.getPrototypeOf,Object),P0="[object Object]",O0=Function.prototype,R0=Object.prototype,Zf=O0.toString,D0=R0.hasOwnProperty,F0=Zf.call(Object);function Wf(e){if(!jn(e)||ni(e)!=P0)return!1;var t=$f(e);if(t===null)return!0;var i=D0.call(t,"constructor")&&t.constructor;return typeof i=="function"&&i instanceof i&&Zf.call(i)==F0}function G0(){this.__data__=new ar,this.size=0}function B0(e){var t=this.__data__,i=t.delete(e);return this.size=t.size,i}function U0(e){return this.__data__.get(e)}function z0(e){return this.__data__.has(e)}var j0=200;function q0(e,t){var i=this.__data__;if(i instanceof ar){var s=i.__data__;if(!js||s.length<j0-1)return s.push([e,t]),this.size=++i.size,this;i=this.__data__=new or(s)}return i.set(e,t),this.size=i.size,this}function kn(e){var t=this.__data__=new ar(e);this.size=t.size}kn.prototype.clear=G0;kn.prototype.delete=B0;kn.prototype.get=U0;kn.prototype.has=z0;kn.prototype.set=q0;var Kf=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Zc=Kf&&typeof module=="object"&&module&&!module.nodeType&&module,Wc=Zc&&Zc.exports===Kf?En.Buffer:void 0,Kc=Wc?Wc.allocUnsafe:void 0;function Qf(e,t){if(t)return e.slice();var i=e.length,s=Kc?Kc(i):new e.constructor(i);return e.copy(s),s}function Y0(e,t){for(var i=-1,s=e==null?0:e.length,u=0,c=[];++i<s;){var f=e[i];t(f,i,e)&&(c[u++]=f)}return c}function H0(){return[]}var J0=Object.prototype.propertyIsEnumerable,Qc=Object.getOwnPropertySymbols,V0=Qc?function(e){return e==null?[]:(e=Object(e),Y0(Qc(e),function(t){return J0.call(e,t)}))}:H0;function X0(e,t,i){var s=t(e);return bt(e)?s:Xf(s,i(e))}function xu(e){return X0(e,fo,V0)}var Eu=ii(En,"DataView"),bu=ii(En,"Promise"),Li=ii(En,"Set"),eh="[object Map]",$0="[object Object]",th="[object Promise]",nh="[object Set]",rh="[object WeakMap]",ih="[object DataView]",Z0=ri(Eu),W0=ri(js),K0=ri(bu),Q0=ri(Li),ey=ri(wu),mn=ni;(Eu&&mn(new Eu(new ArrayBuffer(1)))!=ih||js&&mn(new js)!=eh||bu&&mn(bu.resolve())!=th||Li&&mn(new Li)!=nh||wu&&mn(new wu)!=rh)&&(mn=function(e){var t=ni(e),i=t==$0?e.constructor:void 0,s=i?ri(i):"";if(s)switch(s){case Z0:return ih;case W0:return eh;case K0:return th;case Q0:return nh;case ey:return rh}return t});var ty=Object.prototype.hasOwnProperty;function ny(e){var t=e.length,i=new e.constructor(t);return t&&typeof e[0]=="string"&&ty.call(e,"index")&&(i.index=e.index,i.input=e.input),i}var Va=En.Uint8Array;function kl(e){var t=new e.constructor(e.byteLength);return new Va(t).set(new Va(e)),t}function ry(e,t){var i=kl(e.buffer);return new e.constructor(i,e.byteOffset,e.byteLength)}var iy=/\w*$/;function sy(e){var t=new e.constructor(e.source,iy.exec(e));return t.lastIndex=e.lastIndex,t}var sh=an?an.prototype:void 0,ah=sh?sh.valueOf:void 0;function ay(e){return ah?Object(ah.call(e)):{}}function eg(e,t){var i=t?kl(e.buffer):e.buffer;return new e.constructor(i,e.byteOffset,e.length)}var oy="[object Boolean]",uy="[object Date]",ly="[object Map]",cy="[object Number]",hy="[object RegExp]",fy="[object Set]",gy="[object String]",dy="[object Symbol]",py="[object ArrayBuffer]",my="[object DataView]",vy="[object Float32Array]",yy="[object Float64Array]",_y="[object Int8Array]",wy="[object Int16Array]",ky="[object Int32Array]",xy="[object Uint8Array]",Ey="[object Uint8ClampedArray]",by="[object Uint16Array]",Sy="[object Uint32Array]";function Iy(e,t,i){var s=e.constructor;switch(t){case py:return kl(e);case oy:case uy:return new s(+e);case my:return ry(e);case vy:case yy:case _y:case wy:case ky:case xy:case Ey:case by:case Sy:return eg(e,i);case ly:return new s;case cy:case gy:return new s(e);case hy:return sy(e);case fy:return new s;case dy:return ay(e)}}function tg(e){return typeof e.constructor=="function"&&!pl(e)?Zm($f(e)):{}}var My="[object Map]";function Ny(e){return jn(e)&&mn(e)==My}var oh=Oi&&Oi.isMap,Ly=oh?ho(oh):Ny,Cy="[object Set]";function Ay(e){return jn(e)&&mn(e)==Cy}var uh=Oi&&Oi.isSet,Ty=uh?ho(uh):Ay,Py=1,ng="[object Arguments]",Oy="[object Array]",Ry="[object Boolean]",Dy="[object Date]",Fy="[object Error]",rg="[object Function]",Gy="[object GeneratorFunction]",By="[object Map]",Uy="[object Number]",ig="[object Object]",zy="[object RegExp]",jy="[object Set]",qy="[object String]",Yy="[object Symbol]",Hy="[object WeakMap]",Jy="[object ArrayBuffer]",Vy="[object DataView]",Xy="[object Float32Array]",$y="[object Float64Array]",Zy="[object Int8Array]",Wy="[object Int16Array]",Ky="[object Int32Array]",Qy="[object Uint8Array]",e1="[object Uint8ClampedArray]",t1="[object Uint16Array]",n1="[object Uint32Array]",Ue={};Ue[ng]=Ue[Oy]=Ue[Jy]=Ue[Vy]=Ue[Ry]=Ue[Dy]=Ue[Xy]=Ue[$y]=Ue[Zy]=Ue[Wy]=Ue[Ky]=Ue[By]=Ue[Uy]=Ue[ig]=Ue[zy]=Ue[jy]=Ue[qy]=Ue[Yy]=Ue[Qy]=Ue[e1]=Ue[t1]=Ue[n1]=!0;Ue[Fy]=Ue[rg]=Ue[Hy]=!1;function Ra(e,t,i,s,u,c){var f,h=t&Py;if(f!==void 0)return f;if(!St(e))return e;var d=bt(e);if(d)f=ny(e);else{var m=mn(e),v=m==rg||m==Gy;if(Us(e))return Qf(e,h);if(m==ig||m==ng||v&&!u)f=v?{}:tg(e);else{if(!Ue[m])return u?e:{};f=Iy(e,m,h)}}c||(c=new kn);var y=c.get(e);if(y)return y;c.set(e,f),Ty(e)?e.forEach(function(S){f.add(Ra(S,t,i,S,e,c))}):Ly(e)&&e.forEach(function(S,b){f.set(b,Ra(S,t,i,b,e,c))});var k=d?void 0:xu(e);return av(k||e,function(S,b){k&&(b=S,S=e[b]),fl(f,b,Ra(S,t,i,b,e,c))}),f}var r1=1,i1=4;function Bt(e){return Ra(e,r1|i1)}var s1="__lodash_hash_undefined__";function a1(e){return this.__data__.set(e,s1),this}function o1(e){return this.__data__.has(e)}function Di(e){var t=-1,i=e==null?0:e.length;for(this.__data__=new or;++t<i;)this.add(e[t])}Di.prototype.add=Di.prototype.push=a1;Di.prototype.has=o1;function u1(e,t){for(var i=-1,s=e==null?0:e.length;++i<s;)if(t(e[i],i,e))return!0;return!1}function Xa(e,t){return e.has(t)}var l1=1,c1=2;function sg(e,t,i,s,u,c){var f=i&l1,h=e.length,d=t.length;if(h!=d&&!(f&&d>h))return!1;var m=c.get(e),v=c.get(t);if(m&&v)return m==t&&v==e;var y=-1,k=!0,S=i&c1?new Di:void 0;for(c.set(e,t),c.set(t,e);++y<h;){var b=e[y],P=t[y];if(s)var O=f?s(P,b,y,t,e,c):s(b,P,y,e,t,c);if(O!==void 0){if(O)continue;k=!1;break}if(S){if(!u1(t,function(G,L){if(!Xa(S,L)&&(b===G||u(b,G,i,s,c)))return S.push(L)})){k=!1;break}}else if(!(b===P||u(b,P,i,s,c))){k=!1;break}}return c.delete(e),c.delete(t),k}function h1(e){var t=-1,i=Array(e.size);return e.forEach(function(s,u){i[++t]=[u,s]}),i}function xl(e){var t=-1,i=Array(e.size);return e.forEach(function(s){i[++t]=s}),i}var f1=1,g1=2,d1="[object Boolean]",p1="[object Date]",m1="[object Error]",v1="[object Map]",y1="[object Number]",_1="[object RegExp]",w1="[object Set]",k1="[object String]",x1="[object Symbol]",E1="[object ArrayBuffer]",b1="[object DataView]",lh=an?an.prototype:void 0,Vo=lh?lh.valueOf:void 0;function S1(e,t,i,s,u,c,f){switch(i){case b1:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case E1:return!(e.byteLength!=t.byteLength||!c(new Va(e),new Va(t)));case d1:case p1:case y1:return Ks(+e,+t);case m1:return e.name==t.name&&e.message==t.message;case _1:case k1:return e==t+"";case v1:var h=h1;case w1:var d=s&f1;if(h||(h=xl),e.size!=t.size&&!d)return!1;var m=f.get(e);if(m)return m==t;s|=g1,f.set(e,t);var v=sg(h(e),h(t),s,u,c,f);return f.delete(e),v;case x1:if(Vo)return Vo.call(e)==Vo.call(t)}return!1}var I1=1,M1=Object.prototype.hasOwnProperty;function N1(e,t,i,s,u,c){var f=i&I1,h=xu(e),d=h.length;if(d!=xu(t).length&&!f)return!1;for(var m=d;m--;){var v=h[m];if(!(f?v in t:M1.call(t,v)))return!1}var y=c.get(e),k=c.get(t);if(y&&k)return y==t&&k==e;var S=!0;c.set(e,t),c.set(t,e);for(var b=f;++m<d;){v=h[m];var P=e[v],O=t[v];if(s)var G=f?s(O,P,v,t,e,c):s(P,O,v,e,t,c);if(!(G===void 0?P===O||u(P,O,i,s,c):G)){S=!1;break}b||(b=v=="constructor")}if(S&&!b){var L=e.constructor,j=t.constructor;L!=j&&"constructor"in e&&"constructor"in t&&!(typeof L=="function"&&L instanceof L&&typeof j=="function"&&j instanceof j)&&(S=!1)}return c.delete(e),c.delete(t),S}var L1=1,ch="[object Arguments]",hh="[object Array]",ma="[object Object]",fh=Object.prototype.hasOwnProperty;function C1(e,t,i,s,u,c){var f=bt(e),h=bt(t),d=f?hh:mn(e),m=h?hh:mn(t);d=d==ch?ma:d,m=m==ch?ma:m;var v=d==ma,y=m==ma,k=d==m;if(k&&Us(e)){if(!Us(t))return!1;f=!0,v=!1}if(k&&!v)return c||(c=new kn),f||ml(e)?sg(e,t,i,s,u,c):S1(e,t,d,i,s,u,c);if(!(i&L1)){var S=v&&fh.call(e,"__wrapped__"),b=y&&fh.call(t,"__wrapped__");if(S||b){var P=S?e.value():e,O=b?t.value():t;return c||(c=new kn),u(P,O,i,s,c)}}return k?(c||(c=new kn),N1(e,t,i,s,u,c)):!1}function mo(e,t,i,s,u){return e===t?!0:e==null||t==null||!jn(e)&&!jn(t)?e!==e&&t!==t:C1(e,t,i,s,mo,u)}var A1=1,T1=2;function P1(e,t,i,s){var u=i.length,c=u;if(e==null)return!c;for(e=Object(e);u--;){var f=i[u];if(f[2]?f[1]!==e[f[0]]:!(f[0]in e))return!1}for(;++u<c;){f=i[u];var h=f[0],d=e[h],m=f[1];if(f[2]){if(d===void 0&&!(h in e))return!1}else{var v=new kn,y;if(!(y===void 0?mo(m,d,A1|T1,s,v):y))return!1}}return!0}function ag(e){return e===e&&!St(e)}function O1(e){for(var t=fo(e),i=t.length;i--;){var s=t[i],u=e[s];t[i]=[s,u,ag(u)]}return t}function og(e,t){return function(i){return i==null?!1:i[e]===t&&(t!==void 0||e in Object(i))}}function R1(e){var t=O1(e);return t.length==1&&t[0][2]?og(t[0][0],t[0][1]):function(i){return i===e||P1(i,e,t)}}function D1(e,t){return e!=null&&t in Object(e)}function F1(e,t,i){t=_l(t,e);for(var s=-1,u=t.length,c=!1;++s<u;){var f=Qs(t[s]);if(!(c=e!=null&&i(e,f)))break;e=e[f]}return c||++s!=u?c:(u=e==null?0:e.length,!!u&&dl(u)&&co(f,u)&&(bt(e)||Bs(e)))}function G1(e,t){return e!=null&&F1(e,t,D1)}var B1=1,U1=2;function z1(e,t){return vl(e)&&ag(t)?og(Qs(e),t):function(i){var s=Ri(i,e);return s===void 0&&s===t?G1(i,e):mo(t,s,B1|U1)}}function j1(e){return function(t){return t?.[e]}}function q1(e){return function(t){return wl(t,e)}}function Y1(e){return vl(e)?j1(Qs(e)):q1(e)}function ug(e){return typeof e=="function"?e:e==null?lo:typeof e=="object"?bt(e)?z1(e[0],e[1]):R1(e):Y1(e)}function H1(e,t,i,s){for(var u=-1,c=e==null?0:e.length;++u<c;){var f=e[u];t(s,f,i(f),e)}return s}function J1(e){return function(t,i,s){for(var u=-1,c=Object(t),f=s(t),h=f.length;h--;){var d=f[++u];if(i(c[d],d,c)===!1)break}return t}}var lg=J1();function V1(e,t){return e&&lg(e,t,fo)}function X1(e,t){return function(i,s){if(i==null)return i;if(!Hi(i))return e(i,s);for(var u=i.length,c=-1,f=Object(i);++c<u&&s(f[c],c,f)!==!1;);return i}}var cg=X1(V1);function $1(e,t,i,s){return cg(e,function(u,c,f){t(s,u,i(u),f)}),s}function hg(e,t){return function(i,s){var u=bt(i)?H1:$1,c=t?t():{};return u(i,e,ug(s),c)}}var Z1=Object.prototype.hasOwnProperty,W1=hg(function(e,t,i){Z1.call(e,i)?++e[i]:Ws(e,i,1)}),Xo=function(){return En.Date.now()},K1="Expected a function",Q1=Math.max,e_=Math.min;function fg(e,t,i){var s,u,c,f,h,d,m=0,v=!1,y=!1,k=!0;if(typeof e!="function")throw new TypeError(K1);t=zc(t)||0,St(i)&&(v=!!i.leading,y="maxWait"in i,c=y?Q1(zc(i.maxWait)||0,t):c,k="trailing"in i?!!i.trailing:k);function S(H){var $=s,w=u;return s=u=void 0,m=H,f=e.apply(w,$),f}function b(H){return m=H,h=setTimeout(G,t),v?S(H):f}function P(H){var $=H-d,w=H-m,E=t-$;return y?e_(E,c-w):E}function O(H){var $=H-d,w=H-m;return d===void 0||$>=t||$<0||y&&w>=c}function G(){var H=Xo();if(O(H))return L(H);h=setTimeout(G,P(H))}function L(H){return h=void 0,k&&s?S(H):(s=u=void 0,f)}function j(){h!==void 0&&clearTimeout(h),m=0,s=d=u=h=void 0}function V(){return h===void 0?f:L(Xo())}function X(){var H=Xo(),$=O(H);if(s=arguments,u=this,d=H,$){if(h===void 0)return b(d);if(y)return clearTimeout(h),h=setTimeout(G,t),S(d)}return h===void 0&&(h=setTimeout(G,t)),f}return X.cancel=j,X.flush=V,X}function Su(e,t,i){(i!==void 0&&!Ks(e[t],i)||i===void 0&&!(t in e))&&Ws(e,t,i)}function gg(e){return jn(e)&&Hi(e)}function Iu(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}function t_(e){return dv(e,Vf(e))}function n_(e,t,i,s,u,c,f){var h=Iu(e,i),d=Iu(t,i),m=f.get(d);if(m){Su(e,i,m);return}var v=c?c(h,d,i+"",e,t,f):void 0,y=v===void 0;if(y){var k=bt(d),S=!k&&Us(d),b=!k&&!S&&ml(d);v=d,k||S||b?bt(h)?v=h:gg(h)?v=Qm(h):S?(y=!1,v=Qf(d,!0)):b?(y=!1,v=eg(d,!0)):v=[]:Wf(d)||Bs(d)?(v=h,Bs(h)?v=t_(h):(!St(h)||hl(h))&&(v=tg(d))):y=!1}y&&(f.set(d,v),u(v,d,s,c,f),f.delete(d)),Su(e,i,v)}function El(e,t,i,s,u){e!==t&&lg(t,function(c,f){if(u||(u=new kn),St(c))n_(e,t,f,i,El,s,u);else{var h=s?s(Iu(e,f),c,f+"",e,t,u):void 0;h===void 0&&(h=c),Su(e,f,h)}},Vf)}var r_=zf(function(e,t,i,s){El(e,t,i,s)});function i_(e,t,i){for(var s=-1,u=e==null?0:e.length;++s<u;)if(i(t,e[s]))return!0;return!1}function s_(e,t){var i=-1,s=Hi(e)?Array(e.length):[];return cg(e,function(u,c,f){s[++i]=t(u,c,f)}),s}function a_(e,t){return Ni(t,function(i){return e[i]})}function o_(e){return e==null?[]:a_(e,fo(e))}var u_=Math.min;function l_(e,t,i){for(var s=Uf,u=e[0].length,c=e.length,f=c,h=Array(c),d=1/0,m=[];f--;){var v=e[f];d=u_(v.length,d),h[f]=u>=120&&v.length>=120?new Di(f&&v):void 0}v=e[0];var y=-1,k=h[0];e:for(;++y<u&&m.length<d;){var S=v[y],b=S;if(S=S!==0?S:0,!(k?Xa(k,b):s(m,b))){for(f=c;--f;){var P=h[f];if(!(P?Xa(P,b):s(e[f],b)))continue e}k&&k.push(b),m.push(S)}}return m}function c_(e){return gg(e)?e:[]}var h_=gl(function(e){var t=Ni(e,c_);return t.length&&t[0]===e[0]?l_(t):[]});function Ji(e,t){return mo(e,t)}var f_=hg(function(e,t,i){Ws(e,i,t)}),g_=zf(function(e,t,i){El(e,t,i)});function d_(e,t,i,s){if(!St(e))return e;t=_l(t,e);for(var u=-1,c=t.length,f=c-1,h=e;h!=null&&++u<c;){var d=Qs(t[u]),m=i;if(d==="__proto__"||d==="constructor"||d==="prototype")return e;if(u!=f){var v=h[d];m=void 0,m===void 0&&(m=St(v)?v:co(t[u+1])?[]:{})}fl(h,d,m),h=h[d]}return e}function p_(e,t){var i=e.length;for(e.sort(t);i--;)e[i]=e[i].value;return e}function m_(e,t){if(e!==t){var i=e!==void 0,s=e===null,u=e===e,c=Pi(e),f=t!==void 0,h=t===null,d=t===t,m=Pi(t);if(!h&&!m&&!c&&e>t||c&&f&&d&&!h&&!m||s&&f&&d||!i&&d||!u)return 1;if(!s&&!c&&!m&&e<t||m&&i&&u&&!s&&!c||h&&i&&u||!f&&u||!d)return-1}return 0}function v_(e,t,i){for(var s=-1,u=e.criteria,c=t.criteria,f=u.length,h=i.length;++s<f;){var d=m_(u[s],c[s]);if(d)return s>=h?d:d*(i[s]=="desc"?-1:1)}return e.index-t.index}function y_(e,t,i){t.length?t=Ni(t,function(u){return bt(u)?function(c){return wl(c,u.length===1?u[0]:u)}:u}):t=[lo];var s=-1;return t=Ni(t,ho(ug)),p_(s_(e,function(u,c,f){return{criteria:Ni(t,function(h){return h(u)}),index:++s,value:u}}),function(u,c){return v_(u,c,i)})}function __(e,t,i){return e==null?e:d_(e,t,i)}var gh=gl(function(e,t){if(e==null)return[];var i=t.length;return i>1&&ku(e,t[0],t[1])?t=[]:i>2&&ku(t[0],t[1],t[2])&&(t=[t[0]]),y_(e,T0(t),[])}),w_="Expected a function";function dg(e,t,i){var s=!0,u=!0;if(typeof e!="function")throw new TypeError(w_);return St(i)&&(s="leading"in i?!!i.leading:s,u="trailing"in i?!!i.trailing:u),fg(e,t,{leading:s,maxWait:t,trailing:u})}var k_=Li&&1/xl(new Li([,-0]))[1]==1/0?function(e){return new Li(e)}:Km,x_=200;function E_(e,t,i){var s=-1,u=Uf,c=e.length,f=!0,h=[],d=h;if(i)f=!1,u=i_;else if(c>=x_){var m=k_(e);if(m)return xl(m);f=!1,u=Xa,d=new Di}else d=h;e:for(;++s<c;){var v=e[s],y=v;if(v=i||v!==0?v:0,f&&y===y){for(var k=d.length;k--;)if(d[k]===y)continue e;h.push(v)}else u(d,y,i)||(d!==h&&d.push(y),h.push(v))}return h}function dh(e,t){return t=typeof t=="function"?t:void 0,e&&e.length?E_(e,void 0,t):[]}function pg(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Mu={exports:{}},b_=Mu.exports,ph;function S_(){return ph||(ph=1,(function(e){(function(t,i){e.exports?e.exports=i():t.log=i()})(b_,function(){var t=function(){},i="undefined",s=typeof window!==i&&typeof window.navigator!==i&&/Trident\/|MSIE /.test(window.navigator.userAgent),u=["trace","debug","info","warn","error"],c={},f=null;function h(P,O){var G=P[O];if(typeof G.bind=="function")return G.bind(P);try{return Function.prototype.bind.call(G,P)}catch{return function(){return Function.prototype.apply.apply(G,[P,arguments])}}}function d(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function m(P){return P==="debug"&&(P="log"),typeof console===i?!1:P==="trace"&&s?d:console[P]!==void 0?h(console,P):console.log!==void 0?h(console,"log"):t}function v(){for(var P=this.getLevel(),O=0;O<u.length;O++){var G=u[O];this[G]=O<P?t:this.methodFactory(G,P,this.name)}if(this.log=this.debug,typeof console===i&&P<this.levels.SILENT)return"No console available for logging"}function y(P){return function(){typeof console!==i&&(v.call(this),this[P].apply(this,arguments))}}function k(P,O,G){return m(P)||y.apply(this,arguments)}function S(P,O){var G=this,L,j,V,X="loglevel";typeof P=="string"?X+=":"+P:typeof P=="symbol"&&(X=void 0);function H(R){var T=(u[R]||"silent").toUpperCase();if(!(typeof window===i||!X)){try{window.localStorage[X]=T;return}catch{}try{window.document.cookie=encodeURIComponent(X)+"="+T+";"}catch{}}}function $(){var R;if(!(typeof window===i||!X)){try{R=window.localStorage[X]}catch{}if(typeof R===i)try{var T=window.document.cookie,F=encodeURIComponent(X),D=T.indexOf(F+"=");D!==-1&&(R=/^([^;]+)/.exec(T.slice(D+F.length+1))[1])}catch{}return G.levels[R]===void 0&&(R=void 0),R}}function w(){if(!(typeof window===i||!X)){try{window.localStorage.removeItem(X)}catch{}try{window.document.cookie=encodeURIComponent(X)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}function E(R){var T=R;if(typeof T=="string"&&G.levels[T.toUpperCase()]!==void 0&&(T=G.levels[T.toUpperCase()]),typeof T=="number"&&T>=0&&T<=G.levels.SILENT)return T;throw new TypeError("log.setLevel() called with invalid level: "+R)}G.name=P,G.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},G.methodFactory=O||k,G.getLevel=function(){return V??j??L},G.setLevel=function(R,T){return V=E(R),T!==!1&&H(V),v.call(G)},G.setDefaultLevel=function(R){j=E(R),$()||G.setLevel(R,!1)},G.resetLevel=function(){V=null,w(),v.call(G)},G.enableAll=function(R){G.setLevel(G.levels.TRACE,R)},G.disableAll=function(R){G.setLevel(G.levels.SILENT,R)},G.rebuild=function(){if(f!==G&&(L=E(f.getLevel())),v.call(G),f===G)for(var R in c)c[R].rebuild()},L=E(f?f.getLevel():"WARN");var M=$();M!=null&&(V=E(M)),v.call(G)}f=new S,f.getLogger=function(P){if(typeof P!="symbol"&&typeof P!="string"||P==="")throw new TypeError("You must supply a name when creating a logger.");var O=c[P];return O||(O=c[P]=new S(P,f.methodFactory)),O};var b=typeof window!==i?window.log:void 0;return f.noConflict=function(){return typeof window!==i&&window.log===f&&(window.log=b),f},f.getLoggers=function(){return c},f.default=f,f})})(Mu)),Mu.exports}var ee=pg(S_()),I_=(e,t)=>{let i=null;try{e.forEach(s=>{if(t(s))throw i=s,new Error("found")})}catch{}return i},M_=e=>{const t=new Set;return e.filter(i=>t.has(i.id)?!1:(t.add(i.id),!0))};function Nu(e,t,i=[]){t(e,i),Array.isArray(e)?e.forEach((s,u)=>Nu(s,t,[...i,u])):Wf(e)?Object.entries(e).forEach(([s,u])=>Nu(u,t,[...i,s])):e!==null&&typeof e=="object"&&ee.warn(`forEachDeep: unknown collection type (${e}), path "${i.join(".")}"`)}var N_=e=>{const t=["shape_markers"],i=e.settings.controlsUiEnabledByDefault;Nu(e,(s,u)=>{const c=u.at(2);if(u.length===4&&u.at(-1)==="uiEnabled"){if(t.includes(c))return;__(e,u,i)}})},Lu=()=>Bt(vm),bl=Array.isArray,L_=Array.prototype.indexOf,Fi=Array.prototype.includes,vo=Array.from,mg=Object.defineProperty,Ts=Object.getOwnPropertyDescriptor,C_=Object.getOwnPropertyDescriptors,A_=Object.prototype,T_=Array.prototype,vg=Object.getPrototypeOf,mh=Object.isExtensible,Yr=()=>{};function P_(e){for(var t=0;t<e.length;t++)e[t]()}function yg(){var e,t;return{promise:new Promise((i,s)=>{e=i,t=s}),resolve:e,reject:t}}function $a(e,t){if(Array.isArray(e))return e;if(!(Symbol.iterator in e))return Array.from(e);const i=[];for(const s of e)if(i.push(s),i.length===t)break;return i}var At=2,yo=4,_o=8,ea=16,Vi=32,_g=64,Cu=128,xn=512,ft=1024,Gt=2048,qn=4096,rn=8192,Xi=16384,$i=32768,qs=65536,O_=1<<17,R_=1<<18,wg=1<<19,Gn=1<<25,Za=65536,Au=1<<21,yr=1<<23,Ps=Symbol("$state"),D_=Symbol(""),jr=new class extends Error{name="StaleReactionError";message="The reaction that called `getAbortSignal()` was re-run or destroyed"};function kg(e){return e===this.v}function xg(e,t){return e!=e?t==t:e!==t||e!==null&&typeof e=="object"||typeof e=="function"}function Eg(e){return!xg(e,this.v)}function bg(e){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function F_(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function G_(e,t,i){throw new Error("https://svelte.dev/e/each_key_duplicate")}function B_(e){throw new Error("https://svelte.dev/e/effect_in_teardown")}function U_(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function z_(e){throw new Error("https://svelte.dev/e/effect_orphan")}function j_(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function q_(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function Y_(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function H_(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function J_(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}var V_=1,X_=2,Sg=4,$_=8,Z_=16,W_=1,K_=2,ht=Symbol(),Ig="http://www.w3.org/1999/xhtml",Q_="http://www.w3.org/2000/svg",ew="http://www.w3.org/1998/Math/MathML",mt=null;function Gi(e){mt=e}function Mg(e){return tw().get(e)}function Zi(e,t=!1,i){mt={p:mt,i:!1,c:null,e:null,s:e,x:null,l:null}}function Wi(e){var t=mt,i=t.e;if(i!==null){t.e=null;for(var s of i)ed(s)}return t.i=!0,mt=t.p,{}}function Ng(){return!0}function tw(e){return mt===null&&bg(),mt.c??=new Map(nw(mt)||void 0)}function nw(e){let t=e.p;for(;t!==null;){const i=t.c;if(i!==null)return i;t=t.p}return null}var Ii=[];function rw(){var e=Ii;Ii=[],P_(e)}function Hr(e){if(Ii.length===0){var t=Ii;queueMicrotask(()=>{t===Ii&&rw()})}Ii.push(e)}function iw(){console.warn("https://svelte.dev/e/select_multiple_invalid_value")}function sw(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}function ws(e){if(typeof e!="object"||e===null||Ps in e)return e;const t=vg(e);if(t!==A_&&t!==T_)return e;var i=new Map,s=bl(e),u=Rn(0),c=Vr,f=h=>{if(Vr===c)return h();var d=Se,m=Vr;on(null),xh(c);var v=h();return on(d),xh(m),v};return s&&i.set("length",Rn(e.length)),new Proxy(e,{defineProperty(h,d,m){(!("value"in m)||m.configurable===!1||m.enumerable===!1||m.writable===!1)&&q_();var v=i.get(d);return v===void 0?f(()=>{var y=Rn(m.value);return i.set(d,y),y}):Et(v,m.value,!0),!0},deleteProperty(h,d){var m=i.get(d);if(m===void 0){if(d in h){const v=f(()=>Rn(ht));i.set(d,v),Os(u)}}else Et(m,ht),Os(u);return!0},get(h,d,m){if(d===Ps)return e;var v=i.get(d),y=d in h;if(v===void 0&&(!y||Ts(h,d)?.writable)&&(v=f(()=>Rn(ws(y?h[d]:ht))),i.set(d,v)),v!==void 0){var k=ye(v);return k===ht?void 0:k}return Reflect.get(h,d,m)},getOwnPropertyDescriptor(h,d){var m=Reflect.getOwnPropertyDescriptor(h,d);if(m&&"value"in m){var v=i.get(d);v&&(m.value=ye(v))}else if(m===void 0){var y=i.get(d),k=y?.v;if(y!==void 0&&k!==ht)return{enumerable:!0,configurable:!0,value:k,writable:!0}}return m},has(h,d){if(d===Ps)return!0;var m=i.get(d),v=m!==void 0&&m.v!==ht||Reflect.has(h,d);return(m!==void 0||Oe!==null&&(!v||Ts(h,d)?.writable))&&(m===void 0&&(m=f(()=>Rn(v?ws(h[d]):ht)),i.set(d,m)),ye(m)===ht)?!1:v},set(h,d,m,v){var y=i.get(d),k=d in h;if(s&&d==="length")for(var S=m;S<y.v;S+=1){var b=i.get(S+"");b!==void 0?Et(b,ht):S in h&&(b=f(()=>Rn(ht)),i.set(S+"",b))}if(y===void 0)(!k||Ts(h,d)?.writable)&&(y=f(()=>Rn(void 0)),Et(y,ws(m)),i.set(d,y));else{k=y.v!==ht;var P=f(()=>ws(m));Et(y,P)}var O=Reflect.getOwnPropertyDescriptor(h,d);if(O?.set&&O.set.call(v,m),!k){if(s&&typeof d=="string"){var G=i.get("length"),L=Number(d);Number.isInteger(L)&&L>=G.v&&Et(G,L+1)}Os(u)}return!0},ownKeys(h){ye(u);var d=Reflect.ownKeys(h).filter(y=>{var k=i.get(y);return k===void 0||k.v!==ht});for(var[m,v]of i)v.v!==ht&&!(m in h)&&d.push(m);return d},setPrototypeOf(){Y_()}})}function vh(e){try{if(e!==null&&typeof e=="object"&&Ps in e)return e[Ps]}catch{}return e}function aw(e,t){return Object.is(vh(e),vh(t))}var yh,Lg,Cg,Ag;function ow(){if(yh===void 0){yh=window,Lg=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,i=Text.prototype;Cg=Ts(t,"firstChild").get,Ag=Ts(t,"nextSibling").get,mh(e)&&(e.__click=void 0,e.__className=void 0,e.__attributes=null,e.__style=void 0,e.__e=void 0),mh(i)&&(i.__t=void 0)}}function nr(e=""){return document.createTextNode(e)}function Jr(e){return Cg.call(e)}function ta(e){return Ag.call(e)}function nn(e,t){return Jr(e)}function rr(e,t=!1){var i=Jr(e);return i instanceof Comment&&i.data===""?ta(i):i}function Ys(e,t=1,i=!1){let s=e;for(;t--;)s=ta(s);return s}function uw(e){e.textContent=""}function Tg(){return!1}function Pg(e,t,i){return document.createElementNS(t??Ig,e,void 0)}function Og(e){var t=Oe;if(t===null)return Se.f|=yr,e;if((t.f&$i)===0&&(t.f&yo)===0)throw e;mr(e,t)}function mr(e,t){for(;t!==null;){if((t.f&Cu)!==0){if((t.f&$i)===0)throw e;try{t.b.error(e);return}catch(i){e=i}}t=t.parent}throw e}var lw=-7169;function We(e,t){e.f=e.f&lw|t}function Sl(e){(e.f&xn)!==0||e.deps===null?We(e,ft):We(e,qn)}function Rg(e){if(e!==null)for(const t of e)!(t.f&At)||!(t.f&Za)||(t.f^=Za,Rg(t.deps))}function Dg(e,t,i){(e.f&Gt)!==0?t.add(e):e.f&qn&&i.add(e),Rg(e.deps),We(e,ft)}var va=new Set,qe=null,Tu=null,vn=null,Kt=[],Il=null,Bi=null,cw=1,Ci=class Fg{id=cw++;current=new Map;previous=new Map;#e=new Set;#o=new Set;#t=0;#a=0;#n=null;#s=new Set;#r=new Set;#i=new Map;is_fork=!1;#u=!1;#c(){return this.is_fork||this.#a>0}skip_effect(t){this.#i.has(t)||this.#i.set(t,{d:[],m:[]})}unskip_effect(t){var i=this.#i.get(t);if(i){this.#i.delete(t);for(var s of i.d)We(s,Gt),Bn(s);for(s of i.m)We(s,qn),Bn(s)}}process(t){Kt=[],this.apply();var i=Bi=[],s=[];for(const u of t)this.#l(u,i,s);if(Bi=null,this.#c()){this.#h(s),this.#h(i);for(const[u,c]of this.#i)Ug(u,c)}else{Tu=this,qe=null;for(const u of this.#e)u(this);this.#e.clear(),this.#t===0&&this.#f(),_h(s),_h(i),this.#s.clear(),this.#r.clear(),Tu=null,this.#n?.resolve()}vn=null}#l(t,i,s){t.f^=ft;for(var u=t.first;u!==null;){var c=u.f,f=(c&96)!==0,h=f&&(c&ft)!==0,d=(c&rn)!==0;if(!(h||this.#i.has(u))&&u.fn!==null){f?d||(u.f^=ft):(c&yo)!==0?i.push(u):(c&16777224)!==0&&d?s.push(u):na(u)&&(zi(u),c&ea&&(this.#r.add(u),d&&We(u,Gt)));var m=u.first;if(m!==null){u=m;continue}}for(;u!==null;){var v=u.next;if(v!==null){u=v;break}u=u.parent}}}#h(t){for(var i=0;i<t.length;i+=1)Dg(t[i],this.#s,this.#r)}capture(t,i){i!==ht&&!this.previous.has(t)&&this.previous.set(t,i),!(t.f&yr)&&(this.current.set(t,t.v),vn?.set(t,t.v))}activate(){qe=this,this.apply()}deactivate(){qe===this&&(qe=null,vn=null)}flush(){if(Kt.length>0)qe=this,hw();else if(this.#t===0&&!this.is_fork){for(const t of this.#e)t(this);this.#e.clear(),this.#f(),this.#n?.resolve()}this.deactivate()}discard(){for(const t of this.#o)t(this);this.#o.clear()}#f(){if(va.size>1){this.previous.clear();var t=qe,i=vn,s=!0;for(const c of va){if(c===this){s=!1;continue}const f=[];for(const[d,m]of this.current){if(c.current.has(d))if(s&&m!==c.current.get(d))c.current.set(d,m);else continue;f.push(d)}if(f.length===0)continue;const h=[...c.current.keys()].filter(d=>!this.current.has(d));if(h.length>0){var u=Kt;Kt=[];const d=new Set,m=new Map;for(const v of f)Gg(v,h,d,m);if(Kt.length>0){qe=c,c.apply();for(const v of Kt)c.#l(v,[],[]);c.deactivate()}Kt=u}}qe=t,vn=i}this.#i.clear(),va.delete(this)}increment(t){this.#t+=1,t&&(this.#a+=1)}decrement(t){this.#t-=1,t&&(this.#a-=1),!this.#u&&(this.#u=!0,Hr(()=>{this.#u=!1,this.#c()?Kt.length>0&&this.flush():this.revive()}))}revive(){for(const t of this.#s)this.#r.delete(t),We(t,Gt),Bn(t);for(const t of this.#r)We(t,qn),Bn(t);this.flush()}oncommit(t){this.#e.add(t)}ondiscard(t){this.#o.add(t)}settled(){return(this.#n??=yg()).promise}static ensure(){if(qe===null){const t=qe=new Fg;va.add(qe),Hr(()=>{qe===t&&t.flush()})}return qe}apply(){}};function hw(){try{for(var e=0;Kt.length>0;){var t=Ci.ensure();e++>1e3&&fw(),t.process(Kt),_r.clear()}}finally{Kt=[],Il=null,Bi=null}}function fw(){try{j_()}catch(e){mr(e,Il)}}var er=null;function _h(e){var t=e.length;if(t!==0){for(var i=0;i<t;){var s=e[i++];if((s.f&24576)===0&&na(s)&&(er=new Set,zi(s),s.deps===null&&s.first===null&&s.nodes===null&&s.teardown===null&&s.ac===null&&id(s),er?.size>0)){_r.clear();for(const u of er){if((u.f&24576)!==0)continue;const c=[u];let f=u.parent;for(;f!==null;)er.has(f)&&(er.delete(f),c.push(f)),f=f.parent;for(let h=c.length-1;h>=0;h--){const d=c[h];!(d.f&24576)&&zi(d)}}er.clear()}}er=null}}function Gg(e,t,i,s){if(!i.has(e)&&(i.add(e),e.reactions!==null))for(const u of e.reactions){const c=u.f;(c&At)!==0?Gg(u,t,i,s):c&4194320&&!(c&Gt)&&Bg(u,t,s)&&(We(u,Gt),Bn(u))}}function Bg(e,t,i){const s=i.get(e);if(s!==void 0)return s;if(e.deps!==null)for(const u of e.deps){if(Fi.call(t,u))return!0;if((u.f&At)!==0&&Bg(u,t,i))return i.set(u,!0),!0}return i.set(e,!1),!1}function Bn(e){var t=Il=e,i=t.b;if(i?.is_pending&&(e.f&16777228)!==0&&(e.f&$i)===0){i.defer_effect(e);return}for(;t.parent!==null;){t=t.parent;var s=t.f;if(Bi!==null&&t===Oe&&(e.f&_o)===0)return;if((s&96)!==0){if((s&ft)===0)return;t.f^=ft}}Kt.push(t)}function Ug(e,t){if(!((e.f&Vi)!==0&&(e.f&ft)!==0)){(e.f&Gt)!==0?t.d.push(e):e.f&qn&&t.m.push(e),We(e,ft);for(var i=e.first;i!==null;)Ug(i,t),i=i.next}}function gw(e){let t=0,i=Zr(0),s;return()=>{Cl()&&(ye(i),td(()=>(t===0&&(s=wo(()=>e(()=>Os(i)))),t+=1,()=>{Hr(()=>{t-=1,t===0&&(s?.(),s=void 0,Os(i))})})))}}var dw=589824;function pw(e,t,i,s){new mw(e,t,i,s)}var mw=class{parent;is_pending=!1;transform_error;#e;#o=null;#t;#a;#n;#s=null;#r=null;#i=null;#u=null;#c=0;#l=0;#h=!1;#f=new Set;#d=new Set;#g=null;#_=gw(()=>(this.#g=Zr(this.#c),()=>{this.#g=null}));constructor(e,t,i,s){this.#e=e,this.#t=t,this.#a=u=>{var c=Oe;c.b=this,c.f|=Cu,i(u)},this.parent=Oe.b,this.transform_error=s??this.parent?.transform_error??(u=>u),this.#n=Tl(()=>{this.#v()},dw)}#w(){try{this.#s=en(()=>this.#a(this.#e))}catch(e){this.error(e)}}#k(e){const t=this.#t.failed;t&&(this.#i=en(()=>{t(this.#e,()=>e,()=>()=>{})}))}#x(){const e=this.#t.pending;e&&(this.is_pending=!0,this.#r=en(()=>e(this.#e)),Hr(()=>{var t=this.#u=document.createDocumentFragment(),i=nr();t.append(i),this.#s=this.#m(()=>(Ci.ensure(),en(()=>this.#a(i)))),this.#l===0&&(this.#e.before(t),this.#u=null,Xr(this.#r,()=>{this.#r=null}),this.#p())}))}#v(){try{if(this.is_pending=this.has_pending_snippet(),this.#l=0,this.#c=0,this.#s=en(()=>{this.#a(this.#e)}),this.#l>0){var e=this.#u=document.createDocumentFragment();Rl(this.#s,e);const t=this.#t.pending;this.#r=en(()=>t(this.#e))}else this.#p()}catch(t){this.error(t)}}#p(){this.is_pending=!1;for(const e of this.#f)We(e,Gt),Bn(e);for(const e of this.#d)We(e,qn),Bn(e);this.#f.clear(),this.#d.clear()}defer_effect(e){Dg(e,this.#f,this.#d)}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!this.#t.pending}#m(e){var t=Oe,i=Se,s=mt;Yn(this.#n),on(this.#n),Gi(this.#n.ctx);try{return e()}catch(u){return Og(u),null}finally{Yn(t),on(i),Gi(s)}}#y(e){if(!this.has_pending_snippet()){this.parent&&this.parent.#y(e);return}this.#l+=e,this.#l===0&&(this.#p(),this.#r&&Xr(this.#r,()=>{this.#r=null}),this.#u&&(this.#e.before(this.#u),this.#u=null))}update_pending_count(e){this.#y(e),this.#c+=e,!(!this.#g||this.#h)&&(this.#h=!0,Hr(()=>{this.#h=!1,this.#g&&Ui(this.#g,this.#c)}))}get_effect_pending(){return this.#_(),ye(this.#g)}error(e){var t=this.#t.onerror;let i=this.#t.failed;if(!t&&!i)throw e;this.#s&&(Ct(this.#s),this.#s=null),this.#r&&(Ct(this.#r),this.#r=null),this.#i&&(Ct(this.#i),this.#i=null);var s=!1,u=!1;const c=()=>{if(s){sw();return}s=!0,u&&J_(),this.#i!==null&&Xr(this.#i,()=>{this.#i=null}),this.#m(()=>{Ci.ensure(),this.#v()})},f=h=>{try{u=!0,t?.(h,c),u=!1}catch(d){mr(d,this.#n&&this.#n.parent)}i&&(this.#i=this.#m(()=>{Ci.ensure();try{return en(()=>{var d=Oe;d.b=this,d.f|=Cu,i(this.#e,()=>h,()=>c)})}catch(d){return mr(d,this.#n.parent),null}}))};Hr(()=>{var h;try{h=this.transform_error(e)}catch(d){mr(d,this.#n&&this.#n.parent);return}h!==null&&typeof h=="object"&&typeof h.then=="function"?h.then(f,d=>mr(d,this.#n&&this.#n.parent)):f(h)})}};function vw(e,t,i,s){const u=Ml;var c=e.filter(y=>!y.settled);if(i.length===0&&c.length===0){s(t.map(u));return}var f=Oe,h=yw(),d=c.length===1?c[0].promise:c.length>1?Promise.all(c.map(y=>y.promise)):null;function m(y){h();try{s(y)}catch(k){!(f.f&Xi)&&mr(k,f)}Pu()}if(i.length===0){d.then(()=>m(t.map(u)));return}function v(){h(),Promise.all(i.map(y=>ww(y))).then(y=>m([...t.map(u),...y])).catch(y=>mr(y,f))}d?d.then(v):v()}function yw(){var e=Oe,t=Se,i=mt,s=qe;return function(u=!0){Yn(e),on(t),Gi(i),u&&s?.activate()}}function Pu(e=!0){Yn(null),on(null),Gi(null),e&&qe?.deactivate()}function _w(){var e=Oe.b,t=qe,i=e.is_rendered();return e.update_pending_count(1),t.increment(i),()=>{e.update_pending_count(-1),t.decrement(i)}}function Ml(e){var t=2050,i=Se!==null&&(Se.f&At)!==0?Se:null;return Oe!==null&&(Oe.f|=wg),{ctx:mt,deps:null,effects:null,equals:kg,f:t,fn:e,reactions:null,rv:0,v:ht,wv:0,parent:i??Oe,ac:null}}function ww(e,t,i){Oe===null&&F_();var s=void 0,u=Zr(ht),c=!Se,f=new Map;return Ow(()=>{var h=yg();s=h.promise;try{Promise.resolve(e()).then(h.resolve,h.reject).finally(Pu)}catch(y){h.reject(y),Pu()}var d=qe;if(c){var m=_w();f.get(d)?.reject(jr),f.delete(d),f.set(d,h)}const v=(y,k=void 0)=>{if(d.activate(),k)k!==jr&&(u.f|=yr,Ui(u,k));else{u.f&yr&&(u.f^=yr),Ui(u,y);for(const[S,b]of f){if(f.delete(S),S===d)break;b.reject(jr)}}m&&m()};h.promise.then(v,y=>v(null,y||"unknown"))}),Al(()=>{for(const h of f.values())h.reject(jr)}),new Promise(h=>{function d(m){function v(){m===s?h(u):d(s)}m.then(v,v)}d(s)})}function tn(e){const t=Ml(e);return Vg(t),t}function kw(e){const t=Ml(e);return t.equals=Eg,t}function xw(e){var t=e.effects;if(t!==null){e.effects=null;for(var i=0;i<t.length;i+=1)Ct(t[i])}}function Ew(e){for(var t=e.parent;t!==null;){if((t.f&At)===0)return(t.f&Xi)===0?t:null;t=t.parent}return null}function Nl(e){var t,i=Oe;Yn(Ew(e));try{e.f&=-65537,xw(e),t=Wg(e)}finally{Yn(i)}return t}function zg(e){var t=Nl(e);if(!e.equals(t)&&(e.wv=$g(),(!qe?.is_fork||e.deps===null)&&(e.v=t,e.deps===null))){We(e,ft);return}Wr||(vn!==null?(Cl()||qe?.is_fork)&&vn.set(e,t):Sl(e))}function bw(e){if(e.effects!==null)for(const t of e.effects)(t.teardown||t.ac)&&(t.teardown?.(),t.ac?.abort(jr),t.teardown=Yr,t.ac=null,Hs(t,0),Pl(t))}function jg(e){if(e.effects!==null)for(const t of e.effects)t.teardown&&zi(t)}var Ou=new Set,_r=new Map,qg=!1;function Zr(e,t){return{f:0,v:e,reactions:null,equals:kg,rv:0,wv:0}}function Rn(e,t){const i=Zr(e);return Vg(i),i}function Yg(e,t=!1,i=!0){const s=Zr(e);return t||(s.equals=Eg),s}function Et(e,t,i=!1){return Se!==null&&(!yn||Se.f&O_)&&Ng()&&Se.f&4325394&&(sn===null||!Fi.call(sn,e))&&H_(),Ui(e,i?ws(t):t)}function Ui(e,t){if(!e.equals(t)){var i=e.v;Wr?_r.set(e,t):_r.set(e,i),e.v=t;var s=Ci.ensure();if(s.capture(e,i),(e.f&At)!==0){const u=e;e.f&Gt&&Nl(u),Sl(u)}e.wv=$g(),Hg(e,Gt),Oe!==null&&Oe.f&ft&&!(Oe.f&96)&&(Zt===null?Mw([e]):Zt.push(e)),!s.is_fork&&Ou.size>0&&!qg&&Sw()}return t}function Sw(){qg=!1;for(const e of Ou)e.f&ft&&We(e,qn),na(e)&&zi(e);Ou.clear()}function Os(e){Et(e,e.v+1)}function Hg(e,t){var i=e.reactions;if(i!==null)for(var s=i.length,u=0;u<s;u++){var c=i[u],f=c.f,h=(f&Gt)===0;if(h&&We(c,t),(f&At)!==0){var d=c;vn?.delete(d),!(f&Za)&&(f&xn&&(c.f|=Za),Hg(d,qn))}else h&&(f&ea&&er!==null&&er.add(c),Bn(c))}}var wh=!1;function Iw(){wh||(wh=!0,document.addEventListener("reset",e=>{Promise.resolve().then(()=>{if(!e.defaultPrevented)for(const t of e.target.elements)t.__on_r?.()})},{capture:!0}))}function Ll(e){var t=Se,i=Oe;on(null),Yn(null);try{return e()}finally{on(t),Yn(i)}}function Jg(e,t,i,s=i){e.addEventListener(t,()=>Ll(i));const u=e.__on_r;u?e.__on_r=()=>{u(),s(!0)}:e.__on_r=()=>s(!0),Iw()}var Da=!1,Wr=!1;function kh(e){Wr=e}var Se=null,yn=!1;function on(e){Se=e}var Oe=null;function Yn(e){Oe=e}var sn=null;function Vg(e){Se!==null&&(sn===null?sn=[e]:sn.push(e))}var Lt=null,Ot=0,Zt=null;function Mw(e){Zt=e}var Xg=1,qr=0,Vr=qr;function xh(e){Vr=e}function $g(){return++Xg}function na(e){var t=e.f;if((t&Gt)!==0)return!0;if(t&At&&(e.f&=-65537),(t&qn)!==0){for(var i=e.deps,s=i.length,u=0;u<s;u++){var c=i[u];if(na(c)&&zg(c),c.wv>e.wv)return!0}t&xn&&vn===null&&We(e,ft)}return!1}function Zg(e,t,i=!0){var s=e.reactions;if(s!==null&&!(sn!==null&&Fi.call(sn,e)))for(var u=0;u<s.length;u++){var c=s[u];(c.f&At)!==0?Zg(c,t,!1):t===c&&(i?We(c,Gt):c.f&ft&&We(c,qn),Bn(c))}}function Wg(e){var t=Lt,i=Ot,s=Zt,u=Se,c=sn,f=mt,h=yn,d=Vr,m=e.f;Lt=null,Ot=0,Zt=null,Se=(m&96)===0?e:null,sn=null,Gi(e.ctx),yn=!1,Vr=++qr,e.ac!==null&&(Ll(()=>{e.ac.abort(jr)}),e.ac=null);try{e.f|=Au;var v=e.fn,y=v();e.f|=$i;var k=e.deps,S=qe?.is_fork;if(Lt!==null){var b;if(S||Hs(e,Ot),k!==null&&Ot>0)for(k.length=Ot+Lt.length,b=0;b<Lt.length;b++)k[Ot+b]=Lt[b];else e.deps=k=Lt;if(Cl()&&(e.f&xn)!==0)for(b=Ot;b<k.length;b++)(k[b].reactions??=[]).push(e)}else!S&&k!==null&&Ot<k.length&&(Hs(e,Ot),k.length=Ot);if(Ng()&&Zt!==null&&!yn&&k!==null&&(e.f&6146)===0)for(b=0;b<Zt.length;b++)Zg(Zt[b],e);if(u!==null&&u!==e){if(qr++,u.deps!==null)for(let P=0;P<i;P+=1)u.deps[P].rv=qr;if(t!==null)for(const P of t)P.rv=qr;Zt!==null&&(s===null?s=Zt:s.push(...Zt))}return e.f&yr&&(e.f^=yr),y}catch(P){return Og(P)}finally{e.f^=Au,Lt=t,Ot=i,Zt=s,Se=u,sn=c,Gi(f),yn=h,Vr=d}}function Nw(e,t){let i=t.reactions;if(i!==null){var s=L_.call(i,e);if(s!==-1){var u=i.length-1;u===0?i=t.reactions=null:(i[s]=i[u],i.pop())}}if(i===null&&(t.f&At)!==0&&(Lt===null||!Fi.call(Lt,t))){var c=t;c.f&xn&&(c.f^=xn,c.f&=-65537),Sl(c),bw(c),Hs(c,0)}}function Hs(e,t){var i=e.deps;if(i!==null)for(var s=t;s<i.length;s++)Nw(e,i[s])}function zi(e){var t=e.f;if((t&Xi)===0){We(e,ft);var i=Oe,s=Da;Oe=e,Da=!0;try{(t&16777232)!==0?Rw(e):Pl(e),nd(e);var u=Wg(e);e.teardown=typeof u=="function"?u:null,e.wv=Xg}finally{Da=s,Oe=i}}}function ye(e){var t=(e.f&At)!==0;if(Se!==null&&!yn&&!(Oe!==null&&(Oe.f&Xi)!==0)&&(sn===null||!Fi.call(sn,e))){var i=Se.deps;if((Se.f&Au)!==0)e.rv<qr&&(e.rv=qr,Lt===null&&i!==null&&i[Ot]===e?Ot++:Lt===null?Lt=[e]:Lt.push(e));else{(Se.deps??=[]).push(e);var s=e.reactions;s===null?e.reactions=[Se]:Fi.call(s,Se)||s.push(Se)}}if(Wr&&_r.has(e))return _r.get(e);if(t){var u=e;if(Wr){var c=u.v;return(!(u.f&ft)&&u.reactions!==null||Qg(u))&&(c=Nl(u)),_r.set(u,c),c}var f=(u.f&xn)===0&&!yn&&Se!==null&&(Da||(Se.f&xn)!==0),h=(u.f&$i)===0;na(u)&&(f&&(u.f|=xn),zg(u)),f&&!h&&(jg(u),Kg(u))}if(vn?.has(e))return vn.get(e);if((e.f&yr)!==0)throw e.v;return e.v}function Kg(e){if(e.f|=xn,e.deps!==null)for(const t of e.deps)(t.reactions??=[]).push(e),t.f&At&&!(t.f&xn)&&(jg(t),Kg(t))}function Qg(e){if(e.v===ht)return!0;if(e.deps===null)return!1;for(const t of e.deps)if(_r.has(t)||(t.f&At)!==0&&Qg(t))return!0;return!1}function wo(e){var t=yn;try{return yn=!0,e()}finally{yn=t}}function Lw(e){Oe===null&&(Se===null&&z_(),U_()),Wr&&B_()}function Cw(e,t){var i=t.last;i===null?t.last=t.first=e:(i.next=e,e.prev=i,t.last=e)}function ur(e,t){var i=Oe;i!==null&&i.f&rn&&(e|=rn);var s={ctx:mt,deps:null,nodes:null,f:e|2560,first:null,fn:t,last:null,next:null,parent:i,b:i&&i.b,prev:null,teardown:null,wv:0,ac:null},u=s;if((e&yo)!==0)Bi!==null?Bi.push(s):Bn(s);else if(t!==null){try{zi(s)}catch(f){throw Ct(s),f}u.deps===null&&u.teardown===null&&u.nodes===null&&u.first===u.last&&!(u.f&wg)&&(u=u.first,e&ea&&e&qs&&u!==null&&(u.f|=qs))}if(u!==null&&(u.parent=i,i!==null&&Cw(u,i),Se!==null&&(Se.f&At)!==0&&(e&_g)===0)){var c=Se;(c.effects??=[]).push(u)}return s}function Cl(){return Se!==null&&!yn}function Al(e){const t=ur(_o,null);return We(t,ft),t.teardown=e,t}function Aw(e){Lw();var t=Oe.f;if(!Se&&(t&Vi)!==0&&(t&$i)===0){var i=mt;(i.e??=[]).push(e)}else return ed(e)}function ed(e){return ur(1048580,e)}function Tw(e){Ci.ensure();const t=ur(524352,e);return(i={})=>new Promise(s=>{i.outro?Xr(t,()=>{Ct(t),s(void 0)}):(Ct(t),s(void 0))})}function Pw(e){return ur(yo,e)}function Ow(e){return ur(4718592,e)}function td(e,t=0){return ur(_o|t,e)}function _n(e,t=[],i=[],s=[]){vw(s,t,i,u=>{ur(_o,()=>e(...u.map(ye)))})}function Tl(e,t=0){return ur(ea|t,e)}function en(e){return ur(524320,e)}function nd(e){var t=e.teardown;if(t!==null){const i=Wr,s=Se;kh(!0),on(null);try{t.call(null)}finally{kh(i),on(s)}}}function Pl(e,t=!1){var i=e.first;for(e.first=e.last=null;i!==null;){const u=i.ac;u!==null&&Ll(()=>{u.abort(jr)});var s=i.next;(i.f&_g)!==0?i.parent=null:Ct(i,t),i=s}}function Rw(e){for(var t=e.first;t!==null;){var i=t.next;!(t.f&Vi)&&Ct(t),t=i}}function Ct(e,t=!0){var i=!1;(t||e.f&R_)&&e.nodes!==null&&e.nodes.end!==null&&(rd(e.nodes.start,e.nodes.end),i=!0),Pl(e,t&&!i),Hs(e,0),We(e,Xi);var s=e.nodes&&e.nodes.t;if(s!==null)for(const c of s)c.stop();nd(e);var u=e.parent;u!==null&&u.first!==null&&id(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes=e.ac=null}function rd(e,t){for(;e!==null;){var i=e===t?null:ta(e);e.remove(),e=i}}function id(e){var t=e.parent,i=e.prev,s=e.next;i!==null&&(i.next=s),s!==null&&(s.prev=i),t!==null&&(t.first===e&&(t.first=s),t.last===e&&(t.last=i))}function Xr(e,t,i=!0){var s=[];sd(e,s,!0);var u=()=>{i&&Ct(e),t&&t()},c=s.length;if(c>0){var f=()=>--c||u();for(var h of s)h.out(f)}else u()}function sd(e,t,i){if((e.f&rn)===0){e.f^=rn;var s=e.nodes&&e.nodes.t;if(s!==null)for(const h of s)(h.is_global||i)&&t.push(h);for(var u=e.first;u!==null;){var c=u.next,f=(u.f&qs)!==0||(u.f&Vi)!==0&&(e.f&ea)!==0;sd(u,t,f?i:!1),u=c}}}function Ol(e){ad(e,!0)}function ad(e,t){if((e.f&rn)!==0){e.f^=rn;for(var i=e.first;i!==null;){var s=i.next,u=(i.f&qs)!==0||(i.f&Vi)!==0;ad(i,u?t:!1),i=s}var c=e.nodes&&e.nodes.t;if(c!==null)for(const f of c)(f.is_global||t)&&f.in()}}function Rl(e,t){if(e.nodes)for(var i=e.nodes.start,s=e.nodes.end;i!==null;){var u=i===s?null:ta(i);t.append(i),i=u}}var Dw=["touchstart","touchmove"];function Fw(e){return Dw.includes(e)}var ks=Symbol("events"),od=new Set,Ru=new Set;function Js(e,t,i){(t[ks]??={})[e]=i}function ko(e){for(var t=0;t<e.length;t++)od.add(e[t]);for(var i of Ru)i(e)}var Eh=null;function bh(e){var t=this,i=t.ownerDocument,s=e.type,u=e.composedPath?.()||[],c=u[0]||e.target;Eh=e;var f=0,h=Eh===e&&e[ks];if(h){var d=u.indexOf(h);if(d!==-1&&(t===document||t===window)){e[ks]=t;return}var m=u.indexOf(t);if(m===-1)return;d<=m&&(f=d)}if(c=u[f]||e.target,c!==t){mg(e,"currentTarget",{configurable:!0,get(){return c||i}});var v=Se,y=Oe;on(null),Yn(null);try{for(var k,S=[];c!==null;){var b=c.assignedSlot||c.parentNode||c.host||null;try{var P=c[ks]?.[s];P!=null&&(!c.disabled||e.target===c)&&P.call(c,e)}catch(O){k?S.push(O):k=O}if(e.cancelBubble||b===t||b===null)break;c=b}if(k){for(let O of S)queueMicrotask(()=>{throw O});throw k}}finally{e[ks]=t,delete e.currentTarget,on(v),Yn(y)}}}var Gw=globalThis?.window?.trustedTypes&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:e=>e});function Bw(e){return Gw?.createHTML(e)??e}function Uw(e){var t=Pg("template");return t.innerHTML=Bw(e.replaceAll("<!>","<!---->")),t.content}function Vs(e,t){var i=Oe;i.nodes===null&&(i.nodes={start:e,end:t,a:null,t:null})}function cn(e,t){var i=(t&W_)!==0,s=(t&K_)!==0,u,c=!e.startsWith("<!>");return()=>{u===void 0&&(u=Uw(c?e:"<!>"+e),i||(u=Jr(u)));var f=s||Lg?document.importNode(u,!0):u.cloneNode(!0);if(i){var h=Jr(f),d=f.lastChild;Vs(h,d)}else Vs(f,f);return f}}function Sh(e=""){var t=nr(e+"");return Vs(t,t),t}function Kr(){var e=document.createDocumentFragment(),t=document.createComment(""),i=nr();return e.append(t,i),Vs(t,i),e}function Ze(e,t){e!==null&&e.before(t)}function Ai(e,t){var i=t==null?"":typeof t=="object"?`${t}`:t;i!==(e.__t??=e.nodeValue)&&(e.__t=i,e.nodeValue=`${i}`)}function zw(e,t){return jw(e,t)}var ya=new Map;function jw(e,{target:t,anchor:i,props:s={},events:u,context:c,intro:f=!0,transformError:h}){ow();var d=void 0,m=Tw(()=>{var v=i??t.appendChild(nr());pw(v,{pending:()=>{}},S=>{Zi({});var b=mt;c&&(b.c=c),u&&(s.$$events=u),d=e(S,s)||{},Wi()},h);var y=new Set,k=S=>{for(var b=0;b<S.length;b++){var P=S[b];if(!y.has(P)){y.add(P);var O=Fw(P);for(const j of[t,document]){var G=ya.get(j);G===void 0&&(G=new Map,ya.set(j,G));var L=G.get(P);L===void 0?(j.addEventListener(P,bh,{passive:O}),G.set(P,1)):G.set(P,L+1)}}}};return k(vo(od)),Ru.add(k),()=>{for(var S of y)for(const O of[t,document]){var b=ya.get(O),P=b.get(S);--P==0?(O.removeEventListener(S,bh),b.delete(S),b.size===0&&ya.delete(O)):b.set(S,P)}Ru.delete(k),v!==i&&v.parentNode?.removeChild(v)}});return Du.set(d,m),d}var Du=new WeakMap;function qw(e,t){const i=Du.get(e);return i?(Du.delete(e),i(t)):Promise.resolve()}var Yw=class{anchor;#e=new Map;#o=new Map;#t=new Map;#a=new Set;#n=!0;constructor(e,t=!0){this.anchor=e,this.#n=t}#s=e=>{if(this.#e.has(e)){var t=this.#e.get(e),i=this.#o.get(t);if(i)Ol(i),this.#a.delete(t);else{var s=this.#t.get(t);s&&!(s.effect.f&rn)&&(this.#o.set(t,s.effect),this.#t.delete(t),s.fragment.lastChild.remove(),this.anchor.before(s.fragment),i=s.effect)}for(const[u,c]of this.#e){if(this.#e.delete(u),u===e)break;const f=this.#t.get(c);f&&(Ct(f.effect),this.#t.delete(c))}for(const[u,c]of this.#o){if(u===t||this.#a.has(u)||(c.f&rn)!==0)continue;const f=()=>{if(Array.from(this.#e.values()).includes(u)){var h=document.createDocumentFragment();Rl(c,h),h.append(nr()),this.#t.set(u,{effect:c,fragment:h})}else Ct(c);this.#a.delete(u),this.#o.delete(u)};this.#n||!i?(this.#a.add(u),Xr(c,f,!1)):f()}}};#r=e=>{this.#e.delete(e);const t=Array.from(this.#e.values());for(const[i,s]of this.#t)t.includes(i)||(Ct(s.effect),this.#t.delete(i))};ensure(e,t){var i=qe,s=Tg();if(t&&!this.#o.has(e)&&!this.#t.has(e))if(s){var u=document.createDocumentFragment(),c=nr();u.append(c),this.#t.set(e,{effect:en(()=>t(c)),fragment:u})}else this.#o.set(e,en(()=>t(this.anchor)));if(this.#e.set(i,e),s){for(const[f,h]of this.#o)f===e?i.unskip_effect(h):i.skip_effect(h);for(const[f,h]of this.#t)f===e?i.unskip_effect(h.effect):i.skip_effect(h.effect);i.oncommit(this.#s),i.ondiscard(this.#r)}else this.#s(i)}};function wn(e,t,i=!1){var s=new Yw(e),u=i?qs:0;function c(f,h){s.ensure(f,h)}Tl(()=>{var f=!1;t((h,d=0)=>{f=!0,c(d,h)}),f||c(-1,null)},u)}function Hw(e,t,i){for(var s=[],u=t.length,c,f=t.length,h=0;h<u;h++){let y=t[h];Xr(y,()=>{if(c){if(c.pending.delete(y),c.done.add(y),c.pending.size===0){var k=e.outrogroups;Fu(e,vo(c.done)),k.delete(c),k.size===0&&(e.outrogroups=null)}}else f-=1},!1)}if(f===0){var d=s.length===0&&i!==null;if(d){var m=i,v=m.parentNode;uw(v),v.append(m),e.items.clear()}Fu(e,t,!d)}else c={pending:new Set(t),done:new Set},(e.outrogroups??=new Set).add(c)}function Fu(e,t,i=!0){var s;if(e.pending.size>0){s=new Set;for(const f of e.pending.values())for(const h of f)s.add(e.items.get(h).e)}for(var u=0;u<t.length;u++){var c=t[u];s?.has(c)?(c.f|=Gn,Rl(c,document.createDocumentFragment())):Ct(t[u],i)}}var Ih;function Xs(e,t,i,s,u,c=null){var f=e,h=new Map;(t&Sg)!==0&&(f=e.appendChild(nr()));var d=null,m=kw(()=>{var O=i();return bl(O)?O:O==null?[]:vo(O)}),v,y=new Map,k=!0;function S(O){!(P.effect.f&Xi)&&(P.pending.delete(O),P.fallback=d,Jw(P,v,f,t,s),d!==null&&(v.length===0?(d.f&Gn)===0?Ol(d):(d.f^=Gn,xs(d,null,f)):Xr(d,()=>{d=null})))}function b(O){P.pending.delete(O)}var P={effect:Tl(()=>{v=ye(m);for(var O=v.length,G=new Set,L=qe,j=Tg(),V=0;V<O;V+=1){var X=v[V],H=s(X,V),$=k?null:h.get(H);$?($.v&&Ui($.v,X),$.i&&Ui($.i,V),j&&L.unskip_effect($.e)):($=Vw(h,k?f:Ih??=nr(),X,H,V,u,t,i),k||($.e.f|=Gn),h.set(H,$)),G.add(H)}if(O===0&&c&&!d&&(k?d=en(()=>c(f)):(d=en(()=>c(Ih??=nr())),d.f|=Gn)),O>G.size&&G_(),!k)if(y.set(L,G),j){for(const[w,E]of h)G.has(w)||L.skip_effect(E.e);L.oncommit(S),L.ondiscard(b)}else S(L);ye(m)}),items:h,pending:y,outrogroups:null,fallback:d};k=!1}function cs(e){for(;e!==null&&(e.f&Vi)===0;)e=e.next;return e}function Jw(e,t,i,s,u){var c=(s&$_)!==0,f=t.length,h=e.items,d=cs(e.effect.first),m,v=null,y,k=[],S=[],b,P,O,G;if(c)for(G=0;G<f;G+=1)b=t[G],P=u(b,G),O=h.get(P).e,!(O.f&Gn)&&(O.nodes?.a?.measure(),(y??=new Set).add(O));for(G=0;G<f;G+=1){if(b=t[G],P=u(b,G),O=h.get(P).e,e.outrogroups!==null)for(const M of e.outrogroups)M.pending.delete(O),M.done.delete(O);if((O.f&Gn)!==0)if(O.f^=Gn,O===d)xs(O,null,i);else{var L=v?v.next:d;O===e.effect.last&&(e.effect.last=O.prev),O.prev&&(O.prev.next=O.next),O.next&&(O.next.prev=O.prev),gr(e,v,O),gr(e,O,L),xs(O,L,i),v=O,k=[],S=[],d=cs(v.next);continue}if(O.f&rn&&(Ol(O),c&&(O.nodes?.a?.unfix(),(y??=new Set).delete(O))),O!==d){if(m!==void 0&&m.has(O)){if(k.length<S.length){var j=S[0],V;v=j.prev;var X=k[0],H=k[k.length-1];for(V=0;V<k.length;V+=1)xs(k[V],j,i);for(V=0;V<S.length;V+=1)m.delete(S[V]);gr(e,X.prev,H.next),gr(e,v,X),gr(e,H,j),d=j,v=H,G-=1,k=[],S=[]}else m.delete(O),xs(O,d,i),gr(e,O.prev,O.next),gr(e,O,v===null?e.effect.first:v.next),gr(e,v,O),v=O;continue}for(k=[],S=[];d!==null&&d!==O;)(m??=new Set).add(d),S.push(d),d=cs(d.next);if(d===null)continue}!(O.f&Gn)&&k.push(O),v=O,d=cs(O.next)}if(e.outrogroups!==null){for(const M of e.outrogroups)M.pending.size===0&&(Fu(e,vo(M.done)),e.outrogroups?.delete(M));e.outrogroups.size===0&&(e.outrogroups=null)}if(d!==null||m!==void 0){var $=[];if(m!==void 0)for(O of m)!(O.f&rn)&&$.push(O);for(;d!==null;)!(d.f&rn)&&d!==e.fallback&&$.push(d),d=cs(d.next);var w=$.length;if(w>0){var E=(s&Sg)!==0&&f===0?i:null;if(c){for(G=0;G<w;G+=1)$[G].nodes?.a?.measure();for(G=0;G<w;G+=1)$[G].nodes?.a?.fix()}Hw(e,$,E)}}c&&Hr(()=>{if(y!==void 0)for(O of y)O.nodes?.a?.apply()})}function Vw(e,t,i,s,u,c,f,h){var d=(f&V_)!==0?(f&Z_)===0?Yg(i,!1,!1):Zr(i):null,m=(f&X_)!==0?Zr(u):null;return{v:d,i:m,e:en(()=>(c(t,d??i,m??u,h),()=>{e.delete(s)}))}}function xs(e,t,i){if(e.nodes)for(var s=e.nodes.start,u=e.nodes.end,c=t&&(t.f&Gn)===0?t.nodes.start:i;s!==null;){var f=ta(s);if(c.before(s),s===u)return;s=f}}function gr(e,t,i){t===null?e.effect.first=i:t.next=i,i===null?e.effect.last=t:i.prev=t}function ud(e,t,i=!1,s=!1,u=!1){var c=e,f="";_n(()=>{var h=Oe;if(f!==(f=t()??"")&&(h.nodes!==null&&(rd(h.nodes.start,h.nodes.end),h.nodes=null),f!=="")){var d=Pg(i?"svg":s?"math":"template",i?Q_:s?ew:void 0);d.innerHTML=f;var m=i||s?d:d.content;if(Vs(Jr(m),m.lastChild),i||s)for(;Jr(m);)c.before(Jr(m));else c.before(m)}})}function ld(e){var t,i,s="";if(typeof e=="string"||typeof e=="number")s+=e;else if(typeof e=="object")if(Array.isArray(e)){var u=e.length;for(t=0;t<u;t++)e[t]&&(i=ld(e[t]))&&(s&&(s+=" "),s+=i)}else for(i in e)e[i]&&(s&&(s+=" "),s+=i);return s}function Xw(){for(var e,t,i=0,s="",u=arguments.length;i<u;i++)(e=arguments[i])&&(t=ld(e))&&(s&&(s+=" "),s+=t);return s}function $w(e){return typeof e=="object"?Xw(e):e??""}var Mh=[...`
|
|
199
|
+
\r\f \v\uFEFF`];function Zw(e,t,i){var s=e==null?"":""+e;if(t&&(s=s?s+" "+t:t),i){for(var u of Object.keys(i))if(i[u])s=s?s+" "+u:u;else if(s.length)for(var c=u.length,f=0;(f=s.indexOf(u,f))>=0;){var h=f+c;(f===0||Mh.includes(s[f-1]))&&(h===s.length||Mh.includes(s[h]))?s=(f===0?"":s.substring(0,f))+s.substring(h+1):f=h}}return s===""?null:s}function Rs(e,t,i,s,u,c){var f=e.__className;if(f!==i||f===void 0){var h=Zw(i,s,c);h==null?e.removeAttribute("class"):e.className=h,e.__className=i}else if(c&&u!==c)for(var d in c){var m=!!c[d];(u==null||m!==!!u[d])&&e.classList.toggle(d,m)}return c}function cd(e,t,i=!1){if(e.multiple){if(t==null)return;if(!bl(t))return iw();for(var s of e.options)s.selected=t.includes(Ds(s));return}for(s of e.options)if(aw(Ds(s),t)){s.selected=!0;return}(!i||t!==void 0)&&(e.selectedIndex=-1)}function Ww(e){var t=new MutationObserver(()=>{cd(e,e.__value)});t.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),Al(()=>{t.disconnect()})}function Kw(e,t,i=t){var s=new WeakSet,u=!0;Jg(e,"change",c=>{var f=c?"[selected]":":checked",h;if(e.multiple)h=[].map.call(e.querySelectorAll(f),Ds);else{var d=e.querySelector(f)??e.querySelector("option:not([disabled])");h=d&&Ds(d)}i(h),qe!==null&&s.add(qe)}),Pw(()=>{var c=t();if(e===document.activeElement){var f=Tu??qe;if(s.has(f))return}if(cd(e,c,u),u&&c===void 0){var h=e.querySelector(":checked");h!==null&&(c=Ds(h),i(c))}e.__value=c,u=!1}),Ww(e)}function Ds(e){return"__value"in e?e.__value:e.value}var Qw=Symbol("is custom element"),ek=Symbol("is html");function vr(e,t,i,s){var u=tk(e);u[t]!==(u[t]=i)&&(t==="loading"&&(e[D_]=i),i==null?e.removeAttribute(t):typeof i!="string"&&nk(e).includes(t)?e[t]=i:e.setAttribute(t,i))}function tk(e){return e.__attributes??={[Qw]:e.nodeName.includes("-"),[ek]:e.namespaceURI===Ig}}var Nh=new Map;function nk(e){var t=e.getAttribute("is")||e.nodeName,i=Nh.get(t);if(i)return i;Nh.set(t,i=[]);for(var s,u=e,c=Element.prototype;c!==u;){s=C_(u);for(var f in s)s[f].set&&i.push(f);u=vg(u)}return i}function rk(e,t,i=t){Jg(e,"change",s=>{i(s?e.defaultChecked:e.checked)}),wo(t)??i(e.checked),td(()=>{e.checked=!!t()})}var Gu=Symbol();function hd(e,t,i){const s=i[t]??={store:null,source:Yg(void 0),unsubscribe:Yr};if(s.store!==e&&!(Gu in i))if(s.unsubscribe(),s.store=e??null,e==null)s.source.v=void 0,s.unsubscribe=Yr;else{var u=!0;s.unsubscribe=gd(e,c=>{u?s.source.v=c:Et(s.source,c)}),u=!1}return e&&Gu in i?ak(e):ye(s.source)}function fd(){const e={};function t(){Al(()=>{for(var i in e)e[i].unsubscribe();mg(e,Gu,{enumerable:!1,value:!0})})}return[e,t]}function ik(e){mt===null&&bg(),Aw(()=>{const t=wo(e);if(typeof t=="function")return t})}function gd(e,t,i){if(e==null)return t(void 0),Yr;const s=wo(()=>e.subscribe(t,i));return s.unsubscribe?()=>s.unsubscribe():s}var ki=[];function sk(e,t=Yr){let i=null;const s=new Set;function u(h){if(xg(e,h)&&(e=h,i)){const d=!ki.length;for(const m of s)m[1](),ki.push(m,e);if(d){for(let m=0;m<ki.length;m+=2)ki[m][0](ki[m+1]);ki.length=0}}}function c(h){u(h(e))}function f(h,d=Yr){const m=[h,d];return s.add(m),s.size===1&&(i=t(u,c)||Yr),h(e),()=>{s.delete(m),s.size===0&&i&&(i(),i=null)}}return{set:u,update:c,subscribe:f}}function ak(e){let t;return gd(e,i=>t=i)(),t}var Dl=sk({controls:Bt(Rf),options:Lu().controls,settings:Lu().settings}),ok="5";typeof window<"u"&&((window.__svelte??={}).v??=new Set).add(ok);var uk=`<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 64 64">
|
|
200
|
+
<path d="M7.474 17.988h49.045L31.996 46.012zm-3.85 3.37 24.522 28.019a5.113 5.113 0 0 0 7.7 0l24.523-28.02c2.894-3.308.542-8.482-3.85-8.482H7.474a5.113 5.113 0 0 0-3.85 8.482"/>
|
|
201
|
+
</svg>
|
|
202
|
+
`,lk=`<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 64 64">
|
|
203
|
+
<path d="M7.474 46.012h49.045L31.996 17.988Zm-3.85-3.37 24.522-28.019a5.113 5.113 0 0 1 7.7 0l24.523 28.02c2.894 3.308.542 8.482-3.85 8.482H7.474a5.113 5.113 0 0 1-3.85-8.482"/>
|
|
204
|
+
</svg>
|
|
205
|
+
`,ck=cn("<option> </option>"),hk=cn('<label class="svelte-1gitljd"> </label> <select class="svelte-1gitljd"></select>',1),fk=cn('<label class="svelte-1gitljd"><input type="checkbox" class="svelte-1gitljd"/> </label>'),gk=cn('<div class="action-option svelte-1gitljd"><!></div>');function dk(e,t){Zi(t,!0);let i=Rn("");ik(()=>{t.actionOption&&(t.actionOption.type==="select"?Et(i,t.actionOption.value.value,!0):t.actionOption.type==="toggle"&&Et(i,t.actionOption.value,!0))});const s=h=>{if(!t.actionInstance||!t.actionOption){ee.error("Can't apply option value",t.actionInstance,t.actionOption);return}if(t.actionOption?.type==="toggle"){const d=h.target;Et(i,d.checked,!0)}else if(t.actionOption?.type==="select"){const d=h.target;Et(i,d.value,!0)}t.actionInstance.applyOptionValue(t.name,ye(i))};var u=Kr(),c=rr(u),f=h=>{var d=gk(),m=nn(d),v=k=>{var S=hk(),b=rr(S),P=nn(b),O=Ys(b,2);Xs(O,21,()=>t.actionOption.choices,G=>G.value,(G,L)=>{var j=ck(),V=nn(j),X={};_n(()=>{Ai(V,ye(L).title),X!==(X=ye(L).value)&&(j.value=(j.__value=ye(L).value)??"")}),Ze(G,j)}),_n(()=>{vr(b,"for",t.name),Ai(P,t.actionOption.label),vr(O,"id",t.name)}),Js("change",O,s),Kw(O,()=>ye(i),G=>Et(i,G)),Ze(k,S)},y=k=>{var S=fk(),b=nn(S),P=Ys(b);_n(O=>{vr(S,"for",t.name),vr(b,"id",O),Ai(P,` ${t.actionOption.label??""}`)},[()=>String(t.name)]),Js("change",b,s),rk(b,()=>ye(i),O=>Et(i,O)),Ze(k,S)};wn(m,k=>{t.actionOption.type==="select"?k(v):t.actionOption.type==="toggle"&&typeof ye(i)=="boolean"&&k(y,1)}),Ze(h,d)};wn(c,h=>{t.actionOption&&h(f)}),Ze(e,u),Wi()}ko(["change"]);var pk=cn('<button type="submit" class="sub-action svelte-1icfoc8"> </button>');function mk(e,t){Zi(t,!0);const i=f=>{if(f.preventDefault(),!t.actionInstance||!t.subAction){ee.error("Can't run a SubAction",t.actionInstance,t.subAction);return}t.subAction.method()};var s=Kr(),u=rr(s),c=f=>{var h=pk(),d=nn(h);_n(()=>{vr(h,"id",`subaction-${t.name}`),vr(h,"title",t.subAction.label),Ai(d,t.subAction.label)}),Js("click",h,i),Ze(f,h)};wn(u,f=>{t.subAction&&f(c)}),Ze(e,s),Wi()}ko(["click"]);var vk=cn("<!> <!>",1);function yk(e,t){Zi(t,!0);const i=Mg("gm"),s=tn(()=>t.control.type),u=tn(()=>t.control.targetMode),c=tn(()=>ye(s)&&ye(u)&&i.actionInstances[`${ye(s)}__${ye(u)}`]||null);var f=Kr(),h=rr(f),d=m=>{var v=vk(),y=rr(v);Xs(y,17,()=>Object.entries(ye(c).options),([k,S])=>k,(k,S)=>{var b=tn(()=>$a(ye(S),2));let P=()=>ye(b)[0],O=()=>ye(b)[1];dk(k,{get name(){return P()},get actionInstance(){return ye(c)},get actionOption(){return O()}})}),Xs(Ys(y,2),17,()=>Object.entries(ye(c).actions),([k,S])=>k,(k,S)=>{var b=tn(()=>$a(ye(S),2));let P=()=>ye(b)[0],O=()=>ye(b)[1];mk(k,{get name(){return P()},get actionInstance(){return ye(c)},get subAction(){return O()}})}),Ze(m,v)};wn(h,m=>{ye(c)&&m(d)}),Ze(e,f),Wi()}var{entries:dd,setPrototypeOf:Lh,isFrozen:_k,getPrototypeOf:wk,getOwnPropertyDescriptor:kk}=Object,{freeze:It,seal:un,create:Fa}=Object,{apply:Bu,construct:Uu}=typeof Reflect<"u"&&Reflect;It||(It=function(e){return e});un||(un=function(e){return e});Bu||(Bu=function(e,t){for(var i=arguments.length,s=new Array(i>2?i-2:0),u=2;u<i;u++)s[u-2]=arguments[u];return e.apply(t,s)});Uu||(Uu=function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),s=1;s<t;s++)i[s-1]=arguments[s];return new e(...i)});var _a=Mt(Array.prototype.forEach),xk=Mt(Array.prototype.lastIndexOf),Ch=Mt(Array.prototype.pop),hs=Mt(Array.prototype.push),Ek=Mt(Array.prototype.splice),Ga=Mt(String.prototype.toLowerCase),$o=Mt(String.prototype.toString),Zo=Mt(String.prototype.match),fs=Mt(String.prototype.replace),bk=Mt(String.prototype.indexOf),Sk=Mt(String.prototype.trim),Rt=Mt(Object.prototype.hasOwnProperty),kt=Mt(RegExp.prototype.test),gs=Ik(TypeError);function Mt(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var i=arguments.length,s=new Array(i>1?i-1:0),u=1;u<i;u++)s[u-1]=arguments[u];return Bu(e,t,s)}}function Ik(e){return function(){for(var t=arguments.length,i=new Array(t),s=0;s<t;s++)i[s]=arguments[s];return Uu(e,i)}}function xe(e,t){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ga;Lh&&Lh(e,null);let s=t.length;for(;s--;){let u=t[s];if(typeof u=="string"){const c=i(u);c!==u&&(_k(t)||(t[s]=c),u=c)}e[u]=!0}return e}function Mk(e){for(let t=0;t<e.length;t++)Rt(e,t)||(e[t]=null);return e}function On(e){const t=Fa(null);for(const[i,s]of dd(e))Rt(e,i)&&(Array.isArray(s)?t[i]=Mk(s):s&&typeof s=="object"&&s.constructor===Object?t[i]=On(s):t[i]=s);return t}function ds(e,t){for(;e!==null;){const s=kk(e,t);if(s){if(s.get)return Mt(s.get);if(typeof s.value=="function")return Mt(s.value)}e=wk(e)}function i(){return null}return i}var Ah=It(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Wo=It(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Ko=It(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Nk=It(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Qo=It(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),Lk=It(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Th=It(["#text"]),Ph=It(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),eu=It(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Oh=It(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),wa=It(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Ck=un(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Ak=un(/<%[\w\W]*|[\w\W]*%>/gm),Tk=un(/\$\{[\w\W]*/gm),Pk=un(/^data-[\-\w.\u00B7-\uFFFF]+$/),Ok=un(/^aria-[\-\w]+$/),pd=un(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Rk=un(/^(?:\w+script|data):/i),Dk=un(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),md=un(/^html$/i),Fk=un(/^[a-z][.\w]*(-[.\w]+)+$/i),Rh=Object.freeze({__proto__:null,ARIA_ATTR:Ok,ATTR_WHITESPACE:Dk,CUSTOM_ELEMENT:Fk,DATA_ATTR:Pk,DOCTYPE_NAME:md,ERB_EXPR:Ak,IS_ALLOWED_URI:pd,IS_SCRIPT_OR_DATA:Rk,MUSTACHE_EXPR:Ck,TMPLIT_EXPR:Tk}),ps={element:1,text:3,progressingInstruction:7,comment:8,document:9},Gk=function(){return typeof window>"u"?null:window},Bk=function(e,t){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let i=null;const s="data-tt-policy-suffix";t&&t.hasAttribute(s)&&(i=t.getAttribute(s));const u="dompurify"+(i?"#"+i:"");try{return e.createPolicy(u,{createHTML(c){return c},createScriptURL(c){return c}})}catch{return console.warn("TrustedTypes policy "+u+" could not be created."),null}},Dh=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function vd(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Gk();const t=A=>vd(A);if(t.version="3.3.2",t.removed=[],!e||!e.document||e.document.nodeType!==ps.document||!e.Element)return t.isSupported=!1,t;let{document:i}=e;const s=i,u=s.currentScript,{DocumentFragment:c,HTMLTemplateElement:f,Node:h,Element:d,NodeFilter:m,NamedNodeMap:v=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:y,DOMParser:k,trustedTypes:S}=e,b=d.prototype,P=ds(b,"cloneNode"),O=ds(b,"remove"),G=ds(b,"nextSibling"),L=ds(b,"childNodes"),j=ds(b,"parentNode");if(typeof f=="function"){const A=i.createElement("template");A.content&&A.content.ownerDocument&&(i=A.content.ownerDocument)}let V,X="";const{implementation:H,createNodeIterator:$,createDocumentFragment:w,getElementsByTagName:E}=i,{importNode:M}=s;let R=Dh();t.isSupported=typeof dd=="function"&&typeof j=="function"&&H&&H.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:T,ERB_EXPR:F,TMPLIT_EXPR:D,DATA_ATTR:N,ARIA_ATTR:B,IS_SCRIPT_OR_DATA:U,ATTR_WHITESPACE:q,CUSTOM_ELEMENT:W}=Rh;let{IS_ALLOWED_URI:K}=Rh,ie=null;const ae=xe({},[...Ah,...Wo,...Ko,...Qo,...Th]);let ce=null;const re=xe({},[...Ph,...eu,...Oh,...wa]);let oe=Object.seal(Fa(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),we=null,Ie=null;const Y=Object.seal(Fa(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let be=!0,fe=!0,C=!1,$e=!0,Be=!1,Re=!0,Me=!1,Mr=!1,es=!1,ne=!1,Nr=!1,Lr=!1,bn=!0,ua=!1;const _e="user-content-";let Vn=!0,Sn=!1,In={},ge=null;const Cr=xe({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Ee=null;const ve=xe({},["audio","video","img","source","image","track"]);let ts=null;const Ut=xe({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),oi="http://www.w3.org/1998/Math/MathML",pe="http://www.w3.org/2000/svg",hn="http://www.w3.org/1999/xhtml";let cr=hn,Ar=!1,gt=null;const Tr=xe({},[oi,pe,hn],$o);let vt=xe({},["mi","mo","mn","ms","mtext"]),Pr=xe({},["annotation-xml"]);const ui=xe({},["title","style","font","a","script"]);let Or=null;const la=["application/xhtml+xml","text/html"],Xn="text/html";let te=null,fn=null;const li=i.createElement("form"),hr=function(A){return A instanceof RegExp||A instanceof Function},ci=function(){let A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(fn&&fn===A)){if((!A||typeof A!="object")&&(A={}),A=On(A),Or=la.indexOf(A.PARSER_MEDIA_TYPE)===-1?Xn:A.PARSER_MEDIA_TYPE,te=Or==="application/xhtml+xml"?$o:Ga,ie=Rt(A,"ALLOWED_TAGS")?xe({},A.ALLOWED_TAGS,te):ae,ce=Rt(A,"ALLOWED_ATTR")?xe({},A.ALLOWED_ATTR,te):re,gt=Rt(A,"ALLOWED_NAMESPACES")?xe({},A.ALLOWED_NAMESPACES,$o):Tr,ts=Rt(A,"ADD_URI_SAFE_ATTR")?xe(On(Ut),A.ADD_URI_SAFE_ATTR,te):Ut,Ee=Rt(A,"ADD_DATA_URI_TAGS")?xe(On(ve),A.ADD_DATA_URI_TAGS,te):ve,ge=Rt(A,"FORBID_CONTENTS")?xe({},A.FORBID_CONTENTS,te):Cr,we=Rt(A,"FORBID_TAGS")?xe({},A.FORBID_TAGS,te):On({}),Ie=Rt(A,"FORBID_ATTR")?xe({},A.FORBID_ATTR,te):On({}),In=Rt(A,"USE_PROFILES")?A.USE_PROFILES:!1,be=A.ALLOW_ARIA_ATTR!==!1,fe=A.ALLOW_DATA_ATTR!==!1,C=A.ALLOW_UNKNOWN_PROTOCOLS||!1,$e=A.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Be=A.SAFE_FOR_TEMPLATES||!1,Re=A.SAFE_FOR_XML!==!1,Me=A.WHOLE_DOCUMENT||!1,ne=A.RETURN_DOM||!1,Nr=A.RETURN_DOM_FRAGMENT||!1,Lr=A.RETURN_TRUSTED_TYPE||!1,es=A.FORCE_BODY||!1,bn=A.SANITIZE_DOM!==!1,ua=A.SANITIZE_NAMED_PROPS||!1,Vn=A.KEEP_CONTENT!==!1,Sn=A.IN_PLACE||!1,K=A.ALLOWED_URI_REGEXP||pd,cr=A.NAMESPACE||hn,vt=A.MATHML_TEXT_INTEGRATION_POINTS||vt,Pr=A.HTML_INTEGRATION_POINTS||Pr,oe=A.CUSTOM_ELEMENT_HANDLING||{},A.CUSTOM_ELEMENT_HANDLING&&hr(A.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(oe.tagNameCheck=A.CUSTOM_ELEMENT_HANDLING.tagNameCheck),A.CUSTOM_ELEMENT_HANDLING&&hr(A.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(oe.attributeNameCheck=A.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),A.CUSTOM_ELEMENT_HANDLING&&typeof A.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(oe.allowCustomizedBuiltInElements=A.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Be&&(fe=!1),Nr&&(ne=!0),In&&(ie=xe({},Th),ce=Fa(null),In.html===!0&&(xe(ie,Ah),xe(ce,Ph)),In.svg===!0&&(xe(ie,Wo),xe(ce,eu),xe(ce,wa)),In.svgFilters===!0&&(xe(ie,Ko),xe(ce,eu),xe(ce,wa)),In.mathMl===!0&&(xe(ie,Qo),xe(ce,Oh),xe(ce,wa))),Rt(A,"ADD_TAGS")||(Y.tagCheck=null),Rt(A,"ADD_ATTR")||(Y.attributeCheck=null),A.ADD_TAGS&&(typeof A.ADD_TAGS=="function"?Y.tagCheck=A.ADD_TAGS:(ie===ae&&(ie=On(ie)),xe(ie,A.ADD_TAGS,te))),A.ADD_ATTR&&(typeof A.ADD_ATTR=="function"?Y.attributeCheck=A.ADD_ATTR:(ce===re&&(ce=On(ce)),xe(ce,A.ADD_ATTR,te))),A.ADD_URI_SAFE_ATTR&&xe(ts,A.ADD_URI_SAFE_ATTR,te),A.FORBID_CONTENTS&&(ge===Cr&&(ge=On(ge)),xe(ge,A.FORBID_CONTENTS,te)),A.ADD_FORBID_CONTENTS&&(ge===Cr&&(ge=On(ge)),xe(ge,A.ADD_FORBID_CONTENTS,te)),Vn&&(ie["#text"]=!0),Me&&xe(ie,["html","head","body"]),ie.table&&(xe(ie,["tbody"]),delete we.tbody),A.TRUSTED_TYPES_POLICY){if(typeof A.TRUSTED_TYPES_POLICY.createHTML!="function")throw gs('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof A.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw gs('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');V=A.TRUSTED_TYPES_POLICY,X=V.createHTML("")}else V===void 0&&(V=Bk(S,u)),V!==null&&typeof X=="string"&&(X=V.createHTML(""));It&&It(A),fn=A}},hi=xe({},[...Wo,...Ko,...Nk]),ns=xe({},[...Qo,...Lk]),$n=function(A){let he=j(A);(!he||!he.tagName)&&(he={namespaceURI:cr,tagName:"template"});const ue=Ga(A.tagName),Ne=Ga(he.tagName);return gt[A.namespaceURI]?A.namespaceURI===pe?he.namespaceURI===hn?ue==="svg":he.namespaceURI===oi?ue==="svg"&&(Ne==="annotation-xml"||vt[Ne]):!!hi[ue]:A.namespaceURI===oi?he.namespaceURI===hn?ue==="math":he.namespaceURI===pe?ue==="math"&&Pr[Ne]:!!ns[ue]:A.namespaceURI===hn?he.namespaceURI===pe&&!Pr[Ne]||he.namespaceURI===oi&&!vt[Ne]?!1:!ns[ue]&&(ui[ue]||!hi[ue]):!!(Or==="application/xhtml+xml"&>[A.namespaceURI]):!1},Mn=function(A){hs(t.removed,{element:A});try{j(A).removeChild(A)}catch{O(A)}},zt=function(A,he){try{hs(t.removed,{attribute:he.getAttributeNode(A),from:he})}catch{hs(t.removed,{attribute:null,from:he})}if(he.removeAttribute(A),A==="is")if(ne||Nr)try{Mn(he)}catch{}else try{he.setAttribute(A,"")}catch{}},rs=function(A){let he=null,ue=null;if(es)A="<remove></remove>"+A;else{const tt=Zo(A,/^[\r\n\t ]+/);ue=tt&&tt[0]}Or==="application/xhtml+xml"&&cr===hn&&(A='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+A+"</body></html>");const Ne=V?V.createHTML(A):A;if(cr===hn)try{he=new k().parseFromString(Ne,Or)}catch{}if(!he||!he.documentElement){he=H.createDocument(cr,"template",null);try{he.documentElement.innerHTML=Ar?X:Ne}catch{}}const Ae=he.body||he.documentElement;return A&&ue&&Ae.insertBefore(i.createTextNode(ue),Ae.childNodes[0]||null),cr===hn?E.call(he,Me?"html":"body")[0]:Me?he.documentElement:Ae},ca=function(A){return $.call(A.ownerDocument||A,A,m.SHOW_ELEMENT|m.SHOW_COMMENT|m.SHOW_TEXT|m.SHOW_PROCESSING_INSTRUCTION|m.SHOW_CDATA_SECTION,null)},lt=function(A){return A instanceof y&&(typeof A.nodeName!="string"||typeof A.textContent!="string"||typeof A.removeChild!="function"||!(A.attributes instanceof v)||typeof A.removeAttribute!="function"||typeof A.setAttribute!="function"||typeof A.namespaceURI!="string"||typeof A.insertBefore!="function"||typeof A.hasChildNodes!="function")},fi=function(A){return typeof h=="function"&&A instanceof h};function yt(A,he,ue){_a(A,Ne=>{Ne.call(t,he,ue,fn)})}const Nn=function(A){let he=null;if(yt(R.beforeSanitizeElements,A,null),lt(A))return Mn(A),!0;const ue=te(A.nodeName);if(yt(R.uponSanitizeElement,A,{tagName:ue,allowedTags:ie}),Re&&A.hasChildNodes()&&!fi(A.firstElementChild)&&kt(/<[/\w!]/g,A.innerHTML)&&kt(/<[/\w!]/g,A.textContent)||A.nodeType===ps.progressingInstruction||Re&&A.nodeType===ps.comment&&kt(/<[/\w]/g,A.data))return Mn(A),!0;if(!(Y.tagCheck instanceof Function&&Y.tagCheck(ue))&&(!ie[ue]||we[ue])){if(!we[ue]&&gi(ue)&&(oe.tagNameCheck instanceof RegExp&&kt(oe.tagNameCheck,ue)||oe.tagNameCheck instanceof Function&&oe.tagNameCheck(ue)))return!1;if(Vn&&!ge[ue]){const Ne=j(A)||A.parentNode,Ae=L(A)||A.childNodes;if(Ae&&Ne){const tt=Ae.length;for(let gn=tt-1;gn>=0;--gn){const nt=P(Ae[gn],!0);nt.__removalCount=(A.__removalCount||0)+1,Ne.insertBefore(nt,G(A))}}}return Mn(A),!0}return A instanceof d&&!$n(A)||(ue==="noscript"||ue==="noembed"||ue==="noframes")&&kt(/<\/no(script|embed|frames)/i,A.innerHTML)?(Mn(A),!0):(Be&&A.nodeType===ps.text&&(he=A.textContent,_a([T,F,D],Ne=>{he=fs(he,Ne," ")}),A.textContent!==he&&(hs(t.removed,{element:A.cloneNode()}),A.textContent=he)),yt(R.afterSanitizeElements,A,null),!1)},Ln=function(A,he,ue){if(Ie[he]||bn&&(he==="id"||he==="name")&&(ue in i||ue in li))return!1;if(!(fe&&!Ie[he]&&kt(N,he))&&!(be&&kt(B,he))&&!(Y.attributeCheck instanceof Function&&Y.attributeCheck(he,A))){if(!ce[he]||Ie[he]){if(!(gi(A)&&(oe.tagNameCheck instanceof RegExp&&kt(oe.tagNameCheck,A)||oe.tagNameCheck instanceof Function&&oe.tagNameCheck(A))&&(oe.attributeNameCheck instanceof RegExp&&kt(oe.attributeNameCheck,he)||oe.attributeNameCheck instanceof Function&&oe.attributeNameCheck(he,A))||he==="is"&&oe.allowCustomizedBuiltInElements&&(oe.tagNameCheck instanceof RegExp&&kt(oe.tagNameCheck,ue)||oe.tagNameCheck instanceof Function&&oe.tagNameCheck(ue))))return!1}else if(!ts[he]&&!kt(K,fs(ue,q,""))&&!((he==="src"||he==="xlink:href"||he==="href")&&A!=="script"&&bk(ue,"data:")===0&&Ee[A])&&!(C&&!kt(U,fs(ue,q,"")))&&ue)return!1}return!0},gi=function(A){return A!=="annotation-xml"&&Zo(A,W)},Rr=function(A){yt(R.beforeSanitizeAttributes,A,null);const{attributes:he}=A;if(!he||lt(A))return;const ue={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ce,forceKeepAttr:void 0};let Ne=he.length;for(;Ne--;){const{name:Ae,namespaceURI:tt,value:gn}=he[Ne],nt=te(Ae),Cn=gn;let De=Ae==="value"?Cn:Sk(Cn);if(ue.attrName=nt,ue.attrValue=De,ue.keepAttr=!0,ue.forceKeepAttr=void 0,yt(R.uponSanitizeAttribute,A,ue),De=ue.attrValue,ua&&(nt==="id"||nt==="name")&&(zt(Ae,A),De=_e+De),Re&&kt(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,De)){zt(Ae,A);continue}if(nt==="attributename"&&Zo(De,"href")){zt(Ae,A);continue}if(ue.forceKeepAttr)continue;if(!ue.keepAttr){zt(Ae,A);continue}if(!$e&&kt(/\/>/i,De)){zt(Ae,A);continue}Be&&_a([T,F,D],is=>{De=fs(De,is," ")});const Zn=te(A.nodeName);if(!Ln(Zn,nt,De)){zt(Ae,A);continue}if(V&&typeof S=="object"&&typeof S.getAttributeType=="function"&&!tt)switch(S.getAttributeType(Zn,nt)){case"TrustedHTML":De=V.createHTML(De);break;case"TrustedScriptURL":De=V.createScriptURL(De);break}if(De!==Cn)try{tt?A.setAttributeNS(tt,Ae,De):A.setAttribute(Ae,De),lt(A)?Mn(A):Ch(t.removed)}catch{zt(Ae,A)}}yt(R.afterSanitizeAttributes,A,null)},Dr=function A(he){let ue=null;const Ne=ca(he);for(yt(R.beforeSanitizeShadowDOM,he,null);ue=Ne.nextNode();)yt(R.uponSanitizeShadowNode,ue,null),Nn(ue),Rr(ue),ue.content instanceof c&&A(ue.content);yt(R.afterSanitizeShadowDOM,he,null)};return t.sanitize=function(A){let he=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ue=null,Ne=null,Ae=null,tt=null;if(Ar=!A,Ar&&(A="<!-->"),typeof A!="string"&&!fi(A))if(typeof A.toString=="function"){if(A=A.toString(),typeof A!="string")throw gs("dirty is not a string, aborting")}else throw gs("toString is not a function");if(!t.isSupported)return A;if(Mr||ci(he),t.removed=[],typeof A=="string"&&(Sn=!1),Sn){if(A.nodeName){const Cn=te(A.nodeName);if(!ie[Cn]||we[Cn])throw gs("root node is forbidden and cannot be sanitized in-place")}}else if(A instanceof h)ue=rs("<!---->"),Ne=ue.ownerDocument.importNode(A,!0),Ne.nodeType===ps.element&&Ne.nodeName==="BODY"||Ne.nodeName==="HTML"?ue=Ne:ue.appendChild(Ne);else{if(!ne&&!Be&&!Me&&A.indexOf("<")===-1)return V&&Lr?V.createHTML(A):A;if(ue=rs(A),!ue)return ne?null:Lr?X:""}ue&&es&&Mn(ue.firstChild);const gn=ca(Sn?A:ue);for(;Ae=gn.nextNode();)Nn(Ae),Rr(Ae),Ae.content instanceof c&&Dr(Ae.content);if(Sn)return A;if(ne){if(Nr)for(tt=w.call(ue.ownerDocument);ue.firstChild;)tt.appendChild(ue.firstChild);else tt=ue;return(ce.shadowroot||ce.shadowrootmode)&&(tt=M.call(s,tt,!0)),tt}let nt=Me?ue.outerHTML:ue.innerHTML;return Me&&ie["!doctype"]&&ue.ownerDocument&&ue.ownerDocument.doctype&&ue.ownerDocument.doctype.name&&kt(md,ue.ownerDocument.doctype.name)&&(nt="<!DOCTYPE "+ue.ownerDocument.doctype.name+`>
|
|
206
|
+
`+nt),Be&&_a([T,F,D],Cn=>{nt=fs(nt,Cn," ")}),V&&Lr?V.createHTML(nt):nt},t.setConfig=function(){ci(arguments.length>0&&arguments[0]!==void 0?arguments[0]:{}),Mr=!0},t.clearConfig=function(){fn=null,Mr=!1},t.isValidAttribute=function(A,he,ue){return fn||ci({}),Ln(te(A),te(he),ue)},t.addHook=function(A,he){typeof he=="function"&&hs(R[A],he)},t.removeHook=function(A,he){if(he!==void 0){const ue=xk(R[A],he);return ue===-1?void 0:Ek(R[A],ue,1)[0]}return Ch(R[A])},t.removeHooks=function(A){R[A]=[]},t.removeAllHooks=function(){R=Dh()},t}var yd=vd(),Uk=cn("<div><!></div>"),zk=cn('<div><button type="button"><!></button> <!></div>');function jk(e,t){Zi(t,!0);const i=()=>hd(Dl,"$controlsStore",s),[s,u]=fd(),c=tn(()=>t.controlOptions?.icon?yd.sanitize(t.controlOptions.icon.trim()):null),f=Mg("gm"),h=f.control.getDefaultPosition(),d=async()=>{t.control&&t.controlOptions?await f.options.toggleMode(t.control.type,t.control.targetMode):ee.error("Control or controlOptions not defined",t.control,t.controlOptions)};var m=Kr(),v=rr(m),y=k=>{var S=zk(),b=nn(S);let P;var O=nn(b),G=H=>{var $=Kr();ud(rr($),()=>ye(c)),Ze(H,$)},L=H=>{var $=Sh();_n(w=>Ai($,w),[()=>t.controlOptions.title.slice(0,2)]),Ze(H,$)},j=H=>{var $=Sh();_n(()=>Ai($,t.control.targetMode)),Ze(H,$)};wn(O,H=>{t.controlOptions.icon?H(G):t.controlOptions.title?H(L,1):H(j,-1)});var V=Ys(b,2),X=H=>{var $=Uk();let w;yk(nn($),{get control(){return t.control}}),_n(E=>w=Rs($,1,"control-menu svelte-uokk3b",null,w,E),[()=>({"menu-right":h.endsWith("left"),"menu-left":h.endsWith("right")})]),Ze(H,$)};wn(V,H=>{t.controlOptions.active&&H(X)}),_n(()=>{Rs(S,1,$w(i().settings.controlsStyles.controlContainerClass),"svelte-uokk3b"),vr(b,"id",`id_${t.control.type}_${t.control.targetMode}`),P=Rs(b,1,`${i().settings.controlsStyles.controlButtonClass} ${t.control.type}-${t.control.targetMode}`,"svelte-uokk3b",P,{active:t.controlOptions.active}),vr(b,"title",t.controlOptions.title)}),Js("click",b,d),Ze(k,S)};wn(v,k=>{t.control&&t.controlOptions&&t.controlOptions.uiEnabled&&k(y)}),Ze(e,m),Wi(),u()}ko(["click"]);var qk=cn('<div><div><button class="gm-control-button"><!></button></div></div>'),Yk=cn("<div></div>"),Hk=cn("<div></div>"),Jk=cn('<div class="gm-reactive-controls"><!> <!></div>');function Vk(e,t){Zi(t,!0);const i=()=>hd(Dl,"$controlsStore",s),[s,u]=fd();let c=Rn(!0),f=tn(()=>i().settings.controlsCollapsible),h=tn(()=>i().settings.controlsStyles);const d=(L,j)=>i().controls?.[L]?.[j]||null,m=(L,j)=>Object.entries(j).some(([V,X])=>d(L,V)&&X&&X.uiEnabled),v=()=>{Et(c,!ye(c))},y=()=>yd.sanitize(ye(c)?uk:lk),k=L=>Object.entries(L).map(([j,V],X)=>({key:j,options:V,originalIndex:X})).sort((j,V)=>{const X=j.options.order??1/0,H=V.options.order??1/0;return X!==H?X-H:j.originalIndex-V.originalIndex}).map(({key:j,options:V})=>[j,V]);var S=Jk(),b=nn(S),P=L=>{var j=qk(),V=nn(j),X=nn(V);ud(nn(X),y),_n(()=>Rs(V,1,`${ye(h).controlGroupClass} group-settings`)),Js("click",X,v),Ze(L,j)};wn(b,L=>{ye(f)&&L(P)});var O=Ys(b,2),G=L=>{var j=Hk();Xs(j,5,()=>Object.entries(i().options),([V,X])=>V,(V,X)=>{var H=tn(()=>$a(ye(X),2));let $=()=>ye(H)[0],w=()=>ye(H)[1];var E=Kr(),M=rr(E),R=F=>{var D=Yk();Xs(D,21,()=>k(w()),([N,B])=>N,(N,B)=>{var U=tn(()=>$a(ye(B),2));let q=()=>ye(U)[0],W=()=>ye(U)[1];const K=tn(()=>d($(),q()));var ie=Kr(),ae=rr(ie),ce=re=>{jk(re,{get control(){return ye(K)},get controlOptions(){return W()}})};wn(ae,re=>{ye(K)&&re(ce)}),Ze(N,ie)}),_n(()=>Rs(D,1,`${ye(h).controlGroupClass} group-${$()}`)),Ze(F,D)},T=tn(()=>m($(),w()));wn(M,F=>{ye(T)&&F(R)}),Ze(V,E)}),Ze(L,j)};wn(O,L=>{ye(c)&&L(G)}),Ze(e,S),Wi(),u()}ko(["click"]);var Xk=class{gm;constructor(e){this.gm=e}},$k=["mode_start","mode_started","mode_end","mode_ended"],Ke=e=>Object.keys(e),Ba=e=>Object.values(e),wr=(e,t)=>t.includes(e),_d=e=>ir(e)&&e.name===`${se}:control:switch`,ir=e=>!!(e&&typeof e=="object"&&["level","name","actionType","action"].every(t=>t in e)),Zk=e=>!!(e&&typeof e=="object"&&["type","originalEvent","target"].every(t=>t in e)),wd=["draw","edit","helper"],$b=[...wd,"control"],Fn=["marker","circle","circle_marker","ellipse","text_marker","line","rectangle","polygon"],kd=["dom_marker","vertex_marker","center_marker","edge_marker","snap_guide"],xd=[...Fn,...kd],Wk=["freehand","custom_shape"],Ed=[...Fn,...Wk],bd=["shape_markers","pin","snapping","snap_guides","measurements","auto_trace","geofencing","zoom_to_features","click_to_edit"],Sd=["drag","change","rotate","scale","copy","cut","split","union","difference","line_simplification","lasso","delete"],Fl=e=>ir(e)&&e.actionType==="draw",Kk=e=>ir(e)&&(e.name===`${se}:draw:shape`||e.name===`${se}:draw:shape_with_data`),Id=e=>Kk(e)&&e.variant==="line_drawer";var Gl=e=>ir(e)&&e.actionType==="helper",Qk=e=>ir(e)&&e.name===`${se}:helper:geofencing_violation`,Ki=e=>ir(e)&&e.actionType==="edit",e2=e=>wd.includes(e);var t2=e=>Ed.includes(e),n2=e=>Sd.includes(e),r2=e=>bd.includes(e),i2=e=>t2(e)||n2(e)||r2(e),s2=["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","mouseover","mouseout","contextmenu","touchstart","touchend","touchmove","touchcancel"];var He=(e,t={warning:!1})=>{if(!e)return t.warning&&ee.warn("Empty event",e),!1;const i=typeof e=="object"&&"lngLat"in e&&"point"in e&&"type"in e&&"originalEvent"in e&&typeof e.type=="string"&&s2.includes(e.type);return!i&&t.warning&&ee.warn("Not a pointer event",e),i},a2=e=>e.originalEvent.ctrlKey||e.originalEvent.shiftKey||e.originalEvent.altKey||e.originalEvent.metaKey,o2=e=>!!e&&typeof e=="object"&&"type"in e&&["symbol","fill","line","circle"].includes(e.type);var Fh=e=>e!=null,Bl=e=>ir(e)&&wr(e.action,$k),u2=class extends Xk{controls=Bt(Rf);reactiveControls=null;container=void 0;eventHandlers={[`${se}:draw`]:this.handleModeEvent.bind(this),[`${se}:edit`]:this.handleModeEvent.bind(this),[`${se}:helper`]:this.handleModeEvent.bind(this)};onAdd(){if(this.createControls().then(()=>{this.gm.events.bus.attachEvents(this.eventHandlers)}),!this.container)throw new Error("Controls container is not initialized");return this.container}async createControls(e=void 0){if(this.controlsAdded()){ee.warn("Can't add controls: controls already added");return}this.container=e||this.createHtmlContainer(),await this.createReactivePanel()}async onRemove(){this.gm.events.bus.detachEvents(this.eventHandlers),this.reactiveControls&&(await qw(this.reactiveControls),this.reactiveControls=null),this.container&&this.container.parentNode&&this.container.parentNode.removeChild(this.container),this.container=void 0}handleModeEvent(e){return Bl(e)?(["mode_started","mode_ended"].includes(e.action)&&this.updateReactivePanel(),{next:!0}):{next:!0}}controlsAdded(){return!!this.reactiveControls}async createReactivePanel(){if(!this.container){ee.error("Can't create reactive panel: container is not initialized");return}await this.syncModeStates();const e=new Map;e.set("gm",this.gm),this.reactiveControls=zw(Vk,{target:this.container,context:e}),this.updateReactivePanel()}updateReactivePanel(){Dl.update(()=>({controls:this.controls,options:this.gm.options.controls,settings:this.gm.options.settings}))}createHtmlContainer(){const e=document.createElement("div");return e.classList.add("geoman-controls"),e}async syncModeStates(){await this.eachControlWithOptions(({control:e})=>{this.gm.options.syncModeState(e.type,e.targetMode)})}async eachControlWithOptions(e){for(const t of Ke(this.controls)){const i=this.controls[t];for(const s of Object.keys(i)){const u=s,c=this.getControl({modeType:t,modeName:u}),f=this.gm.options.getControlOptions({modeType:t,modeName:u});c&&f&&await e({control:c,controlOptions:f})}}}getControl({modeType:e,modeName:t}){return e&&t&&this.controls[e][t]||null}getDefaultPosition(){return this.gm.options.settings.controlsPosition}},l2=class{gm;globalEventsListener=null;constructor(e){this.gm=e}get map(){return this.gm.mapAdapter.getMapInstance()}async processEvent(e,t){await this.fireToMap({type:"system",eventName:e.split(":")[1],payload:{...t,level:"user"}}),t.action==="mode_start"||t.action==="mode_end"?await this.forwardModeToggledEvent(t):t.action==="feature_created"?await this.forwardFeatureCreated(t):t.action==="feature_removed"?await this.forwardFeatureRemoved(t):t.action==="feature_updated"?await this.forwardFeatureUpdated(t):t.action==="feature_edit_start"?await this.forwardFeatureEditStart(t):t.action==="feature_edit_end"?await this.forwardFeatureEditEnd(t):t.action==="selection_change"?await this.forwardSelectionChanged(t):(t.action==="loaded"||t.action==="unloaded")&&await this.forwardGeomanLoaded(t)}async forwardModeToggledEvent(e){const t=e.action==="mode_start";if(e.actionType==="draw"){const i="globaldrawmodetoggled",s={name:`gm:${i}`,actionType:e.actionType,action:e.action,enabled:t,shape:e.mode,map:this.map};await this.fireToMap({type:"converted",eventName:i,payload:s});const u=t?"drawstart":"drawend",c={name:`gm:${u}`,actionType:e.actionType,action:e.action,shape:e.mode,map:this.map};await this.fireToMap({type:"converted",eventName:u,payload:c})}else if(e.actionType==="edit"){const i=`global${this.getConvertedEditModeName(e.mode)}modetoggled`,s={name:`gm:${i}`,actionType:e.actionType,action:e.action,enabled:t,map:this.map};await this.fireToMap({type:"converted",eventName:i,payload:s})}else if(e.actionType==="helper"){const i=`global${e.mode}modetoggled`,s={name:`gm:${i}`,actionType:e.actionType,action:e.action,enabled:t,map:this.map};await this.fireToMap({type:"converted",eventName:i,payload:s})}}async forwardFeatureCreated(e){const t={name:"gm:create",actionType:e.actionType,action:e.action,shape:e.mode,feature:e.featureData,map:this.map};await this.fireToMap({type:"converted",eventName:"create",payload:t})}async forwardFeatureRemoved(e){const t={name:"gm:remove",actionType:e.actionType,action:e.action,shape:e.mode,feature:e.featureData,map:this.map};await this.fireToMap({type:"converted",eventName:"remove",payload:t})}async forwardFeatureUpdated(e){const t=this.getConvertedEditModeName(e.mode),i=["lasso"],s={name:`gm:${t}`,actionType:e.actionType,action:e.action,map:this.map};e.sourceFeatures.length===1&&!i.includes(e.mode)?s.originalFeature=e.sourceFeatures[0]:s.originalFeatures=e.sourceFeatures,e.targetFeatures.length===1&&!i.includes(e.mode)?(s.feature=e.targetFeatures[0],s.shape=s.feature.shape):s.features=e.targetFeatures,await this.fireToMap({type:"converted",eventName:`${t}`,payload:s})}async forwardFeatureEditStart(e){const t=this.getConvertedEditModeName(e.mode),i={name:`gm:${t}start`,actionType:e.actionType,action:e.action,shape:e.feature.shape,feature:e.feature,map:this.map};await this.fireToMap({type:"converted",eventName:`${t}start`,payload:i})}async forwardFeatureEditEnd(e){const t=this.getConvertedEditModeName(e.mode),i={name:`gm:${t}end`,actionType:e.actionType,action:e.action,shape:e.feature.shape,feature:e.feature,map:this.map};await this.fireToMap({type:"converted",eventName:`${t}end`,payload:i})}async forwardSelectionChanged(e){const t={name:"gm:selection",actionType:e.actionType,action:e.action,selection:e.selection,map:this.map};await this.fireToMap({type:"converted",eventName:"selection",payload:t})}async forwardGeomanLoaded(e){const t={name:`gm:${e.action}`,actionType:e.actionType,action:e.action,map:this.map,gm:this.gm};await this.fireToMap({type:"converted",eventName:`${t.action}`,payload:t})}async fireToMap({type:e,eventName:t,payload:i}){const s=`${e==="system"?se:"gm"}:${t}`;if(this.gm.options.settings.awaitDataUpdatesOnEvents&&"feature"in i&&i.feature?.source){const u=i.feature.source.id;await this.gm.features.updateManager.waitForPendingUpdates(u)}this.globalEventsListener?.(i),this.gm.mapAdapter.fire(s,i)}getConvertedEditModeName(e){return e==="change"?"edit":e}},c2=class{gm;forwarder;mapEventHandlers={};gmEventHandlers={};constructor(e){this.gm=e,this.forwarder=new l2(e)}pendingForward=Promise.resolve();async fireEvent(e,t){const i=this.gmEventHandlers[e];if(!i)return;const{controlHandler:s}=i;await s(t),this.pendingForward=this.pendingForward.then(()=>this.forwarder.processEvent(e,t))}attachEvents(e){Ke(e).forEach(t=>{const i=e[t];i&&this.on(t,i)})}detachEvents(e){Ke(e).forEach(t=>{const i=e[t];i&&this.off(t,i)})}detachAllEvents(){Ke(this.gmEventHandlers).forEach(e=>{Array.from(this.gmEventHandlers[e]?.handlers||[]).forEach(t=>{this.off(e,t)})}),Ke(this.mapEventHandlers).forEach(e=>{Array.from(this.mapEventHandlers[e]?.handlers||[]).forEach(t=>{this.off(e,t)})})}on(e,t){e.startsWith(se)?this.onGmEvent(e,t):this.onMapEvent(e,t)}onGmEvent(e,t){this.gmEventHandlers[e]||(this.gmEventHandlers[e]=this.createEventSection(e)),this.gmEventHandlers[e]?.handlers.unshift(t)}onMapEvent(e,t){if(!this.mapEventHandlers[e]){const i=this.createEventSection(e);this.gm.mapAdapter.on(e,i.controlHandler),this.mapEventHandlers[e]=i}this.mapEventHandlers[e]?.handlers.unshift(t)}off(e,t){e.startsWith(`${se}`)?this.offGmEvent(e,t):this.offMapEvent(e,t)}offGmEvent(e,t){const i=this.gmEventHandlers[e]?.handlers||[],s=i.findIndex(u=>t===u);s===-1?ee.warn("MapEvents: handler not found",e,t):(i.splice(s,1),i.length===0&&delete this.gmEventHandlers[e])}offMapEvent(e,t){const i=this.mapEventHandlers[e]?.handlers||[],s=i.findIndex(u=>t===u);if(s===-1)ee.warn("MapEvents: handler not found",e,t);else if(i.splice(s,1),i.length===0){const u=this.mapEventHandlers[e]?.controlHandler;u&&this.gm.mapAdapter.off(e,u),delete this.mapEventHandlers[e]}}createEventSection(e){return{handlers:[],controlHandler:async t=>{let i;if(ir(t)&&e.startsWith(`${se}`)?i=this.gmEventHandlers[e]:i=this.mapEventHandlers[e],!i){ee.debug(`No handlers for eventName: "${e}"`);return}for(const s of[...i.handlers]){let u;if(ir(t)?u=await s(t):Zk(t)?u=await s(t):ee.error("EventsBus: unknown event type",t),u&&typeof u=="object"&&"next"in u){if(!u.next)break}else ee.error('EventsBus: handler should return an object with a "next" property')}}}}},xo=class{gm;constructor(e){this.gm=e}async trackExclusiveModes(e){if(e.action!=="mode_start")return;const{sectionName:t,modeName:i}=this.getControlIds(e)||{};this.getControl(e)?.settings.exclusive&&await this.gm.control.eachControlWithOptions(async s=>{const u=s.control.type,c=s.control.targetMode;u===t&&c===i||s.controlOptions.active&&s.control.settings.exclusive&&await this.gm.options.disableMode(u,c)})}async trackRelatedModes(e){Bl(e)&&await this.gm.control.eachControlWithOptions(async t=>{const i=t.control,{type:s,targetMode:u}=i;i.settings.enabledBy?.includes(e.mode)&&(e.action==="mode_start"?(this.gm.options.isModeEnabled(s,u)&&await this.gm.options.disableMode(s,u),await this.gm.options.enableMode(s,u)):e.action==="mode_end"?await this.gm.options.disableMode(s,u):ee.error("Unknown mode action",e.action))})}getControl(e){const{modeName:t,sectionName:i}=this.getControlIds(e)||{};return t&&i?this.gm.control.getControl({modeType:i,modeName:t}):null}getControlOptions(e){const{modeName:t,sectionName:i}=this.getControlIds(e)||{};return t&&i?this.gm.options.getControlOptions({modeType:i,modeName:t}):null}getControlIds(e){let t=null,i=null;return e.action==="mode_start"?(t=e.actionType,i=e.mode):_d(e)&&(t=e.section,i=e.mode),t&&i?{sectionName:t,modeName:i}:null}},h2=class extends xo{eventHandlers={[`${se}:control`]:this.handleControlEvent.bind(this)};constructor(e,t){super(e),t.attachEvents(this.eventHandlers)}handleControlEvent(e){return _d(e)?(this.getControl(e)||ee.error("Control not found, event payload",e),{next:!0}):{next:!0}}},f2=e=>Array.isArray(e)&&e.length===2&&typeof e[0]=="number"&&typeof e[1]=="number",ka={id:e=>typeof e=="string"||typeof e=="number",shape:e=>typeof e=="string"&&wr(e,xd),center:e=>f2(e),xSemiAxis:e=>typeof e=="number",ySemiAxis:e=>typeof e=="number",angle:e=>typeof e=="number",text:e=>typeof e=="string",disableEdit:e=>typeof e=="boolean",group:e=>typeof e=="string"},Wa=class{isMarkerInstanceAvailable(){return this.markerInstance?!0:(ee.error("Marker instance is not available"),!1)}},at=63710088e-1,Md={centimeters:at*100,centimetres:at*100,degrees:360/(2*Math.PI),feet:at*3.28084,inches:at*39.37,kilometers:at/1e3,kilometres:at/1e3,meters:at,metres:at,miles:at/1609.344,millimeters:at*1e3,millimetres:at*1e3,nauticalmiles:at/1852,radians:1,yards:at*1.0936};function ln(e,t,i={}){const s={type:"Feature"};return(i.id===0||i.id)&&(s.id=i.id),i.bbox&&(s.bbox=i.bbox),s.properties=t||{},s.geometry=e,s}function Dt(e,t,i={}){if(!e)throw new Error("coordinates is required");if(!Array.isArray(e))throw new Error("coordinates must be an Array");if(e.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Ka(e[0])||!Ka(e[1]))throw new Error("coordinates must contain numbers");return ln({type:"Point",coordinates:e},t,i)}function kr(e,t,i={}){for(const s of e){if(s.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(s[s.length-1].length!==s[0].length)throw new Error("First and last Position are not equivalent.");for(let u=0;u<s[s.length-1].length;u++)if(s[s.length-1][u]!==s[0][u])throw new Error("First and last Position are not equivalent.")}return ln({type:"Polygon",coordinates:e},t,i)}function xr(e,t,i={}){if(e.length<2)throw new Error("coordinates must be an array of two or more positions");return ln({type:"LineString",coordinates:e},t,i)}function et(e,t={}){const i={type:"FeatureCollection"};return t.id&&(i.id=t.id),t.bbox&&(i.bbox=t.bbox),i.features=e,i}function g2(e,t,i={}){return ln({type:"MultiLineString",coordinates:e},t,i)}function Nd(e,t,i={}){return ln({type:"MultiPolygon",coordinates:e},t,i)}function Ul(e,t="kilometers"){const i=Md[t];if(!i)throw new Error(t+" units is invalid");return e*i}function zl(e,t="kilometers"){const i=Md[t];if(!i)throw new Error(t+" units is invalid");return e/i}function Qr(e){return e%(2*Math.PI)*180/Math.PI}function ot(e){return e%360*Math.PI/180}function Ld(e,t="kilometers",i="kilometers"){if(!(e>=0))throw new Error("length must be a positive number");return Ul(zl(e,t),i)}function Ka(e){return!isNaN(e)&&e!==null&&!Array.isArray(e)}function Eo(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function br(e,t,i){if(e!==null)for(var s,u,c,f,h,d,m,v=0,y=0,k,S=e.type,b=S==="FeatureCollection",P=S==="Feature",O=b?e.features.length:1,G=0;G<O;G++){m=b?e.features[G].geometry:P?e.geometry:e,k=m?m.type==="GeometryCollection":!1,h=k?m.geometries.length:1;for(var L=0;L<h;L++){var j=0,V=0;if(f=k?m.geometries[L]:m,f!==null){d=f.coordinates;var X=f.type;switch(v=i&&(X==="Polygon"||X==="MultiPolygon")?1:0,X){case null:break;case"Point":if(t(d,y,G,j,V)===!1)return!1;y++,j++;break;case"LineString":case"MultiPoint":for(s=0;s<d.length;s++){if(t(d[s],y,G,j,V)===!1)return!1;y++,X==="MultiPoint"&&j++}X==="LineString"&&j++;break;case"Polygon":case"MultiLineString":for(s=0;s<d.length;s++){for(u=0;u<d[s].length-v;u++){if(t(d[s][u],y,G,j,V)===!1)return!1;y++}X==="MultiLineString"&&j++,X==="Polygon"&&V++}X==="Polygon"&&j++;break;case"MultiPolygon":for(s=0;s<d.length;s++){for(V=0,u=0;u<d[s].length;u++){for(c=0;c<d[s][u].length-v;c++){if(t(d[s][u][c],y,G,j,V)===!1)return!1;y++}V++}j++}break;case"GeometryCollection":for(s=0;s<f.geometries.length;s++)if(br(f.geometries[s],t,i)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function Hn(e,t){if(e.type==="Feature")t(e,0);else if(e.type==="FeatureCollection")for(var i=0;i<e.features.length&&t(e.features[i],i)!==!1;i++);}function d2(e,t,i){var s=i;return Hn(e,function(u,c){c===0&&i===void 0?s=u:s=t(s,u,c)}),s}function si(e,t){var i,s,u,c,f,h,d,m,v,y,k=0,S=e.type==="FeatureCollection",b=e.type==="Feature",P=S?e.features.length:1;for(i=0;i<P;i++){for(h=S?e.features[i].geometry:b?e.geometry:e,m=S?e.features[i].properties:b?e.properties:{},v=S?e.features[i].bbox:b?e.bbox:void 0,y=S?e.features[i].id:b?e.id:void 0,d=h?h.type==="GeometryCollection":!1,f=d?h.geometries.length:1,u=0;u<f;u++){if(c=d?h.geometries[u]:h,c===null){if(t(null,k,m,v,y)===!1)return!1;continue}switch(c.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":if(t(c,k,m,v,y)===!1)return!1;break;case"GeometryCollection":for(s=0;s<c.geometries.length;s++)if(t(c.geometries[s],k,m,v,y)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}k++}}function p2(e,t,i){var s=i;return si(e,function(u,c,f,h,d){s=t(s,u,c,f,h,d)}),s}function Er(e,t){si(e,function(i,s,u,c,f){var h=i===null?null:i.type;switch(h){case null:case"Point":case"LineString":case"Polygon":return t(ln(i,u,{bbox:c,id:f}),s,0)===!1?!1:void 0}var d;switch(h){case"MultiPoint":d="Point";break;case"MultiLineString":d="LineString";break;case"MultiPolygon":d="Polygon";break}for(var m=0;m<i.coordinates.length;m++){var v=i.coordinates[m];if(t(ln({type:d,coordinates:v},u),s,m)===!1)return!1}})}function tr(e,t={}){if(e.bbox!=null&&t.recompute!==!0)return e.bbox;const i=[1/0,1/0,-1/0,-1/0];return br(e,s=>{i[0]>s[0]&&(i[0]=s[0]),i[1]>s[1]&&(i[1]=s[1]),i[2]<s[0]&&(i[2]=s[0]),i[3]<s[1]&&(i[3]=s[1])}),i}var Cd=tr;function Qe(e){if(!e)throw new Error("coord is required");if(!Array.isArray(e)){if(e.type==="Feature"&&e.geometry!==null&&e.geometry.type==="Point")return[...e.geometry.coordinates];if(e.type==="Point")return[...e.coordinates]}if(Array.isArray(e)&&e.length>=2&&!Array.isArray(e[0])&&!Array.isArray(e[1]))return[...e];throw new Error("coord must be GeoJSON Point or an Array of numbers")}function Ft(e){if(Array.isArray(e))return e;if(e.type==="Feature"){if(e.geometry!==null)return e.geometry.coordinates}else if(e.coordinates)return e.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function ra(e){return e.type==="Feature"?e.geometry:e}function Gh(e,t){return e.type==="FeatureCollection"?"FeatureCollection":e.type==="GeometryCollection"?"GeometryCollection":e.type==="Feature"&&e.geometry!==null?e.geometry.type:e.type}function Ad(e,t,i,s={}){const u=Qe(e),c=ot(u[0]),f=ot(u[1]),h=ot(i),d=zl(t,s.units),m=Math.asin(Math.sin(f)*Math.cos(d)+Math.cos(f)*Math.sin(d)*Math.cos(h)),v=Qr(c+Math.atan2(Math.sin(h)*Math.sin(d)*Math.cos(f),Math.cos(d)-Math.sin(f)*Math.sin(m))),y=Qr(m);return u[2]!==void 0?Dt([v,y,u[2]],s.properties):Dt([v,y],s.properties)}function m2(e,t,i={}){const s=i.steps||64,u=i.properties?i.properties:!Array.isArray(e)&&e.type==="Feature"&&e.properties?e.properties:{},c=[];for(let f=0;f<s;f++)c.push(Ad(e,t,f*-360/s,i).geometry.coordinates);return c.push(c[0]),kr([c],u)}var v2=m2;function Td(e,t={}){let i=0,s=0,u=0;return br(e,function(c){i+=c[0],s+=c[1],u++},!0),Dt([i/u,s/u],t.properties)}var zu=Td;function y2(e,t,i={}){let s;return i.final?s=Bh(Qe(t),Qe(e)):s=Bh(Qe(e),Qe(t)),s>180?-(360-s):s}function Bh(e,t){const i=ot(e[1]),s=ot(t[1]);let u=ot(t[0]-e[0]);u>Math.PI&&(u-=2*Math.PI),u<-Math.PI&&(u+=2*Math.PI);const c=Math.log(Math.tan(s/2+Math.PI/4)/Math.tan(i/2+Math.PI/4));return(Qr(Math.atan2(u,c))+360)%360}function _2(e,t,i={}){const s=Qe(e),u=Qe(t);return u[0]+=u[0]-s[0]>180?-360:s[0]-u[0]>180?360:0,Ld(w2(s,u),"meters",i.units)}function w2(e,t,i){i=i===void 0?at:Number(i);const s=i,u=e[1]*Math.PI/180,c=t[1]*Math.PI/180,f=c-u;let h=Math.abs(t[0]-e[0])*Math.PI/180;h>Math.PI&&(h-=2*Math.PI);const d=Math.log(Math.tan(c/2+Math.PI/4)/Math.tan(u/2+Math.PI/4)),m=Math.abs(d)>1e-11?f/d:Math.cos(u);return Math.sqrt(f*f+m*m*h*h)*s}function k2(e,t,i,s={}){const u=t<0;let c=Ld(Math.abs(t),s.units,"meters");u&&(c=-Math.abs(c));const f=Qe(e),h=x2(f,c,i);return h[0]+=h[0]-f[0]>180?-360:f[0]-h[0]>180?360:0,Dt(h,s.properties)}function x2(e,t,i,s){s=s===void 0?at:Number(s);const u=t/s,c=e[0]*Math.PI/180,f=ot(e[1]),h=ot(i),d=u*Math.cos(h);let m=f+d;Math.abs(m)>Math.PI/2&&(m=m>0?Math.PI-m:-Math.PI-m);const v=Math.log(Math.tan(m/2+Math.PI/4)/Math.tan(f/2+Math.PI/4)),y=Math.abs(v)>1e-11?d/v:Math.cos(f);return[((c+u*Math.sin(h)/y)*180/Math.PI+540)%360-180,m*180/Math.PI]}function bo(e){if(!e)throw new Error("geojson is required");switch(e.type){case"Feature":return Pd(e);case"FeatureCollection":return E2(e);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return jl(e);default:throw new Error("unknown GeoJSON type")}}function Pd(e){const t={type:"Feature"};return Object.keys(e).forEach(i=>{switch(i){case"type":case"properties":case"geometry":return;default:t[i]=e[i]}}),t.properties=Od(e.properties),e.geometry==null?t.geometry=null:t.geometry=jl(e.geometry),t}function Od(e){const t={};return e&&Object.keys(e).forEach(i=>{const s=e[i];typeof s=="object"?s===null?t[i]=null:Array.isArray(s)?t[i]=s.map(u=>u):t[i]=Od(s):t[i]=s}),t}function E2(e){const t={type:"FeatureCollection"};return Object.keys(e).forEach(i=>{switch(i){case"type":case"features":return;default:t[i]=e[i]}}),t.features=e.features.map(i=>Pd(i)),t}function jl(e){const t={type:e.type};return e.bbox&&(t.bbox=e.bbox),e.type==="GeometryCollection"?(t.geometries=e.geometries.map(i=>jl(i)),t):(t.coordinates=Rd(e.coordinates),t)}function Rd(e){const t=e;return typeof t[0]!="object"?t.slice():t.map(i=>Rd(i))}var b2=bo;function Dd(e,t,i){if(i=i||{},!Eo(i))throw new Error("options is invalid");const s=i.pivot,u=i.mutate;if(!e)throw new Error("geojson is required");if(t==null||isNaN(t))throw new Error("angle is required");if(t===0)return e;const c=s??Td(e);return(u===!1||u===void 0)&&(e=bo(e)),br(e,function(f){const h=y2(c,f)+t,d=Ft(k2(c,_2(c,f),h));f[0]=d[0],f[1]=d[1]}),e}var tu=Dd;function Uh(e,t,i,s){s=s||{};let u=s.steps||64;const c=s.units||"kilometers";let f=s.angle||0;const h=s.pivot||e,d=s.properties||{};if(!e)throw new Error("center is required");if(!t)throw new Error("xSemiAxis is required");if(!i)throw new Error("ySemiAxis is required");if(!Eo(s))throw new Error("options must be an object");if(!Ka(u))throw new Error("steps must be a number");if(!Ka(f))throw new Error("angle must be a number");const m=Qe(Dd(Dt(Qe(e)),f,{pivot:h}));f=-90+f,u=Math.ceil(u/4);const v=[],y=[],k=t,S=i,b=S,P=(k-S)/(Math.PI/2),O=(k+S)*Math.PI/4,G=.5,L=u;let j=0,V=0;for(let H=0;H<u;H++)V+=j,P===0?j=O/L/b:j=(-(P*V+b)+Math.sqrt(Math.pow(P*V+b,2)-4*(G*P)*-(O/L)))/(2*(G*P)),V!=0&&v.push(V);y.push(0);for(let H=0;H<v.length;H++)y.push(v[H]);y.push(Math.PI/2);for(let H=0;H<v.length;H++)y.push(Math.PI-v[v.length-H-1]);y.push(Math.PI);for(let H=0;H<v.length;H++)y.push(Math.PI+v[H]);y.push(3*Math.PI/2);for(let H=0;H<v.length;H++)y.push(2*Math.PI-v[v.length-H-1]);y.push(0);const X=[];for(const H of y){const $=Math.atan2(S*Math.sin(H),k*Math.cos(H)),w=Math.sqrt(Math.pow(k,2)*Math.pow(S,2)/(Math.pow(k*Math.sin($),2)+Math.pow(S*Math.cos($),2)));X.push(Ad(m,w,f+Qr($),{units:c}).geometry.coordinates)}return kr([X],d)}function Fd(e,t,i={}){if(i.final===!0)return S2(e,t);const s=Qe(e),u=Qe(t),c=ot(s[0]),f=ot(u[0]),h=ot(s[1]),d=ot(u[1]),m=Math.sin(f-c)*Math.cos(d),v=Math.cos(h)*Math.sin(d)-Math.sin(h)*Math.cos(d)*Math.cos(f-c);return Qr(Math.atan2(m,v))}function S2(e,t){let i=Fd(t,e);return i=(i+180)%360,i}var Qa=Fd;function Ti(e,t,i={}){var s=Qe(e),u=Qe(t),c=ot(u[1]-s[1]),f=ot(u[0]-s[0]),h=ot(s[1]),d=ot(u[1]),m=Math.pow(Math.sin(c/2),2)+Math.pow(Math.sin(f/2),2)*Math.cos(h)*Math.cos(d);return Ul(2*Math.atan2(Math.sqrt(m),Math.sqrt(1-m)),i.units)}var Gd=Ti;function ju(e,t={}){const i=ra(e);switch(!t.properties&&e.type==="Feature"&&(t.properties=e.properties),i.type){case"Polygon":return I2(i,t);case"MultiPolygon":return M2(i,t);default:throw new Error("invalid poly")}}function I2(e,t={}){const i=ra(e).coordinates;return Bd(i,t.properties?t.properties:e.type==="Feature"?e.properties:{})}function M2(e,t={}){const i=ra(e).coordinates,s=t.properties?t.properties:e.type==="Feature"?e.properties:{},u=[];return i.forEach(c=>{u.push(Bd(c,s))}),et(u)}function Bd(e,t){return e.length>1?g2(e,t):xr(e[0],t)}var qu=(e,t)=>e[0]===t[0]&&e[1]===t[1],Ud=e=>e.type==="Feature"&&e.geometry.type==="LineString";var zd=e=>e.type==="Feature"&&e.geometry.type==="Polygon",jd=e=>e.type==="Feature"&&e.geometry.type==="MultiPolygon";var So=(e,t)=>({lng:t[0]-e[0],lat:t[1]-e[1]}),eo=e=>Array.isArray(e)&&e.length>=2&&e.length<=3&&e.every(t=>typeof t=="number"),ia=(e,t,i=!1)=>{let s=0;const u=["features","geometries","geometry","coordinates"],c=(f,h,d=!1)=>{eo(f)?(t({coordinate:f,path:h},s),s+=1):Array.isArray(f)?f.forEach((m,v)=>{d&&i&&v===f.length-1&&eo(m)||c(m,[...h,v],d)}):typeof f=="object"&&f!==null&&Ke(f).forEach(m=>{const v=f[m];if(u.includes(m)&&v){const y="type"in f&&f.type,k=y==="Polygon"||y==="MultiPolygon";c(v,[...h,m],k)}})};c(e,[])},N2=(e,t)=>{let i={coordinate:[0,0],path:[]},s=-1;try{ia(e,(u,c)=>{if(t[0]===u.coordinate[0]&&t[1]===u.coordinate[1])throw s=c,i=u,new Error("stop")})}catch{if(i)return{index:s,coordinate:i.coordinate,path:i.path}}return null},qd=(e,t)=>{let i=0;const s=["features","geometries","geometry","coordinates"],u=(c,f,h,d)=>{eo(c)&&eo(f)?(t({start:{coordinate:[...c],path:h},end:{coordinate:[...f],path:d}},i),i+=1):Array.isArray(c)?c.forEach((m,v)=>{u(m,c[v+1],[...h,v],[...h,v+1])}):typeof c=="object"&&c!==null&&Ke(c).forEach(m=>{const v=c[m];s.includes(m)&&v&&u(v,void 0,[...h,m],[])})};u(e,void 0,[],[])},Io=(e,t)=>{let i={absCoordIndex:-1,featureIndex:-1,multiFeatureIndex:-1,geometryIndex:-1};try{br(e,(s,u,c,f,h)=>{if(s[0]===t[0]&&s[1]===t[1])throw i={absCoordIndex:u,featureIndex:c,multiFeatureIndex:f,geometryIndex:h},new Error("found")})}catch{}return i};var bi=(e,t)=>{const[i,s]=e,[u,c]=t;return[Math.min(i,u),Math.min(s,c),Math.max(i,u),Math.max(s,c)]},Yu=(e,t)=>{const i=bi(e,t),s=[i[0],i[1]],u=[i[2],i[3]],c=s[0],f=s[1],h=u[0],d=u[1];return{type:"Feature",properties:{shape:"rectangle"},geometry:{type:"Polygon",coordinates:[[[c,f],[h,f],[h,d],[c,d],[c,f]]]}}},Hu=e=>[e.geometry.coordinates[0],e.geometry.coordinates[1]],ql=e=>{const t=Cd(e);return[[t[0],t[1]],[t[2],t[3]]]};var nu=e=>{let t=0;return br(e,()=>{t+=1},!0),t},L2=e=>{const t=[];return br(e,i=>{t.push([i[0],i[1]])},!0),t},Yl=e=>{const t=L2(e);return t.some(i=>!Ji(t[0],i))},Hl=e=>{let t=null;try{ia(e,i=>{throw t=i.coordinate,new Error("found")})}catch{return t}return null},Fs=(e,t)=>Math.sqrt((e[0]-t[0])**2+(e[1]-t[1])**2),C2=(e,t,i)=>{const[s,u]=[e[0],e[1]],[c,f]=[t[0],t[1]],[h,d]=[i[0],i[1]],m=c-s,v=f-u,y=h-s,k=d-u;let S=(y*m+k*v)/(m*m+v*v);return S=Math.max(0,Math.min(1,S)),[s+S*m,u+S*v]},A2=(e,t)=>{const{absCoordIndex:i}=Io(e,t);return i!==-1?(e.geometry.coordinates.splice(i,1),!0):!1},T2=(e,t)=>{const i=Io(e,t);if(i.absCoordIndex!==-1){const s=[i.geometryIndex],u=Ri(e.geometry.coordinates,s),c=u.findIndex(f=>Ji(f,t));return u.length<=4?(e.geometry.coordinates.splice(i.geometryIndex,1),!0):(u.splice(c,1),c===0&&(u[u.length-1]=[...u[0]]),!0)}return!1},P2=(e,t)=>{const i=Io(e,t);if(i.absCoordIndex!==-1){const s=[i.multiFeatureIndex,i.geometryIndex],u=Ri(e.geometry.coordinates,s),c=u.findIndex(f=>Ji(f,t));if(u.length<=4){s.pop();const f=Ri(e.geometry.coordinates,i.multiFeatureIndex);return f.splice(i.geometryIndex,1),f.length===0&&e.geometry.coordinates.splice(i.multiFeatureIndex,1),!0}return u.splice(c,1),c===0&&(u[u.length-1]=[...u[0]]),!0}return!1},O2=(e,t)=>Ud(e)?A2(e,t):zd(e)?T2(e,t):jd(e)?P2(e,t):!1;var R2=(e,t="marker")=>({type:"Feature",properties:{shape:t},geometry:{type:"Point",coordinates:e}}),Mo=({center:e,radius:t,steps:i=80})=>{const s=v2(e,t,{steps:i,units:"meters"});return s.geometry.coordinates[0][0]=[...s.geometry.coordinates[0][0]],s},zh=({center:e,xSemiAxisLngLat:t,rimLngLat:i})=>{let s=Ti(e,t,{units:"meters"});s===0&&(s=1);const u=Qa(e,t)-90;let c=0;if(i){const f=-u*Math.PI/180,h=-(Qa(e,i)-90)*Math.PI/180,d=Ti(e,i,{units:"meters"}),m=d*Math.cos(h),v=d*Math.sin(h),y=m*Math.cos(f)+v*Math.sin(f),k=m*-Math.sin(f)+v*Math.cos(f),S=y*y/(s*s);c=Math.abs(k)/Math.sqrt(1-S),isNaN(c)&&(c=0)}return{xSemiAxis:s,ySemiAxis:c,angle:u}},Yd=80,No=({center:e,xSemiAxis:t,ySemiAxis:i,angle:s,properties:u={}})=>{const c={steps:Yd,angle:s,units:"meters"};if(i===void 0||i===0)return xr(Uh(e,t,1,c).geometry.coordinates[0].slice(0,41),{__gm_shape:"line"});const f=Uh(e,t,i,{...c,properties:{...u,[`${rt}shape`]:"ellipse",[`${rt}center`]:e,[`${rt}xSemiAxis`]:t,[`${rt}ySemiAxis`]:i,[`${rt}angle`]:s}});return f.geometry.coordinates[0][0]=[...f.geometry.coordinates[0][0]],f},D2=["circle","ellipse","rectangle"],ru=class Hd{gm;id="no-id";parent=null;markers;source;_geoJson=null;constructor(t){this.gm=t.gm,this.id=t.id,this.source=t.source,this.parent=t.parent,this.markers=new Map;const i={...t.geoJsonShapeFeature,properties:{...this.parseExtraProperties(t.geoJsonShapeFeature),...this.parseGmShapeProperties(t.geoJsonShapeFeature)}};if(t.skipSourceUpdate){if(this._geoJson={...i,id:this.id},this.shape==="circle"){const s=Hu(zu(this._geoJson));this._geoJson.properties[`${rt}center`]=s}}else this.addGeoJson(i).then()}get shape(){const t=this.getShapeProperty("shape");if(typeof t=="string"&&wr(t,xd))return t;throw new Error(`Wrong shape type: "${t}"`)}set shape(t){this.setShapeProperty("shape",t).then()}get temporary(){return this.source.id===Z.temporary}get sourceName(){return this.source.id}getShapeProperty(t,i){const s=i?.properties||this._geoJson?.properties||{},u=ka[t],c=s[`${rt}${t}`]??s[t];if(u&&u(c))return c}async setShapeProperty(t,i){if(!this._geoJson){ee.error("FeatureData.setShapeProperty(): geojson is not set");return}this._geoJson.properties[`${rt}${t}`]=i,await this._updateAllProperties(this._geoJson.properties)}async deleteShapeProperty(t){if(!this._geoJson){ee.error("FeatureData.deleteShapeProperty(): geojson is not set");return}await this.removeProperties([`${rt}${t}`],!1)}parseGmShapeProperties(t){const i=this.getShapeProperty("shape",t)||this.gm.features.getFeatureShapeByGeoJson(t);i||ee.error(`FeatureData.importGmShapeProperties(): unknown shape: ${i}`);const s={...Object.fromEntries(Ke(ka).map(u=>[u,this.getShapeProperty(u,t)])),id:this.id,shape:i||void 0};return Object.fromEntries(Ke(s).filter(u=>s[u]!==void 0).map(u=>[`${rt}${u}`,s[u]]))}parseExtraProperties(t){const i=Bt(t.properties)||{};return Ke(ka).forEach(s=>{delete i[s],delete i[`${rt}${s}`]}),i}getGeoJson(){if(this._geoJson)return this._geoJson;throw new Error(`Missing GeoJSON for feature: "${this.shape}:${this.id}"`)}async addGeoJson(t){if(this._geoJson={...t,id:this.id},this.shape==="circle"){const s=Hu(zu(this._geoJson));this._geoJson.properties[`${rt}center`]=s}const i=new Map().set(this.id,this._geoJson);await this.gm.features.updateManager.updateSource({diff:{add:i},sourceName:this.sourceName})}async removeGeoJson(){if(!this._geoJson)throw new Error(`Feature not found: "${this.id}"`);await this.gm.features.updateManager.updateSource({diff:{remove:new Set([this.id])},sourceName:this.sourceName})}async removeMarkers(){await Promise.all(Array.from(this.markers.values(),t=>{if(t.instance instanceof Wa){t.instance.remove();return}else return this.gm.features.delete(t.instance)})),this.markers=new Map}async updateGeometry(t){const i=this.getGeoJson();if(!i)throw new Error(`Feature not found: "${this.id}"`);this._geoJson={...i,geometry:t};const s=new Map().set(this.id,{id:this.id,newGeometry:this._geoJson.geometry});await this.gm.features.updateManager.updateSource({diff:{update:s},sourceName:this.sourceName})}async updateProperties(t){if(!this._geoJson)throw new Error(`Feature not found: "${this.id}"`);const i={...this._geoJson.properties},s={id:this.id,addOrUpdateProperties:[],removeProperties:[]},u=this.parseGmShapeProperties(this._geoJson),c=new Set(Object.keys(u));for(const[h,d]of Object.entries(t))c.has(h)||(typeof d>"u"?(delete i[h],s.removeProperties?.push(h)):(i[h]=d,s.addOrUpdateProperties?.push({key:h,value:d})));const f=new Map().set(this.id,s);this._geoJson.properties=i,await this.gm.features.updateManager.updateSource({diff:{update:f},sourceName:this.sourceName})}async setProperties(t){if(!this._geoJson)throw new Error(`Feature not found: "${this.id}"`);const i=this.parseGmShapeProperties(this._geoJson),s={};for(const[c,f]of Object.entries(t))f!==void 0&&!(c in i)&&(s[c]=f);this._geoJson.properties={...s,...i};const u=new Map().set(this.id,this._geoJson);await this.gm.features.updateManager.updateSource({diff:{add:u},sourceName:this.sourceName})}async removeProperties(t,i=!0){if(!this._geoJson)throw new Error(`Feature not found: "${this.id}"`);const s=i?Ke(ka).map(h=>`${rt}${h}`):[],u=t.filter(h=>!s.includes(h)),c={...this._geoJson.properties};u.forEach(h=>{delete c[h]});const f=new Map().set(this.id,{id:this.id,removeProperties:u,addOrUpdateProperties:[]});this._geoJson.properties=c,await this.gm.features.updateManager.updateSource({diff:{update:f},sourceName:this.sourceName})}async _updateAllProperties(t){if(!this._geoJson)throw new Error(`Feature not found: "${this.id}"`);this._geoJson.properties={...this._geoJson.properties,...t};const i=new Map().set(this.id,{id:this.id,addOrUpdateProperties:Object.entries(t||{}).map(([s,u])=>({key:s,value:u}))});await this.gm.features.updateManager.updateSource({diff:{update:i},sourceName:this.sourceName})}async convertToPolygon(){return this.isConvertableToPolygon()?(this.shape="polygon",await this.deleteShapeProperty("center"),await this.deleteShapeProperty("angle"),await this.deleteShapeProperty("xSemiAxis"),await this.deleteShapeProperty("ySemiAxis"),!0):!1}isConvertableToPolygon(){return D2.includes(this.shape)}async changeSource({sourceName:t}){if(this.source.id===t){ee.error(`FeatureData.changeSource: feature "${this.id}" already has the source "${t}"`);return}const i=this.gm.features.sources[t];if(!i){ee.error(`FeatureData.changeSource: missing source "${t}"`);return}const s=this.getGeoJson();if(!s){ee.error("FeatureData.changeSource: missing shape GeoJSON");return}await this.removeGeoJson(),this.source=i,await this.addGeoJson(s),this.markers.size&&await Promise.all(Array.from(this.markers.values(),u=>{if(u.instance instanceof Hd)return u.instance.changeSource({sourceName:t===Z.temporary?Z.temporary:Z.internal})}))}async fireFeatureUpdatedEvent({mode:t}){const i={name:`${se}:edit:feature_updated`,level:"system",actionType:"edit",action:"feature_updated",mode:t,sourceFeatures:[this],targetFeatures:[this],markerData:null};await this.gm.events.fire(`${se}:edit`,i)}async delete(){await this.removeGeoJson(),await this.removeMarkers()}},Jl=class{gm;options={};settings={};actions={};flags={featureCreateAllowed:!0,featureUpdateAllowed:!0,actionInProgress:!1};internalEventHandlers={[`${se}:helper`]:this.handleHelperEvent.bind(this)};constructor(e){this.gm=e}get snappingHelper(){return this.gm.actionInstances.helper__snapping||null}async startAction(){this.gm.events.bus.attachEvents(this.internalEventHandlers),this.gm.events.bus.attachEvents(this.eventHandlers),await this.onStartAction()}async endAction(){await this.onEndAction(),this.gm.events.bus.detachEvents(this.eventHandlers),this.gm.events.bus.detachEvents(this.internalEventHandlers)}getOptionValue(e){const t=this.options[e];if(!t)throw new Error(`Option ${e} not found`);if(["toggle","hidden"].includes(t.type))return t.value;if(t.type==="select")return t.value.value;throw new Error(`Unknown option type: ${JSON.stringify(t)}`)}getSettingValue(e){if(e in this.settings)return this.settings[e]}applyOptionValue(e,t){const i=this.options[e];if(!i){ee.error("Option not found",e,t);return}if(i.type==="toggle"&&typeof t=="boolean")i.value=t;else if(i.type==="select"){const s=i.choices.find(u=>u.value===t);s&&(i.value=s)}else i.type==="hidden"?i.value=t:ee.error("Can't apply option value",e,t,i)}handleHelperEvent(e){return Qk(e)?this.handleGeofencingViolationEvent(e):{next:!0}}handleGeofencingViolationEvent(e){return e.actionType==="draw"?this.flags.featureCreateAllowed=!1:e.actionType==="edit"&&(this.flags.featureUpdateAllowed=!1),{next:!0}}},lr=class extends Jl{actionType="draw";shape=null;featureData=null;async saveFeature(){if(this.featureData){const e=this.featureData.getGeoJson();await this.removeTmpFeature(),await this.gm.features.createFeature({sourceName:Z.main,shapeGeoJson:e})}else ee.error("BaseDraw.saveFeature: no featureData to save")}async removeTmpFeature(){this.featureData&&(this.featureData.temporary||ee.error("Not a temporary feature to remove",this.featureData),await this.gm.features.delete(this.featureData),this.featureData=null)}async fireBeforeFeatureCreate({geoJsonFeatures:e,forceMode:t=void 0}){this.flags.featureCreateAllowed=!0;const i={name:`${se}:feature:before_create`,level:"system",actionType:"draw",mode:t||this.mode,action:"before_create",geoJsonFeatures:e};await this.gm.events.fire(`${se}:${this.actionType}`,i)}async fireMarkerPointerStartEvent(){if(!this.gm.markerPointer.marker||!this.shape)return;const e=this.gm.markerPointer.marker,t={name:`${se}:draw:shape_with_data`,level:"system",variant:null,actionType:"draw",mode:this.shape,action:"start",markerData:{type:"dom",instance:e,position:{coordinate:e.getLngLat(),path:[-1]}},featureData:this.featureData};await this.gm.events.fire(`${se}:draw`,t)}async fireMarkerPointerUpdateEvent(){if(!this.gm.markerPointer.marker||!this.shape)return;const e=this.gm.markerPointer.marker,t={name:`${se}:draw:shape_with_data`,level:"system",variant:null,actionType:"draw",mode:this.shape,action:"update",markerData:{type:"dom",instance:e,position:{coordinate:e.getLngLat(),path:[-1]}},featureData:this.featureData};await this.gm.events.fire(`${se}:draw`,t)}async fireMarkerPointerFinishEvent(){if(!this.shape)return;const e={name:`${se}:draw:shape`,level:"system",variant:null,actionType:"draw",mode:this.shape,action:"finish"};await this.gm.events.fire(`${se}:draw`,e)}async forwardLineDrawerEvent(e){if(!Id(e)||!this.shape)return{next:!0};if(e.action==="start"||e.action==="update"){const t={name:`${se}:draw:shape_with_data`,level:"system",actionType:"draw",mode:this.shape,variant:null,action:e.action,featureData:e.featureData,markerData:e.markerData};await this.gm.events.fire(`${se}:draw`,t)}else if(e.action==="finish"||e.action==="cancel"){const t={name:`${se}:draw:shape`,level:"system",actionType:"draw",mode:this.shape,variant:null,action:e.action};await this.gm.events.fire(`${se}:draw`,t)}return{next:!0}}async fireStartEvent(e,t=null){if(!this.shape)return;const i={name:`${se}:draw:shape_with_data`,level:"system",actionType:"draw",mode:this.shape,variant:null,action:"start",featureData:e,markerData:t};await this.gm.events.fire(`${se}:draw`,i)}async fireUpdateEvent(e,t=null){if(!this.shape)return;const i={name:`${se}:draw:shape_with_data`,level:"system",actionType:"draw",mode:this.shape,variant:null,action:"update",featureData:e,markerData:t};await this.gm.events.fire(`${se}:draw`,i)}async fireFinishEvent(){if(!this.shape)return;const e={name:`${se}:draw:shape`,level:"system",actionType:"draw",mode:this.shape,variant:null,action:"finish"};await this.gm.events.fire(`${se}:draw`,e)}},Vl=class extends lr{mode="circle";shape="circle";eventHandlers={mousemove:this.onMouseMove.bind(this),click:this.onMouseClick.bind(this)};circleCenterPoint=null;circleCenterLngLat=null;onStartAction(){this.gm.markerPointer.enable()}async onEndAction(){await this.removeTmpFeature(),this.gm.markerPointer.disable(),await this.fireFinishEvent()}getFeatureGeoJson(e){return{type:"Feature",properties:{__gm_shape:this.shape},geometry:{type:"Point",coordinates:e}}}getControlMarkerData(){const e=this.gm.markerPointer.marker;return e?{type:"dom",instance:e,position:{coordinate:e.getLngLat(),path:[-1]}}:null}async createFeature(){const e=await this.gm.features.createFeature({shapeGeoJson:this.getFeatureGeoJson(this.circleCenterLngLat||[0,0]),sourceName:Z.temporary});return e&&this.circleCenterLngLat&&await e.setShapeProperty("center",this.circleCenterLngLat),e}createMarker(){const e=document.createElement("div");e.innerHTML=Df;const t=e.firstChild;return t.style.color="#278cda",t.style.width="28px",t.style.height="28px",t.style.pointerEvents="none",this.gm.mapAdapter.createDomMarker({draggable:!1,anchor:"center",element:t},[0,0])}},F2=class extends Vl{mode="circle_marker";shape="circle_marker";onStartAction(){this.gm.markerPointer.enable({customMarker:this.createMarker()})}async onEndAction(){await this.fireMarkerPointerFinishEvent(),await super.onEndAction()}async onMouseMove(){return await this.fireMarkerPointerUpdateEvent(),{next:!0}}async onMouseClick(e){this.gm.features.clearSelection();const t=this.gm.markerPointer.marker?.getLngLat()||e.lngLat.toArray();return await this.fireBeforeFeatureCreate({geoJsonFeatures:[this.getFeatureGeoJson(t)]}),this.flags.featureCreateAllowed&&(this.featureData=await this.createFeature(),this.circleCenterLngLat=t,this.circleCenterPoint=this.gm.mapAdapter.project(this.circleCenterLngLat),await this.updateFeaturePosition(this.circleCenterLngLat),await this.saveFeature()),{next:!1}}async updateFeaturePosition(e){if(!this.featureData)return;const t=this.getFeatureGeoJson(e);await this.featureData.updateGeometry(t.geometry)}},G2=()=>window.PointerEvent&&"maxTouchPoints"in navigator?navigator.maxTouchPoints>0?!window.matchMedia("(hover: hover)").matches:!1:matchMedia("(hover: none)").matches||"ontouchstart"in window?!0:"msMaxTouchPoints"in navigator&&typeof navigator.msMaxTouchPoints=="number"&&navigator.msMaxTouchPoints>0,ai=(e,t,i=10)=>{const s={...e};return Ke(e).forEach(u=>{const c=e[u];typeof c=="function"?s[u]=dg(c.bind(t),i,{leading:!0,trailing:!1}):ee.error("convertToThrottled: item is not a function",e[u])}),s},B2=(e,t,i=10)=>{const s={...e};return Ke(e).forEach(u=>{const c=e[u];typeof c=="function"?s[u]=fg(c.bind(t),i,{leading:!1,trailing:!0}):ee.error("convertToDebounced: item is not a function",e[u])}),s},Ju=async({promise:e,errorMessage:t,timeout:i,onTimeout:s})=>{const u="Promise race timeout",c=i||_u;let f;try{await Promise.race([e,new Promise((h,d)=>{f=setTimeout(()=>{try{s?.()}catch(m){ee.error("withPromiseTimeoutRace onTimeout callback failed",m)}finally{d(new Error(`Timeout ${c/1e3} seconds: ${t||u}`))}},c)})])}finally{f!==void 0&&clearTimeout(f)}},U2=class extends Vl{mode="circle";shape="circle";throttledMethods=ai({updateFeatureGeoJson:this.updateFeatureGeoJson},this,this.gm.options.settings.throttlingDelay);async onMouseClick(e){if(!He(e))return{next:!0};this.gm.features.clearSelection();const t=this.gm.markerPointer.marker?.getLngLat()||e.lngLat.toArray();if(this.circleCenterPoint&&this.circleCenterLngLat)await this.fireBeforeFeatureCreate({geoJsonFeatures:[this.getCircleGeoJson(this.circleCenterLngLat,t)]}),this.flags.featureCreateAllowed&&(await this.saveCircleFeature(t),this.circleCenterLngLat=null,this.circleCenterPoint=null,await this.fireFinishEvent());else if(await this.fireBeforeFeatureCreate({geoJsonFeatures:[this.getFeatureGeoJson(t)]}),this.flags.featureCreateAllowed){this.circleCenterLngLat=t,this.circleCenterPoint=this.gm.mapAdapter.project(this.circleCenterLngLat),this.featureData=await this.createFeature();const i=this.getControlMarkerData();this.featureData&&i&&await this.fireStartEvent(this.featureData,i)}return{next:!1}}async onMouseMove(){if(this.circleCenterLngLat&&this.gm.markerPointer.marker){const e=this.gm.markerPointer.marker.getLngLat();await this.fireBeforeFeatureCreate({geoJsonFeatures:[this.getCircleGeoJson(this.circleCenterLngLat,e)]}),this.flags.featureCreateAllowed&&await this.throttledMethods.updateFeatureGeoJson(e)}return this.circleCenterPoint||await this.fireMarkerPointerUpdateEvent(),{next:!1}}async updateFeatureGeoJson(e){if(this.featureData&&this.circleCenterLngLat){const t=this.getCircleGeoJson(this.circleCenterLngLat,e);await this.featureData.updateGeometry(t.geometry);const i=this.getControlMarkerData();i&&await this.fireUpdateEvent(this.featureData,i)}}async saveCircleFeature(e){if(this.circleCenterLngLat&&this.featureData){const t=this.gm.markerPointer.marker?.getLngLat()||e;await this.updateFeatureGeoJson(t),await this.featureData.setShapeProperty("center",this.circleCenterLngLat),this.isFeatureGeoJsonValid()?await this.saveFeature():await this.removeTmpFeature()}}isFeatureGeoJsonValid(){return this.featureData?Yl(this.featureData.getGeoJson()):!1}getCircleGeoJson(e,t){return{...Mo({center:e,radius:this.gm.mapAdapter.getDistance(e,t)}),properties:{shape:this.shape}}}},Sr=class extends Jl{actionType="helper"},Jd=e=>!!e&&typeof e=="object"&&e instanceof Sr&&"removeSnapGuides"in e&&"updateSnapGuides"in e&&e.mode==="snap_guides"&&typeof e.removeSnapGuides=="function"&&typeof e.updateSnapGuides=="function",z2=e=>!!e&&typeof e=="object"&&e instanceof Sr&&"getShortestPath"in e&&e.mode==="auto_trace"&&typeof e.getShortestPath=="function",j2=e=>!!e&&typeof e=="object"&&e instanceof Sr&&"getSharedMarkers"in e&&e.mode==="pin"&&typeof e.getSharedMarkers=="function";function q2(e,t={}){var i,s,u,c=t.properties,f=(i=t.autoComplete)!=null?i:!0,h=(s=t.orderCoords)!=null?s:!0;if((u=t.mutate)!=null&&u||(e=bo(e)),e.type==="FeatureCollection"){var d=[];return e.features.forEach(function(m){d.push(Ft(jh(m,{},f,h)))}),Nd(d,c)}else return jh(e,c,f,h)}function jh(e,t,i,s){t=t||(e.type==="Feature"?e.properties:{});var u=ra(e),c=u.coordinates,f=u.type;if(!c.length)throw new Error("line must contain coordinates");switch(f){case"LineString":return i&&(c=qh(c)),kr([c],t);case"MultiLineString":var h=[],d=0;return c.forEach(function(m){if(i&&(m=qh(m)),s){var v=Y2(tr(xr(m)));v>d?(h.unshift(m),d=v):h.push(m)}else h.push(m)}),kr(h,t);default:throw new Error("geometry type "+f+" is not supported")}}function qh(e){var t=e[0],i=t[0],s=t[1],u=e[e.length-1],c=u[0],f=u[1];return(i!==c||s!==f)&&e.push(t),e}function Y2(e){var t=e[0],i=e[1],s=e[2],u=e[3];return Math.abs(t-s)*Math.abs(i-u)}var Xl=q2,$l=class extends lr{mode="line";snappingKey="line_drawer";drawOptions;shapeLngLats=[];throttledMethods=ai({onMouseMove:this.onMouseMove},this,this.gm.options.settings.throttlingDelay);eventHandlers={[`${se}:helper`]:this.handleGmHelperEvent.bind(this),click:this.onMouseClick.bind(this),mousemove:this.throttledMethods.onMouseMove.bind(this)};drawerEventHandlers={firstMarkerClick:null,lastMarkerClick:null,nMarkerClick:null};constructor(e,t={snappingMarkers:"none",targetShape:"line"}){super(e),this.drawOptions=t}get snapGuidesInstance(){const e=this.gm.actionInstances.helper__snap_guides;return Jd(e)?e:null}get autoTraceEnabled(){return this.gm.options.controls.helper.auto_trace?.active||!1}get autoTraceHelperInstance(){return this.autoTraceEnabled&&Object.values(this.gm.actionInstances).find(z2)||null}onStartAction(){this.gm.markerPointer.enable()}async onEndAction(){this.gm.markerPointer.disable(),await this.endShape(),this.snapGuidesInstance?.removeSnapGuides(),this.clearDrawerHandlers()}clearDrawerHandlers(){this.drawerEventHandlers.firstMarkerClick=null,this.drawerEventHandlers.lastMarkerClick=null,this.drawerEventHandlers.nMarkerClick=null}handleGmHelperEvent(e){return Gl(e)?(e.mode==="snap_guides"&&e.action==="mode_start"&&this.updateSnapGuides(),{next:!0}):(ee.error("LineDrawer.handleGmHelperEvent: invalid event",e),{next:!0})}updateSnapGuides(){if(this.snapGuidesInstance){const e=this.featureData?.getGeoJson();e&&e.geometry.coordinates.pop(),this.snapGuidesInstance.updateSnapGuides(e||null,this.shapeLngLats.at(-1)||null,!0)}}on(e,t){this.drawerEventHandlers[e]=t}async onMouseClick(e){if(!He(e,{warning:!0}))return{next:!0};this.gm.features.clearSelection();const t=this.gm.markerPointer.marker?.getLngLat()||e.lngLat.toArray();if(this.featureData){let i=this.getClickedMarkerInfo(e);i.index===-1&&this.snappingHelper&&(i=this.getMarkerInfoByProximity(e)),await this.handleNextVertex(t,i)}else await this.isFeatureAllowed(R2(t))&&await this.startShape(t);return this.updateSnapGuides(),{next:!0}}async handleNextVertex(e,t){if(!this.featureData){ee.error("LineDrawer.handleNextVertex: no featureData");return}const i=this.featureData.markers.size,s=this.getMarkerClickEventData(t.index);t.index<i-1&&await this.addPoint(e,t),t.index!==-1&&(t.index===0?this.drawerEventHandlers.firstMarkerClick?.(s):t.index>0&&t.index===i-1&&this.drawerEventHandlers.lastMarkerClick?.(s),t.index>=0&&this.drawerEventHandlers.nMarkerClick?.(s))}getMarkerClickEventData(e){const t=this.getFeatureGeoJson({withControlMarker:!1});return{markerIndex:e,shapeCoordinates:this.getShapeCoordinates({withControlMarker:!1}),geoJson:t,bounds:ql(t)}}async onMouseMove(e){return He(e,{warning:!0})?(this.featureData&&this.shapeLngLats.length&&await this.updateFeatureSource(),{next:!0}):{next:!0}}async startShape(e){this.shapeLngLats=[e],this.featureData=await this.gm.features.createFeature({shapeGeoJson:this.getFeatureGeoJson({withControlMarker:!0}),sourceName:Z.temporary});const t={type:"dom",instance:this.createMarker(e),position:{coordinate:e,path:["geometry","coordinates",0]}};this.featureData&&(this.featureData.markers.set(t.position.path.join("."),t),this.setSnapping(),await this.fireStartEvent(this.featureData,t)),this.gm.mapAdapter.disableMapInteractions(["doubleClickZoom"])}async endShape(){const e=this.getFeatureGeoJson({withControlMarker:!1});this.removeSnapping(),await this.removeTmpFeature(),this.shapeLngLats=[],this.gm.mapAdapter.enableMapInteractions(["doubleClickZoom"]),await this.fireStopEvent(e)}setSnapping(){if(!this.snappingHelper)return;const e=this.drawOptions.snappingMarkers;e==="none"?this.snappingHelper.setCustomSnappingCoordinates(this.snappingKey,[]):e==="all"&&this.shapeLngLats.length?this.snappingHelper.setCustomSnappingCoordinates(this.snappingKey,this.shapeLngLats):e==="first"&&this.shapeLngLats.length?this.snappingHelper.setCustomSnappingCoordinates(this.snappingKey,[this.shapeLngLats[0]]):e==="last"&&this.shapeLngLats.length?this.snappingHelper.setCustomSnappingCoordinates(this.snappingKey,[this.shapeLngLats[this.shapeLngLats.length-1]]):ee.error("LineDrawer.setSnapping: invalid data",e,this.shapeLngLats)}removeSnapping(){this.snappingHelper&&this.snappingHelper.clearCustomSnappingCoordinates(this.snappingKey)}getClickedMarkerInfo(e){if(!this.featureData)return{index:-1,path:null};let t=0,i=null;try{this.featureData.markers.forEach((s,u)=>{if(s.instance instanceof Wa){const c=s.instance.getElement()||null,f=e.originalEvent.target,h=f instanceof Element?f:null;if(c&&c.contains(h))throw i=u,new Error("stop")}t+=1})}catch{if(i)return{index:t,path:i}}return{index:-1,path:null}}getMarkerInfoByProximity(e){if(!this.featureData||!this.snappingHelper)return{index:-1,path:null};const t=[e.point.x,e.point.y],i=this.snappingHelper.tolerance;let s=-1,u=null,c=1/0,f=0;for(const[h,d]of this.featureData.markers){if(d.instance instanceof Wa){const m=d.instance.getLngLat(),v=Fs(t,this.gm.mapAdapter.project(m));v<i&&v<c&&(c=v,s=f,u=h)}f++}return{index:s,path:u}}async addPoint(e,t){const i=this.featureData;if(!i){ee.error("LineDrawer.addPoint: no featureData");return}const s=this.getAddedLngLats(e,t),u=this.getFeatureGeoJsonWithType({withControlMarker:!0,coordinates:this.shapeLngLats.concat(s)});if(await this.isFeatureAllowed(u)){for(const c of s){this.shapeLngLats.push(c);const f=this.addMarker(c,i);await this.fireUpdateEvent(i,f)}await this.updateFeatureSource()}}async isFeatureAllowed(e){return this.gm.getActiveDrawModes().length?(await this.fireBeforeFeatureCreate({geoJsonFeatures:[e]}),this.flags.featureCreateAllowed):!0}getAddedLngLats(e,t){if(!this.featureData)return ee.error("LineDrawer.getCurrentLngLats: no featureData"),[];const i=this.getMarkerInfoLngLat(t)||e;return[...this.getAutoTracePath(i)?.slice(1,-1)||[],i]}getAutoTracePath(e){const t=this.shapeLngLats.at(-1);return this.autoTraceEnabled&&this.autoTraceHelperInstance&&t&&this.autoTraceHelperInstance.getShortestPath(t,e)||null}getMarkerInfoLngLat(e){if(this.featureData&&e.path){const t=this.featureData.markers.get(e.path);if(t&&t.type==="dom")return t.instance.getLngLat();ee.error("LineDrawer.addPoint: no markerData",e)}return null}addMarker(e,t){const i={type:"dom",instance:this.createMarker(e),position:{coordinate:e,path:["geometry","coordinates",this.shapeLngLats.length]}};return t.markers.set(i.position.path.join("."),{type:"dom",instance:i.instance,position:{coordinate:e,path:[]}}),i}createMarker(e){return this.gm.mapAdapter.createDomMarker({element:this.gm.createSvgMarkerElement("control",{pointerEvents:"auto",cursor:"pointer"}),anchor:"center"},e)}async updateFeatureSource(){if(this.featureData&&(await this.featureData.updateGeometry(this.getFeatureGeoJson({withControlMarker:!0}).geometry),this.gm.markerPointer.marker)){const e={type:"dom",instance:this.gm.markerPointer.marker,position:{coordinate:this.gm.markerPointer.marker.getLngLat(),path:["geometry","coordinates",this.shapeLngLats.length]}};await this.fireUpdateEvent(this.featureData,e)}}getFeatureGeoJson({withControlMarker:e,coordinates:t=void 0}){return{type:"Feature",properties:{shape:"line"},geometry:{type:"LineString",coordinates:t||this.getShapeCoordinates({withControlMarker:e})}}}getFeatureGeoJsonWithType({withControlMarker:e,coordinates:t=void 0}){const i=this.getFeatureGeoJson({withControlMarker:e,coordinates:t});return this.drawOptions.targetShape==="polygon"&&i.geometry.coordinates.length>3?Xl(i,{properties:i.properties}):i}getShapeCoordinates({withControlMarker:e}){const t=[...this.shapeLngLats];return e&&this.gm.markerPointer.marker&&t.push(this.gm.markerPointer.marker.getLngLat()),t}async fireStartEvent(e,t){const i={name:`${se}:draw:shape_with_data`,level:"system",actionType:"draw",mode:"line",variant:"line_drawer",action:"start",featureData:e,markerData:t};await this.gm.events.fire(`${se}:draw`,i)}async fireUpdateEvent(e,t){const i={name:`${se}:draw:shape_with_data`,level:"system",actionType:"draw",mode:"line",variant:"line_drawer",action:"update",featureData:e,markerData:t};await this.gm.events.fire(`${se}:draw`,i)}async fireStopEvent(e){const t={name:`${se}:draw:shape_with_data`,level:"system",actionType:"draw",mode:"line",action:"finish",variant:"line_drawer",geoJsonFeature:e,markerData:null,featureData:null};await this.gm.events.fire(`${se}:draw`,t)}},H2=class extends lr{mode="line";shape="line";lineDrawer=new $l(this.gm,{snappingMarkers:"first",targetShape:"line"});eventHandlers={[`${se}:draw`]:this.forwardLineDrawerEvent.bind(this),mousemove:this.onMouseMove.bind(this)};async onStartAction(){await this.lineDrawer.startAction(),this.lineDrawer.on("nMarkerClick",this.lineFinished.bind(this))}async onEndAction(){await this.lineDrawer.endAction()}async onMouseMove(e){return He(e)?(this.lineDrawer.featureData||await this.fireMarkerPointerUpdateEvent(),{next:!0}):{next:!0}}async lineFinished(e){await this.lineDrawer.endShape();let t=e.shapeCoordinates;return e.markerIndex>0&&(t=t.slice(0,e.markerIndex+1)),t.length<2?null:this.gm.features.createFeature({shapeGeoJson:this.getFeatureGeoJson(t),sourceName:Z.main})}getFeatureGeoJson(e){return{type:"Feature",properties:{shape:this.shape},geometry:{type:"LineString",coordinates:e}}}},J2=class extends lr{mode="marker";shape="marker";eventHandlers={click:this.onMouseClick.bind(this),mousemove:this.onMouseMove.bind(this)};async onStartAction(){const e=this.createMarker();this.gm.markerPointer.enable({customMarker:e}),await this.fireMarkerPointerStartEvent()}async onEndAction(){this.gm.markerPointer.disable(),await this.fireMarkerPointerFinishEvent()}async onMouseClick(e){return this.gm.features.clearSelection(),He(e)&&(this.featureData=await this.createFeature(e),this.featureData&&await this.saveFeature()),{next:!1}}async onMouseMove(e){return!He(e)||!this.gm.markerPointer.marker?{next:!0}:(await this.fireMarkerPointerUpdateEvent(),{next:!0})}async createFeature(e){const t=this.gm.markerPointer.marker?.getLngLat()||e.lngLat.toArray(),i=this.getFeatureGeoJson(t);return i&&(await this.fireBeforeFeatureCreate({geoJsonFeatures:[i]}),this.flags.featureCreateAllowed)?this.gm.features.createFeature({shapeGeoJson:i,sourceName:Z.temporary}):null}getFeatureGeoJson(e){return{type:"Feature",properties:{shape:this.shape},geometry:{type:"Point",coordinates:e}}}createMarker(e=Z.temporary){const t=this.gm.options.layerStyles.marker[e]?.find(h=>h.type==="symbol"),i=t?.paint&&"icon-opacity"in t.paint?t.paint["icon-opacity"]:void 0,s=t?.layout&&"icon-size"in t.layout?t.layout["icon-size"]:void 0,u=36,c=`${s!==void 0?Math.round(u*(s/.18)):u}px`,f=this.gm.createSvgMarkerElement("default",{width:c,height:c,pointerEvents:"none",...i!==void 0&&{opacity:String(i)}});return this.gm.mapAdapter.createDomMarker({draggable:!1,anchor:"bottom",element:f},[0,0])}};function V2(e){var t={MultiPoint:{coordinates:[],properties:[]},MultiLineString:{coordinates:[],properties:[]},MultiPolygon:{coordinates:[],properties:[]}};return Hn(e,i=>{var s;switch((s=i.geometry)==null?void 0:s.type){case"Point":t.MultiPoint.coordinates.push(i.geometry.coordinates),t.MultiPoint.properties.push(i.properties);break;case"MultiPoint":t.MultiPoint.coordinates.push(...i.geometry.coordinates),t.MultiPoint.properties.push(i.properties);break;case"LineString":t.MultiLineString.coordinates.push(i.geometry.coordinates),t.MultiLineString.properties.push(i.properties);break;case"MultiLineString":t.MultiLineString.coordinates.push(...i.geometry.coordinates),t.MultiLineString.properties.push(i.properties);break;case"Polygon":t.MultiPolygon.coordinates.push(i.geometry.coordinates),t.MultiPolygon.properties.push(i.properties);break;case"MultiPolygon":t.MultiPolygon.coordinates.push(...i.geometry.coordinates),t.MultiPolygon.properties.push(i.properties);break}}),et(Object.keys(t).filter(function(i){return t[i].coordinates.length}).sort().map(function(i){return ln({type:i,coordinates:t[i].coordinates},{collectedProperties:t[i].properties})}))}var X2=V2;function $2(e,t,i,s,u){Vd(e,t,i||0,s||e.length-1,u||Z2)}function Vd(e,t,i,s,u){for(;s>i;){if(s-i>600){var c=s-i+1,f=t-i+1,h=Math.log(c),d=.5*Math.exp(2*h/3),m=.5*Math.sqrt(h*d*(c-d)/c)*(f-c/2<0?-1:1);Vd(e,t,Math.max(i,Math.floor(t-f*d/c+m)),Math.min(s,Math.floor(t+(c-f)*d/c+m)),u)}var v=e[t],y=i,k=s;for(ms(e,i,t),u(e[s],v)>0&&ms(e,i,s);y<k;){for(ms(e,y,k),y++,k--;u(e[y],v)<0;)y++;for(;u(e[k],v)>0;)k--}u(e[i],v)===0?ms(e,i,k):(k++,ms(e,k,s)),k<=t&&(i=k+1),t<=k&&(s=k-1)}}function ms(e,t,i){var s=e[t];e[t]=e[i],e[i]=s}function Z2(e,t){return e<t?-1:e>t?1:0}var Zl=class{constructor(e=9){this._maxEntries=Math.max(4,e),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(e){let t=this.data;const i=[];if(!Ea(e,t))return i;const s=this.toBBox,u=[];for(;t;){for(let c=0;c<t.children.length;c++){const f=t.children[c],h=t.leaf?s(f):f;Ea(e,h)&&(t.leaf?i.push(f):su(e,h)?this._all(f,i):u.push(f))}t=u.pop()}return i}collides(e){let t=this.data;if(!Ea(e,t))return!1;const i=[];for(;t;){for(let s=0;s<t.children.length;s++){const u=t.children[s],c=t.leaf?this.toBBox(u):u;if(Ea(e,c)){if(t.leaf||su(e,c))return!0;i.push(u)}}t=i.pop()}return!1}load(e){if(!(e&&e.length))return this;if(e.length<this._minEntries){for(let i=0;i<e.length;i++)this.insert(e[i]);return this}let t=this._build(e.slice(),0,e.length-1,0);if(!this.data.children.length)this.data=t;else if(this.data.height===t.height)this._splitRoot(this.data,t);else{if(this.data.height<t.height){const i=this.data;this.data=t,t=i}this._insert(t,this.data.height-t.height-1,!0)}return this}insert(e){return e&&this._insert(e,this.data.height-1),this}clear(){return this.data=Si([]),this}remove(e,t){if(!e)return this;let i=this.data;const s=this.toBBox(e),u=[],c=[];let f,h,d;for(;i||u.length;){if(i||(i=u.pop(),h=u[u.length-1],f=c.pop(),d=!0),i.leaf){const m=W2(e,i.children,t);if(m!==-1)return i.children.splice(m,1),u.push(i),this._condense(u),this}!d&&!i.leaf&&su(i,s)?(u.push(i),c.push(f),f=0,h=i,i=i.children[0]):h?(f++,i=h.children[f],d=!1):i=null}return this}toBBox(e){return e}compareMinX(e,t){return e.minX-t.minX}compareMinY(e,t){return e.minY-t.minY}toJSON(){return this.data}fromJSON(e){return this.data=e,this}_all(e,t){const i=[];for(;e;)e.leaf?t.push(...e.children):i.push(...e.children),e=i.pop();return t}_build(e,t,i,s){const u=i-t+1;let c=this._maxEntries,f;if(u<=c)return f=Si(e.slice(t,i+1)),xi(f,this.toBBox),f;s||(s=Math.ceil(Math.log(u)/Math.log(c)),c=Math.ceil(u/Math.pow(c,s-1))),f=Si([]),f.leaf=!1,f.height=s;const h=Math.ceil(u/c),d=h*Math.ceil(Math.sqrt(c));Yh(e,t,i,d,this.compareMinX);for(let m=t;m<=i;m+=d){const v=Math.min(m+d-1,i);Yh(e,m,v,h,this.compareMinY);for(let y=m;y<=v;y+=h){const k=Math.min(y+h-1,v);f.children.push(this._build(e,y,k,s-1))}}return xi(f,this.toBBox),f}_chooseSubtree(e,t,i,s){for(;s.push(t),!(t.leaf||s.length-1===i);){let u=1/0,c=1/0,f;for(let h=0;h<t.children.length;h++){const d=t.children[h],m=iu(d),v=ex(e,d)-m;v<c?(c=v,u=m<u?m:u,f=d):v===c&&m<u&&(u=m,f=d)}t=f||t.children[0]}return t}_insert(e,t,i){const s=i?e:this.toBBox(e),u=[],c=this._chooseSubtree(s,this.data,t,u);for(c.children.push(e),bs(c,s);t>=0&&u[t].children.length>this._maxEntries;)this._split(u,t),t--;this._adjustParentBBoxes(s,u,t)}_split(e,t){const i=e[t],s=i.children.length,u=this._minEntries;this._chooseSplitAxis(i,u,s);const c=this._chooseSplitIndex(i,u,s),f=Si(i.children.splice(c,i.children.length-c));f.height=i.height,f.leaf=i.leaf,xi(i,this.toBBox),xi(f,this.toBBox),t?e[t-1].children.push(f):this._splitRoot(i,f)}_splitRoot(e,t){this.data=Si([e,t]),this.data.height=e.height+1,this.data.leaf=!1,xi(this.data,this.toBBox)}_chooseSplitIndex(e,t,i){let s,u=1/0,c=1/0;for(let f=t;f<=i-t;f++){const h=Es(e,0,f,this.toBBox),d=Es(e,f,i,this.toBBox),m=tx(h,d),v=iu(h)+iu(d);m<u?(u=m,s=f,c=v<c?v:c):m===u&&v<c&&(c=v,s=f)}return s||i-t}_chooseSplitAxis(e,t,i){const s=e.leaf?this.compareMinX:K2,u=e.leaf?this.compareMinY:Q2;this._allDistMargin(e,t,i,s)<this._allDistMargin(e,t,i,u)&&e.children.sort(s)}_allDistMargin(e,t,i,s){e.children.sort(s);const u=this.toBBox,c=Es(e,0,t,u),f=Es(e,i-t,i,u);let h=xa(c)+xa(f);for(let d=t;d<i-t;d++){const m=e.children[d];bs(c,e.leaf?u(m):m),h+=xa(c)}for(let d=i-t-1;d>=t;d--){const m=e.children[d];bs(f,e.leaf?u(m):m),h+=xa(f)}return h}_adjustParentBBoxes(e,t,i){for(let s=i;s>=0;s--)bs(t[s],e)}_condense(e){for(let t=e.length-1,i;t>=0;t--)e[t].children.length===0?t>0?(i=e[t-1].children,i.splice(i.indexOf(e[t]),1)):this.clear():xi(e[t],this.toBBox)}};function W2(e,t,i){if(!i)return t.indexOf(e);for(let s=0;s<t.length;s++)if(i(e,t[s]))return s;return-1}function xi(e,t){Es(e,0,e.children.length,t,e)}function Es(e,t,i,s,u){u||(u=Si(null)),u.minX=1/0,u.minY=1/0,u.maxX=-1/0,u.maxY=-1/0;for(let c=t;c<i;c++){const f=e.children[c];bs(u,e.leaf?s(f):f)}return u}function bs(e,t){return e.minX=Math.min(e.minX,t.minX),e.minY=Math.min(e.minY,t.minY),e.maxX=Math.max(e.maxX,t.maxX),e.maxY=Math.max(e.maxY,t.maxY),e}function K2(e,t){return e.minX-t.minX}function Q2(e,t){return e.minY-t.minY}function iu(e){return(e.maxX-e.minX)*(e.maxY-e.minY)}function xa(e){return e.maxX-e.minX+(e.maxY-e.minY)}function ex(e,t){return(Math.max(t.maxX,e.maxX)-Math.min(t.minX,e.minX))*(Math.max(t.maxY,e.maxY)-Math.min(t.minY,e.minY))}function tx(e,t){const i=Math.max(e.minX,t.minX),s=Math.max(e.minY,t.minY),u=Math.min(e.maxX,t.maxX),c=Math.min(e.maxY,t.maxY);return Math.max(0,u-i)*Math.max(0,c-s)}function su(e,t){return e.minX<=t.minX&&e.minY<=t.minY&&t.maxX<=e.maxX&&t.maxY<=e.maxY}function Ea(e,t){return t.minX<=e.maxX&&t.minY<=e.maxY&&t.maxX>=e.minX&&t.maxY>=e.minY}function Si(e){return{children:e,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function Yh(e,t,i,s,u){const c=[t,i];for(;c.length;){if(i=c.pop(),t=c.pop(),i-t<=s)continue;const f=t+Math.ceil((i-t)/s/2)*s;$2(e,f,t,i,u),c.push(t,f,f,i)}}function nx(e){return p2(e,(t,i)=>t+rx(i),0)}function rx(e){let t=0,i;switch(e.type){case"Polygon":return Hh(e.coordinates);case"MultiPolygon":for(i=0;i<e.coordinates.length;i++)t+=Hh(e.coordinates[i]);return t;case"Point":case"MultiPoint":case"LineString":case"MultiLineString":return 0}return 0}function Hh(e){let t=0;if(e&&e.length>0){t+=Math.abs(Jh(e[0]));for(let i=1;i<e.length;i++)t-=Math.abs(Jh(e[i]))}return t}var ix=at*at/2,au=Math.PI/180;function Jh(e){const t=e.length-1;if(t<=2)return 0;let i=0,s=0;for(;s<t;){const u=e[s],c=e[s+1===t?0:s+1],f=e[s+2>=t?(s+2)%t:s+2],h=u[0]*au,d=c[1]*au,m=f[0]*au;i+=(m-h)*Math.sin(d),s++}return i*ix}var $s=11102230246251565e-32,pt=134217729,sx=3.000000000000001*$s;function ou(e,t,i,s,u){let c,f,h,d,m=t[0],v=s[0],y=0,k=0;v>m==v>-m?(c=m,m=t[++y]):(c=v,v=s[++k]);let S=0;if(y<e&&k<i)for(v>m==v>-m?(f=m+c,h=c-(f-m),m=t[++y]):(f=v+c,h=c-(f-v),v=s[++k]),c=f,h!==0&&(u[S++]=h);y<e&&k<i;)v>m==v>-m?(f=c+m,d=f-c,h=c-(f-d)+(m-d),m=t[++y]):(f=c+v,d=f-c,h=c-(f-d)+(v-d),v=s[++k]),c=f,h!==0&&(u[S++]=h);for(;y<e;)f=c+m,d=f-c,h=c-(f-d)+(m-d),m=t[++y],c=f,h!==0&&(u[S++]=h);for(;k<i;)f=c+v,d=f-c,h=c-(f-d)+(v-d),v=s[++k],c=f,h!==0&&(u[S++]=h);return(c!==0||S===0)&&(u[S++]=c),S}function ax(e,t){let i=t[0];for(let s=1;s<e;s++)i+=t[s];return i}function sa(e){return new Float64Array(e)}var ox=3.0000000000000018*$s,ux=2.0000000000000013*$s,lx=9.000000000000007*$s*$s,Ei=sa(4),Vh=sa(8),Xh=sa(12),$h=sa(16),xt=sa(4);function cx(e,t,i,s,u,c,f){let h,d,m,v,y,k,S,b,P,O,G,L,j,V,X,H,$,w;const E=e-u,M=i-u,R=t-c,T=s-c;V=E*T,k=pt*E,S=k-(k-E),b=E-S,k=pt*T,P=k-(k-T),O=T-P,X=b*O-(V-S*P-b*P-S*O),H=R*M,k=pt*R,S=k-(k-R),b=R-S,k=pt*M,P=k-(k-M),O=M-P,$=b*O-(H-S*P-b*P-S*O),G=X-$,y=X-G,Ei[0]=X-(G+y)+(y-$),L=V+G,y=L-V,j=V-(L-y)+(G-y),G=j-H,y=j-G,Ei[1]=j-(G+y)+(y-H),w=L+G,y=w-L,Ei[2]=L-(w-y)+(G-y),Ei[3]=w;let F=ax(4,Ei),D=ux*f;if(F>=D||-F>=D||(y=e-E,h=e-(E+y)+(y-u),y=i-M,m=i-(M+y)+(y-u),y=t-R,d=t-(R+y)+(y-c),y=s-T,v=s-(T+y)+(y-c),h===0&&d===0&&m===0&&v===0)||(D=lx*f+sx*Math.abs(F),F+=E*v+T*h-(R*m+M*d),F>=D||-F>=D))return F;V=h*T,k=pt*h,S=k-(k-h),b=h-S,k=pt*T,P=k-(k-T),O=T-P,X=b*O-(V-S*P-b*P-S*O),H=d*M,k=pt*d,S=k-(k-d),b=d-S,k=pt*M,P=k-(k-M),O=M-P,$=b*O-(H-S*P-b*P-S*O),G=X-$,y=X-G,xt[0]=X-(G+y)+(y-$),L=V+G,y=L-V,j=V-(L-y)+(G-y),G=j-H,y=j-G,xt[1]=j-(G+y)+(y-H),w=L+G,y=w-L,xt[2]=L-(w-y)+(G-y),xt[3]=w;const N=ou(4,Ei,4,xt,Vh);V=E*v,k=pt*E,S=k-(k-E),b=E-S,k=pt*v,P=k-(k-v),O=v-P,X=b*O-(V-S*P-b*P-S*O),H=R*m,k=pt*R,S=k-(k-R),b=R-S,k=pt*m,P=k-(k-m),O=m-P,$=b*O-(H-S*P-b*P-S*O),G=X-$,y=X-G,xt[0]=X-(G+y)+(y-$),L=V+G,y=L-V,j=V-(L-y)+(G-y),G=j-H,y=j-G,xt[1]=j-(G+y)+(y-H),w=L+G,y=w-L,xt[2]=L-(w-y)+(G-y),xt[3]=w;const B=ou(N,Vh,4,xt,Xh);return V=h*v,k=pt*h,S=k-(k-h),b=h-S,k=pt*v,P=k-(k-v),O=v-P,X=b*O-(V-S*P-b*P-S*O),H=d*m,k=pt*d,S=k-(k-d),b=d-S,k=pt*m,P=k-(k-m),O=m-P,$=b*O-(H-S*P-b*P-S*O),G=X-$,y=X-G,xt[0]=X-(G+y)+(y-$),L=V+G,y=L-V,j=V-(L-y)+(G-y),G=j-H,y=j-G,xt[1]=j-(G+y)+(y-H),w=L+G,y=w-L,xt[2]=L-(w-y)+(G-y),xt[3]=w,$h[ou(B,Xh,4,xt,$h)-1]}function hx(e,t,i,s,u,c){const f=(t-c)*(i-u),h=(e-u)*(s-c),d=f-h,m=Math.abs(f+h);return Math.abs(d)>=ox*m?d:-cx(e,t,i,s,u,c,m)}function fx(e,t){var i,s,u=0,c,f,h,d,m,v,y,k=e[0],S=e[1],b=t.length;for(i=0;i<b;i++){s=0;var P=t[i],O=P.length-1;if(v=P[0],v[0]!==P[O][0]&&v[1]!==P[O][1])throw new Error("First and last coordinates in a ring must be the same");for(f=v[0]-k,h=v[1]-S;s<O;s++){if(y=P[s+1],d=y[0]-k,m=y[1]-S,h===0&&m===0){if(d<=0&&f>=0||f<=0&&d>=0)return 0}else if(m>=0&&h<=0||m<=0&&h>=0){if(c=hx(f,d,h,m,0,0),c===0)return 0;(c>0&&m>0&&h<=0||c<0&&m<=0&&h>0)&&u++}v=y,h=m,f=d}}return u%2!==0}function ei(e,t,i={}){if(!e)throw new Error("point is required");if(!t)throw new Error("polygon is required");const s=Qe(e),u=ra(t),c=u.type,f=t.bbox;let h=u.coordinates;if(f&&gx(s,f)===!1)return!1;c==="Polygon"&&(h=[h]);let d=!1;for(var m=0;m<h.length;++m){const v=fx(s,h[m]);if(v===0)return!i.ignoreBoundary;v&&(d=!0)}return d}function gx(e,t){return t[0]<=e[0]&&t[1]<=e[1]&&t[2]>=e[0]&&t[3]>=e[1]}function dx(e,t){if(e.geometry.type!=="Polygon")throw new Error("The input feature must be a Polygon");for(var i=e.geometry.coordinates,s=[],u={},c=[],f=0;f<i.length;f++)for(var h=0;h<i[f].length-1;h++)c.push(k(f,h));var d=new Zl;d.load(c);for(var m=0;m<i.length;m++)for(var v=0;v<i[m].length-1;v++)d.search(k(m,v)).forEach(function(S){var b=S.ring,P=S.edge;y(m,v,b,P)});return s;function y(S,b,P,O){var G=i[S][b],L=i[S][b+1],j=i[P][O],V=i[P][O+1],X=px(G,L,j,V);if(X!==null){var H,$;if(L[0]!==G[0]?H=(X[0]-G[0])/(L[0]-G[0]):H=(X[1]-G[1])/(L[1]-G[1]),V[0]!==j[0]?$=(X[0]-j[0])/(V[0]-j[0]):$=(X[1]-j[1])/(V[1]-j[1]),!(H>=1||H<=0||$>=1||$<=0)){var w=X,E=!u[w.toString()];E&&(u[w.toString()]=!0),t&&s.push(t(X,S,b,G,L,H,P,O,j,V,$,E))}}}function k(S,b){var P=i[S][b],O=i[S][b+1],G,L,j,V;return P[0]<O[0]?(G=P[0],L=O[0]):(G=O[0],L=P[0]),P[1]<O[1]?(j=P[1],V=O[1]):(j=O[1],V=P[1]),{minX:G,minY:j,maxX:L,maxY:V,ring:S,edge:b}}}function px(e,t,i,s){if(Ss(e,i)||Ss(e,s)||Ss(t,i)||Ss(s,i))return null;var u=e[0],c=e[1],f=t[0],h=t[1],d=i[0],m=i[1],v=s[0],y=s[1],k=(u-f)*(m-y)-(c-h)*(d-v);return k===0?null:[((u*h-c*f)*(d-v)-(u-f)*(d*y-m*v))/k,((u*h-c*f)*(m-y)-(c-h)*(d*y-m*v))/k]}function Ss(e,t){if(!e||!t||e.length!==t.length)return!1;for(var i=0,s=e.length;i<s;i++)if(e[i]instanceof Array&&t[i]instanceof Array){if(!Ss(e[i],t[i]))return!1}else if(e[i]!==t[i])return!1;return!0}function mx(e){if(e.type!="Feature")throw new Error("The input must a geojson object of type Feature");if(e.geometry===void 0||e.geometry==null)throw new Error("The input must a geojson object with a non-empty geometry");if(e.geometry.type!="Polygon")throw new Error("The input must be a geojson Polygon");for(var t=e.geometry.coordinates.length,i=[],s=0;s<t;s++){var u=e.geometry.coordinates[s];Is(u[0],u[u.length-1])||u.push(u[0]);for(var c=0;c<u.length-1;c++)i.push(u[c])}if(!yx(i))throw new Error("The input polygon may not have duplicate vertices (except for the first and last vertex of each ring)");var f=i.length,h=dx(e,function(ae,ce,re,oe,we,Ie,Y,be,fe,C,$e,Be){return[ae,ce,re,oe,we,Ie,Y,be,fe,C,$e,Be]}),d=h.length;if(d==0){for(var m=[],s=0;s<t;s++)m.push(kr([e.geometry.coordinates[s]],{parent:-1,winding:vx(e.geometry.coordinates[s])}));let ae=et(m);return W(ae),K(ae),ae}for(var v=[],y=[],s=0;s<t;s++){v.push([]);for(var c=0;c<e.geometry.coordinates[s].length-1;c++)v[s].push([new Zh(e.geometry.coordinates[s][Mi(c+1,e.geometry.coordinates[s].length-1)],1,[s,c],[s,Mi(c+1,e.geometry.coordinates[s].length-1)],void 0)]),y.push(new Wh(e.geometry.coordinates[s][c],[s,Mi(c-1,e.geometry.coordinates[s].length-1)],[s,c],void 0,void 0,!1,!0))}for(var s=0;s<d;s++)v[h[s][1]][h[s][2]].push(new Zh(h[s][0],h[s][5],[h[s][1],h[s][2]],[h[s][6],h[s][7]],void 0)),h[s][11]&&y.push(new Wh(h[s][0],[h[s][1],h[s][2]],[h[s][6],h[s][7]],void 0,void 0,!0,!0));for(var k=y.length,s=0;s<v.length;s++)for(var c=0;c<v[s].length;c++)v[s][c].sort(function(re,oe){return re.param<oe.param?-1:1});for(var S=[],s=0;s<k;s++)S.push({minX:y[s].coord[0],minY:y[s].coord[1],maxX:y[s].coord[0],maxY:y[s].coord[1],index:s});var b=new Zl;b.load(S);for(var s=0;s<v.length;s++)for(var c=0;c<v[s].length;c++)for(var P=0;P<v[s][c].length;P++){let re;P==v[s][c].length-1?re=v[s][Mi(c+1,e.geometry.coordinates[s].length-1)][0].coord:re=v[s][c][P+1].coord;var O=b.search({minX:re[0],minY:re[1],maxX:re[0],maxY:re[1]})[0];v[s][c][P].nxtIsectAlongEdgeIn=O.index}for(var s=0;s<v.length;s++)for(var c=0;c<v[s].length;c++)for(var P=0;P<v[s][c].length;P++){let oe=v[s][c][P].coord;var O=b.search({minX:oe[0],minY:oe[1],maxX:oe[0],maxY:oe[1]})[0],G=O.index;G<f?y[G].nxtIsectAlongRingAndEdge2=v[s][c][P].nxtIsectAlongEdgeIn:Is(y[G].ringAndEdge1,v[s][c][P].ringAndEdgeIn)?y[G].nxtIsectAlongRingAndEdge1=v[s][c][P].nxtIsectAlongEdgeIn:y[G].nxtIsectAlongRingAndEdge2=v[s][c][P].nxtIsectAlongEdgeIn}for(var L=[],s=0,c=0;c<t;c++){for(var j=s,P=0;P<e.geometry.coordinates[c].length-1;P++)y[s].coord[0]<y[j].coord[0]&&(j=s),s++;for(var V=y[j].nxtIsectAlongRingAndEdge2,P=0;P<y.length;P++)if(y[P].nxtIsectAlongRingAndEdge1==j||y[P].nxtIsectAlongRingAndEdge2==j){var X=P;break}var H=Ua([y[X].coord,y[j].coord,y[V].coord],!0)?1:-1;L.push({isect:j,parent:-1,winding:H})}L.sort(function(ae,ce){return y[ae.isect].coord>y[ce.isect].coord?-1:1});for(var m=[];L.length>0;){var $=L.pop(),w=$.isect,E=$.parent,M=$.winding,R=m.length,T=[y[w].coord],F=w;if(y[w].ringAndEdge1Walkable)var D=y[w].ringAndEdge1,N=y[w].nxtIsectAlongRingAndEdge1;else var D=y[w].ringAndEdge2,N=y[w].nxtIsectAlongRingAndEdge2;for(;!Is(y[w].coord,y[N].coord);){T.push(y[N].coord);for(var B=void 0,s=0;s<L.length;s++)if(L[s].isect==N){B=s;break}if(B!=null&&L.splice(B,1),Is(D,y[N].ringAndEdge1)){if(D=y[N].ringAndEdge2,y[N].ringAndEdge2Walkable=!1,y[N].ringAndEdge1Walkable){var U={isect:N};Ua([y[F].coord,y[N].coord,y[y[N].nxtIsectAlongRingAndEdge2].coord],M==1)?(U.parent=E,U.winding=-M):(U.parent=R,U.winding=M),L.push(U)}F=N,N=y[N].nxtIsectAlongRingAndEdge2}else{if(D=y[N].ringAndEdge1,y[N].ringAndEdge1Walkable=!1,y[N].ringAndEdge2Walkable){var U={isect:N};Ua([y[F].coord,y[N].coord,y[y[N].nxtIsectAlongRingAndEdge1].coord],M==1)?(U.parent=E,U.winding=-M):(U.parent=R,U.winding=M),L.push(U)}F=N,N=y[N].nxtIsectAlongRingAndEdge1}}T.push(y[N].coord),m.push(kr([T],{index:R,parent:E,winding:M,netWinding:void 0}))}let q=et(m);W(q),K(q);function W(ae){for(var ce=[],re=0;re<ae.features.length;re++)ae.features[re].properties.parent==-1&&ce.push(re);if(ce.length>1)for(var re=0;re<ce.length;re++){for(var oe=-1,we=1/0,Ie=0;Ie<ae.features.length;Ie++)ce[re]!=Ie&&ei(ae.features[ce[re]].geometry.coordinates[0][0],ae.features[Ie],{ignoreBoundary:!0})&&nx(ae.features[Ie])<we&&(oe=Ie);ae.features[ce[re]].properties.parent=oe}}function K(ae){for(var ce=0;ce<ae.features.length;ce++)if(ae.features[ce].properties.parent==-1){var re=ae.features[ce].properties.winding;ae.features[ce].properties.netWinding=re,ie(ae,ce,re)}}function ie(ae,ce,re){for(var oe=0;oe<ae.features.length;oe++)if(ae.features[oe].properties.parent==ce){var we=re+ae.features[oe].properties.winding;ae.features[oe].properties.netWinding=we,ie(ae,oe,we)}}return q}var Zh=class{constructor(e,t,i,s,u){this.coord=e,this.param=t,this.ringAndEdgeIn=i,this.ringAndEdgeOut=s,this.nxtIsectAlongEdgeIn=u}},Wh=class{constructor(e,t,i,s,u,c,f){this.coord=e,this.ringAndEdge1=t,this.ringAndEdge2=i,this.nxtIsectAlongRingAndEdge1=s,this.nxtIsectAlongRingAndEdge2=u,this.ringAndEdge1Walkable=c,this.ringAndEdge2Walkable=f}};function Ua(e,t){if(typeof t>"u"&&(t=!0),e.length!=3)throw new Error("This function requires an array of three points [x,y]");return(e[1][0]-e[0][0])*(e[2][1]-e[0][1])-(e[1][1]-e[0][1])*(e[2][0]-e[0][0])>=0==t}function vx(e){for(var t=0,i=0;i<e.length-1;i++)e[i][0]<e[t][0]&&(t=i);if(Ua([e[Mi(t-1,e.length-1)],e[t],e[Mi(t+1,e.length-1)]],!0))var s=1;else var s=-1;return s}function Is(e,t){if(!e||!t||e.length!=t.length)return!1;for(var i=0,s=e.length;i<s;i++)if(e[i]instanceof Array&&t[i]instanceof Array){if(!Is(e[i],t[i]))return!1}else if(e[i]!=t[i])return!1;return!0}function Mi(e,t){return(e%t+t)%t}function yx(e){for(var t={},i=1,s=0,u=e.length;s<u;++s){if(Object.prototype.hasOwnProperty.call(t,e[s].toString())){i=0;break}t[e[s].toString()]=1}return i}function _x(e){var t=[];return Er(e,function(i){i.geometry.type==="Polygon"&&Hn(mx(i),function(s){t.push(kr(s.geometry.coordinates,i.properties))})}),et(t)}var wx=_x,kx=class extends lr{mode="polygon";shape="polygon";lineDrawer=new $l(this.gm,{snappingMarkers:"first",targetShape:"polygon"});eventHandlers={[`${se}:draw`]:this.forwardLineDrawerEvent.bind(this),mousemove:this.onMouseMove.bind(this)};async onEndAction(){await this.lineDrawer.endAction()}async onStartAction(){await this.lineDrawer.startAction(),this.lineDrawer.on("firstMarkerClick",this.polygonFinished.bind(this)),this.lineDrawer.on("lastMarkerClick",this.polygonFinished.bind(this))}async onMouseMove(e){return He(e)?(this.lineDrawer.featureData||await this.fireMarkerPointerUpdateEvent(),{next:!0}):{next:!0}}async polygonFinished(e){if(await this.lineDrawer.endShape(),e.shapeCoordinates.length<3)return;const t=this.fixShapeGeoJson(Xl(e.geoJson));t&&await this.gm.features.createFeature({shapeGeoJson:{...t,properties:{shape:this.shape}},sourceName:Z.main})}fixShapeGeoJson(e){try{return b2(X2(wx(e))).features[0]}catch{return null}}},xx=class extends lr{mode="rectangle";shape="rectangle";startLngLat=null;eventHandlers={mousemove:this.onMouseMove.bind(this),click:this.onMouseClick.bind(this)};throttledMethods=ai({updateFeaturePosition:this.updateFeaturePosition},this,this.gm.options.settings.throttlingDelay);onStartAction(){this.gm.markerPointer.enable()}async onEndAction(){await this.removeTmpFeature(),this.startLngLat=null,this.gm.markerPointer.disable(),await this.fireFinishEvent()}async onMouseClick(e){if(!He(e,{warning:!0}))return{next:!1};this.gm.features.clearSelection();const t=this.gm.markerPointer.marker?.getLngLat()||e.lngLat.toArray();if(this.startLngLat){const i=this.getFeatureGeoJson(bi(this.startLngLat,t));await this.fireBeforeFeatureCreate({geoJsonFeatures:[i]}),this.flags.featureCreateAllowed&&await this.finishShape(t)}else{const i=this.getFeatureGeoJson(bi(t,t));if(await this.fireBeforeFeatureCreate({geoJsonFeatures:[i]}),this.flags.featureCreateAllowed){const s=await this.startShape(t);if(s){const u=this.getControlMarkerData(["geometry","coordinates",4]);await this.fireStartEvent(s,u)}}}return{next:!1}}async onMouseMove(e){if(!He(e,{warning:!0}))return{next:!1};if(!this.startLngLat)return await this.fireMarkerPointerUpdateEvent(),{next:!1};const t=this.gm.markerPointer.marker?.getLngLat()||e.lngLat.toArray(),i=bi(this.startLngLat,t),s=this.getFeatureGeoJson(i);return await this.fireBeforeFeatureCreate({geoJsonFeatures:[s]}),this.flags.featureCreateAllowed&&await this.throttledMethods.updateFeaturePosition(i),{next:!1}}async startShape(e){this.startLngLat=e;const t=bi(this.startLngLat,this.startLngLat);return this.featureData=await this.createFeature(t),this.featureData}async finishShape(e){if(this.startLngLat){const t=bi(this.startLngLat,e);await this.throttledMethods.updateFeaturePosition(t)}this.featureData&&(this.isFeatureGeoJsonValid()?await this.saveFeature():await this.removeTmpFeature()),this.startLngLat=null,await this.fireFinishEvent()}async createFeature(e){return this.gm.features.createFeature({shapeGeoJson:this.getFeatureGeoJson(e),sourceName:Z.temporary})}isFeatureGeoJsonValid(){return this.featureData?Yl(this.featureData.getGeoJson()):!1}getFeatureGeoJson(e){return{...Yu([e[0],e[1]],[e[2],e[3]]),properties:{shape:this.shape}}}async updateFeaturePosition(e){if(!this.featureData)return;const t=Yu([e[0],e[1]],[e[2],e[3]]);await this.featureData.updateGeometry(t.geometry);const i=this.getControlMarkerData(["geometry","coordinates",4]);await this.fireUpdateEvent(this.featureData,i)}getControlMarkerData(e){const t=this.gm.markerPointer.marker;return t?{type:"dom",instance:t,position:{coordinate:t.getLngLat(),path:e}}:null}async fireStartEvent(e,t){const i={name:`${se}:draw:shape_with_data`,level:"system",actionType:"draw",mode:this.shape,variant:null,action:"start",featureData:e,markerData:t};await this.gm.events.fire(`${se}:draw`,i)}async fireUpdateEvent(e,t){const i={name:`${se}:draw:shape_with_data`,level:"system",actionType:"draw",mode:this.shape,variant:null,action:"update",featureData:e,markerData:t};await this.gm.events.fire(`${se}:draw`,i)}async fireFinishEvent(){const e={name:`${se}:draw:shape`,level:"system",actionType:"draw",mode:this.shape,variant:null,action:"finish"};await this.gm.events.fire(`${se}:draw`,e)}},Ex=class extends lr{mode="text_marker";shape="text_marker";textarea=null;eventHandlers={click:this.onMouseClick.bind(this),mousemove:this.onMouseMove.bind(this)};onStartAction(){this.gm.markerPointer.enable({invisibleMarker:!0})}async onEndAction(){this.removeTextarea(),await this.removeTmpFeature(),this.featureData=null,this.gm.markerPointer.disable(),await this.fireMarkerPointerFinishEvent()}async onMouseMove(e){return He(e,{warning:!0})?(await this.fireMarkerPointerUpdateEvent(),{next:!0}):{next:!0}}async onMouseClick(e){if(!He(e,{warning:!0}))return{next:!0};if(this.gm.features.clearSelection(),this.textarea)await this.endShape(),this.gm.markerPointer.enable({invisibleMarker:!0,lngLat:e.lngLat.toArray()}),await this.fireMarkerPointerUpdateEvent();else{const t=this.gm.markerPointer.marker?.getLngLat()||e.lngLat.toArray();await this.fireBeforeFeatureCreate({geoJsonFeatures:[this.getFeatureGeoJson(t)]}),this.flags.featureCreateAllowed&&(this.featureData=await this.createFeature(t),this.gm.markerPointer.disable(),await this.fireMarkerPointerFinishEvent())}return{next:!1}}createFeature(e){const t=this.gm.mapAdapter.project(e);return this.createTextarea(t),this.gm.features.createFeature({shapeGeoJson:this.getFeatureGeoJson(e),sourceName:Z.temporary})}async endShape(){const e=this.textarea?.value||"";this.removeTextarea(),e.trim()?(await this.updateFeatureSource(e),await this.saveFeature()):await this.removeTmpFeature()}createTextarea(e){this.textarea=document.createElement("textarea"),this.textarea.style.position="absolute",this.textarea.style.left=`${e[0]}px`,this.textarea.style.top=`${e[1]}px`,this.textarea.style.opacity="0.7",this.gm.mapAdapter.getContainer().appendChild(this.textarea),this.textarea.focus()}removeTextarea(){this.textarea?.remove(),this.textarea=null}getFeatureGeoJson(e){return{type:"Feature",properties:{shape:this.shape,text:""},geometry:{type:"Point",coordinates:e}}}async updateFeatureSource(e){this.featureData&&await this.featureData._updateAllProperties({[`${rt}shape`]:this.shape,[`${rt}text`]:e})}},bx=class extends Vl{mode="ellipse";shape="ellipse";xSemiAxisPoint=null;xSemiAxisLngLat=null;throttledMethods=ai({updateFeatureGeoJson:this.updateFeatureGeoJson},this,this.gm.options.settings.throttlingDelay);async onMouseClick(e){if(!He(e))return{next:!0};this.gm.features.clearSelection();const t=this.gm.markerPointer.marker?.getLngLat()||e.lngLat.toArray();if(this.circleCenterLngLat&&this.xSemiAxisLngLat)await this.fireBeforeFeatureCreate({geoJsonFeatures:[this.getEllipseGeoJson(this.circleCenterLngLat,this.xSemiAxisLngLat,t)]}),this.flags.featureCreateAllowed&&(await this.saveEllipseFeature(t),this.circleCenterLngLat=null,this.circleCenterPoint=null,this.xSemiAxisPoint=null,this.xSemiAxisLngLat=null,await this.fireFinishEvent());else if(this.circleCenterLngLat)await this.fireBeforeFeatureCreate({geoJsonFeatures:[this.getEllipseGeoJson(this.circleCenterLngLat,t)]}),this.flags.featureCreateAllowed&&(this.xSemiAxisLngLat=t,this.xSemiAxisPoint=this.gm.mapAdapter.project(this.circleCenterLngLat));else if(await this.fireBeforeFeatureCreate({geoJsonFeatures:[this.getFeatureGeoJson(t)]}),this.flags.featureCreateAllowed){this.circleCenterLngLat=t,this.circleCenterPoint=this.gm.mapAdapter.project(this.circleCenterLngLat),this.featureData=await this.createFeature();const i=this.getControlMarkerData();this.featureData&&i&&await this.fireStartEvent(this.featureData,i)}return{next:!1}}async onMouseMove(){if(this.circleCenterLngLat&&this.gm.markerPointer.marker){const e=this.gm.markerPointer.marker.getLngLat();await this.fireBeforeFeatureCreate({geoJsonFeatures:[this.xSemiAxisLngLat?this.getEllipseGeoJson(this.circleCenterLngLat,this.xSemiAxisLngLat,e):this.getEllipseGeoJson(this.circleCenterLngLat,e)]}),this.flags.featureCreateAllowed&&await this.throttledMethods.updateFeatureGeoJson(e)}return this.circleCenterLngLat||await this.fireMarkerPointerUpdateEvent(),{next:!1}}async updateFeatureGeoJson(e){if(!this.featureData||!this.circleCenterLngLat)return;const t=this.xSemiAxisLngLat?this.getEllipseGeoJson(this.circleCenterLngLat,this.xSemiAxisLngLat,e):this.getEllipseGeoJson(this.circleCenterLngLat,e);await this.featureData.updateGeometry(t.geometry),await this.featureData._updateAllProperties({__gm_shape:t.properties.__gm_shape});const i=this.getControlMarkerData();i&&await this.fireUpdateEvent(this.featureData,i)}async saveEllipseFeature(e){if(!(!this.circleCenterLngLat||!this.xSemiAxisLngLat)&&this.featureData){const t=this.gm.markerPointer.marker?.getLngLat()||e;await this.updateFeatureGeoJson(t);const{xSemiAxis:i,ySemiAxis:s,angle:u}=zh({center:this.circleCenterLngLat,xSemiAxisLngLat:this.xSemiAxisLngLat,rimLngLat:t});await this.featureData.setShapeProperty("center",this.circleCenterLngLat),await this.featureData.setShapeProperty("xSemiAxis",i),await this.featureData.setShapeProperty("ySemiAxis",s),await this.featureData.setShapeProperty("angle",u),this.isFeatureGeoJsonValid()?await this.saveFeature():await this.removeTmpFeature()}}isFeatureGeoJsonValid(){return this.featureData?Yl(this.featureData.getGeoJson()):!1}getEllipseGeoJson(e,t,i){const{xSemiAxis:s,ySemiAxis:u,angle:c}=zh({center:e,xSemiAxisLngLat:t,rimLngLat:i});return No({center:e,xSemiAxis:s,ySemiAxis:u,angle:c})}},Vu={marker:J2,ellipse:bx,circle:U2,circle_marker:F2,text_marker:Ex,line:H2,rectangle:xx,polygon:kx,freehand:null,custom_shape:null},Sx=(e,t)=>Vu[t]?new Vu[t](e):(ee.error(`Draw "${t}" is not available`),null),Ix=class extends xo{eventHandlers={[`${se}:draw`]:this.handleDrawEvent.bind(this)};constructor(e,t){super(e),t.attachEvents(this.eventHandlers)}async handleDrawEvent(e){if(!Fl(e))return{next:!0};const t=`${e.actionType}__${e.mode}`;return e.action==="mode_start"?(await this.trackExclusiveModes(e),await this.start(t,e),await this.trackRelatedModes(e)):e.action==="mode_end"&&(await this.trackRelatedModes(e),await this.end(t)),{next:!0}}async start(e,t){const i=Sx(this.gm,t.mode);i&&(e in this.gm.actionInstances&&ee.error(`Action instance "${e}" already exists`),this.gm.actionInstances[e]=i,await i.startAction())}async end(e){const t=this.gm.actionInstances[e];t instanceof lr?(await t.endAction(),delete this.gm.actionInstances[e]):console.error(`Wrong action instance for draw event "${e}":`,t)}},aa=class extends Jl{actionType="edit";featureData=null;cursorExcludedLayerIds=["rectangle-line","polygon-line","circle-line"];layerEventHandlersData=[];async startAction(){this.setEventsForLayers("mouseenter",this.setCursorToPointer.bind(this)),this.setEventsForLayers("mouseleave",this.setCursorToEmpty.bind(this)),await super.startAction()}async endAction(){this.clearEventsForLayers(),await super.endAction()}setCursorToPointer(){this.flags.actionInProgress||this.gm.mapAdapter.setCursor("pointer")}setCursorToEmpty(){this.flags.actionInProgress||this.gm.mapAdapter.setCursor("")}getFeatureByMouseEvent({event:e,sourceNames:t}){const i=this.gm.features.getFeatureByMouseEvent({event:e,sourceNames:t});return!i||i.getShapeProperty("disableEdit")===!0?null:i}setEventsForLayers(e,t){this.gm.features.layers.map(i=>i.id).filter(i=>!this.cursorExcludedLayerIds.some(s=>i.includes(s))).forEach(i=>{this.gm.mapAdapter.on(e,i,t),this.layerEventHandlersData.push({eventName:e,layerId:i,callback:t})})}clearEventsForLayers(){this.layerEventHandlersData.forEach(({eventName:e,layerId:t,callback:i})=>{this.gm.mapAdapter.off(e,t,i)}),this.layerEventHandlersData=[]}async updateFeatureGeoJson({featureData:e,featureGeoJson:t,forceMode:i=void 0}){return this.flags.featureUpdateAllowed?(await e.updateGeometry(t.geometry),Ji(e.getGeoJson().properties,t.properties)||await e._updateAllProperties(t.properties),await this.fireFeatureUpdatedEvent({sourceFeatures:[e],targetFeatures:[e],forceMode:i}),!0):!1}async fireBeforeFeatureUpdate({features:e,geoJsonFeatures:t,forceMode:i=void 0}){this.flags.featureUpdateAllowed=!0;const s={name:`${se}:feature:before_update`,level:"system",actionType:"edit",mode:i||this.mode,action:"before_update",features:e,geoJsonFeatures:t};await this.gm.events.fire(`${se}:${this.actionType}`,s)}async fireFeatureUpdatedEvent({sourceFeatures:e,targetFeatures:t,markerData:i=void 0,forceMode:s=void 0}){const u={name:`${se}:edit:feature_updated`,level:"system",actionType:"edit",action:"feature_updated",mode:s||this.mode,sourceFeatures:e,targetFeatures:t,markerData:i||null};await this.gm.events.fire(`${se}:edit`,u)}async fireFeatureEditStartEvent({feature:e,forceMode:t=void 0}){const i={name:`${se}:edit:feature_edit_start`,level:"system",actionType:"edit",action:"feature_edit_start",mode:t||this.mode,feature:e};await this.gm.events.fire(`${se}:edit`,i)}async fireFeatureEditEndEvent({feature:e,forceMode:t=void 0}){const i={name:`${se}:edit:feature_edit_end`,level:"system",actionType:"edit",action:"feature_edit_end",mode:t||this.mode,feature:e};await this.gm.events.fire(`${se}:edit`,i)}async fireMarkerPointerUpdateEvent(){if(!this.gm.markerPointer.marker)return;const e=this.gm.markerPointer.marker,t={name:`${se}:draw:shape_with_data`,level:"system",variant:null,actionType:"draw",mode:this.getLineDrawerMode(),action:"update",markerData:{type:"dom",instance:e,position:{coordinate:e.getLngLat(),path:[-1]}},featureData:null};await this.gm.events.fire(`${se}:draw`,t)}async forwardLineDrawerEvent(e){if(!Id(e)||!["cut","split"].includes(this.mode))return{next:!0};if(e.action==="start"||e.action==="update"){const t={name:`${se}:draw:shape_with_data`,level:"system",actionType:"draw",mode:this.getLineDrawerMode(),variant:null,action:e.action,featureData:e.featureData,markerData:e.markerData};await this.gm.events.fire(`${se}:draw`,t)}else if(e.action==="finish"||e.action==="cancel"){const t={name:`${se}:draw:shape`,level:"system",actionType:"draw",mode:this.getLineDrawerMode(),variant:null,action:e.action};await this.gm.events.fire(`${se}:draw`,t)}return{next:!0}}async fireFeatureRemovedEvent(e){if(wr(e.shape,Fn)){const t={name:`${se}:edit:feature_removed`,level:"system",actionType:"edit",mode:e.shape,action:"feature_removed",featureData:e};await this.gm.events.fire(`${se}:edit`,t)}}getLineDrawerMode(){return this.mode==="cut"?"polygon":(this.mode,"line")}},Mx=class{gm;mapInstance;constructor(e,t){this.gm=t,this.mapInstance=e,this.addGmInstance(t)}addGmInstance(e){Object.assign(this.mapInstance,{gm:e})}removeGmInstance(){"gm"in this.mapInstance&&delete this.mapInstance.gm}getMapInstance(){if(this.mapInstance)return this.mapInstance;throw new Error(`Missing a "${this.mapType}" map instance`)}getEuclideanNearestLngLat(e,t){const i=this.project(t);let s=[0,0],u=1/0;return qd(e,c=>{const f=C2(this.project(c.start.coordinate),this.project(c.end.coordinate),i),h=Fs(i,f);h<u&&(u=h,s=[f[0],f[1]])}),this.unproject(s)}getDistance(e,t){return Gd(e,t,{units:"meters"})}};function Nx(e,t={}){const i=tr(e);return Dt([(i[0]+i[2])/2,(i[1]+i[3])/2],t.properties,t)}var Xu={exports:{}},Lx=Xu.exports,Kh;function Cx(){return Kh||(Kh=1,(function(e,t){(function(i,s){e.exports=s()})(Lx,(function(){function i(o,n){(n==null||n>o.length)&&(n=o.length);for(var r=0,a=Array(n);r<n;r++)a[r]=o[r];return a}function s(o,n,r){return n=v(n),(function(a,l){if(l&&(typeof l=="object"||typeof l=="function"))return l;if(l!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return(function(g){if(g===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return g})(a)})(o,k()?Reflect.construct(n,r||[],v(o).constructor):n.apply(o,r))}function u(o,n){if(!(o instanceof n))throw new TypeError("Cannot call a class as a function")}function c(o,n,r){if(k())return Reflect.construct.apply(null,arguments);var a=[null];a.push.apply(a,n);var l=new(o.bind.apply(o,a));return r&&S(l,r.prototype),l}function f(o,n){for(var r=0;r<n.length;r++){var a=n[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(o,O(a.key),a)}}function h(o,n,r){return n&&f(o.prototype,n),r&&f(o,r),Object.defineProperty(o,"prototype",{writable:!1}),o}function d(o,n){var r=typeof Symbol<"u"&&o[Symbol.iterator]||o["@@iterator"];if(!r){if(Array.isArray(o)||(r=G(o))||n){r&&(o=r);var a=0,l=function(){};return{s:l,n:function(){return a>=o.length?{done:!0}:{done:!1,value:o[a++]}},e:function(x){throw x},f:l}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
207
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var g,p=!0,_=!1;return{s:function(){r=r.call(o)},n:function(){var x=r.next();return p=x.done,x},e:function(x){_=!0,g=x},f:function(){try{p||r.return==null||r.return()}finally{if(_)throw g}}}}function m(){return m=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(o,n,r){var a=(function(g,p){for(;!{}.hasOwnProperty.call(g,p)&&(g=v(g))!==null;);return g})(o,n);if(a){var l=Object.getOwnPropertyDescriptor(a,n);return l.get?l.get.call(arguments.length<3?o:r):l.value}},m.apply(null,arguments)}function v(o){return v=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},v(o)}function y(o,n){if(typeof n!="function"&&n!==null)throw new TypeError("Super expression must either be null or a function");o.prototype=Object.create(n&&n.prototype,{constructor:{value:o,writable:!0,configurable:!0}}),Object.defineProperty(o,"prototype",{writable:!1}),n&&S(o,n)}function k(){try{var o=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch{}return(k=function(){return!!o})()}function S(o,n){return S=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,a){return r.__proto__=a,r},S(o,n)}function b(o,n,r,a){var l=m(v(1&a?o.prototype:o),n,r);return 2&a&&typeof l=="function"?function(g){return l.apply(r,g)}:l}function P(o){return(function(n){if(Array.isArray(n))return i(n)})(o)||(function(n){if(typeof Symbol<"u"&&n[Symbol.iterator]!=null||n["@@iterator"]!=null)return Array.from(n)})(o)||G(o)||(function(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
208
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)})()}function O(o){var n=(function(r,a){if(typeof r!="object"||!r)return r;var l=r[Symbol.toPrimitive];if(l!==void 0){var g=l.call(r,a);if(typeof g!="object")return g;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(r)})(o,"string");return typeof n=="symbol"?n:n+""}function G(o,n){if(o){if(typeof o=="string")return i(o,n);var r={}.toString.call(o).slice(8,-1);return r==="Object"&&o.constructor&&(r=o.constructor.name),r==="Map"||r==="Set"?Array.from(o):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?i(o,n):void 0}}function L(o){var n=typeof Map=="function"?new Map:void 0;return L=function(r){if(r===null||!(function(l){try{return Function.toString.call(l).indexOf("[native code]")!==-1}catch{return typeof l=="function"}})(r))return r;if(typeof r!="function")throw new TypeError("Super expression must either be null or a function");if(n!==void 0){if(n.has(r))return n.get(r);n.set(r,a)}function a(){return c(r,arguments,v(this).constructor)}return a.prototype=Object.create(r.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),S(a,r)},L(o)}var j=(function(){function o(){u(this,o),o.constructor_.apply(this,arguments)}return h(o,[{key:"getEndCapStyle",value:function(){return this._endCapStyle}},{key:"isSingleSided",value:function(){return this._isSingleSided}},{key:"setQuadrantSegments",value:function(n){this._quadrantSegments=n,this._quadrantSegments===0&&(this._joinStyle=o.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=o.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),n<=0&&(this._quadrantSegments=1),this._joinStyle!==o.JOIN_ROUND&&(this._quadrantSegments=o.DEFAULT_QUADRANT_SEGMENTS)}},{key:"getJoinStyle",value:function(){return this._joinStyle}},{key:"setJoinStyle",value:function(n){this._joinStyle=n}},{key:"setSimplifyFactor",value:function(n){this._simplifyFactor=n<0?0:n}},{key:"getSimplifyFactor",value:function(){return this._simplifyFactor}},{key:"getQuadrantSegments",value:function(){return this._quadrantSegments}},{key:"setEndCapStyle",value:function(n){this._endCapStyle=n}},{key:"getMitreLimit",value:function(){return this._mitreLimit}},{key:"setMitreLimit",value:function(n){this._mitreLimit=n}},{key:"setSingleSided",value:function(n){this._isSingleSided=n}}],[{key:"constructor_",value:function(){if(this._quadrantSegments=o.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=o.CAP_ROUND,this._joinStyle=o.JOIN_ROUND,this._mitreLimit=o.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=o.DEFAULT_SIMPLIFY_FACTOR,arguments.length!==0){if(arguments.length===1){var n=arguments[0];this.setQuadrantSegments(n)}else if(arguments.length===2){var r=arguments[0],a=arguments[1];this.setQuadrantSegments(r),this.setEndCapStyle(a)}else if(arguments.length===4){var l=arguments[0],g=arguments[1],p=arguments[2],_=arguments[3];this.setQuadrantSegments(l),this.setEndCapStyle(g),this.setJoinStyle(p),this.setMitreLimit(_)}}}},{key:"bufferDistanceError",value:function(n){var r=Math.PI/2/n;return 1-Math.cos(r/2)}}])})();j.CAP_ROUND=1,j.CAP_FLAT=2,j.CAP_SQUARE=3,j.JOIN_ROUND=1,j.JOIN_MITRE=2,j.JOIN_BEVEL=3,j.DEFAULT_QUADRANT_SEGMENTS=8,j.DEFAULT_MITRE_LIMIT=5,j.DEFAULT_SIMPLIFY_FACTOR=.01;var V=(function(o){function n(r){var a;return u(this,n),(a=s(this,n,[r])).name=Object.keys({Exception:n})[0],a}return y(n,o),h(n,[{key:"toString",value:function(){return this.message}}])})(L(Error)),X=(function(o){function n(r){var a;return u(this,n),(a=s(this,n,[r])).name=Object.keys({IllegalArgumentException:n})[0],a}return y(n,o),h(n)})(V),H=(function(){return h((function o(){u(this,o)}),[{key:"filter",value:function(o){}}])})();function $(){}function w(){}function E(){}var M,R,T,F,D,N,B,U,q=(function(){return h((function o(){u(this,o)}),null,[{key:"equalsWithTolerance",value:function(o,n,r){return Math.abs(o-n)<=r}}])})(),W=(function(){return h((function o(n,r){u(this,o),this.low=r||0,this.high=n||0}),null,[{key:"toBinaryString",value:function(o){var n,r="";for(n=2147483648;n>0;n>>>=1)r+=(o.high&n)===n?"1":"0";for(n=2147483648;n>0;n>>>=1)r+=(o.low&n)===n?"1":"0";return r}}])})();function K(){}function ie(){}K.NaN=NaN,K.isNaN=function(o){return Number.isNaN(o)},K.isInfinite=function(o){return!Number.isFinite(o)},K.MAX_VALUE=Number.MAX_VALUE,K.POSITIVE_INFINITY=Number.POSITIVE_INFINITY,K.NEGATIVE_INFINITY=Number.NEGATIVE_INFINITY,typeof Float64Array=="function"&&typeof Int32Array=="function"?(N=2146435072,B=new Float64Array(1),U=new Int32Array(B.buffer),K.doubleToLongBits=function(o){B[0]=o;var n=0|U[0],r=0|U[1];return(r&N)===N&&1048575&r&&n!==0&&(n=0,r=2146959360),new W(r,n)},K.longBitsToDouble=function(o){return U[0]=o.low,U[1]=o.high,B[0]}):(M=1023,R=Math.log2,T=Math.floor,F=Math.pow,D=(function(){for(var o=53;o>0;o--){var n=F(2,o)-1;if(T(R(n))+1===o)return n}return 0})(),K.doubleToLongBits=function(o){var n,r,a,l,g,p,_,x,I;if(o<0||1/o===Number.NEGATIVE_INFINITY?(p=1<<31,o=-o):p=0,o===0)return new W(x=p,I=0);if(o===1/0)return new W(x=2146435072|p,I=0);if(o!=o)return new W(x=2146959360,I=0);if(l=0,I=0,(n=T(o))>1)if(n<=D)(l=T(R(n)))<=20?(I=0,x=n<<20-l&1048575):(I=n%(r=F(2,a=l-20))<<32-a,x=n/r&1048575);else for(a=n,I=0;(a=T(r=a/2))!==0;)l++,I>>>=1,I|=(1&x)<<31,x>>>=1,r!==a&&(x|=524288);if(_=l+M,g=n===0,n=o-n,l<52&&n!==0)for(a=0;;){if((r=2*n)>=1?(n=r-1,g?(_--,g=!1):(a<<=1,a|=1,l++)):(n=r,g?--_==0&&(l++,g=!1):(a<<=1,l++)),l===20)x|=a,a=0;else if(l===52){I|=a;break}if(r===1){l<20?x|=a<<20-l:l<52&&(I|=a<<52-l);break}}return x|=_<<20,new W(x|=p,I)},K.longBitsToDouble=function(o){var n,r,a,l,g=o.high,p=o.low,_=g&1<<31?-1:1;for(a=((2146435072&g)>>20)-M,l=0,r=1<<19,n=1;n<=20;n++)g&r&&(l+=F(2,-n)),r>>>=1;for(r=1<<31,n=21;n<=52;n++)p&r&&(l+=F(2,-n)),r>>>=1;if(a===-1023){if(l===0)return 0*_;a=-1022}else{if(a===1024)return l===0?_/0:NaN;l+=1}return _*l*F(2,a)});var ae=(function(o){function n(r){var a;return u(this,n),(a=s(this,n,[r])).name=Object.keys({RuntimeException:n})[0],a}return y(n,o),h(n)})(V),ce=(function(o){function n(){var r;return u(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return y(n,o),h(n,null,[{key:"constructor_",value:function(){if(arguments.length===0)ae.constructor_.call(this);else if(arguments.length===1){var r=arguments[0];ae.constructor_.call(this,r)}}}])})(ae),re=(function(){function o(){u(this,o)}return h(o,null,[{key:"shouldNeverReachHere",value:function(){if(arguments.length===0)o.shouldNeverReachHere(null);else if(arguments.length===1){var n=arguments[0];throw new ce("Should never reach here"+(n!==null?": "+n:""))}}},{key:"isTrue",value:function(){if(arguments.length===1){var n=arguments[0];o.isTrue(n,null)}else if(arguments.length===2){var r=arguments[1];if(!arguments[0])throw r===null?new ce:new ce(r)}}},{key:"equals",value:function(){if(arguments.length===2){var n=arguments[0],r=arguments[1];o.equals(n,r,null)}else if(arguments.length===3){var a=arguments[0],l=arguments[1],g=arguments[2];if(!l.equals(a))throw new ce("Expected "+a+" but encountered "+l+(g!==null?": "+g:""))}}}])})(),oe=new ArrayBuffer(8),we=new Float64Array(oe),Ie=new Int32Array(oe),Y=(function(){function o(){u(this,o),o.constructor_.apply(this,arguments)}return h(o,[{key:"getM",value:function(){return K.NaN}},{key:"setOrdinate",value:function(n,r){switch(n){case o.X:this.x=r;break;case o.Y:this.y=r;break;case o.Z:this.setZ(r);break;default:throw new X("Invalid ordinate index: "+n)}}},{key:"equals2D",value:function(){if(arguments.length===1){var n=arguments[0];return this.x===n.x&&this.y===n.y}if(arguments.length===2){var r=arguments[0],a=arguments[1];return!!q.equalsWithTolerance(this.x,r.x,a)&&!!q.equalsWithTolerance(this.y,r.y,a)}}},{key:"setM",value:function(n){throw new X("Invalid ordinate index: "+o.M)}},{key:"getZ",value:function(){return this.z}},{key:"getOrdinate",value:function(n){switch(n){case o.X:return this.x;case o.Y:return this.y;case o.Z:return this.getZ()}throw new X("Invalid ordinate index: "+n)}},{key:"equals3D",value:function(n){return this.x===n.x&&this.y===n.y&&(this.getZ()===n.getZ()||K.isNaN(this.getZ())&&K.isNaN(n.getZ()))}},{key:"equals",value:function(n){return n instanceof o&&this.equals2D(n)}},{key:"equalInZ",value:function(n,r){return q.equalsWithTolerance(this.getZ(),n.getZ(),r)}},{key:"setX",value:function(n){this.x=n}},{key:"compareTo",value:function(n){var r=n;return this.x<r.x?-1:this.x>r.x?1:this.y<r.y?-1:this.y>r.y?1:0}},{key:"getX",value:function(){return this.x}},{key:"setZ",value:function(n){this.z=n}},{key:"clone",value:function(){try{return null}catch(n){if(n instanceof CloneNotSupportedException)return re.shouldNeverReachHere("this shouldn't happen because this class is Cloneable"),null;throw n}}},{key:"copy",value:function(){return new o(this)}},{key:"toString",value:function(){return"("+this.x+", "+this.y+", "+this.getZ()+")"}},{key:"distance3D",value:function(n){var r=this.x-n.x,a=this.y-n.y,l=this.getZ()-n.getZ();return Math.sqrt(r*r+a*a+l*l)}},{key:"getY",value:function(){return this.y}},{key:"setY",value:function(n){this.y=n}},{key:"distance",value:function(n){var r=this.x-n.x,a=this.y-n.y;return Math.sqrt(r*r+a*a)}},{key:"hashCode",value:function(){var n=17;return n=37*(n=37*n+o.hashCode(this.x))+o.hashCode(this.y)}},{key:"setCoordinate",value:function(n){this.x=n.x,this.y=n.y,this.z=n.getZ()}},{key:"interfaces_",get:function(){return[$,w,E]}}],[{key:"constructor_",value:function(){if(this.x=null,this.y=null,this.z=null,arguments.length===0)o.constructor_.call(this,0,0);else if(arguments.length===1){var n=arguments[0];o.constructor_.call(this,n.x,n.y,n.getZ())}else if(arguments.length===2){var r=arguments[0],a=arguments[1];o.constructor_.call(this,r,a,o.NULL_ORDINATE)}else if(arguments.length===3){var l=arguments[0],g=arguments[1],p=arguments[2];this.x=l,this.y=g,this.z=p}}},{key:"hashCode",value:function(n){return we[0]=n,Ie[0]^Ie[1]}}])})();Y.DimensionalComparator=(function(){function o(){u(this,o),o.constructor_.apply(this,arguments)}return h(o,[{key:"compare",value:function(n,r){var a=o.compare(n.x,r.x);if(a!==0)return a;var l=o.compare(n.y,r.y);return l!==0?l:this._dimensionsToTest<=2?0:o.compare(n.getZ(),r.getZ())}},{key:"interfaces_",get:function(){return[ie]}}],[{key:"constructor_",value:function(){if(this._dimensionsToTest=2,arguments.length===0)o.constructor_.call(this,2);else if(arguments.length===1){var n=arguments[0];if(n!==2&&n!==3)throw new X("only 2 or 3 dimensions may be specified");this._dimensionsToTest=n}}},{key:"compare",value:function(n,r){return n<r?-1:n>r?1:K.isNaN(n)?K.isNaN(r)?0:-1:K.isNaN(r)?1:0}}])})(),Y.NULL_ORDINATE=K.NaN,Y.X=0,Y.Y=1,Y.Z=2,Y.M=3;var be=(function(){function o(){u(this,o),o.constructor_.apply(this,arguments)}return h(o,[{key:"getArea",value:function(){return this.getWidth()*this.getHeight()}},{key:"equals",value:function(n){if(!(n instanceof o))return!1;var r=n;return this.isNull()?r.isNull():this._maxx===r.getMaxX()&&this._maxy===r.getMaxY()&&this._minx===r.getMinX()&&this._miny===r.getMinY()}},{key:"intersection",value:function(n){if(this.isNull()||n.isNull()||!this.intersects(n))return new o;var r=this._minx>n._minx?this._minx:n._minx,a=this._miny>n._miny?this._miny:n._miny;return new o(r,this._maxx<n._maxx?this._maxx:n._maxx,a,this._maxy<n._maxy?this._maxy:n._maxy)}},{key:"isNull",value:function(){return this._maxx<this._minx}},{key:"getMaxX",value:function(){return this._maxx}},{key:"covers",value:function(){if(arguments.length===1){if(arguments[0]instanceof Y){var n=arguments[0];return this.covers(n.x,n.y)}if(arguments[0]instanceof o){var r=arguments[0];return!this.isNull()&&!r.isNull()&&r.getMinX()>=this._minx&&r.getMaxX()<=this._maxx&&r.getMinY()>=this._miny&&r.getMaxY()<=this._maxy}}else if(arguments.length===2){var a=arguments[0],l=arguments[1];return!this.isNull()&&a>=this._minx&&a<=this._maxx&&l>=this._miny&&l<=this._maxy}}},{key:"intersects",value:function(){if(arguments.length===1){if(arguments[0]instanceof o){var n=arguments[0];return!this.isNull()&&!n.isNull()&&!(n._minx>this._maxx||n._maxx<this._minx||n._miny>this._maxy||n._maxy<this._miny)}if(arguments[0]instanceof Y){var r=arguments[0];return this.intersects(r.x,r.y)}}else if(arguments.length===2){if(arguments[0]instanceof Y&&arguments[1]instanceof Y){var a=arguments[0],l=arguments[1];return!this.isNull()&&!((a.x<l.x?a.x:l.x)>this._maxx)&&!((a.x>l.x?a.x:l.x)<this._minx)&&!((a.y<l.y?a.y:l.y)>this._maxy)&&!((a.y>l.y?a.y:l.y)<this._miny)}if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var g=arguments[0],p=arguments[1];return!this.isNull()&&!(g>this._maxx||g<this._minx||p>this._maxy||p<this._miny)}}}},{key:"getMinY",value:function(){return this._miny}},{key:"getDiameter",value:function(){if(this.isNull())return 0;var n=this.getWidth(),r=this.getHeight();return Math.sqrt(n*n+r*r)}},{key:"getMinX",value:function(){return this._minx}},{key:"expandToInclude",value:function(){if(arguments.length===1){if(arguments[0]instanceof Y){var n=arguments[0];this.expandToInclude(n.x,n.y)}else if(arguments[0]instanceof o){var r=arguments[0];if(r.isNull())return null;this.isNull()?(this._minx=r.getMinX(),this._maxx=r.getMaxX(),this._miny=r.getMinY(),this._maxy=r.getMaxY()):(r._minx<this._minx&&(this._minx=r._minx),r._maxx>this._maxx&&(this._maxx=r._maxx),r._miny<this._miny&&(this._miny=r._miny),r._maxy>this._maxy&&(this._maxy=r._maxy))}}else if(arguments.length===2){var a=arguments[0],l=arguments[1];this.isNull()?(this._minx=a,this._maxx=a,this._miny=l,this._maxy=l):(a<this._minx&&(this._minx=a),a>this._maxx&&(this._maxx=a),l<this._miny&&(this._miny=l),l>this._maxy&&(this._maxy=l))}}},{key:"minExtent",value:function(){if(this.isNull())return 0;var n=this.getWidth(),r=this.getHeight();return n<r?n:r}},{key:"getWidth",value:function(){return this.isNull()?0:this._maxx-this._minx}},{key:"compareTo",value:function(n){var r=n;return this.isNull()?r.isNull()?0:-1:r.isNull()?1:this._minx<r._minx?-1:this._minx>r._minx?1:this._miny<r._miny?-1:this._miny>r._miny?1:this._maxx<r._maxx?-1:this._maxx>r._maxx?1:this._maxy<r._maxy?-1:this._maxy>r._maxy?1:0}},{key:"translate",value:function(n,r){if(this.isNull())return null;this.init(this.getMinX()+n,this.getMaxX()+n,this.getMinY()+r,this.getMaxY()+r)}},{key:"copy",value:function(){return new o(this)}},{key:"toString",value:function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"}},{key:"setToNull",value:function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1}},{key:"disjoint",value:function(n){return!(!this.isNull()&&!n.isNull())||n._minx>this._maxx||n._maxx<this._minx||n._miny>this._maxy||n._maxy<this._miny}},{key:"getHeight",value:function(){return this.isNull()?0:this._maxy-this._miny}},{key:"maxExtent",value:function(){if(this.isNull())return 0;var n=this.getWidth(),r=this.getHeight();return n>r?n:r}},{key:"expandBy",value:function(){if(arguments.length===1){var n=arguments[0];this.expandBy(n,n)}else if(arguments.length===2){var r=arguments[0],a=arguments[1];if(this.isNull())return null;this._minx-=r,this._maxx+=r,this._miny-=a,this._maxy+=a,(this._minx>this._maxx||this._miny>this._maxy)&&this.setToNull()}}},{key:"contains",value:function(){if(arguments.length===1){if(arguments[0]instanceof o){var n=arguments[0];return this.covers(n)}if(arguments[0]instanceof Y){var r=arguments[0];return this.covers(r)}}else if(arguments.length===2){var a=arguments[0],l=arguments[1];return this.covers(a,l)}}},{key:"centre",value:function(){return this.isNull()?null:new Y((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)}},{key:"init",value:function(){if(arguments.length===0)this.setToNull();else if(arguments.length===1){if(arguments[0]instanceof Y){var n=arguments[0];this.init(n.x,n.x,n.y,n.y)}else if(arguments[0]instanceof o){var r=arguments[0];this._minx=r._minx,this._maxx=r._maxx,this._miny=r._miny,this._maxy=r._maxy}}else if(arguments.length===2){var a=arguments[0],l=arguments[1];this.init(a.x,l.x,a.y,l.y)}else if(arguments.length===4){var g=arguments[0],p=arguments[1],_=arguments[2],x=arguments[3];g<p?(this._minx=g,this._maxx=p):(this._minx=p,this._maxx=g),_<x?(this._miny=_,this._maxy=x):(this._miny=x,this._maxy=_)}}},{key:"getMaxY",value:function(){return this._maxy}},{key:"distance",value:function(n){if(this.intersects(n))return 0;var r=0;this._maxx<n._minx?r=n._minx-this._maxx:this._minx>n._maxx&&(r=this._minx-n._maxx);var a=0;return this._maxy<n._miny?a=n._miny-this._maxy:this._miny>n._maxy&&(a=this._miny-n._maxy),r===0?a:a===0?r:Math.sqrt(r*r+a*a)}},{key:"hashCode",value:function(){var n=17;return n=37*(n=37*(n=37*(n=37*n+Y.hashCode(this._minx))+Y.hashCode(this._maxx))+Y.hashCode(this._miny))+Y.hashCode(this._maxy)}},{key:"interfaces_",get:function(){return[$,E]}}],[{key:"constructor_",value:function(){if(this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,arguments.length===0)this.init();else if(arguments.length===1){if(arguments[0]instanceof Y){var n=arguments[0];this.init(n.x,n.x,n.y,n.y)}else if(arguments[0]instanceof o){var r=arguments[0];this.init(r)}}else if(arguments.length===2){var a=arguments[0],l=arguments[1];this.init(a.x,l.x,a.y,l.y)}else if(arguments.length===4){var g=arguments[0],p=arguments[1],_=arguments[2],x=arguments[3];this.init(g,p,_,x)}}},{key:"intersects",value:function(){if(arguments.length===3){var n=arguments[0],r=arguments[1],a=arguments[2];return a.x>=(n.x<r.x?n.x:r.x)&&a.x<=(n.x>r.x?n.x:r.x)&&a.y>=(n.y<r.y?n.y:r.y)&&a.y<=(n.y>r.y?n.y:r.y)}if(arguments.length===4){var l=arguments[0],g=arguments[1],p=arguments[2],_=arguments[3],x=Math.min(p.x,_.x),I=Math.max(p.x,_.x),z=Math.min(l.x,g.x),J=Math.max(l.x,g.x);return!(z>I)&&!(J<x)&&(x=Math.min(p.y,_.y),I=Math.max(p.y,_.y),z=Math.min(l.y,g.y),J=Math.max(l.y,g.y),!(z>I)&&!(J<x))}}}])})(),fe=(function(){function o(){u(this,o),o.constructor_.apply(this,arguments)}return h(o,[{key:"isGeometryCollection",value:function(){return this.getTypeCode()===o.TYPECODE_GEOMETRYCOLLECTION}},{key:"getFactory",value:function(){return this._factory}},{key:"getGeometryN",value:function(n){return this}},{key:"getArea",value:function(){return 0}},{key:"isRectangle",value:function(){return!1}},{key:"equalsExact",value:function(n){return this===n||this.equalsExact(n,0)}},{key:"geometryChanged",value:function(){this.apply(o.geometryChangedFilter)}},{key:"geometryChangedAction",value:function(){this._envelope=null}},{key:"equalsNorm",value:function(n){return n!==null&&this.norm().equalsExact(n.norm())}},{key:"getLength",value:function(){return 0}},{key:"getNumGeometries",value:function(){return 1}},{key:"compareTo",value:function(){var n;if(arguments.length===1){var r=arguments[0];return n=r,this.getTypeCode()!==n.getTypeCode()?this.getTypeCode()-n.getTypeCode():this.isEmpty()&&n.isEmpty()?0:this.isEmpty()?-1:n.isEmpty()?1:this.compareToSameClass(r)}if(arguments.length===2){var a=arguments[0],l=arguments[1];return n=a,this.getTypeCode()!==n.getTypeCode()?this.getTypeCode()-n.getTypeCode():this.isEmpty()&&n.isEmpty()?0:this.isEmpty()?-1:n.isEmpty()?1:this.compareToSameClass(a,l)}}},{key:"getUserData",value:function(){return this._userData}},{key:"getSRID",value:function(){return this._SRID}},{key:"getEnvelope",value:function(){return this.getFactory().toGeometry(this.getEnvelopeInternal())}},{key:"checkNotGeometryCollection",value:function(n){if(n.getTypeCode()===o.TYPECODE_GEOMETRYCOLLECTION)throw new X("This method does not support GeometryCollection arguments")}},{key:"equal",value:function(n,r,a){return a===0?n.equals(r):n.distance(r)<=a}},{key:"norm",value:function(){var n=this.copy();return n.normalize(),n}},{key:"reverse",value:function(){var n=this.reverseInternal();return this.envelope!=null&&(n.envelope=this.envelope.copy()),n.setSRID(this.getSRID()),n}},{key:"copy",value:function(){var n=this.copyInternal();return n.envelope=this._envelope==null?null:this._envelope.copy(),n._SRID=this._SRID,n._userData=this._userData,n}},{key:"getPrecisionModel",value:function(){return this._factory.getPrecisionModel()}},{key:"getEnvelopeInternal",value:function(){return this._envelope===null&&(this._envelope=this.computeEnvelopeInternal()),new be(this._envelope)}},{key:"setSRID",value:function(n){this._SRID=n}},{key:"setUserData",value:function(n){this._userData=n}},{key:"compare",value:function(n,r){for(var a=n.iterator(),l=r.iterator();a.hasNext()&&l.hasNext();){var g=a.next(),p=l.next(),_=g.compareTo(p);if(_!==0)return _}return a.hasNext()?1:l.hasNext()?-1:0}},{key:"hashCode",value:function(){return this.getEnvelopeInternal().hashCode()}},{key:"isEquivalentClass",value:function(n){return this.getClass()===n.getClass()}},{key:"isGeometryCollectionOrDerived",value:function(){return this.getTypeCode()===o.TYPECODE_GEOMETRYCOLLECTION||this.getTypeCode()===o.TYPECODE_MULTIPOINT||this.getTypeCode()===o.TYPECODE_MULTILINESTRING||this.getTypeCode()===o.TYPECODE_MULTIPOLYGON}},{key:"interfaces_",get:function(){return[w,$,E]}},{key:"getClass",value:function(){return o}}],[{key:"hasNonEmptyElements",value:function(n){for(var r=0;r<n.length;r++)if(!n[r].isEmpty())return!0;return!1}},{key:"hasNullElements",value:function(n){for(var r=0;r<n.length;r++)if(n[r]===null)return!0;return!1}}])})();fe.constructor_=function(o){o&&(this._envelope=null,this._userData=null,this._factory=o,this._SRID=o.getSRID())},fe.TYPECODE_POINT=0,fe.TYPECODE_MULTIPOINT=1,fe.TYPECODE_LINESTRING=2,fe.TYPECODE_LINEARRING=3,fe.TYPECODE_MULTILINESTRING=4,fe.TYPECODE_POLYGON=5,fe.TYPECODE_MULTIPOLYGON=6,fe.TYPECODE_GEOMETRYCOLLECTION=7,fe.TYPENAME_POINT="Point",fe.TYPENAME_MULTIPOINT="MultiPoint",fe.TYPENAME_LINESTRING="LineString",fe.TYPENAME_LINEARRING="LinearRing",fe.TYPENAME_MULTILINESTRING="MultiLineString",fe.TYPENAME_POLYGON="Polygon",fe.TYPENAME_MULTIPOLYGON="MultiPolygon",fe.TYPENAME_GEOMETRYCOLLECTION="GeometryCollection",fe.geometryChangedFilter={get interfaces_(){return[H]},filter:function(o){o.geometryChangedAction()}};var C=(function(){function o(){u(this,o)}return h(o,null,[{key:"toLocationSymbol",value:function(n){switch(n){case o.EXTERIOR:return"e";case o.BOUNDARY:return"b";case o.INTERIOR:return"i";case o.NONE:return"-"}throw new X("Unknown location value: "+n)}}])})();C.INTERIOR=0,C.BOUNDARY=1,C.EXTERIOR=2,C.NONE=-1;var $e=(function(){return h((function o(){u(this,o)}),[{key:"add",value:function(){}},{key:"addAll",value:function(){}},{key:"isEmpty",value:function(){}},{key:"iterator",value:function(){}},{key:"size",value:function(){}},{key:"toArray",value:function(){}},{key:"remove",value:function(){}}])})(),Be=(function(o){function n(r){var a;return u(this,n),(a=s(this,n,[r])).name=Object.keys({NoSuchElementException:n})[0],a}return y(n,o),h(n)})(V),Re=(function(o){function n(r){var a;return u(this,n),(a=s(this,n,[r])).name=Object.keys({UnsupportedOperationException:n})[0],a}return y(n,o),h(n)})(V),Me=(function(o){function n(){return u(this,n),s(this,n,arguments)}return y(n,o),h(n,[{key:"contains",value:function(){}}])})($e),Mr=(function(o){function n(r){var a;return u(this,n),(a=s(this,n)).map=new Map,r instanceof $e&&a.addAll(r),a}return y(n,o),h(n,[{key:"contains",value:function(r){var a=r.hashCode?r.hashCode():r;return!!this.map.has(a)}},{key:"add",value:function(r){var a=r.hashCode?r.hashCode():r;return!this.map.has(a)&&!!this.map.set(a,r)}},{key:"addAll",value:function(r){var a,l=d(r);try{for(l.s();!(a=l.n()).done;){var g=a.value;this.add(g)}}catch(p){l.e(p)}finally{l.f()}return!0}},{key:"remove",value:function(){throw new Re}},{key:"size",value:function(){return this.map.size}},{key:"isEmpty",value:function(){return this.map.size===0}},{key:"toArray",value:function(){return Array.from(this.map.values())}},{key:"iterator",value:function(){return new es(this.map)}},{key:Symbol.iterator,value:function(){return this.map}}])})(Me),es=(function(){return h((function o(n){u(this,o),this.iterator=n.values();var r=this.iterator.next(),a=r.done,l=r.value;this.done=a,this.value=l}),[{key:"next",value:function(){if(this.done)throw new Be;var o=this.value,n=this.iterator.next(),r=n.done,a=n.value;return this.done=r,this.value=a,o}},{key:"hasNext",value:function(){return!this.done}},{key:"remove",value:function(){throw new Re}}])})(),ne=(function(){function o(){u(this,o)}return h(o,null,[{key:"opposite",value:function(n){return n===o.LEFT?o.RIGHT:n===o.RIGHT?o.LEFT:n}}])})();ne.ON=0,ne.LEFT=1,ne.RIGHT=2;var Nr=(function(o){function n(r){var a;return u(this,n),(a=s(this,n,[r])).name=Object.keys({EmptyStackException:n})[0],a}return y(n,o),h(n)})(V),Lr=(function(o){function n(r){var a;return u(this,n),(a=s(this,n,[r])).name=Object.keys({IndexOutOfBoundsException:n})[0],a}return y(n,o),h(n)})(V),bn=(function(o){function n(){return u(this,n),s(this,n,arguments)}return y(n,o),h(n,[{key:"get",value:function(){}},{key:"set",value:function(){}},{key:"isEmpty",value:function(){}}])})($e),ua=(function(o){function n(){var r;return u(this,n),(r=s(this,n)).array=[],r}return y(n,o),h(n,[{key:"add",value:function(r){return this.array.push(r),!0}},{key:"get",value:function(r){if(r<0||r>=this.size())throw new Lr;return this.array[r]}},{key:"push",value:function(r){return this.array.push(r),r}},{key:"pop",value:function(){if(this.array.length===0)throw new Nr;return this.array.pop()}},{key:"peek",value:function(){if(this.array.length===0)throw new Nr;return this.array[this.array.length-1]}},{key:"empty",value:function(){return this.array.length===0}},{key:"isEmpty",value:function(){return this.empty()}},{key:"search",value:function(r){return this.array.indexOf(r)}},{key:"size",value:function(){return this.array.length}},{key:"toArray",value:function(){return this.array.slice()}}])})(bn);function _e(o,n){return o.interfaces_&&o.interfaces_.indexOf(n)>-1}var Vn=(function(){return h((function o(n){u(this,o),this.str=n}),[{key:"append",value:function(o){this.str+=o}},{key:"setCharAt",value:function(o,n){this.str=this.str.substr(0,o)+n+this.str.substr(o+1)}},{key:"toString",value:function(){return this.str}}])})(),Sn=(function(){function o(n){u(this,o),this.value=n}return h(o,[{key:"intValue",value:function(){return this.value}},{key:"compareTo",value:function(n){return this.value<n?-1:this.value>n?1:0}}],[{key:"compare",value:function(n,r){return n<r?-1:n>r?1:0}},{key:"isNan",value:function(n){return Number.isNaN(n)}},{key:"valueOf",value:function(n){return new o(n)}}])})(),In=(function(){return h((function o(){u(this,o)}),null,[{key:"isWhitespace",value:function(o){return o<=32&&o>=0||o===127}},{key:"toUpperCase",value:function(o){return o.toUpperCase()}}])})(),ge=(function(){function o(){u(this,o),o.constructor_.apply(this,arguments)}return h(o,[{key:"le",value:function(n){return this._hi<n._hi||this._hi===n._hi&&this._lo<=n._lo}},{key:"extractSignificantDigits",value:function(n,r){var a=this.abs(),l=o.magnitude(a._hi),g=o.TEN.pow(l);(a=a.divide(g)).gt(o.TEN)?(a=a.divide(o.TEN),l+=1):a.lt(o.ONE)&&(a=a.multiply(o.TEN),l-=1);for(var p=l+1,_=new Vn,x=o.MAX_PRINT_DIGITS-1,I=0;I<=x;I++){n&&I===p&&_.append(".");var z=Math.trunc(a._hi);if(z<0)break;var J=!1,Q=0;z>9?(J=!0,Q="9"):Q="0"+z,_.append(Q),a=a.subtract(o.valueOf(z)).multiply(o.TEN),J&&a.selfAdd(o.TEN);var le=!0,de=o.magnitude(a._hi);if(de<0&&Math.abs(de)>=x-I&&(le=!1),!le)break}return r[0]=l,_.toString()}},{key:"sqr",value:function(){return this.multiply(this)}},{key:"doubleValue",value:function(){return this._hi+this._lo}},{key:"subtract",value:function(){if(arguments[0]instanceof o){var n=arguments[0];return this.add(n.negate())}if(typeof arguments[0]=="number"){var r=arguments[0];return this.add(-r)}}},{key:"equals",value:function(){if(arguments.length===1&&arguments[0]instanceof o){var n=arguments[0];return this._hi===n._hi&&this._lo===n._lo}}},{key:"isZero",value:function(){return this._hi===0&&this._lo===0}},{key:"selfSubtract",value:function(){if(arguments[0]instanceof o){var n=arguments[0];return this.isNaN()?this:this.selfAdd(-n._hi,-n._lo)}if(typeof arguments[0]=="number"){var r=arguments[0];return this.isNaN()?this:this.selfAdd(-r,0)}}},{key:"getSpecialNumberString",value:function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null}},{key:"min",value:function(n){return this.le(n)?this:n}},{key:"selfDivide",value:function(){if(arguments.length===1){if(arguments[0]instanceof o){var n=arguments[0];return this.selfDivide(n._hi,n._lo)}if(typeof arguments[0]=="number"){var r=arguments[0];return this.selfDivide(r,0)}}else if(arguments.length===2){var a,l,g,p,_=arguments[0],x=arguments[1],I=null,z=null,J=null,Q=null;return g=this._hi/_,Q=(I=(J=o.SPLIT*g)-(I=J-g))*(z=(Q=o.SPLIT*_)-(z=Q-_))-(p=g*_)+I*(l=_-z)+(a=g-I)*z+a*l,Q=g+(J=(this._hi-p-Q+this._lo-g*x)/_),this._hi=Q,this._lo=g-Q+J,this}}},{key:"dump",value:function(){return"DD<"+this._hi+", "+this._lo+">"}},{key:"divide",value:function(){if(arguments[0]instanceof o){var n,r,a,l,g=arguments[0],p=null,_=null,x=null,I=null;return n=(a=this._hi/g._hi)-(p=(x=o.SPLIT*a)-(p=x-a)),I=p*(_=(I=o.SPLIT*g._hi)-(_=I-g._hi))-(l=a*g._hi)+p*(r=g._hi-_)+n*_+n*r,new o(I=a+(x=(this._hi-l-I+this._lo-a*g._lo)/g._hi),a-I+x)}if(typeof arguments[0]=="number"){var z=arguments[0];return K.isNaN(z)?o.createNaN():o.copy(this).selfDivide(z,0)}}},{key:"ge",value:function(n){return this._hi>n._hi||this._hi===n._hi&&this._lo>=n._lo}},{key:"pow",value:function(n){if(n===0)return o.valueOf(1);var r=new o(this),a=o.valueOf(1),l=Math.abs(n);if(l>1)for(;l>0;)l%2==1&&a.selfMultiply(r),(l/=2)>0&&(r=r.sqr());else a=r;return n<0?a.reciprocal():a}},{key:"ceil",value:function(){if(this.isNaN())return o.NaN;var n=Math.ceil(this._hi),r=0;return n===this._hi&&(r=Math.ceil(this._lo)),new o(n,r)}},{key:"compareTo",value:function(n){var r=n;return this._hi<r._hi?-1:this._hi>r._hi?1:this._lo<r._lo?-1:this._lo>r._lo?1:0}},{key:"rint",value:function(){return this.isNaN()?this:this.add(.5).floor()}},{key:"setValue",value:function(){if(arguments[0]instanceof o){var n=arguments[0];return this.init(n),this}if(typeof arguments[0]=="number"){var r=arguments[0];return this.init(r),this}}},{key:"max",value:function(n){return this.ge(n)?this:n}},{key:"sqrt",value:function(){if(this.isZero())return o.valueOf(0);if(this.isNegative())return o.NaN;var n=1/Math.sqrt(this._hi),r=this._hi*n,a=o.valueOf(r),l=this.subtract(a.sqr())._hi*(.5*n);return a.add(l)}},{key:"selfAdd",value:function(){if(arguments.length===1){if(arguments[0]instanceof o){var n=arguments[0];return this.selfAdd(n._hi,n._lo)}if(typeof arguments[0]=="number"){var r,a,l,g,p,_=arguments[0],x=null;return x=(l=this._hi+_)-(g=l-this._hi),a=(p=(x=_-g+(this._hi-x))+this._lo)+(l-(r=l+p)),this._hi=r+a,this._lo=a+(r-this._hi),this}}else if(arguments.length===2){var I,z,J,Q,le=arguments[0],de=arguments[1],me=null,Pe=null,Le=null;J=this._hi+le,z=this._lo+de,Pe=J-(Le=J-this._hi),me=z-(Q=z-this._lo);var Fe=(I=J+(Le=(Pe=le-Le+(this._hi-Pe))+z))+(Le=(me=de-Q+(this._lo-me))+(Le+(J-I))),ct=Le+(I-Fe);return this._hi=Fe,this._lo=ct,this}}},{key:"selfMultiply",value:function(){if(arguments.length===1){if(arguments[0]instanceof o){var n=arguments[0];return this.selfMultiply(n._hi,n._lo)}if(typeof arguments[0]=="number"){var r=arguments[0];return this.selfMultiply(r,0)}}else if(arguments.length===2){var a,l,g=arguments[0],p=arguments[1],_=null,x=null,I=null,z=null;_=(I=o.SPLIT*this._hi)-this._hi,z=o.SPLIT*g,_=I-_,a=this._hi-_,x=z-g;var J=(I=this._hi*g)+(z=_*(x=z-x)-I+_*(l=g-x)+a*x+a*l+(this._hi*p+this._lo*g)),Q=z+(_=I-J);return this._hi=J,this._lo=Q,this}}},{key:"selfSqr",value:function(){return this.selfMultiply(this)}},{key:"floor",value:function(){if(this.isNaN())return o.NaN;var n=Math.floor(this._hi),r=0;return n===this._hi&&(r=Math.floor(this._lo)),new o(n,r)}},{key:"negate",value:function(){return this.isNaN()?this:new o(-this._hi,-this._lo)}},{key:"clone",value:function(){try{return null}catch(n){if(n instanceof CloneNotSupportedException)return null;throw n}}},{key:"multiply",value:function(){if(arguments[0]instanceof o){var n=arguments[0];return n.isNaN()?o.createNaN():o.copy(this).selfMultiply(n)}if(typeof arguments[0]=="number"){var r=arguments[0];return K.isNaN(r)?o.createNaN():o.copy(this).selfMultiply(r,0)}}},{key:"isNaN",value:function(){return K.isNaN(this._hi)}},{key:"intValue",value:function(){return Math.trunc(this._hi)}},{key:"toString",value:function(){var n=o.magnitude(this._hi);return n>=-3&&n<=20?this.toStandardNotation():this.toSciNotation()}},{key:"toStandardNotation",value:function(){var n=this.getSpecialNumberString();if(n!==null)return n;var r=new Array(1).fill(null),a=this.extractSignificantDigits(!0,r),l=r[0]+1,g=a;if(a.charAt(0)===".")g="0"+a;else if(l<0)g="0."+o.stringOfChar("0",-l)+a;else if(a.indexOf(".")===-1){var p=l-a.length;g=a+o.stringOfChar("0",p)+".0"}return this.isNegative()?"-"+g:g}},{key:"reciprocal",value:function(){var n,r,a,l,g=null,p=null,_=null,x=null;n=(a=1/this._hi)-(g=(_=o.SPLIT*a)-(g=_-a)),p=(x=o.SPLIT*this._hi)-this._hi;var I=a+(_=(1-(l=a*this._hi)-(x=g*(p=x-p)-l+g*(r=this._hi-p)+n*p+n*r)-a*this._lo)/this._hi);return new o(I,a-I+_)}},{key:"toSciNotation",value:function(){if(this.isZero())return o.SCI_NOT_ZERO;var n=this.getSpecialNumberString();if(n!==null)return n;var r=new Array(1).fill(null),a=this.extractSignificantDigits(!1,r),l=o.SCI_NOT_EXPONENT_CHAR+r[0];if(a.charAt(0)==="0")throw new IllegalStateException("Found leading zero: "+a);var g="";a.length>1&&(g=a.substring(1));var p=a.charAt(0)+"."+g;return this.isNegative()?"-"+p+l:p+l}},{key:"abs",value:function(){return this.isNaN()?o.NaN:this.isNegative()?this.negate():new o(this)}},{key:"isPositive",value:function(){return this._hi>0||this._hi===0&&this._lo>0}},{key:"lt",value:function(n){return this._hi<n._hi||this._hi===n._hi&&this._lo<n._lo}},{key:"add",value:function(){if(arguments[0]instanceof o){var n=arguments[0];return o.copy(this).selfAdd(n)}if(typeof arguments[0]=="number"){var r=arguments[0];return o.copy(this).selfAdd(r)}}},{key:"init",value:function(){if(arguments.length===1){if(typeof arguments[0]=="number"){var n=arguments[0];this._hi=n,this._lo=0}else if(arguments[0]instanceof o){var r=arguments[0];this._hi=r._hi,this._lo=r._lo}}else if(arguments.length===2){var a=arguments[0],l=arguments[1];this._hi=a,this._lo=l}}},{key:"gt",value:function(n){return this._hi>n._hi||this._hi===n._hi&&this._lo>n._lo}},{key:"isNegative",value:function(){return this._hi<0||this._hi===0&&this._lo<0}},{key:"trunc",value:function(){return this.isNaN()?o.NaN:this.isPositive()?this.floor():this.ceil()}},{key:"signum",value:function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0}},{key:"interfaces_",get:function(){return[E,$,w]}}],[{key:"constructor_",value:function(){if(this._hi=0,this._lo=0,arguments.length===0)this.init(0);else if(arguments.length===1){if(typeof arguments[0]=="number"){var n=arguments[0];this.init(n)}else if(arguments[0]instanceof o){var r=arguments[0];this.init(r)}else if(typeof arguments[0]=="string"){var a=arguments[0];o.constructor_.call(this,o.parse(a))}}else if(arguments.length===2){var l=arguments[0],g=arguments[1];this.init(l,g)}}},{key:"determinant",value:function(){if(typeof arguments[3]=="number"&&typeof arguments[2]=="number"&&typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var n=arguments[0],r=arguments[1],a=arguments[2],l=arguments[3];return o.determinant(o.valueOf(n),o.valueOf(r),o.valueOf(a),o.valueOf(l))}if(arguments[3]instanceof o&&arguments[2]instanceof o&&arguments[0]instanceof o&&arguments[1]instanceof o){var g=arguments[1],p=arguments[2],_=arguments[3];return arguments[0].multiply(_).selfSubtract(g.multiply(p))}}},{key:"sqr",value:function(n){return o.valueOf(n).selfMultiply(n)}},{key:"valueOf",value:function(){if(typeof arguments[0]=="string"){var n=arguments[0];return o.parse(n)}if(typeof arguments[0]=="number")return new o(arguments[0])}},{key:"sqrt",value:function(n){return o.valueOf(n).sqrt()}},{key:"parse",value:function(n){for(var r=0,a=n.length;In.isWhitespace(n.charAt(r));)r++;var l=!1;if(r<a){var g=n.charAt(r);g!=="-"&&g!=="+"||(r++,g==="-"&&(l=!0))}for(var p=new o,_=0,x=0,I=0,z=!1;!(r>=a);){var J=n.charAt(r);if(r++,In.isDigit(J)){var Q=J-"0";p.selfMultiply(o.TEN),p.selfAdd(Q),_++}else{if(J!=="."){if(J==="e"||J==="E"){var le=n.substring(r);try{I=Sn.parseInt(le)}catch(Fe){throw Fe instanceof NumberFormatException?new NumberFormatException("Invalid exponent "+le+" in string "+n):Fe}break}throw new NumberFormatException("Unexpected character '"+J+"' at position "+r+" in string "+n)}x=_,z=!0}}var de=p;z||(x=_);var me=_-x-I;if(me===0)de=p;else if(me>0){var Pe=o.TEN.pow(me);de=p.divide(Pe)}else if(me<0){var Le=o.TEN.pow(-me);de=p.multiply(Le)}return l?de.negate():de}},{key:"createNaN",value:function(){return new o(K.NaN,K.NaN)}},{key:"copy",value:function(n){return new o(n)}},{key:"magnitude",value:function(n){var r=Math.abs(n),a=Math.log(r)/Math.log(10),l=Math.trunc(Math.floor(a));return 10*Math.pow(10,l)<=r&&(l+=1),l}},{key:"stringOfChar",value:function(n,r){for(var a=new Vn,l=0;l<r;l++)a.append(n);return a.toString()}}])})();ge.PI=new ge(3.141592653589793,12246467991473532e-32),ge.TWO_PI=new ge(6.283185307179586,24492935982947064e-32),ge.PI_2=new ge(1.5707963267948966,6123233995736766e-32),ge.E=new ge(2.718281828459045,14456468917292502e-32),ge.NaN=new ge(K.NaN,K.NaN),ge.EPS=123259516440783e-46,ge.SPLIT=134217729,ge.MAX_PRINT_DIGITS=32,ge.TEN=ge.valueOf(10),ge.ONE=ge.valueOf(1),ge.SCI_NOT_EXPONENT_CHAR="E",ge.SCI_NOT_ZERO="0.0E0";var Cr=(function(){function o(){u(this,o)}return h(o,null,[{key:"orientationIndex",value:function(n,r,a){var l=o.orientationIndexFilter(n,r,a);if(l<=1)return l;var g=ge.valueOf(r.x).selfAdd(-n.x),p=ge.valueOf(r.y).selfAdd(-n.y),_=ge.valueOf(a.x).selfAdd(-r.x),x=ge.valueOf(a.y).selfAdd(-r.y);return g.selfMultiply(x).selfSubtract(p.selfMultiply(_)).signum()}},{key:"signOfDet2x2",value:function(){if(arguments[3]instanceof ge&&arguments[2]instanceof ge&&arguments[0]instanceof ge&&arguments[1]instanceof ge){var n=arguments[1],r=arguments[2],a=arguments[3];return arguments[0].multiply(a).selfSubtract(n.multiply(r)).signum()}if(typeof arguments[3]=="number"&&typeof arguments[2]=="number"&&typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var l=arguments[0],g=arguments[1],p=arguments[2],_=arguments[3],x=ge.valueOf(l),I=ge.valueOf(g),z=ge.valueOf(p),J=ge.valueOf(_);return x.multiply(J).selfSubtract(I.multiply(z)).signum()}}},{key:"intersection",value:function(n,r,a,l){var g=new ge(n.y).selfSubtract(r.y),p=new ge(r.x).selfSubtract(n.x),_=new ge(n.x).selfMultiply(r.y).selfSubtract(new ge(r.x).selfMultiply(n.y)),x=new ge(a.y).selfSubtract(l.y),I=new ge(l.x).selfSubtract(a.x),z=new ge(a.x).selfMultiply(l.y).selfSubtract(new ge(l.x).selfMultiply(a.y)),J=p.multiply(z).selfSubtract(I.multiply(_)),Q=x.multiply(_).selfSubtract(g.multiply(z)),le=g.multiply(I).selfSubtract(x.multiply(p)),de=J.selfDivide(le).doubleValue(),me=Q.selfDivide(le).doubleValue();return K.isNaN(de)||K.isInfinite(de)||K.isNaN(me)||K.isInfinite(me)?null:new Y(de,me)}},{key:"orientationIndexFilter",value:function(n,r,a){var l=null,g=(n.x-a.x)*(r.y-a.y),p=(n.y-a.y)*(r.x-a.x),_=g-p;if(g>0){if(p<=0)return o.signum(_);l=g+p}else{if(!(g<0)||p>=0)return o.signum(_);l=-g-p}var x=o.DP_SAFE_EPSILON*l;return _>=x||-_>=x?o.signum(_):2}},{key:"signum",value:function(n){return n>0?1:n<0?-1:0}}])})();Cr.DP_SAFE_EPSILON=1e-15;var Ee=(function(){return h((function o(){u(this,o)}),[{key:"getM",value:function(o){if(this.hasM()){var n=this.getDimension()-this.getMeasures();return this.getOrdinate(o,n)}return K.NaN}},{key:"setOrdinate",value:function(o,n,r){}},{key:"getZ",value:function(o){return this.hasZ()?this.getOrdinate(o,2):K.NaN}},{key:"size",value:function(){}},{key:"getOrdinate",value:function(o,n){}},{key:"getCoordinate",value:function(){}},{key:"getCoordinateCopy",value:function(o){}},{key:"createCoordinate",value:function(){}},{key:"getDimension",value:function(){}},{key:"hasM",value:function(){return this.getMeasures()>0}},{key:"getX",value:function(o){}},{key:"hasZ",value:function(){return this.getDimension()-this.getMeasures()>2}},{key:"getMeasures",value:function(){return 0}},{key:"expandEnvelope",value:function(o){}},{key:"copy",value:function(){}},{key:"getY",value:function(o){}},{key:"toCoordinateArray",value:function(){}},{key:"interfaces_",get:function(){return[w]}}])})();Ee.X=0,Ee.Y=1,Ee.Z=2,Ee.M=3;var ve=(function(){function o(){u(this,o)}return h(o,null,[{key:"index",value:function(n,r,a){return Cr.orientationIndex(n,r,a)}},{key:"isCCW",value:function(){if(arguments[0]instanceof Array){var n=arguments[0],r=n.length-1;if(r<3)throw new X("Ring has fewer than 4 points, so orientation cannot be determined");for(var a=n[0],l=0,g=1;g<=r;g++){var p=n[g];p.y>a.y&&(a=p,l=g)}var _=l;do(_-=1)<0&&(_=r);while(n[_].equals2D(a)&&_!==l);var x=l;do x=(x+1)%r;while(n[x].equals2D(a)&&x!==l);var I=n[_],z=n[x];if(I.equals2D(a)||z.equals2D(a)||I.equals2D(z))return!1;var J=o.index(I,a,z);return J===0?I.x>z.x:J>0}if(_e(arguments[0],Ee)){var Q=arguments[0],le=Q.size()-1;if(le<3)throw new X("Ring has fewer than 4 points, so orientation cannot be determined");for(var de=Q.getCoordinate(0),me=0,Pe=1;Pe<=le;Pe++){var Le=Q.getCoordinate(Pe);Le.y>de.y&&(de=Le,me=Pe)}var Fe=null,ct=me;do(ct-=1)<0&&(ct=le),Fe=Q.getCoordinate(ct);while(Fe.equals2D(de)&&ct!==me);var dt=null,Br=me;do Br=(Br+1)%le,dt=Q.getCoordinate(Br);while(dt.equals2D(de)&&Br!==me);if(Fe.equals2D(de)||dt.equals2D(de)||Fe.equals2D(dt))return!1;var us=o.index(Fe,de,dt);return us===0?Fe.x>dt.x:us>0}}}])})();ve.CLOCKWISE=-1,ve.RIGHT=ve.CLOCKWISE,ve.COUNTERCLOCKWISE=1,ve.LEFT=ve.COUNTERCLOCKWISE,ve.COLLINEAR=0,ve.STRAIGHT=ve.COLLINEAR;var ts=(function(){return h((function o(){u(this,o),o.constructor_.apply(this,arguments)}),[{key:"getCoordinate",value:function(){return this._minCoord}},{key:"getRightmostSide",value:function(o,n){var r=this.getRightmostSideOfSegment(o,n);return r<0&&(r=this.getRightmostSideOfSegment(o,n-1)),r<0&&(this._minCoord=null,this.checkForRightmostCoordinate(o)),r}},{key:"findRightmostEdgeAtVertex",value:function(){var o=this._minDe.getEdge().getCoordinates();re.isTrue(this._minIndex>0&&this._minIndex<o.length,"rightmost point expected to be interior vertex of edge");var n=o[this._minIndex-1],r=o[this._minIndex+1],a=ve.index(this._minCoord,r,n),l=!1;(n.y<this._minCoord.y&&r.y<this._minCoord.y&&a===ve.COUNTERCLOCKWISE||n.y>this._minCoord.y&&r.y>this._minCoord.y&&a===ve.CLOCKWISE)&&(l=!0),l&&(this._minIndex=this._minIndex-1)}},{key:"getRightmostSideOfSegment",value:function(o,n){var r=o.getEdge().getCoordinates();if(n<0||n+1>=r.length||r[n].y===r[n+1].y)return-1;var a=ne.LEFT;return r[n].y<r[n+1].y&&(a=ne.RIGHT),a}},{key:"getEdge",value:function(){return this._orientedDe}},{key:"checkForRightmostCoordinate",value:function(o){for(var n=o.getEdge().getCoordinates(),r=0;r<n.length-1;r++)(this._minCoord===null||n[r].x>this._minCoord.x)&&(this._minDe=o,this._minIndex=r,this._minCoord=n[r])}},{key:"findRightmostEdgeAtNode",value:function(){var o=this._minDe.getNode().getEdges();this._minDe=o.getRightmostEdge(),this._minDe.isForward()||(this._minDe=this._minDe.getSym(),this._minIndex=this._minDe.getEdge().getCoordinates().length-1)}},{key:"findEdge",value:function(o){for(var n=o.iterator();n.hasNext();){var r=n.next();r.isForward()&&this.checkForRightmostCoordinate(r)}re.isTrue(this._minIndex!==0||this._minCoord.equals(this._minDe.getCoordinate()),"inconsistency in rightmost processing"),this._minIndex===0?this.findRightmostEdgeAtNode():this.findRightmostEdgeAtVertex(),this._orientedDe=this._minDe,this.getRightmostSide(this._minDe,this._minIndex)===ne.LEFT&&(this._orientedDe=this._minDe.getSym())}}],[{key:"constructor_",value:function(){this._minIndex=-1,this._minCoord=null,this._minDe=null,this._orientedDe=null}}])})(),Ut=(function(o){function n(r,a){var l;return u(this,n),(l=s(this,n,[a?r+" [ "+a+" ]":r])).pt=a?new Y(a):void 0,l.name=Object.keys({TopologyException:n})[0],l}return y(n,o),h(n,[{key:"getCoordinate",value:function(){return this.pt}}])})(ae),oi=(function(){return h((function o(){u(this,o),this.array=[]}),[{key:"addLast",value:function(o){this.array.push(o)}},{key:"removeFirst",value:function(){return this.array.shift()}},{key:"isEmpty",value:function(){return this.array.length===0}}])})(),pe=(function(o){function n(r){var a;return u(this,n),(a=s(this,n)).array=[],r instanceof $e&&a.addAll(r),a}return y(n,o),h(n,[{key:"interfaces_",get:function(){return[bn,$e]}},{key:"ensureCapacity",value:function(){}},{key:"add",value:function(r){return arguments.length===1?this.array.push(r):this.array.splice(arguments[0],0,arguments[1]),!0}},{key:"clear",value:function(){this.array=[]}},{key:"addAll",value:function(r){var a,l=d(r);try{for(l.s();!(a=l.n()).done;){var g=a.value;this.array.push(g)}}catch(p){l.e(p)}finally{l.f()}}},{key:"set",value:function(r,a){var l=this.array[r];return this.array[r]=a,l}},{key:"iterator",value:function(){return new hn(this)}},{key:"get",value:function(r){if(r<0||r>=this.size())throw new Lr;return this.array[r]}},{key:"isEmpty",value:function(){return this.array.length===0}},{key:"sort",value:function(r){r?this.array.sort((function(a,l){return r.compare(a,l)})):this.array.sort()}},{key:"size",value:function(){return this.array.length}},{key:"toArray",value:function(){return this.array.slice()}},{key:"remove",value:function(r){for(var a=0,l=this.array.length;a<l;a++)if(this.array[a]===r)return!!this.array.splice(a,1);return!1}},{key:Symbol.iterator,value:function(){return this.array.values()}}])})(bn),hn=(function(){return h((function o(n){u(this,o),this.arrayList=n,this.position=0}),[{key:"next",value:function(){if(this.position===this.arrayList.size())throw new Be;return this.arrayList.get(this.position++)}},{key:"hasNext",value:function(){return this.position<this.arrayList.size()}},{key:"set",value:function(o){return this.arrayList.set(this.position-1,o)}},{key:"remove",value:function(){this.arrayList.remove(this.arrayList.get(this.position))}}])})(),cr=(function(){return h((function o(){u(this,o),o.constructor_.apply(this,arguments)}),[{key:"clearVisitedEdges",value:function(){for(var o=this._dirEdgeList.iterator();o.hasNext();)o.next().setVisited(!1)}},{key:"getRightmostCoordinate",value:function(){return this._rightMostCoord}},{key:"computeNodeDepth",value:function(o){for(var n=null,r=o.getEdges().iterator();r.hasNext();){var a=r.next();if(a.isVisited()||a.getSym().isVisited()){n=a;break}}if(n===null)throw new Ut("unable to find edge to compute depths at "+o.getCoordinate());o.getEdges().computeDepths(n);for(var l=o.getEdges().iterator();l.hasNext();){var g=l.next();g.setVisited(!0),this.copySymDepths(g)}}},{key:"computeDepth",value:function(o){this.clearVisitedEdges();var n=this._finder.getEdge();n.getNode(),n.getLabel(),n.setEdgeDepths(ne.RIGHT,o),this.copySymDepths(n),this.computeDepths(n)}},{key:"create",value:function(o){this.addReachable(o),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()}},{key:"findResultEdges",value:function(){for(var o=this._dirEdgeList.iterator();o.hasNext();){var n=o.next();n.getDepth(ne.RIGHT)>=1&&n.getDepth(ne.LEFT)<=0&&!n.isInteriorAreaEdge()&&n.setInResult(!0)}}},{key:"computeDepths",value:function(o){var n=new Mr,r=new oi,a=o.getNode();for(r.addLast(a),n.add(a),o.setVisited(!0);!r.isEmpty();){var l=r.removeFirst();n.add(l),this.computeNodeDepth(l);for(var g=l.getEdges().iterator();g.hasNext();){var p=g.next().getSym();if(!p.isVisited()){var _=p.getNode();n.contains(_)||(r.addLast(_),n.add(_))}}}}},{key:"compareTo",value:function(o){var n=o;return this._rightMostCoord.x<n._rightMostCoord.x?-1:this._rightMostCoord.x>n._rightMostCoord.x?1:0}},{key:"getEnvelope",value:function(){if(this._env===null){for(var o=new be,n=this._dirEdgeList.iterator();n.hasNext();)for(var r=n.next().getEdge().getCoordinates(),a=0;a<r.length-1;a++)o.expandToInclude(r[a]);this._env=o}return this._env}},{key:"addReachable",value:function(o){var n=new ua;for(n.add(o);!n.empty();){var r=n.pop();this.add(r,n)}}},{key:"copySymDepths",value:function(o){var n=o.getSym();n.setDepth(ne.LEFT,o.getDepth(ne.RIGHT)),n.setDepth(ne.RIGHT,o.getDepth(ne.LEFT))}},{key:"add",value:function(o,n){o.setVisited(!0),this._nodes.add(o);for(var r=o.getEdges().iterator();r.hasNext();){var a=r.next();this._dirEdgeList.add(a);var l=a.getSym().getNode();l.isVisited()||n.push(l)}}},{key:"getNodes",value:function(){return this._nodes}},{key:"getDirectedEdges",value:function(){return this._dirEdgeList}},{key:"interfaces_",get:function(){return[$]}}],[{key:"constructor_",value:function(){this._finder=null,this._dirEdgeList=new pe,this._nodes=new pe,this._rightMostCoord=null,this._env=null,this._finder=new ts}}])})(),Ar=(function(){return h((function o(){u(this,o)}),null,[{key:"intersection",value:function(o,n,r,a){var l=o.x<n.x?o.x:n.x,g=o.y<n.y?o.y:n.y,p=o.x>n.x?o.x:n.x,_=o.y>n.y?o.y:n.y,x=r.x<a.x?r.x:a.x,I=r.y<a.y?r.y:a.y,z=r.x>a.x?r.x:a.x,J=r.y>a.y?r.y:a.y,Q=((l>x?l:x)+(p<z?p:z))/2,le=((g>I?g:I)+(_<J?_:J))/2,de=o.x-Q,me=o.y-le,Pe=n.x-Q,Le=n.y-le,Fe=r.x-Q,ct=r.y-le,dt=a.x-Q,Br=a.y-le,us=me-Le,Ac=Pe-de,Tc=de*Le-Pe*me,Pc=ct-Br,Oc=dt-Fe,Rc=Fe*Br-dt*ct,Dc=us*Oc-Pc*Ac,Go=(Ac*Rc-Oc*Tc)/Dc,Bo=(Pc*Tc-us*Rc)/Dc;return K.isNaN(Go)||K.isInfinite(Go)||K.isNaN(Bo)||K.isInfinite(Bo)?null:new Y(Go+Q,Bo+le)}}])})(),gt=(function(){return h((function o(){u(this,o)}),null,[{key:"arraycopy",value:function(o,n,r,a,l){for(var g=0,p=n;p<n+l;p++)r[a+g]=o[p],g++}},{key:"getProperty",value:function(o){return{"line.separator":`
|
|
209
|
+
`}[o]}}])})(),Tr=(function(){function o(){u(this,o)}return h(o,null,[{key:"log10",value:function(n){var r=Math.log(n);return K.isInfinite(r)||K.isNaN(r)?r:r/o.LOG_10}},{key:"min",value:function(n,r,a,l){var g=n;return r<g&&(g=r),a<g&&(g=a),l<g&&(g=l),g}},{key:"clamp",value:function(){if(typeof arguments[2]=="number"&&typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var n=arguments[0],r=arguments[1],a=arguments[2];return n<r?r:n>a?a:n}if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var l=arguments[0],g=arguments[1],p=arguments[2];return l<g?g:l>p?p:l}}},{key:"wrap",value:function(n,r){return n<0?r- -n%r:n%r}},{key:"max",value:function(){if(arguments.length===3){var n=arguments[1],r=arguments[2],a=arguments[0];return n>a&&(a=n),r>a&&(a=r),a}if(arguments.length===4){var l=arguments[1],g=arguments[2],p=arguments[3],_=arguments[0];return l>_&&(_=l),g>_&&(_=g),p>_&&(_=p),_}}},{key:"average",value:function(n,r){return(n+r)/2}}])})();Tr.LOG_10=Math.log(10);var vt=(function(){function o(){u(this,o)}return h(o,null,[{key:"segmentToSegment",value:function(n,r,a,l){if(n.equals(r))return o.pointToSegment(n,a,l);if(a.equals(l))return o.pointToSegment(l,n,r);var g=!1;if(be.intersects(n,r,a,l)){var p=(r.x-n.x)*(l.y-a.y)-(r.y-n.y)*(l.x-a.x);if(p===0)g=!0;else{var _=(n.y-a.y)*(l.x-a.x)-(n.x-a.x)*(l.y-a.y),x=((n.y-a.y)*(r.x-n.x)-(n.x-a.x)*(r.y-n.y))/p,I=_/p;(I<0||I>1||x<0||x>1)&&(g=!0)}}else g=!0;return g?Tr.min(o.pointToSegment(n,a,l),o.pointToSegment(r,a,l),o.pointToSegment(a,n,r),o.pointToSegment(l,n,r)):0}},{key:"pointToSegment",value:function(n,r,a){if(r.x===a.x&&r.y===a.y)return n.distance(r);var l=(a.x-r.x)*(a.x-r.x)+(a.y-r.y)*(a.y-r.y),g=((n.x-r.x)*(a.x-r.x)+(n.y-r.y)*(a.y-r.y))/l;if(g<=0)return n.distance(r);if(g>=1)return n.distance(a);var p=((r.y-n.y)*(a.x-r.x)-(r.x-n.x)*(a.y-r.y))/l;return Math.abs(p)*Math.sqrt(l)}},{key:"pointToLinePerpendicular",value:function(n,r,a){var l=(a.x-r.x)*(a.x-r.x)+(a.y-r.y)*(a.y-r.y),g=((r.y-n.y)*(a.x-r.x)-(r.x-n.x)*(a.y-r.y))/l;return Math.abs(g)*Math.sqrt(l)}},{key:"pointToSegmentString",value:function(n,r){if(r.length===0)throw new X("Line array must contain at least one vertex");for(var a=n.distance(r[0]),l=0;l<r.length-1;l++){var g=o.pointToSegment(n,r[l],r[l+1]);g<a&&(a=g)}return a}}])})(),Pr=(function(){return h((function o(){u(this,o)}),[{key:"create",value:function(){if(arguments.length===1)arguments[0]instanceof Array||_e(arguments[0],Ee);else if(arguments.length!==2&&arguments.length===3){var o=arguments[0],n=arguments[1];return this.create(o,n)}}}])})(),ui=(function(){return h((function o(){u(this,o)}),[{key:"filter",value:function(o){}}])})(),Or=(function(){return h((function o(){u(this,o)}),null,[{key:"ofLine",value:function(o){var n=o.size();if(n<=1)return 0;var r=0,a=new Y;o.getCoordinate(0,a);for(var l=a.x,g=a.y,p=1;p<n;p++){o.getCoordinate(p,a);var _=a.x,x=a.y,I=_-l,z=x-g;r+=Math.sqrt(I*I+z*z),l=_,g=x}return r}}])})(),la=h((function o(){u(this,o)})),Xn=(function(){function o(){u(this,o)}return h(o,null,[{key:"copyCoord",value:function(n,r,a,l){for(var g=Math.min(n.getDimension(),a.getDimension()),p=0;p<g;p++)a.setOrdinate(l,p,n.getOrdinate(r,p))}},{key:"isRing",value:function(n){var r=n.size();return r===0||!(r<=3)&&n.getOrdinate(0,Ee.X)===n.getOrdinate(r-1,Ee.X)&&n.getOrdinate(0,Ee.Y)===n.getOrdinate(r-1,Ee.Y)}},{key:"scroll",value:function(){if(arguments.length===2){if(_e(arguments[0],Ee)&&Number.isInteger(arguments[1])){var n=arguments[0],r=arguments[1];o.scroll(n,r,o.isRing(n))}else if(_e(arguments[0],Ee)&&arguments[1]instanceof Y){var a=arguments[0],l=arguments[1],g=o.indexOf(l,a);if(g<=0)return null;o.scroll(a,g)}}else if(arguments.length===3){var p=arguments[0],_=arguments[1],x=arguments[2];if(_<=0)return null;for(var I=p.copy(),z=x?p.size()-1:p.size(),J=0;J<z;J++)for(var Q=0;Q<p.getDimension();Q++)p.setOrdinate(J,Q,I.getOrdinate((_+J)%z,Q));if(x)for(var le=0;le<p.getDimension();le++)p.setOrdinate(z,le,p.getOrdinate(0,le))}}},{key:"isEqual",value:function(n,r){var a=n.size();if(a!==r.size())return!1;for(var l=Math.min(n.getDimension(),r.getDimension()),g=0;g<a;g++)for(var p=0;p<l;p++){var _=n.getOrdinate(g,p),x=r.getOrdinate(g,p);if(n.getOrdinate(g,p)!==r.getOrdinate(g,p)&&(!K.isNaN(_)||!K.isNaN(x)))return!1}return!0}},{key:"minCoordinateIndex",value:function(){if(arguments.length===1){var n=arguments[0];return o.minCoordinateIndex(n,0,n.size()-1)}if(arguments.length===3){for(var r=arguments[0],a=arguments[2],l=-1,g=null,p=arguments[1];p<=a;p++){var _=r.getCoordinate(p);(g===null||g.compareTo(_)>0)&&(g=_,l=p)}return l}}},{key:"extend",value:function(n,r,a){var l=n.create(a,r.getDimension()),g=r.size();if(o.copy(r,0,l,0,g),g>0)for(var p=g;p<a;p++)o.copy(r,g-1,l,p,1);return l}},{key:"reverse",value:function(n){for(var r=n.size()-1,a=Math.trunc(r/2),l=0;l<=a;l++)o.swap(n,l,r-l)}},{key:"swap",value:function(n,r,a){if(r===a)return null;for(var l=0;l<n.getDimension();l++){var g=n.getOrdinate(r,l);n.setOrdinate(r,l,n.getOrdinate(a,l)),n.setOrdinate(a,l,g)}}},{key:"copy",value:function(n,r,a,l,g){for(var p=0;p<g;p++)o.copyCoord(n,r+p,a,l+p)}},{key:"ensureValidRing",value:function(n,r){var a=r.size();return a===0?r:a<=3?o.createClosedRing(n,r,4):r.getOrdinate(0,Ee.X)===r.getOrdinate(a-1,Ee.X)&&r.getOrdinate(0,Ee.Y)===r.getOrdinate(a-1,Ee.Y)?r:o.createClosedRing(n,r,a+1)}},{key:"indexOf",value:function(n,r){for(var a=0;a<r.size();a++)if(n.x===r.getOrdinate(a,Ee.X)&&n.y===r.getOrdinate(a,Ee.Y))return a;return-1}},{key:"createClosedRing",value:function(n,r,a){var l=n.create(a,r.getDimension()),g=r.size();o.copy(r,0,l,0,g);for(var p=g;p<a;p++)o.copy(r,0,l,p,1);return l}},{key:"minCoordinate",value:function(n){for(var r=null,a=0;a<n.size();a++){var l=n.getCoordinate(a);(r===null||r.compareTo(l)>0)&&(r=l)}return r}}])})(),te=(function(){function o(){u(this,o)}return h(o,null,[{key:"toDimensionSymbol",value:function(n){switch(n){case o.FALSE:return o.SYM_FALSE;case o.TRUE:return o.SYM_TRUE;case o.DONTCARE:return o.SYM_DONTCARE;case o.P:return o.SYM_P;case o.L:return o.SYM_L;case o.A:return o.SYM_A}throw new X("Unknown dimension value: "+n)}},{key:"toDimensionValue",value:function(n){switch(In.toUpperCase(n)){case o.SYM_FALSE:return o.FALSE;case o.SYM_TRUE:return o.TRUE;case o.SYM_DONTCARE:return o.DONTCARE;case o.SYM_P:return o.P;case o.SYM_L:return o.L;case o.SYM_A:return o.A}throw new X("Unknown dimension symbol: "+n)}}])})();te.P=0,te.L=1,te.A=2,te.FALSE=-1,te.TRUE=-2,te.DONTCARE=-3,te.SYM_FALSE="F",te.SYM_TRUE="T",te.SYM_DONTCARE="*",te.SYM_P="0",te.SYM_L="1",te.SYM_A="2";var fn=(function(){return h((function o(){u(this,o)}),[{key:"filter",value:function(o){}}])})(),li=(function(){return h((function o(){u(this,o)}),[{key:"filter",value:function(o,n){}},{key:"isDone",value:function(){}},{key:"isGeometryChanged",value:function(){}}])})(),hr=(function(o){function n(){var r;return u(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return y(n,o),h(n,[{key:"computeEnvelopeInternal",value:function(){return this.isEmpty()?new be:this._points.expandEnvelope(new be)}},{key:"isRing",value:function(){return this.isClosed()&&this.isSimple()}},{key:"getCoordinates",value:function(){return this._points.toCoordinateArray()}},{key:"copyInternal",value:function(){return new n(this._points.copy(),this._factory)}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof fe){var r=arguments[0],a=arguments[1];if(!this.isEquivalentClass(r))return!1;var l=r;if(this._points.size()!==l._points.size())return!1;for(var g=0;g<this._points.size();g++)if(!this.equal(this._points.getCoordinate(g),l._points.getCoordinate(g),a))return!1;return!0}return b(n,"equalsExact",this,1).apply(this,arguments)}},{key:"normalize",value:function(){for(var r=0;r<Math.trunc(this._points.size()/2);r++){var a=this._points.size()-1-r;if(!this._points.getCoordinate(r).equals(this._points.getCoordinate(a))){if(this._points.getCoordinate(r).compareTo(this._points.getCoordinate(a))>0){var l=this._points.copy();Xn.reverse(l),this._points=l}return null}}}},{key:"getCoordinate",value:function(){return this.isEmpty()?null:this._points.getCoordinate(0)}},{key:"getBoundaryDimension",value:function(){return this.isClosed()?te.FALSE:0}},{key:"isClosed",value:function(){return!this.isEmpty()&&this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints()-1))}},{key:"reverseInternal",value:function(){var r=this._points.copy();return Xn.reverse(r),this.getFactory().createLineString(r)}},{key:"getEndPoint",value:function(){return this.isEmpty()?null:this.getPointN(this.getNumPoints()-1)}},{key:"getTypeCode",value:function(){return fe.TYPECODE_LINESTRING}},{key:"getDimension",value:function(){return 1}},{key:"getLength",value:function(){return Or.ofLine(this._points)}},{key:"getNumPoints",value:function(){return this._points.size()}},{key:"compareToSameClass",value:function(){if(arguments.length===1){for(var r=arguments[0],a=0,l=0;a<this._points.size()&&l<r._points.size();){var g=this._points.getCoordinate(a).compareTo(r._points.getCoordinate(l));if(g!==0)return g;a++,l++}return a<this._points.size()?1:l<r._points.size()?-1:0}if(arguments.length===2){var p=arguments[0];return arguments[1].compare(this._points,p._points)}}},{key:"apply",value:function(){if(_e(arguments[0],ui))for(var r=arguments[0],a=0;a<this._points.size();a++)r.filter(this._points.getCoordinate(a));else if(_e(arguments[0],li)){var l=arguments[0];if(this._points.size()===0)return null;for(var g=0;g<this._points.size()&&(l.filter(this._points,g),!l.isDone());g++);l.isGeometryChanged()&&this.geometryChanged()}else _e(arguments[0],fn)?arguments[0].filter(this):_e(arguments[0],H)&&arguments[0].filter(this)}},{key:"getBoundary",value:function(){throw new Re}},{key:"isEquivalentClass",value:function(r){return r instanceof n}},{key:"getCoordinateN",value:function(r){return this._points.getCoordinate(r)}},{key:"getGeometryType",value:function(){return fe.TYPENAME_LINESTRING}},{key:"getCoordinateSequence",value:function(){return this._points}},{key:"isEmpty",value:function(){return this._points.size()===0}},{key:"init",value:function(r){if(r===null&&(r=this.getFactory().getCoordinateSequenceFactory().create([])),r.size()===1)throw new X("Invalid number of points in LineString (found "+r.size()+" - must be 0 or >= 2)");this._points=r}},{key:"isCoordinate",value:function(r){for(var a=0;a<this._points.size();a++)if(this._points.getCoordinate(a).equals(r))return!0;return!1}},{key:"getStartPoint",value:function(){return this.isEmpty()?null:this.getPointN(0)}},{key:"getPointN",value:function(r){return this.getFactory().createPoint(this._points.getCoordinate(r))}},{key:"interfaces_",get:function(){return[la]}}],[{key:"constructor_",value:function(){if(this._points=null,arguments.length!==0&&arguments.length===2){var r=arguments[0],a=arguments[1];fe.constructor_.call(this,a),this.init(r)}}}])})(fe),ci=h((function o(){u(this,o)})),hi=(function(o){function n(){var r;return u(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return y(n,o),h(n,[{key:"computeEnvelopeInternal",value:function(){if(this.isEmpty())return new be;var r=new be;return r.expandToInclude(this._coordinates.getX(0),this._coordinates.getY(0)),r}},{key:"getCoordinates",value:function(){return this.isEmpty()?[]:[this.getCoordinate()]}},{key:"copyInternal",value:function(){return new n(this._coordinates.copy(),this._factory)}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof fe){var r=arguments[0],a=arguments[1];return!!this.isEquivalentClass(r)&&(!(!this.isEmpty()||!r.isEmpty())||this.isEmpty()===r.isEmpty()&&this.equal(r.getCoordinate(),this.getCoordinate(),a))}return b(n,"equalsExact",this,1).apply(this,arguments)}},{key:"normalize",value:function(){}},{key:"getCoordinate",value:function(){return this._coordinates.size()!==0?this._coordinates.getCoordinate(0):null}},{key:"getBoundaryDimension",value:function(){return te.FALSE}},{key:"reverseInternal",value:function(){return this.getFactory().createPoint(this._coordinates.copy())}},{key:"getTypeCode",value:function(){return fe.TYPECODE_POINT}},{key:"getDimension",value:function(){return 0}},{key:"getNumPoints",value:function(){return this.isEmpty()?0:1}},{key:"getX",value:function(){if(this.getCoordinate()===null)throw new IllegalStateException("getX called on empty Point");return this.getCoordinate().x}},{key:"compareToSameClass",value:function(){if(arguments.length===1){var r=arguments[0];return this.getCoordinate().compareTo(r.getCoordinate())}if(arguments.length===2){var a=arguments[0];return arguments[1].compare(this._coordinates,a._coordinates)}}},{key:"apply",value:function(){if(_e(arguments[0],ui)){var r=arguments[0];if(this.isEmpty())return null;r.filter(this.getCoordinate())}else if(_e(arguments[0],li)){var a=arguments[0];if(this.isEmpty())return null;a.filter(this._coordinates,0),a.isGeometryChanged()&&this.geometryChanged()}else _e(arguments[0],fn)?arguments[0].filter(this):_e(arguments[0],H)&&arguments[0].filter(this)}},{key:"getBoundary",value:function(){return this.getFactory().createGeometryCollection()}},{key:"getGeometryType",value:function(){return fe.TYPENAME_POINT}},{key:"getCoordinateSequence",value:function(){return this._coordinates}},{key:"getY",value:function(){if(this.getCoordinate()===null)throw new IllegalStateException("getY called on empty Point");return this.getCoordinate().y}},{key:"isEmpty",value:function(){return this._coordinates.size()===0}},{key:"init",value:function(r){r===null&&(r=this.getFactory().getCoordinateSequenceFactory().create([])),re.isTrue(r.size()<=1),this._coordinates=r}},{key:"isSimple",value:function(){return!0}},{key:"interfaces_",get:function(){return[ci]}}],[{key:"constructor_",value:function(){this._coordinates=null;var r=arguments[0],a=arguments[1];fe.constructor_.call(this,a),this.init(r)}}])})(fe),ns=(function(){function o(){u(this,o)}return h(o,null,[{key:"ofRing",value:function(){if(arguments[0]instanceof Array){var n=arguments[0];return Math.abs(o.ofRingSigned(n))}if(_e(arguments[0],Ee)){var r=arguments[0];return Math.abs(o.ofRingSigned(r))}}},{key:"ofRingSigned",value:function(){if(arguments[0]instanceof Array){var n=arguments[0];if(n.length<3)return 0;for(var r=0,a=n[0].x,l=1;l<n.length-1;l++){var g=n[l].x-a,p=n[l+1].y;r+=g*(n[l-1].y-p)}return r/2}if(_e(arguments[0],Ee)){var _=arguments[0],x=_.size();if(x<3)return 0;var I=new Y,z=new Y,J=new Y;_.getCoordinate(0,z),_.getCoordinate(1,J);var Q=z.x;J.x-=Q;for(var le=0,de=1;de<x-1;de++)I.y=z.y,z.x=J.x,z.y=J.y,_.getCoordinate(de+1,J),J.x-=Q,le+=z.x*(I.y-J.y);return le/2}}}])})(),$n=(function(){return h((function o(){u(this,o)}),null,[{key:"sort",value:function(){var o=arguments,n=arguments[0];if(arguments.length===1)n.sort((function(Q,le){return Q.compareTo(le)}));else if(arguments.length===2)n.sort((function(Q,le){return o[1].compare(Q,le)}));else if(arguments.length===3){var r=n.slice(arguments[1],arguments[2]);r.sort();var a=n.slice(0,arguments[1]).concat(r,n.slice(arguments[2],n.length));n.splice(0,n.length);var l,g=d(a);try{for(g.s();!(l=g.n()).done;){var p=l.value;n.push(p)}}catch(Q){g.e(Q)}finally{g.f()}}else if(arguments.length===4){var _=n.slice(arguments[1],arguments[2]);_.sort((function(Q,le){return o[3].compare(Q,le)}));var x=n.slice(0,arguments[1]).concat(_,n.slice(arguments[2],n.length));n.splice(0,n.length);var I,z=d(x);try{for(z.s();!(I=z.n()).done;){var J=I.value;n.push(J)}}catch(Q){z.e(Q)}finally{z.f()}}}},{key:"asList",value:function(o){var n,r=new pe,a=d(o);try{for(a.s();!(n=a.n()).done;){var l=n.value;r.add(l)}}catch(g){a.e(g)}finally{a.f()}return r}},{key:"copyOf",value:function(o,n){return o.slice(0,n)}}])})(),Mn=h((function o(){u(this,o)})),zt=(function(o){function n(){var r;return u(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return y(n,o),h(n,[{key:"computeEnvelopeInternal",value:function(){return this._shell.getEnvelopeInternal()}},{key:"getCoordinates",value:function(){if(this.isEmpty())return[];for(var r=new Array(this.getNumPoints()).fill(null),a=-1,l=this._shell.getCoordinates(),g=0;g<l.length;g++)r[++a]=l[g];for(var p=0;p<this._holes.length;p++)for(var _=this._holes[p].getCoordinates(),x=0;x<_.length;x++)r[++a]=_[x];return r}},{key:"getArea",value:function(){var r=0;r+=ns.ofRing(this._shell.getCoordinateSequence());for(var a=0;a<this._holes.length;a++)r-=ns.ofRing(this._holes[a].getCoordinateSequence());return r}},{key:"copyInternal",value:function(){for(var r=this._shell.copy(),a=new Array(this._holes.length).fill(null),l=0;l<this._holes.length;l++)a[l]=this._holes[l].copy();return new n(r,a,this._factory)}},{key:"isRectangle",value:function(){if(this.getNumInteriorRing()!==0||this._shell===null||this._shell.getNumPoints()!==5)return!1;for(var r=this._shell.getCoordinateSequence(),a=this.getEnvelopeInternal(),l=0;l<5;l++){var g=r.getX(l);if(g!==a.getMinX()&&g!==a.getMaxX())return!1;var p=r.getY(l);if(p!==a.getMinY()&&p!==a.getMaxY())return!1}for(var _=r.getX(0),x=r.getY(0),I=1;I<=4;I++){var z=r.getX(I),J=r.getY(I);if(z!==_==(J!==x))return!1;_=z,x=J}return!0}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof fe){var r=arguments[0],a=arguments[1];if(!this.isEquivalentClass(r))return!1;var l=r,g=this._shell,p=l._shell;if(!g.equalsExact(p,a)||this._holes.length!==l._holes.length)return!1;for(var _=0;_<this._holes.length;_++)if(!this._holes[_].equalsExact(l._holes[_],a))return!1;return!0}return b(n,"equalsExact",this,1).apply(this,arguments)}},{key:"normalize",value:function(){if(arguments.length===0){this._shell=this.normalized(this._shell,!0);for(var r=0;r<this._holes.length;r++)this._holes[r]=this.normalized(this._holes[r],!1);$n.sort(this._holes)}else if(arguments.length===2){var a=arguments[0],l=arguments[1];if(a.isEmpty())return null;var g=a.getCoordinateSequence(),p=Xn.minCoordinateIndex(g,0,g.size()-2);Xn.scroll(g,p,!0),ve.isCCW(g)===l&&Xn.reverse(g)}}},{key:"getCoordinate",value:function(){return this._shell.getCoordinate()}},{key:"getNumInteriorRing",value:function(){return this._holes.length}},{key:"getBoundaryDimension",value:function(){return 1}},{key:"reverseInternal",value:function(){for(var r=this.getExteriorRing().reverse(),a=new Array(this.getNumInteriorRing()).fill(null),l=0;l<a.length;l++)a[l]=this.getInteriorRingN(l).reverse();return this.getFactory().createPolygon(r,a)}},{key:"getTypeCode",value:function(){return fe.TYPECODE_POLYGON}},{key:"getDimension",value:function(){return 2}},{key:"getLength",value:function(){var r=0;r+=this._shell.getLength();for(var a=0;a<this._holes.length;a++)r+=this._holes[a].getLength();return r}},{key:"getNumPoints",value:function(){for(var r=this._shell.getNumPoints(),a=0;a<this._holes.length;a++)r+=this._holes[a].getNumPoints();return r}},{key:"convexHull",value:function(){return this.getExteriorRing().convexHull()}},{key:"normalized",value:function(r,a){var l=r.copy();return this.normalize(l,a),l}},{key:"compareToSameClass",value:function(){if(arguments.length===1){var r=arguments[0],a=this._shell,l=r._shell;return a.compareToSameClass(l)}if(arguments.length===2){var g=arguments[1],p=arguments[0],_=this._shell,x=p._shell,I=_.compareToSameClass(x,g);if(I!==0)return I;for(var z=this.getNumInteriorRing(),J=p.getNumInteriorRing(),Q=0;Q<z&&Q<J;){var le=this.getInteriorRingN(Q),de=p.getInteriorRingN(Q),me=le.compareToSameClass(de,g);if(me!==0)return me;Q++}return Q<z?1:Q<J?-1:0}}},{key:"apply",value:function(){if(_e(arguments[0],ui)){var r=arguments[0];this._shell.apply(r);for(var a=0;a<this._holes.length;a++)this._holes[a].apply(r)}else if(_e(arguments[0],li)){var l=arguments[0];if(this._shell.apply(l),!l.isDone())for(var g=0;g<this._holes.length&&(this._holes[g].apply(l),!l.isDone());g++);l.isGeometryChanged()&&this.geometryChanged()}else if(_e(arguments[0],fn))arguments[0].filter(this);else if(_e(arguments[0],H)){var p=arguments[0];p.filter(this),this._shell.apply(p);for(var _=0;_<this._holes.length;_++)this._holes[_].apply(p)}}},{key:"getBoundary",value:function(){if(this.isEmpty())return this.getFactory().createMultiLineString();var r=new Array(this._holes.length+1).fill(null);r[0]=this._shell;for(var a=0;a<this._holes.length;a++)r[a+1]=this._holes[a];return r.length<=1?this.getFactory().createLinearRing(r[0].getCoordinateSequence()):this.getFactory().createMultiLineString(r)}},{key:"getGeometryType",value:function(){return fe.TYPENAME_POLYGON}},{key:"getExteriorRing",value:function(){return this._shell}},{key:"isEmpty",value:function(){return this._shell.isEmpty()}},{key:"getInteriorRingN",value:function(r){return this._holes[r]}},{key:"interfaces_",get:function(){return[Mn]}}],[{key:"constructor_",value:function(){this._shell=null,this._holes=null;var r=arguments[0],a=arguments[1],l=arguments[2];if(fe.constructor_.call(this,l),r===null&&(r=this.getFactory().createLinearRing()),a===null&&(a=[]),fe.hasNullElements(a))throw new X("holes must not contain null elements");if(r.isEmpty()&&fe.hasNonEmptyElements(a))throw new X("shell is empty but holes are not");this._shell=r,this._holes=a}}])})(fe),rs=(function(o){function n(r){var a;return u(this,n),(a=s(this,n)).array=[],r instanceof $e&&a.addAll(r),a}return y(n,o),h(n,[{key:"contains",value:function(r){var a,l=d(this.array);try{for(l.s();!(a=l.n()).done;)if(a.value.compareTo(r)===0)return!0}catch(g){l.e(g)}finally{l.f()}return!1}},{key:"add",value:function(r){if(this.contains(r))return!1;for(var a=0,l=this.array.length;a<l;a++)if(this.array[a].compareTo(r)===1)return!!this.array.splice(a,0,r);return this.array.push(r),!0}},{key:"addAll",value:function(r){var a,l=d(r);try{for(l.s();!(a=l.n()).done;){var g=a.value;this.add(g)}}catch(p){l.e(p)}finally{l.f()}return!0}},{key:"remove",value:function(){throw new Re}},{key:"size",value:function(){return this.array.length}},{key:"isEmpty",value:function(){return this.array.length===0}},{key:"toArray",value:function(){return this.array.slice()}},{key:"iterator",value:function(){return new ca(this.array)}}])})((function(o){function n(){return u(this,n),s(this,n,arguments)}return y(n,o),h(n)})(Me)),ca=(function(){return h((function o(n){u(this,o),this.array=n,this.position=0}),[{key:"next",value:function(){if(this.position===this.array.length)throw new Be;return this.array[this.position++]}},{key:"hasNext",value:function(){return this.position<this.array.length}},{key:"remove",value:function(){throw new Re}}])})(),lt=(function(o){function n(){var r;return u(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return y(n,o),h(n,[{key:"computeEnvelopeInternal",value:function(){for(var r=new be,a=0;a<this._geometries.length;a++)r.expandToInclude(this._geometries[a].getEnvelopeInternal());return r}},{key:"getGeometryN",value:function(r){return this._geometries[r]}},{key:"getCoordinates",value:function(){for(var r=new Array(this.getNumPoints()).fill(null),a=-1,l=0;l<this._geometries.length;l++)for(var g=this._geometries[l].getCoordinates(),p=0;p<g.length;p++)r[++a]=g[p];return r}},{key:"getArea",value:function(){for(var r=0,a=0;a<this._geometries.length;a++)r+=this._geometries[a].getArea();return r}},{key:"copyInternal",value:function(){for(var r=new Array(this._geometries.length).fill(null),a=0;a<r.length;a++)r[a]=this._geometries[a].copy();return new n(r,this._factory)}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof fe){var r=arguments[0],a=arguments[1];if(!this.isEquivalentClass(r))return!1;var l=r;if(this._geometries.length!==l._geometries.length)return!1;for(var g=0;g<this._geometries.length;g++)if(!this._geometries[g].equalsExact(l._geometries[g],a))return!1;return!0}return b(n,"equalsExact",this,1).apply(this,arguments)}},{key:"normalize",value:function(){for(var r=0;r<this._geometries.length;r++)this._geometries[r].normalize();$n.sort(this._geometries)}},{key:"getCoordinate",value:function(){return this.isEmpty()?null:this._geometries[0].getCoordinate()}},{key:"getBoundaryDimension",value:function(){for(var r=te.FALSE,a=0;a<this._geometries.length;a++)r=Math.max(r,this._geometries[a].getBoundaryDimension());return r}},{key:"reverseInternal",value:function(){for(var r=this._geometries.length,a=new pe(r),l=0;l<r;l++)a.add(this._geometries[l].reverse());return this.getFactory().buildGeometry(a)}},{key:"getTypeCode",value:function(){return fe.TYPECODE_GEOMETRYCOLLECTION}},{key:"getDimension",value:function(){for(var r=te.FALSE,a=0;a<this._geometries.length;a++)r=Math.max(r,this._geometries[a].getDimension());return r}},{key:"getLength",value:function(){for(var r=0,a=0;a<this._geometries.length;a++)r+=this._geometries[a].getLength();return r}},{key:"getNumPoints",value:function(){for(var r=0,a=0;a<this._geometries.length;a++)r+=this._geometries[a].getNumPoints();return r}},{key:"getNumGeometries",value:function(){return this._geometries.length}},{key:"compareToSameClass",value:function(){if(arguments.length===1){var r=arguments[0],a=new rs($n.asList(this._geometries)),l=new rs($n.asList(r._geometries));return this.compare(a,l)}if(arguments.length===2){for(var g=arguments[1],p=arguments[0],_=this.getNumGeometries(),x=p.getNumGeometries(),I=0;I<_&&I<x;){var z=this.getGeometryN(I),J=p.getGeometryN(I),Q=z.compareToSameClass(J,g);if(Q!==0)return Q;I++}return I<_?1:I<x?-1:0}}},{key:"apply",value:function(){if(_e(arguments[0],ui))for(var r=arguments[0],a=0;a<this._geometries.length;a++)this._geometries[a].apply(r);else if(_e(arguments[0],li)){var l=arguments[0];if(this._geometries.length===0)return null;for(var g=0;g<this._geometries.length&&(this._geometries[g].apply(l),!l.isDone());g++);l.isGeometryChanged()&&this.geometryChanged()}else if(_e(arguments[0],fn)){var p=arguments[0];p.filter(this);for(var _=0;_<this._geometries.length;_++)this._geometries[_].apply(p)}else if(_e(arguments[0],H)){var x=arguments[0];x.filter(this);for(var I=0;I<this._geometries.length;I++)this._geometries[I].apply(x)}}},{key:"getBoundary",value:function(){return fe.checkNotGeometryCollection(this),re.shouldNeverReachHere(),null}},{key:"getGeometryType",value:function(){return fe.TYPENAME_GEOMETRYCOLLECTION}},{key:"isEmpty",value:function(){for(var r=0;r<this._geometries.length;r++)if(!this._geometries[r].isEmpty())return!1;return!0}}],[{key:"constructor_",value:function(){if(this._geometries=null,arguments.length!==0&&arguments.length===2){var r=arguments[0],a=arguments[1];if(fe.constructor_.call(this,a),r===null&&(r=[]),fe.hasNullElements(r))throw new X("geometries must not contain null elements");this._geometries=r}}}])})(fe),fi=(function(o){function n(){var r;return u(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return y(n,o),h(n,[{key:"copyInternal",value:function(){for(var r=new Array(this._geometries.length).fill(null),a=0;a<r.length;a++)r[a]=this._geometries[a].copy();return new n(r,this._factory)}},{key:"isValid",value:function(){return!0}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof fe){var r=arguments[0],a=arguments[1];return!!this.isEquivalentClass(r)&&b(n,"equalsExact",this,1).call(this,r,a)}return b(n,"equalsExact",this,1).apply(this,arguments)}},{key:"getCoordinate",value:function(){if(arguments.length===1&&Number.isInteger(arguments[0])){var r=arguments[0];return this._geometries[r].getCoordinate()}return b(n,"getCoordinate",this,1).apply(this,arguments)}},{key:"getBoundaryDimension",value:function(){return te.FALSE}},{key:"getTypeCode",value:function(){return fe.TYPECODE_MULTIPOINT}},{key:"getDimension",value:function(){return 0}},{key:"getBoundary",value:function(){return this.getFactory().createGeometryCollection()}},{key:"getGeometryType",value:function(){return fe.TYPENAME_MULTIPOINT}},{key:"interfaces_",get:function(){return[ci]}}],[{key:"constructor_",value:function(){var r=arguments[0],a=arguments[1];lt.constructor_.call(this,r,a)}}])})(lt),yt=(function(o){function n(){var r;return u(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return y(n,o),h(n,[{key:"copyInternal",value:function(){return new n(this._points.copy(),this._factory)}},{key:"getBoundaryDimension",value:function(){return te.FALSE}},{key:"isClosed",value:function(){return!!this.isEmpty()||b(n,"isClosed",this,1).call(this)}},{key:"reverseInternal",value:function(){var r=this._points.copy();return Xn.reverse(r),this.getFactory().createLinearRing(r)}},{key:"getTypeCode",value:function(){return fe.TYPECODE_LINEARRING}},{key:"validateConstruction",value:function(){if(!this.isEmpty()&&!b(n,"isClosed",this,1).call(this))throw new X("Points of LinearRing do not form a closed linestring");if(this.getCoordinateSequence().size()>=1&&this.getCoordinateSequence().size()<n.MINIMUM_VALID_SIZE)throw new X("Invalid number of points in LinearRing (found "+this.getCoordinateSequence().size()+" - must be 0 or >= 4)")}},{key:"getGeometryType",value:function(){return fe.TYPENAME_LINEARRING}}],[{key:"constructor_",value:function(){var r=arguments[0],a=arguments[1];hr.constructor_.call(this,r,a),this.validateConstruction()}}])})(hr);yt.MINIMUM_VALID_SIZE=4;var Nn=(function(o){function n(){var r;return u(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return y(n,o),h(n,[{key:"setOrdinate",value:function(r,a){switch(r){case n.X:this.x=a;break;case n.Y:this.y=a;break;default:throw new X("Invalid ordinate index: "+r)}}},{key:"getZ",value:function(){return Y.NULL_ORDINATE}},{key:"getOrdinate",value:function(r){switch(r){case n.X:return this.x;case n.Y:return this.y}throw new X("Invalid ordinate index: "+r)}},{key:"setZ",value:function(r){throw new X("CoordinateXY dimension 2 does not support z-ordinate")}},{key:"copy",value:function(){return new n(this)}},{key:"toString",value:function(){return"("+this.x+", "+this.y+")"}},{key:"setCoordinate",value:function(r){this.x=r.x,this.y=r.y,this.z=r.getZ()}}],[{key:"constructor_",value:function(){if(arguments.length===0)Y.constructor_.call(this);else if(arguments.length===1){if(arguments[0]instanceof n){var r=arguments[0];Y.constructor_.call(this,r.x,r.y)}else if(arguments[0]instanceof Y){var a=arguments[0];Y.constructor_.call(this,a.x,a.y)}}else if(arguments.length===2){var l=arguments[0],g=arguments[1];Y.constructor_.call(this,l,g,Y.NULL_ORDINATE)}}}])})(Y);Nn.X=0,Nn.Y=1,Nn.Z=-1,Nn.M=-1;var Ln=(function(o){function n(){var r;return u(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return y(n,o),h(n,[{key:"getM",value:function(){return this._m}},{key:"setOrdinate",value:function(r,a){switch(r){case n.X:this.x=a;break;case n.Y:this.y=a;break;case n.M:this._m=a;break;default:throw new X("Invalid ordinate index: "+r)}}},{key:"setM",value:function(r){this._m=r}},{key:"getZ",value:function(){return Y.NULL_ORDINATE}},{key:"getOrdinate",value:function(r){switch(r){case n.X:return this.x;case n.Y:return this.y;case n.M:return this._m}throw new X("Invalid ordinate index: "+r)}},{key:"setZ",value:function(r){throw new X("CoordinateXY dimension 2 does not support z-ordinate")}},{key:"copy",value:function(){return new n(this)}},{key:"toString",value:function(){return"("+this.x+", "+this.y+" m="+this.getM()+")"}},{key:"setCoordinate",value:function(r){this.x=r.x,this.y=r.y,this.z=r.getZ(),this._m=r.getM()}}],[{key:"constructor_",value:function(){if(this._m=null,arguments.length===0)Y.constructor_.call(this),this._m=0;else if(arguments.length===1){if(arguments[0]instanceof n){var r=arguments[0];Y.constructor_.call(this,r.x,r.y),this._m=r._m}else if(arguments[0]instanceof Y){var a=arguments[0];Y.constructor_.call(this,a.x,a.y),this._m=this.getM()}}else if(arguments.length===3){var l=arguments[0],g=arguments[1],p=arguments[2];Y.constructor_.call(this,l,g,Y.NULL_ORDINATE),this._m=p}}}])})(Y);Ln.X=0,Ln.Y=1,Ln.Z=-1,Ln.M=2;var gi=(function(o){function n(){var r;return u(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return y(n,o),h(n,[{key:"getM",value:function(){return this._m}},{key:"setOrdinate",value:function(r,a){switch(r){case Y.X:this.x=a;break;case Y.Y:this.y=a;break;case Y.Z:this.z=a;break;case Y.M:this._m=a;break;default:throw new X("Invalid ordinate index: "+r)}}},{key:"setM",value:function(r){this._m=r}},{key:"getOrdinate",value:function(r){switch(r){case Y.X:return this.x;case Y.Y:return this.y;case Y.Z:return this.getZ();case Y.M:return this.getM()}throw new X("Invalid ordinate index: "+r)}},{key:"copy",value:function(){return new n(this)}},{key:"toString",value:function(){return"("+this.x+", "+this.y+", "+this.getZ()+" m="+this.getM()+")"}},{key:"setCoordinate",value:function(r){this.x=r.x,this.y=r.y,this.z=r.getZ(),this._m=r.getM()}}],[{key:"constructor_",value:function(){if(this._m=null,arguments.length===0)Y.constructor_.call(this),this._m=0;else if(arguments.length===1){if(arguments[0]instanceof n){var r=arguments[0];Y.constructor_.call(this,r),this._m=r._m}else if(arguments[0]instanceof Y){var a=arguments[0];Y.constructor_.call(this,a),this._m=this.getM()}}else if(arguments.length===4){var l=arguments[0],g=arguments[1],p=arguments[2],_=arguments[3];Y.constructor_.call(this,l,g,p),this._m=_}}}])})(Y),Rr=(function(){function o(){u(this,o)}return h(o,null,[{key:"measures",value:function(n){return n instanceof Nn?0:n instanceof Ln||n instanceof gi?1:0}},{key:"dimension",value:function(n){return n instanceof Nn?2:n instanceof Ln?3:n instanceof gi?4:3}},{key:"create",value:function(){if(arguments.length===1){var n=arguments[0];return o.create(n,0)}if(arguments.length===2){var r=arguments[0],a=arguments[1];return r===2?new Nn:r===3&&a===0?new Y:r===3&&a===1?new Ln:r===4&&a===1?new gi:new Y}}}])})(),Dr=(function(o){function n(){var r;return u(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return y(n,o),h(n,[{key:"getCoordinate",value:function(r){return this.get(r)}},{key:"addAll",value:function(){if(arguments.length===2&&typeof arguments[1]=="boolean"&&_e(arguments[0],$e)){for(var r=arguments[1],a=!1,l=arguments[0].iterator();l.hasNext();)this.add(l.next(),r),a=!0;return a}return b(n,"addAll",this,1).apply(this,arguments)}},{key:"clone",value:function(){for(var r=b(n,"clone",this,1).call(this),a=0;a<this.size();a++)r.add(a,this.get(a).clone());return r}},{key:"toCoordinateArray",value:function(){if(arguments.length===0)return this.toArray(n.coordArrayType);if(arguments.length===1){if(arguments[0])return this.toArray(n.coordArrayType);for(var r=this.size(),a=new Array(r).fill(null),l=0;l<r;l++)a[l]=this.get(r-l-1);return a}}},{key:"add",value:function(){if(arguments.length===1){var r=arguments[0];return b(n,"add",this,1).call(this,r)}if(arguments.length===2){if(arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var a=arguments[0],l=arguments[1];return this.add(a,l,!0),!0}if(arguments[0]instanceof Y&&typeof arguments[1]=="boolean"){var g=arguments[0];if(!arguments[1]&&this.size()>=1&&this.get(this.size()-1).equals2D(g))return null;b(n,"add",this,1).call(this,g)}else if(arguments[0]instanceof Object&&typeof arguments[1]=="boolean"){var p=arguments[0],_=arguments[1];return this.add(p,_),!0}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var x=arguments[0],I=arguments[1];if(arguments[2])for(var z=0;z<x.length;z++)this.add(x[z],I);else for(var J=x.length-1;J>=0;J--)this.add(x[J],I);return!0}if(typeof arguments[2]=="boolean"&&Number.isInteger(arguments[0])&&arguments[1]instanceof Y){var Q=arguments[0],le=arguments[1];if(!arguments[2]){var de=this.size();if(de>0&&(Q>0&&this.get(Q-1).equals2D(le)||Q<de&&this.get(Q).equals2D(le)))return null}b(n,"add",this,1).call(this,Q,le)}}else if(arguments.length===4){var me=arguments[0],Pe=arguments[1],Le=arguments[2],Fe=arguments[3],ct=1;Le>Fe&&(ct=-1);for(var dt=Le;dt!==Fe;dt+=ct)this.add(me[dt],Pe);return!0}}},{key:"closeRing",value:function(){if(this.size()>0){var r=this.get(0).copy();this.add(r,!1)}}}],[{key:"constructor_",value:function(){if(arguments.length!==0){if(arguments.length===1){var r=arguments[0];this.ensureCapacity(r.length),this.add(r,!0)}else if(arguments.length===2){var a=arguments[0],l=arguments[1];this.ensureCapacity(a.length),this.add(a,l)}}}}])})(pe);Dr.coordArrayType=new Array(0).fill(null);var A=(function(){function o(){u(this,o)}return h(o,null,[{key:"isRing",value:function(n){return!(n.length<4)&&!!n[0].equals2D(n[n.length-1])}},{key:"ptNotInList",value:function(n,r){for(var a=0;a<n.length;a++){var l=n[a];if(o.indexOf(l,r)<0)return l}return null}},{key:"scroll",value:function(n,r){var a=o.indexOf(r,n);if(a<0)return null;var l=new Array(n.length).fill(null);gt.arraycopy(n,a,l,0,n.length-a),gt.arraycopy(n,0,l,n.length-a,a),gt.arraycopy(l,0,n,0,n.length)}},{key:"equals",value:function(){if(arguments.length===2){var n=arguments[0],r=arguments[1];if(n===r)return!0;if(n===null||r===null||n.length!==r.length)return!1;for(var a=0;a<n.length;a++)if(!n[a].equals(r[a]))return!1;return!0}if(arguments.length===3){var l=arguments[0],g=arguments[1],p=arguments[2];if(l===g)return!0;if(l===null||g===null||l.length!==g.length)return!1;for(var _=0;_<l.length;_++)if(p.compare(l[_],g[_])!==0)return!1;return!0}}},{key:"intersection",value:function(n,r){for(var a=new Dr,l=0;l<n.length;l++)r.intersects(n[l])&&a.add(n[l],!0);return a.toCoordinateArray()}},{key:"measures",value:function(n){if(n===null||n.length===0)return 0;var r,a=0,l=d(n);try{for(l.s();!(r=l.n()).done;){var g=r.value;a=Math.max(a,Rr.measures(g))}}catch(p){l.e(p)}finally{l.f()}return a}},{key:"hasRepeatedPoints",value:function(n){for(var r=1;r<n.length;r++)if(n[r-1].equals(n[r]))return!0;return!1}},{key:"removeRepeatedPoints",value:function(n){return o.hasRepeatedPoints(n)?new Dr(n,!1).toCoordinateArray():n}},{key:"reverse",value:function(n){for(var r=n.length-1,a=Math.trunc(r/2),l=0;l<=a;l++){var g=n[l];n[l]=n[r-l],n[r-l]=g}}},{key:"removeNull",value:function(n){for(var r=0,a=0;a<n.length;a++)n[a]!==null&&r++;var l=new Array(r).fill(null);if(r===0)return l;for(var g=0,p=0;p<n.length;p++)n[p]!==null&&(l[g++]=n[p]);return l}},{key:"copyDeep",value:function(){if(arguments.length===1){for(var n=arguments[0],r=new Array(n.length).fill(null),a=0;a<n.length;a++)r[a]=n[a].copy();return r}if(arguments.length===5)for(var l=arguments[0],g=arguments[1],p=arguments[2],_=arguments[3],x=arguments[4],I=0;I<x;I++)p[_+I]=l[g+I].copy()}},{key:"isEqualReversed",value:function(n,r){for(var a=0;a<n.length;a++){var l=n[a],g=r[n.length-a-1];if(l.compareTo(g)!==0)return!1}return!0}},{key:"envelope",value:function(n){for(var r=new be,a=0;a<n.length;a++)r.expandToInclude(n[a]);return r}},{key:"toCoordinateArray",value:function(n){return n.toArray(o.coordArrayType)}},{key:"dimension",value:function(n){if(n===null||n.length===0)return 3;var r,a=0,l=d(n);try{for(l.s();!(r=l.n()).done;){var g=r.value;a=Math.max(a,Rr.dimension(g))}}catch(p){l.e(p)}finally{l.f()}return a}},{key:"atLeastNCoordinatesOrNothing",value:function(n,r){return r.length>=n?r:[]}},{key:"indexOf",value:function(n,r){for(var a=0;a<r.length;a++)if(n.equals(r[a]))return a;return-1}},{key:"increasingDirection",value:function(n){for(var r=0;r<Math.trunc(n.length/2);r++){var a=n.length-1-r,l=n[r].compareTo(n[a]);if(l!==0)return l}return 1}},{key:"compare",value:function(n,r){for(var a=0;a<n.length&&a<r.length;){var l=n[a].compareTo(r[a]);if(l!==0)return l;a++}return a<r.length?-1:a<n.length?1:0}},{key:"minCoordinate",value:function(n){for(var r=null,a=0;a<n.length;a++)(r===null||r.compareTo(n[a])>0)&&(r=n[a]);return r}},{key:"extract",value:function(n,r,a){r=Tr.clamp(r,0,n.length);var l=(a=Tr.clamp(a,-1,n.length))-r+1;a<0&&(l=0),r>=n.length&&(l=0),a<r&&(l=0);var g=new Array(l).fill(null);if(l===0)return g;for(var p=0,_=r;_<=a;_++)g[p++]=n[_];return g}}])})(),he=(function(){return h((function o(){u(this,o)}),[{key:"compare",value:function(o,n){var r=o,a=n;return A.compare(r,a)}},{key:"interfaces_",get:function(){return[ie]}}])})(),ue=(function(){return h((function o(){u(this,o)}),[{key:"compare",value:function(o,n){var r=o,a=n;if(r.length<a.length)return-1;if(r.length>a.length)return 1;if(r.length===0)return 0;var l=A.compare(r,a);return A.isEqualReversed(r,a)?0:l}},{key:"OLDcompare",value:function(o,n){var r=o,a=n;if(r.length<a.length)return-1;if(r.length>a.length)return 1;if(r.length===0)return 0;for(var l=A.increasingDirection(r),g=A.increasingDirection(a),p=l>0?0:r.length-1,_=g>0?0:r.length-1,x=0;x<r.length;x++){var I=r[p].compareTo(a[_]);if(I!==0)return I;p+=l,_+=g}return 0}},{key:"interfaces_",get:function(){return[ie]}}])})();A.ForwardComparator=he,A.BidirectionalComparator=ue,A.coordArrayType=new Array(0).fill(null);var Ne=(function(){return h((function o(n){u(this,o),this.str=n}),[{key:"append",value:function(o){this.str+=o}},{key:"setCharAt",value:function(o,n){this.str=this.str.substr(0,o)+n+this.str.substr(o+1)}},{key:"toString",value:function(){return this.str}}])})(),Ae=(function(){function o(){u(this,o),o.constructor_.apply(this,arguments)}return h(o,[{key:"getM",value:function(n){return this.hasM()?this._coordinates[n].getM():K.NaN}},{key:"setOrdinate",value:function(n,r,a){switch(r){case Ee.X:this._coordinates[n].x=a;break;case Ee.Y:this._coordinates[n].y=a;break;default:this._coordinates[n].setOrdinate(r,a)}}},{key:"getZ",value:function(n){return this.hasZ()?this._coordinates[n].getZ():K.NaN}},{key:"size",value:function(){return this._coordinates.length}},{key:"getOrdinate",value:function(n,r){switch(r){case Ee.X:return this._coordinates[n].x;case Ee.Y:return this._coordinates[n].y;default:return this._coordinates[n].getOrdinate(r)}}},{key:"getCoordinate",value:function(){if(arguments.length===1){var n=arguments[0];return this._coordinates[n]}if(arguments.length===2){var r=arguments[0];arguments[1].setCoordinate(this._coordinates[r])}}},{key:"getCoordinateCopy",value:function(n){var r=this.createCoordinate();return r.setCoordinate(this._coordinates[n]),r}},{key:"createCoordinate",value:function(){return Rr.create(this.getDimension(),this.getMeasures())}},{key:"getDimension",value:function(){return this._dimension}},{key:"getX",value:function(n){return this._coordinates[n].x}},{key:"getMeasures",value:function(){return this._measures}},{key:"expandEnvelope",value:function(n){for(var r=0;r<this._coordinates.length;r++)n.expandToInclude(this._coordinates[r]);return n}},{key:"copy",value:function(){for(var n=new Array(this.size()).fill(null),r=0;r<this._coordinates.length;r++){var a=this.createCoordinate();a.setCoordinate(this._coordinates[r]),n[r]=a}return new o(n,this._dimension,this._measures)}},{key:"toString",value:function(){if(this._coordinates.length>0){var n=new Ne(17*this._coordinates.length);n.append("("),n.append(this._coordinates[0]);for(var r=1;r<this._coordinates.length;r++)n.append(", "),n.append(this._coordinates[r]);return n.append(")"),n.toString()}return"()"}},{key:"getY",value:function(n){return this._coordinates[n].y}},{key:"toCoordinateArray",value:function(){return this._coordinates}},{key:"interfaces_",get:function(){return[Ee,E]}}],[{key:"constructor_",value:function(){if(this._dimension=3,this._measures=0,this._coordinates=null,arguments.length===1){if(arguments[0]instanceof Array){var n=arguments[0];o.constructor_.call(this,n,A.dimension(n),A.measures(n))}else if(Number.isInteger(arguments[0])){var r=arguments[0];this._coordinates=new Array(r).fill(null);for(var a=0;a<r;a++)this._coordinates[a]=new Y}else if(_e(arguments[0],Ee)){var l=arguments[0];if(l===null)return this._coordinates=new Array(0).fill(null),null;this._dimension=l.getDimension(),this._measures=l.getMeasures(),this._coordinates=new Array(l.size()).fill(null);for(var g=0;g<this._coordinates.length;g++)this._coordinates[g]=l.getCoordinateCopy(g)}}else if(arguments.length===2){if(arguments[0]instanceof Array&&Number.isInteger(arguments[1])){var p=arguments[0],_=arguments[1];o.constructor_.call(this,p,_,A.measures(p))}else if(Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var x=arguments[0],I=arguments[1];this._coordinates=new Array(x).fill(null),this._dimension=I;for(var z=0;z<x;z++)this._coordinates[z]=Rr.create(I)}}else if(arguments.length===3){if(Number.isInteger(arguments[2])&&arguments[0]instanceof Array&&Number.isInteger(arguments[1])){var J=arguments[0],Q=arguments[1],le=arguments[2];this._dimension=Q,this._measures=le,this._coordinates=J===null?new Array(0).fill(null):J}else if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var de=arguments[0],me=arguments[1],Pe=arguments[2];this._coordinates=new Array(de).fill(null),this._dimension=me,this._measures=Pe;for(var Le=0;Le<de;Le++)this._coordinates[Le]=this.createCoordinate()}}}}])})(),tt=(function(){function o(){u(this,o)}return h(o,[{key:"readResolve",value:function(){return o.instance()}},{key:"create",value:function(){if(arguments.length===1){if(arguments[0]instanceof Array)return new Ae(arguments[0]);if(_e(arguments[0],Ee))return new Ae(arguments[0])}else{if(arguments.length===2){var n=arguments[1];return n>3&&(n=3),n<2&&(n=2),new Ae(arguments[0],n)}if(arguments.length===3){var r=arguments[2],a=arguments[1]-r;return r>1&&(r=1),a>3&&(a=3),a<2&&(a=2),new Ae(arguments[0],a+r,r)}}}},{key:"interfaces_",get:function(){return[Pr,E]}}],[{key:"instance",value:function(){return o.instanceObject}}])})();tt.instanceObject=new tt;var gn=(function(o){function n(){var r;return u(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return y(n,o),h(n,[{key:"copyInternal",value:function(){for(var r=new Array(this._geometries.length).fill(null),a=0;a<r.length;a++)r[a]=this._geometries[a].copy();return new n(r,this._factory)}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof fe){var r=arguments[0],a=arguments[1];return!!this.isEquivalentClass(r)&&b(n,"equalsExact",this,1).call(this,r,a)}return b(n,"equalsExact",this,1).apply(this,arguments)}},{key:"getBoundaryDimension",value:function(){return 1}},{key:"getTypeCode",value:function(){return fe.TYPECODE_MULTIPOLYGON}},{key:"getDimension",value:function(){return 2}},{key:"getBoundary",value:function(){if(this.isEmpty())return this.getFactory().createMultiLineString();for(var r=new pe,a=0;a<this._geometries.length;a++)for(var l=this._geometries[a].getBoundary(),g=0;g<l.getNumGeometries();g++)r.add(l.getGeometryN(g));var p=new Array(r.size()).fill(null);return this.getFactory().createMultiLineString(r.toArray(p))}},{key:"getGeometryType",value:function(){return fe.TYPENAME_MULTIPOLYGON}},{key:"interfaces_",get:function(){return[Mn]}}],[{key:"constructor_",value:function(){var r=arguments[0],a=arguments[1];lt.constructor_.call(this,r,a)}}])})(lt),nt=(function(){return h((function o(){u(this,o)}),[{key:"get",value:function(){}},{key:"put",value:function(){}},{key:"size",value:function(){}},{key:"values",value:function(){}},{key:"entrySet",value:function(){}}])})(),Cn=(function(o){function n(){var r;return u(this,n),(r=s(this,n)).map=new Map,r}return y(n,o),h(n,[{key:"get",value:function(r){return this.map.get(r)||null}},{key:"put",value:function(r,a){return this.map.set(r,a),a}},{key:"values",value:function(){for(var r=new pe,a=this.map.values(),l=a.next();!l.done;)r.add(l.value),l=a.next();return r}},{key:"entrySet",value:function(){var r=new Mr;return this.map.entries().forEach((function(a){return r.add(a)})),r}},{key:"size",value:function(){return this.map.size()}}])})(nt),De=(function(){function o(){u(this,o),o.constructor_.apply(this,arguments)}return h(o,[{key:"equals",value:function(n){if(!(n instanceof o))return!1;var r=n;return this._modelType===r._modelType&&this._scale===r._scale}},{key:"compareTo",value:function(n){var r=n,a=this.getMaximumSignificantDigits(),l=r.getMaximumSignificantDigits();return Sn.compare(a,l)}},{key:"getScale",value:function(){return this._scale}},{key:"isFloating",value:function(){return this._modelType===o.FLOATING||this._modelType===o.FLOATING_SINGLE}},{key:"getType",value:function(){return this._modelType}},{key:"toString",value:function(){var n="UNKNOWN";return this._modelType===o.FLOATING?n="Floating":this._modelType===o.FLOATING_SINGLE?n="Floating-Single":this._modelType===o.FIXED&&(n="Fixed (Scale="+this.getScale()+")"),n}},{key:"makePrecise",value:function(){if(typeof arguments[0]=="number"){var n=arguments[0];return K.isNaN(n)||this._modelType===o.FLOATING_SINGLE?n:this._modelType===o.FIXED?Math.round(n*this._scale)/this._scale:n}if(arguments[0]instanceof Y){var r=arguments[0];if(this._modelType===o.FLOATING)return null;r.x=this.makePrecise(r.x),r.y=this.makePrecise(r.y)}}},{key:"getMaximumSignificantDigits",value:function(){var n=16;return this._modelType===o.FLOATING?n=16:this._modelType===o.FLOATING_SINGLE?n=6:this._modelType===o.FIXED&&(n=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),n}},{key:"setScale",value:function(n){this._scale=Math.abs(n)}},{key:"interfaces_",get:function(){return[E,$]}}],[{key:"constructor_",value:function(){if(this._modelType=null,this._scale=null,arguments.length===0)this._modelType=o.FLOATING;else if(arguments.length===1){if(arguments[0]instanceof Zn){var n=arguments[0];this._modelType=n,n===o.FIXED&&this.setScale(1)}else if(typeof arguments[0]=="number"){var r=arguments[0];this._modelType=o.FIXED,this.setScale(r)}else if(arguments[0]instanceof o){var a=arguments[0];this._modelType=a._modelType,this._scale=a._scale}}}},{key:"mostPrecise",value:function(n,r){return n.compareTo(r)>=0?n:r}}])})(),Zn=(function(){function o(){u(this,o),o.constructor_.apply(this,arguments)}return h(o,[{key:"readResolve",value:function(){return o.nameToTypeMap.get(this._name)}},{key:"toString",value:function(){return this._name}},{key:"interfaces_",get:function(){return[E]}}],[{key:"constructor_",value:function(){this._name=null;var n=arguments[0];this._name=n,o.nameToTypeMap.put(n,this)}}])})();Zn.nameToTypeMap=new Cn,De.Type=Zn,De.FIXED=new Zn("FIXED"),De.FLOATING=new Zn("FLOATING"),De.FLOATING_SINGLE=new Zn("FLOATING SINGLE"),De.maximumPreciseValue=9007199254740992;var is=(function(o){function n(){var r;return u(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return y(n,o),h(n,[{key:"copyInternal",value:function(){for(var r=new Array(this._geometries.length).fill(null),a=0;a<r.length;a++)r[a]=this._geometries[a].copy();return new n(r,this._factory)}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof fe){var r=arguments[0],a=arguments[1];return!!this.isEquivalentClass(r)&&b(n,"equalsExact",this,1).call(this,r,a)}return b(n,"equalsExact",this,1).apply(this,arguments)}},{key:"getBoundaryDimension",value:function(){return this.isClosed()?te.FALSE:0}},{key:"isClosed",value:function(){if(this.isEmpty())return!1;for(var r=0;r<this._geometries.length;r++)if(!this._geometries[r].isClosed())return!1;return!0}},{key:"getTypeCode",value:function(){return fe.TYPECODE_MULTILINESTRING}},{key:"getDimension",value:function(){return 1}},{key:"getBoundary",value:function(){throw new Re}},{key:"getGeometryType",value:function(){return fe.TYPENAME_MULTILINESTRING}},{key:"interfaces_",get:function(){return[la]}}],[{key:"constructor_",value:function(){var r=arguments[0],a=arguments[1];lt.constructor_.call(this,r,a)}}])})(lt),di=(function(){function o(){u(this,o),o.constructor_.apply(this,arguments)}return h(o,[{key:"createEmpty",value:function(n){switch(n){case-1:return this.createGeometryCollection();case 0:return this.createPoint();case 1:return this.createLineString();case 2:return this.createPolygon();default:throw new X("Invalid dimension: "+n)}}},{key:"toGeometry",value:function(n){return n.isNull()?this.createPoint():n.getMinX()===n.getMaxX()&&n.getMinY()===n.getMaxY()?this.createPoint(new Y(n.getMinX(),n.getMinY())):n.getMinX()===n.getMaxX()||n.getMinY()===n.getMaxY()?this.createLineString([new Y(n.getMinX(),n.getMinY()),new Y(n.getMaxX(),n.getMaxY())]):this.createPolygon(this.createLinearRing([new Y(n.getMinX(),n.getMinY()),new Y(n.getMinX(),n.getMaxY()),new Y(n.getMaxX(),n.getMaxY()),new Y(n.getMaxX(),n.getMinY()),new Y(n.getMinX(),n.getMinY())]),null)}},{key:"createLineString",value:function(){if(arguments.length===0)return this.createLineString(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Array){var n=arguments[0];return this.createLineString(n!==null?this.getCoordinateSequenceFactory().create(n):null)}if(_e(arguments[0],Ee))return new hr(arguments[0],this)}}},{key:"createMultiLineString",value:function(){return arguments.length===0?new is(null,this):arguments.length===1?new is(arguments[0],this):void 0}},{key:"buildGeometry",value:function(n){for(var r=null,a=!1,l=!1,g=n.iterator();g.hasNext();){var p=g.next(),_=p.getTypeCode();r===null&&(r=_),_!==r&&(a=!0),p instanceof lt&&(l=!0)}if(r===null)return this.createGeometryCollection();if(a||l)return this.createGeometryCollection(o.toGeometryArray(n));var x=n.iterator().next();if(n.size()>1){if(x instanceof zt)return this.createMultiPolygon(o.toPolygonArray(n));if(x instanceof hr)return this.createMultiLineString(o.toLineStringArray(n));if(x instanceof hi)return this.createMultiPoint(o.toPointArray(n));re.shouldNeverReachHere("Unhandled geometry type: "+x.getGeometryType())}return x}},{key:"createMultiPointFromCoords",value:function(n){return this.createMultiPoint(n!==null?this.getCoordinateSequenceFactory().create(n):null)}},{key:"createPoint",value:function(){if(arguments.length===0)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Y){var n=arguments[0];return this.createPoint(n!==null?this.getCoordinateSequenceFactory().create([n]):null)}if(_e(arguments[0],Ee))return new hi(arguments[0],this)}}},{key:"getCoordinateSequenceFactory",value:function(){return this._coordinateSequenceFactory}},{key:"createPolygon",value:function(){if(arguments.length===0)return this.createPolygon(null,null);if(arguments.length===1){if(_e(arguments[0],Ee)){var n=arguments[0];return this.createPolygon(this.createLinearRing(n))}if(arguments[0]instanceof Array){var r=arguments[0];return this.createPolygon(this.createLinearRing(r))}if(arguments[0]instanceof yt){var a=arguments[0];return this.createPolygon(a,null)}}else if(arguments.length===2)return new zt(arguments[0],arguments[1],this)}},{key:"getSRID",value:function(){return this._SRID}},{key:"createGeometryCollection",value:function(){return arguments.length===0?new lt(null,this):arguments.length===1?new lt(arguments[0],this):void 0}},{key:"getPrecisionModel",value:function(){return this._precisionModel}},{key:"createLinearRing",value:function(){if(arguments.length===0)return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Array){var n=arguments[0];return this.createLinearRing(n!==null?this.getCoordinateSequenceFactory().create(n):null)}if(_e(arguments[0],Ee))return new yt(arguments[0],this)}}},{key:"createMultiPolygon",value:function(){return arguments.length===0?new gn(null,this):arguments.length===1?new gn(arguments[0],this):void 0}},{key:"createMultiPoint",value:function(){if(arguments.length===0)return new fi(null,this);if(arguments.length===1){if(arguments[0]instanceof Array)return new fi(arguments[0],this);if(_e(arguments[0],Ee)){var n=arguments[0];if(n===null)return this.createMultiPoint(new Array(0).fill(null));for(var r=new Array(n.size()).fill(null),a=0;a<n.size();a++){var l=this.getCoordinateSequenceFactory().create(1,n.getDimension(),n.getMeasures());Xn.copy(n,a,l,0,1),r[a]=this.createPoint(l)}return this.createMultiPoint(r)}}}},{key:"interfaces_",get:function(){return[E]}}],[{key:"constructor_",value:function(){if(this._precisionModel=null,this._coordinateSequenceFactory=null,this._SRID=null,arguments.length===0)o.constructor_.call(this,new De,0);else if(arguments.length===1){if(_e(arguments[0],Pr)){var n=arguments[0];o.constructor_.call(this,new De,0,n)}else if(arguments[0]instanceof De){var r=arguments[0];o.constructor_.call(this,r,0,o.getDefaultCoordinateSequenceFactory())}}else if(arguments.length===2){var a=arguments[0],l=arguments[1];o.constructor_.call(this,a,l,o.getDefaultCoordinateSequenceFactory())}else if(arguments.length===3){var g=arguments[0],p=arguments[1],_=arguments[2];this._precisionModel=g,this._coordinateSequenceFactory=_,this._SRID=p}}},{key:"toMultiPolygonArray",value:function(n){var r=new Array(n.size()).fill(null);return n.toArray(r)}},{key:"toGeometryArray",value:function(n){if(n===null)return null;var r=new Array(n.size()).fill(null);return n.toArray(r)}},{key:"getDefaultCoordinateSequenceFactory",value:function(){return tt.instance()}},{key:"toMultiLineStringArray",value:function(n){var r=new Array(n.size()).fill(null);return n.toArray(r)}},{key:"toLineStringArray",value:function(n){var r=new Array(n.size()).fill(null);return n.toArray(r)}},{key:"toMultiPointArray",value:function(n){var r=new Array(n.size()).fill(null);return n.toArray(r)}},{key:"toLinearRingArray",value:function(n){var r=new Array(n.size()).fill(null);return n.toArray(r)}},{key:"toPointArray",value:function(n){var r=new Array(n.size()).fill(null);return n.toArray(r)}},{key:"toPolygonArray",value:function(n){var r=new Array(n.size()).fill(null);return n.toArray(r)}},{key:"createPointFromInternalCoord",value:function(n,r){return r.getPrecisionModel().makePrecise(n),r.getFactory().createPoint(n)}}])})(),Lo="XY",wp="XYZ",kp="XYM",xp="XYZM",Ql={POINT:"Point",LINE_STRING:"LineString",LINEAR_RING:"LinearRing",POLYGON:"Polygon",MULTI_POINT:"MultiPoint",MULTI_LINE_STRING:"MultiLineString",MULTI_POLYGON:"MultiPolygon",GEOMETRY_COLLECTION:"GeometryCollection",CIRCLE:"Circle"},ec="EMPTY",ha=1,Wn=2,fr=3,tc=4,pi=5,Ep=6;for(var bp in Ql)Ql[bp].toUpperCase();var Sp=(function(){return h((function o(n){u(this,o),this.wkt=n,this.index_=-1}),[{key:"isAlpha_",value:function(o){return o>="a"&&o<="z"||o>="A"&&o<="Z"}},{key:"isNumeric_",value:function(o,n){return o>="0"&&o<="9"||o=="."&&!(n!==void 0&&n)}},{key:"isWhiteSpace_",value:function(o){return o==" "||o==" "||o=="\r"||o==`
|
|
210
|
+
`}},{key:"nextChar_",value:function(){return this.wkt.charAt(++this.index_)}},{key:"nextToken",value:function(){var o,n=this.nextChar_(),r=this.index_,a=n;if(n=="(")o=Wn;else if(n==",")o=pi;else if(n==")")o=fr;else if(this.isNumeric_(n)||n=="-")o=tc,a=this.readNumber_();else if(this.isAlpha_(n))o=ha,a=this.readText_();else{if(this.isWhiteSpace_(n))return this.nextToken();if(n!=="")throw new Error("Unexpected character: "+n);o=Ep}return{position:r,value:a,type:o}}},{key:"readNumber_",value:function(){var o,n=this.index_,r=!1,a=!1;do o=="."?r=!0:o!="e"&&o!="E"||(a=!0),o=this.nextChar_();while(this.isNumeric_(o,r)||!a&&(o=="e"||o=="E")||a&&(o=="-"||o=="+"));return parseFloat(this.wkt.substring(n,this.index_--))}},{key:"readText_",value:function(){var o,n=this.index_;do o=this.nextChar_();while(this.isAlpha_(o));return this.wkt.substring(n,this.index_--).toUpperCase()}}])})(),Ip=(function(){return h((function o(n,r){u(this,o),this.lexer_=n,this.token_,this.layout_=Lo,this.factory=r}),[{key:"consume_",value:function(){this.token_=this.lexer_.nextToken()}},{key:"isTokenType",value:function(o){return this.token_.type==o}},{key:"match",value:function(o){var n=this.isTokenType(o);return n&&this.consume_(),n}},{key:"parse",value:function(){return this.consume_(),this.parseGeometry_()}},{key:"parseGeometryLayout_",value:function(){var o=Lo,n=this.token_;if(this.isTokenType(ha)){var r=n.value;r==="Z"?o=wp:r==="M"?o=kp:r==="ZM"&&(o=xp),o!==Lo&&this.consume_()}return o}},{key:"parseGeometryCollectionText_",value:function(){if(this.match(Wn)){var o=[];do o.push(this.parseGeometry_());while(this.match(pi));if(this.match(fr))return o}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parsePointText_",value:function(){if(this.match(Wn)){var o=this.parsePoint_();if(this.match(fr))return o}else if(this.isEmptyGeometry_())return null;throw new Error(this.formatErrorMessage_())}},{key:"parseLineStringText_",value:function(){if(this.match(Wn)){var o=this.parsePointList_();if(this.match(fr))return o}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parsePolygonText_",value:function(){if(this.match(Wn)){var o=this.parseLineStringTextList_();if(this.match(fr))return o}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parseMultiPointText_",value:function(){var o;if(this.match(Wn)){if(o=this.token_.type==Wn?this.parsePointTextList_():this.parsePointList_(),this.match(fr))return o}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parseMultiLineStringText_",value:function(){if(this.match(Wn)){var o=this.parseLineStringTextList_();if(this.match(fr))return o}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parseMultiPolygonText_",value:function(){if(this.match(Wn)){var o=this.parsePolygonTextList_();if(this.match(fr))return o}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parsePoint_",value:function(){for(var o=[],n=this.layout_.length,r=0;r<n;++r){var a=this.token_;if(!this.match(tc))break;o.push(a.value)}if(o.length==n)return o;throw new Error(this.formatErrorMessage_())}},{key:"parsePointList_",value:function(){for(var o=[this.parsePoint_()];this.match(pi);)o.push(this.parsePoint_());return o}},{key:"parsePointTextList_",value:function(){for(var o=[this.parsePointText_()];this.match(pi);)o.push(this.parsePointText_());return o}},{key:"parseLineStringTextList_",value:function(){for(var o=[this.parseLineStringText_()];this.match(pi);)o.push(this.parseLineStringText_());return o}},{key:"parsePolygonTextList_",value:function(){for(var o=[this.parsePolygonText_()];this.match(pi);)o.push(this.parsePolygonText_());return o}},{key:"isEmptyGeometry_",value:function(){var o=this.isTokenType(ha)&&this.token_.value==ec;return o&&this.consume_(),o}},{key:"formatErrorMessage_",value:function(){return"Unexpected `"+this.token_.value+"` at position "+this.token_.position+" in `"+this.lexer_.wkt+"`"}},{key:"parseGeometry_",value:function(){var o=this.factory,n=function(me){return c(Y,P(me))},r=function(me){var Pe=me.map((function(Le){return o.createLinearRing(Le.map(n))}));return Pe.length>1?o.createPolygon(Pe[0],Pe.slice(1)):o.createPolygon(Pe[0])},a=this.token_;if(this.match(ha)){var l=a.value;if(this.layout_=this.parseGeometryLayout_(),l=="GEOMETRYCOLLECTION"){var g=this.parseGeometryCollectionText_();return o.createGeometryCollection(g)}switch(l){case"POINT":var p=this.parsePointText_();return p?o.createPoint(c(Y,P(p))):o.createPoint();case"LINESTRING":var _=this.parseLineStringText_().map(n);return o.createLineString(_);case"LINEARRING":var x=this.parseLineStringText_().map(n);return o.createLinearRing(x);case"POLYGON":var I=this.parsePolygonText_();return I&&I.length!==0?r(I):o.createPolygon();case"MULTIPOINT":var z=this.parseMultiPointText_();if(!z||z.length===0)return o.createMultiPoint();var J=z.map(n).map((function(me){return o.createPoint(me)}));return o.createMultiPoint(J);case"MULTILINESTRING":var Q=this.parseMultiLineStringText_().map((function(me){return o.createLineString(me.map(n))}));return o.createMultiLineString(Q);case"MULTIPOLYGON":var le=this.parseMultiPolygonText_();if(!le||le.length===0)return o.createMultiPolygon();var de=le.map(r);return o.createMultiPolygon(de);default:throw new Error("Invalid geometry type: "+l)}}throw new Error(this.formatErrorMessage_())}}])})();function nc(o){if(o.isEmpty())return"";var n=o.getCoordinate(),r=[n.x,n.y];return n.z===void 0||Number.isNaN(n.z)||r.push(n.z),n.m===void 0||Number.isNaN(n.m)||r.push(n.m),r.join(" ")}function ss(o){for(var n=o.getCoordinates().map((function(g){var p=[g.x,g.y];return g.z===void 0||Number.isNaN(g.z)||p.push(g.z),g.m===void 0||Number.isNaN(g.m)||p.push(g.m),p})),r=[],a=0,l=n.length;a<l;++a)r.push(n[a].join(" "));return r.join(", ")}function rc(o){var n=[];n.push("("+ss(o.getExteriorRing())+")");for(var r=0,a=o.getNumInteriorRing();r<a;++r)n.push("("+ss(o.getInteriorRingN(r))+")");return n.join(", ")}var Mp={Point:nc,LineString:ss,LinearRing:ss,Polygon:rc,MultiPoint:function(o){for(var n=[],r=0,a=o.getNumGeometries();r<a;++r)n.push("("+nc(o.getGeometryN(r))+")");return n.join(", ")},MultiLineString:function(o){for(var n=[],r=0,a=o.getNumGeometries();r<a;++r)n.push("("+ss(o.getGeometryN(r))+")");return n.join(", ")},MultiPolygon:function(o){for(var n=[],r=0,a=o.getNumGeometries();r<a;++r)n.push("("+rc(o.getGeometryN(r))+")");return n.join(", ")},GeometryCollection:function(o){for(var n=[],r=0,a=o.getNumGeometries();r<a;++r)n.push(ic(o.getGeometryN(r)));return n.join(", ")}};function ic(o){var n=o.getGeometryType(),r=Mp[n];n=n.toUpperCase();var a=(function(l){var g="";if(l.isEmpty())return g;var p=l.getCoordinate();return p.z===void 0||Number.isNaN(p.z)||(g+="Z"),p.m===void 0||Number.isNaN(p.m)||(g+="M"),g})(o);return a.length>0&&(n+=" "+a),o.isEmpty()?n+" "+ec:n+" ("+r(o)+")"}var Np=(function(){return h((function o(n){u(this,o),this.geometryFactory=n||new di,this.precisionModel=this.geometryFactory.getPrecisionModel()}),[{key:"read",value:function(o){return new Ip(new Sp(o),this.geometryFactory).parse()}},{key:"write",value:function(o){return ic(o)}}])})(),Co=(function(){return h((function o(n){u(this,o),this.parser=new Np(n)}),[{key:"write",value:function(o){return this.parser.write(o)}}],[{key:"toLineString",value:function(o,n){if(arguments.length!==2)throw new Error("Not implemented");return"LINESTRING ( "+o.x+" "+o.y+", "+n.x+" "+n.y+" )"}}])})(),Ye=(function(){function o(){u(this,o),o.constructor_.apply(this,arguments)}return h(o,[{key:"getIndexAlongSegment",value:function(n,r){return this.computeIntLineIndex(),this._intLineIndex[n][r]}},{key:"getTopologySummary",value:function(){var n=new Ne;return this.isEndPoint()&&n.append(" endpoint"),this._isProper&&n.append(" proper"),this.isCollinear()&&n.append(" collinear"),n.toString()}},{key:"computeIntersection",value:function(n,r,a,l){this._inputLines[0][0]=n,this._inputLines[0][1]=r,this._inputLines[1][0]=a,this._inputLines[1][1]=l,this._result=this.computeIntersect(n,r,a,l)}},{key:"getIntersectionNum",value:function(){return this._result}},{key:"computeIntLineIndex",value:function(){if(arguments.length===0)this._intLineIndex===null&&(this._intLineIndex=Array(2).fill().map((function(){return Array(2)})),this.computeIntLineIndex(0),this.computeIntLineIndex(1));else if(arguments.length===1){var n=arguments[0];this.getEdgeDistance(n,0)>this.getEdgeDistance(n,1)?(this._intLineIndex[n][0]=0,this._intLineIndex[n][1]=1):(this._intLineIndex[n][0]=1,this._intLineIndex[n][1]=0)}}},{key:"isProper",value:function(){return this.hasIntersection()&&this._isProper}},{key:"setPrecisionModel",value:function(n){this._precisionModel=n}},{key:"isInteriorIntersection",value:function(){if(arguments.length===0)return!!this.isInteriorIntersection(0)||!!this.isInteriorIntersection(1);if(arguments.length===1){for(var n=arguments[0],r=0;r<this._result;r++)if(!this._intPt[r].equals2D(this._inputLines[n][0])&&!this._intPt[r].equals2D(this._inputLines[n][1]))return!0;return!1}}},{key:"getIntersection",value:function(n){return this._intPt[n]}},{key:"isEndPoint",value:function(){return this.hasIntersection()&&!this._isProper}},{key:"hasIntersection",value:function(){return this._result!==o.NO_INTERSECTION}},{key:"getEdgeDistance",value:function(n,r){return o.computeEdgeDistance(this._intPt[r],this._inputLines[n][0],this._inputLines[n][1])}},{key:"isCollinear",value:function(){return this._result===o.COLLINEAR_INTERSECTION}},{key:"toString",value:function(){return Co.toLineString(this._inputLines[0][0],this._inputLines[0][1])+" - "+Co.toLineString(this._inputLines[1][0],this._inputLines[1][1])+this.getTopologySummary()}},{key:"getEndpoint",value:function(n,r){return this._inputLines[n][r]}},{key:"isIntersection",value:function(n){for(var r=0;r<this._result;r++)if(this._intPt[r].equals2D(n))return!0;return!1}},{key:"getIntersectionAlongSegment",value:function(n,r){return this.computeIntLineIndex(),this._intPt[this._intLineIndex[n][r]]}}],[{key:"constructor_",value:function(){this._result=null,this._inputLines=Array(2).fill().map((function(){return Array(2)})),this._intPt=new Array(2).fill(null),this._intLineIndex=null,this._isProper=null,this._pa=null,this._pb=null,this._precisionModel=null,this._intPt[0]=new Y,this._intPt[1]=new Y,this._pa=this._intPt[0],this._pb=this._intPt[1],this._result=0}},{key:"computeEdgeDistance",value:function(n,r,a){var l=Math.abs(a.x-r.x),g=Math.abs(a.y-r.y),p=-1;if(n.equals(r))p=0;else if(n.equals(a))p=l>g?l:g;else{var _=Math.abs(n.x-r.x),x=Math.abs(n.y-r.y);(p=l>g?_:x)!==0||n.equals(r)||(p=Math.max(_,x))}return re.isTrue(!(p===0&&!n.equals(r)),"Bad distance calculation"),p}},{key:"nonRobustComputeEdgeDistance",value:function(n,r,a){var l=n.x-r.x,g=n.y-r.y,p=Math.sqrt(l*l+g*g);return re.isTrue(!(p===0&&!n.equals(r)),"Invalid distance calculation"),p}}])})();Ye.DONT_INTERSECT=0,Ye.DO_INTERSECT=1,Ye.COLLINEAR=2,Ye.NO_INTERSECTION=0,Ye.POINT_INTERSECTION=1,Ye.COLLINEAR_INTERSECTION=2;var Fr=(function(o){function n(){return u(this,n),s(this,n)}return y(n,o),h(n,[{key:"isInSegmentEnvelopes",value:function(r){var a=new be(this._inputLines[0][0],this._inputLines[0][1]),l=new be(this._inputLines[1][0],this._inputLines[1][1]);return a.contains(r)&&l.contains(r)}},{key:"computeIntersection",value:function(){if(arguments.length!==3)return b(n,"computeIntersection",this,1).apply(this,arguments);var r=arguments[0],a=arguments[1],l=arguments[2];if(this._isProper=!1,be.intersects(a,l,r)&&ve.index(a,l,r)===0&&ve.index(l,a,r)===0)return this._isProper=!0,(r.equals(a)||r.equals(l))&&(this._isProper=!1),this._result=Ye.POINT_INTERSECTION,null;this._result=Ye.NO_INTERSECTION}},{key:"intersection",value:function(r,a,l,g){var p=this.intersectionSafe(r,a,l,g);return this.isInSegmentEnvelopes(p)||(p=new Y(n.nearestEndpoint(r,a,l,g))),this._precisionModel!==null&&this._precisionModel.makePrecise(p),p}},{key:"checkDD",value:function(r,a,l,g,p){var _=Cr.intersection(r,a,l,g),x=this.isInSegmentEnvelopes(_);gt.out.println("DD in env = "+x+" --------------------- "+_),p.distance(_)>1e-4&>.out.println("Distance = "+p.distance(_))}},{key:"intersectionSafe",value:function(r,a,l,g){var p=Ar.intersection(r,a,l,g);return p===null&&(p=n.nearestEndpoint(r,a,l,g)),p}},{key:"computeCollinearIntersection",value:function(r,a,l,g){var p=be.intersects(r,a,l),_=be.intersects(r,a,g),x=be.intersects(l,g,r),I=be.intersects(l,g,a);return p&&_?(this._intPt[0]=l,this._intPt[1]=g,Ye.COLLINEAR_INTERSECTION):x&&I?(this._intPt[0]=r,this._intPt[1]=a,Ye.COLLINEAR_INTERSECTION):p&&x?(this._intPt[0]=l,this._intPt[1]=r,!l.equals(r)||_||I?Ye.COLLINEAR_INTERSECTION:Ye.POINT_INTERSECTION):p&&I?(this._intPt[0]=l,this._intPt[1]=a,!l.equals(a)||_||x?Ye.COLLINEAR_INTERSECTION:Ye.POINT_INTERSECTION):_&&x?(this._intPt[0]=g,this._intPt[1]=r,!g.equals(r)||p||I?Ye.COLLINEAR_INTERSECTION:Ye.POINT_INTERSECTION):_&&I?(this._intPt[0]=g,this._intPt[1]=a,!g.equals(a)||p||x?Ye.COLLINEAR_INTERSECTION:Ye.POINT_INTERSECTION):Ye.NO_INTERSECTION}},{key:"computeIntersect",value:function(r,a,l,g){if(this._isProper=!1,!be.intersects(r,a,l,g))return Ye.NO_INTERSECTION;var p=ve.index(r,a,l),_=ve.index(r,a,g);if(p>0&&_>0||p<0&&_<0)return Ye.NO_INTERSECTION;var x=ve.index(l,g,r),I=ve.index(l,g,a);return x>0&&I>0||x<0&&I<0?Ye.NO_INTERSECTION:p===0&&_===0&&x===0&&I===0?this.computeCollinearIntersection(r,a,l,g):(p===0||_===0||x===0||I===0?(this._isProper=!1,r.equals2D(l)||r.equals2D(g)?this._intPt[0]=r:a.equals2D(l)||a.equals2D(g)?this._intPt[0]=a:p===0?this._intPt[0]=new Y(l):_===0?this._intPt[0]=new Y(g):x===0?this._intPt[0]=new Y(r):I===0&&(this._intPt[0]=new Y(a))):(this._isProper=!0,this._intPt[0]=this.intersection(r,a,l,g)),Ye.POINT_INTERSECTION)}}],[{key:"nearestEndpoint",value:function(r,a,l,g){var p=r,_=vt.pointToSegment(r,l,g),x=vt.pointToSegment(a,l,g);return x<_&&(_=x,p=a),(x=vt.pointToSegment(l,r,a))<_&&(_=x,p=l),(x=vt.pointToSegment(g,r,a))<_&&(_=x,p=g),p}}])})(Ye),Lp=(function(){function o(){u(this,o),o.constructor_.apply(this,arguments)}return h(o,[{key:"countSegment",value:function(n,r){if(n.x<this._p.x&&r.x<this._p.x)return null;if(this._p.x===r.x&&this._p.y===r.y)return this._isPointOnSegment=!0,null;if(n.y===this._p.y&&r.y===this._p.y){var a=n.x,l=r.x;return a>l&&(a=r.x,l=n.x),this._p.x>=a&&this._p.x<=l&&(this._isPointOnSegment=!0),null}if(n.y>this._p.y&&r.y<=this._p.y||r.y>this._p.y&&n.y<=this._p.y){var g=ve.index(n,r,this._p);if(g===ve.COLLINEAR)return this._isPointOnSegment=!0,null;r.y<n.y&&(g=-g),g===ve.LEFT&&this._crossingCount++}}},{key:"isPointInPolygon",value:function(){return this.getLocation()!==C.EXTERIOR}},{key:"getLocation",value:function(){return this._isPointOnSegment?C.BOUNDARY:this._crossingCount%2==1?C.INTERIOR:C.EXTERIOR}},{key:"isOnSegment",value:function(){return this._isPointOnSegment}}],[{key:"constructor_",value:function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var n=arguments[0];this._p=n}},{key:"locatePointInRing",value:function(){if(arguments[0]instanceof Y&&_e(arguments[1],Ee)){for(var n=arguments[1],r=new o(arguments[0]),a=new Y,l=new Y,g=1;g<n.size();g++)if(n.getCoordinate(g,a),n.getCoordinate(g-1,l),r.countSegment(a,l),r.isOnSegment())return r.getLocation();return r.getLocation()}if(arguments[0]instanceof Y&&arguments[1]instanceof Array){for(var p=arguments[1],_=new o(arguments[0]),x=1;x<p.length;x++){var I=p[x],z=p[x-1];if(_.countSegment(I,z),_.isOnSegment())return _.getLocation()}return _.getLocation()}}}])})(),Ao=(function(){function o(){u(this,o)}return h(o,null,[{key:"isOnLine",value:function(){if(arguments[0]instanceof Y&&_e(arguments[1],Ee)){for(var n=arguments[0],r=arguments[1],a=new Fr,l=new Y,g=new Y,p=r.size(),_=1;_<p;_++)if(r.getCoordinate(_-1,l),r.getCoordinate(_,g),a.computeIntersection(n,l,g),a.hasIntersection())return!0;return!1}if(arguments[0]instanceof Y&&arguments[1]instanceof Array){for(var x=arguments[0],I=arguments[1],z=new Fr,J=1;J<I.length;J++){var Q=I[J-1],le=I[J];if(z.computeIntersection(x,Q,le),z.hasIntersection())return!0}return!1}}},{key:"locateInRing",value:function(n,r){return Lp.locatePointInRing(n,r)}},{key:"isInRing",value:function(n,r){return o.locateInRing(n,r)!==C.EXTERIOR}}])})(),jt=(function(){function o(){u(this,o),o.constructor_.apply(this,arguments)}return h(o,[{key:"setAllLocations",value:function(n){for(var r=0;r<this.location.length;r++)this.location[r]=n}},{key:"isNull",value:function(){for(var n=0;n<this.location.length;n++)if(this.location[n]!==C.NONE)return!1;return!0}},{key:"setAllLocationsIfNull",value:function(n){for(var r=0;r<this.location.length;r++)this.location[r]===C.NONE&&(this.location[r]=n)}},{key:"isLine",value:function(){return this.location.length===1}},{key:"merge",value:function(n){if(n.location.length>this.location.length){var r=new Array(3).fill(null);r[ne.ON]=this.location[ne.ON],r[ne.LEFT]=C.NONE,r[ne.RIGHT]=C.NONE,this.location=r}for(var a=0;a<this.location.length;a++)this.location[a]===C.NONE&&a<n.location.length&&(this.location[a]=n.location[a])}},{key:"getLocations",value:function(){return this.location}},{key:"flip",value:function(){if(this.location.length<=1)return null;var n=this.location[ne.LEFT];this.location[ne.LEFT]=this.location[ne.RIGHT],this.location[ne.RIGHT]=n}},{key:"toString",value:function(){var n=new Vn;return this.location.length>1&&n.append(C.toLocationSymbol(this.location[ne.LEFT])),n.append(C.toLocationSymbol(this.location[ne.ON])),this.location.length>1&&n.append(C.toLocationSymbol(this.location[ne.RIGHT])),n.toString()}},{key:"setLocations",value:function(n,r,a){this.location[ne.ON]=n,this.location[ne.LEFT]=r,this.location[ne.RIGHT]=a}},{key:"get",value:function(n){return n<this.location.length?this.location[n]:C.NONE}},{key:"isArea",value:function(){return this.location.length>1}},{key:"isAnyNull",value:function(){for(var n=0;n<this.location.length;n++)if(this.location[n]===C.NONE)return!0;return!1}},{key:"setLocation",value:function(){if(arguments.length===1){var n=arguments[0];this.setLocation(ne.ON,n)}else if(arguments.length===2){var r=arguments[0],a=arguments[1];this.location[r]=a}}},{key:"init",value:function(n){this.location=new Array(n).fill(null),this.setAllLocations(C.NONE)}},{key:"isEqualOnSide",value:function(n,r){return this.location[r]===n.location[r]}},{key:"allPositionsEqual",value:function(n){for(var r=0;r<this.location.length;r++)if(this.location[r]!==n)return!1;return!0}}],[{key:"constructor_",value:function(){if(this.location=null,arguments.length===1){if(arguments[0]instanceof Array){var n=arguments[0];this.init(n.length)}else if(Number.isInteger(arguments[0])){var r=arguments[0];this.init(1),this.location[ne.ON]=r}else if(arguments[0]instanceof o){var a=arguments[0];if(this.init(a.location.length),a!==null)for(var l=0;l<this.location.length;l++)this.location[l]=a.location[l]}}else if(arguments.length===3){var g=arguments[0],p=arguments[1],_=arguments[2];this.init(3),this.location[ne.ON]=g,this.location[ne.LEFT]=p,this.location[ne.RIGHT]=_}}}])})(),qt=(function(){function o(){u(this,o),o.constructor_.apply(this,arguments)}return h(o,[{key:"getGeometryCount",value:function(){var n=0;return this.elt[0].isNull()||n++,this.elt[1].isNull()||n++,n}},{key:"setAllLocations",value:function(n,r){this.elt[n].setAllLocations(r)}},{key:"isNull",value:function(n){return this.elt[n].isNull()}},{key:"setAllLocationsIfNull",value:function(){if(arguments.length===1){var n=arguments[0];this.setAllLocationsIfNull(0,n),this.setAllLocationsIfNull(1,n)}else if(arguments.length===2){var r=arguments[0],a=arguments[1];this.elt[r].setAllLocationsIfNull(a)}}},{key:"isLine",value:function(n){return this.elt[n].isLine()}},{key:"merge",value:function(n){for(var r=0;r<2;r++)this.elt[r]===null&&n.elt[r]!==null?this.elt[r]=new jt(n.elt[r]):this.elt[r].merge(n.elt[r])}},{key:"flip",value:function(){this.elt[0].flip(),this.elt[1].flip()}},{key:"getLocation",value:function(){if(arguments.length===1){var n=arguments[0];return this.elt[n].get(ne.ON)}if(arguments.length===2){var r=arguments[0],a=arguments[1];return this.elt[r].get(a)}}},{key:"toString",value:function(){var n=new Vn;return this.elt[0]!==null&&(n.append("A:"),n.append(this.elt[0].toString())),this.elt[1]!==null&&(n.append(" B:"),n.append(this.elt[1].toString())),n.toString()}},{key:"isArea",value:function(){if(arguments.length===0)return this.elt[0].isArea()||this.elt[1].isArea();if(arguments.length===1){var n=arguments[0];return this.elt[n].isArea()}}},{key:"isAnyNull",value:function(n){return this.elt[n].isAnyNull()}},{key:"setLocation",value:function(){if(arguments.length===2){var n=arguments[0],r=arguments[1];this.elt[n].setLocation(ne.ON,r)}else if(arguments.length===3){var a=arguments[0],l=arguments[1],g=arguments[2];this.elt[a].setLocation(l,g)}}},{key:"isEqualOnSide",value:function(n,r){return this.elt[0].isEqualOnSide(n.elt[0],r)&&this.elt[1].isEqualOnSide(n.elt[1],r)}},{key:"allPositionsEqual",value:function(n,r){return this.elt[n].allPositionsEqual(r)}},{key:"toLine",value:function(n){this.elt[n].isArea()&&(this.elt[n]=new jt(this.elt[n].location[0]))}}],[{key:"constructor_",value:function(){if(this.elt=new Array(2).fill(null),arguments.length===1){if(Number.isInteger(arguments[0])){var n=arguments[0];this.elt[0]=new jt(n),this.elt[1]=new jt(n)}else if(arguments[0]instanceof o){var r=arguments[0];this.elt[0]=new jt(r.elt[0]),this.elt[1]=new jt(r.elt[1])}}else if(arguments.length===2){var a=arguments[0],l=arguments[1];this.elt[0]=new jt(C.NONE),this.elt[1]=new jt(C.NONE),this.elt[a].setLocation(l)}else if(arguments.length===3){var g=arguments[0],p=arguments[1],_=arguments[2];this.elt[0]=new jt(g,p,_),this.elt[1]=new jt(g,p,_)}else if(arguments.length===4){var x=arguments[0],I=arguments[1],z=arguments[2],J=arguments[3];this.elt[0]=new jt(C.NONE,C.NONE,C.NONE),this.elt[1]=new jt(C.NONE,C.NONE,C.NONE),this.elt[x].setLocations(I,z,J)}}},{key:"toLineLabel",value:function(n){for(var r=new o(C.NONE),a=0;a<2;a++)r.setLocation(a,n.getLocation(a));return r}}])})(),fa=(function(){return h((function o(){u(this,o),o.constructor_.apply(this,arguments)}),[{key:"computeRing",value:function(){if(this._ring!==null)return null;for(var o=new Array(this._pts.size()).fill(null),n=0;n<this._pts.size();n++)o[n]=this._pts.get(n);this._ring=this._geometryFactory.createLinearRing(o),this._isHole=ve.isCCW(this._ring.getCoordinates())}},{key:"isIsolated",value:function(){return this._label.getGeometryCount()===1}},{key:"computePoints",value:function(o){this._startDe=o;var n=o,r=!0;do{if(n===null)throw new Ut("Found null DirectedEdge");if(n.getEdgeRing()===this)throw new Ut("Directed Edge visited twice during ring-building at "+n.getCoordinate());this._edges.add(n);var a=n.getLabel();re.isTrue(a.isArea()),this.mergeLabel(a),this.addPoints(n.getEdge(),n.isForward(),r),r=!1,this.setEdgeRing(n,this),n=this.getNext(n)}while(n!==this._startDe)}},{key:"getLinearRing",value:function(){return this._ring}},{key:"getCoordinate",value:function(o){return this._pts.get(o)}},{key:"computeMaxNodeDegree",value:function(){this._maxNodeDegree=0;var o=this._startDe;do{var n=o.getNode().getEdges().getOutgoingDegree(this);n>this._maxNodeDegree&&(this._maxNodeDegree=n),o=this.getNext(o)}while(o!==this._startDe);this._maxNodeDegree*=2}},{key:"addPoints",value:function(o,n,r){var a=o.getCoordinates();if(n){var l=1;r&&(l=0);for(var g=l;g<a.length;g++)this._pts.add(a[g])}else{var p=a.length-2;r&&(p=a.length-1);for(var _=p;_>=0;_--)this._pts.add(a[_])}}},{key:"isHole",value:function(){return this._isHole}},{key:"setInResult",value:function(){var o=this._startDe;do o.getEdge().setInResult(!0),o=o.getNext();while(o!==this._startDe)}},{key:"containsPoint",value:function(o){var n=this.getLinearRing();if(!n.getEnvelopeInternal().contains(o)||!Ao.isInRing(o,n.getCoordinates()))return!1;for(var r=this._holes.iterator();r.hasNext();)if(r.next().containsPoint(o))return!1;return!0}},{key:"addHole",value:function(o){this._holes.add(o)}},{key:"isShell",value:function(){return this._shell===null}},{key:"getLabel",value:function(){return this._label}},{key:"getEdges",value:function(){return this._edges}},{key:"getMaxNodeDegree",value:function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree}},{key:"getShell",value:function(){return this._shell}},{key:"mergeLabel",value:function(){if(arguments.length===1){var o=arguments[0];this.mergeLabel(o,0),this.mergeLabel(o,1)}else if(arguments.length===2){var n=arguments[1],r=arguments[0].getLocation(n,ne.RIGHT);if(r===C.NONE)return null;if(this._label.getLocation(n)===C.NONE)return this._label.setLocation(n,r),null}}},{key:"setShell",value:function(o){this._shell=o,o!==null&&o.addHole(this)}},{key:"toPolygon",value:function(o){for(var n=new Array(this._holes.size()).fill(null),r=0;r<this._holes.size();r++)n[r]=this._holes.get(r).getLinearRing();return o.createPolygon(this.getLinearRing(),n)}}],[{key:"constructor_",value:function(){if(this._startDe=null,this._maxNodeDegree=-1,this._edges=new pe,this._pts=new pe,this._label=new qt(C.NONE),this._ring=null,this._isHole=null,this._shell=null,this._holes=new pe,this._geometryFactory=null,arguments.length!==0&&arguments.length===2){var o=arguments[0],n=arguments[1];this._geometryFactory=n,this.computePoints(o),this.computeRing()}}}])})(),Cp=(function(o){function n(){var r;return u(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return y(n,o),h(n,[{key:"setEdgeRing",value:function(r,a){r.setMinEdgeRing(a)}},{key:"getNext",value:function(r){return r.getNextMin()}}],[{key:"constructor_",value:function(){var r=arguments[0],a=arguments[1];fa.constructor_.call(this,r,a)}}])})(fa),Ap=(function(o){function n(){var r;return u(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return y(n,o),h(n,[{key:"buildMinimalRings",value:function(){var r=new pe,a=this._startDe;do{if(a.getMinEdgeRing()===null){var l=new Cp(a,this._geometryFactory);r.add(l)}a=a.getNext()}while(a!==this._startDe);return r}},{key:"setEdgeRing",value:function(r,a){r.setEdgeRing(a)}},{key:"linkDirectedEdgesForMinimalEdgeRings",value:function(){var r=this._startDe;do r.getNode().getEdges().linkMinimalDirectedEdges(this),r=r.getNext();while(r!==this._startDe)}},{key:"getNext",value:function(r){return r.getNext()}}],[{key:"constructor_",value:function(){var r=arguments[0],a=arguments[1];fa.constructor_.call(this,r,a)}}])})(fa),sc=(function(){return h((function o(){u(this,o),o.constructor_.apply(this,arguments)}),[{key:"setVisited",value:function(o){this._isVisited=o}},{key:"setInResult",value:function(o){this._isInResult=o}},{key:"isCovered",value:function(){return this._isCovered}},{key:"isCoveredSet",value:function(){return this._isCoveredSet}},{key:"setLabel",value:function(o){this._label=o}},{key:"getLabel",value:function(){return this._label}},{key:"setCovered",value:function(o){this._isCovered=o,this._isCoveredSet=!0}},{key:"updateIM",value:function(o){re.isTrue(this._label.getGeometryCount()>=2,"found partial label"),this.computeIM(o)}},{key:"isInResult",value:function(){return this._isInResult}},{key:"isVisited",value:function(){return this._isVisited}}],[{key:"constructor_",value:function(){if(this._label=null,this._isInResult=!1,this._isCovered=!1,this._isCoveredSet=!1,this._isVisited=!1,arguments.length!==0&&arguments.length===1){var o=arguments[0];this._label=o}}}])})(),ga=(function(o){function n(){var r;return u(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return y(n,o),h(n,[{key:"isIncidentEdgeInResult",value:function(){for(var r=this.getEdges().getEdges().iterator();r.hasNext();)if(r.next().getEdge().isInResult())return!0;return!1}},{key:"isIsolated",value:function(){return this._label.getGeometryCount()===1}},{key:"getCoordinate",value:function(){return this._coord}},{key:"print",value:function(r){r.println("node "+this._coord+" lbl: "+this._label)}},{key:"computeIM",value:function(r){}},{key:"computeMergedLocation",value:function(r,a){var l=C.NONE;if(l=this._label.getLocation(a),!r.isNull(a)){var g=r.getLocation(a);l!==C.BOUNDARY&&(l=g)}return l}},{key:"setLabel",value:function(){if(arguments.length!==2||!Number.isInteger(arguments[1])||!Number.isInteger(arguments[0]))return b(n,"setLabel",this,1).apply(this,arguments);var r=arguments[0],a=arguments[1];this._label===null?this._label=new qt(r,a):this._label.setLocation(r,a)}},{key:"getEdges",value:function(){return this._edges}},{key:"mergeLabel",value:function(){if(arguments[0]instanceof n){var r=arguments[0];this.mergeLabel(r._label)}else if(arguments[0]instanceof qt)for(var a=arguments[0],l=0;l<2;l++){var g=this.computeMergedLocation(a,l);this._label.getLocation(l)===C.NONE&&this._label.setLocation(l,g)}}},{key:"add",value:function(r){this._edges.insert(r),r.setNode(this)}},{key:"setLabelBoundary",value:function(r){if(this._label===null)return null;var a=C.NONE;this._label!==null&&(a=this._label.getLocation(r));var l=null;switch(a){case C.BOUNDARY:l=C.INTERIOR;break;case C.INTERIOR:default:l=C.BOUNDARY}this._label.setLocation(r,l)}}],[{key:"constructor_",value:function(){this._coord=null,this._edges=null;var r=arguments[0],a=arguments[1];this._coord=r,this._edges=a,this._label=new qt(0,C.NONE)}}])})(sc),Tp=(function(o){function n(){return u(this,n),s(this,n,arguments)}return y(n,o),h(n)})(nt);function ac(o){return o==null?0:o.color}function Te(o){return o==null?null:o.parent}function An(o,n){o!==null&&(o.color=n)}function To(o){return o==null?null:o.left}function oc(o){return o==null?null:o.right}var as=(function(o){function n(){var r;return u(this,n),(r=s(this,n)).root_=null,r.size_=0,r}return y(n,o),h(n,[{key:"get",value:function(r){for(var a=this.root_;a!==null;){var l=r.compareTo(a.key);if(l<0)a=a.left;else{if(!(l>0))return a.value;a=a.right}}return null}},{key:"put",value:function(r,a){if(this.root_===null)return this.root_={key:r,value:a,left:null,right:null,parent:null,color:0,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var l,g,p=this.root_;do if(l=p,(g=r.compareTo(p.key))<0)p=p.left;else{if(!(g>0)){var _=p.value;return p.value=a,_}p=p.right}while(p!==null);var x={key:r,left:null,right:null,value:a,parent:l,color:0,getValue:function(){return this.value},getKey:function(){return this.key}};return g<0?l.left=x:l.right=x,this.fixAfterInsertion(x),this.size_++,null}},{key:"fixAfterInsertion",value:function(r){var a;for(r.color=1;r!=null&&r!==this.root_&&r.parent.color===1;)Te(r)===To(Te(Te(r)))?ac(a=oc(Te(Te(r))))===1?(An(Te(r),0),An(a,0),An(Te(Te(r)),1),r=Te(Te(r))):(r===oc(Te(r))&&(r=Te(r),this.rotateLeft(r)),An(Te(r),0),An(Te(Te(r)),1),this.rotateRight(Te(Te(r)))):ac(a=To(Te(Te(r))))===1?(An(Te(r),0),An(a,0),An(Te(Te(r)),1),r=Te(Te(r))):(r===To(Te(r))&&(r=Te(r),this.rotateRight(r)),An(Te(r),0),An(Te(Te(r)),1),this.rotateLeft(Te(Te(r))));this.root_.color=0}},{key:"values",value:function(){var r=new pe,a=this.getFirstEntry();if(a!==null)for(r.add(a.value);(a=n.successor(a))!==null;)r.add(a.value);return r}},{key:"entrySet",value:function(){var r=new Mr,a=this.getFirstEntry();if(a!==null)for(r.add(a);(a=n.successor(a))!==null;)r.add(a);return r}},{key:"rotateLeft",value:function(r){if(r!=null){var a=r.right;r.right=a.left,a.left!=null&&(a.left.parent=r),a.parent=r.parent,r.parent==null?this.root_=a:r.parent.left===r?r.parent.left=a:r.parent.right=a,a.left=r,r.parent=a}}},{key:"rotateRight",value:function(r){if(r!=null){var a=r.left;r.left=a.right,a.right!=null&&(a.right.parent=r),a.parent=r.parent,r.parent==null?this.root_=a:r.parent.right===r?r.parent.right=a:r.parent.left=a,a.right=r,r.parent=a}}},{key:"getFirstEntry",value:function(){var r=this.root_;if(r!=null)for(;r.left!=null;)r=r.left;return r}},{key:"size",value:function(){return this.size_}},{key:"containsKey",value:function(r){for(var a=this.root_;a!==null;){var l=r.compareTo(a.key);if(l<0)a=a.left;else{if(!(l>0))return!0;a=a.right}}return!1}}],[{key:"successor",value:function(r){var a;if(r===null)return null;if(r.right!==null){for(a=r.right;a.left!==null;)a=a.left;return a}a=r.parent;for(var l=r;a!==null&&l===a.right;)l=a,a=a.parent;return a}}])})(Tp),uc=(function(){return h((function o(){u(this,o),o.constructor_.apply(this,arguments)}),[{key:"find",value:function(o){return this.nodeMap.get(o)}},{key:"addNode",value:function(){if(arguments[0]instanceof Y){var o=arguments[0],n=this.nodeMap.get(o);return n===null&&(n=this.nodeFact.createNode(o),this.nodeMap.put(o,n)),n}if(arguments[0]instanceof ga){var r=arguments[0],a=this.nodeMap.get(r.getCoordinate());return a===null?(this.nodeMap.put(r.getCoordinate(),r),r):(a.mergeLabel(r),a)}}},{key:"print",value:function(o){for(var n=this.iterator();n.hasNext();)n.next().print(o)}},{key:"iterator",value:function(){return this.nodeMap.values().iterator()}},{key:"values",value:function(){return this.nodeMap.values()}},{key:"getBoundaryNodes",value:function(o){for(var n=new pe,r=this.iterator();r.hasNext();){var a=r.next();a.getLabel().getLocation(o)===C.BOUNDARY&&n.add(a)}return n}},{key:"add",value:function(o){var n=o.getCoordinate();this.addNode(n).add(o)}}],[{key:"constructor_",value:function(){this.nodeMap=new as,this.nodeFact=null;var o=arguments[0];this.nodeFact=o}}])})(),_t=(function(){function o(){u(this,o)}return h(o,null,[{key:"isNorthern",value:function(n){return n===o.NE||n===o.NW}},{key:"isOpposite",value:function(n,r){return n!==r&&(n-r+4)%4===2}},{key:"commonHalfPlane",value:function(n,r){if(n===r)return n;if((n-r+4)%4===2)return-1;var a=n<r?n:r;return a===0&&(n>r?n:r)===3?3:a}},{key:"isInHalfPlane",value:function(n,r){return r===o.SE?n===o.SE||n===o.SW:n===r||n===r+1}},{key:"quadrant",value:function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var n=arguments[0],r=arguments[1];if(n===0&&r===0)throw new X("Cannot compute the quadrant for point ( "+n+", "+r+" )");return n>=0?r>=0?o.NE:o.SE:r>=0?o.NW:o.SW}if(arguments[0]instanceof Y&&arguments[1]instanceof Y){var a=arguments[0],l=arguments[1];if(l.x===a.x&&l.y===a.y)throw new X("Cannot compute the quadrant for two identical points "+a);return l.x>=a.x?l.y>=a.y?o.NE:o.SE:l.y>=a.y?o.NW:o.SW}}}])})();_t.NE=0,_t.NW=1,_t.SW=2,_t.SE=3;var lc=(function(){function o(){u(this,o),o.constructor_.apply(this,arguments)}return h(o,[{key:"compareDirection",value:function(n){return this._dx===n._dx&&this._dy===n._dy?0:this._quadrant>n._quadrant?1:this._quadrant<n._quadrant?-1:ve.index(n._p0,n._p1,this._p1)}},{key:"getDy",value:function(){return this._dy}},{key:"getCoordinate",value:function(){return this._p0}},{key:"setNode",value:function(n){this._node=n}},{key:"print",value:function(n){var r=Math.atan2(this._dy,this._dx),a=this.getClass().getName(),l=a.lastIndexOf("."),g=a.substring(l+1);n.print(" "+g+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+r+" "+this._label)}},{key:"compareTo",value:function(n){var r=n;return this.compareDirection(r)}},{key:"getDirectedCoordinate",value:function(){return this._p1}},{key:"getDx",value:function(){return this._dx}},{key:"getLabel",value:function(){return this._label}},{key:"getEdge",value:function(){return this._edge}},{key:"getQuadrant",value:function(){return this._quadrant}},{key:"getNode",value:function(){return this._node}},{key:"toString",value:function(){var n=Math.atan2(this._dy,this._dx),r=this.getClass().getName(),a=r.lastIndexOf(".");return" "+r.substring(a+1)+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+n+" "+this._label}},{key:"computeLabel",value:function(n){}},{key:"init",value:function(n,r){this._p0=n,this._p1=r,this._dx=r.x-n.x,this._dy=r.y-n.y,this._quadrant=_t.quadrant(this._dx,this._dy),re.isTrue(!(this._dx===0&&this._dy===0),"EdgeEnd with identical endpoints found")}},{key:"interfaces_",get:function(){return[$]}}],[{key:"constructor_",value:function(){if(this._edge=null,this._label=null,this._node=null,this._p0=null,this._p1=null,this._dx=null,this._dy=null,this._quadrant=null,arguments.length===1){var n=arguments[0];this._edge=n}else if(arguments.length===3){var r=arguments[0],a=arguments[1],l=arguments[2];o.constructor_.call(this,r,a,l,null)}else if(arguments.length===4){var g=arguments[0],p=arguments[1],_=arguments[2],x=arguments[3];o.constructor_.call(this,g),this.init(p,_),this._label=x}}}])})(),Po=(function(o){function n(){var r;return u(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return y(n,o),h(n,[{key:"getNextMin",value:function(){return this._nextMin}},{key:"getDepth",value:function(r){return this._depth[r]}},{key:"setVisited",value:function(r){this._isVisited=r}},{key:"computeDirectedLabel",value:function(){this._label=new qt(this._edge.getLabel()),this._isForward||this._label.flip()}},{key:"getNext",value:function(){return this._next}},{key:"setDepth",value:function(r,a){if(this._depth[r]!==-999&&this._depth[r]!==a)throw new Ut("assigned depths do not match",this.getCoordinate());this._depth[r]=a}},{key:"isInteriorAreaEdge",value:function(){for(var r=!0,a=0;a<2;a++)this._label.isArea(a)&&this._label.getLocation(a,ne.LEFT)===C.INTERIOR&&this._label.getLocation(a,ne.RIGHT)===C.INTERIOR||(r=!1);return r}},{key:"setNextMin",value:function(r){this._nextMin=r}},{key:"print",value:function(r){b(n,"print",this,1).call(this,r),r.print(" "+this._depth[ne.LEFT]+"/"+this._depth[ne.RIGHT]),r.print(" ("+this.getDepthDelta()+")"),this._isInResult&&r.print(" inResult")}},{key:"setMinEdgeRing",value:function(r){this._minEdgeRing=r}},{key:"isLineEdge",value:function(){var r=this._label.isLine(0)||this._label.isLine(1),a=!this._label.isArea(0)||this._label.allPositionsEqual(0,C.EXTERIOR),l=!this._label.isArea(1)||this._label.allPositionsEqual(1,C.EXTERIOR);return r&&a&&l}},{key:"setEdgeRing",value:function(r){this._edgeRing=r}},{key:"getMinEdgeRing",value:function(){return this._minEdgeRing}},{key:"getDepthDelta",value:function(){var r=this._edge.getDepthDelta();return this._isForward||(r=-r),r}},{key:"setInResult",value:function(r){this._isInResult=r}},{key:"getSym",value:function(){return this._sym}},{key:"isForward",value:function(){return this._isForward}},{key:"getEdge",value:function(){return this._edge}},{key:"printEdge",value:function(r){this.print(r),r.print(" "),this._isForward?this._edge.print(r):this._edge.printReverse(r)}},{key:"setSym",value:function(r){this._sym=r}},{key:"setVisitedEdge",value:function(r){this.setVisited(r),this._sym.setVisited(r)}},{key:"setEdgeDepths",value:function(r,a){var l=this.getEdge().getDepthDelta();this._isForward||(l=-l);var g=1;r===ne.LEFT&&(g=-1);var p=ne.opposite(r),_=a+l*g;this.setDepth(r,a),this.setDepth(p,_)}},{key:"getEdgeRing",value:function(){return this._edgeRing}},{key:"isInResult",value:function(){return this._isInResult}},{key:"setNext",value:function(r){this._next=r}},{key:"isVisited",value:function(){return this._isVisited}}],[{key:"constructor_",value:function(){this._isForward=null,this._isInResult=!1,this._isVisited=!1,this._sym=null,this._next=null,this._nextMin=null,this._edgeRing=null,this._minEdgeRing=null,this._depth=[0,-999,-999];var r=arguments[0],a=arguments[1];if(lc.constructor_.call(this,r),this._isForward=a,a)this.init(r.getCoordinate(0),r.getCoordinate(1));else{var l=r.getNumPoints()-1;this.init(r.getCoordinate(l),r.getCoordinate(l-1))}this.computeDirectedLabel()}},{key:"depthFactor",value:function(r,a){return r===C.EXTERIOR&&a===C.INTERIOR?1:r===C.INTERIOR&&a===C.EXTERIOR?-1:0}}])})(lc),cc=(function(){return h((function o(){u(this,o)}),[{key:"createNode",value:function(o){return new ga(o,null)}}])})(),hc=(function(){return h((function o(){u(this,o),o.constructor_.apply(this,arguments)}),[{key:"printEdges",value:function(o){o.println("Edges:");for(var n=0;n<this._edges.size();n++){o.println("edge "+n+":");var r=this._edges.get(n);r.print(o),r.eiList.print(o)}}},{key:"find",value:function(o){return this._nodes.find(o)}},{key:"addNode",value:function(){if(arguments[0]instanceof ga){var o=arguments[0];return this._nodes.addNode(o)}if(arguments[0]instanceof Y){var n=arguments[0];return this._nodes.addNode(n)}}},{key:"getNodeIterator",value:function(){return this._nodes.iterator()}},{key:"linkResultDirectedEdges",value:function(){for(var o=this._nodes.iterator();o.hasNext();)o.next().getEdges().linkResultDirectedEdges()}},{key:"debugPrintln",value:function(o){gt.out.println(o)}},{key:"isBoundaryNode",value:function(o,n){var r=this._nodes.find(n);if(r===null)return!1;var a=r.getLabel();return a!==null&&a.getLocation(o)===C.BOUNDARY}},{key:"linkAllDirectedEdges",value:function(){for(var o=this._nodes.iterator();o.hasNext();)o.next().getEdges().linkAllDirectedEdges()}},{key:"matchInSameDirection",value:function(o,n,r,a){return!!o.equals(r)&&ve.index(o,n,a)===ve.COLLINEAR&&_t.quadrant(o,n)===_t.quadrant(r,a)}},{key:"getEdgeEnds",value:function(){return this._edgeEndList}},{key:"debugPrint",value:function(o){gt.out.print(o)}},{key:"getEdgeIterator",value:function(){return this._edges.iterator()}},{key:"findEdgeInSameDirection",value:function(o,n){for(var r=0;r<this._edges.size();r++){var a=this._edges.get(r),l=a.getCoordinates();if(this.matchInSameDirection(o,n,l[0],l[1])||this.matchInSameDirection(o,n,l[l.length-1],l[l.length-2]))return a}return null}},{key:"insertEdge",value:function(o){this._edges.add(o)}},{key:"findEdgeEnd",value:function(o){for(var n=this.getEdgeEnds().iterator();n.hasNext();){var r=n.next();if(r.getEdge()===o)return r}return null}},{key:"addEdges",value:function(o){for(var n=o.iterator();n.hasNext();){var r=n.next();this._edges.add(r);var a=new Po(r,!0),l=new Po(r,!1);a.setSym(l),l.setSym(a),this.add(a),this.add(l)}}},{key:"add",value:function(o){this._nodes.add(o),this._edgeEndList.add(o)}},{key:"getNodes",value:function(){return this._nodes.values()}},{key:"findEdge",value:function(o,n){for(var r=0;r<this._edges.size();r++){var a=this._edges.get(r),l=a.getCoordinates();if(o.equals(l[0])&&n.equals(l[1]))return a}return null}}],[{key:"constructor_",value:function(){if(this._edges=new pe,this._nodes=null,this._edgeEndList=new pe,arguments.length===0)this._nodes=new uc(new cc);else if(arguments.length===1){var o=arguments[0];this._nodes=new uc(o)}}},{key:"linkResultDirectedEdges",value:function(o){for(var n=o.iterator();n.hasNext();)n.next().getEdges().linkResultDirectedEdges()}}])})(),Pp=(function(){function o(){u(this,o),o.constructor_.apply(this,arguments)}return h(o,[{key:"sortShellsAndHoles",value:function(n,r,a){for(var l=n.iterator();l.hasNext();){var g=l.next();g.isHole()?a.add(g):r.add(g)}}},{key:"computePolygons",value:function(n){for(var r=new pe,a=n.iterator();a.hasNext();){var l=a.next().toPolygon(this._geometryFactory);r.add(l)}return r}},{key:"placeFreeHoles",value:function(n,r){for(var a=r.iterator();a.hasNext();){var l=a.next();if(l.getShell()===null){var g=o.findEdgeRingContaining(l,n);if(g===null)throw new Ut("unable to assign hole to a shell",l.getCoordinate(0));l.setShell(g)}}}},{key:"buildMinimalEdgeRings",value:function(n,r,a){for(var l=new pe,g=n.iterator();g.hasNext();){var p=g.next();if(p.getMaxNodeDegree()>2){p.linkDirectedEdgesForMinimalEdgeRings();var _=p.buildMinimalRings(),x=this.findShell(_);x!==null?(this.placePolygonHoles(x,_),r.add(x)):a.addAll(_)}else l.add(p)}return l}},{key:"buildMaximalEdgeRings",value:function(n){for(var r=new pe,a=n.iterator();a.hasNext();){var l=a.next();if(l.isInResult()&&l.getLabel().isArea()&&l.getEdgeRing()===null){var g=new Ap(l,this._geometryFactory);r.add(g),g.setInResult()}}return r}},{key:"placePolygonHoles",value:function(n,r){for(var a=r.iterator();a.hasNext();){var l=a.next();l.isHole()&&l.setShell(n)}}},{key:"getPolygons",value:function(){return this.computePolygons(this._shellList)}},{key:"findShell",value:function(n){for(var r=0,a=null,l=n.iterator();l.hasNext();){var g=l.next();g.isHole()||(a=g,r++)}return re.isTrue(r<=1,"found two shells in MinimalEdgeRing list"),a}},{key:"add",value:function(){if(arguments.length===1){var n=arguments[0];this.add(n.getEdgeEnds(),n.getNodes())}else if(arguments.length===2){var r=arguments[0],a=arguments[1];hc.linkResultDirectedEdges(a);var l=this.buildMaximalEdgeRings(r),g=new pe,p=this.buildMinimalEdgeRings(l,this._shellList,g);this.sortShellsAndHoles(p,this._shellList,g),this.placeFreeHoles(this._shellList,g)}}}],[{key:"constructor_",value:function(){this._geometryFactory=null,this._shellList=new pe;var n=arguments[0];this._geometryFactory=n}},{key:"findEdgeRingContaining",value:function(n,r){for(var a=n.getLinearRing(),l=a.getEnvelopeInternal(),g=a.getCoordinateN(0),p=null,_=null,x=r.iterator();x.hasNext();){var I=x.next(),z=I.getLinearRing(),J=z.getEnvelopeInternal();if(!J.equals(l)&&J.contains(l)){g=A.ptNotInList(a.getCoordinates(),z.getCoordinates());var Q=!1;Ao.isInRing(g,z.getCoordinates())&&(Q=!0),Q&&(p===null||_.contains(J))&&(_=(p=I).getLinearRing().getEnvelopeInternal())}}return p}}])})(),fc=(function(){return h((function o(){u(this,o)}),[{key:"getBounds",value:function(){}}])})(),Kn=(function(){return h((function o(){u(this,o),o.constructor_.apply(this,arguments)}),[{key:"getItem",value:function(){return this._item}},{key:"getBounds",value:function(){return this._bounds}},{key:"interfaces_",get:function(){return[fc,E]}}],[{key:"constructor_",value:function(){this._bounds=null,this._item=null;var o=arguments[0],n=arguments[1];this._bounds=o,this._item=n}}])})(),da=(function(){return h((function o(){u(this,o),o.constructor_.apply(this,arguments)}),[{key:"poll",value:function(){if(this.isEmpty())return null;var o=this._items.get(1);return this._items.set(1,this._items.get(this._size)),this._size-=1,this.reorder(1),o}},{key:"size",value:function(){return this._size}},{key:"reorder",value:function(o){for(var n=null,r=this._items.get(o);2*o<=this._size&&((n=2*o)!==this._size&&this._items.get(n+1).compareTo(this._items.get(n))<0&&n++,this._items.get(n).compareTo(r)<0);o=n)this._items.set(o,this._items.get(n));this._items.set(o,r)}},{key:"clear",value:function(){this._size=0,this._items.clear()}},{key:"peek",value:function(){return this.isEmpty()?null:this._items.get(1)}},{key:"isEmpty",value:function(){return this._size===0}},{key:"add",value:function(o){this._items.add(null),this._size+=1;var n=this._size;for(this._items.set(0,o);o.compareTo(this._items.get(Math.trunc(n/2)))<0;n/=2)this._items.set(n,this._items.get(Math.trunc(n/2)));this._items.set(n,o)}}],[{key:"constructor_",value:function(){this._size=null,this._items=null,this._size=0,this._items=new pe,this._items.add(null)}}])})(),Op=(function(){return h((function o(){u(this,o)}),[{key:"insert",value:function(o,n){}},{key:"remove",value:function(o,n){}},{key:"query",value:function(){}}])})(),Yt=(function(){return h((function o(){u(this,o),o.constructor_.apply(this,arguments)}),[{key:"getLevel",value:function(){return this._level}},{key:"size",value:function(){return this._childBoundables.size()}},{key:"getChildBoundables",value:function(){return this._childBoundables}},{key:"addChildBoundable",value:function(o){re.isTrue(this._bounds===null),this._childBoundables.add(o)}},{key:"isEmpty",value:function(){return this._childBoundables.isEmpty()}},{key:"getBounds",value:function(){return this._bounds===null&&(this._bounds=this.computeBounds()),this._bounds}},{key:"interfaces_",get:function(){return[fc,E]}}],[{key:"constructor_",value:function(){if(this._childBoundables=new pe,this._bounds=null,this._level=null,arguments.length!==0&&arguments.length===1){var o=arguments[0];this._level=o}}}])})(),mi={reverseOrder:function(){return{compare:function(o,n){return n.compareTo(o)}}},min:function(o){return mi.sort(o),o.get(0)},sort:function(o,n){var r=o.toArray();n?$n.sort(r,n):$n.sort(r);for(var a=o.iterator(),l=0,g=r.length;l<g;l++)a.next(),a.set(r[l])},singletonList:function(o){var n=new pe;return n.add(o),n}},Rp=(function(){function o(){u(this,o)}return h(o,null,[{key:"maxDistance",value:function(n,r,a,l,g,p,_,x){var I=o.distance(n,r,g,p);return I=Math.max(I,o.distance(n,r,_,x)),I=Math.max(I,o.distance(a,l,g,p)),I=Math.max(I,o.distance(a,l,_,x))}},{key:"distance",value:function(n,r,a,l){var g=a-n,p=l-r;return Math.sqrt(g*g+p*p)}},{key:"maximumDistance",value:function(n,r){var a=Math.min(n.getMinX(),r.getMinX()),l=Math.min(n.getMinY(),r.getMinY()),g=Math.max(n.getMaxX(),r.getMaxX()),p=Math.max(n.getMaxY(),r.getMaxY());return o.distance(a,l,g,p)}},{key:"minMaxDistance",value:function(n,r){var a=n.getMinX(),l=n.getMinY(),g=n.getMaxX(),p=n.getMaxY(),_=r.getMinX(),x=r.getMinY(),I=r.getMaxX(),z=r.getMaxY(),J=o.maxDistance(a,l,a,p,_,x,_,z);return J=Math.min(J,o.maxDistance(a,l,a,p,_,x,I,x)),J=Math.min(J,o.maxDistance(a,l,a,p,I,z,_,z)),J=Math.min(J,o.maxDistance(a,l,a,p,I,z,I,x)),J=Math.min(J,o.maxDistance(a,l,g,l,_,x,_,z)),J=Math.min(J,o.maxDistance(a,l,g,l,_,x,I,x)),J=Math.min(J,o.maxDistance(a,l,g,l,I,z,_,z)),J=Math.min(J,o.maxDistance(a,l,g,l,I,z,I,x)),J=Math.min(J,o.maxDistance(g,p,a,p,_,x,_,z)),J=Math.min(J,o.maxDistance(g,p,a,p,_,x,I,x)),J=Math.min(J,o.maxDistance(g,p,a,p,I,z,_,z)),J=Math.min(J,o.maxDistance(g,p,a,p,I,z,I,x)),J=Math.min(J,o.maxDistance(g,p,g,l,_,x,_,z)),J=Math.min(J,o.maxDistance(g,p,g,l,_,x,I,x)),J=Math.min(J,o.maxDistance(g,p,g,l,I,z,_,z)),J=Math.min(J,o.maxDistance(g,p,g,l,I,z,I,x))}}])})(),vi=(function(){function o(){u(this,o),o.constructor_.apply(this,arguments)}return h(o,[{key:"maximumDistance",value:function(){return Rp.maximumDistance(this._boundable1.getBounds(),this._boundable2.getBounds())}},{key:"expandToQueue",value:function(n,r){var a=o.isComposite(this._boundable1),l=o.isComposite(this._boundable2);if(a&&l)return o.area(this._boundable1)>o.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,!1,n,r),null):(this.expand(this._boundable2,this._boundable1,!0,n,r),null);if(a)return this.expand(this._boundable1,this._boundable2,!1,n,r),null;if(l)return this.expand(this._boundable2,this._boundable1,!0,n,r),null;throw new X("neither boundable is composite")}},{key:"isLeaves",value:function(){return!(o.isComposite(this._boundable1)||o.isComposite(this._boundable2))}},{key:"compareTo",value:function(n){var r=n;return this._distance<r._distance?-1:this._distance>r._distance?1:0}},{key:"expand",value:function(n,r,a,l,g){for(var p=n.getChildBoundables().iterator();p.hasNext();){var _=p.next(),x=null;(x=a?new o(r,_,this._itemDistance):new o(_,r,this._itemDistance)).getDistance()<g&&l.add(x)}}},{key:"getBoundable",value:function(n){return n===0?this._boundable1:this._boundable2}},{key:"getDistance",value:function(){return this._distance}},{key:"distance",value:function(){return this.isLeaves()?this._itemDistance.distance(this._boundable1,this._boundable2):this._boundable1.getBounds().distance(this._boundable2.getBounds())}},{key:"interfaces_",get:function(){return[$]}}],[{key:"constructor_",value:function(){this._boundable1=null,this._boundable2=null,this._distance=null,this._itemDistance=null;var n=arguments[0],r=arguments[1],a=arguments[2];this._boundable1=n,this._boundable2=r,this._itemDistance=a,this._distance=this.distance()}},{key:"area",value:function(n){return n.getBounds().getArea()}},{key:"isComposite",value:function(n){return n instanceof Yt}}])})(),gc=(function(){return h((function o(){u(this,o)}),[{key:"visitItem",value:function(o){}}])})(),yi=(function(){function o(){u(this,o),o.constructor_.apply(this,arguments)}return h(o,[{key:"queryInternal",value:function(){if(_e(arguments[2],gc)&&arguments[0]instanceof Object&&arguments[1]instanceof Yt)for(var n=arguments[0],r=arguments[2],a=arguments[1].getChildBoundables(),l=0;l<a.size();l++){var g=a.get(l);this.getIntersectsOp().intersects(g.getBounds(),n)&&(g instanceof Yt?this.queryInternal(n,g,r):g instanceof Kn?r.visitItem(g.getItem()):re.shouldNeverReachHere())}else if(_e(arguments[2],bn)&&arguments[0]instanceof Object&&arguments[1]instanceof Yt)for(var p=arguments[0],_=arguments[2],x=arguments[1].getChildBoundables(),I=0;I<x.size();I++){var z=x.get(I);this.getIntersectsOp().intersects(z.getBounds(),p)&&(z instanceof Yt?this.queryInternal(p,z,_):z instanceof Kn?_.add(z.getItem()):re.shouldNeverReachHere())}}},{key:"getNodeCapacity",value:function(){return this._nodeCapacity}},{key:"lastNode",value:function(n){return n.get(n.size()-1)}},{key:"size",value:function(){if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.size(this._root));if(arguments.length===1){for(var n=0,r=arguments[0].getChildBoundables().iterator();r.hasNext();){var a=r.next();a instanceof Yt?n+=this.size(a):a instanceof Kn&&(n+=1)}return n}}},{key:"removeItem",value:function(n,r){for(var a=null,l=n.getChildBoundables().iterator();l.hasNext();){var g=l.next();g instanceof Kn&&g.getItem()===r&&(a=g)}return a!==null&&(n.getChildBoundables().remove(a),!0)}},{key:"itemsTree",value:function(){if(arguments.length===0){this.build();var n=this.itemsTree(this._root);return n===null?new pe:n}if(arguments.length===1){for(var r=arguments[0],a=new pe,l=r.getChildBoundables().iterator();l.hasNext();){var g=l.next();if(g instanceof Yt){var p=this.itemsTree(g);p!==null&&a.add(p)}else g instanceof Kn?a.add(g.getItem()):re.shouldNeverReachHere()}return a.size()<=0?null:a}}},{key:"insert",value:function(n,r){re.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new Kn(n,r))}},{key:"boundablesAtLevel",value:function(){if(arguments.length===1){var n=arguments[0],r=new pe;return this.boundablesAtLevel(n,this._root,r),r}if(arguments.length===3){var a=arguments[0],l=arguments[1],g=arguments[2];if(re.isTrue(a>-2),l.getLevel()===a)return g.add(l),null;for(var p=l.getChildBoundables().iterator();p.hasNext();){var _=p.next();_ instanceof Yt?this.boundablesAtLevel(a,_,g):(re.isTrue(_ instanceof Kn),a===-1&&g.add(_))}return null}}},{key:"query",value:function(){if(arguments.length===1){var n=arguments[0];this.build();var r=new pe;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),n)&&this.queryInternal(n,this._root,r),r}if(arguments.length===2){var a=arguments[0],l=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),a)&&this.queryInternal(a,this._root,l)}}},{key:"build",value:function(){if(this._built)return null;this._root=this._itemBoundables.isEmpty()?this.createNode(0):this.createHigherLevels(this._itemBoundables,-1),this._itemBoundables=null,this._built=!0}},{key:"getRoot",value:function(){return this.build(),this._root}},{key:"remove",value:function(){if(arguments.length===2){var n=arguments[0],r=arguments[1];return this.build(),!!this.getIntersectsOp().intersects(this._root.getBounds(),n)&&this.remove(n,this._root,r)}if(arguments.length===3){var a=arguments[0],l=arguments[1],g=arguments[2],p=this.removeItem(l,g);if(p)return!0;for(var _=null,x=l.getChildBoundables().iterator();x.hasNext();){var I=x.next();if(this.getIntersectsOp().intersects(I.getBounds(),a)&&I instanceof Yt&&(p=this.remove(a,I,g))){_=I;break}}return _!==null&&_.getChildBoundables().isEmpty()&&l.getChildBoundables().remove(_),p}}},{key:"createHigherLevels",value:function(n,r){re.isTrue(!n.isEmpty());var a=this.createParentBoundables(n,r+1);return a.size()===1?a.get(0):this.createHigherLevels(a,r+1)}},{key:"depth",value:function(){if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.depth(this._root));if(arguments.length===1){for(var n=0,r=arguments[0].getChildBoundables().iterator();r.hasNext();){var a=r.next();if(a instanceof Yt){var l=this.depth(a);l>n&&(n=l)}}return n+1}}},{key:"createParentBoundables",value:function(n,r){re.isTrue(!n.isEmpty());var a=new pe;a.add(this.createNode(r));var l=new pe(n);mi.sort(l,this.getComparator());for(var g=l.iterator();g.hasNext();){var p=g.next();this.lastNode(a).getChildBoundables().size()===this.getNodeCapacity()&&a.add(this.createNode(r)),this.lastNode(a).addChildBoundable(p)}return a}},{key:"isEmpty",value:function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()}},{key:"interfaces_",get:function(){return[E]}}],[{key:"constructor_",value:function(){if(this._root=null,this._built=!1,this._itemBoundables=new pe,this._nodeCapacity=null,arguments.length===0)o.constructor_.call(this,o.DEFAULT_NODE_CAPACITY);else if(arguments.length===1){var n=arguments[0];re.isTrue(n>1,"Node capacity must be greater than 1"),this._nodeCapacity=n}}},{key:"compareDoubles",value:function(n,r){return n>r?1:n<r?-1:0}}])})();yi.IntersectsOp=function(){},yi.DEFAULT_NODE_CAPACITY=10;var Dp=(function(){return h((function o(){u(this,o)}),[{key:"distance",value:function(o,n){}}])})(),Tn=(function(o){function n(){var r;return u(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return y(n,o),h(n,[{key:"createParentBoundablesFromVerticalSlices",value:function(r,a){re.isTrue(r.length>0);for(var l=new pe,g=0;g<r.length;g++)l.addAll(this.createParentBoundablesFromVerticalSlice(r[g],a));return l}},{key:"nearestNeighbourK",value:function(){if(arguments.length===2){var r=arguments[0],a=arguments[1];return this.nearestNeighbourK(r,K.POSITIVE_INFINITY,a)}if(arguments.length===3){var l=arguments[0],g=arguments[2],p=arguments[1],_=new da;_.add(l);for(var x=new da;!_.isEmpty()&&p>=0;){var I=_.poll(),z=I.getDistance();if(z>=p)break;I.isLeaves()?x.size()<g?x.add(I):(x.peek().getDistance()>z&&(x.poll(),x.add(I)),p=x.peek().getDistance()):I.expandToQueue(_,p)}return n.getItems(x)}}},{key:"createNode",value:function(r){return new dc(r)}},{key:"size",value:function(){return arguments.length===0?b(n,"size",this,1).call(this):b(n,"size",this,1).apply(this,arguments)}},{key:"insert",value:function(){if(!(arguments.length===2&&arguments[1]instanceof Object&&arguments[0]instanceof be))return b(n,"insert",this,1).apply(this,arguments);var r=arguments[0],a=arguments[1];if(r.isNull())return null;b(n,"insert",this,1).call(this,r,a)}},{key:"getIntersectsOp",value:function(){return n.intersectsOp}},{key:"verticalSlices",value:function(r,a){for(var l=Math.trunc(Math.ceil(r.size()/a)),g=new Array(a).fill(null),p=r.iterator(),_=0;_<a;_++){g[_]=new pe;for(var x=0;p.hasNext()&&x<l;){var I=p.next();g[_].add(I),x++}}return g}},{key:"query",value:function(){if(arguments.length===1){var r=arguments[0];return b(n,"query",this,1).call(this,r)}if(arguments.length===2){var a=arguments[0],l=arguments[1];b(n,"query",this,1).call(this,a,l)}}},{key:"getComparator",value:function(){return n.yComparator}},{key:"createParentBoundablesFromVerticalSlice",value:function(r,a){return b(n,"createParentBoundables",this,1).call(this,r,a)}},{key:"remove",value:function(){if(arguments.length===2&&arguments[1]instanceof Object&&arguments[0]instanceof be){var r=arguments[0],a=arguments[1];return b(n,"remove",this,1).call(this,r,a)}return b(n,"remove",this,1).apply(this,arguments)}},{key:"depth",value:function(){return arguments.length===0?b(n,"depth",this,1).call(this):b(n,"depth",this,1).apply(this,arguments)}},{key:"createParentBoundables",value:function(r,a){re.isTrue(!r.isEmpty());var l=Math.trunc(Math.ceil(r.size()/this.getNodeCapacity())),g=new pe(r);mi.sort(g,n.xComparator);var p=this.verticalSlices(g,Math.trunc(Math.ceil(Math.sqrt(l))));return this.createParentBoundablesFromVerticalSlices(p,a)}},{key:"nearestNeighbour",value:function(){if(arguments.length===1){if(_e(arguments[0],Dp)){var r=arguments[0];if(this.isEmpty())return null;var a=new vi(this.getRoot(),this.getRoot(),r);return this.nearestNeighbour(a)}if(arguments[0]instanceof vi){var l=arguments[0],g=K.POSITIVE_INFINITY,p=null,_=new da;for(_.add(l);!_.isEmpty()&&g>0;){var x=_.poll(),I=x.getDistance();if(I>=g)break;x.isLeaves()?(g=I,p=x):x.expandToQueue(_,g)}return p===null?null:[p.getBoundable(0).getItem(),p.getBoundable(1).getItem()]}}else{if(arguments.length===2){var z=arguments[0],J=arguments[1];if(this.isEmpty()||z.isEmpty())return null;var Q=new vi(this.getRoot(),z.getRoot(),J);return this.nearestNeighbour(Q)}if(arguments.length===3){var le=arguments[2],de=new Kn(arguments[0],arguments[1]),me=new vi(this.getRoot(),de,le);return this.nearestNeighbour(me)[0]}if(arguments.length===4){var Pe=arguments[2],Le=arguments[3],Fe=new Kn(arguments[0],arguments[1]),ct=new vi(this.getRoot(),Fe,Pe);return this.nearestNeighbourK(ct,Le)}}}},{key:"isWithinDistance",value:function(){if(arguments.length===2){var r=arguments[0],a=arguments[1],l=K.POSITIVE_INFINITY,g=new da;for(g.add(r);!g.isEmpty();){var p=g.poll(),_=p.getDistance();if(_>a)return!1;if(p.maximumDistance()<=a)return!0;if(p.isLeaves()){if((l=_)<=a)return!0}else p.expandToQueue(g,l)}return!1}if(arguments.length===3){var x=arguments[0],I=arguments[1],z=arguments[2],J=new vi(this.getRoot(),x.getRoot(),I);return this.isWithinDistance(J,z)}}},{key:"interfaces_",get:function(){return[Op,E]}}],[{key:"constructor_",value:function(){if(arguments.length===0)n.constructor_.call(this,n.DEFAULT_NODE_CAPACITY);else if(arguments.length===1){var r=arguments[0];yi.constructor_.call(this,r)}}},{key:"centreX",value:function(r){return n.avg(r.getMinX(),r.getMaxX())}},{key:"avg",value:function(r,a){return(r+a)/2}},{key:"getItems",value:function(r){for(var a=new Array(r.size()).fill(null),l=0;!r.isEmpty();)a[l]=r.poll().getBoundable(0).getItem(),l++;return a}},{key:"centreY",value:function(r){return n.avg(r.getMinY(),r.getMaxY())}}])})(yi),dc=(function(o){function n(){var r;return u(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return y(n,o),h(n,[{key:"computeBounds",value:function(){for(var r=null,a=this.getChildBoundables().iterator();a.hasNext();){var l=a.next();r===null?r=new be(l.getBounds()):r.expandToInclude(l.getBounds())}return r}}],[{key:"constructor_",value:function(){var r=arguments[0];Yt.constructor_.call(this,r)}}])})(Yt);Tn.STRtreeNode=dc,Tn.xComparator=new((function(){return h((function o(){u(this,o)}),[{key:"interfaces_",get:function(){return[ie]}},{key:"compare",value:function(o,n){return yi.compareDoubles(Tn.centreX(o.getBounds()),Tn.centreX(n.getBounds()))}}])})()),Tn.yComparator=new((function(){return h((function o(){u(this,o)}),[{key:"interfaces_",get:function(){return[ie]}},{key:"compare",value:function(o,n){return yi.compareDoubles(Tn.centreY(o.getBounds()),Tn.centreY(n.getBounds()))}}])})()),Tn.intersectsOp=new((function(){return h((function o(){u(this,o)}),[{key:"interfaces_",get:function(){return[IntersectsOp]}},{key:"intersects",value:function(o,n){return o.intersects(n)}}])})()),Tn.DEFAULT_NODE_CAPACITY=10;var Fp=(function(){function o(){u(this,o)}return h(o,null,[{key:"relativeSign",value:function(n,r){return n<r?-1:n>r?1:0}},{key:"compare",value:function(n,r,a){if(r.equals2D(a))return 0;var l=o.relativeSign(r.x,a.x),g=o.relativeSign(r.y,a.y);switch(n){case 0:return o.compareValue(l,g);case 1:return o.compareValue(g,l);case 2:return o.compareValue(g,-l);case 3:return o.compareValue(-l,g);case 4:return o.compareValue(-l,-g);case 5:return o.compareValue(-g,-l);case 6:return o.compareValue(-g,l);case 7:return o.compareValue(l,-g)}return re.shouldNeverReachHere("invalid octant value"),0}},{key:"compareValue",value:function(n,r){return n<0?-1:n>0?1:r<0?-1:r>0?1:0}}])})(),Gp=(function(){return h((function o(){u(this,o),o.constructor_.apply(this,arguments)}),[{key:"getCoordinate",value:function(){return this.coord}},{key:"print",value:function(o){o.print(this.coord),o.print(" seg # = "+this.segmentIndex)}},{key:"compareTo",value:function(o){var n=o;return this.segmentIndex<n.segmentIndex?-1:this.segmentIndex>n.segmentIndex?1:this.coord.equals2D(n.coord)?0:this._isInterior?n._isInterior?Fp.compare(this._segmentOctant,this.coord,n.coord):1:-1}},{key:"isEndPoint",value:function(o){return this.segmentIndex===0&&!this._isInterior||this.segmentIndex===o}},{key:"toString",value:function(){return this.segmentIndex+":"+this.coord.toString()}},{key:"isInterior",value:function(){return this._isInterior}},{key:"interfaces_",get:function(){return[$]}}],[{key:"constructor_",value:function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var o=arguments[0],n=arguments[1],r=arguments[2],a=arguments[3];this._segString=o,this.coord=new Y(n),this.segmentIndex=r,this._segmentOctant=a,this._isInterior=!n.equals2D(o.getCoordinate(r))}}])})(),Bp=(function(){return h((function o(){u(this,o)}),[{key:"hasNext",value:function(){}},{key:"next",value:function(){}},{key:"remove",value:function(){}}])})(),Up=(function(){return h((function o(){u(this,o),o.constructor_.apply(this,arguments)}),[{key:"getSplitCoordinates",value:function(){var o=new Dr;this.addEndpoints();for(var n=this.iterator(),r=n.next();n.hasNext();){var a=n.next();this.addEdgeCoordinates(r,a,o),r=a}return o.toCoordinateArray()}},{key:"addCollapsedNodes",value:function(){var o=new pe;this.findCollapsesFromInsertedNodes(o),this.findCollapsesFromExistingVertices(o);for(var n=o.iterator();n.hasNext();){var r=n.next().intValue();this.add(this._edge.getCoordinate(r),r)}}},{key:"createSplitEdgePts",value:function(o,n){var r=n.segmentIndex-o.segmentIndex+2;if(r===2)return[new Y(o.coord),new Y(n.coord)];var a=this._edge.getCoordinate(n.segmentIndex),l=n.isInterior()||!n.coord.equals2D(a);l||r--;var g=new Array(r).fill(null),p=0;g[p++]=new Y(o.coord);for(var _=o.segmentIndex+1;_<=n.segmentIndex;_++)g[p++]=this._edge.getCoordinate(_);return l&&(g[p]=new Y(n.coord)),g}},{key:"print",value:function(o){o.println("Intersections:");for(var n=this.iterator();n.hasNext();)n.next().print(o)}},{key:"findCollapsesFromExistingVertices",value:function(o){for(var n=0;n<this._edge.size()-2;n++){var r=this._edge.getCoordinate(n);this._edge.getCoordinate(n+1);var a=this._edge.getCoordinate(n+2);r.equals2D(a)&&o.add(Sn.valueOf(n+1))}}},{key:"addEdgeCoordinates",value:function(o,n,r){var a=this.createSplitEdgePts(o,n);r.add(a,!1)}},{key:"iterator",value:function(){return this._nodeMap.values().iterator()}},{key:"addSplitEdges",value:function(o){this.addEndpoints(),this.addCollapsedNodes();for(var n=this.iterator(),r=n.next();n.hasNext();){var a=n.next(),l=this.createSplitEdge(r,a);o.add(l),r=a}}},{key:"findCollapseIndex",value:function(o,n,r){if(!o.coord.equals2D(n.coord))return!1;var a=n.segmentIndex-o.segmentIndex;return n.isInterior()||a--,a===1&&(r[0]=o.segmentIndex+1,!0)}},{key:"findCollapsesFromInsertedNodes",value:function(o){for(var n=new Array(1).fill(null),r=this.iterator(),a=r.next();r.hasNext();){var l=r.next();this.findCollapseIndex(a,l,n)&&o.add(Sn.valueOf(n[0])),a=l}}},{key:"getEdge",value:function(){return this._edge}},{key:"addEndpoints",value:function(){var o=this._edge.size()-1;this.add(this._edge.getCoordinate(0),0),this.add(this._edge.getCoordinate(o),o)}},{key:"createSplitEdge",value:function(o,n){return new Gr(this.createSplitEdgePts(o,n),this._edge.getData())}},{key:"add",value:function(o,n){var r=new Gp(this._edge,o,n,this._edge.getSegmentOctant(n)),a=this._nodeMap.get(r);return a!==null?(re.isTrue(a.coord.equals2D(o),"Found equal nodes with different coordinates"),a):(this._nodeMap.put(r,r),r)}},{key:"checkSplitEdgesCorrectness",value:function(o){var n=this._edge.getCoordinates(),r=o.get(0).getCoordinate(0);if(!r.equals2D(n[0]))throw new ae("bad split edge start point at "+r);var a=o.get(o.size()-1).getCoordinates(),l=a[a.length-1];if(!l.equals2D(n[n.length-1]))throw new ae("bad split edge end point at "+l)}}],[{key:"constructor_",value:function(){this._nodeMap=new as,this._edge=null;var o=arguments[0];this._edge=o}}])})(),zp=(function(){function o(){u(this,o)}return h(o,null,[{key:"octant",value:function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var n=arguments[0],r=arguments[1];if(n===0&&r===0)throw new X("Cannot compute the octant for point ( "+n+", "+r+" )");var a=Math.abs(n),l=Math.abs(r);return n>=0?r>=0?a>=l?0:1:a>=l?7:6:r>=0?a>=l?3:2:a>=l?4:5}if(arguments[0]instanceof Y&&arguments[1]instanceof Y){var g=arguments[0],p=arguments[1],_=p.x-g.x,x=p.y-g.y;if(_===0&&x===0)throw new X("Cannot compute the octant for two identical points "+g);return o.octant(_,x)}}}])})(),jp=(function(){return h((function o(){u(this,o)}),[{key:"getCoordinates",value:function(){}},{key:"size",value:function(){}},{key:"getCoordinate",value:function(o){}},{key:"isClosed",value:function(){}},{key:"setData",value:function(o){}},{key:"getData",value:function(){}}])})(),qp=(function(){return h((function o(){u(this,o)}),[{key:"addIntersection",value:function(o,n){}},{key:"interfaces_",get:function(){return[jp]}}])})(),Gr=(function(){function o(){u(this,o),o.constructor_.apply(this,arguments)}return h(o,[{key:"getCoordinates",value:function(){return this._pts}},{key:"size",value:function(){return this._pts.length}},{key:"getCoordinate",value:function(n){return this._pts[n]}},{key:"isClosed",value:function(){return this._pts[0].equals(this._pts[this._pts.length-1])}},{key:"getSegmentOctant",value:function(n){return n===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(n),this.getCoordinate(n+1))}},{key:"setData",value:function(n){this._data=n}},{key:"safeOctant",value:function(n,r){return n.equals2D(r)?0:zp.octant(n,r)}},{key:"getData",value:function(){return this._data}},{key:"addIntersection",value:function(){if(arguments.length===2){var n=arguments[0],r=arguments[1];this.addIntersectionNode(n,r)}else if(arguments.length===4){var a=arguments[1],l=arguments[3],g=new Y(arguments[0].getIntersection(l));this.addIntersection(g,a)}}},{key:"toString",value:function(){return Co.toLineString(new Ae(this._pts))}},{key:"getNodeList",value:function(){return this._nodeList}},{key:"addIntersectionNode",value:function(n,r){var a=r,l=a+1;if(l<this._pts.length){var g=this._pts[l];n.equals2D(g)&&(a=l)}return this._nodeList.add(n,a)}},{key:"addIntersections",value:function(n,r,a){for(var l=0;l<n.getIntersectionNum();l++)this.addIntersection(n,r,a,l)}},{key:"interfaces_",get:function(){return[qp]}}],[{key:"constructor_",value:function(){this._nodeList=new Up(this),this._pts=null,this._data=null;var n=arguments[0],r=arguments[1];this._pts=n,this._data=r}},{key:"getNodedSubstrings",value:function(){if(arguments.length===1){var n=arguments[0],r=new pe;return o.getNodedSubstrings(n,r),r}if(arguments.length===2)for(var a=arguments[1],l=arguments[0].iterator();l.hasNext();)l.next().getNodeList().addSplitEdges(a)}}])})(),Tt=(function(){function o(){u(this,o),o.constructor_.apply(this,arguments)}return h(o,[{key:"minX",value:function(){return Math.min(this.p0.x,this.p1.x)}},{key:"orientationIndex",value:function(){if(arguments[0]instanceof o){var n=arguments[0],r=ve.index(this.p0,this.p1,n.p0),a=ve.index(this.p0,this.p1,n.p1);return r>=0&&a>=0||r<=0&&a<=0?Math.max(r,a):0}if(arguments[0]instanceof Y){var l=arguments[0];return ve.index(this.p0,this.p1,l)}}},{key:"toGeometry",value:function(n){return n.createLineString([this.p0,this.p1])}},{key:"isVertical",value:function(){return this.p0.x===this.p1.x}},{key:"equals",value:function(n){if(!(n instanceof o))return!1;var r=n;return this.p0.equals(r.p0)&&this.p1.equals(r.p1)}},{key:"intersection",value:function(n){var r=new Fr;return r.computeIntersection(this.p0,this.p1,n.p0,n.p1),r.hasIntersection()?r.getIntersection(0):null}},{key:"project",value:function(){if(arguments[0]instanceof Y){var n=arguments[0];if(n.equals(this.p0)||n.equals(this.p1))return new Y(n);var r=this.projectionFactor(n),a=new Y;return a.x=this.p0.x+r*(this.p1.x-this.p0.x),a.y=this.p0.y+r*(this.p1.y-this.p0.y),a}if(arguments[0]instanceof o){var l=arguments[0],g=this.projectionFactor(l.p0),p=this.projectionFactor(l.p1);if(g>=1&&p>=1||g<=0&&p<=0)return null;var _=this.project(l.p0);g<0&&(_=this.p0),g>1&&(_=this.p1);var x=this.project(l.p1);return p<0&&(x=this.p0),p>1&&(x=this.p1),new o(_,x)}}},{key:"normalize",value:function(){this.p1.compareTo(this.p0)<0&&this.reverse()}},{key:"angle",value:function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)}},{key:"getCoordinate",value:function(n){return n===0?this.p0:this.p1}},{key:"distancePerpendicular",value:function(n){return vt.pointToLinePerpendicular(n,this.p0,this.p1)}},{key:"minY",value:function(){return Math.min(this.p0.y,this.p1.y)}},{key:"midPoint",value:function(){return o.midPoint(this.p0,this.p1)}},{key:"projectionFactor",value:function(n){if(n.equals(this.p0))return 0;if(n.equals(this.p1))return 1;var r=this.p1.x-this.p0.x,a=this.p1.y-this.p0.y,l=r*r+a*a;return l<=0?K.NaN:((n.x-this.p0.x)*r+(n.y-this.p0.y)*a)/l}},{key:"closestPoints",value:function(n){var r=this.intersection(n);if(r!==null)return[r,r];var a=new Array(2).fill(null),l=K.MAX_VALUE,g=null,p=this.closestPoint(n.p0);l=p.distance(n.p0),a[0]=p,a[1]=n.p0;var _=this.closestPoint(n.p1);(g=_.distance(n.p1))<l&&(l=g,a[0]=_,a[1]=n.p1);var x=n.closestPoint(this.p0);(g=x.distance(this.p0))<l&&(l=g,a[0]=this.p0,a[1]=x);var I=n.closestPoint(this.p1);return(g=I.distance(this.p1))<l&&(l=g,a[0]=this.p1,a[1]=I),a}},{key:"closestPoint",value:function(n){var r=this.projectionFactor(n);return r>0&&r<1?this.project(n):this.p0.distance(n)<this.p1.distance(n)?this.p0:this.p1}},{key:"maxX",value:function(){return Math.max(this.p0.x,this.p1.x)}},{key:"getLength",value:function(){return this.p0.distance(this.p1)}},{key:"compareTo",value:function(n){var r=n,a=this.p0.compareTo(r.p0);return a!==0?a:this.p1.compareTo(r.p1)}},{key:"reverse",value:function(){var n=this.p0;this.p0=this.p1,this.p1=n}},{key:"equalsTopo",value:function(n){return this.p0.equals(n.p0)&&this.p1.equals(n.p1)||this.p0.equals(n.p1)&&this.p1.equals(n.p0)}},{key:"lineIntersection",value:function(n){return Ar.intersection(this.p0,this.p1,n.p0,n.p1)}},{key:"maxY",value:function(){return Math.max(this.p0.y,this.p1.y)}},{key:"pointAlongOffset",value:function(n,r){var a=this.p0.x+n*(this.p1.x-this.p0.x),l=this.p0.y+n*(this.p1.y-this.p0.y),g=this.p1.x-this.p0.x,p=this.p1.y-this.p0.y,_=Math.sqrt(g*g+p*p),x=0,I=0;if(r!==0){if(_<=0)throw new IllegalStateException("Cannot compute offset from zero-length line segment");x=r*g/_,I=r*p/_}return new Y(a-I,l+x)}},{key:"setCoordinates",value:function(){if(arguments.length===1){var n=arguments[0];this.setCoordinates(n.p0,n.p1)}else if(arguments.length===2){var r=arguments[0],a=arguments[1];this.p0.x=r.x,this.p0.y=r.y,this.p1.x=a.x,this.p1.y=a.y}}},{key:"segmentFraction",value:function(n){var r=this.projectionFactor(n);return r<0?r=0:(r>1||K.isNaN(r))&&(r=1),r}},{key:"toString",value:function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"}},{key:"isHorizontal",value:function(){return this.p0.y===this.p1.y}},{key:"reflect",value:function(n){var r=this.p1.getY()-this.p0.getY(),a=this.p0.getX()-this.p1.getX(),l=this.p0.getY()*(this.p1.getX()-this.p0.getX())-this.p0.getX()*(this.p1.getY()-this.p0.getY()),g=r*r+a*a,p=r*r-a*a,_=n.getX(),x=n.getY();return new Y((-p*_-2*r*a*x-2*r*l)/g,(p*x-2*r*a*_-2*a*l)/g)}},{key:"distance",value:function(){if(arguments[0]instanceof o){var n=arguments[0];return vt.segmentToSegment(this.p0,this.p1,n.p0,n.p1)}if(arguments[0]instanceof Y){var r=arguments[0];return vt.pointToSegment(r,this.p0,this.p1)}}},{key:"pointAlong",value:function(n){var r=new Y;return r.x=this.p0.x+n*(this.p1.x-this.p0.x),r.y=this.p0.y+n*(this.p1.y-this.p0.y),r}},{key:"hashCode",value:function(){var n=K.doubleToLongBits(this.p0.x);n^=31*K.doubleToLongBits(this.p0.y);var r=Math.trunc(n)^Math.trunc(n>>32),a=K.doubleToLongBits(this.p1.x);return a^=31*K.doubleToLongBits(this.p1.y),r^(Math.trunc(a)^Math.trunc(a>>32))}},{key:"interfaces_",get:function(){return[$,E]}}],[{key:"constructor_",value:function(){if(this.p0=null,this.p1=null,arguments.length===0)o.constructor_.call(this,new Y,new Y);else if(arguments.length===1){var n=arguments[0];o.constructor_.call(this,n.p0,n.p1)}else if(arguments.length===2){var r=arguments[0],a=arguments[1];this.p0=r,this.p1=a}else if(arguments.length===4){var l=arguments[0],g=arguments[1],p=arguments[2],_=arguments[3];o.constructor_.call(this,new Y(l,g),new Y(p,_))}}},{key:"midPoint",value:function(n,r){return new Y((n.x+r.x)/2,(n.y+r.y)/2)}}])})(),Yp=(function(){return h((function o(){u(this,o),o.constructor_.apply(this,arguments)}),[{key:"overlap",value:function(){if(arguments.length!==2&&arguments.length===4){var o=arguments[1],n=arguments[2],r=arguments[3];arguments[0].getLineSegment(o,this._overlapSeg1),n.getLineSegment(r,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}}}],[{key:"constructor_",value:function(){this._overlapSeg1=new Tt,this._overlapSeg2=new Tt}}])})(),pc=(function(){return h((function o(){u(this,o),o.constructor_.apply(this,arguments)}),[{key:"getLineSegment",value:function(o,n){n.p0=this._pts[o],n.p1=this._pts[o+1]}},{key:"computeSelect",value:function(o,n,r,a){var l=this._pts[n],g=this._pts[r];if(r-n==1)return a.select(this,n),null;if(!o.intersects(l,g))return null;var p=Math.trunc((n+r)/2);n<p&&this.computeSelect(o,n,p,a),p<r&&this.computeSelect(o,p,r,a)}},{key:"getCoordinates",value:function(){for(var o=new Array(this._end-this._start+1).fill(null),n=0,r=this._start;r<=this._end;r++)o[n++]=this._pts[r];return o}},{key:"computeOverlaps",value:function(){if(arguments.length===2){var o=arguments[0],n=arguments[1];this.computeOverlaps(this._start,this._end,o,o._start,o._end,n)}else if(arguments.length===6){var r=arguments[0],a=arguments[1],l=arguments[2],g=arguments[3],p=arguments[4],_=arguments[5];if(a-r==1&&p-g==1)return _.overlap(this,r,l,g),null;if(!this.overlaps(r,a,l,g,p))return null;var x=Math.trunc((r+a)/2),I=Math.trunc((g+p)/2);r<x&&(g<I&&this.computeOverlaps(r,x,l,g,I,_),I<p&&this.computeOverlaps(r,x,l,I,p,_)),x<a&&(g<I&&this.computeOverlaps(x,a,l,g,I,_),I<p&&this.computeOverlaps(x,a,l,I,p,_))}}},{key:"setId",value:function(o){this._id=o}},{key:"select",value:function(o,n){this.computeSelect(o,this._start,this._end,n)}},{key:"getEnvelope",value:function(){if(this._env===null){var o=this._pts[this._start],n=this._pts[this._end];this._env=new be(o,n)}return this._env}},{key:"overlaps",value:function(o,n,r,a,l){return be.intersects(this._pts[o],this._pts[n],r._pts[a],r._pts[l])}},{key:"getEndIndex",value:function(){return this._end}},{key:"getStartIndex",value:function(){return this._start}},{key:"getContext",value:function(){return this._context}},{key:"getId",value:function(){return this._id}}],[{key:"constructor_",value:function(){this._pts=null,this._start=null,this._end=null,this._env=null,this._context=null,this._id=null;var o=arguments[0],n=arguments[1],r=arguments[2],a=arguments[3];this._pts=o,this._start=n,this._end=r,this._context=a}}])})(),Hp=(function(){function o(){u(this,o)}return h(o,null,[{key:"findChainEnd",value:function(n,r){for(var a=r;a<n.length-1&&n[a].equals2D(n[a+1]);)a++;if(a>=n.length-1)return n.length-1;for(var l=_t.quadrant(n[a],n[a+1]),g=r+1;g<n.length&&!(!n[g-1].equals2D(n[g])&&_t.quadrant(n[g-1],n[g])!==l);)g++;return g-1}},{key:"getChains",value:function(){if(arguments.length===1){var n=arguments[0];return o.getChains(n,null)}if(arguments.length===2){var r=arguments[0],a=arguments[1],l=new pe,g=0;do{var p=o.findChainEnd(r,g),_=new pc(r,g,p,a);l.add(_),g=p}while(g<r.length-1);return l}}}])})(),Oo=(function(){return h((function o(){u(this,o)}),[{key:"computeNodes",value:function(o){}},{key:"getNodedSubstrings",value:function(){}}])})(),mc=(function(){return h((function o(){u(this,o),o.constructor_.apply(this,arguments)}),[{key:"setSegmentIntersector",value:function(o){this._segInt=o}},{key:"interfaces_",get:function(){return[Oo]}}],[{key:"constructor_",value:function(){if(this._segInt=null,arguments.length!==0&&arguments.length===1){var o=arguments[0];this.setSegmentIntersector(o)}}}])})(),Ro=(function(o){function n(){var r;return u(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return y(n,o),h(n,[{key:"getMonotoneChains",value:function(){return this._monoChains}},{key:"getNodedSubstrings",value:function(){return Gr.getNodedSubstrings(this._nodedSegStrings)}},{key:"getIndex",value:function(){return this._index}},{key:"add",value:function(r){for(var a=Hp.getChains(r.getCoordinates(),r).iterator();a.hasNext();){var l=a.next();l.setId(this._idCounter++),this._index.insert(l.getEnvelope(),l),this._monoChains.add(l)}}},{key:"computeNodes",value:function(r){this._nodedSegStrings=r;for(var a=r.iterator();a.hasNext();)this.add(a.next());this.intersectChains()}},{key:"intersectChains",value:function(){for(var r=new vc(this._segInt),a=this._monoChains.iterator();a.hasNext();)for(var l=a.next(),g=this._index.query(l.getEnvelope()).iterator();g.hasNext();){var p=g.next();if(p.getId()>l.getId()&&(l.computeOverlaps(p,r),this._nOverlaps++),this._segInt.isDone())return null}}}],[{key:"constructor_",value:function(){if(this._monoChains=new pe,this._index=new Tn,this._idCounter=0,this._nodedSegStrings=null,this._nOverlaps=0,arguments.length!==0&&arguments.length===1){var r=arguments[0];mc.constructor_.call(this,r)}}}])})(mc),vc=(function(o){function n(){var r;return u(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return y(n,o),h(n,[{key:"overlap",value:function(){if(arguments.length!==4)return b(n,"overlap",this,1).apply(this,arguments);var r=arguments[1],a=arguments[2],l=arguments[3],g=arguments[0].getContext(),p=a.getContext();this._si.processIntersections(g,r,p,l)}}],[{key:"constructor_",value:function(){this._si=null;var r=arguments[0];this._si=r}}])})(Yp);Ro.SegmentOverlapAction=vc;var dn=(function(){function o(){u(this,o),o.constructor_.apply(this,arguments)}return h(o,[{key:"isDeletable",value:function(n,r,a,l){var g=this._inputLine[n],p=this._inputLine[r],_=this._inputLine[a];return!!this.isConcave(g,p,_)&&!!this.isShallow(g,p,_,l)&&this.isShallowSampled(g,p,n,a,l)}},{key:"deleteShallowConcavities",value:function(){for(var n=1,r=this.findNextNonDeletedIndex(n),a=this.findNextNonDeletedIndex(r),l=!1;a<this._inputLine.length;){var g=!1;this.isDeletable(n,r,a,this._distanceTol)&&(this._isDeleted[r]=o.DELETE,g=!0,l=!0),n=g?a:r,r=this.findNextNonDeletedIndex(n),a=this.findNextNonDeletedIndex(r)}return l}},{key:"isShallowConcavity",value:function(n,r,a,l){return ve.index(n,r,a)===this._angleOrientation&&vt.pointToSegment(r,n,a)<l}},{key:"isShallowSampled",value:function(n,r,a,l,g){var p=Math.trunc((l-a)/o.NUM_PTS_TO_CHECK);p<=0&&(p=1);for(var _=a;_<l;_+=p)if(!this.isShallow(n,r,this._inputLine[_],g))return!1;return!0}},{key:"isConcave",value:function(n,r,a){return ve.index(n,r,a)===this._angleOrientation}},{key:"simplify",value:function(n){this._distanceTol=Math.abs(n),n<0&&(this._angleOrientation=ve.CLOCKWISE),this._isDeleted=new Array(this._inputLine.length).fill(null);var r=!1;do r=this.deleteShallowConcavities();while(r);return this.collapseLine()}},{key:"findNextNonDeletedIndex",value:function(n){for(var r=n+1;r<this._inputLine.length&&this._isDeleted[r]===o.DELETE;)r++;return r}},{key:"isShallow",value:function(n,r,a,l){return vt.pointToSegment(r,n,a)<l}},{key:"collapseLine",value:function(){for(var n=new Dr,r=0;r<this._inputLine.length;r++)this._isDeleted[r]!==o.DELETE&&n.add(this._inputLine[r]);return n.toCoordinateArray()}}],[{key:"constructor_",value:function(){this._inputLine=null,this._distanceTol=null,this._isDeleted=null,this._angleOrientation=ve.COUNTERCLOCKWISE;var n=arguments[0];this._inputLine=n}},{key:"simplify",value:function(n,r){return new o(n).simplify(r)}}])})();dn.INIT=0,dn.DELETE=1,dn.KEEP=1,dn.NUM_PTS_TO_CHECK=10;var yc=(function(){function o(){u(this,o),o.constructor_.apply(this,arguments)}return h(o,[{key:"getCoordinates",value:function(){return this._ptList.toArray(o.COORDINATE_ARRAY_TYPE)}},{key:"setPrecisionModel",value:function(n){this._precisionModel=n}},{key:"addPt",value:function(n){var r=new Y(n);if(this._precisionModel.makePrecise(r),this.isRedundant(r))return null;this._ptList.add(r)}},{key:"reverse",value:function(){}},{key:"addPts",value:function(n,r){if(r)for(var a=0;a<n.length;a++)this.addPt(n[a]);else for(var l=n.length-1;l>=0;l--)this.addPt(n[l])}},{key:"isRedundant",value:function(n){if(this._ptList.size()<1)return!1;var r=this._ptList.get(this._ptList.size()-1);return n.distance(r)<this._minimimVertexDistance}},{key:"toString",value:function(){return new di().createLineString(this.getCoordinates()).toString()}},{key:"closeRing",value:function(){if(this._ptList.size()<1)return null;var n=new Y(this._ptList.get(0)),r=this._ptList.get(this._ptList.size()-1);if(n.equals(r))return null;this._ptList.add(n)}},{key:"setMinimumVertexDistance",value:function(n){this._minimimVertexDistance=n}}],[{key:"constructor_",value:function(){this._ptList=null,this._precisionModel=null,this._minimimVertexDistance=0,this._ptList=new pe}}])})();yc.COORDINATE_ARRAY_TYPE=new Array(0).fill(null);var Pt=(function(){function o(){u(this,o)}return h(o,null,[{key:"toDegrees",value:function(n){return 180*n/Math.PI}},{key:"normalize",value:function(n){for(;n>Math.PI;)n-=o.PI_TIMES_2;for(;n<=-Math.PI;)n+=o.PI_TIMES_2;return n}},{key:"angle",value:function(){if(arguments.length===1){var n=arguments[0];return Math.atan2(n.y,n.x)}if(arguments.length===2){var r=arguments[0],a=arguments[1],l=a.x-r.x,g=a.y-r.y;return Math.atan2(g,l)}}},{key:"isAcute",value:function(n,r,a){var l=n.x-r.x,g=n.y-r.y;return l*(a.x-r.x)+g*(a.y-r.y)>0}},{key:"isObtuse",value:function(n,r,a){var l=n.x-r.x,g=n.y-r.y;return l*(a.x-r.x)+g*(a.y-r.y)<0}},{key:"interiorAngle",value:function(n,r,a){var l=o.angle(r,n),g=o.angle(r,a);return Math.abs(g-l)}},{key:"normalizePositive",value:function(n){if(n<0){for(;n<0;)n+=o.PI_TIMES_2;n>=o.PI_TIMES_2&&(n=0)}else{for(;n>=o.PI_TIMES_2;)n-=o.PI_TIMES_2;n<0&&(n=0)}return n}},{key:"angleBetween",value:function(n,r,a){var l=o.angle(r,n),g=o.angle(r,a);return o.diff(l,g)}},{key:"diff",value:function(n,r){var a=null;return(a=n<r?r-n:n-r)>Math.PI&&(a=2*Math.PI-a),a}},{key:"toRadians",value:function(n){return n*Math.PI/180}},{key:"getTurn",value:function(n,r){var a=Math.sin(r-n);return a>0?o.COUNTERCLOCKWISE:a<0?o.CLOCKWISE:o.NONE}},{key:"angleBetweenOriented",value:function(n,r,a){var l=o.angle(r,n),g=o.angle(r,a)-l;return g<=-Math.PI?g+o.PI_TIMES_2:g>Math.PI?g-o.PI_TIMES_2:g}}])})();Pt.PI_TIMES_2=2*Math.PI,Pt.PI_OVER_2=Math.PI/2,Pt.PI_OVER_4=Math.PI/4,Pt.COUNTERCLOCKWISE=ve.COUNTERCLOCKWISE,Pt.CLOCKWISE=ve.CLOCKWISE,Pt.NONE=ve.COLLINEAR;var os=(function(){function o(){u(this,o),o.constructor_.apply(this,arguments)}return h(o,[{key:"addNextSegment",value:function(n,r){if(this._s0=this._s1,this._s1=this._s2,this._s2=n,this._seg0.setCoordinates(this._s0,this._s1),this.computeOffsetSegment(this._seg0,this._side,this._distance,this._offset0),this._seg1.setCoordinates(this._s1,this._s2),this.computeOffsetSegment(this._seg1,this._side,this._distance,this._offset1),this._s1.equals(this._s2))return null;var a=ve.index(this._s0,this._s1,this._s2),l=a===ve.CLOCKWISE&&this._side===ne.LEFT||a===ve.COUNTERCLOCKWISE&&this._side===ne.RIGHT;a===0?this.addCollinear(r):l?this.addOutsideTurn(a,r):this.addInsideTurn(a,r)}},{key:"addLineEndCap",value:function(n,r){var a=new Tt(n,r),l=new Tt;this.computeOffsetSegment(a,ne.LEFT,this._distance,l);var g=new Tt;this.computeOffsetSegment(a,ne.RIGHT,this._distance,g);var p=r.x-n.x,_=r.y-n.y,x=Math.atan2(_,p);switch(this._bufParams.getEndCapStyle()){case j.CAP_ROUND:this._segList.addPt(l.p1),this.addDirectedFillet(r,x+Math.PI/2,x-Math.PI/2,ve.CLOCKWISE,this._distance),this._segList.addPt(g.p1);break;case j.CAP_FLAT:this._segList.addPt(l.p1),this._segList.addPt(g.p1);break;case j.CAP_SQUARE:var I=new Y;I.x=Math.abs(this._distance)*Math.cos(x),I.y=Math.abs(this._distance)*Math.sin(x);var z=new Y(l.p1.x+I.x,l.p1.y+I.y),J=new Y(g.p1.x+I.x,g.p1.y+I.y);this._segList.addPt(z),this._segList.addPt(J)}}},{key:"getCoordinates",value:function(){return this._segList.getCoordinates()}},{key:"addMitreJoin",value:function(n,r,a,l){var g=Ar.intersection(r.p0,r.p1,a.p0,a.p1);if(g!==null&&(l<=0?1:g.distance(n)/Math.abs(l))<=this._bufParams.getMitreLimit())return this._segList.addPt(g),null;this.addLimitedMitreJoin(r,a,l,this._bufParams.getMitreLimit())}},{key:"addOutsideTurn",value:function(n,r){if(this._offset0.p1.distance(this._offset1.p0)<this._distance*o.OFFSET_SEGMENT_SEPARATION_FACTOR)return this._segList.addPt(this._offset0.p1),null;this._bufParams.getJoinStyle()===j.JOIN_MITRE?this.addMitreJoin(this._s1,this._offset0,this._offset1,this._distance):this._bufParams.getJoinStyle()===j.JOIN_BEVEL?this.addBevelJoin(this._offset0,this._offset1):(r&&this._segList.addPt(this._offset0.p1),this.addCornerFillet(this._s1,this._offset0.p1,this._offset1.p0,n,this._distance),this._segList.addPt(this._offset1.p0))}},{key:"createSquare",value:function(n){this._segList.addPt(new Y(n.x+this._distance,n.y+this._distance)),this._segList.addPt(new Y(n.x+this._distance,n.y-this._distance)),this._segList.addPt(new Y(n.x-this._distance,n.y-this._distance)),this._segList.addPt(new Y(n.x-this._distance,n.y+this._distance)),this._segList.closeRing()}},{key:"addSegments",value:function(n,r){this._segList.addPts(n,r)}},{key:"addFirstSegment",value:function(){this._segList.addPt(this._offset1.p0)}},{key:"addCornerFillet",value:function(n,r,a,l,g){var p=r.x-n.x,_=r.y-n.y,x=Math.atan2(_,p),I=a.x-n.x,z=a.y-n.y,J=Math.atan2(z,I);l===ve.CLOCKWISE?x<=J&&(x+=2*Math.PI):x>=J&&(x-=2*Math.PI),this._segList.addPt(r),this.addDirectedFillet(n,x,J,l,g),this._segList.addPt(a)}},{key:"addLastSegment",value:function(){this._segList.addPt(this._offset1.p1)}},{key:"initSideSegments",value:function(n,r,a){this._s1=n,this._s2=r,this._side=a,this._seg1.setCoordinates(n,r),this.computeOffsetSegment(this._seg1,a,this._distance,this._offset1)}},{key:"addLimitedMitreJoin",value:function(n,r,a,l){var g=this._seg0.p1,p=Pt.angle(g,this._seg0.p0),_=Pt.angleBetweenOriented(this._seg0.p0,g,this._seg1.p1)/2,x=Pt.normalize(p+_),I=Pt.normalize(x+Math.PI),z=l*a,J=a-z*Math.abs(Math.sin(_)),Q=new Tt(g,new Y(g.x+z*Math.cos(I),g.y+z*Math.sin(I))),le=Q.pointAlongOffset(1,J),de=Q.pointAlongOffset(1,-J);this._side===ne.LEFT?(this._segList.addPt(le),this._segList.addPt(de)):(this._segList.addPt(de),this._segList.addPt(le))}},{key:"addDirectedFillet",value:function(n,r,a,l,g){var p=l===ve.CLOCKWISE?-1:1,_=Math.abs(r-a),x=Math.trunc(_/this._filletAngleQuantum+.5);if(x<1)return null;for(var I=_/x,z=new Y,J=0;J<x;J++){var Q=r+p*J*I;z.x=n.x+g*Math.cos(Q),z.y=n.y+g*Math.sin(Q),this._segList.addPt(z)}}},{key:"computeOffsetSegment",value:function(n,r,a,l){var g=r===ne.LEFT?1:-1,p=n.p1.x-n.p0.x,_=n.p1.y-n.p0.y,x=Math.sqrt(p*p+_*_),I=g*a*p/x,z=g*a*_/x;l.p0.x=n.p0.x-z,l.p0.y=n.p0.y+I,l.p1.x=n.p1.x-z,l.p1.y=n.p1.y+I}},{key:"addInsideTurn",value:function(n,r){if(this._li.computeIntersection(this._offset0.p0,this._offset0.p1,this._offset1.p0,this._offset1.p1),this._li.hasIntersection())this._segList.addPt(this._li.getIntersection(0));else if(this._hasNarrowConcaveAngle=!0,this._offset0.p1.distance(this._offset1.p0)<this._distance*o.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR)this._segList.addPt(this._offset0.p1);else{if(this._segList.addPt(this._offset0.p1),this._closingSegLengthFactor>0){var a=new Y((this._closingSegLengthFactor*this._offset0.p1.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset0.p1.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(a);var l=new Y((this._closingSegLengthFactor*this._offset1.p0.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset1.p0.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(l)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}}},{key:"createCircle",value:function(n){var r=new Y(n.x+this._distance,n.y);this._segList.addPt(r),this.addDirectedFillet(n,0,2*Math.PI,-1,this._distance),this._segList.closeRing()}},{key:"addBevelJoin",value:function(n,r){this._segList.addPt(n.p1),this._segList.addPt(r.p0)}},{key:"init",value:function(n){this._distance=n,this._maxCurveSegmentError=n*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new yc,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(n*o.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)}},{key:"addCollinear",value:function(n){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2),this._li.getIntersectionNum()>=2&&(this._bufParams.getJoinStyle()===j.JOIN_BEVEL||this._bufParams.getJoinStyle()===j.JOIN_MITRE?(n&&this._segList.addPt(this._offset0.p1),this._segList.addPt(this._offset1.p0)):this.addCornerFillet(this._s1,this._offset0.p1,this._offset1.p0,ve.CLOCKWISE,this._distance))}},{key:"closeRing",value:function(){this._segList.closeRing()}},{key:"hasNarrowConcaveAngle",value:function(){return this._hasNarrowConcaveAngle}}],[{key:"constructor_",value:function(){this._maxCurveSegmentError=0,this._filletAngleQuantum=null,this._closingSegLengthFactor=1,this._segList=null,this._distance=0,this._precisionModel=null,this._bufParams=null,this._li=null,this._s0=null,this._s1=null,this._s2=null,this._seg0=new Tt,this._seg1=new Tt,this._offset0=new Tt,this._offset1=new Tt,this._side=0,this._hasNarrowConcaveAngle=!1;var n=arguments[0],r=arguments[1],a=arguments[2];this._precisionModel=n,this._bufParams=r,this._li=new Fr,this._filletAngleQuantum=Math.PI/2/r.getQuadrantSegments(),r.getQuadrantSegments()>=8&&r.getJoinStyle()===j.JOIN_ROUND&&(this._closingSegLengthFactor=o.MAX_CLOSING_SEG_LEN_FACTOR),this.init(a)}}])})();os.OFFSET_SEGMENT_SEPARATION_FACTOR=.001,os.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR=.001,os.CURVE_VERTEX_SNAP_DISTANCE_FACTOR=1e-6,os.MAX_CLOSING_SEG_LEN_FACTOR=80;var Jp=(function(){function o(){u(this,o),o.constructor_.apply(this,arguments)}return h(o,[{key:"getOffsetCurve",value:function(n,r){if(this._distance=r,r===0)return null;var a=r<0,l=Math.abs(r),g=this.getSegGen(l);n.length<=1?this.computePointCurve(n[0],g):this.computeOffsetCurve(n,a,g);var p=g.getCoordinates();return a&&A.reverse(p),p}},{key:"computeSingleSidedBufferCurve",value:function(n,r,a){var l=this.simplifyTolerance(this._distance);if(r){a.addSegments(n,!0);var g=dn.simplify(n,-l),p=g.length-1;a.initSideSegments(g[p],g[p-1],ne.LEFT),a.addFirstSegment();for(var _=p-2;_>=0;_--)a.addNextSegment(g[_],!0)}else{a.addSegments(n,!1);var x=dn.simplify(n,l),I=x.length-1;a.initSideSegments(x[0],x[1],ne.LEFT),a.addFirstSegment();for(var z=2;z<=I;z++)a.addNextSegment(x[z],!0)}a.addLastSegment(),a.closeRing()}},{key:"computeRingBufferCurve",value:function(n,r,a){var l=this.simplifyTolerance(this._distance);r===ne.RIGHT&&(l=-l);var g=dn.simplify(n,l),p=g.length-1;a.initSideSegments(g[p-1],g[0],r);for(var _=1;_<=p;_++){var x=_!==1;a.addNextSegment(g[_],x)}a.closeRing()}},{key:"computeLineBufferCurve",value:function(n,r){var a=this.simplifyTolerance(this._distance),l=dn.simplify(n,a),g=l.length-1;r.initSideSegments(l[0],l[1],ne.LEFT);for(var p=2;p<=g;p++)r.addNextSegment(l[p],!0);r.addLastSegment(),r.addLineEndCap(l[g-1],l[g]);var _=dn.simplify(n,-a),x=_.length-1;r.initSideSegments(_[x],_[x-1],ne.LEFT);for(var I=x-2;I>=0;I--)r.addNextSegment(_[I],!0);r.addLastSegment(),r.addLineEndCap(_[1],_[0]),r.closeRing()}},{key:"computePointCurve",value:function(n,r){switch(this._bufParams.getEndCapStyle()){case j.CAP_ROUND:r.createCircle(n);break;case j.CAP_SQUARE:r.createSquare(n)}}},{key:"getLineCurve",value:function(n,r){if(this._distance=r,this.isLineOffsetEmpty(r))return null;var a=Math.abs(r),l=this.getSegGen(a);if(n.length<=1)this.computePointCurve(n[0],l);else if(this._bufParams.isSingleSided()){var g=r<0;this.computeSingleSidedBufferCurve(n,g,l)}else this.computeLineBufferCurve(n,l);return l.getCoordinates()}},{key:"getBufferParameters",value:function(){return this._bufParams}},{key:"simplifyTolerance",value:function(n){return n*this._bufParams.getSimplifyFactor()}},{key:"getRingCurve",value:function(n,r,a){if(this._distance=a,n.length<=2)return this.getLineCurve(n,a);if(a===0)return o.copyCoordinates(n);var l=this.getSegGen(a);return this.computeRingBufferCurve(n,r,l),l.getCoordinates()}},{key:"computeOffsetCurve",value:function(n,r,a){var l=this.simplifyTolerance(this._distance);if(r){var g=dn.simplify(n,-l),p=g.length-1;a.initSideSegments(g[p],g[p-1],ne.LEFT),a.addFirstSegment();for(var _=p-2;_>=0;_--)a.addNextSegment(g[_],!0)}else{var x=dn.simplify(n,l),I=x.length-1;a.initSideSegments(x[0],x[1],ne.LEFT),a.addFirstSegment();for(var z=2;z<=I;z++)a.addNextSegment(x[z],!0)}a.addLastSegment()}},{key:"isLineOffsetEmpty",value:function(n){return n===0||n<0&&!this._bufParams.isSingleSided()}},{key:"getSegGen",value:function(n){return new os(this._precisionModel,this._bufParams,n)}}],[{key:"constructor_",value:function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var n=arguments[0],r=arguments[1];this._precisionModel=n,this._bufParams=r}},{key:"copyCoordinates",value:function(n){for(var r=new Array(n.length).fill(null),a=0;a<r.length;a++)r[a]=new Y(n[a]);return r}}])})(),_c=(function(){return h((function o(){u(this,o),o.constructor_.apply(this,arguments)}),[{key:"findStabbedSegments",value:function(){if(arguments.length===1){for(var o=arguments[0],n=new pe,r=this._subgraphs.iterator();r.hasNext();){var a=r.next(),l=a.getEnvelope();o.y<l.getMinY()||o.y>l.getMaxY()||this.findStabbedSegments(o,a.getDirectedEdges(),n)}return n}if(arguments.length===3){if(_e(arguments[2],bn)&&arguments[0]instanceof Y&&arguments[1]instanceof Po){for(var g=arguments[0],p=arguments[1],_=arguments[2],x=p.getEdge().getCoordinates(),I=0;I<x.length-1;I++)if(this._seg.p0=x[I],this._seg.p1=x[I+1],this._seg.p0.y>this._seg.p1.y&&this._seg.reverse(),!(Math.max(this._seg.p0.x,this._seg.p1.x)<g.x||this._seg.isHorizontal()||g.y<this._seg.p0.y||g.y>this._seg.p1.y||ve.index(this._seg.p0,this._seg.p1,g)===ve.RIGHT)){var z=p.getDepth(ne.LEFT);this._seg.p0.equals(x[I])||(z=p.getDepth(ne.RIGHT));var J=new wc(this._seg,z);_.add(J)}}else if(_e(arguments[2],bn)&&arguments[0]instanceof Y&&_e(arguments[1],bn))for(var Q=arguments[0],le=arguments[2],de=arguments[1].iterator();de.hasNext();){var me=de.next();me.isForward()&&this.findStabbedSegments(Q,me,le)}}}},{key:"getDepth",value:function(o){var n=this.findStabbedSegments(o);return n.size()===0?0:mi.min(n)._leftDepth}}],[{key:"constructor_",value:function(){this._subgraphs=null,this._seg=new Tt;var o=arguments[0];this._subgraphs=o}}])})(),wc=(function(){return h((function o(){u(this,o),o.constructor_.apply(this,arguments)}),[{key:"compareTo",value:function(o){var n=o;if(this._upwardSeg.minX()>=n._upwardSeg.maxX())return 1;if(this._upwardSeg.maxX()<=n._upwardSeg.minX())return-1;var r=this._upwardSeg.orientationIndex(n._upwardSeg);return r!==0||(r=-1*n._upwardSeg.orientationIndex(this._upwardSeg))!==0?r:this._upwardSeg.compareTo(n._upwardSeg)}},{key:"compareX",value:function(o,n){var r=o.p0.compareTo(n.p0);return r!==0?r:o.p1.compareTo(n.p1)}},{key:"toString",value:function(){return this._upwardSeg.toString()}},{key:"interfaces_",get:function(){return[$]}}],[{key:"constructor_",value:function(){this._upwardSeg=null,this._leftDepth=null;var o=arguments[0],n=arguments[1];this._upwardSeg=new Tt(o),this._leftDepth=n}}])})();_c.DepthSegment=wc;var kc=(function(o){function n(){var r;return u(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return y(n,o),h(n,null,[{key:"constructor_",value:function(){V.constructor_.call(this,"Projective point not representable on the Cartesian plane.")}}])})(V),Do=(function(){function o(){u(this,o),o.constructor_.apply(this,arguments)}return h(o,[{key:"getY",value:function(){var n=this.y/this.w;if(K.isNaN(n)||K.isInfinite(n))throw new kc;return n}},{key:"getX",value:function(){var n=this.x/this.w;if(K.isNaN(n)||K.isInfinite(n))throw new kc;return n}},{key:"getCoordinate",value:function(){var n=new Y;return n.x=this.getX(),n.y=this.getY(),n}}],[{key:"constructor_",value:function(){if(this.x=null,this.y=null,this.w=null,arguments.length===0)this.x=0,this.y=0,this.w=1;else if(arguments.length===1){var n=arguments[0];this.x=n.x,this.y=n.y,this.w=1}else if(arguments.length===2){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var r=arguments[0],a=arguments[1];this.x=r,this.y=a,this.w=1}else if(arguments[0]instanceof o&&arguments[1]instanceof o){var l=arguments[0],g=arguments[1];this.x=l.y*g.w-g.y*l.w,this.y=g.x*l.w-l.x*g.w,this.w=l.x*g.y-g.x*l.y}else if(arguments[0]instanceof Y&&arguments[1]instanceof Y){var p=arguments[0],_=arguments[1];this.x=p.y-_.y,this.y=_.x-p.x,this.w=p.x*_.y-_.x*p.y}}else if(arguments.length===3){var x=arguments[0],I=arguments[1],z=arguments[2];this.x=x,this.y=I,this.w=z}else if(arguments.length===4){var J=arguments[0],Q=arguments[1],le=arguments[2],de=arguments[3],me=J.y-Q.y,Pe=Q.x-J.x,Le=J.x*Q.y-Q.x*J.y,Fe=le.y-de.y,ct=de.x-le.x,dt=le.x*de.y-de.x*le.y;this.x=Pe*dt-ct*Le,this.y=Fe*Le-me*dt,this.w=me*ct-Fe*Pe}}}])})(),Vp=(function(){function o(){u(this,o),o.constructor_.apply(this,arguments)}return h(o,[{key:"area",value:function(){return o.area(this.p0,this.p1,this.p2)}},{key:"signedArea",value:function(){return o.signedArea(this.p0,this.p1,this.p2)}},{key:"interpolateZ",value:function(n){if(n===null)throw new X("Supplied point is null.");return o.interpolateZ(n,this.p0,this.p1,this.p2)}},{key:"longestSideLength",value:function(){return o.longestSideLength(this.p0,this.p1,this.p2)}},{key:"isAcute",value:function(){return o.isAcute(this.p0,this.p1,this.p2)}},{key:"circumcentre",value:function(){return o.circumcentre(this.p0,this.p1,this.p2)}},{key:"area3D",value:function(){return o.area3D(this.p0,this.p1,this.p2)}},{key:"centroid",value:function(){return o.centroid(this.p0,this.p1,this.p2)}},{key:"inCentre",value:function(){return o.inCentre(this.p0,this.p1,this.p2)}}],[{key:"constructor_",value:function(){this.p0=null,this.p1=null,this.p2=null;var n=arguments[0],r=arguments[1],a=arguments[2];this.p0=n,this.p1=r,this.p2=a}},{key:"area",value:function(n,r,a){return Math.abs(((a.x-n.x)*(r.y-n.y)-(r.x-n.x)*(a.y-n.y))/2)}},{key:"signedArea",value:function(n,r,a){return((a.x-n.x)*(r.y-n.y)-(r.x-n.x)*(a.y-n.y))/2}},{key:"det",value:function(n,r,a,l){return n*l-r*a}},{key:"interpolateZ",value:function(n,r,a,l){var g=r.x,p=r.y,_=a.x-g,x=l.x-g,I=a.y-p,z=l.y-p,J=_*z-x*I,Q=n.x-g,le=n.y-p,de=(z*Q-x*le)/J,me=(-I*Q+_*le)/J;return r.getZ()+de*(a.getZ()-r.getZ())+me*(l.getZ()-r.getZ())}},{key:"longestSideLength",value:function(n,r,a){var l=n.distance(r),g=r.distance(a),p=a.distance(n),_=l;return g>_&&(_=g),p>_&&(_=p),_}},{key:"circumcentreDD",value:function(n,r,a){var l=ge.valueOf(n.x).subtract(a.x),g=ge.valueOf(n.y).subtract(a.y),p=ge.valueOf(r.x).subtract(a.x),_=ge.valueOf(r.y).subtract(a.y),x=ge.determinant(l,g,p,_).multiply(2),I=l.sqr().add(g.sqr()),z=p.sqr().add(_.sqr()),J=ge.determinant(g,I,_,z),Q=ge.determinant(l,I,p,z);return new Y(ge.valueOf(a.x).subtract(J.divide(x)).doubleValue(),ge.valueOf(a.y).add(Q.divide(x)).doubleValue())}},{key:"isAcute",value:function(n,r,a){return!!Pt.isAcute(n,r,a)&&!!Pt.isAcute(r,a,n)&&!!Pt.isAcute(a,n,r)}},{key:"circumcentre",value:function(n,r,a){var l=a.x,g=a.y,p=n.x-l,_=n.y-g,x=r.x-l,I=r.y-g,z=2*o.det(p,_,x,I),J=o.det(_,p*p+_*_,I,x*x+I*I),Q=o.det(p,p*p+_*_,x,x*x+I*I);return new Y(l-J/z,g+Q/z)}},{key:"perpendicularBisector",value:function(n,r){var a=r.x-n.x,l=r.y-n.y;return new Do(new Do(n.x+a/2,n.y+l/2,1),new Do(n.x-l+a/2,n.y+a+l/2,1))}},{key:"angleBisector",value:function(n,r,a){var l=r.distance(n),g=l/(l+r.distance(a)),p=a.x-n.x,_=a.y-n.y;return new Y(n.x+g*p,n.y+g*_)}},{key:"area3D",value:function(n,r,a){var l=r.x-n.x,g=r.y-n.y,p=r.getZ()-n.getZ(),_=a.x-n.x,x=a.y-n.y,I=a.getZ()-n.getZ(),z=g*I-p*x,J=p*_-l*I,Q=l*x-g*_,le=z*z+J*J+Q*Q;return Math.sqrt(le)/2}},{key:"centroid",value:function(n,r,a){return new Y((n.x+r.x+a.x)/3,(n.y+r.y+a.y)/3)}},{key:"inCentre",value:function(n,r,a){var l=r.distance(a),g=n.distance(a),p=n.distance(r),_=l+g+p;return new Y((l*n.x+g*r.x+p*a.x)/_,(l*n.y+g*r.y+p*a.y)/_)}}])})(),Xp=(function(){return h((function o(){u(this,o),o.constructor_.apply(this,arguments)}),[{key:"addRingSide",value:function(o,n,r,a,l){if(n===0&&o.length<yt.MINIMUM_VALID_SIZE)return null;var g=a,p=l;o.length>=yt.MINIMUM_VALID_SIZE&&ve.isCCW(o)&&(g=l,p=a,r=ne.opposite(r));var _=this._curveBuilder.getRingCurve(o,r,n);this.addCurve(_,g,p)}},{key:"addRingBothSides",value:function(o,n){this.addRingSide(o,n,ne.LEFT,C.EXTERIOR,C.INTERIOR),this.addRingSide(o,n,ne.RIGHT,C.INTERIOR,C.EXTERIOR)}},{key:"addPoint",value:function(o){if(this._distance<=0)return null;var n=o.getCoordinates(),r=this._curveBuilder.getLineCurve(n,this._distance);this.addCurve(r,C.EXTERIOR,C.INTERIOR)}},{key:"addPolygon",value:function(o){var n=this._distance,r=ne.LEFT;this._distance<0&&(n=-this._distance,r=ne.RIGHT);var a=o.getExteriorRing(),l=A.removeRepeatedPoints(a.getCoordinates());if(this._distance<0&&this.isErodedCompletely(a,this._distance)||this._distance<=0&&l.length<3)return null;this.addRingSide(l,n,r,C.EXTERIOR,C.INTERIOR);for(var g=0;g<o.getNumInteriorRing();g++){var p=o.getInteriorRingN(g),_=A.removeRepeatedPoints(p.getCoordinates());this._distance>0&&this.isErodedCompletely(p,-this._distance)||this.addRingSide(_,n,ne.opposite(r),C.INTERIOR,C.EXTERIOR)}}},{key:"isTriangleErodedCompletely",value:function(o,n){var r=new Vp(o[0],o[1],o[2]),a=r.inCentre();return vt.pointToSegment(a,r.p0,r.p1)<Math.abs(n)}},{key:"addLineString",value:function(o){if(this._curveBuilder.isLineOffsetEmpty(this._distance))return null;var n=A.removeRepeatedPoints(o.getCoordinates());if(A.isRing(n)&&!this._curveBuilder.getBufferParameters().isSingleSided())this.addRingBothSides(n,this._distance);else{var r=this._curveBuilder.getLineCurve(n,this._distance);this.addCurve(r,C.EXTERIOR,C.INTERIOR)}}},{key:"addCurve",value:function(o,n,r){if(o===null||o.length<2)return null;var a=new Gr(o,new qt(0,C.BOUNDARY,n,r));this._curveList.add(a)}},{key:"getCurves",value:function(){return this.add(this._inputGeom),this._curveList}},{key:"add",value:function(o){if(o.isEmpty())return null;if(o instanceof zt)this.addPolygon(o);else if(o instanceof hr)this.addLineString(o);else if(o instanceof hi)this.addPoint(o);else if(o instanceof fi)this.addCollection(o);else if(o instanceof is)this.addCollection(o);else if(o instanceof gn)this.addCollection(o);else{if(!(o instanceof lt))throw new Re(o.getGeometryType());this.addCollection(o)}}},{key:"isErodedCompletely",value:function(o,n){var r=o.getCoordinates();if(r.length<4)return n<0;if(r.length===4)return this.isTriangleErodedCompletely(r,n);var a=o.getEnvelopeInternal(),l=Math.min(a.getHeight(),a.getWidth());return n<0&&2*Math.abs(n)>l}},{key:"addCollection",value:function(o){for(var n=0;n<o.getNumGeometries();n++){var r=o.getGeometryN(n);this.add(r)}}}],[{key:"constructor_",value:function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new pe;var o=arguments[0],n=arguments[1],r=arguments[2];this._inputGeom=o,this._distance=n,this._curveBuilder=r}}])})(),$p=(function(){return h((function o(){u(this,o)}),[{key:"locate",value:function(o){}}])})(),Zp=(function(){function o(){u(this,o),o.constructor_.apply(this,arguments)}return h(o,[{key:"next",value:function(){if(this._atStart)return this._atStart=!1,o.isAtomic(this._parent)&&this._index++,this._parent;if(this._subcollectionIterator!==null){if(this._subcollectionIterator.hasNext())return this._subcollectionIterator.next();this._subcollectionIterator=null}if(this._index>=this._max)throw new Be;var n=this._parent.getGeometryN(this._index++);return n instanceof lt?(this._subcollectionIterator=new o(n),this._subcollectionIterator.next()):n}},{key:"remove",value:function(){throw new Re(this.getClass().getName())}},{key:"hasNext",value:function(){if(this._atStart)return!0;if(this._subcollectionIterator!==null){if(this._subcollectionIterator.hasNext())return!0;this._subcollectionIterator=null}return!(this._index>=this._max)}},{key:"interfaces_",get:function(){return[Bp]}}],[{key:"constructor_",value:function(){this._parent=null,this._atStart=null,this._max=null,this._index=null,this._subcollectionIterator=null;var n=arguments[0];this._parent=n,this._atStart=!0,this._index=0,this._max=n.getNumGeometries()}},{key:"isAtomic",value:function(n){return!(n instanceof lt)}}])})(),Wp=(function(){function o(){u(this,o),o.constructor_.apply(this,arguments)}return h(o,[{key:"locate",value:function(n){return o.locate(n,this._geom)}},{key:"interfaces_",get:function(){return[$p]}}],[{key:"constructor_",value:function(){this._geom=null;var n=arguments[0];this._geom=n}},{key:"locatePointInPolygon",value:function(n,r){if(r.isEmpty())return C.EXTERIOR;var a=r.getExteriorRing(),l=o.locatePointInRing(n,a);if(l!==C.INTERIOR)return l;for(var g=0;g<r.getNumInteriorRing();g++){var p=r.getInteriorRingN(g),_=o.locatePointInRing(n,p);if(_===C.BOUNDARY)return C.BOUNDARY;if(_===C.INTERIOR)return C.EXTERIOR}return C.INTERIOR}},{key:"locatePointInRing",value:function(n,r){return r.getEnvelopeInternal().intersects(n)?Ao.locateInRing(n,r.getCoordinates()):C.EXTERIOR}},{key:"containsPointInPolygon",value:function(n,r){return C.EXTERIOR!==o.locatePointInPolygon(n,r)}},{key:"locateInGeometry",value:function(n,r){if(r instanceof zt)return o.locatePointInPolygon(n,r);if(r instanceof lt)for(var a=new Zp(r);a.hasNext();){var l=a.next();if(l!==r){var g=o.locateInGeometry(n,l);if(g!==C.EXTERIOR)return g}}return C.EXTERIOR}},{key:"isContained",value:function(n,r){return C.EXTERIOR!==o.locate(n,r)}},{key:"locate",value:function(n,r){return r.isEmpty()?C.EXTERIOR:r.getEnvelopeInternal().intersects(n)?o.locateInGeometry(n,r):C.EXTERIOR}}])})(),Kp=(function(o){function n(){var r;return u(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return y(n,o),h(n,[{key:"linkResultDirectedEdges",value:function(){this.getResultAreaEdges();for(var r=null,a=null,l=this._SCANNING_FOR_INCOMING,g=0;g<this._resultAreaEdgeList.size();g++){var p=this._resultAreaEdgeList.get(g),_=p.getSym();if(p.getLabel().isArea())switch(r===null&&p.isInResult()&&(r=p),l){case this._SCANNING_FOR_INCOMING:if(!_.isInResult())continue;a=_,l=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(!p.isInResult())continue;a.setNext(p),l=this._SCANNING_FOR_INCOMING}}if(l===this._LINKING_TO_OUTGOING){if(r===null)throw new Ut("no outgoing dirEdge found",this.getCoordinate());re.isTrue(r.isInResult(),"unable to link last incoming dirEdge"),a.setNext(r)}}},{key:"insert",value:function(r){var a=r;this.insertEdgeEnd(a,a)}},{key:"getRightmostEdge",value:function(){var r=this.getEdges(),a=r.size();if(a<1)return null;var l=r.get(0);if(a===1)return l;var g=r.get(a-1),p=l.getQuadrant(),_=g.getQuadrant();return _t.isNorthern(p)&&_t.isNorthern(_)?l:_t.isNorthern(p)||_t.isNorthern(_)?l.getDy()!==0?l:g.getDy()!==0?g:(re.shouldNeverReachHere("found two horizontal edges incident on node"),null):g}},{key:"print",value:function(r){gt.out.println("DirectedEdgeStar: "+this.getCoordinate());for(var a=this.iterator();a.hasNext();){var l=a.next();r.print("out "),l.print(r),r.println(),r.print("in "),l.getSym().print(r),r.println()}}},{key:"getResultAreaEdges",value:function(){if(this._resultAreaEdgeList!==null)return this._resultAreaEdgeList;this._resultAreaEdgeList=new pe;for(var r=this.iterator();r.hasNext();){var a=r.next();(a.isInResult()||a.getSym().isInResult())&&this._resultAreaEdgeList.add(a)}return this._resultAreaEdgeList}},{key:"updateLabelling",value:function(r){for(var a=this.iterator();a.hasNext();){var l=a.next().getLabel();l.setAllLocationsIfNull(0,r.getLocation(0)),l.setAllLocationsIfNull(1,r.getLocation(1))}}},{key:"linkAllDirectedEdges",value:function(){this.getEdges();for(var r=null,a=null,l=this._edgeList.size()-1;l>=0;l--){var g=this._edgeList.get(l),p=g.getSym();a===null&&(a=p),r!==null&&p.setNext(r),r=g}a.setNext(r)}},{key:"computeDepths",value:function(){if(arguments.length===1){var r=arguments[0],a=this.findIndex(r),l=r.getDepth(ne.LEFT),g=r.getDepth(ne.RIGHT),p=this.computeDepths(a+1,this._edgeList.size(),l);if(this.computeDepths(0,a,p)!==g)throw new Ut("depth mismatch at "+r.getCoordinate())}else if(arguments.length===3){for(var _=arguments[1],x=arguments[2],I=arguments[0];I<_;I++){var z=this._edgeList.get(I);z.setEdgeDepths(ne.RIGHT,x),x=z.getDepth(ne.LEFT)}return x}}},{key:"mergeSymLabels",value:function(){for(var r=this.iterator();r.hasNext();){var a=r.next();a.getLabel().merge(a.getSym().getLabel())}}},{key:"linkMinimalDirectedEdges",value:function(r){for(var a=null,l=null,g=this._SCANNING_FOR_INCOMING,p=this._resultAreaEdgeList.size()-1;p>=0;p--){var _=this._resultAreaEdgeList.get(p),x=_.getSym();switch(a===null&&_.getEdgeRing()===r&&(a=_),g){case this._SCANNING_FOR_INCOMING:if(x.getEdgeRing()!==r)continue;l=x,g=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(_.getEdgeRing()!==r)continue;l.setNextMin(_),g=this._SCANNING_FOR_INCOMING}}g===this._LINKING_TO_OUTGOING&&(re.isTrue(a!==null,"found null for first outgoing dirEdge"),re.isTrue(a.getEdgeRing()===r,"unable to link last incoming dirEdge"),l.setNextMin(a))}},{key:"getOutgoingDegree",value:function(){if(arguments.length===0){for(var r=0,a=this.iterator();a.hasNext();)a.next().isInResult()&&r++;return r}if(arguments.length===1){for(var l=arguments[0],g=0,p=this.iterator();p.hasNext();)p.next().getEdgeRing()===l&&g++;return g}}},{key:"getLabel",value:function(){return this._label}},{key:"findCoveredLineEdges",value:function(){for(var r=C.NONE,a=this.iterator();a.hasNext();){var l=a.next(),g=l.getSym();if(!l.isLineEdge()){if(l.isInResult()){r=C.INTERIOR;break}if(g.isInResult()){r=C.EXTERIOR;break}}}if(r===C.NONE)return null;for(var p=r,_=this.iterator();_.hasNext();){var x=_.next(),I=x.getSym();x.isLineEdge()?x.getEdge().setCovered(p===C.INTERIOR):(x.isInResult()&&(p=C.EXTERIOR),I.isInResult()&&(p=C.INTERIOR))}}},{key:"computeLabelling",value:function(r){b(n,"computeLabelling",this,1).call(this,r),this._label=new qt(C.NONE);for(var a=this.iterator();a.hasNext();)for(var l=a.next().getEdge().getLabel(),g=0;g<2;g++){var p=l.getLocation(g);p!==C.INTERIOR&&p!==C.BOUNDARY||this._label.setLocation(g,C.INTERIOR)}}}],[{key:"constructor_",value:function(){this._resultAreaEdgeList=null,this._label=null,this._SCANNING_FOR_INCOMING=1,this._LINKING_TO_OUTGOING=2}}])})((function(){return h((function o(){u(this,o),o.constructor_.apply(this,arguments)}),[{key:"getNextCW",value:function(o){this.getEdges();var n=this._edgeList.indexOf(o),r=n-1;return n===0&&(r=this._edgeList.size()-1),this._edgeList.get(r)}},{key:"propagateSideLabels",value:function(o){for(var n=C.NONE,r=this.iterator();r.hasNext();){var a=r.next().getLabel();a.isArea(o)&&a.getLocation(o,ne.LEFT)!==C.NONE&&(n=a.getLocation(o,ne.LEFT))}if(n===C.NONE)return null;for(var l=n,g=this.iterator();g.hasNext();){var p=g.next(),_=p.getLabel();if(_.getLocation(o,ne.ON)===C.NONE&&_.setLocation(o,ne.ON,l),_.isArea(o)){var x=_.getLocation(o,ne.LEFT),I=_.getLocation(o,ne.RIGHT);if(I!==C.NONE){if(I!==l)throw new Ut("side location conflict",p.getCoordinate());x===C.NONE&&re.shouldNeverReachHere("found single null side (at "+p.getCoordinate()+")"),l=x}else re.isTrue(_.getLocation(o,ne.LEFT)===C.NONE,"found single null side"),_.setLocation(o,ne.RIGHT,l),_.setLocation(o,ne.LEFT,l)}}}},{key:"getCoordinate",value:function(){var o=this.iterator();return o.hasNext()?o.next().getCoordinate():null}},{key:"print",value:function(o){gt.out.println("EdgeEndStar: "+this.getCoordinate());for(var n=this.iterator();n.hasNext();)n.next().print(o)}},{key:"isAreaLabelsConsistent",value:function(o){return this.computeEdgeEndLabels(o.getBoundaryNodeRule()),this.checkAreaLabelsConsistent(0)}},{key:"checkAreaLabelsConsistent",value:function(o){var n=this.getEdges();if(n.size()<=0)return!0;var r=n.size()-1,a=n.get(r).getLabel().getLocation(o,ne.LEFT);re.isTrue(a!==C.NONE,"Found unlabelled area edge");for(var l=a,g=this.iterator();g.hasNext();){var p=g.next().getLabel();re.isTrue(p.isArea(o),"Found non-area edge");var _=p.getLocation(o,ne.LEFT),x=p.getLocation(o,ne.RIGHT);if(_===x||x!==l)return!1;l=_}return!0}},{key:"findIndex",value:function(o){this.iterator();for(var n=0;n<this._edgeList.size();n++)if(this._edgeList.get(n)===o)return n;return-1}},{key:"iterator",value:function(){return this.getEdges().iterator()}},{key:"getEdges",value:function(){return this._edgeList===null&&(this._edgeList=new pe(this._edgeMap.values())),this._edgeList}},{key:"getLocation",value:function(o,n,r){return this._ptInAreaLocation[o]===C.NONE&&(this._ptInAreaLocation[o]=Wp.locate(n,r[o].getGeometry())),this._ptInAreaLocation[o]}},{key:"toString",value:function(){var o=new Vn;o.append("EdgeEndStar: "+this.getCoordinate()),o.append(`
|
|
211
|
+
`);for(var n=this.iterator();n.hasNext();){var r=n.next();o.append(r),o.append(`
|
|
212
|
+
`)}return o.toString()}},{key:"computeEdgeEndLabels",value:function(o){for(var n=this.iterator();n.hasNext();)n.next().computeLabel(o)}},{key:"computeLabelling",value:function(o){this.computeEdgeEndLabels(o[0].getBoundaryNodeRule()),this.propagateSideLabels(0),this.propagateSideLabels(1);for(var n=[!1,!1],r=this.iterator();r.hasNext();)for(var a=r.next().getLabel(),l=0;l<2;l++)a.isLine(l)&&a.getLocation(l)===C.BOUNDARY&&(n[l]=!0);for(var g=this.iterator();g.hasNext();)for(var p=g.next(),_=p.getLabel(),x=0;x<2;x++)if(_.isAnyNull(x)){var I=C.NONE;if(n[x])I=C.EXTERIOR;else{var z=p.getCoordinate();I=this.getLocation(x,z,o)}_.setAllLocationsIfNull(x,I)}}},{key:"getDegree",value:function(){return this._edgeMap.size()}},{key:"insertEdgeEnd",value:function(o,n){this._edgeMap.put(o,n),this._edgeList=null}}],[{key:"constructor_",value:function(){this._edgeMap=new as,this._edgeList=null,this._ptInAreaLocation=[C.NONE,C.NONE]}}])})()),Qp=(function(o){function n(){return u(this,n),s(this,n)}return y(n,o),h(n,[{key:"createNode",value:function(r){return new ga(r,new Kp)}}])})(cc),xc=(function(){function o(){u(this,o),o.constructor_.apply(this,arguments)}return h(o,[{key:"compareTo",value:function(n){var r=n;return o.compareOriented(this._pts,this._orientation,r._pts,r._orientation)}},{key:"interfaces_",get:function(){return[$]}}],[{key:"constructor_",value:function(){this._pts=null,this._orientation=null;var n=arguments[0];this._pts=n,this._orientation=o.orientation(n)}},{key:"orientation",value:function(n){return A.increasingDirection(n)===1}},{key:"compareOriented",value:function(n,r,a,l){for(var g=r?1:-1,p=l?1:-1,_=r?n.length:-1,x=l?a.length:-1,I=r?0:n.length-1,z=l?0:a.length-1;;){var J=n[I].compareTo(a[z]);if(J!==0)return J;var Q=(I+=g)===_,le=(z+=p)===x;if(Q&&!le)return-1;if(!Q&&le)return 1;if(Q&&le)return 0}}}])})(),em=(function(){return h((function o(){u(this,o),o.constructor_.apply(this,arguments)}),[{key:"print",value:function(o){o.print("MULTILINESTRING ( ");for(var n=0;n<this._edges.size();n++){var r=this._edges.get(n);n>0&&o.print(","),o.print("(");for(var a=r.getCoordinates(),l=0;l<a.length;l++)l>0&&o.print(","),o.print(a[l].x+" "+a[l].y);o.println(")")}o.print(") ")}},{key:"addAll",value:function(o){for(var n=o.iterator();n.hasNext();)this.add(n.next())}},{key:"findEdgeIndex",value:function(o){for(var n=0;n<this._edges.size();n++)if(this._edges.get(n).equals(o))return n;return-1}},{key:"iterator",value:function(){return this._edges.iterator()}},{key:"getEdges",value:function(){return this._edges}},{key:"get",value:function(o){return this._edges.get(o)}},{key:"findEqualEdge",value:function(o){var n=new xc(o.getCoordinates());return this._ocaMap.get(n)}},{key:"add",value:function(o){this._edges.add(o);var n=new xc(o.getCoordinates());this._ocaMap.put(n,o)}}],[{key:"constructor_",value:function(){this._edges=new pe,this._ocaMap=new as}}])})(),Ec=(function(){return h((function o(){u(this,o)}),[{key:"processIntersections",value:function(o,n,r,a){}},{key:"isDone",value:function(){}}])})(),tm=(function(){function o(){u(this,o),o.constructor_.apply(this,arguments)}return h(o,[{key:"isTrivialIntersection",value:function(n,r,a,l){if(n===a&&this._li.getIntersectionNum()===1){if(o.isAdjacentSegments(r,l))return!0;if(n.isClosed()){var g=n.size()-1;if(r===0&&l===g||l===0&&r===g)return!0}}return!1}},{key:"getProperIntersectionPoint",value:function(){return this._properIntersectionPoint}},{key:"hasProperInteriorIntersection",value:function(){return this._hasProperInterior}},{key:"getLineIntersector",value:function(){return this._li}},{key:"hasProperIntersection",value:function(){return this._hasProper}},{key:"processIntersections",value:function(n,r,a,l){if(n===a&&r===l)return null;this.numTests++;var g=n.getCoordinates()[r],p=n.getCoordinates()[r+1],_=a.getCoordinates()[l],x=a.getCoordinates()[l+1];this._li.computeIntersection(g,p,_,x),this._li.hasIntersection()&&(this.numIntersections++,this._li.isInteriorIntersection()&&(this.numInteriorIntersections++,this._hasInterior=!0),this.isTrivialIntersection(n,r,a,l)||(this._hasIntersection=!0,n.addIntersections(this._li,r,0),a.addIntersections(this._li,l,1),this._li.isProper()&&(this.numProperIntersections++,this._hasProper=!0,this._hasProperInterior=!0)))}},{key:"hasIntersection",value:function(){return this._hasIntersection}},{key:"isDone",value:function(){return!1}},{key:"hasInteriorIntersection",value:function(){return this._hasInterior}},{key:"interfaces_",get:function(){return[Ec]}}],[{key:"constructor_",value:function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._hasInterior=!1,this._properIntersectionPoint=null,this._li=null,this._isSelfIntersection=null,this.numIntersections=0,this.numInteriorIntersections=0,this.numProperIntersections=0,this.numTests=0;var n=arguments[0];this._li=n}},{key:"isAdjacentSegments",value:function(n,r){return Math.abs(n-r)===1}}])})(),nm=(function(){return h((function o(){u(this,o),o.constructor_.apply(this,arguments)}),[{key:"getSegmentIndex",value:function(){return this.segmentIndex}},{key:"getCoordinate",value:function(){return this.coord}},{key:"print",value:function(o){o.print(this.coord),o.print(" seg # = "+this.segmentIndex),o.println(" dist = "+this.dist)}},{key:"compareTo",value:function(o){var n=o;return this.compare(n.segmentIndex,n.dist)}},{key:"isEndPoint",value:function(o){return this.segmentIndex===0&&this.dist===0||this.segmentIndex===o}},{key:"toString",value:function(){return this.coord+" seg # = "+this.segmentIndex+" dist = "+this.dist}},{key:"getDistance",value:function(){return this.dist}},{key:"compare",value:function(o,n){return this.segmentIndex<o?-1:this.segmentIndex>o?1:this.dist<n?-1:this.dist>n?1:0}},{key:"interfaces_",get:function(){return[$]}}],[{key:"constructor_",value:function(){this.coord=null,this.segmentIndex=null,this.dist=null;var o=arguments[0],n=arguments[1],r=arguments[2];this.coord=new Y(o),this.segmentIndex=n,this.dist=r}}])})(),rm=(function(){return h((function o(){u(this,o),o.constructor_.apply(this,arguments)}),[{key:"print",value:function(o){o.println("Intersections:");for(var n=this.iterator();n.hasNext();)n.next().print(o)}},{key:"iterator",value:function(){return this._nodeMap.values().iterator()}},{key:"addSplitEdges",value:function(o){this.addEndpoints();for(var n=this.iterator(),r=n.next();n.hasNext();){var a=n.next(),l=this.createSplitEdge(r,a);o.add(l),r=a}}},{key:"addEndpoints",value:function(){var o=this.edge.pts.length-1;this.add(this.edge.pts[0],0,0),this.add(this.edge.pts[o],o,0)}},{key:"createSplitEdge",value:function(o,n){var r=n.segmentIndex-o.segmentIndex+2,a=this.edge.pts[n.segmentIndex],l=n.dist>0||!n.coord.equals2D(a);l||r--;var g=new Array(r).fill(null),p=0;g[p++]=new Y(o.coord);for(var _=o.segmentIndex+1;_<=n.segmentIndex;_++)g[p++]=this.edge.pts[_];return l&&(g[p]=n.coord),new Sc(g,new qt(this.edge._label))}},{key:"add",value:function(o,n,r){var a=new nm(o,n,r),l=this._nodeMap.get(a);return l!==null?l:(this._nodeMap.put(a,a),a)}},{key:"isIntersection",value:function(o){for(var n=this.iterator();n.hasNext();)if(n.next().coord.equals(o))return!0;return!1}}],[{key:"constructor_",value:function(){this._nodeMap=new as,this.edge=null;var o=arguments[0];this.edge=o}}])})(),im=(function(){function o(){u(this,o),o.constructor_.apply(this,arguments)}return h(o,[{key:"isIntersects",value:function(){return!this.isDisjoint()}},{key:"isCovers",value:function(){return(o.isTrue(this._matrix[C.INTERIOR][C.INTERIOR])||o.isTrue(this._matrix[C.INTERIOR][C.BOUNDARY])||o.isTrue(this._matrix[C.BOUNDARY][C.INTERIOR])||o.isTrue(this._matrix[C.BOUNDARY][C.BOUNDARY]))&&this._matrix[C.EXTERIOR][C.INTERIOR]===te.FALSE&&this._matrix[C.EXTERIOR][C.BOUNDARY]===te.FALSE}},{key:"isCoveredBy",value:function(){return(o.isTrue(this._matrix[C.INTERIOR][C.INTERIOR])||o.isTrue(this._matrix[C.INTERIOR][C.BOUNDARY])||o.isTrue(this._matrix[C.BOUNDARY][C.INTERIOR])||o.isTrue(this._matrix[C.BOUNDARY][C.BOUNDARY]))&&this._matrix[C.INTERIOR][C.EXTERIOR]===te.FALSE&&this._matrix[C.BOUNDARY][C.EXTERIOR]===te.FALSE}},{key:"set",value:function(){if(arguments.length===1)for(var n=arguments[0],r=0;r<n.length;r++){var a=Math.trunc(r/3),l=r%3;this._matrix[a][l]=te.toDimensionValue(n.charAt(r))}else if(arguments.length===3){var g=arguments[0],p=arguments[1],_=arguments[2];this._matrix[g][p]=_}}},{key:"isContains",value:function(){return o.isTrue(this._matrix[C.INTERIOR][C.INTERIOR])&&this._matrix[C.EXTERIOR][C.INTERIOR]===te.FALSE&&this._matrix[C.EXTERIOR][C.BOUNDARY]===te.FALSE}},{key:"setAtLeast",value:function(){if(arguments.length===1)for(var n=arguments[0],r=0;r<n.length;r++){var a=Math.trunc(r/3),l=r%3;this.setAtLeast(a,l,te.toDimensionValue(n.charAt(r)))}else if(arguments.length===3){var g=arguments[0],p=arguments[1],_=arguments[2];this._matrix[g][p]<_&&(this._matrix[g][p]=_)}}},{key:"setAtLeastIfValid",value:function(n,r,a){n>=0&&r>=0&&this.setAtLeast(n,r,a)}},{key:"isWithin",value:function(){return o.isTrue(this._matrix[C.INTERIOR][C.INTERIOR])&&this._matrix[C.INTERIOR][C.EXTERIOR]===te.FALSE&&this._matrix[C.BOUNDARY][C.EXTERIOR]===te.FALSE}},{key:"isTouches",value:function(n,r){return n>r?this.isTouches(r,n):(n===te.A&&r===te.A||n===te.L&&r===te.L||n===te.L&&r===te.A||n===te.P&&r===te.A||n===te.P&&r===te.L)&&this._matrix[C.INTERIOR][C.INTERIOR]===te.FALSE&&(o.isTrue(this._matrix[C.INTERIOR][C.BOUNDARY])||o.isTrue(this._matrix[C.BOUNDARY][C.INTERIOR])||o.isTrue(this._matrix[C.BOUNDARY][C.BOUNDARY]))}},{key:"isOverlaps",value:function(n,r){return n===te.P&&r===te.P||n===te.A&&r===te.A?o.isTrue(this._matrix[C.INTERIOR][C.INTERIOR])&&o.isTrue(this._matrix[C.INTERIOR][C.EXTERIOR])&&o.isTrue(this._matrix[C.EXTERIOR][C.INTERIOR]):n===te.L&&r===te.L&&this._matrix[C.INTERIOR][C.INTERIOR]===1&&o.isTrue(this._matrix[C.INTERIOR][C.EXTERIOR])&&o.isTrue(this._matrix[C.EXTERIOR][C.INTERIOR])}},{key:"isEquals",value:function(n,r){return n===r&&o.isTrue(this._matrix[C.INTERIOR][C.INTERIOR])&&this._matrix[C.INTERIOR][C.EXTERIOR]===te.FALSE&&this._matrix[C.BOUNDARY][C.EXTERIOR]===te.FALSE&&this._matrix[C.EXTERIOR][C.INTERIOR]===te.FALSE&&this._matrix[C.EXTERIOR][C.BOUNDARY]===te.FALSE}},{key:"toString",value:function(){for(var n=new Ne("123456789"),r=0;r<3;r++)for(var a=0;a<3;a++)n.setCharAt(3*r+a,te.toDimensionSymbol(this._matrix[r][a]));return n.toString()}},{key:"setAll",value:function(n){for(var r=0;r<3;r++)for(var a=0;a<3;a++)this._matrix[r][a]=n}},{key:"get",value:function(n,r){return this._matrix[n][r]}},{key:"transpose",value:function(){var n=this._matrix[1][0];return this._matrix[1][0]=this._matrix[0][1],this._matrix[0][1]=n,n=this._matrix[2][0],this._matrix[2][0]=this._matrix[0][2],this._matrix[0][2]=n,n=this._matrix[2][1],this._matrix[2][1]=this._matrix[1][2],this._matrix[1][2]=n,this}},{key:"matches",value:function(n){if(n.length!==9)throw new X("Should be length 9: "+n);for(var r=0;r<3;r++)for(var a=0;a<3;a++)if(!o.matches(this._matrix[r][a],n.charAt(3*r+a)))return!1;return!0}},{key:"add",value:function(n){for(var r=0;r<3;r++)for(var a=0;a<3;a++)this.setAtLeast(r,a,n.get(r,a))}},{key:"isDisjoint",value:function(){return this._matrix[C.INTERIOR][C.INTERIOR]===te.FALSE&&this._matrix[C.INTERIOR][C.BOUNDARY]===te.FALSE&&this._matrix[C.BOUNDARY][C.INTERIOR]===te.FALSE&&this._matrix[C.BOUNDARY][C.BOUNDARY]===te.FALSE}},{key:"isCrosses",value:function(n,r){return n===te.P&&r===te.L||n===te.P&&r===te.A||n===te.L&&r===te.A?o.isTrue(this._matrix[C.INTERIOR][C.INTERIOR])&&o.isTrue(this._matrix[C.INTERIOR][C.EXTERIOR]):n===te.L&&r===te.P||n===te.A&&r===te.P||n===te.A&&r===te.L?o.isTrue(this._matrix[C.INTERIOR][C.INTERIOR])&&o.isTrue(this._matrix[C.EXTERIOR][C.INTERIOR]):n===te.L&&r===te.L&&this._matrix[C.INTERIOR][C.INTERIOR]===0}},{key:"interfaces_",get:function(){return[w]}}],[{key:"constructor_",value:function(){if(this._matrix=null,arguments.length===0)this._matrix=Array(3).fill().map((function(){return Array(3)})),this.setAll(te.FALSE);else if(arguments.length===1){if(typeof arguments[0]=="string"){var n=arguments[0];o.constructor_.call(this),this.set(n)}else if(arguments[0]instanceof o){var r=arguments[0];o.constructor_.call(this),this._matrix[C.INTERIOR][C.INTERIOR]=r._matrix[C.INTERIOR][C.INTERIOR],this._matrix[C.INTERIOR][C.BOUNDARY]=r._matrix[C.INTERIOR][C.BOUNDARY],this._matrix[C.INTERIOR][C.EXTERIOR]=r._matrix[C.INTERIOR][C.EXTERIOR],this._matrix[C.BOUNDARY][C.INTERIOR]=r._matrix[C.BOUNDARY][C.INTERIOR],this._matrix[C.BOUNDARY][C.BOUNDARY]=r._matrix[C.BOUNDARY][C.BOUNDARY],this._matrix[C.BOUNDARY][C.EXTERIOR]=r._matrix[C.BOUNDARY][C.EXTERIOR],this._matrix[C.EXTERIOR][C.INTERIOR]=r._matrix[C.EXTERIOR][C.INTERIOR],this._matrix[C.EXTERIOR][C.BOUNDARY]=r._matrix[C.EXTERIOR][C.BOUNDARY],this._matrix[C.EXTERIOR][C.EXTERIOR]=r._matrix[C.EXTERIOR][C.EXTERIOR]}}}},{key:"matches",value:function(){if(Number.isInteger(arguments[0])&&typeof arguments[1]=="string"){var n=arguments[0],r=arguments[1];return r===te.SYM_DONTCARE||r===te.SYM_TRUE&&(n>=0||n===te.TRUE)||r===te.SYM_FALSE&&n===te.FALSE||r===te.SYM_P&&n===te.P||r===te.SYM_L&&n===te.L||r===te.SYM_A&&n===te.A}if(typeof arguments[0]=="string"&&typeof arguments[1]=="string"){var a=arguments[1];return new o(arguments[0]).matches(a)}}},{key:"isTrue",value:function(n){return n>=0||n===te.TRUE}}])})(),sm=(function(){function o(){u(this,o),o.constructor_.apply(this,arguments)}return h(o,[{key:"size",value:function(){return this._size}},{key:"addAll",value:function(n){return n===null||n.length===0?null:(this.ensureCapacity(this._size+n.length),gt.arraycopy(n,0,this._data,this._size,n.length),void(this._size+=n.length))}},{key:"ensureCapacity",value:function(n){if(n<=this._data.length)return null;var r=Math.max(n,2*this._data.length);this._data=$n.copyOf(this._data,r)}},{key:"toArray",value:function(){var n=new Array(this._size).fill(null);return gt.arraycopy(this._data,0,n,0,this._size),n}},{key:"add",value:function(n){this.ensureCapacity(this._size+1),this._data[this._size]=n,++this._size}}],[{key:"constructor_",value:function(){if(this._data=null,this._size=0,arguments.length===0)o.constructor_.call(this,10);else if(arguments.length===1){var n=arguments[0];this._data=new Array(n).fill(null)}}}])})(),am=(function(){function o(){u(this,o)}return h(o,[{key:"getChainStartIndices",value:function(n){var r=0,a=new sm(Math.trunc(n.length/2));a.add(r);do{var l=this.findChainEnd(n,r);a.add(l),r=l}while(r<n.length-1);return a.toArray()}},{key:"findChainEnd",value:function(n,r){for(var a=_t.quadrant(n[r],n[r+1]),l=r+1;l<n.length&&_t.quadrant(n[l-1],n[l])===a;)l++;return l-1}},{key:"OLDgetChainStartIndices",value:function(n){var r=0,a=new pe;a.add(r);do{var l=this.findChainEnd(n,r);a.add(l),r=l}while(r<n.length-1);return o.toIntArray(a)}}],[{key:"toIntArray",value:function(n){for(var r=new Array(n.size()).fill(null),a=0;a<r.length;a++)r[a]=n.get(a).intValue();return r}}])})(),om=(function(){return h((function o(){u(this,o),o.constructor_.apply(this,arguments)}),[{key:"getCoordinates",value:function(){return this.pts}},{key:"getMaxX",value:function(o){var n=this.pts[this.startIndex[o]].x,r=this.pts[this.startIndex[o+1]].x;return n>r?n:r}},{key:"getMinX",value:function(o){var n=this.pts[this.startIndex[o]].x,r=this.pts[this.startIndex[o+1]].x;return n<r?n:r}},{key:"computeIntersectsForChain",value:function(){if(arguments.length===4){var o=arguments[0],n=arguments[1],r=arguments[2],a=arguments[3];this.computeIntersectsForChain(this.startIndex[o],this.startIndex[o+1],n,n.startIndex[r],n.startIndex[r+1],a)}else if(arguments.length===6){var l=arguments[0],g=arguments[1],p=arguments[2],_=arguments[3],x=arguments[4],I=arguments[5];if(g-l==1&&x-_==1)return I.addIntersections(this.e,l,p.e,_),null;if(!this.overlaps(l,g,p,_,x))return null;var z=Math.trunc((l+g)/2),J=Math.trunc((_+x)/2);l<z&&(_<J&&this.computeIntersectsForChain(l,z,p,_,J,I),J<x&&this.computeIntersectsForChain(l,z,p,J,x,I)),z<g&&(_<J&&this.computeIntersectsForChain(z,g,p,_,J,I),J<x&&this.computeIntersectsForChain(z,g,p,J,x,I))}}},{key:"overlaps",value:function(o,n,r,a,l){return be.intersects(this.pts[o],this.pts[n],r.pts[a],r.pts[l])}},{key:"getStartIndexes",value:function(){return this.startIndex}},{key:"computeIntersects",value:function(o,n){for(var r=0;r<this.startIndex.length-1;r++)for(var a=0;a<o.startIndex.length-1;a++)this.computeIntersectsForChain(r,o,a,n)}}],[{key:"constructor_",value:function(){this.e=null,this.pts=null,this.startIndex=null;var o=arguments[0];this.e=o,this.pts=o.getCoordinates();var n=new am;this.startIndex=n.getChainStartIndices(this.pts)}}])})(),bc=(function(){function o(){u(this,o),o.constructor_.apply(this,arguments)}return h(o,[{key:"getDepth",value:function(n,r){return this._depth[n][r]}},{key:"setDepth",value:function(n,r,a){this._depth[n][r]=a}},{key:"isNull",value:function(){if(arguments.length===0){for(var n=0;n<2;n++)for(var r=0;r<3;r++)if(this._depth[n][r]!==o.NULL_VALUE)return!1;return!0}if(arguments.length===1){var a=arguments[0];return this._depth[a][1]===o.NULL_VALUE}if(arguments.length===2){var l=arguments[0],g=arguments[1];return this._depth[l][g]===o.NULL_VALUE}}},{key:"normalize",value:function(){for(var n=0;n<2;n++)if(!this.isNull(n)){var r=this._depth[n][1];this._depth[n][2]<r&&(r=this._depth[n][2]),r<0&&(r=0);for(var a=1;a<3;a++){var l=0;this._depth[n][a]>r&&(l=1),this._depth[n][a]=l}}}},{key:"getDelta",value:function(n){return this._depth[n][ne.RIGHT]-this._depth[n][ne.LEFT]}},{key:"getLocation",value:function(n,r){return this._depth[n][r]<=0?C.EXTERIOR:C.INTERIOR}},{key:"toString",value:function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]}},{key:"add",value:function(){if(arguments.length===1)for(var n=arguments[0],r=0;r<2;r++)for(var a=1;a<3;a++){var l=n.getLocation(r,a);l!==C.EXTERIOR&&l!==C.INTERIOR||(this.isNull(r,a)?this._depth[r][a]=o.depthAtLocation(l):this._depth[r][a]+=o.depthAtLocation(l))}else if(arguments.length===3){var g=arguments[0],p=arguments[1];arguments[2]===C.INTERIOR&&this._depth[g][p]++}}}],[{key:"constructor_",value:function(){this._depth=Array(2).fill().map((function(){return Array(3)}));for(var n=0;n<2;n++)for(var r=0;r<3;r++)this._depth[n][r]=o.NULL_VALUE}},{key:"depthAtLocation",value:function(n){return n===C.EXTERIOR?0:n===C.INTERIOR?1:o.NULL_VALUE}}])})();bc.NULL_VALUE=-1;var Sc=(function(o){function n(){var r;return u(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return y(n,o),h(n,[{key:"getDepth",value:function(){return this._depth}},{key:"getCollapsedEdge",value:function(){var r=new Array(2).fill(null);return r[0]=this.pts[0],r[1]=this.pts[1],new n(r,qt.toLineLabel(this._label))}},{key:"isIsolated",value:function(){return this._isIsolated}},{key:"getCoordinates",value:function(){return this.pts}},{key:"setIsolated",value:function(r){this._isIsolated=r}},{key:"setName",value:function(r){this._name=r}},{key:"equals",value:function(r){if(!(r instanceof n))return!1;var a=r;if(this.pts.length!==a.pts.length)return!1;for(var l=!0,g=!0,p=this.pts.length,_=0;_<this.pts.length;_++)if(this.pts[_].equals2D(a.pts[_])||(l=!1),this.pts[_].equals2D(a.pts[--p])||(g=!1),!l&&!g)return!1;return!0}},{key:"getCoordinate",value:function(){if(arguments.length===0)return this.pts.length>0?this.pts[0]:null;if(arguments.length===1){var r=arguments[0];return this.pts[r]}}},{key:"print",value:function(r){r.print("edge "+this._name+": "),r.print("LINESTRING (");for(var a=0;a<this.pts.length;a++)a>0&&r.print(","),r.print(this.pts[a].x+" "+this.pts[a].y);r.print(") "+this._label+" "+this._depthDelta)}},{key:"computeIM",value:function(r){n.updateIM(this._label,r)}},{key:"isCollapsed",value:function(){return!!this._label.isArea()&&this.pts.length===3&&!!this.pts[0].equals(this.pts[2])}},{key:"isClosed",value:function(){return this.pts[0].equals(this.pts[this.pts.length-1])}},{key:"getMaximumSegmentIndex",value:function(){return this.pts.length-1}},{key:"getDepthDelta",value:function(){return this._depthDelta}},{key:"getNumPoints",value:function(){return this.pts.length}},{key:"printReverse",value:function(r){r.print("edge "+this._name+": ");for(var a=this.pts.length-1;a>=0;a--)r.print(this.pts[a]+" ");r.println("")}},{key:"getMonotoneChainEdge",value:function(){return this._mce===null&&(this._mce=new om(this)),this._mce}},{key:"getEnvelope",value:function(){if(this._env===null){this._env=new be;for(var r=0;r<this.pts.length;r++)this._env.expandToInclude(this.pts[r])}return this._env}},{key:"addIntersection",value:function(r,a,l,g){var p=new Y(r.getIntersection(g)),_=a,x=r.getEdgeDistance(l,g),I=_+1;if(I<this.pts.length){var z=this.pts[I];p.equals2D(z)&&(_=I,x=0)}this.eiList.add(p,_,x)}},{key:"toString",value:function(){var r=new Ne;r.append("edge "+this._name+": "),r.append("LINESTRING (");for(var a=0;a<this.pts.length;a++)a>0&&r.append(","),r.append(this.pts[a].x+" "+this.pts[a].y);return r.append(") "+this._label+" "+this._depthDelta),r.toString()}},{key:"isPointwiseEqual",value:function(r){if(this.pts.length!==r.pts.length)return!1;for(var a=0;a<this.pts.length;a++)if(!this.pts[a].equals2D(r.pts[a]))return!1;return!0}},{key:"setDepthDelta",value:function(r){this._depthDelta=r}},{key:"getEdgeIntersectionList",value:function(){return this.eiList}},{key:"addIntersections",value:function(r,a,l){for(var g=0;g<r.getIntersectionNum();g++)this.addIntersection(r,a,l,g)}}],[{key:"constructor_",value:function(){if(this.pts=null,this._env=null,this.eiList=new rm(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new bc,this._depthDelta=0,arguments.length===1){var r=arguments[0];n.constructor_.call(this,r,null)}else if(arguments.length===2){var a=arguments[0],l=arguments[1];this.pts=a,this._label=l}}},{key:"updateIM",value:function(){if(!(arguments.length===2&&arguments[1]instanceof im&&arguments[0]instanceof qt))return b(n,"updateIM",this).apply(this,arguments);var r=arguments[0],a=arguments[1];a.setAtLeastIfValid(r.getLocation(0,ne.ON),r.getLocation(1,ne.ON),1),r.isArea()&&(a.setAtLeastIfValid(r.getLocation(0,ne.LEFT),r.getLocation(1,ne.LEFT),2),a.setAtLeastIfValid(r.getLocation(0,ne.RIGHT),r.getLocation(1,ne.RIGHT),2))}}])})(sc),Ic=(function(){function o(){u(this,o),o.constructor_.apply(this,arguments)}return h(o,[{key:"setWorkingPrecisionModel",value:function(n){this._workingPrecisionModel=n}},{key:"insertUniqueEdge",value:function(n){var r=this._edgeList.findEqualEdge(n);if(r!==null){var a=r.getLabel(),l=n.getLabel();r.isPointwiseEqual(n)||(l=new qt(n.getLabel())).flip(),a.merge(l);var g=o.depthDelta(l),p=r.getDepthDelta()+g;r.setDepthDelta(p)}else this._edgeList.add(n),n.setDepthDelta(o.depthDelta(n.getLabel()))}},{key:"buildSubgraphs",value:function(n,r){for(var a=new pe,l=n.iterator();l.hasNext();){var g=l.next(),p=g.getRightmostCoordinate(),_=new _c(a).getDepth(p);g.computeDepth(_),g.findResultEdges(),a.add(g),r.add(g.getDirectedEdges(),g.getNodes())}}},{key:"createSubgraphs",value:function(n){for(var r=new pe,a=n.getNodes().iterator();a.hasNext();){var l=a.next();if(!l.isVisited()){var g=new cr;g.create(l),r.add(g)}}return mi.sort(r,mi.reverseOrder()),r}},{key:"createEmptyResultGeometry",value:function(){return this._geomFact.createPolygon()}},{key:"getNoder",value:function(n){if(this._workingNoder!==null)return this._workingNoder;var r=new Ro,a=new Fr;return a.setPrecisionModel(n),r.setSegmentIntersector(new tm(a)),r}},{key:"buffer",value:function(n,r){var a=this._workingPrecisionModel;a===null&&(a=n.getPrecisionModel()),this._geomFact=n.getFactory();var l=new Xp(n,r,new Jp(a,this._bufParams)).getCurves();if(l.size()<=0)return this.createEmptyResultGeometry();this.computeNodedEdges(l,a),this._graph=new hc(new Qp),this._graph.addEdges(this._edgeList.getEdges());var g=this.createSubgraphs(this._graph),p=new Pp(this._geomFact);this.buildSubgraphs(g,p);var _=p.getPolygons();return _.size()<=0?this.createEmptyResultGeometry():this._geomFact.buildGeometry(_)}},{key:"computeNodedEdges",value:function(n,r){var a=this.getNoder(r);a.computeNodes(n);for(var l=a.getNodedSubstrings().iterator();l.hasNext();){var g=l.next(),p=g.getCoordinates();if(p.length!==2||!p[0].equals2D(p[1])){var _=g.getData(),x=new Sc(g.getCoordinates(),new qt(_));this.insertUniqueEdge(x)}}}},{key:"setNoder",value:function(n){this._workingNoder=n}}],[{key:"constructor_",value:function(){this._bufParams=null,this._workingPrecisionModel=null,this._workingNoder=null,this._geomFact=null,this._graph=null,this._edgeList=new em;var n=arguments[0];this._bufParams=n}},{key:"depthDelta",value:function(n){var r=n.getLocation(0,ne.LEFT),a=n.getLocation(0,ne.RIGHT);return r===C.INTERIOR&&a===C.EXTERIOR?1:r===C.EXTERIOR&&a===C.INTERIOR?-1:0}},{key:"convertSegStrings",value:function(n){for(var r=new di,a=new pe;n.hasNext();){var l=n.next(),g=r.createLineString(l.getCoordinates());a.add(g)}return r.buildGeometry(a)}}])})(),um=(function(){function o(){u(this,o),o.constructor_.apply(this,arguments)}return h(o,[{key:"rescale",value:function(){if(_e(arguments[0],$e))for(var n=arguments[0].iterator();n.hasNext();){var r=n.next();this.rescale(r.getCoordinates())}else if(arguments[0]instanceof Array){for(var a=arguments[0],l=0;l<a.length;l++)a[l].x=a[l].x/this._scaleFactor+this._offsetX,a[l].y=a[l].y/this._scaleFactor+this._offsetY;a.length===2&&a[0].equals2D(a[1])&>.out.println(a)}}},{key:"scale",value:function(){if(_e(arguments[0],$e)){for(var n=arguments[0],r=new pe(n.size()),a=n.iterator();a.hasNext();){var l=a.next();r.add(new Gr(this.scale(l.getCoordinates()),l.getData()))}return r}if(arguments[0]instanceof Array){for(var g=arguments[0],p=new Array(g.length).fill(null),_=0;_<g.length;_++)p[_]=new Y(Math.round((g[_].x-this._offsetX)*this._scaleFactor),Math.round((g[_].y-this._offsetY)*this._scaleFactor),g[_].getZ());return A.removeRepeatedPoints(p)}}},{key:"isIntegerPrecision",value:function(){return this._scaleFactor===1}},{key:"getNodedSubstrings",value:function(){var n=this._noder.getNodedSubstrings();return this._isScaled&&this.rescale(n),n}},{key:"computeNodes",value:function(n){var r=n;this._isScaled&&(r=this.scale(n)),this._noder.computeNodes(r)}},{key:"interfaces_",get:function(){return[Oo]}}],[{key:"constructor_",value:function(){if(this._noder=null,this._scaleFactor=null,this._offsetX=null,this._offsetY=null,this._isScaled=!1,arguments.length===2){var n=arguments[0],r=arguments[1];o.constructor_.call(this,n,r,0,0)}else if(arguments.length===4){var a=arguments[0],l=arguments[1];this._noder=a,this._scaleFactor=l,this._isScaled=!this.isIntegerPrecision()}}}])})(),Mc=(function(){function o(){u(this,o),o.constructor_.apply(this,arguments)}return h(o,[{key:"checkEndPtVertexIntersections",value:function(){if(arguments.length===0)for(var n=this._segStrings.iterator();n.hasNext();){var r=n.next().getCoordinates();this.checkEndPtVertexIntersections(r[0],this._segStrings),this.checkEndPtVertexIntersections(r[r.length-1],this._segStrings)}else if(arguments.length===2){for(var a=arguments[0],l=arguments[1].iterator();l.hasNext();)for(var g=l.next().getCoordinates(),p=1;p<g.length-1;p++)if(g[p].equals(a))throw new ae("found endpt/interior pt intersection at index "+p+" :pt "+a)}}},{key:"checkInteriorIntersections",value:function(){if(arguments.length===0)for(var n=this._segStrings.iterator();n.hasNext();)for(var r=n.next(),a=this._segStrings.iterator();a.hasNext();){var l=a.next();this.checkInteriorIntersections(r,l)}else if(arguments.length===2)for(var g=arguments[0],p=arguments[1],_=g.getCoordinates(),x=p.getCoordinates(),I=0;I<_.length-1;I++)for(var z=0;z<x.length-1;z++)this.checkInteriorIntersections(g,I,p,z);else if(arguments.length===4){var J=arguments[0],Q=arguments[1],le=arguments[2],de=arguments[3];if(J===le&&Q===de)return null;var me=J.getCoordinates()[Q],Pe=J.getCoordinates()[Q+1],Le=le.getCoordinates()[de],Fe=le.getCoordinates()[de+1];if(this._li.computeIntersection(me,Pe,Le,Fe),this._li.hasIntersection()&&(this._li.isProper()||this.hasInteriorIntersection(this._li,me,Pe)||this.hasInteriorIntersection(this._li,Le,Fe)))throw new ae("found non-noded intersection at "+me+"-"+Pe+" and "+Le+"-"+Fe)}}},{key:"checkValid",value:function(){this.checkEndPtVertexIntersections(),this.checkInteriorIntersections(),this.checkCollapses()}},{key:"checkCollapses",value:function(){if(arguments.length===0)for(var n=this._segStrings.iterator();n.hasNext();){var r=n.next();this.checkCollapses(r)}else if(arguments.length===1)for(var a=arguments[0].getCoordinates(),l=0;l<a.length-2;l++)this.checkCollapse(a[l],a[l+1],a[l+2])}},{key:"hasInteriorIntersection",value:function(n,r,a){for(var l=0;l<n.getIntersectionNum();l++){var g=n.getIntersection(l);if(!g.equals(r)&&!g.equals(a))return!0}return!1}},{key:"checkCollapse",value:function(n,r,a){if(n.equals(a))throw new ae("found non-noded collapse at "+o.fact.createLineString([n,r,a]))}}],[{key:"constructor_",value:function(){this._li=new Fr,this._segStrings=null;var n=arguments[0];this._segStrings=n}}])})();Mc.fact=new di;var Fo=(function(){function o(){u(this,o),o.constructor_.apply(this,arguments)}return h(o,[{key:"intersectsScaled",value:function(n,r){var a=Math.min(n.x,r.x),l=Math.max(n.x,r.x),g=Math.min(n.y,r.y),p=Math.max(n.y,r.y),_=this._maxx<a||this._minx>l||this._maxy<g||this._miny>p;if(_)return!1;var x=this.intersectsToleranceSquare(n,r);return re.isTrue(!(_&&x),"Found bad envelope test"),x}},{key:"initCorners",value:function(n){var r=.5;this._minx=n.x-r,this._maxx=n.x+r,this._miny=n.y-r,this._maxy=n.y+r,this._corner[0]=new Y(this._maxx,this._maxy),this._corner[1]=new Y(this._minx,this._maxy),this._corner[2]=new Y(this._minx,this._miny),this._corner[3]=new Y(this._maxx,this._miny)}},{key:"intersects",value:function(n,r){return this._scaleFactor===1?this.intersectsScaled(n,r):(this.copyScaled(n,this._p0Scaled),this.copyScaled(r,this._p1Scaled),this.intersectsScaled(this._p0Scaled,this._p1Scaled))}},{key:"scale",value:function(n){return Math.round(n*this._scaleFactor)}},{key:"getCoordinate",value:function(){return this._originalPt}},{key:"copyScaled",value:function(n,r){r.x=this.scale(n.x),r.y=this.scale(n.y)}},{key:"getSafeEnvelope",value:function(){if(this._safeEnv===null){var n=o.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new be(this._originalPt.x-n,this._originalPt.x+n,this._originalPt.y-n,this._originalPt.y+n)}return this._safeEnv}},{key:"intersectsPixelClosure",value:function(n,r){return this._li.computeIntersection(n,r,this._corner[0],this._corner[1]),!!this._li.hasIntersection()||(this._li.computeIntersection(n,r,this._corner[1],this._corner[2]),!!this._li.hasIntersection()||(this._li.computeIntersection(n,r,this._corner[2],this._corner[3]),!!this._li.hasIntersection()||(this._li.computeIntersection(n,r,this._corner[3],this._corner[0]),!!this._li.hasIntersection())))}},{key:"intersectsToleranceSquare",value:function(n,r){var a=!1,l=!1;return this._li.computeIntersection(n,r,this._corner[0],this._corner[1]),!!this._li.isProper()||(this._li.computeIntersection(n,r,this._corner[1],this._corner[2]),!!this._li.isProper()||(this._li.hasIntersection()&&(a=!0),this._li.computeIntersection(n,r,this._corner[2],this._corner[3]),!!this._li.isProper()||(this._li.hasIntersection()&&(l=!0),this._li.computeIntersection(n,r,this._corner[3],this._corner[0]),!!this._li.isProper()||!(!a||!l)||!!n.equals(this._pt)||!!r.equals(this._pt))))}},{key:"addSnappedNode",value:function(n,r){var a=n.getCoordinate(r),l=n.getCoordinate(r+1);return!!this.intersects(a,l)&&(n.addIntersection(this.getCoordinate(),r),!0)}}],[{key:"constructor_",value:function(){this._li=null,this._pt=null,this._originalPt=null,this._ptScaled=null,this._p0Scaled=null,this._p1Scaled=null,this._scaleFactor=null,this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,this._corner=new Array(4).fill(null),this._safeEnv=null;var n=arguments[0],r=arguments[1],a=arguments[2];if(this._originalPt=n,this._pt=n,this._scaleFactor=r,this._li=a,r<=0)throw new X("Scale factor must be non-zero");r!==1&&(this._pt=new Y(this.scale(n.x),this.scale(n.y)),this._p0Scaled=new Y,this._p1Scaled=new Y),this.initCorners(this._pt)}}])})();Fo.SAFE_ENV_EXPANSION_FACTOR=.75;var lm=(function(){return h((function o(){u(this,o),o.constructor_.apply(this,arguments)}),[{key:"select",value:function(){if(arguments.length!==1&&arguments.length===2){var o=arguments[1];arguments[0].getLineSegment(o,this.selectedSegment),this.select(this.selectedSegment)}}}],[{key:"constructor_",value:function(){this.selectedSegment=new Tt}}])})(),Nc=(function(){return h((function o(){u(this,o),o.constructor_.apply(this,arguments)}),[{key:"snap",value:function(){if(arguments.length===1){var o=arguments[0];return this.snap(o,null,-1)}if(arguments.length===3){var n=arguments[0],r=arguments[1],a=arguments[2],l=n.getSafeEnvelope(),g=new Lc(n,r,a);return this._index.query(l,new((function(){return h((function p(){u(this,p)}),[{key:"interfaces_",get:function(){return[gc]}},{key:"visitItem",value:function(p){p.select(l,g)}}])})())),g.isNodeAdded()}}}],[{key:"constructor_",value:function(){this._index=null;var o=arguments[0];this._index=o}}])})(),Lc=(function(o){function n(){var r;return u(this,n),r=s(this,n),n.constructor_.apply(r,arguments),r}return y(n,o),h(n,[{key:"isNodeAdded",value:function(){return this._isNodeAdded}},{key:"select",value:function(){if(!(arguments.length===2&&Number.isInteger(arguments[1])&&arguments[0]instanceof pc))return b(n,"select",this,1).apply(this,arguments);var r=arguments[1],a=arguments[0].getContext();if(this._parentEdge===a&&(r===this._hotPixelVertexIndex||r+1===this._hotPixelVertexIndex))return null;this._isNodeAdded|=this._hotPixel.addSnappedNode(a,r)}}],[{key:"constructor_",value:function(){this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var r=arguments[0],a=arguments[1],l=arguments[2];this._hotPixel=r,this._parentEdge=a,this._hotPixelVertexIndex=l}}])})(lm);Nc.HotPixelSnapAction=Lc;var cm=(function(){return h((function o(){u(this,o),o.constructor_.apply(this,arguments)}),[{key:"processIntersections",value:function(o,n,r,a){if(o===r&&n===a)return null;var l=o.getCoordinates()[n],g=o.getCoordinates()[n+1],p=r.getCoordinates()[a],_=r.getCoordinates()[a+1];if(this._li.computeIntersection(l,g,p,_),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var x=0;x<this._li.getIntersectionNum();x++)this._interiorIntersections.add(this._li.getIntersection(x));o.addIntersections(this._li,n,0),r.addIntersections(this._li,a,1)}}},{key:"isDone",value:function(){return!1}},{key:"getInteriorIntersections",value:function(){return this._interiorIntersections}},{key:"interfaces_",get:function(){return[Ec]}}],[{key:"constructor_",value:function(){this._li=null,this._interiorIntersections=null;var o=arguments[0];this._li=o,this._interiorIntersections=new pe}}])})(),hm=(function(){return h((function o(){u(this,o),o.constructor_.apply(this,arguments)}),[{key:"checkCorrectness",value:function(o){var n=new Mc(Gr.getNodedSubstrings(o));try{n.checkValid()}catch(r){if(!(r instanceof V))throw r;r.printStackTrace()}}},{key:"getNodedSubstrings",value:function(){return Gr.getNodedSubstrings(this._nodedSegStrings)}},{key:"snapRound",value:function(o,n){var r=this.findInteriorIntersections(o,n);this.computeIntersectionSnaps(r),this.computeVertexSnaps(o)}},{key:"findInteriorIntersections",value:function(o,n){var r=new cm(n);return this._noder.setSegmentIntersector(r),this._noder.computeNodes(o),r.getInteriorIntersections()}},{key:"computeVertexSnaps",value:function(){if(_e(arguments[0],$e))for(var o=arguments[0].iterator();o.hasNext();){var n=o.next();this.computeVertexSnaps(n)}else if(arguments[0]instanceof Gr)for(var r=arguments[0],a=r.getCoordinates(),l=0;l<a.length;l++){var g=new Fo(a[l],this._scaleFactor,this._li);this._pointSnapper.snap(g,r,l)&&r.addIntersection(a[l],l)}}},{key:"computeNodes",value:function(o){this._nodedSegStrings=o,this._noder=new Ro,this._pointSnapper=new Nc(this._noder.getIndex()),this.snapRound(o,this._li)}},{key:"computeIntersectionSnaps",value:function(o){for(var n=o.iterator();n.hasNext();){var r=new Fo(n.next(),this._scaleFactor,this._li);this._pointSnapper.snap(r)}}},{key:"interfaces_",get:function(){return[Oo]}}],[{key:"constructor_",value:function(){this._pm=null,this._li=null,this._scaleFactor=null,this._noder=null,this._pointSnapper=null,this._nodedSegStrings=null;var o=arguments[0];this._pm=o,this._li=new Fr,this._li.setPrecisionModel(o),this._scaleFactor=o.getScale()}}])})(),_i=(function(){function o(){u(this,o),o.constructor_.apply(this,arguments)}return h(o,[{key:"bufferFixedPrecision",value:function(n){var r=new um(new hm(new De(1)),n.getScale()),a=new Ic(this._bufParams);a.setWorkingPrecisionModel(n),a.setNoder(r),this._resultGeometry=a.buffer(this._argGeom,this._distance)}},{key:"bufferReducedPrecision",value:function(){if(arguments.length===0){for(var n=o.MAX_PRECISION_DIGITS;n>=0;n--){try{this.bufferReducedPrecision(n)}catch(l){if(!(l instanceof Ut))throw l;this._saveException=l}if(this._resultGeometry!==null)return null}throw this._saveException}if(arguments.length===1){var r=arguments[0],a=new De(o.precisionScaleFactor(this._argGeom,this._distance,r));this.bufferFixedPrecision(a)}}},{key:"computeGeometry",value:function(){if(this.bufferOriginalPrecision(),this._resultGeometry!==null)return null;var n=this._argGeom.getFactory().getPrecisionModel();n.getType()===De.FIXED?this.bufferFixedPrecision(n):this.bufferReducedPrecision()}},{key:"setQuadrantSegments",value:function(n){this._bufParams.setQuadrantSegments(n)}},{key:"bufferOriginalPrecision",value:function(){try{var n=new Ic(this._bufParams);this._resultGeometry=n.buffer(this._argGeom,this._distance)}catch(r){if(!(r instanceof ae))throw r;this._saveException=r}}},{key:"getResultGeometry",value:function(n){return this._distance=n,this.computeGeometry(),this._resultGeometry}},{key:"setEndCapStyle",value:function(n){this._bufParams.setEndCapStyle(n)}}],[{key:"constructor_",value:function(){if(this._argGeom=null,this._distance=null,this._bufParams=new j,this._resultGeometry=null,this._saveException=null,arguments.length===1){var n=arguments[0];this._argGeom=n}else if(arguments.length===2){var r=arguments[0],a=arguments[1];this._argGeom=r,this._bufParams=a}}},{key:"bufferOp",value:function(){if(arguments.length===2){var n=arguments[1];return new o(arguments[0]).getResultGeometry(n)}if(arguments.length===3){if(Number.isInteger(arguments[2])&&arguments[0]instanceof fe&&typeof arguments[1]=="number"){var r=arguments[1],a=arguments[2],l=new o(arguments[0]);return l.setQuadrantSegments(a),l.getResultGeometry(r)}if(arguments[2]instanceof j&&arguments[0]instanceof fe&&typeof arguments[1]=="number"){var g=arguments[1];return new o(arguments[0],arguments[2]).getResultGeometry(g)}}else if(arguments.length===4){var p=arguments[1],_=arguments[2],x=arguments[3],I=new o(arguments[0]);return I.setQuadrantSegments(_),I.setEndCapStyle(x),I.getResultGeometry(p)}}},{key:"precisionScaleFactor",value:function(n,r,a){var l=n.getEnvelopeInternal(),g=Tr.max(Math.abs(l.getMaxX()),Math.abs(l.getMaxY()),Math.abs(l.getMinX()),Math.abs(l.getMinY()))+2*(r>0?r:0),p=a-Math.trunc(Math.log(g)/Math.log(10)+1);return Math.pow(10,p)}}])})();_i.CAP_ROUND=j.CAP_ROUND,_i.CAP_BUTT=j.CAP_FLAT,_i.CAP_FLAT=j.CAP_FLAT,_i.CAP_SQUARE=j.CAP_SQUARE,_i.MAX_PRECISION_DIGITS=12;var fm=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],Cc=(function(){return h((function o(n){u(this,o),this.geometryFactory=n||new di}),[{key:"read",value:function(o){var n,r=(n=typeof o=="string"?JSON.parse(o):o).type;if(!Ht[r])throw new Error("Unknown GeoJSON type: "+n.type);return fm.indexOf(r)!==-1?Ht[r].call(this,n.coordinates):r==="GeometryCollection"?Ht[r].call(this,n.geometries):Ht[r].call(this,n)}},{key:"write",value:function(o){var n=o.getGeometryType();if(!Pn[n])throw new Error("Geometry is not supported");return Pn[n].call(this,o)}}])})(),Ht={Feature:function(o){var n={};for(var r in o)n[r]=o[r];if(o.geometry){if(!Ht[o.geometry.type])throw new Error("Unknown GeoJSON type: "+o.type);n.geometry=this.read(o.geometry)}return o.bbox&&(n.bbox=Ht.bbox.call(this,o.bbox)),n},FeatureCollection:function(o){var n={};if(o.features){n.features=[];for(var r=0;r<o.features.length;++r)n.features.push(this.read(o.features[r]))}return o.bbox&&(n.bbox=this.parse.bbox.call(this,o.bbox)),n},coordinates:function(o){for(var n=[],r=0;r<o.length;++r){var a=o[r];n.push(c(Y,P(a)))}return n},bbox:function(o){return this.geometryFactory.createLinearRing([new Y(o[0],o[1]),new Y(o[2],o[1]),new Y(o[2],o[3]),new Y(o[0],o[3]),new Y(o[0],o[1])])},Point:function(o){var n=c(Y,P(o));return this.geometryFactory.createPoint(n)},MultiPoint:function(o){for(var n=[],r=0;r<o.length;++r)n.push(Ht.Point.call(this,o[r]));return this.geometryFactory.createMultiPoint(n)},LineString:function(o){var n=Ht.coordinates.call(this,o);return this.geometryFactory.createLineString(n)},MultiLineString:function(o){for(var n=[],r=0;r<o.length;++r)n.push(Ht.LineString.call(this,o[r]));return this.geometryFactory.createMultiLineString(n)},Polygon:function(o){for(var n=Ht.coordinates.call(this,o[0]),r=this.geometryFactory.createLinearRing(n),a=[],l=1;l<o.length;++l){var g=o[l],p=Ht.coordinates.call(this,g),_=this.geometryFactory.createLinearRing(p);a.push(_)}return this.geometryFactory.createPolygon(r,a)},MultiPolygon:function(o){for(var n=[],r=0;r<o.length;++r){var a=o[r];n.push(Ht.Polygon.call(this,a))}return this.geometryFactory.createMultiPolygon(n)},GeometryCollection:function(o){for(var n=[],r=0;r<o.length;++r){var a=o[r];n.push(this.read(a))}return this.geometryFactory.createGeometryCollection(n)}},Pn={coordinate:function(o){var n=[o.x,o.y];return o.z&&n.push(o.z),o.m&&n.push(o.m),n},Point:function(o){return{type:"Point",coordinates:Pn.coordinate.call(this,o.getCoordinate())}},MultiPoint:function(o){for(var n=[],r=0;r<o._geometries.length;++r){var a=o._geometries[r],l=Pn.Point.call(this,a);n.push(l.coordinates)}return{type:"MultiPoint",coordinates:n}},LineString:function(o){for(var n=[],r=o.getCoordinates(),a=0;a<r.length;++a){var l=r[a];n.push(Pn.coordinate.call(this,l))}return{type:"LineString",coordinates:n}},MultiLineString:function(o){for(var n=[],r=0;r<o._geometries.length;++r){var a=o._geometries[r],l=Pn.LineString.call(this,a);n.push(l.coordinates)}return{type:"MultiLineString",coordinates:n}},Polygon:function(o){var n=[],r=Pn.LineString.call(this,o._shell);n.push(r.coordinates);for(var a=0;a<o._holes.length;++a){var l=o._holes[a],g=Pn.LineString.call(this,l);n.push(g.coordinates)}return{type:"Polygon",coordinates:n}},MultiPolygon:function(o){for(var n=[],r=0;r<o._geometries.length;++r){var a=o._geometries[r],l=Pn.Polygon.call(this,a);n.push(l.coordinates)}return{type:"MultiPolygon",coordinates:n}},GeometryCollection:function(o){for(var n=[],r=0;r<o._geometries.length;++r){var a=o._geometries[r],l=a.getGeometryType();n.push(Pn[l].call(this,a))}return{type:"GeometryCollection",geometries:n}}};return{BufferOp:_i,GeoJSONReader:(function(){return h((function o(n){u(this,o),this.parser=new Cc(n||new di)}),[{key:"read",value:function(o){return this.parser.read(o)}}])})(),GeoJSONWriter:(function(){return h((function o(){u(this,o),this.parser=new Cc(this.geometryFactory)}),[{key:"write",value:function(o){return this.parser.write(o)}}])})()}}))})(Xu)),Xu.exports}var Ax=pg(Cx());function Ir(){return new to}function to(){this.reset()}to.prototype={constructor:to,reset:function(){this.s=this.t=0},add:function(e){Qh(ba,e,this.t),Qh(this,ba.s,this.s),this.s?this.t+=ba.t:this.s=ba.t},valueOf:function(){return this.s}};var ba=new to;function Qh(e,t,i){var s=e.s=t+i,u=s-t;e.t=t-(s-u)+(i-u)}var ze=1e-6,Ce=Math.PI,Un=Ce/2,ef=Ce/4,Jn=Ce*2,dr=180/Ce,Wt=Ce/180,ut=Math.abs,Tx=Math.atan,ji=Math.atan2,Ve=Math.cos,Xe=Math.sin,Qi=Math.sqrt;function Xd(e){return e>1?0:e<-1?Ce:Math.acos(e)}function ti(e){return e>1?Un:e<-1?-Un:Math.asin(e)}function Ms(){}function no(e,t){e&&nf.hasOwnProperty(e.type)&&nf[e.type](e,t)}var tf={Feature:function(e,t){no(e.geometry,t)},FeatureCollection:function(e,t){for(var i=e.features,s=-1,u=i.length;++s<u;)no(i[s].geometry,t)}},nf={Sphere:function(e,t){t.sphere()},Point:function(e,t){e=e.coordinates,t.point(e[0],e[1],e[2])},MultiPoint:function(e,t){for(var i=e.coordinates,s=-1,u=i.length;++s<u;)e=i[s],t.point(e[0],e[1],e[2])},LineString:function(e,t){$u(e.coordinates,t,0)},MultiLineString:function(e,t){for(var i=e.coordinates,s=-1,u=i.length;++s<u;)$u(i[s],t,0)},Polygon:function(e,t){rf(e.coordinates,t)},MultiPolygon:function(e,t){for(var i=e.coordinates,s=-1,u=i.length;++s<u;)rf(i[s],t)},GeometryCollection:function(e,t){for(var i=e.geometries,s=-1,u=i.length;++s<u;)no(i[s],t)}};function $u(e,t,i){var s=-1,u=e.length-i,c;for(t.lineStart();++s<u;)c=e[s],t.point(c[0],c[1],c[2]);t.lineEnd()}function rf(e,t){var i=-1,s=e.length;for(t.polygonStart();++i<s;)$u(e[i],t,1);t.polygonEnd()}function Px(e,t){e&&tf.hasOwnProperty(e.type)?tf[e.type](e,t):no(e,t)}Ir();Ir();function Zu(e){return[ji(e[1],e[0]),ti(e[2])]}function qi(e){var t=e[0],i=e[1],s=Ve(i);return[s*Ve(t),s*Xe(t),Xe(i)]}function Sa(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function ro(e,t){return[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]}function uu(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function Ia(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function Wu(e){var t=Qi(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=t,e[1]/=t,e[2]/=t}Ir();function $d(e,t){function i(s,u){return s=e(s,u),t(s[0],s[1])}return e.invert&&t.invert&&(i.invert=function(s,u){return s=t.invert(s,u),s&&e.invert(s[0],s[1])}),i}function Ku(e,t){return[e>Ce?e-Jn:e<-Ce?e+Jn:e,t]}Ku.invert=Ku;function Ox(e,t,i){return(e%=Jn)?t||i?$d(af(e),of(t,i)):af(e):t||i?of(t,i):Ku}function sf(e){return function(t,i){return t+=e,[t>Ce?t-Jn:t<-Ce?t+Jn:t,i]}}function af(e){var t=sf(e);return t.invert=sf(-e),t}function of(e,t){var i=Ve(e),s=Xe(e),u=Ve(t),c=Xe(t);function f(h,d){var m=Ve(d),v=Ve(h)*m,y=Xe(h)*m,k=Xe(d),S=k*i+v*s;return[ji(y*u-S*c,v*i-k*s),ti(S*u+y*c)]}return f.invert=function(h,d){var m=Ve(d),v=Ve(h)*m,y=Xe(h)*m,k=Xe(d),S=k*u-y*c;return[ji(y*u+k*c,v*i+S*s),ti(S*i-v*s)]},f}function Rx(e,t,i,s,u,c){if(i){var f=Ve(t),h=Xe(t),d=s*i;u==null?(u=t+s*Jn,c=t-d/2):(u=uf(f,u),c=uf(f,c),(s>0?u<c:u>c)&&(u+=s*Jn));for(var m,v=u;s>0?v>c:v<c;v-=d)m=Zu([f,-h*Ve(v),-h*Xe(v)]),e.point(m[0],m[1])}}function uf(e,t){t=qi(t),t[0]-=e,Wu(t);var i=Xd(-t[1]);return((-t[2]<0?-i:i)+Jn-ze)%Jn}function Zd(){var e=[],t;return{point:function(i,s){t.push([i,s])},lineStart:function(){e.push(t=[])},lineEnd:Ms,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function Dx(e,t,i,s,u,c){var f=e[0],h=e[1],d=t[0],m=t[1],v=0,y=1,k=d-f,S=m-h,b;if(b=i-f,!(!k&&b>0)){if(b/=k,k<0){if(b<v)return;b<y&&(y=b)}else if(k>0){if(b>y)return;b>v&&(v=b)}if(b=u-f,!(!k&&b<0)){if(b/=k,k<0){if(b>y)return;b>v&&(v=b)}else if(k>0){if(b<v)return;b<y&&(y=b)}if(b=s-h,!(!S&&b>0)){if(b/=S,S<0){if(b<v)return;b<y&&(y=b)}else if(S>0){if(b>y)return;b>v&&(v=b)}if(b=c-h,!(!S&&b<0)){if(b/=S,S<0){if(b>y)return;b>v&&(v=b)}else if(S>0){if(b<v)return;b<y&&(y=b)}return v>0&&(e[0]=f+v*k,e[1]=h+v*S),y<1&&(t[0]=f+y*k,t[1]=h+y*S),!0}}}}}function za(e,t){return ut(e[0]-t[0])<ze&&ut(e[1]-t[1])<ze}function Ma(e,t,i,s){this.x=e,this.z=t,this.o=i,this.e=s,this.v=!1,this.n=this.p=null}function Wd(e,t,i,s,u){var c=[],f=[],h,d;if(e.forEach(function(b){if(!((P=b.length-1)<=0)){var P,O=b[0],G=b[P],L;if(za(O,G)){for(u.lineStart(),h=0;h<P;++h)u.point((O=b[h])[0],O[1]);u.lineEnd();return}c.push(L=new Ma(O,b,null,!0)),f.push(L.o=new Ma(O,null,L,!1)),c.push(L=new Ma(G,b,null,!1)),f.push(L.o=new Ma(G,null,L,!0))}}),!!c.length){for(f.sort(t),lf(c),lf(f),h=0,d=f.length;h<d;++h)f[h].e=i=!i;for(var m=c[0],v,y;;){for(var k=m,S=!0;k.v;)if((k=k.n)===m)return;v=k.z,u.lineStart();do{if(k.v=k.o.v=!0,k.e){if(S)for(h=0,d=v.length;h<d;++h)u.point((y=v[h])[0],y[1]);else s(k.x,k.n.x,1,u);k=k.n}else{if(S)for(v=k.p.z,h=v.length-1;h>=0;--h)u.point((y=v[h])[0],y[1]);else s(k.x,k.p.x,-1,u);k=k.p}k=k.o,v=k.z,S=!S}while(!k.v);u.lineEnd()}}}function lf(e){if(t=e.length){for(var t,i=0,s=e[0],u;++i<t;)s.n=u=e[i],u.p=s,s=u;s.n=u=e[0],u.p=s}}function Kd(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Fx(e){return e.length===1&&(e=Gx(e)),{left:function(t,i,s,u){for(s??=0,u??=t.length;s<u;){var c=s+u>>>1;e(t[c],i)<0?s=c+1:u=c}return s},right:function(t,i,s,u){for(s??=0,u??=t.length;s<u;){var c=s+u>>>1;e(t[c],i)>0?u=c:s=c+1}return s}}}function Gx(e){return function(t,i){return Kd(e(t),i)}}Fx(Kd);function Qd(e){for(var t=e.length,i,s=-1,u=0,c,f;++s<t;)u+=e[s].length;for(c=new Array(u);--t>=0;)for(f=e[t],i=f.length;--i>=0;)c[--u]=f[i];return c}var Ns=1e9,Na=-Ns;function Bx(e,t,i,s){function u(m,v){return e<=m&&m<=i&&t<=v&&v<=s}function c(m,v,y,k){var S=0,b=0;if(m==null||(S=f(m,y))!==(b=f(v,y))||d(m,v)<0^y>0)do k.point(S===0||S===3?e:i,S>1?s:t);while((S=(S+y+4)%4)!==b);else k.point(v[0],v[1])}function f(m,v){return ut(m[0]-e)<ze?v>0?0:3:ut(m[0]-i)<ze?v>0?2:1:ut(m[1]-t)<ze?v>0?1:0:v>0?3:2}function h(m,v){return d(m.x,v.x)}function d(m,v){var y=f(m,1),k=f(v,1);return y!==k?y-k:y===0?v[1]-m[1]:y===1?m[0]-v[0]:y===2?m[1]-v[1]:v[0]-m[0]}return function(m){var v=m,y=Zd(),k,S,b,P,O,G,L,j,V,X,H,$={point:w,lineStart:T,lineEnd:F,polygonStart:M,polygonEnd:R};function w(N,B){u(N,B)&&v.point(N,B)}function E(){for(var N=0,B=0,U=S.length;B<U;++B)for(var q=S[B],W=1,K=q.length,ie=q[0],ae,ce,re=ie[0],oe=ie[1];W<K;++W)ae=re,ce=oe,ie=q[W],re=ie[0],oe=ie[1],ce<=s?oe>s&&(re-ae)*(s-ce)>(oe-ce)*(e-ae)&&++N:oe<=s&&(re-ae)*(s-ce)<(oe-ce)*(e-ae)&&--N;return N}function M(){v=y,k=[],S=[],H=!0}function R(){var N=E(),B=H&&N,U=(k=Qd(k)).length;(B||U)&&(m.polygonStart(),B&&(m.lineStart(),c(null,null,1,m),m.lineEnd()),U&&Wd(k,h,N,c,m),m.polygonEnd()),v=m,k=S=b=null}function T(){$.point=D,S&&S.push(b=[]),X=!0,V=!1,L=j=NaN}function F(){k&&(D(P,O),G&&V&&y.rejoin(),k.push(y.result())),$.point=w,V&&v.lineEnd()}function D(N,B){var U=u(N,B);if(S&&b.push([N,B]),X)P=N,O=B,G=U,X=!1,U&&(v.lineStart(),v.point(N,B));else if(U&&V)v.point(N,B);else{var q=[L=Math.max(Na,Math.min(Ns,L)),j=Math.max(Na,Math.min(Ns,j))],W=[N=Math.max(Na,Math.min(Ns,N)),B=Math.max(Na,Math.min(Ns,B))];Dx(q,W,e,t,i,s)?(V||(v.lineStart(),v.point(q[0],q[1])),v.point(W[0],W[1]),U||v.lineEnd(),H=!1):U&&(v.lineStart(),v.point(N,B),H=!1)}L=N,j=B,V=U}return $}}var lu=Ir();function Ux(e,t){var i=t[0],s=t[1],u=[Xe(i),-Ve(i),0],c=0,f=0;lu.reset();for(var h=0,d=e.length;h<d;++h)if(v=(m=e[h]).length)for(var m,v,y=m[v-1],k=y[0],S=y[1]/2+ef,b=Xe(S),P=Ve(S),O=0;O<v;++O,k=L,b=V,P=X,y=G){var G=m[O],L=G[0],j=G[1]/2+ef,V=Xe(j),X=Ve(j),H=L-k,$=H>=0?1:-1,w=$*H,E=w>Ce,M=b*V;if(lu.add(ji(M*$*Xe(w),P*X+M*Ve(w))),c+=E?H+$*Jn:H,E^k>=i^L>=i){var R=ro(qi(y),qi(G));Wu(R);var T=ro(u,R);Wu(T);var F=(E^H>=0?-1:1)*ti(T[2]);(s>F||s===F&&(R[0]||R[1]))&&(f+=E^H>=0?1:-1)}}return(c<-ze||c<ze&&lu<-ze)^f&1}Ir();function cf(e){return e}Ir();Ir();var Yi=1/0,io=Yi,Zs=-Yi,so=Zs,hf={point:zx,lineStart:Ms,lineEnd:Ms,polygonStart:Ms,polygonEnd:Ms,result:function(){var e=[[Yi,io],[Zs,so]];return Zs=so=-(io=Yi=1/0),e}};function zx(e,t){e<Yi&&(Yi=e),e>Zs&&(Zs=e),t<io&&(io=t),t>so&&(so=t)}Ir();function ep(e,t,i,s){return function(u,c){var f=t(c),h=u.invert(s[0],s[1]),d=Zd(),m=t(d),v=!1,y,k,S,b={point:P,lineStart:G,lineEnd:L,polygonStart:function(){b.point=j,b.lineStart=V,b.lineEnd=X,k=[],y=[]},polygonEnd:function(){b.point=P,b.lineStart=G,b.lineEnd=L,k=Qd(k);var H=Ux(y,h);k.length?(v||(c.polygonStart(),v=!0),Wd(k,qx,H,i,c)):H&&(v||(c.polygonStart(),v=!0),c.lineStart(),i(null,null,1,c),c.lineEnd()),v&&(c.polygonEnd(),v=!1),k=y=null},sphere:function(){c.polygonStart(),c.lineStart(),i(null,null,1,c),c.lineEnd(),c.polygonEnd()}};function P(H,$){var w=u(H,$);e(H=w[0],$=w[1])&&c.point(H,$)}function O(H,$){var w=u(H,$);f.point(w[0],w[1])}function G(){b.point=O,f.lineStart()}function L(){b.point=P,f.lineEnd()}function j(H,$){S.push([H,$]);var w=u(H,$);m.point(w[0],w[1])}function V(){m.lineStart(),S=[]}function X(){j(S[0][0],S[0][1]),m.lineEnd();var H=m.clean(),$=d.result(),w,E=$.length,M,R,T;if(S.pop(),y.push(S),S=null,!!E){if(H&1){if(R=$[0],(M=R.length-1)>0){for(v||(c.polygonStart(),v=!0),c.lineStart(),w=0;w<M;++w)c.point((T=R[w])[0],T[1]);c.lineEnd()}return}E>1&&H&2&&$.push($.pop().concat($.shift())),k.push($.filter(jx))}}return b}}function jx(e){return e.length>1}function qx(e,t){return((e=e.x)[0]<0?e[1]-Un-ze:Un-e[1])-((t=t.x)[0]<0?t[1]-Un-ze:Un-t[1])}var ff=ep(function(){return!0},Yx,Jx,[-Ce,-Un]);function Yx(e){var t=NaN,i=NaN,s=NaN,u;return{lineStart:function(){e.lineStart(),u=1},point:function(c,f){var h=c>0?Ce:-Ce,d=ut(c-t);ut(d-Ce)<ze?(e.point(t,i=(i+f)/2>0?Un:-Un),e.point(s,i),e.lineEnd(),e.lineStart(),e.point(h,i),e.point(c,i),u=0):s!==h&&d>=Ce&&(ut(t-s)<ze&&(t-=s*ze),ut(c-h)<ze&&(c-=h*ze),i=Hx(t,i,c,f),e.point(s,i),e.lineEnd(),e.lineStart(),e.point(h,i),u=0),e.point(t=c,i=f),s=h},lineEnd:function(){e.lineEnd(),t=i=NaN},clean:function(){return 2-u}}}function Hx(e,t,i,s){var u,c,f=Xe(e-i);return ut(f)>ze?Tx((Xe(t)*(c=Ve(s))*Xe(i)-Xe(s)*(u=Ve(t))*Xe(e))/(u*c*f)):(t+s)/2}function Jx(e,t,i,s){var u;if(e==null)u=i*Un,s.point(-Ce,u),s.point(0,u),s.point(Ce,u),s.point(Ce,0),s.point(Ce,-u),s.point(0,-u),s.point(-Ce,-u),s.point(-Ce,0),s.point(-Ce,u);else if(ut(e[0]-t[0])>ze){var c=e[0]<t[0]?Ce:-Ce;u=i*c/2,s.point(-c,u),s.point(0,u),s.point(c,u)}else s.point(t[0],t[1])}function Vx(e,t){var i=Ve(e),s=i>0,u=ut(i)>ze;function c(v,y,k,S){Rx(S,e,t,k,v,y)}function f(v,y){return Ve(v)*Ve(y)>i}function h(v){var y,k,S,b,P;return{lineStart:function(){b=S=!1,P=1},point:function(O,G){var L=[O,G],j,V=f(O,G),X=s?V?0:m(O,G):V?m(O+(O<0?Ce:-Ce),G):0;if(!y&&(b=S=V)&&v.lineStart(),V!==S&&(j=d(y,L),(!j||za(y,j)||za(L,j))&&(L[0]+=ze,L[1]+=ze,V=f(L[0],L[1]))),V!==S)P=0,V?(v.lineStart(),j=d(L,y),v.point(j[0],j[1])):(j=d(y,L),v.point(j[0],j[1]),v.lineEnd()),y=j;else if(u&&y&&s^V){var H;!(X&k)&&(H=d(L,y,!0))&&(P=0,s?(v.lineStart(),v.point(H[0][0],H[0][1]),v.point(H[1][0],H[1][1]),v.lineEnd()):(v.point(H[1][0],H[1][1]),v.lineEnd(),v.lineStart(),v.point(H[0][0],H[0][1])))}V&&(!y||!za(y,L))&&v.point(L[0],L[1]),y=L,S=V,k=X},lineEnd:function(){S&&v.lineEnd(),y=null},clean:function(){return P|(b&&S)<<1}}}function d(v,y,k){var S=qi(v),b=qi(y),P=[1,0,0],O=ro(S,b),G=Sa(O,O),L=O[0],j=G-L*L;if(!j)return!k&&v;var V=i*G/j,X=-i*L/j,H=ro(P,O),$=Ia(P,V);uu($,Ia(O,X));var w=H,E=Sa($,w),M=Sa(w,w),R=E*E-M*(Sa($,$)-1);if(!(R<0)){var T=Qi(R),F=Ia(w,(-E-T)/M);if(uu(F,$),F=Zu(F),!k)return F;var D=v[0],N=y[0],B=v[1],U=y[1],q;N<D&&(q=D,D=N,N=q);var W=N-D,K=ut(W-Ce)<ze,ie=K||W<ze;if(!K&&U<B&&(q=B,B=U,U=q),ie?K?B+U>0^F[1]<(ut(F[0]-D)<ze?B:U):B<=F[1]&&F[1]<=U:W>Ce^(D<=F[0]&&F[0]<=N)){var ae=Ia(w,(-E+T)/M);return uu(ae,$),[F,Zu(ae)]}}}function m(v,y){var k=s?e:Ce-e,S=0;return v<-k?S|=1:v>k&&(S|=2),y<-k?S|=4:y>k&&(S|=8),S}return ep(f,h,c,s?[0,-e]:[-Ce,e-Ce])}function tp(e){return function(t){var i=new Qu;for(var s in e)i[s]=e[s];return i.stream=t,i}}function Qu(){}Qu.prototype={constructor:Qu,point:function(e,t){this.stream.point(e,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};function np(e,t,i){var s=t[1][0]-t[0][0],u=t[1][1]-t[0][1],c=e.clipExtent&&e.clipExtent();e.scale(150).translate([0,0]),c!=null&&e.clipExtent(null),Px(i,e.stream(hf));var f=hf.result(),h=Math.min(s/(f[1][0]-f[0][0]),u/(f[1][1]-f[0][1])),d=+t[0][0]+(s-h*(f[1][0]+f[0][0]))/2,m=+t[0][1]+(u-h*(f[1][1]+f[0][1]))/2;return c!=null&&e.clipExtent(c),e.scale(h*150).translate([d,m])}function Xx(e,t,i){return np(e,[[0,0],t],i)}var gf=16,$x=Ve(30*Wt);function df(e,t){return+t?Wx(e,t):Zx(e)}function Zx(e){return tp({point:function(t,i){t=e(t,i),this.stream.point(t[0],t[1])}})}function Wx(e,t){function i(s,u,c,f,h,d,m,v,y,k,S,b,P,O){var G=m-s,L=v-u,j=G*G+L*L;if(j>4*t&&P--){var V=f+k,X=h+S,H=d+b,$=Qi(V*V+X*X+H*H),w=ti(H/=$),E=ut(ut(H)-1)<ze||ut(c-y)<ze?(c+y)/2:ji(X,V),M=e(E,w),R=M[0],T=M[1],F=R-s,D=T-u,N=L*F-G*D;(N*N/j>t||ut((G*F+L*D)/j-.5)>.3||f*k+h*S+d*b<$x)&&(i(s,u,c,f,h,d,R,T,E,V/=$,X/=$,H,P,O),O.point(R,T),i(R,T,E,V,X,H,m,v,y,k,S,b,P,O))}}return function(s){var u,c,f,h,d,m,v,y,k,S,b,P,O={point:G,lineStart:L,lineEnd:V,polygonStart:function(){s.polygonStart(),O.lineStart=X},polygonEnd:function(){s.polygonEnd(),O.lineStart=L}};function G(w,E){w=e(w,E),s.point(w[0],w[1])}function L(){y=NaN,O.point=j,s.lineStart()}function j(w,E){var M=qi([w,E]),R=e(w,E);i(y,k,v,S,b,P,y=R[0],k=R[1],v=w,S=M[0],b=M[1],P=M[2],gf,s),s.point(y,k)}function V(){O.point=G,s.lineEnd()}function X(){L(),O.point=H,O.lineEnd=$}function H(w,E){j(u=w,E),c=y,f=k,h=S,d=b,m=P,O.point=j}function $(){i(y,k,v,S,b,P,c,f,u,h,d,m,gf,s),O.lineEnd=V,V()}return O}}var Kx=tp({point:function(e,t){this.stream.point(e*Wt,t*Wt)}});function Qx(e){return eE(function(){return e})()}function eE(e){var t,i=150,s=480,u=250,c,f,h=0,d=0,m=0,v=0,y=0,k,S,b=null,P=ff,O=null,G,L,j,V=cf,X=.5,H=df(R,X),$,w;function E(D){return D=S(D[0]*Wt,D[1]*Wt),[D[0]*i+c,f-D[1]*i]}function M(D){return D=S.invert((D[0]-c)/i,(f-D[1])/i),D&&[D[0]*dr,D[1]*dr]}function R(D,N){return D=t(D,N),[D[0]*i+c,f-D[1]*i]}E.stream=function(D){return $&&w===D?$:$=Kx(P(k,H(V(w=D))))},E.clipAngle=function(D){return arguments.length?(P=+D?Vx(b=D*Wt,6*Wt):(b=null,ff),F()):b*dr},E.clipExtent=function(D){return arguments.length?(V=D==null?(O=G=L=j=null,cf):Bx(O=+D[0][0],G=+D[0][1],L=+D[1][0],j=+D[1][1]),F()):O==null?null:[[O,G],[L,j]]},E.scale=function(D){return arguments.length?(i=+D,T()):i},E.translate=function(D){return arguments.length?(s=+D[0],u=+D[1],T()):[s,u]},E.center=function(D){return arguments.length?(h=D[0]%360*Wt,d=D[1]%360*Wt,T()):[h*dr,d*dr]},E.rotate=function(D){return arguments.length?(m=D[0]%360*Wt,v=D[1]%360*Wt,y=D.length>2?D[2]%360*Wt:0,T()):[m*dr,v*dr,y*dr]},E.precision=function(D){return arguments.length?(H=df(R,X=D*D),F()):Qi(X)},E.fitExtent=function(D,N){return np(E,D,N)},E.fitSize=function(D,N){return Xx(E,D,N)};function T(){S=$d(k=Ox(m,v,y),t);var D=t(h,d);return c=s-D[0]*i,f=u+D[1]*i,F()}function F(){return $=w=null,E}return function(){return t=e.apply(this,arguments),E.invert=t.invert&&M,T()}}function rp(e){return function(t,i){var s=Ve(t),u=Ve(i),c=e(s*u);return[c*u*Xe(t),c*Xe(i)]}}function ip(e){return function(t,i){var s=Qi(t*t+i*i),u=e(s),c=Xe(u),f=Ve(u);return[ji(t*c,s*f),ti(s&&i*c/s)]}}var tE=rp(function(e){return Qi(2/(1+e))});tE.invert=ip(function(e){return 2*ti(e/2)});var sp=rp(function(e){return(e=Xd(e))&&e/Xe(e)});sp.invert=ip(function(e){return e});function nE(){return Qx(sp).scale(79.4188).clipAngle(179.999)}function pf(e,t){return[e,t]}pf.invert=pf;var{BufferOp:rE,GeoJSONReader:iE,GeoJSONWriter:sE}=Ax;function aE(e,t,i){i=i||{};var s=i.units||"kilometers",u=i.steps||8;if(!e)throw new Error("geojson is required");if(typeof i!="object")throw new Error("options must be an object");if(typeof u!="number")throw new Error("steps must be an number");if(t===void 0)throw new Error("radius is required");if(u<=0)throw new Error("steps must be greater than 0");var c=[];switch(e.type){case"GeometryCollection":return si(e,function(f){var h=ja(f,t,s,u);h&&c.push(h)}),et(c);case"FeatureCollection":return Hn(e,function(f){var h=ja(f,t,s,u);h&&Hn(h,function(d){d&&c.push(d)})}),et(c)}return ja(e,t,s,u)}function ja(e,t,i,s){var u=e.properties||{},c=e.type==="Feature"?e.geometry:e;if(c.type==="GeometryCollection"){var f=[];return si(e,function(k){var S=ja(k,t,i,s);S&&f.push(S)}),et(f)}var h=oE(c),d={type:c.type,coordinates:op(c.coordinates,h)},m=new iE().read(d),v=Ul(zl(t,i),"meters"),y=rE.bufferOp(m,v,s);if(y=new sE().write(y),!ap(y.coordinates))return ln({type:y.type,coordinates:up(y.coordinates,h)},u)}function ap(e){return Array.isArray(e[0])?ap(e[0]):isNaN(e[0])}function op(e,t){return typeof e[0]!="object"?t(e):e.map(function(i){return op(i,t)})}function up(e,t){return typeof e[0]!="object"?t.invert(e):e.map(function(i){return up(i,t)})}function oE(e){var t=Nx(e).geometry.coordinates,i=[-t[0],-t[1]];return nE().rotate(i).scale(at)}var uE=aE,lp=class{constructor(e=[],t=lE){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let i=(this.length>>1)-1;i>=0;i--)this._down(i)}push(e){this.data.push(e),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const e=this.data[0],t=this.data.pop();return this.length--,this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:t,compare:i}=this,s=t[e];for(;e>0;){const u=e-1>>1,c=t[u];if(i(s,c)>=0)break;t[e]=c,e=u}t[e]=s}_down(e){const{data:t,compare:i}=this,s=this.length>>1,u=t[e];for(;e<s;){let c=(e<<1)+1,f=t[c];const h=c+1;if(h<this.length&&i(t[h],f)<0&&(c=h,f=t[h]),i(f,u)>=0)break;t[e]=f,e=c}t[e]=u}};function lE(e,t){return e<t?-1:e>t?1:0}function cp(e,t){return e.p.x>t.p.x?1:e.p.x<t.p.x?-1:e.p.y!==t.p.y?e.p.y>t.p.y?1:-1:1}function cE(e,t){return e.rightSweepEvent.p.x>t.rightSweepEvent.p.x?1:e.rightSweepEvent.p.x<t.rightSweepEvent.p.x?-1:e.rightSweepEvent.p.y!==t.rightSweepEvent.p.y?e.rightSweepEvent.p.y<t.rightSweepEvent.p.y?1:-1:1}var mf=class{constructor(e,t,i,s){this.p={x:e[0],y:e[1]},this.featureId=t,this.ringId=i,this.eventId=s,this.otherEvent=null,this.isLeftEndpoint=null}isSamePoint(e){return this.p.x===e.p.x&&this.p.y===e.p.y}};function hE(e,t){if(e.type==="FeatureCollection"){const i=e.features;for(let s=0;s<i.length;s++)vf(i[s],t)}else vf(e,t)}var La=0,Ca=0,Aa=0;function vf(e,t){const i=e.type==="Feature"?e.geometry:e;let s=i.coordinates;(i.type==="Polygon"||i.type==="MultiLineString")&&(s=[s]),i.type==="LineString"&&(s=[[s]]);for(let u=0;u<s.length;u++)for(let c=0;c<s[u].length;c++){let f=s[u][c][0],h=null;Ca=Ca+1;for(let d=0;d<s[u][c].length-1;d++){h=s[u][c][d+1];const m=new mf(f,La,Ca,Aa),v=new mf(h,La,Ca,Aa+1);m.otherEvent=v,v.otherEvent=m,cp(m,v)>0?(v.isLeftEndpoint=!0,m.isLeftEndpoint=!1):(m.isLeftEndpoint=!0,v.isLeftEndpoint=!1),t.push(m),t.push(v),f=h,Aa=Aa+1}}La=La+1}var fE=class{constructor(e){this.leftSweepEvent=e,this.rightSweepEvent=e.otherEvent}};function gE(e,t){if(e===null||t===null||e.leftSweepEvent.ringId===t.leftSweepEvent.ringId&&(e.rightSweepEvent.isSamePoint(t.leftSweepEvent)||e.rightSweepEvent.isSamePoint(t.leftSweepEvent)||e.rightSweepEvent.isSamePoint(t.rightSweepEvent)||e.leftSweepEvent.isSamePoint(t.leftSweepEvent)||e.leftSweepEvent.isSamePoint(t.rightSweepEvent)))return!1;const i=e.leftSweepEvent.p.x,s=e.leftSweepEvent.p.y,u=e.rightSweepEvent.p.x,c=e.rightSweepEvent.p.y,f=t.leftSweepEvent.p.x,h=t.leftSweepEvent.p.y,d=t.rightSweepEvent.p.x,m=t.rightSweepEvent.p.y,v=(m-h)*(u-i)-(d-f)*(c-s),y=(d-f)*(s-h)-(m-h)*(i-f),k=(u-i)*(s-h)-(c-s)*(i-f);if(v===0)return!1;const S=y/v,b=k/v;return S>=0&&S<=1&&b>=0&&b<=1?[i+S*(u-i),s+S*(c-s)]:!1}function dE(e,t){t=t||!1;const i=[],s=new lp([],cE);for(;e.length;){const u=e.pop();if(u.isLeftEndpoint){const c=new fE(u);for(let f=0;f<s.data.length;f++){const h=s.data[f];if(t&&h.leftSweepEvent.featureId===u.featureId)continue;const d=gE(c,h);d!==!1&&i.push(d)}s.push(c)}else u.isLeftEndpoint===!1&&s.pop()}return i}function pE(e,t){const i=new lp([],cp);return hE(e,i),dE(i,t)}var mE=pE;function oa(e,t,i={}){const{removeDuplicates:s=!0,ignoreSelfIntersections:u=!0}=i;let c=[];e.type==="FeatureCollection"?c=c.concat(e.features):e.type==="Feature"?c.push(e):(e.type==="LineString"||e.type==="Polygon"||e.type==="MultiLineString"||e.type==="MultiPolygon")&&c.push(ln(e)),t.type==="FeatureCollection"?c=c.concat(t.features):t.type==="Feature"?c.push(t):(t.type==="LineString"||t.type==="Polygon"||t.type==="MultiLineString"||t.type==="MultiPolygon")&&c.push(ln(t));const f=mE(et(c),u);let h=[];if(s){const d={};f.forEach(m=>{const v=m.join(",");d[v]||(d[v]=!0,h.push(m))})}else h=f;return et(h.map(d=>Dt(d)))}var vE=oa;function el(e){const t=Ft(e);let i=0,s=1,u,c;for(;s<t.length;)u=c||t[0],c=t[s],i+=(c[0]-u[0])*(c[1]+u[1]),s++;return i>0}function yE(e,t={}){var i,s;if(t=t||{},!Eo(t))throw new Error("options is invalid");const u=(i=t.mutate)!=null?i:!1,c=(s=t.reverse)!=null?s:!1;if(!e)throw new Error("<geojson> is required");if(typeof c!="boolean")throw new Error("<reverse> must be a boolean");if(typeof u!="boolean")throw new Error("<mutate> must be a boolean");!u&&e.type!=="Point"&&e.type!=="MultiPoint"&&(e=bo(e));const f=[];switch(e.type){case"GeometryCollection":return si(e,function(h){qa(h,c)}),e;case"FeatureCollection":return Hn(e,function(h){Hn(qa(h,c),function(d){f.push(d)})}),et(f)}return qa(e,c)}function qa(e,t){switch(e.type==="Feature"?e.geometry.type:e.type){case"GeometryCollection":return si(e,function(i){qa(i,t)}),e;case"LineString":return yf(Ft(e),t),e;case"Polygon":return _f(Ft(e),t),e;case"MultiLineString":return Ft(e).forEach(function(i){yf(i,t)}),e;case"MultiPolygon":return Ft(e).forEach(function(i){_f(i,t)}),e;case"Point":case"MultiPoint":return e}}function yf(e,t){el(e)===t&&e.reverse()}function _f(e,t){el(e[0])!==t&&e[0].reverse();for(let i=1;i<e.length;i++)el(e[i])===t&&e[i].reverse()}var _E=yE,wE=["Point","MultiPoint"],kE=["LineString","MultiLineString","Polygon","MultiPolygon"],hp=e=>wE.includes(e.geometry.type),tl=e=>kE.includes(e.geometry.type),xE=(e,t)=>(ia(e,i=>{const s=i.coordinate;s[0]+=t.lng,s[1]+=t.lat}),e),EE=(e,t)=>{const i=e.getBounds();return uE(t,Gd(i[0],i[1],{units:"meters"})*1e-4,{units:"meters"})||null},bE=(e,t)=>{const i=Bt(e.getGeoJson());return xE(i,t),i};var SE=(e,t)=>{try{ia(e,i=>{if(!ei(i.coordinate,t))throw new Error("stop")})}catch{return!1}return!0},Ta=(e,t)=>{const i=SE(e,t);return hp(e)?i:i&&tl(e)?!vE(e,t,{ignoreSelfIntersections:!0}).features.length:!1},Wl=e=>{const t=e.getGeoJson();return typeof t!="object"?null:Hl(t)},IE=e=>{if(tl(e)){const t=_E(e,{mutate:!1});if(t.type==="Feature"&&tl(t))return{...t,properties:e.properties||{}}}return hp(e)?e:null},ME=(e,t)=>{const i=e.properties?.[t];return typeof i=="string"||typeof i=="number"?i:null},Kl=class extends aa{mode="drag";initialPoint=null;previousLngLat=null;linkedFeatures=[];bodyDragEnabled=!0;pointBasedShapes=["marker","circle_marker","text_marker"];throttledMethods=ai({onMouseMove:this.onMouseMove},this,this.gm.options.settings.throttlingDelay);eventHandlers={[`${se}:edit`]:this.handleGmEdit.bind(this),mousedown:this.onMouseDown.bind(this),touchstart:this.onMouseDown.bind(this),mousemove:this.throttledMethods.onMouseMove.bind(this),touchmove:this.throttledMethods.onMouseMove.bind(this),mouseup:this.onMouseUp.bind(this),touchend:this.onMouseUp.bind(this)};getUpdatedGeoJsonHandlers={marker:this.moveSource.bind(this),ellipse:this.moveEllipse.bind(this),circle:this.moveCircle.bind(this),circle_marker:this.moveSource.bind(this),text_marker:this.moveSource.bind(this),line:this.moveSource.bind(this),rectangle:this.moveSource.bind(this),polygon:this.moveSource.bind(this)};async onMouseDown(e){if(!this.bodyDragEnabled||!He(e))return{next:!0};const t=this.getFeatureByMouseEvent({event:e,sourceNames:[Z.main]});if(t&&this.getUpdatedGeoJsonHandlers[t.shape]){this.gm.features.selection.has(t.id)||this.gm.features.setSelection([t.id]);const i=this.gm.features.getLinkedFeatures(t);if(i.some(s=>s.getShapeProperty("disableEdit")===!0))return{next:!0};this.initialPoint=e.point,this.featureData=t,this.linkedFeatures=i,this.gm.features.updateManager.beginTransaction("transactional-update");for(const s of[this.featureData,...this.linkedFeatures])await s.changeSource({sourceName:Z.temporary}),this.snappingHelper?.addExcludedFeature(s),await this.fireFeatureEditStartEvent({feature:s,forceMode:"drag"});return this.gm.features.updateManager.commitTransaction(),this.gm.mapAdapter.setDragPan(!1),this.flags.actionInProgress=!0,this.isPointBasedShape()&&await this.alignShapeCenterWithControlMarker(this.featureData,e),{next:!1}}return{next:!0}}async onMouseUp(e){if(!this.featureData||!He(e,{warning:!0}))return{next:!0};this.snappingHelper?.clearExcludedFeatures(),this.gm.mapAdapter.setDragPan(!0),this.flags.actionInProgress=!1,this.gm.features.updateManager.beginTransaction("transactional-update");for(const t of[this.featureData,...this.linkedFeatures])await t.changeSource({sourceName:Z.main}),await this.fireFeatureEditEndEvent({feature:t,forceMode:"drag"});if(this.gm.features.updateManager.commitTransaction(),this.initialPoint&&this.initialPoint.dist(e.point)<1)if(e.originalEvent.ctrlKey){const t=this.gm.features.selection;t.has(this.featureData.id)||this.gm.features.setSelection([...t,this.featureData.id],!0)}else this.gm.features.setSelection([this.featureData.id],!0);return this.initialPoint=null,this.previousLngLat=null,this.featureData=null,this.linkedFeatures=[],{next:!0}}async onMouseMove(e){if(!this.flags.actionInProgress||!He(e,{warning:!0}))return{next:!0};if(this.featureData){const t=this.gm.markerPointer.marker?.getLngLat()||e.lngLat.toArray(),i=So(this.previousLngLat??t,t);this.gm.features.updateManager.beginTransaction("transactional-update",Z.temporary);for(const u of this.linkedFeatures)await this.moveFeature(u,i);const s=await this.moveFeature(this.featureData,i);this.gm.features.updateManager.commitTransaction(Z.temporary),s&&(this.previousLngLat=t)}return{next:!1}}isPointBasedShape(){return!!this.featureData&&this.pointBasedShapes.includes(this.featureData.shape)}async alignShapeCenterWithControlMarker(e,t){const i=Wl(e);i&&(this.gm.markerPointer.marker?.setLngLat(i),await this.onMouseMove(t))}async moveFeature(e,t){if(!this.flags.actionInProgress)return;const i=this.getUpdatedGeoJsonHandlers[e.shape];if(i){let s=i(e,t);if(s instanceof Promise&&(s=await s),!s){ee.error("BaseDrag.moveFeature: invalid updatedGeoJson",e);return}await this.fireBeforeFeatureUpdate({features:[e],geoJsonFeatures:[s],forceMode:"drag"});const u=await this.updateFeatureGeoJson({featureData:e,featureGeoJson:s,forceMode:"drag"});return Ji(e.getGeoJson().properties,s.properties)||await e._updateAllProperties(s.properties),u}}moveSource(e,t){return bE(e,t)}moveEllipse(e,t){if(e.shape!=="ellipse")return ee.error("BaseDrag.moveCircle: invalid shape type",e),null;const i=e.getShapeProperty("center"),s=e.getShapeProperty("xSemiAxis"),u=e.getShapeProperty("ySemiAxis"),c=e.getShapeProperty("angle");return!Array.isArray(i)||typeof s!="number"||typeof u!="number"||typeof c!="number"?(ee.error("BaseDrag.moveEllipse: missing center, xSemiAxis, ySemiAxis or angle in the featureData",e),null):No({center:[i[0]+t.lng,i[1]+t.lat],xSemiAxis:s,ySemiAxis:u,angle:c})}async moveCircle(e,t){if(e.shape!=="circle")return ee.error("BaseDrag.moveCircle: invalid shape type",e),null;const i=e.getShapeProperty("center");if(!Array.isArray(i))return ee.error("BaseDrag.moveCircle: missing center in the featureData",e),null;const s=Hl(e.getGeoJson());if(!s)return ee.error("BaseDrag.moveCircle: missing center circleRimLngLat"),null;const u=[i[0]+t.lng,i[1]+t.lat];return await e.setShapeProperty("center",u),{type:"Feature",properties:{shape:"circle"},geometry:Mo({center:u,radius:this.gm.mapAdapter.getDistance(i,s)}).geometry}}};var NE=(e,t)=>(e%t+t)%t;var LE=class extends Kl{mode="change";cutVertexShapeTypes=["line","polygon","rectangle"];markerData=null;shapeUpdateHandlers={marker:this.updateSingleVertex.bind(this),circle:this.updateCircle.bind(this),circle_marker:this.updateSingleVertex.bind(this),ellipse:this.updateEllipse.bind(this),text_marker:this.updateSingleVertex.bind(this),line:this.updateSingleVertex.bind(this),rectangle:this.updateRectangle.bind(this),polygon:this.updateSingleVertex.bind(this)};get snapGuidesInstance(){const e=this.gm.actionInstances.helper__snap_guides;return Jd(e)?e:null}onStartAction(){}onEndAction(){this.snapGuidesInstance?.removeSnapGuides()}async onMouseDown(e){if(!He(e))return{next:!0};if(this.getSettingValue("bodyDragEnabled")===!0)return await super.onMouseDown(e);const t=this.getFeatureByMouseEvent({event:e,sourceNames:[Z.main]});return!t||!this.pointBasedShapes.includes(t.shape)?{next:!0}:await super.onMouseDown(e)}async handleGmEdit(e){if(!Ki(e))return{next:!0};if(e.action==="marker_move"&&e.lngLatStart&&e.markerData){if(e.markerData.type==="vertex")return await this.moveVertex(e),{next:!1};if(e.lngLatEnd){const t=So(e.lngLatStart,e.lngLatEnd);return this.moveSource(e.featureData,t),{next:!1}}}return e.action==="marker_right_click"?(await this.cutVertex(e),await this.fireFeatureEditEndEvent({feature:e.featureData})):e.action==="edge_marker_click"?await this.insertVertex(e):e.action==="marker_captured"?(this.setCursorToPointer(),await e.featureData.changeSource({sourceName:Z.temporary}),this.flags.actionInProgress=!0,await this.fireFeatureEditStartEvent({feature:e.featureData})):e.action==="marker_released"&&(this.markerData=null,this.snapGuidesInstance?.removeSnapGuides(),await e.featureData.changeSource({sourceName:Z.main}),await this.fireFeatureEditEndEvent({feature:e.featureData}),this.flags.actionInProgress=!1),{next:!0}}async moveVertex(e){this.markerData||(this.markerData=e.markerData||null,this.snapGuidesInstance?.updateSnapGuides(e.featureData.getGeoJson(),e.lngLatStart));const t=e.featureData,i=t.shape,s=this.shapeUpdateHandlers[i]?.(e)||null;s?(await this.fireBeforeFeatureUpdate({features:[t],geoJsonFeatures:[s]}),this.updateFeatureGeoJson({featureData:t,featureGeoJson:s})):ee.error("EditChange.moveVertex: invalid geojson",s,e)}async cutVertex(e){const t=e.featureData;if(e.markerData.type!=="vertex"||!this.cutVertexShapeTypes.includes(t.shape))return;let i=!1;const s=t.getGeoJson(),u=e.markerData.instance;if(Ud(s)){if(nu(s)<=2){await this.gm.features.delete(t);return}}else if(jd(s)){if(nu(s)<=3){await this.gm.features.delete(t);return}}else if(zd(s)&&nu(s)<=3){await this.gm.features.delete(t);return}const c=Wl(u);c&&(i=O2(s,c)),i?(await t.convertToPolygon(),await t.updateGeometry(s.geometry),await this.fireFeatureUpdatedEvent({sourceFeatures:[t],targetFeatures:[t],markerData:e.markerData})):ee.error("EditChange.cutVertex: feature not updated",e)}async insertVertex(e){if(e.markerData.type!=="edge")return;const t=e.featureData.getGeoJson(),i=e.markerData.segment.end.path,s=i.pop(),u=Ri(t,i);typeof s=="number"&&(u.splice(s,0,[...e.markerData.position.coordinate]),await e.featureData.updateGeometry(t.geometry),await e.featureData.convertToPolygon(),await this.fireFeatureUpdatedEvent({sourceFeatures:[e.featureData],targetFeatures:[e.featureData],markerData:e.markerData}))}updateSingleVertex({featureData:e,lngLatEnd:t,markerData:i}){const s=Bt(e.getGeoJson()),u=Bt(i.position.path),c=u.pop(),f=Ri(s,u);return Array.isArray(f)&&typeof c=="number"?(f[c]=[...t],c===0&&e.shape==="polygon"&&(f[f.length-1]=[...t])):ee.error("BaseDrag.moveSingleVertex: invalid coordinates",s,u),s}updateCircle({featureData:e,lngLatEnd:t}){const i=e.getShapeProperty("center");return e.shape!=="circle"||!i?(ee.error("BaseDrag.moveCircle: invalid shape type / missing center",e),null):{type:"Feature",properties:{shape:"circle"},geometry:Mo({center:i,radius:this.gm.mapAdapter.getDistance(i,t)}).geometry}}updateEllipse(e){const{featureData:t,lngLatEnd:i,markerData:s}=e;if(t.shape!=="ellipse")return ee.error("EditChange.updateEllipse: invalid shape type",t),null;const u=t.getShapeProperty("center");let c=t.getShapeProperty("xSemiAxis"),f=t.getShapeProperty("ySemiAxis");const h=t.getShapeProperty("angle");if(!Array.isArray(u)||typeof c!="number"||typeof f!="number"||typeof h!="number")return ee.error("updateEllipse: missing center, xSemiAxis, ySemiAxis or angle in the featureData",t),null;const d=this.gm.mapAdapter.getDistance(u,i),m=s.position.path[3],v=Math.floor(m/Yd*4);return(v===0||v===2?"x":"y")=="x"?c=d:f=d,No({center:u,xSemiAxis:c,ySemiAxis:f,angle:h})}updateRectangle({featureData:e,lngLatStart:t,lngLatEnd:i}){const s=e.getGeoJson(),u=s.geometry.coordinates[0],{absCoordIndex:c}=Io(s,t);if(c===-1)return ee.error("EditChange.updateRectangle: start vertex not found",e),null;const f=u[NE(c-2,4)];return Yu(i,f)}};function CE(e,t,{ignoreSelfIntersections:i=!0}={ignoreSelfIntersections:!0}){let s=!0;return Er(e,u=>{Er(t,c=>{if(s===!1)return!1;s=AE(u.geometry,c.geometry,i)})}),s}function AE(e,t,i){switch(e.type){case"Point":switch(t.type){case"Point":return!RE(e.coordinates,t.coordinates);case"LineString":return!wf(t,e);case"Polygon":return!ei(e,t)}break;case"LineString":switch(t.type){case"Point":return!wf(e,t);case"LineString":return!TE(e,t,i);case"Polygon":return!kf(t,e,i)}break;case"Polygon":switch(t.type){case"Point":return!ei(t,e);case"LineString":return!kf(e,t,i);case"Polygon":return!PE(t,e,i)}}return!1}function wf(e,t){for(let i=0;i<e.coordinates.length-1;i++)if(OE(e.coordinates[i],e.coordinates[i+1],t.coordinates))return!0;return!1}function TE(e,t,i){return oa(e,t,{ignoreSelfIntersections:i}).features.length>0}function kf(e,t,i){for(const s of t.coordinates)if(ei(s,e))return!0;return oa(t,ju(e),{ignoreSelfIntersections:i}).features.length>0}function PE(e,t,i){for(const s of e.coordinates[0])if(ei(s,t))return!0;for(const s of t.coordinates[0])if(ei(s,e))return!0;return oa(ju(e),ju(t),{ignoreSelfIntersections:i}).features.length>0}function OE(e,t,i){const s=i[0]-e[0],u=i[1]-e[1],c=t[0]-e[0],f=t[1]-e[1];return s*f-u*c!==0?!1:Math.abs(c)>=Math.abs(f)?c>0?e[0]<=i[0]&&i[0]<=t[0]:t[0]<=i[0]&&i[0]<=e[0]:f>0?e[1]<=i[1]&&i[1]<=t[1]:t[1]<=i[1]&&i[1]<=e[1]}function RE(e,t){return e[0]===t[0]&&e[1]===t[1]}function DE(e,t,{ignoreSelfIntersections:i=!0}={}){let s=!1;return Er(e,u=>{Er(t,c=>{if(s===!0)return!0;s=!CE(u.geometry,c.geometry,{ignoreSelfIntersections:i})})}),s}var FE=DE,GE=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,cu=Math.ceil,Xt=Math.floor,Nt="[BigNumber Error] ",xf=Nt+"Number primitive has more than 15 significant digits: ",pn=1e14,ke=14,hu=9007199254740991,fu=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],pr=1e7,it=1e9;function fp(e){var t,i,s,u=L.prototype={constructor:L,toString:null,valueOf:null},c=new L(1),f=20,h=4,d=-7,m=21,v=-1e7,y=1e7,k=!1,S=1,b=0,P={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},O="0123456789abcdefghijklmnopqrstuvwxyz",G=!0;function L(w,E){var M,R,T,F,D,N,B,U,q=this;if(!(q instanceof L))return new L(w,E);if(E==null){if(w&&w._isBigNumber===!0){q.s=w.s,!w.c||w.e>y?q.c=q.e=null:w.e<v?q.c=[q.e=0]:(q.e=w.e,q.c=w.c.slice());return}if((N=typeof w=="number")&&w*0==0){if(q.s=1/w<0?(w=-w,-1):1,w===~~w){for(F=0,D=w;D>=10;D/=10,F++);F>y?q.c=q.e=null:(q.e=F,q.c=[w]);return}U=String(w)}else{if(!GE.test(U=String(w)))return s(q,U,N);q.s=U.charCodeAt(0)==45?(U=U.slice(1),-1):1}(F=U.indexOf("."))>-1&&(U=U.replace(".","")),(D=U.search(/e/i))>0?(F<0&&(F=D),F+=+U.slice(D+1),U=U.substring(0,D)):F<0&&(F=U.length)}else{if(Je(E,2,O.length,"Base"),E==10&&G)return q=new L(w),H(q,f+q.e+1,h);if(U=String(w),N=typeof w=="number"){if(w*0!=0)return s(q,U,N,E);if(q.s=1/w<0?(U=U.slice(1),-1):1,L.DEBUG&&U.replace(/^0\.0*|\./,"").length>15)throw Error(xf+w)}else q.s=U.charCodeAt(0)===45?(U=U.slice(1),-1):1;for(M=O.slice(0,E),F=D=0,B=U.length;D<B;D++)if(M.indexOf(R=U.charAt(D))<0){if(R=="."){if(D>F){F=B;continue}}else if(!T&&(U==U.toUpperCase()&&(U=U.toLowerCase())||U==U.toLowerCase()&&(U=U.toUpperCase()))){T=!0,D=-1,F=0;continue}return s(q,String(w),N,E)}N=!1,U=i(U,E,10,q.s),(F=U.indexOf("."))>-1?U=U.replace(".",""):F=U.length}for(D=0;U.charCodeAt(D)===48;D++);for(B=U.length;U.charCodeAt(--B)===48;);if(U=U.slice(D,++B)){if(B-=D,N&&L.DEBUG&&B>15&&(w>hu||w!==Xt(w)))throw Error(xf+q.s*w);if((F=F-D-1)>y)q.c=q.e=null;else if(F<v)q.c=[q.e=0];else{if(q.e=F,q.c=[],D=(F+1)%ke,F<0&&(D+=ke),D<B){for(D&&q.c.push(+U.slice(0,D)),B-=ke;D<B;)q.c.push(+U.slice(D,D+=ke));D=ke-(U=U.slice(D)).length}else D-=B;for(;D--;U+="0");q.c.push(+U)}}else q.c=[q.e=0]}L.clone=fp,L.ROUND_UP=0,L.ROUND_DOWN=1,L.ROUND_CEIL=2,L.ROUND_FLOOR=3,L.ROUND_HALF_UP=4,L.ROUND_HALF_DOWN=5,L.ROUND_HALF_EVEN=6,L.ROUND_HALF_CEIL=7,L.ROUND_HALF_FLOOR=8,L.EUCLID=9,L.config=L.set=function(w){var E,M;if(w!=null)if(typeof w=="object"){if(w.hasOwnProperty(E="DECIMAL_PLACES")&&(M=w[E],Je(M,0,it,E),f=M),w.hasOwnProperty(E="ROUNDING_MODE")&&(M=w[E],Je(M,0,8,E),h=M),w.hasOwnProperty(E="EXPONENTIAL_AT")&&(M=w[E],M&&M.pop?(Je(M[0],-it,0,E),Je(M[1],0,it,E),d=M[0],m=M[1]):(Je(M,-it,it,E),d=-(m=M<0?-M:M))),w.hasOwnProperty(E="RANGE"))if(M=w[E],M&&M.pop)Je(M[0],-it,-1,E),Je(M[1],1,it,E),v=M[0],y=M[1];else if(Je(M,-it,it,E),M)v=-(y=M<0?-M:M);else throw Error(Nt+E+" cannot be zero: "+M);if(w.hasOwnProperty(E="CRYPTO"))if(M=w[E],M===!!M)if(M)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))k=M;else throw k=!M,Error(Nt+"crypto unavailable");else k=M;else throw Error(Nt+E+" not true or false: "+M);if(w.hasOwnProperty(E="MODULO_MODE")&&(M=w[E],Je(M,0,9,E),S=M),w.hasOwnProperty(E="POW_PRECISION")&&(M=w[E],Je(M,0,it,E),b=M),w.hasOwnProperty(E="FORMAT"))if(M=w[E],typeof M=="object")P=M;else throw Error(Nt+E+" not an object: "+M);if(w.hasOwnProperty(E="ALPHABET"))if(M=w[E],typeof M=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(M))G=M.slice(0,10)=="0123456789",O=M;else throw Error(Nt+E+" invalid: "+M)}else throw Error(Nt+"Object expected: "+w);return{DECIMAL_PLACES:f,ROUNDING_MODE:h,EXPONENTIAL_AT:[d,m],RANGE:[v,y],CRYPTO:k,MODULO_MODE:S,POW_PRECISION:b,FORMAT:P,ALPHABET:O}},L.isBigNumber=function(w){if(!w||w._isBigNumber!==!0)return!1;if(!L.DEBUG)return!0;var E,M,R=w.c,T=w.e,F=w.s;e:if({}.toString.call(R)=="[object Array]"){if((F===1||F===-1)&&T>=-it&&T<=it&&T===Xt(T)){if(R[0]===0){if(T===0&&R.length===1)return!0;break e}if(E=(T+1)%ke,E<1&&(E+=ke),String(R[0]).length==E){for(E=0;E<R.length;E++)if(M=R[E],M<0||M>=pn||M!==Xt(M))break e;if(M!==0)return!0}}}else if(R===null&&T===null&&(F===null||F===1||F===-1))return!0;throw Error(Nt+"Invalid BigNumber: "+w)},L.maximum=L.max=function(){return V(arguments,-1)},L.minimum=L.min=function(){return V(arguments,1)},L.random=(function(){var w=9007199254740992,E=Math.random()*w&2097151?function(){return Xt(Math.random()*w)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(M){var R,T,F,D,N,B=0,U=[],q=new L(c);if(M==null?M=f:Je(M,0,it),D=cu(M/ke),k)if(crypto.getRandomValues){for(R=crypto.getRandomValues(new Uint32Array(D*=2));B<D;)N=R[B]*131072+(R[B+1]>>>11),N>=9e15?(T=crypto.getRandomValues(new Uint32Array(2)),R[B]=T[0],R[B+1]=T[1]):(U.push(N%1e14),B+=2);B=D/2}else if(crypto.randomBytes){for(R=crypto.randomBytes(D*=7);B<D;)N=(R[B]&31)*281474976710656+R[B+1]*1099511627776+R[B+2]*4294967296+R[B+3]*16777216+(R[B+4]<<16)+(R[B+5]<<8)+R[B+6],N>=9e15?crypto.randomBytes(7).copy(R,B):(U.push(N%1e14),B+=7);B=D/7}else throw k=!1,Error(Nt+"crypto unavailable");if(!k)for(;B<D;)N=E(),N<9e15&&(U[B++]=N%1e14);for(D=U[--B],M%=ke,D&&M&&(N=fu[ke-M],U[B]=Xt(D/N)*N);U[B]===0;U.pop(),B--);if(B<0)U=[F=0];else{for(F=-1;U[0]===0;U.splice(0,1),F-=ke);for(B=1,N=U[0];N>=10;N/=10,B++);B<ke&&(F-=ke-B)}return q.e=F,q.c=U,q}})(),L.sum=function(){for(var w=1,E=arguments,M=new L(E[0]);w<E.length;)M=M.plus(E[w++]);return M},i=(function(){var w="0123456789";function E(M,R,T,F){for(var D,N=[0],B,U=0,q=M.length;U<q;){for(B=N.length;B--;N[B]*=R);for(N[0]+=F.indexOf(M.charAt(U++)),D=0;D<N.length;D++)N[D]>T-1&&(N[D+1]??(N[D+1]=0),N[D+1]+=N[D]/T|0,N[D]%=T)}return N.reverse()}return function(M,R,T,F,D){var N,B,U,q,W,K,ie,ae,ce=M.indexOf("."),re=f,oe=h;for(ce>=0&&(q=b,b=0,M=M.replace(".",""),ae=new L(R),K=ae.pow(M.length-ce),b=q,ae.c=E(Qn(Vt(K.c),K.e,"0"),10,T,w),ae.e=ae.c.length),ie=E(M,R,T,D?(N=O,w):(N=w,O)),U=q=ie.length;ie[--q]==0;ie.pop());if(!ie[0])return N.charAt(0);if(ce<0?--U:(K.c=ie,K.e=U,K.s=F,K=t(K,ae,re,oe,T),ie=K.c,W=K.r,U=K.e),B=U+re+1,ce=ie[B],q=T/2,W=W||B<0||ie[B+1]!=null,W=oe<4?(ce!=null||W)&&(oe==0||oe==(K.s<0?3:2)):ce>q||ce==q&&(oe==4||W||oe==6&&ie[B-1]&1||oe==(K.s<0?8:7)),B<1||!ie[0])M=W?Qn(N.charAt(1),-re,N.charAt(0)):N.charAt(0);else{if(ie.length=B,W)for(--T;++ie[--B]>T;)ie[B]=0,B||(++U,ie=[1].concat(ie));for(q=ie.length;!ie[--q];);for(ce=0,M="";ce<=q;M+=N.charAt(ie[ce++]));M=Qn(M,U,N.charAt(0))}return M}})(),t=(function(){function w(R,T,F){var D,N,B,U,q=0,W=R.length,K=T%pr,ie=T/pr|0;for(R=R.slice();W--;)B=R[W]%pr,U=R[W]/pr|0,D=ie*B+U*K,N=K*B+D%pr*pr+q,q=(N/F|0)+(D/pr|0)+ie*U,R[W]=N%F;return q&&(R=[q].concat(R)),R}function E(R,T,F,D){var N,B;if(F!=D)B=F>D?1:-1;else for(N=B=0;N<F;N++)if(R[N]!=T[N]){B=R[N]>T[N]?1:-1;break}return B}function M(R,T,F,D){for(var N=0;F--;)R[F]-=N,N=R[F]<T[F]?1:0,R[F]=N*D+R[F]-T[F];for(;!R[0]&&R.length>1;R.splice(0,1));}return function(R,T,F,D,N){var B,U,q,W,K,ie,ae,ce,re,oe,we,Ie,Y,be,fe,C,$e,Be=R.s==T.s?1:-1,Re=R.c,Me=T.c;if(!Re||!Re[0]||!Me||!Me[0])return new L(!R.s||!T.s||(Re?Me&&Re[0]==Me[0]:!Me)?NaN:Re&&Re[0]==0||!Me?Be*0:Be/0);for(ce=new L(Be),re=ce.c=[],U=R.e-T.e,Be=F+U+1,N||(N=pn,U=$t(R.e/ke)-$t(T.e/ke),Be=Be/ke|0),q=0;Me[q]==(Re[q]||0);q++);if(Me[q]>(Re[q]||0)&&U--,Be<0)re.push(1),W=!0;else{for(be=Re.length,C=Me.length,q=0,Be+=2,K=Xt(N/(Me[0]+1)),K>1&&(Me=w(Me,K,N),Re=w(Re,K,N),C=Me.length,be=Re.length),Y=C,oe=Re.slice(0,C),we=oe.length;we<C;oe[we++]=0);$e=Me.slice(),$e=[0].concat($e),fe=Me[0],Me[1]>=N/2&&fe++;do{if(K=0,B=E(Me,oe,C,we),B<0){if(Ie=oe[0],C!=we&&(Ie=Ie*N+(oe[1]||0)),K=Xt(Ie/fe),K>1)for(K>=N&&(K=N-1),ie=w(Me,K,N),ae=ie.length,we=oe.length;E(ie,oe,ae,we)==1;)K--,M(ie,C<ae?$e:Me,ae,N),ae=ie.length,B=1;else K==0&&(B=K=1),ie=Me.slice(),ae=ie.length;if(ae<we&&(ie=[0].concat(ie)),M(oe,ie,we,N),we=oe.length,B==-1)for(;E(Me,oe,C,we)<1;)K++,M(oe,C<we?$e:Me,we,N),we=oe.length}else B===0&&(K++,oe=[0]);re[q++]=K,oe[0]?oe[we++]=Re[Y]||0:(oe=[Re[Y]],we=1)}while((Y++<be||oe[0]!=null)&&Be--);W=oe[0]!=null,re[0]||re.splice(0,1)}if(N==pn){for(q=1,Be=re[0];Be>=10;Be/=10,q++);H(ce,F+(ce.e=q+U*ke-1)+1,D,W)}else ce.e=U,ce.r=+W;return ce}})();function j(w,E,M,R){var T,F,D,N,B;if(M==null?M=h:Je(M,0,8),!w.c)return w.toString();if(T=w.c[0],D=w.e,E==null)B=Vt(w.c),B=R==1||R==2&&(D<=d||D>=m)?Oa(B,D):Qn(B,D,"0");else if(w=H(new L(w),E,M),F=w.e,B=Vt(w.c),N=B.length,R==1||R==2&&(E<=F||F<=d)){for(;N<E;B+="0",N++);B=Oa(B,F)}else if(E-=D+(R===2&&F>D),B=Qn(B,F,"0"),F+1>N){if(--E>0)for(B+=".";E--;B+="0");}else if(E+=F-N,E>0)for(F+1==N&&(B+=".");E--;B+="0");return w.s<0&&T?"-"+B:B}function V(w,E){for(var M,R,T=1,F=new L(w[0]);T<w.length;T++)R=new L(w[T]),(!R.s||(M=Ur(F,R))===E||M===0&&F.s===E)&&(F=R);return F}function X(w,E,M){for(var R=1,T=E.length;!E[--T];E.pop());for(T=E[0];T>=10;T/=10,R++);return(M=R+M*ke-1)>y?w.c=w.e=null:M<v?w.c=[w.e=0]:(w.e=M,w.c=E),w}s=(function(){var w=/^(-?)0([xbo])(?=\w[\w.]*$)/i,E=/^([^.]+)\.$/,M=/^\.([^.]+)$/,R=/^-?(Infinity|NaN)$/,T=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(F,D,N,B){var U,q=N?D:D.replace(T,"");if(R.test(q))F.s=isNaN(q)?null:q<0?-1:1;else{if(!N&&(q=q.replace(w,function(W,K,ie){return U=(ie=ie.toLowerCase())=="x"?16:ie=="b"?2:8,!B||B==U?K:W}),B&&(U=B,q=q.replace(E,"$1").replace(M,"0.$1")),D!=q))return new L(q,U);if(L.DEBUG)throw Error(Nt+"Not a"+(B?" base "+B:"")+" number: "+D);F.s=null}F.c=F.e=null}})();function H(w,E,M,R){var T,F,D,N,B,U,q,W=w.c,K=fu;if(W){e:{for(T=1,N=W[0];N>=10;N/=10,T++);if(F=E-T,F<0)F+=ke,D=E,B=W[U=0],q=Xt(B/K[T-D-1]%10);else if(U=cu((F+1)/ke),U>=W.length)if(R){for(;W.length<=U;W.push(0));B=q=0,T=1,F%=ke,D=F-ke+1}else break e;else{for(B=N=W[U],T=1;N>=10;N/=10,T++);F%=ke,D=F-ke+T,q=D<0?0:Xt(B/K[T-D-1]%10)}if(R=R||E<0||W[U+1]!=null||(D<0?B:B%K[T-D-1]),R=M<4?(q||R)&&(M==0||M==(w.s<0?3:2)):q>5||q==5&&(M==4||R||M==6&&(F>0?D>0?B/K[T-D]:0:W[U-1])%10&1||M==(w.s<0?8:7)),E<1||!W[0])return W.length=0,R?(E-=w.e+1,W[0]=K[(ke-E%ke)%ke],w.e=-E||0):W[0]=w.e=0,w;if(F==0?(W.length=U,N=1,U--):(W.length=U+1,N=K[ke-F],W[U]=D>0?Xt(B/K[T-D]%K[D])*N:0),R)for(;;)if(U==0){for(F=1,D=W[0];D>=10;D/=10,F++);for(D=W[0]+=N,N=1;D>=10;D/=10,N++);F!=N&&(w.e++,W[0]==pn&&(W[0]=1));break}else{if(W[U]+=N,W[U]!=pn)break;W[U--]=0,N=1}for(F=W.length;W[--F]===0;W.pop());}w.e>y?w.c=w.e=null:w.e<v&&(w.c=[w.e=0])}return w}function $(w){var E,M=w.e;return M===null?w.toString():(E=Vt(w.c),E=M<=d||M>=m?Oa(E,M):Qn(E,M,"0"),w.s<0?"-"+E:E)}return u.absoluteValue=u.abs=function(){var w=new L(this);return w.s<0&&(w.s=1),w},u.comparedTo=function(w,E){return Ur(this,new L(w,E))},u.decimalPlaces=u.dp=function(w,E){var M,R,T,F=this;if(w!=null)return Je(w,0,it),E==null?E=h:Je(E,0,8),H(new L(F),w+F.e+1,E);if(!(M=F.c))return null;if(R=((T=M.length-1)-$t(this.e/ke))*ke,T=M[T])for(;T%10==0;T/=10,R--);return R<0&&(R=0),R},u.dividedBy=u.div=function(w,E){return t(this,new L(w,E),f,h)},u.dividedToIntegerBy=u.idiv=function(w,E){return t(this,new L(w,E),0,1)},u.exponentiatedBy=u.pow=function(w,E){var M,R,T,F,D,N,B,U,q,W=this;if(w=new L(w),w.c&&!w.isInteger())throw Error(Nt+"Exponent not an integer: "+$(w));if(E!=null&&(E=new L(E)),N=w.e>14,!W.c||!W.c[0]||W.c[0]==1&&!W.e&&W.c.length==1||!w.c||!w.c[0])return q=new L(Math.pow(+$(W),N?w.s*(2-Pa(w)):+$(w))),E?q.mod(E):q;if(B=w.s<0,E){if(E.c?!E.c[0]:!E.s)return new L(NaN);R=!B&&W.isInteger()&&E.isInteger(),R&&(W=W.mod(E))}else{if(w.e>9&&(W.e>0||W.e<-1||(W.e==0?W.c[0]>1||N&&W.c[1]>=24e7:W.c[0]<8e13||N&&W.c[0]<=9999975e7)))return F=W.s<0&&Pa(w)?-0:0,W.e>-1&&(F=1/F),new L(B?1/F:F);b&&(F=cu(b/ke+2))}for(N?(M=new L(.5),B&&(w.s=1),U=Pa(w)):(T=Math.abs(+$(w)),U=T%2),q=new L(c);;){if(U){if(q=q.times(W),!q.c)break;F?q.c.length>F&&(q.c.length=F):R&&(q=q.mod(E))}if(T){if(T=Xt(T/2),T===0)break;U=T%2}else if(w=w.times(M),H(w,w.e+1,1),w.e>14)U=Pa(w);else{if(T=+$(w),T===0)break;U=T%2}W=W.times(W),F?W.c&&W.c.length>F&&(W.c.length=F):R&&(W=W.mod(E))}return R?q:(B&&(q=c.div(q)),E?q.mod(E):F?H(q,b,h,D):q)},u.integerValue=function(w){var E=new L(this);return w==null?w=h:Je(w,0,8),H(E,E.e+1,w)},u.isEqualTo=u.eq=function(w,E){return Ur(this,new L(w,E))===0},u.isFinite=function(){return!!this.c},u.isGreaterThan=u.gt=function(w,E){return Ur(this,new L(w,E))>0},u.isGreaterThanOrEqualTo=u.gte=function(w,E){return(E=Ur(this,new L(w,E)))===1||E===0},u.isInteger=function(){return!!this.c&&$t(this.e/ke)>this.c.length-2},u.isLessThan=u.lt=function(w,E){return Ur(this,new L(w,E))<0},u.isLessThanOrEqualTo=u.lte=function(w,E){return(E=Ur(this,new L(w,E)))===-1||E===0},u.isNaN=function(){return!this.s},u.isNegative=function(){return this.s<0},u.isPositive=function(){return this.s>0},u.isZero=function(){return!!this.c&&this.c[0]==0},u.minus=function(w,E){var M,R,T,F,D=this,N=D.s;if(w=new L(w,E),E=w.s,!N||!E)return new L(NaN);if(N!=E)return w.s=-E,D.plus(w);var B=D.e/ke,U=w.e/ke,q=D.c,W=w.c;if(!B||!U){if(!q||!W)return q?(w.s=-E,w):new L(W?D:NaN);if(!q[0]||!W[0])return W[0]?(w.s=-E,w):new L(q[0]?D:h==3?-0:0)}if(B=$t(B),U=$t(U),q=q.slice(),N=B-U){for((F=N<0)?(N=-N,T=q):(U=B,T=W),T.reverse(),E=N;E--;T.push(0));T.reverse()}else for(R=(F=(N=q.length)<(E=W.length))?N:E,N=E=0;E<R;E++)if(q[E]!=W[E]){F=q[E]<W[E];break}if(F&&(T=q,q=W,W=T,w.s=-w.s),E=(R=W.length)-(M=q.length),E>0)for(;E--;q[M++]=0);for(E=pn-1;R>N;){if(q[--R]<W[R]){for(M=R;M&&!q[--M];q[M]=E);--q[M],q[R]+=pn}q[R]-=W[R]}for(;q[0]==0;q.splice(0,1),--U);return q[0]?X(w,q,U):(w.s=h==3?-1:1,w.c=[w.e=0],w)},u.modulo=u.mod=function(w,E){var M,R,T=this;return w=new L(w,E),!T.c||!w.s||w.c&&!w.c[0]?new L(NaN):!w.c||T.c&&!T.c[0]?new L(T):(S==9?(R=w.s,w.s=1,M=t(T,w,0,3),w.s=R,M.s*=R):M=t(T,w,0,S),w=T.minus(M.times(w)),!w.c[0]&&S==1&&(w.s=T.s),w)},u.multipliedBy=u.times=function(w,E){var M,R,T,F,D,N,B,U,q,W,K,ie,ae,ce,re,oe=this,we=oe.c,Ie=(w=new L(w,E)).c;if(!we||!Ie||!we[0]||!Ie[0])return!oe.s||!w.s||we&&!we[0]&&!Ie||Ie&&!Ie[0]&&!we?w.c=w.e=w.s=null:(w.s*=oe.s,!we||!Ie?w.c=w.e=null:(w.c=[0],w.e=0)),w;for(R=$t(oe.e/ke)+$t(w.e/ke),w.s*=oe.s,B=we.length,W=Ie.length,B<W&&(ae=we,we=Ie,Ie=ae,T=B,B=W,W=T),T=B+W,ae=[];T--;ae.push(0));for(ce=pn,re=pr,T=W;--T>=0;){for(M=0,K=Ie[T]%re,ie=Ie[T]/re|0,D=B,F=T+D;F>T;)U=we[--D]%re,q=we[D]/re|0,N=ie*U+q*K,U=K*U+N%re*re+ae[F]+M,M=(U/ce|0)+(N/re|0)+ie*q,ae[F--]=U%ce;ae[F]=M}return M?++R:ae.splice(0,1),X(w,ae,R)},u.negated=function(){var w=new L(this);return w.s=-w.s||null,w},u.plus=function(w,E){var M,R=this,T=R.s;if(w=new L(w,E),E=w.s,!T||!E)return new L(NaN);if(T!=E)return w.s=-E,R.minus(w);var F=R.e/ke,D=w.e/ke,N=R.c,B=w.c;if(!F||!D){if(!N||!B)return new L(T/0);if(!N[0]||!B[0])return B[0]?w:new L(N[0]?R:T*0)}if(F=$t(F),D=$t(D),N=N.slice(),T=F-D){for(T>0?(D=F,M=B):(T=-T,M=N),M.reverse();T--;M.push(0));M.reverse()}for(T=N.length,E=B.length,T-E<0&&(M=B,B=N,N=M,E=T),T=0;E;)T=(N[--E]=N[E]+B[E]+T)/pn|0,N[E]=pn===N[E]?0:N[E]%pn;return T&&(N=[T].concat(N),++D),X(w,N,D)},u.precision=u.sd=function(w,E){var M,R,T,F=this;if(w!=null&&w!==!!w)return Je(w,1,it),E==null?E=h:Je(E,0,8),H(new L(F),w,E);if(!(M=F.c))return null;if(T=M.length-1,R=T*ke+1,T=M[T]){for(;T%10==0;T/=10,R--);for(T=M[0];T>=10;T/=10,R++);}return w&&F.e+1>R&&(R=F.e+1),R},u.shiftedBy=function(w){return Je(w,-hu,hu),this.times("1e"+w)},u.squareRoot=u.sqrt=function(){var w,E,M,R,T,F=this,D=F.c,N=F.s,B=F.e,U=f+4,q=new L("0.5");if(N!==1||!D||!D[0])return new L(!N||N<0&&(!D||D[0])?NaN:D?F:1/0);if(N=Math.sqrt(+$(F)),N==0||N==1/0?(E=Vt(D),(E.length+B)%2==0&&(E+="0"),N=Math.sqrt(+E),B=$t((B+1)/2)-(B<0||B%2),N==1/0?E="5e"+B:(E=N.toExponential(),E=E.slice(0,E.indexOf("e")+1)+B),M=new L(E)):M=new L(N+""),M.c[0]){for(B=M.e,N=B+U,N<3&&(N=0);;)if(T=M,M=q.times(T.plus(t(F,T,U,1))),Vt(T.c).slice(0,N)===(E=Vt(M.c)).slice(0,N))if(M.e<B&&--N,E=E.slice(N-3,N+1),E=="9999"||!R&&E=="4999"){if(!R&&(H(T,T.e+f+2,0),T.times(T).eq(F))){M=T;break}U+=4,N+=4,R=1}else{(!+E||!+E.slice(1)&&E.charAt(0)=="5")&&(H(M,M.e+f+2,1),w=!M.times(M).eq(F));break}}return H(M,M.e+f+1,h,w)},u.toExponential=function(w,E){return w!=null&&(Je(w,0,it),w++),j(this,w,E,1)},u.toFixed=function(w,E){return w!=null&&(Je(w,0,it),w=w+this.e+1),j(this,w,E)},u.toFormat=function(w,E,M){var R,T=this;if(M==null)w!=null&&E&&typeof E=="object"?(M=E,E=null):w&&typeof w=="object"?(M=w,w=E=null):M=P;else if(typeof M!="object")throw Error(Nt+"Argument not an object: "+M);if(R=T.toFixed(w,E),T.c){var F,D=R.split("."),N=+M.groupSize,B=+M.secondaryGroupSize,U=M.groupSeparator||"",q=D[0],W=D[1],K=T.s<0,ie=K?q.slice(1):q,ae=ie.length;if(B&&(F=N,N=B,B=F,ae-=F),N>0&&ae>0){for(F=ae%N||N,q=ie.substr(0,F);F<ae;F+=N)q+=U+ie.substr(F,N);B>0&&(q+=U+ie.slice(F)),K&&(q="-"+q)}R=W?q+(M.decimalSeparator||"")+((B=+M.fractionGroupSize)?W.replace(new RegExp("\\d{"+B+"}\\B","g"),"$&"+(M.fractionGroupSeparator||"")):W):q}return(M.prefix||"")+R+(M.suffix||"")},u.toFraction=function(w){var E,M,R,T,F,D,N,B,U,q,W,K,ie=this,ae=ie.c;if(w!=null&&(N=new L(w),!N.isInteger()&&(N.c||N.s!==1)||N.lt(c)))throw Error(Nt+"Argument "+(N.isInteger()?"out of range: ":"not an integer: ")+$(N));if(!ae)return new L(ie);for(E=new L(c),U=M=new L(c),R=B=new L(c),K=Vt(ae),F=E.e=K.length-ie.e-1,E.c[0]=fu[(D=F%ke)<0?ke+D:D],w=!w||N.comparedTo(E)>0?F>0?E:U:N,D=y,y=1/0,N=new L(K),B.c[0]=0;q=t(N,E,0,1),T=M.plus(q.times(R)),T.comparedTo(w)!=1;)M=R,R=T,U=B.plus(q.times(T=U)),B=T,E=N.minus(q.times(T=E)),N=T;return T=t(w.minus(M),R,0,1),B=B.plus(T.times(U)),M=M.plus(T.times(R)),B.s=U.s=ie.s,F=F*2,W=t(U,R,F,h).minus(ie).abs().comparedTo(t(B,M,F,h).minus(ie).abs())<1?[U,R]:[B,M],y=D,W},u.toNumber=function(){return+$(this)},u.toPrecision=function(w,E){return w!=null&&Je(w,1,it),j(this,w,E,2)},u.toString=function(w){var E,M=this,R=M.s,T=M.e;return T===null?R?(E="Infinity",R<0&&(E="-"+E)):E="NaN":(w==null?E=T<=d||T>=m?Oa(Vt(M.c),T):Qn(Vt(M.c),T,"0"):w===10&&G?(M=H(new L(M),f+T+1,h),E=Qn(Vt(M.c),M.e,"0")):(Je(w,2,O.length,"Base"),E=i(Qn(Vt(M.c),T,"0"),10,w,R,!0)),R<0&&M.c[0]&&(E="-"+E)),E},u.valueOf=u.toJSON=function(){return $(this)},u._isBigNumber=!0,u[Symbol.toStringTag]="BigNumber",u[Symbol.for("nodejs.util.inspect.custom")]=u.valueOf,e!=null&&L.set(e),L}function $t(e){var t=e|0;return e>0||e===t?t:t-1}function Vt(e){for(var t,i,s=1,u=e.length,c=e[0]+"";s<u;){for(t=e[s++]+"",i=ke-t.length;i--;t="0"+t);c+=t}for(u=c.length;c.charCodeAt(--u)===48;);return c.slice(0,u+1||1)}function Ur(e,t){var i,s,u=e.c,c=t.c,f=e.s,h=t.s,d=e.e,m=t.e;if(!f||!h)return null;if(i=u&&!u[0],s=c&&!c[0],i||s)return i?s?0:-h:f;if(f!=h)return f;if(i=f<0,s=d==m,!u||!c)return s?0:!u^i?1:-1;if(!s)return d>m^i?1:-1;for(h=(d=u.length)<(m=c.length)?d:m,f=0;f<h;f++)if(u[f]!=c[f])return u[f]>c[f]^i?1:-1;return d==m?0:d>m^i?1:-1}function Je(e,t,i,s){if(e<t||e>i||e!==Xt(e))throw Error(Nt+(s||"Argument")+(typeof e=="number"?e<t||e>i?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function Pa(e){var t=e.c.length-1;return $t(e.e/ke)==t&&e.c[t]%2!=0}function Oa(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function Qn(e,t,i){var s,u;if(t<0){for(u=i+".";++t;u+=i);e=u+e}else if(s=e.length,++t>s){for(u=i,t-=s;--t;u+=i);e+=u}else t<s&&(e=e.slice(0,t)+"."+e.slice(t));return e}var zn=fp(),BE=class{key;left=null;right=null;constructor(e){this.key=e}},vs=class extends BE{constructor(e){super(e)}},UE=class{size=0;modificationCount=0;splayCount=0;splay(e){const t=this.root;if(t==null)return this.compare(e,e),-1;let i=null,s=null,u=null,c=null,f=t;const h=this.compare;let d;for(;;)if(d=h(f.key,e),d>0){let m=f.left;if(m==null||(d=h(m.key,e),d>0&&(f.left=m.right,m.right=f,f=m,m=f.left,m==null)))break;i==null?s=f:i.left=f,i=f,f=m}else if(d<0){let m=f.right;if(m==null||(d=h(m.key,e),d<0&&(f.right=m.left,m.left=f,f=m,m=f.right,m==null)))break;u==null?c=f:u.right=f,u=f,f=m}else break;return u!=null&&(u.right=f.left,f.left=c),i!=null&&(i.left=f.right,f.right=s),this.root!==f&&(this.root=f,this.splayCount++),d}splayMin(e){let t=e,i=t.left;for(;i!=null;){const s=i;t.left=s.right,s.right=t,t=s,i=t.left}return t}splayMax(e){let t=e,i=t.right;for(;i!=null;){const s=i;t.right=s.left,s.left=t,t=s,i=t.right}return t}_delete(e){if(this.root==null||this.splay(e)!=0)return null;let t=this.root;const i=t,s=t.left;if(this.size--,s==null)this.root=t.right;else{const u=t.right;t=this.splayMax(s),t.right=u,this.root=t}return this.modificationCount++,i}addNewRoot(e,t){this.size++,this.modificationCount++;const i=this.root;if(i==null){this.root=e;return}t<0?(e.left=i,e.right=i.right,i.right=null):(e.right=i,e.left=i.left,i.left=null),this.root=e}_first(){const e=this.root;return e==null?null:(this.root=this.splayMin(e),this.root)}_last(){const e=this.root;return e==null?null:(this.root=this.splayMax(e),this.root)}clear(){this.root=null,this.size=0,this.modificationCount++}has(e){return this.validKey(e)&&this.splay(e)==0}defaultCompare(){return(e,t)=>e<t?-1:e>t?1:0}wrap(){return{getRoot:()=>this.root,setRoot:e=>{this.root=e},getSize:()=>this.size,getModificationCount:()=>this.modificationCount,getSplayCount:()=>this.splayCount,setSplayCount:e=>{this.splayCount=e},splay:e=>this.splay(e),has:e=>this.has(e)}}},ao=class Ls extends UE{root=null;compare;validKey;constructor(t,i){super(),this.compare=t??this.defaultCompare(),this.validKey=i??(s=>s!=null&&s!=null)}delete(t){return this.validKey(t)?this._delete(t)!=null:!1}deleteAll(t){for(const i of t)this.delete(i)}forEach(t){const i=this[Symbol.iterator]();let s;for(;s=i.next(),!s.done;)t(s.value,s.value,this)}add(t){const i=this.splay(t);return i!=0&&this.addNewRoot(new vs(t),i),this}addAndReturn(t){const i=this.splay(t);return i!=0&&this.addNewRoot(new vs(t),i),this.root.key}addAll(t){for(const i of t)this.add(i)}isEmpty(){return this.root==null}isNotEmpty(){return this.root!=null}single(){if(this.size==0)throw"Bad state: No element";if(this.size>1)throw"Bad state: Too many element";return this.root.key}first(){if(this.size==0)throw"Bad state: No element";return this._first().key}last(){if(this.size==0)throw"Bad state: No element";return this._last().key}lastBefore(t){if(t==null)throw"Invalid arguments(s)";if(this.root==null)return null;if(this.splay(t)<0)return this.root.key;let i=this.root.left;if(i==null)return null;let s=i.right;for(;s!=null;)i=s,s=i.right;return i.key}firstAfter(t){if(t==null)throw"Invalid arguments(s)";if(this.root==null)return null;if(this.splay(t)>0)return this.root.key;let i=this.root.right;if(i==null)return null;let s=i.left;for(;s!=null;)i=s,s=i.left;return i.key}retainAll(t){const i=new Ls(this.compare,this.validKey),s=this.modificationCount;for(const u of t){if(s!=this.modificationCount)throw"Concurrent modification during iteration.";this.validKey(u)&&this.splay(u)==0&&i.add(this.root.key)}i.size!=this.size&&(this.root=i.root,this.size=i.size,this.modificationCount++)}lookup(t){return!this.validKey(t)||this.splay(t)!=0?null:this.root.key}intersection(t){const i=new Ls(this.compare,this.validKey);for(const s of this)t.has(s)&&i.add(s);return i}difference(t){const i=new Ls(this.compare,this.validKey);for(const s of this)t.has(s)||i.add(s);return i}union(t){const i=this.clone();return i.addAll(t),i}clone(){const t=new Ls(this.compare,this.validKey);return t.size=this.size,t.root=this.copyNode(this.root),t}copyNode(t){if(t==null)return null;function i(u,c){let f,h;do{if(f=u.left,h=u.right,f!=null){const d=new vs(f.key);c.left=d,i(f,d)}if(h!=null){const d=new vs(h.key);c.right=d,u=h,c=d}}while(h!=null)}const s=new vs(t.key);return i(t,s),s}toSet(){return this.clone()}entries(){return new jE(this.wrap())}keys(){return this[Symbol.iterator]()}values(){return this[Symbol.iterator]()}[Symbol.iterator](){return new zE(this.wrap())}[Symbol.toStringTag]="[object Set]"},gp=class{tree;path=new Array;modificationCount=null;splayCount;constructor(e){this.tree=e,this.splayCount=e.getSplayCount()}[Symbol.iterator](){return this}next(){return this.moveNext()?{done:!1,value:this.current()}:{done:!0,value:null}}current(){if(!this.path.length)return null;const e=this.path[this.path.length-1];return this.getValue(e)}rebuildPath(e){this.path.splice(0,this.path.length),this.tree.splay(e),this.path.push(this.tree.getRoot()),this.splayCount=this.tree.getSplayCount()}findLeftMostDescendent(e){for(;e!=null;)this.path.push(e),e=e.left}moveNext(){if(this.modificationCount!=this.tree.getModificationCount()){if(this.modificationCount==null){this.modificationCount=this.tree.getModificationCount();let i=this.tree.getRoot();for(;i!=null;)this.path.push(i),i=i.left;return this.path.length>0}throw"Concurrent modification during iteration."}if(!this.path.length)return!1;this.splayCount!=this.tree.getSplayCount()&&this.rebuildPath(this.path[this.path.length-1].key);let e=this.path[this.path.length-1],t=e.right;if(t!=null){for(;t!=null;)this.path.push(t),t=t.left;return!0}for(this.path.pop();this.path.length&&this.path[this.path.length-1].right===e;)e=this.path.pop();return this.path.length>0}},zE=class extends gp{getValue(e){return e.key}},jE=class extends gp{getValue(e){return[e.key,e.key]}},dp=e=>()=>e,nl=e=>{const t=e?(i,s)=>s.minus(i).abs().isLessThanOrEqualTo(e):dp(!1);return(i,s)=>t(i,s)?0:i.comparedTo(s)};function qE(e){const t=e?(i,s,u,c,f)=>i.exponentiatedBy(2).isLessThanOrEqualTo(c.minus(s).exponentiatedBy(2).plus(f.minus(u).exponentiatedBy(2)).times(e)):dp(!1);return(i,s,u)=>{const c=i.x,f=i.y,h=u.x,d=u.y,m=f.minus(d).times(s.x.minus(h)).minus(c.minus(h).times(s.y.minus(d)));return t(m,c,f,h,d)?0:m.comparedTo(0)}}var YE=e=>e,HE=e=>{if(e){const t=new ao(nl(e)),i=new ao(nl(e)),s=(c,f)=>f.addAndReturn(c),u=c=>({x:s(c.x,t),y:s(c.y,i)});return u({x:new zn(0),y:new zn(0)}),u}return YE},rl=e=>({set:t=>{sr=rl(t)},reset:()=>rl(e),compare:nl(e),snap:HE(e),orient:qE(e)}),sr=rl(),ys=(e,t)=>e.ll.x.isLessThanOrEqualTo(t.x)&&t.x.isLessThanOrEqualTo(e.ur.x)&&e.ll.y.isLessThanOrEqualTo(t.y)&&t.y.isLessThanOrEqualTo(e.ur.y),il=(e,t)=>{if(t.ur.x.isLessThan(e.ll.x)||e.ur.x.isLessThan(t.ll.x)||t.ur.y.isLessThan(e.ll.y)||e.ur.y.isLessThan(t.ll.y))return null;const i=e.ll.x.isLessThan(t.ll.x)?t.ll.x:e.ll.x,s=e.ur.x.isLessThan(t.ur.x)?e.ur.x:t.ur.x,u=e.ll.y.isLessThan(t.ll.y)?t.ll.y:e.ll.y,c=e.ur.y.isLessThan(t.ur.y)?e.ur.y:t.ur.y;return{ll:{x:i,y:u},ur:{x:s,y:c}}},Ya=(e,t)=>e.x.times(t.y).minus(e.y.times(t.x)),pp=(e,t)=>e.x.times(t.x).plus(e.y.times(t.y)),oo=e=>pp(e,e).sqrt(),JE=(e,t,i)=>{const s={x:t.x.minus(e.x),y:t.y.minus(e.y)},u={x:i.x.minus(e.x),y:i.y.minus(e.y)};return Ya(u,s).div(oo(u)).div(oo(s))},VE=(e,t,i)=>{const s={x:t.x.minus(e.x),y:t.y.minus(e.y)},u={x:i.x.minus(e.x),y:i.y.minus(e.y)};return pp(u,s).div(oo(u)).div(oo(s))},Ef=(e,t,i)=>t.y.isZero()?null:{x:e.x.plus(t.x.div(t.y).times(i.minus(e.y))),y:i},bf=(e,t,i)=>t.x.isZero()?null:{x:i,y:e.y.plus(t.y.div(t.x).times(i.minus(e.x)))},XE=(e,t,i,s)=>{if(t.x.isZero())return bf(i,s,e.x);if(s.x.isZero())return bf(e,t,i.x);if(t.y.isZero())return Ef(i,s,e.y);if(s.y.isZero())return Ef(e,t,i.y);const u=Ya(t,s);if(u.isZero())return null;const c={x:i.x.minus(e.x),y:i.y.minus(e.y)},f=Ya(c,t).div(u),h=Ya(c,s).div(u),d=e.x.plus(h.times(t.x)),m=i.x.plus(f.times(s.x)),v=e.y.plus(h.times(t.y)),y=i.y.plus(f.times(s.y));return{x:d.plus(m).div(2),y:v.plus(y).div(2)}},Dn=class mp{point;isLeft;segment;otherSE;consumedBy;static compare(t,i){const s=mp.comparePoints(t.point,i.point);return s!==0?s:(t.point!==i.point&&t.link(i),t.isLeft!==i.isLeft?t.isLeft?1:-1:uo.compare(t.segment,i.segment))}static comparePoints(t,i){return t.x.isLessThan(i.x)?-1:t.x.isGreaterThan(i.x)?1:t.y.isLessThan(i.y)?-1:t.y.isGreaterThan(i.y)?1:0}constructor(t,i){t.events===void 0?t.events=[this]:t.events.push(this),this.point=t,this.isLeft=i}link(t){if(t.point===this.point)throw new Error("Tried to link already linked events");const i=t.point.events;for(let s=0,u=i.length;s<u;s++){const c=i[s];this.point.events.push(c),c.point=this.point}this.checkForConsuming()}checkForConsuming(){const t=this.point.events.length;for(let i=0;i<t;i++){const s=this.point.events[i];if(s.segment.consumedBy===void 0)for(let u=i+1;u<t;u++){const c=this.point.events[u];c.consumedBy===void 0&&s.otherSE.point.events===c.otherSE.point.events&&s.segment.consume(c.segment)}}}getAvailableLinkedEvents(){const t=[];for(let i=0,s=this.point.events.length;i<s;i++){const u=this.point.events[i];u!==this&&!u.segment.ringOut&&u.segment.isInResult()&&t.push(u)}return t}getLeftmostComparator(t){const i=new Map,s=u=>{const c=u.otherSE;i.set(u,{sine:JE(this.point,t.point,c.point),cosine:VE(this.point,t.point,c.point)})};return(u,c)=>{i.has(u)||s(u),i.has(c)||s(c);const{sine:f,cosine:h}=i.get(u),{sine:d,cosine:m}=i.get(c);return f.isGreaterThanOrEqualTo(0)&&d.isGreaterThanOrEqualTo(0)?h.isLessThan(m)?1:h.isGreaterThan(m)?-1:0:f.isLessThan(0)&&d.isLessThan(0)?h.isLessThan(m)?-1:h.isGreaterThan(m)?1:0:d.isLessThan(f)?-1:d.isGreaterThan(f)?1:0}}},$E=class sl{events;poly;_isExteriorRing;_enclosingRing;static factory(t){const i=[];for(let s=0,u=t.length;s<u;s++){const c=t[s];if(!c.isInResult()||c.ringOut)continue;let f=null,h=c.leftSE,d=c.rightSE;const m=[h],v=h.point,y=[];for(;f=h,h=d,m.push(h),h.point!==v;)for(;;){const k=h.getAvailableLinkedEvents();if(k.length===0){const P=m[0].point,O=m[m.length-1].point;throw new Error(`Unable to complete output ring starting at [${P.x}, ${P.y}]. Last matching segment found ends at [${O.x}, ${O.y}].`)}if(k.length===1){d=k[0].otherSE;break}let S=null;for(let P=0,O=y.length;P<O;P++)if(y[P].point===h.point){S=P;break}if(S!==null){const P=y.splice(S)[0],O=m.splice(P.index);O.unshift(O[0].otherSE),i.push(new sl(O.reverse()));continue}y.push({index:m.length,point:h.point});const b=h.getLeftmostComparator(f);d=k.sort(b)[0].otherSE;break}i.push(new sl(m))}return i}constructor(t){this.events=t;for(let i=0,s=t.length;i<s;i++)t[i].segment.ringOut=this;this.poly=null}getGeom(){let t=this.events[0].point;const i=[t];for(let m=1,v=this.events.length-1;m<v;m++){const y=this.events[m].point,k=this.events[m+1].point;sr.orient(y,t,k)!==0&&(i.push(y),t=y)}if(i.length===1)return null;const s=i[0],u=i[1];sr.orient(s,t,u)===0&&i.shift(),i.push(i[0]);const c=this.isExteriorRing()?1:-1,f=this.isExteriorRing()?0:i.length-1,h=this.isExteriorRing()?i.length:-1,d=[];for(let m=f;m!=h;m+=c)d.push([i[m].x.toNumber(),i[m].y.toNumber()]);return d}isExteriorRing(){if(this._isExteriorRing===void 0){const t=this.enclosingRing();this._isExteriorRing=t?!t.isExteriorRing():!0}return this._isExteriorRing}enclosingRing(){return this._enclosingRing===void 0&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}_calcEnclosingRing(){let t=this.events[0];for(let u=1,c=this.events.length;u<c;u++){const f=this.events[u];Dn.compare(t,f)>0&&(t=f)}let i=t.segment.prevInResult(),s=i?i.prevInResult():null;for(;;){if(!i)return null;if(!s)return i.ringOut;if(s.ringOut!==i.ringOut)return s.ringOut?.enclosingRing()!==i.ringOut?i.ringOut:i.ringOut?.enclosingRing();i=s.prevInResult(),s=i?i.prevInResult():null}}},Sf=class{exteriorRing;interiorRings;constructor(e){this.exteriorRing=e,e.poly=this,this.interiorRings=[]}addInterior(e){this.interiorRings.push(e),e.poly=this}getGeom(){const e=this.exteriorRing.getGeom();if(e===null)return null;const t=[e];for(let i=0,s=this.interiorRings.length;i<s;i++){const u=this.interiorRings[i].getGeom();u!==null&&t.push(u)}return t}},ZE=class{rings;polys;constructor(e){this.rings=e,this.polys=this._composePolys(e)}getGeom(){const e=[];for(let t=0,i=this.polys.length;t<i;t++){const s=this.polys[t].getGeom();s!==null&&e.push(s)}return e}_composePolys(e){const t=[];for(let i=0,s=e.length;i<s;i++){const u=e[i];if(!u.poly)if(u.isExteriorRing())t.push(new Sf(u));else{const c=u.enclosingRing();c?.poly||t.push(new Sf(c)),c?.poly?.addInterior(u)}}return t}},WE=class{queue;tree;segments;constructor(e,t=uo.compare){this.queue=e,this.tree=new ao(t),this.segments=[]}process(e){const t=e.segment,i=[];if(e.consumedBy)return e.isLeft?this.queue.delete(e.otherSE):this.tree.delete(t),i;e.isLeft&&this.tree.add(t);let s=t,u=t;do s=this.tree.lastBefore(s);while(s!=null&&s.consumedBy!=null);do u=this.tree.firstAfter(u);while(u!=null&&u.consumedBy!=null);if(e.isLeft){let c=null;if(s){const h=s.getIntersection(t);if(h!==null&&(t.isAnEndpoint(h)||(c=h),!s.isAnEndpoint(h))){const d=this._splitSafely(s,h);for(let m=0,v=d.length;m<v;m++)i.push(d[m])}}let f=null;if(u){const h=u.getIntersection(t);if(h!==null&&(t.isAnEndpoint(h)||(f=h),!u.isAnEndpoint(h))){const d=this._splitSafely(u,h);for(let m=0,v=d.length;m<v;m++)i.push(d[m])}}if(c!==null||f!==null){let h=null;c===null?h=f:f===null?h=c:h=Dn.comparePoints(c,f)<=0?c:f,this.queue.delete(t.rightSE),i.push(t.rightSE);const d=t.split(h);for(let m=0,v=d.length;m<v;m++)i.push(d[m])}i.length>0?(this.tree.delete(t),i.push(e)):(this.segments.push(t),t.prev=s)}else{if(s&&u){const c=s.getIntersection(u);if(c!==null){if(!s.isAnEndpoint(c)){const f=this._splitSafely(s,c);for(let h=0,d=f.length;h<d;h++)i.push(f[h])}if(!u.isAnEndpoint(c)){const f=this._splitSafely(u,c);for(let h=0,d=f.length;h<d;h++)i.push(f[h])}}}this.tree.delete(t)}return i}_splitSafely(e,t){this.tree.delete(e);const i=e.rightSE;this.queue.delete(i);const s=e.split(t);return s.push(i),e.consumedBy===void 0&&this.tree.add(e),s}},KE=class{type;numMultiPolys;run(e,t,i){Cs.type=e;const s=[new Mf(t,!0)];for(let h=0,d=i.length;h<d;h++)s.push(new Mf(i[h],!1));if(Cs.numMultiPolys=s.length,Cs.type==="difference"){const h=s[0];let d=1;for(;d<s.length;)il(s[d].bbox,h.bbox)!==null?d++:s.splice(d,1)}if(Cs.type==="intersection")for(let h=0,d=s.length;h<d;h++){const m=s[h];for(let v=h+1,y=s.length;v<y;v++)if(il(m.bbox,s[v].bbox)===null)return[]}const u=new ao(Dn.compare);for(let h=0,d=s.length;h<d;h++){const m=s[h].getSweepEvents();for(let v=0,y=m.length;v<y;v++)u.add(m[v])}const c=new WE(u);let f=null;for(u.size!=0&&(f=u.first(),u.delete(f));f;){const h=c.process(f);for(let d=0,m=h.length;d<m;d++){const v=h[d];v.consumedBy===void 0&&u.add(v)}u.size!=0?(f=u.first(),u.delete(f)):f=null}return sr.reset(),new ZE($E.factory(c.segments)).getGeom()}},Cs=new KE,al=Cs,QE=0,uo=class Ha{id;leftSE;rightSE;rings;windings;ringOut;consumedBy;prev;_prevInResult;_beforeState;_afterState;_isInResult;static compare(t,i){const s=t.leftSE.point.x,u=i.leftSE.point.x,c=t.rightSE.point.x,f=i.rightSE.point.x;if(f.isLessThan(s))return 1;if(c.isLessThan(u))return-1;const h=t.leftSE.point.y,d=i.leftSE.point.y,m=t.rightSE.point.y,v=i.rightSE.point.y;if(s.isLessThan(u)){if(d.isLessThan(h)&&d.isLessThan(m))return 1;if(d.isGreaterThan(h)&&d.isGreaterThan(m))return-1;const y=t.comparePoint(i.leftSE.point);if(y<0)return 1;if(y>0)return-1;const k=i.comparePoint(t.rightSE.point);return k!==0?k:-1}if(s.isGreaterThan(u)){if(h.isLessThan(d)&&h.isLessThan(v))return-1;if(h.isGreaterThan(d)&&h.isGreaterThan(v))return 1;const y=i.comparePoint(t.leftSE.point);if(y!==0)return y;const k=t.comparePoint(i.rightSE.point);return k<0?1:k>0?-1:1}if(h.isLessThan(d))return-1;if(h.isGreaterThan(d))return 1;if(c.isLessThan(f)){const y=i.comparePoint(t.rightSE.point);if(y!==0)return y}if(c.isGreaterThan(f)){const y=t.comparePoint(i.rightSE.point);if(y<0)return 1;if(y>0)return-1}if(!c.eq(f)){const y=m.minus(h),k=c.minus(s),S=v.minus(d),b=f.minus(u);if(y.isGreaterThan(k)&&S.isLessThan(b))return 1;if(y.isLessThan(k)&&S.isGreaterThan(b))return-1}return c.isGreaterThan(f)?1:c.isLessThan(f)||m.isLessThan(v)?-1:m.isGreaterThan(v)?1:t.id<i.id?-1:t.id>i.id?1:0}constructor(t,i,s,u){this.id=++QE,this.leftSE=t,t.segment=this,t.otherSE=i,this.rightSE=i,i.segment=this,i.otherSE=t,this.rings=s,this.windings=u}static fromRing(t,i,s){let u,c,f;const h=Dn.comparePoints(t,i);if(h<0)u=t,c=i,f=1;else if(h>0)u=i,c=t,f=-1;else throw new Error(`Tried to create degenerate segment at [${t.x}, ${t.y}]`);return new Ha(new Dn(u,!0),new Dn(c,!1),[s],[f])}replaceRightSE(t){this.rightSE=t,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}bbox(){const t=this.leftSE.point.y,i=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:t.isLessThan(i)?t:i},ur:{x:this.rightSE.point.x,y:t.isGreaterThan(i)?t:i}}}vector(){return{x:this.rightSE.point.x.minus(this.leftSE.point.x),y:this.rightSE.point.y.minus(this.leftSE.point.y)}}isAnEndpoint(t){return t.x.eq(this.leftSE.point.x)&&t.y.eq(this.leftSE.point.y)||t.x.eq(this.rightSE.point.x)&&t.y.eq(this.rightSE.point.y)}comparePoint(t){return sr.orient(this.leftSE.point,t,this.rightSE.point)}getIntersection(t){const i=this.bbox(),s=t.bbox(),u=il(i,s);if(u===null)return null;const c=this.leftSE.point,f=this.rightSE.point,h=t.leftSE.point,d=t.rightSE.point,m=ys(i,h)&&this.comparePoint(h)===0,v=ys(s,c)&&t.comparePoint(c)===0,y=ys(i,d)&&this.comparePoint(d)===0,k=ys(s,f)&&t.comparePoint(f)===0;if(v&&m)return k&&!y?f:!k&&y?d:null;if(v)return y&&c.x.eq(d.x)&&c.y.eq(d.y)?null:c;if(m)return k&&f.x.eq(h.x)&&f.y.eq(h.y)?null:h;if(k&&y)return null;if(k)return f;if(y)return d;const S=XE(c,this.vector(),h,t.vector());return S===null||!ys(u,S)?null:sr.snap(S)}split(t){const i=[],s=t.events!==void 0,u=new Dn(t,!0),c=new Dn(t,!1),f=this.rightSE;this.replaceRightSE(c),i.push(c),i.push(u);const h=new Ha(u,f,this.rings.slice(),this.windings.slice());return Dn.comparePoints(h.leftSE.point,h.rightSE.point)>0&&h.swapEvents(),Dn.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),s&&(u.checkForConsuming(),c.checkForConsuming()),i}swapEvents(){const t=this.rightSE;this.rightSE=this.leftSE,this.leftSE=t,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(let i=0,s=this.windings.length;i<s;i++)this.windings[i]*=-1}consume(t){let i=this,s=t;for(;i.consumedBy;)i=i.consumedBy;for(;s.consumedBy;)s=s.consumedBy;const u=Ha.compare(i,s);if(u!==0){if(u>0){const c=i;i=s,s=c}if(i.prev===s){const c=i;i=s,s=c}for(let c=0,f=s.rings.length;c<f;c++){const h=s.rings[c],d=s.windings[c],m=i.rings.indexOf(h);m===-1?(i.rings.push(h),i.windings.push(d)):i.windings[m]+=d}s.rings=null,s.windings=null,s.consumedBy=i,s.leftSE.consumedBy=i.leftSE,s.rightSE.consumedBy=i.rightSE}}prevInResult(){return this._prevInResult!==void 0?this._prevInResult:(this.prev?this.prev.isInResult()?this._prevInResult=this.prev:this._prevInResult=this.prev.prevInResult():this._prevInResult=null,this._prevInResult)}beforeState(){if(this._beforeState!==void 0)return this._beforeState;if(!this.prev)this._beforeState={rings:[],windings:[],multiPolys:[]};else{const t=this.prev.consumedBy||this.prev;this._beforeState=t.afterState()}return this._beforeState}afterState(){if(this._afterState!==void 0)return this._afterState;const t=this.beforeState();this._afterState={rings:t.rings.slice(0),windings:t.windings.slice(0),multiPolys:[]};const i=this._afterState.rings,s=this._afterState.windings,u=this._afterState.multiPolys;for(let h=0,d=this.rings.length;h<d;h++){const m=this.rings[h],v=this.windings[h],y=i.indexOf(m);y===-1?(i.push(m),s.push(v)):s[y]+=v}const c=[],f=[];for(let h=0,d=i.length;h<d;h++){if(s[h]===0)continue;const m=i[h],v=m.poly;if(f.indexOf(v)===-1)if(m.isExterior)c.push(v);else{f.indexOf(v)===-1&&f.push(v);const y=c.indexOf(m.poly);y!==-1&&c.splice(y,1)}}for(let h=0,d=c.length;h<d;h++){const m=c[h].multiPoly;u.indexOf(m)===-1&&u.push(m)}return this._afterState}isInResult(){if(this.consumedBy)return!1;if(this._isInResult!==void 0)return this._isInResult;const t=this.beforeState().multiPolys,i=this.afterState().multiPolys;switch(al.type){case"union":{const s=t.length===0,u=i.length===0;this._isInResult=s!==u;break}case"intersection":{let s,u;t.length<i.length?(s=t.length,u=i.length):(s=i.length,u=t.length),this._isInResult=u===al.numMultiPolys&&s<u;break}case"xor":{const s=Math.abs(t.length-i.length);this._isInResult=s%2===1;break}case"difference":{const s=u=>u.length===1&&u[0].isSubject;this._isInResult=s(t)!==s(i);break}}return this._isInResult}},If=class{poly;isExterior;segments;bbox;constructor(e,t,i){if(!Array.isArray(e)||e.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=t,this.isExterior=i,this.segments=[],typeof e[0][0]!="number"||typeof e[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");const s=sr.snap({x:new zn(e[0][0]),y:new zn(e[0][1])});this.bbox={ll:{x:s.x,y:s.y},ur:{x:s.x,y:s.y}};let u=s;for(let c=1,f=e.length;c<f;c++){if(typeof e[c][0]!="number"||typeof e[c][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");const h=sr.snap({x:new zn(e[c][0]),y:new zn(e[c][1])});h.x.eq(u.x)&&h.y.eq(u.y)||(this.segments.push(uo.fromRing(u,h,this)),h.x.isLessThan(this.bbox.ll.x)&&(this.bbox.ll.x=h.x),h.y.isLessThan(this.bbox.ll.y)&&(this.bbox.ll.y=h.y),h.x.isGreaterThan(this.bbox.ur.x)&&(this.bbox.ur.x=h.x),h.y.isGreaterThan(this.bbox.ur.y)&&(this.bbox.ur.y=h.y),u=h)}(!s.x.eq(u.x)||!s.y.eq(u.y))&&this.segments.push(uo.fromRing(u,s,this))}getSweepEvents(){const e=[];for(let t=0,i=this.segments.length;t<i;t++){const s=this.segments[t];e.push(s.leftSE),e.push(s.rightSE)}return e}},eb=class{multiPoly;exteriorRing;interiorRings;bbox;constructor(e,t){if(!Array.isArray(e))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new If(e[0],this,!0),this.bbox={ll:{x:this.exteriorRing.bbox.ll.x,y:this.exteriorRing.bbox.ll.y},ur:{x:this.exteriorRing.bbox.ur.x,y:this.exteriorRing.bbox.ur.y}},this.interiorRings=[];for(let i=1,s=e.length;i<s;i++){const u=new If(e[i],this,!1);u.bbox.ll.x.isLessThan(this.bbox.ll.x)&&(this.bbox.ll.x=u.bbox.ll.x),u.bbox.ll.y.isLessThan(this.bbox.ll.y)&&(this.bbox.ll.y=u.bbox.ll.y),u.bbox.ur.x.isGreaterThan(this.bbox.ur.x)&&(this.bbox.ur.x=u.bbox.ur.x),u.bbox.ur.y.isGreaterThan(this.bbox.ur.y)&&(this.bbox.ur.y=u.bbox.ur.y),this.interiorRings.push(u)}this.multiPoly=t}getSweepEvents(){const e=this.exteriorRing.getSweepEvents();for(let t=0,i=this.interiorRings.length;t<i;t++){const s=this.interiorRings[t].getSweepEvents();for(let u=0,c=s.length;u<c;u++)e.push(s[u])}return e}},Mf=class{isSubject;polys;bbox;constructor(e,t){if(!Array.isArray(e))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{typeof e[0][0][0]=="number"&&(e=[e])}catch{}this.polys=[],this.bbox={ll:{x:new zn(Number.POSITIVE_INFINITY),y:new zn(Number.POSITIVE_INFINITY)},ur:{x:new zn(Number.NEGATIVE_INFINITY),y:new zn(Number.NEGATIVE_INFINITY)}};for(let i=0,s=e.length;i<s;i++){const u=new eb(e[i],this);u.bbox.ll.x.isLessThan(this.bbox.ll.x)&&(this.bbox.ll.x=u.bbox.ll.x),u.bbox.ll.y.isLessThan(this.bbox.ll.y)&&(this.bbox.ll.y=u.bbox.ll.y),u.bbox.ur.x.isGreaterThan(this.bbox.ur.x)&&(this.bbox.ur.x=u.bbox.ur.x),u.bbox.ur.y.isGreaterThan(this.bbox.ur.y)&&(this.bbox.ur.y=u.bbox.ur.y),this.polys.push(u)}this.isSubject=t}getSweepEvents(){const e=[];for(let t=0,i=this.polys.length;t<i;t++){const s=this.polys[t].getSweepEvents();for(let u=0,c=s.length;u<c;u++)e.push(s[u])}return e}};var tb=(e,...t)=>al.run("difference",e,t);sr.set;function nb(e){const t=[];if(si(e,u=>{t.push(u.coordinates)}),t.length<2)throw new Error("Must have at least two features");const i=e.features[0].properties||{},s=tb(t[0],...t.slice(1));return s.length===0?null:s.length===1?kr(s[0],i):Nd(s,i)}var rb=nb;function gu(e){var t;if(e.bbox)t=e.bbox;else if(Array.isArray(e)&&e.length===4)t=e;else if(Array.isArray(e)&&e.length===6)t=[e[0],e[1],e[3],e[4]];else if(e.type==="Feature")t=tr(e);else if(e.type==="FeatureCollection")t=tr(e);else throw new Error("invalid geojson");return{minX:t[0],minY:t[1],maxX:t[2],maxY:t[3]}}var ib=class{constructor(e=9){this.tree=new Zl(e),this.tree.toBBox=gu}insert(e){if(e.type!=="Feature")throw new Error("invalid feature");return e.bbox=e.bbox?e.bbox:tr(e),this.tree.insert(e),this}load(e){var t=[];return Array.isArray(e)?e.forEach(function(i){if(i.type!=="Feature")throw new Error("invalid features");i.bbox=i.bbox?i.bbox:tr(i),t.push(i)}):Hn(e,function(i){if(i.type!=="Feature")throw new Error("invalid features");i.bbox=i.bbox?i.bbox:tr(i),t.push(i)}),this.tree.load(t),this}remove(e,t){if(e.type!=="Feature")throw new Error("invalid feature");return e.bbox=e.bbox?e.bbox:tr(e),this.tree.remove(e,t),this}clear(){return this.tree.clear(),this}search(e){return et(this.tree.search(gu(e)))}collides(e){return this.tree.collides(gu(e))}all(){return et(this.tree.all())}toJSON(){return this.tree.toJSON()}fromJSON(e){return this.tree.fromJSON(e),this}};function vp(e){return new ib(e)}function sb(e,t){if(t=t??{},!Eo(t))throw new Error("options is invalid");var i=t.precision,s=t.coordinates,u=t.mutate;if(i=i==null||isNaN(i)?6:i,s=s==null||isNaN(s)?3:s,!e)throw new Error("<geojson> is required");if(typeof i!="number")throw new Error("<precision> must be a number");if(typeof s!="number")throw new Error("<coordinates> must be a number");(u===!1||u===void 0)&&(e=JSON.parse(JSON.stringify(e)));var c=Math.pow(10,i);return br(e,function(f){ab(f,c,s)}),e}function ab(e,t,i){e.length>i&&e.splice(i,e.length);for(var s=0;s<e.length;s++)e[s]=Math.round(e[s]*t)/t;return e}function ob(e){if(!e)throw new Error("geojson is required");const t=[];return Er(e,i=>{ub(i,t)}),et(t)}function ub(e,t){let i=[];const s=e.geometry;if(s!==null){switch(s.type){case"Polygon":i=Ft(s);break;case"LineString":i=[Ft(s)]}i.forEach(u=>{lb(u,e.properties).forEach(c=>{c.id=t.length,t.push(c)})})}}function lb(e,t){const i=[];return e.reduce((s,u)=>{const c=xr([s,u],t);return c.bbox=cb(s,u),i.push(c),u}),i}function cb(e,t){const i=e[0],s=e[1],u=t[0],c=t[1];return[i<u?i:u,s<c?s:c,i>u?i:u,s>c?s:c]}var hb=Object.defineProperty,fb=Object.defineProperties,gb=Object.getOwnPropertyDescriptors,Nf=Object.getOwnPropertySymbols,db=Object.prototype.hasOwnProperty,pb=Object.prototype.propertyIsEnumerable,Lf=(e,t,i)=>t in e?hb(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,mb=(e,t)=>{for(var i in t||(t={}))db.call(t,i)&&Lf(e,i,t[i]);if(Nf)for(var i of Nf(t))pb.call(t,i)&&Lf(e,i,t[i]);return e},vb=(e,t)=>fb(e,gb(t));function yb(e,t,i={}){if(!e||!t)throw new Error("lines and inputPoint are required arguments");const s=Qe(t);let u=Dt([1/0,1/0],{lineStringIndex:-1,segmentIndex:-1,totalDistance:-1,lineDistance:-1,segmentDistance:-1,pointDistance:1/0,multiFeatureIndex:-1,index:-1,location:-1,dist:1/0}),c=0,f=0,h=-1;return Er(e,function(d,m,v){h!==v&&(h=v,f=0);const y=Ft(d);for(let k=0;k<y.length-1;k++){const S=Dt(y[k]),b=Qe(S),P=Dt(y[k+1]),O=Qe(P),G=Ti(S,P,i);let L,j;O[0]===s[0]&&O[1]===s[1]?[L,j]=[O,!0]:b[0]===s[0]&&b[1]===s[1]?[L,j]=[b,!1]:[L,j]=kb(b,O,s);const V=Ti(t,L,i);if(V<u.properties.pointDistance){const X=Ti(S,L,i);u=Dt(L,{lineStringIndex:v,segmentIndex:j?k+1:k,totalDistance:c+X,lineDistance:f+X,segmentDistance:X,pointDistance:V,multiFeatureIndex:-1,index:-1,location:-1,dist:1/0}),u.properties=vb(mb({},u.properties),{multiFeatureIndex:u.properties.lineStringIndex,index:u.properties.segmentIndex,location:u.properties.totalDistance,dist:u.properties.pointDistance})}c+=G,f+=G}}),u}function zr(e,t){const[i,s,u]=e,[c,f,h]=t;return i*c+s*f+u*h}function _s(e,t){const[i,s,u]=e,[c,f,h]=t;return[s*h-u*f,u*c-i*h,i*f-s*c]}function _b(e){return Math.sqrt(Math.pow(e[0],2)+Math.pow(e[1],2)+Math.pow(e[2],2))}function Cf(e){const t=_b(e);return[e[0]/t,e[1]/t,e[2]/t]}function du(e){const t=ot(e[1]),i=ot(e[0]);return[Math.cos(t)*Math.cos(i),Math.cos(t)*Math.sin(i),Math.sin(t)]}function wb(e){const[t,i,s]=e,u=Qr(Math.asin(Math.min(Math.max(s,-1),1)));return[Qr(Math.atan2(i,t)),u]}function kb(e,t,i){const s=du(e),u=du(t),c=du(i),f=_s(s,u);if(f[0]===0&&f[1]===0&&f[2]===0)return zr(s,u)>0?[[...t],!0]:[[...i],!1];const h=_s(f,c);if(h[0]===0&&h[1]===0&&h[2]===0)return[[...t],!0];const d=Cf(_s(h,f)),m=[-d[0],-d[1],-d[2]],v=zr(c,d)>zr(c,m)?d:m,y=Cf(f),k=zr(_s(s,v),y),S=zr(_s(v,u),y);return k>=0&&S>=0?[wb(v),!1]:zr(s,c)>zr(u,c)?[[...e],!1]:[[...t],!0]}function xb(e,t){if(!e)throw new Error("line is required");if(!t)throw new Error("splitter is required");const i=Gh(e),s=Gh(t);if(i!=="LineString")throw new Error("line must be LineString");if(s==="FeatureCollection")throw new Error("splitter cannot be a FeatureCollection");if(s==="GeometryCollection")throw new Error("splitter cannot be a GeometryCollection");var u=sb(t,{precision:7});switch(e.type!=="Feature"&&(e=ln(e)),s){case"Point":return ol(e,u);case"MultiPoint":return Af(e,u);case"LineString":case"MultiLineString":case"Polygon":case"MultiPolygon":return Af(e,oa(e,u,{ignoreSelfIntersections:!0}))}}function Af(e,t){var i=[],s=vp();return Er(t,function(u){if(i.forEach(function(h,d){h.id=d}),!i.length)i=ol(e,u).features,s.load(et(i));else{var c=s.search(u);if(c.features.length){var f=yp(u,c);i=i.filter(function(h){return h.id!==f.id}),s.remove(f),Hn(ol(f,u),function(h){i.push(h),s.insert(h)})}}}),et(i)}function ol(e,t){var i=[],s=Ft(e)[0],u=Ft(e)[e.geometry.coordinates.length-1];if(pu(s,Qe(t))||pu(u,Qe(t)))return et([e]);var c=vp(),f=ob(e);c.load(f);var h=c.search(t);if(!h.features.length)return et([e]);var d=yp(t,h),m=d2(f,function(v,y,k){var S=Ft(y)[1],b=Qe(t);return k===d.id?(v.push(b),i.push(xr(v)),pu(b,S)?[b]:[b,S]):(v.push(S),v)},[s]);return m.length>1&&i.push(xr(m)),et(i)}function yp(e,t){if(!t.features.length)throw new Error("lines must contain features");if(t.features.length===1)return t.features[0];var i,s=1/0;return Hn(t,function(u){var c=yb(u,e).properties.dist;c<s&&(i=u,s=c)}),i}function pu(e,t){return e[0]===t[0]&&e[1]===t[1]}var Tf=xb,Eb=class extends aa{mode="cut";lineDrawer=new $l(this.gm,{snappingMarkers:"first",targetShape:"polygon"});cutShapesAllowed=["circle","ellipse","line","rectangle","polygon"];eventHandlers={[`${se}:draw`]:this.forwardLineDrawerEvent.bind(this),mousemove:this.onMouseMove.bind(this)};async onStartAction(){await this.lineDrawer.startAction(),this.lineDrawer.on("firstMarkerClick",this.cutPolygonFinished.bind(this))}async onEndAction(){await this.lineDrawer.endAction()}async onMouseMove(e){return He(e)?(this.lineDrawer.featureData||await this.fireMarkerPointerUpdateEvent(),{next:!0}):{next:!0}}async cutPolygonFinished(e){await this.lineDrawer.endShape();const t=Xl(e.geoJson),i=this.getBBoxFeaturesByPolygon(t);await this.cutFeaturesByPolygon(i,t)}getBBoxFeaturesByPolygon(e){const t=ql(e),i=this.gm.mapAdapter.coordBoundsToScreenBounds(t);return this.gm.mapAdapter.queryFeaturesByScreenCoordinates({queryCoordinates:i,sourceNames:[Z.main]})}async cutFeaturesByPolygon(e,t){for(const i of e)if(i.getShapeProperty("disableEdit")!==!0){if(Ta(i.getGeoJson(),t)){await this.gm.features.delete(i),await this.fireFeatureRemovedEvent(i);continue}if(FE(i.getGeoJson(),t)&&this.cutShapesAllowed.includes(i.shape)){if(i.shape==="line"){await this.cutLineFeatureByPolygon(i,t);continue}await this.cutPolygonFeatureByPolygon(i.id,t)}}}async cutLineFeatureByPolygon(e,t){const i=e.getGeoJson(),s=EE(this.gm.mapAdapter,t);let u=!1,c=[];if(s){if(i.geometry.type==="MultiLineString")i.geometry.coordinates.forEach(f=>{if(Ta(xr(f),t))return;const h=Tf(xr(f),t);if(h.features.length===0){c.push(f);return}h.features.filter(d=>!Ta(d,s)).forEach(d=>{u=!0,c.push(d.geometry.coordinates)})});else if(i.geometry.type==="LineString"){const f=Tf(i,t);c=f.features.filter(h=>!Ta(h,s)&&h.geometry.type==="LineString").map(h=>h.geometry.coordinates),f.features.length>0&&(u=!0)}u&&c.length&&(c.length===1?await e.updateGeometry({type:"LineString",coordinates:c[0]}):await e.updateGeometry({type:"MultiLineString",coordinates:c}),await this.fireFeatureUpdatedEvent({sourceFeatures:[e],targetFeatures:[e]}))}}async cutPolygonFeatureByPolygon(e,t){const i=this.gm.features.get(Z.main,e);if(!i){ee.warn("cutPolygonFeatureByPolygon: featureData not found",e);return}await i.convertToPolygon();const s=i.getGeoJson(),u=this.getGeoJsonDifference(s,t);u&&(await i.updateGeometry(u.geometry),await this.fireFeatureUpdatedEvent({sourceFeatures:[i],targetFeatures:[i]}))}getGeoJsonDifference(e,t){const i=rb(et([e,t]));return i?i.type==="Feature"?i:(i.type==="FeatureCollection"&&ee.error("getGeoJsonDifference: FeatureCollection detected (not supported)",i),null):null}},bb=class extends aa{mode="delete";allowedShapes=[...Fn];eventHandlers={click:this.onMouseClick.bind(this)};onStartAction(){this.gm.markerPointer.enable({invisibleMarker:!0}),this.gm.markerPointer.pauseSnapping()}onEndAction(){this.gm.markerPointer.resumeSnapping(),this.gm.markerPointer.disable()}async onMouseClick(e){if(!He(e,{warning:!0}))return{next:!1};const t=this.getFeatureByMouseEvent({event:e,sourceNames:[Z.main]});if(t&&this.allowedShapes.includes(t.shape)){this.gm.features.selection.has(t.id)||this.gm.features.setSelection([t.id]);const i=this.gm.features.getLinkedFeatures(t);if(i.some(s=>s.getShapeProperty("disableEdit")===!0))return{next:!1};this.gm.features.setSelection([],!0);for(const s of[t,...i])await this.gm.features.delete(s),await this.fireFeatureRemovedEvent(s)}return{next:!1}}},Sb=class extends Kl{mode="drag";onStartAction(){}onEndAction(){}async handleGmEdit(e){if(!Ki(e))return ee.error("EditDrag.handleGmEdit: not an edit event",e),{next:!0};if(e.action==="marker_move"&&e.lngLatStart&&e.lngLatEnd){const t=So(e.lngLatStart,e.lngLatEnd);for(const i of e.linkedFeatures??[])await this.moveFeature(i,t);return await this.moveFeature(e.featureData,t)&&(this.previousLngLat=e.lngLatEnd),{next:!1}}else if(e.action==="marker_captured"){this.gm.features.updateManager.beginTransaction("transactional-update");for(const t of[e.featureData,...e.linkedFeatures??[]])await t.changeSource({sourceName:Z.temporary}),await this.fireFeatureEditStartEvent({feature:t});this.gm.features.updateManager.commitTransaction(),this.flags.actionInProgress=!0,this.setCursorToPointer()}else if(e.action==="marker_released"){this.previousLngLat=null,this.gm.features.updateManager.beginTransaction("transactional-update");for(const t of[e.featureData,...e.linkedFeatures??[]])await t.changeSource({sourceName:Z.main}),await this.fireFeatureEditEndEvent({feature:t});this.gm.features.updateManager.commitTransaction(),this.flags.actionInProgress=!1}return{next:!0}}},Ib=class extends Kl{mode="rotate";allowedShapes=["line","rectangle","polygon","ellipse","circle"];convertFeaturesTypes=["rectangle"];shapeRotateHandlers={marker:this.rotateFeature.bind(this),circle:this.rotateCircle.bind(this),circle_marker:this.rotateFeature.bind(this),text_marker:this.rotateFeature.bind(this),line:this.rotateFeature.bind(this),rectangle:this.rotateFeature.bind(this),polygon:this.rotateFeature.bind(this),ellipse:this.rotateEllipse.bind(this)};onStartAction(){this.bodyDragEnabled=this.getSettingValue("bodyDragEnabled")===!0}onEndAction(){}async handleGmEdit(e){if(!Ki(e))return ee.error("EditChange.handleGmEdit: not an edit event",e),{next:!1};if(this.isFeatureAllowed(e))return{next:!0};if(e.action==="marker_move"&&e.lngLatStart&&e.lngLatEnd){if(e.markerData?.type==="vertex")await this.moveVertex(e);else{const t=So(e.lngLatStart,e.lngLatEnd);this.moveSource(e.featureData,t)}return{next:!1}}else if(e.action==="marker_captured"){this.gm.features.updateManager.beginTransaction("transactional-update");for(const t of[e.featureData,...e.linkedFeatures??[]])await t.changeSource({sourceName:Z.temporary}),await this.fireFeatureEditStartEvent({feature:t});this.gm.features.updateManager.commitTransaction(),this.setCursorToPointer(),this.flags.actionInProgress=!0}else if(e.action==="marker_released"){this.flags.actionInProgress=!1,this.gm.features.updateManager.beginTransaction("transactional-update");for(const t of[e.featureData,...e.linkedFeatures??[]])await t.changeSource({sourceName:Z.main}),await this.fireFeatureEditEndEvent({feature:t});this.gm.features.updateManager.commitTransaction()}return{next:!0}}isFeatureAllowed(e){return"featureData"in e&&!this.allowedShapes.includes(e.featureData.shape)}async moveVertex(e){const t=Hu(zu(et([e.featureData.getGeoJson(),...(e.linkedFeatures??[]).map(i=>i.getGeoJson())])));for(const i of[e.featureData,...e.linkedFeatures??[]]){const s=this.shapeRotateHandlers[i.shape]?.(i,t,e)||null;s?(await this.fireBeforeFeatureUpdate({features:[i],geoJsonFeatures:[s]}),await this.updateFeatureGeoJson({featureData:i,featureGeoJson:s})&&this.convertFeaturesTypes.includes(i.shape)&&await i.convertToPolygon()):ee.error("EditRotate.moveVertex: invalid geojson",s,e)}}rotateCircle(e,t,i){if(e.shape!=="circle")return ee.error("EditRotate.rotateCircle: invalid shape type",e),null;const s=e.getShapeProperty("center");if(!Array.isArray(s))return ee.error("rotateCircle: missing center in the featureData",e),null;if(qu(t,s))return e.getGeoJson();const u=this.calculateRotationAngle(t,i.lngLatStart,i.lngLatEnd,!1),c=Hl(e.getGeoJson());if(!c)return ee.error("rotateCircle: missing center circleRimLngLat"),null;const f=tu(Dt(s),u,{pivot:t}).geometry.coordinates;return Mo({center:f,radius:this.gm.mapAdapter.getDistance(s,c)})}rotateEllipse(e,t,i){if(e.shape!=="ellipse")return ee.error("EditRotate.rotateEllipse: invalid shape type",e),null;const s=e.getShapeProperty("center"),u=e.getShapeProperty("xSemiAxis"),c=e.getShapeProperty("ySemiAxis"),f=e.getShapeProperty("angle");if(!Array.isArray(s)||typeof u!="number"||typeof c!="number"||typeof f!="number")return ee.error("rotateEllipse: missing center, xSemiAxis, ySemiAxis or angle in the featureData",e),null;const h=this.calculateRotationAngle(t,i.lngLatStart,i.lngLatEnd,!1),d=tu(Dt(s),h,{pivot:t}).geometry.coordinates;return No({center:d,xSemiAxis:u,ySemiAxis:c,angle:f+h})}rotateFeature(e,t,i){const s=Bt(e.getGeoJson());return s.geometry=tu(s,this.calculateRotationAngle(t,i.lngLatStart,i.lngLatEnd),{pivot:t}).geometry,s}calculateRotationAngle(e,t,i,s=!0){const u=Qa(e,t),c=Qa(e,i)-u;return s?(c+360)%360:c}},ul={drag:Sb,change:LE,rotate:Ib,scale:null,copy:null,cut:Eb,split:null,union:null,difference:null,line_simplification:null,lasso:null,delete:bb},Mb=(e,t)=>ul[t]?new ul[t](e):(ee.error(`Edit "${t}" is not available`),null),Nb=class extends xo{eventHandlers={[`${se}:edit`]:this.handleEditEvent.bind(this)};constructor(e,t){super(e),t.attachEvents(this.eventHandlers)}async handleEditEvent(e){if(!Ki(e)||!e.mode)return{next:!0};const t=`${e.actionType}__${e.mode}`;return e.action==="mode_start"?(await this.trackExclusiveModes(e),await this.start(t,e),await this.trackRelatedModes(e)):e.action==="mode_end"&&(await this.trackRelatedModes(e),await this.end(t)),{next:!0}}async start(e,t){if(t.action!=="mode_start")return;const i=Mb(this.gm,t.mode);if(!i)return;const s=this.getControlOptions(t);s?.settings&&(i.settings=s.settings),e in this.gm.actionInstances&&ee.error(`Action instance "${e}" already exists`),this.gm.actionInstances[e]=i,await i.startAction()}async end(e){const t=this.gm.actionInstances[e];t instanceof aa?(await t.endAction(),delete this.gm.actionInstances[e]):console.error(`Wrong action instance for edit event "${e}": `,t)}},Lb=class extends Sr{mode="shape_markers";pinEnabled=this.gm.options.controls.helper.pin?.active||!1;previousPosition=null;activeMarker=null;activeFeatureData=null;initialPoint=null;linkedFeatures=[];sharedMarkers=[];allowedShapes=["circle","line","rectangle","polygon","ellipse"];edgeMarkersAllowed=!1;edgeMarkerAllowedShapes=["line","rectangle","polygon"];shapeMarkerAllowedModes=["drag","change","cut","split"];eventHandlers={[`${se}:draw`]:this.handleGmDraw.bind(this),[`${se}:edit`]:this.handleGmEdit.bind(this),mousedown:this.onMouseDown.bind(this),touchstart:this.onMouseDown.bind(this),mouseup:this.onMouseUp.bind(this),touchend:this.onMouseUp.bind(this),mousemove:this.onMouseMove.bind(this),touchmove:this.onMouseMove.bind(this),contextmenu:this.onMouseRightButtonClick.bind(this)};throttledMethods=ai({sendMarkerMoveEvent:this.sendMarkerMoveEvent,sendMarkerRightClickEvent:this.sendMarkerRightClickEvent},this,this.gm.options.settings.throttlingDelay);debouncedMethods=B2({refreshMarkers:this.refreshMarkers},this,this.gm.options.settings.throttlingDelay*10);get pinHelperInstance(){return this.pinEnabled&&Object.values(this.gm.actionInstances).find(j2)||null}async onStartAction(){this.isShapeMarkerAllowed()&&this.gm.markerPointer.enable({invisibleMarker:!0}),this.edgeMarkersAllowed=this.gm.getActiveEditModes().includes("change"),this.gm.features.updateManager.beginTransaction("transactional-set",Z.internal),await this.addMarkers(),this.gm.features.updateManager.commitTransaction(Z.internal)}async onEndAction(){this.gm.markerPointer.disable(),this.gm.features.updateManager.beginTransaction("transactional-set",Z.internal),await this.removeMarkers(),this.gm.features.updateManager.commitTransaction(Z.internal)}setPin(e){this.pinEnabled=e}async onMouseDown(e){if(!He(e,{warning:!0})||!["mousedown","touchstart"].includes(e.type)||a2(e))return{next:!0};if(e.type==="mousedown"&&e.originalEvent.button!==0)return{next:!0};const t=this.getFeatureMarkerByMouseEvent(e);if(this.activeMarker=t||null,this.activeFeatureData=t?.instance.parent||null,this.activeFeatureData){this.gm.features.selection.has(this.activeFeatureData.id)||this.gm.features.setSelection([this.activeFeatureData.id]);const i=this.gm.features.getLinkedFeatures(this.activeFeatureData);if(i.some(s=>s.getShapeProperty("disableEdit")===!0))return{next:!0};this.linkedFeatures=i}if(!(this.activeMarker&&this.activeFeatureData))return{next:!0};if(this.initialPoint=e.point,this.previousPosition=Wl(this.activeMarker.instance),this.gm.mapAdapter.setDragPan(!1),this.activeMarker.type==="edge"&&await this.sendMarkerEvent("edge_marker_click",this.activeFeatureData,this.activeMarker),this.pinEnabled&&this.pinHelperInstance)this.sharedMarkers=this.pinHelperInstance.getSharedMarkers(this.activeMarker.position.coordinate),this.sharedMarkers.forEach(i=>this.snappingHelper?.addExcludedFeature(i.featureData));else for(const i of[this.activeFeatureData,...this.linkedFeatures])this.snappingHelper?.addExcludedFeature(i);return await this.sendMarkerEvent("marker_captured",this.activeFeatureData,this.activeMarker,this.linkedFeatures),{next:!1}}async onMouseUp(e){if(!this.activeFeatureData||!He(e,{warning:!0}))return{next:!0};if(!this.activeMarker)return{next:!0};const t={featureData:this.activeFeatureData,markerData:this.activeMarker,linkedFeatures:this.linkedFeatures};return this.initialPoint&&this.initialPoint.dist(e.point)<1&&this.gm.features.setSelection([this.activeFeatureData.id],!0),this.initialPoint=null,this.activeMarker=null,this.activeFeatureData=null,this.sharedMarkers=[],this.linkedFeatures=[],this.snappingHelper?.clearExcludedFeatures(),this.previousPosition=null,this.gm.mapAdapter.setDragPan(!0),t.featureData&&t.markerData?(await this.sendMarkerEvent("marker_released",t.featureData,t.markerData,t.linkedFeatures),{next:!1}):(ee.debug("ShapeMarkersHelper.onMouseUp: no active marker or featureData",t),{next:!0})}onMouseMove(e){return!this.activeMarker||!He(e,{warning:!0})?{next:!0}:(this.throttledMethods.sendMarkerMoveEvent(e),{next:!1})}onMouseRightButtonClick(e){if(!He(e,{warning:!0}))return{next:!0};const t=this.getFeatureMarkerByMouseEvent(e);return t&&t.instance.parent?(this.throttledMethods.sendMarkerRightClickEvent(t.instance.parent,t),{next:!1}):{next:!0}}isShapeMarkerAllowed(){return h_(this.shapeMarkerAllowedModes,this.gm.getActiveEditModes()).length>0}async convertToVertexMarker(e){if(e.type==="edge"&&e.instance.parent){const t=e.position,i=e.instance.parent;await this.removeMarker(e);const s=await this.createMarker({type:"vertex",positionData:t,parentFeature:i}),u=N2(i.getGeoJson(),t.coordinate);if(u){const c=u.path.join("."),f=i.markers.get(c);return f&&await this.removeMarker(f),i.markers.set(c,s),s}}return ee.error("ShapeMarkersHelper.convertToVertexMarker: invalid marker type",e),e}getFeatureMarkerByMouseEvent(e){const t=this.gm.features.getFeatureByMouseEvent({event:e,sourceNames:[Z.internal]});if(t?.parent?.markers){const i=I_(t.parent.markers,s=>s.instance===t);if(i?.type!=="dom")return i}return null}async addMarkers(){for(const[,e]of this.gm.features.featureStore){if(!e||e.temporary||!this.allowedShapes.includes(e.shape)||e.getShapeProperty("disableEdit")===!0)continue;await this.addCenterMarker(e);const t=this.getAllShapeSegments(e),i=this.getEndMarkerIndexes(e);for(const[s,u]of t.entries()){if(this.isMarkerIndexAllowed(e.shape,s,t.length)){const c=await this.createOrUpdateVertexMarker(u.segment.start,e);if(e.markers.set(c.markerKey,c.markerData),i.has(s)){const f=await this.createOrUpdateVertexMarker(u.segment.end,e);e.markers.set(f.markerKey,f.markerData)}}if(this.isEdgeMarkerAllowed(e)){const c=await this.createOrUpdateEdgeMarker(u,e);e.markers.set(c.markerKey,c.markerData)}}}}async addCenterMarker(e){const t=e.getShapeProperty("center");if(t){const i=await this.createMarker({type:"center",positionData:{path:[],coordinate:t},parentFeature:e});e.markers.set("center",i)}}getAllShapeSegments(e){const t=e.getGeoJson(),i=[];return qd(t,(s,u)=>{i.push({segment:s,middle:this.getSegmentMiddlePosition(s),edgeMarkerKey:this.getEdgeMarkerKey(u)})}),i}isEdgeMarkerAllowed(e){return this.edgeMarkersAllowed&&this.edgeMarkerAllowedShapes.includes(e.shape)}isMarkerIndexAllowed(e,t,i){const s=Math.floor(i/4);return e==="circle"?(t+s/2)%s===0:e==="ellipse"?t%s===0:!0}getEdgeMarkerKey(e){return`edge.${e}`}getEndMarkerIndexes(e){const t=e.getGeoJson().geometry;return e.shape!=="line"||!["LineString","MultiLineString"].includes(t.type)?new Set:t.type==="MultiLineString"?t.coordinates.reduce((i,s)=>(i.indexes.add(i.sum+s.length-2),i.sum+=s.length-1,i),{sum:0,indexes:new Set}).indexes:new Set([t.coordinates.length-2])}getSegmentMiddlePosition(e){const t=this.gm.mapAdapter.project(e.start.coordinate),i=this.gm.mapAdapter.project(e.end.coordinate),s=[(t[0]+i[0])/2,(t[1]+i[1])/2],u=e.start.path.slice(0,e.start.path.length-1).concat([-1]);return{coordinate:this.gm.mapAdapter.unproject(s),path:u}}async removeMarkers(){this.gm.features.forEach((e,t)=>{const i=this.gm.features.get(Z.main,t);i&&(i.markers.forEach(s=>{s.type!=="dom"?this.gm.features.delete(s.instance):ee.error("Non a FeatureData marker",s)}),i.markers=new Map)})}async removeMarker(e){if(e.type==="dom"){ee.error("Wrong marker type",e);return}const t=e.instance.parent;if(!t){ee.error("Missing parent feature data",e);return}for(const[i,s]of t.markers.entries())if(s===e){await this.gm.features.delete(s.instance),t.markers.delete(i);break}}async handleGmDraw(e){return Fl(e)?(["feature_created","mode_start"].includes(e.action)&&await this.debouncedMethods.refreshMarkers(),{next:!0}):(ee.error("ShapeMarkersHelper.handleGmDraw: not a draw event",e),{next:!0})}async refreshMarkers(){this.gm.options.isModeEnabled("helper","shape_markers")&&(this.gm.features.updateManager.beginTransaction("transactional-set",Z.internal),await this.removeMarkers(),await this.addMarkers(),this.gm.features.updateManager.commitTransaction(Z.internal))}async handleGmEdit(e){return Ki(e)?(e.action==="feature_updated"&&await this.handleShapeUpdate(e),{next:!0}):(ee.error("ShapeMarkersHelper.handleGmEdit: not an edit event",e),{next:!0})}async handleShapeUpdate(e){const t=e.targetFeatures[0];if(!t){ee.error("ShapeMarkersHelper.handleShapeUpdate: no featureData",e);return}this.activeMarker?.type==="edge"&&(this.activeMarker=await this.convertToVertexMarker(this.activeMarker));const i=this.getAllShapeSegments(t),s=new Set(t.markers.keys()),u=this.getEndMarkerIndexes(t);for(const[c,f]of i.entries()){if(this.isMarkerIndexAllowed(t.shape,c,i.length)){const h=await this.createOrUpdateVertexMarker(f.segment.start,t);if(s.delete(h.markerKey),u.has(c)){const d=await this.createOrUpdateVertexMarker(f.segment.end,t);s.delete(d.markerKey)}}if(this.isEdgeMarkerAllowed(t)){const h=await this.createOrUpdateEdgeMarker(f,t);s.delete(h.markerKey)}}await this.updateCenterMarkerPosition(t),s.delete("center");for(const c of s){const f=t.markers.get(c);f&&f.type!=="dom"?await this.gm.features.delete(f.instance):ee.error("Non a FeatureData marker"),t.markers.delete(c)}}async createOrUpdateVertexMarker(e,t){const i=e.path.join(".");let s=t.markers.get(i)||null;if(s&&s?.type!=="vertex")throw new Error(`Invalid marker type "${s?.type}" for edge marker`);return s?(qu(s.position.coordinate,e.coordinate)||await this.gm.features.updateMarkerFeaturePosition(s.instance,e.coordinate),s.position=e):(s=await this.createMarker({type:"vertex",positionData:e,parentFeature:t}),t.markers.set(i,s)),{markerKey:i,markerData:s}}async createOrUpdateEdgeMarker(e,t){let i=t.markers.get(e.edgeMarkerKey)||null;if(i&&i?.type!=="edge")throw new Error(`Invalid marker type "${i?.type}" for edge marker`);return i?(qu(i.position.coordinate,e.middle.coordinate)||await i.instance.updateGeometry({type:"Point",coordinates:e.middle.coordinate}),i.position=e.middle,i.segment=e.segment):(i=await this.createMarker({type:"edge",positionData:e.middle,segment:e.segment,parentFeature:t}),t.markers.set(e.edgeMarkerKey,i)),{markerKey:e.edgeMarkerKey,markerData:i}}async updateCenterMarkerPosition(e){const t=e.markers.get("center")||null,i=e.getShapeProperty("center");t&&t.type!=="dom"&&i&&(await t.instance.updateGeometry({type:"Point",coordinates:i}),t.position.coordinate=i)}async sendMarkerEvent(e,t,i,s=[]){const u={name:`${se}:edit:marker`,level:"system",actionType:"edit",mode:"change",action:e,featureData:t,markerData:i,linkedFeatures:s};await this.gm.events.fire(`${se}:edit`,u)}async sendMarkerRightClickEvent(e,t){const i={name:`${se}:edit:marker`,level:"system",actionType:"edit",mode:"change",action:"marker_right_click",featureData:e,markerData:t};await this.gm.events.fire(`${se}:edit`,i)}async sendMarkerMoveEvent(e){const t=this.gm.markerPointer.marker?.getLngLat()||e.lngLat.toArray();if(this.activeMarker&&this.activeFeatureData){const i=this.pinEnabled?this.sharedMarkers:[{markerData:this.activeMarker,featureData:this.activeFeatureData}];for(const s of i)if(this.previousPosition){const u={name:`${se}:edit:marker_move`,level:"system",actionType:"edit",mode:"drag",action:"marker_move",featureData:s.featureData,markerData:s.markerData,lngLatStart:this.previousPosition,lngLatEnd:t,linkedFeatures:s.featureData===this.activeFeatureData?this.linkedFeatures:[]};await this.gm.events.fire(`${se}:edit`,u)}}this.previousPosition=t}async createMarker({type:e,segment:t,positionData:i,parentFeature:s}){const u=i.coordinate,c=await this.gm.features.createMarkerFeature({sourceName:Z.internal,parentFeature:s,type:e,coordinate:u});if(!c)throw new Error(`Missine feature data for the "${e}" marker`);if(e==="edge"&&t)return{type:e,instance:c,position:Bt(i),segment:t};if(e==="vertex"||e==="center")return{type:e,instance:c,position:Bt(i)};throw new Error(`Invalid marker type "${e}" with segment: ${t}`)}},Cb=class extends Sr{mode="snapping";get tolerance(){return this.gm.options.settings.snapDistance}lineSnappingShapes=["circle","line","rectangle","polygon","snap_guide"];eventHandlers={};shapeSnappingHandlers={marker:this.getPointsSnapping.bind(this),circle:this.getLineSnapping.bind(this),circle_marker:this.getPointsSnapping.bind(this),text_marker:this.getPointsSnapping.bind(this),line:this.getLineSnapping.bind(this),rectangle:this.getLineSnapping.bind(this),polygon:this.getLineSnapping.bind(this),snap_guide:this.getLineSnapping.bind(this)};excludedFeature=new Set;customSnappingLngLats=new Map;customSnappingFeatures=new Set;onStartAction(){this.gm.markerPointer.setSnapping(!0)}onEndAction(){this.gm.markerPointer.setSnapping(!1)}addExcludedFeature(e){this.excludedFeature.add(e)}clearExcludedFeatures(){this.excludedFeature.clear()}addCustomSnappingFeature(e){this.customSnappingFeatures.add(e)}removeCustomSnappingFeature(e){this.customSnappingFeatures.delete(e)}clearCustomSnappingFeature(){this.customSnappingFeatures.clear()}setCustomSnappingCoordinates(e,t){this.customSnappingLngLats.set(e,t)}clearCustomSnappingCoordinates(e){this.customSnappingLngLats.delete(e)}getSnappedLngLat(e,t){let i=this.getCustomLngLatsSnapping(t);if(i)return i;const s=this.getFeaturesInPointBounds(t).filter(u=>!this.excludedFeature.has(u));return i=this.getFeaturePointsSnapping(s,e,t),i||(i=this.getFeatureLinesSnapping(s,e,t),i)?i:e}getCustomLngLatsSnapping(e){const t={distance:1/0,lngLat:null};return this.customSnappingLngLats.forEach(i=>{i.forEach(s=>{const u=Fs(e,this.gm.mapAdapter.project(s));u<this.tolerance&&u<t.distance&&(t.distance=u,t.lngLat=s)})}),t.lngLat}getFeaturePointsSnapping(e,t,i){let s=e.map(u=>({shape:u.shape,...this.getPointsSnapping(u,t,i)})).filter(u=>u.distance<this.tolerance);return s.length?(s=gh(s,["distance"]),s[0].lngLat):null}getFeatureLinesSnapping(e,t,i){let s=e.filter(u=>this.lineSnappingShapes.includes(u.shape)).map(u=>{const c=this.shapeSnappingHandlers[u.shape];return c?{shape:u.shape,...c(u,t,i)}:null}).filter(u=>u!==null&&u.distance<this.tolerance);return s.length?(s=gh(s,["distance"]),s[0].lngLat):null}getFeaturesInPointBounds(e){const t=[[e[0]-this.tolerance,e[1]-this.tolerance],[e[0]+this.tolerance,e[1]+this.tolerance]];return this.gm.features.getFeaturesByScreenBounds({bounds:t,sourceNames:[Z.main,Z.temporary]}).filter(i=>i.temporary?this.customSnappingFeatures.has(i):!0)||[]}getPointsSnapping(e,t,i){const s=e.getGeoJson(),u={distance:1/0,coord:null};return ia(s,c=>{const f=Fs(i,this.gm.mapAdapter.project(c.coordinate));f<this.tolerance&&f<u.distance&&(u.distance=f,u.coord=c.coordinate)},!0),{lngLat:u.coord?u.coord:t,distance:u.distance}}getLineSnapping(e,t,i){const s=e.getGeoJson();return this.getNearestLinePointData(s,t,i)}getNearestLinePointData(e,t,i){const s={lngLat:t,distance:1/0},u=this.gm.mapAdapter.getEuclideanNearestLngLat(e,t);return s.distance=Fs(this.gm.mapAdapter.project(u),i),s.distance<this.tolerance&&(s.lngLat=u),s}},Ab=class extends Sr{mode="zoom_to_features";eventHandlers={};async onStartAction(){this.fitMapToFeatures(),setTimeout(()=>{this.gm.options.disableMode("helper","zoom_to_features").then()})}onEndAction(){}fitMapToFeatures(){const e=this.gm.features.asGeoJsonFeatureCollection({sourceNames:[Z.main,...st?[Z.standby]:[]]}),t=Cd(e),i=[[t[0],t[1]],[t[2],t[3]]];try{this.gm.mapAdapter.fitBounds(i,{padding:20})}catch{ee.warn("Wrong bounds for zooming to features",i,e)}}},ll={shape_markers:Lb,pin:null,snapping:Cb,snap_guides:null,measurements:null,auto_trace:null,geofencing:null,zoom_to_features:Ab,click_to_edit:null},Tb=(e,t)=>ll[t]?new ll[t](e):(ee.error(`Helper "${t}" is not available`),null),Pb=class extends xo{eventHandlers={[`${se}:helper`]:this.handleHelperEvent.bind(this)};constructor(e,t){super(e),t.attachEvents(this.eventHandlers)}async handleHelperEvent(e){if(!Gl(e))return{next:!0};const t=`${e.actionType}__${e.mode}`;return e.action==="mode_start"?(await this.trackExclusiveModes(e),await this.start(t,e),await this.trackRelatedModes(e)):e.action==="mode_end"&&(await this.trackRelatedModes(e),await this.end(t)),{next:!0}}async start(e,t){const i=Tb(this.gm,t.mode);if(i){if(e in this.gm.actionInstances)throw ee.error(`Action instance "${e}" already exists`),new Error("Action instance already exists");this.gm.actionInstances[e]=i,await i.startAction()}}async end(e){const t=this.gm.actionInstances[e];t instanceof Sr?(await t.endAction(),delete this.gm.actionInstances[e]):console.error(`Wrong action instance for edit event "${e}":`,t)}},Ob=class{gm;bus;listeners={};constructor(e){this.gm=e,this.bus=new c2(this.gm),this.listeners={draw:new Ix(this.gm,this.bus),edit:new Nb(this.gm,this.bus),helper:new Pb(this.gm,this.bus),control:new h2(this.gm,this.bus)}}async fire(e,t){this.listeners[t.actionType]||ee.error(`Can't find event listener for "${t.actionType}" event type`),await this.bus.fireEvent(e,t)}},Rb=class cl{gm;updateStorage;delayedSourceUpdateMethods;pendingUpdatePromises;constructor(t){this.gm=t,this.updateStorage=Object.fromEntries(Ba(Z).map(i=>[i,{diff:null,method:"automatic"}])),this.delayedSourceUpdateMethods=Object.fromEntries(Ba(Z).map(i=>[i,dg(()=>this.updateSourceActual(i),this.gm.options.settings.throttlingDelay)])),this.pendingUpdatePromises=Object.fromEntries(Ba(Z).map(i=>[i,new Set]))}beginTransaction(t,i){(i?[i]:Object.values(Z)).forEach(s=>{this.updateStorage[s].method=t})}updatesPending(t){return this.updateStorage[t].diff!==null||!!(this.pendingUpdatePromises[t]?.size??0)}getFeatureId(t){const i=t.properties?.[Qt]??t.id;return i??console.warn("Feature id is null or undefined",t),i}async updateSource({sourceName:t,diff:i,waitForCompletion:s=!1}){const u=this.updateStorage[t].method;u==="transactional-set"&&i.update&&(ee.error("In transactional-set updates are not allowed"),delete i.update),this.updateStorage[t].diff||(this.updateStorage[t].diff={}),this.mergeGeoJsonDiff(this.updateStorage[t].diff,i),u==="automatic"&&this.delayedSourceUpdateMethods[t](),s&&await this.waitForPendingUpdates(t)}updateSourceActual(t){const i=this.gm.features.sources[t];if(this.updateStorage[t].method==="automatic"&&i){if(!i.loaded){setTimeout(()=>{this.updateSourceActual(t)},this.gm.options.settings.throttlingDelay);return}if(this.updateStorage[t].diff){const s=i.updateData(this.updateStorage[t].diff);this.addPendingPromise(t,s).then(),this.updateStorage[t].diff=null}}}addPendingPromise(t,i){const s=Ju({promise:i,errorMessage:`Source update timeout for "${t}"`});return this.pendingUpdatePromises[t].add(s),s.catch(u=>ee.error("addPendingPromise: pending promise error",u)),s.finally(()=>{this.pendingUpdatePromises[t].delete(s)}),s}async waitForPendingUpdates(t){const i=this.gm.features.sources[t];if(!i){ee.error(`Missing source for name: "${t}"`);return}const s=Date.now();for(;this.updateStorage[t].diff||this.pendingUpdatePromises[t].size||!i.loaded;){const u=this.pendingUpdatePromises[t];if(u.size&&await Promise.all(Array.from(u).map(c=>c.catch(f=>{ee.error("waitForPendingUpdates: pending promise error",f)}))),Date.now()-s>_u){ee.error(`waitForPendingUpdates timeout error,
|
|
213
|
+
can't wait more than ${_u}ms for ${t}`);return}await new Promise(c=>setTimeout(c,0))}await new Promise(u=>requestAnimationFrame(u))}commitTransaction(t){(t?[t]:Object.values(Z)).forEach(i=>{const s=this.gm.features.sources[i];if(!s||!this.updateStorage[i].diff){this.updateStorage[i].method="automatic";return}if(this.updateStorage[i].method==="transactional-set"){const u=this.updateStorage[i].diff.add?.values()??[];s.setData({type:"FeatureCollection",features:Array.from(u)}).then()}else this.updateStorage[i].method==="transactional-update"&&s.updateData(this.updateStorage[i].diff).then();this.updateStorage[i].diff=null,this.updateStorage[i].method="automatic"})}mergeGeoJsonDiff(t,i){if(cl.resolveMergeConflicts(t,i),(t.removeAll||i.removeAll)&&(t.removeAll=!0),i.remove&&!t.remove&&(t.remove=new Set),i.remove?.forEach(s=>{t.remove?.add(s)}),i.add&&!t.add&&(t.add=new Map),i.add?.forEach((s,u)=>{t.add?.set(u,s)}),i.update&&!t.update&&(t.update=new Map),i.update?.forEach((s,u)=>{t.update?.set(u,s)}),t.remove?.size&&t.add?.size)for(const s of t.add.keys())t.remove.delete(s)}static resolveMergeConflicts(t,i){if(i.removeAll&&(t.add?.clear(),t.update?.clear(),t.remove?.clear(),i.remove?.clear()),i.remove)for(const s of i.remove)t.add?.delete(s),t.update?.delete(s);if(i.update)for(const[s,u]of i.update){const c=t.update?.get(s);c&&(i.update?.set(s,cl.mergeFeatureDiffs(c,u)),t.update?.delete(s))}}static mergeFeatureDiffs(t,i){const s={id:t.id};if(i.removeAllProperties&&(delete t.removeProperties,delete t.addOrUpdateProperties,delete i.removeProperties),i.removeProperties)for(const u of i.removeProperties){const c=t.addOrUpdateProperties?.findIndex(f=>f.key===u)??-1;c>-1&&t.addOrUpdateProperties?.splice(c,1)}return(t.removeAllProperties||i.removeAllProperties)&&(s.removeAllProperties=!0),(t.removeProperties||i.removeProperties)&&(s.removeProperties=[...t.removeProperties||[],...i.removeProperties||[]]),(t.addOrUpdateProperties||i.addOrUpdateProperties)&&(s.addOrUpdateProperties=[...t.addOrUpdateProperties||[],...i.addOrUpdateProperties||[]]),(t.newGeometry||i.newGeometry)&&(s.newGeometry=i.newGeometry||t.newGeometry),s}},Db=class{isInstanceAvailable(){return this.sourceInstance?!0:(ee.error("Source instance is not available"),!1)}},Fb=class{gm;featureCounter=0;featureStore=new Map;featureStoreAllowedSources=[Z.main,Z.temporary,Z.internal];selection=new Set;sources;defaultSourceName=Z.main;updateManager;layers;constructor(e){this.gm=e,this.updateManager=new Rb(e),this.sources=Object.fromEntries(Ba(Z).map(t=>[t,null])),this.layers=[]}get forEach(){return this.filteredForEach(e=>!e.temporary)}get tmpForEach(){return this.filteredForEach(e=>e.temporary)}init(){if(Object.values(this.sources).some(e=>e!==null)){ee.warn("features.init(): features are already initialized");return}Ke(this.sources).forEach(e=>{this.sources[e]=this.createSource(e)}),this.hydrateFromExistingSources(),this.gm.options.settings.useDefaultLayers&&(this.layers=this.createLayers())}hydrateFromExistingSources(){let e=0;Ke(this.sources).forEach(t=>{const i=this.sources[t];if(i)try{const s=i.getGeoJson();if(s&&"features"in s)for(const u of s.features){const c=u.properties?.[Qt];if(!c)continue;if(typeof c=="string"&&c.startsWith("feature-")){const d=parseInt(c.replace("feature-",""),10);!isNaN(d)&&d>e&&(e=d)}if(this.featureStore.has(c))continue;const f=u,h=new ru({gm:this.gm,id:c,parent:null,source:i,geoJsonShapeFeature:Bt(f),skipSourceUpdate:!0});this.featureStore.set(c,h)}}catch{}}),e>this.featureCounter&&(this.featureCounter=e)}getNewFeatureId(e){if(this.featureCounter+=1,this.gm.options.settings.idGenerator)return this.gm.options.settings.idGenerator(e);let t=`feature-${this.featureCounter}`;for(;this.featureStore.has(t);)this.featureCounter+=1,t=`feature-${this.featureCounter}`;return t}filteredForEach(e){return t=>{this.featureStore.forEach((i,s,u)=>{e(i)&&t(i,s,u)})}}has(e,t){const i=this.featureStore.get(t);return!!i&&i?.source===this.sources[e]}get(e,t){const i=this.featureStore.get(t)||null;return i?.source===this.sources[e]?i:null}add(e){if(this.featureStore.has(e.id)){ee.error(`features.add: feature with the id "${e.id}" already exists`);return}this.featureStoreAllowedSources.includes(e.source.id)&&this.featureStore.set(e.id,e)}setDefaultSourceName(e){this.defaultSourceName=e}setSelection(e,t=!1){this.selection=new Set(e),t&&this.fireSelectionChangeEvent(e)}clearSelection(){this.selection.clear()}createSource(e){const t=this.gm.mapAdapter.addSource(e,{type:"FeatureCollection",features:[]});if(t)return t;throw new Error(`Features: failed to create the source: "${e}"`)}async delete(e){let t;e instanceof ru?t=e:t=this.featureStore.get(e)||null,t?(this.featureStore.delete(t.id),await t.delete()):ee.error(`features.delete: feature "${e}" not found`)}async deleteAll(){await Promise.all(Array.from(this.featureStore.values(),e=>e.delete())),this.featureStore.clear()}getLinkedFeatures(e){const t=Array.from(this.selection).map(u=>this.featureStore.get(u)).filter(Fh),i=new Set(t.map(u=>u.getShapeProperty("group")).filter(Fh)),s=Array.from(this.featureStore.values()).filter(u=>{const c=u.getShapeProperty("group");return Fn.includes(u.shape)&&c&&i.has(c)});return M_([...t,...s]).filter(u=>u.id!==e.id)}getFeatureByMouseEvent({event:e,sourceNames:t}){if(!He(e,{warning:!0}))return null;const i=[e.point.x,e.point.y],s=this.gm.mapAdapter.queryFeaturesByScreenCoordinates({queryCoordinates:i,sourceNames:t});return s.length===0?null:s.find(u=>kd.includes(u.shape))??s[0]}getFeaturesByGeoJsonBounds({geoJson:e,sourceNames:t}){const i=ql(e),s=this.gm.mapAdapter.coordBoundsToScreenBounds(i);return this.getFeaturesByScreenBounds({bounds:s,sourceNames:t})}getFeaturesByScreenBounds({bounds:e,sourceNames:t}){return this.gm.mapAdapter.queryFeaturesByScreenCoordinates({queryCoordinates:e,sourceNames:t})}async createFeature({featureId:e,shapeGeoJson:t,parent:i,sourceName:s,imported:u}){const c=this.sources[s];if(!c)return ee.error("Features.createFeature Missing source for feature creation"),null;const f=e??t.properties[Qt]??this.getNewFeatureId(t);if(this.featureStore.get(f))return ee.error(`Features.createFeature: feature with the id "${f}" already exists`,this.featureStore.get(f)),null;const h=new ru({gm:this.gm,id:f,parent:i||null,source:c,geoJsonShapeFeature:Bt(t)});return this.add(h),!h.temporary&&!u&&await this.fireFeatureCreatedEvent(h),this.featureCounter+=1,h}async importGeoJson(e,t){const i=t??{},s="features"in e?e.features:[e],u={stats:{total:0,success:0,failed:0,overwritten:0},addedFeatures:[]};this.updateManager.beginTransaction("transactional-update",Z.main);for(const c of s){let f=null;u.stats.total+=1;const h=IE(c);if(h){if(i.idPropertyName){const d=ME(h,i.idPropertyName);d&&(h.id=d)}if(i.overwrite){const d=h.id??h.properties?.[Qt];d&&this.featureStore.has(d)&&(await this.delete(d),u.stats.overwritten+=1)}f=await this.importGeoJsonFeature(h)}f?(u.addedFeatures.push(f),u.stats.success+=1):u.stats.failed+=1}return this.updateManager.commitTransaction("gm_main"),u}async importGeoJsonFeature(e){const t=this.defaultSourceName,i=this.getFeatureShapeByGeoJson(e);return i?this.createFeature({featureId:e.id,shapeGeoJson:e,sourceName:t,imported:!0}):(ee.error("features.addGeoJsonFeature: unknown shape",i),null)}getAll(){return this.exportGeoJson()}exportGeoJson({allowedShapes:e,idPropertyName:t}={allowedShapes:void 0}){return this.asGeoJsonFeatureCollection({sourceNames:[Z.main,...st?[Z.standby]:[]],shapeTypes:e||[...Fn],idPropertyName:t,useMapLibreSource:!1})}exportGeoJsonFromSource({allowedShapes:e,idPropertyName:t}={allowedShapes:void 0}){return this.asGeoJsonFeatureCollection({sourceNames:[Z.main,...st?[Z.standby]:[]],shapeTypes:e||[...Fn],idPropertyName:t,useMapLibreSource:!0})}asGeoJsonFeatureCollection({shapeTypes:e,sourceNames:t,idPropertyName:i,useMapLibreSource:s=!1}){const u={type:"FeatureCollection",features:[]};return i??=Qt,t.forEach(c=>{const f=this.sources[c];f&&(s?f.getGeoJson():f.getGmGeoJson()).features.filter(h=>!!h).forEach(h=>{const d=this.get(c,h.id);if(!d)return;const m=h.properties[Qt];i!==Qt&&(h.properties[i]=m,delete h.properties[Qt]),(e===void 0||e.includes(d.shape))&&u.features.push({...h,id:m})})}),u}async convertSourceToGm(e){const t=[],i=e.getGeoJson(),s="features"in i?i.features:[i];this.gm.mapAdapter.getSource(e.id).remove();for(const u of s){const c=await this.addGeoJsonFeature({shapeGeoJson:u,defaultSource:!0});c&&t.push(c)}return t}async addGeoJsonFeature({shapeGeoJson:e,sourceName:t,defaultSource:i}){let s;if(i?(s=this.defaultSourceName,t&&ee.warn("features.addGeoJsonFeature: default source is set, sourceName is ignored")):s=t||null,!s)return ee.error("features.addGeoJsonFeature: missing sourceName"),null;const u=this.getFeatureShapeByGeoJson(e);return u?this.createFeature({featureId:e.id,shapeGeoJson:{...e,properties:{...e.properties,shape:u}},sourceName:s}):(ee.error("features.addGeoJsonFeature: unknown shape",u),null)}createLayers(){const e=[];return Ke(this.sources).forEach(t=>{Ke(this.gm.options.layerStyles).forEach(i=>{this.gm.options.layerStyles[i][t]?.forEach(s=>{const u=this.createGenericLayer({sourceName:t,shapeNames:[i],partialStyle:s});u&&e.push(u)})})}),e}createGenericLayer({sourceName:e,shapeNames:t,partialStyle:i}){const s=this.getGenericLayerName({sourceName:e,shapeNames:t,partialStyle:i});if(!s)throw new Error("Can't create a layer, for [object Object]");const u={...i,id:s,source:e,filter:["in",["get",`${rt}shape`],["literal",t]]};return this.gm.mapAdapter.addLayer(u)}getGenericLayerName({sourceName:e,shapeNames:t,partialStyle:i}){const s=t.length===1?t[0]:"mixed",u=c=>`${e}-${s}__${i.type}-layer-${c}`;for(let c=0;c<100;c+=1){const f=u(c);if(!this.gm.mapAdapter.getLayer(f))return f}return null}getFeatureShapeByGeoJson(e){const t={Point:"marker",MultiPoint:"marker",LineString:"line",MultiLineString:"line",Polygon:"polygon",MultiPolygon:"polygon"},i=e.properties;return i?.shape&&Fn.includes(i?.shape)?i?.shape:t[e.geometry.type]||null}createMarkerFeature({parentFeature:e,coordinate:t,type:i,sourceName:s}){return this.createFeature({sourceName:s,parent:e,shapeGeoJson:{type:"Feature",geometry:{type:"Point",coordinates:t},properties:{[`${rt}shape`]:`${i}_marker`}}})}async updateMarkerFeaturePosition(e,t){await e.updateGeometry({type:"Point",coordinates:t})}async fireFeatureCreatedEvent(e){if(wr(e.shape,Fn)){const t={name:`${se}:draw:feature_created`,level:"system",actionType:"draw",mode:e.shape,action:"feature_created",featureData:e};await this.gm.events.fire(`${se}:draw`,t)}}fireSelectionChangeEvent(e){const t={name:`${se}:edit:selection_change`,level:"system",actionType:"edit",action:"selection_change",selection:e,mode:null};this.gm.events.fire(`${se}:edit`,t)}},Gb=class{isInstanceAvailable(){return this.layerInstance?!0:(ee.error("layerInstance is not available"),!1)}},mu=class extends Gb{gm;layerInstance=null;mapInstance;constructor({gm:e,layerId:t,options:i}){super(),this.gm=e,this.mapInstance=this.gm.mapAdapter.getMapInstance(),i?this.layerInstance=this.createLayer(i):this.layerInstance=this.mapInstance.getLayer(t)||null}get id(){if(!this.isInstanceAvailable())throw new Error("Layer instance is not available");return this.layerInstance.id}get source(){if(!this.isInstanceAvailable())throw new Error("Layer instance is not available");return this.layerInstance.source}createLayer(e){let t=this.mapInstance.getLayer(e.id);return t?ee.warn(`Layer "${e.id}" already exists, skipping`):(this.mapInstance.addLayer(e),t=this.mapInstance.getLayer(e.id)),t??null}remove(){this.isInstanceAvailable()&&this.mapInstance.removeLayer(this.id),this.layerInstance=null}},Bb=class extends Wa{markerInstance;constructor({mapInstance:e,options:t,lngLat:i}){super(),this.markerInstance=new Gs.default.Marker(t).setLngLat(i).addTo(e)}getElement(){return this.isMarkerInstanceAvailable()&&this.markerInstance?.getElement()||null}setLngLat(e){this.isMarkerInstanceAvailable()&&this.markerInstance?.setLngLat(e)}getLngLat(){return this.isMarkerInstanceAvailable()?this.markerInstance?.getLngLat().toArray()||[0,0]:[0,0]}remove(){this.markerInstance?.remove()}},Ub=class{isInstanceAvailable(){return this.popupInstance?!0:(ee.error("Popup instance is not available"),!1)}},zb=class extends Ub{popupInstance;constructor({mapInstance:e,options:t,lngLat:i}){super(),this.popupInstance=new Gs.default.Popup(t).addTo(e),i&&this.setLngLat(i)}getLngLat(){return this.isInstanceAvailable()?this.popupInstance.getLngLat().toArray()||[0,0]:[0,0]}setLngLat(e){this.isInstanceAvailable()&&this.popupInstance.setLngLat(e)}setHtml(e){this.isInstanceAvailable()&&this.popupInstance.setHTML(e)}remove(){this.isInstanceAvailable()&&this.popupInstance.remove()}},Pf=class _p extends Db{gm;mapInstance;sourceInstance;constructor({gm:t,geoJson:i,sourceId:s}){super(),this.gm=t,this.mapInstance=this.gm.mapAdapter.getMapInstance(),i?this.sourceInstance=this.createSource({geoJson:i,sourceId:s}):this.sourceInstance=this.mapInstance.getSource(s)||null}get id(){if(!this.isInstanceAvailable())throw new Error("Source instance is not available");return this.sourceInstance.id}get loaded(){return this.mapInstance.isSourceLoaded(this.id)}createSource({geoJson:t,sourceId:i}){let s=this.mapInstance.getSource(i);return s?ee.warn(`Source "${s.id}" already exists, skipping`):(this.mapInstance.addSource(i,{type:"geojson",data:t,promoteId:Qt}),s=this.mapInstance.getSource(i)),s??null}getGeoJson(){if(!this.isInstanceAvailable())throw new Error("Source instance is not available");return this.sourceInstance.serialize().data}getGmGeoJson(){if(!this.isInstanceAvailable())throw new Error("Source instance is not available");const t={type:"FeatureCollection",features:[]};return this.gm.features.filteredForEach(i=>i.source.id===this.sourceInstance?.id)(i=>{Fn.includes(i.shape)&&t.features.push(i.getGeoJson())}),t}async setData(t){if(!this.isInstanceAvailable())throw new Error("Source instance is not available");await this.sourceInstance.setData(t,!0)}async updateData(t){if(!this.isInstanceAvailable())return;const i=_p.hashedToDiff(t);await this.sourceInstance.updateData(i,!0)}static hashedToDiff(t){const i={};return t.removeAll&&(i.removeAll=t.removeAll),t.remove&&(i.remove=Array.from(t.remove)),t.add&&(i.add=Array.from(t.add.values())),t.update&&(i.update=Array.from(t.update.values())),i}remove(){this.isInstanceAvailable()&&(this.gm.mapAdapter.eachLayer(t=>{t.source===this.sourceInstance.id&&this.gm.mapAdapter.removeLayer(t.id)}),this.mapInstance.removeSource(this.sourceInstance.id))}},jb=["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","mouseover","mouseout","contextmenu","touchstart","touchend","touchcancel"],vu=e=>jb.includes(e),qb=class extends Mx{mapType="maplibre";constructor(e,t){super(e,t)}isLoaded(){const e=this.mapInstance;return typeof e.loaded=="function"&&e.loaded()||typeof e.isStyleLoaded=="function"&&e.isStyleLoaded()?!0:e._loaded===!0}getContainer(){return this.mapInstance.getContainer()}getCanvas(){return this.mapInstance.getCanvas()}addControl(e){this.mapInstance.addControl(e)}removeControl(e){this.mapInstance.removeControl(e)}async loadImage({id:e,image:t}){if(!this.mapInstance.hasImage(e)){const i=await this.mapInstance.loadImage(t);this.mapInstance.addImage(e,i.data)}}removeImage(e){try{this.mapInstance.hasImage(e)&&this.mapInstance.removeImage(e)}catch{}}getBounds(){return this.mapInstance.getBounds().toArray()}fitBounds(e,t){this.mapInstance.fitBounds(e,t)}setCursor(e){this.mapInstance.getCanvas().style.cursor=e}disableMapInteractions(e){e.forEach(t=>{this.mapInstance[t].disable()})}enableMapInteractions(e){e.forEach(t=>{this.mapInstance[t].enable()})}setDragPan(e){e?this.mapInstance.dragPan.enable():this.mapInstance.dragPan.disable()}queryFeaturesByScreenCoordinates({queryCoordinates:e=void 0,sourceNames:t}){return dh(this.mapInstance.queryRenderedFeatures(e).map(i=>({featureId:i.properties[Qt],featureSourceName:i.source})),Ji).map(({featureId:i,featureSourceName:s})=>i===void 0||!t.includes(s)?null:this.gm.features.get(s,i)||null).filter(i=>!!i)}queryGeoJsonFeatures({queryCoordinates:e=void 0,sourceNames:t}){const i=(s,u)=>s?.id===u?.id;return dh(this.mapInstance.queryRenderedFeatures(e).map(s=>{const u=this.convertToGeoJsonImportFeature(s);return u?{id:s.properties[Qt],sourceName:s.source,geoJson:u}:null}),i).filter(s=>!!s&&s.id!==void 0&&s.geoJson&&t.includes(s.sourceName))}convertToGeoJsonImportFeature(e){const t=e.properties[Qt];return t===void 0||e.geometry.type==="GeometryCollection"?null:{id:t,type:"Feature",properties:e.properties,geometry:e.geometry}}addSource(e,t){return new Pf({gm:this.gm,sourceId:e,geoJson:t})}getSource(e){return new Pf({gm:this.gm,sourceId:e})}addLayer(e){const t=e.id;return new mu({gm:this.gm,layerId:t,options:e})}getLayer(e){return this.mapInstance.getLayer(e)?new mu({gm:this.gm,layerId:e}):null}removeLayer(e){const t=this.getLayer(e);t&&t.remove()}eachLayer(e){this.mapInstance.getStyle().layers.forEach(t=>{e(new mu({gm:this.gm,layerId:t.id}))})}createDomMarker(e,t){return new Bb({mapInstance:this.mapInstance,options:e,lngLat:t})}createPopup(e,t){return new zb({mapInstance:this.mapInstance,options:e,lngLat:t})}project(e){const t=this.mapInstance.project(e);return[t.x,t.y]}unproject(e){const t=this.mapInstance.unproject(e);return[t.lng,t.lat]}coordBoundsToScreenBounds(e){const t=new Gs.default.LngLatBounds(e);return[this.project(t.getSouthWest().toArray()),this.project(t.getNorthEast().toArray())]}fire(e,t){this.mapInstance.fire(e,t)}on(e,t,i){if(typeof t=="string"&&i&&vu(e))this.mapInstance.on(e,t,i);else if(typeof t=="function")this.mapInstance.on(e,t);else throw new Error("Invalid arguments passed to 'on' method")}once(e,t,i){if(typeof t=="string"&&i&&vu(e))this.mapInstance.once(e,t,i);else if(typeof t=="function")this.mapInstance.once(e,t);else throw new Error("Invalid arguments passed to 'once' method.")}off(e,t,i){if(typeof t=="string"&&i&&vu(e))this.mapInstance.off(e,t,i);else if(typeof t=="function")this.mapInstance.off(e,t);else throw new Error("Invalid arguments passed to 'off' method")}},Yb=(e,t)=>new qb(t,e),Hb=(e,t)=>{if(!Array.isArray(e)||!Array.isArray(t))return;if(t.some(u=>!o2(u))){ee.warn("Wrong partial layer detected for layer styles");return}const i=f_(e,"type"),s=W1(t,"type");if(Object.values(s).some(u=>u>1))throw new Error('Multiple layers for the same shape are detected. Use "useDefaultLayers: false" and define layers manually.');return t.forEach(u=>{i[u.type]?g_(i[u.type],u):i[u.type]=Bt(u)}),o_(i)},Jb=class{gm;settings;controls;layerStyles;constructor(e,t){this.gm=e;const i=this.getMergedOptions(t);this.settings=i.settings,this.controls=i.controls,this.layerStyles=i.layerStyles}getMergedOptions(e={}){const t=Lu();return typeof e.settings?.controlsUiEnabledByDefault=="boolean"&&(t.settings.controlsUiEnabledByDefault=e.settings.controlsUiEnabledByDefault),N_(t),r_(t,e,Hb)}async enableMode(e,t){const i=this.isModeEnabled(e,t),s=this.isModeAvailable(e,t);if(s||ee.warn(`Unable to enable mode, "${e}:${t}" is not available`),i||!s)return;const u=this.controls[e][t];u?(u.active=!0,await this.fireModeEvent(e,t,"mode_start"),await this.fireControlEvent(e,t,"on"),await this.fireModeEvent(e,t,"mode_started")):ee.error("Can't find control section for",e,t)}async disableMode(e,t){const i=this.isModeEnabled(e,t),s=this.isModeAvailable(e,t);if(!i||!s)return;const u=this.controls[e][t];u?(u.active=!1,await this.fireModeEvent(e,t,"mode_end"),await this.fireControlEvent(e,t,"off"),await this.fireModeEvent(e,t,"mode_ended")):ee.error("Can't find control section for",e,t)}async syncModeState(e,t){const i=this.controls[e][t],s=this.isModeAvailable(e,t);i&&(s?i.active?await this.enableMode(e,t):await this.disableMode(e,t):(console.log(`Not available mode: ${e}:${t}`),i.active=!1,i.uiEnabled=!1))}async toggleMode(e,t){this.isModeEnabled(e,t)?await this.disableMode(e,t):await this.enableMode(e,t)}isModeEnabled(e,t){return!!Object.entries(this.gm.actionInstances).find(([i,s])=>i===`${e}__${t}`&&s)}isModeAvailable(e,t){return e==="draw"&&wr(t,Ed)?!!this.gm.drawClassMap[t]:e==="edit"&&wr(t,Sd)?!!this.gm.editClassMap[t]:e==="helper"&&wr(t,bd)?!!this.gm.helperClassMap[t]:!1}getControlOptions({modeType:e,modeName:t}){return e&&t&&this.controls[e][t]||null}async fireModeEvent(e,t,i){const s={name:`${se}:${t}:mode`,level:"system",actionType:e,mode:t,action:i};Bl(s)&&(Fl(s)?await this.gm.events.fire(`${se}:${e}`,s):Ki(s)?await this.gm.events.fire(`${se}:${e}`,s):Gl(s)?await this.gm.events.fire(`${se}:${e}`,s):ee.warn("Unknown mode event: ",s))}async fireControlEvent(e,t,i){const s={name:`${se}:control:switch`,level:"system",actionType:"control",section:e,mode:t,action:i};await this.gm.events.fire(`${se}:control`,s)}},Vb=class{gm;marker=null;tmpMarker=null;snapping=!1;oldSnapping=void 0;constructor(e){this.gm=e,this.initEventHandlers()}get snappingHelper(){return this.gm.actionInstances.helper__snapping||null}initEventHandlers(){this.throttledMethods=ai({onMouseMove:this.onMouseMove},this,this.gm.options.settings.throttlingDelay),this.eventHandlers={mousemove:this.throttledMethods.onMouseMove.bind(this)}}setSnapping(e){if(e&&!this.snappingHelper){ee.error("MarkerPointer: snapping is not available");return}this.snapping=e}pauseSnapping(){this.oldSnapping!==void 0&&ee.error("MarkerPointer: snapping is already paused"),this.oldSnapping=this.snapping,this.setSnapping(!1)}resumeSnapping(){this.oldSnapping===void 0?(ee.error("MarkerPointer: resumeSnapping is called before pauseSnapping"),this.setSnapping(!0)):(this.setSnapping(this.oldSnapping),this.oldSnapping=void 0)}enable({lngLat:e,customMarker:t,invisibleMarker:i}={lngLat:[0,0],customMarker:void 0,invisibleMarker:!1}){if(!G2()){if(t&&i)throw new Error("MarkerPointer: customMarker and invisibleMarker can't be used together");if(this.marker)throw new Error("MarkerPointer: marker is already enabled");this.gm.events.bus.attachEvents(this.eventHandlers),i?this.marker=this.createInvisibleMarker(e||[0,0]):this.marker=t||this.createMarker(e||[0,0]),this.gm.getActiveDrawModes().length&&this.gm.mapAdapter.setCursor("crosshair")}}disable(){this.marker&&(this.gm.events.bus.detachEvents(this.eventHandlers),this.marker.remove(),this.marker=null),this.gm.mapAdapter.setCursor("")}createMarker(e=[0,0]){return this.gm.mapAdapter.createDomMarker({anchor:"center",element:this.gm.createSvgMarkerElement("control",{pointerEvents:"none"})},e)}createInvisibleMarker(e=[0,0]){const t=document.createElement("div");return t.style.width="0px",t.style.height="0px",this.gm.mapAdapter.createDomMarker({anchor:"center",element:t},e)}onMouseMove(e){if(He(e,{warning:!0})&&this.marker)if(this.snapping&&this.snappingHelper){const t=[e.point.x,e.point.y],i=this.snappingHelper.getSnappedLngLat(e.lngLat.toArray(),t);this.marker.setLngLat(i)}else this.marker.setLngLat(e.lngLat.toArray());return{next:!0}}syncTmpMarker(e){this.tmpMarker||(this.tmpMarker=this.createMarker(e)),this.tmpMarker.setLngLat(e)}},Of="waitForBaseMap aborted",Xb=class{mapAdapterInstance=null;globalLngLatBounds=this.getGlobalLngLatBounds();features;loaded=!1;destroyed=!1;options;events;control;actionInstances={};markerPointer;_pendingBaseMapCleanup;_pendingBaseMapAbort;_pendingBaseMapWait;constructor(e,t={}){this.options=this.initCoreOptions(t),this.events=this.initCoreEvents(),this.features=this.initCoreFeatures(),this.control=this.initCoreControls(),this.markerPointer=this.initMarkerPointer(),this.mapAdapterInstance=Yb(this,e),this.waitForBaseMap().then(this.init.bind(this)).catch(i=>{i instanceof Error&&i.message.includes(Of)&&this.destroyed||(ee.error("Geoman initialization failed:",i),this.destroy().then())})}get drawClassMap(){return Vu}get editClassMap(){return ul}get helperClassMap(){return ll}get mapAdapter(){if(this.mapAdapterInstance)return this.mapAdapterInstance;throw ee.trace("Map adapter is not initialized"),new Error("Map adapter is not initialized")}initCoreOptions(e={}){return new Jb(this,e)}initCoreEvents(){return new Ob(this)}initCoreFeatures(){return new Fb(this)}initCoreControls(){return new u2(this)}initMarkerPointer(){return new Vb(this)}addControls(e=void 0){return new Promise(t=>{(async()=>{e?await this.control.createControls(e):this.options.settings.useControlsUi&&this.mapAdapter.addControl(this.control),await this.onMapLoad(),t()})().then()})}async waitForBaseMap(){if(this.mapAdapter.isLoaded())return!0;if(this._pendingBaseMapWait)return await this._pendingBaseMapWait,!0;this._pendingBaseMapWait=Ju({promise:new Promise((e,t)=>{const i=()=>{h(),e(!0)};this.mapAdapter.once("load",i);const s=d=>{const m=d&&typeof d=="object"&&"error"in d?d.error:d;ee.warn("waitForBaseMap: map error during initialization",m)};this.mapAdapter.on("error",s);const u=setInterval(()=>{this.mapAdapter.isLoaded()&&(h(),e(!0))},2e3),c=()=>{document.visibilityState==="visible"&&this.mapAdapter.isLoaded()&&(h(),e(!0))};document.addEventListener("visibilitychange",c);let f=!1;const h=()=>{if(!f){f=!0;try{this.mapAdapter.off("load",i)}catch{}try{this.mapAdapter.off("error",s)}catch{}try{clearInterval(u)}catch{}try{document.removeEventListener("visibilitychange",c)}catch{}}};this._pendingBaseMapCleanup=h,this._pendingBaseMapAbort=()=>{h(),t(new Error(Of))},this.mapAdapter.isLoaded()&&(h(),e(!0))}),errorMessage:"waitForBaseMap failed",onTimeout:()=>{this._pendingBaseMapCleanup?.(),this._pendingBaseMapCleanup=void 0,this._pendingBaseMapAbort=void 0}});try{await this._pendingBaseMapWait}finally{this._pendingBaseMapWait=void 0,this._pendingBaseMapCleanup=void 0,this._pendingBaseMapAbort=void 0}return!0}async waitForGeomanLoaded(){if(this.loaded)return this;if(this.destroyed)return;if(!await this.waitForBaseMap()){ee.error("Map instance is not available");return}const e="gm:loaded";let t;return await Ju({promise:new Promise(i=>{t=()=>i(this),this.mapAdapter.once(e,t),this.loaded&&(this.mapAdapter.off(e,t),i(this))}),errorMessage:"waitForGeomanLoaded failed",onTimeout:()=>{t&&this.mapAdapter.off(e,t)}}),this}async init(){this.destroyed||(this.features.init(),!this.destroyed&&await this.addControls())}async destroy({removeSources:e}={removeSources:!1}){if(this.destroyed=!0,this.mapAdapterInstance&&this.mapAdapterInstance.removeGmInstance(),this._pendingBaseMapAbort?.(),this._pendingBaseMapAbort=void 0,this._pendingBaseMapCleanup=void 0,this._pendingBaseMapWait=void 0,this.loaded?(await this.removeControls(),this.mapAdapter.removeImage("default-marker")):this.events.bus.detachAllEvents(),e)for(const t of Object.values(this.features.sources))t&&t.remove()}async removeControls(){await this.disableAllModes(),this.options.settings.useControlsUi&&this.mapAdapter.removeControl(this.control)}async onMapLoad(){if(this.loaded||this.destroyed||(await this.mapAdapter.loadImage({id:"default-marker",image:dm}),this.destroyed))return;const e={name:`${se}:control:load`,level:"system",actionType:"control",action:"loaded"};await this.events.fire(`${se}:control`,e),this.loaded=!0}async disableAllModes(){for(const e of Ke(this.actionInstances)){const[t,i]=e.split("__");e2(t)&&i2(i)&&await this.options.disableMode(t,i)}}getActiveDrawModes(){return Ke(this.actionInstances).map(e=>{const t=this.actionInstances[e];return t instanceof lr?t.mode:null}).filter(e=>e!==null)}getActiveEditModes(){return Ke(this.actionInstances).map(e=>{const t=this.actionInstances[e];return t instanceof aa?t.mode:null}).filter(e=>e!==null)}getActiveHelperModes(){return Ke(this.actionInstances).map(e=>{const t=this.actionInstances[e];return t instanceof Sr?t.mode:null}).filter(e=>e!==null)}getGlobalLngLatBounds(){return[[-179.99999,-85.051129],[179.99999,85.051129]]}setGlobalEventsListener(e=null){this.events.bus.forwarder.globalEventsListener=e}createSvgMarkerElement(e,t=void 0){const i=this.options.settings.markerIcons;i[e]||ee.error(`createMarkerElement: marker type "${e}" not found`);const s=document.createElement("div");s.classList.add("marker-wrapper"),s.style.lineHeight="0",s.innerHTML=i[e]||"NO_ICON";const u=s.firstChild;if(typeof u!="object")throw ee.error(`createMarkerElement: no icon "${e}" found`),new Error(`No icon "${e}" found`);return t&&Object.assign(u.style,t),s}async enableMode(e,t){await this.options.enableMode(e,t)}async disableMode(e,t){await this.options.disableMode(e,t)}async toggleMode(e,t){await this.options.toggleMode(e,t)}isModeEnabled(e,t){return this.options.isModeEnabled(e,t)}async enableDraw(e){await this.options.enableMode("draw",e)}async disableDraw(){for(const e of this.getActiveDrawModes())await this.options.disableMode("draw",e)}async toggleDraw(e){await this.options.toggleMode("draw",e)}drawEnabled(e){return this.options.isModeEnabled("draw",e)}async enableGlobalDragMode(){await this.options.enableMode("edit","drag")}async disableGlobalDragMode(){await this.options.disableMode("edit","drag")}async toggleGlobalDragMode(){await this.options.toggleMode("edit","drag")}globalDragModeEnabled(){return this.options.isModeEnabled("edit","drag")}async enableGlobalEditMode(){await this.options.enableMode("edit","change")}async disableGlobalEditMode(){await this.options.disableMode("edit","change")}async toggleGlobalEditMode(){await this.options.toggleMode("edit","change")}globalEditModeEnabled(){return this.options.isModeEnabled("edit","change")}async enableGlobalRotateMode(){await this.options.enableMode("edit","rotate")}async disableGlobalRotateMode(){await this.options.disableMode("edit","rotate")}async toggleGlobalRotateMode(){await this.options.toggleMode("edit","rotate")}globalRotateModeEnabled(){return this.options.isModeEnabled("edit","rotate")}async enableGlobalCutMode(){await this.options.enableMode("edit","cut")}async disableGlobalCutMode(){await this.options.disableMode("edit","cut")}async toggleGlobalCutMode(){await this.options.toggleMode("edit","cut")}globalCutModeEnabled(){return this.options.isModeEnabled("edit","cut")}async enableGlobalRemovalMode(){await this.options.enableMode("edit","delete")}async disableGlobalRemovalMode(){await this.options.disableMode("edit","delete")}async toggleGlobalRemovalMode(){await this.options.toggleMode("edit","delete")}globalRemovalModeEnabled(){return this.options.isModeEnabled("edit","delete")}};exports.Geoman=Xb;
|