node-red-contrib-tak-registration 0.11.4 → 0.11.6

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.
Files changed (202) hide show
  1. package/node_modules/@types/node/README.md +1 -1
  2. package/node_modules/@types/node/buffer.d.ts +8 -7
  3. package/node_modules/@types/node/crypto.d.ts +38 -7
  4. package/node_modules/@types/node/dgram.d.ts +10 -0
  5. package/node_modules/@types/node/diagnostics_channel.d.ts +355 -1
  6. package/node_modules/@types/node/fs.d.ts +28 -8
  7. package/node_modules/@types/node/globals.d.ts +26 -0
  8. package/node_modules/@types/node/http.d.ts +6 -7
  9. package/node_modules/@types/node/module.d.ts +14 -0
  10. package/node_modules/@types/node/net.d.ts +8 -3
  11. package/node_modules/@types/node/package.json +3 -4
  12. package/node_modules/@types/node/perf_hooks.d.ts +12 -6
  13. package/node_modules/@types/node/process.d.ts +25 -3
  14. package/node_modules/@types/node/querystring.d.ts +3 -3
  15. package/node_modules/@types/node/stream/web.d.ts +17 -1
  16. package/node_modules/@types/node/string_decoder.d.ts +2 -2
  17. package/node_modules/@types/node/test.d.ts +98 -15
  18. package/node_modules/@types/node/tls.d.ts +1 -1
  19. package/node_modules/@types/node/ts4.8/buffer.d.ts +8 -7
  20. package/node_modules/@types/node/ts4.8/crypto.d.ts +41 -9
  21. package/node_modules/@types/node/ts4.8/dgram.d.ts +10 -0
  22. package/node_modules/@types/node/ts4.8/diagnostics_channel.d.ts +355 -1
  23. package/node_modules/@types/node/ts4.8/fs.d.ts +28 -8
  24. package/node_modules/@types/node/ts4.8/globals.d.ts +26 -0
  25. package/node_modules/@types/node/ts4.8/http.d.ts +6 -7
  26. package/node_modules/@types/node/ts4.8/module.d.ts +14 -0
  27. package/node_modules/@types/node/ts4.8/net.d.ts +8 -3
  28. package/node_modules/@types/node/ts4.8/perf_hooks.d.ts +13 -7
  29. package/node_modules/@types/node/ts4.8/process.d.ts +25 -3
  30. package/node_modules/@types/node/ts4.8/querystring.d.ts +3 -3
  31. package/node_modules/@types/node/ts4.8/stream/web.d.ts +17 -1
  32. package/node_modules/@types/node/ts4.8/string_decoder.d.ts +2 -2
  33. package/node_modules/@types/node/ts4.8/test.d.ts +98 -15
  34. package/node_modules/@types/node/ts4.8/tls.d.ts +1 -1
  35. package/node_modules/@types/node/ts4.8/url.d.ts +59 -42
  36. package/node_modules/@types/node/ts4.8/util.d.ts +1 -1
  37. package/node_modules/@types/node/ts4.8/v8.d.ts +134 -5
  38. package/node_modules/@types/node/ts4.8/wasi.d.ts +26 -5
  39. package/node_modules/@types/node/url.d.ts +59 -42
  40. package/node_modules/@types/node/v8.d.ts +134 -5
  41. package/node_modules/@types/node/wasi.d.ts +26 -5
  42. package/node_modules/axios/CHANGELOG.md +53 -0
  43. package/node_modules/axios/README.md +47 -5
  44. package/node_modules/axios/dist/axios.js +368 -4
  45. package/node_modules/axios/dist/axios.js.map +1 -1
  46. package/node_modules/axios/dist/axios.min.js +1 -1
  47. package/node_modules/axios/dist/axios.min.js.map +1 -1
  48. package/node_modules/axios/dist/browser/axios.cjs +28 -4
  49. package/node_modules/axios/dist/browser/axios.cjs.map +1 -1
  50. package/node_modules/axios/dist/esm/axios.js +28 -4
  51. package/node_modules/axios/dist/esm/axios.js.map +1 -1
  52. package/node_modules/axios/dist/esm/axios.min.js +1 -1
  53. package/node_modules/axios/dist/esm/axios.min.js.map +1 -1
  54. package/node_modules/axios/dist/node/axios.cjs +34 -6
  55. package/node_modules/axios/dist/node/axios.cjs.map +1 -1
  56. package/node_modules/axios/index.d.cts +1 -1
  57. package/node_modules/axios/index.d.ts +1 -1
  58. package/node_modules/axios/lib/adapters/http.js +6 -2
  59. package/node_modules/axios/lib/core/Axios.js +22 -1
  60. package/node_modules/axios/lib/env/data.js +1 -1
  61. package/node_modules/axios/lib/helpers/combineURLs.js +1 -1
  62. package/node_modules/axios/lib/helpers/formDataToJSON.js +3 -0
  63. package/node_modules/axios/package.json +2 -2
  64. package/node_modules/call-bind/CHANGELOG.md +16 -0
  65. package/node_modules/call-bind/index.js +2 -11
  66. package/node_modules/call-bind/package.json +11 -6
  67. package/node_modules/define-data-property/CHANGELOG.md +29 -0
  68. package/node_modules/define-data-property/index.d.ts +12 -3
  69. package/node_modules/define-data-property/index.js +4 -16
  70. package/node_modules/define-data-property/package.json +26 -33
  71. package/node_modules/define-data-property/test/index.js +10 -10
  72. package/node_modules/es-define-property/.eslintrc +13 -0
  73. package/node_modules/es-define-property/.github/FUNDING.yml +12 -0
  74. package/node_modules/es-define-property/.nycrc +9 -0
  75. package/node_modules/es-define-property/CHANGELOG.md +15 -0
  76. package/node_modules/es-define-property/LICENSE +21 -0
  77. package/node_modules/es-define-property/README.md +49 -0
  78. package/node_modules/es-define-property/index.d.ts +3 -0
  79. package/node_modules/es-define-property/index.js +16 -0
  80. package/node_modules/es-define-property/package.json +81 -0
  81. package/node_modules/es-define-property/test/index.js +55 -0
  82. package/node_modules/es-define-property/tsconfig.json +50 -0
  83. package/node_modules/es-errors/.eslintrc +5 -0
  84. package/node_modules/es-errors/.github/FUNDING.yml +12 -0
  85. package/node_modules/es-errors/CHANGELOG.md +40 -0
  86. package/node_modules/es-errors/LICENSE +21 -0
  87. package/node_modules/es-errors/README.md +55 -0
  88. package/node_modules/es-errors/eval.d.ts +3 -0
  89. package/node_modules/es-errors/eval.js +4 -0
  90. package/node_modules/es-errors/index.d.ts +3 -0
  91. package/node_modules/es-errors/index.js +4 -0
  92. package/node_modules/es-errors/package.json +80 -0
  93. package/node_modules/es-errors/range.d.ts +3 -0
  94. package/node_modules/es-errors/range.js +4 -0
  95. package/node_modules/es-errors/ref.d.ts +3 -0
  96. package/node_modules/es-errors/ref.js +4 -0
  97. package/node_modules/es-errors/syntax.d.ts +3 -0
  98. package/node_modules/es-errors/syntax.js +4 -0
  99. package/node_modules/es-errors/test/index.js +19 -0
  100. package/node_modules/es-errors/tsconfig.json +49 -0
  101. package/node_modules/es-errors/type.d.ts +3 -0
  102. package/node_modules/es-errors/type.js +4 -0
  103. package/node_modules/es-errors/uri.d.ts +3 -0
  104. package/node_modules/es-errors/uri.js +4 -0
  105. package/node_modules/fast-xml-parser/CHANGELOG.md +3 -0
  106. package/node_modules/fast-xml-parser/README.md +2 -1
  107. package/node_modules/fast-xml-parser/package.json +4 -1
  108. package/node_modules/fast-xml-parser/src/fxp.d.ts +363 -69
  109. package/node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js +5 -5
  110. package/node_modules/follow-redirects/index.js +114 -75
  111. package/node_modules/follow-redirects/package.json +1 -1
  112. package/node_modules/get-intrinsic/CHANGELOG.md +18 -0
  113. package/node_modules/get-intrinsic/index.js +15 -7
  114. package/node_modules/get-intrinsic/package.json +12 -12
  115. package/node_modules/has-property-descriptors/CHANGELOG.md +8 -0
  116. package/node_modules/has-property-descriptors/index.js +3 -14
  117. package/node_modules/has-property-descriptors/package.json +5 -5
  118. package/node_modules/has-proto/CHANGELOG.md +15 -0
  119. package/node_modules/has-proto/index.d.ts +3 -0
  120. package/node_modules/has-proto/index.js +5 -1
  121. package/node_modules/has-proto/package.json +9 -5
  122. package/node_modules/has-proto/tsconfig.json +49 -0
  123. package/node_modules/has-tostringtag/.eslintrc +0 -6
  124. package/node_modules/has-tostringtag/.nycrc +13 -0
  125. package/node_modules/has-tostringtag/CHANGELOG.md +22 -0
  126. package/node_modules/has-tostringtag/index.d.ts +3 -0
  127. package/node_modules/has-tostringtag/index.js +1 -0
  128. package/node_modules/has-tostringtag/package.json +37 -13
  129. package/node_modules/has-tostringtag/shams.d.ts +3 -0
  130. package/node_modules/has-tostringtag/shams.js +1 -0
  131. package/node_modules/has-tostringtag/test/shams/core-js.js +3 -0
  132. package/node_modules/has-tostringtag/test/shams/get-own-property-symbols.js +2 -0
  133. package/node_modules/has-tostringtag/test/tests.js +2 -1
  134. package/node_modules/has-tostringtag/tsconfig.json +49 -0
  135. package/node_modules/hasown/CHANGELOG.md +8 -0
  136. package/node_modules/hasown/index.d.ts +3 -3
  137. package/node_modules/hasown/index.js +1 -1
  138. package/node_modules/hasown/package.json +13 -15
  139. package/node_modules/polygon-clipping/README.md +29 -26
  140. package/node_modules/polygon-clipping/dist/polygon-clipping.cjs.js +1398 -1421
  141. package/node_modules/polygon-clipping/dist/polygon-clipping.d.ts +13 -10
  142. package/node_modules/polygon-clipping/dist/polygon-clipping.esm.js +1139 -1427
  143. package/node_modules/polygon-clipping/dist/polygon-clipping.umd.js +1770 -1831
  144. package/node_modules/polygon-clipping/dist/polygon-clipping.umd.min.js +22 -8
  145. package/node_modules/polygon-clipping/dist/polygon-clipping.umd.min.js.map +1 -1
  146. package/node_modules/polygon-clipping/node_modules/robust-predicates/LICENSE +24 -0
  147. package/node_modules/polygon-clipping/node_modules/robust-predicates/README.md +82 -0
  148. package/node_modules/polygon-clipping/node_modules/robust-predicates/esm/incircle.js +765 -0
  149. package/node_modules/polygon-clipping/node_modules/robust-predicates/esm/insphere.js +766 -0
  150. package/node_modules/polygon-clipping/node_modules/robust-predicates/esm/orient2d.js +184 -0
  151. package/node_modules/polygon-clipping/node_modules/robust-predicates/esm/orient3d.js +462 -0
  152. package/node_modules/polygon-clipping/node_modules/robust-predicates/esm/util.js +138 -0
  153. package/node_modules/polygon-clipping/node_modules/robust-predicates/index.d.ts +49 -0
  154. package/node_modules/polygon-clipping/node_modules/robust-predicates/index.js +5 -0
  155. package/node_modules/polygon-clipping/node_modules/robust-predicates/package.json +75 -0
  156. package/node_modules/polygon-clipping/node_modules/robust-predicates/umd/incircle.js +908 -0
  157. package/node_modules/polygon-clipping/node_modules/robust-predicates/umd/incircle.min.js +1 -0
  158. package/node_modules/polygon-clipping/node_modules/robust-predicates/umd/insphere.js +914 -0
  159. package/node_modules/polygon-clipping/node_modules/robust-predicates/umd/insphere.min.js +1 -0
  160. package/node_modules/polygon-clipping/node_modules/robust-predicates/umd/orient2d.js +280 -0
  161. package/node_modules/polygon-clipping/node_modules/robust-predicates/umd/orient2d.min.js +1 -0
  162. package/node_modules/polygon-clipping/node_modules/robust-predicates/umd/orient3d.js +601 -0
  163. package/node_modules/polygon-clipping/node_modules/robust-predicates/umd/orient3d.min.js +1 -0
  164. package/node_modules/polygon-clipping/node_modules/robust-predicates/umd/predicates.js +2328 -0
  165. package/node_modules/polygon-clipping/node_modules/robust-predicates/umd/predicates.min.js +1 -0
  166. package/node_modules/polygon-clipping/package.json +30 -25
  167. package/node_modules/protobufjs/dist/light/protobuf.js +4 -4
  168. package/node_modules/protobufjs/dist/light/protobuf.js.map +1 -1
  169. package/node_modules/protobufjs/dist/light/protobuf.min.js +3 -3
  170. package/node_modules/protobufjs/dist/light/protobuf.min.js.map +1 -1
  171. package/node_modules/protobufjs/dist/minimal/protobuf.js +2 -2
  172. package/node_modules/protobufjs/dist/minimal/protobuf.min.js +2 -2
  173. package/node_modules/protobufjs/dist/protobuf.js +4 -4
  174. package/node_modules/protobufjs/dist/protobuf.js.map +1 -1
  175. package/node_modules/protobufjs/dist/protobuf.min.js +3 -3
  176. package/node_modules/protobufjs/dist/protobuf.min.js.map +1 -1
  177. package/node_modules/protobufjs/package.json +1 -1
  178. package/node_modules/protobufjs/src/root.js +2 -2
  179. package/node_modules/regexp.prototype.flags/CHANGELOG.md +13 -0
  180. package/node_modules/regexp.prototype.flags/implementation.js +2 -2
  181. package/node_modules/regexp.prototype.flags/package.json +11 -10
  182. package/node_modules/regexp.prototype.flags/test/tests.js +13 -13
  183. package/node_modules/set-function-length/CHANGELOG.md +18 -0
  184. package/node_modules/set-function-length/env.d.ts +6 -0
  185. package/node_modules/set-function-length/env.d.ts.map +1 -0
  186. package/node_modules/set-function-length/env.js +9 -4
  187. package/node_modules/set-function-length/index.d.ts +7 -0
  188. package/node_modules/set-function-length/index.d.ts.map +1 -0
  189. package/node_modules/set-function-length/index.js +6 -3
  190. package/node_modules/set-function-length/package.json +33 -13
  191. package/node_modules/set-function-length/tsconfig.json +59 -0
  192. package/node_modules/set-function-name/.eslintrc +1 -0
  193. package/node_modules/set-function-name/CHANGELOG.md +9 -0
  194. package/node_modules/set-function-name/index.d.ts +5 -0
  195. package/node_modules/set-function-name/index.js +4 -3
  196. package/node_modules/set-function-name/package.json +28 -9
  197. package/node_modules/set-function-name/tsconfig.json +59 -0
  198. package/package.json +4 -4
  199. package/tak-ingest.js +15 -7
  200. package/node_modules/define-data-property/index.d.ts.map +0 -1
  201. package/node_modules/hasown/index.d.ts.map +0 -1
  202. package/node_modules/polygon-clipping/CHANGELOG.md +0 -129
