@maptiler/geocoding-control 1.3.2 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (204) hide show
  1. package/README.md +3 -4
  2. package/icons/airport.svg +6 -0
  3. package/icons/animal_shelter.svg +4 -0
  4. package/icons/art_gallery.svg +4 -0
  5. package/icons/atm.svg +5 -1
  6. package/icons/barrier.svg +4 -0
  7. package/icons/baseball.svg +4 -0
  8. package/icons/basketball.svg +4 -0
  9. package/icons/bbq.svg +4 -1
  10. package/icons/beach.svg +4 -0
  11. package/icons/beer.svg +4 -1
  12. package/icons/bench.svg +4 -1
  13. package/icons/bicycle.svg +4 -1
  14. package/icons/bicycle_parking.svg +5 -1
  15. package/icons/bicycle_rental.svg +5 -1
  16. package/icons/billiards.svg +4 -0
  17. package/icons/board.svg +4 -1
  18. package/icons/bollard.svg +4 -0
  19. package/icons/bowling.svg +4 -1
  20. package/icons/building.svg +4 -0
  21. package/icons/bulldozer.svg +4 -0
  22. package/icons/bus_guided.svg +4 -0
  23. package/icons/bus_trolley.svg +4 -0
  24. package/icons/butcher.svg +4 -1
  25. package/icons/camper_trailer.svg +4 -0
  26. package/icons/campfire.svg +4 -0
  27. package/icons/caution.svg +4 -0
  28. package/icons/cemetery.svg +3 -11
  29. package/icons/charging_station.svg +4 -1
  30. package/icons/christian.svg +5 -0
  31. package/icons/circle-dot.svg +4 -0
  32. package/icons/circle-stroke.svg +4 -0
  33. package/icons/circle.svg +4 -0
  34. package/icons/city.svg +4 -0
  35. package/icons/communications_tower.svg +4 -1
  36. package/icons/confectionery.svg +4 -1
  37. package/icons/construction.svg +4 -0
  38. package/icons/cricket.svg +4 -0
  39. package/icons/cross.svg +4 -1
  40. package/icons/cycle_barrier.svg +4 -0
  41. package/icons/dam.svg +4 -0
  42. package/icons/danger.svg +4 -0
  43. package/icons/diamond.svg +4 -0
  44. package/icons/diamond_stroked.svg +4 -0
  45. package/icons/dot.svg +4 -0
  46. package/icons/drinking_water.svg +4 -1
  47. package/icons/emergency_phone.svg +4 -1
  48. package/icons/entrance.svg +4 -0
  49. package/icons/farm.svg +3 -8
  50. package/icons/fence.svg +4 -0
  51. package/icons/florist.svg +4 -1
  52. package/icons/furniture.svg +4 -1
  53. package/icons/gaming.svg +4 -0
  54. package/icons/garden.svg +4 -0
  55. package/icons/garden_centre.svg +4 -1
  56. package/icons/gate.svg +4 -1
  57. package/icons/globe.svg +4 -0
  58. package/icons/golf_green.svg +4 -0
  59. package/icons/gondola.svg +4 -0
  60. package/icons/guidepost.svg +4 -1
  61. package/icons/hardware.svg +3 -3
  62. package/icons/heart.svg +4 -0
  63. package/icons/heliport.svg +4 -0
  64. package/icons/highway_rest_area.svg +4 -0
  65. package/icons/home.svg +4 -0
  66. package/icons/hot_spring.svg +4 -1
  67. package/icons/hut.svg +4 -0
  68. package/icons/industry.svg +4 -0
  69. package/icons/karaoke.svg +4 -0
  70. package/icons/lift_gate.svg +4 -0
  71. package/icons/light_rail.svg +4 -0
  72. package/icons/lighthouse.svg +4 -1
  73. package/icons/marker.svg +4 -0
  74. package/icons/marker_stroked.svg +4 -0
  75. package/icons/monorail.svg +4 -0
  76. package/icons/motorcycle.svg +4 -1
  77. package/icons/motorcycle_parking.svg +4 -1
  78. package/icons/motorcycle_rental.svg +4 -0
  79. package/icons/motorcycle_repair.svg +4 -0
  80. package/icons/natural.svg +4 -0
  81. package/icons/noodle.svg +4 -0
  82. package/icons/obelisk.svg +4 -1
  83. package/icons/observation_tower.svg +4 -1
  84. package/icons/oneway.svg +4 -0
  85. package/icons/optician.svg +4 -1
  86. package/icons/park.svg +4 -1
  87. package/icons/parking_paid.svg +4 -0
  88. package/icons/pin.svg +4 -0
  89. package/icons/pipe.svg +4 -0
  90. package/icons/pizza.svg +4 -0
  91. package/icons/place_of_worship.svg +4 -1
  92. package/icons/playground.svg +3 -3
  93. package/icons/racetrack.svg +4 -0
  94. package/icons/radiation.svg +4 -0
  95. package/icons/railway.svg +4 -0
  96. package/icons/ranger_station.svg +4 -0
  97. package/icons/recycling.svg +4 -1
  98. package/icons/road_accident.svg +4 -0
  99. package/icons/roadblock.svg +4 -0
  100. package/icons/rocket.svg +4 -0
  101. package/icons/school_bus.svg +4 -0
  102. package/icons/sculpture.svg +4 -0
  103. package/icons/seafood.svg +4 -1
  104. package/icons/shelter.svg +4 -1
  105. package/icons/shoes.svg +4 -1
  106. package/icons/sikh.svg +4 -0
  107. package/icons/snow.svg +4 -0
  108. package/icons/soccer.svg +4 -1
  109. package/icons/spring.svg +4 -1
  110. package/icons/square.svg +4 -0
  111. package/icons/square_stroked.svg +4 -0
  112. package/icons/star.svg +4 -0
  113. package/icons/star_stroked.svg +4 -0
  114. package/icons/statue.svg +4 -1
  115. package/icons/subway.svg +4 -0
  116. package/icons/sushi.svg +4 -0
  117. package/icons/swimming.svg +5 -0
  118. package/icons/swimming_pool.svg +8 -0
  119. package/icons/tako.svg +4 -0
  120. package/icons/taxi.svg +4 -1
  121. package/icons/teahouse.svg +4 -0
  122. package/icons/terminal.svg +4 -1
  123. package/icons/theme_park.svg +4 -0
  124. package/icons/town.svg +4 -0
  125. package/icons/town_hall.svg +4 -1
  126. package/icons/townhall.svg +4 -1
  127. package/icons/tram_stop.svg +4 -0
  128. package/icons/transit.svg +4 -0
  129. package/icons/triangle.svg +4 -0
  130. package/icons/triangle_stroked.svg +4 -0
  131. package/icons/truck.svg +4 -0
  132. package/icons/tunnel.svg +4 -0
  133. package/icons/veterinary.svg +4 -1
  134. package/icons/viewpoint.svg +4 -1
  135. package/icons/village.svg +4 -0
  136. package/icons/volleyball.svg +4 -0
  137. package/icons/warehouse.svg +4 -0
  138. package/icons/water.svg +3 -5
  139. package/icons/water_park.svg +6 -1
  140. package/icons/water_tower.svg +4 -1
  141. package/icons/watermill.svg +4 -0
  142. package/icons/wetland.svg +4 -0
  143. package/icons/wine.svg +4 -0
  144. package/leaflet-controller.d.ts +2 -2
  145. package/leaflet-controller.js +1828 -12736
  146. package/leaflet-controller.js.map +1 -1
  147. package/leaflet-controller.umd.js +13 -22
  148. package/leaflet-controller.umd.js.map +1 -1
  149. package/leaflet.js +3052 -13916
  150. package/leaflet.js.map +1 -1
  151. package/leaflet.umd.js +3 -12
  152. package/leaflet.umd.js.map +1 -1
  153. package/maplibregl-controller.d.ts +2 -2
  154. package/maplibregl-controller.js +1767 -12761
  155. package/maplibregl-controller.js.map +1 -1
  156. package/maplibregl-controller.umd.js +13 -22
  157. package/maplibregl-controller.umd.js.map +1 -1
  158. package/maplibregl.js +2950 -13900
  159. package/maplibregl.js.map +1 -1
  160. package/maplibregl.umd.js +3 -12
  161. package/maplibregl.umd.js.map +1 -1
  162. package/maptilersdk.js +2958 -13908
  163. package/maptilersdk.js.map +1 -1
  164. package/maptilersdk.umd.js +3 -12
  165. package/maptilersdk.umd.js.map +1 -1
  166. package/mask.d.ts +1 -1
  167. package/openlayers-controller.js +1177 -12154
  168. package/openlayers-controller.js.map +1 -1
  169. package/openlayers-controller.umd.js +13 -22
  170. package/openlayers-controller.umd.js.map +1 -1
  171. package/openlayers.js +2667 -13607
  172. package/openlayers.js.map +1 -1
  173. package/openlayers.umd.js +3 -12
  174. package/openlayers.umd.js.map +1 -1
  175. package/package.json +31 -29
  176. package/react.js +996 -955
  177. package/react.js.map +1 -1
  178. package/react.umd.js +1 -1
  179. package/react.umd.js.map +1 -1
  180. package/style.css +1 -1
  181. package/svelte/FeatureItem.svelte +7 -5
  182. package/svelte/GeocodingControl.svelte +72 -14
  183. package/svelte/GeocodingControl.svelte.d.ts +4 -2
  184. package/svelte/geoUtils.js +7 -1
  185. package/svelte/leaflet-controller.d.ts +2 -2
  186. package/svelte/leaflet-controller.js +48 -2
  187. package/svelte/maplibregl-controller.d.ts +2 -2
  188. package/svelte/maplibregl-controller.js +5 -2
  189. package/svelte/mask.d.ts +1 -1
  190. package/svelte/mask.js +32 -29
  191. package/svelte/openlayers-controller.js +13 -14
  192. package/svelte/types.d.ts +15 -9
  193. package/types.d.ts +15 -9
  194. package/vanilla.js +1016 -975
  195. package/vanilla.js.map +1 -1
  196. package/vanilla.umd.js +1 -1
  197. package/vanilla.umd.js.map +1 -1
  198. package/icons/beach_resort.svg +0 -1
  199. package/icons/drinking-water.svg +0 -1
  200. package/icons/emergency-phone.svg +0 -1
  201. package/icons/rental_bicycle.svg +0 -1
  202. package/icons/rental_car.svg +0 -1
  203. /package/icons/{camp_site.svg → campsite.svg} +0 -0
  204. /package/icons/{toll_booth.svg → toll.svg} +0 -0
@@ -1,7 +1,4 @@
1
- (function(qe,be){typeof exports=="object"&&typeof module<"u"?be(exports):typeof define=="function"&&define.amd?define(["exports"],be):(qe=typeof globalThis<"u"?globalThis:qe||self,be(qe.maplibreglMaptilerGeocodingController={}))})(this,function(qe){"use strict";var Cd=Object.defineProperty;var Pd=(qe,be,Dt)=>be in qe?Cd(qe,be,{enumerable:!0,configurable:!0,writable:!0,value:Dt}):qe[be]=Dt;var na=(qe,be,Dt)=>Pd(qe,typeof be!="symbol"?be+"":be,Dt);var be=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Dt(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}function Lc(o){if(o.__esModule)return o;var r=o.default;if(typeof r=="function"){var a=function l(){return this instanceof l?Reflect.construct(r,arguments,this.constructor):r.apply(this,arguments)};a.prototype=r.prototype}else a={};return Object.defineProperty(a,"__esModule",{value:!0}),Object.keys(o).forEach(function(l){var c=Object.getOwnPropertyDescriptor(o,l);Object.defineProperty(a,l,c.get?c:{enumerable:!0,get:function(){return o[l]}})}),a}var ra=Object.prototype.toString,ia=function(r){var a=ra.call(r),l=a==="[object Arguments]";return l||(l=a!=="[object Array]"&&r!==null&&typeof r=="object"&&typeof r.length=="number"&&r.length>=0&&ra.call(r.callee)==="[object Function]"),l},ui,sa;function Rc(){if(sa)return ui;sa=1;var o;if(!Object.keys){var r=Object.prototype.hasOwnProperty,a=Object.prototype.toString,l=ia,c=Object.prototype.propertyIsEnumerable,h=!c.call({toString:null},"toString"),v=c.call(function(){},"prototype"),p=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],_=function(E){var k=E.constructor;return k&&k.prototype===E},x={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},I=function(){if(typeof window>"u")return!1;for(var E in window)try{if(!x["$"+E]&&r.call(window,E)&&window[E]!==null&&typeof window[E]=="object")try{_(window[E])}catch{return!0}}catch{return!0}return!1}(),m=function(E){if(typeof window>"u"||!I)return _(E);try{return _(E)}catch{return!1}};o=function(k){var w=k!==null&&typeof k=="object",C=a.call(k)==="[object Function]",T=l(k),R=w&&a.call(k)==="[object String]",P=[];if(!w&&!C&&!T)throw new TypeError("Object.keys called on a non-object");var A=v&&C;if(R&&k.length>0&&!r.call(k,0))for(var D=0;D<k.length;++D)P.push(String(D));if(T&&k.length>0)for(var M=0;M<k.length;++M)P.push(String(M));else for(var G in k)!(A&&G==="prototype")&&r.call(k,G)&&P.push(String(G));if(h)for(var Y=m(k),U=0;U<p.length;++U)!(Y&&p[U]==="constructor")&&r.call(k,p[U])&&P.push(p[U]);return P}}return ui=o,ui}var Cc=Array.prototype.slice,Pc=ia,aa=Object.keys,nr=aa?function(r){return aa(r)}:Rc(),oa=Object.keys;nr.shim=function(){if(Object.keys){var r=function(){var a=Object.keys(arguments);return a&&a.length===arguments.length}(1,2);r||(Object.keys=function(l){return Pc(l)?oa(Cc.call(l)):oa(l)})}else Object.keys=nr;return Object.keys||nr};var li=nr,Ac=Error,Mc=EvalError,Dc=RangeError,Fc=ReferenceError,ua=SyntaxError,It=TypeError,$c=URIError,rr=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var r={},a=Symbol("test"),l=Object(a);if(typeof a=="string"||Object.prototype.toString.call(a)!=="[object Symbol]"||Object.prototype.toString.call(l)!=="[object Symbol]")return!1;var c=42;r[a]=c;for(a in r)return!1;if(typeof Object.keys=="function"&&Object.keys(r).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(r).length!==0)return!1;var h=Object.getOwnPropertySymbols(r);if(h.length!==1||h[0]!==a||!Object.prototype.propertyIsEnumerable.call(r,a))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var v=Object.getOwnPropertyDescriptor(r,a);if(v.value!==c||v.enumerable!==!0)return!1}return!0},la=typeof Symbol<"u"&&Symbol,Bc=rr,ci=function(){return typeof la!="function"||typeof Symbol!="function"||typeof la("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:Bc()},fi={__proto__:null,foo:{}},Gc=Object,qc=function(){return{__proto__:fi}.foo===fi.foo&&!(fi instanceof Gc)},zc="Function.prototype.bind called on incompatible ",Yc=Object.prototype.toString,Uc=Math.max,Xc="[object Function]",ca=function(r,a){for(var l=[],c=0;c<r.length;c+=1)l[c]=r[c];for(var h=0;h<a.length;h+=1)l[h+r.length]=a[h];return l},jc=function(r,a){for(var l=[],c=a,h=0;c<r.length;c+=1,h+=1)l[h]=r[c];return l},Vc=function(o,r){for(var a="",l=0;l<o.length;l+=1)a+=o[l],l+1<o.length&&(a+=r);return a},Wc=function(r){var a=this;if(typeof a!="function"||Yc.apply(a)!==Xc)throw new TypeError(zc+a);for(var l=jc(arguments,1),c,h=function(){if(this instanceof c){var I=a.apply(this,ca(l,arguments));return Object(I)===I?I:this}return a.apply(r,ca(l,arguments))},v=Uc(0,a.length-l.length),p=[],_=0;_<v;_++)p[_]="$"+_;if(c=Function("binder","return function ("+Vc(p,",")+"){ return binder.apply(this,arguments); }")(h),a.prototype){var x=function(){};x.prototype=a.prototype,c.prototype=new x,x.prototype=null}return c},Hc=Wc,hi=Function.prototype.bind||Hc,Zc=Function.prototype.call,Jc=Object.prototype.hasOwnProperty,Qc=hi,fa=Qc.call(Zc,Jc),oe,Kc=Ac,ef=Mc,tf=Dc,nf=Fc,Jt=ua,Qt=It,rf=$c,ha=Function,gi=function(o){try{return ha('"use strict"; return ('+o+").constructor;")()}catch{}},Ft=Object.getOwnPropertyDescriptor;if(Ft)try{Ft({},"")}catch{Ft=null}var yi=function(){throw new Qt},sf=Ft?function(){try{return arguments.callee,yi}catch{try{return Ft(arguments,"callee").get}catch{return yi}}}():yi,Kt=ci(),af=qc(),ke=Object.getPrototypeOf||(af?function(o){return o.__proto__}:null),en={},of=typeof Uint8Array>"u"||!ke?oe:ke(Uint8Array),$t={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?oe:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?oe:ArrayBuffer,"%ArrayIteratorPrototype%":Kt&&ke?ke([][Symbol.iterator]()):oe,"%AsyncFromSyncIteratorPrototype%":oe,"%AsyncFunction%":en,"%AsyncGenerator%":en,"%AsyncGeneratorFunction%":en,"%AsyncIteratorPrototype%":en,"%Atomics%":typeof Atomics>"u"?oe:Atomics,"%BigInt%":typeof BigInt>"u"?oe:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?oe:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?oe:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?oe:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Kc,"%eval%":eval,"%EvalError%":ef,"%Float32Array%":typeof Float32Array>"u"?oe:Float32Array,"%Float64Array%":typeof Float64Array>"u"?oe:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?oe:FinalizationRegistry,"%Function%":ha,"%GeneratorFunction%":en,"%Int8Array%":typeof Int8Array>"u"?oe:Int8Array,"%Int16Array%":typeof Int16Array>"u"?oe:Int16Array,"%Int32Array%":typeof Int32Array>"u"?oe:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Kt&&ke?ke(ke([][Symbol.iterator]())):oe,"%JSON%":typeof JSON=="object"?JSON:oe,"%Map%":typeof Map>"u"?oe:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Kt||!ke?oe:ke(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?oe:Promise,"%Proxy%":typeof Proxy>"u"?oe:Proxy,"%RangeError%":tf,"%ReferenceError%":nf,"%Reflect%":typeof Reflect>"u"?oe:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?oe:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Kt||!ke?oe:ke(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?oe:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Kt&&ke?ke(""[Symbol.iterator]()):oe,"%Symbol%":Kt?Symbol:oe,"%SyntaxError%":Jt,"%ThrowTypeError%":sf,"%TypedArray%":of,"%TypeError%":Qt,"%Uint8Array%":typeof Uint8Array>"u"?oe:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?oe:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?oe:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?oe:Uint32Array,"%URIError%":rf,"%WeakMap%":typeof WeakMap>"u"?oe:WeakMap,"%WeakRef%":typeof WeakRef>"u"?oe:WeakRef,"%WeakSet%":typeof WeakSet>"u"?oe:WeakSet};if(ke)try{null.error}catch(o){var uf=ke(ke(o));$t["%Error.prototype%"]=uf}var lf=function o(r){var a;if(r==="%AsyncFunction%")a=gi("async function () {}");else if(r==="%GeneratorFunction%")a=gi("function* () {}");else if(r==="%AsyncGeneratorFunction%")a=gi("async function* () {}");else if(r==="%AsyncGenerator%"){var l=o("%AsyncGeneratorFunction%");l&&(a=l.prototype)}else if(r==="%AsyncIteratorPrototype%"){var c=o("%AsyncGenerator%");c&&ke&&(a=ke(c.prototype))}return $t[r]=a,a},ga={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},bn=hi,ir=fa,cf=bn.call(Function.call,Array.prototype.concat),ff=bn.call(Function.apply,Array.prototype.splice),ya=bn.call(Function.call,String.prototype.replace),sr=bn.call(Function.call,String.prototype.slice),hf=bn.call(Function.call,RegExp.prototype.exec),gf=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,yf=/\\(\\)?/g,vf=function(r){var a=sr(r,0,1),l=sr(r,-1);if(a==="%"&&l!=="%")throw new Jt("invalid intrinsic syntax, expected closing `%`");if(l==="%"&&a!=="%")throw new Jt("invalid intrinsic syntax, expected opening `%`");var c=[];return ya(r,gf,function(h,v,p,_){c[c.length]=p?ya(_,yf,"$1"):v||h}),c},pf=function(r,a){var l=r,c;if(ir(ga,l)&&(c=ga[l],l="%"+c[0]+"%"),ir($t,l)){var h=$t[l];if(h===en&&(h=lf(l)),typeof h>"u"&&!a)throw new Qt("intrinsic "+r+" exists, but is not available. Please file an issue!");return{alias:c,name:l,value:h}}throw new Jt("intrinsic "+r+" does not exist!")},it=function(r,a){if(typeof r!="string"||r.length===0)throw new Qt("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof a!="boolean")throw new Qt('"allowMissing" argument must be a boolean');if(hf(/^%?[^%]*%?$/,r)===null)throw new Jt("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var l=vf(r),c=l.length>0?l[0]:"",h=pf("%"+c+"%",a),v=h.name,p=h.value,_=!1,x=h.alias;x&&(c=x[0],ff(l,cf([0,1],x)));for(var I=1,m=!0;I<l.length;I+=1){var E=l[I],k=sr(E,0,1),w=sr(E,-1);if((k==='"'||k==="'"||k==="`"||w==='"'||w==="'"||w==="`")&&k!==w)throw new Jt("property names with quotes must have matching quotes");if((E==="constructor"||!m)&&(_=!0),c+="."+E,v="%"+c+"%",ir($t,v))p=$t[v];else if(p!=null){if(!(E in p)){if(!a)throw new Qt("base intrinsic for "+r+" exists, but the property is not available.");return}if(Ft&&I+1>=l.length){var C=Ft(p,E);m=!!C,m&&"get"in C&&!("originalValue"in C.get)?p=C.get:p=p[E]}else m=ir(p,E),p=p[E];m&&!_&&($t[v]=p)}}return p},vi,va;function pi(){if(va)return vi;va=1;var o=it,r=o("%Object.defineProperty%",!0)||!1;if(r)try{r({},"a",{value:1})}catch{r=!1}return vi=r,vi}var mf=it,ar=mf("%Object.getOwnPropertyDescriptor%",!0);if(ar)try{ar([],"length")}catch{ar=null}var mi=ar,pa=pi(),df=ua,tn=It,ma=mi,di=function(r,a,l){if(!r||typeof r!="object"&&typeof r!="function")throw new tn("`obj` must be an object or a function`");if(typeof a!="string"&&typeof a!="symbol")throw new tn("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new tn("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new tn("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new tn("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new tn("`loose`, if provided, must be a boolean");var c=arguments.length>3?arguments[3]:null,h=arguments.length>4?arguments[4]:null,v=arguments.length>5?arguments[5]:null,p=arguments.length>6?arguments[6]:!1,_=!!ma&&ma(r,a);if(pa)pa(r,a,{configurable:v===null&&_?_.configurable:!v,enumerable:c===null&&_?_.enumerable:!c,value:l,writable:h===null&&_?_.writable:!h});else if(p||!c&&!h&&!v)r[a]=l;else throw new df("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},_i=pi(),da=function(){return!!_i};da.hasArrayLengthDefineBug=function(){if(!_i)return null;try{return _i([],"length",{value:1}).length!==1}catch{return!0}};var xi=da,_f=li,xf=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",Ef=Object.prototype.toString,kf=Array.prototype.concat,_a=di,If=function(o){return typeof o=="function"&&Ef.call(o)==="[object Function]"},xa=xi(),Sf=function(o,r,a,l){if(r in o){if(l===!0){if(o[r]===a)return}else if(!If(l)||!l())return}xa?_a(o,r,a,!0):_a(o,r,a)},Ea=function(o,r){var a=arguments.length>2?arguments[2]:{},l=_f(r);xf&&(l=kf.call(l,Object.getOwnPropertySymbols(r)));for(var c=0;c<l.length;c+=1)Sf(o,l[c],r[l[c]],a[l[c]])};Ea.supportsDescriptors=!!xa;var Bt=Ea,ka={exports:{}},Nf=it,Ia=di,wf=xi(),Sa=mi,Na=It,bf=Nf("%Math.floor%"),Of=function(r,a){if(typeof r!="function")throw new Na("`fn` is not a function");if(typeof a!="number"||a<0||a>4294967295||bf(a)!==a)throw new Na("`length` must be a positive 32-bit integer");var l=arguments.length>2&&!!arguments[2],c=!0,h=!0;if("length"in r&&Sa){var v=Sa(r,"length");v&&!v.configurable&&(c=!1),v&&!v.writable&&(h=!1)}return(c||h||!l)&&(wf?Ia(r,"length",a,!0,!0):Ia(r,"length",a)),r};(function(o){var r=hi,a=it,l=Of,c=It,h=a("%Function.prototype.apply%"),v=a("%Function.prototype.call%"),p=a("%Reflect.apply%",!0)||r.call(v,h),_=pi(),x=a("%Math.max%");o.exports=function(E){if(typeof E!="function")throw new c("a function is required");var k=p(r,v,arguments);return l(k,1+x(0,E.length-(arguments.length-1)),!0)};var I=function(){return p(r,h,arguments)};_?_(o.exports,"apply",{value:I}):o.exports.apply=I})(ka);var nn=ka.exports,wa=it,ba=nn,Tf=ba(wa("String.prototype.indexOf")),ze=function(r,a){var l=wa(r,!!a);return typeof l=="function"&&Tf(r,".prototype.")>-1?ba(l):l},Lf=li,Oa=rr(),Ta=ze,La=Object,Rf=Ta("Array.prototype.push"),Ra=Ta("Object.prototype.propertyIsEnumerable"),Cf=Oa?Object.getOwnPropertySymbols:null,Ca=function(r,a){if(r==null)throw new TypeError("target must be an object");var l=La(r);if(arguments.length===1)return l;for(var c=1;c<arguments.length;++c){var h=La(arguments[c]),v=Lf(h),p=Oa&&(Object.getOwnPropertySymbols||Cf);if(p)for(var _=p(h),x=0;x<_.length;++x){var I=_[x];Ra(h,I)&&Rf(v,I)}for(var m=0;m<v.length;++m){var E=v[m];if(Ra(h,E)){var k=h[E];l[E]=k}}}return l},Ei=Ca,Pf=function(){if(!Object.assign)return!1;for(var o="abcdefghijklmnopqrst",r=o.split(""),a={},l=0;l<r.length;++l)a[r[l]]=r[l];var c=Object.assign({},a),h="";for(var v in c)h+=v;return o!==h},Af=function(){if(!Object.assign||!Object.preventExtensions)return!1;var o=Object.preventExtensions({1:2});try{Object.assign(o,"xy")}catch{return o[1]==="y"}return!1},Pa=function(){return!Object.assign||Pf()||Af()?Ei:Object.assign},Mf=Bt,Df=Pa,Ff=function(){var r=Df();return Mf(Object,{assign:r},{assign:function(){return Object.assign!==r}}),r},$f=Bt,Bf=nn,Gf=Ca,Aa=Pa,qf=Ff,zf=Bf.apply(Aa()),Ma=function(r,a){return zf(Object,arguments)};$f(Ma,{getPolyfill:Aa,implementation:Gf,shim:qf});var Yf=Ma,On=function(){return typeof(function(){}).name=="string"},Tn=Object.getOwnPropertyDescriptor;if(Tn)try{Tn([],"length")}catch{Tn=null}On.functionsHaveConfigurableNames=function(){if(!On()||!Tn)return!1;var r=Tn(function(){},"name");return!!r&&!!r.configurable};var Uf=Function.prototype.bind;On.boundFunctionsHaveNames=function(){return On()&&typeof Uf=="function"&&(function(){}).bind().name!==""};var Xf=On,Da=di,jf=xi(),Vf=Xf.functionsHaveConfigurableNames(),Wf=It,Hf=function(r,a){if(typeof r!="function")throw new Wf("`fn` is not a function");var l=arguments.length>2&&!!arguments[2];return(!l||Vf)&&(jf?Da(r,"name",a,!0,!0):Da(r,"name",a)),r},Zf=Hf,Jf=It,Qf=Object,Fa=Zf(function(){if(this==null||this!==Qf(this))throw new Jf("RegExp.prototype.flags getter called on non-object");var r="";return this.hasIndices&&(r+="d"),this.global&&(r+="g"),this.ignoreCase&&(r+="i"),this.multiline&&(r+="m"),this.dotAll&&(r+="s"),this.unicode&&(r+="u"),this.unicodeSets&&(r+="v"),this.sticky&&(r+="y"),r},"get flags",!0),Kf=Fa,eh=Bt.supportsDescriptors,th=Object.getOwnPropertyDescriptor,$a=function(){if(eh&&/a/mig.flags==="gim"){var r=th(RegExp.prototype,"flags");if(r&&typeof r.get=="function"&&typeof RegExp.prototype.dotAll=="boolean"&&typeof RegExp.prototype.hasIndices=="boolean"){var a="",l={};if(Object.defineProperty(l,"hasIndices",{get:function(){a+="d"}}),Object.defineProperty(l,"sticky",{get:function(){a+="y"}}),a==="dy")return r.get}}return Kf},nh=Bt.supportsDescriptors,rh=$a,ih=Object.getOwnPropertyDescriptor,sh=Object.defineProperty,ah=TypeError,Ba=Object.getPrototypeOf,oh=/a/,uh=function(){if(!nh||!Ba)throw new ah("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var r=rh(),a=Ba(oh),l=ih(a,"flags");return(!l||l.get!==r)&&sh(a,"flags",{configurable:!0,enumerable:!1,get:r}),r},lh=Bt,ch=nn,fh=Fa,Ga=$a,hh=uh,qa=ch(Ga());lh(qa,{getPolyfill:Ga,implementation:fh,shim:hh});var gh=qa,or={exports:{}},yh=rr,Gt=function(){return yh()&&!!Symbol.toStringTag},vh=Gt(),ph=ze,ki=ph("Object.prototype.toString"),ur=function(r){return vh&&r&&typeof r=="object"&&Symbol.toStringTag in r?!1:ki(r)==="[object Arguments]"},za=function(r){return ur(r)?!0:r!==null&&typeof r=="object"&&typeof r.length=="number"&&r.length>=0&&ki(r)!=="[object Array]"&&ki(r.callee)==="[object Function]"},mh=function(){return ur(arguments)}();ur.isLegacyArguments=za;var Ya=mh?ur:za;const dh=Lc(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:"Module"})));var Ii=typeof Map=="function"&&Map.prototype,Si=Object.getOwnPropertyDescriptor&&Ii?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,lr=Ii&&Si&&typeof Si.get=="function"?Si.get:null,Ua=Ii&&Map.prototype.forEach,Ni=typeof Set=="function"&&Set.prototype,wi=Object.getOwnPropertyDescriptor&&Ni?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,cr=Ni&&wi&&typeof wi.get=="function"?wi.get:null,Xa=Ni&&Set.prototype.forEach,_h=typeof WeakMap=="function"&&WeakMap.prototype,Ln=_h?WeakMap.prototype.has:null,xh=typeof WeakSet=="function"&&WeakSet.prototype,Rn=xh?WeakSet.prototype.has:null,Eh=typeof WeakRef=="function"&&WeakRef.prototype,ja=Eh?WeakRef.prototype.deref:null,kh=Boolean.prototype.valueOf,Ih=Object.prototype.toString,Sh=Function.prototype.toString,Nh=String.prototype.match,bi=String.prototype.slice,St=String.prototype.replace,wh=String.prototype.toUpperCase,Va=String.prototype.toLowerCase,Wa=RegExp.prototype.test,Ha=Array.prototype.concat,st=Array.prototype.join,bh=Array.prototype.slice,Za=Math.floor,Oi=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Ti=Object.getOwnPropertySymbols,Li=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,rn=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Te=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===rn||!0)?Symbol.toStringTag:null,Ja=Object.prototype.propertyIsEnumerable,Qa=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(o){return o.__proto__}:null);function Ka(o,r){if(o===1/0||o===-1/0||o!==o||o&&o>-1e3&&o<1e3||Wa.call(/e/,r))return r;var a=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof o=="number"){var l=o<0?-Za(-o):Za(o);if(l!==o){var c=String(l),h=bi.call(r,c.length+1);return St.call(c,a,"$&_")+"."+St.call(St.call(h,/([0-9]{3})/g,"$&_"),/_$/,"")}}return St.call(r,a,"$&_")}var Ri=dh,eo=Ri.custom,to=io(eo)?eo:null,Oh=function o(r,a,l,c){var h=a||{};if(Nt(h,"quoteStyle")&&h.quoteStyle!=="single"&&h.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Nt(h,"maxStringLength")&&(typeof h.maxStringLength=="number"?h.maxStringLength<0&&h.maxStringLength!==1/0:h.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var v=Nt(h,"customInspect")?h.customInspect:!0;if(typeof v!="boolean"&&v!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(Nt(h,"indent")&&h.indent!==null&&h.indent!==" "&&!(parseInt(h.indent,10)===h.indent&&h.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(Nt(h,"numericSeparator")&&typeof h.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var p=h.numericSeparator;if(typeof r>"u")return"undefined";if(r===null)return"null";if(typeof r=="boolean")return r?"true":"false";if(typeof r=="string")return ao(r,h);if(typeof r=="number"){if(r===0)return 1/0/r>0?"0":"-0";var _=String(r);return p?Ka(r,_):_}if(typeof r=="bigint"){var x=String(r)+"n";return p?Ka(r,x):x}var I=typeof h.depth>"u"?5:h.depth;if(typeof l>"u"&&(l=0),l>=I&&I>0&&typeof r=="object")return Ci(r)?"[Array]":"[Object]";var m=jh(h,l);if(typeof c>"u")c=[];else if(so(c,r)>=0)return"[Circular]";function E(ae,q,ne){if(q&&(c=bh.call(c),c.push(q)),ne){var ue={depth:h.depth};return Nt(h,"quoteStyle")&&(ue.quoteStyle=h.quoteStyle),o(ae,ue,l+1,c)}return o(ae,h,l+1,c)}if(typeof r=="function"&&!ro(r)){var k=Fh(r),w=fr(r,E);return"[Function"+(k?": "+k:" (anonymous)")+"]"+(w.length>0?" { "+st.call(w,", ")+" }":"")}if(io(r)){var C=rn?St.call(String(r),/^(Symbol\(.*\))_[^)]*$/,"$1"):Li.call(r);return typeof r=="object"&&!rn?Cn(C):C}if(Yh(r)){for(var T="<"+Va.call(String(r.nodeName)),R=r.attributes||[],P=0;P<R.length;P++)T+=" "+R[P].name+"="+no(Th(R[P].value),"double",h);return T+=">",r.childNodes&&r.childNodes.length&&(T+="..."),T+="</"+Va.call(String(r.nodeName))+">",T}if(Ci(r)){if(r.length===0)return"[]";var A=fr(r,E);return m&&!Xh(A)?"["+Ai(A,m)+"]":"[ "+st.call(A,", ")+" ]"}if(Rh(r)){var D=fr(r,E);return!("cause"in Error.prototype)&&"cause"in r&&!Ja.call(r,"cause")?"{ ["+String(r)+"] "+st.call(Ha.call("[cause]: "+E(r.cause),D),", ")+" }":D.length===0?"["+String(r)+"]":"{ ["+String(r)+"] "+st.call(D,", ")+" }"}if(typeof r=="object"&&v){if(to&&typeof r[to]=="function"&&Ri)return Ri(r,{depth:I-l});if(v!=="symbol"&&typeof r.inspect=="function")return r.inspect()}if($h(r)){var M=[];return Ua&&Ua.call(r,function(ae,q){M.push(E(q,r,!0)+" => "+E(ae,r))}),oo("Map",lr.call(r),M,m)}if(qh(r)){var G=[];return Xa&&Xa.call(r,function(ae){G.push(E(ae,r))}),oo("Set",cr.call(r),G,m)}if(Bh(r))return Pi("WeakMap");if(zh(r))return Pi("WeakSet");if(Gh(r))return Pi("WeakRef");if(Ph(r))return Cn(E(Number(r)));if(Mh(r))return Cn(E(Oi.call(r)));if(Ah(r))return Cn(kh.call(r));if(Ch(r))return Cn(E(String(r)));if(typeof window<"u"&&r===window)return"{ [object Window] }";if(typeof globalThis<"u"&&r===globalThis||typeof be<"u"&&r===be)return"{ [object globalThis] }";if(!Lh(r)&&!ro(r)){var Y=fr(r,E),U=Qa?Qa(r)===Object.prototype:r instanceof Object||r.constructor===Object,X=r instanceof Object?"":"null prototype",ie=!U&&Te&&Object(r)===r&&Te in r?bi.call(wt(r),8,-1):X?"Object":"",ee=U||typeof r.constructor!="function"?"":r.constructor.name?r.constructor.name+" ":"",te=ee+(ie||X?"["+st.call(Ha.call([],ie||[],X||[]),": ")+"] ":"");return Y.length===0?te+"{}":m?te+"{"+Ai(Y,m)+"}":te+"{ "+st.call(Y,", ")+" }"}return String(r)};function no(o,r,a){var l=(a.quoteStyle||r)==="double"?'"':"'";return l+o+l}function Th(o){return St.call(String(o),/"/g,"&quot;")}function Ci(o){return wt(o)==="[object Array]"&&(!Te||!(typeof o=="object"&&Te in o))}function Lh(o){return wt(o)==="[object Date]"&&(!Te||!(typeof o=="object"&&Te in o))}function ro(o){return wt(o)==="[object RegExp]"&&(!Te||!(typeof o=="object"&&Te in o))}function Rh(o){return wt(o)==="[object Error]"&&(!Te||!(typeof o=="object"&&Te in o))}function Ch(o){return wt(o)==="[object String]"&&(!Te||!(typeof o=="object"&&Te in o))}function Ph(o){return wt(o)==="[object Number]"&&(!Te||!(typeof o=="object"&&Te in o))}function Ah(o){return wt(o)==="[object Boolean]"&&(!Te||!(typeof o=="object"&&Te in o))}function io(o){if(rn)return o&&typeof o=="object"&&o instanceof Symbol;if(typeof o=="symbol")return!0;if(!o||typeof o!="object"||!Li)return!1;try{return Li.call(o),!0}catch{}return!1}function Mh(o){if(!o||typeof o!="object"||!Oi)return!1;try{return Oi.call(o),!0}catch{}return!1}var Dh=Object.prototype.hasOwnProperty||function(o){return o in this};function Nt(o,r){return Dh.call(o,r)}function wt(o){return Ih.call(o)}function Fh(o){if(o.name)return o.name;var r=Nh.call(Sh.call(o),/^function\s*([\w$]+)/);return r?r[1]:null}function so(o,r){if(o.indexOf)return o.indexOf(r);for(var a=0,l=o.length;a<l;a++)if(o[a]===r)return a;return-1}function $h(o){if(!lr||!o||typeof o!="object")return!1;try{lr.call(o);try{cr.call(o)}catch{return!0}return o instanceof Map}catch{}return!1}function Bh(o){if(!Ln||!o||typeof o!="object")return!1;try{Ln.call(o,Ln);try{Rn.call(o,Rn)}catch{return!0}return o instanceof WeakMap}catch{}return!1}function Gh(o){if(!ja||!o||typeof o!="object")return!1;try{return ja.call(o),!0}catch{}return!1}function qh(o){if(!cr||!o||typeof o!="object")return!1;try{cr.call(o);try{lr.call(o)}catch{return!0}return o instanceof Set}catch{}return!1}function zh(o){if(!Rn||!o||typeof o!="object")return!1;try{Rn.call(o,Rn);try{Ln.call(o,Ln)}catch{return!0}return o instanceof WeakSet}catch{}return!1}function Yh(o){return!o||typeof o!="object"?!1:typeof HTMLElement<"u"&&o instanceof HTMLElement?!0:typeof o.nodeName=="string"&&typeof o.getAttribute=="function"}function ao(o,r){if(o.length>r.maxStringLength){var a=o.length-r.maxStringLength,l="... "+a+" more character"+(a>1?"s":"");return ao(bi.call(o,0,r.maxStringLength),r)+l}var c=St.call(St.call(o,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,Uh);return no(c,"single",r)}function Uh(o){var r=o.charCodeAt(0),a={8:"b",9:"t",10:"n",12:"f",13:"r"}[r];return a?"\\"+a:"\\x"+(r<16?"0":"")+wh.call(r.toString(16))}function Cn(o){return"Object("+o+")"}function Pi(o){return o+" { ? }"}function oo(o,r,a,l){var c=l?Ai(a,l):st.call(a,", ");return o+" ("+r+") {"+c+"}"}function Xh(o){for(var r=0;r<o.length;r++)if(so(o[r],`
2
- `)>=0)return!1;return!0}function jh(o,r){var a;if(o.indent===" ")a=" ";else if(typeof o.indent=="number"&&o.indent>0)a=st.call(Array(o.indent+1)," ");else return null;return{base:a,prev:st.call(Array(r+1),a)}}function Ai(o,r){if(o.length===0)return"";var a=`
3
- `+r.prev+r.base;return a+st.call(o,","+a)+`
4
- `+r.prev}function fr(o,r){var a=Ci(o),l=[];if(a){l.length=o.length;for(var c=0;c<o.length;c++)l[c]=Nt(o,c)?r(o[c],o):""}var h=typeof Ti=="function"?Ti(o):[],v;if(rn){v={};for(var p=0;p<h.length;p++)v["$"+h[p]]=h[p]}for(var _ in o)Nt(o,_)&&(a&&String(Number(_))===_&&_<o.length||rn&&v["$"+_]instanceof Symbol||(Wa.call(/[^\w$]/,_)?l.push(r(_,o)+": "+r(o[_],o)):l.push(_+": "+r(o[_],o))));if(typeof Ti=="function")for(var x=0;x<h.length;x++)Ja.call(o,h[x])&&l.push("["+r(h[x])+"]: "+r(o[h[x]],o));return l}var uo=it,sn=ze,Vh=Oh,Wh=It,hr=uo("%WeakMap%",!0),gr=uo("%Map%",!0),Hh=sn("WeakMap.prototype.get",!0),Zh=sn("WeakMap.prototype.set",!0),Jh=sn("WeakMap.prototype.has",!0),Qh=sn("Map.prototype.get",!0),Kh=sn("Map.prototype.set",!0),eg=sn("Map.prototype.has",!0),Mi=function(o,r){for(var a=o,l;(l=a.next)!==null;a=l)if(l.key===r)return a.next=l.next,l.next=o.next,o.next=l,l},tg=function(o,r){var a=Mi(o,r);return a&&a.value},ng=function(o,r,a){var l=Mi(o,r);l?l.value=a:o.next={key:r,next:o.next,value:a}},rg=function(o,r){return!!Mi(o,r)},lo=function(){var r,a,l,c={assert:function(h){if(!c.has(h))throw new Wh("Side channel does not contain "+Vh(h))},get:function(h){if(hr&&h&&(typeof h=="object"||typeof h=="function")){if(r)return Hh(r,h)}else if(gr){if(a)return Qh(a,h)}else if(l)return tg(l,h)},has:function(h){if(hr&&h&&(typeof h=="object"||typeof h=="function")){if(r)return Jh(r,h)}else if(gr){if(a)return eg(a,h)}else if(l)return rg(l,h);return!1},set:function(h,v){hr&&h&&(typeof h=="object"||typeof h=="function")?(r||(r=new hr),Zh(r,h,v)):gr?(a||(a=new gr),Kh(a,h,v)):(l||(l={key:{},next:null}),ng(l,h,v))}};return c},ig=fa,Pn=lo(),vt=It,Di={assert:function(o,r){if(!o||typeof o!="object"&&typeof o!="function")throw new vt("`O` is not an object");if(typeof r!="string")throw new vt("`slot` must be a string");if(Pn.assert(o),!Di.has(o,r))throw new vt("`"+r+"` is not present on `O`")},get:function(o,r){if(!o||typeof o!="object"&&typeof o!="function")throw new vt("`O` is not an object");if(typeof r!="string")throw new vt("`slot` must be a string");var a=Pn.get(o);return a&&a["$"+r]},has:function(o,r){if(!o||typeof o!="object"&&typeof o!="function")throw new vt("`O` is not an object");if(typeof r!="string")throw new vt("`slot` must be a string");var a=Pn.get(o);return!!a&&ig(a,"$"+r)},set:function(o,r,a){if(!o||typeof o!="object"&&typeof o!="function")throw new vt("`O` is not an object");if(typeof r!="string")throw new vt("`slot` must be a string");var l=Pn.get(o);l||(l={},Pn.set(o,l)),l["$"+r]=a}};Object.freeze&&Object.freeze(Di);var sg=Di,An=sg,ag=SyntaxError,co=typeof StopIteration=="object"?StopIteration:null,og=function(r){if(!co)throw new ag("this environment lacks StopIteration");An.set(r,"[[Done]]",!1);var a={next:function(){var c=An.get(this,"[[Iterator]]"),h=An.get(c,"[[Done]]");try{return{done:h,value:h?void 0:c.next()}}catch(v){if(An.set(c,"[[Done]]",!0),v!==co)throw v;return{done:!0,value:void 0}}}};return An.set(a,"[[Iterator]]",r),a},ug={}.toString,fo=Array.isArray||function(o){return ug.call(o)=="[object Array]"},lg=String.prototype.valueOf,cg=function(r){try{return lg.call(r),!0}catch{return!1}},fg=Object.prototype.toString,hg="[object String]",gg=Gt(),ho=function(r){return typeof r=="string"?!0:typeof r!="object"?!1:gg?cg(r):fg.call(r)===hg},Fi=typeof Map=="function"&&Map.prototype?Map:null,yg=typeof Set=="function"&&Set.prototype?Set:null,yr;Fi||(yr=function(r){return!1});var go=Fi?Map.prototype.has:null,yo=yg?Set.prototype.has:null;!yr&&!go&&(yr=function(r){return!1});var vo=yr||function(r){if(!r||typeof r!="object")return!1;try{if(go.call(r),yo)try{yo.call(r)}catch{return!0}return r instanceof Fi}catch{}return!1},vg=typeof Map=="function"&&Map.prototype?Map:null,$i=typeof Set=="function"&&Set.prototype?Set:null,vr;$i||(vr=function(r){return!1});var po=vg?Map.prototype.has:null,mo=$i?Set.prototype.has:null;!vr&&!mo&&(vr=function(r){return!1});var _o=vr||function(r){if(!r||typeof r!="object")return!1;try{if(mo.call(r),po)try{po.call(r)}catch{return!0}return r instanceof $i}catch{}return!1},xo=Ya,Eo=og;if(ci()||rr()){var Bi=Symbol.iterator;or.exports=function(r){if(r!=null&&typeof r[Bi]<"u")return r[Bi]();if(xo(r))return Array.prototype[Bi].call(r)}}else{var pg=fo,mg=ho,ko=it,dg=ko("%Map%",!0),_g=ko("%Set%",!0),Je=ze,Io=Je("Array.prototype.push"),So=Je("String.prototype.charCodeAt"),xg=Je("String.prototype.slice"),Eg=function(r,a){var l=r.length;if(a+1>=l)return a+1;var c=So(r,a);if(c<55296||c>56319)return a+1;var h=So(r,a+1);return h<56320||h>57343?a+1:a+2},Gi=function(r){var a=0;return{next:function(){var c=a>=r.length,h;return c||(h=r[a],a+=1),{done:c,value:h}}}},No=function(r,a){if(pg(r)||xo(r))return Gi(r);if(mg(r)){var l=0;return{next:function(){var h=Eg(r,l),v=xg(r,l,h);return l=h,{done:h>r.length,value:v}}}}if(a&&typeof r["_es6-shim iterator_"]<"u")return r["_es6-shim iterator_"]()};if(!dg&&!_g)or.exports=function(r){if(r!=null)return No(r,!0)};else{var kg=vo,Ig=_o,wo=Je("Map.prototype.forEach",!0),bo=Je("Set.prototype.forEach",!0);if(typeof process>"u"||!process.versions||!process.versions.node)var Oo=Je("Map.prototype.iterator",!0),To=Je("Set.prototype.iterator",!0);var Lo=Je("Map.prototype.@@iterator",!0)||Je("Map.prototype._es6-shim iterator_",!0),Ro=Je("Set.prototype.@@iterator",!0)||Je("Set.prototype._es6-shim iterator_",!0),Sg=function(r){if(kg(r)){if(Oo)return Eo(Oo(r));if(Lo)return Lo(r);if(wo){var a=[];return wo(r,function(c,h){Io(a,[h,c])}),Gi(a)}}if(Ig(r)){if(To)return Eo(To(r));if(Ro)return Ro(r);if(bo){var l=[];return bo(r,function(c){Io(l,c)}),Gi(l)}}};or.exports=function(r){return Sg(r)||No(r)}}}var Ng=or.exports,Co=function(o){return o!==o},Po=function(r,a){return r===0&&a===0?1/r===1/a:!!(r===a||Co(r)&&Co(a))},wg=Po,Ao=function(){return typeof Object.is=="function"?Object.is:wg},bg=Ao,Og=Bt,Tg=function(){var r=bg();return Og(Object,{is:r},{is:function(){return Object.is!==r}}),r},Lg=Bt,Rg=nn,Cg=Po,Mo=Ao,Pg=Tg,Do=Rg(Mo(),Object);Lg(Do,{getPolyfill:Mo,implementation:Cg,shim:Pg});var Ag=Do,Mg=nn,Fo=ze,Dg=it,qi=Dg("%ArrayBuffer%",!0),pr=Fo("ArrayBuffer.prototype.byteLength",!0),Fg=Fo("Object.prototype.toString"),$o=!!qi&&!pr&&new qi(0).slice,Bo=!!$o&&Mg($o),Go=pr||Bo?function(r){if(!r||typeof r!="object")return!1;try{return pr?pr(r):Bo(r,0),!0}catch{return!1}}:qi?function(r){return Fg(r)==="[object ArrayBuffer]"}:function(r){return!1},$g=Date.prototype.getDay,Bg=function(r){try{return $g.call(r),!0}catch{return!1}},Gg=Object.prototype.toString,qg="[object Date]",zg=Gt(),Yg=function(r){return typeof r!="object"||r===null?!1:zg?Bg(r):Gg.call(r)===qg},zi=ze,qo=Gt(),zo,Yo,Yi,Ui;if(qo){zo=zi("Object.prototype.hasOwnProperty"),Yo=zi("RegExp.prototype.exec"),Yi={};var Xi=function(){throw Yi};Ui={toString:Xi,valueOf:Xi},typeof Symbol.toPrimitive=="symbol"&&(Ui[Symbol.toPrimitive]=Xi)}var Ug=zi("Object.prototype.toString"),Xg=Object.getOwnPropertyDescriptor,jg="[object RegExp]",Vg=qo?function(r){if(!r||typeof r!="object")return!1;var a=Xg(r,"lastIndex"),l=a&&zo(a,"value");if(!l)return!1;try{Yo(r,Ui)}catch(c){return c===Yi}}:function(r){return!r||typeof r!="object"&&typeof r!="function"?!1:Ug(r)===jg},Wg=ze,Uo=Wg("SharedArrayBuffer.prototype.byteLength",!0),Hg=Uo?function(r){if(!r||typeof r!="object")return!1;try{return Uo(r),!0}catch{return!1}}:function(r){return!1},Zg=Number.prototype.toString,Jg=function(r){try{return Zg.call(r),!0}catch{return!1}},Qg=Object.prototype.toString,Kg="[object Number]",ey=Gt(),ty=function(r){return typeof r=="number"?!0:typeof r!="object"?!1:ey?Jg(r):Qg.call(r)===Kg},Xo=ze,ny=Xo("Boolean.prototype.toString"),ry=Xo("Object.prototype.toString"),iy=function(r){try{return ny(r),!0}catch{return!1}},sy="[object Boolean]",ay=Gt(),oy=function(r){return typeof r=="boolean"?!0:r===null||typeof r!="object"?!1:ay&&Symbol.toStringTag in r?iy(r):ry(r)===sy},ji={exports:{}},uy=Object.prototype.toString,ly=ci();if(ly){var cy=Symbol.prototype.toString,fy=/^Symbol\(.*\)$/,hy=function(r){return typeof r.valueOf()!="symbol"?!1:fy.test(cy.call(r))};ji.exports=function(r){if(typeof r=="symbol")return!0;if(uy.call(r)!=="[object Symbol]")return!1;try{return hy(r)}catch{return!1}}}else ji.exports=function(r){return!1};var gy=ji.exports,Vi={exports:{}},jo=typeof BigInt<"u"&&BigInt,yy=function(){return typeof jo=="function"&&typeof BigInt=="function"&&typeof jo(42)=="bigint"&&typeof BigInt(42)=="bigint"},vy=yy();if(vy){var py=BigInt.prototype.valueOf,my=function(r){try{return py.call(r),!0}catch{}return!1};Vi.exports=function(r){return r===null||typeof r>"u"||typeof r=="boolean"||typeof r=="string"||typeof r=="number"||typeof r=="symbol"||typeof r=="function"?!1:typeof r=="bigint"?!0:my(r)}}else Vi.exports=function(r){return!1};var dy=Vi.exports,_y=ho,xy=ty,Ey=oy,ky=gy,Iy=dy,Sy=function(r){if(r==null||typeof r!="object"&&typeof r!="function")return null;if(_y(r))return"String";if(xy(r))return"Number";if(Ey(r))return"Boolean";if(ky(r))return"Symbol";if(Iy(r))return"BigInt"},mr=typeof WeakMap=="function"&&WeakMap.prototype?WeakMap:null,Vo=typeof WeakSet=="function"&&WeakSet.prototype?WeakSet:null,dr;mr||(dr=function(r){return!1});var Wi=mr?mr.prototype.has:null,Hi=Vo?Vo.prototype.has:null;!dr&&!Wi&&(dr=function(r){return!1});var Ny=dr||function(r){if(!r||typeof r!="object")return!1;try{if(Wi.call(r,Wi),Hi)try{Hi.call(r,Hi)}catch{return!0}return r instanceof mr}catch{}return!1},Zi={exports:{}},wy=it,Wo=ze,by=wy("%WeakSet%",!0),Ji=Wo("WeakSet.prototype.has",!0);if(Ji){var Qi=Wo("WeakMap.prototype.has",!0);Zi.exports=function(r){if(!r||typeof r!="object")return!1;try{if(Ji(r,Ji),Qi)try{Qi(r,Qi)}catch{return!0}return r instanceof by}catch{}return!1}}else Zi.exports=function(r){return!1};var Oy=Zi.exports,Ty=vo,Ly=_o,Ry=Ny,Cy=Oy,Py=function(r){if(r&&typeof r=="object"){if(Ty(r))return"Map";if(Ly(r))return"Set";if(Ry(r))return"WeakMap";if(Cy(r))return"WeakSet"}return!1},Ho=Function.prototype.toString,an=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,Ki,_r;if(typeof an=="function"&&typeof Object.defineProperty=="function")try{Ki=Object.defineProperty({},"length",{get:function(){throw _r}}),_r={},an(function(){throw 42},null,Ki)}catch(o){o!==_r&&(an=null)}else an=null;var Ay=/^\s*class\b/,es=function(r){try{var a=Ho.call(r);return Ay.test(a)}catch{return!1}},ts=function(r){try{return es(r)?!1:(Ho.call(r),!0)}catch{return!1}},xr=Object.prototype.toString,My="[object Object]",Dy="[object Function]",Fy="[object GeneratorFunction]",$y="[object HTMLAllCollection]",By="[object HTML document.all class]",Gy="[object HTMLCollection]",qy=typeof Symbol=="function"&&!!Symbol.toStringTag,zy=!(0 in[,]),ns=function(){return!1};if(typeof document=="object"){var Yy=document.all;xr.call(Yy)===xr.call(document.all)&&(ns=function(r){if((zy||!r)&&(typeof r>"u"||typeof r=="object"))try{var a=xr.call(r);return(a===$y||a===By||a===Gy||a===My)&&r("")==null}catch{}return!1})}var Uy=an?function(r){if(ns(r))return!0;if(!r||typeof r!="function"&&typeof r!="object")return!1;try{an(r,null,Ki)}catch(a){if(a!==_r)return!1}return!es(r)&&ts(r)}:function(r){if(ns(r))return!0;if(!r||typeof r!="function"&&typeof r!="object")return!1;if(qy)return ts(r);if(es(r))return!1;var a=xr.call(r);return a!==Dy&&a!==Fy&&!/^\[object HTML/.test(a)?!1:ts(r)},Xy=Uy,jy=Object.prototype.toString,Zo=Object.prototype.hasOwnProperty,Vy=function(r,a,l){for(var c=0,h=r.length;c<h;c++)Zo.call(r,c)&&(l==null?a(r[c],c,r):a.call(l,r[c],c,r))},Wy=function(r,a,l){for(var c=0,h=r.length;c<h;c++)l==null?a(r.charAt(c),c,r):a.call(l,r.charAt(c),c,r)},Hy=function(r,a,l){for(var c in r)Zo.call(r,c)&&(l==null?a(r[c],c,r):a.call(l,r[c],c,r))},Zy=function(r,a,l){if(!Xy(a))throw new TypeError("iterator must be a function");var c;arguments.length>=3&&(c=l),jy.call(r)==="[object Array]"?Vy(r,a,c):typeof r=="string"?Wy(r,a,c):Hy(r,a,c)},Jy=Zy,Qy=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"],rs=Qy,Ky=typeof globalThis>"u"?be:globalThis,ev=function(){for(var r=[],a=0;a<rs.length;a++)typeof Ky[rs[a]]=="function"&&(r[r.length]=rs[a]);return r},Er=Jy,tv=ev,Jo=nn,is=ze,kr=mi,nv=is("Object.prototype.toString"),Qo=Gt(),Ko=typeof globalThis>"u"?be:globalThis,ss=tv(),as=is("String.prototype.slice"),os=Object.getPrototypeOf,rv=is("Array.prototype.indexOf",!0)||function(r,a){for(var l=0;l<r.length;l+=1)if(r[l]===a)return l;return-1},Ir={__proto__:null};Qo&&kr&&os?Er(ss,function(o){var r=new Ko[o];if(Symbol.toStringTag in r){var a=os(r),l=kr(a,Symbol.toStringTag);if(!l){var c=os(a);l=kr(c,Symbol.toStringTag)}Ir["$"+o]=Jo(l.get)}}):Er(ss,function(o){var r=new Ko[o],a=r.slice||r.set;a&&(Ir["$"+o]=Jo(a))});var iv=function(r){var a=!1;return Er(Ir,function(l,c){if(!a)try{"$"+l(r)===c&&(a=as(c,1))}catch{}}),a},sv=function(r){var a=!1;return Er(Ir,function(l,c){if(!a)try{l(r),a=as(c,1)}catch{}}),a},av=function(r){if(!r||typeof r!="object")return!1;if(!Qo){var a=as(nv(r),8,-1);return rv(ss,a)>-1?a:a!=="Object"?!1:sv(r)}return kr?iv(r):null},ov=ze,eu=ov("ArrayBuffer.prototype.byteLength",!0),uv=Go,lv=function(r){return uv(r)?eu?eu(r):r.byteLength:NaN},tu=Yf,at=ze,nu=gh,cv=it,on=Ng,fv=lo,ru=Ag,iu=Ya,su=fo,au=Go,ou=Yg,uu=Vg,lu=Hg,cu=li,fu=Sy,hu=Py,gu=av,yu=lv,vu=at("SharedArrayBuffer.prototype.byteLength",!0),pu=at("Date.prototype.getTime"),us=Object.getPrototypeOf,mu=at("Object.prototype.toString"),Sr=cv("%Set%",!0),ls=at("Map.prototype.has",!0),Nr=at("Map.prototype.get",!0),du=at("Map.prototype.size",!0),wr=at("Set.prototype.add",!0),_u=at("Set.prototype.delete",!0),br=at("Set.prototype.has",!0),Or=at("Set.prototype.size",!0);function xu(o,r,a,l){for(var c=on(o),h;(h=c.next())&&!h.done;)if(Qe(r,h.value,a,l))return _u(o,h.value),!0;return!1}function Eu(o){if(typeof o>"u")return null;if(typeof o!="object")return typeof o=="symbol"?!1:typeof o=="string"||typeof o=="number"?+o==+o:!0}function hv(o,r,a,l,c,h){var v=Eu(a);if(v!=null)return v;var p=Nr(r,v),_=tu({},c,{strict:!1});return typeof p>"u"&&!ls(r,v)||!Qe(l,p,_,h)?!1:!ls(o,v)&&Qe(l,p,_,h)}function gv(o,r,a){var l=Eu(a);return l??(br(r,l)&&!br(o,l))}function ku(o,r,a,l,c,h){for(var v=on(o),p,_;(p=v.next())&&!p.done;)if(_=p.value,Qe(a,_,c,h)&&Qe(l,Nr(r,_),c,h))return _u(o,_),!0;return!1}function Qe(o,r,a,l){var c=a||{};if(c.strict?ru(o,r):o===r)return!0;var h=fu(o),v=fu(r);if(h!==v)return!1;if(!o||!r||typeof o!="object"&&typeof r!="object")return c.strict?ru(o,r):o==r;var p=l.has(o),_=l.has(r),x;if(p&&_){if(l.get(o)===l.get(r))return!0}else x={};return p||l.set(o,x),_||l.set(r,x),pv(o,r,c,l)}function Iu(o){return!o||typeof o!="object"||typeof o.length!="number"||typeof o.copy!="function"||typeof o.slice!="function"||o.length>0&&typeof o[0]!="number"?!1:!!(o.constructor&&o.constructor.isBuffer&&o.constructor.isBuffer(o))}function yv(o,r,a,l){if(Or(o)!==Or(r))return!1;for(var c=on(o),h=on(r),v,p,_;(v=c.next())&&!v.done;)if(v.value&&typeof v.value=="object")_||(_=new Sr),wr(_,v.value);else if(!br(r,v.value)){if(a.strict||!gv(o,r,v.value))return!1;_||(_=new Sr),wr(_,v.value)}if(_){for(;(p=h.next())&&!p.done;)if(p.value&&typeof p.value=="object"){if(!xu(_,p.value,a.strict,l))return!1}else if(!a.strict&&!br(o,p.value)&&!xu(_,p.value,a.strict,l))return!1;return Or(_)===0}return!0}function vv(o,r,a,l){if(du(o)!==du(r))return!1;for(var c=on(o),h=on(r),v,p,_,x,I,m;(v=c.next())&&!v.done;)if(x=v.value[0],I=v.value[1],x&&typeof x=="object")_||(_=new Sr),wr(_,x);else if(m=Nr(r,x),typeof m>"u"&&!ls(r,x)||!Qe(I,m,a,l)){if(a.strict||!hv(o,r,x,I,a,l))return!1;_||(_=new Sr),wr(_,x)}if(_){for(;(p=h.next())&&!p.done;)if(x=p.value[0],m=p.value[1],x&&typeof x=="object"){if(!ku(_,o,x,m,a,l))return!1}else if(!a.strict&&(!o.has(x)||!Qe(Nr(o,x),m,a,l))&&!ku(_,o,x,m,tu({},a,{strict:!1}),l))return!1;return Or(_)===0}return!0}function pv(o,r,a,l){var c,h;if(typeof o!=typeof r||o==null||r==null||mu(o)!==mu(r)||iu(o)!==iu(r))return!1;var v=su(o),p=su(r);if(v!==p)return!1;var _=o instanceof Error,x=r instanceof Error;if(_!==x||(_||x)&&(o.name!==r.name||o.message!==r.message))return!1;var I=uu(o),m=uu(r);if(I!==m||(I||m)&&(o.source!==r.source||nu(o)!==nu(r)))return!1;var E=ou(o),k=ou(r);if(E!==k||(E||k)&&pu(o)!==pu(r)||a.strict&&us&&us(o)!==us(r))return!1;var w=gu(o),C=gu(r);if(w!==C)return!1;if(w||C){if(o.length!==r.length)return!1;for(c=0;c<o.length;c++)if(o[c]!==r[c])return!1;return!0}var T=Iu(o),R=Iu(r);if(T!==R)return!1;if(T||R){if(o.length!==r.length)return!1;for(c=0;c<o.length;c++)if(o[c]!==r[c])return!1;return!0}var P=au(o),A=au(r);if(P!==A)return!1;if(P||A)return yu(o)!==yu(r)?!1:typeof Uint8Array=="function"&&Qe(new Uint8Array(o),new Uint8Array(r),a,l);var D=lu(o),M=lu(r);if(D!==M)return!1;if(D||M)return vu(o)!==vu(r)?!1:typeof Uint8Array=="function"&&Qe(new Uint8Array(o),new Uint8Array(r),a,l);if(typeof o!=typeof r)return!1;var G=cu(o),Y=cu(r);if(G.length!==Y.length)return!1;for(G.sort(),Y.sort(),c=G.length-1;c>=0;c--)if(G[c]!=Y[c])return!1;for(c=G.length-1;c>=0;c--)if(h=G[c],!Qe(o[h],r[h],a,l))return!1;var U=hu(o),X=hu(r);return U!==X?!1:U==="Set"||X==="Set"?yv(o,r,a,l):U==="Map"?vv(o,r,a,l):!0}var mv=function(r,a,l){return Qe(r,a,l,fv())};const dv=Dt(mv);var _v=Object.defineProperty,he=(o,r)=>_v(o,"name",{value:r,configurable:!0}),xv=class{constructor(r){this.direction=!1,this.compareProperties=!0;var a,l,c;this.precision=10**-((a=r==null?void 0:r.precision)!=null?a:17),this.direction=(l=r==null?void 0:r.direction)!=null?l:!1,this.compareProperties=(c=r==null?void 0:r.compareProperties)!=null?c:!0}compare(r,a){if(r.type!==a.type||!Mn(r,a))return!1;switch(r.type){case"Point":return this.compareCoord(r.coordinates,a.coordinates);case"LineString":return this.compareLine(r.coordinates,a.coordinates);case"Polygon":return this.comparePolygon(r,a);case"GeometryCollection":return this.compareGeometryCollection(r,a);case"Feature":return this.compareFeature(r,a);case"FeatureCollection":return this.compareFeatureCollection(r,a);default:if(r.type.startsWith("Multi")){const l=cs(r),c=cs(a);return l.every(h=>c.some(v=>this.compare(h,v)))}}return!1}compareCoord(r,a){return r.length===a.length&&r.every((l,c)=>Math.abs(l-a[c])<this.precision)}compareLine(r,a,l=0,c=!1){if(!Mn(r,a))return!1;const h=r;let v=a;if(c&&!this.compareCoord(h[0],v[0])){const _=this.fixStartIndex(v,h);if(_)v=_;else return!1}const p=this.compareCoord(h[l],v[l]);return this.direction||p?this.comparePath(h,v):this.compareCoord(h[l],v[v.length-(1+l)])?this.comparePath(h.slice().reverse(),v):!1}fixStartIndex(r,a){let l,c=-1;for(let h=0;h<r.length;h++)if(this.compareCoord(r[h],a[0])){c=h;break}return c>=0&&(l=[].concat(r.slice(c,r.length),r.slice(1,c+1))),l}comparePath(r,a){return r.every((l,c)=>this.compareCoord(l,a[c]))}comparePolygon(r,a){if(this.compareLine(r.coordinates[0],a.coordinates[0],1,!0)){const l=r.coordinates.slice(1,r.coordinates.length),c=a.coordinates.slice(1,a.coordinates.length);return l.every(h=>c.some(v=>this.compareLine(h,v,1,!0)))}return!1}compareGeometryCollection(r,a){return Mn(r.geometries,a.geometries)&&this.compareBBox(r,a)&&r.geometries.every((l,c)=>this.compare(l,a.geometries[c]))}compareFeature(r,a){return r.id===a.id&&(this.compareProperties?dv(r.properties,a.properties):!0)&&this.compareBBox(r,a)&&this.compare(r.geometry,a.geometry)}compareFeatureCollection(r,a){return Mn(r.features,a.features)&&this.compareBBox(r,a)&&r.features.every((l,c)=>this.compare(l,a.features[c]))}compareBBox(r,a){return!r.bbox&&!a.bbox||(r.bbox&&a.bbox?this.compareCoord(r.bbox,a.bbox):!1)}};he(xv,"GeojsonEquality");function Mn(o,r){return o.coordinates?o.coordinates.length===r.coordinates.length:o.length===r.length}he(Mn,"sameLength");function cs(o){return o.coordinates.map(r=>({type:o.type.replace("Multi",""),coordinates:r}))}he(cs,"explode");var Me=63710088e-1,Su={centimeters:Me*100,centimetres:Me*100,degrees:360/(2*Math.PI),feet:Me*3.28084,inches:Me*39.37,kilometers:Me/1e3,kilometres:Me/1e3,meters:Me,metres:Me,miles:Me/1609.344,millimeters:Me*1e3,millimetres:Me*1e3,nauticalmiles:Me/1852,radians:1,yards:Me*1.0936},Nu={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,nauticalmiles:29155334959812285e-23,millimeters:1e6,millimetres:1e6,yards:1.195990046};function Ye(o,r,a={}){const l={type:"Feature"};return(a.id===0||a.id)&&(l.id=a.id),a.bbox&&(l.bbox=a.bbox),l.properties=r||{},l.geometry=o,l}he(Ye,"feature");function Ev(o,r,a={}){switch(o){case"Point":return ot(r).geometry;case"LineString":return pt(r).geometry;case"Polygon":return un(r).geometry;case"MultiPoint":return bu(r).geometry;case"MultiLineString":return wu(r).geometry;case"MultiPolygon":return Tr(r).geometry;default:throw new Error(o+" is invalid")}}he(Ev,"geometry");function ot(o,r,a={}){if(!o)throw new Error("coordinates is required");if(!Array.isArray(o))throw new Error("coordinates must be an Array");if(o.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Rr(o[0])||!Rr(o[1]))throw new Error("coordinates must contain numbers");return Ye({type:"Point",coordinates:o},r,a)}he(ot,"point");function kv(o,r,a={}){return Ke(o.map(l=>ot(l,r)),a)}he(kv,"points");function un(o,r,a={}){for(const c of o){if(c.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(c[c.length-1].length!==c[0].length)throw new Error("First and last Position are not equivalent.");for(let h=0;h<c[c.length-1].length;h++)if(c[c.length-1][h]!==c[0][h])throw new Error("First and last Position are not equivalent.")}return Ye({type:"Polygon",coordinates:o},r,a)}he(un,"polygon");function Iv(o,r,a={}){return Ke(o.map(l=>un(l,r)),a)}he(Iv,"polygons");function pt(o,r,a={}){if(o.length<2)throw new Error("coordinates must be an array of two or more positions");return Ye({type:"LineString",coordinates:o},r,a)}he(pt,"lineString");function Sv(o,r,a={}){return Ke(o.map(l=>pt(l,r)),a)}he(Sv,"lineStrings");function Ke(o,r={}){const a={type:"FeatureCollection"};return r.id&&(a.id=r.id),r.bbox&&(a.bbox=r.bbox),a.features=o,a}he(Ke,"featureCollection");function wu(o,r,a={}){return Ye({type:"MultiLineString",coordinates:o},r,a)}he(wu,"multiLineString");function bu(o,r,a={}){return Ye({type:"MultiPoint",coordinates:o},r,a)}he(bu,"multiPoint");function Tr(o,r,a={}){return Ye({type:"MultiPolygon",coordinates:o},r,a)}he(Tr,"multiPolygon");function Nv(o,r,a={}){return Ye({type:"GeometryCollection",geometries:o},r,a)}he(Nv,"geometryCollection");function wv(o,r=0){if(r&&!(r>=0))throw new Error("precision must be a positive number");const a=Math.pow(10,r||0);return Math.round(o*a)/a}he(wv,"round");function fs(o,r="kilometers"){const a=Su[r];if(!a)throw new Error(r+" units is invalid");return o*a}he(fs,"radiansToLength");function Lr(o,r="kilometers"){const a=Su[r];if(!a)throw new Error(r+" units is invalid");return o/a}he(Lr,"lengthToRadians");function bv(o,r){return Ou(Lr(o,r))}he(bv,"lengthToDegrees");function Ov(o){let r=o%360;return r<0&&(r+=360),r}he(Ov,"bearingToAzimuth");function Ou(o){return o%(2*Math.PI)*180/Math.PI}he(Ou,"radiansToDegrees");function Tv(o){return o%360*Math.PI/180}he(Tv,"degreesToRadians");function Lv(o,r="kilometers",a="kilometers"){if(!(o>=0))throw new Error("length must be a positive number");return fs(Lr(o,r),a)}he(Lv,"convertLength");function Rv(o,r="meters",a="kilometers"){if(!(o>=0))throw new Error("area must be a positive number");const l=Nu[r];if(!l)throw new Error("invalid original units");const c=Nu[a];if(!c)throw new Error("invalid final units");return o/l*c}he(Rv,"convertArea");function Rr(o){return!isNaN(o)&&o!==null&&!Array.isArray(o)}he(Rr,"isNumber");function hs(o){return o!==null&&typeof o=="object"&&!Array.isArray(o)}he(hs,"isObject");function Cv(o){if(!o)throw new Error("bbox is required");if(!Array.isArray(o))throw new Error("bbox must be an Array");if(o.length!==4&&o.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");o.forEach(r=>{if(!Rr(r))throw new Error("bbox must only contain numbers")})}he(Cv,"validateBBox");function Pv(o){if(!o)throw new Error("id is required");if(["string","number"].indexOf(typeof o)===-1)throw new Error("id must be a number or a string")}he(Pv,"validateId");/**
1
+ (function(L,b){typeof exports=="object"&&typeof module<"u"?b(exports):typeof define=="function"&&define.amd?define(["exports"],b):(L=typeof globalThis<"u"?globalThis:L||self,b(L.maplibreglMaptilerGeocodingController={}))})(this,function(L){"use strict";var We=Object.defineProperty;var Je=(L,b,T)=>b in L?We(L,b,{enumerable:!0,configurable:!0,writable:!0,value:T}):L[b]=T;var vt=(L,b,T)=>Je(L,typeof b!="symbol"?b+"":b,T);function b(i,t,e={}){const n={type:"Feature"};return(e.id===0||e.id)&&(n.id=e.id),e.bbox&&(n.bbox=e.bbox),n.properties=t||{},n.geometry=i,n}function T(i,t,e={}){for(const r of i){if(r.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(r[r.length-1].length!==r[0].length)throw new Error("First and last Position are not equivalent.");for(let o=0;o<r[r.length-1].length;o++)if(r[r.length-1][o]!==r[0][o])throw new Error("First and last Position are not equivalent.")}return b({type:"Polygon",coordinates:i},t,e)}function V(i,t={}){const e={type:"FeatureCollection"};return t.id&&(e.id=t.id),t.bbox&&(e.bbox=t.bbox),e.features=i,e}function wt(i,t,e={}){return b({type:"MultiPolygon",coordinates:i},t,e)}/**
5
2
  * splaytree v3.1.2
6
3
  * Fast Splay tree for Node and browser
7
4
  *
@@ -9,24 +6,18 @@
9
6
  * @license MIT
10
7
  * @preserve
11
8
  *//*! *****************************************************************************
12
- Copyright (c) Microsoft Corporation. All rights reserved.
13
- Licensed under the Apache License, Version 2.0 (the "License"); you may not use
14
- this file except in compliance with the License. You may obtain a copy of the
15
- License at http://www.apache.org/licenses/LICENSE-2.0
9
+ Copyright (c) Microsoft Corporation. All rights reserved.
10
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
11
+ this file except in compliance with the License. You may obtain a copy of the
12
+ License at http://www.apache.org/licenses/LICENSE-2.0
16
13
 
17
- THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18
- KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
19
- WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
20
- MERCHANTABLITY OR NON-INFRINGEMENT.
14
+ THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
+ KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
16
+ WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
17
+ MERCHANTABLITY OR NON-INFRINGEMENT.
21
18
 
22
- See the Apache Version 2.0 License for specific language governing permissions
23
- and limitations under the License.
24
- ***************************************************************************** */function Av(o,r){var a={label:0,sent:function(){if(h[0]&1)throw h[1];return h[1]},trys:[],ops:[]},l,c,h,v;return v={next:p(0),throw:p(1),return:p(2)},typeof Symbol=="function"&&(v[Symbol.iterator]=function(){return this}),v;function p(x){return function(I){return _([x,I])}}function _(x){if(l)throw new TypeError("Generator is already executing.");for(;a;)try{if(l=1,c&&(h=x[0]&2?c.return:x[0]?c.throw||((h=c.return)&&h.call(c),0):c.next)&&!(h=h.call(c,x[1])).done)return h;switch(c=0,h&&(x=[x[0]&2,h.value]),x[0]){case 0:case 1:h=x;break;case 4:return a.label++,{value:x[1],done:!1};case 5:a.label++,c=x[1],x=[0];continue;case 7:x=a.ops.pop(),a.trys.pop();continue;default:if(h=a.trys,!(h=h.length>0&&h[h.length-1])&&(x[0]===6||x[0]===2)){a=0;continue}if(x[0]===3&&(!h||x[1]>h[0]&&x[1]<h[3])){a.label=x[1];break}if(x[0]===6&&a.label<h[1]){a.label=h[1],h=x;break}if(h&&a.label<h[2]){a.label=h[2],a.ops.push(x);break}h[2]&&a.ops.pop(),a.trys.pop();continue}x=r.call(o,a)}catch(I){x=[6,I],c=0}finally{l=h=0}if(x[0]&5)throw x[1];return{value:x[0]?x[1]:void 0,done:!0}}}var bt=function(){function o(r,a){this.next=null,this.key=r,this.data=a,this.left=null,this.right=null}return o}();function Mv(o,r){return o>r?1:o<r?-1:0}function Ot(o,r,a){for(var l=new bt(null,null),c=l,h=l;;){var v=a(o,r.key);if(v<0){if(r.left===null)break;if(a(o,r.left.key)<0){var p=r.left;if(r.left=p.right,p.right=r,r=p,r.left===null)break}h.left=r,h=r,r=r.left}else if(v>0){if(r.right===null)break;if(a(o,r.right.key)>0){var p=r.right;if(r.right=p.left,p.left=r,r=p,r.right===null)break}c.right=r,c=r,r=r.right}else break}return c.right=r.left,h.left=r.right,r.left=l.right,r.right=l.left,r}function gs(o,r,a,l){var c=new bt(o,r);if(a===null)return c.left=c.right=null,c;a=Ot(o,a,l);var h=l(o,a.key);return h<0?(c.left=a.left,c.right=a,a.left=null):h>=0&&(c.right=a.right,c.left=a,a.right=null),c}function Tu(o,r,a){var l=null,c=null;if(r){r=Ot(o,r,a);var h=a(r.key,o);h===0?(l=r.left,c=r.right):h<0?(c=r.right,r.right=null,l=r):(l=r.left,r.left=null,c=r)}return{left:l,right:c}}function Dv(o,r,a){return r===null?o:(o===null||(r=Ot(o.key,r,a),r.left=o),r)}function ys(o,r,a,l,c){if(o){l(""+r+(a?"└── ":"├── ")+c(o)+`
25
- `);var h=r+(a?" ":"│ ");o.left&&ys(o.left,h,!1,l,c),o.right&&ys(o.right,h,!0,l,c)}}var vs=function(){function o(r){r===void 0&&(r=Mv),this._root=null,this._size=0,this._comparator=r}return o.prototype.insert=function(r,a){return this._size++,this._root=gs(r,a,this._root,this._comparator)},o.prototype.add=function(r,a){var l=new bt(r,a);this._root===null&&(l.left=l.right=null,this._size++,this._root=l);var c=this._comparator,h=Ot(r,this._root,c),v=c(r,h.key);return v===0?this._root=h:(v<0?(l.left=h.left,l.right=h,h.left=null):v>0&&(l.right=h.right,l.left=h,h.right=null),this._size++,this._root=l),this._root},o.prototype.remove=function(r){this._root=this._remove(r,this._root,this._comparator)},o.prototype._remove=function(r,a,l){var c;if(a===null)return null;a=Ot(r,a,l);var h=l(r,a.key);return h===0?(a.left===null?c=a.right:(c=Ot(r,a.left,l),c.right=a.right),this._size--,c):a},o.prototype.pop=function(){var r=this._root;if(r){for(;r.left;)r=r.left;return this._root=Ot(r.key,this._root,this._comparator),this._root=this._remove(r.key,this._root,this._comparator),{key:r.key,data:r.data}}return null},o.prototype.findStatic=function(r){for(var a=this._root,l=this._comparator;a;){var c=l(r,a.key);if(c===0)return a;c<0?a=a.left:a=a.right}return null},o.prototype.find=function(r){return this._root&&(this._root=Ot(r,this._root,this._comparator),this._comparator(r,this._root.key)!==0)?null:this._root},o.prototype.contains=function(r){for(var a=this._root,l=this._comparator;a;){var c=l(r,a.key);if(c===0)return!0;c<0?a=a.left:a=a.right}return!1},o.prototype.forEach=function(r,a){for(var l=this._root,c=[],h=!1;!h;)l!==null?(c.push(l),l=l.left):c.length!==0?(l=c.pop(),r.call(a,l),l=l.right):h=!0;return this},o.prototype.range=function(r,a,l,c){for(var h=[],v=this._comparator,p=this._root,_;h.length!==0||p;)if(p)h.push(p),p=p.left;else{if(p=h.pop(),_=v(p.key,a),_>0)break;if(v(p.key,r)>=0&&l.call(c,p))return this;p=p.right}return this},o.prototype.keys=function(){var r=[];return this.forEach(function(a){var l=a.key;return r.push(l)}),r},o.prototype.values=function(){var r=[];return this.forEach(function(a){var l=a.data;return r.push(l)}),r},o.prototype.min=function(){return this._root?this.minNode(this._root).key:null},o.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},o.prototype.minNode=function(r){if(r===void 0&&(r=this._root),r)for(;r.left;)r=r.left;return r},o.prototype.maxNode=function(r){if(r===void 0&&(r=this._root),r)for(;r.right;)r=r.right;return r},o.prototype.at=function(r){for(var a=this._root,l=!1,c=0,h=[];!l;)if(a)h.push(a),a=a.left;else if(h.length>0){if(a=h.pop(),c===r)return a;c++,a=a.right}else l=!0;return null},o.prototype.next=function(r){var a=this._root,l=null;if(r.right){for(l=r.right;l.left;)l=l.left;return l}for(var c=this._comparator;a;){var h=c(r.key,a.key);if(h===0)break;h<0?(l=a,a=a.left):a=a.right}return l},o.prototype.prev=function(r){var a=this._root,l=null;if(r.left!==null){for(l=r.left;l.right;)l=l.right;return l}for(var c=this._comparator;a;){var h=c(r.key,a.key);if(h===0)break;h<0?a=a.left:(l=a,a=a.right)}return l},o.prototype.clear=function(){return this._root=null,this._size=0,this},o.prototype.toList=function(){return $v(this._root)},o.prototype.load=function(r,a,l){a===void 0&&(a=[]),l===void 0&&(l=!1);var c=r.length,h=this._comparator;if(l&&ds(r,a,0,c-1,h),this._root===null)this._root=ps(r,a,0,c),this._size=c;else{var v=Bv(this.toList(),Fv(r,a),h);c=this._size+c,this._root=ms({head:v},0,c)}return this},o.prototype.isEmpty=function(){return this._root===null},Object.defineProperty(o.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),o.prototype.toString=function(r){r===void 0&&(r=function(l){return String(l.key)});var a=[];return ys(this._root,"",!0,function(l){return a.push(l)},r),a.join("")},o.prototype.update=function(r,a,l){var c=this._comparator,h=Tu(r,this._root,c),v=h.left,p=h.right;c(r,a)<0?p=gs(a,l,p,c):v=gs(a,l,v,c),this._root=Dv(v,p,c)},o.prototype.split=function(r){return Tu(r,this._root,this._comparator)},o.prototype[Symbol.iterator]=function(){var r,a,l;return Av(this,function(c){switch(c.label){case 0:r=this._root,a=[],l=!1,c.label=1;case 1:return l?[3,6]:r===null?[3,2]:(a.push(r),r=r.left,[3,5]);case 2:return a.length===0?[3,4]:(r=a.pop(),[4,r]);case 3:return c.sent(),r=r.right,[3,5];case 4:l=!0,c.label=5;case 5:return[3,1];case 6:return[2]}})},o}();function ps(o,r,a,l){var c=l-a;if(c>0){var h=a+Math.floor(c/2),v=o[h],p=r[h],_=new bt(v,p);return _.left=ps(o,r,a,h),_.right=ps(o,r,h+1,l),_}return null}function Fv(o,r){for(var a=new bt(null,null),l=a,c=0;c<o.length;c++)l=l.next=new bt(o[c],r[c]);return l.next=null,a.next}function $v(o){for(var r=o,a=[],l=!1,c=new bt(null,null),h=c;!l;)r?(a.push(r),r=r.left):a.length>0?(r=h=h.next=a.pop(),r=r.right):l=!0;return h.next=null,c.next}function ms(o,r,a){var l=a-r;if(l>0){var c=r+Math.floor(l/2),h=ms(o,r,c),v=o.head;return v.left=h,o.head=o.head.next,v.right=ms(o,c+1,a),v}return null}function Bv(o,r,a){for(var l=new bt(null,null),c=l,h=o,v=r;h!==null&&v!==null;)a(h.key,v.key)<0?(c.next=h,h=h.next):(c.next=v,v=v.next),c=c.next;return h!==null?c.next=h:v!==null&&(c.next=v),l.next}function ds(o,r,a,l,c){if(!(a>=l)){for(var h=o[a+l>>1],v=a-1,p=l+1;;){do v++;while(c(o[v],h)<0);do p--;while(c(o[p],h)>0);if(v>=p)break;var _=o[v];o[v]=o[p],o[p]=_,_=r[v],r[v]=r[p],r[p]=_}ds(o,r,a,p,c),ds(o,r,p+1,l,c)}}const mt=11102230246251565e-32,Le=134217729,Gv=(3+8*mt)*mt;function _s(o,r,a,l,c){let h,v,p,_,x=r[0],I=l[0],m=0,E=0;I>x==I>-x?(h=x,x=r[++m]):(h=I,I=l[++E]);let k=0;if(m<o&&E<a)for(I>x==I>-x?(v=x+h,p=h-(v-x),x=r[++m]):(v=I+h,p=h-(v-I),I=l[++E]),h=v,p!==0&&(c[k++]=p);m<o&&E<a;)I>x==I>-x?(v=h+x,_=v-h,p=h-(v-_)+(x-_),x=r[++m]):(v=h+I,_=v-h,p=h-(v-_)+(I-_),I=l[++E]),h=v,p!==0&&(c[k++]=p);for(;m<o;)v=h+x,_=v-h,p=h-(v-_)+(x-_),x=r[++m],h=v,p!==0&&(c[k++]=p);for(;E<a;)v=h+I,_=v-h,p=h-(v-_)+(I-_),I=l[++E],h=v,p!==0&&(c[k++]=p);return(h!==0||k===0)&&(c[k++]=h),k}function qv(o,r){let a=r[0];for(let l=1;l<o;l++)a+=r[l];return a}function Dn(o){return new Float64Array(o)}const zv=(3+16*mt)*mt,Yv=(2+12*mt)*mt,Uv=(9+64*mt)*mt*mt,ln=Dn(4),Lu=Dn(8),Ru=Dn(12),Cu=Dn(16),Ce=Dn(4);function Xv(o,r,a,l,c,h,v){let p,_,x,I,m,E,k,w,C,T,R,P,A,D,M,G,Y,U;const X=o-c,ie=a-c,ee=r-h,te=l-h;D=X*te,E=Le*X,k=E-(E-X),w=X-k,E=Le*te,C=E-(E-te),T=te-C,M=w*T-(D-k*C-w*C-k*T),G=ee*ie,E=Le*ee,k=E-(E-ee),w=ee-k,E=Le*ie,C=E-(E-ie),T=ie-C,Y=w*T-(G-k*C-w*C-k*T),R=M-Y,m=M-R,ln[0]=M-(R+m)+(m-Y),P=D+R,m=P-D,A=D-(P-m)+(R-m),R=A-G,m=A-R,ln[1]=A-(R+m)+(m-G),U=P+R,m=U-P,ln[2]=P-(U-m)+(R-m),ln[3]=U;let ae=qv(4,ln),q=Yv*v;if(ae>=q||-ae>=q||(m=o-X,p=o-(X+m)+(m-c),m=a-ie,x=a-(ie+m)+(m-c),m=r-ee,_=r-(ee+m)+(m-h),m=l-te,I=l-(te+m)+(m-h),p===0&&_===0&&x===0&&I===0)||(q=Uv*v+Gv*Math.abs(ae),ae+=X*I+te*p-(ee*x+ie*_),ae>=q||-ae>=q))return ae;D=p*te,E=Le*p,k=E-(E-p),w=p-k,E=Le*te,C=E-(E-te),T=te-C,M=w*T-(D-k*C-w*C-k*T),G=_*ie,E=Le*_,k=E-(E-_),w=_-k,E=Le*ie,C=E-(E-ie),T=ie-C,Y=w*T-(G-k*C-w*C-k*T),R=M-Y,m=M-R,Ce[0]=M-(R+m)+(m-Y),P=D+R,m=P-D,A=D-(P-m)+(R-m),R=A-G,m=A-R,Ce[1]=A-(R+m)+(m-G),U=P+R,m=U-P,Ce[2]=P-(U-m)+(R-m),Ce[3]=U;const ne=_s(4,ln,4,Ce,Lu);D=X*I,E=Le*X,k=E-(E-X),w=X-k,E=Le*I,C=E-(E-I),T=I-C,M=w*T-(D-k*C-w*C-k*T),G=ee*x,E=Le*ee,k=E-(E-ee),w=ee-k,E=Le*x,C=E-(E-x),T=x-C,Y=w*T-(G-k*C-w*C-k*T),R=M-Y,m=M-R,Ce[0]=M-(R+m)+(m-Y),P=D+R,m=P-D,A=D-(P-m)+(R-m),R=A-G,m=A-R,Ce[1]=A-(R+m)+(m-G),U=P+R,m=U-P,Ce[2]=P-(U-m)+(R-m),Ce[3]=U;const ue=_s(ne,Lu,4,Ce,Ru);D=p*I,E=Le*p,k=E-(E-p),w=p-k,E=Le*I,C=E-(E-I),T=I-C,M=w*T-(D-k*C-w*C-k*T),G=_*x,E=Le*_,k=E-(E-_),w=_-k,E=Le*x,C=E-(E-x),T=x-C,Y=w*T-(G-k*C-w*C-k*T),R=M-Y,m=M-R,Ce[0]=M-(R+m)+(m-Y),P=D+R,m=P-D,A=D-(P-m)+(R-m),R=A-G,m=A-R,Ce[1]=A-(R+m)+(m-G),U=P+R,m=U-P,Ce[2]=P-(U-m)+(R-m),Ce[3]=U;const ve=_s(ue,Ru,4,Ce,Cu);return Cu[ve-1]}function jv(o,r,a,l,c,h){const v=(r-h)*(a-c),p=(o-c)*(l-h),_=v-p,x=Math.abs(v+p);return Math.abs(_)>=zv*x?_:-Xv(o,r,a,l,c,h,x)}const Fn=(o,r)=>o.ll.x<=r.x&&r.x<=o.ur.x&&o.ll.y<=r.y&&r.y<=o.ur.y,xs=(o,r)=>{if(r.ur.x<o.ll.x||o.ur.x<r.ll.x||r.ur.y<o.ll.y||o.ur.y<r.ll.y)return null;const a=o.ll.x<r.ll.x?r.ll.x:o.ll.x,l=o.ur.x<r.ur.x?o.ur.x:r.ur.x,c=o.ll.y<r.ll.y?r.ll.y:o.ll.y,h=o.ur.y<r.ur.y?o.ur.y:r.ur.y;return{ll:{x:a,y:c},ur:{x:l,y:h}}};let Tt=Number.EPSILON;Tt===void 0&&(Tt=Math.pow(2,-52));const Vv=Tt*Tt,Pu=(o,r)=>{if(-Tt<o&&o<Tt&&-Tt<r&&r<Tt)return 0;const a=o-r;return a*a<Vv*o*r?0:o<r?-1:1};class Wv{constructor(){this.reset()}reset(){this.xRounder=new Au,this.yRounder=new Au}round(r,a){return{x:this.xRounder.round(r),y:this.yRounder.round(a)}}}class Au{constructor(){this.tree=new vs,this.round(0)}round(r){const a=this.tree.add(r),l=this.tree.prev(a);if(l!==null&&Pu(a.key,l.key)===0)return this.tree.remove(r),l.key;const c=this.tree.next(a);return c!==null&&Pu(a.key,c.key)===0?(this.tree.remove(r),c.key):r}}const $n=new Wv,Cr=(o,r)=>o.x*r.y-o.y*r.x,Mu=(o,r)=>o.x*r.x+o.y*r.y,Du=(o,r,a)=>{const l=jv(o.x,o.y,r.x,r.y,a.x,a.y);return l>0?-1:l<0?1:0},Pr=o=>Math.sqrt(Mu(o,o)),Hv=(o,r,a)=>{const l={x:r.x-o.x,y:r.y-o.y},c={x:a.x-o.x,y:a.y-o.y};return Cr(c,l)/Pr(c)/Pr(l)},Zv=(o,r,a)=>{const l={x:r.x-o.x,y:r.y-o.y},c={x:a.x-o.x,y:a.y-o.y};return Mu(c,l)/Pr(c)/Pr(l)},Fu=(o,r,a)=>r.y===0?null:{x:o.x+r.x/r.y*(a-o.y),y:a},$u=(o,r,a)=>r.x===0?null:{x:a,y:o.y+r.y/r.x*(a-o.x)},Jv=(o,r,a,l)=>{if(r.x===0)return $u(a,l,o.x);if(l.x===0)return $u(o,r,a.x);if(r.y===0)return Fu(a,l,o.y);if(l.y===0)return Fu(o,r,a.y);const c=Cr(r,l);if(c==0)return null;const h={x:a.x-o.x,y:a.y-o.y},v=Cr(h,r)/c,p=Cr(h,l)/c,_=o.x+p*r.x,x=a.x+v*l.x,I=o.y+p*r.y,m=a.y+v*l.y,E=(_+x)/2,k=(I+m)/2;return{x:E,y:k}};class Ue{static compare(r,a){const l=Ue.comparePoints(r.point,a.point);return l!==0?l:(r.point!==a.point&&r.link(a),r.isLeft!==a.isLeft?r.isLeft?1:-1:Lt.compare(r.segment,a.segment))}static comparePoints(r,a){return r.x<a.x?-1:r.x>a.x?1:r.y<a.y?-1:r.y>a.y?1:0}constructor(r,a){r.events===void 0?r.events=[this]:r.events.push(this),this.point=r,this.isLeft=a}link(r){if(r.point===this.point)throw new Error("Tried to link already linked events");const a=r.point.events;for(let l=0,c=a.length;l<c;l++){const h=a[l];this.point.events.push(h),h.point=this.point}this.checkForConsuming()}checkForConsuming(){const r=this.point.events.length;for(let a=0;a<r;a++){const l=this.point.events[a];if(l.segment.consumedBy===void 0)for(let c=a+1;c<r;c++){const h=this.point.events[c];h.consumedBy===void 0&&l.otherSE.point.events===h.otherSE.point.events&&l.segment.consume(h.segment)}}}getAvailableLinkedEvents(){const r=[];for(let a=0,l=this.point.events.length;a<l;a++){const c=this.point.events[a];c!==this&&!c.segment.ringOut&&c.segment.isInResult()&&r.push(c)}return r}getLeftmostComparator(r){const a=new Map,l=c=>{const h=c.otherSE;a.set(c,{sine:Hv(this.point,r.point,h.point),cosine:Zv(this.point,r.point,h.point)})};return(c,h)=>{a.has(c)||l(c),a.has(h)||l(h);const{sine:v,cosine:p}=a.get(c),{sine:_,cosine:x}=a.get(h);return v>=0&&_>=0?p<x?1:p>x?-1:0:v<0&&_<0?p<x?-1:p>x?1:0:_<v?-1:_>v?1:0}}}let Qv=0;class Lt{static compare(r,a){const l=r.leftSE.point.x,c=a.leftSE.point.x,h=r.rightSE.point.x,v=a.rightSE.point.x;if(v<l)return 1;if(h<c)return-1;const p=r.leftSE.point.y,_=a.leftSE.point.y,x=r.rightSE.point.y,I=a.rightSE.point.y;if(l<c){if(_<p&&_<x)return 1;if(_>p&&_>x)return-1;const m=r.comparePoint(a.leftSE.point);if(m<0)return 1;if(m>0)return-1;const E=a.comparePoint(r.rightSE.point);return E!==0?E:-1}if(l>c){if(p<_&&p<I)return-1;if(p>_&&p>I)return 1;const m=a.comparePoint(r.leftSE.point);if(m!==0)return m;const E=r.comparePoint(a.rightSE.point);return E<0?1:E>0?-1:1}if(p<_)return-1;if(p>_)return 1;if(h<v){const m=a.comparePoint(r.rightSE.point);if(m!==0)return m}if(h>v){const m=r.comparePoint(a.rightSE.point);if(m<0)return 1;if(m>0)return-1}if(h!==v){const m=x-p,E=h-l,k=I-_,w=v-c;if(m>E&&k<w)return 1;if(m<E&&k>w)return-1}return h>v?1:h<v||x<I?-1:x>I?1:r.id<a.id?-1:r.id>a.id?1:0}constructor(r,a,l,c){this.id=++Qv,this.leftSE=r,r.segment=this,r.otherSE=a,this.rightSE=a,a.segment=this,a.otherSE=r,this.rings=l,this.windings=c}static fromRing(r,a,l){let c,h,v;const p=Ue.comparePoints(r,a);if(p<0)c=r,h=a,v=1;else if(p>0)c=a,h=r,v=-1;else throw new Error(`Tried to create degenerate segment at [${r.x}, ${r.y}]`);const _=new Ue(c,!0),x=new Ue(h,!1);return new Lt(_,x,[l],[v])}replaceRightSE(r){this.rightSE=r,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}bbox(){const r=this.leftSE.point.y,a=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:r<a?r:a},ur:{x:this.rightSE.point.x,y:r>a?r:a}}}vector(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}isAnEndpoint(r){return r.x===this.leftSE.point.x&&r.y===this.leftSE.point.y||r.x===this.rightSE.point.x&&r.y===this.rightSE.point.y}comparePoint(r){if(this.isAnEndpoint(r))return 0;const a=this.leftSE.point,l=this.rightSE.point,c=this.vector();if(a.x===l.x)return r.x===a.x?0:r.x<a.x?1:-1;const h=(r.y-a.y)/c.y,v=a.x+h*c.x;if(r.x===v)return 0;const p=(r.x-a.x)/c.x,_=a.y+p*c.y;return r.y===_?0:r.y<_?-1:1}getIntersection(r){const a=this.bbox(),l=r.bbox(),c=xs(a,l);if(c===null)return null;const h=this.leftSE.point,v=this.rightSE.point,p=r.leftSE.point,_=r.rightSE.point,x=Fn(a,p)&&this.comparePoint(p)===0,I=Fn(l,h)&&r.comparePoint(h)===0,m=Fn(a,_)&&this.comparePoint(_)===0,E=Fn(l,v)&&r.comparePoint(v)===0;if(I&&x)return E&&!m?v:!E&&m?_:null;if(I)return m&&h.x===_.x&&h.y===_.y?null:h;if(x)return E&&v.x===p.x&&v.y===p.y?null:p;if(E&&m)return null;if(E)return v;if(m)return _;const k=Jv(h,this.vector(),p,r.vector());return k===null||!Fn(c,k)?null:$n.round(k.x,k.y)}split(r){const a=[],l=r.events!==void 0,c=new Ue(r,!0),h=new Ue(r,!1),v=this.rightSE;this.replaceRightSE(h),a.push(h),a.push(c);const p=new Lt(c,v,this.rings.slice(),this.windings.slice());return Ue.comparePoints(p.leftSE.point,p.rightSE.point)>0&&p.swapEvents(),Ue.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),l&&(c.checkForConsuming(),h.checkForConsuming()),a}swapEvents(){const r=this.rightSE;this.rightSE=this.leftSE,this.leftSE=r,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(let a=0,l=this.windings.length;a<l;a++)this.windings[a]*=-1}consume(r){let a=this,l=r;for(;a.consumedBy;)a=a.consumedBy;for(;l.consumedBy;)l=l.consumedBy;const c=Lt.compare(a,l);if(c!==0){if(c>0){const h=a;a=l,l=h}if(a.prev===l){const h=a;a=l,l=h}for(let h=0,v=l.rings.length;h<v;h++){const p=l.rings[h],_=l.windings[h],x=a.rings.indexOf(p);x===-1?(a.rings.push(p),a.windings.push(_)):a.windings[x]+=_}l.rings=null,l.windings=null,l.consumedBy=a,l.leftSE.consumedBy=a.leftSE,l.rightSE.consumedBy=a.rightSE}}prevInResult(){return this._prevInResult!==void 0?this._prevInResult:(this.prev?this.prev.isInResult()?this._prevInResult=this.prev:this._prevInResult=this.prev.prevInResult():this._prevInResult=null,this._prevInResult)}beforeState(){if(this._beforeState!==void 0)return this._beforeState;if(!this.prev)this._beforeState={rings:[],windings:[],multiPolys:[]};else{const r=this.prev.consumedBy||this.prev;this._beforeState=r.afterState()}return this._beforeState}afterState(){if(this._afterState!==void 0)return this._afterState;const r=this.beforeState();this._afterState={rings:r.rings.slice(0),windings:r.windings.slice(0),multiPolys:[]};const a=this._afterState.rings,l=this._afterState.windings,c=this._afterState.multiPolys;for(let p=0,_=this.rings.length;p<_;p++){const x=this.rings[p],I=this.windings[p],m=a.indexOf(x);m===-1?(a.push(x),l.push(I)):l[m]+=I}const h=[],v=[];for(let p=0,_=a.length;p<_;p++){if(l[p]===0)continue;const x=a[p],I=x.poly;if(v.indexOf(I)===-1)if(x.isExterior)h.push(I);else{v.indexOf(I)===-1&&v.push(I);const m=h.indexOf(x.poly);m!==-1&&h.splice(m,1)}}for(let p=0,_=h.length;p<_;p++){const x=h[p].multiPoly;c.indexOf(x)===-1&&c.push(x)}return this._afterState}isInResult(){if(this.consumedBy)return!1;if(this._isInResult!==void 0)return this._isInResult;const r=this.beforeState().multiPolys,a=this.afterState().multiPolys;switch(et.type){case"union":{const l=r.length===0,c=a.length===0;this._isInResult=l!==c;break}case"intersection":{let l,c;r.length<a.length?(l=r.length,c=a.length):(l=a.length,c=r.length),this._isInResult=c===et.numMultiPolys&&l<c;break}case"xor":{const l=Math.abs(r.length-a.length);this._isInResult=l%2===1;break}case"difference":{const l=c=>c.length===1&&c[0].isSubject;this._isInResult=l(r)!==l(a);break}default:throw new Error(`Unrecognized operation type found ${et.type}`)}return this._isInResult}}class Bu{constructor(r,a,l){if(!Array.isArray(r)||r.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=a,this.isExterior=l,this.segments=[],typeof r[0][0]!="number"||typeof r[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");const c=$n.round(r[0][0],r[0][1]);this.bbox={ll:{x:c.x,y:c.y},ur:{x:c.x,y:c.y}};let h=c;for(let v=1,p=r.length;v<p;v++){if(typeof r[v][0]!="number"||typeof r[v][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");let _=$n.round(r[v][0],r[v][1]);_.x===h.x&&_.y===h.y||(this.segments.push(Lt.fromRing(h,_,this)),_.x<this.bbox.ll.x&&(this.bbox.ll.x=_.x),_.y<this.bbox.ll.y&&(this.bbox.ll.y=_.y),_.x>this.bbox.ur.x&&(this.bbox.ur.x=_.x),_.y>this.bbox.ur.y&&(this.bbox.ur.y=_.y),h=_)}(c.x!==h.x||c.y!==h.y)&&this.segments.push(Lt.fromRing(h,c,this))}getSweepEvents(){const r=[];for(let a=0,l=this.segments.length;a<l;a++){const c=this.segments[a];r.push(c.leftSE),r.push(c.rightSE)}return r}}class Kv{constructor(r,a){if(!Array.isArray(r))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new Bu(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(let l=1,c=r.length;l<c;l++){const h=new Bu(r[l],this,!1);h.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=h.bbox.ll.x),h.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=h.bbox.ll.y),h.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=h.bbox.ur.x),h.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=h.bbox.ur.y),this.interiorRings.push(h)}this.multiPoly=a}getSweepEvents(){const r=this.exteriorRing.getSweepEvents();for(let a=0,l=this.interiorRings.length;a<l;a++){const c=this.interiorRings[a].getSweepEvents();for(let h=0,v=c.length;h<v;h++)r.push(c[h])}return r}}class Gu{constructor(r,a){if(!Array.isArray(r))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{typeof r[0][0][0]=="number"&&(r=[r])}catch{}this.polys=[],this.bbox={ll:{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY},ur:{x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY}};for(let l=0,c=r.length;l<c;l++){const h=new Kv(r[l],this);h.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=h.bbox.ll.x),h.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=h.bbox.ll.y),h.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=h.bbox.ur.x),h.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=h.bbox.ur.y),this.polys.push(h)}this.isSubject=a}getSweepEvents(){const r=[];for(let a=0,l=this.polys.length;a<l;a++){const c=this.polys[a].getSweepEvents();for(let h=0,v=c.length;h<v;h++)r.push(c[h])}return r}}class Ar{static factory(r){const a=[];for(let l=0,c=r.length;l<c;l++){const h=r[l];if(!h.isInResult()||h.ringOut)continue;let v=null,p=h.leftSE,_=h.rightSE;const x=[p],I=p.point,m=[];for(;v=p,p=_,x.push(p),p.point!==I;)for(;;){const E=p.getAvailableLinkedEvents();if(E.length===0){const C=x[0].point,T=x[x.length-1].point;throw new Error(`Unable to complete output ring starting at [${C.x}, ${C.y}]. Last matching segment found ends at [${T.x}, ${T.y}].`)}if(E.length===1){_=E[0].otherSE;break}let k=null;for(let C=0,T=m.length;C<T;C++)if(m[C].point===p.point){k=C;break}if(k!==null){const C=m.splice(k)[0],T=x.splice(C.index);T.unshift(T[0].otherSE),a.push(new Ar(T.reverse()));continue}m.push({index:x.length,point:p.point});const w=p.getLeftmostComparator(v);_=E.sort(w)[0].otherSE;break}a.push(new Ar(x))}return a}constructor(r){this.events=r;for(let a=0,l=r.length;a<l;a++)r[a].segment.ringOut=this;this.poly=null}getGeom(){let r=this.events[0].point;const a=[r];for(let x=1,I=this.events.length-1;x<I;x++){const m=this.events[x].point,E=this.events[x+1].point;Du(m,r,E)!==0&&(a.push(m),r=m)}if(a.length===1)return null;const l=a[0],c=a[1];Du(l,r,c)===0&&a.shift(),a.push(a[0]);const h=this.isExteriorRing()?1:-1,v=this.isExteriorRing()?0:a.length-1,p=this.isExteriorRing()?a.length:-1,_=[];for(let x=v;x!=p;x+=h)_.push([a[x].x,a[x].y]);return _}isExteriorRing(){if(this._isExteriorRing===void 0){const r=this.enclosingRing();this._isExteriorRing=r?!r.isExteriorRing():!0}return this._isExteriorRing}enclosingRing(){return this._enclosingRing===void 0&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}_calcEnclosingRing(){let r=this.events[0];for(let c=1,h=this.events.length;c<h;c++){const v=this.events[c];Ue.compare(r,v)>0&&(r=v)}let a=r.segment.prevInResult(),l=a?a.prevInResult():null;for(;;){if(!a)return null;if(!l)return a.ringOut;if(l.ringOut!==a.ringOut)return l.ringOut.enclosingRing()!==a.ringOut?a.ringOut:a.ringOut.enclosingRing();a=l.prevInResult(),l=a?a.prevInResult():null}}}class qu{constructor(r){this.exteriorRing=r,r.poly=this,this.interiorRings=[]}addInterior(r){this.interiorRings.push(r),r.poly=this}getGeom(){const r=[this.exteriorRing.getGeom()];if(r[0]===null)return null;for(let a=0,l=this.interiorRings.length;a<l;a++){const c=this.interiorRings[a].getGeom();c!==null&&r.push(c)}return r}}class ep{constructor(r){this.rings=r,this.polys=this._composePolys(r)}getGeom(){const r=[];for(let a=0,l=this.polys.length;a<l;a++){const c=this.polys[a].getGeom();c!==null&&r.push(c)}return r}_composePolys(r){const a=[];for(let l=0,c=r.length;l<c;l++){const h=r[l];if(!h.poly)if(h.isExteriorRing())a.push(new qu(h));else{const v=h.enclosingRing();v.poly||a.push(new qu(v)),v.poly.addInterior(h)}}return a}}class tp{constructor(r){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Lt.compare;this.queue=r,this.tree=new vs(a),this.segments=[]}process(r){const a=r.segment,l=[];if(r.consumedBy)return r.isLeft?this.queue.remove(r.otherSE):this.tree.remove(a),l;const c=r.isLeft?this.tree.add(a):this.tree.find(a);if(!c)throw new Error(`Unable to find segment #${a.id} [${a.leftSE.point.x}, ${a.leftSE.point.y}] -> [${a.rightSE.point.x}, ${a.rightSE.point.y}] in SweepLine tree.`);let h=c,v=c,p,_;for(;p===void 0;)h=this.tree.prev(h),h===null?p=null:h.key.consumedBy===void 0&&(p=h.key);for(;_===void 0;)v=this.tree.next(v),v===null?_=null:v.key.consumedBy===void 0&&(_=v.key);if(r.isLeft){let x=null;if(p){const m=p.getIntersection(a);if(m!==null&&(a.isAnEndpoint(m)||(x=m),!p.isAnEndpoint(m))){const E=this._splitSafely(p,m);for(let k=0,w=E.length;k<w;k++)l.push(E[k])}}let I=null;if(_){const m=_.getIntersection(a);if(m!==null&&(a.isAnEndpoint(m)||(I=m),!_.isAnEndpoint(m))){const E=this._splitSafely(_,m);for(let k=0,w=E.length;k<w;k++)l.push(E[k])}}if(x!==null||I!==null){let m=null;x===null?m=I:I===null?m=x:m=Ue.comparePoints(x,I)<=0?x:I,this.queue.remove(a.rightSE),l.push(a.rightSE);const E=a.split(m);for(let k=0,w=E.length;k<w;k++)l.push(E[k])}l.length>0?(this.tree.remove(a),l.push(r)):(this.segments.push(a),a.prev=p)}else{if(p&&_){const x=p.getIntersection(_);if(x!==null){if(!p.isAnEndpoint(x)){const I=this._splitSafely(p,x);for(let m=0,E=I.length;m<E;m++)l.push(I[m])}if(!_.isAnEndpoint(x)){const I=this._splitSafely(_,x);for(let m=0,E=I.length;m<E;m++)l.push(I[m])}}}this.tree.remove(a)}return l}_splitSafely(r,a){this.tree.remove(r);const l=r.rightSE;this.queue.remove(l);const c=r.split(a);return c.push(l),r.consumedBy===void 0&&this.tree.add(r),c}}const zu=typeof process<"u"&&process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,np=typeof process<"u"&&process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6;class rp{run(r,a,l){et.type=r,$n.reset();const c=[new Gu(a,!0)];for(let m=0,E=l.length;m<E;m++)c.push(new Gu(l[m],!1));if(et.numMultiPolys=c.length,et.type==="difference"){const m=c[0];let E=1;for(;E<c.length;)xs(c[E].bbox,m.bbox)!==null?E++:c.splice(E,1)}if(et.type==="intersection")for(let m=0,E=c.length;m<E;m++){const k=c[m];for(let w=m+1,C=c.length;w<C;w++)if(xs(k.bbox,c[w].bbox)===null)return[]}const h=new vs(Ue.compare);for(let m=0,E=c.length;m<E;m++){const k=c[m].getSweepEvents();for(let w=0,C=k.length;w<C;w++)if(h.insert(k[w]),h.size>zu)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big).")}const v=new tp(h);let p=h.size,_=h.pop();for(;_;){const m=_.key;if(h.size===p){const k=m.segment;throw new Error(`Unable to pop() ${m.isLeft?"left":"right"} SweepEvent [${m.point.x}, ${m.point.y}] from segment #${k.id} [${k.leftSE.point.x}, ${k.leftSE.point.y}] -> [${k.rightSE.point.x}, ${k.rightSE.point.y}] from queue.`)}if(h.size>zu)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big).");if(v.segments.length>np)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments).");const E=v.process(m);for(let k=0,w=E.length;k<w;k++){const C=E[k];C.consumedBy===void 0&&h.insert(C)}p=h.size,_=h.pop()}$n.reset();const x=Ar.factory(v.segments);return new ep(x).getGeom()}}const et=new rp;var Yu={union:function(o){for(var r=arguments.length,a=new Array(r>1?r-1:0),l=1;l<r;l++)a[l-1]=arguments[l];return et.run("union",o,a)},intersection:function(o){for(var r=arguments.length,a=new Array(r>1?r-1:0),l=1;l<r;l++)a[l-1]=arguments[l];return et.run("intersection",o,a)},xor:function(o){for(var r=arguments.length,a=new Array(r>1?r-1:0),l=1;l<r;l++)a[l-1]=arguments[l];return et.run("xor",o,a)},difference:function(o){for(var r=arguments.length,a=new Array(r>1?r-1:0),l=1;l<r;l++)a[l-1]=arguments[l];return et.run("difference",o,a)}},ip=Object.defineProperty,Oe=(o,r)=>ip(o,"name",{value:r,configurable:!0});function cn(o,r,a){if(o!==null)for(var l,c,h,v,p,_,x,I=0,m=0,E,k=o.type,w=k==="FeatureCollection",C=k==="Feature",T=w?o.features.length:1,R=0;R<T;R++){x=w?o.features[R].geometry:C?o.geometry:o,E=x?x.type==="GeometryCollection":!1,p=E?x.geometries.length:1;for(var P=0;P<p;P++){var A=0,D=0;if(v=E?x.geometries[P]:x,v!==null){_=v.coordinates;var M=v.type;switch(I=a&&(M==="Polygon"||M==="MultiPolygon")?1:0,M){case null:break;case"Point":if(r(_,m,R,A,D)===!1)return!1;m++,A++;break;case"LineString":case"MultiPoint":for(l=0;l<_.length;l++){if(r(_[l],m,R,A,D)===!1)return!1;m++,M==="MultiPoint"&&A++}M==="LineString"&&A++;break;case"Polygon":case"MultiLineString":for(l=0;l<_.length;l++){for(c=0;c<_[l].length-I;c++){if(r(_[l][c],m,R,A,D)===!1)return!1;m++}M==="MultiLineString"&&A++,M==="Polygon"&&D++}M==="Polygon"&&A++;break;case"MultiPolygon":for(l=0;l<_.length;l++){for(D=0,c=0;c<_[l].length;c++){for(h=0;h<_[l][c].length-I;h++){if(r(_[l][c][h],m,R,A,D)===!1)return!1;m++}D++}A++}break;case"GeometryCollection":for(l=0;l<v.geometries.length;l++)if(cn(v.geometries[l],r,a)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}Oe(cn,"coordEach");function sp(o,r,a,l){var c=a;return cn(o,function(h,v,p,_,x){v===0&&a===void 0?c=h:c=r(c,h,v,p,_,x)},l),c}Oe(sp,"coordReduce");function Uu(o,r){var a;switch(o.type){case"FeatureCollection":for(a=0;a<o.features.length&&r(o.features[a].properties,a)!==!1;a++);break;case"Feature":r(o.properties,0);break}}Oe(Uu,"propEach");function ap(o,r,a){var l=a;return Uu(o,function(c,h){h===0&&a===void 0?l=c:l=r(l,c,h)}),l}Oe(ap,"propReduce");function Mr(o,r){if(o.type==="Feature")r(o,0);else if(o.type==="FeatureCollection")for(var a=0;a<o.features.length&&r(o.features[a],a)!==!1;a++);}Oe(Mr,"featureEach");function op(o,r,a){var l=a;return Mr(o,function(c,h){h===0&&a===void 0?l=c:l=r(l,c,h)}),l}Oe(op,"featureReduce");function up(o){var r=[];return cn(o,function(a){r.push(a)}),r}Oe(up,"coordAll");function qt(o,r){var a,l,c,h,v,p,_,x,I,m,E=0,k=o.type==="FeatureCollection",w=o.type==="Feature",C=k?o.features.length:1;for(a=0;a<C;a++){for(p=k?o.features[a].geometry:w?o.geometry:o,x=k?o.features[a].properties:w?o.properties:{},I=k?o.features[a].bbox:w?o.bbox:void 0,m=k?o.features[a].id:w?o.id:void 0,_=p?p.type==="GeometryCollection":!1,v=_?p.geometries.length:1,c=0;c<v;c++){if(h=_?p.geometries[c]:p,h===null){if(r(null,E,x,I,m)===!1)return!1;continue}switch(h.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(r(h,E,x,I,m)===!1)return!1;break}case"GeometryCollection":{for(l=0;l<h.geometries.length;l++)if(r(h.geometries[l],E,x,I,m)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}E++}}Oe(qt,"geomEach");function lp(o,r,a){var l=a;return qt(o,function(c,h,v,p,_){h===0&&a===void 0?l=c:l=r(l,c,h,v,p,_)}),l}Oe(lp,"geomReduce");function Dr(o,r){qt(o,function(a,l,c,h,v){var p=a===null?null:a.type;switch(p){case null:case"Point":case"LineString":case"Polygon":return r(Ye(a,c,{bbox:h,id:v}),l,0)===!1?!1:void 0}var _;switch(p){case"MultiPoint":_="Point";break;case"MultiLineString":_="LineString";break;case"MultiPolygon":_="Polygon";break}for(var x=0;x<a.coordinates.length;x++){var I=a.coordinates[x],m={type:_,coordinates:I};if(r(Ye(m,c),l,x)===!1)return!1}})}Oe(Dr,"flattenEach");function cp(o,r,a){var l=a;return Dr(o,function(c,h,v){h===0&&v===0&&a===void 0?l=c:l=r(l,c,h,v)}),l}Oe(cp,"flattenReduce");function Xu(o,r){Dr(o,function(a,l,c){var h=0;if(a.geometry){var v=a.geometry.type;if(!(v==="Point"||v==="MultiPoint")){var p,_=0,x=0,I=0;if(cn(a,function(m,E,k,w,C){if(p===void 0||l>_||w>x||C>I){p=m,_=l,x=w,I=C,h=0;return}var T=pt([p,m],a.properties);if(r(T,l,c,C,h)===!1)return!1;h++,p=m})===!1)return!1}}})}Oe(Xu,"segmentEach");function fp(o,r,a){var l=a,c=!1;return Xu(o,function(h,v,p,_,x){c===!1&&a===void 0?l=h:l=r(l,h,v,p,_,x),c=!0}),l}Oe(fp,"segmentReduce");function ju(o,r){if(!o)throw new Error("geojson is required");Dr(o,function(a,l,c){if(a.geometry!==null){var h=a.geometry.type,v=a.geometry.coordinates;switch(h){case"LineString":if(r(a,l,c,0,0)===!1)return!1;break;case"Polygon":for(var p=0;p<v.length;p++)if(r(pt(v[p],a.properties),l,c,p)===!1)return!1;break}}})}Oe(ju,"lineEach");function hp(o,r,a){var l=a;return ju(o,function(c,h,v,p){h===0&&a===void 0?l=c:l=r(l,c,h,v,p)}),l}Oe(hp,"lineReduce");function gp(o,r){if(r=r||{},!hs(r))throw new Error("options is invalid");var a=r.featureIndex||0,l=r.multiFeatureIndex||0,c=r.geometryIndex||0,h=r.segmentIndex||0,v=r.properties,p;switch(o.type){case"FeatureCollection":a<0&&(a=o.features.length+a),v=v||o.features[a].properties,p=o.features[a].geometry;break;case"Feature":v=v||o.properties,p=o.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":p=o;break;default:throw new Error("geojson is invalid")}if(p===null)return null;var _=p.coordinates;switch(p.type){case"Point":case"MultiPoint":return null;case"LineString":return h<0&&(h=_.length+h-1),pt([_[h],_[h+1]],v,r);case"Polygon":return c<0&&(c=_.length+c),h<0&&(h=_[c].length+h-1),pt([_[c][h],_[c][h+1]],v,r);case"MultiLineString":return l<0&&(l=_.length+l),h<0&&(h=_[l].length+h-1),pt([_[l][h],_[l][h+1]],v,r);case"MultiPolygon":return l<0&&(l=_.length+l),c<0&&(c=_[l].length+c),h<0&&(h=_[l][c].length-h-1),pt([_[l][c][h],_[l][c][h+1]],v,r)}throw new Error("geojson is invalid")}Oe(gp,"findSegment");function yp(o,r){if(r=r||{},!hs(r))throw new Error("options is invalid");var a=r.featureIndex||0,l=r.multiFeatureIndex||0,c=r.geometryIndex||0,h=r.coordIndex||0,v=r.properties,p;switch(o.type){case"FeatureCollection":a<0&&(a=o.features.length+a),v=v||o.features[a].properties,p=o.features[a].geometry;break;case"Feature":v=v||o.properties,p=o.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":p=o;break;default:throw new Error("geojson is invalid")}if(p===null)return null;var _=p.coordinates;switch(p.type){case"Point":return ot(_,v,r);case"MultiPoint":return l<0&&(l=_.length+l),ot(_[l],v,r);case"LineString":return h<0&&(h=_.length+h),ot(_[h],v,r);case"Polygon":return c<0&&(c=_.length+c),h<0&&(h=_[c].length+h),ot(_[c][h],v,r);case"MultiLineString":return l<0&&(l=_.length+l),h<0&&(h=_[l].length+h),ot(_[l][h],v,r);case"MultiPolygon":return l<0&&(l=_.length+l),c<0&&(c=_[l].length+c),h<0&&(h=_[l][c].length-h),ot(_[l][c][h],v,r)}throw new Error("geojson is invalid")}Oe(yp,"findPoint");var vp=Object.defineProperty,pp=(o,r)=>vp(o,"name",{value:r,configurable:!0});function Vu(o,r={}){const a=[];if(qt(o,c=>{a.push(c.coordinates)}),a.length<2)throw new Error("Must have at least 2 geometries");const l=Yu.union(a[0],...a.slice(1));return l.length===0?null:l.length===1?un(l[0],r.properties):Tr(l,r.properties)}pp(Vu,"union");var mp=Vu;function Bn(){}function Wu(o){return o()}function Hu(){return Object.create(null)}function Fr(o){o.forEach(Wu)}function Zu(o){return typeof o=="function"}function dp(o,r){return o!=o?r==r:o!==r||o&&typeof o=="object"||typeof o=="function"}function _p(o){return Object.keys(o).length===0}function xp(o,r){o.appendChild(r)}function Ep(o,r,a){o.insertBefore(r,a||null)}function Ju(o){o.parentNode&&o.parentNode.removeChild(o)}function Qu(o){return document.createElementNS("http://www.w3.org/2000/svg",o)}function Rt(o,r,a){a==null?o.removeAttribute(r):o.getAttribute(r)!==a&&o.setAttribute(r,a)}function kp(o){return Array.from(o.childNodes)}function $r(o,r,a){o.classList.toggle(r,!!a)}let Es;function Gn(o){Es=o}const fn=[],Ku=[];let hn=[];const el=[],Ip=Promise.resolve();let ks=!1;function Sp(){ks||(ks=!0,Ip.then(tl))}function Is(o){hn.push(o)}const Ss=new Set;let gn=0;function tl(){if(gn!==0)return;const o=Es;do{try{for(;gn<fn.length;){const r=fn[gn];gn++,Gn(r),Np(r.$$)}}catch(r){throw fn.length=0,gn=0,r}for(Gn(null),fn.length=0,gn=0;Ku.length;)Ku.pop()();for(let r=0;r<hn.length;r+=1){const a=hn[r];Ss.has(a)||(Ss.add(a),a())}hn.length=0}while(fn.length);for(;el.length;)el.pop()();ks=!1,Ss.clear(),Gn(o)}function Np(o){if(o.fragment!==null){o.update(),Fr(o.before_update);const r=o.dirty;o.dirty=[-1],o.fragment&&o.fragment.p(o.ctx,r),o.after_update.forEach(Is)}}function wp(o){const r=[],a=[];hn.forEach(l=>o.indexOf(l)===-1?r.push(l):a.push(l)),a.forEach(l=>l()),hn=r}const bp=new Set;function Op(o,r){o&&o.i&&(bp.delete(o),o.i(r))}function Tp(o,r,a){const{fragment:l,after_update:c}=o.$$;l&&l.m(r,a),Is(()=>{const h=o.$$.on_mount.map(Wu).filter(Zu);o.$$.on_destroy?o.$$.on_destroy.push(...h):Fr(h),o.$$.on_mount=[]}),c.forEach(Is)}function Lp(o,r){const a=o.$$;a.fragment!==null&&(wp(a.after_update),Fr(a.on_destroy),a.fragment&&a.fragment.d(r),a.on_destroy=a.fragment=null,a.ctx=[])}function Rp(o,r){o.$$.dirty[0]===-1&&(fn.push(o),Sp(),o.$$.dirty.fill(0)),o.$$.dirty[r/31|0]|=1<<r%31}function Cp(o,r,a,l,c,h,v=null,p=[-1]){const _=Es;Gn(o);const x=o.$$={fragment:null,ctx:[],props:h,update:Bn,not_equal:c,bound:Hu(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(r.context||(_?_.$$.context:[])),callbacks:Hu(),dirty:p,skip_bound:!1,root:r.target||_.$$.root};v&&v(x.root);let I=!1;if(x.ctx=a?a(o,r.props||{},(m,E,...k)=>{const w=k.length?k[0]:E;return x.ctx&&c(x.ctx[m],x.ctx[m]=w)&&(!x.skip_bound&&x.bound[m]&&x.bound[m](w),I&&Rp(o,m)),E}):[],x.update(),I=!0,Fr(x.before_update),x.fragment=l?l(x.ctx):!1,r.target){if(r.hydrate){const m=kp(r.target);x.fragment&&x.fragment.l(m),m.forEach(Ju)}else x.fragment&&x.fragment.c();r.intro&&Op(o.$$.fragment),Tp(o,r.target,r.anchor),tl()}Gn(_)}class Pp{constructor(){na(this,"$$");na(this,"$$set")}$destroy(){Lp(this,1),this.$destroy=Bn}$on(r,a){if(!Zu(a))return Bn;const l=this.$$.callbacks[r]||(this.$$.callbacks[r]=[]);return l.push(a),()=>{const c=l.indexOf(a);c!==-1&&l.splice(c,1)}}$set(r){this.$$set&&!_p(r)&&(this.$$.skip_bound=!0,this.$$set(r),this.$$.skip_bound=!1)}}const Ap="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Ap);function Mp(o){let r,a,l;return{c(){r=Qu("svg"),a=Qu("path"),Rt(a,"stroke-width","4"),Rt(a,"d","M 5,33.103579 C 5,17.607779 18.457,5 35,5 C 51.543,5 65,17.607779 65,33.103579 C 65,56.388679 40.4668,76.048179 36.6112,79.137779 C 36.3714,79.329879 36.2116,79.457979 36.1427,79.518879 C 35.8203,79.800879 35.4102,79.942779 35,79.942779 C 34.5899,79.942779 34.1797,79.800879 33.8575,79.518879 C 33.7886,79.457979 33.6289,79.330079 33.3893,79.138079 C 29.5346,76.049279 5,56.389379 5,33.103579 Z M 35.0001,49.386379 C 43.1917,49.386379 49.8323,42.646079 49.8323,34.331379 C 49.8323,26.016779 43.1917,19.276479 35.0001,19.276479 C 26.8085,19.276479 20.1679,26.016779 20.1679,34.331379 C 20.1679,42.646079 26.8085,49.386379 35.0001,49.386379 Z"),Rt(a,"class","svelte-gzo3ar"),Rt(r,"width",l=o[0]==="list"?20:void 0),Rt(r,"viewBox","0 0 70 85"),Rt(r,"fill","none"),Rt(r,"class","svelte-gzo3ar"),$r(r,"in-map",o[0]!=="list"),$r(r,"list-icon",o[0]==="list")},m(c,h){Ep(c,r,h),xp(r,a)},p(c,[h]){h&1&&l!==(l=c[0]==="list"?20:void 0)&&Rt(r,"width",l),h&1&&$r(r,"in-map",c[0]!=="list"),h&1&&$r(r,"list-icon",c[0]==="list")},i:Bn,o:Bn,d(c){c&&Ju(r)}}}function Dp(o,r,a){let{displayIn:l}=r;return o.$$set=c=>{"displayIn"in c&&a(0,l=c.displayIn)},[l]}class Fp extends Pp{constructor(r){super(),Cp(this,r,Dp,Mp,dp,{displayIn:0})}}var $p=Object.defineProperty,Bp=(o,r)=>$p(o,"name",{value:r,configurable:!0});function nl(o,r={}){if(o.bbox!=null&&r.recompute!==!0)return o.bbox;const a=[1/0,1/0,-1/0,-1/0];return cn(o,l=>{a[0]>l[0]&&(a[0]=l[0]),a[1]>l[1]&&(a[1]=l[1]),a[2]<l[0]&&(a[2]=l[0]),a[3]<l[1]&&(a[3]=l[1])}),a}Bp(nl,"bbox");var Gp=Object.defineProperty,qp=(o,r)=>Gp(o,"name",{value:r,configurable:!0});function rl(o,r={}){const a=nl(o),l=(a[0]+a[2])/2,c=(a[1]+a[3])/2;return ot([l,c],r.properties,r)}qp(rl,"center");var il={exports:{}};(function(o,r){(function(a,l){o.exports=l()})(be,function(){function a(s,e){if(!(s instanceof e))throw new TypeError("Cannot call a class as a function")}function l(s,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(s,n.key,n)}}function c(s,e,t){return e&&l(s.prototype,e),t&&l(s,t),s}function h(s,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");s.prototype=Object.create(e&&e.prototype,{constructor:{value:s,writable:!0,configurable:!0}}),e&&p(s,e)}function v(s){return v=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},v(s)}function p(s,e){return p=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t},p(s,e)}function _(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function x(s,e,t){return x=_()?Reflect.construct:function(n,i,u){var f=[null];f.push.apply(f,i);var g=new(Function.bind.apply(n,f));return u&&p(g,u.prototype),g},x.apply(null,arguments)}function I(s){var e=typeof Map=="function"?new Map:void 0;return I=function(t){if(t===null||(n=t,Function.toString.call(n).indexOf("[native code]")===-1))return t;var n;if(typeof t!="function")throw new TypeError("Super expression must either be null or a function");if(e!==void 0){if(e.has(t))return e.get(t);e.set(t,i)}function i(){return x(t,arguments,v(this).constructor)}return i.prototype=Object.create(t.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),p(i,t)},I(s)}function m(s){if(s===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return s}function E(s,e){if(e&&(typeof e=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return m(s)}function k(s){var e=_();return function(){var t,n=v(s);if(e){var i=v(this).constructor;t=Reflect.construct(n,arguments,i)}else t=n.apply(this,arguments);return E(this,t)}}function w(s,e,t){return w=typeof Reflect<"u"&&Reflect.get?Reflect.get:function(n,i,u){var f=function(y,d){for(;!Object.prototype.hasOwnProperty.call(y,d)&&(y=v(y))!==null;);return y}(n,i);if(f){var g=Object.getOwnPropertyDescriptor(f,i);return g.get?g.get.call(u):g.value}},w(s,e,t||s)}function C(s){return function(e){if(Array.isArray(e))return R(e)}(s)||function(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}(s)||T(s)||function(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
26
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function T(s,e){if(s){if(typeof s=="string")return R(s,e);var t=Object.prototype.toString.call(s).slice(8,-1);return t==="Object"&&s.constructor&&(t=s.constructor.name),t==="Map"||t==="Set"?Array.from(s):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?R(s,e):void 0}}function R(s,e){(e==null||e>s.length)&&(e=s.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=s[t];return n}function P(s,e){var t=typeof Symbol<"u"&&s[Symbol.iterator]||s["@@iterator"];if(!t){if(Array.isArray(s)||(t=T(s))||e){t&&(s=t);var n=0,i=function(){};return{s:i,n:function(){return n>=s.length?{done:!0}:{done:!1,value:s[n++]}},e:function(y){throw y},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
27
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var u,f=!0,g=!1;return{s:function(){t=t.call(s)},n:function(){var y=t.next();return f=y.done,y},e:function(y){g=!0,u=y},f:function(){try{f||t.return==null||t.return()}finally{if(g)throw u}}}}var A=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"getEndCapStyle",value:function(){return this._endCapStyle}},{key:"isSingleSided",value:function(){return this._isSingleSided}},{key:"setQuadrantSegments",value:function(e){this._quadrantSegments=e,this._quadrantSegments===0&&(this._joinStyle=s.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=s.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),e<=0&&(this._quadrantSegments=1),this._joinStyle!==s.JOIN_ROUND&&(this._quadrantSegments=s.DEFAULT_QUADRANT_SEGMENTS)}},{key:"getJoinStyle",value:function(){return this._joinStyle}},{key:"setJoinStyle",value:function(e){this._joinStyle=e}},{key:"setSimplifyFactor",value:function(e){this._simplifyFactor=e<0?0:e}},{key:"getSimplifyFactor",value:function(){return this._simplifyFactor}},{key:"getQuadrantSegments",value:function(){return this._quadrantSegments}},{key:"setEndCapStyle",value:function(e){this._endCapStyle=e}},{key:"getMitreLimit",value:function(){return this._mitreLimit}},{key:"setMitreLimit",value:function(e){this._mitreLimit=e}},{key:"setSingleSided",value:function(e){this._isSingleSided=e}}],[{key:"constructor_",value:function(){if(this._quadrantSegments=s.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=s.CAP_ROUND,this._joinStyle=s.JOIN_ROUND,this._mitreLimit=s.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=s.DEFAULT_SIMPLIFY_FACTOR,arguments.length!==0){if(arguments.length===1){var e=arguments[0];this.setQuadrantSegments(e)}else if(arguments.length===2){var t=arguments[0],n=arguments[1];this.setQuadrantSegments(t),this.setEndCapStyle(n)}else if(arguments.length===4){var i=arguments[0],u=arguments[1],f=arguments[2],g=arguments[3];this.setQuadrantSegments(i),this.setEndCapStyle(u),this.setJoinStyle(f),this.setMitreLimit(g)}}}},{key:"bufferDistanceError",value:function(e){var t=Math.PI/2/e;return 1-Math.cos(t/2)}}]),s}();A.CAP_ROUND=1,A.CAP_FLAT=2,A.CAP_SQUARE=3,A.JOIN_ROUND=1,A.JOIN_MITRE=2,A.JOIN_BEVEL=3,A.DEFAULT_QUADRANT_SEGMENTS=8,A.DEFAULT_MITRE_LIMIT=5,A.DEFAULT_SIMPLIFY_FACTOR=.01;var D=function(s){h(t,s);var e=k(t);function t(n){var i;return a(this,t),(i=e.call(this,n)).name=Object.keys({Exception:t})[0],i}return c(t,[{key:"toString",value:function(){return this.message}}]),t}(I(Error)),M=function(s){h(t,s);var e=k(t);function t(n){var i;return a(this,t),(i=e.call(this,n)).name=Object.keys({IllegalArgumentException:t})[0],i}return t}(D),G=function(){function s(){a(this,s)}return c(s,[{key:"filter",value:function(e){}}]),s}();function Y(){}function U(){}function X(){}var ie,ee,te,ae,q,ne,ue,ve,Se=function(){function s(){a(this,s)}return c(s,null,[{key:"equalsWithTolerance",value:function(e,t,n){return Math.abs(e-t)<=n}}]),s}(),Ne=function(){function s(e,t){a(this,s),this.low=t||0,this.high=e||0}return c(s,null,[{key:"toBinaryString",value:function(e){var t,n="";for(t=2147483648;t>0;t>>>=1)n+=(e.high&t)===t?"1":"0";for(t=2147483648;t>0;t>>>=1)n+=(e.low&t)===t?"1":"0";return n}}]),s}();function j(){}function Pe(){}j.NaN=NaN,j.isNaN=function(s){return Number.isNaN(s)},j.isInfinite=function(s){return!Number.isFinite(s)},j.MAX_VALUE=Number.MAX_VALUE,j.POSITIVE_INFINITY=Number.POSITIVE_INFINITY,j.NEGATIVE_INFINITY=Number.NEGATIVE_INFINITY,typeof Float64Array=="function"&&typeof Int32Array=="function"?(ne=2146435072,ue=new Float64Array(1),ve=new Int32Array(ue.buffer),j.doubleToLongBits=function(s){ue[0]=s;var e=0|ve[0],t=0|ve[1];return(t&ne)===ne&&1048575&t&&e!==0&&(e=0,t=2146959360),new Ne(t,e)},j.longBitsToDouble=function(s){return ve[0]=s.low,ve[1]=s.high,ue[0]}):(ie=1023,ee=Math.log2,te=Math.floor,ae=Math.pow,q=function(){for(var s=53;s>0;s--){var e=ae(2,s)-1;if(te(ee(e))+1===s)return e}return 0}(),j.doubleToLongBits=function(s){var e,t,n,i,u,f,g,y,d;if(s<0||1/s===Number.NEGATIVE_INFINITY?(f=1<<31,s=-s):f=0,s===0)return new Ne(y=f,d=0);if(s===1/0)return new Ne(y=2146435072|f,d=0);if(s!=s)return new Ne(y=2146959360,d=0);if(i=0,d=0,(e=te(s))>1)if(e<=q)(i=te(ee(e)))<=20?(d=0,y=e<<20-i&1048575):(d=e%(t=ae(2,n=i-20))<<32-n,y=e/t&1048575);else for(n=e,d=0;(n=te(t=n/2))!==0;)i++,d>>>=1,d|=(1&y)<<31,y>>>=1,t!==n&&(y|=524288);if(g=i+ie,u=e===0,e=s-e,i<52&&e!==0)for(n=0;;){if((t=2*e)>=1?(e=t-1,u?(g--,u=!1):(n<<=1,n|=1,i++)):(e=t,u?--g==0&&(i++,u=!1):(n<<=1,i++)),i===20)y|=n,n=0;else if(i===52){d|=n;break}if(t===1){i<20?y|=n<<20-i:i<52&&(d|=n<<52-i);break}}return y|=g<<20,new Ne(y|=f,d)},j.longBitsToDouble=function(s){var e,t,n,i,u=s.high,f=s.low,g=u&1<<31?-1:1;for(n=((2146435072&u)>>20)-ie,i=0,t=1<<19,e=1;e<=20;e++)u&t&&(i+=ae(2,-e)),t>>>=1;for(t=1<<31,e=21;e<=52;e++)f&t&&(i+=ae(2,-e)),t>>>=1;if(n===-1023){if(i===0)return 0*g;n=-1022}else{if(n===1024)return i===0?g/0:NaN;i+=1}return g*i*ae(2,n)});var we=function(s){h(t,s);var e=k(t);function t(n){var i;return a(this,t),(i=e.call(this,n)).name=Object.keys({RuntimeException:t})[0],i}return t}(D),De=function(s){h(t,s);var e=k(t);function t(){var n;return a(this,t),n=e.call(this),t.constructor_.apply(m(n),arguments),n}return c(t,null,[{key:"constructor_",value:function(){if(arguments.length===0)we.constructor_.call(this);else if(arguments.length===1){var n=arguments[0];we.constructor_.call(this,n)}}}]),t}(we),se=function(){function s(){a(this,s)}return c(s,null,[{key:"shouldNeverReachHere",value:function(){if(arguments.length===0)s.shouldNeverReachHere(null);else if(arguments.length===1){var e=arguments[0];throw new De("Should never reach here"+(e!==null?": "+e:""))}}},{key:"isTrue",value:function(){if(arguments.length===1){var e=arguments[0];s.isTrue(e,null)}else if(arguments.length===2){var t=arguments[0],n=arguments[1];if(!t)throw n===null?new De:new De(n)}}},{key:"equals",value:function(){if(arguments.length===2){var e=arguments[0],t=arguments[1];s.equals(e,t,null)}else if(arguments.length===3){var n=arguments[0],i=arguments[1],u=arguments[2];if(!i.equals(n))throw new De("Expected "+n+" but encountered "+i+(u!==null?": "+u:""))}}}]),s}(),dt=new ArrayBuffer(8),Sm=new Float64Array(dt),Bl=new Int32Array(dt),O=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"getM",value:function(){return j.NaN}},{key:"setOrdinate",value:function(e,t){switch(e){case s.X:this.x=t;break;case s.Y:this.y=t;break;case s.Z:this.setZ(t);break;default:throw new M("Invalid ordinate index: "+e)}}},{key:"equals2D",value:function(){if(arguments.length===1){var e=arguments[0];return this.x===e.x&&this.y===e.y}if(arguments.length===2){var t=arguments[0],n=arguments[1];return!!Se.equalsWithTolerance(this.x,t.x,n)&&!!Se.equalsWithTolerance(this.y,t.y,n)}}},{key:"setM",value:function(e){throw new M("Invalid ordinate index: "+s.M)}},{key:"getZ",value:function(){return this.z}},{key:"getOrdinate",value:function(e){switch(e){case s.X:return this.x;case s.Y:return this.y;case s.Z:return this.getZ()}throw new M("Invalid ordinate index: "+e)}},{key:"equals3D",value:function(e){return this.x===e.x&&this.y===e.y&&(this.getZ()===e.getZ()||j.isNaN(this.getZ())&&j.isNaN(e.getZ()))}},{key:"equals",value:function(e){return e instanceof s&&this.equals2D(e)}},{key:"equalInZ",value:function(e,t){return Se.equalsWithTolerance(this.getZ(),e.getZ(),t)}},{key:"setX",value:function(e){this.x=e}},{key:"compareTo",value:function(e){var t=e;return this.x<t.x?-1:this.x>t.x?1:this.y<t.y?-1:this.y>t.y?1:0}},{key:"getX",value:function(){return this.x}},{key:"setZ",value:function(e){this.z=e}},{key:"clone",value:function(){try{return null}catch(e){if(e instanceof CloneNotSupportedException)return se.shouldNeverReachHere("this shouldn't happen because this class is Cloneable"),null;throw e}}},{key:"copy",value:function(){return new s(this)}},{key:"toString",value:function(){return"("+this.x+", "+this.y+", "+this.getZ()+")"}},{key:"distance3D",value:function(e){var t=this.x-e.x,n=this.y-e.y,i=this.getZ()-e.getZ();return Math.sqrt(t*t+n*n+i*i)}},{key:"getY",value:function(){return this.y}},{key:"setY",value:function(e){this.y=e}},{key:"distance",value:function(e){var t=this.x-e.x,n=this.y-e.y;return Math.sqrt(t*t+n*n)}},{key:"hashCode",value:function(){var e=17;return e=37*(e=37*e+s.hashCode(this.x))+s.hashCode(this.y)}},{key:"setCoordinate",value:function(e){this.x=e.x,this.y=e.y,this.z=e.getZ()}},{key:"interfaces_",get:function(){return[Y,U,X]}}],[{key:"constructor_",value:function(){if(this.x=null,this.y=null,this.z=null,arguments.length===0)s.constructor_.call(this,0,0);else if(arguments.length===1){var e=arguments[0];s.constructor_.call(this,e.x,e.y,e.getZ())}else if(arguments.length===2){var t=arguments[0],n=arguments[1];s.constructor_.call(this,t,n,s.NULL_ORDINATE)}else if(arguments.length===3){var i=arguments[0],u=arguments[1],f=arguments[2];this.x=i,this.y=u,this.z=f}}},{key:"hashCode",value:function(e){return Sm[0]=e,Bl[0]^Bl[1]}}]),s}(),Nm=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"compare",value:function(e,t){var n=s.compare(e.x,t.x);if(n!==0)return n;var i=s.compare(e.y,t.y);return i!==0?i:this._dimensionsToTest<=2?0:s.compare(e.getZ(),t.getZ())}},{key:"interfaces_",get:function(){return[Pe]}}],[{key:"constructor_",value:function(){if(this._dimensionsToTest=2,arguments.length===0)s.constructor_.call(this,2);else if(arguments.length===1){var e=arguments[0];if(e!==2&&e!==3)throw new M("only 2 or 3 dimensions may be specified");this._dimensionsToTest=e}}},{key:"compare",value:function(e,t){return e<t?-1:e>t?1:j.isNaN(e)?j.isNaN(t)?0:-1:j.isNaN(t)?1:0}}]),s}();O.DimensionalComparator=Nm,O.NULL_ORDINATE=j.NaN,O.X=0,O.Y=1,O.Z=2,O.M=3;var pe=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"getArea",value:function(){return this.getWidth()*this.getHeight()}},{key:"equals",value:function(e){if(!(e instanceof s))return!1;var t=e;return this.isNull()?t.isNull():this._maxx===t.getMaxX()&&this._maxy===t.getMaxY()&&this._minx===t.getMinX()&&this._miny===t.getMinY()}},{key:"intersection",value:function(e){if(this.isNull()||e.isNull()||!this.intersects(e))return new s;var t=this._minx>e._minx?this._minx:e._minx,n=this._miny>e._miny?this._miny:e._miny;return new s(t,this._maxx<e._maxx?this._maxx:e._maxx,n,this._maxy<e._maxy?this._maxy:e._maxy)}},{key:"isNull",value:function(){return this._maxx<this._minx}},{key:"getMaxX",value:function(){return this._maxx}},{key:"covers",value:function(){if(arguments.length===1){if(arguments[0]instanceof O){var e=arguments[0];return this.covers(e.x,e.y)}if(arguments[0]instanceof s){var t=arguments[0];return!this.isNull()&&!t.isNull()&&t.getMinX()>=this._minx&&t.getMaxX()<=this._maxx&&t.getMinY()>=this._miny&&t.getMaxY()<=this._maxy}}else if(arguments.length===2){var n=arguments[0],i=arguments[1];return!this.isNull()&&n>=this._minx&&n<=this._maxx&&i>=this._miny&&i<=this._maxy}}},{key:"intersects",value:function(){if(arguments.length===1){if(arguments[0]instanceof s){var e=arguments[0];return!this.isNull()&&!e.isNull()&&!(e._minx>this._maxx||e._maxx<this._minx||e._miny>this._maxy||e._maxy<this._miny)}if(arguments[0]instanceof O){var t=arguments[0];return this.intersects(t.x,t.y)}}else if(arguments.length===2){if(arguments[0]instanceof O&&arguments[1]instanceof O){var n=arguments[0],i=arguments[1];if(this.isNull())return!1;var u=n.x<i.x?n.x:i.x;if(u>this._maxx)return!1;var f=n.x>i.x?n.x:i.x;if(f<this._minx)return!1;var g=n.y<i.y?n.y:i.y;if(g>this._maxy)return!1;var y=n.y>i.y?n.y:i.y;return!(y<this._miny)}if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var d=arguments[0],N=arguments[1];return!this.isNull()&&!(d>this._maxx||d<this._minx||N>this._maxy||N<this._miny)}}}},{key:"getMinY",value:function(){return this._miny}},{key:"getDiameter",value:function(){if(this.isNull())return 0;var e=this.getWidth(),t=this.getHeight();return Math.sqrt(e*e+t*t)}},{key:"getMinX",value:function(){return this._minx}},{key:"expandToInclude",value:function(){if(arguments.length===1){if(arguments[0]instanceof O){var e=arguments[0];this.expandToInclude(e.x,e.y)}else if(arguments[0]instanceof s){var t=arguments[0];if(t.isNull())return null;this.isNull()?(this._minx=t.getMinX(),this._maxx=t.getMaxX(),this._miny=t.getMinY(),this._maxy=t.getMaxY()):(t._minx<this._minx&&(this._minx=t._minx),t._maxx>this._maxx&&(this._maxx=t._maxx),t._miny<this._miny&&(this._miny=t._miny),t._maxy>this._maxy&&(this._maxy=t._maxy))}}else if(arguments.length===2){var n=arguments[0],i=arguments[1];this.isNull()?(this._minx=n,this._maxx=n,this._miny=i,this._maxy=i):(n<this._minx&&(this._minx=n),n>this._maxx&&(this._maxx=n),i<this._miny&&(this._miny=i),i>this._maxy&&(this._maxy=i))}}},{key:"minExtent",value:function(){if(this.isNull())return 0;var e=this.getWidth(),t=this.getHeight();return e<t?e:t}},{key:"getWidth",value:function(){return this.isNull()?0:this._maxx-this._minx}},{key:"compareTo",value:function(e){var t=e;return this.isNull()?t.isNull()?0:-1:t.isNull()?1:this._minx<t._minx?-1:this._minx>t._minx?1:this._miny<t._miny?-1:this._miny>t._miny?1:this._maxx<t._maxx?-1:this._maxx>t._maxx?1:this._maxy<t._maxy?-1:this._maxy>t._maxy?1:0}},{key:"translate",value:function(e,t){if(this.isNull())return null;this.init(this.getMinX()+e,this.getMaxX()+e,this.getMinY()+t,this.getMaxY()+t)}},{key:"copy",value:function(){return new s(this)}},{key:"toString",value:function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"}},{key:"setToNull",value:function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1}},{key:"disjoint",value:function(e){return!(!this.isNull()&&!e.isNull())||e._minx>this._maxx||e._maxx<this._minx||e._miny>this._maxy||e._maxy<this._miny}},{key:"getHeight",value:function(){return this.isNull()?0:this._maxy-this._miny}},{key:"maxExtent",value:function(){if(this.isNull())return 0;var e=this.getWidth(),t=this.getHeight();return e>t?e:t}},{key:"expandBy",value:function(){if(arguments.length===1){var e=arguments[0];this.expandBy(e,e)}else if(arguments.length===2){var t=arguments[0],n=arguments[1];if(this.isNull())return null;this._minx-=t,this._maxx+=t,this._miny-=n,this._maxy+=n,(this._minx>this._maxx||this._miny>this._maxy)&&this.setToNull()}}},{key:"contains",value:function(){if(arguments.length===1){if(arguments[0]instanceof s){var e=arguments[0];return this.covers(e)}if(arguments[0]instanceof O){var t=arguments[0];return this.covers(t)}}else if(arguments.length===2){var n=arguments[0],i=arguments[1];return this.covers(n,i)}}},{key:"centre",value:function(){return this.isNull()?null:new O((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)}},{key:"init",value:function(){if(arguments.length===0)this.setToNull();else if(arguments.length===1){if(arguments[0]instanceof O){var e=arguments[0];this.init(e.x,e.x,e.y,e.y)}else if(arguments[0]instanceof s){var t=arguments[0];this._minx=t._minx,this._maxx=t._maxx,this._miny=t._miny,this._maxy=t._maxy}}else if(arguments.length===2){var n=arguments[0],i=arguments[1];this.init(n.x,i.x,n.y,i.y)}else if(arguments.length===4){var u=arguments[0],f=arguments[1],g=arguments[2],y=arguments[3];u<f?(this._minx=u,this._maxx=f):(this._minx=f,this._maxx=u),g<y?(this._miny=g,this._maxy=y):(this._miny=y,this._maxy=g)}}},{key:"getMaxY",value:function(){return this._maxy}},{key:"distance",value:function(e){if(this.intersects(e))return 0;var t=0;this._maxx<e._minx?t=e._minx-this._maxx:this._minx>e._maxx&&(t=this._minx-e._maxx);var n=0;return this._maxy<e._miny?n=e._miny-this._maxy:this._miny>e._maxy&&(n=this._miny-e._maxy),t===0?n:n===0?t:Math.sqrt(t*t+n*n)}},{key:"hashCode",value:function(){var e=17;return e=37*(e=37*(e=37*(e=37*e+O.hashCode(this._minx))+O.hashCode(this._maxx))+O.hashCode(this._miny))+O.hashCode(this._maxy)}},{key:"interfaces_",get:function(){return[Y,X]}}],[{key:"constructor_",value:function(){if(this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,arguments.length===0)this.init();else if(arguments.length===1){if(arguments[0]instanceof O){var e=arguments[0];this.init(e.x,e.x,e.y,e.y)}else if(arguments[0]instanceof s){var t=arguments[0];this.init(t)}}else if(arguments.length===2){var n=arguments[0],i=arguments[1];this.init(n.x,i.x,n.y,i.y)}else if(arguments.length===4){var u=arguments[0],f=arguments[1],g=arguments[2],y=arguments[3];this.init(u,f,g,y)}}},{key:"intersects",value:function(){if(arguments.length===3){var e=arguments[0],t=arguments[1],n=arguments[2];return n.x>=(e.x<t.x?e.x:t.x)&&n.x<=(e.x>t.x?e.x:t.x)&&n.y>=(e.y<t.y?e.y:t.y)&&n.y<=(e.y>t.y?e.y:t.y)}if(arguments.length===4){var i=arguments[0],u=arguments[1],f=arguments[2],g=arguments[3],y=Math.min(f.x,g.x),d=Math.max(f.x,g.x),N=Math.min(i.x,u.x),b=Math.max(i.x,u.x);return!(N>d)&&!(b<y)&&(y=Math.min(f.y,g.y),d=Math.max(f.y,g.y),N=Math.min(i.y,u.y),b=Math.max(i.y,u.y),!(N>d)&&!(b<y))}}}]),s}(),W=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"isGeometryCollection",value:function(){return this.getTypeCode()===s.TYPECODE_GEOMETRYCOLLECTION}},{key:"getFactory",value:function(){return this._factory}},{key:"getGeometryN",value:function(e){return this}},{key:"getArea",value:function(){return 0}},{key:"isRectangle",value:function(){return!1}},{key:"equalsExact",value:function(e){return this===e||this.equalsExact(e,0)}},{key:"geometryChanged",value:function(){this.apply(s.geometryChangedFilter)}},{key:"geometryChangedAction",value:function(){this._envelope=null}},{key:"equalsNorm",value:function(e){return e!==null&&this.norm().equalsExact(e.norm())}},{key:"getLength",value:function(){return 0}},{key:"getNumGeometries",value:function(){return 1}},{key:"compareTo",value:function(){var e;if(arguments.length===1){var t=arguments[0];return e=t,this.getTypeCode()!==e.getTypeCode()?this.getTypeCode()-e.getTypeCode():this.isEmpty()&&e.isEmpty()?0:this.isEmpty()?-1:e.isEmpty()?1:this.compareToSameClass(t)}if(arguments.length===2){var n=arguments[0],i=arguments[1];return e=n,this.getTypeCode()!==e.getTypeCode()?this.getTypeCode()-e.getTypeCode():this.isEmpty()&&e.isEmpty()?0:this.isEmpty()?-1:e.isEmpty()?1:this.compareToSameClass(n,i)}}},{key:"getUserData",value:function(){return this._userData}},{key:"getSRID",value:function(){return this._SRID}},{key:"getEnvelope",value:function(){return this.getFactory().toGeometry(this.getEnvelopeInternal())}},{key:"checkNotGeometryCollection",value:function(e){if(e.getTypeCode()===s.TYPECODE_GEOMETRYCOLLECTION)throw new M("This method does not support GeometryCollection arguments")}},{key:"equal",value:function(e,t,n){return n===0?e.equals(t):e.distance(t)<=n}},{key:"norm",value:function(){var e=this.copy();return e.normalize(),e}},{key:"reverse",value:function(){var e=this.reverseInternal();return this.envelope!=null&&(e.envelope=this.envelope.copy()),e.setSRID(this.getSRID()),e}},{key:"copy",value:function(){var e=this.copyInternal();return e.envelope=this._envelope==null?null:this._envelope.copy(),e._SRID=this._SRID,e._userData=this._userData,e}},{key:"getPrecisionModel",value:function(){return this._factory.getPrecisionModel()}},{key:"getEnvelopeInternal",value:function(){return this._envelope===null&&(this._envelope=this.computeEnvelopeInternal()),new pe(this._envelope)}},{key:"setSRID",value:function(e){this._SRID=e}},{key:"setUserData",value:function(e){this._userData=e}},{key:"compare",value:function(e,t){for(var n=e.iterator(),i=t.iterator();n.hasNext()&&i.hasNext();){var u=n.next(),f=i.next(),g=u.compareTo(f);if(g!==0)return g}return n.hasNext()?1:i.hasNext()?-1:0}},{key:"hashCode",value:function(){return this.getEnvelopeInternal().hashCode()}},{key:"isEquivalentClass",value:function(e){return this.getClass()===e.getClass()}},{key:"isGeometryCollectionOrDerived",value:function(){return this.getTypeCode()===s.TYPECODE_GEOMETRYCOLLECTION||this.getTypeCode()===s.TYPECODE_MULTIPOINT||this.getTypeCode()===s.TYPECODE_MULTILINESTRING||this.getTypeCode()===s.TYPECODE_MULTIPOLYGON}},{key:"interfaces_",get:function(){return[U,Y,X]}},{key:"getClass",value:function(){return s}}],[{key:"hasNonEmptyElements",value:function(e){for(var t=0;t<e.length;t++)if(!e[t].isEmpty())return!0;return!1}},{key:"hasNullElements",value:function(e){for(var t=0;t<e.length;t++)if(e[t]===null)return!0;return!1}}]),s}();W.constructor_=function(s){s&&(this._envelope=null,this._userData=null,this._factory=s,this._SRID=s.getSRID())},W.TYPECODE_POINT=0,W.TYPECODE_MULTIPOINT=1,W.TYPECODE_LINESTRING=2,W.TYPECODE_LINEARRING=3,W.TYPECODE_MULTILINESTRING=4,W.TYPECODE_POLYGON=5,W.TYPECODE_MULTIPOLYGON=6,W.TYPECODE_GEOMETRYCOLLECTION=7,W.TYPENAME_POINT="Point",W.TYPENAME_MULTIPOINT="MultiPoint",W.TYPENAME_LINESTRING="LineString",W.TYPENAME_LINEARRING="LinearRing",W.TYPENAME_MULTILINESTRING="MultiLineString",W.TYPENAME_POLYGON="Polygon",W.TYPENAME_MULTIPOLYGON="MultiPolygon",W.TYPENAME_GEOMETRYCOLLECTION="GeometryCollection",W.geometryChangedFilter={get interfaces_(){return[G]},filter:function(s){s.geometryChangedAction()}};var S=function(){function s(){a(this,s)}return c(s,null,[{key:"toLocationSymbol",value:function(e){switch(e){case s.EXTERIOR:return"e";case s.BOUNDARY:return"b";case s.INTERIOR:return"i";case s.NONE:return"-"}throw new M("Unknown location value: "+e)}}]),s}();S.INTERIOR=0,S.BOUNDARY=1,S.EXTERIOR=2,S.NONE=-1;var ct=function(){function s(){a(this,s)}return c(s,[{key:"add",value:function(){}},{key:"addAll",value:function(){}},{key:"isEmpty",value:function(){}},{key:"iterator",value:function(){}},{key:"size",value:function(){}},{key:"toArray",value:function(){}},{key:"remove",value:function(){}}]),s}(),Zr=function(s){h(t,s);var e=k(t);function t(n){var i;return a(this,t),(i=e.call(this,n)).name=Object.keys({NoSuchElementException:t})[0],i}return t}(D),At=function(s){h(t,s);var e=k(t);function t(n){var i;return a(this,t),(i=e.call(this,n)).name=Object.keys({UnsupportedOperationException:t})[0],i}return t}(D),Gl=function(s){h(t,s);var e=k(t);function t(){return a(this,t),e.apply(this,arguments)}return c(t,[{key:"contains",value:function(){}}]),t}(ct),Ms=function(s,e){h(n,s);var t=k(n);function n(i){var u;return a(this,n),(u=t.call(this)).map=new Map,i instanceof ct&&u.addAll(i),u}return c(n,[{key:"contains",value:function(i){var u=i.hashCode?i.hashCode():i;return!!this.map.has(u)}},{key:"add",value:function(i){var u=i.hashCode?i.hashCode():i;return!this.map.has(u)&&!!this.map.set(u,i)}},{key:"addAll",value:function(i){var u,f=P(i);try{for(f.s();!(u=f.n()).done;){var g=u.value;this.add(g)}}catch(y){f.e(y)}finally{f.f()}return!0}},{key:"remove",value:function(){throw new At}},{key:"size",value:function(){return this.map.size}},{key:"isEmpty",value:function(){return this.map.size===0}},{key:"toArray",value:function(){return Array.from(this.map.values())}},{key:"iterator",value:function(){return new wm(this.map)}},{key:e,value:function(){return this.map}}]),n}(Gl,Symbol.iterator),wm=function(){function s(e){a(this,s),this.iterator=e.values();var t=this.iterator.next(),n=t.done,i=t.value;this.done=n,this.value=i}return c(s,[{key:"next",value:function(){if(this.done)throw new Zr;var e=this.value,t=this.iterator.next(),n=t.done,i=t.value;return this.done=n,this.value=i,e}},{key:"hasNext",value:function(){return!this.done}},{key:"remove",value:function(){throw new At}}]),s}(),B=function(){function s(){a(this,s)}return c(s,null,[{key:"opposite",value:function(e){return e===s.LEFT?s.RIGHT:e===s.RIGHT?s.LEFT:e}}]),s}();B.ON=0,B.LEFT=1,B.RIGHT=2;var ql=function(s){h(t,s);var e=k(t);function t(n){var i;return a(this,t),(i=e.call(this,n)).name=Object.keys({EmptyStackException:t})[0],i}return t}(D),zl=function(s){h(t,s);var e=k(t);function t(n){var i;return a(this,t),(i=e.call(this,n)).name=Object.keys({IndexOutOfBoundsException:t})[0],i}return t}(D),Yt=function(s){h(t,s);var e=k(t);function t(){return a(this,t),e.apply(this,arguments)}return c(t,[{key:"get",value:function(){}},{key:"set",value:function(){}},{key:"isEmpty",value:function(){}}]),t}(ct),bm=function(s){h(t,s);var e=k(t);function t(){var n;return a(this,t),(n=e.call(this)).array=[],n}return c(t,[{key:"add",value:function(n){return this.array.push(n),!0}},{key:"get",value:function(n){if(n<0||n>=this.size())throw new zl;return this.array[n]}},{key:"push",value:function(n){return this.array.push(n),n}},{key:"pop",value:function(){if(this.array.length===0)throw new ql;return this.array.pop()}},{key:"peek",value:function(){if(this.array.length===0)throw new ql;return this.array[this.array.length-1]}},{key:"empty",value:function(){return this.array.length===0}},{key:"isEmpty",value:function(){return this.empty()}},{key:"search",value:function(n){return this.array.indexOf(n)}},{key:"size",value:function(){return this.array.length}},{key:"toArray",value:function(){return this.array.slice()}}]),t}(Yt);function re(s,e){return s.interfaces_&&s.interfaces_.indexOf(e)>-1}var Xn=function(){function s(e){a(this,s),this.str=e}return c(s,[{key:"append",value:function(e){this.str+=e}},{key:"setCharAt",value:function(e,t){this.str=this.str.substr(0,e)+t+this.str.substr(e+1)}},{key:"toString",value:function(){return this.str}}]),s}(),Jr=function(){function s(e){a(this,s),this.value=e}return c(s,[{key:"intValue",value:function(){return this.value}},{key:"compareTo",value:function(e){return this.value<e?-1:this.value>e?1:0}}],[{key:"compare",value:function(e,t){return e<t?-1:e>t?1:0}},{key:"isNan",value:function(e){return Number.isNaN(e)}},{key:"valueOf",value:function(e){return new s(e)}}]),s}(),Ds=function(){function s(){a(this,s)}return c(s,null,[{key:"isWhitespace",value:function(e){return e<=32&&e>=0||e===127}},{key:"toUpperCase",value:function(e){return e.toUpperCase()}}]),s}(),J=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"le",value:function(e){return this._hi<e._hi||this._hi===e._hi&&this._lo<=e._lo}},{key:"extractSignificantDigits",value:function(e,t){var n=this.abs(),i=s.magnitude(n._hi),u=s.TEN.pow(i);(n=n.divide(u)).gt(s.TEN)?(n=n.divide(s.TEN),i+=1):n.lt(s.ONE)&&(n=n.multiply(s.TEN),i-=1);for(var f=i+1,g=new Xn,y=s.MAX_PRINT_DIGITS-1,d=0;d<=y;d++){e&&d===f&&g.append(".");var N=Math.trunc(n._hi);if(N<0)break;var b=!1,L=0;N>9?(b=!0,L="9"):L="0"+N,g.append(L),n=n.subtract(s.valueOf(N)).multiply(s.TEN),b&&n.selfAdd(s.TEN);var $=!0,F=s.magnitude(n._hi);if(F<0&&Math.abs(F)>=y-d&&($=!1),!$)break}return t[0]=i,g.toString()}},{key:"sqr",value:function(){return this.multiply(this)}},{key:"doubleValue",value:function(){return this._hi+this._lo}},{key:"subtract",value:function(){if(arguments[0]instanceof s){var e=arguments[0];return this.add(e.negate())}if(typeof arguments[0]=="number"){var t=arguments[0];return this.add(-t)}}},{key:"equals",value:function(){if(arguments.length===1&&arguments[0]instanceof s){var e=arguments[0];return this._hi===e._hi&&this._lo===e._lo}}},{key:"isZero",value:function(){return this._hi===0&&this._lo===0}},{key:"selfSubtract",value:function(){if(arguments[0]instanceof s){var e=arguments[0];return this.isNaN()?this:this.selfAdd(-e._hi,-e._lo)}if(typeof arguments[0]=="number"){var t=arguments[0];return this.isNaN()?this:this.selfAdd(-t,0)}}},{key:"getSpecialNumberString",value:function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null}},{key:"min",value:function(e){return this.le(e)?this:e}},{key:"selfDivide",value:function(){if(arguments.length===1){if(arguments[0]instanceof s){var e=arguments[0];return this.selfDivide(e._hi,e._lo)}if(typeof arguments[0]=="number"){var t=arguments[0];return this.selfDivide(t,0)}}else if(arguments.length===2){var n=arguments[0],i=arguments[1],u=null,f=null,g=null,y=null,d=null,N=null,b=null,L=null;return d=this._hi/n,L=(u=(N=s.SPLIT*d)-(u=N-d))*(g=(L=s.SPLIT*n)-(g=L-n))-(b=d*n)+u*(y=n-g)+(f=d-u)*g+f*y,L=d+(N=(this._hi-b-L+this._lo-d*i)/n),this._hi=L,this._lo=d-L+N,this}}},{key:"dump",value:function(){return"DD<"+this._hi+", "+this._lo+">"}},{key:"divide",value:function(){if(arguments[0]instanceof s){var e=arguments[0],t=null,n=null,i=null,u=null,f=null,g=null,y=null,d=null;n=(f=this._hi/e._hi)-(t=(g=s.SPLIT*f)-(t=g-f)),d=t*(i=(d=s.SPLIT*e._hi)-(i=d-e._hi))-(y=f*e._hi)+t*(u=e._hi-i)+n*i+n*u;var N=d=f+(g=(this._hi-y-d+this._lo-f*e._lo)/e._hi),b=f-d+g;return new s(N,b)}if(typeof arguments[0]=="number"){var L=arguments[0];return j.isNaN(L)?s.createNaN():s.copy(this).selfDivide(L,0)}}},{key:"ge",value:function(e){return this._hi>e._hi||this._hi===e._hi&&this._lo>=e._lo}},{key:"pow",value:function(e){if(e===0)return s.valueOf(1);var t=new s(this),n=s.valueOf(1),i=Math.abs(e);if(i>1)for(;i>0;)i%2==1&&n.selfMultiply(t),(i/=2)>0&&(t=t.sqr());else n=t;return e<0?n.reciprocal():n}},{key:"ceil",value:function(){if(this.isNaN())return s.NaN;var e=Math.ceil(this._hi),t=0;return e===this._hi&&(t=Math.ceil(this._lo)),new s(e,t)}},{key:"compareTo",value:function(e){var t=e;return this._hi<t._hi?-1:this._hi>t._hi?1:this._lo<t._lo?-1:this._lo>t._lo?1:0}},{key:"rint",value:function(){return this.isNaN()?this:this.add(.5).floor()}},{key:"setValue",value:function(){if(arguments[0]instanceof s){var e=arguments[0];return this.init(e),this}if(typeof arguments[0]=="number"){var t=arguments[0];return this.init(t),this}}},{key:"max",value:function(e){return this.ge(e)?this:e}},{key:"sqrt",value:function(){if(this.isZero())return s.valueOf(0);if(this.isNegative())return s.NaN;var e=1/Math.sqrt(this._hi),t=this._hi*e,n=s.valueOf(t),i=this.subtract(n.sqr())._hi*(.5*e);return n.add(i)}},{key:"selfAdd",value:function(){if(arguments.length===1){if(arguments[0]instanceof s){var e=arguments[0];return this.selfAdd(e._hi,e._lo)}if(typeof arguments[0]=="number"){var t=arguments[0],n=null,i=null,u=null,f=null,g=null,y=null;return f=(u=this._hi+t)-(g=u-this._hi),i=(y=(f=t-g+(this._hi-f))+this._lo)+(u-(n=u+y)),this._hi=n+i,this._lo=i+(n-this._hi),this}}else if(arguments.length===2){var d=arguments[0],N=arguments[1],b=null,L=null,$=null,F=null,V=null,H=null,K=null;F=this._hi+d,L=this._lo+N,V=F-(H=F-this._hi),$=L-(K=L-this._lo);var ge=(b=F+(H=(V=d-H+(this._hi-V))+L))+(H=($=N-K+(this._lo-$))+(H+(F-b))),xe=H+(b-ge);return this._hi=ge,this._lo=xe,this}}},{key:"selfMultiply",value:function(){if(arguments.length===1){if(arguments[0]instanceof s){var e=arguments[0];return this.selfMultiply(e._hi,e._lo)}if(typeof arguments[0]=="number"){var t=arguments[0];return this.selfMultiply(t,0)}}else if(arguments.length===2){var n=arguments[0],i=arguments[1],u=null,f=null,g=null,y=null,d=null,N=null;u=(d=s.SPLIT*this._hi)-this._hi,N=s.SPLIT*n,u=d-u,f=this._hi-u,g=N-n;var b=(d=this._hi*n)+(N=u*(g=N-g)-d+u*(y=n-g)+f*g+f*y+(this._hi*i+this._lo*n)),L=N+(u=d-b);return this._hi=b,this._lo=L,this}}},{key:"selfSqr",value:function(){return this.selfMultiply(this)}},{key:"floor",value:function(){if(this.isNaN())return s.NaN;var e=Math.floor(this._hi),t=0;return e===this._hi&&(t=Math.floor(this._lo)),new s(e,t)}},{key:"negate",value:function(){return this.isNaN()?this:new s(-this._hi,-this._lo)}},{key:"clone",value:function(){try{return null}catch(e){if(e instanceof CloneNotSupportedException)return null;throw e}}},{key:"multiply",value:function(){if(arguments[0]instanceof s){var e=arguments[0];return e.isNaN()?s.createNaN():s.copy(this).selfMultiply(e)}if(typeof arguments[0]=="number"){var t=arguments[0];return j.isNaN(t)?s.createNaN():s.copy(this).selfMultiply(t,0)}}},{key:"isNaN",value:function(){return j.isNaN(this._hi)}},{key:"intValue",value:function(){return Math.trunc(this._hi)}},{key:"toString",value:function(){var e=s.magnitude(this._hi);return e>=-3&&e<=20?this.toStandardNotation():this.toSciNotation()}},{key:"toStandardNotation",value:function(){var e=this.getSpecialNumberString();if(e!==null)return e;var t=new Array(1).fill(null),n=this.extractSignificantDigits(!0,t),i=t[0]+1,u=n;if(n.charAt(0)===".")u="0"+n;else if(i<0)u="0."+s.stringOfChar("0",-i)+n;else if(n.indexOf(".")===-1){var f=i-n.length;u=n+s.stringOfChar("0",f)+".0"}return this.isNegative()?"-"+u:u}},{key:"reciprocal",value:function(){var e,t,n,i,u=null,f=null,g=null,y=null;e=(n=1/this._hi)-(u=(g=s.SPLIT*n)-(u=g-n)),f=(y=s.SPLIT*this._hi)-this._hi;var d=n+(g=(1-(i=n*this._hi)-(y=u*(f=y-f)-i+u*(t=this._hi-f)+e*f+e*t)-n*this._lo)/this._hi);return new s(d,n-d+g)}},{key:"toSciNotation",value:function(){if(this.isZero())return s.SCI_NOT_ZERO;var e=this.getSpecialNumberString();if(e!==null)return e;var t=new Array(1).fill(null),n=this.extractSignificantDigits(!1,t),i=s.SCI_NOT_EXPONENT_CHAR+t[0];if(n.charAt(0)==="0")throw new IllegalStateException("Found leading zero: "+n);var u="";n.length>1&&(u=n.substring(1));var f=n.charAt(0)+"."+u;return this.isNegative()?"-"+f+i:f+i}},{key:"abs",value:function(){return this.isNaN()?s.NaN:this.isNegative()?this.negate():new s(this)}},{key:"isPositive",value:function(){return this._hi>0||this._hi===0&&this._lo>0}},{key:"lt",value:function(e){return this._hi<e._hi||this._hi===e._hi&&this._lo<e._lo}},{key:"add",value:function(){if(arguments[0]instanceof s){var e=arguments[0];return s.copy(this).selfAdd(e)}if(typeof arguments[0]=="number"){var t=arguments[0];return s.copy(this).selfAdd(t)}}},{key:"init",value:function(){if(arguments.length===1){if(typeof arguments[0]=="number"){var e=arguments[0];this._hi=e,this._lo=0}else if(arguments[0]instanceof s){var t=arguments[0];this._hi=t._hi,this._lo=t._lo}}else if(arguments.length===2){var n=arguments[0],i=arguments[1];this._hi=n,this._lo=i}}},{key:"gt",value:function(e){return this._hi>e._hi||this._hi===e._hi&&this._lo>e._lo}},{key:"isNegative",value:function(){return this._hi<0||this._hi===0&&this._lo<0}},{key:"trunc",value:function(){return this.isNaN()?s.NaN:this.isPositive()?this.floor():this.ceil()}},{key:"signum",value:function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0}},{key:"interfaces_",get:function(){return[X,Y,U]}}],[{key:"constructor_",value:function(){if(this._hi=0,this._lo=0,arguments.length===0)this.init(0);else if(arguments.length===1){if(typeof arguments[0]=="number"){var e=arguments[0];this.init(e)}else if(arguments[0]instanceof s){var t=arguments[0];this.init(t)}else if(typeof arguments[0]=="string"){var n=arguments[0];s.constructor_.call(this,s.parse(n))}}else if(arguments.length===2){var i=arguments[0],u=arguments[1];this.init(i,u)}}},{key:"determinant",value:function(){if(typeof arguments[3]=="number"&&typeof arguments[2]=="number"&&typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var e=arguments[0],t=arguments[1],n=arguments[2],i=arguments[3];return s.determinant(s.valueOf(e),s.valueOf(t),s.valueOf(n),s.valueOf(i))}if(arguments[3]instanceof s&&arguments[2]instanceof s&&arguments[0]instanceof s&&arguments[1]instanceof s){var u=arguments[0],f=arguments[1],g=arguments[2],y=arguments[3],d=u.multiply(y).selfSubtract(f.multiply(g));return d}}},{key:"sqr",value:function(e){return s.valueOf(e).selfMultiply(e)}},{key:"valueOf",value:function(){if(typeof arguments[0]=="string"){var e=arguments[0];return s.parse(e)}if(typeof arguments[0]=="number"){var t=arguments[0];return new s(t)}}},{key:"sqrt",value:function(e){return s.valueOf(e).sqrt()}},{key:"parse",value:function(e){for(var t=0,n=e.length;Ds.isWhitespace(e.charAt(t));)t++;var i=!1;if(t<n){var u=e.charAt(t);u!=="-"&&u!=="+"||(t++,u==="-"&&(i=!0))}for(var f=new s,g=0,y=0,d=0,N=!1;!(t>=n);){var b=e.charAt(t);if(t++,Ds.isDigit(b)){var L=b-"0";f.selfMultiply(s.TEN),f.selfAdd(L),g++}else{if(b!=="."){if(b==="e"||b==="E"){var $=e.substring(t);try{d=Jr.parseInt($)}catch(ge){throw ge instanceof NumberFormatException?new NumberFormatException("Invalid exponent "+$+" in string "+e):ge}break}throw new NumberFormatException("Unexpected character '"+b+"' at position "+t+" in string "+e)}y=g,N=!0}}var F=f;N||(y=g);var V=g-y-d;if(V===0)F=f;else if(V>0){var H=s.TEN.pow(V);F=f.divide(H)}else if(V<0){var K=s.TEN.pow(-V);F=f.multiply(K)}return i?F.negate():F}},{key:"createNaN",value:function(){return new s(j.NaN,j.NaN)}},{key:"copy",value:function(e){return new s(e)}},{key:"magnitude",value:function(e){var t=Math.abs(e),n=Math.log(t)/Math.log(10),i=Math.trunc(Math.floor(n));return 10*Math.pow(10,i)<=t&&(i+=1),i}},{key:"stringOfChar",value:function(e,t){for(var n=new Xn,i=0;i<t;i++)n.append(e);return n.toString()}}]),s}();J.PI=new J(3.141592653589793,12246467991473532e-32),J.TWO_PI=new J(6.283185307179586,24492935982947064e-32),J.PI_2=new J(1.5707963267948966,6123233995736766e-32),J.E=new J(2.718281828459045,14456468917292502e-32),J.NaN=new J(j.NaN,j.NaN),J.EPS=123259516440783e-46,J.SPLIT=134217729,J.MAX_PRINT_DIGITS=32,J.TEN=J.valueOf(10),J.ONE=J.valueOf(1),J.SCI_NOT_EXPONENT_CHAR="E",J.SCI_NOT_ZERO="0.0E0";var Fs=function(){function s(){a(this,s)}return c(s,null,[{key:"orientationIndex",value:function(e,t,n){var i=s.orientationIndexFilter(e,t,n);if(i<=1)return i;var u=J.valueOf(t.x).selfAdd(-e.x),f=J.valueOf(t.y).selfAdd(-e.y),g=J.valueOf(n.x).selfAdd(-t.x),y=J.valueOf(n.y).selfAdd(-t.y);return u.selfMultiply(y).selfSubtract(f.selfMultiply(g)).signum()}},{key:"signOfDet2x2",value:function(){if(arguments[3]instanceof J&&arguments[2]instanceof J&&arguments[0]instanceof J&&arguments[1]instanceof J){var e=arguments[0],t=arguments[1],n=arguments[2],i=arguments[3],u=e.multiply(i).selfSubtract(t.multiply(n));return u.signum()}if(typeof arguments[3]=="number"&&typeof arguments[2]=="number"&&typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var f=arguments[0],g=arguments[1],y=arguments[2],d=arguments[3],N=J.valueOf(f),b=J.valueOf(g),L=J.valueOf(y),$=J.valueOf(d),F=N.multiply($).selfSubtract(b.multiply(L));return F.signum()}}},{key:"intersection",value:function(e,t,n,i){var u=new J(e.y).selfSubtract(t.y),f=new J(t.x).selfSubtract(e.x),g=new J(e.x).selfMultiply(t.y).selfSubtract(new J(t.x).selfMultiply(e.y)),y=new J(n.y).selfSubtract(i.y),d=new J(i.x).selfSubtract(n.x),N=new J(n.x).selfMultiply(i.y).selfSubtract(new J(i.x).selfMultiply(n.y)),b=f.multiply(N).selfSubtract(d.multiply(g)),L=y.multiply(g).selfSubtract(u.multiply(N)),$=u.multiply(d).selfSubtract(y.multiply(f)),F=b.selfDivide($).doubleValue(),V=L.selfDivide($).doubleValue();return j.isNaN(F)||j.isInfinite(F)||j.isNaN(V)||j.isInfinite(V)?null:new O(F,V)}},{key:"orientationIndexFilter",value:function(e,t,n){var i=null,u=(e.x-n.x)*(t.y-n.y),f=(e.y-n.y)*(t.x-n.x),g=u-f;if(u>0){if(f<=0)return s.signum(g);i=u+f}else{if(!(u<0)||f>=0)return s.signum(g);i=-u-f}var y=s.DP_SAFE_EPSILON*i;return g>=y||-g>=y?s.signum(g):2}},{key:"signum",value:function(e){return e>0?1:e<0?-1:0}}]),s}();Fs.DP_SAFE_EPSILON=1e-15;var le=function(){function s(){a(this,s)}return c(s,[{key:"getM",value:function(e){if(this.hasM()){var t=this.getDimension()-this.getMeasures();return this.getOrdinate(e,t)}return j.NaN}},{key:"setOrdinate",value:function(e,t,n){}},{key:"getZ",value:function(e){return this.hasZ()?this.getOrdinate(e,2):j.NaN}},{key:"size",value:function(){}},{key:"getOrdinate",value:function(e,t){}},{key:"getCoordinate",value:function(){}},{key:"getCoordinateCopy",value:function(e){}},{key:"createCoordinate",value:function(){}},{key:"getDimension",value:function(){}},{key:"hasM",value:function(){return this.getMeasures()>0}},{key:"getX",value:function(e){}},{key:"hasZ",value:function(){return this.getDimension()-this.getMeasures()>2}},{key:"getMeasures",value:function(){return 0}},{key:"expandEnvelope",value:function(e){}},{key:"copy",value:function(){}},{key:"getY",value:function(e){}},{key:"toCoordinateArray",value:function(){}},{key:"interfaces_",get:function(){return[U]}}]),s}();le.X=0,le.Y=1,le.Z=2,le.M=3;var Q=function(){function s(){a(this,s)}return c(s,null,[{key:"index",value:function(e,t,n){return Fs.orientationIndex(e,t,n)}},{key:"isCCW",value:function(){if(arguments[0]instanceof Array){var e=arguments[0],t=e.length-1;if(t<3)throw new M("Ring has fewer than 4 points, so orientation cannot be determined");for(var n=e[0],i=0,u=1;u<=t;u++){var f=e[u];f.y>n.y&&(n=f,i=u)}var g=i;do(g-=1)<0&&(g=t);while(e[g].equals2D(n)&&g!==i);var y=i;do y=(y+1)%t;while(e[y].equals2D(n)&&y!==i);var d=e[g],N=e[y];if(d.equals2D(n)||N.equals2D(n)||d.equals2D(N))return!1;var b=s.index(d,n,N),L=null;return L=b===0?d.x>N.x:b>0,L}if(re(arguments[0],le)){var $=arguments[0],F=$.size()-1;if(F<3)throw new M("Ring has fewer than 4 points, so orientation cannot be determined");for(var V=$.getCoordinate(0),H=0,K=1;K<=F;K++){var ge=$.getCoordinate(K);ge.y>V.y&&(V=ge,H=K)}var xe=null,Re=H;do(Re-=1)<0&&(Re=F),xe=$.getCoordinate(Re);while(xe.equals2D(V)&&Re!==H);var Ge=null,rt=H;do rt=(rt+1)%F,Ge=$.getCoordinate(rt);while(Ge.equals2D(V)&&rt!==H);if(xe.equals2D(V)||Ge.equals2D(V)||xe.equals2D(Ge))return!1;var kt=s.index(xe,V,Ge);return kt===0?xe.x>Ge.x:kt>0}}}]),s}();Q.CLOCKWISE=-1,Q.RIGHT=Q.CLOCKWISE,Q.COUNTERCLOCKWISE=1,Q.LEFT=Q.COUNTERCLOCKWISE,Q.COLLINEAR=0,Q.STRAIGHT=Q.COLLINEAR;var Om=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"getCoordinate",value:function(){return this._minCoord}},{key:"getRightmostSide",value:function(e,t){var n=this.getRightmostSideOfSegment(e,t);return n<0&&(n=this.getRightmostSideOfSegment(e,t-1)),n<0&&(this._minCoord=null,this.checkForRightmostCoordinate(e)),n}},{key:"findRightmostEdgeAtVertex",value:function(){var e=this._minDe.getEdge().getCoordinates();se.isTrue(this._minIndex>0&&this._minIndex<e.length,"rightmost point expected to be interior vertex of edge");var t=e[this._minIndex-1],n=e[this._minIndex+1],i=Q.index(this._minCoord,n,t),u=!1;(t.y<this._minCoord.y&&n.y<this._minCoord.y&&i===Q.COUNTERCLOCKWISE||t.y>this._minCoord.y&&n.y>this._minCoord.y&&i===Q.CLOCKWISE)&&(u=!0),u&&(this._minIndex=this._minIndex-1)}},{key:"getRightmostSideOfSegment",value:function(e,t){var n=e.getEdge().getCoordinates();if(t<0||t+1>=n.length||n[t].y===n[t+1].y)return-1;var i=B.LEFT;return n[t].y<n[t+1].y&&(i=B.RIGHT),i}},{key:"getEdge",value:function(){return this._orientedDe}},{key:"checkForRightmostCoordinate",value:function(e){for(var t=e.getEdge().getCoordinates(),n=0;n<t.length-1;n++)(this._minCoord===null||t[n].x>this._minCoord.x)&&(this._minDe=e,this._minIndex=n,this._minCoord=t[n])}},{key:"findRightmostEdgeAtNode",value:function(){var e=this._minDe.getNode().getEdges();this._minDe=e.getRightmostEdge(),this._minDe.isForward()||(this._minDe=this._minDe.getSym(),this._minIndex=this._minDe.getEdge().getCoordinates().length-1)}},{key:"findEdge",value:function(e){for(var t=e.iterator();t.hasNext();){var n=t.next();n.isForward()&&this.checkForRightmostCoordinate(n)}se.isTrue(this._minIndex!==0||this._minCoord.equals(this._minDe.getCoordinate()),"inconsistency in rightmost processing"),this._minIndex===0?this.findRightmostEdgeAtNode():this.findRightmostEdgeAtVertex(),this._orientedDe=this._minDe,this.getRightmostSide(this._minDe,this._minIndex)===B.LEFT&&(this._orientedDe=this._minDe.getSym())}}],[{key:"constructor_",value:function(){this._minIndex=-1,this._minCoord=null,this._minDe=null,this._orientedDe=null}}]),s}(),_t=function(s){h(t,s);var e=k(t);function t(n,i){var u;return a(this,t),(u=e.call(this,i?n+" [ "+i+" ]":n)).pt=i?new O(i):void 0,u.name=Object.keys({TopologyException:t})[0],u}return c(t,[{key:"getCoordinate",value:function(){return this.pt}}]),t}(we),Tm=function(){function s(){a(this,s),this.array=[]}return c(s,[{key:"addLast",value:function(e){this.array.push(e)}},{key:"removeFirst",value:function(){return this.array.shift()}},{key:"isEmpty",value:function(){return this.array.length===0}}]),s}(),Z=function(s,e){h(n,s);var t=k(n);function n(i){var u;return a(this,n),(u=t.call(this)).array=[],i instanceof ct&&u.addAll(i),u}return c(n,[{key:"interfaces_",get:function(){return[Yt,ct]}},{key:"ensureCapacity",value:function(){}},{key:"add",value:function(i){return arguments.length===1?this.array.push(i):this.array.splice(arguments[0],0,arguments[1]),!0}},{key:"clear",value:function(){this.array=[]}},{key:"addAll",value:function(i){var u,f=P(i);try{for(f.s();!(u=f.n()).done;){var g=u.value;this.array.push(g)}}catch(y){f.e(y)}finally{f.f()}}},{key:"set",value:function(i,u){var f=this.array[i];return this.array[i]=u,f}},{key:"iterator",value:function(){return new Lm(this)}},{key:"get",value:function(i){if(i<0||i>=this.size())throw new zl;return this.array[i]}},{key:"isEmpty",value:function(){return this.array.length===0}},{key:"sort",value:function(i){i?this.array.sort(function(u,f){return i.compare(u,f)}):this.array.sort()}},{key:"size",value:function(){return this.array.length}},{key:"toArray",value:function(){return this.array.slice()}},{key:"remove",value:function(i){for(var u=0,f=this.array.length;u<f;u++)if(this.array[u]===i)return!!this.array.splice(u,1);return!1}},{key:e,value:function(){return this.array.values()}}]),n}(Yt,Symbol.iterator),Lm=function(){function s(e){a(this,s),this.arrayList=e,this.position=0}return c(s,[{key:"next",value:function(){if(this.position===this.arrayList.size())throw new Zr;return this.arrayList.get(this.position++)}},{key:"hasNext",value:function(){return this.position<this.arrayList.size()}},{key:"set",value:function(e){return this.arrayList.set(this.position-1,e)}},{key:"remove",value:function(){this.arrayList.remove(this.arrayList.get(this.position))}}]),s}(),Rm=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"clearVisitedEdges",value:function(){for(var e=this._dirEdgeList.iterator();e.hasNext();)e.next().setVisited(!1)}},{key:"getRightmostCoordinate",value:function(){return this._rightMostCoord}},{key:"computeNodeDepth",value:function(e){for(var t=null,n=e.getEdges().iterator();n.hasNext();){var i=n.next();if(i.isVisited()||i.getSym().isVisited()){t=i;break}}if(t===null)throw new _t("unable to find edge to compute depths at "+e.getCoordinate());e.getEdges().computeDepths(t);for(var u=e.getEdges().iterator();u.hasNext();){var f=u.next();f.setVisited(!0),this.copySymDepths(f)}}},{key:"computeDepth",value:function(e){this.clearVisitedEdges();var t=this._finder.getEdge();t.getNode(),t.getLabel(),t.setEdgeDepths(B.RIGHT,e),this.copySymDepths(t),this.computeDepths(t)}},{key:"create",value:function(e){this.addReachable(e),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()}},{key:"findResultEdges",value:function(){for(var e=this._dirEdgeList.iterator();e.hasNext();){var t=e.next();t.getDepth(B.RIGHT)>=1&&t.getDepth(B.LEFT)<=0&&!t.isInteriorAreaEdge()&&t.setInResult(!0)}}},{key:"computeDepths",value:function(e){var t=new Ms,n=new Tm,i=e.getNode();for(n.addLast(i),t.add(i),e.setVisited(!0);!n.isEmpty();){var u=n.removeFirst();t.add(u),this.computeNodeDepth(u);for(var f=u.getEdges().iterator();f.hasNext();){var g=f.next().getSym();if(!g.isVisited()){var y=g.getNode();t.contains(y)||(n.addLast(y),t.add(y))}}}}},{key:"compareTo",value:function(e){var t=e;return this._rightMostCoord.x<t._rightMostCoord.x?-1:this._rightMostCoord.x>t._rightMostCoord.x?1:0}},{key:"getEnvelope",value:function(){if(this._env===null){for(var e=new pe,t=this._dirEdgeList.iterator();t.hasNext();)for(var n=t.next().getEdge().getCoordinates(),i=0;i<n.length-1;i++)e.expandToInclude(n[i]);this._env=e}return this._env}},{key:"addReachable",value:function(e){var t=new bm;for(t.add(e);!t.empty();){var n=t.pop();this.add(n,t)}}},{key:"copySymDepths",value:function(e){var t=e.getSym();t.setDepth(B.LEFT,e.getDepth(B.RIGHT)),t.setDepth(B.RIGHT,e.getDepth(B.LEFT))}},{key:"add",value:function(e,t){e.setVisited(!0),this._nodes.add(e);for(var n=e.getEdges().iterator();n.hasNext();){var i=n.next();this._dirEdgeList.add(i);var u=i.getSym().getNode();u.isVisited()||t.push(u)}}},{key:"getNodes",value:function(){return this._nodes}},{key:"getDirectedEdges",value:function(){return this._dirEdgeList}},{key:"interfaces_",get:function(){return[Y]}}],[{key:"constructor_",value:function(){this._finder=null,this._dirEdgeList=new Z,this._nodes=new Z,this._rightMostCoord=null,this._env=null,this._finder=new Om}}]),s}(),$s=function(){function s(){a(this,s)}return c(s,null,[{key:"intersection",value:function(e,t,n,i){var u=e.x<t.x?e.x:t.x,f=e.y<t.y?e.y:t.y,g=e.x>t.x?e.x:t.x,y=e.y>t.y?e.y:t.y,d=n.x<i.x?n.x:i.x,N=n.y<i.y?n.y:i.y,b=n.x>i.x?n.x:i.x,L=n.y>i.y?n.y:i.y,$=((u>d?u:d)+(g<b?g:b))/2,F=((f>N?f:N)+(y<L?y:L))/2,V=e.x-$,H=e.y-F,K=t.x-$,ge=t.y-F,xe=n.x-$,Re=n.y-F,Ge=i.x-$,rt=i.y-F,kt=H-ge,Zt=K-V,er=V*ge-K*H,tr=Re-rt,wn=Ge-xe,Oc=xe*rt-Ge*Re,Tc=kt*wn-tr*Zt,ea=(Zt*Oc-wn*er)/Tc,ta=(tr*er-kt*Oc)/Tc;return j.isNaN(ea)||j.isInfinite(ea)||j.isNaN(ta)||j.isInfinite(ta)?null:new O(ea+$,ta+F)}}]),s}(),je=function(){function s(){a(this,s)}return c(s,null,[{key:"arraycopy",value:function(e,t,n,i,u){for(var f=0,g=t;g<t+u;g++)n[i+f]=e[g],f++}},{key:"getProperty",value:function(e){return{"line.separator":`
28
- `}[e]}}]),s}(),jn=function(){function s(){a(this,s)}return c(s,null,[{key:"log10",value:function(e){var t=Math.log(e);return j.isInfinite(t)||j.isNaN(t)?t:t/s.LOG_10}},{key:"min",value:function(e,t,n,i){var u=e;return t<u&&(u=t),n<u&&(u=n),i<u&&(u=i),u}},{key:"clamp",value:function(){if(typeof arguments[2]=="number"&&typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var e=arguments[0],t=arguments[1],n=arguments[2];return e<t?t:e>n?n:e}if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var i=arguments[0],u=arguments[1],f=arguments[2];return i<u?u:i>f?f:i}}},{key:"wrap",value:function(e,t){return e<0?t- -e%t:e%t}},{key:"max",value:function(){if(arguments.length===3){var e=arguments[0],t=arguments[1],n=arguments[2],i=e;return t>i&&(i=t),n>i&&(i=n),i}if(arguments.length===4){var u=arguments[0],f=arguments[1],g=arguments[2],y=arguments[3],d=u;return f>d&&(d=f),g>d&&(d=g),y>d&&(d=y),d}}},{key:"average",value:function(e,t){return(e+t)/2}}]),s}();jn.LOG_10=Math.log(10);var ft=function(){function s(){a(this,s)}return c(s,null,[{key:"segmentToSegment",value:function(e,t,n,i){if(e.equals(t))return s.pointToSegment(e,n,i);if(n.equals(i))return s.pointToSegment(i,e,t);var u=!1;if(pe.intersects(e,t,n,i)){var f=(t.x-e.x)*(i.y-n.y)-(t.y-e.y)*(i.x-n.x);if(f===0)u=!0;else{var g=(e.y-n.y)*(i.x-n.x)-(e.x-n.x)*(i.y-n.y),y=((e.y-n.y)*(t.x-e.x)-(e.x-n.x)*(t.y-e.y))/f,d=g/f;(d<0||d>1||y<0||y>1)&&(u=!0)}}else u=!0;return u?jn.min(s.pointToSegment(e,n,i),s.pointToSegment(t,n,i),s.pointToSegment(n,e,t),s.pointToSegment(i,e,t)):0}},{key:"pointToSegment",value:function(e,t,n){if(t.x===n.x&&t.y===n.y)return e.distance(t);var i=(n.x-t.x)*(n.x-t.x)+(n.y-t.y)*(n.y-t.y),u=((e.x-t.x)*(n.x-t.x)+(e.y-t.y)*(n.y-t.y))/i;if(u<=0)return e.distance(t);if(u>=1)return e.distance(n);var f=((t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y))/i;return Math.abs(f)*Math.sqrt(i)}},{key:"pointToLinePerpendicular",value:function(e,t,n){var i=(n.x-t.x)*(n.x-t.x)+(n.y-t.y)*(n.y-t.y),u=((t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y))/i;return Math.abs(u)*Math.sqrt(i)}},{key:"pointToSegmentString",value:function(e,t){if(t.length===0)throw new M("Line array must contain at least one vertex");for(var n=e.distance(t[0]),i=0;i<t.length-1;i++){var u=s.pointToSegment(e,t[i],t[i+1]);u<n&&(n=u)}return n}}]),s}(),Yl=function(){function s(){a(this,s)}return c(s,[{key:"create",value:function(){if(arguments.length===1)arguments[0]instanceof Array||re(arguments[0],le);else if(arguments.length!==2){if(arguments.length===3){var e=arguments[0],t=arguments[1];return this.create(e,t)}}}}]),s}(),Qr=function(){function s(){a(this,s)}return c(s,[{key:"filter",value:function(e){}}]),s}(),Cm=function(){function s(){a(this,s)}return c(s,null,[{key:"ofLine",value:function(e){var t=e.size();if(t<=1)return 0;var n=0,i=new O;e.getCoordinate(0,i);for(var u=i.x,f=i.y,g=1;g<t;g++){e.getCoordinate(g,i);var y=i.x,d=i.y,N=y-u,b=d-f;n+=Math.sqrt(N*N+b*b),u=y,f=d}return n}}]),s}(),Ul=function s(){a(this,s)},Ut=function(){function s(){a(this,s)}return c(s,null,[{key:"copyCoord",value:function(e,t,n,i){for(var u=Math.min(e.getDimension(),n.getDimension()),f=0;f<u;f++)n.setOrdinate(i,f,e.getOrdinate(t,f))}},{key:"isRing",value:function(e){var t=e.size();return t===0||!(t<=3)&&e.getOrdinate(0,le.X)===e.getOrdinate(t-1,le.X)&&e.getOrdinate(0,le.Y)===e.getOrdinate(t-1,le.Y)}},{key:"scroll",value:function(){if(arguments.length===2){if(re(arguments[0],le)&&Number.isInteger(arguments[1])){var e=arguments[0],t=arguments[1];s.scroll(e,t,s.isRing(e))}else if(re(arguments[0],le)&&arguments[1]instanceof O){var n=arguments[0],i=arguments[1],u=s.indexOf(i,n);if(u<=0)return null;s.scroll(n,u)}}else if(arguments.length===3){var f=arguments[0],g=arguments[1],y=arguments[2],d=g;if(d<=0)return null;for(var N=f.copy(),b=y?f.size()-1:f.size(),L=0;L<b;L++)for(var $=0;$<f.getDimension();$++)f.setOrdinate(L,$,N.getOrdinate((g+L)%b,$));if(y)for(var F=0;F<f.getDimension();F++)f.setOrdinate(b,F,f.getOrdinate(0,F))}}},{key:"isEqual",value:function(e,t){var n=e.size();if(n!==t.size())return!1;for(var i=Math.min(e.getDimension(),t.getDimension()),u=0;u<n;u++)for(var f=0;f<i;f++){var g=e.getOrdinate(u,f),y=t.getOrdinate(u,f);if(e.getOrdinate(u,f)!==t.getOrdinate(u,f)&&(!j.isNaN(g)||!j.isNaN(y)))return!1}return!0}},{key:"minCoordinateIndex",value:function(){if(arguments.length===1){var e=arguments[0];return s.minCoordinateIndex(e,0,e.size()-1)}if(arguments.length===3){for(var t=arguments[0],n=arguments[1],i=arguments[2],u=-1,f=null,g=n;g<=i;g++){var y=t.getCoordinate(g);(f===null||f.compareTo(y)>0)&&(f=y,u=g)}return u}}},{key:"extend",value:function(e,t,n){var i=e.create(n,t.getDimension()),u=t.size();if(s.copy(t,0,i,0,u),u>0)for(var f=u;f<n;f++)s.copy(t,u-1,i,f,1);return i}},{key:"reverse",value:function(e){for(var t=e.size()-1,n=Math.trunc(t/2),i=0;i<=n;i++)s.swap(e,i,t-i)}},{key:"swap",value:function(e,t,n){if(t===n)return null;for(var i=0;i<e.getDimension();i++){var u=e.getOrdinate(t,i);e.setOrdinate(t,i,e.getOrdinate(n,i)),e.setOrdinate(n,i,u)}}},{key:"copy",value:function(e,t,n,i,u){for(var f=0;f<u;f++)s.copyCoord(e,t+f,n,i+f)}},{key:"ensureValidRing",value:function(e,t){var n=t.size();return n===0?t:n<=3?s.createClosedRing(e,t,4):t.getOrdinate(0,le.X)===t.getOrdinate(n-1,le.X)&&t.getOrdinate(0,le.Y)===t.getOrdinate(n-1,le.Y)?t:s.createClosedRing(e,t,n+1)}},{key:"indexOf",value:function(e,t){for(var n=0;n<t.size();n++)if(e.x===t.getOrdinate(n,le.X)&&e.y===t.getOrdinate(n,le.Y))return n;return-1}},{key:"createClosedRing",value:function(e,t,n){var i=e.create(n,t.getDimension()),u=t.size();s.copy(t,0,i,0,u);for(var f=u;f<n;f++)s.copy(t,0,i,f,1);return i}},{key:"minCoordinate",value:function(e){for(var t=null,n=0;n<e.size();n++){var i=e.getCoordinate(n);(t===null||t.compareTo(i)>0)&&(t=i)}return t}}]),s}(),z=function(){function s(){a(this,s)}return c(s,null,[{key:"toDimensionSymbol",value:function(e){switch(e){case s.FALSE:return s.SYM_FALSE;case s.TRUE:return s.SYM_TRUE;case s.DONTCARE:return s.SYM_DONTCARE;case s.P:return s.SYM_P;case s.L:return s.SYM_L;case s.A:return s.SYM_A}throw new M("Unknown dimension value: "+e)}},{key:"toDimensionValue",value:function(e){switch(Ds.toUpperCase(e)){case s.SYM_FALSE:return s.FALSE;case s.SYM_TRUE:return s.TRUE;case s.SYM_DONTCARE:return s.DONTCARE;case s.SYM_P:return s.P;case s.SYM_L:return s.L;case s.SYM_A:return s.A}throw new M("Unknown dimension symbol: "+e)}}]),s}();z.P=0,z.L=1,z.A=2,z.FALSE=-1,z.TRUE=-2,z.DONTCARE=-3,z.SYM_FALSE="F",z.SYM_TRUE="T",z.SYM_DONTCARE="*",z.SYM_P="0",z.SYM_L="1",z.SYM_A="2";var Kr=function(){function s(){a(this,s)}return c(s,[{key:"filter",value:function(e){}}]),s}(),ei=function(){function s(){a(this,s)}return c(s,[{key:"filter",value:function(e,t){}},{key:"isDone",value:function(){}},{key:"isGeometryChanged",value:function(){}}]),s}(),Vn=function(s){h(t,s);var e=k(t);function t(){var n;return a(this,t),n=e.call(this),t.constructor_.apply(m(n),arguments),n}return c(t,[{key:"computeEnvelopeInternal",value:function(){return this.isEmpty()?new pe:this._points.expandEnvelope(new pe)}},{key:"isRing",value:function(){return this.isClosed()&&this.isSimple()}},{key:"getCoordinates",value:function(){return this._points.toCoordinateArray()}},{key:"copyInternal",value:function(){return new t(this._points.copy(),this._factory)}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof W){var n=arguments[0],i=arguments[1];if(!this.isEquivalentClass(n))return!1;var u=n;if(this._points.size()!==u._points.size())return!1;for(var f=0;f<this._points.size();f++)if(!this.equal(this._points.getCoordinate(f),u._points.getCoordinate(f),i))return!1;return!0}return w(v(t.prototype),"equalsExact",this).apply(this,arguments)}},{key:"normalize",value:function(){for(var n=0;n<Math.trunc(this._points.size()/2);n++){var i=this._points.size()-1-n;if(!this._points.getCoordinate(n).equals(this._points.getCoordinate(i))){if(this._points.getCoordinate(n).compareTo(this._points.getCoordinate(i))>0){var u=this._points.copy();Ut.reverse(u),this._points=u}return null}}}},{key:"getCoordinate",value:function(){return this.isEmpty()?null:this._points.getCoordinate(0)}},{key:"getBoundaryDimension",value:function(){return this.isClosed()?z.FALSE:0}},{key:"isClosed",value:function(){return!this.isEmpty()&&this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints()-1))}},{key:"reverseInternal",value:function(){var n=this._points.copy();return Ut.reverse(n),this.getFactory().createLineString(n)}},{key:"getEndPoint",value:function(){return this.isEmpty()?null:this.getPointN(this.getNumPoints()-1)}},{key:"getTypeCode",value:function(){return W.TYPECODE_LINESTRING}},{key:"getDimension",value:function(){return 1}},{key:"getLength",value:function(){return Cm.ofLine(this._points)}},{key:"getNumPoints",value:function(){return this._points.size()}},{key:"compareToSameClass",value:function(){if(arguments.length===1){for(var n=arguments[0],i=n,u=0,f=0;u<this._points.size()&&f<i._points.size();){var g=this._points.getCoordinate(u).compareTo(i._points.getCoordinate(f));if(g!==0)return g;u++,f++}return u<this._points.size()?1:f<i._points.size()?-1:0}if(arguments.length===2){var y=arguments[0],d=arguments[1],N=y;return d.compare(this._points,N._points)}}},{key:"apply",value:function(){if(re(arguments[0],Qr))for(var n=arguments[0],i=0;i<this._points.size();i++)n.filter(this._points.getCoordinate(i));else if(re(arguments[0],ei)){var u=arguments[0];if(this._points.size()===0)return null;for(var f=0;f<this._points.size()&&(u.filter(this._points,f),!u.isDone());f++);u.isGeometryChanged()&&this.geometryChanged()}else if(re(arguments[0],Kr)){var g=arguments[0];g.filter(this)}else if(re(arguments[0],G)){var y=arguments[0];y.filter(this)}}},{key:"getBoundary",value:function(){throw new At}},{key:"isEquivalentClass",value:function(n){return n instanceof t}},{key:"getCoordinateN",value:function(n){return this._points.getCoordinate(n)}},{key:"getGeometryType",value:function(){return W.TYPENAME_LINESTRING}},{key:"getCoordinateSequence",value:function(){return this._points}},{key:"isEmpty",value:function(){return this._points.size()===0}},{key:"init",value:function(n){if(n===null&&(n=this.getFactory().getCoordinateSequenceFactory().create([])),n.size()===1)throw new M("Invalid number of points in LineString (found "+n.size()+" - must be 0 or >= 2)");this._points=n}},{key:"isCoordinate",value:function(n){for(var i=0;i<this._points.size();i++)if(this._points.getCoordinate(i).equals(n))return!0;return!1}},{key:"getStartPoint",value:function(){return this.isEmpty()?null:this.getPointN(0)}},{key:"getPointN",value:function(n){return this.getFactory().createPoint(this._points.getCoordinate(n))}},{key:"interfaces_",get:function(){return[Ul]}}],[{key:"constructor_",value:function(){if(this._points=null,arguments.length!==0){if(arguments.length===2){var n=arguments[0],i=arguments[1];W.constructor_.call(this,i),this.init(n)}}}}]),t}(W),Xl=function s(){a(this,s)},Bs=function(s){h(t,s);var e=k(t);function t(){var n;return a(this,t),n=e.call(this),t.constructor_.apply(m(n),arguments),n}return c(t,[{key:"computeEnvelopeInternal",value:function(){if(this.isEmpty())return new pe;var n=new pe;return n.expandToInclude(this._coordinates.getX(0),this._coordinates.getY(0)),n}},{key:"getCoordinates",value:function(){return this.isEmpty()?[]:[this.getCoordinate()]}},{key:"copyInternal",value:function(){return new t(this._coordinates.copy(),this._factory)}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof W){var n=arguments[0],i=arguments[1];return!!this.isEquivalentClass(n)&&(!(!this.isEmpty()||!n.isEmpty())||this.isEmpty()===n.isEmpty()&&this.equal(n.getCoordinate(),this.getCoordinate(),i))}return w(v(t.prototype),"equalsExact",this).apply(this,arguments)}},{key:"normalize",value:function(){}},{key:"getCoordinate",value:function(){return this._coordinates.size()!==0?this._coordinates.getCoordinate(0):null}},{key:"getBoundaryDimension",value:function(){return z.FALSE}},{key:"reverseInternal",value:function(){return this.getFactory().createPoint(this._coordinates.copy())}},{key:"getTypeCode",value:function(){return W.TYPECODE_POINT}},{key:"getDimension",value:function(){return 0}},{key:"getNumPoints",value:function(){return this.isEmpty()?0:1}},{key:"getX",value:function(){if(this.getCoordinate()===null)throw new IllegalStateException("getX called on empty Point");return this.getCoordinate().x}},{key:"compareToSameClass",value:function(){if(arguments.length===1){var n=arguments[0],i=n;return this.getCoordinate().compareTo(i.getCoordinate())}if(arguments.length===2){var u=arguments[0],f=arguments[1],g=u;return f.compare(this._coordinates,g._coordinates)}}},{key:"apply",value:function(){if(re(arguments[0],Qr)){var n=arguments[0];if(this.isEmpty())return null;n.filter(this.getCoordinate())}else if(re(arguments[0],ei)){var i=arguments[0];if(this.isEmpty())return null;i.filter(this._coordinates,0),i.isGeometryChanged()&&this.geometryChanged()}else if(re(arguments[0],Kr)){var u=arguments[0];u.filter(this)}else if(re(arguments[0],G)){var f=arguments[0];f.filter(this)}}},{key:"getBoundary",value:function(){return this.getFactory().createGeometryCollection()}},{key:"getGeometryType",value:function(){return W.TYPENAME_POINT}},{key:"getCoordinateSequence",value:function(){return this._coordinates}},{key:"getY",value:function(){if(this.getCoordinate()===null)throw new IllegalStateException("getY called on empty Point");return this.getCoordinate().y}},{key:"isEmpty",value:function(){return this._coordinates.size()===0}},{key:"init",value:function(n){n===null&&(n=this.getFactory().getCoordinateSequenceFactory().create([])),se.isTrue(n.size()<=1),this._coordinates=n}},{key:"isSimple",value:function(){return!0}},{key:"interfaces_",get:function(){return[Xl]}}],[{key:"constructor_",value:function(){this._coordinates=null;var n=arguments[0],i=arguments[1];W.constructor_.call(this,i),this.init(n)}}]),t}(W),jl=function(){function s(){a(this,s)}return c(s,null,[{key:"ofRing",value:function(){if(arguments[0]instanceof Array){var e=arguments[0];return Math.abs(s.ofRingSigned(e))}if(re(arguments[0],le)){var t=arguments[0];return Math.abs(s.ofRingSigned(t))}}},{key:"ofRingSigned",value:function(){if(arguments[0]instanceof Array){var e=arguments[0];if(e.length<3)return 0;for(var t=0,n=e[0].x,i=1;i<e.length-1;i++){var u=e[i].x-n,f=e[i+1].y,g=e[i-1].y;t+=u*(g-f)}return t/2}if(re(arguments[0],le)){var y=arguments[0],d=y.size();if(d<3)return 0;var N=new O,b=new O,L=new O;y.getCoordinate(0,b),y.getCoordinate(1,L);var $=b.x;L.x-=$;for(var F=0,V=1;V<d-1;V++)N.y=b.y,b.x=L.x,b.y=L.y,y.getCoordinate(V+1,L),L.x-=$,F+=b.x*(N.y-L.y);return F/2}}}]),s}(),Xt=function(){function s(){a(this,s)}return c(s,null,[{key:"sort",value:function(){var e=arguments,t=arguments[0];if(arguments.length===1)t.sort(function($,F){return $.compareTo(F)});else if(arguments.length===2)t.sort(function($,F){return e[1].compare($,F)});else if(arguments.length===3){var n=t.slice(arguments[1],arguments[2]);n.sort();var i=t.slice(0,arguments[1]).concat(n,t.slice(arguments[2],t.length));t.splice(0,t.length);var u,f=P(i);try{for(f.s();!(u=f.n()).done;){var g=u.value;t.push(g)}}catch($){f.e($)}finally{f.f()}}else if(arguments.length===4){var y=t.slice(arguments[1],arguments[2]);y.sort(function($,F){return e[3].compare($,F)});var d=t.slice(0,arguments[1]).concat(y,t.slice(arguments[2],t.length));t.splice(0,t.length);var N,b=P(d);try{for(b.s();!(N=b.n()).done;){var L=N.value;t.push(L)}}catch($){b.e($)}finally{b.f()}}}},{key:"asList",value:function(e){var t,n=new Z,i=P(e);try{for(i.s();!(t=i.n()).done;){var u=t.value;n.add(u)}}catch(f){i.e(f)}finally{i.f()}return n}},{key:"copyOf",value:function(e,t){return e.slice(0,t)}}]),s}(),Vl=function s(){a(this,s)},ti=function(s){h(t,s);var e=k(t);function t(){var n;return a(this,t),n=e.call(this),t.constructor_.apply(m(n),arguments),n}return c(t,[{key:"computeEnvelopeInternal",value:function(){return this._shell.getEnvelopeInternal()}},{key:"getCoordinates",value:function(){if(this.isEmpty())return[];for(var n=new Array(this.getNumPoints()).fill(null),i=-1,u=this._shell.getCoordinates(),f=0;f<u.length;f++)n[++i]=u[f];for(var g=0;g<this._holes.length;g++)for(var y=this._holes[g].getCoordinates(),d=0;d<y.length;d++)n[++i]=y[d];return n}},{key:"getArea",value:function(){var n=0;n+=jl.ofRing(this._shell.getCoordinateSequence());for(var i=0;i<this._holes.length;i++)n-=jl.ofRing(this._holes[i].getCoordinateSequence());return n}},{key:"copyInternal",value:function(){for(var n=this._shell.copy(),i=new Array(this._holes.length).fill(null),u=0;u<this._holes.length;u++)i[u]=this._holes[u].copy();return new t(n,i,this._factory)}},{key:"isRectangle",value:function(){if(this.getNumInteriorRing()!==0||this._shell===null||this._shell.getNumPoints()!==5)return!1;for(var n=this._shell.getCoordinateSequence(),i=this.getEnvelopeInternal(),u=0;u<5;u++){var f=n.getX(u);if(f!==i.getMinX()&&f!==i.getMaxX())return!1;var g=n.getY(u);if(g!==i.getMinY()&&g!==i.getMaxY())return!1}for(var y=n.getX(0),d=n.getY(0),N=1;N<=4;N++){var b=n.getX(N),L=n.getY(N);if(b!==y==(L!==d))return!1;y=b,d=L}return!0}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof W){var n=arguments[0],i=arguments[1];if(!this.isEquivalentClass(n))return!1;var u=n,f=this._shell,g=u._shell;if(!f.equalsExact(g,i)||this._holes.length!==u._holes.length)return!1;for(var y=0;y<this._holes.length;y++)if(!this._holes[y].equalsExact(u._holes[y],i))return!1;return!0}return w(v(t.prototype),"equalsExact",this).apply(this,arguments)}},{key:"normalize",value:function(){if(arguments.length===0){this._shell=this.normalized(this._shell,!0);for(var n=0;n<this._holes.length;n++)this._holes[n]=this.normalized(this._holes[n],!1);Xt.sort(this._holes)}else if(arguments.length===2){var i=arguments[0],u=arguments[1];if(i.isEmpty())return null;var f=i.getCoordinateSequence(),g=Ut.minCoordinateIndex(f,0,f.size()-2);Ut.scroll(f,g,!0),Q.isCCW(f)===u&&Ut.reverse(f)}}},{key:"getCoordinate",value:function(){return this._shell.getCoordinate()}},{key:"getNumInteriorRing",value:function(){return this._holes.length}},{key:"getBoundaryDimension",value:function(){return 1}},{key:"reverseInternal",value:function(){for(var n=this.getExteriorRing().reverse(),i=new Array(this.getNumInteriorRing()).fill(null),u=0;u<i.length;u++)i[u]=this.getInteriorRingN(u).reverse();return this.getFactory().createPolygon(n,i)}},{key:"getTypeCode",value:function(){return W.TYPECODE_POLYGON}},{key:"getDimension",value:function(){return 2}},{key:"getLength",value:function(){var n=0;n+=this._shell.getLength();for(var i=0;i<this._holes.length;i++)n+=this._holes[i].getLength();return n}},{key:"getNumPoints",value:function(){for(var n=this._shell.getNumPoints(),i=0;i<this._holes.length;i++)n+=this._holes[i].getNumPoints();return n}},{key:"convexHull",value:function(){return this.getExteriorRing().convexHull()}},{key:"normalized",value:function(n,i){var u=n.copy();return this.normalize(u,i),u}},{key:"compareToSameClass",value:function(){if(arguments.length===1){var n=arguments[0],i=this._shell,u=n._shell;return i.compareToSameClass(u)}if(arguments.length===2){var f=arguments[0],g=arguments[1],y=f,d=this._shell,N=y._shell,b=d.compareToSameClass(N,g);if(b!==0)return b;for(var L=this.getNumInteriorRing(),$=y.getNumInteriorRing(),F=0;F<L&&F<$;){var V=this.getInteriorRingN(F),H=y.getInteriorRingN(F),K=V.compareToSameClass(H,g);if(K!==0)return K;F++}return F<L?1:F<$?-1:0}}},{key:"apply",value:function(){if(re(arguments[0],Qr)){var n=arguments[0];this._shell.apply(n);for(var i=0;i<this._holes.length;i++)this._holes[i].apply(n)}else if(re(arguments[0],ei)){var u=arguments[0];if(this._shell.apply(u),!u.isDone())for(var f=0;f<this._holes.length&&(this._holes[f].apply(u),!u.isDone());f++);u.isGeometryChanged()&&this.geometryChanged()}else if(re(arguments[0],Kr)){var g=arguments[0];g.filter(this)}else if(re(arguments[0],G)){var y=arguments[0];y.filter(this),this._shell.apply(y);for(var d=0;d<this._holes.length;d++)this._holes[d].apply(y)}}},{key:"getBoundary",value:function(){if(this.isEmpty())return this.getFactory().createMultiLineString();var n=new Array(this._holes.length+1).fill(null);n[0]=this._shell;for(var i=0;i<this._holes.length;i++)n[i+1]=this._holes[i];return n.length<=1?this.getFactory().createLinearRing(n[0].getCoordinateSequence()):this.getFactory().createMultiLineString(n)}},{key:"getGeometryType",value:function(){return W.TYPENAME_POLYGON}},{key:"getExteriorRing",value:function(){return this._shell}},{key:"isEmpty",value:function(){return this._shell.isEmpty()}},{key:"getInteriorRingN",value:function(n){return this._holes[n]}},{key:"interfaces_",get:function(){return[Vl]}}],[{key:"constructor_",value:function(){this._shell=null,this._holes=null;var n=arguments[0],i=arguments[1],u=arguments[2];if(W.constructor_.call(this,u),n===null&&(n=this.getFactory().createLinearRing()),i===null&&(i=[]),W.hasNullElements(i))throw new M("holes must not contain null elements");if(n.isEmpty()&&W.hasNonEmptyElements(i))throw new M("shell is empty but holes are not");this._shell=n,this._holes=i}}]),t}(W),Pm=function(s){h(t,s);var e=k(t);function t(){return a(this,t),e.apply(this,arguments)}return t}(Gl),Wl=function(s){h(t,s);var e=k(t);function t(n){var i;return a(this,t),(i=e.call(this)).array=[],n instanceof ct&&i.addAll(n),i}return c(t,[{key:"contains",value:function(n){var i,u=P(this.array);try{for(u.s();!(i=u.n()).done;)if(i.value.compareTo(n)===0)return!0}catch(f){u.e(f)}finally{u.f()}return!1}},{key:"add",value:function(n){if(this.contains(n))return!1;for(var i=0,u=this.array.length;i<u;i++)if(this.array[i].compareTo(n)===1)return!!this.array.splice(i,0,n);return this.array.push(n),!0}},{key:"addAll",value:function(n){var i,u=P(n);try{for(u.s();!(i=u.n()).done;){var f=i.value;this.add(f)}}catch(g){u.e(g)}finally{u.f()}return!0}},{key:"remove",value:function(){throw new At}},{key:"size",value:function(){return this.array.length}},{key:"isEmpty",value:function(){return this.array.length===0}},{key:"toArray",value:function(){return this.array.slice()}},{key:"iterator",value:function(){return new Am(this.array)}}]),t}(Pm),Am=function(){function s(e){a(this,s),this.array=e,this.position=0}return c(s,[{key:"next",value:function(){if(this.position===this.array.length)throw new Zr;return this.array[this.position++]}},{key:"hasNext",value:function(){return this.position<this.array.length}},{key:"remove",value:function(){throw new At}}]),s}(),Fe=function(s){h(t,s);var e=k(t);function t(){var n;return a(this,t),n=e.call(this),t.constructor_.apply(m(n),arguments),n}return c(t,[{key:"computeEnvelopeInternal",value:function(){for(var n=new pe,i=0;i<this._geometries.length;i++)n.expandToInclude(this._geometries[i].getEnvelopeInternal());return n}},{key:"getGeometryN",value:function(n){return this._geometries[n]}},{key:"getCoordinates",value:function(){for(var n=new Array(this.getNumPoints()).fill(null),i=-1,u=0;u<this._geometries.length;u++)for(var f=this._geometries[u].getCoordinates(),g=0;g<f.length;g++)n[++i]=f[g];return n}},{key:"getArea",value:function(){for(var n=0,i=0;i<this._geometries.length;i++)n+=this._geometries[i].getArea();return n}},{key:"copyInternal",value:function(){for(var n=new Array(this._geometries.length).fill(null),i=0;i<n.length;i++)n[i]=this._geometries[i].copy();return new t(n,this._factory)}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof W){var n=arguments[0],i=arguments[1];if(!this.isEquivalentClass(n))return!1;var u=n;if(this._geometries.length!==u._geometries.length)return!1;for(var f=0;f<this._geometries.length;f++)if(!this._geometries[f].equalsExact(u._geometries[f],i))return!1;return!0}return w(v(t.prototype),"equalsExact",this).apply(this,arguments)}},{key:"normalize",value:function(){for(var n=0;n<this._geometries.length;n++)this._geometries[n].normalize();Xt.sort(this._geometries)}},{key:"getCoordinate",value:function(){return this.isEmpty()?null:this._geometries[0].getCoordinate()}},{key:"getBoundaryDimension",value:function(){for(var n=z.FALSE,i=0;i<this._geometries.length;i++)n=Math.max(n,this._geometries[i].getBoundaryDimension());return n}},{key:"reverseInternal",value:function(){for(var n=this._geometries.length,i=new Z(n),u=0;u<n;u++)i.add(this._geometries[u].reverse());return this.getFactory().buildGeometry(i)}},{key:"getTypeCode",value:function(){return W.TYPECODE_GEOMETRYCOLLECTION}},{key:"getDimension",value:function(){for(var n=z.FALSE,i=0;i<this._geometries.length;i++)n=Math.max(n,this._geometries[i].getDimension());return n}},{key:"getLength",value:function(){for(var n=0,i=0;i<this._geometries.length;i++)n+=this._geometries[i].getLength();return n}},{key:"getNumPoints",value:function(){for(var n=0,i=0;i<this._geometries.length;i++)n+=this._geometries[i].getNumPoints();return n}},{key:"getNumGeometries",value:function(){return this._geometries.length}},{key:"compareToSameClass",value:function(){if(arguments.length===1){var n=arguments[0],i=new Wl(Xt.asList(this._geometries)),u=new Wl(Xt.asList(n._geometries));return this.compare(i,u)}if(arguments.length===2){for(var f=arguments[0],g=arguments[1],y=f,d=this.getNumGeometries(),N=y.getNumGeometries(),b=0;b<d&&b<N;){var L=this.getGeometryN(b),$=y.getGeometryN(b),F=L.compareToSameClass($,g);if(F!==0)return F;b++}return b<d?1:b<N?-1:0}}},{key:"apply",value:function(){if(re(arguments[0],Qr))for(var n=arguments[0],i=0;i<this._geometries.length;i++)this._geometries[i].apply(n);else if(re(arguments[0],ei)){var u=arguments[0];if(this._geometries.length===0)return null;for(var f=0;f<this._geometries.length&&(this._geometries[f].apply(u),!u.isDone());f++);u.isGeometryChanged()&&this.geometryChanged()}else if(re(arguments[0],Kr)){var g=arguments[0];g.filter(this);for(var y=0;y<this._geometries.length;y++)this._geometries[y].apply(g)}else if(re(arguments[0],G)){var d=arguments[0];d.filter(this);for(var N=0;N<this._geometries.length;N++)this._geometries[N].apply(d)}}},{key:"getBoundary",value:function(){return W.checkNotGeometryCollection(this),se.shouldNeverReachHere(),null}},{key:"getGeometryType",value:function(){return W.TYPENAME_GEOMETRYCOLLECTION}},{key:"isEmpty",value:function(){for(var n=0;n<this._geometries.length;n++)if(!this._geometries[n].isEmpty())return!1;return!0}}],[{key:"constructor_",value:function(){if(this._geometries=null,arguments.length!==0){if(arguments.length===2){var n=arguments[0],i=arguments[1];if(W.constructor_.call(this,i),n===null&&(n=[]),W.hasNullElements(n))throw new M("geometries must not contain null elements");this._geometries=n}}}}]),t}(W),Gs=function(s){h(t,s);var e=k(t);function t(){var n;return a(this,t),n=e.call(this),t.constructor_.apply(m(n),arguments),n}return c(t,[{key:"copyInternal",value:function(){for(var n=new Array(this._geometries.length).fill(null),i=0;i<n.length;i++)n[i]=this._geometries[i].copy();return new t(n,this._factory)}},{key:"isValid",value:function(){return!0}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof W){var n=arguments[0],i=arguments[1];return!!this.isEquivalentClass(n)&&w(v(t.prototype),"equalsExact",this).call(this,n,i)}return w(v(t.prototype),"equalsExact",this).apply(this,arguments)}},{key:"getCoordinate",value:function(){if(arguments.length===1&&Number.isInteger(arguments[0])){var n=arguments[0];return this._geometries[n].getCoordinate()}return w(v(t.prototype),"getCoordinate",this).apply(this,arguments)}},{key:"getBoundaryDimension",value:function(){return z.FALSE}},{key:"getTypeCode",value:function(){return W.TYPECODE_MULTIPOINT}},{key:"getDimension",value:function(){return 0}},{key:"getBoundary",value:function(){return this.getFactory().createGeometryCollection()}},{key:"getGeometryType",value:function(){return W.TYPENAME_MULTIPOINT}},{key:"interfaces_",get:function(){return[Xl]}}],[{key:"constructor_",value:function(){var n=arguments[0],i=arguments[1];Fe.constructor_.call(this,n,i)}}]),t}(Fe),Wn=function(s){h(t,s);var e=k(t);function t(){var n;return a(this,t),n=e.call(this),t.constructor_.apply(m(n),arguments),n}return c(t,[{key:"copyInternal",value:function(){return new t(this._points.copy(),this._factory)}},{key:"getBoundaryDimension",value:function(){return z.FALSE}},{key:"isClosed",value:function(){return!!this.isEmpty()||w(v(t.prototype),"isClosed",this).call(this)}},{key:"reverseInternal",value:function(){var n=this._points.copy();return Ut.reverse(n),this.getFactory().createLinearRing(n)}},{key:"getTypeCode",value:function(){return W.TYPECODE_LINEARRING}},{key:"validateConstruction",value:function(){if(!this.isEmpty()&&!w(v(t.prototype),"isClosed",this).call(this))throw new M("Points of LinearRing do not form a closed linestring");if(this.getCoordinateSequence().size()>=1&&this.getCoordinateSequence().size()<t.MINIMUM_VALID_SIZE)throw new M("Invalid number of points in LinearRing (found "+this.getCoordinateSequence().size()+" - must be 0 or >= 4)")}},{key:"getGeometryType",value:function(){return W.TYPENAME_LINEARRING}}],[{key:"constructor_",value:function(){var n=arguments[0],i=arguments[1];Vn.constructor_.call(this,n,i),this.validateConstruction()}}]),t}(Vn);Wn.MINIMUM_VALID_SIZE=4;var jt=function(s){h(t,s);var e=k(t);function t(){var n;return a(this,t),n=e.call(this),t.constructor_.apply(m(n),arguments),n}return c(t,[{key:"setOrdinate",value:function(n,i){switch(n){case t.X:this.x=i;break;case t.Y:this.y=i;break;default:throw new M("Invalid ordinate index: "+n)}}},{key:"getZ",value:function(){return O.NULL_ORDINATE}},{key:"getOrdinate",value:function(n){switch(n){case t.X:return this.x;case t.Y:return this.y}throw new M("Invalid ordinate index: "+n)}},{key:"setZ",value:function(n){throw new M("CoordinateXY dimension 2 does not support z-ordinate")}},{key:"copy",value:function(){return new t(this)}},{key:"toString",value:function(){return"("+this.x+", "+this.y+")"}},{key:"setCoordinate",value:function(n){this.x=n.x,this.y=n.y,this.z=n.getZ()}}],[{key:"constructor_",value:function(){if(arguments.length===0)O.constructor_.call(this);else if(arguments.length===1){if(arguments[0]instanceof t){var n=arguments[0];O.constructor_.call(this,n.x,n.y)}else if(arguments[0]instanceof O){var i=arguments[0];O.constructor_.call(this,i.x,i.y)}}else if(arguments.length===2){var u=arguments[0],f=arguments[1];O.constructor_.call(this,u,f,O.NULL_ORDINATE)}}}]),t}(O);jt.X=0,jt.Y=1,jt.Z=-1,jt.M=-1;var Vt=function(s){h(t,s);var e=k(t);function t(){var n;return a(this,t),n=e.call(this),t.constructor_.apply(m(n),arguments),n}return c(t,[{key:"getM",value:function(){return this._m}},{key:"setOrdinate",value:function(n,i){switch(n){case t.X:this.x=i;break;case t.Y:this.y=i;break;case t.M:this._m=i;break;default:throw new M("Invalid ordinate index: "+n)}}},{key:"setM",value:function(n){this._m=n}},{key:"getZ",value:function(){return O.NULL_ORDINATE}},{key:"getOrdinate",value:function(n){switch(n){case t.X:return this.x;case t.Y:return this.y;case t.M:return this._m}throw new M("Invalid ordinate index: "+n)}},{key:"setZ",value:function(n){throw new M("CoordinateXY dimension 2 does not support z-ordinate")}},{key:"copy",value:function(){return new t(this)}},{key:"toString",value:function(){return"("+this.x+", "+this.y+" m="+this.getM()+")"}},{key:"setCoordinate",value:function(n){this.x=n.x,this.y=n.y,this.z=n.getZ(),this._m=n.getM()}}],[{key:"constructor_",value:function(){if(this._m=null,arguments.length===0)O.constructor_.call(this),this._m=0;else if(arguments.length===1){if(arguments[0]instanceof t){var n=arguments[0];O.constructor_.call(this,n.x,n.y),this._m=n._m}else if(arguments[0]instanceof O){var i=arguments[0];O.constructor_.call(this,i.x,i.y),this._m=this.getM()}}else if(arguments.length===3){var u=arguments[0],f=arguments[1],g=arguments[2];O.constructor_.call(this,u,f,O.NULL_ORDINATE),this._m=g}}}]),t}(O);Vt.X=0,Vt.Y=1,Vt.Z=-1,Vt.M=2;var qs=function(s){h(t,s);var e=k(t);function t(){var n;return a(this,t),n=e.call(this),t.constructor_.apply(m(n),arguments),n}return c(t,[{key:"getM",value:function(){return this._m}},{key:"setOrdinate",value:function(n,i){switch(n){case O.X:this.x=i;break;case O.Y:this.y=i;break;case O.Z:this.z=i;break;case O.M:this._m=i;break;default:throw new M("Invalid ordinate index: "+n)}}},{key:"setM",value:function(n){this._m=n}},{key:"getOrdinate",value:function(n){switch(n){case O.X:return this.x;case O.Y:return this.y;case O.Z:return this.getZ();case O.M:return this.getM()}throw new M("Invalid ordinate index: "+n)}},{key:"copy",value:function(){return new t(this)}},{key:"toString",value:function(){return"("+this.x+", "+this.y+", "+this.getZ()+" m="+this.getM()+")"}},{key:"setCoordinate",value:function(n){this.x=n.x,this.y=n.y,this.z=n.getZ(),this._m=n.getM()}}],[{key:"constructor_",value:function(){if(this._m=null,arguments.length===0)O.constructor_.call(this),this._m=0;else if(arguments.length===1){if(arguments[0]instanceof t){var n=arguments[0];O.constructor_.call(this,n),this._m=n._m}else if(arguments[0]instanceof O){var i=arguments[0];O.constructor_.call(this,i),this._m=this.getM()}}else if(arguments.length===4){var u=arguments[0],f=arguments[1],g=arguments[2],y=arguments[3];O.constructor_.call(this,u,f,g),this._m=y}}}]),t}(O),ni=function(){function s(){a(this,s)}return c(s,null,[{key:"measures",value:function(e){return e instanceof jt?0:e instanceof Vt||e instanceof qs?1:0}},{key:"dimension",value:function(e){return e instanceof jt?2:e instanceof Vt?3:e instanceof qs?4:3}},{key:"create",value:function(){if(arguments.length===1){var e=arguments[0];return s.create(e,0)}if(arguments.length===2){var t=arguments[0],n=arguments[1];return t===2?new jt:t===3&&n===0?new O:t===3&&n===1?new Vt:t===4&&n===1?new qs:new O}}}]),s}(),Hn=function(s){h(t,s);var e=k(t);function t(){var n;return a(this,t),n=e.call(this),t.constructor_.apply(m(n),arguments),n}return c(t,[{key:"getCoordinate",value:function(n){return this.get(n)}},{key:"addAll",value:function(){if(arguments.length===2&&typeof arguments[1]=="boolean"&&re(arguments[0],ct)){for(var n=arguments[0],i=arguments[1],u=!1,f=n.iterator();f.hasNext();)this.add(f.next(),i),u=!0;return u}return w(v(t.prototype),"addAll",this).apply(this,arguments)}},{key:"clone",value:function(){for(var n=w(v(t.prototype),"clone",this).call(this),i=0;i<this.size();i++)n.add(i,this.get(i).clone());return n}},{key:"toCoordinateArray",value:function(){if(arguments.length===0)return this.toArray(t.coordArrayType);if(arguments.length===1){var n=arguments[0];if(n)return this.toArray(t.coordArrayType);for(var i=this.size(),u=new Array(i).fill(null),f=0;f<i;f++)u[f]=this.get(i-f-1);return u}}},{key:"add",value:function(){if(arguments.length===1){var n=arguments[0];return w(v(t.prototype),"add",this).call(this,n)}if(arguments.length===2){if(arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var i=arguments[0],u=arguments[1];return this.add(i,u,!0),!0}if(arguments[0]instanceof O&&typeof arguments[1]=="boolean"){var f=arguments[0],g=arguments[1];if(!g&&this.size()>=1){var y=this.get(this.size()-1);if(y.equals2D(f))return null}w(v(t.prototype),"add",this).call(this,f)}else if(arguments[0]instanceof Object&&typeof arguments[1]=="boolean"){var d=arguments[0],N=arguments[1];return this.add(d,N),!0}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var b=arguments[0],L=arguments[1],$=arguments[2];if($)for(var F=0;F<b.length;F++)this.add(b[F],L);else for(var V=b.length-1;V>=0;V--)this.add(b[V],L);return!0}if(typeof arguments[2]=="boolean"&&Number.isInteger(arguments[0])&&arguments[1]instanceof O){var H=arguments[0],K=arguments[1],ge=arguments[2];if(!ge){var xe=this.size();if(xe>0){if(H>0){var Re=this.get(H-1);if(Re.equals2D(K))return null}if(H<xe){var Ge=this.get(H);if(Ge.equals2D(K))return null}}}w(v(t.prototype),"add",this).call(this,H,K)}}else if(arguments.length===4){var rt=arguments[0],kt=arguments[1],Zt=arguments[2],er=arguments[3],tr=1;Zt>er&&(tr=-1);for(var wn=Zt;wn!==er;wn+=tr)this.add(rt[wn],kt);return!0}}},{key:"closeRing",value:function(){if(this.size()>0){var n=this.get(0).copy();this.add(n,!1)}}}],[{key:"constructor_",value:function(){if(arguments.length!==0){if(arguments.length===1){var n=arguments[0];this.ensureCapacity(n.length),this.add(n,!0)}else if(arguments.length===2){var i=arguments[0],u=arguments[1];this.ensureCapacity(i.length),this.add(i,u)}}}}]),t}(Z);Hn.coordArrayType=new Array(0).fill(null);var Ee=function(){function s(){a(this,s)}return c(s,null,[{key:"isRing",value:function(e){return!(e.length<4)&&!!e[0].equals2D(e[e.length-1])}},{key:"ptNotInList",value:function(e,t){for(var n=0;n<e.length;n++){var i=e[n];if(s.indexOf(i,t)<0)return i}return null}},{key:"scroll",value:function(e,t){var n=s.indexOf(t,e);if(n<0)return null;var i=new Array(e.length).fill(null);je.arraycopy(e,n,i,0,e.length-n),je.arraycopy(e,0,i,e.length-n,n),je.arraycopy(i,0,e,0,e.length)}},{key:"equals",value:function(){if(arguments.length===2){var e=arguments[0],t=arguments[1];if(e===t)return!0;if(e===null||t===null||e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(!e[n].equals(t[n]))return!1;return!0}if(arguments.length===3){var i=arguments[0],u=arguments[1],f=arguments[2];if(i===u)return!0;if(i===null||u===null||i.length!==u.length)return!1;for(var g=0;g<i.length;g++)if(f.compare(i[g],u[g])!==0)return!1;return!0}}},{key:"intersection",value:function(e,t){for(var n=new Hn,i=0;i<e.length;i++)t.intersects(e[i])&&n.add(e[i],!0);return n.toCoordinateArray()}},{key:"measures",value:function(e){if(e===null||e.length===0)return 0;var t,n=0,i=P(e);try{for(i.s();!(t=i.n()).done;){var u=t.value;n=Math.max(n,ni.measures(u))}}catch(f){i.e(f)}finally{i.f()}return n}},{key:"hasRepeatedPoints",value:function(e){for(var t=1;t<e.length;t++)if(e[t-1].equals(e[t]))return!0;return!1}},{key:"removeRepeatedPoints",value:function(e){return s.hasRepeatedPoints(e)?new Hn(e,!1).toCoordinateArray():e}},{key:"reverse",value:function(e){for(var t=e.length-1,n=Math.trunc(t/2),i=0;i<=n;i++){var u=e[i];e[i]=e[t-i],e[t-i]=u}}},{key:"removeNull",value:function(e){for(var t=0,n=0;n<e.length;n++)e[n]!==null&&t++;var i=new Array(t).fill(null);if(t===0)return i;for(var u=0,f=0;f<e.length;f++)e[f]!==null&&(i[u++]=e[f]);return i}},{key:"copyDeep",value:function(){if(arguments.length===1){for(var e=arguments[0],t=new Array(e.length).fill(null),n=0;n<e.length;n++)t[n]=e[n].copy();return t}if(arguments.length===5)for(var i=arguments[0],u=arguments[1],f=arguments[2],g=arguments[3],y=arguments[4],d=0;d<y;d++)f[g+d]=i[u+d].copy()}},{key:"isEqualReversed",value:function(e,t){for(var n=0;n<e.length;n++){var i=e[n],u=t[e.length-n-1];if(i.compareTo(u)!==0)return!1}return!0}},{key:"envelope",value:function(e){for(var t=new pe,n=0;n<e.length;n++)t.expandToInclude(e[n]);return t}},{key:"toCoordinateArray",value:function(e){return e.toArray(s.coordArrayType)}},{key:"dimension",value:function(e){if(e===null||e.length===0)return 3;var t,n=0,i=P(e);try{for(i.s();!(t=i.n()).done;){var u=t.value;n=Math.max(n,ni.dimension(u))}}catch(f){i.e(f)}finally{i.f()}return n}},{key:"atLeastNCoordinatesOrNothing",value:function(e,t){return t.length>=e?t:[]}},{key:"indexOf",value:function(e,t){for(var n=0;n<t.length;n++)if(e.equals(t[n]))return n;return-1}},{key:"increasingDirection",value:function(e){for(var t=0;t<Math.trunc(e.length/2);t++){var n=e.length-1-t,i=e[t].compareTo(e[n]);if(i!==0)return i}return 1}},{key:"compare",value:function(e,t){for(var n=0;n<e.length&&n<t.length;){var i=e[n].compareTo(t[n]);if(i!==0)return i;n++}return n<t.length?-1:n<e.length?1:0}},{key:"minCoordinate",value:function(e){for(var t=null,n=0;n<e.length;n++)(t===null||t.compareTo(e[n])>0)&&(t=e[n]);return t}},{key:"extract",value:function(e,t,n){t=jn.clamp(t,0,e.length);var i=(n=jn.clamp(n,-1,e.length))-t+1;n<0&&(i=0),t>=e.length&&(i=0),n<t&&(i=0);var u=new Array(i).fill(null);if(i===0)return u;for(var f=0,g=t;g<=n;g++)u[f++]=e[g];return u}}]),s}(),Mm=function(){function s(){a(this,s)}return c(s,[{key:"compare",value:function(e,t){var n=e,i=t;return Ee.compare(n,i)}},{key:"interfaces_",get:function(){return[Pe]}}]),s}(),Dm=function(){function s(){a(this,s)}return c(s,[{key:"compare",value:function(e,t){var n=e,i=t;if(n.length<i.length)return-1;if(n.length>i.length)return 1;if(n.length===0)return 0;var u=Ee.compare(n,i);return Ee.isEqualReversed(n,i)?0:u}},{key:"OLDcompare",value:function(e,t){var n=e,i=t;if(n.length<i.length)return-1;if(n.length>i.length)return 1;if(n.length===0)return 0;for(var u=Ee.increasingDirection(n),f=Ee.increasingDirection(i),g=u>0?0:n.length-1,y=f>0?0:n.length-1,d=0;d<n.length;d++){var N=n[g].compareTo(i[y]);if(N!==0)return N;g+=u,y+=f}return 0}},{key:"interfaces_",get:function(){return[Pe]}}]),s}();Ee.ForwardComparator=Mm,Ee.BidirectionalComparator=Dm,Ee.coordArrayType=new Array(0).fill(null);var ri=function(){function s(e){a(this,s),this.str=e}return c(s,[{key:"append",value:function(e){this.str+=e}},{key:"setCharAt",value:function(e,t){this.str=this.str.substr(0,e)+t+this.str.substr(e+1)}},{key:"toString",value:function(){return this.str}}]),s}(),Zn=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"getM",value:function(e){return this.hasM()?this._coordinates[e].getM():j.NaN}},{key:"setOrdinate",value:function(e,t,n){switch(t){case le.X:this._coordinates[e].x=n;break;case le.Y:this._coordinates[e].y=n;break;default:this._coordinates[e].setOrdinate(t,n)}}},{key:"getZ",value:function(e){return this.hasZ()?this._coordinates[e].getZ():j.NaN}},{key:"size",value:function(){return this._coordinates.length}},{key:"getOrdinate",value:function(e,t){switch(t){case le.X:return this._coordinates[e].x;case le.Y:return this._coordinates[e].y;default:return this._coordinates[e].getOrdinate(t)}}},{key:"getCoordinate",value:function(){if(arguments.length===1){var e=arguments[0];return this._coordinates[e]}if(arguments.length===2){var t=arguments[0],n=arguments[1];n.setCoordinate(this._coordinates[t])}}},{key:"getCoordinateCopy",value:function(e){var t=this.createCoordinate();return t.setCoordinate(this._coordinates[e]),t}},{key:"createCoordinate",value:function(){return ni.create(this.getDimension(),this.getMeasures())}},{key:"getDimension",value:function(){return this._dimension}},{key:"getX",value:function(e){return this._coordinates[e].x}},{key:"getMeasures",value:function(){return this._measures}},{key:"expandEnvelope",value:function(e){for(var t=0;t<this._coordinates.length;t++)e.expandToInclude(this._coordinates[t]);return e}},{key:"copy",value:function(){for(var e=new Array(this.size()).fill(null),t=0;t<this._coordinates.length;t++){var n=this.createCoordinate();n.setCoordinate(this._coordinates[t]),e[t]=n}return new s(e,this._dimension,this._measures)}},{key:"toString",value:function(){if(this._coordinates.length>0){var e=new ri(17*this._coordinates.length);e.append("("),e.append(this._coordinates[0]);for(var t=1;t<this._coordinates.length;t++)e.append(", "),e.append(this._coordinates[t]);return e.append(")"),e.toString()}return"()"}},{key:"getY",value:function(e){return this._coordinates[e].y}},{key:"toCoordinateArray",value:function(){return this._coordinates}},{key:"interfaces_",get:function(){return[le,X]}}],[{key:"constructor_",value:function(){if(this._dimension=3,this._measures=0,this._coordinates=null,arguments.length===1){if(arguments[0]instanceof Array){var e=arguments[0];s.constructor_.call(this,e,Ee.dimension(e),Ee.measures(e))}else if(Number.isInteger(arguments[0])){var t=arguments[0];this._coordinates=new Array(t).fill(null);for(var n=0;n<t;n++)this._coordinates[n]=new O}else if(re(arguments[0],le)){var i=arguments[0];if(i===null)return this._coordinates=new Array(0).fill(null),null;this._dimension=i.getDimension(),this._measures=i.getMeasures(),this._coordinates=new Array(i.size()).fill(null);for(var u=0;u<this._coordinates.length;u++)this._coordinates[u]=i.getCoordinateCopy(u)}}else if(arguments.length===2){if(arguments[0]instanceof Array&&Number.isInteger(arguments[1])){var f=arguments[0],g=arguments[1];s.constructor_.call(this,f,g,Ee.measures(f))}else if(Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var y=arguments[0],d=arguments[1];this._coordinates=new Array(y).fill(null),this._dimension=d;for(var N=0;N<y;N++)this._coordinates[N]=ni.create(d)}}else if(arguments.length===3){if(Number.isInteger(arguments[2])&&arguments[0]instanceof Array&&Number.isInteger(arguments[1])){var b=arguments[0],L=arguments[1],$=arguments[2];this._dimension=L,this._measures=$,this._coordinates=b===null?new Array(0).fill(null):b}else if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var F=arguments[0],V=arguments[1],H=arguments[2];this._coordinates=new Array(F).fill(null),this._dimension=V,this._measures=H;for(var K=0;K<F;K++)this._coordinates[K]=this.createCoordinate()}}}}]),s}(),zs=function(){function s(){a(this,s)}return c(s,[{key:"readResolve",value:function(){return s.instance()}},{key:"create",value:function(){if(arguments.length===1){if(arguments[0]instanceof Array){var e=arguments[0];return new Zn(e)}if(re(arguments[0],le)){var t=arguments[0];return new Zn(t)}}else{if(arguments.length===2){var n=arguments[0],i=arguments[1];return i>3&&(i=3),i<2&&(i=2),new Zn(n,i)}if(arguments.length===3){var u=arguments[0],f=arguments[1],g=arguments[2],y=f-g;return g>1&&(g=1),y>3&&(y=3),y<2&&(y=2),new Zn(u,y+g,g)}}}},{key:"interfaces_",get:function(){return[Yl,X]}}],[{key:"instance",value:function(){return s.instanceObject}}]),s}();zs.instanceObject=new zs;var Ys=function(s){h(t,s);var e=k(t);function t(){var n;return a(this,t),n=e.call(this),t.constructor_.apply(m(n),arguments),n}return c(t,[{key:"copyInternal",value:function(){for(var n=new Array(this._geometries.length).fill(null),i=0;i<n.length;i++)n[i]=this._geometries[i].copy();return new t(n,this._factory)}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof W){var n=arguments[0],i=arguments[1];return!!this.isEquivalentClass(n)&&w(v(t.prototype),"equalsExact",this).call(this,n,i)}return w(v(t.prototype),"equalsExact",this).apply(this,arguments)}},{key:"getBoundaryDimension",value:function(){return 1}},{key:"getTypeCode",value:function(){return W.TYPECODE_MULTIPOLYGON}},{key:"getDimension",value:function(){return 2}},{key:"getBoundary",value:function(){if(this.isEmpty())return this.getFactory().createMultiLineString();for(var n=new Z,i=0;i<this._geometries.length;i++)for(var u=this._geometries[i].getBoundary(),f=0;f<u.getNumGeometries();f++)n.add(u.getGeometryN(f));var g=new Array(n.size()).fill(null);return this.getFactory().createMultiLineString(n.toArray(g))}},{key:"getGeometryType",value:function(){return W.TYPENAME_MULTIPOLYGON}},{key:"interfaces_",get:function(){return[Vl]}}],[{key:"constructor_",value:function(){var n=arguments[0],i=arguments[1];Fe.constructor_.call(this,n,i)}}]),t}(Fe),Hl=function(){function s(){a(this,s)}return c(s,[{key:"get",value:function(){}},{key:"put",value:function(){}},{key:"size",value:function(){}},{key:"values",value:function(){}},{key:"entrySet",value:function(){}}]),s}(),Fm=function(s){h(t,s);var e=k(t);function t(){var n;return a(this,t),(n=e.call(this)).map=new Map,n}return c(t,[{key:"get",value:function(n){return this.map.get(n)||null}},{key:"put",value:function(n,i){return this.map.set(n,i),i}},{key:"values",value:function(){for(var n=new Z,i=this.map.values(),u=i.next();!u.done;)n.add(u.value),u=i.next();return n}},{key:"entrySet",value:function(){var n=new Ms;return this.map.entries().forEach(function(i){return n.add(i)}),n}},{key:"size",value:function(){return this.map.size()}}]),t}(Hl),tt=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"equals",value:function(e){if(!(e instanceof s))return!1;var t=e;return this._modelType===t._modelType&&this._scale===t._scale}},{key:"compareTo",value:function(e){var t=e,n=this.getMaximumSignificantDigits(),i=t.getMaximumSignificantDigits();return Jr.compare(n,i)}},{key:"getScale",value:function(){return this._scale}},{key:"isFloating",value:function(){return this._modelType===s.FLOATING||this._modelType===s.FLOATING_SINGLE}},{key:"getType",value:function(){return this._modelType}},{key:"toString",value:function(){var e="UNKNOWN";return this._modelType===s.FLOATING?e="Floating":this._modelType===s.FLOATING_SINGLE?e="Floating-Single":this._modelType===s.FIXED&&(e="Fixed (Scale="+this.getScale()+")"),e}},{key:"makePrecise",value:function(){if(typeof arguments[0]=="number"){var e=arguments[0];return j.isNaN(e)||this._modelType===s.FLOATING_SINGLE?e:this._modelType===s.FIXED?Math.round(e*this._scale)/this._scale:e}if(arguments[0]instanceof O){var t=arguments[0];if(this._modelType===s.FLOATING)return null;t.x=this.makePrecise(t.x),t.y=this.makePrecise(t.y)}}},{key:"getMaximumSignificantDigits",value:function(){var e=16;return this._modelType===s.FLOATING?e=16:this._modelType===s.FLOATING_SINGLE?e=6:this._modelType===s.FIXED&&(e=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),e}},{key:"setScale",value:function(e){this._scale=Math.abs(e)}},{key:"interfaces_",get:function(){return[X,Y]}}],[{key:"constructor_",value:function(){if(this._modelType=null,this._scale=null,arguments.length===0)this._modelType=s.FLOATING;else if(arguments.length===1){if(arguments[0]instanceof _n){var e=arguments[0];this._modelType=e,e===s.FIXED&&this.setScale(1)}else if(typeof arguments[0]=="number"){var t=arguments[0];this._modelType=s.FIXED,this.setScale(t)}else if(arguments[0]instanceof s){var n=arguments[0];this._modelType=n._modelType,this._scale=n._scale}}}},{key:"mostPrecise",value:function(e,t){return e.compareTo(t)>=0?e:t}}]),s}(),_n=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"readResolve",value:function(){return s.nameToTypeMap.get(this._name)}},{key:"toString",value:function(){return this._name}},{key:"interfaces_",get:function(){return[X]}}],[{key:"constructor_",value:function(){this._name=null;var e=arguments[0];this._name=e,s.nameToTypeMap.put(e,this)}}]),s}();_n.nameToTypeMap=new Fm,tt.Type=_n,tt.FIXED=new _n("FIXED"),tt.FLOATING=new _n("FLOATING"),tt.FLOATING_SINGLE=new _n("FLOATING SINGLE"),tt.maximumPreciseValue=9007199254740992;var Us=function(s){h(t,s);var e=k(t);function t(){var n;return a(this,t),n=e.call(this),t.constructor_.apply(m(n),arguments),n}return c(t,[{key:"copyInternal",value:function(){for(var n=new Array(this._geometries.length).fill(null),i=0;i<n.length;i++)n[i]=this._geometries[i].copy();return new t(n,this._factory)}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof W){var n=arguments[0],i=arguments[1];return!!this.isEquivalentClass(n)&&w(v(t.prototype),"equalsExact",this).call(this,n,i)}return w(v(t.prototype),"equalsExact",this).apply(this,arguments)}},{key:"getBoundaryDimension",value:function(){return this.isClosed()?z.FALSE:0}},{key:"isClosed",value:function(){if(this.isEmpty())return!1;for(var n=0;n<this._geometries.length;n++)if(!this._geometries[n].isClosed())return!1;return!0}},{key:"getTypeCode",value:function(){return W.TYPECODE_MULTILINESTRING}},{key:"getDimension",value:function(){return 1}},{key:"getBoundary",value:function(){throw new At}},{key:"getGeometryType",value:function(){return W.TYPENAME_MULTILINESTRING}},{key:"interfaces_",get:function(){return[Ul]}}],[{key:"constructor_",value:function(){var n=arguments[0],i=arguments[1];Fe.constructor_.call(this,n,i)}}]),t}(Fe),xn=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"createEmpty",value:function(e){switch(e){case-1:return this.createGeometryCollection();case 0:return this.createPoint();case 1:return this.createLineString();case 2:return this.createPolygon();default:throw new M("Invalid dimension: "+e)}}},{key:"toGeometry",value:function(e){return e.isNull()?this.createPoint():e.getMinX()===e.getMaxX()&&e.getMinY()===e.getMaxY()?this.createPoint(new O(e.getMinX(),e.getMinY())):e.getMinX()===e.getMaxX()||e.getMinY()===e.getMaxY()?this.createLineString([new O(e.getMinX(),e.getMinY()),new O(e.getMaxX(),e.getMaxY())]):this.createPolygon(this.createLinearRing([new O(e.getMinX(),e.getMinY()),new O(e.getMinX(),e.getMaxY()),new O(e.getMaxX(),e.getMaxY()),new O(e.getMaxX(),e.getMinY()),new O(e.getMinX(),e.getMinY())]),null)}},{key:"createLineString",value:function(){if(arguments.length===0)return this.createLineString(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Array){var e=arguments[0];return this.createLineString(e!==null?this.getCoordinateSequenceFactory().create(e):null)}if(re(arguments[0],le)){var t=arguments[0];return new Vn(t,this)}}}},{key:"createMultiLineString",value:function(){if(arguments.length===0)return new Us(null,this);if(arguments.length===1){var e=arguments[0];return new Us(e,this)}}},{key:"buildGeometry",value:function(e){for(var t=null,n=!1,i=!1,u=e.iterator();u.hasNext();){var f=u.next(),g=f.getTypeCode();t===null&&(t=g),g!==t&&(n=!0),f instanceof Fe&&(i=!0)}if(t===null)return this.createGeometryCollection();if(n||i)return this.createGeometryCollection(s.toGeometryArray(e));var y=e.iterator().next();if(e.size()>1){if(y instanceof ti)return this.createMultiPolygon(s.toPolygonArray(e));if(y instanceof Vn)return this.createMultiLineString(s.toLineStringArray(e));if(y instanceof Bs)return this.createMultiPoint(s.toPointArray(e));se.shouldNeverReachHere("Unhandled geometry type: "+y.getGeometryType())}return y}},{key:"createMultiPointFromCoords",value:function(e){return this.createMultiPoint(e!==null?this.getCoordinateSequenceFactory().create(e):null)}},{key:"createPoint",value:function(){if(arguments.length===0)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof O){var e=arguments[0];return this.createPoint(e!==null?this.getCoordinateSequenceFactory().create([e]):null)}if(re(arguments[0],le)){var t=arguments[0];return new Bs(t,this)}}}},{key:"getCoordinateSequenceFactory",value:function(){return this._coordinateSequenceFactory}},{key:"createPolygon",value:function(){if(arguments.length===0)return this.createPolygon(null,null);if(arguments.length===1){if(re(arguments[0],le)){var e=arguments[0];return this.createPolygon(this.createLinearRing(e))}if(arguments[0]instanceof Array){var t=arguments[0];return this.createPolygon(this.createLinearRing(t))}if(arguments[0]instanceof Wn){var n=arguments[0];return this.createPolygon(n,null)}}else if(arguments.length===2){var i=arguments[0],u=arguments[1];return new ti(i,u,this)}}},{key:"getSRID",value:function(){return this._SRID}},{key:"createGeometryCollection",value:function(){if(arguments.length===0)return new Fe(null,this);if(arguments.length===1){var e=arguments[0];return new Fe(e,this)}}},{key:"getPrecisionModel",value:function(){return this._precisionModel}},{key:"createLinearRing",value:function(){if(arguments.length===0)return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Array){var e=arguments[0];return this.createLinearRing(e!==null?this.getCoordinateSequenceFactory().create(e):null)}if(re(arguments[0],le)){var t=arguments[0];return new Wn(t,this)}}}},{key:"createMultiPolygon",value:function(){if(arguments.length===0)return new Ys(null,this);if(arguments.length===1){var e=arguments[0];return new Ys(e,this)}}},{key:"createMultiPoint",value:function(){if(arguments.length===0)return new Gs(null,this);if(arguments.length===1){if(arguments[0]instanceof Array){var e=arguments[0];return new Gs(e,this)}if(re(arguments[0],le)){var t=arguments[0];if(t===null)return this.createMultiPoint(new Array(0).fill(null));for(var n=new Array(t.size()).fill(null),i=0;i<t.size();i++){var u=this.getCoordinateSequenceFactory().create(1,t.getDimension(),t.getMeasures());Ut.copy(t,i,u,0,1),n[i]=this.createPoint(u)}return this.createMultiPoint(n)}}}},{key:"interfaces_",get:function(){return[X]}}],[{key:"constructor_",value:function(){if(this._precisionModel=null,this._coordinateSequenceFactory=null,this._SRID=null,arguments.length===0)s.constructor_.call(this,new tt,0);else if(arguments.length===1){if(re(arguments[0],Yl)){var e=arguments[0];s.constructor_.call(this,new tt,0,e)}else if(arguments[0]instanceof tt){var t=arguments[0];s.constructor_.call(this,t,0,s.getDefaultCoordinateSequenceFactory())}}else if(arguments.length===2){var n=arguments[0],i=arguments[1];s.constructor_.call(this,n,i,s.getDefaultCoordinateSequenceFactory())}else if(arguments.length===3){var u=arguments[0],f=arguments[1],g=arguments[2];this._precisionModel=u,this._coordinateSequenceFactory=g,this._SRID=f}}},{key:"toMultiPolygonArray",value:function(e){var t=new Array(e.size()).fill(null);return e.toArray(t)}},{key:"toGeometryArray",value:function(e){if(e===null)return null;var t=new Array(e.size()).fill(null);return e.toArray(t)}},{key:"getDefaultCoordinateSequenceFactory",value:function(){return zs.instance()}},{key:"toMultiLineStringArray",value:function(e){var t=new Array(e.size()).fill(null);return e.toArray(t)}},{key:"toLineStringArray",value:function(e){var t=new Array(e.size()).fill(null);return e.toArray(t)}},{key:"toMultiPointArray",value:function(e){var t=new Array(e.size()).fill(null);return e.toArray(t)}},{key:"toLinearRingArray",value:function(e){var t=new Array(e.size()).fill(null);return e.toArray(t)}},{key:"toPointArray",value:function(e){var t=new Array(e.size()).fill(null);return e.toArray(t)}},{key:"toPolygonArray",value:function(e){var t=new Array(e.size()).fill(null);return e.toArray(t)}},{key:"createPointFromInternalCoord",value:function(e,t){return t.getPrecisionModel().makePrecise(e),t.getFactory().createPoint(e)}}]),s}(),Xs="XY",$m="XYZ",Bm="XYM",Gm="XYZM",Zl={POINT:"Point",LINE_STRING:"LineString",LINEAR_RING:"LinearRing",POLYGON:"Polygon",MULTI_POINT:"MultiPoint",MULTI_LINE_STRING:"MultiLineString",MULTI_POLYGON:"MultiPolygon",GEOMETRY_COLLECTION:"GeometryCollection",CIRCLE:"Circle"},Jl="EMPTY",ii=1,xt=2,Mt=3,Ql=4,En=5,qm=6;for(var zm in Zl)Zl[zm].toUpperCase();var Ym=function(){function s(e){a(this,s),this.wkt=e,this.index_=-1}return c(s,[{key:"isAlpha_",value:function(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"}},{key:"isNumeric_",value:function(e,t){return e>="0"&&e<="9"||e=="."&&!(t!==void 0&&t)}},{key:"isWhiteSpace_",value:function(e){return e==" "||e==" "||e=="\r"||e==`
29
- `}},{key:"nextChar_",value:function(){return this.wkt.charAt(++this.index_)}},{key:"nextToken",value:function(){var e,t=this.nextChar_(),n=this.index_,i=t;if(t=="(")e=xt;else if(t==",")e=En;else if(t==")")e=Mt;else if(this.isNumeric_(t)||t=="-")e=Ql,i=this.readNumber_();else if(this.isAlpha_(t))e=ii,i=this.readText_();else{if(this.isWhiteSpace_(t))return this.nextToken();if(t!=="")throw new Error("Unexpected character: "+t);e=qm}return{position:n,value:i,type:e}}},{key:"readNumber_",value:function(){var e,t=this.index_,n=!1,i=!1;do e=="."?n=!0:e!="e"&&e!="E"||(i=!0),e=this.nextChar_();while(this.isNumeric_(e,n)||!i&&(e=="e"||e=="E")||i&&(e=="-"||e=="+"));return parseFloat(this.wkt.substring(t,this.index_--))}},{key:"readText_",value:function(){var e,t=this.index_;do e=this.nextChar_();while(this.isAlpha_(e));return this.wkt.substring(t,this.index_--).toUpperCase()}}]),s}(),Um=function(){function s(e,t){a(this,s),this.lexer_=e,this.token_,this.layout_=Xs,this.factory=t}return c(s,[{key:"consume_",value:function(){this.token_=this.lexer_.nextToken()}},{key:"isTokenType",value:function(e){return this.token_.type==e}},{key:"match",value:function(e){var t=this.isTokenType(e);return t&&this.consume_(),t}},{key:"parse",value:function(){return this.consume_(),this.parseGeometry_()}},{key:"parseGeometryLayout_",value:function(){var e=Xs,t=this.token_;if(this.isTokenType(ii)){var n=t.value;n==="Z"?e=$m:n==="M"?e=Bm:n==="ZM"&&(e=Gm),e!==Xs&&this.consume_()}return e}},{key:"parseGeometryCollectionText_",value:function(){if(this.match(xt)){var e=[];do e.push(this.parseGeometry_());while(this.match(En));if(this.match(Mt))return e}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parsePointText_",value:function(){if(this.match(xt)){var e=this.parsePoint_();if(this.match(Mt))return e}else if(this.isEmptyGeometry_())return null;throw new Error(this.formatErrorMessage_())}},{key:"parseLineStringText_",value:function(){if(this.match(xt)){var e=this.parsePointList_();if(this.match(Mt))return e}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parsePolygonText_",value:function(){if(this.match(xt)){var e=this.parseLineStringTextList_();if(this.match(Mt))return e}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parseMultiPointText_",value:function(){var e;if(this.match(xt)){if(e=this.token_.type==xt?this.parsePointTextList_():this.parsePointList_(),this.match(Mt))return e}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parseMultiLineStringText_",value:function(){if(this.match(xt)){var e=this.parseLineStringTextList_();if(this.match(Mt))return e}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parseMultiPolygonText_",value:function(){if(this.match(xt)){var e=this.parsePolygonTextList_();if(this.match(Mt))return e}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parsePoint_",value:function(){for(var e=[],t=this.layout_.length,n=0;n<t;++n){var i=this.token_;if(!this.match(Ql))break;e.push(i.value)}if(e.length==t)return e;throw new Error(this.formatErrorMessage_())}},{key:"parsePointList_",value:function(){for(var e=[this.parsePoint_()];this.match(En);)e.push(this.parsePoint_());return e}},{key:"parsePointTextList_",value:function(){for(var e=[this.parsePointText_()];this.match(En);)e.push(this.parsePointText_());return e}},{key:"parseLineStringTextList_",value:function(){for(var e=[this.parseLineStringText_()];this.match(En);)e.push(this.parseLineStringText_());return e}},{key:"parsePolygonTextList_",value:function(){for(var e=[this.parsePolygonText_()];this.match(En);)e.push(this.parsePolygonText_());return e}},{key:"isEmptyGeometry_",value:function(){var e=this.isTokenType(ii)&&this.token_.value==Jl;return e&&this.consume_(),e}},{key:"formatErrorMessage_",value:function(){return"Unexpected `"+this.token_.value+"` at position "+this.token_.position+" in `"+this.lexer_.wkt+"`"}},{key:"parseGeometry_",value:function(){var e=this.factory,t=function(H){return x(O,C(H))},n=function(H){var K=H.map(function(ge){return e.createLinearRing(ge.map(t))});return K.length>1?e.createPolygon(K[0],K.slice(1)):e.createPolygon(K[0])},i=this.token_;if(this.match(ii)){var u=i.value;if(this.layout_=this.parseGeometryLayout_(),u=="GEOMETRYCOLLECTION"){var f=this.parseGeometryCollectionText_();return e.createGeometryCollection(f)}switch(u){case"POINT":var g=this.parsePointText_();return g?e.createPoint(x(O,C(g))):e.createPoint();case"LINESTRING":var y=this.parseLineStringText_().map(t);return e.createLineString(y);case"LINEARRING":var d=this.parseLineStringText_().map(t);return e.createLinearRing(d);case"POLYGON":var N=this.parsePolygonText_();return N&&N.length!==0?n(N):e.createPolygon();case"MULTIPOINT":var b=this.parseMultiPointText_();if(!b||b.length===0)return e.createMultiPoint();var L=b.map(t).map(function(H){return e.createPoint(H)});return e.createMultiPoint(L);case"MULTILINESTRING":var $=this.parseMultiLineStringText_().map(function(H){return e.createLineString(H.map(t))});return e.createMultiLineString($);case"MULTIPOLYGON":var F=this.parseMultiPolygonText_();if(!F||F.length===0)return e.createMultiPolygon();var V=F.map(n);return e.createMultiPolygon(V);default:throw new Error("Invalid geometry type: "+u)}}throw new Error(this.formatErrorMessage_())}}]),s}();function Kl(s){if(s.isEmpty())return"";var e=s.getCoordinate(),t=[e.x,e.y];return e.z===void 0||Number.isNaN(e.z)||t.push(e.z),e.m===void 0||Number.isNaN(e.m)||t.push(e.m),t.join(" ")}function Jn(s){for(var e=s.getCoordinates().map(function(u){var f=[u.x,u.y];return u.z===void 0||Number.isNaN(u.z)||f.push(u.z),u.m===void 0||Number.isNaN(u.m)||f.push(u.m),f}),t=[],n=0,i=e.length;n<i;++n)t.push(e[n].join(" "));return t.join(", ")}function ec(s){var e=[];e.push("("+Jn(s.getExteriorRing())+")");for(var t=0,n=s.getNumInteriorRing();t<n;++t)e.push("("+Jn(s.getInteriorRingN(t))+")");return e.join(", ")}var Xm={Point:Kl,LineString:Jn,LinearRing:Jn,Polygon:ec,MultiPoint:function(s){for(var e=[],t=0,n=s.getNumGeometries();t<n;++t)e.push("("+Kl(s.getGeometryN(t))+")");return e.join(", ")},MultiLineString:function(s){for(var e=[],t=0,n=s.getNumGeometries();t<n;++t)e.push("("+Jn(s.getGeometryN(t))+")");return e.join(", ")},MultiPolygon:function(s){for(var e=[],t=0,n=s.getNumGeometries();t<n;++t)e.push("("+ec(s.getGeometryN(t))+")");return e.join(", ")},GeometryCollection:function(s){for(var e=[],t=0,n=s.getNumGeometries();t<n;++t)e.push(tc(s.getGeometryN(t)));return e.join(", ")}};function tc(s){var e=s.getGeometryType(),t=Xm[e];e=e.toUpperCase();var n=function(i){var u="";if(i.isEmpty())return u;var f=i.getCoordinate();return f.z===void 0||Number.isNaN(f.z)||(u+="Z"),f.m===void 0||Number.isNaN(f.m)||(u+="M"),u}(s);return n.length>0&&(e+=" "+n),s.isEmpty()?e+" "+Jl:e+" ("+t(s)+")"}var jm=function(){function s(e){a(this,s),this.geometryFactory=e||new xn,this.precisionModel=this.geometryFactory.getPrecisionModel()}return c(s,[{key:"read",value:function(e){var t=new Ym(e);return new Um(t,this.geometryFactory).parse()}},{key:"write",value:function(e){return tc(e)}}]),s}(),js=function(){function s(e){a(this,s),this.parser=new jm(e)}return c(s,[{key:"write",value:function(e){return this.parser.write(e)}}],[{key:"toLineString",value:function(e,t){if(arguments.length!==2)throw new Error("Not implemented");return"LINESTRING ( "+e.x+" "+e.y+", "+t.x+" "+t.y+" )"}}]),s}(),me=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"getIndexAlongSegment",value:function(e,t){return this.computeIntLineIndex(),this._intLineIndex[e][t]}},{key:"getTopologySummary",value:function(){var e=new ri;return this.isEndPoint()&&e.append(" endpoint"),this._isProper&&e.append(" proper"),this.isCollinear()&&e.append(" collinear"),e.toString()}},{key:"computeIntersection",value:function(e,t,n,i){this._inputLines[0][0]=e,this._inputLines[0][1]=t,this._inputLines[1][0]=n,this._inputLines[1][1]=i,this._result=this.computeIntersect(e,t,n,i)}},{key:"getIntersectionNum",value:function(){return this._result}},{key:"computeIntLineIndex",value:function(){if(arguments.length===0)this._intLineIndex===null&&(this._intLineIndex=Array(2).fill().map(function(){return Array(2)}),this.computeIntLineIndex(0),this.computeIntLineIndex(1));else if(arguments.length===1){var e=arguments[0],t=this.getEdgeDistance(e,0),n=this.getEdgeDistance(e,1);t>n?(this._intLineIndex[e][0]=0,this._intLineIndex[e][1]=1):(this._intLineIndex[e][0]=1,this._intLineIndex[e][1]=0)}}},{key:"isProper",value:function(){return this.hasIntersection()&&this._isProper}},{key:"setPrecisionModel",value:function(e){this._precisionModel=e}},{key:"isInteriorIntersection",value:function(){if(arguments.length===0)return!!this.isInteriorIntersection(0)||!!this.isInteriorIntersection(1);if(arguments.length===1){for(var e=arguments[0],t=0;t<this._result;t++)if(!this._intPt[t].equals2D(this._inputLines[e][0])&&!this._intPt[t].equals2D(this._inputLines[e][1]))return!0;return!1}}},{key:"getIntersection",value:function(e){return this._intPt[e]}},{key:"isEndPoint",value:function(){return this.hasIntersection()&&!this._isProper}},{key:"hasIntersection",value:function(){return this._result!==s.NO_INTERSECTION}},{key:"getEdgeDistance",value:function(e,t){return s.computeEdgeDistance(this._intPt[t],this._inputLines[e][0],this._inputLines[e][1])}},{key:"isCollinear",value:function(){return this._result===s.COLLINEAR_INTERSECTION}},{key:"toString",value:function(){return js.toLineString(this._inputLines[0][0],this._inputLines[0][1])+" - "+js.toLineString(this._inputLines[1][0],this._inputLines[1][1])+this.getTopologySummary()}},{key:"getEndpoint",value:function(e,t){return this._inputLines[e][t]}},{key:"isIntersection",value:function(e){for(var t=0;t<this._result;t++)if(this._intPt[t].equals2D(e))return!0;return!1}},{key:"getIntersectionAlongSegment",value:function(e,t){return this.computeIntLineIndex(),this._intPt[this._intLineIndex[e][t]]}}],[{key:"constructor_",value:function(){this._result=null,this._inputLines=Array(2).fill().map(function(){return Array(2)}),this._intPt=new Array(2).fill(null),this._intLineIndex=null,this._isProper=null,this._pa=null,this._pb=null,this._precisionModel=null,this._intPt[0]=new O,this._intPt[1]=new O,this._pa=this._intPt[0],this._pb=this._intPt[1],this._result=0}},{key:"computeEdgeDistance",value:function(e,t,n){var i=Math.abs(n.x-t.x),u=Math.abs(n.y-t.y),f=-1;if(e.equals(t))f=0;else if(e.equals(n))f=i>u?i:u;else{var g=Math.abs(e.x-t.x),y=Math.abs(e.y-t.y);(f=i>u?g:y)!==0||e.equals(t)||(f=Math.max(g,y))}return se.isTrue(!(f===0&&!e.equals(t)),"Bad distance calculation"),f}},{key:"nonRobustComputeEdgeDistance",value:function(e,t,n){var i=e.x-t.x,u=e.y-t.y,f=Math.sqrt(i*i+u*u);return se.isTrue(!(f===0&&!e.equals(t)),"Invalid distance calculation"),f}}]),s}();me.DONT_INTERSECT=0,me.DO_INTERSECT=1,me.COLLINEAR=2,me.NO_INTERSECTION=0,me.POINT_INTERSECTION=1,me.COLLINEAR_INTERSECTION=2;var Wt=function(s){h(t,s);var e=k(t);function t(){return a(this,t),e.call(this)}return c(t,[{key:"isInSegmentEnvelopes",value:function(n){var i=new pe(this._inputLines[0][0],this._inputLines[0][1]),u=new pe(this._inputLines[1][0],this._inputLines[1][1]);return i.contains(n)&&u.contains(n)}},{key:"computeIntersection",value:function(){if(arguments.length!==3)return w(v(t.prototype),"computeIntersection",this).apply(this,arguments);var n=arguments[0],i=arguments[1],u=arguments[2];if(this._isProper=!1,pe.intersects(i,u,n)&&Q.index(i,u,n)===0&&Q.index(u,i,n)===0)return this._isProper=!0,(n.equals(i)||n.equals(u))&&(this._isProper=!1),this._result=me.POINT_INTERSECTION,null;this._result=me.NO_INTERSECTION}},{key:"intersection",value:function(n,i,u,f){var g=this.intersectionSafe(n,i,u,f);return this.isInSegmentEnvelopes(g)||(g=new O(t.nearestEndpoint(n,i,u,f))),this._precisionModel!==null&&this._precisionModel.makePrecise(g),g}},{key:"checkDD",value:function(n,i,u,f,g){var y=Fs.intersection(n,i,u,f),d=this.isInSegmentEnvelopes(y);je.out.println("DD in env = "+d+" --------------------- "+y),g.distance(y)>1e-4&&je.out.println("Distance = "+g.distance(y))}},{key:"intersectionSafe",value:function(n,i,u,f){var g=$s.intersection(n,i,u,f);return g===null&&(g=t.nearestEndpoint(n,i,u,f)),g}},{key:"computeCollinearIntersection",value:function(n,i,u,f){var g=pe.intersects(n,i,u),y=pe.intersects(n,i,f),d=pe.intersects(u,f,n),N=pe.intersects(u,f,i);return g&&y?(this._intPt[0]=u,this._intPt[1]=f,me.COLLINEAR_INTERSECTION):d&&N?(this._intPt[0]=n,this._intPt[1]=i,me.COLLINEAR_INTERSECTION):g&&d?(this._intPt[0]=u,this._intPt[1]=n,!u.equals(n)||y||N?me.COLLINEAR_INTERSECTION:me.POINT_INTERSECTION):g&&N?(this._intPt[0]=u,this._intPt[1]=i,!u.equals(i)||y||d?me.COLLINEAR_INTERSECTION:me.POINT_INTERSECTION):y&&d?(this._intPt[0]=f,this._intPt[1]=n,!f.equals(n)||g||N?me.COLLINEAR_INTERSECTION:me.POINT_INTERSECTION):y&&N?(this._intPt[0]=f,this._intPt[1]=i,!f.equals(i)||g||d?me.COLLINEAR_INTERSECTION:me.POINT_INTERSECTION):me.NO_INTERSECTION}},{key:"computeIntersect",value:function(n,i,u,f){if(this._isProper=!1,!pe.intersects(n,i,u,f))return me.NO_INTERSECTION;var g=Q.index(n,i,u),y=Q.index(n,i,f);if(g>0&&y>0||g<0&&y<0)return me.NO_INTERSECTION;var d=Q.index(u,f,n),N=Q.index(u,f,i);return d>0&&N>0||d<0&&N<0?me.NO_INTERSECTION:g===0&&y===0&&d===0&&N===0?this.computeCollinearIntersection(n,i,u,f):(g===0||y===0||d===0||N===0?(this._isProper=!1,n.equals2D(u)||n.equals2D(f)?this._intPt[0]=n:i.equals2D(u)||i.equals2D(f)?this._intPt[0]=i:g===0?this._intPt[0]=new O(u):y===0?this._intPt[0]=new O(f):d===0?this._intPt[0]=new O(n):N===0&&(this._intPt[0]=new O(i))):(this._isProper=!0,this._intPt[0]=this.intersection(n,i,u,f)),me.POINT_INTERSECTION)}}],[{key:"nearestEndpoint",value:function(n,i,u,f){var g=n,y=ft.pointToSegment(n,u,f),d=ft.pointToSegment(i,u,f);return d<y&&(y=d,g=i),(d=ft.pointToSegment(u,n,i))<y&&(y=d,g=u),(d=ft.pointToSegment(f,n,i))<y&&(y=d,g=f),g}}]),t}(me),Vm=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"countSegment",value:function(e,t){if(e.x<this._p.x&&t.x<this._p.x)return null;if(this._p.x===t.x&&this._p.y===t.y)return this._isPointOnSegment=!0,null;if(e.y===this._p.y&&t.y===this._p.y){var n=e.x,i=t.x;return n>i&&(n=t.x,i=e.x),this._p.x>=n&&this._p.x<=i&&(this._isPointOnSegment=!0),null}if(e.y>this._p.y&&t.y<=this._p.y||t.y>this._p.y&&e.y<=this._p.y){var u=Q.index(e,t,this._p);if(u===Q.COLLINEAR)return this._isPointOnSegment=!0,null;t.y<e.y&&(u=-u),u===Q.LEFT&&this._crossingCount++}}},{key:"isPointInPolygon",value:function(){return this.getLocation()!==S.EXTERIOR}},{key:"getLocation",value:function(){return this._isPointOnSegment?S.BOUNDARY:this._crossingCount%2==1?S.INTERIOR:S.EXTERIOR}},{key:"isOnSegment",value:function(){return this._isPointOnSegment}}],[{key:"constructor_",value:function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var e=arguments[0];this._p=e}},{key:"locatePointInRing",value:function(){if(arguments[0]instanceof O&&re(arguments[1],le)){for(var e=arguments[0],t=arguments[1],n=new s(e),i=new O,u=new O,f=1;f<t.size();f++)if(t.getCoordinate(f,i),t.getCoordinate(f-1,u),n.countSegment(i,u),n.isOnSegment())return n.getLocation();return n.getLocation()}if(arguments[0]instanceof O&&arguments[1]instanceof Array){for(var g=arguments[0],y=arguments[1],d=new s(g),N=1;N<y.length;N++){var b=y[N],L=y[N-1];if(d.countSegment(b,L),d.isOnSegment())return d.getLocation()}return d.getLocation()}}}]),s}(),Vs=function(){function s(){a(this,s)}return c(s,null,[{key:"isOnLine",value:function(){if(arguments[0]instanceof O&&re(arguments[1],le)){for(var e=arguments[0],t=arguments[1],n=new Wt,i=new O,u=new O,f=t.size(),g=1;g<f;g++)if(t.getCoordinate(g-1,i),t.getCoordinate(g,u),n.computeIntersection(e,i,u),n.hasIntersection())return!0;return!1}if(arguments[0]instanceof O&&arguments[1]instanceof Array){for(var y=arguments[0],d=arguments[1],N=new Wt,b=1;b<d.length;b++){var L=d[b-1],$=d[b];if(N.computeIntersection(y,L,$),N.hasIntersection())return!0}return!1}}},{key:"locateInRing",value:function(e,t){return Vm.locatePointInRing(e,t)}},{key:"isInRing",value:function(e,t){return s.locateInRing(e,t)!==S.EXTERIOR}}]),s}(),Ve=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"setAllLocations",value:function(e){for(var t=0;t<this.location.length;t++)this.location[t]=e}},{key:"isNull",value:function(){for(var e=0;e<this.location.length;e++)if(this.location[e]!==S.NONE)return!1;return!0}},{key:"setAllLocationsIfNull",value:function(e){for(var t=0;t<this.location.length;t++)this.location[t]===S.NONE&&(this.location[t]=e)}},{key:"isLine",value:function(){return this.location.length===1}},{key:"merge",value:function(e){if(e.location.length>this.location.length){var t=new Array(3).fill(null);t[B.ON]=this.location[B.ON],t[B.LEFT]=S.NONE,t[B.RIGHT]=S.NONE,this.location=t}for(var n=0;n<this.location.length;n++)this.location[n]===S.NONE&&n<e.location.length&&(this.location[n]=e.location[n])}},{key:"getLocations",value:function(){return this.location}},{key:"flip",value:function(){if(this.location.length<=1)return null;var e=this.location[B.LEFT];this.location[B.LEFT]=this.location[B.RIGHT],this.location[B.RIGHT]=e}},{key:"toString",value:function(){var e=new Xn;return this.location.length>1&&e.append(S.toLocationSymbol(this.location[B.LEFT])),e.append(S.toLocationSymbol(this.location[B.ON])),this.location.length>1&&e.append(S.toLocationSymbol(this.location[B.RIGHT])),e.toString()}},{key:"setLocations",value:function(e,t,n){this.location[B.ON]=e,this.location[B.LEFT]=t,this.location[B.RIGHT]=n}},{key:"get",value:function(e){return e<this.location.length?this.location[e]:S.NONE}},{key:"isArea",value:function(){return this.location.length>1}},{key:"isAnyNull",value:function(){for(var e=0;e<this.location.length;e++)if(this.location[e]===S.NONE)return!0;return!1}},{key:"setLocation",value:function(){if(arguments.length===1){var e=arguments[0];this.setLocation(B.ON,e)}else if(arguments.length===2){var t=arguments[0],n=arguments[1];this.location[t]=n}}},{key:"init",value:function(e){this.location=new Array(e).fill(null),this.setAllLocations(S.NONE)}},{key:"isEqualOnSide",value:function(e,t){return this.location[t]===e.location[t]}},{key:"allPositionsEqual",value:function(e){for(var t=0;t<this.location.length;t++)if(this.location[t]!==e)return!1;return!0}}],[{key:"constructor_",value:function(){if(this.location=null,arguments.length===1){if(arguments[0]instanceof Array){var e=arguments[0];this.init(e.length)}else if(Number.isInteger(arguments[0])){var t=arguments[0];this.init(1),this.location[B.ON]=t}else if(arguments[0]instanceof s){var n=arguments[0];if(this.init(n.location.length),n!==null)for(var i=0;i<this.location.length;i++)this.location[i]=n.location[i]}}else if(arguments.length===3){var u=arguments[0],f=arguments[1],g=arguments[2];this.init(3),this.location[B.ON]=u,this.location[B.LEFT]=f,this.location[B.RIGHT]=g}}}]),s}(),We=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"getGeometryCount",value:function(){var e=0;return this.elt[0].isNull()||e++,this.elt[1].isNull()||e++,e}},{key:"setAllLocations",value:function(e,t){this.elt[e].setAllLocations(t)}},{key:"isNull",value:function(e){return this.elt[e].isNull()}},{key:"setAllLocationsIfNull",value:function(){if(arguments.length===1){var e=arguments[0];this.setAllLocationsIfNull(0,e),this.setAllLocationsIfNull(1,e)}else if(arguments.length===2){var t=arguments[0],n=arguments[1];this.elt[t].setAllLocationsIfNull(n)}}},{key:"isLine",value:function(e){return this.elt[e].isLine()}},{key:"merge",value:function(e){for(var t=0;t<2;t++)this.elt[t]===null&&e.elt[t]!==null?this.elt[t]=new Ve(e.elt[t]):this.elt[t].merge(e.elt[t])}},{key:"flip",value:function(){this.elt[0].flip(),this.elt[1].flip()}},{key:"getLocation",value:function(){if(arguments.length===1){var e=arguments[0];return this.elt[e].get(B.ON)}if(arguments.length===2){var t=arguments[0],n=arguments[1];return this.elt[t].get(n)}}},{key:"toString",value:function(){var e=new Xn;return this.elt[0]!==null&&(e.append("A:"),e.append(this.elt[0].toString())),this.elt[1]!==null&&(e.append(" B:"),e.append(this.elt[1].toString())),e.toString()}},{key:"isArea",value:function(){if(arguments.length===0)return this.elt[0].isArea()||this.elt[1].isArea();if(arguments.length===1){var e=arguments[0];return this.elt[e].isArea()}}},{key:"isAnyNull",value:function(e){return this.elt[e].isAnyNull()}},{key:"setLocation",value:function(){if(arguments.length===2){var e=arguments[0],t=arguments[1];this.elt[e].setLocation(B.ON,t)}else if(arguments.length===3){var n=arguments[0],i=arguments[1],u=arguments[2];this.elt[n].setLocation(i,u)}}},{key:"isEqualOnSide",value:function(e,t){return this.elt[0].isEqualOnSide(e.elt[0],t)&&this.elt[1].isEqualOnSide(e.elt[1],t)}},{key:"allPositionsEqual",value:function(e,t){return this.elt[e].allPositionsEqual(t)}},{key:"toLine",value:function(e){this.elt[e].isArea()&&(this.elt[e]=new Ve(this.elt[e].location[0]))}}],[{key:"constructor_",value:function(){if(this.elt=new Array(2).fill(null),arguments.length===1){if(Number.isInteger(arguments[0])){var e=arguments[0];this.elt[0]=new Ve(e),this.elt[1]=new Ve(e)}else if(arguments[0]instanceof s){var t=arguments[0];this.elt[0]=new Ve(t.elt[0]),this.elt[1]=new Ve(t.elt[1])}}else if(arguments.length===2){var n=arguments[0],i=arguments[1];this.elt[0]=new Ve(S.NONE),this.elt[1]=new Ve(S.NONE),this.elt[n].setLocation(i)}else if(arguments.length===3){var u=arguments[0],f=arguments[1],g=arguments[2];this.elt[0]=new Ve(u,f,g),this.elt[1]=new Ve(u,f,g)}else if(arguments.length===4){var y=arguments[0],d=arguments[1],N=arguments[2],b=arguments[3];this.elt[0]=new Ve(S.NONE,S.NONE,S.NONE),this.elt[1]=new Ve(S.NONE,S.NONE,S.NONE),this.elt[y].setLocations(d,N,b)}}},{key:"toLineLabel",value:function(e){for(var t=new s(S.NONE),n=0;n<2;n++)t.setLocation(n,e.getLocation(n));return t}}]),s}(),si=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"computeRing",value:function(){if(this._ring!==null)return null;for(var e=new Array(this._pts.size()).fill(null),t=0;t<this._pts.size();t++)e[t]=this._pts.get(t);this._ring=this._geometryFactory.createLinearRing(e),this._isHole=Q.isCCW(this._ring.getCoordinates())}},{key:"isIsolated",value:function(){return this._label.getGeometryCount()===1}},{key:"computePoints",value:function(e){this._startDe=e;var t=e,n=!0;do{if(t===null)throw new _t("Found null DirectedEdge");if(t.getEdgeRing()===this)throw new _t("Directed Edge visited twice during ring-building at "+t.getCoordinate());this._edges.add(t);var i=t.getLabel();se.isTrue(i.isArea()),this.mergeLabel(i),this.addPoints(t.getEdge(),t.isForward(),n),n=!1,this.setEdgeRing(t,this),t=this.getNext(t)}while(t!==this._startDe)}},{key:"getLinearRing",value:function(){return this._ring}},{key:"getCoordinate",value:function(e){return this._pts.get(e)}},{key:"computeMaxNodeDegree",value:function(){this._maxNodeDegree=0;var e=this._startDe;do{var t=e.getNode().getEdges().getOutgoingDegree(this);t>this._maxNodeDegree&&(this._maxNodeDegree=t),e=this.getNext(e)}while(e!==this._startDe);this._maxNodeDegree*=2}},{key:"addPoints",value:function(e,t,n){var i=e.getCoordinates();if(t){var u=1;n&&(u=0);for(var f=u;f<i.length;f++)this._pts.add(i[f])}else{var g=i.length-2;n&&(g=i.length-1);for(var y=g;y>=0;y--)this._pts.add(i[y])}}},{key:"isHole",value:function(){return this._isHole}},{key:"setInResult",value:function(){var e=this._startDe;do e.getEdge().setInResult(!0),e=e.getNext();while(e!==this._startDe)}},{key:"containsPoint",value:function(e){var t=this.getLinearRing();if(!t.getEnvelopeInternal().contains(e)||!Vs.isInRing(e,t.getCoordinates()))return!1;for(var n=this._holes.iterator();n.hasNext();)if(n.next().containsPoint(e))return!1;return!0}},{key:"addHole",value:function(e){this._holes.add(e)}},{key:"isShell",value:function(){return this._shell===null}},{key:"getLabel",value:function(){return this._label}},{key:"getEdges",value:function(){return this._edges}},{key:"getMaxNodeDegree",value:function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree}},{key:"getShell",value:function(){return this._shell}},{key:"mergeLabel",value:function(){if(arguments.length===1){var e=arguments[0];this.mergeLabel(e,0),this.mergeLabel(e,1)}else if(arguments.length===2){var t=arguments[0],n=arguments[1],i=t.getLocation(n,B.RIGHT);if(i===S.NONE)return null;if(this._label.getLocation(n)===S.NONE)return this._label.setLocation(n,i),null}}},{key:"setShell",value:function(e){this._shell=e,e!==null&&e.addHole(this)}},{key:"toPolygon",value:function(e){for(var t=new Array(this._holes.size()).fill(null),n=0;n<this._holes.size();n++)t[n]=this._holes.get(n).getLinearRing();return e.createPolygon(this.getLinearRing(),t)}}],[{key:"constructor_",value:function(){if(this._startDe=null,this._maxNodeDegree=-1,this._edges=new Z,this._pts=new Z,this._label=new We(S.NONE),this._ring=null,this._isHole=null,this._shell=null,this._holes=new Z,this._geometryFactory=null,arguments.length!==0){if(arguments.length===2){var e=arguments[0],t=arguments[1];this._geometryFactory=t,this.computePoints(e),this.computeRing()}}}}]),s}(),Wm=function(s){h(t,s);var e=k(t);function t(){var n;return a(this,t),n=e.call(this),t.constructor_.apply(m(n),arguments),n}return c(t,[{key:"setEdgeRing",value:function(n,i){n.setMinEdgeRing(i)}},{key:"getNext",value:function(n){return n.getNextMin()}}],[{key:"constructor_",value:function(){var n=arguments[0],i=arguments[1];si.constructor_.call(this,n,i)}}]),t}(si),Hm=function(s){h(t,s);var e=k(t);function t(){var n;return a(this,t),n=e.call(this),t.constructor_.apply(m(n),arguments),n}return c(t,[{key:"buildMinimalRings",value:function(){var n=new Z,i=this._startDe;do{if(i.getMinEdgeRing()===null){var u=new Wm(i,this._geometryFactory);n.add(u)}i=i.getNext()}while(i!==this._startDe);return n}},{key:"setEdgeRing",value:function(n,i){n.setEdgeRing(i)}},{key:"linkDirectedEdgesForMinimalEdgeRings",value:function(){var n=this._startDe;do n.getNode().getEdges().linkMinimalDirectedEdges(this),n=n.getNext();while(n!==this._startDe)}},{key:"getNext",value:function(n){return n.getNext()}}],[{key:"constructor_",value:function(){var n=arguments[0],i=arguments[1];si.constructor_.call(this,n,i)}}]),t}(si),nc=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"setVisited",value:function(e){this._isVisited=e}},{key:"setInResult",value:function(e){this._isInResult=e}},{key:"isCovered",value:function(){return this._isCovered}},{key:"isCoveredSet",value:function(){return this._isCoveredSet}},{key:"setLabel",value:function(e){this._label=e}},{key:"getLabel",value:function(){return this._label}},{key:"setCovered",value:function(e){this._isCovered=e,this._isCoveredSet=!0}},{key:"updateIM",value:function(e){se.isTrue(this._label.getGeometryCount()>=2,"found partial label"),this.computeIM(e)}},{key:"isInResult",value:function(){return this._isInResult}},{key:"isVisited",value:function(){return this._isVisited}}],[{key:"constructor_",value:function(){if(this._label=null,this._isInResult=!1,this._isCovered=!1,this._isCoveredSet=!1,this._isVisited=!1,arguments.length!==0){if(arguments.length===1){var e=arguments[0];this._label=e}}}}]),s}(),ai=function(s){h(t,s);var e=k(t);function t(){var n;return a(this,t),n=e.call(this),t.constructor_.apply(m(n),arguments),n}return c(t,[{key:"isIncidentEdgeInResult",value:function(){for(var n=this.getEdges().getEdges().iterator();n.hasNext();)if(n.next().getEdge().isInResult())return!0;return!1}},{key:"isIsolated",value:function(){return this._label.getGeometryCount()===1}},{key:"getCoordinate",value:function(){return this._coord}},{key:"print",value:function(n){n.println("node "+this._coord+" lbl: "+this._label)}},{key:"computeIM",value:function(n){}},{key:"computeMergedLocation",value:function(n,i){var u=S.NONE;if(u=this._label.getLocation(i),!n.isNull(i)){var f=n.getLocation(i);u!==S.BOUNDARY&&(u=f)}return u}},{key:"setLabel",value:function(){if(arguments.length!==2||!Number.isInteger(arguments[1])||!Number.isInteger(arguments[0]))return w(v(t.prototype),"setLabel",this).apply(this,arguments);var n=arguments[0],i=arguments[1];this._label===null?this._label=new We(n,i):this._label.setLocation(n,i)}},{key:"getEdges",value:function(){return this._edges}},{key:"mergeLabel",value:function(){if(arguments[0]instanceof t){var n=arguments[0];this.mergeLabel(n._label)}else if(arguments[0]instanceof We)for(var i=arguments[0],u=0;u<2;u++){var f=this.computeMergedLocation(i,u),g=this._label.getLocation(u);g===S.NONE&&this._label.setLocation(u,f)}}},{key:"add",value:function(n){this._edges.insert(n),n.setNode(this)}},{key:"setLabelBoundary",value:function(n){if(this._label===null)return null;var i=S.NONE;this._label!==null&&(i=this._label.getLocation(n));var u=null;switch(i){case S.BOUNDARY:u=S.INTERIOR;break;case S.INTERIOR:default:u=S.BOUNDARY}this._label.setLocation(n,u)}}],[{key:"constructor_",value:function(){this._coord=null,this._edges=null;var n=arguments[0],i=arguments[1];this._coord=n,this._edges=i,this._label=new We(0,S.NONE)}}]),t}(nc),Zm=function(s){h(t,s);var e=k(t);function t(){return a(this,t),e.apply(this,arguments)}return t}(Hl);function rc(s){return s==null?0:s.color}function fe(s){return s==null?null:s.parent}function ht(s,e){s!==null&&(s.color=e)}function Ws(s){return s==null?null:s.left}function ic(s){return s==null?null:s.right}var Qn=function(s){h(t,s);var e=k(t);function t(){var n;return a(this,t),(n=e.call(this)).root_=null,n.size_=0,n}return c(t,[{key:"get",value:function(n){for(var i=this.root_;i!==null;){var u=n.compareTo(i.key);if(u<0)i=i.left;else{if(!(u>0))return i.value;i=i.right}}return null}},{key:"put",value:function(n,i){if(this.root_===null)return this.root_={key:n,value:i,left:null,right:null,parent:null,color:0,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var u,f,g=this.root_;do if(u=g,(f=n.compareTo(g.key))<0)g=g.left;else{if(!(f>0)){var y=g.value;return g.value=i,y}g=g.right}while(g!==null);var d={key:n,left:null,right:null,value:i,parent:u,color:0,getValue:function(){return this.value},getKey:function(){return this.key}};return f<0?u.left=d:u.right=d,this.fixAfterInsertion(d),this.size_++,null}},{key:"fixAfterInsertion",value:function(n){var i;for(n.color=1;n!=null&&n!==this.root_&&n.parent.color===1;)fe(n)===Ws(fe(fe(n)))?rc(i=ic(fe(fe(n))))===1?(ht(fe(n),0),ht(i,0),ht(fe(fe(n)),1),n=fe(fe(n))):(n===ic(fe(n))&&(n=fe(n),this.rotateLeft(n)),ht(fe(n),0),ht(fe(fe(n)),1),this.rotateRight(fe(fe(n)))):rc(i=Ws(fe(fe(n))))===1?(ht(fe(n),0),ht(i,0),ht(fe(fe(n)),1),n=fe(fe(n))):(n===Ws(fe(n))&&(n=fe(n),this.rotateRight(n)),ht(fe(n),0),ht(fe(fe(n)),1),this.rotateLeft(fe(fe(n))));this.root_.color=0}},{key:"values",value:function(){var n=new Z,i=this.getFirstEntry();if(i!==null)for(n.add(i.value);(i=t.successor(i))!==null;)n.add(i.value);return n}},{key:"entrySet",value:function(){var n=new Ms,i=this.getFirstEntry();if(i!==null)for(n.add(i);(i=t.successor(i))!==null;)n.add(i);return n}},{key:"rotateLeft",value:function(n){if(n!=null){var i=n.right;n.right=i.left,i.left!=null&&(i.left.parent=n),i.parent=n.parent,n.parent==null?this.root_=i:n.parent.left===n?n.parent.left=i:n.parent.right=i,i.left=n,n.parent=i}}},{key:"rotateRight",value:function(n){if(n!=null){var i=n.left;n.left=i.right,i.right!=null&&(i.right.parent=n),i.parent=n.parent,n.parent==null?this.root_=i:n.parent.right===n?n.parent.right=i:n.parent.left=i,i.right=n,n.parent=i}}},{key:"getFirstEntry",value:function(){var n=this.root_;if(n!=null)for(;n.left!=null;)n=n.left;return n}},{key:"size",value:function(){return this.size_}},{key:"containsKey",value:function(n){for(var i=this.root_;i!==null;){var u=n.compareTo(i.key);if(u<0)i=i.left;else{if(!(u>0))return!0;i=i.right}}return!1}}],[{key:"successor",value:function(n){var i;if(n===null)return null;if(n.right!==null){for(i=n.right;i.left!==null;)i=i.left;return i}i=n.parent;for(var u=n;i!==null&&u===i.right;)u=i,i=i.parent;return i}}]),t}(Zm),sc=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"find",value:function(e){return this.nodeMap.get(e)}},{key:"addNode",value:function(){if(arguments[0]instanceof O){var e=arguments[0],t=this.nodeMap.get(e);return t===null&&(t=this.nodeFact.createNode(e),this.nodeMap.put(e,t)),t}if(arguments[0]instanceof ai){var n=arguments[0],i=this.nodeMap.get(n.getCoordinate());return i===null?(this.nodeMap.put(n.getCoordinate(),n),n):(i.mergeLabel(n),i)}}},{key:"print",value:function(e){for(var t=this.iterator();t.hasNext();)t.next().print(e)}},{key:"iterator",value:function(){return this.nodeMap.values().iterator()}},{key:"values",value:function(){return this.nodeMap.values()}},{key:"getBoundaryNodes",value:function(e){for(var t=new Z,n=this.iterator();n.hasNext();){var i=n.next();i.getLabel().getLocation(e)===S.BOUNDARY&&t.add(i)}return t}},{key:"add",value:function(e){var t=e.getCoordinate();this.addNode(t).add(e)}}],[{key:"constructor_",value:function(){this.nodeMap=new Qn,this.nodeFact=null;var e=arguments[0];this.nodeFact=e}}]),s}(),Ae=function(){function s(){a(this,s)}return c(s,null,[{key:"isNorthern",value:function(e){return e===s.NE||e===s.NW}},{key:"isOpposite",value:function(e,t){return e!==t&&(e-t+4)%4===2}},{key:"commonHalfPlane",value:function(e,t){if(e===t)return e;if((e-t+4)%4===2)return-1;var n=e<t?e:t;return n===0&&(e>t?e:t)===3?3:n}},{key:"isInHalfPlane",value:function(e,t){return t===s.SE?e===s.SE||e===s.SW:e===t||e===t+1}},{key:"quadrant",value:function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var e=arguments[0],t=arguments[1];if(e===0&&t===0)throw new M("Cannot compute the quadrant for point ( "+e+", "+t+" )");return e>=0?t>=0?s.NE:s.SE:t>=0?s.NW:s.SW}if(arguments[0]instanceof O&&arguments[1]instanceof O){var n=arguments[0],i=arguments[1];if(i.x===n.x&&i.y===n.y)throw new M("Cannot compute the quadrant for two identical points "+n);return i.x>=n.x?i.y>=n.y?s.NE:s.SE:i.y>=n.y?s.NW:s.SW}}}]),s}();Ae.NE=0,Ae.NW=1,Ae.SW=2,Ae.SE=3;var ac=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"compareDirection",value:function(e){return this._dx===e._dx&&this._dy===e._dy?0:this._quadrant>e._quadrant?1:this._quadrant<e._quadrant?-1:Q.index(e._p0,e._p1,this._p1)}},{key:"getDy",value:function(){return this._dy}},{key:"getCoordinate",value:function(){return this._p0}},{key:"setNode",value:function(e){this._node=e}},{key:"print",value:function(e){var t=Math.atan2(this._dy,this._dx),n=this.getClass().getName(),i=n.lastIndexOf("."),u=n.substring(i+1);e.print(" "+u+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+t+" "+this._label)}},{key:"compareTo",value:function(e){var t=e;return this.compareDirection(t)}},{key:"getDirectedCoordinate",value:function(){return this._p1}},{key:"getDx",value:function(){return this._dx}},{key:"getLabel",value:function(){return this._label}},{key:"getEdge",value:function(){return this._edge}},{key:"getQuadrant",value:function(){return this._quadrant}},{key:"getNode",value:function(){return this._node}},{key:"toString",value:function(){var e=Math.atan2(this._dy,this._dx),t=this.getClass().getName(),n=t.lastIndexOf(".");return" "+t.substring(n+1)+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+e+" "+this._label}},{key:"computeLabel",value:function(e){}},{key:"init",value:function(e,t){this._p0=e,this._p1=t,this._dx=t.x-e.x,this._dy=t.y-e.y,this._quadrant=Ae.quadrant(this._dx,this._dy),se.isTrue(!(this._dx===0&&this._dy===0),"EdgeEnd with identical endpoints found")}},{key:"interfaces_",get:function(){return[Y]}}],[{key:"constructor_",value:function(){if(this._edge=null,this._label=null,this._node=null,this._p0=null,this._p1=null,this._dx=null,this._dy=null,this._quadrant=null,arguments.length===1){var e=arguments[0];this._edge=e}else if(arguments.length===3){var t=arguments[0],n=arguments[1],i=arguments[2];s.constructor_.call(this,t,n,i,null)}else if(arguments.length===4){var u=arguments[0],f=arguments[1],g=arguments[2],y=arguments[3];s.constructor_.call(this,u),this.init(f,g),this._label=y}}}]),s}(),Hs=function(s){h(t,s);var e=k(t);function t(){var n;return a(this,t),n=e.call(this),t.constructor_.apply(m(n),arguments),n}return c(t,[{key:"getNextMin",value:function(){return this._nextMin}},{key:"getDepth",value:function(n){return this._depth[n]}},{key:"setVisited",value:function(n){this._isVisited=n}},{key:"computeDirectedLabel",value:function(){this._label=new We(this._edge.getLabel()),this._isForward||this._label.flip()}},{key:"getNext",value:function(){return this._next}},{key:"setDepth",value:function(n,i){if(this._depth[n]!==-999&&this._depth[n]!==i)throw new _t("assigned depths do not match",this.getCoordinate());this._depth[n]=i}},{key:"isInteriorAreaEdge",value:function(){for(var n=!0,i=0;i<2;i++)this._label.isArea(i)&&this._label.getLocation(i,B.LEFT)===S.INTERIOR&&this._label.getLocation(i,B.RIGHT)===S.INTERIOR||(n=!1);return n}},{key:"setNextMin",value:function(n){this._nextMin=n}},{key:"print",value:function(n){w(v(t.prototype),"print",this).call(this,n),n.print(" "+this._depth[B.LEFT]+"/"+this._depth[B.RIGHT]),n.print(" ("+this.getDepthDelta()+")"),this._isInResult&&n.print(" inResult")}},{key:"setMinEdgeRing",value:function(n){this._minEdgeRing=n}},{key:"isLineEdge",value:function(){var n=this._label.isLine(0)||this._label.isLine(1),i=!this._label.isArea(0)||this._label.allPositionsEqual(0,S.EXTERIOR),u=!this._label.isArea(1)||this._label.allPositionsEqual(1,S.EXTERIOR);return n&&i&&u}},{key:"setEdgeRing",value:function(n){this._edgeRing=n}},{key:"getMinEdgeRing",value:function(){return this._minEdgeRing}},{key:"getDepthDelta",value:function(){var n=this._edge.getDepthDelta();return this._isForward||(n=-n),n}},{key:"setInResult",value:function(n){this._isInResult=n}},{key:"getSym",value:function(){return this._sym}},{key:"isForward",value:function(){return this._isForward}},{key:"getEdge",value:function(){return this._edge}},{key:"printEdge",value:function(n){this.print(n),n.print(" "),this._isForward?this._edge.print(n):this._edge.printReverse(n)}},{key:"setSym",value:function(n){this._sym=n}},{key:"setVisitedEdge",value:function(n){this.setVisited(n),this._sym.setVisited(n)}},{key:"setEdgeDepths",value:function(n,i){var u=this.getEdge().getDepthDelta();this._isForward||(u=-u);var f=1;n===B.LEFT&&(f=-1);var g=B.opposite(n),y=i+u*f;this.setDepth(n,i),this.setDepth(g,y)}},{key:"getEdgeRing",value:function(){return this._edgeRing}},{key:"isInResult",value:function(){return this._isInResult}},{key:"setNext",value:function(n){this._next=n}},{key:"isVisited",value:function(){return this._isVisited}}],[{key:"constructor_",value:function(){this._isForward=null,this._isInResult=!1,this._isVisited=!1,this._sym=null,this._next=null,this._nextMin=null,this._edgeRing=null,this._minEdgeRing=null,this._depth=[0,-999,-999];var n=arguments[0],i=arguments[1];if(ac.constructor_.call(this,n),this._isForward=i,i)this.init(n.getCoordinate(0),n.getCoordinate(1));else{var u=n.getNumPoints()-1;this.init(n.getCoordinate(u),n.getCoordinate(u-1))}this.computeDirectedLabel()}},{key:"depthFactor",value:function(n,i){return n===S.EXTERIOR&&i===S.INTERIOR?1:n===S.INTERIOR&&i===S.EXTERIOR?-1:0}}]),t}(ac),oc=function(){function s(){a(this,s)}return c(s,[{key:"createNode",value:function(e){return new ai(e,null)}}]),s}(),uc=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"printEdges",value:function(e){e.println("Edges:");for(var t=0;t<this._edges.size();t++){e.println("edge "+t+":");var n=this._edges.get(t);n.print(e),n.eiList.print(e)}}},{key:"find",value:function(e){return this._nodes.find(e)}},{key:"addNode",value:function(){if(arguments[0]instanceof ai){var e=arguments[0];return this._nodes.addNode(e)}if(arguments[0]instanceof O){var t=arguments[0];return this._nodes.addNode(t)}}},{key:"getNodeIterator",value:function(){return this._nodes.iterator()}},{key:"linkResultDirectedEdges",value:function(){for(var e=this._nodes.iterator();e.hasNext();)e.next().getEdges().linkResultDirectedEdges()}},{key:"debugPrintln",value:function(e){je.out.println(e)}},{key:"isBoundaryNode",value:function(e,t){var n=this._nodes.find(t);if(n===null)return!1;var i=n.getLabel();return i!==null&&i.getLocation(e)===S.BOUNDARY}},{key:"linkAllDirectedEdges",value:function(){for(var e=this._nodes.iterator();e.hasNext();)e.next().getEdges().linkAllDirectedEdges()}},{key:"matchInSameDirection",value:function(e,t,n,i){return!!e.equals(n)&&Q.index(e,t,i)===Q.COLLINEAR&&Ae.quadrant(e,t)===Ae.quadrant(n,i)}},{key:"getEdgeEnds",value:function(){return this._edgeEndList}},{key:"debugPrint",value:function(e){je.out.print(e)}},{key:"getEdgeIterator",value:function(){return this._edges.iterator()}},{key:"findEdgeInSameDirection",value:function(e,t){for(var n=0;n<this._edges.size();n++){var i=this._edges.get(n),u=i.getCoordinates();if(this.matchInSameDirection(e,t,u[0],u[1])||this.matchInSameDirection(e,t,u[u.length-1],u[u.length-2]))return i}return null}},{key:"insertEdge",value:function(e){this._edges.add(e)}},{key:"findEdgeEnd",value:function(e){for(var t=this.getEdgeEnds().iterator();t.hasNext();){var n=t.next();if(n.getEdge()===e)return n}return null}},{key:"addEdges",value:function(e){for(var t=e.iterator();t.hasNext();){var n=t.next();this._edges.add(n);var i=new Hs(n,!0),u=new Hs(n,!1);i.setSym(u),u.setSym(i),this.add(i),this.add(u)}}},{key:"add",value:function(e){this._nodes.add(e),this._edgeEndList.add(e)}},{key:"getNodes",value:function(){return this._nodes.values()}},{key:"findEdge",value:function(e,t){for(var n=0;n<this._edges.size();n++){var i=this._edges.get(n),u=i.getCoordinates();if(e.equals(u[0])&&t.equals(u[1]))return i}return null}}],[{key:"constructor_",value:function(){if(this._edges=new Z,this._nodes=null,this._edgeEndList=new Z,arguments.length===0)this._nodes=new sc(new oc);else if(arguments.length===1){var e=arguments[0];this._nodes=new sc(e)}}},{key:"linkResultDirectedEdges",value:function(e){for(var t=e.iterator();t.hasNext();)t.next().getEdges().linkResultDirectedEdges()}}]),s}(),Jm=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"sortShellsAndHoles",value:function(e,t,n){for(var i=e.iterator();i.hasNext();){var u=i.next();u.isHole()?n.add(u):t.add(u)}}},{key:"computePolygons",value:function(e){for(var t=new Z,n=e.iterator();n.hasNext();){var i=n.next().toPolygon(this._geometryFactory);t.add(i)}return t}},{key:"placeFreeHoles",value:function(e,t){for(var n=t.iterator();n.hasNext();){var i=n.next();if(i.getShell()===null){var u=s.findEdgeRingContaining(i,e);if(u===null)throw new _t("unable to assign hole to a shell",i.getCoordinate(0));i.setShell(u)}}}},{key:"buildMinimalEdgeRings",value:function(e,t,n){for(var i=new Z,u=e.iterator();u.hasNext();){var f=u.next();if(f.getMaxNodeDegree()>2){f.linkDirectedEdgesForMinimalEdgeRings();var g=f.buildMinimalRings(),y=this.findShell(g);y!==null?(this.placePolygonHoles(y,g),t.add(y)):n.addAll(g)}else i.add(f)}return i}},{key:"buildMaximalEdgeRings",value:function(e){for(var t=new Z,n=e.iterator();n.hasNext();){var i=n.next();if(i.isInResult()&&i.getLabel().isArea()&&i.getEdgeRing()===null){var u=new Hm(i,this._geometryFactory);t.add(u),u.setInResult()}}return t}},{key:"placePolygonHoles",value:function(e,t){for(var n=t.iterator();n.hasNext();){var i=n.next();i.isHole()&&i.setShell(e)}}},{key:"getPolygons",value:function(){return this.computePolygons(this._shellList)}},{key:"findShell",value:function(e){for(var t=0,n=null,i=e.iterator();i.hasNext();){var u=i.next();u.isHole()||(n=u,t++)}return se.isTrue(t<=1,"found two shells in MinimalEdgeRing list"),n}},{key:"add",value:function(){if(arguments.length===1){var e=arguments[0];this.add(e.getEdgeEnds(),e.getNodes())}else if(arguments.length===2){var t=arguments[0],n=arguments[1];uc.linkResultDirectedEdges(n);var i=this.buildMaximalEdgeRings(t),u=new Z,f=this.buildMinimalEdgeRings(i,this._shellList,u);this.sortShellsAndHoles(f,this._shellList,u),this.placeFreeHoles(this._shellList,u)}}}],[{key:"constructor_",value:function(){this._geometryFactory=null,this._shellList=new Z;var e=arguments[0];this._geometryFactory=e}},{key:"findEdgeRingContaining",value:function(e,t){for(var n=e.getLinearRing(),i=n.getEnvelopeInternal(),u=n.getCoordinateN(0),f=null,g=null,y=t.iterator();y.hasNext();){var d=y.next(),N=d.getLinearRing(),b=N.getEnvelopeInternal();if(!b.equals(i)&&b.contains(i)){u=Ee.ptNotInList(n.getCoordinates(),N.getCoordinates());var L=!1;Vs.isInRing(u,N.getCoordinates())&&(L=!0),L&&(f===null||g.contains(b))&&(g=(f=d).getLinearRing().getEnvelopeInternal())}}return f}}]),s}(),lc=function(){function s(){a(this,s)}return c(s,[{key:"getBounds",value:function(){}}]),s}(),Et=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"getItem",value:function(){return this._item}},{key:"getBounds",value:function(){return this._bounds}},{key:"interfaces_",get:function(){return[lc,X]}}],[{key:"constructor_",value:function(){this._bounds=null,this._item=null;var e=arguments[0],t=arguments[1];this._bounds=e,this._item=t}}]),s}(),oi=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"poll",value:function(){if(this.isEmpty())return null;var e=this._items.get(1);return this._items.set(1,this._items.get(this._size)),this._size-=1,this.reorder(1),e}},{key:"size",value:function(){return this._size}},{key:"reorder",value:function(e){for(var t=null,n=this._items.get(e);2*e<=this._size&&((t=2*e)!==this._size&&this._items.get(t+1).compareTo(this._items.get(t))<0&&t++,this._items.get(t).compareTo(n)<0);e=t)this._items.set(e,this._items.get(t));this._items.set(e,n)}},{key:"clear",value:function(){this._size=0,this._items.clear()}},{key:"peek",value:function(){return this.isEmpty()?null:this._items.get(1)}},{key:"isEmpty",value:function(){return this._size===0}},{key:"add",value:function(e){this._items.add(null),this._size+=1;var t=this._size;for(this._items.set(0,e);e.compareTo(this._items.get(Math.trunc(t/2)))<0;t/=2)this._items.set(t,this._items.get(Math.trunc(t/2)));this._items.set(t,e)}}],[{key:"constructor_",value:function(){this._size=null,this._items=null,this._size=0,this._items=new Z,this._items.add(null)}}]),s}(),Qm=function(){function s(){a(this,s)}return c(s,[{key:"insert",value:function(e,t){}},{key:"remove",value:function(e,t){}},{key:"query",value:function(){}}]),s}(),He=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"getLevel",value:function(){return this._level}},{key:"size",value:function(){return this._childBoundables.size()}},{key:"getChildBoundables",value:function(){return this._childBoundables}},{key:"addChildBoundable",value:function(e){se.isTrue(this._bounds===null),this._childBoundables.add(e)}},{key:"isEmpty",value:function(){return this._childBoundables.isEmpty()}},{key:"getBounds",value:function(){return this._bounds===null&&(this._bounds=this.computeBounds()),this._bounds}},{key:"interfaces_",get:function(){return[lc,X]}}],[{key:"constructor_",value:function(){if(this._childBoundables=new Z,this._bounds=null,this._level=null,arguments.length!==0){if(arguments.length===1){var e=arguments[0];this._level=e}}}}]),s}(),kn={reverseOrder:function(){return{compare:function(s,e){return e.compareTo(s)}}},min:function(s){return kn.sort(s),s.get(0)},sort:function(s,e){var t=s.toArray();e?Xt.sort(t,e):Xt.sort(t);for(var n=s.iterator(),i=0,u=t.length;i<u;i++)n.next(),n.set(t[i])},singletonList:function(s){var e=new Z;return e.add(s),e}},Km=function(){function s(){a(this,s)}return c(s,null,[{key:"maxDistance",value:function(e,t,n,i,u,f,g,y){var d=s.distance(e,t,u,f);return d=Math.max(d,s.distance(e,t,g,y)),d=Math.max(d,s.distance(n,i,u,f)),d=Math.max(d,s.distance(n,i,g,y))}},{key:"distance",value:function(e,t,n,i){var u=n-e,f=i-t;return Math.sqrt(u*u+f*f)}},{key:"maximumDistance",value:function(e,t){var n=Math.min(e.getMinX(),t.getMinX()),i=Math.min(e.getMinY(),t.getMinY()),u=Math.max(e.getMaxX(),t.getMaxX()),f=Math.max(e.getMaxY(),t.getMaxY());return s.distance(n,i,u,f)}},{key:"minMaxDistance",value:function(e,t){var n=e.getMinX(),i=e.getMinY(),u=e.getMaxX(),f=e.getMaxY(),g=t.getMinX(),y=t.getMinY(),d=t.getMaxX(),N=t.getMaxY(),b=s.maxDistance(n,i,n,f,g,y,g,N);return b=Math.min(b,s.maxDistance(n,i,n,f,g,y,d,y)),b=Math.min(b,s.maxDistance(n,i,n,f,d,N,g,N)),b=Math.min(b,s.maxDistance(n,i,n,f,d,N,d,y)),b=Math.min(b,s.maxDistance(n,i,u,i,g,y,g,N)),b=Math.min(b,s.maxDistance(n,i,u,i,g,y,d,y)),b=Math.min(b,s.maxDistance(n,i,u,i,d,N,g,N)),b=Math.min(b,s.maxDistance(n,i,u,i,d,N,d,y)),b=Math.min(b,s.maxDistance(u,f,n,f,g,y,g,N)),b=Math.min(b,s.maxDistance(u,f,n,f,g,y,d,y)),b=Math.min(b,s.maxDistance(u,f,n,f,d,N,g,N)),b=Math.min(b,s.maxDistance(u,f,n,f,d,N,d,y)),b=Math.min(b,s.maxDistance(u,f,u,i,g,y,g,N)),b=Math.min(b,s.maxDistance(u,f,u,i,g,y,d,y)),b=Math.min(b,s.maxDistance(u,f,u,i,d,N,g,N)),b=Math.min(b,s.maxDistance(u,f,u,i,d,N,d,y))}}]),s}(),In=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"maximumDistance",value:function(){return Km.maximumDistance(this._boundable1.getBounds(),this._boundable2.getBounds())}},{key:"expandToQueue",value:function(e,t){var n=s.isComposite(this._boundable1),i=s.isComposite(this._boundable2);if(n&&i)return s.area(this._boundable1)>s.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,!1,e,t),null):(this.expand(this._boundable2,this._boundable1,!0,e,t),null);if(n)return this.expand(this._boundable1,this._boundable2,!1,e,t),null;if(i)return this.expand(this._boundable2,this._boundable1,!0,e,t),null;throw new M("neither boundable is composite")}},{key:"isLeaves",value:function(){return!(s.isComposite(this._boundable1)||s.isComposite(this._boundable2))}},{key:"compareTo",value:function(e){var t=e;return this._distance<t._distance?-1:this._distance>t._distance?1:0}},{key:"expand",value:function(e,t,n,i,u){for(var f=e.getChildBoundables().iterator();f.hasNext();){var g=f.next(),y=null;(y=n?new s(t,g,this._itemDistance):new s(g,t,this._itemDistance)).getDistance()<u&&i.add(y)}}},{key:"getBoundable",value:function(e){return e===0?this._boundable1:this._boundable2}},{key:"getDistance",value:function(){return this._distance}},{key:"distance",value:function(){return this.isLeaves()?this._itemDistance.distance(this._boundable1,this._boundable2):this._boundable1.getBounds().distance(this._boundable2.getBounds())}},{key:"interfaces_",get:function(){return[Y]}}],[{key:"constructor_",value:function(){this._boundable1=null,this._boundable2=null,this._distance=null,this._itemDistance=null;var e=arguments[0],t=arguments[1],n=arguments[2];this._boundable1=e,this._boundable2=t,this._itemDistance=n,this._distance=this.distance()}},{key:"area",value:function(e){return e.getBounds().getArea()}},{key:"isComposite",value:function(e){return e instanceof He}}]),s}(),cc=function(){function s(){a(this,s)}return c(s,[{key:"visitItem",value:function(e){}}]),s}(),Sn=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"queryInternal",value:function(){if(re(arguments[2],cc)&&arguments[0]instanceof Object&&arguments[1]instanceof He)for(var e=arguments[0],t=arguments[1],n=arguments[2],i=t.getChildBoundables(),u=0;u<i.size();u++){var f=i.get(u);this.getIntersectsOp().intersects(f.getBounds(),e)&&(f instanceof He?this.queryInternal(e,f,n):f instanceof Et?n.visitItem(f.getItem()):se.shouldNeverReachHere())}else if(re(arguments[2],Yt)&&arguments[0]instanceof Object&&arguments[1]instanceof He)for(var g=arguments[0],y=arguments[1],d=arguments[2],N=y.getChildBoundables(),b=0;b<N.size();b++){var L=N.get(b);this.getIntersectsOp().intersects(L.getBounds(),g)&&(L instanceof He?this.queryInternal(g,L,d):L instanceof Et?d.add(L.getItem()):se.shouldNeverReachHere())}}},{key:"getNodeCapacity",value:function(){return this._nodeCapacity}},{key:"lastNode",value:function(e){return e.get(e.size()-1)}},{key:"size",value:function(){if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.size(this._root));if(arguments.length===1){for(var e=arguments[0],t=0,n=e.getChildBoundables().iterator();n.hasNext();){var i=n.next();i instanceof He?t+=this.size(i):i instanceof Et&&(t+=1)}return t}}},{key:"removeItem",value:function(e,t){for(var n=null,i=e.getChildBoundables().iterator();i.hasNext();){var u=i.next();u instanceof Et&&u.getItem()===t&&(n=u)}return n!==null&&(e.getChildBoundables().remove(n),!0)}},{key:"itemsTree",value:function(){if(arguments.length===0){this.build();var e=this.itemsTree(this._root);return e===null?new Z:e}if(arguments.length===1){for(var t=arguments[0],n=new Z,i=t.getChildBoundables().iterator();i.hasNext();){var u=i.next();if(u instanceof He){var f=this.itemsTree(u);f!==null&&n.add(f)}else u instanceof Et?n.add(u.getItem()):se.shouldNeverReachHere()}return n.size()<=0?null:n}}},{key:"insert",value:function(e,t){se.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new Et(e,t))}},{key:"boundablesAtLevel",value:function(){if(arguments.length===1){var e=arguments[0],t=new Z;return this.boundablesAtLevel(e,this._root,t),t}if(arguments.length===3){var n=arguments[0],i=arguments[1],u=arguments[2];if(se.isTrue(n>-2),i.getLevel()===n)return u.add(i),null;for(var f=i.getChildBoundables().iterator();f.hasNext();){var g=f.next();g instanceof He?this.boundablesAtLevel(n,g,u):(se.isTrue(g instanceof Et),n===-1&&u.add(g))}return null}}},{key:"query",value:function(){if(arguments.length===1){var e=arguments[0];this.build();var t=new Z;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),e)&&this.queryInternal(e,this._root,t),t}if(arguments.length===2){var n=arguments[0],i=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),n)&&this.queryInternal(n,this._root,i)}}},{key:"build",value:function(){if(this._built)return null;this._root=this._itemBoundables.isEmpty()?this.createNode(0):this.createHigherLevels(this._itemBoundables,-1),this._itemBoundables=null,this._built=!0}},{key:"getRoot",value:function(){return this.build(),this._root}},{key:"remove",value:function(){if(arguments.length===2){var e=arguments[0],t=arguments[1];return this.build(),!!this.getIntersectsOp().intersects(this._root.getBounds(),e)&&this.remove(e,this._root,t)}if(arguments.length===3){var n=arguments[0],i=arguments[1],u=arguments[2],f=this.removeItem(i,u);if(f)return!0;for(var g=null,y=i.getChildBoundables().iterator();y.hasNext();){var d=y.next();if(this.getIntersectsOp().intersects(d.getBounds(),n)&&d instanceof He&&(f=this.remove(n,d,u))){g=d;break}}return g!==null&&g.getChildBoundables().isEmpty()&&i.getChildBoundables().remove(g),f}}},{key:"createHigherLevels",value:function(e,t){se.isTrue(!e.isEmpty());var n=this.createParentBoundables(e,t+1);return n.size()===1?n.get(0):this.createHigherLevels(n,t+1)}},{key:"depth",value:function(){if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.depth(this._root));if(arguments.length===1){for(var e=arguments[0],t=0,n=e.getChildBoundables().iterator();n.hasNext();){var i=n.next();if(i instanceof He){var u=this.depth(i);u>t&&(t=u)}}return t+1}}},{key:"createParentBoundables",value:function(e,t){se.isTrue(!e.isEmpty());var n=new Z;n.add(this.createNode(t));var i=new Z(e);kn.sort(i,this.getComparator());for(var u=i.iterator();u.hasNext();){var f=u.next();this.lastNode(n).getChildBoundables().size()===this.getNodeCapacity()&&n.add(this.createNode(t)),this.lastNode(n).addChildBoundable(f)}return n}},{key:"isEmpty",value:function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()}},{key:"interfaces_",get:function(){return[X]}}],[{key:"constructor_",value:function(){if(this._root=null,this._built=!1,this._itemBoundables=new Z,this._nodeCapacity=null,arguments.length===0)s.constructor_.call(this,s.DEFAULT_NODE_CAPACITY);else if(arguments.length===1){var e=arguments[0];se.isTrue(e>1,"Node capacity must be greater than 1"),this._nodeCapacity=e}}},{key:"compareDoubles",value:function(e,t){return e>t?1:e<t?-1:0}}]),s}();Sn.IntersectsOp=function(){},Sn.DEFAULT_NODE_CAPACITY=10;var ed=function(){function s(){a(this,s)}return c(s,[{key:"distance",value:function(e,t){}}]),s}(),gt=function(s){h(t,s);var e=k(t);function t(){var n;return a(this,t),n=e.call(this),t.constructor_.apply(m(n),arguments),n}return c(t,[{key:"createParentBoundablesFromVerticalSlices",value:function(n,i){se.isTrue(n.length>0);for(var u=new Z,f=0;f<n.length;f++)u.addAll(this.createParentBoundablesFromVerticalSlice(n[f],i));return u}},{key:"nearestNeighbourK",value:function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];return this.nearestNeighbourK(n,j.POSITIVE_INFINITY,i)}if(arguments.length===3){var u=arguments[0],f=arguments[1],g=arguments[2],y=f,d=new oi;d.add(u);for(var N=new oi;!d.isEmpty()&&y>=0;){var b=d.poll(),L=b.getDistance();if(L>=y)break;if(b.isLeaves())if(N.size()<g)N.add(b);else{var $=N.peek();$.getDistance()>L&&(N.poll(),N.add(b));var F=N.peek();y=F.getDistance()}else b.expandToQueue(d,y)}return t.getItems(N)}}},{key:"createNode",value:function(n){return new fc(n)}},{key:"size",value:function(){return arguments.length===0?w(v(t.prototype),"size",this).call(this):w(v(t.prototype),"size",this).apply(this,arguments)}},{key:"insert",value:function(){if(!(arguments.length===2&&arguments[1]instanceof Object&&arguments[0]instanceof pe))return w(v(t.prototype),"insert",this).apply(this,arguments);var n=arguments[0],i=arguments[1];if(n.isNull())return null;w(v(t.prototype),"insert",this).call(this,n,i)}},{key:"getIntersectsOp",value:function(){return t.intersectsOp}},{key:"verticalSlices",value:function(n,i){for(var u=Math.trunc(Math.ceil(n.size()/i)),f=new Array(i).fill(null),g=n.iterator(),y=0;y<i;y++){f[y]=new Z;for(var d=0;g.hasNext()&&d<u;){var N=g.next();f[y].add(N),d++}}return f}},{key:"query",value:function(){if(arguments.length===1){var n=arguments[0];return w(v(t.prototype),"query",this).call(this,n)}if(arguments.length===2){var i=arguments[0],u=arguments[1];w(v(t.prototype),"query",this).call(this,i,u)}}},{key:"getComparator",value:function(){return t.yComparator}},{key:"createParentBoundablesFromVerticalSlice",value:function(n,i){return w(v(t.prototype),"createParentBoundables",this).call(this,n,i)}},{key:"remove",value:function(){if(arguments.length===2&&arguments[1]instanceof Object&&arguments[0]instanceof pe){var n=arguments[0],i=arguments[1];return w(v(t.prototype),"remove",this).call(this,n,i)}return w(v(t.prototype),"remove",this).apply(this,arguments)}},{key:"depth",value:function(){return arguments.length===0?w(v(t.prototype),"depth",this).call(this):w(v(t.prototype),"depth",this).apply(this,arguments)}},{key:"createParentBoundables",value:function(n,i){se.isTrue(!n.isEmpty());var u=Math.trunc(Math.ceil(n.size()/this.getNodeCapacity())),f=new Z(n);kn.sort(f,t.xComparator);var g=this.verticalSlices(f,Math.trunc(Math.ceil(Math.sqrt(u))));return this.createParentBoundablesFromVerticalSlices(g,i)}},{key:"nearestNeighbour",value:function(){if(arguments.length===1){if(re(arguments[0],ed)){var n=arguments[0];if(this.isEmpty())return null;var i=new In(this.getRoot(),this.getRoot(),n);return this.nearestNeighbour(i)}if(arguments[0]instanceof In){var u=arguments[0],f=j.POSITIVE_INFINITY,g=null,y=new oi;for(y.add(u);!y.isEmpty()&&f>0;){var d=y.poll(),N=d.getDistance();if(N>=f)break;d.isLeaves()?(f=N,g=d):d.expandToQueue(y,f)}return g===null?null:[g.getBoundable(0).getItem(),g.getBoundable(1).getItem()]}}else{if(arguments.length===2){var b=arguments[0],L=arguments[1];if(this.isEmpty()||b.isEmpty())return null;var $=new In(this.getRoot(),b.getRoot(),L);return this.nearestNeighbour($)}if(arguments.length===3){var F=arguments[0],V=arguments[1],H=arguments[2],K=new Et(F,V),ge=new In(this.getRoot(),K,H);return this.nearestNeighbour(ge)[0]}if(arguments.length===4){var xe=arguments[0],Re=arguments[1],Ge=arguments[2],rt=arguments[3],kt=new Et(xe,Re),Zt=new In(this.getRoot(),kt,Ge);return this.nearestNeighbourK(Zt,rt)}}}},{key:"isWithinDistance",value:function(){if(arguments.length===2){var n=arguments[0],i=arguments[1],u=j.POSITIVE_INFINITY,f=new oi;for(f.add(n);!f.isEmpty();){var g=f.poll(),y=g.getDistance();if(y>i)return!1;if(g.maximumDistance()<=i)return!0;if(g.isLeaves()){if((u=y)<=i)return!0}else g.expandToQueue(f,u)}return!1}if(arguments.length===3){var d=arguments[0],N=arguments[1],b=arguments[2],L=new In(this.getRoot(),d.getRoot(),N);return this.isWithinDistance(L,b)}}},{key:"interfaces_",get:function(){return[Qm,X]}}],[{key:"constructor_",value:function(){if(arguments.length===0)t.constructor_.call(this,t.DEFAULT_NODE_CAPACITY);else if(arguments.length===1){var n=arguments[0];Sn.constructor_.call(this,n)}}},{key:"centreX",value:function(n){return t.avg(n.getMinX(),n.getMaxX())}},{key:"avg",value:function(n,i){return(n+i)/2}},{key:"getItems",value:function(n){for(var i=new Array(n.size()).fill(null),u=0;!n.isEmpty();){var f=n.poll();i[u]=f.getBoundable(0).getItem(),u++}return i}},{key:"centreY",value:function(n){return t.avg(n.getMinY(),n.getMaxY())}}]),t}(Sn),fc=function(s){h(t,s);var e=k(t);function t(){var n;return a(this,t),n=e.call(this),t.constructor_.apply(m(n),arguments),n}return c(t,[{key:"computeBounds",value:function(){for(var n=null,i=this.getChildBoundables().iterator();i.hasNext();){var u=i.next();n===null?n=new pe(u.getBounds()):n.expandToInclude(u.getBounds())}return n}}],[{key:"constructor_",value:function(){var n=arguments[0];He.constructor_.call(this,n)}}]),t}(He);gt.STRtreeNode=fc,gt.xComparator=new(function(){function s(){a(this,s)}return c(s,[{key:"interfaces_",get:function(){return[Pe]}},{key:"compare",value:function(e,t){return Sn.compareDoubles(gt.centreX(e.getBounds()),gt.centreX(t.getBounds()))}}]),s}()),gt.yComparator=new(function(){function s(){a(this,s)}return c(s,[{key:"interfaces_",get:function(){return[Pe]}},{key:"compare",value:function(e,t){return Sn.compareDoubles(gt.centreY(e.getBounds()),gt.centreY(t.getBounds()))}}]),s}()),gt.intersectsOp=new(function(){function s(){a(this,s)}return c(s,[{key:"interfaces_",get:function(){return[IntersectsOp]}},{key:"intersects",value:function(e,t){return e.intersects(t)}}]),s}()),gt.DEFAULT_NODE_CAPACITY=10;var td=function(){function s(){a(this,s)}return c(s,null,[{key:"relativeSign",value:function(e,t){return e<t?-1:e>t?1:0}},{key:"compare",value:function(e,t,n){if(t.equals2D(n))return 0;var i=s.relativeSign(t.x,n.x),u=s.relativeSign(t.y,n.y);switch(e){case 0:return s.compareValue(i,u);case 1:return s.compareValue(u,i);case 2:return s.compareValue(u,-i);case 3:return s.compareValue(-i,u);case 4:return s.compareValue(-i,-u);case 5:return s.compareValue(-u,-i);case 6:return s.compareValue(-u,i);case 7:return s.compareValue(i,-u)}return se.shouldNeverReachHere("invalid octant value"),0}},{key:"compareValue",value:function(e,t){return e<0?-1:e>0?1:t<0?-1:t>0?1:0}}]),s}(),nd=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"getCoordinate",value:function(){return this.coord}},{key:"print",value:function(e){e.print(this.coord),e.print(" seg # = "+this.segmentIndex)}},{key:"compareTo",value:function(e){var t=e;return this.segmentIndex<t.segmentIndex?-1:this.segmentIndex>t.segmentIndex?1:this.coord.equals2D(t.coord)?0:this._isInterior?t._isInterior?td.compare(this._segmentOctant,this.coord,t.coord):1:-1}},{key:"isEndPoint",value:function(e){return this.segmentIndex===0&&!this._isInterior||this.segmentIndex===e}},{key:"toString",value:function(){return this.segmentIndex+":"+this.coord.toString()}},{key:"isInterior",value:function(){return this._isInterior}},{key:"interfaces_",get:function(){return[Y]}}],[{key:"constructor_",value:function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var e=arguments[0],t=arguments[1],n=arguments[2],i=arguments[3];this._segString=e,this.coord=new O(t),this.segmentIndex=n,this._segmentOctant=i,this._isInterior=!t.equals2D(e.getCoordinate(n))}}]),s}(),rd=function(){function s(){a(this,s)}return c(s,[{key:"hasNext",value:function(){}},{key:"next",value:function(){}},{key:"remove",value:function(){}}]),s}(),id=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"getSplitCoordinates",value:function(){var e=new Hn;this.addEndpoints();for(var t=this.iterator(),n=t.next();t.hasNext();){var i=t.next();this.addEdgeCoordinates(n,i,e),n=i}return e.toCoordinateArray()}},{key:"addCollapsedNodes",value:function(){var e=new Z;this.findCollapsesFromInsertedNodes(e),this.findCollapsesFromExistingVertices(e);for(var t=e.iterator();t.hasNext();){var n=t.next().intValue();this.add(this._edge.getCoordinate(n),n)}}},{key:"createSplitEdgePts",value:function(e,t){var n=t.segmentIndex-e.segmentIndex+2;if(n===2)return[new O(e.coord),new O(t.coord)];var i=this._edge.getCoordinate(t.segmentIndex),u=t.isInterior()||!t.coord.equals2D(i);u||n--;var f=new Array(n).fill(null),g=0;f[g++]=new O(e.coord);for(var y=e.segmentIndex+1;y<=t.segmentIndex;y++)f[g++]=this._edge.getCoordinate(y);return u&&(f[g]=new O(t.coord)),f}},{key:"print",value:function(e){e.println("Intersections:");for(var t=this.iterator();t.hasNext();)t.next().print(e)}},{key:"findCollapsesFromExistingVertices",value:function(e){for(var t=0;t<this._edge.size()-2;t++){var n=this._edge.getCoordinate(t);this._edge.getCoordinate(t+1);var i=this._edge.getCoordinate(t+2);n.equals2D(i)&&e.add(Jr.valueOf(t+1))}}},{key:"addEdgeCoordinates",value:function(e,t,n){var i=this.createSplitEdgePts(e,t);n.add(i,!1)}},{key:"iterator",value:function(){return this._nodeMap.values().iterator()}},{key:"addSplitEdges",value:function(e){this.addEndpoints(),this.addCollapsedNodes();for(var t=this.iterator(),n=t.next();t.hasNext();){var i=t.next(),u=this.createSplitEdge(n,i);e.add(u),n=i}}},{key:"findCollapseIndex",value:function(e,t,n){if(!e.coord.equals2D(t.coord))return!1;var i=t.segmentIndex-e.segmentIndex;return t.isInterior()||i--,i===1&&(n[0]=e.segmentIndex+1,!0)}},{key:"findCollapsesFromInsertedNodes",value:function(e){for(var t=new Array(1).fill(null),n=this.iterator(),i=n.next();n.hasNext();){var u=n.next();this.findCollapseIndex(i,u,t)&&e.add(Jr.valueOf(t[0])),i=u}}},{key:"getEdge",value:function(){return this._edge}},{key:"addEndpoints",value:function(){var e=this._edge.size()-1;this.add(this._edge.getCoordinate(0),0),this.add(this._edge.getCoordinate(e),e)}},{key:"createSplitEdge",value:function(e,t){var n=this.createSplitEdgePts(e,t);return new Ht(n,this._edge.getData())}},{key:"add",value:function(e,t){var n=new nd(this._edge,e,t,this._edge.getSegmentOctant(t)),i=this._nodeMap.get(n);return i!==null?(se.isTrue(i.coord.equals2D(e),"Found equal nodes with different coordinates"),i):(this._nodeMap.put(n,n),n)}},{key:"checkSplitEdgesCorrectness",value:function(e){var t=this._edge.getCoordinates(),n=e.get(0).getCoordinate(0);if(!n.equals2D(t[0]))throw new we("bad split edge start point at "+n);var i=e.get(e.size()-1).getCoordinates(),u=i[i.length-1];if(!u.equals2D(t[t.length-1]))throw new we("bad split edge end point at "+u)}}],[{key:"constructor_",value:function(){this._nodeMap=new Qn,this._edge=null;var e=arguments[0];this._edge=e}}]),s}(),sd=function(){function s(){a(this,s)}return c(s,null,[{key:"octant",value:function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var e=arguments[0],t=arguments[1];if(e===0&&t===0)throw new M("Cannot compute the octant for point ( "+e+", "+t+" )");var n=Math.abs(e),i=Math.abs(t);return e>=0?t>=0?n>=i?0:1:n>=i?7:6:t>=0?n>=i?3:2:n>=i?4:5}if(arguments[0]instanceof O&&arguments[1]instanceof O){var u=arguments[0],f=arguments[1],g=f.x-u.x,y=f.y-u.y;if(g===0&&y===0)throw new M("Cannot compute the octant for two identical points "+u);return s.octant(g,y)}}}]),s}(),ad=function(){function s(){a(this,s)}return c(s,[{key:"getCoordinates",value:function(){}},{key:"size",value:function(){}},{key:"getCoordinate",value:function(e){}},{key:"isClosed",value:function(){}},{key:"setData",value:function(e){}},{key:"getData",value:function(){}}]),s}(),od=function(){function s(){a(this,s)}return c(s,[{key:"addIntersection",value:function(e,t){}},{key:"interfaces_",get:function(){return[ad]}}]),s}(),Ht=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"getCoordinates",value:function(){return this._pts}},{key:"size",value:function(){return this._pts.length}},{key:"getCoordinate",value:function(e){return this._pts[e]}},{key:"isClosed",value:function(){return this._pts[0].equals(this._pts[this._pts.length-1])}},{key:"getSegmentOctant",value:function(e){return e===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(e),this.getCoordinate(e+1))}},{key:"setData",value:function(e){this._data=e}},{key:"safeOctant",value:function(e,t){return e.equals2D(t)?0:sd.octant(e,t)}},{key:"getData",value:function(){return this._data}},{key:"addIntersection",value:function(){if(arguments.length===2){var e=arguments[0],t=arguments[1];this.addIntersectionNode(e,t)}else if(arguments.length===4){var n=arguments[0],i=arguments[1],u=arguments[3],f=new O(n.getIntersection(u));this.addIntersection(f,i)}}},{key:"toString",value:function(){return js.toLineString(new Zn(this._pts))}},{key:"getNodeList",value:function(){return this._nodeList}},{key:"addIntersectionNode",value:function(e,t){var n=t,i=n+1;if(i<this._pts.length){var u=this._pts[i];e.equals2D(u)&&(n=i)}return this._nodeList.add(e,n)}},{key:"addIntersections",value:function(e,t,n){for(var i=0;i<e.getIntersectionNum();i++)this.addIntersection(e,t,n,i)}},{key:"interfaces_",get:function(){return[od]}}],[{key:"constructor_",value:function(){this._nodeList=new id(this),this._pts=null,this._data=null;var e=arguments[0],t=arguments[1];this._pts=e,this._data=t}},{key:"getNodedSubstrings",value:function(){if(arguments.length===1){var e=arguments[0],t=new Z;return s.getNodedSubstrings(e,t),t}if(arguments.length===2)for(var n=arguments[0],i=arguments[1],u=n.iterator();u.hasNext();){var f=u.next();f.getNodeList().addSplitEdges(i)}}}]),s}(),$e=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"minX",value:function(){return Math.min(this.p0.x,this.p1.x)}},{key:"orientationIndex",value:function(){if(arguments[0]instanceof s){var e=arguments[0],t=Q.index(this.p0,this.p1,e.p0),n=Q.index(this.p0,this.p1,e.p1);return t>=0&&n>=0||t<=0&&n<=0?Math.max(t,n):0}if(arguments[0]instanceof O){var i=arguments[0];return Q.index(this.p0,this.p1,i)}}},{key:"toGeometry",value:function(e){return e.createLineString([this.p0,this.p1])}},{key:"isVertical",value:function(){return this.p0.x===this.p1.x}},{key:"equals",value:function(e){if(!(e instanceof s))return!1;var t=e;return this.p0.equals(t.p0)&&this.p1.equals(t.p1)}},{key:"intersection",value:function(e){var t=new Wt;return t.computeIntersection(this.p0,this.p1,e.p0,e.p1),t.hasIntersection()?t.getIntersection(0):null}},{key:"project",value:function(){if(arguments[0]instanceof O){var e=arguments[0];if(e.equals(this.p0)||e.equals(this.p1))return new O(e);var t=this.projectionFactor(e),n=new O;return n.x=this.p0.x+t*(this.p1.x-this.p0.x),n.y=this.p0.y+t*(this.p1.y-this.p0.y),n}if(arguments[0]instanceof s){var i=arguments[0],u=this.projectionFactor(i.p0),f=this.projectionFactor(i.p1);if(u>=1&&f>=1||u<=0&&f<=0)return null;var g=this.project(i.p0);u<0&&(g=this.p0),u>1&&(g=this.p1);var y=this.project(i.p1);return f<0&&(y=this.p0),f>1&&(y=this.p1),new s(g,y)}}},{key:"normalize",value:function(){this.p1.compareTo(this.p0)<0&&this.reverse()}},{key:"angle",value:function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)}},{key:"getCoordinate",value:function(e){return e===0?this.p0:this.p1}},{key:"distancePerpendicular",value:function(e){return ft.pointToLinePerpendicular(e,this.p0,this.p1)}},{key:"minY",value:function(){return Math.min(this.p0.y,this.p1.y)}},{key:"midPoint",value:function(){return s.midPoint(this.p0,this.p1)}},{key:"projectionFactor",value:function(e){if(e.equals(this.p0))return 0;if(e.equals(this.p1))return 1;var t=this.p1.x-this.p0.x,n=this.p1.y-this.p0.y,i=t*t+n*n;return i<=0?j.NaN:((e.x-this.p0.x)*t+(e.y-this.p0.y)*n)/i}},{key:"closestPoints",value:function(e){var t=this.intersection(e);if(t!==null)return[t,t];var n=new Array(2).fill(null),i=j.MAX_VALUE,u=null,f=this.closestPoint(e.p0);i=f.distance(e.p0),n[0]=f,n[1]=e.p0;var g=this.closestPoint(e.p1);(u=g.distance(e.p1))<i&&(i=u,n[0]=g,n[1]=e.p1);var y=e.closestPoint(this.p0);(u=y.distance(this.p0))<i&&(i=u,n[0]=this.p0,n[1]=y);var d=e.closestPoint(this.p1);return(u=d.distance(this.p1))<i&&(i=u,n[0]=this.p1,n[1]=d),n}},{key:"closestPoint",value:function(e){var t=this.projectionFactor(e);return t>0&&t<1?this.project(e):this.p0.distance(e)<this.p1.distance(e)?this.p0:this.p1}},{key:"maxX",value:function(){return Math.max(this.p0.x,this.p1.x)}},{key:"getLength",value:function(){return this.p0.distance(this.p1)}},{key:"compareTo",value:function(e){var t=e,n=this.p0.compareTo(t.p0);return n!==0?n:this.p1.compareTo(t.p1)}},{key:"reverse",value:function(){var e=this.p0;this.p0=this.p1,this.p1=e}},{key:"equalsTopo",value:function(e){return this.p0.equals(e.p0)&&this.p1.equals(e.p1)||this.p0.equals(e.p1)&&this.p1.equals(e.p0)}},{key:"lineIntersection",value:function(e){return $s.intersection(this.p0,this.p1,e.p0,e.p1)}},{key:"maxY",value:function(){return Math.max(this.p0.y,this.p1.y)}},{key:"pointAlongOffset",value:function(e,t){var n=this.p0.x+e*(this.p1.x-this.p0.x),i=this.p0.y+e*(this.p1.y-this.p0.y),u=this.p1.x-this.p0.x,f=this.p1.y-this.p0.y,g=Math.sqrt(u*u+f*f),y=0,d=0;if(t!==0){if(g<=0)throw new IllegalStateException("Cannot compute offset from zero-length line segment");y=t*u/g,d=t*f/g}return new O(n-d,i+y)}},{key:"setCoordinates",value:function(){if(arguments.length===1){var e=arguments[0];this.setCoordinates(e.p0,e.p1)}else if(arguments.length===2){var t=arguments[0],n=arguments[1];this.p0.x=t.x,this.p0.y=t.y,this.p1.x=n.x,this.p1.y=n.y}}},{key:"segmentFraction",value:function(e){var t=this.projectionFactor(e);return t<0?t=0:(t>1||j.isNaN(t))&&(t=1),t}},{key:"toString",value:function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"}},{key:"isHorizontal",value:function(){return this.p0.y===this.p1.y}},{key:"reflect",value:function(e){var t=this.p1.getY()-this.p0.getY(),n=this.p0.getX()-this.p1.getX(),i=this.p0.getY()*(this.p1.getX()-this.p0.getX())-this.p0.getX()*(this.p1.getY()-this.p0.getY()),u=t*t+n*n,f=t*t-n*n,g=e.getX(),y=e.getY();return new O((-f*g-2*t*n*y-2*t*i)/u,(f*y-2*t*n*g-2*n*i)/u)}},{key:"distance",value:function(){if(arguments[0]instanceof s){var e=arguments[0];return ft.segmentToSegment(this.p0,this.p1,e.p0,e.p1)}if(arguments[0]instanceof O){var t=arguments[0];return ft.pointToSegment(t,this.p0,this.p1)}}},{key:"pointAlong",value:function(e){var t=new O;return t.x=this.p0.x+e*(this.p1.x-this.p0.x),t.y=this.p0.y+e*(this.p1.y-this.p0.y),t}},{key:"hashCode",value:function(){var e=j.doubleToLongBits(this.p0.x);e^=31*j.doubleToLongBits(this.p0.y);var t=Math.trunc(e)^Math.trunc(e>>32),n=j.doubleToLongBits(this.p1.x);return n^=31*j.doubleToLongBits(this.p1.y),t^(Math.trunc(n)^Math.trunc(n>>32))}},{key:"interfaces_",get:function(){return[Y,X]}}],[{key:"constructor_",value:function(){if(this.p0=null,this.p1=null,arguments.length===0)s.constructor_.call(this,new O,new O);else if(arguments.length===1){var e=arguments[0];s.constructor_.call(this,e.p0,e.p1)}else if(arguments.length===2){var t=arguments[0],n=arguments[1];this.p0=t,this.p1=n}else if(arguments.length===4){var i=arguments[0],u=arguments[1],f=arguments[2],g=arguments[3];s.constructor_.call(this,new O(i,u),new O(f,g))}}},{key:"midPoint",value:function(e,t){return new O((e.x+t.x)/2,(e.y+t.y)/2)}}]),s}(),ud=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"overlap",value:function(){if(arguments.length!==2){if(arguments.length===4){var e=arguments[0],t=arguments[1],n=arguments[2],i=arguments[3];e.getLineSegment(t,this._overlapSeg1),n.getLineSegment(i,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}}}}],[{key:"constructor_",value:function(){this._overlapSeg1=new $e,this._overlapSeg2=new $e}}]),s}(),hc=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"getLineSegment",value:function(e,t){t.p0=this._pts[e],t.p1=this._pts[e+1]}},{key:"computeSelect",value:function(e,t,n,i){var u=this._pts[t],f=this._pts[n];if(n-t==1)return i.select(this,t),null;if(!e.intersects(u,f))return null;var g=Math.trunc((t+n)/2);t<g&&this.computeSelect(e,t,g,i),g<n&&this.computeSelect(e,g,n,i)}},{key:"getCoordinates",value:function(){for(var e=new Array(this._end-this._start+1).fill(null),t=0,n=this._start;n<=this._end;n++)e[t++]=this._pts[n];return e}},{key:"computeOverlaps",value:function(){if(arguments.length===2){var e=arguments[0],t=arguments[1];this.computeOverlaps(this._start,this._end,e,e._start,e._end,t)}else if(arguments.length===6){var n=arguments[0],i=arguments[1],u=arguments[2],f=arguments[3],g=arguments[4],y=arguments[5];if(i-n==1&&g-f==1)return y.overlap(this,n,u,f),null;if(!this.overlaps(n,i,u,f,g))return null;var d=Math.trunc((n+i)/2),N=Math.trunc((f+g)/2);n<d&&(f<N&&this.computeOverlaps(n,d,u,f,N,y),N<g&&this.computeOverlaps(n,d,u,N,g,y)),d<i&&(f<N&&this.computeOverlaps(d,i,u,f,N,y),N<g&&this.computeOverlaps(d,i,u,N,g,y))}}},{key:"setId",value:function(e){this._id=e}},{key:"select",value:function(e,t){this.computeSelect(e,this._start,this._end,t)}},{key:"getEnvelope",value:function(){if(this._env===null){var e=this._pts[this._start],t=this._pts[this._end];this._env=new pe(e,t)}return this._env}},{key:"overlaps",value:function(e,t,n,i,u){return pe.intersects(this._pts[e],this._pts[t],n._pts[i],n._pts[u])}},{key:"getEndIndex",value:function(){return this._end}},{key:"getStartIndex",value:function(){return this._start}},{key:"getContext",value:function(){return this._context}},{key:"getId",value:function(){return this._id}}],[{key:"constructor_",value:function(){this._pts=null,this._start=null,this._end=null,this._env=null,this._context=null,this._id=null;var e=arguments[0],t=arguments[1],n=arguments[2],i=arguments[3];this._pts=e,this._start=t,this._end=n,this._context=i}}]),s}(),ld=function(){function s(){a(this,s)}return c(s,null,[{key:"findChainEnd",value:function(e,t){for(var n=t;n<e.length-1&&e[n].equals2D(e[n+1]);)n++;if(n>=e.length-1)return e.length-1;for(var i=Ae.quadrant(e[n],e[n+1]),u=t+1;u<e.length&&!(!e[u-1].equals2D(e[u])&&Ae.quadrant(e[u-1],e[u])!==i);)u++;return u-1}},{key:"getChains",value:function(){if(arguments.length===1){var e=arguments[0];return s.getChains(e,null)}if(arguments.length===2){var t=arguments[0],n=arguments[1],i=new Z,u=0;do{var f=s.findChainEnd(t,u),g=new hc(t,u,f,n);i.add(g),u=f}while(u<t.length-1);return i}}}]),s}(),Zs=function(){function s(){a(this,s)}return c(s,[{key:"computeNodes",value:function(e){}},{key:"getNodedSubstrings",value:function(){}}]),s}(),gc=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"setSegmentIntersector",value:function(e){this._segInt=e}},{key:"interfaces_",get:function(){return[Zs]}}],[{key:"constructor_",value:function(){if(this._segInt=null,arguments.length!==0){if(arguments.length===1){var e=arguments[0];this.setSegmentIntersector(e)}}}}]),s}(),Js=function(s){h(t,s);var e=k(t);function t(){var n;return a(this,t),n=e.call(this),t.constructor_.apply(m(n),arguments),n}return c(t,[{key:"getMonotoneChains",value:function(){return this._monoChains}},{key:"getNodedSubstrings",value:function(){return Ht.getNodedSubstrings(this._nodedSegStrings)}},{key:"getIndex",value:function(){return this._index}},{key:"add",value:function(n){for(var i=ld.getChains(n.getCoordinates(),n).iterator();i.hasNext();){var u=i.next();u.setId(this._idCounter++),this._index.insert(u.getEnvelope(),u),this._monoChains.add(u)}}},{key:"computeNodes",value:function(n){this._nodedSegStrings=n;for(var i=n.iterator();i.hasNext();)this.add(i.next());this.intersectChains()}},{key:"intersectChains",value:function(){for(var n=new yc(this._segInt),i=this._monoChains.iterator();i.hasNext();)for(var u=i.next(),f=this._index.query(u.getEnvelope()).iterator();f.hasNext();){var g=f.next();if(g.getId()>u.getId()&&(u.computeOverlaps(g,n),this._nOverlaps++),this._segInt.isDone())return null}}}],[{key:"constructor_",value:function(){if(this._monoChains=new Z,this._index=new gt,this._idCounter=0,this._nodedSegStrings=null,this._nOverlaps=0,arguments.length!==0){if(arguments.length===1){var n=arguments[0];gc.constructor_.call(this,n)}}}}]),t}(gc),yc=function(s){h(t,s);var e=k(t);function t(){var n;return a(this,t),n=e.call(this),t.constructor_.apply(m(n),arguments),n}return c(t,[{key:"overlap",value:function(){if(arguments.length!==4)return w(v(t.prototype),"overlap",this).apply(this,arguments);var n=arguments[0],i=arguments[1],u=arguments[2],f=arguments[3],g=n.getContext(),y=u.getContext();this._si.processIntersections(g,i,y,f)}}],[{key:"constructor_",value:function(){this._si=null;var n=arguments[0];this._si=n}}]),t}(ud);Js.SegmentOverlapAction=yc;var nt=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"isDeletable",value:function(e,t,n,i){var u=this._inputLine[e],f=this._inputLine[t],g=this._inputLine[n];return!!this.isConcave(u,f,g)&&!!this.isShallow(u,f,g,i)&&this.isShallowSampled(u,f,e,n,i)}},{key:"deleteShallowConcavities",value:function(){for(var e=1,t=this.findNextNonDeletedIndex(e),n=this.findNextNonDeletedIndex(t),i=!1;n<this._inputLine.length;){var u=!1;this.isDeletable(e,t,n,this._distanceTol)&&(this._isDeleted[t]=s.DELETE,u=!0,i=!0),e=u?n:t,t=this.findNextNonDeletedIndex(e),n=this.findNextNonDeletedIndex(t)}return i}},{key:"isShallowConcavity",value:function(e,t,n,i){return Q.index(e,t,n)===this._angleOrientation&&ft.pointToSegment(t,e,n)<i}},{key:"isShallowSampled",value:function(e,t,n,i,u){var f=Math.trunc((i-n)/s.NUM_PTS_TO_CHECK);f<=0&&(f=1);for(var g=n;g<i;g+=f)if(!this.isShallow(e,t,this._inputLine[g],u))return!1;return!0}},{key:"isConcave",value:function(e,t,n){var i=Q.index(e,t,n)===this._angleOrientation;return i}},{key:"simplify",value:function(e){this._distanceTol=Math.abs(e),e<0&&(this._angleOrientation=Q.CLOCKWISE),this._isDeleted=new Array(this._inputLine.length).fill(null);var t=!1;do t=this.deleteShallowConcavities();while(t);return this.collapseLine()}},{key:"findNextNonDeletedIndex",value:function(e){for(var t=e+1;t<this._inputLine.length&&this._isDeleted[t]===s.DELETE;)t++;return t}},{key:"isShallow",value:function(e,t,n,i){return ft.pointToSegment(t,e,n)<i}},{key:"collapseLine",value:function(){for(var e=new Hn,t=0;t<this._inputLine.length;t++)this._isDeleted[t]!==s.DELETE&&e.add(this._inputLine[t]);return e.toCoordinateArray()}}],[{key:"constructor_",value:function(){this._inputLine=null,this._distanceTol=null,this._isDeleted=null,this._angleOrientation=Q.COUNTERCLOCKWISE;var e=arguments[0];this._inputLine=e}},{key:"simplify",value:function(e,t){return new s(e).simplify(t)}}]),s}();nt.INIT=0,nt.DELETE=1,nt.KEEP=1,nt.NUM_PTS_TO_CHECK=10;var vc=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"getCoordinates",value:function(){return this._ptList.toArray(s.COORDINATE_ARRAY_TYPE)}},{key:"setPrecisionModel",value:function(e){this._precisionModel=e}},{key:"addPt",value:function(e){var t=new O(e);if(this._precisionModel.makePrecise(t),this.isRedundant(t))return null;this._ptList.add(t)}},{key:"reverse",value:function(){}},{key:"addPts",value:function(e,t){if(t)for(var n=0;n<e.length;n++)this.addPt(e[n]);else for(var i=e.length-1;i>=0;i--)this.addPt(e[i])}},{key:"isRedundant",value:function(e){if(this._ptList.size()<1)return!1;var t=this._ptList.get(this._ptList.size()-1);return e.distance(t)<this._minimimVertexDistance}},{key:"toString",value:function(){return new xn().createLineString(this.getCoordinates()).toString()}},{key:"closeRing",value:function(){if(this._ptList.size()<1)return null;var e=new O(this._ptList.get(0)),t=this._ptList.get(this._ptList.size()-1);if(e.equals(t))return null;this._ptList.add(e)}},{key:"setMinimumVertexDistance",value:function(e){this._minimimVertexDistance=e}}],[{key:"constructor_",value:function(){this._ptList=null,this._precisionModel=null,this._minimimVertexDistance=0,this._ptList=new Z}}]),s}();vc.COORDINATE_ARRAY_TYPE=new Array(0).fill(null);var Be=function(){function s(){a(this,s)}return c(s,null,[{key:"toDegrees",value:function(e){return 180*e/Math.PI}},{key:"normalize",value:function(e){for(;e>Math.PI;)e-=s.PI_TIMES_2;for(;e<=-Math.PI;)e+=s.PI_TIMES_2;return e}},{key:"angle",value:function(){if(arguments.length===1){var e=arguments[0];return Math.atan2(e.y,e.x)}if(arguments.length===2){var t=arguments[0],n=arguments[1],i=n.x-t.x,u=n.y-t.y;return Math.atan2(u,i)}}},{key:"isAcute",value:function(e,t,n){var i=e.x-t.x,u=e.y-t.y;return i*(n.x-t.x)+u*(n.y-t.y)>0}},{key:"isObtuse",value:function(e,t,n){var i=e.x-t.x,u=e.y-t.y;return i*(n.x-t.x)+u*(n.y-t.y)<0}},{key:"interiorAngle",value:function(e,t,n){var i=s.angle(t,e),u=s.angle(t,n);return Math.abs(u-i)}},{key:"normalizePositive",value:function(e){if(e<0){for(;e<0;)e+=s.PI_TIMES_2;e>=s.PI_TIMES_2&&(e=0)}else{for(;e>=s.PI_TIMES_2;)e-=s.PI_TIMES_2;e<0&&(e=0)}return e}},{key:"angleBetween",value:function(e,t,n){var i=s.angle(t,e),u=s.angle(t,n);return s.diff(i,u)}},{key:"diff",value:function(e,t){var n=null;return(n=e<t?t-e:e-t)>Math.PI&&(n=2*Math.PI-n),n}},{key:"toRadians",value:function(e){return e*Math.PI/180}},{key:"getTurn",value:function(e,t){var n=Math.sin(t-e);return n>0?s.COUNTERCLOCKWISE:n<0?s.CLOCKWISE:s.NONE}},{key:"angleBetweenOriented",value:function(e,t,n){var i=s.angle(t,e),u=s.angle(t,n)-i;return u<=-Math.PI?u+s.PI_TIMES_2:u>Math.PI?u-s.PI_TIMES_2:u}}]),s}();Be.PI_TIMES_2=2*Math.PI,Be.PI_OVER_2=Math.PI/2,Be.PI_OVER_4=Math.PI/4,Be.COUNTERCLOCKWISE=Q.COUNTERCLOCKWISE,Be.CLOCKWISE=Q.CLOCKWISE,Be.NONE=Q.COLLINEAR;var Kn=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"addNextSegment",value:function(e,t){if(this._s0=this._s1,this._s1=this._s2,this._s2=e,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=Q.index(this._s0,this._s1,this._s2),i=n===Q.CLOCKWISE&&this._side===B.LEFT||n===Q.COUNTERCLOCKWISE&&this._side===B.RIGHT;n===0?this.addCollinear(t):i?this.addOutsideTurn(n,t):this.addInsideTurn(n,t)}},{key:"addLineEndCap",value:function(e,t){var n=new $e(e,t),i=new $e;this.computeOffsetSegment(n,B.LEFT,this._distance,i);var u=new $e;this.computeOffsetSegment(n,B.RIGHT,this._distance,u);var f=t.x-e.x,g=t.y-e.y,y=Math.atan2(g,f);switch(this._bufParams.getEndCapStyle()){case A.CAP_ROUND:this._segList.addPt(i.p1),this.addDirectedFillet(t,y+Math.PI/2,y-Math.PI/2,Q.CLOCKWISE,this._distance),this._segList.addPt(u.p1);break;case A.CAP_FLAT:this._segList.addPt(i.p1),this._segList.addPt(u.p1);break;case A.CAP_SQUARE:var d=new O;d.x=Math.abs(this._distance)*Math.cos(y),d.y=Math.abs(this._distance)*Math.sin(y);var N=new O(i.p1.x+d.x,i.p1.y+d.y),b=new O(u.p1.x+d.x,u.p1.y+d.y);this._segList.addPt(N),this._segList.addPt(b)}}},{key:"getCoordinates",value:function(){return this._segList.getCoordinates()}},{key:"addMitreJoin",value:function(e,t,n,i){var u=$s.intersection(t.p0,t.p1,n.p0,n.p1);if(u!==null&&(i<=0?1:u.distance(e)/Math.abs(i))<=this._bufParams.getMitreLimit())return this._segList.addPt(u),null;this.addLimitedMitreJoin(t,n,i,this._bufParams.getMitreLimit())}},{key:"addOutsideTurn",value:function(e,t){if(this._offset0.p1.distance(this._offset1.p0)<this._distance*s.OFFSET_SEGMENT_SEPARATION_FACTOR)return this._segList.addPt(this._offset0.p1),null;this._bufParams.getJoinStyle()===A.JOIN_MITRE?this.addMitreJoin(this._s1,this._offset0,this._offset1,this._distance):this._bufParams.getJoinStyle()===A.JOIN_BEVEL?this.addBevelJoin(this._offset0,this._offset1):(t&&this._segList.addPt(this._offset0.p1),this.addCornerFillet(this._s1,this._offset0.p1,this._offset1.p0,e,this._distance),this._segList.addPt(this._offset1.p0))}},{key:"createSquare",value:function(e){this._segList.addPt(new O(e.x+this._distance,e.y+this._distance)),this._segList.addPt(new O(e.x+this._distance,e.y-this._distance)),this._segList.addPt(new O(e.x-this._distance,e.y-this._distance)),this._segList.addPt(new O(e.x-this._distance,e.y+this._distance)),this._segList.closeRing()}},{key:"addSegments",value:function(e,t){this._segList.addPts(e,t)}},{key:"addFirstSegment",value:function(){this._segList.addPt(this._offset1.p0)}},{key:"addCornerFillet",value:function(e,t,n,i,u){var f=t.x-e.x,g=t.y-e.y,y=Math.atan2(g,f),d=n.x-e.x,N=n.y-e.y,b=Math.atan2(N,d);i===Q.CLOCKWISE?y<=b&&(y+=2*Math.PI):y>=b&&(y-=2*Math.PI),this._segList.addPt(t),this.addDirectedFillet(e,y,b,i,u),this._segList.addPt(n)}},{key:"addLastSegment",value:function(){this._segList.addPt(this._offset1.p1)}},{key:"initSideSegments",value:function(e,t,n){this._s1=e,this._s2=t,this._side=n,this._seg1.setCoordinates(e,t),this.computeOffsetSegment(this._seg1,n,this._distance,this._offset1)}},{key:"addLimitedMitreJoin",value:function(e,t,n,i){var u=this._seg0.p1,f=Be.angle(u,this._seg0.p0),g=Be.angleBetweenOriented(this._seg0.p0,u,this._seg1.p1)/2,y=Be.normalize(f+g),d=Be.normalize(y+Math.PI),N=i*n,b=n-N*Math.abs(Math.sin(g)),L=u.x+N*Math.cos(d),$=u.y+N*Math.sin(d),F=new O(L,$),V=new $e(u,F),H=V.pointAlongOffset(1,b),K=V.pointAlongOffset(1,-b);this._side===B.LEFT?(this._segList.addPt(H),this._segList.addPt(K)):(this._segList.addPt(K),this._segList.addPt(H))}},{key:"addDirectedFillet",value:function(e,t,n,i,u){var f=i===Q.CLOCKWISE?-1:1,g=Math.abs(t-n),y=Math.trunc(g/this._filletAngleQuantum+.5);if(y<1)return null;for(var d=g/y,N=new O,b=0;b<y;b++){var L=t+f*b*d;N.x=e.x+u*Math.cos(L),N.y=e.y+u*Math.sin(L),this._segList.addPt(N)}}},{key:"computeOffsetSegment",value:function(e,t,n,i){var u=t===B.LEFT?1:-1,f=e.p1.x-e.p0.x,g=e.p1.y-e.p0.y,y=Math.sqrt(f*f+g*g),d=u*n*f/y,N=u*n*g/y;i.p0.x=e.p0.x-N,i.p0.y=e.p0.y+d,i.p1.x=e.p1.x-N,i.p1.y=e.p1.y+d}},{key:"addInsideTurn",value:function(e,t){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*s.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 O((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 i=new O((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(i)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}}},{key:"createCircle",value:function(e){var t=new O(e.x+this._distance,e.y);this._segList.addPt(t),this.addDirectedFillet(e,0,2*Math.PI,-1,this._distance),this._segList.closeRing()}},{key:"addBevelJoin",value:function(e,t){this._segList.addPt(e.p1),this._segList.addPt(t.p0)}},{key:"init",value:function(e){this._distance=e,this._maxCurveSegmentError=e*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new vc,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(e*s.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)}},{key:"addCollinear",value:function(e){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2),this._li.getIntersectionNum()>=2&&(this._bufParams.getJoinStyle()===A.JOIN_BEVEL||this._bufParams.getJoinStyle()===A.JOIN_MITRE?(e&&this._segList.addPt(this._offset0.p1),this._segList.addPt(this._offset1.p0)):this.addCornerFillet(this._s1,this._offset0.p1,this._offset1.p0,Q.CLOCKWISE,this._distance))}},{key:"closeRing",value:function(){this._segList.closeRing()}},{key:"hasNarrowConcaveAngle",value:function(){return this._hasNarrowConcaveAngle}}],[{key:"constructor_",value:function(){this._maxCurveSegmentError=0,this._filletAngleQuantum=null,this._closingSegLengthFactor=1,this._segList=null,this._distance=0,this._precisionModel=null,this._bufParams=null,this._li=null,this._s0=null,this._s1=null,this._s2=null,this._seg0=new $e,this._seg1=new $e,this._offset0=new $e,this._offset1=new $e,this._side=0,this._hasNarrowConcaveAngle=!1;var e=arguments[0],t=arguments[1],n=arguments[2];this._precisionModel=e,this._bufParams=t,this._li=new Wt,this._filletAngleQuantum=Math.PI/2/t.getQuadrantSegments(),t.getQuadrantSegments()>=8&&t.getJoinStyle()===A.JOIN_ROUND&&(this._closingSegLengthFactor=s.MAX_CLOSING_SEG_LEN_FACTOR),this.init(n)}}]),s}();Kn.OFFSET_SEGMENT_SEPARATION_FACTOR=.001,Kn.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR=.001,Kn.CURVE_VERTEX_SNAP_DISTANCE_FACTOR=1e-6,Kn.MAX_CLOSING_SEG_LEN_FACTOR=80;var cd=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"getOffsetCurve",value:function(e,t){if(this._distance=t,t===0)return null;var n=t<0,i=Math.abs(t),u=this.getSegGen(i);e.length<=1?this.computePointCurve(e[0],u):this.computeOffsetCurve(e,n,u);var f=u.getCoordinates();return n&&Ee.reverse(f),f}},{key:"computeSingleSidedBufferCurve",value:function(e,t,n){var i=this.simplifyTolerance(this._distance);if(t){n.addSegments(e,!0);var u=nt.simplify(e,-i),f=u.length-1;n.initSideSegments(u[f],u[f-1],B.LEFT),n.addFirstSegment();for(var g=f-2;g>=0;g--)n.addNextSegment(u[g],!0)}else{n.addSegments(e,!1);var y=nt.simplify(e,i),d=y.length-1;n.initSideSegments(y[0],y[1],B.LEFT),n.addFirstSegment();for(var N=2;N<=d;N++)n.addNextSegment(y[N],!0)}n.addLastSegment(),n.closeRing()}},{key:"computeRingBufferCurve",value:function(e,t,n){var i=this.simplifyTolerance(this._distance);t===B.RIGHT&&(i=-i);var u=nt.simplify(e,i),f=u.length-1;n.initSideSegments(u[f-1],u[0],t);for(var g=1;g<=f;g++){var y=g!==1;n.addNextSegment(u[g],y)}n.closeRing()}},{key:"computeLineBufferCurve",value:function(e,t){var n=this.simplifyTolerance(this._distance),i=nt.simplify(e,n),u=i.length-1;t.initSideSegments(i[0],i[1],B.LEFT);for(var f=2;f<=u;f++)t.addNextSegment(i[f],!0);t.addLastSegment(),t.addLineEndCap(i[u-1],i[u]);var g=nt.simplify(e,-n),y=g.length-1;t.initSideSegments(g[y],g[y-1],B.LEFT);for(var d=y-2;d>=0;d--)t.addNextSegment(g[d],!0);t.addLastSegment(),t.addLineEndCap(g[1],g[0]),t.closeRing()}},{key:"computePointCurve",value:function(e,t){switch(this._bufParams.getEndCapStyle()){case A.CAP_ROUND:t.createCircle(e);break;case A.CAP_SQUARE:t.createSquare(e)}}},{key:"getLineCurve",value:function(e,t){if(this._distance=t,this.isLineOffsetEmpty(t))return null;var n=Math.abs(t),i=this.getSegGen(n);if(e.length<=1)this.computePointCurve(e[0],i);else if(this._bufParams.isSingleSided()){var u=t<0;this.computeSingleSidedBufferCurve(e,u,i)}else this.computeLineBufferCurve(e,i);return i.getCoordinates()}},{key:"getBufferParameters",value:function(){return this._bufParams}},{key:"simplifyTolerance",value:function(e){return e*this._bufParams.getSimplifyFactor()}},{key:"getRingCurve",value:function(e,t,n){if(this._distance=n,e.length<=2)return this.getLineCurve(e,n);if(n===0)return s.copyCoordinates(e);var i=this.getSegGen(n);return this.computeRingBufferCurve(e,t,i),i.getCoordinates()}},{key:"computeOffsetCurve",value:function(e,t,n){var i=this.simplifyTolerance(this._distance);if(t){var u=nt.simplify(e,-i),f=u.length-1;n.initSideSegments(u[f],u[f-1],B.LEFT),n.addFirstSegment();for(var g=f-2;g>=0;g--)n.addNextSegment(u[g],!0)}else{var y=nt.simplify(e,i),d=y.length-1;n.initSideSegments(y[0],y[1],B.LEFT),n.addFirstSegment();for(var N=2;N<=d;N++)n.addNextSegment(y[N],!0)}n.addLastSegment()}},{key:"isLineOffsetEmpty",value:function(e){return e===0||e<0&&!this._bufParams.isSingleSided()}},{key:"getSegGen",value:function(e){return new Kn(this._precisionModel,this._bufParams,e)}}],[{key:"constructor_",value:function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var e=arguments[0],t=arguments[1];this._precisionModel=e,this._bufParams=t}},{key:"copyCoordinates",value:function(e){for(var t=new Array(e.length).fill(null),n=0;n<t.length;n++)t[n]=new O(e[n]);return t}}]),s}(),pc=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"findStabbedSegments",value:function(){if(arguments.length===1){for(var e=arguments[0],t=new Z,n=this._subgraphs.iterator();n.hasNext();){var i=n.next(),u=i.getEnvelope();e.y<u.getMinY()||e.y>u.getMaxY()||this.findStabbedSegments(e,i.getDirectedEdges(),t)}return t}if(arguments.length===3){if(re(arguments[2],Yt)&&arguments[0]instanceof O&&arguments[1]instanceof Hs)for(var f=arguments[0],g=arguments[1],y=arguments[2],d=g.getEdge().getCoordinates(),N=0;N<d.length-1;N++){this._seg.p0=d[N],this._seg.p1=d[N+1],this._seg.p0.y>this._seg.p1.y&&this._seg.reverse();var b=Math.max(this._seg.p0.x,this._seg.p1.x);if(!(b<f.x)&&!(this._seg.isHorizontal()||f.y<this._seg.p0.y||f.y>this._seg.p1.y||Q.index(this._seg.p0,this._seg.p1,f)===Q.RIGHT)){var L=g.getDepth(B.LEFT);this._seg.p0.equals(d[N])||(L=g.getDepth(B.RIGHT));var $=new mc(this._seg,L);y.add($)}}else if(re(arguments[2],Yt)&&arguments[0]instanceof O&&re(arguments[1],Yt))for(var F=arguments[0],V=arguments[1],H=arguments[2],K=V.iterator();K.hasNext();){var ge=K.next();ge.isForward()&&this.findStabbedSegments(F,ge,H)}}}},{key:"getDepth",value:function(e){var t=this.findStabbedSegments(e);return t.size()===0?0:kn.min(t)._leftDepth}}],[{key:"constructor_",value:function(){this._subgraphs=null,this._seg=new $e;var e=arguments[0];this._subgraphs=e}}]),s}(),mc=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"compareTo",value:function(e){var t=e;if(this._upwardSeg.minX()>=t._upwardSeg.maxX())return 1;if(this._upwardSeg.maxX()<=t._upwardSeg.minX())return-1;var n=this._upwardSeg.orientationIndex(t._upwardSeg);return n!==0||(n=-1*t._upwardSeg.orientationIndex(this._upwardSeg))!==0?n:this._upwardSeg.compareTo(t._upwardSeg)}},{key:"compareX",value:function(e,t){var n=e.p0.compareTo(t.p0);return n!==0?n:e.p1.compareTo(t.p1)}},{key:"toString",value:function(){return this._upwardSeg.toString()}},{key:"interfaces_",get:function(){return[Y]}}],[{key:"constructor_",value:function(){this._upwardSeg=null,this._leftDepth=null;var e=arguments[0],t=arguments[1];this._upwardSeg=new $e(e),this._leftDepth=t}}]),s}();pc.DepthSegment=mc;var dc=function(s){h(t,s);var e=k(t);function t(){var n;return a(this,t),n=e.call(this),t.constructor_.apply(m(n),arguments),n}return c(t,null,[{key:"constructor_",value:function(){D.constructor_.call(this,"Projective point not representable on the Cartesian plane.")}}]),t}(D),Qs=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"getY",value:function(){var e=this.y/this.w;if(j.isNaN(e)||j.isInfinite(e))throw new dc;return e}},{key:"getX",value:function(){var e=this.x/this.w;if(j.isNaN(e)||j.isInfinite(e))throw new dc;return e}},{key:"getCoordinate",value:function(){var e=new O;return e.x=this.getX(),e.y=this.getY(),e}}],[{key:"constructor_",value:function(){if(this.x=null,this.y=null,this.w=null,arguments.length===0)this.x=0,this.y=0,this.w=1;else if(arguments.length===1){var e=arguments[0];this.x=e.x,this.y=e.y,this.w=1}else if(arguments.length===2){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var t=arguments[0],n=arguments[1];this.x=t,this.y=n,this.w=1}else if(arguments[0]instanceof s&&arguments[1]instanceof s){var i=arguments[0],u=arguments[1];this.x=i.y*u.w-u.y*i.w,this.y=u.x*i.w-i.x*u.w,this.w=i.x*u.y-u.x*i.y}else if(arguments[0]instanceof O&&arguments[1]instanceof O){var f=arguments[0],g=arguments[1];this.x=f.y-g.y,this.y=g.x-f.x,this.w=f.x*g.y-g.x*f.y}}else if(arguments.length===3){var y=arguments[0],d=arguments[1],N=arguments[2];this.x=y,this.y=d,this.w=N}else if(arguments.length===4){var b=arguments[0],L=arguments[1],$=arguments[2],F=arguments[3],V=b.y-L.y,H=L.x-b.x,K=b.x*L.y-L.x*b.y,ge=$.y-F.y,xe=F.x-$.x,Re=$.x*F.y-F.x*$.y;this.x=H*Re-xe*K,this.y=ge*K-V*Re,this.w=V*xe-ge*H}}}]),s}(),fd=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"area",value:function(){return s.area(this.p0,this.p1,this.p2)}},{key:"signedArea",value:function(){return s.signedArea(this.p0,this.p1,this.p2)}},{key:"interpolateZ",value:function(e){if(e===null)throw new M("Supplied point is null.");return s.interpolateZ(e,this.p0,this.p1,this.p2)}},{key:"longestSideLength",value:function(){return s.longestSideLength(this.p0,this.p1,this.p2)}},{key:"isAcute",value:function(){return s.isAcute(this.p0,this.p1,this.p2)}},{key:"circumcentre",value:function(){return s.circumcentre(this.p0,this.p1,this.p2)}},{key:"area3D",value:function(){return s.area3D(this.p0,this.p1,this.p2)}},{key:"centroid",value:function(){return s.centroid(this.p0,this.p1,this.p2)}},{key:"inCentre",value:function(){return s.inCentre(this.p0,this.p1,this.p2)}}],[{key:"constructor_",value:function(){this.p0=null,this.p1=null,this.p2=null;var e=arguments[0],t=arguments[1],n=arguments[2];this.p0=e,this.p1=t,this.p2=n}},{key:"area",value:function(e,t,n){return Math.abs(((n.x-e.x)*(t.y-e.y)-(t.x-e.x)*(n.y-e.y))/2)}},{key:"signedArea",value:function(e,t,n){return((n.x-e.x)*(t.y-e.y)-(t.x-e.x)*(n.y-e.y))/2}},{key:"det",value:function(e,t,n,i){return e*i-t*n}},{key:"interpolateZ",value:function(e,t,n,i){var u=t.x,f=t.y,g=n.x-u,y=i.x-u,d=n.y-f,N=i.y-f,b=g*N-y*d,L=e.x-u,$=e.y-f,F=(N*L-y*$)/b,V=(-d*L+g*$)/b;return t.getZ()+F*(n.getZ()-t.getZ())+V*(i.getZ()-t.getZ())}},{key:"longestSideLength",value:function(e,t,n){var i=e.distance(t),u=t.distance(n),f=n.distance(e),g=i;return u>g&&(g=u),f>g&&(g=f),g}},{key:"circumcentreDD",value:function(e,t,n){var i=J.valueOf(e.x).subtract(n.x),u=J.valueOf(e.y).subtract(n.y),f=J.valueOf(t.x).subtract(n.x),g=J.valueOf(t.y).subtract(n.y),y=J.determinant(i,u,f,g).multiply(2),d=i.sqr().add(u.sqr()),N=f.sqr().add(g.sqr()),b=J.determinant(u,d,g,N),L=J.determinant(i,d,f,N),$=J.valueOf(n.x).subtract(b.divide(y)).doubleValue(),F=J.valueOf(n.y).add(L.divide(y)).doubleValue();return new O($,F)}},{key:"isAcute",value:function(e,t,n){return!!Be.isAcute(e,t,n)&&!!Be.isAcute(t,n,e)&&!!Be.isAcute(n,e,t)}},{key:"circumcentre",value:function(e,t,n){var i=n.x,u=n.y,f=e.x-i,g=e.y-u,y=t.x-i,d=t.y-u,N=2*s.det(f,g,y,d),b=s.det(g,f*f+g*g,d,y*y+d*d),L=s.det(f,f*f+g*g,y,y*y+d*d);return new O(i-b/N,u+L/N)}},{key:"perpendicularBisector",value:function(e,t){var n=t.x-e.x,i=t.y-e.y,u=new Qs(e.x+n/2,e.y+i/2,1),f=new Qs(e.x-i+n/2,e.y+n+i/2,1);return new Qs(u,f)}},{key:"angleBisector",value:function(e,t,n){var i=t.distance(e),u=i/(i+t.distance(n)),f=n.x-e.x,g=n.y-e.y;return new O(e.x+u*f,e.y+u*g)}},{key:"area3D",value:function(e,t,n){var i=t.x-e.x,u=t.y-e.y,f=t.getZ()-e.getZ(),g=n.x-e.x,y=n.y-e.y,d=n.getZ()-e.getZ(),N=u*d-f*y,b=f*g-i*d,L=i*y-u*g,$=N*N+b*b+L*L,F=Math.sqrt($)/2;return F}},{key:"centroid",value:function(e,t,n){var i=(e.x+t.x+n.x)/3,u=(e.y+t.y+n.y)/3;return new O(i,u)}},{key:"inCentre",value:function(e,t,n){var i=t.distance(n),u=e.distance(n),f=e.distance(t),g=i+u+f,y=(i*e.x+u*t.x+f*n.x)/g,d=(i*e.y+u*t.y+f*n.y)/g;return new O(y,d)}}]),s}(),hd=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"addRingSide",value:function(e,t,n,i,u){if(t===0&&e.length<Wn.MINIMUM_VALID_SIZE)return null;var f=i,g=u;e.length>=Wn.MINIMUM_VALID_SIZE&&Q.isCCW(e)&&(f=u,g=i,n=B.opposite(n));var y=this._curveBuilder.getRingCurve(e,n,t);this.addCurve(y,f,g)}},{key:"addRingBothSides",value:function(e,t){this.addRingSide(e,t,B.LEFT,S.EXTERIOR,S.INTERIOR),this.addRingSide(e,t,B.RIGHT,S.INTERIOR,S.EXTERIOR)}},{key:"addPoint",value:function(e){if(this._distance<=0)return null;var t=e.getCoordinates(),n=this._curveBuilder.getLineCurve(t,this._distance);this.addCurve(n,S.EXTERIOR,S.INTERIOR)}},{key:"addPolygon",value:function(e){var t=this._distance,n=B.LEFT;this._distance<0&&(t=-this._distance,n=B.RIGHT);var i=e.getExteriorRing(),u=Ee.removeRepeatedPoints(i.getCoordinates());if(this._distance<0&&this.isErodedCompletely(i,this._distance)||this._distance<=0&&u.length<3)return null;this.addRingSide(u,t,n,S.EXTERIOR,S.INTERIOR);for(var f=0;f<e.getNumInteriorRing();f++){var g=e.getInteriorRingN(f),y=Ee.removeRepeatedPoints(g.getCoordinates());this._distance>0&&this.isErodedCompletely(g,-this._distance)||this.addRingSide(y,t,B.opposite(n),S.INTERIOR,S.EXTERIOR)}}},{key:"isTriangleErodedCompletely",value:function(e,t){var n=new fd(e[0],e[1],e[2]),i=n.inCentre();return ft.pointToSegment(i,n.p0,n.p1)<Math.abs(t)}},{key:"addLineString",value:function(e){if(this._curveBuilder.isLineOffsetEmpty(this._distance))return null;var t=Ee.removeRepeatedPoints(e.getCoordinates());if(Ee.isRing(t)&&!this._curveBuilder.getBufferParameters().isSingleSided())this.addRingBothSides(t,this._distance);else{var n=this._curveBuilder.getLineCurve(t,this._distance);this.addCurve(n,S.EXTERIOR,S.INTERIOR)}}},{key:"addCurve",value:function(e,t,n){if(e===null||e.length<2)return null;var i=new Ht(e,new We(0,S.BOUNDARY,t,n));this._curveList.add(i)}},{key:"getCurves",value:function(){return this.add(this._inputGeom),this._curveList}},{key:"add",value:function(e){if(e.isEmpty())return null;if(e instanceof ti)this.addPolygon(e);else if(e instanceof Vn)this.addLineString(e);else if(e instanceof Bs)this.addPoint(e);else if(e instanceof Gs)this.addCollection(e);else if(e instanceof Us)this.addCollection(e);else if(e instanceof Ys)this.addCollection(e);else{if(!(e instanceof Fe))throw new At(e.getGeometryType());this.addCollection(e)}}},{key:"isErodedCompletely",value:function(e,t){var n=e.getCoordinates();if(n.length<4)return t<0;if(n.length===4)return this.isTriangleErodedCompletely(n,t);var i=e.getEnvelopeInternal(),u=Math.min(i.getHeight(),i.getWidth());return t<0&&2*Math.abs(t)>u}},{key:"addCollection",value:function(e){for(var t=0;t<e.getNumGeometries();t++){var n=e.getGeometryN(t);this.add(n)}}}],[{key:"constructor_",value:function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new Z;var e=arguments[0],t=arguments[1],n=arguments[2];this._inputGeom=e,this._distance=t,this._curveBuilder=n}}]),s}(),gd=function(){function s(){a(this,s)}return c(s,[{key:"locate",value:function(e){}}]),s}(),yd=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"next",value:function(){if(this._atStart)return this._atStart=!1,s.isAtomic(this._parent)&&this._index++,this._parent;if(this._subcollectionIterator!==null){if(this._subcollectionIterator.hasNext())return this._subcollectionIterator.next();this._subcollectionIterator=null}if(this._index>=this._max)throw new Zr;var e=this._parent.getGeometryN(this._index++);return e instanceof Fe?(this._subcollectionIterator=new s(e),this._subcollectionIterator.next()):e}},{key:"remove",value:function(){throw new At(this.getClass().getName())}},{key:"hasNext",value:function(){if(this._atStart)return!0;if(this._subcollectionIterator!==null){if(this._subcollectionIterator.hasNext())return!0;this._subcollectionIterator=null}return!(this._index>=this._max)}},{key:"interfaces_",get:function(){return[rd]}}],[{key:"constructor_",value:function(){this._parent=null,this._atStart=null,this._max=null,this._index=null,this._subcollectionIterator=null;var e=arguments[0];this._parent=e,this._atStart=!0,this._index=0,this._max=e.getNumGeometries()}},{key:"isAtomic",value:function(e){return!(e instanceof Fe)}}]),s}(),vd=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"locate",value:function(e){return s.locate(e,this._geom)}},{key:"interfaces_",get:function(){return[gd]}}],[{key:"constructor_",value:function(){this._geom=null;var e=arguments[0];this._geom=e}},{key:"locatePointInPolygon",value:function(e,t){if(t.isEmpty())return S.EXTERIOR;var n=t.getExteriorRing(),i=s.locatePointInRing(e,n);if(i!==S.INTERIOR)return i;for(var u=0;u<t.getNumInteriorRing();u++){var f=t.getInteriorRingN(u),g=s.locatePointInRing(e,f);if(g===S.BOUNDARY)return S.BOUNDARY;if(g===S.INTERIOR)return S.EXTERIOR}return S.INTERIOR}},{key:"locatePointInRing",value:function(e,t){return t.getEnvelopeInternal().intersects(e)?Vs.locateInRing(e,t.getCoordinates()):S.EXTERIOR}},{key:"containsPointInPolygon",value:function(e,t){return S.EXTERIOR!==s.locatePointInPolygon(e,t)}},{key:"locateInGeometry",value:function(e,t){if(t instanceof ti)return s.locatePointInPolygon(e,t);if(t instanceof Fe)for(var n=new yd(t);n.hasNext();){var i=n.next();if(i!==t){var u=s.locateInGeometry(e,i);if(u!==S.EXTERIOR)return u}}return S.EXTERIOR}},{key:"isContained",value:function(e,t){return S.EXTERIOR!==s.locate(e,t)}},{key:"locate",value:function(e,t){return t.isEmpty()?S.EXTERIOR:t.getEnvelopeInternal().intersects(e)?s.locateInGeometry(e,t):S.EXTERIOR}}]),s}(),pd=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"getNextCW",value:function(e){this.getEdges();var t=this._edgeList.indexOf(e),n=t-1;return t===0&&(n=this._edgeList.size()-1),this._edgeList.get(n)}},{key:"propagateSideLabels",value:function(e){for(var t=S.NONE,n=this.iterator();n.hasNext();){var i=n.next().getLabel();i.isArea(e)&&i.getLocation(e,B.LEFT)!==S.NONE&&(t=i.getLocation(e,B.LEFT))}if(t===S.NONE)return null;for(var u=t,f=this.iterator();f.hasNext();){var g=f.next(),y=g.getLabel();if(y.getLocation(e,B.ON)===S.NONE&&y.setLocation(e,B.ON,u),y.isArea(e)){var d=y.getLocation(e,B.LEFT),N=y.getLocation(e,B.RIGHT);if(N!==S.NONE){if(N!==u)throw new _t("side location conflict",g.getCoordinate());d===S.NONE&&se.shouldNeverReachHere("found single null side (at "+g.getCoordinate()+")"),u=d}else se.isTrue(y.getLocation(e,B.LEFT)===S.NONE,"found single null side"),y.setLocation(e,B.RIGHT,u),y.setLocation(e,B.LEFT,u)}}}},{key:"getCoordinate",value:function(){var e=this.iterator();return e.hasNext()?e.next().getCoordinate():null}},{key:"print",value:function(e){je.out.println("EdgeEndStar: "+this.getCoordinate());for(var t=this.iterator();t.hasNext();)t.next().print(e)}},{key:"isAreaLabelsConsistent",value:function(e){return this.computeEdgeEndLabels(e.getBoundaryNodeRule()),this.checkAreaLabelsConsistent(0)}},{key:"checkAreaLabelsConsistent",value:function(e){var t=this.getEdges();if(t.size()<=0)return!0;var n=t.size()-1,i=t.get(n).getLabel().getLocation(e,B.LEFT);se.isTrue(i!==S.NONE,"Found unlabelled area edge");for(var u=i,f=this.iterator();f.hasNext();){var g=f.next().getLabel();se.isTrue(g.isArea(e),"Found non-area edge");var y=g.getLocation(e,B.LEFT),d=g.getLocation(e,B.RIGHT);if(y===d||d!==u)return!1;u=y}return!0}},{key:"findIndex",value:function(e){this.iterator();for(var t=0;t<this._edgeList.size();t++)if(this._edgeList.get(t)===e)return t;return-1}},{key:"iterator",value:function(){return this.getEdges().iterator()}},{key:"getEdges",value:function(){return this._edgeList===null&&(this._edgeList=new Z(this._edgeMap.values())),this._edgeList}},{key:"getLocation",value:function(e,t,n){return this._ptInAreaLocation[e]===S.NONE&&(this._ptInAreaLocation[e]=vd.locate(t,n[e].getGeometry())),this._ptInAreaLocation[e]}},{key:"toString",value:function(){var e=new Xn;e.append("EdgeEndStar: "+this.getCoordinate()),e.append(`
30
- `);for(var t=this.iterator();t.hasNext();){var n=t.next();e.append(n),e.append(`
31
- `)}return e.toString()}},{key:"computeEdgeEndLabels",value:function(e){for(var t=this.iterator();t.hasNext();)t.next().computeLabel(e)}},{key:"computeLabelling",value:function(e){this.computeEdgeEndLabels(e[0].getBoundaryNodeRule()),this.propagateSideLabels(0),this.propagateSideLabels(1);for(var t=[!1,!1],n=this.iterator();n.hasNext();)for(var i=n.next().getLabel(),u=0;u<2;u++)i.isLine(u)&&i.getLocation(u)===S.BOUNDARY&&(t[u]=!0);for(var f=this.iterator();f.hasNext();)for(var g=f.next(),y=g.getLabel(),d=0;d<2;d++)if(y.isAnyNull(d)){var N=S.NONE;if(t[d])N=S.EXTERIOR;else{var b=g.getCoordinate();N=this.getLocation(d,b,e)}y.setAllLocationsIfNull(d,N)}}},{key:"getDegree",value:function(){return this._edgeMap.size()}},{key:"insertEdgeEnd",value:function(e,t){this._edgeMap.put(e,t),this._edgeList=null}}],[{key:"constructor_",value:function(){this._edgeMap=new Qn,this._edgeList=null,this._ptInAreaLocation=[S.NONE,S.NONE]}}]),s}(),md=function(s){h(t,s);var e=k(t);function t(){var n;return a(this,t),n=e.call(this),t.constructor_.apply(m(n),arguments),n}return c(t,[{key:"linkResultDirectedEdges",value:function(){this.getResultAreaEdges();for(var n=null,i=null,u=this._SCANNING_FOR_INCOMING,f=0;f<this._resultAreaEdgeList.size();f++){var g=this._resultAreaEdgeList.get(f),y=g.getSym();if(g.getLabel().isArea())switch(n===null&&g.isInResult()&&(n=g),u){case this._SCANNING_FOR_INCOMING:if(!y.isInResult())continue;i=y,u=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(!g.isInResult())continue;i.setNext(g),u=this._SCANNING_FOR_INCOMING}}if(u===this._LINKING_TO_OUTGOING){if(n===null)throw new _t("no outgoing dirEdge found",this.getCoordinate());se.isTrue(n.isInResult(),"unable to link last incoming dirEdge"),i.setNext(n)}}},{key:"insert",value:function(n){var i=n;this.insertEdgeEnd(i,i)}},{key:"getRightmostEdge",value:function(){var n=this.getEdges(),i=n.size();if(i<1)return null;var u=n.get(0);if(i===1)return u;var f=n.get(i-1),g=u.getQuadrant(),y=f.getQuadrant();return Ae.isNorthern(g)&&Ae.isNorthern(y)?u:Ae.isNorthern(g)||Ae.isNorthern(y)?u.getDy()!==0?u:f.getDy()!==0?f:(se.shouldNeverReachHere("found two horizontal edges incident on node"),null):f}},{key:"print",value:function(n){je.out.println("DirectedEdgeStar: "+this.getCoordinate());for(var i=this.iterator();i.hasNext();){var u=i.next();n.print("out "),u.print(n),n.println(),n.print("in "),u.getSym().print(n),n.println()}}},{key:"getResultAreaEdges",value:function(){if(this._resultAreaEdgeList!==null)return this._resultAreaEdgeList;this._resultAreaEdgeList=new Z;for(var n=this.iterator();n.hasNext();){var i=n.next();(i.isInResult()||i.getSym().isInResult())&&this._resultAreaEdgeList.add(i)}return this._resultAreaEdgeList}},{key:"updateLabelling",value:function(n){for(var i=this.iterator();i.hasNext();){var u=i.next().getLabel();u.setAllLocationsIfNull(0,n.getLocation(0)),u.setAllLocationsIfNull(1,n.getLocation(1))}}},{key:"linkAllDirectedEdges",value:function(){this.getEdges();for(var n=null,i=null,u=this._edgeList.size()-1;u>=0;u--){var f=this._edgeList.get(u),g=f.getSym();i===null&&(i=g),n!==null&&g.setNext(n),n=f}i.setNext(n)}},{key:"computeDepths",value:function(){if(arguments.length===1){var n=arguments[0],i=this.findIndex(n),u=n.getDepth(B.LEFT),f=n.getDepth(B.RIGHT),g=this.computeDepths(i+1,this._edgeList.size(),u),y=this.computeDepths(0,i,g);if(y!==f)throw new _t("depth mismatch at "+n.getCoordinate())}else if(arguments.length===3){for(var d=arguments[0],N=arguments[1],b=arguments[2],L=b,$=d;$<N;$++){var F=this._edgeList.get($);F.setEdgeDepths(B.RIGHT,L),L=F.getDepth(B.LEFT)}return L}}},{key:"mergeSymLabels",value:function(){for(var n=this.iterator();n.hasNext();){var i=n.next();i.getLabel().merge(i.getSym().getLabel())}}},{key:"linkMinimalDirectedEdges",value:function(n){for(var i=null,u=null,f=this._SCANNING_FOR_INCOMING,g=this._resultAreaEdgeList.size()-1;g>=0;g--){var y=this._resultAreaEdgeList.get(g),d=y.getSym();switch(i===null&&y.getEdgeRing()===n&&(i=y),f){case this._SCANNING_FOR_INCOMING:if(d.getEdgeRing()!==n)continue;u=d,f=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(y.getEdgeRing()!==n)continue;u.setNextMin(y),f=this._SCANNING_FOR_INCOMING}}f===this._LINKING_TO_OUTGOING&&(se.isTrue(i!==null,"found null for first outgoing dirEdge"),se.isTrue(i.getEdgeRing()===n,"unable to link last incoming dirEdge"),u.setNextMin(i))}},{key:"getOutgoingDegree",value:function(){if(arguments.length===0){for(var n=0,i=this.iterator();i.hasNext();){var u=i.next();u.isInResult()&&n++}return n}if(arguments.length===1){for(var f=arguments[0],g=0,y=this.iterator();y.hasNext();){var d=y.next();d.getEdgeRing()===f&&g++}return g}}},{key:"getLabel",value:function(){return this._label}},{key:"findCoveredLineEdges",value:function(){for(var n=S.NONE,i=this.iterator();i.hasNext();){var u=i.next(),f=u.getSym();if(!u.isLineEdge()){if(u.isInResult()){n=S.INTERIOR;break}if(f.isInResult()){n=S.EXTERIOR;break}}}if(n===S.NONE)return null;for(var g=n,y=this.iterator();y.hasNext();){var d=y.next(),N=d.getSym();d.isLineEdge()?d.getEdge().setCovered(g===S.INTERIOR):(d.isInResult()&&(g=S.EXTERIOR),N.isInResult()&&(g=S.INTERIOR))}}},{key:"computeLabelling",value:function(n){w(v(t.prototype),"computeLabelling",this).call(this,n),this._label=new We(S.NONE);for(var i=this.iterator();i.hasNext();)for(var u=i.next().getEdge().getLabel(),f=0;f<2;f++){var g=u.getLocation(f);g!==S.INTERIOR&&g!==S.BOUNDARY||this._label.setLocation(f,S.INTERIOR)}}}],[{key:"constructor_",value:function(){this._resultAreaEdgeList=null,this._label=null,this._SCANNING_FOR_INCOMING=1,this._LINKING_TO_OUTGOING=2}}]),t}(pd),dd=function(s){h(t,s);var e=k(t);function t(){return a(this,t),e.call(this)}return c(t,[{key:"createNode",value:function(n){return new ai(n,new md)}}]),t}(oc),_c=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"compareTo",value:function(e){var t=e;return s.compareOriented(this._pts,this._orientation,t._pts,t._orientation)}},{key:"interfaces_",get:function(){return[Y]}}],[{key:"constructor_",value:function(){this._pts=null,this._orientation=null;var e=arguments[0];this._pts=e,this._orientation=s.orientation(e)}},{key:"orientation",value:function(e){return Ee.increasingDirection(e)===1}},{key:"compareOriented",value:function(e,t,n,i){for(var u=t?1:-1,f=i?1:-1,g=t?e.length:-1,y=i?n.length:-1,d=t?0:e.length-1,N=i?0:n.length-1;;){var b=e[d].compareTo(n[N]);if(b!==0)return b;var L=(d+=u)===g,$=(N+=f)===y;if(L&&!$)return-1;if(!L&&$)return 1;if(L&&$)return 0}}}]),s}(),_d=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"print",value:function(e){e.print("MULTILINESTRING ( ");for(var t=0;t<this._edges.size();t++){var n=this._edges.get(t);t>0&&e.print(","),e.print("(");for(var i=n.getCoordinates(),u=0;u<i.length;u++)u>0&&e.print(","),e.print(i[u].x+" "+i[u].y);e.println(")")}e.print(") ")}},{key:"addAll",value:function(e){for(var t=e.iterator();t.hasNext();)this.add(t.next())}},{key:"findEdgeIndex",value:function(e){for(var t=0;t<this._edges.size();t++)if(this._edges.get(t).equals(e))return t;return-1}},{key:"iterator",value:function(){return this._edges.iterator()}},{key:"getEdges",value:function(){return this._edges}},{key:"get",value:function(e){return this._edges.get(e)}},{key:"findEqualEdge",value:function(e){var t=new _c(e.getCoordinates());return this._ocaMap.get(t)}},{key:"add",value:function(e){this._edges.add(e);var t=new _c(e.getCoordinates());this._ocaMap.put(t,e)}}],[{key:"constructor_",value:function(){this._edges=new Z,this._ocaMap=new Qn}}]),s}(),xc=function(){function s(){a(this,s)}return c(s,[{key:"processIntersections",value:function(e,t,n,i){}},{key:"isDone",value:function(){}}]),s}(),xd=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"isTrivialIntersection",value:function(e,t,n,i){if(e===n&&this._li.getIntersectionNum()===1){if(s.isAdjacentSegments(t,i))return!0;if(e.isClosed()){var u=e.size()-1;if(t===0&&i===u||i===0&&t===u)return!0}}return!1}},{key:"getProperIntersectionPoint",value:function(){return this._properIntersectionPoint}},{key:"hasProperInteriorIntersection",value:function(){return this._hasProperInterior}},{key:"getLineIntersector",value:function(){return this._li}},{key:"hasProperIntersection",value:function(){return this._hasProper}},{key:"processIntersections",value:function(e,t,n,i){if(e===n&&t===i)return null;this.numTests++;var u=e.getCoordinates()[t],f=e.getCoordinates()[t+1],g=n.getCoordinates()[i],y=n.getCoordinates()[i+1];this._li.computeIntersection(u,f,g,y),this._li.hasIntersection()&&(this.numIntersections++,this._li.isInteriorIntersection()&&(this.numInteriorIntersections++,this._hasInterior=!0),this.isTrivialIntersection(e,t,n,i)||(this._hasIntersection=!0,e.addIntersections(this._li,t,0),n.addIntersections(this._li,i,1),this._li.isProper()&&(this.numProperIntersections++,this._hasProper=!0,this._hasProperInterior=!0)))}},{key:"hasIntersection",value:function(){return this._hasIntersection}},{key:"isDone",value:function(){return!1}},{key:"hasInteriorIntersection",value:function(){return this._hasInterior}},{key:"interfaces_",get:function(){return[xc]}}],[{key:"constructor_",value:function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._hasInterior=!1,this._properIntersectionPoint=null,this._li=null,this._isSelfIntersection=null,this.numIntersections=0,this.numInteriorIntersections=0,this.numProperIntersections=0,this.numTests=0;var e=arguments[0];this._li=e}},{key:"isAdjacentSegments",value:function(e,t){return Math.abs(e-t)===1}}]),s}(),Ed=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"getSegmentIndex",value:function(){return this.segmentIndex}},{key:"getCoordinate",value:function(){return this.coord}},{key:"print",value:function(e){e.print(this.coord),e.print(" seg # = "+this.segmentIndex),e.println(" dist = "+this.dist)}},{key:"compareTo",value:function(e){var t=e;return this.compare(t.segmentIndex,t.dist)}},{key:"isEndPoint",value:function(e){return this.segmentIndex===0&&this.dist===0||this.segmentIndex===e}},{key:"toString",value:function(){return this.coord+" seg # = "+this.segmentIndex+" dist = "+this.dist}},{key:"getDistance",value:function(){return this.dist}},{key:"compare",value:function(e,t){return this.segmentIndex<e?-1:this.segmentIndex>e?1:this.dist<t?-1:this.dist>t?1:0}},{key:"interfaces_",get:function(){return[Y]}}],[{key:"constructor_",value:function(){this.coord=null,this.segmentIndex=null,this.dist=null;var e=arguments[0],t=arguments[1],n=arguments[2];this.coord=new O(e),this.segmentIndex=t,this.dist=n}}]),s}(),kd=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"print",value:function(e){e.println("Intersections:");for(var t=this.iterator();t.hasNext();)t.next().print(e)}},{key:"iterator",value:function(){return this._nodeMap.values().iterator()}},{key:"addSplitEdges",value:function(e){this.addEndpoints();for(var t=this.iterator(),n=t.next();t.hasNext();){var i=t.next(),u=this.createSplitEdge(n,i);e.add(u),n=i}}},{key:"addEndpoints",value:function(){var e=this.edge.pts.length-1;this.add(this.edge.pts[0],0,0),this.add(this.edge.pts[e],e,0)}},{key:"createSplitEdge",value:function(e,t){var n=t.segmentIndex-e.segmentIndex+2,i=this.edge.pts[t.segmentIndex],u=t.dist>0||!t.coord.equals2D(i);u||n--;var f=new Array(n).fill(null),g=0;f[g++]=new O(e.coord);for(var y=e.segmentIndex+1;y<=t.segmentIndex;y++)f[g++]=this.edge.pts[y];return u&&(f[g]=t.coord),new kc(f,new We(this.edge._label))}},{key:"add",value:function(e,t,n){var i=new Ed(e,t,n),u=this._nodeMap.get(i);return u!==null?u:(this._nodeMap.put(i,i),i)}},{key:"isIntersection",value:function(e){for(var t=this.iterator();t.hasNext();)if(t.next().coord.equals(e))return!0;return!1}}],[{key:"constructor_",value:function(){this._nodeMap=new Qn,this.edge=null;var e=arguments[0];this.edge=e}}]),s}(),Id=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"isIntersects",value:function(){return!this.isDisjoint()}},{key:"isCovers",value:function(){return(s.isTrue(this._matrix[S.INTERIOR][S.INTERIOR])||s.isTrue(this._matrix[S.INTERIOR][S.BOUNDARY])||s.isTrue(this._matrix[S.BOUNDARY][S.INTERIOR])||s.isTrue(this._matrix[S.BOUNDARY][S.BOUNDARY]))&&this._matrix[S.EXTERIOR][S.INTERIOR]===z.FALSE&&this._matrix[S.EXTERIOR][S.BOUNDARY]===z.FALSE}},{key:"isCoveredBy",value:function(){return(s.isTrue(this._matrix[S.INTERIOR][S.INTERIOR])||s.isTrue(this._matrix[S.INTERIOR][S.BOUNDARY])||s.isTrue(this._matrix[S.BOUNDARY][S.INTERIOR])||s.isTrue(this._matrix[S.BOUNDARY][S.BOUNDARY]))&&this._matrix[S.INTERIOR][S.EXTERIOR]===z.FALSE&&this._matrix[S.BOUNDARY][S.EXTERIOR]===z.FALSE}},{key:"set",value:function(){if(arguments.length===1)for(var e=arguments[0],t=0;t<e.length;t++){var n=Math.trunc(t/3),i=t%3;this._matrix[n][i]=z.toDimensionValue(e.charAt(t))}else if(arguments.length===3){var u=arguments[0],f=arguments[1],g=arguments[2];this._matrix[u][f]=g}}},{key:"isContains",value:function(){return s.isTrue(this._matrix[S.INTERIOR][S.INTERIOR])&&this._matrix[S.EXTERIOR][S.INTERIOR]===z.FALSE&&this._matrix[S.EXTERIOR][S.BOUNDARY]===z.FALSE}},{key:"setAtLeast",value:function(){if(arguments.length===1)for(var e=arguments[0],t=0;t<e.length;t++){var n=Math.trunc(t/3),i=t%3;this.setAtLeast(n,i,z.toDimensionValue(e.charAt(t)))}else if(arguments.length===3){var u=arguments[0],f=arguments[1],g=arguments[2];this._matrix[u][f]<g&&(this._matrix[u][f]=g)}}},{key:"setAtLeastIfValid",value:function(e,t,n){e>=0&&t>=0&&this.setAtLeast(e,t,n)}},{key:"isWithin",value:function(){return s.isTrue(this._matrix[S.INTERIOR][S.INTERIOR])&&this._matrix[S.INTERIOR][S.EXTERIOR]===z.FALSE&&this._matrix[S.BOUNDARY][S.EXTERIOR]===z.FALSE}},{key:"isTouches",value:function(e,t){return e>t?this.isTouches(t,e):(e===z.A&&t===z.A||e===z.L&&t===z.L||e===z.L&&t===z.A||e===z.P&&t===z.A||e===z.P&&t===z.L)&&this._matrix[S.INTERIOR][S.INTERIOR]===z.FALSE&&(s.isTrue(this._matrix[S.INTERIOR][S.BOUNDARY])||s.isTrue(this._matrix[S.BOUNDARY][S.INTERIOR])||s.isTrue(this._matrix[S.BOUNDARY][S.BOUNDARY]))}},{key:"isOverlaps",value:function(e,t){return e===z.P&&t===z.P||e===z.A&&t===z.A?s.isTrue(this._matrix[S.INTERIOR][S.INTERIOR])&&s.isTrue(this._matrix[S.INTERIOR][S.EXTERIOR])&&s.isTrue(this._matrix[S.EXTERIOR][S.INTERIOR]):e===z.L&&t===z.L&&this._matrix[S.INTERIOR][S.INTERIOR]===1&&s.isTrue(this._matrix[S.INTERIOR][S.EXTERIOR])&&s.isTrue(this._matrix[S.EXTERIOR][S.INTERIOR])}},{key:"isEquals",value:function(e,t){return e===t&&s.isTrue(this._matrix[S.INTERIOR][S.INTERIOR])&&this._matrix[S.INTERIOR][S.EXTERIOR]===z.FALSE&&this._matrix[S.BOUNDARY][S.EXTERIOR]===z.FALSE&&this._matrix[S.EXTERIOR][S.INTERIOR]===z.FALSE&&this._matrix[S.EXTERIOR][S.BOUNDARY]===z.FALSE}},{key:"toString",value:function(){for(var e=new ri("123456789"),t=0;t<3;t++)for(var n=0;n<3;n++)e.setCharAt(3*t+n,z.toDimensionSymbol(this._matrix[t][n]));return e.toString()}},{key:"setAll",value:function(e){for(var t=0;t<3;t++)for(var n=0;n<3;n++)this._matrix[t][n]=e}},{key:"get",value:function(e,t){return this._matrix[e][t]}},{key:"transpose",value:function(){var e=this._matrix[1][0];return this._matrix[1][0]=this._matrix[0][1],this._matrix[0][1]=e,e=this._matrix[2][0],this._matrix[2][0]=this._matrix[0][2],this._matrix[0][2]=e,e=this._matrix[2][1],this._matrix[2][1]=this._matrix[1][2],this._matrix[1][2]=e,this}},{key:"matches",value:function(e){if(e.length!==9)throw new M("Should be length 9: "+e);for(var t=0;t<3;t++)for(var n=0;n<3;n++)if(!s.matches(this._matrix[t][n],e.charAt(3*t+n)))return!1;return!0}},{key:"add",value:function(e){for(var t=0;t<3;t++)for(var n=0;n<3;n++)this.setAtLeast(t,n,e.get(t,n))}},{key:"isDisjoint",value:function(){return this._matrix[S.INTERIOR][S.INTERIOR]===z.FALSE&&this._matrix[S.INTERIOR][S.BOUNDARY]===z.FALSE&&this._matrix[S.BOUNDARY][S.INTERIOR]===z.FALSE&&this._matrix[S.BOUNDARY][S.BOUNDARY]===z.FALSE}},{key:"isCrosses",value:function(e,t){return e===z.P&&t===z.L||e===z.P&&t===z.A||e===z.L&&t===z.A?s.isTrue(this._matrix[S.INTERIOR][S.INTERIOR])&&s.isTrue(this._matrix[S.INTERIOR][S.EXTERIOR]):e===z.L&&t===z.P||e===z.A&&t===z.P||e===z.A&&t===z.L?s.isTrue(this._matrix[S.INTERIOR][S.INTERIOR])&&s.isTrue(this._matrix[S.EXTERIOR][S.INTERIOR]):e===z.L&&t===z.L&&this._matrix[S.INTERIOR][S.INTERIOR]===0}},{key:"interfaces_",get:function(){return[U]}}],[{key:"constructor_",value:function(){if(this._matrix=null,arguments.length===0)this._matrix=Array(3).fill().map(function(){return Array(3)}),this.setAll(z.FALSE);else if(arguments.length===1){if(typeof arguments[0]=="string"){var e=arguments[0];s.constructor_.call(this),this.set(e)}else if(arguments[0]instanceof s){var t=arguments[0];s.constructor_.call(this),this._matrix[S.INTERIOR][S.INTERIOR]=t._matrix[S.INTERIOR][S.INTERIOR],this._matrix[S.INTERIOR][S.BOUNDARY]=t._matrix[S.INTERIOR][S.BOUNDARY],this._matrix[S.INTERIOR][S.EXTERIOR]=t._matrix[S.INTERIOR][S.EXTERIOR],this._matrix[S.BOUNDARY][S.INTERIOR]=t._matrix[S.BOUNDARY][S.INTERIOR],this._matrix[S.BOUNDARY][S.BOUNDARY]=t._matrix[S.BOUNDARY][S.BOUNDARY],this._matrix[S.BOUNDARY][S.EXTERIOR]=t._matrix[S.BOUNDARY][S.EXTERIOR],this._matrix[S.EXTERIOR][S.INTERIOR]=t._matrix[S.EXTERIOR][S.INTERIOR],this._matrix[S.EXTERIOR][S.BOUNDARY]=t._matrix[S.EXTERIOR][S.BOUNDARY],this._matrix[S.EXTERIOR][S.EXTERIOR]=t._matrix[S.EXTERIOR][S.EXTERIOR]}}}},{key:"matches",value:function(){if(Number.isInteger(arguments[0])&&typeof arguments[1]=="string"){var e=arguments[0],t=arguments[1];return t===z.SYM_DONTCARE||t===z.SYM_TRUE&&(e>=0||e===z.TRUE)||t===z.SYM_FALSE&&e===z.FALSE||t===z.SYM_P&&e===z.P||t===z.SYM_L&&e===z.L||t===z.SYM_A&&e===z.A}if(typeof arguments[0]=="string"&&typeof arguments[1]=="string"){var n=arguments[0],i=arguments[1],u=new s(n);return u.matches(i)}}},{key:"isTrue",value:function(e){return e>=0||e===z.TRUE}}]),s}(),Sd=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"size",value:function(){return this._size}},{key:"addAll",value:function(e){return e===null||e.length===0?null:(this.ensureCapacity(this._size+e.length),je.arraycopy(e,0,this._data,this._size,e.length),void(this._size+=e.length))}},{key:"ensureCapacity",value:function(e){if(e<=this._data.length)return null;var t=Math.max(e,2*this._data.length);this._data=Xt.copyOf(this._data,t)}},{key:"toArray",value:function(){var e=new Array(this._size).fill(null);return je.arraycopy(this._data,0,e,0,this._size),e}},{key:"add",value:function(e){this.ensureCapacity(this._size+1),this._data[this._size]=e,++this._size}}],[{key:"constructor_",value:function(){if(this._data=null,this._size=0,arguments.length===0)s.constructor_.call(this,10);else if(arguments.length===1){var e=arguments[0];this._data=new Array(e).fill(null)}}}]),s}(),Nd=function(){function s(){a(this,s)}return c(s,[{key:"getChainStartIndices",value:function(e){var t=0,n=new Sd(Math.trunc(e.length/2));n.add(t);do{var i=this.findChainEnd(e,t);n.add(i),t=i}while(t<e.length-1);return n.toArray()}},{key:"findChainEnd",value:function(e,t){for(var n=Ae.quadrant(e[t],e[t+1]),i=t+1;i<e.length&&Ae.quadrant(e[i-1],e[i])===n;)i++;return i-1}},{key:"OLDgetChainStartIndices",value:function(e){var t=0,n=new Z;n.add(t);do{var i=this.findChainEnd(e,t);n.add(i),t=i}while(t<e.length-1);return s.toIntArray(n)}}],[{key:"toIntArray",value:function(e){for(var t=new Array(e.size()).fill(null),n=0;n<t.length;n++)t[n]=e.get(n).intValue();return t}}]),s}(),wd=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"getCoordinates",value:function(){return this.pts}},{key:"getMaxX",value:function(e){var t=this.pts[this.startIndex[e]].x,n=this.pts[this.startIndex[e+1]].x;return t>n?t:n}},{key:"getMinX",value:function(e){var t=this.pts[this.startIndex[e]].x,n=this.pts[this.startIndex[e+1]].x;return t<n?t:n}},{key:"computeIntersectsForChain",value:function(){if(arguments.length===4){var e=arguments[0],t=arguments[1],n=arguments[2],i=arguments[3];this.computeIntersectsForChain(this.startIndex[e],this.startIndex[e+1],t,t.startIndex[n],t.startIndex[n+1],i)}else if(arguments.length===6){var u=arguments[0],f=arguments[1],g=arguments[2],y=arguments[3],d=arguments[4],N=arguments[5];if(f-u==1&&d-y==1)return N.addIntersections(this.e,u,g.e,y),null;if(!this.overlaps(u,f,g,y,d))return null;var b=Math.trunc((u+f)/2),L=Math.trunc((y+d)/2);u<b&&(y<L&&this.computeIntersectsForChain(u,b,g,y,L,N),L<d&&this.computeIntersectsForChain(u,b,g,L,d,N)),b<f&&(y<L&&this.computeIntersectsForChain(b,f,g,y,L,N),L<d&&this.computeIntersectsForChain(b,f,g,L,d,N))}}},{key:"overlaps",value:function(e,t,n,i,u){return pe.intersects(this.pts[e],this.pts[t],n.pts[i],n.pts[u])}},{key:"getStartIndexes",value:function(){return this.startIndex}},{key:"computeIntersects",value:function(e,t){for(var n=0;n<this.startIndex.length-1;n++)for(var i=0;i<e.startIndex.length-1;i++)this.computeIntersectsForChain(n,e,i,t)}}],[{key:"constructor_",value:function(){this.e=null,this.pts=null,this.startIndex=null;var e=arguments[0];this.e=e,this.pts=e.getCoordinates();var t=new Nd;this.startIndex=t.getChainStartIndices(this.pts)}}]),s}(),Ec=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"getDepth",value:function(e,t){return this._depth[e][t]}},{key:"setDepth",value:function(e,t,n){this._depth[e][t]=n}},{key:"isNull",value:function(){if(arguments.length===0){for(var e=0;e<2;e++)for(var t=0;t<3;t++)if(this._depth[e][t]!==s.NULL_VALUE)return!1;return!0}if(arguments.length===1){var n=arguments[0];return this._depth[n][1]===s.NULL_VALUE}if(arguments.length===2){var i=arguments[0],u=arguments[1];return this._depth[i][u]===s.NULL_VALUE}}},{key:"normalize",value:function(){for(var e=0;e<2;e++)if(!this.isNull(e)){var t=this._depth[e][1];this._depth[e][2]<t&&(t=this._depth[e][2]),t<0&&(t=0);for(var n=1;n<3;n++){var i=0;this._depth[e][n]>t&&(i=1),this._depth[e][n]=i}}}},{key:"getDelta",value:function(e){return this._depth[e][B.RIGHT]-this._depth[e][B.LEFT]}},{key:"getLocation",value:function(e,t){return this._depth[e][t]<=0?S.EXTERIOR:S.INTERIOR}},{key:"toString",value:function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]}},{key:"add",value:function(){if(arguments.length===1)for(var e=arguments[0],t=0;t<2;t++)for(var n=1;n<3;n++){var i=e.getLocation(t,n);i!==S.EXTERIOR&&i!==S.INTERIOR||(this.isNull(t,n)?this._depth[t][n]=s.depthAtLocation(i):this._depth[t][n]+=s.depthAtLocation(i))}else if(arguments.length===3){var u=arguments[0],f=arguments[1],g=arguments[2];g===S.INTERIOR&&this._depth[u][f]++}}}],[{key:"constructor_",value:function(){this._depth=Array(2).fill().map(function(){return Array(3)});for(var e=0;e<2;e++)for(var t=0;t<3;t++)this._depth[e][t]=s.NULL_VALUE}},{key:"depthAtLocation",value:function(e){return e===S.EXTERIOR?0:e===S.INTERIOR?1:s.NULL_VALUE}}]),s}();Ec.NULL_VALUE=-1;var kc=function(s){h(t,s);var e=k(t);function t(){var n;return a(this,t),n=e.call(this),t.constructor_.apply(m(n),arguments),n}return c(t,[{key:"getDepth",value:function(){return this._depth}},{key:"getCollapsedEdge",value:function(){var n=new Array(2).fill(null);return n[0]=this.pts[0],n[1]=this.pts[1],new t(n,We.toLineLabel(this._label))}},{key:"isIsolated",value:function(){return this._isIsolated}},{key:"getCoordinates",value:function(){return this.pts}},{key:"setIsolated",value:function(n){this._isIsolated=n}},{key:"setName",value:function(n){this._name=n}},{key:"equals",value:function(n){if(!(n instanceof t))return!1;var i=n;if(this.pts.length!==i.pts.length)return!1;for(var u=!0,f=!0,g=this.pts.length,y=0;y<this.pts.length;y++)if(this.pts[y].equals2D(i.pts[y])||(u=!1),this.pts[y].equals2D(i.pts[--g])||(f=!1),!u&&!f)return!1;return!0}},{key:"getCoordinate",value:function(){if(arguments.length===0)return this.pts.length>0?this.pts[0]:null;if(arguments.length===1){var n=arguments[0];return this.pts[n]}}},{key:"print",value:function(n){n.print("edge "+this._name+": "),n.print("LINESTRING (");for(var i=0;i<this.pts.length;i++)i>0&&n.print(","),n.print(this.pts[i].x+" "+this.pts[i].y);n.print(") "+this._label+" "+this._depthDelta)}},{key:"computeIM",value:function(n){t.updateIM(this._label,n)}},{key:"isCollapsed",value:function(){return!!this._label.isArea()&&this.pts.length===3&&!!this.pts[0].equals(this.pts[2])}},{key:"isClosed",value:function(){return this.pts[0].equals(this.pts[this.pts.length-1])}},{key:"getMaximumSegmentIndex",value:function(){return this.pts.length-1}},{key:"getDepthDelta",value:function(){return this._depthDelta}},{key:"getNumPoints",value:function(){return this.pts.length}},{key:"printReverse",value:function(n){n.print("edge "+this._name+": ");for(var i=this.pts.length-1;i>=0;i--)n.print(this.pts[i]+" ");n.println("")}},{key:"getMonotoneChainEdge",value:function(){return this._mce===null&&(this._mce=new wd(this)),this._mce}},{key:"getEnvelope",value:function(){if(this._env===null){this._env=new pe;for(var n=0;n<this.pts.length;n++)this._env.expandToInclude(this.pts[n])}return this._env}},{key:"addIntersection",value:function(n,i,u,f){var g=new O(n.getIntersection(f)),y=i,d=n.getEdgeDistance(u,f),N=y+1;if(N<this.pts.length){var b=this.pts[N];g.equals2D(b)&&(y=N,d=0)}this.eiList.add(g,y,d)}},{key:"toString",value:function(){var n=new ri;n.append("edge "+this._name+": "),n.append("LINESTRING (");for(var i=0;i<this.pts.length;i++)i>0&&n.append(","),n.append(this.pts[i].x+" "+this.pts[i].y);return n.append(") "+this._label+" "+this._depthDelta),n.toString()}},{key:"isPointwiseEqual",value:function(n){if(this.pts.length!==n.pts.length)return!1;for(var i=0;i<this.pts.length;i++)if(!this.pts[i].equals2D(n.pts[i]))return!1;return!0}},{key:"setDepthDelta",value:function(n){this._depthDelta=n}},{key:"getEdgeIntersectionList",value:function(){return this.eiList}},{key:"addIntersections",value:function(n,i,u){for(var f=0;f<n.getIntersectionNum();f++)this.addIntersection(n,i,u,f)}}],[{key:"constructor_",value:function(){if(this.pts=null,this._env=null,this.eiList=new kd(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new Ec,this._depthDelta=0,arguments.length===1){var n=arguments[0];t.constructor_.call(this,n,null)}else if(arguments.length===2){var i=arguments[0],u=arguments[1];this.pts=i,this._label=u}}},{key:"updateIM",value:function(){if(!(arguments.length===2&&arguments[1]instanceof Id&&arguments[0]instanceof We))return w(v(t),"updateIM",this).apply(this,arguments);var n=arguments[0],i=arguments[1];i.setAtLeastIfValid(n.getLocation(0,B.ON),n.getLocation(1,B.ON),1),n.isArea()&&(i.setAtLeastIfValid(n.getLocation(0,B.LEFT),n.getLocation(1,B.LEFT),2),i.setAtLeastIfValid(n.getLocation(0,B.RIGHT),n.getLocation(1,B.RIGHT),2))}}]),t}(nc),Ic=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"setWorkingPrecisionModel",value:function(e){this._workingPrecisionModel=e}},{key:"insertUniqueEdge",value:function(e){var t=this._edgeList.findEqualEdge(e);if(t!==null){var n=t.getLabel(),i=e.getLabel();t.isPointwiseEqual(e)||(i=new We(e.getLabel())).flip(),n.merge(i);var u=s.depthDelta(i),f=t.getDepthDelta()+u;t.setDepthDelta(f)}else this._edgeList.add(e),e.setDepthDelta(s.depthDelta(e.getLabel()))}},{key:"buildSubgraphs",value:function(e,t){for(var n=new Z,i=e.iterator();i.hasNext();){var u=i.next(),f=u.getRightmostCoordinate(),g=new pc(n).getDepth(f);u.computeDepth(g),u.findResultEdges(),n.add(u),t.add(u.getDirectedEdges(),u.getNodes())}}},{key:"createSubgraphs",value:function(e){for(var t=new Z,n=e.getNodes().iterator();n.hasNext();){var i=n.next();if(!i.isVisited()){var u=new Rm;u.create(i),t.add(u)}}return kn.sort(t,kn.reverseOrder()),t}},{key:"createEmptyResultGeometry",value:function(){return this._geomFact.createPolygon()}},{key:"getNoder",value:function(e){if(this._workingNoder!==null)return this._workingNoder;var t=new Js,n=new Wt;return n.setPrecisionModel(e),t.setSegmentIntersector(new xd(n)),t}},{key:"buffer",value:function(e,t){var n=this._workingPrecisionModel;n===null&&(n=e.getPrecisionModel()),this._geomFact=e.getFactory();var i=new cd(n,this._bufParams),u=new hd(e,t,i).getCurves();if(u.size()<=0)return this.createEmptyResultGeometry();this.computeNodedEdges(u,n),this._graph=new uc(new dd),this._graph.addEdges(this._edgeList.getEdges());var f=this.createSubgraphs(this._graph),g=new Jm(this._geomFact);this.buildSubgraphs(f,g);var y=g.getPolygons();return y.size()<=0?this.createEmptyResultGeometry():this._geomFact.buildGeometry(y)}},{key:"computeNodedEdges",value:function(e,t){var n=this.getNoder(t);n.computeNodes(e);for(var i=n.getNodedSubstrings().iterator();i.hasNext();){var u=i.next(),f=u.getCoordinates();if(f.length!==2||!f[0].equals2D(f[1])){var g=u.getData(),y=new kc(u.getCoordinates(),new We(g));this.insertUniqueEdge(y)}}}},{key:"setNoder",value:function(e){this._workingNoder=e}}],[{key:"constructor_",value:function(){this._bufParams=null,this._workingPrecisionModel=null,this._workingNoder=null,this._geomFact=null,this._graph=null,this._edgeList=new _d;var e=arguments[0];this._bufParams=e}},{key:"depthDelta",value:function(e){var t=e.getLocation(0,B.LEFT),n=e.getLocation(0,B.RIGHT);return t===S.INTERIOR&&n===S.EXTERIOR?1:t===S.EXTERIOR&&n===S.INTERIOR?-1:0}},{key:"convertSegStrings",value:function(e){for(var t=new xn,n=new Z;e.hasNext();){var i=e.next(),u=t.createLineString(i.getCoordinates());n.add(u)}return t.buildGeometry(n)}}]),s}(),bd=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"rescale",value:function(){if(re(arguments[0],ct))for(var e=arguments[0],t=e.iterator();t.hasNext();){var n=t.next();this.rescale(n.getCoordinates())}else if(arguments[0]instanceof Array){for(var i=arguments[0],u=0;u<i.length;u++)i[u].x=i[u].x/this._scaleFactor+this._offsetX,i[u].y=i[u].y/this._scaleFactor+this._offsetY;i.length===2&&i[0].equals2D(i[1])&&je.out.println(i)}}},{key:"scale",value:function(){if(re(arguments[0],ct)){for(var e=arguments[0],t=new Z(e.size()),n=e.iterator();n.hasNext();){var i=n.next();t.add(new Ht(this.scale(i.getCoordinates()),i.getData()))}return t}if(arguments[0]instanceof Array){for(var u=arguments[0],f=new Array(u.length).fill(null),g=0;g<u.length;g++)f[g]=new O(Math.round((u[g].x-this._offsetX)*this._scaleFactor),Math.round((u[g].y-this._offsetY)*this._scaleFactor),u[g].getZ());var y=Ee.removeRepeatedPoints(f);return y}}},{key:"isIntegerPrecision",value:function(){return this._scaleFactor===1}},{key:"getNodedSubstrings",value:function(){var e=this._noder.getNodedSubstrings();return this._isScaled&&this.rescale(e),e}},{key:"computeNodes",value:function(e){var t=e;this._isScaled&&(t=this.scale(e)),this._noder.computeNodes(t)}},{key:"interfaces_",get:function(){return[Zs]}}],[{key:"constructor_",value:function(){if(this._noder=null,this._scaleFactor=null,this._offsetX=null,this._offsetY=null,this._isScaled=!1,arguments.length===2){var e=arguments[0],t=arguments[1];s.constructor_.call(this,e,t,0,0)}else if(arguments.length===4){var n=arguments[0],i=arguments[1];this._noder=n,this._scaleFactor=i,this._isScaled=!this.isIntegerPrecision()}}}]),s}(),Sc=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"checkEndPtVertexIntersections",value:function(){if(arguments.length===0)for(var e=this._segStrings.iterator();e.hasNext();){var t=e.next(),n=t.getCoordinates();this.checkEndPtVertexIntersections(n[0],this._segStrings),this.checkEndPtVertexIntersections(n[n.length-1],this._segStrings)}else if(arguments.length===2){for(var i=arguments[0],u=arguments[1],f=u.iterator();f.hasNext();)for(var g=f.next(),y=g.getCoordinates(),d=1;d<y.length-1;d++)if(y[d].equals(i))throw new we("found endpt/interior pt intersection at index "+d+" :pt "+i)}}},{key:"checkInteriorIntersections",value:function(){if(arguments.length===0)for(var e=this._segStrings.iterator();e.hasNext();)for(var t=e.next(),n=this._segStrings.iterator();n.hasNext();){var i=n.next();this.checkInteriorIntersections(t,i)}else if(arguments.length===2)for(var u=arguments[0],f=arguments[1],g=u.getCoordinates(),y=f.getCoordinates(),d=0;d<g.length-1;d++)for(var N=0;N<y.length-1;N++)this.checkInteriorIntersections(u,d,f,N);else if(arguments.length===4){var b=arguments[0],L=arguments[1],$=arguments[2],F=arguments[3];if(b===$&&L===F)return null;var V=b.getCoordinates()[L],H=b.getCoordinates()[L+1],K=$.getCoordinates()[F],ge=$.getCoordinates()[F+1];if(this._li.computeIntersection(V,H,K,ge),this._li.hasIntersection()&&(this._li.isProper()||this.hasInteriorIntersection(this._li,V,H)||this.hasInteriorIntersection(this._li,K,ge)))throw new we("found non-noded intersection at "+V+"-"+H+" and "+K+"-"+ge)}}},{key:"checkValid",value:function(){this.checkEndPtVertexIntersections(),this.checkInteriorIntersections(),this.checkCollapses()}},{key:"checkCollapses",value:function(){if(arguments.length===0)for(var e=this._segStrings.iterator();e.hasNext();){var t=e.next();this.checkCollapses(t)}else if(arguments.length===1)for(var n=arguments[0],i=n.getCoordinates(),u=0;u<i.length-2;u++)this.checkCollapse(i[u],i[u+1],i[u+2])}},{key:"hasInteriorIntersection",value:function(e,t,n){for(var i=0;i<e.getIntersectionNum();i++){var u=e.getIntersection(i);if(!u.equals(t)&&!u.equals(n))return!0}return!1}},{key:"checkCollapse",value:function(e,t,n){if(e.equals(n))throw new we("found non-noded collapse at "+s.fact.createLineString([e,t,n]))}}],[{key:"constructor_",value:function(){this._li=new Wt,this._segStrings=null;var e=arguments[0];this._segStrings=e}}]),s}();Sc.fact=new xn;var Ks=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"intersectsScaled",value:function(e,t){var n=Math.min(e.x,t.x),i=Math.max(e.x,t.x),u=Math.min(e.y,t.y),f=Math.max(e.y,t.y),g=this._maxx<n||this._minx>i||this._maxy<u||this._miny>f;if(g)return!1;var y=this.intersectsToleranceSquare(e,t);return se.isTrue(!(g&&y),"Found bad envelope test"),y}},{key:"initCorners",value:function(e){var t=.5;this._minx=e.x-t,this._maxx=e.x+t,this._miny=e.y-t,this._maxy=e.y+t,this._corner[0]=new O(this._maxx,this._maxy),this._corner[1]=new O(this._minx,this._maxy),this._corner[2]=new O(this._minx,this._miny),this._corner[3]=new O(this._maxx,this._miny)}},{key:"intersects",value:function(e,t){return this._scaleFactor===1?this.intersectsScaled(e,t):(this.copyScaled(e,this._p0Scaled),this.copyScaled(t,this._p1Scaled),this.intersectsScaled(this._p0Scaled,this._p1Scaled))}},{key:"scale",value:function(e){return Math.round(e*this._scaleFactor)}},{key:"getCoordinate",value:function(){return this._originalPt}},{key:"copyScaled",value:function(e,t){t.x=this.scale(e.x),t.y=this.scale(e.y)}},{key:"getSafeEnvelope",value:function(){if(this._safeEnv===null){var e=s.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new pe(this._originalPt.x-e,this._originalPt.x+e,this._originalPt.y-e,this._originalPt.y+e)}return this._safeEnv}},{key:"intersectsPixelClosure",value:function(e,t){return this._li.computeIntersection(e,t,this._corner[0],this._corner[1]),!!this._li.hasIntersection()||(this._li.computeIntersection(e,t,this._corner[1],this._corner[2]),!!this._li.hasIntersection()||(this._li.computeIntersection(e,t,this._corner[2],this._corner[3]),!!this._li.hasIntersection()||(this._li.computeIntersection(e,t,this._corner[3],this._corner[0]),!!this._li.hasIntersection())))}},{key:"intersectsToleranceSquare",value:function(e,t){var n=!1,i=!1;return this._li.computeIntersection(e,t,this._corner[0],this._corner[1]),!!this._li.isProper()||(this._li.computeIntersection(e,t,this._corner[1],this._corner[2]),!!this._li.isProper()||(this._li.hasIntersection()&&(n=!0),this._li.computeIntersection(e,t,this._corner[2],this._corner[3]),!!this._li.isProper()||(this._li.hasIntersection()&&(i=!0),this._li.computeIntersection(e,t,this._corner[3],this._corner[0]),!!this._li.isProper()||!(!n||!i)||!!e.equals(this._pt)||!!t.equals(this._pt))))}},{key:"addSnappedNode",value:function(e,t){var n=e.getCoordinate(t),i=e.getCoordinate(t+1);return!!this.intersects(n,i)&&(e.addIntersection(this.getCoordinate(),t),!0)}}],[{key:"constructor_",value:function(){this._li=null,this._pt=null,this._originalPt=null,this._ptScaled=null,this._p0Scaled=null,this._p1Scaled=null,this._scaleFactor=null,this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,this._corner=new Array(4).fill(null),this._safeEnv=null;var e=arguments[0],t=arguments[1],n=arguments[2];if(this._originalPt=e,this._pt=e,this._scaleFactor=t,this._li=n,t<=0)throw new M("Scale factor must be non-zero");t!==1&&(this._pt=new O(this.scale(e.x),this.scale(e.y)),this._p0Scaled=new O,this._p1Scaled=new O),this.initCorners(this._pt)}}]),s}();Ks.SAFE_ENV_EXPANSION_FACTOR=.75;var Od=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"select",value:function(){if(arguments.length!==1){if(arguments.length===2){var e=arguments[0],t=arguments[1];e.getLineSegment(t,this.selectedSegment),this.select(this.selectedSegment)}}}}],[{key:"constructor_",value:function(){this.selectedSegment=new $e}}]),s}(),Nc=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"snap",value:function(){if(arguments.length===1){var e=arguments[0];return this.snap(e,null,-1)}if(arguments.length===3){var t=arguments[0],n=arguments[1],i=arguments[2],u=t.getSafeEnvelope(),f=new wc(t,n,i);return this._index.query(u,new(function(){function g(){a(this,g)}return c(g,[{key:"interfaces_",get:function(){return[cc]}},{key:"visitItem",value:function(y){y.select(u,f)}}]),g}())),f.isNodeAdded()}}}],[{key:"constructor_",value:function(){this._index=null;var e=arguments[0];this._index=e}}]),s}(),wc=function(s){h(t,s);var e=k(t);function t(){var n;return a(this,t),n=e.call(this),t.constructor_.apply(m(n),arguments),n}return c(t,[{key:"isNodeAdded",value:function(){return this._isNodeAdded}},{key:"select",value:function(){if(!(arguments.length===2&&Number.isInteger(arguments[1])&&arguments[0]instanceof hc))return w(v(t.prototype),"select",this).apply(this,arguments);var n=arguments[0],i=arguments[1],u=n.getContext();if(this._parentEdge===u&&(i===this._hotPixelVertexIndex||i+1===this._hotPixelVertexIndex))return null;this._isNodeAdded|=this._hotPixel.addSnappedNode(u,i)}}],[{key:"constructor_",value:function(){this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var n=arguments[0],i=arguments[1],u=arguments[2];this._hotPixel=n,this._parentEdge=i,this._hotPixelVertexIndex=u}}]),t}(Od);Nc.HotPixelSnapAction=wc;var Td=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"processIntersections",value:function(e,t,n,i){if(e===n&&t===i)return null;var u=e.getCoordinates()[t],f=e.getCoordinates()[t+1],g=n.getCoordinates()[i],y=n.getCoordinates()[i+1];if(this._li.computeIntersection(u,f,g,y),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var d=0;d<this._li.getIntersectionNum();d++)this._interiorIntersections.add(this._li.getIntersection(d));e.addIntersections(this._li,t,0),n.addIntersections(this._li,i,1)}}},{key:"isDone",value:function(){return!1}},{key:"getInteriorIntersections",value:function(){return this._interiorIntersections}},{key:"interfaces_",get:function(){return[xc]}}],[{key:"constructor_",value:function(){this._li=null,this._interiorIntersections=null;var e=arguments[0];this._li=e,this._interiorIntersections=new Z}}]),s}(),Ld=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"checkCorrectness",value:function(e){var t=Ht.getNodedSubstrings(e),n=new Sc(t);try{n.checkValid()}catch(i){if(!(i instanceof D))throw i;i.printStackTrace()}}},{key:"getNodedSubstrings",value:function(){return Ht.getNodedSubstrings(this._nodedSegStrings)}},{key:"snapRound",value:function(e,t){var n=this.findInteriorIntersections(e,t);this.computeIntersectionSnaps(n),this.computeVertexSnaps(e)}},{key:"findInteriorIntersections",value:function(e,t){var n=new Td(t);return this._noder.setSegmentIntersector(n),this._noder.computeNodes(e),n.getInteriorIntersections()}},{key:"computeVertexSnaps",value:function(){if(re(arguments[0],ct))for(var e=arguments[0],t=e.iterator();t.hasNext();){var n=t.next();this.computeVertexSnaps(n)}else if(arguments[0]instanceof Ht)for(var i=arguments[0],u=i.getCoordinates(),f=0;f<u.length;f++){var g=new Ks(u[f],this._scaleFactor,this._li),y=this._pointSnapper.snap(g,i,f);y&&i.addIntersection(u[f],f)}}},{key:"computeNodes",value:function(e){this._nodedSegStrings=e,this._noder=new Js,this._pointSnapper=new Nc(this._noder.getIndex()),this.snapRound(e,this._li)}},{key:"computeIntersectionSnaps",value:function(e){for(var t=e.iterator();t.hasNext();){var n=t.next(),i=new Ks(n,this._scaleFactor,this._li);this._pointSnapper.snap(i)}}},{key:"interfaces_",get:function(){return[Zs]}}],[{key:"constructor_",value:function(){this._pm=null,this._li=null,this._scaleFactor=null,this._noder=null,this._pointSnapper=null,this._nodedSegStrings=null;var e=arguments[0];this._pm=e,this._li=new Wt,this._li.setPrecisionModel(e),this._scaleFactor=e.getScale()}}]),s}(),Nn=function(){function s(){a(this,s),s.constructor_.apply(this,arguments)}return c(s,[{key:"bufferFixedPrecision",value:function(e){var t=new bd(new Ld(new tt(1)),e.getScale()),n=new Ic(this._bufParams);n.setWorkingPrecisionModel(e),n.setNoder(t),this._resultGeometry=n.buffer(this._argGeom,this._distance)}},{key:"bufferReducedPrecision",value:function(){if(arguments.length===0){for(var e=s.MAX_PRECISION_DIGITS;e>=0;e--){try{this.bufferReducedPrecision(e)}catch(u){if(!(u instanceof _t))throw u;this._saveException=u}if(this._resultGeometry!==null)return null}throw this._saveException}if(arguments.length===1){var t=arguments[0],n=s.precisionScaleFactor(this._argGeom,this._distance,t),i=new tt(n);this.bufferFixedPrecision(i)}}},{key:"computeGeometry",value:function(){if(this.bufferOriginalPrecision(),this._resultGeometry!==null)return null;var e=this._argGeom.getFactory().getPrecisionModel();e.getType()===tt.FIXED?this.bufferFixedPrecision(e):this.bufferReducedPrecision()}},{key:"setQuadrantSegments",value:function(e){this._bufParams.setQuadrantSegments(e)}},{key:"bufferOriginalPrecision",value:function(){try{var e=new Ic(this._bufParams);this._resultGeometry=e.buffer(this._argGeom,this._distance)}catch(t){if(!(t instanceof we))throw t;this._saveException=t}}},{key:"getResultGeometry",value:function(e){return this._distance=e,this.computeGeometry(),this._resultGeometry}},{key:"setEndCapStyle",value:function(e){this._bufParams.setEndCapStyle(e)}}],[{key:"constructor_",value:function(){if(this._argGeom=null,this._distance=null,this._bufParams=new A,this._resultGeometry=null,this._saveException=null,arguments.length===1){var e=arguments[0];this._argGeom=e}else if(arguments.length===2){var t=arguments[0],n=arguments[1];this._argGeom=t,this._bufParams=n}}},{key:"bufferOp",value:function(){if(arguments.length===2){var e=arguments[0],t=arguments[1],n=new s(e),i=n.getResultGeometry(t);return i}if(arguments.length===3){if(Number.isInteger(arguments[2])&&arguments[0]instanceof W&&typeof arguments[1]=="number"){var u=arguments[0],f=arguments[1],g=arguments[2],y=new s(u);y.setQuadrantSegments(g);var d=y.getResultGeometry(f);return d}if(arguments[2]instanceof A&&arguments[0]instanceof W&&typeof arguments[1]=="number"){var N=arguments[0],b=arguments[1],L=arguments[2],$=new s(N,L),F=$.getResultGeometry(b);return F}}else if(arguments.length===4){var V=arguments[0],H=arguments[1],K=arguments[2],ge=arguments[3],xe=new s(V);xe.setQuadrantSegments(K),xe.setEndCapStyle(ge);var Re=xe.getResultGeometry(H);return Re}}},{key:"precisionScaleFactor",value:function(e,t,n){var i=e.getEnvelopeInternal(),u=jn.max(Math.abs(i.getMaxX()),Math.abs(i.getMaxY()),Math.abs(i.getMinX()),Math.abs(i.getMinY()))+2*(t>0?t:0),f=n-Math.trunc(Math.log(u)/Math.log(10)+1);return Math.pow(10,f)}}]),s}();Nn.CAP_ROUND=A.CAP_ROUND,Nn.CAP_BUTT=A.CAP_FLAT,Nn.CAP_FLAT=A.CAP_FLAT,Nn.CAP_SQUARE=A.CAP_SQUARE,Nn.MAX_PRECISION_DIGITS=12;var Rd=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],bc=function(){function s(e){a(this,s),this.geometryFactory=e||new xn}return c(s,[{key:"read",value:function(e){var t,n=(t=typeof e=="string"?JSON.parse(e):e).type;if(!Ze[n])throw new Error("Unknown GeoJSON type: "+t.type);return Rd.indexOf(n)!==-1?Ze[n].call(this,t.coordinates):n==="GeometryCollection"?Ze[n].call(this,t.geometries):Ze[n].call(this,t)}},{key:"write",value:function(e){var t=e.getGeometryType();if(!yt[t])throw new Error("Geometry is not supported");return yt[t].call(this,e)}}]),s}(),Ze={Feature:function(s){var e={};for(var t in s)e[t]=s[t];if(s.geometry){var n=s.geometry.type;if(!Ze[n])throw new Error("Unknown GeoJSON type: "+s.type);e.geometry=this.read(s.geometry)}return s.bbox&&(e.bbox=Ze.bbox.call(this,s.bbox)),e},FeatureCollection:function(s){var e={};if(s.features){e.features=[];for(var t=0;t<s.features.length;++t)e.features.push(this.read(s.features[t]))}return s.bbox&&(e.bbox=this.parse.bbox.call(this,s.bbox)),e},coordinates:function(s){for(var e=[],t=0;t<s.length;++t){var n=s[t];e.push(x(O,C(n)))}return e},bbox:function(s){return this.geometryFactory.createLinearRing([new O(s[0],s[1]),new O(s[2],s[1]),new O(s[2],s[3]),new O(s[0],s[3]),new O(s[0],s[1])])},Point:function(s){var e=x(O,C(s));return this.geometryFactory.createPoint(e)},MultiPoint:function(s){for(var e=[],t=0;t<s.length;++t)e.push(Ze.Point.call(this,s[t]));return this.geometryFactory.createMultiPoint(e)},LineString:function(s){var e=Ze.coordinates.call(this,s);return this.geometryFactory.createLineString(e)},MultiLineString:function(s){for(var e=[],t=0;t<s.length;++t)e.push(Ze.LineString.call(this,s[t]));return this.geometryFactory.createMultiLineString(e)},Polygon:function(s){for(var e=Ze.coordinates.call(this,s[0]),t=this.geometryFactory.createLinearRing(e),n=[],i=1;i<s.length;++i){var u=s[i],f=Ze.coordinates.call(this,u),g=this.geometryFactory.createLinearRing(f);n.push(g)}return this.geometryFactory.createPolygon(t,n)},MultiPolygon:function(s){for(var e=[],t=0;t<s.length;++t){var n=s[t];e.push(Ze.Polygon.call(this,n))}return this.geometryFactory.createMultiPolygon(e)},GeometryCollection:function(s){for(var e=[],t=0;t<s.length;++t){var n=s[t];e.push(this.read(n))}return this.geometryFactory.createGeometryCollection(e)}},yt={coordinate:function(s){var e=[s.x,s.y];return s.z&&e.push(s.z),s.m&&e.push(s.m),e},Point:function(s){return{type:"Point",coordinates:yt.coordinate.call(this,s.getCoordinate())}},MultiPoint:function(s){for(var e=[],t=0;t<s._geometries.length;++t){var n=s._geometries[t],i=yt.Point.call(this,n);e.push(i.coordinates)}return{type:"MultiPoint",coordinates:e}},LineString:function(s){for(var e=[],t=s.getCoordinates(),n=0;n<t.length;++n){var i=t[n];e.push(yt.coordinate.call(this,i))}return{type:"LineString",coordinates:e}},MultiLineString:function(s){for(var e=[],t=0;t<s._geometries.length;++t){var n=s._geometries[t],i=yt.LineString.call(this,n);e.push(i.coordinates)}return{type:"MultiLineString",coordinates:e}},Polygon:function(s){var e=[],t=yt.LineString.call(this,s._shell);e.push(t.coordinates);for(var n=0;n<s._holes.length;++n){var i=s._holes[n],u=yt.LineString.call(this,i);e.push(u.coordinates)}return{type:"Polygon",coordinates:e}},MultiPolygon:function(s){for(var e=[],t=0;t<s._geometries.length;++t){var n=s._geometries[t],i=yt.Polygon.call(this,n);e.push(i.coordinates)}return{type:"MultiPolygon",coordinates:e}},GeometryCollection:function(s){for(var e=[],t=0;t<s._geometries.length;++t){var n=s._geometries[t],i=n.getGeometryType();e.push(yt[i].call(this,n))}return{type:"GeometryCollection",geometries:e}}};return{BufferOp:Nn,GeoJSONReader:function(){function s(e){a(this,s),this.parser=new bc(e||new xn)}return c(s,[{key:"read",value:function(e){return this.parser.read(e)}}]),s}(),GeoJSONWriter:function(){function s(){a(this,s),this.parser=new bc(this.geometryFactory)}return c(s,[{key:"write",value:function(e){return this.parser.write(e)}}]),s}()}})})(il);var zp=il.exports;const Yp=Dt(zp);function Ct(){return new Br}function Br(){this.reset()}Br.prototype={constructor:Br,reset:function(){this.s=this.t=0},add:function(o){sl(Gr,o,this.t),sl(this,Gr.s,this.s),this.s?this.t+=Gr.t:this.s=Gr.t},valueOf:function(){return this.s}};var Gr=new Br;function sl(o,r,a){var l=o.s=r+a,c=l-r,h=l-c;o.t=r-h+(a-c)}var ye=1e-6,ce=Math.PI,ut=ce/2,al=ce/4,lt=ce*2,Pt=180/ce,Xe=ce/180,Ie=Math.abs,Up=Math.atan,yn=Math.atan2,de=Math.cos,_e=Math.sin,vn=Math.sqrt;function ol(o){return o>1?0:o<-1?ce:Math.acos(o)}function zt(o){return o>1?ut:o<-1?-ut:Math.asin(o)}function qn(){}function qr(o,r){o&&ll.hasOwnProperty(o.type)&&ll[o.type](o,r)}var ul={Feature:function(o,r){qr(o.geometry,r)},FeatureCollection:function(o,r){for(var a=o.features,l=-1,c=a.length;++l<c;)qr(a[l].geometry,r)}},ll={Sphere:function(o,r){r.sphere()},Point:function(o,r){o=o.coordinates,r.point(o[0],o[1],o[2])},MultiPoint:function(o,r){for(var a=o.coordinates,l=-1,c=a.length;++l<c;)o=a[l],r.point(o[0],o[1],o[2])},LineString:function(o,r){Ns(o.coordinates,r,0)},MultiLineString:function(o,r){for(var a=o.coordinates,l=-1,c=a.length;++l<c;)Ns(a[l],r,0)},Polygon:function(o,r){cl(o.coordinates,r)},MultiPolygon:function(o,r){for(var a=o.coordinates,l=-1,c=a.length;++l<c;)cl(a[l],r)},GeometryCollection:function(o,r){for(var a=o.geometries,l=-1,c=a.length;++l<c;)qr(a[l],r)}};function Ns(o,r,a){var l=-1,c=o.length-a,h;for(r.lineStart();++l<c;)h=o[l],r.point(h[0],h[1],h[2]);r.lineEnd()}function cl(o,r){var a=-1,l=o.length;for(r.polygonStart();++a<l;)Ns(o[a],r,1);r.polygonEnd()}function Xp(o,r){o&&ul.hasOwnProperty(o.type)?ul[o.type](o,r):qr(o,r)}Ct(),Ct();function ws(o){return[yn(o[1],o[0]),zt(o[2])]}function pn(o){var r=o[0],a=o[1],l=de(a);return[l*de(r),l*_e(r),_e(a)]}function zr(o,r){return o[0]*r[0]+o[1]*r[1]+o[2]*r[2]}function Yr(o,r){return[o[1]*r[2]-o[2]*r[1],o[2]*r[0]-o[0]*r[2],o[0]*r[1]-o[1]*r[0]]}function bs(o,r){o[0]+=r[0],o[1]+=r[1],o[2]+=r[2]}function Ur(o,r){return[o[0]*r,o[1]*r,o[2]*r]}function Os(o){var r=vn(o[0]*o[0]+o[1]*o[1]+o[2]*o[2]);o[0]/=r,o[1]/=r,o[2]/=r}Ct();function fl(o,r){function a(l,c){return l=o(l,c),r(l[0],l[1])}return o.invert&&r.invert&&(a.invert=function(l,c){return l=r.invert(l,c),l&&o.invert(l[0],l[1])}),a}function Ts(o,r){return[o>ce?o-lt:o<-ce?o+lt:o,r]}Ts.invert=Ts;function jp(o,r,a){return(o%=lt)?r||a?fl(gl(o),yl(r,a)):gl(o):r||a?yl(r,a):Ts}function hl(o){return function(r,a){return r+=o,[r>ce?r-lt:r<-ce?r+lt:r,a]}}function gl(o){var r=hl(o);return r.invert=hl(-o),r}function yl(o,r){var a=de(o),l=_e(o),c=de(r),h=_e(r);function v(p,_){var x=de(_),I=de(p)*x,m=_e(p)*x,E=_e(_),k=E*a+I*l;return[yn(m*c-k*h,I*a-E*l),zt(k*c+m*h)]}return v.invert=function(p,_){var x=de(_),I=de(p)*x,m=_e(p)*x,E=_e(_),k=E*c-m*h;return[yn(m*c+E*h,I*a+k*l),zt(k*a-I*l)]},v}function Vp(o,r,a,l,c,h){if(a){var v=de(r),p=_e(r),_=l*a;c==null?(c=r+l*lt,h=r-_/2):(c=vl(v,c),h=vl(v,h),(l>0?c<h:c>h)&&(c+=l*lt));for(var x,I=c;l>0?I>h:I<h;I-=_)x=ws([v,-p*de(I),-p*_e(I)]),o.point(x[0],x[1])}}function vl(o,r){r=pn(r),r[0]-=o,Os(r);var a=ol(-r[1]);return((-r[2]<0?-a:a)+lt-ye)%lt}function pl(){var o=[],r;return{point:function(a,l){r.push([a,l])},lineStart:function(){o.push(r=[])},lineEnd:qn,rejoin:function(){o.length>1&&o.push(o.pop().concat(o.shift()))},result:function(){var a=o;return o=[],r=null,a}}}function Wp(o,r,a,l,c,h){var v=o[0],p=o[1],_=r[0],x=r[1],I=0,m=1,E=_-v,k=x-p,w;if(w=a-v,!(!E&&w>0)){if(w/=E,E<0){if(w<I)return;w<m&&(m=w)}else if(E>0){if(w>m)return;w>I&&(I=w)}if(w=c-v,!(!E&&w<0)){if(w/=E,E<0){if(w>m)return;w>I&&(I=w)}else if(E>0){if(w<I)return;w<m&&(m=w)}if(w=l-p,!(!k&&w>0)){if(w/=k,k<0){if(w<I)return;w<m&&(m=w)}else if(k>0){if(w>m)return;w>I&&(I=w)}if(w=h-p,!(!k&&w<0)){if(w/=k,k<0){if(w>m)return;w>I&&(I=w)}else if(k>0){if(w<I)return;w<m&&(m=w)}return I>0&&(o[0]=v+I*E,o[1]=p+I*k),m<1&&(r[0]=v+m*E,r[1]=p+m*k),!0}}}}}function Xr(o,r){return Ie(o[0]-r[0])<ye&&Ie(o[1]-r[1])<ye}function jr(o,r,a,l){this.x=o,this.z=r,this.o=a,this.e=l,this.v=!1,this.n=this.p=null}function ml(o,r,a,l,c){var h=[],v=[],p,_;if(o.forEach(function(w){if(!((C=w.length-1)<=0)){var C,T=w[0],R=w[C],P;if(Xr(T,R)){for(c.lineStart(),p=0;p<C;++p)c.point((T=w[p])[0],T[1]);c.lineEnd();return}h.push(P=new jr(T,w,null,!0)),v.push(P.o=new jr(T,null,P,!1)),h.push(P=new jr(R,w,null,!1)),v.push(P.o=new jr(R,null,P,!0))}}),!!h.length){for(v.sort(r),dl(h),dl(v),p=0,_=v.length;p<_;++p)v[p].e=a=!a;for(var x=h[0],I,m;;){for(var E=x,k=!0;E.v;)if((E=E.n)===x)return;I=E.z,c.lineStart();do{if(E.v=E.o.v=!0,E.e){if(k)for(p=0,_=I.length;p<_;++p)c.point((m=I[p])[0],m[1]);else l(E.x,E.n.x,1,c);E=E.n}else{if(k)for(I=E.p.z,p=I.length-1;p>=0;--p)c.point((m=I[p])[0],m[1]);else l(E.x,E.p.x,-1,c);E=E.p}E=E.o,I=E.z,k=!k}while(!E.v);c.lineEnd()}}}function dl(o){if(r=o.length){for(var r,a=0,l=o[0],c;++a<r;)l.n=c=o[a],c.p=l,l=c;l.n=c=o[0],c.p=l}}function _l(o,r){return o<r?-1:o>r?1:o>=r?0:NaN}function Hp(o){return o.length===1&&(o=Zp(o)),{left:function(r,a,l,c){for(l==null&&(l=0),c==null&&(c=r.length);l<c;){var h=l+c>>>1;o(r[h],a)<0?l=h+1:c=h}return l},right:function(r,a,l,c){for(l==null&&(l=0),c==null&&(c=r.length);l<c;){var h=l+c>>>1;o(r[h],a)>0?c=h:l=h+1}return l}}}function Zp(o){return function(r,a){return _l(o(r),a)}}Hp(_l);function xl(o){for(var r=o.length,a,l=-1,c=0,h,v;++l<r;)c+=o[l].length;for(h=new Array(c);--r>=0;)for(v=o[r],a=v.length;--a>=0;)h[--c]=v[a];return h}var zn=1e9,Vr=-zn;function Jp(o,r,a,l){function c(x,I){return o<=x&&x<=a&&r<=I&&I<=l}function h(x,I,m,E){var k=0,w=0;if(x==null||(k=v(x,m))!==(w=v(I,m))||_(x,I)<0^m>0)do E.point(k===0||k===3?o:a,k>1?l:r);while((k=(k+m+4)%4)!==w);else E.point(I[0],I[1])}function v(x,I){return Ie(x[0]-o)<ye?I>0?0:3:Ie(x[0]-a)<ye?I>0?2:1:Ie(x[1]-r)<ye?I>0?1:0:I>0?3:2}function p(x,I){return _(x.x,I.x)}function _(x,I){var m=v(x,1),E=v(I,1);return m!==E?m-E:m===0?I[1]-x[1]:m===1?x[0]-I[0]:m===2?x[1]-I[1]:I[0]-x[0]}return function(x){var I=x,m=pl(),E,k,w,C,T,R,P,A,D,M,G,Y={point:U,lineStart:te,lineEnd:ae,polygonStart:ie,polygonEnd:ee};function U(ne,ue){c(ne,ue)&&I.point(ne,ue)}function X(){for(var ne=0,ue=0,ve=k.length;ue<ve;++ue)for(var Se=k[ue],Ne=1,j=Se.length,Pe=Se[0],we,De,se=Pe[0],dt=Pe[1];Ne<j;++Ne)we=se,De=dt,Pe=Se[Ne],se=Pe[0],dt=Pe[1],De<=l?dt>l&&(se-we)*(l-De)>(dt-De)*(o-we)&&++ne:dt<=l&&(se-we)*(l-De)<(dt-De)*(o-we)&&--ne;return ne}function ie(){I=m,E=[],k=[],G=!0}function ee(){var ne=X(),ue=G&&ne,ve=(E=xl(E)).length;(ue||ve)&&(x.polygonStart(),ue&&(x.lineStart(),h(null,null,1,x),x.lineEnd()),ve&&ml(E,p,ne,h,x),x.polygonEnd()),I=x,E=k=w=null}function te(){Y.point=q,k&&k.push(w=[]),M=!0,D=!1,P=A=NaN}function ae(){E&&(q(C,T),R&&D&&m.rejoin(),E.push(m.result())),Y.point=U,D&&I.lineEnd()}function q(ne,ue){var ve=c(ne,ue);if(k&&w.push([ne,ue]),M)C=ne,T=ue,R=ve,M=!1,ve&&(I.lineStart(),I.point(ne,ue));else if(ve&&D)I.point(ne,ue);else{var Se=[P=Math.max(Vr,Math.min(zn,P)),A=Math.max(Vr,Math.min(zn,A))],Ne=[ne=Math.max(Vr,Math.min(zn,ne)),ue=Math.max(Vr,Math.min(zn,ue))];Wp(Se,Ne,o,r,a,l)?(D||(I.lineStart(),I.point(Se[0],Se[1])),I.point(Ne[0],Ne[1]),ve||I.lineEnd(),G=!1):ve&&(I.lineStart(),I.point(ne,ue),G=!1)}P=ne,A=ue,D=ve}return Y}}var Ls=Ct();function Qp(o,r){var a=r[0],l=r[1],c=[_e(a),-de(a),0],h=0,v=0;Ls.reset();for(var p=0,_=o.length;p<_;++p)if(I=(x=o[p]).length)for(var x,I,m=x[I-1],E=m[0],k=m[1]/2+al,w=_e(k),C=de(k),T=0;T<I;++T,E=P,w=D,C=M,m=R){var R=x[T],P=R[0],A=R[1]/2+al,D=_e(A),M=de(A),G=P-E,Y=G>=0?1:-1,U=Y*G,X=U>ce,ie=w*D;if(Ls.add(yn(ie*Y*_e(U),C*M+ie*de(U))),h+=X?G+Y*lt:G,X^E>=a^P>=a){var ee=Yr(pn(m),pn(R));Os(ee);var te=Yr(c,ee);Os(te);var ae=(X^G>=0?-1:1)*zt(te[2]);(l>ae||l===ae&&(ee[0]||ee[1]))&&(v+=X^G>=0?1:-1)}}return(h<-ye||h<ye&&Ls<-ye)^v&1}Ct();function El(o){return o}Ct(),Ct();var mn=1/0,Wr=mn,Yn=-mn,Hr=Yn,kl={point:Kp,lineStart:qn,lineEnd:qn,polygonStart:qn,polygonEnd:qn,result:function(){var o=[[mn,Wr],[Yn,Hr]];return Yn=Hr=-(Wr=mn=1/0),o}};function Kp(o,r){o<mn&&(mn=o),o>Yn&&(Yn=o),r<Wr&&(Wr=r),r>Hr&&(Hr=r)}Ct();function Il(o,r,a,l){return function(c,h){var v=r(h),p=c.invert(l[0],l[1]),_=pl(),x=r(_),I=!1,m,E,k,w={point:C,lineStart:R,lineEnd:P,polygonStart:function(){w.point=A,w.lineStart=D,w.lineEnd=M,E=[],m=[]},polygonEnd:function(){w.point=C,w.lineStart=R,w.lineEnd=P,E=xl(E);var G=Qp(m,p);E.length?(I||(h.polygonStart(),I=!0),ml(E,tm,G,a,h)):G&&(I||(h.polygonStart(),I=!0),h.lineStart(),a(null,null,1,h),h.lineEnd()),I&&(h.polygonEnd(),I=!1),E=m=null},sphere:function(){h.polygonStart(),h.lineStart(),a(null,null,1,h),h.lineEnd(),h.polygonEnd()}};function C(G,Y){var U=c(G,Y);o(G=U[0],Y=U[1])&&h.point(G,Y)}function T(G,Y){var U=c(G,Y);v.point(U[0],U[1])}function R(){w.point=T,v.lineStart()}function P(){w.point=C,v.lineEnd()}function A(G,Y){k.push([G,Y]);var U=c(G,Y);x.point(U[0],U[1])}function D(){x.lineStart(),k=[]}function M(){A(k[0][0],k[0][1]),x.lineEnd();var G=x.clean(),Y=_.result(),U,X=Y.length,ie,ee,te;if(k.pop(),m.push(k),k=null,!!X){if(G&1){if(ee=Y[0],(ie=ee.length-1)>0){for(I||(h.polygonStart(),I=!0),h.lineStart(),U=0;U<ie;++U)h.point((te=ee[U])[0],te[1]);h.lineEnd()}return}X>1&&G&2&&Y.push(Y.pop().concat(Y.shift())),E.push(Y.filter(em))}}return w}}function em(o){return o.length>1}function tm(o,r){return((o=o.x)[0]<0?o[1]-ut-ye:ut-o[1])-((r=r.x)[0]<0?r[1]-ut-ye:ut-r[1])}const Sl=Il(function(){return!0},nm,im,[-ce,-ut]);function nm(o){var r=NaN,a=NaN,l=NaN,c;return{lineStart:function(){o.lineStart(),c=1},point:function(h,v){var p=h>0?ce:-ce,_=Ie(h-r);Ie(_-ce)<ye?(o.point(r,a=(a+v)/2>0?ut:-ut),o.point(l,a),o.lineEnd(),o.lineStart(),o.point(p,a),o.point(h,a),c=0):l!==p&&_>=ce&&(Ie(r-l)<ye&&(r-=l*ye),Ie(h-p)<ye&&(h-=p*ye),a=rm(r,a,h,v),o.point(l,a),o.lineEnd(),o.lineStart(),o.point(p,a),c=0),o.point(r=h,a=v),l=p},lineEnd:function(){o.lineEnd(),r=a=NaN},clean:function(){return 2-c}}}function rm(o,r,a,l){var c,h,v=_e(o-a);return Ie(v)>ye?Up((_e(r)*(h=de(l))*_e(a)-_e(l)*(c=de(r))*_e(o))/(c*h*v)):(r+l)/2}function im(o,r,a,l){var c;if(o==null)c=a*ut,l.point(-ce,c),l.point(0,c),l.point(ce,c),l.point(ce,0),l.point(ce,-c),l.point(0,-c),l.point(-ce,-c),l.point(-ce,0),l.point(-ce,c);else if(Ie(o[0]-r[0])>ye){var h=o[0]<r[0]?ce:-ce;c=a*h/2,l.point(-h,c),l.point(0,c),l.point(h,c)}else l.point(r[0],r[1])}function sm(o,r){var a=de(o),l=a>0,c=Ie(a)>ye;function h(I,m,E,k){Vp(k,o,r,E,I,m)}function v(I,m){return de(I)*de(m)>a}function p(I){var m,E,k,w,C;return{lineStart:function(){w=k=!1,C=1},point:function(T,R){var P=[T,R],A,D=v(T,R),M=l?D?0:x(T,R):D?x(T+(T<0?ce:-ce),R):0;if(!m&&(w=k=D)&&I.lineStart(),D!==k&&(A=_(m,P),(!A||Xr(m,A)||Xr(P,A))&&(P[0]+=ye,P[1]+=ye,D=v(P[0],P[1]))),D!==k)C=0,D?(I.lineStart(),A=_(P,m),I.point(A[0],A[1])):(A=_(m,P),I.point(A[0],A[1]),I.lineEnd()),m=A;else if(c&&m&&l^D){var G;!(M&E)&&(G=_(P,m,!0))&&(C=0,l?(I.lineStart(),I.point(G[0][0],G[0][1]),I.point(G[1][0],G[1][1]),I.lineEnd()):(I.point(G[1][0],G[1][1]),I.lineEnd(),I.lineStart(),I.point(G[0][0],G[0][1])))}D&&(!m||!Xr(m,P))&&I.point(P[0],P[1]),m=P,k=D,E=M},lineEnd:function(){k&&I.lineEnd(),m=null},clean:function(){return C|(w&&k)<<1}}}function _(I,m,E){var k=pn(I),w=pn(m),C=[1,0,0],T=Yr(k,w),R=zr(T,T),P=T[0],A=R-P*P;if(!A)return!E&&I;var D=a*R/A,M=-a*P/A,G=Yr(C,T),Y=Ur(C,D),U=Ur(T,M);bs(Y,U);var X=G,ie=zr(Y,X),ee=zr(X,X),te=ie*ie-ee*(zr(Y,Y)-1);if(!(te<0)){var ae=vn(te),q=Ur(X,(-ie-ae)/ee);if(bs(q,Y),q=ws(q),!E)return q;var ne=I[0],ue=m[0],ve=I[1],Se=m[1],Ne;ue<ne&&(Ne=ne,ne=ue,ue=Ne);var j=ue-ne,Pe=Ie(j-ce)<ye,we=Pe||j<ye;if(!Pe&&Se<ve&&(Ne=ve,ve=Se,Se=Ne),we?Pe?ve+Se>0^q[1]<(Ie(q[0]-ne)<ye?ve:Se):ve<=q[1]&&q[1]<=Se:j>ce^(ne<=q[0]&&q[0]<=ue)){var De=Ur(X,(-ie+ae)/ee);return bs(De,Y),[q,ws(De)]}}}function x(I,m){var E=l?o:ce-o,k=0;return I<-E?k|=1:I>E&&(k|=2),m<-E?k|=4:m>E&&(k|=8),k}return Il(v,p,h,l?[0,-o]:[-ce,o-ce])}function Nl(o){return function(r){var a=new Rs;for(var l in o)a[l]=o[l];return a.stream=r,a}}function Rs(){}Rs.prototype={constructor:Rs,point:function(o,r){this.stream.point(o,r)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};function wl(o,r,a){var l=r[1][0]-r[0][0],c=r[1][1]-r[0][1],h=o.clipExtent&&o.clipExtent();o.scale(150).translate([0,0]),h!=null&&o.clipExtent(null),Xp(a,o.stream(kl));var v=kl.result(),p=Math.min(l/(v[1][0]-v[0][0]),c/(v[1][1]-v[0][1])),_=+r[0][0]+(l-p*(v[1][0]+v[0][0]))/2,x=+r[0][1]+(c-p*(v[1][1]+v[0][1]))/2;return h!=null&&o.clipExtent(h),o.scale(p*150).translate([_,x])}function am(o,r,a){return wl(o,[[0,0],r],a)}var bl=16,om=de(30*Xe);function Ol(o,r){return+r?lm(o,r):um(o)}function um(o){return Nl({point:function(r,a){r=o(r,a),this.stream.point(r[0],r[1])}})}function lm(o,r){function a(l,c,h,v,p,_,x,I,m,E,k,w,C,T){var R=x-l,P=I-c,A=R*R+P*P;if(A>4*r&&C--){var D=v+E,M=p+k,G=_+w,Y=vn(D*D+M*M+G*G),U=zt(G/=Y),X=Ie(Ie(G)-1)<ye||Ie(h-m)<ye?(h+m)/2:yn(M,D),ie=o(X,U),ee=ie[0],te=ie[1],ae=ee-l,q=te-c,ne=P*ae-R*q;(ne*ne/A>r||Ie((R*ae+P*q)/A-.5)>.3||v*E+p*k+_*w<om)&&(a(l,c,h,v,p,_,ee,te,X,D/=Y,M/=Y,G,C,T),T.point(ee,te),a(ee,te,X,D,M,G,x,I,m,E,k,w,C,T))}}return function(l){var c,h,v,p,_,x,I,m,E,k,w,C,T={point:R,lineStart:P,lineEnd:D,polygonStart:function(){l.polygonStart(),T.lineStart=M},polygonEnd:function(){l.polygonEnd(),T.lineStart=P}};function R(U,X){U=o(U,X),l.point(U[0],U[1])}function P(){m=NaN,T.point=A,l.lineStart()}function A(U,X){var ie=pn([U,X]),ee=o(U,X);a(m,E,I,k,w,C,m=ee[0],E=ee[1],I=U,k=ie[0],w=ie[1],C=ie[2],bl,l),l.point(m,E)}function D(){T.point=R,l.lineEnd()}function M(){P(),T.point=G,T.lineEnd=Y}function G(U,X){A(c=U,X),h=m,v=E,p=k,_=w,x=C,T.point=A}function Y(){a(m,E,I,k,w,C,h,v,c,p,_,x,bl,l),T.lineEnd=D,D()}return T}}var cm=Nl({point:function(o,r){this.stream.point(o*Xe,r*Xe)}});function fm(o){return hm(function(){return o})()}function hm(o){var r,a=150,l=480,c=250,h,v,p=0,_=0,x=0,I=0,m=0,E,k,w=null,C=Sl,T=null,R,P,A,D=El,M=.5,G=Ol(ee,M),Y,U;function X(q){return q=k(q[0]*Xe,q[1]*Xe),[q[0]*a+h,v-q[1]*a]}function ie(q){return q=k.invert((q[0]-h)/a,(v-q[1])/a),q&&[q[0]*Pt,q[1]*Pt]}function ee(q,ne){return q=r(q,ne),[q[0]*a+h,v-q[1]*a]}X.stream=function(q){return Y&&U===q?Y:Y=cm(C(E,G(D(U=q))))},X.clipAngle=function(q){return arguments.length?(C=+q?sm(w=q*Xe,6*Xe):(w=null,Sl),ae()):w*Pt},X.clipExtent=function(q){return arguments.length?(D=q==null?(T=R=P=A=null,El):Jp(T=+q[0][0],R=+q[0][1],P=+q[1][0],A=+q[1][1]),ae()):T==null?null:[[T,R],[P,A]]},X.scale=function(q){return arguments.length?(a=+q,te()):a},X.translate=function(q){return arguments.length?(l=+q[0],c=+q[1],te()):[l,c]},X.center=function(q){return arguments.length?(p=q[0]%360*Xe,_=q[1]%360*Xe,te()):[p*Pt,_*Pt]},X.rotate=function(q){return arguments.length?(x=q[0]%360*Xe,I=q[1]%360*Xe,m=q.length>2?q[2]%360*Xe:0,te()):[x*Pt,I*Pt,m*Pt]},X.precision=function(q){return arguments.length?(G=Ol(ee,M=q*q),ae()):vn(M)},X.fitExtent=function(q,ne){return wl(X,q,ne)},X.fitSize=function(q,ne){return am(X,q,ne)};function te(){k=fl(E=jp(x,I,m),r);var q=r(p,_);return h=l-q[0]*a,v=c+q[1]*a,ae()}function ae(){return Y=U=null,X}return function(){return r=o.apply(this,arguments),X.invert=r.invert&&ie,te()}}function Tl(o){return function(r,a){var l=de(r),c=de(a),h=o(l*c);return[h*c*_e(r),h*_e(a)]}}function Ll(o){return function(r,a){var l=vn(r*r+a*a),c=o(l),h=_e(c),v=de(c);return[yn(r*h,l*v),zt(l&&a*h/l)]}}var gm=Tl(function(o){return vn(2/(1+o))});gm.invert=Ll(function(o){return 2*zt(o/2)});var Rl=Tl(function(o){return(o=ol(o))&&o/_e(o)});Rl.invert=Ll(function(o){return o});function ym(){return fm(Rl).scale(79.4188).clipAngle(180-.001)}function Cl(o,r){return[o,r]}Cl.invert=Cl;var vm=Object.defineProperty,dn=(o,r)=>vm(o,"name",{value:r,configurable:!0}),{BufferOp:pm,GeoJSONReader:mm,GeoJSONWriter:dm}=Yp;function Pl(o,r,a){a=a||{};var l=a.units||"kilometers",c=a.steps||8;if(!o)throw new Error("geojson is required");if(typeof a!="object")throw new Error("options must be an object");if(typeof c!="number")throw new Error("steps must be an number");if(r===void 0)throw new Error("radius is required");if(c<=0)throw new Error("steps must be greater than 0");var h=[];switch(o.type){case"GeometryCollection":return qt(o,function(v){var p=Un(v,r,l,c);p&&h.push(p)}),Ke(h);case"FeatureCollection":return Mr(o,function(v){var p=Un(v,r,l,c);p&&Mr(p,function(_){_&&h.push(_)})}),Ke(h)}return Un(o,r,l,c)}dn(Pl,"buffer");function Un(o,r,a,l){var c=o.properties||{},h=o.type==="Feature"?o.geometry:o;if(h.type==="GeometryCollection"){var v=[];return qt(o,function(C){var T=Un(C,r,a,l);T&&v.push(T)}),Ke(v)}var p=Al(h),_={type:h.type,coordinates:Ps(h.coordinates,p)},x=new mm,I=x.read(_),m=fs(Lr(r,a),"meters"),E=pm.bufferOp(I,m,l),k=new dm;if(E=k.write(E),!Cs(E.coordinates)){var w={type:E.type,coordinates:As(E.coordinates,p)};return Ye(w,c)}}dn(Un,"bufferFeature");function Cs(o){return Array.isArray(o[0])?Cs(o[0]):isNaN(o[0])}dn(Cs,"coordsIsNaN");function Ps(o,r){return typeof o[0]!="object"?r(o):o.map(function(a){return Ps(a,r)})}dn(Ps,"projectCoords");function As(o,r){return typeof o[0]!="object"?r.invert(o):o.map(function(a){return As(a,r)})}dn(As,"unprojectCoords");function Al(o){var r=rl(o).geometry.coordinates,a=[-r[0],-r[1]];return ym().rotate(a).scale(Me)}dn(Al,"defineProjection");var _m=Pl,xm=Object.defineProperty,Em=(o,r)=>xm(o,"name",{value:r,configurable:!0});function Ml(o){const r=[];if(qt(o,c=>{r.push(c.coordinates)}),r.length<2)throw new Error("Must have at least two features");const a=o.features[0].properties||{},l=Yu.difference(r[0],...r.slice(1));return l.length===0?null:l.length===1?un(l[0],a):Tr(l,a)}Em(Ml,"difference");var km=Ml;function Dl(o){let r;for(const a of o)r&&a[0]-r[0]>=180?a[0]-=360:r&&a[0]-r[0]<-180&&(a[0]+=360),r=a}function Fl(o,r){const a=km(Ke([un([[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]]]),o]));if(!a)return;a.properties={isMask:"y"};const l=_m(o,0);if(l){if(l.geometry.type==="Polygon")for(const c of l.geometry.coordinates)Dl(c);else for(const c of l.geometry.coordinates)for(const h of c)Dl(h);r(Ke([l,a]))}}const $l=Ke([]);function Im(o,r,a=!0,l=!0,c={},h={},v={fill:{paint:{"fill-color":"#000","fill-opacity":.1},filter:["all",["==",["geometry-type"],"Polygon"],["has","isMask"]]},line:{layout:{"line-cap":"square"},paint:{"line-width":["case",["==",["geometry-type"],"Polygon"],2,3],"line-dasharray":[1,1],"line-color":"#3170fe"},filter:["!",["has","isMask"]]}}){let p;const _=[];let x,I,m;function E(){!o.getSource("full-geom")&&(v!=null&&v.fill||v!=null&&v.line)&&o.addSource("full-geom",{type:"geojson",data:$l}),!o.getLayer("full-geom-fill")&&(v!=null&&v.fill)&&o.addLayer({...v==null?void 0:v.fill,id:"full-geom-fill",type:"fill",source:"full-geom"}),!o.getLayer("full-geom-line")&&(v!=null&&v.line)&&o.addLayer({...v==null?void 0:v.line,id:"full-geom-line",type:"line",source:"full-geom"}),m&&C(m)}o.loaded()?E():o.once("load",()=>{E()}),o.on("styledata",()=>{E()});const k=T=>{p==null||p({type:"mapClick",coordinates:[T.lngLat.lng,T.lngLat.lat]})};function w(T=!1){if(!r)throw new Error;const R=document.createElement("div");return T&&R.classList.add("marker-interactive"),new Fp({props:{displayIn:"maplibre"},target:R}),new r.Marker({element:R,offset:[1,-13]})}function C(T){var R;m=T,(R=o.getSource("full-geom"))==null||R.setData(T)}return{setEventHandler(T){T?(p=T,o.on("click",k)):(p=void 0,o.off("click",k))},flyTo(T,R){o.flyTo({center:T,zoom:R,...c})},fitBounds(T,R,P){o.fitBounds([[T[0],T[1]],[T[2],T[3]]],{padding:R,maxZoom:P,...h})},indicateReverse(T){o.getCanvasContainer().style.cursor=T?"crosshair":""},setReverseMarker(T){!r||!a||(I?T?I.setLngLat(T):(I.remove(),I=void 0):T&&(I=(typeof a=="object"?new r.Marker(a):w()).setLngLat(T).addTo(o),I.getElement().classList.add("marker-reverse")))},setMarkers(T,R){if(a){for(const P of _)P.remove();if(_.length=0,C($l),!!r){if(R){let P=!1;if(R.geometry.type==="GeometryCollection"){const A=R.geometry.geometries.filter(D=>D.type==="Polygon"||D.type==="MultiPolygon");e:if(A.length>0){const D=mp(Ke(A.map(M=>Ye(M))));if(!D)break e;Fl({...R,geometry:D.geometry},C),P=!0}else{const D=R.geometry.geometries.filter(M=>M.type==="LineString"||M.type==="MultiLineString");D.length>0&&(C({...R,geometry:{type:"GeometryCollection",geometries:D}}),P=!0)}}if(!P){if(R.geometry.type==="Polygon"||R.geometry.type==="MultiPolygon")Fl(R,C);else if(R.geometry.type==="LineString"||R.geometry.type==="MultiLineString"){C(R);return}}a&&_.push((typeof a=="object"?new r.Marker(a):w()).setLngLat(R.center).addTo(o))}if(l)for(const P of T??[]){if(P===R)continue;const A=(typeof l=="object"?new r.Marker(l):w(!0)).setLngLat(P.center).setPopup(new r.Popup({offset:[1,-27],closeButton:!1,closeOnMove:!0,className:"maptiler-gc-popup"}).setText(P.place_type[0]==="reverse"?P.place_name:P.place_name.replace(/,.*/,""))).addTo(o),D=A.getElement();D.addEventListener("click",M=>{M.stopPropagation(),p==null||p({type:"markerClick",id:P.id})}),D.addEventListener("mouseenter",()=>{p==null||p({type:"markerMouseEnter",id:P.id}),A.togglePopup()}),D.addEventListener("mouseleave",()=>{p==null||p({type:"markerMouseLeave",id:P.id}),A.togglePopup()}),_.push(A)}}}},setSelectedMarker(T){x&&x.getElement().classList.toggle("marker-selected",!1),x=T>-1?_[T]:void 0,x==null||x.getElement().classList.toggle("marker-selected",!0)},getCenterAndZoom(){const T=o.getCenter();return[o.getZoom(),T.lng,T.lat]}}}qe.createMapLibreGlMapController=Im,Object.defineProperty(qe,Symbol.toStringTag,{value:"Module"})});
19
+ See the Apache Version 2.0 License for specific language governing permissions
20
+ and limitations under the License.
21
+ ***************************************************************************** */function Zt(i,t){var e={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,r,o,u;return u={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(u[Symbol.iterator]=function(){return this}),u;function s(f){return function(g){return c([f,g])}}function c(f){if(n)throw new TypeError("Generator is already executing.");for(;e;)try{if(n=1,r&&(o=f[0]&2?r.return:f[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,f[1])).done)return o;switch(r=0,o&&(f=[f[0]&2,o.value]),f[0]){case 0:case 1:o=f;break;case 4:return e.label++,{value:f[1],done:!1};case 5:e.label++,r=f[1],f=[0];continue;case 7:f=e.ops.pop(),e.trys.pop();continue;default:if(o=e.trys,!(o=o.length>0&&o[o.length-1])&&(f[0]===6||f[0]===2)){e=0;continue}if(f[0]===3&&(!o||f[1]>o[0]&&f[1]<o[3])){e.label=f[1];break}if(f[0]===6&&e.label<o[1]){e.label=o[1],o=f;break}if(o&&e.label<o[2]){e.label=o[2],e.ops.push(f);break}o[2]&&e.ops.pop(),e.trys.pop();continue}f=t.call(i,e)}catch(g){f=[6,g],r=0}finally{n=o=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}}var z=function(){function i(t,e){this.next=null,this.key=t,this.data=e,this.left=null,this.right=null}return i}();function Wt(i,t){return i>t?1:i<t?-1:0}function F(i,t,e){for(var n=new z(null,null),r=n,o=n;;){var u=e(i,t.key);if(u<0){if(t.left===null)break;if(e(i,t.left.key)<0){var s=t.left;if(t.left=s.right,s.right=t,t=s,t.left===null)break}o.left=t,o=t,t=t.left}else if(u>0){if(t.right===null)break;if(e(i,t.right.key)>0){var s=t.right;if(t.right=s.left,s.left=t,t=s,t.right===null)break}r.right=t,r=t,t=t.right}else break}return r.right=t.left,o.left=t.right,t.left=n.right,t.right=n.left,t}function ot(i,t,e,n){var r=new z(i,t);if(e===null)return r.left=r.right=null,r;e=F(i,e,n);var o=n(i,e.key);return o<0?(r.left=e.left,r.right=e,e.left=null):o>=0&&(r.right=e.right,r.left=e,e.right=null),r}function Et(i,t,e){var n=null,r=null;if(t){t=F(i,t,e);var o=e(t.key,i);o===0?(n=t.left,r=t.right):o<0?(r=t.right,t.right=null,n=t):(n=t.left,t.left=null,r=t)}return{left:n,right:r}}function Jt(i,t,e){return t===null?i:(i===null||(t=F(i.key,t,e),t.left=i),t)}function st(i,t,e,n,r){if(i){n(""+t+(e?"└── ":"├── ")+r(i)+`
22
+ `);var o=t+(e?" ":"│ ");i.left&&st(i.left,o,!1,n,r),i.right&&st(i.right,o,!0,n,r)}}var lt=function(){function i(t){t===void 0&&(t=Wt),this._root=null,this._size=0,this._comparator=t}return i.prototype.insert=function(t,e){return this._size++,this._root=ot(t,e,this._root,this._comparator)},i.prototype.add=function(t,e){var n=new z(t,e);this._root===null&&(n.left=n.right=null,this._size++,this._root=n);var r=this._comparator,o=F(t,this._root,r),u=r(t,o.key);return u===0?this._root=o:(u<0?(n.left=o.left,n.right=o,o.left=null):u>0&&(n.right=o.right,n.left=o,o.right=null),this._size++,this._root=n),this._root},i.prototype.remove=function(t){this._root=this._remove(t,this._root,this._comparator)},i.prototype._remove=function(t,e,n){var r;if(e===null)return null;e=F(t,e,n);var o=n(t,e.key);return o===0?(e.left===null?r=e.right:(r=F(t,e.left,n),r.right=e.right),this._size--,r):e},i.prototype.pop=function(){var t=this._root;if(t){for(;t.left;)t=t.left;return this._root=F(t.key,this._root,this._comparator),this._root=this._remove(t.key,this._root,this._comparator),{key:t.key,data:t.data}}return null},i.prototype.findStatic=function(t){for(var e=this._root,n=this._comparator;e;){var r=n(t,e.key);if(r===0)return e;r<0?e=e.left:e=e.right}return null},i.prototype.find=function(t){return this._root&&(this._root=F(t,this._root,this._comparator),this._comparator(t,this._root.key)!==0)?null:this._root},i.prototype.contains=function(t){for(var e=this._root,n=this._comparator;e;){var r=n(t,e.key);if(r===0)return!0;r<0?e=e.left:e=e.right}return!1},i.prototype.forEach=function(t,e){for(var n=this._root,r=[],o=!1;!o;)n!==null?(r.push(n),n=n.left):r.length!==0?(n=r.pop(),t.call(e,n),n=n.right):o=!0;return this},i.prototype.range=function(t,e,n,r){for(var o=[],u=this._comparator,s=this._root,c;o.length!==0||s;)if(s)o.push(s),s=s.left;else{if(s=o.pop(),c=u(s.key,e),c>0)break;if(u(s.key,t)>=0&&n.call(r,s))return this;s=s.right}return this},i.prototype.keys=function(){var t=[];return this.forEach(function(e){var n=e.key;return t.push(n)}),t},i.prototype.values=function(){var t=[];return this.forEach(function(e){var n=e.data;return t.push(n)}),t},i.prototype.min=function(){return this._root?this.minNode(this._root).key:null},i.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},i.prototype.minNode=function(t){if(t===void 0&&(t=this._root),t)for(;t.left;)t=t.left;return t},i.prototype.maxNode=function(t){if(t===void 0&&(t=this._root),t)for(;t.right;)t=t.right;return t},i.prototype.at=function(t){for(var e=this._root,n=!1,r=0,o=[];!n;)if(e)o.push(e),e=e.left;else if(o.length>0){if(e=o.pop(),r===t)return e;r++,e=e.right}else n=!0;return null},i.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 o=r(t.key,e.key);if(o===0)break;o<0?(n=e,e=e.left):e=e.right}return n},i.prototype.prev=function(t){var e=this._root,n=null;if(t.left!==null){for(n=t.left;n.right;)n=n.right;return n}for(var r=this._comparator;e;){var o=r(t.key,e.key);if(o===0)break;o<0?e=e.left:(n=e,e=e.right)}return n},i.prototype.clear=function(){return this._root=null,this._size=0,this},i.prototype.toList=function(){return Ht(this._root)},i.prototype.load=function(t,e,n){e===void 0&&(e=[]),n===void 0&&(n=!1);var r=t.length,o=this._comparator;if(n&&ct(t,e,0,r-1,o),this._root===null)this._root=ut(t,e,0,r),this._size=r;else{var u=te(this.toList(),Kt(t,e),o);r=this._size+r,this._root=ft({head:u},0,r)}return this},i.prototype.isEmpty=function(){return this._root===null},Object.defineProperty(i.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),i.prototype.toString=function(t){t===void 0&&(t=function(n){return String(n.key)});var e=[];return st(this._root,"",!0,function(n){return e.push(n)},t),e.join("")},i.prototype.update=function(t,e,n){var r=this._comparator,o=Et(t,this._root,r),u=o.left,s=o.right;r(t,e)<0?s=ot(e,n,s,r):u=ot(e,n,u,r),this._root=Jt(u,s,r)},i.prototype.split=function(t){return Et(t,this._root,this._comparator)},i.prototype[Symbol.iterator]=function(){var t,e,n;return Zt(this,function(r){switch(r.label){case 0:t=this._root,e=[],n=!1,r.label=1;case 1:return n?[3,6]:t===null?[3,2]:(e.push(t),t=t.left,[3,5]);case 2:return e.length===0?[3,4]:(t=e.pop(),[4,t]);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]}})},i}();function ut(i,t,e,n){var r=n-e;if(r>0){var o=e+Math.floor(r/2),u=i[o],s=t[o],c=new z(u,s);return c.left=ut(i,t,e,o),c.right=ut(i,t,o+1,n),c}return null}function Kt(i,t){for(var e=new z(null,null),n=e,r=0;r<i.length;r++)n=n.next=new z(i[r],t[r]);return n.next=null,e.next}function Ht(i){for(var t=i,e=[],n=!1,r=new z(null,null),o=r;!n;)t?(e.push(t),t=t.left):e.length>0?(t=o=o.next=e.pop(),t=t.right):n=!0;return o.next=null,r.next}function ft(i,t,e){var n=e-t;if(n>0){var r=t+Math.floor(n/2),o=ft(i,t,r),u=i.head;return u.left=o,i.head=i.head.next,u.right=ft(i,r+1,e),u}return null}function te(i,t,e){for(var n=new z(null,null),r=n,o=i,u=t;o!==null&&u!==null;)e(o.key,u.key)<0?(r.next=o,o=o.next):(r.next=u,u=u.next),r=r.next;return o!==null?r.next=o:u!==null&&(r.next=u),n.next}function ct(i,t,e,n,r){if(!(e>=n)){for(var o=i[e+n>>1],u=e-1,s=n+1;;){do u++;while(r(i[u],o)<0);do s--;while(r(i[s],o)>0);if(u>=s)break;var c=i[u];i[u]=i[s],i[s]=c,c=t[u],t[u]=t[s],t[s]=c}ct(i,t,e,s,r),ct(i,t,s+1,n,r)}}const N=11102230246251565e-32,_=134217729,ee=(3+8*N)*N;function ht(i,t,e,n,r){let o,u,s,c,f=t[0],g=n[0],l=0,h=0;g>f==g>-f?(o=f,f=t[++l]):(o=g,g=n[++h]);let a=0;if(l<i&&h<e)for(g>f==g>-f?(u=f+o,s=o-(u-f),f=t[++l]):(u=g+o,s=o-(u-g),g=n[++h]),o=u,s!==0&&(r[a++]=s);l<i&&h<e;)g>f==g>-f?(u=o+f,c=u-o,s=o-(u-c)+(f-c),f=t[++l]):(u=o+g,c=u-o,s=o-(u-c)+(g-c),g=n[++h]),o=u,s!==0&&(r[a++]=s);for(;l<i;)u=o+f,c=u-o,s=o-(u-c)+(f-c),f=t[++l],o=u,s!==0&&(r[a++]=s);for(;h<e;)u=o+g,c=u-o,s=o-(u-c)+(g-c),g=n[++h],o=u,s!==0&&(r[a++]=s);return(o!==0||a===0)&&(r[a++]=o),a}function ne(i,t){let e=t[0];for(let n=1;n<i;n++)e+=t[n];return e}function G(i){return new Float64Array(i)}const ie=(3+16*N)*N,re=(2+12*N)*N,oe=(9+64*N)*N*N,U=G(4),mt=G(8),bt=G(12),_t=G(16),P=G(4);function se(i,t,e,n,r,o,u){let s,c,f,g,l,h,a,d,x,y,p,v,E,w,m,S,k,M;const I=i-r,$=e-r,A=t-o,O=n-o;w=I*O,h=_*I,a=h-(h-I),d=I-a,h=_*O,x=h-(h-O),y=O-x,m=d*y-(w-a*x-d*x-a*y),S=A*$,h=_*A,a=h-(h-A),d=A-a,h=_*$,x=h-(h-$),y=$-x,k=d*y-(S-a*x-d*x-a*y),p=m-k,l=m-p,U[0]=m-(p+l)+(l-k),v=w+p,l=v-w,E=w-(v-l)+(p-l),p=E-S,l=E-p,U[1]=E-(p+l)+(l-S),M=v+p,l=M-v,U[2]=v-(M-l)+(p-l),U[3]=M;let B=ne(4,U),H=re*u;if(B>=H||-B>=H||(l=i-I,s=i-(I+l)+(l-r),l=e-$,f=e-($+l)+(l-r),l=t-A,c=t-(A+l)+(l-o),l=n-O,g=n-(O+l)+(l-o),s===0&&c===0&&f===0&&g===0)||(H=oe*u+ee*Math.abs(B),B+=I*g+O*s-(A*f+$*c),B>=H||-B>=H))return B;w=s*O,h=_*s,a=h-(h-s),d=s-a,h=_*O,x=h-(h-O),y=O-x,m=d*y-(w-a*x-d*x-a*y),S=c*$,h=_*c,a=h-(h-c),d=c-a,h=_*$,x=h-(h-$),y=$-x,k=d*y-(S-a*x-d*x-a*y),p=m-k,l=m-p,P[0]=m-(p+l)+(l-k),v=w+p,l=v-w,E=w-(v-l)+(p-l),p=E-S,l=E-p,P[1]=E-(p+l)+(l-S),M=v+p,l=M-v,P[2]=v-(M-l)+(p-l),P[3]=M;const Ve=ht(4,U,4,P,mt);w=I*g,h=_*I,a=h-(h-I),d=I-a,h=_*g,x=h-(h-g),y=g-x,m=d*y-(w-a*x-d*x-a*y),S=A*f,h=_*A,a=h-(h-A),d=A-a,h=_*f,x=h-(h-f),y=f-x,k=d*y-(S-a*x-d*x-a*y),p=m-k,l=m-p,P[0]=m-(p+l)+(l-k),v=w+p,l=v-w,E=w-(v-l)+(p-l),p=E-S,l=E-p,P[1]=E-(p+l)+(l-S),M=v+p,l=M-v,P[2]=v-(M-l)+(p-l),P[3]=M;const Ge=ht(Ve,mt,4,P,bt);w=s*g,h=_*s,a=h-(h-s),d=s-a,h=_*g,x=h-(h-g),y=g-x,m=d*y-(w-a*x-d*x-a*y),S=c*f,h=_*c,a=h-(h-c),d=c-a,h=_*f,x=h-(h-f),y=f-x,k=d*y-(S-a*x-d*x-a*y),p=m-k,l=m-p,P[0]=m-(p+l)+(l-k),v=w+p,l=v-w,E=w-(v-l)+(p-l),p=E-S,l=E-p,P[1]=E-(p+l)+(l-S),M=v+p,l=M-v,P[2]=v-(M-l)+(p-l),P[3]=M;const Ze=ht(Ge,bt,4,P,_t);return _t[Ze-1]}function le(i,t,e,n,r,o){const u=(t-o)*(e-r),s=(i-r)*(n-o),c=u-s,f=Math.abs(u+s);return Math.abs(c)>=ie*f?c:-se(i,t,e,n,r,o,f)}const Z=(i,t)=>i.ll.x<=t.x&&t.x<=i.ur.x&&i.ll.y<=t.y&&t.y<=i.ur.y,at=(i,t)=>{if(t.ur.x<i.ll.x||i.ur.x<t.ll.x||t.ur.y<i.ll.y||i.ur.y<t.ll.y)return null;const e=i.ll.x<t.ll.x?t.ll.x:i.ll.x,n=i.ur.x<t.ur.x?i.ur.x:t.ur.x,r=i.ll.y<t.ll.y?t.ll.y:i.ll.y,o=i.ur.y<t.ur.y?i.ur.y:t.ur.y;return{ll:{x:e,y:r},ur:{x:n,y:o}}};let j=Number.EPSILON;j===void 0&&(j=Math.pow(2,-52));const ue=j*j,St=(i,t)=>{if(-j<i&&i<j&&-j<t&&t<j)return 0;const e=i-t;return e*e<ue*i*t?0:i<t?-1:1};class fe{constructor(){this.reset()}reset(){this.xRounder=new Mt,this.yRounder=new Mt}round(t,e){return{x:this.xRounder.round(t),y:this.yRounder.round(e)}}}class Mt{constructor(){this.tree=new lt,this.round(0)}round(t){const e=this.tree.add(t),n=this.tree.prev(e);if(n!==null&&St(e.key,n.key)===0)return this.tree.remove(t),n.key;const r=this.tree.next(e);return r!==null&&St(e.key,r.key)===0?(this.tree.remove(t),r.key):t}}const W=new fe,tt=(i,t)=>i.x*t.y-i.y*t.x,Pt=(i,t)=>i.x*t.x+i.y*t.y,Lt=(i,t,e)=>{const n=le(i.x,i.y,t.x,t.y,e.x,e.y);return n>0?-1:n<0?1:0},et=i=>Math.sqrt(Pt(i,i)),ce=(i,t,e)=>{const n={x:t.x-i.x,y:t.y-i.y},r={x:e.x-i.x,y:e.y-i.y};return tt(r,n)/et(r)/et(n)},he=(i,t,e)=>{const n={x:t.x-i.x,y:t.y-i.y},r={x:e.x-i.x,y:e.y-i.y};return Pt(r,n)/et(r)/et(n)},Rt=(i,t,e)=>t.y===0?null:{x:i.x+t.x/t.y*(e-i.y),y:e},kt=(i,t,e)=>t.x===0?null:{x:e,y:i.y+t.y/t.x*(e-i.x)},ae=(i,t,e,n)=>{if(t.x===0)return kt(e,n,i.x);if(n.x===0)return kt(i,t,e.x);if(t.y===0)return Rt(e,n,i.y);if(n.y===0)return Rt(i,t,e.y);const r=tt(t,n);if(r==0)return null;const o={x:e.x-i.x,y:e.y-i.y},u=tt(o,t)/r,s=tt(o,n)/r,c=i.x+s*t.x,f=e.x+u*n.x,g=i.y+s*t.y,l=e.y+u*n.y,h=(c+f)/2,a=(g+l)/2;return{x:h,y:a}};class R{static compare(t,e){const n=R.comparePoints(t.point,e.point);return n!==0?n:(t.point!==e.point&&t.link(e),t.isLeft!==e.isLeft?t.isLeft?1:-1:q.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){t.events===void 0?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 n=0,r=e.length;n<r;n++){const o=e[n];this.point.events.push(o),o.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(n.segment.consumedBy===void 0)for(let r=e+1;r<t;r++){const o=this.point.events[r];o.consumedBy===void 0&&n.otherSE.point.events===o.otherSE.point.events&&n.segment.consume(o.segment)}}}getAvailableLinkedEvents(){const t=[];for(let e=0,n=this.point.events.length;e<n;e++){const r=this.point.events[e];r!==this&&!r.segment.ringOut&&r.segment.isInResult()&&t.push(r)}return t}getLeftmostComparator(t){const e=new Map,n=r=>{const o=r.otherSE;e.set(r,{sine:ce(this.point,t.point,o.point),cosine:he(this.point,t.point,o.point)})};return(r,o)=>{e.has(r)||n(r),e.has(o)||n(o);const{sine:u,cosine:s}=e.get(r),{sine:c,cosine:f}=e.get(o);return u>=0&&c>=0?s<f?1:s>f?-1:0:u<0&&c<0?s<f?-1:s>f?1:0:c<u?-1:c>u?1:0}}}let ge=0;class q{static compare(t,e){const n=t.leftSE.point.x,r=e.leftSE.point.x,o=t.rightSE.point.x,u=e.rightSE.point.x;if(u<n)return 1;if(o<r)return-1;const s=t.leftSE.point.y,c=e.leftSE.point.y,f=t.rightSE.point.y,g=e.rightSE.point.y;if(n<r){if(c<s&&c<f)return 1;if(c>s&&c>f)return-1;const l=t.comparePoint(e.leftSE.point);if(l<0)return 1;if(l>0)return-1;const h=e.comparePoint(t.rightSE.point);return h!==0?h:-1}if(n>r){if(s<c&&s<g)return-1;if(s>c&&s>g)return 1;const l=e.comparePoint(t.leftSE.point);if(l!==0)return l;const h=t.comparePoint(e.rightSE.point);return h<0?1:h>0?-1:1}if(s<c)return-1;if(s>c)return 1;if(o<u){const l=e.comparePoint(t.rightSE.point);if(l!==0)return l}if(o>u){const l=t.comparePoint(e.rightSE.point);if(l<0)return 1;if(l>0)return-1}if(o!==u){const l=f-s,h=o-n,a=g-c,d=u-r;if(l>h&&a<d)return 1;if(l<h&&a>d)return-1}return o>u?1:o<u||f<g?-1:f>g?1:t.id<e.id?-1:t.id>e.id?1:0}constructor(t,e,n,r){this.id=++ge,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,o,u;const s=R.comparePoints(t,e);if(s<0)r=t,o=e,u=1;else if(s>0)r=e,o=t,u=-1;else throw new Error(`Tried to create degenerate segment at [${t.x}, ${t.y}]`);const c=new R(r,!0),f=new R(o,!1);return new q(c,f,[n],[u])}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 o=(t.y-e.y)/r.y,u=e.x+o*r.x;if(t.x===u)return 0;const s=(t.x-e.x)/r.x,c=e.y+s*r.y;return t.y===c?0:t.y<c?-1:1}getIntersection(t){const e=this.bbox(),n=t.bbox(),r=at(e,n);if(r===null)return null;const o=this.leftSE.point,u=this.rightSE.point,s=t.leftSE.point,c=t.rightSE.point,f=Z(e,s)&&this.comparePoint(s)===0,g=Z(n,o)&&t.comparePoint(o)===0,l=Z(e,c)&&this.comparePoint(c)===0,h=Z(n,u)&&t.comparePoint(u)===0;if(g&&f)return h&&!l?u:!h&&l?c:null;if(g)return l&&o.x===c.x&&o.y===c.y?null:o;if(f)return h&&u.x===s.x&&u.y===s.y?null:s;if(h&&l)return null;if(h)return u;if(l)return c;const a=ae(o,this.vector(),s,t.vector());return a===null||!Z(r,a)?null:W.round(a.x,a.y)}split(t){const e=[],n=t.events!==void 0,r=new R(t,!0),o=new R(t,!1),u=this.rightSE;this.replaceRightSE(o),e.push(o),e.push(r);const s=new q(r,u,this.rings.slice(),this.windings.slice());return R.comparePoints(s.leftSE.point,s.rightSE.point)>0&&s.swapEvents(),R.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),n&&(r.checkForConsuming(),o.checkForConsuming()),e}swapEvents(){const t=this.rightSE;this.rightSE=this.leftSE,this.leftSE=t,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(let e=0,n=this.windings.length;e<n;e++)this.windings[e]*=-1}consume(t){let e=this,n=t;for(;e.consumedBy;)e=e.consumedBy;for(;n.consumedBy;)n=n.consumedBy;const r=q.compare(e,n);if(r!==0){if(r>0){const o=e;e=n,n=o}if(e.prev===n){const o=e;e=n,n=o}for(let o=0,u=n.rings.length;o<u;o++){const s=n.rings[o],c=n.windings[o],f=e.rings.indexOf(s);f===-1?(e.rings.push(s),e.windings.push(c)):e.windings[f]+=c}n.rings=null,n.windings=null,n.consumedBy=e,n.leftSE.consumedBy=e.leftSE,n.rightSE.consumedBy=e.rightSE}}prevInResult(){return this._prevInResult!==void 0?this._prevInResult:(this.prev?this.prev.isInResult()?this._prevInResult=this.prev:this._prevInResult=this.prev.prevInResult():this._prevInResult=null,this._prevInResult)}beforeState(){if(this._beforeState!==void 0)return this._beforeState;if(!this.prev)this._beforeState={rings:[],windings:[],multiPolys:[]};else{const t=this.prev.consumedBy||this.prev;this._beforeState=t.afterState()}return this._beforeState}afterState(){if(this._afterState!==void 0)return this._afterState;const t=this.beforeState();this._afterState={rings:t.rings.slice(0),windings:t.windings.slice(0),multiPolys:[]};const e=this._afterState.rings,n=this._afterState.windings,r=this._afterState.multiPolys;for(let s=0,c=this.rings.length;s<c;s++){const f=this.rings[s],g=this.windings[s],l=e.indexOf(f);l===-1?(e.push(f),n.push(g)):n[l]+=g}const o=[],u=[];for(let s=0,c=e.length;s<c;s++){if(n[s]===0)continue;const f=e[s],g=f.poly;if(u.indexOf(g)===-1)if(f.isExterior)o.push(g);else{u.indexOf(g)===-1&&u.push(g);const l=o.indexOf(f.poly);l!==-1&&o.splice(l,1)}}for(let s=0,c=o.length;s<c;s++){const f=o[s].multiPoly;r.indexOf(f)===-1&&r.push(f)}return this._afterState}isInResult(){if(this.consumedBy)return!1;if(this._isInResult!==void 0)return this._isInResult;const t=this.beforeState().multiPolys,e=this.afterState().multiPolys;switch(C.type){case"union":{const n=t.length===0,r=e.length===0;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===C.numMultiPolys&&n<r;break}case"xor":{const n=Math.abs(t.length-e.length);this._isInResult=n%2===1;break}case"difference":{const n=r=>r.length===1&&r[0].isSubject;this._isInResult=n(t)!==n(e);break}default:throw new Error(`Unrecognized operation type found ${C.type}`)}return this._isInResult}}class Ct{constructor(t,e,n){if(!Array.isArray(t)||t.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=e,this.isExterior=n,this.segments=[],typeof t[0][0]!="number"||typeof t[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");const r=W.round(t[0][0],t[0][1]);this.bbox={ll:{x:r.x,y:r.y},ur:{x:r.x,y:r.y}};let o=r;for(let u=1,s=t.length;u<s;u++){if(typeof t[u][0]!="number"||typeof t[u][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");let c=W.round(t[u][0],t[u][1]);c.x===o.x&&c.y===o.y||(this.segments.push(q.fromRing(o,c,this)),c.x<this.bbox.ll.x&&(this.bbox.ll.x=c.x),c.y<this.bbox.ll.y&&(this.bbox.ll.y=c.y),c.x>this.bbox.ur.x&&(this.bbox.ur.x=c.x),c.y>this.bbox.ur.y&&(this.bbox.ur.y=c.y),o=c)}(r.x!==o.x||r.y!==o.y)&&this.segments.push(q.fromRing(o,r,this))}getSweepEvents(){const t=[];for(let e=0,n=this.segments.length;e<n;e++){const r=this.segments[e];t.push(r.leftSE),t.push(r.rightSE)}return t}}class pe{constructor(t,e){if(!Array.isArray(t))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new Ct(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 n=1,r=t.length;n<r;n++){const o=new Ct(t[n],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=e}getSweepEvents(){const t=this.exteriorRing.getSweepEvents();for(let e=0,n=this.interiorRings.length;e<n;e++){const r=this.interiorRings[e].getSweepEvents();for(let o=0,u=r.length;o<u;o++)t.push(r[o])}return t}}class It{constructor(t,e){if(!Array.isArray(t))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{typeof t[0][0][0]=="number"&&(t=[t])}catch{}this.polys=[],this.bbox={ll:{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY},ur:{x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY}};for(let n=0,r=t.length;n<r;n++){const o=new pe(t[n],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=e}getSweepEvents(){const t=[];for(let e=0,n=this.polys.length;e<n;e++){const r=this.polys[e].getSweepEvents();for(let o=0,u=r.length;o<u;o++)t.push(r[o])}return t}}class nt{static factory(t){const e=[];for(let n=0,r=t.length;n<r;n++){const o=t[n];if(!o.isInResult()||o.ringOut)continue;let u=null,s=o.leftSE,c=o.rightSE;const f=[s],g=s.point,l=[];for(;u=s,s=c,f.push(s),s.point!==g;)for(;;){const h=s.getAvailableLinkedEvents();if(h.length===0){const x=f[0].point,y=f[f.length-1].point;throw new Error(`Unable to complete output ring starting at [${x.x}, ${x.y}]. Last matching segment found ends at [${y.x}, ${y.y}].`)}if(h.length===1){c=h[0].otherSE;break}let a=null;for(let x=0,y=l.length;x<y;x++)if(l[x].point===s.point){a=x;break}if(a!==null){const x=l.splice(a)[0],y=f.splice(x.index);y.unshift(y[0].otherSE),e.push(new nt(y.reverse()));continue}l.push({index:f.length,point:s.point});const d=s.getLeftmostComparator(u);c=h.sort(d)[0].otherSE;break}e.push(new nt(f))}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 f=1,g=this.events.length-1;f<g;f++){const l=this.events[f].point,h=this.events[f+1].point;Lt(l,t,h)!==0&&(e.push(l),t=l)}if(e.length===1)return null;const n=e[0],r=e[1];Lt(n,t,r)===0&&e.shift(),e.push(e[0]);const o=this.isExteriorRing()?1:-1,u=this.isExteriorRing()?0:e.length-1,s=this.isExteriorRing()?e.length:-1,c=[];for(let f=u;f!=s;f+=o)c.push([e[f].x,e[f].y]);return c}isExteriorRing(){if(this._isExteriorRing===void 0){const t=this.enclosingRing();this._isExteriorRing=t?!t.isExteriorRing():!0}return this._isExteriorRing}enclosingRing(){return this._enclosingRing===void 0&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}_calcEnclosingRing(){let t=this.events[0];for(let r=1,o=this.events.length;r<o;r++){const u=this.events[r];R.compare(t,u)>0&&(t=u)}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 $t{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(t[0]===null)return null;for(let e=0,n=this.interiorRings.length;e<n;e++){const r=this.interiorRings[e].getGeom();r!==null&&t.push(r)}return t}}class ye{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 r=this.polys[e].getGeom();r!==null&&t.push(r)}return t}_composePolys(t){const e=[];for(let n=0,r=t.length;n<r;n++){const o=t[n];if(!o.poly)if(o.isExteriorRing())e.push(new $t(o));else{const u=o.enclosingRing();u.poly||e.push(new $t(u)),u.poly.addInterior(o)}}return e}}class de{constructor(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:q.compare;this.queue=t,this.tree=new lt(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 o=r,u=r,s,c;for(;s===void 0;)o=this.tree.prev(o),o===null?s=null:o.key.consumedBy===void 0&&(s=o.key);for(;c===void 0;)u=this.tree.next(u),u===null?c=null:u.key.consumedBy===void 0&&(c=u.key);if(t.isLeft){let f=null;if(s){const l=s.getIntersection(e);if(l!==null&&(e.isAnEndpoint(l)||(f=l),!s.isAnEndpoint(l))){const h=this._splitSafely(s,l);for(let a=0,d=h.length;a<d;a++)n.push(h[a])}}let g=null;if(c){const l=c.getIntersection(e);if(l!==null&&(e.isAnEndpoint(l)||(g=l),!c.isAnEndpoint(l))){const h=this._splitSafely(c,l);for(let a=0,d=h.length;a<d;a++)n.push(h[a])}}if(f!==null||g!==null){let l=null;f===null?l=g:g===null?l=f:l=R.comparePoints(f,g)<=0?f:g,this.queue.remove(e.rightSE),n.push(e.rightSE);const h=e.split(l);for(let a=0,d=h.length;a<d;a++)n.push(h[a])}n.length>0?(this.tree.remove(e),n.push(t)):(this.segments.push(e),e.prev=s)}else{if(s&&c){const f=s.getIntersection(c);if(f!==null){if(!s.isAnEndpoint(f)){const g=this._splitSafely(s,f);for(let l=0,h=g.length;l<h;l++)n.push(g[l])}if(!c.isAnEndpoint(f)){const g=this._splitSafely(c,f);for(let l=0,h=g.length;l<h;l++)n.push(g[l])}}}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),t.consumedBy===void 0&&this.tree.add(t),r}}const At=typeof process<"u"&&process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,xe=typeof process<"u"&&process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6;class ve{run(t,e,n){C.type=t,W.reset();const r=[new It(e,!0)];for(let l=0,h=n.length;l<h;l++)r.push(new It(n[l],!1));if(C.numMultiPolys=r.length,C.type==="difference"){const l=r[0];let h=1;for(;h<r.length;)at(r[h].bbox,l.bbox)!==null?h++:r.splice(h,1)}if(C.type==="intersection")for(let l=0,h=r.length;l<h;l++){const a=r[l];for(let d=l+1,x=r.length;d<x;d++)if(at(a.bbox,r[d].bbox)===null)return[]}const o=new lt(R.compare);for(let l=0,h=r.length;l<h;l++){const a=r[l].getSweepEvents();for(let d=0,x=a.length;d<x;d++)if(o.insert(a[d]),o.size>At)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big).")}const u=new de(o);let s=o.size,c=o.pop();for(;c;){const l=c.key;if(o.size===s){const a=l.segment;throw new Error(`Unable to pop() ${l.isLeft?"left":"right"} SweepEvent [${l.point.x}, ${l.point.y}] from segment #${a.id} [${a.leftSE.point.x}, ${a.leftSE.point.y}] -> [${a.rightSE.point.x}, ${a.rightSE.point.y}] from queue.`)}if(o.size>At)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big).");if(u.segments.length>xe)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments).");const h=u.process(l);for(let a=0,d=h.length;a<d;a++){const x=h[a];x.consumedBy===void 0&&o.insert(x)}s=o.size,c=o.pop()}W.reset();const f=nt.factory(u.segments);return new ye(f).getGeom()}}const C=new ve;var Ot={union:function(i){for(var t=arguments.length,e=new Array(t>1?t-1:0),n=1;n<t;n++)e[n-1]=arguments[n];return C.run("union",i,e)},intersection:function(i){for(var t=arguments.length,e=new Array(t>1?t-1:0),n=1;n<t;n++)e[n-1]=arguments[n];return C.run("intersection",i,e)},xor:function(i){for(var t=arguments.length,e=new Array(t>1?t-1:0),n=1;n<t;n++)e[n-1]=arguments[n];return C.run("xor",i,e)},difference:function(i){for(var t=arguments.length,e=new Array(t>1?t-1:0),n=1;n<t;n++)e[n-1]=arguments[n];return C.run("difference",i,e)}};function Nt(i,t,e){if(i!==null)for(var n,r,o,u,s,c,f,g=0,l=0,h,a=i.type,d=a==="FeatureCollection",x=a==="Feature",y=d?i.features.length:1,p=0;p<y;p++){f=d?i.features[p].geometry:x?i.geometry:i,h=f?f.type==="GeometryCollection":!1,s=h?f.geometries.length:1;for(var v=0;v<s;v++){var E=0,w=0;if(u=h?f.geometries[v]:f,u!==null){c=u.coordinates;var m=u.type;switch(g=0,m){case null:break;case"Point":if(t(c,l,p,E,w)===!1)return!1;l++,E++;break;case"LineString":case"MultiPoint":for(n=0;n<c.length;n++){if(t(c[n],l,p,E,w)===!1)return!1;l++,m==="MultiPoint"&&E++}m==="LineString"&&E++;break;case"Polygon":case"MultiLineString":for(n=0;n<c.length;n++){for(r=0;r<c[n].length-g;r++){if(t(c[n][r],l,p,E,w)===!1)return!1;l++}m==="MultiLineString"&&E++,m==="Polygon"&&w++}m==="Polygon"&&E++;break;case"MultiPolygon":for(n=0;n<c.length;n++){for(w=0,r=0;r<c[n].length;r++){for(o=0;o<c[n][r].length-g;o++){if(t(c[n][r][o],l,p,E,w)===!1)return!1;l++}w++}E++}break;case"GeometryCollection":for(n=0;n<u.geometries.length;n++)if(Nt(u.geometries[n],t)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function gt(i,t){var e,n,r,o,u,s,c,f,g,l,h=0,a=i.type==="FeatureCollection",d=i.type==="Feature",x=a?i.features.length:1;for(e=0;e<x;e++){for(s=a?i.features[e].geometry:d?i.geometry:i,f=a?i.features[e].properties:d?i.properties:{},g=a?i.features[e].bbox:d?i.bbox:void 0,l=a?i.features[e].id:d?i.id:void 0,c=s?s.type==="GeometryCollection":!1,u=c?s.geometries.length:1,r=0;r<u;r++){if(o=c?s.geometries[r]:s,o===null){if(t(null,h,f,g,l)===!1)return!1;continue}switch(o.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(t(o,h,f,g,l)===!1)return!1;break}case"GeometryCollection":{for(n=0;n<o.geometries.length;n++)if(t(o.geometries[n],h,f,g,l)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}h++}}function we(i,t){gt(i,function(e,n,r,o,u){var s=e===null?null:e.type;switch(s){case null:case"Point":case"LineString":case"Polygon":return t(b(e,r,{bbox:o,id:u}),n,0)===!1?!1:void 0}var c;switch(s){case"MultiPoint":c="Point";break;case"MultiLineString":c="LineString";break;case"MultiPolygon":c="Polygon";break}for(var f=0;f<e.coordinates.length;f++){var g=e.coordinates[f],l={type:c,coordinates:g};if(t(b(l,r),n,f)===!1)return!1}})}function Ee(i,t={}){const e=[];if(gt(i,r=>{e.push(r.coordinates)}),e.length<2)throw new Error("Must have at least 2 geometries");const n=Ot.union(e[0],...e.slice(1));return n.length===0?null:n.length===1?T(n[0],t.properties):wt(n,t.properties)}var Bt=Ee;function J(){}function Tt(i){return i()}function zt(){return Object.create(null)}function it(i){i.forEach(Tt)}function Ft(i){return typeof i=="function"}function me(i,t){return i!=i?t==t:i!==t||i&&typeof i=="object"||typeof i=="function"}function be(i){return Object.keys(i).length===0}function _e(i,t){i.appendChild(t)}function Se(i,t,e){i.insertBefore(t,e||null)}function jt(i){i.parentNode&&i.parentNode.removeChild(i)}function qt(i){return document.createElementNS("http://www.w3.org/2000/svg",i)}function Q(i,t,e){e==null?i.removeAttribute(t):i.getAttribute(t)!==e&&i.setAttribute(t,e)}function Me(i){return Array.from(i.childNodes)}function rt(i,t,e){i.classList.toggle(t,!!e)}let pt;function K(i){pt=i}const Y=[],Qt=[];let D=[];const Ut=[],Pe=Promise.resolve();let yt=!1;function Le(){yt||(yt=!0,Pe.then(Yt))}function dt(i){D.push(i)}const xt=new Set;let X=0;function Yt(){if(X!==0)return;const i=pt;do{try{for(;X<Y.length;){const t=Y[X];X++,K(t),Re(t.$$)}}catch(t){throw Y.length=0,X=0,t}for(K(null),Y.length=0,X=0;Qt.length;)Qt.pop()();for(let t=0;t<D.length;t+=1){const e=D[t];xt.has(e)||(xt.add(e),e())}D.length=0}while(Y.length);for(;Ut.length;)Ut.pop()();yt=!1,xt.clear(),K(i)}function Re(i){if(i.fragment!==null){i.update(),it(i.before_update);const t=i.dirty;i.dirty=[-1],i.fragment&&i.fragment.p(i.ctx,t),i.after_update.forEach(dt)}}function ke(i){const t=[],e=[];D.forEach(n=>i.indexOf(n)===-1?t.push(n):e.push(n)),e.forEach(n=>n()),D=t}const Ce=new Set;function Ie(i,t){i&&i.i&&(Ce.delete(i),i.i(t))}function $e(i,t,e){const{fragment:n,after_update:r}=i.$$;n&&n.m(t,e),dt(()=>{const o=i.$$.on_mount.map(Tt).filter(Ft);i.$$.on_destroy?i.$$.on_destroy.push(...o):it(o),i.$$.on_mount=[]}),r.forEach(dt)}function Ae(i,t){const e=i.$$;e.fragment!==null&&(ke(e.after_update),it(e.on_destroy),e.fragment&&e.fragment.d(t),e.on_destroy=e.fragment=null,e.ctx=[])}function Oe(i,t){i.$$.dirty[0]===-1&&(Y.push(i),Le(),i.$$.dirty.fill(0)),i.$$.dirty[t/31|0]|=1<<t%31}function Ne(i,t,e,n,r,o,u=null,s=[-1]){const c=pt;K(i);const f=i.$$={fragment:null,ctx:[],props:o,update:J,not_equal:r,bound:zt(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(t.context||(c?c.$$.context:[])),callbacks:zt(),dirty:s,skip_bound:!1,root:t.target||c.$$.root};u&&u(f.root);let g=!1;if(f.ctx=e?e(i,t.props||{},(l,h,...a)=>{const d=a.length?a[0]:h;return f.ctx&&r(f.ctx[l],f.ctx[l]=d)&&(!f.skip_bound&&f.bound[l]&&f.bound[l](d),g&&Oe(i,l)),h}):[],f.update(),g=!0,it(f.before_update),f.fragment=n?n(f.ctx):!1,t.target){if(t.hydrate){const l=Me(t.target);f.fragment&&f.fragment.l(l),l.forEach(jt)}else f.fragment&&f.fragment.c();t.intro&&Ie(i.$$.fragment),$e(i,t.target,t.anchor),Yt()}K(c)}class Be{constructor(){vt(this,"$$");vt(this,"$$set")}$destroy(){Ae(this,1),this.$destroy=J}$on(t,e){if(!Ft(e))return J;const n=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return n.push(e),()=>{const r=n.indexOf(e);r!==-1&&n.splice(r,1)}}$set(t){this.$$set&&!be(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const Te="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Te);function ze(i){let t,e,n;return{c(){t=qt("svg"),e=qt("path"),Q(e,"stroke-width","4"),Q(e,"d","M 5,33.103579 C 5,17.607779 18.457,5 35,5 C 51.543,5 65,17.607779 65,33.103579 C 65,56.388679 40.4668,76.048179 36.6112,79.137779 C 36.3714,79.329879 36.2116,79.457979 36.1427,79.518879 C 35.8203,79.800879 35.4102,79.942779 35,79.942779 C 34.5899,79.942779 34.1797,79.800879 33.8575,79.518879 C 33.7886,79.457979 33.6289,79.330079 33.3893,79.138079 C 29.5346,76.049279 5,56.389379 5,33.103579 Z M 35.0001,49.386379 C 43.1917,49.386379 49.8323,42.646079 49.8323,34.331379 C 49.8323,26.016779 43.1917,19.276479 35.0001,19.276479 C 26.8085,19.276479 20.1679,26.016779 20.1679,34.331379 C 20.1679,42.646079 26.8085,49.386379 35.0001,49.386379 Z"),Q(e,"class","svelte-gzo3ar"),Q(t,"width",n=i[0]==="list"?20:void 0),Q(t,"viewBox","0 0 70 85"),Q(t,"fill","none"),Q(t,"class","svelte-gzo3ar"),rt(t,"in-map",i[0]!=="list"),rt(t,"list-icon",i[0]==="list")},m(r,o){Se(r,t,o),_e(t,e)},p(r,[o]){o&1&&n!==(n=r[0]==="list"?20:void 0)&&Q(t,"width",n),o&1&&rt(t,"in-map",r[0]!=="list"),o&1&&rt(t,"list-icon",r[0]==="list")},i:J,o:J,d(r){r&&jt(t)}}}function Fe(i,t,e){let{displayIn:n}=t;return i.$$set=r=>{"displayIn"in r&&e(0,n=r.displayIn)},[n]}class je extends Be{constructor(t){super(),Ne(this,t,Fe,ze,me,{displayIn:0})}}function qe(i,t={}){if(i.bbox!=null&&t.recompute!==!0)return i.bbox;const e=[1/0,1/0,-1/0,-1/0];return Nt(i,n=>{e[0]>n[0]&&(e[0]=n[0]),e[1]>n[1]&&(e[1]=n[1]),e[2]<n[0]&&(e[2]=n[0]),e[3]<n[1]&&(e[3]=n[1])}),e}var Dt=qe;function Qe(i){const t=[];if(gt(i,r=>{t.push(r.coordinates)}),t.length<2)throw new Error("Must have at least two features");const e=i.features[0].properties||{},n=Ot.difference(t[0],...t.slice(1));return n.length===0?null:n.length===1?T(n[0],e):wt(n,e)}var Ue=Qe;function Ye(i){if(!i)throw new Error("geojson is required");var t=[];return we(i,function(e){t.push(e)}),V(t)}var De=Ye;function Xt(i){const t=[...i];return t[2]<t[0]&&(Math.abs((t[0]+t[2]+360)/2)>Math.abs((t[0]-360+t[2])/2)?t[0]-=360:t[2]+=360),t}function Vt(i,t){const e=Ue(V([T([[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]]]),i]));if(!e)return;e.properties={isMask:!0};const n=Xt(Dt(i)),r=(n[2]-n[0])/360/1e3,o=n[0]<-180,u=n[2]>180,s=De(i);if(s.features.length>1&&(o||u))for(const c of s.features){const f=Xt(Dt(c));if(u&&f[0]<-180+r)for(const g of c.geometry.coordinates)for(const l of g)l[0]+=360-r;if(o&&f[2]>180-r)for(const g of c.geometry.coordinates)for(const l of g)l[0]-=360-r}t(V([s.features.length<2?i:Bt(s)??i,e]))}const Gt=V([]);function Xe(i,t,e=!0,n=!0,r={},o={},u={fill:{paint:{"fill-color":"#000","fill-opacity":.1},filter:["all",["==",["geometry-type"],"Polygon"],["has","isMask"]]},line:{layout:{"line-cap":"square"},paint:{"line-width":["case",["==",["geometry-type"],"Polygon"],2,3],"line-dasharray":[1,1],"line-color":"#3170fe"},filter:["!",["has","isMask"]]}}){let s;const c=[];let f,g,l;function h(){!i.getSource("full-geom")&&(u!=null&&u.fill||u!=null&&u.line)&&i.addSource("full-geom",{type:"geojson",data:Gt}),!i.getLayer("full-geom-fill")&&(u!=null&&u.fill)&&i.addLayer({...u==null?void 0:u.fill,id:"full-geom-fill",type:"fill",source:"full-geom"}),!i.getLayer("full-geom-line")&&(u!=null&&u.line)&&i.addLayer({...u==null?void 0:u.line,id:"full-geom-line",type:"line",source:"full-geom"}),l&&x(l)}i.loaded()?h():i.once("load",()=>{h()}),i.on("styledata",()=>{h()});const a=y=>{s==null||s({type:"mapClick",coordinates:[y.lngLat.lng,y.lngLat.lat]})};function d(y=!1){if(!t)throw new Error;const p=document.createElement("div");return y&&p.classList.add("marker-interactive"),new je({props:{displayIn:"maplibre"},target:p}),new t.Marker({element:p,offset:[1,-13]})}function x(y){var p;l=y,y&&((p=i.getSource("full-geom"))==null||p.setData(y))}return{setEventHandler(y){y?(s=y,i.on("click",a)):(s=void 0,i.off("click",a))},flyTo(y,p){i.flyTo({center:y,...p?{zoom:p}:{},...r})},fitBounds(y,p,v){i.fitBounds([[y[0],y[1]],[y[2],y[3]]],{padding:p,...v?{maxZoom:v}:{},...o})},indicateReverse(y){i.getCanvasContainer().style.cursor=y?"crosshair":""},setReverseMarker(y){!t||!e||(g?y?g.setLngLat(y):(g.remove(),g=void 0):y&&(g=(typeof e=="object"?new t.Marker(e):d()).setLngLat(y).addTo(i),g.getElement().classList.add("marker-reverse")))},setMarkers(y,p){if(e){for(const v of c)v.remove();if(c.length=0,x(Gt),!!t){if(p){let v=!1;if(p.geometry.type==="GeometryCollection"){const E=p.geometry.geometries.filter(w=>w.type==="Polygon"||w.type==="MultiPolygon");t:if(E.length>0){const w=Bt(V(E.map(m=>b(m))));if(!w)break t;Vt({...p,geometry:w.geometry},x),v=!0}else{const w=p.geometry.geometries.filter(m=>m.type==="LineString"||m.type==="MultiLineString");w.length>0&&(x({...p,geometry:{type:"GeometryCollection",geometries:w}}),v=!0)}}if(!v){if(p.geometry.type==="Polygon"||p.geometry.type==="MultiPolygon")Vt(p,x);else if(p.geometry.type==="LineString"||p.geometry.type==="MultiLineString"){x(p);return}}e&&c.push((typeof e=="object"?new t.Marker(e):d()).setLngLat(p.center).addTo(i))}if(n)for(const v of y??[]){if(v===p)continue;const E=(typeof n=="object"?new t.Marker(n):d(!0)).setLngLat(v.center).setPopup(new t.Popup({offset:[1,-27],closeButton:!1,closeOnMove:!0,className:"maptiler-gc-popup"}).setText(v.place_type[0]==="reverse"?v.place_name:v.place_name.replace(/,.*/,""))).addTo(i),w=E.getElement();w.addEventListener("click",m=>{m.stopPropagation(),s==null||s({type:"markerClick",id:v.id})}),w.addEventListener("mouseenter",()=>{s==null||s({type:"markerMouseEnter",id:v.id}),E.togglePopup()}),w.addEventListener("mouseleave",()=>{s==null||s({type:"markerMouseLeave",id:v.id}),E.togglePopup()}),c.push(E)}}}},setSelectedMarker(y){f&&f.getElement().classList.toggle("marker-selected",!1),f=y>-1?c[y]:void 0,f==null||f.getElement().classList.toggle("marker-selected",!0)},getCenterAndZoom(){const y=i.getCenter();return[i.getZoom(),y.lng,y.lat]}}}L.createMapLibreGlMapController=Xe,Object.defineProperty(L,Symbol.toStringTag,{value:"Module"})});
32
23
  //# sourceMappingURL=maplibregl-controller.umd.js.map