map-core-func 0.1.41 → 0.1.42
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.
|
@@ -155,4 +155,4 @@ MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
|
155
155
|
|
|
156
156
|
See the Apache Version 2.0 License for specific language governing permissions
|
|
157
157
|
and limitations under the License.
|
|
158
|
-
***************************************************************************** */function rI(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(o){return function(a){return function(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=s.trys,(i=i.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}}([o,a])}}}var iI=function(t,e){this.next=null,this.key=t,this.data=e,this.left=null,this.right=null};function oI(t,e){return t>e?1:t<e?-1:0}function sI(t,e,n){for(var r=new iI(null,null),i=r,o=r;;){var s=n(t,e.key);if(s<0){if(null===e.left)break;if(n(t,e.left.key)<0){var a=e.left;if(e.left=a.right,a.right=e,null===(e=a).left)break}o.left=e,o=e,e=e.left}else{if(!(s>0))break;if(null===e.right)break;if(n(t,e.right.key)>0){a=e.right;if(e.right=a.left,a.left=e,null===(e=a).right)break}i.right=e,i=e,e=e.right}}return i.right=e.left,o.left=e.right,e.left=r.right,e.right=r.left,e}function aI(t,e,n,r){var i=new iI(t,e);if(null===n)return i.left=i.right=null,i;var o=r(t,(n=sI(t,n,r)).key);return o<0?(i.left=n.left,i.right=n,n.left=null):o>=0&&(i.right=n.right,i.left=n,n.right=null),i}function uI(t,e,n){var r=null,i=null;if(e){var o=n((e=sI(t,e,n)).key,t);0===o?(r=e.left,i=e.right):o<0?(i=e.right,e.right=null,r=e):(r=e.left,e.left=null,i=e)}return{left:r,right:i}}function lI(t,e,n,r,i){if(t){r(e+(n?"└── ":"├── ")+i(t)+"\n");var o=e+(n?" ":"│ ");t.left&&lI(t.left,o,!1,r,i),t.right&&lI(t.right,o,!0,r,i)}}var cI=function(){function t(t){void 0===t&&(t=oI),this._root=null,this._size=0,this._comparator=t}return t.prototype.insert=function(t,e){return this._size++,this._root=aI(t,e,this._root,this._comparator)},t.prototype.add=function(t,e){var n=new iI(t,e);null===this._root&&(n.left=n.right=null,this._size++,this._root=n);var r=this._comparator,i=sI(t,this._root,r),o=r(t,i.key);return 0===o?this._root=i:(o<0?(n.left=i.left,n.right=i,i.left=null):o>0&&(n.right=i.right,n.left=i,i.right=null),this._size++,this._root=n),this._root},t.prototype.remove=function(t){this._root=this._remove(t,this._root,this._comparator)},t.prototype._remove=function(t,e,n){var r;return null===e?null:0===n(t,(e=sI(t,e,n)).key)?(null===e.left?r=e.right:(r=sI(t,e.left,n)).right=e.right,this._size--,r):e},t.prototype.pop=function(){var t=this._root;if(t){for(;t.left;)t=t.left;return this._root=sI(t.key,this._root,this._comparator),this._root=this._remove(t.key,this._root,this._comparator),{key:t.key,data:t.data}}return null},t.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},t.prototype.find=function(t){return this._root&&(this._root=sI(t,this._root,this._comparator),0!==this._comparator(t,this._root.key))?null:this._root},t.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},t.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},t.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},t.prototype.keys=function(){var t=[];return this.forEach((function(e){var n=e.key;return t.push(n)})),t},t.prototype.values=function(){var t=[];return this.forEach((function(e){var n=e.data;return t.push(n)})),t},t.prototype.min=function(){return this._root?this.minNode(this._root).key:null},t.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},t.prototype.minNode=function(t){if(void 0===t&&(t=this._root),t)for(;t.left;)t=t.left;return t},t.prototype.maxNode=function(t){if(void 0===t&&(t=this._root),t)for(;t.right;)t=t.right;return t},t.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},t.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},t.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},t.prototype.clear=function(){return this._root=null,this._size=0,this},t.prototype.toList=function(){return function(t){var e=t,n=[],r=!1,i=new iI(null,null),o=i;for(;!r;)e?(n.push(e),e=e.left):n.length>0?e=(e=o=o.next=n.pop()).right:r=!0;return o.next=null,i.next}(this._root)},t.prototype.load=function(t,e,n){void 0===e&&(e=[]),void 0===n&&(n=!1);var r=t.length,i=this._comparator;if(n&&pI(t,e,0,r-1,i),null===this._root)this._root=hI(t,e,0,r),this._size=r;else{var o=function(t,e,n){var r=new iI(null,null),i=r,o=t,s=e;for(;null!==o&&null!==s;)n(o.key,s.key)<0?(i.next=o,o=o.next):(i.next=s,s=s.next),i=i.next;null!==o?i.next=o:null!==s&&(i.next=s);return r.next}(this.toList(),function(t,e){for(var n=new iI(null,null),r=n,i=0;i<t.length;i++)r=r.next=new iI(t[i],e[i]);return r.next=null,n.next}(t,e),i);r=this._size+r,this._root=fI({head:o},0,r)}return this},t.prototype.isEmpty=function(){return null===this._root},Object.defineProperty(t.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),t.prototype.toString=function(t){void 0===t&&(t=function(t){return String(t.key)});var e=[];return lI(this._root,"",!0,(function(t){return e.push(t)}),t),e.join("")},t.prototype.update=function(t,e,n){var r=this._comparator,i=uI(t,this._root,r),o=i.left,s=i.right;r(t,e)<0?s=aI(e,n,s,r):o=aI(e,n,o,r),this._root=function(t,e,n){return null===e?t:(null===t||((e=sI(t.key,e,n)).left=t),e)}(o,s,r)},t.prototype.split=function(t){return uI(t,this._root,this._comparator)},t.prototype[Symbol.iterator]=function(){var t,e,n;return rI(this,(function(r){switch(r.label){case 0:t=this._root,e=[],n=!1,r.label=1;case 1:return n?[3,6]:null===t?[3,2]:(e.push(t),t=t.left,[3,5]);case 2:return 0===e.length?[3,4]:[4,t=e.pop()];case 3:return r.sent(),t=t.right,[3,5];case 4:n=!0,r.label=5;case 5:return[3,1];case 6:return[2]}}))},t}();function hI(t,e,n,r){var i=r-n;if(i>0){var o=n+Math.floor(i/2),s=t[o],a=e[o],u=new iI(s,a);return u.left=hI(t,e,n,o),u.right=hI(t,e,o+1,r),u}return null}function fI(t,e,n){var r=n-e;if(r>0){var i=e+Math.floor(r/2),o=fI(t,e,i),s=t.head;return s.left=o,t.head=t.head.next,s.right=fI(t,i+1,n),s}return null}function pI(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 u=t[s];t[s]=t[a],t[a]=u,u=e[s],e[s]=e[a],e[a]=u}pI(t,e,n,a,i),pI(t,e,a+1,r,i)}}function gI(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function AI(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function dI(t,e,n){return e&&AI(t.prototype,e),n&&AI(t,n),t}var yI=function(t,e){return t.ll.x<=e.x&&e.x<=t.ur.x&&t.ll.y<=e.y&&e.y<=t.ur.y},vI=function(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;var 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}}},mI=Number.EPSILON;void 0===mI&&(mI=Math.pow(2,-52));var _I=mI*mI,II=function(t,e){if(-mI<t&&t<mI&&-mI<e&&e<mI)return 0;var n=t-e;return n*n<_I*t*e?0:t<e?-1:1},EI=function(){function t(){gI(this,t),this.reset()}return dI(t,[{key:"reset",value:function(){this.xRounder=new xI,this.yRounder=new xI}},{key:"round",value:function(t,e){return{x:this.xRounder.round(t),y:this.yRounder.round(e)}}}]),t}(),xI=function(){function t(){gI(this,t),this.tree=new cI,this.round(0)}return dI(t,[{key:"round",value:function(t){var e=this.tree.add(t),n=this.tree.prev(e);if(null!==n&&0===II(e.key,n.key))return this.tree.remove(t),n.key;var r=this.tree.next(e);return null!==r&&0===II(e.key,r.key)?(this.tree.remove(t),r.key):t}}]),t}(),CI=new EI,wI=function(t,e){return t.x*e.y-t.y*e.x},bI=function(t,e){return t.x*e.x+t.y*e.y},BI=function(t,e,n){var r={x:e.x-t.x,y:e.y-t.y},i={x:n.x-t.x,y:n.y-t.y},o=wI(r,i);return II(o,0)},SI=function(t){return Math.sqrt(bI(t,t))},MI=function(t,e,n){var r={x:e.x-t.x,y:e.y-t.y},i={x:n.x-t.x,y:n.y-t.y};return bI(i,r)/SI(i)/SI(r)},LI=function(t,e,n){return 0===e.y?null:{x:t.x+e.x/e.y*(n-t.y),y:n}},NI=function(t,e,n){return 0===e.x?null:{x:n,y:t.y+e.y/e.x*(n-t.x)}},TI=function(){function t(e,n){gI(this,t),void 0===e.events?e.events=[this]:e.events.push(this),this.point=e,this.isLeft=n}return dI(t,null,[{key:"compare",value:function(e,n){var r=t.comparePoints(e.point,n.point);return 0!==r?r:(e.point!==n.point&&e.link(n),e.isLeft!==n.isLeft?e.isLeft?1:-1:QI.compare(e.segment,n.segment))}},{key:"comparePoints",value:function(t,e){return t.x<e.x?-1:t.x>e.x?1:t.y<e.y?-1:t.y>e.y?1:0}}]),dI(t,[{key:"link",value:function(t){if(t.point===this.point)throw new Error("Tried to link already linked events");for(var e=t.point.events,n=0,r=e.length;n<r;n++){var i=e[n];this.point.events.push(i),i.point=this.point}this.checkForConsuming()}},{key:"checkForConsuming",value:function(){for(var t=this.point.events.length,e=0;e<t;e++){var n=this.point.events[e];if(void 0===n.segment.consumedBy)for(var r=e+1;r<t;r++){var i=this.point.events[r];void 0===i.consumedBy&&(n.otherSE.point.events===i.otherSE.point.events&&n.segment.consume(i.segment))}}}},{key:"getAvailableLinkedEvents",value:function(){for(var t=[],e=0,n=this.point.events.length;e<n;e++){var r=this.point.events[e];r!==this&&!r.segment.ringOut&&r.segment.isInResult()&&t.push(r)}return t}},{key:"getLeftmostComparator",value:function(t){var e=this,n=new Map,r=function(r){var i,o,s,a,u,l=r.otherSE;n.set(r,{sine:(i=e.point,o=t.point,s=l.point,a={x:o.x-i.x,y:o.y-i.y},u={x:s.x-i.x,y:s.y-i.y},wI(u,a)/SI(u)/SI(a)),cosine:MI(e.point,t.point,l.point)})};return function(t,e){n.has(t)||r(t),n.has(e)||r(e);var i=n.get(t),o=i.sine,s=i.cosine,a=n.get(e),u=a.sine,l=a.cosine;return o>=0&&u>=0?s<l?1:s>l?-1:0:o<0&&u<0?s<l?-1:s>l?1:0:u<o?-1:u>o?1:0}}}]),t}(),RI=0,QI=function(){function t(e,n,r,i){gI(this,t),this.id=++RI,this.leftSE=e,e.segment=this,e.otherSE=n,this.rightSE=n,n.segment=this,n.otherSE=e,this.rings=r,this.windings=i}return dI(t,null,[{key:"compare",value:function(t,e){var 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;var s=t.leftSE.point.y,a=e.leftSE.point.y,u=t.rightSE.point.y,l=e.rightSE.point.y;if(n<r){if(a<s&&a<u)return 1;if(a>s&&a>u)return-1;var c=t.comparePoint(e.leftSE.point);if(c<0)return 1;if(c>0)return-1;var h=e.comparePoint(t.rightSE.point);return 0!==h?h:-1}if(n>r){if(s<a&&s<l)return-1;if(s>a&&s>l)return 1;var f=e.comparePoint(t.leftSE.point);if(0!==f)return f;var p=t.comparePoint(e.rightSE.point);return p<0?1:p>0?-1:1}if(s<a)return-1;if(s>a)return 1;if(i<o){var g=e.comparePoint(t.rightSE.point);if(0!==g)return g}if(i>o){var A=t.comparePoint(e.rightSE.point);if(A<0)return 1;if(A>0)return-1}if(i!==o){var d=u-s,y=i-n,v=l-a,m=o-r;if(d>y&&v<m)return 1;if(d<y&&v>m)return-1}return i>o?1:i<o||u<l?-1:u>l?1:t.id<e.id?-1:t.id>e.id?1:0}}]),dI(t,[{key:"replaceRightSE",value:function(t){this.rightSE=t,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}},{key:"bbox",value:function(){var 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}}}},{key:"vector",value:function(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}},{key:"isAnEndpoint",value:function(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}},{key:"comparePoint",value:function(t){if(this.isAnEndpoint(t))return 0;var 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;var i=(t.y-e.y)/r.y,o=e.x+i*r.x;if(t.x===o)return 0;var s=(t.x-e.x)/r.x,a=e.y+s*r.y;return t.y===a?0:t.y<a?-1:1}},{key:"getIntersection",value:function(t){var e=this.bbox(),n=t.bbox(),r=vI(e,n);if(null===r)return null;var i=this.leftSE.point,o=this.rightSE.point,s=t.leftSE.point,a=t.rightSE.point,u=yI(e,s)&&0===this.comparePoint(s),l=yI(n,i)&&0===t.comparePoint(i),c=yI(e,a)&&0===this.comparePoint(a),h=yI(n,o)&&0===t.comparePoint(o);if(l&&u)return h&&!c?o:!h&&c?a:null;if(l)return c&&i.x===a.x&&i.y===a.y?null:i;if(u)return h&&o.x===s.x&&o.y===s.y?null:s;if(h&&c)return null;if(h)return o;if(c)return a;var f=function(t,e,n,r){if(0===e.x)return NI(n,r,t.x);if(0===r.x)return NI(t,e,n.x);if(0===e.y)return LI(n,r,t.y);if(0===r.y)return LI(t,e,n.y);var i=wI(e,r);if(0==i)return null;var o={x:n.x-t.x,y:n.y-t.y},s=wI(o,e)/i,a=wI(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}}(i,this.vector(),s,t.vector());return null===f?null:yI(r,f)?CI.round(f.x,f.y):null}},{key:"split",value:function(e){var n=[],r=void 0!==e.events,i=new TI(e,!0),o=new TI(e,!1),s=this.rightSE;this.replaceRightSE(o),n.push(o),n.push(i);var a=new t(i,s,this.rings.slice(),this.windings.slice());return TI.comparePoints(a.leftSE.point,a.rightSE.point)>0&&a.swapEvents(),TI.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),r&&(i.checkForConsuming(),o.checkForConsuming()),n}},{key:"swapEvents",value:function(){var t=this.rightSE;this.rightSE=this.leftSE,this.leftSE=t,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(var e=0,n=this.windings.length;e<n;e++)this.windings[e]*=-1}},{key:"consume",value:function(e){for(var n=this,r=e;n.consumedBy;)n=n.consumedBy;for(;r.consumedBy;)r=r.consumedBy;var i=t.compare(n,r);if(0!==i){if(i>0){var o=n;n=r,r=o}if(n.prev===r){var s=n;n=r,r=s}for(var a=0,u=r.rings.length;a<u;a++){var l=r.rings[a],c=r.windings[a],h=n.rings.indexOf(l);-1===h?(n.rings.push(l),n.windings.push(c)):n.windings[h]+=c}r.rings=null,r.windings=null,r.consumedBy=n,r.leftSE.consumedBy=n.leftSE,r.rightSE.consumedBy=n.rightSE}}},{key:"prevInResult",value:function(){return void 0!==this._prevInResult||(this.prev?this.prev.isInResult()?this._prevInResult=this.prev:this._prevInResult=this.prev.prevInResult():this._prevInResult=null),this._prevInResult}},{key:"beforeState",value:function(){if(void 0!==this._beforeState)return this._beforeState;if(this.prev){var t=this.prev.consumedBy||this.prev;this._beforeState=t.afterState()}else this._beforeState={rings:[],windings:[],multiPolys:[]};return this._beforeState}},{key:"afterState",value:function(){if(void 0!==this._afterState)return this._afterState;var t=this.beforeState();this._afterState={rings:t.rings.slice(0),windings:t.windings.slice(0),multiPolys:[]};for(var e=this._afterState.rings,n=this._afterState.windings,r=this._afterState.multiPolys,i=0,o=this.rings.length;i<o;i++){var s=this.rings[i],a=this.windings[i],u=e.indexOf(s);-1===u?(e.push(s),n.push(a)):n[u]+=a}for(var l=[],c=[],h=0,f=e.length;h<f;h++)if(0!==n[h]){var p=e[h],g=p.poly;if(-1===c.indexOf(g))if(p.isExterior)l.push(g);else{-1===c.indexOf(g)&&c.push(g);var A=l.indexOf(p.poly);-1!==A&&l.splice(A,1)}}for(var d=0,y=l.length;d<y;d++){var v=l[d].multiPoly;-1===r.indexOf(v)&&r.push(v)}return this._afterState}},{key:"isInResult",value:function(){if(this.consumedBy)return!1;if(void 0!==this._isInResult)return this._isInResult;var t=this.beforeState().multiPolys,e=this.afterState().multiPolys;switch(VI.type){case"union":var n=0===t.length,r=0===e.length;this._isInResult=n!==r;break;case"intersection":var i,o;t.length<e.length?(i=t.length,o=e.length):(i=e.length,o=t.length),this._isInResult=o===VI.numMultiPolys&&i<o;break;case"xor":var s=Math.abs(t.length-e.length);this._isInResult=s%2==1;break;case"difference":var a=function(t){return 1===t.length&&t[0].isSubject};this._isInResult=a(t)!==a(e);break;default:throw new Error("Unrecognized operation type found ".concat(VI.type))}return this._isInResult}}],[{key:"fromRing",value:function(e,n,r){var i,o,s,a=TI.comparePoints(e,n);if(a<0)i=e,o=n,s=1;else{if(!(a>0))throw new Error("Tried to create degenerate segment at [".concat(e.x,", ").concat(e.y,"]"));i=n,o=e,s=-1}return new t(new TI(i,!0),new TI(o,!1),[r],[s])}}]),t}(),DI=function(){function t(e,n,r){if(gI(this,t),!Array.isArray(e)||0===e.length)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=n,this.isExterior=r,this.segments=[],"number"!=typeof e[0][0]||"number"!=typeof e[0][1])throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var i=CI.round(e[0][0],e[0][1]);this.bbox={ll:{x:i.x,y:i.y},ur:{x:i.x,y:i.y}};for(var o=i,s=1,a=e.length;s<a;s++){if("number"!=typeof e[s][0]||"number"!=typeof e[s][1])throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var u=CI.round(e[s][0],e[s][1]);u.x===o.x&&u.y===o.y||(this.segments.push(QI.fromRing(o,u,this)),u.x<this.bbox.ll.x&&(this.bbox.ll.x=u.x),u.y<this.bbox.ll.y&&(this.bbox.ll.y=u.y),u.x>this.bbox.ur.x&&(this.bbox.ur.x=u.x),u.y>this.bbox.ur.y&&(this.bbox.ur.y=u.y),o=u)}i.x===o.x&&i.y===o.y||this.segments.push(QI.fromRing(o,i,this))}return dI(t,[{key:"getSweepEvents",value:function(){for(var t=[],e=0,n=this.segments.length;e<n;e++){var r=this.segments[e];t.push(r.leftSE),t.push(r.rightSE)}return t}}]),t}(),PI=function(){function t(e,n){if(gI(this,t),!Array.isArray(e))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new DI(e[0],this,!0),this.bbox={ll:{x:this.exteriorRing.bbox.ll.x,y:this.exteriorRing.bbox.ll.y},ur:{x:this.exteriorRing.bbox.ur.x,y:this.exteriorRing.bbox.ur.y}},this.interiorRings=[];for(var r=1,i=e.length;r<i;r++){var o=new DI(e[r],this,!1);o.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=o.bbox.ll.x),o.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=o.bbox.ll.y),o.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=o.bbox.ur.x),o.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=o.bbox.ur.y),this.interiorRings.push(o)}this.multiPoly=n}return dI(t,[{key:"getSweepEvents",value:function(){for(var t=this.exteriorRing.getSweepEvents(),e=0,n=this.interiorRings.length;e<n;e++)for(var r=this.interiorRings[e].getSweepEvents(),i=0,o=r.length;i<o;i++)t.push(r[i]);return t}}]),t}(),kI=function(){function t(e,n){if(gI(this,t),!Array.isArray(e))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{"number"==typeof e[0][0][0]&&(e=[e])}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(var r=0,i=e.length;r<i;r++){var o=new PI(e[r],this);o.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=o.bbox.ll.x),o.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=o.bbox.ll.y),o.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=o.bbox.ur.x),o.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=o.bbox.ur.y),this.polys.push(o)}this.isSubject=n}return dI(t,[{key:"getSweepEvents",value:function(){for(var t=[],e=0,n=this.polys.length;e<n;e++)for(var r=this.polys[e].getSweepEvents(),i=0,o=r.length;i<o;i++)t.push(r[i]);return t}}]),t}(),OI=function(){function t(e){gI(this,t),this.events=e;for(var n=0,r=e.length;n<r;n++)e[n].segment.ringOut=this;this.poly=null}return dI(t,null,[{key:"factory",value:function(e){for(var n=[],r=0,i=e.length;r<i;r++){var o=e[r];if(o.isInResult()&&!o.ringOut){for(var s=null,a=o.leftSE,u=o.rightSE,l=[a],c=a.point,h=[];s=a,a=u,l.push(a),a.point!==c;)for(;;){var f=a.getAvailableLinkedEvents();if(0===f.length){var p=l[0].point,g=l[l.length-1].point;throw new Error("Unable to complete output ring starting at [".concat(p.x,",")+" ".concat(p.y,"]. Last matching segment found ends at")+" [".concat(g.x,", ").concat(g.y,"]."))}if(1===f.length){u=f[0].otherSE;break}for(var A=null,d=0,y=h.length;d<y;d++)if(h[d].point===a.point){A=d;break}if(null===A){h.push({index:l.length,point:a.point});var v=a.getLeftmostComparator(s);u=f.sort(v)[0].otherSE;break}var m=h.splice(A)[0],_=l.splice(m.index);_.unshift(_[0].otherSE),n.push(new t(_.reverse()))}n.push(new t(l))}}return n}}]),dI(t,[{key:"getGeom",value:function(){for(var t=this.events[0].point,e=[t],n=1,r=this.events.length-1;n<r;n++){var i=this.events[n].point,o=this.events[n+1].point;0!==BI(i,t,o)&&(e.push(i),t=i)}if(1===e.length)return null;var s=e[0],a=e[1];0===BI(s,t,a)&&e.shift(),e.push(e[0]);for(var u=this.isExteriorRing()?1:-1,l=this.isExteriorRing()?0:e.length-1,c=this.isExteriorRing()?e.length:-1,h=[],f=l;f!=c;f+=u)h.push([e[f].x,e[f].y]);return h}},{key:"isExteriorRing",value:function(){if(void 0===this._isExteriorRing){var t=this.enclosingRing();this._isExteriorRing=!t||!t.isExteriorRing()}return this._isExteriorRing}},{key:"enclosingRing",value:function(){return void 0===this._enclosingRing&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}},{key:"_calcEnclosingRing",value:function(){for(var t=this.events[0],e=1,n=this.events.length;e<n;e++){var r=this.events[e];TI.compare(t,r)>0&&(t=r)}for(var i=t.segment.prevInResult(),o=i?i.prevInResult():null;;){if(!i)return null;if(!o)return i.ringOut;if(o.ringOut!==i.ringOut)return o.ringOut.enclosingRing()!==i.ringOut?i.ringOut:i.ringOut.enclosingRing();i=o.prevInResult(),o=i?i.prevInResult():null}}}]),t}(),FI=function(){function t(e){gI(this,t),this.exteriorRing=e,e.poly=this,this.interiorRings=[]}return dI(t,[{key:"addInterior",value:function(t){this.interiorRings.push(t),t.poly=this}},{key:"getGeom",value:function(){var t=[this.exteriorRing.getGeom()];if(null===t[0])return null;for(var e=0,n=this.interiorRings.length;e<n;e++){var r=this.interiorRings[e].getGeom();null!==r&&t.push(r)}return t}}]),t}(),GI=function(){function t(e){gI(this,t),this.rings=e,this.polys=this._composePolys(e)}return dI(t,[{key:"getGeom",value:function(){for(var t=[],e=0,n=this.polys.length;e<n;e++){var r=this.polys[e].getGeom();null!==r&&t.push(r)}return t}},{key:"_composePolys",value:function(t){for(var e=[],n=0,r=t.length;n<r;n++){var i=t[n];if(!i.poly)if(i.isExteriorRing())e.push(new FI(i));else{var o=i.enclosingRing();o.poly||e.push(new FI(o)),o.poly.addInterior(i)}}return e}}]),t}(),UI=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:QI.compare;gI(this,t),this.queue=e,this.tree=new cI(n),this.segments=[]}return dI(t,[{key:"process",value:function(t){var e=t.segment,n=[];if(t.consumedBy)return t.isLeft?this.queue.remove(t.otherSE):this.tree.remove(e),n;var r=t.isLeft?this.tree.insert(e):this.tree.find(e);if(!r)throw new Error("Unable to find segment #".concat(e.id," ")+"[".concat(e.leftSE.point.x,", ").concat(e.leftSE.point.y,"] -> ")+"[".concat(e.rightSE.point.x,", ").concat(e.rightSE.point.y,"] ")+"in SweepLine tree. Please submit a bug report.");for(var i=r,o=r,s=void 0,a=void 0;void 0===s;)null===(i=this.tree.prev(i))?s=null:void 0===i.key.consumedBy&&(s=i.key);for(;void 0===a;)null===(o=this.tree.next(o))?a=null:void 0===o.key.consumedBy&&(a=o.key);if(t.isLeft){var u=null;if(s){var l=s.getIntersection(e);if(null!==l&&(e.isAnEndpoint(l)||(u=l),!s.isAnEndpoint(l)))for(var c=this._splitSafely(s,l),h=0,f=c.length;h<f;h++)n.push(c[h])}var p=null;if(a){var g=a.getIntersection(e);if(null!==g&&(e.isAnEndpoint(g)||(p=g),!a.isAnEndpoint(g)))for(var A=this._splitSafely(a,g),d=0,y=A.length;d<y;d++)n.push(A[d])}if(null!==u||null!==p){var v=null;if(null===u)v=p;else if(null===p)v=u;else{v=TI.comparePoints(u,p)<=0?u:p}this.queue.remove(e.rightSE),n.push(e.rightSE);for(var m=e.split(v),_=0,I=m.length;_<I;_++)n.push(m[_])}n.length>0?(this.tree.remove(e),n.push(t)):(this.segments.push(e),e.prev=s)}else{if(s&&a){var E=s.getIntersection(a);if(null!==E){if(!s.isAnEndpoint(E))for(var x=this._splitSafely(s,E),C=0,w=x.length;C<w;C++)n.push(x[C]);if(!a.isAnEndpoint(E))for(var b=this._splitSafely(a,E),B=0,S=b.length;B<S;B++)n.push(b[B])}}this.tree.remove(e)}return n}},{key:"_splitSafely",value:function(t,e){this.tree.remove(t);var n=t.rightSE;this.queue.remove(n);var r=t.split(e);return r.push(n),void 0===t.consumedBy&&this.tree.insert(t),r}}]),t}(),qI="undefined"!=typeof process&&process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,jI="undefined"!=typeof process&&process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6,zI=function(){function t(){gI(this,t)}return dI(t,[{key:"run",value:function(t,e,n){VI.type=t,CI.reset();for(var r=[new kI(e,!0)],i=0,o=n.length;i<o;i++)r.push(new kI(n[i],!1));if(VI.numMultiPolys=r.length,"difference"===VI.type)for(var s=r[0],a=1;a<r.length;)null!==vI(r[a].bbox,s.bbox)?a++:r.splice(a,1);if("intersection"===VI.type)for(var u=0,l=r.length;u<l;u++)for(var c=r[u],h=u+1,f=r.length;h<f;h++)if(null===vI(c.bbox,r[h].bbox))return[];for(var p=new cI(TI.compare),g=0,A=r.length;g<A;g++)for(var d=r[g].getSweepEvents(),y=0,v=d.length;y<v;y++)if(p.insert(d[y]),p.size>qI)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big). Please file a bug report.");for(var m=new UI(p),_=p.size,I=p.pop();I;){var E=I.key;if(p.size===_){var x=E.segment;throw new Error("Unable to pop() ".concat(E.isLeft?"left":"right"," SweepEvent ")+"[".concat(E.point.x,", ").concat(E.point.y,"] from segment #").concat(x.id," ")+"[".concat(x.leftSE.point.x,", ").concat(x.leftSE.point.y,"] -> ")+"[".concat(x.rightSE.point.x,", ").concat(x.rightSE.point.y,"] from queue. ")+"Please file a bug report.")}if(p.size>qI)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big). Please file a bug report.");if(m.segments.length>jI)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");for(var C=m.process(E),w=0,b=C.length;w<b;w++){var B=C[w];void 0===B.consumedBy&&p.insert(B)}_=p.size,I=p.pop()}CI.reset();var S=OI.factory(m.segments);return new GI(S).getGeom()}}]),t}(),VI=new zI,YI={union: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 VI.run("union",t,n)},intersection: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 VI.run("intersection",t,n)},xor: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 VI.run("xor",t,n)},difference: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 VI.run("difference",t,n)}};"fill"in Array.prototype||Object.defineProperty(Array.prototype,"fill",{configurable:!0,value:function(t){if(null==this)throw new TypeError(this+" is not an object");var e=Object(this),n=Math.max(Math.min(e.length,9007199254740991),0)||0,r=1 in arguments&&parseInt(Number(arguments[1]),10)||0;r=r<0?Math.max(n+r,0):Math.min(r,n);var i=2 in arguments&&void 0!==arguments[2]?parseInt(Number(arguments[2]),10)||0:n;for(i=i<0?Math.max(n+arguments[2],0):Math.min(i,n);r<i;)e[r]=t,++r;return e},writable:!0}),Number.isFinite=Number.isFinite||function(t){return"number"==typeof t&&isFinite(t)},Number.isInteger=Number.isInteger||function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t},Number.parseFloat=Number.parseFloat||parseFloat,Number.isNaN=Number.isNaN||function(t){return t!=t},Math.trunc=Math.trunc||function(t){return t<0?Math.ceil(t):Math.floor(t)};var HI=function(){};HI.prototype.interfaces_=function(){return[]},HI.prototype.getClass=function(){return HI},HI.prototype.equalsWithTolerance=function(t,e,n){return Math.abs(t-e)<=n};var XI=function(t){function e(e){t.call(this,e),this.name="IllegalArgumentException",this.message=e,this.stack=(new t).stack}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Error),JI=function(){},WI={MAX_VALUE:{configurable:!0}};JI.isNaN=function(t){return Number.isNaN(t)},JI.doubleToLongBits=function(t){return t},JI.longBitsToDouble=function(t){return t},JI.isInfinite=function(t){return!Number.isFinite(t)},WI.MAX_VALUE.get=function(){return Number.MAX_VALUE},Object.defineProperties(JI,WI);var KI=function(){},ZI=function(){},$I=function(){};function tE(){}var eE=function t(){if(this.x=null,this.y=null,this.z=null,0===arguments.length)this.x=0,this.y=0,this.z=t.NULL_ORDINATE;else if(1===arguments.length){var e=arguments[0];this.x=e.x,this.y=e.y,this.z=e.z}else 2===arguments.length?(this.x=arguments[0],this.y=arguments[1],this.z=t.NULL_ORDINATE):3===arguments.length&&(this.x=arguments[0],this.y=arguments[1],this.z=arguments[2])},nE={DimensionalComparator:{configurable:!0},serialVersionUID:{configurable:!0},NULL_ORDINATE:{configurable:!0},X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0}};eE.prototype.setOrdinate=function(t,e){switch(t){case eE.X:this.x=e;break;case eE.Y:this.y=e;break;case eE.Z:this.z=e;break;default:throw new XI("Invalid ordinate index: "+t)}},eE.prototype.equals2D=function(){if(1===arguments.length){var t=arguments[0];return this.x===t.x&&this.y===t.y}if(2===arguments.length){var e=arguments[0],n=arguments[1];return!!HI.equalsWithTolerance(this.x,e.x,n)&&!!HI.equalsWithTolerance(this.y,e.y,n)}},eE.prototype.getOrdinate=function(t){switch(t){case eE.X:return this.x;case eE.Y:return this.y;case eE.Z:return this.z}throw new XI("Invalid ordinate index: "+t)},eE.prototype.equals3D=function(t){return this.x===t.x&&this.y===t.y&&(this.z===t.z||JI.isNaN(this.z))&&JI.isNaN(t.z)},eE.prototype.equals=function(t){return t instanceof eE&&this.equals2D(t)},eE.prototype.equalInZ=function(t,e){return HI.equalsWithTolerance(this.z,t.z,e)},eE.prototype.compareTo=function(t){var e=t;return this.x<e.x?-1:this.x>e.x?1:this.y<e.y?-1:this.y>e.y?1:0},eE.prototype.clone=function(){},eE.prototype.copy=function(){return new eE(this)},eE.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},eE.prototype.distance3D=function(t){var e=this.x-t.x,n=this.y-t.y,r=this.z-t.z;return Math.sqrt(e*e+n*n+r*r)},eE.prototype.distance=function(t){var e=this.x-t.x,n=this.y-t.y;return Math.sqrt(e*e+n*n)},eE.prototype.hashCode=function(){var t=17;return t=37*(t=37*t+eE.hashCode(this.x))+eE.hashCode(this.y)},eE.prototype.setCoordinate=function(t){this.x=t.x,this.y=t.y,this.z=t.z},eE.prototype.interfaces_=function(){return[KI,ZI,tE]},eE.prototype.getClass=function(){return eE},eE.hashCode=function(){if(1===arguments.length){var t=JI.doubleToLongBits(arguments[0]);return Math.trunc((t^t)>>>32)}},nE.DimensionalComparator.get=function(){return rE},nE.serialVersionUID.get=function(){return 0x5cbf2c235c7e5800},nE.NULL_ORDINATE.get=function(){return JI.NaN},nE.X.get=function(){return 0},nE.Y.get=function(){return 1},nE.Z.get=function(){return 2},Object.defineProperties(eE,nE);var rE=function(t){if(this._dimensionsToTest=2,0===arguments.length);else if(1===arguments.length){var e=arguments[0];if(2!==e&&3!==e)throw new XI("only 2 or 3 dimensions may be specified");this._dimensionsToTest=e}};rE.prototype.compare=function(t,e){var n=t,r=e,i=rE.compare(n.x,r.x);if(0!==i)return i;var o=rE.compare(n.y,r.y);return 0!==o?o:this._dimensionsToTest<=2?0:rE.compare(n.z,r.z)},rE.prototype.interfaces_=function(){return[$I]},rE.prototype.getClass=function(){return rE},rE.compare=function(t,e){return t<e?-1:t>e?1:JI.isNaN(t)?JI.isNaN(e)?0:-1:JI.isNaN(e)?1:0};var iE=function(){};iE.prototype.create=function(){},iE.prototype.interfaces_=function(){return[]},iE.prototype.getClass=function(){return iE};var oE=function(){},sE={INTERIOR:{configurable:!0},BOUNDARY:{configurable:!0},EXTERIOR:{configurable:!0},NONE:{configurable:!0}};oE.prototype.interfaces_=function(){return[]},oE.prototype.getClass=function(){return oE},oE.toLocationSymbol=function(t){switch(t){case oE.EXTERIOR:return"e";case oE.BOUNDARY:return"b";case oE.INTERIOR:return"i";case oE.NONE:return"-"}throw new XI("Unknown location value: "+t)},sE.INTERIOR.get=function(){return 0},sE.BOUNDARY.get=function(){return 1},sE.EXTERIOR.get=function(){return 2},sE.NONE.get=function(){return-1},Object.defineProperties(oE,sE);var aE=function(t,e){return t.interfaces_&&t.interfaces_().indexOf(e)>-1},uE=function(){},lE={LOG_10:{configurable:!0}};uE.prototype.interfaces_=function(){return[]},uE.prototype.getClass=function(){return uE},uE.log10=function(t){var e=Math.log(t);return JI.isInfinite(e)||JI.isNaN(e)?e:e/uE.LOG_10},uE.min=function(t,e,n,r){var i=t;return e<i&&(i=e),n<i&&(i=n),r<i&&(i=r),i},uE.clamp=function(){if("number"==typeof arguments[2]&&"number"==typeof arguments[0]&&"number"==typeof arguments[1]){var t=arguments[0],e=arguments[1],n=arguments[2];return t<e?e:t>n?n:t}if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var r=arguments[0],i=arguments[1],o=arguments[2];return r<i?i:r>o?o:r}},uE.wrap=function(t,e){return t<0?e- -t%e:t%e},uE.max=function(){if(3===arguments.length){var t=arguments[1],e=arguments[2],n=arguments[0];return t>n&&(n=t),e>n&&(n=e),n}if(4===arguments.length){var r=arguments[1],i=arguments[2],o=arguments[3],s=arguments[0];return r>s&&(s=r),i>s&&(s=i),o>s&&(s=o),s}},uE.average=function(t,e){return(t+e)/2},lE.LOG_10.get=function(){return Math.log(10)},Object.defineProperties(uE,lE);var cE=function(t){this.str=t};cE.prototype.append=function(t){this.str+=t},cE.prototype.setCharAt=function(t,e){this.str=this.str.substr(0,t)+e+this.str.substr(t+1)},cE.prototype.toString=function(t){return this.str};var hE=function(t){this.value=t};hE.prototype.intValue=function(){return this.value},hE.prototype.compareTo=function(t){return this.value<t?-1:this.value>t?1:0},hE.isNaN=function(t){return Number.isNaN(t)};var fE=function(){};fE.isWhitespace=function(t){return t<=32&&t>=0||127===t},fE.toUpperCase=function(t){return t.toUpperCase()};var pE=function t(){if(this._hi=0,this._lo=0,0===arguments.length)this.init(0);else if(1===arguments.length){if("number"==typeof arguments[0]){var e=arguments[0];this.init(e)}else if(arguments[0]instanceof t){var n=arguments[0];this.init(n)}else if("string"==typeof arguments[0]){t.call(this,t.parse(arguments[0]))}}else if(2===arguments.length){var r=arguments[0],i=arguments[1];this.init(r,i)}},gE={PI:{configurable:!0},TWO_PI:{configurable:!0},PI_2:{configurable:!0},E:{configurable:!0},NaN:{configurable:!0},EPS:{configurable:!0},SPLIT:{configurable:!0},MAX_PRINT_DIGITS:{configurable:!0},TEN:{configurable:!0},ONE:{configurable:!0},SCI_NOT_EXPONENT_CHAR:{configurable:!0},SCI_NOT_ZERO:{configurable:!0}};pE.prototype.le=function(t){return(this._hi<t._hi||this._hi===t._hi)&&this._lo<=t._lo},pE.prototype.extractSignificantDigits=function(t,e){var n=this.abs(),r=pE.magnitude(n._hi),i=pE.TEN.pow(r);(n=n.divide(i)).gt(pE.TEN)?(n=n.divide(pE.TEN),r+=1):n.lt(pE.ONE)&&(n=n.multiply(pE.TEN),r-=1);for(var o=r+1,s=new cE,a=pE.MAX_PRINT_DIGITS-1,u=0;u<=a;u++){t&&u===o&&s.append(".");var l=Math.trunc(n._hi);if(l<0)break;var c=!1,h=0;l>9?(c=!0,h="9"):h="0"+l,s.append(h),n=n.subtract(pE.valueOf(l)).multiply(pE.TEN),c&&n.selfAdd(pE.TEN);var f=!0,p=pE.magnitude(n._hi);if(p<0&&Math.abs(p)>=a-u&&(f=!1),!f)break}return e[0]=r,s.toString()},pE.prototype.sqr=function(){return this.multiply(this)},pE.prototype.doubleValue=function(){return this._hi+this._lo},pE.prototype.subtract=function(){if(arguments[0]instanceof pE){var t=arguments[0];return this.add(t.negate())}if("number"==typeof arguments[0]){var e=arguments[0];return this.add(-e)}},pE.prototype.equals=function(){if(1===arguments.length){var t=arguments[0];return this._hi===t._hi&&this._lo===t._lo}},pE.prototype.isZero=function(){return 0===this._hi&&0===this._lo},pE.prototype.selfSubtract=function(){if(arguments[0]instanceof pE){var t=arguments[0];return this.isNaN()?this:this.selfAdd(-t._hi,-t._lo)}if("number"==typeof arguments[0]){var e=arguments[0];return this.isNaN()?this:this.selfAdd(-e,0)}},pE.prototype.getSpecialNumberString=function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null},pE.prototype.min=function(t){return this.le(t)?this:t},pE.prototype.selfDivide=function(){if(1===arguments.length){if(arguments[0]instanceof pE){var t=arguments[0];return this.selfDivide(t._hi,t._lo)}if("number"==typeof arguments[0]){var e=arguments[0];return this.selfDivide(e,0)}}else if(2===arguments.length){var n,r,i,o,s=arguments[0],a=arguments[1],u=null,l=null,c=null,h=null;return i=this._hi/s,h=(u=(c=pE.SPLIT*i)-(u=c-i))*(l=(h=pE.SPLIT*s)-(l=h-s))-(o=i*s)+u*(r=s-l)+(n=i-u)*l+n*r,h=i+(c=(this._hi-o-h+this._lo-i*a)/s),this._hi=h,this._lo=i-h+c,this}},pE.prototype.dump=function(){return"DD<"+this._hi+", "+this._lo+">"},pE.prototype.divide=function(){if(arguments[0]instanceof pE){var t,e,n,r,i=arguments[0],o=null,s=null,a=null,u=null;return t=(n=this._hi/i._hi)-(o=(a=pE.SPLIT*n)-(o=a-n)),u=o*(s=(u=pE.SPLIT*i._hi)-(s=u-i._hi))-(r=n*i._hi)+o*(e=i._hi-s)+t*s+t*e,a=(this._hi-r-u+this._lo-n*i._lo)/i._hi,new pE(u=n+a,n-u+a)}if("number"==typeof arguments[0]){var l=arguments[0];return JI.isNaN(l)?pE.createNaN():pE.copy(this).selfDivide(l,0)}},pE.prototype.ge=function(t){return(this._hi>t._hi||this._hi===t._hi)&&this._lo>=t._lo},pE.prototype.pow=function(t){if(0===t)return pE.valueOf(1);var e=new pE(this),n=pE.valueOf(1),r=Math.abs(t);if(r>1)for(;r>0;)r%2==1&&n.selfMultiply(e),(r/=2)>0&&(e=e.sqr());else n=e;return t<0?n.reciprocal():n},pE.prototype.ceil=function(){if(this.isNaN())return pE.NaN;var t=Math.ceil(this._hi),e=0;return t===this._hi&&(e=Math.ceil(this._lo)),new pE(t,e)},pE.prototype.compareTo=function(t){var e=t;return this._hi<e._hi?-1:this._hi>e._hi?1:this._lo<e._lo?-1:this._lo>e._lo?1:0},pE.prototype.rint=function(){return this.isNaN()?this:this.add(.5).floor()},pE.prototype.setValue=function(){if(arguments[0]instanceof pE){var t=arguments[0];return this.init(t),this}if("number"==typeof arguments[0]){var e=arguments[0];return this.init(e),this}},pE.prototype.max=function(t){return this.ge(t)?this:t},pE.prototype.sqrt=function(){if(this.isZero())return pE.valueOf(0);if(this.isNegative())return pE.NaN;var t=1/Math.sqrt(this._hi),e=this._hi*t,n=pE.valueOf(e),r=this.subtract(n.sqr())._hi*(.5*t);return n.add(r)},pE.prototype.selfAdd=function(){if(1===arguments.length){if(arguments[0]instanceof pE){var t=arguments[0];return this.selfAdd(t._hi,t._lo)}if("number"==typeof arguments[0]){var e,n,r,i,o,s=arguments[0],a=null;return a=(r=this._hi+s)-(i=r-this._hi),n=(o=(a=s-i+(this._hi-a))+this._lo)+(r-(e=r+o)),this._hi=e+n,this._lo=n+(e-this._hi),this}}else if(2===arguments.length){var u,l,c,h,f=arguments[0],p=arguments[1],g=null,A=null,d=null;c=this._hi+f,l=this._lo+p,A=c-(d=c-this._hi),g=l-(h=l-this._lo);var y=(u=c+(d=(A=f-d+(this._hi-A))+l))+(d=(g=p-h+(this._lo-g))+(d+(c-u))),v=d+(u-y);return this._hi=y,this._lo=v,this}},pE.prototype.selfMultiply=function(){if(1===arguments.length){if(arguments[0]instanceof pE){var t=arguments[0];return this.selfMultiply(t._hi,t._lo)}if("number"==typeof arguments[0]){var e=arguments[0];return this.selfMultiply(e,0)}}else if(2===arguments.length){var n,r,i=arguments[0],o=arguments[1],s=null,a=null,u=null,l=null;s=(u=pE.SPLIT*this._hi)-this._hi,l=pE.SPLIT*i,s=u-s,n=this._hi-s,a=l-i;var c=(u=this._hi*i)+(l=s*(a=l-a)-u+s*(r=i-a)+n*a+n*r+(this._hi*o+this._lo*i)),h=l+(s=u-c);return this._hi=c,this._lo=h,this}},pE.prototype.selfSqr=function(){return this.selfMultiply(this)},pE.prototype.floor=function(){if(this.isNaN())return pE.NaN;var t=Math.floor(this._hi),e=0;return t===this._hi&&(e=Math.floor(this._lo)),new pE(t,e)},pE.prototype.negate=function(){return this.isNaN()?this:new pE(-this._hi,-this._lo)},pE.prototype.clone=function(){},pE.prototype.multiply=function(){if(arguments[0]instanceof pE){var t=arguments[0];return t.isNaN()?pE.createNaN():pE.copy(this).selfMultiply(t)}if("number"==typeof arguments[0]){var e=arguments[0];return JI.isNaN(e)?pE.createNaN():pE.copy(this).selfMultiply(e,0)}},pE.prototype.isNaN=function(){return JI.isNaN(this._hi)},pE.prototype.intValue=function(){return Math.trunc(this._hi)},pE.prototype.toString=function(){var t=pE.magnitude(this._hi);return t>=-3&&t<=20?this.toStandardNotation():this.toSciNotation()},pE.prototype.toStandardNotation=function(){var t=this.getSpecialNumberString();if(null!==t)return t;var e=new Array(1).fill(null),n=this.extractSignificantDigits(!0,e),r=e[0]+1,i=n;if("."===n.charAt(0))i="0"+n;else if(r<0)i="0."+pE.stringOfChar("0",-r)+n;else if(-1===n.indexOf(".")){var o=r-n.length;i=n+pE.stringOfChar("0",o)+".0"}return this.isNegative()?"-"+i:i},pE.prototype.reciprocal=function(){var t,e,n,r,i=null,o=null,s=null,a=null;t=(n=1/this._hi)-(i=(s=pE.SPLIT*n)-(i=s-n)),o=(a=pE.SPLIT*this._hi)-this._hi;var u=n+(s=(1-(r=n*this._hi)-(a=i*(o=a-o)-r+i*(e=this._hi-o)+t*o+t*e)-n*this._lo)/this._hi);return new pE(u,n-u+s)},pE.prototype.toSciNotation=function(){if(this.isZero())return pE.SCI_NOT_ZERO;var t=this.getSpecialNumberString();if(null!==t)return t;var e=new Array(1).fill(null),n=this.extractSignificantDigits(!1,e),r=pE.SCI_NOT_EXPONENT_CHAR+e[0];if("0"===n.charAt(0))throw new Error("Found leading zero: "+n);var i="";n.length>1&&(i=n.substring(1));var o=n.charAt(0)+"."+i;return this.isNegative()?"-"+o+r:o+r},pE.prototype.abs=function(){return this.isNaN()?pE.NaN:this.isNegative()?this.negate():new pE(this)},pE.prototype.isPositive=function(){return(this._hi>0||0===this._hi)&&this._lo>0},pE.prototype.lt=function(t){return(this._hi<t._hi||this._hi===t._hi)&&this._lo<t._lo},pE.prototype.add=function(){if(arguments[0]instanceof pE){var t=arguments[0];return pE.copy(this).selfAdd(t)}if("number"==typeof arguments[0]){var e=arguments[0];return pE.copy(this).selfAdd(e)}},pE.prototype.init=function(){if(1===arguments.length){if("number"==typeof arguments[0]){var t=arguments[0];this._hi=t,this._lo=0}else if(arguments[0]instanceof pE){var e=arguments[0];this._hi=e._hi,this._lo=e._lo}}else if(2===arguments.length){var n=arguments[0],r=arguments[1];this._hi=n,this._lo=r}},pE.prototype.gt=function(t){return(this._hi>t._hi||this._hi===t._hi)&&this._lo>t._lo},pE.prototype.isNegative=function(){return(this._hi<0||0===this._hi)&&this._lo<0},pE.prototype.trunc=function(){return this.isNaN()?pE.NaN:this.isPositive()?this.floor():this.ceil()},pE.prototype.signum=function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0},pE.prototype.interfaces_=function(){return[tE,KI,ZI]},pE.prototype.getClass=function(){return pE},pE.sqr=function(t){return pE.valueOf(t).selfMultiply(t)},pE.valueOf=function(){return"string"==typeof arguments[0]?pE.parse(arguments[0]):"number"==typeof arguments[0]?new pE(arguments[0]):void 0},pE.sqrt=function(t){return pE.valueOf(t).sqrt()},pE.parse=function(t){for(var e=0,n=t.length;fE.isWhitespace(t.charAt(e));)e++;var r=!1;if(e<n){var i=t.charAt(e);"-"!==i&&"+"!==i||(e++,"-"===i&&(r=!0))}for(var o=new pE,s=0,a=0,u=0;!(e>=n);){var l=t.charAt(e);if(e++,fE.isDigit(l)){var c=l-"0";o.selfMultiply(pE.TEN),o.selfAdd(c),s++}else{if("."!==l){if("e"===l||"E"===l){var h=t.substring(e);try{u=hE.parseInt(h)}catch(e){throw e instanceof Error?new Error("Invalid exponent "+h+" in string "+t):e}break}throw new Error("Unexpected character '"+l+"' at position "+e+" in string "+t)}a=s}}var f=o,p=s-a-u;if(0===p)f=o;else if(p>0){var g=pE.TEN.pow(p);f=o.divide(g)}else if(p<0){var A=pE.TEN.pow(-p);f=o.multiply(A)}return r?f.negate():f},pE.createNaN=function(){return new pE(JI.NaN,JI.NaN)},pE.copy=function(t){return new pE(t)},pE.magnitude=function(t){var e=Math.abs(t),n=Math.log(e)/Math.log(10),r=Math.trunc(Math.floor(n));return 10*Math.pow(10,r)<=e&&(r+=1),r},pE.stringOfChar=function(t,e){for(var n=new cE,r=0;r<e;r++)n.append(t);return n.toString()},gE.PI.get=function(){return new pE(3.141592653589793,12246467991473532e-32)},gE.TWO_PI.get=function(){return new pE(6.283185307179586,24492935982947064e-32)},gE.PI_2.get=function(){return new pE(1.5707963267948966,6123233995736766e-32)},gE.E.get=function(){return new pE(2.718281828459045,14456468917292502e-32)},gE.NaN.get=function(){return new pE(JI.NaN,JI.NaN)},gE.EPS.get=function(){return 123259516440783e-46},gE.SPLIT.get=function(){return 134217729},gE.MAX_PRINT_DIGITS.get=function(){return 32},gE.TEN.get=function(){return pE.valueOf(10)},gE.ONE.get=function(){return pE.valueOf(1)},gE.SCI_NOT_EXPONENT_CHAR.get=function(){return"E"},gE.SCI_NOT_ZERO.get=function(){return"0.0E0"},Object.defineProperties(pE,gE);var AE=function(){},dE={DP_SAFE_EPSILON:{configurable:!0}};AE.prototype.interfaces_=function(){return[]},AE.prototype.getClass=function(){return AE},AE.orientationIndex=function(t,e,n){var r=AE.orientationIndexFilter(t,e,n);if(r<=1)return r;var i=pE.valueOf(e.x).selfAdd(-t.x),o=pE.valueOf(e.y).selfAdd(-t.y),s=pE.valueOf(n.x).selfAdd(-e.x),a=pE.valueOf(n.y).selfAdd(-e.y);return i.selfMultiply(a).selfSubtract(o.selfMultiply(s)).signum()},AE.signOfDet2x2=function(t,e,n,r){return t.multiply(r).selfSubtract(e.multiply(n)).signum()},AE.intersection=function(t,e,n,r){var i=pE.valueOf(r.y).selfSubtract(n.y).selfMultiply(pE.valueOf(e.x).selfSubtract(t.x)),o=pE.valueOf(r.x).selfSubtract(n.x).selfMultiply(pE.valueOf(e.y).selfSubtract(t.y)),s=i.subtract(o),a=pE.valueOf(r.x).selfSubtract(n.x).selfMultiply(pE.valueOf(t.y).selfSubtract(n.y)),u=pE.valueOf(r.y).selfSubtract(n.y).selfMultiply(pE.valueOf(t.x).selfSubtract(n.x)),l=a.subtract(u).selfDivide(s).doubleValue(),c=pE.valueOf(t.x).selfAdd(pE.valueOf(e.x).selfSubtract(t.x).selfMultiply(l)).doubleValue(),h=pE.valueOf(e.x).selfSubtract(t.x).selfMultiply(pE.valueOf(t.y).selfSubtract(n.y)),f=pE.valueOf(e.y).selfSubtract(t.y).selfMultiply(pE.valueOf(t.x).selfSubtract(n.x)),p=h.subtract(f).selfDivide(s).doubleValue(),g=pE.valueOf(n.y).selfAdd(pE.valueOf(r.y).selfSubtract(n.y).selfMultiply(p)).doubleValue();return new eE(c,g)},AE.orientationIndexFilter=function(t,e,n){var r=null,i=(t.x-n.x)*(e.y-n.y),o=(t.y-n.y)*(e.x-n.x),s=i-o;if(i>0){if(o<=0)return AE.signum(s);r=i+o}else{if(!(i<0))return AE.signum(s);if(o>=0)return AE.signum(s);r=-i-o}var a=AE.DP_SAFE_EPSILON*r;return s>=a||-s>=a?AE.signum(s):2},AE.signum=function(t){return t>0?1:t<0?-1:0},dE.DP_SAFE_EPSILON.get=function(){return 1e-15},Object.defineProperties(AE,dE);var yE=function(){},vE={X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0},M:{configurable:!0}};vE.X.get=function(){return 0},vE.Y.get=function(){return 1},vE.Z.get=function(){return 2},vE.M.get=function(){return 3},yE.prototype.setOrdinate=function(t,e,n){},yE.prototype.size=function(){},yE.prototype.getOrdinate=function(t,e){},yE.prototype.getCoordinate=function(){},yE.prototype.getCoordinateCopy=function(t){},yE.prototype.getDimension=function(){},yE.prototype.getX=function(t){},yE.prototype.clone=function(){},yE.prototype.expandEnvelope=function(t){},yE.prototype.copy=function(){},yE.prototype.getY=function(t){},yE.prototype.toCoordinateArray=function(){},yE.prototype.interfaces_=function(){return[ZI]},yE.prototype.getClass=function(){return yE},Object.defineProperties(yE,vE);var mE=function(){},_E=function(t){function e(){t.call(this,"Projective point not representable on the Cartesian plane.")}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(mE),IE=function(){};IE.arraycopy=function(t,e,n,r,i){for(var o=0,s=e;s<e+i;s++)n[r+o]=t[s],o++},IE.getProperty=function(t){return{"line.separator":"\n"}[t]};var EE=function t(){if(this.x=null,this.y=null,this.w=null,0===arguments.length)this.x=0,this.y=0,this.w=1;else if(1===arguments.length){var e=arguments[0];this.x=e.x,this.y=e.y,this.w=1}else if(2===arguments.length){if("number"==typeof arguments[0]&&"number"==typeof arguments[1]){var n=arguments[0],r=arguments[1];this.x=n,this.y=r,this.w=1}else if(arguments[0]instanceof t&&arguments[1]instanceof t){var i=arguments[0],o=arguments[1];this.x=i.y*o.w-o.y*i.w,this.y=o.x*i.w-i.x*o.w,this.w=i.x*o.y-o.x*i.y}else if(arguments[0]instanceof eE&&arguments[1]instanceof eE){var s=arguments[0],a=arguments[1];this.x=s.y-a.y,this.y=a.x-s.x,this.w=s.x*a.y-a.x*s.y}}else if(3===arguments.length){var u=arguments[0],l=arguments[1],c=arguments[2];this.x=u,this.y=l,this.w=c}else if(4===arguments.length){var h=arguments[0],f=arguments[1],p=arguments[2],g=arguments[3],A=h.y-f.y,d=f.x-h.x,y=h.x*f.y-f.x*h.y,v=p.y-g.y,m=g.x-p.x,_=p.x*g.y-g.x*p.y;this.x=d*_-m*y,this.y=v*y-A*_,this.w=A*m-v*d}};EE.prototype.getY=function(){var t=this.y/this.w;if(JI.isNaN(t)||JI.isInfinite(t))throw new _E;return t},EE.prototype.getX=function(){var t=this.x/this.w;if(JI.isNaN(t)||JI.isInfinite(t))throw new _E;return t},EE.prototype.getCoordinate=function(){var t=new eE;return t.x=this.getX(),t.y=this.getY(),t},EE.prototype.interfaces_=function(){return[]},EE.prototype.getClass=function(){return EE},EE.intersection=function(t,e,n,r){var i=t.y-e.y,o=e.x-t.x,s=t.x*e.y-e.x*t.y,a=n.y-r.y,u=r.x-n.x,l=n.x*r.y-r.x*n.y,c=i*u-a*o,h=(o*l-u*s)/c,f=(a*s-i*l)/c;if(JI.isNaN(h)||JI.isInfinite(h)||JI.isNaN(f)||JI.isInfinite(f))throw new _E;return new eE(h,f)};var xE=function t(){if(this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,0===arguments.length)this.init();else if(1===arguments.length){if(arguments[0]instanceof eE){var e=arguments[0];this.init(e.x,e.x,e.y,e.y)}else if(arguments[0]instanceof t){var n=arguments[0];this.init(n)}}else if(2===arguments.length){var r=arguments[0],i=arguments[1];this.init(r.x,i.x,r.y,i.y)}else if(4===arguments.length){var o=arguments[0],s=arguments[1],a=arguments[2],u=arguments[3];this.init(o,s,a,u)}},CE={serialVersionUID:{configurable:!0}};xE.prototype.getArea=function(){return this.getWidth()*this.getHeight()},xE.prototype.equals=function(t){if(!(t instanceof xE))return!1;var e=t;return this.isNull()?e.isNull():this._maxx===e.getMaxX()&&this._maxy===e.getMaxY()&&this._minx===e.getMinX()&&this._miny===e.getMinY()},xE.prototype.intersection=function(t){if(this.isNull()||t.isNull()||!this.intersects(t))return new xE;var e=this._minx>t._minx?this._minx:t._minx,n=this._miny>t._miny?this._miny:t._miny,r=this._maxx<t._maxx?this._maxx:t._maxx,i=this._maxy<t._maxy?this._maxy:t._maxy;return new xE(e,r,n,i)},xE.prototype.isNull=function(){return this._maxx<this._minx},xE.prototype.getMaxX=function(){return this._maxx},xE.prototype.covers=function(){if(1===arguments.length){if(arguments[0]instanceof eE){var t=arguments[0];return this.covers(t.x,t.y)}if(arguments[0]instanceof xE){var e=arguments[0];return!this.isNull()&&!e.isNull()&&(e.getMinX()>=this._minx&&e.getMaxX()<=this._maxx&&e.getMinY()>=this._miny&&e.getMaxY()<=this._maxy)}}else if(2===arguments.length){var n=arguments[0],r=arguments[1];return!this.isNull()&&(n>=this._minx&&n<=this._maxx&&r>=this._miny&&r<=this._maxy)}},xE.prototype.intersects=function(){if(1===arguments.length){if(arguments[0]instanceof xE){var t=arguments[0];return!this.isNull()&&!t.isNull()&&!(t._minx>this._maxx||t._maxx<this._minx||t._miny>this._maxy||t._maxy<this._miny)}if(arguments[0]instanceof eE){var e=arguments[0];return this.intersects(e.x,e.y)}}else if(2===arguments.length){var n=arguments[0],r=arguments[1];return!this.isNull()&&!(n>this._maxx||n<this._minx||r>this._maxy||r<this._miny)}},xE.prototype.getMinY=function(){return this._miny},xE.prototype.getMinX=function(){return this._minx},xE.prototype.expandToInclude=function(){if(1===arguments.length){if(arguments[0]instanceof eE){var t=arguments[0];this.expandToInclude(t.x,t.y)}else if(arguments[0]instanceof xE){var e=arguments[0];if(e.isNull())return null;this.isNull()?(this._minx=e.getMinX(),this._maxx=e.getMaxX(),this._miny=e.getMinY(),this._maxy=e.getMaxY()):(e._minx<this._minx&&(this._minx=e._minx),e._maxx>this._maxx&&(this._maxx=e._maxx),e._miny<this._miny&&(this._miny=e._miny),e._maxy>this._maxy&&(this._maxy=e._maxy))}}else if(2===arguments.length){var n=arguments[0],r=arguments[1];this.isNull()?(this._minx=n,this._maxx=n,this._miny=r,this._maxy=r):(n<this._minx&&(this._minx=n),n>this._maxx&&(this._maxx=n),r<this._miny&&(this._miny=r),r>this._maxy&&(this._maxy=r))}},xE.prototype.minExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return t<e?t:e},xE.prototype.getWidth=function(){return this.isNull()?0:this._maxx-this._minx},xE.prototype.compareTo=function(t){var e=t;return this.isNull()?e.isNull()?0:-1:e.isNull()?1:this._minx<e._minx?-1:this._minx>e._minx?1:this._miny<e._miny?-1:this._miny>e._miny?1:this._maxx<e._maxx?-1:this._maxx>e._maxx?1:this._maxy<e._maxy?-1:this._maxy>e._maxy?1:0},xE.prototype.translate=function(t,e){if(this.isNull())return null;this.init(this.getMinX()+t,this.getMaxX()+t,this.getMinY()+e,this.getMaxY()+e)},xE.prototype.toString=function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"},xE.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1},xE.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny},xE.prototype.maxExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return t>e?t:e},xE.prototype.expandBy=function(){if(1===arguments.length){var t=arguments[0];this.expandBy(t,t)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];if(this.isNull())return null;this._minx-=e,this._maxx+=e,this._miny-=n,this._maxy+=n,(this._minx>this._maxx||this._miny>this._maxy)&&this.setToNull()}},xE.prototype.contains=function(){if(1===arguments.length){if(arguments[0]instanceof xE){var t=arguments[0];return this.covers(t)}if(arguments[0]instanceof eE){var e=arguments[0];return this.covers(e)}}else if(2===arguments.length){var n=arguments[0],r=arguments[1];return this.covers(n,r)}},xE.prototype.centre=function(){return this.isNull()?null:new eE((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)},xE.prototype.init=function(){if(0===arguments.length)this.setToNull();else if(1===arguments.length){if(arguments[0]instanceof eE){var t=arguments[0];this.init(t.x,t.x,t.y,t.y)}else if(arguments[0]instanceof xE){var e=arguments[0];this._minx=e._minx,this._maxx=e._maxx,this._miny=e._miny,this._maxy=e._maxy}}else if(2===arguments.length){var n=arguments[0],r=arguments[1];this.init(n.x,r.x,n.y,r.y)}else if(4===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3];i<o?(this._minx=i,this._maxx=o):(this._minx=o,this._maxx=i),s<a?(this._miny=s,this._maxy=a):(this._miny=a,this._maxy=s)}},xE.prototype.getMaxY=function(){return this._maxy},xE.prototype.distance=function(t){if(this.intersects(t))return 0;var e=0;this._maxx<t._minx?e=t._minx-this._maxx:this._minx>t._maxx&&(e=this._minx-t._maxx);var n=0;return this._maxy<t._miny?n=t._miny-this._maxy:this._miny>t._maxy&&(n=this._miny-t._maxy),0===e?n:0===n?e:Math.sqrt(e*e+n*n)},xE.prototype.hashCode=function(){var t=17;return t=37*(t=37*(t=37*(t=37*t+eE.hashCode(this._minx))+eE.hashCode(this._maxx))+eE.hashCode(this._miny))+eE.hashCode(this._maxy)},xE.prototype.interfaces_=function(){return[KI,tE]},xE.prototype.getClass=function(){return xE},xE.intersects=function(){if(3===arguments.length){var t=arguments[0],e=arguments[1],n=arguments[2];return n.x>=(t.x<e.x?t.x:e.x)&&n.x<=(t.x>e.x?t.x:e.x)&&n.y>=(t.y<e.y?t.y:e.y)&&n.y<=(t.y>e.y?t.y:e.y)}if(4===arguments.length){var r=arguments[0],i=arguments[1],o=arguments[2],s=arguments[3],a=Math.min(o.x,s.x),u=Math.max(o.x,s.x),l=Math.min(r.x,i.x),c=Math.max(r.x,i.x);return!(l>u)&&(!(c<a)&&(a=Math.min(o.y,s.y),u=Math.max(o.y,s.y),l=Math.min(r.y,i.y),c=Math.max(r.y,i.y),!(l>u)&&!(c<a)))}},CE.serialVersionUID.get=function(){return 0x51845cd552189800},Object.defineProperties(xE,CE);var wE={typeStr:/^\s*(\w+)\s*\(\s*(.*)\s*\)\s*$/,emptyTypeStr:/^\s*(\w+)\s*EMPTY\s*$/,spaces:/\s+/,parenComma:/\)\s*,\s*\(/,doubleParenComma:/\)\s*\)\s*,\s*\(\s*\(/,trimParens:/^\s*\(?(.*?)\)?\s*$/},bE=function(t){this.geometryFactory=t||new hC};bE.prototype.read=function(t){var e,n,r;t=t.replace(/[\n\r]/g," ");var i=wE.typeStr.exec(t);if(-1!==t.search("EMPTY")&&((i=wE.emptyTypeStr.exec(t))[2]=void 0),i&&(n=i[1].toLowerCase(),r=i[2],SE[n]&&(e=SE[n].apply(this,[r]))),void 0===e)throw new Error("Could not parse WKT "+t);return e},bE.prototype.write=function(t){return this.extractGeometry(t)},bE.prototype.extractGeometry=function(t){var e=t.getGeometryType().toLowerCase();if(!BE[e])return null;var n=e.toUpperCase();return t.isEmpty()?n+" EMPTY":n+"("+BE[e].apply(this,[t])+")"};var BE={coordinate:function(t){return t.x+" "+t.y},point:function(t){return BE.coordinate.call(this,t._coordinates._coordinates[0])},multipoint:function(t){for(var e=[],n=0,r=t._geometries.length;n<r;++n)e.push("("+BE.point.apply(this,[t._geometries[n]])+")");return e.join(",")},linestring:function(t){for(var e=[],n=0,r=t._points._coordinates.length;n<r;++n)e.push(BE.coordinate.apply(this,[t._points._coordinates[n]]));return e.join(",")},linearring:function(t){for(var e=[],n=0,r=t._points._coordinates.length;n<r;++n)e.push(BE.coordinate.apply(this,[t._points._coordinates[n]]));return e.join(",")},multilinestring:function(t){for(var e=[],n=0,r=t._geometries.length;n<r;++n)e.push("("+BE.linestring.apply(this,[t._geometries[n]])+")");return e.join(",")},polygon:function(t){var e=[];e.push("("+BE.linestring.apply(this,[t._shell])+")");for(var n=0,r=t._holes.length;n<r;++n)e.push("("+BE.linestring.apply(this,[t._holes[n]])+")");return e.join(",")},multipolygon:function(t){for(var e=[],n=0,r=t._geometries.length;n<r;++n)e.push("("+BE.polygon.apply(this,[t._geometries[n]])+")");return e.join(",")},geometrycollection:function(t){for(var e=[],n=0,r=t._geometries.length;n<r;++n)e.push(this.extractGeometry(t._geometries[n]));return e.join(",")}},SE={point:function(t){if(void 0===t)return this.geometryFactory.createPoint();var e=t.trim().split(wE.spaces);return this.geometryFactory.createPoint(new eE(Number.parseFloat(e[0]),Number.parseFloat(e[1])))},multipoint:function(t){var e;if(void 0===t)return this.geometryFactory.createMultiPoint();for(var n=t.trim().split(","),r=[],i=0,o=n.length;i<o;++i)e=n[i].replace(wE.trimParens,"$1"),r.push(SE.point.apply(this,[e]));return this.geometryFactory.createMultiPoint(r)},linestring:function(t){if(void 0===t)return this.geometryFactory.createLineString();for(var e,n=t.trim().split(","),r=[],i=0,o=n.length;i<o;++i)e=n[i].trim().split(wE.spaces),r.push(new eE(Number.parseFloat(e[0]),Number.parseFloat(e[1])));return this.geometryFactory.createLineString(r)},linearring:function(t){if(void 0===t)return this.geometryFactory.createLinearRing();for(var e,n=t.trim().split(","),r=[],i=0,o=n.length;i<o;++i)e=n[i].trim().split(wE.spaces),r.push(new eE(Number.parseFloat(e[0]),Number.parseFloat(e[1])));return this.geometryFactory.createLinearRing(r)},multilinestring:function(t){var e;if(void 0===t)return this.geometryFactory.createMultiLineString();for(var n=t.trim().split(wE.parenComma),r=[],i=0,o=n.length;i<o;++i)e=n[i].replace(wE.trimParens,"$1"),r.push(SE.linestring.apply(this,[e]));return this.geometryFactory.createMultiLineString(r)},polygon:function(t){var e,n,r;if(void 0===t)return this.geometryFactory.createPolygon();for(var i,o=t.trim().split(wE.parenComma),s=[],a=0,u=o.length;a<u;++a)e=o[a].replace(wE.trimParens,"$1"),n=SE.linestring.apply(this,[e]),r=this.geometryFactory.createLinearRing(n._points),0===a?i=r:s.push(r);return this.geometryFactory.createPolygon(i,s)},multipolygon:function(t){var e;if(void 0===t)return this.geometryFactory.createMultiPolygon();for(var n=t.trim().split(wE.doubleParenComma),r=[],i=0,o=n.length;i<o;++i)e=n[i].replace(wE.trimParens,"$1"),r.push(SE.polygon.apply(this,[e]));return this.geometryFactory.createMultiPolygon(r)},geometrycollection:function(t){if(void 0===t)return this.geometryFactory.createGeometryCollection();for(var e=(t=t.replace(/,\s*([A-Za-z])/g,"|$1")).trim().split("|"),n=[],r=0,i=e.length;r<i;++r)n.push(this.read(e[r]));return this.geometryFactory.createGeometryCollection(n)}},ME=function(t){this.parser=new bE(t)};ME.prototype.write=function(t){return this.parser.write(t)},ME.toLineString=function(t,e){if(2!==arguments.length)throw new Error("Not implemented");return"LINESTRING ( "+t.x+" "+t.y+", "+e.x+" "+e.y+" )"};var LE=function(t){function e(e){t.call(this,e),this.name="RuntimeException",this.message=e,this.stack=(new t).stack}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Error),NE=function(t){function e(){if(t.call(this),0===arguments.length)t.call(this);else if(1===arguments.length){var e=arguments[0];t.call(this,e)}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(LE),TE=function(){};TE.prototype.interfaces_=function(){return[]},TE.prototype.getClass=function(){return TE},TE.shouldNeverReachHere=function(){if(0===arguments.length)TE.shouldNeverReachHere(null);else if(1===arguments.length){var t=arguments[0];throw new NE("Should never reach here"+(null!==t?": "+t:""))}},TE.isTrue=function(){var t;if(1===arguments.length)TE.isTrue(arguments[0],null);else if(2===arguments.length&&(t=arguments[1],!arguments[0]))throw null===t?new NE:new NE(t)},TE.equals=function(){var t,e,n;if(2===arguments.length)TE.equals(t=arguments[0],e=arguments[1],null);else if(3===arguments.length&&(t=arguments[0],n=arguments[2],!(e=arguments[1]).equals(t)))throw new NE("Expected "+t+" but encountered "+e+(null!==n?": "+n:""))};var RE=function(){this._result=null,this._inputLines=Array(2).fill().map((function(){return Array(2)})),this._intPt=new Array(2).fill(null),this._intLineIndex=null,this._isProper=null,this._pa=null,this._pb=null,this._precisionModel=null,this._intPt[0]=new eE,this._intPt[1]=new eE,this._pa=this._intPt[0],this._pb=this._intPt[1],this._result=0},QE={DONT_INTERSECT:{configurable:!0},DO_INTERSECT:{configurable:!0},COLLINEAR:{configurable:!0},NO_INTERSECTION:{configurable:!0},POINT_INTERSECTION:{configurable:!0},COLLINEAR_INTERSECTION:{configurable:!0}};RE.prototype.getIndexAlongSegment=function(t,e){return this.computeIntLineIndex(),this._intLineIndex[t][e]},RE.prototype.getTopologySummary=function(){var t=new cE;return this.isEndPoint()&&t.append(" endpoint"),this._isProper&&t.append(" proper"),this.isCollinear()&&t.append(" collinear"),t.toString()},RE.prototype.computeIntersection=function(t,e,n,r){this._inputLines[0][0]=t,this._inputLines[0][1]=e,this._inputLines[1][0]=n,this._inputLines[1][1]=r,this._result=this.computeIntersect(t,e,n,r)},RE.prototype.getIntersectionNum=function(){return this._result},RE.prototype.computeIntLineIndex=function(){if(0===arguments.length)null===this._intLineIndex&&(this._intLineIndex=Array(2).fill().map((function(){return Array(2)})),this.computeIntLineIndex(0),this.computeIntLineIndex(1));else if(1===arguments.length){var t=arguments[0];this.getEdgeDistance(t,0)>this.getEdgeDistance(t,1)?(this._intLineIndex[t][0]=0,this._intLineIndex[t][1]=1):(this._intLineIndex[t][0]=1,this._intLineIndex[t][1]=0)}},RE.prototype.isProper=function(){return this.hasIntersection()&&this._isProper},RE.prototype.setPrecisionModel=function(t){this._precisionModel=t},RE.prototype.isInteriorIntersection=function(){var t=this;if(0===arguments.length)return!!this.isInteriorIntersection(0)||!!this.isInteriorIntersection(1);if(1===arguments.length){for(var e=arguments[0],n=0;n<this._result;n++)if(!t._intPt[n].equals2D(t._inputLines[e][0])&&!t._intPt[n].equals2D(t._inputLines[e][1]))return!0;return!1}},RE.prototype.getIntersection=function(t){return this._intPt[t]},RE.prototype.isEndPoint=function(){return this.hasIntersection()&&!this._isProper},RE.prototype.hasIntersection=function(){return this._result!==RE.NO_INTERSECTION},RE.prototype.getEdgeDistance=function(t,e){return RE.computeEdgeDistance(this._intPt[e],this._inputLines[t][0],this._inputLines[t][1])},RE.prototype.isCollinear=function(){return this._result===RE.COLLINEAR_INTERSECTION},RE.prototype.toString=function(){return ME.toLineString(this._inputLines[0][0],this._inputLines[0][1])+" - "+ME.toLineString(this._inputLines[1][0],this._inputLines[1][1])+this.getTopologySummary()},RE.prototype.getEndpoint=function(t,e){return this._inputLines[t][e]},RE.prototype.isIntersection=function(t){for(var e=0;e<this._result;e++)if(this._intPt[e].equals2D(t))return!0;return!1},RE.prototype.getIntersectionAlongSegment=function(t,e){return this.computeIntLineIndex(),this._intPt[this._intLineIndex[t][e]]},RE.prototype.interfaces_=function(){return[]},RE.prototype.getClass=function(){return RE},RE.computeEdgeDistance=function(t,e,n){var r=Math.abs(n.x-e.x),i=Math.abs(n.y-e.y),o=-1;if(t.equals(e))o=0;else if(t.equals(n))o=r>i?r:i;else{var s=Math.abs(t.x-e.x),a=Math.abs(t.y-e.y);0!==(o=r>i?s:a)||t.equals(e)||(o=Math.max(s,a))}return TE.isTrue(!(0===o&&!t.equals(e)),"Bad distance calculation"),o},RE.nonRobustComputeEdgeDistance=function(t,e,n){var r=t.x-e.x,i=t.y-e.y,o=Math.sqrt(r*r+i*i);return TE.isTrue(!(0===o&&!t.equals(e)),"Invalid distance calculation"),o},QE.DONT_INTERSECT.get=function(){return 0},QE.DO_INTERSECT.get=function(){return 1},QE.COLLINEAR.get=function(){return 2},QE.NO_INTERSECTION.get=function(){return 0},QE.POINT_INTERSECTION.get=function(){return 1},QE.COLLINEAR_INTERSECTION.get=function(){return 2},Object.defineProperties(RE,QE);var DE=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isInSegmentEnvelopes=function(t){var e=new xE(this._inputLines[0][0],this._inputLines[0][1]),n=new xE(this._inputLines[1][0],this._inputLines[1][1]);return e.contains(t)&&n.contains(t)},e.prototype.computeIntersection=function(){if(3!==arguments.length)return t.prototype.computeIntersection.apply(this,arguments);var e=arguments[0],n=arguments[1],r=arguments[2];if(this._isProper=!1,xE.intersects(n,r,e)&&0===OE.orientationIndex(n,r,e)&&0===OE.orientationIndex(r,n,e))return this._isProper=!0,(e.equals(n)||e.equals(r))&&(this._isProper=!1),this._result=t.POINT_INTERSECTION,null;this._result=t.NO_INTERSECTION},e.prototype.normalizeToMinimum=function(t,e,n,r,i){i.x=this.smallestInAbsValue(t.x,e.x,n.x,r.x),i.y=this.smallestInAbsValue(t.y,e.y,n.y,r.y),t.x-=i.x,t.y-=i.y,e.x-=i.x,e.y-=i.y,n.x-=i.x,n.y-=i.y,r.x-=i.x,r.y-=i.y},e.prototype.safeHCoordinateIntersection=function(t,n,r,i){var o=null;try{o=EE.intersection(t,n,r,i)}catch(s){if(!(s instanceof _E))throw s;o=e.nearestEndpoint(t,n,r,i)}return o},e.prototype.intersection=function(t,n,r,i){var o=this.intersectionWithNormalization(t,n,r,i);return this.isInSegmentEnvelopes(o)||(o=new eE(e.nearestEndpoint(t,n,r,i))),null!==this._precisionModel&&this._precisionModel.makePrecise(o),o},e.prototype.smallestInAbsValue=function(t,e,n,r){var i=t,o=Math.abs(i);return Math.abs(e)<o&&(i=e,o=Math.abs(e)),Math.abs(n)<o&&(i=n,o=Math.abs(n)),Math.abs(r)<o&&(i=r),i},e.prototype.checkDD=function(t,e,n,r,i){var o=AE.intersection(t,e,n,r),s=this.isInSegmentEnvelopes(o);IE.out.println("DD in env = "+s+" --------------------- "+o),i.distance(o)>1e-4&&IE.out.println("Distance = "+i.distance(o))},e.prototype.intersectionWithNormalization=function(t,e,n,r){var i=new eE(t),o=new eE(e),s=new eE(n),a=new eE(r),u=new eE;this.normalizeToEnvCentre(i,o,s,a,u);var l=this.safeHCoordinateIntersection(i,o,s,a);return l.x+=u.x,l.y+=u.y,l},e.prototype.computeCollinearIntersection=function(e,n,r,i){var o=xE.intersects(e,n,r),s=xE.intersects(e,n,i),a=xE.intersects(r,i,e),u=xE.intersects(r,i,n);return o&&s?(this._intPt[0]=r,this._intPt[1]=i,t.COLLINEAR_INTERSECTION):a&&u?(this._intPt[0]=e,this._intPt[1]=n,t.COLLINEAR_INTERSECTION):o&&a?(this._intPt[0]=r,this._intPt[1]=e,!r.equals(e)||s||u?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):o&&u?(this._intPt[0]=r,this._intPt[1]=n,!r.equals(n)||s||a?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):s&&a?(this._intPt[0]=i,this._intPt[1]=e,!i.equals(e)||o||u?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):s&&u?(this._intPt[0]=i,this._intPt[1]=n,!i.equals(n)||o||a?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):t.NO_INTERSECTION},e.prototype.normalizeToEnvCentre=function(t,e,n,r,i){var o=t.x<e.x?t.x:e.x,s=t.y<e.y?t.y:e.y,a=t.x>e.x?t.x:e.x,u=t.y>e.y?t.y:e.y,l=n.x<r.x?n.x:r.x,c=n.y<r.y?n.y:r.y,h=n.x>r.x?n.x:r.x,f=n.y>r.y?n.y:r.y,p=((o>l?o:l)+(a<h?a:h))/2,g=((s>c?s:c)+(u<f?u:f))/2;i.x=p,i.y=g,t.x-=i.x,t.y-=i.y,e.x-=i.x,e.y-=i.y,n.x-=i.x,n.y-=i.y,r.x-=i.x,r.y-=i.y},e.prototype.computeIntersect=function(e,n,r,i){if(this._isProper=!1,!xE.intersects(e,n,r,i))return t.NO_INTERSECTION;var o=OE.orientationIndex(e,n,r),s=OE.orientationIndex(e,n,i);if(o>0&&s>0||o<0&&s<0)return t.NO_INTERSECTION;var a=OE.orientationIndex(r,i,e),u=OE.orientationIndex(r,i,n);return a>0&&u>0||a<0&&u<0?t.NO_INTERSECTION:0===o&&0===s&&0===a&&0===u?this.computeCollinearIntersection(e,n,r,i):(0===o||0===s||0===a||0===u?(this._isProper=!1,e.equals2D(r)||e.equals2D(i)?this._intPt[0]=e:n.equals2D(r)||n.equals2D(i)?this._intPt[0]=n:0===o?this._intPt[0]=new eE(r):0===s?this._intPt[0]=new eE(i):0===a?this._intPt[0]=new eE(e):0===u&&(this._intPt[0]=new eE(n))):(this._isProper=!0,this._intPt[0]=this.intersection(e,n,r,i)),t.POINT_INTERSECTION)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.nearestEndpoint=function(t,e,n,r){var i=t,o=OE.distancePointLine(t,n,r),s=OE.distancePointLine(e,n,r);return s<o&&(o=s,i=e),(s=OE.distancePointLine(n,t,e))<o&&(o=s,i=n),(s=OE.distancePointLine(r,t,e))<o&&(o=s,i=r),i},e}(RE),PE=function(){};PE.prototype.interfaces_=function(){return[]},PE.prototype.getClass=function(){return PE},PE.orientationIndex=function(t,e,n){var r=e.x-t.x,i=e.y-t.y,o=n.x-e.x,s=n.y-e.y;return PE.signOfDet2x2(r,i,o,s)},PE.signOfDet2x2=function(t,e,n,r){var i=null,o=null,s=null;if(i=1,0===t||0===r)return 0===e||0===n?0:e>0?n>0?-i:i:n>0?i:-i;if(0===e||0===n)return r>0?t>0?i:-i:t>0?-i:i;if(e>0?r>0?e<=r||(i=-i,o=t,t=n,n=o,o=e,e=r,r=o):e<=-r?(i=-i,n=-n,r=-r):(o=t,t=-n,n=o,o=e,e=-r,r=o):r>0?-e<=r?(i=-i,t=-t,e=-e):(o=-t,t=n,n=o,o=-e,e=r,r=o):e>=r?(t=-t,e=-e,n=-n,r=-r):(i=-i,o=-t,t=-n,n=o,o=-e,e=-r,r=o),t>0){if(!(n>0))return i;if(!(t<=n))return i}else{if(n>0)return-i;if(!(t>=n))return-i;i=-i,t=-t,n=-n}for(;;){if((r-=(s=Math.floor(n/t))*e)<0)return-i;if(r>e)return i;if(t>(n-=s*t)+n){if(e<r+r)return i}else{if(e>r+r)return-i;n=t-n,r=e-r,i=-i}if(0===r)return 0===n?0:-i;if(0===n)return i;if((e-=(s=Math.floor(t/n))*r)<0)return i;if(e>r)return-i;if(n>(t-=s*n)+t){if(r<e+e)return-i}else{if(r>e+e)return i;t=n-t,e=r-e,i=-i}if(0===e)return 0===t?0:i;if(0===t)return-i}};var kE=function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var t=arguments[0];this._p=t};kE.prototype.countSegment=function(t,e){if(t.x<this._p.x&&e.x<this._p.x)return null;if(this._p.x===e.x&&this._p.y===e.y)return this._isPointOnSegment=!0,null;if(t.y===this._p.y&&e.y===this._p.y){var n=t.x,r=e.x;return n>r&&(n=e.x,r=t.x),this._p.x>=n&&this._p.x<=r&&(this._isPointOnSegment=!0),null}if(t.y>this._p.y&&e.y<=this._p.y||e.y>this._p.y&&t.y<=this._p.y){var i=t.x-this._p.x,o=t.y-this._p.y,s=e.x-this._p.x,a=e.y-this._p.y,u=PE.signOfDet2x2(i,o,s,a);if(0===u)return this._isPointOnSegment=!0,null;a<o&&(u=-u),u>0&&this._crossingCount++}},kE.prototype.isPointInPolygon=function(){return this.getLocation()!==oE.EXTERIOR},kE.prototype.getLocation=function(){return this._isPointOnSegment?oE.BOUNDARY:this._crossingCount%2==1?oE.INTERIOR:oE.EXTERIOR},kE.prototype.isOnSegment=function(){return this._isPointOnSegment},kE.prototype.interfaces_=function(){return[]},kE.prototype.getClass=function(){return kE},kE.locatePointInRing=function(){if(arguments[0]instanceof eE&&aE(arguments[1],yE)){for(var t=arguments[1],e=new kE(arguments[0]),n=new eE,r=new eE,i=1;i<t.size();i++)if(t.getCoordinate(i,n),t.getCoordinate(i-1,r),e.countSegment(n,r),e.isOnSegment())return e.getLocation();return e.getLocation()}if(arguments[0]instanceof eE&&arguments[1]instanceof Array){for(var o=arguments[1],s=new kE(arguments[0]),a=1;a<o.length;a++){var u=o[a],l=o[a-1];if(s.countSegment(u,l),s.isOnSegment())return s.getLocation()}return s.getLocation()}};var OE=function(){},FE={CLOCKWISE:{configurable:!0},RIGHT:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},LEFT:{configurable:!0},COLLINEAR:{configurable:!0},STRAIGHT:{configurable:!0}};OE.prototype.interfaces_=function(){return[]},OE.prototype.getClass=function(){return OE},OE.orientationIndex=function(t,e,n){return AE.orientationIndex(t,e,n)},OE.signedArea=function(){if(arguments[0]instanceof Array){var t=arguments[0];if(t.length<3)return 0;for(var e=0,n=t[0].x,r=1;r<t.length-1;r++){var i=t[r].x-n,o=t[r+1].y;e+=i*(t[r-1].y-o)}return e/2}if(aE(arguments[0],yE)){var s=arguments[0],a=s.size();if(a<3)return 0;var u=new eE,l=new eE,c=new eE;s.getCoordinate(0,l),s.getCoordinate(1,c);var h=l.x;c.x-=h;for(var f=0,p=1;p<a-1;p++)u.y=l.y,l.x=c.x,l.y=c.y,s.getCoordinate(p+1,c),c.x-=h,f+=l.x*(u.y-c.y);return f/2}},OE.distanceLineLine=function(t,e,n,r){if(t.equals(e))return OE.distancePointLine(t,n,r);if(n.equals(r))return OE.distancePointLine(r,t,e);var i=!1;if(xE.intersects(t,e,n,r)){var o=(e.x-t.x)*(r.y-n.y)-(e.y-t.y)*(r.x-n.x);if(0===o)i=!0;else{var s=(t.y-n.y)*(r.x-n.x)-(t.x-n.x)*(r.y-n.y),a=((t.y-n.y)*(e.x-t.x)-(t.x-n.x)*(e.y-t.y))/o,u=s/o;(u<0||u>1||a<0||a>1)&&(i=!0)}}else i=!0;return i?uE.min(OE.distancePointLine(t,n,r),OE.distancePointLine(e,n,r),OE.distancePointLine(n,t,e),OE.distancePointLine(r,t,e)):0},OE.isPointInRing=function(t,e){return OE.locatePointInRing(t,e)!==oE.EXTERIOR},OE.computeLength=function(t){var e=t.size();if(e<=1)return 0;var n=0,r=new eE;t.getCoordinate(0,r);for(var i=r.x,o=r.y,s=1;s<e;s++){t.getCoordinate(s,r);var a=r.x,u=r.y,l=a-i,c=u-o;n+=Math.sqrt(l*l+c*c),i=a,o=u}return n},OE.isCCW=function(t){var e=t.length-1;if(e<3)throw new XI("Ring has fewer than 4 points, so orientation cannot be determined");for(var n=t[0],r=0,i=1;i<=e;i++){var o=t[i];o.y>n.y&&(n=o,r=i)}var s=r;do{(s-=1)<0&&(s=e)}while(t[s].equals2D(n)&&s!==r);var a=r;do{a=(a+1)%e}while(t[a].equals2D(n)&&a!==r);var u=t[s],l=t[a];if(u.equals2D(n)||l.equals2D(n)||u.equals2D(l))return!1;var c=OE.computeOrientation(u,n,l),h=!1;return h=0===c?u.x>l.x:c>0,h},OE.locatePointInRing=function(t,e){return kE.locatePointInRing(t,e)},OE.distancePointLinePerpendicular=function(t,e,n){var r=(n.x-e.x)*(n.x-e.x)+(n.y-e.y)*(n.y-e.y),i=((e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y))/r;return Math.abs(i)*Math.sqrt(r)},OE.computeOrientation=function(t,e,n){return OE.orientationIndex(t,e,n)},OE.distancePointLine=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];if(0===e.length)throw new XI("Line array must contain at least one vertex");for(var n=t.distance(e[0]),r=0;r<e.length-1;r++){var i=OE.distancePointLine(t,e[r],e[r+1]);i<n&&(n=i)}return n}if(3===arguments.length){var o=arguments[0],s=arguments[1],a=arguments[2];if(s.x===a.x&&s.y===a.y)return o.distance(s);var u=(a.x-s.x)*(a.x-s.x)+(a.y-s.y)*(a.y-s.y),l=((o.x-s.x)*(a.x-s.x)+(o.y-s.y)*(a.y-s.y))/u;if(l<=0)return o.distance(s);if(l>=1)return o.distance(a);var c=((s.y-o.y)*(a.x-s.x)-(s.x-o.x)*(a.y-s.y))/u;return Math.abs(c)*Math.sqrt(u)}},OE.isOnLine=function(t,e){for(var n=new DE,r=1;r<e.length;r++){var i=e[r-1],o=e[r];if(n.computeIntersection(t,i,o),n.hasIntersection())return!0}return!1},FE.CLOCKWISE.get=function(){return-1},FE.RIGHT.get=function(){return OE.CLOCKWISE},FE.COUNTERCLOCKWISE.get=function(){return 1},FE.LEFT.get=function(){return OE.COUNTERCLOCKWISE},FE.COLLINEAR.get=function(){return 0},FE.STRAIGHT.get=function(){return OE.COLLINEAR},Object.defineProperties(OE,FE);var GE=function(){};GE.prototype.filter=function(t){},GE.prototype.interfaces_=function(){return[]},GE.prototype.getClass=function(){return GE};var UE=function(){var t=arguments[0];this._envelope=null,this._factory=null,this._SRID=null,this._userData=null,this._factory=t,this._SRID=t.getSRID()},qE={serialVersionUID:{configurable:!0},SORTINDEX_POINT:{configurable:!0},SORTINDEX_MULTIPOINT:{configurable:!0},SORTINDEX_LINESTRING:{configurable:!0},SORTINDEX_LINEARRING:{configurable:!0},SORTINDEX_MULTILINESTRING:{configurable:!0},SORTINDEX_POLYGON:{configurable:!0},SORTINDEX_MULTIPOLYGON:{configurable:!0},SORTINDEX_GEOMETRYCOLLECTION:{configurable:!0},geometryChangedFilter:{configurable:!0}};UE.prototype.isGeometryCollection=function(){return this.getSortIndex()===UE.SORTINDEX_GEOMETRYCOLLECTION},UE.prototype.getFactory=function(){return this._factory},UE.prototype.getGeometryN=function(t){return this},UE.prototype.getArea=function(){return 0},UE.prototype.isRectangle=function(){return!1},UE.prototype.equals=function(){if(arguments[0]instanceof UE){var t=arguments[0];return null!==t&&this.equalsTopo(t)}if(arguments[0]instanceof Object){var e=arguments[0];if(!(e instanceof UE))return!1;var n=e;return this.equalsExact(n)}},UE.prototype.equalsExact=function(t){return this===t||this.equalsExact(t,0)},UE.prototype.geometryChanged=function(){this.apply(UE.geometryChangedFilter)},UE.prototype.geometryChangedAction=function(){this._envelope=null},UE.prototype.equalsNorm=function(t){return null!==t&&this.norm().equalsExact(t.norm())},UE.prototype.getLength=function(){return 0},UE.prototype.getNumGeometries=function(){return 1},UE.prototype.compareTo=function(){if(1===arguments.length){var t=arguments[0],e=t;return this.getSortIndex()!==e.getSortIndex()?this.getSortIndex()-e.getSortIndex():this.isEmpty()&&e.isEmpty()?0:this.isEmpty()?-1:e.isEmpty()?1:this.compareToSameClass(t)}if(2===arguments.length){var n=arguments[0],r=arguments[1];return this.getSortIndex()!==n.getSortIndex()?this.getSortIndex()-n.getSortIndex():this.isEmpty()&&n.isEmpty()?0:this.isEmpty()?-1:n.isEmpty()?1:this.compareToSameClass(n,r)}},UE.prototype.getUserData=function(){return this._userData},UE.prototype.getSRID=function(){return this._SRID},UE.prototype.getEnvelope=function(){return this.getFactory().toGeometry(this.getEnvelopeInternal())},UE.prototype.checkNotGeometryCollection=function(t){if(t.getSortIndex()===UE.SORTINDEX_GEOMETRYCOLLECTION)throw new XI("This method does not support GeometryCollection arguments")},UE.prototype.equal=function(t,e,n){return 0===n?t.equals(e):t.distance(e)<=n},UE.prototype.norm=function(){var t=this.copy();return t.normalize(),t},UE.prototype.getPrecisionModel=function(){return this._factory.getPrecisionModel()},UE.prototype.getEnvelopeInternal=function(){return null===this._envelope&&(this._envelope=this.computeEnvelopeInternal()),new xE(this._envelope)},UE.prototype.setSRID=function(t){this._SRID=t},UE.prototype.setUserData=function(t){this._userData=t},UE.prototype.compare=function(t,e){for(var n=t.iterator(),r=e.iterator();n.hasNext()&&r.hasNext();){var i=n.next(),o=r.next(),s=i.compareTo(o);if(0!==s)return s}return n.hasNext()?1:r.hasNext()?-1:0},UE.prototype.hashCode=function(){return this.getEnvelopeInternal().hashCode()},UE.prototype.isGeometryCollectionOrDerived=function(){return this.getSortIndex()===UE.SORTINDEX_GEOMETRYCOLLECTION||this.getSortIndex()===UE.SORTINDEX_MULTIPOINT||this.getSortIndex()===UE.SORTINDEX_MULTILINESTRING||this.getSortIndex()===UE.SORTINDEX_MULTIPOLYGON},UE.prototype.interfaces_=function(){return[ZI,KI,tE]},UE.prototype.getClass=function(){return UE},UE.hasNonEmptyElements=function(t){for(var e=0;e<t.length;e++)if(!t[e].isEmpty())return!0;return!1},UE.hasNullElements=function(t){for(var e=0;e<t.length;e++)if(null===t[e])return!0;return!1},qE.serialVersionUID.get=function(){return 0x799ea46522854c00},qE.SORTINDEX_POINT.get=function(){return 0},qE.SORTINDEX_MULTIPOINT.get=function(){return 1},qE.SORTINDEX_LINESTRING.get=function(){return 2},qE.SORTINDEX_LINEARRING.get=function(){return 3},qE.SORTINDEX_MULTILINESTRING.get=function(){return 4},qE.SORTINDEX_POLYGON.get=function(){return 5},qE.SORTINDEX_MULTIPOLYGON.get=function(){return 6},qE.SORTINDEX_GEOMETRYCOLLECTION.get=function(){return 7},qE.geometryChangedFilter.get=function(){return jE},Object.defineProperties(UE,qE);var jE=function(){};jE.interfaces_=function(){return[GE]},jE.filter=function(t){t.geometryChangedAction()};var zE=function(){};zE.prototype.filter=function(t){},zE.prototype.interfaces_=function(){return[]},zE.prototype.getClass=function(){return zE};var VE=function(){},YE={Mod2BoundaryNodeRule:{configurable:!0},EndPointBoundaryNodeRule:{configurable:!0},MultiValentEndPointBoundaryNodeRule:{configurable:!0},MonoValentEndPointBoundaryNodeRule:{configurable:!0},MOD2_BOUNDARY_RULE:{configurable:!0},ENDPOINT_BOUNDARY_RULE:{configurable:!0},MULTIVALENT_ENDPOINT_BOUNDARY_RULE:{configurable:!0},MONOVALENT_ENDPOINT_BOUNDARY_RULE:{configurable:!0},OGC_SFS_BOUNDARY_RULE:{configurable:!0}};VE.prototype.isInBoundary=function(t){},VE.prototype.interfaces_=function(){return[]},VE.prototype.getClass=function(){return VE},YE.Mod2BoundaryNodeRule.get=function(){return HE},YE.EndPointBoundaryNodeRule.get=function(){return XE},YE.MultiValentEndPointBoundaryNodeRule.get=function(){return JE},YE.MonoValentEndPointBoundaryNodeRule.get=function(){return WE},YE.MOD2_BOUNDARY_RULE.get=function(){return new HE},YE.ENDPOINT_BOUNDARY_RULE.get=function(){return new XE},YE.MULTIVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new JE},YE.MONOVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new WE},YE.OGC_SFS_BOUNDARY_RULE.get=function(){return VE.MOD2_BOUNDARY_RULE},Object.defineProperties(VE,YE);var HE=function(){};HE.prototype.isInBoundary=function(t){return t%2==1},HE.prototype.interfaces_=function(){return[VE]},HE.prototype.getClass=function(){return HE};var XE=function(){};XE.prototype.isInBoundary=function(t){return t>0},XE.prototype.interfaces_=function(){return[VE]},XE.prototype.getClass=function(){return XE};var JE=function(){};JE.prototype.isInBoundary=function(t){return t>1},JE.prototype.interfaces_=function(){return[VE]},JE.prototype.getClass=function(){return JE};var WE=function(){};WE.prototype.isInBoundary=function(t){return 1===t},WE.prototype.interfaces_=function(){return[VE]},WE.prototype.getClass=function(){return WE};var KE=function(){};function ZE(t){this.message=t||""}KE.prototype.add=function(){},KE.prototype.addAll=function(){},KE.prototype.isEmpty=function(){},KE.prototype.iterator=function(){},KE.prototype.size=function(){},KE.prototype.toArray=function(){},KE.prototype.remove=function(){},ZE.prototype=new Error,ZE.prototype.name="IndexOutOfBoundsException";var $E=function(){};$E.prototype.hasNext=function(){},$E.prototype.next=function(){},$E.prototype.remove=function(){};var tx=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(){},e.prototype.set=function(){},e.prototype.isEmpty=function(){},e}(KE);function ex(t){this.message=t||""}ex.prototype=new Error,ex.prototype.name="NoSuchElementException";var nx=function(t){function e(){t.call(this),this.array_=[],arguments[0]instanceof KE&&this.addAll(arguments[0])}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.ensureCapacity=function(){},e.prototype.interfaces_=function(){return[t,KE]},e.prototype.add=function(t){return 1===arguments.length?this.array_.push(t):this.array_.splice(arguments[0],arguments[1]),!0},e.prototype.clear=function(){this.array_=[]},e.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next());return!0},e.prototype.set=function(t,e){var n=this.array_[t];return this.array_[t]=e,n},e.prototype.iterator=function(){return new rx(this)},e.prototype.get=function(t){if(t<0||t>=this.size())throw new ZE;return this.array_[t]},e.prototype.isEmpty=function(){return 0===this.array_.length},e.prototype.size=function(){return this.array_.length},e.prototype.toArray=function(){for(var t=[],e=0,n=this.array_.length;e<n;e++)t.push(this.array_[e]);return t},e.prototype.remove=function(t){for(var e=!1,n=0,r=this.array_.length;n<r;n++)if(this.array_[n]===t){this.array_.splice(n,1),e=!0;break}return e},e}(tx),rx=function(t){function e(e){t.call(this),this.arrayList_=e,this.position_=0}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.next=function(){if(this.position_===this.arrayList_.size())throw new ex;return this.arrayList_.get(this.position_++)},e.prototype.hasNext=function(){return this.position_<this.arrayList_.size()},e.prototype.set=function(t){return this.arrayList_.set(this.position_-1,t)},e.prototype.remove=function(){this.arrayList_.remove(this.arrayList_.get(this.position_))},e}($E),ix=function(t){function e(){if(t.call(this),0===arguments.length);else if(1===arguments.length){var e=arguments[0];this.ensureCapacity(e.length),this.add(e,!0)}else if(2===arguments.length){var n=arguments[0],r=arguments[1];this.ensureCapacity(n.length),this.add(n,r)}}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={coordArrayType:{configurable:!0}};return n.coordArrayType.get=function(){return new Array(0).fill(null)},e.prototype.getCoordinate=function(t){return this.get(t)},e.prototype.addAll=function(){if(2===arguments.length){for(var e=arguments[1],n=!1,r=arguments[0].iterator();r.hasNext();)this.add(r.next(),e),n=!0;return n}return t.prototype.addAll.apply(this,arguments)},e.prototype.clone=function(){for(var e=t.prototype.clone.call(this),n=0;n<this.size();n++)e.add(n,this.get(n).copy());return e},e.prototype.toCoordinateArray=function(){return this.toArray(e.coordArrayType)},e.prototype.add=function(){var e=this;if(1===arguments.length){var n=arguments[0];t.prototype.add.call(this,n)}else if(2===arguments.length){if(arguments[0]instanceof Array&&"boolean"==typeof arguments[1]){var r=arguments[0],i=arguments[1];return this.add(r,i,!0),!0}if(arguments[0]instanceof eE&&"boolean"==typeof arguments[1]){var o=arguments[0];if(!arguments[1])if(this.size()>=1)if(this.get(this.size()-1).equals2D(o))return null;t.prototype.add.call(this,o)}else if(arguments[0]instanceof Object&&"boolean"==typeof arguments[1]){var s=arguments[0],a=arguments[1];return this.add(s,a),!0}}else if(3===arguments.length){if("boolean"==typeof arguments[2]&&arguments[0]instanceof Array&&"boolean"==typeof arguments[1]){var u=arguments[0],l=arguments[1];if(arguments[2])for(var c=0;c<u.length;c++)e.add(u[c],l);else for(var h=u.length-1;h>=0;h--)e.add(u[h],l);return!0}if("boolean"==typeof arguments[2]&&Number.isInteger(arguments[0])&&arguments[1]instanceof eE){var f=arguments[0],p=arguments[1];if(!arguments[2]){var g=this.size();if(g>0){if(f>0)if(this.get(f-1).equals2D(p))return null;if(f<g)if(this.get(f).equals2D(p))return null}}t.prototype.add.call(this,f,p)}}else if(4===arguments.length){var A=arguments[0],d=arguments[1],y=arguments[2],v=arguments[3],m=1;y>v&&(m=-1);for(var _=y;_!==v;_+=m)e.add(A[_],d);return!0}},e.prototype.closeRing=function(){this.size()>0&&this.add(new eE(this.get(0)),!1)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},Object.defineProperties(e,n),e}(nx),ox=function(){},sx={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};sx.ForwardComparator.get=function(){return ax},sx.BidirectionalComparator.get=function(){return ux},sx.coordArrayType.get=function(){return new Array(0).fill(null)},ox.prototype.interfaces_=function(){return[]},ox.prototype.getClass=function(){return ox},ox.isRing=function(t){return!(t.length<4)&&!!t[0].equals2D(t[t.length-1])},ox.ptNotInList=function(t,e){for(var n=0;n<t.length;n++){var r=t[n];if(ox.indexOf(r,e)<0)return r}return null},ox.scroll=function(t,e){var n=ox.indexOf(e,t);if(n<0)return null;var r=new Array(t.length).fill(null);IE.arraycopy(t,n,r,0,t.length-n),IE.arraycopy(t,0,r,t.length-n,n),IE.arraycopy(r,0,t,0,t.length)},ox.equals=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];if(t===e)return!0;if(null===t||null===e)return!1;if(t.length!==e.length)return!1;for(var n=0;n<t.length;n++)if(!t[n].equals(e[n]))return!1;return!0}if(3===arguments.length){var r=arguments[0],i=arguments[1],o=arguments[2];if(r===i)return!0;if(null===r||null===i)return!1;if(r.length!==i.length)return!1;for(var s=0;s<r.length;s++)if(0!==o.compare(r[s],i[s]))return!1;return!0}},ox.intersection=function(t,e){for(var n=new ix,r=0;r<t.length;r++)e.intersects(t[r])&&n.add(t[r],!0);return n.toCoordinateArray()},ox.hasRepeatedPoints=function(t){for(var e=1;e<t.length;e++)if(t[e-1].equals(t[e]))return!0;return!1},ox.removeRepeatedPoints=function(t){return ox.hasRepeatedPoints(t)?new ix(t,!1).toCoordinateArray():t},ox.reverse=function(t){for(var e=t.length-1,n=Math.trunc(e/2),r=0;r<=n;r++){var i=t[r];t[r]=t[e-r],t[e-r]=i}},ox.removeNull=function(t){for(var e=0,n=0;n<t.length;n++)null!==t[n]&&e++;var r=new Array(e).fill(null);if(0===e)return r;for(var i=0,o=0;o<t.length;o++)null!==t[o]&&(r[i++]=t[o]);return r},ox.copyDeep=function(){if(1===arguments.length){for(var t=arguments[0],e=new Array(t.length).fill(null),n=0;n<t.length;n++)e[n]=new eE(t[n]);return e}if(5===arguments.length)for(var r=arguments[0],i=arguments[1],o=arguments[2],s=arguments[3],a=arguments[4],u=0;u<a;u++)o[s+u]=new eE(r[i+u])},ox.isEqualReversed=function(t,e){for(var n=0;n<t.length;n++){var r=t[n],i=e[t.length-n-1];if(0!==r.compareTo(i))return!1}return!0},ox.envelope=function(t){for(var e=new xE,n=0;n<t.length;n++)e.expandToInclude(t[n]);return e},ox.toCoordinateArray=function(t){return t.toArray(ox.coordArrayType)},ox.atLeastNCoordinatesOrNothing=function(t,e){return e.length>=t?e:[]},ox.indexOf=function(t,e){for(var n=0;n<e.length;n++)if(t.equals(e[n]))return n;return-1},ox.increasingDirection=function(t){for(var e=0;e<Math.trunc(t.length/2);e++){var n=t.length-1-e,r=t[e].compareTo(t[n]);if(0!==r)return r}return 1},ox.compare=function(t,e){for(var n=0;n<t.length&&n<e.length;){var r=t[n].compareTo(e[n]);if(0!==r)return r;n++}return n<e.length?-1:n<t.length?1:0},ox.minCoordinate=function(t){for(var e=null,n=0;n<t.length;n++)(null===e||e.compareTo(t[n])>0)&&(e=t[n]);return e},ox.extract=function(t,e,n){e=uE.clamp(e,0,t.length);var r=(n=uE.clamp(n,-1,t.length))-e+1;n<0&&(r=0),e>=t.length&&(r=0),n<e&&(r=0);var i=new Array(r).fill(null);if(0===r)return i;for(var o=0,s=e;s<=n;s++)i[o++]=t[s];return i},Object.defineProperties(ox,sx);var ax=function(){};ax.prototype.compare=function(t,e){return ox.compare(t,e)},ax.prototype.interfaces_=function(){return[$I]},ax.prototype.getClass=function(){return ax};var ux=function(){};ux.prototype.compare=function(t,e){var n=t,r=e;if(n.length<r.length)return-1;if(n.length>r.length)return 1;if(0===n.length)return 0;var i=ox.compare(n,r);return ox.isEqualReversed(n,r)?0:i},ux.prototype.OLDcompare=function(t,e){var n=t,r=e;if(n.length<r.length)return-1;if(n.length>r.length)return 1;if(0===n.length)return 0;for(var i=ox.increasingDirection(n),o=ox.increasingDirection(r),s=i>0?0:n.length-1,a=o>0?0:n.length-1,u=0;u<n.length;u++){var l=n[s].compareTo(r[a]);if(0!==l)return l;s+=i,a+=o}return 0},ux.prototype.interfaces_=function(){return[$I]},ux.prototype.getClass=function(){return ux};var lx=function(){};lx.prototype.get=function(){},lx.prototype.put=function(){},lx.prototype.size=function(){},lx.prototype.values=function(){},lx.prototype.entrySet=function(){};var cx=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(lx);function hx(t){this.message=t||""}function fx(){}hx.prototype=new Error,hx.prototype.name="OperationNotSupported",fx.prototype=new KE,fx.prototype.contains=function(){};var px=function(t){function e(){t.call(this),this.array_=[],arguments[0]instanceof KE&&this.addAll(arguments[0])}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.contains=function(t){for(var e=0,n=this.array_.length;e<n;e++){if(this.array_[e]===t)return!0}return!1},e.prototype.add=function(t){return!this.contains(t)&&(this.array_.push(t),!0)},e.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next());return!0},e.prototype.remove=function(t){throw new Error},e.prototype.size=function(){return this.array_.length},e.prototype.isEmpty=function(){return 0===this.array_.length},e.prototype.toArray=function(){for(var t=[],e=0,n=this.array_.length;e<n;e++)t.push(this.array_[e]);return t},e.prototype.iterator=function(){return new gx(this)},e}(fx),gx=function(t){function e(e){t.call(this),this.hashSet_=e,this.position_=0}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.next=function(){if(this.position_===this.hashSet_.size())throw new ex;return this.hashSet_.array_[this.position_++]},e.prototype.hasNext=function(){return this.position_<this.hashSet_.size()},e.prototype.remove=function(){throw new hx},e}($E);function Ax(t){return null===t?0:t.color}function dx(t){return null===t?null:t.parent}function yx(t,e){null!==t&&(t.color=e)}function vx(t){return null===t?null:t.left}function mx(t){return null===t?null:t.right}function _x(){this.root_=null,this.size_=0}_x.prototype=new cx,_x.prototype.get=function(t){for(var e=this.root_;null!==e;){var n=t.compareTo(e.key);if(n<0)e=e.left;else{if(!(n>0))return e.value;e=e.right}}return null},_x.prototype.put=function(t,e){if(null===this.root_)return this.root_={key:t,value:e,left:null,right:null,parent:null,color:0,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var n,r,i=this.root_;do{if(n=i,(r=t.compareTo(i.key))<0)i=i.left;else{if(!(r>0)){var o=i.value;return i.value=e,o}i=i.right}}while(null!==i);var s={key:t,left:null,right:null,value:e,parent:n,color:0,getValue:function(){return this.value},getKey:function(){return this.key}};return r<0?n.left=s:n.right=s,this.fixAfterInsertion(s),this.size_++,null},_x.prototype.fixAfterInsertion=function(t){var e=this;for(t.color=1;null!=t&&t!==this.root_&&1===t.parent.color;)if(dx(t)===vx(dx(dx(t)))){var n=mx(dx(dx(t)));1===Ax(n)?(yx(dx(t),0),yx(n,0),yx(dx(dx(t)),1),t=dx(dx(t))):(t===mx(dx(t))&&(t=dx(t),e.rotateLeft(t)),yx(dx(t),0),yx(dx(dx(t)),1),e.rotateRight(dx(dx(t))))}else{var r=vx(dx(dx(t)));1===Ax(r)?(yx(dx(t),0),yx(r,0),yx(dx(dx(t)),1),t=dx(dx(t))):(t===vx(dx(t))&&(t=dx(t),e.rotateRight(t)),yx(dx(t),0),yx(dx(dx(t)),1),e.rotateLeft(dx(dx(t))))}this.root_.color=0},_x.prototype.values=function(){var t=new nx,e=this.getFirstEntry();if(null!==e)for(t.add(e.value);null!==(e=_x.successor(e));)t.add(e.value);return t},_x.prototype.entrySet=function(){var t=new px,e=this.getFirstEntry();if(null!==e)for(t.add(e);null!==(e=_x.successor(e));)t.add(e);return t},_x.prototype.rotateLeft=function(t){if(null!=t){var e=t.right;t.right=e.left,null!=e.left&&(e.left.parent=t),e.parent=t.parent,null===t.parent?this.root_=e:t.parent.left===t?t.parent.left=e:t.parent.right=e,e.left=t,t.parent=e}},_x.prototype.rotateRight=function(t){if(null!=t){var e=t.left;t.left=e.right,null!=e.right&&(e.right.parent=t),e.parent=t.parent,null===t.parent?this.root_=e:t.parent.right===t?t.parent.right=e:t.parent.left=e,e.right=t,t.parent=e}},_x.prototype.getFirstEntry=function(){var t=this.root_;if(null!=t)for(;null!=t.left;)t=t.left;return t},_x.successor=function(t){if(null===t)return null;if(null!==t.right){for(var e=t.right;null!==e.left;)e=e.left;return e}for(var n=t.parent,r=t;null!==n&&r===n.right;)r=n,n=n.parent;return n},_x.prototype.size=function(){return this.size_};var Ix=function(){};function Ex(){}function xx(){this.array_=[],arguments[0]instanceof KE&&this.addAll(arguments[0])}Ix.prototype.interfaces_=function(){return[]},Ix.prototype.getClass=function(){return Ix},Ex.prototype=new fx,xx.prototype=new Ex,xx.prototype.contains=function(t){for(var e=0,n=this.array_.length;e<n;e++){if(0===this.array_[e].compareTo(t))return!0}return!1},xx.prototype.add=function(t){if(this.contains(t))return!1;for(var e=0,n=this.array_.length;e<n;e++){if(1===this.array_[e].compareTo(t))return this.array_.splice(e,0,t),!0}return this.array_.push(t),!0},xx.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next());return!0},xx.prototype.remove=function(t){throw new hx},xx.prototype.size=function(){return this.array_.length},xx.prototype.isEmpty=function(){return 0===this.array_.length},xx.prototype.toArray=function(){for(var t=[],e=0,n=this.array_.length;e<n;e++)t.push(this.array_[e]);return t},xx.prototype.iterator=function(){return new Cx(this)};var Cx=function(t){this.treeSet_=t,this.position_=0};Cx.prototype.next=function(){if(this.position_===this.treeSet_.size())throw new ex;return this.treeSet_.array_[this.position_++]},Cx.prototype.hasNext=function(){return this.position_<this.treeSet_.size()},Cx.prototype.remove=function(){throw new hx};var wx=function(){};wx.sort=function(){var t,e,n,r,i=arguments[0];if(1===arguments.length)r=function(t,e){return t.compareTo(e)},i.sort(r);else if(2===arguments.length)n=arguments[1],r=function(t,e){return n.compare(t,e)},i.sort(r);else if(3===arguments.length){(e=i.slice(arguments[1],arguments[2])).sort();var o=i.slice(0,arguments[1]).concat(e,i.slice(arguments[2],i.length));for(i.splice(0,i.length),t=0;t<o.length;t++)i.push(o[t])}else if(4===arguments.length)for(e=i.slice(arguments[1],arguments[2]),n=arguments[3],r=function(t,e){return n.compare(t,e)},e.sort(r),o=i.slice(0,arguments[1]).concat(e,i.slice(arguments[2],i.length)),i.splice(0,i.length),t=0;t<o.length;t++)i.push(o[t])},wx.asList=function(t){for(var e=new nx,n=0,r=t.length;n<r;n++)e.add(t[n]);return e};var bx=function(){},Bx={P:{configurable:!0},L:{configurable:!0},A:{configurable:!0},FALSE:{configurable:!0},TRUE:{configurable:!0},DONTCARE:{configurable:!0},SYM_FALSE:{configurable:!0},SYM_TRUE:{configurable:!0},SYM_DONTCARE:{configurable:!0},SYM_P:{configurable:!0},SYM_L:{configurable:!0},SYM_A:{configurable:!0}};Bx.P.get=function(){return 0},Bx.L.get=function(){return 1},Bx.A.get=function(){return 2},Bx.FALSE.get=function(){return-1},Bx.TRUE.get=function(){return-2},Bx.DONTCARE.get=function(){return-3},Bx.SYM_FALSE.get=function(){return"F"},Bx.SYM_TRUE.get=function(){return"T"},Bx.SYM_DONTCARE.get=function(){return"*"},Bx.SYM_P.get=function(){return"0"},Bx.SYM_L.get=function(){return"1"},Bx.SYM_A.get=function(){return"2"},bx.prototype.interfaces_=function(){return[]},bx.prototype.getClass=function(){return bx},bx.toDimensionSymbol=function(t){switch(t){case bx.FALSE:return bx.SYM_FALSE;case bx.TRUE:return bx.SYM_TRUE;case bx.DONTCARE:return bx.SYM_DONTCARE;case bx.P:return bx.SYM_P;case bx.L:return bx.SYM_L;case bx.A:return bx.SYM_A}throw new XI("Unknown dimension value: "+t)},bx.toDimensionValue=function(t){switch(fE.toUpperCase(t)){case bx.SYM_FALSE:return bx.FALSE;case bx.SYM_TRUE:return bx.TRUE;case bx.SYM_DONTCARE:return bx.DONTCARE;case bx.SYM_P:return bx.P;case bx.SYM_L:return bx.L;case bx.SYM_A:return bx.A}throw new XI("Unknown dimension symbol: "+t)},Object.defineProperties(bx,Bx);var Sx=function(){};Sx.prototype.filter=function(t){},Sx.prototype.interfaces_=function(){return[]},Sx.prototype.getClass=function(){return Sx};var Mx=function(){};Mx.prototype.filter=function(t,e){},Mx.prototype.isDone=function(){},Mx.prototype.isGeometryChanged=function(){},Mx.prototype.interfaces_=function(){return[]},Mx.prototype.getClass=function(){return Mx};var Lx=function(t){function e(e,n){if(t.call(this,n),this._geometries=e||[],t.hasNullElements(this._geometries))throw new XI("geometries must not contain null elements")}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={serialVersionUID:{configurable:!0}};return e.prototype.computeEnvelopeInternal=function(){for(var t=new xE,e=0;e<this._geometries.length;e++)t.expandToInclude(this._geometries[e].getEnvelopeInternal());return t},e.prototype.getGeometryN=function(t){return this._geometries[t]},e.prototype.getSortIndex=function(){return t.SORTINDEX_GEOMETRYCOLLECTION},e.prototype.getCoordinates=function(){for(var t=new Array(this.getNumPoints()).fill(null),e=-1,n=0;n<this._geometries.length;n++)for(var r=this._geometries[n].getCoordinates(),i=0;i<r.length;i++)t[++e]=r[i];return t},e.prototype.getArea=function(){for(var t=0,e=0;e<this._geometries.length;e++)t+=this._geometries[e].getArea();return t},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],n=arguments[1];if(!this.isEquivalentClass(e))return!1;var r=e;if(this._geometries.length!==r._geometries.length)return!1;for(var i=0;i<this._geometries.length;i++)if(!this._geometries[i].equalsExact(r._geometries[i],n))return!1;return!0}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.normalize=function(){for(var t=0;t<this._geometries.length;t++)this._geometries[t].normalize();wx.sort(this._geometries)},e.prototype.getCoordinate=function(){return this.isEmpty()?null:this._geometries[0].getCoordinate()},e.prototype.getBoundaryDimension=function(){for(var t=bx.FALSE,e=0;e<this._geometries.length;e++)t=Math.max(t,this._geometries[e].getBoundaryDimension());return t},e.prototype.getDimension=function(){for(var t=bx.FALSE,e=0;e<this._geometries.length;e++)t=Math.max(t,this._geometries[e].getDimension());return t},e.prototype.getLength=function(){for(var t=0,e=0;e<this._geometries.length;e++)t+=this._geometries[e].getLength();return t},e.prototype.getNumPoints=function(){for(var t=0,e=0;e<this._geometries.length;e++)t+=this._geometries[e].getNumPoints();return t},e.prototype.getNumGeometries=function(){return this._geometries.length},e.prototype.reverse=function(){for(var t=this._geometries.length,e=new Array(t).fill(null),n=0;n<this._geometries.length;n++)e[n]=this._geometries[n].reverse();return this.getFactory().createGeometryCollection(e)},e.prototype.compareToSameClass=function(){if(1===arguments.length){var t=arguments[0],e=new xx(wx.asList(this._geometries)),n=new xx(wx.asList(t._geometries));return this.compare(e,n)}if(2===arguments.length){for(var r=arguments[1],i=arguments[0],o=this.getNumGeometries(),s=i.getNumGeometries(),a=0;a<o&&a<s;){var u=this.getGeometryN(a),l=i.getGeometryN(a),c=u.compareToSameClass(l,r);if(0!==c)return c;a++}return a<o?1:a<s?-1:0}},e.prototype.apply=function(){var t=this;if(aE(arguments[0],zE))for(var e=arguments[0],n=0;n<this._geometries.length;n++)t._geometries[n].apply(e);else if(aE(arguments[0],Mx)){var r=arguments[0];if(0===this._geometries.length)return null;for(var i=0;i<this._geometries.length&&(t._geometries[i].apply(r),!r.isDone());i++);r.isGeometryChanged()&&this.geometryChanged()}else if(aE(arguments[0],Sx)){var o=arguments[0];o.filter(this);for(var s=0;s<this._geometries.length;s++)t._geometries[s].apply(o)}else if(aE(arguments[0],GE)){var a=arguments[0];a.filter(this);for(var u=0;u<this._geometries.length;u++)t._geometries[u].apply(a)}},e.prototype.getBoundary=function(){return this.checkNotGeometryCollection(this),TE.shouldNeverReachHere(),null},e.prototype.clone=function(){var e=t.prototype.clone.call(this);e._geometries=new Array(this._geometries.length).fill(null);for(var n=0;n<this._geometries.length;n++)e._geometries[n]=this._geometries[n].clone();return e},e.prototype.getGeometryType=function(){return"GeometryCollection"},e.prototype.copy=function(){for(var t=new Array(this._geometries.length).fill(null),n=0;n<t.length;n++)t[n]=this._geometries[n].copy();return new e(t,this._factory)},e.prototype.isEmpty=function(){for(var t=0;t<this._geometries.length;t++)if(!this._geometries[t].isEmpty())return!1;return!0},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},n.serialVersionUID.get=function(){return-0x4f07bcb1f857d800},Object.defineProperties(e,n),e}(UE),Nx=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return UE.SORTINDEX_MULTILINESTRING},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],n=arguments[1];return!!this.isEquivalentClass(e)&&t.prototype.equalsExact.call(this,e,n)}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.getBoundaryDimension=function(){return this.isClosed()?bx.FALSE:0},e.prototype.isClosed=function(){if(this.isEmpty())return!1;for(var t=0;t<this._geometries.length;t++)if(!this._geometries[t].isClosed())return!1;return!0},e.prototype.getDimension=function(){return 1},e.prototype.reverse=function(){for(var t=this._geometries.length,e=new Array(t).fill(null),n=0;n<this._geometries.length;n++)e[t-1-n]=this._geometries[n].reverse();return this.getFactory().createMultiLineString(e)},e.prototype.getBoundary=function(){return new Tx(this).getBoundary()},e.prototype.getGeometryType=function(){return"MultiLineString"},e.prototype.copy=function(){for(var t=new Array(this._geometries.length).fill(null),n=0;n<t.length;n++)t[n]=this._geometries[n].copy();return new e(t,this._factory)},e.prototype.interfaces_=function(){return[Ix]},e.prototype.getClass=function(){return e},n.serialVersionUID.get=function(){return 0x7155d2ab4afa8000},Object.defineProperties(e,n),e}(Lx),Tx=function(){if(this._geom=null,this._geomFact=null,this._bnRule=null,this._endpointMap=null,1===arguments.length){var t=arguments[0],e=VE.MOD2_BOUNDARY_RULE;this._geom=t,this._geomFact=t.getFactory(),this._bnRule=e}else if(2===arguments.length){var n=arguments[0],r=arguments[1];this._geom=n,this._geomFact=n.getFactory(),this._bnRule=r}};Tx.prototype.boundaryMultiLineString=function(t){if(this._geom.isEmpty())return this.getEmptyMultiPoint();var e=this.computeBoundaryCoordinates(t);return 1===e.length?this._geomFact.createPoint(e[0]):this._geomFact.createMultiPointFromCoords(e)},Tx.prototype.getBoundary=function(){return this._geom instanceof jx?this.boundaryLineString(this._geom):this._geom instanceof Nx?this.boundaryMultiLineString(this._geom):this._geom.getBoundary()},Tx.prototype.boundaryLineString=function(t){return this._geom.isEmpty()?this.getEmptyMultiPoint():t.isClosed()?this._bnRule.isInBoundary(2)?t.getStartPoint():this._geomFact.createMultiPoint():this._geomFact.createMultiPoint([t.getStartPoint(),t.getEndPoint()])},Tx.prototype.getEmptyMultiPoint=function(){return this._geomFact.createMultiPoint()},Tx.prototype.computeBoundaryCoordinates=function(t){var e=this,n=new nx;this._endpointMap=new _x;for(var r=0;r<t.getNumGeometries();r++){var i=t.getGeometryN(r);0!==i.getNumPoints()&&(e.addEndpoint(i.getCoordinateN(0)),e.addEndpoint(i.getCoordinateN(i.getNumPoints()-1)))}for(var o=this._endpointMap.entrySet().iterator();o.hasNext();){var s=o.next(),a=s.getValue().count;e._bnRule.isInBoundary(a)&&n.add(s.getKey())}return ox.toCoordinateArray(n)},Tx.prototype.addEndpoint=function(t){var e=this._endpointMap.get(t);null===e&&(e=new Rx,this._endpointMap.put(t,e)),e.count++},Tx.prototype.interfaces_=function(){return[]},Tx.prototype.getClass=function(){return Tx},Tx.getBoundary=function(){return 1===arguments.length?new Tx(arguments[0]).getBoundary():2===arguments.length?new Tx(arguments[0],arguments[1]).getBoundary():void 0};var Rx=function(){this.count=null};function Qx(){}function Dx(){}Rx.prototype.interfaces_=function(){return[]},Rx.prototype.getClass=function(){return Rx};var Px=function(){};function kx(){}function Ox(){}function Fx(){}var Gx=function(){},Ux={NEWLINE:{configurable:!0},SIMPLE_ORDINATE_FORMAT:{configurable:!0}};Gx.prototype.interfaces_=function(){return[]},Gx.prototype.getClass=function(){return Gx},Gx.chars=function(t,e){for(var n=new Array(e).fill(null),r=0;r<e;r++)n[r]=t;return String(n)},Gx.getStackTrace=function(){if(1===arguments.length){var t=arguments[0],e=new kx,n=new Qx;return t.printStackTrace(n),e.toString()}if(2===arguments.length){var r=arguments[1],i="";new Dx(Gx.getStackTrace(arguments[0]));for(var o=new Fx,s=0;s<r;s++)try{i+=o.readLine()+Gx.NEWLINE}catch(t){if(!(t instanceof Ox))throw t;TE.shouldNeverReachHere()}return i}},Gx.split=function(t,e){for(var n=e.length,r=new nx,i=""+t,o=i.indexOf(e);o>=0;){var s=i.substring(0,o);r.add(s),o=(i=i.substring(o+n)).indexOf(e)}i.length>0&&r.add(i);for(var a=new Array(r.size()).fill(null),u=0;u<a.length;u++)a[u]=r.get(u);return a},Gx.toString=function(){if(1===arguments.length){var t=arguments[0];return Gx.SIMPLE_ORDINATE_FORMAT.format(t)}},Gx.spaces=function(t){return Gx.chars(" ",t)},Ux.NEWLINE.get=function(){return IE.getProperty("line.separator")},Ux.SIMPLE_ORDINATE_FORMAT.get=function(){return new Px},Object.defineProperties(Gx,Ux);var qx=function(){};qx.prototype.interfaces_=function(){return[]},qx.prototype.getClass=function(){return qx},qx.copyCoord=function(t,e,n,r){for(var i=Math.min(t.getDimension(),n.getDimension()),o=0;o<i;o++)n.setOrdinate(r,o,t.getOrdinate(e,o))},qx.isRing=function(t){var e=t.size();return 0===e||!(e<=3)&&(t.getOrdinate(0,yE.X)===t.getOrdinate(e-1,yE.X)&&t.getOrdinate(0,yE.Y)===t.getOrdinate(e-1,yE.Y))},qx.isEqual=function(t,e){var n=t.size();if(n!==e.size())return!1;for(var r=Math.min(t.getDimension(),e.getDimension()),i=0;i<n;i++)for(var o=0;o<r;o++){var s=t.getOrdinate(i,o),a=e.getOrdinate(i,o);if(t.getOrdinate(i,o)!==e.getOrdinate(i,o)&&(!JI.isNaN(s)||!JI.isNaN(a)))return!1}return!0},qx.extend=function(t,e,n){var r=t.create(n,e.getDimension()),i=e.size();if(qx.copy(e,0,r,0,i),i>0)for(var o=i;o<n;o++)qx.copy(e,i-1,r,o,1);return r},qx.reverse=function(t){for(var e=t.size()-1,n=Math.trunc(e/2),r=0;r<=n;r++)qx.swap(t,r,e-r)},qx.swap=function(t,e,n){if(e===n)return null;for(var r=0;r<t.getDimension();r++){var i=t.getOrdinate(e,r);t.setOrdinate(e,r,t.getOrdinate(n,r)),t.setOrdinate(n,r,i)}},qx.copy=function(t,e,n,r,i){for(var o=0;o<i;o++)qx.copyCoord(t,e+o,n,r+o)},qx.toString=function(){if(1===arguments.length){var t=arguments[0],e=t.size();if(0===e)return"()";var n=t.getDimension(),r=new cE;r.append("(");for(var i=0;i<e;i++){i>0&&r.append(" ");for(var o=0;o<n;o++)o>0&&r.append(","),r.append(Gx.toString(t.getOrdinate(i,o)))}return r.append(")"),r.toString()}},qx.ensureValidRing=function(t,e){var n=e.size();return 0===n?e:n<=3?qx.createClosedRing(t,e,4):e.getOrdinate(0,yE.X)===e.getOrdinate(n-1,yE.X)&&e.getOrdinate(0,yE.Y)===e.getOrdinate(n-1,yE.Y)?e:qx.createClosedRing(t,e,n+1)},qx.createClosedRing=function(t,e,n){var r=t.create(n,e.getDimension()),i=e.size();qx.copy(e,0,r,0,i);for(var o=i;o<n;o++)qx.copy(e,0,r,o,1);return r};var jx=function(t){function e(e,n){t.call(this,n),this._points=null,this.init(e)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={serialVersionUID:{configurable:!0}};return e.prototype.computeEnvelopeInternal=function(){return this.isEmpty()?new xE:this._points.expandEnvelope(new xE)},e.prototype.isRing=function(){return this.isClosed()&&this.isSimple()},e.prototype.getSortIndex=function(){return t.SORTINDEX_LINESTRING},e.prototype.getCoordinates=function(){return this._points.toCoordinateArray()},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],n=arguments[1];if(!this.isEquivalentClass(e))return!1;var r=e;if(this._points.size()!==r._points.size())return!1;for(var i=0;i<this._points.size();i++)if(!this.equal(this._points.getCoordinate(i),r._points.getCoordinate(i),n))return!1;return!0}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.normalize=function(){for(var t=this,e=0;e<Math.trunc(this._points.size()/2);e++){var n=t._points.size()-1-e;if(!t._points.getCoordinate(e).equals(t._points.getCoordinate(n)))return t._points.getCoordinate(e).compareTo(t._points.getCoordinate(n))>0&&qx.reverse(t._points),null}},e.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},e.prototype.getBoundaryDimension=function(){return this.isClosed()?bx.FALSE:0},e.prototype.isClosed=function(){return!this.isEmpty()&&this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints()-1))},e.prototype.getEndPoint=function(){return this.isEmpty()?null:this.getPointN(this.getNumPoints()-1)},e.prototype.getDimension=function(){return 1},e.prototype.getLength=function(){return OE.computeLength(this._points)},e.prototype.getNumPoints=function(){return this._points.size()},e.prototype.reverse=function(){var t=this._points.copy();return qx.reverse(t),this.getFactory().createLineString(t)},e.prototype.compareToSameClass=function(){if(1===arguments.length){for(var t=arguments[0],e=0,n=0;e<this._points.size()&&n<t._points.size();){var r=this._points.getCoordinate(e).compareTo(t._points.getCoordinate(n));if(0!==r)return r;e++,n++}return e<this._points.size()?1:n<t._points.size()?-1:0}if(2===arguments.length){var i=arguments[0];return arguments[1].compare(this._points,i._points)}},e.prototype.apply=function(){if(aE(arguments[0],zE))for(var t=arguments[0],e=0;e<this._points.size();e++)t.filter(this._points.getCoordinate(e));else if(aE(arguments[0],Mx)){var n=arguments[0];if(0===this._points.size())return null;for(var r=0;r<this._points.size()&&(n.filter(this._points,r),!n.isDone());r++);n.isGeometryChanged()&&this.geometryChanged()}else if(aE(arguments[0],Sx)){arguments[0].filter(this)}else if(aE(arguments[0],GE)){arguments[0].filter(this)}},e.prototype.getBoundary=function(){return new Tx(this).getBoundary()},e.prototype.isEquivalentClass=function(t){return t instanceof e},e.prototype.clone=function(){var e=t.prototype.clone.call(this);return e._points=this._points.clone(),e},e.prototype.getCoordinateN=function(t){return this._points.getCoordinate(t)},e.prototype.getGeometryType=function(){return"LineString"},e.prototype.copy=function(){return new e(this._points.copy(),this._factory)},e.prototype.getCoordinateSequence=function(){return this._points},e.prototype.isEmpty=function(){return 0===this._points.size()},e.prototype.init=function(t){if(null===t&&(t=this.getFactory().getCoordinateSequenceFactory().create([])),1===t.size())throw new XI("Invalid number of points in LineString (found "+t.size()+" - must be 0 or >= 2)");this._points=t},e.prototype.isCoordinate=function(t){for(var e=0;e<this._points.size();e++)if(this._points.getCoordinate(e).equals(t))return!0;return!1},e.prototype.getStartPoint=function(){return this.isEmpty()?null:this.getPointN(0)},e.prototype.getPointN=function(t){return this.getFactory().createPoint(this._points.getCoordinate(t))},e.prototype.interfaces_=function(){return[Ix]},e.prototype.getClass=function(){return e},n.serialVersionUID.get=function(){return 0x2b2b51ba435c8e00},Object.defineProperties(e,n),e}(UE),zx=function(){};zx.prototype.interfaces_=function(){return[]},zx.prototype.getClass=function(){return zx};var Vx=function(t){function e(e,n){t.call(this,n),this._coordinates=e||null,this.init(this._coordinates)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={serialVersionUID:{configurable:!0}};return e.prototype.computeEnvelopeInternal=function(){if(this.isEmpty())return new xE;var t=new xE;return t.expandToInclude(this._coordinates.getX(0),this._coordinates.getY(0)),t},e.prototype.getSortIndex=function(){return t.SORTINDEX_POINT},e.prototype.getCoordinates=function(){return this.isEmpty()?[]:[this.getCoordinate()]},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],n=arguments[1];return!!this.isEquivalentClass(e)&&(!(!this.isEmpty()||!e.isEmpty())||this.isEmpty()===e.isEmpty()&&this.equal(e.getCoordinate(),this.getCoordinate(),n))}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.normalize=function(){},e.prototype.getCoordinate=function(){return 0!==this._coordinates.size()?this._coordinates.getCoordinate(0):null},e.prototype.getBoundaryDimension=function(){return bx.FALSE},e.prototype.getDimension=function(){return 0},e.prototype.getNumPoints=function(){return this.isEmpty()?0:1},e.prototype.reverse=function(){return this.copy()},e.prototype.getX=function(){if(null===this.getCoordinate())throw new Error("getX called on empty Point");return this.getCoordinate().x},e.prototype.compareToSameClass=function(){if(1===arguments.length){var t=arguments[0];return this.getCoordinate().compareTo(t.getCoordinate())}if(2===arguments.length){var e=arguments[0];return arguments[1].compare(this._coordinates,e._coordinates)}},e.prototype.apply=function(){if(aE(arguments[0],zE)){var t=arguments[0];if(this.isEmpty())return null;t.filter(this.getCoordinate())}else if(aE(arguments[0],Mx)){var e=arguments[0];if(this.isEmpty())return null;e.filter(this._coordinates,0),e.isGeometryChanged()&&this.geometryChanged()}else if(aE(arguments[0],Sx)){arguments[0].filter(this)}else if(aE(arguments[0],GE)){arguments[0].filter(this)}},e.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},e.prototype.clone=function(){var e=t.prototype.clone.call(this);return e._coordinates=this._coordinates.clone(),e},e.prototype.getGeometryType=function(){return"Point"},e.prototype.copy=function(){return new e(this._coordinates.copy(),this._factory)},e.prototype.getCoordinateSequence=function(){return this._coordinates},e.prototype.getY=function(){if(null===this.getCoordinate())throw new Error("getY called on empty Point");return this.getCoordinate().y},e.prototype.isEmpty=function(){return 0===this._coordinates.size()},e.prototype.init=function(t){null===t&&(t=this.getFactory().getCoordinateSequenceFactory().create([])),TE.isTrue(t.size()<=1),this._coordinates=t},e.prototype.isSimple=function(){return!0},e.prototype.interfaces_=function(){return[zx]},e.prototype.getClass=function(){return e},n.serialVersionUID.get=function(){return 0x44077bad161cbc00},Object.defineProperties(e,n),e}(UE),Yx=function(){};Yx.prototype.interfaces_=function(){return[]},Yx.prototype.getClass=function(){return Yx};var Hx=function(t){function e(e,n,r){if(t.call(this,r),this._shell=null,this._holes=null,null===e&&(e=this.getFactory().createLinearRing()),null===n&&(n=[]),t.hasNullElements(n))throw new XI("holes must not contain null elements");if(e.isEmpty()&&t.hasNonEmptyElements(n))throw new XI("shell is empty but holes are not");this._shell=e,this._holes=n}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={serialVersionUID:{configurable:!0}};return e.prototype.computeEnvelopeInternal=function(){return this._shell.getEnvelopeInternal()},e.prototype.getSortIndex=function(){return t.SORTINDEX_POLYGON},e.prototype.getCoordinates=function(){if(this.isEmpty())return[];for(var t=new Array(this.getNumPoints()).fill(null),e=-1,n=this._shell.getCoordinates(),r=0;r<n.length;r++)t[++e]=n[r];for(var i=0;i<this._holes.length;i++)for(var o=this._holes[i].getCoordinates(),s=0;s<o.length;s++)t[++e]=o[s];return t},e.prototype.getArea=function(){var t=0;t+=Math.abs(OE.signedArea(this._shell.getCoordinateSequence()));for(var e=0;e<this._holes.length;e++)t-=Math.abs(OE.signedArea(this._holes[e].getCoordinateSequence()));return t},e.prototype.isRectangle=function(){if(0!==this.getNumInteriorRing())return!1;if(null===this._shell)return!1;if(5!==this._shell.getNumPoints())return!1;for(var t=this._shell.getCoordinateSequence(),e=this.getEnvelopeInternal(),n=0;n<5;n++){var r=t.getX(n);if(r!==e.getMinX()&&r!==e.getMaxX())return!1;var i=t.getY(n);if(i!==e.getMinY()&&i!==e.getMaxY())return!1}for(var o=t.getX(0),s=t.getY(0),a=1;a<=4;a++){var u=t.getX(a),l=t.getY(a);if(u!==o===(l!==s))return!1;o=u,s=l}return!0},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],n=arguments[1];if(!this.isEquivalentClass(e))return!1;var r=e,i=this._shell,o=r._shell;if(!i.equalsExact(o,n))return!1;if(this._holes.length!==r._holes.length)return!1;for(var s=0;s<this._holes.length;s++)if(!this._holes[s].equalsExact(r._holes[s],n))return!1;return!0}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.normalize=function(){if(0===arguments.length){this.normalize(this._shell,!0);for(var t=0;t<this._holes.length;t++)this.normalize(this._holes[t],!1);wx.sort(this._holes)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];if(e.isEmpty())return null;var r=new Array(e.getCoordinates().length-1).fill(null);IE.arraycopy(e.getCoordinates(),0,r,0,r.length);var i=ox.minCoordinate(e.getCoordinates());ox.scroll(r,i),IE.arraycopy(r,0,e.getCoordinates(),0,r.length),e.getCoordinates()[r.length]=r[0],OE.isCCW(e.getCoordinates())===n&&ox.reverse(e.getCoordinates())}},e.prototype.getCoordinate=function(){return this._shell.getCoordinate()},e.prototype.getNumInteriorRing=function(){return this._holes.length},e.prototype.getBoundaryDimension=function(){return 1},e.prototype.getDimension=function(){return 2},e.prototype.getLength=function(){var t=0;t+=this._shell.getLength();for(var e=0;e<this._holes.length;e++)t+=this._holes[e].getLength();return t},e.prototype.getNumPoints=function(){for(var t=this._shell.getNumPoints(),e=0;e<this._holes.length;e++)t+=this._holes[e].getNumPoints();return t},e.prototype.reverse=function(){var t=this.copy();t._shell=this._shell.copy().reverse(),t._holes=new Array(this._holes.length).fill(null);for(var e=0;e<this._holes.length;e++)t._holes[e]=this._holes[e].copy().reverse();return t},e.prototype.convexHull=function(){return this.getExteriorRing().convexHull()},e.prototype.compareToSameClass=function(){if(1===arguments.length){var t=arguments[0],e=this._shell,n=t._shell;return e.compareToSameClass(n)}if(2===arguments.length){var r=arguments[1],i=arguments[0],o=this._shell,s=i._shell,a=o.compareToSameClass(s,r);if(0!==a)return a;for(var u=this.getNumInteriorRing(),l=i.getNumInteriorRing(),c=0;c<u&&c<l;){var h=this.getInteriorRingN(c),f=i.getInteriorRingN(c),p=h.compareToSameClass(f,r);if(0!==p)return p;c++}return c<u?1:c<l?-1:0}},e.prototype.apply=function(t){var e=this;if(aE(t,zE)){this._shell.apply(t);for(var n=0;n<this._holes.length;n++)e._holes[n].apply(t)}else if(aE(t,Mx)){if(this._shell.apply(t),!t.isDone())for(var r=0;r<this._holes.length&&(e._holes[r].apply(t),!t.isDone());r++);t.isGeometryChanged()&&this.geometryChanged()}else if(aE(t,Sx))t.filter(this);else if(aE(t,GE)){t.filter(this),this._shell.apply(t);for(var i=0;i<this._holes.length;i++)e._holes[i].apply(t)}},e.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();var t=new Array(this._holes.length+1).fill(null);t[0]=this._shell;for(var e=0;e<this._holes.length;e++)t[e+1]=this._holes[e];return t.length<=1?this.getFactory().createLinearRing(t[0].getCoordinateSequence()):this.getFactory().createMultiLineString(t)},e.prototype.clone=function(){var e=t.prototype.clone.call(this);e._shell=this._shell.clone(),e._holes=new Array(this._holes.length).fill(null);for(var n=0;n<this._holes.length;n++)e._holes[n]=this._holes[n].clone();return e},e.prototype.getGeometryType=function(){return"Polygon"},e.prototype.copy=function(){for(var t=this._shell.copy(),n=new Array(this._holes.length).fill(null),r=0;r<n.length;r++)n[r]=this._holes[r].copy();return new e(t,n,this._factory)},e.prototype.getExteriorRing=function(){return this._shell},e.prototype.isEmpty=function(){return this._shell.isEmpty()},e.prototype.getInteriorRingN=function(t){return this._holes[t]},e.prototype.interfaces_=function(){return[Yx]},e.prototype.getClass=function(){return e},n.serialVersionUID.get=function(){return-0x307ffefd8dc97200},Object.defineProperties(e,n),e}(UE),Xx=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return UE.SORTINDEX_MULTIPOINT},e.prototype.isValid=function(){return!0},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],n=arguments[1];return!!this.isEquivalentClass(e)&&t.prototype.equalsExact.call(this,e,n)}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.getCoordinate=function(){if(1===arguments.length){var e=arguments[0];return this._geometries[e].getCoordinate()}return t.prototype.getCoordinate.apply(this,arguments)},e.prototype.getBoundaryDimension=function(){return bx.FALSE},e.prototype.getDimension=function(){return 0},e.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},e.prototype.getGeometryType=function(){return"MultiPoint"},e.prototype.copy=function(){for(var t=new Array(this._geometries.length).fill(null),n=0;n<t.length;n++)t[n]=this._geometries[n].copy();return new e(t,this._factory)},e.prototype.interfaces_=function(){return[zx]},e.prototype.getClass=function(){return e},n.serialVersionUID.get=function(){return-0x6fb1ed4162e0fc00},Object.defineProperties(e,n),e}(Lx),Jx=function(t){function e(e,n){e instanceof eE&&n instanceof hC&&(e=n.getCoordinateSequenceFactory().create(e)),t.call(this,e,n),this.validateConstruction()}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={MINIMUM_VALID_SIZE:{configurable:!0},serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return UE.SORTINDEX_LINEARRING},e.prototype.getBoundaryDimension=function(){return bx.FALSE},e.prototype.isClosed=function(){return!!this.isEmpty()||t.prototype.isClosed.call(this)},e.prototype.reverse=function(){var t=this._points.copy();return qx.reverse(t),this.getFactory().createLinearRing(t)},e.prototype.validateConstruction=function(){if(!this.isEmpty()&&!t.prototype.isClosed.call(this))throw new XI("Points of LinearRing do not form a closed linestring");if(this.getCoordinateSequence().size()>=1&&this.getCoordinateSequence().size()<e.MINIMUM_VALID_SIZE)throw new XI("Invalid number of points in LinearRing (found "+this.getCoordinateSequence().size()+" - must be 0 or >= 4)")},e.prototype.getGeometryType=function(){return"LinearRing"},e.prototype.copy=function(){return new e(this._points.copy(),this._factory)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},n.MINIMUM_VALID_SIZE.get=function(){return 4},n.serialVersionUID.get=function(){return-0x3b229e262367a600},Object.defineProperties(e,n),e}(jx),Wx=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return UE.SORTINDEX_MULTIPOLYGON},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],n=arguments[1];return!!this.isEquivalentClass(e)&&t.prototype.equalsExact.call(this,e,n)}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.getBoundaryDimension=function(){return 1},e.prototype.getDimension=function(){return 2},e.prototype.reverse=function(){for(var t=this._geometries.length,e=new Array(t).fill(null),n=0;n<this._geometries.length;n++)e[n]=this._geometries[n].reverse();return this.getFactory().createMultiPolygon(e)},e.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();for(var t=new nx,e=0;e<this._geometries.length;e++)for(var n=this._geometries[e].getBoundary(),r=0;r<n.getNumGeometries();r++)t.add(n.getGeometryN(r));var i=new Array(t.size()).fill(null);return this.getFactory().createMultiLineString(t.toArray(i))},e.prototype.getGeometryType=function(){return"MultiPolygon"},e.prototype.copy=function(){for(var t=new Array(this._geometries.length).fill(null),n=0;n<t.length;n++)t[n]=this._geometries[n].copy();return new e(t,this._factory)},e.prototype.interfaces_=function(){return[Yx]},e.prototype.getClass=function(){return e},n.serialVersionUID.get=function(){return-0x7a5aa1369171980},Object.defineProperties(e,n),e}(Lx),Kx=function(t){this._factory=t||null,this._isUserDataCopied=!1},Zx={NoOpGeometryOperation:{configurable:!0},CoordinateOperation:{configurable:!0},CoordinateSequenceOperation:{configurable:!0}};Kx.prototype.setCopyUserData=function(t){this._isUserDataCopied=t},Kx.prototype.edit=function(t,e){if(null===t)return null;var n=this.editInternal(t,e);return this._isUserDataCopied&&n.setUserData(t.getUserData()),n},Kx.prototype.editInternal=function(t,e){return null===this._factory&&(this._factory=t.getFactory()),t instanceof Lx?this.editGeometryCollection(t,e):t instanceof Hx?this.editPolygon(t,e):t instanceof Vx||t instanceof jx?e.edit(t,this._factory):(TE.shouldNeverReachHere("Unsupported Geometry class: "+t.getClass().getName()),null)},Kx.prototype.editGeometryCollection=function(t,e){for(var n=e.edit(t,this._factory),r=new nx,i=0;i<n.getNumGeometries();i++){var o=this.edit(n.getGeometryN(i),e);null===o||o.isEmpty()||r.add(o)}return n.getClass()===Xx?this._factory.createMultiPoint(r.toArray([])):n.getClass()===Nx?this._factory.createMultiLineString(r.toArray([])):n.getClass()===Wx?this._factory.createMultiPolygon(r.toArray([])):this._factory.createGeometryCollection(r.toArray([]))},Kx.prototype.editPolygon=function(t,e){var n=e.edit(t,this._factory);if(null===n&&(n=this._factory.createPolygon(null)),n.isEmpty())return n;var r=this.edit(n.getExteriorRing(),e);if(null===r||r.isEmpty())return this._factory.createPolygon();for(var i=new nx,o=0;o<n.getNumInteriorRing();o++){var s=this.edit(n.getInteriorRingN(o),e);null===s||s.isEmpty()||i.add(s)}return this._factory.createPolygon(r,i.toArray([]))},Kx.prototype.interfaces_=function(){return[]},Kx.prototype.getClass=function(){return Kx},Kx.GeometryEditorOperation=function(){},Zx.NoOpGeometryOperation.get=function(){return $x},Zx.CoordinateOperation.get=function(){return tC},Zx.CoordinateSequenceOperation.get=function(){return eC},Object.defineProperties(Kx,Zx);var $x=function(){};$x.prototype.edit=function(t,e){return t},$x.prototype.interfaces_=function(){return[Kx.GeometryEditorOperation]},$x.prototype.getClass=function(){return $x};var tC=function(){};tC.prototype.edit=function(t,e){var n=this.editCoordinates(t.getCoordinates(),t);return null===n?t:t instanceof Jx?e.createLinearRing(n):t instanceof jx?e.createLineString(n):t instanceof Vx?n.length>0?e.createPoint(n[0]):e.createPoint():t},tC.prototype.interfaces_=function(){return[Kx.GeometryEditorOperation]},tC.prototype.getClass=function(){return tC};var eC=function(){};eC.prototype.edit=function(t,e){return t instanceof Jx?e.createLinearRing(this.edit(t.getCoordinateSequence(),t)):t instanceof jx?e.createLineString(this.edit(t.getCoordinateSequence(),t)):t instanceof Vx?e.createPoint(this.edit(t.getCoordinateSequence(),t)):t},eC.prototype.interfaces_=function(){return[Kx.GeometryEditorOperation]},eC.prototype.getClass=function(){return eC};var nC=function(){var t=this;if(this._dimension=3,this._coordinates=null,1===arguments.length){if(arguments[0]instanceof Array)this._coordinates=arguments[0],this._dimension=3;else if(Number.isInteger(arguments[0])){var e=arguments[0];this._coordinates=new Array(e).fill(null);for(var n=0;n<e;n++)t._coordinates[n]=new eE}else if(aE(arguments[0],yE)){var r=arguments[0];if(null===r)return this._coordinates=new Array(0).fill(null),null;this._dimension=r.getDimension(),this._coordinates=new Array(r.size()).fill(null);for(var i=0;i<this._coordinates.length;i++)t._coordinates[i]=r.getCoordinateCopy(i)}}else if(2===arguments.length)if(arguments[0]instanceof Array&&Number.isInteger(arguments[1])){var o=arguments[0],s=arguments[1];this._coordinates=o,this._dimension=s,null===o&&(this._coordinates=new Array(0).fill(null))}else if(Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var a=arguments[0],u=arguments[1];this._coordinates=new Array(a).fill(null),this._dimension=u;for(var l=0;l<a;l++)t._coordinates[l]=new eE}},rC={serialVersionUID:{configurable:!0}};nC.prototype.setOrdinate=function(t,e,n){switch(e){case yE.X:this._coordinates[t].x=n;break;case yE.Y:this._coordinates[t].y=n;break;case yE.Z:this._coordinates[t].z=n;break;default:throw new XI("invalid ordinateIndex")}},nC.prototype.size=function(){return this._coordinates.length},nC.prototype.getOrdinate=function(t,e){switch(e){case yE.X:return this._coordinates[t].x;case yE.Y:return this._coordinates[t].y;case yE.Z:return this._coordinates[t].z}return JI.NaN},nC.prototype.getCoordinate=function(){if(1===arguments.length){var t=arguments[0];return this._coordinates[t]}if(2===arguments.length){var e=arguments[0],n=arguments[1];n.x=this._coordinates[e].x,n.y=this._coordinates[e].y,n.z=this._coordinates[e].z}},nC.prototype.getCoordinateCopy=function(t){return new eE(this._coordinates[t])},nC.prototype.getDimension=function(){return this._dimension},nC.prototype.getX=function(t){return this._coordinates[t].x},nC.prototype.clone=function(){for(var t=new Array(this.size()).fill(null),e=0;e<this._coordinates.length;e++)t[e]=this._coordinates[e].clone();return new nC(t,this._dimension)},nC.prototype.expandEnvelope=function(t){for(var e=0;e<this._coordinates.length;e++)t.expandToInclude(this._coordinates[e]);return t},nC.prototype.copy=function(){for(var t=new Array(this.size()).fill(null),e=0;e<this._coordinates.length;e++)t[e]=this._coordinates[e].copy();return new nC(t,this._dimension)},nC.prototype.toString=function(){if(this._coordinates.length>0){var t=new cE(17*this._coordinates.length);t.append("("),t.append(this._coordinates[0]);for(var e=1;e<this._coordinates.length;e++)t.append(", "),t.append(this._coordinates[e]);return t.append(")"),t.toString()}return"()"},nC.prototype.getY=function(t){return this._coordinates[t].y},nC.prototype.toCoordinateArray=function(){return this._coordinates},nC.prototype.interfaces_=function(){return[yE,tE]},nC.prototype.getClass=function(){return nC},rC.serialVersionUID.get=function(){return-0xcb44a778db18e00},Object.defineProperties(nC,rC);var iC=function(){},oC={serialVersionUID:{configurable:!0},instanceObject:{configurable:!0}};iC.prototype.readResolve=function(){return iC.instance()},iC.prototype.create=function(){if(1===arguments.length){if(arguments[0]instanceof Array)return new nC(arguments[0]);if(aE(arguments[0],yE))return new nC(arguments[0])}else if(2===arguments.length){var t=arguments[0],e=arguments[1];return e>3&&(e=3),e<2?new nC(t):new nC(t,e)}},iC.prototype.interfaces_=function(){return[iE,tE]},iC.prototype.getClass=function(){return iC},iC.instance=function(){return iC.instanceObject},oC.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00},oC.instanceObject.get=function(){return new iC},Object.defineProperties(iC,oC);var sC=function(t){function e(){t.call(this),this.map_=new Map}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(t){return this.map_.get(t)||null},e.prototype.put=function(t,e){return this.map_.set(t,e),e},e.prototype.values=function(){for(var t=new nx,e=this.map_.values(),n=e.next();!n.done;)t.add(n.value),n=e.next();return t},e.prototype.entrySet=function(){var t=new px;return this.map_.entries().forEach((function(e){return t.add(e)})),t},e.prototype.size=function(){return this.map_.size()},e}(lx),aC=function t(){if(this._modelType=null,this._scale=null,0===arguments.length)this._modelType=t.FLOATING;else if(1===arguments.length)if(arguments[0]instanceof lC){var e=arguments[0];this._modelType=e,e===t.FIXED&&this.setScale(1)}else if("number"==typeof arguments[0]){var n=arguments[0];this._modelType=t.FIXED,this.setScale(n)}else if(arguments[0]instanceof t){var r=arguments[0];this._modelType=r._modelType,this._scale=r._scale}},uC={serialVersionUID:{configurable:!0},maximumPreciseValue:{configurable:!0}};aC.prototype.equals=function(t){if(!(t instanceof aC))return!1;var e=t;return this._modelType===e._modelType&&this._scale===e._scale},aC.prototype.compareTo=function(t){var e=t,n=this.getMaximumSignificantDigits(),r=e.getMaximumSignificantDigits();return new hE(n).compareTo(new hE(r))},aC.prototype.getScale=function(){return this._scale},aC.prototype.isFloating=function(){return this._modelType===aC.FLOATING||this._modelType===aC.FLOATING_SINGLE},aC.prototype.getType=function(){return this._modelType},aC.prototype.toString=function(){var t="UNKNOWN";return this._modelType===aC.FLOATING?t="Floating":this._modelType===aC.FLOATING_SINGLE?t="Floating-Single":this._modelType===aC.FIXED&&(t="Fixed (Scale="+this.getScale()+")"),t},aC.prototype.makePrecise=function(){if("number"==typeof arguments[0]){var t=arguments[0];return JI.isNaN(t)||this._modelType===aC.FLOATING_SINGLE?t:this._modelType===aC.FIXED?Math.round(t*this._scale)/this._scale:t}if(arguments[0]instanceof eE){var e=arguments[0];if(this._modelType===aC.FLOATING)return null;e.x=this.makePrecise(e.x),e.y=this.makePrecise(e.y)}},aC.prototype.getMaximumSignificantDigits=function(){var t=16;return this._modelType===aC.FLOATING?t=16:this._modelType===aC.FLOATING_SINGLE?t=6:this._modelType===aC.FIXED&&(t=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),t},aC.prototype.setScale=function(t){this._scale=Math.abs(t)},aC.prototype.interfaces_=function(){return[tE,KI]},aC.prototype.getClass=function(){return aC},aC.mostPrecise=function(t,e){return t.compareTo(e)>=0?t:e},uC.serialVersionUID.get=function(){return 0x6bee6404e9a25c00},uC.maximumPreciseValue.get=function(){return 9007199254740992},Object.defineProperties(aC,uC);var lC=function t(e){this._name=e||null,t.nameToTypeMap.put(e,this)},cC={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}};lC.prototype.readResolve=function(){return lC.nameToTypeMap.get(this._name)},lC.prototype.toString=function(){return this._name},lC.prototype.interfaces_=function(){return[tE]},lC.prototype.getClass=function(){return lC},cC.serialVersionUID.get=function(){return-552860263173159e4},cC.nameToTypeMap.get=function(){return new sC},Object.defineProperties(lC,cC),aC.Type=lC,aC.FIXED=new lC("FIXED"),aC.FLOATING=new lC("FLOATING"),aC.FLOATING_SINGLE=new lC("FLOATING SINGLE");var hC=function t(){this._precisionModel=new aC,this._SRID=0,this._coordinateSequenceFactory=t.getDefaultCoordinateSequenceFactory(),0===arguments.length||(1===arguments.length?aE(arguments[0],iE)?this._coordinateSequenceFactory=arguments[0]:arguments[0]instanceof aC&&(this._precisionModel=arguments[0]):2===arguments.length?(this._precisionModel=arguments[0],this._SRID=arguments[1]):3===arguments.length&&(this._precisionModel=arguments[0],this._SRID=arguments[1],this._coordinateSequenceFactory=arguments[2]))},fC={serialVersionUID:{configurable:!0}};hC.prototype.toGeometry=function(t){return t.isNull()?this.createPoint(null):t.getMinX()===t.getMaxX()&&t.getMinY()===t.getMaxY()?this.createPoint(new eE(t.getMinX(),t.getMinY())):t.getMinX()===t.getMaxX()||t.getMinY()===t.getMaxY()?this.createLineString([new eE(t.getMinX(),t.getMinY()),new eE(t.getMaxX(),t.getMaxY())]):this.createPolygon(this.createLinearRing([new eE(t.getMinX(),t.getMinY()),new eE(t.getMinX(),t.getMaxY()),new eE(t.getMaxX(),t.getMaxY()),new eE(t.getMaxX(),t.getMinY()),new eE(t.getMinX(),t.getMinY())]),null)},hC.prototype.createLineString=function(t){return t?t instanceof Array?new jx(this.getCoordinateSequenceFactory().create(t),this):aE(t,yE)?new jx(t,this):void 0:new jx(this.getCoordinateSequenceFactory().create([]),this)},hC.prototype.createMultiLineString=function(){return 0===arguments.length?new Nx(null,this):1===arguments.length?new Nx(arguments[0],this):void 0},hC.prototype.buildGeometry=function(t){for(var e=null,n=!1,r=!1,i=t.iterator();i.hasNext();){var o=i.next(),s=o.getClass();null===e&&(e=s),s!==e&&(n=!0),o.isGeometryCollectionOrDerived()&&(r=!0)}if(null===e)return this.createGeometryCollection();if(n||r)return this.createGeometryCollection(hC.toGeometryArray(t));var a=t.iterator().next();if(t.size()>1){if(a instanceof Hx)return this.createMultiPolygon(hC.toPolygonArray(t));if(a instanceof jx)return this.createMultiLineString(hC.toLineStringArray(t));if(a instanceof Vx)return this.createMultiPoint(hC.toPointArray(t));TE.shouldNeverReachHere("Unhandled class: "+a.getClass().getName())}return a},hC.prototype.createMultiPointFromCoords=function(t){return this.createMultiPoint(null!==t?this.getCoordinateSequenceFactory().create(t):null)},hC.prototype.createPoint=function(){if(0===arguments.length)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(1===arguments.length){if(arguments[0]instanceof eE){var t=arguments[0];return this.createPoint(null!==t?this.getCoordinateSequenceFactory().create([t]):null)}if(aE(arguments[0],yE))return new Vx(arguments[0],this)}},hC.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory},hC.prototype.createPolygon=function(){if(0===arguments.length)return new Hx(null,null,this);if(1===arguments.length){if(aE(arguments[0],yE)){var t=arguments[0];return this.createPolygon(this.createLinearRing(t))}if(arguments[0]instanceof Array){var e=arguments[0];return this.createPolygon(this.createLinearRing(e))}if(arguments[0]instanceof Jx){var n=arguments[0];return this.createPolygon(n,null)}}else if(2===arguments.length){return new Hx(arguments[0],arguments[1],this)}},hC.prototype.getSRID=function(){return this._SRID},hC.prototype.createGeometryCollection=function(){return 0===arguments.length?new Lx(null,this):1===arguments.length?new Lx(arguments[0],this):void 0},hC.prototype.createGeometry=function(t){return new Kx(this).edit(t,{edit:function(){if(2===arguments.length){var t=arguments[0];return this._coordinateSequenceFactory.create(t)}}})},hC.prototype.getPrecisionModel=function(){return this._precisionModel},hC.prototype.createLinearRing=function(){if(0===arguments.length)return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));if(1===arguments.length){if(arguments[0]instanceof Array){var t=arguments[0];return this.createLinearRing(null!==t?this.getCoordinateSequenceFactory().create(t):null)}if(aE(arguments[0],yE))return new Jx(arguments[0],this)}},hC.prototype.createMultiPolygon=function(){return 0===arguments.length?new Wx(null,this):1===arguments.length?new Wx(arguments[0],this):void 0},hC.prototype.createMultiPoint=function(){if(0===arguments.length)return new Xx(null,this);if(1===arguments.length){if(arguments[0]instanceof Array)return new Xx(arguments[0],this);if(arguments[0]instanceof Array){var t=arguments[0];return this.createMultiPoint(null!==t?this.getCoordinateSequenceFactory().create(t):null)}if(aE(arguments[0],yE)){var e=arguments[0];if(null===e)return this.createMultiPoint(new Array(0).fill(null));for(var n=new Array(e.size()).fill(null),r=0;r<e.size();r++){var i=this.getCoordinateSequenceFactory().create(1,e.getDimension());qx.copy(e,r,i,0,1),n[r]=this.createPoint(i)}return this.createMultiPoint(n)}}},hC.prototype.interfaces_=function(){return[tE]},hC.prototype.getClass=function(){return hC},hC.toMultiPolygonArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},hC.toGeometryArray=function(t){if(null===t)return null;var e=new Array(t.size()).fill(null);return t.toArray(e)},hC.getDefaultCoordinateSequenceFactory=function(){return iC.instance()},hC.toMultiLineStringArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},hC.toLineStringArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},hC.toMultiPointArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},hC.toLinearRingArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},hC.toPointArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},hC.toPolygonArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},hC.createPointFromInternalCoord=function(t,e){return e.getPrecisionModel().makePrecise(t),e.getFactory().createPoint(t)},fC.serialVersionUID.get=function(){return-0x5ea75f2051eeb400},Object.defineProperties(hC,fC);var pC=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],gC=function(t){this.geometryFactory=t||new hC};gC.prototype.read=function(t){var e,n=(e="string"==typeof t?JSON.parse(t):t).type;if(!AC[n])throw new Error("Unknown GeoJSON type: "+e.type);return-1!==pC.indexOf(n)?AC[n].apply(this,[e.coordinates]):"GeometryCollection"===n?AC[n].apply(this,[e.geometries]):AC[n].apply(this,[e])},gC.prototype.write=function(t){var e=t.getGeometryType();if(!dC[e])throw new Error("Geometry is not supported");return dC[e].apply(this,[t])};var AC={Feature:function(t){var e={};for(var n in t)e[n]=t[n];if(t.geometry){var r=t.geometry.type;if(!AC[r])throw new Error("Unknown GeoJSON type: "+t.type);e.geometry=this.read(t.geometry)}return t.bbox&&(e.bbox=AC.bbox.apply(this,[t.bbox])),e},FeatureCollection:function(t){var e={};if(t.features){e.features=[];for(var n=0;n<t.features.length;++n)e.features.push(this.read(t.features[n]))}return t.bbox&&(e.bbox=this.parse.bbox.apply(this,[t.bbox])),e},coordinates:function(t){for(var e=[],n=0;n<t.length;++n){var r=t[n];e.push(new eE(r[0],r[1]))}return e},bbox:function(t){return this.geometryFactory.createLinearRing([new eE(t[0],t[1]),new eE(t[2],t[1]),new eE(t[2],t[3]),new eE(t[0],t[3]),new eE(t[0],t[1])])},Point:function(t){var e=new eE(t[0],t[1]);return this.geometryFactory.createPoint(e)},MultiPoint:function(t){for(var e=[],n=0;n<t.length;++n)e.push(AC.Point.apply(this,[t[n]]));return this.geometryFactory.createMultiPoint(e)},LineString:function(t){var e=AC.coordinates.apply(this,[t]);return this.geometryFactory.createLineString(e)},MultiLineString:function(t){for(var e=[],n=0;n<t.length;++n)e.push(AC.LineString.apply(this,[t[n]]));return this.geometryFactory.createMultiLineString(e)},Polygon:function(t){for(var e=AC.coordinates.apply(this,[t[0]]),n=this.geometryFactory.createLinearRing(e),r=[],i=1;i<t.length;++i){var o=t[i],s=AC.coordinates.apply(this,[o]),a=this.geometryFactory.createLinearRing(s);r.push(a)}return this.geometryFactory.createPolygon(n,r)},MultiPolygon:function(t){for(var e=[],n=0;n<t.length;++n){var r=t[n];e.push(AC.Polygon.apply(this,[r]))}return this.geometryFactory.createMultiPolygon(e)},GeometryCollection:function(t){for(var e=[],n=0;n<t.length;++n){var r=t[n];e.push(this.read(r))}return this.geometryFactory.createGeometryCollection(e)}},dC={coordinate:function(t){return[t.x,t.y]},Point:function(t){return{type:"Point",coordinates:dC.coordinate.apply(this,[t.getCoordinate()])}},MultiPoint:function(t){for(var e=[],n=0;n<t._geometries.length;++n){var r=t._geometries[n],i=dC.Point.apply(this,[r]);e.push(i.coordinates)}return{type:"MultiPoint",coordinates:e}},LineString:function(t){for(var e=[],n=t.getCoordinates(),r=0;r<n.length;++r){var i=n[r];e.push(dC.coordinate.apply(this,[i]))}return{type:"LineString",coordinates:e}},MultiLineString:function(t){for(var e=[],n=0;n<t._geometries.length;++n){var r=t._geometries[n],i=dC.LineString.apply(this,[r]);e.push(i.coordinates)}return{type:"MultiLineString",coordinates:e}},Polygon:function(t){var e=[],n=dC.LineString.apply(this,[t._shell]);e.push(n.coordinates);for(var r=0;r<t._holes.length;++r){var i=t._holes[r],o=dC.LineString.apply(this,[i]);e.push(o.coordinates)}return{type:"Polygon",coordinates:e}},MultiPolygon:function(t){for(var e=[],n=0;n<t._geometries.length;++n){var r=t._geometries[n],i=dC.Polygon.apply(this,[r]);e.push(i.coordinates)}return{type:"MultiPolygon",coordinates:e}},GeometryCollection:function(t){for(var e=[],n=0;n<t._geometries.length;++n){var r=t._geometries[n],i=r.getGeometryType();e.push(dC[i].apply(this,[r]))}return{type:"GeometryCollection",geometries:e}}},yC=function(t){this.geometryFactory=t||new hC,this.precisionModel=this.geometryFactory.getPrecisionModel(),this.parser=new gC(this.geometryFactory)};yC.prototype.read=function(t){var e=this.parser.read(t);return this.precisionModel.getType()===aC.FIXED&&this.reducePrecision(e),e},yC.prototype.reducePrecision=function(t){var e,n;if(t.coordinate)this.precisionModel.makePrecise(t.coordinate);else if(t.points)for(e=0,n=t.points.length;e<n;e++)this.precisionModel.makePrecise(t.points[e]);else if(t.geometries)for(e=0,n=t.geometries.length;e<n;e++)this.reducePrecision(t.geometries[e])};var vC=function(){this.parser=new gC(this.geometryFactory)};vC.prototype.write=function(t){return this.parser.write(t)};var mC=function(){},_C={ON:{configurable:!0},LEFT:{configurable:!0},RIGHT:{configurable:!0}};function IC(t){this.message=t||""}function EC(){this.array_=[]}mC.prototype.interfaces_=function(){return[]},mC.prototype.getClass=function(){return mC},mC.opposite=function(t){return t===mC.LEFT?mC.RIGHT:t===mC.RIGHT?mC.LEFT:t},_C.ON.get=function(){return 0},_C.LEFT.get=function(){return 1},_C.RIGHT.get=function(){return 2},Object.defineProperties(mC,_C),IC.prototype=new Error,IC.prototype.name="EmptyStackException",EC.prototype=new tx,EC.prototype.add=function(t){return this.array_.push(t),!0},EC.prototype.get=function(t){if(t<0||t>=this.size())throw new Error;return this.array_[t]},EC.prototype.push=function(t){return this.array_.push(t),t},EC.prototype.pop=function(t){if(0===this.array_.length)throw new IC;return this.array_.pop()},EC.prototype.peek=function(){if(0===this.array_.length)throw new IC;return this.array_[this.array_.length-1]},EC.prototype.empty=function(){return 0===this.array_.length},EC.prototype.isEmpty=function(){return this.empty()},EC.prototype.search=function(t){return this.array_.indexOf(t)},EC.prototype.size=function(){return this.array_.length},EC.prototype.toArray=function(){for(var t=[],e=0,n=this.array_.length;e<n;e++)t.push(this.array_[e]);return t};var xC=function(){this._minIndex=-1,this._minCoord=null,this._minDe=null,this._orientedDe=null};xC.prototype.getCoordinate=function(){return this._minCoord},xC.prototype.getRightmostSide=function(t,e){var n=this.getRightmostSideOfSegment(t,e);return n<0&&(n=this.getRightmostSideOfSegment(t,e-1)),n<0&&(this._minCoord=null,this.checkForRightmostCoordinate(t)),n},xC.prototype.findRightmostEdgeAtVertex=function(){var t=this._minDe.getEdge().getCoordinates();TE.isTrue(this._minIndex>0&&this._minIndex<t.length,"rightmost point expected to be interior vertex of edge");var e=t[this._minIndex-1],n=t[this._minIndex+1],r=OE.computeOrientation(this._minCoord,n,e),i=!1;(e.y<this._minCoord.y&&n.y<this._minCoord.y&&r===OE.COUNTERCLOCKWISE||e.y>this._minCoord.y&&n.y>this._minCoord.y&&r===OE.CLOCKWISE)&&(i=!0),i&&(this._minIndex=this._minIndex-1)},xC.prototype.getRightmostSideOfSegment=function(t,e){var n=t.getEdge().getCoordinates();if(e<0||e+1>=n.length)return-1;if(n[e].y===n[e+1].y)return-1;var r=mC.LEFT;return n[e].y<n[e+1].y&&(r=mC.RIGHT),r},xC.prototype.getEdge=function(){return this._orientedDe},xC.prototype.checkForRightmostCoordinate=function(t){for(var e=this,n=t.getEdge().getCoordinates(),r=0;r<n.length-1;r++)(null===e._minCoord||n[r].x>e._minCoord.x)&&(e._minDe=t,e._minIndex=r,e._minCoord=n[r])},xC.prototype.findRightmostEdgeAtNode=function(){var t=this._minDe.getNode().getEdges();this._minDe=t.getRightmostEdge(),this._minDe.isForward()||(this._minDe=this._minDe.getSym(),this._minIndex=this._minDe.getEdge().getCoordinates().length-1)},xC.prototype.findEdge=function(t){for(var e=t.iterator();e.hasNext();){var n=e.next();n.isForward()&&this.checkForRightmostCoordinate(n)}TE.isTrue(0!==this._minIndex||this._minCoord.equals(this._minDe.getCoordinate()),"inconsistency in rightmost processing"),0===this._minIndex?this.findRightmostEdgeAtNode():this.findRightmostEdgeAtVertex(),this._orientedDe=this._minDe,this.getRightmostSide(this._minDe,this._minIndex)===mC.LEFT&&(this._orientedDe=this._minDe.getSym())},xC.prototype.interfaces_=function(){return[]},xC.prototype.getClass=function(){return xC};var CC=function(t){function e(n,r){t.call(this,e.msgWithCoord(n,r)),this.pt=r?new eE(r):null,this.name="TopologyException"}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getCoordinate=function(){return this.pt},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.msgWithCoord=function(t,e){return e?t:t+" [ "+e+" ]"},e}(LE),wC=function(){this.array_=[]};wC.prototype.addLast=function(t){this.array_.push(t)},wC.prototype.removeFirst=function(){return this.array_.shift()},wC.prototype.isEmpty=function(){return 0===this.array_.length};var bC=function(){this._finder=null,this._dirEdgeList=new nx,this._nodes=new nx,this._rightMostCoord=null,this._env=null,this._finder=new xC};bC.prototype.clearVisitedEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){t.next().setVisited(!1)}},bC.prototype.getRightmostCoordinate=function(){return this._rightMostCoord},bC.prototype.computeNodeDepth=function(t){for(var e=null,n=t.getEdges().iterator();n.hasNext();){var r=n.next();if(r.isVisited()||r.getSym().isVisited()){e=r;break}}if(null===e)throw new CC("unable to find edge to compute depths at "+t.getCoordinate());t.getEdges().computeDepths(e);for(var i=t.getEdges().iterator();i.hasNext();){var o=i.next();o.setVisited(!0),this.copySymDepths(o)}},bC.prototype.computeDepth=function(t){this.clearVisitedEdges();var e=this._finder.getEdge();e.setEdgeDepths(mC.RIGHT,t),this.copySymDepths(e),this.computeDepths(e)},bC.prototype.create=function(t){this.addReachable(t),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()},bC.prototype.findResultEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){var e=t.next();e.getDepth(mC.RIGHT)>=1&&e.getDepth(mC.LEFT)<=0&&!e.isInteriorAreaEdge()&&e.setInResult(!0)}},bC.prototype.computeDepths=function(t){var e=new px,n=new wC,r=t.getNode();for(n.addLast(r),e.add(r),t.setVisited(!0);!n.isEmpty();){var i=n.removeFirst();e.add(i),this.computeNodeDepth(i);for(var o=i.getEdges().iterator();o.hasNext();){var s=o.next().getSym();if(!s.isVisited()){var a=s.getNode();e.contains(a)||(n.addLast(a),e.add(a))}}}},bC.prototype.compareTo=function(t){var e=t;return this._rightMostCoord.x<e._rightMostCoord.x?-1:this._rightMostCoord.x>e._rightMostCoord.x?1:0},bC.prototype.getEnvelope=function(){if(null===this._env){for(var t=new xE,e=this._dirEdgeList.iterator();e.hasNext();)for(var n=e.next().getEdge().getCoordinates(),r=0;r<n.length-1;r++)t.expandToInclude(n[r]);this._env=t}return this._env},bC.prototype.addReachable=function(t){var e=new EC;for(e.add(t);!e.empty();){var n=e.pop();this.add(n,e)}},bC.prototype.copySymDepths=function(t){var e=t.getSym();e.setDepth(mC.LEFT,t.getDepth(mC.RIGHT)),e.setDepth(mC.RIGHT,t.getDepth(mC.LEFT))},bC.prototype.add=function(t,e){t.setVisited(!0),this._nodes.add(t);for(var n=t.getEdges().iterator();n.hasNext();){var r=n.next();this._dirEdgeList.add(r);var i=r.getSym().getNode();i.isVisited()||e.push(i)}},bC.prototype.getNodes=function(){return this._nodes},bC.prototype.getDirectedEdges=function(){return this._dirEdgeList},bC.prototype.interfaces_=function(){return[KI]},bC.prototype.getClass=function(){return bC};var BC=function t(){if(this.location=null,1===arguments.length){if(arguments[0]instanceof Array){var e=arguments[0];this.init(e.length)}else if(Number.isInteger(arguments[0])){var n=arguments[0];this.init(1),this.location[mC.ON]=n}else if(arguments[0]instanceof t){var r=arguments[0];if(this.init(r.location.length),null!==r)for(var i=0;i<this.location.length;i++)this.location[i]=r.location[i]}}else if(3===arguments.length){var o=arguments[0],s=arguments[1],a=arguments[2];this.init(3),this.location[mC.ON]=o,this.location[mC.LEFT]=s,this.location[mC.RIGHT]=a}};BC.prototype.setAllLocations=function(t){for(var e=0;e<this.location.length;e++)this.location[e]=t},BC.prototype.isNull=function(){for(var t=0;t<this.location.length;t++)if(this.location[t]!==oE.NONE)return!1;return!0},BC.prototype.setAllLocationsIfNull=function(t){for(var e=0;e<this.location.length;e++)this.location[e]===oE.NONE&&(this.location[e]=t)},BC.prototype.isLine=function(){return 1===this.location.length},BC.prototype.merge=function(t){if(t.location.length>this.location.length){var e=new Array(3).fill(null);e[mC.ON]=this.location[mC.ON],e[mC.LEFT]=oE.NONE,e[mC.RIGHT]=oE.NONE,this.location=e}for(var n=0;n<this.location.length;n++)this.location[n]===oE.NONE&&n<t.location.length&&(this.location[n]=t.location[n])},BC.prototype.getLocations=function(){return this.location},BC.prototype.flip=function(){if(this.location.length<=1)return null;var t=this.location[mC.LEFT];this.location[mC.LEFT]=this.location[mC.RIGHT],this.location[mC.RIGHT]=t},BC.prototype.toString=function(){var t=new cE;return this.location.length>1&&t.append(oE.toLocationSymbol(this.location[mC.LEFT])),t.append(oE.toLocationSymbol(this.location[mC.ON])),this.location.length>1&&t.append(oE.toLocationSymbol(this.location[mC.RIGHT])),t.toString()},BC.prototype.setLocations=function(t,e,n){this.location[mC.ON]=t,this.location[mC.LEFT]=e,this.location[mC.RIGHT]=n},BC.prototype.get=function(t){return t<this.location.length?this.location[t]:oE.NONE},BC.prototype.isArea=function(){return this.location.length>1},BC.prototype.isAnyNull=function(){for(var t=0;t<this.location.length;t++)if(this.location[t]===oE.NONE)return!0;return!1},BC.prototype.setLocation=function(){if(1===arguments.length){var t=arguments[0];this.setLocation(mC.ON,t)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];this.location[e]=n}},BC.prototype.init=function(t){this.location=new Array(t).fill(null),this.setAllLocations(oE.NONE)},BC.prototype.isEqualOnSide=function(t,e){return this.location[e]===t.location[e]},BC.prototype.allPositionsEqual=function(t){for(var e=0;e<this.location.length;e++)if(this.location[e]!==t)return!1;return!0},BC.prototype.interfaces_=function(){return[]},BC.prototype.getClass=function(){return BC};var SC=function t(){if(this.elt=new Array(2).fill(null),1===arguments.length){if(Number.isInteger(arguments[0])){var e=arguments[0];this.elt[0]=new BC(e),this.elt[1]=new BC(e)}else if(arguments[0]instanceof t){var n=arguments[0];this.elt[0]=new BC(n.elt[0]),this.elt[1]=new BC(n.elt[1])}}else if(2===arguments.length){var r=arguments[0],i=arguments[1];this.elt[0]=new BC(oE.NONE),this.elt[1]=new BC(oE.NONE),this.elt[r].setLocation(i)}else if(3===arguments.length){var o=arguments[0],s=arguments[1],a=arguments[2];this.elt[0]=new BC(o,s,a),this.elt[1]=new BC(o,s,a)}else if(4===arguments.length){var u=arguments[0],l=arguments[1],c=arguments[2],h=arguments[3];this.elt[0]=new BC(oE.NONE,oE.NONE,oE.NONE),this.elt[1]=new BC(oE.NONE,oE.NONE,oE.NONE),this.elt[u].setLocations(l,c,h)}};SC.prototype.getGeometryCount=function(){var t=0;return this.elt[0].isNull()||t++,this.elt[1].isNull()||t++,t},SC.prototype.setAllLocations=function(t,e){this.elt[t].setAllLocations(e)},SC.prototype.isNull=function(t){return this.elt[t].isNull()},SC.prototype.setAllLocationsIfNull=function(){if(1===arguments.length){var t=arguments[0];this.setAllLocationsIfNull(0,t),this.setAllLocationsIfNull(1,t)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];this.elt[e].setAllLocationsIfNull(n)}},SC.prototype.isLine=function(t){return this.elt[t].isLine()},SC.prototype.merge=function(t){for(var e=this,n=0;n<2;n++)null===e.elt[n]&&null!==t.elt[n]?e.elt[n]=new BC(t.elt[n]):e.elt[n].merge(t.elt[n])},SC.prototype.flip=function(){this.elt[0].flip(),this.elt[1].flip()},SC.prototype.getLocation=function(){if(1===arguments.length){var t=arguments[0];return this.elt[t].get(mC.ON)}if(2===arguments.length){var e=arguments[0],n=arguments[1];return this.elt[e].get(n)}},SC.prototype.toString=function(){var t=new cE;return null!==this.elt[0]&&(t.append("A:"),t.append(this.elt[0].toString())),null!==this.elt[1]&&(t.append(" B:"),t.append(this.elt[1].toString())),t.toString()},SC.prototype.isArea=function(){if(0===arguments.length)return this.elt[0].isArea()||this.elt[1].isArea();if(1===arguments.length){var t=arguments[0];return this.elt[t].isArea()}},SC.prototype.isAnyNull=function(t){return this.elt[t].isAnyNull()},SC.prototype.setLocation=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];this.elt[t].setLocation(mC.ON,e)}else if(3===arguments.length){var n=arguments[0],r=arguments[1],i=arguments[2];this.elt[n].setLocation(r,i)}},SC.prototype.isEqualOnSide=function(t,e){return this.elt[0].isEqualOnSide(t.elt[0],e)&&this.elt[1].isEqualOnSide(t.elt[1],e)},SC.prototype.allPositionsEqual=function(t,e){return this.elt[t].allPositionsEqual(e)},SC.prototype.toLine=function(t){this.elt[t].isArea()&&(this.elt[t]=new BC(this.elt[t].location[0]))},SC.prototype.interfaces_=function(){return[]},SC.prototype.getClass=function(){return SC},SC.toLineLabel=function(t){for(var e=new SC(oE.NONE),n=0;n<2;n++)e.setLocation(n,t.getLocation(n));return e};var MC=function(){this._startDe=null,this._maxNodeDegree=-1,this._edges=new nx,this._pts=new nx,this._label=new SC(oE.NONE),this._ring=null,this._isHole=null,this._shell=null,this._holes=new nx,this._geometryFactory=null;var t=arguments[0],e=arguments[1];this._geometryFactory=e,this.computePoints(t),this.computeRing()};MC.prototype.computeRing=function(){if(null!==this._ring)return null;for(var t=new Array(this._pts.size()).fill(null),e=0;e<this._pts.size();e++)t[e]=this._pts.get(e);this._ring=this._geometryFactory.createLinearRing(t),this._isHole=OE.isCCW(this._ring.getCoordinates())},MC.prototype.isIsolated=function(){return 1===this._label.getGeometryCount()},MC.prototype.computePoints=function(t){var e=this;this._startDe=t;var n=t,r=!0;do{if(null===n)throw new CC("Found null DirectedEdge");if(n.getEdgeRing()===e)throw new CC("Directed Edge visited twice during ring-building at "+n.getCoordinate());e._edges.add(n);var i=n.getLabel();TE.isTrue(i.isArea()),e.mergeLabel(i),e.addPoints(n.getEdge(),n.isForward(),r),r=!1,e.setEdgeRing(n,e),n=e.getNext(n)}while(n!==this._startDe)},MC.prototype.getLinearRing=function(){return this._ring},MC.prototype.getCoordinate=function(t){return this._pts.get(t)},MC.prototype.computeMaxNodeDegree=function(){var t=this;this._maxNodeDegree=0;var e=this._startDe;do{var n=e.getNode().getEdges().getOutgoingDegree(t);n>t._maxNodeDegree&&(t._maxNodeDegree=n),e=t.getNext(e)}while(e!==this._startDe);this._maxNodeDegree*=2},MC.prototype.addPoints=function(t,e,n){var r=t.getCoordinates();if(e){var i=1;n&&(i=0);for(var o=i;o<r.length;o++)this._pts.add(r[o])}else{var s=r.length-2;n&&(s=r.length-1);for(var a=s;a>=0;a--)this._pts.add(r[a])}},MC.prototype.isHole=function(){return this._isHole},MC.prototype.setInResult=function(){var t=this._startDe;do{t.getEdge().setInResult(!0),t=t.getNext()}while(t!==this._startDe)},MC.prototype.containsPoint=function(t){var e=this.getLinearRing();if(!e.getEnvelopeInternal().contains(t))return!1;if(!OE.isPointInRing(t,e.getCoordinates()))return!1;for(var n=this._holes.iterator();n.hasNext();){if(n.next().containsPoint(t))return!1}return!0},MC.prototype.addHole=function(t){this._holes.add(t)},MC.prototype.isShell=function(){return null===this._shell},MC.prototype.getLabel=function(){return this._label},MC.prototype.getEdges=function(){return this._edges},MC.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree},MC.prototype.getShell=function(){return this._shell},MC.prototype.mergeLabel=function(){if(1===arguments.length){var t=arguments[0];this.mergeLabel(t,0),this.mergeLabel(t,1)}else if(2===arguments.length){var e=arguments[1],n=arguments[0].getLocation(e,mC.RIGHT);if(n===oE.NONE)return null;if(this._label.getLocation(e)===oE.NONE)return this._label.setLocation(e,n),null}},MC.prototype.setShell=function(t){this._shell=t,null!==t&&t.addHole(this)},MC.prototype.toPolygon=function(t){for(var e=new Array(this._holes.size()).fill(null),n=0;n<this._holes.size();n++)e[n]=this._holes.get(n).getLinearRing();return t.createPolygon(this.getLinearRing(),e)},MC.prototype.interfaces_=function(){return[]},MC.prototype.getClass=function(){return MC};var LC=function(t){function e(){var e=arguments[0],n=arguments[1];t.call(this,e,n)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.setEdgeRing=function(t,e){t.setMinEdgeRing(e)},e.prototype.getNext=function(t){return t.getNextMin()},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(MC),NC=function(t){function e(){var e=arguments[0],n=arguments[1];t.call(this,e,n)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.buildMinimalRings=function(){var t=new nx,e=this._startDe;do{if(null===e.getMinEdgeRing()){var n=new LC(e,this._geometryFactory);t.add(n)}e=e.getNext()}while(e!==this._startDe);return t},e.prototype.setEdgeRing=function(t,e){t.setEdgeRing(e)},e.prototype.linkDirectedEdgesForMinimalEdgeRings=function(){var t=this._startDe;do{t.getNode().getEdges().linkMinimalDirectedEdges(this),t=t.getNext()}while(t!==this._startDe)},e.prototype.getNext=function(t){return t.getNext()},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(MC),TC=function(){if(this._label=null,this._isInResult=!1,this._isCovered=!1,this._isCoveredSet=!1,this._isVisited=!1,0===arguments.length);else if(1===arguments.length){var t=arguments[0];this._label=t}};TC.prototype.setVisited=function(t){this._isVisited=t},TC.prototype.setInResult=function(t){this._isInResult=t},TC.prototype.isCovered=function(){return this._isCovered},TC.prototype.isCoveredSet=function(){return this._isCoveredSet},TC.prototype.setLabel=function(t){this._label=t},TC.prototype.getLabel=function(){return this._label},TC.prototype.setCovered=function(t){this._isCovered=t,this._isCoveredSet=!0},TC.prototype.updateIM=function(t){TE.isTrue(this._label.getGeometryCount()>=2,"found partial label"),this.computeIM(t)},TC.prototype.isInResult=function(){return this._isInResult},TC.prototype.isVisited=function(){return this._isVisited},TC.prototype.interfaces_=function(){return[]},TC.prototype.getClass=function(){return TC};var RC=function(t){function e(){t.call(this),this._coord=null,this._edges=null;var e=arguments[0],n=arguments[1];this._coord=e,this._edges=n,this._label=new SC(0,oE.NONE)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isIncidentEdgeInResult=function(){for(var t=this.getEdges().getEdges().iterator();t.hasNext();){if(t.next().getEdge().isInResult())return!0}return!1},e.prototype.isIsolated=function(){return 1===this._label.getGeometryCount()},e.prototype.getCoordinate=function(){return this._coord},e.prototype.print=function(t){t.println("node "+this._coord+" lbl: "+this._label)},e.prototype.computeIM=function(t){},e.prototype.computeMergedLocation=function(t,e){var n=oE.NONE;if(n=this._label.getLocation(e),!t.isNull(e)){var r=t.getLocation(e);n!==oE.BOUNDARY&&(n=r)}return n},e.prototype.setLabel=function(){if(2!==arguments.length)return t.prototype.setLabel.apply(this,arguments);var e=arguments[0],n=arguments[1];null===this._label?this._label=new SC(e,n):this._label.setLocation(e,n)},e.prototype.getEdges=function(){return this._edges},e.prototype.mergeLabel=function(){var t=this;if(arguments[0]instanceof e){var n=arguments[0];this.mergeLabel(n._label)}else if(arguments[0]instanceof SC)for(var r=arguments[0],i=0;i<2;i++){var o=t.computeMergedLocation(r,i);t._label.getLocation(i)===oE.NONE&&t._label.setLocation(i,o)}},e.prototype.add=function(t){this._edges.insert(t),t.setNode(this)},e.prototype.setLabelBoundary=function(t){if(null===this._label)return null;var e=oE.NONE;null!==this._label&&(e=this._label.getLocation(t));var n=null;if(e===oE.BOUNDARY)n=oE.INTERIOR;else n=oE.BOUNDARY;this._label.setLocation(t,n)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(TC),QC=function(){this.nodeMap=new _x,this.nodeFact=null;var t=arguments[0];this.nodeFact=t};QC.prototype.find=function(t){return this.nodeMap.get(t)},QC.prototype.addNode=function(){if(arguments[0]instanceof eE){var t=arguments[0],e=this.nodeMap.get(t);return null===e&&(e=this.nodeFact.createNode(t),this.nodeMap.put(t,e)),e}if(arguments[0]instanceof RC){var n=arguments[0],r=this.nodeMap.get(n.getCoordinate());return null===r?(this.nodeMap.put(n.getCoordinate(),n),n):(r.mergeLabel(n),r)}},QC.prototype.print=function(t){for(var e=this.iterator();e.hasNext();){e.next().print(t)}},QC.prototype.iterator=function(){return this.nodeMap.values().iterator()},QC.prototype.values=function(){return this.nodeMap.values()},QC.prototype.getBoundaryNodes=function(t){for(var e=new nx,n=this.iterator();n.hasNext();){var r=n.next();r.getLabel().getLocation(t)===oE.BOUNDARY&&e.add(r)}return e},QC.prototype.add=function(t){var e=t.getCoordinate();this.addNode(e).add(t)},QC.prototype.interfaces_=function(){return[]},QC.prototype.getClass=function(){return QC};var DC=function(){},PC={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}};DC.prototype.interfaces_=function(){return[]},DC.prototype.getClass=function(){return DC},DC.isNorthern=function(t){return t===DC.NE||t===DC.NW},DC.isOpposite=function(t,e){return t!==e&&2===(t-e+4)%4},DC.commonHalfPlane=function(t,e){if(t===e)return t;if(2===(t-e+4)%4)return-1;var n=t<e?t:e;return 0===n&&3===(t>e?t:e)?3:n},DC.isInHalfPlane=function(t,e){return e===DC.SE?t===DC.SE||t===DC.SW:t===e||t===e+1},DC.quadrant=function(){if("number"==typeof arguments[0]&&"number"==typeof arguments[1]){var t=arguments[0],e=arguments[1];if(0===t&&0===e)throw new XI("Cannot compute the quadrant for point ( "+t+", "+e+" )");return t>=0?e>=0?DC.NE:DC.SE:e>=0?DC.NW:DC.SW}if(arguments[0]instanceof eE&&arguments[1]instanceof eE){var n=arguments[0],r=arguments[1];if(r.x===n.x&&r.y===n.y)throw new XI("Cannot compute the quadrant for two identical points "+n);return r.x>=n.x?r.y>=n.y?DC.NE:DC.SE:r.y>=n.y?DC.NW:DC.SW}},PC.NE.get=function(){return 0},PC.NW.get=function(){return 1},PC.SW.get=function(){return 2},PC.SE.get=function(){return 3},Object.defineProperties(DC,PC);var kC=function(){if(this._edge=null,this._label=null,this._node=null,this._p0=null,this._p1=null,this._dx=null,this._dy=null,this._quadrant=null,1===arguments.length){var t=arguments[0];this._edge=t}else if(3===arguments.length){var e=arguments[0],n=arguments[1],r=arguments[2];this._edge=e,this.init(n,r),this._label=null}else if(4===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3];this._edge=i,this.init(o,s),this._label=a}};kC.prototype.compareDirection=function(t){return this._dx===t._dx&&this._dy===t._dy?0:this._quadrant>t._quadrant?1:this._quadrant<t._quadrant?-1:OE.computeOrientation(t._p0,t._p1,this._p1)},kC.prototype.getDy=function(){return this._dy},kC.prototype.getCoordinate=function(){return this._p0},kC.prototype.setNode=function(t){this._node=t},kC.prototype.print=function(t){var e=Math.atan2(this._dy,this._dx),n=this.getClass().getName(),r=n.lastIndexOf("."),i=n.substring(r+1);t.print(" "+i+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+e+" "+this._label)},kC.prototype.compareTo=function(t){var e=t;return this.compareDirection(e)},kC.prototype.getDirectedCoordinate=function(){return this._p1},kC.prototype.getDx=function(){return this._dx},kC.prototype.getLabel=function(){return this._label},kC.prototype.getEdge=function(){return this._edge},kC.prototype.getQuadrant=function(){return this._quadrant},kC.prototype.getNode=function(){return this._node},kC.prototype.toString=function(){var t=Math.atan2(this._dy,this._dx),e=this.getClass().getName(),n=e.lastIndexOf(".");return" "+e.substring(n+1)+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+t+" "+this._label},kC.prototype.computeLabel=function(t){},kC.prototype.init=function(t,e){this._p0=t,this._p1=e,this._dx=e.x-t.x,this._dy=e.y-t.y,this._quadrant=DC.quadrant(this._dx,this._dy),TE.isTrue(!(0===this._dx&&0===this._dy),"EdgeEnd with identical endpoints found")},kC.prototype.interfaces_=function(){return[KI]},kC.prototype.getClass=function(){return kC};var OC=function(t){function e(){var e=arguments[0],n=arguments[1];if(t.call(this,e),this._isForward=null,this._isInResult=!1,this._isVisited=!1,this._sym=null,this._next=null,this._nextMin=null,this._edgeRing=null,this._minEdgeRing=null,this._depth=[0,-999,-999],this._isForward=n,n)this.init(e.getCoordinate(0),e.getCoordinate(1));else{var r=e.getNumPoints()-1;this.init(e.getCoordinate(r),e.getCoordinate(r-1))}this.computeDirectedLabel()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getNextMin=function(){return this._nextMin},e.prototype.getDepth=function(t){return this._depth[t]},e.prototype.setVisited=function(t){this._isVisited=t},e.prototype.computeDirectedLabel=function(){this._label=new SC(this._edge.getLabel()),this._isForward||this._label.flip()},e.prototype.getNext=function(){return this._next},e.prototype.setDepth=function(t,e){if(-999!==this._depth[t]&&this._depth[t]!==e)throw new CC("assigned depths do not match",this.getCoordinate());this._depth[t]=e},e.prototype.isInteriorAreaEdge=function(){for(var t=this,e=!0,n=0;n<2;n++)t._label.isArea(n)&&t._label.getLocation(n,mC.LEFT)===oE.INTERIOR&&t._label.getLocation(n,mC.RIGHT)===oE.INTERIOR||(e=!1);return e},e.prototype.setNextMin=function(t){this._nextMin=t},e.prototype.print=function(e){t.prototype.print.call(this,e),e.print(" "+this._depth[mC.LEFT]+"/"+this._depth[mC.RIGHT]),e.print(" ("+this.getDepthDelta()+")"),this._isInResult&&e.print(" inResult")},e.prototype.setMinEdgeRing=function(t){this._minEdgeRing=t},e.prototype.isLineEdge=function(){var t=this._label.isLine(0)||this._label.isLine(1),e=!this._label.isArea(0)||this._label.allPositionsEqual(0,oE.EXTERIOR),n=!this._label.isArea(1)||this._label.allPositionsEqual(1,oE.EXTERIOR);return t&&e&&n},e.prototype.setEdgeRing=function(t){this._edgeRing=t},e.prototype.getMinEdgeRing=function(){return this._minEdgeRing},e.prototype.getDepthDelta=function(){var t=this._edge.getDepthDelta();return this._isForward||(t=-t),t},e.prototype.setInResult=function(t){this._isInResult=t},e.prototype.getSym=function(){return this._sym},e.prototype.isForward=function(){return this._isForward},e.prototype.getEdge=function(){return this._edge},e.prototype.printEdge=function(t){this.print(t),t.print(" "),this._isForward?this._edge.print(t):this._edge.printReverse(t)},e.prototype.setSym=function(t){this._sym=t},e.prototype.setVisitedEdge=function(t){this.setVisited(t),this._sym.setVisited(t)},e.prototype.setEdgeDepths=function(t,e){var n=this.getEdge().getDepthDelta();this._isForward||(n=-n);var r=1;t===mC.LEFT&&(r=-1);var i=mC.opposite(t),o=e+n*r;this.setDepth(t,e),this.setDepth(i,o)},e.prototype.getEdgeRing=function(){return this._edgeRing},e.prototype.isInResult=function(){return this._isInResult},e.prototype.setNext=function(t){this._next=t},e.prototype.isVisited=function(){return this._isVisited},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.depthFactor=function(t,e){return t===oE.EXTERIOR&&e===oE.INTERIOR?1:t===oE.INTERIOR&&e===oE.EXTERIOR?-1:0},e}(kC),FC=function(){};FC.prototype.createNode=function(t){return new RC(t,null)},FC.prototype.interfaces_=function(){return[]},FC.prototype.getClass=function(){return FC};var GC=function(){if(this._edges=new nx,this._nodes=null,this._edgeEndList=new nx,0===arguments.length)this._nodes=new QC(new FC);else if(1===arguments.length){var t=arguments[0];this._nodes=new QC(t)}};GC.prototype.printEdges=function(t){t.println("Edges:");for(var e=0;e<this._edges.size();e++){t.println("edge "+e+":");var n=this._edges.get(e);n.print(t),n.eiList.print(t)}},GC.prototype.find=function(t){return this._nodes.find(t)},GC.prototype.addNode=function(){if(arguments[0]instanceof RC){var t=arguments[0];return this._nodes.addNode(t)}if(arguments[0]instanceof eE){var e=arguments[0];return this._nodes.addNode(e)}},GC.prototype.getNodeIterator=function(){return this._nodes.iterator()},GC.prototype.linkResultDirectedEdges=function(){for(var t=this._nodes.iterator();t.hasNext();){t.next().getEdges().linkResultDirectedEdges()}},GC.prototype.debugPrintln=function(t){IE.out.println(t)},GC.prototype.isBoundaryNode=function(t,e){var n=this._nodes.find(e);if(null===n)return!1;var r=n.getLabel();return null!==r&&r.getLocation(t)===oE.BOUNDARY},GC.prototype.linkAllDirectedEdges=function(){for(var t=this._nodes.iterator();t.hasNext();){t.next().getEdges().linkAllDirectedEdges()}},GC.prototype.matchInSameDirection=function(t,e,n,r){return!!t.equals(n)&&(OE.computeOrientation(t,e,r)===OE.COLLINEAR&&DC.quadrant(t,e)===DC.quadrant(n,r))},GC.prototype.getEdgeEnds=function(){return this._edgeEndList},GC.prototype.debugPrint=function(t){IE.out.print(t)},GC.prototype.getEdgeIterator=function(){return this._edges.iterator()},GC.prototype.findEdgeInSameDirection=function(t,e){for(var n=this,r=0;r<this._edges.size();r++){var i=n._edges.get(r),o=i.getCoordinates();if(n.matchInSameDirection(t,e,o[0],o[1]))return i;if(n.matchInSameDirection(t,e,o[o.length-1],o[o.length-2]))return i}return null},GC.prototype.insertEdge=function(t){this._edges.add(t)},GC.prototype.findEdgeEnd=function(t){for(var e=this.getEdgeEnds().iterator();e.hasNext();){var n=e.next();if(n.getEdge()===t)return n}return null},GC.prototype.addEdges=function(t){for(var e=this,n=t.iterator();n.hasNext();){var r=n.next();e._edges.add(r);var i=new OC(r,!0),o=new OC(r,!1);i.setSym(o),o.setSym(i),e.add(i),e.add(o)}},GC.prototype.add=function(t){this._nodes.add(t),this._edgeEndList.add(t)},GC.prototype.getNodes=function(){return this._nodes.values()},GC.prototype.findEdge=function(t,e){for(var n=0;n<this._edges.size();n++){var r=this._edges.get(n),i=r.getCoordinates();if(t.equals(i[0])&&e.equals(i[1]))return r}return null},GC.prototype.interfaces_=function(){return[]},GC.prototype.getClass=function(){return GC},GC.linkResultDirectedEdges=function(t){for(var e=t.iterator();e.hasNext();){e.next().getEdges().linkResultDirectedEdges()}};var UC=function(){this._geometryFactory=null,this._shellList=new nx;var t=arguments[0];this._geometryFactory=t};UC.prototype.sortShellsAndHoles=function(t,e,n){for(var r=t.iterator();r.hasNext();){var i=r.next();i.isHole()?n.add(i):e.add(i)}},UC.prototype.computePolygons=function(t){for(var e=new nx,n=t.iterator();n.hasNext();){var r=n.next().toPolygon(this._geometryFactory);e.add(r)}return e},UC.prototype.placeFreeHoles=function(t,e){for(var n=e.iterator();n.hasNext();){var r=n.next();if(null===r.getShell()){var i=this.findEdgeRingContaining(r,t);if(null===i)throw new CC("unable to assign hole to a shell",r.getCoordinate(0));r.setShell(i)}}},UC.prototype.buildMinimalEdgeRings=function(t,e,n){for(var r=new nx,i=t.iterator();i.hasNext();){var o=i.next();if(o.getMaxNodeDegree()>2){o.linkDirectedEdgesForMinimalEdgeRings();var s=o.buildMinimalRings(),a=this.findShell(s);null!==a?(this.placePolygonHoles(a,s),e.add(a)):n.addAll(s)}else r.add(o)}return r},UC.prototype.containsPoint=function(t){for(var e=this._shellList.iterator();e.hasNext();){if(e.next().containsPoint(t))return!0}return!1},UC.prototype.buildMaximalEdgeRings=function(t){for(var e=new nx,n=t.iterator();n.hasNext();){var r=n.next();if(r.isInResult()&&r.getLabel().isArea()&&null===r.getEdgeRing()){var i=new NC(r,this._geometryFactory);e.add(i),i.setInResult()}}return e},UC.prototype.placePolygonHoles=function(t,e){for(var n=e.iterator();n.hasNext();){var r=n.next();r.isHole()&&r.setShell(t)}},UC.prototype.getPolygons=function(){return this.computePolygons(this._shellList)},UC.prototype.findEdgeRingContaining=function(t,e){for(var n=t.getLinearRing(),r=n.getEnvelopeInternal(),i=n.getCoordinateN(0),o=null,s=null,a=e.iterator();a.hasNext();){var u=a.next(),l=u.getLinearRing(),c=l.getEnvelopeInternal();null!==o&&(s=o.getLinearRing().getEnvelopeInternal());var h=!1;c.contains(r)&&OE.isPointInRing(i,l.getCoordinates())&&(h=!0),h&&(null===o||s.contains(c))&&(o=u)}return o},UC.prototype.findShell=function(t){for(var e=0,n=null,r=t.iterator();r.hasNext();){var i=r.next();i.isHole()||(n=i,e++)}return TE.isTrue(e<=1,"found two shells in MinimalEdgeRing list"),n},UC.prototype.add=function(){if(1===arguments.length){var t=arguments[0];this.add(t.getEdgeEnds(),t.getNodes())}else if(2===arguments.length){var e=arguments[0];GC.linkResultDirectedEdges(arguments[1]);var n=this.buildMaximalEdgeRings(e),r=new nx,i=this.buildMinimalEdgeRings(n,this._shellList,r);this.sortShellsAndHoles(i,this._shellList,r),this.placeFreeHoles(this._shellList,r)}},UC.prototype.interfaces_=function(){return[]},UC.prototype.getClass=function(){return UC};var qC=function(){};qC.prototype.getBounds=function(){},qC.prototype.interfaces_=function(){return[]},qC.prototype.getClass=function(){return qC};var jC=function(){this._bounds=null,this._item=null;var t=arguments[0],e=arguments[1];this._bounds=t,this._item=e};jC.prototype.getItem=function(){return this._item},jC.prototype.getBounds=function(){return this._bounds},jC.prototype.interfaces_=function(){return[qC,tE]},jC.prototype.getClass=function(){return jC};var zC=function(){this._size=null,this._items=null,this._size=0,this._items=new nx,this._items.add(null)};zC.prototype.poll=function(){if(this.isEmpty())return null;var t=this._items.get(1);return this._items.set(1,this._items.get(this._size)),this._size-=1,this.reorder(1),t},zC.prototype.size=function(){return this._size},zC.prototype.reorder=function(t){for(var e=this,n=null,r=this._items.get(t);2*t<=this._size&&((n=2*t)!==e._size&&e._items.get(n+1).compareTo(e._items.get(n))<0&&n++,e._items.get(n).compareTo(r)<0);t=n)e._items.set(t,e._items.get(n));this._items.set(t,r)},zC.prototype.clear=function(){this._size=0,this._items.clear()},zC.prototype.isEmpty=function(){return 0===this._size},zC.prototype.add=function(t){this._items.add(null),this._size+=1;var e=this._size;for(this._items.set(0,t);t.compareTo(this._items.get(Math.trunc(e/2)))<0;e/=2)this._items.set(e,this._items.get(Math.trunc(e/2)));this._items.set(e,t)},zC.prototype.interfaces_=function(){return[]},zC.prototype.getClass=function(){return zC};var VC=function(){};VC.prototype.visitItem=function(t){},VC.prototype.interfaces_=function(){return[]},VC.prototype.getClass=function(){return VC};var YC=function(){};YC.prototype.insert=function(t,e){},YC.prototype.remove=function(t,e){},YC.prototype.query=function(){},YC.prototype.interfaces_=function(){return[]},YC.prototype.getClass=function(){return YC};var HC=function(){if(this._childBoundables=new nx,this._bounds=null,this._level=null,0===arguments.length);else if(1===arguments.length){var t=arguments[0];this._level=t}},XC={serialVersionUID:{configurable:!0}};HC.prototype.getLevel=function(){return this._level},HC.prototype.size=function(){return this._childBoundables.size()},HC.prototype.getChildBoundables=function(){return this._childBoundables},HC.prototype.addChildBoundable=function(t){TE.isTrue(null===this._bounds),this._childBoundables.add(t)},HC.prototype.isEmpty=function(){return this._childBoundables.isEmpty()},HC.prototype.getBounds=function(){return null===this._bounds&&(this._bounds=this.computeBounds()),this._bounds},HC.prototype.interfaces_=function(){return[qC,tE]},HC.prototype.getClass=function(){return HC},XC.serialVersionUID.get=function(){return 0x5a1e55ec41369800},Object.defineProperties(HC,XC);var JC=function(){};JC.reverseOrder=function(){return{compare:function(t,e){return e.compareTo(t)}}},JC.min=function(t){return JC.sort(t),t.get(0)},JC.sort=function(t,e){var n=t.toArray();e?wx.sort(n,e):wx.sort(n);for(var r=t.iterator(),i=0,o=n.length;i<o;i++)r.next(),r.set(n[i])},JC.singletonList=function(t){var e=new nx;return e.add(t),e};var WC=function(){this._boundable1=null,this._boundable2=null,this._distance=null,this._itemDistance=null;var t=arguments[0],e=arguments[1],n=arguments[2];this._boundable1=t,this._boundable2=e,this._itemDistance=n,this._distance=this.distance()};WC.prototype.expandToQueue=function(t,e){var n=WC.isComposite(this._boundable1),r=WC.isComposite(this._boundable2);if(n&&r)return WC.area(this._boundable1)>WC.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,t,e),null):(this.expand(this._boundable2,this._boundable1,t,e),null);if(n)return this.expand(this._boundable1,this._boundable2,t,e),null;if(r)return this.expand(this._boundable2,this._boundable1,t,e),null;throw new XI("neither boundable is composite")},WC.prototype.isLeaves=function(){return!(WC.isComposite(this._boundable1)||WC.isComposite(this._boundable2))},WC.prototype.compareTo=function(t){var e=t;return this._distance<e._distance?-1:this._distance>e._distance?1:0},WC.prototype.expand=function(t,e,n,r){for(var i=t.getChildBoundables().iterator();i.hasNext();){var o=i.next(),s=new WC(o,e,this._itemDistance);s.getDistance()<r&&n.add(s)}},WC.prototype.getBoundable=function(t){return 0===t?this._boundable1:this._boundable2},WC.prototype.getDistance=function(){return this._distance},WC.prototype.distance=function(){return this.isLeaves()?this._itemDistance.distance(this._boundable1,this._boundable2):this._boundable1.getBounds().distance(this._boundable2.getBounds())},WC.prototype.interfaces_=function(){return[KI]},WC.prototype.getClass=function(){return WC},WC.area=function(t){return t.getBounds().getArea()},WC.isComposite=function(t){return t instanceof HC};var KC=function t(){if(this._root=null,this._built=!1,this._itemBoundables=new nx,this._nodeCapacity=null,0===arguments.length){var e=t.DEFAULT_NODE_CAPACITY;this._nodeCapacity=e}else if(1===arguments.length){var n=arguments[0];TE.isTrue(n>1,"Node capacity must be greater than 1"),this._nodeCapacity=n}},ZC={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};KC.prototype.getNodeCapacity=function(){return this._nodeCapacity},KC.prototype.lastNode=function(t){return t.get(t.size()-1)},KC.prototype.size=function(){if(0===arguments.length)return this.isEmpty()?0:(this.build(),this.size(this._root));if(1===arguments.length){for(var t=0,e=arguments[0].getChildBoundables().iterator();e.hasNext();){var n=e.next();n instanceof HC?t+=this.size(n):n instanceof jC&&(t+=1)}return t}},KC.prototype.removeItem=function(t,e){for(var n=null,r=t.getChildBoundables().iterator();r.hasNext();){var i=r.next();i instanceof jC&&i.getItem()===e&&(n=i)}return null!==n&&(t.getChildBoundables().remove(n),!0)},KC.prototype.itemsTree=function(){if(0===arguments.length){this.build();var t=this.itemsTree(this._root);return null===t?new nx:t}if(1===arguments.length){for(var e=arguments[0],n=new nx,r=e.getChildBoundables().iterator();r.hasNext();){var i=r.next();if(i instanceof HC){var o=this.itemsTree(i);null!==o&&n.add(o)}else i instanceof jC?n.add(i.getItem()):TE.shouldNeverReachHere()}return n.size()<=0?null:n}},KC.prototype.insert=function(t,e){TE.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new jC(t,e))},KC.prototype.boundablesAtLevel=function(){if(1===arguments.length){var t=arguments[0],e=new nx;return this.boundablesAtLevel(t,this._root,e),e}if(3===arguments.length){var n=arguments[0],r=arguments[1],i=arguments[2];if(TE.isTrue(n>-2),r.getLevel()===n)return i.add(r),null;for(var o=r.getChildBoundables().iterator();o.hasNext();){var s=o.next();s instanceof HC?this.boundablesAtLevel(n,s,i):(TE.isTrue(s instanceof jC),-1===n&&i.add(s))}return null}},KC.prototype.query=function(){var t=this;if(1===arguments.length){var e=arguments[0];this.build();var n=new nx;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),e)&&this.query(e,this._root,n),n}if(2===arguments.length){var r=arguments[0],i=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),r)&&this.query(r,this._root,i)}else if(3===arguments.length)if(aE(arguments[2],VC)&&arguments[0]instanceof Object&&arguments[1]instanceof HC)for(var o=arguments[0],s=arguments[2],a=arguments[1].getChildBoundables(),u=0;u<a.size();u++){var l=a.get(u);t.getIntersectsOp().intersects(l.getBounds(),o)&&(l instanceof HC?t.query(o,l,s):l instanceof jC?s.visitItem(l.getItem()):TE.shouldNeverReachHere())}else if(aE(arguments[2],tx)&&arguments[0]instanceof Object&&arguments[1]instanceof HC)for(var c=arguments[0],h=arguments[2],f=arguments[1].getChildBoundables(),p=0;p<f.size();p++){var g=f.get(p);t.getIntersectsOp().intersects(g.getBounds(),c)&&(g instanceof HC?t.query(c,g,h):g instanceof jC?h.add(g.getItem()):TE.shouldNeverReachHere())}},KC.prototype.build=function(){if(this._built)return null;this._root=this._itemBoundables.isEmpty()?this.createNode(0):this.createHigherLevels(this._itemBoundables,-1),this._itemBoundables=null,this._built=!0},KC.prototype.getRoot=function(){return this.build(),this._root},KC.prototype.remove=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];return this.build(),!!this.getIntersectsOp().intersects(this._root.getBounds(),t)&&this.remove(t,this._root,e)}if(3===arguments.length){var n=arguments[0],r=arguments[1],i=arguments[2],o=this.removeItem(r,i);if(o)return!0;for(var s=null,a=r.getChildBoundables().iterator();a.hasNext();){var u=a.next();if(this.getIntersectsOp().intersects(u.getBounds(),n)&&(u instanceof HC&&(o=this.remove(n,u,i)))){s=u;break}}return null!==s&&s.getChildBoundables().isEmpty()&&r.getChildBoundables().remove(s),o}},KC.prototype.createHigherLevels=function(t,e){TE.isTrue(!t.isEmpty());var n=this.createParentBoundables(t,e+1);return 1===n.size()?n.get(0):this.createHigherLevels(n,e+1)},KC.prototype.depth=function(){if(0===arguments.length)return this.isEmpty()?0:(this.build(),this.depth(this._root));if(1===arguments.length){for(var t=0,e=arguments[0].getChildBoundables().iterator();e.hasNext();){var n=e.next();if(n instanceof HC){var r=this.depth(n);r>t&&(t=r)}}return t+1}},KC.prototype.createParentBoundables=function(t,e){var n=this;TE.isTrue(!t.isEmpty());var r=new nx;r.add(this.createNode(e));var i=new nx(t);JC.sort(i,this.getComparator());for(var o=i.iterator();o.hasNext();){var s=o.next();n.lastNode(r).getChildBoundables().size()===n.getNodeCapacity()&&r.add(n.createNode(e)),n.lastNode(r).addChildBoundable(s)}return r},KC.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()},KC.prototype.interfaces_=function(){return[tE]},KC.prototype.getClass=function(){return KC},KC.compareDoubles=function(t,e){return t>e?1:t<e?-1:0},ZC.IntersectsOp.get=function(){return $C},ZC.serialVersionUID.get=function(){return-0x35ef64c82d4c5400},ZC.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(KC,ZC);var $C=function(){},tw=function(){};tw.prototype.distance=function(t,e){},tw.prototype.interfaces_=function(){return[]},tw.prototype.getClass=function(){return tw};var ew=function(t){function e(n){n=n||e.DEFAULT_NODE_CAPACITY,t.call(this,n)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={STRtreeNode:{configurable:!0},serialVersionUID:{configurable:!0},xComparator:{configurable:!0},yComparator:{configurable:!0},intersectsOp:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};return e.prototype.createParentBoundablesFromVerticalSlices=function(t,e){TE.isTrue(t.length>0);for(var n=new nx,r=0;r<t.length;r++)n.addAll(this.createParentBoundablesFromVerticalSlice(t[r],e));return n},e.prototype.createNode=function(t){return new nw(t)},e.prototype.size=function(){return 0===arguments.length?t.prototype.size.call(this):t.prototype.size.apply(this,arguments)},e.prototype.insert=function(){if(2!==arguments.length)return t.prototype.insert.apply(this,arguments);var e=arguments[0],n=arguments[1];if(e.isNull())return null;t.prototype.insert.call(this,e,n)},e.prototype.getIntersectsOp=function(){return e.intersectsOp},e.prototype.verticalSlices=function(t,e){for(var n=Math.trunc(Math.ceil(t.size()/e)),r=new Array(e).fill(null),i=t.iterator(),o=0;o<e;o++){r[o]=new nx;for(var s=0;i.hasNext()&&s<n;){var a=i.next();r[o].add(a),s++}}return r},e.prototype.query=function(){if(1===arguments.length){var e=arguments[0];return t.prototype.query.call(this,e)}if(2===arguments.length){var n=arguments[0],r=arguments[1];t.prototype.query.call(this,n,r)}else if(3===arguments.length)if(aE(arguments[2],VC)&&arguments[0]instanceof Object&&arguments[1]instanceof HC){var i=arguments[0],o=arguments[1],s=arguments[2];t.prototype.query.call(this,i,o,s)}else if(aE(arguments[2],tx)&&arguments[0]instanceof Object&&arguments[1]instanceof HC){var a=arguments[0],u=arguments[1],l=arguments[2];t.prototype.query.call(this,a,u,l)}},e.prototype.getComparator=function(){return e.yComparator},e.prototype.createParentBoundablesFromVerticalSlice=function(e,n){return t.prototype.createParentBoundables.call(this,e,n)},e.prototype.remove=function(){if(2===arguments.length){var e=arguments[0],n=arguments[1];return t.prototype.remove.call(this,e,n)}return t.prototype.remove.apply(this,arguments)},e.prototype.depth=function(){return 0===arguments.length?t.prototype.depth.call(this):t.prototype.depth.apply(this,arguments)},e.prototype.createParentBoundables=function(t,n){TE.isTrue(!t.isEmpty());var r=Math.trunc(Math.ceil(t.size()/this.getNodeCapacity())),i=new nx(t);JC.sort(i,e.xComparator);var o=this.verticalSlices(i,Math.trunc(Math.ceil(Math.sqrt(r))));return this.createParentBoundablesFromVerticalSlices(o,n)},e.prototype.nearestNeighbour=function(){if(1===arguments.length){if(aE(arguments[0],tw)){var t=arguments[0],n=new WC(this.getRoot(),this.getRoot(),t);return this.nearestNeighbour(n)}if(arguments[0]instanceof WC){var r=arguments[0];return this.nearestNeighbour(r,JI.POSITIVE_INFINITY)}}else if(2===arguments.length){if(arguments[0]instanceof e&&aE(arguments[1],tw)){var i=arguments[0],o=arguments[1],s=new WC(this.getRoot(),i.getRoot(),o);return this.nearestNeighbour(s)}if(arguments[0]instanceof WC&&"number"==typeof arguments[1]){var a=arguments[0],u=arguments[1],l=null,c=new zC;for(c.add(a);!c.isEmpty()&&u>0;){var h=c.poll(),f=h.getDistance();if(f>=u)break;h.isLeaves()?(u=f,l=h):h.expandToQueue(c,u)}return[l.getBoundable(0).getItem(),l.getBoundable(1).getItem()]}}else if(3===arguments.length){var p=arguments[2],g=new jC(arguments[0],arguments[1]),A=new WC(this.getRoot(),g,p);return this.nearestNeighbour(A)[0]}},e.prototype.interfaces_=function(){return[YC,tE]},e.prototype.getClass=function(){return e},e.centreX=function(t){return e.avg(t.getMinX(),t.getMaxX())},e.avg=function(t,e){return(t+e)/2},e.centreY=function(t){return e.avg(t.getMinY(),t.getMaxY())},n.STRtreeNode.get=function(){return nw},n.serialVersionUID.get=function(){return 0x39920f7d5f261e0},n.xComparator.get=function(){return{interfaces_:function(){return[$I]},compare:function(n,r){return t.compareDoubles(e.centreX(n.getBounds()),e.centreX(r.getBounds()))}}},n.yComparator.get=function(){return{interfaces_:function(){return[$I]},compare:function(n,r){return t.compareDoubles(e.centreY(n.getBounds()),e.centreY(r.getBounds()))}}},n.intersectsOp.get=function(){return{interfaces_:function(){return[t.IntersectsOp]},intersects:function(t,e){return t.intersects(e)}}},n.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(e,n),e}(KC),nw=function(t){function e(){var e=arguments[0];t.call(this,e)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.computeBounds=function(){for(var t=null,e=this.getChildBoundables().iterator();e.hasNext();){var n=e.next();null===t?t=new xE(n.getBounds()):t.expandToInclude(n.getBounds())}return t},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(HC),rw=function(){};rw.prototype.interfaces_=function(){return[]},rw.prototype.getClass=function(){return rw},rw.relativeSign=function(t,e){return t<e?-1:t>e?1:0},rw.compare=function(t,e,n){if(e.equals2D(n))return 0;var r=rw.relativeSign(e.x,n.x),i=rw.relativeSign(e.y,n.y);switch(t){case 0:return rw.compareValue(r,i);case 1:return rw.compareValue(i,r);case 2:return rw.compareValue(i,-r);case 3:return rw.compareValue(-r,i);case 4:return rw.compareValue(-r,-i);case 5:return rw.compareValue(-i,-r);case 6:return rw.compareValue(-i,r);case 7:return rw.compareValue(r,-i)}return TE.shouldNeverReachHere("invalid octant value"),0},rw.compareValue=function(t,e){return t<0?-1:t>0?1:e<0?-1:e>0?1:0};var iw=function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var t=arguments[0],e=arguments[1],n=arguments[2],r=arguments[3];this._segString=t,this.coord=new eE(e),this.segmentIndex=n,this._segmentOctant=r,this._isInterior=!e.equals2D(t.getCoordinate(n))};iw.prototype.getCoordinate=function(){return this.coord},iw.prototype.print=function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex)},iw.prototype.compareTo=function(t){var e=t;return this.segmentIndex<e.segmentIndex?-1:this.segmentIndex>e.segmentIndex?1:this.coord.equals2D(e.coord)?0:rw.compare(this._segmentOctant,this.coord,e.coord)},iw.prototype.isEndPoint=function(t){return 0===this.segmentIndex&&!this._isInterior||this.segmentIndex===t},iw.prototype.isInterior=function(){return this._isInterior},iw.prototype.interfaces_=function(){return[KI]},iw.prototype.getClass=function(){return iw};var ow=function(){this._nodeMap=new _x,this._edge=null;var t=arguments[0];this._edge=t};ow.prototype.getSplitCoordinates=function(){var t=new ix;this.addEndpoints();for(var e=this.iterator(),n=e.next();e.hasNext();){var r=e.next();this.addEdgeCoordinates(n,r,t),n=r}return t.toCoordinateArray()},ow.prototype.addCollapsedNodes=function(){var t=new nx;this.findCollapsesFromInsertedNodes(t),this.findCollapsesFromExistingVertices(t);for(var e=t.iterator();e.hasNext();){var n=e.next().intValue();this.add(this._edge.getCoordinate(n),n)}},ow.prototype.print=function(t){t.println("Intersections:");for(var e=this.iterator();e.hasNext();){e.next().print(t)}},ow.prototype.findCollapsesFromExistingVertices=function(t){for(var e=0;e<this._edge.size()-2;e++){var n=this._edge.getCoordinate(e),r=this._edge.getCoordinate(e+2);n.equals2D(r)&&t.add(new hE(e+1))}},ow.prototype.addEdgeCoordinates=function(t,e,n){var r=this._edge.getCoordinate(e.segmentIndex),i=e.isInterior()||!e.coord.equals2D(r);n.add(new eE(t.coord),!1);for(var o=t.segmentIndex+1;o<=e.segmentIndex;o++)n.add(this._edge.getCoordinate(o));i&&n.add(new eE(e.coord))},ow.prototype.iterator=function(){return this._nodeMap.values().iterator()},ow.prototype.addSplitEdges=function(t){this.addEndpoints(),this.addCollapsedNodes();for(var e=this.iterator(),n=e.next();e.hasNext();){var r=e.next(),i=this.createSplitEdge(n,r);t.add(i),n=r}},ow.prototype.findCollapseIndex=function(t,e,n){if(!t.coord.equals2D(e.coord))return!1;var r=e.segmentIndex-t.segmentIndex;return e.isInterior()||r--,1===r&&(n[0]=t.segmentIndex+1,!0)},ow.prototype.findCollapsesFromInsertedNodes=function(t){for(var e=new Array(1).fill(null),n=this.iterator(),r=n.next();n.hasNext();){var i=n.next();this.findCollapseIndex(r,i,e)&&t.add(new hE(e[0])),r=i}},ow.prototype.getEdge=function(){return this._edge},ow.prototype.addEndpoints=function(){var t=this._edge.size()-1;this.add(this._edge.getCoordinate(0),0),this.add(this._edge.getCoordinate(t),t)},ow.prototype.createSplitEdge=function(t,e){var n=e.segmentIndex-t.segmentIndex+2,r=this._edge.getCoordinate(e.segmentIndex),i=e.isInterior()||!e.coord.equals2D(r);i||n--;var o=new Array(n).fill(null),s=0;o[s++]=new eE(t.coord);for(var a=t.segmentIndex+1;a<=e.segmentIndex;a++)o[s++]=this._edge.getCoordinate(a);return i&&(o[s]=new eE(e.coord)),new lw(o,this._edge.getData())},ow.prototype.add=function(t,e){var n=new iw(this._edge,t,e,this._edge.getSegmentOctant(e)),r=this._nodeMap.get(n);return null!==r?(TE.isTrue(r.coord.equals2D(t),"Found equal nodes with different coordinates"),r):(this._nodeMap.put(n,n),n)},ow.prototype.checkSplitEdgesCorrectness=function(t){var e=this._edge.getCoordinates(),n=t.get(0).getCoordinate(0);if(!n.equals2D(e[0]))throw new LE("bad split edge start point at "+n);var r=t.get(t.size()-1).getCoordinates(),i=r[r.length-1];if(!i.equals2D(e[e.length-1]))throw new LE("bad split edge end point at "+i)},ow.prototype.interfaces_=function(){return[]},ow.prototype.getClass=function(){return ow};var sw=function(){};sw.prototype.interfaces_=function(){return[]},sw.prototype.getClass=function(){return sw},sw.octant=function(){if("number"==typeof arguments[0]&&"number"==typeof arguments[1]){var t=arguments[0],e=arguments[1];if(0===t&&0===e)throw new XI("Cannot compute the octant for point ( "+t+", "+e+" )");var n=Math.abs(t),r=Math.abs(e);return t>=0?e>=0?n>=r?0:1:n>=r?7:6:e>=0?n>=r?3:2:n>=r?4:5}if(arguments[0]instanceof eE&&arguments[1]instanceof eE){var i=arguments[0],o=arguments[1],s=o.x-i.x,a=o.y-i.y;if(0===s&&0===a)throw new XI("Cannot compute the octant for two identical points "+i);return sw.octant(s,a)}};var aw=function(){};aw.prototype.getCoordinates=function(){},aw.prototype.size=function(){},aw.prototype.getCoordinate=function(t){},aw.prototype.isClosed=function(){},aw.prototype.setData=function(t){},aw.prototype.getData=function(){},aw.prototype.interfaces_=function(){return[]},aw.prototype.getClass=function(){return aw};var uw=function(){};uw.prototype.addIntersection=function(t,e){},uw.prototype.interfaces_=function(){return[aw]},uw.prototype.getClass=function(){return uw};var lw=function(){this._nodeList=new ow(this),this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};lw.prototype.getCoordinates=function(){return this._pts},lw.prototype.size=function(){return this._pts.length},lw.prototype.getCoordinate=function(t){return this._pts[t]},lw.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},lw.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(t),this.getCoordinate(t+1))},lw.prototype.setData=function(t){this._data=t},lw.prototype.safeOctant=function(t,e){return t.equals2D(e)?0:sw.octant(t,e)},lw.prototype.getData=function(){return this._data},lw.prototype.addIntersection=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];this.addIntersectionNode(t,e)}else if(4===arguments.length){var n=arguments[1],r=arguments[3],i=new eE(arguments[0].getIntersection(r));this.addIntersection(i,n)}},lw.prototype.toString=function(){return ME.toLineString(new nC(this._pts))},lw.prototype.getNodeList=function(){return this._nodeList},lw.prototype.addIntersectionNode=function(t,e){var n=e,r=n+1;if(r<this._pts.length){var i=this._pts[r];t.equals2D(i)&&(n=r)}return this._nodeList.add(t,n)},lw.prototype.addIntersections=function(t,e,n){for(var r=0;r<t.getIntersectionNum();r++)this.addIntersection(t,e,n,r)},lw.prototype.interfaces_=function(){return[uw]},lw.prototype.getClass=function(){return lw},lw.getNodedSubstrings=function(){if(1===arguments.length){var t=arguments[0],e=new nx;return lw.getNodedSubstrings(t,e),e}if(2===arguments.length)for(var n=arguments[1],r=arguments[0].iterator();r.hasNext();){r.next().getNodeList().addSplitEdges(n)}};var cw=function(){if(this.p0=null,this.p1=null,0===arguments.length)this.p0=new eE,this.p1=new eE;else if(1===arguments.length){var t=arguments[0];this.p0=new eE(t.p0),this.p1=new eE(t.p1)}else if(2===arguments.length)this.p0=arguments[0],this.p1=arguments[1];else if(4===arguments.length){var e=arguments[0],n=arguments[1],r=arguments[2],i=arguments[3];this.p0=new eE(e,n),this.p1=new eE(r,i)}},hw={serialVersionUID:{configurable:!0}};cw.prototype.minX=function(){return Math.min(this.p0.x,this.p1.x)},cw.prototype.orientationIndex=function(){if(arguments[0]instanceof cw){var t=arguments[0],e=OE.orientationIndex(this.p0,this.p1,t.p0),n=OE.orientationIndex(this.p0,this.p1,t.p1);return e>=0&&n>=0||e<=0&&n<=0?Math.max(e,n):0}if(arguments[0]instanceof eE){var r=arguments[0];return OE.orientationIndex(this.p0,this.p1,r)}},cw.prototype.toGeometry=function(t){return t.createLineString([this.p0,this.p1])},cw.prototype.isVertical=function(){return this.p0.x===this.p1.x},cw.prototype.equals=function(t){if(!(t instanceof cw))return!1;var e=t;return this.p0.equals(e.p0)&&this.p1.equals(e.p1)},cw.prototype.intersection=function(t){var e=new DE;return e.computeIntersection(this.p0,this.p1,t.p0,t.p1),e.hasIntersection()?e.getIntersection(0):null},cw.prototype.project=function(){if(arguments[0]instanceof eE){var t=arguments[0];if(t.equals(this.p0)||t.equals(this.p1))return new eE(t);var e=this.projectionFactor(t),n=new eE;return n.x=this.p0.x+e*(this.p1.x-this.p0.x),n.y=this.p0.y+e*(this.p1.y-this.p0.y),n}if(arguments[0]instanceof cw){var r=arguments[0],i=this.projectionFactor(r.p0),o=this.projectionFactor(r.p1);if(i>=1&&o>=1)return null;if(i<=0&&o<=0)return null;var s=this.project(r.p0);i<0&&(s=this.p0),i>1&&(s=this.p1);var a=this.project(r.p1);return o<0&&(a=this.p0),o>1&&(a=this.p1),new cw(s,a)}},cw.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()},cw.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)},cw.prototype.getCoordinate=function(t){return 0===t?this.p0:this.p1},cw.prototype.distancePerpendicular=function(t){return OE.distancePointLinePerpendicular(t,this.p0,this.p1)},cw.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)},cw.prototype.midPoint=function(){return cw.midPoint(this.p0,this.p1)},cw.prototype.projectionFactor=function(t){if(t.equals(this.p0))return 0;if(t.equals(this.p1))return 1;var e=this.p1.x-this.p0.x,n=this.p1.y-this.p0.y,r=e*e+n*n;return r<=0?JI.NaN:((t.x-this.p0.x)*e+(t.y-this.p0.y)*n)/r},cw.prototype.closestPoints=function(t){var e=this.intersection(t);if(null!==e)return[e,e];var n=new Array(2).fill(null),r=JI.MAX_VALUE,i=null,o=this.closestPoint(t.p0);r=o.distance(t.p0),n[0]=o,n[1]=t.p0;var s=this.closestPoint(t.p1);(i=s.distance(t.p1))<r&&(r=i,n[0]=s,n[1]=t.p1);var a=t.closestPoint(this.p0);(i=a.distance(this.p0))<r&&(r=i,n[0]=this.p0,n[1]=a);var u=t.closestPoint(this.p1);return(i=u.distance(this.p1))<r&&(r=i,n[0]=this.p1,n[1]=u),n},cw.prototype.closestPoint=function(t){var e=this.projectionFactor(t);return e>0&&e<1?this.project(t):this.p0.distance(t)<this.p1.distance(t)?this.p0:this.p1},cw.prototype.maxX=function(){return Math.max(this.p0.x,this.p1.x)},cw.prototype.getLength=function(){return this.p0.distance(this.p1)},cw.prototype.compareTo=function(t){var e=t,n=this.p0.compareTo(e.p0);return 0!==n?n:this.p1.compareTo(e.p1)},cw.prototype.reverse=function(){var t=this.p0;this.p0=this.p1,this.p1=t},cw.prototype.equalsTopo=function(t){return this.p0.equals(t.p0)&&(this.p1.equals(t.p1)||this.p0.equals(t.p1))&&this.p1.equals(t.p0)},cw.prototype.lineIntersection=function(t){try{return EE.intersection(this.p0,this.p1,t.p0,t.p1)}catch(t){if(!(t instanceof _E))throw t}return null},cw.prototype.maxY=function(){return Math.max(this.p0.y,this.p1.y)},cw.prototype.pointAlongOffset=function(t,e){var n=this.p0.x+t*(this.p1.x-this.p0.x),r=this.p0.y+t*(this.p1.y-this.p0.y),i=this.p1.x-this.p0.x,o=this.p1.y-this.p0.y,s=Math.sqrt(i*i+o*o),a=0,u=0;if(0!==e){if(s<=0)throw new Error("Cannot compute offset from zero-length line segment");a=e*i/s,u=e*o/s}return new eE(n-u,r+a)},cw.prototype.setCoordinates=function(){if(1===arguments.length){var t=arguments[0];this.setCoordinates(t.p0,t.p1)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];this.p0.x=e.x,this.p0.y=e.y,this.p1.x=n.x,this.p1.y=n.y}},cw.prototype.segmentFraction=function(t){var e=this.projectionFactor(t);return e<0?e=0:(e>1||JI.isNaN(e))&&(e=1),e},cw.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"},cw.prototype.isHorizontal=function(){return this.p0.y===this.p1.y},cw.prototype.distance=function(){if(arguments[0]instanceof cw){var t=arguments[0];return OE.distanceLineLine(this.p0,this.p1,t.p0,t.p1)}if(arguments[0]instanceof eE){var e=arguments[0];return OE.distancePointLine(e,this.p0,this.p1)}},cw.prototype.pointAlong=function(t){var e=new eE;return e.x=this.p0.x+t*(this.p1.x-this.p0.x),e.y=this.p0.y+t*(this.p1.y-this.p0.y),e},cw.prototype.hashCode=function(){var t=JI.doubleToLongBits(this.p0.x);t^=31*JI.doubleToLongBits(this.p0.y);var e=Math.trunc(t)^Math.trunc(t>>32),n=JI.doubleToLongBits(this.p1.x);return n^=31*JI.doubleToLongBits(this.p1.y),e^(Math.trunc(n)^Math.trunc(n>>32))},cw.prototype.interfaces_=function(){return[KI,tE]},cw.prototype.getClass=function(){return cw},cw.midPoint=function(t,e){return new eE((t.x+e.x)/2,(t.y+e.y)/2)},hw.serialVersionUID.get=function(){return 0x2d2172135f411c00},Object.defineProperties(cw,hw);var fw=function(){this.tempEnv1=new xE,this.tempEnv2=new xE,this._overlapSeg1=new cw,this._overlapSeg2=new cw};fw.prototype.overlap=function(){if(2===arguments.length);else if(4===arguments.length){var t=arguments[1],e=arguments[2],n=arguments[3];arguments[0].getLineSegment(t,this._overlapSeg1),e.getLineSegment(n,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}},fw.prototype.interfaces_=function(){return[]},fw.prototype.getClass=function(){return fw};var pw=function(){this._pts=null,this._start=null,this._end=null,this._env=null,this._context=null,this._id=null;var t=arguments[0],e=arguments[1],n=arguments[2],r=arguments[3];this._pts=t,this._start=e,this._end=n,this._context=r};pw.prototype.getLineSegment=function(t,e){e.p0=this._pts[t],e.p1=this._pts[t+1]},pw.prototype.computeSelect=function(t,e,n,r){var i=this._pts[e],o=this._pts[n];if(r.tempEnv1.init(i,o),n-e==1)return r.select(this,e),null;if(!t.intersects(r.tempEnv1))return null;var s=Math.trunc((e+n)/2);e<s&&this.computeSelect(t,e,s,r),s<n&&this.computeSelect(t,s,n,r)},pw.prototype.getCoordinates=function(){for(var t=new Array(this._end-this._start+1).fill(null),e=0,n=this._start;n<=this._end;n++)t[e++]=this._pts[n];return t},pw.prototype.computeOverlaps=function(t,e){this.computeOverlapsInternal(this._start,this._end,t,t._start,t._end,e)},pw.prototype.setId=function(t){this._id=t},pw.prototype.select=function(t,e){this.computeSelect(t,this._start,this._end,e)},pw.prototype.getEnvelope=function(){if(null===this._env){var t=this._pts[this._start],e=this._pts[this._end];this._env=new xE(t,e)}return this._env},pw.prototype.getEndIndex=function(){return this._end},pw.prototype.getStartIndex=function(){return this._start},pw.prototype.getContext=function(){return this._context},pw.prototype.getId=function(){return this._id},pw.prototype.computeOverlapsInternal=function(t,e,n,r,i,o){var s=this._pts[t],a=this._pts[e],u=n._pts[r],l=n._pts[i];if(e-t==1&&i-r==1)return o.overlap(this,t,n,r),null;if(o.tempEnv1.init(s,a),o.tempEnv2.init(u,l),!o.tempEnv1.intersects(o.tempEnv2))return null;var c=Math.trunc((t+e)/2),h=Math.trunc((r+i)/2);t<c&&(r<h&&this.computeOverlapsInternal(t,c,n,r,h,o),h<i&&this.computeOverlapsInternal(t,c,n,h,i,o)),c<e&&(r<h&&this.computeOverlapsInternal(c,e,n,r,h,o),h<i&&this.computeOverlapsInternal(c,e,n,h,i,o))},pw.prototype.interfaces_=function(){return[]},pw.prototype.getClass=function(){return pw};var gw=function(){};gw.prototype.interfaces_=function(){return[]},gw.prototype.getClass=function(){return gw},gw.getChainStartIndices=function(t){var e=0,n=new nx;n.add(new hE(e));do{var r=gw.findChainEnd(t,e);n.add(new hE(r)),e=r}while(e<t.length-1);return gw.toIntArray(n)},gw.findChainEnd=function(t,e){for(var n=e;n<t.length-1&&t[n].equals2D(t[n+1]);)n++;if(n>=t.length-1)return t.length-1;for(var r=DC.quadrant(t[n],t[n+1]),i=e+1;i<t.length;){if(!t[i-1].equals2D(t[i]))if(DC.quadrant(t[i-1],t[i])!==r)break;i++}return i-1},gw.getChains=function(){if(1===arguments.length)return gw.getChains(arguments[0],null);if(2===arguments.length){for(var t=arguments[0],e=arguments[1],n=new nx,r=gw.getChainStartIndices(t),i=0;i<r.length-1;i++){var o=new pw(t,r[i],r[i+1],e);n.add(o)}return n}},gw.toIntArray=function(t){for(var e=new Array(t.size()).fill(null),n=0;n<e.length;n++)e[n]=t.get(n).intValue();return e};var Aw=function(){};Aw.prototype.computeNodes=function(t){},Aw.prototype.getNodedSubstrings=function(){},Aw.prototype.interfaces_=function(){return[]},Aw.prototype.getClass=function(){return Aw};var dw=function(){if(this._segInt=null,0===arguments.length);else if(1===arguments.length){var t=arguments[0];this.setSegmentIntersector(t)}};dw.prototype.setSegmentIntersector=function(t){this._segInt=t},dw.prototype.interfaces_=function(){return[Aw]},dw.prototype.getClass=function(){return dw};var yw=function(t){function e(e){e?t.call(this,e):t.call(this),this._monoChains=new nx,this._index=new ew,this._idCounter=0,this._nodedSegStrings=null,this._nOverlaps=0}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={SegmentOverlapAction:{configurable:!0}};return e.prototype.getMonotoneChains=function(){return this._monoChains},e.prototype.getNodedSubstrings=function(){return lw.getNodedSubstrings(this._nodedSegStrings)},e.prototype.getIndex=function(){return this._index},e.prototype.add=function(t){for(var e=this,n=gw.getChains(t.getCoordinates(),t).iterator();n.hasNext();){var r=n.next();r.setId(e._idCounter++),e._index.insert(r.getEnvelope(),r),e._monoChains.add(r)}},e.prototype.computeNodes=function(t){this._nodedSegStrings=t;for(var e=t.iterator();e.hasNext();)this.add(e.next());this.intersectChains()},e.prototype.intersectChains=function(){for(var t=this,e=new vw(this._segInt),n=this._monoChains.iterator();n.hasNext();)for(var r=n.next(),i=t._index.query(r.getEnvelope()).iterator();i.hasNext();){var o=i.next();if(o.getId()>r.getId()&&(r.computeOverlaps(o,e),t._nOverlaps++),t._segInt.isDone())return null}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},n.SegmentOverlapAction.get=function(){return vw},Object.defineProperties(e,n),e}(dw),vw=function(t){function e(){t.call(this),this._si=null;var e=arguments[0];this._si=e}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.overlap=function(){if(4!==arguments.length)return t.prototype.overlap.apply(this,arguments);var e=arguments[1],n=arguments[2],r=arguments[3],i=arguments[0].getContext(),o=n.getContext();this._si.processIntersections(i,e,o,r)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(fw),mw=function t(){if(this._quadrantSegments=t.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=t.CAP_ROUND,this._joinStyle=t.JOIN_ROUND,this._mitreLimit=t.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=t.DEFAULT_SIMPLIFY_FACTOR,0===arguments.length);else if(1===arguments.length){var e=arguments[0];this.setQuadrantSegments(e)}else if(2===arguments.length){var n=arguments[0],r=arguments[1];this.setQuadrantSegments(n),this.setEndCapStyle(r)}else if(4===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3];this.setQuadrantSegments(i),this.setEndCapStyle(o),this.setJoinStyle(s),this.setMitreLimit(a)}},_w={CAP_ROUND:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},JOIN_ROUND:{configurable:!0},JOIN_MITRE:{configurable:!0},JOIN_BEVEL:{configurable:!0},DEFAULT_QUADRANT_SEGMENTS:{configurable:!0},DEFAULT_MITRE_LIMIT:{configurable:!0},DEFAULT_SIMPLIFY_FACTOR:{configurable:!0}};mw.prototype.getEndCapStyle=function(){return this._endCapStyle},mw.prototype.isSingleSided=function(){return this._isSingleSided},mw.prototype.setQuadrantSegments=function(t){this._quadrantSegments=t,0===this._quadrantSegments&&(this._joinStyle=mw.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=mw.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),t<=0&&(this._quadrantSegments=1),this._joinStyle!==mw.JOIN_ROUND&&(this._quadrantSegments=mw.DEFAULT_QUADRANT_SEGMENTS)},mw.prototype.getJoinStyle=function(){return this._joinStyle},mw.prototype.setJoinStyle=function(t){this._joinStyle=t},mw.prototype.setSimplifyFactor=function(t){this._simplifyFactor=t<0?0:t},mw.prototype.getSimplifyFactor=function(){return this._simplifyFactor},mw.prototype.getQuadrantSegments=function(){return this._quadrantSegments},mw.prototype.setEndCapStyle=function(t){this._endCapStyle=t},mw.prototype.getMitreLimit=function(){return this._mitreLimit},mw.prototype.setMitreLimit=function(t){this._mitreLimit=t},mw.prototype.setSingleSided=function(t){this._isSingleSided=t},mw.prototype.interfaces_=function(){return[]},mw.prototype.getClass=function(){return mw},mw.bufferDistanceError=function(t){var e=Math.PI/2/t;return 1-Math.cos(e/2)},_w.CAP_ROUND.get=function(){return 1},_w.CAP_FLAT.get=function(){return 2},_w.CAP_SQUARE.get=function(){return 3},_w.JOIN_ROUND.get=function(){return 1},_w.JOIN_MITRE.get=function(){return 2},_w.JOIN_BEVEL.get=function(){return 3},_w.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8},_w.DEFAULT_MITRE_LIMIT.get=function(){return 5},_w.DEFAULT_SIMPLIFY_FACTOR.get=function(){return.01},Object.defineProperties(mw,_w);var Iw=function(t){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=OE.COUNTERCLOCKWISE,this._inputLine=t||null},Ew={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};Iw.prototype.isDeletable=function(t,e,n,r){var i=this._inputLine[t],o=this._inputLine[e],s=this._inputLine[n];return!!this.isConcave(i,o,s)&&(!!this.isShallow(i,o,s,r)&&this.isShallowSampled(i,o,t,n,r))},Iw.prototype.deleteShallowConcavities=function(){for(var t=this,e=1,n=this.findNextNonDeletedIndex(e),r=this.findNextNonDeletedIndex(n),i=!1;r<this._inputLine.length;){var o=!1;t.isDeletable(e,n,r,t._distanceTol)&&(t._isDeleted[n]=Iw.DELETE,o=!0,i=!0),e=o?r:n,n=t.findNextNonDeletedIndex(e),r=t.findNextNonDeletedIndex(n)}return i},Iw.prototype.isShallowConcavity=function(t,e,n,r){return OE.computeOrientation(t,e,n)===this._angleOrientation&&OE.distancePointLine(e,t,n)<r},Iw.prototype.isShallowSampled=function(t,e,n,r,i){var o=Math.trunc((r-n)/Iw.NUM_PTS_TO_CHECK);o<=0&&(o=1);for(var s=n;s<r;s+=o)if(!this.isShallow(t,e,this._inputLine[s],i))return!1;return!0},Iw.prototype.isConcave=function(t,e,n){var r=OE.computeOrientation(t,e,n)===this._angleOrientation;return r},Iw.prototype.simplify=function(t){this._distanceTol=Math.abs(t),t<0&&(this._angleOrientation=OE.CLOCKWISE),this._isDeleted=new Array(this._inputLine.length).fill(null);var e=!1;do{e=this.deleteShallowConcavities()}while(e);return this.collapseLine()},Iw.prototype.findNextNonDeletedIndex=function(t){for(var e=t+1;e<this._inputLine.length&&this._isDeleted[e]===Iw.DELETE;)e++;return e},Iw.prototype.isShallow=function(t,e,n,r){return OE.distancePointLine(e,t,n)<r},Iw.prototype.collapseLine=function(){for(var t=new ix,e=0;e<this._inputLine.length;e++)this._isDeleted[e]!==Iw.DELETE&&t.add(this._inputLine[e]);return t.toCoordinateArray()},Iw.prototype.interfaces_=function(){return[]},Iw.prototype.getClass=function(){return Iw},Iw.simplify=function(t,e){return new Iw(t).simplify(e)},Ew.INIT.get=function(){return 0},Ew.DELETE.get=function(){return 1},Ew.KEEP.get=function(){return 1},Ew.NUM_PTS_TO_CHECK.get=function(){return 10},Object.defineProperties(Iw,Ew);var xw=function(){this._ptList=null,this._precisionModel=null,this._minimimVertexDistance=0,this._ptList=new nx},Cw={COORDINATE_ARRAY_TYPE:{configurable:!0}};xw.prototype.getCoordinates=function(){return this._ptList.toArray(xw.COORDINATE_ARRAY_TYPE)},xw.prototype.setPrecisionModel=function(t){this._precisionModel=t},xw.prototype.addPt=function(t){var e=new eE(t);if(this._precisionModel.makePrecise(e),this.isRedundant(e))return null;this._ptList.add(e)},xw.prototype.revere=function(){},xw.prototype.addPts=function(t,e){if(e)for(var n=0;n<t.length;n++)this.addPt(t[n]);else for(var r=t.length-1;r>=0;r--)this.addPt(t[r])},xw.prototype.isRedundant=function(t){if(this._ptList.size()<1)return!1;var e=this._ptList.get(this._ptList.size()-1);return t.distance(e)<this._minimimVertexDistance},xw.prototype.toString=function(){return(new hC).createLineString(this.getCoordinates()).toString()},xw.prototype.closeRing=function(){if(this._ptList.size()<1)return null;var t=new eE(this._ptList.get(0)),e=this._ptList.get(this._ptList.size()-1);if(t.equals(e))return null;this._ptList.add(t)},xw.prototype.setMinimumVertexDistance=function(t){this._minimimVertexDistance=t},xw.prototype.interfaces_=function(){return[]},xw.prototype.getClass=function(){return xw},Cw.COORDINATE_ARRAY_TYPE.get=function(){return new Array(0).fill(null)},Object.defineProperties(xw,Cw);var ww=function(){},bw={PI_TIMES_2:{configurable:!0},PI_OVER_2:{configurable:!0},PI_OVER_4:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},CLOCKWISE:{configurable:!0},NONE:{configurable:!0}};ww.prototype.interfaces_=function(){return[]},ww.prototype.getClass=function(){return ww},ww.toDegrees=function(t){return 180*t/Math.PI},ww.normalize=function(t){for(;t>Math.PI;)t-=ww.PI_TIMES_2;for(;t<=-Math.PI;)t+=ww.PI_TIMES_2;return t},ww.angle=function(){if(1===arguments.length){var t=arguments[0];return Math.atan2(t.y,t.x)}if(2===arguments.length){var e=arguments[0],n=arguments[1],r=n.x-e.x,i=n.y-e.y;return Math.atan2(i,r)}},ww.isAcute=function(t,e,n){var r=t.x-e.x,i=t.y-e.y;return r*(n.x-e.x)+i*(n.y-e.y)>0},ww.isObtuse=function(t,e,n){var r=t.x-e.x,i=t.y-e.y;return r*(n.x-e.x)+i*(n.y-e.y)<0},ww.interiorAngle=function(t,e,n){var r=ww.angle(e,t),i=ww.angle(e,n);return Math.abs(i-r)},ww.normalizePositive=function(t){if(t<0){for(;t<0;)t+=ww.PI_TIMES_2;t>=ww.PI_TIMES_2&&(t=0)}else{for(;t>=ww.PI_TIMES_2;)t-=ww.PI_TIMES_2;t<0&&(t=0)}return t},ww.angleBetween=function(t,e,n){var r=ww.angle(e,t),i=ww.angle(e,n);return ww.diff(r,i)},ww.diff=function(t,e){var n=null;return(n=t<e?e-t:t-e)>Math.PI&&(n=2*Math.PI-n),n},ww.toRadians=function(t){return t*Math.PI/180},ww.getTurn=function(t,e){var n=Math.sin(e-t);return n>0?ww.COUNTERCLOCKWISE:n<0?ww.CLOCKWISE:ww.NONE},ww.angleBetweenOriented=function(t,e,n){var r=ww.angle(e,t),i=ww.angle(e,n)-r;return i<=-Math.PI?i+ww.PI_TIMES_2:i>Math.PI?i-ww.PI_TIMES_2:i},bw.PI_TIMES_2.get=function(){return 2*Math.PI},bw.PI_OVER_2.get=function(){return Math.PI/2},bw.PI_OVER_4.get=function(){return Math.PI/4},bw.COUNTERCLOCKWISE.get=function(){return OE.COUNTERCLOCKWISE},bw.CLOCKWISE.get=function(){return OE.CLOCKWISE},bw.NONE.get=function(){return OE.COLLINEAR},Object.defineProperties(ww,bw);var Bw=function t(){this._maxCurveSegmentError=0,this._filletAngleQuantum=null,this._closingSegLengthFactor=1,this._segList=null,this._distance=0,this._precisionModel=null,this._bufParams=null,this._li=null,this._s0=null,this._s1=null,this._s2=null,this._seg0=new cw,this._seg1=new cw,this._offset0=new cw,this._offset1=new cw,this._side=0,this._hasNarrowConcaveAngle=!1;var e=arguments[0],n=arguments[1],r=arguments[2];this._precisionModel=e,this._bufParams=n,this._li=new DE,this._filletAngleQuantum=Math.PI/2/n.getQuadrantSegments(),n.getQuadrantSegments()>=8&&n.getJoinStyle()===mw.JOIN_ROUND&&(this._closingSegLengthFactor=t.MAX_CLOSING_SEG_LEN_FACTOR),this.init(r)},Sw={OFFSET_SEGMENT_SEPARATION_FACTOR:{configurable:!0},INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},CURVE_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},MAX_CLOSING_SEG_LEN_FACTOR:{configurable:!0}};Bw.prototype.addNextSegment=function(t,e){if(this._s0=this._s1,this._s1=this._s2,this._s2=t,this._seg0.setCoordinates(this._s0,this._s1),this.computeOffsetSegment(this._seg0,this._side,this._distance,this._offset0),this._seg1.setCoordinates(this._s1,this._s2),this.computeOffsetSegment(this._seg1,this._side,this._distance,this._offset1),this._s1.equals(this._s2))return null;var n=OE.computeOrientation(this._s0,this._s1,this._s2),r=n===OE.CLOCKWISE&&this._side===mC.LEFT||n===OE.COUNTERCLOCKWISE&&this._side===mC.RIGHT;0===n?this.addCollinear(e):r?this.addOutsideTurn(n,e):this.addInsideTurn(n,e)},Bw.prototype.addLineEndCap=function(t,e){var n=new cw(t,e),r=new cw;this.computeOffsetSegment(n,mC.LEFT,this._distance,r);var i=new cw;this.computeOffsetSegment(n,mC.RIGHT,this._distance,i);var o=e.x-t.x,s=e.y-t.y,a=Math.atan2(s,o);switch(this._bufParams.getEndCapStyle()){case mw.CAP_ROUND:this._segList.addPt(r.p1),this.addFilletArc(e,a+Math.PI/2,a-Math.PI/2,OE.CLOCKWISE,this._distance),this._segList.addPt(i.p1);break;case mw.CAP_FLAT:this._segList.addPt(r.p1),this._segList.addPt(i.p1);break;case mw.CAP_SQUARE:var u=new eE;u.x=Math.abs(this._distance)*Math.cos(a),u.y=Math.abs(this._distance)*Math.sin(a);var l=new eE(r.p1.x+u.x,r.p1.y+u.y),c=new eE(i.p1.x+u.x,i.p1.y+u.y);this._segList.addPt(l),this._segList.addPt(c)}},Bw.prototype.getCoordinates=function(){return this._segList.getCoordinates()},Bw.prototype.addMitreJoin=function(t,e,n,r){var i=!0,o=null;try{o=EE.intersection(e.p0,e.p1,n.p0,n.p1),(r<=0?1:o.distance(t)/Math.abs(r))>this._bufParams.getMitreLimit()&&(i=!1)}catch(t){if(!(t instanceof _E))throw t;o=new eE(0,0),i=!1}i?this._segList.addPt(o):this.addLimitedMitreJoin(e,n,r,this._bufParams.getMitreLimit())},Bw.prototype.addFilletCorner=function(t,e,n,r,i){var o=e.x-t.x,s=e.y-t.y,a=Math.atan2(s,o),u=n.x-t.x,l=n.y-t.y,c=Math.atan2(l,u);r===OE.CLOCKWISE?a<=c&&(a+=2*Math.PI):a>=c&&(a-=2*Math.PI),this._segList.addPt(e),this.addFilletArc(t,a,c,r,i),this._segList.addPt(n)},Bw.prototype.addOutsideTurn=function(t,e){if(this._offset0.p1.distance(this._offset1.p0)<this._distance*Bw.OFFSET_SEGMENT_SEPARATION_FACTOR)return this._segList.addPt(this._offset0.p1),null;this._bufParams.getJoinStyle()===mw.JOIN_MITRE?this.addMitreJoin(this._s1,this._offset0,this._offset1,this._distance):this._bufParams.getJoinStyle()===mw.JOIN_BEVEL?this.addBevelJoin(this._offset0,this._offset1):(e&&this._segList.addPt(this._offset0.p1),this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,t,this._distance),this._segList.addPt(this._offset1.p0))},Bw.prototype.createSquare=function(t){this._segList.addPt(new eE(t.x+this._distance,t.y+this._distance)),this._segList.addPt(new eE(t.x+this._distance,t.y-this._distance)),this._segList.addPt(new eE(t.x-this._distance,t.y-this._distance)),this._segList.addPt(new eE(t.x-this._distance,t.y+this._distance)),this._segList.closeRing()},Bw.prototype.addSegments=function(t,e){this._segList.addPts(t,e)},Bw.prototype.addFirstSegment=function(){this._segList.addPt(this._offset1.p0)},Bw.prototype.addLastSegment=function(){this._segList.addPt(this._offset1.p1)},Bw.prototype.initSideSegments=function(t,e,n){this._s1=t,this._s2=e,this._side=n,this._seg1.setCoordinates(t,e),this.computeOffsetSegment(this._seg1,n,this._distance,this._offset1)},Bw.prototype.addLimitedMitreJoin=function(t,e,n,r){var i=this._seg0.p1,o=ww.angle(i,this._seg0.p0),s=ww.angleBetweenOriented(this._seg0.p0,i,this._seg1.p1)/2,a=ww.normalize(o+s),u=ww.normalize(a+Math.PI),l=r*n,c=n-l*Math.abs(Math.sin(s)),h=i.x+l*Math.cos(u),f=i.y+l*Math.sin(u),p=new eE(h,f),g=new cw(i,p),A=g.pointAlongOffset(1,c),d=g.pointAlongOffset(1,-c);this._side===mC.LEFT?(this._segList.addPt(A),this._segList.addPt(d)):(this._segList.addPt(d),this._segList.addPt(A))},Bw.prototype.computeOffsetSegment=function(t,e,n,r){var i=e===mC.LEFT?1:-1,o=t.p1.x-t.p0.x,s=t.p1.y-t.p0.y,a=Math.sqrt(o*o+s*s),u=i*n*o/a,l=i*n*s/a;r.p0.x=t.p0.x-l,r.p0.y=t.p0.y+u,r.p1.x=t.p1.x-l,r.p1.y=t.p1.y+u},Bw.prototype.addFilletArc=function(t,e,n,r,i){var o=r===OE.CLOCKWISE?-1:1,s=Math.abs(e-n),a=Math.trunc(s/this._filletAngleQuantum+.5);if(a<1)return null;for(var u=s/a,l=0,c=new eE;l<s;){var h=e+o*l;c.x=t.x+i*Math.cos(h),c.y=t.y+i*Math.sin(h),this._segList.addPt(c),l+=u}},Bw.prototype.addInsideTurn=function(t,e){if(this._li.computeIntersection(this._offset0.p0,this._offset0.p1,this._offset1.p0,this._offset1.p1),this._li.hasIntersection())this._segList.addPt(this._li.getIntersection(0));else if(this._hasNarrowConcaveAngle=!0,this._offset0.p1.distance(this._offset1.p0)<this._distance*Bw.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR)this._segList.addPt(this._offset0.p1);else{if(this._segList.addPt(this._offset0.p1),this._closingSegLengthFactor>0){var n=new eE((this._closingSegLengthFactor*this._offset0.p1.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset0.p1.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(n);var r=new eE((this._closingSegLengthFactor*this._offset1.p0.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset1.p0.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(r)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}},Bw.prototype.createCircle=function(t){var e=new eE(t.x+this._distance,t.y);this._segList.addPt(e),this.addFilletArc(t,0,2*Math.PI,-1,this._distance),this._segList.closeRing()},Bw.prototype.addBevelJoin=function(t,e){this._segList.addPt(t.p1),this._segList.addPt(e.p0)},Bw.prototype.init=function(t){this._distance=t,this._maxCurveSegmentError=t*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new xw,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(t*Bw.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)},Bw.prototype.addCollinear=function(t){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2),this._li.getIntersectionNum()>=2&&(this._bufParams.getJoinStyle()===mw.JOIN_BEVEL||this._bufParams.getJoinStyle()===mw.JOIN_MITRE?(t&&this._segList.addPt(this._offset0.p1),this._segList.addPt(this._offset1.p0)):this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,OE.CLOCKWISE,this._distance))},Bw.prototype.closeRing=function(){this._segList.closeRing()},Bw.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle},Bw.prototype.interfaces_=function(){return[]},Bw.prototype.getClass=function(){return Bw},Sw.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return.001},Sw.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return.001},Sw.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6},Sw.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80},Object.defineProperties(Bw,Sw);var Mw=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var t=arguments[0],e=arguments[1];this._precisionModel=t,this._bufParams=e};Mw.prototype.getOffsetCurve=function(t,e){if(this._distance=e,0===e)return null;var n=e<0,r=Math.abs(e),i=this.getSegGen(r);t.length<=1?this.computePointCurve(t[0],i):this.computeOffsetCurve(t,n,i);var o=i.getCoordinates();return n&&ox.reverse(o),o},Mw.prototype.computeSingleSidedBufferCurve=function(t,e,n){var r=this.simplifyTolerance(this._distance);if(e){n.addSegments(t,!0);var i=Iw.simplify(t,-r),o=i.length-1;n.initSideSegments(i[o],i[o-1],mC.LEFT),n.addFirstSegment();for(var s=o-2;s>=0;s--)n.addNextSegment(i[s],!0)}else{n.addSegments(t,!1);var a=Iw.simplify(t,r),u=a.length-1;n.initSideSegments(a[0],a[1],mC.LEFT),n.addFirstSegment();for(var l=2;l<=u;l++)n.addNextSegment(a[l],!0)}n.addLastSegment(),n.closeRing()},Mw.prototype.computeRingBufferCurve=function(t,e,n){var r=this.simplifyTolerance(this._distance);e===mC.RIGHT&&(r=-r);var i=Iw.simplify(t,r),o=i.length-1;n.initSideSegments(i[o-1],i[0],e);for(var s=1;s<=o;s++){var a=1!==s;n.addNextSegment(i[s],a)}n.closeRing()},Mw.prototype.computeLineBufferCurve=function(t,e){var n=this.simplifyTolerance(this._distance),r=Iw.simplify(t,n),i=r.length-1;e.initSideSegments(r[0],r[1],mC.LEFT);for(var o=2;o<=i;o++)e.addNextSegment(r[o],!0);e.addLastSegment(),e.addLineEndCap(r[i-1],r[i]);var s=Iw.simplify(t,-n),a=s.length-1;e.initSideSegments(s[a],s[a-1],mC.LEFT);for(var u=a-2;u>=0;u--)e.addNextSegment(s[u],!0);e.addLastSegment(),e.addLineEndCap(s[1],s[0]),e.closeRing()},Mw.prototype.computePointCurve=function(t,e){switch(this._bufParams.getEndCapStyle()){case mw.CAP_ROUND:e.createCircle(t);break;case mw.CAP_SQUARE:e.createSquare(t)}},Mw.prototype.getLineCurve=function(t,e){if(this._distance=e,e<0&&!this._bufParams.isSingleSided())return null;if(0===e)return null;var n=Math.abs(e),r=this.getSegGen(n);if(t.length<=1)this.computePointCurve(t[0],r);else if(this._bufParams.isSingleSided()){var i=e<0;this.computeSingleSidedBufferCurve(t,i,r)}else this.computeLineBufferCurve(t,r);return r.getCoordinates()},Mw.prototype.getBufferParameters=function(){return this._bufParams},Mw.prototype.simplifyTolerance=function(t){return t*this._bufParams.getSimplifyFactor()},Mw.prototype.getRingCurve=function(t,e,n){if(this._distance=n,t.length<=2)return this.getLineCurve(t,n);if(0===n)return Mw.copyCoordinates(t);var r=this.getSegGen(n);return this.computeRingBufferCurve(t,e,r),r.getCoordinates()},Mw.prototype.computeOffsetCurve=function(t,e,n){var r=this.simplifyTolerance(this._distance);if(e){var i=Iw.simplify(t,-r),o=i.length-1;n.initSideSegments(i[o],i[o-1],mC.LEFT),n.addFirstSegment();for(var s=o-2;s>=0;s--)n.addNextSegment(i[s],!0)}else{var a=Iw.simplify(t,r),u=a.length-1;n.initSideSegments(a[0],a[1],mC.LEFT),n.addFirstSegment();for(var l=2;l<=u;l++)n.addNextSegment(a[l],!0)}n.addLastSegment()},Mw.prototype.getSegGen=function(t){return new Bw(this._precisionModel,this._bufParams,t)},Mw.prototype.interfaces_=function(){return[]},Mw.prototype.getClass=function(){return Mw},Mw.copyCoordinates=function(t){for(var e=new Array(t.length).fill(null),n=0;n<e.length;n++)e[n]=new eE(t[n]);return e};var Lw=function(){this._subgraphs=null,this._seg=new cw,this._cga=new OE;var t=arguments[0];this._subgraphs=t},Nw={DepthSegment:{configurable:!0}};Lw.prototype.findStabbedSegments=function(){var t=this;if(1===arguments.length){for(var e=arguments[0],n=new nx,r=this._subgraphs.iterator();r.hasNext();){var i=r.next(),o=i.getEnvelope();e.y<o.getMinY()||e.y>o.getMaxY()||t.findStabbedSegments(e,i.getDirectedEdges(),n)}return n}if(3===arguments.length)if(aE(arguments[2],tx)&&arguments[0]instanceof eE&&arguments[1]instanceof OC)for(var s=arguments[0],a=arguments[1],u=arguments[2],l=a.getEdge().getCoordinates(),c=0;c<l.length-1;c++){if(t._seg.p0=l[c],t._seg.p1=l[c+1],t._seg.p0.y>t._seg.p1.y&&t._seg.reverse(),!(Math.max(t._seg.p0.x,t._seg.p1.x)<s.x||t._seg.isHorizontal()||s.y<t._seg.p0.y||s.y>t._seg.p1.y||OE.computeOrientation(t._seg.p0,t._seg.p1,s)===OE.RIGHT)){var h=a.getDepth(mC.LEFT);t._seg.p0.equals(l[c])||(h=a.getDepth(mC.RIGHT));var f=new Tw(t._seg,h);u.add(f)}}else if(aE(arguments[2],tx)&&arguments[0]instanceof eE&&aE(arguments[1],tx))for(var p=arguments[0],g=arguments[2],A=arguments[1].iterator();A.hasNext();){var d=A.next();d.isForward()&&t.findStabbedSegments(p,d,g)}},Lw.prototype.getDepth=function(t){var e=this.findStabbedSegments(t);return 0===e.size()?0:JC.min(e)._leftDepth},Lw.prototype.interfaces_=function(){return[]},Lw.prototype.getClass=function(){return Lw},Nw.DepthSegment.get=function(){return Tw},Object.defineProperties(Lw,Nw);var Tw=function(){this._upwardSeg=null,this._leftDepth=null;var t=arguments[0],e=arguments[1];this._upwardSeg=new cw(t),this._leftDepth=e};Tw.prototype.compareTo=function(t){var e=t;if(this._upwardSeg.minX()>=e._upwardSeg.maxX())return 1;if(this._upwardSeg.maxX()<=e._upwardSeg.minX())return-1;var n=this._upwardSeg.orientationIndex(e._upwardSeg);return 0!==n||0!==(n=-1*e._upwardSeg.orientationIndex(this._upwardSeg))?n:this._upwardSeg.compareTo(e._upwardSeg)},Tw.prototype.compareX=function(t,e){var n=t.p0.compareTo(e.p0);return 0!==n?n:t.p1.compareTo(e.p1)},Tw.prototype.toString=function(){return this._upwardSeg.toString()},Tw.prototype.interfaces_=function(){return[KI]},Tw.prototype.getClass=function(){return Tw};var Rw=function(t,e,n){this.p0=t||null,this.p1=e||null,this.p2=n||null};Rw.prototype.area=function(){return Rw.area(this.p0,this.p1,this.p2)},Rw.prototype.signedArea=function(){return Rw.signedArea(this.p0,this.p1,this.p2)},Rw.prototype.interpolateZ=function(t){if(null===t)throw new XI("Supplied point is null.");return Rw.interpolateZ(t,this.p0,this.p1,this.p2)},Rw.prototype.longestSideLength=function(){return Rw.longestSideLength(this.p0,this.p1,this.p2)},Rw.prototype.isAcute=function(){return Rw.isAcute(this.p0,this.p1,this.p2)},Rw.prototype.circumcentre=function(){return Rw.circumcentre(this.p0,this.p1,this.p2)},Rw.prototype.area3D=function(){return Rw.area3D(this.p0,this.p1,this.p2)},Rw.prototype.centroid=function(){return Rw.centroid(this.p0,this.p1,this.p2)},Rw.prototype.inCentre=function(){return Rw.inCentre(this.p0,this.p1,this.p2)},Rw.prototype.interfaces_=function(){return[]},Rw.prototype.getClass=function(){return Rw},Rw.area=function(t,e,n){return Math.abs(((n.x-t.x)*(e.y-t.y)-(e.x-t.x)*(n.y-t.y))/2)},Rw.signedArea=function(t,e,n){return((n.x-t.x)*(e.y-t.y)-(e.x-t.x)*(n.y-t.y))/2},Rw.det=function(t,e,n,r){return t*r-e*n},Rw.interpolateZ=function(t,e,n,r){var i=e.x,o=e.y,s=n.x-i,a=r.x-i,u=n.y-o,l=r.y-o,c=s*l-a*u,h=t.x-i,f=t.y-o,p=(l*h-a*f)/c,g=(-u*h+s*f)/c;return e.z+p*(n.z-e.z)+g*(r.z-e.z)},Rw.longestSideLength=function(t,e,n){var r=t.distance(e),i=e.distance(n),o=n.distance(t),s=r;return i>s&&(s=i),o>s&&(s=o),s},Rw.isAcute=function(t,e,n){return!!ww.isAcute(t,e,n)&&(!!ww.isAcute(e,n,t)&&!!ww.isAcute(n,t,e))},Rw.circumcentre=function(t,e,n){var r=n.x,i=n.y,o=t.x-r,s=t.y-i,a=e.x-r,u=e.y-i,l=2*Rw.det(o,s,a,u),c=Rw.det(s,o*o+s*s,u,a*a+u*u),h=Rw.det(o,o*o+s*s,a,a*a+u*u);return new eE(r-c/l,i+h/l)},Rw.perpendicularBisector=function(t,e){var n=e.x-t.x,r=e.y-t.y,i=new EE(t.x+n/2,t.y+r/2,1),o=new EE(t.x-r+n/2,t.y+n+r/2,1);return new EE(i,o)},Rw.angleBisector=function(t,e,n){var r=e.distance(t),i=r/(r+e.distance(n)),o=n.x-t.x,s=n.y-t.y;return new eE(t.x+i*o,t.y+i*s)},Rw.area3D=function(t,e,n){var r=e.x-t.x,i=e.y-t.y,o=e.z-t.z,s=n.x-t.x,a=n.y-t.y,u=n.z-t.z,l=i*u-o*a,c=o*s-r*u,h=r*a-i*s,f=l*l+c*c+h*h,p=Math.sqrt(f)/2;return p},Rw.centroid=function(t,e,n){var r=(t.x+e.x+n.x)/3,i=(t.y+e.y+n.y)/3;return new eE(r,i)},Rw.inCentre=function(t,e,n){var r=e.distance(n),i=t.distance(n),o=t.distance(e),s=r+i+o,a=(r*t.x+i*e.x+o*n.x)/s,u=(r*t.y+i*e.y+o*n.y)/s;return new eE(a,u)};var Qw=function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new nx;var t=arguments[0],e=arguments[1],n=arguments[2];this._inputGeom=t,this._distance=e,this._curveBuilder=n};Qw.prototype.addPoint=function(t){if(this._distance<=0)return null;var e=t.getCoordinates(),n=this._curveBuilder.getLineCurve(e,this._distance);this.addCurve(n,oE.EXTERIOR,oE.INTERIOR)},Qw.prototype.addPolygon=function(t){var e=this,n=this._distance,r=mC.LEFT;this._distance<0&&(n=-this._distance,r=mC.RIGHT);var i=t.getExteriorRing(),o=ox.removeRepeatedPoints(i.getCoordinates());if(this._distance<0&&this.isErodedCompletely(i,this._distance))return null;if(this._distance<=0&&o.length<3)return null;this.addPolygonRing(o,n,r,oE.EXTERIOR,oE.INTERIOR);for(var s=0;s<t.getNumInteriorRing();s++){var a=t.getInteriorRingN(s),u=ox.removeRepeatedPoints(a.getCoordinates());e._distance>0&&e.isErodedCompletely(a,-e._distance)||e.addPolygonRing(u,n,mC.opposite(r),oE.INTERIOR,oE.EXTERIOR)}},Qw.prototype.isTriangleErodedCompletely=function(t,e){var n=new Rw(t[0],t[1],t[2]),r=n.inCentre();return OE.distancePointLine(r,n.p0,n.p1)<Math.abs(e)},Qw.prototype.addLineString=function(t){if(this._distance<=0&&!this._curveBuilder.getBufferParameters().isSingleSided())return null;var e=ox.removeRepeatedPoints(t.getCoordinates()),n=this._curveBuilder.getLineCurve(e,this._distance);this.addCurve(n,oE.EXTERIOR,oE.INTERIOR)},Qw.prototype.addCurve=function(t,e,n){if(null===t||t.length<2)return null;var r=new lw(t,new SC(0,oE.BOUNDARY,e,n));this._curveList.add(r)},Qw.prototype.getCurves=function(){return this.add(this._inputGeom),this._curveList},Qw.prototype.addPolygonRing=function(t,e,n,r,i){if(0===e&&t.length<Jx.MINIMUM_VALID_SIZE)return null;var o=r,s=i;t.length>=Jx.MINIMUM_VALID_SIZE&&OE.isCCW(t)&&(o=i,s=r,n=mC.opposite(n));var a=this._curveBuilder.getRingCurve(t,n,e);this.addCurve(a,o,s)},Qw.prototype.add=function(t){if(t.isEmpty())return null;t instanceof Hx?this.addPolygon(t):t instanceof jx?this.addLineString(t):t instanceof Vx?this.addPoint(t):(t instanceof Xx||t instanceof Nx||t instanceof Wx||t instanceof Lx)&&this.addCollection(t)},Qw.prototype.isErodedCompletely=function(t,e){var n=t.getCoordinates();if(n.length<4)return e<0;if(4===n.length)return this.isTriangleErodedCompletely(n,e);var r=t.getEnvelopeInternal(),i=Math.min(r.getHeight(),r.getWidth());return e<0&&2*Math.abs(e)>i},Qw.prototype.addCollection=function(t){for(var e=0;e<t.getNumGeometries();e++){var n=t.getGeometryN(e);this.add(n)}},Qw.prototype.interfaces_=function(){return[]},Qw.prototype.getClass=function(){return Qw};var Dw=function(){};Dw.prototype.locate=function(t){},Dw.prototype.interfaces_=function(){return[]},Dw.prototype.getClass=function(){return Dw};var Pw=function(){this._parent=null,this._atStart=null,this._max=null,this._index=null,this._subcollectionIterator=null;var t=arguments[0];this._parent=t,this._atStart=!0,this._index=0,this._max=t.getNumGeometries()};Pw.prototype.next=function(){if(this._atStart)return this._atStart=!1,Pw.isAtomic(this._parent)&&this._index++,this._parent;if(null!==this._subcollectionIterator){if(this._subcollectionIterator.hasNext())return this._subcollectionIterator.next();this._subcollectionIterator=null}if(this._index>=this._max)throw new ex;var t=this._parent.getGeometryN(this._index++);return t instanceof Lx?(this._subcollectionIterator=new Pw(t),this._subcollectionIterator.next()):t},Pw.prototype.remove=function(){throw new Error(this.getClass().getName())},Pw.prototype.hasNext=function(){if(this._atStart)return!0;if(null!==this._subcollectionIterator){if(this._subcollectionIterator.hasNext())return!0;this._subcollectionIterator=null}return!(this._index>=this._max)},Pw.prototype.interfaces_=function(){return[$E]},Pw.prototype.getClass=function(){return Pw},Pw.isAtomic=function(t){return!(t instanceof Lx)};var kw=function(){this._geom=null;var t=arguments[0];this._geom=t};kw.prototype.locate=function(t){return kw.locate(t,this._geom)},kw.prototype.interfaces_=function(){return[Dw]},kw.prototype.getClass=function(){return kw},kw.isPointInRing=function(t,e){return!!e.getEnvelopeInternal().intersects(t)&&OE.isPointInRing(t,e.getCoordinates())},kw.containsPointInPolygon=function(t,e){if(e.isEmpty())return!1;var n=e.getExteriorRing();if(!kw.isPointInRing(t,n))return!1;for(var r=0;r<e.getNumInteriorRing();r++){var i=e.getInteriorRingN(r);if(kw.isPointInRing(t,i))return!1}return!0},kw.containsPoint=function(t,e){if(e instanceof Hx)return kw.containsPointInPolygon(t,e);if(e instanceof Lx)for(var n=new Pw(e);n.hasNext();){var r=n.next();if(r!==e&&kw.containsPoint(t,r))return!0}return!1},kw.locate=function(t,e){return e.isEmpty()?oE.EXTERIOR:kw.containsPoint(t,e)?oE.INTERIOR:oE.EXTERIOR};var Ow=function(){this._edgeMap=new _x,this._edgeList=null,this._ptInAreaLocation=[oE.NONE,oE.NONE]};Ow.prototype.getNextCW=function(t){this.getEdges();var e=this._edgeList.indexOf(t),n=e-1;return 0===e&&(n=this._edgeList.size()-1),this._edgeList.get(n)},Ow.prototype.propagateSideLabels=function(t){for(var e=oE.NONE,n=this.iterator();n.hasNext();){var r=n.next().getLabel();r.isArea(t)&&r.getLocation(t,mC.LEFT)!==oE.NONE&&(e=r.getLocation(t,mC.LEFT))}if(e===oE.NONE)return null;for(var i=e,o=this.iterator();o.hasNext();){var s=o.next(),a=s.getLabel();if(a.getLocation(t,mC.ON)===oE.NONE&&a.setLocation(t,mC.ON,i),a.isArea(t)){var u=a.getLocation(t,mC.LEFT),l=a.getLocation(t,mC.RIGHT);if(l!==oE.NONE){if(l!==i)throw new CC("side location conflict",s.getCoordinate());u===oE.NONE&&TE.shouldNeverReachHere("found single null side (at "+s.getCoordinate()+")"),i=u}else TE.isTrue(a.getLocation(t,mC.LEFT)===oE.NONE,"found single null side"),a.setLocation(t,mC.RIGHT,i),a.setLocation(t,mC.LEFT,i)}}},Ow.prototype.getCoordinate=function(){var t=this.iterator();return t.hasNext()?t.next().getCoordinate():null},Ow.prototype.print=function(t){IE.out.println("EdgeEndStar: "+this.getCoordinate());for(var e=this.iterator();e.hasNext();){e.next().print(t)}},Ow.prototype.isAreaLabelsConsistent=function(t){return this.computeEdgeEndLabels(t.getBoundaryNodeRule()),this.checkAreaLabelsConsistent(0)},Ow.prototype.checkAreaLabelsConsistent=function(t){var e=this.getEdges();if(e.size()<=0)return!0;var n=e.size()-1,r=e.get(n).getLabel().getLocation(t,mC.LEFT);TE.isTrue(r!==oE.NONE,"Found unlabelled area edge");for(var i=r,o=this.iterator();o.hasNext();){var s=o.next().getLabel();TE.isTrue(s.isArea(t),"Found non-area edge");var a=s.getLocation(t,mC.LEFT),u=s.getLocation(t,mC.RIGHT);if(a===u)return!1;if(u!==i)return!1;i=a}return!0},Ow.prototype.findIndex=function(t){this.iterator();for(var e=0;e<this._edgeList.size();e++){if(this._edgeList.get(e)===t)return e}return-1},Ow.prototype.iterator=function(){return this.getEdges().iterator()},Ow.prototype.getEdges=function(){return null===this._edgeList&&(this._edgeList=new nx(this._edgeMap.values())),this._edgeList},Ow.prototype.getLocation=function(t,e,n){return this._ptInAreaLocation[t]===oE.NONE&&(this._ptInAreaLocation[t]=kw.locate(e,n[t].getGeometry())),this._ptInAreaLocation[t]},Ow.prototype.toString=function(){var t=new cE;t.append("EdgeEndStar: "+this.getCoordinate()),t.append("\n");for(var e=this.iterator();e.hasNext();){var n=e.next();t.append(n),t.append("\n")}return t.toString()},Ow.prototype.computeEdgeEndLabels=function(t){for(var e=this.iterator();e.hasNext();){e.next().computeLabel(t)}},Ow.prototype.computeLabelling=function(t){this.computeEdgeEndLabels(t[0].getBoundaryNodeRule()),this.propagateSideLabels(0),this.propagateSideLabels(1);for(var e=[!1,!1],n=this.iterator();n.hasNext();)for(var r=n.next().getLabel(),i=0;i<2;i++)r.isLine(i)&&r.getLocation(i)===oE.BOUNDARY&&(e[i]=!0);for(var o=this.iterator();o.hasNext();)for(var s=o.next(),a=s.getLabel(),u=0;u<2;u++)if(a.isAnyNull(u)){var l=oE.NONE;if(e[u])l=oE.EXTERIOR;else{var c=s.getCoordinate();l=this.getLocation(u,c,t)}a.setAllLocationsIfNull(u,l)}},Ow.prototype.getDegree=function(){return this._edgeMap.size()},Ow.prototype.insertEdgeEnd=function(t,e){this._edgeMap.put(t,e),this._edgeList=null},Ow.prototype.interfaces_=function(){return[]},Ow.prototype.getClass=function(){return Ow};var Fw=function(t){function e(){t.call(this),this._resultAreaEdgeList=null,this._label=null,this._SCANNING_FOR_INCOMING=1,this._LINKING_TO_OUTGOING=2}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.linkResultDirectedEdges=function(){var t=this;this.getResultAreaEdges();for(var e=null,n=null,r=this._SCANNING_FOR_INCOMING,i=0;i<this._resultAreaEdgeList.size();i++){var o=t._resultAreaEdgeList.get(i),s=o.getSym();if(o.getLabel().isArea())switch(null===e&&o.isInResult()&&(e=o),r){case t._SCANNING_FOR_INCOMING:if(!s.isInResult())continue;n=s,r=t._LINKING_TO_OUTGOING;break;case t._LINKING_TO_OUTGOING:if(!o.isInResult())continue;n.setNext(o),r=t._SCANNING_FOR_INCOMING}}if(r===this._LINKING_TO_OUTGOING){if(null===e)throw new CC("no outgoing dirEdge found",this.getCoordinate());TE.isTrue(e.isInResult(),"unable to link last incoming dirEdge"),n.setNext(e)}},e.prototype.insert=function(t){var e=t;this.insertEdgeEnd(e,e)},e.prototype.getRightmostEdge=function(){var t=this.getEdges(),e=t.size();if(e<1)return null;var n=t.get(0);if(1===e)return n;var r=t.get(e-1),i=n.getQuadrant(),o=r.getQuadrant();return DC.isNorthern(i)&&DC.isNorthern(o)?n:DC.isNorthern(i)||DC.isNorthern(o)?0!==n.getDy()?n:0!==r.getDy()?r:(TE.shouldNeverReachHere("found two horizontal edges incident on node"),null):r},e.prototype.print=function(t){IE.out.println("DirectedEdgeStar: "+this.getCoordinate());for(var e=this.iterator();e.hasNext();){var n=e.next();t.print("out "),n.print(t),t.println(),t.print("in "),n.getSym().print(t),t.println()}},e.prototype.getResultAreaEdges=function(){if(null!==this._resultAreaEdgeList)return this._resultAreaEdgeList;this._resultAreaEdgeList=new nx;for(var t=this.iterator();t.hasNext();){var e=t.next();(e.isInResult()||e.getSym().isInResult())&&this._resultAreaEdgeList.add(e)}return this._resultAreaEdgeList},e.prototype.updateLabelling=function(t){for(var e=this.iterator();e.hasNext();){var n=e.next().getLabel();n.setAllLocationsIfNull(0,t.getLocation(0)),n.setAllLocationsIfNull(1,t.getLocation(1))}},e.prototype.linkAllDirectedEdges=function(){this.getEdges();for(var t=null,e=null,n=this._edgeList.size()-1;n>=0;n--){var r=this._edgeList.get(n),i=r.getSym();null===e&&(e=i),null!==t&&i.setNext(t),t=r}e.setNext(t)},e.prototype.computeDepths=function(){if(1===arguments.length){var t=arguments[0],e=this.findIndex(t),n=t.getDepth(mC.LEFT),r=t.getDepth(mC.RIGHT),i=this.computeDepths(e+1,this._edgeList.size(),n);if(this.computeDepths(0,e,i)!==r)throw new CC("depth mismatch at "+t.getCoordinate())}else if(3===arguments.length){for(var o=arguments[1],s=arguments[2],a=arguments[0];a<o;a++){var u=this._edgeList.get(a);u.setEdgeDepths(mC.RIGHT,s),s=u.getDepth(mC.LEFT)}return s}},e.prototype.mergeSymLabels=function(){for(var t=this.iterator();t.hasNext();){var e=t.next();e.getLabel().merge(e.getSym().getLabel())}},e.prototype.linkMinimalDirectedEdges=function(t){for(var e=this,n=null,r=null,i=this._SCANNING_FOR_INCOMING,o=this._resultAreaEdgeList.size()-1;o>=0;o--){var s=e._resultAreaEdgeList.get(o),a=s.getSym();switch(null===n&&s.getEdgeRing()===t&&(n=s),i){case e._SCANNING_FOR_INCOMING:if(a.getEdgeRing()!==t)continue;r=a,i=e._LINKING_TO_OUTGOING;break;case e._LINKING_TO_OUTGOING:if(s.getEdgeRing()!==t)continue;r.setNextMin(s),i=e._SCANNING_FOR_INCOMING}}i===this._LINKING_TO_OUTGOING&&(TE.isTrue(null!==n,"found null for first outgoing dirEdge"),TE.isTrue(n.getEdgeRing()===t,"unable to link last incoming dirEdge"),r.setNextMin(n))},e.prototype.getOutgoingDegree=function(){if(0===arguments.length){for(var t=0,e=this.iterator();e.hasNext();){e.next().isInResult()&&t++}return t}if(1===arguments.length){for(var n=arguments[0],r=0,i=this.iterator();i.hasNext();){i.next().getEdgeRing()===n&&r++}return r}},e.prototype.getLabel=function(){return this._label},e.prototype.findCoveredLineEdges=function(){for(var t=oE.NONE,e=this.iterator();e.hasNext();){var n=e.next(),r=n.getSym();if(!n.isLineEdge()){if(n.isInResult()){t=oE.INTERIOR;break}if(r.isInResult()){t=oE.EXTERIOR;break}}}if(t===oE.NONE)return null;for(var i=t,o=this.iterator();o.hasNext();){var s=o.next(),a=s.getSym();s.isLineEdge()?s.getEdge().setCovered(i===oE.INTERIOR):(s.isInResult()&&(i=oE.EXTERIOR),a.isInResult()&&(i=oE.INTERIOR))}},e.prototype.computeLabelling=function(e){t.prototype.computeLabelling.call(this,e),this._label=new SC(oE.NONE);for(var n=this.iterator();n.hasNext();)for(var r=n.next().getEdge().getLabel(),i=0;i<2;i++){var o=r.getLocation(i);o!==oE.INTERIOR&&o!==oE.BOUNDARY||this._label.setLocation(i,oE.INTERIOR)}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Ow),Gw=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.createNode=function(t){return new RC(t,new Fw)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(FC),Uw=function t(){this._pts=null,this._orientation=null;var e=arguments[0];this._pts=e,this._orientation=t.orientation(e)};Uw.prototype.compareTo=function(t){var e=t;return Uw.compareOriented(this._pts,this._orientation,e._pts,e._orientation)},Uw.prototype.interfaces_=function(){return[KI]},Uw.prototype.getClass=function(){return Uw},Uw.orientation=function(t){return 1===ox.increasingDirection(t)},Uw.compareOriented=function(t,e,n,r){for(var i=e?1:-1,o=r?1:-1,s=e?t.length:-1,a=r?n.length:-1,u=e?0:t.length-1,l=r?0:n.length-1;;){var c=t[u].compareTo(n[l]);if(0!==c)return c;var h=(u+=i)===s,f=(l+=o)===a;if(h&&!f)return-1;if(!h&&f)return 1;if(h&&f)return 0}};var qw=function(){this._edges=new nx,this._ocaMap=new _x};qw.prototype.print=function(t){t.print("MULTILINESTRING ( ");for(var e=0;e<this._edges.size();e++){var n=this._edges.get(e);e>0&&t.print(","),t.print("(");for(var r=n.getCoordinates(),i=0;i<r.length;i++)i>0&&t.print(","),t.print(r[i].x+" "+r[i].y);t.println(")")}t.print(") ")},qw.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next())},qw.prototype.findEdgeIndex=function(t){for(var e=0;e<this._edges.size();e++)if(this._edges.get(e).equals(t))return e;return-1},qw.prototype.iterator=function(){return this._edges.iterator()},qw.prototype.getEdges=function(){return this._edges},qw.prototype.get=function(t){return this._edges.get(t)},qw.prototype.findEqualEdge=function(t){var e=new Uw(t.getCoordinates());return this._ocaMap.get(e)},qw.prototype.add=function(t){this._edges.add(t);var e=new Uw(t.getCoordinates());this._ocaMap.put(e,t)},qw.prototype.interfaces_=function(){return[]},qw.prototype.getClass=function(){return qw};var jw=function(){};jw.prototype.processIntersections=function(t,e,n,r){},jw.prototype.isDone=function(){},jw.prototype.interfaces_=function(){return[]},jw.prototype.getClass=function(){return jw};var zw=function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._hasInterior=!1,this._properIntersectionPoint=null,this._li=null,this._isSelfIntersection=null,this.numIntersections=0,this.numInteriorIntersections=0,this.numProperIntersections=0,this.numTests=0;var t=arguments[0];this._li=t};zw.prototype.isTrivialIntersection=function(t,e,n,r){if(t===n&&1===this._li.getIntersectionNum()){if(zw.isAdjacentSegments(e,r))return!0;if(t.isClosed()){var i=t.size()-1;if(0===e&&r===i||0===r&&e===i)return!0}}return!1},zw.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},zw.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},zw.prototype.getLineIntersector=function(){return this._li},zw.prototype.hasProperIntersection=function(){return this._hasProper},zw.prototype.processIntersections=function(t,e,n,r){if(t===n&&e===r)return null;this.numTests++;var i=t.getCoordinates()[e],o=t.getCoordinates()[e+1],s=n.getCoordinates()[r],a=n.getCoordinates()[r+1];this._li.computeIntersection(i,o,s,a),this._li.hasIntersection()&&(this.numIntersections++,this._li.isInteriorIntersection()&&(this.numInteriorIntersections++,this._hasInterior=!0),this.isTrivialIntersection(t,e,n,r)||(this._hasIntersection=!0,t.addIntersections(this._li,e,0),n.addIntersections(this._li,r,1),this._li.isProper()&&(this.numProperIntersections++,this._hasProper=!0,this._hasProperInterior=!0)))},zw.prototype.hasIntersection=function(){return this._hasIntersection},zw.prototype.isDone=function(){return!1},zw.prototype.hasInteriorIntersection=function(){return this._hasInterior},zw.prototype.interfaces_=function(){return[jw]},zw.prototype.getClass=function(){return zw},zw.isAdjacentSegments=function(t,e){return 1===Math.abs(t-e)};var Vw=function(){this.coord=null,this.segmentIndex=null,this.dist=null;var t=arguments[0],e=arguments[1],n=arguments[2];this.coord=new eE(t),this.segmentIndex=e,this.dist=n};Vw.prototype.getSegmentIndex=function(){return this.segmentIndex},Vw.prototype.getCoordinate=function(){return this.coord},Vw.prototype.print=function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex),t.println(" dist = "+this.dist)},Vw.prototype.compareTo=function(t){var e=t;return this.compare(e.segmentIndex,e.dist)},Vw.prototype.isEndPoint=function(t){return 0===this.segmentIndex&&0===this.dist||this.segmentIndex===t},Vw.prototype.toString=function(){return this.coord+" seg # = "+this.segmentIndex+" dist = "+this.dist},Vw.prototype.getDistance=function(){return this.dist},Vw.prototype.compare=function(t,e){return this.segmentIndex<t?-1:this.segmentIndex>t?1:this.dist<e?-1:this.dist>e?1:0},Vw.prototype.interfaces_=function(){return[KI]},Vw.prototype.getClass=function(){return Vw};var Yw=function(){this._nodeMap=new _x,this.edge=null;var t=arguments[0];this.edge=t};Yw.prototype.print=function(t){t.println("Intersections:");for(var e=this.iterator();e.hasNext();){e.next().print(t)}},Yw.prototype.iterator=function(){return this._nodeMap.values().iterator()},Yw.prototype.addSplitEdges=function(t){this.addEndpoints();for(var e=this.iterator(),n=e.next();e.hasNext();){var r=e.next(),i=this.createSplitEdge(n,r);t.add(i),n=r}},Yw.prototype.addEndpoints=function(){var t=this.edge.pts.length-1;this.add(this.edge.pts[0],0,0),this.add(this.edge.pts[t],t,0)},Yw.prototype.createSplitEdge=function(t,e){var n=e.segmentIndex-t.segmentIndex+2,r=this.edge.pts[e.segmentIndex],i=e.dist>0||!e.coord.equals2D(r);i||n--;var o=new Array(n).fill(null),s=0;o[s++]=new eE(t.coord);for(var a=t.segmentIndex+1;a<=e.segmentIndex;a++)o[s++]=this.edge.pts[a];return i&&(o[s]=e.coord),new Kw(o,new SC(this.edge._label))},Yw.prototype.add=function(t,e,n){var r=new Vw(t,e,n),i=this._nodeMap.get(r);return null!==i?i:(this._nodeMap.put(r,r),r)},Yw.prototype.isIntersection=function(t){for(var e=this.iterator();e.hasNext();){if(e.next().coord.equals(t))return!0}return!1},Yw.prototype.interfaces_=function(){return[]},Yw.prototype.getClass=function(){return Yw};var Hw=function(){};Hw.prototype.getChainStartIndices=function(t){var e=0,n=new nx;n.add(new hE(e));do{var r=this.findChainEnd(t,e);n.add(new hE(r)),e=r}while(e<t.length-1);return Hw.toIntArray(n)},Hw.prototype.findChainEnd=function(t,e){for(var n=DC.quadrant(t[e],t[e+1]),r=e+1;r<t.length;){if(DC.quadrant(t[r-1],t[r])!==n)break;r++}return r-1},Hw.prototype.interfaces_=function(){return[]},Hw.prototype.getClass=function(){return Hw},Hw.toIntArray=function(t){for(var e=new Array(t.size()).fill(null),n=0;n<e.length;n++)e[n]=t.get(n).intValue();return e};var Xw=function(){this.e=null,this.pts=null,this.startIndex=null,this.env1=new xE,this.env2=new xE;var t=arguments[0];this.e=t,this.pts=t.getCoordinates();var e=new Hw;this.startIndex=e.getChainStartIndices(this.pts)};Xw.prototype.getCoordinates=function(){return this.pts},Xw.prototype.getMaxX=function(t){var e=this.pts[this.startIndex[t]].x,n=this.pts[this.startIndex[t+1]].x;return e>n?e:n},Xw.prototype.getMinX=function(t){var e=this.pts[this.startIndex[t]].x,n=this.pts[this.startIndex[t+1]].x;return e<n?e:n},Xw.prototype.computeIntersectsForChain=function(){if(4===arguments.length){var t=arguments[0],e=arguments[1],n=arguments[2],r=arguments[3];this.computeIntersectsForChain(this.startIndex[t],this.startIndex[t+1],e,e.startIndex[n],e.startIndex[n+1],r)}else if(6===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3],u=arguments[4],l=arguments[5],c=this.pts[i],h=this.pts[o],f=s.pts[a],p=s.pts[u];if(o-i==1&&u-a==1)return l.addIntersections(this.e,i,s.e,a),null;if(this.env1.init(c,h),this.env2.init(f,p),!this.env1.intersects(this.env2))return null;var g=Math.trunc((i+o)/2),A=Math.trunc((a+u)/2);i<g&&(a<A&&this.computeIntersectsForChain(i,g,s,a,A,l),A<u&&this.computeIntersectsForChain(i,g,s,A,u,l)),g<o&&(a<A&&this.computeIntersectsForChain(g,o,s,a,A,l),A<u&&this.computeIntersectsForChain(g,o,s,A,u,l))}},Xw.prototype.getStartIndexes=function(){return this.startIndex},Xw.prototype.computeIntersects=function(t,e){for(var n=0;n<this.startIndex.length-1;n++)for(var r=0;r<t.startIndex.length-1;r++)this.computeIntersectsForChain(n,t,r,e)},Xw.prototype.interfaces_=function(){return[]},Xw.prototype.getClass=function(){return Xw};var Jw=function t(){this._depth=Array(2).fill().map((function(){return Array(3)}));for(var e=0;e<2;e++)for(var n=0;n<3;n++)this._depth[e][n]=t.NULL_VALUE},Ww={NULL_VALUE:{configurable:!0}};Jw.prototype.getDepth=function(t,e){return this._depth[t][e]},Jw.prototype.setDepth=function(t,e,n){this._depth[t][e]=n},Jw.prototype.isNull=function(){if(0===arguments.length){for(var t=0;t<2;t++)for(var e=0;e<3;e++)if(this._depth[t][e]!==Jw.NULL_VALUE)return!1;return!0}if(1===arguments.length){var n=arguments[0];return this._depth[n][1]===Jw.NULL_VALUE}if(2===arguments.length){var r=arguments[0],i=arguments[1];return this._depth[r][i]===Jw.NULL_VALUE}},Jw.prototype.normalize=function(){for(var t=this,e=0;e<2;e++)if(!t.isNull(e)){var n=t._depth[e][1];t._depth[e][2]<n&&(n=t._depth[e][2]),n<0&&(n=0);for(var r=1;r<3;r++){var i=0;t._depth[e][r]>n&&(i=1),t._depth[e][r]=i}}},Jw.prototype.getDelta=function(t){return this._depth[t][mC.RIGHT]-this._depth[t][mC.LEFT]},Jw.prototype.getLocation=function(t,e){return this._depth[t][e]<=0?oE.EXTERIOR:oE.INTERIOR},Jw.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]},Jw.prototype.add=function(){var t=this;if(1===arguments.length)for(var e=arguments[0],n=0;n<2;n++)for(var r=1;r<3;r++){var i=e.getLocation(n,r);i!==oE.EXTERIOR&&i!==oE.INTERIOR||(t.isNull(n,r)?t._depth[n][r]=Jw.depthAtLocation(i):t._depth[n][r]+=Jw.depthAtLocation(i))}else if(3===arguments.length){var o=arguments[0],s=arguments[1];arguments[2]===oE.INTERIOR&&this._depth[o][s]++}},Jw.prototype.interfaces_=function(){return[]},Jw.prototype.getClass=function(){return Jw},Jw.depthAtLocation=function(t){return t===oE.EXTERIOR?0:t===oE.INTERIOR?1:Jw.NULL_VALUE},Ww.NULL_VALUE.get=function(){return-1},Object.defineProperties(Jw,Ww);var Kw=function(t){function e(){if(t.call(this),this.pts=null,this._env=null,this.eiList=new Yw(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new Jw,this._depthDelta=0,1===arguments.length){var n=arguments[0];e.call(this,n,null)}else if(2===arguments.length){var r=arguments[0],i=arguments[1];this.pts=r,this._label=i}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getDepth=function(){return this._depth},e.prototype.getCollapsedEdge=function(){var t=new Array(2).fill(null);return t[0]=this.pts[0],t[1]=this.pts[1],new e(t,SC.toLineLabel(this._label))},e.prototype.isIsolated=function(){return this._isIsolated},e.prototype.getCoordinates=function(){return this.pts},e.prototype.setIsolated=function(t){this._isIsolated=t},e.prototype.setName=function(t){this._name=t},e.prototype.equals=function(t){if(!(t instanceof e))return!1;var n=t;if(this.pts.length!==n.pts.length)return!1;for(var r=!0,i=!0,o=this.pts.length,s=0;s<this.pts.length;s++)if(this.pts[s].equals2D(n.pts[s])||(r=!1),this.pts[s].equals2D(n.pts[--o])||(i=!1),!r&&!i)return!1;return!0},e.prototype.getCoordinate=function(){if(0===arguments.length)return this.pts.length>0?this.pts[0]:null;if(1===arguments.length){var t=arguments[0];return this.pts[t]}},e.prototype.print=function(t){t.print("edge "+this._name+": "),t.print("LINESTRING (");for(var e=0;e<this.pts.length;e++)e>0&&t.print(","),t.print(this.pts[e].x+" "+this.pts[e].y);t.print(") "+this._label+" "+this._depthDelta)},e.prototype.computeIM=function(t){e.updateIM(this._label,t)},e.prototype.isCollapsed=function(){return!!this._label.isArea()&&(3===this.pts.length&&!!this.pts[0].equals(this.pts[2]))},e.prototype.isClosed=function(){return this.pts[0].equals(this.pts[this.pts.length-1])},e.prototype.getMaximumSegmentIndex=function(){return this.pts.length-1},e.prototype.getDepthDelta=function(){return this._depthDelta},e.prototype.getNumPoints=function(){return this.pts.length},e.prototype.printReverse=function(t){t.print("edge "+this._name+": ");for(var e=this.pts.length-1;e>=0;e--)t.print(this.pts[e]+" ");t.println("")},e.prototype.getMonotoneChainEdge=function(){return null===this._mce&&(this._mce=new Xw(this)),this._mce},e.prototype.getEnvelope=function(){if(null===this._env){this._env=new xE;for(var t=0;t<this.pts.length;t++)this._env.expandToInclude(this.pts[t])}return this._env},e.prototype.addIntersection=function(t,e,n,r){var i=new eE(t.getIntersection(r)),o=e,s=t.getEdgeDistance(n,r),a=o+1;if(a<this.pts.length){var u=this.pts[a];i.equals2D(u)&&(o=a,s=0)}this.eiList.add(i,o,s)},e.prototype.toString=function(){var t=new cE;t.append("edge "+this._name+": "),t.append("LINESTRING (");for(var e=0;e<this.pts.length;e++)e>0&&t.append(","),t.append(this.pts[e].x+" "+this.pts[e].y);return t.append(") "+this._label+" "+this._depthDelta),t.toString()},e.prototype.isPointwiseEqual=function(t){if(this.pts.length!==t.pts.length)return!1;for(var e=0;e<this.pts.length;e++)if(!this.pts[e].equals2D(t.pts[e]))return!1;return!0},e.prototype.setDepthDelta=function(t){this._depthDelta=t},e.prototype.getEdgeIntersectionList=function(){return this.eiList},e.prototype.addIntersections=function(t,e,n){for(var r=0;r<t.getIntersectionNum();r++)this.addIntersection(t,e,n,r)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.updateIM=function(){if(2!==arguments.length)return t.prototype.updateIM.apply(this,arguments);var e=arguments[0],n=arguments[1];n.setAtLeastIfValid(e.getLocation(0,mC.ON),e.getLocation(1,mC.ON),1),e.isArea()&&(n.setAtLeastIfValid(e.getLocation(0,mC.LEFT),e.getLocation(1,mC.LEFT),2),n.setAtLeastIfValid(e.getLocation(0,mC.RIGHT),e.getLocation(1,mC.RIGHT),2))},e}(TC),Zw=function(t){this._workingPrecisionModel=null,this._workingNoder=null,this._geomFact=null,this._graph=null,this._edgeList=new qw,this._bufParams=t||null};Zw.prototype.setWorkingPrecisionModel=function(t){this._workingPrecisionModel=t},Zw.prototype.insertUniqueEdge=function(t){var e=this._edgeList.findEqualEdge(t);if(null!==e){var n=e.getLabel(),r=t.getLabel();e.isPointwiseEqual(t)||(r=new SC(t.getLabel())).flip(),n.merge(r);var i=Zw.depthDelta(r),o=e.getDepthDelta()+i;e.setDepthDelta(o)}else this._edgeList.add(t),t.setDepthDelta(Zw.depthDelta(t.getLabel()))},Zw.prototype.buildSubgraphs=function(t,e){for(var n=new nx,r=t.iterator();r.hasNext();){var i=r.next(),o=i.getRightmostCoordinate(),s=new Lw(n).getDepth(o);i.computeDepth(s),i.findResultEdges(),n.add(i),e.add(i.getDirectedEdges(),i.getNodes())}},Zw.prototype.createSubgraphs=function(t){for(var e=new nx,n=t.getNodes().iterator();n.hasNext();){var r=n.next();if(!r.isVisited()){var i=new bC;i.create(r),e.add(i)}}return JC.sort(e,JC.reverseOrder()),e},Zw.prototype.createEmptyResultGeometry=function(){return this._geomFact.createPolygon()},Zw.prototype.getNoder=function(t){if(null!==this._workingNoder)return this._workingNoder;var e=new yw,n=new DE;return n.setPrecisionModel(t),e.setSegmentIntersector(new zw(n)),e},Zw.prototype.buffer=function(t,e){var n=this._workingPrecisionModel;null===n&&(n=t.getPrecisionModel()),this._geomFact=t.getFactory();var r=new Mw(n,this._bufParams),i=new Qw(t,e,r).getCurves();if(i.size()<=0)return this.createEmptyResultGeometry();this.computeNodedEdges(i,n),this._graph=new GC(new Gw),this._graph.addEdges(this._edgeList.getEdges());var o=this.createSubgraphs(this._graph),s=new UC(this._geomFact);this.buildSubgraphs(o,s);var a=s.getPolygons();return a.size()<=0?this.createEmptyResultGeometry():this._geomFact.buildGeometry(a)},Zw.prototype.computeNodedEdges=function(t,e){var n=this.getNoder(e);n.computeNodes(t);for(var r=n.getNodedSubstrings().iterator();r.hasNext();){var i=r.next(),o=i.getCoordinates();if(2!==o.length||!o[0].equals2D(o[1])){var s=i.getData(),a=new Kw(i.getCoordinates(),new SC(s));this.insertUniqueEdge(a)}}},Zw.prototype.setNoder=function(t){this._workingNoder=t},Zw.prototype.interfaces_=function(){return[]},Zw.prototype.getClass=function(){return Zw},Zw.depthDelta=function(t){var e=t.getLocation(0,mC.LEFT),n=t.getLocation(0,mC.RIGHT);return e===oE.INTERIOR&&n===oE.EXTERIOR?1:e===oE.EXTERIOR&&n===oE.INTERIOR?-1:0},Zw.convertSegStrings=function(t){for(var e=new hC,n=new nx;t.hasNext();){var r=t.next(),i=e.createLineString(r.getCoordinates());n.add(i)}return e.buildGeometry(n)};var $w=function(){if(this._noder=null,this._scaleFactor=null,this._offsetX=null,this._offsetY=null,this._isScaled=!1,2===arguments.length){var t=arguments[0],e=arguments[1];this._noder=t,this._scaleFactor=e,this._offsetX=0,this._offsetY=0,this._isScaled=!this.isIntegerPrecision()}else if(4===arguments.length){var n=arguments[0],r=arguments[1],i=arguments[2],o=arguments[3];this._noder=n,this._scaleFactor=r,this._offsetX=i,this._offsetY=o,this._isScaled=!this.isIntegerPrecision()}};$w.prototype.rescale=function(){var t=this;if(aE(arguments[0],KE))for(var e=arguments[0].iterator();e.hasNext();){var n=e.next();t.rescale(n.getCoordinates())}else if(arguments[0]instanceof Array){for(var r=arguments[0],i=0;i<r.length;i++)r[i].x=r[i].x/t._scaleFactor+t._offsetX,r[i].y=r[i].y/t._scaleFactor+t._offsetY;2===r.length&&r[0].equals2D(r[1])&&IE.out.println(r)}},$w.prototype.scale=function(){var t=this;if(aE(arguments[0],KE)){for(var e=arguments[0],n=new nx,r=e.iterator();r.hasNext();){var i=r.next();n.add(new lw(t.scale(i.getCoordinates()),i.getData()))}return n}if(arguments[0]instanceof Array){for(var o=arguments[0],s=new Array(o.length).fill(null),a=0;a<o.length;a++)s[a]=new eE(Math.round((o[a].x-t._offsetX)*t._scaleFactor),Math.round((o[a].y-t._offsetY)*t._scaleFactor),o[a].z);return ox.removeRepeatedPoints(s)}},$w.prototype.isIntegerPrecision=function(){return 1===this._scaleFactor},$w.prototype.getNodedSubstrings=function(){var t=this._noder.getNodedSubstrings();return this._isScaled&&this.rescale(t),t},$w.prototype.computeNodes=function(t){var e=t;this._isScaled&&(e=this.scale(t)),this._noder.computeNodes(e)},$w.prototype.interfaces_=function(){return[Aw]},$w.prototype.getClass=function(){return $w};var tb=function(){this._li=new DE,this._segStrings=null;var t=arguments[0];this._segStrings=t},eb={fact:{configurable:!0}};tb.prototype.checkEndPtVertexIntersections=function(){var t=this;if(0===arguments.length)for(var e=this._segStrings.iterator();e.hasNext();){var n=e.next().getCoordinates();t.checkEndPtVertexIntersections(n[0],t._segStrings),t.checkEndPtVertexIntersections(n[n.length-1],t._segStrings)}else if(2===arguments.length)for(var r=arguments[0],i=arguments[1].iterator();i.hasNext();)for(var o=i.next().getCoordinates(),s=1;s<o.length-1;s++)if(o[s].equals(r))throw new LE("found endpt/interior pt intersection at index "+s+" :pt "+r)},tb.prototype.checkInteriorIntersections=function(){if(0===arguments.length)for(var t=this._segStrings.iterator();t.hasNext();)for(var e=t.next(),n=this._segStrings.iterator();n.hasNext();){var r=n.next();this.checkInteriorIntersections(e,r)}else if(2===arguments.length)for(var i=arguments[0],o=arguments[1],s=i.getCoordinates(),a=o.getCoordinates(),u=0;u<s.length-1;u++)for(var l=0;l<a.length-1;l++)this.checkInteriorIntersections(i,u,o,l);else if(4===arguments.length){var c=arguments[0],h=arguments[1],f=arguments[2],p=arguments[3];if(c===f&&h===p)return null;var g=c.getCoordinates()[h],A=c.getCoordinates()[h+1],d=f.getCoordinates()[p],y=f.getCoordinates()[p+1];if(this._li.computeIntersection(g,A,d,y),this._li.hasIntersection()&&(this._li.isProper()||this.hasInteriorIntersection(this._li,g,A)||this.hasInteriorIntersection(this._li,d,y)))throw new LE("found non-noded intersection at "+g+"-"+A+" and "+d+"-"+y)}},tb.prototype.checkValid=function(){this.checkEndPtVertexIntersections(),this.checkInteriorIntersections(),this.checkCollapses()},tb.prototype.checkCollapses=function(){if(0===arguments.length)for(var t=this._segStrings.iterator();t.hasNext();){var e=t.next();this.checkCollapses(e)}else if(1===arguments.length)for(var n=arguments[0].getCoordinates(),r=0;r<n.length-2;r++)this.checkCollapse(n[r],n[r+1],n[r+2])},tb.prototype.hasInteriorIntersection=function(t,e,n){for(var r=0;r<t.getIntersectionNum();r++){var i=t.getIntersection(r);if(!i.equals(e)&&!i.equals(n))return!0}return!1},tb.prototype.checkCollapse=function(t,e,n){if(t.equals(n))throw new LE("found non-noded collapse at "+tb.fact.createLineString([t,e,n]))},tb.prototype.interfaces_=function(){return[]},tb.prototype.getClass=function(){return tb},eb.fact.get=function(){return new hC},Object.defineProperties(tb,eb);var nb=function(){this._li=null,this._pt=null,this._originalPt=null,this._ptScaled=null,this._p0Scaled=null,this._p1Scaled=null,this._scaleFactor=null,this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,this._corner=new Array(4).fill(null),this._safeEnv=null;var t=arguments[0],e=arguments[1],n=arguments[2];if(this._originalPt=t,this._pt=t,this._scaleFactor=e,this._li=n,e<=0)throw new XI("Scale factor must be non-zero");1!==e&&(this._pt=new eE(this.scale(t.x),this.scale(t.y)),this._p0Scaled=new eE,this._p1Scaled=new eE),this.initCorners(this._pt)},rb={SAFE_ENV_EXPANSION_FACTOR:{configurable:!0}};nb.prototype.intersectsScaled=function(t,e){var n=Math.min(t.x,e.x),r=Math.max(t.x,e.x),i=Math.min(t.y,e.y),o=Math.max(t.y,e.y),s=this._maxx<n||this._minx>r||this._maxy<i||this._miny>o;if(s)return!1;var a=this.intersectsToleranceSquare(t,e);return TE.isTrue(!(s&&a),"Found bad envelope test"),a},nb.prototype.initCorners=function(t){var e=.5;this._minx=t.x-e,this._maxx=t.x+e,this._miny=t.y-e,this._maxy=t.y+e,this._corner[0]=new eE(this._maxx,this._maxy),this._corner[1]=new eE(this._minx,this._maxy),this._corner[2]=new eE(this._minx,this._miny),this._corner[3]=new eE(this._maxx,this._miny)},nb.prototype.intersects=function(t,e){return 1===this._scaleFactor?this.intersectsScaled(t,e):(this.copyScaled(t,this._p0Scaled),this.copyScaled(e,this._p1Scaled),this.intersectsScaled(this._p0Scaled,this._p1Scaled))},nb.prototype.scale=function(t){return Math.round(t*this._scaleFactor)},nb.prototype.getCoordinate=function(){return this._originalPt},nb.prototype.copyScaled=function(t,e){e.x=this.scale(t.x),e.y=this.scale(t.y)},nb.prototype.getSafeEnvelope=function(){if(null===this._safeEnv){var t=nb.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new xE(this._originalPt.x-t,this._originalPt.x+t,this._originalPt.y-t,this._originalPt.y+t)}return this._safeEnv},nb.prototype.intersectsPixelClosure=function(t,e){return this._li.computeIntersection(t,e,this._corner[0],this._corner[1]),!!this._li.hasIntersection()||(this._li.computeIntersection(t,e,this._corner[1],this._corner[2]),!!this._li.hasIntersection()||(this._li.computeIntersection(t,e,this._corner[2],this._corner[3]),!!this._li.hasIntersection()||(this._li.computeIntersection(t,e,this._corner[3],this._corner[0]),!!this._li.hasIntersection())))},nb.prototype.intersectsToleranceSquare=function(t,e){var n=!1,r=!1;return this._li.computeIntersection(t,e,this._corner[0],this._corner[1]),!!this._li.isProper()||(this._li.computeIntersection(t,e,this._corner[1],this._corner[2]),!!this._li.isProper()||(this._li.hasIntersection()&&(n=!0),this._li.computeIntersection(t,e,this._corner[2],this._corner[3]),!!this._li.isProper()||(this._li.hasIntersection()&&(r=!0),this._li.computeIntersection(t,e,this._corner[3],this._corner[0]),!!this._li.isProper()||(!(!n||!r)||(!!t.equals(this._pt)||!!e.equals(this._pt))))))},nb.prototype.addSnappedNode=function(t,e){var n=t.getCoordinate(e),r=t.getCoordinate(e+1);return!!this.intersects(n,r)&&(t.addIntersection(this.getCoordinate(),e),!0)},nb.prototype.interfaces_=function(){return[]},nb.prototype.getClass=function(){return nb},rb.SAFE_ENV_EXPANSION_FACTOR.get=function(){return.75},Object.defineProperties(nb,rb);var ib=function(){this.tempEnv1=new xE,this.selectedSegment=new cw};ib.prototype.select=function(){if(1===arguments.length);else if(2===arguments.length){var t=arguments[1];arguments[0].getLineSegment(t,this.selectedSegment),this.select(this.selectedSegment)}},ib.prototype.interfaces_=function(){return[]},ib.prototype.getClass=function(){return ib};var ob=function(){this._index=null;var t=arguments[0];this._index=t},sb={HotPixelSnapAction:{configurable:!0}};ob.prototype.snap=function(){if(1===arguments.length){var t=arguments[0];return this.snap(t,null,-1)}if(3===arguments.length){var e=arguments[0],n=arguments[1],r=arguments[2],i=e.getSafeEnvelope(),o=new ab(e,n,r);return this._index.query(i,{interfaces_:function(){return[VC]},visitItem:function(t){t.select(i,o)}}),o.isNodeAdded()}},ob.prototype.interfaces_=function(){return[]},ob.prototype.getClass=function(){return ob},sb.HotPixelSnapAction.get=function(){return ab},Object.defineProperties(ob,sb);var ab=function(t){function e(){t.call(this),this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var e=arguments[0],n=arguments[1],r=arguments[2];this._hotPixel=e,this._parentEdge=n,this._hotPixelVertexIndex=r}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isNodeAdded=function(){return this._isNodeAdded},e.prototype.select=function(){if(2!==arguments.length)return t.prototype.select.apply(this,arguments);var e=arguments[1],n=arguments[0].getContext();if(null!==this._parentEdge&&n===this._parentEdge&&e===this._hotPixelVertexIndex)return null;this._isNodeAdded=this._hotPixel.addSnappedNode(n,e)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(ib),ub=function(){this._li=null,this._interiorIntersections=null;var t=arguments[0];this._li=t,this._interiorIntersections=new nx};ub.prototype.processIntersections=function(t,e,n,r){if(t===n&&e===r)return null;var i=t.getCoordinates()[e],o=t.getCoordinates()[e+1],s=n.getCoordinates()[r],a=n.getCoordinates()[r+1];if(this._li.computeIntersection(i,o,s,a),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var u=0;u<this._li.getIntersectionNum();u++)this._interiorIntersections.add(this._li.getIntersection(u));t.addIntersections(this._li,e,0),n.addIntersections(this._li,r,1)}},ub.prototype.isDone=function(){return!1},ub.prototype.getInteriorIntersections=function(){return this._interiorIntersections},ub.prototype.interfaces_=function(){return[jw]},ub.prototype.getClass=function(){return ub};var lb=function(){this._pm=null,this._li=null,this._scaleFactor=null,this._noder=null,this._pointSnapper=null,this._nodedSegStrings=null;var t=arguments[0];this._pm=t,this._li=new DE,this._li.setPrecisionModel(t),this._scaleFactor=t.getScale()};lb.prototype.checkCorrectness=function(t){var e=lw.getNodedSubstrings(t),n=new tb(e);try{n.checkValid()}catch(t){if(!(t instanceof mE))throw t;t.printStackTrace()}},lb.prototype.getNodedSubstrings=function(){return lw.getNodedSubstrings(this._nodedSegStrings)},lb.prototype.snapRound=function(t,e){var n=this.findInteriorIntersections(t,e);this.computeIntersectionSnaps(n),this.computeVertexSnaps(t)},lb.prototype.findInteriorIntersections=function(t,e){var n=new ub(e);return this._noder.setSegmentIntersector(n),this._noder.computeNodes(t),n.getInteriorIntersections()},lb.prototype.computeVertexSnaps=function(){var t=this;if(aE(arguments[0],KE))for(var e=arguments[0].iterator();e.hasNext();){var n=e.next();t.computeVertexSnaps(n)}else if(arguments[0]instanceof lw)for(var r=arguments[0],i=r.getCoordinates(),o=0;o<i.length;o++){var s=new nb(i[o],t._scaleFactor,t._li);t._pointSnapper.snap(s,r,o)&&r.addIntersection(i[o],o)}},lb.prototype.computeNodes=function(t){this._nodedSegStrings=t,this._noder=new yw,this._pointSnapper=new ob(this._noder.getIndex()),this.snapRound(t,this._li)},lb.prototype.computeIntersectionSnaps=function(t){for(var e=this,n=t.iterator();n.hasNext();){var r=n.next(),i=new nb(r,e._scaleFactor,e._li);e._pointSnapper.snap(i)}},lb.prototype.interfaces_=function(){return[Aw]},lb.prototype.getClass=function(){return lb};var cb=function(){if(this._argGeom=null,this._distance=null,this._bufParams=new mw,this._resultGeometry=null,this._saveException=null,1===arguments.length){var t=arguments[0];this._argGeom=t}else if(2===arguments.length){var e=arguments[0],n=arguments[1];this._argGeom=e,this._bufParams=n}},hb={CAP_ROUND:{configurable:!0},CAP_BUTT:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},MAX_PRECISION_DIGITS:{configurable:!0}};cb.prototype.bufferFixedPrecision=function(t){var e=new $w(new lb(new aC(1)),t.getScale()),n=new Zw(this._bufParams);n.setWorkingPrecisionModel(t),n.setNoder(e),this._resultGeometry=n.buffer(this._argGeom,this._distance)},cb.prototype.bufferReducedPrecision=function(){var t=this;if(0===arguments.length){for(var e=cb.MAX_PRECISION_DIGITS;e>=0;e--){try{t.bufferReducedPrecision(e)}catch(e){if(!(e instanceof CC))throw e;t._saveException=e}if(null!==t._resultGeometry)return null}throw this._saveException}if(1===arguments.length){var n=arguments[0],r=cb.precisionScaleFactor(this._argGeom,this._distance,n),i=new aC(r);this.bufferFixedPrecision(i)}},cb.prototype.computeGeometry=function(){if(this.bufferOriginalPrecision(),null!==this._resultGeometry)return null;var t=this._argGeom.getFactory().getPrecisionModel();t.getType()===aC.FIXED?this.bufferFixedPrecision(t):this.bufferReducedPrecision()},cb.prototype.setQuadrantSegments=function(t){this._bufParams.setQuadrantSegments(t)},cb.prototype.bufferOriginalPrecision=function(){try{var t=new Zw(this._bufParams);this._resultGeometry=t.buffer(this._argGeom,this._distance)}catch(t){if(!(t instanceof LE))throw t;this._saveException=t}},cb.prototype.getResultGeometry=function(t){return this._distance=t,this.computeGeometry(),this._resultGeometry},cb.prototype.setEndCapStyle=function(t){this._bufParams.setEndCapStyle(t)},cb.prototype.interfaces_=function(){return[]},cb.prototype.getClass=function(){return cb},cb.bufferOp=function(){if(2===arguments.length){var t=arguments[1];return new cb(arguments[0]).getResultGeometry(t)}if(3===arguments.length){if(Number.isInteger(arguments[2])&&arguments[0]instanceof UE&&"number"==typeof arguments[1]){var e=arguments[1],n=arguments[2],r=new cb(arguments[0]);return r.setQuadrantSegments(n),r.getResultGeometry(e)}if(arguments[2]instanceof mw&&arguments[0]instanceof UE&&"number"==typeof arguments[1]){var i=arguments[1];return new cb(arguments[0],arguments[2]).getResultGeometry(i)}}else if(4===arguments.length){var o=arguments[1],s=arguments[2],a=arguments[3],u=new cb(arguments[0]);return u.setQuadrantSegments(s),u.setEndCapStyle(a),u.getResultGeometry(o)}},cb.precisionScaleFactor=function(t,e,n){var r=t.getEnvelopeInternal(),i=uE.max(Math.abs(r.getMaxX()),Math.abs(r.getMaxY()),Math.abs(r.getMinX()),Math.abs(r.getMinY()))+2*(e>0?e:0),o=n-Math.trunc(Math.log(i)/Math.log(10)+1);return Math.pow(10,o)},hb.CAP_ROUND.get=function(){return mw.CAP_ROUND},hb.CAP_BUTT.get=function(){return mw.CAP_FLAT},hb.CAP_FLAT.get=function(){return mw.CAP_FLAT},hb.CAP_SQUARE.get=function(){return mw.CAP_SQUARE},hb.MAX_PRECISION_DIGITS.get=function(){return 12},Object.defineProperties(cb,hb);var fb=function(){this._pt=[new eE,new eE],this._distance=JI.NaN,this._isNull=!0};fb.prototype.getCoordinates=function(){return this._pt},fb.prototype.getCoordinate=function(t){return this._pt[t]},fb.prototype.setMinimum=function(){if(1===arguments.length){var t=arguments[0];this.setMinimum(t._pt[0],t._pt[1])}else if(2===arguments.length){var e=arguments[0],n=arguments[1];if(this._isNull)return this.initialize(e,n),null;var r=e.distance(n);r<this._distance&&this.initialize(e,n,r)}},fb.prototype.initialize=function(){if(0===arguments.length)this._isNull=!0;else if(2===arguments.length){var t=arguments[0],e=arguments[1];this._pt[0].setCoordinate(t),this._pt[1].setCoordinate(e),this._distance=t.distance(e),this._isNull=!1}else if(3===arguments.length){var n=arguments[0],r=arguments[1],i=arguments[2];this._pt[0].setCoordinate(n),this._pt[1].setCoordinate(r),this._distance=i,this._isNull=!1}},fb.prototype.getDistance=function(){return this._distance},fb.prototype.setMaximum=function(){if(1===arguments.length){var t=arguments[0];this.setMaximum(t._pt[0],t._pt[1])}else if(2===arguments.length){var e=arguments[0],n=arguments[1];if(this._isNull)return this.initialize(e,n),null;var r=e.distance(n);r>this._distance&&this.initialize(e,n,r)}},fb.prototype.interfaces_=function(){return[]},fb.prototype.getClass=function(){return fb};var pb=function(){};pb.prototype.interfaces_=function(){return[]},pb.prototype.getClass=function(){return pb},pb.computeDistance=function(){if(arguments[2]instanceof fb&&arguments[0]instanceof jx&&arguments[1]instanceof eE)for(var t=arguments[1],e=arguments[2],n=arguments[0].getCoordinates(),r=new cw,i=0;i<n.length-1;i++){r.setCoordinates(n[i],n[i+1]);var o=r.closestPoint(t);e.setMinimum(o,t)}else if(arguments[2]instanceof fb&&arguments[0]instanceof Hx&&arguments[1]instanceof eE){var s=arguments[0],a=arguments[1],u=arguments[2];pb.computeDistance(s.getExteriorRing(),a,u);for(var l=0;l<s.getNumInteriorRing();l++)pb.computeDistance(s.getInteriorRingN(l),a,u)}else if(arguments[2]instanceof fb&&arguments[0]instanceof UE&&arguments[1]instanceof eE){var c=arguments[0],h=arguments[1],f=arguments[2];if(c instanceof jx)pb.computeDistance(c,h,f);else if(c instanceof Hx)pb.computeDistance(c,h,f);else if(c instanceof Lx)for(var p=c,g=0;g<p.getNumGeometries();g++){var A=p.getGeometryN(g);pb.computeDistance(A,h,f)}else f.setMinimum(c.getCoordinate(),h)}else if(arguments[2]instanceof fb&&arguments[0]instanceof cw&&arguments[1]instanceof eE){var d=arguments[1],y=arguments[2],v=arguments[0].closestPoint(d);y.setMinimum(v,d)}};var gb=function(t){this._maxPtDist=new fb,this._inputGeom=t||null},Ab={MaxPointDistanceFilter:{configurable:!0},MaxMidpointDistanceFilter:{configurable:!0}};gb.prototype.computeMaxMidpointDistance=function(t){var e=new yb(this._inputGeom);t.apply(e),this._maxPtDist.setMaximum(e.getMaxPointDistance())},gb.prototype.computeMaxVertexDistance=function(t){var e=new db(this._inputGeom);t.apply(e),this._maxPtDist.setMaximum(e.getMaxPointDistance())},gb.prototype.findDistance=function(t){return this.computeMaxVertexDistance(t),this.computeMaxMidpointDistance(t),this._maxPtDist.getDistance()},gb.prototype.getDistancePoints=function(){return this._maxPtDist},gb.prototype.interfaces_=function(){return[]},gb.prototype.getClass=function(){return gb},Ab.MaxPointDistanceFilter.get=function(){return db},Ab.MaxMidpointDistanceFilter.get=function(){return yb},Object.defineProperties(gb,Ab);var db=function(t){this._maxPtDist=new fb,this._minPtDist=new fb,this._geom=t||null};db.prototype.filter=function(t){this._minPtDist.initialize(),pb.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},db.prototype.getMaxPointDistance=function(){return this._maxPtDist},db.prototype.interfaces_=function(){return[zE]},db.prototype.getClass=function(){return db};var yb=function(t){this._maxPtDist=new fb,this._minPtDist=new fb,this._geom=t||null};yb.prototype.filter=function(t,e){if(0===e)return null;var n=t.getCoordinate(e-1),r=t.getCoordinate(e),i=new eE((n.x+r.x)/2,(n.y+r.y)/2);this._minPtDist.initialize(),pb.computeDistance(this._geom,i,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},yb.prototype.isDone=function(){return!1},yb.prototype.isGeometryChanged=function(){return!1},yb.prototype.getMaxPointDistance=function(){return this._maxPtDist},yb.prototype.interfaces_=function(){return[Mx]},yb.prototype.getClass=function(){return yb};var vb=function(t){this._comps=t||null};vb.prototype.filter=function(t){t instanceof Hx&&this._comps.add(t)},vb.prototype.interfaces_=function(){return[Sx]},vb.prototype.getClass=function(){return vb},vb.getPolygons=function(){if(1===arguments.length)return vb.getPolygons(arguments[0],new nx);if(2===arguments.length){var t=arguments[0],e=arguments[1];return t instanceof Hx?e.add(t):t instanceof Lx&&t.apply(new vb(e)),e}};var mb=function(){if(this._lines=null,this._isForcedToLineString=!1,1===arguments.length){var t=arguments[0];this._lines=t}else if(2===arguments.length){var e=arguments[0],n=arguments[1];this._lines=e,this._isForcedToLineString=n}};mb.prototype.filter=function(t){if(this._isForcedToLineString&&t instanceof Jx){var e=t.getFactory().createLineString(t.getCoordinateSequence());return this._lines.add(e),null}t instanceof jx&&this._lines.add(t)},mb.prototype.setForceToLineString=function(t){this._isForcedToLineString=t},mb.prototype.interfaces_=function(){return[GE]},mb.prototype.getClass=function(){return mb},mb.getGeometry=function(){if(1===arguments.length){var t=arguments[0];return t.getFactory().buildGeometry(mb.getLines(t))}if(2===arguments.length){var e=arguments[0],n=arguments[1];return e.getFactory().buildGeometry(mb.getLines(e,n))}},mb.getLines=function(){if(1===arguments.length)return mb.getLines(arguments[0],!1);if(2===arguments.length){if(aE(arguments[0],KE)&&aE(arguments[1],KE)){for(var t=arguments[1],e=arguments[0].iterator();e.hasNext();){var n=e.next();mb.getLines(n,t)}return t}if(arguments[0]instanceof UE&&"boolean"==typeof arguments[1]){var r=arguments[0],i=arguments[1],o=new nx;return r.apply(new mb(o,i)),o}if(arguments[0]instanceof UE&&aE(arguments[1],KE)){var s=arguments[0],a=arguments[1];return s instanceof jx?a.add(s):s.apply(new mb(a)),a}}else if(3===arguments.length){if("boolean"==typeof arguments[2]&&aE(arguments[0],KE)&&aE(arguments[1],KE)){for(var u=arguments[1],l=arguments[2],c=arguments[0].iterator();c.hasNext();){var h=c.next();mb.getLines(h,u,l)}return u}if("boolean"==typeof arguments[2]&&arguments[0]instanceof UE&&aE(arguments[1],KE)){var f=arguments[1],p=arguments[2];return arguments[0].apply(new mb(f,p)),f}}};var _b=function(){if(this._boundaryRule=VE.OGC_SFS_BOUNDARY_RULE,this._isIn=null,this._numBoundaries=null,0===arguments.length);else if(1===arguments.length){var t=arguments[0];if(null===t)throw new XI("Rule must be non-null");this._boundaryRule=t}};_b.prototype.locateInternal=function(){if(arguments[0]instanceof eE&&arguments[1]instanceof Hx){var t=arguments[0],e=arguments[1];if(e.isEmpty())return oE.EXTERIOR;var n=e.getExteriorRing(),r=this.locateInPolygonRing(t,n);if(r===oE.EXTERIOR)return oE.EXTERIOR;if(r===oE.BOUNDARY)return oE.BOUNDARY;for(var i=0;i<e.getNumInteriorRing();i++){var o=e.getInteriorRingN(i),s=this.locateInPolygonRing(t,o);if(s===oE.INTERIOR)return oE.EXTERIOR;if(s===oE.BOUNDARY)return oE.BOUNDARY}return oE.INTERIOR}if(arguments[0]instanceof eE&&arguments[1]instanceof jx){var a=arguments[0],u=arguments[1];if(!u.getEnvelopeInternal().intersects(a))return oE.EXTERIOR;var l=u.getCoordinates();return u.isClosed()||!a.equals(l[0])&&!a.equals(l[l.length-1])?OE.isOnLine(a,l)?oE.INTERIOR:oE.EXTERIOR:oE.BOUNDARY}if(arguments[0]instanceof eE&&arguments[1]instanceof Vx){var c=arguments[0];return arguments[1].getCoordinate().equals2D(c)?oE.INTERIOR:oE.EXTERIOR}},_b.prototype.locateInPolygonRing=function(t,e){return e.getEnvelopeInternal().intersects(t)?OE.locatePointInRing(t,e.getCoordinates()):oE.EXTERIOR},_b.prototype.intersects=function(t,e){return this.locate(t,e)!==oE.EXTERIOR},_b.prototype.updateLocationInfo=function(t){t===oE.INTERIOR&&(this._isIn=!0),t===oE.BOUNDARY&&this._numBoundaries++},_b.prototype.computeLocation=function(t,e){var n=this;if(e instanceof Vx&&this.updateLocationInfo(this.locateInternal(t,e)),e instanceof jx)this.updateLocationInfo(this.locateInternal(t,e));else if(e instanceof Hx)this.updateLocationInfo(this.locateInternal(t,e));else if(e instanceof Nx)for(var r=e,i=0;i<r.getNumGeometries();i++){var o=r.getGeometryN(i);n.updateLocationInfo(n.locateInternal(t,o))}else if(e instanceof Wx)for(var s=e,a=0;a<s.getNumGeometries();a++){var u=s.getGeometryN(a);n.updateLocationInfo(n.locateInternal(t,u))}else if(e instanceof Lx)for(var l=new Pw(e);l.hasNext();){var c=l.next();c!==e&&n.computeLocation(t,c)}},_b.prototype.locate=function(t,e){return e.isEmpty()?oE.EXTERIOR:e instanceof jx||e instanceof Hx?this.locateInternal(t,e):(this._isIn=!1,this._numBoundaries=0,this.computeLocation(t,e),this._boundaryRule.isInBoundary(this._numBoundaries)?oE.BOUNDARY:this._numBoundaries>0||this._isIn?oE.INTERIOR:oE.EXTERIOR)},_b.prototype.interfaces_=function(){return[]},_b.prototype.getClass=function(){return _b};var Ib=function t(){if(this._component=null,this._segIndex=null,this._pt=null,2===arguments.length)t.call(this,arguments[0],t.INSIDE_AREA,arguments[1]);else if(3===arguments.length){var e=arguments[0],n=arguments[1],r=arguments[2];this._component=e,this._segIndex=n,this._pt=r}},Eb={INSIDE_AREA:{configurable:!0}};Ib.prototype.isInsideArea=function(){return this._segIndex===Ib.INSIDE_AREA},Ib.prototype.getCoordinate=function(){return this._pt},Ib.prototype.getGeometryComponent=function(){return this._component},Ib.prototype.getSegmentIndex=function(){return this._segIndex},Ib.prototype.interfaces_=function(){return[]},Ib.prototype.getClass=function(){return Ib},Eb.INSIDE_AREA.get=function(){return-1},Object.defineProperties(Ib,Eb);var xb=function(t){this._pts=t||null};xb.prototype.filter=function(t){t instanceof Vx&&this._pts.add(t)},xb.prototype.interfaces_=function(){return[Sx]},xb.prototype.getClass=function(){return xb},xb.getPoints=function(){if(1===arguments.length){var t=arguments[0];return t instanceof Vx?JC.singletonList(t):xb.getPoints(t,new nx)}if(2===arguments.length){var e=arguments[0],n=arguments[1];return e instanceof Vx?n.add(e):e instanceof Lx&&e.apply(new xb(n)),n}};var Cb=function(){this._locations=null;var t=arguments[0];this._locations=t};Cb.prototype.filter=function(t){(t instanceof Vx||t instanceof jx||t instanceof Hx)&&this._locations.add(new Ib(t,0,t.getCoordinate()))},Cb.prototype.interfaces_=function(){return[Sx]},Cb.prototype.getClass=function(){return Cb},Cb.getLocations=function(t){var e=new nx;return t.apply(new Cb(e)),e};var wb=function(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new _b,this._minDistanceLocation=null,this._minDistance=JI.MAX_VALUE,2===arguments.length){var t=arguments[0],e=arguments[1];this._geom=[t,e],this._terminateDistance=0}else if(3===arguments.length){var n=arguments[0],r=arguments[1],i=arguments[2];this._geom=new Array(2).fill(null),this._geom[0]=n,this._geom[1]=r,this._terminateDistance=i}};wb.prototype.computeContainmentDistance=function(){var t=this;if(0===arguments.length){var e=new Array(2).fill(null);if(this.computeContainmentDistance(0,e),this._minDistance<=this._terminateDistance)return null;this.computeContainmentDistance(1,e)}else if(2===arguments.length){var n=arguments[0],r=arguments[1],i=1-n,o=vb.getPolygons(this._geom[n]);if(o.size()>0){var s=Cb.getLocations(this._geom[i]);if(this.computeContainmentDistance(s,o,r),this._minDistance<=this._terminateDistance)return this._minDistanceLocation[i]=r[0],this._minDistanceLocation[n]=r[1],null}}else if(3===arguments.length)if(arguments[2]instanceof Array&&aE(arguments[0],tx)&&aE(arguments[1],tx)){for(var a=arguments[0],u=arguments[1],l=arguments[2],c=0;c<a.size();c++)for(var h=a.get(c),f=0;f<u.size();f++)if(t.computeContainmentDistance(h,u.get(f),l),t._minDistance<=t._terminateDistance)return null}else if(arguments[2]instanceof Array&&arguments[0]instanceof Ib&&arguments[1]instanceof Hx){var p=arguments[0],g=arguments[1],A=arguments[2],d=p.getCoordinate();if(oE.EXTERIOR!==this._ptLocator.locate(d,g))return this._minDistance=0,A[0]=p,A[1]=new Ib(g,d),null}},wb.prototype.computeMinDistanceLinesPoints=function(t,e,n){for(var r=this,i=0;i<t.size();i++)for(var o=t.get(i),s=0;s<e.size();s++){var a=e.get(s);if(r.computeMinDistance(o,a,n),r._minDistance<=r._terminateDistance)return null}},wb.prototype.computeFacetDistance=function(){var t=new Array(2).fill(null),e=mb.getLines(this._geom[0]),n=mb.getLines(this._geom[1]),r=xb.getPoints(this._geom[0]),i=xb.getPoints(this._geom[1]);return this.computeMinDistanceLines(e,n,t),this.updateMinDistance(t,!1),this._minDistance<=this._terminateDistance?null:(t[0]=null,t[1]=null,this.computeMinDistanceLinesPoints(e,i,t),this.updateMinDistance(t,!1),this._minDistance<=this._terminateDistance?null:(t[0]=null,t[1]=null,this.computeMinDistanceLinesPoints(n,r,t),this.updateMinDistance(t,!0),this._minDistance<=this._terminateDistance?null:(t[0]=null,t[1]=null,this.computeMinDistancePoints(r,i,t),void this.updateMinDistance(t,!1))))},wb.prototype.nearestLocations=function(){return this.computeMinDistance(),this._minDistanceLocation},wb.prototype.updateMinDistance=function(t,e){if(null===t[0])return null;e?(this._minDistanceLocation[0]=t[1],this._minDistanceLocation[1]=t[0]):(this._minDistanceLocation[0]=t[0],this._minDistanceLocation[1]=t[1])},wb.prototype.nearestPoints=function(){return this.computeMinDistance(),[this._minDistanceLocation[0].getCoordinate(),this._minDistanceLocation[1].getCoordinate()]},wb.prototype.computeMinDistance=function(){var t=this;if(0===arguments.length){if(null!==this._minDistanceLocation)return null;if(this._minDistanceLocation=new Array(2).fill(null),this.computeContainmentDistance(),this._minDistance<=this._terminateDistance)return null;this.computeFacetDistance()}else if(3===arguments.length)if(arguments[2]instanceof Array&&arguments[0]instanceof jx&&arguments[1]instanceof Vx){var e=arguments[0],n=arguments[1],r=arguments[2];if(e.getEnvelopeInternal().distance(n.getEnvelopeInternal())>this._minDistance)return null;for(var i=e.getCoordinates(),o=n.getCoordinate(),s=0;s<i.length-1;s++){var a=OE.distancePointLine(o,i[s],i[s+1]);if(a<t._minDistance){t._minDistance=a;var u=new cw(i[s],i[s+1]).closestPoint(o);r[0]=new Ib(e,s,u),r[1]=new Ib(n,0,o)}if(t._minDistance<=t._terminateDistance)return null}}else if(arguments[2]instanceof Array&&arguments[0]instanceof jx&&arguments[1]instanceof jx){var l=arguments[0],c=arguments[1],h=arguments[2];if(l.getEnvelopeInternal().distance(c.getEnvelopeInternal())>this._minDistance)return null;for(var f=l.getCoordinates(),p=c.getCoordinates(),g=0;g<f.length-1;g++)for(var A=0;A<p.length-1;A++){var d=OE.distanceLineLine(f[g],f[g+1],p[A],p[A+1]);if(d<t._minDistance){t._minDistance=d;var y=new cw(f[g],f[g+1]),v=new cw(p[A],p[A+1]),m=y.closestPoints(v);h[0]=new Ib(l,g,m[0]),h[1]=new Ib(c,A,m[1])}if(t._minDistance<=t._terminateDistance)return null}}},wb.prototype.computeMinDistancePoints=function(t,e,n){for(var r=this,i=0;i<t.size();i++)for(var o=t.get(i),s=0;s<e.size();s++){var a=e.get(s),u=o.getCoordinate().distance(a.getCoordinate());if(u<r._minDistance&&(r._minDistance=u,n[0]=new Ib(o,0,o.getCoordinate()),n[1]=new Ib(a,0,a.getCoordinate())),r._minDistance<=r._terminateDistance)return null}},wb.prototype.distance=function(){if(null===this._geom[0]||null===this._geom[1])throw new XI("null geometries are not supported");return this._geom[0].isEmpty()||this._geom[1].isEmpty()?0:(this.computeMinDistance(),this._minDistance)},wb.prototype.computeMinDistanceLines=function(t,e,n){for(var r=this,i=0;i<t.size();i++)for(var o=t.get(i),s=0;s<e.size();s++){var a=e.get(s);if(r.computeMinDistance(o,a,n),r._minDistance<=r._terminateDistance)return null}},wb.prototype.interfaces_=function(){return[]},wb.prototype.getClass=function(){return wb},wb.distance=function(t,e){return new wb(t,e).distance()},wb.isWithinDistance=function(t,e,n){return new wb(t,e,n).distance()<=n},wb.nearestPoints=function(t,e){return new wb(t,e).nearestPoints()};var bb=function(){this._pt=[new eE,new eE],this._distance=JI.NaN,this._isNull=!0};bb.prototype.getCoordinates=function(){return this._pt},bb.prototype.getCoordinate=function(t){return this._pt[t]},bb.prototype.setMinimum=function(){if(1===arguments.length){var t=arguments[0];this.setMinimum(t._pt[0],t._pt[1])}else if(2===arguments.length){var e=arguments[0],n=arguments[1];if(this._isNull)return this.initialize(e,n),null;var r=e.distance(n);r<this._distance&&this.initialize(e,n,r)}},bb.prototype.initialize=function(){if(0===arguments.length)this._isNull=!0;else if(2===arguments.length){var t=arguments[0],e=arguments[1];this._pt[0].setCoordinate(t),this._pt[1].setCoordinate(e),this._distance=t.distance(e),this._isNull=!1}else if(3===arguments.length){var n=arguments[0],r=arguments[1],i=arguments[2];this._pt[0].setCoordinate(n),this._pt[1].setCoordinate(r),this._distance=i,this._isNull=!1}},bb.prototype.toString=function(){return ME.toLineString(this._pt[0],this._pt[1])},bb.prototype.getDistance=function(){return this._distance},bb.prototype.setMaximum=function(){if(1===arguments.length){var t=arguments[0];this.setMaximum(t._pt[0],t._pt[1])}else if(2===arguments.length){var e=arguments[0],n=arguments[1];if(this._isNull)return this.initialize(e,n),null;var r=e.distance(n);r>this._distance&&this.initialize(e,n,r)}},bb.prototype.interfaces_=function(){return[]},bb.prototype.getClass=function(){return bb};var Bb=function(){};Bb.prototype.interfaces_=function(){return[]},Bb.prototype.getClass=function(){return Bb},Bb.computeDistance=function(){if(arguments[2]instanceof bb&&arguments[0]instanceof jx&&arguments[1]instanceof eE)for(var t=arguments[0],e=arguments[1],n=arguments[2],r=new cw,i=t.getCoordinates(),o=0;o<i.length-1;o++){r.setCoordinates(i[o],i[o+1]);var s=r.closestPoint(e);n.setMinimum(s,e)}else if(arguments[2]instanceof bb&&arguments[0]instanceof Hx&&arguments[1]instanceof eE){var a=arguments[0],u=arguments[1],l=arguments[2];Bb.computeDistance(a.getExteriorRing(),u,l);for(var c=0;c<a.getNumInteriorRing();c++)Bb.computeDistance(a.getInteriorRingN(c),u,l)}else if(arguments[2]instanceof bb&&arguments[0]instanceof UE&&arguments[1]instanceof eE){var h=arguments[0],f=arguments[1],p=arguments[2];if(h instanceof jx)Bb.computeDistance(h,f,p);else if(h instanceof Hx)Bb.computeDistance(h,f,p);else if(h instanceof Lx)for(var g=h,A=0;A<g.getNumGeometries();A++){var d=g.getGeometryN(A);Bb.computeDistance(d,f,p)}else p.setMinimum(h.getCoordinate(),f)}else if(arguments[2]instanceof bb&&arguments[0]instanceof cw&&arguments[1]instanceof eE){var y=arguments[1],v=arguments[2],m=arguments[0].closestPoint(y);v.setMinimum(m,y)}};var Sb=function(){this._g0=null,this._g1=null,this._ptDist=new bb,this._densifyFrac=0;var t=arguments[0],e=arguments[1];this._g0=t,this._g1=e},Mb={MaxPointDistanceFilter:{configurable:!0},MaxDensifiedByFractionDistanceFilter:{configurable:!0}};Sb.prototype.getCoordinates=function(){return this._ptDist.getCoordinates()},Sb.prototype.setDensifyFraction=function(t){if(t>1||t<=0)throw new XI("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=t},Sb.prototype.compute=function(t,e){this.computeOrientedDistance(t,e,this._ptDist),this.computeOrientedDistance(e,t,this._ptDist)},Sb.prototype.distance=function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()},Sb.prototype.computeOrientedDistance=function(t,e,n){var r=new Lb(e);if(t.apply(r),n.setMaximum(r.getMaxPointDistance()),this._densifyFrac>0){var i=new Nb(e,this._densifyFrac);t.apply(i),n.setMaximum(i.getMaxPointDistance())}},Sb.prototype.orientedDistance=function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()},Sb.prototype.interfaces_=function(){return[]},Sb.prototype.getClass=function(){return Sb},Sb.distance=function(){if(2===arguments.length)return new Sb(arguments[0],arguments[1]).distance();if(3===arguments.length){var t=arguments[2],e=new Sb(arguments[0],arguments[1]);return e.setDensifyFraction(t),e.distance()}},Mb.MaxPointDistanceFilter.get=function(){return Lb},Mb.MaxDensifiedByFractionDistanceFilter.get=function(){return Nb},Object.defineProperties(Sb,Mb);var Lb=function(){this._maxPtDist=new bb,this._minPtDist=new bb,this._euclideanDist=new Bb,this._geom=null;var t=arguments[0];this._geom=t};Lb.prototype.filter=function(t){this._minPtDist.initialize(),Bb.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},Lb.prototype.getMaxPointDistance=function(){return this._maxPtDist},Lb.prototype.interfaces_=function(){return[zE]},Lb.prototype.getClass=function(){return Lb};var Nb=function(){this._maxPtDist=new bb,this._minPtDist=new bb,this._geom=null,this._numSubSegs=0;var t=arguments[0],e=arguments[1];this._geom=t,this._numSubSegs=Math.trunc(Math.round(1/e))};Nb.prototype.filter=function(t,e){var n=this;if(0===e)return null;for(var r=t.getCoordinate(e-1),i=t.getCoordinate(e),o=(i.x-r.x)/this._numSubSegs,s=(i.y-r.y)/this._numSubSegs,a=0;a<this._numSubSegs;a++){var u=r.x+a*o,l=r.y+a*s,c=new eE(u,l);n._minPtDist.initialize(),Bb.computeDistance(n._geom,c,n._minPtDist),n._maxPtDist.setMaximum(n._minPtDist)}},Nb.prototype.isDone=function(){return!1},Nb.prototype.isGeometryChanged=function(){return!1},Nb.prototype.getMaxPointDistance=function(){return this._maxPtDist},Nb.prototype.interfaces_=function(){return[Mx]},Nb.prototype.getClass=function(){return Nb};var Tb=function(t,e,n){this._minValidDistance=null,this._maxValidDistance=null,this._minDistanceFound=null,this._maxDistanceFound=null,this._isValid=!0,this._errMsg=null,this._errorLocation=null,this._errorIndicator=null,this._input=t||null,this._bufDistance=e||null,this._result=n||null},Rb={VERBOSE:{configurable:!0},MAX_DISTANCE_DIFF_FRAC:{configurable:!0}};Tb.prototype.checkMaximumDistance=function(t,e,n){var r=new Sb(e,t);if(r.setDensifyFraction(.25),this._maxDistanceFound=r.orientedDistance(),this._maxDistanceFound>n){this._isValid=!1;var i=r.getCoordinates();this._errorLocation=i[1],this._errorIndicator=t.getFactory().createLineString(i),this._errMsg="Distance between buffer curve and input is too large ("+this._maxDistanceFound+" at "+ME.toLineString(i[0],i[1])+")"}},Tb.prototype.isValid=function(){var t=Math.abs(this._bufDistance),e=Tb.MAX_DISTANCE_DIFF_FRAC*t;return this._minValidDistance=t-e,this._maxValidDistance=t+e,!(!this._input.isEmpty()&&!this._result.isEmpty())||(this._bufDistance>0?this.checkPositiveValid():this.checkNegativeValid(),Tb.VERBOSE&&IE.out.println("Min Dist= "+this._minDistanceFound+" err= "+(1-this._minDistanceFound/this._bufDistance)+" Max Dist= "+this._maxDistanceFound+" err= "+(this._maxDistanceFound/this._bufDistance-1)),this._isValid)},Tb.prototype.checkNegativeValid=function(){if(!(this._input instanceof Hx||this._input instanceof Wx||this._input instanceof Lx))return null;var t=this.getPolygonLines(this._input);if(this.checkMinimumDistance(t,this._result,this._minValidDistance),!this._isValid)return null;this.checkMaximumDistance(t,this._result,this._maxValidDistance)},Tb.prototype.getErrorIndicator=function(){return this._errorIndicator},Tb.prototype.checkMinimumDistance=function(t,e,n){var r=new wb(t,e,n);if(this._minDistanceFound=r.distance(),this._minDistanceFound<n){this._isValid=!1;var i=r.nearestPoints();this._errorLocation=r.nearestPoints()[1],this._errorIndicator=t.getFactory().createLineString(i),this._errMsg="Distance between buffer curve and input is too small ("+this._minDistanceFound+" at "+ME.toLineString(i[0],i[1])+" )"}},Tb.prototype.checkPositiveValid=function(){var t=this._result.getBoundary();if(this.checkMinimumDistance(this._input,t,this._minValidDistance),!this._isValid)return null;this.checkMaximumDistance(this._input,t,this._maxValidDistance)},Tb.prototype.getErrorLocation=function(){return this._errorLocation},Tb.prototype.getPolygonLines=function(t){for(var e=new nx,n=new mb(e),r=vb.getPolygons(t).iterator();r.hasNext();){r.next().apply(n)}return t.getFactory().buildGeometry(e)},Tb.prototype.getErrorMessage=function(){return this._errMsg},Tb.prototype.interfaces_=function(){return[]},Tb.prototype.getClass=function(){return Tb},Rb.VERBOSE.get=function(){return!1},Rb.MAX_DISTANCE_DIFF_FRAC.get=function(){return.012},Object.defineProperties(Tb,Rb);var Qb=function(t,e,n){this._isValid=!0,this._errorMsg=null,this._errorLocation=null,this._errorIndicator=null,this._input=t||null,this._distance=e||null,this._result=n||null},Db={VERBOSE:{configurable:!0},MAX_ENV_DIFF_FRAC:{configurable:!0}};Qb.prototype.isValid=function(){return this.checkPolygonal(),this._isValid?(this.checkExpectedEmpty(),this._isValid?(this.checkEnvelope(),this._isValid?(this.checkArea(),this._isValid?(this.checkDistance(),this._isValid):this._isValid):this._isValid):this._isValid):this._isValid},Qb.prototype.checkEnvelope=function(){if(this._distance<0)return null;var t=this._distance*Qb.MAX_ENV_DIFF_FRAC;0===t&&(t=.001);var e=new xE(this._input.getEnvelopeInternal());e.expandBy(this._distance);var n=new xE(this._result.getEnvelopeInternal());n.expandBy(t),n.contains(e)||(this._isValid=!1,this._errorMsg="Buffer envelope is incorrect",this._errorIndicator=this._input.getFactory().toGeometry(n)),this.report("Envelope")},Qb.prototype.checkDistance=function(){var t=new Tb(this._input,this._distance,this._result);t.isValid()||(this._isValid=!1,this._errorMsg=t.getErrorMessage(),this._errorLocation=t.getErrorLocation(),this._errorIndicator=t.getErrorIndicator()),this.report("Distance")},Qb.prototype.checkArea=function(){var t=this._input.getArea(),e=this._result.getArea();this._distance>0&&t>e&&(this._isValid=!1,this._errorMsg="Area of positive buffer is smaller than input",this._errorIndicator=this._result),this._distance<0&&t<e&&(this._isValid=!1,this._errorMsg="Area of negative buffer is larger than input",this._errorIndicator=this._result),this.report("Area")},Qb.prototype.checkPolygonal=function(){this._result instanceof Hx||this._result instanceof Wx||(this._isValid=!1),this._errorMsg="Result is not polygonal",this._errorIndicator=this._result,this.report("Polygonal")},Qb.prototype.getErrorIndicator=function(){return this._errorIndicator},Qb.prototype.getErrorLocation=function(){return this._errorLocation},Qb.prototype.checkExpectedEmpty=function(){return this._input.getDimension()>=2||this._distance>0?null:(this._result.isEmpty()||(this._isValid=!1,this._errorMsg="Result is non-empty",this._errorIndicator=this._result),void this.report("ExpectedEmpty"))},Qb.prototype.report=function(t){if(!Qb.VERBOSE)return null;IE.out.println("Check "+t+": "+(this._isValid?"passed":"FAILED"))},Qb.prototype.getErrorMessage=function(){return this._errorMsg},Qb.prototype.interfaces_=function(){return[]},Qb.prototype.getClass=function(){return Qb},Qb.isValidMsg=function(t,e,n){var r=new Qb(t,e,n);return r.isValid()?null:r.getErrorMessage()},Qb.isValid=function(t,e,n){return!!new Qb(t,e,n).isValid()},Db.VERBOSE.get=function(){return!1},Db.MAX_ENV_DIFF_FRAC.get=function(){return.012},Object.defineProperties(Qb,Db);var Pb=function(){this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};Pb.prototype.getCoordinates=function(){return this._pts},Pb.prototype.size=function(){return this._pts.length},Pb.prototype.getCoordinate=function(t){return this._pts[t]},Pb.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},Pb.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:sw.octant(this.getCoordinate(t),this.getCoordinate(t+1))},Pb.prototype.setData=function(t){this._data=t},Pb.prototype.getData=function(){return this._data},Pb.prototype.toString=function(){return ME.toLineString(new nC(this._pts))},Pb.prototype.interfaces_=function(){return[aw]},Pb.prototype.getClass=function(){return Pb};var kb=function(){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new nx,this._intersectionCount=0,this._keepIntersections=!0;var t=arguments[0];this._li=t,this._interiorIntersection=null};kb.prototype.getInteriorIntersection=function(){return this._interiorIntersection},kb.prototype.setCheckEndSegmentsOnly=function(t){this._isCheckEndSegmentsOnly=t},kb.prototype.getIntersectionSegments=function(){return this._intSegments},kb.prototype.count=function(){return this._intersectionCount},kb.prototype.getIntersections=function(){return this._intersections},kb.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t},kb.prototype.setKeepIntersections=function(t){this._keepIntersections=t},kb.prototype.processIntersections=function(t,e,n,r){if(!this._findAllIntersections&&this.hasIntersection())return null;if(t===n&&e===r)return null;if(this._isCheckEndSegmentsOnly&&!(this.isEndSegment(t,e)||this.isEndSegment(n,r)))return null;var i=t.getCoordinates()[e],o=t.getCoordinates()[e+1],s=n.getCoordinates()[r],a=n.getCoordinates()[r+1];this._li.computeIntersection(i,o,s,a),this._li.hasIntersection()&&this._li.isInteriorIntersection()&&(this._intSegments=new Array(4).fill(null),this._intSegments[0]=i,this._intSegments[1]=o,this._intSegments[2]=s,this._intSegments[3]=a,this._interiorIntersection=this._li.getIntersection(0),this._keepIntersections&&this._intersections.add(this._interiorIntersection),this._intersectionCount++)},kb.prototype.isEndSegment=function(t,e){return 0===e||e>=t.size()-2},kb.prototype.hasIntersection=function(){return null!==this._interiorIntersection},kb.prototype.isDone=function(){return!this._findAllIntersections&&null!==this._interiorIntersection},kb.prototype.interfaces_=function(){return[jw]},kb.prototype.getClass=function(){return kb},kb.createAllIntersectionsFinder=function(t){var e=new kb(t);return e.setFindAllIntersections(!0),e},kb.createAnyIntersectionFinder=function(t){return new kb(t)},kb.createIntersectionCounter=function(t){var e=new kb(t);return e.setFindAllIntersections(!0),e.setKeepIntersections(!1),e};var Ob=function(){this._li=new DE,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;var t=arguments[0];this._segStrings=t};Ob.prototype.execute=function(){if(null!==this._segInt)return null;this.checkInteriorIntersections()},Ob.prototype.getIntersections=function(){return this._segInt.getIntersections()},Ob.prototype.isValid=function(){return this.execute(),this._isValid},Ob.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t},Ob.prototype.checkInteriorIntersections=function(){this._isValid=!0,this._segInt=new kb(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var t=new yw;if(t.setSegmentIntersector(this._segInt),t.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null},Ob.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new CC(this.getErrorMessage(),this._segInt.getInteriorIntersection())},Ob.prototype.getErrorMessage=function(){if(this._isValid)return"no intersections found";var t=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+ME.toLineString(t[0],t[1])+" and "+ME.toLineString(t[2],t[3])},Ob.prototype.interfaces_=function(){return[]},Ob.prototype.getClass=function(){return Ob},Ob.computeIntersections=function(t){var e=new Ob(t);return e.setFindAllIntersections(!0),e.isValid(),e.getIntersections()};var Fb=function t(){this._nv=null;var e=arguments[0];this._nv=new Ob(t.toSegmentStrings(e))};Fb.prototype.checkValid=function(){this._nv.checkValid()},Fb.prototype.interfaces_=function(){return[]},Fb.prototype.getClass=function(){return Fb},Fb.toSegmentStrings=function(t){for(var e=new nx,n=t.iterator();n.hasNext();){var r=n.next();e.add(new Pb(r.getCoordinates(),r))}return e},Fb.checkValid=function(t){new Fb(t).checkValid()};var Gb=function(t){this._mapOp=t};Gb.prototype.map=function(t){for(var e=new nx,n=0;n<t.getNumGeometries();n++){var r=this._mapOp.map(t.getGeometryN(n));r.isEmpty()||e.add(r)}return t.getFactory().createGeometryCollection(hC.toGeometryArray(e))},Gb.prototype.interfaces_=function(){return[]},Gb.prototype.getClass=function(){return Gb},Gb.map=function(t,e){return new Gb(e).map(t)};var Ub=function(){this._op=null,this._geometryFactory=null,this._ptLocator=null,this._lineEdgesList=new nx,this._resultLineList=new nx;var t=arguments[0],e=arguments[1],n=arguments[2];this._op=t,this._geometryFactory=e,this._ptLocator=n};Ub.prototype.collectLines=function(t){for(var e=this,n=this._op.getGraph().getEdgeEnds().iterator();n.hasNext();){var r=n.next();e.collectLineEdge(r,t,e._lineEdgesList),e.collectBoundaryTouchEdge(r,t,e._lineEdgesList)}},Ub.prototype.labelIsolatedLine=function(t,e){var n=this._ptLocator.locate(t.getCoordinate(),this._op.getArgGeometry(e));t.getLabel().setLocation(e,n)},Ub.prototype.build=function(t){return this.findCoveredLineEdges(),this.collectLines(t),this.buildLines(t),this._resultLineList},Ub.prototype.collectLineEdge=function(t,e,n){var r=t.getLabel(),i=t.getEdge();t.isLineEdge()&&(t.isVisited()||!IB.isResultOfOp(r,e)||i.isCovered()||(n.add(i),t.setVisitedEdge(!0)))},Ub.prototype.findCoveredLineEdges=function(){for(var t=this._op.getGraph().getNodes().iterator();t.hasNext();){t.next().getEdges().findCoveredLineEdges()}for(var e=this._op.getGraph().getEdgeEnds().iterator();e.hasNext();){var n=e.next(),r=n.getEdge();if(n.isLineEdge()&&!r.isCoveredSet()){var i=this._op.isCoveredByA(n.getCoordinate());r.setCovered(i)}}},Ub.prototype.labelIsolatedLines=function(t){for(var e=t.iterator();e.hasNext();){var n=e.next(),r=n.getLabel();n.isIsolated()&&(r.isNull(0)?this.labelIsolatedLine(n,0):this.labelIsolatedLine(n,1))}},Ub.prototype.buildLines=function(t){for(var e=this._lineEdgesList.iterator();e.hasNext();){var n=e.next(),r=this._geometryFactory.createLineString(n.getCoordinates());this._resultLineList.add(r),n.setInResult(!0)}},Ub.prototype.collectBoundaryTouchEdge=function(t,e,n){var r=t.getLabel();return t.isLineEdge()||t.isVisited()||t.isInteriorAreaEdge()||t.getEdge().isInResult()?null:(TE.isTrue(!(t.isInResult()||t.getSym().isInResult())||!t.getEdge().isInResult()),void(IB.isResultOfOp(r,e)&&e===IB.INTERSECTION&&(n.add(t.getEdge()),t.setVisitedEdge(!0))))},Ub.prototype.interfaces_=function(){return[]},Ub.prototype.getClass=function(){return Ub};var qb=function(){this._op=null,this._geometryFactory=null,this._resultPointList=new nx;var t=arguments[0],e=arguments[1];this._op=t,this._geometryFactory=e};qb.prototype.filterCoveredNodeToPoint=function(t){var e=t.getCoordinate();if(!this._op.isCoveredByLA(e)){var n=this._geometryFactory.createPoint(e);this._resultPointList.add(n)}},qb.prototype.extractNonCoveredResultNodes=function(t){for(var e=this._op.getGraph().getNodes().iterator();e.hasNext();){var n=e.next();if(!n.isInResult()&&(!n.isIncidentEdgeInResult()&&(0===n.getEdges().getDegree()||t===IB.INTERSECTION))){var r=n.getLabel();IB.isResultOfOp(r,t)&&this.filterCoveredNodeToPoint(n)}}},qb.prototype.build=function(t){return this.extractNonCoveredResultNodes(t),this._resultPointList},qb.prototype.interfaces_=function(){return[]},qb.prototype.getClass=function(){return qb};var jb=function(){this._inputGeom=null,this._factory=null,this._pruneEmptyGeometry=!0,this._preserveGeometryCollectionType=!0,this._preserveCollections=!1,this._preserveType=!1};jb.prototype.transformPoint=function(t,e){return this._factory.createPoint(this.transformCoordinates(t.getCoordinateSequence(),t))},jb.prototype.transformPolygon=function(t,e){var n=!0,r=this.transformLinearRing(t.getExteriorRing(),t);null!==r&&r instanceof Jx&&!r.isEmpty()||(n=!1);for(var i=new nx,o=0;o<t.getNumInteriorRing();o++){var s=this.transformLinearRing(t.getInteriorRingN(o),t);null===s||s.isEmpty()||(s instanceof Jx||(n=!1),i.add(s))}if(n)return this._factory.createPolygon(r,i.toArray([]));var a=new nx;return null!==r&&a.add(r),a.addAll(i),this._factory.buildGeometry(a)},jb.prototype.createCoordinateSequence=function(t){return this._factory.getCoordinateSequenceFactory().create(t)},jb.prototype.getInputGeometry=function(){return this._inputGeom},jb.prototype.transformMultiLineString=function(t,e){for(var n=new nx,r=0;r<t.getNumGeometries();r++){var i=this.transformLineString(t.getGeometryN(r),t);null!==i&&(i.isEmpty()||n.add(i))}return this._factory.buildGeometry(n)},jb.prototype.transformCoordinates=function(t,e){return this.copy(t)},jb.prototype.transformLineString=function(t,e){return this._factory.createLineString(this.transformCoordinates(t.getCoordinateSequence(),t))},jb.prototype.transformMultiPoint=function(t,e){for(var n=new nx,r=0;r<t.getNumGeometries();r++){var i=this.transformPoint(t.getGeometryN(r),t);null!==i&&(i.isEmpty()||n.add(i))}return this._factory.buildGeometry(n)},jb.prototype.transformMultiPolygon=function(t,e){for(var n=new nx,r=0;r<t.getNumGeometries();r++){var i=this.transformPolygon(t.getGeometryN(r),t);null!==i&&(i.isEmpty()||n.add(i))}return this._factory.buildGeometry(n)},jb.prototype.copy=function(t){return t.copy()},jb.prototype.transformGeometryCollection=function(t,e){for(var n=new nx,r=0;r<t.getNumGeometries();r++){var i=this.transform(t.getGeometryN(r));null!==i&&(this._pruneEmptyGeometry&&i.isEmpty()||n.add(i))}return this._preserveGeometryCollectionType?this._factory.createGeometryCollection(hC.toGeometryArray(n)):this._factory.buildGeometry(n)},jb.prototype.transform=function(t){if(this._inputGeom=t,this._factory=t.getFactory(),t instanceof Vx)return this.transformPoint(t,null);if(t instanceof Xx)return this.transformMultiPoint(t,null);if(t instanceof Jx)return this.transformLinearRing(t,null);if(t instanceof jx)return this.transformLineString(t,null);if(t instanceof Nx)return this.transformMultiLineString(t,null);if(t instanceof Hx)return this.transformPolygon(t,null);if(t instanceof Wx)return this.transformMultiPolygon(t,null);if(t instanceof Lx)return this.transformGeometryCollection(t,null);throw new XI("Unknown Geometry subtype: "+t.getClass().getName())},jb.prototype.transformLinearRing=function(t,e){var n=this.transformCoordinates(t.getCoordinateSequence(),t);if(null===n)return this._factory.createLinearRing(null);var r=n.size();return r>0&&r<4&&!this._preserveType?this._factory.createLineString(n):this._factory.createLinearRing(n)},jb.prototype.interfaces_=function(){return[]},jb.prototype.getClass=function(){return jb};var zb=function t(){if(this._snapTolerance=0,this._srcPts=null,this._seg=new cw,this._allowSnappingToSourceVertices=!1,this._isClosed=!1,arguments[0]instanceof jx&&"number"==typeof arguments[1]){var e=arguments[1];t.call(this,arguments[0].getCoordinates(),e)}else if(arguments[0]instanceof Array&&"number"==typeof arguments[1]){var n=arguments[0],r=arguments[1];this._srcPts=n,this._isClosed=t.isClosed(n),this._snapTolerance=r}};zb.prototype.snapVertices=function(t,e){for(var n=this._isClosed?t.size()-1:t.size(),r=0;r<n;r++){var i=t.get(r),o=this.findSnapForVertex(i,e);null!==o&&(t.set(r,new eE(o)),0===r&&this._isClosed&&t.set(t.size()-1,new eE(o)))}},zb.prototype.findSnapForVertex=function(t,e){for(var n=0;n<e.length;n++){if(t.equals2D(e[n]))return null;if(t.distance(e[n])<this._snapTolerance)return e[n]}return null},zb.prototype.snapTo=function(t){var e=new ix(this._srcPts);return this.snapVertices(e,t),this.snapSegments(e,t),e.toCoordinateArray()},zb.prototype.snapSegments=function(t,e){if(0===e.length)return null;var n=e.length;e[0].equals2D(e[e.length-1])&&(n=e.length-1);for(var r=0;r<n;r++){var i=e[r],o=this.findSegmentIndexToSnap(i,t);o>=0&&t.add(o+1,new eE(i),!1)}},zb.prototype.findSegmentIndexToSnap=function(t,e){for(var n=this,r=JI.MAX_VALUE,i=-1,o=0;o<e.size()-1;o++){if(n._seg.p0=e.get(o),n._seg.p1=e.get(o+1),n._seg.p0.equals2D(t)||n._seg.p1.equals2D(t)){if(n._allowSnappingToSourceVertices)continue;return-1}var s=n._seg.distance(t);s<n._snapTolerance&&s<r&&(r=s,i=o)}return i},zb.prototype.setAllowSnappingToSourceVertices=function(t){this._allowSnappingToSourceVertices=t},zb.prototype.interfaces_=function(){return[]},zb.prototype.getClass=function(){return zb},zb.isClosed=function(t){return!(t.length<=1)&&t[0].equals2D(t[t.length-1])};var Vb=function(t){this._srcGeom=t||null},Yb={SNAP_PRECISION_FACTOR:{configurable:!0}};Vb.prototype.snapTo=function(t,e){var n=this.extractTargetCoordinates(t);return new Hb(e,n).transform(this._srcGeom)},Vb.prototype.snapToSelf=function(t,e){var n=this.extractTargetCoordinates(this._srcGeom),r=new Hb(t,n,!0).transform(this._srcGeom),i=r;return e&&aE(i,Yx)&&(i=r.buffer(0)),i},Vb.prototype.computeSnapTolerance=function(t){return this.computeMinimumSegmentLength(t)/10},Vb.prototype.extractTargetCoordinates=function(t){for(var e=new xx,n=t.getCoordinates(),r=0;r<n.length;r++)e.add(n[r]);return e.toArray(new Array(0).fill(null))},Vb.prototype.computeMinimumSegmentLength=function(t){for(var e=JI.MAX_VALUE,n=0;n<t.length-1;n++){var r=t[n].distance(t[n+1]);r<e&&(e=r)}return e},Vb.prototype.interfaces_=function(){return[]},Vb.prototype.getClass=function(){return Vb},Vb.snap=function(t,e,n){var r=new Array(2).fill(null),i=new Vb(t);r[0]=i.snapTo(e,n);var o=new Vb(e);return r[1]=o.snapTo(r[0],n),r},Vb.computeOverlaySnapTolerance=function(){if(1===arguments.length){var t=arguments[0],e=Vb.computeSizeBasedSnapTolerance(t),n=t.getPrecisionModel();if(n.getType()===aC.FIXED){var r=1/n.getScale()*2/1.415;r>e&&(e=r)}return e}if(2===arguments.length){var i=arguments[0],o=arguments[1];return Math.min(Vb.computeOverlaySnapTolerance(i),Vb.computeOverlaySnapTolerance(o))}},Vb.computeSizeBasedSnapTolerance=function(t){var e=t.getEnvelopeInternal();return Math.min(e.getHeight(),e.getWidth())*Vb.SNAP_PRECISION_FACTOR},Vb.snapToSelf=function(t,e,n){return new Vb(t).snapToSelf(e,n)},Yb.SNAP_PRECISION_FACTOR.get=function(){return 1e-9},Object.defineProperties(Vb,Yb);var Hb=function(t){function e(e,n,r){t.call(this),this._snapTolerance=e||null,this._snapPts=n||null,this._isSelfSnap=void 0!==r&&r}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.snapLine=function(t,e){var n=new zb(t,this._snapTolerance);return n.setAllowSnappingToSourceVertices(this._isSelfSnap),n.snapTo(e)},e.prototype.transformCoordinates=function(t,e){var n=t.toCoordinateArray(),r=this.snapLine(n,this._snapPts);return this._factory.getCoordinateSequenceFactory().create(r)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(jb),Xb=function(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=0,this._commonSignExp=null};Xb.prototype.getCommon=function(){return JI.longBitsToDouble(this._commonBits)},Xb.prototype.add=function(t){var e=JI.doubleToLongBits(t);return this._isFirst?(this._commonBits=e,this._commonSignExp=Xb.signExpBits(this._commonBits),this._isFirst=!1,null):Xb.signExpBits(e)!==this._commonSignExp?(this._commonBits=0,null):(this._commonMantissaBitsCount=Xb.numCommonMostSigMantissaBits(this._commonBits,e),void(this._commonBits=Xb.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))))},Xb.prototype.toString=function(){if(1===arguments.length){var t=arguments[0],e=JI.longBitsToDouble(t),n="0000000000000000000000000000000000000000000000000000000000000000"+JI.toBinaryString(t),r=n.substring(n.length-64);return r.substring(0,1)+" "+r.substring(1,12)+"(exp) "+r.substring(12)+" [ "+e+" ]"}},Xb.prototype.interfaces_=function(){return[]},Xb.prototype.getClass=function(){return Xb},Xb.getBit=function(t,e){return 0!=(t&1<<e)?1:0},Xb.signExpBits=function(t){return t>>52},Xb.zeroLowerBits=function(t,e){return t&~((1<<e)-1)},Xb.numCommonMostSigMantissaBits=function(t,e){for(var n=0,r=52;r>=0;r--){if(Xb.getBit(t,r)!==Xb.getBit(e,r))return n;n++}return 52};var Jb=function(){this._commonCoord=null,this._ccFilter=new Kb},Wb={CommonCoordinateFilter:{configurable:!0},Translater:{configurable:!0}};Jb.prototype.addCommonBits=function(t){var e=new Zb(this._commonCoord);t.apply(e),t.geometryChanged()},Jb.prototype.removeCommonBits=function(t){if(0===this._commonCoord.x&&0===this._commonCoord.y)return t;var e=new eE(this._commonCoord);e.x=-e.x,e.y=-e.y;var n=new Zb(e);return t.apply(n),t.geometryChanged(),t},Jb.prototype.getCommonCoordinate=function(){return this._commonCoord},Jb.prototype.add=function(t){t.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()},Jb.prototype.interfaces_=function(){return[]},Jb.prototype.getClass=function(){return Jb},Wb.CommonCoordinateFilter.get=function(){return Kb},Wb.Translater.get=function(){return Zb},Object.defineProperties(Jb,Wb);var Kb=function(){this._commonBitsX=new Xb,this._commonBitsY=new Xb};Kb.prototype.filter=function(t){this._commonBitsX.add(t.x),this._commonBitsY.add(t.y)},Kb.prototype.getCommonCoordinate=function(){return new eE(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())},Kb.prototype.interfaces_=function(){return[zE]},Kb.prototype.getClass=function(){return Kb};var Zb=function(){this.trans=null;var t=arguments[0];this.trans=t};Zb.prototype.filter=function(t,e){var n=t.getOrdinate(e,0)+this.trans.x,r=t.getOrdinate(e,1)+this.trans.y;t.setOrdinate(e,0,n),t.setOrdinate(e,1,r)},Zb.prototype.isDone=function(){return!1},Zb.prototype.isGeometryChanged=function(){return!0},Zb.prototype.interfaces_=function(){return[Mx]},Zb.prototype.getClass=function(){return Zb};var $b=function(t,e){this._geom=new Array(2).fill(null),this._snapTolerance=null,this._cbr=null,this._geom[0]=t,this._geom[1]=e,this.computeSnapTolerance()};$b.prototype.selfSnap=function(t){return new Vb(t).snapTo(t,this._snapTolerance)},$b.prototype.removeCommonBits=function(t){this._cbr=new Jb,this._cbr.add(t[0]),this._cbr.add(t[1]);var e=new Array(2).fill(null);return e[0]=this._cbr.removeCommonBits(t[0].copy()),e[1]=this._cbr.removeCommonBits(t[1].copy()),e},$b.prototype.prepareResult=function(t){return this._cbr.addCommonBits(t),t},$b.prototype.getResultGeometry=function(t){var e=this.snap(this._geom),n=IB.overlayOp(e[0],e[1],t);return this.prepareResult(n)},$b.prototype.checkValid=function(t){t.isValid()||IE.out.println("Snapped geometry is invalid")},$b.prototype.computeSnapTolerance=function(){this._snapTolerance=Vb.computeOverlaySnapTolerance(this._geom[0],this._geom[1])},$b.prototype.snap=function(t){var e=this.removeCommonBits(t);return Vb.snap(e[0],e[1],this._snapTolerance)},$b.prototype.interfaces_=function(){return[]},$b.prototype.getClass=function(){return $b},$b.overlayOp=function(t,e,n){return new $b(t,e).getResultGeometry(n)},$b.union=function(t,e){return $b.overlayOp(t,e,IB.UNION)},$b.intersection=function(t,e){return $b.overlayOp(t,e,IB.INTERSECTION)},$b.symDifference=function(t,e){return $b.overlayOp(t,e,IB.SYMDIFFERENCE)},$b.difference=function(t,e){return $b.overlayOp(t,e,IB.DIFFERENCE)};var tB=function(t,e){this._geom=new Array(2).fill(null),this._geom[0]=t,this._geom[1]=e};tB.prototype.getResultGeometry=function(t){var e=null,n=!1,r=null;try{e=IB.overlayOp(this._geom[0],this._geom[1],t);n=!0}catch(t){if(!(t instanceof LE))throw t;r=t}if(!n)try{e=$b.overlayOp(this._geom[0],this._geom[1],t)}catch(t){throw t instanceof LE?r:t}return e},tB.prototype.interfaces_=function(){return[]},tB.prototype.getClass=function(){return tB},tB.overlayOp=function(t,e,n){return new tB(t,e).getResultGeometry(n)},tB.union=function(t,e){return tB.overlayOp(t,e,IB.UNION)},tB.intersection=function(t,e){return tB.overlayOp(t,e,IB.INTERSECTION)},tB.symDifference=function(t,e){return tB.overlayOp(t,e,IB.SYMDIFFERENCE)},tB.difference=function(t,e){return tB.overlayOp(t,e,IB.DIFFERENCE)};var eB=function(){this.mce=null,this.chainIndex=null;var t=arguments[0],e=arguments[1];this.mce=t,this.chainIndex=e};eB.prototype.computeIntersections=function(t,e){this.mce.computeIntersectsForChain(this.chainIndex,t.mce,t.chainIndex,e)},eB.prototype.interfaces_=function(){return[]},eB.prototype.getClass=function(){return eB};var nB=function t(){if(this._label=null,this._xValue=null,this._eventType=null,this._insertEvent=null,this._deleteEventIndex=null,this._obj=null,2===arguments.length){var e=arguments[0],n=arguments[1];this._eventType=t.DELETE,this._xValue=e,this._insertEvent=n}else if(3===arguments.length){var r=arguments[0],i=arguments[1],o=arguments[2];this._eventType=t.INSERT,this._label=r,this._xValue=i,this._obj=o}},rB={INSERT:{configurable:!0},DELETE:{configurable:!0}};nB.prototype.isDelete=function(){return this._eventType===nB.DELETE},nB.prototype.setDeleteEventIndex=function(t){this._deleteEventIndex=t},nB.prototype.getObject=function(){return this._obj},nB.prototype.compareTo=function(t){var e=t;return this._xValue<e._xValue?-1:this._xValue>e._xValue?1:this._eventType<e._eventType?-1:this._eventType>e._eventType?1:0},nB.prototype.getInsertEvent=function(){return this._insertEvent},nB.prototype.isInsert=function(){return this._eventType===nB.INSERT},nB.prototype.isSameLabel=function(t){return null!==this._label&&this._label===t._label},nB.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex},nB.prototype.interfaces_=function(){return[KI]},nB.prototype.getClass=function(){return nB},rB.INSERT.get=function(){return 1},rB.DELETE.get=function(){return 2},Object.defineProperties(nB,rB);var iB=function(){};iB.prototype.interfaces_=function(){return[]},iB.prototype.getClass=function(){return iB};var oB=function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._properIntersectionPoint=null,this._li=null,this._includeProper=null,this._recordIsolated=null,this._isSelfIntersection=null,this._numIntersections=0,this.numTests=0,this._bdyNodes=null,this._isDone=!1,this._isDoneWhenProperInt=!1;var t=arguments[0],e=arguments[1],n=arguments[2];this._li=t,this._includeProper=e,this._recordIsolated=n};oB.prototype.isTrivialIntersection=function(t,e,n,r){if(t===n&&1===this._li.getIntersectionNum()){if(oB.isAdjacentSegments(e,r))return!0;if(t.isClosed()){var i=t.getNumPoints()-1;if(0===e&&r===i||0===r&&e===i)return!0}}return!1},oB.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},oB.prototype.setIsDoneIfProperInt=function(t){this._isDoneWhenProperInt=t},oB.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},oB.prototype.isBoundaryPointInternal=function(t,e){for(var n=e.iterator();n.hasNext();){var r=n.next().getCoordinate();if(t.isIntersection(r))return!0}return!1},oB.prototype.hasProperIntersection=function(){return this._hasProper},oB.prototype.hasIntersection=function(){return this._hasIntersection},oB.prototype.isDone=function(){return this._isDone},oB.prototype.isBoundaryPoint=function(t,e){return null!==e&&(!!this.isBoundaryPointInternal(t,e[0])||!!this.isBoundaryPointInternal(t,e[1]))},oB.prototype.setBoundaryNodes=function(t,e){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=t,this._bdyNodes[1]=e},oB.prototype.addIntersections=function(t,e,n,r){if(t===n&&e===r)return null;this.numTests++;var i=t.getCoordinates()[e],o=t.getCoordinates()[e+1],s=n.getCoordinates()[r],a=n.getCoordinates()[r+1];this._li.computeIntersection(i,o,s,a),this._li.hasIntersection()&&(this._recordIsolated&&(t.setIsolated(!1),n.setIsolated(!1)),this._numIntersections++,this.isTrivialIntersection(t,e,n,r)||(this._hasIntersection=!0,!this._includeProper&&this._li.isProper()||(t.addIntersections(this._li,e,0),n.addIntersections(this._li,r,1)),this._li.isProper()&&(this._properIntersectionPoint=this._li.getIntersection(0).copy(),this._hasProper=!0,this._isDoneWhenProperInt&&(this._isDone=!0),this.isBoundaryPoint(this._li,this._bdyNodes)||(this._hasProperInterior=!0))))},oB.prototype.interfaces_=function(){return[]},oB.prototype.getClass=function(){return oB},oB.isAdjacentSegments=function(t,e){return 1===Math.abs(t-e)};var sB=function(t){function e(){t.call(this),this.events=new nx,this.nOverlaps=null}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.prepareEvents=function(){JC.sort(this.events);for(var t=0;t<this.events.size();t++){var e=this.events.get(t);e.isDelete()&&e.getInsertEvent().setDeleteEventIndex(t)}},e.prototype.computeIntersections=function(){if(1===arguments.length){var t=arguments[0];this.nOverlaps=0,this.prepareEvents();for(var e=0;e<this.events.size();e++){var n=this.events.get(e);if(n.isInsert()&&this.processOverlaps(e,n.getDeleteEventIndex(),n,t),t.isDone())break}}else if(3===arguments.length)if(arguments[2]instanceof oB&&aE(arguments[0],tx)&&aE(arguments[1],tx)){var r=arguments[0],i=arguments[1],o=arguments[2];this.addEdges(r,r),this.addEdges(i,i),this.computeIntersections(o)}else if("boolean"==typeof arguments[2]&&aE(arguments[0],tx)&&arguments[1]instanceof oB){var s=arguments[0],a=arguments[1];arguments[2]?this.addEdges(s,null):this.addEdges(s),this.computeIntersections(a)}},e.prototype.addEdge=function(t,e){for(var n=t.getMonotoneChainEdge(),r=n.getStartIndexes(),i=0;i<r.length-1;i++){var o=new eB(n,i),s=new nB(e,n.getMinX(i),o);this.events.add(s),this.events.add(new nB(n.getMaxX(i),s))}},e.prototype.processOverlaps=function(t,e,n,r){for(var i=n.getObject(),o=t;o<e;o++){var s=this.events.get(o);if(s.isInsert()){var a=s.getObject();n.isSameLabel(s)||(i.computeIntersections(a,r),this.nOverlaps++)}}},e.prototype.addEdges=function(){if(1===arguments.length)for(var t=arguments[0].iterator();t.hasNext();){var e=t.next();this.addEdge(e,e)}else if(2===arguments.length)for(var n=arguments[1],r=arguments[0].iterator();r.hasNext();){var i=r.next();this.addEdge(i,n)}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(iB),aB=function(){this._min=JI.POSITIVE_INFINITY,this._max=JI.NEGATIVE_INFINITY},uB={NodeComparator:{configurable:!0}};aB.prototype.getMin=function(){return this._min},aB.prototype.intersects=function(t,e){return!(this._min>e||this._max<t)},aB.prototype.getMax=function(){return this._max},aB.prototype.toString=function(){return ME.toLineString(new eE(this._min,0),new eE(this._max,0))},aB.prototype.interfaces_=function(){return[]},aB.prototype.getClass=function(){return aB},uB.NodeComparator.get=function(){return lB},Object.defineProperties(aB,uB);var lB=function(){};lB.prototype.compare=function(t,e){var n=t,r=e,i=(n._min+n._max)/2,o=(r._min+r._max)/2;return i<o?-1:i>o?1:0},lB.prototype.interfaces_=function(){return[$I]},lB.prototype.getClass=function(){return lB};var cB=function(t){function e(){t.call(this),this._item=null;var e=arguments[0],n=arguments[1],r=arguments[2];this._min=e,this._max=n,this._item=r}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.query=function(t,e,n){if(!this.intersects(t,e))return null;n.visitItem(this._item)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(aB),hB=function(t){function e(){t.call(this),this._node1=null,this._node2=null;var e=arguments[0],n=arguments[1];this._node1=e,this._node2=n,this.buildExtent(this._node1,this._node2)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.buildExtent=function(t,e){this._min=Math.min(t._min,e._min),this._max=Math.max(t._max,e._max)},e.prototype.query=function(t,e,n){if(!this.intersects(t,e))return null;null!==this._node1&&this._node1.query(t,e,n),null!==this._node2&&this._node2.query(t,e,n)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(aB),fB=function(){this._leaves=new nx,this._root=null,this._level=0};fB.prototype.buildTree=function(){JC.sort(this._leaves,new aB.NodeComparator);for(var t=this._leaves,e=null,n=new nx;;){if(this.buildLevel(t,n),1===n.size())return n.get(0);e=t,t=n,n=e}},fB.prototype.insert=function(t,e,n){if(null!==this._root)throw new Error("Index cannot be added to once it has been queried");this._leaves.add(new cB(t,e,n))},fB.prototype.query=function(t,e,n){this.init(),this._root.query(t,e,n)},fB.prototype.buildRoot=function(){if(null!==this._root)return null;this._root=this.buildTree()},fB.prototype.printNode=function(t){IE.out.println(ME.toLineString(new eE(t._min,this._level),new eE(t._max,this._level)))},fB.prototype.init=function(){if(null!==this._root)return null;this.buildRoot()},fB.prototype.buildLevel=function(t,e){this._level++,e.clear();for(var n=0;n<t.size();n+=2){var r=t.get(n);if(null===(n+1<t.size()?t.get(n):null))e.add(r);else{var i=new hB(t.get(n),t.get(n+1));e.add(i)}}},fB.prototype.interfaces_=function(){return[]},fB.prototype.getClass=function(){return fB};var pB=function(){this._items=new nx};pB.prototype.visitItem=function(t){this._items.add(t)},pB.prototype.getItems=function(){return this._items},pB.prototype.interfaces_=function(){return[VC]},pB.prototype.getClass=function(){return pB};var gB=function(){this._index=null;var t=arguments[0];if(!aE(t,Yx))throw new XI("Argument must be Polygonal");this._index=new yB(t)},AB={SegmentVisitor:{configurable:!0},IntervalIndexedGeometry:{configurable:!0}};gB.prototype.locate=function(t){var e=new kE(t),n=new dB(e);return this._index.query(t.y,t.y,n),e.getLocation()},gB.prototype.interfaces_=function(){return[Dw]},gB.prototype.getClass=function(){return gB},AB.SegmentVisitor.get=function(){return dB},AB.IntervalIndexedGeometry.get=function(){return yB},Object.defineProperties(gB,AB);var dB=function(){this._counter=null;var t=arguments[0];this._counter=t};dB.prototype.visitItem=function(t){var e=t;this._counter.countSegment(e.getCoordinate(0),e.getCoordinate(1))},dB.prototype.interfaces_=function(){return[VC]},dB.prototype.getClass=function(){return dB};var yB=function(){this._index=new fB;var t=arguments[0];this.init(t)};yB.prototype.init=function(t){for(var e=mb.getLines(t).iterator();e.hasNext();){var n=e.next().getCoordinates();this.addLine(n)}},yB.prototype.addLine=function(t){for(var e=1;e<t.length;e++){var n=new cw(t[e-1],t[e]),r=Math.min(n.p0.y,n.p1.y),i=Math.max(n.p0.y,n.p1.y);this._index.insert(r,i,n)}},yB.prototype.query=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1],n=new pB;return this._index.query(t,e,n),n.getItems()}if(3===arguments.length){var r=arguments[0],i=arguments[1],o=arguments[2];this._index.query(r,i,o)}},yB.prototype.interfaces_=function(){return[]},yB.prototype.getClass=function(){return yB};var vB=function(t){function e(){if(t.call(this),this._parentGeom=null,this._lineEdgeMap=new sC,this._boundaryNodeRule=null,this._useBoundaryDeterminationRule=!0,this._argIndex=null,this._boundaryNodes=null,this._hasTooFewPoints=!1,this._invalidPoint=null,this._areaPtLocator=null,this._ptLocator=new _b,2===arguments.length){var e=arguments[0],n=arguments[1],r=VE.OGC_SFS_BOUNDARY_RULE;this._argIndex=e,this._parentGeom=n,this._boundaryNodeRule=r,null!==n&&this.add(n)}else if(3===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2];this._argIndex=i,this._parentGeom=o,this._boundaryNodeRule=s,null!==o&&this.add(o)}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.insertBoundaryPoint=function(t,n){var r=this._nodes.addNode(n).getLabel(),i=1;r.getLocation(t,mC.ON)===oE.BOUNDARY&&i++;var o=e.determineBoundary(this._boundaryNodeRule,i);r.setLocation(t,o)},e.prototype.computeSelfNodes=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];return this.computeSelfNodes(t,e,!1)}if(3===arguments.length){var n=arguments[1],r=arguments[2],i=new oB(arguments[0],!0,!1);i.setIsDoneIfProperInt(r);var o=this.createEdgeSetIntersector(),s=this._parentGeom instanceof Jx||this._parentGeom instanceof Hx||this._parentGeom instanceof Wx,a=n||!s;return o.computeIntersections(this._edges,i,a),this.addSelfIntersectionNodes(this._argIndex),i}},e.prototype.computeSplitEdges=function(t){for(var e=this._edges.iterator();e.hasNext();){e.next().eiList.addSplitEdges(t)}},e.prototype.computeEdgeIntersections=function(t,e,n){var r=new oB(e,n,!0);return r.setBoundaryNodes(this.getBoundaryNodes(),t.getBoundaryNodes()),this.createEdgeSetIntersector().computeIntersections(this._edges,t._edges,r),r},e.prototype.getGeometry=function(){return this._parentGeom},e.prototype.getBoundaryNodeRule=function(){return this._boundaryNodeRule},e.prototype.hasTooFewPoints=function(){return this._hasTooFewPoints},e.prototype.addPoint=function(){if(arguments[0]instanceof Vx){var t=arguments[0].getCoordinate();this.insertPoint(this._argIndex,t,oE.INTERIOR)}else if(arguments[0]instanceof eE){var e=arguments[0];this.insertPoint(this._argIndex,e,oE.INTERIOR)}},e.prototype.addPolygon=function(t){this.addPolygonRing(t.getExteriorRing(),oE.EXTERIOR,oE.INTERIOR);for(var e=0;e<t.getNumInteriorRing();e++){var n=t.getInteriorRingN(e);this.addPolygonRing(n,oE.INTERIOR,oE.EXTERIOR)}},e.prototype.addEdge=function(t){this.insertEdge(t);var e=t.getCoordinates();this.insertPoint(this._argIndex,e[0],oE.BOUNDARY),this.insertPoint(this._argIndex,e[e.length-1],oE.BOUNDARY)},e.prototype.addLineString=function(t){var e=ox.removeRepeatedPoints(t.getCoordinates());if(e.length<2)return this._hasTooFewPoints=!0,this._invalidPoint=e[0],null;var n=new Kw(e,new SC(this._argIndex,oE.INTERIOR));this._lineEdgeMap.put(t,n),this.insertEdge(n),TE.isTrue(e.length>=2,"found LineString with single point"),this.insertBoundaryPoint(this._argIndex,e[0]),this.insertBoundaryPoint(this._argIndex,e[e.length-1])},e.prototype.getInvalidPoint=function(){return this._invalidPoint},e.prototype.getBoundaryPoints=function(){for(var t=this.getBoundaryNodes(),e=new Array(t.size()).fill(null),n=0,r=t.iterator();r.hasNext();){var i=r.next();e[n++]=i.getCoordinate().copy()}return e},e.prototype.getBoundaryNodes=function(){return null===this._boundaryNodes&&(this._boundaryNodes=this._nodes.getBoundaryNodes(this._argIndex)),this._boundaryNodes},e.prototype.addSelfIntersectionNode=function(t,e,n){if(this.isBoundaryNode(t,e))return null;n===oE.BOUNDARY&&this._useBoundaryDeterminationRule?this.insertBoundaryPoint(t,e):this.insertPoint(t,e,n)},e.prototype.addPolygonRing=function(t,e,n){if(t.isEmpty())return null;var r=ox.removeRepeatedPoints(t.getCoordinates());if(r.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=r[0],null;var i=e,o=n;OE.isCCW(r)&&(i=n,o=e);var s=new Kw(r,new SC(this._argIndex,oE.BOUNDARY,i,o));this._lineEdgeMap.put(t,s),this.insertEdge(s),this.insertPoint(this._argIndex,r[0],oE.BOUNDARY)},e.prototype.insertPoint=function(t,e,n){var r=this._nodes.addNode(e),i=r.getLabel();null===i?r._label=new SC(t,n):i.setLocation(t,n)},e.prototype.createEdgeSetIntersector=function(){return new sB},e.prototype.addSelfIntersectionNodes=function(t){for(var e=this._edges.iterator();e.hasNext();)for(var n=e.next(),r=n.getLabel().getLocation(t),i=n.eiList.iterator();i.hasNext();){var o=i.next();this.addSelfIntersectionNode(t,o.coord,r)}},e.prototype.add=function(){if(1!==arguments.length)return t.prototype.add.apply(this,arguments);var e=arguments[0];if(e.isEmpty())return null;if(e instanceof Wx&&(this._useBoundaryDeterminationRule=!1),e instanceof Hx)this.addPolygon(e);else if(e instanceof jx)this.addLineString(e);else if(e instanceof Vx)this.addPoint(e);else if(e instanceof Xx)this.addCollection(e);else if(e instanceof Nx)this.addCollection(e);else if(e instanceof Wx)this.addCollection(e);else{if(!(e instanceof Lx))throw new Error(e.getClass().getName());this.addCollection(e)}},e.prototype.addCollection=function(t){for(var e=0;e<t.getNumGeometries();e++){var n=t.getGeometryN(e);this.add(n)}},e.prototype.locate=function(t){return aE(this._parentGeom,Yx)&&this._parentGeom.getNumGeometries()>50?(null===this._areaPtLocator&&(this._areaPtLocator=new gB(this._parentGeom)),this._areaPtLocator.locate(t)):this._ptLocator.locate(t,this._parentGeom)},e.prototype.findEdge=function(){if(1===arguments.length){var e=arguments[0];return this._lineEdgeMap.get(e)}return t.prototype.findEdge.apply(this,arguments)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.determineBoundary=function(t,e){return t.isInBoundary(e)?oE.BOUNDARY:oE.INTERIOR},e}(GC),mB=function(){if(this._li=new DE,this._resultPrecisionModel=null,this._arg=null,1===arguments.length){var t=arguments[0];this.setComputationPrecision(t.getPrecisionModel()),this._arg=new Array(1).fill(null),this._arg[0]=new vB(0,t)}else if(2===arguments.length){var e=arguments[0],n=arguments[1],r=VE.OGC_SFS_BOUNDARY_RULE;e.getPrecisionModel().compareTo(n.getPrecisionModel())>=0?this.setComputationPrecision(e.getPrecisionModel()):this.setComputationPrecision(n.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new vB(0,e,r),this._arg[1]=new vB(1,n,r)}else if(3===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2];i.getPrecisionModel().compareTo(o.getPrecisionModel())>=0?this.setComputationPrecision(i.getPrecisionModel()):this.setComputationPrecision(o.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new vB(0,i,s),this._arg[1]=new vB(1,o,s)}};mB.prototype.getArgGeometry=function(t){return this._arg[t].getGeometry()},mB.prototype.setComputationPrecision=function(t){this._resultPrecisionModel=t,this._li.setPrecisionModel(this._resultPrecisionModel)},mB.prototype.interfaces_=function(){return[]},mB.prototype.getClass=function(){return mB};var _B=function(){};_B.prototype.interfaces_=function(){return[]},_B.prototype.getClass=function(){return _B},_B.map=function(){if(arguments[0]instanceof UE&&aE(arguments[1],_B.MapOp)){for(var t=arguments[0],e=arguments[1],n=new nx,r=0;r<t.getNumGeometries();r++){var i=e.map(t.getGeometryN(r));null!==i&&n.add(i)}return t.getFactory().buildGeometry(n)}if(aE(arguments[0],KE)&&aE(arguments[1],_B.MapOp)){for(var o=arguments[0],s=arguments[1],a=new nx,u=o.iterator();u.hasNext();){var l=u.next(),c=s.map(l);null!==c&&a.add(c)}return a}},_B.MapOp=function(){};var IB=function(t){function e(){var e=arguments[0],n=arguments[1];t.call(this,e,n),this._ptLocator=new _b,this._geomFact=null,this._resultGeom=null,this._graph=null,this._edgeList=new qw,this._resultPolyList=new nx,this._resultLineList=new nx,this._resultPointList=new nx,this._graph=new GC(new Gw),this._geomFact=e.getFactory()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.insertUniqueEdge=function(t){var e=this._edgeList.findEqualEdge(t);if(null!==e){var n=e.getLabel(),r=t.getLabel();e.isPointwiseEqual(t)||(r=new SC(t.getLabel())).flip();var i=e.getDepth();i.isNull()&&i.add(n),i.add(r),n.merge(r)}else this._edgeList.add(t)},e.prototype.getGraph=function(){return this._graph},e.prototype.cancelDuplicateResultEdges=function(){for(var t=this._graph.getEdgeEnds().iterator();t.hasNext();){var e=t.next(),n=e.getSym();e.isInResult()&&n.isInResult()&&(e.setInResult(!1),n.setInResult(!1))}},e.prototype.isCoveredByLA=function(t){return!!this.isCovered(t,this._resultLineList)||!!this.isCovered(t,this._resultPolyList)},e.prototype.computeGeometry=function(t,n,r,i){var o=new nx;return o.addAll(t),o.addAll(n),o.addAll(r),o.isEmpty()?e.createEmptyResult(i,this._arg[0].getGeometry(),this._arg[1].getGeometry(),this._geomFact):this._geomFact.buildGeometry(o)},e.prototype.mergeSymLabels=function(){for(var t=this._graph.getNodes().iterator();t.hasNext();){t.next().getEdges().mergeSymLabels()}},e.prototype.isCovered=function(t,e){for(var n=e.iterator();n.hasNext();){var r=n.next();if(this._ptLocator.locate(t,r)!==oE.EXTERIOR)return!0}return!1},e.prototype.replaceCollapsedEdges=function(){for(var t=new nx,e=this._edgeList.iterator();e.hasNext();){var n=e.next();n.isCollapsed()&&(e.remove(),t.add(n.getCollapsedEdge()))}this._edgeList.addAll(t)},e.prototype.updateNodeLabelling=function(){for(var t=this._graph.getNodes().iterator();t.hasNext();){var e=t.next(),n=e.getEdges().getLabel();e.getLabel().merge(n)}},e.prototype.getResultGeometry=function(t){return this.computeOverlay(t),this._resultGeom},e.prototype.insertUniqueEdges=function(t){for(var e=t.iterator();e.hasNext();){var n=e.next();this.insertUniqueEdge(n)}},e.prototype.computeOverlay=function(t){this.copyPoints(0),this.copyPoints(1),this._arg[0].computeSelfNodes(this._li,!1),this._arg[1].computeSelfNodes(this._li,!1),this._arg[0].computeEdgeIntersections(this._arg[1],this._li,!0);var e=new nx;this._arg[0].computeSplitEdges(e),this._arg[1].computeSplitEdges(e),this.insertUniqueEdges(e),this.computeLabelsFromDepths(),this.replaceCollapsedEdges(),Fb.checkValid(this._edgeList.getEdges()),this._graph.addEdges(this._edgeList.getEdges()),this.computeLabelling(),this.labelIncompleteNodes(),this.findResultAreaEdges(t),this.cancelDuplicateResultEdges();var n=new UC(this._geomFact);n.add(this._graph),this._resultPolyList=n.getPolygons();var r=new Ub(this,this._geomFact,this._ptLocator);this._resultLineList=r.build(t);var i=new qb(this,this._geomFact,this._ptLocator);this._resultPointList=i.build(t),this._resultGeom=this.computeGeometry(this._resultPointList,this._resultLineList,this._resultPolyList,t)},e.prototype.labelIncompleteNode=function(t,e){var n=this._ptLocator.locate(t.getCoordinate(),this._arg[e].getGeometry());t.getLabel().setLocation(e,n)},e.prototype.copyPoints=function(t){for(var e=this._arg[t].getNodeIterator();e.hasNext();){var n=e.next();this._graph.addNode(n.getCoordinate()).setLabel(t,n.getLabel().getLocation(t))}},e.prototype.findResultAreaEdges=function(t){for(var n=this._graph.getEdgeEnds().iterator();n.hasNext();){var r=n.next(),i=r.getLabel();i.isArea()&&!r.isInteriorAreaEdge()&&e.isResultOfOp(i.getLocation(0,mC.RIGHT),i.getLocation(1,mC.RIGHT),t)&&r.setInResult(!0)}},e.prototype.computeLabelsFromDepths=function(){for(var t=this._edgeList.iterator();t.hasNext();){var e=t.next(),n=e.getLabel(),r=e.getDepth();if(!r.isNull()){r.normalize();for(var i=0;i<2;i++)n.isNull(i)||!n.isArea()||r.isNull(i)||(0===r.getDelta(i)?n.toLine(i):(TE.isTrue(!r.isNull(i,mC.LEFT),"depth of LEFT side has not been initialized"),n.setLocation(i,mC.LEFT,r.getLocation(i,mC.LEFT)),TE.isTrue(!r.isNull(i,mC.RIGHT),"depth of RIGHT side has not been initialized"),n.setLocation(i,mC.RIGHT,r.getLocation(i,mC.RIGHT))))}}},e.prototype.computeLabelling=function(){for(var t=this._graph.getNodes().iterator();t.hasNext();){t.next().getEdges().computeLabelling(this._arg)}this.mergeSymLabels(),this.updateNodeLabelling()},e.prototype.labelIncompleteNodes=function(){for(var t=this._graph.getNodes().iterator();t.hasNext();){var e=t.next(),n=e.getLabel();e.isIsolated()&&(n.isNull(0)?this.labelIncompleteNode(e,0):this.labelIncompleteNode(e,1)),e.getEdges().updateLabelling(n)}},e.prototype.isCoveredByA=function(t){return!!this.isCovered(t,this._resultPolyList)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(mB);IB.overlayOp=function(t,e,n){return new IB(t,e).getResultGeometry(n)},IB.intersection=function(t,e){if(t.isEmpty()||e.isEmpty())return IB.createEmptyResult(IB.INTERSECTION,t,e,t.getFactory());if(t.isGeometryCollection()){var n=e;return Gb.map(t,{interfaces_:function(){return[_B.MapOp]},map:function(t){return t.intersection(n)}})}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),tB.overlayOp(t,e,IB.INTERSECTION)},IB.symDifference=function(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return IB.createEmptyResult(IB.SYMDIFFERENCE,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),tB.overlayOp(t,e,IB.SYMDIFFERENCE)},IB.resultDimension=function(t,e,n){var r=e.getDimension(),i=n.getDimension(),o=-1;switch(t){case IB.INTERSECTION:o=Math.min(r,i);break;case IB.UNION:o=Math.max(r,i);break;case IB.DIFFERENCE:o=r;break;case IB.SYMDIFFERENCE:o=Math.max(r,i)}return o},IB.createEmptyResult=function(t,e,n,r){var i=null;switch(IB.resultDimension(t,e,n)){case-1:i=r.createGeometryCollection(new Array(0).fill(null));break;case 0:i=r.createPoint();break;case 1:i=r.createLineString();break;case 2:i=r.createPolygon()}return i},IB.difference=function(t,e){return t.isEmpty()?IB.createEmptyResult(IB.DIFFERENCE,t,e,t.getFactory()):e.isEmpty()?t.copy():(t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),tB.overlayOp(t,e,IB.DIFFERENCE))},IB.isResultOfOp=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1],n=t.getLocation(0),r=t.getLocation(1);return IB.isResultOfOp(n,r,e)}if(3===arguments.length){var i=arguments[0],o=arguments[1];switch(i===oE.BOUNDARY&&(i=oE.INTERIOR),o===oE.BOUNDARY&&(o=oE.INTERIOR),arguments[2]){case IB.INTERSECTION:return i===oE.INTERIOR&&o===oE.INTERIOR;case IB.UNION:return i===oE.INTERIOR||o===oE.INTERIOR;case IB.DIFFERENCE:return i===oE.INTERIOR&&o!==oE.INTERIOR;case IB.SYMDIFFERENCE:return i===oE.INTERIOR&&o!==oE.INTERIOR||i!==oE.INTERIOR&&o===oE.INTERIOR}return!1}},IB.INTERSECTION=1,IB.UNION=2,IB.DIFFERENCE=3,IB.SYMDIFFERENCE=4;var EB=function(){this._g=null,this._boundaryDistanceTolerance=null,this._linework=null,this._ptLocator=new _b,this._seg=new cw;var t=arguments[0],e=arguments[1];this._g=t,this._boundaryDistanceTolerance=e,this._linework=this.extractLinework(t)};EB.prototype.isWithinToleranceOfBoundary=function(t){for(var e=this,n=0;n<this._linework.getNumGeometries();n++)for(var r=e._linework.getGeometryN(n).getCoordinateSequence(),i=0;i<r.size()-1;i++){if(r.getCoordinate(i,e._seg.p0),r.getCoordinate(i+1,e._seg.p1),e._seg.distance(t)<=e._boundaryDistanceTolerance)return!0}return!1},EB.prototype.getLocation=function(t){return this.isWithinToleranceOfBoundary(t)?oE.BOUNDARY:this._ptLocator.locate(t,this._g)},EB.prototype.extractLinework=function(t){var e=new xB;t.apply(e);var n=e.getLinework(),r=hC.toLineStringArray(n);return t.getFactory().createMultiLineString(r)},EB.prototype.interfaces_=function(){return[]},EB.prototype.getClass=function(){return EB};var xB=function(){this._linework=null,this._linework=new nx};xB.prototype.getLinework=function(){return this._linework},xB.prototype.filter=function(t){if(t instanceof Hx){var e=t;this._linework.add(e.getExteriorRing());for(var n=0;n<e.getNumInteriorRing();n++)this._linework.add(e.getInteriorRingN(n))}},xB.prototype.interfaces_=function(){return[Sx]},xB.prototype.getClass=function(){return xB};var CB=function(){this._g=null,this._doLeft=!0,this._doRight=!0;var t=arguments[0];this._g=t};CB.prototype.extractPoints=function(t,e,n){for(var r=t.getCoordinates(),i=0;i<r.length-1;i++)this.computeOffsetPoints(r[i],r[i+1],e,n)},CB.prototype.setSidesToGenerate=function(t,e){this._doLeft=t,this._doRight=e},CB.prototype.getPoints=function(t){for(var e=new nx,n=mb.getLines(this._g).iterator();n.hasNext();){var r=n.next();this.extractPoints(r,t,e)}return e},CB.prototype.computeOffsetPoints=function(t,e,n,r){var i=e.x-t.x,o=e.y-t.y,s=Math.sqrt(i*i+o*o),a=n*i/s,u=n*o/s,l=(e.x+t.x)/2,c=(e.y+t.y)/2;if(this._doLeft){var h=new eE(l-u,c+a);r.add(h)}if(this._doRight){var f=new eE(l+u,c-a);r.add(f)}},CB.prototype.interfaces_=function(){return[]},CB.prototype.getClass=function(){return CB};var wB=function t(){this._geom=null,this._locFinder=null,this._location=new Array(3).fill(null),this._invalidLocation=null,this._boundaryDistanceTolerance=t.TOLERANCE,this._testCoords=new nx;var e=arguments[0],n=arguments[1],r=arguments[2];this._boundaryDistanceTolerance=t.computeBoundaryDistanceTolerance(e,n),this._geom=[e,n,r],this._locFinder=[new EB(this._geom[0],this._boundaryDistanceTolerance),new EB(this._geom[1],this._boundaryDistanceTolerance),new EB(this._geom[2],this._boundaryDistanceTolerance)]},bB={TOLERANCE:{configurable:!0}};wB.prototype.reportResult=function(t,e,n){IE.out.println("Overlay result invalid - A:"+oE.toLocationSymbol(e[0])+" B:"+oE.toLocationSymbol(e[1])+" expected:"+(n?"i":"e")+" actual:"+oE.toLocationSymbol(e[2]))},wB.prototype.isValid=function(t){this.addTestPts(this._geom[0]),this.addTestPts(this._geom[1]);var e=this.checkValid(t);return e},wB.prototype.checkValid=function(){var t=this;if(1===arguments.length){for(var e=arguments[0],n=0;n<this._testCoords.size();n++){var r=t._testCoords.get(n);if(!t.checkValid(e,r))return t._invalidLocation=r,!1}return!0}if(2===arguments.length){var i=arguments[0],o=arguments[1];return this._location[0]=this._locFinder[0].getLocation(o),this._location[1]=this._locFinder[1].getLocation(o),this._location[2]=this._locFinder[2].getLocation(o),!!wB.hasLocation(this._location,oE.BOUNDARY)||this.isValidResult(i,this._location)}},wB.prototype.addTestPts=function(t){var e=new CB(t);this._testCoords.addAll(e.getPoints(5*this._boundaryDistanceTolerance))},wB.prototype.isValidResult=function(t,e){var n=IB.isResultOfOp(e[0],e[1],t),r=!(n^e[2]===oE.INTERIOR);return r||this.reportResult(t,e,n),r},wB.prototype.getInvalidLocation=function(){return this._invalidLocation},wB.prototype.interfaces_=function(){return[]},wB.prototype.getClass=function(){return wB},wB.hasLocation=function(t,e){for(var n=0;n<3;n++)if(t[n]===e)return!0;return!1},wB.computeBoundaryDistanceTolerance=function(t,e){return Math.min(Vb.computeSizeBasedSnapTolerance(t),Vb.computeSizeBasedSnapTolerance(e))},wB.isValid=function(t,e,n,r){return new wB(t,e,r).isValid(n)},bB.TOLERANCE.get=function(){return 1e-6},Object.defineProperties(wB,bB);var BB=function t(e){this._geomFactory=null,this._skipEmpty=!1,this._inputGeoms=null,this._geomFactory=t.extractFactory(e),this._inputGeoms=e};BB.prototype.extractElements=function(t,e){if(null===t)return null;for(var n=0;n<t.getNumGeometries();n++){var r=t.getGeometryN(n);this._skipEmpty&&r.isEmpty()||e.add(r)}},BB.prototype.combine=function(){for(var t=new nx,e=this._inputGeoms.iterator();e.hasNext();){var n=e.next();this.extractElements(n,t)}return 0===t.size()?null!==this._geomFactory?this._geomFactory.createGeometryCollection(null):null:this._geomFactory.buildGeometry(t)},BB.prototype.interfaces_=function(){return[]},BB.prototype.getClass=function(){return BB},BB.combine=function(){return 1===arguments.length?new BB(arguments[0]).combine():2===arguments.length?new BB(BB.createList(arguments[0],arguments[1])).combine():3===arguments.length?new BB(BB.createList(arguments[0],arguments[1],arguments[2])).combine():void 0},BB.extractFactory=function(t){return t.isEmpty()?null:t.iterator().next().getFactory()},BB.createList=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1],n=new nx;return n.add(t),n.add(e),n}if(3===arguments.length){var r=arguments[0],i=arguments[1],o=arguments[2],s=new nx;return s.add(r),s.add(i),s.add(o),s}};var SB=function(){this._inputPolys=null,this._geomFactory=null;var t=arguments[0];this._inputPolys=t,null===this._inputPolys&&(this._inputPolys=new nx)},MB={STRTREE_NODE_CAPACITY:{configurable:!0}};SB.prototype.reduceToGeometries=function(t){for(var e=new nx,n=t.iterator();n.hasNext();){var r=n.next(),i=null;aE(r,tx)?i=this.unionTree(r):r instanceof UE&&(i=r),e.add(i)}return e},SB.prototype.extractByEnvelope=function(t,e,n){for(var r=new nx,i=0;i<e.getNumGeometries();i++){var o=e.getGeometryN(i);o.getEnvelopeInternal().intersects(t)?r.add(o):n.add(o)}return this._geomFactory.buildGeometry(r)},SB.prototype.unionOptimized=function(t,e){var n=t.getEnvelopeInternal(),r=e.getEnvelopeInternal();if(!n.intersects(r))return BB.combine(t,e);if(t.getNumGeometries()<=1&&e.getNumGeometries()<=1)return this.unionActual(t,e);var i=n.intersection(r);return this.unionUsingEnvelopeIntersection(t,e,i)},SB.prototype.union=function(){if(null===this._inputPolys)throw new Error("union() method cannot be called twice");if(this._inputPolys.isEmpty())return null;this._geomFactory=this._inputPolys.iterator().next().getFactory();for(var t=new ew(SB.STRTREE_NODE_CAPACITY),e=this._inputPolys.iterator();e.hasNext();){var n=e.next();t.insert(n.getEnvelopeInternal(),n)}this._inputPolys=null;var r=t.itemsTree();return this.unionTree(r)},SB.prototype.binaryUnion=function(){if(1===arguments.length){var t=arguments[0];return this.binaryUnion(t,0,t.size())}if(3===arguments.length){var e=arguments[0],n=arguments[1],r=arguments[2];if(r-n<=1){var i=SB.getGeometry(e,n);return this.unionSafe(i,null)}if(r-n==2)return this.unionSafe(SB.getGeometry(e,n),SB.getGeometry(e,n+1));var o=Math.trunc((r+n)/2),s=this.binaryUnion(e,n,o),a=this.binaryUnion(e,o,r);return this.unionSafe(s,a)}},SB.prototype.repeatedUnion=function(t){for(var e=null,n=t.iterator();n.hasNext();){var r=n.next();e=null===e?r.copy():e.union(r)}return e},SB.prototype.unionSafe=function(t,e){return null===t&&null===e?null:null===t?e.copy():null===e?t.copy():this.unionOptimized(t,e)},SB.prototype.unionActual=function(t,e){return SB.restrictToPolygons(t.union(e))},SB.prototype.unionTree=function(t){var e=this.reduceToGeometries(t);return this.binaryUnion(e)},SB.prototype.unionUsingEnvelopeIntersection=function(t,e,n){var r=new nx,i=this.extractByEnvelope(n,t,r),o=this.extractByEnvelope(n,e,r),s=this.unionActual(i,o);return r.add(s),BB.combine(r)},SB.prototype.bufferUnion=function(){if(1===arguments.length){var t=arguments[0];return t.get(0).getFactory().buildGeometry(t).buffer(0)}if(2===arguments.length){var e=arguments[0],n=arguments[1];return e.getFactory().createGeometryCollection([e,n]).buffer(0)}},SB.prototype.interfaces_=function(){return[]},SB.prototype.getClass=function(){return SB},SB.restrictToPolygons=function(t){if(aE(t,Yx))return t;var e=vb.getPolygons(t);return 1===e.size()?e.get(0):t.getFactory().createMultiPolygon(hC.toPolygonArray(e))},SB.getGeometry=function(t,e){return e>=t.size()?null:t.get(e)},SB.union=function(t){return new SB(t).union()},MB.STRTREE_NODE_CAPACITY.get=function(){return 4},Object.defineProperties(SB,MB);var LB=function(){};function NB(){return new TB}function TB(){this.reset()}LB.prototype.interfaces_=function(){return[]},LB.prototype.getClass=function(){return LB},LB.union=function(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return IB.createEmptyResult(IB.UNION,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),tB.overlayOp(t,e,IB.UNION)},TB.prototype={constructor:TB,reset:function(){this.s=this.t=0},add:function(t){QB(RB,t,this.t),QB(this,RB.s,this.s),this.s?this.t+=RB.t:this.s=RB.t},valueOf:function(){return this.s}};var RB=new TB;function QB(t,e,n){var r=t.s=e+n,i=r-e,o=r-i;t.t=e-o+(n-i)}var DB=1e-6,PB=Math.PI,kB=PB/2,OB=PB/4,FB=2*PB,GB=180/PB,UB=PB/180,qB=Math.abs,jB=Math.atan,zB=Math.atan2,VB=Math.cos,YB=Math.sin,HB=Math.sqrt;function XB(t){return t>1?0:t<-1?PB:Math.acos(t)}function JB(t){return t>1?kB:t<-1?-kB:Math.asin(t)}function WB(){}function KB(t,e){t&&eS.hasOwnProperty(t.type)&&eS[t.type](t,e)}var ZB,$B,tS={Feature:function(t,e){KB(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,i=n.length;++r<i;)KB(n[r].geometry,e)}},eS={Sphere:function(t,e){e.sphere()},Point:function(t,e){t=t.coordinates,e.point(t[0],t[1],t[2])},MultiPoint:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)t=n[r],e.point(t[0],t[1],t[2])},LineString:function(t,e){nS(t.coordinates,e,0)},MultiLineString:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)nS(n[r],e,0)},Polygon:function(t,e){rS(t.coordinates,e)},MultiPolygon:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)rS(n[r],e)},GeometryCollection:function(t,e){for(var n=t.geometries,r=-1,i=n.length;++r<i;)KB(n[r],e)}};function nS(t,e,n){var r,i=-1,o=t.length-n;for(e.lineStart();++i<o;)r=t[i],e.point(r[0],r[1],r[2]);e.lineEnd()}function rS(t,e){var n=-1,r=t.length;for(e.polygonStart();++n<r;)nS(t[n],e,1);e.polygonEnd()}function iS(t){return[zB(t[1],t[0]),JB(t[2])]}function oS(t){var e=t[0],n=t[1],r=VB(n);return[r*VB(e),r*YB(e),YB(n)]}function sS(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function aS(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function uS(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function lS(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function cS(t){var e=HB(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}function hS(t,e){function n(n,r){return n=t(n,r),e(n[0],n[1])}return t.invert&&e.invert&&(n.invert=function(n,r){return(n=e.invert(n,r))&&t.invert(n[0],n[1])}),n}function fS(t,e){return[t>PB?t-FB:t<-PB?t+FB:t,e]}function pS(t){return function(e,n){return[(e+=t)>PB?e-FB:e<-PB?e+FB:e,n]}}function gS(t){var e=pS(t);return e.invert=pS(-t),e}function AS(t,e){var n=VB(t),r=YB(t),i=VB(e),o=YB(e);function s(t,e){var s=VB(e),a=VB(t)*s,u=YB(t)*s,l=YB(e),c=l*n+a*r;return[zB(u*i-c*o,a*n-l*r),JB(c*i+u*o)]}return s.invert=function(t,e){var s=VB(e),a=VB(t)*s,u=YB(t)*s,l=YB(e),c=l*i-u*o;return[zB(u*i+l*o,a*n+c*r),JB(c*n-a*r)]},s}function dS(t,e){(e=oS(e))[0]-=t,cS(e);var n=XB(-e[1]);return((-e[2]<0?-n:n)+FB-DB)%FB}function yS(){var t,e=[];return{point:function(e,n){t.push([e,n])},lineStart:function(){e.push(t=[])},lineEnd:WB,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}}function vS(t,e){return qB(t[0]-e[0])<DB&&qB(t[1]-e[1])<DB}function mS(t,e,n,r){this.x=t,this.z=e,this.o=n,this.e=r,this.v=!1,this.n=this.p=null}function _S(t,e,n,r,i){var o,s,a=[],u=[];if(t.forEach((function(t){if(!((e=t.length-1)<=0)){var e,n,r=t[0],s=t[e];if(vS(r,s)){for(i.lineStart(),o=0;o<e;++o)i.point((r=t[o])[0],r[1]);i.lineEnd()}else a.push(n=new mS(r,t,null,!0)),u.push(n.o=new mS(r,null,n,!1)),a.push(n=new mS(s,t,null,!1)),u.push(n.o=new mS(s,null,n,!0))}})),a.length){for(u.sort(e),IS(a),IS(u),o=0,s=u.length;o<s;++o)u[o].e=n=!n;for(var l,c,h=a[0];;){for(var f=h,p=!0;f.v;)if((f=f.n)===h)return;l=f.z,i.lineStart();do{if(f.v=f.o.v=!0,f.e){if(p)for(o=0,s=l.length;o<s;++o)i.point((c=l[o])[0],c[1]);else r(f.x,f.n.x,1,i);f=f.n}else{if(p)for(l=f.p.z,o=l.length-1;o>=0;--o)i.point((c=l[o])[0],c[1]);else r(f.x,f.p.x,-1,i);f=f.p}l=(f=f.o).z,p=!p}while(!f.v);i.lineEnd()}}}function IS(t){if(e=t.length){for(var e,n,r=0,i=t[0];++r<e;)i.n=n=t[r],n.p=i,i=n;i.n=n=t[0],n.p=i}}function ES(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function xS(t){for(var e,n,r,i=t.length,o=-1,s=0;++o<i;)s+=t[o].length;for(n=new Array(s);--i>=0;)for(e=(r=t[i]).length;--e>=0;)n[--s]=r[e];return n}NB(),NB(),NB(),fS.invert=fS,1===(ZB=ES).length&&($B=ZB,ZB=function(t,e){return ES($B(t),e)});var CS=1e9,wS=-CS;function bS(t,e,n,r){function i(i,o){return t<=i&&i<=n&&e<=o&&o<=r}function o(i,o,a,l){var c=0,h=0;if(null==i||(c=s(i,a))!==(h=s(o,a))||u(i,o)<0^a>0)do{l.point(0===c||3===c?t:n,c>1?r:e)}while((c=(c+a+4)%4)!==h);else l.point(o[0],o[1])}function s(r,i){return qB(r[0]-t)<DB?i>0?0:3:qB(r[0]-n)<DB?i>0?2:1:qB(r[1]-e)<DB?i>0?1:0:i>0?3:2}function a(t,e){return u(t.x,e.x)}function u(t,e){var n=s(t,1),r=s(e,1);return n!==r?n-r:0===n?e[1]-t[1]:1===n?t[0]-e[0]:2===n?t[1]-e[1]:e[0]-t[0]}return function(s){var u,l,c,h,f,p,g,A,d,y,v,m=s,_=yS(),I={point:E,lineStart:function(){I.point=x,l&&l.push(c=[]);y=!0,d=!1,g=A=NaN},lineEnd:function(){u&&(x(h,f),p&&d&&_.rejoin(),u.push(_.result()));I.point=E,d&&m.lineEnd()},polygonStart:function(){m=_,u=[],l=[],v=!0},polygonEnd:function(){var e=function(){for(var e=0,n=0,i=l.length;n<i;++n)for(var o,s,a=l[n],u=1,c=a.length,h=a[0],f=h[0],p=h[1];u<c;++u)o=f,s=p,f=(h=a[u])[0],p=h[1],s<=r?p>r&&(f-o)*(r-s)>(p-s)*(t-o)&&++e:p<=r&&(f-o)*(r-s)<(p-s)*(t-o)&&--e;return e}(),n=v&&e,i=(u=xS(u)).length;(n||i)&&(s.polygonStart(),n&&(s.lineStart(),o(null,null,1,s),s.lineEnd()),i&&_S(u,a,e,o,s),s.polygonEnd());m=s,u=l=c=null}};function E(t,e){i(t,e)&&m.point(t,e)}function x(o,s){var a=i(o,s);if(l&&c.push([o,s]),y)h=o,f=s,p=a,y=!1,a&&(m.lineStart(),m.point(o,s));else if(a&&d)m.point(o,s);else{var u=[g=Math.max(wS,Math.min(CS,g)),A=Math.max(wS,Math.min(CS,A))],_=[o=Math.max(wS,Math.min(CS,o)),s=Math.max(wS,Math.min(CS,s))];!function(t,e,n,r,i,o){var s,a=t[0],u=t[1],l=0,c=1,h=e[0]-a,f=e[1]-u;if(s=n-a,h||!(s>0)){if(s/=h,h<0){if(s<l)return;s<c&&(c=s)}else if(h>0){if(s>c)return;s>l&&(l=s)}if(s=i-a,h||!(s<0)){if(s/=h,h<0){if(s>c)return;s>l&&(l=s)}else if(h>0){if(s<l)return;s<c&&(c=s)}if(s=r-u,f||!(s>0)){if(s/=f,f<0){if(s<l)return;s<c&&(c=s)}else if(f>0){if(s>c)return;s>l&&(l=s)}if(s=o-u,f||!(s<0)){if(s/=f,f<0){if(s>c)return;s>l&&(l=s)}else if(f>0){if(s<l)return;s<c&&(c=s)}return l>0&&(t[0]=a+l*h,t[1]=u+l*f),c<1&&(e[0]=a+c*h,e[1]=u+c*f),!0}}}}}(u,_,t,e,n,r)?a&&(m.lineStart(),m.point(o,s),v=!1):(d||(m.lineStart(),m.point(u[0],u[1])),m.point(_[0],_[1]),a||m.lineEnd(),v=!1)}g=o,A=s,d=a}return I}}var BS=NB();function SS(t){return t}NB(),NB(),NB();var MS=1/0,LS=MS,NS=-MS,TS=NS,RS={point:function(t,e){t<MS&&(MS=t);t>NS&&(NS=t);e<LS&&(LS=e);e>TS&&(TS=e)},lineStart:WB,lineEnd:WB,polygonStart:WB,polygonEnd:WB,result:function(){var t=[[MS,LS],[NS,TS]];return NS=TS=-(LS=MS=1/0),t}};function QS(t,e,n,r){return function(i,o){var s,a,u,l=e(o),c=i.invert(r[0],r[1]),h=yS(),f=e(h),p=!1,g={point:A,lineStart:y,lineEnd:v,polygonStart:function(){g.point=m,g.lineStart=_,g.lineEnd=I,a=[],s=[]},polygonEnd:function(){g.point=A,g.lineStart=y,g.lineEnd=v,a=xS(a);var t=function(t,e){var n=e[0],r=e[1],i=[YB(n),-VB(n),0],o=0,s=0;BS.reset();for(var a=0,u=t.length;a<u;++a)if(c=(l=t[a]).length)for(var l,c,h=l[c-1],f=h[0],p=h[1]/2+OB,g=YB(p),A=VB(p),d=0;d<c;++d,f=v,g=_,A=I,h=y){var y=l[d],v=y[0],m=y[1]/2+OB,_=YB(m),I=VB(m),E=v-f,x=E>=0?1:-1,C=x*E,w=C>PB,b=g*_;if(BS.add(zB(b*x*YB(C),A*I+b*VB(C))),o+=w?E+x*FB:E,w^f>=n^v>=n){var B=aS(oS(h),oS(y));cS(B);var S=aS(i,B);cS(S);var M=(w^E>=0?-1:1)*JB(S[2]);(r>M||r===M&&(B[0]||B[1]))&&(s+=w^E>=0?1:-1)}}return(o<-DB||o<DB&&BS<-DB)^1&s}(s,c);a.length?(p||(o.polygonStart(),p=!0),_S(a,PS,t,n,o)):t&&(p||(o.polygonStart(),p=!0),o.lineStart(),n(null,null,1,o),o.lineEnd()),p&&(o.polygonEnd(),p=!1),a=s=null},sphere:function(){o.polygonStart(),o.lineStart(),n(null,null,1,o),o.lineEnd(),o.polygonEnd()}};function A(e,n){var r=i(e,n);t(e=r[0],n=r[1])&&o.point(e,n)}function d(t,e){var n=i(t,e);l.point(n[0],n[1])}function y(){g.point=d,l.lineStart()}function v(){g.point=A,l.lineEnd()}function m(t,e){u.push([t,e]);var n=i(t,e);f.point(n[0],n[1])}function _(){f.lineStart(),u=[]}function I(){m(u[0][0],u[0][1]),f.lineEnd();var t,e,n,r,i=f.clean(),l=h.result(),c=l.length;if(u.pop(),s.push(u),u=null,c)if(1&i){if((e=(n=l[0]).length-1)>0){for(p||(o.polygonStart(),p=!0),o.lineStart(),t=0;t<e;++t)o.point((r=n[t])[0],r[1]);o.lineEnd()}}else c>1&&2&i&&l.push(l.pop().concat(l.shift())),a.push(l.filter(DS))}return g}}function DS(t){return t.length>1}function PS(t,e){return((t=t.x)[0]<0?t[1]-kB-DB:kB-t[1])-((e=e.x)[0]<0?e[1]-kB-DB:kB-e[1])}NB();var kS=QS((function(){return!0}),(function(t){var e,n=NaN,r=NaN,i=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(o,s){var a=o>0?PB:-PB,u=qB(o-n);qB(u-PB)<DB?(t.point(n,r=(r+s)/2>0?kB:-kB),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(a,r),t.point(o,r),e=0):i!==a&&u>=PB&&(qB(n-i)<DB&&(n-=i*DB),qB(o-a)<DB&&(o-=a*DB),r=function(t,e,n,r){var i,o,s=YB(t-n);return qB(s)>DB?jB((YB(e)*(o=VB(r))*YB(n)-YB(r)*(i=VB(e))*YB(t))/(i*o*s)):(e+r)/2}(n,r,o,s),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(a,r),e=0),t.point(n=o,r=s),i=a},lineEnd:function(){t.lineEnd(),n=r=NaN},clean:function(){return 2-e}}}),(function(t,e,n,r){var i;if(null==t)i=n*kB,r.point(-PB,i),r.point(0,i),r.point(PB,i),r.point(PB,0),r.point(PB,-i),r.point(0,-i),r.point(-PB,-i),r.point(-PB,0),r.point(-PB,i);else if(qB(t[0]-e[0])>DB){var o=t[0]<e[0]?PB:-PB;i=n*o/2,r.point(-o,i),r.point(0,i),r.point(o,i)}else r.point(e[0],e[1])}),[-PB,-kB]);function OS(t,e){var n=VB(t),r=n>0,i=qB(n)>DB;function o(t,e){return VB(t)*VB(e)>n}function s(t,e,r){var i=[1,0,0],o=aS(oS(t),oS(e)),s=sS(o,o),a=o[0],u=s-a*a;if(!u)return!r&&t;var l=n*s/u,c=-n*a/u,h=aS(i,o),f=lS(i,l);uS(f,lS(o,c));var p=h,g=sS(f,p),A=sS(p,p),d=g*g-A*(sS(f,f)-1);if(!(d<0)){var y=HB(d),v=lS(p,(-g-y)/A);if(uS(v,f),v=iS(v),!r)return v;var m,_=t[0],I=e[0],E=t[1],x=e[1];I<_&&(m=_,_=I,I=m);var C=I-_,w=qB(C-PB)<DB;if(!w&&x<E&&(m=E,E=x,x=m),w||C<DB?w?E+x>0^v[1]<(qB(v[0]-_)<DB?E:x):E<=v[1]&&v[1]<=x:C>PB^(_<=v[0]&&v[0]<=I)){var b=lS(p,(-g+y)/A);return uS(b,f),[v,iS(b)]}}}function a(e,n){var i=r?t:PB-t,o=0;return e<-i?o|=1:e>i&&(o|=2),n<-i?o|=4:n>i&&(o|=8),o}return QS(o,(function(t){var e,n,u,l,c;return{lineStart:function(){l=u=!1,c=1},point:function(h,f){var p,g=[h,f],A=o(h,f),d=r?A?0:a(h,f):A?a(h+(h<0?PB:-PB),f):0;if(!e&&(l=u=A)&&t.lineStart(),A!==u&&(!(p=s(e,g))||vS(e,p)||vS(g,p))&&(g[0]+=DB,g[1]+=DB,A=o(g[0],g[1])),A!==u)c=0,A?(t.lineStart(),p=s(g,e),t.point(p[0],p[1])):(p=s(e,g),t.point(p[0],p[1]),t.lineEnd()),e=p;else if(i&&e&&r^A){var y;d&n||!(y=s(g,e,!0))||(c=0,r?(t.lineStart(),t.point(y[0][0],y[0][1]),t.point(y[1][0],y[1][1]),t.lineEnd()):(t.point(y[1][0],y[1][1]),t.lineEnd(),t.lineStart(),t.point(y[0][0],y[0][1])))}!A||e&&vS(e,g)||t.point(g[0],g[1]),e=g,u=A,n=d},lineEnd:function(){u&&t.lineEnd(),e=null},clean:function(){return c|(l&&u)<<1}}}),(function(n,r,i,o){!function(t,e,n,r,i,o){if(n){var s=VB(e),a=YB(e),u=r*n;null==i?(i=e+r*FB,o=e-u/2):(i=dS(s,i),o=dS(s,o),(r>0?i<o:i>o)&&(i+=r*FB));for(var l,c=i;r>0?c>o:c<o;c-=u)l=iS([s,-a*VB(c),-a*YB(c)]),t.point(l[0],l[1])}}(o,t,e,i,n,r)}),r?[0,-t]:[-PB,t-PB])}function FS(t){return function(e){var n=new GS;for(var r in t)n[r]=t[r];return n.stream=e,n}}function GS(){}function US(t,e,n){var r=e[1][0]-e[0][0],i=e[1][1]-e[0][1],o=t.clipExtent&&t.clipExtent();t.scale(150).translate([0,0]),null!=o&&t.clipExtent(null),function(t,e){t&&tS.hasOwnProperty(t.type)?tS[t.type](t,e):KB(t,e)}(n,t.stream(RS));var s=RS.result(),a=Math.min(r/(s[1][0]-s[0][0]),i/(s[1][1]-s[0][1])),u=+e[0][0]+(r-a*(s[1][0]+s[0][0]))/2,l=+e[0][1]+(i-a*(s[1][1]+s[0][1]))/2;return null!=o&&t.clipExtent(o),t.scale(150*a).translate([u,l])}GS.prototype={constructor:GS,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var qS=16,jS=VB(30*UB);function zS(t,e){return+e?function(t,e){function n(r,i,o,s,a,u,l,c,h,f,p,g,A,d){var y=l-r,v=c-i,m=y*y+v*v;if(m>4*e&&A--){var _=s+f,I=a+p,E=u+g,x=HB(_*_+I*I+E*E),C=JB(E/=x),w=qB(qB(E)-1)<DB||qB(o-h)<DB?(o+h)/2:zB(I,_),b=t(w,C),B=b[0],S=b[1],M=B-r,L=S-i,N=v*M-y*L;(N*N/m>e||qB((y*M+v*L)/m-.5)>.3||s*f+a*p+u*g<jS)&&(n(r,i,o,s,a,u,B,S,w,_/=x,I/=x,E,A,d),d.point(B,S),n(B,S,w,_,I,E,l,c,h,f,p,g,A,d))}}return function(e){var r,i,o,s,a,u,l,c,h,f,p,g,A={point:d,lineStart:y,lineEnd:m,polygonStart:function(){e.polygonStart(),A.lineStart=_},polygonEnd:function(){e.polygonEnd(),A.lineStart=y}};function d(n,r){n=t(n,r),e.point(n[0],n[1])}function y(){c=NaN,A.point=v,e.lineStart()}function v(r,i){var o=oS([r,i]),s=t(r,i);n(c,h,l,f,p,g,c=s[0],h=s[1],l=r,f=o[0],p=o[1],g=o[2],qS,e),e.point(c,h)}function m(){A.point=d,e.lineEnd()}function _(){y(),A.point=I,A.lineEnd=E}function I(t,e){v(r=t,e),i=c,o=h,s=f,a=p,u=g,A.point=v}function E(){n(c,h,l,f,p,g,i,o,r,s,a,u,qS,e),A.lineEnd=m,m()}return A}}(t,e):function(t){return FS({point:function(e,n){e=t(e,n),this.stream.point(e[0],e[1])}})}(t)}var VS=FS({point:function(t,e){this.stream.point(t*UB,e*UB)}});function YS(t){return function(t){var e,n,r,i,o,s,a,u,l,c,h=150,f=480,p=250,g=0,A=0,d=0,y=0,v=0,m=null,_=kS,I=null,E=SS,x=.5,C=zS(B,x);function w(t){return[(t=o(t[0]*UB,t[1]*UB))[0]*h+n,r-t[1]*h]}function b(t){return(t=o.invert((t[0]-n)/h,(r-t[1])/h))&&[t[0]*GB,t[1]*GB]}function B(t,i){return[(t=e(t,i))[0]*h+n,r-t[1]*h]}function S(){o=hS(i=function(t,e,n){return(t%=FB)?e||n?hS(gS(t),AS(e,n)):gS(t):e||n?AS(e,n):fS}(d,y,v),e);var t=e(g,A);return n=f-t[0]*h,r=p+t[1]*h,M()}function M(){return l=c=null,w}return w.stream=function(t){return l&&c===t?l:l=VS(_(i,C(E(c=t))))},w.clipAngle=function(t){return arguments.length?(_=+t?OS(m=t*UB,6*UB):(m=null,kS),M()):m*GB},w.clipExtent=function(t){return arguments.length?(E=null==t?(I=s=a=u=null,SS):bS(I=+t[0][0],s=+t[0][1],a=+t[1][0],u=+t[1][1]),M()):null==I?null:[[I,s],[a,u]]},w.scale=function(t){return arguments.length?(h=+t,S()):h},w.translate=function(t){return arguments.length?(f=+t[0],p=+t[1],S()):[f,p]},w.center=function(t){return arguments.length?(g=t[0]%360*UB,A=t[1]%360*UB,S()):[g*GB,A*GB]},w.rotate=function(t){return arguments.length?(d=t[0]%360*UB,y=t[1]%360*UB,v=t.length>2?t[2]%360*UB:0,S()):[d*GB,y*GB,v*GB]},w.precision=function(t){return arguments.length?(C=zS(B,x=t*t),M()):HB(x)},w.fitExtent=function(t,e){return US(w,t,e)},w.fitSize=function(t,e){return function(t,e,n){return US(t,[[0,0],e],n)}(w,t,e)},function(){return e=t.apply(this,arguments),w.invert=e.invert&&b,S()}}((function(){return t}))()}function HS(t){return function(e,n){var r=VB(e),i=VB(n),o=t(r*i);return[o*i*YB(e),o*YB(n)]}}function XS(t){return function(e,n){var r=HB(e*e+n*n),i=t(r),o=YB(i),s=VB(i);return[zB(e*o,r*s),JB(r&&n*o/r)]}}HS((function(t){return HB(2/(1+t))})).invert=XS((function(t){return 2*JB(t/2)}));var JS=HS((function(t){return(t=XB(t))&&t/YB(t)}));function WS(){return YS(JS).scale(79.4188).clipAngle(179.999)}function KS(t,e){return[t,e]}function ZS(t,e,n,r){var i=t.properties||{},o="Feature"===t.type?t.geometry:t;if("GeometryCollection"===o.type){var s=[];return Fl(t,(function(t){var i=ZS(t,e,n,r);i&&s.push(i)})),hn(s)}var a=function(t){var e=Vf(t).geometry.coordinates,n=[-e[0],-e[1]];return WS().rotate(n).scale(Ze)}(o),u={type:o.type,coordinates:tM(o.coordinates,a)},l=(new yC).read(u),c=yn(vn(e,n),"meters"),h=cb.bufferOp(l,c,r);if(!$S((h=(new vC).write(h)).coordinates))return nn({type:h.type,coordinates:eM(h.coordinates,a)},i)}function $S(t){return Array.isArray(t[0])?$S(t[0]):isNaN(t[0])}function tM(t,e){return"object"!=typeof t[0]?e(t):t.map((function(t){return tM(t,e)}))}function eM(t,e){return"object"!=typeof t[0]?e.invert(t):t.map((function(t){return eM(t,e)}))}function nM(t,e,n){void 0===n&&(n={});var r=Pn(t),i=Pn(e),o=YI.intersection(r.coordinates,i.coordinates);return 0===o.length?null:1===o.length?an(o[0],n.properties):gn(o,n.properties)}function rM(t,e,n){void 0===n&&(n={});var r=JSON.stringify(n.properties||{}),i=t[0],o=t[1],s=t[2],a=t[3],u=(o+a)/2,l=(i+s)/2,c=2*e/Fn([i,u],[s,u],n)*(s-i),h=2*e/Fn([l,o],[l,a],n)*(a-o),f=c/2,p=2*f,g=Math.sqrt(3)/2*h,A=s-i,d=a-o,y=3/4*p,v=g,m=(A-p)/(p-f/2),_=Math.floor(m),I=(_*y-f/2-A)/2-f/2+y/2,E=Math.floor((d-g)/g),x=(d-E*g)/2,C=E*g-d>g/2;C&&(x-=g/4);for(var w=[],b=[],B=0;B<6;B++){var S=2*Math.PI/6*B;w.push(Math.cos(S)),b.push(Math.sin(S))}for(var M=[],L=0;L<=_;L++)for(var N=0;N<=E;N++){var T=L%2==1;if((0!==N||!T)&&(0!==N||!C)){var R=L*y+i-I,Q=N*v+o+x;if(T&&(Q-=g/2),!0===n.triangles)oM([R,Q],c/2,h/2,JSON.parse(r),w,b).forEach((function(t){n.mask?nM(n.mask,t)&&M.push(t):M.push(t)}));else{var D=iM([R,Q],c/2,h/2,JSON.parse(r),w,b);n.mask?nM(n.mask,D)&&M.push(D):M.push(D)}}}return hn(M)}function iM(t,e,n,r,i,o){for(var s=[],a=0;a<6;a++){var u=t[0]+e*i[a],l=t[1]+n*o[a];s.push([u,l])}return s.push(s[0].slice()),an([s],r)}function oM(t,e,n,r,i,o){for(var s=[],a=0;a<6;a++){var u=[];u.push(t),u.push([t[0]+e*i[a],t[1]+n*o[a]]),u.push([t[0]+e*i[(a+1)%6],t[1]+n*o[(a+1)%6]]),u.push(t),s.push(an([u],r))}return s}function sM(t){return gn(t)}function aM(t){return an(t&&t.geometry.coordinates||[[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]]])}function uM(t,e,n){return void 0===n&&(n={}),function(t,e,n,r){void 0===r&&(r={});for(var i=[],o=t[0],s=t[1],a=t[2],u=t[3],l=e/Fn([o,s],[a,s],r)*(a-o),c=n/Fn([o,s],[o,u],r)*(u-s),h=a-o,f=u-s,p=Math.floor(h/l),g=Math.floor(f/c),A=(f-g*c)/2,d=o+(h-p*l)/2,y=0;y<p;y++){for(var v=s+A,m=0;m<g;m++){var _=an([[[d,v],[d,v+c],[d+l,v+c],[d+l,v],[d,v]]],r.properties);r.mask?dm(r.mask,_)&&i.push(_):i.push(_),v+=c}d+=l}return hn(i)}(t,e,e,n)}function lM(t,e,n){void 0===n&&(n={});for(var r=[],i=e/Fn([t[0],t[1]],[t[2],t[1]],n)*(t[2]-t[0]),o=e/Fn([t[0],t[1]],[t[0],t[3]],n)*(t[3]-t[1]),s=0,a=t[0];a<=t[2];){for(var u=0,l=t[1];l<=t[3];){var c=null,h=null;s%2==0&&u%2==0?(c=an([[[a,l],[a,l+o],[a+i,l],[a,l]]],n.properties),h=an([[[a,l+o],[a+i,l+o],[a+i,l],[a,l+o]]],n.properties)):s%2==0&&u%2==1?(c=an([[[a,l],[a+i,l+o],[a+i,l],[a,l]]],n.properties),h=an([[[a,l],[a,l+o],[a+i,l+o],[a,l]]],n.properties)):u%2==0&&s%2==1?(c=an([[[a,l],[a,l+o],[a+i,l+o],[a,l]]],n.properties),h=an([[[a,l],[a+i,l+o],[a+i,l],[a,l]]],n.properties)):u%2==1&&s%2==1&&(c=an([[[a,l],[a,l+o],[a+i,l],[a,l]]],n.properties),h=an([[[a,l+o],[a+i,l+o],[a+i,l],[a,l+o]]],n.properties)),n.mask?(nM(n.mask,c)&&r.push(c),nM(n.mask,h)&&r.push(h)):(r.push(c),r.push(h)),l+=o,u++}s++,a+=i}return hn(r)}JS.invert=XS((function(t){return t})),KS.invert=KS;var cM=Object.freeze({__proto__:null,projection:G_,random:X_,clusters:nI,helpers:Mn,invariant:On,meta:Jl,isolines:function(t,e,n){if(!bn(n=n||{}))throw new Error("options is invalid");var r=n.zProperty||"elevation",i=n.commonProperties||{},o=n.breaksProperties||[];if(Dn(t,"Point","Input must contain Points"),!e)throw new Error("breaks is required");if(!Array.isArray(e))throw new Error("breaks must be an Array");if(!bn(i))throw new Error("commonProperties must be an Object");if(!Array.isArray(o))throw new Error("breaksProperties must be an Array");var s=Wc(t,{zProperty:r,flip:!0}),a=function(t,e,n,r,i){for(var o=[],s=1;s<e.length;s++){var a=+e[s],u=qc({},r,i[s]);u[n]=a;var l=fn(Vc(t,a),u);o.push(l)}return o}(s,e,r,i,o),u=function(t,e,n){var r=Oc(n),i=r[2]-r[0],o=r[3]-r[1],s=r[0],a=r[1],u=e[0].length-1,l=e.length-1,c=i/u,h=o/l,f=function(t){t[0]=t[0]*c+s,t[1]=t[1]*h+a};return t.forEach((function(t){Tl(t,f)})),t}(a,s,t);return hn(u)},convex:qh,pointsWithinPolygon:jh,within:jh,concave:function(t,e){void 0===e&&(e={});var n=e.maxEdge||1/0,r=function(t){var e=[],n={};return Pl(t,(function(t){if(t.geometry){var r=t.geometry.coordinates.join("-");Object.prototype.hasOwnProperty.call(n,r)||(e.push(t),n[r]=!0)}})),hn(e)}(t),i=zh(r);if(i.features=i.features.filter((function(t){var r=t.geometry.coordinates[0][0],i=t.geometry.coordinates[0][1],o=t.geometry.coordinates[0][2],s=Fn(r,i,e),a=Fn(i,o,e),u=Fn(r,o,e);return s<=n&&a<=n&&u<=n})),i.features.length<1)return null;var o=mf(i);return 1===o.coordinates.length&&(o.coordinates=o.coordinates[0],o.type="Polygon"),nn(o)},collect:function(t,e,n,r){var i=Pf(6),o=e.features.map((function(t){var e;return{minX:t.geometry.coordinates[0],minY:t.geometry.coordinates[1],maxX:t.geometry.coordinates[0],maxY:t.geometry.coordinates[1],property:null===(e=t.properties)||void 0===e?void 0:e[n]}}));return i.load(o),t.features.forEach((function(t){t.properties||(t.properties={});var e=Oc(t),n=i.search({minX:e[0],minY:e[1],maxX:e[2],maxY:e[3]}),o=[];n.forEach((function(e){Gn([e.minX,e.minY],t)&&o.push(e.property)})),t.properties[r]=o})),t},flip:function(t,e){if(!bn(e=e||{}))throw new Error("options is invalid");var n=e.mutate;if(!t)throw new Error("geojson is required");return!1!==n&&void 0!==n||(t=Bl(t)),Tl(t,(function(t){var e=t[0],n=t[1];t[0]=n,t[1]=e})),t},simplify:tc,bezier:Of,bezierSpline:Of,tag:function(t,e,n,r){return t=Bl(t),e=Bl(e),Pl(t,(function(t){t.properties||(t.properties={}),Pl(e,(function(e){void 0===t.properties[r]&&Gn(t,e)&&(t.properties[r]=e.properties[n])}))})),t},sample:function(t,e){if(!t)throw new Error("featurecollection is required");if(null==e)throw new Error("num is required");if("number"!=typeof e)throw new Error("num must be a number");var n=hn(function(t,e){var n,r,i=t.slice(0),o=t.length,s=o-e;for(;o-- >s;)n=i[r=Math.floor((o+1)*Math.random())],i[r]=i[o],i[o]=n;return i.slice(s)}(t.features,e));return n},envelope:Gf,square:Uf,circle:jf,midpoint:function(t,e){return qf(t,Fn(t,e)/2,zf(t,e))},center:Vf,centerOfMass:function t(e,n){switch(void 0===n&&(n={}),kn(e)){case"Point":return on(Ln(e),n.properties);case"Polygon":var r=[];Tl(e,(function(t){r.push(t)}));var i,o,s,a,u,l,c,h,f=Yf(e,{properties:n.properties}),p=f.geometry.coordinates,g=0,A=0,d=0,y=r.map((function(t){return[t[0]-p[0],t[1]-p[1]]}));for(i=0;i<r.length-1;i++)a=(o=y[i])[0],l=o[1],u=(s=y[i+1])[0],d+=h=a*(c=s[1])-u*l,g+=(a+u)*h,A+=(l+c)*h;if(0===d)return f;var v=1/(6*(.5*d));return on([p[0]+v*g,p[1]+v*A],n.properties);default:var m=qh(e);return m?t(m,{properties:n.properties}):Yf(e,{properties:n.properties})}},centroid:Yf,combine:function(t){var e={MultiPoint:{coordinates:[],properties:[]},MultiLineString:{coordinates:[],properties:[]},MultiPolygon:{coordinates:[],properties:[]}};return Pl(t,(function(t){var n,r,i,o;switch(null===(o=t.geometry)||void 0===o?void 0:o.type){case"Point":e.MultiPoint.coordinates.push(t.geometry.coordinates),e.MultiPoint.properties.push(t.properties);break;case"MultiPoint":(n=e.MultiPoint.coordinates).push.apply(n,t.geometry.coordinates),e.MultiPoint.properties.push(t.properties);break;case"LineString":e.MultiLineString.coordinates.push(t.geometry.coordinates),e.MultiLineString.properties.push(t.properties);break;case"MultiLineString":(r=e.MultiLineString.coordinates).push.apply(r,t.geometry.coordinates),e.MultiLineString.properties.push(t.properties);break;case"Polygon":e.MultiPolygon.coordinates.push(t.geometry.coordinates),e.MultiPolygon.properties.push(t.properties);break;case"MultiPolygon":(i=e.MultiPolygon.coordinates).push.apply(i,t.geometry.coordinates),e.MultiPolygon.properties.push(t.properties)}})),hn(Object.keys(e).filter((function(t){return e[t].coordinates.length})).sort().map((function(t){return nn({type:t,coordinates:e[t].coordinates},{collectedProperties:e[t].properties})})))},distance:Fn,explode:Hf,bbox:Oc,tesselate:function(t){if(!t.geometry||"Polygon"!==t.geometry.type&&"MultiPolygon"!==t.geometry.type)throw new Error("input must be a Polygon or MultiPolygon");var e={type:"FeatureCollection",features:[]};return"Polygon"===t.geometry.type?e.features=Xf(t.geometry.coordinates):t.geometry.coordinates.forEach((function(t){e.features=e.features.concat(Xf(t))})),e},bboxPolygon:Ff,booleanPointInPolygon:Gn,inside:Gn,nearest:Jf,nearestPoint:Jf,nearestPointOnLine:Gp,pointOnLine:Gp,nearestPointToLine:function(t,e,n){void 0===n&&(n={});var r=n.units,i=n.properties||{},o=function(t){var e=[];switch(t.geometry?t.geometry.type:t.type){case"GeometryCollection":return Fl(t,(function(t){"Point"===t.type&&e.push({type:"Feature",properties:{},geometry:t})})),{type:"FeatureCollection",features:e};case"FeatureCollection":return t.features=t.features.filter((function(t){return"Point"===t.geometry.type})),t;default:throw new Error("points must be a Point Collection")}}(t);if(!o.features.length)throw new Error("points must contain features");if(!e)throw new Error("line is required");if("LineString"!==kn(e))throw new Error("line must be a LineString");var s=1/0,a=null;return Pl(o,(function(t){var n=qp(t,e,{units:r});n<s&&(s=n,a=t)})),a&&(a.properties=qc({dist:s},a.properties,i)),a},planepoint:function(t,e){var n=Ln(t),r=Pn(e).coordinates[0];if(r.length<4)throw new Error("OuterRing of a Polygon must have 4 or more Positions.");var i=e.properties||{},o=i.a,s=i.b,a=i.c,u=n[0],l=n[1],c=r[0][0],h=r[0][1],f=void 0!==o?o:r[0][2],p=r[1][0],g=r[1][1],A=void 0!==s?s:r[1][2],d=r[2][0],y=r[2][1],v=void 0!==a?a:r[2][2];return(v*(u-c)*(l-g)+f*(u-p)*(l-y)+A*(u-d)*(l-h)-A*(u-c)*(l-y)-v*(u-p)*(l-h)-f*(u-d)*(l-g))/((u-c)*(l-g)+(u-p)*(l-y)+(u-d)*(l-h)-(u-c)*(l-y)-(u-p)*(l-h)-(u-d)*(l-g))},tin:zh,bearing:zf,destination:qf,kinks:function(t){var e,n,r={type:"FeatureCollection",features:[]};if("LineString"===(n="Feature"===t.type?t.geometry:t).type)e=[n.coordinates];else if("MultiLineString"===n.type)e=n.coordinates;else if("MultiPolygon"===n.type)e=[].concat.apply([],n.coordinates);else{if("Polygon"!==n.type)throw new Error("Input must be a LineString, MultiLineString, Polygon, or MultiPolygon Feature or Geometry");e=n.coordinates}return e.forEach((function(t){e.forEach((function(e){for(var n=0;n<t.length-1;n++)for(var i=n;i<e.length-1;i++){if(t===e){if(1===Math.abs(n-i))continue;if(0===n&&i===t.length-2&&t[n][0]===t[t.length-1][0]&&t[n][1]===t[t.length-1][1])continue}var o=Vp(t[n][0],t[n][1],t[n+1][0],t[n+1][1],e[i][0],e[i][1],e[i+1][0],e[i+1][1]);o&&r.features.push(on([o[0],o[1]]))}}))})),r},pointOnFeature:Yp,pointOnSurface:Yp,area:Jp,along:function(t,e,n){void 0===n&&(n={});for(var r=Pn(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=zf(r[o],r[o-1])-180;return qf(r[o],s,a,n)}return on(r[o])}i+=Fn(r[o],r[o+1],n)}return on(r[r.length-1])},length:$p,lineDistance:$p,lineSlice:function(t,e,n){var r=Nn(n);if("LineString"!==kn(n))throw new Error("line must be a LineString");for(var i,o=Gp(n,t),s=Gp(n,e),a=[(i=o.properties.index<=s.properties.index?[o,s]:[s,o])[0].geometry.coordinates],u=i[0].properties.index+1;u<i[1].properties.index+1;u++)a.push(r[u]);return a.push(i[1].geometry.coordinates),ln(a,n.properties)},lineSliceAlong:tg,pointGrid:ag,truncate:ug,flatten:lg,lineIntersect:Op,lineChunk:function(t,e,n){if(!bn(n=n||{}))throw new Error("options is invalid");var r=n.units,i=n.reverse;if(!t)throw new Error("geojson is required");if(e<=0)throw new Error("segmentLength must be greater than 0");var o=[];return Ul(t,(function(t){i&&(t.geometry.coordinates=t.geometry.coordinates.reverse()),function(t,e,n,r){var i=$p(t,{units:n});if(i<=e)return r(t);var o=i/e;Number.isInteger(o)||(o=Math.floor(o)+1);for(var s=0;s<o;s++){r(tg(t,e*s,e*(s+1),{units:n}),s)}}(t,e,r,(function(t){o.push(t)}))})),hn(o)},unkinkPolygon:function(t){var e=[];return Ul(t,(function(t){"Polygon"===t.geometry.type&&Pl(fg(t),(function(n){e.push(an(n.geometry.coordinates,t.properties))}))})),hn(e)},greatCircle:function(t,e,n){if("object"!=typeof(n=n||{}))throw new Error("options is invalid");var r=n.properties,i=n.npoints,o=n.offset;return t=Ln(t),e=Ln(e),r=r||{},i=i||100,o=o||10,new Cg({x:t[0],y:t[1]},{x:e[0],y:e[1]},r).Arc(i,{offset:o}).json()},lineSegment:Wf,lineSplit:function(t,e){if(!t)throw new Error("line is required");if(!e)throw new Error("splitter is required");var n=kn(t),r=kn(e);if("LineString"!==n)throw new Error("line must be LineString");if("FeatureCollection"===r)throw new Error("splitter cannot be a FeatureCollection");if("GeometryCollection"===r)throw new Error("splitter cannot be a GeometryCollection");var i=ug(e,{precision:7});switch(r){case"Point":return bg(t,i);case"MultiPoint":return wg(t,i);case"LineString":case"MultiLineString":case"Polygon":case"MultiPolygon":return wg(t,Op(t,i))}},lineArc:Mg,polygonToLine:Ng,polygonToLineString:Ng,lineStringToPolygon:Qg,lineToPolygon:Qg,bboxClip:function(t,e){var n=Pn(t),r=n.type,i="Feature"===t.type?t.properties:{},o=n.coordinates;switch(r){case"LineString":case"MultiLineString":var s=[];return"LineString"===r&&(o=[o]),o.forEach((function(t){!function(t,e,n){var r,i,o,s,a,u=t.length,l=Fg(t[0],e),c=[];for(n||(n=[]),r=1;r<u;r++){for(s=t[r-1],i=o=Fg(a=t[r],e);;){if(!(l|i)){c.push(s),i!==o?(c.push(a),r<u-1&&(n.push(c),c=[])):r===u-1&&c.push(a);break}if(l&i)break;l?l=Fg(s=Og(s,a,l,e),e):i=Fg(a=Og(s,a,i,e),e)}l=o}c.length&&n.push(c)}(t,e,s)})),1===s.length?ln(s[0],i):fn(s,i);case"Polygon":return an(Gg(o,e),i);case"MultiPolygon":return gn(o.map((function(t){return Gg(t,e)})),i);default:throw new Error("geometry "+r+" not supported")}},lineOverlap:Iy,sector:function(t,e,n,r,i){if(!bn(i=i||{}))throw new Error("options is invalid");var o=i.properties;if(!t)throw new Error("center is required");if(null==n)throw new Error("bearing1 is required");if(null==r)throw new Error("bearing2 is required");if(!e)throw new Error("radius is required");if("object"!=typeof i)throw new Error("options must be an object");if(xy(n)===xy(r))return jf(t,e,i);var s=Nn(t),a=Mg(t,e,n,r,i),u=[[s]];return Tl(a,(function(t){u[0].push(t)})),u[0].push(s),an(u,o)},rhumbBearing:Cy,rhumbDistance:Up,rhumbDestination:by,polygonTangents:function(t,e){var n,r,i,o,s=Nn(t),a=Nn(e),u=Oc(e),l=0,c=null;switch(s[0]>u[0]&&s[0]<u[2]&&s[1]>u[1]&&s[1]<u[3]&&(l=(c=Jf(t,Hf(e))).properties.featureIndex),kn(e)){case"Polygon":n=a[0][l],r=a[0][0],null!==c&&c.geometry.coordinates[1]<s[1]&&(r=a[0][l]),o=My(a[0][0],a[0][a[0].length-1],s);var h=By(a[0],s,o,i,n,r);n=h[0],r=h[1];break;case"MultiPolygon":for(var f=0,p=0,g=0,A=0;A<a[0].length;A++){f=A;for(var d=!1,y=0;y<a[0][A].length;y++){if(p=y,g===l){d=!0;break}g++}if(d)break}n=a[0][f][p],r=a[0][f][p],o=My(a[0][0][0],a[0][0][a[0][0].length-1],s),a.forEach((function(t){var e=By(t[0],s,o,i,n,r);n=e[0],r=e[1]}))}return hn([on(n),on(r)])},rewind:function(t,e){if(!bn(e=e||{}))throw new Error("options is invalid");var n=e.reverse||!1,r=e.mutate||!1;if(!t)throw new Error("<geojson> is required");if("boolean"!=typeof n)throw new Error("<reverse> must be a boolean");if("boolean"!=typeof r)throw new Error("<mutate> must be a boolean");!1===r&&(t=Bl(t));var i=[];switch(t.type){case"GeometryCollection":return Fl(t,(function(t){Ny(t,n)})),t;case"FeatureCollection":return Pl(t,(function(t){Pl(Ny(t,n),(function(t){i.push(t)}))})),hn(i)}return Ny(t,n)},isobands:function(t,e,n){if(!bn(n=n||{}))throw new Error("options is invalid");var r=n.zProperty||"elevation",i=n.commonProperties||{},o=n.breaksProperties||[];if(Dn(t,"Point","Input must contain Points"),!e)throw new Error("breaks is required");if(!Array.isArray(e))throw new Error("breaks is not an Array");if(!bn(i))throw new Error("commonProperties is not an Object");if(!Array.isArray(o))throw new Error("breaksProperties is not an Array");var s=Qy(t,{zProperty:r,flip:!0}),a=function(t,e,n){for(var r=[],i=1;i<e.length;i++){var o=+e[i-1],s=+e[i],a=Dv(Qv(ky(t,o,s-o))),u={};u.groupedRings=a,u[n]=o+"-"+s,r.push(u)}return r}(s,e,r);a=function(t,e,n){var r=Oc(n),i=r[2]-r[0],o=r[3]-r[1],s=r[0],a=r[1],u=e[0].length-1,l=e.length-1,c=i/u,h=o/l,f=function(t){t[0]=t[0]*c+s,t[1]=t[1]*h+a};return t.forEach((function(t){t.groupedRings.forEach((function(t){t.forEach((function(t){t.forEach(f)}))}))})),t}(a,s,t);var u=a.map((function(t,e){if(o[e]&&!bn(o[e]))throw new Error("Each mappedProperty is required to be an Object");var n=qc({},i,o[e]);return n[r]=t[r],gn(t.groupedRings,n)}));return hn(u)},transformRotate:Ov,transformScale:Fv,transformTranslate:function(t,e,n,r){if(!bn(r=r||{}))throw new Error("options is invalid");var i=r.units,o=r.zTranslation,s=r.mutate;if(!t)throw new Error("geojson is required");if(null==e||isNaN(e))throw new Error("distance is required");if(o&&"number"!=typeof o&&isNaN(o))throw new Error("zTranslation is not a number");if(o=void 0!==o?o:0,0===e&&0===o)return t;if(null==n||isNaN(n))throw new Error("direction is required");return e<0&&(e=-e,n+=180),!1!==s&&void 0!==s||(t=Bl(t)),Tl(t,(function(t){var r=Nn(by(t,e,n,{units:i}));t[0]=r[0],t[1]=r[1],o&&3===t.length&&(t[2]+=o)})),t},lineOffset:function(t,e,n){if(!bn(n=n||{}))throw new Error("options is invalid");var r=n.units;if(!t)throw new Error("geojson is required");if(null==e||isNaN(e))throw new Error("distance is required");var i=kn(t),o=t.properties;switch(i){case"LineString":return zv(t,e,r);case"MultiLineString":var s=[];return Ul(t,(function(t){s.push(zv(t,e,r).geometry.coordinates)})),fn(s,o);default:throw new Error("geometry "+i+" is not supported")}},polygonize:function(t){var e=Zv.fromGeoJson(t);e.deleteDangles(),e.deleteCutEdges();var n=[],r=[];return e.getEdgeRings().filter((function(t){return t.isValid()})).forEach((function(t){t.isHole()?n.push(t):r.push(t)})),n.forEach((function(t){Wv.findEdgeRingContaining(t,r)&&r.push(t)})),hn(r.map((function(t){return t.toPolygon()})))},booleanDisjoint:$v,booleanContains:function(t,e){var n=Pn(t),r=Pn(e),i=n.type,o=r.type,s=n.coordinates,a=r.coordinates;switch(i){case"Point":if("Point"===o)return im(s,a);throw new Error("feature2 "+o+" geometry not supported");case"MultiPoint":switch(o){case"Point":return function(t,e){var n,r=!1;for(n=0;n<t.coordinates.length;n++)if(im(t.coordinates[n],e.coordinates)){r=!0;break}return r}(n,r);case"MultiPoint":return function(t,e){for(var n=0,r=e.coordinates;n<r.length;n++){for(var i=r[n],o=!1,s=0,a=t.coordinates;s<a.length;s++){if(im(i,a[s])){o=!0;break}}if(!o)return!1}return!0}(n,r);default:throw new Error("feature2 "+o+" geometry not supported")}case"LineString":switch(o){case"Point":return eg(r,n,{ignoreEndVertices:!0});case"LineString":return function(t,e){for(var n=!1,r=0,i=e.coordinates;r<i.length;r++){var o=i[r];if(eg({type:"Point",coordinates:o},t,{ignoreEndVertices:!0})&&(n=!0),!eg({type:"Point",coordinates:o},t,{ignoreEndVertices:!1}))return!1}return n}(n,r);case"MultiPoint":return function(t,e){for(var n=!1,r=0,i=e.coordinates;r<i.length;r++){var o=i[r];if(eg(o,t,{ignoreEndVertices:!0})&&(n=!0),!eg(o,t))return!1}if(n)return!0;return!1}(n,r);default:throw new Error("feature2 "+o+" geometry not supported")}case"Polygon":switch(o){case"Point":return Gn(r,n,{ignoreBoundary:!0});case"LineString":return function(t,e){var n=!1,r=0,i=Oc(t),o=Oc(e);if(!rm(i,o))return!1;for(;r<e.coordinates.length-1;r++){if(Gn({type:"Point",coordinates:om(e.coordinates[r],e.coordinates[r+1])},t,{ignoreBoundary:!0})){n=!0;break}}return n}(n,r);case"Polygon":return function(t,e){if("Feature"===t.type&&null===t.geometry)return!1;if("Feature"===e.type&&null===e.geometry)return!1;var n=Oc(t),r=Oc(e);if(!rm(n,r))return!1;for(var i=Pn(e).coordinates,o=0,s=i;o<s.length;o++)for(var a=0,u=s[o];a<u.length;a++){if(!Gn(u[a],t))return!1}return!0}(n,r);case"MultiPoint":return function(t,e){for(var n=0,r=e.coordinates;n<r.length;n++){if(!Gn(r[n],t,{ignoreBoundary:!0}))return!1}return!0}(n,r);default:throw new Error("feature2 "+o+" geometry not supported")}default:throw new Error("feature1 "+i+" geometry not supported")}},booleanCrosses:function(t,e){var n=Pn(t),r=Pn(e),i=n.type,o=r.type;switch(i){case"MultiPoint":switch(o){case"LineString":return sm(n,r);case"Polygon":return um(n,r);default:throw new Error("feature2 "+o+" geometry not supported")}case"LineString":switch(o){case"MultiPoint":return sm(r,n);case"LineString":return function(t,e){if(Op(t,e).features.length>0)for(var n=0;n<t.coordinates.length-1;n++)for(var r=0;r<e.coordinates.length-1;r++){var i=!0;if(0!==r&&r!==e.coordinates.length-2||(i=!1),lm(t.coordinates[n],t.coordinates[n+1],e.coordinates[r],i))return!0}return!1}(n,r);case"Polygon":return am(n,r);default:throw new Error("feature2 "+o+" geometry not supported")}case"Polygon":switch(o){case"MultiPoint":return um(r,n);case"LineString":return am(r,n);default:throw new Error("feature2 "+o+" geometry not supported")}default:throw new Error("feature1 "+i+" geometry not supported")}},booleanClockwise:Ly,booleanOverlap:function(t,e){var n=Pn(t),r=Pn(e),i=n.type,o=r.type;if("MultiPoint"===i&&"MultiPoint"!==o||("LineString"===i||"MultiLineString"===i)&&"LineString"!==o&&"MultiLineString"!==o||("Polygon"===i||"MultiPolygon"===i)&&"Polygon"!==o&&"MultiPolygon"!==o)throw new Error("features must be of the same type");if("Point"===i)throw new Error("Point geometry not supported");if(new Am({precision:6}).compare(t,e))return!1;var s=0;switch(i){case"MultiPoint":for(var a=0;a<n.coordinates.length;a++)for(var u=0;u<r.coordinates.length;u++){var l=n.coordinates[a],c=r.coordinates[u];if(l[0]===c[0]&&l[1]===c[1])return!0}return!1;case"LineString":case"MultiLineString":jl(t,(function(t){jl(e,(function(e){Iy(t,e).features.length&&s++}))}));break;case"Polygon":case"MultiPolygon":jl(t,(function(t){jl(e,(function(e){Op(t,e).features.length&&s++}))}))}return s>0},booleanPointOnLine:eg,booleanEqual:function(t,e){return Pn(t).type===Pn(e).type&&new Am({precision:6}).compare(xl(t),xl(e))},booleanWithin:rg,booleanIntersects:dm,clone:Bl,cleanCoords:xl,clustersDbscan:function(t,e,n){void 0===n&&(n={}),!0!==n.mutate&&(t=Bl(t)),n.minPoints=n.minPoints||3;var r=new xm.DBSCAN,i=r.run(Ol(t),xn(e,n.units),n.minPoints,Fn),o=-1;return i.forEach((function(e){o++,e.forEach((function(e){var n=t.features[e];n.properties||(n.properties={}),n.properties.cluster=o,n.properties.dbscan="core"}))})),r.noise.forEach((function(e){var n=t.features[e];n.properties||(n.properties={}),n.properties.cluster?n.properties.dbscan="edge":n.properties.dbscan="noise"})),t},clustersKmeans:function(t,e){void 0===e&&(e={});var n=t.features.length;e.numberOfClusters=e.numberOfClusters||Math.round(Math.sqrt(n/2)),e.numberOfClusters>n&&(e.numberOfClusters=n),!0!==e.mutate&&(t=Bl(t));var r=Ol(t),i=r.slice(0,e.numberOfClusters),o=Tm(r,e.numberOfClusters,i),s={};return o.centroids.forEach((function(t,e){s[e]=t})),Pl(t,(function(t,e){var n=o.idxs[e];t.properties.cluster=n,t.properties.centroid=s[n]})),t},pointToLineDistance:qp,booleanParallel:function(t,e){if(!t)throw new Error("line1 is required");if(!e)throw new Error("line2 is required");if("LineString"!==Qm(t,"line1"))throw new Error("line1 must be a LineString");if("LineString"!==Qm(e,"line2"))throw new Error("line2 must be a LineString");for(var n=Wf(xl(t)).features,r=Wf(xl(e)).features,i=0;i<n.length;i++){var o=n[i].geometry.coordinates;if(!r[i])break;if(!Rm(o,r[i].geometry.coordinates))return!1}return!0},shortestPath:function(t,e,n){if(!bn(n=n||{}))throw new Error("options is invalid");var r=n.resolution,i=n.minDistance,o=n.obstacles||hn([]);if(!t)throw new Error("start is required");if(!e)throw new Error("end is required");if(r&&!wn(r)||r<=0)throw new Error("options.resolution must be a number, greater than 0");if(i)throw new Error("options.minDistance is not yet implemented");var s=Ln(t),a=Ln(e);switch(t=on(s),e=on(a),kn(o)){case"FeatureCollection":if(0===o.features.length)return ln([s,a]);break;case"Polygon":o=hn([nn(Pn(o))]);break;default:throw new Error("invalid obstacles")}var u=o;u.features.push(t),u.features.push(e);var l=Oc(Fv(Ff(Oc(u)),1.15));r||(r=Fn([l[0],l[1]],[l[2],l[1]],n)/100),u.features.pop(),u.features.pop();for(var c=l[0],h=l[1],f=l[2],p=l[3],g=r/Fn([c,h],[f,h],n)*(f-c),A=r/Fn([c,h],[c,p],n)*(p-h),d=f-c,y=p-h,v=Math.floor(d/g),m=Math.floor(y/A),_=(d-v*g)/2,I=[],E=[],x=[],C=[],w=1/0,b=1/0,B=p-(y-m*A)/2,S=0;B>=h;){for(var M=[],L=[],N=c+_,T=0;N<=f;){var R=on([N,B]),Q=Gm(R,o);M.push(Q?0:1),L.push(N+"|"+B);var D=Fn(R,t);!Q&&D<w&&(w=D,x={x:T,y:S});var P=Fn(R,e);!Q&&P<b&&(b=P,C={x:T,y:S}),N+=g,T++}E.push(M),I.push(L),B-=A,S++}var k=new km(E,{diagonal:!0}),O=k.grid[x.y][x.x],F=k.grid[C.y][C.x],G=Pm.search(k,O,F),U=[s];return G.forEach((function(t){var e=I[t.x][t.y].split("|");U.push([+e[0],+e[1]])})),U.push(a),xl(ln(U))},voronoi:function(t,e){if(!bn(e=e||{}))throw new Error("options is invalid");var n=e.bbox||[-180,-85,180,85];if(!t)throw new Error("points is required");if(!Array.isArray(n))throw new Error("bbox is invalid");return Dn(t,"Point","points"),hn(function(){var t=qm,e=jm,n=null;function r(r){return new x_(r.map((function(n,i){var o=[Math.round(t(n,i,r)/__)*__,Math.round(e(n,i,r)/__)*__];return o.index=i,o.data=n,o})),n)}return r.polygons=function(t){return r(t).polygons()},r.links=function(t){return r(t).links()},r.triangles=function(t){return r(t).triangles()},r.x=function(e){return arguments.length?(t="function"==typeof e?e:Um(+e),r):t},r.y=function(t){return arguments.length?(e="function"==typeof t?t:Um(+t),r):e},r.extent=function(t){return arguments.length?(n=null==t?null:[[+t[0][0],+t[0][1]],[+t[1][0],+t[1][1]]],r):n&&[[n[0][0],n[0][1]],[n[1][0],n[1][1]]]},r.size=function(t){return arguments.length?(n=null==t?null:[[0,0],[+t[0],+t[1]]],r):n&&[n[1][0]-n[0][0],n[1][1]-n[0][1]]},r}().x((function(t){return t.geometry.coordinates[0]})).y((function(t){return t.geometry.coordinates[1]})).extent([[n[0],n[1]],[n[2],n[3]]]).polygons(t.features).map(C_))},ellipse:w_,centerMean:B_,centerMedian:function(t,e){if(void 0===e&&(e={}),!bn(e=e||{}))throw new Error("options is invalid");var n=e.counter||10;if(!wn(n))throw new Error("counter must be a number");var r=e.weight,i=B_(t,{weight:e.weight}),o=hn([]);Pl(t,(function(t){var e;o.features.push(Yf(t,{properties:{weight:null===(e=t.properties)||void 0===e?void 0:e[r]}}))}));var s={tolerance:e.tolerance,medianCandidates:[]};return S_(i.geometry.coordinates,[0,0],o,s,n)},standardDeviationalEllipse:function(t,e){if(!bn(e=e||{}))throw new Error("options is invalid");var n=e.steps||64,r=e.weight,i=e.properties||{};if(!wn(n))throw new Error("steps must be a number");if(!bn(i))throw new Error("properties must be a number");var o=Ol(t).length,s=B_(t,{weight:r}),a=0,u=0,l=0;Pl(t,(function(t){var e=t.properties[r]||1,n=M_(Nn(t),Nn(s));a+=Math.pow(n.x,2)*e,u+=Math.pow(n.y,2)*e,l+=n.x*n.y*e}));var c=a-u,h=Math.sqrt(Math.pow(c,2)+4*Math.pow(l,2)),f=2*l,p=Math.atan((c+h)/f),g=180*p/Math.PI,A=0,d=0,y=0;Pl(t,(function(t){var e=t.properties[r]||1,n=M_(Nn(t),Nn(s));A+=Math.pow(n.x*Math.cos(p)-n.y*Math.sin(p),2)*e,d+=Math.pow(n.x*Math.sin(p)+n.y*Math.cos(p),2)*e,y+=e}));var v=Math.sqrt(2*A/y),m=Math.sqrt(2*d/y),_=w_(s,v,m,{units:"degrees",angle:g,steps:n,properties:i}),I=jh(t,hn([_])),E={meanCenterCoordinates:Nn(s),semiMajorAxis:v,semiMinorAxis:m,numberOfFeatures:o,angle:g,percentageWithinEllipse:100*Ol(I).length/o};return _.properties.standardDeviationalEllipse=E,_},angle:function(t,e,n,r){if(void 0===r&&(r={}),!bn(r))throw new Error("options is invalid");if(!t)throw new Error("startPoint is required");if(!e)throw new Error("midPoint is required");if(!n)throw new Error("endPoint is required");var i=t,o=e,s=n,a=_n(!0!==r.mercator?zf(i,o):Cy(i,o)),u=_n(!0!==r.mercator?zf(s,o):Cy(s,o)),l=Math.abs(a-u);return!0===r.explementary?360-l:l},polygonSmooth:function(t,e){var n=[],r=e.iterations||1;if(!t)throw new Error("inputPolys is required");return Fl(t,(function(t,e,i){var o,s,a;switch(t.type){case"Polygon":o=[[]];for(var u=0;u<r;u++)a=[[]],s=t,u>0&&(s=an(o).geometry),L_(s,a),o=a.slice(0);n.push(an(o,i));break;case"MultiPolygon":o=[[[]]];for(var l=0;l<r;l++)a=[[[]]],s=t,l>0&&(s=gn(o).geometry),N_(s,a),o=a.slice(0);n.push(gn(o,i));break;default:throw new Error("geometry is invalid, must be Polygon or MultiPolygon")}})),hn(n)},moranIndex:function(t,e){var n=e.inputField,r=e.threshold||1e5,i=e.p||2,o=e.binary||!1,s=R_(t,{alpha:e.alpha||-1,binary:o,p:i,standardization:e.standardization||!0,threshold:r}),a=[];Pl(t,(function(t){var e=t.properties||{};a.push(e[n])}));for(var u=Q_(a),l=function(t){for(var e=Q_(t),n=0,r=0,i=t;r<i.length;r++){var o=i[r];n+=Math.pow(o-e,2)}return n/t.length}(a),c=0,h=0,f=0,p=0,g=s.length,A=0;A<g;A++){for(var d=0,y=0;y<g;y++)c+=s[A][y]*(a[A]-u)*(a[y]-u),h+=s[A][y],f+=Math.pow(s[A][y]+s[y][A],2),d+=s[A][y]+s[y][A];p+=Math.pow(d,2)}var v=c/h/l,m=-1/(g-1),_=(g*g*(f*=.5)-g*p+h*h*3)/((g-1)*(g+1)*(h*h))-m*m,I=Math.sqrt(_);return{expectedMoranIndex:m,moranIndex:v,stdNorm:I,zNorm:(v-m)/I}},distanceWeight:R_,bearingToAngle:_n,convertDistance:xn,degrees2radians:En,distanceToDegrees:mn,distanceToRadians:vn,radians2degrees:In,radiansToDistance:yn,difference:function(t,e){var n=Pn(t),r=Pn(e),i=t.properties||{},o=YI.difference(n.coordinates,r.coordinates);return 0===o.length?null:1===o.length?an(o[0],i):gn(o,i)},buffer:function(t,e,n){var r=(n=n||{}).units||"kilometers",i=n.steps||8;if(!t)throw new Error("geojson is required");if("object"!=typeof n)throw new Error("options must be an object");if("number"!=typeof i)throw new Error("steps must be an number");if(void 0===e)throw new Error("radius is required");if(i<=0)throw new Error("steps must be greater than 0");var o=[];switch(t.type){case"GeometryCollection":return Fl(t,(function(t){var n=ZS(t,e,r,i);n&&o.push(n)})),hn(o);case"FeatureCollection":return Pl(t,(function(t){var n=ZS(t,e,r,i);n&&Pl(n,(function(t){t&&o.push(t)}))})),hn(o)}return ZS(t,e,r,i)},union:function(t,e,n){void 0===n&&(n={});var r=Pn(t),i=Pn(e),o=YI.union(r.coordinates,i.coordinates);return 0===o.length?null:1===o.length?an(o[0],n.properties):gn(o,n.properties)},intersect:nM,dissolve:function(t,e){if(!bn(e=e||{}))throw new Error("options is invalid");var n=e.propertyName;Dn(t,"Polygon","dissolve");var r=[];if(!e.propertyName)return lg(gn(YI.union.apply(null,t.features.map((function(t){return t.geometry.coordinates})))));var i={};Pl(t,(function(t){Object.prototype.hasOwnProperty.call(i,t.properties[n])||(i[t.properties[n]]=[]),i[t.properties[n]].push(t)}));for(var o=Object.keys(i),s=0;s<o.length;s++){var a=gn(YI.union.apply(null,i[o[s]].map((function(t){return t.geometry.coordinates}))));a.properties[n]=o[s],r.push(a)}return lg(hn(r))},hexGrid:rM,mask:function(t,e){var n,r,i=aM(e),o=null;return"FeatureCollection"===t.type?(r=2===(n=t).features.length?YI.union(n.features[0].geometry.coordinates,n.features[1].geometry.coordinates):YI.union.apply(YI,n.features.map((function(t){return t.geometry.coordinates}))),o=sM(r)):o=sM(YI.union(t.geometry.coordinates)),o.geometry.coordinates.forEach((function(t){i.geometry.coordinates.push(t[0])})),i},squareGrid:uM,triangleGrid:lM,interpolate:function(t,e,n){if("object"!=typeof(n=n||{}))throw new Error("options is invalid");var r=n.gridType,i=n.property,o=n.weight;if(!t)throw new Error("points is required");if(Dn(t,"Point","input must contain Points"),!e)throw new Error("cellSize is required");if(void 0!==o&&"number"!=typeof o)throw new Error("weight must be a number");i=i||"elevation",r=r||"square",o=o||1;var s,a=Oc(t);switch(r){case"point":case"points":s=ag(a,e,n);break;case"square":case"squares":s=uM(a,e,n);break;case"hex":case"hexes":s=rM(a,e,n);break;case"triangle":case"triangles":s=lM(a,e,n);break;default:throw new Error("invalid gridType")}var u=[];return Pl(s,(function(e){var s=0,a=0;Pl(t,(function(t){var u,l=Fn("point"===r?e:Yf(e),t,n);if(void 0!==i&&(u=t.properties[i]),void 0===u&&(u=t.geometry.coordinates[2]),void 0===u)throw new Error("zValue is missing");0===l&&(s=u);var c=1/Math.pow(l,o);a+=c,s+=c*u}));var l=Bl(e);l.properties[i]=s/a,u.push(l)})),hn(u)},toMercator:D_,toWgs84:P_,randomPosition:q_,randomPoint:j_,randomPolygon:z_,randomLineString:V_,getCluster:J_,clusterEach:W_,clusterReduce:K_,createBins:Z_,applyFilter:$_,propertiesContainsFilter:tI,filterProperties:eI,earthRadius:Ze,factors:$e,unitsFactors:tn,areaFactors:en,feature:nn,geometry:rn,point:on,points:sn,polygon:an,polygons:un,lineString:ln,lineStrings:cn,featureCollection:hn,multiLineString:fn,multiPoint:pn,multiPolygon:gn,geometryCollection:An,round:dn,radiansToLength:yn,lengthToRadians:vn,lengthToDegrees:mn,bearingToAzimuth:_n,radiansToDegrees:In,degreesToRadians:En,convertLength:xn,convertArea:Cn,isNumber:wn,isObject:bn,validateBBox:Bn,validateId:Sn,getCoord:Ln,getCoords:Nn,containsNumber:Tn,geojsonType:Rn,featureOf:Qn,collectionOf:Dn,getGeom:Pn,getType:kn,coordAll:Ol,coordEach:Tl,coordReduce:Rl,featureEach:Pl,featureReduce:kl,findPoint:Xl,findSegment:Hl,flattenEach:Ul,flattenReduce:ql,geomEach:Fl,geomReduce:Gl,lineEach:Vl,lineReduce:Yl,propEach:Ql,propReduce:Dl,segmentEach:jl,segmentReduce:zl});export{_l as Arrow3D,kc as CoordinateTransform,sl as LineGeometry,Ou as LineMaterial,He as TextureAnimator,Pc as drawTool,jn as gisCommon,La as gltfLoadClass,Oe as imgClass,Dc as layerClass,vl as line2Object,De as lineLength,pl as planeGifClass,sr as planeMark,Xe as planeSectorClass,Qc as polygonClass,Ue as radarClass,Qu as rippleWallClass,ze as sectorClass,Ke as shockClass,Se as sleep,Ba as tileClass,Il as tripHeight,El as tripLineClass,dl as tubeClass,cM as turf,cl as verticalFatLineClass};
|
|
158
|
+
***************************************************************************** */function rI(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(o){return function(a){return function(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=s.trys,(i=i.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}}([o,a])}}}var iI=function(t,e){this.next=null,this.key=t,this.data=e,this.left=null,this.right=null};function oI(t,e){return t>e?1:t<e?-1:0}function sI(t,e,n){for(var r=new iI(null,null),i=r,o=r;;){var s=n(t,e.key);if(s<0){if(null===e.left)break;if(n(t,e.left.key)<0){var a=e.left;if(e.left=a.right,a.right=e,null===(e=a).left)break}o.left=e,o=e,e=e.left}else{if(!(s>0))break;if(null===e.right)break;if(n(t,e.right.key)>0){a=e.right;if(e.right=a.left,a.left=e,null===(e=a).right)break}i.right=e,i=e,e=e.right}}return i.right=e.left,o.left=e.right,e.left=r.right,e.right=r.left,e}function aI(t,e,n,r){var i=new iI(t,e);if(null===n)return i.left=i.right=null,i;var o=r(t,(n=sI(t,n,r)).key);return o<0?(i.left=n.left,i.right=n,n.left=null):o>=0&&(i.right=n.right,i.left=n,n.right=null),i}function uI(t,e,n){var r=null,i=null;if(e){var o=n((e=sI(t,e,n)).key,t);0===o?(r=e.left,i=e.right):o<0?(i=e.right,e.right=null,r=e):(r=e.left,e.left=null,i=e)}return{left:r,right:i}}function lI(t,e,n,r,i){if(t){r(e+(n?"└── ":"├── ")+i(t)+"\n");var o=e+(n?" ":"│ ");t.left&&lI(t.left,o,!1,r,i),t.right&&lI(t.right,o,!0,r,i)}}var cI=function(){function t(t){void 0===t&&(t=oI),this._root=null,this._size=0,this._comparator=t}return t.prototype.insert=function(t,e){return this._size++,this._root=aI(t,e,this._root,this._comparator)},t.prototype.add=function(t,e){var n=new iI(t,e);null===this._root&&(n.left=n.right=null,this._size++,this._root=n);var r=this._comparator,i=sI(t,this._root,r),o=r(t,i.key);return 0===o?this._root=i:(o<0?(n.left=i.left,n.right=i,i.left=null):o>0&&(n.right=i.right,n.left=i,i.right=null),this._size++,this._root=n),this._root},t.prototype.remove=function(t){this._root=this._remove(t,this._root,this._comparator)},t.prototype._remove=function(t,e,n){var r;return null===e?null:0===n(t,(e=sI(t,e,n)).key)?(null===e.left?r=e.right:(r=sI(t,e.left,n)).right=e.right,this._size--,r):e},t.prototype.pop=function(){var t=this._root;if(t){for(;t.left;)t=t.left;return this._root=sI(t.key,this._root,this._comparator),this._root=this._remove(t.key,this._root,this._comparator),{key:t.key,data:t.data}}return null},t.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},t.prototype.find=function(t){return this._root&&(this._root=sI(t,this._root,this._comparator),0!==this._comparator(t,this._root.key))?null:this._root},t.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},t.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},t.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},t.prototype.keys=function(){var t=[];return this.forEach((function(e){var n=e.key;return t.push(n)})),t},t.prototype.values=function(){var t=[];return this.forEach((function(e){var n=e.data;return t.push(n)})),t},t.prototype.min=function(){return this._root?this.minNode(this._root).key:null},t.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},t.prototype.minNode=function(t){if(void 0===t&&(t=this._root),t)for(;t.left;)t=t.left;return t},t.prototype.maxNode=function(t){if(void 0===t&&(t=this._root),t)for(;t.right;)t=t.right;return t},t.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},t.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},t.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},t.prototype.clear=function(){return this._root=null,this._size=0,this},t.prototype.toList=function(){return function(t){var e=t,n=[],r=!1,i=new iI(null,null),o=i;for(;!r;)e?(n.push(e),e=e.left):n.length>0?e=(e=o=o.next=n.pop()).right:r=!0;return o.next=null,i.next}(this._root)},t.prototype.load=function(t,e,n){void 0===e&&(e=[]),void 0===n&&(n=!1);var r=t.length,i=this._comparator;if(n&&pI(t,e,0,r-1,i),null===this._root)this._root=hI(t,e,0,r),this._size=r;else{var o=function(t,e,n){var r=new iI(null,null),i=r,o=t,s=e;for(;null!==o&&null!==s;)n(o.key,s.key)<0?(i.next=o,o=o.next):(i.next=s,s=s.next),i=i.next;null!==o?i.next=o:null!==s&&(i.next=s);return r.next}(this.toList(),function(t,e){for(var n=new iI(null,null),r=n,i=0;i<t.length;i++)r=r.next=new iI(t[i],e[i]);return r.next=null,n.next}(t,e),i);r=this._size+r,this._root=fI({head:o},0,r)}return this},t.prototype.isEmpty=function(){return null===this._root},Object.defineProperty(t.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),t.prototype.toString=function(t){void 0===t&&(t=function(t){return String(t.key)});var e=[];return lI(this._root,"",!0,(function(t){return e.push(t)}),t),e.join("")},t.prototype.update=function(t,e,n){var r=this._comparator,i=uI(t,this._root,r),o=i.left,s=i.right;r(t,e)<0?s=aI(e,n,s,r):o=aI(e,n,o,r),this._root=function(t,e,n){return null===e?t:(null===t||((e=sI(t.key,e,n)).left=t),e)}(o,s,r)},t.prototype.split=function(t){return uI(t,this._root,this._comparator)},t.prototype[Symbol.iterator]=function(){var t,e,n;return rI(this,(function(r){switch(r.label){case 0:t=this._root,e=[],n=!1,r.label=1;case 1:return n?[3,6]:null===t?[3,2]:(e.push(t),t=t.left,[3,5]);case 2:return 0===e.length?[3,4]:[4,t=e.pop()];case 3:return r.sent(),t=t.right,[3,5];case 4:n=!0,r.label=5;case 5:return[3,1];case 6:return[2]}}))},t}();function hI(t,e,n,r){var i=r-n;if(i>0){var o=n+Math.floor(i/2),s=t[o],a=e[o],u=new iI(s,a);return u.left=hI(t,e,n,o),u.right=hI(t,e,o+1,r),u}return null}function fI(t,e,n){var r=n-e;if(r>0){var i=e+Math.floor(r/2),o=fI(t,e,i),s=t.head;return s.left=o,t.head=t.head.next,s.right=fI(t,i+1,n),s}return null}function pI(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 u=t[s];t[s]=t[a],t[a]=u,u=e[s],e[s]=e[a],e[a]=u}pI(t,e,n,a,i),pI(t,e,a+1,r,i)}}function gI(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function AI(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function dI(t,e,n){return e&&AI(t.prototype,e),n&&AI(t,n),t}var yI=function(t,e){return t.ll.x<=e.x&&e.x<=t.ur.x&&t.ll.y<=e.y&&e.y<=t.ur.y},vI=function(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;var 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}}},mI=Number.EPSILON;void 0===mI&&(mI=Math.pow(2,-52));var _I=mI*mI,II=function(t,e){if(-mI<t&&t<mI&&-mI<e&&e<mI)return 0;var n=t-e;return n*n<_I*t*e?0:t<e?-1:1},EI=function(){function t(){gI(this,t),this.reset()}return dI(t,[{key:"reset",value:function(){this.xRounder=new xI,this.yRounder=new xI}},{key:"round",value:function(t,e){return{x:this.xRounder.round(t),y:this.yRounder.round(e)}}}]),t}(),xI=function(){function t(){gI(this,t),this.tree=new cI,this.round(0)}return dI(t,[{key:"round",value:function(t){var e=this.tree.add(t),n=this.tree.prev(e);if(null!==n&&0===II(e.key,n.key))return this.tree.remove(t),n.key;var r=this.tree.next(e);return null!==r&&0===II(e.key,r.key)?(this.tree.remove(t),r.key):t}}]),t}(),CI=new EI,wI=function(t,e){return t.x*e.y-t.y*e.x},bI=function(t,e){return t.x*e.x+t.y*e.y},BI=function(t,e,n){var r={x:e.x-t.x,y:e.y-t.y},i={x:n.x-t.x,y:n.y-t.y},o=wI(r,i);return II(o,0)},SI=function(t){return Math.sqrt(bI(t,t))},MI=function(t,e,n){var r={x:e.x-t.x,y:e.y-t.y},i={x:n.x-t.x,y:n.y-t.y};return bI(i,r)/SI(i)/SI(r)},LI=function(t,e,n){return 0===e.y?null:{x:t.x+e.x/e.y*(n-t.y),y:n}},NI=function(t,e,n){return 0===e.x?null:{x:n,y:t.y+e.y/e.x*(n-t.x)}},TI=function(){function t(e,n){gI(this,t),void 0===e.events?e.events=[this]:e.events.push(this),this.point=e,this.isLeft=n}return dI(t,null,[{key:"compare",value:function(e,n){var r=t.comparePoints(e.point,n.point);return 0!==r?r:(e.point!==n.point&&e.link(n),e.isLeft!==n.isLeft?e.isLeft?1:-1:QI.compare(e.segment,n.segment))}},{key:"comparePoints",value:function(t,e){return t.x<e.x?-1:t.x>e.x?1:t.y<e.y?-1:t.y>e.y?1:0}}]),dI(t,[{key:"link",value:function(t){if(t.point===this.point)throw new Error("Tried to link already linked events");for(var e=t.point.events,n=0,r=e.length;n<r;n++){var i=e[n];this.point.events.push(i),i.point=this.point}this.checkForConsuming()}},{key:"checkForConsuming",value:function(){for(var t=this.point.events.length,e=0;e<t;e++){var n=this.point.events[e];if(void 0===n.segment.consumedBy)for(var r=e+1;r<t;r++){var i=this.point.events[r];void 0===i.consumedBy&&(n.otherSE.point.events===i.otherSE.point.events&&n.segment.consume(i.segment))}}}},{key:"getAvailableLinkedEvents",value:function(){for(var t=[],e=0,n=this.point.events.length;e<n;e++){var r=this.point.events[e];r!==this&&!r.segment.ringOut&&r.segment.isInResult()&&t.push(r)}return t}},{key:"getLeftmostComparator",value:function(t){var e=this,n=new Map,r=function(r){var i,o,s,a,u,l=r.otherSE;n.set(r,{sine:(i=e.point,o=t.point,s=l.point,a={x:o.x-i.x,y:o.y-i.y},u={x:s.x-i.x,y:s.y-i.y},wI(u,a)/SI(u)/SI(a)),cosine:MI(e.point,t.point,l.point)})};return function(t,e){n.has(t)||r(t),n.has(e)||r(e);var i=n.get(t),o=i.sine,s=i.cosine,a=n.get(e),u=a.sine,l=a.cosine;return o>=0&&u>=0?s<l?1:s>l?-1:0:o<0&&u<0?s<l?-1:s>l?1:0:u<o?-1:u>o?1:0}}}]),t}(),RI=0,QI=function(){function t(e,n,r,i){gI(this,t),this.id=++RI,this.leftSE=e,e.segment=this,e.otherSE=n,this.rightSE=n,n.segment=this,n.otherSE=e,this.rings=r,this.windings=i}return dI(t,null,[{key:"compare",value:function(t,e){var 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;var s=t.leftSE.point.y,a=e.leftSE.point.y,u=t.rightSE.point.y,l=e.rightSE.point.y;if(n<r){if(a<s&&a<u)return 1;if(a>s&&a>u)return-1;var c=t.comparePoint(e.leftSE.point);if(c<0)return 1;if(c>0)return-1;var h=e.comparePoint(t.rightSE.point);return 0!==h?h:-1}if(n>r){if(s<a&&s<l)return-1;if(s>a&&s>l)return 1;var f=e.comparePoint(t.leftSE.point);if(0!==f)return f;var p=t.comparePoint(e.rightSE.point);return p<0?1:p>0?-1:1}if(s<a)return-1;if(s>a)return 1;if(i<o){var g=e.comparePoint(t.rightSE.point);if(0!==g)return g}if(i>o){var A=t.comparePoint(e.rightSE.point);if(A<0)return 1;if(A>0)return-1}if(i!==o){var d=u-s,y=i-n,v=l-a,m=o-r;if(d>y&&v<m)return 1;if(d<y&&v>m)return-1}return i>o?1:i<o||u<l?-1:u>l?1:t.id<e.id?-1:t.id>e.id?1:0}}]),dI(t,[{key:"replaceRightSE",value:function(t){this.rightSE=t,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}},{key:"bbox",value:function(){var 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}}}},{key:"vector",value:function(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}},{key:"isAnEndpoint",value:function(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}},{key:"comparePoint",value:function(t){if(this.isAnEndpoint(t))return 0;var 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;var i=(t.y-e.y)/r.y,o=e.x+i*r.x;if(t.x===o)return 0;var s=(t.x-e.x)/r.x,a=e.y+s*r.y;return t.y===a?0:t.y<a?-1:1}},{key:"getIntersection",value:function(t){var e=this.bbox(),n=t.bbox(),r=vI(e,n);if(null===r)return null;var i=this.leftSE.point,o=this.rightSE.point,s=t.leftSE.point,a=t.rightSE.point,u=yI(e,s)&&0===this.comparePoint(s),l=yI(n,i)&&0===t.comparePoint(i),c=yI(e,a)&&0===this.comparePoint(a),h=yI(n,o)&&0===t.comparePoint(o);if(l&&u)return h&&!c?o:!h&&c?a:null;if(l)return c&&i.x===a.x&&i.y===a.y?null:i;if(u)return h&&o.x===s.x&&o.y===s.y?null:s;if(h&&c)return null;if(h)return o;if(c)return a;var f=function(t,e,n,r){if(0===e.x)return NI(n,r,t.x);if(0===r.x)return NI(t,e,n.x);if(0===e.y)return LI(n,r,t.y);if(0===r.y)return LI(t,e,n.y);var i=wI(e,r);if(0==i)return null;var o={x:n.x-t.x,y:n.y-t.y},s=wI(o,e)/i,a=wI(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}}(i,this.vector(),s,t.vector());return null===f?null:yI(r,f)?CI.round(f.x,f.y):null}},{key:"split",value:function(e){var n=[],r=void 0!==e.events,i=new TI(e,!0),o=new TI(e,!1),s=this.rightSE;this.replaceRightSE(o),n.push(o),n.push(i);var a=new t(i,s,this.rings.slice(),this.windings.slice());return TI.comparePoints(a.leftSE.point,a.rightSE.point)>0&&a.swapEvents(),TI.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),r&&(i.checkForConsuming(),o.checkForConsuming()),n}},{key:"swapEvents",value:function(){var t=this.rightSE;this.rightSE=this.leftSE,this.leftSE=t,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(var e=0,n=this.windings.length;e<n;e++)this.windings[e]*=-1}},{key:"consume",value:function(e){for(var n=this,r=e;n.consumedBy;)n=n.consumedBy;for(;r.consumedBy;)r=r.consumedBy;var i=t.compare(n,r);if(0!==i){if(i>0){var o=n;n=r,r=o}if(n.prev===r){var s=n;n=r,r=s}for(var a=0,u=r.rings.length;a<u;a++){var l=r.rings[a],c=r.windings[a],h=n.rings.indexOf(l);-1===h?(n.rings.push(l),n.windings.push(c)):n.windings[h]+=c}r.rings=null,r.windings=null,r.consumedBy=n,r.leftSE.consumedBy=n.leftSE,r.rightSE.consumedBy=n.rightSE}}},{key:"prevInResult",value:function(){return void 0!==this._prevInResult||(this.prev?this.prev.isInResult()?this._prevInResult=this.prev:this._prevInResult=this.prev.prevInResult():this._prevInResult=null),this._prevInResult}},{key:"beforeState",value:function(){if(void 0!==this._beforeState)return this._beforeState;if(this.prev){var t=this.prev.consumedBy||this.prev;this._beforeState=t.afterState()}else this._beforeState={rings:[],windings:[],multiPolys:[]};return this._beforeState}},{key:"afterState",value:function(){if(void 0!==this._afterState)return this._afterState;var t=this.beforeState();this._afterState={rings:t.rings.slice(0),windings:t.windings.slice(0),multiPolys:[]};for(var e=this._afterState.rings,n=this._afterState.windings,r=this._afterState.multiPolys,i=0,o=this.rings.length;i<o;i++){var s=this.rings[i],a=this.windings[i],u=e.indexOf(s);-1===u?(e.push(s),n.push(a)):n[u]+=a}for(var l=[],c=[],h=0,f=e.length;h<f;h++)if(0!==n[h]){var p=e[h],g=p.poly;if(-1===c.indexOf(g))if(p.isExterior)l.push(g);else{-1===c.indexOf(g)&&c.push(g);var A=l.indexOf(p.poly);-1!==A&&l.splice(A,1)}}for(var d=0,y=l.length;d<y;d++){var v=l[d].multiPoly;-1===r.indexOf(v)&&r.push(v)}return this._afterState}},{key:"isInResult",value:function(){if(this.consumedBy)return!1;if(void 0!==this._isInResult)return this._isInResult;var t=this.beforeState().multiPolys,e=this.afterState().multiPolys;switch(VI.type){case"union":var n=0===t.length,r=0===e.length;this._isInResult=n!==r;break;case"intersection":var i,o;t.length<e.length?(i=t.length,o=e.length):(i=e.length,o=t.length),this._isInResult=o===VI.numMultiPolys&&i<o;break;case"xor":var s=Math.abs(t.length-e.length);this._isInResult=s%2==1;break;case"difference":var a=function(t){return 1===t.length&&t[0].isSubject};this._isInResult=a(t)!==a(e);break;default:throw new Error("Unrecognized operation type found ".concat(VI.type))}return this._isInResult}}],[{key:"fromRing",value:function(e,n,r){var i,o,s,a=TI.comparePoints(e,n);if(a<0)i=e,o=n,s=1;else{if(!(a>0))throw new Error("Tried to create degenerate segment at [".concat(e.x,", ").concat(e.y,"]"));i=n,o=e,s=-1}return new t(new TI(i,!0),new TI(o,!1),[r],[s])}}]),t}(),DI=function(){function t(e,n,r){if(gI(this,t),!Array.isArray(e)||0===e.length)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=n,this.isExterior=r,this.segments=[],"number"!=typeof e[0][0]||"number"!=typeof e[0][1])throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var i=CI.round(e[0][0],e[0][1]);this.bbox={ll:{x:i.x,y:i.y},ur:{x:i.x,y:i.y}};for(var o=i,s=1,a=e.length;s<a;s++){if("number"!=typeof e[s][0]||"number"!=typeof e[s][1])throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var u=CI.round(e[s][0],e[s][1]);u.x===o.x&&u.y===o.y||(this.segments.push(QI.fromRing(o,u,this)),u.x<this.bbox.ll.x&&(this.bbox.ll.x=u.x),u.y<this.bbox.ll.y&&(this.bbox.ll.y=u.y),u.x>this.bbox.ur.x&&(this.bbox.ur.x=u.x),u.y>this.bbox.ur.y&&(this.bbox.ur.y=u.y),o=u)}i.x===o.x&&i.y===o.y||this.segments.push(QI.fromRing(o,i,this))}return dI(t,[{key:"getSweepEvents",value:function(){for(var t=[],e=0,n=this.segments.length;e<n;e++){var r=this.segments[e];t.push(r.leftSE),t.push(r.rightSE)}return t}}]),t}(),PI=function(){function t(e,n){if(gI(this,t),!Array.isArray(e))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new DI(e[0],this,!0),this.bbox={ll:{x:this.exteriorRing.bbox.ll.x,y:this.exteriorRing.bbox.ll.y},ur:{x:this.exteriorRing.bbox.ur.x,y:this.exteriorRing.bbox.ur.y}},this.interiorRings=[];for(var r=1,i=e.length;r<i;r++){var o=new DI(e[r],this,!1);o.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=o.bbox.ll.x),o.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=o.bbox.ll.y),o.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=o.bbox.ur.x),o.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=o.bbox.ur.y),this.interiorRings.push(o)}this.multiPoly=n}return dI(t,[{key:"getSweepEvents",value:function(){for(var t=this.exteriorRing.getSweepEvents(),e=0,n=this.interiorRings.length;e<n;e++)for(var r=this.interiorRings[e].getSweepEvents(),i=0,o=r.length;i<o;i++)t.push(r[i]);return t}}]),t}(),kI=function(){function t(e,n){if(gI(this,t),!Array.isArray(e))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{"number"==typeof e[0][0][0]&&(e=[e])}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(var r=0,i=e.length;r<i;r++){var o=new PI(e[r],this);o.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=o.bbox.ll.x),o.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=o.bbox.ll.y),o.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=o.bbox.ur.x),o.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=o.bbox.ur.y),this.polys.push(o)}this.isSubject=n}return dI(t,[{key:"getSweepEvents",value:function(){for(var t=[],e=0,n=this.polys.length;e<n;e++)for(var r=this.polys[e].getSweepEvents(),i=0,o=r.length;i<o;i++)t.push(r[i]);return t}}]),t}(),OI=function(){function t(e){gI(this,t),this.events=e;for(var n=0,r=e.length;n<r;n++)e[n].segment.ringOut=this;this.poly=null}return dI(t,null,[{key:"factory",value:function(e){for(var n=[],r=0,i=e.length;r<i;r++){var o=e[r];if(o.isInResult()&&!o.ringOut){for(var s=null,a=o.leftSE,u=o.rightSE,l=[a],c=a.point,h=[];s=a,a=u,l.push(a),a.point!==c;)for(;;){var f=a.getAvailableLinkedEvents();if(0===f.length){var p=l[0].point,g=l[l.length-1].point;throw new Error("Unable to complete output ring starting at [".concat(p.x,",")+" ".concat(p.y,"]. Last matching segment found ends at")+" [".concat(g.x,", ").concat(g.y,"]."))}if(1===f.length){u=f[0].otherSE;break}for(var A=null,d=0,y=h.length;d<y;d++)if(h[d].point===a.point){A=d;break}if(null===A){h.push({index:l.length,point:a.point});var v=a.getLeftmostComparator(s);u=f.sort(v)[0].otherSE;break}var m=h.splice(A)[0],_=l.splice(m.index);_.unshift(_[0].otherSE),n.push(new t(_.reverse()))}n.push(new t(l))}}return n}}]),dI(t,[{key:"getGeom",value:function(){for(var t=this.events[0].point,e=[t],n=1,r=this.events.length-1;n<r;n++){var i=this.events[n].point,o=this.events[n+1].point;0!==BI(i,t,o)&&(e.push(i),t=i)}if(1===e.length)return null;var s=e[0],a=e[1];0===BI(s,t,a)&&e.shift(),e.push(e[0]);for(var u=this.isExteriorRing()?1:-1,l=this.isExteriorRing()?0:e.length-1,c=this.isExteriorRing()?e.length:-1,h=[],f=l;f!=c;f+=u)h.push([e[f].x,e[f].y]);return h}},{key:"isExteriorRing",value:function(){if(void 0===this._isExteriorRing){var t=this.enclosingRing();this._isExteriorRing=!t||!t.isExteriorRing()}return this._isExteriorRing}},{key:"enclosingRing",value:function(){return void 0===this._enclosingRing&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}},{key:"_calcEnclosingRing",value:function(){for(var t=this.events[0],e=1,n=this.events.length;e<n;e++){var r=this.events[e];TI.compare(t,r)>0&&(t=r)}for(var i=t.segment.prevInResult(),o=i?i.prevInResult():null;;){if(!i)return null;if(!o)return i.ringOut;if(o.ringOut!==i.ringOut)return o.ringOut.enclosingRing()!==i.ringOut?i.ringOut:i.ringOut.enclosingRing();i=o.prevInResult(),o=i?i.prevInResult():null}}}]),t}(),FI=function(){function t(e){gI(this,t),this.exteriorRing=e,e.poly=this,this.interiorRings=[]}return dI(t,[{key:"addInterior",value:function(t){this.interiorRings.push(t),t.poly=this}},{key:"getGeom",value:function(){var t=[this.exteriorRing.getGeom()];if(null===t[0])return null;for(var e=0,n=this.interiorRings.length;e<n;e++){var r=this.interiorRings[e].getGeom();null!==r&&t.push(r)}return t}}]),t}(),GI=function(){function t(e){gI(this,t),this.rings=e,this.polys=this._composePolys(e)}return dI(t,[{key:"getGeom",value:function(){for(var t=[],e=0,n=this.polys.length;e<n;e++){var r=this.polys[e].getGeom();null!==r&&t.push(r)}return t}},{key:"_composePolys",value:function(t){for(var e=[],n=0,r=t.length;n<r;n++){var i=t[n];if(!i.poly)if(i.isExteriorRing())e.push(new FI(i));else{var o=i.enclosingRing();o.poly||e.push(new FI(o)),o.poly.addInterior(i)}}return e}}]),t}(),UI=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:QI.compare;gI(this,t),this.queue=e,this.tree=new cI(n),this.segments=[]}return dI(t,[{key:"process",value:function(t){var e=t.segment,n=[];if(t.consumedBy)return t.isLeft?this.queue.remove(t.otherSE):this.tree.remove(e),n;var r=t.isLeft?this.tree.insert(e):this.tree.find(e);if(!r)throw new Error("Unable to find segment #".concat(e.id," ")+"[".concat(e.leftSE.point.x,", ").concat(e.leftSE.point.y,"] -> ")+"[".concat(e.rightSE.point.x,", ").concat(e.rightSE.point.y,"] ")+"in SweepLine tree. Please submit a bug report.");for(var i=r,o=r,s=void 0,a=void 0;void 0===s;)null===(i=this.tree.prev(i))?s=null:void 0===i.key.consumedBy&&(s=i.key);for(;void 0===a;)null===(o=this.tree.next(o))?a=null:void 0===o.key.consumedBy&&(a=o.key);if(t.isLeft){var u=null;if(s){var l=s.getIntersection(e);if(null!==l&&(e.isAnEndpoint(l)||(u=l),!s.isAnEndpoint(l)))for(var c=this._splitSafely(s,l),h=0,f=c.length;h<f;h++)n.push(c[h])}var p=null;if(a){var g=a.getIntersection(e);if(null!==g&&(e.isAnEndpoint(g)||(p=g),!a.isAnEndpoint(g)))for(var A=this._splitSafely(a,g),d=0,y=A.length;d<y;d++)n.push(A[d])}if(null!==u||null!==p){var v=null;if(null===u)v=p;else if(null===p)v=u;else{v=TI.comparePoints(u,p)<=0?u:p}this.queue.remove(e.rightSE),n.push(e.rightSE);for(var m=e.split(v),_=0,I=m.length;_<I;_++)n.push(m[_])}n.length>0?(this.tree.remove(e),n.push(t)):(this.segments.push(e),e.prev=s)}else{if(s&&a){var E=s.getIntersection(a);if(null!==E){if(!s.isAnEndpoint(E))for(var x=this._splitSafely(s,E),C=0,w=x.length;C<w;C++)n.push(x[C]);if(!a.isAnEndpoint(E))for(var b=this._splitSafely(a,E),B=0,S=b.length;B<S;B++)n.push(b[B])}}this.tree.remove(e)}return n}},{key:"_splitSafely",value:function(t,e){this.tree.remove(t);var n=t.rightSE;this.queue.remove(n);var r=t.split(e);return r.push(n),void 0===t.consumedBy&&this.tree.insert(t),r}}]),t}(),qI="undefined"!=typeof process&&process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,jI="undefined"!=typeof process&&process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6,zI=function(){function t(){gI(this,t)}return dI(t,[{key:"run",value:function(t,e,n){VI.type=t,CI.reset();for(var r=[new kI(e,!0)],i=0,o=n.length;i<o;i++)r.push(new kI(n[i],!1));if(VI.numMultiPolys=r.length,"difference"===VI.type)for(var s=r[0],a=1;a<r.length;)null!==vI(r[a].bbox,s.bbox)?a++:r.splice(a,1);if("intersection"===VI.type)for(var u=0,l=r.length;u<l;u++)for(var c=r[u],h=u+1,f=r.length;h<f;h++)if(null===vI(c.bbox,r[h].bbox))return[];for(var p=new cI(TI.compare),g=0,A=r.length;g<A;g++)for(var d=r[g].getSweepEvents(),y=0,v=d.length;y<v;y++)if(p.insert(d[y]),p.size>qI)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big). Please file a bug report.");for(var m=new UI(p),_=p.size,I=p.pop();I;){var E=I.key;if(p.size===_){var x=E.segment;throw new Error("Unable to pop() ".concat(E.isLeft?"left":"right"," SweepEvent ")+"[".concat(E.point.x,", ").concat(E.point.y,"] from segment #").concat(x.id," ")+"[".concat(x.leftSE.point.x,", ").concat(x.leftSE.point.y,"] -> ")+"[".concat(x.rightSE.point.x,", ").concat(x.rightSE.point.y,"] from queue. ")+"Please file a bug report.")}if(p.size>qI)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big). Please file a bug report.");if(m.segments.length>jI)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");for(var C=m.process(E),w=0,b=C.length;w<b;w++){var B=C[w];void 0===B.consumedBy&&p.insert(B)}_=p.size,I=p.pop()}CI.reset();var S=OI.factory(m.segments);return new GI(S).getGeom()}}]),t}(),VI=new zI,YI={union: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 VI.run("union",t,n)},intersection: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 VI.run("intersection",t,n)},xor: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 VI.run("xor",t,n)},difference: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 VI.run("difference",t,n)}};"fill"in Array.prototype||Object.defineProperty(Array.prototype,"fill",{configurable:!0,value:function(t){if(null==this)throw new TypeError(this+" is not an object");var e=Object(this),n=Math.max(Math.min(e.length,9007199254740991),0)||0,r=1 in arguments&&parseInt(Number(arguments[1]),10)||0;r=r<0?Math.max(n+r,0):Math.min(r,n);var i=2 in arguments&&void 0!==arguments[2]?parseInt(Number(arguments[2]),10)||0:n;for(i=i<0?Math.max(n+arguments[2],0):Math.min(i,n);r<i;)e[r]=t,++r;return e},writable:!0}),Number.isFinite=Number.isFinite||function(t){return"number"==typeof t&&isFinite(t)},Number.isInteger=Number.isInteger||function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t},Number.parseFloat=Number.parseFloat||parseFloat,Number.isNaN=Number.isNaN||function(t){return t!=t},Math.trunc=Math.trunc||function(t){return t<0?Math.ceil(t):Math.floor(t)};var HI=function(){};HI.prototype.interfaces_=function(){return[]},HI.prototype.getClass=function(){return HI},HI.prototype.equalsWithTolerance=function(t,e,n){return Math.abs(t-e)<=n};var XI=function(t){function e(e){t.call(this,e),this.name="IllegalArgumentException",this.message=e,this.stack=(new t).stack}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Error),JI=function(){},WI={MAX_VALUE:{configurable:!0}};JI.isNaN=function(t){return Number.isNaN(t)},JI.doubleToLongBits=function(t){return t},JI.longBitsToDouble=function(t){return t},JI.isInfinite=function(t){return!Number.isFinite(t)},WI.MAX_VALUE.get=function(){return Number.MAX_VALUE},Object.defineProperties(JI,WI);var KI=function(){},ZI=function(){},$I=function(){};function tE(){}var eE=function t(){if(this.x=null,this.y=null,this.z=null,0===arguments.length)this.x=0,this.y=0,this.z=t.NULL_ORDINATE;else if(1===arguments.length){var e=arguments[0];this.x=e.x,this.y=e.y,this.z=e.z}else 2===arguments.length?(this.x=arguments[0],this.y=arguments[1],this.z=t.NULL_ORDINATE):3===arguments.length&&(this.x=arguments[0],this.y=arguments[1],this.z=arguments[2])},nE={DimensionalComparator:{configurable:!0},serialVersionUID:{configurable:!0},NULL_ORDINATE:{configurable:!0},X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0}};eE.prototype.setOrdinate=function(t,e){switch(t){case eE.X:this.x=e;break;case eE.Y:this.y=e;break;case eE.Z:this.z=e;break;default:throw new XI("Invalid ordinate index: "+t)}},eE.prototype.equals2D=function(){if(1===arguments.length){var t=arguments[0];return this.x===t.x&&this.y===t.y}if(2===arguments.length){var e=arguments[0],n=arguments[1];return!!HI.equalsWithTolerance(this.x,e.x,n)&&!!HI.equalsWithTolerance(this.y,e.y,n)}},eE.prototype.getOrdinate=function(t){switch(t){case eE.X:return this.x;case eE.Y:return this.y;case eE.Z:return this.z}throw new XI("Invalid ordinate index: "+t)},eE.prototype.equals3D=function(t){return this.x===t.x&&this.y===t.y&&(this.z===t.z||JI.isNaN(this.z))&&JI.isNaN(t.z)},eE.prototype.equals=function(t){return t instanceof eE&&this.equals2D(t)},eE.prototype.equalInZ=function(t,e){return HI.equalsWithTolerance(this.z,t.z,e)},eE.prototype.compareTo=function(t){var e=t;return this.x<e.x?-1:this.x>e.x?1:this.y<e.y?-1:this.y>e.y?1:0},eE.prototype.clone=function(){},eE.prototype.copy=function(){return new eE(this)},eE.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},eE.prototype.distance3D=function(t){var e=this.x-t.x,n=this.y-t.y,r=this.z-t.z;return Math.sqrt(e*e+n*n+r*r)},eE.prototype.distance=function(t){var e=this.x-t.x,n=this.y-t.y;return Math.sqrt(e*e+n*n)},eE.prototype.hashCode=function(){var t=17;return t=37*(t=37*t+eE.hashCode(this.x))+eE.hashCode(this.y)},eE.prototype.setCoordinate=function(t){this.x=t.x,this.y=t.y,this.z=t.z},eE.prototype.interfaces_=function(){return[KI,ZI,tE]},eE.prototype.getClass=function(){return eE},eE.hashCode=function(){if(1===arguments.length){var t=JI.doubleToLongBits(arguments[0]);return Math.trunc((t^t)>>>32)}},nE.DimensionalComparator.get=function(){return rE},nE.serialVersionUID.get=function(){return 0x5cbf2c235c7e5800},nE.NULL_ORDINATE.get=function(){return JI.NaN},nE.X.get=function(){return 0},nE.Y.get=function(){return 1},nE.Z.get=function(){return 2},Object.defineProperties(eE,nE);var rE=function(t){if(this._dimensionsToTest=2,0===arguments.length);else if(1===arguments.length){var e=arguments[0];if(2!==e&&3!==e)throw new XI("only 2 or 3 dimensions may be specified");this._dimensionsToTest=e}};rE.prototype.compare=function(t,e){var n=t,r=e,i=rE.compare(n.x,r.x);if(0!==i)return i;var o=rE.compare(n.y,r.y);return 0!==o?o:this._dimensionsToTest<=2?0:rE.compare(n.z,r.z)},rE.prototype.interfaces_=function(){return[$I]},rE.prototype.getClass=function(){return rE},rE.compare=function(t,e){return t<e?-1:t>e?1:JI.isNaN(t)?JI.isNaN(e)?0:-1:JI.isNaN(e)?1:0};var iE=function(){};iE.prototype.create=function(){},iE.prototype.interfaces_=function(){return[]},iE.prototype.getClass=function(){return iE};var oE=function(){},sE={INTERIOR:{configurable:!0},BOUNDARY:{configurable:!0},EXTERIOR:{configurable:!0},NONE:{configurable:!0}};oE.prototype.interfaces_=function(){return[]},oE.prototype.getClass=function(){return oE},oE.toLocationSymbol=function(t){switch(t){case oE.EXTERIOR:return"e";case oE.BOUNDARY:return"b";case oE.INTERIOR:return"i";case oE.NONE:return"-"}throw new XI("Unknown location value: "+t)},sE.INTERIOR.get=function(){return 0},sE.BOUNDARY.get=function(){return 1},sE.EXTERIOR.get=function(){return 2},sE.NONE.get=function(){return-1},Object.defineProperties(oE,sE);var aE=function(t,e){return t.interfaces_&&t.interfaces_().indexOf(e)>-1},uE=function(){},lE={LOG_10:{configurable:!0}};uE.prototype.interfaces_=function(){return[]},uE.prototype.getClass=function(){return uE},uE.log10=function(t){var e=Math.log(t);return JI.isInfinite(e)||JI.isNaN(e)?e:e/uE.LOG_10},uE.min=function(t,e,n,r){var i=t;return e<i&&(i=e),n<i&&(i=n),r<i&&(i=r),i},uE.clamp=function(){if("number"==typeof arguments[2]&&"number"==typeof arguments[0]&&"number"==typeof arguments[1]){var t=arguments[0],e=arguments[1],n=arguments[2];return t<e?e:t>n?n:t}if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var r=arguments[0],i=arguments[1],o=arguments[2];return r<i?i:r>o?o:r}},uE.wrap=function(t,e){return t<0?e- -t%e:t%e},uE.max=function(){if(3===arguments.length){var t=arguments[1],e=arguments[2],n=arguments[0];return t>n&&(n=t),e>n&&(n=e),n}if(4===arguments.length){var r=arguments[1],i=arguments[2],o=arguments[3],s=arguments[0];return r>s&&(s=r),i>s&&(s=i),o>s&&(s=o),s}},uE.average=function(t,e){return(t+e)/2},lE.LOG_10.get=function(){return Math.log(10)},Object.defineProperties(uE,lE);var cE=function(t){this.str=t};cE.prototype.append=function(t){this.str+=t},cE.prototype.setCharAt=function(t,e){this.str=this.str.substr(0,t)+e+this.str.substr(t+1)},cE.prototype.toString=function(t){return this.str};var hE=function(t){this.value=t};hE.prototype.intValue=function(){return this.value},hE.prototype.compareTo=function(t){return this.value<t?-1:this.value>t?1:0},hE.isNaN=function(t){return Number.isNaN(t)};var fE=function(){};fE.isWhitespace=function(t){return t<=32&&t>=0||127===t},fE.toUpperCase=function(t){return t.toUpperCase()};var pE=function t(){if(this._hi=0,this._lo=0,0===arguments.length)this.init(0);else if(1===arguments.length){if("number"==typeof arguments[0]){var e=arguments[0];this.init(e)}else if(arguments[0]instanceof t){var n=arguments[0];this.init(n)}else if("string"==typeof arguments[0]){t.call(this,t.parse(arguments[0]))}}else if(2===arguments.length){var r=arguments[0],i=arguments[1];this.init(r,i)}},gE={PI:{configurable:!0},TWO_PI:{configurable:!0},PI_2:{configurable:!0},E:{configurable:!0},NaN:{configurable:!0},EPS:{configurable:!0},SPLIT:{configurable:!0},MAX_PRINT_DIGITS:{configurable:!0},TEN:{configurable:!0},ONE:{configurable:!0},SCI_NOT_EXPONENT_CHAR:{configurable:!0},SCI_NOT_ZERO:{configurable:!0}};pE.prototype.le=function(t){return(this._hi<t._hi||this._hi===t._hi)&&this._lo<=t._lo},pE.prototype.extractSignificantDigits=function(t,e){var n=this.abs(),r=pE.magnitude(n._hi),i=pE.TEN.pow(r);(n=n.divide(i)).gt(pE.TEN)?(n=n.divide(pE.TEN),r+=1):n.lt(pE.ONE)&&(n=n.multiply(pE.TEN),r-=1);for(var o=r+1,s=new cE,a=pE.MAX_PRINT_DIGITS-1,u=0;u<=a;u++){t&&u===o&&s.append(".");var l=Math.trunc(n._hi);if(l<0)break;var c=!1,h=0;l>9?(c=!0,h="9"):h="0"+l,s.append(h),n=n.subtract(pE.valueOf(l)).multiply(pE.TEN),c&&n.selfAdd(pE.TEN);var f=!0,p=pE.magnitude(n._hi);if(p<0&&Math.abs(p)>=a-u&&(f=!1),!f)break}return e[0]=r,s.toString()},pE.prototype.sqr=function(){return this.multiply(this)},pE.prototype.doubleValue=function(){return this._hi+this._lo},pE.prototype.subtract=function(){if(arguments[0]instanceof pE){var t=arguments[0];return this.add(t.negate())}if("number"==typeof arguments[0]){var e=arguments[0];return this.add(-e)}},pE.prototype.equals=function(){if(1===arguments.length){var t=arguments[0];return this._hi===t._hi&&this._lo===t._lo}},pE.prototype.isZero=function(){return 0===this._hi&&0===this._lo},pE.prototype.selfSubtract=function(){if(arguments[0]instanceof pE){var t=arguments[0];return this.isNaN()?this:this.selfAdd(-t._hi,-t._lo)}if("number"==typeof arguments[0]){var e=arguments[0];return this.isNaN()?this:this.selfAdd(-e,0)}},pE.prototype.getSpecialNumberString=function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null},pE.prototype.min=function(t){return this.le(t)?this:t},pE.prototype.selfDivide=function(){if(1===arguments.length){if(arguments[0]instanceof pE){var t=arguments[0];return this.selfDivide(t._hi,t._lo)}if("number"==typeof arguments[0]){var e=arguments[0];return this.selfDivide(e,0)}}else if(2===arguments.length){var n,r,i,o,s=arguments[0],a=arguments[1],u=null,l=null,c=null,h=null;return i=this._hi/s,h=(u=(c=pE.SPLIT*i)-(u=c-i))*(l=(h=pE.SPLIT*s)-(l=h-s))-(o=i*s)+u*(r=s-l)+(n=i-u)*l+n*r,h=i+(c=(this._hi-o-h+this._lo-i*a)/s),this._hi=h,this._lo=i-h+c,this}},pE.prototype.dump=function(){return"DD<"+this._hi+", "+this._lo+">"},pE.prototype.divide=function(){if(arguments[0]instanceof pE){var t,e,n,r,i=arguments[0],o=null,s=null,a=null,u=null;return t=(n=this._hi/i._hi)-(o=(a=pE.SPLIT*n)-(o=a-n)),u=o*(s=(u=pE.SPLIT*i._hi)-(s=u-i._hi))-(r=n*i._hi)+o*(e=i._hi-s)+t*s+t*e,a=(this._hi-r-u+this._lo-n*i._lo)/i._hi,new pE(u=n+a,n-u+a)}if("number"==typeof arguments[0]){var l=arguments[0];return JI.isNaN(l)?pE.createNaN():pE.copy(this).selfDivide(l,0)}},pE.prototype.ge=function(t){return(this._hi>t._hi||this._hi===t._hi)&&this._lo>=t._lo},pE.prototype.pow=function(t){if(0===t)return pE.valueOf(1);var e=new pE(this),n=pE.valueOf(1),r=Math.abs(t);if(r>1)for(;r>0;)r%2==1&&n.selfMultiply(e),(r/=2)>0&&(e=e.sqr());else n=e;return t<0?n.reciprocal():n},pE.prototype.ceil=function(){if(this.isNaN())return pE.NaN;var t=Math.ceil(this._hi),e=0;return t===this._hi&&(e=Math.ceil(this._lo)),new pE(t,e)},pE.prototype.compareTo=function(t){var e=t;return this._hi<e._hi?-1:this._hi>e._hi?1:this._lo<e._lo?-1:this._lo>e._lo?1:0},pE.prototype.rint=function(){return this.isNaN()?this:this.add(.5).floor()},pE.prototype.setValue=function(){if(arguments[0]instanceof pE){var t=arguments[0];return this.init(t),this}if("number"==typeof arguments[0]){var e=arguments[0];return this.init(e),this}},pE.prototype.max=function(t){return this.ge(t)?this:t},pE.prototype.sqrt=function(){if(this.isZero())return pE.valueOf(0);if(this.isNegative())return pE.NaN;var t=1/Math.sqrt(this._hi),e=this._hi*t,n=pE.valueOf(e),r=this.subtract(n.sqr())._hi*(.5*t);return n.add(r)},pE.prototype.selfAdd=function(){if(1===arguments.length){if(arguments[0]instanceof pE){var t=arguments[0];return this.selfAdd(t._hi,t._lo)}if("number"==typeof arguments[0]){var e,n,r,i,o,s=arguments[0],a=null;return a=(r=this._hi+s)-(i=r-this._hi),n=(o=(a=s-i+(this._hi-a))+this._lo)+(r-(e=r+o)),this._hi=e+n,this._lo=n+(e-this._hi),this}}else if(2===arguments.length){var u,l,c,h,f=arguments[0],p=arguments[1],g=null,A=null,d=null;c=this._hi+f,l=this._lo+p,A=c-(d=c-this._hi),g=l-(h=l-this._lo);var y=(u=c+(d=(A=f-d+(this._hi-A))+l))+(d=(g=p-h+(this._lo-g))+(d+(c-u))),v=d+(u-y);return this._hi=y,this._lo=v,this}},pE.prototype.selfMultiply=function(){if(1===arguments.length){if(arguments[0]instanceof pE){var t=arguments[0];return this.selfMultiply(t._hi,t._lo)}if("number"==typeof arguments[0]){var e=arguments[0];return this.selfMultiply(e,0)}}else if(2===arguments.length){var n,r,i=arguments[0],o=arguments[1],s=null,a=null,u=null,l=null;s=(u=pE.SPLIT*this._hi)-this._hi,l=pE.SPLIT*i,s=u-s,n=this._hi-s,a=l-i;var c=(u=this._hi*i)+(l=s*(a=l-a)-u+s*(r=i-a)+n*a+n*r+(this._hi*o+this._lo*i)),h=l+(s=u-c);return this._hi=c,this._lo=h,this}},pE.prototype.selfSqr=function(){return this.selfMultiply(this)},pE.prototype.floor=function(){if(this.isNaN())return pE.NaN;var t=Math.floor(this._hi),e=0;return t===this._hi&&(e=Math.floor(this._lo)),new pE(t,e)},pE.prototype.negate=function(){return this.isNaN()?this:new pE(-this._hi,-this._lo)},pE.prototype.clone=function(){},pE.prototype.multiply=function(){if(arguments[0]instanceof pE){var t=arguments[0];return t.isNaN()?pE.createNaN():pE.copy(this).selfMultiply(t)}if("number"==typeof arguments[0]){var e=arguments[0];return JI.isNaN(e)?pE.createNaN():pE.copy(this).selfMultiply(e,0)}},pE.prototype.isNaN=function(){return JI.isNaN(this._hi)},pE.prototype.intValue=function(){return Math.trunc(this._hi)},pE.prototype.toString=function(){var t=pE.magnitude(this._hi);return t>=-3&&t<=20?this.toStandardNotation():this.toSciNotation()},pE.prototype.toStandardNotation=function(){var t=this.getSpecialNumberString();if(null!==t)return t;var e=new Array(1).fill(null),n=this.extractSignificantDigits(!0,e),r=e[0]+1,i=n;if("."===n.charAt(0))i="0"+n;else if(r<0)i="0."+pE.stringOfChar("0",-r)+n;else if(-1===n.indexOf(".")){var o=r-n.length;i=n+pE.stringOfChar("0",o)+".0"}return this.isNegative()?"-"+i:i},pE.prototype.reciprocal=function(){var t,e,n,r,i=null,o=null,s=null,a=null;t=(n=1/this._hi)-(i=(s=pE.SPLIT*n)-(i=s-n)),o=(a=pE.SPLIT*this._hi)-this._hi;var u=n+(s=(1-(r=n*this._hi)-(a=i*(o=a-o)-r+i*(e=this._hi-o)+t*o+t*e)-n*this._lo)/this._hi);return new pE(u,n-u+s)},pE.prototype.toSciNotation=function(){if(this.isZero())return pE.SCI_NOT_ZERO;var t=this.getSpecialNumberString();if(null!==t)return t;var e=new Array(1).fill(null),n=this.extractSignificantDigits(!1,e),r=pE.SCI_NOT_EXPONENT_CHAR+e[0];if("0"===n.charAt(0))throw new Error("Found leading zero: "+n);var i="";n.length>1&&(i=n.substring(1));var o=n.charAt(0)+"."+i;return this.isNegative()?"-"+o+r:o+r},pE.prototype.abs=function(){return this.isNaN()?pE.NaN:this.isNegative()?this.negate():new pE(this)},pE.prototype.isPositive=function(){return(this._hi>0||0===this._hi)&&this._lo>0},pE.prototype.lt=function(t){return(this._hi<t._hi||this._hi===t._hi)&&this._lo<t._lo},pE.prototype.add=function(){if(arguments[0]instanceof pE){var t=arguments[0];return pE.copy(this).selfAdd(t)}if("number"==typeof arguments[0]){var e=arguments[0];return pE.copy(this).selfAdd(e)}},pE.prototype.init=function(){if(1===arguments.length){if("number"==typeof arguments[0]){var t=arguments[0];this._hi=t,this._lo=0}else if(arguments[0]instanceof pE){var e=arguments[0];this._hi=e._hi,this._lo=e._lo}}else if(2===arguments.length){var n=arguments[0],r=arguments[1];this._hi=n,this._lo=r}},pE.prototype.gt=function(t){return(this._hi>t._hi||this._hi===t._hi)&&this._lo>t._lo},pE.prototype.isNegative=function(){return(this._hi<0||0===this._hi)&&this._lo<0},pE.prototype.trunc=function(){return this.isNaN()?pE.NaN:this.isPositive()?this.floor():this.ceil()},pE.prototype.signum=function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0},pE.prototype.interfaces_=function(){return[tE,KI,ZI]},pE.prototype.getClass=function(){return pE},pE.sqr=function(t){return pE.valueOf(t).selfMultiply(t)},pE.valueOf=function(){return"string"==typeof arguments[0]?pE.parse(arguments[0]):"number"==typeof arguments[0]?new pE(arguments[0]):void 0},pE.sqrt=function(t){return pE.valueOf(t).sqrt()},pE.parse=function(t){for(var e=0,n=t.length;fE.isWhitespace(t.charAt(e));)e++;var r=!1;if(e<n){var i=t.charAt(e);"-"!==i&&"+"!==i||(e++,"-"===i&&(r=!0))}for(var o=new pE,s=0,a=0,u=0;!(e>=n);){var l=t.charAt(e);if(e++,fE.isDigit(l)){var c=l-"0";o.selfMultiply(pE.TEN),o.selfAdd(c),s++}else{if("."!==l){if("e"===l||"E"===l){var h=t.substring(e);try{u=hE.parseInt(h)}catch(e){throw e instanceof Error?new Error("Invalid exponent "+h+" in string "+t):e}break}throw new Error("Unexpected character '"+l+"' at position "+e+" in string "+t)}a=s}}var f=o,p=s-a-u;if(0===p)f=o;else if(p>0){var g=pE.TEN.pow(p);f=o.divide(g)}else if(p<0){var A=pE.TEN.pow(-p);f=o.multiply(A)}return r?f.negate():f},pE.createNaN=function(){return new pE(JI.NaN,JI.NaN)},pE.copy=function(t){return new pE(t)},pE.magnitude=function(t){var e=Math.abs(t),n=Math.log(e)/Math.log(10),r=Math.trunc(Math.floor(n));return 10*Math.pow(10,r)<=e&&(r+=1),r},pE.stringOfChar=function(t,e){for(var n=new cE,r=0;r<e;r++)n.append(t);return n.toString()},gE.PI.get=function(){return new pE(3.141592653589793,12246467991473532e-32)},gE.TWO_PI.get=function(){return new pE(6.283185307179586,24492935982947064e-32)},gE.PI_2.get=function(){return new pE(1.5707963267948966,6123233995736766e-32)},gE.E.get=function(){return new pE(2.718281828459045,14456468917292502e-32)},gE.NaN.get=function(){return new pE(JI.NaN,JI.NaN)},gE.EPS.get=function(){return 123259516440783e-46},gE.SPLIT.get=function(){return 134217729},gE.MAX_PRINT_DIGITS.get=function(){return 32},gE.TEN.get=function(){return pE.valueOf(10)},gE.ONE.get=function(){return pE.valueOf(1)},gE.SCI_NOT_EXPONENT_CHAR.get=function(){return"E"},gE.SCI_NOT_ZERO.get=function(){return"0.0E0"},Object.defineProperties(pE,gE);var AE=function(){},dE={DP_SAFE_EPSILON:{configurable:!0}};AE.prototype.interfaces_=function(){return[]},AE.prototype.getClass=function(){return AE},AE.orientationIndex=function(t,e,n){var r=AE.orientationIndexFilter(t,e,n);if(r<=1)return r;var i=pE.valueOf(e.x).selfAdd(-t.x),o=pE.valueOf(e.y).selfAdd(-t.y),s=pE.valueOf(n.x).selfAdd(-e.x),a=pE.valueOf(n.y).selfAdd(-e.y);return i.selfMultiply(a).selfSubtract(o.selfMultiply(s)).signum()},AE.signOfDet2x2=function(t,e,n,r){return t.multiply(r).selfSubtract(e.multiply(n)).signum()},AE.intersection=function(t,e,n,r){var i=pE.valueOf(r.y).selfSubtract(n.y).selfMultiply(pE.valueOf(e.x).selfSubtract(t.x)),o=pE.valueOf(r.x).selfSubtract(n.x).selfMultiply(pE.valueOf(e.y).selfSubtract(t.y)),s=i.subtract(o),a=pE.valueOf(r.x).selfSubtract(n.x).selfMultiply(pE.valueOf(t.y).selfSubtract(n.y)),u=pE.valueOf(r.y).selfSubtract(n.y).selfMultiply(pE.valueOf(t.x).selfSubtract(n.x)),l=a.subtract(u).selfDivide(s).doubleValue(),c=pE.valueOf(t.x).selfAdd(pE.valueOf(e.x).selfSubtract(t.x).selfMultiply(l)).doubleValue(),h=pE.valueOf(e.x).selfSubtract(t.x).selfMultiply(pE.valueOf(t.y).selfSubtract(n.y)),f=pE.valueOf(e.y).selfSubtract(t.y).selfMultiply(pE.valueOf(t.x).selfSubtract(n.x)),p=h.subtract(f).selfDivide(s).doubleValue(),g=pE.valueOf(n.y).selfAdd(pE.valueOf(r.y).selfSubtract(n.y).selfMultiply(p)).doubleValue();return new eE(c,g)},AE.orientationIndexFilter=function(t,e,n){var r=null,i=(t.x-n.x)*(e.y-n.y),o=(t.y-n.y)*(e.x-n.x),s=i-o;if(i>0){if(o<=0)return AE.signum(s);r=i+o}else{if(!(i<0))return AE.signum(s);if(o>=0)return AE.signum(s);r=-i-o}var a=AE.DP_SAFE_EPSILON*r;return s>=a||-s>=a?AE.signum(s):2},AE.signum=function(t){return t>0?1:t<0?-1:0},dE.DP_SAFE_EPSILON.get=function(){return 1e-15},Object.defineProperties(AE,dE);var yE=function(){},vE={X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0},M:{configurable:!0}};vE.X.get=function(){return 0},vE.Y.get=function(){return 1},vE.Z.get=function(){return 2},vE.M.get=function(){return 3},yE.prototype.setOrdinate=function(t,e,n){},yE.prototype.size=function(){},yE.prototype.getOrdinate=function(t,e){},yE.prototype.getCoordinate=function(){},yE.prototype.getCoordinateCopy=function(t){},yE.prototype.getDimension=function(){},yE.prototype.getX=function(t){},yE.prototype.clone=function(){},yE.prototype.expandEnvelope=function(t){},yE.prototype.copy=function(){},yE.prototype.getY=function(t){},yE.prototype.toCoordinateArray=function(){},yE.prototype.interfaces_=function(){return[ZI]},yE.prototype.getClass=function(){return yE},Object.defineProperties(yE,vE);var mE=function(){},_E=function(t){function e(){t.call(this,"Projective point not representable on the Cartesian plane.")}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(mE),IE=function(){};IE.arraycopy=function(t,e,n,r,i){for(var o=0,s=e;s<e+i;s++)n[r+o]=t[s],o++},IE.getProperty=function(t){return{"line.separator":"\n"}[t]};var EE=function t(){if(this.x=null,this.y=null,this.w=null,0===arguments.length)this.x=0,this.y=0,this.w=1;else if(1===arguments.length){var e=arguments[0];this.x=e.x,this.y=e.y,this.w=1}else if(2===arguments.length){if("number"==typeof arguments[0]&&"number"==typeof arguments[1]){var n=arguments[0],r=arguments[1];this.x=n,this.y=r,this.w=1}else if(arguments[0]instanceof t&&arguments[1]instanceof t){var i=arguments[0],o=arguments[1];this.x=i.y*o.w-o.y*i.w,this.y=o.x*i.w-i.x*o.w,this.w=i.x*o.y-o.x*i.y}else if(arguments[0]instanceof eE&&arguments[1]instanceof eE){var s=arguments[0],a=arguments[1];this.x=s.y-a.y,this.y=a.x-s.x,this.w=s.x*a.y-a.x*s.y}}else if(3===arguments.length){var u=arguments[0],l=arguments[1],c=arguments[2];this.x=u,this.y=l,this.w=c}else if(4===arguments.length){var h=arguments[0],f=arguments[1],p=arguments[2],g=arguments[3],A=h.y-f.y,d=f.x-h.x,y=h.x*f.y-f.x*h.y,v=p.y-g.y,m=g.x-p.x,_=p.x*g.y-g.x*p.y;this.x=d*_-m*y,this.y=v*y-A*_,this.w=A*m-v*d}};EE.prototype.getY=function(){var t=this.y/this.w;if(JI.isNaN(t)||JI.isInfinite(t))throw new _E;return t},EE.prototype.getX=function(){var t=this.x/this.w;if(JI.isNaN(t)||JI.isInfinite(t))throw new _E;return t},EE.prototype.getCoordinate=function(){var t=new eE;return t.x=this.getX(),t.y=this.getY(),t},EE.prototype.interfaces_=function(){return[]},EE.prototype.getClass=function(){return EE},EE.intersection=function(t,e,n,r){var i=t.y-e.y,o=e.x-t.x,s=t.x*e.y-e.x*t.y,a=n.y-r.y,u=r.x-n.x,l=n.x*r.y-r.x*n.y,c=i*u-a*o,h=(o*l-u*s)/c,f=(a*s-i*l)/c;if(JI.isNaN(h)||JI.isInfinite(h)||JI.isNaN(f)||JI.isInfinite(f))throw new _E;return new eE(h,f)};var xE=function t(){if(this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,0===arguments.length)this.init();else if(1===arguments.length){if(arguments[0]instanceof eE){var e=arguments[0];this.init(e.x,e.x,e.y,e.y)}else if(arguments[0]instanceof t){var n=arguments[0];this.init(n)}}else if(2===arguments.length){var r=arguments[0],i=arguments[1];this.init(r.x,i.x,r.y,i.y)}else if(4===arguments.length){var o=arguments[0],s=arguments[1],a=arguments[2],u=arguments[3];this.init(o,s,a,u)}},CE={serialVersionUID:{configurable:!0}};xE.prototype.getArea=function(){return this.getWidth()*this.getHeight()},xE.prototype.equals=function(t){if(!(t instanceof xE))return!1;var e=t;return this.isNull()?e.isNull():this._maxx===e.getMaxX()&&this._maxy===e.getMaxY()&&this._minx===e.getMinX()&&this._miny===e.getMinY()},xE.prototype.intersection=function(t){if(this.isNull()||t.isNull()||!this.intersects(t))return new xE;var e=this._minx>t._minx?this._minx:t._minx,n=this._miny>t._miny?this._miny:t._miny,r=this._maxx<t._maxx?this._maxx:t._maxx,i=this._maxy<t._maxy?this._maxy:t._maxy;return new xE(e,r,n,i)},xE.prototype.isNull=function(){return this._maxx<this._minx},xE.prototype.getMaxX=function(){return this._maxx},xE.prototype.covers=function(){if(1===arguments.length){if(arguments[0]instanceof eE){var t=arguments[0];return this.covers(t.x,t.y)}if(arguments[0]instanceof xE){var e=arguments[0];return!this.isNull()&&!e.isNull()&&(e.getMinX()>=this._minx&&e.getMaxX()<=this._maxx&&e.getMinY()>=this._miny&&e.getMaxY()<=this._maxy)}}else if(2===arguments.length){var n=arguments[0],r=arguments[1];return!this.isNull()&&(n>=this._minx&&n<=this._maxx&&r>=this._miny&&r<=this._maxy)}},xE.prototype.intersects=function(){if(1===arguments.length){if(arguments[0]instanceof xE){var t=arguments[0];return!this.isNull()&&!t.isNull()&&!(t._minx>this._maxx||t._maxx<this._minx||t._miny>this._maxy||t._maxy<this._miny)}if(arguments[0]instanceof eE){var e=arguments[0];return this.intersects(e.x,e.y)}}else if(2===arguments.length){var n=arguments[0],r=arguments[1];return!this.isNull()&&!(n>this._maxx||n<this._minx||r>this._maxy||r<this._miny)}},xE.prototype.getMinY=function(){return this._miny},xE.prototype.getMinX=function(){return this._minx},xE.prototype.expandToInclude=function(){if(1===arguments.length){if(arguments[0]instanceof eE){var t=arguments[0];this.expandToInclude(t.x,t.y)}else if(arguments[0]instanceof xE){var e=arguments[0];if(e.isNull())return null;this.isNull()?(this._minx=e.getMinX(),this._maxx=e.getMaxX(),this._miny=e.getMinY(),this._maxy=e.getMaxY()):(e._minx<this._minx&&(this._minx=e._minx),e._maxx>this._maxx&&(this._maxx=e._maxx),e._miny<this._miny&&(this._miny=e._miny),e._maxy>this._maxy&&(this._maxy=e._maxy))}}else if(2===arguments.length){var n=arguments[0],r=arguments[1];this.isNull()?(this._minx=n,this._maxx=n,this._miny=r,this._maxy=r):(n<this._minx&&(this._minx=n),n>this._maxx&&(this._maxx=n),r<this._miny&&(this._miny=r),r>this._maxy&&(this._maxy=r))}},xE.prototype.minExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return t<e?t:e},xE.prototype.getWidth=function(){return this.isNull()?0:this._maxx-this._minx},xE.prototype.compareTo=function(t){var e=t;return this.isNull()?e.isNull()?0:-1:e.isNull()?1:this._minx<e._minx?-1:this._minx>e._minx?1:this._miny<e._miny?-1:this._miny>e._miny?1:this._maxx<e._maxx?-1:this._maxx>e._maxx?1:this._maxy<e._maxy?-1:this._maxy>e._maxy?1:0},xE.prototype.translate=function(t,e){if(this.isNull())return null;this.init(this.getMinX()+t,this.getMaxX()+t,this.getMinY()+e,this.getMaxY()+e)},xE.prototype.toString=function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"},xE.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1},xE.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny},xE.prototype.maxExtent=function(){if(this.isNull())return 0;var t=this.getWidth(),e=this.getHeight();return t>e?t:e},xE.prototype.expandBy=function(){if(1===arguments.length){var t=arguments[0];this.expandBy(t,t)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];if(this.isNull())return null;this._minx-=e,this._maxx+=e,this._miny-=n,this._maxy+=n,(this._minx>this._maxx||this._miny>this._maxy)&&this.setToNull()}},xE.prototype.contains=function(){if(1===arguments.length){if(arguments[0]instanceof xE){var t=arguments[0];return this.covers(t)}if(arguments[0]instanceof eE){var e=arguments[0];return this.covers(e)}}else if(2===arguments.length){var n=arguments[0],r=arguments[1];return this.covers(n,r)}},xE.prototype.centre=function(){return this.isNull()?null:new eE((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)},xE.prototype.init=function(){if(0===arguments.length)this.setToNull();else if(1===arguments.length){if(arguments[0]instanceof eE){var t=arguments[0];this.init(t.x,t.x,t.y,t.y)}else if(arguments[0]instanceof xE){var e=arguments[0];this._minx=e._minx,this._maxx=e._maxx,this._miny=e._miny,this._maxy=e._maxy}}else if(2===arguments.length){var n=arguments[0],r=arguments[1];this.init(n.x,r.x,n.y,r.y)}else if(4===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3];i<o?(this._minx=i,this._maxx=o):(this._minx=o,this._maxx=i),s<a?(this._miny=s,this._maxy=a):(this._miny=a,this._maxy=s)}},xE.prototype.getMaxY=function(){return this._maxy},xE.prototype.distance=function(t){if(this.intersects(t))return 0;var e=0;this._maxx<t._minx?e=t._minx-this._maxx:this._minx>t._maxx&&(e=this._minx-t._maxx);var n=0;return this._maxy<t._miny?n=t._miny-this._maxy:this._miny>t._maxy&&(n=this._miny-t._maxy),0===e?n:0===n?e:Math.sqrt(e*e+n*n)},xE.prototype.hashCode=function(){var t=17;return t=37*(t=37*(t=37*(t=37*t+eE.hashCode(this._minx))+eE.hashCode(this._maxx))+eE.hashCode(this._miny))+eE.hashCode(this._maxy)},xE.prototype.interfaces_=function(){return[KI,tE]},xE.prototype.getClass=function(){return xE},xE.intersects=function(){if(3===arguments.length){var t=arguments[0],e=arguments[1],n=arguments[2];return n.x>=(t.x<e.x?t.x:e.x)&&n.x<=(t.x>e.x?t.x:e.x)&&n.y>=(t.y<e.y?t.y:e.y)&&n.y<=(t.y>e.y?t.y:e.y)}if(4===arguments.length){var r=arguments[0],i=arguments[1],o=arguments[2],s=arguments[3],a=Math.min(o.x,s.x),u=Math.max(o.x,s.x),l=Math.min(r.x,i.x),c=Math.max(r.x,i.x);return!(l>u)&&(!(c<a)&&(a=Math.min(o.y,s.y),u=Math.max(o.y,s.y),l=Math.min(r.y,i.y),c=Math.max(r.y,i.y),!(l>u)&&!(c<a)))}},CE.serialVersionUID.get=function(){return 0x51845cd552189800},Object.defineProperties(xE,CE);var wE={typeStr:/^\s*(\w+)\s*\(\s*(.*)\s*\)\s*$/,emptyTypeStr:/^\s*(\w+)\s*EMPTY\s*$/,spaces:/\s+/,parenComma:/\)\s*,\s*\(/,doubleParenComma:/\)\s*\)\s*,\s*\(\s*\(/,trimParens:/^\s*\(?(.*?)\)?\s*$/},bE=function(t){this.geometryFactory=t||new hC};bE.prototype.read=function(t){var e,n,r;t=t.replace(/[\n\r]/g," ");var i=wE.typeStr.exec(t);if(-1!==t.search("EMPTY")&&((i=wE.emptyTypeStr.exec(t))[2]=void 0),i&&(n=i[1].toLowerCase(),r=i[2],SE[n]&&(e=SE[n].apply(this,[r]))),void 0===e)throw new Error("Could not parse WKT "+t);return e},bE.prototype.write=function(t){return this.extractGeometry(t)},bE.prototype.extractGeometry=function(t){var e=t.getGeometryType().toLowerCase();if(!BE[e])return null;var n=e.toUpperCase();return t.isEmpty()?n+" EMPTY":n+"("+BE[e].apply(this,[t])+")"};var BE={coordinate:function(t){return t.x+" "+t.y},point:function(t){return BE.coordinate.call(this,t._coordinates._coordinates[0])},multipoint:function(t){for(var e=[],n=0,r=t._geometries.length;n<r;++n)e.push("("+BE.point.apply(this,[t._geometries[n]])+")");return e.join(",")},linestring:function(t){for(var e=[],n=0,r=t._points._coordinates.length;n<r;++n)e.push(BE.coordinate.apply(this,[t._points._coordinates[n]]));return e.join(",")},linearring:function(t){for(var e=[],n=0,r=t._points._coordinates.length;n<r;++n)e.push(BE.coordinate.apply(this,[t._points._coordinates[n]]));return e.join(",")},multilinestring:function(t){for(var e=[],n=0,r=t._geometries.length;n<r;++n)e.push("("+BE.linestring.apply(this,[t._geometries[n]])+")");return e.join(",")},polygon:function(t){var e=[];e.push("("+BE.linestring.apply(this,[t._shell])+")");for(var n=0,r=t._holes.length;n<r;++n)e.push("("+BE.linestring.apply(this,[t._holes[n]])+")");return e.join(",")},multipolygon:function(t){for(var e=[],n=0,r=t._geometries.length;n<r;++n)e.push("("+BE.polygon.apply(this,[t._geometries[n]])+")");return e.join(",")},geometrycollection:function(t){for(var e=[],n=0,r=t._geometries.length;n<r;++n)e.push(this.extractGeometry(t._geometries[n]));return e.join(",")}},SE={point:function(t){if(void 0===t)return this.geometryFactory.createPoint();var e=t.trim().split(wE.spaces);return this.geometryFactory.createPoint(new eE(Number.parseFloat(e[0]),Number.parseFloat(e[1])))},multipoint:function(t){var e;if(void 0===t)return this.geometryFactory.createMultiPoint();for(var n=t.trim().split(","),r=[],i=0,o=n.length;i<o;++i)e=n[i].replace(wE.trimParens,"$1"),r.push(SE.point.apply(this,[e]));return this.geometryFactory.createMultiPoint(r)},linestring:function(t){if(void 0===t)return this.geometryFactory.createLineString();for(var e,n=t.trim().split(","),r=[],i=0,o=n.length;i<o;++i)e=n[i].trim().split(wE.spaces),r.push(new eE(Number.parseFloat(e[0]),Number.parseFloat(e[1])));return this.geometryFactory.createLineString(r)},linearring:function(t){if(void 0===t)return this.geometryFactory.createLinearRing();for(var e,n=t.trim().split(","),r=[],i=0,o=n.length;i<o;++i)e=n[i].trim().split(wE.spaces),r.push(new eE(Number.parseFloat(e[0]),Number.parseFloat(e[1])));return this.geometryFactory.createLinearRing(r)},multilinestring:function(t){var e;if(void 0===t)return this.geometryFactory.createMultiLineString();for(var n=t.trim().split(wE.parenComma),r=[],i=0,o=n.length;i<o;++i)e=n[i].replace(wE.trimParens,"$1"),r.push(SE.linestring.apply(this,[e]));return this.geometryFactory.createMultiLineString(r)},polygon:function(t){var e,n,r;if(void 0===t)return this.geometryFactory.createPolygon();for(var i,o=t.trim().split(wE.parenComma),s=[],a=0,u=o.length;a<u;++a)e=o[a].replace(wE.trimParens,"$1"),n=SE.linestring.apply(this,[e]),r=this.geometryFactory.createLinearRing(n._points),0===a?i=r:s.push(r);return this.geometryFactory.createPolygon(i,s)},multipolygon:function(t){var e;if(void 0===t)return this.geometryFactory.createMultiPolygon();for(var n=t.trim().split(wE.doubleParenComma),r=[],i=0,o=n.length;i<o;++i)e=n[i].replace(wE.trimParens,"$1"),r.push(SE.polygon.apply(this,[e]));return this.geometryFactory.createMultiPolygon(r)},geometrycollection:function(t){if(void 0===t)return this.geometryFactory.createGeometryCollection();for(var e=(t=t.replace(/,\s*([A-Za-z])/g,"|$1")).trim().split("|"),n=[],r=0,i=e.length;r<i;++r)n.push(this.read(e[r]));return this.geometryFactory.createGeometryCollection(n)}},ME=function(t){this.parser=new bE(t)};ME.prototype.write=function(t){return this.parser.write(t)},ME.toLineString=function(t,e){if(2!==arguments.length)throw new Error("Not implemented");return"LINESTRING ( "+t.x+" "+t.y+", "+e.x+" "+e.y+" )"};var LE=function(t){function e(e){t.call(this,e),this.name="RuntimeException",this.message=e,this.stack=(new t).stack}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Error),NE=function(t){function e(){if(t.call(this),0===arguments.length)t.call(this);else if(1===arguments.length){var e=arguments[0];t.call(this,e)}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(LE),TE=function(){};TE.prototype.interfaces_=function(){return[]},TE.prototype.getClass=function(){return TE},TE.shouldNeverReachHere=function(){if(0===arguments.length)TE.shouldNeverReachHere(null);else if(1===arguments.length){var t=arguments[0];throw new NE("Should never reach here"+(null!==t?": "+t:""))}},TE.isTrue=function(){var t;if(1===arguments.length)TE.isTrue(arguments[0],null);else if(2===arguments.length&&(t=arguments[1],!arguments[0]))throw null===t?new NE:new NE(t)},TE.equals=function(){var t,e,n;if(2===arguments.length)TE.equals(t=arguments[0],e=arguments[1],null);else if(3===arguments.length&&(t=arguments[0],n=arguments[2],!(e=arguments[1]).equals(t)))throw new NE("Expected "+t+" but encountered "+e+(null!==n?": "+n:""))};var RE=function(){this._result=null,this._inputLines=Array(2).fill().map((function(){return Array(2)})),this._intPt=new Array(2).fill(null),this._intLineIndex=null,this._isProper=null,this._pa=null,this._pb=null,this._precisionModel=null,this._intPt[0]=new eE,this._intPt[1]=new eE,this._pa=this._intPt[0],this._pb=this._intPt[1],this._result=0},QE={DONT_INTERSECT:{configurable:!0},DO_INTERSECT:{configurable:!0},COLLINEAR:{configurable:!0},NO_INTERSECTION:{configurable:!0},POINT_INTERSECTION:{configurable:!0},COLLINEAR_INTERSECTION:{configurable:!0}};RE.prototype.getIndexAlongSegment=function(t,e){return this.computeIntLineIndex(),this._intLineIndex[t][e]},RE.prototype.getTopologySummary=function(){var t=new cE;return this.isEndPoint()&&t.append(" endpoint"),this._isProper&&t.append(" proper"),this.isCollinear()&&t.append(" collinear"),t.toString()},RE.prototype.computeIntersection=function(t,e,n,r){this._inputLines[0][0]=t,this._inputLines[0][1]=e,this._inputLines[1][0]=n,this._inputLines[1][1]=r,this._result=this.computeIntersect(t,e,n,r)},RE.prototype.getIntersectionNum=function(){return this._result},RE.prototype.computeIntLineIndex=function(){if(0===arguments.length)null===this._intLineIndex&&(this._intLineIndex=Array(2).fill().map((function(){return Array(2)})),this.computeIntLineIndex(0),this.computeIntLineIndex(1));else if(1===arguments.length){var t=arguments[0];this.getEdgeDistance(t,0)>this.getEdgeDistance(t,1)?(this._intLineIndex[t][0]=0,this._intLineIndex[t][1]=1):(this._intLineIndex[t][0]=1,this._intLineIndex[t][1]=0)}},RE.prototype.isProper=function(){return this.hasIntersection()&&this._isProper},RE.prototype.setPrecisionModel=function(t){this._precisionModel=t},RE.prototype.isInteriorIntersection=function(){var t=this;if(0===arguments.length)return!!this.isInteriorIntersection(0)||!!this.isInteriorIntersection(1);if(1===arguments.length){for(var e=arguments[0],n=0;n<this._result;n++)if(!t._intPt[n].equals2D(t._inputLines[e][0])&&!t._intPt[n].equals2D(t._inputLines[e][1]))return!0;return!1}},RE.prototype.getIntersection=function(t){return this._intPt[t]},RE.prototype.isEndPoint=function(){return this.hasIntersection()&&!this._isProper},RE.prototype.hasIntersection=function(){return this._result!==RE.NO_INTERSECTION},RE.prototype.getEdgeDistance=function(t,e){return RE.computeEdgeDistance(this._intPt[e],this._inputLines[t][0],this._inputLines[t][1])},RE.prototype.isCollinear=function(){return this._result===RE.COLLINEAR_INTERSECTION},RE.prototype.toString=function(){return ME.toLineString(this._inputLines[0][0],this._inputLines[0][1])+" - "+ME.toLineString(this._inputLines[1][0],this._inputLines[1][1])+this.getTopologySummary()},RE.prototype.getEndpoint=function(t,e){return this._inputLines[t][e]},RE.prototype.isIntersection=function(t){for(var e=0;e<this._result;e++)if(this._intPt[e].equals2D(t))return!0;return!1},RE.prototype.getIntersectionAlongSegment=function(t,e){return this.computeIntLineIndex(),this._intPt[this._intLineIndex[t][e]]},RE.prototype.interfaces_=function(){return[]},RE.prototype.getClass=function(){return RE},RE.computeEdgeDistance=function(t,e,n){var r=Math.abs(n.x-e.x),i=Math.abs(n.y-e.y),o=-1;if(t.equals(e))o=0;else if(t.equals(n))o=r>i?r:i;else{var s=Math.abs(t.x-e.x),a=Math.abs(t.y-e.y);0!==(o=r>i?s:a)||t.equals(e)||(o=Math.max(s,a))}return TE.isTrue(!(0===o&&!t.equals(e)),"Bad distance calculation"),o},RE.nonRobustComputeEdgeDistance=function(t,e,n){var r=t.x-e.x,i=t.y-e.y,o=Math.sqrt(r*r+i*i);return TE.isTrue(!(0===o&&!t.equals(e)),"Invalid distance calculation"),o},QE.DONT_INTERSECT.get=function(){return 0},QE.DO_INTERSECT.get=function(){return 1},QE.COLLINEAR.get=function(){return 2},QE.NO_INTERSECTION.get=function(){return 0},QE.POINT_INTERSECTION.get=function(){return 1},QE.COLLINEAR_INTERSECTION.get=function(){return 2},Object.defineProperties(RE,QE);var DE=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isInSegmentEnvelopes=function(t){var e=new xE(this._inputLines[0][0],this._inputLines[0][1]),n=new xE(this._inputLines[1][0],this._inputLines[1][1]);return e.contains(t)&&n.contains(t)},e.prototype.computeIntersection=function(){if(3!==arguments.length)return t.prototype.computeIntersection.apply(this,arguments);var e=arguments[0],n=arguments[1],r=arguments[2];if(this._isProper=!1,xE.intersects(n,r,e)&&0===OE.orientationIndex(n,r,e)&&0===OE.orientationIndex(r,n,e))return this._isProper=!0,(e.equals(n)||e.equals(r))&&(this._isProper=!1),this._result=t.POINT_INTERSECTION,null;this._result=t.NO_INTERSECTION},e.prototype.normalizeToMinimum=function(t,e,n,r,i){i.x=this.smallestInAbsValue(t.x,e.x,n.x,r.x),i.y=this.smallestInAbsValue(t.y,e.y,n.y,r.y),t.x-=i.x,t.y-=i.y,e.x-=i.x,e.y-=i.y,n.x-=i.x,n.y-=i.y,r.x-=i.x,r.y-=i.y},e.prototype.safeHCoordinateIntersection=function(t,n,r,i){var o=null;try{o=EE.intersection(t,n,r,i)}catch(s){if(!(s instanceof _E))throw s;o=e.nearestEndpoint(t,n,r,i)}return o},e.prototype.intersection=function(t,n,r,i){var o=this.intersectionWithNormalization(t,n,r,i);return this.isInSegmentEnvelopes(o)||(o=new eE(e.nearestEndpoint(t,n,r,i))),null!==this._precisionModel&&this._precisionModel.makePrecise(o),o},e.prototype.smallestInAbsValue=function(t,e,n,r){var i=t,o=Math.abs(i);return Math.abs(e)<o&&(i=e,o=Math.abs(e)),Math.abs(n)<o&&(i=n,o=Math.abs(n)),Math.abs(r)<o&&(i=r),i},e.prototype.checkDD=function(t,e,n,r,i){var o=AE.intersection(t,e,n,r),s=this.isInSegmentEnvelopes(o);IE.out.println("DD in env = "+s+" --------------------- "+o),i.distance(o)>1e-4&&IE.out.println("Distance = "+i.distance(o))},e.prototype.intersectionWithNormalization=function(t,e,n,r){var i=new eE(t),o=new eE(e),s=new eE(n),a=new eE(r),u=new eE;this.normalizeToEnvCentre(i,o,s,a,u);var l=this.safeHCoordinateIntersection(i,o,s,a);return l.x+=u.x,l.y+=u.y,l},e.prototype.computeCollinearIntersection=function(e,n,r,i){var o=xE.intersects(e,n,r),s=xE.intersects(e,n,i),a=xE.intersects(r,i,e),u=xE.intersects(r,i,n);return o&&s?(this._intPt[0]=r,this._intPt[1]=i,t.COLLINEAR_INTERSECTION):a&&u?(this._intPt[0]=e,this._intPt[1]=n,t.COLLINEAR_INTERSECTION):o&&a?(this._intPt[0]=r,this._intPt[1]=e,!r.equals(e)||s||u?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):o&&u?(this._intPt[0]=r,this._intPt[1]=n,!r.equals(n)||s||a?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):s&&a?(this._intPt[0]=i,this._intPt[1]=e,!i.equals(e)||o||u?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):s&&u?(this._intPt[0]=i,this._intPt[1]=n,!i.equals(n)||o||a?t.COLLINEAR_INTERSECTION:t.POINT_INTERSECTION):t.NO_INTERSECTION},e.prototype.normalizeToEnvCentre=function(t,e,n,r,i){var o=t.x<e.x?t.x:e.x,s=t.y<e.y?t.y:e.y,a=t.x>e.x?t.x:e.x,u=t.y>e.y?t.y:e.y,l=n.x<r.x?n.x:r.x,c=n.y<r.y?n.y:r.y,h=n.x>r.x?n.x:r.x,f=n.y>r.y?n.y:r.y,p=((o>l?o:l)+(a<h?a:h))/2,g=((s>c?s:c)+(u<f?u:f))/2;i.x=p,i.y=g,t.x-=i.x,t.y-=i.y,e.x-=i.x,e.y-=i.y,n.x-=i.x,n.y-=i.y,r.x-=i.x,r.y-=i.y},e.prototype.computeIntersect=function(e,n,r,i){if(this._isProper=!1,!xE.intersects(e,n,r,i))return t.NO_INTERSECTION;var o=OE.orientationIndex(e,n,r),s=OE.orientationIndex(e,n,i);if(o>0&&s>0||o<0&&s<0)return t.NO_INTERSECTION;var a=OE.orientationIndex(r,i,e),u=OE.orientationIndex(r,i,n);return a>0&&u>0||a<0&&u<0?t.NO_INTERSECTION:0===o&&0===s&&0===a&&0===u?this.computeCollinearIntersection(e,n,r,i):(0===o||0===s||0===a||0===u?(this._isProper=!1,e.equals2D(r)||e.equals2D(i)?this._intPt[0]=e:n.equals2D(r)||n.equals2D(i)?this._intPt[0]=n:0===o?this._intPt[0]=new eE(r):0===s?this._intPt[0]=new eE(i):0===a?this._intPt[0]=new eE(e):0===u&&(this._intPt[0]=new eE(n))):(this._isProper=!0,this._intPt[0]=this.intersection(e,n,r,i)),t.POINT_INTERSECTION)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.nearestEndpoint=function(t,e,n,r){var i=t,o=OE.distancePointLine(t,n,r),s=OE.distancePointLine(e,n,r);return s<o&&(o=s,i=e),(s=OE.distancePointLine(n,t,e))<o&&(o=s,i=n),(s=OE.distancePointLine(r,t,e))<o&&(o=s,i=r),i},e}(RE),PE=function(){};PE.prototype.interfaces_=function(){return[]},PE.prototype.getClass=function(){return PE},PE.orientationIndex=function(t,e,n){var r=e.x-t.x,i=e.y-t.y,o=n.x-e.x,s=n.y-e.y;return PE.signOfDet2x2(r,i,o,s)},PE.signOfDet2x2=function(t,e,n,r){var i=null,o=null,s=null;if(i=1,0===t||0===r)return 0===e||0===n?0:e>0?n>0?-i:i:n>0?i:-i;if(0===e||0===n)return r>0?t>0?i:-i:t>0?-i:i;if(e>0?r>0?e<=r||(i=-i,o=t,t=n,n=o,o=e,e=r,r=o):e<=-r?(i=-i,n=-n,r=-r):(o=t,t=-n,n=o,o=e,e=-r,r=o):r>0?-e<=r?(i=-i,t=-t,e=-e):(o=-t,t=n,n=o,o=-e,e=r,r=o):e>=r?(t=-t,e=-e,n=-n,r=-r):(i=-i,o=-t,t=-n,n=o,o=-e,e=-r,r=o),t>0){if(!(n>0))return i;if(!(t<=n))return i}else{if(n>0)return-i;if(!(t>=n))return-i;i=-i,t=-t,n=-n}for(;;){if((r-=(s=Math.floor(n/t))*e)<0)return-i;if(r>e)return i;if(t>(n-=s*t)+n){if(e<r+r)return i}else{if(e>r+r)return-i;n=t-n,r=e-r,i=-i}if(0===r)return 0===n?0:-i;if(0===n)return i;if((e-=(s=Math.floor(t/n))*r)<0)return i;if(e>r)return-i;if(n>(t-=s*n)+t){if(r<e+e)return-i}else{if(r>e+e)return i;t=n-t,e=r-e,i=-i}if(0===e)return 0===t?0:i;if(0===t)return-i}};var kE=function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var t=arguments[0];this._p=t};kE.prototype.countSegment=function(t,e){if(t.x<this._p.x&&e.x<this._p.x)return null;if(this._p.x===e.x&&this._p.y===e.y)return this._isPointOnSegment=!0,null;if(t.y===this._p.y&&e.y===this._p.y){var n=t.x,r=e.x;return n>r&&(n=e.x,r=t.x),this._p.x>=n&&this._p.x<=r&&(this._isPointOnSegment=!0),null}if(t.y>this._p.y&&e.y<=this._p.y||e.y>this._p.y&&t.y<=this._p.y){var i=t.x-this._p.x,o=t.y-this._p.y,s=e.x-this._p.x,a=e.y-this._p.y,u=PE.signOfDet2x2(i,o,s,a);if(0===u)return this._isPointOnSegment=!0,null;a<o&&(u=-u),u>0&&this._crossingCount++}},kE.prototype.isPointInPolygon=function(){return this.getLocation()!==oE.EXTERIOR},kE.prototype.getLocation=function(){return this._isPointOnSegment?oE.BOUNDARY:this._crossingCount%2==1?oE.INTERIOR:oE.EXTERIOR},kE.prototype.isOnSegment=function(){return this._isPointOnSegment},kE.prototype.interfaces_=function(){return[]},kE.prototype.getClass=function(){return kE},kE.locatePointInRing=function(){if(arguments[0]instanceof eE&&aE(arguments[1],yE)){for(var t=arguments[1],e=new kE(arguments[0]),n=new eE,r=new eE,i=1;i<t.size();i++)if(t.getCoordinate(i,n),t.getCoordinate(i-1,r),e.countSegment(n,r),e.isOnSegment())return e.getLocation();return e.getLocation()}if(arguments[0]instanceof eE&&arguments[1]instanceof Array){for(var o=arguments[1],s=new kE(arguments[0]),a=1;a<o.length;a++){var u=o[a],l=o[a-1];if(s.countSegment(u,l),s.isOnSegment())return s.getLocation()}return s.getLocation()}};var OE=function(){},FE={CLOCKWISE:{configurable:!0},RIGHT:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},LEFT:{configurable:!0},COLLINEAR:{configurable:!0},STRAIGHT:{configurable:!0}};OE.prototype.interfaces_=function(){return[]},OE.prototype.getClass=function(){return OE},OE.orientationIndex=function(t,e,n){return AE.orientationIndex(t,e,n)},OE.signedArea=function(){if(arguments[0]instanceof Array){var t=arguments[0];if(t.length<3)return 0;for(var e=0,n=t[0].x,r=1;r<t.length-1;r++){var i=t[r].x-n,o=t[r+1].y;e+=i*(t[r-1].y-o)}return e/2}if(aE(arguments[0],yE)){var s=arguments[0],a=s.size();if(a<3)return 0;var u=new eE,l=new eE,c=new eE;s.getCoordinate(0,l),s.getCoordinate(1,c);var h=l.x;c.x-=h;for(var f=0,p=1;p<a-1;p++)u.y=l.y,l.x=c.x,l.y=c.y,s.getCoordinate(p+1,c),c.x-=h,f+=l.x*(u.y-c.y);return f/2}},OE.distanceLineLine=function(t,e,n,r){if(t.equals(e))return OE.distancePointLine(t,n,r);if(n.equals(r))return OE.distancePointLine(r,t,e);var i=!1;if(xE.intersects(t,e,n,r)){var o=(e.x-t.x)*(r.y-n.y)-(e.y-t.y)*(r.x-n.x);if(0===o)i=!0;else{var s=(t.y-n.y)*(r.x-n.x)-(t.x-n.x)*(r.y-n.y),a=((t.y-n.y)*(e.x-t.x)-(t.x-n.x)*(e.y-t.y))/o,u=s/o;(u<0||u>1||a<0||a>1)&&(i=!0)}}else i=!0;return i?uE.min(OE.distancePointLine(t,n,r),OE.distancePointLine(e,n,r),OE.distancePointLine(n,t,e),OE.distancePointLine(r,t,e)):0},OE.isPointInRing=function(t,e){return OE.locatePointInRing(t,e)!==oE.EXTERIOR},OE.computeLength=function(t){var e=t.size();if(e<=1)return 0;var n=0,r=new eE;t.getCoordinate(0,r);for(var i=r.x,o=r.y,s=1;s<e;s++){t.getCoordinate(s,r);var a=r.x,u=r.y,l=a-i,c=u-o;n+=Math.sqrt(l*l+c*c),i=a,o=u}return n},OE.isCCW=function(t){var e=t.length-1;if(e<3)throw new XI("Ring has fewer than 4 points, so orientation cannot be determined");for(var n=t[0],r=0,i=1;i<=e;i++){var o=t[i];o.y>n.y&&(n=o,r=i)}var s=r;do{(s-=1)<0&&(s=e)}while(t[s].equals2D(n)&&s!==r);var a=r;do{a=(a+1)%e}while(t[a].equals2D(n)&&a!==r);var u=t[s],l=t[a];if(u.equals2D(n)||l.equals2D(n)||u.equals2D(l))return!1;var c=OE.computeOrientation(u,n,l),h=!1;return h=0===c?u.x>l.x:c>0,h},OE.locatePointInRing=function(t,e){return kE.locatePointInRing(t,e)},OE.distancePointLinePerpendicular=function(t,e,n){var r=(n.x-e.x)*(n.x-e.x)+(n.y-e.y)*(n.y-e.y),i=((e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y))/r;return Math.abs(i)*Math.sqrt(r)},OE.computeOrientation=function(t,e,n){return OE.orientationIndex(t,e,n)},OE.distancePointLine=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];if(0===e.length)throw new XI("Line array must contain at least one vertex");for(var n=t.distance(e[0]),r=0;r<e.length-1;r++){var i=OE.distancePointLine(t,e[r],e[r+1]);i<n&&(n=i)}return n}if(3===arguments.length){var o=arguments[0],s=arguments[1],a=arguments[2];if(s.x===a.x&&s.y===a.y)return o.distance(s);var u=(a.x-s.x)*(a.x-s.x)+(a.y-s.y)*(a.y-s.y),l=((o.x-s.x)*(a.x-s.x)+(o.y-s.y)*(a.y-s.y))/u;if(l<=0)return o.distance(s);if(l>=1)return o.distance(a);var c=((s.y-o.y)*(a.x-s.x)-(s.x-o.x)*(a.y-s.y))/u;return Math.abs(c)*Math.sqrt(u)}},OE.isOnLine=function(t,e){for(var n=new DE,r=1;r<e.length;r++){var i=e[r-1],o=e[r];if(n.computeIntersection(t,i,o),n.hasIntersection())return!0}return!1},FE.CLOCKWISE.get=function(){return-1},FE.RIGHT.get=function(){return OE.CLOCKWISE},FE.COUNTERCLOCKWISE.get=function(){return 1},FE.LEFT.get=function(){return OE.COUNTERCLOCKWISE},FE.COLLINEAR.get=function(){return 0},FE.STRAIGHT.get=function(){return OE.COLLINEAR},Object.defineProperties(OE,FE);var GE=function(){};GE.prototype.filter=function(t){},GE.prototype.interfaces_=function(){return[]},GE.prototype.getClass=function(){return GE};var UE=function(){var t=arguments[0];this._envelope=null,this._factory=null,this._SRID=null,this._userData=null,this._factory=t,this._SRID=t.getSRID()},qE={serialVersionUID:{configurable:!0},SORTINDEX_POINT:{configurable:!0},SORTINDEX_MULTIPOINT:{configurable:!0},SORTINDEX_LINESTRING:{configurable:!0},SORTINDEX_LINEARRING:{configurable:!0},SORTINDEX_MULTILINESTRING:{configurable:!0},SORTINDEX_POLYGON:{configurable:!0},SORTINDEX_MULTIPOLYGON:{configurable:!0},SORTINDEX_GEOMETRYCOLLECTION:{configurable:!0},geometryChangedFilter:{configurable:!0}};UE.prototype.isGeometryCollection=function(){return this.getSortIndex()===UE.SORTINDEX_GEOMETRYCOLLECTION},UE.prototype.getFactory=function(){return this._factory},UE.prototype.getGeometryN=function(t){return this},UE.prototype.getArea=function(){return 0},UE.prototype.isRectangle=function(){return!1},UE.prototype.equals=function(){if(arguments[0]instanceof UE){var t=arguments[0];return null!==t&&this.equalsTopo(t)}if(arguments[0]instanceof Object){var e=arguments[0];if(!(e instanceof UE))return!1;var n=e;return this.equalsExact(n)}},UE.prototype.equalsExact=function(t){return this===t||this.equalsExact(t,0)},UE.prototype.geometryChanged=function(){this.apply(UE.geometryChangedFilter)},UE.prototype.geometryChangedAction=function(){this._envelope=null},UE.prototype.equalsNorm=function(t){return null!==t&&this.norm().equalsExact(t.norm())},UE.prototype.getLength=function(){return 0},UE.prototype.getNumGeometries=function(){return 1},UE.prototype.compareTo=function(){if(1===arguments.length){var t=arguments[0],e=t;return this.getSortIndex()!==e.getSortIndex()?this.getSortIndex()-e.getSortIndex():this.isEmpty()&&e.isEmpty()?0:this.isEmpty()?-1:e.isEmpty()?1:this.compareToSameClass(t)}if(2===arguments.length){var n=arguments[0],r=arguments[1];return this.getSortIndex()!==n.getSortIndex()?this.getSortIndex()-n.getSortIndex():this.isEmpty()&&n.isEmpty()?0:this.isEmpty()?-1:n.isEmpty()?1:this.compareToSameClass(n,r)}},UE.prototype.getUserData=function(){return this._userData},UE.prototype.getSRID=function(){return this._SRID},UE.prototype.getEnvelope=function(){return this.getFactory().toGeometry(this.getEnvelopeInternal())},UE.prototype.checkNotGeometryCollection=function(t){if(t.getSortIndex()===UE.SORTINDEX_GEOMETRYCOLLECTION)throw new XI("This method does not support GeometryCollection arguments")},UE.prototype.equal=function(t,e,n){return 0===n?t.equals(e):t.distance(e)<=n},UE.prototype.norm=function(){var t=this.copy();return t.normalize(),t},UE.prototype.getPrecisionModel=function(){return this._factory.getPrecisionModel()},UE.prototype.getEnvelopeInternal=function(){return null===this._envelope&&(this._envelope=this.computeEnvelopeInternal()),new xE(this._envelope)},UE.prototype.setSRID=function(t){this._SRID=t},UE.prototype.setUserData=function(t){this._userData=t},UE.prototype.compare=function(t,e){for(var n=t.iterator(),r=e.iterator();n.hasNext()&&r.hasNext();){var i=n.next(),o=r.next(),s=i.compareTo(o);if(0!==s)return s}return n.hasNext()?1:r.hasNext()?-1:0},UE.prototype.hashCode=function(){return this.getEnvelopeInternal().hashCode()},UE.prototype.isGeometryCollectionOrDerived=function(){return this.getSortIndex()===UE.SORTINDEX_GEOMETRYCOLLECTION||this.getSortIndex()===UE.SORTINDEX_MULTIPOINT||this.getSortIndex()===UE.SORTINDEX_MULTILINESTRING||this.getSortIndex()===UE.SORTINDEX_MULTIPOLYGON},UE.prototype.interfaces_=function(){return[ZI,KI,tE]},UE.prototype.getClass=function(){return UE},UE.hasNonEmptyElements=function(t){for(var e=0;e<t.length;e++)if(!t[e].isEmpty())return!0;return!1},UE.hasNullElements=function(t){for(var e=0;e<t.length;e++)if(null===t[e])return!0;return!1},qE.serialVersionUID.get=function(){return 0x799ea46522854c00},qE.SORTINDEX_POINT.get=function(){return 0},qE.SORTINDEX_MULTIPOINT.get=function(){return 1},qE.SORTINDEX_LINESTRING.get=function(){return 2},qE.SORTINDEX_LINEARRING.get=function(){return 3},qE.SORTINDEX_MULTILINESTRING.get=function(){return 4},qE.SORTINDEX_POLYGON.get=function(){return 5},qE.SORTINDEX_MULTIPOLYGON.get=function(){return 6},qE.SORTINDEX_GEOMETRYCOLLECTION.get=function(){return 7},qE.geometryChangedFilter.get=function(){return jE},Object.defineProperties(UE,qE);var jE=function(){};jE.interfaces_=function(){return[GE]},jE.filter=function(t){t.geometryChangedAction()};var zE=function(){};zE.prototype.filter=function(t){},zE.prototype.interfaces_=function(){return[]},zE.prototype.getClass=function(){return zE};var VE=function(){},YE={Mod2BoundaryNodeRule:{configurable:!0},EndPointBoundaryNodeRule:{configurable:!0},MultiValentEndPointBoundaryNodeRule:{configurable:!0},MonoValentEndPointBoundaryNodeRule:{configurable:!0},MOD2_BOUNDARY_RULE:{configurable:!0},ENDPOINT_BOUNDARY_RULE:{configurable:!0},MULTIVALENT_ENDPOINT_BOUNDARY_RULE:{configurable:!0},MONOVALENT_ENDPOINT_BOUNDARY_RULE:{configurable:!0},OGC_SFS_BOUNDARY_RULE:{configurable:!0}};VE.prototype.isInBoundary=function(t){},VE.prototype.interfaces_=function(){return[]},VE.prototype.getClass=function(){return VE},YE.Mod2BoundaryNodeRule.get=function(){return HE},YE.EndPointBoundaryNodeRule.get=function(){return XE},YE.MultiValentEndPointBoundaryNodeRule.get=function(){return JE},YE.MonoValentEndPointBoundaryNodeRule.get=function(){return WE},YE.MOD2_BOUNDARY_RULE.get=function(){return new HE},YE.ENDPOINT_BOUNDARY_RULE.get=function(){return new XE},YE.MULTIVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new JE},YE.MONOVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new WE},YE.OGC_SFS_BOUNDARY_RULE.get=function(){return VE.MOD2_BOUNDARY_RULE},Object.defineProperties(VE,YE);var HE=function(){};HE.prototype.isInBoundary=function(t){return t%2==1},HE.prototype.interfaces_=function(){return[VE]},HE.prototype.getClass=function(){return HE};var XE=function(){};XE.prototype.isInBoundary=function(t){return t>0},XE.prototype.interfaces_=function(){return[VE]},XE.prototype.getClass=function(){return XE};var JE=function(){};JE.prototype.isInBoundary=function(t){return t>1},JE.prototype.interfaces_=function(){return[VE]},JE.prototype.getClass=function(){return JE};var WE=function(){};WE.prototype.isInBoundary=function(t){return 1===t},WE.prototype.interfaces_=function(){return[VE]},WE.prototype.getClass=function(){return WE};var KE=function(){};function ZE(t){this.message=t||""}KE.prototype.add=function(){},KE.prototype.addAll=function(){},KE.prototype.isEmpty=function(){},KE.prototype.iterator=function(){},KE.prototype.size=function(){},KE.prototype.toArray=function(){},KE.prototype.remove=function(){},ZE.prototype=new Error,ZE.prototype.name="IndexOutOfBoundsException";var $E=function(){};$E.prototype.hasNext=function(){},$E.prototype.next=function(){},$E.prototype.remove=function(){};var tx=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(){},e.prototype.set=function(){},e.prototype.isEmpty=function(){},e}(KE);function ex(t){this.message=t||""}ex.prototype=new Error,ex.prototype.name="NoSuchElementException";var nx=function(t){function e(){t.call(this),this.array_=[],arguments[0]instanceof KE&&this.addAll(arguments[0])}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.ensureCapacity=function(){},e.prototype.interfaces_=function(){return[t,KE]},e.prototype.add=function(t){return 1===arguments.length?this.array_.push(t):this.array_.splice(arguments[0],arguments[1]),!0},e.prototype.clear=function(){this.array_=[]},e.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next());return!0},e.prototype.set=function(t,e){var n=this.array_[t];return this.array_[t]=e,n},e.prototype.iterator=function(){return new rx(this)},e.prototype.get=function(t){if(t<0||t>=this.size())throw new ZE;return this.array_[t]},e.prototype.isEmpty=function(){return 0===this.array_.length},e.prototype.size=function(){return this.array_.length},e.prototype.toArray=function(){for(var t=[],e=0,n=this.array_.length;e<n;e++)t.push(this.array_[e]);return t},e.prototype.remove=function(t){for(var e=!1,n=0,r=this.array_.length;n<r;n++)if(this.array_[n]===t){this.array_.splice(n,1),e=!0;break}return e},e}(tx),rx=function(t){function e(e){t.call(this),this.arrayList_=e,this.position_=0}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.next=function(){if(this.position_===this.arrayList_.size())throw new ex;return this.arrayList_.get(this.position_++)},e.prototype.hasNext=function(){return this.position_<this.arrayList_.size()},e.prototype.set=function(t){return this.arrayList_.set(this.position_-1,t)},e.prototype.remove=function(){this.arrayList_.remove(this.arrayList_.get(this.position_))},e}($E),ix=function(t){function e(){if(t.call(this),0===arguments.length);else if(1===arguments.length){var e=arguments[0];this.ensureCapacity(e.length),this.add(e,!0)}else if(2===arguments.length){var n=arguments[0],r=arguments[1];this.ensureCapacity(n.length),this.add(n,r)}}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={coordArrayType:{configurable:!0}};return n.coordArrayType.get=function(){return new Array(0).fill(null)},e.prototype.getCoordinate=function(t){return this.get(t)},e.prototype.addAll=function(){if(2===arguments.length){for(var e=arguments[1],n=!1,r=arguments[0].iterator();r.hasNext();)this.add(r.next(),e),n=!0;return n}return t.prototype.addAll.apply(this,arguments)},e.prototype.clone=function(){for(var e=t.prototype.clone.call(this),n=0;n<this.size();n++)e.add(n,this.get(n).copy());return e},e.prototype.toCoordinateArray=function(){return this.toArray(e.coordArrayType)},e.prototype.add=function(){var e=this;if(1===arguments.length){var n=arguments[0];t.prototype.add.call(this,n)}else if(2===arguments.length){if(arguments[0]instanceof Array&&"boolean"==typeof arguments[1]){var r=arguments[0],i=arguments[1];return this.add(r,i,!0),!0}if(arguments[0]instanceof eE&&"boolean"==typeof arguments[1]){var o=arguments[0];if(!arguments[1])if(this.size()>=1)if(this.get(this.size()-1).equals2D(o))return null;t.prototype.add.call(this,o)}else if(arguments[0]instanceof Object&&"boolean"==typeof arguments[1]){var s=arguments[0],a=arguments[1];return this.add(s,a),!0}}else if(3===arguments.length){if("boolean"==typeof arguments[2]&&arguments[0]instanceof Array&&"boolean"==typeof arguments[1]){var u=arguments[0],l=arguments[1];if(arguments[2])for(var c=0;c<u.length;c++)e.add(u[c],l);else for(var h=u.length-1;h>=0;h--)e.add(u[h],l);return!0}if("boolean"==typeof arguments[2]&&Number.isInteger(arguments[0])&&arguments[1]instanceof eE){var f=arguments[0],p=arguments[1];if(!arguments[2]){var g=this.size();if(g>0){if(f>0)if(this.get(f-1).equals2D(p))return null;if(f<g)if(this.get(f).equals2D(p))return null}}t.prototype.add.call(this,f,p)}}else if(4===arguments.length){var A=arguments[0],d=arguments[1],y=arguments[2],v=arguments[3],m=1;y>v&&(m=-1);for(var _=y;_!==v;_+=m)e.add(A[_],d);return!0}},e.prototype.closeRing=function(){this.size()>0&&this.add(new eE(this.get(0)),!1)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},Object.defineProperties(e,n),e}(nx),ox=function(){},sx={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};sx.ForwardComparator.get=function(){return ax},sx.BidirectionalComparator.get=function(){return ux},sx.coordArrayType.get=function(){return new Array(0).fill(null)},ox.prototype.interfaces_=function(){return[]},ox.prototype.getClass=function(){return ox},ox.isRing=function(t){return!(t.length<4)&&!!t[0].equals2D(t[t.length-1])},ox.ptNotInList=function(t,e){for(var n=0;n<t.length;n++){var r=t[n];if(ox.indexOf(r,e)<0)return r}return null},ox.scroll=function(t,e){var n=ox.indexOf(e,t);if(n<0)return null;var r=new Array(t.length).fill(null);IE.arraycopy(t,n,r,0,t.length-n),IE.arraycopy(t,0,r,t.length-n,n),IE.arraycopy(r,0,t,0,t.length)},ox.equals=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];if(t===e)return!0;if(null===t||null===e)return!1;if(t.length!==e.length)return!1;for(var n=0;n<t.length;n++)if(!t[n].equals(e[n]))return!1;return!0}if(3===arguments.length){var r=arguments[0],i=arguments[1],o=arguments[2];if(r===i)return!0;if(null===r||null===i)return!1;if(r.length!==i.length)return!1;for(var s=0;s<r.length;s++)if(0!==o.compare(r[s],i[s]))return!1;return!0}},ox.intersection=function(t,e){for(var n=new ix,r=0;r<t.length;r++)e.intersects(t[r])&&n.add(t[r],!0);return n.toCoordinateArray()},ox.hasRepeatedPoints=function(t){for(var e=1;e<t.length;e++)if(t[e-1].equals(t[e]))return!0;return!1},ox.removeRepeatedPoints=function(t){return ox.hasRepeatedPoints(t)?new ix(t,!1).toCoordinateArray():t},ox.reverse=function(t){for(var e=t.length-1,n=Math.trunc(e/2),r=0;r<=n;r++){var i=t[r];t[r]=t[e-r],t[e-r]=i}},ox.removeNull=function(t){for(var e=0,n=0;n<t.length;n++)null!==t[n]&&e++;var r=new Array(e).fill(null);if(0===e)return r;for(var i=0,o=0;o<t.length;o++)null!==t[o]&&(r[i++]=t[o]);return r},ox.copyDeep=function(){if(1===arguments.length){for(var t=arguments[0],e=new Array(t.length).fill(null),n=0;n<t.length;n++)e[n]=new eE(t[n]);return e}if(5===arguments.length)for(var r=arguments[0],i=arguments[1],o=arguments[2],s=arguments[3],a=arguments[4],u=0;u<a;u++)o[s+u]=new eE(r[i+u])},ox.isEqualReversed=function(t,e){for(var n=0;n<t.length;n++){var r=t[n],i=e[t.length-n-1];if(0!==r.compareTo(i))return!1}return!0},ox.envelope=function(t){for(var e=new xE,n=0;n<t.length;n++)e.expandToInclude(t[n]);return e},ox.toCoordinateArray=function(t){return t.toArray(ox.coordArrayType)},ox.atLeastNCoordinatesOrNothing=function(t,e){return e.length>=t?e:[]},ox.indexOf=function(t,e){for(var n=0;n<e.length;n++)if(t.equals(e[n]))return n;return-1},ox.increasingDirection=function(t){for(var e=0;e<Math.trunc(t.length/2);e++){var n=t.length-1-e,r=t[e].compareTo(t[n]);if(0!==r)return r}return 1},ox.compare=function(t,e){for(var n=0;n<t.length&&n<e.length;){var r=t[n].compareTo(e[n]);if(0!==r)return r;n++}return n<e.length?-1:n<t.length?1:0},ox.minCoordinate=function(t){for(var e=null,n=0;n<t.length;n++)(null===e||e.compareTo(t[n])>0)&&(e=t[n]);return e},ox.extract=function(t,e,n){e=uE.clamp(e,0,t.length);var r=(n=uE.clamp(n,-1,t.length))-e+1;n<0&&(r=0),e>=t.length&&(r=0),n<e&&(r=0);var i=new Array(r).fill(null);if(0===r)return i;for(var o=0,s=e;s<=n;s++)i[o++]=t[s];return i},Object.defineProperties(ox,sx);var ax=function(){};ax.prototype.compare=function(t,e){return ox.compare(t,e)},ax.prototype.interfaces_=function(){return[$I]},ax.prototype.getClass=function(){return ax};var ux=function(){};ux.prototype.compare=function(t,e){var n=t,r=e;if(n.length<r.length)return-1;if(n.length>r.length)return 1;if(0===n.length)return 0;var i=ox.compare(n,r);return ox.isEqualReversed(n,r)?0:i},ux.prototype.OLDcompare=function(t,e){var n=t,r=e;if(n.length<r.length)return-1;if(n.length>r.length)return 1;if(0===n.length)return 0;for(var i=ox.increasingDirection(n),o=ox.increasingDirection(r),s=i>0?0:n.length-1,a=o>0?0:n.length-1,u=0;u<n.length;u++){var l=n[s].compareTo(r[a]);if(0!==l)return l;s+=i,a+=o}return 0},ux.prototype.interfaces_=function(){return[$I]},ux.prototype.getClass=function(){return ux};var lx=function(){};lx.prototype.get=function(){},lx.prototype.put=function(){},lx.prototype.size=function(){},lx.prototype.values=function(){},lx.prototype.entrySet=function(){};var cx=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(lx);function hx(t){this.message=t||""}function fx(){}hx.prototype=new Error,hx.prototype.name="OperationNotSupported",fx.prototype=new KE,fx.prototype.contains=function(){};var px=function(t){function e(){t.call(this),this.array_=[],arguments[0]instanceof KE&&this.addAll(arguments[0])}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.contains=function(t){for(var e=0,n=this.array_.length;e<n;e++){if(this.array_[e]===t)return!0}return!1},e.prototype.add=function(t){return!this.contains(t)&&(this.array_.push(t),!0)},e.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next());return!0},e.prototype.remove=function(t){throw new Error},e.prototype.size=function(){return this.array_.length},e.prototype.isEmpty=function(){return 0===this.array_.length},e.prototype.toArray=function(){for(var t=[],e=0,n=this.array_.length;e<n;e++)t.push(this.array_[e]);return t},e.prototype.iterator=function(){return new gx(this)},e}(fx),gx=function(t){function e(e){t.call(this),this.hashSet_=e,this.position_=0}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.next=function(){if(this.position_===this.hashSet_.size())throw new ex;return this.hashSet_.array_[this.position_++]},e.prototype.hasNext=function(){return this.position_<this.hashSet_.size()},e.prototype.remove=function(){throw new hx},e}($E);function Ax(t){return null===t?0:t.color}function dx(t){return null===t?null:t.parent}function yx(t,e){null!==t&&(t.color=e)}function vx(t){return null===t?null:t.left}function mx(t){return null===t?null:t.right}function _x(){this.root_=null,this.size_=0}_x.prototype=new cx,_x.prototype.get=function(t){for(var e=this.root_;null!==e;){var n=t.compareTo(e.key);if(n<0)e=e.left;else{if(!(n>0))return e.value;e=e.right}}return null},_x.prototype.put=function(t,e){if(null===this.root_)return this.root_={key:t,value:e,left:null,right:null,parent:null,color:0,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var n,r,i=this.root_;do{if(n=i,(r=t.compareTo(i.key))<0)i=i.left;else{if(!(r>0)){var o=i.value;return i.value=e,o}i=i.right}}while(null!==i);var s={key:t,left:null,right:null,value:e,parent:n,color:0,getValue:function(){return this.value},getKey:function(){return this.key}};return r<0?n.left=s:n.right=s,this.fixAfterInsertion(s),this.size_++,null},_x.prototype.fixAfterInsertion=function(t){var e=this;for(t.color=1;null!=t&&t!==this.root_&&1===t.parent.color;)if(dx(t)===vx(dx(dx(t)))){var n=mx(dx(dx(t)));1===Ax(n)?(yx(dx(t),0),yx(n,0),yx(dx(dx(t)),1),t=dx(dx(t))):(t===mx(dx(t))&&(t=dx(t),e.rotateLeft(t)),yx(dx(t),0),yx(dx(dx(t)),1),e.rotateRight(dx(dx(t))))}else{var r=vx(dx(dx(t)));1===Ax(r)?(yx(dx(t),0),yx(r,0),yx(dx(dx(t)),1),t=dx(dx(t))):(t===vx(dx(t))&&(t=dx(t),e.rotateRight(t)),yx(dx(t),0),yx(dx(dx(t)),1),e.rotateLeft(dx(dx(t))))}this.root_.color=0},_x.prototype.values=function(){var t=new nx,e=this.getFirstEntry();if(null!==e)for(t.add(e.value);null!==(e=_x.successor(e));)t.add(e.value);return t},_x.prototype.entrySet=function(){var t=new px,e=this.getFirstEntry();if(null!==e)for(t.add(e);null!==(e=_x.successor(e));)t.add(e);return t},_x.prototype.rotateLeft=function(t){if(null!=t){var e=t.right;t.right=e.left,null!=e.left&&(e.left.parent=t),e.parent=t.parent,null===t.parent?this.root_=e:t.parent.left===t?t.parent.left=e:t.parent.right=e,e.left=t,t.parent=e}},_x.prototype.rotateRight=function(t){if(null!=t){var e=t.left;t.left=e.right,null!=e.right&&(e.right.parent=t),e.parent=t.parent,null===t.parent?this.root_=e:t.parent.right===t?t.parent.right=e:t.parent.left=e,e.right=t,t.parent=e}},_x.prototype.getFirstEntry=function(){var t=this.root_;if(null!=t)for(;null!=t.left;)t=t.left;return t},_x.successor=function(t){if(null===t)return null;if(null!==t.right){for(var e=t.right;null!==e.left;)e=e.left;return e}for(var n=t.parent,r=t;null!==n&&r===n.right;)r=n,n=n.parent;return n},_x.prototype.size=function(){return this.size_};var Ix=function(){};function Ex(){}function xx(){this.array_=[],arguments[0]instanceof KE&&this.addAll(arguments[0])}Ix.prototype.interfaces_=function(){return[]},Ix.prototype.getClass=function(){return Ix},Ex.prototype=new fx,xx.prototype=new Ex,xx.prototype.contains=function(t){for(var e=0,n=this.array_.length;e<n;e++){if(0===this.array_[e].compareTo(t))return!0}return!1},xx.prototype.add=function(t){if(this.contains(t))return!1;for(var e=0,n=this.array_.length;e<n;e++){if(1===this.array_[e].compareTo(t))return this.array_.splice(e,0,t),!0}return this.array_.push(t),!0},xx.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next());return!0},xx.prototype.remove=function(t){throw new hx},xx.prototype.size=function(){return this.array_.length},xx.prototype.isEmpty=function(){return 0===this.array_.length},xx.prototype.toArray=function(){for(var t=[],e=0,n=this.array_.length;e<n;e++)t.push(this.array_[e]);return t},xx.prototype.iterator=function(){return new Cx(this)};var Cx=function(t){this.treeSet_=t,this.position_=0};Cx.prototype.next=function(){if(this.position_===this.treeSet_.size())throw new ex;return this.treeSet_.array_[this.position_++]},Cx.prototype.hasNext=function(){return this.position_<this.treeSet_.size()},Cx.prototype.remove=function(){throw new hx};var wx=function(){};wx.sort=function(){var t,e,n,r,i=arguments[0];if(1===arguments.length)r=function(t,e){return t.compareTo(e)},i.sort(r);else if(2===arguments.length)n=arguments[1],r=function(t,e){return n.compare(t,e)},i.sort(r);else if(3===arguments.length){(e=i.slice(arguments[1],arguments[2])).sort();var o=i.slice(0,arguments[1]).concat(e,i.slice(arguments[2],i.length));for(i.splice(0,i.length),t=0;t<o.length;t++)i.push(o[t])}else if(4===arguments.length)for(e=i.slice(arguments[1],arguments[2]),n=arguments[3],r=function(t,e){return n.compare(t,e)},e.sort(r),o=i.slice(0,arguments[1]).concat(e,i.slice(arguments[2],i.length)),i.splice(0,i.length),t=0;t<o.length;t++)i.push(o[t])},wx.asList=function(t){for(var e=new nx,n=0,r=t.length;n<r;n++)e.add(t[n]);return e};var bx=function(){},Bx={P:{configurable:!0},L:{configurable:!0},A:{configurable:!0},FALSE:{configurable:!0},TRUE:{configurable:!0},DONTCARE:{configurable:!0},SYM_FALSE:{configurable:!0},SYM_TRUE:{configurable:!0},SYM_DONTCARE:{configurable:!0},SYM_P:{configurable:!0},SYM_L:{configurable:!0},SYM_A:{configurable:!0}};Bx.P.get=function(){return 0},Bx.L.get=function(){return 1},Bx.A.get=function(){return 2},Bx.FALSE.get=function(){return-1},Bx.TRUE.get=function(){return-2},Bx.DONTCARE.get=function(){return-3},Bx.SYM_FALSE.get=function(){return"F"},Bx.SYM_TRUE.get=function(){return"T"},Bx.SYM_DONTCARE.get=function(){return"*"},Bx.SYM_P.get=function(){return"0"},Bx.SYM_L.get=function(){return"1"},Bx.SYM_A.get=function(){return"2"},bx.prototype.interfaces_=function(){return[]},bx.prototype.getClass=function(){return bx},bx.toDimensionSymbol=function(t){switch(t){case bx.FALSE:return bx.SYM_FALSE;case bx.TRUE:return bx.SYM_TRUE;case bx.DONTCARE:return bx.SYM_DONTCARE;case bx.P:return bx.SYM_P;case bx.L:return bx.SYM_L;case bx.A:return bx.SYM_A}throw new XI("Unknown dimension value: "+t)},bx.toDimensionValue=function(t){switch(fE.toUpperCase(t)){case bx.SYM_FALSE:return bx.FALSE;case bx.SYM_TRUE:return bx.TRUE;case bx.SYM_DONTCARE:return bx.DONTCARE;case bx.SYM_P:return bx.P;case bx.SYM_L:return bx.L;case bx.SYM_A:return bx.A}throw new XI("Unknown dimension symbol: "+t)},Object.defineProperties(bx,Bx);var Sx=function(){};Sx.prototype.filter=function(t){},Sx.prototype.interfaces_=function(){return[]},Sx.prototype.getClass=function(){return Sx};var Mx=function(){};Mx.prototype.filter=function(t,e){},Mx.prototype.isDone=function(){},Mx.prototype.isGeometryChanged=function(){},Mx.prototype.interfaces_=function(){return[]},Mx.prototype.getClass=function(){return Mx};var Lx=function(t){function e(e,n){if(t.call(this,n),this._geometries=e||[],t.hasNullElements(this._geometries))throw new XI("geometries must not contain null elements")}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={serialVersionUID:{configurable:!0}};return e.prototype.computeEnvelopeInternal=function(){for(var t=new xE,e=0;e<this._geometries.length;e++)t.expandToInclude(this._geometries[e].getEnvelopeInternal());return t},e.prototype.getGeometryN=function(t){return this._geometries[t]},e.prototype.getSortIndex=function(){return t.SORTINDEX_GEOMETRYCOLLECTION},e.prototype.getCoordinates=function(){for(var t=new Array(this.getNumPoints()).fill(null),e=-1,n=0;n<this._geometries.length;n++)for(var r=this._geometries[n].getCoordinates(),i=0;i<r.length;i++)t[++e]=r[i];return t},e.prototype.getArea=function(){for(var t=0,e=0;e<this._geometries.length;e++)t+=this._geometries[e].getArea();return t},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],n=arguments[1];if(!this.isEquivalentClass(e))return!1;var r=e;if(this._geometries.length!==r._geometries.length)return!1;for(var i=0;i<this._geometries.length;i++)if(!this._geometries[i].equalsExact(r._geometries[i],n))return!1;return!0}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.normalize=function(){for(var t=0;t<this._geometries.length;t++)this._geometries[t].normalize();wx.sort(this._geometries)},e.prototype.getCoordinate=function(){return this.isEmpty()?null:this._geometries[0].getCoordinate()},e.prototype.getBoundaryDimension=function(){for(var t=bx.FALSE,e=0;e<this._geometries.length;e++)t=Math.max(t,this._geometries[e].getBoundaryDimension());return t},e.prototype.getDimension=function(){for(var t=bx.FALSE,e=0;e<this._geometries.length;e++)t=Math.max(t,this._geometries[e].getDimension());return t},e.prototype.getLength=function(){for(var t=0,e=0;e<this._geometries.length;e++)t+=this._geometries[e].getLength();return t},e.prototype.getNumPoints=function(){for(var t=0,e=0;e<this._geometries.length;e++)t+=this._geometries[e].getNumPoints();return t},e.prototype.getNumGeometries=function(){return this._geometries.length},e.prototype.reverse=function(){for(var t=this._geometries.length,e=new Array(t).fill(null),n=0;n<this._geometries.length;n++)e[n]=this._geometries[n].reverse();return this.getFactory().createGeometryCollection(e)},e.prototype.compareToSameClass=function(){if(1===arguments.length){var t=arguments[0],e=new xx(wx.asList(this._geometries)),n=new xx(wx.asList(t._geometries));return this.compare(e,n)}if(2===arguments.length){for(var r=arguments[1],i=arguments[0],o=this.getNumGeometries(),s=i.getNumGeometries(),a=0;a<o&&a<s;){var u=this.getGeometryN(a),l=i.getGeometryN(a),c=u.compareToSameClass(l,r);if(0!==c)return c;a++}return a<o?1:a<s?-1:0}},e.prototype.apply=function(){var t=this;if(aE(arguments[0],zE))for(var e=arguments[0],n=0;n<this._geometries.length;n++)t._geometries[n].apply(e);else if(aE(arguments[0],Mx)){var r=arguments[0];if(0===this._geometries.length)return null;for(var i=0;i<this._geometries.length&&(t._geometries[i].apply(r),!r.isDone());i++);r.isGeometryChanged()&&this.geometryChanged()}else if(aE(arguments[0],Sx)){var o=arguments[0];o.filter(this);for(var s=0;s<this._geometries.length;s++)t._geometries[s].apply(o)}else if(aE(arguments[0],GE)){var a=arguments[0];a.filter(this);for(var u=0;u<this._geometries.length;u++)t._geometries[u].apply(a)}},e.prototype.getBoundary=function(){return this.checkNotGeometryCollection(this),TE.shouldNeverReachHere(),null},e.prototype.clone=function(){var e=t.prototype.clone.call(this);e._geometries=new Array(this._geometries.length).fill(null);for(var n=0;n<this._geometries.length;n++)e._geometries[n]=this._geometries[n].clone();return e},e.prototype.getGeometryType=function(){return"GeometryCollection"},e.prototype.copy=function(){for(var t=new Array(this._geometries.length).fill(null),n=0;n<t.length;n++)t[n]=this._geometries[n].copy();return new e(t,this._factory)},e.prototype.isEmpty=function(){for(var t=0;t<this._geometries.length;t++)if(!this._geometries[t].isEmpty())return!1;return!0},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},n.serialVersionUID.get=function(){return-0x4f07bcb1f857d800},Object.defineProperties(e,n),e}(UE),Nx=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return UE.SORTINDEX_MULTILINESTRING},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],n=arguments[1];return!!this.isEquivalentClass(e)&&t.prototype.equalsExact.call(this,e,n)}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.getBoundaryDimension=function(){return this.isClosed()?bx.FALSE:0},e.prototype.isClosed=function(){if(this.isEmpty())return!1;for(var t=0;t<this._geometries.length;t++)if(!this._geometries[t].isClosed())return!1;return!0},e.prototype.getDimension=function(){return 1},e.prototype.reverse=function(){for(var t=this._geometries.length,e=new Array(t).fill(null),n=0;n<this._geometries.length;n++)e[t-1-n]=this._geometries[n].reverse();return this.getFactory().createMultiLineString(e)},e.prototype.getBoundary=function(){return new Tx(this).getBoundary()},e.prototype.getGeometryType=function(){return"MultiLineString"},e.prototype.copy=function(){for(var t=new Array(this._geometries.length).fill(null),n=0;n<t.length;n++)t[n]=this._geometries[n].copy();return new e(t,this._factory)},e.prototype.interfaces_=function(){return[Ix]},e.prototype.getClass=function(){return e},n.serialVersionUID.get=function(){return 0x7155d2ab4afa8000},Object.defineProperties(e,n),e}(Lx),Tx=function(){if(this._geom=null,this._geomFact=null,this._bnRule=null,this._endpointMap=null,1===arguments.length){var t=arguments[0],e=VE.MOD2_BOUNDARY_RULE;this._geom=t,this._geomFact=t.getFactory(),this._bnRule=e}else if(2===arguments.length){var n=arguments[0],r=arguments[1];this._geom=n,this._geomFact=n.getFactory(),this._bnRule=r}};Tx.prototype.boundaryMultiLineString=function(t){if(this._geom.isEmpty())return this.getEmptyMultiPoint();var e=this.computeBoundaryCoordinates(t);return 1===e.length?this._geomFact.createPoint(e[0]):this._geomFact.createMultiPointFromCoords(e)},Tx.prototype.getBoundary=function(){return this._geom instanceof jx?this.boundaryLineString(this._geom):this._geom instanceof Nx?this.boundaryMultiLineString(this._geom):this._geom.getBoundary()},Tx.prototype.boundaryLineString=function(t){return this._geom.isEmpty()?this.getEmptyMultiPoint():t.isClosed()?this._bnRule.isInBoundary(2)?t.getStartPoint():this._geomFact.createMultiPoint():this._geomFact.createMultiPoint([t.getStartPoint(),t.getEndPoint()])},Tx.prototype.getEmptyMultiPoint=function(){return this._geomFact.createMultiPoint()},Tx.prototype.computeBoundaryCoordinates=function(t){var e=this,n=new nx;this._endpointMap=new _x;for(var r=0;r<t.getNumGeometries();r++){var i=t.getGeometryN(r);0!==i.getNumPoints()&&(e.addEndpoint(i.getCoordinateN(0)),e.addEndpoint(i.getCoordinateN(i.getNumPoints()-1)))}for(var o=this._endpointMap.entrySet().iterator();o.hasNext();){var s=o.next(),a=s.getValue().count;e._bnRule.isInBoundary(a)&&n.add(s.getKey())}return ox.toCoordinateArray(n)},Tx.prototype.addEndpoint=function(t){var e=this._endpointMap.get(t);null===e&&(e=new Rx,this._endpointMap.put(t,e)),e.count++},Tx.prototype.interfaces_=function(){return[]},Tx.prototype.getClass=function(){return Tx},Tx.getBoundary=function(){return 1===arguments.length?new Tx(arguments[0]).getBoundary():2===arguments.length?new Tx(arguments[0],arguments[1]).getBoundary():void 0};var Rx=function(){this.count=null};function Qx(){}function Dx(){}Rx.prototype.interfaces_=function(){return[]},Rx.prototype.getClass=function(){return Rx};var Px=function(){};function kx(){}function Ox(){}function Fx(){}var Gx=function(){},Ux={NEWLINE:{configurable:!0},SIMPLE_ORDINATE_FORMAT:{configurable:!0}};Gx.prototype.interfaces_=function(){return[]},Gx.prototype.getClass=function(){return Gx},Gx.chars=function(t,e){for(var n=new Array(e).fill(null),r=0;r<e;r++)n[r]=t;return String(n)},Gx.getStackTrace=function(){if(1===arguments.length){var t=arguments[0],e=new kx,n=new Qx;return t.printStackTrace(n),e.toString()}if(2===arguments.length){var r=arguments[1],i="";new Dx(Gx.getStackTrace(arguments[0]));for(var o=new Fx,s=0;s<r;s++)try{i+=o.readLine()+Gx.NEWLINE}catch(t){if(!(t instanceof Ox))throw t;TE.shouldNeverReachHere()}return i}},Gx.split=function(t,e){for(var n=e.length,r=new nx,i=""+t,o=i.indexOf(e);o>=0;){var s=i.substring(0,o);r.add(s),o=(i=i.substring(o+n)).indexOf(e)}i.length>0&&r.add(i);for(var a=new Array(r.size()).fill(null),u=0;u<a.length;u++)a[u]=r.get(u);return a},Gx.toString=function(){if(1===arguments.length){var t=arguments[0];return Gx.SIMPLE_ORDINATE_FORMAT.format(t)}},Gx.spaces=function(t){return Gx.chars(" ",t)},Ux.NEWLINE.get=function(){return IE.getProperty("line.separator")},Ux.SIMPLE_ORDINATE_FORMAT.get=function(){return new Px},Object.defineProperties(Gx,Ux);var qx=function(){};qx.prototype.interfaces_=function(){return[]},qx.prototype.getClass=function(){return qx},qx.copyCoord=function(t,e,n,r){for(var i=Math.min(t.getDimension(),n.getDimension()),o=0;o<i;o++)n.setOrdinate(r,o,t.getOrdinate(e,o))},qx.isRing=function(t){var e=t.size();return 0===e||!(e<=3)&&(t.getOrdinate(0,yE.X)===t.getOrdinate(e-1,yE.X)&&t.getOrdinate(0,yE.Y)===t.getOrdinate(e-1,yE.Y))},qx.isEqual=function(t,e){var n=t.size();if(n!==e.size())return!1;for(var r=Math.min(t.getDimension(),e.getDimension()),i=0;i<n;i++)for(var o=0;o<r;o++){var s=t.getOrdinate(i,o),a=e.getOrdinate(i,o);if(t.getOrdinate(i,o)!==e.getOrdinate(i,o)&&(!JI.isNaN(s)||!JI.isNaN(a)))return!1}return!0},qx.extend=function(t,e,n){var r=t.create(n,e.getDimension()),i=e.size();if(qx.copy(e,0,r,0,i),i>0)for(var o=i;o<n;o++)qx.copy(e,i-1,r,o,1);return r},qx.reverse=function(t){for(var e=t.size()-1,n=Math.trunc(e/2),r=0;r<=n;r++)qx.swap(t,r,e-r)},qx.swap=function(t,e,n){if(e===n)return null;for(var r=0;r<t.getDimension();r++){var i=t.getOrdinate(e,r);t.setOrdinate(e,r,t.getOrdinate(n,r)),t.setOrdinate(n,r,i)}},qx.copy=function(t,e,n,r,i){for(var o=0;o<i;o++)qx.copyCoord(t,e+o,n,r+o)},qx.toString=function(){if(1===arguments.length){var t=arguments[0],e=t.size();if(0===e)return"()";var n=t.getDimension(),r=new cE;r.append("(");for(var i=0;i<e;i++){i>0&&r.append(" ");for(var o=0;o<n;o++)o>0&&r.append(","),r.append(Gx.toString(t.getOrdinate(i,o)))}return r.append(")"),r.toString()}},qx.ensureValidRing=function(t,e){var n=e.size();return 0===n?e:n<=3?qx.createClosedRing(t,e,4):e.getOrdinate(0,yE.X)===e.getOrdinate(n-1,yE.X)&&e.getOrdinate(0,yE.Y)===e.getOrdinate(n-1,yE.Y)?e:qx.createClosedRing(t,e,n+1)},qx.createClosedRing=function(t,e,n){var r=t.create(n,e.getDimension()),i=e.size();qx.copy(e,0,r,0,i);for(var o=i;o<n;o++)qx.copy(e,0,r,o,1);return r};var jx=function(t){function e(e,n){t.call(this,n),this._points=null,this.init(e)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={serialVersionUID:{configurable:!0}};return e.prototype.computeEnvelopeInternal=function(){return this.isEmpty()?new xE:this._points.expandEnvelope(new xE)},e.prototype.isRing=function(){return this.isClosed()&&this.isSimple()},e.prototype.getSortIndex=function(){return t.SORTINDEX_LINESTRING},e.prototype.getCoordinates=function(){return this._points.toCoordinateArray()},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],n=arguments[1];if(!this.isEquivalentClass(e))return!1;var r=e;if(this._points.size()!==r._points.size())return!1;for(var i=0;i<this._points.size();i++)if(!this.equal(this._points.getCoordinate(i),r._points.getCoordinate(i),n))return!1;return!0}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.normalize=function(){for(var t=this,e=0;e<Math.trunc(this._points.size()/2);e++){var n=t._points.size()-1-e;if(!t._points.getCoordinate(e).equals(t._points.getCoordinate(n)))return t._points.getCoordinate(e).compareTo(t._points.getCoordinate(n))>0&&qx.reverse(t._points),null}},e.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},e.prototype.getBoundaryDimension=function(){return this.isClosed()?bx.FALSE:0},e.prototype.isClosed=function(){return!this.isEmpty()&&this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints()-1))},e.prototype.getEndPoint=function(){return this.isEmpty()?null:this.getPointN(this.getNumPoints()-1)},e.prototype.getDimension=function(){return 1},e.prototype.getLength=function(){return OE.computeLength(this._points)},e.prototype.getNumPoints=function(){return this._points.size()},e.prototype.reverse=function(){var t=this._points.copy();return qx.reverse(t),this.getFactory().createLineString(t)},e.prototype.compareToSameClass=function(){if(1===arguments.length){for(var t=arguments[0],e=0,n=0;e<this._points.size()&&n<t._points.size();){var r=this._points.getCoordinate(e).compareTo(t._points.getCoordinate(n));if(0!==r)return r;e++,n++}return e<this._points.size()?1:n<t._points.size()?-1:0}if(2===arguments.length){var i=arguments[0];return arguments[1].compare(this._points,i._points)}},e.prototype.apply=function(){if(aE(arguments[0],zE))for(var t=arguments[0],e=0;e<this._points.size();e++)t.filter(this._points.getCoordinate(e));else if(aE(arguments[0],Mx)){var n=arguments[0];if(0===this._points.size())return null;for(var r=0;r<this._points.size()&&(n.filter(this._points,r),!n.isDone());r++);n.isGeometryChanged()&&this.geometryChanged()}else if(aE(arguments[0],Sx)){arguments[0].filter(this)}else if(aE(arguments[0],GE)){arguments[0].filter(this)}},e.prototype.getBoundary=function(){return new Tx(this).getBoundary()},e.prototype.isEquivalentClass=function(t){return t instanceof e},e.prototype.clone=function(){var e=t.prototype.clone.call(this);return e._points=this._points.clone(),e},e.prototype.getCoordinateN=function(t){return this._points.getCoordinate(t)},e.prototype.getGeometryType=function(){return"LineString"},e.prototype.copy=function(){return new e(this._points.copy(),this._factory)},e.prototype.getCoordinateSequence=function(){return this._points},e.prototype.isEmpty=function(){return 0===this._points.size()},e.prototype.init=function(t){if(null===t&&(t=this.getFactory().getCoordinateSequenceFactory().create([])),1===t.size())throw new XI("Invalid number of points in LineString (found "+t.size()+" - must be 0 or >= 2)");this._points=t},e.prototype.isCoordinate=function(t){for(var e=0;e<this._points.size();e++)if(this._points.getCoordinate(e).equals(t))return!0;return!1},e.prototype.getStartPoint=function(){return this.isEmpty()?null:this.getPointN(0)},e.prototype.getPointN=function(t){return this.getFactory().createPoint(this._points.getCoordinate(t))},e.prototype.interfaces_=function(){return[Ix]},e.prototype.getClass=function(){return e},n.serialVersionUID.get=function(){return 0x2b2b51ba435c8e00},Object.defineProperties(e,n),e}(UE),zx=function(){};zx.prototype.interfaces_=function(){return[]},zx.prototype.getClass=function(){return zx};var Vx=function(t){function e(e,n){t.call(this,n),this._coordinates=e||null,this.init(this._coordinates)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={serialVersionUID:{configurable:!0}};return e.prototype.computeEnvelopeInternal=function(){if(this.isEmpty())return new xE;var t=new xE;return t.expandToInclude(this._coordinates.getX(0),this._coordinates.getY(0)),t},e.prototype.getSortIndex=function(){return t.SORTINDEX_POINT},e.prototype.getCoordinates=function(){return this.isEmpty()?[]:[this.getCoordinate()]},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],n=arguments[1];return!!this.isEquivalentClass(e)&&(!(!this.isEmpty()||!e.isEmpty())||this.isEmpty()===e.isEmpty()&&this.equal(e.getCoordinate(),this.getCoordinate(),n))}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.normalize=function(){},e.prototype.getCoordinate=function(){return 0!==this._coordinates.size()?this._coordinates.getCoordinate(0):null},e.prototype.getBoundaryDimension=function(){return bx.FALSE},e.prototype.getDimension=function(){return 0},e.prototype.getNumPoints=function(){return this.isEmpty()?0:1},e.prototype.reverse=function(){return this.copy()},e.prototype.getX=function(){if(null===this.getCoordinate())throw new Error("getX called on empty Point");return this.getCoordinate().x},e.prototype.compareToSameClass=function(){if(1===arguments.length){var t=arguments[0];return this.getCoordinate().compareTo(t.getCoordinate())}if(2===arguments.length){var e=arguments[0];return arguments[1].compare(this._coordinates,e._coordinates)}},e.prototype.apply=function(){if(aE(arguments[0],zE)){var t=arguments[0];if(this.isEmpty())return null;t.filter(this.getCoordinate())}else if(aE(arguments[0],Mx)){var e=arguments[0];if(this.isEmpty())return null;e.filter(this._coordinates,0),e.isGeometryChanged()&&this.geometryChanged()}else if(aE(arguments[0],Sx)){arguments[0].filter(this)}else if(aE(arguments[0],GE)){arguments[0].filter(this)}},e.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},e.prototype.clone=function(){var e=t.prototype.clone.call(this);return e._coordinates=this._coordinates.clone(),e},e.prototype.getGeometryType=function(){return"Point"},e.prototype.copy=function(){return new e(this._coordinates.copy(),this._factory)},e.prototype.getCoordinateSequence=function(){return this._coordinates},e.prototype.getY=function(){if(null===this.getCoordinate())throw new Error("getY called on empty Point");return this.getCoordinate().y},e.prototype.isEmpty=function(){return 0===this._coordinates.size()},e.prototype.init=function(t){null===t&&(t=this.getFactory().getCoordinateSequenceFactory().create([])),TE.isTrue(t.size()<=1),this._coordinates=t},e.prototype.isSimple=function(){return!0},e.prototype.interfaces_=function(){return[zx]},e.prototype.getClass=function(){return e},n.serialVersionUID.get=function(){return 0x44077bad161cbc00},Object.defineProperties(e,n),e}(UE),Yx=function(){};Yx.prototype.interfaces_=function(){return[]},Yx.prototype.getClass=function(){return Yx};var Hx=function(t){function e(e,n,r){if(t.call(this,r),this._shell=null,this._holes=null,null===e&&(e=this.getFactory().createLinearRing()),null===n&&(n=[]),t.hasNullElements(n))throw new XI("holes must not contain null elements");if(e.isEmpty()&&t.hasNonEmptyElements(n))throw new XI("shell is empty but holes are not");this._shell=e,this._holes=n}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={serialVersionUID:{configurable:!0}};return e.prototype.computeEnvelopeInternal=function(){return this._shell.getEnvelopeInternal()},e.prototype.getSortIndex=function(){return t.SORTINDEX_POLYGON},e.prototype.getCoordinates=function(){if(this.isEmpty())return[];for(var t=new Array(this.getNumPoints()).fill(null),e=-1,n=this._shell.getCoordinates(),r=0;r<n.length;r++)t[++e]=n[r];for(var i=0;i<this._holes.length;i++)for(var o=this._holes[i].getCoordinates(),s=0;s<o.length;s++)t[++e]=o[s];return t},e.prototype.getArea=function(){var t=0;t+=Math.abs(OE.signedArea(this._shell.getCoordinateSequence()));for(var e=0;e<this._holes.length;e++)t-=Math.abs(OE.signedArea(this._holes[e].getCoordinateSequence()));return t},e.prototype.isRectangle=function(){if(0!==this.getNumInteriorRing())return!1;if(null===this._shell)return!1;if(5!==this._shell.getNumPoints())return!1;for(var t=this._shell.getCoordinateSequence(),e=this.getEnvelopeInternal(),n=0;n<5;n++){var r=t.getX(n);if(r!==e.getMinX()&&r!==e.getMaxX())return!1;var i=t.getY(n);if(i!==e.getMinY()&&i!==e.getMaxY())return!1}for(var o=t.getX(0),s=t.getY(0),a=1;a<=4;a++){var u=t.getX(a),l=t.getY(a);if(u!==o===(l!==s))return!1;o=u,s=l}return!0},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],n=arguments[1];if(!this.isEquivalentClass(e))return!1;var r=e,i=this._shell,o=r._shell;if(!i.equalsExact(o,n))return!1;if(this._holes.length!==r._holes.length)return!1;for(var s=0;s<this._holes.length;s++)if(!this._holes[s].equalsExact(r._holes[s],n))return!1;return!0}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.normalize=function(){if(0===arguments.length){this.normalize(this._shell,!0);for(var t=0;t<this._holes.length;t++)this.normalize(this._holes[t],!1);wx.sort(this._holes)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];if(e.isEmpty())return null;var r=new Array(e.getCoordinates().length-1).fill(null);IE.arraycopy(e.getCoordinates(),0,r,0,r.length);var i=ox.minCoordinate(e.getCoordinates());ox.scroll(r,i),IE.arraycopy(r,0,e.getCoordinates(),0,r.length),e.getCoordinates()[r.length]=r[0],OE.isCCW(e.getCoordinates())===n&&ox.reverse(e.getCoordinates())}},e.prototype.getCoordinate=function(){return this._shell.getCoordinate()},e.prototype.getNumInteriorRing=function(){return this._holes.length},e.prototype.getBoundaryDimension=function(){return 1},e.prototype.getDimension=function(){return 2},e.prototype.getLength=function(){var t=0;t+=this._shell.getLength();for(var e=0;e<this._holes.length;e++)t+=this._holes[e].getLength();return t},e.prototype.getNumPoints=function(){for(var t=this._shell.getNumPoints(),e=0;e<this._holes.length;e++)t+=this._holes[e].getNumPoints();return t},e.prototype.reverse=function(){var t=this.copy();t._shell=this._shell.copy().reverse(),t._holes=new Array(this._holes.length).fill(null);for(var e=0;e<this._holes.length;e++)t._holes[e]=this._holes[e].copy().reverse();return t},e.prototype.convexHull=function(){return this.getExteriorRing().convexHull()},e.prototype.compareToSameClass=function(){if(1===arguments.length){var t=arguments[0],e=this._shell,n=t._shell;return e.compareToSameClass(n)}if(2===arguments.length){var r=arguments[1],i=arguments[0],o=this._shell,s=i._shell,a=o.compareToSameClass(s,r);if(0!==a)return a;for(var u=this.getNumInteriorRing(),l=i.getNumInteriorRing(),c=0;c<u&&c<l;){var h=this.getInteriorRingN(c),f=i.getInteriorRingN(c),p=h.compareToSameClass(f,r);if(0!==p)return p;c++}return c<u?1:c<l?-1:0}},e.prototype.apply=function(t){var e=this;if(aE(t,zE)){this._shell.apply(t);for(var n=0;n<this._holes.length;n++)e._holes[n].apply(t)}else if(aE(t,Mx)){if(this._shell.apply(t),!t.isDone())for(var r=0;r<this._holes.length&&(e._holes[r].apply(t),!t.isDone());r++);t.isGeometryChanged()&&this.geometryChanged()}else if(aE(t,Sx))t.filter(this);else if(aE(t,GE)){t.filter(this),this._shell.apply(t);for(var i=0;i<this._holes.length;i++)e._holes[i].apply(t)}},e.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();var t=new Array(this._holes.length+1).fill(null);t[0]=this._shell;for(var e=0;e<this._holes.length;e++)t[e+1]=this._holes[e];return t.length<=1?this.getFactory().createLinearRing(t[0].getCoordinateSequence()):this.getFactory().createMultiLineString(t)},e.prototype.clone=function(){var e=t.prototype.clone.call(this);e._shell=this._shell.clone(),e._holes=new Array(this._holes.length).fill(null);for(var n=0;n<this._holes.length;n++)e._holes[n]=this._holes[n].clone();return e},e.prototype.getGeometryType=function(){return"Polygon"},e.prototype.copy=function(){for(var t=this._shell.copy(),n=new Array(this._holes.length).fill(null),r=0;r<n.length;r++)n[r]=this._holes[r].copy();return new e(t,n,this._factory)},e.prototype.getExteriorRing=function(){return this._shell},e.prototype.isEmpty=function(){return this._shell.isEmpty()},e.prototype.getInteriorRingN=function(t){return this._holes[t]},e.prototype.interfaces_=function(){return[Yx]},e.prototype.getClass=function(){return e},n.serialVersionUID.get=function(){return-0x307ffefd8dc97200},Object.defineProperties(e,n),e}(UE),Xx=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return UE.SORTINDEX_MULTIPOINT},e.prototype.isValid=function(){return!0},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],n=arguments[1];return!!this.isEquivalentClass(e)&&t.prototype.equalsExact.call(this,e,n)}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.getCoordinate=function(){if(1===arguments.length){var e=arguments[0];return this._geometries[e].getCoordinate()}return t.prototype.getCoordinate.apply(this,arguments)},e.prototype.getBoundaryDimension=function(){return bx.FALSE},e.prototype.getDimension=function(){return 0},e.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},e.prototype.getGeometryType=function(){return"MultiPoint"},e.prototype.copy=function(){for(var t=new Array(this._geometries.length).fill(null),n=0;n<t.length;n++)t[n]=this._geometries[n].copy();return new e(t,this._factory)},e.prototype.interfaces_=function(){return[zx]},e.prototype.getClass=function(){return e},n.serialVersionUID.get=function(){return-0x6fb1ed4162e0fc00},Object.defineProperties(e,n),e}(Lx),Jx=function(t){function e(e,n){e instanceof eE&&n instanceof hC&&(e=n.getCoordinateSequenceFactory().create(e)),t.call(this,e,n),this.validateConstruction()}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={MINIMUM_VALID_SIZE:{configurable:!0},serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return UE.SORTINDEX_LINEARRING},e.prototype.getBoundaryDimension=function(){return bx.FALSE},e.prototype.isClosed=function(){return!!this.isEmpty()||t.prototype.isClosed.call(this)},e.prototype.reverse=function(){var t=this._points.copy();return qx.reverse(t),this.getFactory().createLinearRing(t)},e.prototype.validateConstruction=function(){if(!this.isEmpty()&&!t.prototype.isClosed.call(this))throw new XI("Points of LinearRing do not form a closed linestring");if(this.getCoordinateSequence().size()>=1&&this.getCoordinateSequence().size()<e.MINIMUM_VALID_SIZE)throw new XI("Invalid number of points in LinearRing (found "+this.getCoordinateSequence().size()+" - must be 0 or >= 4)")},e.prototype.getGeometryType=function(){return"LinearRing"},e.prototype.copy=function(){return new e(this._points.copy(),this._factory)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},n.MINIMUM_VALID_SIZE.get=function(){return 4},n.serialVersionUID.get=function(){return-0x3b229e262367a600},Object.defineProperties(e,n),e}(jx),Wx=function(t){function e(){t.apply(this,arguments)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={serialVersionUID:{configurable:!0}};return e.prototype.getSortIndex=function(){return UE.SORTINDEX_MULTIPOLYGON},e.prototype.equalsExact=function(){if(2===arguments.length){var e=arguments[0],n=arguments[1];return!!this.isEquivalentClass(e)&&t.prototype.equalsExact.call(this,e,n)}return t.prototype.equalsExact.apply(this,arguments)},e.prototype.getBoundaryDimension=function(){return 1},e.prototype.getDimension=function(){return 2},e.prototype.reverse=function(){for(var t=this._geometries.length,e=new Array(t).fill(null),n=0;n<this._geometries.length;n++)e[n]=this._geometries[n].reverse();return this.getFactory().createMultiPolygon(e)},e.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();for(var t=new nx,e=0;e<this._geometries.length;e++)for(var n=this._geometries[e].getBoundary(),r=0;r<n.getNumGeometries();r++)t.add(n.getGeometryN(r));var i=new Array(t.size()).fill(null);return this.getFactory().createMultiLineString(t.toArray(i))},e.prototype.getGeometryType=function(){return"MultiPolygon"},e.prototype.copy=function(){for(var t=new Array(this._geometries.length).fill(null),n=0;n<t.length;n++)t[n]=this._geometries[n].copy();return new e(t,this._factory)},e.prototype.interfaces_=function(){return[Yx]},e.prototype.getClass=function(){return e},n.serialVersionUID.get=function(){return-0x7a5aa1369171980},Object.defineProperties(e,n),e}(Lx),Kx=function(t){this._factory=t||null,this._isUserDataCopied=!1},Zx={NoOpGeometryOperation:{configurable:!0},CoordinateOperation:{configurable:!0},CoordinateSequenceOperation:{configurable:!0}};Kx.prototype.setCopyUserData=function(t){this._isUserDataCopied=t},Kx.prototype.edit=function(t,e){if(null===t)return null;var n=this.editInternal(t,e);return this._isUserDataCopied&&n.setUserData(t.getUserData()),n},Kx.prototype.editInternal=function(t,e){return null===this._factory&&(this._factory=t.getFactory()),t instanceof Lx?this.editGeometryCollection(t,e):t instanceof Hx?this.editPolygon(t,e):t instanceof Vx||t instanceof jx?e.edit(t,this._factory):(TE.shouldNeverReachHere("Unsupported Geometry class: "+t.getClass().getName()),null)},Kx.prototype.editGeometryCollection=function(t,e){for(var n=e.edit(t,this._factory),r=new nx,i=0;i<n.getNumGeometries();i++){var o=this.edit(n.getGeometryN(i),e);null===o||o.isEmpty()||r.add(o)}return n.getClass()===Xx?this._factory.createMultiPoint(r.toArray([])):n.getClass()===Nx?this._factory.createMultiLineString(r.toArray([])):n.getClass()===Wx?this._factory.createMultiPolygon(r.toArray([])):this._factory.createGeometryCollection(r.toArray([]))},Kx.prototype.editPolygon=function(t,e){var n=e.edit(t,this._factory);if(null===n&&(n=this._factory.createPolygon(null)),n.isEmpty())return n;var r=this.edit(n.getExteriorRing(),e);if(null===r||r.isEmpty())return this._factory.createPolygon();for(var i=new nx,o=0;o<n.getNumInteriorRing();o++){var s=this.edit(n.getInteriorRingN(o),e);null===s||s.isEmpty()||i.add(s)}return this._factory.createPolygon(r,i.toArray([]))},Kx.prototype.interfaces_=function(){return[]},Kx.prototype.getClass=function(){return Kx},Kx.GeometryEditorOperation=function(){},Zx.NoOpGeometryOperation.get=function(){return $x},Zx.CoordinateOperation.get=function(){return tC},Zx.CoordinateSequenceOperation.get=function(){return eC},Object.defineProperties(Kx,Zx);var $x=function(){};$x.prototype.edit=function(t,e){return t},$x.prototype.interfaces_=function(){return[Kx.GeometryEditorOperation]},$x.prototype.getClass=function(){return $x};var tC=function(){};tC.prototype.edit=function(t,e){var n=this.editCoordinates(t.getCoordinates(),t);return null===n?t:t instanceof Jx?e.createLinearRing(n):t instanceof jx?e.createLineString(n):t instanceof Vx?n.length>0?e.createPoint(n[0]):e.createPoint():t},tC.prototype.interfaces_=function(){return[Kx.GeometryEditorOperation]},tC.prototype.getClass=function(){return tC};var eC=function(){};eC.prototype.edit=function(t,e){return t instanceof Jx?e.createLinearRing(this.edit(t.getCoordinateSequence(),t)):t instanceof jx?e.createLineString(this.edit(t.getCoordinateSequence(),t)):t instanceof Vx?e.createPoint(this.edit(t.getCoordinateSequence(),t)):t},eC.prototype.interfaces_=function(){return[Kx.GeometryEditorOperation]},eC.prototype.getClass=function(){return eC};var nC=function(){var t=this;if(this._dimension=3,this._coordinates=null,1===arguments.length){if(arguments[0]instanceof Array)this._coordinates=arguments[0],this._dimension=3;else if(Number.isInteger(arguments[0])){var e=arguments[0];this._coordinates=new Array(e).fill(null);for(var n=0;n<e;n++)t._coordinates[n]=new eE}else if(aE(arguments[0],yE)){var r=arguments[0];if(null===r)return this._coordinates=new Array(0).fill(null),null;this._dimension=r.getDimension(),this._coordinates=new Array(r.size()).fill(null);for(var i=0;i<this._coordinates.length;i++)t._coordinates[i]=r.getCoordinateCopy(i)}}else if(2===arguments.length)if(arguments[0]instanceof Array&&Number.isInteger(arguments[1])){var o=arguments[0],s=arguments[1];this._coordinates=o,this._dimension=s,null===o&&(this._coordinates=new Array(0).fill(null))}else if(Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var a=arguments[0],u=arguments[1];this._coordinates=new Array(a).fill(null),this._dimension=u;for(var l=0;l<a;l++)t._coordinates[l]=new eE}},rC={serialVersionUID:{configurable:!0}};nC.prototype.setOrdinate=function(t,e,n){switch(e){case yE.X:this._coordinates[t].x=n;break;case yE.Y:this._coordinates[t].y=n;break;case yE.Z:this._coordinates[t].z=n;break;default:throw new XI("invalid ordinateIndex")}},nC.prototype.size=function(){return this._coordinates.length},nC.prototype.getOrdinate=function(t,e){switch(e){case yE.X:return this._coordinates[t].x;case yE.Y:return this._coordinates[t].y;case yE.Z:return this._coordinates[t].z}return JI.NaN},nC.prototype.getCoordinate=function(){if(1===arguments.length){var t=arguments[0];return this._coordinates[t]}if(2===arguments.length){var e=arguments[0],n=arguments[1];n.x=this._coordinates[e].x,n.y=this._coordinates[e].y,n.z=this._coordinates[e].z}},nC.prototype.getCoordinateCopy=function(t){return new eE(this._coordinates[t])},nC.prototype.getDimension=function(){return this._dimension},nC.prototype.getX=function(t){return this._coordinates[t].x},nC.prototype.clone=function(){for(var t=new Array(this.size()).fill(null),e=0;e<this._coordinates.length;e++)t[e]=this._coordinates[e].clone();return new nC(t,this._dimension)},nC.prototype.expandEnvelope=function(t){for(var e=0;e<this._coordinates.length;e++)t.expandToInclude(this._coordinates[e]);return t},nC.prototype.copy=function(){for(var t=new Array(this.size()).fill(null),e=0;e<this._coordinates.length;e++)t[e]=this._coordinates[e].copy();return new nC(t,this._dimension)},nC.prototype.toString=function(){if(this._coordinates.length>0){var t=new cE(17*this._coordinates.length);t.append("("),t.append(this._coordinates[0]);for(var e=1;e<this._coordinates.length;e++)t.append(", "),t.append(this._coordinates[e]);return t.append(")"),t.toString()}return"()"},nC.prototype.getY=function(t){return this._coordinates[t].y},nC.prototype.toCoordinateArray=function(){return this._coordinates},nC.prototype.interfaces_=function(){return[yE,tE]},nC.prototype.getClass=function(){return nC},rC.serialVersionUID.get=function(){return-0xcb44a778db18e00},Object.defineProperties(nC,rC);var iC=function(){},oC={serialVersionUID:{configurable:!0},instanceObject:{configurable:!0}};iC.prototype.readResolve=function(){return iC.instance()},iC.prototype.create=function(){if(1===arguments.length){if(arguments[0]instanceof Array)return new nC(arguments[0]);if(aE(arguments[0],yE))return new nC(arguments[0])}else if(2===arguments.length){var t=arguments[0],e=arguments[1];return e>3&&(e=3),e<2?new nC(t):new nC(t,e)}},iC.prototype.interfaces_=function(){return[iE,tE]},iC.prototype.getClass=function(){return iC},iC.instance=function(){return iC.instanceObject},oC.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00},oC.instanceObject.get=function(){return new iC},Object.defineProperties(iC,oC);var sC=function(t){function e(){t.call(this),this.map_=new Map}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.get=function(t){return this.map_.get(t)||null},e.prototype.put=function(t,e){return this.map_.set(t,e),e},e.prototype.values=function(){for(var t=new nx,e=this.map_.values(),n=e.next();!n.done;)t.add(n.value),n=e.next();return t},e.prototype.entrySet=function(){var t=new px;return this.map_.entries().forEach((function(e){return t.add(e)})),t},e.prototype.size=function(){return this.map_.size()},e}(lx),aC=function t(){if(this._modelType=null,this._scale=null,0===arguments.length)this._modelType=t.FLOATING;else if(1===arguments.length)if(arguments[0]instanceof lC){var e=arguments[0];this._modelType=e,e===t.FIXED&&this.setScale(1)}else if("number"==typeof arguments[0]){var n=arguments[0];this._modelType=t.FIXED,this.setScale(n)}else if(arguments[0]instanceof t){var r=arguments[0];this._modelType=r._modelType,this._scale=r._scale}},uC={serialVersionUID:{configurable:!0},maximumPreciseValue:{configurable:!0}};aC.prototype.equals=function(t){if(!(t instanceof aC))return!1;var e=t;return this._modelType===e._modelType&&this._scale===e._scale},aC.prototype.compareTo=function(t){var e=t,n=this.getMaximumSignificantDigits(),r=e.getMaximumSignificantDigits();return new hE(n).compareTo(new hE(r))},aC.prototype.getScale=function(){return this._scale},aC.prototype.isFloating=function(){return this._modelType===aC.FLOATING||this._modelType===aC.FLOATING_SINGLE},aC.prototype.getType=function(){return this._modelType},aC.prototype.toString=function(){var t="UNKNOWN";return this._modelType===aC.FLOATING?t="Floating":this._modelType===aC.FLOATING_SINGLE?t="Floating-Single":this._modelType===aC.FIXED&&(t="Fixed (Scale="+this.getScale()+")"),t},aC.prototype.makePrecise=function(){if("number"==typeof arguments[0]){var t=arguments[0];return JI.isNaN(t)||this._modelType===aC.FLOATING_SINGLE?t:this._modelType===aC.FIXED?Math.round(t*this._scale)/this._scale:t}if(arguments[0]instanceof eE){var e=arguments[0];if(this._modelType===aC.FLOATING)return null;e.x=this.makePrecise(e.x),e.y=this.makePrecise(e.y)}},aC.prototype.getMaximumSignificantDigits=function(){var t=16;return this._modelType===aC.FLOATING?t=16:this._modelType===aC.FLOATING_SINGLE?t=6:this._modelType===aC.FIXED&&(t=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),t},aC.prototype.setScale=function(t){this._scale=Math.abs(t)},aC.prototype.interfaces_=function(){return[tE,KI]},aC.prototype.getClass=function(){return aC},aC.mostPrecise=function(t,e){return t.compareTo(e)>=0?t:e},uC.serialVersionUID.get=function(){return 0x6bee6404e9a25c00},uC.maximumPreciseValue.get=function(){return 9007199254740992},Object.defineProperties(aC,uC);var lC=function t(e){this._name=e||null,t.nameToTypeMap.put(e,this)},cC={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}};lC.prototype.readResolve=function(){return lC.nameToTypeMap.get(this._name)},lC.prototype.toString=function(){return this._name},lC.prototype.interfaces_=function(){return[tE]},lC.prototype.getClass=function(){return lC},cC.serialVersionUID.get=function(){return-552860263173159e4},cC.nameToTypeMap.get=function(){return new sC},Object.defineProperties(lC,cC),aC.Type=lC,aC.FIXED=new lC("FIXED"),aC.FLOATING=new lC("FLOATING"),aC.FLOATING_SINGLE=new lC("FLOATING SINGLE");var hC=function t(){this._precisionModel=new aC,this._SRID=0,this._coordinateSequenceFactory=t.getDefaultCoordinateSequenceFactory(),0===arguments.length||(1===arguments.length?aE(arguments[0],iE)?this._coordinateSequenceFactory=arguments[0]:arguments[0]instanceof aC&&(this._precisionModel=arguments[0]):2===arguments.length?(this._precisionModel=arguments[0],this._SRID=arguments[1]):3===arguments.length&&(this._precisionModel=arguments[0],this._SRID=arguments[1],this._coordinateSequenceFactory=arguments[2]))},fC={serialVersionUID:{configurable:!0}};hC.prototype.toGeometry=function(t){return t.isNull()?this.createPoint(null):t.getMinX()===t.getMaxX()&&t.getMinY()===t.getMaxY()?this.createPoint(new eE(t.getMinX(),t.getMinY())):t.getMinX()===t.getMaxX()||t.getMinY()===t.getMaxY()?this.createLineString([new eE(t.getMinX(),t.getMinY()),new eE(t.getMaxX(),t.getMaxY())]):this.createPolygon(this.createLinearRing([new eE(t.getMinX(),t.getMinY()),new eE(t.getMinX(),t.getMaxY()),new eE(t.getMaxX(),t.getMaxY()),new eE(t.getMaxX(),t.getMinY()),new eE(t.getMinX(),t.getMinY())]),null)},hC.prototype.createLineString=function(t){return t?t instanceof Array?new jx(this.getCoordinateSequenceFactory().create(t),this):aE(t,yE)?new jx(t,this):void 0:new jx(this.getCoordinateSequenceFactory().create([]),this)},hC.prototype.createMultiLineString=function(){return 0===arguments.length?new Nx(null,this):1===arguments.length?new Nx(arguments[0],this):void 0},hC.prototype.buildGeometry=function(t){for(var e=null,n=!1,r=!1,i=t.iterator();i.hasNext();){var o=i.next(),s=o.getClass();null===e&&(e=s),s!==e&&(n=!0),o.isGeometryCollectionOrDerived()&&(r=!0)}if(null===e)return this.createGeometryCollection();if(n||r)return this.createGeometryCollection(hC.toGeometryArray(t));var a=t.iterator().next();if(t.size()>1){if(a instanceof Hx)return this.createMultiPolygon(hC.toPolygonArray(t));if(a instanceof jx)return this.createMultiLineString(hC.toLineStringArray(t));if(a instanceof Vx)return this.createMultiPoint(hC.toPointArray(t));TE.shouldNeverReachHere("Unhandled class: "+a.getClass().getName())}return a},hC.prototype.createMultiPointFromCoords=function(t){return this.createMultiPoint(null!==t?this.getCoordinateSequenceFactory().create(t):null)},hC.prototype.createPoint=function(){if(0===arguments.length)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(1===arguments.length){if(arguments[0]instanceof eE){var t=arguments[0];return this.createPoint(null!==t?this.getCoordinateSequenceFactory().create([t]):null)}if(aE(arguments[0],yE))return new Vx(arguments[0],this)}},hC.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory},hC.prototype.createPolygon=function(){if(0===arguments.length)return new Hx(null,null,this);if(1===arguments.length){if(aE(arguments[0],yE)){var t=arguments[0];return this.createPolygon(this.createLinearRing(t))}if(arguments[0]instanceof Array){var e=arguments[0];return this.createPolygon(this.createLinearRing(e))}if(arguments[0]instanceof Jx){var n=arguments[0];return this.createPolygon(n,null)}}else if(2===arguments.length){return new Hx(arguments[0],arguments[1],this)}},hC.prototype.getSRID=function(){return this._SRID},hC.prototype.createGeometryCollection=function(){return 0===arguments.length?new Lx(null,this):1===arguments.length?new Lx(arguments[0],this):void 0},hC.prototype.createGeometry=function(t){return new Kx(this).edit(t,{edit:function(){if(2===arguments.length){var t=arguments[0];return this._coordinateSequenceFactory.create(t)}}})},hC.prototype.getPrecisionModel=function(){return this._precisionModel},hC.prototype.createLinearRing=function(){if(0===arguments.length)return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));if(1===arguments.length){if(arguments[0]instanceof Array){var t=arguments[0];return this.createLinearRing(null!==t?this.getCoordinateSequenceFactory().create(t):null)}if(aE(arguments[0],yE))return new Jx(arguments[0],this)}},hC.prototype.createMultiPolygon=function(){return 0===arguments.length?new Wx(null,this):1===arguments.length?new Wx(arguments[0],this):void 0},hC.prototype.createMultiPoint=function(){if(0===arguments.length)return new Xx(null,this);if(1===arguments.length){if(arguments[0]instanceof Array)return new Xx(arguments[0],this);if(arguments[0]instanceof Array){var t=arguments[0];return this.createMultiPoint(null!==t?this.getCoordinateSequenceFactory().create(t):null)}if(aE(arguments[0],yE)){var e=arguments[0];if(null===e)return this.createMultiPoint(new Array(0).fill(null));for(var n=new Array(e.size()).fill(null),r=0;r<e.size();r++){var i=this.getCoordinateSequenceFactory().create(1,e.getDimension());qx.copy(e,r,i,0,1),n[r]=this.createPoint(i)}return this.createMultiPoint(n)}}},hC.prototype.interfaces_=function(){return[tE]},hC.prototype.getClass=function(){return hC},hC.toMultiPolygonArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},hC.toGeometryArray=function(t){if(null===t)return null;var e=new Array(t.size()).fill(null);return t.toArray(e)},hC.getDefaultCoordinateSequenceFactory=function(){return iC.instance()},hC.toMultiLineStringArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},hC.toLineStringArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},hC.toMultiPointArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},hC.toLinearRingArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},hC.toPointArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},hC.toPolygonArray=function(t){var e=new Array(t.size()).fill(null);return t.toArray(e)},hC.createPointFromInternalCoord=function(t,e){return e.getPrecisionModel().makePrecise(t),e.getFactory().createPoint(t)},fC.serialVersionUID.get=function(){return-0x5ea75f2051eeb400},Object.defineProperties(hC,fC);var pC=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],gC=function(t){this.geometryFactory=t||new hC};gC.prototype.read=function(t){var e,n=(e="string"==typeof t?JSON.parse(t):t).type;if(!AC[n])throw new Error("Unknown GeoJSON type: "+e.type);return-1!==pC.indexOf(n)?AC[n].apply(this,[e.coordinates]):"GeometryCollection"===n?AC[n].apply(this,[e.geometries]):AC[n].apply(this,[e])},gC.prototype.write=function(t){var e=t.getGeometryType();if(!dC[e])throw new Error("Geometry is not supported");return dC[e].apply(this,[t])};var AC={Feature:function(t){var e={};for(var n in t)e[n]=t[n];if(t.geometry){var r=t.geometry.type;if(!AC[r])throw new Error("Unknown GeoJSON type: "+t.type);e.geometry=this.read(t.geometry)}return t.bbox&&(e.bbox=AC.bbox.apply(this,[t.bbox])),e},FeatureCollection:function(t){var e={};if(t.features){e.features=[];for(var n=0;n<t.features.length;++n)e.features.push(this.read(t.features[n]))}return t.bbox&&(e.bbox=this.parse.bbox.apply(this,[t.bbox])),e},coordinates:function(t){for(var e=[],n=0;n<t.length;++n){var r=t[n];e.push(new eE(r[0],r[1]))}return e},bbox:function(t){return this.geometryFactory.createLinearRing([new eE(t[0],t[1]),new eE(t[2],t[1]),new eE(t[2],t[3]),new eE(t[0],t[3]),new eE(t[0],t[1])])},Point:function(t){var e=new eE(t[0],t[1]);return this.geometryFactory.createPoint(e)},MultiPoint:function(t){for(var e=[],n=0;n<t.length;++n)e.push(AC.Point.apply(this,[t[n]]));return this.geometryFactory.createMultiPoint(e)},LineString:function(t){var e=AC.coordinates.apply(this,[t]);return this.geometryFactory.createLineString(e)},MultiLineString:function(t){for(var e=[],n=0;n<t.length;++n)e.push(AC.LineString.apply(this,[t[n]]));return this.geometryFactory.createMultiLineString(e)},Polygon:function(t){for(var e=AC.coordinates.apply(this,[t[0]]),n=this.geometryFactory.createLinearRing(e),r=[],i=1;i<t.length;++i){var o=t[i],s=AC.coordinates.apply(this,[o]),a=this.geometryFactory.createLinearRing(s);r.push(a)}return this.geometryFactory.createPolygon(n,r)},MultiPolygon:function(t){for(var e=[],n=0;n<t.length;++n){var r=t[n];e.push(AC.Polygon.apply(this,[r]))}return this.geometryFactory.createMultiPolygon(e)},GeometryCollection:function(t){for(var e=[],n=0;n<t.length;++n){var r=t[n];e.push(this.read(r))}return this.geometryFactory.createGeometryCollection(e)}},dC={coordinate:function(t){return[t.x,t.y]},Point:function(t){return{type:"Point",coordinates:dC.coordinate.apply(this,[t.getCoordinate()])}},MultiPoint:function(t){for(var e=[],n=0;n<t._geometries.length;++n){var r=t._geometries[n],i=dC.Point.apply(this,[r]);e.push(i.coordinates)}return{type:"MultiPoint",coordinates:e}},LineString:function(t){for(var e=[],n=t.getCoordinates(),r=0;r<n.length;++r){var i=n[r];e.push(dC.coordinate.apply(this,[i]))}return{type:"LineString",coordinates:e}},MultiLineString:function(t){for(var e=[],n=0;n<t._geometries.length;++n){var r=t._geometries[n],i=dC.LineString.apply(this,[r]);e.push(i.coordinates)}return{type:"MultiLineString",coordinates:e}},Polygon:function(t){var e=[],n=dC.LineString.apply(this,[t._shell]);e.push(n.coordinates);for(var r=0;r<t._holes.length;++r){var i=t._holes[r],o=dC.LineString.apply(this,[i]);e.push(o.coordinates)}return{type:"Polygon",coordinates:e}},MultiPolygon:function(t){for(var e=[],n=0;n<t._geometries.length;++n){var r=t._geometries[n],i=dC.Polygon.apply(this,[r]);e.push(i.coordinates)}return{type:"MultiPolygon",coordinates:e}},GeometryCollection:function(t){for(var e=[],n=0;n<t._geometries.length;++n){var r=t._geometries[n],i=r.getGeometryType();e.push(dC[i].apply(this,[r]))}return{type:"GeometryCollection",geometries:e}}},yC=function(t){this.geometryFactory=t||new hC,this.precisionModel=this.geometryFactory.getPrecisionModel(),this.parser=new gC(this.geometryFactory)};yC.prototype.read=function(t){var e=this.parser.read(t);return this.precisionModel.getType()===aC.FIXED&&this.reducePrecision(e),e},yC.prototype.reducePrecision=function(t){var e,n;if(t.coordinate)this.precisionModel.makePrecise(t.coordinate);else if(t.points)for(e=0,n=t.points.length;e<n;e++)this.precisionModel.makePrecise(t.points[e]);else if(t.geometries)for(e=0,n=t.geometries.length;e<n;e++)this.reducePrecision(t.geometries[e])};var vC=function(){this.parser=new gC(this.geometryFactory)};vC.prototype.write=function(t){return this.parser.write(t)};var mC=function(){},_C={ON:{configurable:!0},LEFT:{configurable:!0},RIGHT:{configurable:!0}};function IC(t){this.message=t||""}function EC(){this.array_=[]}mC.prototype.interfaces_=function(){return[]},mC.prototype.getClass=function(){return mC},mC.opposite=function(t){return t===mC.LEFT?mC.RIGHT:t===mC.RIGHT?mC.LEFT:t},_C.ON.get=function(){return 0},_C.LEFT.get=function(){return 1},_C.RIGHT.get=function(){return 2},Object.defineProperties(mC,_C),IC.prototype=new Error,IC.prototype.name="EmptyStackException",EC.prototype=new tx,EC.prototype.add=function(t){return this.array_.push(t),!0},EC.prototype.get=function(t){if(t<0||t>=this.size())throw new Error;return this.array_[t]},EC.prototype.push=function(t){return this.array_.push(t),t},EC.prototype.pop=function(t){if(0===this.array_.length)throw new IC;return this.array_.pop()},EC.prototype.peek=function(){if(0===this.array_.length)throw new IC;return this.array_[this.array_.length-1]},EC.prototype.empty=function(){return 0===this.array_.length},EC.prototype.isEmpty=function(){return this.empty()},EC.prototype.search=function(t){return this.array_.indexOf(t)},EC.prototype.size=function(){return this.array_.length},EC.prototype.toArray=function(){for(var t=[],e=0,n=this.array_.length;e<n;e++)t.push(this.array_[e]);return t};var xC=function(){this._minIndex=-1,this._minCoord=null,this._minDe=null,this._orientedDe=null};xC.prototype.getCoordinate=function(){return this._minCoord},xC.prototype.getRightmostSide=function(t,e){var n=this.getRightmostSideOfSegment(t,e);return n<0&&(n=this.getRightmostSideOfSegment(t,e-1)),n<0&&(this._minCoord=null,this.checkForRightmostCoordinate(t)),n},xC.prototype.findRightmostEdgeAtVertex=function(){var t=this._minDe.getEdge().getCoordinates();TE.isTrue(this._minIndex>0&&this._minIndex<t.length,"rightmost point expected to be interior vertex of edge");var e=t[this._minIndex-1],n=t[this._minIndex+1],r=OE.computeOrientation(this._minCoord,n,e),i=!1;(e.y<this._minCoord.y&&n.y<this._minCoord.y&&r===OE.COUNTERCLOCKWISE||e.y>this._minCoord.y&&n.y>this._minCoord.y&&r===OE.CLOCKWISE)&&(i=!0),i&&(this._minIndex=this._minIndex-1)},xC.prototype.getRightmostSideOfSegment=function(t,e){var n=t.getEdge().getCoordinates();if(e<0||e+1>=n.length)return-1;if(n[e].y===n[e+1].y)return-1;var r=mC.LEFT;return n[e].y<n[e+1].y&&(r=mC.RIGHT),r},xC.prototype.getEdge=function(){return this._orientedDe},xC.prototype.checkForRightmostCoordinate=function(t){for(var e=this,n=t.getEdge().getCoordinates(),r=0;r<n.length-1;r++)(null===e._minCoord||n[r].x>e._minCoord.x)&&(e._minDe=t,e._minIndex=r,e._minCoord=n[r])},xC.prototype.findRightmostEdgeAtNode=function(){var t=this._minDe.getNode().getEdges();this._minDe=t.getRightmostEdge(),this._minDe.isForward()||(this._minDe=this._minDe.getSym(),this._minIndex=this._minDe.getEdge().getCoordinates().length-1)},xC.prototype.findEdge=function(t){for(var e=t.iterator();e.hasNext();){var n=e.next();n.isForward()&&this.checkForRightmostCoordinate(n)}TE.isTrue(0!==this._minIndex||this._minCoord.equals(this._minDe.getCoordinate()),"inconsistency in rightmost processing"),0===this._minIndex?this.findRightmostEdgeAtNode():this.findRightmostEdgeAtVertex(),this._orientedDe=this._minDe,this.getRightmostSide(this._minDe,this._minIndex)===mC.LEFT&&(this._orientedDe=this._minDe.getSym())},xC.prototype.interfaces_=function(){return[]},xC.prototype.getClass=function(){return xC};var CC=function(t){function e(n,r){t.call(this,e.msgWithCoord(n,r)),this.pt=r?new eE(r):null,this.name="TopologyException"}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getCoordinate=function(){return this.pt},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.msgWithCoord=function(t,e){return e?t:t+" [ "+e+" ]"},e}(LE),wC=function(){this.array_=[]};wC.prototype.addLast=function(t){this.array_.push(t)},wC.prototype.removeFirst=function(){return this.array_.shift()},wC.prototype.isEmpty=function(){return 0===this.array_.length};var bC=function(){this._finder=null,this._dirEdgeList=new nx,this._nodes=new nx,this._rightMostCoord=null,this._env=null,this._finder=new xC};bC.prototype.clearVisitedEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){t.next().setVisited(!1)}},bC.prototype.getRightmostCoordinate=function(){return this._rightMostCoord},bC.prototype.computeNodeDepth=function(t){for(var e=null,n=t.getEdges().iterator();n.hasNext();){var r=n.next();if(r.isVisited()||r.getSym().isVisited()){e=r;break}}if(null===e)throw new CC("unable to find edge to compute depths at "+t.getCoordinate());t.getEdges().computeDepths(e);for(var i=t.getEdges().iterator();i.hasNext();){var o=i.next();o.setVisited(!0),this.copySymDepths(o)}},bC.prototype.computeDepth=function(t){this.clearVisitedEdges();var e=this._finder.getEdge();e.setEdgeDepths(mC.RIGHT,t),this.copySymDepths(e),this.computeDepths(e)},bC.prototype.create=function(t){this.addReachable(t),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()},bC.prototype.findResultEdges=function(){for(var t=this._dirEdgeList.iterator();t.hasNext();){var e=t.next();e.getDepth(mC.RIGHT)>=1&&e.getDepth(mC.LEFT)<=0&&!e.isInteriorAreaEdge()&&e.setInResult(!0)}},bC.prototype.computeDepths=function(t){var e=new px,n=new wC,r=t.getNode();for(n.addLast(r),e.add(r),t.setVisited(!0);!n.isEmpty();){var i=n.removeFirst();e.add(i),this.computeNodeDepth(i);for(var o=i.getEdges().iterator();o.hasNext();){var s=o.next().getSym();if(!s.isVisited()){var a=s.getNode();e.contains(a)||(n.addLast(a),e.add(a))}}}},bC.prototype.compareTo=function(t){var e=t;return this._rightMostCoord.x<e._rightMostCoord.x?-1:this._rightMostCoord.x>e._rightMostCoord.x?1:0},bC.prototype.getEnvelope=function(){if(null===this._env){for(var t=new xE,e=this._dirEdgeList.iterator();e.hasNext();)for(var n=e.next().getEdge().getCoordinates(),r=0;r<n.length-1;r++)t.expandToInclude(n[r]);this._env=t}return this._env},bC.prototype.addReachable=function(t){var e=new EC;for(e.add(t);!e.empty();){var n=e.pop();this.add(n,e)}},bC.prototype.copySymDepths=function(t){var e=t.getSym();e.setDepth(mC.LEFT,t.getDepth(mC.RIGHT)),e.setDepth(mC.RIGHT,t.getDepth(mC.LEFT))},bC.prototype.add=function(t,e){t.setVisited(!0),this._nodes.add(t);for(var n=t.getEdges().iterator();n.hasNext();){var r=n.next();this._dirEdgeList.add(r);var i=r.getSym().getNode();i.isVisited()||e.push(i)}},bC.prototype.getNodes=function(){return this._nodes},bC.prototype.getDirectedEdges=function(){return this._dirEdgeList},bC.prototype.interfaces_=function(){return[KI]},bC.prototype.getClass=function(){return bC};var BC=function t(){if(this.location=null,1===arguments.length){if(arguments[0]instanceof Array){var e=arguments[0];this.init(e.length)}else if(Number.isInteger(arguments[0])){var n=arguments[0];this.init(1),this.location[mC.ON]=n}else if(arguments[0]instanceof t){var r=arguments[0];if(this.init(r.location.length),null!==r)for(var i=0;i<this.location.length;i++)this.location[i]=r.location[i]}}else if(3===arguments.length){var o=arguments[0],s=arguments[1],a=arguments[2];this.init(3),this.location[mC.ON]=o,this.location[mC.LEFT]=s,this.location[mC.RIGHT]=a}};BC.prototype.setAllLocations=function(t){for(var e=0;e<this.location.length;e++)this.location[e]=t},BC.prototype.isNull=function(){for(var t=0;t<this.location.length;t++)if(this.location[t]!==oE.NONE)return!1;return!0},BC.prototype.setAllLocationsIfNull=function(t){for(var e=0;e<this.location.length;e++)this.location[e]===oE.NONE&&(this.location[e]=t)},BC.prototype.isLine=function(){return 1===this.location.length},BC.prototype.merge=function(t){if(t.location.length>this.location.length){var e=new Array(3).fill(null);e[mC.ON]=this.location[mC.ON],e[mC.LEFT]=oE.NONE,e[mC.RIGHT]=oE.NONE,this.location=e}for(var n=0;n<this.location.length;n++)this.location[n]===oE.NONE&&n<t.location.length&&(this.location[n]=t.location[n])},BC.prototype.getLocations=function(){return this.location},BC.prototype.flip=function(){if(this.location.length<=1)return null;var t=this.location[mC.LEFT];this.location[mC.LEFT]=this.location[mC.RIGHT],this.location[mC.RIGHT]=t},BC.prototype.toString=function(){var t=new cE;return this.location.length>1&&t.append(oE.toLocationSymbol(this.location[mC.LEFT])),t.append(oE.toLocationSymbol(this.location[mC.ON])),this.location.length>1&&t.append(oE.toLocationSymbol(this.location[mC.RIGHT])),t.toString()},BC.prototype.setLocations=function(t,e,n){this.location[mC.ON]=t,this.location[mC.LEFT]=e,this.location[mC.RIGHT]=n},BC.prototype.get=function(t){return t<this.location.length?this.location[t]:oE.NONE},BC.prototype.isArea=function(){return this.location.length>1},BC.prototype.isAnyNull=function(){for(var t=0;t<this.location.length;t++)if(this.location[t]===oE.NONE)return!0;return!1},BC.prototype.setLocation=function(){if(1===arguments.length){var t=arguments[0];this.setLocation(mC.ON,t)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];this.location[e]=n}},BC.prototype.init=function(t){this.location=new Array(t).fill(null),this.setAllLocations(oE.NONE)},BC.prototype.isEqualOnSide=function(t,e){return this.location[e]===t.location[e]},BC.prototype.allPositionsEqual=function(t){for(var e=0;e<this.location.length;e++)if(this.location[e]!==t)return!1;return!0},BC.prototype.interfaces_=function(){return[]},BC.prototype.getClass=function(){return BC};var SC=function t(){if(this.elt=new Array(2).fill(null),1===arguments.length){if(Number.isInteger(arguments[0])){var e=arguments[0];this.elt[0]=new BC(e),this.elt[1]=new BC(e)}else if(arguments[0]instanceof t){var n=arguments[0];this.elt[0]=new BC(n.elt[0]),this.elt[1]=new BC(n.elt[1])}}else if(2===arguments.length){var r=arguments[0],i=arguments[1];this.elt[0]=new BC(oE.NONE),this.elt[1]=new BC(oE.NONE),this.elt[r].setLocation(i)}else if(3===arguments.length){var o=arguments[0],s=arguments[1],a=arguments[2];this.elt[0]=new BC(o,s,a),this.elt[1]=new BC(o,s,a)}else if(4===arguments.length){var u=arguments[0],l=arguments[1],c=arguments[2],h=arguments[3];this.elt[0]=new BC(oE.NONE,oE.NONE,oE.NONE),this.elt[1]=new BC(oE.NONE,oE.NONE,oE.NONE),this.elt[u].setLocations(l,c,h)}};SC.prototype.getGeometryCount=function(){var t=0;return this.elt[0].isNull()||t++,this.elt[1].isNull()||t++,t},SC.prototype.setAllLocations=function(t,e){this.elt[t].setAllLocations(e)},SC.prototype.isNull=function(t){return this.elt[t].isNull()},SC.prototype.setAllLocationsIfNull=function(){if(1===arguments.length){var t=arguments[0];this.setAllLocationsIfNull(0,t),this.setAllLocationsIfNull(1,t)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];this.elt[e].setAllLocationsIfNull(n)}},SC.prototype.isLine=function(t){return this.elt[t].isLine()},SC.prototype.merge=function(t){for(var e=this,n=0;n<2;n++)null===e.elt[n]&&null!==t.elt[n]?e.elt[n]=new BC(t.elt[n]):e.elt[n].merge(t.elt[n])},SC.prototype.flip=function(){this.elt[0].flip(),this.elt[1].flip()},SC.prototype.getLocation=function(){if(1===arguments.length){var t=arguments[0];return this.elt[t].get(mC.ON)}if(2===arguments.length){var e=arguments[0],n=arguments[1];return this.elt[e].get(n)}},SC.prototype.toString=function(){var t=new cE;return null!==this.elt[0]&&(t.append("A:"),t.append(this.elt[0].toString())),null!==this.elt[1]&&(t.append(" B:"),t.append(this.elt[1].toString())),t.toString()},SC.prototype.isArea=function(){if(0===arguments.length)return this.elt[0].isArea()||this.elt[1].isArea();if(1===arguments.length){var t=arguments[0];return this.elt[t].isArea()}},SC.prototype.isAnyNull=function(t){return this.elt[t].isAnyNull()},SC.prototype.setLocation=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];this.elt[t].setLocation(mC.ON,e)}else if(3===arguments.length){var n=arguments[0],r=arguments[1],i=arguments[2];this.elt[n].setLocation(r,i)}},SC.prototype.isEqualOnSide=function(t,e){return this.elt[0].isEqualOnSide(t.elt[0],e)&&this.elt[1].isEqualOnSide(t.elt[1],e)},SC.prototype.allPositionsEqual=function(t,e){return this.elt[t].allPositionsEqual(e)},SC.prototype.toLine=function(t){this.elt[t].isArea()&&(this.elt[t]=new BC(this.elt[t].location[0]))},SC.prototype.interfaces_=function(){return[]},SC.prototype.getClass=function(){return SC},SC.toLineLabel=function(t){for(var e=new SC(oE.NONE),n=0;n<2;n++)e.setLocation(n,t.getLocation(n));return e};var MC=function(){this._startDe=null,this._maxNodeDegree=-1,this._edges=new nx,this._pts=new nx,this._label=new SC(oE.NONE),this._ring=null,this._isHole=null,this._shell=null,this._holes=new nx,this._geometryFactory=null;var t=arguments[0],e=arguments[1];this._geometryFactory=e,this.computePoints(t),this.computeRing()};MC.prototype.computeRing=function(){if(null!==this._ring)return null;for(var t=new Array(this._pts.size()).fill(null),e=0;e<this._pts.size();e++)t[e]=this._pts.get(e);this._ring=this._geometryFactory.createLinearRing(t),this._isHole=OE.isCCW(this._ring.getCoordinates())},MC.prototype.isIsolated=function(){return 1===this._label.getGeometryCount()},MC.prototype.computePoints=function(t){var e=this;this._startDe=t;var n=t,r=!0;do{if(null===n)throw new CC("Found null DirectedEdge");if(n.getEdgeRing()===e)throw new CC("Directed Edge visited twice during ring-building at "+n.getCoordinate());e._edges.add(n);var i=n.getLabel();TE.isTrue(i.isArea()),e.mergeLabel(i),e.addPoints(n.getEdge(),n.isForward(),r),r=!1,e.setEdgeRing(n,e),n=e.getNext(n)}while(n!==this._startDe)},MC.prototype.getLinearRing=function(){return this._ring},MC.prototype.getCoordinate=function(t){return this._pts.get(t)},MC.prototype.computeMaxNodeDegree=function(){var t=this;this._maxNodeDegree=0;var e=this._startDe;do{var n=e.getNode().getEdges().getOutgoingDegree(t);n>t._maxNodeDegree&&(t._maxNodeDegree=n),e=t.getNext(e)}while(e!==this._startDe);this._maxNodeDegree*=2},MC.prototype.addPoints=function(t,e,n){var r=t.getCoordinates();if(e){var i=1;n&&(i=0);for(var o=i;o<r.length;o++)this._pts.add(r[o])}else{var s=r.length-2;n&&(s=r.length-1);for(var a=s;a>=0;a--)this._pts.add(r[a])}},MC.prototype.isHole=function(){return this._isHole},MC.prototype.setInResult=function(){var t=this._startDe;do{t.getEdge().setInResult(!0),t=t.getNext()}while(t!==this._startDe)},MC.prototype.containsPoint=function(t){var e=this.getLinearRing();if(!e.getEnvelopeInternal().contains(t))return!1;if(!OE.isPointInRing(t,e.getCoordinates()))return!1;for(var n=this._holes.iterator();n.hasNext();){if(n.next().containsPoint(t))return!1}return!0},MC.prototype.addHole=function(t){this._holes.add(t)},MC.prototype.isShell=function(){return null===this._shell},MC.prototype.getLabel=function(){return this._label},MC.prototype.getEdges=function(){return this._edges},MC.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree},MC.prototype.getShell=function(){return this._shell},MC.prototype.mergeLabel=function(){if(1===arguments.length){var t=arguments[0];this.mergeLabel(t,0),this.mergeLabel(t,1)}else if(2===arguments.length){var e=arguments[1],n=arguments[0].getLocation(e,mC.RIGHT);if(n===oE.NONE)return null;if(this._label.getLocation(e)===oE.NONE)return this._label.setLocation(e,n),null}},MC.prototype.setShell=function(t){this._shell=t,null!==t&&t.addHole(this)},MC.prototype.toPolygon=function(t){for(var e=new Array(this._holes.size()).fill(null),n=0;n<this._holes.size();n++)e[n]=this._holes.get(n).getLinearRing();return t.createPolygon(this.getLinearRing(),e)},MC.prototype.interfaces_=function(){return[]},MC.prototype.getClass=function(){return MC};var LC=function(t){function e(){var e=arguments[0],n=arguments[1];t.call(this,e,n)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.setEdgeRing=function(t,e){t.setMinEdgeRing(e)},e.prototype.getNext=function(t){return t.getNextMin()},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(MC),NC=function(t){function e(){var e=arguments[0],n=arguments[1];t.call(this,e,n)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.buildMinimalRings=function(){var t=new nx,e=this._startDe;do{if(null===e.getMinEdgeRing()){var n=new LC(e,this._geometryFactory);t.add(n)}e=e.getNext()}while(e!==this._startDe);return t},e.prototype.setEdgeRing=function(t,e){t.setEdgeRing(e)},e.prototype.linkDirectedEdgesForMinimalEdgeRings=function(){var t=this._startDe;do{t.getNode().getEdges().linkMinimalDirectedEdges(this),t=t.getNext()}while(t!==this._startDe)},e.prototype.getNext=function(t){return t.getNext()},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(MC),TC=function(){if(this._label=null,this._isInResult=!1,this._isCovered=!1,this._isCoveredSet=!1,this._isVisited=!1,0===arguments.length);else if(1===arguments.length){var t=arguments[0];this._label=t}};TC.prototype.setVisited=function(t){this._isVisited=t},TC.prototype.setInResult=function(t){this._isInResult=t},TC.prototype.isCovered=function(){return this._isCovered},TC.prototype.isCoveredSet=function(){return this._isCoveredSet},TC.prototype.setLabel=function(t){this._label=t},TC.prototype.getLabel=function(){return this._label},TC.prototype.setCovered=function(t){this._isCovered=t,this._isCoveredSet=!0},TC.prototype.updateIM=function(t){TE.isTrue(this._label.getGeometryCount()>=2,"found partial label"),this.computeIM(t)},TC.prototype.isInResult=function(){return this._isInResult},TC.prototype.isVisited=function(){return this._isVisited},TC.prototype.interfaces_=function(){return[]},TC.prototype.getClass=function(){return TC};var RC=function(t){function e(){t.call(this),this._coord=null,this._edges=null;var e=arguments[0],n=arguments[1];this._coord=e,this._edges=n,this._label=new SC(0,oE.NONE)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isIncidentEdgeInResult=function(){for(var t=this.getEdges().getEdges().iterator();t.hasNext();){if(t.next().getEdge().isInResult())return!0}return!1},e.prototype.isIsolated=function(){return 1===this._label.getGeometryCount()},e.prototype.getCoordinate=function(){return this._coord},e.prototype.print=function(t){t.println("node "+this._coord+" lbl: "+this._label)},e.prototype.computeIM=function(t){},e.prototype.computeMergedLocation=function(t,e){var n=oE.NONE;if(n=this._label.getLocation(e),!t.isNull(e)){var r=t.getLocation(e);n!==oE.BOUNDARY&&(n=r)}return n},e.prototype.setLabel=function(){if(2!==arguments.length)return t.prototype.setLabel.apply(this,arguments);var e=arguments[0],n=arguments[1];null===this._label?this._label=new SC(e,n):this._label.setLocation(e,n)},e.prototype.getEdges=function(){return this._edges},e.prototype.mergeLabel=function(){var t=this;if(arguments[0]instanceof e){var n=arguments[0];this.mergeLabel(n._label)}else if(arguments[0]instanceof SC)for(var r=arguments[0],i=0;i<2;i++){var o=t.computeMergedLocation(r,i);t._label.getLocation(i)===oE.NONE&&t._label.setLocation(i,o)}},e.prototype.add=function(t){this._edges.insert(t),t.setNode(this)},e.prototype.setLabelBoundary=function(t){if(null===this._label)return null;var e=oE.NONE;null!==this._label&&(e=this._label.getLocation(t));var n=null;if(e===oE.BOUNDARY)n=oE.INTERIOR;else n=oE.BOUNDARY;this._label.setLocation(t,n)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(TC),QC=function(){this.nodeMap=new _x,this.nodeFact=null;var t=arguments[0];this.nodeFact=t};QC.prototype.find=function(t){return this.nodeMap.get(t)},QC.prototype.addNode=function(){if(arguments[0]instanceof eE){var t=arguments[0],e=this.nodeMap.get(t);return null===e&&(e=this.nodeFact.createNode(t),this.nodeMap.put(t,e)),e}if(arguments[0]instanceof RC){var n=arguments[0],r=this.nodeMap.get(n.getCoordinate());return null===r?(this.nodeMap.put(n.getCoordinate(),n),n):(r.mergeLabel(n),r)}},QC.prototype.print=function(t){for(var e=this.iterator();e.hasNext();){e.next().print(t)}},QC.prototype.iterator=function(){return this.nodeMap.values().iterator()},QC.prototype.values=function(){return this.nodeMap.values()},QC.prototype.getBoundaryNodes=function(t){for(var e=new nx,n=this.iterator();n.hasNext();){var r=n.next();r.getLabel().getLocation(t)===oE.BOUNDARY&&e.add(r)}return e},QC.prototype.add=function(t){var e=t.getCoordinate();this.addNode(e).add(t)},QC.prototype.interfaces_=function(){return[]},QC.prototype.getClass=function(){return QC};var DC=function(){},PC={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}};DC.prototype.interfaces_=function(){return[]},DC.prototype.getClass=function(){return DC},DC.isNorthern=function(t){return t===DC.NE||t===DC.NW},DC.isOpposite=function(t,e){return t!==e&&2===(t-e+4)%4},DC.commonHalfPlane=function(t,e){if(t===e)return t;if(2===(t-e+4)%4)return-1;var n=t<e?t:e;return 0===n&&3===(t>e?t:e)?3:n},DC.isInHalfPlane=function(t,e){return e===DC.SE?t===DC.SE||t===DC.SW:t===e||t===e+1},DC.quadrant=function(){if("number"==typeof arguments[0]&&"number"==typeof arguments[1]){var t=arguments[0],e=arguments[1];if(0===t&&0===e)throw new XI("Cannot compute the quadrant for point ( "+t+", "+e+" )");return t>=0?e>=0?DC.NE:DC.SE:e>=0?DC.NW:DC.SW}if(arguments[0]instanceof eE&&arguments[1]instanceof eE){var n=arguments[0],r=arguments[1];if(r.x===n.x&&r.y===n.y)throw new XI("Cannot compute the quadrant for two identical points "+n);return r.x>=n.x?r.y>=n.y?DC.NE:DC.SE:r.y>=n.y?DC.NW:DC.SW}},PC.NE.get=function(){return 0},PC.NW.get=function(){return 1},PC.SW.get=function(){return 2},PC.SE.get=function(){return 3},Object.defineProperties(DC,PC);var kC=function(){if(this._edge=null,this._label=null,this._node=null,this._p0=null,this._p1=null,this._dx=null,this._dy=null,this._quadrant=null,1===arguments.length){var t=arguments[0];this._edge=t}else if(3===arguments.length){var e=arguments[0],n=arguments[1],r=arguments[2];this._edge=e,this.init(n,r),this._label=null}else if(4===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3];this._edge=i,this.init(o,s),this._label=a}};kC.prototype.compareDirection=function(t){return this._dx===t._dx&&this._dy===t._dy?0:this._quadrant>t._quadrant?1:this._quadrant<t._quadrant?-1:OE.computeOrientation(t._p0,t._p1,this._p1)},kC.prototype.getDy=function(){return this._dy},kC.prototype.getCoordinate=function(){return this._p0},kC.prototype.setNode=function(t){this._node=t},kC.prototype.print=function(t){var e=Math.atan2(this._dy,this._dx),n=this.getClass().getName(),r=n.lastIndexOf("."),i=n.substring(r+1);t.print(" "+i+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+e+" "+this._label)},kC.prototype.compareTo=function(t){var e=t;return this.compareDirection(e)},kC.prototype.getDirectedCoordinate=function(){return this._p1},kC.prototype.getDx=function(){return this._dx},kC.prototype.getLabel=function(){return this._label},kC.prototype.getEdge=function(){return this._edge},kC.prototype.getQuadrant=function(){return this._quadrant},kC.prototype.getNode=function(){return this._node},kC.prototype.toString=function(){var t=Math.atan2(this._dy,this._dx),e=this.getClass().getName(),n=e.lastIndexOf(".");return" "+e.substring(n+1)+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+t+" "+this._label},kC.prototype.computeLabel=function(t){},kC.prototype.init=function(t,e){this._p0=t,this._p1=e,this._dx=e.x-t.x,this._dy=e.y-t.y,this._quadrant=DC.quadrant(this._dx,this._dy),TE.isTrue(!(0===this._dx&&0===this._dy),"EdgeEnd with identical endpoints found")},kC.prototype.interfaces_=function(){return[KI]},kC.prototype.getClass=function(){return kC};var OC=function(t){function e(){var e=arguments[0],n=arguments[1];if(t.call(this,e),this._isForward=null,this._isInResult=!1,this._isVisited=!1,this._sym=null,this._next=null,this._nextMin=null,this._edgeRing=null,this._minEdgeRing=null,this._depth=[0,-999,-999],this._isForward=n,n)this.init(e.getCoordinate(0),e.getCoordinate(1));else{var r=e.getNumPoints()-1;this.init(e.getCoordinate(r),e.getCoordinate(r-1))}this.computeDirectedLabel()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getNextMin=function(){return this._nextMin},e.prototype.getDepth=function(t){return this._depth[t]},e.prototype.setVisited=function(t){this._isVisited=t},e.prototype.computeDirectedLabel=function(){this._label=new SC(this._edge.getLabel()),this._isForward||this._label.flip()},e.prototype.getNext=function(){return this._next},e.prototype.setDepth=function(t,e){if(-999!==this._depth[t]&&this._depth[t]!==e)throw new CC("assigned depths do not match",this.getCoordinate());this._depth[t]=e},e.prototype.isInteriorAreaEdge=function(){for(var t=this,e=!0,n=0;n<2;n++)t._label.isArea(n)&&t._label.getLocation(n,mC.LEFT)===oE.INTERIOR&&t._label.getLocation(n,mC.RIGHT)===oE.INTERIOR||(e=!1);return e},e.prototype.setNextMin=function(t){this._nextMin=t},e.prototype.print=function(e){t.prototype.print.call(this,e),e.print(" "+this._depth[mC.LEFT]+"/"+this._depth[mC.RIGHT]),e.print(" ("+this.getDepthDelta()+")"),this._isInResult&&e.print(" inResult")},e.prototype.setMinEdgeRing=function(t){this._minEdgeRing=t},e.prototype.isLineEdge=function(){var t=this._label.isLine(0)||this._label.isLine(1),e=!this._label.isArea(0)||this._label.allPositionsEqual(0,oE.EXTERIOR),n=!this._label.isArea(1)||this._label.allPositionsEqual(1,oE.EXTERIOR);return t&&e&&n},e.prototype.setEdgeRing=function(t){this._edgeRing=t},e.prototype.getMinEdgeRing=function(){return this._minEdgeRing},e.prototype.getDepthDelta=function(){var t=this._edge.getDepthDelta();return this._isForward||(t=-t),t},e.prototype.setInResult=function(t){this._isInResult=t},e.prototype.getSym=function(){return this._sym},e.prototype.isForward=function(){return this._isForward},e.prototype.getEdge=function(){return this._edge},e.prototype.printEdge=function(t){this.print(t),t.print(" "),this._isForward?this._edge.print(t):this._edge.printReverse(t)},e.prototype.setSym=function(t){this._sym=t},e.prototype.setVisitedEdge=function(t){this.setVisited(t),this._sym.setVisited(t)},e.prototype.setEdgeDepths=function(t,e){var n=this.getEdge().getDepthDelta();this._isForward||(n=-n);var r=1;t===mC.LEFT&&(r=-1);var i=mC.opposite(t),o=e+n*r;this.setDepth(t,e),this.setDepth(i,o)},e.prototype.getEdgeRing=function(){return this._edgeRing},e.prototype.isInResult=function(){return this._isInResult},e.prototype.setNext=function(t){this._next=t},e.prototype.isVisited=function(){return this._isVisited},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.depthFactor=function(t,e){return t===oE.EXTERIOR&&e===oE.INTERIOR?1:t===oE.INTERIOR&&e===oE.EXTERIOR?-1:0},e}(kC),FC=function(){};FC.prototype.createNode=function(t){return new RC(t,null)},FC.prototype.interfaces_=function(){return[]},FC.prototype.getClass=function(){return FC};var GC=function(){if(this._edges=new nx,this._nodes=null,this._edgeEndList=new nx,0===arguments.length)this._nodes=new QC(new FC);else if(1===arguments.length){var t=arguments[0];this._nodes=new QC(t)}};GC.prototype.printEdges=function(t){t.println("Edges:");for(var e=0;e<this._edges.size();e++){t.println("edge "+e+":");var n=this._edges.get(e);n.print(t),n.eiList.print(t)}},GC.prototype.find=function(t){return this._nodes.find(t)},GC.prototype.addNode=function(){if(arguments[0]instanceof RC){var t=arguments[0];return this._nodes.addNode(t)}if(arguments[0]instanceof eE){var e=arguments[0];return this._nodes.addNode(e)}},GC.prototype.getNodeIterator=function(){return this._nodes.iterator()},GC.prototype.linkResultDirectedEdges=function(){for(var t=this._nodes.iterator();t.hasNext();){t.next().getEdges().linkResultDirectedEdges()}},GC.prototype.debugPrintln=function(t){IE.out.println(t)},GC.prototype.isBoundaryNode=function(t,e){var n=this._nodes.find(e);if(null===n)return!1;var r=n.getLabel();return null!==r&&r.getLocation(t)===oE.BOUNDARY},GC.prototype.linkAllDirectedEdges=function(){for(var t=this._nodes.iterator();t.hasNext();){t.next().getEdges().linkAllDirectedEdges()}},GC.prototype.matchInSameDirection=function(t,e,n,r){return!!t.equals(n)&&(OE.computeOrientation(t,e,r)===OE.COLLINEAR&&DC.quadrant(t,e)===DC.quadrant(n,r))},GC.prototype.getEdgeEnds=function(){return this._edgeEndList},GC.prototype.debugPrint=function(t){IE.out.print(t)},GC.prototype.getEdgeIterator=function(){return this._edges.iterator()},GC.prototype.findEdgeInSameDirection=function(t,e){for(var n=this,r=0;r<this._edges.size();r++){var i=n._edges.get(r),o=i.getCoordinates();if(n.matchInSameDirection(t,e,o[0],o[1]))return i;if(n.matchInSameDirection(t,e,o[o.length-1],o[o.length-2]))return i}return null},GC.prototype.insertEdge=function(t){this._edges.add(t)},GC.prototype.findEdgeEnd=function(t){for(var e=this.getEdgeEnds().iterator();e.hasNext();){var n=e.next();if(n.getEdge()===t)return n}return null},GC.prototype.addEdges=function(t){for(var e=this,n=t.iterator();n.hasNext();){var r=n.next();e._edges.add(r);var i=new OC(r,!0),o=new OC(r,!1);i.setSym(o),o.setSym(i),e.add(i),e.add(o)}},GC.prototype.add=function(t){this._nodes.add(t),this._edgeEndList.add(t)},GC.prototype.getNodes=function(){return this._nodes.values()},GC.prototype.findEdge=function(t,e){for(var n=0;n<this._edges.size();n++){var r=this._edges.get(n),i=r.getCoordinates();if(t.equals(i[0])&&e.equals(i[1]))return r}return null},GC.prototype.interfaces_=function(){return[]},GC.prototype.getClass=function(){return GC},GC.linkResultDirectedEdges=function(t){for(var e=t.iterator();e.hasNext();){e.next().getEdges().linkResultDirectedEdges()}};var UC=function(){this._geometryFactory=null,this._shellList=new nx;var t=arguments[0];this._geometryFactory=t};UC.prototype.sortShellsAndHoles=function(t,e,n){for(var r=t.iterator();r.hasNext();){var i=r.next();i.isHole()?n.add(i):e.add(i)}},UC.prototype.computePolygons=function(t){for(var e=new nx,n=t.iterator();n.hasNext();){var r=n.next().toPolygon(this._geometryFactory);e.add(r)}return e},UC.prototype.placeFreeHoles=function(t,e){for(var n=e.iterator();n.hasNext();){var r=n.next();if(null===r.getShell()){var i=this.findEdgeRingContaining(r,t);if(null===i)throw new CC("unable to assign hole to a shell",r.getCoordinate(0));r.setShell(i)}}},UC.prototype.buildMinimalEdgeRings=function(t,e,n){for(var r=new nx,i=t.iterator();i.hasNext();){var o=i.next();if(o.getMaxNodeDegree()>2){o.linkDirectedEdgesForMinimalEdgeRings();var s=o.buildMinimalRings(),a=this.findShell(s);null!==a?(this.placePolygonHoles(a,s),e.add(a)):n.addAll(s)}else r.add(o)}return r},UC.prototype.containsPoint=function(t){for(var e=this._shellList.iterator();e.hasNext();){if(e.next().containsPoint(t))return!0}return!1},UC.prototype.buildMaximalEdgeRings=function(t){for(var e=new nx,n=t.iterator();n.hasNext();){var r=n.next();if(r.isInResult()&&r.getLabel().isArea()&&null===r.getEdgeRing()){var i=new NC(r,this._geometryFactory);e.add(i),i.setInResult()}}return e},UC.prototype.placePolygonHoles=function(t,e){for(var n=e.iterator();n.hasNext();){var r=n.next();r.isHole()&&r.setShell(t)}},UC.prototype.getPolygons=function(){return this.computePolygons(this._shellList)},UC.prototype.findEdgeRingContaining=function(t,e){for(var n=t.getLinearRing(),r=n.getEnvelopeInternal(),i=n.getCoordinateN(0),o=null,s=null,a=e.iterator();a.hasNext();){var u=a.next(),l=u.getLinearRing(),c=l.getEnvelopeInternal();null!==o&&(s=o.getLinearRing().getEnvelopeInternal());var h=!1;c.contains(r)&&OE.isPointInRing(i,l.getCoordinates())&&(h=!0),h&&(null===o||s.contains(c))&&(o=u)}return o},UC.prototype.findShell=function(t){for(var e=0,n=null,r=t.iterator();r.hasNext();){var i=r.next();i.isHole()||(n=i,e++)}return TE.isTrue(e<=1,"found two shells in MinimalEdgeRing list"),n},UC.prototype.add=function(){if(1===arguments.length){var t=arguments[0];this.add(t.getEdgeEnds(),t.getNodes())}else if(2===arguments.length){var e=arguments[0];GC.linkResultDirectedEdges(arguments[1]);var n=this.buildMaximalEdgeRings(e),r=new nx,i=this.buildMinimalEdgeRings(n,this._shellList,r);this.sortShellsAndHoles(i,this._shellList,r),this.placeFreeHoles(this._shellList,r)}},UC.prototype.interfaces_=function(){return[]},UC.prototype.getClass=function(){return UC};var qC=function(){};qC.prototype.getBounds=function(){},qC.prototype.interfaces_=function(){return[]},qC.prototype.getClass=function(){return qC};var jC=function(){this._bounds=null,this._item=null;var t=arguments[0],e=arguments[1];this._bounds=t,this._item=e};jC.prototype.getItem=function(){return this._item},jC.prototype.getBounds=function(){return this._bounds},jC.prototype.interfaces_=function(){return[qC,tE]},jC.prototype.getClass=function(){return jC};var zC=function(){this._size=null,this._items=null,this._size=0,this._items=new nx,this._items.add(null)};zC.prototype.poll=function(){if(this.isEmpty())return null;var t=this._items.get(1);return this._items.set(1,this._items.get(this._size)),this._size-=1,this.reorder(1),t},zC.prototype.size=function(){return this._size},zC.prototype.reorder=function(t){for(var e=this,n=null,r=this._items.get(t);2*t<=this._size&&((n=2*t)!==e._size&&e._items.get(n+1).compareTo(e._items.get(n))<0&&n++,e._items.get(n).compareTo(r)<0);t=n)e._items.set(t,e._items.get(n));this._items.set(t,r)},zC.prototype.clear=function(){this._size=0,this._items.clear()},zC.prototype.isEmpty=function(){return 0===this._size},zC.prototype.add=function(t){this._items.add(null),this._size+=1;var e=this._size;for(this._items.set(0,t);t.compareTo(this._items.get(Math.trunc(e/2)))<0;e/=2)this._items.set(e,this._items.get(Math.trunc(e/2)));this._items.set(e,t)},zC.prototype.interfaces_=function(){return[]},zC.prototype.getClass=function(){return zC};var VC=function(){};VC.prototype.visitItem=function(t){},VC.prototype.interfaces_=function(){return[]},VC.prototype.getClass=function(){return VC};var YC=function(){};YC.prototype.insert=function(t,e){},YC.prototype.remove=function(t,e){},YC.prototype.query=function(){},YC.prototype.interfaces_=function(){return[]},YC.prototype.getClass=function(){return YC};var HC=function(){if(this._childBoundables=new nx,this._bounds=null,this._level=null,0===arguments.length);else if(1===arguments.length){var t=arguments[0];this._level=t}},XC={serialVersionUID:{configurable:!0}};HC.prototype.getLevel=function(){return this._level},HC.prototype.size=function(){return this._childBoundables.size()},HC.prototype.getChildBoundables=function(){return this._childBoundables},HC.prototype.addChildBoundable=function(t){TE.isTrue(null===this._bounds),this._childBoundables.add(t)},HC.prototype.isEmpty=function(){return this._childBoundables.isEmpty()},HC.prototype.getBounds=function(){return null===this._bounds&&(this._bounds=this.computeBounds()),this._bounds},HC.prototype.interfaces_=function(){return[qC,tE]},HC.prototype.getClass=function(){return HC},XC.serialVersionUID.get=function(){return 0x5a1e55ec41369800},Object.defineProperties(HC,XC);var JC=function(){};JC.reverseOrder=function(){return{compare:function(t,e){return e.compareTo(t)}}},JC.min=function(t){return JC.sort(t),t.get(0)},JC.sort=function(t,e){var n=t.toArray();e?wx.sort(n,e):wx.sort(n);for(var r=t.iterator(),i=0,o=n.length;i<o;i++)r.next(),r.set(n[i])},JC.singletonList=function(t){var e=new nx;return e.add(t),e};var WC=function(){this._boundable1=null,this._boundable2=null,this._distance=null,this._itemDistance=null;var t=arguments[0],e=arguments[1],n=arguments[2];this._boundable1=t,this._boundable2=e,this._itemDistance=n,this._distance=this.distance()};WC.prototype.expandToQueue=function(t,e){var n=WC.isComposite(this._boundable1),r=WC.isComposite(this._boundable2);if(n&&r)return WC.area(this._boundable1)>WC.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,t,e),null):(this.expand(this._boundable2,this._boundable1,t,e),null);if(n)return this.expand(this._boundable1,this._boundable2,t,e),null;if(r)return this.expand(this._boundable2,this._boundable1,t,e),null;throw new XI("neither boundable is composite")},WC.prototype.isLeaves=function(){return!(WC.isComposite(this._boundable1)||WC.isComposite(this._boundable2))},WC.prototype.compareTo=function(t){var e=t;return this._distance<e._distance?-1:this._distance>e._distance?1:0},WC.prototype.expand=function(t,e,n,r){for(var i=t.getChildBoundables().iterator();i.hasNext();){var o=i.next(),s=new WC(o,e,this._itemDistance);s.getDistance()<r&&n.add(s)}},WC.prototype.getBoundable=function(t){return 0===t?this._boundable1:this._boundable2},WC.prototype.getDistance=function(){return this._distance},WC.prototype.distance=function(){return this.isLeaves()?this._itemDistance.distance(this._boundable1,this._boundable2):this._boundable1.getBounds().distance(this._boundable2.getBounds())},WC.prototype.interfaces_=function(){return[KI]},WC.prototype.getClass=function(){return WC},WC.area=function(t){return t.getBounds().getArea()},WC.isComposite=function(t){return t instanceof HC};var KC=function t(){if(this._root=null,this._built=!1,this._itemBoundables=new nx,this._nodeCapacity=null,0===arguments.length){var e=t.DEFAULT_NODE_CAPACITY;this._nodeCapacity=e}else if(1===arguments.length){var n=arguments[0];TE.isTrue(n>1,"Node capacity must be greater than 1"),this._nodeCapacity=n}},ZC={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};KC.prototype.getNodeCapacity=function(){return this._nodeCapacity},KC.prototype.lastNode=function(t){return t.get(t.size()-1)},KC.prototype.size=function(){if(0===arguments.length)return this.isEmpty()?0:(this.build(),this.size(this._root));if(1===arguments.length){for(var t=0,e=arguments[0].getChildBoundables().iterator();e.hasNext();){var n=e.next();n instanceof HC?t+=this.size(n):n instanceof jC&&(t+=1)}return t}},KC.prototype.removeItem=function(t,e){for(var n=null,r=t.getChildBoundables().iterator();r.hasNext();){var i=r.next();i instanceof jC&&i.getItem()===e&&(n=i)}return null!==n&&(t.getChildBoundables().remove(n),!0)},KC.prototype.itemsTree=function(){if(0===arguments.length){this.build();var t=this.itemsTree(this._root);return null===t?new nx:t}if(1===arguments.length){for(var e=arguments[0],n=new nx,r=e.getChildBoundables().iterator();r.hasNext();){var i=r.next();if(i instanceof HC){var o=this.itemsTree(i);null!==o&&n.add(o)}else i instanceof jC?n.add(i.getItem()):TE.shouldNeverReachHere()}return n.size()<=0?null:n}},KC.prototype.insert=function(t,e){TE.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new jC(t,e))},KC.prototype.boundablesAtLevel=function(){if(1===arguments.length){var t=arguments[0],e=new nx;return this.boundablesAtLevel(t,this._root,e),e}if(3===arguments.length){var n=arguments[0],r=arguments[1],i=arguments[2];if(TE.isTrue(n>-2),r.getLevel()===n)return i.add(r),null;for(var o=r.getChildBoundables().iterator();o.hasNext();){var s=o.next();s instanceof HC?this.boundablesAtLevel(n,s,i):(TE.isTrue(s instanceof jC),-1===n&&i.add(s))}return null}},KC.prototype.query=function(){var t=this;if(1===arguments.length){var e=arguments[0];this.build();var n=new nx;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),e)&&this.query(e,this._root,n),n}if(2===arguments.length){var r=arguments[0],i=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),r)&&this.query(r,this._root,i)}else if(3===arguments.length)if(aE(arguments[2],VC)&&arguments[0]instanceof Object&&arguments[1]instanceof HC)for(var o=arguments[0],s=arguments[2],a=arguments[1].getChildBoundables(),u=0;u<a.size();u++){var l=a.get(u);t.getIntersectsOp().intersects(l.getBounds(),o)&&(l instanceof HC?t.query(o,l,s):l instanceof jC?s.visitItem(l.getItem()):TE.shouldNeverReachHere())}else if(aE(arguments[2],tx)&&arguments[0]instanceof Object&&arguments[1]instanceof HC)for(var c=arguments[0],h=arguments[2],f=arguments[1].getChildBoundables(),p=0;p<f.size();p++){var g=f.get(p);t.getIntersectsOp().intersects(g.getBounds(),c)&&(g instanceof HC?t.query(c,g,h):g instanceof jC?h.add(g.getItem()):TE.shouldNeverReachHere())}},KC.prototype.build=function(){if(this._built)return null;this._root=this._itemBoundables.isEmpty()?this.createNode(0):this.createHigherLevels(this._itemBoundables,-1),this._itemBoundables=null,this._built=!0},KC.prototype.getRoot=function(){return this.build(),this._root},KC.prototype.remove=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];return this.build(),!!this.getIntersectsOp().intersects(this._root.getBounds(),t)&&this.remove(t,this._root,e)}if(3===arguments.length){var n=arguments[0],r=arguments[1],i=arguments[2],o=this.removeItem(r,i);if(o)return!0;for(var s=null,a=r.getChildBoundables().iterator();a.hasNext();){var u=a.next();if(this.getIntersectsOp().intersects(u.getBounds(),n)&&(u instanceof HC&&(o=this.remove(n,u,i)))){s=u;break}}return null!==s&&s.getChildBoundables().isEmpty()&&r.getChildBoundables().remove(s),o}},KC.prototype.createHigherLevels=function(t,e){TE.isTrue(!t.isEmpty());var n=this.createParentBoundables(t,e+1);return 1===n.size()?n.get(0):this.createHigherLevels(n,e+1)},KC.prototype.depth=function(){if(0===arguments.length)return this.isEmpty()?0:(this.build(),this.depth(this._root));if(1===arguments.length){for(var t=0,e=arguments[0].getChildBoundables().iterator();e.hasNext();){var n=e.next();if(n instanceof HC){var r=this.depth(n);r>t&&(t=r)}}return t+1}},KC.prototype.createParentBoundables=function(t,e){var n=this;TE.isTrue(!t.isEmpty());var r=new nx;r.add(this.createNode(e));var i=new nx(t);JC.sort(i,this.getComparator());for(var o=i.iterator();o.hasNext();){var s=o.next();n.lastNode(r).getChildBoundables().size()===n.getNodeCapacity()&&r.add(n.createNode(e)),n.lastNode(r).addChildBoundable(s)}return r},KC.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()},KC.prototype.interfaces_=function(){return[tE]},KC.prototype.getClass=function(){return KC},KC.compareDoubles=function(t,e){return t>e?1:t<e?-1:0},ZC.IntersectsOp.get=function(){return $C},ZC.serialVersionUID.get=function(){return-0x35ef64c82d4c5400},ZC.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(KC,ZC);var $C=function(){},tw=function(){};tw.prototype.distance=function(t,e){},tw.prototype.interfaces_=function(){return[]},tw.prototype.getClass=function(){return tw};var ew=function(t){function e(n){n=n||e.DEFAULT_NODE_CAPACITY,t.call(this,n)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={STRtreeNode:{configurable:!0},serialVersionUID:{configurable:!0},xComparator:{configurable:!0},yComparator:{configurable:!0},intersectsOp:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};return e.prototype.createParentBoundablesFromVerticalSlices=function(t,e){TE.isTrue(t.length>0);for(var n=new nx,r=0;r<t.length;r++)n.addAll(this.createParentBoundablesFromVerticalSlice(t[r],e));return n},e.prototype.createNode=function(t){return new nw(t)},e.prototype.size=function(){return 0===arguments.length?t.prototype.size.call(this):t.prototype.size.apply(this,arguments)},e.prototype.insert=function(){if(2!==arguments.length)return t.prototype.insert.apply(this,arguments);var e=arguments[0],n=arguments[1];if(e.isNull())return null;t.prototype.insert.call(this,e,n)},e.prototype.getIntersectsOp=function(){return e.intersectsOp},e.prototype.verticalSlices=function(t,e){for(var n=Math.trunc(Math.ceil(t.size()/e)),r=new Array(e).fill(null),i=t.iterator(),o=0;o<e;o++){r[o]=new nx;for(var s=0;i.hasNext()&&s<n;){var a=i.next();r[o].add(a),s++}}return r},e.prototype.query=function(){if(1===arguments.length){var e=arguments[0];return t.prototype.query.call(this,e)}if(2===arguments.length){var n=arguments[0],r=arguments[1];t.prototype.query.call(this,n,r)}else if(3===arguments.length)if(aE(arguments[2],VC)&&arguments[0]instanceof Object&&arguments[1]instanceof HC){var i=arguments[0],o=arguments[1],s=arguments[2];t.prototype.query.call(this,i,o,s)}else if(aE(arguments[2],tx)&&arguments[0]instanceof Object&&arguments[1]instanceof HC){var a=arguments[0],u=arguments[1],l=arguments[2];t.prototype.query.call(this,a,u,l)}},e.prototype.getComparator=function(){return e.yComparator},e.prototype.createParentBoundablesFromVerticalSlice=function(e,n){return t.prototype.createParentBoundables.call(this,e,n)},e.prototype.remove=function(){if(2===arguments.length){var e=arguments[0],n=arguments[1];return t.prototype.remove.call(this,e,n)}return t.prototype.remove.apply(this,arguments)},e.prototype.depth=function(){return 0===arguments.length?t.prototype.depth.call(this):t.prototype.depth.apply(this,arguments)},e.prototype.createParentBoundables=function(t,n){TE.isTrue(!t.isEmpty());var r=Math.trunc(Math.ceil(t.size()/this.getNodeCapacity())),i=new nx(t);JC.sort(i,e.xComparator);var o=this.verticalSlices(i,Math.trunc(Math.ceil(Math.sqrt(r))));return this.createParentBoundablesFromVerticalSlices(o,n)},e.prototype.nearestNeighbour=function(){if(1===arguments.length){if(aE(arguments[0],tw)){var t=arguments[0],n=new WC(this.getRoot(),this.getRoot(),t);return this.nearestNeighbour(n)}if(arguments[0]instanceof WC){var r=arguments[0];return this.nearestNeighbour(r,JI.POSITIVE_INFINITY)}}else if(2===arguments.length){if(arguments[0]instanceof e&&aE(arguments[1],tw)){var i=arguments[0],o=arguments[1],s=new WC(this.getRoot(),i.getRoot(),o);return this.nearestNeighbour(s)}if(arguments[0]instanceof WC&&"number"==typeof arguments[1]){var a=arguments[0],u=arguments[1],l=null,c=new zC;for(c.add(a);!c.isEmpty()&&u>0;){var h=c.poll(),f=h.getDistance();if(f>=u)break;h.isLeaves()?(u=f,l=h):h.expandToQueue(c,u)}return[l.getBoundable(0).getItem(),l.getBoundable(1).getItem()]}}else if(3===arguments.length){var p=arguments[2],g=new jC(arguments[0],arguments[1]),A=new WC(this.getRoot(),g,p);return this.nearestNeighbour(A)[0]}},e.prototype.interfaces_=function(){return[YC,tE]},e.prototype.getClass=function(){return e},e.centreX=function(t){return e.avg(t.getMinX(),t.getMaxX())},e.avg=function(t,e){return(t+e)/2},e.centreY=function(t){return e.avg(t.getMinY(),t.getMaxY())},n.STRtreeNode.get=function(){return nw},n.serialVersionUID.get=function(){return 0x39920f7d5f261e0},n.xComparator.get=function(){return{interfaces_:function(){return[$I]},compare:function(n,r){return t.compareDoubles(e.centreX(n.getBounds()),e.centreX(r.getBounds()))}}},n.yComparator.get=function(){return{interfaces_:function(){return[$I]},compare:function(n,r){return t.compareDoubles(e.centreY(n.getBounds()),e.centreY(r.getBounds()))}}},n.intersectsOp.get=function(){return{interfaces_:function(){return[t.IntersectsOp]},intersects:function(t,e){return t.intersects(e)}}},n.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(e,n),e}(KC),nw=function(t){function e(){var e=arguments[0];t.call(this,e)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.computeBounds=function(){for(var t=null,e=this.getChildBoundables().iterator();e.hasNext();){var n=e.next();null===t?t=new xE(n.getBounds()):t.expandToInclude(n.getBounds())}return t},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(HC),rw=function(){};rw.prototype.interfaces_=function(){return[]},rw.prototype.getClass=function(){return rw},rw.relativeSign=function(t,e){return t<e?-1:t>e?1:0},rw.compare=function(t,e,n){if(e.equals2D(n))return 0;var r=rw.relativeSign(e.x,n.x),i=rw.relativeSign(e.y,n.y);switch(t){case 0:return rw.compareValue(r,i);case 1:return rw.compareValue(i,r);case 2:return rw.compareValue(i,-r);case 3:return rw.compareValue(-r,i);case 4:return rw.compareValue(-r,-i);case 5:return rw.compareValue(-i,-r);case 6:return rw.compareValue(-i,r);case 7:return rw.compareValue(r,-i)}return TE.shouldNeverReachHere("invalid octant value"),0},rw.compareValue=function(t,e){return t<0?-1:t>0?1:e<0?-1:e>0?1:0};var iw=function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var t=arguments[0],e=arguments[1],n=arguments[2],r=arguments[3];this._segString=t,this.coord=new eE(e),this.segmentIndex=n,this._segmentOctant=r,this._isInterior=!e.equals2D(t.getCoordinate(n))};iw.prototype.getCoordinate=function(){return this.coord},iw.prototype.print=function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex)},iw.prototype.compareTo=function(t){var e=t;return this.segmentIndex<e.segmentIndex?-1:this.segmentIndex>e.segmentIndex?1:this.coord.equals2D(e.coord)?0:rw.compare(this._segmentOctant,this.coord,e.coord)},iw.prototype.isEndPoint=function(t){return 0===this.segmentIndex&&!this._isInterior||this.segmentIndex===t},iw.prototype.isInterior=function(){return this._isInterior},iw.prototype.interfaces_=function(){return[KI]},iw.prototype.getClass=function(){return iw};var ow=function(){this._nodeMap=new _x,this._edge=null;var t=arguments[0];this._edge=t};ow.prototype.getSplitCoordinates=function(){var t=new ix;this.addEndpoints();for(var e=this.iterator(),n=e.next();e.hasNext();){var r=e.next();this.addEdgeCoordinates(n,r,t),n=r}return t.toCoordinateArray()},ow.prototype.addCollapsedNodes=function(){var t=new nx;this.findCollapsesFromInsertedNodes(t),this.findCollapsesFromExistingVertices(t);for(var e=t.iterator();e.hasNext();){var n=e.next().intValue();this.add(this._edge.getCoordinate(n),n)}},ow.prototype.print=function(t){t.println("Intersections:");for(var e=this.iterator();e.hasNext();){e.next().print(t)}},ow.prototype.findCollapsesFromExistingVertices=function(t){for(var e=0;e<this._edge.size()-2;e++){var n=this._edge.getCoordinate(e),r=this._edge.getCoordinate(e+2);n.equals2D(r)&&t.add(new hE(e+1))}},ow.prototype.addEdgeCoordinates=function(t,e,n){var r=this._edge.getCoordinate(e.segmentIndex),i=e.isInterior()||!e.coord.equals2D(r);n.add(new eE(t.coord),!1);for(var o=t.segmentIndex+1;o<=e.segmentIndex;o++)n.add(this._edge.getCoordinate(o));i&&n.add(new eE(e.coord))},ow.prototype.iterator=function(){return this._nodeMap.values().iterator()},ow.prototype.addSplitEdges=function(t){this.addEndpoints(),this.addCollapsedNodes();for(var e=this.iterator(),n=e.next();e.hasNext();){var r=e.next(),i=this.createSplitEdge(n,r);t.add(i),n=r}},ow.prototype.findCollapseIndex=function(t,e,n){if(!t.coord.equals2D(e.coord))return!1;var r=e.segmentIndex-t.segmentIndex;return e.isInterior()||r--,1===r&&(n[0]=t.segmentIndex+1,!0)},ow.prototype.findCollapsesFromInsertedNodes=function(t){for(var e=new Array(1).fill(null),n=this.iterator(),r=n.next();n.hasNext();){var i=n.next();this.findCollapseIndex(r,i,e)&&t.add(new hE(e[0])),r=i}},ow.prototype.getEdge=function(){return this._edge},ow.prototype.addEndpoints=function(){var t=this._edge.size()-1;this.add(this._edge.getCoordinate(0),0),this.add(this._edge.getCoordinate(t),t)},ow.prototype.createSplitEdge=function(t,e){var n=e.segmentIndex-t.segmentIndex+2,r=this._edge.getCoordinate(e.segmentIndex),i=e.isInterior()||!e.coord.equals2D(r);i||n--;var o=new Array(n).fill(null),s=0;o[s++]=new eE(t.coord);for(var a=t.segmentIndex+1;a<=e.segmentIndex;a++)o[s++]=this._edge.getCoordinate(a);return i&&(o[s]=new eE(e.coord)),new lw(o,this._edge.getData())},ow.prototype.add=function(t,e){var n=new iw(this._edge,t,e,this._edge.getSegmentOctant(e)),r=this._nodeMap.get(n);return null!==r?(TE.isTrue(r.coord.equals2D(t),"Found equal nodes with different coordinates"),r):(this._nodeMap.put(n,n),n)},ow.prototype.checkSplitEdgesCorrectness=function(t){var e=this._edge.getCoordinates(),n=t.get(0).getCoordinate(0);if(!n.equals2D(e[0]))throw new LE("bad split edge start point at "+n);var r=t.get(t.size()-1).getCoordinates(),i=r[r.length-1];if(!i.equals2D(e[e.length-1]))throw new LE("bad split edge end point at "+i)},ow.prototype.interfaces_=function(){return[]},ow.prototype.getClass=function(){return ow};var sw=function(){};sw.prototype.interfaces_=function(){return[]},sw.prototype.getClass=function(){return sw},sw.octant=function(){if("number"==typeof arguments[0]&&"number"==typeof arguments[1]){var t=arguments[0],e=arguments[1];if(0===t&&0===e)throw new XI("Cannot compute the octant for point ( "+t+", "+e+" )");var n=Math.abs(t),r=Math.abs(e);return t>=0?e>=0?n>=r?0:1:n>=r?7:6:e>=0?n>=r?3:2:n>=r?4:5}if(arguments[0]instanceof eE&&arguments[1]instanceof eE){var i=arguments[0],o=arguments[1],s=o.x-i.x,a=o.y-i.y;if(0===s&&0===a)throw new XI("Cannot compute the octant for two identical points "+i);return sw.octant(s,a)}};var aw=function(){};aw.prototype.getCoordinates=function(){},aw.prototype.size=function(){},aw.prototype.getCoordinate=function(t){},aw.prototype.isClosed=function(){},aw.prototype.setData=function(t){},aw.prototype.getData=function(){},aw.prototype.interfaces_=function(){return[]},aw.prototype.getClass=function(){return aw};var uw=function(){};uw.prototype.addIntersection=function(t,e){},uw.prototype.interfaces_=function(){return[aw]},uw.prototype.getClass=function(){return uw};var lw=function(){this._nodeList=new ow(this),this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};lw.prototype.getCoordinates=function(){return this._pts},lw.prototype.size=function(){return this._pts.length},lw.prototype.getCoordinate=function(t){return this._pts[t]},lw.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},lw.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(t),this.getCoordinate(t+1))},lw.prototype.setData=function(t){this._data=t},lw.prototype.safeOctant=function(t,e){return t.equals2D(e)?0:sw.octant(t,e)},lw.prototype.getData=function(){return this._data},lw.prototype.addIntersection=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];this.addIntersectionNode(t,e)}else if(4===arguments.length){var n=arguments[1],r=arguments[3],i=new eE(arguments[0].getIntersection(r));this.addIntersection(i,n)}},lw.prototype.toString=function(){return ME.toLineString(new nC(this._pts))},lw.prototype.getNodeList=function(){return this._nodeList},lw.prototype.addIntersectionNode=function(t,e){var n=e,r=n+1;if(r<this._pts.length){var i=this._pts[r];t.equals2D(i)&&(n=r)}return this._nodeList.add(t,n)},lw.prototype.addIntersections=function(t,e,n){for(var r=0;r<t.getIntersectionNum();r++)this.addIntersection(t,e,n,r)},lw.prototype.interfaces_=function(){return[uw]},lw.prototype.getClass=function(){return lw},lw.getNodedSubstrings=function(){if(1===arguments.length){var t=arguments[0],e=new nx;return lw.getNodedSubstrings(t,e),e}if(2===arguments.length)for(var n=arguments[1],r=arguments[0].iterator();r.hasNext();){r.next().getNodeList().addSplitEdges(n)}};var cw=function(){if(this.p0=null,this.p1=null,0===arguments.length)this.p0=new eE,this.p1=new eE;else if(1===arguments.length){var t=arguments[0];this.p0=new eE(t.p0),this.p1=new eE(t.p1)}else if(2===arguments.length)this.p0=arguments[0],this.p1=arguments[1];else if(4===arguments.length){var e=arguments[0],n=arguments[1],r=arguments[2],i=arguments[3];this.p0=new eE(e,n),this.p1=new eE(r,i)}},hw={serialVersionUID:{configurable:!0}};cw.prototype.minX=function(){return Math.min(this.p0.x,this.p1.x)},cw.prototype.orientationIndex=function(){if(arguments[0]instanceof cw){var t=arguments[0],e=OE.orientationIndex(this.p0,this.p1,t.p0),n=OE.orientationIndex(this.p0,this.p1,t.p1);return e>=0&&n>=0||e<=0&&n<=0?Math.max(e,n):0}if(arguments[0]instanceof eE){var r=arguments[0];return OE.orientationIndex(this.p0,this.p1,r)}},cw.prototype.toGeometry=function(t){return t.createLineString([this.p0,this.p1])},cw.prototype.isVertical=function(){return this.p0.x===this.p1.x},cw.prototype.equals=function(t){if(!(t instanceof cw))return!1;var e=t;return this.p0.equals(e.p0)&&this.p1.equals(e.p1)},cw.prototype.intersection=function(t){var e=new DE;return e.computeIntersection(this.p0,this.p1,t.p0,t.p1),e.hasIntersection()?e.getIntersection(0):null},cw.prototype.project=function(){if(arguments[0]instanceof eE){var t=arguments[0];if(t.equals(this.p0)||t.equals(this.p1))return new eE(t);var e=this.projectionFactor(t),n=new eE;return n.x=this.p0.x+e*(this.p1.x-this.p0.x),n.y=this.p0.y+e*(this.p1.y-this.p0.y),n}if(arguments[0]instanceof cw){var r=arguments[0],i=this.projectionFactor(r.p0),o=this.projectionFactor(r.p1);if(i>=1&&o>=1)return null;if(i<=0&&o<=0)return null;var s=this.project(r.p0);i<0&&(s=this.p0),i>1&&(s=this.p1);var a=this.project(r.p1);return o<0&&(a=this.p0),o>1&&(a=this.p1),new cw(s,a)}},cw.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()},cw.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)},cw.prototype.getCoordinate=function(t){return 0===t?this.p0:this.p1},cw.prototype.distancePerpendicular=function(t){return OE.distancePointLinePerpendicular(t,this.p0,this.p1)},cw.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)},cw.prototype.midPoint=function(){return cw.midPoint(this.p0,this.p1)},cw.prototype.projectionFactor=function(t){if(t.equals(this.p0))return 0;if(t.equals(this.p1))return 1;var e=this.p1.x-this.p0.x,n=this.p1.y-this.p0.y,r=e*e+n*n;return r<=0?JI.NaN:((t.x-this.p0.x)*e+(t.y-this.p0.y)*n)/r},cw.prototype.closestPoints=function(t){var e=this.intersection(t);if(null!==e)return[e,e];var n=new Array(2).fill(null),r=JI.MAX_VALUE,i=null,o=this.closestPoint(t.p0);r=o.distance(t.p0),n[0]=o,n[1]=t.p0;var s=this.closestPoint(t.p1);(i=s.distance(t.p1))<r&&(r=i,n[0]=s,n[1]=t.p1);var a=t.closestPoint(this.p0);(i=a.distance(this.p0))<r&&(r=i,n[0]=this.p0,n[1]=a);var u=t.closestPoint(this.p1);return(i=u.distance(this.p1))<r&&(r=i,n[0]=this.p1,n[1]=u),n},cw.prototype.closestPoint=function(t){var e=this.projectionFactor(t);return e>0&&e<1?this.project(t):this.p0.distance(t)<this.p1.distance(t)?this.p0:this.p1},cw.prototype.maxX=function(){return Math.max(this.p0.x,this.p1.x)},cw.prototype.getLength=function(){return this.p0.distance(this.p1)},cw.prototype.compareTo=function(t){var e=t,n=this.p0.compareTo(e.p0);return 0!==n?n:this.p1.compareTo(e.p1)},cw.prototype.reverse=function(){var t=this.p0;this.p0=this.p1,this.p1=t},cw.prototype.equalsTopo=function(t){return this.p0.equals(t.p0)&&(this.p1.equals(t.p1)||this.p0.equals(t.p1))&&this.p1.equals(t.p0)},cw.prototype.lineIntersection=function(t){try{return EE.intersection(this.p0,this.p1,t.p0,t.p1)}catch(t){if(!(t instanceof _E))throw t}return null},cw.prototype.maxY=function(){return Math.max(this.p0.y,this.p1.y)},cw.prototype.pointAlongOffset=function(t,e){var n=this.p0.x+t*(this.p1.x-this.p0.x),r=this.p0.y+t*(this.p1.y-this.p0.y),i=this.p1.x-this.p0.x,o=this.p1.y-this.p0.y,s=Math.sqrt(i*i+o*o),a=0,u=0;if(0!==e){if(s<=0)throw new Error("Cannot compute offset from zero-length line segment");a=e*i/s,u=e*o/s}return new eE(n-u,r+a)},cw.prototype.setCoordinates=function(){if(1===arguments.length){var t=arguments[0];this.setCoordinates(t.p0,t.p1)}else if(2===arguments.length){var e=arguments[0],n=arguments[1];this.p0.x=e.x,this.p0.y=e.y,this.p1.x=n.x,this.p1.y=n.y}},cw.prototype.segmentFraction=function(t){var e=this.projectionFactor(t);return e<0?e=0:(e>1||JI.isNaN(e))&&(e=1),e},cw.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"},cw.prototype.isHorizontal=function(){return this.p0.y===this.p1.y},cw.prototype.distance=function(){if(arguments[0]instanceof cw){var t=arguments[0];return OE.distanceLineLine(this.p0,this.p1,t.p0,t.p1)}if(arguments[0]instanceof eE){var e=arguments[0];return OE.distancePointLine(e,this.p0,this.p1)}},cw.prototype.pointAlong=function(t){var e=new eE;return e.x=this.p0.x+t*(this.p1.x-this.p0.x),e.y=this.p0.y+t*(this.p1.y-this.p0.y),e},cw.prototype.hashCode=function(){var t=JI.doubleToLongBits(this.p0.x);t^=31*JI.doubleToLongBits(this.p0.y);var e=Math.trunc(t)^Math.trunc(t>>32),n=JI.doubleToLongBits(this.p1.x);return n^=31*JI.doubleToLongBits(this.p1.y),e^(Math.trunc(n)^Math.trunc(n>>32))},cw.prototype.interfaces_=function(){return[KI,tE]},cw.prototype.getClass=function(){return cw},cw.midPoint=function(t,e){return new eE((t.x+e.x)/2,(t.y+e.y)/2)},hw.serialVersionUID.get=function(){return 0x2d2172135f411c00},Object.defineProperties(cw,hw);var fw=function(){this.tempEnv1=new xE,this.tempEnv2=new xE,this._overlapSeg1=new cw,this._overlapSeg2=new cw};fw.prototype.overlap=function(){if(2===arguments.length);else if(4===arguments.length){var t=arguments[1],e=arguments[2],n=arguments[3];arguments[0].getLineSegment(t,this._overlapSeg1),e.getLineSegment(n,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}},fw.prototype.interfaces_=function(){return[]},fw.prototype.getClass=function(){return fw};var pw=function(){this._pts=null,this._start=null,this._end=null,this._env=null,this._context=null,this._id=null;var t=arguments[0],e=arguments[1],n=arguments[2],r=arguments[3];this._pts=t,this._start=e,this._end=n,this._context=r};pw.prototype.getLineSegment=function(t,e){e.p0=this._pts[t],e.p1=this._pts[t+1]},pw.prototype.computeSelect=function(t,e,n,r){var i=this._pts[e],o=this._pts[n];if(r.tempEnv1.init(i,o),n-e==1)return r.select(this,e),null;if(!t.intersects(r.tempEnv1))return null;var s=Math.trunc((e+n)/2);e<s&&this.computeSelect(t,e,s,r),s<n&&this.computeSelect(t,s,n,r)},pw.prototype.getCoordinates=function(){for(var t=new Array(this._end-this._start+1).fill(null),e=0,n=this._start;n<=this._end;n++)t[e++]=this._pts[n];return t},pw.prototype.computeOverlaps=function(t,e){this.computeOverlapsInternal(this._start,this._end,t,t._start,t._end,e)},pw.prototype.setId=function(t){this._id=t},pw.prototype.select=function(t,e){this.computeSelect(t,this._start,this._end,e)},pw.prototype.getEnvelope=function(){if(null===this._env){var t=this._pts[this._start],e=this._pts[this._end];this._env=new xE(t,e)}return this._env},pw.prototype.getEndIndex=function(){return this._end},pw.prototype.getStartIndex=function(){return this._start},pw.prototype.getContext=function(){return this._context},pw.prototype.getId=function(){return this._id},pw.prototype.computeOverlapsInternal=function(t,e,n,r,i,o){var s=this._pts[t],a=this._pts[e],u=n._pts[r],l=n._pts[i];if(e-t==1&&i-r==1)return o.overlap(this,t,n,r),null;if(o.tempEnv1.init(s,a),o.tempEnv2.init(u,l),!o.tempEnv1.intersects(o.tempEnv2))return null;var c=Math.trunc((t+e)/2),h=Math.trunc((r+i)/2);t<c&&(r<h&&this.computeOverlapsInternal(t,c,n,r,h,o),h<i&&this.computeOverlapsInternal(t,c,n,h,i,o)),c<e&&(r<h&&this.computeOverlapsInternal(c,e,n,r,h,o),h<i&&this.computeOverlapsInternal(c,e,n,h,i,o))},pw.prototype.interfaces_=function(){return[]},pw.prototype.getClass=function(){return pw};var gw=function(){};gw.prototype.interfaces_=function(){return[]},gw.prototype.getClass=function(){return gw},gw.getChainStartIndices=function(t){var e=0,n=new nx;n.add(new hE(e));do{var r=gw.findChainEnd(t,e);n.add(new hE(r)),e=r}while(e<t.length-1);return gw.toIntArray(n)},gw.findChainEnd=function(t,e){for(var n=e;n<t.length-1&&t[n].equals2D(t[n+1]);)n++;if(n>=t.length-1)return t.length-1;for(var r=DC.quadrant(t[n],t[n+1]),i=e+1;i<t.length;){if(!t[i-1].equals2D(t[i]))if(DC.quadrant(t[i-1],t[i])!==r)break;i++}return i-1},gw.getChains=function(){if(1===arguments.length)return gw.getChains(arguments[0],null);if(2===arguments.length){for(var t=arguments[0],e=arguments[1],n=new nx,r=gw.getChainStartIndices(t),i=0;i<r.length-1;i++){var o=new pw(t,r[i],r[i+1],e);n.add(o)}return n}},gw.toIntArray=function(t){for(var e=new Array(t.size()).fill(null),n=0;n<e.length;n++)e[n]=t.get(n).intValue();return e};var Aw=function(){};Aw.prototype.computeNodes=function(t){},Aw.prototype.getNodedSubstrings=function(){},Aw.prototype.interfaces_=function(){return[]},Aw.prototype.getClass=function(){return Aw};var dw=function(){if(this._segInt=null,0===arguments.length);else if(1===arguments.length){var t=arguments[0];this.setSegmentIntersector(t)}};dw.prototype.setSegmentIntersector=function(t){this._segInt=t},dw.prototype.interfaces_=function(){return[Aw]},dw.prototype.getClass=function(){return dw};var yw=function(t){function e(e){e?t.call(this,e):t.call(this),this._monoChains=new nx,this._index=new ew,this._idCounter=0,this._nodedSegStrings=null,this._nOverlaps=0}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={SegmentOverlapAction:{configurable:!0}};return e.prototype.getMonotoneChains=function(){return this._monoChains},e.prototype.getNodedSubstrings=function(){return lw.getNodedSubstrings(this._nodedSegStrings)},e.prototype.getIndex=function(){return this._index},e.prototype.add=function(t){for(var e=this,n=gw.getChains(t.getCoordinates(),t).iterator();n.hasNext();){var r=n.next();r.setId(e._idCounter++),e._index.insert(r.getEnvelope(),r),e._monoChains.add(r)}},e.prototype.computeNodes=function(t){this._nodedSegStrings=t;for(var e=t.iterator();e.hasNext();)this.add(e.next());this.intersectChains()},e.prototype.intersectChains=function(){for(var t=this,e=new vw(this._segInt),n=this._monoChains.iterator();n.hasNext();)for(var r=n.next(),i=t._index.query(r.getEnvelope()).iterator();i.hasNext();){var o=i.next();if(o.getId()>r.getId()&&(r.computeOverlaps(o,e),t._nOverlaps++),t._segInt.isDone())return null}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},n.SegmentOverlapAction.get=function(){return vw},Object.defineProperties(e,n),e}(dw),vw=function(t){function e(){t.call(this),this._si=null;var e=arguments[0];this._si=e}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.overlap=function(){if(4!==arguments.length)return t.prototype.overlap.apply(this,arguments);var e=arguments[1],n=arguments[2],r=arguments[3],i=arguments[0].getContext(),o=n.getContext();this._si.processIntersections(i,e,o,r)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(fw),mw=function t(){if(this._quadrantSegments=t.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=t.CAP_ROUND,this._joinStyle=t.JOIN_ROUND,this._mitreLimit=t.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=t.DEFAULT_SIMPLIFY_FACTOR,0===arguments.length);else if(1===arguments.length){var e=arguments[0];this.setQuadrantSegments(e)}else if(2===arguments.length){var n=arguments[0],r=arguments[1];this.setQuadrantSegments(n),this.setEndCapStyle(r)}else if(4===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3];this.setQuadrantSegments(i),this.setEndCapStyle(o),this.setJoinStyle(s),this.setMitreLimit(a)}},_w={CAP_ROUND:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},JOIN_ROUND:{configurable:!0},JOIN_MITRE:{configurable:!0},JOIN_BEVEL:{configurable:!0},DEFAULT_QUADRANT_SEGMENTS:{configurable:!0},DEFAULT_MITRE_LIMIT:{configurable:!0},DEFAULT_SIMPLIFY_FACTOR:{configurable:!0}};mw.prototype.getEndCapStyle=function(){return this._endCapStyle},mw.prototype.isSingleSided=function(){return this._isSingleSided},mw.prototype.setQuadrantSegments=function(t){this._quadrantSegments=t,0===this._quadrantSegments&&(this._joinStyle=mw.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=mw.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),t<=0&&(this._quadrantSegments=1),this._joinStyle!==mw.JOIN_ROUND&&(this._quadrantSegments=mw.DEFAULT_QUADRANT_SEGMENTS)},mw.prototype.getJoinStyle=function(){return this._joinStyle},mw.prototype.setJoinStyle=function(t){this._joinStyle=t},mw.prototype.setSimplifyFactor=function(t){this._simplifyFactor=t<0?0:t},mw.prototype.getSimplifyFactor=function(){return this._simplifyFactor},mw.prototype.getQuadrantSegments=function(){return this._quadrantSegments},mw.prototype.setEndCapStyle=function(t){this._endCapStyle=t},mw.prototype.getMitreLimit=function(){return this._mitreLimit},mw.prototype.setMitreLimit=function(t){this._mitreLimit=t},mw.prototype.setSingleSided=function(t){this._isSingleSided=t},mw.prototype.interfaces_=function(){return[]},mw.prototype.getClass=function(){return mw},mw.bufferDistanceError=function(t){var e=Math.PI/2/t;return 1-Math.cos(e/2)},_w.CAP_ROUND.get=function(){return 1},_w.CAP_FLAT.get=function(){return 2},_w.CAP_SQUARE.get=function(){return 3},_w.JOIN_ROUND.get=function(){return 1},_w.JOIN_MITRE.get=function(){return 2},_w.JOIN_BEVEL.get=function(){return 3},_w.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8},_w.DEFAULT_MITRE_LIMIT.get=function(){return 5},_w.DEFAULT_SIMPLIFY_FACTOR.get=function(){return.01},Object.defineProperties(mw,_w);var Iw=function(t){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=OE.COUNTERCLOCKWISE,this._inputLine=t||null},Ew={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};Iw.prototype.isDeletable=function(t,e,n,r){var i=this._inputLine[t],o=this._inputLine[e],s=this._inputLine[n];return!!this.isConcave(i,o,s)&&(!!this.isShallow(i,o,s,r)&&this.isShallowSampled(i,o,t,n,r))},Iw.prototype.deleteShallowConcavities=function(){for(var t=this,e=1,n=this.findNextNonDeletedIndex(e),r=this.findNextNonDeletedIndex(n),i=!1;r<this._inputLine.length;){var o=!1;t.isDeletable(e,n,r,t._distanceTol)&&(t._isDeleted[n]=Iw.DELETE,o=!0,i=!0),e=o?r:n,n=t.findNextNonDeletedIndex(e),r=t.findNextNonDeletedIndex(n)}return i},Iw.prototype.isShallowConcavity=function(t,e,n,r){return OE.computeOrientation(t,e,n)===this._angleOrientation&&OE.distancePointLine(e,t,n)<r},Iw.prototype.isShallowSampled=function(t,e,n,r,i){var o=Math.trunc((r-n)/Iw.NUM_PTS_TO_CHECK);o<=0&&(o=1);for(var s=n;s<r;s+=o)if(!this.isShallow(t,e,this._inputLine[s],i))return!1;return!0},Iw.prototype.isConcave=function(t,e,n){var r=OE.computeOrientation(t,e,n)===this._angleOrientation;return r},Iw.prototype.simplify=function(t){this._distanceTol=Math.abs(t),t<0&&(this._angleOrientation=OE.CLOCKWISE),this._isDeleted=new Array(this._inputLine.length).fill(null);var e=!1;do{e=this.deleteShallowConcavities()}while(e);return this.collapseLine()},Iw.prototype.findNextNonDeletedIndex=function(t){for(var e=t+1;e<this._inputLine.length&&this._isDeleted[e]===Iw.DELETE;)e++;return e},Iw.prototype.isShallow=function(t,e,n,r){return OE.distancePointLine(e,t,n)<r},Iw.prototype.collapseLine=function(){for(var t=new ix,e=0;e<this._inputLine.length;e++)this._isDeleted[e]!==Iw.DELETE&&t.add(this._inputLine[e]);return t.toCoordinateArray()},Iw.prototype.interfaces_=function(){return[]},Iw.prototype.getClass=function(){return Iw},Iw.simplify=function(t,e){return new Iw(t).simplify(e)},Ew.INIT.get=function(){return 0},Ew.DELETE.get=function(){return 1},Ew.KEEP.get=function(){return 1},Ew.NUM_PTS_TO_CHECK.get=function(){return 10},Object.defineProperties(Iw,Ew);var xw=function(){this._ptList=null,this._precisionModel=null,this._minimimVertexDistance=0,this._ptList=new nx},Cw={COORDINATE_ARRAY_TYPE:{configurable:!0}};xw.prototype.getCoordinates=function(){return this._ptList.toArray(xw.COORDINATE_ARRAY_TYPE)},xw.prototype.setPrecisionModel=function(t){this._precisionModel=t},xw.prototype.addPt=function(t){var e=new eE(t);if(this._precisionModel.makePrecise(e),this.isRedundant(e))return null;this._ptList.add(e)},xw.prototype.revere=function(){},xw.prototype.addPts=function(t,e){if(e)for(var n=0;n<t.length;n++)this.addPt(t[n]);else for(var r=t.length-1;r>=0;r--)this.addPt(t[r])},xw.prototype.isRedundant=function(t){if(this._ptList.size()<1)return!1;var e=this._ptList.get(this._ptList.size()-1);return t.distance(e)<this._minimimVertexDistance},xw.prototype.toString=function(){return(new hC).createLineString(this.getCoordinates()).toString()},xw.prototype.closeRing=function(){if(this._ptList.size()<1)return null;var t=new eE(this._ptList.get(0)),e=this._ptList.get(this._ptList.size()-1);if(t.equals(e))return null;this._ptList.add(t)},xw.prototype.setMinimumVertexDistance=function(t){this._minimimVertexDistance=t},xw.prototype.interfaces_=function(){return[]},xw.prototype.getClass=function(){return xw},Cw.COORDINATE_ARRAY_TYPE.get=function(){return new Array(0).fill(null)},Object.defineProperties(xw,Cw);var ww=function(){},bw={PI_TIMES_2:{configurable:!0},PI_OVER_2:{configurable:!0},PI_OVER_4:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},CLOCKWISE:{configurable:!0},NONE:{configurable:!0}};ww.prototype.interfaces_=function(){return[]},ww.prototype.getClass=function(){return ww},ww.toDegrees=function(t){return 180*t/Math.PI},ww.normalize=function(t){for(;t>Math.PI;)t-=ww.PI_TIMES_2;for(;t<=-Math.PI;)t+=ww.PI_TIMES_2;return t},ww.angle=function(){if(1===arguments.length){var t=arguments[0];return Math.atan2(t.y,t.x)}if(2===arguments.length){var e=arguments[0],n=arguments[1],r=n.x-e.x,i=n.y-e.y;return Math.atan2(i,r)}},ww.isAcute=function(t,e,n){var r=t.x-e.x,i=t.y-e.y;return r*(n.x-e.x)+i*(n.y-e.y)>0},ww.isObtuse=function(t,e,n){var r=t.x-e.x,i=t.y-e.y;return r*(n.x-e.x)+i*(n.y-e.y)<0},ww.interiorAngle=function(t,e,n){var r=ww.angle(e,t),i=ww.angle(e,n);return Math.abs(i-r)},ww.normalizePositive=function(t){if(t<0){for(;t<0;)t+=ww.PI_TIMES_2;t>=ww.PI_TIMES_2&&(t=0)}else{for(;t>=ww.PI_TIMES_2;)t-=ww.PI_TIMES_2;t<0&&(t=0)}return t},ww.angleBetween=function(t,e,n){var r=ww.angle(e,t),i=ww.angle(e,n);return ww.diff(r,i)},ww.diff=function(t,e){var n=null;return(n=t<e?e-t:t-e)>Math.PI&&(n=2*Math.PI-n),n},ww.toRadians=function(t){return t*Math.PI/180},ww.getTurn=function(t,e){var n=Math.sin(e-t);return n>0?ww.COUNTERCLOCKWISE:n<0?ww.CLOCKWISE:ww.NONE},ww.angleBetweenOriented=function(t,e,n){var r=ww.angle(e,t),i=ww.angle(e,n)-r;return i<=-Math.PI?i+ww.PI_TIMES_2:i>Math.PI?i-ww.PI_TIMES_2:i},bw.PI_TIMES_2.get=function(){return 2*Math.PI},bw.PI_OVER_2.get=function(){return Math.PI/2},bw.PI_OVER_4.get=function(){return Math.PI/4},bw.COUNTERCLOCKWISE.get=function(){return OE.COUNTERCLOCKWISE},bw.CLOCKWISE.get=function(){return OE.CLOCKWISE},bw.NONE.get=function(){return OE.COLLINEAR},Object.defineProperties(ww,bw);var Bw=function t(){this._maxCurveSegmentError=0,this._filletAngleQuantum=null,this._closingSegLengthFactor=1,this._segList=null,this._distance=0,this._precisionModel=null,this._bufParams=null,this._li=null,this._s0=null,this._s1=null,this._s2=null,this._seg0=new cw,this._seg1=new cw,this._offset0=new cw,this._offset1=new cw,this._side=0,this._hasNarrowConcaveAngle=!1;var e=arguments[0],n=arguments[1],r=arguments[2];this._precisionModel=e,this._bufParams=n,this._li=new DE,this._filletAngleQuantum=Math.PI/2/n.getQuadrantSegments(),n.getQuadrantSegments()>=8&&n.getJoinStyle()===mw.JOIN_ROUND&&(this._closingSegLengthFactor=t.MAX_CLOSING_SEG_LEN_FACTOR),this.init(r)},Sw={OFFSET_SEGMENT_SEPARATION_FACTOR:{configurable:!0},INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},CURVE_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},MAX_CLOSING_SEG_LEN_FACTOR:{configurable:!0}};Bw.prototype.addNextSegment=function(t,e){if(this._s0=this._s1,this._s1=this._s2,this._s2=t,this._seg0.setCoordinates(this._s0,this._s1),this.computeOffsetSegment(this._seg0,this._side,this._distance,this._offset0),this._seg1.setCoordinates(this._s1,this._s2),this.computeOffsetSegment(this._seg1,this._side,this._distance,this._offset1),this._s1.equals(this._s2))return null;var n=OE.computeOrientation(this._s0,this._s1,this._s2),r=n===OE.CLOCKWISE&&this._side===mC.LEFT||n===OE.COUNTERCLOCKWISE&&this._side===mC.RIGHT;0===n?this.addCollinear(e):r?this.addOutsideTurn(n,e):this.addInsideTurn(n,e)},Bw.prototype.addLineEndCap=function(t,e){var n=new cw(t,e),r=new cw;this.computeOffsetSegment(n,mC.LEFT,this._distance,r);var i=new cw;this.computeOffsetSegment(n,mC.RIGHT,this._distance,i);var o=e.x-t.x,s=e.y-t.y,a=Math.atan2(s,o);switch(this._bufParams.getEndCapStyle()){case mw.CAP_ROUND:this._segList.addPt(r.p1),this.addFilletArc(e,a+Math.PI/2,a-Math.PI/2,OE.CLOCKWISE,this._distance),this._segList.addPt(i.p1);break;case mw.CAP_FLAT:this._segList.addPt(r.p1),this._segList.addPt(i.p1);break;case mw.CAP_SQUARE:var u=new eE;u.x=Math.abs(this._distance)*Math.cos(a),u.y=Math.abs(this._distance)*Math.sin(a);var l=new eE(r.p1.x+u.x,r.p1.y+u.y),c=new eE(i.p1.x+u.x,i.p1.y+u.y);this._segList.addPt(l),this._segList.addPt(c)}},Bw.prototype.getCoordinates=function(){return this._segList.getCoordinates()},Bw.prototype.addMitreJoin=function(t,e,n,r){var i=!0,o=null;try{o=EE.intersection(e.p0,e.p1,n.p0,n.p1),(r<=0?1:o.distance(t)/Math.abs(r))>this._bufParams.getMitreLimit()&&(i=!1)}catch(t){if(!(t instanceof _E))throw t;o=new eE(0,0),i=!1}i?this._segList.addPt(o):this.addLimitedMitreJoin(e,n,r,this._bufParams.getMitreLimit())},Bw.prototype.addFilletCorner=function(t,e,n,r,i){var o=e.x-t.x,s=e.y-t.y,a=Math.atan2(s,o),u=n.x-t.x,l=n.y-t.y,c=Math.atan2(l,u);r===OE.CLOCKWISE?a<=c&&(a+=2*Math.PI):a>=c&&(a-=2*Math.PI),this._segList.addPt(e),this.addFilletArc(t,a,c,r,i),this._segList.addPt(n)},Bw.prototype.addOutsideTurn=function(t,e){if(this._offset0.p1.distance(this._offset1.p0)<this._distance*Bw.OFFSET_SEGMENT_SEPARATION_FACTOR)return this._segList.addPt(this._offset0.p1),null;this._bufParams.getJoinStyle()===mw.JOIN_MITRE?this.addMitreJoin(this._s1,this._offset0,this._offset1,this._distance):this._bufParams.getJoinStyle()===mw.JOIN_BEVEL?this.addBevelJoin(this._offset0,this._offset1):(e&&this._segList.addPt(this._offset0.p1),this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,t,this._distance),this._segList.addPt(this._offset1.p0))},Bw.prototype.createSquare=function(t){this._segList.addPt(new eE(t.x+this._distance,t.y+this._distance)),this._segList.addPt(new eE(t.x+this._distance,t.y-this._distance)),this._segList.addPt(new eE(t.x-this._distance,t.y-this._distance)),this._segList.addPt(new eE(t.x-this._distance,t.y+this._distance)),this._segList.closeRing()},Bw.prototype.addSegments=function(t,e){this._segList.addPts(t,e)},Bw.prototype.addFirstSegment=function(){this._segList.addPt(this._offset1.p0)},Bw.prototype.addLastSegment=function(){this._segList.addPt(this._offset1.p1)},Bw.prototype.initSideSegments=function(t,e,n){this._s1=t,this._s2=e,this._side=n,this._seg1.setCoordinates(t,e),this.computeOffsetSegment(this._seg1,n,this._distance,this._offset1)},Bw.prototype.addLimitedMitreJoin=function(t,e,n,r){var i=this._seg0.p1,o=ww.angle(i,this._seg0.p0),s=ww.angleBetweenOriented(this._seg0.p0,i,this._seg1.p1)/2,a=ww.normalize(o+s),u=ww.normalize(a+Math.PI),l=r*n,c=n-l*Math.abs(Math.sin(s)),h=i.x+l*Math.cos(u),f=i.y+l*Math.sin(u),p=new eE(h,f),g=new cw(i,p),A=g.pointAlongOffset(1,c),d=g.pointAlongOffset(1,-c);this._side===mC.LEFT?(this._segList.addPt(A),this._segList.addPt(d)):(this._segList.addPt(d),this._segList.addPt(A))},Bw.prototype.computeOffsetSegment=function(t,e,n,r){var i=e===mC.LEFT?1:-1,o=t.p1.x-t.p0.x,s=t.p1.y-t.p0.y,a=Math.sqrt(o*o+s*s),u=i*n*o/a,l=i*n*s/a;r.p0.x=t.p0.x-l,r.p0.y=t.p0.y+u,r.p1.x=t.p1.x-l,r.p1.y=t.p1.y+u},Bw.prototype.addFilletArc=function(t,e,n,r,i){var o=r===OE.CLOCKWISE?-1:1,s=Math.abs(e-n),a=Math.trunc(s/this._filletAngleQuantum+.5);if(a<1)return null;for(var u=s/a,l=0,c=new eE;l<s;){var h=e+o*l;c.x=t.x+i*Math.cos(h),c.y=t.y+i*Math.sin(h),this._segList.addPt(c),l+=u}},Bw.prototype.addInsideTurn=function(t,e){if(this._li.computeIntersection(this._offset0.p0,this._offset0.p1,this._offset1.p0,this._offset1.p1),this._li.hasIntersection())this._segList.addPt(this._li.getIntersection(0));else if(this._hasNarrowConcaveAngle=!0,this._offset0.p1.distance(this._offset1.p0)<this._distance*Bw.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR)this._segList.addPt(this._offset0.p1);else{if(this._segList.addPt(this._offset0.p1),this._closingSegLengthFactor>0){var n=new eE((this._closingSegLengthFactor*this._offset0.p1.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset0.p1.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(n);var r=new eE((this._closingSegLengthFactor*this._offset1.p0.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset1.p0.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(r)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}},Bw.prototype.createCircle=function(t){var e=new eE(t.x+this._distance,t.y);this._segList.addPt(e),this.addFilletArc(t,0,2*Math.PI,-1,this._distance),this._segList.closeRing()},Bw.prototype.addBevelJoin=function(t,e){this._segList.addPt(t.p1),this._segList.addPt(e.p0)},Bw.prototype.init=function(t){this._distance=t,this._maxCurveSegmentError=t*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new xw,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(t*Bw.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)},Bw.prototype.addCollinear=function(t){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2),this._li.getIntersectionNum()>=2&&(this._bufParams.getJoinStyle()===mw.JOIN_BEVEL||this._bufParams.getJoinStyle()===mw.JOIN_MITRE?(t&&this._segList.addPt(this._offset0.p1),this._segList.addPt(this._offset1.p0)):this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,OE.CLOCKWISE,this._distance))},Bw.prototype.closeRing=function(){this._segList.closeRing()},Bw.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle},Bw.prototype.interfaces_=function(){return[]},Bw.prototype.getClass=function(){return Bw},Sw.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return.001},Sw.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return.001},Sw.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6},Sw.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80},Object.defineProperties(Bw,Sw);var Mw=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var t=arguments[0],e=arguments[1];this._precisionModel=t,this._bufParams=e};Mw.prototype.getOffsetCurve=function(t,e){if(this._distance=e,0===e)return null;var n=e<0,r=Math.abs(e),i=this.getSegGen(r);t.length<=1?this.computePointCurve(t[0],i):this.computeOffsetCurve(t,n,i);var o=i.getCoordinates();return n&&ox.reverse(o),o},Mw.prototype.computeSingleSidedBufferCurve=function(t,e,n){var r=this.simplifyTolerance(this._distance);if(e){n.addSegments(t,!0);var i=Iw.simplify(t,-r),o=i.length-1;n.initSideSegments(i[o],i[o-1],mC.LEFT),n.addFirstSegment();for(var s=o-2;s>=0;s--)n.addNextSegment(i[s],!0)}else{n.addSegments(t,!1);var a=Iw.simplify(t,r),u=a.length-1;n.initSideSegments(a[0],a[1],mC.LEFT),n.addFirstSegment();for(var l=2;l<=u;l++)n.addNextSegment(a[l],!0)}n.addLastSegment(),n.closeRing()},Mw.prototype.computeRingBufferCurve=function(t,e,n){var r=this.simplifyTolerance(this._distance);e===mC.RIGHT&&(r=-r);var i=Iw.simplify(t,r),o=i.length-1;n.initSideSegments(i[o-1],i[0],e);for(var s=1;s<=o;s++){var a=1!==s;n.addNextSegment(i[s],a)}n.closeRing()},Mw.prototype.computeLineBufferCurve=function(t,e){var n=this.simplifyTolerance(this._distance),r=Iw.simplify(t,n),i=r.length-1;e.initSideSegments(r[0],r[1],mC.LEFT);for(var o=2;o<=i;o++)e.addNextSegment(r[o],!0);e.addLastSegment(),e.addLineEndCap(r[i-1],r[i]);var s=Iw.simplify(t,-n),a=s.length-1;e.initSideSegments(s[a],s[a-1],mC.LEFT);for(var u=a-2;u>=0;u--)e.addNextSegment(s[u],!0);e.addLastSegment(),e.addLineEndCap(s[1],s[0]),e.closeRing()},Mw.prototype.computePointCurve=function(t,e){switch(this._bufParams.getEndCapStyle()){case mw.CAP_ROUND:e.createCircle(t);break;case mw.CAP_SQUARE:e.createSquare(t)}},Mw.prototype.getLineCurve=function(t,e){if(this._distance=e,e<0&&!this._bufParams.isSingleSided())return null;if(0===e)return null;var n=Math.abs(e),r=this.getSegGen(n);if(t.length<=1)this.computePointCurve(t[0],r);else if(this._bufParams.isSingleSided()){var i=e<0;this.computeSingleSidedBufferCurve(t,i,r)}else this.computeLineBufferCurve(t,r);return r.getCoordinates()},Mw.prototype.getBufferParameters=function(){return this._bufParams},Mw.prototype.simplifyTolerance=function(t){return t*this._bufParams.getSimplifyFactor()},Mw.prototype.getRingCurve=function(t,e,n){if(this._distance=n,t.length<=2)return this.getLineCurve(t,n);if(0===n)return Mw.copyCoordinates(t);var r=this.getSegGen(n);return this.computeRingBufferCurve(t,e,r),r.getCoordinates()},Mw.prototype.computeOffsetCurve=function(t,e,n){var r=this.simplifyTolerance(this._distance);if(e){var i=Iw.simplify(t,-r),o=i.length-1;n.initSideSegments(i[o],i[o-1],mC.LEFT),n.addFirstSegment();for(var s=o-2;s>=0;s--)n.addNextSegment(i[s],!0)}else{var a=Iw.simplify(t,r),u=a.length-1;n.initSideSegments(a[0],a[1],mC.LEFT),n.addFirstSegment();for(var l=2;l<=u;l++)n.addNextSegment(a[l],!0)}n.addLastSegment()},Mw.prototype.getSegGen=function(t){return new Bw(this._precisionModel,this._bufParams,t)},Mw.prototype.interfaces_=function(){return[]},Mw.prototype.getClass=function(){return Mw},Mw.copyCoordinates=function(t){for(var e=new Array(t.length).fill(null),n=0;n<e.length;n++)e[n]=new eE(t[n]);return e};var Lw=function(){this._subgraphs=null,this._seg=new cw,this._cga=new OE;var t=arguments[0];this._subgraphs=t},Nw={DepthSegment:{configurable:!0}};Lw.prototype.findStabbedSegments=function(){var t=this;if(1===arguments.length){for(var e=arguments[0],n=new nx,r=this._subgraphs.iterator();r.hasNext();){var i=r.next(),o=i.getEnvelope();e.y<o.getMinY()||e.y>o.getMaxY()||t.findStabbedSegments(e,i.getDirectedEdges(),n)}return n}if(3===arguments.length)if(aE(arguments[2],tx)&&arguments[0]instanceof eE&&arguments[1]instanceof OC)for(var s=arguments[0],a=arguments[1],u=arguments[2],l=a.getEdge().getCoordinates(),c=0;c<l.length-1;c++){if(t._seg.p0=l[c],t._seg.p1=l[c+1],t._seg.p0.y>t._seg.p1.y&&t._seg.reverse(),!(Math.max(t._seg.p0.x,t._seg.p1.x)<s.x||t._seg.isHorizontal()||s.y<t._seg.p0.y||s.y>t._seg.p1.y||OE.computeOrientation(t._seg.p0,t._seg.p1,s)===OE.RIGHT)){var h=a.getDepth(mC.LEFT);t._seg.p0.equals(l[c])||(h=a.getDepth(mC.RIGHT));var f=new Tw(t._seg,h);u.add(f)}}else if(aE(arguments[2],tx)&&arguments[0]instanceof eE&&aE(arguments[1],tx))for(var p=arguments[0],g=arguments[2],A=arguments[1].iterator();A.hasNext();){var d=A.next();d.isForward()&&t.findStabbedSegments(p,d,g)}},Lw.prototype.getDepth=function(t){var e=this.findStabbedSegments(t);return 0===e.size()?0:JC.min(e)._leftDepth},Lw.prototype.interfaces_=function(){return[]},Lw.prototype.getClass=function(){return Lw},Nw.DepthSegment.get=function(){return Tw},Object.defineProperties(Lw,Nw);var Tw=function(){this._upwardSeg=null,this._leftDepth=null;var t=arguments[0],e=arguments[1];this._upwardSeg=new cw(t),this._leftDepth=e};Tw.prototype.compareTo=function(t){var e=t;if(this._upwardSeg.minX()>=e._upwardSeg.maxX())return 1;if(this._upwardSeg.maxX()<=e._upwardSeg.minX())return-1;var n=this._upwardSeg.orientationIndex(e._upwardSeg);return 0!==n||0!==(n=-1*e._upwardSeg.orientationIndex(this._upwardSeg))?n:this._upwardSeg.compareTo(e._upwardSeg)},Tw.prototype.compareX=function(t,e){var n=t.p0.compareTo(e.p0);return 0!==n?n:t.p1.compareTo(e.p1)},Tw.prototype.toString=function(){return this._upwardSeg.toString()},Tw.prototype.interfaces_=function(){return[KI]},Tw.prototype.getClass=function(){return Tw};var Rw=function(t,e,n){this.p0=t||null,this.p1=e||null,this.p2=n||null};Rw.prototype.area=function(){return Rw.area(this.p0,this.p1,this.p2)},Rw.prototype.signedArea=function(){return Rw.signedArea(this.p0,this.p1,this.p2)},Rw.prototype.interpolateZ=function(t){if(null===t)throw new XI("Supplied point is null.");return Rw.interpolateZ(t,this.p0,this.p1,this.p2)},Rw.prototype.longestSideLength=function(){return Rw.longestSideLength(this.p0,this.p1,this.p2)},Rw.prototype.isAcute=function(){return Rw.isAcute(this.p0,this.p1,this.p2)},Rw.prototype.circumcentre=function(){return Rw.circumcentre(this.p0,this.p1,this.p2)},Rw.prototype.area3D=function(){return Rw.area3D(this.p0,this.p1,this.p2)},Rw.prototype.centroid=function(){return Rw.centroid(this.p0,this.p1,this.p2)},Rw.prototype.inCentre=function(){return Rw.inCentre(this.p0,this.p1,this.p2)},Rw.prototype.interfaces_=function(){return[]},Rw.prototype.getClass=function(){return Rw},Rw.area=function(t,e,n){return Math.abs(((n.x-t.x)*(e.y-t.y)-(e.x-t.x)*(n.y-t.y))/2)},Rw.signedArea=function(t,e,n){return((n.x-t.x)*(e.y-t.y)-(e.x-t.x)*(n.y-t.y))/2},Rw.det=function(t,e,n,r){return t*r-e*n},Rw.interpolateZ=function(t,e,n,r){var i=e.x,o=e.y,s=n.x-i,a=r.x-i,u=n.y-o,l=r.y-o,c=s*l-a*u,h=t.x-i,f=t.y-o,p=(l*h-a*f)/c,g=(-u*h+s*f)/c;return e.z+p*(n.z-e.z)+g*(r.z-e.z)},Rw.longestSideLength=function(t,e,n){var r=t.distance(e),i=e.distance(n),o=n.distance(t),s=r;return i>s&&(s=i),o>s&&(s=o),s},Rw.isAcute=function(t,e,n){return!!ww.isAcute(t,e,n)&&(!!ww.isAcute(e,n,t)&&!!ww.isAcute(n,t,e))},Rw.circumcentre=function(t,e,n){var r=n.x,i=n.y,o=t.x-r,s=t.y-i,a=e.x-r,u=e.y-i,l=2*Rw.det(o,s,a,u),c=Rw.det(s,o*o+s*s,u,a*a+u*u),h=Rw.det(o,o*o+s*s,a,a*a+u*u);return new eE(r-c/l,i+h/l)},Rw.perpendicularBisector=function(t,e){var n=e.x-t.x,r=e.y-t.y,i=new EE(t.x+n/2,t.y+r/2,1),o=new EE(t.x-r+n/2,t.y+n+r/2,1);return new EE(i,o)},Rw.angleBisector=function(t,e,n){var r=e.distance(t),i=r/(r+e.distance(n)),o=n.x-t.x,s=n.y-t.y;return new eE(t.x+i*o,t.y+i*s)},Rw.area3D=function(t,e,n){var r=e.x-t.x,i=e.y-t.y,o=e.z-t.z,s=n.x-t.x,a=n.y-t.y,u=n.z-t.z,l=i*u-o*a,c=o*s-r*u,h=r*a-i*s,f=l*l+c*c+h*h,p=Math.sqrt(f)/2;return p},Rw.centroid=function(t,e,n){var r=(t.x+e.x+n.x)/3,i=(t.y+e.y+n.y)/3;return new eE(r,i)},Rw.inCentre=function(t,e,n){var r=e.distance(n),i=t.distance(n),o=t.distance(e),s=r+i+o,a=(r*t.x+i*e.x+o*n.x)/s,u=(r*t.y+i*e.y+o*n.y)/s;return new eE(a,u)};var Qw=function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new nx;var t=arguments[0],e=arguments[1],n=arguments[2];this._inputGeom=t,this._distance=e,this._curveBuilder=n};Qw.prototype.addPoint=function(t){if(this._distance<=0)return null;var e=t.getCoordinates(),n=this._curveBuilder.getLineCurve(e,this._distance);this.addCurve(n,oE.EXTERIOR,oE.INTERIOR)},Qw.prototype.addPolygon=function(t){var e=this,n=this._distance,r=mC.LEFT;this._distance<0&&(n=-this._distance,r=mC.RIGHT);var i=t.getExteriorRing(),o=ox.removeRepeatedPoints(i.getCoordinates());if(this._distance<0&&this.isErodedCompletely(i,this._distance))return null;if(this._distance<=0&&o.length<3)return null;this.addPolygonRing(o,n,r,oE.EXTERIOR,oE.INTERIOR);for(var s=0;s<t.getNumInteriorRing();s++){var a=t.getInteriorRingN(s),u=ox.removeRepeatedPoints(a.getCoordinates());e._distance>0&&e.isErodedCompletely(a,-e._distance)||e.addPolygonRing(u,n,mC.opposite(r),oE.INTERIOR,oE.EXTERIOR)}},Qw.prototype.isTriangleErodedCompletely=function(t,e){var n=new Rw(t[0],t[1],t[2]),r=n.inCentre();return OE.distancePointLine(r,n.p0,n.p1)<Math.abs(e)},Qw.prototype.addLineString=function(t){if(this._distance<=0&&!this._curveBuilder.getBufferParameters().isSingleSided())return null;var e=ox.removeRepeatedPoints(t.getCoordinates()),n=this._curveBuilder.getLineCurve(e,this._distance);this.addCurve(n,oE.EXTERIOR,oE.INTERIOR)},Qw.prototype.addCurve=function(t,e,n){if(null===t||t.length<2)return null;var r=new lw(t,new SC(0,oE.BOUNDARY,e,n));this._curveList.add(r)},Qw.prototype.getCurves=function(){return this.add(this._inputGeom),this._curveList},Qw.prototype.addPolygonRing=function(t,e,n,r,i){if(0===e&&t.length<Jx.MINIMUM_VALID_SIZE)return null;var o=r,s=i;t.length>=Jx.MINIMUM_VALID_SIZE&&OE.isCCW(t)&&(o=i,s=r,n=mC.opposite(n));var a=this._curveBuilder.getRingCurve(t,n,e);this.addCurve(a,o,s)},Qw.prototype.add=function(t){if(t.isEmpty())return null;t instanceof Hx?this.addPolygon(t):t instanceof jx?this.addLineString(t):t instanceof Vx?this.addPoint(t):(t instanceof Xx||t instanceof Nx||t instanceof Wx||t instanceof Lx)&&this.addCollection(t)},Qw.prototype.isErodedCompletely=function(t,e){var n=t.getCoordinates();if(n.length<4)return e<0;if(4===n.length)return this.isTriangleErodedCompletely(n,e);var r=t.getEnvelopeInternal(),i=Math.min(r.getHeight(),r.getWidth());return e<0&&2*Math.abs(e)>i},Qw.prototype.addCollection=function(t){for(var e=0;e<t.getNumGeometries();e++){var n=t.getGeometryN(e);this.add(n)}},Qw.prototype.interfaces_=function(){return[]},Qw.prototype.getClass=function(){return Qw};var Dw=function(){};Dw.prototype.locate=function(t){},Dw.prototype.interfaces_=function(){return[]},Dw.prototype.getClass=function(){return Dw};var Pw=function(){this._parent=null,this._atStart=null,this._max=null,this._index=null,this._subcollectionIterator=null;var t=arguments[0];this._parent=t,this._atStart=!0,this._index=0,this._max=t.getNumGeometries()};Pw.prototype.next=function(){if(this._atStart)return this._atStart=!1,Pw.isAtomic(this._parent)&&this._index++,this._parent;if(null!==this._subcollectionIterator){if(this._subcollectionIterator.hasNext())return this._subcollectionIterator.next();this._subcollectionIterator=null}if(this._index>=this._max)throw new ex;var t=this._parent.getGeometryN(this._index++);return t instanceof Lx?(this._subcollectionIterator=new Pw(t),this._subcollectionIterator.next()):t},Pw.prototype.remove=function(){throw new Error(this.getClass().getName())},Pw.prototype.hasNext=function(){if(this._atStart)return!0;if(null!==this._subcollectionIterator){if(this._subcollectionIterator.hasNext())return!0;this._subcollectionIterator=null}return!(this._index>=this._max)},Pw.prototype.interfaces_=function(){return[$E]},Pw.prototype.getClass=function(){return Pw},Pw.isAtomic=function(t){return!(t instanceof Lx)};var kw=function(){this._geom=null;var t=arguments[0];this._geom=t};kw.prototype.locate=function(t){return kw.locate(t,this._geom)},kw.prototype.interfaces_=function(){return[Dw]},kw.prototype.getClass=function(){return kw},kw.isPointInRing=function(t,e){return!!e.getEnvelopeInternal().intersects(t)&&OE.isPointInRing(t,e.getCoordinates())},kw.containsPointInPolygon=function(t,e){if(e.isEmpty())return!1;var n=e.getExteriorRing();if(!kw.isPointInRing(t,n))return!1;for(var r=0;r<e.getNumInteriorRing();r++){var i=e.getInteriorRingN(r);if(kw.isPointInRing(t,i))return!1}return!0},kw.containsPoint=function(t,e){if(e instanceof Hx)return kw.containsPointInPolygon(t,e);if(e instanceof Lx)for(var n=new Pw(e);n.hasNext();){var r=n.next();if(r!==e&&kw.containsPoint(t,r))return!0}return!1},kw.locate=function(t,e){return e.isEmpty()?oE.EXTERIOR:kw.containsPoint(t,e)?oE.INTERIOR:oE.EXTERIOR};var Ow=function(){this._edgeMap=new _x,this._edgeList=null,this._ptInAreaLocation=[oE.NONE,oE.NONE]};Ow.prototype.getNextCW=function(t){this.getEdges();var e=this._edgeList.indexOf(t),n=e-1;return 0===e&&(n=this._edgeList.size()-1),this._edgeList.get(n)},Ow.prototype.propagateSideLabels=function(t){for(var e=oE.NONE,n=this.iterator();n.hasNext();){var r=n.next().getLabel();r.isArea(t)&&r.getLocation(t,mC.LEFT)!==oE.NONE&&(e=r.getLocation(t,mC.LEFT))}if(e===oE.NONE)return null;for(var i=e,o=this.iterator();o.hasNext();){var s=o.next(),a=s.getLabel();if(a.getLocation(t,mC.ON)===oE.NONE&&a.setLocation(t,mC.ON,i),a.isArea(t)){var u=a.getLocation(t,mC.LEFT),l=a.getLocation(t,mC.RIGHT);if(l!==oE.NONE){if(l!==i)throw new CC("side location conflict",s.getCoordinate());u===oE.NONE&&TE.shouldNeverReachHere("found single null side (at "+s.getCoordinate()+")"),i=u}else TE.isTrue(a.getLocation(t,mC.LEFT)===oE.NONE,"found single null side"),a.setLocation(t,mC.RIGHT,i),a.setLocation(t,mC.LEFT,i)}}},Ow.prototype.getCoordinate=function(){var t=this.iterator();return t.hasNext()?t.next().getCoordinate():null},Ow.prototype.print=function(t){IE.out.println("EdgeEndStar: "+this.getCoordinate());for(var e=this.iterator();e.hasNext();){e.next().print(t)}},Ow.prototype.isAreaLabelsConsistent=function(t){return this.computeEdgeEndLabels(t.getBoundaryNodeRule()),this.checkAreaLabelsConsistent(0)},Ow.prototype.checkAreaLabelsConsistent=function(t){var e=this.getEdges();if(e.size()<=0)return!0;var n=e.size()-1,r=e.get(n).getLabel().getLocation(t,mC.LEFT);TE.isTrue(r!==oE.NONE,"Found unlabelled area edge");for(var i=r,o=this.iterator();o.hasNext();){var s=o.next().getLabel();TE.isTrue(s.isArea(t),"Found non-area edge");var a=s.getLocation(t,mC.LEFT),u=s.getLocation(t,mC.RIGHT);if(a===u)return!1;if(u!==i)return!1;i=a}return!0},Ow.prototype.findIndex=function(t){this.iterator();for(var e=0;e<this._edgeList.size();e++){if(this._edgeList.get(e)===t)return e}return-1},Ow.prototype.iterator=function(){return this.getEdges().iterator()},Ow.prototype.getEdges=function(){return null===this._edgeList&&(this._edgeList=new nx(this._edgeMap.values())),this._edgeList},Ow.prototype.getLocation=function(t,e,n){return this._ptInAreaLocation[t]===oE.NONE&&(this._ptInAreaLocation[t]=kw.locate(e,n[t].getGeometry())),this._ptInAreaLocation[t]},Ow.prototype.toString=function(){var t=new cE;t.append("EdgeEndStar: "+this.getCoordinate()),t.append("\n");for(var e=this.iterator();e.hasNext();){var n=e.next();t.append(n),t.append("\n")}return t.toString()},Ow.prototype.computeEdgeEndLabels=function(t){for(var e=this.iterator();e.hasNext();){e.next().computeLabel(t)}},Ow.prototype.computeLabelling=function(t){this.computeEdgeEndLabels(t[0].getBoundaryNodeRule()),this.propagateSideLabels(0),this.propagateSideLabels(1);for(var e=[!1,!1],n=this.iterator();n.hasNext();)for(var r=n.next().getLabel(),i=0;i<2;i++)r.isLine(i)&&r.getLocation(i)===oE.BOUNDARY&&(e[i]=!0);for(var o=this.iterator();o.hasNext();)for(var s=o.next(),a=s.getLabel(),u=0;u<2;u++)if(a.isAnyNull(u)){var l=oE.NONE;if(e[u])l=oE.EXTERIOR;else{var c=s.getCoordinate();l=this.getLocation(u,c,t)}a.setAllLocationsIfNull(u,l)}},Ow.prototype.getDegree=function(){return this._edgeMap.size()},Ow.prototype.insertEdgeEnd=function(t,e){this._edgeMap.put(t,e),this._edgeList=null},Ow.prototype.interfaces_=function(){return[]},Ow.prototype.getClass=function(){return Ow};var Fw=function(t){function e(){t.call(this),this._resultAreaEdgeList=null,this._label=null,this._SCANNING_FOR_INCOMING=1,this._LINKING_TO_OUTGOING=2}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.linkResultDirectedEdges=function(){var t=this;this.getResultAreaEdges();for(var e=null,n=null,r=this._SCANNING_FOR_INCOMING,i=0;i<this._resultAreaEdgeList.size();i++){var o=t._resultAreaEdgeList.get(i),s=o.getSym();if(o.getLabel().isArea())switch(null===e&&o.isInResult()&&(e=o),r){case t._SCANNING_FOR_INCOMING:if(!s.isInResult())continue;n=s,r=t._LINKING_TO_OUTGOING;break;case t._LINKING_TO_OUTGOING:if(!o.isInResult())continue;n.setNext(o),r=t._SCANNING_FOR_INCOMING}}if(r===this._LINKING_TO_OUTGOING){if(null===e)throw new CC("no outgoing dirEdge found",this.getCoordinate());TE.isTrue(e.isInResult(),"unable to link last incoming dirEdge"),n.setNext(e)}},e.prototype.insert=function(t){var e=t;this.insertEdgeEnd(e,e)},e.prototype.getRightmostEdge=function(){var t=this.getEdges(),e=t.size();if(e<1)return null;var n=t.get(0);if(1===e)return n;var r=t.get(e-1),i=n.getQuadrant(),o=r.getQuadrant();return DC.isNorthern(i)&&DC.isNorthern(o)?n:DC.isNorthern(i)||DC.isNorthern(o)?0!==n.getDy()?n:0!==r.getDy()?r:(TE.shouldNeverReachHere("found two horizontal edges incident on node"),null):r},e.prototype.print=function(t){IE.out.println("DirectedEdgeStar: "+this.getCoordinate());for(var e=this.iterator();e.hasNext();){var n=e.next();t.print("out "),n.print(t),t.println(),t.print("in "),n.getSym().print(t),t.println()}},e.prototype.getResultAreaEdges=function(){if(null!==this._resultAreaEdgeList)return this._resultAreaEdgeList;this._resultAreaEdgeList=new nx;for(var t=this.iterator();t.hasNext();){var e=t.next();(e.isInResult()||e.getSym().isInResult())&&this._resultAreaEdgeList.add(e)}return this._resultAreaEdgeList},e.prototype.updateLabelling=function(t){for(var e=this.iterator();e.hasNext();){var n=e.next().getLabel();n.setAllLocationsIfNull(0,t.getLocation(0)),n.setAllLocationsIfNull(1,t.getLocation(1))}},e.prototype.linkAllDirectedEdges=function(){this.getEdges();for(var t=null,e=null,n=this._edgeList.size()-1;n>=0;n--){var r=this._edgeList.get(n),i=r.getSym();null===e&&(e=i),null!==t&&i.setNext(t),t=r}e.setNext(t)},e.prototype.computeDepths=function(){if(1===arguments.length){var t=arguments[0],e=this.findIndex(t),n=t.getDepth(mC.LEFT),r=t.getDepth(mC.RIGHT),i=this.computeDepths(e+1,this._edgeList.size(),n);if(this.computeDepths(0,e,i)!==r)throw new CC("depth mismatch at "+t.getCoordinate())}else if(3===arguments.length){for(var o=arguments[1],s=arguments[2],a=arguments[0];a<o;a++){var u=this._edgeList.get(a);u.setEdgeDepths(mC.RIGHT,s),s=u.getDepth(mC.LEFT)}return s}},e.prototype.mergeSymLabels=function(){for(var t=this.iterator();t.hasNext();){var e=t.next();e.getLabel().merge(e.getSym().getLabel())}},e.prototype.linkMinimalDirectedEdges=function(t){for(var e=this,n=null,r=null,i=this._SCANNING_FOR_INCOMING,o=this._resultAreaEdgeList.size()-1;o>=0;o--){var s=e._resultAreaEdgeList.get(o),a=s.getSym();switch(null===n&&s.getEdgeRing()===t&&(n=s),i){case e._SCANNING_FOR_INCOMING:if(a.getEdgeRing()!==t)continue;r=a,i=e._LINKING_TO_OUTGOING;break;case e._LINKING_TO_OUTGOING:if(s.getEdgeRing()!==t)continue;r.setNextMin(s),i=e._SCANNING_FOR_INCOMING}}i===this._LINKING_TO_OUTGOING&&(TE.isTrue(null!==n,"found null for first outgoing dirEdge"),TE.isTrue(n.getEdgeRing()===t,"unable to link last incoming dirEdge"),r.setNextMin(n))},e.prototype.getOutgoingDegree=function(){if(0===arguments.length){for(var t=0,e=this.iterator();e.hasNext();){e.next().isInResult()&&t++}return t}if(1===arguments.length){for(var n=arguments[0],r=0,i=this.iterator();i.hasNext();){i.next().getEdgeRing()===n&&r++}return r}},e.prototype.getLabel=function(){return this._label},e.prototype.findCoveredLineEdges=function(){for(var t=oE.NONE,e=this.iterator();e.hasNext();){var n=e.next(),r=n.getSym();if(!n.isLineEdge()){if(n.isInResult()){t=oE.INTERIOR;break}if(r.isInResult()){t=oE.EXTERIOR;break}}}if(t===oE.NONE)return null;for(var i=t,o=this.iterator();o.hasNext();){var s=o.next(),a=s.getSym();s.isLineEdge()?s.getEdge().setCovered(i===oE.INTERIOR):(s.isInResult()&&(i=oE.EXTERIOR),a.isInResult()&&(i=oE.INTERIOR))}},e.prototype.computeLabelling=function(e){t.prototype.computeLabelling.call(this,e),this._label=new SC(oE.NONE);for(var n=this.iterator();n.hasNext();)for(var r=n.next().getEdge().getLabel(),i=0;i<2;i++){var o=r.getLocation(i);o!==oE.INTERIOR&&o!==oE.BOUNDARY||this._label.setLocation(i,oE.INTERIOR)}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(Ow),Gw=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.createNode=function(t){return new RC(t,new Fw)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(FC),Uw=function t(){this._pts=null,this._orientation=null;var e=arguments[0];this._pts=e,this._orientation=t.orientation(e)};Uw.prototype.compareTo=function(t){var e=t;return Uw.compareOriented(this._pts,this._orientation,e._pts,e._orientation)},Uw.prototype.interfaces_=function(){return[KI]},Uw.prototype.getClass=function(){return Uw},Uw.orientation=function(t){return 1===ox.increasingDirection(t)},Uw.compareOriented=function(t,e,n,r){for(var i=e?1:-1,o=r?1:-1,s=e?t.length:-1,a=r?n.length:-1,u=e?0:t.length-1,l=r?0:n.length-1;;){var c=t[u].compareTo(n[l]);if(0!==c)return c;var h=(u+=i)===s,f=(l+=o)===a;if(h&&!f)return-1;if(!h&&f)return 1;if(h&&f)return 0}};var qw=function(){this._edges=new nx,this._ocaMap=new _x};qw.prototype.print=function(t){t.print("MULTILINESTRING ( ");for(var e=0;e<this._edges.size();e++){var n=this._edges.get(e);e>0&&t.print(","),t.print("(");for(var r=n.getCoordinates(),i=0;i<r.length;i++)i>0&&t.print(","),t.print(r[i].x+" "+r[i].y);t.println(")")}t.print(") ")},qw.prototype.addAll=function(t){for(var e=t.iterator();e.hasNext();)this.add(e.next())},qw.prototype.findEdgeIndex=function(t){for(var e=0;e<this._edges.size();e++)if(this._edges.get(e).equals(t))return e;return-1},qw.prototype.iterator=function(){return this._edges.iterator()},qw.prototype.getEdges=function(){return this._edges},qw.prototype.get=function(t){return this._edges.get(t)},qw.prototype.findEqualEdge=function(t){var e=new Uw(t.getCoordinates());return this._ocaMap.get(e)},qw.prototype.add=function(t){this._edges.add(t);var e=new Uw(t.getCoordinates());this._ocaMap.put(e,t)},qw.prototype.interfaces_=function(){return[]},qw.prototype.getClass=function(){return qw};var jw=function(){};jw.prototype.processIntersections=function(t,e,n,r){},jw.prototype.isDone=function(){},jw.prototype.interfaces_=function(){return[]},jw.prototype.getClass=function(){return jw};var zw=function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._hasInterior=!1,this._properIntersectionPoint=null,this._li=null,this._isSelfIntersection=null,this.numIntersections=0,this.numInteriorIntersections=0,this.numProperIntersections=0,this.numTests=0;var t=arguments[0];this._li=t};zw.prototype.isTrivialIntersection=function(t,e,n,r){if(t===n&&1===this._li.getIntersectionNum()){if(zw.isAdjacentSegments(e,r))return!0;if(t.isClosed()){var i=t.size()-1;if(0===e&&r===i||0===r&&e===i)return!0}}return!1},zw.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},zw.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},zw.prototype.getLineIntersector=function(){return this._li},zw.prototype.hasProperIntersection=function(){return this._hasProper},zw.prototype.processIntersections=function(t,e,n,r){if(t===n&&e===r)return null;this.numTests++;var i=t.getCoordinates()[e],o=t.getCoordinates()[e+1],s=n.getCoordinates()[r],a=n.getCoordinates()[r+1];this._li.computeIntersection(i,o,s,a),this._li.hasIntersection()&&(this.numIntersections++,this._li.isInteriorIntersection()&&(this.numInteriorIntersections++,this._hasInterior=!0),this.isTrivialIntersection(t,e,n,r)||(this._hasIntersection=!0,t.addIntersections(this._li,e,0),n.addIntersections(this._li,r,1),this._li.isProper()&&(this.numProperIntersections++,this._hasProper=!0,this._hasProperInterior=!0)))},zw.prototype.hasIntersection=function(){return this._hasIntersection},zw.prototype.isDone=function(){return!1},zw.prototype.hasInteriorIntersection=function(){return this._hasInterior},zw.prototype.interfaces_=function(){return[jw]},zw.prototype.getClass=function(){return zw},zw.isAdjacentSegments=function(t,e){return 1===Math.abs(t-e)};var Vw=function(){this.coord=null,this.segmentIndex=null,this.dist=null;var t=arguments[0],e=arguments[1],n=arguments[2];this.coord=new eE(t),this.segmentIndex=e,this.dist=n};Vw.prototype.getSegmentIndex=function(){return this.segmentIndex},Vw.prototype.getCoordinate=function(){return this.coord},Vw.prototype.print=function(t){t.print(this.coord),t.print(" seg # = "+this.segmentIndex),t.println(" dist = "+this.dist)},Vw.prototype.compareTo=function(t){var e=t;return this.compare(e.segmentIndex,e.dist)},Vw.prototype.isEndPoint=function(t){return 0===this.segmentIndex&&0===this.dist||this.segmentIndex===t},Vw.prototype.toString=function(){return this.coord+" seg # = "+this.segmentIndex+" dist = "+this.dist},Vw.prototype.getDistance=function(){return this.dist},Vw.prototype.compare=function(t,e){return this.segmentIndex<t?-1:this.segmentIndex>t?1:this.dist<e?-1:this.dist>e?1:0},Vw.prototype.interfaces_=function(){return[KI]},Vw.prototype.getClass=function(){return Vw};var Yw=function(){this._nodeMap=new _x,this.edge=null;var t=arguments[0];this.edge=t};Yw.prototype.print=function(t){t.println("Intersections:");for(var e=this.iterator();e.hasNext();){e.next().print(t)}},Yw.prototype.iterator=function(){return this._nodeMap.values().iterator()},Yw.prototype.addSplitEdges=function(t){this.addEndpoints();for(var e=this.iterator(),n=e.next();e.hasNext();){var r=e.next(),i=this.createSplitEdge(n,r);t.add(i),n=r}},Yw.prototype.addEndpoints=function(){var t=this.edge.pts.length-1;this.add(this.edge.pts[0],0,0),this.add(this.edge.pts[t],t,0)},Yw.prototype.createSplitEdge=function(t,e){var n=e.segmentIndex-t.segmentIndex+2,r=this.edge.pts[e.segmentIndex],i=e.dist>0||!e.coord.equals2D(r);i||n--;var o=new Array(n).fill(null),s=0;o[s++]=new eE(t.coord);for(var a=t.segmentIndex+1;a<=e.segmentIndex;a++)o[s++]=this.edge.pts[a];return i&&(o[s]=e.coord),new Kw(o,new SC(this.edge._label))},Yw.prototype.add=function(t,e,n){var r=new Vw(t,e,n),i=this._nodeMap.get(r);return null!==i?i:(this._nodeMap.put(r,r),r)},Yw.prototype.isIntersection=function(t){for(var e=this.iterator();e.hasNext();){if(e.next().coord.equals(t))return!0}return!1},Yw.prototype.interfaces_=function(){return[]},Yw.prototype.getClass=function(){return Yw};var Hw=function(){};Hw.prototype.getChainStartIndices=function(t){var e=0,n=new nx;n.add(new hE(e));do{var r=this.findChainEnd(t,e);n.add(new hE(r)),e=r}while(e<t.length-1);return Hw.toIntArray(n)},Hw.prototype.findChainEnd=function(t,e){for(var n=DC.quadrant(t[e],t[e+1]),r=e+1;r<t.length;){if(DC.quadrant(t[r-1],t[r])!==n)break;r++}return r-1},Hw.prototype.interfaces_=function(){return[]},Hw.prototype.getClass=function(){return Hw},Hw.toIntArray=function(t){for(var e=new Array(t.size()).fill(null),n=0;n<e.length;n++)e[n]=t.get(n).intValue();return e};var Xw=function(){this.e=null,this.pts=null,this.startIndex=null,this.env1=new xE,this.env2=new xE;var t=arguments[0];this.e=t,this.pts=t.getCoordinates();var e=new Hw;this.startIndex=e.getChainStartIndices(this.pts)};Xw.prototype.getCoordinates=function(){return this.pts},Xw.prototype.getMaxX=function(t){var e=this.pts[this.startIndex[t]].x,n=this.pts[this.startIndex[t+1]].x;return e>n?e:n},Xw.prototype.getMinX=function(t){var e=this.pts[this.startIndex[t]].x,n=this.pts[this.startIndex[t+1]].x;return e<n?e:n},Xw.prototype.computeIntersectsForChain=function(){if(4===arguments.length){var t=arguments[0],e=arguments[1],n=arguments[2],r=arguments[3];this.computeIntersectsForChain(this.startIndex[t],this.startIndex[t+1],e,e.startIndex[n],e.startIndex[n+1],r)}else if(6===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2],a=arguments[3],u=arguments[4],l=arguments[5],c=this.pts[i],h=this.pts[o],f=s.pts[a],p=s.pts[u];if(o-i==1&&u-a==1)return l.addIntersections(this.e,i,s.e,a),null;if(this.env1.init(c,h),this.env2.init(f,p),!this.env1.intersects(this.env2))return null;var g=Math.trunc((i+o)/2),A=Math.trunc((a+u)/2);i<g&&(a<A&&this.computeIntersectsForChain(i,g,s,a,A,l),A<u&&this.computeIntersectsForChain(i,g,s,A,u,l)),g<o&&(a<A&&this.computeIntersectsForChain(g,o,s,a,A,l),A<u&&this.computeIntersectsForChain(g,o,s,A,u,l))}},Xw.prototype.getStartIndexes=function(){return this.startIndex},Xw.prototype.computeIntersects=function(t,e){for(var n=0;n<this.startIndex.length-1;n++)for(var r=0;r<t.startIndex.length-1;r++)this.computeIntersectsForChain(n,t,r,e)},Xw.prototype.interfaces_=function(){return[]},Xw.prototype.getClass=function(){return Xw};var Jw=function t(){this._depth=Array(2).fill().map((function(){return Array(3)}));for(var e=0;e<2;e++)for(var n=0;n<3;n++)this._depth[e][n]=t.NULL_VALUE},Ww={NULL_VALUE:{configurable:!0}};Jw.prototype.getDepth=function(t,e){return this._depth[t][e]},Jw.prototype.setDepth=function(t,e,n){this._depth[t][e]=n},Jw.prototype.isNull=function(){if(0===arguments.length){for(var t=0;t<2;t++)for(var e=0;e<3;e++)if(this._depth[t][e]!==Jw.NULL_VALUE)return!1;return!0}if(1===arguments.length){var n=arguments[0];return this._depth[n][1]===Jw.NULL_VALUE}if(2===arguments.length){var r=arguments[0],i=arguments[1];return this._depth[r][i]===Jw.NULL_VALUE}},Jw.prototype.normalize=function(){for(var t=this,e=0;e<2;e++)if(!t.isNull(e)){var n=t._depth[e][1];t._depth[e][2]<n&&(n=t._depth[e][2]),n<0&&(n=0);for(var r=1;r<3;r++){var i=0;t._depth[e][r]>n&&(i=1),t._depth[e][r]=i}}},Jw.prototype.getDelta=function(t){return this._depth[t][mC.RIGHT]-this._depth[t][mC.LEFT]},Jw.prototype.getLocation=function(t,e){return this._depth[t][e]<=0?oE.EXTERIOR:oE.INTERIOR},Jw.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]},Jw.prototype.add=function(){var t=this;if(1===arguments.length)for(var e=arguments[0],n=0;n<2;n++)for(var r=1;r<3;r++){var i=e.getLocation(n,r);i!==oE.EXTERIOR&&i!==oE.INTERIOR||(t.isNull(n,r)?t._depth[n][r]=Jw.depthAtLocation(i):t._depth[n][r]+=Jw.depthAtLocation(i))}else if(3===arguments.length){var o=arguments[0],s=arguments[1];arguments[2]===oE.INTERIOR&&this._depth[o][s]++}},Jw.prototype.interfaces_=function(){return[]},Jw.prototype.getClass=function(){return Jw},Jw.depthAtLocation=function(t){return t===oE.EXTERIOR?0:t===oE.INTERIOR?1:Jw.NULL_VALUE},Ww.NULL_VALUE.get=function(){return-1},Object.defineProperties(Jw,Ww);var Kw=function(t){function e(){if(t.call(this),this.pts=null,this._env=null,this.eiList=new Yw(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new Jw,this._depthDelta=0,1===arguments.length){var n=arguments[0];e.call(this,n,null)}else if(2===arguments.length){var r=arguments[0],i=arguments[1];this.pts=r,this._label=i}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getDepth=function(){return this._depth},e.prototype.getCollapsedEdge=function(){var t=new Array(2).fill(null);return t[0]=this.pts[0],t[1]=this.pts[1],new e(t,SC.toLineLabel(this._label))},e.prototype.isIsolated=function(){return this._isIsolated},e.prototype.getCoordinates=function(){return this.pts},e.prototype.setIsolated=function(t){this._isIsolated=t},e.prototype.setName=function(t){this._name=t},e.prototype.equals=function(t){if(!(t instanceof e))return!1;var n=t;if(this.pts.length!==n.pts.length)return!1;for(var r=!0,i=!0,o=this.pts.length,s=0;s<this.pts.length;s++)if(this.pts[s].equals2D(n.pts[s])||(r=!1),this.pts[s].equals2D(n.pts[--o])||(i=!1),!r&&!i)return!1;return!0},e.prototype.getCoordinate=function(){if(0===arguments.length)return this.pts.length>0?this.pts[0]:null;if(1===arguments.length){var t=arguments[0];return this.pts[t]}},e.prototype.print=function(t){t.print("edge "+this._name+": "),t.print("LINESTRING (");for(var e=0;e<this.pts.length;e++)e>0&&t.print(","),t.print(this.pts[e].x+" "+this.pts[e].y);t.print(") "+this._label+" "+this._depthDelta)},e.prototype.computeIM=function(t){e.updateIM(this._label,t)},e.prototype.isCollapsed=function(){return!!this._label.isArea()&&(3===this.pts.length&&!!this.pts[0].equals(this.pts[2]))},e.prototype.isClosed=function(){return this.pts[0].equals(this.pts[this.pts.length-1])},e.prototype.getMaximumSegmentIndex=function(){return this.pts.length-1},e.prototype.getDepthDelta=function(){return this._depthDelta},e.prototype.getNumPoints=function(){return this.pts.length},e.prototype.printReverse=function(t){t.print("edge "+this._name+": ");for(var e=this.pts.length-1;e>=0;e--)t.print(this.pts[e]+" ");t.println("")},e.prototype.getMonotoneChainEdge=function(){return null===this._mce&&(this._mce=new Xw(this)),this._mce},e.prototype.getEnvelope=function(){if(null===this._env){this._env=new xE;for(var t=0;t<this.pts.length;t++)this._env.expandToInclude(this.pts[t])}return this._env},e.prototype.addIntersection=function(t,e,n,r){var i=new eE(t.getIntersection(r)),o=e,s=t.getEdgeDistance(n,r),a=o+1;if(a<this.pts.length){var u=this.pts[a];i.equals2D(u)&&(o=a,s=0)}this.eiList.add(i,o,s)},e.prototype.toString=function(){var t=new cE;t.append("edge "+this._name+": "),t.append("LINESTRING (");for(var e=0;e<this.pts.length;e++)e>0&&t.append(","),t.append(this.pts[e].x+" "+this.pts[e].y);return t.append(") "+this._label+" "+this._depthDelta),t.toString()},e.prototype.isPointwiseEqual=function(t){if(this.pts.length!==t.pts.length)return!1;for(var e=0;e<this.pts.length;e++)if(!this.pts[e].equals2D(t.pts[e]))return!1;return!0},e.prototype.setDepthDelta=function(t){this._depthDelta=t},e.prototype.getEdgeIntersectionList=function(){return this.eiList},e.prototype.addIntersections=function(t,e,n){for(var r=0;r<t.getIntersectionNum();r++)this.addIntersection(t,e,n,r)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.updateIM=function(){if(2!==arguments.length)return t.prototype.updateIM.apply(this,arguments);var e=arguments[0],n=arguments[1];n.setAtLeastIfValid(e.getLocation(0,mC.ON),e.getLocation(1,mC.ON),1),e.isArea()&&(n.setAtLeastIfValid(e.getLocation(0,mC.LEFT),e.getLocation(1,mC.LEFT),2),n.setAtLeastIfValid(e.getLocation(0,mC.RIGHT),e.getLocation(1,mC.RIGHT),2))},e}(TC),Zw=function(t){this._workingPrecisionModel=null,this._workingNoder=null,this._geomFact=null,this._graph=null,this._edgeList=new qw,this._bufParams=t||null};Zw.prototype.setWorkingPrecisionModel=function(t){this._workingPrecisionModel=t},Zw.prototype.insertUniqueEdge=function(t){var e=this._edgeList.findEqualEdge(t);if(null!==e){var n=e.getLabel(),r=t.getLabel();e.isPointwiseEqual(t)||(r=new SC(t.getLabel())).flip(),n.merge(r);var i=Zw.depthDelta(r),o=e.getDepthDelta()+i;e.setDepthDelta(o)}else this._edgeList.add(t),t.setDepthDelta(Zw.depthDelta(t.getLabel()))},Zw.prototype.buildSubgraphs=function(t,e){for(var n=new nx,r=t.iterator();r.hasNext();){var i=r.next(),o=i.getRightmostCoordinate(),s=new Lw(n).getDepth(o);i.computeDepth(s),i.findResultEdges(),n.add(i),e.add(i.getDirectedEdges(),i.getNodes())}},Zw.prototype.createSubgraphs=function(t){for(var e=new nx,n=t.getNodes().iterator();n.hasNext();){var r=n.next();if(!r.isVisited()){var i=new bC;i.create(r),e.add(i)}}return JC.sort(e,JC.reverseOrder()),e},Zw.prototype.createEmptyResultGeometry=function(){return this._geomFact.createPolygon()},Zw.prototype.getNoder=function(t){if(null!==this._workingNoder)return this._workingNoder;var e=new yw,n=new DE;return n.setPrecisionModel(t),e.setSegmentIntersector(new zw(n)),e},Zw.prototype.buffer=function(t,e){var n=this._workingPrecisionModel;null===n&&(n=t.getPrecisionModel()),this._geomFact=t.getFactory();var r=new Mw(n,this._bufParams),i=new Qw(t,e,r).getCurves();if(i.size()<=0)return this.createEmptyResultGeometry();this.computeNodedEdges(i,n),this._graph=new GC(new Gw),this._graph.addEdges(this._edgeList.getEdges());var o=this.createSubgraphs(this._graph),s=new UC(this._geomFact);this.buildSubgraphs(o,s);var a=s.getPolygons();return a.size()<=0?this.createEmptyResultGeometry():this._geomFact.buildGeometry(a)},Zw.prototype.computeNodedEdges=function(t,e){var n=this.getNoder(e);n.computeNodes(t);for(var r=n.getNodedSubstrings().iterator();r.hasNext();){var i=r.next(),o=i.getCoordinates();if(2!==o.length||!o[0].equals2D(o[1])){var s=i.getData(),a=new Kw(i.getCoordinates(),new SC(s));this.insertUniqueEdge(a)}}},Zw.prototype.setNoder=function(t){this._workingNoder=t},Zw.prototype.interfaces_=function(){return[]},Zw.prototype.getClass=function(){return Zw},Zw.depthDelta=function(t){var e=t.getLocation(0,mC.LEFT),n=t.getLocation(0,mC.RIGHT);return e===oE.INTERIOR&&n===oE.EXTERIOR?1:e===oE.EXTERIOR&&n===oE.INTERIOR?-1:0},Zw.convertSegStrings=function(t){for(var e=new hC,n=new nx;t.hasNext();){var r=t.next(),i=e.createLineString(r.getCoordinates());n.add(i)}return e.buildGeometry(n)};var $w=function(){if(this._noder=null,this._scaleFactor=null,this._offsetX=null,this._offsetY=null,this._isScaled=!1,2===arguments.length){var t=arguments[0],e=arguments[1];this._noder=t,this._scaleFactor=e,this._offsetX=0,this._offsetY=0,this._isScaled=!this.isIntegerPrecision()}else if(4===arguments.length){var n=arguments[0],r=arguments[1],i=arguments[2],o=arguments[3];this._noder=n,this._scaleFactor=r,this._offsetX=i,this._offsetY=o,this._isScaled=!this.isIntegerPrecision()}};$w.prototype.rescale=function(){var t=this;if(aE(arguments[0],KE))for(var e=arguments[0].iterator();e.hasNext();){var n=e.next();t.rescale(n.getCoordinates())}else if(arguments[0]instanceof Array){for(var r=arguments[0],i=0;i<r.length;i++)r[i].x=r[i].x/t._scaleFactor+t._offsetX,r[i].y=r[i].y/t._scaleFactor+t._offsetY;2===r.length&&r[0].equals2D(r[1])&&IE.out.println(r)}},$w.prototype.scale=function(){var t=this;if(aE(arguments[0],KE)){for(var e=arguments[0],n=new nx,r=e.iterator();r.hasNext();){var i=r.next();n.add(new lw(t.scale(i.getCoordinates()),i.getData()))}return n}if(arguments[0]instanceof Array){for(var o=arguments[0],s=new Array(o.length).fill(null),a=0;a<o.length;a++)s[a]=new eE(Math.round((o[a].x-t._offsetX)*t._scaleFactor),Math.round((o[a].y-t._offsetY)*t._scaleFactor),o[a].z);return ox.removeRepeatedPoints(s)}},$w.prototype.isIntegerPrecision=function(){return 1===this._scaleFactor},$w.prototype.getNodedSubstrings=function(){var t=this._noder.getNodedSubstrings();return this._isScaled&&this.rescale(t),t},$w.prototype.computeNodes=function(t){var e=t;this._isScaled&&(e=this.scale(t)),this._noder.computeNodes(e)},$w.prototype.interfaces_=function(){return[Aw]},$w.prototype.getClass=function(){return $w};var tb=function(){this._li=new DE,this._segStrings=null;var t=arguments[0];this._segStrings=t},eb={fact:{configurable:!0}};tb.prototype.checkEndPtVertexIntersections=function(){var t=this;if(0===arguments.length)for(var e=this._segStrings.iterator();e.hasNext();){var n=e.next().getCoordinates();t.checkEndPtVertexIntersections(n[0],t._segStrings),t.checkEndPtVertexIntersections(n[n.length-1],t._segStrings)}else if(2===arguments.length)for(var r=arguments[0],i=arguments[1].iterator();i.hasNext();)for(var o=i.next().getCoordinates(),s=1;s<o.length-1;s++)if(o[s].equals(r))throw new LE("found endpt/interior pt intersection at index "+s+" :pt "+r)},tb.prototype.checkInteriorIntersections=function(){if(0===arguments.length)for(var t=this._segStrings.iterator();t.hasNext();)for(var e=t.next(),n=this._segStrings.iterator();n.hasNext();){var r=n.next();this.checkInteriorIntersections(e,r)}else if(2===arguments.length)for(var i=arguments[0],o=arguments[1],s=i.getCoordinates(),a=o.getCoordinates(),u=0;u<s.length-1;u++)for(var l=0;l<a.length-1;l++)this.checkInteriorIntersections(i,u,o,l);else if(4===arguments.length){var c=arguments[0],h=arguments[1],f=arguments[2],p=arguments[3];if(c===f&&h===p)return null;var g=c.getCoordinates()[h],A=c.getCoordinates()[h+1],d=f.getCoordinates()[p],y=f.getCoordinates()[p+1];if(this._li.computeIntersection(g,A,d,y),this._li.hasIntersection()&&(this._li.isProper()||this.hasInteriorIntersection(this._li,g,A)||this.hasInteriorIntersection(this._li,d,y)))throw new LE("found non-noded intersection at "+g+"-"+A+" and "+d+"-"+y)}},tb.prototype.checkValid=function(){this.checkEndPtVertexIntersections(),this.checkInteriorIntersections(),this.checkCollapses()},tb.prototype.checkCollapses=function(){if(0===arguments.length)for(var t=this._segStrings.iterator();t.hasNext();){var e=t.next();this.checkCollapses(e)}else if(1===arguments.length)for(var n=arguments[0].getCoordinates(),r=0;r<n.length-2;r++)this.checkCollapse(n[r],n[r+1],n[r+2])},tb.prototype.hasInteriorIntersection=function(t,e,n){for(var r=0;r<t.getIntersectionNum();r++){var i=t.getIntersection(r);if(!i.equals(e)&&!i.equals(n))return!0}return!1},tb.prototype.checkCollapse=function(t,e,n){if(t.equals(n))throw new LE("found non-noded collapse at "+tb.fact.createLineString([t,e,n]))},tb.prototype.interfaces_=function(){return[]},tb.prototype.getClass=function(){return tb},eb.fact.get=function(){return new hC},Object.defineProperties(tb,eb);var nb=function(){this._li=null,this._pt=null,this._originalPt=null,this._ptScaled=null,this._p0Scaled=null,this._p1Scaled=null,this._scaleFactor=null,this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,this._corner=new Array(4).fill(null),this._safeEnv=null;var t=arguments[0],e=arguments[1],n=arguments[2];if(this._originalPt=t,this._pt=t,this._scaleFactor=e,this._li=n,e<=0)throw new XI("Scale factor must be non-zero");1!==e&&(this._pt=new eE(this.scale(t.x),this.scale(t.y)),this._p0Scaled=new eE,this._p1Scaled=new eE),this.initCorners(this._pt)},rb={SAFE_ENV_EXPANSION_FACTOR:{configurable:!0}};nb.prototype.intersectsScaled=function(t,e){var n=Math.min(t.x,e.x),r=Math.max(t.x,e.x),i=Math.min(t.y,e.y),o=Math.max(t.y,e.y),s=this._maxx<n||this._minx>r||this._maxy<i||this._miny>o;if(s)return!1;var a=this.intersectsToleranceSquare(t,e);return TE.isTrue(!(s&&a),"Found bad envelope test"),a},nb.prototype.initCorners=function(t){var e=.5;this._minx=t.x-e,this._maxx=t.x+e,this._miny=t.y-e,this._maxy=t.y+e,this._corner[0]=new eE(this._maxx,this._maxy),this._corner[1]=new eE(this._minx,this._maxy),this._corner[2]=new eE(this._minx,this._miny),this._corner[3]=new eE(this._maxx,this._miny)},nb.prototype.intersects=function(t,e){return 1===this._scaleFactor?this.intersectsScaled(t,e):(this.copyScaled(t,this._p0Scaled),this.copyScaled(e,this._p1Scaled),this.intersectsScaled(this._p0Scaled,this._p1Scaled))},nb.prototype.scale=function(t){return Math.round(t*this._scaleFactor)},nb.prototype.getCoordinate=function(){return this._originalPt},nb.prototype.copyScaled=function(t,e){e.x=this.scale(t.x),e.y=this.scale(t.y)},nb.prototype.getSafeEnvelope=function(){if(null===this._safeEnv){var t=nb.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new xE(this._originalPt.x-t,this._originalPt.x+t,this._originalPt.y-t,this._originalPt.y+t)}return this._safeEnv},nb.prototype.intersectsPixelClosure=function(t,e){return this._li.computeIntersection(t,e,this._corner[0],this._corner[1]),!!this._li.hasIntersection()||(this._li.computeIntersection(t,e,this._corner[1],this._corner[2]),!!this._li.hasIntersection()||(this._li.computeIntersection(t,e,this._corner[2],this._corner[3]),!!this._li.hasIntersection()||(this._li.computeIntersection(t,e,this._corner[3],this._corner[0]),!!this._li.hasIntersection())))},nb.prototype.intersectsToleranceSquare=function(t,e){var n=!1,r=!1;return this._li.computeIntersection(t,e,this._corner[0],this._corner[1]),!!this._li.isProper()||(this._li.computeIntersection(t,e,this._corner[1],this._corner[2]),!!this._li.isProper()||(this._li.hasIntersection()&&(n=!0),this._li.computeIntersection(t,e,this._corner[2],this._corner[3]),!!this._li.isProper()||(this._li.hasIntersection()&&(r=!0),this._li.computeIntersection(t,e,this._corner[3],this._corner[0]),!!this._li.isProper()||(!(!n||!r)||(!!t.equals(this._pt)||!!e.equals(this._pt))))))},nb.prototype.addSnappedNode=function(t,e){var n=t.getCoordinate(e),r=t.getCoordinate(e+1);return!!this.intersects(n,r)&&(t.addIntersection(this.getCoordinate(),e),!0)},nb.prototype.interfaces_=function(){return[]},nb.prototype.getClass=function(){return nb},rb.SAFE_ENV_EXPANSION_FACTOR.get=function(){return.75},Object.defineProperties(nb,rb);var ib=function(){this.tempEnv1=new xE,this.selectedSegment=new cw};ib.prototype.select=function(){if(1===arguments.length);else if(2===arguments.length){var t=arguments[1];arguments[0].getLineSegment(t,this.selectedSegment),this.select(this.selectedSegment)}},ib.prototype.interfaces_=function(){return[]},ib.prototype.getClass=function(){return ib};var ob=function(){this._index=null;var t=arguments[0];this._index=t},sb={HotPixelSnapAction:{configurable:!0}};ob.prototype.snap=function(){if(1===arguments.length){var t=arguments[0];return this.snap(t,null,-1)}if(3===arguments.length){var e=arguments[0],n=arguments[1],r=arguments[2],i=e.getSafeEnvelope(),o=new ab(e,n,r);return this._index.query(i,{interfaces_:function(){return[VC]},visitItem:function(t){t.select(i,o)}}),o.isNodeAdded()}},ob.prototype.interfaces_=function(){return[]},ob.prototype.getClass=function(){return ob},sb.HotPixelSnapAction.get=function(){return ab},Object.defineProperties(ob,sb);var ab=function(t){function e(){t.call(this),this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var e=arguments[0],n=arguments[1],r=arguments[2];this._hotPixel=e,this._parentEdge=n,this._hotPixelVertexIndex=r}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.isNodeAdded=function(){return this._isNodeAdded},e.prototype.select=function(){if(2!==arguments.length)return t.prototype.select.apply(this,arguments);var e=arguments[1],n=arguments[0].getContext();if(null!==this._parentEdge&&n===this._parentEdge&&e===this._hotPixelVertexIndex)return null;this._isNodeAdded=this._hotPixel.addSnappedNode(n,e)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(ib),ub=function(){this._li=null,this._interiorIntersections=null;var t=arguments[0];this._li=t,this._interiorIntersections=new nx};ub.prototype.processIntersections=function(t,e,n,r){if(t===n&&e===r)return null;var i=t.getCoordinates()[e],o=t.getCoordinates()[e+1],s=n.getCoordinates()[r],a=n.getCoordinates()[r+1];if(this._li.computeIntersection(i,o,s,a),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var u=0;u<this._li.getIntersectionNum();u++)this._interiorIntersections.add(this._li.getIntersection(u));t.addIntersections(this._li,e,0),n.addIntersections(this._li,r,1)}},ub.prototype.isDone=function(){return!1},ub.prototype.getInteriorIntersections=function(){return this._interiorIntersections},ub.prototype.interfaces_=function(){return[jw]},ub.prototype.getClass=function(){return ub};var lb=function(){this._pm=null,this._li=null,this._scaleFactor=null,this._noder=null,this._pointSnapper=null,this._nodedSegStrings=null;var t=arguments[0];this._pm=t,this._li=new DE,this._li.setPrecisionModel(t),this._scaleFactor=t.getScale()};lb.prototype.checkCorrectness=function(t){var e=lw.getNodedSubstrings(t),n=new tb(e);try{n.checkValid()}catch(t){if(!(t instanceof mE))throw t;t.printStackTrace()}},lb.prototype.getNodedSubstrings=function(){return lw.getNodedSubstrings(this._nodedSegStrings)},lb.prototype.snapRound=function(t,e){var n=this.findInteriorIntersections(t,e);this.computeIntersectionSnaps(n),this.computeVertexSnaps(t)},lb.prototype.findInteriorIntersections=function(t,e){var n=new ub(e);return this._noder.setSegmentIntersector(n),this._noder.computeNodes(t),n.getInteriorIntersections()},lb.prototype.computeVertexSnaps=function(){var t=this;if(aE(arguments[0],KE))for(var e=arguments[0].iterator();e.hasNext();){var n=e.next();t.computeVertexSnaps(n)}else if(arguments[0]instanceof lw)for(var r=arguments[0],i=r.getCoordinates(),o=0;o<i.length;o++){var s=new nb(i[o],t._scaleFactor,t._li);t._pointSnapper.snap(s,r,o)&&r.addIntersection(i[o],o)}},lb.prototype.computeNodes=function(t){this._nodedSegStrings=t,this._noder=new yw,this._pointSnapper=new ob(this._noder.getIndex()),this.snapRound(t,this._li)},lb.prototype.computeIntersectionSnaps=function(t){for(var e=this,n=t.iterator();n.hasNext();){var r=n.next(),i=new nb(r,e._scaleFactor,e._li);e._pointSnapper.snap(i)}},lb.prototype.interfaces_=function(){return[Aw]},lb.prototype.getClass=function(){return lb};var cb=function(){if(this._argGeom=null,this._distance=null,this._bufParams=new mw,this._resultGeometry=null,this._saveException=null,1===arguments.length){var t=arguments[0];this._argGeom=t}else if(2===arguments.length){var e=arguments[0],n=arguments[1];this._argGeom=e,this._bufParams=n}},hb={CAP_ROUND:{configurable:!0},CAP_BUTT:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},MAX_PRECISION_DIGITS:{configurable:!0}};cb.prototype.bufferFixedPrecision=function(t){var e=new $w(new lb(new aC(1)),t.getScale()),n=new Zw(this._bufParams);n.setWorkingPrecisionModel(t),n.setNoder(e),this._resultGeometry=n.buffer(this._argGeom,this._distance)},cb.prototype.bufferReducedPrecision=function(){var t=this;if(0===arguments.length){for(var e=cb.MAX_PRECISION_DIGITS;e>=0;e--){try{t.bufferReducedPrecision(e)}catch(e){if(!(e instanceof CC))throw e;t._saveException=e}if(null!==t._resultGeometry)return null}throw this._saveException}if(1===arguments.length){var n=arguments[0],r=cb.precisionScaleFactor(this._argGeom,this._distance,n),i=new aC(r);this.bufferFixedPrecision(i)}},cb.prototype.computeGeometry=function(){if(this.bufferOriginalPrecision(),null!==this._resultGeometry)return null;var t=this._argGeom.getFactory().getPrecisionModel();t.getType()===aC.FIXED?this.bufferFixedPrecision(t):this.bufferReducedPrecision()},cb.prototype.setQuadrantSegments=function(t){this._bufParams.setQuadrantSegments(t)},cb.prototype.bufferOriginalPrecision=function(){try{var t=new Zw(this._bufParams);this._resultGeometry=t.buffer(this._argGeom,this._distance)}catch(t){if(!(t instanceof LE))throw t;this._saveException=t}},cb.prototype.getResultGeometry=function(t){return this._distance=t,this.computeGeometry(),this._resultGeometry},cb.prototype.setEndCapStyle=function(t){this._bufParams.setEndCapStyle(t)},cb.prototype.interfaces_=function(){return[]},cb.prototype.getClass=function(){return cb},cb.bufferOp=function(){if(2===arguments.length){var t=arguments[1];return new cb(arguments[0]).getResultGeometry(t)}if(3===arguments.length){if(Number.isInteger(arguments[2])&&arguments[0]instanceof UE&&"number"==typeof arguments[1]){var e=arguments[1],n=arguments[2],r=new cb(arguments[0]);return r.setQuadrantSegments(n),r.getResultGeometry(e)}if(arguments[2]instanceof mw&&arguments[0]instanceof UE&&"number"==typeof arguments[1]){var i=arguments[1];return new cb(arguments[0],arguments[2]).getResultGeometry(i)}}else if(4===arguments.length){var o=arguments[1],s=arguments[2],a=arguments[3],u=new cb(arguments[0]);return u.setQuadrantSegments(s),u.setEndCapStyle(a),u.getResultGeometry(o)}},cb.precisionScaleFactor=function(t,e,n){var r=t.getEnvelopeInternal(),i=uE.max(Math.abs(r.getMaxX()),Math.abs(r.getMaxY()),Math.abs(r.getMinX()),Math.abs(r.getMinY()))+2*(e>0?e:0),o=n-Math.trunc(Math.log(i)/Math.log(10)+1);return Math.pow(10,o)},hb.CAP_ROUND.get=function(){return mw.CAP_ROUND},hb.CAP_BUTT.get=function(){return mw.CAP_FLAT},hb.CAP_FLAT.get=function(){return mw.CAP_FLAT},hb.CAP_SQUARE.get=function(){return mw.CAP_SQUARE},hb.MAX_PRECISION_DIGITS.get=function(){return 12},Object.defineProperties(cb,hb);var fb=function(){this._pt=[new eE,new eE],this._distance=JI.NaN,this._isNull=!0};fb.prototype.getCoordinates=function(){return this._pt},fb.prototype.getCoordinate=function(t){return this._pt[t]},fb.prototype.setMinimum=function(){if(1===arguments.length){var t=arguments[0];this.setMinimum(t._pt[0],t._pt[1])}else if(2===arguments.length){var e=arguments[0],n=arguments[1];if(this._isNull)return this.initialize(e,n),null;var r=e.distance(n);r<this._distance&&this.initialize(e,n,r)}},fb.prototype.initialize=function(){if(0===arguments.length)this._isNull=!0;else if(2===arguments.length){var t=arguments[0],e=arguments[1];this._pt[0].setCoordinate(t),this._pt[1].setCoordinate(e),this._distance=t.distance(e),this._isNull=!1}else if(3===arguments.length){var n=arguments[0],r=arguments[1],i=arguments[2];this._pt[0].setCoordinate(n),this._pt[1].setCoordinate(r),this._distance=i,this._isNull=!1}},fb.prototype.getDistance=function(){return this._distance},fb.prototype.setMaximum=function(){if(1===arguments.length){var t=arguments[0];this.setMaximum(t._pt[0],t._pt[1])}else if(2===arguments.length){var e=arguments[0],n=arguments[1];if(this._isNull)return this.initialize(e,n),null;var r=e.distance(n);r>this._distance&&this.initialize(e,n,r)}},fb.prototype.interfaces_=function(){return[]},fb.prototype.getClass=function(){return fb};var pb=function(){};pb.prototype.interfaces_=function(){return[]},pb.prototype.getClass=function(){return pb},pb.computeDistance=function(){if(arguments[2]instanceof fb&&arguments[0]instanceof jx&&arguments[1]instanceof eE)for(var t=arguments[1],e=arguments[2],n=arguments[0].getCoordinates(),r=new cw,i=0;i<n.length-1;i++){r.setCoordinates(n[i],n[i+1]);var o=r.closestPoint(t);e.setMinimum(o,t)}else if(arguments[2]instanceof fb&&arguments[0]instanceof Hx&&arguments[1]instanceof eE){var s=arguments[0],a=arguments[1],u=arguments[2];pb.computeDistance(s.getExteriorRing(),a,u);for(var l=0;l<s.getNumInteriorRing();l++)pb.computeDistance(s.getInteriorRingN(l),a,u)}else if(arguments[2]instanceof fb&&arguments[0]instanceof UE&&arguments[1]instanceof eE){var c=arguments[0],h=arguments[1],f=arguments[2];if(c instanceof jx)pb.computeDistance(c,h,f);else if(c instanceof Hx)pb.computeDistance(c,h,f);else if(c instanceof Lx)for(var p=c,g=0;g<p.getNumGeometries();g++){var A=p.getGeometryN(g);pb.computeDistance(A,h,f)}else f.setMinimum(c.getCoordinate(),h)}else if(arguments[2]instanceof fb&&arguments[0]instanceof cw&&arguments[1]instanceof eE){var d=arguments[1],y=arguments[2],v=arguments[0].closestPoint(d);y.setMinimum(v,d)}};var gb=function(t){this._maxPtDist=new fb,this._inputGeom=t||null},Ab={MaxPointDistanceFilter:{configurable:!0},MaxMidpointDistanceFilter:{configurable:!0}};gb.prototype.computeMaxMidpointDistance=function(t){var e=new yb(this._inputGeom);t.apply(e),this._maxPtDist.setMaximum(e.getMaxPointDistance())},gb.prototype.computeMaxVertexDistance=function(t){var e=new db(this._inputGeom);t.apply(e),this._maxPtDist.setMaximum(e.getMaxPointDistance())},gb.prototype.findDistance=function(t){return this.computeMaxVertexDistance(t),this.computeMaxMidpointDistance(t),this._maxPtDist.getDistance()},gb.prototype.getDistancePoints=function(){return this._maxPtDist},gb.prototype.interfaces_=function(){return[]},gb.prototype.getClass=function(){return gb},Ab.MaxPointDistanceFilter.get=function(){return db},Ab.MaxMidpointDistanceFilter.get=function(){return yb},Object.defineProperties(gb,Ab);var db=function(t){this._maxPtDist=new fb,this._minPtDist=new fb,this._geom=t||null};db.prototype.filter=function(t){this._minPtDist.initialize(),pb.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},db.prototype.getMaxPointDistance=function(){return this._maxPtDist},db.prototype.interfaces_=function(){return[zE]},db.prototype.getClass=function(){return db};var yb=function(t){this._maxPtDist=new fb,this._minPtDist=new fb,this._geom=t||null};yb.prototype.filter=function(t,e){if(0===e)return null;var n=t.getCoordinate(e-1),r=t.getCoordinate(e),i=new eE((n.x+r.x)/2,(n.y+r.y)/2);this._minPtDist.initialize(),pb.computeDistance(this._geom,i,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},yb.prototype.isDone=function(){return!1},yb.prototype.isGeometryChanged=function(){return!1},yb.prototype.getMaxPointDistance=function(){return this._maxPtDist},yb.prototype.interfaces_=function(){return[Mx]},yb.prototype.getClass=function(){return yb};var vb=function(t){this._comps=t||null};vb.prototype.filter=function(t){t instanceof Hx&&this._comps.add(t)},vb.prototype.interfaces_=function(){return[Sx]},vb.prototype.getClass=function(){return vb},vb.getPolygons=function(){if(1===arguments.length)return vb.getPolygons(arguments[0],new nx);if(2===arguments.length){var t=arguments[0],e=arguments[1];return t instanceof Hx?e.add(t):t instanceof Lx&&t.apply(new vb(e)),e}};var mb=function(){if(this._lines=null,this._isForcedToLineString=!1,1===arguments.length){var t=arguments[0];this._lines=t}else if(2===arguments.length){var e=arguments[0],n=arguments[1];this._lines=e,this._isForcedToLineString=n}};mb.prototype.filter=function(t){if(this._isForcedToLineString&&t instanceof Jx){var e=t.getFactory().createLineString(t.getCoordinateSequence());return this._lines.add(e),null}t instanceof jx&&this._lines.add(t)},mb.prototype.setForceToLineString=function(t){this._isForcedToLineString=t},mb.prototype.interfaces_=function(){return[GE]},mb.prototype.getClass=function(){return mb},mb.getGeometry=function(){if(1===arguments.length){var t=arguments[0];return t.getFactory().buildGeometry(mb.getLines(t))}if(2===arguments.length){var e=arguments[0],n=arguments[1];return e.getFactory().buildGeometry(mb.getLines(e,n))}},mb.getLines=function(){if(1===arguments.length)return mb.getLines(arguments[0],!1);if(2===arguments.length){if(aE(arguments[0],KE)&&aE(arguments[1],KE)){for(var t=arguments[1],e=arguments[0].iterator();e.hasNext();){var n=e.next();mb.getLines(n,t)}return t}if(arguments[0]instanceof UE&&"boolean"==typeof arguments[1]){var r=arguments[0],i=arguments[1],o=new nx;return r.apply(new mb(o,i)),o}if(arguments[0]instanceof UE&&aE(arguments[1],KE)){var s=arguments[0],a=arguments[1];return s instanceof jx?a.add(s):s.apply(new mb(a)),a}}else if(3===arguments.length){if("boolean"==typeof arguments[2]&&aE(arguments[0],KE)&&aE(arguments[1],KE)){for(var u=arguments[1],l=arguments[2],c=arguments[0].iterator();c.hasNext();){var h=c.next();mb.getLines(h,u,l)}return u}if("boolean"==typeof arguments[2]&&arguments[0]instanceof UE&&aE(arguments[1],KE)){var f=arguments[1],p=arguments[2];return arguments[0].apply(new mb(f,p)),f}}};var _b=function(){if(this._boundaryRule=VE.OGC_SFS_BOUNDARY_RULE,this._isIn=null,this._numBoundaries=null,0===arguments.length);else if(1===arguments.length){var t=arguments[0];if(null===t)throw new XI("Rule must be non-null");this._boundaryRule=t}};_b.prototype.locateInternal=function(){if(arguments[0]instanceof eE&&arguments[1]instanceof Hx){var t=arguments[0],e=arguments[1];if(e.isEmpty())return oE.EXTERIOR;var n=e.getExteriorRing(),r=this.locateInPolygonRing(t,n);if(r===oE.EXTERIOR)return oE.EXTERIOR;if(r===oE.BOUNDARY)return oE.BOUNDARY;for(var i=0;i<e.getNumInteriorRing();i++){var o=e.getInteriorRingN(i),s=this.locateInPolygonRing(t,o);if(s===oE.INTERIOR)return oE.EXTERIOR;if(s===oE.BOUNDARY)return oE.BOUNDARY}return oE.INTERIOR}if(arguments[0]instanceof eE&&arguments[1]instanceof jx){var a=arguments[0],u=arguments[1];if(!u.getEnvelopeInternal().intersects(a))return oE.EXTERIOR;var l=u.getCoordinates();return u.isClosed()||!a.equals(l[0])&&!a.equals(l[l.length-1])?OE.isOnLine(a,l)?oE.INTERIOR:oE.EXTERIOR:oE.BOUNDARY}if(arguments[0]instanceof eE&&arguments[1]instanceof Vx){var c=arguments[0];return arguments[1].getCoordinate().equals2D(c)?oE.INTERIOR:oE.EXTERIOR}},_b.prototype.locateInPolygonRing=function(t,e){return e.getEnvelopeInternal().intersects(t)?OE.locatePointInRing(t,e.getCoordinates()):oE.EXTERIOR},_b.prototype.intersects=function(t,e){return this.locate(t,e)!==oE.EXTERIOR},_b.prototype.updateLocationInfo=function(t){t===oE.INTERIOR&&(this._isIn=!0),t===oE.BOUNDARY&&this._numBoundaries++},_b.prototype.computeLocation=function(t,e){var n=this;if(e instanceof Vx&&this.updateLocationInfo(this.locateInternal(t,e)),e instanceof jx)this.updateLocationInfo(this.locateInternal(t,e));else if(e instanceof Hx)this.updateLocationInfo(this.locateInternal(t,e));else if(e instanceof Nx)for(var r=e,i=0;i<r.getNumGeometries();i++){var o=r.getGeometryN(i);n.updateLocationInfo(n.locateInternal(t,o))}else if(e instanceof Wx)for(var s=e,a=0;a<s.getNumGeometries();a++){var u=s.getGeometryN(a);n.updateLocationInfo(n.locateInternal(t,u))}else if(e instanceof Lx)for(var l=new Pw(e);l.hasNext();){var c=l.next();c!==e&&n.computeLocation(t,c)}},_b.prototype.locate=function(t,e){return e.isEmpty()?oE.EXTERIOR:e instanceof jx||e instanceof Hx?this.locateInternal(t,e):(this._isIn=!1,this._numBoundaries=0,this.computeLocation(t,e),this._boundaryRule.isInBoundary(this._numBoundaries)?oE.BOUNDARY:this._numBoundaries>0||this._isIn?oE.INTERIOR:oE.EXTERIOR)},_b.prototype.interfaces_=function(){return[]},_b.prototype.getClass=function(){return _b};var Ib=function t(){if(this._component=null,this._segIndex=null,this._pt=null,2===arguments.length)t.call(this,arguments[0],t.INSIDE_AREA,arguments[1]);else if(3===arguments.length){var e=arguments[0],n=arguments[1],r=arguments[2];this._component=e,this._segIndex=n,this._pt=r}},Eb={INSIDE_AREA:{configurable:!0}};Ib.prototype.isInsideArea=function(){return this._segIndex===Ib.INSIDE_AREA},Ib.prototype.getCoordinate=function(){return this._pt},Ib.prototype.getGeometryComponent=function(){return this._component},Ib.prototype.getSegmentIndex=function(){return this._segIndex},Ib.prototype.interfaces_=function(){return[]},Ib.prototype.getClass=function(){return Ib},Eb.INSIDE_AREA.get=function(){return-1},Object.defineProperties(Ib,Eb);var xb=function(t){this._pts=t||null};xb.prototype.filter=function(t){t instanceof Vx&&this._pts.add(t)},xb.prototype.interfaces_=function(){return[Sx]},xb.prototype.getClass=function(){return xb},xb.getPoints=function(){if(1===arguments.length){var t=arguments[0];return t instanceof Vx?JC.singletonList(t):xb.getPoints(t,new nx)}if(2===arguments.length){var e=arguments[0],n=arguments[1];return e instanceof Vx?n.add(e):e instanceof Lx&&e.apply(new xb(n)),n}};var Cb=function(){this._locations=null;var t=arguments[0];this._locations=t};Cb.prototype.filter=function(t){(t instanceof Vx||t instanceof jx||t instanceof Hx)&&this._locations.add(new Ib(t,0,t.getCoordinate()))},Cb.prototype.interfaces_=function(){return[Sx]},Cb.prototype.getClass=function(){return Cb},Cb.getLocations=function(t){var e=new nx;return t.apply(new Cb(e)),e};var wb=function(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new _b,this._minDistanceLocation=null,this._minDistance=JI.MAX_VALUE,2===arguments.length){var t=arguments[0],e=arguments[1];this._geom=[t,e],this._terminateDistance=0}else if(3===arguments.length){var n=arguments[0],r=arguments[1],i=arguments[2];this._geom=new Array(2).fill(null),this._geom[0]=n,this._geom[1]=r,this._terminateDistance=i}};wb.prototype.computeContainmentDistance=function(){var t=this;if(0===arguments.length){var e=new Array(2).fill(null);if(this.computeContainmentDistance(0,e),this._minDistance<=this._terminateDistance)return null;this.computeContainmentDistance(1,e)}else if(2===arguments.length){var n=arguments[0],r=arguments[1],i=1-n,o=vb.getPolygons(this._geom[n]);if(o.size()>0){var s=Cb.getLocations(this._geom[i]);if(this.computeContainmentDistance(s,o,r),this._minDistance<=this._terminateDistance)return this._minDistanceLocation[i]=r[0],this._minDistanceLocation[n]=r[1],null}}else if(3===arguments.length)if(arguments[2]instanceof Array&&aE(arguments[0],tx)&&aE(arguments[1],tx)){for(var a=arguments[0],u=arguments[1],l=arguments[2],c=0;c<a.size();c++)for(var h=a.get(c),f=0;f<u.size();f++)if(t.computeContainmentDistance(h,u.get(f),l),t._minDistance<=t._terminateDistance)return null}else if(arguments[2]instanceof Array&&arguments[0]instanceof Ib&&arguments[1]instanceof Hx){var p=arguments[0],g=arguments[1],A=arguments[2],d=p.getCoordinate();if(oE.EXTERIOR!==this._ptLocator.locate(d,g))return this._minDistance=0,A[0]=p,A[1]=new Ib(g,d),null}},wb.prototype.computeMinDistanceLinesPoints=function(t,e,n){for(var r=this,i=0;i<t.size();i++)for(var o=t.get(i),s=0;s<e.size();s++){var a=e.get(s);if(r.computeMinDistance(o,a,n),r._minDistance<=r._terminateDistance)return null}},wb.prototype.computeFacetDistance=function(){var t=new Array(2).fill(null),e=mb.getLines(this._geom[0]),n=mb.getLines(this._geom[1]),r=xb.getPoints(this._geom[0]),i=xb.getPoints(this._geom[1]);return this.computeMinDistanceLines(e,n,t),this.updateMinDistance(t,!1),this._minDistance<=this._terminateDistance?null:(t[0]=null,t[1]=null,this.computeMinDistanceLinesPoints(e,i,t),this.updateMinDistance(t,!1),this._minDistance<=this._terminateDistance?null:(t[0]=null,t[1]=null,this.computeMinDistanceLinesPoints(n,r,t),this.updateMinDistance(t,!0),this._minDistance<=this._terminateDistance?null:(t[0]=null,t[1]=null,this.computeMinDistancePoints(r,i,t),void this.updateMinDistance(t,!1))))},wb.prototype.nearestLocations=function(){return this.computeMinDistance(),this._minDistanceLocation},wb.prototype.updateMinDistance=function(t,e){if(null===t[0])return null;e?(this._minDistanceLocation[0]=t[1],this._minDistanceLocation[1]=t[0]):(this._minDistanceLocation[0]=t[0],this._minDistanceLocation[1]=t[1])},wb.prototype.nearestPoints=function(){return this.computeMinDistance(),[this._minDistanceLocation[0].getCoordinate(),this._minDistanceLocation[1].getCoordinate()]},wb.prototype.computeMinDistance=function(){var t=this;if(0===arguments.length){if(null!==this._minDistanceLocation)return null;if(this._minDistanceLocation=new Array(2).fill(null),this.computeContainmentDistance(),this._minDistance<=this._terminateDistance)return null;this.computeFacetDistance()}else if(3===arguments.length)if(arguments[2]instanceof Array&&arguments[0]instanceof jx&&arguments[1]instanceof Vx){var e=arguments[0],n=arguments[1],r=arguments[2];if(e.getEnvelopeInternal().distance(n.getEnvelopeInternal())>this._minDistance)return null;for(var i=e.getCoordinates(),o=n.getCoordinate(),s=0;s<i.length-1;s++){var a=OE.distancePointLine(o,i[s],i[s+1]);if(a<t._minDistance){t._minDistance=a;var u=new cw(i[s],i[s+1]).closestPoint(o);r[0]=new Ib(e,s,u),r[1]=new Ib(n,0,o)}if(t._minDistance<=t._terminateDistance)return null}}else if(arguments[2]instanceof Array&&arguments[0]instanceof jx&&arguments[1]instanceof jx){var l=arguments[0],c=arguments[1],h=arguments[2];if(l.getEnvelopeInternal().distance(c.getEnvelopeInternal())>this._minDistance)return null;for(var f=l.getCoordinates(),p=c.getCoordinates(),g=0;g<f.length-1;g++)for(var A=0;A<p.length-1;A++){var d=OE.distanceLineLine(f[g],f[g+1],p[A],p[A+1]);if(d<t._minDistance){t._minDistance=d;var y=new cw(f[g],f[g+1]),v=new cw(p[A],p[A+1]),m=y.closestPoints(v);h[0]=new Ib(l,g,m[0]),h[1]=new Ib(c,A,m[1])}if(t._minDistance<=t._terminateDistance)return null}}},wb.prototype.computeMinDistancePoints=function(t,e,n){for(var r=this,i=0;i<t.size();i++)for(var o=t.get(i),s=0;s<e.size();s++){var a=e.get(s),u=o.getCoordinate().distance(a.getCoordinate());if(u<r._minDistance&&(r._minDistance=u,n[0]=new Ib(o,0,o.getCoordinate()),n[1]=new Ib(a,0,a.getCoordinate())),r._minDistance<=r._terminateDistance)return null}},wb.prototype.distance=function(){if(null===this._geom[0]||null===this._geom[1])throw new XI("null geometries are not supported");return this._geom[0].isEmpty()||this._geom[1].isEmpty()?0:(this.computeMinDistance(),this._minDistance)},wb.prototype.computeMinDistanceLines=function(t,e,n){for(var r=this,i=0;i<t.size();i++)for(var o=t.get(i),s=0;s<e.size();s++){var a=e.get(s);if(r.computeMinDistance(o,a,n),r._minDistance<=r._terminateDistance)return null}},wb.prototype.interfaces_=function(){return[]},wb.prototype.getClass=function(){return wb},wb.distance=function(t,e){return new wb(t,e).distance()},wb.isWithinDistance=function(t,e,n){return new wb(t,e,n).distance()<=n},wb.nearestPoints=function(t,e){return new wb(t,e).nearestPoints()};var bb=function(){this._pt=[new eE,new eE],this._distance=JI.NaN,this._isNull=!0};bb.prototype.getCoordinates=function(){return this._pt},bb.prototype.getCoordinate=function(t){return this._pt[t]},bb.prototype.setMinimum=function(){if(1===arguments.length){var t=arguments[0];this.setMinimum(t._pt[0],t._pt[1])}else if(2===arguments.length){var e=arguments[0],n=arguments[1];if(this._isNull)return this.initialize(e,n),null;var r=e.distance(n);r<this._distance&&this.initialize(e,n,r)}},bb.prototype.initialize=function(){if(0===arguments.length)this._isNull=!0;else if(2===arguments.length){var t=arguments[0],e=arguments[1];this._pt[0].setCoordinate(t),this._pt[1].setCoordinate(e),this._distance=t.distance(e),this._isNull=!1}else if(3===arguments.length){var n=arguments[0],r=arguments[1],i=arguments[2];this._pt[0].setCoordinate(n),this._pt[1].setCoordinate(r),this._distance=i,this._isNull=!1}},bb.prototype.toString=function(){return ME.toLineString(this._pt[0],this._pt[1])},bb.prototype.getDistance=function(){return this._distance},bb.prototype.setMaximum=function(){if(1===arguments.length){var t=arguments[0];this.setMaximum(t._pt[0],t._pt[1])}else if(2===arguments.length){var e=arguments[0],n=arguments[1];if(this._isNull)return this.initialize(e,n),null;var r=e.distance(n);r>this._distance&&this.initialize(e,n,r)}},bb.prototype.interfaces_=function(){return[]},bb.prototype.getClass=function(){return bb};var Bb=function(){};Bb.prototype.interfaces_=function(){return[]},Bb.prototype.getClass=function(){return Bb},Bb.computeDistance=function(){if(arguments[2]instanceof bb&&arguments[0]instanceof jx&&arguments[1]instanceof eE)for(var t=arguments[0],e=arguments[1],n=arguments[2],r=new cw,i=t.getCoordinates(),o=0;o<i.length-1;o++){r.setCoordinates(i[o],i[o+1]);var s=r.closestPoint(e);n.setMinimum(s,e)}else if(arguments[2]instanceof bb&&arguments[0]instanceof Hx&&arguments[1]instanceof eE){var a=arguments[0],u=arguments[1],l=arguments[2];Bb.computeDistance(a.getExteriorRing(),u,l);for(var c=0;c<a.getNumInteriorRing();c++)Bb.computeDistance(a.getInteriorRingN(c),u,l)}else if(arguments[2]instanceof bb&&arguments[0]instanceof UE&&arguments[1]instanceof eE){var h=arguments[0],f=arguments[1],p=arguments[2];if(h instanceof jx)Bb.computeDistance(h,f,p);else if(h instanceof Hx)Bb.computeDistance(h,f,p);else if(h instanceof Lx)for(var g=h,A=0;A<g.getNumGeometries();A++){var d=g.getGeometryN(A);Bb.computeDistance(d,f,p)}else p.setMinimum(h.getCoordinate(),f)}else if(arguments[2]instanceof bb&&arguments[0]instanceof cw&&arguments[1]instanceof eE){var y=arguments[1],v=arguments[2],m=arguments[0].closestPoint(y);v.setMinimum(m,y)}};var Sb=function(){this._g0=null,this._g1=null,this._ptDist=new bb,this._densifyFrac=0;var t=arguments[0],e=arguments[1];this._g0=t,this._g1=e},Mb={MaxPointDistanceFilter:{configurable:!0},MaxDensifiedByFractionDistanceFilter:{configurable:!0}};Sb.prototype.getCoordinates=function(){return this._ptDist.getCoordinates()},Sb.prototype.setDensifyFraction=function(t){if(t>1||t<=0)throw new XI("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=t},Sb.prototype.compute=function(t,e){this.computeOrientedDistance(t,e,this._ptDist),this.computeOrientedDistance(e,t,this._ptDist)},Sb.prototype.distance=function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()},Sb.prototype.computeOrientedDistance=function(t,e,n){var r=new Lb(e);if(t.apply(r),n.setMaximum(r.getMaxPointDistance()),this._densifyFrac>0){var i=new Nb(e,this._densifyFrac);t.apply(i),n.setMaximum(i.getMaxPointDistance())}},Sb.prototype.orientedDistance=function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()},Sb.prototype.interfaces_=function(){return[]},Sb.prototype.getClass=function(){return Sb},Sb.distance=function(){if(2===arguments.length)return new Sb(arguments[0],arguments[1]).distance();if(3===arguments.length){var t=arguments[2],e=new Sb(arguments[0],arguments[1]);return e.setDensifyFraction(t),e.distance()}},Mb.MaxPointDistanceFilter.get=function(){return Lb},Mb.MaxDensifiedByFractionDistanceFilter.get=function(){return Nb},Object.defineProperties(Sb,Mb);var Lb=function(){this._maxPtDist=new bb,this._minPtDist=new bb,this._euclideanDist=new Bb,this._geom=null;var t=arguments[0];this._geom=t};Lb.prototype.filter=function(t){this._minPtDist.initialize(),Bb.computeDistance(this._geom,t,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},Lb.prototype.getMaxPointDistance=function(){return this._maxPtDist},Lb.prototype.interfaces_=function(){return[zE]},Lb.prototype.getClass=function(){return Lb};var Nb=function(){this._maxPtDist=new bb,this._minPtDist=new bb,this._geom=null,this._numSubSegs=0;var t=arguments[0],e=arguments[1];this._geom=t,this._numSubSegs=Math.trunc(Math.round(1/e))};Nb.prototype.filter=function(t,e){var n=this;if(0===e)return null;for(var r=t.getCoordinate(e-1),i=t.getCoordinate(e),o=(i.x-r.x)/this._numSubSegs,s=(i.y-r.y)/this._numSubSegs,a=0;a<this._numSubSegs;a++){var u=r.x+a*o,l=r.y+a*s,c=new eE(u,l);n._minPtDist.initialize(),Bb.computeDistance(n._geom,c,n._minPtDist),n._maxPtDist.setMaximum(n._minPtDist)}},Nb.prototype.isDone=function(){return!1},Nb.prototype.isGeometryChanged=function(){return!1},Nb.prototype.getMaxPointDistance=function(){return this._maxPtDist},Nb.prototype.interfaces_=function(){return[Mx]},Nb.prototype.getClass=function(){return Nb};var Tb=function(t,e,n){this._minValidDistance=null,this._maxValidDistance=null,this._minDistanceFound=null,this._maxDistanceFound=null,this._isValid=!0,this._errMsg=null,this._errorLocation=null,this._errorIndicator=null,this._input=t||null,this._bufDistance=e||null,this._result=n||null},Rb={VERBOSE:{configurable:!0},MAX_DISTANCE_DIFF_FRAC:{configurable:!0}};Tb.prototype.checkMaximumDistance=function(t,e,n){var r=new Sb(e,t);if(r.setDensifyFraction(.25),this._maxDistanceFound=r.orientedDistance(),this._maxDistanceFound>n){this._isValid=!1;var i=r.getCoordinates();this._errorLocation=i[1],this._errorIndicator=t.getFactory().createLineString(i),this._errMsg="Distance between buffer curve and input is too large ("+this._maxDistanceFound+" at "+ME.toLineString(i[0],i[1])+")"}},Tb.prototype.isValid=function(){var t=Math.abs(this._bufDistance),e=Tb.MAX_DISTANCE_DIFF_FRAC*t;return this._minValidDistance=t-e,this._maxValidDistance=t+e,!(!this._input.isEmpty()&&!this._result.isEmpty())||(this._bufDistance>0?this.checkPositiveValid():this.checkNegativeValid(),Tb.VERBOSE&&IE.out.println("Min Dist= "+this._minDistanceFound+" err= "+(1-this._minDistanceFound/this._bufDistance)+" Max Dist= "+this._maxDistanceFound+" err= "+(this._maxDistanceFound/this._bufDistance-1)),this._isValid)},Tb.prototype.checkNegativeValid=function(){if(!(this._input instanceof Hx||this._input instanceof Wx||this._input instanceof Lx))return null;var t=this.getPolygonLines(this._input);if(this.checkMinimumDistance(t,this._result,this._minValidDistance),!this._isValid)return null;this.checkMaximumDistance(t,this._result,this._maxValidDistance)},Tb.prototype.getErrorIndicator=function(){return this._errorIndicator},Tb.prototype.checkMinimumDistance=function(t,e,n){var r=new wb(t,e,n);if(this._minDistanceFound=r.distance(),this._minDistanceFound<n){this._isValid=!1;var i=r.nearestPoints();this._errorLocation=r.nearestPoints()[1],this._errorIndicator=t.getFactory().createLineString(i),this._errMsg="Distance between buffer curve and input is too small ("+this._minDistanceFound+" at "+ME.toLineString(i[0],i[1])+" )"}},Tb.prototype.checkPositiveValid=function(){var t=this._result.getBoundary();if(this.checkMinimumDistance(this._input,t,this._minValidDistance),!this._isValid)return null;this.checkMaximumDistance(this._input,t,this._maxValidDistance)},Tb.prototype.getErrorLocation=function(){return this._errorLocation},Tb.prototype.getPolygonLines=function(t){for(var e=new nx,n=new mb(e),r=vb.getPolygons(t).iterator();r.hasNext();){r.next().apply(n)}return t.getFactory().buildGeometry(e)},Tb.prototype.getErrorMessage=function(){return this._errMsg},Tb.prototype.interfaces_=function(){return[]},Tb.prototype.getClass=function(){return Tb},Rb.VERBOSE.get=function(){return!1},Rb.MAX_DISTANCE_DIFF_FRAC.get=function(){return.012},Object.defineProperties(Tb,Rb);var Qb=function(t,e,n){this._isValid=!0,this._errorMsg=null,this._errorLocation=null,this._errorIndicator=null,this._input=t||null,this._distance=e||null,this._result=n||null},Db={VERBOSE:{configurable:!0},MAX_ENV_DIFF_FRAC:{configurable:!0}};Qb.prototype.isValid=function(){return this.checkPolygonal(),this._isValid?(this.checkExpectedEmpty(),this._isValid?(this.checkEnvelope(),this._isValid?(this.checkArea(),this._isValid?(this.checkDistance(),this._isValid):this._isValid):this._isValid):this._isValid):this._isValid},Qb.prototype.checkEnvelope=function(){if(this._distance<0)return null;var t=this._distance*Qb.MAX_ENV_DIFF_FRAC;0===t&&(t=.001);var e=new xE(this._input.getEnvelopeInternal());e.expandBy(this._distance);var n=new xE(this._result.getEnvelopeInternal());n.expandBy(t),n.contains(e)||(this._isValid=!1,this._errorMsg="Buffer envelope is incorrect",this._errorIndicator=this._input.getFactory().toGeometry(n)),this.report("Envelope")},Qb.prototype.checkDistance=function(){var t=new Tb(this._input,this._distance,this._result);t.isValid()||(this._isValid=!1,this._errorMsg=t.getErrorMessage(),this._errorLocation=t.getErrorLocation(),this._errorIndicator=t.getErrorIndicator()),this.report("Distance")},Qb.prototype.checkArea=function(){var t=this._input.getArea(),e=this._result.getArea();this._distance>0&&t>e&&(this._isValid=!1,this._errorMsg="Area of positive buffer is smaller than input",this._errorIndicator=this._result),this._distance<0&&t<e&&(this._isValid=!1,this._errorMsg="Area of negative buffer is larger than input",this._errorIndicator=this._result),this.report("Area")},Qb.prototype.checkPolygonal=function(){this._result instanceof Hx||this._result instanceof Wx||(this._isValid=!1),this._errorMsg="Result is not polygonal",this._errorIndicator=this._result,this.report("Polygonal")},Qb.prototype.getErrorIndicator=function(){return this._errorIndicator},Qb.prototype.getErrorLocation=function(){return this._errorLocation},Qb.prototype.checkExpectedEmpty=function(){return this._input.getDimension()>=2||this._distance>0?null:(this._result.isEmpty()||(this._isValid=!1,this._errorMsg="Result is non-empty",this._errorIndicator=this._result),void this.report("ExpectedEmpty"))},Qb.prototype.report=function(t){if(!Qb.VERBOSE)return null;IE.out.println("Check "+t+": "+(this._isValid?"passed":"FAILED"))},Qb.prototype.getErrorMessage=function(){return this._errorMsg},Qb.prototype.interfaces_=function(){return[]},Qb.prototype.getClass=function(){return Qb},Qb.isValidMsg=function(t,e,n){var r=new Qb(t,e,n);return r.isValid()?null:r.getErrorMessage()},Qb.isValid=function(t,e,n){return!!new Qb(t,e,n).isValid()},Db.VERBOSE.get=function(){return!1},Db.MAX_ENV_DIFF_FRAC.get=function(){return.012},Object.defineProperties(Qb,Db);var Pb=function(){this._pts=null,this._data=null;var t=arguments[0],e=arguments[1];this._pts=t,this._data=e};Pb.prototype.getCoordinates=function(){return this._pts},Pb.prototype.size=function(){return this._pts.length},Pb.prototype.getCoordinate=function(t){return this._pts[t]},Pb.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},Pb.prototype.getSegmentOctant=function(t){return t===this._pts.length-1?-1:sw.octant(this.getCoordinate(t),this.getCoordinate(t+1))},Pb.prototype.setData=function(t){this._data=t},Pb.prototype.getData=function(){return this._data},Pb.prototype.toString=function(){return ME.toLineString(new nC(this._pts))},Pb.prototype.interfaces_=function(){return[aw]},Pb.prototype.getClass=function(){return Pb};var kb=function(){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new nx,this._intersectionCount=0,this._keepIntersections=!0;var t=arguments[0];this._li=t,this._interiorIntersection=null};kb.prototype.getInteriorIntersection=function(){return this._interiorIntersection},kb.prototype.setCheckEndSegmentsOnly=function(t){this._isCheckEndSegmentsOnly=t},kb.prototype.getIntersectionSegments=function(){return this._intSegments},kb.prototype.count=function(){return this._intersectionCount},kb.prototype.getIntersections=function(){return this._intersections},kb.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t},kb.prototype.setKeepIntersections=function(t){this._keepIntersections=t},kb.prototype.processIntersections=function(t,e,n,r){if(!this._findAllIntersections&&this.hasIntersection())return null;if(t===n&&e===r)return null;if(this._isCheckEndSegmentsOnly&&!(this.isEndSegment(t,e)||this.isEndSegment(n,r)))return null;var i=t.getCoordinates()[e],o=t.getCoordinates()[e+1],s=n.getCoordinates()[r],a=n.getCoordinates()[r+1];this._li.computeIntersection(i,o,s,a),this._li.hasIntersection()&&this._li.isInteriorIntersection()&&(this._intSegments=new Array(4).fill(null),this._intSegments[0]=i,this._intSegments[1]=o,this._intSegments[2]=s,this._intSegments[3]=a,this._interiorIntersection=this._li.getIntersection(0),this._keepIntersections&&this._intersections.add(this._interiorIntersection),this._intersectionCount++)},kb.prototype.isEndSegment=function(t,e){return 0===e||e>=t.size()-2},kb.prototype.hasIntersection=function(){return null!==this._interiorIntersection},kb.prototype.isDone=function(){return!this._findAllIntersections&&null!==this._interiorIntersection},kb.prototype.interfaces_=function(){return[jw]},kb.prototype.getClass=function(){return kb},kb.createAllIntersectionsFinder=function(t){var e=new kb(t);return e.setFindAllIntersections(!0),e},kb.createAnyIntersectionFinder=function(t){return new kb(t)},kb.createIntersectionCounter=function(t){var e=new kb(t);return e.setFindAllIntersections(!0),e.setKeepIntersections(!1),e};var Ob=function(){this._li=new DE,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;var t=arguments[0];this._segStrings=t};Ob.prototype.execute=function(){if(null!==this._segInt)return null;this.checkInteriorIntersections()},Ob.prototype.getIntersections=function(){return this._segInt.getIntersections()},Ob.prototype.isValid=function(){return this.execute(),this._isValid},Ob.prototype.setFindAllIntersections=function(t){this._findAllIntersections=t},Ob.prototype.checkInteriorIntersections=function(){this._isValid=!0,this._segInt=new kb(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var t=new yw;if(t.setSegmentIntersector(this._segInt),t.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null},Ob.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new CC(this.getErrorMessage(),this._segInt.getInteriorIntersection())},Ob.prototype.getErrorMessage=function(){if(this._isValid)return"no intersections found";var t=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+ME.toLineString(t[0],t[1])+" and "+ME.toLineString(t[2],t[3])},Ob.prototype.interfaces_=function(){return[]},Ob.prototype.getClass=function(){return Ob},Ob.computeIntersections=function(t){var e=new Ob(t);return e.setFindAllIntersections(!0),e.isValid(),e.getIntersections()};var Fb=function t(){this._nv=null;var e=arguments[0];this._nv=new Ob(t.toSegmentStrings(e))};Fb.prototype.checkValid=function(){this._nv.checkValid()},Fb.prototype.interfaces_=function(){return[]},Fb.prototype.getClass=function(){return Fb},Fb.toSegmentStrings=function(t){for(var e=new nx,n=t.iterator();n.hasNext();){var r=n.next();e.add(new Pb(r.getCoordinates(),r))}return e},Fb.checkValid=function(t){new Fb(t).checkValid()};var Gb=function(t){this._mapOp=t};Gb.prototype.map=function(t){for(var e=new nx,n=0;n<t.getNumGeometries();n++){var r=this._mapOp.map(t.getGeometryN(n));r.isEmpty()||e.add(r)}return t.getFactory().createGeometryCollection(hC.toGeometryArray(e))},Gb.prototype.interfaces_=function(){return[]},Gb.prototype.getClass=function(){return Gb},Gb.map=function(t,e){return new Gb(e).map(t)};var Ub=function(){this._op=null,this._geometryFactory=null,this._ptLocator=null,this._lineEdgesList=new nx,this._resultLineList=new nx;var t=arguments[0],e=arguments[1],n=arguments[2];this._op=t,this._geometryFactory=e,this._ptLocator=n};Ub.prototype.collectLines=function(t){for(var e=this,n=this._op.getGraph().getEdgeEnds().iterator();n.hasNext();){var r=n.next();e.collectLineEdge(r,t,e._lineEdgesList),e.collectBoundaryTouchEdge(r,t,e._lineEdgesList)}},Ub.prototype.labelIsolatedLine=function(t,e){var n=this._ptLocator.locate(t.getCoordinate(),this._op.getArgGeometry(e));t.getLabel().setLocation(e,n)},Ub.prototype.build=function(t){return this.findCoveredLineEdges(),this.collectLines(t),this.buildLines(t),this._resultLineList},Ub.prototype.collectLineEdge=function(t,e,n){var r=t.getLabel(),i=t.getEdge();t.isLineEdge()&&(t.isVisited()||!IB.isResultOfOp(r,e)||i.isCovered()||(n.add(i),t.setVisitedEdge(!0)))},Ub.prototype.findCoveredLineEdges=function(){for(var t=this._op.getGraph().getNodes().iterator();t.hasNext();){t.next().getEdges().findCoveredLineEdges()}for(var e=this._op.getGraph().getEdgeEnds().iterator();e.hasNext();){var n=e.next(),r=n.getEdge();if(n.isLineEdge()&&!r.isCoveredSet()){var i=this._op.isCoveredByA(n.getCoordinate());r.setCovered(i)}}},Ub.prototype.labelIsolatedLines=function(t){for(var e=t.iterator();e.hasNext();){var n=e.next(),r=n.getLabel();n.isIsolated()&&(r.isNull(0)?this.labelIsolatedLine(n,0):this.labelIsolatedLine(n,1))}},Ub.prototype.buildLines=function(t){for(var e=this._lineEdgesList.iterator();e.hasNext();){var n=e.next(),r=this._geometryFactory.createLineString(n.getCoordinates());this._resultLineList.add(r),n.setInResult(!0)}},Ub.prototype.collectBoundaryTouchEdge=function(t,e,n){var r=t.getLabel();return t.isLineEdge()||t.isVisited()||t.isInteriorAreaEdge()||t.getEdge().isInResult()?null:(TE.isTrue(!(t.isInResult()||t.getSym().isInResult())||!t.getEdge().isInResult()),void(IB.isResultOfOp(r,e)&&e===IB.INTERSECTION&&(n.add(t.getEdge()),t.setVisitedEdge(!0))))},Ub.prototype.interfaces_=function(){return[]},Ub.prototype.getClass=function(){return Ub};var qb=function(){this._op=null,this._geometryFactory=null,this._resultPointList=new nx;var t=arguments[0],e=arguments[1];this._op=t,this._geometryFactory=e};qb.prototype.filterCoveredNodeToPoint=function(t){var e=t.getCoordinate();if(!this._op.isCoveredByLA(e)){var n=this._geometryFactory.createPoint(e);this._resultPointList.add(n)}},qb.prototype.extractNonCoveredResultNodes=function(t){for(var e=this._op.getGraph().getNodes().iterator();e.hasNext();){var n=e.next();if(!n.isInResult()&&(!n.isIncidentEdgeInResult()&&(0===n.getEdges().getDegree()||t===IB.INTERSECTION))){var r=n.getLabel();IB.isResultOfOp(r,t)&&this.filterCoveredNodeToPoint(n)}}},qb.prototype.build=function(t){return this.extractNonCoveredResultNodes(t),this._resultPointList},qb.prototype.interfaces_=function(){return[]},qb.prototype.getClass=function(){return qb};var jb=function(){this._inputGeom=null,this._factory=null,this._pruneEmptyGeometry=!0,this._preserveGeometryCollectionType=!0,this._preserveCollections=!1,this._preserveType=!1};jb.prototype.transformPoint=function(t,e){return this._factory.createPoint(this.transformCoordinates(t.getCoordinateSequence(),t))},jb.prototype.transformPolygon=function(t,e){var n=!0,r=this.transformLinearRing(t.getExteriorRing(),t);null!==r&&r instanceof Jx&&!r.isEmpty()||(n=!1);for(var i=new nx,o=0;o<t.getNumInteriorRing();o++){var s=this.transformLinearRing(t.getInteriorRingN(o),t);null===s||s.isEmpty()||(s instanceof Jx||(n=!1),i.add(s))}if(n)return this._factory.createPolygon(r,i.toArray([]));var a=new nx;return null!==r&&a.add(r),a.addAll(i),this._factory.buildGeometry(a)},jb.prototype.createCoordinateSequence=function(t){return this._factory.getCoordinateSequenceFactory().create(t)},jb.prototype.getInputGeometry=function(){return this._inputGeom},jb.prototype.transformMultiLineString=function(t,e){for(var n=new nx,r=0;r<t.getNumGeometries();r++){var i=this.transformLineString(t.getGeometryN(r),t);null!==i&&(i.isEmpty()||n.add(i))}return this._factory.buildGeometry(n)},jb.prototype.transformCoordinates=function(t,e){return this.copy(t)},jb.prototype.transformLineString=function(t,e){return this._factory.createLineString(this.transformCoordinates(t.getCoordinateSequence(),t))},jb.prototype.transformMultiPoint=function(t,e){for(var n=new nx,r=0;r<t.getNumGeometries();r++){var i=this.transformPoint(t.getGeometryN(r),t);null!==i&&(i.isEmpty()||n.add(i))}return this._factory.buildGeometry(n)},jb.prototype.transformMultiPolygon=function(t,e){for(var n=new nx,r=0;r<t.getNumGeometries();r++){var i=this.transformPolygon(t.getGeometryN(r),t);null!==i&&(i.isEmpty()||n.add(i))}return this._factory.buildGeometry(n)},jb.prototype.copy=function(t){return t.copy()},jb.prototype.transformGeometryCollection=function(t,e){for(var n=new nx,r=0;r<t.getNumGeometries();r++){var i=this.transform(t.getGeometryN(r));null!==i&&(this._pruneEmptyGeometry&&i.isEmpty()||n.add(i))}return this._preserveGeometryCollectionType?this._factory.createGeometryCollection(hC.toGeometryArray(n)):this._factory.buildGeometry(n)},jb.prototype.transform=function(t){if(this._inputGeom=t,this._factory=t.getFactory(),t instanceof Vx)return this.transformPoint(t,null);if(t instanceof Xx)return this.transformMultiPoint(t,null);if(t instanceof Jx)return this.transformLinearRing(t,null);if(t instanceof jx)return this.transformLineString(t,null);if(t instanceof Nx)return this.transformMultiLineString(t,null);if(t instanceof Hx)return this.transformPolygon(t,null);if(t instanceof Wx)return this.transformMultiPolygon(t,null);if(t instanceof Lx)return this.transformGeometryCollection(t,null);throw new XI("Unknown Geometry subtype: "+t.getClass().getName())},jb.prototype.transformLinearRing=function(t,e){var n=this.transformCoordinates(t.getCoordinateSequence(),t);if(null===n)return this._factory.createLinearRing(null);var r=n.size();return r>0&&r<4&&!this._preserveType?this._factory.createLineString(n):this._factory.createLinearRing(n)},jb.prototype.interfaces_=function(){return[]},jb.prototype.getClass=function(){return jb};var zb=function t(){if(this._snapTolerance=0,this._srcPts=null,this._seg=new cw,this._allowSnappingToSourceVertices=!1,this._isClosed=!1,arguments[0]instanceof jx&&"number"==typeof arguments[1]){var e=arguments[1];t.call(this,arguments[0].getCoordinates(),e)}else if(arguments[0]instanceof Array&&"number"==typeof arguments[1]){var n=arguments[0],r=arguments[1];this._srcPts=n,this._isClosed=t.isClosed(n),this._snapTolerance=r}};zb.prototype.snapVertices=function(t,e){for(var n=this._isClosed?t.size()-1:t.size(),r=0;r<n;r++){var i=t.get(r),o=this.findSnapForVertex(i,e);null!==o&&(t.set(r,new eE(o)),0===r&&this._isClosed&&t.set(t.size()-1,new eE(o)))}},zb.prototype.findSnapForVertex=function(t,e){for(var n=0;n<e.length;n++){if(t.equals2D(e[n]))return null;if(t.distance(e[n])<this._snapTolerance)return e[n]}return null},zb.prototype.snapTo=function(t){var e=new ix(this._srcPts);return this.snapVertices(e,t),this.snapSegments(e,t),e.toCoordinateArray()},zb.prototype.snapSegments=function(t,e){if(0===e.length)return null;var n=e.length;e[0].equals2D(e[e.length-1])&&(n=e.length-1);for(var r=0;r<n;r++){var i=e[r],o=this.findSegmentIndexToSnap(i,t);o>=0&&t.add(o+1,new eE(i),!1)}},zb.prototype.findSegmentIndexToSnap=function(t,e){for(var n=this,r=JI.MAX_VALUE,i=-1,o=0;o<e.size()-1;o++){if(n._seg.p0=e.get(o),n._seg.p1=e.get(o+1),n._seg.p0.equals2D(t)||n._seg.p1.equals2D(t)){if(n._allowSnappingToSourceVertices)continue;return-1}var s=n._seg.distance(t);s<n._snapTolerance&&s<r&&(r=s,i=o)}return i},zb.prototype.setAllowSnappingToSourceVertices=function(t){this._allowSnappingToSourceVertices=t},zb.prototype.interfaces_=function(){return[]},zb.prototype.getClass=function(){return zb},zb.isClosed=function(t){return!(t.length<=1)&&t[0].equals2D(t[t.length-1])};var Vb=function(t){this._srcGeom=t||null},Yb={SNAP_PRECISION_FACTOR:{configurable:!0}};Vb.prototype.snapTo=function(t,e){var n=this.extractTargetCoordinates(t);return new Hb(e,n).transform(this._srcGeom)},Vb.prototype.snapToSelf=function(t,e){var n=this.extractTargetCoordinates(this._srcGeom),r=new Hb(t,n,!0).transform(this._srcGeom),i=r;return e&&aE(i,Yx)&&(i=r.buffer(0)),i},Vb.prototype.computeSnapTolerance=function(t){return this.computeMinimumSegmentLength(t)/10},Vb.prototype.extractTargetCoordinates=function(t){for(var e=new xx,n=t.getCoordinates(),r=0;r<n.length;r++)e.add(n[r]);return e.toArray(new Array(0).fill(null))},Vb.prototype.computeMinimumSegmentLength=function(t){for(var e=JI.MAX_VALUE,n=0;n<t.length-1;n++){var r=t[n].distance(t[n+1]);r<e&&(e=r)}return e},Vb.prototype.interfaces_=function(){return[]},Vb.prototype.getClass=function(){return Vb},Vb.snap=function(t,e,n){var r=new Array(2).fill(null),i=new Vb(t);r[0]=i.snapTo(e,n);var o=new Vb(e);return r[1]=o.snapTo(r[0],n),r},Vb.computeOverlaySnapTolerance=function(){if(1===arguments.length){var t=arguments[0],e=Vb.computeSizeBasedSnapTolerance(t),n=t.getPrecisionModel();if(n.getType()===aC.FIXED){var r=1/n.getScale()*2/1.415;r>e&&(e=r)}return e}if(2===arguments.length){var i=arguments[0],o=arguments[1];return Math.min(Vb.computeOverlaySnapTolerance(i),Vb.computeOverlaySnapTolerance(o))}},Vb.computeSizeBasedSnapTolerance=function(t){var e=t.getEnvelopeInternal();return Math.min(e.getHeight(),e.getWidth())*Vb.SNAP_PRECISION_FACTOR},Vb.snapToSelf=function(t,e,n){return new Vb(t).snapToSelf(e,n)},Yb.SNAP_PRECISION_FACTOR.get=function(){return 1e-9},Object.defineProperties(Vb,Yb);var Hb=function(t){function e(e,n,r){t.call(this),this._snapTolerance=e||null,this._snapPts=n||null,this._isSelfSnap=void 0!==r&&r}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.snapLine=function(t,e){var n=new zb(t,this._snapTolerance);return n.setAllowSnappingToSourceVertices(this._isSelfSnap),n.snapTo(e)},e.prototype.transformCoordinates=function(t,e){var n=t.toCoordinateArray(),r=this.snapLine(n,this._snapPts);return this._factory.getCoordinateSequenceFactory().create(r)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(jb),Xb=function(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=0,this._commonSignExp=null};Xb.prototype.getCommon=function(){return JI.longBitsToDouble(this._commonBits)},Xb.prototype.add=function(t){var e=JI.doubleToLongBits(t);return this._isFirst?(this._commonBits=e,this._commonSignExp=Xb.signExpBits(this._commonBits),this._isFirst=!1,null):Xb.signExpBits(e)!==this._commonSignExp?(this._commonBits=0,null):(this._commonMantissaBitsCount=Xb.numCommonMostSigMantissaBits(this._commonBits,e),void(this._commonBits=Xb.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))))},Xb.prototype.toString=function(){if(1===arguments.length){var t=arguments[0],e=JI.longBitsToDouble(t),n="0000000000000000000000000000000000000000000000000000000000000000"+JI.toBinaryString(t),r=n.substring(n.length-64);return r.substring(0,1)+" "+r.substring(1,12)+"(exp) "+r.substring(12)+" [ "+e+" ]"}},Xb.prototype.interfaces_=function(){return[]},Xb.prototype.getClass=function(){return Xb},Xb.getBit=function(t,e){return 0!=(t&1<<e)?1:0},Xb.signExpBits=function(t){return t>>52},Xb.zeroLowerBits=function(t,e){return t&~((1<<e)-1)},Xb.numCommonMostSigMantissaBits=function(t,e){for(var n=0,r=52;r>=0;r--){if(Xb.getBit(t,r)!==Xb.getBit(e,r))return n;n++}return 52};var Jb=function(){this._commonCoord=null,this._ccFilter=new Kb},Wb={CommonCoordinateFilter:{configurable:!0},Translater:{configurable:!0}};Jb.prototype.addCommonBits=function(t){var e=new Zb(this._commonCoord);t.apply(e),t.geometryChanged()},Jb.prototype.removeCommonBits=function(t){if(0===this._commonCoord.x&&0===this._commonCoord.y)return t;var e=new eE(this._commonCoord);e.x=-e.x,e.y=-e.y;var n=new Zb(e);return t.apply(n),t.geometryChanged(),t},Jb.prototype.getCommonCoordinate=function(){return this._commonCoord},Jb.prototype.add=function(t){t.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()},Jb.prototype.interfaces_=function(){return[]},Jb.prototype.getClass=function(){return Jb},Wb.CommonCoordinateFilter.get=function(){return Kb},Wb.Translater.get=function(){return Zb},Object.defineProperties(Jb,Wb);var Kb=function(){this._commonBitsX=new Xb,this._commonBitsY=new Xb};Kb.prototype.filter=function(t){this._commonBitsX.add(t.x),this._commonBitsY.add(t.y)},Kb.prototype.getCommonCoordinate=function(){return new eE(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())},Kb.prototype.interfaces_=function(){return[zE]},Kb.prototype.getClass=function(){return Kb};var Zb=function(){this.trans=null;var t=arguments[0];this.trans=t};Zb.prototype.filter=function(t,e){var n=t.getOrdinate(e,0)+this.trans.x,r=t.getOrdinate(e,1)+this.trans.y;t.setOrdinate(e,0,n),t.setOrdinate(e,1,r)},Zb.prototype.isDone=function(){return!1},Zb.prototype.isGeometryChanged=function(){return!0},Zb.prototype.interfaces_=function(){return[Mx]},Zb.prototype.getClass=function(){return Zb};var $b=function(t,e){this._geom=new Array(2).fill(null),this._snapTolerance=null,this._cbr=null,this._geom[0]=t,this._geom[1]=e,this.computeSnapTolerance()};$b.prototype.selfSnap=function(t){return new Vb(t).snapTo(t,this._snapTolerance)},$b.prototype.removeCommonBits=function(t){this._cbr=new Jb,this._cbr.add(t[0]),this._cbr.add(t[1]);var e=new Array(2).fill(null);return e[0]=this._cbr.removeCommonBits(t[0].copy()),e[1]=this._cbr.removeCommonBits(t[1].copy()),e},$b.prototype.prepareResult=function(t){return this._cbr.addCommonBits(t),t},$b.prototype.getResultGeometry=function(t){var e=this.snap(this._geom),n=IB.overlayOp(e[0],e[1],t);return this.prepareResult(n)},$b.prototype.checkValid=function(t){t.isValid()||IE.out.println("Snapped geometry is invalid")},$b.prototype.computeSnapTolerance=function(){this._snapTolerance=Vb.computeOverlaySnapTolerance(this._geom[0],this._geom[1])},$b.prototype.snap=function(t){var e=this.removeCommonBits(t);return Vb.snap(e[0],e[1],this._snapTolerance)},$b.prototype.interfaces_=function(){return[]},$b.prototype.getClass=function(){return $b},$b.overlayOp=function(t,e,n){return new $b(t,e).getResultGeometry(n)},$b.union=function(t,e){return $b.overlayOp(t,e,IB.UNION)},$b.intersection=function(t,e){return $b.overlayOp(t,e,IB.INTERSECTION)},$b.symDifference=function(t,e){return $b.overlayOp(t,e,IB.SYMDIFFERENCE)},$b.difference=function(t,e){return $b.overlayOp(t,e,IB.DIFFERENCE)};var tB=function(t,e){this._geom=new Array(2).fill(null),this._geom[0]=t,this._geom[1]=e};tB.prototype.getResultGeometry=function(t){var e=null,n=!1,r=null;try{e=IB.overlayOp(this._geom[0],this._geom[1],t);n=!0}catch(t){if(!(t instanceof LE))throw t;r=t}if(!n)try{e=$b.overlayOp(this._geom[0],this._geom[1],t)}catch(t){throw t instanceof LE?r:t}return e},tB.prototype.interfaces_=function(){return[]},tB.prototype.getClass=function(){return tB},tB.overlayOp=function(t,e,n){return new tB(t,e).getResultGeometry(n)},tB.union=function(t,e){return tB.overlayOp(t,e,IB.UNION)},tB.intersection=function(t,e){return tB.overlayOp(t,e,IB.INTERSECTION)},tB.symDifference=function(t,e){return tB.overlayOp(t,e,IB.SYMDIFFERENCE)},tB.difference=function(t,e){return tB.overlayOp(t,e,IB.DIFFERENCE)};var eB=function(){this.mce=null,this.chainIndex=null;var t=arguments[0],e=arguments[1];this.mce=t,this.chainIndex=e};eB.prototype.computeIntersections=function(t,e){this.mce.computeIntersectsForChain(this.chainIndex,t.mce,t.chainIndex,e)},eB.prototype.interfaces_=function(){return[]},eB.prototype.getClass=function(){return eB};var nB=function t(){if(this._label=null,this._xValue=null,this._eventType=null,this._insertEvent=null,this._deleteEventIndex=null,this._obj=null,2===arguments.length){var e=arguments[0],n=arguments[1];this._eventType=t.DELETE,this._xValue=e,this._insertEvent=n}else if(3===arguments.length){var r=arguments[0],i=arguments[1],o=arguments[2];this._eventType=t.INSERT,this._label=r,this._xValue=i,this._obj=o}},rB={INSERT:{configurable:!0},DELETE:{configurable:!0}};nB.prototype.isDelete=function(){return this._eventType===nB.DELETE},nB.prototype.setDeleteEventIndex=function(t){this._deleteEventIndex=t},nB.prototype.getObject=function(){return this._obj},nB.prototype.compareTo=function(t){var e=t;return this._xValue<e._xValue?-1:this._xValue>e._xValue?1:this._eventType<e._eventType?-1:this._eventType>e._eventType?1:0},nB.prototype.getInsertEvent=function(){return this._insertEvent},nB.prototype.isInsert=function(){return this._eventType===nB.INSERT},nB.prototype.isSameLabel=function(t){return null!==this._label&&this._label===t._label},nB.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex},nB.prototype.interfaces_=function(){return[KI]},nB.prototype.getClass=function(){return nB},rB.INSERT.get=function(){return 1},rB.DELETE.get=function(){return 2},Object.defineProperties(nB,rB);var iB=function(){};iB.prototype.interfaces_=function(){return[]},iB.prototype.getClass=function(){return iB};var oB=function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._properIntersectionPoint=null,this._li=null,this._includeProper=null,this._recordIsolated=null,this._isSelfIntersection=null,this._numIntersections=0,this.numTests=0,this._bdyNodes=null,this._isDone=!1,this._isDoneWhenProperInt=!1;var t=arguments[0],e=arguments[1],n=arguments[2];this._li=t,this._includeProper=e,this._recordIsolated=n};oB.prototype.isTrivialIntersection=function(t,e,n,r){if(t===n&&1===this._li.getIntersectionNum()){if(oB.isAdjacentSegments(e,r))return!0;if(t.isClosed()){var i=t.getNumPoints()-1;if(0===e&&r===i||0===r&&e===i)return!0}}return!1},oB.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},oB.prototype.setIsDoneIfProperInt=function(t){this._isDoneWhenProperInt=t},oB.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},oB.prototype.isBoundaryPointInternal=function(t,e){for(var n=e.iterator();n.hasNext();){var r=n.next().getCoordinate();if(t.isIntersection(r))return!0}return!1},oB.prototype.hasProperIntersection=function(){return this._hasProper},oB.prototype.hasIntersection=function(){return this._hasIntersection},oB.prototype.isDone=function(){return this._isDone},oB.prototype.isBoundaryPoint=function(t,e){return null!==e&&(!!this.isBoundaryPointInternal(t,e[0])||!!this.isBoundaryPointInternal(t,e[1]))},oB.prototype.setBoundaryNodes=function(t,e){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=t,this._bdyNodes[1]=e},oB.prototype.addIntersections=function(t,e,n,r){if(t===n&&e===r)return null;this.numTests++;var i=t.getCoordinates()[e],o=t.getCoordinates()[e+1],s=n.getCoordinates()[r],a=n.getCoordinates()[r+1];this._li.computeIntersection(i,o,s,a),this._li.hasIntersection()&&(this._recordIsolated&&(t.setIsolated(!1),n.setIsolated(!1)),this._numIntersections++,this.isTrivialIntersection(t,e,n,r)||(this._hasIntersection=!0,!this._includeProper&&this._li.isProper()||(t.addIntersections(this._li,e,0),n.addIntersections(this._li,r,1)),this._li.isProper()&&(this._properIntersectionPoint=this._li.getIntersection(0).copy(),this._hasProper=!0,this._isDoneWhenProperInt&&(this._isDone=!0),this.isBoundaryPoint(this._li,this._bdyNodes)||(this._hasProperInterior=!0))))},oB.prototype.interfaces_=function(){return[]},oB.prototype.getClass=function(){return oB},oB.isAdjacentSegments=function(t,e){return 1===Math.abs(t-e)};var sB=function(t){function e(){t.call(this),this.events=new nx,this.nOverlaps=null}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.prepareEvents=function(){JC.sort(this.events);for(var t=0;t<this.events.size();t++){var e=this.events.get(t);e.isDelete()&&e.getInsertEvent().setDeleteEventIndex(t)}},e.prototype.computeIntersections=function(){if(1===arguments.length){var t=arguments[0];this.nOverlaps=0,this.prepareEvents();for(var e=0;e<this.events.size();e++){var n=this.events.get(e);if(n.isInsert()&&this.processOverlaps(e,n.getDeleteEventIndex(),n,t),t.isDone())break}}else if(3===arguments.length)if(arguments[2]instanceof oB&&aE(arguments[0],tx)&&aE(arguments[1],tx)){var r=arguments[0],i=arguments[1],o=arguments[2];this.addEdges(r,r),this.addEdges(i,i),this.computeIntersections(o)}else if("boolean"==typeof arguments[2]&&aE(arguments[0],tx)&&arguments[1]instanceof oB){var s=arguments[0],a=arguments[1];arguments[2]?this.addEdges(s,null):this.addEdges(s),this.computeIntersections(a)}},e.prototype.addEdge=function(t,e){for(var n=t.getMonotoneChainEdge(),r=n.getStartIndexes(),i=0;i<r.length-1;i++){var o=new eB(n,i),s=new nB(e,n.getMinX(i),o);this.events.add(s),this.events.add(new nB(n.getMaxX(i),s))}},e.prototype.processOverlaps=function(t,e,n,r){for(var i=n.getObject(),o=t;o<e;o++){var s=this.events.get(o);if(s.isInsert()){var a=s.getObject();n.isSameLabel(s)||(i.computeIntersections(a,r),this.nOverlaps++)}}},e.prototype.addEdges=function(){if(1===arguments.length)for(var t=arguments[0].iterator();t.hasNext();){var e=t.next();this.addEdge(e,e)}else if(2===arguments.length)for(var n=arguments[1],r=arguments[0].iterator();r.hasNext();){var i=r.next();this.addEdge(i,n)}},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(iB),aB=function(){this._min=JI.POSITIVE_INFINITY,this._max=JI.NEGATIVE_INFINITY},uB={NodeComparator:{configurable:!0}};aB.prototype.getMin=function(){return this._min},aB.prototype.intersects=function(t,e){return!(this._min>e||this._max<t)},aB.prototype.getMax=function(){return this._max},aB.prototype.toString=function(){return ME.toLineString(new eE(this._min,0),new eE(this._max,0))},aB.prototype.interfaces_=function(){return[]},aB.prototype.getClass=function(){return aB},uB.NodeComparator.get=function(){return lB},Object.defineProperties(aB,uB);var lB=function(){};lB.prototype.compare=function(t,e){var n=t,r=e,i=(n._min+n._max)/2,o=(r._min+r._max)/2;return i<o?-1:i>o?1:0},lB.prototype.interfaces_=function(){return[$I]},lB.prototype.getClass=function(){return lB};var cB=function(t){function e(){t.call(this),this._item=null;var e=arguments[0],n=arguments[1],r=arguments[2];this._min=e,this._max=n,this._item=r}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.query=function(t,e,n){if(!this.intersects(t,e))return null;n.visitItem(this._item)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(aB),hB=function(t){function e(){t.call(this),this._node1=null,this._node2=null;var e=arguments[0],n=arguments[1];this._node1=e,this._node2=n,this.buildExtent(this._node1,this._node2)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.buildExtent=function(t,e){this._min=Math.min(t._min,e._min),this._max=Math.max(t._max,e._max)},e.prototype.query=function(t,e,n){if(!this.intersects(t,e))return null;null!==this._node1&&this._node1.query(t,e,n),null!==this._node2&&this._node2.query(t,e,n)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(aB),fB=function(){this._leaves=new nx,this._root=null,this._level=0};fB.prototype.buildTree=function(){JC.sort(this._leaves,new aB.NodeComparator);for(var t=this._leaves,e=null,n=new nx;;){if(this.buildLevel(t,n),1===n.size())return n.get(0);e=t,t=n,n=e}},fB.prototype.insert=function(t,e,n){if(null!==this._root)throw new Error("Index cannot be added to once it has been queried");this._leaves.add(new cB(t,e,n))},fB.prototype.query=function(t,e,n){this.init(),this._root.query(t,e,n)},fB.prototype.buildRoot=function(){if(null!==this._root)return null;this._root=this.buildTree()},fB.prototype.printNode=function(t){IE.out.println(ME.toLineString(new eE(t._min,this._level),new eE(t._max,this._level)))},fB.prototype.init=function(){if(null!==this._root)return null;this.buildRoot()},fB.prototype.buildLevel=function(t,e){this._level++,e.clear();for(var n=0;n<t.size();n+=2){var r=t.get(n);if(null===(n+1<t.size()?t.get(n):null))e.add(r);else{var i=new hB(t.get(n),t.get(n+1));e.add(i)}}},fB.prototype.interfaces_=function(){return[]},fB.prototype.getClass=function(){return fB};var pB=function(){this._items=new nx};pB.prototype.visitItem=function(t){this._items.add(t)},pB.prototype.getItems=function(){return this._items},pB.prototype.interfaces_=function(){return[VC]},pB.prototype.getClass=function(){return pB};var gB=function(){this._index=null;var t=arguments[0];if(!aE(t,Yx))throw new XI("Argument must be Polygonal");this._index=new yB(t)},AB={SegmentVisitor:{configurable:!0},IntervalIndexedGeometry:{configurable:!0}};gB.prototype.locate=function(t){var e=new kE(t),n=new dB(e);return this._index.query(t.y,t.y,n),e.getLocation()},gB.prototype.interfaces_=function(){return[Dw]},gB.prototype.getClass=function(){return gB},AB.SegmentVisitor.get=function(){return dB},AB.IntervalIndexedGeometry.get=function(){return yB},Object.defineProperties(gB,AB);var dB=function(){this._counter=null;var t=arguments[0];this._counter=t};dB.prototype.visitItem=function(t){var e=t;this._counter.countSegment(e.getCoordinate(0),e.getCoordinate(1))},dB.prototype.interfaces_=function(){return[VC]},dB.prototype.getClass=function(){return dB};var yB=function(){this._index=new fB;var t=arguments[0];this.init(t)};yB.prototype.init=function(t){for(var e=mb.getLines(t).iterator();e.hasNext();){var n=e.next().getCoordinates();this.addLine(n)}},yB.prototype.addLine=function(t){for(var e=1;e<t.length;e++){var n=new cw(t[e-1],t[e]),r=Math.min(n.p0.y,n.p1.y),i=Math.max(n.p0.y,n.p1.y);this._index.insert(r,i,n)}},yB.prototype.query=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1],n=new pB;return this._index.query(t,e,n),n.getItems()}if(3===arguments.length){var r=arguments[0],i=arguments[1],o=arguments[2];this._index.query(r,i,o)}},yB.prototype.interfaces_=function(){return[]},yB.prototype.getClass=function(){return yB};var vB=function(t){function e(){if(t.call(this),this._parentGeom=null,this._lineEdgeMap=new sC,this._boundaryNodeRule=null,this._useBoundaryDeterminationRule=!0,this._argIndex=null,this._boundaryNodes=null,this._hasTooFewPoints=!1,this._invalidPoint=null,this._areaPtLocator=null,this._ptLocator=new _b,2===arguments.length){var e=arguments[0],n=arguments[1],r=VE.OGC_SFS_BOUNDARY_RULE;this._argIndex=e,this._parentGeom=n,this._boundaryNodeRule=r,null!==n&&this.add(n)}else if(3===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2];this._argIndex=i,this._parentGeom=o,this._boundaryNodeRule=s,null!==o&&this.add(o)}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.insertBoundaryPoint=function(t,n){var r=this._nodes.addNode(n).getLabel(),i=1;r.getLocation(t,mC.ON)===oE.BOUNDARY&&i++;var o=e.determineBoundary(this._boundaryNodeRule,i);r.setLocation(t,o)},e.prototype.computeSelfNodes=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];return this.computeSelfNodes(t,e,!1)}if(3===arguments.length){var n=arguments[1],r=arguments[2],i=new oB(arguments[0],!0,!1);i.setIsDoneIfProperInt(r);var o=this.createEdgeSetIntersector(),s=this._parentGeom instanceof Jx||this._parentGeom instanceof Hx||this._parentGeom instanceof Wx,a=n||!s;return o.computeIntersections(this._edges,i,a),this.addSelfIntersectionNodes(this._argIndex),i}},e.prototype.computeSplitEdges=function(t){for(var e=this._edges.iterator();e.hasNext();){e.next().eiList.addSplitEdges(t)}},e.prototype.computeEdgeIntersections=function(t,e,n){var r=new oB(e,n,!0);return r.setBoundaryNodes(this.getBoundaryNodes(),t.getBoundaryNodes()),this.createEdgeSetIntersector().computeIntersections(this._edges,t._edges,r),r},e.prototype.getGeometry=function(){return this._parentGeom},e.prototype.getBoundaryNodeRule=function(){return this._boundaryNodeRule},e.prototype.hasTooFewPoints=function(){return this._hasTooFewPoints},e.prototype.addPoint=function(){if(arguments[0]instanceof Vx){var t=arguments[0].getCoordinate();this.insertPoint(this._argIndex,t,oE.INTERIOR)}else if(arguments[0]instanceof eE){var e=arguments[0];this.insertPoint(this._argIndex,e,oE.INTERIOR)}},e.prototype.addPolygon=function(t){this.addPolygonRing(t.getExteriorRing(),oE.EXTERIOR,oE.INTERIOR);for(var e=0;e<t.getNumInteriorRing();e++){var n=t.getInteriorRingN(e);this.addPolygonRing(n,oE.INTERIOR,oE.EXTERIOR)}},e.prototype.addEdge=function(t){this.insertEdge(t);var e=t.getCoordinates();this.insertPoint(this._argIndex,e[0],oE.BOUNDARY),this.insertPoint(this._argIndex,e[e.length-1],oE.BOUNDARY)},e.prototype.addLineString=function(t){var e=ox.removeRepeatedPoints(t.getCoordinates());if(e.length<2)return this._hasTooFewPoints=!0,this._invalidPoint=e[0],null;var n=new Kw(e,new SC(this._argIndex,oE.INTERIOR));this._lineEdgeMap.put(t,n),this.insertEdge(n),TE.isTrue(e.length>=2,"found LineString with single point"),this.insertBoundaryPoint(this._argIndex,e[0]),this.insertBoundaryPoint(this._argIndex,e[e.length-1])},e.prototype.getInvalidPoint=function(){return this._invalidPoint},e.prototype.getBoundaryPoints=function(){for(var t=this.getBoundaryNodes(),e=new Array(t.size()).fill(null),n=0,r=t.iterator();r.hasNext();){var i=r.next();e[n++]=i.getCoordinate().copy()}return e},e.prototype.getBoundaryNodes=function(){return null===this._boundaryNodes&&(this._boundaryNodes=this._nodes.getBoundaryNodes(this._argIndex)),this._boundaryNodes},e.prototype.addSelfIntersectionNode=function(t,e,n){if(this.isBoundaryNode(t,e))return null;n===oE.BOUNDARY&&this._useBoundaryDeterminationRule?this.insertBoundaryPoint(t,e):this.insertPoint(t,e,n)},e.prototype.addPolygonRing=function(t,e,n){if(t.isEmpty())return null;var r=ox.removeRepeatedPoints(t.getCoordinates());if(r.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=r[0],null;var i=e,o=n;OE.isCCW(r)&&(i=n,o=e);var s=new Kw(r,new SC(this._argIndex,oE.BOUNDARY,i,o));this._lineEdgeMap.put(t,s),this.insertEdge(s),this.insertPoint(this._argIndex,r[0],oE.BOUNDARY)},e.prototype.insertPoint=function(t,e,n){var r=this._nodes.addNode(e),i=r.getLabel();null===i?r._label=new SC(t,n):i.setLocation(t,n)},e.prototype.createEdgeSetIntersector=function(){return new sB},e.prototype.addSelfIntersectionNodes=function(t){for(var e=this._edges.iterator();e.hasNext();)for(var n=e.next(),r=n.getLabel().getLocation(t),i=n.eiList.iterator();i.hasNext();){var o=i.next();this.addSelfIntersectionNode(t,o.coord,r)}},e.prototype.add=function(){if(1!==arguments.length)return t.prototype.add.apply(this,arguments);var e=arguments[0];if(e.isEmpty())return null;if(e instanceof Wx&&(this._useBoundaryDeterminationRule=!1),e instanceof Hx)this.addPolygon(e);else if(e instanceof jx)this.addLineString(e);else if(e instanceof Vx)this.addPoint(e);else if(e instanceof Xx)this.addCollection(e);else if(e instanceof Nx)this.addCollection(e);else if(e instanceof Wx)this.addCollection(e);else{if(!(e instanceof Lx))throw new Error(e.getClass().getName());this.addCollection(e)}},e.prototype.addCollection=function(t){for(var e=0;e<t.getNumGeometries();e++){var n=t.getGeometryN(e);this.add(n)}},e.prototype.locate=function(t){return aE(this._parentGeom,Yx)&&this._parentGeom.getNumGeometries()>50?(null===this._areaPtLocator&&(this._areaPtLocator=new gB(this._parentGeom)),this._areaPtLocator.locate(t)):this._ptLocator.locate(t,this._parentGeom)},e.prototype.findEdge=function(){if(1===arguments.length){var e=arguments[0];return this._lineEdgeMap.get(e)}return t.prototype.findEdge.apply(this,arguments)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e.determineBoundary=function(t,e){return t.isInBoundary(e)?oE.BOUNDARY:oE.INTERIOR},e}(GC),mB=function(){if(this._li=new DE,this._resultPrecisionModel=null,this._arg=null,1===arguments.length){var t=arguments[0];this.setComputationPrecision(t.getPrecisionModel()),this._arg=new Array(1).fill(null),this._arg[0]=new vB(0,t)}else if(2===arguments.length){var e=arguments[0],n=arguments[1],r=VE.OGC_SFS_BOUNDARY_RULE;e.getPrecisionModel().compareTo(n.getPrecisionModel())>=0?this.setComputationPrecision(e.getPrecisionModel()):this.setComputationPrecision(n.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new vB(0,e,r),this._arg[1]=new vB(1,n,r)}else if(3===arguments.length){var i=arguments[0],o=arguments[1],s=arguments[2];i.getPrecisionModel().compareTo(o.getPrecisionModel())>=0?this.setComputationPrecision(i.getPrecisionModel()):this.setComputationPrecision(o.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new vB(0,i,s),this._arg[1]=new vB(1,o,s)}};mB.prototype.getArgGeometry=function(t){return this._arg[t].getGeometry()},mB.prototype.setComputationPrecision=function(t){this._resultPrecisionModel=t,this._li.setPrecisionModel(this._resultPrecisionModel)},mB.prototype.interfaces_=function(){return[]},mB.prototype.getClass=function(){return mB};var _B=function(){};_B.prototype.interfaces_=function(){return[]},_B.prototype.getClass=function(){return _B},_B.map=function(){if(arguments[0]instanceof UE&&aE(arguments[1],_B.MapOp)){for(var t=arguments[0],e=arguments[1],n=new nx,r=0;r<t.getNumGeometries();r++){var i=e.map(t.getGeometryN(r));null!==i&&n.add(i)}return t.getFactory().buildGeometry(n)}if(aE(arguments[0],KE)&&aE(arguments[1],_B.MapOp)){for(var o=arguments[0],s=arguments[1],a=new nx,u=o.iterator();u.hasNext();){var l=u.next(),c=s.map(l);null!==c&&a.add(c)}return a}},_B.MapOp=function(){};var IB=function(t){function e(){var e=arguments[0],n=arguments[1];t.call(this,e,n),this._ptLocator=new _b,this._geomFact=null,this._resultGeom=null,this._graph=null,this._edgeList=new qw,this._resultPolyList=new nx,this._resultLineList=new nx,this._resultPointList=new nx,this._graph=new GC(new Gw),this._geomFact=e.getFactory()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.insertUniqueEdge=function(t){var e=this._edgeList.findEqualEdge(t);if(null!==e){var n=e.getLabel(),r=t.getLabel();e.isPointwiseEqual(t)||(r=new SC(t.getLabel())).flip();var i=e.getDepth();i.isNull()&&i.add(n),i.add(r),n.merge(r)}else this._edgeList.add(t)},e.prototype.getGraph=function(){return this._graph},e.prototype.cancelDuplicateResultEdges=function(){for(var t=this._graph.getEdgeEnds().iterator();t.hasNext();){var e=t.next(),n=e.getSym();e.isInResult()&&n.isInResult()&&(e.setInResult(!1),n.setInResult(!1))}},e.prototype.isCoveredByLA=function(t){return!!this.isCovered(t,this._resultLineList)||!!this.isCovered(t,this._resultPolyList)},e.prototype.computeGeometry=function(t,n,r,i){var o=new nx;return o.addAll(t),o.addAll(n),o.addAll(r),o.isEmpty()?e.createEmptyResult(i,this._arg[0].getGeometry(),this._arg[1].getGeometry(),this._geomFact):this._geomFact.buildGeometry(o)},e.prototype.mergeSymLabels=function(){for(var t=this._graph.getNodes().iterator();t.hasNext();){t.next().getEdges().mergeSymLabels()}},e.prototype.isCovered=function(t,e){for(var n=e.iterator();n.hasNext();){var r=n.next();if(this._ptLocator.locate(t,r)!==oE.EXTERIOR)return!0}return!1},e.prototype.replaceCollapsedEdges=function(){for(var t=new nx,e=this._edgeList.iterator();e.hasNext();){var n=e.next();n.isCollapsed()&&(e.remove(),t.add(n.getCollapsedEdge()))}this._edgeList.addAll(t)},e.prototype.updateNodeLabelling=function(){for(var t=this._graph.getNodes().iterator();t.hasNext();){var e=t.next(),n=e.getEdges().getLabel();e.getLabel().merge(n)}},e.prototype.getResultGeometry=function(t){return this.computeOverlay(t),this._resultGeom},e.prototype.insertUniqueEdges=function(t){for(var e=t.iterator();e.hasNext();){var n=e.next();this.insertUniqueEdge(n)}},e.prototype.computeOverlay=function(t){this.copyPoints(0),this.copyPoints(1),this._arg[0].computeSelfNodes(this._li,!1),this._arg[1].computeSelfNodes(this._li,!1),this._arg[0].computeEdgeIntersections(this._arg[1],this._li,!0);var e=new nx;this._arg[0].computeSplitEdges(e),this._arg[1].computeSplitEdges(e),this.insertUniqueEdges(e),this.computeLabelsFromDepths(),this.replaceCollapsedEdges(),Fb.checkValid(this._edgeList.getEdges()),this._graph.addEdges(this._edgeList.getEdges()),this.computeLabelling(),this.labelIncompleteNodes(),this.findResultAreaEdges(t),this.cancelDuplicateResultEdges();var n=new UC(this._geomFact);n.add(this._graph),this._resultPolyList=n.getPolygons();var r=new Ub(this,this._geomFact,this._ptLocator);this._resultLineList=r.build(t);var i=new qb(this,this._geomFact,this._ptLocator);this._resultPointList=i.build(t),this._resultGeom=this.computeGeometry(this._resultPointList,this._resultLineList,this._resultPolyList,t)},e.prototype.labelIncompleteNode=function(t,e){var n=this._ptLocator.locate(t.getCoordinate(),this._arg[e].getGeometry());t.getLabel().setLocation(e,n)},e.prototype.copyPoints=function(t){for(var e=this._arg[t].getNodeIterator();e.hasNext();){var n=e.next();this._graph.addNode(n.getCoordinate()).setLabel(t,n.getLabel().getLocation(t))}},e.prototype.findResultAreaEdges=function(t){for(var n=this._graph.getEdgeEnds().iterator();n.hasNext();){var r=n.next(),i=r.getLabel();i.isArea()&&!r.isInteriorAreaEdge()&&e.isResultOfOp(i.getLocation(0,mC.RIGHT),i.getLocation(1,mC.RIGHT),t)&&r.setInResult(!0)}},e.prototype.computeLabelsFromDepths=function(){for(var t=this._edgeList.iterator();t.hasNext();){var e=t.next(),n=e.getLabel(),r=e.getDepth();if(!r.isNull()){r.normalize();for(var i=0;i<2;i++)n.isNull(i)||!n.isArea()||r.isNull(i)||(0===r.getDelta(i)?n.toLine(i):(TE.isTrue(!r.isNull(i,mC.LEFT),"depth of LEFT side has not been initialized"),n.setLocation(i,mC.LEFT,r.getLocation(i,mC.LEFT)),TE.isTrue(!r.isNull(i,mC.RIGHT),"depth of RIGHT side has not been initialized"),n.setLocation(i,mC.RIGHT,r.getLocation(i,mC.RIGHT))))}}},e.prototype.computeLabelling=function(){for(var t=this._graph.getNodes().iterator();t.hasNext();){t.next().getEdges().computeLabelling(this._arg)}this.mergeSymLabels(),this.updateNodeLabelling()},e.prototype.labelIncompleteNodes=function(){for(var t=this._graph.getNodes().iterator();t.hasNext();){var e=t.next(),n=e.getLabel();e.isIsolated()&&(n.isNull(0)?this.labelIncompleteNode(e,0):this.labelIncompleteNode(e,1)),e.getEdges().updateLabelling(n)}},e.prototype.isCoveredByA=function(t){return!!this.isCovered(t,this._resultPolyList)},e.prototype.interfaces_=function(){return[]},e.prototype.getClass=function(){return e},e}(mB);IB.overlayOp=function(t,e,n){return new IB(t,e).getResultGeometry(n)},IB.intersection=function(t,e){if(t.isEmpty()||e.isEmpty())return IB.createEmptyResult(IB.INTERSECTION,t,e,t.getFactory());if(t.isGeometryCollection()){var n=e;return Gb.map(t,{interfaces_:function(){return[_B.MapOp]},map:function(t){return t.intersection(n)}})}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),tB.overlayOp(t,e,IB.INTERSECTION)},IB.symDifference=function(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return IB.createEmptyResult(IB.SYMDIFFERENCE,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),tB.overlayOp(t,e,IB.SYMDIFFERENCE)},IB.resultDimension=function(t,e,n){var r=e.getDimension(),i=n.getDimension(),o=-1;switch(t){case IB.INTERSECTION:o=Math.min(r,i);break;case IB.UNION:o=Math.max(r,i);break;case IB.DIFFERENCE:o=r;break;case IB.SYMDIFFERENCE:o=Math.max(r,i)}return o},IB.createEmptyResult=function(t,e,n,r){var i=null;switch(IB.resultDimension(t,e,n)){case-1:i=r.createGeometryCollection(new Array(0).fill(null));break;case 0:i=r.createPoint();break;case 1:i=r.createLineString();break;case 2:i=r.createPolygon()}return i},IB.difference=function(t,e){return t.isEmpty()?IB.createEmptyResult(IB.DIFFERENCE,t,e,t.getFactory()):e.isEmpty()?t.copy():(t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),tB.overlayOp(t,e,IB.DIFFERENCE))},IB.isResultOfOp=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1],n=t.getLocation(0),r=t.getLocation(1);return IB.isResultOfOp(n,r,e)}if(3===arguments.length){var i=arguments[0],o=arguments[1];switch(i===oE.BOUNDARY&&(i=oE.INTERIOR),o===oE.BOUNDARY&&(o=oE.INTERIOR),arguments[2]){case IB.INTERSECTION:return i===oE.INTERIOR&&o===oE.INTERIOR;case IB.UNION:return i===oE.INTERIOR||o===oE.INTERIOR;case IB.DIFFERENCE:return i===oE.INTERIOR&&o!==oE.INTERIOR;case IB.SYMDIFFERENCE:return i===oE.INTERIOR&&o!==oE.INTERIOR||i!==oE.INTERIOR&&o===oE.INTERIOR}return!1}},IB.INTERSECTION=1,IB.UNION=2,IB.DIFFERENCE=3,IB.SYMDIFFERENCE=4;var EB=function(){this._g=null,this._boundaryDistanceTolerance=null,this._linework=null,this._ptLocator=new _b,this._seg=new cw;var t=arguments[0],e=arguments[1];this._g=t,this._boundaryDistanceTolerance=e,this._linework=this.extractLinework(t)};EB.prototype.isWithinToleranceOfBoundary=function(t){for(var e=this,n=0;n<this._linework.getNumGeometries();n++)for(var r=e._linework.getGeometryN(n).getCoordinateSequence(),i=0;i<r.size()-1;i++){if(r.getCoordinate(i,e._seg.p0),r.getCoordinate(i+1,e._seg.p1),e._seg.distance(t)<=e._boundaryDistanceTolerance)return!0}return!1},EB.prototype.getLocation=function(t){return this.isWithinToleranceOfBoundary(t)?oE.BOUNDARY:this._ptLocator.locate(t,this._g)},EB.prototype.extractLinework=function(t){var e=new xB;t.apply(e);var n=e.getLinework(),r=hC.toLineStringArray(n);return t.getFactory().createMultiLineString(r)},EB.prototype.interfaces_=function(){return[]},EB.prototype.getClass=function(){return EB};var xB=function(){this._linework=null,this._linework=new nx};xB.prototype.getLinework=function(){return this._linework},xB.prototype.filter=function(t){if(t instanceof Hx){var e=t;this._linework.add(e.getExteriorRing());for(var n=0;n<e.getNumInteriorRing();n++)this._linework.add(e.getInteriorRingN(n))}},xB.prototype.interfaces_=function(){return[Sx]},xB.prototype.getClass=function(){return xB};var CB=function(){this._g=null,this._doLeft=!0,this._doRight=!0;var t=arguments[0];this._g=t};CB.prototype.extractPoints=function(t,e,n){for(var r=t.getCoordinates(),i=0;i<r.length-1;i++)this.computeOffsetPoints(r[i],r[i+1],e,n)},CB.prototype.setSidesToGenerate=function(t,e){this._doLeft=t,this._doRight=e},CB.prototype.getPoints=function(t){for(var e=new nx,n=mb.getLines(this._g).iterator();n.hasNext();){var r=n.next();this.extractPoints(r,t,e)}return e},CB.prototype.computeOffsetPoints=function(t,e,n,r){var i=e.x-t.x,o=e.y-t.y,s=Math.sqrt(i*i+o*o),a=n*i/s,u=n*o/s,l=(e.x+t.x)/2,c=(e.y+t.y)/2;if(this._doLeft){var h=new eE(l-u,c+a);r.add(h)}if(this._doRight){var f=new eE(l+u,c-a);r.add(f)}},CB.prototype.interfaces_=function(){return[]},CB.prototype.getClass=function(){return CB};var wB=function t(){this._geom=null,this._locFinder=null,this._location=new Array(3).fill(null),this._invalidLocation=null,this._boundaryDistanceTolerance=t.TOLERANCE,this._testCoords=new nx;var e=arguments[0],n=arguments[1],r=arguments[2];this._boundaryDistanceTolerance=t.computeBoundaryDistanceTolerance(e,n),this._geom=[e,n,r],this._locFinder=[new EB(this._geom[0],this._boundaryDistanceTolerance),new EB(this._geom[1],this._boundaryDistanceTolerance),new EB(this._geom[2],this._boundaryDistanceTolerance)]},bB={TOLERANCE:{configurable:!0}};wB.prototype.reportResult=function(t,e,n){IE.out.println("Overlay result invalid - A:"+oE.toLocationSymbol(e[0])+" B:"+oE.toLocationSymbol(e[1])+" expected:"+(n?"i":"e")+" actual:"+oE.toLocationSymbol(e[2]))},wB.prototype.isValid=function(t){this.addTestPts(this._geom[0]),this.addTestPts(this._geom[1]);var e=this.checkValid(t);return e},wB.prototype.checkValid=function(){var t=this;if(1===arguments.length){for(var e=arguments[0],n=0;n<this._testCoords.size();n++){var r=t._testCoords.get(n);if(!t.checkValid(e,r))return t._invalidLocation=r,!1}return!0}if(2===arguments.length){var i=arguments[0],o=arguments[1];return this._location[0]=this._locFinder[0].getLocation(o),this._location[1]=this._locFinder[1].getLocation(o),this._location[2]=this._locFinder[2].getLocation(o),!!wB.hasLocation(this._location,oE.BOUNDARY)||this.isValidResult(i,this._location)}},wB.prototype.addTestPts=function(t){var e=new CB(t);this._testCoords.addAll(e.getPoints(5*this._boundaryDistanceTolerance))},wB.prototype.isValidResult=function(t,e){var n=IB.isResultOfOp(e[0],e[1],t),r=!(n^e[2]===oE.INTERIOR);return r||this.reportResult(t,e,n),r},wB.prototype.getInvalidLocation=function(){return this._invalidLocation},wB.prototype.interfaces_=function(){return[]},wB.prototype.getClass=function(){return wB},wB.hasLocation=function(t,e){for(var n=0;n<3;n++)if(t[n]===e)return!0;return!1},wB.computeBoundaryDistanceTolerance=function(t,e){return Math.min(Vb.computeSizeBasedSnapTolerance(t),Vb.computeSizeBasedSnapTolerance(e))},wB.isValid=function(t,e,n,r){return new wB(t,e,r).isValid(n)},bB.TOLERANCE.get=function(){return 1e-6},Object.defineProperties(wB,bB);var BB=function t(e){this._geomFactory=null,this._skipEmpty=!1,this._inputGeoms=null,this._geomFactory=t.extractFactory(e),this._inputGeoms=e};BB.prototype.extractElements=function(t,e){if(null===t)return null;for(var n=0;n<t.getNumGeometries();n++){var r=t.getGeometryN(n);this._skipEmpty&&r.isEmpty()||e.add(r)}},BB.prototype.combine=function(){for(var t=new nx,e=this._inputGeoms.iterator();e.hasNext();){var n=e.next();this.extractElements(n,t)}return 0===t.size()?null!==this._geomFactory?this._geomFactory.createGeometryCollection(null):null:this._geomFactory.buildGeometry(t)},BB.prototype.interfaces_=function(){return[]},BB.prototype.getClass=function(){return BB},BB.combine=function(){return 1===arguments.length?new BB(arguments[0]).combine():2===arguments.length?new BB(BB.createList(arguments[0],arguments[1])).combine():3===arguments.length?new BB(BB.createList(arguments[0],arguments[1],arguments[2])).combine():void 0},BB.extractFactory=function(t){return t.isEmpty()?null:t.iterator().next().getFactory()},BB.createList=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1],n=new nx;return n.add(t),n.add(e),n}if(3===arguments.length){var r=arguments[0],i=arguments[1],o=arguments[2],s=new nx;return s.add(r),s.add(i),s.add(o),s}};var SB=function(){this._inputPolys=null,this._geomFactory=null;var t=arguments[0];this._inputPolys=t,null===this._inputPolys&&(this._inputPolys=new nx)},MB={STRTREE_NODE_CAPACITY:{configurable:!0}};SB.prototype.reduceToGeometries=function(t){for(var e=new nx,n=t.iterator();n.hasNext();){var r=n.next(),i=null;aE(r,tx)?i=this.unionTree(r):r instanceof UE&&(i=r),e.add(i)}return e},SB.prototype.extractByEnvelope=function(t,e,n){for(var r=new nx,i=0;i<e.getNumGeometries();i++){var o=e.getGeometryN(i);o.getEnvelopeInternal().intersects(t)?r.add(o):n.add(o)}return this._geomFactory.buildGeometry(r)},SB.prototype.unionOptimized=function(t,e){var n=t.getEnvelopeInternal(),r=e.getEnvelopeInternal();if(!n.intersects(r))return BB.combine(t,e);if(t.getNumGeometries()<=1&&e.getNumGeometries()<=1)return this.unionActual(t,e);var i=n.intersection(r);return this.unionUsingEnvelopeIntersection(t,e,i)},SB.prototype.union=function(){if(null===this._inputPolys)throw new Error("union() method cannot be called twice");if(this._inputPolys.isEmpty())return null;this._geomFactory=this._inputPolys.iterator().next().getFactory();for(var t=new ew(SB.STRTREE_NODE_CAPACITY),e=this._inputPolys.iterator();e.hasNext();){var n=e.next();t.insert(n.getEnvelopeInternal(),n)}this._inputPolys=null;var r=t.itemsTree();return this.unionTree(r)},SB.prototype.binaryUnion=function(){if(1===arguments.length){var t=arguments[0];return this.binaryUnion(t,0,t.size())}if(3===arguments.length){var e=arguments[0],n=arguments[1],r=arguments[2];if(r-n<=1){var i=SB.getGeometry(e,n);return this.unionSafe(i,null)}if(r-n==2)return this.unionSafe(SB.getGeometry(e,n),SB.getGeometry(e,n+1));var o=Math.trunc((r+n)/2),s=this.binaryUnion(e,n,o),a=this.binaryUnion(e,o,r);return this.unionSafe(s,a)}},SB.prototype.repeatedUnion=function(t){for(var e=null,n=t.iterator();n.hasNext();){var r=n.next();e=null===e?r.copy():e.union(r)}return e},SB.prototype.unionSafe=function(t,e){return null===t&&null===e?null:null===t?e.copy():null===e?t.copy():this.unionOptimized(t,e)},SB.prototype.unionActual=function(t,e){return SB.restrictToPolygons(t.union(e))},SB.prototype.unionTree=function(t){var e=this.reduceToGeometries(t);return this.binaryUnion(e)},SB.prototype.unionUsingEnvelopeIntersection=function(t,e,n){var r=new nx,i=this.extractByEnvelope(n,t,r),o=this.extractByEnvelope(n,e,r),s=this.unionActual(i,o);return r.add(s),BB.combine(r)},SB.prototype.bufferUnion=function(){if(1===arguments.length){var t=arguments[0];return t.get(0).getFactory().buildGeometry(t).buffer(0)}if(2===arguments.length){var e=arguments[0],n=arguments[1];return e.getFactory().createGeometryCollection([e,n]).buffer(0)}},SB.prototype.interfaces_=function(){return[]},SB.prototype.getClass=function(){return SB},SB.restrictToPolygons=function(t){if(aE(t,Yx))return t;var e=vb.getPolygons(t);return 1===e.size()?e.get(0):t.getFactory().createMultiPolygon(hC.toPolygonArray(e))},SB.getGeometry=function(t,e){return e>=t.size()?null:t.get(e)},SB.union=function(t){return new SB(t).union()},MB.STRTREE_NODE_CAPACITY.get=function(){return 4},Object.defineProperties(SB,MB);var LB=function(){};function NB(){return new TB}function TB(){this.reset()}LB.prototype.interfaces_=function(){return[]},LB.prototype.getClass=function(){return LB},LB.union=function(t,e){if(t.isEmpty()||e.isEmpty()){if(t.isEmpty()&&e.isEmpty())return IB.createEmptyResult(IB.UNION,t,e,t.getFactory());if(t.isEmpty())return e.copy();if(e.isEmpty())return t.copy()}return t.checkNotGeometryCollection(t),t.checkNotGeometryCollection(e),tB.overlayOp(t,e,IB.UNION)},TB.prototype={constructor:TB,reset:function(){this.s=this.t=0},add:function(t){QB(RB,t,this.t),QB(this,RB.s,this.s),this.s?this.t+=RB.t:this.s=RB.t},valueOf:function(){return this.s}};var RB=new TB;function QB(t,e,n){var r=t.s=e+n,i=r-e,o=r-i;t.t=e-o+(n-i)}var DB=1e-6,PB=Math.PI,kB=PB/2,OB=PB/4,FB=2*PB,GB=180/PB,UB=PB/180,qB=Math.abs,jB=Math.atan,zB=Math.atan2,VB=Math.cos,YB=Math.sin,HB=Math.sqrt;function XB(t){return t>1?0:t<-1?PB:Math.acos(t)}function JB(t){return t>1?kB:t<-1?-kB:Math.asin(t)}function WB(){}function KB(t,e){t&&eS.hasOwnProperty(t.type)&&eS[t.type](t,e)}var ZB,$B,tS={Feature:function(t,e){KB(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,i=n.length;++r<i;)KB(n[r].geometry,e)}},eS={Sphere:function(t,e){e.sphere()},Point:function(t,e){t=t.coordinates,e.point(t[0],t[1],t[2])},MultiPoint:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)t=n[r],e.point(t[0],t[1],t[2])},LineString:function(t,e){nS(t.coordinates,e,0)},MultiLineString:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)nS(n[r],e,0)},Polygon:function(t,e){rS(t.coordinates,e)},MultiPolygon:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)rS(n[r],e)},GeometryCollection:function(t,e){for(var n=t.geometries,r=-1,i=n.length;++r<i;)KB(n[r],e)}};function nS(t,e,n){var r,i=-1,o=t.length-n;for(e.lineStart();++i<o;)r=t[i],e.point(r[0],r[1],r[2]);e.lineEnd()}function rS(t,e){var n=-1,r=t.length;for(e.polygonStart();++n<r;)nS(t[n],e,1);e.polygonEnd()}function iS(t){return[zB(t[1],t[0]),JB(t[2])]}function oS(t){var e=t[0],n=t[1],r=VB(n);return[r*VB(e),r*YB(e),YB(n)]}function sS(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function aS(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function uS(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function lS(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function cS(t){var e=HB(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}function hS(t,e){function n(n,r){return n=t(n,r),e(n[0],n[1])}return t.invert&&e.invert&&(n.invert=function(n,r){return(n=e.invert(n,r))&&t.invert(n[0],n[1])}),n}function fS(t,e){return[t>PB?t-FB:t<-PB?t+FB:t,e]}function pS(t){return function(e,n){return[(e+=t)>PB?e-FB:e<-PB?e+FB:e,n]}}function gS(t){var e=pS(t);return e.invert=pS(-t),e}function AS(t,e){var n=VB(t),r=YB(t),i=VB(e),o=YB(e);function s(t,e){var s=VB(e),a=VB(t)*s,u=YB(t)*s,l=YB(e),c=l*n+a*r;return[zB(u*i-c*o,a*n-l*r),JB(c*i+u*o)]}return s.invert=function(t,e){var s=VB(e),a=VB(t)*s,u=YB(t)*s,l=YB(e),c=l*i-u*o;return[zB(u*i+l*o,a*n+c*r),JB(c*n-a*r)]},s}function dS(t,e){(e=oS(e))[0]-=t,cS(e);var n=XB(-e[1]);return((-e[2]<0?-n:n)+FB-DB)%FB}function yS(){var t,e=[];return{point:function(e,n){t.push([e,n])},lineStart:function(){e.push(t=[])},lineEnd:WB,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}}function vS(t,e){return qB(t[0]-e[0])<DB&&qB(t[1]-e[1])<DB}function mS(t,e,n,r){this.x=t,this.z=e,this.o=n,this.e=r,this.v=!1,this.n=this.p=null}function _S(t,e,n,r,i){var o,s,a=[],u=[];if(t.forEach((function(t){if(!((e=t.length-1)<=0)){var e,n,r=t[0],s=t[e];if(vS(r,s)){for(i.lineStart(),o=0;o<e;++o)i.point((r=t[o])[0],r[1]);i.lineEnd()}else a.push(n=new mS(r,t,null,!0)),u.push(n.o=new mS(r,null,n,!1)),a.push(n=new mS(s,t,null,!1)),u.push(n.o=new mS(s,null,n,!0))}})),a.length){for(u.sort(e),IS(a),IS(u),o=0,s=u.length;o<s;++o)u[o].e=n=!n;for(var l,c,h=a[0];;){for(var f=h,p=!0;f.v;)if((f=f.n)===h)return;l=f.z,i.lineStart();do{if(f.v=f.o.v=!0,f.e){if(p)for(o=0,s=l.length;o<s;++o)i.point((c=l[o])[0],c[1]);else r(f.x,f.n.x,1,i);f=f.n}else{if(p)for(l=f.p.z,o=l.length-1;o>=0;--o)i.point((c=l[o])[0],c[1]);else r(f.x,f.p.x,-1,i);f=f.p}l=(f=f.o).z,p=!p}while(!f.v);i.lineEnd()}}}function IS(t){if(e=t.length){for(var e,n,r=0,i=t[0];++r<e;)i.n=n=t[r],n.p=i,i=n;i.n=n=t[0],n.p=i}}function ES(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function xS(t){for(var e,n,r,i=t.length,o=-1,s=0;++o<i;)s+=t[o].length;for(n=new Array(s);--i>=0;)for(e=(r=t[i]).length;--e>=0;)n[--s]=r[e];return n}NB(),NB(),NB(),fS.invert=fS,1===(ZB=ES).length&&($B=ZB,ZB=function(t,e){return ES($B(t),e)});var CS=1e9,wS=-CS;function bS(t,e,n,r){function i(i,o){return t<=i&&i<=n&&e<=o&&o<=r}function o(i,o,a,l){var c=0,h=0;if(null==i||(c=s(i,a))!==(h=s(o,a))||u(i,o)<0^a>0)do{l.point(0===c||3===c?t:n,c>1?r:e)}while((c=(c+a+4)%4)!==h);else l.point(o[0],o[1])}function s(r,i){return qB(r[0]-t)<DB?i>0?0:3:qB(r[0]-n)<DB?i>0?2:1:qB(r[1]-e)<DB?i>0?1:0:i>0?3:2}function a(t,e){return u(t.x,e.x)}function u(t,e){var n=s(t,1),r=s(e,1);return n!==r?n-r:0===n?e[1]-t[1]:1===n?t[0]-e[0]:2===n?t[1]-e[1]:e[0]-t[0]}return function(s){var u,l,c,h,f,p,g,A,d,y,v,m=s,_=yS(),I={point:E,lineStart:function(){I.point=x,l&&l.push(c=[]);y=!0,d=!1,g=A=NaN},lineEnd:function(){u&&(x(h,f),p&&d&&_.rejoin(),u.push(_.result()));I.point=E,d&&m.lineEnd()},polygonStart:function(){m=_,u=[],l=[],v=!0},polygonEnd:function(){var e=function(){for(var e=0,n=0,i=l.length;n<i;++n)for(var o,s,a=l[n],u=1,c=a.length,h=a[0],f=h[0],p=h[1];u<c;++u)o=f,s=p,f=(h=a[u])[0],p=h[1],s<=r?p>r&&(f-o)*(r-s)>(p-s)*(t-o)&&++e:p<=r&&(f-o)*(r-s)<(p-s)*(t-o)&&--e;return e}(),n=v&&e,i=(u=xS(u)).length;(n||i)&&(s.polygonStart(),n&&(s.lineStart(),o(null,null,1,s),s.lineEnd()),i&&_S(u,a,e,o,s),s.polygonEnd());m=s,u=l=c=null}};function E(t,e){i(t,e)&&m.point(t,e)}function x(o,s){var a=i(o,s);if(l&&c.push([o,s]),y)h=o,f=s,p=a,y=!1,a&&(m.lineStart(),m.point(o,s));else if(a&&d)m.point(o,s);else{var u=[g=Math.max(wS,Math.min(CS,g)),A=Math.max(wS,Math.min(CS,A))],_=[o=Math.max(wS,Math.min(CS,o)),s=Math.max(wS,Math.min(CS,s))];!function(t,e,n,r,i,o){var s,a=t[0],u=t[1],l=0,c=1,h=e[0]-a,f=e[1]-u;if(s=n-a,h||!(s>0)){if(s/=h,h<0){if(s<l)return;s<c&&(c=s)}else if(h>0){if(s>c)return;s>l&&(l=s)}if(s=i-a,h||!(s<0)){if(s/=h,h<0){if(s>c)return;s>l&&(l=s)}else if(h>0){if(s<l)return;s<c&&(c=s)}if(s=r-u,f||!(s>0)){if(s/=f,f<0){if(s<l)return;s<c&&(c=s)}else if(f>0){if(s>c)return;s>l&&(l=s)}if(s=o-u,f||!(s<0)){if(s/=f,f<0){if(s>c)return;s>l&&(l=s)}else if(f>0){if(s<l)return;s<c&&(c=s)}return l>0&&(t[0]=a+l*h,t[1]=u+l*f),c<1&&(e[0]=a+c*h,e[1]=u+c*f),!0}}}}}(u,_,t,e,n,r)?a&&(m.lineStart(),m.point(o,s),v=!1):(d||(m.lineStart(),m.point(u[0],u[1])),m.point(_[0],_[1]),a||m.lineEnd(),v=!1)}g=o,A=s,d=a}return I}}var BS=NB();function SS(t){return t}NB(),NB(),NB();var MS=1/0,LS=MS,NS=-MS,TS=NS,RS={point:function(t,e){t<MS&&(MS=t);t>NS&&(NS=t);e<LS&&(LS=e);e>TS&&(TS=e)},lineStart:WB,lineEnd:WB,polygonStart:WB,polygonEnd:WB,result:function(){var t=[[MS,LS],[NS,TS]];return NS=TS=-(LS=MS=1/0),t}};function QS(t,e,n,r){return function(i,o){var s,a,u,l=e(o),c=i.invert(r[0],r[1]),h=yS(),f=e(h),p=!1,g={point:A,lineStart:y,lineEnd:v,polygonStart:function(){g.point=m,g.lineStart=_,g.lineEnd=I,a=[],s=[]},polygonEnd:function(){g.point=A,g.lineStart=y,g.lineEnd=v,a=xS(a);var t=function(t,e){var n=e[0],r=e[1],i=[YB(n),-VB(n),0],o=0,s=0;BS.reset();for(var a=0,u=t.length;a<u;++a)if(c=(l=t[a]).length)for(var l,c,h=l[c-1],f=h[0],p=h[1]/2+OB,g=YB(p),A=VB(p),d=0;d<c;++d,f=v,g=_,A=I,h=y){var y=l[d],v=y[0],m=y[1]/2+OB,_=YB(m),I=VB(m),E=v-f,x=E>=0?1:-1,C=x*E,w=C>PB,b=g*_;if(BS.add(zB(b*x*YB(C),A*I+b*VB(C))),o+=w?E+x*FB:E,w^f>=n^v>=n){var B=aS(oS(h),oS(y));cS(B);var S=aS(i,B);cS(S);var M=(w^E>=0?-1:1)*JB(S[2]);(r>M||r===M&&(B[0]||B[1]))&&(s+=w^E>=0?1:-1)}}return(o<-DB||o<DB&&BS<-DB)^1&s}(s,c);a.length?(p||(o.polygonStart(),p=!0),_S(a,PS,t,n,o)):t&&(p||(o.polygonStart(),p=!0),o.lineStart(),n(null,null,1,o),o.lineEnd()),p&&(o.polygonEnd(),p=!1),a=s=null},sphere:function(){o.polygonStart(),o.lineStart(),n(null,null,1,o),o.lineEnd(),o.polygonEnd()}};function A(e,n){var r=i(e,n);t(e=r[0],n=r[1])&&o.point(e,n)}function d(t,e){var n=i(t,e);l.point(n[0],n[1])}function y(){g.point=d,l.lineStart()}function v(){g.point=A,l.lineEnd()}function m(t,e){u.push([t,e]);var n=i(t,e);f.point(n[0],n[1])}function _(){f.lineStart(),u=[]}function I(){m(u[0][0],u[0][1]),f.lineEnd();var t,e,n,r,i=f.clean(),l=h.result(),c=l.length;if(u.pop(),s.push(u),u=null,c)if(1&i){if((e=(n=l[0]).length-1)>0){for(p||(o.polygonStart(),p=!0),o.lineStart(),t=0;t<e;++t)o.point((r=n[t])[0],r[1]);o.lineEnd()}}else c>1&&2&i&&l.push(l.pop().concat(l.shift())),a.push(l.filter(DS))}return g}}function DS(t){return t.length>1}function PS(t,e){return((t=t.x)[0]<0?t[1]-kB-DB:kB-t[1])-((e=e.x)[0]<0?e[1]-kB-DB:kB-e[1])}NB();var kS=QS((function(){return!0}),(function(t){var e,n=NaN,r=NaN,i=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(o,s){var a=o>0?PB:-PB,u=qB(o-n);qB(u-PB)<DB?(t.point(n,r=(r+s)/2>0?kB:-kB),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(a,r),t.point(o,r),e=0):i!==a&&u>=PB&&(qB(n-i)<DB&&(n-=i*DB),qB(o-a)<DB&&(o-=a*DB),r=function(t,e,n,r){var i,o,s=YB(t-n);return qB(s)>DB?jB((YB(e)*(o=VB(r))*YB(n)-YB(r)*(i=VB(e))*YB(t))/(i*o*s)):(e+r)/2}(n,r,o,s),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(a,r),e=0),t.point(n=o,r=s),i=a},lineEnd:function(){t.lineEnd(),n=r=NaN},clean:function(){return 2-e}}}),(function(t,e,n,r){var i;if(null==t)i=n*kB,r.point(-PB,i),r.point(0,i),r.point(PB,i),r.point(PB,0),r.point(PB,-i),r.point(0,-i),r.point(-PB,-i),r.point(-PB,0),r.point(-PB,i);else if(qB(t[0]-e[0])>DB){var o=t[0]<e[0]?PB:-PB;i=n*o/2,r.point(-o,i),r.point(0,i),r.point(o,i)}else r.point(e[0],e[1])}),[-PB,-kB]);function OS(t,e){var n=VB(t),r=n>0,i=qB(n)>DB;function o(t,e){return VB(t)*VB(e)>n}function s(t,e,r){var i=[1,0,0],o=aS(oS(t),oS(e)),s=sS(o,o),a=o[0],u=s-a*a;if(!u)return!r&&t;var l=n*s/u,c=-n*a/u,h=aS(i,o),f=lS(i,l);uS(f,lS(o,c));var p=h,g=sS(f,p),A=sS(p,p),d=g*g-A*(sS(f,f)-1);if(!(d<0)){var y=HB(d),v=lS(p,(-g-y)/A);if(uS(v,f),v=iS(v),!r)return v;var m,_=t[0],I=e[0],E=t[1],x=e[1];I<_&&(m=_,_=I,I=m);var C=I-_,w=qB(C-PB)<DB;if(!w&&x<E&&(m=E,E=x,x=m),w||C<DB?w?E+x>0^v[1]<(qB(v[0]-_)<DB?E:x):E<=v[1]&&v[1]<=x:C>PB^(_<=v[0]&&v[0]<=I)){var b=lS(p,(-g+y)/A);return uS(b,f),[v,iS(b)]}}}function a(e,n){var i=r?t:PB-t,o=0;return e<-i?o|=1:e>i&&(o|=2),n<-i?o|=4:n>i&&(o|=8),o}return QS(o,(function(t){var e,n,u,l,c;return{lineStart:function(){l=u=!1,c=1},point:function(h,f){var p,g=[h,f],A=o(h,f),d=r?A?0:a(h,f):A?a(h+(h<0?PB:-PB),f):0;if(!e&&(l=u=A)&&t.lineStart(),A!==u&&(!(p=s(e,g))||vS(e,p)||vS(g,p))&&(g[0]+=DB,g[1]+=DB,A=o(g[0],g[1])),A!==u)c=0,A?(t.lineStart(),p=s(g,e),t.point(p[0],p[1])):(p=s(e,g),t.point(p[0],p[1]),t.lineEnd()),e=p;else if(i&&e&&r^A){var y;d&n||!(y=s(g,e,!0))||(c=0,r?(t.lineStart(),t.point(y[0][0],y[0][1]),t.point(y[1][0],y[1][1]),t.lineEnd()):(t.point(y[1][0],y[1][1]),t.lineEnd(),t.lineStart(),t.point(y[0][0],y[0][1])))}!A||e&&vS(e,g)||t.point(g[0],g[1]),e=g,u=A,n=d},lineEnd:function(){u&&t.lineEnd(),e=null},clean:function(){return c|(l&&u)<<1}}}),(function(n,r,i,o){!function(t,e,n,r,i,o){if(n){var s=VB(e),a=YB(e),u=r*n;null==i?(i=e+r*FB,o=e-u/2):(i=dS(s,i),o=dS(s,o),(r>0?i<o:i>o)&&(i+=r*FB));for(var l,c=i;r>0?c>o:c<o;c-=u)l=iS([s,-a*VB(c),-a*YB(c)]),t.point(l[0],l[1])}}(o,t,e,i,n,r)}),r?[0,-t]:[-PB,t-PB])}function FS(t){return function(e){var n=new GS;for(var r in t)n[r]=t[r];return n.stream=e,n}}function GS(){}function US(t,e,n){var r=e[1][0]-e[0][0],i=e[1][1]-e[0][1],o=t.clipExtent&&t.clipExtent();t.scale(150).translate([0,0]),null!=o&&t.clipExtent(null),function(t,e){t&&tS.hasOwnProperty(t.type)?tS[t.type](t,e):KB(t,e)}(n,t.stream(RS));var s=RS.result(),a=Math.min(r/(s[1][0]-s[0][0]),i/(s[1][1]-s[0][1])),u=+e[0][0]+(r-a*(s[1][0]+s[0][0]))/2,l=+e[0][1]+(i-a*(s[1][1]+s[0][1]))/2;return null!=o&&t.clipExtent(o),t.scale(150*a).translate([u,l])}GS.prototype={constructor:GS,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var qS=16,jS=VB(30*UB);function zS(t,e){return+e?function(t,e){function n(r,i,o,s,a,u,l,c,h,f,p,g,A,d){var y=l-r,v=c-i,m=y*y+v*v;if(m>4*e&&A--){var _=s+f,I=a+p,E=u+g,x=HB(_*_+I*I+E*E),C=JB(E/=x),w=qB(qB(E)-1)<DB||qB(o-h)<DB?(o+h)/2:zB(I,_),b=t(w,C),B=b[0],S=b[1],M=B-r,L=S-i,N=v*M-y*L;(N*N/m>e||qB((y*M+v*L)/m-.5)>.3||s*f+a*p+u*g<jS)&&(n(r,i,o,s,a,u,B,S,w,_/=x,I/=x,E,A,d),d.point(B,S),n(B,S,w,_,I,E,l,c,h,f,p,g,A,d))}}return function(e){var r,i,o,s,a,u,l,c,h,f,p,g,A={point:d,lineStart:y,lineEnd:m,polygonStart:function(){e.polygonStart(),A.lineStart=_},polygonEnd:function(){e.polygonEnd(),A.lineStart=y}};function d(n,r){n=t(n,r),e.point(n[0],n[1])}function y(){c=NaN,A.point=v,e.lineStart()}function v(r,i){var o=oS([r,i]),s=t(r,i);n(c,h,l,f,p,g,c=s[0],h=s[1],l=r,f=o[0],p=o[1],g=o[2],qS,e),e.point(c,h)}function m(){A.point=d,e.lineEnd()}function _(){y(),A.point=I,A.lineEnd=E}function I(t,e){v(r=t,e),i=c,o=h,s=f,a=p,u=g,A.point=v}function E(){n(c,h,l,f,p,g,i,o,r,s,a,u,qS,e),A.lineEnd=m,m()}return A}}(t,e):function(t){return FS({point:function(e,n){e=t(e,n),this.stream.point(e[0],e[1])}})}(t)}var VS=FS({point:function(t,e){this.stream.point(t*UB,e*UB)}});function YS(t){return function(t){var e,n,r,i,o,s,a,u,l,c,h=150,f=480,p=250,g=0,A=0,d=0,y=0,v=0,m=null,_=kS,I=null,E=SS,x=.5,C=zS(B,x);function w(t){return[(t=o(t[0]*UB,t[1]*UB))[0]*h+n,r-t[1]*h]}function b(t){return(t=o.invert((t[0]-n)/h,(r-t[1])/h))&&[t[0]*GB,t[1]*GB]}function B(t,i){return[(t=e(t,i))[0]*h+n,r-t[1]*h]}function S(){o=hS(i=function(t,e,n){return(t%=FB)?e||n?hS(gS(t),AS(e,n)):gS(t):e||n?AS(e,n):fS}(d,y,v),e);var t=e(g,A);return n=f-t[0]*h,r=p+t[1]*h,M()}function M(){return l=c=null,w}return w.stream=function(t){return l&&c===t?l:l=VS(_(i,C(E(c=t))))},w.clipAngle=function(t){return arguments.length?(_=+t?OS(m=t*UB,6*UB):(m=null,kS),M()):m*GB},w.clipExtent=function(t){return arguments.length?(E=null==t?(I=s=a=u=null,SS):bS(I=+t[0][0],s=+t[0][1],a=+t[1][0],u=+t[1][1]),M()):null==I?null:[[I,s],[a,u]]},w.scale=function(t){return arguments.length?(h=+t,S()):h},w.translate=function(t){return arguments.length?(f=+t[0],p=+t[1],S()):[f,p]},w.center=function(t){return arguments.length?(g=t[0]%360*UB,A=t[1]%360*UB,S()):[g*GB,A*GB]},w.rotate=function(t){return arguments.length?(d=t[0]%360*UB,y=t[1]%360*UB,v=t.length>2?t[2]%360*UB:0,S()):[d*GB,y*GB,v*GB]},w.precision=function(t){return arguments.length?(C=zS(B,x=t*t),M()):HB(x)},w.fitExtent=function(t,e){return US(w,t,e)},w.fitSize=function(t,e){return function(t,e,n){return US(t,[[0,0],e],n)}(w,t,e)},function(){return e=t.apply(this,arguments),w.invert=e.invert&&b,S()}}((function(){return t}))()}function HS(t){return function(e,n){var r=VB(e),i=VB(n),o=t(r*i);return[o*i*YB(e),o*YB(n)]}}function XS(t){return function(e,n){var r=HB(e*e+n*n),i=t(r),o=YB(i),s=VB(i);return[zB(e*o,r*s),JB(r&&n*o/r)]}}HS((function(t){return HB(2/(1+t))})).invert=XS((function(t){return 2*JB(t/2)}));var JS=HS((function(t){return(t=XB(t))&&t/YB(t)}));function WS(){return YS(JS).scale(79.4188).clipAngle(179.999)}function KS(t,e){return[t,e]}function ZS(t,e,n,r){var i=t.properties||{},o="Feature"===t.type?t.geometry:t;if("GeometryCollection"===o.type){var s=[];return Fl(t,(function(t){var i=ZS(t,e,n,r);i&&s.push(i)})),hn(s)}var a=function(t){var e=Vf(t).geometry.coordinates,n=[-e[0],-e[1]];return WS().rotate(n).scale(Ze)}(o),u={type:o.type,coordinates:tM(o.coordinates,a)},l=(new yC).read(u),c=yn(vn(e,n),"meters"),h=cb.bufferOp(l,c,r);if(!$S((h=(new vC).write(h)).coordinates))return nn({type:h.type,coordinates:eM(h.coordinates,a)},i)}function $S(t){return Array.isArray(t[0])?$S(t[0]):isNaN(t[0])}function tM(t,e){return"object"!=typeof t[0]?e(t):t.map((function(t){return tM(t,e)}))}function eM(t,e){return"object"!=typeof t[0]?e.invert(t):t.map((function(t){return eM(t,e)}))}function nM(t,e,n){void 0===n&&(n={});var r=Pn(t),i=Pn(e),o=YI.intersection(r.coordinates,i.coordinates);return 0===o.length?null:1===o.length?an(o[0],n.properties):gn(o,n.properties)}function rM(t,e,n){void 0===n&&(n={});var r=JSON.stringify(n.properties||{}),i=t[0],o=t[1],s=t[2],a=t[3],u=(o+a)/2,l=(i+s)/2,c=2*e/Fn([i,u],[s,u],n)*(s-i),h=2*e/Fn([l,o],[l,a],n)*(a-o),f=c/2,p=2*f,g=Math.sqrt(3)/2*h,A=s-i,d=a-o,y=3/4*p,v=g,m=(A-p)/(p-f/2),_=Math.floor(m),I=(_*y-f/2-A)/2-f/2+y/2,E=Math.floor((d-g)/g),x=(d-E*g)/2,C=E*g-d>g/2;C&&(x-=g/4);for(var w=[],b=[],B=0;B<6;B++){var S=2*Math.PI/6*B;w.push(Math.cos(S)),b.push(Math.sin(S))}for(var M=[],L=0;L<=_;L++)for(var N=0;N<=E;N++){var T=L%2==1;if((0!==N||!T)&&(0!==N||!C)){var R=L*y+i-I,Q=N*v+o+x;if(T&&(Q-=g/2),!0===n.triangles)oM([R,Q],c/2,h/2,JSON.parse(r),w,b).forEach((function(t){n.mask?nM(n.mask,t)&&M.push(t):M.push(t)}));else{var D=iM([R,Q],c/2,h/2,JSON.parse(r),w,b);n.mask?nM(n.mask,D)&&M.push(D):M.push(D)}}}return hn(M)}function iM(t,e,n,r,i,o){for(var s=[],a=0;a<6;a++){var u=t[0]+e*i[a],l=t[1]+n*o[a];s.push([u,l])}return s.push(s[0].slice()),an([s],r)}function oM(t,e,n,r,i,o){for(var s=[],a=0;a<6;a++){var u=[];u.push(t),u.push([t[0]+e*i[a],t[1]+n*o[a]]),u.push([t[0]+e*i[(a+1)%6],t[1]+n*o[(a+1)%6]]),u.push(t),s.push(an([u],r))}return s}function sM(t){return gn(t)}function aM(t){return an(t&&t.geometry.coordinates||[[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]]])}function uM(t,e,n){return void 0===n&&(n={}),function(t,e,n,r){void 0===r&&(r={});for(var i=[],o=t[0],s=t[1],a=t[2],u=t[3],l=e/Fn([o,s],[a,s],r)*(a-o),c=n/Fn([o,s],[o,u],r)*(u-s),h=a-o,f=u-s,p=Math.floor(h/l),g=Math.floor(f/c),A=(f-g*c)/2,d=o+(h-p*l)/2,y=0;y<p;y++){for(var v=s+A,m=0;m<g;m++){var _=an([[[d,v],[d,v+c],[d+l,v+c],[d+l,v],[d,v]]],r.properties);r.mask?dm(r.mask,_)&&i.push(_):i.push(_),v+=c}d+=l}return hn(i)}(t,e,e,n)}function lM(t,e,n){void 0===n&&(n={});for(var r=[],i=e/Fn([t[0],t[1]],[t[2],t[1]],n)*(t[2]-t[0]),o=e/Fn([t[0],t[1]],[t[0],t[3]],n)*(t[3]-t[1]),s=0,a=t[0];a<=t[2];){for(var u=0,l=t[1];l<=t[3];){var c=null,h=null;s%2==0&&u%2==0?(c=an([[[a,l],[a,l+o],[a+i,l],[a,l]]],n.properties),h=an([[[a,l+o],[a+i,l+o],[a+i,l],[a,l+o]]],n.properties)):s%2==0&&u%2==1?(c=an([[[a,l],[a+i,l+o],[a+i,l],[a,l]]],n.properties),h=an([[[a,l],[a,l+o],[a+i,l+o],[a,l]]],n.properties)):u%2==0&&s%2==1?(c=an([[[a,l],[a,l+o],[a+i,l+o],[a,l]]],n.properties),h=an([[[a,l],[a+i,l+o],[a+i,l],[a,l]]],n.properties)):u%2==1&&s%2==1&&(c=an([[[a,l],[a,l+o],[a+i,l],[a,l]]],n.properties),h=an([[[a,l+o],[a+i,l+o],[a+i,l],[a,l+o]]],n.properties)),n.mask?(nM(n.mask,c)&&r.push(c),nM(n.mask,h)&&r.push(h)):(r.push(c),r.push(h)),l+=o,u++}s++,a+=i}return hn(r)}JS.invert=XS((function(t){return t})),KS.invert=KS;var cM=Object.freeze({__proto__:null,projection:G_,random:X_,clusters:nI,helpers:Mn,invariant:On,meta:Jl,isolines:function(t,e,n){if(!bn(n=n||{}))throw new Error("options is invalid");var r=n.zProperty||"elevation",i=n.commonProperties||{},o=n.breaksProperties||[];if(Dn(t,"Point","Input must contain Points"),!e)throw new Error("breaks is required");if(!Array.isArray(e))throw new Error("breaks must be an Array");if(!bn(i))throw new Error("commonProperties must be an Object");if(!Array.isArray(o))throw new Error("breaksProperties must be an Array");var s=Wc(t,{zProperty:r,flip:!0}),a=function(t,e,n,r,i){for(var o=[],s=1;s<e.length;s++){var a=+e[s],u=qc({},r,i[s]);u[n]=a;var l=fn(Vc(t,a),u);o.push(l)}return o}(s,e,r,i,o),u=function(t,e,n){var r=Oc(n),i=r[2]-r[0],o=r[3]-r[1],s=r[0],a=r[1],u=e[0].length-1,l=e.length-1,c=i/u,h=o/l,f=function(t){t[0]=t[0]*c+s,t[1]=t[1]*h+a};return t.forEach((function(t){Tl(t,f)})),t}(a,s,t);return hn(u)},convex:qh,pointsWithinPolygon:jh,within:jh,concave:function(t,e){void 0===e&&(e={});var n=e.maxEdge||1/0,r=function(t){var e=[],n={};return Pl(t,(function(t){if(t.geometry){var r=t.geometry.coordinates.join("-");Object.prototype.hasOwnProperty.call(n,r)||(e.push(t),n[r]=!0)}})),hn(e)}(t),i=zh(r);if(i.features=i.features.filter((function(t){var r=t.geometry.coordinates[0][0],i=t.geometry.coordinates[0][1],o=t.geometry.coordinates[0][2],s=Fn(r,i,e),a=Fn(i,o,e),u=Fn(r,o,e);return s<=n&&a<=n&&u<=n})),i.features.length<1)return null;var o=mf(i);return 1===o.coordinates.length&&(o.coordinates=o.coordinates[0],o.type="Polygon"),nn(o)},collect:function(t,e,n,r){var i=Pf(6),o=e.features.map((function(t){var e;return{minX:t.geometry.coordinates[0],minY:t.geometry.coordinates[1],maxX:t.geometry.coordinates[0],maxY:t.geometry.coordinates[1],property:null===(e=t.properties)||void 0===e?void 0:e[n]}}));return i.load(o),t.features.forEach((function(t){t.properties||(t.properties={});var e=Oc(t),n=i.search({minX:e[0],minY:e[1],maxX:e[2],maxY:e[3]}),o=[];n.forEach((function(e){Gn([e.minX,e.minY],t)&&o.push(e.property)})),t.properties[r]=o})),t},flip:function(t,e){if(!bn(e=e||{}))throw new Error("options is invalid");var n=e.mutate;if(!t)throw new Error("geojson is required");return!1!==n&&void 0!==n||(t=Bl(t)),Tl(t,(function(t){var e=t[0],n=t[1];t[0]=n,t[1]=e})),t},simplify:tc,bezier:Of,bezierSpline:Of,tag:function(t,e,n,r){return t=Bl(t),e=Bl(e),Pl(t,(function(t){t.properties||(t.properties={}),Pl(e,(function(e){void 0===t.properties[r]&&Gn(t,e)&&(t.properties[r]=e.properties[n])}))})),t},sample:function(t,e){if(!t)throw new Error("featurecollection is required");if(null==e)throw new Error("num is required");if("number"!=typeof e)throw new Error("num must be a number");var n=hn(function(t,e){var n,r,i=t.slice(0),o=t.length,s=o-e;for(;o-- >s;)n=i[r=Math.floor((o+1)*Math.random())],i[r]=i[o],i[o]=n;return i.slice(s)}(t.features,e));return n},envelope:Gf,square:Uf,circle:jf,midpoint:function(t,e){return qf(t,Fn(t,e)/2,zf(t,e))},center:Vf,centerOfMass:function t(e,n){switch(void 0===n&&(n={}),kn(e)){case"Point":return on(Ln(e),n.properties);case"Polygon":var r=[];Tl(e,(function(t){r.push(t)}));var i,o,s,a,u,l,c,h,f=Yf(e,{properties:n.properties}),p=f.geometry.coordinates,g=0,A=0,d=0,y=r.map((function(t){return[t[0]-p[0],t[1]-p[1]]}));for(i=0;i<r.length-1;i++)a=(o=y[i])[0],l=o[1],u=(s=y[i+1])[0],d+=h=a*(c=s[1])-u*l,g+=(a+u)*h,A+=(l+c)*h;if(0===d)return f;var v=1/(6*(.5*d));return on([p[0]+v*g,p[1]+v*A],n.properties);default:var m=qh(e);return m?t(m,{properties:n.properties}):Yf(e,{properties:n.properties})}},centroid:Yf,combine:function(t){var e={MultiPoint:{coordinates:[],properties:[]},MultiLineString:{coordinates:[],properties:[]},MultiPolygon:{coordinates:[],properties:[]}};return Pl(t,(function(t){var n,r,i,o;switch(null===(o=t.geometry)||void 0===o?void 0:o.type){case"Point":e.MultiPoint.coordinates.push(t.geometry.coordinates),e.MultiPoint.properties.push(t.properties);break;case"MultiPoint":(n=e.MultiPoint.coordinates).push.apply(n,t.geometry.coordinates),e.MultiPoint.properties.push(t.properties);break;case"LineString":e.MultiLineString.coordinates.push(t.geometry.coordinates),e.MultiLineString.properties.push(t.properties);break;case"MultiLineString":(r=e.MultiLineString.coordinates).push.apply(r,t.geometry.coordinates),e.MultiLineString.properties.push(t.properties);break;case"Polygon":e.MultiPolygon.coordinates.push(t.geometry.coordinates),e.MultiPolygon.properties.push(t.properties);break;case"MultiPolygon":(i=e.MultiPolygon.coordinates).push.apply(i,t.geometry.coordinates),e.MultiPolygon.properties.push(t.properties)}})),hn(Object.keys(e).filter((function(t){return e[t].coordinates.length})).sort().map((function(t){return nn({type:t,coordinates:e[t].coordinates},{collectedProperties:e[t].properties})})))},distance:Fn,explode:Hf,bbox:Oc,tesselate:function(t){if(!t.geometry||"Polygon"!==t.geometry.type&&"MultiPolygon"!==t.geometry.type)throw new Error("input must be a Polygon or MultiPolygon");var e={type:"FeatureCollection",features:[]};return"Polygon"===t.geometry.type?e.features=Xf(t.geometry.coordinates):t.geometry.coordinates.forEach((function(t){e.features=e.features.concat(Xf(t))})),e},bboxPolygon:Ff,booleanPointInPolygon:Gn,inside:Gn,nearest:Jf,nearestPoint:Jf,nearestPointOnLine:Gp,pointOnLine:Gp,nearestPointToLine:function(t,e,n){void 0===n&&(n={});var r=n.units,i=n.properties||{},o=function(t){var e=[];switch(t.geometry?t.geometry.type:t.type){case"GeometryCollection":return Fl(t,(function(t){"Point"===t.type&&e.push({type:"Feature",properties:{},geometry:t})})),{type:"FeatureCollection",features:e};case"FeatureCollection":return t.features=t.features.filter((function(t){return"Point"===t.geometry.type})),t;default:throw new Error("points must be a Point Collection")}}(t);if(!o.features.length)throw new Error("points must contain features");if(!e)throw new Error("line is required");if("LineString"!==kn(e))throw new Error("line must be a LineString");var s=1/0,a=null;return Pl(o,(function(t){var n=qp(t,e,{units:r});n<s&&(s=n,a=t)})),a&&(a.properties=qc({dist:s},a.properties,i)),a},planepoint:function(t,e){var n=Ln(t),r=Pn(e).coordinates[0];if(r.length<4)throw new Error("OuterRing of a Polygon must have 4 or more Positions.");var i=e.properties||{},o=i.a,s=i.b,a=i.c,u=n[0],l=n[1],c=r[0][0],h=r[0][1],f=void 0!==o?o:r[0][2],p=r[1][0],g=r[1][1],A=void 0!==s?s:r[1][2],d=r[2][0],y=r[2][1],v=void 0!==a?a:r[2][2];return(v*(u-c)*(l-g)+f*(u-p)*(l-y)+A*(u-d)*(l-h)-A*(u-c)*(l-y)-v*(u-p)*(l-h)-f*(u-d)*(l-g))/((u-c)*(l-g)+(u-p)*(l-y)+(u-d)*(l-h)-(u-c)*(l-y)-(u-p)*(l-h)-(u-d)*(l-g))},tin:zh,bearing:zf,destination:qf,kinks:function(t){var e,n,r={type:"FeatureCollection",features:[]};if("LineString"===(n="Feature"===t.type?t.geometry:t).type)e=[n.coordinates];else if("MultiLineString"===n.type)e=n.coordinates;else if("MultiPolygon"===n.type)e=[].concat.apply([],n.coordinates);else{if("Polygon"!==n.type)throw new Error("Input must be a LineString, MultiLineString, Polygon, or MultiPolygon Feature or Geometry");e=n.coordinates}return e.forEach((function(t){e.forEach((function(e){for(var n=0;n<t.length-1;n++)for(var i=n;i<e.length-1;i++){if(t===e){if(1===Math.abs(n-i))continue;if(0===n&&i===t.length-2&&t[n][0]===t[t.length-1][0]&&t[n][1]===t[t.length-1][1])continue}var o=Vp(t[n][0],t[n][1],t[n+1][0],t[n+1][1],e[i][0],e[i][1],e[i+1][0],e[i+1][1]);o&&r.features.push(on([o[0],o[1]]))}}))})),r},pointOnFeature:Yp,pointOnSurface:Yp,area:Jp,along:function(t,e,n){void 0===n&&(n={});for(var r=Pn(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=zf(r[o],r[o-1])-180;return qf(r[o],s,a,n)}return on(r[o])}i+=Fn(r[o],r[o+1],n)}return on(r[r.length-1])},length:$p,lineDistance:$p,lineSlice:function(t,e,n){var r=Nn(n);if("LineString"!==kn(n))throw new Error("line must be a LineString");for(var i,o=Gp(n,t),s=Gp(n,e),a=[(i=o.properties.index<=s.properties.index?[o,s]:[s,o])[0].geometry.coordinates],u=i[0].properties.index+1;u<i[1].properties.index+1;u++)a.push(r[u]);return a.push(i[1].geometry.coordinates),ln(a,n.properties)},lineSliceAlong:tg,pointGrid:ag,truncate:ug,flatten:lg,lineIntersect:Op,lineChunk:function(t,e,n){if(!bn(n=n||{}))throw new Error("options is invalid");var r=n.units,i=n.reverse;if(!t)throw new Error("geojson is required");if(e<=0)throw new Error("segmentLength must be greater than 0");var o=[];return Ul(t,(function(t){i&&(t.geometry.coordinates=t.geometry.coordinates.reverse()),function(t,e,n,r){var i=$p(t,{units:n});if(i<=e)return r(t);var o=i/e;Number.isInteger(o)||(o=Math.floor(o)+1);for(var s=0;s<o;s++){r(tg(t,e*s,e*(s+1),{units:n}),s)}}(t,e,r,(function(t){o.push(t)}))})),hn(o)},unkinkPolygon:function(t){var e=[];return Ul(t,(function(t){"Polygon"===t.geometry.type&&Pl(fg(t),(function(n){e.push(an(n.geometry.coordinates,t.properties))}))})),hn(e)},greatCircle:function(t,e,n){if("object"!=typeof(n=n||{}))throw new Error("options is invalid");var r=n.properties,i=n.npoints,o=n.offset;return t=Ln(t),e=Ln(e),r=r||{},i=i||100,o=o||10,new Cg({x:t[0],y:t[1]},{x:e[0],y:e[1]},r).Arc(i,{offset:o}).json()},lineSegment:Wf,lineSplit:function(t,e){if(!t)throw new Error("line is required");if(!e)throw new Error("splitter is required");var n=kn(t),r=kn(e);if("LineString"!==n)throw new Error("line must be LineString");if("FeatureCollection"===r)throw new Error("splitter cannot be a FeatureCollection");if("GeometryCollection"===r)throw new Error("splitter cannot be a GeometryCollection");var i=ug(e,{precision:7});switch(r){case"Point":return bg(t,i);case"MultiPoint":return wg(t,i);case"LineString":case"MultiLineString":case"Polygon":case"MultiPolygon":return wg(t,Op(t,i))}},lineArc:Mg,polygonToLine:Ng,polygonToLineString:Ng,lineStringToPolygon:Qg,lineToPolygon:Qg,bboxClip:function(t,e){var n=Pn(t),r=n.type,i="Feature"===t.type?t.properties:{},o=n.coordinates;switch(r){case"LineString":case"MultiLineString":var s=[];return"LineString"===r&&(o=[o]),o.forEach((function(t){!function(t,e,n){var r,i,o,s,a,u=t.length,l=Fg(t[0],e),c=[];for(n||(n=[]),r=1;r<u;r++){for(s=t[r-1],i=o=Fg(a=t[r],e);;){if(!(l|i)){c.push(s),i!==o?(c.push(a),r<u-1&&(n.push(c),c=[])):r===u-1&&c.push(a);break}if(l&i)break;l?l=Fg(s=Og(s,a,l,e),e):i=Fg(a=Og(s,a,i,e),e)}l=o}c.length&&n.push(c)}(t,e,s)})),1===s.length?ln(s[0],i):fn(s,i);case"Polygon":return an(Gg(o,e),i);case"MultiPolygon":return gn(o.map((function(t){return Gg(t,e)})),i);default:throw new Error("geometry "+r+" not supported")}},lineOverlap:Iy,sector:function(t,e,n,r,i){if(!bn(i=i||{}))throw new Error("options is invalid");var o=i.properties;if(!t)throw new Error("center is required");if(null==n)throw new Error("bearing1 is required");if(null==r)throw new Error("bearing2 is required");if(!e)throw new Error("radius is required");if("object"!=typeof i)throw new Error("options must be an object");if(xy(n)===xy(r))return jf(t,e,i);var s=Nn(t),a=Mg(t,e,n,r,i),u=[[s]];return Tl(a,(function(t){u[0].push(t)})),u[0].push(s),an(u,o)},rhumbBearing:Cy,rhumbDistance:Up,rhumbDestination:by,polygonTangents:function(t,e){var n,r,i,o,s=Nn(t),a=Nn(e),u=Oc(e),l=0,c=null;switch(s[0]>u[0]&&s[0]<u[2]&&s[1]>u[1]&&s[1]<u[3]&&(l=(c=Jf(t,Hf(e))).properties.featureIndex),kn(e)){case"Polygon":n=a[0][l],r=a[0][0],null!==c&&c.geometry.coordinates[1]<s[1]&&(r=a[0][l]),o=My(a[0][0],a[0][a[0].length-1],s);var h=By(a[0],s,o,i,n,r);n=h[0],r=h[1];break;case"MultiPolygon":for(var f=0,p=0,g=0,A=0;A<a[0].length;A++){f=A;for(var d=!1,y=0;y<a[0][A].length;y++){if(p=y,g===l){d=!0;break}g++}if(d)break}n=a[0][f][p],r=a[0][f][p],o=My(a[0][0][0],a[0][0][a[0][0].length-1],s),a.forEach((function(t){var e=By(t[0],s,o,i,n,r);n=e[0],r=e[1]}))}return hn([on(n),on(r)])},rewind:function(t,e){if(!bn(e=e||{}))throw new Error("options is invalid");var n=e.reverse||!1,r=e.mutate||!1;if(!t)throw new Error("<geojson> is required");if("boolean"!=typeof n)throw new Error("<reverse> must be a boolean");if("boolean"!=typeof r)throw new Error("<mutate> must be a boolean");!1===r&&(t=Bl(t));var i=[];switch(t.type){case"GeometryCollection":return Fl(t,(function(t){Ny(t,n)})),t;case"FeatureCollection":return Pl(t,(function(t){Pl(Ny(t,n),(function(t){i.push(t)}))})),hn(i)}return Ny(t,n)},isobands:function(t,e,n){if(!bn(n=n||{}))throw new Error("options is invalid");var r=n.zProperty||"elevation",i=n.commonProperties||{},o=n.breaksProperties||[];if(Dn(t,"Point","Input must contain Points"),!e)throw new Error("breaks is required");if(!Array.isArray(e))throw new Error("breaks is not an Array");if(!bn(i))throw new Error("commonProperties is not an Object");if(!Array.isArray(o))throw new Error("breaksProperties is not an Array");var s=Qy(t,{zProperty:r,flip:!0}),a=function(t,e,n){for(var r=[],i=1;i<e.length;i++){var o=+e[i-1],s=+e[i],a=Dv(Qv(ky(t,o,s-o))),u={};u.groupedRings=a,u[n]=o+"-"+s,r.push(u)}return r}(s,e,r);a=function(t,e,n){var r=Oc(n),i=r[2]-r[0],o=r[3]-r[1],s=r[0],a=r[1],u=e[0].length-1,l=e.length-1,c=i/u,h=o/l,f=function(t){t[0]=t[0]*c+s,t[1]=t[1]*h+a};return t.forEach((function(t){t.groupedRings.forEach((function(t){t.forEach((function(t){t.forEach(f)}))}))})),t}(a,s,t);var u=a.map((function(t,e){if(o[e]&&!bn(o[e]))throw new Error("Each mappedProperty is required to be an Object");var n=qc({},i,o[e]);return n[r]=t[r],gn(t.groupedRings,n)}));return hn(u)},transformRotate:Ov,transformScale:Fv,transformTranslate:function(t,e,n,r){if(!bn(r=r||{}))throw new Error("options is invalid");var i=r.units,o=r.zTranslation,s=r.mutate;if(!t)throw new Error("geojson is required");if(null==e||isNaN(e))throw new Error("distance is required");if(o&&"number"!=typeof o&&isNaN(o))throw new Error("zTranslation is not a number");if(o=void 0!==o?o:0,0===e&&0===o)return t;if(null==n||isNaN(n))throw new Error("direction is required");return e<0&&(e=-e,n+=180),!1!==s&&void 0!==s||(t=Bl(t)),Tl(t,(function(t){var r=Nn(by(t,e,n,{units:i}));t[0]=r[0],t[1]=r[1],o&&3===t.length&&(t[2]+=o)})),t},lineOffset:function(t,e,n){if(!bn(n=n||{}))throw new Error("options is invalid");var r=n.units;if(!t)throw new Error("geojson is required");if(null==e||isNaN(e))throw new Error("distance is required");var i=kn(t),o=t.properties;switch(i){case"LineString":return zv(t,e,r);case"MultiLineString":var s=[];return Ul(t,(function(t){s.push(zv(t,e,r).geometry.coordinates)})),fn(s,o);default:throw new Error("geometry "+i+" is not supported")}},polygonize:function(t){var e=Zv.fromGeoJson(t);e.deleteDangles(),e.deleteCutEdges();var n=[],r=[];return e.getEdgeRings().filter((function(t){return t.isValid()})).forEach((function(t){t.isHole()?n.push(t):r.push(t)})),n.forEach((function(t){Wv.findEdgeRingContaining(t,r)&&r.push(t)})),hn(r.map((function(t){return t.toPolygon()})))},booleanDisjoint:$v,booleanContains:function(t,e){var n=Pn(t),r=Pn(e),i=n.type,o=r.type,s=n.coordinates,a=r.coordinates;switch(i){case"Point":if("Point"===o)return im(s,a);throw new Error("feature2 "+o+" geometry not supported");case"MultiPoint":switch(o){case"Point":return function(t,e){var n,r=!1;for(n=0;n<t.coordinates.length;n++)if(im(t.coordinates[n],e.coordinates)){r=!0;break}return r}(n,r);case"MultiPoint":return function(t,e){for(var n=0,r=e.coordinates;n<r.length;n++){for(var i=r[n],o=!1,s=0,a=t.coordinates;s<a.length;s++){if(im(i,a[s])){o=!0;break}}if(!o)return!1}return!0}(n,r);default:throw new Error("feature2 "+o+" geometry not supported")}case"LineString":switch(o){case"Point":return eg(r,n,{ignoreEndVertices:!0});case"LineString":return function(t,e){for(var n=!1,r=0,i=e.coordinates;r<i.length;r++){var o=i[r];if(eg({type:"Point",coordinates:o},t,{ignoreEndVertices:!0})&&(n=!0),!eg({type:"Point",coordinates:o},t,{ignoreEndVertices:!1}))return!1}return n}(n,r);case"MultiPoint":return function(t,e){for(var n=!1,r=0,i=e.coordinates;r<i.length;r++){var o=i[r];if(eg(o,t,{ignoreEndVertices:!0})&&(n=!0),!eg(o,t))return!1}if(n)return!0;return!1}(n,r);default:throw new Error("feature2 "+o+" geometry not supported")}case"Polygon":switch(o){case"Point":return Gn(r,n,{ignoreBoundary:!0});case"LineString":return function(t,e){var n=!1,r=0,i=Oc(t),o=Oc(e);if(!rm(i,o))return!1;for(;r<e.coordinates.length-1;r++){if(Gn({type:"Point",coordinates:om(e.coordinates[r],e.coordinates[r+1])},t,{ignoreBoundary:!0})){n=!0;break}}return n}(n,r);case"Polygon":return function(t,e){if("Feature"===t.type&&null===t.geometry)return!1;if("Feature"===e.type&&null===e.geometry)return!1;var n=Oc(t),r=Oc(e);if(!rm(n,r))return!1;for(var i=Pn(e).coordinates,o=0,s=i;o<s.length;o++)for(var a=0,u=s[o];a<u.length;a++){if(!Gn(u[a],t))return!1}return!0}(n,r);case"MultiPoint":return function(t,e){for(var n=0,r=e.coordinates;n<r.length;n++){if(!Gn(r[n],t,{ignoreBoundary:!0}))return!1}return!0}(n,r);default:throw new Error("feature2 "+o+" geometry not supported")}default:throw new Error("feature1 "+i+" geometry not supported")}},booleanCrosses:function(t,e){var n=Pn(t),r=Pn(e),i=n.type,o=r.type;switch(i){case"MultiPoint":switch(o){case"LineString":return sm(n,r);case"Polygon":return um(n,r);default:throw new Error("feature2 "+o+" geometry not supported")}case"LineString":switch(o){case"MultiPoint":return sm(r,n);case"LineString":return function(t,e){if(Op(t,e).features.length>0)for(var n=0;n<t.coordinates.length-1;n++)for(var r=0;r<e.coordinates.length-1;r++){var i=!0;if(0!==r&&r!==e.coordinates.length-2||(i=!1),lm(t.coordinates[n],t.coordinates[n+1],e.coordinates[r],i))return!0}return!1}(n,r);case"Polygon":return am(n,r);default:throw new Error("feature2 "+o+" geometry not supported")}case"Polygon":switch(o){case"MultiPoint":return um(r,n);case"LineString":return am(r,n);default:throw new Error("feature2 "+o+" geometry not supported")}default:throw new Error("feature1 "+i+" geometry not supported")}},booleanClockwise:Ly,booleanOverlap:function(t,e){var n=Pn(t),r=Pn(e),i=n.type,o=r.type;if("MultiPoint"===i&&"MultiPoint"!==o||("LineString"===i||"MultiLineString"===i)&&"LineString"!==o&&"MultiLineString"!==o||("Polygon"===i||"MultiPolygon"===i)&&"Polygon"!==o&&"MultiPolygon"!==o)throw new Error("features must be of the same type");if("Point"===i)throw new Error("Point geometry not supported");if(new Am({precision:6}).compare(t,e))return!1;var s=0;switch(i){case"MultiPoint":for(var a=0;a<n.coordinates.length;a++)for(var u=0;u<r.coordinates.length;u++){var l=n.coordinates[a],c=r.coordinates[u];if(l[0]===c[0]&&l[1]===c[1])return!0}return!1;case"LineString":case"MultiLineString":jl(t,(function(t){jl(e,(function(e){Iy(t,e).features.length&&s++}))}));break;case"Polygon":case"MultiPolygon":jl(t,(function(t){jl(e,(function(e){Op(t,e).features.length&&s++}))}))}return s>0},booleanPointOnLine:eg,booleanEqual:function(t,e){return Pn(t).type===Pn(e).type&&new Am({precision:6}).compare(xl(t),xl(e))},booleanWithin:rg,booleanIntersects:dm,clone:Bl,cleanCoords:xl,clustersDbscan:function(t,e,n){void 0===n&&(n={}),!0!==n.mutate&&(t=Bl(t)),n.minPoints=n.minPoints||3;var r=new xm.DBSCAN,i=r.run(Ol(t),xn(e,n.units),n.minPoints,Fn),o=-1;return i.forEach((function(e){o++,e.forEach((function(e){var n=t.features[e];n.properties||(n.properties={}),n.properties.cluster=o,n.properties.dbscan="core"}))})),r.noise.forEach((function(e){var n=t.features[e];n.properties||(n.properties={}),n.properties.cluster?n.properties.dbscan="edge":n.properties.dbscan="noise"})),t},clustersKmeans:function(t,e){void 0===e&&(e={});var n=t.features.length;e.numberOfClusters=e.numberOfClusters||Math.round(Math.sqrt(n/2)),e.numberOfClusters>n&&(e.numberOfClusters=n),!0!==e.mutate&&(t=Bl(t));var r=Ol(t),i=r.slice(0,e.numberOfClusters),o=Tm(r,e.numberOfClusters,i),s={};return o.centroids.forEach((function(t,e){s[e]=t})),Pl(t,(function(t,e){var n=o.idxs[e];t.properties.cluster=n,t.properties.centroid=s[n]})),t},pointToLineDistance:qp,booleanParallel:function(t,e){if(!t)throw new Error("line1 is required");if(!e)throw new Error("line2 is required");if("LineString"!==Qm(t,"line1"))throw new Error("line1 must be a LineString");if("LineString"!==Qm(e,"line2"))throw new Error("line2 must be a LineString");for(var n=Wf(xl(t)).features,r=Wf(xl(e)).features,i=0;i<n.length;i++){var o=n[i].geometry.coordinates;if(!r[i])break;if(!Rm(o,r[i].geometry.coordinates))return!1}return!0},shortestPath:function(t,e,n){if(!bn(n=n||{}))throw new Error("options is invalid");var r=n.resolution,i=n.minDistance,o=n.obstacles||hn([]);if(!t)throw new Error("start is required");if(!e)throw new Error("end is required");if(r&&!wn(r)||r<=0)throw new Error("options.resolution must be a number, greater than 0");if(i)throw new Error("options.minDistance is not yet implemented");var s=Ln(t),a=Ln(e);switch(t=on(s),e=on(a),kn(o)){case"FeatureCollection":if(0===o.features.length)return ln([s,a]);break;case"Polygon":o=hn([nn(Pn(o))]);break;default:throw new Error("invalid obstacles")}var u=o;u.features.push(t),u.features.push(e);var l=Oc(Fv(Ff(Oc(u)),1.15));r||(r=Fn([l[0],l[1]],[l[2],l[1]],n)/100),u.features.pop(),u.features.pop();for(var c=l[0],h=l[1],f=l[2],p=l[3],g=r/Fn([c,h],[f,h],n)*(f-c),A=r/Fn([c,h],[c,p],n)*(p-h),d=f-c,y=p-h,v=Math.floor(d/g),m=Math.floor(y/A),_=(d-v*g)/2,I=[],E=[],x=[],C=[],w=1/0,b=1/0,B=p-(y-m*A)/2,S=0;B>=h;){for(var M=[],L=[],N=c+_,T=0;N<=f;){var R=on([N,B]),Q=Gm(R,o);M.push(Q?0:1),L.push(N+"|"+B);var D=Fn(R,t);!Q&&D<w&&(w=D,x={x:T,y:S});var P=Fn(R,e);!Q&&P<b&&(b=P,C={x:T,y:S}),N+=g,T++}E.push(M),I.push(L),B-=A,S++}var k=new km(E,{diagonal:!0}),O=k.grid[x.y][x.x],F=k.grid[C.y][C.x],G=Pm.search(k,O,F),U=[s];return G.forEach((function(t){var e=I[t.x][t.y].split("|");U.push([+e[0],+e[1]])})),U.push(a),xl(ln(U))},voronoi:function(t,e){if(!bn(e=e||{}))throw new Error("options is invalid");var n=e.bbox||[-180,-85,180,85];if(!t)throw new Error("points is required");if(!Array.isArray(n))throw new Error("bbox is invalid");return Dn(t,"Point","points"),hn(function(){var t=qm,e=jm,n=null;function r(r){return new x_(r.map((function(n,i){var o=[Math.round(t(n,i,r)/__)*__,Math.round(e(n,i,r)/__)*__];return o.index=i,o.data=n,o})),n)}return r.polygons=function(t){return r(t).polygons()},r.links=function(t){return r(t).links()},r.triangles=function(t){return r(t).triangles()},r.x=function(e){return arguments.length?(t="function"==typeof e?e:Um(+e),r):t},r.y=function(t){return arguments.length?(e="function"==typeof t?t:Um(+t),r):e},r.extent=function(t){return arguments.length?(n=null==t?null:[[+t[0][0],+t[0][1]],[+t[1][0],+t[1][1]]],r):n&&[[n[0][0],n[0][1]],[n[1][0],n[1][1]]]},r.size=function(t){return arguments.length?(n=null==t?null:[[0,0],[+t[0],+t[1]]],r):n&&[n[1][0]-n[0][0],n[1][1]-n[0][1]]},r}().x((function(t){return t.geometry.coordinates[0]})).y((function(t){return t.geometry.coordinates[1]})).extent([[n[0],n[1]],[n[2],n[3]]]).polygons(t.features).map(C_))},ellipse:w_,centerMean:B_,centerMedian:function(t,e){if(void 0===e&&(e={}),!bn(e=e||{}))throw new Error("options is invalid");var n=e.counter||10;if(!wn(n))throw new Error("counter must be a number");var r=e.weight,i=B_(t,{weight:e.weight}),o=hn([]);Pl(t,(function(t){var e;o.features.push(Yf(t,{properties:{weight:null===(e=t.properties)||void 0===e?void 0:e[r]}}))}));var s={tolerance:e.tolerance,medianCandidates:[]};return S_(i.geometry.coordinates,[0,0],o,s,n)},standardDeviationalEllipse:function(t,e){if(!bn(e=e||{}))throw new Error("options is invalid");var n=e.steps||64,r=e.weight,i=e.properties||{};if(!wn(n))throw new Error("steps must be a number");if(!bn(i))throw new Error("properties must be a number");var o=Ol(t).length,s=B_(t,{weight:r}),a=0,u=0,l=0;Pl(t,(function(t){var e=t.properties[r]||1,n=M_(Nn(t),Nn(s));a+=Math.pow(n.x,2)*e,u+=Math.pow(n.y,2)*e,l+=n.x*n.y*e}));var c=a-u,h=Math.sqrt(Math.pow(c,2)+4*Math.pow(l,2)),f=2*l,p=Math.atan((c+h)/f),g=180*p/Math.PI,A=0,d=0,y=0;Pl(t,(function(t){var e=t.properties[r]||1,n=M_(Nn(t),Nn(s));A+=Math.pow(n.x*Math.cos(p)-n.y*Math.sin(p),2)*e,d+=Math.pow(n.x*Math.sin(p)+n.y*Math.cos(p),2)*e,y+=e}));var v=Math.sqrt(2*A/y),m=Math.sqrt(2*d/y),_=w_(s,v,m,{units:"degrees",angle:g,steps:n,properties:i}),I=jh(t,hn([_])),E={meanCenterCoordinates:Nn(s),semiMajorAxis:v,semiMinorAxis:m,numberOfFeatures:o,angle:g,percentageWithinEllipse:100*Ol(I).length/o};return _.properties.standardDeviationalEllipse=E,_},angle:function(t,e,n,r){if(void 0===r&&(r={}),!bn(r))throw new Error("options is invalid");if(!t)throw new Error("startPoint is required");if(!e)throw new Error("midPoint is required");if(!n)throw new Error("endPoint is required");var i=t,o=e,s=n,a=_n(!0!==r.mercator?zf(i,o):Cy(i,o)),u=_n(!0!==r.mercator?zf(s,o):Cy(s,o)),l=Math.abs(a-u);return!0===r.explementary?360-l:l},polygonSmooth:function(t,e){var n=[],r=e.iterations||1;if(!t)throw new Error("inputPolys is required");return Fl(t,(function(t,e,i){var o,s,a;switch(t.type){case"Polygon":o=[[]];for(var u=0;u<r;u++)a=[[]],s=t,u>0&&(s=an(o).geometry),L_(s,a),o=a.slice(0);n.push(an(o,i));break;case"MultiPolygon":o=[[[]]];for(var l=0;l<r;l++)a=[[[]]],s=t,l>0&&(s=gn(o).geometry),N_(s,a),o=a.slice(0);n.push(gn(o,i));break;default:throw new Error("geometry is invalid, must be Polygon or MultiPolygon")}})),hn(n)},moranIndex:function(t,e){var n=e.inputField,r=e.threshold||1e5,i=e.p||2,o=e.binary||!1,s=R_(t,{alpha:e.alpha||-1,binary:o,p:i,standardization:e.standardization||!0,threshold:r}),a=[];Pl(t,(function(t){var e=t.properties||{};a.push(e[n])}));for(var u=Q_(a),l=function(t){for(var e=Q_(t),n=0,r=0,i=t;r<i.length;r++){var o=i[r];n+=Math.pow(o-e,2)}return n/t.length}(a),c=0,h=0,f=0,p=0,g=s.length,A=0;A<g;A++){for(var d=0,y=0;y<g;y++)c+=s[A][y]*(a[A]-u)*(a[y]-u),h+=s[A][y],f+=Math.pow(s[A][y]+s[y][A],2),d+=s[A][y]+s[y][A];p+=Math.pow(d,2)}var v=c/h/l,m=-1/(g-1),_=(g*g*(f*=.5)-g*p+h*h*3)/((g-1)*(g+1)*(h*h))-m*m,I=Math.sqrt(_);return{expectedMoranIndex:m,moranIndex:v,stdNorm:I,zNorm:(v-m)/I}},distanceWeight:R_,bearingToAngle:_n,convertDistance:xn,degrees2radians:En,distanceToDegrees:mn,distanceToRadians:vn,radians2degrees:In,radiansToDistance:yn,difference:function(t,e){var n=Pn(t),r=Pn(e),i=t.properties||{},o=YI.difference(n.coordinates,r.coordinates);return 0===o.length?null:1===o.length?an(o[0],i):gn(o,i)},buffer:function(t,e,n){var r=(n=n||{}).units||"kilometers",i=n.steps||8;if(!t)throw new Error("geojson is required");if("object"!=typeof n)throw new Error("options must be an object");if("number"!=typeof i)throw new Error("steps must be an number");if(void 0===e)throw new Error("radius is required");if(i<=0)throw new Error("steps must be greater than 0");var o=[];switch(t.type){case"GeometryCollection":return Fl(t,(function(t){var n=ZS(t,e,r,i);n&&o.push(n)})),hn(o);case"FeatureCollection":return Pl(t,(function(t){var n=ZS(t,e,r,i);n&&Pl(n,(function(t){t&&o.push(t)}))})),hn(o)}return ZS(t,e,r,i)},union:function(t,e,n){void 0===n&&(n={});var r=Pn(t),i=Pn(e),o=YI.union(r.coordinates,i.coordinates);return 0===o.length?null:1===o.length?an(o[0],n.properties):gn(o,n.properties)},intersect:nM,dissolve:function(t,e){if(!bn(e=e||{}))throw new Error("options is invalid");var n=e.propertyName;Dn(t,"Polygon","dissolve");var r=[];if(!e.propertyName)return lg(gn(YI.union.apply(null,t.features.map((function(t){return t.geometry.coordinates})))));var i={};Pl(t,(function(t){Object.prototype.hasOwnProperty.call(i,t.properties[n])||(i[t.properties[n]]=[]),i[t.properties[n]].push(t)}));for(var o=Object.keys(i),s=0;s<o.length;s++){var a=gn(YI.union.apply(null,i[o[s]].map((function(t){return t.geometry.coordinates}))));a.properties[n]=o[s],r.push(a)}return lg(hn(r))},hexGrid:rM,mask:function(t,e){var n,r,i=aM(e),o=null;return"FeatureCollection"===t.type?(r=2===(n=t).features.length?YI.union(n.features[0].geometry.coordinates,n.features[1].geometry.coordinates):YI.union.apply(YI,n.features.map((function(t){return t.geometry.coordinates}))),o=sM(r)):o=sM(YI.union(t.geometry.coordinates)),o.geometry.coordinates.forEach((function(t){i.geometry.coordinates.push(t[0])})),i},squareGrid:uM,triangleGrid:lM,interpolate:function(t,e,n){if("object"!=typeof(n=n||{}))throw new Error("options is invalid");var r=n.gridType,i=n.property,o=n.weight;if(!t)throw new Error("points is required");if(Dn(t,"Point","input must contain Points"),!e)throw new Error("cellSize is required");if(void 0!==o&&"number"!=typeof o)throw new Error("weight must be a number");i=i||"elevation",r=r||"square",o=o||1;var s,a=Oc(t);switch(r){case"point":case"points":s=ag(a,e,n);break;case"square":case"squares":s=uM(a,e,n);break;case"hex":case"hexes":s=rM(a,e,n);break;case"triangle":case"triangles":s=lM(a,e,n);break;default:throw new Error("invalid gridType")}var u=[];return Pl(s,(function(e){var s=0,a=0;Pl(t,(function(t){var u,l=Fn("point"===r?e:Yf(e),t,n);if(void 0!==i&&(u=t.properties[i]),void 0===u&&(u=t.geometry.coordinates[2]),void 0===u)throw new Error("zValue is missing");0===l&&(s=u);var c=1/Math.pow(l,o);a+=c,s+=c*u}));var l=Bl(e);l.properties[i]=s/a,u.push(l)})),hn(u)},toMercator:D_,toWgs84:P_,randomPosition:q_,randomPoint:j_,randomPolygon:z_,randomLineString:V_,getCluster:J_,clusterEach:W_,clusterReduce:K_,createBins:Z_,applyFilter:$_,propertiesContainsFilter:tI,filterProperties:eI,earthRadius:Ze,factors:$e,unitsFactors:tn,areaFactors:en,feature:nn,geometry:rn,point:on,points:sn,polygon:an,polygons:un,lineString:ln,lineStrings:cn,featureCollection:hn,multiLineString:fn,multiPoint:pn,multiPolygon:gn,geometryCollection:An,round:dn,radiansToLength:yn,lengthToRadians:vn,lengthToDegrees:mn,bearingToAzimuth:_n,radiansToDegrees:In,degreesToRadians:En,convertLength:xn,convertArea:Cn,isNumber:wn,isObject:bn,validateBBox:Bn,validateId:Sn,getCoord:Ln,getCoords:Nn,containsNumber:Tn,geojsonType:Rn,featureOf:Qn,collectionOf:Dn,getGeom:Pn,getType:kn,coordAll:Ol,coordEach:Tl,coordReduce:Rl,featureEach:Pl,featureReduce:kl,findPoint:Xl,findSegment:Hl,flattenEach:Ul,flattenReduce:ql,geomEach:Fl,geomReduce:Gl,lineEach:Vl,lineReduce:Yl,propEach:Ql,propReduce:Dl,segmentEach:jl,segmentReduce:zl});export{_l as Arrow3D,kc as CoordinateTransform,sl as LineGeometry,Ou as LineMaterial,He as TextureAnimator,Pc as drawTool,jn as gisCommon,La as gltfLoadClass,Oe as imgClass,Dc as layerClass,vl as line2Object,De as lineLength,pl as planeGifClass,sr as planeMark,Xe as planeSectorClass,Qc as polygonClass,Fu as polylineClass,Ue as radarClass,Qu as rippleWallClass,ze as sectorClass,Ke as shockClass,Se as sleep,Ba as tileClass,Il as tripHeight,El as tripLineClass,dl as tubeClass,cM as turf,cl as verticalFatLineClass};
|