@@ -1,10 +1,24 @@
1
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).polygonClipping=e()}(this,(function(){"use strict";function t(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function e(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function r(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}
1
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).polygonClipping=e()}(this,(function(){"use strict";
2
2
  /**
3
- * splaytree v3.1.0
4
- * Fast Splay tree for Node and browser
5
- *
6
- * @author Alexander Milevski <info@w8r.name>
7
- * @license MIT
8
- * @preserve
9
- */var n=function(t,e){this.next=null,this.key=t,this.data=e,this.left=null,this.right=null};function i(t,e){return t>e?1:t<e?-1:0}function o(t,e,r){for(var i=new n(null,null),o=i,s=i;;){var u=r(t,e.key);if(u<0){if(null===e.left)break;if(r(t,e.left.key)<0){var l=e.left;if(e.left=l.right,l.right=e,null===(e=l).left)break}s.left=e,s=e,e=e.left}else{if(!(u>0))break;if(null===e.right)break;if(r(t,e.right.key)>0){l=e.right;if(e.right=l.left,l.left=e,null===(e=l).right)break}o.right=e,o=e,e=e.right}}return o.right=e.left,s.left=e.right,e.left=i.right,e.right=i.left,e}function s(t,e,r,i){var s=new n(t,e);if(null===r)return s.left=s.right=null,s;var u=i(t,(r=o(t,r,i)).key);return u<0?(s.left=r.left,s.right=r,r.left=null):u>=0&&(s.right=r.right,s.left=r,r.right=null),s}function u(t,e,r){var n=null,i=null;if(e){var s=r((e=o(t,e,r)).key,t);0===s?(n=e.left,i=e.right):s<0?(i=e.right,e.right=null,n=e):(n=e.left,e.left=null,i=e)}return{left:n,right:i}}function l(t,e,r,n,i){if(t){n(e+(r?"└── ":"├── ")+i(t)+"\n");var o=e+(r?" ":"│ ");t.left&&l(t.left,o,!1,n,i),t.right&&l(t.right,o,!0,n,i)}}var h=function(){function t(t){void 0===t&&(t=i),this._root=null,this._size=0,this._comparator=t}return t.prototype.insert=function(t,e){return this._size++,this._root=s(t,e,this._root,this._comparator)},t.prototype.add=function(t,e){var r=new n(t,e);null===this._root&&(r.left=r.right=null,this._size++,this._root=r);var i=this._comparator,s=o(t,this._root,i),u=i(t,s.key);return 0===u?this._root=s:(u<0?(r.left=s.left,r.right=s,s.left=null):u>0&&(r.right=s.right,r.left=s,s.right=null),this._size++,this._root=r),this._root},t.prototype.remove=function(t){this._root=this._remove(t,this._root,this._comparator)},t.prototype._remove=function(t,e,r){var n;return null===e?null:0===r(t,(e=o(t,e,r)).key)?(null===e.left?n=e.right:(n=o(t,e.left,r)).right=e.right,this._size--,n):e},t.prototype.pop=function(){var t=this._root;if(t){for(;t.left;)t=t.left;return this._root=o(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,r=this._comparator;e;){var n=r(t,e.key);if(0===n)return e;e=n<0?e.left:e.right}return null},t.prototype.find=function(t){return this._root&&(this._root=o(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,r=this._comparator;e;){var n=r(t,e.key);if(0===n)return!0;e=n<0?e.left:e.right}return!1},t.prototype.forEach=function(t,e){for(var r=this._root,n=[],i=!1;!i;)null!==r?(n.push(r),r=r.left):0!==n.length?(r=n.pop(),t.call(e,r),r=r.right):i=!0;return this},t.prototype.range=function(t,e,r,n){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&&r.call(n,s))return this;s=s.right}return this},t.prototype.keys=function(){var t=[];return this.forEach((function(e){var r=e.key;return t.push(r)})),t},t.prototype.values=function(){var t=[];return this.forEach((function(e){var r=e.data;return t.push(r)})),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,r=!1,n=0,i=[];!r;)if(e)i.push(e),e=e.left;else if(i.length>0){if(e=i.pop(),n===t)return e;n++,e=e.right}else r=!0;return null},t.prototype.next=function(t){var e=this._root,r=null;if(t.right){for(r=t.right;r.left;)r=r.left;return r}for(var n=this._comparator;e;){var i=n(t.key,e.key);if(0===i)break;i<0?(r=e,e=e.left):e=e.right}return r},t.prototype.prev=function(t){var e=this._root,r=null;if(null!==t.left){for(r=t.left;r.right;)r=r.right;return r}for(var n=this._comparator;e;){var i=n(t.key,e.key);if(0===i)break;i<0?e=e.left:(r=e,e=e.right)}return r},t.prototype.clear=function(){return this._root=null,this._size=0,this},t.prototype.toList=function(){return function(t){var e=t,r=[],i=!1,o=new n(null,null),s=o;for(;!i;)e?(r.push(e),e=e.left):r.length>0?e=(e=s=s.next=r.pop()).right:i=!0;return s.next=null,o.next}(this._root)},t.prototype.load=function(t,e,r){void 0===e&&(e=[]),void 0===r&&(r=!1);var i=t.length,o=this._comparator;if(r&&p(t,e,0,i-1,o),null===this._root)this._root=f(t,e,0,i),this._size=i;else{var s=function(t,e,r){var i=new n(null,null),o=i,s=t,u=e;for(;null!==s&&null!==u;)r(s.key,u.key)<0?(o.next=s,s=s.next):(o.next=u,u=u.next),o=o.next;null!==s?o.next=s:null!==u&&(o.next=u);return i.next}(this.toList(),function(t,e){for(var r=new n(null,null),i=r,o=0;o<t.length;o++)i=i.next=new n(t[o],e[o]);return i.next=null,r.next}(t,e),o);i=this._size+i,this._root=a({head:s},0,i)}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 l(this._root,"",!0,(function(t){return e.push(t)}),t),e.join("")},t.prototype.update=function(t,e,r){var n=this._comparator,i=u(t,this._root,n),l=i.left,h=i.right;n(t,e)<0?h=s(e,r,h,n):l=s(e,r,l,n),this._root=function(t,e,r){return null===e?t:(null===t||((e=o(t.key,e,r)).left=t),e)}(l,h,n)},t.prototype.split=function(t){return u(t,this._root,this._comparator)},t}();function f(t,e,r,i){var o=i-r;if(o>0){var s=r+Math.floor(o/2),u=t[s],l=e[s],h=new n(u,l);return h.left=f(t,e,r,s),h.right=f(t,e,s+1,i),h}return null}function a(t,e,r){var n=r-e;if(n>0){var i=e+Math.floor(n/2),o=a(t,e,i),s=t.head;return s.left=o,t.head=t.head.next,s.right=a(t,i+1,r),s}return null}function p(t,e,r,n,i){if(!(r>=n)){for(var o=t[r+n>>1],s=r-1,u=n+1;;){do{s++}while(i(t[s],o)<0);do{u--}while(i(t[u],o)>0);if(s>=u)break;var l=t[s];t[s]=t[u],t[u]=l,l=e[s],e[s]=e[u],e[u]=l}p(t,e,r,u,i),p(t,e,u+1,n,i)}}var y=function(t,e){return t.ll.x<=e.x&&e.x<=t.ur.x&&t.ll.y<=e.y&&e.y<=t.ur.y},g=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 r=t.ll.x<e.ll.x?e.ll.x:t.ll.x,n=t.ur.x<e.ur.x?t.ur.x:e.ur.x;return{ll:{x:r,y:t.ll.y<e.ll.y?e.ll.y:t.ll.y},ur:{x:n,y:t.ur.y<e.ur.y?t.ur.y:e.ur.y}}},v=Number.EPSILON;void 0===v&&(v=Math.pow(2,-52));var c=v*v,x=function(t,e){if(-v<t&&t<v&&-v<e&&e<v)return 0;var r=t-e;return r*r<c*t*e?0:t<e?-1:1},b=function(){function e(){t(this,e),this.reset()}return r(e,[{key:"reset",value:function(){this.xRounder=new m,this.yRounder=new m}},{key:"round",value:function(t,e){return{x:this.xRounder.round(t),y:this.yRounder.round(e)}}}]),e}(),m=function(){function e(){t(this,e),this.tree=new h,this.round(0)}return r(e,[{key:"round",value:function(t){var e=this.tree.add(t),r=this.tree.prev(e);if(null!==r&&0===x(e.key,r.key))return this.tree.remove(t),r.key;var n=this.tree.next(e);return null!==n&&0===x(e.key,n.key)?(this.tree.remove(t),n.key):t}}]),e}(),d=new b,E=function(t,e){return t.x*e.y-t.y*e.x},S=function(t,e){return t.x*e.x+t.y*e.y},_=function(t,e,r){var n={x:e.x-t.x,y:e.y-t.y},i={x:r.x-t.x,y:r.y-t.y},o=E(n,i);return x(o,0)},k=function(t){return Math.sqrt(S(t,t))},w=function(t,e,r){var n={x:e.x-t.x,y:e.y-t.y},i={x:r.x-t.x,y:r.y-t.y};return S(i,n)/k(i)/k(n)},R=function(t,e,r){return 0===e.y?null:{x:t.x+e.x/e.y*(r-t.y),y:r}},I=function(t,e,r){return 0===e.x?null:{x:r,y:t.y+e.y/e.x*(r-t.x)}},P=function(){function e(r,n){t(this,e),void 0===r.events?r.events=[this]:r.events.push(this),this.point=r,this.isLeft=n}return r(e,null,[{key:"compare",value:function(t,r){var n=e.comparePoints(t.point,r.point);return 0!==n?n:(t.point!==r.point&&t.link(r),t.isLeft!==r.isLeft?t.isLeft?1:-1:O.compare(t.segment,r.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}}]),r(e,[{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,r=0,n=e.length;r<n;r++){var i=e[r];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 r=this.point.events[e];if(void 0===r.segment.consumedBy)for(var n=e+1;n<t;n++){var i=this.point.events[n];void 0===i.consumedBy&&(r.otherSE.point.events===i.otherSE.point.events&&r.segment.consume(i.segment))}}}},{key:"getAvailableLinkedEvents",value:function(){for(var t=[],e=0,r=this.point.events.length;e<r;e++){var n=this.point.events[e];n!==this&&!n.segment.ringOut&&n.segment.isInResult()&&t.push(n)}return t}},{key:"getLeftmostComparator",value:function(t){var e=this,r=new Map,n=function(n){var i,o,s,u,l,h=n.otherSE;r.set(n,{sine:(i=e.point,o=t.point,s=h.point,u={x:o.x-i.x,y:o.y-i.y},l={x:s.x-i.x,y:s.y-i.y},E(l,u)/k(l)/k(u)),cosine:w(e.point,t.point,h.point)})};return function(t,e){r.has(t)||n(t),r.has(e)||n(e);var i=r.get(t),o=i.sine,s=i.cosine,u=r.get(e),l=u.sine,h=u.cosine;return o>=0&&l>=0?s<h?1:s>h?-1:0:o<0&&l<0?s<h?-1:s>h?1:0:l<o?-1:l>o?1:0}}}]),e}(),N=0,O=function(){function e(r,n,i,o){t(this,e),this.id=++N,this.leftSE=r,r.segment=this,r.otherSE=n,this.rightSE=n,n.segment=this,n.otherSE=r,this.rings=i,this.windings=o}return r(e,null,[{key:"compare",value:function(t,e){var r=t.leftSE.point.x,n=e.leftSE.point.x,i=t.rightSE.point.x,o=e.rightSE.point.x;if(o<r)return 1;if(i<n)return-1;var s=t.leftSE.point.y,u=e.leftSE.point.y,l=t.rightSE.point.y,h=e.rightSE.point.y;if(r<n){if(u<s&&u<l)return 1;if(u>s&&u>l)return-1;var f=t.comparePoint(e.leftSE.point);if(f<0)return 1;if(f>0)return-1;var a=e.comparePoint(t.rightSE.point);return 0!==a?a:-1}if(r>n){if(s<u&&s<h)return-1;if(s>u&&s>h)return 1;var p=e.comparePoint(t.leftSE.point);if(0!==p)return p;var y=t.comparePoint(e.rightSE.point);return y<0?1:y>0?-1:1}if(s<u)return-1;if(s>u)return 1;if(i<o){var g=e.comparePoint(t.rightSE.point);if(0!==g)return g}if(i>o){var v=t.comparePoint(e.rightSE.point);if(v<0)return 1;if(v>0)return-1}if(i!==o){var c=l-s,x=i-r,b=h-u,m=o-n;if(c>x&&b<m)return 1;if(c<x&&b>m)return-1}return i>o?1:i<o||l<h?-1:l>h?1:t.id<e.id?-1:t.id>e.id?1:0}}]),r(e,[{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,r=this.rightSE.point,n=this.vector();if(e.x===r.x)return t.x===e.x?0:t.x<e.x?1:-1;var i=(t.y-e.y)/n.y,o=e.x+i*n.x;if(t.x===o)return 0;var s=(t.x-e.x)/n.x,u=e.y+s*n.y;return t.y===u?0:t.y<u?-1:1}},{key:"getIntersection",value:function(t){var e=this.bbox(),r=t.bbox(),n=g(e,r);if(null===n)return null;var i=this.leftSE.point,o=this.rightSE.point,s=t.leftSE.point,u=t.rightSE.point,l=y(e,s)&&0===this.comparePoint(s),h=y(r,i)&&0===t.comparePoint(i),f=y(e,u)&&0===this.comparePoint(u),a=y(r,o)&&0===t.comparePoint(o);if(h&&l)return a&&!f?o:!a&&f?u:null;if(h)return f&&i.x===u.x&&i.y===u.y?null:i;if(l)return a&&o.x===s.x&&o.y===s.y?null:s;if(a&&f)return null;if(a)return o;if(f)return u;var p=function(t,e,r,n){if(0===e.x)return I(r,n,t.x);if(0===n.x)return I(t,e,r.x);if(0===e.y)return R(r,n,t.y);if(0===n.y)return R(t,e,r.y);var i=E(e,n);if(0==i)return null;var o={x:r.x-t.x,y:r.y-t.y},s=E(o,e)/i,u=E(o,n)/i;return{x:(t.x+u*e.x+(r.x+s*n.x))/2,y:(t.y+u*e.y+(r.y+s*n.y))/2}}(i,this.vector(),s,t.vector());return null===p?null:y(n,p)?d.round(p.x,p.y):null}},{key:"split",value:function(t){var r=[],n=void 0!==t.events,i=new P(t,!0),o=new P(t,!1),s=this.rightSE;this.replaceRightSE(o),r.push(o),r.push(i);var u=new e(i,s,this.rings.slice(),this.windings.slice());return P.comparePoints(u.leftSE.point,u.rightSE.point)>0&&u.swapEvents(),P.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),n&&(i.checkForConsuming(),o.checkForConsuming()),r}},{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,r=this.windings.length;e<r;e++)this.windings[e]*=-1}},{key:"consume",value:function(t){for(var r=this,n=t;r.consumedBy;)r=r.consumedBy;for(;n.consumedBy;)n=n.consumedBy;var i=e.compare(r,n);if(0!==i){if(i>0){var o=r;r=n,n=o}if(r.prev===n){var s=r;r=n,n=s}for(var u=0,l=n.rings.length;u<l;u++){var h=n.rings[u],f=n.windings[u],a=r.rings.indexOf(h);-1===a?(r.rings.push(h),r.windings.push(f)):r.windings[a]+=f}n.rings=null,n.windings=null,n.consumedBy=r,n.leftSE.consumedBy=r.leftSE,n.rightSE.consumedBy=r.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,r=this._afterState.windings,n=this._afterState.multiPolys,i=0,o=this.rings.length;i<o;i++){var s=this.rings[i],u=this.windings[i],l=e.indexOf(s);-1===l?(e.push(s),r.push(u)):r[l]+=u}for(var h=[],f=[],a=0,p=e.length;a<p;a++)if(0!==r[a]){var y=e[a],g=y.poly;if(-1===f.indexOf(g))if(y.isExterior)h.push(g);else{-1===f.indexOf(g)&&f.push(g);var v=h.indexOf(y.poly);-1!==v&&h.splice(v,1)}}for(var c=0,x=h.length;c<x;c++){var b=h[c].multiPoly;-1===n.indexOf(b)&&n.push(b)}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(F.type){case"union":var r=0===t.length,n=0===e.length;this._isInResult=r!==n;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===F.numMultiPolys&&i<o;break;case"xor":var s=Math.abs(t.length-e.length);this._isInResult=s%2==1;break;case"difference":var u=function(t){return 1===t.length&&t[0].isSubject};this._isInResult=u(t)!==u(e);break;default:throw new Error("Unrecognized operation type found ".concat(F.type))}return this._isInResult}}],[{key:"fromRing",value:function(t,r,n){var i,o,s,u=P.comparePoints(t,r);if(u<0)i=t,o=r,s=1;else{if(!(u>0))throw new Error("Tried to create degenerate segment at [".concat(t.x,", ").concat(t.y,"]"));i=r,o=t,s=-1}return new e(new P(i,!0),new P(o,!1),[n],[s])}}]),e}(),A=function(){function e(r,n,i){if(t(this,e),!Array.isArray(r)||0===r.length)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=n,this.isExterior=i,this.segments=[],"number"!=typeof r[0][0]||"number"!=typeof r[0][1])throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var o=d.round(r[0][0],r[0][1]);this.bbox={ll:{x:o.x,y:o.y},ur:{x:o.x,y:o.y}};for(var s=o,u=1,l=r.length;u<l;u++){if("number"!=typeof r[u][0]||"number"!=typeof r[u][1])throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var h=d.round(r[u][0],r[u][1]);h.x===s.x&&h.y===s.y||(this.segments.push(O.fromRing(s,h,this)),h.x<this.bbox.ll.x&&(this.bbox.ll.x=h.x),h.y<this.bbox.ll.y&&(this.bbox.ll.y=h.y),h.x>this.bbox.ur.x&&(this.bbox.ur.x=h.x),h.y>this.bbox.ur.y&&(this.bbox.ur.y=h.y),s=h)}o.x===s.x&&o.y===s.y||this.segments.push(O.fromRing(s,o,this))}return r(e,[{key:"getSweepEvents",value:function(){for(var t=[],e=0,r=this.segments.length;e<r;e++){var n=this.segments[e];t.push(n.leftSE),t.push(n.rightSE)}return t}}]),e}(),L=function(){function e(r,n){if(t(this,e),!Array.isArray(r))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new A(r[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 i=1,o=r.length;i<o;i++){var s=new A(r[i],this,!1);s.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=s.bbox.ll.x),s.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=s.bbox.ll.y),s.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=s.bbox.ur.x),s.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=s.bbox.ur.y),this.interiorRings.push(s)}this.multiPoly=n}return r(e,[{key:"getSweepEvents",value:function(){for(var t=this.exteriorRing.getSweepEvents(),e=0,r=this.interiorRings.length;e<r;e++)for(var n=this.interiorRings[e].getSweepEvents(),i=0,o=n.length;i<o;i++)t.push(n[i]);return t}}]),e}(),z=function(){function e(r,n){if(t(this,e),!Array.isArray(r))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{"number"==typeof r[0][0][0]&&(r=[r])}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 i=0,o=r.length;i<o;i++){var s=new L(r[i],this);s.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=s.bbox.ll.x),s.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=s.bbox.ll.y),s.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=s.bbox.ur.x),s.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=s.bbox.ur.y),this.polys.push(s)}this.isSubject=n}return r(e,[{key:"getSweepEvents",value:function(){for(var t=[],e=0,r=this.polys.length;e<r;e++)for(var n=this.polys[e].getSweepEvents(),i=0,o=n.length;i<o;i++)t.push(n[i]);return t}}]),e}(),B=function(){function e(r){t(this,e),this.events=r;for(var n=0,i=r.length;n<i;n++)r[n].segment.ringOut=this;this.poly=null}return r(e,null,[{key:"factory",value:function(t){for(var r=[],n=0,i=t.length;n<i;n++){var o=t[n];if(o.isInResult()&&!o.ringOut){for(var s=null,u=o.leftSE,l=o.rightSE,h=[u],f=u.point,a=[];s=u,u=l,h.push(u),u.point!==f;)for(;;){var p=u.getAvailableLinkedEvents();if(0===p.length){var y=h[0].point,g=h[h.length-1].point;throw new Error("Unable to complete output ring starting at [".concat(y.x,",")+" ".concat(y.y,"]. Last matching segment found ends at")+" [".concat(g.x,", ").concat(g.y,"]."))}if(1===p.length){l=p[0].otherSE;break}for(var v=null,c=0,x=a.length;c<x;c++)if(a[c].point===u.point){v=c;break}if(null===v){a.push({index:h.length,point:u.point});var b=u.getLeftmostComparator(s);l=p.sort(b)[0].otherSE;break}var m=a.splice(v)[0],d=h.splice(m.index);d.unshift(d[0].otherSE),r.push(new e(d.reverse()))}r.push(new e(h))}}return r}}]),r(e,[{key:"getGeom",value:function(){for(var t=this.events[0].point,e=[t],r=1,n=this.events.length-1;r<n;r++){var i=this.events[r].point,o=this.events[r+1].point;0!==_(i,t,o)&&(e.push(i),t=i)}if(1===e.length)return null;var s=e[0],u=e[1];0===_(s,t,u)&&e.shift(),e.push(e[0]);for(var l=this.isExteriorRing()?1:-1,h=this.isExteriorRing()?0:e.length-1,f=this.isExteriorRing()?e.length:-1,a=[],p=h;p!=f;p+=l)a.push([e[p].x,e[p].y]);return a}},{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,r=this.events.length;e<r;e++){var n=this.events[e];P.compare(t,n)>0&&(t=n)}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}}}]),e}(),M=function(){function e(r){t(this,e),this.exteriorRing=r,r.poly=this,this.interiorRings=[]}return r(e,[{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,r=this.interiorRings.length;e<r;e++){var n=this.interiorRings[e].getGeom();null!==n&&t.push(n)}return t}}]),e}(),G=function(){function e(r){t(this,e),this.rings=r,this.polys=this._composePolys(r)}return r(e,[{key:"getGeom",value:function(){for(var t=[],e=0,r=this.polys.length;e<r;e++){var n=this.polys[e].getGeom();null!==n&&t.push(n)}return t}},{key:"_composePolys",value:function(t){for(var e=[],r=0,n=t.length;r<n;r++){var i=t[r];if(!i.poly)if(i.isExteriorRing())e.push(new M(i));else{var o=i.enclosingRing();o.poly||e.push(new M(o)),o.poly.addInterior(i)}}return e}}]),e}(),T=function(){function e(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:O.compare;t(this,e),this.queue=r,this.tree=new h(n),this.segments=[]}return r(e,[{key:"process",value:function(t){var e=t.segment,r=[];if(t.consumedBy)return t.isLeft?this.queue.remove(t.otherSE):this.tree.remove(e),r;var n=t.isLeft?this.tree.insert(e):this.tree.find(e);if(!n)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=n,o=n,s=void 0,u=void 0;void 0===s;)null===(i=this.tree.prev(i))?s=null:void 0===i.key.consumedBy&&(s=i.key);for(;void 0===u;)null===(o=this.tree.next(o))?u=null:void 0===o.key.consumedBy&&(u=o.key);if(t.isLeft){var l=null;if(s){var h=s.getIntersection(e);if(null!==h&&(e.isAnEndpoint(h)||(l=h),!s.isAnEndpoint(h)))for(var f=this._splitSafely(s,h),a=0,p=f.length;a<p;a++)r.push(f[a])}var y=null;if(u){var g=u.getIntersection(e);if(null!==g&&(e.isAnEndpoint(g)||(y=g),!u.isAnEndpoint(g)))for(var v=this._splitSafely(u,g),c=0,x=v.length;c<x;c++)r.push(v[c])}if(null!==l||null!==y){var b=null;if(null===l)b=y;else if(null===y)b=l;else{b=P.comparePoints(l,y)<=0?l:y}this.queue.remove(e.rightSE),r.push(e.rightSE);for(var m=e.split(b),d=0,E=m.length;d<E;d++)r.push(m[d])}r.length>0?(this.tree.remove(e),r.push(t)):(this.segments.push(e),e.prev=s)}else{if(s&&u){var S=s.getIntersection(u);if(null!==S){if(!s.isAnEndpoint(S))for(var _=this._splitSafely(s,S),k=0,w=_.length;k<w;k++)r.push(_[k]);if(!u.isAnEndpoint(S))for(var R=this._splitSafely(u,S),I=0,N=R.length;I<N;I++)r.push(R[I])}}this.tree.remove(e)}return r}},{key:"_splitSafely",value:function(t,e){this.tree.remove(t);var r=t.rightSE;this.queue.remove(r);var n=t.split(e);return n.push(r),void 0===t.consumedBy&&this.tree.insert(t),n}}]),e}(),C="undefined"!=typeof process&&process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,q="undefined"!=typeof process&&process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6,F=new(function(){function e(){t(this,e)}return r(e,[{key:"run",value:function(t,e,r){F.type=t,d.reset();for(var n=[new z(e,!0)],i=0,o=r.length;i<o;i++)n.push(new z(r[i],!1));if(F.numMultiPolys=n.length,"difference"===F.type)for(var s=n[0],u=1;u<n.length;)null!==g(n[u].bbox,s.bbox)?u++:n.splice(u,1);if("intersection"===F.type)for(var l=0,f=n.length;l<f;l++)for(var a=n[l],p=l+1,y=n.length;p<y;p++)if(null===g(a.bbox,n[p].bbox))return[];for(var v=new h(P.compare),c=0,x=n.length;c<x;c++)for(var b=n[c].getSweepEvents(),m=0,E=b.length;m<E;m++)if(v.insert(b[m]),v.size>C)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big). Please file a bug report.");for(var S=new T(v),_=v.size,k=v.pop();k;){var w=k.key;if(v.size===_){var R=w.segment;throw new Error("Unable to pop() ".concat(w.isLeft?"left":"right"," SweepEvent ")+"[".concat(w.point.x,", ").concat(w.point.y,"] from segment #").concat(R.id," ")+"[".concat(R.leftSE.point.x,", ").concat(R.leftSE.point.y,"] -> ")+"[".concat(R.rightSE.point.x,", ").concat(R.rightSE.point.y,"] from queue. ")+"Please file a bug report.")}if(v.size>C)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big). Please file a bug report.");if(S.segments.length>q)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");for(var I=S.process(w),N=0,O=I.length;N<O;N++){var A=I[N];void 0===A.consumedBy&&v.insert(A)}_=v.size,k=v.pop()}d.reset();var L=B.factory(S.segments);return new G(L).getGeom()}}]),e}());return{union:function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return F.run("union",t,r)},intersection:function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return F.run("intersection",t,r)},xor:function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return F.run("xor",t,r)},difference:function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];return F.run("difference",t,r)}}}));
3
+ * splaytree v3.1.2
4
+ * Fast Splay tree for Node and browser
5
+ *
6
+ * @author Alexander Milevski <info@w8r.name>
7
+ * @license MIT
8
+ * @preserve
9
+ */
10
+ /*! *****************************************************************************
11
+ Copyright (c) Microsoft Corporation. All rights reserved.
12
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
13
+ this file except in compliance with the License. You may obtain a copy of the
14
+ License at http://www.apache.org/licenses/LICENSE-2.0
15
+
16
+ THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17
+ KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
18
+ WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
19
+ MERCHANTABLITY OR NON-INFRINGEMENT.
20
+
21
+ See the Apache Version 2.0 License for specific language governing permissions
22
+ and limitations under the License.
23
+ ***************************************************************************** */function t(t,e){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function l(o){return function(l){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,l])}}}var e=function(t,e){this.next=null,this.key=t,this.data=e,this.left=null,this.right=null};function n(t,e){return t>e?1:t<e?-1:0}function r(t,n,r){for(var i=new e(null,null),o=i,s=i;;){var l=r(t,n.key);if(l<0){if(null===n.left)break;if(r(t,n.left.key)<0){var h=n.left;if(n.left=h.right,h.right=n,null===(n=h).left)break}s.left=n,s=n,n=n.left}else{if(!(l>0))break;if(null===n.right)break;if(r(t,n.right.key)>0){h=n.right;if(n.right=h.left,h.left=n,null===(n=h).right)break}o.right=n,o=n,n=n.right}}return o.right=n.left,s.left=n.right,n.left=i.right,n.right=i.left,n}function i(t,n,i,o){var s=new e(t,n);if(null===i)return s.left=s.right=null,s;var l=o(t,(i=r(t,i,o)).key);return l<0?(s.left=i.left,s.right=i,i.left=null):l>=0&&(s.right=i.right,s.left=i,i.right=null),s}function o(t,e,n){var i=null,o=null;if(e){var s=n((e=r(t,e,n)).key,t);0===s?(i=e.left,o=e.right):s<0?(o=e.right,e.right=null,i=e):(i=e.left,e.left=null,o=e)}return{left:i,right:o}}function s(t,e,n,r,i){if(t){r(e+(n?"└── ":"├── ")+i(t)+"\n");var o=e+(n?" ":"│ ");t.left&&s(t.left,o,!1,r,i),t.right&&s(t.right,o,!0,r,i)}}var l=function(){function l(t){void 0===t&&(t=n),this._root=null,this._size=0,this._comparator=t}return l.prototype.insert=function(t,e){return this._size++,this._root=i(t,e,this._root,this._comparator)},l.prototype.add=function(t,n){var i=new e(t,n);null===this._root&&(i.left=i.right=null,this._size++,this._root=i);var o=this._comparator,s=r(t,this._root,o),l=o(t,s.key);return 0===l?this._root=s:(l<0?(i.left=s.left,i.right=s,s.left=null):l>0&&(i.right=s.right,i.left=s,s.right=null),this._size++,this._root=i),this._root},l.prototype.remove=function(t){this._root=this._remove(t,this._root,this._comparator)},l.prototype._remove=function(t,e,n){var i;return null===e?null:0===n(t,(e=r(t,e,n)).key)?(null===e.left?i=e.right:(i=r(t,e.left,n)).right=e.right,this._size--,i):e},l.prototype.pop=function(){var t=this._root;if(t){for(;t.left;)t=t.left;return this._root=r(t.key,this._root,this._comparator),this._root=this._remove(t.key,this._root,this._comparator),{key:t.key,data:t.data}}return null},l.prototype.findStatic=function(t){for(var e=this._root,n=this._comparator;e;){var r=n(t,e.key);if(0===r)return e;e=r<0?e.left:e.right}return null},l.prototype.find=function(t){return this._root&&(this._root=r(t,this._root,this._comparator),0!==this._comparator(t,this._root.key))?null:this._root},l.prototype.contains=function(t){for(var e=this._root,n=this._comparator;e;){var r=n(t,e.key);if(0===r)return!0;e=r<0?e.left:e.right}return!1},l.prototype.forEach=function(t,e){for(var n=this._root,r=[],i=!1;!i;)null!==n?(r.push(n),n=n.left):0!==r.length?(n=r.pop(),t.call(e,n),n=n.right):i=!0;return this},l.prototype.range=function(t,e,n,r){for(var i=[],o=this._comparator,s=this._root;0!==i.length||s;)if(s)i.push(s),s=s.left;else{if(o((s=i.pop()).key,e)>0)break;if(o(s.key,t)>=0&&n.call(r,s))return this;s=s.right}return this},l.prototype.keys=function(){var t=[];return this.forEach((function(e){var n=e.key;return t.push(n)})),t},l.prototype.values=function(){var t=[];return this.forEach((function(e){var n=e.data;return t.push(n)})),t},l.prototype.min=function(){return this._root?this.minNode(this._root).key:null},l.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},l.prototype.minNode=function(t){if(void 0===t&&(t=this._root),t)for(;t.left;)t=t.left;return t},l.prototype.maxNode=function(t){if(void 0===t&&(t=this._root),t)for(;t.right;)t=t.right;return t},l.prototype.at=function(t){for(var e=this._root,n=!1,r=0,i=[];!n;)if(e)i.push(e),e=e.left;else if(i.length>0){if(e=i.pop(),r===t)return e;r++,e=e.right}else n=!0;return null},l.prototype.next=function(t){var e=this._root,n=null;if(t.right){for(n=t.right;n.left;)n=n.left;return n}for(var r=this._comparator;e;){var i=r(t.key,e.key);if(0===i)break;i<0?(n=e,e=e.left):e=e.right}return n},l.prototype.prev=function(t){var e=this._root,n=null;if(null!==t.left){for(n=t.left;n.right;)n=n.right;return n}for(var r=this._comparator;e;){var i=r(t.key,e.key);if(0===i)break;i<0?e=e.left:(n=e,e=e.right)}return n},l.prototype.clear=function(){return this._root=null,this._size=0,this},l.prototype.toList=function(){return function(t){var n=t,r=[],i=!1,o=new e(null,null),s=o;for(;!i;)n?(r.push(n),n=n.left):r.length>0?n=(n=s=s.next=r.pop()).right:i=!0;return s.next=null,o.next}(this._root)},l.prototype.load=function(t,n,r){void 0===n&&(n=[]),void 0===r&&(r=!1);var i=t.length,o=this._comparator;if(r&&f(t,n,0,i-1,o),null===this._root)this._root=h(t,n,0,i),this._size=i;else{var s=function(t,n,r){var i=new e(null,null),o=i,s=t,l=n;for(;null!==s&&null!==l;)r(s.key,l.key)<0?(o.next=s,s=s.next):(o.next=l,l=l.next),o=o.next;null!==s?o.next=s:null!==l&&(o.next=l);return i.next}(this.toList(),function(t,n){for(var r=new e(null,null),i=r,o=0;o<t.length;o++)i=i.next=new e(t[o],n[o]);return i.next=null,r.next}(t,n),o);i=this._size+i,this._root=u({head:s},0,i)}return this},l.prototype.isEmpty=function(){return null===this._root},Object.defineProperty(l.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),l.prototype.toString=function(t){void 0===t&&(t=function(t){return String(t.key)});var e=[];return s(this._root,"",!0,(function(t){return e.push(t)}),t),e.join("")},l.prototype.update=function(t,e,n){var s=this._comparator,l=o(t,this._root,s),h=l.left,u=l.right;s(t,e)<0?u=i(e,n,u,s):h=i(e,n,h,s),this._root=function(t,e,n){return null===e?t:(null===t||((e=r(t.key,e,n)).left=t),e)}(h,u,s)},l.prototype.split=function(t){return o(t,this._root,this._comparator)},l.prototype[Symbol.iterator]=function(){var e,n,r;return t(this,(function(t){switch(t.label){case 0:e=this._root,n=[],r=!1,t.label=1;case 1:return r?[3,6]:null===e?[3,2]:(n.push(e),e=e.left,[3,5]);case 2:return 0===n.length?[3,4]:[4,e=n.pop()];case 3:return t.sent(),e=e.right,[3,5];case 4:r=!0,t.label=5;case 5:return[3,1];case 6:return[2]}}))},l}();function h(t,n,r,i){var o=i-r;if(o>0){var s=r+Math.floor(o/2),l=t[s],u=n[s],f=new e(l,u);return f.left=h(t,n,r,s),f.right=h(t,n,s+1,i),f}return null}function u(t,e,n){var r=n-e;if(r>0){var i=e+Math.floor(r/2),o=u(t,e,i),s=t.head;return s.left=o,t.head=t.head.next,s.right=u(t,i+1,n),s}return null}function f(t,e,n,r,i){if(!(n>=r)){for(var o=t[n+r>>1],s=n-1,l=r+1;;){do{s++}while(i(t[s],o)<0);do{l--}while(i(t[l],o)>0);if(s>=l)break;var h=t[s];t[s]=t[l],t[l]=h,h=e[s],e[s]=e[l],e[l]=h}f(t,e,n,l,i),f(t,e,l+1,r,i)}}const c=(t,e)=>t.ll.x<=e.x&&e.x<=t.ur.x&&t.ll.y<=e.y&&e.y<=t.ur.y,p=(t,e)=>{if(e.ur.x<t.ll.x||t.ur.x<e.ll.x||e.ur.y<t.ll.y||t.ur.y<e.ll.y)return null;const n=t.ll.x<e.ll.x?e.ll.x:t.ll.x,r=t.ur.x<e.ur.x?t.ur.x:e.ur.x;return{ll:{x:n,y:t.ll.y<e.ll.y?e.ll.y:t.ll.y},ur:{x:r,y:t.ur.y<e.ur.y?t.ur.y:e.ur.y}}};let g=Number.EPSILON;void 0===g&&(g=Math.pow(2,-52));const a=g*g,y=(t,e)=>{if(-g<t&&t<g&&-g<e&&e<g)return 0;const n=t-e;return n*n<a*t*e?0:t<e?-1:1};class x{constructor(){this.tree=new l,this.round(0)}round(t){const e=this.tree.add(t),n=this.tree.prev(e);if(null!==n&&0===y(e.key,n.key))return this.tree.remove(t),n.key;const r=this.tree.next(e);return null!==r&&0===y(e.key,r.key)?(this.tree.remove(t),r.key):t}}const b=new class{constructor(){this.reset()}reset(){this.xRounder=new x,this.yRounder=new x}round(t,e){return{x:this.xRounder.round(t),y:this.yRounder.round(e)}}},v=11102230246251565e-32,d=134217729,m=(3+8*v)*v;function E(t,e,n,r,i){let o,s,l,h,u=e[0],f=r[0],c=0,p=0;f>u==f>-u?(o=u,u=e[++c]):(o=f,f=r[++p]);let g=0;if(c<t&&p<n)for(f>u==f>-u?(s=u+o,l=o-(s-u),u=e[++c]):(s=f+o,l=o-(s-f),f=r[++p]),o=s,0!==l&&(i[g++]=l);c<t&&p<n;)f>u==f>-u?(s=o+u,h=s-o,l=o-(s-h)+(u-h),u=e[++c]):(s=o+f,h=s-o,l=o-(s-h)+(f-h),f=r[++p]),o=s,0!==l&&(i[g++]=l);for(;c<t;)s=o+u,h=s-o,l=o-(s-h)+(u-h),u=e[++c],o=s,0!==l&&(i[g++]=l);for(;p<n;)s=o+f,h=s-o,l=o-(s-h)+(f-h),f=r[++p],o=s,0!==l&&(i[g++]=l);return 0===o&&0!==g||(i[g++]=o),g}function S(t){return new Float64Array(t)}const _=22204460492503146e-32,w=11093356479670487e-47,k=S(4),R=S(8),I=S(12),P=S(16),N=S(4);function A(t,e,n,r,i,o){const s=(e-o)*(n-i),l=(t-i)*(r-o),h=s-l,u=Math.abs(s+l);return Math.abs(h)>=33306690738754716e-32*u?h:-function(t,e,n,r,i,o,s){let l,h,u,f,c,p,g,a,y,x,b,v,S,A,O,L,$,M;const z=t-i,B=n-i,G=e-o,T=r-o;A=z*T,p=d*z,g=p-(p-z),a=z-g,p=d*T,y=p-(p-T),x=T-y,O=a*x-(A-g*y-a*y-g*x),L=G*B,p=d*G,g=p-(p-G),a=G-g,p=d*B,y=p-(p-B),x=B-y,$=a*x-(L-g*y-a*y-g*x),b=O-$,c=O-b,k[0]=O-(b+c)+(c-$),v=A+b,c=v-A,S=A-(v-c)+(b-c),b=S-L,c=S-b,k[1]=S-(b+c)+(c-L),M=v+b,c=M-v,k[2]=v-(M-c)+(b-c),k[3]=M;let q=function(t,e){let n=e[0];for(let r=1;r<t;r++)n+=e[r];return n}(4,k),C=_*s;if(q>=C||-q>=C)return q;if(c=t-z,l=t-(z+c)+(c-i),c=n-B,u=n-(B+c)+(c-i),c=e-G,h=e-(G+c)+(c-o),c=r-T,f=r-(T+c)+(c-o),0===l&&0===h&&0===u&&0===f)return q;if(C=w*s+m*Math.abs(q),q+=z*f+T*l-(G*u+B*h),q>=C||-q>=C)return q;A=l*T,p=d*l,g=p-(p-l),a=l-g,p=d*T,y=p-(p-T),x=T-y,O=a*x-(A-g*y-a*y-g*x),L=h*B,p=d*h,g=p-(p-h),a=h-g,p=d*B,y=p-(p-B),x=B-y,$=a*x-(L-g*y-a*y-g*x),b=O-$,c=O-b,N[0]=O-(b+c)+(c-$),v=A+b,c=v-A,S=A-(v-c)+(b-c),b=S-L,c=S-b,N[1]=S-(b+c)+(c-L),M=v+b,c=M-v,N[2]=v-(M-c)+(b-c),N[3]=M;const F=E(4,k,4,N,R);A=z*f,p=d*z,g=p-(p-z),a=z-g,p=d*f,y=p-(p-f),x=f-y,O=a*x-(A-g*y-a*y-g*x),L=G*u,p=d*G,g=p-(p-G),a=G-g,p=d*u,y=p-(p-u),x=u-y,$=a*x-(L-g*y-a*y-g*x),b=O-$,c=O-b,N[0]=O-(b+c)+(c-$),v=A+b,c=v-A,S=A-(v-c)+(b-c),b=S-L,c=S-b,N[1]=S-(b+c)+(c-L),M=v+b,c=M-v,N[2]=v-(M-c)+(b-c),N[3]=M;const j=E(F,R,4,N,I);A=l*f,p=d*l,g=p-(p-l),a=l-g,p=d*f,y=p-(p-f),x=f-y,O=a*x-(A-g*y-a*y-g*x),L=h*u,p=d*h,g=p-(p-h),a=h-g,p=d*u,y=p-(p-u),x=u-y,$=a*x-(L-g*y-a*y-g*x),b=O-$,c=O-b,N[0]=O-(b+c)+(c-$),v=A+b,c=v-A,S=A-(v-c)+(b-c),b=S-L,c=S-b,N[1]=S-(b+c)+(c-L),M=v+b,c=M-v,N[2]=v-(M-c)+(b-c),N[3]=M;const U=E(j,I,4,N,P);return P[U-1]}(t,e,n,r,i,o,u)}const O=(t,e)=>t.x*e.y-t.y*e.x,L=(t,e)=>t.x*e.x+t.y*e.y,$=(t,e,n)=>{const r=A(t.x,t.y,e.x,e.y,n.x,n.y);return r>0?-1:r<0?1:0},M=t=>Math.sqrt(L(t,t)),z=(t,e,n)=>{const r={x:e.x-t.x,y:e.y-t.y},i={x:n.x-t.x,y:n.y-t.y};return O(i,r)/M(i)/M(r)},B=(t,e,n)=>{const r={x:e.x-t.x,y:e.y-t.y},i={x:n.x-t.x,y:n.y-t.y};return L(i,r)/M(i)/M(r)},G=(t,e,n)=>0===e.y?null:{x:t.x+e.x/e.y*(n-t.y),y:n},T=(t,e,n)=>0===e.x?null:{x:n,y:t.y+e.y/e.x*(n-t.x)};class q{static compare(t,e){const n=q.comparePoints(t.point,e.point);return 0!==n?n:(t.point!==e.point&&t.link(e),t.isLeft!==e.isLeft?t.isLeft?1:-1:F.compare(t.segment,e.segment))}static comparePoints(t,e){return t.x<e.x?-1:t.x>e.x?1:t.y<e.y?-1:t.y>e.y?1:0}constructor(t,e){void 0===t.events?t.events=[this]:t.events.push(this),this.point=t,this.isLeft=e}link(t){if(t.point===this.point)throw new Error("Tried to link already linked events");const e=t.point.events;for(let t=0,n=e.length;t<n;t++){const n=e[t];this.point.events.push(n),n.point=this.point}this.checkForConsuming()}checkForConsuming(){const t=this.point.events.length;for(let e=0;e<t;e++){const n=this.point.events[e];if(void 0===n.segment.consumedBy)for(let r=e+1;r<t;r++){const t=this.point.events[r];void 0===t.consumedBy&&(n.otherSE.point.events===t.otherSE.point.events&&n.segment.consume(t.segment))}}}getAvailableLinkedEvents(){const t=[];for(let e=0,n=this.point.events.length;e<n;e++){const n=this.point.events[e];n!==this&&!n.segment.ringOut&&n.segment.isInResult()&&t.push(n)}return t}getLeftmostComparator(t){const e=new Map,n=n=>{const r=n.otherSE;e.set(n,{sine:z(this.point,t.point,r.point),cosine:B(this.point,t.point,r.point)})};return(t,r)=>{e.has(t)||n(t),e.has(r)||n(r);const{sine:i,cosine:o}=e.get(t),{sine:s,cosine:l}=e.get(r);return i>=0&&s>=0?o<l?1:o>l?-1:0:i<0&&s<0?o<l?-1:o>l?1:0:s<i?-1:s>i?1:0}}}let C=0;class F{static compare(t,e){const n=t.leftSE.point.x,r=e.leftSE.point.x,i=t.rightSE.point.x,o=e.rightSE.point.x;if(o<n)return 1;if(i<r)return-1;const s=t.leftSE.point.y,l=e.leftSE.point.y,h=t.rightSE.point.y,u=e.rightSE.point.y;if(n<r){if(l<s&&l<h)return 1;if(l>s&&l>h)return-1;const n=t.comparePoint(e.leftSE.point);if(n<0)return 1;if(n>0)return-1;const r=e.comparePoint(t.rightSE.point);return 0!==r?r:-1}if(n>r){if(s<l&&s<u)return-1;if(s>l&&s>u)return 1;const n=e.comparePoint(t.leftSE.point);if(0!==n)return n;const r=t.comparePoint(e.rightSE.point);return r<0?1:r>0?-1:1}if(s<l)return-1;if(s>l)return 1;if(i<o){const n=e.comparePoint(t.rightSE.point);if(0!==n)return n}if(i>o){const n=t.comparePoint(e.rightSE.point);if(n<0)return 1;if(n>0)return-1}if(i!==o){const t=h-s,e=i-n,f=u-l,c=o-r;if(t>e&&f<c)return 1;if(t<e&&f>c)return-1}return i>o?1:i<o||h<u?-1:h>u?1:t.id<e.id?-1:t.id>e.id?1:0}constructor(t,e,n,r){this.id=++C,this.leftSE=t,t.segment=this,t.otherSE=e,this.rightSE=e,e.segment=this,e.otherSE=t,this.rings=n,this.windings=r}static fromRing(t,e,n){let r,i,o;const s=q.comparePoints(t,e);if(s<0)r=t,i=e,o=1;else{if(!(s>0))throw new Error(`Tried to create degenerate segment at [${t.x}, ${t.y}]`);r=e,i=t,o=-1}const l=new q(r,!0),h=new q(i,!1);return new F(l,h,[n],[o])}replaceRightSE(t){this.rightSE=t,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}bbox(){const t=this.leftSE.point.y,e=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:t<e?t:e},ur:{x:this.rightSE.point.x,y:t>e?t:e}}}vector(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}isAnEndpoint(t){return t.x===this.leftSE.point.x&&t.y===this.leftSE.point.y||t.x===this.rightSE.point.x&&t.y===this.rightSE.point.y}comparePoint(t){if(this.isAnEndpoint(t))return 0;const e=this.leftSE.point,n=this.rightSE.point,r=this.vector();if(e.x===n.x)return t.x===e.x?0:t.x<e.x?1:-1;const i=(t.y-e.y)/r.y,o=e.x+i*r.x;if(t.x===o)return 0;const s=(t.x-e.x)/r.x,l=e.y+s*r.y;return t.y===l?0:t.y<l?-1:1}getIntersection(t){const e=this.bbox(),n=t.bbox(),r=p(e,n);if(null===r)return null;const i=this.leftSE.point,o=this.rightSE.point,s=t.leftSE.point,l=t.rightSE.point,h=c(e,s)&&0===this.comparePoint(s),u=c(n,i)&&0===t.comparePoint(i),f=c(e,l)&&0===this.comparePoint(l),g=c(n,o)&&0===t.comparePoint(o);if(u&&h)return g&&!f?o:!g&&f?l:null;if(u)return f&&i.x===l.x&&i.y===l.y?null:i;if(h)return g&&o.x===s.x&&o.y===s.y?null:s;if(g&&f)return null;if(g)return o;if(f)return l;const a=((t,e,n,r)=>{if(0===e.x)return T(n,r,t.x);if(0===r.x)return T(t,e,n.x);if(0===e.y)return G(n,r,t.y);if(0===r.y)return G(t,e,n.y);const i=O(e,r);if(0==i)return null;const o={x:n.x-t.x,y:n.y-t.y},s=O(o,e)/i,l=O(o,r)/i;return{x:(t.x+l*e.x+(n.x+s*r.x))/2,y:(t.y+l*e.y+(n.y+s*r.y))/2}})(i,this.vector(),s,t.vector());return null===a?null:c(r,a)?b.round(a.x,a.y):null}split(t){const e=[],n=void 0!==t.events,r=new q(t,!0),i=new q(t,!1),o=this.rightSE;this.replaceRightSE(i),e.push(i),e.push(r);const s=new F(r,o,this.rings.slice(),this.windings.slice());return q.comparePoints(s.leftSE.point,s.rightSE.point)>0&&s.swapEvents(),q.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),n&&(r.checkForConsuming(),i.checkForConsuming()),e}swapEvents(){const t=this.rightSE;this.rightSE=this.leftSE,this.leftSE=t,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(let t=0,e=this.windings.length;t<e;t++)this.windings[t]*=-1}consume(t){let e=this,n=t;for(;e.consumedBy;)e=e.consumedBy;for(;n.consumedBy;)n=n.consumedBy;const r=F.compare(e,n);if(0!==r){if(r>0){const t=e;e=n,n=t}if(e.prev===n){const t=e;e=n,n=t}for(let t=0,r=n.rings.length;t<r;t++){const r=n.rings[t],i=n.windings[t],o=e.rings.indexOf(r);-1===o?(e.rings.push(r),e.windings.push(i)):e.windings[o]+=i}n.rings=null,n.windings=null,n.consumedBy=e,n.leftSE.consumedBy=e.leftSE,n.rightSE.consumedBy=e.rightSE}}prevInResult(){return void 0!==this._prevInResult||(this.prev?this.prev.isInResult()?this._prevInResult=this.prev:this._prevInResult=this.prev.prevInResult():this._prevInResult=null),this._prevInResult}beforeState(){if(void 0!==this._beforeState)return this._beforeState;if(this.prev){const t=this.prev.consumedBy||this.prev;this._beforeState=t.afterState()}else this._beforeState={rings:[],windings:[],multiPolys:[]};return this._beforeState}afterState(){if(void 0!==this._afterState)return this._afterState;const t=this.beforeState();this._afterState={rings:t.rings.slice(0),windings:t.windings.slice(0),multiPolys:[]};const e=this._afterState.rings,n=this._afterState.windings,r=this._afterState.multiPolys;for(let t=0,r=this.rings.length;t<r;t++){const r=this.rings[t],i=this.windings[t],o=e.indexOf(r);-1===o?(e.push(r),n.push(i)):n[o]+=i}const i=[],o=[];for(let t=0,r=e.length;t<r;t++){if(0===n[t])continue;const r=e[t],s=r.poly;if(-1===o.indexOf(s))if(r.isExterior)i.push(s);else{-1===o.indexOf(s)&&o.push(s);const t=i.indexOf(r.poly);-1!==t&&i.splice(t,1)}}for(let t=0,e=i.length;t<e;t++){const e=i[t].multiPoly;-1===r.indexOf(e)&&r.push(e)}return this._afterState}isInResult(){if(this.consumedBy)return!1;if(void 0!==this._isInResult)return this._isInResult;const t=this.beforeState().multiPolys,e=this.afterState().multiPolys;switch(H.type){case"union":{const n=0===t.length,r=0===e.length;this._isInResult=n!==r;break}case"intersection":{let n,r;t.length<e.length?(n=t.length,r=e.length):(n=e.length,r=t.length),this._isInResult=r===H.numMultiPolys&&n<r;break}case"xor":{const n=Math.abs(t.length-e.length);this._isInResult=n%2==1;break}case"difference":{const n=t=>1===t.length&&t[0].isSubject;this._isInResult=n(t)!==n(e);break}default:throw new Error(`Unrecognized operation type found ${H.type}`)}return this._isInResult}}class j{constructor(t,e,n){if(!Array.isArray(t)||0===t.length)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=e,this.isExterior=n,this.segments=[],"number"!=typeof t[0][0]||"number"!=typeof t[0][1])throw new Error("Input geometry is not a valid Polygon or MultiPolygon");const r=b.round(t[0][0],t[0][1]);this.bbox={ll:{x:r.x,y:r.y},ur:{x:r.x,y:r.y}};let i=r;for(let e=1,n=t.length;e<n;e++){if("number"!=typeof t[e][0]||"number"!=typeof t[e][1])throw new Error("Input geometry is not a valid Polygon or MultiPolygon");let n=b.round(t[e][0],t[e][1]);n.x===i.x&&n.y===i.y||(this.segments.push(F.fromRing(i,n,this)),n.x<this.bbox.ll.x&&(this.bbox.ll.x=n.x),n.y<this.bbox.ll.y&&(this.bbox.ll.y=n.y),n.x>this.bbox.ur.x&&(this.bbox.ur.x=n.x),n.y>this.bbox.ur.y&&(this.bbox.ur.y=n.y),i=n)}r.x===i.x&&r.y===i.y||this.segments.push(F.fromRing(i,r,this))}getSweepEvents(){const t=[];for(let e=0,n=this.segments.length;e<n;e++){const n=this.segments[e];t.push(n.leftSE),t.push(n.rightSE)}return t}}class U{constructor(t,e){if(!Array.isArray(t))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new j(t[0],this,!0),this.bbox={ll:{x:this.exteriorRing.bbox.ll.x,y:this.exteriorRing.bbox.ll.y},ur:{x:this.exteriorRing.bbox.ur.x,y:this.exteriorRing.bbox.ur.y}},this.interiorRings=[];for(let e=1,n=t.length;e<n;e++){const n=new j(t[e],this,!1);n.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=n.bbox.ll.x),n.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=n.bbox.ll.y),n.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=n.bbox.ur.x),n.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=n.bbox.ur.y),this.interiorRings.push(n)}this.multiPoly=e}getSweepEvents(){const t=this.exteriorRing.getSweepEvents();for(let e=0,n=this.interiorRings.length;e<n;e++){const n=this.interiorRings[e].getSweepEvents();for(let e=0,r=n.length;e<r;e++)t.push(n[e])}return t}}class Y{constructor(t,e){if(!Array.isArray(t))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{"number"==typeof t[0][0][0]&&(t=[t])}catch(t){}this.polys=[],this.bbox={ll:{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY},ur:{x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY}};for(let e=0,n=t.length;e<n;e++){const n=new U(t[e],this);n.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=n.bbox.ll.x),n.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=n.bbox.ll.y),n.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=n.bbox.ur.x),n.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=n.bbox.ur.y),this.polys.push(n)}this.isSubject=e}getSweepEvents(){const t=[];for(let e=0,n=this.polys.length;e<n;e++){const n=this.polys[e].getSweepEvents();for(let e=0,r=n.length;e<r;e++)t.push(n[e])}return t}}class V{static factory(t){const e=[];for(let n=0,r=t.length;n<r;n++){const r=t[n];if(!r.isInResult()||r.ringOut)continue;let i=null,o=r.leftSE,s=r.rightSE;const l=[o],h=o.point,u=[];for(;i=o,o=s,l.push(o),o.point!==h;)for(;;){const t=o.getAvailableLinkedEvents();if(0===t.length){const t=l[0].point,e=l[l.length-1].point;throw new Error(`Unable to complete output ring starting at [${t.x}, ${t.y}]. Last matching segment found ends at [${e.x}, ${e.y}].`)}if(1===t.length){s=t[0].otherSE;break}let n=null;for(let t=0,e=u.length;t<e;t++)if(u[t].point===o.point){n=t;break}if(null!==n){const t=u.splice(n)[0],r=l.splice(t.index);r.unshift(r[0].otherSE),e.push(new V(r.reverse()));continue}u.push({index:l.length,point:o.point});const r=o.getLeftmostComparator(i);s=t.sort(r)[0].otherSE;break}e.push(new V(l))}return e}constructor(t){this.events=t;for(let e=0,n=t.length;e<n;e++)t[e].segment.ringOut=this;this.poly=null}getGeom(){let t=this.events[0].point;const e=[t];for(let n=1,r=this.events.length-1;n<r;n++){const r=this.events[n].point,i=this.events[n+1].point;0!==$(r,t,i)&&(e.push(r),t=r)}if(1===e.length)return null;const n=e[0],r=e[1];0===$(n,t,r)&&e.shift(),e.push(e[0]);const i=this.isExteriorRing()?1:-1,o=this.isExteriorRing()?0:e.length-1,s=this.isExteriorRing()?e.length:-1,l=[];for(let t=o;t!=s;t+=i)l.push([e[t].x,e[t].y]);return l}isExteriorRing(){if(void 0===this._isExteriorRing){const t=this.enclosingRing();this._isExteriorRing=!t||!t.isExteriorRing()}return this._isExteriorRing}enclosingRing(){return void 0===this._enclosingRing&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}_calcEnclosingRing(){let t=this.events[0];for(let e=1,n=this.events.length;e<n;e++){const n=this.events[e];q.compare(t,n)>0&&(t=n)}let e=t.segment.prevInResult(),n=e?e.prevInResult():null;for(;;){if(!e)return null;if(!n)return e.ringOut;if(n.ringOut!==e.ringOut)return n.ringOut.enclosingRing()!==e.ringOut?e.ringOut:e.ringOut.enclosingRing();e=n.prevInResult(),n=e?e.prevInResult():null}}}class X{constructor(t){this.exteriorRing=t,t.poly=this,this.interiorRings=[]}addInterior(t){this.interiorRings.push(t),t.poly=this}getGeom(){const t=[this.exteriorRing.getGeom()];if(null===t[0])return null;for(let e=0,n=this.interiorRings.length;e<n;e++){const n=this.interiorRings[e].getGeom();null!==n&&t.push(n)}return t}}class Q{constructor(t){this.rings=t,this.polys=this._composePolys(t)}getGeom(){const t=[];for(let e=0,n=this.polys.length;e<n;e++){const n=this.polys[e].getGeom();null!==n&&t.push(n)}return t}_composePolys(t){const e=[];for(let n=0,r=t.length;n<r;n++){const r=t[n];if(!r.poly)if(r.isExteriorRing())e.push(new X(r));else{const t=r.enclosingRing();t.poly||e.push(new X(t)),t.poly.addInterior(r)}}return e}}class W{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:F.compare;this.queue=t,this.tree=new l(e),this.segments=[]}process(t){const e=t.segment,n=[];if(t.consumedBy)return t.isLeft?this.queue.remove(t.otherSE):this.tree.remove(e),n;const r=t.isLeft?this.tree.add(e):this.tree.find(e);if(!r)throw new Error(`Unable to find segment #${e.id} [${e.leftSE.point.x}, ${e.leftSE.point.y}] -> [${e.rightSE.point.x}, ${e.rightSE.point.y}] in SweepLine tree.`);let i,o,s=r,l=r;for(;void 0===i;)s=this.tree.prev(s),null===s?i=null:void 0===s.key.consumedBy&&(i=s.key);for(;void 0===o;)l=this.tree.next(l),null===l?o=null:void 0===l.key.consumedBy&&(o=l.key);if(t.isLeft){let r=null;if(i){const t=i.getIntersection(e);if(null!==t&&(e.isAnEndpoint(t)||(r=t),!i.isAnEndpoint(t))){const e=this._splitSafely(i,t);for(let t=0,r=e.length;t<r;t++)n.push(e[t])}}let s=null;if(o){const t=o.getIntersection(e);if(null!==t&&(e.isAnEndpoint(t)||(s=t),!o.isAnEndpoint(t))){const e=this._splitSafely(o,t);for(let t=0,r=e.length;t<r;t++)n.push(e[t])}}if(null!==r||null!==s){let t=null;if(null===r)t=s;else if(null===s)t=r;else{t=q.comparePoints(r,s)<=0?r:s}this.queue.remove(e.rightSE),n.push(e.rightSE);const i=e.split(t);for(let t=0,e=i.length;t<e;t++)n.push(i[t])}n.length>0?(this.tree.remove(e),n.push(t)):(this.segments.push(e),e.prev=i)}else{if(i&&o){const t=i.getIntersection(o);if(null!==t){if(!i.isAnEndpoint(t)){const e=this._splitSafely(i,t);for(let t=0,r=e.length;t<r;t++)n.push(e[t])}if(!o.isAnEndpoint(t)){const e=this._splitSafely(o,t);for(let t=0,r=e.length;t<r;t++)n.push(e[t])}}}this.tree.remove(e)}return n}_splitSafely(t,e){this.tree.remove(t);const n=t.rightSE;this.queue.remove(n);const r=t.split(e);return r.push(n),void 0===t.consumedBy&&this.tree.add(t),r}}const Z="undefined"!=typeof process&&process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,D="undefined"!=typeof process&&process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6;const H=new class{run(t,e,n){H.type=t,b.reset();const r=[new Y(e,!0)];for(let t=0,e=n.length;t<e;t++)r.push(new Y(n[t],!1));if(H.numMultiPolys=r.length,"difference"===H.type){const t=r[0];let e=1;for(;e<r.length;)null!==p(r[e].bbox,t.bbox)?e++:r.splice(e,1)}if("intersection"===H.type)for(let t=0,e=r.length;t<e;t++){const e=r[t];for(let n=t+1,i=r.length;n<i;n++)if(null===p(e.bbox,r[n].bbox))return[]}const i=new l(q.compare);for(let t=0,e=r.length;t<e;t++){const e=r[t].getSweepEvents();for(let t=0,n=e.length;t<n;t++)if(i.insert(e[t]),i.size>Z)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big).")}const o=new W(i);let s=i.size,h=i.pop();for(;h;){const t=h.key;if(i.size===s){const e=t.segment;throw new Error(`Unable to pop() ${t.isLeft?"left":"right"} SweepEvent [${t.point.x}, ${t.point.y}] from segment #${e.id} [${e.leftSE.point.x}, ${e.leftSE.point.y}] -> [${e.rightSE.point.x}, ${e.rightSE.point.y}] from queue.`)}if(i.size>Z)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big).");if(o.segments.length>D)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments).");const e=o.process(t);for(let t=0,n=e.length;t<n;t++){const n=e[t];void 0===n.consumedBy&&i.insert(n)}s=i.size,h=i.pop()}b.reset();const u=V.factory(o.segments);return new Q(u).getGeom()}};var J={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 H.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 H.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 H.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 H.run("difference",t,n)}};return J}));
10
24
  //# sourceMappingURL=polygon-clipping.umd.min.js.map