@zhuyukeji/z-map-vue2 1.0.5

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 ADDED
@@ -0,0 +1,74 @@
1
+ **@zhuyukeji/z-map-vue2**是一个gis地图可视化插件,用于交互式地图。
2
+
3
+ **安装**
4
+
5
+ 使用 npm 或 yarn 安装
6
+
7
+ 推荐使用 npm 或 yarn 的方式进行开发,不仅可在开发环境轻松调试,也可放心地在生产环境打包部署使用,享受整个生态圈和工具链带来的诸多好处。
8
+ ``` js
9
+ $ npm install @zhuyukeji/z-map-vue2
10
+ $ npm install mapbox-gl
11
+ ```
12
+
13
+ ``` js
14
+ $ yarn add @zhuyukeji/z-map-vue2
15
+ $ yarn add mapbox-gl
16
+ ```
17
+
18
+ **引入**
19
+ ``` js
20
+ import { ZMap } from '@zhuyukeji/z-map-vue2'
21
+ ```
22
+
23
+ **引入样式**
24
+ ``` js
25
+ import '@zhuyukeji/z-map-vue2/es/ZMap/style/style.css'
26
+ ```
27
+
28
+ **组件示例**
29
+ ``` js
30
+ <ZMap ref="ZMap" :mapStyle="mapStyle" :cityMap="cityMap" :baseMap="baseMap" :farmMap="farmMap" :pointMap="pointMap" :center="center"
31
+ :mapKey="mapKey" @point-click="pointClick" @farm-click="farmClick"></ZMap>
32
+ ```
33
+
34
+ ## 参数
35
+
36
+ | [属性]| [说明]| [类型]| [默认值]| [版本] |
37
+ | --- | --- | --- | --- | --- |
38
+ mapKey | mapbox的key | String | '' | 1.2.3 |
39
+ mapStyle| 地图瓦片样式 | Object | null | 1.2.3 |
40
+ isProminent | 是否凸显中间基地,city/base | String | base | 1.2.3 |
41
+ cityMap| 城市地图数据 | Object/String | geojson | 1.2.3 |
42
+ baseMap| 基地地图数据 | Array/String | [{title: "",id: "",mapPosition: "",}] | 1.2.3 |
43
+ farmMap| 场景地图数据 | Array/String | [{title: "",id: "",mapPosition: "",}] | 1.2.3 |
44
+ pointMap| 地图点数据 | Array | [] | 1.2.3 |
45
+ heatMap| 热力数据 | Array | [] | 1.2.3 |
46
+ center| 地图中心点 | Array | [] | 1.2.3 |
47
+ minZoom| 最小放缩值 | Number | 0 | 1.2.3 |
48
+ maxZoom| 最大放缩值 | Number | 20 | 1.2.3 |
49
+ zoom| 放缩值 | Number | 6.5 | 1.2.3 |
50
+ pitch| 地图倾斜角度 | Number | 0 | 1.2.3 |
51
+ prominentFillColor| 地图外部区域蒙层颜色 | String | 'rgba(0, 0, 0, 0.5)' | 1.2.3 |
52
+
53
+ # baseMap
54
+ | [属性]| [说明]| [类型]| [默认值]| [版本] |
55
+ | --- | --- | --- | --- | --- |
56
+
57
+ # farmMap
58
+ | [属性]| [说明]| [类型]| [默认值]| [版本] |
59
+ | --- | --- | --- | --- | --- |
60
+
61
+ # pointMap
62
+ | [属性]| [说明]| [类型]| [默认值]| [版本] |
63
+ | --- | --- | --- | --- | --- |
64
+
65
+
66
+ ## 事件
67
+
68
+ | [属性]| [说明]| [返回]| [版本] |
69
+ | --- | --- | --- | --- |
70
+ farm-click| 点击场景地图返回事件 | id | 1.2.3 |
71
+ point-click| 点击地图点返回事件 | id | 1.2.3 |
72
+ city-click| 点击省市区返回事件 | id | 1.2.3 |
73
+ base-click| 点击基地返回事件 | id | 1.2.3 |
74
+ heat-click| 点击热力返回事件 | id | 1.2.3 |
@@ -0,0 +1,24 @@
1
+ import t from"mapbox-gl";function e(t){if(!t)throw new Error("obj is required");var e;if(t.length?e=t:t.coordinates?e=t.coordinates:t.geometry&&t.geometry.coordinates&&(e=t.geometry.coordinates),e)return n(e),e;throw new Error("No valid coordinates")}function n(t){if(t.length>1&&"number"==typeof t[0]&&"number"==typeof t[1])return!0;if(Array.isArray(t[0])&&t[0].length)return n(t[0]);throw new Error("coordinates must only contain numbers")}var r=function(t){if(!t)throw new Error("obj is required");var n=e(t);if(n.length>1&&"number"==typeof n[0]&&"number"==typeof n[1])return n;throw new Error("Coordinate is not a valid Point")};var i={miles:3960,nauticalmiles:3441.145,degrees:57.2957795,radians:1,inches:250905600,yards:6969600,meters:6373e3,metres:6373e3,centimeters:6373e5,centimetres:6373e5,kilometers:6373,kilometres:6373,feet:20908792.65};function o(t,e){if(null==t)throw new Error("radians is required");var n=i[e||"kilometers"];if(!n)throw new Error("units is invalid");return t*n}var s=r,a=o;function l(t,e,n){if(null!==t){var r,i,o,s,a,u,h,c,p,f,y=0,g=0,d=t.type,m="FeatureCollection"===d,x="Feature"===d,v=m?t.features.length:1;for(r=0;r<v;r++)for(h=(f=!!(p=m?t.features[r].geometry:x?t.geometry:t)&&"GeometryCollection"===p.type)?p.geometries.length:1,i=0;i<h;i++){var b=0;if(null!==(u=f?p.geometries[i]:p)){c=u.coordinates;var w=u.type;switch(y=!n||"Polygon"!==w&&"MultiPolygon"!==w?0:1,w){case null:break;case"Point":e(c,g,r,b),g++,b++;break;case"LineString":case"MultiPoint":for(o=0;o<c.length;o++)e(c[o],g,r,b),g++,"MultiPoint"===w&&b++;"LineString"===w&&b++;break;case"Polygon":case"MultiLineString":for(o=0;o<c.length;o++){for(s=0;s<c[o].length-y;s++)e(c[o][s],g,r,b),g++;"MultiLineString"===w&&b++}"Polygon"===w&&b++;break;case"MultiPolygon":for(o=0;o<c.length;o++){for(s=0;s<c[o].length;s++)for(a=0;a<c[o][s].length-y;a++)e(c[o][s][a],g,r,b),g++;b++}break;case"GeometryCollection":for(o=0;o<u.geometries.length;o++)l(u.geometries[o],e,n);break;default:throw new Error("Unknown Geometry Type")}}}}}function u(t,e,n,r){var i=n;return l(t,(function(t,r,o,s){i=0===r&&void 0===n?t:e(i,t,r,o,s)}),r),i}function h(t,e){var n;switch(t.type){case"FeatureCollection":for(n=0;n<t.features.length;n++)e(t.features[n].properties,n);break;case"Feature":e(t.properties,0)}}function c(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var n=0;n<t.features.length;n++)e(t.features[n],n)}function p(t,e){var n,r,i,o,s,a,l,u,h=0,c="FeatureCollection"===t.type,p="Feature"===t.type,f=c?t.features.length:1;for(n=0;n<f;n++){for(a=c?t.features[n].geometry:p?t.geometry:t,u=c?t.features[n].properties:p?t.properties:{},s=(l=!!a&&"GeometryCollection"===a.type)?a.geometries.length:1,i=0;i<s;i++)if(null!==(o=l?a.geometries[i]:a))switch(o.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":e(o,h,u);break;case"GeometryCollection":for(r=0;r<o.geometries.length;r++)e(o.geometries[r],h,u);break;default:throw new Error("Unknown Geometry Type")}else e(null,h,u);h++}}function f(t,e){p(t,(function(t,n,r){var i,o=null===t?null:t.type;switch(o){case null:case"Point":case"LineString":case"Polygon":return void e(g(t,r),n,0)}switch(o){case"MultiPoint":i="Point";break;case"MultiLineString":i="LineString";break;case"MultiPolygon":i="Polygon"}t.coordinates.forEach((function(t,o){e(g({type:i,coordinates:t},r),n,o)}))}))}function y(t,e){f(t,(function(t,n,r){var i=0;if(t.geometry){var o=t.geometry.type;"Point"!==o&&"MultiPoint"!==o&&u(t,(function(o,s){var a=d([o,s],t.properties);return e(a,n,r,i),i++,s}))}}))}function g(t,e){if(void 0===t)throw new Error("No geometry passed");return{type:"Feature",properties:e||{},geometry:t}}function d(t,e){if(!t)throw new Error("No coordinates passed");if(t.length<2)throw new Error("Coordinates must be an array of two or more positions");return{type:"Feature",properties:e||{},geometry:{type:"LineString",coordinates:t}}}function m(t,e){if(!t)throw new Error("geojson is required");var n=t.geometry?t.geometry.type:t.type;if(!n)throw new Error("invalid geojson");if("FeatureCollection"===n)throw new Error("FeatureCollection is not supported");if("GeometryCollection"===n)throw new Error("GeometryCollection is not supported");var r=t.geometry?t.geometry.coordinates:t.coordinates;if(!r)throw new Error("geojson must contain coordinates");switch(n){case"LineString":return void e(r,0,0);case"Polygon":case"MultiLineString":for(var i=0,o=0;o<r.length;o++)"MultiLineString"===n&&(i=o),e(r[o],o,i);return;case"MultiPolygon":for(var s=0;s<r.length;s++)for(var a=0;a<r[s].length;a++)e(r[s][a],a,s);return;default:throw new Error(n+" geometry not supported")}}var x=Object.freeze({__proto__:null,coordAll:function(t){var e=[];return l(t,(function(t){e.push(t)})),e},coordEach:l,coordReduce:u,feature:g,featureEach:c,featureReduce:function(t,e,n){var r=n;return c(t,(function(t,i){r=0===i&&void 0===n?t:e(r,t,i)})),r},flattenEach:f,flattenReduce:function(t,e,n){var r=n;return f(t,(function(t,i,o){r=0===i&&0===o&&void 0===n?t:e(r,t,i,o)})),r},geomEach:p,geomReduce:function(t,e,n){var r=n;return p(t,(function(t,i,o){r=0===i&&void 0===n?t:e(r,t,i,o)})),r},lineEach:m,lineReduce:function(t,e,n){var r=n;return m(t,(function(t,i,o){r=0===i&&void 0===n?t:e(r,t,i,o)})),r},lineString:d,propEach:h,propReduce:function(t,e,n){var r=n;return h(t,(function(t,i){r=0===i&&void 0===n?t:e(r,t,i)})),r},segmentEach:y,segmentReduce:function(t,e,n){var r=n,i=!1;return y(t,(function(t,o,s,a){r=!1===i&&void 0===n?t:e(r,t,o,s,a),i=!0})),r}}).segmentReduce,v=function(t,e){if(!t)throw new Error("geojson is required");return x(t,(function(t,n){var r=n.geometry.coordinates;return t+function(t,e,n){var r=Math.PI/180,i=s(t),o=s(e),l=r*(o[1]-i[1]),u=r*(o[0]-i[0]),h=r*i[1],c=r*o[1],p=Math.pow(Math.sin(l/2),2)+Math.pow(Math.sin(u/2),2)*Math.cos(h)*Math.cos(c);return a(2*Math.atan2(Math.sqrt(p),Math.sqrt(1-p)),n)}(r[0],r[1],e)}),0)},b=6371008.8,w={centimeters:637100880,centimetres:637100880,degrees:57.22891354143274,feet:20902260.511392,inches:39.37*b,kilometers:6371.0088,kilometres:6371.0088,meters:b,metres:b,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:b/1852,radians:1,yards:6967335.223679999};function E(t,e,n){void 0===n&&(n={});var r={type:"Feature"};return(0===n.id||n.id)&&(r.id=n.id),n.bbox&&(r.bbox=n.bbox),r.properties=e||{},r.geometry=t,r}function S(t,e,n){if(void 0===n&&(n={}),!t)throw new Error("coordinates is required");if(!Array.isArray(t))throw new Error("coordinates must be an Array");if(t.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!M(t[0])||!M(t[1]))throw new Error("coordinates must contain numbers");return E({type:"Point",coordinates:t},e,n)}function _(t){return 180*(t%(2*Math.PI))/Math.PI}function P(t){return t%360*Math.PI/180}function M(t){return!isNaN(t)&&null!==t&&!Array.isArray(t)}function k(t){if(!t)throw new Error("coord is required");if(!Array.isArray(t)){if("Feature"===t.type&&null!==t.geometry&&"Point"===t.geometry.type)return t.geometry.coordinates;if("Point"===t.type)return t.coordinates}if(Array.isArray(t)&&t.length>=2&&!Array.isArray(t[0])&&!Array.isArray(t[1]))return t;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function C(t){return"Feature"===t.type?t.geometry:t}function I(t,e,n){if(void 0===n&&(n={}),!0===n.final)return function(t,e){var n=I(e,t);return n=(n+180)%360}(t,e);var r=k(t),i=k(e),o=P(r[0]),s=P(i[0]),a=P(r[1]),l=P(i[1]),u=Math.sin(s-o)*Math.cos(l),h=Math.cos(a)*Math.sin(l)-Math.sin(a)*Math.cos(l)*Math.cos(s-o);return _(Math.atan2(u,h))}function R(t,e,n,r){void 0===r&&(r={});var i=k(t),o=P(i[0]),s=P(i[1]),a=P(n),l=function(t,e){void 0===e&&(e="kilometers");var n=w[e];if(!n)throw new Error(e+" units is invalid");return t/n}(e,r.units),u=Math.asin(Math.sin(s)*Math.cos(l)+Math.cos(s)*Math.sin(l)*Math.cos(a));return S([_(o+Math.atan2(Math.sin(a)*Math.sin(l)*Math.cos(s),Math.cos(l)-Math.sin(s)*Math.sin(u))),_(u)],r.properties)}function L(t,e,n){void 0===n&&(n={});var r=k(t),i=k(e),o=P(i[1]-r[1]),s=P(i[0]-r[0]),a=P(r[1]),l=P(i[1]),u=Math.pow(Math.sin(o/2),2)+Math.pow(Math.sin(s/2),2)*Math.cos(a)*Math.cos(l);return function(t,e){void 0===e&&(e="kilometers");var n=w[e];if(!n)throw new Error(e+" units is invalid");return t*n}(2*Math.atan2(Math.sqrt(u),Math.sqrt(1-u)),n.units)}function A(t){return A="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},A(t)}function T(t){return function(t){if(Array.isArray(t))return B(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return B(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return B(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function B(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var z,O,N=(z=function(t,e){t.exports=function(){
2
+ /**
3
+ * splaytree v3.1.2
4
+ * Fast Splay tree for Node and browser
5
+ *
6
+ * @author Alexander Milevski <info@w8r.name>
7
+ * @license MIT
8
+ * @preserve
9
+ */
10
+ /*! *****************************************************************************
11
+ Copyright (c) Microsoft Corporation. All rights reserved.
12
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
13
+ this file except in compliance with the License. You may obtain a copy of the
14
+ License at http://www.apache.org/licenses/LICENSE-2.0
15
+
16
+ THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17
+ KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
18
+ WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
19
+ MERCHANTABLITY OR NON-INFRINGEMENT.
20
+
21
+ See the Apache Version 2.0 License for specific language governing permissions
22
+ and limitations under the License.
23
+ ***************************************************************************** */
24
+ function t(t,e){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(t){return function(e){return l([t,e])}}function l(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}}var e=function(){function t(t,e){this.next=null,this.key=t,this.data=e,this.left=null,this.right=null}return t}();function n(t,e){return t>e?1:t<e?-1:0}function r(t,n,r){for(var i=new e(null,null),o=i,s=i;;){var a=r(t,n.key);if(a<0){if(null===n.left)break;if(r(t,n.left.key)<0){var l=n.left;if(n.left=l.right,l.right=n,null===(n=l).left)break}s.left=n,s=n,n=n.left}else{if(!(a>0))break;if(null===n.right)break;if(r(t,n.right.key)>0&&(l=n.right,n.right=l.left,l.left=n,null===(n=l).right))break;o.right=n,o=n,n=n.right}}return o.right=n.left,s.left=n.right,n.left=i.right,n.right=i.left,n}function i(t,n,i,o){var s=new e(t,n);if(null===i)return s.left=s.right=null,s;var a=o(t,(i=r(t,i,o)).key);return a<0?(s.left=i.left,s.right=i,i.left=null):a>=0&&(s.right=i.right,s.left=i,i.right=null),s}function o(t,e,n){var i=null,o=null;if(e){var s=n((e=r(t,e,n)).key,t);0===s?(i=e.left,o=e.right):s<0?(o=e.right,e.right=null,i=e):(i=e.left,e.left=null,o=e)}return{left:i,right:o}}function s(t,e,n){return null===e?t:(null===t||((e=r(t.key,e,n)).left=t),e)}function a(t,e,n,r,i){if(t){r(e+(n?"└── ":"├── ")+i(t)+"\n");var o=e+(n?" ":"│ ");t.left&&a(t.left,o,!1,r,i),t.right&&a(t.right,o,!0,r,i)}}var l=function(){function l(t){void 0===t&&(t=n),this._root=null,this._size=0,this._comparator=t}return l.prototype.insert=function(t,e){return this._size++,this._root=i(t,e,this._root,this._comparator)},l.prototype.add=function(t,n){var i=new e(t,n);null===this._root&&(i.left=i.right=null,this._size++,this._root=i);var o=this._comparator,s=r(t,this._root,o),a=o(t,s.key);return 0===a?this._root=s:(a<0?(i.left=s.left,i.right=s,s.left=null):a>0&&(i.right=s.right,i.left=s,s.right=null),this._size++,this._root=i),this._root},l.prototype.remove=function(t){this._root=this._remove(t,this._root,this._comparator)},l.prototype._remove=function(t,e,n){var i;return null===e?null:0===n(t,(e=r(t,e,n)).key)?(null===e.left?i=e.right:(i=r(t,e.left,n)).right=e.right,this._size--,i):e},l.prototype.pop=function(){var t=this._root;if(t){for(;t.left;)t=t.left;return this._root=r(t.key,this._root,this._comparator),this._root=this._remove(t.key,this._root,this._comparator),{key:t.key,data:t.data}}return null},l.prototype.findStatic=function(t){for(var e=this._root,n=this._comparator;e;){var r=n(t,e.key);if(0===r)return e;e=r<0?e.left:e.right}return null},l.prototype.find=function(t){return this._root&&(this._root=r(t,this._root,this._comparator),0!==this._comparator(t,this._root.key))?null:this._root},l.prototype.contains=function(t){for(var e=this._root,n=this._comparator;e;){var r=n(t,e.key);if(0===r)return!0;e=r<0?e.left:e.right}return!1},l.prototype.forEach=function(t,e){for(var n=this._root,r=[],i=!1;!i;)null!==n?(r.push(n),n=n.left):0!==r.length?(n=r.pop(),t.call(e,n),n=n.right):i=!0;return this},l.prototype.range=function(t,e,n,r){for(var i=[],o=this._comparator,s=this._root;0!==i.length||s;)if(s)i.push(s),s=s.left;else{if(o((s=i.pop()).key,e)>0)break;if(o(s.key,t)>=0&&n.call(r,s))return this;s=s.right}return this},l.prototype.keys=function(){var t=[];return this.forEach((function(e){var n=e.key;return t.push(n)})),t},l.prototype.values=function(){var t=[];return this.forEach((function(e){var n=e.data;return t.push(n)})),t},l.prototype.min=function(){return this._root?this.minNode(this._root).key:null},l.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},l.prototype.minNode=function(t){if(void 0===t&&(t=this._root),t)for(;t.left;)t=t.left;return t},l.prototype.maxNode=function(t){if(void 0===t&&(t=this._root),t)for(;t.right;)t=t.right;return t},l.prototype.at=function(t){for(var e=this._root,n=!1,r=0,i=[];!n;)if(e)i.push(e),e=e.left;else if(i.length>0){if(e=i.pop(),r===t)return e;r++,e=e.right}else n=!0;return null},l.prototype.next=function(t){var e=this._root,n=null;if(t.right){for(n=t.right;n.left;)n=n.left;return n}for(var r=this._comparator;e;){var i=r(t.key,e.key);if(0===i)break;i<0?(n=e,e=e.left):e=e.right}return n},l.prototype.prev=function(t){var e=this._root,n=null;if(null!==t.left){for(n=t.left;n.right;)n=n.right;return n}for(var r=this._comparator;e;){var i=r(t.key,e.key);if(0===i)break;i<0?e=e.left:(n=e,e=e.right)}return n},l.prototype.clear=function(){return this._root=null,this._size=0,this},l.prototype.toList=function(){return c(this._root)},l.prototype.load=function(t,e,n){void 0===e&&(e=[]),void 0===n&&(n=!1);var r=t.length,i=this._comparator;if(n&&y(t,e,0,r-1,i),null===this._root)this._root=u(t,e,0,r),this._size=r;else{var o=f(this.toList(),h(t,e),i);r=this._size+r,this._root=p({head:o},0,r)}return this},l.prototype.isEmpty=function(){return null===this._root},Object.defineProperty(l.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),l.prototype.toString=function(t){void 0===t&&(t=function(t){return String(t.key)});var e=[];return a(this._root,"",!0,(function(t){return e.push(t)}),t),e.join("")},l.prototype.update=function(t,e,n){var r=this._comparator,a=o(t,this._root,r),l=a.left,u=a.right;r(t,e)<0?u=i(e,n,u,r):l=i(e,n,l,r),this._root=s(l,u,r)},l.prototype.split=function(t){return o(t,this._root,this._comparator)},l.prototype[Symbol.iterator]=function(){var e,n,r;return t(this,(function(t){switch(t.label){case 0:e=this._root,n=[],r=!1,t.label=1;case 1:return r?[3,6]:null===e?[3,2]:(n.push(e),e=e.left,[3,5]);case 2:return 0===n.length?[3,4]:[4,e=n.pop()];case 3:return t.sent(),e=e.right,[3,5];case 4:r=!0,t.label=5;case 5:return[3,1];case 6:return[2]}}))},l}();function u(t,n,r,i){var o=i-r;if(o>0){var s=r+Math.floor(o/2),a=t[s],l=n[s],h=new e(a,l);return h.left=u(t,n,r,s),h.right=u(t,n,s+1,i),h}return null}function h(t,n){for(var r=new e(null,null),i=r,o=0;o<t.length;o++)i=i.next=new e(t[o],n[o]);return i.next=null,r.next}function c(t){for(var n=t,r=[],i=!1,o=new e(null,null),s=o;!i;)n?(r.push(n),n=n.left):r.length>0?n=(n=s=s.next=r.pop()).right:i=!0;return s.next=null,o.next}function p(t,e,n){var r=n-e;if(r>0){var i=e+Math.floor(r/2),o=p(t,e,i),s=t.head;return s.left=o,t.head=t.head.next,s.right=p(t,i+1,n),s}return null}function f(t,n,r){for(var i=new e(null,null),o=i,s=t,a=n;null!==s&&null!==a;)r(s.key,a.key)<0?(o.next=s,s=s.next):(o.next=a,a=a.next),o=o.next;return null!==s?o.next=s:null!==a&&(o.next=a),i.next}function y(t,e,n,r,i){if(!(n>=r)){for(var o=t[n+r>>1],s=n-1,a=r+1;;){do{s++}while(i(t[s],o)<0);do{a--}while(i(t[a],o)>0);if(s>=a)break;var l=t[s];t[s]=t[a],t[a]=l,l=e[s],e[s]=e[a],e[a]=l}y(t,e,n,a,i),y(t,e,a+1,r,i)}}const g=(t,e)=>t.ll.x<=e.x&&e.x<=t.ur.x&&t.ll.y<=e.y&&e.y<=t.ur.y,d=(t,e)=>{if(e.ur.x<t.ll.x||t.ur.x<e.ll.x||e.ur.y<t.ll.y||t.ur.y<e.ll.y)return null;const n=t.ll.x<e.ll.x?e.ll.x:t.ll.x,r=t.ur.x<e.ur.x?t.ur.x:e.ur.x;return{ll:{x:n,y:t.ll.y<e.ll.y?e.ll.y:t.ll.y},ur:{x:r,y:t.ur.y<e.ur.y?t.ur.y:e.ur.y}}};let m=Number.EPSILON;void 0===m&&(m=Math.pow(2,-52));const x=m*m,v=(t,e)=>{if(-m<t&&t<m&&-m<e&&e<m)return 0;const n=t-e;return n*n<x*t*e?0:t<e?-1:1};class b{constructor(){this.reset()}reset(){this.xRounder=new w,this.yRounder=new w}round(t,e){return{x:this.xRounder.round(t),y:this.yRounder.round(e)}}}class w{constructor(){this.tree=new l,this.round(0)}round(t){const e=this.tree.add(t),n=this.tree.prev(e);if(null!==n&&0===v(e.key,n.key))return this.tree.remove(t),n.key;const r=this.tree.next(e);return null!==r&&0===v(e.key,r.key)?(this.tree.remove(t),r.key):t}}const E=new b,S=11102230246251565e-32,_=134217729,P=(3+8*S)*S;function M(t,e,n,r,i){let o,s,a,l,u=e[0],h=r[0],c=0,p=0;h>u==h>-u?(o=u,u=e[++c]):(o=h,h=r[++p]);let f=0;if(c<t&&p<n)for(h>u==h>-u?(s=u+o,a=o-(s-u),u=e[++c]):(s=h+o,a=o-(s-h),h=r[++p]),o=s,0!==a&&(i[f++]=a);c<t&&p<n;)h>u==h>-u?(s=o+u,l=s-o,a=o-(s-l)+(u-l),u=e[++c]):(s=o+h,l=s-o,a=o-(s-l)+(h-l),h=r[++p]),o=s,0!==a&&(i[f++]=a);for(;c<t;)s=o+u,l=s-o,a=o-(s-l)+(u-l),u=e[++c],o=s,0!==a&&(i[f++]=a);for(;p<n;)s=o+h,l=s-o,a=o-(s-l)+(h-l),h=r[++p],o=s,0!==a&&(i[f++]=a);return 0===o&&0!==f||(i[f++]=o),f}function k(t,e){let n=e[0];for(let r=1;r<t;r++)n+=e[r];return n}function C(t){return new Float64Array(t)}const I=(3+16*S)*S,R=(2+12*S)*S,L=(9+64*S)*S*S,A=C(4),T=C(8),B=C(12),z=C(16),O=C(4);function N(t,e,n,r,i,o,s){let a,l,u,h,c,p,f,y,g,d,m,x,v,b,w,E,S,C;const I=t-i,N=n-i,F=e-o,j=r-o;b=I*j,p=_*I,f=p-(p-I),y=I-f,p=_*j,g=p-(p-j),d=j-g,w=y*d-(b-f*g-y*g-f*d),E=F*N,p=_*F,f=p-(p-F),y=F-f,p=_*N,g=p-(p-N),d=N-g,S=y*d-(E-f*g-y*g-f*d),m=w-S,c=w-m,A[0]=w-(m+c)+(c-S),x=b+m,c=x-b,v=b-(x-c)+(m-c),m=v-E,c=v-m,A[1]=v-(m+c)+(c-E),C=x+m,c=C-x,A[2]=x-(C-c)+(m-c),A[3]=C;let $=k(4,A),q=R*s;if($>=q||-$>=q)return $;if(c=t-I,a=t-(I+c)+(c-i),c=n-N,u=n-(N+c)+(c-i),c=e-F,l=e-(F+c)+(c-o),c=r-j,h=r-(j+c)+(c-o),0===a&&0===l&&0===u&&0===h)return $;if(q=L*s+P*Math.abs($),$+=I*h+j*a-(F*u+N*l),$>=q||-$>=q)return $;b=a*j,p=_*a,f=p-(p-a),y=a-f,p=_*j,g=p-(p-j),d=j-g,w=y*d-(b-f*g-y*g-f*d),E=l*N,p=_*l,f=p-(p-l),y=l-f,p=_*N,g=p-(p-N),d=N-g,S=y*d-(E-f*g-y*g-f*d),m=w-S,c=w-m,O[0]=w-(m+c)+(c-S),x=b+m,c=x-b,v=b-(x-c)+(m-c),m=v-E,c=v-m,O[1]=v-(m+c)+(c-E),C=x+m,c=C-x,O[2]=x-(C-c)+(m-c),O[3]=C;const G=M(4,A,4,O,T);b=I*h,p=_*I,f=p-(p-I),y=I-f,p=_*h,g=p-(p-h),d=h-g,w=y*d-(b-f*g-y*g-f*d),E=F*u,p=_*F,f=p-(p-F),y=F-f,p=_*u,g=p-(p-u),d=u-g,S=y*d-(E-f*g-y*g-f*d),m=w-S,c=w-m,O[0]=w-(m+c)+(c-S),x=b+m,c=x-b,v=b-(x-c)+(m-c),m=v-E,c=v-m,O[1]=v-(m+c)+(c-E),C=x+m,c=C-x,O[2]=x-(C-c)+(m-c),O[3]=C;const U=M(G,T,4,O,B);b=a*h,p=_*a,f=p-(p-a),y=a-f,p=_*h,g=p-(p-h),d=h-g,w=y*d-(b-f*g-y*g-f*d),E=l*u,p=_*l,f=p-(p-l),y=l-f,p=_*u,g=p-(p-u),d=u-g,S=y*d-(E-f*g-y*g-f*d),m=w-S,c=w-m,O[0]=w-(m+c)+(c-S),x=b+m,c=x-b,v=b-(x-c)+(m-c),m=v-E,c=v-m,O[1]=v-(m+c)+(c-E),C=x+m,c=C-x,O[2]=x-(C-c)+(m-c),O[3]=C;const J=M(U,B,4,O,z);return z[J-1]}function F(t,e,n,r,i,o){const s=(e-o)*(n-i),a=(t-i)*(r-o),l=s-a,u=Math.abs(s+a);return Math.abs(l)>=I*u?l:-N(t,e,n,r,i,o,u)}const j=(t,e)=>t.x*e.y-t.y*e.x,$=(t,e)=>t.x*e.x+t.y*e.y,q=(t,e,n)=>{const r=F(t.x,t.y,e.x,e.y,n.x,n.y);return r>0?-1:r<0?1:0},G=t=>Math.sqrt($(t,t)),U=(t,e,n)=>{const r={x:e.x-t.x,y:e.y-t.y},i={x:n.x-t.x,y:n.y-t.y};return j(i,r)/G(i)/G(r)},J=(t,e,n)=>{const r={x:e.x-t.x,y:e.y-t.y},i={x:n.x-t.x,y:n.y-t.y};return $(i,r)/G(i)/G(r)},Z=(t,e,n)=>0===e.y?null:{x:t.x+e.x/e.y*(n-t.y),y:n},D=(t,e,n)=>0===e.x?null:{x:n,y:t.y+e.y/e.x*(n-t.x)},H=(t,e,n,r)=>{if(0===e.x)return D(n,r,t.x);if(0===r.x)return D(t,e,n.x);if(0===e.y)return Z(n,r,t.y);if(0===r.y)return Z(t,e,n.y);const i=j(e,r);if(0==i)return null;const o={x:n.x-t.x,y:n.y-t.y},s=j(o,e)/i,a=j(o,r)/i;return{x:(t.x+a*e.x+(n.x+s*r.x))/2,y:(t.y+a*e.y+(n.y+s*r.y))/2}};class V{static compare(t,e){const n=V.comparePoints(t.point,e.point);return 0!==n?n:(t.point!==e.point&&t.link(e),t.isLeft!==e.isLeft?t.isLeft?1:-1:X.compare(t.segment,e.segment))}static comparePoints(t,e){return t.x<e.x?-1:t.x>e.x?1:t.y<e.y?-1:t.y>e.y?1:0}constructor(t,e){void 0===t.events?t.events=[this]:t.events.push(this),this.point=t,this.isLeft=e}link(t){if(t.point===this.point)throw new Error("Tried to link already linked events");const e=t.point.events;for(let t=0,n=e.length;t<n;t++){const n=e[t];this.point.events.push(n),n.point=this.point}this.checkForConsuming()}checkForConsuming(){const t=this.point.events.length;for(let e=0;e<t;e++){const n=this.point.events[e];if(void 0===n.segment.consumedBy)for(let r=e+1;r<t;r++){const t=this.point.events[r];void 0===t.consumedBy&&n.otherSE.point.events===t.otherSE.point.events&&n.segment.consume(t.segment)}}}getAvailableLinkedEvents(){const t=[];for(let e=0,n=this.point.events.length;e<n;e++){const n=this.point.events[e];n!==this&&!n.segment.ringOut&&n.segment.isInResult()&&t.push(n)}return t}getLeftmostComparator(t){const e=new Map,n=n=>{const r=n.otherSE;e.set(n,{sine:U(this.point,t.point,r.point),cosine:J(this.point,t.point,r.point)})};return(t,r)=>{e.has(t)||n(t),e.has(r)||n(r);const{sine:i,cosine:o}=e.get(t),{sine:s,cosine:a}=e.get(r);return i>=0&&s>=0?o<a?1:o>a?-1:0:i<0&&s<0?o<a?-1:o>a?1:0:s<i?-1:s>i?1:0}}}let Y=0;class X{static compare(t,e){const n=t.leftSE.point.x,r=e.leftSE.point.x,i=t.rightSE.point.x,o=e.rightSE.point.x;if(o<n)return 1;if(i<r)return-1;const s=t.leftSE.point.y,a=e.leftSE.point.y,l=t.rightSE.point.y,u=e.rightSE.point.y;if(n<r){if(a<s&&a<l)return 1;if(a>s&&a>l)return-1;const n=t.comparePoint(e.leftSE.point);if(n<0)return 1;if(n>0)return-1;const r=e.comparePoint(t.rightSE.point);return 0!==r?r:-1}if(n>r){if(s<a&&s<u)return-1;if(s>a&&s>u)return 1;const n=e.comparePoint(t.leftSE.point);if(0!==n)return n;const r=t.comparePoint(e.rightSE.point);return r<0?1:r>0?-1:1}if(s<a)return-1;if(s>a)return 1;if(i<o){const n=e.comparePoint(t.rightSE.point);if(0!==n)return n}if(i>o){const n=t.comparePoint(e.rightSE.point);if(n<0)return 1;if(n>0)return-1}if(i!==o){const t=l-s,e=i-n,h=u-a,c=o-r;if(t>e&&h<c)return 1;if(t<e&&h>c)return-1}return i>o?1:i<o||l<u?-1:l>u?1:t.id<e.id?-1:t.id>e.id?1:0}constructor(t,e,n,r){this.id=++Y,this.leftSE=t,t.segment=this,t.otherSE=e,this.rightSE=e,e.segment=this,e.otherSE=t,this.rings=n,this.windings=r}static fromRing(t,e,n){let r,i,o;const s=V.comparePoints(t,e);if(s<0)r=t,i=e,o=1;else{if(!(s>0))throw new Error(`Tried to create degenerate segment at [${t.x}, ${t.y}]`);r=e,i=t,o=-1}const a=new V(r,!0),l=new V(i,!1);return new X(a,l,[n],[o])}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,e=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:t<e?t:e},ur:{x:this.rightSE.point.x,y:t>e?t:e}}}vector(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}isAnEndpoint(t){return t.x===this.leftSE.point.x&&t.y===this.leftSE.point.y||t.x===this.rightSE.point.x&&t.y===this.rightSE.point.y}comparePoint(t){if(this.isAnEndpoint(t))return 0;const e=this.leftSE.point,n=this.rightSE.point,r=this.vector();if(e.x===n.x)return t.x===e.x?0:t.x<e.x?1:-1;const i=(t.y-e.y)/r.y,o=e.x+i*r.x;if(t.x===o)return 0;const s=(t.x-e.x)/r.x,a=e.y+s*r.y;return t.y===a?0:t.y<a?-1:1}getIntersection(t){const e=this.bbox(),n=t.bbox(),r=d(e,n);if(null===r)return null;const i=this.leftSE.point,o=this.rightSE.point,s=t.leftSE.point,a=t.rightSE.point,l=g(e,s)&&0===this.comparePoint(s),u=g(n,i)&&0===t.comparePoint(i),h=g(e,a)&&0===this.comparePoint(a),c=g(n,o)&&0===t.comparePoint(o);if(u&&l)return c&&!h?o:!c&&h?a:null;if(u)return h&&i.x===a.x&&i.y===a.y?null:i;if(l)return c&&o.x===s.x&&o.y===s.y?null:s;if(c&&h)return null;if(c)return o;if(h)return a;const p=H(i,this.vector(),s,t.vector());return null===p?null:g(r,p)?E.round(p.x,p.y):null}split(t){const e=[],n=void 0!==t.events,r=new V(t,!0),i=new V(t,!1),o=this.rightSE;this.replaceRightSE(i),e.push(i),e.push(r);const s=new X(r,o,this.rings.slice(),this.windings.slice());return V.comparePoints(s.leftSE.point,s.rightSE.point)>0&&s.swapEvents(),V.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),n&&(r.checkForConsuming(),i.checkForConsuming()),e}swapEvents(){const t=this.rightSE;this.rightSE=this.leftSE,this.leftSE=t,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(let t=0,e=this.windings.length;t<e;t++)this.windings[t]*=-1}consume(t){let e=this,n=t;for(;e.consumedBy;)e=e.consumedBy;for(;n.consumedBy;)n=n.consumedBy;const r=X.compare(e,n);if(0!==r){if(r>0){const t=e;e=n,n=t}if(e.prev===n){const t=e;e=n,n=t}for(let t=0,r=n.rings.length;t<r;t++){const r=n.rings[t],i=n.windings[t],o=e.rings.indexOf(r);-1===o?(e.rings.push(r),e.windings.push(i)):e.windings[o]+=i}n.rings=null,n.windings=null,n.consumedBy=e,n.leftSE.consumedBy=e.leftSE,n.rightSE.consumedBy=e.rightSE}}prevInResult(){return 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(void 0!==this._beforeState)return this._beforeState;if(this.prev){const t=this.prev.consumedBy||this.prev;this._beforeState=t.afterState()}else this._beforeState={rings:[],windings:[],multiPolys:[]};return this._beforeState}afterState(){if(void 0!==this._afterState)return this._afterState;const t=this.beforeState();this._afterState={rings:t.rings.slice(0),windings:t.windings.slice(0),multiPolys:[]};const e=this._afterState.rings,n=this._afterState.windings,r=this._afterState.multiPolys;for(let t=0,r=this.rings.length;t<r;t++){const r=this.rings[t],i=this.windings[t],o=e.indexOf(r);-1===o?(e.push(r),n.push(i)):n[o]+=i}const i=[],o=[];for(let t=0,r=e.length;t<r;t++){if(0===n[t])continue;const r=e[t],s=r.poly;if(-1===o.indexOf(s))if(r.isExterior)i.push(s);else{-1===o.indexOf(s)&&o.push(s);const t=i.indexOf(r.poly);-1!==t&&i.splice(t,1)}}for(let t=0,e=i.length;t<e;t++){const e=i[t].multiPoly;-1===r.indexOf(e)&&r.push(e)}return this._afterState}isInResult(){if(this.consumedBy)return!1;if(void 0!==this._isInResult)return this._isInResult;const t=this.beforeState().multiPolys,e=this.afterState().multiPolys;switch(at.type){case"union":{const n=0===t.length,r=0===e.length;this._isInResult=n!==r;break}case"intersection":{let n,r;t.length<e.length?(n=t.length,r=e.length):(n=e.length,r=t.length),this._isInResult=r===at.numMultiPolys&&n<r;break}case"xor":{const n=Math.abs(t.length-e.length);this._isInResult=n%2==1;break}case"difference":{const n=t=>1===t.length&&t[0].isSubject;this._isInResult=n(t)!==n(e);break}default:throw new Error(`Unrecognized operation type found ${at.type}`)}return this._isInResult}}class K{constructor(t,e,n){if(!Array.isArray(t)||0===t.length)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=e,this.isExterior=n,this.segments=[],"number"!=typeof t[0][0]||"number"!=typeof t[0][1])throw new Error("Input geometry is not a valid Polygon or MultiPolygon");const r=E.round(t[0][0],t[0][1]);this.bbox={ll:{x:r.x,y:r.y},ur:{x:r.x,y:r.y}};let i=r;for(let e=1,n=t.length;e<n;e++){if("number"!=typeof t[e][0]||"number"!=typeof t[e][1])throw new Error("Input geometry is not a valid Polygon or MultiPolygon");let n=E.round(t[e][0],t[e][1]);n.x===i.x&&n.y===i.y||(this.segments.push(X.fromRing(i,n,this)),n.x<this.bbox.ll.x&&(this.bbox.ll.x=n.x),n.y<this.bbox.ll.y&&(this.bbox.ll.y=n.y),n.x>this.bbox.ur.x&&(this.bbox.ur.x=n.x),n.y>this.bbox.ur.y&&(this.bbox.ur.y=n.y),i=n)}r.x===i.x&&r.y===i.y||this.segments.push(X.fromRing(i,r,this))}getSweepEvents(){const t=[];for(let e=0,n=this.segments.length;e<n;e++){const n=this.segments[e];t.push(n.leftSE),t.push(n.rightSE)}return t}}class W{constructor(t,e){if(!Array.isArray(t))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new K(t[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 e=1,n=t.length;e<n;e++){const n=new K(t[e],this,!1);n.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=n.bbox.ll.x),n.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=n.bbox.ll.y),n.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=n.bbox.ur.x),n.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=n.bbox.ur.y),this.interiorRings.push(n)}this.multiPoly=e}getSweepEvents(){const t=this.exteriorRing.getSweepEvents();for(let e=0,n=this.interiorRings.length;e<n;e++){const n=this.interiorRings[e].getSweepEvents();for(let e=0,r=n.length;e<r;e++)t.push(n[e])}return t}}class Q{constructor(t,e){if(!Array.isArray(t))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{"number"==typeof t[0][0][0]&&(t=[t])}catch(t){}this.polys=[],this.bbox={ll:{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY},ur:{x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY}};for(let e=0,n=t.length;e<n;e++){const n=new W(t[e],this);n.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=n.bbox.ll.x),n.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=n.bbox.ll.y),n.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=n.bbox.ur.x),n.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=n.bbox.ur.y),this.polys.push(n)}this.isSubject=e}getSweepEvents(){const t=[];for(let e=0,n=this.polys.length;e<n;e++){const n=this.polys[e].getSweepEvents();for(let e=0,r=n.length;e<r;e++)t.push(n[e])}return t}}class tt{static factory(t){const e=[];for(let n=0,r=t.length;n<r;n++){const r=t[n];if(!r.isInResult()||r.ringOut)continue;let i=null,o=r.leftSE,s=r.rightSE;const a=[o],l=o.point,u=[];for(;i=o,o=s,a.push(o),o.point!==l;)for(;;){const t=o.getAvailableLinkedEvents();if(0===t.length){const t=a[0].point,e=a[a.length-1].point;throw new Error(`Unable to complete output ring starting at [${t.x}, ${t.y}]. Last matching segment found ends at [${e.x}, ${e.y}].`)}if(1===t.length){s=t[0].otherSE;break}let n=null;for(let t=0,e=u.length;t<e;t++)if(u[t].point===o.point){n=t;break}if(null!==n){const t=u.splice(n)[0],r=a.splice(t.index);r.unshift(r[0].otherSE),e.push(new tt(r.reverse()));continue}u.push({index:a.length,point:o.point});const r=o.getLeftmostComparator(i);s=t.sort(r)[0].otherSE;break}e.push(new tt(a))}return e}constructor(t){this.events=t;for(let e=0,n=t.length;e<n;e++)t[e].segment.ringOut=this;this.poly=null}getGeom(){let t=this.events[0].point;const e=[t];for(let n=1,r=this.events.length-1;n<r;n++){const r=this.events[n].point,i=this.events[n+1].point;0!==q(r,t,i)&&(e.push(r),t=r)}if(1===e.length)return null;const n=e[0],r=e[1];0===q(n,t,r)&&e.shift(),e.push(e[0]);const i=this.isExteriorRing()?1:-1,o=this.isExteriorRing()?0:e.length-1,s=this.isExteriorRing()?e.length:-1,a=[];for(let t=o;t!=s;t+=i)a.push([e[t].x,e[t].y]);return a}isExteriorRing(){if(void 0===this._isExteriorRing){const t=this.enclosingRing();this._isExteriorRing=!t||!t.isExteriorRing()}return this._isExteriorRing}enclosingRing(){return void 0===this._enclosingRing&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}_calcEnclosingRing(){let t=this.events[0];for(let e=1,n=this.events.length;e<n;e++){const n=this.events[e];V.compare(t,n)>0&&(t=n)}let e=t.segment.prevInResult(),n=e?e.prevInResult():null;for(;;){if(!e)return null;if(!n)return e.ringOut;if(n.ringOut!==e.ringOut)return n.ringOut.enclosingRing()!==e.ringOut?e.ringOut:e.ringOut.enclosingRing();e=n.prevInResult(),n=e?e.prevInResult():null}}}class et{constructor(t){this.exteriorRing=t,t.poly=this,this.interiorRings=[]}addInterior(t){this.interiorRings.push(t),t.poly=this}getGeom(){const t=[this.exteriorRing.getGeom()];if(null===t[0])return null;for(let e=0,n=this.interiorRings.length;e<n;e++){const n=this.interiorRings[e].getGeom();null!==n&&t.push(n)}return t}}class nt{constructor(t){this.rings=t,this.polys=this._composePolys(t)}getGeom(){const t=[];for(let e=0,n=this.polys.length;e<n;e++){const n=this.polys[e].getGeom();null!==n&&t.push(n)}return t}_composePolys(t){const e=[];for(let n=0,r=t.length;n<r;n++){const r=t[n];if(!r.poly)if(r.isExteriorRing())e.push(new et(r));else{const t=r.enclosingRing();t.poly||e.push(new et(t)),t.poly.addInterior(r)}}return e}}class rt{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:X.compare;this.queue=t,this.tree=new l(e),this.segments=[]}process(t){const e=t.segment,n=[];if(t.consumedBy)return t.isLeft?this.queue.remove(t.otherSE):this.tree.remove(e),n;const r=t.isLeft?this.tree.add(e):this.tree.find(e);if(!r)throw new Error(`Unable to find segment #${e.id} [${e.leftSE.point.x}, ${e.leftSE.point.y}] -> [${e.rightSE.point.x}, ${e.rightSE.point.y}] in SweepLine tree.`);let i,o,s=r,a=r;for(;void 0===i;)s=this.tree.prev(s),null===s?i=null:void 0===s.key.consumedBy&&(i=s.key);for(;void 0===o;)a=this.tree.next(a),null===a?o=null:void 0===a.key.consumedBy&&(o=a.key);if(t.isLeft){let r=null;if(i){const t=i.getIntersection(e);if(null!==t&&(e.isAnEndpoint(t)||(r=t),!i.isAnEndpoint(t))){const e=this._splitSafely(i,t);for(let t=0,r=e.length;t<r;t++)n.push(e[t])}}let s=null;if(o){const t=o.getIntersection(e);if(null!==t&&(e.isAnEndpoint(t)||(s=t),!o.isAnEndpoint(t))){const e=this._splitSafely(o,t);for(let t=0,r=e.length;t<r;t++)n.push(e[t])}}if(null!==r||null!==s){let t=null;t=null===r?s:null===s||V.comparePoints(r,s)<=0?r:s,this.queue.remove(e.rightSE),n.push(e.rightSE);const i=e.split(t);for(let t=0,e=i.length;t<e;t++)n.push(i[t])}n.length>0?(this.tree.remove(e),n.push(t)):(this.segments.push(e),e.prev=i)}else{if(i&&o){const t=i.getIntersection(o);if(null!==t){if(!i.isAnEndpoint(t)){const e=this._splitSafely(i,t);for(let t=0,r=e.length;t<r;t++)n.push(e[t])}if(!o.isAnEndpoint(t)){const e=this._splitSafely(o,t);for(let t=0,r=e.length;t<r;t++)n.push(e[t])}}}this.tree.remove(e)}return n}_splitSafely(t,e){this.tree.remove(t);const n=t.rightSE;this.queue.remove(n);const r=t.split(e);return r.push(n),void 0===t.consumedBy&&this.tree.add(t),r}}const it="undefined"!=typeof process&&process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,ot="undefined"!=typeof process&&process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6;class st{run(t,e,n){at.type=t,E.reset();const r=[new Q(e,!0)];for(let t=0,e=n.length;t<e;t++)r.push(new Q(n[t],!1));if(at.numMultiPolys=r.length,"difference"===at.type){const t=r[0];let e=1;for(;e<r.length;)null!==d(r[e].bbox,t.bbox)?e++:r.splice(e,1)}if("intersection"===at.type)for(let t=0,e=r.length;t<e;t++){const e=r[t];for(let n=t+1,i=r.length;n<i;n++)if(null===d(e.bbox,r[n].bbox))return[]}const i=new l(V.compare);for(let t=0,e=r.length;t<e;t++){const e=r[t].getSweepEvents();for(let t=0,n=e.length;t<n;t++)if(i.insert(e[t]),i.size>it)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big).")}const o=new rt(i);let s=i.size,a=i.pop();for(;a;){const t=a.key;if(i.size===s){const e=t.segment;throw new Error(`Unable to pop() ${t.isLeft?"left":"right"} SweepEvent [${t.point.x}, ${t.point.y}] from segment #${e.id} [${e.leftSE.point.x}, ${e.leftSE.point.y}] -> [${e.rightSE.point.x}, ${e.rightSE.point.y}] from queue.`)}if(i.size>it)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big).");if(o.segments.length>ot)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments).");const e=o.process(t);for(let t=0,n=e.length;t<n;t++){const n=e[t];void 0===n.consumedBy&&i.insert(n)}s=i.size,a=i.pop()}E.reset();const u=tt.factory(o.segments);return new nt(u).getGeom()}}const at=new st,lt=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return at.run("union",t,n)},ut=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return at.run("intersection",t,n)},ht=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return at.run("xor",t,n)},ct=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return at.run("difference",t,n)};var pt={union:lt,intersection:ut,xor:ht,difference:ct};return pt}()},z(O={exports:{}},O.exports),O.exports);function F(t,e,n){void 0===n&&(n={});var r=C(t),i=C(e),o=N.union(r.coordinates,i.coordinates);return 0===o.length?null:1===o.length?function(t,e,n){void 0===n&&(n={});for(var r=0,i=t;r<i.length;r++){var o=i[r];if(o.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var s=0;s<o[o.length-1].length;s++)if(o[o.length-1][s]!==o[0][s])throw new Error("First and last Position are not equivalent.")}return E({type:"Polygon",coordinates:t},e,n)}(o[0],n.properties):function(t,e,n){return void 0===n&&(n={}),E({type:"MultiPolygon",coordinates:t},e,n)}(o,n.properties)}function j(t){var e=null;if("svg"===t.tag)return e=$(t);if(e=document.createElement(t.tag),"object"===A(t.props)&&null!==t.props){var n=function(){var n=t.props[r];if("on"===r){n=t.props[r];var i=function(t){e.addEventListener(t,(function(e){return n[t](e)}))};for(var o in n)i(o)}else if("dataset"===r)Object.keys(n).forEach((function(t){e.dataset[t]=n[t]}));else if("style"===r)if("string"==typeof n)e.setAttribute(r,n);else{var s=[];Object.keys(n).forEach((function(t){s.push("".concat(t,":").concat(n[t]))})),e.setAttribute(r,s.join(";"))}else"cssText"===r?e.style.cssText=n:e.setAttribute(r,n)};for(var r in t.props)n()}return t.children instanceof Array?t.children.forEach((function(t){e.appendChild(j(t))})):e.textContent=t.children,e}function $(t){var e="http://www.w3.org/1999/xlink",n=document.createElementNS("http://www.w3.org/2000/svg",t.tag);if("svg"===t.tag&&n.setAttribute("xmlns:xlink",e),"object"===A(t.props)&&null!==t.props)for(var r in t.props){var i=t.props[r];"xlink:href"===r?n.setAttributeNS(e,r,i):n.setAttribute(r,i)}return t.children instanceof Array?t.children.forEach((function(t){n.appendChild($(t))})):n.textContent=t.children,n}function q(t,e){var n=JSON.parse(JSON.stringify(e));for(var r in n)t[r]&&("center"==r?(n.center.wgs84=t.center,t.zoom&&(n.center.zoom=t.zoom)):n[r]=t[r]);return n}function G(t){var e=[];return t.info&&t.info.show&&(e.push({tag:"div",props:{class:"PointInfo ".concat(t.info.type)},children:[]}),t.titles&&t.titles.show&&e[0].children.push({tag:"div",props:{class:"PointTitle"},children:t.titles.value}),t.contents&&t.contents.show&&e[0].children.push({tag:"div",props:{class:"PointContent"},children:t.contents.value})),e}function U(t,e){!e||"string"!=typeof e&&"number"!=typeof e||(e=[e]);for(var n=document.querySelectorAll(".PointMap"),r=function(r){e?e.forEach((function(e,i){var o,s="PointMap_"+e;(null===(o=n[r])||void 0===o?void 0:o.className.indexOf(s))>-1&&("visible"==t?n[r].classList.remove("z-none"):n[r].classList.add("z-none"))})):"visible"==t?n[r].classList.remove("z-none"):n[r].classList.add("z-none")},i=0;i<n.length;i++)r(i)}function J(t){if(!t)return console.log("请传入标点的id!!!"),!1;!t||"string"!=typeof t&&"number"!=typeof t||(t=[t]);for(var e=document.querySelectorAll(".PointMap"),n=function(n){t.forEach((function(t,r){var i,o="PointMap_"+t;(null===(i=e[n])||void 0===i?void 0:i.className.indexOf(o))>-1&&e[n].remove()}))},r=0;r<e.length;r++)n(r)}function Z(t,e,n){var r={"line-color":n["line-color"],"line-width":n["line-width"],"line-opacity":n["line-opacity"]};return n["line-blur"]&&(r["line-blur"]=n["line-blur"]),n["line-offset"]&&(r["line-offset"]=n["line-offset"]),{id:t,type:"line",source:e,layout:{"line-cap":"round","line-join":"round"},paint:r,metadata:{zIndex:n.zIndex}}}function D(t,e,n,r){return{id:t,type:"symbol",source:e,layout:{"text-field":n,"text-size":r["text-size"],"text-allow-overlap":!0,"text-justify":r["text-justify"],"text-offset":r["text-offset"],"text-anchor":"bottom","icon-image":"","text-font":["Alibaba-PuHuiTi Regular"]},paint:{"text-color":r["text-color"],"text-halo-color":r["text-halo-color"],"text-halo-width":r["text-halo-width"]},metadata:{zIndex:4}}}function H(t,e,n,r,i,o,s,a){var l,u="function"==typeof t?t.options:t;if(e&&(u.render=e,u.staticRenderFns=n,u._compiled=!0),r&&(u.functional=!0),o&&(u._scopeId="data-v-"+o),s?(l=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),i&&i.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(s)},u._ssrRegister=l):i&&(l=a?function(){i.call(this,(u.functional?this.parent:this).$root.$options.shadowRoot)}:i),l)if(u.functional){u._injectStyles=l;var h=u.render;u.render=function(t,e){return l.call(e),h(t,e)}}else{var c=u.beforeCreate;u.beforeCreate=c?[].concat(c,l):[l]}return{exports:t,options:u}}const V={name:"ZMap",props:{id:{type:String,default:"mapContainer"},mapStyle:{type:Object,default:()=>({})},mapKey:{type:String,default:""},cityMap:{type:[Object,String],default:()=>({})},baseMap:{type:Array,default:()=>[]},farmMap:{type:Array,default:()=>[]},lineMap:{type:Array,default:()=>[]},pointMap:{type:Array,default:()=>[]},heatMap:{type:[Object,String],default:()=>({})},routeMap:{type:[Object,String],default:()=>({})},params:{type:Object,default:()=>({})},isDrilling:{type:Boolean,default:!1}},data:()=>({title:"gis地图可视化",mapBox:null,cityContainer:new Map,baseContainer:new Map,farmContainer:new Map,lineContainer:new Map,dotContainer:new Map,routeContainer:new Map,layerTypes:{source:"_s",fill:"_f",line:"_l",text:"_t",prominent:"_p",shadow:"_sh"},parameter:{shadow:!1,scale:!1,zoom:6,minZoom:3,maxZoom:20,center:[106.64070540957499,29.542372847334505],isProminent:"city",prominentType:"geojson",prominentUrl:"",prominentHeight:1,prominentFillColor:"rgba(0, 0, 0, 0.5)",pitch:0,zIndex:0},properties:{center:{wgs84:[106.64314362686562,29.54485285119372],zoom:14.978617404032729},"fill-color":"#016b67","fill-opacity":.5,"fill-outline-color":"#38d9a9","line-color":"rgba(255, 50, 10, 1)","line-opacity":1,"line-width":1,"text-size":14,"text-offset":[0,1.8],"text-justify":"center","text-color":"rgb(159, 96, 55)","text-halo-color":"#fff","text-halo-width":1.8,shadow:{"line-color":"#38d9a9","line-opacity":1,"line-width":25,"line-blur":40,"line-offset":-5}},onClickType:""}),computed:{},mounted(){this.getUsagePermissions()},watch:{cityMap:{handler(t){t&&this.mapBox&&setTimeout((()=>{this.addCityMaps(t)}),400)},deep:!0,immediate:!0},heatMap:{handler(t){t&&this.mapBox&&this.mapBox.on("load",(()=>{this.addHeatMaps(t)}))},deep:!0,immediate:!0},baseMap:{handler(t){t&&(null==t?void 0:t.length)>0&&this.mapBox&&setTimeout((()=>{this.addBaseMaps(t)}),400)},deep:!0,immediate:!0},farmMap:{handler(t){t&&(null==t?void 0:t.length)>0&&this.mapBox&&setTimeout((()=>{this.addFarmMaps(t)}),400)},deep:!0,immediate:!0},lineMap:{handler(t){t&&(null==t?void 0:t.length)>0&&this.mapBox&&setTimeout((()=>{this.addLineMaps(t)}),400)},deep:!0,immediate:!0},pointMap:{handler(t){t&&(null==t?void 0:t.length)>0&&this.mapBox&&setTimeout((()=>{this.addPointMaps(t)}),400)},deep:!0,immediate:!0}},methods:{setCache(t,e){localStorage.setItem(t,JSON.stringify(e))},getCache(t){const e=localStorage.getItem(t);return e?JSON.parse(e):null},getUsagePermissions(){let t="pro__MAP_VIEWS",e=this.getCache(t),n=(new Date).getTime();if(e&&e.value&&n<e.expire)return this.initMap(),!0;return fetch("https://map.zhuyukeji.com/Tool.Map",{method:"GET"}).then((e=>{if(e.ok){this.initMap();let e=n+6048e5;return this.setCache(t,{value:!0,expire:e}),!0}return console.groupCollapsed("%cz-map-views","color:#009a61;font-size:24px;font-weight:800;"),console.log("%c"+window.location.hostname+"\n-------------\n您当前域名没有购买地图服务,或者服务到期!!\n请登录https://map.zhuyukeji.com/Tool.map\n购买!!","color:#009a61"),console.groupEnd(),this.initMap(),!1})).then((t=>{})).catch((t=>(console.error("请求出错:",t),!1)))},initMap(){this.parameter=function(t,e){var n=JSON.parse(JSON.stringify(e));for(var r in n)t[r]&&(n[r]=t[r]);return n}(this.params,this.parameter),this.mapStyle.version&&(this.mapBox=new t.Map({container:this.id,center:this.parameter.center,minZoom:this.parameter.minZoom,maxZoom:this.parameter.maxZoom,zoom:this.parameter.zoom,style:this.mapStyle,pitch:this.parameter.pitch,bearing:0,antialias:!1,accessToken:this.mapKey}),this.parameter.scale&&this.mapBox.addControl(new t.ScaleControl,"bottom-right"))},addCityMaps(t){if(t){if("string"==typeof t&&(t=JSON.parse(t)),!t.properties.id)return console.log("请在properties中传入id"),!1;this.addAreaMap(t.properties,"city",t)}},addHeatMaps(t){const e="source_heat",n="layer_heat";"string"==typeof t&&(t=JSON.parse(t)),this.mapBox.addSource(e,{type:"geojson",data:t}),this.mapBox.addLayer({id:n,type:"heatmap",source:e,minZoom:3,paint:{"heatmap-weight":["interpolate",["linear"],["get","mag"],0,0,6,1],"heatmap-intensity":["interpolate",["linear"],["zoom"],0,1,9,3],"heatmap-color":["interpolate",["linear"],["heatmap-density"],0,"rgba(0,0,0,0)",.2,"#67a9cf",.4,"#d1e5f0",.6,"#fddbc7",.8,"#ef8a62",1,"#b2182b"],"heatmap-radius":["interpolate",["linear"],["zoom"],0,2,9,20],"heatmap-opacity":["interpolate",["linear"],["zoom"],7,1,9,0]}}),this.mapBox.on("click",n,(t=>{if(t.defaultPrevented)return;let e=this.mapBox.queryRenderedFeatures(t.point).filter((t=>t.layer.id==n))[0];this.$emit("heat-click",e.properties),t.preventDefault()}))},addAreaMap(e,n,r){const i=e.id,o=n+this.layerTypes.source+i,s=n+this.layerTypes.line+i,a=n+this.layerTypes.fill+i,l=n+this.layerTypes.text+i,u=n+this.layerTypes.prominent+i,h=n+this.layerTypes.shadow+i;let c=this,p={},f=[],y=!1;switch(r.type){case"Feature":p=q(r.properties,this.properties);break;case"FeatureCollection":p=q(r.features[0].properties,this.properties)}let g={base:{container:this.baseContainer,name:"baseContainer"},farm:{container:this.farmContainer,name:"farmContainer"},city:{container:this.cityContainer,name:"cityContainer"},line:{container:this.lineContainer,name:"lineContainer"},route:{container:this.routeContainer,name:"routeContainer"}};this.mapBox.getSource(o)||this.mapBox.addSource(o,function(t){return{type:"geojson",data:t}}(r)),"city"==n&&this.setLayout([...g[n].container.values()],"visibility","none");["base","farm","city"].indexOf(n)>-1&&(g[n].container.has(a)?this.setLayout([g[n].container.get(a)],"visibility","visible"):(this.mapBox.addLayer(function(t,e,n){return{id:t,type:"fill",source:e,layout:{},paint:{"fill-color":n["fill-color"],"fill-opacity":n["fill-opacity"]},metadata:{zIndex:n.zIndex}}}(a,o,p)),c[g[n].name].set(a,a)));["line","base","farm","city"].indexOf(n)>-1&&(g[n].container.has(s)?this.setLayout([g[n].container.get(s)],"visibility","visible"):(this.mapBox.addLayer(Z(s,o,p)),c[g[n].name].set(s,s)));["farm","city"].indexOf(n)>-1&&(g[n].container.has(l)?this.setLayout([g[n].container.get(l)],"visibility","visible"):(e.showText&&e.text&&"farm"==n&&this.mapBox.addLayer(D(l,o,e.text,p)),"city"==n&&this.mapBox.addLayer(D(l,o,"{name}",p)),c[g[n].name].set(l,l)));["base","city"].indexOf(n)>-1&&"extrusion"==this.parameter.prominentType&&this.addExtrusionImage(o,u);if(["base","city"].indexOf(n)>-1){if("base"==this.parameter.isProminent)switch(r.type){case"Feature":f=r.geometry.coordinates;break;case"FeatureCollection":f=r.features[0].geometry.coordinates}else"city"==this.parameter.isProminent&&("FeatureCollection"==r.type?r.features&&r.features.length>1?(f=function(t,e){if("push"==e){var n=[];return t.features.forEach((function(t,e){t.geometry.coordinates[0]&&t.geometry.coordinates[0].length>0&&(n=[].concat(T(t.geometry.coordinates[0]),T(n)))})),n}var r=t.features[0];return t.features.forEach((function(t,e){t.geometry.coordinates[0]&&t.geometry.coordinates[0].length>0&&(r=F(r,t))})),r.geometry.coordinates}(r,"union"),y=!0):f=r.features[0].geometry.coordinates&&1==r.features[0].geometry.coordinates.length?r.features[0].geometry.coordinates[0]:r.features[0].geometry.coordinates:f=r.geometry.coordinates&&1==r.geometry.coordinates.length?r.geometry.coordinates[0]:r.geometry.coordinates);if(g[n].container.has(u))this.setLayout([g[n].container.get(u)],"visibility","visible");else if(this.parameter.isProminent==n&&f.length>0){let t=y&&f[0][0]&&f[0][0][0]&&f[0][0][0][0]?f[0]:f;if("extrusionBg"==this.parameter.prominentType){let e=function(t){return{type:"geojson",data:{type:"Feature",geometry:{type:"Polygon",coordinates:[[[-180,90],[180,90],[180,-90],[-180,-90]]].concat(T(t))}}}}(t);this.addExtrusionImage(e,u)}else this.mapBox.addLayer(function(t,e,n,r){return{id:t,type:"fill",source:{type:"geojson",data:{type:"Feature",geometry:{type:"Polygon",coordinates:[[[-180,90],[180,90],[180,-90],[-180,-90]]].concat(T(e))}}},paint:{"fill-color":n},layout:{visibility:"visible"},metadata:{zIndex:r.zIndex}}}(u,t,this.parameter.prominentFillColor,p));c[g[n].name].set(u,u)}}switch(n){case"base":this.mapBox.on("click",a,(t=>{"point"===this.onClickType?(t.preventDefault(),this.onClickType=""):this.onClickType=a,t.defaultPrevented||setTimeout((()=>{this.onClickType===a&&this.$emit("base-click",i,e)}),200)}));break;case"farm":this.mapBox.on("click",a,(t=>{"point"===this.onClickType?(t.preventDefault(),this.onClickType=""):this.onClickType=a,t.defaultPrevented||setTimeout((()=>{this.onClickType===a&&this.$emit("farm-click",i,e)}),200)}),!0);break;case"route":let n=function(t){d||(d=t);const e=(t-d)/f;if(e>1)return;const r=function(t,e,n){void 0===n&&(n={});for(var r=C(t).coordinates,i=0,o=0;o<r.length&&!(e>=i&&o===r.length-1);o++){if(i>=e){var s=e-i;if(s){var a=I(r[o],r[o-1])-180;return R(r[o],s,a,n)}return S(r[o])}i+=L(r[o],r[o+1],n)}return S(r[r.length-1])}(y,g*e).geometry.coordinates,i={lng:r[0],lat:r[1]};let o="<p><span>纬度:</span>"+i.lng.toFixed(5)+"</p>";o+="<p><span>经度:</span>"+i.lat.toFixed(5)+"</p>",l.setHTML(o),u.setLngLat(i),c.mapBox.setPaintProperty(s,"line-gradient",["step",["line-progress"],"red",e,"rgba(255, 0, 0, 1)"]),c.mapBox.flyTo({center:i}),window.requestAnimationFrame(n)},r=[];"FeatureCollection"==data.type?r="LineString"==data.features[0].geometry.type?data.features[0].geometry.coordinates:data.features[0].geometry.coordinates[0]:"Feature"==data.type&&(r="LineString"==data.geometry.type?data.geometry.coordinates:data.geometry.coordinates[0]);const l=new t.Popup({closeButton:!1,closeOnClick:!1}),u=new t.Marker({color:"red",scale:.8,draggable:!1,pitchAlignment:"auto",rotationAlignment:"auto"}).setLngLat(r[0]).setPopup(l).addTo(this.mapBox).togglePopup();let h={"line-color":"rgba(255, 50, 10, 1)","line-opacity":1,"line-width":1};this.mapBox.addLayer(Z(s,o,h)),this.routeContainer.set(s,s);const f=time*1e3,y=function(t,e,n){if(void 0===n&&(n={}),t.length<2)throw new Error("coordinates must be an array of two or more positions");return E({type:"LineString",coordinates:t},e,n)}(r),g=v(y);let d;window.requestAnimationFrame(n);break;case"city":this.flyToMap(p),this.mapBox.on("click",a,(t=>{if("point"===this.onClickType&&(t.preventDefault(),this.onClickType=""),t.defaultPrevented)return;this.isDrilling&&this.setLayout([...this.cityContainer.values()],"visibility","none");let e=this.mapBox.queryRenderedFeatures(t.point).filter((t=>t.layer.id==a))[0],n=e.properties&&e.properties.adcode?e.properties.adcode:i;this.$emit("city-click",n,e.properties)}))}this.parameter.shadow&&f.length>0&&"farm"!=n&&this.addShadow(f,h,p)},addShadow(t,e,n){this.baseContainer.has(e)?this.setLayout([this.baseContainer.get(e)],"visibility","visible"):(this.mapBox.addLayer(function(t,e,n){return{id:t,type:"line",source:{type:"geojson",data:{type:"FeatureCollection",features:[{type:"Feature",properties:{adcode:t,name:"阴影"},geometry:{type:"Polygon",coordinates:[e]}}]}},paint:n.shadow,metadata:{zIndex:n.zIndex}}}(e,t,n)),this.baseContainer.set(e,e))},addExtrusionImage(t,e){if(this.parameter.prominentUrl){let n=this;this.mapBox.loadImage(this.parameter.prominentUrl,(function(r,i){if(r)throw r;n.mapBox.hasImage("ground")?(n.mapBox.updateImage("ground",i),n.mapBox.removeLayer("img_"+e),n.mapBox.addLayer({id:"img_"+e,source:t,type:"fill-extrusion",paint:{"fill-extrusion-height":n.parameter.prominentHeight,"fill-extrusion-base":0,"fill-extrusion-opacity":1,"fill-extrusion-pattern":"ground"}})):(n.mapBox.addImage("ground",i),n.mapBox.addLayer({id:"img_"+e,source:t,type:"fill-extrusion",paint:{"fill-extrusion-height":n.parameter.prominentHeight,"fill-extrusion-base":0,"fill-extrusion-opacity":1,"fill-extrusion-pattern":"ground"}}))}))}},addBaseMaps(t){if(!t||(null==t?void 0:t.length)<1)return!1;t.forEach(((t,e)=>{if(t.mapPosition){let n=JSON.parse(t.mapPosition);if(this.addAreaMap(t,"base",n),0==e){let t={};switch(n.type){case"Feature":t=n.properties;break;case"FeatureCollection":t=n.features[0].properties}"base"==this.parameter.isProminent&&this.flyToMap(t)}}}))},addFarmMaps(t){if(!t||(null==t?void 0:t.length)<1)return!1;t.forEach(((t,e)=>{if(t.mapPosition){let e=JSON.parse(t.mapPosition);this.addAreaMap(t,"farm",e)}}))},addLineMaps(t){if(!t||(null==t?void 0:t.length)<1)return!1;t.forEach(((t,e)=>{if(t.geoJson){let e=JSON.parse(t.geoJson);this.addAreaMap(t,"line",e)}}))},addPointMaps(t){t.forEach(((t,e)=>{let n="PointMap_"+t.id;this.dotContainer.get(n)?U("visible",t.id):t.center&&(this.switchAddPoint(t),this.dotContainer.set(n,n))}))},switchAddPoint(e){let n="";switch(e.type){case"signage":n=function(t,e){var n=e.className?e.className:"aaaaaaaaaaaaa";return j({tag:"div",props:{class:"PointSignages PointMap PointMap_"+e.id+" "+n,on:{click:function(n){n.stopPropagation(),t&&t(e.id)}}},children:[{tag:"div",props:{class:"PointMapBox"},children:[{tag:"div",props:{class:"PointSignage PointSignage_"+e.id},children:e.title},{tag:"div",props:{class:"PointLine"},children:[]},{tag:"div",props:{class:"footerCircle"},children:[]}]}]})}((t=>{this.pointClick(t)}),e);break;case"icon":n=function(t,e){var n=e.className?e.className:"",r=G(e);return j({tag:"div",props:{class:"PointIcons PointMap PointMap_"+e.id+" "+n,on:{click:function(n){n.stopPropagation(),t&&t(e.id)}}},children:[].concat(T(r),[{tag:"div",props:{class:"PointMapBox"},children:[{tag:"img",props:{class:"PointIcon PointIcon_"+e.id,src:e.icon,title:e.title}},{tag:"div",props:{class:"PointLine"},children:[]},{tag:"div",props:{class:"footerCircle"},children:[]}]}])})}((t=>{this.pointClick(t)}),e);break;case"point":n=function(t,e){var n=e.className?e.className:"",r=G(e);return j({tag:"div",props:{class:"PointImgs PointMap PointMap_"+e.id+" "+n,on:{click:function(n){n.stopPropagation(),t&&t(e.id)}}},children:[].concat(T(r),[{tag:"img",props:{class:"PointImg PointImg_"+e.id,src:e.icon,title:e.title}}])})}((t=>{this.pointClick(t)}),e);break;case"svgIcon":n=function(t,e){var n=e.className?e.className:"",r=G(e),i=[],o={};return e.icon&&i.push({tag:"img",props:{class:"PointImg PointImg_"+e.id,src:e.icon,title:e.title}}),e.svg&&(i.push(e.svg.data),e.svg.color&&(o.color=e.svg.color),e.svg.size&&(o["font-size"]=e.svg.size)),j({tag:"div",props:{class:"PointSvgIcons PointMap PointMap_"+e.id+" "+n,on:{click:function(n){n.stopPropagation(),t&&t(e.id)}},style:o},children:[].concat(T(r),i)})}((t=>{this.pointClick(t)}),e)}n&&new t.Marker({element:n}).setLngLat(e.center).addTo(this.mapBox)},pointClick(t){this.$emit("point-click",t),this.onClickType="point"},showMapBase(t,e,n){this.showMapArea(t,e,"base",n)},showMapFarm(t,e,n){this.showMapArea(t,e,"farm",n)},showMapArea(t,e,n,r){if(n||(n="farm"),e){"string"!=typeof e&&"number"!=typeof e||(e=[e]);let i=[];e.forEach(((t,e)=>{if(r){let e=n+this.layerTypes[r]+t;this.mapBox.getLayer(e)&&i.push(e)}else for(let e in this.layerTypes){let r=this.layerTypes[e],o=n+r+t;this.mapBox.getLayer(o)&&i.push(o)}})),this.setLayout(i,"visibility",t)}else"farm"==n?this.setLayout([...this.farmContainer.values()],"visibility",t):"base"==n&&this.setLayout([...this.baseContainer.values()],"visibility",t)},showMapPoint(t,e){U(t,e)},deleteMapPoint(t){J(t)},updateMapPoint(t){J(t.id),this.switchAddPoint(t)},flyToMap(t){t.center&&"string"==typeof t.center&&(t.center=JSON.parse(t.center)),t.center&&(t.center.wgs84?this.mapBox.flyTo({center:[t.center.wgs84[0],t.center.wgs84[1]],zoom:t.center.zoom}):this.mapBox.flyTo({center:[t.center[0],t.center[1]],zoom:t.zoom}))},setLayout(t,e,n){for(let r of t)r&&this.mapBox.setLayoutProperty(r,e,n)},setAreaColor(t,e,n){for(let e of t){let t=["case"];t.push(n),this.mapBox.setPaintProperty(e,"fill-color",t)}},setZoom(t){switch(t){case"zoomIn":this.mapBox.zoomIn();break;case"zoomOut":this.mapBox.zoomOut();break;case"resize":this.mapBox.resize()}}}};var Y=function(){var t=this._self._c;return t("div",{staticClass:"z-map-views w100 h100 pr"},[t("div",{ref:"mapContainer",staticClass:"mapContainer w100 h100 pr",attrs:{id:this.id}})])},X=[];Y._withStripped=!0;var K=H(V,Y,X,!1,null,"fd5304cf",null,null);K.options.__file="D:\\项目\\测试\\test\\map-views\\components\\ZMap\\ZMap.vue";var W=K.exports;W.install=t=>{t.component(W.name,W)};export{W as default};
@@ -0,0 +1,24 @@
1
+ import t from"mapbox-gl";function e(t){if(!t)throw new Error("obj is required");var e;if(t.length?e=t:t.coordinates?e=t.coordinates:t.geometry&&t.geometry.coordinates&&(e=t.geometry.coordinates),e)return n(e),e;throw new Error("No valid coordinates")}function n(t){if(t.length>1&&"number"==typeof t[0]&&"number"==typeof t[1])return!0;if(Array.isArray(t[0])&&t[0].length)return n(t[0]);throw new Error("coordinates must only contain numbers")}var r=function(t){if(!t)throw new Error("obj is required");var n=e(t);if(n.length>1&&"number"==typeof n[0]&&"number"==typeof n[1])return n;throw new Error("Coordinate is not a valid Point")};var i={miles:3960,nauticalmiles:3441.145,degrees:57.2957795,radians:1,inches:250905600,yards:6969600,meters:6373e3,metres:6373e3,centimeters:6373e5,centimetres:6373e5,kilometers:6373,kilometres:6373,feet:20908792.65};function o(t,e){if(null==t)throw new Error("radians is required");var n=i[e||"kilometers"];if(!n)throw new Error("units is invalid");return t*n}var s=r,a=o;function l(t,e,n){if(null!==t){var r,i,o,s,a,u,h,c,p,f,y=0,g=0,d=t.type,m="FeatureCollection"===d,x="Feature"===d,v=m?t.features.length:1;for(r=0;r<v;r++)for(h=(f=!!(p=m?t.features[r].geometry:x?t.geometry:t)&&"GeometryCollection"===p.type)?p.geometries.length:1,i=0;i<h;i++){var b=0;if(null!==(u=f?p.geometries[i]:p)){c=u.coordinates;var w=u.type;switch(y=!n||"Polygon"!==w&&"MultiPolygon"!==w?0:1,w){case null:break;case"Point":e(c,g,r,b),g++,b++;break;case"LineString":case"MultiPoint":for(o=0;o<c.length;o++)e(c[o],g,r,b),g++,"MultiPoint"===w&&b++;"LineString"===w&&b++;break;case"Polygon":case"MultiLineString":for(o=0;o<c.length;o++){for(s=0;s<c[o].length-y;s++)e(c[o][s],g,r,b),g++;"MultiLineString"===w&&b++}"Polygon"===w&&b++;break;case"MultiPolygon":for(o=0;o<c.length;o++){for(s=0;s<c[o].length;s++)for(a=0;a<c[o][s].length-y;a++)e(c[o][s][a],g,r,b),g++;b++}break;case"GeometryCollection":for(o=0;o<u.geometries.length;o++)l(u.geometries[o],e,n);break;default:throw new Error("Unknown Geometry Type")}}}}}function u(t,e,n,r){var i=n;return l(t,(function(t,r,o,s){i=0===r&&void 0===n?t:e(i,t,r,o,s)}),r),i}function h(t,e){var n;switch(t.type){case"FeatureCollection":for(n=0;n<t.features.length;n++)e(t.features[n].properties,n);break;case"Feature":e(t.properties,0)}}function c(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var n=0;n<t.features.length;n++)e(t.features[n],n)}function p(t,e){var n,r,i,o,s,a,l,u,h=0,c="FeatureCollection"===t.type,p="Feature"===t.type,f=c?t.features.length:1;for(n=0;n<f;n++){for(a=c?t.features[n].geometry:p?t.geometry:t,u=c?t.features[n].properties:p?t.properties:{},s=(l=!!a&&"GeometryCollection"===a.type)?a.geometries.length:1,i=0;i<s;i++)if(null!==(o=l?a.geometries[i]:a))switch(o.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":e(o,h,u);break;case"GeometryCollection":for(r=0;r<o.geometries.length;r++)e(o.geometries[r],h,u);break;default:throw new Error("Unknown Geometry Type")}else e(null,h,u);h++}}function f(t,e){p(t,(function(t,n,r){var i,o=null===t?null:t.type;switch(o){case null:case"Point":case"LineString":case"Polygon":return void e(g(t,r),n,0)}switch(o){case"MultiPoint":i="Point";break;case"MultiLineString":i="LineString";break;case"MultiPolygon":i="Polygon"}t.coordinates.forEach((function(t,o){e(g({type:i,coordinates:t},r),n,o)}))}))}function y(t,e){f(t,(function(t,n,r){var i=0;if(t.geometry){var o=t.geometry.type;"Point"!==o&&"MultiPoint"!==o&&u(t,(function(o,s){var a=d([o,s],t.properties);return e(a,n,r,i),i++,s}))}}))}function g(t,e){if(void 0===t)throw new Error("No geometry passed");return{type:"Feature",properties:e||{},geometry:t}}function d(t,e){if(!t)throw new Error("No coordinates passed");if(t.length<2)throw new Error("Coordinates must be an array of two or more positions");return{type:"Feature",properties:e||{},geometry:{type:"LineString",coordinates:t}}}function m(t,e){if(!t)throw new Error("geojson is required");var n=t.geometry?t.geometry.type:t.type;if(!n)throw new Error("invalid geojson");if("FeatureCollection"===n)throw new Error("FeatureCollection is not supported");if("GeometryCollection"===n)throw new Error("GeometryCollection is not supported");var r=t.geometry?t.geometry.coordinates:t.coordinates;if(!r)throw new Error("geojson must contain coordinates");switch(n){case"LineString":return void e(r,0,0);case"Polygon":case"MultiLineString":for(var i=0,o=0;o<r.length;o++)"MultiLineString"===n&&(i=o),e(r[o],o,i);return;case"MultiPolygon":for(var s=0;s<r.length;s++)for(var a=0;a<r[s].length;a++)e(r[s][a],a,s);return;default:throw new Error(n+" geometry not supported")}}var x=Object.freeze({__proto__:null,coordAll:function(t){var e=[];return l(t,(function(t){e.push(t)})),e},coordEach:l,coordReduce:u,feature:g,featureEach:c,featureReduce:function(t,e,n){var r=n;return c(t,(function(t,i){r=0===i&&void 0===n?t:e(r,t,i)})),r},flattenEach:f,flattenReduce:function(t,e,n){var r=n;return f(t,(function(t,i,o){r=0===i&&0===o&&void 0===n?t:e(r,t,i,o)})),r},geomEach:p,geomReduce:function(t,e,n){var r=n;return p(t,(function(t,i,o){r=0===i&&void 0===n?t:e(r,t,i,o)})),r},lineEach:m,lineReduce:function(t,e,n){var r=n;return m(t,(function(t,i,o){r=0===i&&void 0===n?t:e(r,t,i,o)})),r},lineString:d,propEach:h,propReduce:function(t,e,n){var r=n;return h(t,(function(t,i){r=0===i&&void 0===n?t:e(r,t,i)})),r},segmentEach:y,segmentReduce:function(t,e,n){var r=n,i=!1;return y(t,(function(t,o,s,a){r=!1===i&&void 0===n?t:e(r,t,o,s,a),i=!0})),r}}).segmentReduce,v=function(t,e){if(!t)throw new Error("geojson is required");return x(t,(function(t,n){var r=n.geometry.coordinates;return t+function(t,e,n){var r=Math.PI/180,i=s(t),o=s(e),l=r*(o[1]-i[1]),u=r*(o[0]-i[0]),h=r*i[1],c=r*o[1],p=Math.pow(Math.sin(l/2),2)+Math.pow(Math.sin(u/2),2)*Math.cos(h)*Math.cos(c);return a(2*Math.atan2(Math.sqrt(p),Math.sqrt(1-p)),n)}(r[0],r[1],e)}),0)},b=6371008.8,w={centimeters:637100880,centimetres:637100880,degrees:57.22891354143274,feet:20902260.511392,inches:39.37*b,kilometers:6371.0088,kilometres:6371.0088,meters:b,metres:b,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:b/1852,radians:1,yards:6967335.223679999};function E(t,e,n){void 0===n&&(n={});var r={type:"Feature"};return(0===n.id||n.id)&&(r.id=n.id),n.bbox&&(r.bbox=n.bbox),r.properties=e||{},r.geometry=t,r}function S(t,e,n){if(void 0===n&&(n={}),!t)throw new Error("coordinates is required");if(!Array.isArray(t))throw new Error("coordinates must be an Array");if(t.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!M(t[0])||!M(t[1]))throw new Error("coordinates must contain numbers");return E({type:"Point",coordinates:t},e,n)}function _(t){return 180*(t%(2*Math.PI))/Math.PI}function P(t){return t%360*Math.PI/180}function M(t){return!isNaN(t)&&null!==t&&!Array.isArray(t)}function k(t){if(!t)throw new Error("coord is required");if(!Array.isArray(t)){if("Feature"===t.type&&null!==t.geometry&&"Point"===t.geometry.type)return t.geometry.coordinates;if("Point"===t.type)return t.coordinates}if(Array.isArray(t)&&t.length>=2&&!Array.isArray(t[0])&&!Array.isArray(t[1]))return t;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function C(t){return"Feature"===t.type?t.geometry:t}function I(t,e,n){if(void 0===n&&(n={}),!0===n.final)return function(t,e){var n=I(e,t);return n=(n+180)%360}(t,e);var r=k(t),i=k(e),o=P(r[0]),s=P(i[0]),a=P(r[1]),l=P(i[1]),u=Math.sin(s-o)*Math.cos(l),h=Math.cos(a)*Math.sin(l)-Math.sin(a)*Math.cos(l)*Math.cos(s-o);return _(Math.atan2(u,h))}function R(t,e,n,r){void 0===r&&(r={});var i=k(t),o=P(i[0]),s=P(i[1]),a=P(n),l=function(t,e){void 0===e&&(e="kilometers");var n=w[e];if(!n)throw new Error(e+" units is invalid");return t/n}(e,r.units),u=Math.asin(Math.sin(s)*Math.cos(l)+Math.cos(s)*Math.sin(l)*Math.cos(a));return S([_(o+Math.atan2(Math.sin(a)*Math.sin(l)*Math.cos(s),Math.cos(l)-Math.sin(s)*Math.sin(u))),_(u)],r.properties)}function L(t,e,n){void 0===n&&(n={});var r=k(t),i=k(e),o=P(i[1]-r[1]),s=P(i[0]-r[0]),a=P(r[1]),l=P(i[1]),u=Math.pow(Math.sin(o/2),2)+Math.pow(Math.sin(s/2),2)*Math.cos(a)*Math.cos(l);return function(t,e){void 0===e&&(e="kilometers");var n=w[e];if(!n)throw new Error(e+" units is invalid");return t*n}(2*Math.atan2(Math.sqrt(u),Math.sqrt(1-u)),n.units)}function A(t){return A="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},A(t)}function T(t){return function(t){if(Array.isArray(t))return B(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return B(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return B(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function B(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var z,O,N=(z=function(t,e){t.exports=function(){
2
+ /**
3
+ * splaytree v3.1.2
4
+ * Fast Splay tree for Node and browser
5
+ *
6
+ * @author Alexander Milevski <info@w8r.name>
7
+ * @license MIT
8
+ * @preserve
9
+ */
10
+ /*! *****************************************************************************
11
+ Copyright (c) Microsoft Corporation. All rights reserved.
12
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
13
+ this file except in compliance with the License. You may obtain a copy of the
14
+ License at http://www.apache.org/licenses/LICENSE-2.0
15
+
16
+ THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17
+ KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
18
+ WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
19
+ MERCHANTABLITY OR NON-INFRINGEMENT.
20
+
21
+ See the Apache Version 2.0 License for specific language governing permissions
22
+ and limitations under the License.
23
+ ***************************************************************************** */
24
+ function t(t,e){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(t){return function(e){return l([t,e])}}function l(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}}var e=function(){function t(t,e){this.next=null,this.key=t,this.data=e,this.left=null,this.right=null}return t}();function n(t,e){return t>e?1:t<e?-1:0}function r(t,n,r){for(var i=new e(null,null),o=i,s=i;;){var a=r(t,n.key);if(a<0){if(null===n.left)break;if(r(t,n.left.key)<0){var l=n.left;if(n.left=l.right,l.right=n,null===(n=l).left)break}s.left=n,s=n,n=n.left}else{if(!(a>0))break;if(null===n.right)break;if(r(t,n.right.key)>0&&(l=n.right,n.right=l.left,l.left=n,null===(n=l).right))break;o.right=n,o=n,n=n.right}}return o.right=n.left,s.left=n.right,n.left=i.right,n.right=i.left,n}function i(t,n,i,o){var s=new e(t,n);if(null===i)return s.left=s.right=null,s;var a=o(t,(i=r(t,i,o)).key);return a<0?(s.left=i.left,s.right=i,i.left=null):a>=0&&(s.right=i.right,s.left=i,i.right=null),s}function o(t,e,n){var i=null,o=null;if(e){var s=n((e=r(t,e,n)).key,t);0===s?(i=e.left,o=e.right):s<0?(o=e.right,e.right=null,i=e):(i=e.left,e.left=null,o=e)}return{left:i,right:o}}function s(t,e,n){return null===e?t:(null===t||((e=r(t.key,e,n)).left=t),e)}function a(t,e,n,r,i){if(t){r(e+(n?"└── ":"├── ")+i(t)+"\n");var o=e+(n?" ":"│ ");t.left&&a(t.left,o,!1,r,i),t.right&&a(t.right,o,!0,r,i)}}var l=function(){function l(t){void 0===t&&(t=n),this._root=null,this._size=0,this._comparator=t}return l.prototype.insert=function(t,e){return this._size++,this._root=i(t,e,this._root,this._comparator)},l.prototype.add=function(t,n){var i=new e(t,n);null===this._root&&(i.left=i.right=null,this._size++,this._root=i);var o=this._comparator,s=r(t,this._root,o),a=o(t,s.key);return 0===a?this._root=s:(a<0?(i.left=s.left,i.right=s,s.left=null):a>0&&(i.right=s.right,i.left=s,s.right=null),this._size++,this._root=i),this._root},l.prototype.remove=function(t){this._root=this._remove(t,this._root,this._comparator)},l.prototype._remove=function(t,e,n){var i;return null===e?null:0===n(t,(e=r(t,e,n)).key)?(null===e.left?i=e.right:(i=r(t,e.left,n)).right=e.right,this._size--,i):e},l.prototype.pop=function(){var t=this._root;if(t){for(;t.left;)t=t.left;return this._root=r(t.key,this._root,this._comparator),this._root=this._remove(t.key,this._root,this._comparator),{key:t.key,data:t.data}}return null},l.prototype.findStatic=function(t){for(var e=this._root,n=this._comparator;e;){var r=n(t,e.key);if(0===r)return e;e=r<0?e.left:e.right}return null},l.prototype.find=function(t){return this._root&&(this._root=r(t,this._root,this._comparator),0!==this._comparator(t,this._root.key))?null:this._root},l.prototype.contains=function(t){for(var e=this._root,n=this._comparator;e;){var r=n(t,e.key);if(0===r)return!0;e=r<0?e.left:e.right}return!1},l.prototype.forEach=function(t,e){for(var n=this._root,r=[],i=!1;!i;)null!==n?(r.push(n),n=n.left):0!==r.length?(n=r.pop(),t.call(e,n),n=n.right):i=!0;return this},l.prototype.range=function(t,e,n,r){for(var i=[],o=this._comparator,s=this._root;0!==i.length||s;)if(s)i.push(s),s=s.left;else{if(o((s=i.pop()).key,e)>0)break;if(o(s.key,t)>=0&&n.call(r,s))return this;s=s.right}return this},l.prototype.keys=function(){var t=[];return this.forEach((function(e){var n=e.key;return t.push(n)})),t},l.prototype.values=function(){var t=[];return this.forEach((function(e){var n=e.data;return t.push(n)})),t},l.prototype.min=function(){return this._root?this.minNode(this._root).key:null},l.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},l.prototype.minNode=function(t){if(void 0===t&&(t=this._root),t)for(;t.left;)t=t.left;return t},l.prototype.maxNode=function(t){if(void 0===t&&(t=this._root),t)for(;t.right;)t=t.right;return t},l.prototype.at=function(t){for(var e=this._root,n=!1,r=0,i=[];!n;)if(e)i.push(e),e=e.left;else if(i.length>0){if(e=i.pop(),r===t)return e;r++,e=e.right}else n=!0;return null},l.prototype.next=function(t){var e=this._root,n=null;if(t.right){for(n=t.right;n.left;)n=n.left;return n}for(var r=this._comparator;e;){var i=r(t.key,e.key);if(0===i)break;i<0?(n=e,e=e.left):e=e.right}return n},l.prototype.prev=function(t){var e=this._root,n=null;if(null!==t.left){for(n=t.left;n.right;)n=n.right;return n}for(var r=this._comparator;e;){var i=r(t.key,e.key);if(0===i)break;i<0?e=e.left:(n=e,e=e.right)}return n},l.prototype.clear=function(){return this._root=null,this._size=0,this},l.prototype.toList=function(){return c(this._root)},l.prototype.load=function(t,e,n){void 0===e&&(e=[]),void 0===n&&(n=!1);var r=t.length,i=this._comparator;if(n&&y(t,e,0,r-1,i),null===this._root)this._root=u(t,e,0,r),this._size=r;else{var o=f(this.toList(),h(t,e),i);r=this._size+r,this._root=p({head:o},0,r)}return this},l.prototype.isEmpty=function(){return null===this._root},Object.defineProperty(l.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),l.prototype.toString=function(t){void 0===t&&(t=function(t){return String(t.key)});var e=[];return a(this._root,"",!0,(function(t){return e.push(t)}),t),e.join("")},l.prototype.update=function(t,e,n){var r=this._comparator,a=o(t,this._root,r),l=a.left,u=a.right;r(t,e)<0?u=i(e,n,u,r):l=i(e,n,l,r),this._root=s(l,u,r)},l.prototype.split=function(t){return o(t,this._root,this._comparator)},l.prototype[Symbol.iterator]=function(){var e,n,r;return t(this,(function(t){switch(t.label){case 0:e=this._root,n=[],r=!1,t.label=1;case 1:return r?[3,6]:null===e?[3,2]:(n.push(e),e=e.left,[3,5]);case 2:return 0===n.length?[3,4]:[4,e=n.pop()];case 3:return t.sent(),e=e.right,[3,5];case 4:r=!0,t.label=5;case 5:return[3,1];case 6:return[2]}}))},l}();function u(t,n,r,i){var o=i-r;if(o>0){var s=r+Math.floor(o/2),a=t[s],l=n[s],h=new e(a,l);return h.left=u(t,n,r,s),h.right=u(t,n,s+1,i),h}return null}function h(t,n){for(var r=new e(null,null),i=r,o=0;o<t.length;o++)i=i.next=new e(t[o],n[o]);return i.next=null,r.next}function c(t){for(var n=t,r=[],i=!1,o=new e(null,null),s=o;!i;)n?(r.push(n),n=n.left):r.length>0?n=(n=s=s.next=r.pop()).right:i=!0;return s.next=null,o.next}function p(t,e,n){var r=n-e;if(r>0){var i=e+Math.floor(r/2),o=p(t,e,i),s=t.head;return s.left=o,t.head=t.head.next,s.right=p(t,i+1,n),s}return null}function f(t,n,r){for(var i=new e(null,null),o=i,s=t,a=n;null!==s&&null!==a;)r(s.key,a.key)<0?(o.next=s,s=s.next):(o.next=a,a=a.next),o=o.next;return null!==s?o.next=s:null!==a&&(o.next=a),i.next}function y(t,e,n,r,i){if(!(n>=r)){for(var o=t[n+r>>1],s=n-1,a=r+1;;){do{s++}while(i(t[s],o)<0);do{a--}while(i(t[a],o)>0);if(s>=a)break;var l=t[s];t[s]=t[a],t[a]=l,l=e[s],e[s]=e[a],e[a]=l}y(t,e,n,a,i),y(t,e,a+1,r,i)}}const g=(t,e)=>t.ll.x<=e.x&&e.x<=t.ur.x&&t.ll.y<=e.y&&e.y<=t.ur.y,d=(t,e)=>{if(e.ur.x<t.ll.x||t.ur.x<e.ll.x||e.ur.y<t.ll.y||t.ur.y<e.ll.y)return null;const n=t.ll.x<e.ll.x?e.ll.x:t.ll.x,r=t.ur.x<e.ur.x?t.ur.x:e.ur.x;return{ll:{x:n,y:t.ll.y<e.ll.y?e.ll.y:t.ll.y},ur:{x:r,y:t.ur.y<e.ur.y?t.ur.y:e.ur.y}}};let m=Number.EPSILON;void 0===m&&(m=Math.pow(2,-52));const x=m*m,v=(t,e)=>{if(-m<t&&t<m&&-m<e&&e<m)return 0;const n=t-e;return n*n<x*t*e?0:t<e?-1:1};class b{constructor(){this.reset()}reset(){this.xRounder=new w,this.yRounder=new w}round(t,e){return{x:this.xRounder.round(t),y:this.yRounder.round(e)}}}class w{constructor(){this.tree=new l,this.round(0)}round(t){const e=this.tree.add(t),n=this.tree.prev(e);if(null!==n&&0===v(e.key,n.key))return this.tree.remove(t),n.key;const r=this.tree.next(e);return null!==r&&0===v(e.key,r.key)?(this.tree.remove(t),r.key):t}}const E=new b,S=11102230246251565e-32,_=134217729,P=(3+8*S)*S;function M(t,e,n,r,i){let o,s,a,l,u=e[0],h=r[0],c=0,p=0;h>u==h>-u?(o=u,u=e[++c]):(o=h,h=r[++p]);let f=0;if(c<t&&p<n)for(h>u==h>-u?(s=u+o,a=o-(s-u),u=e[++c]):(s=h+o,a=o-(s-h),h=r[++p]),o=s,0!==a&&(i[f++]=a);c<t&&p<n;)h>u==h>-u?(s=o+u,l=s-o,a=o-(s-l)+(u-l),u=e[++c]):(s=o+h,l=s-o,a=o-(s-l)+(h-l),h=r[++p]),o=s,0!==a&&(i[f++]=a);for(;c<t;)s=o+u,l=s-o,a=o-(s-l)+(u-l),u=e[++c],o=s,0!==a&&(i[f++]=a);for(;p<n;)s=o+h,l=s-o,a=o-(s-l)+(h-l),h=r[++p],o=s,0!==a&&(i[f++]=a);return 0===o&&0!==f||(i[f++]=o),f}function k(t,e){let n=e[0];for(let r=1;r<t;r++)n+=e[r];return n}function C(t){return new Float64Array(t)}const I=(3+16*S)*S,R=(2+12*S)*S,L=(9+64*S)*S*S,A=C(4),T=C(8),B=C(12),z=C(16),O=C(4);function N(t,e,n,r,i,o,s){let a,l,u,h,c,p,f,y,g,d,m,x,v,b,w,E,S,C;const I=t-i,N=n-i,F=e-o,j=r-o;b=I*j,p=_*I,f=p-(p-I),y=I-f,p=_*j,g=p-(p-j),d=j-g,w=y*d-(b-f*g-y*g-f*d),E=F*N,p=_*F,f=p-(p-F),y=F-f,p=_*N,g=p-(p-N),d=N-g,S=y*d-(E-f*g-y*g-f*d),m=w-S,c=w-m,A[0]=w-(m+c)+(c-S),x=b+m,c=x-b,v=b-(x-c)+(m-c),m=v-E,c=v-m,A[1]=v-(m+c)+(c-E),C=x+m,c=C-x,A[2]=x-(C-c)+(m-c),A[3]=C;let $=k(4,A),q=R*s;if($>=q||-$>=q)return $;if(c=t-I,a=t-(I+c)+(c-i),c=n-N,u=n-(N+c)+(c-i),c=e-F,l=e-(F+c)+(c-o),c=r-j,h=r-(j+c)+(c-o),0===a&&0===l&&0===u&&0===h)return $;if(q=L*s+P*Math.abs($),$+=I*h+j*a-(F*u+N*l),$>=q||-$>=q)return $;b=a*j,p=_*a,f=p-(p-a),y=a-f,p=_*j,g=p-(p-j),d=j-g,w=y*d-(b-f*g-y*g-f*d),E=l*N,p=_*l,f=p-(p-l),y=l-f,p=_*N,g=p-(p-N),d=N-g,S=y*d-(E-f*g-y*g-f*d),m=w-S,c=w-m,O[0]=w-(m+c)+(c-S),x=b+m,c=x-b,v=b-(x-c)+(m-c),m=v-E,c=v-m,O[1]=v-(m+c)+(c-E),C=x+m,c=C-x,O[2]=x-(C-c)+(m-c),O[3]=C;const G=M(4,A,4,O,T);b=I*h,p=_*I,f=p-(p-I),y=I-f,p=_*h,g=p-(p-h),d=h-g,w=y*d-(b-f*g-y*g-f*d),E=F*u,p=_*F,f=p-(p-F),y=F-f,p=_*u,g=p-(p-u),d=u-g,S=y*d-(E-f*g-y*g-f*d),m=w-S,c=w-m,O[0]=w-(m+c)+(c-S),x=b+m,c=x-b,v=b-(x-c)+(m-c),m=v-E,c=v-m,O[1]=v-(m+c)+(c-E),C=x+m,c=C-x,O[2]=x-(C-c)+(m-c),O[3]=C;const U=M(G,T,4,O,B);b=a*h,p=_*a,f=p-(p-a),y=a-f,p=_*h,g=p-(p-h),d=h-g,w=y*d-(b-f*g-y*g-f*d),E=l*u,p=_*l,f=p-(p-l),y=l-f,p=_*u,g=p-(p-u),d=u-g,S=y*d-(E-f*g-y*g-f*d),m=w-S,c=w-m,O[0]=w-(m+c)+(c-S),x=b+m,c=x-b,v=b-(x-c)+(m-c),m=v-E,c=v-m,O[1]=v-(m+c)+(c-E),C=x+m,c=C-x,O[2]=x-(C-c)+(m-c),O[3]=C;const J=M(U,B,4,O,z);return z[J-1]}function F(t,e,n,r,i,o){const s=(e-o)*(n-i),a=(t-i)*(r-o),l=s-a,u=Math.abs(s+a);return Math.abs(l)>=I*u?l:-N(t,e,n,r,i,o,u)}const j=(t,e)=>t.x*e.y-t.y*e.x,$=(t,e)=>t.x*e.x+t.y*e.y,q=(t,e,n)=>{const r=F(t.x,t.y,e.x,e.y,n.x,n.y);return r>0?-1:r<0?1:0},G=t=>Math.sqrt($(t,t)),U=(t,e,n)=>{const r={x:e.x-t.x,y:e.y-t.y},i={x:n.x-t.x,y:n.y-t.y};return j(i,r)/G(i)/G(r)},J=(t,e,n)=>{const r={x:e.x-t.x,y:e.y-t.y},i={x:n.x-t.x,y:n.y-t.y};return $(i,r)/G(i)/G(r)},Z=(t,e,n)=>0===e.y?null:{x:t.x+e.x/e.y*(n-t.y),y:n},D=(t,e,n)=>0===e.x?null:{x:n,y:t.y+e.y/e.x*(n-t.x)},H=(t,e,n,r)=>{if(0===e.x)return D(n,r,t.x);if(0===r.x)return D(t,e,n.x);if(0===e.y)return Z(n,r,t.y);if(0===r.y)return Z(t,e,n.y);const i=j(e,r);if(0==i)return null;const o={x:n.x-t.x,y:n.y-t.y},s=j(o,e)/i,a=j(o,r)/i;return{x:(t.x+a*e.x+(n.x+s*r.x))/2,y:(t.y+a*e.y+(n.y+s*r.y))/2}};class V{static compare(t,e){const n=V.comparePoints(t.point,e.point);return 0!==n?n:(t.point!==e.point&&t.link(e),t.isLeft!==e.isLeft?t.isLeft?1:-1:X.compare(t.segment,e.segment))}static comparePoints(t,e){return t.x<e.x?-1:t.x>e.x?1:t.y<e.y?-1:t.y>e.y?1:0}constructor(t,e){void 0===t.events?t.events=[this]:t.events.push(this),this.point=t,this.isLeft=e}link(t){if(t.point===this.point)throw new Error("Tried to link already linked events");const e=t.point.events;for(let t=0,n=e.length;t<n;t++){const n=e[t];this.point.events.push(n),n.point=this.point}this.checkForConsuming()}checkForConsuming(){const t=this.point.events.length;for(let e=0;e<t;e++){const n=this.point.events[e];if(void 0===n.segment.consumedBy)for(let r=e+1;r<t;r++){const t=this.point.events[r];void 0===t.consumedBy&&n.otherSE.point.events===t.otherSE.point.events&&n.segment.consume(t.segment)}}}getAvailableLinkedEvents(){const t=[];for(let e=0,n=this.point.events.length;e<n;e++){const n=this.point.events[e];n!==this&&!n.segment.ringOut&&n.segment.isInResult()&&t.push(n)}return t}getLeftmostComparator(t){const e=new Map,n=n=>{const r=n.otherSE;e.set(n,{sine:U(this.point,t.point,r.point),cosine:J(this.point,t.point,r.point)})};return(t,r)=>{e.has(t)||n(t),e.has(r)||n(r);const{sine:i,cosine:o}=e.get(t),{sine:s,cosine:a}=e.get(r);return i>=0&&s>=0?o<a?1:o>a?-1:0:i<0&&s<0?o<a?-1:o>a?1:0:s<i?-1:s>i?1:0}}}let Y=0;class X{static compare(t,e){const n=t.leftSE.point.x,r=e.leftSE.point.x,i=t.rightSE.point.x,o=e.rightSE.point.x;if(o<n)return 1;if(i<r)return-1;const s=t.leftSE.point.y,a=e.leftSE.point.y,l=t.rightSE.point.y,u=e.rightSE.point.y;if(n<r){if(a<s&&a<l)return 1;if(a>s&&a>l)return-1;const n=t.comparePoint(e.leftSE.point);if(n<0)return 1;if(n>0)return-1;const r=e.comparePoint(t.rightSE.point);return 0!==r?r:-1}if(n>r){if(s<a&&s<u)return-1;if(s>a&&s>u)return 1;const n=e.comparePoint(t.leftSE.point);if(0!==n)return n;const r=t.comparePoint(e.rightSE.point);return r<0?1:r>0?-1:1}if(s<a)return-1;if(s>a)return 1;if(i<o){const n=e.comparePoint(t.rightSE.point);if(0!==n)return n}if(i>o){const n=t.comparePoint(e.rightSE.point);if(n<0)return 1;if(n>0)return-1}if(i!==o){const t=l-s,e=i-n,h=u-a,c=o-r;if(t>e&&h<c)return 1;if(t<e&&h>c)return-1}return i>o?1:i<o||l<u?-1:l>u?1:t.id<e.id?-1:t.id>e.id?1:0}constructor(t,e,n,r){this.id=++Y,this.leftSE=t,t.segment=this,t.otherSE=e,this.rightSE=e,e.segment=this,e.otherSE=t,this.rings=n,this.windings=r}static fromRing(t,e,n){let r,i,o;const s=V.comparePoints(t,e);if(s<0)r=t,i=e,o=1;else{if(!(s>0))throw new Error(`Tried to create degenerate segment at [${t.x}, ${t.y}]`);r=e,i=t,o=-1}const a=new V(r,!0),l=new V(i,!1);return new X(a,l,[n],[o])}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,e=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:t<e?t:e},ur:{x:this.rightSE.point.x,y:t>e?t:e}}}vector(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}isAnEndpoint(t){return t.x===this.leftSE.point.x&&t.y===this.leftSE.point.y||t.x===this.rightSE.point.x&&t.y===this.rightSE.point.y}comparePoint(t){if(this.isAnEndpoint(t))return 0;const e=this.leftSE.point,n=this.rightSE.point,r=this.vector();if(e.x===n.x)return t.x===e.x?0:t.x<e.x?1:-1;const i=(t.y-e.y)/r.y,o=e.x+i*r.x;if(t.x===o)return 0;const s=(t.x-e.x)/r.x,a=e.y+s*r.y;return t.y===a?0:t.y<a?-1:1}getIntersection(t){const e=this.bbox(),n=t.bbox(),r=d(e,n);if(null===r)return null;const i=this.leftSE.point,o=this.rightSE.point,s=t.leftSE.point,a=t.rightSE.point,l=g(e,s)&&0===this.comparePoint(s),u=g(n,i)&&0===t.comparePoint(i),h=g(e,a)&&0===this.comparePoint(a),c=g(n,o)&&0===t.comparePoint(o);if(u&&l)return c&&!h?o:!c&&h?a:null;if(u)return h&&i.x===a.x&&i.y===a.y?null:i;if(l)return c&&o.x===s.x&&o.y===s.y?null:s;if(c&&h)return null;if(c)return o;if(h)return a;const p=H(i,this.vector(),s,t.vector());return null===p?null:g(r,p)?E.round(p.x,p.y):null}split(t){const e=[],n=void 0!==t.events,r=new V(t,!0),i=new V(t,!1),o=this.rightSE;this.replaceRightSE(i),e.push(i),e.push(r);const s=new X(r,o,this.rings.slice(),this.windings.slice());return V.comparePoints(s.leftSE.point,s.rightSE.point)>0&&s.swapEvents(),V.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),n&&(r.checkForConsuming(),i.checkForConsuming()),e}swapEvents(){const t=this.rightSE;this.rightSE=this.leftSE,this.leftSE=t,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(let t=0,e=this.windings.length;t<e;t++)this.windings[t]*=-1}consume(t){let e=this,n=t;for(;e.consumedBy;)e=e.consumedBy;for(;n.consumedBy;)n=n.consumedBy;const r=X.compare(e,n);if(0!==r){if(r>0){const t=e;e=n,n=t}if(e.prev===n){const t=e;e=n,n=t}for(let t=0,r=n.rings.length;t<r;t++){const r=n.rings[t],i=n.windings[t],o=e.rings.indexOf(r);-1===o?(e.rings.push(r),e.windings.push(i)):e.windings[o]+=i}n.rings=null,n.windings=null,n.consumedBy=e,n.leftSE.consumedBy=e.leftSE,n.rightSE.consumedBy=e.rightSE}}prevInResult(){return 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(void 0!==this._beforeState)return this._beforeState;if(this.prev){const t=this.prev.consumedBy||this.prev;this._beforeState=t.afterState()}else this._beforeState={rings:[],windings:[],multiPolys:[]};return this._beforeState}afterState(){if(void 0!==this._afterState)return this._afterState;const t=this.beforeState();this._afterState={rings:t.rings.slice(0),windings:t.windings.slice(0),multiPolys:[]};const e=this._afterState.rings,n=this._afterState.windings,r=this._afterState.multiPolys;for(let t=0,r=this.rings.length;t<r;t++){const r=this.rings[t],i=this.windings[t],o=e.indexOf(r);-1===o?(e.push(r),n.push(i)):n[o]+=i}const i=[],o=[];for(let t=0,r=e.length;t<r;t++){if(0===n[t])continue;const r=e[t],s=r.poly;if(-1===o.indexOf(s))if(r.isExterior)i.push(s);else{-1===o.indexOf(s)&&o.push(s);const t=i.indexOf(r.poly);-1!==t&&i.splice(t,1)}}for(let t=0,e=i.length;t<e;t++){const e=i[t].multiPoly;-1===r.indexOf(e)&&r.push(e)}return this._afterState}isInResult(){if(this.consumedBy)return!1;if(void 0!==this._isInResult)return this._isInResult;const t=this.beforeState().multiPolys,e=this.afterState().multiPolys;switch(at.type){case"union":{const n=0===t.length,r=0===e.length;this._isInResult=n!==r;break}case"intersection":{let n,r;t.length<e.length?(n=t.length,r=e.length):(n=e.length,r=t.length),this._isInResult=r===at.numMultiPolys&&n<r;break}case"xor":{const n=Math.abs(t.length-e.length);this._isInResult=n%2==1;break}case"difference":{const n=t=>1===t.length&&t[0].isSubject;this._isInResult=n(t)!==n(e);break}default:throw new Error(`Unrecognized operation type found ${at.type}`)}return this._isInResult}}class K{constructor(t,e,n){if(!Array.isArray(t)||0===t.length)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=e,this.isExterior=n,this.segments=[],"number"!=typeof t[0][0]||"number"!=typeof t[0][1])throw new Error("Input geometry is not a valid Polygon or MultiPolygon");const r=E.round(t[0][0],t[0][1]);this.bbox={ll:{x:r.x,y:r.y},ur:{x:r.x,y:r.y}};let i=r;for(let e=1,n=t.length;e<n;e++){if("number"!=typeof t[e][0]||"number"!=typeof t[e][1])throw new Error("Input geometry is not a valid Polygon or MultiPolygon");let n=E.round(t[e][0],t[e][1]);n.x===i.x&&n.y===i.y||(this.segments.push(X.fromRing(i,n,this)),n.x<this.bbox.ll.x&&(this.bbox.ll.x=n.x),n.y<this.bbox.ll.y&&(this.bbox.ll.y=n.y),n.x>this.bbox.ur.x&&(this.bbox.ur.x=n.x),n.y>this.bbox.ur.y&&(this.bbox.ur.y=n.y),i=n)}r.x===i.x&&r.y===i.y||this.segments.push(X.fromRing(i,r,this))}getSweepEvents(){const t=[];for(let e=0,n=this.segments.length;e<n;e++){const n=this.segments[e];t.push(n.leftSE),t.push(n.rightSE)}return t}}class W{constructor(t,e){if(!Array.isArray(t))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new K(t[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 e=1,n=t.length;e<n;e++){const n=new K(t[e],this,!1);n.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=n.bbox.ll.x),n.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=n.bbox.ll.y),n.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=n.bbox.ur.x),n.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=n.bbox.ur.y),this.interiorRings.push(n)}this.multiPoly=e}getSweepEvents(){const t=this.exteriorRing.getSweepEvents();for(let e=0,n=this.interiorRings.length;e<n;e++){const n=this.interiorRings[e].getSweepEvents();for(let e=0,r=n.length;e<r;e++)t.push(n[e])}return t}}class Q{constructor(t,e){if(!Array.isArray(t))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{"number"==typeof t[0][0][0]&&(t=[t])}catch(t){}this.polys=[],this.bbox={ll:{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY},ur:{x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY}};for(let e=0,n=t.length;e<n;e++){const n=new W(t[e],this);n.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=n.bbox.ll.x),n.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=n.bbox.ll.y),n.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=n.bbox.ur.x),n.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=n.bbox.ur.y),this.polys.push(n)}this.isSubject=e}getSweepEvents(){const t=[];for(let e=0,n=this.polys.length;e<n;e++){const n=this.polys[e].getSweepEvents();for(let e=0,r=n.length;e<r;e++)t.push(n[e])}return t}}class tt{static factory(t){const e=[];for(let n=0,r=t.length;n<r;n++){const r=t[n];if(!r.isInResult()||r.ringOut)continue;let i=null,o=r.leftSE,s=r.rightSE;const a=[o],l=o.point,u=[];for(;i=o,o=s,a.push(o),o.point!==l;)for(;;){const t=o.getAvailableLinkedEvents();if(0===t.length){const t=a[0].point,e=a[a.length-1].point;throw new Error(`Unable to complete output ring starting at [${t.x}, ${t.y}]. Last matching segment found ends at [${e.x}, ${e.y}].`)}if(1===t.length){s=t[0].otherSE;break}let n=null;for(let t=0,e=u.length;t<e;t++)if(u[t].point===o.point){n=t;break}if(null!==n){const t=u.splice(n)[0],r=a.splice(t.index);r.unshift(r[0].otherSE),e.push(new tt(r.reverse()));continue}u.push({index:a.length,point:o.point});const r=o.getLeftmostComparator(i);s=t.sort(r)[0].otherSE;break}e.push(new tt(a))}return e}constructor(t){this.events=t;for(let e=0,n=t.length;e<n;e++)t[e].segment.ringOut=this;this.poly=null}getGeom(){let t=this.events[0].point;const e=[t];for(let n=1,r=this.events.length-1;n<r;n++){const r=this.events[n].point,i=this.events[n+1].point;0!==q(r,t,i)&&(e.push(r),t=r)}if(1===e.length)return null;const n=e[0],r=e[1];0===q(n,t,r)&&e.shift(),e.push(e[0]);const i=this.isExteriorRing()?1:-1,o=this.isExteriorRing()?0:e.length-1,s=this.isExteriorRing()?e.length:-1,a=[];for(let t=o;t!=s;t+=i)a.push([e[t].x,e[t].y]);return a}isExteriorRing(){if(void 0===this._isExteriorRing){const t=this.enclosingRing();this._isExteriorRing=!t||!t.isExteriorRing()}return this._isExteriorRing}enclosingRing(){return void 0===this._enclosingRing&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}_calcEnclosingRing(){let t=this.events[0];for(let e=1,n=this.events.length;e<n;e++){const n=this.events[e];V.compare(t,n)>0&&(t=n)}let e=t.segment.prevInResult(),n=e?e.prevInResult():null;for(;;){if(!e)return null;if(!n)return e.ringOut;if(n.ringOut!==e.ringOut)return n.ringOut.enclosingRing()!==e.ringOut?e.ringOut:e.ringOut.enclosingRing();e=n.prevInResult(),n=e?e.prevInResult():null}}}class et{constructor(t){this.exteriorRing=t,t.poly=this,this.interiorRings=[]}addInterior(t){this.interiorRings.push(t),t.poly=this}getGeom(){const t=[this.exteriorRing.getGeom()];if(null===t[0])return null;for(let e=0,n=this.interiorRings.length;e<n;e++){const n=this.interiorRings[e].getGeom();null!==n&&t.push(n)}return t}}class nt{constructor(t){this.rings=t,this.polys=this._composePolys(t)}getGeom(){const t=[];for(let e=0,n=this.polys.length;e<n;e++){const n=this.polys[e].getGeom();null!==n&&t.push(n)}return t}_composePolys(t){const e=[];for(let n=0,r=t.length;n<r;n++){const r=t[n];if(!r.poly)if(r.isExteriorRing())e.push(new et(r));else{const t=r.enclosingRing();t.poly||e.push(new et(t)),t.poly.addInterior(r)}}return e}}class rt{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:X.compare;this.queue=t,this.tree=new l(e),this.segments=[]}process(t){const e=t.segment,n=[];if(t.consumedBy)return t.isLeft?this.queue.remove(t.otherSE):this.tree.remove(e),n;const r=t.isLeft?this.tree.add(e):this.tree.find(e);if(!r)throw new Error(`Unable to find segment #${e.id} [${e.leftSE.point.x}, ${e.leftSE.point.y}] -> [${e.rightSE.point.x}, ${e.rightSE.point.y}] in SweepLine tree.`);let i,o,s=r,a=r;for(;void 0===i;)s=this.tree.prev(s),null===s?i=null:void 0===s.key.consumedBy&&(i=s.key);for(;void 0===o;)a=this.tree.next(a),null===a?o=null:void 0===a.key.consumedBy&&(o=a.key);if(t.isLeft){let r=null;if(i){const t=i.getIntersection(e);if(null!==t&&(e.isAnEndpoint(t)||(r=t),!i.isAnEndpoint(t))){const e=this._splitSafely(i,t);for(let t=0,r=e.length;t<r;t++)n.push(e[t])}}let s=null;if(o){const t=o.getIntersection(e);if(null!==t&&(e.isAnEndpoint(t)||(s=t),!o.isAnEndpoint(t))){const e=this._splitSafely(o,t);for(let t=0,r=e.length;t<r;t++)n.push(e[t])}}if(null!==r||null!==s){let t=null;t=null===r?s:null===s||V.comparePoints(r,s)<=0?r:s,this.queue.remove(e.rightSE),n.push(e.rightSE);const i=e.split(t);for(let t=0,e=i.length;t<e;t++)n.push(i[t])}n.length>0?(this.tree.remove(e),n.push(t)):(this.segments.push(e),e.prev=i)}else{if(i&&o){const t=i.getIntersection(o);if(null!==t){if(!i.isAnEndpoint(t)){const e=this._splitSafely(i,t);for(let t=0,r=e.length;t<r;t++)n.push(e[t])}if(!o.isAnEndpoint(t)){const e=this._splitSafely(o,t);for(let t=0,r=e.length;t<r;t++)n.push(e[t])}}}this.tree.remove(e)}return n}_splitSafely(t,e){this.tree.remove(t);const n=t.rightSE;this.queue.remove(n);const r=t.split(e);return r.push(n),void 0===t.consumedBy&&this.tree.add(t),r}}const it="undefined"!=typeof process&&process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,ot="undefined"!=typeof process&&process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6;class st{run(t,e,n){at.type=t,E.reset();const r=[new Q(e,!0)];for(let t=0,e=n.length;t<e;t++)r.push(new Q(n[t],!1));if(at.numMultiPolys=r.length,"difference"===at.type){const t=r[0];let e=1;for(;e<r.length;)null!==d(r[e].bbox,t.bbox)?e++:r.splice(e,1)}if("intersection"===at.type)for(let t=0,e=r.length;t<e;t++){const e=r[t];for(let n=t+1,i=r.length;n<i;n++)if(null===d(e.bbox,r[n].bbox))return[]}const i=new l(V.compare);for(let t=0,e=r.length;t<e;t++){const e=r[t].getSweepEvents();for(let t=0,n=e.length;t<n;t++)if(i.insert(e[t]),i.size>it)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big).")}const o=new rt(i);let s=i.size,a=i.pop();for(;a;){const t=a.key;if(i.size===s){const e=t.segment;throw new Error(`Unable to pop() ${t.isLeft?"left":"right"} SweepEvent [${t.point.x}, ${t.point.y}] from segment #${e.id} [${e.leftSE.point.x}, ${e.leftSE.point.y}] -> [${e.rightSE.point.x}, ${e.rightSE.point.y}] from queue.`)}if(i.size>it)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big).");if(o.segments.length>ot)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments).");const e=o.process(t);for(let t=0,n=e.length;t<n;t++){const n=e[t];void 0===n.consumedBy&&i.insert(n)}s=i.size,a=i.pop()}E.reset();const u=tt.factory(o.segments);return new nt(u).getGeom()}}const at=new st,lt=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return at.run("union",t,n)},ut=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return at.run("intersection",t,n)},ht=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return at.run("xor",t,n)},ct=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return at.run("difference",t,n)};var pt={union:lt,intersection:ut,xor:ht,difference:ct};return pt}()},z(O={exports:{}},O.exports),O.exports);function F(t,e,n){void 0===n&&(n={});var r=C(t),i=C(e),o=N.union(r.coordinates,i.coordinates);return 0===o.length?null:1===o.length?function(t,e,n){void 0===n&&(n={});for(var r=0,i=t;r<i.length;r++){var o=i[r];if(o.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var s=0;s<o[o.length-1].length;s++)if(o[o.length-1][s]!==o[0][s])throw new Error("First and last Position are not equivalent.")}return E({type:"Polygon",coordinates:t},e,n)}(o[0],n.properties):function(t,e,n){return void 0===n&&(n={}),E({type:"MultiPolygon",coordinates:t},e,n)}(o,n.properties)}function j(t){var e=null;if("svg"===t.tag)return e=$(t);if(e=document.createElement(t.tag),"object"===A(t.props)&&null!==t.props){var n=function(){var n=t.props[r];if("on"===r){n=t.props[r];var i=function(t){e.addEventListener(t,(function(e){return n[t](e)}))};for(var o in n)i(o)}else if("dataset"===r)Object.keys(n).forEach((function(t){e.dataset[t]=n[t]}));else if("style"===r)if("string"==typeof n)e.setAttribute(r,n);else{var s=[];Object.keys(n).forEach((function(t){s.push("".concat(t,":").concat(n[t]))})),e.setAttribute(r,s.join(";"))}else"cssText"===r?e.style.cssText=n:e.setAttribute(r,n)};for(var r in t.props)n()}return t.children instanceof Array?t.children.forEach((function(t){e.appendChild(j(t))})):e.textContent=t.children,e}function $(t){var e="http://www.w3.org/1999/xlink",n=document.createElementNS("http://www.w3.org/2000/svg",t.tag);if("svg"===t.tag&&n.setAttribute("xmlns:xlink",e),"object"===A(t.props)&&null!==t.props)for(var r in t.props){var i=t.props[r];"xlink:href"===r?n.setAttributeNS(e,r,i):n.setAttribute(r,i)}return t.children instanceof Array?t.children.forEach((function(t){n.appendChild($(t))})):n.textContent=t.children,n}function q(t,e){var n=JSON.parse(JSON.stringify(e));for(var r in n)t[r]&&("center"==r?(n.center.wgs84=t.center,t.zoom&&(n.center.zoom=t.zoom)):n[r]=t[r]);return n}function G(t){var e=[];return t.info&&t.info.show&&(e.push({tag:"div",props:{class:"PointInfo ".concat(t.info.type)},children:[]}),t.titles&&t.titles.show&&e[0].children.push({tag:"div",props:{class:"PointTitle"},children:t.titles.value}),t.contents&&t.contents.show&&e[0].children.push({tag:"div",props:{class:"PointContent"},children:t.contents.value})),e}function U(t,e){!e||"string"!=typeof e&&"number"!=typeof e||(e=[e]);for(var n=document.querySelectorAll(".PointMap"),r=function(r){e?e.forEach((function(e,i){var o,s="PointMap_"+e;(null===(o=n[r])||void 0===o?void 0:o.className.indexOf(s))>-1&&("visible"==t?n[r].classList.remove("z-none"):n[r].classList.add("z-none"))})):"visible"==t?n[r].classList.remove("z-none"):n[r].classList.add("z-none")},i=0;i<n.length;i++)r(i)}function J(t){if(!t)return console.log("请传入标点的id!!!"),!1;!t||"string"!=typeof t&&"number"!=typeof t||(t=[t]);for(var e=document.querySelectorAll(".PointMap"),n=function(n){t.forEach((function(t,r){var i,o="PointMap_"+t;(null===(i=e[n])||void 0===i?void 0:i.className.indexOf(o))>-1&&e[n].remove()}))},r=0;r<e.length;r++)n(r)}function Z(t,e,n){var r={"line-color":n["line-color"],"line-width":n["line-width"],"line-opacity":n["line-opacity"]};return n["line-blur"]&&(r["line-blur"]=n["line-blur"]),n["line-offset"]&&(r["line-offset"]=n["line-offset"]),{id:t,type:"line",source:e,layout:{"line-cap":"round","line-join":"round"},paint:r,metadata:{zIndex:n.zIndex}}}function D(t,e,n,r){return{id:t,type:"symbol",source:e,layout:{"text-field":n,"text-size":r["text-size"],"text-allow-overlap":!0,"text-justify":r["text-justify"],"text-offset":r["text-offset"],"text-anchor":"bottom","icon-image":"","text-font":["Alibaba-PuHuiTi Regular"]},paint:{"text-color":r["text-color"],"text-halo-color":r["text-halo-color"],"text-halo-width":r["text-halo-width"]},metadata:{zIndex:4}}}function H(t,e,n,r,i,o,s,a){var l,u="function"==typeof t?t.options:t;if(e&&(u.render=e,u.staticRenderFns=n,u._compiled=!0),r&&(u.functional=!0),o&&(u._scopeId="data-v-"+o),s?(l=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),i&&i.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(s)},u._ssrRegister=l):i&&(l=a?function(){i.call(this,(u.functional?this.parent:this).$root.$options.shadowRoot)}:i),l)if(u.functional){u._injectStyles=l;var h=u.render;u.render=function(t,e){return l.call(e),h(t,e)}}else{var c=u.beforeCreate;u.beforeCreate=c?[].concat(c,l):[l]}return{exports:t,options:u}}const V={name:"ZMap",props:{id:{type:String,default:"mapContainer"},mapStyle:{type:Object,default:()=>({})},mapKey:{type:String,default:""},cityMap:{type:[Object,String],default:()=>({})},baseMap:{type:Array,default:()=>[]},farmMap:{type:Array,default:()=>[]},lineMap:{type:Array,default:()=>[]},pointMap:{type:Array,default:()=>[]},heatMap:{type:[Object,String],default:()=>({})},routeMap:{type:[Object,String],default:()=>({})},params:{type:Object,default:()=>({})},isDrilling:{type:Boolean,default:!1}},data:()=>({title:"gis地图可视化",mapBox:null,cityContainer:new Map,baseContainer:new Map,farmContainer:new Map,lineContainer:new Map,dotContainer:new Map,routeContainer:new Map,layerTypes:{source:"_s",fill:"_f",line:"_l",text:"_t",prominent:"_p",shadow:"_sh"},parameter:{shadow:!1,scale:!1,zoom:6,minZoom:3,maxZoom:20,center:[106.64070540957499,29.542372847334505],isProminent:"city",prominentType:"geojson",prominentUrl:"",prominentHeight:1,prominentFillColor:"rgba(0, 0, 0, 0.5)",pitch:0,zIndex:0},properties:{center:{wgs84:[106.64314362686562,29.54485285119372],zoom:14.978617404032729},"fill-color":"#016b67","fill-opacity":.5,"fill-outline-color":"#38d9a9","line-color":"rgba(255, 50, 10, 1)","line-opacity":1,"line-width":1,"text-size":14,"text-offset":[0,1.8],"text-justify":"center","text-color":"rgb(159, 96, 55)","text-halo-color":"#fff","text-halo-width":1.8,shadow:{"line-color":"#38d9a9","line-opacity":1,"line-width":25,"line-blur":40,"line-offset":-5}},onClickType:""}),computed:{},mounted(){this.getUsagePermissions()},watch:{cityMap:{handler(t){t&&this.mapBox&&setTimeout((()=>{this.addCityMaps(t)}),400)},deep:!0,immediate:!0},heatMap:{handler(t){t&&this.mapBox&&this.mapBox.on("load",(()=>{this.addHeatMaps(t)}))},deep:!0,immediate:!0},baseMap:{handler(t){t&&(null==t?void 0:t.length)>0&&this.mapBox&&setTimeout((()=>{this.addBaseMaps(t)}),400)},deep:!0,immediate:!0},farmMap:{handler(t){t&&(null==t?void 0:t.length)>0&&this.mapBox&&setTimeout((()=>{this.addFarmMaps(t)}),400)},deep:!0,immediate:!0},lineMap:{handler(t){t&&(null==t?void 0:t.length)>0&&this.mapBox&&setTimeout((()=>{this.addLineMaps(t)}),400)},deep:!0,immediate:!0},pointMap:{handler(t){t&&(null==t?void 0:t.length)>0&&this.mapBox&&setTimeout((()=>{this.addPointMaps(t)}),400)},deep:!0,immediate:!0}},methods:{setCache(t,e){localStorage.setItem(t,JSON.stringify(e))},getCache(t){const e=localStorage.getItem(t);return e?JSON.parse(e):null},getUsagePermissions(){let t="pro__MAP_VIEWS",e=this.getCache(t),n=(new Date).getTime();if(e&&e.value&&n<e.expire)return this.initMap(),!0;return fetch("https://map.zhuyukeji.com/Tool.Map",{method:"GET"}).then((e=>{if(e.ok){this.initMap();let e=n+6048e5;return this.setCache(t,{value:!0,expire:e}),!0}return console.groupCollapsed("%cz-map-views","color:#009a61;font-size:24px;font-weight:800;"),console.log("%c"+window.location.hostname+"\n-------------\n您当前域名没有购买地图服务,或者服务到期!!\n请登录https://map.zhuyukeji.com/Tool.map\n购买!!","color:#009a61"),console.groupEnd(),this.initMap(),!1})).then((t=>{})).catch((t=>(console.error("请求出错:",t),!1)))},initMap(){this.parameter=function(t,e){var n=JSON.parse(JSON.stringify(e));for(var r in n)t[r]&&(n[r]=t[r]);return n}(this.params,this.parameter),this.mapStyle.version&&(this.mapBox=new t.Map({container:this.id,center:this.parameter.center,minZoom:this.parameter.minZoom,maxZoom:this.parameter.maxZoom,zoom:this.parameter.zoom,style:this.mapStyle,pitch:this.parameter.pitch,bearing:0,antialias:!1,accessToken:this.mapKey}),this.parameter.scale&&this.mapBox.addControl(new t.ScaleControl,"bottom-right"))},addCityMaps(t){if(t){if("string"==typeof t&&(t=JSON.parse(t)),!t.properties.id)return console.log("请在properties中传入id"),!1;this.addAreaMap(t.properties,"city",t)}},addHeatMaps(t){const e="source_heat",n="layer_heat";"string"==typeof t&&(t=JSON.parse(t)),this.mapBox.addSource(e,{type:"geojson",data:t}),this.mapBox.addLayer({id:n,type:"heatmap",source:e,minZoom:3,paint:{"heatmap-weight":["interpolate",["linear"],["get","mag"],0,0,6,1],"heatmap-intensity":["interpolate",["linear"],["zoom"],0,1,9,3],"heatmap-color":["interpolate",["linear"],["heatmap-density"],0,"rgba(0,0,0,0)",.2,"#67a9cf",.4,"#d1e5f0",.6,"#fddbc7",.8,"#ef8a62",1,"#b2182b"],"heatmap-radius":["interpolate",["linear"],["zoom"],0,2,9,20],"heatmap-opacity":["interpolate",["linear"],["zoom"],7,1,9,0]}}),this.mapBox.on("click",n,(t=>{if(t.defaultPrevented)return;let e=this.mapBox.queryRenderedFeatures(t.point).filter((t=>t.layer.id==n))[0];this.$emit("heat-click",e.properties),t.preventDefault()}))},addAreaMap(e,n,r){const i=e.id,o=n+this.layerTypes.source+i,s=n+this.layerTypes.line+i,a=n+this.layerTypes.fill+i,l=n+this.layerTypes.text+i,u=n+this.layerTypes.prominent+i,h=n+this.layerTypes.shadow+i;let c=this,p={},f=[],y=!1;switch(r.type){case"Feature":p=q(r.properties,this.properties);break;case"FeatureCollection":p=q(r.features[0].properties,this.properties)}let g={base:{container:this.baseContainer,name:"baseContainer"},farm:{container:this.farmContainer,name:"farmContainer"},city:{container:this.cityContainer,name:"cityContainer"},line:{container:this.lineContainer,name:"lineContainer"},route:{container:this.routeContainer,name:"routeContainer"}};this.mapBox.getSource(o)||this.mapBox.addSource(o,function(t){return{type:"geojson",data:t}}(r)),"city"==n&&this.setLayout([...g[n].container.values()],"visibility","none");["base","farm","city"].indexOf(n)>-1&&(g[n].container.has(a)?this.setLayout([g[n].container.get(a)],"visibility","visible"):(this.mapBox.addLayer(function(t,e,n){return{id:t,type:"fill",source:e,layout:{},paint:{"fill-color":n["fill-color"],"fill-opacity":n["fill-opacity"]},metadata:{zIndex:n.zIndex}}}(a,o,p)),c[g[n].name].set(a,a)));["line","base","farm","city"].indexOf(n)>-1&&(g[n].container.has(s)?this.setLayout([g[n].container.get(s)],"visibility","visible"):(this.mapBox.addLayer(Z(s,o,p)),c[g[n].name].set(s,s)));["farm","city"].indexOf(n)>-1&&(g[n].container.has(l)?this.setLayout([g[n].container.get(l)],"visibility","visible"):(e.showText&&e.text&&"farm"==n&&this.mapBox.addLayer(D(l,o,e.text,p)),"city"==n&&this.mapBox.addLayer(D(l,o,"{name}",p)),c[g[n].name].set(l,l)));["base","city"].indexOf(n)>-1&&"extrusion"==this.parameter.prominentType&&this.addExtrusionImage(o,u);if(["base","city"].indexOf(n)>-1){if("base"==this.parameter.isProminent)switch(r.type){case"Feature":f=r.geometry.coordinates;break;case"FeatureCollection":f=r.features[0].geometry.coordinates}else"city"==this.parameter.isProminent&&("FeatureCollection"==r.type?r.features&&r.features.length>1?(f=function(t,e){if("push"==e){var n=[];return t.features.forEach((function(t,e){t.geometry.coordinates[0]&&t.geometry.coordinates[0].length>0&&(n=[].concat(T(t.geometry.coordinates[0]),T(n)))})),n}var r=t.features[0];return t.features.forEach((function(t,e){t.geometry.coordinates[0]&&t.geometry.coordinates[0].length>0&&(r=F(r,t))})),r.geometry.coordinates}(r,"union"),y=!0):f=r.features[0].geometry.coordinates&&1==r.features[0].geometry.coordinates.length?r.features[0].geometry.coordinates[0]:r.features[0].geometry.coordinates:f=r.geometry.coordinates&&1==r.geometry.coordinates.length?r.geometry.coordinates[0]:r.geometry.coordinates);if(g[n].container.has(u))this.setLayout([g[n].container.get(u)],"visibility","visible");else if(this.parameter.isProminent==n&&f.length>0){let t=y&&f[0][0]&&f[0][0][0]&&f[0][0][0][0]?f[0]:f;if("extrusionBg"==this.parameter.prominentType){let e=function(t){return{type:"geojson",data:{type:"Feature",geometry:{type:"Polygon",coordinates:[[[-180,90],[180,90],[180,-90],[-180,-90]]].concat(T(t))}}}}(t);this.addExtrusionImage(e,u)}else this.mapBox.addLayer(function(t,e,n,r){return{id:t,type:"fill",source:{type:"geojson",data:{type:"Feature",geometry:{type:"Polygon",coordinates:[[[-180,90],[180,90],[180,-90],[-180,-90]]].concat(T(e))}}},paint:{"fill-color":n},layout:{visibility:"visible"},metadata:{zIndex:r.zIndex}}}(u,t,this.parameter.prominentFillColor,p));c[g[n].name].set(u,u)}}switch(n){case"base":this.mapBox.on("click",a,(t=>{"point"===this.onClickType?(t.preventDefault(),this.onClickType=""):this.onClickType=a,t.defaultPrevented||setTimeout((()=>{this.onClickType===a&&this.$emit("base-click",i,e)}),200)}));break;case"farm":this.mapBox.on("click",a,(t=>{"point"===this.onClickType?(t.preventDefault(),this.onClickType=""):this.onClickType=a,t.defaultPrevented||setTimeout((()=>{this.onClickType===a&&this.$emit("farm-click",i,e)}),200)}),!0);break;case"route":let n=function(t){d||(d=t);const e=(t-d)/f;if(e>1)return;const r=function(t,e,n){void 0===n&&(n={});for(var r=C(t).coordinates,i=0,o=0;o<r.length&&!(e>=i&&o===r.length-1);o++){if(i>=e){var s=e-i;if(s){var a=I(r[o],r[o-1])-180;return R(r[o],s,a,n)}return S(r[o])}i+=L(r[o],r[o+1],n)}return S(r[r.length-1])}(y,g*e).geometry.coordinates,i={lng:r[0],lat:r[1]};let o="<p><span>纬度:</span>"+i.lng.toFixed(5)+"</p>";o+="<p><span>经度:</span>"+i.lat.toFixed(5)+"</p>",l.setHTML(o),u.setLngLat(i),c.mapBox.setPaintProperty(s,"line-gradient",["step",["line-progress"],"red",e,"rgba(255, 0, 0, 1)"]),c.mapBox.flyTo({center:i}),window.requestAnimationFrame(n)},r=[];"FeatureCollection"==data.type?r="LineString"==data.features[0].geometry.type?data.features[0].geometry.coordinates:data.features[0].geometry.coordinates[0]:"Feature"==data.type&&(r="LineString"==data.geometry.type?data.geometry.coordinates:data.geometry.coordinates[0]);const l=new t.Popup({closeButton:!1,closeOnClick:!1}),u=new t.Marker({color:"red",scale:.8,draggable:!1,pitchAlignment:"auto",rotationAlignment:"auto"}).setLngLat(r[0]).setPopup(l).addTo(this.mapBox).togglePopup();let h={"line-color":"rgba(255, 50, 10, 1)","line-opacity":1,"line-width":1};this.mapBox.addLayer(Z(s,o,h)),this.routeContainer.set(s,s);const f=time*1e3,y=function(t,e,n){if(void 0===n&&(n={}),t.length<2)throw new Error("coordinates must be an array of two or more positions");return E({type:"LineString",coordinates:t},e,n)}(r),g=v(y);let d;window.requestAnimationFrame(n);break;case"city":this.flyToMap(p),this.mapBox.on("click",a,(t=>{if("point"===this.onClickType&&(t.preventDefault(),this.onClickType=""),t.defaultPrevented)return;this.isDrilling&&this.setLayout([...this.cityContainer.values()],"visibility","none");let e=this.mapBox.queryRenderedFeatures(t.point).filter((t=>t.layer.id==a))[0],n=e.properties&&e.properties.adcode?e.properties.adcode:i;this.$emit("city-click",n,e.properties)}))}this.parameter.shadow&&f.length>0&&"farm"!=n&&this.addShadow(f,h,p)},addShadow(t,e,n){this.baseContainer.has(e)?this.setLayout([this.baseContainer.get(e)],"visibility","visible"):(this.mapBox.addLayer(function(t,e,n){return{id:t,type:"line",source:{type:"geojson",data:{type:"FeatureCollection",features:[{type:"Feature",properties:{adcode:t,name:"阴影"},geometry:{type:"Polygon",coordinates:[e]}}]}},paint:n.shadow,metadata:{zIndex:n.zIndex}}}(e,t,n)),this.baseContainer.set(e,e))},addExtrusionImage(t,e){if(this.parameter.prominentUrl){let n=this;this.mapBox.loadImage(this.parameter.prominentUrl,(function(r,i){if(r)throw r;n.mapBox.hasImage("ground")?(n.mapBox.updateImage("ground",i),n.mapBox.removeLayer("img_"+e),n.mapBox.addLayer({id:"img_"+e,source:t,type:"fill-extrusion",paint:{"fill-extrusion-height":n.parameter.prominentHeight,"fill-extrusion-base":0,"fill-extrusion-opacity":1,"fill-extrusion-pattern":"ground"}})):(n.mapBox.addImage("ground",i),n.mapBox.addLayer({id:"img_"+e,source:t,type:"fill-extrusion",paint:{"fill-extrusion-height":n.parameter.prominentHeight,"fill-extrusion-base":0,"fill-extrusion-opacity":1,"fill-extrusion-pattern":"ground"}}))}))}},addBaseMaps(t){if(!t||(null==t?void 0:t.length)<1)return!1;t.forEach(((t,e)=>{if(t.mapPosition){let n=JSON.parse(t.mapPosition);if(this.addAreaMap(t,"base",n),0==e){let t={};switch(n.type){case"Feature":t=n.properties;break;case"FeatureCollection":t=n.features[0].properties}"base"==this.parameter.isProminent&&this.flyToMap(t)}}}))},addFarmMaps(t){if(!t||(null==t?void 0:t.length)<1)return!1;t.forEach(((t,e)=>{if(t.mapPosition){let e=JSON.parse(t.mapPosition);this.addAreaMap(t,"farm",e)}}))},addLineMaps(t){if(!t||(null==t?void 0:t.length)<1)return!1;t.forEach(((t,e)=>{if(t.geoJson){let e=JSON.parse(t.geoJson);this.addAreaMap(t,"line",e)}}))},addPointMaps(t){t.forEach(((t,e)=>{let n="PointMap_"+t.id;this.dotContainer.get(n)?U("visible",t.id):t.center&&(this.switchAddPoint(t),this.dotContainer.set(n,n))}))},switchAddPoint(e){let n="";switch(e.type){case"signage":n=function(t,e){var n=e.className?e.className:"aaaaaaaaaaaaa";return j({tag:"div",props:{class:"PointSignages PointMap PointMap_"+e.id+" "+n,on:{click:function(n){n.stopPropagation(),t&&t(e.id)}}},children:[{tag:"div",props:{class:"PointMapBox"},children:[{tag:"div",props:{class:"PointSignage PointSignage_"+e.id},children:e.title},{tag:"div",props:{class:"PointLine"},children:[]},{tag:"div",props:{class:"footerCircle"},children:[]}]}]})}((t=>{this.pointClick(t)}),e);break;case"icon":n=function(t,e){var n=e.className?e.className:"",r=G(e);return j({tag:"div",props:{class:"PointIcons PointMap PointMap_"+e.id+" "+n,on:{click:function(n){n.stopPropagation(),t&&t(e.id)}}},children:[].concat(T(r),[{tag:"div",props:{class:"PointMapBox"},children:[{tag:"img",props:{class:"PointIcon PointIcon_"+e.id,src:e.icon,title:e.title}},{tag:"div",props:{class:"PointLine"},children:[]},{tag:"div",props:{class:"footerCircle"},children:[]}]}])})}((t=>{this.pointClick(t)}),e);break;case"point":n=function(t,e){var n=e.className?e.className:"",r=G(e);return j({tag:"div",props:{class:"PointImgs PointMap PointMap_"+e.id+" "+n,on:{click:function(n){n.stopPropagation(),t&&t(e.id)}}},children:[].concat(T(r),[{tag:"img",props:{class:"PointImg PointImg_"+e.id,src:e.icon,title:e.title}}])})}((t=>{this.pointClick(t)}),e);break;case"svgIcon":n=function(t,e){var n=e.className?e.className:"",r=G(e),i=[],o={};return e.icon&&i.push({tag:"img",props:{class:"PointImg PointImg_"+e.id,src:e.icon,title:e.title}}),e.svg&&(i.push(e.svg.data),e.svg.color&&(o.color=e.svg.color),e.svg.size&&(o["font-size"]=e.svg.size)),j({tag:"div",props:{class:"PointSvgIcons PointMap PointMap_"+e.id+" "+n,on:{click:function(n){n.stopPropagation(),t&&t(e.id)}},style:o},children:[].concat(T(r),i)})}((t=>{this.pointClick(t)}),e)}n&&new t.Marker({element:n}).setLngLat(e.center).addTo(this.mapBox)},pointClick(t){this.$emit("point-click",t),this.onClickType="point"},showMapBase(t,e,n){this.showMapArea(t,e,"base",n)},showMapFarm(t,e,n){this.showMapArea(t,e,"farm",n)},showMapArea(t,e,n,r){if(n||(n="farm"),e){"string"!=typeof e&&"number"!=typeof e||(e=[e]);let i=[];e.forEach(((t,e)=>{if(r){let e=n+this.layerTypes[r]+t;this.mapBox.getLayer(e)&&i.push(e)}else for(let e in this.layerTypes){let r=this.layerTypes[e],o=n+r+t;this.mapBox.getLayer(o)&&i.push(o)}})),this.setLayout(i,"visibility",t)}else"farm"==n?this.setLayout([...this.farmContainer.values()],"visibility",t):"base"==n&&this.setLayout([...this.baseContainer.values()],"visibility",t)},showMapPoint(t,e){U(t,e)},deleteMapPoint(t){J(t)},updateMapPoint(t){J(t.id),this.switchAddPoint(t)},flyToMap(t){t.center&&"string"==typeof t.center&&(t.center=JSON.parse(t.center)),t.center&&(t.center.wgs84?this.mapBox.flyTo({center:[t.center.wgs84[0],t.center.wgs84[1]],zoom:t.center.zoom}):this.mapBox.flyTo({center:[t.center[0],t.center[1]],zoom:t.zoom}))},setLayout(t,e,n){for(let r of t)r&&this.mapBox.setLayoutProperty(r,e,n)},setAreaColor(t,e,n){for(let e of t){let t=["case"];t.push(n),this.mapBox.setPaintProperty(e,"fill-color",t)}},setZoom(t){switch(t){case"zoomIn":this.mapBox.zoomIn();break;case"zoomOut":this.mapBox.zoomOut();break;case"resize":this.mapBox.resize()}}}};var Y=function(){var t=this._self._c;return t("div",{staticClass:"z-map-views w100 h100 pr"},[t("div",{ref:"mapContainer",staticClass:"mapContainer w100 h100 pr",attrs:{id:this.id}})])},X=[];Y._withStripped=!0;var K=H(V,Y,X,!1,null,"fd5304cf",null,null);K.options.__file="D:\\项目\\测试\\test\\map-views\\components\\ZMap\\ZMap.vue";var W=K.exports;W.install=t=>{t.component(W.name,W)};export{W as default};
@@ -0,0 +1,3 @@
1
+
2
+ 'use strict';
3
+ require('./style.css');
@@ -0,0 +1,2 @@
1
+ .w100{width:100%}.h100{height:100%}.mapContainer{height:100%;position:relative;width:100%}.PointMap{height:20px;left:0;position:absolute;top:0;white-space:nowrap;width:20px;z-index:5}.PointMap .PointImg,.PointMap .PointMapBox{bottom:50%;cursor:pointer;left:50%;position:absolute;-webkit-transform:translateX(-50%);transform:translateX(-50%)}.PointMap .PointMapBox{-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;z-index:11}.PointMap .PointMapBox,.PointMap .PointSignage{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center}.PointMap .PointSignage{-webkit-backdrop-filter:blur(15px);backdrop-filter:blur(15px);background:#60baff;border:2px solid #32a3fa;border-radius:4px;-webkit-box-shadow:inset 0 0 6px 0 #32a3fa;box-shadow:inset 0 0 6px 0 #32a3fa;color:#d8fbff;cursor:pointer;font-size:12px;height:37px;left:50%;min-width:95px;opacity:.8;padding:10px;position:absolute;top:-24px;-webkit-transform:translateX(-50%);transform:translateX(-50%);z-index:5}.PointMap .PointSignage:before{background:#faaa32;content:"";height:16px;left:0;position:absolute;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%);width:3px}.PointMap .PointIcon{border-radius:100%;cursor:pointer;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;height:24px;overflow:hidden;width:24px}.PointMap .PointInfo{background:#fff;border:1px solid #ddd;border-radius:8px;left:50%;max-width:160px;padding:10px;position:absolute;-webkit-transform:translateX(-50%);transform:translateX(-50%);-webkit-transition:all .5s;transition:all .5s;width:-webkit-max-content;width:-moz-max-content;width:max-content}.PointMap .PointInfo.hover,.PointMap .PointInfo.none{height:0;opacity:0;overflow:hidden;width:0}.PointMap .PointInfo:before{border:7px solid transparent;border-top-color:#fff;bottom:-14px;content:"";left:50%;position:absolute;-webkit-transform:translate(-50%);transform:translate(-50%);z-index:9}.PointMap .PointLine{background:-webkit-gradient(linear,left top,left bottom,from(#179aff),to(#18e0d2));background:linear-gradient(180deg,#179aff,#18e0d2);height:48px;pointer-events:none;width:2px}.PointMap .footerCircle{bottom:0;height:4px;left:50%;pointer-events:none;-webkit-transform:translateX(-50%);transform:translateX(-50%);width:10px}.PointMap .footerCircle,.PointMap .footerCircle:after{border:.6px solid #00e6ff;border-radius:50%;position:absolute}.PointMap .footerCircle:after{-webkit-animation:scaleAnima 1s linear infinite;animation:scaleAnima 1s linear infinite;-webkit-box-shadow:inset 1px 1px 5px #00e6ff;box-shadow:inset 1px 1px 5px #00e6ff;content:"";height:12px;left:calc(50% - 12px);top:calc(50% - 6px);-webkit-transform:scale(0);transform:scale(0);width:24px}.PointMap.PointImgs{height:32px;width:32px}.PointMap.PointImgs .PointInfo{bottom:calc(100% + 24px)}.PointMap.PointSvgIcons{color:#0b4a8a;font-size:40px;height:1em;width:1em}.PointMap.PointSvgIcons .PointInfo{bottom:calc(100% + 8px);color:#333;font-size:12px}.PointMap.PointSvgIcons img{left:50%;position:absolute;top:40%;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);width:.5em}.PointMap.PointIcons .PointInfo{bottom:calc(100% + 76px)}.PointMap.z-none{display:none}.PointMap:hover .hover{height:auto;opacity:1;overflow:visible;width:200px}@-webkit-keyframes scaleAnima{0%{-webkit-transform:scale(0);transform:scale(0)}to{-webkit-transform:scale(1);transform:scale(1)}}@keyframes scaleAnima{0%{-webkit-transform:scale(0);transform:scale(0)}to{-webkit-transform:scale(1);transform:scale(1)}}
2
+ .mapboxgl-control-container{display:none}
package/es/index.js ADDED
@@ -0,0 +1,24 @@
1
+ import t from"mapbox-gl";function e(t){if(!t)throw new Error("obj is required");var e;if(t.length?e=t:t.coordinates?e=t.coordinates:t.geometry&&t.geometry.coordinates&&(e=t.geometry.coordinates),e)return n(e),e;throw new Error("No valid coordinates")}function n(t){if(t.length>1&&"number"==typeof t[0]&&"number"==typeof t[1])return!0;if(Array.isArray(t[0])&&t[0].length)return n(t[0]);throw new Error("coordinates must only contain numbers")}var r=function(t){if(!t)throw new Error("obj is required");var n=e(t);if(n.length>1&&"number"==typeof n[0]&&"number"==typeof n[1])return n;throw new Error("Coordinate is not a valid Point")};var i={miles:3960,nauticalmiles:3441.145,degrees:57.2957795,radians:1,inches:250905600,yards:6969600,meters:6373e3,metres:6373e3,centimeters:6373e5,centimetres:6373e5,kilometers:6373,kilometres:6373,feet:20908792.65};function o(t,e){if(null==t)throw new Error("radians is required");var n=i[e||"kilometers"];if(!n)throw new Error("units is invalid");return t*n}var s=r,a=o;function l(t,e,n){if(null!==t){var r,i,o,s,a,u,h,c,p,f,y=0,g=0,d=t.type,m="FeatureCollection"===d,x="Feature"===d,v=m?t.features.length:1;for(r=0;r<v;r++)for(h=(f=!!(p=m?t.features[r].geometry:x?t.geometry:t)&&"GeometryCollection"===p.type)?p.geometries.length:1,i=0;i<h;i++){var b=0;if(null!==(u=f?p.geometries[i]:p)){c=u.coordinates;var w=u.type;switch(y=!n||"Polygon"!==w&&"MultiPolygon"!==w?0:1,w){case null:break;case"Point":e(c,g,r,b),g++,b++;break;case"LineString":case"MultiPoint":for(o=0;o<c.length;o++)e(c[o],g,r,b),g++,"MultiPoint"===w&&b++;"LineString"===w&&b++;break;case"Polygon":case"MultiLineString":for(o=0;o<c.length;o++){for(s=0;s<c[o].length-y;s++)e(c[o][s],g,r,b),g++;"MultiLineString"===w&&b++}"Polygon"===w&&b++;break;case"MultiPolygon":for(o=0;o<c.length;o++){for(s=0;s<c[o].length;s++)for(a=0;a<c[o][s].length-y;a++)e(c[o][s][a],g,r,b),g++;b++}break;case"GeometryCollection":for(o=0;o<u.geometries.length;o++)l(u.geometries[o],e,n);break;default:throw new Error("Unknown Geometry Type")}}}}}function u(t,e,n,r){var i=n;return l(t,(function(t,r,o,s){i=0===r&&void 0===n?t:e(i,t,r,o,s)}),r),i}function h(t,e){var n;switch(t.type){case"FeatureCollection":for(n=0;n<t.features.length;n++)e(t.features[n].properties,n);break;case"Feature":e(t.properties,0)}}function c(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var n=0;n<t.features.length;n++)e(t.features[n],n)}function p(t,e){var n,r,i,o,s,a,l,u,h=0,c="FeatureCollection"===t.type,p="Feature"===t.type,f=c?t.features.length:1;for(n=0;n<f;n++){for(a=c?t.features[n].geometry:p?t.geometry:t,u=c?t.features[n].properties:p?t.properties:{},s=(l=!!a&&"GeometryCollection"===a.type)?a.geometries.length:1,i=0;i<s;i++)if(null!==(o=l?a.geometries[i]:a))switch(o.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":e(o,h,u);break;case"GeometryCollection":for(r=0;r<o.geometries.length;r++)e(o.geometries[r],h,u);break;default:throw new Error("Unknown Geometry Type")}else e(null,h,u);h++}}function f(t,e){p(t,(function(t,n,r){var i,o=null===t?null:t.type;switch(o){case null:case"Point":case"LineString":case"Polygon":return void e(g(t,r),n,0)}switch(o){case"MultiPoint":i="Point";break;case"MultiLineString":i="LineString";break;case"MultiPolygon":i="Polygon"}t.coordinates.forEach((function(t,o){e(g({type:i,coordinates:t},r),n,o)}))}))}function y(t,e){f(t,(function(t,n,r){var i=0;if(t.geometry){var o=t.geometry.type;"Point"!==o&&"MultiPoint"!==o&&u(t,(function(o,s){var a=d([o,s],t.properties);return e(a,n,r,i),i++,s}))}}))}function g(t,e){if(void 0===t)throw new Error("No geometry passed");return{type:"Feature",properties:e||{},geometry:t}}function d(t,e){if(!t)throw new Error("No coordinates passed");if(t.length<2)throw new Error("Coordinates must be an array of two or more positions");return{type:"Feature",properties:e||{},geometry:{type:"LineString",coordinates:t}}}function m(t,e){if(!t)throw new Error("geojson is required");var n=t.geometry?t.geometry.type:t.type;if(!n)throw new Error("invalid geojson");if("FeatureCollection"===n)throw new Error("FeatureCollection is not supported");if("GeometryCollection"===n)throw new Error("GeometryCollection is not supported");var r=t.geometry?t.geometry.coordinates:t.coordinates;if(!r)throw new Error("geojson must contain coordinates");switch(n){case"LineString":return void e(r,0,0);case"Polygon":case"MultiLineString":for(var i=0,o=0;o<r.length;o++)"MultiLineString"===n&&(i=o),e(r[o],o,i);return;case"MultiPolygon":for(var s=0;s<r.length;s++)for(var a=0;a<r[s].length;a++)e(r[s][a],a,s);return;default:throw new Error(n+" geometry not supported")}}var x=Object.freeze({__proto__:null,coordAll:function(t){var e=[];return l(t,(function(t){e.push(t)})),e},coordEach:l,coordReduce:u,feature:g,featureEach:c,featureReduce:function(t,e,n){var r=n;return c(t,(function(t,i){r=0===i&&void 0===n?t:e(r,t,i)})),r},flattenEach:f,flattenReduce:function(t,e,n){var r=n;return f(t,(function(t,i,o){r=0===i&&0===o&&void 0===n?t:e(r,t,i,o)})),r},geomEach:p,geomReduce:function(t,e,n){var r=n;return p(t,(function(t,i,o){r=0===i&&void 0===n?t:e(r,t,i,o)})),r},lineEach:m,lineReduce:function(t,e,n){var r=n;return m(t,(function(t,i,o){r=0===i&&void 0===n?t:e(r,t,i,o)})),r},lineString:d,propEach:h,propReduce:function(t,e,n){var r=n;return h(t,(function(t,i){r=0===i&&void 0===n?t:e(r,t,i)})),r},segmentEach:y,segmentReduce:function(t,e,n){var r=n,i=!1;return y(t,(function(t,o,s,a){r=!1===i&&void 0===n?t:e(r,t,o,s,a),i=!0})),r}}).segmentReduce,v=function(t,e){if(!t)throw new Error("geojson is required");return x(t,(function(t,n){var r=n.geometry.coordinates;return t+function(t,e,n){var r=Math.PI/180,i=s(t),o=s(e),l=r*(o[1]-i[1]),u=r*(o[0]-i[0]),h=r*i[1],c=r*o[1],p=Math.pow(Math.sin(l/2),2)+Math.pow(Math.sin(u/2),2)*Math.cos(h)*Math.cos(c);return a(2*Math.atan2(Math.sqrt(p),Math.sqrt(1-p)),n)}(r[0],r[1],e)}),0)},b=6371008.8,w={centimeters:637100880,centimetres:637100880,degrees:57.22891354143274,feet:20902260.511392,inches:39.37*b,kilometers:6371.0088,kilometres:6371.0088,meters:b,metres:b,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:b/1852,radians:1,yards:6967335.223679999};function E(t,e,n){void 0===n&&(n={});var r={type:"Feature"};return(0===n.id||n.id)&&(r.id=n.id),n.bbox&&(r.bbox=n.bbox),r.properties=e||{},r.geometry=t,r}function S(t,e,n){if(void 0===n&&(n={}),!t)throw new Error("coordinates is required");if(!Array.isArray(t))throw new Error("coordinates must be an Array");if(t.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!M(t[0])||!M(t[1]))throw new Error("coordinates must contain numbers");return E({type:"Point",coordinates:t},e,n)}function _(t){return 180*(t%(2*Math.PI))/Math.PI}function P(t){return t%360*Math.PI/180}function M(t){return!isNaN(t)&&null!==t&&!Array.isArray(t)}function k(t){if(!t)throw new Error("coord is required");if(!Array.isArray(t)){if("Feature"===t.type&&null!==t.geometry&&"Point"===t.geometry.type)return t.geometry.coordinates;if("Point"===t.type)return t.coordinates}if(Array.isArray(t)&&t.length>=2&&!Array.isArray(t[0])&&!Array.isArray(t[1]))return t;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function C(t){return"Feature"===t.type?t.geometry:t}function I(t,e,n){if(void 0===n&&(n={}),!0===n.final)return function(t,e){var n=I(e,t);return n=(n+180)%360}(t,e);var r=k(t),i=k(e),o=P(r[0]),s=P(i[0]),a=P(r[1]),l=P(i[1]),u=Math.sin(s-o)*Math.cos(l),h=Math.cos(a)*Math.sin(l)-Math.sin(a)*Math.cos(l)*Math.cos(s-o);return _(Math.atan2(u,h))}function R(t,e,n,r){void 0===r&&(r={});var i=k(t),o=P(i[0]),s=P(i[1]),a=P(n),l=function(t,e){void 0===e&&(e="kilometers");var n=w[e];if(!n)throw new Error(e+" units is invalid");return t/n}(e,r.units),u=Math.asin(Math.sin(s)*Math.cos(l)+Math.cos(s)*Math.sin(l)*Math.cos(a));return S([_(o+Math.atan2(Math.sin(a)*Math.sin(l)*Math.cos(s),Math.cos(l)-Math.sin(s)*Math.sin(u))),_(u)],r.properties)}function L(t,e,n){void 0===n&&(n={});var r=k(t),i=k(e),o=P(i[1]-r[1]),s=P(i[0]-r[0]),a=P(r[1]),l=P(i[1]),u=Math.pow(Math.sin(o/2),2)+Math.pow(Math.sin(s/2),2)*Math.cos(a)*Math.cos(l);return function(t,e){void 0===e&&(e="kilometers");var n=w[e];if(!n)throw new Error(e+" units is invalid");return t*n}(2*Math.atan2(Math.sqrt(u),Math.sqrt(1-u)),n.units)}function A(t){return A="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},A(t)}function T(t){return function(t){if(Array.isArray(t))return B(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return B(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return B(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function B(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var z,O,N=(z=function(t,e){t.exports=function(){
2
+ /**
3
+ * splaytree v3.1.2
4
+ * Fast Splay tree for Node and browser
5
+ *
6
+ * @author Alexander Milevski <info@w8r.name>
7
+ * @license MIT
8
+ * @preserve
9
+ */
10
+ /*! *****************************************************************************
11
+ Copyright (c) Microsoft Corporation. All rights reserved.
12
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
13
+ this file except in compliance with the License. You may obtain a copy of the
14
+ License at http://www.apache.org/licenses/LICENSE-2.0
15
+
16
+ THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17
+ KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
18
+ WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
19
+ MERCHANTABLITY OR NON-INFRINGEMENT.
20
+
21
+ See the Apache Version 2.0 License for specific language governing permissions
22
+ and limitations under the License.
23
+ ***************************************************************************** */
24
+ function t(t,e){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(t){return function(e){return l([t,e])}}function l(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}}var e=function(){function t(t,e){this.next=null,this.key=t,this.data=e,this.left=null,this.right=null}return t}();function n(t,e){return t>e?1:t<e?-1:0}function r(t,n,r){for(var i=new e(null,null),o=i,s=i;;){var a=r(t,n.key);if(a<0){if(null===n.left)break;if(r(t,n.left.key)<0){var l=n.left;if(n.left=l.right,l.right=n,null===(n=l).left)break}s.left=n,s=n,n=n.left}else{if(!(a>0))break;if(null===n.right)break;if(r(t,n.right.key)>0&&(l=n.right,n.right=l.left,l.left=n,null===(n=l).right))break;o.right=n,o=n,n=n.right}}return o.right=n.left,s.left=n.right,n.left=i.right,n.right=i.left,n}function i(t,n,i,o){var s=new e(t,n);if(null===i)return s.left=s.right=null,s;var a=o(t,(i=r(t,i,o)).key);return a<0?(s.left=i.left,s.right=i,i.left=null):a>=0&&(s.right=i.right,s.left=i,i.right=null),s}function o(t,e,n){var i=null,o=null;if(e){var s=n((e=r(t,e,n)).key,t);0===s?(i=e.left,o=e.right):s<0?(o=e.right,e.right=null,i=e):(i=e.left,e.left=null,o=e)}return{left:i,right:o}}function s(t,e,n){return null===e?t:(null===t||((e=r(t.key,e,n)).left=t),e)}function a(t,e,n,r,i){if(t){r(e+(n?"└── ":"├── ")+i(t)+"\n");var o=e+(n?" ":"│ ");t.left&&a(t.left,o,!1,r,i),t.right&&a(t.right,o,!0,r,i)}}var l=function(){function l(t){void 0===t&&(t=n),this._root=null,this._size=0,this._comparator=t}return l.prototype.insert=function(t,e){return this._size++,this._root=i(t,e,this._root,this._comparator)},l.prototype.add=function(t,n){var i=new e(t,n);null===this._root&&(i.left=i.right=null,this._size++,this._root=i);var o=this._comparator,s=r(t,this._root,o),a=o(t,s.key);return 0===a?this._root=s:(a<0?(i.left=s.left,i.right=s,s.left=null):a>0&&(i.right=s.right,i.left=s,s.right=null),this._size++,this._root=i),this._root},l.prototype.remove=function(t){this._root=this._remove(t,this._root,this._comparator)},l.prototype._remove=function(t,e,n){var i;return null===e?null:0===n(t,(e=r(t,e,n)).key)?(null===e.left?i=e.right:(i=r(t,e.left,n)).right=e.right,this._size--,i):e},l.prototype.pop=function(){var t=this._root;if(t){for(;t.left;)t=t.left;return this._root=r(t.key,this._root,this._comparator),this._root=this._remove(t.key,this._root,this._comparator),{key:t.key,data:t.data}}return null},l.prototype.findStatic=function(t){for(var e=this._root,n=this._comparator;e;){var r=n(t,e.key);if(0===r)return e;e=r<0?e.left:e.right}return null},l.prototype.find=function(t){return this._root&&(this._root=r(t,this._root,this._comparator),0!==this._comparator(t,this._root.key))?null:this._root},l.prototype.contains=function(t){for(var e=this._root,n=this._comparator;e;){var r=n(t,e.key);if(0===r)return!0;e=r<0?e.left:e.right}return!1},l.prototype.forEach=function(t,e){for(var n=this._root,r=[],i=!1;!i;)null!==n?(r.push(n),n=n.left):0!==r.length?(n=r.pop(),t.call(e,n),n=n.right):i=!0;return this},l.prototype.range=function(t,e,n,r){for(var i=[],o=this._comparator,s=this._root;0!==i.length||s;)if(s)i.push(s),s=s.left;else{if(o((s=i.pop()).key,e)>0)break;if(o(s.key,t)>=0&&n.call(r,s))return this;s=s.right}return this},l.prototype.keys=function(){var t=[];return this.forEach((function(e){var n=e.key;return t.push(n)})),t},l.prototype.values=function(){var t=[];return this.forEach((function(e){var n=e.data;return t.push(n)})),t},l.prototype.min=function(){return this._root?this.minNode(this._root).key:null},l.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},l.prototype.minNode=function(t){if(void 0===t&&(t=this._root),t)for(;t.left;)t=t.left;return t},l.prototype.maxNode=function(t){if(void 0===t&&(t=this._root),t)for(;t.right;)t=t.right;return t},l.prototype.at=function(t){for(var e=this._root,n=!1,r=0,i=[];!n;)if(e)i.push(e),e=e.left;else if(i.length>0){if(e=i.pop(),r===t)return e;r++,e=e.right}else n=!0;return null},l.prototype.next=function(t){var e=this._root,n=null;if(t.right){for(n=t.right;n.left;)n=n.left;return n}for(var r=this._comparator;e;){var i=r(t.key,e.key);if(0===i)break;i<0?(n=e,e=e.left):e=e.right}return n},l.prototype.prev=function(t){var e=this._root,n=null;if(null!==t.left){for(n=t.left;n.right;)n=n.right;return n}for(var r=this._comparator;e;){var i=r(t.key,e.key);if(0===i)break;i<0?e=e.left:(n=e,e=e.right)}return n},l.prototype.clear=function(){return this._root=null,this._size=0,this},l.prototype.toList=function(){return c(this._root)},l.prototype.load=function(t,e,n){void 0===e&&(e=[]),void 0===n&&(n=!1);var r=t.length,i=this._comparator;if(n&&y(t,e,0,r-1,i),null===this._root)this._root=u(t,e,0,r),this._size=r;else{var o=f(this.toList(),h(t,e),i);r=this._size+r,this._root=p({head:o},0,r)}return this},l.prototype.isEmpty=function(){return null===this._root},Object.defineProperty(l.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),l.prototype.toString=function(t){void 0===t&&(t=function(t){return String(t.key)});var e=[];return a(this._root,"",!0,(function(t){return e.push(t)}),t),e.join("")},l.prototype.update=function(t,e,n){var r=this._comparator,a=o(t,this._root,r),l=a.left,u=a.right;r(t,e)<0?u=i(e,n,u,r):l=i(e,n,l,r),this._root=s(l,u,r)},l.prototype.split=function(t){return o(t,this._root,this._comparator)},l.prototype[Symbol.iterator]=function(){var e,n,r;return t(this,(function(t){switch(t.label){case 0:e=this._root,n=[],r=!1,t.label=1;case 1:return r?[3,6]:null===e?[3,2]:(n.push(e),e=e.left,[3,5]);case 2:return 0===n.length?[3,4]:[4,e=n.pop()];case 3:return t.sent(),e=e.right,[3,5];case 4:r=!0,t.label=5;case 5:return[3,1];case 6:return[2]}}))},l}();function u(t,n,r,i){var o=i-r;if(o>0){var s=r+Math.floor(o/2),a=t[s],l=n[s],h=new e(a,l);return h.left=u(t,n,r,s),h.right=u(t,n,s+1,i),h}return null}function h(t,n){for(var r=new e(null,null),i=r,o=0;o<t.length;o++)i=i.next=new e(t[o],n[o]);return i.next=null,r.next}function c(t){for(var n=t,r=[],i=!1,o=new e(null,null),s=o;!i;)n?(r.push(n),n=n.left):r.length>0?n=(n=s=s.next=r.pop()).right:i=!0;return s.next=null,o.next}function p(t,e,n){var r=n-e;if(r>0){var i=e+Math.floor(r/2),o=p(t,e,i),s=t.head;return s.left=o,t.head=t.head.next,s.right=p(t,i+1,n),s}return null}function f(t,n,r){for(var i=new e(null,null),o=i,s=t,a=n;null!==s&&null!==a;)r(s.key,a.key)<0?(o.next=s,s=s.next):(o.next=a,a=a.next),o=o.next;return null!==s?o.next=s:null!==a&&(o.next=a),i.next}function y(t,e,n,r,i){if(!(n>=r)){for(var o=t[n+r>>1],s=n-1,a=r+1;;){do{s++}while(i(t[s],o)<0);do{a--}while(i(t[a],o)>0);if(s>=a)break;var l=t[s];t[s]=t[a],t[a]=l,l=e[s],e[s]=e[a],e[a]=l}y(t,e,n,a,i),y(t,e,a+1,r,i)}}const g=(t,e)=>t.ll.x<=e.x&&e.x<=t.ur.x&&t.ll.y<=e.y&&e.y<=t.ur.y,d=(t,e)=>{if(e.ur.x<t.ll.x||t.ur.x<e.ll.x||e.ur.y<t.ll.y||t.ur.y<e.ll.y)return null;const n=t.ll.x<e.ll.x?e.ll.x:t.ll.x,r=t.ur.x<e.ur.x?t.ur.x:e.ur.x;return{ll:{x:n,y:t.ll.y<e.ll.y?e.ll.y:t.ll.y},ur:{x:r,y:t.ur.y<e.ur.y?t.ur.y:e.ur.y}}};let m=Number.EPSILON;void 0===m&&(m=Math.pow(2,-52));const x=m*m,v=(t,e)=>{if(-m<t&&t<m&&-m<e&&e<m)return 0;const n=t-e;return n*n<x*t*e?0:t<e?-1:1};class b{constructor(){this.reset()}reset(){this.xRounder=new w,this.yRounder=new w}round(t,e){return{x:this.xRounder.round(t),y:this.yRounder.round(e)}}}class w{constructor(){this.tree=new l,this.round(0)}round(t){const e=this.tree.add(t),n=this.tree.prev(e);if(null!==n&&0===v(e.key,n.key))return this.tree.remove(t),n.key;const r=this.tree.next(e);return null!==r&&0===v(e.key,r.key)?(this.tree.remove(t),r.key):t}}const E=new b,S=11102230246251565e-32,_=134217729,P=(3+8*S)*S;function M(t,e,n,r,i){let o,s,a,l,u=e[0],h=r[0],c=0,p=0;h>u==h>-u?(o=u,u=e[++c]):(o=h,h=r[++p]);let f=0;if(c<t&&p<n)for(h>u==h>-u?(s=u+o,a=o-(s-u),u=e[++c]):(s=h+o,a=o-(s-h),h=r[++p]),o=s,0!==a&&(i[f++]=a);c<t&&p<n;)h>u==h>-u?(s=o+u,l=s-o,a=o-(s-l)+(u-l),u=e[++c]):(s=o+h,l=s-o,a=o-(s-l)+(h-l),h=r[++p]),o=s,0!==a&&(i[f++]=a);for(;c<t;)s=o+u,l=s-o,a=o-(s-l)+(u-l),u=e[++c],o=s,0!==a&&(i[f++]=a);for(;p<n;)s=o+h,l=s-o,a=o-(s-l)+(h-l),h=r[++p],o=s,0!==a&&(i[f++]=a);return 0===o&&0!==f||(i[f++]=o),f}function k(t,e){let n=e[0];for(let r=1;r<t;r++)n+=e[r];return n}function C(t){return new Float64Array(t)}const I=(3+16*S)*S,R=(2+12*S)*S,L=(9+64*S)*S*S,A=C(4),T=C(8),B=C(12),z=C(16),O=C(4);function N(t,e,n,r,i,o,s){let a,l,u,h,c,p,f,y,g,d,m,x,v,b,w,E,S,C;const I=t-i,N=n-i,F=e-o,j=r-o;b=I*j,p=_*I,f=p-(p-I),y=I-f,p=_*j,g=p-(p-j),d=j-g,w=y*d-(b-f*g-y*g-f*d),E=F*N,p=_*F,f=p-(p-F),y=F-f,p=_*N,g=p-(p-N),d=N-g,S=y*d-(E-f*g-y*g-f*d),m=w-S,c=w-m,A[0]=w-(m+c)+(c-S),x=b+m,c=x-b,v=b-(x-c)+(m-c),m=v-E,c=v-m,A[1]=v-(m+c)+(c-E),C=x+m,c=C-x,A[2]=x-(C-c)+(m-c),A[3]=C;let $=k(4,A),q=R*s;if($>=q||-$>=q)return $;if(c=t-I,a=t-(I+c)+(c-i),c=n-N,u=n-(N+c)+(c-i),c=e-F,l=e-(F+c)+(c-o),c=r-j,h=r-(j+c)+(c-o),0===a&&0===l&&0===u&&0===h)return $;if(q=L*s+P*Math.abs($),$+=I*h+j*a-(F*u+N*l),$>=q||-$>=q)return $;b=a*j,p=_*a,f=p-(p-a),y=a-f,p=_*j,g=p-(p-j),d=j-g,w=y*d-(b-f*g-y*g-f*d),E=l*N,p=_*l,f=p-(p-l),y=l-f,p=_*N,g=p-(p-N),d=N-g,S=y*d-(E-f*g-y*g-f*d),m=w-S,c=w-m,O[0]=w-(m+c)+(c-S),x=b+m,c=x-b,v=b-(x-c)+(m-c),m=v-E,c=v-m,O[1]=v-(m+c)+(c-E),C=x+m,c=C-x,O[2]=x-(C-c)+(m-c),O[3]=C;const G=M(4,A,4,O,T);b=I*h,p=_*I,f=p-(p-I),y=I-f,p=_*h,g=p-(p-h),d=h-g,w=y*d-(b-f*g-y*g-f*d),E=F*u,p=_*F,f=p-(p-F),y=F-f,p=_*u,g=p-(p-u),d=u-g,S=y*d-(E-f*g-y*g-f*d),m=w-S,c=w-m,O[0]=w-(m+c)+(c-S),x=b+m,c=x-b,v=b-(x-c)+(m-c),m=v-E,c=v-m,O[1]=v-(m+c)+(c-E),C=x+m,c=C-x,O[2]=x-(C-c)+(m-c),O[3]=C;const U=M(G,T,4,O,B);b=a*h,p=_*a,f=p-(p-a),y=a-f,p=_*h,g=p-(p-h),d=h-g,w=y*d-(b-f*g-y*g-f*d),E=l*u,p=_*l,f=p-(p-l),y=l-f,p=_*u,g=p-(p-u),d=u-g,S=y*d-(E-f*g-y*g-f*d),m=w-S,c=w-m,O[0]=w-(m+c)+(c-S),x=b+m,c=x-b,v=b-(x-c)+(m-c),m=v-E,c=v-m,O[1]=v-(m+c)+(c-E),C=x+m,c=C-x,O[2]=x-(C-c)+(m-c),O[3]=C;const J=M(U,B,4,O,z);return z[J-1]}function F(t,e,n,r,i,o){const s=(e-o)*(n-i),a=(t-i)*(r-o),l=s-a,u=Math.abs(s+a);return Math.abs(l)>=I*u?l:-N(t,e,n,r,i,o,u)}const j=(t,e)=>t.x*e.y-t.y*e.x,$=(t,e)=>t.x*e.x+t.y*e.y,q=(t,e,n)=>{const r=F(t.x,t.y,e.x,e.y,n.x,n.y);return r>0?-1:r<0?1:0},G=t=>Math.sqrt($(t,t)),U=(t,e,n)=>{const r={x:e.x-t.x,y:e.y-t.y},i={x:n.x-t.x,y:n.y-t.y};return j(i,r)/G(i)/G(r)},J=(t,e,n)=>{const r={x:e.x-t.x,y:e.y-t.y},i={x:n.x-t.x,y:n.y-t.y};return $(i,r)/G(i)/G(r)},Z=(t,e,n)=>0===e.y?null:{x:t.x+e.x/e.y*(n-t.y),y:n},D=(t,e,n)=>0===e.x?null:{x:n,y:t.y+e.y/e.x*(n-t.x)},H=(t,e,n,r)=>{if(0===e.x)return D(n,r,t.x);if(0===r.x)return D(t,e,n.x);if(0===e.y)return Z(n,r,t.y);if(0===r.y)return Z(t,e,n.y);const i=j(e,r);if(0==i)return null;const o={x:n.x-t.x,y:n.y-t.y},s=j(o,e)/i,a=j(o,r)/i;return{x:(t.x+a*e.x+(n.x+s*r.x))/2,y:(t.y+a*e.y+(n.y+s*r.y))/2}};class V{static compare(t,e){const n=V.comparePoints(t.point,e.point);return 0!==n?n:(t.point!==e.point&&t.link(e),t.isLeft!==e.isLeft?t.isLeft?1:-1:X.compare(t.segment,e.segment))}static comparePoints(t,e){return t.x<e.x?-1:t.x>e.x?1:t.y<e.y?-1:t.y>e.y?1:0}constructor(t,e){void 0===t.events?t.events=[this]:t.events.push(this),this.point=t,this.isLeft=e}link(t){if(t.point===this.point)throw new Error("Tried to link already linked events");const e=t.point.events;for(let t=0,n=e.length;t<n;t++){const n=e[t];this.point.events.push(n),n.point=this.point}this.checkForConsuming()}checkForConsuming(){const t=this.point.events.length;for(let e=0;e<t;e++){const n=this.point.events[e];if(void 0===n.segment.consumedBy)for(let r=e+1;r<t;r++){const t=this.point.events[r];void 0===t.consumedBy&&n.otherSE.point.events===t.otherSE.point.events&&n.segment.consume(t.segment)}}}getAvailableLinkedEvents(){const t=[];for(let e=0,n=this.point.events.length;e<n;e++){const n=this.point.events[e];n!==this&&!n.segment.ringOut&&n.segment.isInResult()&&t.push(n)}return t}getLeftmostComparator(t){const e=new Map,n=n=>{const r=n.otherSE;e.set(n,{sine:U(this.point,t.point,r.point),cosine:J(this.point,t.point,r.point)})};return(t,r)=>{e.has(t)||n(t),e.has(r)||n(r);const{sine:i,cosine:o}=e.get(t),{sine:s,cosine:a}=e.get(r);return i>=0&&s>=0?o<a?1:o>a?-1:0:i<0&&s<0?o<a?-1:o>a?1:0:s<i?-1:s>i?1:0}}}let Y=0;class X{static compare(t,e){const n=t.leftSE.point.x,r=e.leftSE.point.x,i=t.rightSE.point.x,o=e.rightSE.point.x;if(o<n)return 1;if(i<r)return-1;const s=t.leftSE.point.y,a=e.leftSE.point.y,l=t.rightSE.point.y,u=e.rightSE.point.y;if(n<r){if(a<s&&a<l)return 1;if(a>s&&a>l)return-1;const n=t.comparePoint(e.leftSE.point);if(n<0)return 1;if(n>0)return-1;const r=e.comparePoint(t.rightSE.point);return 0!==r?r:-1}if(n>r){if(s<a&&s<u)return-1;if(s>a&&s>u)return 1;const n=e.comparePoint(t.leftSE.point);if(0!==n)return n;const r=t.comparePoint(e.rightSE.point);return r<0?1:r>0?-1:1}if(s<a)return-1;if(s>a)return 1;if(i<o){const n=e.comparePoint(t.rightSE.point);if(0!==n)return n}if(i>o){const n=t.comparePoint(e.rightSE.point);if(n<0)return 1;if(n>0)return-1}if(i!==o){const t=l-s,e=i-n,h=u-a,c=o-r;if(t>e&&h<c)return 1;if(t<e&&h>c)return-1}return i>o?1:i<o||l<u?-1:l>u?1:t.id<e.id?-1:t.id>e.id?1:0}constructor(t,e,n,r){this.id=++Y,this.leftSE=t,t.segment=this,t.otherSE=e,this.rightSE=e,e.segment=this,e.otherSE=t,this.rings=n,this.windings=r}static fromRing(t,e,n){let r,i,o;const s=V.comparePoints(t,e);if(s<0)r=t,i=e,o=1;else{if(!(s>0))throw new Error(`Tried to create degenerate segment at [${t.x}, ${t.y}]`);r=e,i=t,o=-1}const a=new V(r,!0),l=new V(i,!1);return new X(a,l,[n],[o])}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,e=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:t<e?t:e},ur:{x:this.rightSE.point.x,y:t>e?t:e}}}vector(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}isAnEndpoint(t){return t.x===this.leftSE.point.x&&t.y===this.leftSE.point.y||t.x===this.rightSE.point.x&&t.y===this.rightSE.point.y}comparePoint(t){if(this.isAnEndpoint(t))return 0;const e=this.leftSE.point,n=this.rightSE.point,r=this.vector();if(e.x===n.x)return t.x===e.x?0:t.x<e.x?1:-1;const i=(t.y-e.y)/r.y,o=e.x+i*r.x;if(t.x===o)return 0;const s=(t.x-e.x)/r.x,a=e.y+s*r.y;return t.y===a?0:t.y<a?-1:1}getIntersection(t){const e=this.bbox(),n=t.bbox(),r=d(e,n);if(null===r)return null;const i=this.leftSE.point,o=this.rightSE.point,s=t.leftSE.point,a=t.rightSE.point,l=g(e,s)&&0===this.comparePoint(s),u=g(n,i)&&0===t.comparePoint(i),h=g(e,a)&&0===this.comparePoint(a),c=g(n,o)&&0===t.comparePoint(o);if(u&&l)return c&&!h?o:!c&&h?a:null;if(u)return h&&i.x===a.x&&i.y===a.y?null:i;if(l)return c&&o.x===s.x&&o.y===s.y?null:s;if(c&&h)return null;if(c)return o;if(h)return a;const p=H(i,this.vector(),s,t.vector());return null===p?null:g(r,p)?E.round(p.x,p.y):null}split(t){const e=[],n=void 0!==t.events,r=new V(t,!0),i=new V(t,!1),o=this.rightSE;this.replaceRightSE(i),e.push(i),e.push(r);const s=new X(r,o,this.rings.slice(),this.windings.slice());return V.comparePoints(s.leftSE.point,s.rightSE.point)>0&&s.swapEvents(),V.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),n&&(r.checkForConsuming(),i.checkForConsuming()),e}swapEvents(){const t=this.rightSE;this.rightSE=this.leftSE,this.leftSE=t,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(let t=0,e=this.windings.length;t<e;t++)this.windings[t]*=-1}consume(t){let e=this,n=t;for(;e.consumedBy;)e=e.consumedBy;for(;n.consumedBy;)n=n.consumedBy;const r=X.compare(e,n);if(0!==r){if(r>0){const t=e;e=n,n=t}if(e.prev===n){const t=e;e=n,n=t}for(let t=0,r=n.rings.length;t<r;t++){const r=n.rings[t],i=n.windings[t],o=e.rings.indexOf(r);-1===o?(e.rings.push(r),e.windings.push(i)):e.windings[o]+=i}n.rings=null,n.windings=null,n.consumedBy=e,n.leftSE.consumedBy=e.leftSE,n.rightSE.consumedBy=e.rightSE}}prevInResult(){return 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(void 0!==this._beforeState)return this._beforeState;if(this.prev){const t=this.prev.consumedBy||this.prev;this._beforeState=t.afterState()}else this._beforeState={rings:[],windings:[],multiPolys:[]};return this._beforeState}afterState(){if(void 0!==this._afterState)return this._afterState;const t=this.beforeState();this._afterState={rings:t.rings.slice(0),windings:t.windings.slice(0),multiPolys:[]};const e=this._afterState.rings,n=this._afterState.windings,r=this._afterState.multiPolys;for(let t=0,r=this.rings.length;t<r;t++){const r=this.rings[t],i=this.windings[t],o=e.indexOf(r);-1===o?(e.push(r),n.push(i)):n[o]+=i}const i=[],o=[];for(let t=0,r=e.length;t<r;t++){if(0===n[t])continue;const r=e[t],s=r.poly;if(-1===o.indexOf(s))if(r.isExterior)i.push(s);else{-1===o.indexOf(s)&&o.push(s);const t=i.indexOf(r.poly);-1!==t&&i.splice(t,1)}}for(let t=0,e=i.length;t<e;t++){const e=i[t].multiPoly;-1===r.indexOf(e)&&r.push(e)}return this._afterState}isInResult(){if(this.consumedBy)return!1;if(void 0!==this._isInResult)return this._isInResult;const t=this.beforeState().multiPolys,e=this.afterState().multiPolys;switch(at.type){case"union":{const n=0===t.length,r=0===e.length;this._isInResult=n!==r;break}case"intersection":{let n,r;t.length<e.length?(n=t.length,r=e.length):(n=e.length,r=t.length),this._isInResult=r===at.numMultiPolys&&n<r;break}case"xor":{const n=Math.abs(t.length-e.length);this._isInResult=n%2==1;break}case"difference":{const n=t=>1===t.length&&t[0].isSubject;this._isInResult=n(t)!==n(e);break}default:throw new Error(`Unrecognized operation type found ${at.type}`)}return this._isInResult}}class K{constructor(t,e,n){if(!Array.isArray(t)||0===t.length)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=e,this.isExterior=n,this.segments=[],"number"!=typeof t[0][0]||"number"!=typeof t[0][1])throw new Error("Input geometry is not a valid Polygon or MultiPolygon");const r=E.round(t[0][0],t[0][1]);this.bbox={ll:{x:r.x,y:r.y},ur:{x:r.x,y:r.y}};let i=r;for(let e=1,n=t.length;e<n;e++){if("number"!=typeof t[e][0]||"number"!=typeof t[e][1])throw new Error("Input geometry is not a valid Polygon or MultiPolygon");let n=E.round(t[e][0],t[e][1]);n.x===i.x&&n.y===i.y||(this.segments.push(X.fromRing(i,n,this)),n.x<this.bbox.ll.x&&(this.bbox.ll.x=n.x),n.y<this.bbox.ll.y&&(this.bbox.ll.y=n.y),n.x>this.bbox.ur.x&&(this.bbox.ur.x=n.x),n.y>this.bbox.ur.y&&(this.bbox.ur.y=n.y),i=n)}r.x===i.x&&r.y===i.y||this.segments.push(X.fromRing(i,r,this))}getSweepEvents(){const t=[];for(let e=0,n=this.segments.length;e<n;e++){const n=this.segments[e];t.push(n.leftSE),t.push(n.rightSE)}return t}}class W{constructor(t,e){if(!Array.isArray(t))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new K(t[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 e=1,n=t.length;e<n;e++){const n=new K(t[e],this,!1);n.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=n.bbox.ll.x),n.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=n.bbox.ll.y),n.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=n.bbox.ur.x),n.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=n.bbox.ur.y),this.interiorRings.push(n)}this.multiPoly=e}getSweepEvents(){const t=this.exteriorRing.getSweepEvents();for(let e=0,n=this.interiorRings.length;e<n;e++){const n=this.interiorRings[e].getSweepEvents();for(let e=0,r=n.length;e<r;e++)t.push(n[e])}return t}}class Q{constructor(t,e){if(!Array.isArray(t))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{"number"==typeof t[0][0][0]&&(t=[t])}catch(t){}this.polys=[],this.bbox={ll:{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY},ur:{x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY}};for(let e=0,n=t.length;e<n;e++){const n=new W(t[e],this);n.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=n.bbox.ll.x),n.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=n.bbox.ll.y),n.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=n.bbox.ur.x),n.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=n.bbox.ur.y),this.polys.push(n)}this.isSubject=e}getSweepEvents(){const t=[];for(let e=0,n=this.polys.length;e<n;e++){const n=this.polys[e].getSweepEvents();for(let e=0,r=n.length;e<r;e++)t.push(n[e])}return t}}class tt{static factory(t){const e=[];for(let n=0,r=t.length;n<r;n++){const r=t[n];if(!r.isInResult()||r.ringOut)continue;let i=null,o=r.leftSE,s=r.rightSE;const a=[o],l=o.point,u=[];for(;i=o,o=s,a.push(o),o.point!==l;)for(;;){const t=o.getAvailableLinkedEvents();if(0===t.length){const t=a[0].point,e=a[a.length-1].point;throw new Error(`Unable to complete output ring starting at [${t.x}, ${t.y}]. Last matching segment found ends at [${e.x}, ${e.y}].`)}if(1===t.length){s=t[0].otherSE;break}let n=null;for(let t=0,e=u.length;t<e;t++)if(u[t].point===o.point){n=t;break}if(null!==n){const t=u.splice(n)[0],r=a.splice(t.index);r.unshift(r[0].otherSE),e.push(new tt(r.reverse()));continue}u.push({index:a.length,point:o.point});const r=o.getLeftmostComparator(i);s=t.sort(r)[0].otherSE;break}e.push(new tt(a))}return e}constructor(t){this.events=t;for(let e=0,n=t.length;e<n;e++)t[e].segment.ringOut=this;this.poly=null}getGeom(){let t=this.events[0].point;const e=[t];for(let n=1,r=this.events.length-1;n<r;n++){const r=this.events[n].point,i=this.events[n+1].point;0!==q(r,t,i)&&(e.push(r),t=r)}if(1===e.length)return null;const n=e[0],r=e[1];0===q(n,t,r)&&e.shift(),e.push(e[0]);const i=this.isExteriorRing()?1:-1,o=this.isExteriorRing()?0:e.length-1,s=this.isExteriorRing()?e.length:-1,a=[];for(let t=o;t!=s;t+=i)a.push([e[t].x,e[t].y]);return a}isExteriorRing(){if(void 0===this._isExteriorRing){const t=this.enclosingRing();this._isExteriorRing=!t||!t.isExteriorRing()}return this._isExteriorRing}enclosingRing(){return void 0===this._enclosingRing&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}_calcEnclosingRing(){let t=this.events[0];for(let e=1,n=this.events.length;e<n;e++){const n=this.events[e];V.compare(t,n)>0&&(t=n)}let e=t.segment.prevInResult(),n=e?e.prevInResult():null;for(;;){if(!e)return null;if(!n)return e.ringOut;if(n.ringOut!==e.ringOut)return n.ringOut.enclosingRing()!==e.ringOut?e.ringOut:e.ringOut.enclosingRing();e=n.prevInResult(),n=e?e.prevInResult():null}}}class et{constructor(t){this.exteriorRing=t,t.poly=this,this.interiorRings=[]}addInterior(t){this.interiorRings.push(t),t.poly=this}getGeom(){const t=[this.exteriorRing.getGeom()];if(null===t[0])return null;for(let e=0,n=this.interiorRings.length;e<n;e++){const n=this.interiorRings[e].getGeom();null!==n&&t.push(n)}return t}}class nt{constructor(t){this.rings=t,this.polys=this._composePolys(t)}getGeom(){const t=[];for(let e=0,n=this.polys.length;e<n;e++){const n=this.polys[e].getGeom();null!==n&&t.push(n)}return t}_composePolys(t){const e=[];for(let n=0,r=t.length;n<r;n++){const r=t[n];if(!r.poly)if(r.isExteriorRing())e.push(new et(r));else{const t=r.enclosingRing();t.poly||e.push(new et(t)),t.poly.addInterior(r)}}return e}}class rt{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:X.compare;this.queue=t,this.tree=new l(e),this.segments=[]}process(t){const e=t.segment,n=[];if(t.consumedBy)return t.isLeft?this.queue.remove(t.otherSE):this.tree.remove(e),n;const r=t.isLeft?this.tree.add(e):this.tree.find(e);if(!r)throw new Error(`Unable to find segment #${e.id} [${e.leftSE.point.x}, ${e.leftSE.point.y}] -> [${e.rightSE.point.x}, ${e.rightSE.point.y}] in SweepLine tree.`);let i,o,s=r,a=r;for(;void 0===i;)s=this.tree.prev(s),null===s?i=null:void 0===s.key.consumedBy&&(i=s.key);for(;void 0===o;)a=this.tree.next(a),null===a?o=null:void 0===a.key.consumedBy&&(o=a.key);if(t.isLeft){let r=null;if(i){const t=i.getIntersection(e);if(null!==t&&(e.isAnEndpoint(t)||(r=t),!i.isAnEndpoint(t))){const e=this._splitSafely(i,t);for(let t=0,r=e.length;t<r;t++)n.push(e[t])}}let s=null;if(o){const t=o.getIntersection(e);if(null!==t&&(e.isAnEndpoint(t)||(s=t),!o.isAnEndpoint(t))){const e=this._splitSafely(o,t);for(let t=0,r=e.length;t<r;t++)n.push(e[t])}}if(null!==r||null!==s){let t=null;t=null===r?s:null===s||V.comparePoints(r,s)<=0?r:s,this.queue.remove(e.rightSE),n.push(e.rightSE);const i=e.split(t);for(let t=0,e=i.length;t<e;t++)n.push(i[t])}n.length>0?(this.tree.remove(e),n.push(t)):(this.segments.push(e),e.prev=i)}else{if(i&&o){const t=i.getIntersection(o);if(null!==t){if(!i.isAnEndpoint(t)){const e=this._splitSafely(i,t);for(let t=0,r=e.length;t<r;t++)n.push(e[t])}if(!o.isAnEndpoint(t)){const e=this._splitSafely(o,t);for(let t=0,r=e.length;t<r;t++)n.push(e[t])}}}this.tree.remove(e)}return n}_splitSafely(t,e){this.tree.remove(t);const n=t.rightSE;this.queue.remove(n);const r=t.split(e);return r.push(n),void 0===t.consumedBy&&this.tree.add(t),r}}const it="undefined"!=typeof process&&process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,ot="undefined"!=typeof process&&process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6;class st{run(t,e,n){at.type=t,E.reset();const r=[new Q(e,!0)];for(let t=0,e=n.length;t<e;t++)r.push(new Q(n[t],!1));if(at.numMultiPolys=r.length,"difference"===at.type){const t=r[0];let e=1;for(;e<r.length;)null!==d(r[e].bbox,t.bbox)?e++:r.splice(e,1)}if("intersection"===at.type)for(let t=0,e=r.length;t<e;t++){const e=r[t];for(let n=t+1,i=r.length;n<i;n++)if(null===d(e.bbox,r[n].bbox))return[]}const i=new l(V.compare);for(let t=0,e=r.length;t<e;t++){const e=r[t].getSweepEvents();for(let t=0,n=e.length;t<n;t++)if(i.insert(e[t]),i.size>it)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big).")}const o=new rt(i);let s=i.size,a=i.pop();for(;a;){const t=a.key;if(i.size===s){const e=t.segment;throw new Error(`Unable to pop() ${t.isLeft?"left":"right"} SweepEvent [${t.point.x}, ${t.point.y}] from segment #${e.id} [${e.leftSE.point.x}, ${e.leftSE.point.y}] -> [${e.rightSE.point.x}, ${e.rightSE.point.y}] from queue.`)}if(i.size>it)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big).");if(o.segments.length>ot)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments).");const e=o.process(t);for(let t=0,n=e.length;t<n;t++){const n=e[t];void 0===n.consumedBy&&i.insert(n)}s=i.size,a=i.pop()}E.reset();const u=tt.factory(o.segments);return new nt(u).getGeom()}}const at=new st,lt=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return at.run("union",t,n)},ut=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return at.run("intersection",t,n)},ht=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return at.run("xor",t,n)},ct=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return at.run("difference",t,n)};var pt={union:lt,intersection:ut,xor:ht,difference:ct};return pt}()},z(O={exports:{}},O.exports),O.exports);function F(t,e,n){void 0===n&&(n={});var r=C(t),i=C(e),o=N.union(r.coordinates,i.coordinates);return 0===o.length?null:1===o.length?function(t,e,n){void 0===n&&(n={});for(var r=0,i=t;r<i.length;r++){var o=i[r];if(o.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var s=0;s<o[o.length-1].length;s++)if(o[o.length-1][s]!==o[0][s])throw new Error("First and last Position are not equivalent.")}return E({type:"Polygon",coordinates:t},e,n)}(o[0],n.properties):function(t,e,n){return void 0===n&&(n={}),E({type:"MultiPolygon",coordinates:t},e,n)}(o,n.properties)}function j(t){var e=null;if("svg"===t.tag)return e=$(t);if(e=document.createElement(t.tag),"object"===A(t.props)&&null!==t.props){var n=function(){var n=t.props[r];if("on"===r){n=t.props[r];var i=function(t){e.addEventListener(t,(function(e){return n[t](e)}))};for(var o in n)i(o)}else if("dataset"===r)Object.keys(n).forEach((function(t){e.dataset[t]=n[t]}));else if("style"===r)if("string"==typeof n)e.setAttribute(r,n);else{var s=[];Object.keys(n).forEach((function(t){s.push("".concat(t,":").concat(n[t]))})),e.setAttribute(r,s.join(";"))}else"cssText"===r?e.style.cssText=n:e.setAttribute(r,n)};for(var r in t.props)n()}return t.children instanceof Array?t.children.forEach((function(t){e.appendChild(j(t))})):e.textContent=t.children,e}function $(t){var e="http://www.w3.org/1999/xlink",n=document.createElementNS("http://www.w3.org/2000/svg",t.tag);if("svg"===t.tag&&n.setAttribute("xmlns:xlink",e),"object"===A(t.props)&&null!==t.props)for(var r in t.props){var i=t.props[r];"xlink:href"===r?n.setAttributeNS(e,r,i):n.setAttribute(r,i)}return t.children instanceof Array?t.children.forEach((function(t){n.appendChild($(t))})):n.textContent=t.children,n}function q(t,e){var n=JSON.parse(JSON.stringify(e));for(var r in n)t[r]&&("center"==r?(n.center.wgs84=t.center,t.zoom&&(n.center.zoom=t.zoom)):n[r]=t[r]);return n}function G(t){var e=[];return t.info&&t.info.show&&(e.push({tag:"div",props:{class:"PointInfo ".concat(t.info.type)},children:[]}),t.titles&&t.titles.show&&e[0].children.push({tag:"div",props:{class:"PointTitle"},children:t.titles.value}),t.contents&&t.contents.show&&e[0].children.push({tag:"div",props:{class:"PointContent"},children:t.contents.value})),e}function U(t,e){!e||"string"!=typeof e&&"number"!=typeof e||(e=[e]);for(var n=document.querySelectorAll(".PointMap"),r=function(r){e?e.forEach((function(e,i){var o,s="PointMap_"+e;(null===(o=n[r])||void 0===o?void 0:o.className.indexOf(s))>-1&&("visible"==t?n[r].classList.remove("z-none"):n[r].classList.add("z-none"))})):"visible"==t?n[r].classList.remove("z-none"):n[r].classList.add("z-none")},i=0;i<n.length;i++)r(i)}function J(t){if(!t)return console.log("请传入标点的id!!!"),!1;!t||"string"!=typeof t&&"number"!=typeof t||(t=[t]);for(var e=document.querySelectorAll(".PointMap"),n=function(n){t.forEach((function(t,r){var i,o="PointMap_"+t;(null===(i=e[n])||void 0===i?void 0:i.className.indexOf(o))>-1&&e[n].remove()}))},r=0;r<e.length;r++)n(r)}function Z(t,e,n){var r={"line-color":n["line-color"],"line-width":n["line-width"],"line-opacity":n["line-opacity"]};return n["line-blur"]&&(r["line-blur"]=n["line-blur"]),n["line-offset"]&&(r["line-offset"]=n["line-offset"]),{id:t,type:"line",source:e,layout:{"line-cap":"round","line-join":"round"},paint:r,metadata:{zIndex:n.zIndex}}}function D(t,e,n,r){return{id:t,type:"symbol",source:e,layout:{"text-field":n,"text-size":r["text-size"],"text-allow-overlap":!0,"text-justify":r["text-justify"],"text-offset":r["text-offset"],"text-anchor":"bottom","icon-image":"","text-font":["Alibaba-PuHuiTi Regular"]},paint:{"text-color":r["text-color"],"text-halo-color":r["text-halo-color"],"text-halo-width":r["text-halo-width"]},metadata:{zIndex:4}}}function H(t,e,n,r,i,o,s,a){var l,u="function"==typeof t?t.options:t;if(e&&(u.render=e,u.staticRenderFns=n,u._compiled=!0),r&&(u.functional=!0),o&&(u._scopeId="data-v-"+o),s?(l=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),i&&i.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(s)},u._ssrRegister=l):i&&(l=a?function(){i.call(this,(u.functional?this.parent:this).$root.$options.shadowRoot)}:i),l)if(u.functional){u._injectStyles=l;var h=u.render;u.render=function(t,e){return l.call(e),h(t,e)}}else{var c=u.beforeCreate;u.beforeCreate=c?[].concat(c,l):[l]}return{exports:t,options:u}}const V={name:"ZMap",props:{id:{type:String,default:"mapContainer"},mapStyle:{type:Object,default:()=>({})},mapKey:{type:String,default:""},cityMap:{type:[Object,String],default:()=>({})},baseMap:{type:Array,default:()=>[]},farmMap:{type:Array,default:()=>[]},lineMap:{type:Array,default:()=>[]},pointMap:{type:Array,default:()=>[]},heatMap:{type:[Object,String],default:()=>({})},routeMap:{type:[Object,String],default:()=>({})},params:{type:Object,default:()=>({})},isDrilling:{type:Boolean,default:!1}},data:()=>({title:"gis地图可视化",mapBox:null,cityContainer:new Map,baseContainer:new Map,farmContainer:new Map,lineContainer:new Map,dotContainer:new Map,routeContainer:new Map,layerTypes:{source:"_s",fill:"_f",line:"_l",text:"_t",prominent:"_p",shadow:"_sh"},parameter:{shadow:!1,scale:!1,zoom:6,minZoom:3,maxZoom:20,center:[106.64070540957499,29.542372847334505],isProminent:"city",prominentType:"geojson",prominentUrl:"",prominentHeight:1,prominentFillColor:"rgba(0, 0, 0, 0.5)",pitch:0,zIndex:0},properties:{center:{wgs84:[106.64314362686562,29.54485285119372],zoom:14.978617404032729},"fill-color":"#016b67","fill-opacity":.5,"fill-outline-color":"#38d9a9","line-color":"rgba(255, 50, 10, 1)","line-opacity":1,"line-width":1,"text-size":14,"text-offset":[0,1.8],"text-justify":"center","text-color":"rgb(159, 96, 55)","text-halo-color":"#fff","text-halo-width":1.8,shadow:{"line-color":"#38d9a9","line-opacity":1,"line-width":25,"line-blur":40,"line-offset":-5}},onClickType:""}),computed:{},mounted(){this.getUsagePermissions()},watch:{cityMap:{handler(t){t&&this.mapBox&&setTimeout((()=>{this.addCityMaps(t)}),400)},deep:!0,immediate:!0},heatMap:{handler(t){t&&this.mapBox&&this.mapBox.on("load",(()=>{this.addHeatMaps(t)}))},deep:!0,immediate:!0},baseMap:{handler(t){t&&(null==t?void 0:t.length)>0&&this.mapBox&&setTimeout((()=>{this.addBaseMaps(t)}),400)},deep:!0,immediate:!0},farmMap:{handler(t){t&&(null==t?void 0:t.length)>0&&this.mapBox&&setTimeout((()=>{this.addFarmMaps(t)}),400)},deep:!0,immediate:!0},lineMap:{handler(t){t&&(null==t?void 0:t.length)>0&&this.mapBox&&setTimeout((()=>{this.addLineMaps(t)}),400)},deep:!0,immediate:!0},pointMap:{handler(t){t&&(null==t?void 0:t.length)>0&&this.mapBox&&setTimeout((()=>{this.addPointMaps(t)}),400)},deep:!0,immediate:!0}},methods:{setCache(t,e){localStorage.setItem(t,JSON.stringify(e))},getCache(t){const e=localStorage.getItem(t);return e?JSON.parse(e):null},getUsagePermissions(){let t="pro__MAP_VIEWS",e=this.getCache(t),n=(new Date).getTime();if(e&&e.value&&n<e.expire)return this.initMap(),!0;return fetch("https://map.zhuyukeji.com/Tool.Map",{method:"GET"}).then((e=>{if(e.ok){this.initMap();let e=n+6048e5;return this.setCache(t,{value:!0,expire:e}),!0}return console.groupCollapsed("%cz-map-views","color:#009a61;font-size:24px;font-weight:800;"),console.log("%c"+window.location.hostname+"\n-------------\n您当前域名没有购买地图服务,或者服务到期!!\n请登录https://map.zhuyukeji.com/Tool.map\n购买!!","color:#009a61"),console.groupEnd(),this.initMap(),!1})).then((t=>{})).catch((t=>(console.error("请求出错:",t),!1)))},initMap(){this.parameter=function(t,e){var n=JSON.parse(JSON.stringify(e));for(var r in n)t[r]&&(n[r]=t[r]);return n}(this.params,this.parameter),this.mapStyle.version&&(this.mapBox=new t.Map({container:this.id,center:this.parameter.center,minZoom:this.parameter.minZoom,maxZoom:this.parameter.maxZoom,zoom:this.parameter.zoom,style:this.mapStyle,pitch:this.parameter.pitch,bearing:0,antialias:!1,accessToken:this.mapKey}),this.parameter.scale&&this.mapBox.addControl(new t.ScaleControl,"bottom-right"))},addCityMaps(t){if(t){if("string"==typeof t&&(t=JSON.parse(t)),!t.properties.id)return console.log("请在properties中传入id"),!1;this.addAreaMap(t.properties,"city",t)}},addHeatMaps(t){const e="source_heat",n="layer_heat";"string"==typeof t&&(t=JSON.parse(t)),this.mapBox.addSource(e,{type:"geojson",data:t}),this.mapBox.addLayer({id:n,type:"heatmap",source:e,minZoom:3,paint:{"heatmap-weight":["interpolate",["linear"],["get","mag"],0,0,6,1],"heatmap-intensity":["interpolate",["linear"],["zoom"],0,1,9,3],"heatmap-color":["interpolate",["linear"],["heatmap-density"],0,"rgba(0,0,0,0)",.2,"#67a9cf",.4,"#d1e5f0",.6,"#fddbc7",.8,"#ef8a62",1,"#b2182b"],"heatmap-radius":["interpolate",["linear"],["zoom"],0,2,9,20],"heatmap-opacity":["interpolate",["linear"],["zoom"],7,1,9,0]}}),this.mapBox.on("click",n,(t=>{if(t.defaultPrevented)return;let e=this.mapBox.queryRenderedFeatures(t.point).filter((t=>t.layer.id==n))[0];this.$emit("heat-click",e.properties),t.preventDefault()}))},addAreaMap(e,n,r){const i=e.id,o=n+this.layerTypes.source+i,s=n+this.layerTypes.line+i,a=n+this.layerTypes.fill+i,l=n+this.layerTypes.text+i,u=n+this.layerTypes.prominent+i,h=n+this.layerTypes.shadow+i;let c=this,p={},f=[],y=!1;switch(r.type){case"Feature":p=q(r.properties,this.properties);break;case"FeatureCollection":p=q(r.features[0].properties,this.properties)}let g={base:{container:this.baseContainer,name:"baseContainer"},farm:{container:this.farmContainer,name:"farmContainer"},city:{container:this.cityContainer,name:"cityContainer"},line:{container:this.lineContainer,name:"lineContainer"},route:{container:this.routeContainer,name:"routeContainer"}};this.mapBox.getSource(o)||this.mapBox.addSource(o,function(t){return{type:"geojson",data:t}}(r)),"city"==n&&this.setLayout([...g[n].container.values()],"visibility","none");["base","farm","city"].indexOf(n)>-1&&(g[n].container.has(a)?this.setLayout([g[n].container.get(a)],"visibility","visible"):(this.mapBox.addLayer(function(t,e,n){return{id:t,type:"fill",source:e,layout:{},paint:{"fill-color":n["fill-color"],"fill-opacity":n["fill-opacity"]},metadata:{zIndex:n.zIndex}}}(a,o,p)),c[g[n].name].set(a,a)));["line","base","farm","city"].indexOf(n)>-1&&(g[n].container.has(s)?this.setLayout([g[n].container.get(s)],"visibility","visible"):(this.mapBox.addLayer(Z(s,o,p)),c[g[n].name].set(s,s)));["farm","city"].indexOf(n)>-1&&(g[n].container.has(l)?this.setLayout([g[n].container.get(l)],"visibility","visible"):(e.showText&&e.text&&"farm"==n&&this.mapBox.addLayer(D(l,o,e.text,p)),"city"==n&&this.mapBox.addLayer(D(l,o,"{name}",p)),c[g[n].name].set(l,l)));["base","city"].indexOf(n)>-1&&"extrusion"==this.parameter.prominentType&&this.addExtrusionImage(o,u);if(["base","city"].indexOf(n)>-1){if("base"==this.parameter.isProminent)switch(r.type){case"Feature":f=r.geometry.coordinates;break;case"FeatureCollection":f=r.features[0].geometry.coordinates}else"city"==this.parameter.isProminent&&("FeatureCollection"==r.type?r.features&&r.features.length>1?(f=function(t,e){if("push"==e){var n=[];return t.features.forEach((function(t,e){t.geometry.coordinates[0]&&t.geometry.coordinates[0].length>0&&(n=[].concat(T(t.geometry.coordinates[0]),T(n)))})),n}var r=t.features[0];return t.features.forEach((function(t,e){t.geometry.coordinates[0]&&t.geometry.coordinates[0].length>0&&(r=F(r,t))})),r.geometry.coordinates}(r,"union"),y=!0):f=r.features[0].geometry.coordinates&&1==r.features[0].geometry.coordinates.length?r.features[0].geometry.coordinates[0]:r.features[0].geometry.coordinates:f=r.geometry.coordinates&&1==r.geometry.coordinates.length?r.geometry.coordinates[0]:r.geometry.coordinates);if(g[n].container.has(u))this.setLayout([g[n].container.get(u)],"visibility","visible");else if(this.parameter.isProminent==n&&f.length>0){let t=y&&f[0][0]&&f[0][0][0]&&f[0][0][0][0]?f[0]:f;if("extrusionBg"==this.parameter.prominentType){let e=function(t){return{type:"geojson",data:{type:"Feature",geometry:{type:"Polygon",coordinates:[[[-180,90],[180,90],[180,-90],[-180,-90]]].concat(T(t))}}}}(t);this.addExtrusionImage(e,u)}else this.mapBox.addLayer(function(t,e,n,r){return{id:t,type:"fill",source:{type:"geojson",data:{type:"Feature",geometry:{type:"Polygon",coordinates:[[[-180,90],[180,90],[180,-90],[-180,-90]]].concat(T(e))}}},paint:{"fill-color":n},layout:{visibility:"visible"},metadata:{zIndex:r.zIndex}}}(u,t,this.parameter.prominentFillColor,p));c[g[n].name].set(u,u)}}switch(n){case"base":this.mapBox.on("click",a,(t=>{"point"===this.onClickType?(t.preventDefault(),this.onClickType=""):this.onClickType=a,t.defaultPrevented||setTimeout((()=>{this.onClickType===a&&this.$emit("base-click",i,e)}),200)}));break;case"farm":this.mapBox.on("click",a,(t=>{"point"===this.onClickType?(t.preventDefault(),this.onClickType=""):this.onClickType=a,t.defaultPrevented||setTimeout((()=>{this.onClickType===a&&this.$emit("farm-click",i,e)}),200)}),!0);break;case"route":let n=function(t){d||(d=t);const e=(t-d)/f;if(e>1)return;const r=function(t,e,n){void 0===n&&(n={});for(var r=C(t).coordinates,i=0,o=0;o<r.length&&!(e>=i&&o===r.length-1);o++){if(i>=e){var s=e-i;if(s){var a=I(r[o],r[o-1])-180;return R(r[o],s,a,n)}return S(r[o])}i+=L(r[o],r[o+1],n)}return S(r[r.length-1])}(y,g*e).geometry.coordinates,i={lng:r[0],lat:r[1]};let o="<p><span>纬度:</span>"+i.lng.toFixed(5)+"</p>";o+="<p><span>经度:</span>"+i.lat.toFixed(5)+"</p>",l.setHTML(o),u.setLngLat(i),c.mapBox.setPaintProperty(s,"line-gradient",["step",["line-progress"],"red",e,"rgba(255, 0, 0, 1)"]),c.mapBox.flyTo({center:i}),window.requestAnimationFrame(n)},r=[];"FeatureCollection"==data.type?r="LineString"==data.features[0].geometry.type?data.features[0].geometry.coordinates:data.features[0].geometry.coordinates[0]:"Feature"==data.type&&(r="LineString"==data.geometry.type?data.geometry.coordinates:data.geometry.coordinates[0]);const l=new t.Popup({closeButton:!1,closeOnClick:!1}),u=new t.Marker({color:"red",scale:.8,draggable:!1,pitchAlignment:"auto",rotationAlignment:"auto"}).setLngLat(r[0]).setPopup(l).addTo(this.mapBox).togglePopup();let h={"line-color":"rgba(255, 50, 10, 1)","line-opacity":1,"line-width":1};this.mapBox.addLayer(Z(s,o,h)),this.routeContainer.set(s,s);const f=time*1e3,y=function(t,e,n){if(void 0===n&&(n={}),t.length<2)throw new Error("coordinates must be an array of two or more positions");return E({type:"LineString",coordinates:t},e,n)}(r),g=v(y);let d;window.requestAnimationFrame(n);break;case"city":this.flyToMap(p),this.mapBox.on("click",a,(t=>{if("point"===this.onClickType&&(t.preventDefault(),this.onClickType=""),t.defaultPrevented)return;this.isDrilling&&this.setLayout([...this.cityContainer.values()],"visibility","none");let e=this.mapBox.queryRenderedFeatures(t.point).filter((t=>t.layer.id==a))[0],n=e.properties&&e.properties.adcode?e.properties.adcode:i;this.$emit("city-click",n,e.properties)}))}this.parameter.shadow&&f.length>0&&"farm"!=n&&this.addShadow(f,h,p)},addShadow(t,e,n){this.baseContainer.has(e)?this.setLayout([this.baseContainer.get(e)],"visibility","visible"):(this.mapBox.addLayer(function(t,e,n){return{id:t,type:"line",source:{type:"geojson",data:{type:"FeatureCollection",features:[{type:"Feature",properties:{adcode:t,name:"阴影"},geometry:{type:"Polygon",coordinates:[e]}}]}},paint:n.shadow,metadata:{zIndex:n.zIndex}}}(e,t,n)),this.baseContainer.set(e,e))},addExtrusionImage(t,e){if(this.parameter.prominentUrl){let n=this;this.mapBox.loadImage(this.parameter.prominentUrl,(function(r,i){if(r)throw r;n.mapBox.hasImage("ground")?(n.mapBox.updateImage("ground",i),n.mapBox.removeLayer("img_"+e),n.mapBox.addLayer({id:"img_"+e,source:t,type:"fill-extrusion",paint:{"fill-extrusion-height":n.parameter.prominentHeight,"fill-extrusion-base":0,"fill-extrusion-opacity":1,"fill-extrusion-pattern":"ground"}})):(n.mapBox.addImage("ground",i),n.mapBox.addLayer({id:"img_"+e,source:t,type:"fill-extrusion",paint:{"fill-extrusion-height":n.parameter.prominentHeight,"fill-extrusion-base":0,"fill-extrusion-opacity":1,"fill-extrusion-pattern":"ground"}}))}))}},addBaseMaps(t){if(!t||(null==t?void 0:t.length)<1)return!1;t.forEach(((t,e)=>{if(t.mapPosition){let n=JSON.parse(t.mapPosition);if(this.addAreaMap(t,"base",n),0==e){let t={};switch(n.type){case"Feature":t=n.properties;break;case"FeatureCollection":t=n.features[0].properties}"base"==this.parameter.isProminent&&this.flyToMap(t)}}}))},addFarmMaps(t){if(!t||(null==t?void 0:t.length)<1)return!1;t.forEach(((t,e)=>{if(t.mapPosition){let e=JSON.parse(t.mapPosition);this.addAreaMap(t,"farm",e)}}))},addLineMaps(t){if(!t||(null==t?void 0:t.length)<1)return!1;t.forEach(((t,e)=>{if(t.geoJson){let e=JSON.parse(t.geoJson);this.addAreaMap(t,"line",e)}}))},addPointMaps(t){t.forEach(((t,e)=>{let n="PointMap_"+t.id;this.dotContainer.get(n)?U("visible",t.id):t.center&&(this.switchAddPoint(t),this.dotContainer.set(n,n))}))},switchAddPoint(e){let n="";switch(e.type){case"signage":n=function(t,e){var n=e.className?e.className:"aaaaaaaaaaaaa";return j({tag:"div",props:{class:"PointSignages PointMap PointMap_"+e.id+" "+n,on:{click:function(n){n.stopPropagation(),t&&t(e.id)}}},children:[{tag:"div",props:{class:"PointMapBox"},children:[{tag:"div",props:{class:"PointSignage PointSignage_"+e.id},children:e.title},{tag:"div",props:{class:"PointLine"},children:[]},{tag:"div",props:{class:"footerCircle"},children:[]}]}]})}((t=>{this.pointClick(t)}),e);break;case"icon":n=function(t,e){var n=e.className?e.className:"",r=G(e);return j({tag:"div",props:{class:"PointIcons PointMap PointMap_"+e.id+" "+n,on:{click:function(n){n.stopPropagation(),t&&t(e.id)}}},children:[].concat(T(r),[{tag:"div",props:{class:"PointMapBox"},children:[{tag:"img",props:{class:"PointIcon PointIcon_"+e.id,src:e.icon,title:e.title}},{tag:"div",props:{class:"PointLine"},children:[]},{tag:"div",props:{class:"footerCircle"},children:[]}]}])})}((t=>{this.pointClick(t)}),e);break;case"point":n=function(t,e){var n=e.className?e.className:"",r=G(e);return j({tag:"div",props:{class:"PointImgs PointMap PointMap_"+e.id+" "+n,on:{click:function(n){n.stopPropagation(),t&&t(e.id)}}},children:[].concat(T(r),[{tag:"img",props:{class:"PointImg PointImg_"+e.id,src:e.icon,title:e.title}}])})}((t=>{this.pointClick(t)}),e);break;case"svgIcon":n=function(t,e){var n=e.className?e.className:"",r=G(e),i=[],o={};return e.icon&&i.push({tag:"img",props:{class:"PointImg PointImg_"+e.id,src:e.icon,title:e.title}}),e.svg&&(i.push(e.svg.data),e.svg.color&&(o.color=e.svg.color),e.svg.size&&(o["font-size"]=e.svg.size)),j({tag:"div",props:{class:"PointSvgIcons PointMap PointMap_"+e.id+" "+n,on:{click:function(n){n.stopPropagation(),t&&t(e.id)}},style:o},children:[].concat(T(r),i)})}((t=>{this.pointClick(t)}),e)}n&&new t.Marker({element:n}).setLngLat(e.center).addTo(this.mapBox)},pointClick(t){this.$emit("point-click",t),this.onClickType="point"},showMapBase(t,e,n){this.showMapArea(t,e,"base",n)},showMapFarm(t,e,n){this.showMapArea(t,e,"farm",n)},showMapArea(t,e,n,r){if(n||(n="farm"),e){"string"!=typeof e&&"number"!=typeof e||(e=[e]);let i=[];e.forEach(((t,e)=>{if(r){let e=n+this.layerTypes[r]+t;this.mapBox.getLayer(e)&&i.push(e)}else for(let e in this.layerTypes){let r=this.layerTypes[e],o=n+r+t;this.mapBox.getLayer(o)&&i.push(o)}})),this.setLayout(i,"visibility",t)}else"farm"==n?this.setLayout([...this.farmContainer.values()],"visibility",t):"base"==n&&this.setLayout([...this.baseContainer.values()],"visibility",t)},showMapPoint(t,e){U(t,e)},deleteMapPoint(t){J(t)},updateMapPoint(t){J(t.id),this.switchAddPoint(t)},flyToMap(t){t.center&&"string"==typeof t.center&&(t.center=JSON.parse(t.center)),t.center&&(t.center.wgs84?this.mapBox.flyTo({center:[t.center.wgs84[0],t.center.wgs84[1]],zoom:t.center.zoom}):this.mapBox.flyTo({center:[t.center[0],t.center[1]],zoom:t.zoom}))},setLayout(t,e,n){for(let r of t)r&&this.mapBox.setLayoutProperty(r,e,n)},setAreaColor(t,e,n){for(let e of t){let t=["case"];t.push(n),this.mapBox.setPaintProperty(e,"fill-color",t)}},setZoom(t){switch(t){case"zoomIn":this.mapBox.zoomIn();break;case"zoomOut":this.mapBox.zoomOut();break;case"resize":this.mapBox.resize()}}}};var Y=function(){var t=this._self._c;return t("div",{staticClass:"z-map-views w100 h100 pr"},[t("div",{ref:"mapContainer",staticClass:"mapContainer w100 h100 pr",attrs:{id:this.id}})])},X=[];Y._withStripped=!0;var K=H(V,Y,X,!1,null,"fd5304cf",null,null);K.options.__file="D:\\项目\\测试\\test\\map-views\\components\\ZMap\\ZMap.vue";var W=K.exports;W.install=t=>{t.component(W.name,W)};export{W as ZMap};
@@ -0,0 +1,24 @@
1
+ import t from"mapbox-gl";function e(t){if(!t)throw new Error("obj is required");var e;if(t.length?e=t:t.coordinates?e=t.coordinates:t.geometry&&t.geometry.coordinates&&(e=t.geometry.coordinates),e)return n(e),e;throw new Error("No valid coordinates")}function n(t){if(t.length>1&&"number"==typeof t[0]&&"number"==typeof t[1])return!0;if(Array.isArray(t[0])&&t[0].length)return n(t[0]);throw new Error("coordinates must only contain numbers")}var r=function(t){if(!t)throw new Error("obj is required");var n=e(t);if(n.length>1&&"number"==typeof n[0]&&"number"==typeof n[1])return n;throw new Error("Coordinate is not a valid Point")};var i={miles:3960,nauticalmiles:3441.145,degrees:57.2957795,radians:1,inches:250905600,yards:6969600,meters:6373e3,metres:6373e3,centimeters:6373e5,centimetres:6373e5,kilometers:6373,kilometres:6373,feet:20908792.65};function o(t,e){if(null==t)throw new Error("radians is required");var n=i[e||"kilometers"];if(!n)throw new Error("units is invalid");return t*n}var s=r,a=o;function l(t,e,n){if(null!==t){var r,i,o,s,a,u,h,c,p,f,y=0,g=0,d=t.type,m="FeatureCollection"===d,x="Feature"===d,v=m?t.features.length:1;for(r=0;r<v;r++)for(h=(f=!!(p=m?t.features[r].geometry:x?t.geometry:t)&&"GeometryCollection"===p.type)?p.geometries.length:1,i=0;i<h;i++){var b=0;if(null!==(u=f?p.geometries[i]:p)){c=u.coordinates;var w=u.type;switch(y=!n||"Polygon"!==w&&"MultiPolygon"!==w?0:1,w){case null:break;case"Point":e(c,g,r,b),g++,b++;break;case"LineString":case"MultiPoint":for(o=0;o<c.length;o++)e(c[o],g,r,b),g++,"MultiPoint"===w&&b++;"LineString"===w&&b++;break;case"Polygon":case"MultiLineString":for(o=0;o<c.length;o++){for(s=0;s<c[o].length-y;s++)e(c[o][s],g,r,b),g++;"MultiLineString"===w&&b++}"Polygon"===w&&b++;break;case"MultiPolygon":for(o=0;o<c.length;o++){for(s=0;s<c[o].length;s++)for(a=0;a<c[o][s].length-y;a++)e(c[o][s][a],g,r,b),g++;b++}break;case"GeometryCollection":for(o=0;o<u.geometries.length;o++)l(u.geometries[o],e,n);break;default:throw new Error("Unknown Geometry Type")}}}}}function u(t,e,n,r){var i=n;return l(t,(function(t,r,o,s){i=0===r&&void 0===n?t:e(i,t,r,o,s)}),r),i}function h(t,e){var n;switch(t.type){case"FeatureCollection":for(n=0;n<t.features.length;n++)e(t.features[n].properties,n);break;case"Feature":e(t.properties,0)}}function c(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var n=0;n<t.features.length;n++)e(t.features[n],n)}function p(t,e){var n,r,i,o,s,a,l,u,h=0,c="FeatureCollection"===t.type,p="Feature"===t.type,f=c?t.features.length:1;for(n=0;n<f;n++){for(a=c?t.features[n].geometry:p?t.geometry:t,u=c?t.features[n].properties:p?t.properties:{},s=(l=!!a&&"GeometryCollection"===a.type)?a.geometries.length:1,i=0;i<s;i++)if(null!==(o=l?a.geometries[i]:a))switch(o.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":e(o,h,u);break;case"GeometryCollection":for(r=0;r<o.geometries.length;r++)e(o.geometries[r],h,u);break;default:throw new Error("Unknown Geometry Type")}else e(null,h,u);h++}}function f(t,e){p(t,(function(t,n,r){var i,o=null===t?null:t.type;switch(o){case null:case"Point":case"LineString":case"Polygon":return void e(g(t,r),n,0)}switch(o){case"MultiPoint":i="Point";break;case"MultiLineString":i="LineString";break;case"MultiPolygon":i="Polygon"}t.coordinates.forEach((function(t,o){e(g({type:i,coordinates:t},r),n,o)}))}))}function y(t,e){f(t,(function(t,n,r){var i=0;if(t.geometry){var o=t.geometry.type;"Point"!==o&&"MultiPoint"!==o&&u(t,(function(o,s){var a=d([o,s],t.properties);return e(a,n,r,i),i++,s}))}}))}function g(t,e){if(void 0===t)throw new Error("No geometry passed");return{type:"Feature",properties:e||{},geometry:t}}function d(t,e){if(!t)throw new Error("No coordinates passed");if(t.length<2)throw new Error("Coordinates must be an array of two or more positions");return{type:"Feature",properties:e||{},geometry:{type:"LineString",coordinates:t}}}function m(t,e){if(!t)throw new Error("geojson is required");var n=t.geometry?t.geometry.type:t.type;if(!n)throw new Error("invalid geojson");if("FeatureCollection"===n)throw new Error("FeatureCollection is not supported");if("GeometryCollection"===n)throw new Error("GeometryCollection is not supported");var r=t.geometry?t.geometry.coordinates:t.coordinates;if(!r)throw new Error("geojson must contain coordinates");switch(n){case"LineString":return void e(r,0,0);case"Polygon":case"MultiLineString":for(var i=0,o=0;o<r.length;o++)"MultiLineString"===n&&(i=o),e(r[o],o,i);return;case"MultiPolygon":for(var s=0;s<r.length;s++)for(var a=0;a<r[s].length;a++)e(r[s][a],a,s);return;default:throw new Error(n+" geometry not supported")}}var x=Object.freeze({__proto__:null,coordAll:function(t){var e=[];return l(t,(function(t){e.push(t)})),e},coordEach:l,coordReduce:u,feature:g,featureEach:c,featureReduce:function(t,e,n){var r=n;return c(t,(function(t,i){r=0===i&&void 0===n?t:e(r,t,i)})),r},flattenEach:f,flattenReduce:function(t,e,n){var r=n;return f(t,(function(t,i,o){r=0===i&&0===o&&void 0===n?t:e(r,t,i,o)})),r},geomEach:p,geomReduce:function(t,e,n){var r=n;return p(t,(function(t,i,o){r=0===i&&void 0===n?t:e(r,t,i,o)})),r},lineEach:m,lineReduce:function(t,e,n){var r=n;return m(t,(function(t,i,o){r=0===i&&void 0===n?t:e(r,t,i,o)})),r},lineString:d,propEach:h,propReduce:function(t,e,n){var r=n;return h(t,(function(t,i){r=0===i&&void 0===n?t:e(r,t,i)})),r},segmentEach:y,segmentReduce:function(t,e,n){var r=n,i=!1;return y(t,(function(t,o,s,a){r=!1===i&&void 0===n?t:e(r,t,o,s,a),i=!0})),r}}).segmentReduce,v=function(t,e){if(!t)throw new Error("geojson is required");return x(t,(function(t,n){var r=n.geometry.coordinates;return t+function(t,e,n){var r=Math.PI/180,i=s(t),o=s(e),l=r*(o[1]-i[1]),u=r*(o[0]-i[0]),h=r*i[1],c=r*o[1],p=Math.pow(Math.sin(l/2),2)+Math.pow(Math.sin(u/2),2)*Math.cos(h)*Math.cos(c);return a(2*Math.atan2(Math.sqrt(p),Math.sqrt(1-p)),n)}(r[0],r[1],e)}),0)},b=6371008.8,w={centimeters:637100880,centimetres:637100880,degrees:57.22891354143274,feet:20902260.511392,inches:39.37*b,kilometers:6371.0088,kilometres:6371.0088,meters:b,metres:b,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:b/1852,radians:1,yards:6967335.223679999};function E(t,e,n){void 0===n&&(n={});var r={type:"Feature"};return(0===n.id||n.id)&&(r.id=n.id),n.bbox&&(r.bbox=n.bbox),r.properties=e||{},r.geometry=t,r}function S(t,e,n){if(void 0===n&&(n={}),!t)throw new Error("coordinates is required");if(!Array.isArray(t))throw new Error("coordinates must be an Array");if(t.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!M(t[0])||!M(t[1]))throw new Error("coordinates must contain numbers");return E({type:"Point",coordinates:t},e,n)}function _(t){return 180*(t%(2*Math.PI))/Math.PI}function P(t){return t%360*Math.PI/180}function M(t){return!isNaN(t)&&null!==t&&!Array.isArray(t)}function k(t){if(!t)throw new Error("coord is required");if(!Array.isArray(t)){if("Feature"===t.type&&null!==t.geometry&&"Point"===t.geometry.type)return t.geometry.coordinates;if("Point"===t.type)return t.coordinates}if(Array.isArray(t)&&t.length>=2&&!Array.isArray(t[0])&&!Array.isArray(t[1]))return t;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function C(t){return"Feature"===t.type?t.geometry:t}function I(t,e,n){if(void 0===n&&(n={}),!0===n.final)return function(t,e){var n=I(e,t);return n=(n+180)%360}(t,e);var r=k(t),i=k(e),o=P(r[0]),s=P(i[0]),a=P(r[1]),l=P(i[1]),u=Math.sin(s-o)*Math.cos(l),h=Math.cos(a)*Math.sin(l)-Math.sin(a)*Math.cos(l)*Math.cos(s-o);return _(Math.atan2(u,h))}function R(t,e,n,r){void 0===r&&(r={});var i=k(t),o=P(i[0]),s=P(i[1]),a=P(n),l=function(t,e){void 0===e&&(e="kilometers");var n=w[e];if(!n)throw new Error(e+" units is invalid");return t/n}(e,r.units),u=Math.asin(Math.sin(s)*Math.cos(l)+Math.cos(s)*Math.sin(l)*Math.cos(a));return S([_(o+Math.atan2(Math.sin(a)*Math.sin(l)*Math.cos(s),Math.cos(l)-Math.sin(s)*Math.sin(u))),_(u)],r.properties)}function L(t,e,n){void 0===n&&(n={});var r=k(t),i=k(e),o=P(i[1]-r[1]),s=P(i[0]-r[0]),a=P(r[1]),l=P(i[1]),u=Math.pow(Math.sin(o/2),2)+Math.pow(Math.sin(s/2),2)*Math.cos(a)*Math.cos(l);return function(t,e){void 0===e&&(e="kilometers");var n=w[e];if(!n)throw new Error(e+" units is invalid");return t*n}(2*Math.atan2(Math.sqrt(u),Math.sqrt(1-u)),n.units)}function A(t){return A="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},A(t)}function T(t){return function(t){if(Array.isArray(t))return B(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return B(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return B(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function B(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var z,O,N=(z=function(t,e){t.exports=function(){
2
+ /**
3
+ * splaytree v3.1.2
4
+ * Fast Splay tree for Node and browser
5
+ *
6
+ * @author Alexander Milevski <info@w8r.name>
7
+ * @license MIT
8
+ * @preserve
9
+ */
10
+ /*! *****************************************************************************
11
+ Copyright (c) Microsoft Corporation. All rights reserved.
12
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
13
+ this file except in compliance with the License. You may obtain a copy of the
14
+ License at http://www.apache.org/licenses/LICENSE-2.0
15
+
16
+ THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17
+ KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
18
+ WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
19
+ MERCHANTABLITY OR NON-INFRINGEMENT.
20
+
21
+ See the Apache Version 2.0 License for specific language governing permissions
22
+ and limitations under the License.
23
+ ***************************************************************************** */
24
+ function t(t,e){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(t){return function(e){return l([t,e])}}function l(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}}var e=function(){function t(t,e){this.next=null,this.key=t,this.data=e,this.left=null,this.right=null}return t}();function n(t,e){return t>e?1:t<e?-1:0}function r(t,n,r){for(var i=new e(null,null),o=i,s=i;;){var a=r(t,n.key);if(a<0){if(null===n.left)break;if(r(t,n.left.key)<0){var l=n.left;if(n.left=l.right,l.right=n,null===(n=l).left)break}s.left=n,s=n,n=n.left}else{if(!(a>0))break;if(null===n.right)break;if(r(t,n.right.key)>0&&(l=n.right,n.right=l.left,l.left=n,null===(n=l).right))break;o.right=n,o=n,n=n.right}}return o.right=n.left,s.left=n.right,n.left=i.right,n.right=i.left,n}function i(t,n,i,o){var s=new e(t,n);if(null===i)return s.left=s.right=null,s;var a=o(t,(i=r(t,i,o)).key);return a<0?(s.left=i.left,s.right=i,i.left=null):a>=0&&(s.right=i.right,s.left=i,i.right=null),s}function o(t,e,n){var i=null,o=null;if(e){var s=n((e=r(t,e,n)).key,t);0===s?(i=e.left,o=e.right):s<0?(o=e.right,e.right=null,i=e):(i=e.left,e.left=null,o=e)}return{left:i,right:o}}function s(t,e,n){return null===e?t:(null===t||((e=r(t.key,e,n)).left=t),e)}function a(t,e,n,r,i){if(t){r(e+(n?"└── ":"├── ")+i(t)+"\n");var o=e+(n?" ":"│ ");t.left&&a(t.left,o,!1,r,i),t.right&&a(t.right,o,!0,r,i)}}var l=function(){function l(t){void 0===t&&(t=n),this._root=null,this._size=0,this._comparator=t}return l.prototype.insert=function(t,e){return this._size++,this._root=i(t,e,this._root,this._comparator)},l.prototype.add=function(t,n){var i=new e(t,n);null===this._root&&(i.left=i.right=null,this._size++,this._root=i);var o=this._comparator,s=r(t,this._root,o),a=o(t,s.key);return 0===a?this._root=s:(a<0?(i.left=s.left,i.right=s,s.left=null):a>0&&(i.right=s.right,i.left=s,s.right=null),this._size++,this._root=i),this._root},l.prototype.remove=function(t){this._root=this._remove(t,this._root,this._comparator)},l.prototype._remove=function(t,e,n){var i;return null===e?null:0===n(t,(e=r(t,e,n)).key)?(null===e.left?i=e.right:(i=r(t,e.left,n)).right=e.right,this._size--,i):e},l.prototype.pop=function(){var t=this._root;if(t){for(;t.left;)t=t.left;return this._root=r(t.key,this._root,this._comparator),this._root=this._remove(t.key,this._root,this._comparator),{key:t.key,data:t.data}}return null},l.prototype.findStatic=function(t){for(var e=this._root,n=this._comparator;e;){var r=n(t,e.key);if(0===r)return e;e=r<0?e.left:e.right}return null},l.prototype.find=function(t){return this._root&&(this._root=r(t,this._root,this._comparator),0!==this._comparator(t,this._root.key))?null:this._root},l.prototype.contains=function(t){for(var e=this._root,n=this._comparator;e;){var r=n(t,e.key);if(0===r)return!0;e=r<0?e.left:e.right}return!1},l.prototype.forEach=function(t,e){for(var n=this._root,r=[],i=!1;!i;)null!==n?(r.push(n),n=n.left):0!==r.length?(n=r.pop(),t.call(e,n),n=n.right):i=!0;return this},l.prototype.range=function(t,e,n,r){for(var i=[],o=this._comparator,s=this._root;0!==i.length||s;)if(s)i.push(s),s=s.left;else{if(o((s=i.pop()).key,e)>0)break;if(o(s.key,t)>=0&&n.call(r,s))return this;s=s.right}return this},l.prototype.keys=function(){var t=[];return this.forEach((function(e){var n=e.key;return t.push(n)})),t},l.prototype.values=function(){var t=[];return this.forEach((function(e){var n=e.data;return t.push(n)})),t},l.prototype.min=function(){return this._root?this.minNode(this._root).key:null},l.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},l.prototype.minNode=function(t){if(void 0===t&&(t=this._root),t)for(;t.left;)t=t.left;return t},l.prototype.maxNode=function(t){if(void 0===t&&(t=this._root),t)for(;t.right;)t=t.right;return t},l.prototype.at=function(t){for(var e=this._root,n=!1,r=0,i=[];!n;)if(e)i.push(e),e=e.left;else if(i.length>0){if(e=i.pop(),r===t)return e;r++,e=e.right}else n=!0;return null},l.prototype.next=function(t){var e=this._root,n=null;if(t.right){for(n=t.right;n.left;)n=n.left;return n}for(var r=this._comparator;e;){var i=r(t.key,e.key);if(0===i)break;i<0?(n=e,e=e.left):e=e.right}return n},l.prototype.prev=function(t){var e=this._root,n=null;if(null!==t.left){for(n=t.left;n.right;)n=n.right;return n}for(var r=this._comparator;e;){var i=r(t.key,e.key);if(0===i)break;i<0?e=e.left:(n=e,e=e.right)}return n},l.prototype.clear=function(){return this._root=null,this._size=0,this},l.prototype.toList=function(){return c(this._root)},l.prototype.load=function(t,e,n){void 0===e&&(e=[]),void 0===n&&(n=!1);var r=t.length,i=this._comparator;if(n&&y(t,e,0,r-1,i),null===this._root)this._root=u(t,e,0,r),this._size=r;else{var o=f(this.toList(),h(t,e),i);r=this._size+r,this._root=p({head:o},0,r)}return this},l.prototype.isEmpty=function(){return null===this._root},Object.defineProperty(l.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),l.prototype.toString=function(t){void 0===t&&(t=function(t){return String(t.key)});var e=[];return a(this._root,"",!0,(function(t){return e.push(t)}),t),e.join("")},l.prototype.update=function(t,e,n){var r=this._comparator,a=o(t,this._root,r),l=a.left,u=a.right;r(t,e)<0?u=i(e,n,u,r):l=i(e,n,l,r),this._root=s(l,u,r)},l.prototype.split=function(t){return o(t,this._root,this._comparator)},l.prototype[Symbol.iterator]=function(){var e,n,r;return t(this,(function(t){switch(t.label){case 0:e=this._root,n=[],r=!1,t.label=1;case 1:return r?[3,6]:null===e?[3,2]:(n.push(e),e=e.left,[3,5]);case 2:return 0===n.length?[3,4]:[4,e=n.pop()];case 3:return t.sent(),e=e.right,[3,5];case 4:r=!0,t.label=5;case 5:return[3,1];case 6:return[2]}}))},l}();function u(t,n,r,i){var o=i-r;if(o>0){var s=r+Math.floor(o/2),a=t[s],l=n[s],h=new e(a,l);return h.left=u(t,n,r,s),h.right=u(t,n,s+1,i),h}return null}function h(t,n){for(var r=new e(null,null),i=r,o=0;o<t.length;o++)i=i.next=new e(t[o],n[o]);return i.next=null,r.next}function c(t){for(var n=t,r=[],i=!1,o=new e(null,null),s=o;!i;)n?(r.push(n),n=n.left):r.length>0?n=(n=s=s.next=r.pop()).right:i=!0;return s.next=null,o.next}function p(t,e,n){var r=n-e;if(r>0){var i=e+Math.floor(r/2),o=p(t,e,i),s=t.head;return s.left=o,t.head=t.head.next,s.right=p(t,i+1,n),s}return null}function f(t,n,r){for(var i=new e(null,null),o=i,s=t,a=n;null!==s&&null!==a;)r(s.key,a.key)<0?(o.next=s,s=s.next):(o.next=a,a=a.next),o=o.next;return null!==s?o.next=s:null!==a&&(o.next=a),i.next}function y(t,e,n,r,i){if(!(n>=r)){for(var o=t[n+r>>1],s=n-1,a=r+1;;){do{s++}while(i(t[s],o)<0);do{a--}while(i(t[a],o)>0);if(s>=a)break;var l=t[s];t[s]=t[a],t[a]=l,l=e[s],e[s]=e[a],e[a]=l}y(t,e,n,a,i),y(t,e,a+1,r,i)}}const g=(t,e)=>t.ll.x<=e.x&&e.x<=t.ur.x&&t.ll.y<=e.y&&e.y<=t.ur.y,d=(t,e)=>{if(e.ur.x<t.ll.x||t.ur.x<e.ll.x||e.ur.y<t.ll.y||t.ur.y<e.ll.y)return null;const n=t.ll.x<e.ll.x?e.ll.x:t.ll.x,r=t.ur.x<e.ur.x?t.ur.x:e.ur.x;return{ll:{x:n,y:t.ll.y<e.ll.y?e.ll.y:t.ll.y},ur:{x:r,y:t.ur.y<e.ur.y?t.ur.y:e.ur.y}}};let m=Number.EPSILON;void 0===m&&(m=Math.pow(2,-52));const x=m*m,v=(t,e)=>{if(-m<t&&t<m&&-m<e&&e<m)return 0;const n=t-e;return n*n<x*t*e?0:t<e?-1:1};class b{constructor(){this.reset()}reset(){this.xRounder=new w,this.yRounder=new w}round(t,e){return{x:this.xRounder.round(t),y:this.yRounder.round(e)}}}class w{constructor(){this.tree=new l,this.round(0)}round(t){const e=this.tree.add(t),n=this.tree.prev(e);if(null!==n&&0===v(e.key,n.key))return this.tree.remove(t),n.key;const r=this.tree.next(e);return null!==r&&0===v(e.key,r.key)?(this.tree.remove(t),r.key):t}}const E=new b,S=11102230246251565e-32,_=134217729,P=(3+8*S)*S;function M(t,e,n,r,i){let o,s,a,l,u=e[0],h=r[0],c=0,p=0;h>u==h>-u?(o=u,u=e[++c]):(o=h,h=r[++p]);let f=0;if(c<t&&p<n)for(h>u==h>-u?(s=u+o,a=o-(s-u),u=e[++c]):(s=h+o,a=o-(s-h),h=r[++p]),o=s,0!==a&&(i[f++]=a);c<t&&p<n;)h>u==h>-u?(s=o+u,l=s-o,a=o-(s-l)+(u-l),u=e[++c]):(s=o+h,l=s-o,a=o-(s-l)+(h-l),h=r[++p]),o=s,0!==a&&(i[f++]=a);for(;c<t;)s=o+u,l=s-o,a=o-(s-l)+(u-l),u=e[++c],o=s,0!==a&&(i[f++]=a);for(;p<n;)s=o+h,l=s-o,a=o-(s-l)+(h-l),h=r[++p],o=s,0!==a&&(i[f++]=a);return 0===o&&0!==f||(i[f++]=o),f}function k(t,e){let n=e[0];for(let r=1;r<t;r++)n+=e[r];return n}function C(t){return new Float64Array(t)}const I=(3+16*S)*S,R=(2+12*S)*S,L=(9+64*S)*S*S,A=C(4),T=C(8),B=C(12),z=C(16),O=C(4);function N(t,e,n,r,i,o,s){let a,l,u,h,c,p,f,y,g,d,m,x,v,b,w,E,S,C;const I=t-i,N=n-i,F=e-o,j=r-o;b=I*j,p=_*I,f=p-(p-I),y=I-f,p=_*j,g=p-(p-j),d=j-g,w=y*d-(b-f*g-y*g-f*d),E=F*N,p=_*F,f=p-(p-F),y=F-f,p=_*N,g=p-(p-N),d=N-g,S=y*d-(E-f*g-y*g-f*d),m=w-S,c=w-m,A[0]=w-(m+c)+(c-S),x=b+m,c=x-b,v=b-(x-c)+(m-c),m=v-E,c=v-m,A[1]=v-(m+c)+(c-E),C=x+m,c=C-x,A[2]=x-(C-c)+(m-c),A[3]=C;let $=k(4,A),q=R*s;if($>=q||-$>=q)return $;if(c=t-I,a=t-(I+c)+(c-i),c=n-N,u=n-(N+c)+(c-i),c=e-F,l=e-(F+c)+(c-o),c=r-j,h=r-(j+c)+(c-o),0===a&&0===l&&0===u&&0===h)return $;if(q=L*s+P*Math.abs($),$+=I*h+j*a-(F*u+N*l),$>=q||-$>=q)return $;b=a*j,p=_*a,f=p-(p-a),y=a-f,p=_*j,g=p-(p-j),d=j-g,w=y*d-(b-f*g-y*g-f*d),E=l*N,p=_*l,f=p-(p-l),y=l-f,p=_*N,g=p-(p-N),d=N-g,S=y*d-(E-f*g-y*g-f*d),m=w-S,c=w-m,O[0]=w-(m+c)+(c-S),x=b+m,c=x-b,v=b-(x-c)+(m-c),m=v-E,c=v-m,O[1]=v-(m+c)+(c-E),C=x+m,c=C-x,O[2]=x-(C-c)+(m-c),O[3]=C;const G=M(4,A,4,O,T);b=I*h,p=_*I,f=p-(p-I),y=I-f,p=_*h,g=p-(p-h),d=h-g,w=y*d-(b-f*g-y*g-f*d),E=F*u,p=_*F,f=p-(p-F),y=F-f,p=_*u,g=p-(p-u),d=u-g,S=y*d-(E-f*g-y*g-f*d),m=w-S,c=w-m,O[0]=w-(m+c)+(c-S),x=b+m,c=x-b,v=b-(x-c)+(m-c),m=v-E,c=v-m,O[1]=v-(m+c)+(c-E),C=x+m,c=C-x,O[2]=x-(C-c)+(m-c),O[3]=C;const U=M(G,T,4,O,B);b=a*h,p=_*a,f=p-(p-a),y=a-f,p=_*h,g=p-(p-h),d=h-g,w=y*d-(b-f*g-y*g-f*d),E=l*u,p=_*l,f=p-(p-l),y=l-f,p=_*u,g=p-(p-u),d=u-g,S=y*d-(E-f*g-y*g-f*d),m=w-S,c=w-m,O[0]=w-(m+c)+(c-S),x=b+m,c=x-b,v=b-(x-c)+(m-c),m=v-E,c=v-m,O[1]=v-(m+c)+(c-E),C=x+m,c=C-x,O[2]=x-(C-c)+(m-c),O[3]=C;const J=M(U,B,4,O,z);return z[J-1]}function F(t,e,n,r,i,o){const s=(e-o)*(n-i),a=(t-i)*(r-o),l=s-a,u=Math.abs(s+a);return Math.abs(l)>=I*u?l:-N(t,e,n,r,i,o,u)}const j=(t,e)=>t.x*e.y-t.y*e.x,$=(t,e)=>t.x*e.x+t.y*e.y,q=(t,e,n)=>{const r=F(t.x,t.y,e.x,e.y,n.x,n.y);return r>0?-1:r<0?1:0},G=t=>Math.sqrt($(t,t)),U=(t,e,n)=>{const r={x:e.x-t.x,y:e.y-t.y},i={x:n.x-t.x,y:n.y-t.y};return j(i,r)/G(i)/G(r)},J=(t,e,n)=>{const r={x:e.x-t.x,y:e.y-t.y},i={x:n.x-t.x,y:n.y-t.y};return $(i,r)/G(i)/G(r)},Z=(t,e,n)=>0===e.y?null:{x:t.x+e.x/e.y*(n-t.y),y:n},D=(t,e,n)=>0===e.x?null:{x:n,y:t.y+e.y/e.x*(n-t.x)},H=(t,e,n,r)=>{if(0===e.x)return D(n,r,t.x);if(0===r.x)return D(t,e,n.x);if(0===e.y)return Z(n,r,t.y);if(0===r.y)return Z(t,e,n.y);const i=j(e,r);if(0==i)return null;const o={x:n.x-t.x,y:n.y-t.y},s=j(o,e)/i,a=j(o,r)/i;return{x:(t.x+a*e.x+(n.x+s*r.x))/2,y:(t.y+a*e.y+(n.y+s*r.y))/2}};class V{static compare(t,e){const n=V.comparePoints(t.point,e.point);return 0!==n?n:(t.point!==e.point&&t.link(e),t.isLeft!==e.isLeft?t.isLeft?1:-1:X.compare(t.segment,e.segment))}static comparePoints(t,e){return t.x<e.x?-1:t.x>e.x?1:t.y<e.y?-1:t.y>e.y?1:0}constructor(t,e){void 0===t.events?t.events=[this]:t.events.push(this),this.point=t,this.isLeft=e}link(t){if(t.point===this.point)throw new Error("Tried to link already linked events");const e=t.point.events;for(let t=0,n=e.length;t<n;t++){const n=e[t];this.point.events.push(n),n.point=this.point}this.checkForConsuming()}checkForConsuming(){const t=this.point.events.length;for(let e=0;e<t;e++){const n=this.point.events[e];if(void 0===n.segment.consumedBy)for(let r=e+1;r<t;r++){const t=this.point.events[r];void 0===t.consumedBy&&n.otherSE.point.events===t.otherSE.point.events&&n.segment.consume(t.segment)}}}getAvailableLinkedEvents(){const t=[];for(let e=0,n=this.point.events.length;e<n;e++){const n=this.point.events[e];n!==this&&!n.segment.ringOut&&n.segment.isInResult()&&t.push(n)}return t}getLeftmostComparator(t){const e=new Map,n=n=>{const r=n.otherSE;e.set(n,{sine:U(this.point,t.point,r.point),cosine:J(this.point,t.point,r.point)})};return(t,r)=>{e.has(t)||n(t),e.has(r)||n(r);const{sine:i,cosine:o}=e.get(t),{sine:s,cosine:a}=e.get(r);return i>=0&&s>=0?o<a?1:o>a?-1:0:i<0&&s<0?o<a?-1:o>a?1:0:s<i?-1:s>i?1:0}}}let Y=0;class X{static compare(t,e){const n=t.leftSE.point.x,r=e.leftSE.point.x,i=t.rightSE.point.x,o=e.rightSE.point.x;if(o<n)return 1;if(i<r)return-1;const s=t.leftSE.point.y,a=e.leftSE.point.y,l=t.rightSE.point.y,u=e.rightSE.point.y;if(n<r){if(a<s&&a<l)return 1;if(a>s&&a>l)return-1;const n=t.comparePoint(e.leftSE.point);if(n<0)return 1;if(n>0)return-1;const r=e.comparePoint(t.rightSE.point);return 0!==r?r:-1}if(n>r){if(s<a&&s<u)return-1;if(s>a&&s>u)return 1;const n=e.comparePoint(t.leftSE.point);if(0!==n)return n;const r=t.comparePoint(e.rightSE.point);return r<0?1:r>0?-1:1}if(s<a)return-1;if(s>a)return 1;if(i<o){const n=e.comparePoint(t.rightSE.point);if(0!==n)return n}if(i>o){const n=t.comparePoint(e.rightSE.point);if(n<0)return 1;if(n>0)return-1}if(i!==o){const t=l-s,e=i-n,h=u-a,c=o-r;if(t>e&&h<c)return 1;if(t<e&&h>c)return-1}return i>o?1:i<o||l<u?-1:l>u?1:t.id<e.id?-1:t.id>e.id?1:0}constructor(t,e,n,r){this.id=++Y,this.leftSE=t,t.segment=this,t.otherSE=e,this.rightSE=e,e.segment=this,e.otherSE=t,this.rings=n,this.windings=r}static fromRing(t,e,n){let r,i,o;const s=V.comparePoints(t,e);if(s<0)r=t,i=e,o=1;else{if(!(s>0))throw new Error(`Tried to create degenerate segment at [${t.x}, ${t.y}]`);r=e,i=t,o=-1}const a=new V(r,!0),l=new V(i,!1);return new X(a,l,[n],[o])}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,e=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:t<e?t:e},ur:{x:this.rightSE.point.x,y:t>e?t:e}}}vector(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}isAnEndpoint(t){return t.x===this.leftSE.point.x&&t.y===this.leftSE.point.y||t.x===this.rightSE.point.x&&t.y===this.rightSE.point.y}comparePoint(t){if(this.isAnEndpoint(t))return 0;const e=this.leftSE.point,n=this.rightSE.point,r=this.vector();if(e.x===n.x)return t.x===e.x?0:t.x<e.x?1:-1;const i=(t.y-e.y)/r.y,o=e.x+i*r.x;if(t.x===o)return 0;const s=(t.x-e.x)/r.x,a=e.y+s*r.y;return t.y===a?0:t.y<a?-1:1}getIntersection(t){const e=this.bbox(),n=t.bbox(),r=d(e,n);if(null===r)return null;const i=this.leftSE.point,o=this.rightSE.point,s=t.leftSE.point,a=t.rightSE.point,l=g(e,s)&&0===this.comparePoint(s),u=g(n,i)&&0===t.comparePoint(i),h=g(e,a)&&0===this.comparePoint(a),c=g(n,o)&&0===t.comparePoint(o);if(u&&l)return c&&!h?o:!c&&h?a:null;if(u)return h&&i.x===a.x&&i.y===a.y?null:i;if(l)return c&&o.x===s.x&&o.y===s.y?null:s;if(c&&h)return null;if(c)return o;if(h)return a;const p=H(i,this.vector(),s,t.vector());return null===p?null:g(r,p)?E.round(p.x,p.y):null}split(t){const e=[],n=void 0!==t.events,r=new V(t,!0),i=new V(t,!1),o=this.rightSE;this.replaceRightSE(i),e.push(i),e.push(r);const s=new X(r,o,this.rings.slice(),this.windings.slice());return V.comparePoints(s.leftSE.point,s.rightSE.point)>0&&s.swapEvents(),V.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),n&&(r.checkForConsuming(),i.checkForConsuming()),e}swapEvents(){const t=this.rightSE;this.rightSE=this.leftSE,this.leftSE=t,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(let t=0,e=this.windings.length;t<e;t++)this.windings[t]*=-1}consume(t){let e=this,n=t;for(;e.consumedBy;)e=e.consumedBy;for(;n.consumedBy;)n=n.consumedBy;const r=X.compare(e,n);if(0!==r){if(r>0){const t=e;e=n,n=t}if(e.prev===n){const t=e;e=n,n=t}for(let t=0,r=n.rings.length;t<r;t++){const r=n.rings[t],i=n.windings[t],o=e.rings.indexOf(r);-1===o?(e.rings.push(r),e.windings.push(i)):e.windings[o]+=i}n.rings=null,n.windings=null,n.consumedBy=e,n.leftSE.consumedBy=e.leftSE,n.rightSE.consumedBy=e.rightSE}}prevInResult(){return 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(void 0!==this._beforeState)return this._beforeState;if(this.prev){const t=this.prev.consumedBy||this.prev;this._beforeState=t.afterState()}else this._beforeState={rings:[],windings:[],multiPolys:[]};return this._beforeState}afterState(){if(void 0!==this._afterState)return this._afterState;const t=this.beforeState();this._afterState={rings:t.rings.slice(0),windings:t.windings.slice(0),multiPolys:[]};const e=this._afterState.rings,n=this._afterState.windings,r=this._afterState.multiPolys;for(let t=0,r=this.rings.length;t<r;t++){const r=this.rings[t],i=this.windings[t],o=e.indexOf(r);-1===o?(e.push(r),n.push(i)):n[o]+=i}const i=[],o=[];for(let t=0,r=e.length;t<r;t++){if(0===n[t])continue;const r=e[t],s=r.poly;if(-1===o.indexOf(s))if(r.isExterior)i.push(s);else{-1===o.indexOf(s)&&o.push(s);const t=i.indexOf(r.poly);-1!==t&&i.splice(t,1)}}for(let t=0,e=i.length;t<e;t++){const e=i[t].multiPoly;-1===r.indexOf(e)&&r.push(e)}return this._afterState}isInResult(){if(this.consumedBy)return!1;if(void 0!==this._isInResult)return this._isInResult;const t=this.beforeState().multiPolys,e=this.afterState().multiPolys;switch(at.type){case"union":{const n=0===t.length,r=0===e.length;this._isInResult=n!==r;break}case"intersection":{let n,r;t.length<e.length?(n=t.length,r=e.length):(n=e.length,r=t.length),this._isInResult=r===at.numMultiPolys&&n<r;break}case"xor":{const n=Math.abs(t.length-e.length);this._isInResult=n%2==1;break}case"difference":{const n=t=>1===t.length&&t[0].isSubject;this._isInResult=n(t)!==n(e);break}default:throw new Error(`Unrecognized operation type found ${at.type}`)}return this._isInResult}}class K{constructor(t,e,n){if(!Array.isArray(t)||0===t.length)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=e,this.isExterior=n,this.segments=[],"number"!=typeof t[0][0]||"number"!=typeof t[0][1])throw new Error("Input geometry is not a valid Polygon or MultiPolygon");const r=E.round(t[0][0],t[0][1]);this.bbox={ll:{x:r.x,y:r.y},ur:{x:r.x,y:r.y}};let i=r;for(let e=1,n=t.length;e<n;e++){if("number"!=typeof t[e][0]||"number"!=typeof t[e][1])throw new Error("Input geometry is not a valid Polygon or MultiPolygon");let n=E.round(t[e][0],t[e][1]);n.x===i.x&&n.y===i.y||(this.segments.push(X.fromRing(i,n,this)),n.x<this.bbox.ll.x&&(this.bbox.ll.x=n.x),n.y<this.bbox.ll.y&&(this.bbox.ll.y=n.y),n.x>this.bbox.ur.x&&(this.bbox.ur.x=n.x),n.y>this.bbox.ur.y&&(this.bbox.ur.y=n.y),i=n)}r.x===i.x&&r.y===i.y||this.segments.push(X.fromRing(i,r,this))}getSweepEvents(){const t=[];for(let e=0,n=this.segments.length;e<n;e++){const n=this.segments[e];t.push(n.leftSE),t.push(n.rightSE)}return t}}class W{constructor(t,e){if(!Array.isArray(t))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new K(t[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 e=1,n=t.length;e<n;e++){const n=new K(t[e],this,!1);n.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=n.bbox.ll.x),n.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=n.bbox.ll.y),n.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=n.bbox.ur.x),n.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=n.bbox.ur.y),this.interiorRings.push(n)}this.multiPoly=e}getSweepEvents(){const t=this.exteriorRing.getSweepEvents();for(let e=0,n=this.interiorRings.length;e<n;e++){const n=this.interiorRings[e].getSweepEvents();for(let e=0,r=n.length;e<r;e++)t.push(n[e])}return t}}class Q{constructor(t,e){if(!Array.isArray(t))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{"number"==typeof t[0][0][0]&&(t=[t])}catch(t){}this.polys=[],this.bbox={ll:{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY},ur:{x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY}};for(let e=0,n=t.length;e<n;e++){const n=new W(t[e],this);n.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=n.bbox.ll.x),n.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=n.bbox.ll.y),n.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=n.bbox.ur.x),n.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=n.bbox.ur.y),this.polys.push(n)}this.isSubject=e}getSweepEvents(){const t=[];for(let e=0,n=this.polys.length;e<n;e++){const n=this.polys[e].getSweepEvents();for(let e=0,r=n.length;e<r;e++)t.push(n[e])}return t}}class tt{static factory(t){const e=[];for(let n=0,r=t.length;n<r;n++){const r=t[n];if(!r.isInResult()||r.ringOut)continue;let i=null,o=r.leftSE,s=r.rightSE;const a=[o],l=o.point,u=[];for(;i=o,o=s,a.push(o),o.point!==l;)for(;;){const t=o.getAvailableLinkedEvents();if(0===t.length){const t=a[0].point,e=a[a.length-1].point;throw new Error(`Unable to complete output ring starting at [${t.x}, ${t.y}]. Last matching segment found ends at [${e.x}, ${e.y}].`)}if(1===t.length){s=t[0].otherSE;break}let n=null;for(let t=0,e=u.length;t<e;t++)if(u[t].point===o.point){n=t;break}if(null!==n){const t=u.splice(n)[0],r=a.splice(t.index);r.unshift(r[0].otherSE),e.push(new tt(r.reverse()));continue}u.push({index:a.length,point:o.point});const r=o.getLeftmostComparator(i);s=t.sort(r)[0].otherSE;break}e.push(new tt(a))}return e}constructor(t){this.events=t;for(let e=0,n=t.length;e<n;e++)t[e].segment.ringOut=this;this.poly=null}getGeom(){let t=this.events[0].point;const e=[t];for(let n=1,r=this.events.length-1;n<r;n++){const r=this.events[n].point,i=this.events[n+1].point;0!==q(r,t,i)&&(e.push(r),t=r)}if(1===e.length)return null;const n=e[0],r=e[1];0===q(n,t,r)&&e.shift(),e.push(e[0]);const i=this.isExteriorRing()?1:-1,o=this.isExteriorRing()?0:e.length-1,s=this.isExteriorRing()?e.length:-1,a=[];for(let t=o;t!=s;t+=i)a.push([e[t].x,e[t].y]);return a}isExteriorRing(){if(void 0===this._isExteriorRing){const t=this.enclosingRing();this._isExteriorRing=!t||!t.isExteriorRing()}return this._isExteriorRing}enclosingRing(){return void 0===this._enclosingRing&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}_calcEnclosingRing(){let t=this.events[0];for(let e=1,n=this.events.length;e<n;e++){const n=this.events[e];V.compare(t,n)>0&&(t=n)}let e=t.segment.prevInResult(),n=e?e.prevInResult():null;for(;;){if(!e)return null;if(!n)return e.ringOut;if(n.ringOut!==e.ringOut)return n.ringOut.enclosingRing()!==e.ringOut?e.ringOut:e.ringOut.enclosingRing();e=n.prevInResult(),n=e?e.prevInResult():null}}}class et{constructor(t){this.exteriorRing=t,t.poly=this,this.interiorRings=[]}addInterior(t){this.interiorRings.push(t),t.poly=this}getGeom(){const t=[this.exteriorRing.getGeom()];if(null===t[0])return null;for(let e=0,n=this.interiorRings.length;e<n;e++){const n=this.interiorRings[e].getGeom();null!==n&&t.push(n)}return t}}class nt{constructor(t){this.rings=t,this.polys=this._composePolys(t)}getGeom(){const t=[];for(let e=0,n=this.polys.length;e<n;e++){const n=this.polys[e].getGeom();null!==n&&t.push(n)}return t}_composePolys(t){const e=[];for(let n=0,r=t.length;n<r;n++){const r=t[n];if(!r.poly)if(r.isExteriorRing())e.push(new et(r));else{const t=r.enclosingRing();t.poly||e.push(new et(t)),t.poly.addInterior(r)}}return e}}class rt{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:X.compare;this.queue=t,this.tree=new l(e),this.segments=[]}process(t){const e=t.segment,n=[];if(t.consumedBy)return t.isLeft?this.queue.remove(t.otherSE):this.tree.remove(e),n;const r=t.isLeft?this.tree.add(e):this.tree.find(e);if(!r)throw new Error(`Unable to find segment #${e.id} [${e.leftSE.point.x}, ${e.leftSE.point.y}] -> [${e.rightSE.point.x}, ${e.rightSE.point.y}] in SweepLine tree.`);let i,o,s=r,a=r;for(;void 0===i;)s=this.tree.prev(s),null===s?i=null:void 0===s.key.consumedBy&&(i=s.key);for(;void 0===o;)a=this.tree.next(a),null===a?o=null:void 0===a.key.consumedBy&&(o=a.key);if(t.isLeft){let r=null;if(i){const t=i.getIntersection(e);if(null!==t&&(e.isAnEndpoint(t)||(r=t),!i.isAnEndpoint(t))){const e=this._splitSafely(i,t);for(let t=0,r=e.length;t<r;t++)n.push(e[t])}}let s=null;if(o){const t=o.getIntersection(e);if(null!==t&&(e.isAnEndpoint(t)||(s=t),!o.isAnEndpoint(t))){const e=this._splitSafely(o,t);for(let t=0,r=e.length;t<r;t++)n.push(e[t])}}if(null!==r||null!==s){let t=null;t=null===r?s:null===s||V.comparePoints(r,s)<=0?r:s,this.queue.remove(e.rightSE),n.push(e.rightSE);const i=e.split(t);for(let t=0,e=i.length;t<e;t++)n.push(i[t])}n.length>0?(this.tree.remove(e),n.push(t)):(this.segments.push(e),e.prev=i)}else{if(i&&o){const t=i.getIntersection(o);if(null!==t){if(!i.isAnEndpoint(t)){const e=this._splitSafely(i,t);for(let t=0,r=e.length;t<r;t++)n.push(e[t])}if(!o.isAnEndpoint(t)){const e=this._splitSafely(o,t);for(let t=0,r=e.length;t<r;t++)n.push(e[t])}}}this.tree.remove(e)}return n}_splitSafely(t,e){this.tree.remove(t);const n=t.rightSE;this.queue.remove(n);const r=t.split(e);return r.push(n),void 0===t.consumedBy&&this.tree.add(t),r}}const it="undefined"!=typeof process&&process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,ot="undefined"!=typeof process&&process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6;class st{run(t,e,n){at.type=t,E.reset();const r=[new Q(e,!0)];for(let t=0,e=n.length;t<e;t++)r.push(new Q(n[t],!1));if(at.numMultiPolys=r.length,"difference"===at.type){const t=r[0];let e=1;for(;e<r.length;)null!==d(r[e].bbox,t.bbox)?e++:r.splice(e,1)}if("intersection"===at.type)for(let t=0,e=r.length;t<e;t++){const e=r[t];for(let n=t+1,i=r.length;n<i;n++)if(null===d(e.bbox,r[n].bbox))return[]}const i=new l(V.compare);for(let t=0,e=r.length;t<e;t++){const e=r[t].getSweepEvents();for(let t=0,n=e.length;t<n;t++)if(i.insert(e[t]),i.size>it)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big).")}const o=new rt(i);let s=i.size,a=i.pop();for(;a;){const t=a.key;if(i.size===s){const e=t.segment;throw new Error(`Unable to pop() ${t.isLeft?"left":"right"} SweepEvent [${t.point.x}, ${t.point.y}] from segment #${e.id} [${e.leftSE.point.x}, ${e.leftSE.point.y}] -> [${e.rightSE.point.x}, ${e.rightSE.point.y}] from queue.`)}if(i.size>it)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big).");if(o.segments.length>ot)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments).");const e=o.process(t);for(let t=0,n=e.length;t<n;t++){const n=e[t];void 0===n.consumedBy&&i.insert(n)}s=i.size,a=i.pop()}E.reset();const u=tt.factory(o.segments);return new nt(u).getGeom()}}const at=new st,lt=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return at.run("union",t,n)},ut=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return at.run("intersection",t,n)},ht=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return at.run("xor",t,n)},ct=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return at.run("difference",t,n)};var pt={union:lt,intersection:ut,xor:ht,difference:ct};return pt}()},z(O={exports:{}},O.exports),O.exports);function F(t,e,n){void 0===n&&(n={});var r=C(t),i=C(e),o=N.union(r.coordinates,i.coordinates);return 0===o.length?null:1===o.length?function(t,e,n){void 0===n&&(n={});for(var r=0,i=t;r<i.length;r++){var o=i[r];if(o.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var s=0;s<o[o.length-1].length;s++)if(o[o.length-1][s]!==o[0][s])throw new Error("First and last Position are not equivalent.")}return E({type:"Polygon",coordinates:t},e,n)}(o[0],n.properties):function(t,e,n){return void 0===n&&(n={}),E({type:"MultiPolygon",coordinates:t},e,n)}(o,n.properties)}function j(t){var e=null;if("svg"===t.tag)return e=$(t);if(e=document.createElement(t.tag),"object"===A(t.props)&&null!==t.props){var n=function(){var n=t.props[r];if("on"===r){n=t.props[r];var i=function(t){e.addEventListener(t,(function(e){return n[t](e)}))};for(var o in n)i(o)}else if("dataset"===r)Object.keys(n).forEach((function(t){e.dataset[t]=n[t]}));else if("style"===r)if("string"==typeof n)e.setAttribute(r,n);else{var s=[];Object.keys(n).forEach((function(t){s.push("".concat(t,":").concat(n[t]))})),e.setAttribute(r,s.join(";"))}else"cssText"===r?e.style.cssText=n:e.setAttribute(r,n)};for(var r in t.props)n()}return t.children instanceof Array?t.children.forEach((function(t){e.appendChild(j(t))})):e.textContent=t.children,e}function $(t){var e="http://www.w3.org/1999/xlink",n=document.createElementNS("http://www.w3.org/2000/svg",t.tag);if("svg"===t.tag&&n.setAttribute("xmlns:xlink",e),"object"===A(t.props)&&null!==t.props)for(var r in t.props){var i=t.props[r];"xlink:href"===r?n.setAttributeNS(e,r,i):n.setAttribute(r,i)}return t.children instanceof Array?t.children.forEach((function(t){n.appendChild($(t))})):n.textContent=t.children,n}function q(t,e){var n=JSON.parse(JSON.stringify(e));for(var r in n)t[r]&&("center"==r?(n.center.wgs84=t.center,t.zoom&&(n.center.zoom=t.zoom)):n[r]=t[r]);return n}function G(t){var e=[];return t.info&&t.info.show&&(e.push({tag:"div",props:{class:"PointInfo ".concat(t.info.type)},children:[]}),t.titles&&t.titles.show&&e[0].children.push({tag:"div",props:{class:"PointTitle"},children:t.titles.value}),t.contents&&t.contents.show&&e[0].children.push({tag:"div",props:{class:"PointContent"},children:t.contents.value})),e}function U(t,e){!e||"string"!=typeof e&&"number"!=typeof e||(e=[e]);for(var n=document.querySelectorAll(".PointMap"),r=function(r){e?e.forEach((function(e,i){var o,s="PointMap_"+e;(null===(o=n[r])||void 0===o?void 0:o.className.indexOf(s))>-1&&("visible"==t?n[r].classList.remove("z-none"):n[r].classList.add("z-none"))})):"visible"==t?n[r].classList.remove("z-none"):n[r].classList.add("z-none")},i=0;i<n.length;i++)r(i)}function J(t){if(!t)return console.log("请传入标点的id!!!"),!1;!t||"string"!=typeof t&&"number"!=typeof t||(t=[t]);for(var e=document.querySelectorAll(".PointMap"),n=function(n){t.forEach((function(t,r){var i,o="PointMap_"+t;(null===(i=e[n])||void 0===i?void 0:i.className.indexOf(o))>-1&&e[n].remove()}))},r=0;r<e.length;r++)n(r)}function Z(t,e,n){var r={"line-color":n["line-color"],"line-width":n["line-width"],"line-opacity":n["line-opacity"]};return n["line-blur"]&&(r["line-blur"]=n["line-blur"]),n["line-offset"]&&(r["line-offset"]=n["line-offset"]),{id:t,type:"line",source:e,layout:{"line-cap":"round","line-join":"round"},paint:r,metadata:{zIndex:n.zIndex}}}function D(t,e,n,r){return{id:t,type:"symbol",source:e,layout:{"text-field":n,"text-size":r["text-size"],"text-allow-overlap":!0,"text-justify":r["text-justify"],"text-offset":r["text-offset"],"text-anchor":"bottom","icon-image":"","text-font":["Alibaba-PuHuiTi Regular"]},paint:{"text-color":r["text-color"],"text-halo-color":r["text-halo-color"],"text-halo-width":r["text-halo-width"]},metadata:{zIndex:4}}}function H(t,e,n,r,i,o,s,a){var l,u="function"==typeof t?t.options:t;if(e&&(u.render=e,u.staticRenderFns=n,u._compiled=!0),r&&(u.functional=!0),o&&(u._scopeId="data-v-"+o),s?(l=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),i&&i.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(s)},u._ssrRegister=l):i&&(l=a?function(){i.call(this,(u.functional?this.parent:this).$root.$options.shadowRoot)}:i),l)if(u.functional){u._injectStyles=l;var h=u.render;u.render=function(t,e){return l.call(e),h(t,e)}}else{var c=u.beforeCreate;u.beforeCreate=c?[].concat(c,l):[l]}return{exports:t,options:u}}const V={name:"ZMap",props:{id:{type:String,default:"mapContainer"},mapStyle:{type:Object,default:()=>({})},mapKey:{type:String,default:""},cityMap:{type:[Object,String],default:()=>({})},baseMap:{type:Array,default:()=>[]},farmMap:{type:Array,default:()=>[]},lineMap:{type:Array,default:()=>[]},pointMap:{type:Array,default:()=>[]},heatMap:{type:[Object,String],default:()=>({})},routeMap:{type:[Object,String],default:()=>({})},params:{type:Object,default:()=>({})},isDrilling:{type:Boolean,default:!1}},data:()=>({title:"gis地图可视化",mapBox:null,cityContainer:new Map,baseContainer:new Map,farmContainer:new Map,lineContainer:new Map,dotContainer:new Map,routeContainer:new Map,layerTypes:{source:"_s",fill:"_f",line:"_l",text:"_t",prominent:"_p",shadow:"_sh"},parameter:{shadow:!1,scale:!1,zoom:6,minZoom:3,maxZoom:20,center:[106.64070540957499,29.542372847334505],isProminent:"city",prominentType:"geojson",prominentUrl:"",prominentHeight:1,prominentFillColor:"rgba(0, 0, 0, 0.5)",pitch:0,zIndex:0},properties:{center:{wgs84:[106.64314362686562,29.54485285119372],zoom:14.978617404032729},"fill-color":"#016b67","fill-opacity":.5,"fill-outline-color":"#38d9a9","line-color":"rgba(255, 50, 10, 1)","line-opacity":1,"line-width":1,"text-size":14,"text-offset":[0,1.8],"text-justify":"center","text-color":"rgb(159, 96, 55)","text-halo-color":"#fff","text-halo-width":1.8,shadow:{"line-color":"#38d9a9","line-opacity":1,"line-width":25,"line-blur":40,"line-offset":-5}},onClickType:""}),computed:{},mounted(){this.getUsagePermissions()},watch:{cityMap:{handler(t){t&&this.mapBox&&setTimeout((()=>{this.addCityMaps(t)}),400)},deep:!0,immediate:!0},heatMap:{handler(t){t&&this.mapBox&&this.mapBox.on("load",(()=>{this.addHeatMaps(t)}))},deep:!0,immediate:!0},baseMap:{handler(t){t&&(null==t?void 0:t.length)>0&&this.mapBox&&setTimeout((()=>{this.addBaseMaps(t)}),400)},deep:!0,immediate:!0},farmMap:{handler(t){t&&(null==t?void 0:t.length)>0&&this.mapBox&&setTimeout((()=>{this.addFarmMaps(t)}),400)},deep:!0,immediate:!0},lineMap:{handler(t){t&&(null==t?void 0:t.length)>0&&this.mapBox&&setTimeout((()=>{this.addLineMaps(t)}),400)},deep:!0,immediate:!0},pointMap:{handler(t){t&&(null==t?void 0:t.length)>0&&this.mapBox&&setTimeout((()=>{this.addPointMaps(t)}),400)},deep:!0,immediate:!0}},methods:{setCache(t,e){localStorage.setItem(t,JSON.stringify(e))},getCache(t){const e=localStorage.getItem(t);return e?JSON.parse(e):null},getUsagePermissions(){let t="pro__MAP_VIEWS",e=this.getCache(t),n=(new Date).getTime();if(e&&e.value&&n<e.expire)return this.initMap(),!0;return fetch("https://map.zhuyukeji.com/Tool.Map",{method:"GET"}).then((e=>{if(e.ok){this.initMap();let e=n+6048e5;return this.setCache(t,{value:!0,expire:e}),!0}return console.groupCollapsed("%cz-map-views","color:#009a61;font-size:24px;font-weight:800;"),console.log("%c"+window.location.hostname+"\n-------------\n您当前域名没有购买地图服务,或者服务到期!!\n请登录https://map.zhuyukeji.com/Tool.map\n购买!!","color:#009a61"),console.groupEnd(),this.initMap(),!1})).then((t=>{})).catch((t=>(console.error("请求出错:",t),!1)))},initMap(){this.parameter=function(t,e){var n=JSON.parse(JSON.stringify(e));for(var r in n)t[r]&&(n[r]=t[r]);return n}(this.params,this.parameter),this.mapStyle.version&&(this.mapBox=new t.Map({container:this.id,center:this.parameter.center,minZoom:this.parameter.minZoom,maxZoom:this.parameter.maxZoom,zoom:this.parameter.zoom,style:this.mapStyle,pitch:this.parameter.pitch,bearing:0,antialias:!1,accessToken:this.mapKey}),this.parameter.scale&&this.mapBox.addControl(new t.ScaleControl,"bottom-right"))},addCityMaps(t){if(t){if("string"==typeof t&&(t=JSON.parse(t)),!t.properties.id)return console.log("请在properties中传入id"),!1;this.addAreaMap(t.properties,"city",t)}},addHeatMaps(t){const e="source_heat",n="layer_heat";"string"==typeof t&&(t=JSON.parse(t)),this.mapBox.addSource(e,{type:"geojson",data:t}),this.mapBox.addLayer({id:n,type:"heatmap",source:e,minZoom:3,paint:{"heatmap-weight":["interpolate",["linear"],["get","mag"],0,0,6,1],"heatmap-intensity":["interpolate",["linear"],["zoom"],0,1,9,3],"heatmap-color":["interpolate",["linear"],["heatmap-density"],0,"rgba(0,0,0,0)",.2,"#67a9cf",.4,"#d1e5f0",.6,"#fddbc7",.8,"#ef8a62",1,"#b2182b"],"heatmap-radius":["interpolate",["linear"],["zoom"],0,2,9,20],"heatmap-opacity":["interpolate",["linear"],["zoom"],7,1,9,0]}}),this.mapBox.on("click",n,(t=>{if(t.defaultPrevented)return;let e=this.mapBox.queryRenderedFeatures(t.point).filter((t=>t.layer.id==n))[0];this.$emit("heat-click",e.properties),t.preventDefault()}))},addAreaMap(e,n,r){const i=e.id,o=n+this.layerTypes.source+i,s=n+this.layerTypes.line+i,a=n+this.layerTypes.fill+i,l=n+this.layerTypes.text+i,u=n+this.layerTypes.prominent+i,h=n+this.layerTypes.shadow+i;let c=this,p={},f=[],y=!1;switch(r.type){case"Feature":p=q(r.properties,this.properties);break;case"FeatureCollection":p=q(r.features[0].properties,this.properties)}let g={base:{container:this.baseContainer,name:"baseContainer"},farm:{container:this.farmContainer,name:"farmContainer"},city:{container:this.cityContainer,name:"cityContainer"},line:{container:this.lineContainer,name:"lineContainer"},route:{container:this.routeContainer,name:"routeContainer"}};this.mapBox.getSource(o)||this.mapBox.addSource(o,function(t){return{type:"geojson",data:t}}(r)),"city"==n&&this.setLayout([...g[n].container.values()],"visibility","none");["base","farm","city"].indexOf(n)>-1&&(g[n].container.has(a)?this.setLayout([g[n].container.get(a)],"visibility","visible"):(this.mapBox.addLayer(function(t,e,n){return{id:t,type:"fill",source:e,layout:{},paint:{"fill-color":n["fill-color"],"fill-opacity":n["fill-opacity"]},metadata:{zIndex:n.zIndex}}}(a,o,p)),c[g[n].name].set(a,a)));["line","base","farm","city"].indexOf(n)>-1&&(g[n].container.has(s)?this.setLayout([g[n].container.get(s)],"visibility","visible"):(this.mapBox.addLayer(Z(s,o,p)),c[g[n].name].set(s,s)));["farm","city"].indexOf(n)>-1&&(g[n].container.has(l)?this.setLayout([g[n].container.get(l)],"visibility","visible"):(e.showText&&e.text&&"farm"==n&&this.mapBox.addLayer(D(l,o,e.text,p)),"city"==n&&this.mapBox.addLayer(D(l,o,"{name}",p)),c[g[n].name].set(l,l)));["base","city"].indexOf(n)>-1&&"extrusion"==this.parameter.prominentType&&this.addExtrusionImage(o,u);if(["base","city"].indexOf(n)>-1){if("base"==this.parameter.isProminent)switch(r.type){case"Feature":f=r.geometry.coordinates;break;case"FeatureCollection":f=r.features[0].geometry.coordinates}else"city"==this.parameter.isProminent&&("FeatureCollection"==r.type?r.features&&r.features.length>1?(f=function(t,e){if("push"==e){var n=[];return t.features.forEach((function(t,e){t.geometry.coordinates[0]&&t.geometry.coordinates[0].length>0&&(n=[].concat(T(t.geometry.coordinates[0]),T(n)))})),n}var r=t.features[0];return t.features.forEach((function(t,e){t.geometry.coordinates[0]&&t.geometry.coordinates[0].length>0&&(r=F(r,t))})),r.geometry.coordinates}(r,"union"),y=!0):f=r.features[0].geometry.coordinates&&1==r.features[0].geometry.coordinates.length?r.features[0].geometry.coordinates[0]:r.features[0].geometry.coordinates:f=r.geometry.coordinates&&1==r.geometry.coordinates.length?r.geometry.coordinates[0]:r.geometry.coordinates);if(g[n].container.has(u))this.setLayout([g[n].container.get(u)],"visibility","visible");else if(this.parameter.isProminent==n&&f.length>0){let t=y&&f[0][0]&&f[0][0][0]&&f[0][0][0][0]?f[0]:f;if("extrusionBg"==this.parameter.prominentType){let e=function(t){return{type:"geojson",data:{type:"Feature",geometry:{type:"Polygon",coordinates:[[[-180,90],[180,90],[180,-90],[-180,-90]]].concat(T(t))}}}}(t);this.addExtrusionImage(e,u)}else this.mapBox.addLayer(function(t,e,n,r){return{id:t,type:"fill",source:{type:"geojson",data:{type:"Feature",geometry:{type:"Polygon",coordinates:[[[-180,90],[180,90],[180,-90],[-180,-90]]].concat(T(e))}}},paint:{"fill-color":n},layout:{visibility:"visible"},metadata:{zIndex:r.zIndex}}}(u,t,this.parameter.prominentFillColor,p));c[g[n].name].set(u,u)}}switch(n){case"base":this.mapBox.on("click",a,(t=>{"point"===this.onClickType?(t.preventDefault(),this.onClickType=""):this.onClickType=a,t.defaultPrevented||setTimeout((()=>{this.onClickType===a&&this.$emit("base-click",i,e)}),200)}));break;case"farm":this.mapBox.on("click",a,(t=>{"point"===this.onClickType?(t.preventDefault(),this.onClickType=""):this.onClickType=a,t.defaultPrevented||setTimeout((()=>{this.onClickType===a&&this.$emit("farm-click",i,e)}),200)}),!0);break;case"route":let n=function(t){d||(d=t);const e=(t-d)/f;if(e>1)return;const r=function(t,e,n){void 0===n&&(n={});for(var r=C(t).coordinates,i=0,o=0;o<r.length&&!(e>=i&&o===r.length-1);o++){if(i>=e){var s=e-i;if(s){var a=I(r[o],r[o-1])-180;return R(r[o],s,a,n)}return S(r[o])}i+=L(r[o],r[o+1],n)}return S(r[r.length-1])}(y,g*e).geometry.coordinates,i={lng:r[0],lat:r[1]};let o="<p><span>纬度:</span>"+i.lng.toFixed(5)+"</p>";o+="<p><span>经度:</span>"+i.lat.toFixed(5)+"</p>",l.setHTML(o),u.setLngLat(i),c.mapBox.setPaintProperty(s,"line-gradient",["step",["line-progress"],"red",e,"rgba(255, 0, 0, 1)"]),c.mapBox.flyTo({center:i}),window.requestAnimationFrame(n)},r=[];"FeatureCollection"==data.type?r="LineString"==data.features[0].geometry.type?data.features[0].geometry.coordinates:data.features[0].geometry.coordinates[0]:"Feature"==data.type&&(r="LineString"==data.geometry.type?data.geometry.coordinates:data.geometry.coordinates[0]);const l=new t.Popup({closeButton:!1,closeOnClick:!1}),u=new t.Marker({color:"red",scale:.8,draggable:!1,pitchAlignment:"auto",rotationAlignment:"auto"}).setLngLat(r[0]).setPopup(l).addTo(this.mapBox).togglePopup();let h={"line-color":"rgba(255, 50, 10, 1)","line-opacity":1,"line-width":1};this.mapBox.addLayer(Z(s,o,h)),this.routeContainer.set(s,s);const f=time*1e3,y=function(t,e,n){if(void 0===n&&(n={}),t.length<2)throw new Error("coordinates must be an array of two or more positions");return E({type:"LineString",coordinates:t},e,n)}(r),g=v(y);let d;window.requestAnimationFrame(n);break;case"city":this.flyToMap(p),this.mapBox.on("click",a,(t=>{if("point"===this.onClickType&&(t.preventDefault(),this.onClickType=""),t.defaultPrevented)return;this.isDrilling&&this.setLayout([...this.cityContainer.values()],"visibility","none");let e=this.mapBox.queryRenderedFeatures(t.point).filter((t=>t.layer.id==a))[0],n=e.properties&&e.properties.adcode?e.properties.adcode:i;this.$emit("city-click",n,e.properties)}))}this.parameter.shadow&&f.length>0&&"farm"!=n&&this.addShadow(f,h,p)},addShadow(t,e,n){this.baseContainer.has(e)?this.setLayout([this.baseContainer.get(e)],"visibility","visible"):(this.mapBox.addLayer(function(t,e,n){return{id:t,type:"line",source:{type:"geojson",data:{type:"FeatureCollection",features:[{type:"Feature",properties:{adcode:t,name:"阴影"},geometry:{type:"Polygon",coordinates:[e]}}]}},paint:n.shadow,metadata:{zIndex:n.zIndex}}}(e,t,n)),this.baseContainer.set(e,e))},addExtrusionImage(t,e){if(this.parameter.prominentUrl){let n=this;this.mapBox.loadImage(this.parameter.prominentUrl,(function(r,i){if(r)throw r;n.mapBox.hasImage("ground")?(n.mapBox.updateImage("ground",i),n.mapBox.removeLayer("img_"+e),n.mapBox.addLayer({id:"img_"+e,source:t,type:"fill-extrusion",paint:{"fill-extrusion-height":n.parameter.prominentHeight,"fill-extrusion-base":0,"fill-extrusion-opacity":1,"fill-extrusion-pattern":"ground"}})):(n.mapBox.addImage("ground",i),n.mapBox.addLayer({id:"img_"+e,source:t,type:"fill-extrusion",paint:{"fill-extrusion-height":n.parameter.prominentHeight,"fill-extrusion-base":0,"fill-extrusion-opacity":1,"fill-extrusion-pattern":"ground"}}))}))}},addBaseMaps(t){if(!t||(null==t?void 0:t.length)<1)return!1;t.forEach(((t,e)=>{if(t.mapPosition){let n=JSON.parse(t.mapPosition);if(this.addAreaMap(t,"base",n),0==e){let t={};switch(n.type){case"Feature":t=n.properties;break;case"FeatureCollection":t=n.features[0].properties}"base"==this.parameter.isProminent&&this.flyToMap(t)}}}))},addFarmMaps(t){if(!t||(null==t?void 0:t.length)<1)return!1;t.forEach(((t,e)=>{if(t.mapPosition){let e=JSON.parse(t.mapPosition);this.addAreaMap(t,"farm",e)}}))},addLineMaps(t){if(!t||(null==t?void 0:t.length)<1)return!1;t.forEach(((t,e)=>{if(t.geoJson){let e=JSON.parse(t.geoJson);this.addAreaMap(t,"line",e)}}))},addPointMaps(t){t.forEach(((t,e)=>{let n="PointMap_"+t.id;this.dotContainer.get(n)?U("visible",t.id):t.center&&(this.switchAddPoint(t),this.dotContainer.set(n,n))}))},switchAddPoint(e){let n="";switch(e.type){case"signage":n=function(t,e){var n=e.className?e.className:"aaaaaaaaaaaaa";return j({tag:"div",props:{class:"PointSignages PointMap PointMap_"+e.id+" "+n,on:{click:function(n){n.stopPropagation(),t&&t(e.id)}}},children:[{tag:"div",props:{class:"PointMapBox"},children:[{tag:"div",props:{class:"PointSignage PointSignage_"+e.id},children:e.title},{tag:"div",props:{class:"PointLine"},children:[]},{tag:"div",props:{class:"footerCircle"},children:[]}]}]})}((t=>{this.pointClick(t)}),e);break;case"icon":n=function(t,e){var n=e.className?e.className:"",r=G(e);return j({tag:"div",props:{class:"PointIcons PointMap PointMap_"+e.id+" "+n,on:{click:function(n){n.stopPropagation(),t&&t(e.id)}}},children:[].concat(T(r),[{tag:"div",props:{class:"PointMapBox"},children:[{tag:"img",props:{class:"PointIcon PointIcon_"+e.id,src:e.icon,title:e.title}},{tag:"div",props:{class:"PointLine"},children:[]},{tag:"div",props:{class:"footerCircle"},children:[]}]}])})}((t=>{this.pointClick(t)}),e);break;case"point":n=function(t,e){var n=e.className?e.className:"",r=G(e);return j({tag:"div",props:{class:"PointImgs PointMap PointMap_"+e.id+" "+n,on:{click:function(n){n.stopPropagation(),t&&t(e.id)}}},children:[].concat(T(r),[{tag:"img",props:{class:"PointImg PointImg_"+e.id,src:e.icon,title:e.title}}])})}((t=>{this.pointClick(t)}),e);break;case"svgIcon":n=function(t,e){var n=e.className?e.className:"",r=G(e),i=[],o={};return e.icon&&i.push({tag:"img",props:{class:"PointImg PointImg_"+e.id,src:e.icon,title:e.title}}),e.svg&&(i.push(e.svg.data),e.svg.color&&(o.color=e.svg.color),e.svg.size&&(o["font-size"]=e.svg.size)),j({tag:"div",props:{class:"PointSvgIcons PointMap PointMap_"+e.id+" "+n,on:{click:function(n){n.stopPropagation(),t&&t(e.id)}},style:o},children:[].concat(T(r),i)})}((t=>{this.pointClick(t)}),e)}n&&new t.Marker({element:n}).setLngLat(e.center).addTo(this.mapBox)},pointClick(t){this.$emit("point-click",t),this.onClickType="point"},showMapBase(t,e,n){this.showMapArea(t,e,"base",n)},showMapFarm(t,e,n){this.showMapArea(t,e,"farm",n)},showMapArea(t,e,n,r){if(n||(n="farm"),e){"string"!=typeof e&&"number"!=typeof e||(e=[e]);let i=[];e.forEach(((t,e)=>{if(r){let e=n+this.layerTypes[r]+t;this.mapBox.getLayer(e)&&i.push(e)}else for(let e in this.layerTypes){let r=this.layerTypes[e],o=n+r+t;this.mapBox.getLayer(o)&&i.push(o)}})),this.setLayout(i,"visibility",t)}else"farm"==n?this.setLayout([...this.farmContainer.values()],"visibility",t):"base"==n&&this.setLayout([...this.baseContainer.values()],"visibility",t)},showMapPoint(t,e){U(t,e)},deleteMapPoint(t){J(t)},updateMapPoint(t){J(t.id),this.switchAddPoint(t)},flyToMap(t){t.center&&"string"==typeof t.center&&(t.center=JSON.parse(t.center)),t.center&&(t.center.wgs84?this.mapBox.flyTo({center:[t.center.wgs84[0],t.center.wgs84[1]],zoom:t.center.zoom}):this.mapBox.flyTo({center:[t.center[0],t.center[1]],zoom:t.zoom}))},setLayout(t,e,n){for(let r of t)r&&this.mapBox.setLayoutProperty(r,e,n)},setAreaColor(t,e,n){for(let e of t){let t=["case"];t.push(n),this.mapBox.setPaintProperty(e,"fill-color",t)}},setZoom(t){switch(t){case"zoomIn":this.mapBox.zoomIn();break;case"zoomOut":this.mapBox.zoomOut();break;case"resize":this.mapBox.resize()}}}};var Y=function(){var t=this._self._c;return t("div",{staticClass:"z-map-views w100 h100 pr"},[t("div",{ref:"mapContainer",staticClass:"mapContainer w100 h100 pr",attrs:{id:this.id}})])},X=[];Y._withStripped=!0;var K=H(V,Y,X,!1,null,"fd5304cf",null,null);K.options.__file="D:\\项目\\测试\\test\\map-views\\components\\ZMap\\ZMap.vue";var W=K.exports;W.install=t=>{t.component(W.name,W)};export{W as ZMap};
@@ -0,0 +1,3 @@
1
+
2
+ 'use strict';
3
+ require('./style.css');
@@ -0,0 +1,2 @@
1
+ .w100{width:100%}.h100{height:100%}.mapContainer{height:100%;position:relative;width:100%}.PointMap{height:20px;left:0;position:absolute;top:0;white-space:nowrap;width:20px;z-index:5}.PointMap .PointImg,.PointMap .PointMapBox{bottom:50%;cursor:pointer;left:50%;position:absolute;-webkit-transform:translateX(-50%);transform:translateX(-50%)}.PointMap .PointMapBox{-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;z-index:11}.PointMap .PointMapBox,.PointMap .PointSignage{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center}.PointMap .PointSignage{-webkit-backdrop-filter:blur(15px);backdrop-filter:blur(15px);background:#60baff;border:2px solid #32a3fa;border-radius:4px;-webkit-box-shadow:inset 0 0 6px 0 #32a3fa;box-shadow:inset 0 0 6px 0 #32a3fa;color:#d8fbff;cursor:pointer;font-size:12px;height:37px;left:50%;min-width:95px;opacity:.8;padding:10px;position:absolute;top:-24px;-webkit-transform:translateX(-50%);transform:translateX(-50%);z-index:5}.PointMap .PointSignage:before{background:#faaa32;content:"";height:16px;left:0;position:absolute;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%);width:3px}.PointMap .PointIcon{border-radius:100%;cursor:pointer;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;height:24px;overflow:hidden;width:24px}.PointMap .PointInfo{background:#fff;border:1px solid #ddd;border-radius:8px;left:50%;max-width:160px;padding:10px;position:absolute;-webkit-transform:translateX(-50%);transform:translateX(-50%);-webkit-transition:all .5s;transition:all .5s;width:-webkit-max-content;width:-moz-max-content;width:max-content}.PointMap .PointInfo.hover,.PointMap .PointInfo.none{height:0;opacity:0;overflow:hidden;width:0}.PointMap .PointInfo:before{border:7px solid transparent;border-top-color:#fff;bottom:-14px;content:"";left:50%;position:absolute;-webkit-transform:translate(-50%);transform:translate(-50%);z-index:9}.PointMap .PointLine{background:-webkit-gradient(linear,left top,left bottom,from(#179aff),to(#18e0d2));background:linear-gradient(180deg,#179aff,#18e0d2);height:48px;pointer-events:none;width:2px}.PointMap .footerCircle{bottom:0;height:4px;left:50%;pointer-events:none;-webkit-transform:translateX(-50%);transform:translateX(-50%);width:10px}.PointMap .footerCircle,.PointMap .footerCircle:after{border:.6px solid #00e6ff;border-radius:50%;position:absolute}.PointMap .footerCircle:after{-webkit-animation:scaleAnima 1s linear infinite;animation:scaleAnima 1s linear infinite;-webkit-box-shadow:inset 1px 1px 5px #00e6ff;box-shadow:inset 1px 1px 5px #00e6ff;content:"";height:12px;left:calc(50% - 12px);top:calc(50% - 6px);-webkit-transform:scale(0);transform:scale(0);width:24px}.PointMap.PointImgs{height:32px;width:32px}.PointMap.PointImgs .PointInfo{bottom:calc(100% + 24px)}.PointMap.PointSvgIcons{color:#0b4a8a;font-size:40px;height:1em;width:1em}.PointMap.PointSvgIcons .PointInfo{bottom:calc(100% + 8px);color:#333;font-size:12px}.PointMap.PointSvgIcons img{left:50%;position:absolute;top:40%;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);width:.5em}.PointMap.PointIcons .PointInfo{bottom:calc(100% + 76px)}.PointMap.z-none{display:none}.PointMap:hover .hover{height:auto;opacity:1;overflow:visible;width:200px}@-webkit-keyframes scaleAnima{0%{-webkit-transform:scale(0);transform:scale(0)}to{-webkit-transform:scale(1);transform:scale(1)}}@keyframes scaleAnima{0%{-webkit-transform:scale(0);transform:scale(0)}to{-webkit-transform:scale(1);transform:scale(1)}}
2
+ .mapboxgl-control-container{display:none}
package/package.json ADDED
@@ -0,0 +1,54 @@
1
+ {
2
+ "name": "@zhuyukeji/z-map-vue2",
3
+ "private": false,
4
+ "version": "1.0.5",
5
+ "description": "这款GIS地图vue2可视化插件,专为交互式地图打造,轻松实现数据直观呈现。GIS地图可视化,把地理数据变成直观地图,挖掘数据背后的价值。",
6
+ "keywords": [
7
+ "mapbox",
8
+ "gis",
9
+ "mapbox-gl",
10
+ "地图可视化"
11
+ ],
12
+ "author": "重庆茱芋科技",
13
+ "license": "ISC",
14
+ "scripts": {
15
+ "dev": "vite --port 5173",
16
+ "build": "vue-tsc && vite build",
17
+ "lib": "npm run build:components"
18
+ },
19
+ "files": [
20
+ "lib",
21
+ "components",
22
+ "types",
23
+ "es",
24
+ "README.md",
25
+ "package.json",
26
+ "src/env.d.ts"
27
+ ],
28
+ "main": "./es/index.js",
29
+ "module": "./es/index.js",
30
+ "typings": "./types/index.d.ts",
31
+ "dependencies": {
32
+ "@turf/along": "^6.5.0",
33
+ "@turf/helpers": "^6.5.0",
34
+ "@turf/line-distance": "^4.7.3",
35
+ "@turf/union": "^6.5.0"
36
+ },
37
+ "devDependencies": {
38
+ "less": "^4.1.3",
39
+ "mapbox-gl": "^2.15.0",
40
+ "vite": "3.2.3",
41
+ "vite-plugin-antdv-fix": "^1.0.3",
42
+ "vite-plugin-compression": "^0.5.1",
43
+ "vue": "^2.7.14",
44
+ "vue-tsc": "^1.0.9"
45
+ },
46
+ "browserslist": [
47
+ "defaults",
48
+ "not ie <= 11",
49
+ "last 2 versions",
50
+ "> 1%",
51
+ "iOS 7",
52
+ "last 3 iOS versions"
53
+ ]
54
+ }
@@ -0,0 +1,5 @@
1
+ export class ZComponent {
2
+ static install(app: any): void
3
+ disabled: boolean
4
+ placeholder: string | string[]
5
+ }
@@ -0,0 +1,9 @@
1
+ import { ZComponent } from "./ZComponent";
2
+
3
+ declare class ZMap extends ZComponent {
4
+ value: string
5
+ type: 'like' | 'ne' | 'ge' | 'le'
6
+ trim: boolean
7
+ }
8
+
9
+ export default ZMap
@@ -0,0 +1,13 @@
1
+ import ZMap from "./ZMap";
2
+ import type Vue from 'vue'
3
+
4
+ export function install(vue: typeof Vue): void;
5
+
6
+ type ZMapViews = {
7
+ install,
8
+ }
9
+ export default ZMapViews
10
+
11
+ export {
12
+ ZMap
13
+ }