@aibee/crc-bmap 0.0.98 → 0.0.99

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/bmap.min.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";(()=>{var Ye=Object.create;var Yt=Object.defineProperty;var Ze=Object.getOwnPropertyDescriptor;var Ke=Object.getOwnPropertyNames;var Je=Object.getPrototypeOf,$e=Object.prototype.hasOwnProperty;var g=(i=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(i,{get:(n,t)=>(typeof require<"u"?require:n)[t]}):i)(function(i){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+i+'" is not supported')});var Zt=(i,n)=>()=>(n||i((n={exports:{}}).exports,n),n.exports);var Qe=(i,n,t,e)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of Ke(n))!$e.call(i,r)&&r!==t&&Yt(i,r,{get:()=>n[r],enumerable:!(e=Ze(n,r))||e.enumerable});return i};var tn=(i,n,t)=>(t=i!=null?Ye(Je(i)):{},Qe(n||!i||!i.__esModule?Yt(t,"default",{value:i,enumerable:!0}):t,i));var Oe=Zt((ts,De)=>{De.exports=function(n,t){return n[0]=t[0],n[1]=t[1],n}});var Be=Zt((es,Ue)=>{var Fe=Oe();Ue.exports=function(i,n){Array.isArray(n)||(n=[]),i.length>0&&n.push(Fe([0,0],i[0]));for(var t=0;t<i.length-1;t++){var e=i[t],r=i[t+1],o=e[0],s=e[1],u=r[0],l=r[1],a=[.75*o+.25*u,.75*s+.25*l],h=[.25*o+.75*u,.25*s+.75*l];n.push(a),n.push(h)}return i.length>1&&n.push(Fe([0,0],i[i.length-1])),n}});var Bt=g("three");var U=class{tasks={requestAnimation:new Set,timeout:new Set,interval:new Set};requestAnimationFrame(n){let t=window.requestAnimationFrame(()=>{this.tasks.requestAnimation.delete(t),n()});return this.tasks.requestAnimation.add(t),t}cancelAnimationFrame(n){this.tasks.requestAnimation.delete(n),window.cancelAnimationFrame(n)}setTimeout(n,t){let e=window.setTimeout(()=>{this.tasks.timeout.delete(e),n()},t);return this.tasks.timeout.add(e),e}clearTimeout(n){this.tasks.timeout.delete(n),window.clearTimeout(n)}setInterval(n,t){let e=window.setInterval(()=>{this.tasks.interval.delete(e),n()},t);return this.tasks.interval.add(e),e}clearInterval(n){this.tasks.interval.delete(n),window.clearInterval(n)}dispose(){this.tasks.requestAnimation.forEach(n=>{window.cancelAnimationFrame(n)}),this.tasks.requestAnimation.clear(),this.tasks.timeout.forEach(n=>{window.clearTimeout(n)}),this.tasks.timeout.clear(),this.tasks.interval.forEach(n=>{window.clearInterval(n)}),this.tasks.interval.clear()}};var S=g("three"),Kt=g("three/examples/jsm/controls/MapControls");function Jt(){let i=new S.Scene;return i.background=new S.Color(16777215),i}function $t(){let i=new S.WebGLRenderer({antialias:!0});return i.autoClear=!0,i.setClearAlpha(1),i.setClearColor(16777215),i.setPixelRatio(window.devicePixelRatio),i.shadowMap.enabled=!0,i.shadowMap.autoUpdate=!0,i.shadowMap.type=S.PCFSoftShadowMap,i}function Qt(i,n){let t=new S.OrthographicCamera(-i/2,i/2,n/2,-n/2,-1e3,5e3);return t.up.set(0,0,1),t.position.set(0,0,100),t.lookAt(0,0,0),t}function te(){let i=new S.Group,n=new S.AmbientLight(16777215,2.6);return i.add(n),i}function ee(i,n){let t=new Kt.MapControls(i,n);return t.enableDamping=!1,t.zoomSpeed=2,t}function ne(i,n=[]){let t=new S.Shape(i.map(e=>new S.Vector2(...e)));return n.length&&n.forEach(e=>{var r=new S.Path(e.map(o=>new S.Vector2(...o)));t.holes.push(r)}),t}function re(i=16777215,n=1){let t=new S.DirectionalLight(i,n);return t.castShadow=!0,t.shadow.radius=8,t.shadow.bias=-.001,t.shadow.mapSize.set(256,256),t.shadow.camera.left=-200,t.shadow.camera.right=200,t.shadow.camera.top=200,t.shadow.camera.bottom=-200,t}function z(i,n){if(n&&i.children&&i.children.length&&i.children.forEach(t=>{z(t,n)}),i.isMesh){let t=i;t.geometry&&t.geometry.dispose(),t.material&&(Array.isArray(t.material)?t.material.forEach(e=>{e.dispose()}):t.material.dispose())}i.isLight&&i.dispose?.()}function ie(i){return/[\u4E00-\u9FA5]+/g.test(i)}var W=g("three");var lt=new Map;function en(){let i=document.createElement("canvas");i.width=1024,i.height=64;let n=i.getContext("2d",{willReadFrequently:!0});return n.font="54px sans-serif",n.textBaseline="hanging",n.lineWidth=12,n.fillStyle="rgba(0,0,0,1)",n.strokeStyle="white",{canvas:i,ctx:n}}var zt,H;function nn(){if(!zt){let{canvas:i,ctx:n}=en();zt=i,H=n}}function Sn(i){if(lt.has(i))return lt.get(i);nn(),H.clearRect(0,0,1024,64);let n=ie(i)?4:8;H.strokeText(i,2,n),H.fillText(i,2,n);let t=Math.ceil(H.measureText(i).width);t=t%2===0?t:t+1,t+=2;let e=H.getImageData(0,0,t,64),r=new W.DataTexture(Uint8Array.from(e.data),t,64,W.RGBAFormat);return r.flipY=!0,r.minFilter=W.LinearFilter,r.magFilter=W.LinearFilter,lt.set(i,r),r}function oe(){lt.clear()}function se(){H=null,zt=null}var ut=g("three"),K=g("@turf/turf");function y(i,n,t,e){let r=i.clone().project(n),o=t/2,s=e/2,u=Math.round(r.x*o+o),l=Math.round(-r.y*s+s);return{x:u,y:l}}function kt(i){let n=(0,K.featureCollection)(i.map(e=>(0,K.point)(e)));return(0,K.center)(n).geometry.coordinates}function ht(i,n,t){return i.x>=n.x&&i.x<=t.x&&i.y>=n.y&&i.y<=t.y}function Tn(i){let n=0,t=new ut.Vector3;for(let e=1;e<i.length;e++){let r=new ut.Vector3(i[e-1][0],i[e-1][1],0),o=new ut.Vector3(i[e][0],i[e][1],0),s=o.distanceTo(r);s>n&&(n=s,t=o.clone().sub(r).normalize())}return t}function rn(i,n){return Math.sqrt((n[0]-i[0])**2+(n[1]-i[1])**2)}function ae(i){let n=0;for(let t=0;t<i.length-1;t++)n+=rn(i[t],i[t+1]);return n}function ct(i,n){return new Proxy(i,{get:(t,e,r)=>Reflect.get(t,e,r),set:(t,e,r,o)=>{let s=Reflect.get(t,e,o),u=Reflect.set(t,e,r,o);return s!==r&&n.dispatchEvent({type:`change-${e}`,value:r}),u}})}function X(i,n){return Promise.race([i,new Promise((t,e)=>{setTimeout(()=>e(new Error("Promise timeout")),n)})])}function pt(i){return document.createElementNS("http://www.w3.org/2000/svg",i)}function le(i,n){let t=pt("svg");return t.setAttribute("width",i),t.setAttribute("height",n),t.style.cssText="position: absolute; left: 0; top: 0; pointer-events: none;",t}function et(i="2",n){let t=pt("circle");return t.setAttribute("r",i),t.setAttribute("fill",n),t}function ft(i){let n=pt("line");return n.setAttribute("stroke",i),n}function J(i,n){let t=pt("rect");return t.setAttribute("stroke",i),t.setAttribute("fill",n),t}function q(i,n,t){i.setAttribute("cx",`${n}`),i.setAttribute("cy",`${t}`)}function D(i,n,t){n&&(i.setAttribute("x1",`${n.x}`),i.setAttribute("y1",`${n.y}`)),t&&(i.setAttribute("x2",`${t.x}`),i.setAttribute("y2",`${t.y}`))}function O(i,n,t,e,r){i.setAttribute("x",`${n}`),i.setAttribute("y",`${t}`),i.setAttribute("width",`${e}`),i.setAttribute("height",`${r}`)}function ue(){return Promise.resolve()}function In(){return new Promise(i=>{requestAnimationFrame(i)})}function Nn(i){return parseInt(i.replace("#","0x"),16)}function Dn(i,n){let t=parseInt(i.substring(1,3),16),e=parseInt(i.substring(3,5),16),r=parseInt(i.substring(5,7),16),o=Math.round(t*n),s=Math.round(e*n),u=Math.round(r*n);return`#${(1<<24|o<<16|s<<8|u).toString(16).slice(1)}`}function dt(i,n=.85){let t,e,r;if(i.startsWith("#"))t=parseInt(i.substring(1,3),16),e=parseInt(i.substring(3,5),16),r=parseInt(i.substring(5,7),16);else{let s=i.slice(4,-1).split(",");t=parseInt(s[0].trim()),e=parseInt(s[1].trim()),r=parseInt(s[2].trim())}return t=Math.min(Math.floor(t*n),255),e=Math.min(Math.floor(e*n),255),r=Math.min(Math.floor(r*n),255),"#"+((1<<24)+(t<<16)+(e<<8)+r).toString(16).slice(1)}var he=g("three/examples/jsm/loaders/GLTFLoader");function on(){return new he.GLTFLoader}var gt=null,mt=new Map;function ce(i){if(mt.has(i)){let t=mt.get(i).then(e=>(e.scene=e.scene.clone(),e))}gt||(gt=on());let n=new Promise((t,e)=>{gt.load(i,r=>{t(r)},void 0,e)});return mt.set(i,n),n.then(t=>(t.scene=t.scene.clone(),t))}function pe(){gt=null,mt.clear()}var yt=navigator.userAgent.toUpperCase().indexOf("MAC")>=0;function Vt(i){return yt?i==="Meta":i==="Control"}var Ht="__once__",fe=class{events=new Map;on(n,t){if(typeof t!="function")return;let e=this.events.get(n);return e?e.add(t):this.events.set(n,new Set([t]))}once(n,t){if(typeof t!="function")return;let e=`${Ht}${n}`,r=this.events.get(e);return r?r.add(t):this.events.set(e,new Set([t]))}off(n,t){let e=this.events.get(n),r=this.events.get(`${Ht}${n}`);!e&&!r||(t===void 0&&(e?.clear(),r?.clear()),e?.has(t)&&e.delete(t),r?.has(t)&&r.delete(t))}offAll(){this.events.clear()}emit(n,...t){let e=this.events.get(n),r=this.events.get(`${Ht}${n}`);!e&&!r||(e?.forEach(o=>{typeof o=="function"&&o(...t)}),r?.forEach(o=>{typeof o=="function"&&o(...t)}),r?.clear())}};var nt=(t=>(t.SWITCH_FLOOR_BEFORE="switch_floor_before",t.SWITCH_FLOOR_AFTER="switch_floor_after",t))(nt||{});function F(i){return Object.keys(i).sort().map(n=>`${n}=${i[n]}`).join("&")}function Wn(i,n){return new Promise((t,e)=>{let r=new XMLHttpRequest;r.open("GET",i,!0),Object.keys(n.headers||{}).forEach(o=>{r.setRequestHeader(o,n.headers[o])}),r.onload=()=>{if(r.status>=200&&r.status<300)try{let o=JSON.parse(r.responseText);t(o)}catch(o){e(o)}else e(r.statusText)},r.onerror=()=>{e(r.statusText)},r.send()})}var _t=class i{keySet=new Set;static createKey(){return Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)}genUniqueKey(){let n=i.createKey();for(;this.keySet.has(n);)n=i.createKey();return n}removeKey(n){this.keySet.delete(n)}dispose(){this.keySet.clear()}};var E=g("three"),Z=g("@tweenjs/tween.js");var Ee=g("three");var _=g("three");var sn={id:"",height:.1,airHeight:0,area:0,group:"",fillColor:"#EFF4FB",strokeColor:"#ffffff",fillOpacity:1,strokeOpacity:1,strokeWidth:1,doors:[],locked:!1,visible:!0,geometry:{type:"polygon",cds:[],coords:[],curveCpt:[],curveIndex:[]},layerType:"",zIndex:0,stroke:!0,deltaHeight:0,userData:{},gradualColor:[],renderType:"single",colorFactor:.9},I=class extends _.Object3D{constructor(t,e){super();this.context=t;if(this.options=ct({...sn,...e},this),this.options.geometry.type==="point"){let[r,o]=this.options.geometry.coords;return this.position.set(r,o,this.options.height+this.options.airHeight),this}this.init(),this.visible=this.options.visible,this.addEventListener("change-fillColor",({value:r})=>{this.initMaterial(),this.initMesh()}),this.addEventListener("change-fillOpacity",({value:r})=>{this.initMaterial(),this.initMesh()}),this.addEventListener("change-height",({value:r})=>{this.dispose(),this.init()}),this.addEventListener("change-strokeColor",({value:r})=>{this.options.stroke&&(this.initLineMaterial(),this.createBorder())}),this.addEventListener("change-strokeOpacity",({value:r})=>{this.options.stroke&&(this.initLineMaterial(),this.createBorder())}),this.addEventListener("change-airHeight",({value:r})=>{this.position.z=r}),this.addEventListener("change-visible",({value:r})=>{this.visible=r}),this.addEventListener("change-stroke",({value:r})=>{if(r){if(this.line)return;this.initLineGeometry(),this.initLineMaterial(),this.createBorder()}else this.line&&(this.remove(this.line),this.lineGeometry?.dispose())}),this.addEventListener("change-renderType",()=>{this.initMaterial(),this.initMesh()}),this.addEventListener("change-gradualColor",()=>{this.initMaterial(),this.initMesh()})}geometry;material;mesh;line;lineMaterial;lineGeometry;options;getCenter(){if(this.options.geometry.type==="point")return this.position.clone();let t=new _.Vector3,e=new _.Box3;return e.setFromObject(this),e.getCenter(t),t}getSize(){if(this.options.geometry.type==="point")return new _.Vector3(0,0,0);let t=new _.Box3,e=new _.Vector3;return t.setFromObject(this),t.getSize(e),e}getPosition(){let t=this.getCenter();return t.setZ(t.z+this.options.height/2),t}init(){this.geometry=this.initGeometry(),this.initMaterial(),this.initMesh(),this.mesh.position.z=this.options.airHeight+this.options.deltaHeight,this.options.stroke&&(this.initLineMaterial(),this.initLineGeometry(),this.createBorder())}initGeometry(){let t=ne(this.options.geometry.coords[0],this.options.geometry.coords.slice(1));return new _.ExtrudeGeometry(t,{steps:1,bevelEnabled:!1,depth:this.options.height,curveSegments:4})}initSingleMaterial(){let t=this.context.materialFactory.createMeshBasicMaterial({color:this.options.fillColor,opacity:this.options.fillOpacity});if(this.options.height<=.1)return this.material=t,t;let e=this.context.materialFactory.createMeshBasicMaterial({color:dt(this.options.fillColor),opacity:this.options.fillOpacity});return this.material=[t,e],[t,e]}getMaxAndMin(t,e){let r=new _.Box3().setFromObject(this),o=t.clone().add(e.clone().multiplyScalar(1e3)),s=new _.Ray(o,e.clone().multiplyScalar(-1)),u=new _.Vector3;s.intersectBox(r,u);let l=t.clone().add(e.clone().multiplyScalar(-1e3)),a=new _.Ray(l,e.clone()),h=new _.Vector3;return a.intersectBox(r,h),{max:h,min:u}}initGradualMaterial(){let{max:t,min:e}=new _.Box3().setFromObject(this),r=t.clone().sub(e),o=Math.max(r.x,r.y,r.z)/2,s=this.getPosition(),u=new _.Vector3(-1,.2,0).normalize(),{max:l,min:a}=this.getMaxAndMin(s,u),h=this.context.materialFactory.createShaderMaterial({gradualColor:this.options.gradualColor,center:this.getPosition(),maxValue:o,opacity:this.options.fillOpacity,direction:new _.Vector3(-1,.2,0),max:l,min:a});if(this.options.height<=.1)return this.material=h,h;let c=this.getCenter(),f=new _.Vector3(-1,.2,1).normalize(),{max:m,min:d}=this.getMaxAndMin(c,f),x=this.context.materialFactory.createShaderMaterial({gradualColor:[dt(this.options.gradualColor[0],this.options.colorFactor),dt(this.options.gradualColor[1],this.options.colorFactor)],center:this.getCenter(),maxValue:o,opacity:this.options.fillOpacity,direction:new _.Vector3(-1,.2,1),max:m,min:d});return this.material=[h,x],[h,x]}initMaterial(){return this.options.renderType==="gradual"?this.initGradualMaterial():this.initSingleMaterial()}initLineMaterial(){let t=this.context.materialFactory.createLineMaterial({color:this.options.strokeColor,opacity:this.options.strokeOpacity});return this.lineMaterial=t,t}initMesh(){this.mesh&&this.remove(this.mesh),this.mesh=new _.Mesh(this.geometry,this.material),this.add(this.mesh)}getBorderPoints(){let t=[],e=this.options.height+this.options.deltaHeight,{coords:r}=this.options.geometry;for(let o=0;o<r.length;o++){let s=r[o];for(let u=0;u<s.length;u++){let l=s[u],a=u+1===s.length?s[0]:s[u+1];t.push(new _.Vector3(l[0],l[1],e)),t.push(new _.Vector3(a[0],a[1],e))}}return t}initLineGeometry(){this.lineGeometry&&this.lineGeometry.dispose();let t=this.getBorderPoints(),e=new _.BufferGeometry().setFromPoints(t);this.lineGeometry=e}createBorder(){this.line&&this.remove(this.line);let t=new _.LineSegments(this.lineGeometry,this.lineMaterial);return t.position.z=this.options.airHeight+.01,this.line=t,this.add(t),t}raycast(t){if(!this.visible||this.options.geometry.type==="point")return!1;let e=t.intersectObject(this.mesh);if(e[0]){let{point:r,distance:o}=e[0];return{position:r,distance:o}}return!1}dispose(){this.geometry.dispose(),this.line?.geometry.dispose(),this.clear()}};var N=g("three");var vt=class extends N.Object3D{directionalLight;plane;basicOpacity=.07;constructor(){super(),this.directionalLight=this.initLight(),this.initPlane()}initLight(){let n=re(16777215,.5);return n.position.set(0,0,100),this.add(n),n}changeLightCamera(n){let t=n.x,e=n.y;this.directionalLight.shadow.camera.left=-t,this.directionalLight.shadow.camera.right=t,this.directionalLight.shadow.camera.top=e,this.directionalLight.shadow.camera.bottom=-e,this.directionalLight.shadow.camera.near=.5,this.directionalLight.shadow.camera.far=Math.max(t,e)}changeLightColor(n){this.directionalLight.color=new N.Color(n)}setPosition(n){this.position.copy(n),this.directionalLight.position.set(-n.x/2,-n.y/2,100)}initPlane(n=1e3,t=1e3){let e=new N.PlaneGeometry(n,t),r=new N.ShadowMaterial({transparent:!0,opacity:0,side:N.DoubleSide}),o=new N.Mesh(e,r);return o.receiveShadow=!0,o.position.z=-10,this.add(o),this.plane=o,o}setTarget(n){this.directionalLight.target=n}transformOpacity(n){return n*this.basicOpacity}setOpacity(n){this.plane.material.opacity=this.transformOpacity(n)}dispose(){z(this,!0)}};var Et=g("three");var b=g("three");var de=g("lodash");var an={autoUpdate:!0,appendToBody:!1,autoChangePlacement:!1},xt=class extends b.EventDispatcher{constructor(t,e={}){super();this.context=t;this.options={...an,...e},this.registryEvent(),this.div=this.initDiv(),this.options.appendToBody?document.body.appendChild(this.div):this.context.container.appendChild(this.div)}div;element;position=new b.Vector3;clientPos={x:0,y:0};visible=!0;options;placement="top";observer=null;initObserver(){let t=new MutationObserver((0,de.debounce)(()=>{this.div&&this.usePlacement()},100));t.observe(this.div,{childList:!0,subtree:!0,attributes:!0}),this.observer=t}getPlacementPosition(){if(this.element instanceof I&&this.element.options.geometry.type==="polygon"){let{max:o,min:s}=new b.Box3().setFromObject(this.element),u=(o.x+s.x)/2,l=(o.y+s.y)/2;return{left:new b.Vector3(s.x,l,o.z),leftTop:new b.Vector3(s.x,o.y,o.z),top:new b.Vector3(u,o.y,o.z),rightTop:new b.Vector3(o.x,o.y,o.z),right:new b.Vector3(o.x,l,o.z),rightBottom:new b.Vector3(o.x,s.y,o.z),bottom:new b.Vector3(u,s.y,o.z),leftBottom:new b.Vector3(s.x,s.y,o.z),center:new b.Vector3(u,l,o.z)}}let{x:t,y:e,z:r}=this.element?.getPosition?.()||this.position;return{left:new b.Vector3(t,e,r),leftTop:new b.Vector3(t,e,r),top:new b.Vector3(t,e,r),rightTop:new b.Vector3(t,e,r),right:new b.Vector3(t,e,r),rightBottom:new b.Vector3(t,e,r),bottom:new b.Vector3(t,e,r),leftBottom:new b.Vector3(t,e,r),center:new b.Vector3(t,e,r)}}getPlacementScreenPosition(){let{width:t,height:e}=this.context.clientSize,r=this.getPlacementPosition();return Object.keys(r).reduce((o,s)=>{let{x:u,y:l}=y(r[s],this.context.camera,t,e);return o[s]={x:u,y:l},o},{})}checkOverflow(t,e){let{width:r,height:o}=this.context.clientSize;return e.x>0&&t.x<r&&e.y<o&&t.y>0}getPlacement(){let{clientWidth:t,clientHeight:e}=this.div,r=this.getPlacementScreenPosition(),o=t/2,s=e/2,u=[{type:"center",getBox(l,a){return{max:{x:o+l,y:a-e},min:{x:l-o,y:a}}}},{type:"left",getBox(l,a){return{max:{x:l,y:a-s},min:{x:l-t,y:a+s}}}},{type:"leftTop",getBox(l,a){return{max:{x:l,y:a-e},min:{x:l-t,y:a}}}},{type:"top",getBox(l,a){return{max:{x:l+o,y:a-e},min:{x:l-o,y:a}}}},{type:"rightTop",getBox(l,a){return{max:{x:l+t,y:a-e},min:{x:l,y:a}}}},{type:"right",getBox(l,a){return{max:{x:l+t,y:a-s},min:{x:l,y:a+s}}}},{type:"rightBottom",getBox(l,a){return{max:{x:l+t,y:a},min:{x:l,y:a+e}}}},{type:"bottom",getBox(l,a){return{max:{x:l+o,y:a},min:{x:l-o,y:a+e}}}},{type:"leftBottom",getBox(l,a){return{max:{x:l,y:a},min:{x:l-t,y:a+s}}}}];for(let l=0;l<u.length;l++){let a=u[l],h=r[a.type],{max:c,min:f}=a.getBox(h.x,h.y);if(this.checkOverflow(c,f))return{type:a.type,position:h}}return{type:"center",position:r.center}}initDiv(){let t=document.createElement("div");return t.style.position="absolute",t}usePlacement(){let t=this.getPlacement();this.div.className=`overlay_${t.type}`,this._updatePosition(t.position.x,t.position.y)}bindElement(t){this.element=t,this.options.autoChangePlacement&&this.initObserver(),this.onUpdate()}unBindElement(){this.element=void 0}setVisible(t,e="block"){t!==this.visible&&(this.div.style.display=t?e:"none",this.visible=t)}setOpacity(t){this.div.style.opacity=`${t}`}getPosition(){return this.element?typeof this.element.getPosition=="function"?this.element.getPosition():new b.Box3().setFromObject(this.element).getCenter(new b.Vector3):this.position}get withinDisplayRange(){let{x:t,y:e}=this.clientPos,{width:r,height:o}=this.context.clientSize;return t>=0&&t<=r&&e>=0&&e<=o}_updatePosition(t,e){this.clientPos={x:t,y:e};let{width:r,height:o,x:s,y:u}=this.context.clientSize;this.options.appendToBody&&(this.div.style.left=`${s}px`,this.div.style.top=`${u+o}px`),this.options.autoUpdate?this.div.style.transform=`translate3d(${t}px, ${-o+e}px, 0)`:this.dispatchEvent({type:"update-position",x:t,y:e,width:r,height:o})}updatePosition(t=!1){let e=this.getPosition(),{width:r,height:o}=this.context.clientSize,{x:s,y:u}=y(e,this.context.camera,r,o);this.clientPos.x===s&&this.clientPos.y===u&&!t||this._updatePosition(s,u)}onUpdate=()=>{this.options.autoChangePlacement?this.usePlacement():this.updatePosition()};registryEvent(){this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.removeEventListener("update",this.onUpdate)}dispose(){this.unRegistryEvent(),this.unBindElement(),this.observer?.disconnect(),this.div?.remove(),this.div=null}};var ln={texts:[{text:""}],level:1,icon_position:"bottom",collision_enable:!0,opacity:1,id:"",position:{x:0,y:0,z:0},icon_opacity:1,icon_border:{color:"#586EE0",width:0},background:"",collision_hide_icon:!0,built_in:!1,box_only_icon:!1},rt=class extends Et.EventDispatcher{constructor(t,e){super();this.context=t;this.options=ct({...ln,...e},this),this.position.set(e.position?.x||0,e.position?.y||0,e.position?.z||0),this.overlay=new xt(this.context,{autoUpdate:!1}),this.overlay.addEventListener("update-position",({x:r,y:o,height:s})=>{this.overlay.div.style.transform=`translate3d(calc(${r}px - 50%), calc(${-s+o}px - ${this.options.icon?"100%":"50%"}), 0)`}),this.overlay.bindElement(this),this.registryEvent(),this.initDiv(),this.addEventListener("change-icon",({value:r})=>{r?this.img?this.img.setAttribute("src",r):(this.addIcon(),this._changePosition()):(this.img&&this.div.removeChild(this.img),this.img=void 0,this._changePosition(),this.resetSize())}),this.addEventListener("change-texts",({value:r})=>{this.div.removeChild(this.textDiv),this.addText(),this.resetSize()}),this.addEventListener("change-opacity",({value:r})=>{this.overlay.setOpacity(r)}),this.addEventListener("change-icon_size",({value:r})=>{this.img&&(this.img.style.width=`${r?.[0]||32}px`,this.img.style.height=`${r?.[1]||32}px`,this.resetSize())}),this.addEventListener("change-icon_opacity",({value:r})=>{this.img&&(this.img.style.opacity=`${r}`)}),this.addEventListener("change-icon_border",({value:r})=>{this.img&&(this.img.style.border=`${r.width}px solid ${r.color}`)}),this.addEventListener("change-background",({value:r})=>{this.div.style.background=r})}div;textDiv;img;overlay;options;visible=!0;size={width:0,height:0};position=new Et.Vector3;userData={};showTextStatus=!0;disposed=!1;get withinDisplayRange(){return this.overlay.withinDisplayRange}async resetSize(){if(!this.disposed)if(await ue(),this.options.box_only_icon){if(!this.img)return;let{width:t,height:e}=this.img.getBoundingClientRect();this.size={width:t+2,height:e+2}}else{let{width:t,height:e}=this.div.getBoundingClientRect();this.size={width:t+2,height:e+2}}}renderHelperBox(){}get clientPos(){return this.overlay.clientPos}initDiv(){let t=document.createElement("div");return this.div=t,this.addText(),this.options.icon&&this.addIcon(),t.style.fontSize="12px",t.style.textShadow="#fff 1px 0 0, #fff 0 1px 0, #fff -1px 0 0, #fff 0 -1px 0",t.style.display="flex",t.style.flexDirection="column",t.style.justifyContent="center",t.style.alignItems="center",t.style.padding="4px",this.overlay.setOpacity(this.options.opacity),this.overlay.div.style.pointerEvents="none",this.overlay.div.style.userSelect="none",this.overlay.div.appendChild(t),this.resetSize(),t}addIcon(){if(!this.img){let t=this.initIcon();this.options.icon_position==="top"?this.div.firstChild?this.div.insertBefore(t,this.div.firstChild):this.div.appendChild(t):this.div.appendChild(t)}}addText(){let t=this.initText();this.options.icon_position==="top"?this.div.appendChild(t):this.div.firstChild?this.div.insertBefore(t,this.div.firstChild):this.div.appendChild(t)}getPosition(){return this.position}initText(){let t=document.createElement("div");return t.appendChild(this.createTextFragment()),t.style.textAlign="center",this.textDiv=t,t}createTextFragment(){let t=document.createDocumentFragment();return this.options.texts.forEach(e=>{let r=document.createElement("div");if(r.style.whiteSpace="nowrap",e.styles)for(let[o,s]of Object.entries(e.styles))r.style[o]=s;r.textContent=e.text,t.appendChild(r)}),t}initIcon(){let t=document.createElement("img");return t.setAttribute("src",this.options.icon),t.style.width=`${this.options.icon_size?.[0]||32}px`,t.style.height=`${this.options.icon_size?.[1]||32}px`,t.style.opacity=`${this.options.icon_opacity}px`,t.style.borderRadius="50%",this.options.icon_border.width&&(t.style.border=`${this.options.icon_border.width}px solid ${this.options.icon_border.color}`),t.onload=()=>{this.resetSize()},this.img=t,t}_changePosition=()=>{this.overlay.updatePosition(!0)};registryEvent(){}unRegistryEvent(){}setVisible(t){t!==this.visible&&(this.visible=t,this.changeOverlayVisible(t))}changeOverlayVisible(t){if(!(t===this.overlay.visible&&this.options.collision_hide_icon))if(this.options.collision_hide_icon)this.overlay.visible=t,this.overlay.div.style.visibility=t?"visible":"hidden";else{if(this.showTextStatus===t)return;this.textDiv.style.visibility=t?"visible":"hidden",this.showTextStatus=t}}parentSetVisible(t){this.visible&&this.changeOverlayVisible(t)}getBox(t=this.context.config.poi.boxScale){let{width:e,height:r}=this.size,o=e*t,s=r*t,{x:u,y:l}=this.overlay.clientPos;return{left:u-o/2,right:u+o/2,top:this.options.icon?l-s:l-s/2,bottom:this.options.icon?l:l+s/2}}getOriginBox(){return this.getBox(1)}isContain(t,e){if(!this.overlay.visible||!this.visible)return!1;let r=this.getOriginBox();return t>=r.left&&t<=r.right&&e>=r.top&&e<=r.bottom}dispose(){this.unRegistryEvent(),this.div=null,this.textDiv=null,this.img=void 0,this.overlay.dispose(),this.disposed=!0}};var P=g("three");var St=g("three");var ge=g("three");var $=class extends ge.Object3D{constructor(t){super();this.context=t}dispose(){z(this),this.clear()}};var bt=class extends ${graphicMap=new Map;constructor(n){super(n)}getCenter(){return new St.Box3().setFromObject(this).getCenter(new St.Vector3)}createGraphic(n){let t=new I(this.context,n);return this.add(t),this.graphicMap.set(n.id,t),t}removeGraphic(n){this.remove(n),this.graphicMap.delete(n.options.id),n.dispose()}removeGraphicById(n){this.graphicMap.has(n)&&this.removeGraphic(this.graphicMap.get(n))}getGraphicByNodeId(n){return this.graphicMap.get(n)||null}getGraphicByRaycaster(n){let t={distance:1e4,graphic:null,position:null},e=this.children.reduce((r,o)=>{if(o instanceof I){let s=o.raycast(n);if(s){let{distance:u}=s;if(u<r.distance)return{distance:r.distance,position:r.position,graphic:o}}return r}else return r},t);return e===t?{graphics:[],position:null}:{graphics:[e.graphic],position:e.position}}};var me=g("lodash");var Mt=class extends ${pois=[];debounceCollisionDetection;timer=new U;constructor(n){super(n),this.registryEvent(),this.debounceCollisionDetection=(0,me.debounce)(this.collisionDetection,10)}clear(n=!1){return this.pois.forEach(t=>{t.options.built_in&&!n||t.dispose()}),this.pois=n?[]:this.pois.filter(t=>t.options.built_in),this}createPoi(n){let t=new rt(this.context,n);return this.pushPoi(t),t.addEventListener("change-level",()=>this.changePoiLevelOrCollisionEnable(t)),t.addEventListener("change-collision_enable",()=>this.changePoiLevelOrCollisionEnable(t)),Promise.resolve().then(()=>{this.debounceCollisionDetection()}),t}changePoiLevelOrCollisionEnable(n){let t=this.pois.findIndex(e=>e===n);t!==-1&&(this.pois.splice(t,1),this.pushPoi(n))}removePoi(n){let t=this.pois.findIndex(e=>e===n);t!==-1&&(this.pois.splice(t,1),n.dispose())}removePoiById(n){let t=this.pois.find(e=>e.options.id===n);t&&this.removePoi(t)}getPoiById(n){return this.pois.find(e=>e.options.id===n)||null}pushPoi(n){if(!n.options.collision_enable){this.pois.unshift(n);return}if(n.options.level===0){this.pois.push(n);return}for(let t=0;t<this.pois.length;t++){let e=this.pois[t];if(e.options.collision_enable&&e.options.level<=n.options.level){this.pois.splice(t,0,n);return}}this.pois.push(n)}getPoiByDeviceXy(n,t){return this.pois.filter(r=>r instanceof rt&&r.isContain(n,t))}onUpdate=()=>{this.timer.requestAnimationFrame(()=>{this.collisionDetection()})};collisionDetection(){let n=[];this.pois.filter(e=>e.visible&&e.withinDisplayRange).forEach((e,r)=>{let{left:o,right:s,top:u,bottom:l}=e.getBox();if(r===0||!e.options.collision_enable){n.push({left:o,right:s,top:u,bottom:l}),e.parentSetVisible(!0);return}let a=n.some(h=>h.left<s&&h.right>o&&h.top<l&&h.bottom>u);e.parentSetVisible(!a),a||n.push({left:o,right:s,top:u,bottom:l})})}registryEvent(){this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.removeEventListener("update",this.onUpdate)}dispose(){this.timer.dispose(),this.pois.forEach(n=>n.dispose()),this.pois.length=0,this.debounceCollisionDetection=()=>{},super.dispose(),this.unRegistryEvent()}};var w=g("three"),ye=g("@mars3d/heatmap.js"),k=g("@turf/turf"),wt=class extends w.Object3D{constructor(t){super();this.context=t;this.div=document.createElement("div")}heatmap;div;plane;clearHeatmap(){this.div.firstChild&&this.div.removeChild(this.div.firstChild),this.heatmap=void 0}loadData(t){this.clearHeatmap();let{width:e,height:r,leftTop:o,center:s}=this.getBox(t);this.heatmap=(0,ye.create)({width:e,height:r,container:this.div,...this.context.config.heatMap}),this.heatmap.setData(this.transformData(t,o)),this.initPlane(e,r),this.position.set(s[0],s[1],this.position.z)}initPlane(t,e){this.plane&&this.remove(this.plane);let r=new w.PlaneGeometry(t,e),o=new w.Texture(this.div.firstChild);o.needsUpdate=!0;let s=new w.MeshBasicMaterial({transparent:!0,side:w.DoubleSide,map:o});s.needsUpdate=!0,this.plane=new w.Mesh(r,s),this.add(this.plane)}getTransMatrix({x:t,y:e}){return new w.Matrix3().makeScale(1,-1).multiply(new w.Matrix3().makeTranslation(0-t,0-e))}transformData(t,e){let r=this.getTransMatrix(e);return{data:t.data.map(s=>{let u=new w.Vector2(s.x,s.y).applyMatrix3(r);return{x:u.x,y:u.y,value:s.value}}),max:t.max,min:t.min}}getBox(t){let e=(0,k.featureCollection)(t.data.map(a=>(0,k.point)([a.x,a.y]))),r=(0,k.bbox)(e),o=r[2]-r[0],s=r[3]-r[1],u={x:r[0],y:r[3]},l=(0,k.center)(e);return{width:o,height:s,leftTop:u,center:l.geometry.coordinates}}dispose(){this.div=null,this.heatmap=void 0}};var j=g("three");var Tt=class extends j.Object3D{constructor(t,e){super();this.context=t;this.options=e;this.position.copy(e.position||new j.Vector3(0,0,0)),this.loadModel()}poi=null;model=null;async loadModel(){let t=await ce(this.options.modelUrl);t.scene.rotation.set(Math.PI/2,Math.PI/2,0),this.add(t.scene),this.model=t,this.initPoi()}initPoi(){if(!this.options.icon)return;let t=this.context.currentFloor?.addPoi({icon:this.options.icon,icon_size:this.options.icon_size,built_in:!0,level:0});this.poi=t||null,this.model&&t&&(t.position=new j.Box3().setFromObject(this).getCenter(new j.Vector3))}dispose(){z(this),this.model=null,this.poi&&(this.context.currentFloor?.poiLayer.removePoi(this.poi),this.poi=null)}};var Ct=class extends P.Object3D{constructor(t){super();this.context=t;this.graphicLayer=new bt(this.context),this.poiLayer=new Mt(this.context),this.groundUpper.add(this.graphicLayer),this.groundUpper.add(this.poiLayer),this.add(this.groundUpper),this.add(this.models)}graphicLayer;poiLayer;grounds=new Set;shadow=new vt;heatmap;groundUpper=new P.Object3D;models=new P.Object3D;modelMap=new Map;groundMaxHeight=0;name="";key="";getPosition(){return new P.Box3().setFromObject(this.groundUpper).getCenter(new P.Vector3)}createGround(t){let e=new I(this.context,t);this.addGrounds([e])}addGrounds(t){t.forEach(e=>{this.grounds.has(e)||(e.mesh.castShadow=!0,this.grounds.add(e),this.groundUpper.add(e))}),this.changeGroundMaxHeight()}changeGroundMaxHeight(){let t=Array.from(this.grounds);this.groundMaxHeight=this.grounds.size>0?Math.max(...t.map(e=>e.options.height+e.options.airHeight+e.options.deltaHeight)):0,this.graphicLayer.position.z=this.groundMaxHeight,this.models.position.z=this.groundMaxHeight}get hasElement(){return!!(this.grounds.size||this.graphicLayer.children.length)}getCenter(){return new P.Box3().setFromObject(this.groundUpper).getCenter(new P.Vector3)}addModel(t){let e=new Tt(this.context,t);return this.models.add(e),this.modelMap.set(t.id,e),e}addShadow(){let t=new P.Box3().setFromObject(this.groundUpper),e=t.getCenter(new P.Vector3),r=t.getSize(new P.Vector3);this.shadow.setPosition(e),this.shadow.changeLightCamera(r)}addGraphic(t){return this.graphicLayer.createGraphic(t)}addPoi(t){return this.poiLayer.createPoi(t)}addHeatmap(t){this.heatmap||(this.heatmap=new wt(this.context),this.add(this.heatmap)),this.heatmap.loadData(t);let e=new P.Box3().setFromObject(this.graphicLayer);return this.heatmap.position.setZ(e.max.z),this.heatmap}removeHeatMap(){this.heatmap&&(this.remove(this.heatmap),this.heatmap.dispose(),this.heatmap=void 0)}setShadowOpacity(t){this.shadow.setOpacity(t)}setShadowVisible(t){this.shadow.visible=t}dispose(){this.shadow.dispose(),this.graphicLayer.dispose(),this.poiLayer.dispose(),this.grounds.forEach(t=>t.dispose()),this.heatmap?.dispose(),this.groundUpper.clear(),this.models.children.forEach(t=>t.dispose()),this.models.clear(),this.modelMap.clear(),this.clear()}};var Pt=g("three");var B=class extends Pt.EventDispatcher{constructor(t){super();this.context=t;this.svg=le(`${t.container.clientWidth}`,`${t.container.clientHeight}`),t.container.appendChild(this.svg),this._registryEvent()}points=[];svg;enable=!0;_onResize=({width:t,height:e})=>{this.svg&&(this.svg.setAttribute("width",`${t}`),this.svg.setAttribute("height",`${e}`))};_registryEvent(){this.context.addEventListener("resize",this._onResize)}_unRegistryEvent(){this.context.removeEventListener("resize",this._onResize)}setEnable(t){this.enable=t,t?this.svg.style.display="block":this.svg.style.display="none"}getIntersectByPointerEvent(t){let{camera:e,renderer:r}=this.context,{offsetX:o,offsetY:s}=t,{clientWidth:u,clientHeight:l}=r.domElement,a=o/u*2-1,h=1-s/l*2;return new Pt.Vector3(a,h,0).unproject(e)}getSvgCoordinate(t){let{camera:e,container:r}=this.context;return y(t,e,r.clientWidth,r.clientHeight)}dispose(){this._unRegistryEvent(),this.context.container.removeChild(this.svg),this.svg=null}};var At=class extends B{constructor(t){super(t);this.context=t;let{config:{svg:{circle:e,line:r}}}=t;this.circles=[et(e.radius,e.fill),et(e.radius,e.fill)],this.line=ft(r.stroke),this.svg.appendChild(this.circles[0]),this.svg.appendChild(this.circles[1]),this.svg.appendChild(this.line),this.registryEvent()}circles;line;setEnable(t){super.setEnable(t),t?this.registryEvent():this.unRegistryEvent()}registryEvent(){this.context.container.addEventListener("pointerenter",this.onPointermove),this.context.container.addEventListener("pointermove",this.onPointermove),this.context.container.addEventListener("pointerleave",this.onPointerleave),this.context.container.addEventListener("pointerdown",this.onPointerdown),this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.container.removeEventListener("pointerenter",this.onPointermove),this.context.container.removeEventListener("pointermove",this.onPointermove),this.context.container.removeEventListener("pointerleave",this.onPointerleave),this.context.container.removeEventListener("pointerdown",this.onPointerdown),this.context.removeEventListener("update",this.onUpdate)}onUpdate=()=>{if(this.points[0]){let t=this.getSvgCoordinate(this.points[0]);q(this.circles[0],t.x,t.y),D(this.line,t)}if(this.points[1]){let t=this.getSvgCoordinate(this.points[1]);q(this.circles[1],t.x,t.y),D(this.line,void 0,t)}};onPointermove=t=>{this.points.length===1&&(this.line.style.display="block",D(this.line,void 0,{x:t.offsetX,y:t.offsetY}))};onPointerleave=()=>{this.points[1]||(this.line.style.display="none")};onPointerdown=t=>{if(this.points[1])return;let e=this.getIntersectByPointerEvent(t);if(e){let{offsetX:r,offsetY:o}=t,s=this.circles[this.points.length];q(s,r,o),this.points.length||D(this.line,{x:r,y:o},{x:r,y:o}),this.addPoint(e)}};addPoint(t){if(this.points.push(t),this.points.length>=2){let e=this.calculatedDistance();this.dispatchEvent({type:"distance",distance:e})}}calculatedDistance(){let[{x:t,y:e},{x:r,y:o}]=this.points;return Math.sqrt((r-t)**2+(o-e)**2)}dispose(){super.dispose(),this.unRegistryEvent(),this.line=null,this.circles=[]}};var Rt=class extends B{circles=[];lines=[];isClose=!1;constructor(n){super(n),this.registryEvent()}setEnable(n){super.setEnable(n),n?this.registryEvent():this.unRegistryEvent()}get lastLine(){return this.lines.slice(-1)[0]}addCircle(n){this.circles.push(n),this.svg.appendChild(n)}addLine(n){this.lines.push(n),this.svg.appendChild(n)}registryEvent(){this.context.container.addEventListener("pointerenter",this.onPointermove),this.context.container.addEventListener("pointermove",this.onPointermove),this.context.container.addEventListener("pointerleave",this.onPointerleave),this.context.container.addEventListener("pointerdown",this.onPointerdown),this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.container.removeEventListener("pointerenter",this.onPointermove),this.context.container.removeEventListener("pointermove",this.onPointermove),this.context.container.removeEventListener("pointerleave",this.onPointerleave),this.context.container.removeEventListener("pointerdown",this.onPointerdown),this.context.removeEventListener("update",this.onUpdate)}onUpdate=()=>{this.points.length&&this.points.forEach((n,t)=>{let e=this.getSvgCoordinate(n);this.circles[t]&&q(this.circles[t],e.x,e.y),t!==0&&D(this.lines[t-1],void 0,e),this.lines[t]&&D(this.lines[t],e)})};onPointermove=n=>{!this.lastLine||this.isClose||(this.lastLine.style.display="block",D(this.lastLine,void 0,{x:n.offsetX,y:n.offsetY}))};onPointerleave=()=>{this.isClose||(this.lastLine.style.display="none")};onPointerdown=n=>{if(this.isClose)return;let t=this.getIntersectByPointerEvent(n);if(t){let{offsetX:e,offsetY:r}=n;this.checkAdsorb(e,r)?(this.isClose=!0,this.addPoint(this.points[0])):this.addPoint(t);let{circle:{fill:o,radius:s},line:{stroke:u}}=this.context.config.svg;if(!this.isClose){let l=et(s,o);q(l,e,r),this.addCircle(l)}if(this.lines.length&&D(this.lastLine,void 0,{x:e,y:r}),!this.isClose){let l=ft(u);D(l,{x:e,y:r},{x:e,y:r}),this.addLine(l)}}};checkAdsorb(n,t){if(this.points.length<3)return!1;let e=this.circles[0],r=+e.getAttribute("cx"),o=+e.getAttribute("cy");return Math.sqrt((n-r)**2+(t-o)**2)<=5}addPoint(n){if(this.points.push(n),this.isClose){let t=this.calculatedArea();this.dispatchEvent({type:"area",area:t})}}calculatedArea(){let n=this.points.map(r=>[r.x,r.y]),t=0,e=n.length;for(let r=0;r<e;r++){let o=(r+1)%e;t+=n[r][0]*n[o][1]-n[o][0]*n[r][1]}return Math.abs(t/2)}dispose(){super.dispose(),this.unRegistryEvent(),this.lines=[],this.circles=[]}};var ve=g("three");var _e=class extends B{constructor(t){super(t);this.context=t;let{config:{svg:{line:e}}}=t;this.rect=J(e.stroke,"transparent"),this.svg.appendChild(this.rect);for(let r=0;r<4;r++)this.cornerRect[r]=J(e.stroke,"#ffffff"),this.centerRect[r]=J(e.stroke,"#ffffff"),this.svg.appendChild(this.cornerRect[r]),this.svg.appendChild(this.centerRect[r]);this.registryEvent()}rect;cornerRect=[];centerRect=[];graphic;setEnable(t){super.setEnable(t),t?this.registryEvent():this.unRegistryEvent()}registryEvent(){this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.removeEventListener("update",this.onUpdate)}onUpdate=()=>{if(this.graphic){let t=new ve.Box3().setFromObject(this.graphic),{camera:e,container:{clientWidth:r,clientHeight:o}}=this.context,{min:s,max:u}=t,l=y(s,e,r,o),a=y(u,e,r,o);O(this.rect,l.x,a.y,Math.abs(a.x-l.x),Math.abs(a.y-l.y));let{x:h,y:c}=l,{x:f,y:m}=a,d=5,x=[{x:h-d,y:m-d},{x:f-d,y:m-d},{x:h-d,y:c-d},{x:f-d,y:c-d}];for(let T=0;T<x.length;T++)O(this.cornerRect[T],x[T].x,x[T].y,d*2,d*2);let v=4,A=(h+f)/2,R=(c+m)/2,G=[{x:A-v,y:m-v},{x:h-v,y:R-v},{x:f-v,y:R-v},{x:A-v,y:c-v}];for(let T=0;T<G.length;T++)O(this.centerRect[T],G[T].x,G[T].y,v*2,v*2)}else{O(this.rect,0,0,0,0);for(let t=0;t<this.cornerRect.length;t++)O(this.cornerRect[t],0,0,0,0),O(this.centerRect[t],0,0,0,0)}};selectGraphic(t){this.graphic=t}dispose(){super.dispose(),this.unRegistryEvent(),this.rect=null,this.cornerRect=[],this.centerRect=[]}};var xe=g("three"),It=class extends B{startPoint;endPoint;rect;frustum=new xe.Frustum;constructor(n){super(n);let{config:{selectBox:{fill:t,stroke:e}}}=n;this.rect=J(e,t),this.svg.appendChild(this.rect),this.registryEvent()}setEnable(n){super.setEnable(n),O(this.rect,0,0,0,0),n?this.registryEvent():(this.startPoint=void 0,this.unRegistryEvent())}onPointerDown=n=>{if(!this.enable)return;let t=this.getIntersectByPointerEvent(n);t&&(this.startPoint=t),this.endPoint=void 0};onPointerMove=n=>{if(!this.enable||!this.startPoint)return;let t=this.getIntersectByPointerEvent(n);t&&(this.endPoint=t)};onPointerUp=n=>{if(!this.enable)return;let t=this.getIntersectByPointerEvent(n);t&&(this.endPoint=t),this.doSelect(),this.startPoint=void 0};onUpdate=()=>{if(this.startPoint){let n=this.getSvgCoordinate(this.startPoint),t={...n};this.endPoint&&(t=this.getSvgCoordinate(this.endPoint));let e={x:Math.min(n.x,t.x),y:Math.min(n.y,t.y)},r=Math.abs(t.x-n.x),o=Math.abs(t.y-n.y);O(this.rect,e.x,e.y,r,o)}else O(this.rect,0,0,0,0)};registryEvent(){this.context.container.addEventListener("pointerdown",this.onPointerDown),this.context.container.addEventListener("pointermove",this.onPointerMove),this.context.container.addEventListener("pointerup",this.onPointerUp),this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.container.removeEventListener("pointerdown",this.onPointerDown),this.context.container.removeEventListener("pointermove",this.onPointerMove),this.context.container.removeEventListener("pointerup",this.onPointerUp),this.context.removeEventListener("update",this.onUpdate)}doSelect(){if(this.startPoint&&this.endPoint){if(this.startPoint.distanceTo(this.endPoint)<.1)return;let{context:{camera:t,container:{clientWidth:e,clientHeight:r}}}=this,o=y(this.startPoint,t,e,r),s=y(this.endPoint,t,e,r),u={x:Math.min(o.x,s.x),y:Math.min(o.y,s.y)},l={x:Math.max(o.x,s.x),y:Math.max(o.y,s.y)},a=this.searchMapInFrustum(u,l);this.dispatchEvent({type:"selected",list:a})}}searchMapInFrustum(n,t){let{context:e}=this;return e.currentFloor?.graphicLayer.children.filter(r=>r instanceof I&&this.searchChildInFrustum(r,n,t))||[]}searchChildInFrustum(n,t,e){let{context:{camera:r,container:{clientWidth:o,clientHeight:s}}}=this;if(!n)return!1;if(!n.mesh){let f=n.getPosition();if(f){let m=y(f,r,o,s);return ht(m,t,e)}return!1}n.mesh.geometry.boundingBox||n.mesh.geometry.computeBoundingBox();let u=n.mesh.geometry.boundingBox;if(!u)return!1;let{min:l,max:a}=u,h=y(l,r,o,s),c=y(a,r,o,s);return!(!ht(h,t,e)||!ht(c,t,e))}dispose(){this.unRegistryEvent()}};var Lt=class extends Ee.EventDispatcher{constructor(t){super();this.context=t;this.boxSelection=new It(t),this.boxSelection.setEnable(!1),this.registryEvent()}_list=new Set;boxSelection;prevPanStatus;prevRotateStatus;downPoint=null;isMultipleSelect=!1;get list(){return this._list}enableBoxSelection(){this.isMultipleSelect||(this.isMultipleSelect=!0,this.boxSelection.setEnable(!0),this.prevPanStatus=this.context.control.enablePan,this.prevRotateStatus=this.context.control.enableRotate,this.context.control.enablePan=!1,this.context.control.enableRotate=!1)}disableBoxSelection(){this.isMultipleSelect&&(this.isMultipleSelect=!1,this.boxSelection.setEnable(!1),this.context.control.enablePan=!!this.prevPanStatus,this.context.control.enableRotate=!!this.prevRotateStatus)}onPointerDown=t=>{this.downPoint={x:t.offsetX,y:t.offsetY}};onPointerUp=t=>{if(!this.downPoint)return;let{offsetX:e,offsetY:r}=t,{x:o,y:s}=this.downPoint;if(Math.sqrt((o-e)**2+(s-r)**2)>3)return;let{graphics:u}=this.context.getGraphicsByDeviceXy(e,r),l=new Set(u.map(h=>h.options.id));this.context.getPoisByDeviceXy(e,r).forEach(h=>{if(!l.has(h.options.id)){let c=this.context.currentFloor?.graphicLayer.graphicMap.get(h.options.id)||null;c&&c.options.geometry.type==="point"&&(u.push(c),l.add(h.options.id))}}),(yt?t.metaKey:t.ctrlKey)||this._list.clear(),u.forEach(h=>this._list.add(h)),this.selectEnd(),this.downPoint=null};onPointerOut=t=>{this.disableBoxSelection()};onKeyDown=t=>{Vt(t.key)&&this.enableBoxSelection()};onKeyUp=t=>{Vt(t.key)&&this.disableBoxSelection()};onBoxSelected=({list:t})=>{this._list.clear(),t.forEach(e=>{this._list.add(e)}),this.selectEnd()};selectEnd(){this.dispatchEvent({type:"select",graphics:[...this._list],isMultipleSelect:this.isMultipleSelect})}registryEvent(){this.context.container.addEventListener("pointerdown",this.onPointerDown),this.context.container.addEventListener("pointerup",this.onPointerUp),this.context.container.addEventListener("pointerout",this.onPointerOut),this.context.container.addEventListener("pointercancel",this.onPointerOut),window.addEventListener("keydown",this.onKeyDown),window.addEventListener("keyup",this.onKeyUp),this.boxSelection.addEventListener("selected",this.onBoxSelected)}unRegistryEvent(){this.context.container.removeEventListener("pointerdown",this.onPointerDown),this.context.container.removeEventListener("pointerup",this.onPointerUp),this.context.container.removeEventListener("pointerout",this.onPointerOut),this.context.container.removeEventListener("pointercancel",this.onPointerOut),window.removeEventListener("keydown",this.onKeyDown),window.removeEventListener("keyup",this.onKeyUp),this.boxSelection.removeEventListener("selected",this.onBoxSelected)}clear(){this._list.clear()}remove(t){this._list.delete(t)}dispose(){this.unRegistryEvent()}};var be=g("three");var Nt=class extends be.EventDispatcher{constructor(t){super();this.context=t;this.registryEvent()}curGraphics=new Set;timer=new U;graphicTimerMap=new Map;onPointerMove=({graphics:t,pois:e,e:r})=>{let o=e.map(a=>this.context.currentFloor?.graphicLayer.graphicMap.get(a.options.id)).filter(a=>a&&a.options.geometry.type==="point");if(!t.length&&!o.length&&this.curGraphics.size){this.curGraphics.clear(),this.handleHoverGraphicsChange();return}let{time:s}=this.context.config.hover,u=new Set;if(o.length){let a,h=1e4;o.forEach(c=>{let f=e.find(v=>v.options.id===c.options.id),{x:m,y:d}=f.clientPos,x=Math.sqrt((m-r.offsetX)**2+(d-r.offsetY)**2);x<h&&(h=x,a=c)}),u.add(a)}u.size||t.forEach(a=>u.add(a)),u.forEach(a=>{if(this.graphicTimerMap.get(a)||this.curGraphics.has(a))return;let h=this.timer.setTimeout(()=>{this.curGraphics.add(a),this.graphicTimerMap.delete(a),this.timer.clearTimeout(h),this.handleHoverGraphicsChange()},s);this.graphicTimerMap.set(a,h)}),this.graphicTimerMap.forEach((a,h)=>{u.has(h)||(this.timer.clearTimeout(a),this.graphicTimerMap.delete(h))});let l=this.curGraphics.size;this.curGraphics.forEach(a=>{u.has(a)||this.curGraphics.delete(a)}),l!==this.curGraphics.size&&this.handleHoverGraphicsChange()};onPointerLevel=()=>{this.curGraphics.clear(),this.handleHoverGraphicsChange()};handleHoverGraphicsChange(t=this.curGraphics){this.dispatchEvent({type:"hover-change",graphics:Array.from(t)})}registryEvent(){this.context.addEventListener("pointer-over",this.onPointerMove),this.context.addEventListener("pointer-move",this.onPointerMove),this.context.addEventListener("pointer-level",this.onPointerLevel)}unRegistryEvent(){this.context.removeEventListener("pointer-over",this.onPointerMove),this.context.removeEventListener("pointer-move",this.onPointerMove),this.context.removeEventListener("pointer-level",this.onPointerLevel)}dispose(){this.unRegistryEvent(),this.timer.dispose()}};var C=g("three");function Se(i){return`${i.x}-${i.y}-${i.z}`}var Dt=class{constructor(n){this.context=n}lineMaterialMap=new Map;meshStandardMaterialMap=new Map;meshBasicMaterialMap=new Map;shaderMaterialMap=new Map;generateLineMaterialKey({color:n,opacity:t}){return`${n}-${t}`}createLineMaterial({color:n,opacity:t}){let e=this.generateLineMaterialKey({color:n,opacity:t});if(this.lineMaterialMap.has(e))return this.lineMaterialMap.get(e);let r=new C.LineBasicMaterial({color:new C.Color(n).convertLinearToSRGB(),transparent:!0,opacity:t});return this.lineMaterialMap.set(e,r),r}createMeshStandardMaterial({color:n,opacity:t}){let e=`${n}-${t}`;if(this.meshStandardMaterialMap.has(e))return this.meshStandardMaterialMap.get(e);let r=new C.MeshStandardMaterial({color:new C.Color(n).convertLinearToSRGB(),roughness:1,transparent:!0,opacity:t,depthWrite:!0});return this.meshStandardMaterialMap.set(e,r),r}createMeshBasicMaterial({color:n,opacity:t}){let e=`${n}-${t}`;if(this.meshBasicMaterialMap.has(e))return this.meshBasicMaterialMap.get(e);let r=new C.MeshBasicMaterial({color:n,transparent:!0,opacity:t,depthWrite:!0});return this.meshBasicMaterialMap.set(e,r),r}createShaderMaterial({gradualColor:n,center:t,maxValue:e,opacity:r,direction:o,max:s,min:u}){let l=`${n.toString()}-${Se(t)}-${e}-${r}-${Se(o)}`;if(this.shaderMaterialMap.has(l))return this.shaderMaterialMap.get(l);let a=`
1
+ "use strict";(()=>{var Ye=Object.create;var Yt=Object.defineProperty;var Ze=Object.getOwnPropertyDescriptor;var Ke=Object.getOwnPropertyNames;var Je=Object.getPrototypeOf,$e=Object.prototype.hasOwnProperty;var g=(i=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(i,{get:(n,t)=>(typeof require<"u"?require:n)[t]}):i)(function(i){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+i+'" is not supported')});var Zt=(i,n)=>()=>(n||i((n={exports:{}}).exports,n),n.exports);var Qe=(i,n,t,e)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of Ke(n))!$e.call(i,r)&&r!==t&&Yt(i,r,{get:()=>n[r],enumerable:!(e=Ze(n,r))||e.enumerable});return i};var tn=(i,n,t)=>(t=i!=null?Ye(Je(i)):{},Qe(n||!i||!i.__esModule?Yt(t,"default",{value:i,enumerable:!0}):t,i));var Oe=Zt((ts,De)=>{De.exports=function(n,t){return n[0]=t[0],n[1]=t[1],n}});var Be=Zt((es,Ue)=>{var Fe=Oe();Ue.exports=function(i,n){Array.isArray(n)||(n=[]),i.length>0&&n.push(Fe([0,0],i[0]));for(var t=0;t<i.length-1;t++){var e=i[t],r=i[t+1],o=e[0],s=e[1],u=r[0],l=r[1],a=[.75*o+.25*u,.75*s+.25*l],h=[.25*o+.75*u,.25*s+.75*l];n.push(a),n.push(h)}return i.length>1&&n.push(Fe([0,0],i[i.length-1])),n}});var Bt=g("three");var U=class{tasks={requestAnimation:new Set,timeout:new Set,interval:new Set};requestAnimationFrame(n){let t=window.requestAnimationFrame(()=>{this.tasks.requestAnimation.delete(t),n()});return this.tasks.requestAnimation.add(t),t}cancelAnimationFrame(n){this.tasks.requestAnimation.delete(n),window.cancelAnimationFrame(n)}setTimeout(n,t){let e=window.setTimeout(()=>{this.tasks.timeout.delete(e),n()},t);return this.tasks.timeout.add(e),e}clearTimeout(n){this.tasks.timeout.delete(n),window.clearTimeout(n)}setInterval(n,t){let e=window.setInterval(()=>{this.tasks.interval.delete(e),n()},t);return this.tasks.interval.add(e),e}clearInterval(n){this.tasks.interval.delete(n),window.clearInterval(n)}dispose(){this.tasks.requestAnimation.forEach(n=>{window.cancelAnimationFrame(n)}),this.tasks.requestAnimation.clear(),this.tasks.timeout.forEach(n=>{window.clearTimeout(n)}),this.tasks.timeout.clear(),this.tasks.interval.forEach(n=>{window.clearInterval(n)}),this.tasks.interval.clear()}};var S=g("three"),Kt=g("three/examples/jsm/controls/MapControls");function Jt(){let i=new S.Scene;return i.background=new S.Color(16777215),i}function $t(){let i=new S.WebGLRenderer({antialias:!0});return i.autoClear=!0,i.setClearAlpha(1),i.setClearColor(16777215),i.setPixelRatio(window.devicePixelRatio),i.shadowMap.enabled=!0,i.shadowMap.autoUpdate=!0,i.shadowMap.type=S.PCFSoftShadowMap,i}function Qt(i,n){let t=new S.OrthographicCamera(-i/2,i/2,n/2,-n/2,-1e3,5e3);return t.up.set(0,0,1),t.position.set(0,0,100),t.lookAt(0,0,0),t}function te(){let i=new S.Group,n=new S.AmbientLight(16777215,2.6);return i.add(n),i}function ee(i,n){let t=new Kt.MapControls(i,n);return t.enableDamping=!1,t.zoomSpeed=2,t}function ne(i,n=[]){let t=new S.Shape(i.map(e=>new S.Vector2(...e)));return n.length&&n.forEach(e=>{var r=new S.Path(e.map(o=>new S.Vector2(...o)));t.holes.push(r)}),t}function re(i=16777215,n=1){let t=new S.DirectionalLight(i,n);return t.castShadow=!0,t.shadow.radius=8,t.shadow.bias=-.001,t.shadow.mapSize.set(256,256),t.shadow.camera.left=-200,t.shadow.camera.right=200,t.shadow.camera.top=200,t.shadow.camera.bottom=-200,t}function z(i,n){if(n&&i.children&&i.children.length&&i.children.forEach(t=>{z(t,n)}),i.isMesh){let t=i;t.geometry&&t.geometry.dispose(),t.material&&(Array.isArray(t.material)?t.material.forEach(e=>{e.dispose()}):t.material.dispose())}i.isLight&&i.dispose?.()}function ie(i){return/[\u4E00-\u9FA5]+/g.test(i)}var W=g("three");var lt=new Map;function en(){let i=document.createElement("canvas");i.width=1024,i.height=64;let n=i.getContext("2d",{willReadFrequently:!0});return n.font="54px sans-serif",n.textBaseline="hanging",n.lineWidth=12,n.fillStyle="rgba(0,0,0,1)",n.strokeStyle="white",{canvas:i,ctx:n}}var zt,H;function nn(){if(!zt){let{canvas:i,ctx:n}=en();zt=i,H=n}}function Sn(i){if(lt.has(i))return lt.get(i);nn(),H.clearRect(0,0,1024,64);let n=ie(i)?4:8;H.strokeText(i,2,n),H.fillText(i,2,n);let t=Math.ceil(H.measureText(i).width);t=t%2===0?t:t+1,t+=2;let e=H.getImageData(0,0,t,64),r=new W.DataTexture(Uint8Array.from(e.data),t,64,W.RGBAFormat);return r.flipY=!0,r.minFilter=W.LinearFilter,r.magFilter=W.LinearFilter,lt.set(i,r),r}function oe(){lt.clear()}function se(){H=null,zt=null}var ut=g("three"),K=g("@turf/turf");function y(i,n,t,e){let r=i.clone().project(n),o=t/2,s=e/2,u=Math.round(r.x*o+o),l=Math.round(-r.y*s+s);return{x:u,y:l}}function kt(i){let n=(0,K.featureCollection)(i.map(e=>(0,K.point)(e)));return(0,K.center)(n).geometry.coordinates}function ht(i,n,t){return i.x>=n.x&&i.x<=t.x&&i.y>=n.y&&i.y<=t.y}function Tn(i){let n=0,t=new ut.Vector3;for(let e=1;e<i.length;e++){let r=new ut.Vector3(i[e-1][0],i[e-1][1],0),o=new ut.Vector3(i[e][0],i[e][1],0),s=o.distanceTo(r);s>n&&(n=s,t=o.clone().sub(r).normalize())}return t}function rn(i,n){return Math.sqrt((n[0]-i[0])**2+(n[1]-i[1])**2)}function ae(i){let n=0;for(let t=0;t<i.length-1;t++)n+=rn(i[t],i[t+1]);return n}function ct(i,n){return new Proxy(i,{get:(t,e,r)=>Reflect.get(t,e,r),set:(t,e,r,o)=>{let s=Reflect.get(t,e,o),u=Reflect.set(t,e,r,o);return s!==r&&n.dispatchEvent({type:`change-${e}`,value:r}),u}})}function X(i,n){return Promise.race([i,new Promise((t,e)=>{setTimeout(()=>e(new Error("Promise timeout")),n)})])}function pt(i){return document.createElementNS("http://www.w3.org/2000/svg",i)}function le(i,n){let t=pt("svg");return t.setAttribute("width",i),t.setAttribute("height",n),t.style.cssText="position: absolute; left: 0; top: 0; pointer-events: none;",t}function et(i="2",n){let t=pt("circle");return t.setAttribute("r",i),t.setAttribute("fill",n),t}function ft(i){let n=pt("line");return n.setAttribute("stroke",i),n}function J(i,n){let t=pt("rect");return t.setAttribute("stroke",i),t.setAttribute("fill",n),t}function q(i,n,t){i.setAttribute("cx",`${n}`),i.setAttribute("cy",`${t}`)}function D(i,n,t){n&&(i.setAttribute("x1",`${n.x}`),i.setAttribute("y1",`${n.y}`)),t&&(i.setAttribute("x2",`${t.x}`),i.setAttribute("y2",`${t.y}`))}function O(i,n,t,e,r){i.setAttribute("x",`${n}`),i.setAttribute("y",`${t}`),i.setAttribute("width",`${e}`),i.setAttribute("height",`${r}`)}function ue(){return Promise.resolve()}function In(){return new Promise(i=>{requestAnimationFrame(i)})}function Nn(i){return parseInt(i.replace("#","0x"),16)}function Dn(i,n){let t=parseInt(i.substring(1,3),16),e=parseInt(i.substring(3,5),16),r=parseInt(i.substring(5,7),16),o=Math.round(t*n),s=Math.round(e*n),u=Math.round(r*n);return`#${(1<<24|o<<16|s<<8|u).toString(16).slice(1)}`}function dt(i,n=.85){let t,e,r;if(i.startsWith("#"))t=parseInt(i.substring(1,3),16),e=parseInt(i.substring(3,5),16),r=parseInt(i.substring(5,7),16);else{let s=i.slice(4,-1).split(",");t=parseInt(s[0].trim()),e=parseInt(s[1].trim()),r=parseInt(s[2].trim())}return t=Math.min(Math.floor(t*n),255),e=Math.min(Math.floor(e*n),255),r=Math.min(Math.floor(r*n),255),"#"+((1<<24)+(t<<16)+(e<<8)+r).toString(16).slice(1)}var he=g("three/examples/jsm/loaders/GLTFLoader");function on(){return new he.GLTFLoader}var gt=null,mt=new Map;function ce(i){if(mt.has(i)){let t=mt.get(i).then(e=>(e.scene=e.scene.clone(),e))}gt||(gt=on());let n=new Promise((t,e)=>{gt.load(i,r=>{t(r)},void 0,e)});return mt.set(i,n),n.then(t=>(t.scene=t.scene.clone(),t))}function pe(){gt=null,mt.clear()}var yt=navigator.userAgent.toUpperCase().indexOf("MAC")>=0;function Vt(i){return yt?i==="Meta":i==="Control"}var Ht="__once__",fe=class{events=new Map;on(n,t){if(typeof t!="function")return;let e=this.events.get(n);return e?e.add(t):this.events.set(n,new Set([t]))}once(n,t){if(typeof t!="function")return;let e=`${Ht}${n}`,r=this.events.get(e);return r?r.add(t):this.events.set(e,new Set([t]))}off(n,t){let e=this.events.get(n),r=this.events.get(`${Ht}${n}`);!e&&!r||(t===void 0&&(e?.clear(),r?.clear()),e?.has(t)&&e.delete(t),r?.has(t)&&r.delete(t))}offAll(){this.events.clear()}emit(n,...t){let e=this.events.get(n),r=this.events.get(`${Ht}${n}`);!e&&!r||(e?.forEach(o=>{typeof o=="function"&&o(...t)}),r?.forEach(o=>{typeof o=="function"&&o(...t)}),r?.clear())}};var nt=(t=>(t.SWITCH_FLOOR_BEFORE="switch_floor_before",t.SWITCH_FLOOR_AFTER="switch_floor_after",t))(nt||{});function F(i){return Object.keys(i).sort().map(n=>`${n}=${i[n]}`).join("&")}function Wn(i,n){return new Promise((t,e)=>{let r=new XMLHttpRequest;r.open("GET",i,!0),Object.keys(n.headers||{}).forEach(o=>{r.setRequestHeader(o,n.headers[o])}),r.onload=()=>{if(r.status>=200&&r.status<300)try{let o=JSON.parse(r.responseText);t(o)}catch(o){e(o)}else e(r.statusText)},r.onerror=()=>{e(r.statusText)},r.send()})}var _t=class i{keySet=new Set;static createKey(){return Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)}genUniqueKey(){let n=i.createKey();for(;this.keySet.has(n);)n=i.createKey();return n}removeKey(n){this.keySet.delete(n)}dispose(){this.keySet.clear()}};var E=g("three"),Z=g("@tweenjs/tween.js");var Ee=g("three");var _=g("three");var sn={id:"",height:.1,airHeight:0,area:0,group:"",fillColor:"#EFF4FB",strokeColor:"#ffffff",fillOpacity:1,strokeOpacity:1,strokeWidth:1,doors:[],locked:!1,visible:!0,geometry:{type:"polygon",cds:[],coords:[],curveCpt:[],curveIndex:[]},layerType:"",zIndex:0,stroke:!0,deltaHeight:0,userData:{},gradualColor:[],renderType:"single",colorFactor:.9},I=class extends _.Object3D{constructor(t,e){super();this.context=t;if(this.options=ct({...sn,...e},this),this.options.geometry.type==="point"){let[r,o]=this.options.geometry.coords;return this.position.set(r,o,this.options.height+this.options.airHeight),this}this.init(),this.visible=this.options.visible,this.addEventListener("change-fillColor",({value:r})=>{this.initMaterial(),this.initMesh()}),this.addEventListener("change-fillOpacity",({value:r})=>{this.initMaterial(),this.initMesh()}),this.addEventListener("change-height",({value:r})=>{this.dispose(),this.init()}),this.addEventListener("change-strokeColor",({value:r})=>{this.options.stroke&&(this.initLineMaterial(),this.createBorder())}),this.addEventListener("change-strokeOpacity",({value:r})=>{this.options.stroke&&(this.initLineMaterial(),this.createBorder())}),this.addEventListener("change-airHeight",({value:r})=>{this.position.z=r}),this.addEventListener("change-visible",({value:r})=>{this.visible=r}),this.addEventListener("change-stroke",({value:r})=>{if(r){if(this.line)return;this.initLineGeometry(),this.initLineMaterial(),this.createBorder()}else this.line&&(this.remove(this.line),this.lineGeometry?.dispose())}),this.addEventListener("change-renderType",()=>{this.initMaterial(),this.initMesh()}),this.addEventListener("change-gradualColor",()=>{this.initMaterial(),this.initMesh()})}geometry;material;mesh;line;lineMaterial;lineGeometry;options;getCenter(){if(this.options.geometry.type==="point")return this.position.clone();let t=new _.Vector3,e=new _.Box3;return e.setFromObject(this),e.getCenter(t),t}getSize(){if(this.options.geometry.type==="point")return new _.Vector3(0,0,0);let t=new _.Box3,e=new _.Vector3;return t.setFromObject(this),t.getSize(e),e}getPosition(){let t=this.getCenter();return t.setZ(t.z+this.options.height/2),t}init(){this.geometry=this.initGeometry(),this.initMaterial(),this.initMesh(),this.mesh.position.z=this.options.airHeight+this.options.deltaHeight,this.options.stroke&&(this.initLineMaterial(),this.initLineGeometry(),this.createBorder())}initGeometry(){let t=ne(this.options.geometry.coords[0],this.options.geometry.coords.slice(1));return new _.ExtrudeGeometry(t,{steps:1,bevelEnabled:!1,depth:this.options.height,curveSegments:4})}initSingleMaterial(){let t=this.context.materialFactory.createMeshBasicMaterial({color:this.options.fillColor,opacity:this.options.fillOpacity});if(this.options.height<=.1)return this.material=t,t;let e=this.context.materialFactory.createMeshBasicMaterial({color:dt(this.options.fillColor),opacity:this.options.fillOpacity});return this.material=[t,e],[t,e]}getMaxAndMin(t,e){let r=new _.Box3().setFromObject(this),o=t.clone().add(e.clone().multiplyScalar(1e3)),s=new _.Ray(o,e.clone().multiplyScalar(-1)),u=new _.Vector3;s.intersectBox(r,u);let l=t.clone().add(e.clone().multiplyScalar(-1e3)),a=new _.Ray(l,e.clone()),h=new _.Vector3;return a.intersectBox(r,h),{max:h,min:u}}initGradualMaterial(){let{max:t,min:e}=new _.Box3().setFromObject(this),r=t.clone().sub(e),o=Math.max(r.x,r.y,r.z)/2,s=this.getPosition(),u=new _.Vector3(-1,.2,0).normalize(),{max:l,min:a}=this.getMaxAndMin(s,u),h=this.context.materialFactory.createShaderMaterial({gradualColor:this.options.gradualColor,center:this.getPosition(),maxValue:o,opacity:this.options.fillOpacity,direction:new _.Vector3(-1,.2,0),max:l,min:a});if(this.options.height<=.1)return this.material=h,h;let c=this.getCenter(),f=new _.Vector3(-1,.2,1).normalize(),{max:m,min:d}=this.getMaxAndMin(c,f),x=this.context.materialFactory.createShaderMaterial({gradualColor:[dt(this.options.gradualColor[0],this.options.colorFactor),dt(this.options.gradualColor[1],this.options.colorFactor)],center:this.getCenter(),maxValue:o,opacity:this.options.fillOpacity,direction:new _.Vector3(-1,.2,1),max:m,min:d});return this.material=[h,x],[h,x]}initMaterial(){return this.options.renderType==="gradual"?this.initGradualMaterial():this.initSingleMaterial()}initLineMaterial(){let t=this.context.materialFactory.createLineMaterial({color:this.options.strokeColor,opacity:this.options.strokeOpacity});return this.lineMaterial=t,t}initMesh(){this.mesh&&this.remove(this.mesh),this.mesh=new _.Mesh(this.geometry,this.material),this.add(this.mesh)}getBorderPoints(){let t=[],e=this.options.height+this.options.deltaHeight,{coords:r}=this.options.geometry;for(let o=0;o<r.length;o++){let s=r[o];for(let u=0;u<s.length;u++){let l=s[u],a=u+1===s.length?s[0]:s[u+1];t.push(new _.Vector3(l[0],l[1],e)),t.push(new _.Vector3(a[0],a[1],e))}}return t}initLineGeometry(){this.lineGeometry&&this.lineGeometry.dispose();let t=this.getBorderPoints(),e=new _.BufferGeometry().setFromPoints(t);this.lineGeometry=e}createBorder(){this.line&&this.remove(this.line);let t=new _.LineSegments(this.lineGeometry,this.lineMaterial);return t.position.z=this.options.airHeight+.01,this.line=t,this.add(t),t}raycast(t){if(!this.visible||this.options.geometry.type==="point")return!1;this.mesh.updateMatrixWorld(!0);let e=t.intersectObject(this.mesh);if(e[0]){let{point:r,distance:o}=e[0];return{position:r,distance:o}}return!1}dispose(){this.geometry.dispose(),this.line?.geometry.dispose(),this.clear()}};var N=g("three");var vt=class extends N.Object3D{directionalLight;plane;basicOpacity=.07;constructor(){super(),this.directionalLight=this.initLight(),this.initPlane()}initLight(){let n=re(16777215,.5);return n.position.set(0,0,100),this.add(n),n}changeLightCamera(n){let t=n.x,e=n.y;this.directionalLight.shadow.camera.left=-t,this.directionalLight.shadow.camera.right=t,this.directionalLight.shadow.camera.top=e,this.directionalLight.shadow.camera.bottom=-e,this.directionalLight.shadow.camera.near=.5,this.directionalLight.shadow.camera.far=Math.max(t,e)}changeLightColor(n){this.directionalLight.color=new N.Color(n)}setPosition(n){this.position.copy(n),this.directionalLight.position.set(-n.x/2,-n.y/2,100)}initPlane(n=1e3,t=1e3){let e=new N.PlaneGeometry(n,t),r=new N.ShadowMaterial({transparent:!0,opacity:0,side:N.DoubleSide}),o=new N.Mesh(e,r);return o.receiveShadow=!0,o.position.z=-10,this.add(o),this.plane=o,o}setTarget(n){this.directionalLight.target=n}transformOpacity(n){return n*this.basicOpacity}setOpacity(n){this.plane.material.opacity=this.transformOpacity(n)}dispose(){z(this,!0)}};var Et=g("three");var b=g("three");var de=g("lodash");var an={autoUpdate:!0,appendToBody:!1,autoChangePlacement:!1},xt=class extends b.EventDispatcher{constructor(t,e={}){super();this.context=t;this.options={...an,...e},this.registryEvent(),this.div=this.initDiv(),this.options.appendToBody?document.body.appendChild(this.div):this.context.container.appendChild(this.div)}div;element;position=new b.Vector3;clientPos={x:0,y:0};visible=!0;options;placement="top";observer=null;initObserver(){let t=new MutationObserver((0,de.debounce)(()=>{this.div&&this.usePlacement()},100));t.observe(this.div,{childList:!0,subtree:!0,attributes:!0}),this.observer=t}getPlacementPosition(){if(this.element instanceof I&&this.element.options.geometry.type==="polygon"){let{max:o,min:s}=new b.Box3().setFromObject(this.element),u=(o.x+s.x)/2,l=(o.y+s.y)/2;return{left:new b.Vector3(s.x,l,o.z),leftTop:new b.Vector3(s.x,o.y,o.z),top:new b.Vector3(u,o.y,o.z),rightTop:new b.Vector3(o.x,o.y,o.z),right:new b.Vector3(o.x,l,o.z),rightBottom:new b.Vector3(o.x,s.y,o.z),bottom:new b.Vector3(u,s.y,o.z),leftBottom:new b.Vector3(s.x,s.y,o.z),center:new b.Vector3(u,l,o.z)}}let{x:t,y:e,z:r}=this.element?.getPosition?.()||this.position;return{left:new b.Vector3(t,e,r),leftTop:new b.Vector3(t,e,r),top:new b.Vector3(t,e,r),rightTop:new b.Vector3(t,e,r),right:new b.Vector3(t,e,r),rightBottom:new b.Vector3(t,e,r),bottom:new b.Vector3(t,e,r),leftBottom:new b.Vector3(t,e,r),center:new b.Vector3(t,e,r)}}getPlacementScreenPosition(){let{width:t,height:e}=this.context.clientSize,r=this.getPlacementPosition();return Object.keys(r).reduce((o,s)=>{let{x:u,y:l}=y(r[s],this.context.camera,t,e);return o[s]={x:u,y:l},o},{})}checkOverflow(t,e){let{width:r,height:o}=this.context.clientSize;return e.x>0&&t.x<r&&e.y<o&&t.y>0}getPlacement(){let{clientWidth:t,clientHeight:e}=this.div,r=this.getPlacementScreenPosition(),o=t/2,s=e/2,u=[{type:"center",getBox(l,a){return{max:{x:o+l,y:a-e},min:{x:l-o,y:a}}}},{type:"left",getBox(l,a){return{max:{x:l,y:a-s},min:{x:l-t,y:a+s}}}},{type:"leftTop",getBox(l,a){return{max:{x:l,y:a-e},min:{x:l-t,y:a}}}},{type:"top",getBox(l,a){return{max:{x:l+o,y:a-e},min:{x:l-o,y:a}}}},{type:"rightTop",getBox(l,a){return{max:{x:l+t,y:a-e},min:{x:l,y:a}}}},{type:"right",getBox(l,a){return{max:{x:l+t,y:a-s},min:{x:l,y:a+s}}}},{type:"rightBottom",getBox(l,a){return{max:{x:l+t,y:a},min:{x:l,y:a+e}}}},{type:"bottom",getBox(l,a){return{max:{x:l+o,y:a},min:{x:l-o,y:a+e}}}},{type:"leftBottom",getBox(l,a){return{max:{x:l,y:a},min:{x:l-t,y:a+s}}}}];for(let l=0;l<u.length;l++){let a=u[l],h=r[a.type],{max:c,min:f}=a.getBox(h.x,h.y);if(this.checkOverflow(c,f))return{type:a.type,position:h}}return{type:"center",position:r.center}}initDiv(){let t=document.createElement("div");return t.style.position="absolute",t}usePlacement(){let t=this.getPlacement();this.div.className=`overlay_${t.type}`,this._updatePosition(t.position.x,t.position.y)}bindElement(t){this.element=t,this.options.autoChangePlacement&&this.initObserver(),this.onUpdate()}unBindElement(){this.element=void 0}setVisible(t,e="block"){t!==this.visible&&(this.div.style.display=t?e:"none",this.visible=t)}setOpacity(t){this.div.style.opacity=`${t}`}getPosition(){return this.element?typeof this.element.getPosition=="function"?this.element.getPosition():new b.Box3().setFromObject(this.element).getCenter(new b.Vector3):this.position}get withinDisplayRange(){let{x:t,y:e}=this.clientPos,{width:r,height:o}=this.context.clientSize;return t>=0&&t<=r&&e>=0&&e<=o}_updatePosition(t,e){this.clientPos={x:t,y:e};let{width:r,height:o,x:s,y:u}=this.context.clientSize;this.options.appendToBody&&(this.div.style.left=`${s}px`,this.div.style.top=`${u+o}px`),this.options.autoUpdate?this.div.style.transform=`translate3d(${t}px, ${-o+e}px, 0)`:this.dispatchEvent({type:"update-position",x:t,y:e,width:r,height:o})}updatePosition(t=!1){let e=this.getPosition(),{width:r,height:o}=this.context.clientSize,{x:s,y:u}=y(e,this.context.camera,r,o);this.clientPos.x===s&&this.clientPos.y===u&&!t||this._updatePosition(s,u)}onUpdate=()=>{this.options.autoChangePlacement?this.usePlacement():this.updatePosition()};registryEvent(){this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.removeEventListener("update",this.onUpdate)}dispose(){this.unRegistryEvent(),this.unBindElement(),this.observer?.disconnect(),this.div?.remove(),this.div=null}};var ln={texts:[{text:""}],level:1,icon_position:"bottom",collision_enable:!0,opacity:1,id:"",position:{x:0,y:0,z:0},icon_opacity:1,icon_border:{color:"#586EE0",width:0},background:"",collision_hide_icon:!0,built_in:!1,box_only_icon:!1},rt=class extends Et.EventDispatcher{constructor(t,e){super();this.context=t;this.options=ct({...ln,...e},this),this.position.set(e.position?.x||0,e.position?.y||0,e.position?.z||0),this.overlay=new xt(this.context,{autoUpdate:!1}),this.overlay.addEventListener("update-position",({x:r,y:o,height:s})=>{this.overlay.div.style.transform=`translate3d(calc(${r}px - 50%), calc(${-s+o}px - ${this.options.icon?"100%":"50%"}), 0)`}),this.overlay.bindElement(this),this.registryEvent(),this.initDiv(),this.addEventListener("change-icon",({value:r})=>{r?this.img?this.img.setAttribute("src",r):(this.addIcon(),this._changePosition()):(this.img&&this.div.removeChild(this.img),this.img=void 0,this._changePosition(),this.resetSize())}),this.addEventListener("change-texts",({value:r})=>{this.div.removeChild(this.textDiv),this.addText(),this.resetSize()}),this.addEventListener("change-opacity",({value:r})=>{this.overlay.setOpacity(r)}),this.addEventListener("change-icon_size",({value:r})=>{this.img&&(this.img.style.width=`${r?.[0]||32}px`,this.img.style.height=`${r?.[1]||32}px`,this.resetSize())}),this.addEventListener("change-icon_opacity",({value:r})=>{this.img&&(this.img.style.opacity=`${r}`)}),this.addEventListener("change-icon_border",({value:r})=>{this.img&&(this.img.style.border=`${r.width}px solid ${r.color}`)}),this.addEventListener("change-background",({value:r})=>{this.div.style.background=r})}div;textDiv;img;overlay;options;visible=!0;size={width:0,height:0};position=new Et.Vector3;userData={};showTextStatus=!0;disposed=!1;get withinDisplayRange(){return this.overlay.withinDisplayRange}async resetSize(){if(!this.disposed)if(await ue(),this.options.box_only_icon){if(!this.img)return;let{width:t,height:e}=this.img.getBoundingClientRect();this.size={width:t+2,height:e+2}}else{let{width:t,height:e}=this.div.getBoundingClientRect();this.size={width:t+2,height:e+2}}}renderHelperBox(){}get clientPos(){return this.overlay.clientPos}initDiv(){let t=document.createElement("div");return this.div=t,this.addText(),this.options.icon&&this.addIcon(),t.style.fontSize="12px",t.style.textShadow="#fff 1px 0 0, #fff 0 1px 0, #fff -1px 0 0, #fff 0 -1px 0",t.style.display="flex",t.style.flexDirection="column",t.style.justifyContent="center",t.style.alignItems="center",t.style.padding="4px",this.overlay.setOpacity(this.options.opacity),this.overlay.div.style.pointerEvents="none",this.overlay.div.style.userSelect="none",this.overlay.div.appendChild(t),this.resetSize(),t}addIcon(){if(!this.img){let t=this.initIcon();this.options.icon_position==="top"?this.div.firstChild?this.div.insertBefore(t,this.div.firstChild):this.div.appendChild(t):this.div.appendChild(t)}}addText(){let t=this.initText();this.options.icon_position==="top"?this.div.appendChild(t):this.div.firstChild?this.div.insertBefore(t,this.div.firstChild):this.div.appendChild(t)}getPosition(){return this.position}initText(){let t=document.createElement("div");return t.appendChild(this.createTextFragment()),t.style.textAlign="center",this.textDiv=t,t}createTextFragment(){let t=document.createDocumentFragment();return this.options.texts.forEach(e=>{let r=document.createElement("div");if(r.style.whiteSpace="nowrap",e.styles)for(let[o,s]of Object.entries(e.styles))r.style[o]=s;r.textContent=e.text,t.appendChild(r)}),t}initIcon(){let t=document.createElement("img");return t.setAttribute("src",this.options.icon),t.style.width=`${this.options.icon_size?.[0]||32}px`,t.style.height=`${this.options.icon_size?.[1]||32}px`,t.style.opacity=`${this.options.icon_opacity}px`,t.style.borderRadius="50%",this.options.icon_border.width&&(t.style.border=`${this.options.icon_border.width}px solid ${this.options.icon_border.color}`),t.onload=()=>{this.resetSize()},this.img=t,t}_changePosition=()=>{this.overlay.updatePosition(!0)};registryEvent(){}unRegistryEvent(){}setVisible(t){t!==this.visible&&(this.visible=t,this.changeOverlayVisible(t))}changeOverlayVisible(t){if(!(t===this.overlay.visible&&this.options.collision_hide_icon))if(this.options.collision_hide_icon)this.overlay.visible=t,this.overlay.div.style.visibility=t?"visible":"hidden";else{if(this.showTextStatus===t)return;this.textDiv.style.visibility=t?"visible":"hidden",this.showTextStatus=t}}parentSetVisible(t){this.visible&&this.changeOverlayVisible(t)}getBox(t=this.context.config.poi.boxScale){let{width:e,height:r}=this.size,o=e*t,s=r*t,{x:u,y:l}=this.overlay.clientPos;return{left:u-o/2,right:u+o/2,top:this.options.icon?l-s:l-s/2,bottom:this.options.icon?l:l+s/2}}getOriginBox(){return this.getBox(1)}isContain(t,e){if(!this.overlay.visible||!this.visible)return!1;let r=this.getOriginBox();return t>=r.left&&t<=r.right&&e>=r.top&&e<=r.bottom}dispose(){this.unRegistryEvent(),this.div=null,this.textDiv=null,this.img=void 0,this.overlay.dispose(),this.disposed=!0}};var P=g("three");var St=g("three");var ge=g("three");var $=class extends ge.Object3D{constructor(t){super();this.context=t}dispose(){z(this),this.clear()}};var bt=class extends ${graphicMap=new Map;constructor(n){super(n)}getCenter(){return new St.Box3().setFromObject(this).getCenter(new St.Vector3)}createGraphic(n){let t=new I(this.context,n);return this.add(t),this.graphicMap.set(n.id,t),t}removeGraphic(n){this.remove(n),this.graphicMap.delete(n.options.id),n.dispose()}removeGraphicById(n){this.graphicMap.has(n)&&this.removeGraphic(this.graphicMap.get(n))}getGraphicByNodeId(n){return this.graphicMap.get(n)||null}getGraphicByRaycaster(n){let t={distance:1e4,graphic:null,position:null},e=this.children.reduce((r,o)=>{if(o instanceof I){let s=o.raycast(n);if(s){let{distance:u}=s;if(u<r.distance)return{distance:r.distance,position:r.position,graphic:o}}return r}else return r},t);return e===t?{graphics:[],position:null}:{graphics:[e.graphic],position:e.position}}};var me=g("lodash");var Mt=class extends ${pois=[];debounceCollisionDetection;timer=new U;constructor(n){super(n),this.registryEvent(),this.debounceCollisionDetection=(0,me.debounce)(this.collisionDetection,10)}clear(n=!1){return this.pois.forEach(t=>{t.options.built_in&&!n||t.dispose()}),this.pois=n?[]:this.pois.filter(t=>t.options.built_in),this}createPoi(n){let t=new rt(this.context,n);return this.pushPoi(t),t.addEventListener("change-level",()=>this.changePoiLevelOrCollisionEnable(t)),t.addEventListener("change-collision_enable",()=>this.changePoiLevelOrCollisionEnable(t)),Promise.resolve().then(()=>{this.debounceCollisionDetection()}),t}changePoiLevelOrCollisionEnable(n){let t=this.pois.findIndex(e=>e===n);t!==-1&&(this.pois.splice(t,1),this.pushPoi(n))}removePoi(n){let t=this.pois.findIndex(e=>e===n);t!==-1&&(this.pois.splice(t,1),n.dispose())}removePoiById(n){let t=this.pois.find(e=>e.options.id===n);t&&this.removePoi(t)}getPoiById(n){return this.pois.find(e=>e.options.id===n)||null}pushPoi(n){if(!n.options.collision_enable){this.pois.unshift(n);return}if(n.options.level===0){this.pois.push(n);return}for(let t=0;t<this.pois.length;t++){let e=this.pois[t];if(e.options.collision_enable&&e.options.level<=n.options.level){this.pois.splice(t,0,n);return}}this.pois.push(n)}getPoiByDeviceXy(n,t){return this.pois.filter(r=>r instanceof rt&&r.isContain(n,t))}onUpdate=()=>{this.timer.requestAnimationFrame(()=>{this.collisionDetection()})};collisionDetection(){let n=[];this.pois.filter(e=>e.visible&&e.withinDisplayRange).forEach((e,r)=>{let{left:o,right:s,top:u,bottom:l}=e.getBox();if(r===0||!e.options.collision_enable){n.push({left:o,right:s,top:u,bottom:l}),e.parentSetVisible(!0);return}let a=n.some(h=>h.left<s&&h.right>o&&h.top<l&&h.bottom>u);e.parentSetVisible(!a),a||n.push({left:o,right:s,top:u,bottom:l})})}registryEvent(){this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.removeEventListener("update",this.onUpdate)}dispose(){this.timer.dispose(),this.pois.forEach(n=>n.dispose()),this.pois.length=0,this.debounceCollisionDetection=()=>{},super.dispose(),this.unRegistryEvent()}};var w=g("three"),ye=g("@mars3d/heatmap.js"),k=g("@turf/turf"),wt=class extends w.Object3D{constructor(t){super();this.context=t;this.div=document.createElement("div")}heatmap;div;plane;clearHeatmap(){this.div.firstChild&&this.div.removeChild(this.div.firstChild),this.heatmap=void 0}loadData(t){this.clearHeatmap();let{width:e,height:r,leftTop:o,center:s}=this.getBox(t);this.heatmap=(0,ye.create)({width:e,height:r,container:this.div,...this.context.config.heatMap}),this.heatmap.setData(this.transformData(t,o)),this.initPlane(e,r),this.position.set(s[0],s[1],this.position.z)}initPlane(t,e){this.plane&&this.remove(this.plane);let r=new w.PlaneGeometry(t,e),o=new w.Texture(this.div.firstChild);o.needsUpdate=!0;let s=new w.MeshBasicMaterial({transparent:!0,side:w.DoubleSide,map:o});s.needsUpdate=!0,this.plane=new w.Mesh(r,s),this.add(this.plane)}getTransMatrix({x:t,y:e}){return new w.Matrix3().makeScale(1,-1).multiply(new w.Matrix3().makeTranslation(0-t,0-e))}transformData(t,e){let r=this.getTransMatrix(e);return{data:t.data.map(s=>{let u=new w.Vector2(s.x,s.y).applyMatrix3(r);return{x:u.x,y:u.y,value:s.value}}),max:t.max,min:t.min}}getBox(t){let e=(0,k.featureCollection)(t.data.map(a=>(0,k.point)([a.x,a.y]))),r=(0,k.bbox)(e),o=r[2]-r[0],s=r[3]-r[1],u={x:r[0],y:r[3]},l=(0,k.center)(e);return{width:o,height:s,leftTop:u,center:l.geometry.coordinates}}dispose(){this.div=null,this.heatmap=void 0}};var j=g("three");var Tt=class extends j.Object3D{constructor(t,e){super();this.context=t;this.options=e;this.position.copy(e.position||new j.Vector3(0,0,0)),this.loadModel()}poi=null;model=null;async loadModel(){let t=await ce(this.options.modelUrl);t.scene.rotation.set(Math.PI/2,Math.PI/2,0),this.add(t.scene),this.model=t,this.initPoi()}initPoi(){if(!this.options.icon)return;let t=this.context.currentFloor?.addPoi({icon:this.options.icon,icon_size:this.options.icon_size,built_in:!0,level:0});this.poi=t||null,this.model&&t&&(t.position=new j.Box3().setFromObject(this).getCenter(new j.Vector3))}dispose(){z(this),this.model=null,this.poi&&(this.context.currentFloor?.poiLayer.removePoi(this.poi),this.poi=null)}};var Ct=class extends P.Object3D{constructor(t){super();this.context=t;this.graphicLayer=new bt(this.context),this.poiLayer=new Mt(this.context),this.groundUpper.add(this.graphicLayer),this.groundUpper.add(this.poiLayer),this.add(this.groundUpper),this.add(this.models)}graphicLayer;poiLayer;grounds=new Set;shadow=new vt;heatmap;groundUpper=new P.Object3D;models=new P.Object3D;modelMap=new Map;groundMaxHeight=0;name="";key="";getPosition(){return new P.Box3().setFromObject(this.groundUpper).getCenter(new P.Vector3)}createGround(t){let e=new I(this.context,t);this.addGrounds([e])}addGrounds(t){t.forEach(e=>{this.grounds.has(e)||(e.mesh.castShadow=!0,this.grounds.add(e),this.groundUpper.add(e))}),this.changeGroundMaxHeight()}changeGroundMaxHeight(){let t=Array.from(this.grounds);this.groundMaxHeight=this.grounds.size>0?Math.max(...t.map(e=>e.options.height+e.options.airHeight+e.options.deltaHeight)):0,this.graphicLayer.position.z=this.groundMaxHeight,this.models.position.z=this.groundMaxHeight}get hasElement(){return!!(this.grounds.size||this.graphicLayer.children.length)}getCenter(){return new P.Box3().setFromObject(this.groundUpper).getCenter(new P.Vector3)}addModel(t){let e=new Tt(this.context,t);return this.models.add(e),this.modelMap.set(t.id,e),e}addShadow(){let t=new P.Box3().setFromObject(this.groundUpper),e=t.getCenter(new P.Vector3),r=t.getSize(new P.Vector3);this.shadow.setPosition(e),this.shadow.changeLightCamera(r)}addGraphic(t){return this.graphicLayer.createGraphic(t)}addPoi(t){return this.poiLayer.createPoi(t)}addHeatmap(t){this.heatmap||(this.heatmap=new wt(this.context),this.add(this.heatmap)),this.heatmap.loadData(t);let e=new P.Box3().setFromObject(this.graphicLayer);return this.heatmap.position.setZ(e.max.z),this.heatmap}removeHeatMap(){this.heatmap&&(this.remove(this.heatmap),this.heatmap.dispose(),this.heatmap=void 0)}setShadowOpacity(t){this.shadow.setOpacity(t)}setShadowVisible(t){this.shadow.visible=t}dispose(){this.shadow.dispose(),this.graphicLayer.dispose(),this.poiLayer.dispose(),this.grounds.forEach(t=>t.dispose()),this.heatmap?.dispose(),this.groundUpper.clear(),this.models.children.forEach(t=>t.dispose()),this.models.clear(),this.modelMap.clear(),this.clear()}};var Pt=g("three");var B=class extends Pt.EventDispatcher{constructor(t){super();this.context=t;this.svg=le(`${t.container.clientWidth}`,`${t.container.clientHeight}`),t.container.appendChild(this.svg),this._registryEvent()}points=[];svg;enable=!0;_onResize=({width:t,height:e})=>{this.svg&&(this.svg.setAttribute("width",`${t}`),this.svg.setAttribute("height",`${e}`))};_registryEvent(){this.context.addEventListener("resize",this._onResize)}_unRegistryEvent(){this.context.removeEventListener("resize",this._onResize)}setEnable(t){this.enable=t,t?this.svg.style.display="block":this.svg.style.display="none"}getIntersectByPointerEvent(t){let{camera:e,renderer:r}=this.context,{offsetX:o,offsetY:s}=t,{clientWidth:u,clientHeight:l}=r.domElement,a=o/u*2-1,h=1-s/l*2;return new Pt.Vector3(a,h,0).unproject(e)}getSvgCoordinate(t){let{camera:e,container:r}=this.context;return y(t,e,r.clientWidth,r.clientHeight)}dispose(){this._unRegistryEvent(),this.context.container.removeChild(this.svg),this.svg=null}};var At=class extends B{constructor(t){super(t);this.context=t;let{config:{svg:{circle:e,line:r}}}=t;this.circles=[et(e.radius,e.fill),et(e.radius,e.fill)],this.line=ft(r.stroke),this.svg.appendChild(this.circles[0]),this.svg.appendChild(this.circles[1]),this.svg.appendChild(this.line),this.registryEvent()}circles;line;setEnable(t){super.setEnable(t),t?this.registryEvent():this.unRegistryEvent()}registryEvent(){this.context.container.addEventListener("pointerenter",this.onPointermove),this.context.container.addEventListener("pointermove",this.onPointermove),this.context.container.addEventListener("pointerleave",this.onPointerleave),this.context.container.addEventListener("pointerdown",this.onPointerdown),this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.container.removeEventListener("pointerenter",this.onPointermove),this.context.container.removeEventListener("pointermove",this.onPointermove),this.context.container.removeEventListener("pointerleave",this.onPointerleave),this.context.container.removeEventListener("pointerdown",this.onPointerdown),this.context.removeEventListener("update",this.onUpdate)}onUpdate=()=>{if(this.points[0]){let t=this.getSvgCoordinate(this.points[0]);q(this.circles[0],t.x,t.y),D(this.line,t)}if(this.points[1]){let t=this.getSvgCoordinate(this.points[1]);q(this.circles[1],t.x,t.y),D(this.line,void 0,t)}};onPointermove=t=>{this.points.length===1&&(this.line.style.display="block",D(this.line,void 0,{x:t.offsetX,y:t.offsetY}))};onPointerleave=()=>{this.points[1]||(this.line.style.display="none")};onPointerdown=t=>{if(this.points[1])return;let e=this.getIntersectByPointerEvent(t);if(e){let{offsetX:r,offsetY:o}=t,s=this.circles[this.points.length];q(s,r,o),this.points.length||D(this.line,{x:r,y:o},{x:r,y:o}),this.addPoint(e)}};addPoint(t){if(this.points.push(t),this.points.length>=2){let e=this.calculatedDistance();this.dispatchEvent({type:"distance",distance:e})}}calculatedDistance(){let[{x:t,y:e},{x:r,y:o}]=this.points;return Math.sqrt((r-t)**2+(o-e)**2)}dispose(){super.dispose(),this.unRegistryEvent(),this.line=null,this.circles=[]}};var Rt=class extends B{circles=[];lines=[];isClose=!1;constructor(n){super(n),this.registryEvent()}setEnable(n){super.setEnable(n),n?this.registryEvent():this.unRegistryEvent()}get lastLine(){return this.lines.slice(-1)[0]}addCircle(n){this.circles.push(n),this.svg.appendChild(n)}addLine(n){this.lines.push(n),this.svg.appendChild(n)}registryEvent(){this.context.container.addEventListener("pointerenter",this.onPointermove),this.context.container.addEventListener("pointermove",this.onPointermove),this.context.container.addEventListener("pointerleave",this.onPointerleave),this.context.container.addEventListener("pointerdown",this.onPointerdown),this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.container.removeEventListener("pointerenter",this.onPointermove),this.context.container.removeEventListener("pointermove",this.onPointermove),this.context.container.removeEventListener("pointerleave",this.onPointerleave),this.context.container.removeEventListener("pointerdown",this.onPointerdown),this.context.removeEventListener("update",this.onUpdate)}onUpdate=()=>{this.points.length&&this.points.forEach((n,t)=>{let e=this.getSvgCoordinate(n);this.circles[t]&&q(this.circles[t],e.x,e.y),t!==0&&D(this.lines[t-1],void 0,e),this.lines[t]&&D(this.lines[t],e)})};onPointermove=n=>{!this.lastLine||this.isClose||(this.lastLine.style.display="block",D(this.lastLine,void 0,{x:n.offsetX,y:n.offsetY}))};onPointerleave=()=>{this.isClose||(this.lastLine.style.display="none")};onPointerdown=n=>{if(this.isClose)return;let t=this.getIntersectByPointerEvent(n);if(t){let{offsetX:e,offsetY:r}=n;this.checkAdsorb(e,r)?(this.isClose=!0,this.addPoint(this.points[0])):this.addPoint(t);let{circle:{fill:o,radius:s},line:{stroke:u}}=this.context.config.svg;if(!this.isClose){let l=et(s,o);q(l,e,r),this.addCircle(l)}if(this.lines.length&&D(this.lastLine,void 0,{x:e,y:r}),!this.isClose){let l=ft(u);D(l,{x:e,y:r},{x:e,y:r}),this.addLine(l)}}};checkAdsorb(n,t){if(this.points.length<3)return!1;let e=this.circles[0],r=+e.getAttribute("cx"),o=+e.getAttribute("cy");return Math.sqrt((n-r)**2+(t-o)**2)<=5}addPoint(n){if(this.points.push(n),this.isClose){let t=this.calculatedArea();this.dispatchEvent({type:"area",area:t})}}calculatedArea(){let n=this.points.map(r=>[r.x,r.y]),t=0,e=n.length;for(let r=0;r<e;r++){let o=(r+1)%e;t+=n[r][0]*n[o][1]-n[o][0]*n[r][1]}return Math.abs(t/2)}dispose(){super.dispose(),this.unRegistryEvent(),this.lines=[],this.circles=[]}};var ve=g("three");var _e=class extends B{constructor(t){super(t);this.context=t;let{config:{svg:{line:e}}}=t;this.rect=J(e.stroke,"transparent"),this.svg.appendChild(this.rect);for(let r=0;r<4;r++)this.cornerRect[r]=J(e.stroke,"#ffffff"),this.centerRect[r]=J(e.stroke,"#ffffff"),this.svg.appendChild(this.cornerRect[r]),this.svg.appendChild(this.centerRect[r]);this.registryEvent()}rect;cornerRect=[];centerRect=[];graphic;setEnable(t){super.setEnable(t),t?this.registryEvent():this.unRegistryEvent()}registryEvent(){this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.removeEventListener("update",this.onUpdate)}onUpdate=()=>{if(this.graphic){let t=new ve.Box3().setFromObject(this.graphic),{camera:e,container:{clientWidth:r,clientHeight:o}}=this.context,{min:s,max:u}=t,l=y(s,e,r,o),a=y(u,e,r,o);O(this.rect,l.x,a.y,Math.abs(a.x-l.x),Math.abs(a.y-l.y));let{x:h,y:c}=l,{x:f,y:m}=a,d=5,x=[{x:h-d,y:m-d},{x:f-d,y:m-d},{x:h-d,y:c-d},{x:f-d,y:c-d}];for(let T=0;T<x.length;T++)O(this.cornerRect[T],x[T].x,x[T].y,d*2,d*2);let v=4,A=(h+f)/2,R=(c+m)/2,G=[{x:A-v,y:m-v},{x:h-v,y:R-v},{x:f-v,y:R-v},{x:A-v,y:c-v}];for(let T=0;T<G.length;T++)O(this.centerRect[T],G[T].x,G[T].y,v*2,v*2)}else{O(this.rect,0,0,0,0);for(let t=0;t<this.cornerRect.length;t++)O(this.cornerRect[t],0,0,0,0),O(this.centerRect[t],0,0,0,0)}};selectGraphic(t){this.graphic=t}dispose(){super.dispose(),this.unRegistryEvent(),this.rect=null,this.cornerRect=[],this.centerRect=[]}};var xe=g("three"),It=class extends B{startPoint;endPoint;rect;frustum=new xe.Frustum;constructor(n){super(n);let{config:{selectBox:{fill:t,stroke:e}}}=n;this.rect=J(e,t),this.svg.appendChild(this.rect),this.registryEvent()}setEnable(n){super.setEnable(n),O(this.rect,0,0,0,0),n?this.registryEvent():(this.startPoint=void 0,this.unRegistryEvent())}onPointerDown=n=>{if(!this.enable)return;let t=this.getIntersectByPointerEvent(n);t&&(this.startPoint=t),this.endPoint=void 0};onPointerMove=n=>{if(!this.enable||!this.startPoint)return;let t=this.getIntersectByPointerEvent(n);t&&(this.endPoint=t)};onPointerUp=n=>{if(!this.enable)return;let t=this.getIntersectByPointerEvent(n);t&&(this.endPoint=t),this.doSelect(),this.startPoint=void 0};onUpdate=()=>{if(this.startPoint){let n=this.getSvgCoordinate(this.startPoint),t={...n};this.endPoint&&(t=this.getSvgCoordinate(this.endPoint));let e={x:Math.min(n.x,t.x),y:Math.min(n.y,t.y)},r=Math.abs(t.x-n.x),o=Math.abs(t.y-n.y);O(this.rect,e.x,e.y,r,o)}else O(this.rect,0,0,0,0)};registryEvent(){this.context.container.addEventListener("pointerdown",this.onPointerDown),this.context.container.addEventListener("pointermove",this.onPointerMove),this.context.container.addEventListener("pointerup",this.onPointerUp),this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.container.removeEventListener("pointerdown",this.onPointerDown),this.context.container.removeEventListener("pointermove",this.onPointerMove),this.context.container.removeEventListener("pointerup",this.onPointerUp),this.context.removeEventListener("update",this.onUpdate)}doSelect(){if(this.startPoint&&this.endPoint){if(this.startPoint.distanceTo(this.endPoint)<.1)return;let{context:{camera:t,container:{clientWidth:e,clientHeight:r}}}=this,o=y(this.startPoint,t,e,r),s=y(this.endPoint,t,e,r),u={x:Math.min(o.x,s.x),y:Math.min(o.y,s.y)},l={x:Math.max(o.x,s.x),y:Math.max(o.y,s.y)},a=this.searchMapInFrustum(u,l);this.dispatchEvent({type:"selected",list:a})}}searchMapInFrustum(n,t){let{context:e}=this;return e.currentFloor?.graphicLayer.children.filter(r=>r instanceof I&&this.searchChildInFrustum(r,n,t))||[]}searchChildInFrustum(n,t,e){let{context:{camera:r,container:{clientWidth:o,clientHeight:s}}}=this;if(!n)return!1;if(!n.mesh){let f=n.getPosition();if(f){let m=y(f,r,o,s);return ht(m,t,e)}return!1}n.mesh.geometry.boundingBox||n.mesh.geometry.computeBoundingBox();let u=n.mesh.geometry.boundingBox;if(!u)return!1;let{min:l,max:a}=u,h=y(l,r,o,s),c=y(a,r,o,s);return!(!ht(h,t,e)||!ht(c,t,e))}dispose(){this.unRegistryEvent()}};var Lt=class extends Ee.EventDispatcher{constructor(t){super();this.context=t;this.boxSelection=new It(t),this.boxSelection.setEnable(!1),this.registryEvent()}_list=new Set;boxSelection;prevPanStatus;prevRotateStatus;downPoint=null;isMultipleSelect=!1;get list(){return this._list}enableBoxSelection(){this.isMultipleSelect||(this.isMultipleSelect=!0,this.boxSelection.setEnable(!0),this.prevPanStatus=this.context.control.enablePan,this.prevRotateStatus=this.context.control.enableRotate,this.context.control.enablePan=!1,this.context.control.enableRotate=!1)}disableBoxSelection(){this.isMultipleSelect&&(this.isMultipleSelect=!1,this.boxSelection.setEnable(!1),this.context.control.enablePan=!!this.prevPanStatus,this.context.control.enableRotate=!!this.prevRotateStatus)}onPointerDown=t=>{this.downPoint={x:t.offsetX,y:t.offsetY}};onPointerUp=t=>{if(!this.downPoint)return;let{offsetX:e,offsetY:r}=t,{x:o,y:s}=this.downPoint;if(Math.sqrt((o-e)**2+(s-r)**2)>3)return;let{graphics:u}=this.context.getGraphicsByDeviceXy(e,r),l=new Set(u.map(h=>h.options.id));this.context.getPoisByDeviceXy(e,r).forEach(h=>{if(!l.has(h.options.id)){let c=this.context.currentFloor?.graphicLayer.graphicMap.get(h.options.id)||null;c&&c.options.geometry.type==="point"&&(u.push(c),l.add(h.options.id))}}),(yt?t.metaKey:t.ctrlKey)||this._list.clear(),u.forEach(h=>this._list.add(h)),this.selectEnd(),this.downPoint=null};onPointerOut=t=>{this.disableBoxSelection()};onKeyDown=t=>{Vt(t.key)&&this.enableBoxSelection()};onKeyUp=t=>{Vt(t.key)&&this.disableBoxSelection()};onBoxSelected=({list:t})=>{this._list.clear(),t.forEach(e=>{this._list.add(e)}),this.selectEnd()};selectEnd(){this.dispatchEvent({type:"select",graphics:[...this._list],isMultipleSelect:this.isMultipleSelect})}registryEvent(){this.context.container.addEventListener("pointerdown",this.onPointerDown),this.context.container.addEventListener("pointerup",this.onPointerUp),this.context.container.addEventListener("pointerout",this.onPointerOut),this.context.container.addEventListener("pointercancel",this.onPointerOut),window.addEventListener("keydown",this.onKeyDown),window.addEventListener("keyup",this.onKeyUp),this.boxSelection.addEventListener("selected",this.onBoxSelected)}unRegistryEvent(){this.context.container.removeEventListener("pointerdown",this.onPointerDown),this.context.container.removeEventListener("pointerup",this.onPointerUp),this.context.container.removeEventListener("pointerout",this.onPointerOut),this.context.container.removeEventListener("pointercancel",this.onPointerOut),window.removeEventListener("keydown",this.onKeyDown),window.removeEventListener("keyup",this.onKeyUp),this.boxSelection.removeEventListener("selected",this.onBoxSelected)}clear(){this._list.clear()}remove(t){this._list.delete(t)}dispose(){this.unRegistryEvent()}};var be=g("three");var Nt=class extends be.EventDispatcher{constructor(t){super();this.context=t;this.registryEvent()}curGraphics=new Set;timer=new U;graphicTimerMap=new Map;onPointerMove=({graphics:t,pois:e,e:r})=>{let o=e.map(a=>this.context.currentFloor?.graphicLayer.graphicMap.get(a.options.id)).filter(a=>a&&a.options.geometry.type==="point");if(!t.length&&!o.length&&this.curGraphics.size){this.curGraphics.clear(),this.handleHoverGraphicsChange();return}let{time:s}=this.context.config.hover,u=new Set;if(o.length){let a,h=1e4;o.forEach(c=>{let f=e.find(v=>v.options.id===c.options.id),{x:m,y:d}=f.clientPos,x=Math.sqrt((m-r.offsetX)**2+(d-r.offsetY)**2);x<h&&(h=x,a=c)}),u.add(a)}u.size||t.forEach(a=>u.add(a)),u.forEach(a=>{if(this.graphicTimerMap.get(a)||this.curGraphics.has(a))return;let h=this.timer.setTimeout(()=>{this.curGraphics.add(a),this.graphicTimerMap.delete(a),this.timer.clearTimeout(h),this.handleHoverGraphicsChange()},s);this.graphicTimerMap.set(a,h)}),this.graphicTimerMap.forEach((a,h)=>{u.has(h)||(this.timer.clearTimeout(a),this.graphicTimerMap.delete(h))});let l=this.curGraphics.size;this.curGraphics.forEach(a=>{u.has(a)||this.curGraphics.delete(a)}),l!==this.curGraphics.size&&this.handleHoverGraphicsChange()};onPointerLevel=()=>{this.curGraphics.clear(),this.handleHoverGraphicsChange()};handleHoverGraphicsChange(t=this.curGraphics){this.dispatchEvent({type:"hover-change",graphics:Array.from(t)})}registryEvent(){this.context.addEventListener("pointer-over",this.onPointerMove),this.context.addEventListener("pointer-move",this.onPointerMove),this.context.addEventListener("pointer-level",this.onPointerLevel)}unRegistryEvent(){this.context.removeEventListener("pointer-over",this.onPointerMove),this.context.removeEventListener("pointer-move",this.onPointerMove),this.context.removeEventListener("pointer-level",this.onPointerLevel)}dispose(){this.unRegistryEvent(),this.timer.dispose()}};var C=g("three");function Se(i){return`${i.x}-${i.y}-${i.z}`}var Dt=class{constructor(n){this.context=n}lineMaterialMap=new Map;meshStandardMaterialMap=new Map;meshBasicMaterialMap=new Map;shaderMaterialMap=new Map;generateLineMaterialKey({color:n,opacity:t}){return`${n}-${t}`}createLineMaterial({color:n,opacity:t}){let e=this.generateLineMaterialKey({color:n,opacity:t});if(this.lineMaterialMap.has(e))return this.lineMaterialMap.get(e);let r=new C.LineBasicMaterial({color:new C.Color(n).convertLinearToSRGB(),transparent:!0,opacity:t});return this.lineMaterialMap.set(e,r),r}createMeshStandardMaterial({color:n,opacity:t}){let e=`${n}-${t}`;if(this.meshStandardMaterialMap.has(e))return this.meshStandardMaterialMap.get(e);let r=new C.MeshStandardMaterial({color:new C.Color(n).convertLinearToSRGB(),roughness:1,transparent:!0,opacity:t,depthWrite:!0});return this.meshStandardMaterialMap.set(e,r),r}createMeshBasicMaterial({color:n,opacity:t}){let e=`${n}-${t}`;if(this.meshBasicMaterialMap.has(e))return this.meshBasicMaterialMap.get(e);let r=new C.MeshBasicMaterial({color:n,transparent:!0,opacity:t,depthWrite:!0});return this.meshBasicMaterialMap.set(e,r),r}createShaderMaterial({gradualColor:n,center:t,maxValue:e,opacity:r,direction:o,max:s,min:u}){let l=`${n.toString()}-${Se(t)}-${e}-${r}-${Se(o)}`;if(this.shaderMaterialMap.has(l))return this.shaderMaterialMap.get(l);let a=`
2
2
  uniform vec3 uColor;
3
3
  uniform vec3 uGradualColor;
4
4
  uniform vec3 center;
@@ -35,7 +35,7 @@
35
35
  void main() {
36
36
  gl_FragColor = vec4(vColor.x, vColor.y, vColor.z, opacity);
37
37
  }
38
- `,c=new C.ShaderMaterial({uniforms:{uColor:{value:new C.Color(n[0]).convertLinearToSRGB()},uGradualColor:{value:new C.Color(n[1]).convertLinearToSRGB()},center:{value:t},maxValue:{value:e},opacity:{value:r},uDirection:{value:o},uMax:{value:s},uMin:{value:u}},vertexShader:a,fragmentShader:h,side:C.DoubleSide});return this.shaderMaterialMap.set(l,c),c}dispose(){this.lineMaterialMap.forEach((n,t)=>{n.dispose()}),this.lineMaterialMap.clear(),this.meshStandardMaterialMap.forEach((n,t)=>{n.dispose()}),this.meshStandardMaterialMap.clear(),this.meshBasicMaterialMap.forEach((n,t)=>{n.dispose()}),this.meshBasicMaterialMap.clear(),this.shaderMaterialMap.forEach((n,t)=>{n.dispose()}),this.shaderMaterialMap.clear()}};var Y=g("three");var Ot=class{constructor(n){this.context=n;this.registryEvent(),this.changePrevCamera()}prevCamera={position:new Y.Vector3,zoom:1,target:new Y.Vector3};enable=!0;setEnable(n){this.enable=n,n?this.registryEvent():this.unRegistryEvent()}changePrevCamera(){this.prevCamera={position:this.context.camera.position.clone(),zoom:this.context.camera.zoom,target:this.context.control.target.clone()}}backToPrevCamera(){this.setEnable(!1),this.context.camera.position.copy(this.prevCamera.position),this.context.camera.zoom=this.prevCamera.zoom,this.context.control.target.copy(this.prevCamera.target),this.context.control.update(),this.setEnable(!0)}registryEvent(){this.context.addEventListener("control-change",this.onCameraChange)}unRegistryEvent(){this.context.removeEventListener("control-change",this.onCameraChange)}getCurFloorScreenPosition(){if(!this.context.currentFloor)return null;let n=new Y.Box3().setFromObject(this.context.currentFloor.groundUpper),{camera:t,container:{clientWidth:e,clientHeight:r}}=this.context,{min:o,max:s}=n,u=y(o,t,e,r),l=y(s,t,e,r),a=y(new Y.Vector3(o.x,s.y,s.z),t,e,r),h=y(new Y.Vector3(s.x,o.y,o.z),t,e,r),c=Math.min(u.x,l.x,a.x,h.x),f=Math.max(u.x,l.x,a.x,h.x),m=Math.min(u.y,l.y,a.y,h.y),d=Math.max(u.y,l.y,a.y,h.y);return{left:c,right:f,top:m,bottom:d}}checkDistanceToScreenEdge({left:n,right:t,top:e,bottom:r}){let{width:o,height:s}=this.context.clientSize,[u,l,a,h]=this.context.config.cameraBound.padding;return n<=h&&o-t<=l&&e<=u&&s-r<=a}onCameraChange=()=>{};dispose(){this.unRegistryEvent()}};var Ft=class extends E.EventDispatcher{constructor(t,e){super();this.container=t;this.config=e;this.container.style.position="relative",this.container.style.overflow="hidden",this.init(),this.selection=new Lt(this),this.hoverHelper=new Nt(this),this.materialFactory=new Dt(this),this.resizeClientSize(),this.registryEvent()}scene=Jt();renderer=$t();camera;control;lights=te();timer=new U;tweenGroup=new Z.Group;currentFloor;selection;hoverHelper;basicRatio;materialFactory;cameraBound;clientSize={width:0,height:0,x:0,y:0};resizeClientSize(){let{x:t,y:e,width:r,height:o}=this.container.getBoundingClientRect();this.clientSize={width:r||this.container.clientWidth,height:o||this.container.clientHeight,x:t,y:e}}init(){let{clientWidth:t,clientHeight:e}=this.container;this.camera=Qt(t,e),this.renderer.setSize(t,e),this.control=ee(this.camera,this.renderer.domElement),this.control.maxPolarAngle=this.config.control.maxPolar,this.container.appendChild(this.renderer.domElement),this.scene.add(this.lights),this.basicRatio=this.getRatio(),this.control.addEventListener("change",()=>{let r=this.control.getPolarAngle();this.currentFloor?.setShadowOpacity(r/this.config.control.maxPolar),this.dispatchEvent({type:"change-ratio",px:(this.basicRatio||0)*this.camera.zoom}),this.dispatchEvent({type:"control-change"})}),this.cameraBound=new Ot(this)}getRatio(t=new E.Vector3(0,0,0),e=new E.Vector3(100,0,0)){let{clientWidth:r,clientHeight:o}=this.container,s=y(t,this.camera,r,o),u=y(e,this.camera,r,o);return Math.ceil(Math.sqrt((u.x-s.x)**2+(u.y-s.y)**2))}changeAmbientLightColor(t){this.lights.children.forEach(e=>{e instanceof E.AmbientLight&&(e.color=new E.Color(t))})}switchFloor(t){this.currentFloor&&(this.scene.remove(this.currentFloor),this.currentFloor.dispose()),this.currentFloor=t,this.scene.add(t);let e=t.getCenter();e&&(this.lights.position.x=e.x,this.lights.position.y=e.y)}onWindowResize=()=>{let{container:t,camera:e,renderer:r}=this,{clientWidth:o,clientHeight:s}=t;o=Math.max(1,o),s=Math.max(1,s),e.left=-o/2,e.right=o/2,e.top=s/2,e.bottom=-s/2,e.updateProjectionMatrix(),r.setSize(o,s),this.resizeClientSize(),this.dispatchEvent({type:"resize",width:o,height:s})};onClick=t=>{let{graphics:e,position:r}=this.getGraphicsByDeviceXy(t.offsetX,t.offsetY);e.length&&this.dispatchEvent({type:"graphic-click",graphics:e,position:r});let o=this.getPoisByDeviceXy(t.offsetX,t.offsetY);o.length&&this.dispatchEvent({type:"poi-click",pois:o})};getGraphicsByDeviceXy(t,e){let r=new E.Vector2;r.x=t/this.clientSize.width*2-1,r.y=e/this.clientSize.height*-2+1;let o=new E.Raycaster;return o.setFromCamera(r,this.camera),this.currentFloor?.graphicLayer.getGraphicByRaycaster(o)||{graphics:[],position:null}}getPoisByDeviceXy(t,e){return this.currentFloor?.poiLayer.getPoiByDeviceXy(t,e)||[]}onPointerover=t=>{let{graphics:e,position:r}=this.getGraphicsByDeviceXy(t.offsetX,t.offsetY),o=this.getPoisByDeviceXy(t.offsetX,t.offsetY);this.dispatchEvent({type:"pointer-over",e:t,graphics:e,pois:o,position:r})};onPointermove=t=>{let{graphics:e,position:r}=this.getGraphicsByDeviceXy(t.offsetX,t.offsetY),o=this.getPoisByDeviceXy(t.offsetX,t.offsetY);this.dispatchEvent({type:"pointer-move",e:t,graphics:e,pois:o,position:r})};onPointerleave=()=>{this.dispatchEvent({type:"pointer-level"})};onSelectionSelect=({graphics:t,isMultipleSelect:e})=>{this.dispatchEvent({type:"select-graphic",graphics:t,isMultipleSelect:e})};onHoverChange=({graphics:t})=>{this.dispatchEvent({type:"hover",graphics:t})};registryEvent(){window.addEventListener("resize",this.onWindowResize),this.container.addEventListener("click",this.onClick),this.container.addEventListener("pointerover",this.onPointerover),this.container.addEventListener("pointermove",this.onPointermove),this.container.addEventListener("pointerleave",this.onPointerleave),this.selection.addEventListener("select",this.onSelectionSelect),this.hoverHelper.addEventListener("hover-change",this.onHoverChange)}unRegistryEvent(){window.removeEventListener("resize",this.onWindowResize),this.container.removeEventListener("click",this.onClick),this.container.removeEventListener("pointerover",this.onPointerover),this.container.removeEventListener("pointermove",this.onPointermove),this.container.removeEventListener("pointerleave",this.onPointerleave),this.selection.removeEventListener("select",this.onSelectionSelect),this.hoverHelper.removeEventListener("hover-change",this.onHoverChange)}setPolarAngle(t,e=500){return e===0?(this.control.maxPolarAngle=t,this.control.minPolarAngle=t,this.control.update(),this.control.maxPolarAngle=this.config.control.maxPolar,this.control.minPolarAngle=0,Promise.resolve()):X(new Promise(r=>{let o={polar:this.control.getPolarAngle()},s={polar:t},u=new Z.Tween(o,this.tweenGroup).to(s,e).onUpdate(()=>{this.control.maxPolarAngle=o.polar,this.control.minPolarAngle=o.polar,this.control.update()}).onComplete(()=>{this.control.enabled=!0,this.control.maxPolarAngle=this.config.control.maxPolar,this.control.minPolarAngle=0,this.tweenGroup.remove(u),r(!0)}).onStart(()=>{this.control.enabled=!1}).start()}),e+500)}setAzimuthalAngle(t,e=500){if(e===0){this.control.maxAzimuthAngle=t,this.control.minAzimuthAngle=t,this.control.update(),this.control.maxAzimuthAngle=1/0,this.control.minAzimuthAngle=1/0;return}return X(new Promise(r=>{let o={azimuthal:this.control.getAzimuthalAngle()},s={azimuthal:t},u=new Z.Tween(o,this.tweenGroup).to(s,e).onUpdate(()=>{this.control.maxAzimuthAngle=o.azimuthal,this.control.minAzimuthAngle=o.azimuthal,this.control.update()}).onComplete(()=>{this.control.enabled=!0,this.control.maxAzimuthAngle=1/0,this.control.minAzimuthAngle=1/0,this.tweenGroup.remove(u),r(!0)}).onStart(()=>{this.control.enabled=!1}).start()}),e+500)}getCameraLookAt(){return new E.Vector3().subVectors(this.control.target,this.camera.position)}setZoom(t,e,r=500){let o=this.getCameraLookAt(),s={zoom:this.camera.zoom,target:this.control.target.clone()};if(!r){this.camera.position.copy(e.clone().sub(o)),this.control.target.copy(e),this.camera.zoom=t,this.control.update();return}return X(new Promise(u=>{let l=new Z.Tween(s,this.tweenGroup).to({zoom:t,target:e},r).onUpdate(()=>{this.camera.position.copy(s.target.clone().sub(o)),this.control.target.copy(s.target),this.camera.zoom=s.zoom,this.control.update()}).onComplete(()=>{this.tweenGroup.remove(l),this.control.enabled=!0,u(!0)}).onStart(()=>{this.control.enabled=!1}).start()}),r+500)}getFitCameraToObjectZoom(t,e=[20,20,20,20],r=500,o=!0){let[s,u,l,a]=e,{clientSize:{width:h,height:c}}=this,f=this.control.getPolarAngle();o&&this.setPolarAngle(0,0);let m=new E.Box3().setFromObject(t);this.setPolarAngle(f,0);let{max:d,min:x}=m,v=new E.Vector3(x.x,d.y,d.z),A=new E.Vector3(d.x,d.y,d.z),R=new E.Vector3(d.x,x.y,x.z),G=new E.Vector3(x.x,x.y,x.z),T=y(v,this.camera,h,c),tt=y(A,this.camera,h,c),ot=y(G,this.camera,h,c),st=y(R,this.camera,h,c),jt=new E.Box2().setFromPoints([new E.Vector2(T.x,T.y),new E.Vector2(tt.x,tt.y),new E.Vector2(ot.x,ot.y),new E.Vector2(st.x,st.y)]).getSize(new E.Vector2),We=(h-u-a)/jt.x,Xe=(c-s-l)/jt.y,qe=Math.min(We,Xe),je=new E.Vector3((d.x+x.x)/2,(d.y+x.y)/2,(d.z+x.z)/2);return{zoom:qe*this.camera.zoom,center:je}}fitCameraToObject(t,e=[20,20,20,20],r=500,o=!0){let{zoom:s,center:u}=this.getFitCameraToObjectZoom(t,e,r,o);return this.setZoom(s,u,r)}getFitCameraToGroundZoom(t=[20,20,20,20],e=500,r=!0){if(this.currentFloor&&this.currentFloor.hasElement)return this.getFitCameraToObjectZoom(this.currentFloor.groundUpper,t,e,r).zoom}fitCameraToGround(t=[20,20,20,20],e=500,r=!0){return this.currentFloor&&this.currentFloor.hasElement?this.fitCameraToObject(this.currentFloor.groundUpper,t,e,r):Promise.resolve(!1)}setCameraPosition(t,e){return X(new Promise(r=>{let o=this.camera.position.clone(),s=this.getCameraLookAt(),u=new Z.Tween(o,this.tweenGroup).to(t,e).onUpdate(()=>{this.camera.position.copy(o.clone().sub(s)),this.control.target.copy(o.clone()),this.control.update()}).onComplete(()=>{this.tweenGroup.remove(u),this.camera.position.copy(o.clone().sub(s)),this.control.target.copy(t.clone()),this.control.update(),this.control.enabled=!0,r(!0)}).onStart(()=>{this.control.enabled=!1}).start()}),e+500)}render(){this.renderer.render(this.scene,this.camera),this.dispatchEvent({type:"update"}),this.timer.requestAnimationFrame(()=>{this.render()}),this.tweenGroup.update()}dispose(){this.cameraBound.dispose(),this.selection.dispose(),this.hoverHelper.dispose(),this.tweenGroup.getAll().forEach(t=>t.stop()),this.tweenGroup.removeAll(),this.unRegistryEvent(),this.container.removeChild(this.renderer.domElement),this.timer.dispose(),this.renderer.dispose(),this.lights.children.forEach(t=>t.dispose()),this.materialFactory.dispose(),z(this.scene)}};var Me=g("lodash"),un={apiDomain:"",apiInfo:{},apiPath:{floorGraphic:"/api/inception-map/floor/get",floorRange:"/api/inception-map/range/get",equipmentList:"/api/inception-map/equipment/get",roadNetwork:"/api/inception-map/road_network/get"},resizeObserver:!1,initTransToMark:!1,heatMap:{radius:50,gradient:{0:"#8F9FCD",.5:"#6284FF",1:"#F95D5D"}},useFloorCache:!0,control:{maxPolar:1.2,defaultPolar:1.1,defaultAzimuthal:0},defaultPadding:[20,20,20,20],svg:{circle:{radius:"2",fill:"#1CADFF"},line:{stroke:"#1CADFF"}},selectBox:{stroke:"#1CADFF",fill:"rgba(28, 173, 255, 0.3)"},hover:{time:100},ground:{color:"#F6F6F6",opacity:1,height:.001,stroke:!1,strokeColor:"#E6E6E6",strokeOpacity:1},markGraphic:{color:"#EEF0F3",opacity:1,height:.001,stroke:!1,strokeColor:"#000",strokeOpacity:1},graphic:{fillOpacity:1},cameraBound:{padding:[150,150,150,150]},poi:{boxScale:1}};function we(i){return(0,Me.merge)({},un,i)}var Pe=g("lodash");async function Te({brand:i,project:n},t){let{apiDomain:e,apiPath:{floorRange:r},apiInfo:o}=t,s=`${e}${r}?brand=${i}&project=${n}&phase=${n}&building=${n}`;return await fetch(s,o).then(l=>l.json()).then(l=>l.data).then(l=>{let a=(l||[])[0];return a&&(a.info=JSON.parse(a.info)),a})}async function Ut({brand:i,project:n,floor:t,ts:e,resource_type_list:r},o){let{apiDomain:s,apiPath:{floorGraphic:u},apiInfo:l}=o,a=`${s}${u}?brand=${i}&project=${n}&phase=${n}&building=${n}&floor=${t}&ts=${e}&resource_type_list=${r}`;return await fetch(a,l).then(c=>c.json()).then(c=>c.data).then(c=>((c||[]).map(f=>f.info=JSON.parse(f.info)),c||[]))}var hn=(t=>(t[t.D2=0]="D2",t[t.D3=1.1]="D3",t))(hn||{}),Ce=class extends Bt.EventDispatcher{constructor(t,e={}){super();this.container=t;this.config=we(e),this.context=new Ft(t,this.config),this.registryEvent(),this.context.render()}config;context;polarKeys=[];azimuthalKeys=[];svgLine;svgPolygon;basicZoom=1;prevCameraZoom=1;type="2d";floorDataMap=new Map;buildingGroundMap=new Map;buildingGroundPromiseMap=new Map;currentBuildGround=null;observe=null;buildingCenter=[0,0];timer=new U;plugins=[];async loadGraphics({brand:t,project:e,floor:r,ts:o,resource_type_list:s}){return await Ut({brand:t,project:e,floor:r,ts:o,resource_type_list:s},this.config)}changeBuildingCenter(t,{brand:e,project:r}){let o=t?kt(t.info.geometry.cds[0]):[0,0];this.buildingCenter=o,this.dispatchEvent({type:"center-change",center:o,project:r,brand:e})}async loadBuildingGround({brand:t,project:e}){let r=F({brand:t,project:e});if(this.buildingGroundMap.has(r)){let s=this.buildingGroundMap.get(r);return this.changeBuildingCenter(s||null,{brand:t,project:e}),s||null}if(this.buildingGroundPromiseMap.has(r))return this.buildingGroundPromiseMap.get(r);let o=new Promise(async s=>{let u=await Te({brand:t,project:e},this.config);this.buildingGroundMap.set(r,u),this.changeBuildingCenter(u||null,{brand:t,project:e}),this.buildingGroundPromiseMap.delete(r),s(u)});return this.buildingGroundPromiseMap.set(r,o),o}async load({brand:t,project:e,floor:r,ts:o,resource_type_list:s}){let u=F({brand:t,project:e,floor:r,ts:o,resource_type_list:s});if(this.floorDataMap.has(u))return this.floorDataMap.get(u);let[l,a]=await Promise.all([this.loadGraphics({brand:t,project:e,floor:r,ts:o,resource_type_list:s}),this.loadBuildingGround({brand:t,project:e})]);return this.transformGraphicData(l),l.forEach(h=>{h.info.transformToBuildingGround=!!a}),this.config.useFloorCache||this.floorDataMap.clear(),this.floorDataMap.set(u,l),l}transformGraphicData(t,e=this.buildingCenter,r=0){t.forEach(l=>{if(l.info.geometry.coords=JSON.parse(JSON.stringify(l.info.geometry.cds)),l.info.geometry.type==="polygon")l.info.geometry.coords.map(a=>{Array.isArray(a)&&a.forEach(h=>{h[0]-=e[0],h[1]-=e[1]})});else{let[a,h]=l.info.geometry.cds;l.info.geometry.coords=[a-e[0],h-e[1]]}});let{ground:o,markGraphic:s,graphic:u}=this.config;for(let l=0;l<t.length;l++){let a=t[l];a.info.deltaHeight=1e-5*(r+l+1),a.info.group==="ground"?(a.info.fillColor=o.color,a.info.fillOpacity=o.opacity,a.info.height=o.height,a.info.stroke=o.stroke,a.info.strokeColor=o.strokeColor,a.info.strokeOpacity=o.strokeOpacity):a.info.userData.mark?(a.info.height=s.height,a.info.fillColor=s.color,a.info.fillOpacity=s.opacity,a.info.stroke=s.stroke,a.info.strokeColor=s.strokeColor,a.info.strokeOpacity=s.strokeOpacity):(a.info.fillOpacity=u.fillOpacity,this.config.initTransToMark&&(a.info.height=s.height,a.info.fillColor=s.color,a.info.stroke=s.stroke,a.info.strokeColor=s.strokeColor,a.info.strokeOpacity=s.strokeOpacity))}}use(t){t.bmap=this,this.plugins.push(t)}unUse(t){this.plugins=this.plugins.filter(e=>e!==t)}createFloor(t){let e=new Ct(this.context);if(!t.length)return{curFloor:e,graphics:[]};let r=new Map,o=[];for(let s of t)if(s.info.group==="ground")e.createGround(s.info);else{let u=e.addGraphic(s.info);u.userData.data=s,r.set(s.legacy_id,u),o.push(u)}return e.userData.legacyToGraphicMap=r,{curFloor:e,graphics:o}}triggerHooks(t,e){this.dispatchEvent({type:t,data:e})}switchFloor({brand:t,project:e,floor:r,ts:o,resource_type_list:s}){let u=F({brand:t,project:e,floor:r,ts:o,resource_type_list:s}),l=this.floorDataMap.get(u);if(this.context.control.removeEventListener("change",this.onControlChange),l){let a=F({brand:t,project:e});this.currentBuildGround=this.buildingGroundMap.get(a)||null;let h=this.createFloor(l);h?(h.curFloor.name=r,this.triggerHooks("switch_floor_before",h),this.context.switchFloor(h.curFloor),this.initialFloorCamera(),this.triggerHooks("switch_floor_after",h)):console.warn("[switchFloor error] ["+r+"] \u697C\u5C42\u6CA1\u6709\u6570\u636E")}else console.warn("[switchFloor error] \u6CA1\u6709\u8FD9\u4E2A\u697C\u5C42\uFF0C\u8BF7\u5148\u8C03\u7528load\u65B9\u6CD5\u52A0\u8F7D\u697C\u5C42")}initialFloorCamera(){this.context.cameraBound.setEnable(!1),this.context.control.minZoom=0,this.context.control.maxZoom=1/0,this.context.camera.zoom=1,this.context.setAzimuthalAngle(this.config.control.defaultAzimuthal,0),this.context.fitCameraToGround(void 0,0),this.basicZoom=this.context.camera.zoom,this.context.control.minZoom=this.basicZoom,this.context.control.maxZoom=this.basicZoom*25,this.context.control.addEventListener("change",this.onControlChange),this.type==="3d"&&this.context.fitCameraToGround(this.config.defaultPadding,0,!1),this.onControlChange(),this.context.cameraBound.setEnable(!0)}onControlChange=()=>{let{camera:{zoom:t}}=this.context;t!==this.prevCameraZoom&&(this.dispatchEvent({type:"zoom-change",basicZoom:this.basicZoom,cameraZoom:this.context.camera.zoom}),this.prevCameraZoom=t)};addModel(t,e){if(t.options.geometry.type==="polygon"){let r=this.context.currentFloor?.addModel({...e,position:t.getPosition().setZ(.1),id:t.options.id});if(r){let{facilityAngle:o=0,facilityXScale:s=1,facilityYScale:u=1}=t.options.userData;r.rotateZ((180-o)/180*Math.PI),r.scale.set(s,u,1)}}}addHeatmap(t){return this.context.currentFloor?.addHeatmap(t)}getLegacyToGraphicMap(){return this.context.currentFloor?.userData.legacyToGraphicMap||new Map}getFloorAllGraphics(){return this.context.currentFloor?.graphicLayer.children.filter(t=>t instanceof I)||[]}createGraphicPoi(t,e){if(this.context.currentFloor){e.id===void 0&&(e.id=t.options.id);let r=t.getCenter();return this.context.currentFloor.addPoi({...e,position:{...r,z:r.z+t.options.height/2}})}return null}removeHeatMap(){this.context.currentFloor?.removeHeatMap()}translateElementToCenter(t,e=500){let r=t.getPosition();return this.context.setCameraPosition(r,e)}async translateElementToCenterX(t,e=500){return X(new Promise(r=>{let o=this.context.control.target.clone(),s=t.getPosition();this.timer.requestAnimationFrame(()=>{let{clientSize:{width:u,height:l},camera:a}=this.context,c=y(s,a,u,l).x-u/2,f=new Bt.Vector3;f.setFromMatrixColumn(this.context.camera.matrix,0),f.normalize(),f.multiplyScalar(c/this.context.camera.zoom),o.add(f),this.context.setCameraPosition(o,e).then(r)})}),e+500)}getElementDeviceCoordinate(t){let e=t.position.clone(),{clientWidth:r,clientHeight:o}=this.container;return y(e,this.context.camera,r,o)}changeMapType(t,e=500){return this.type=t,t==="2d"?this.context.setPolarAngle(0,e):this.context.setPolarAngle(1.1,e)}async resetView(t=300){let e=t/3;await this.context.setAzimuthalAngle(this.config.control.defaultAzimuthal,e),await this.changeMapType(this.type,e),await this.context.fitCameraToGround(this.config.defaultPadding,e,!1)}reduceMap(t=.5,e=500){let r=this.context.camera.zoom;return this.context.setZoom(r-t,this.context.control.target,e)}enlargeMap(t=.5,e=500){let r=this.context.camera.zoom;return this.context.setZoom(r+t,this.context.control.target,e)}onKeydown=t=>{this.polarKeys.includes(t.code)&&(this.context.control.maxPolarAngle=this.config.control.maxPolar,this.context.control.minPolarAngle=0),this.azimuthalKeys.includes(t.code)&&(this.context.control.maxAzimuthAngle=1/0,this.context.control.minAzimuthAngle=1/0)};onKeyUp=t=>{if(this.polarKeys.includes(t.code)){let e=this.context.control.getPolarAngle();this.context.control.maxPolarAngle=e,this.context.control.minPolarAngle=e}if(this.azimuthalKeys.includes(t.code)){let e=this.context.control.getAzimuthalAngle();this.context.control.maxAzimuthAngle=e,this.context.control.minAzimuthAngle=e}};registryEvent(){if(window.addEventListener("keydown",this.onKeydown),window.addEventListener("keyup",this.onKeyUp),this.config.resizeObserver){let t=new ResizeObserver((0,Pe.debounce)(this.resize,5));t.observe(this.container),this.observe=t}}unRegistryEvent(){window.removeEventListener("keydown",this.onKeydown),window.removeEventListener("keyup",this.onKeyUp),this.observe?.disconnect(),this.observe=null}configurePolarShortcutKeys(t){this.polarKeys=t}configureAzimuthalShortcutKeys(t){this.azimuthalKeys=t}rotateMap(t=.1){let e=this.context.control.getAzimuthalAngle();this.context.control.maxAzimuthAngle=e+t,this.context.control.minAzimuthAngle=e+t,this.context.control.update()}async measureDistance(){return this.cancelDistance(),new Promise((t,e)=>{this.changeMapType("2d",0),this.context.control.enableRotate=!1,this.svgLine=new At(this.context);let r=this.svgLine.dispose.bind(this.svgLine);this.svgLine.dispose=function(){r(),e("cancel")},this.svgLine.addEventListener("distance",({distance:o})=>{t(o)})})}cancelDistance(){this.svgLine&&(this.svgLine.dispose(),this.svgLine=void 0,this.context.control.enableRotate=!0)}measureArea(){return this.cancelArea(),new Promise((t,e)=>{this.changeMapType("2d",0),this.context.control.enableRotate=!1,this.svgPolygon=new Rt(this.context);let r=this.svgPolygon.dispose.bind(this.svgPolygon);this.svgPolygon.dispose=function(){r(),e("cancel")},this.svgPolygon.addEventListener("area",({area:o})=>{t(o)})})}cancelArea(){this.svgPolygon&&(this.svgPolygon.dispose(),this.svgPolygon=void 0,this.context.control.enableRotate=!0)}getGraphicByNodeId(t){return this.context.currentFloor?.graphicLayer.getGraphicByNodeId(t)||null}deleteGraphic(t){this.context.currentFloor?.graphicLayer.removeGraphic(t)}createGraphicByOptions(t){if(!t.transformToBuildingGround&&this.currentBuildGround){let e=kt(this.currentBuildGround.info.geometry.cds[0]);if(t.geometry.type==="polygon")t.geometry.coords=JSON.parse(JSON.stringify(t.geometry.cds)),t.geometry.coords.map(r=>{Array.isArray(r)&&r.forEach(o=>{o[0]-=e[0],o[1]-=e[1]})});else{let[r,o]=t.geometry.cds;t.geometry.coords=[r-e[0],o-e[1]]}}return this.context.currentFloor?.graphicLayer.createGraphic(t)}removePoiById(t){return this.context.currentFloor?.poiLayer.removePoiById(t)}getPoiById(t){return this.context.currentFloor?.poiLayer.getPoiById(t)}getPois(){return(this.context.currentFloor?.poiLayer.pois||[]).filter(t=>!t.options.built_in)}clearPoi(){this.context.currentFloor&&this.context.currentFloor.poiLayer.clear()}removeSelectGraphic(t){this.context.selection.remove(t)}resize=()=>{this.context.cameraBound.setEnable(!1),this.context.onWindowResize();let t=this.context.control.getAzimuthalAngle(),e=this.context.camera.zoom;this.context.control.minZoom=0,this.context.control.maxZoom=1/0,this.context.camera.zoom=1,this.context.setAzimuthalAngle(0,0);let r=this.context.getFitCameraToGroundZoom(void 0,0);this.basicZoom=r||0,this.context.control.minZoom=this.basicZoom,this.context.control.maxZoom=this.basicZoom*25,this.context.camera.zoom=e,this.context.control.addEventListener("change",this.onControlChange),this.context.setAzimuthalAngle(t,0),this.context.cameraBound.setEnable(!0)};dispose(){this.timer.dispose(),this.plugins.forEach(t=>t.dispose()),this.context.dispose(),this.floorDataMap.clear(),this.buildingGroundMap.clear(),oe(),se(),pe(),this.unRegistryEvent()}};var Ae=g("three"),V=class extends Ae.EventDispatcher{bmap;constructor(n){super(),this.bmap=n}dispose(){}};var Re=class extends V{equipmentList=[];equipmentMap=new Map;constructor(n){super(n),this.fetchEquipment(),this.bmap.addEventListener("switch_floor_after",this.onSwitchFloor)}async fetchEquipment(){let{apiDomain:n,apiPath:{equipmentList:t},apiInfo:e}=this.bmap.config,r=`${n}${t}`;await fetch(r,e).then(o=>o.json()).then(o=>o.data).then(o=>{this.equipmentList=o,this.equipmentMap=new Map(o.map(s=>[s.equipment_id,s]))}),this.bmap.context.currentFloor&&this.changeGraphicToEquipment(this.bmap.context.currentFloor.graphicLayer.children)}onSwitchFloor=({data:{graphics:n}})=>{this.equipmentList.length&&this.changeGraphicToEquipment(n)};getGraphicEquipment(n){return n.userData.data.info.userData.equipment}changeGraphicToEquipment(n){n.filter(t=>{let e=this.getGraphicEquipment(t);return e&&this.equipmentMap.has(e)}).forEach(t=>{let e=this.equipmentMap.get(this.getGraphicEquipment(t)),r=this.bmap.createGraphicPoi(t,{icon:e?.equipment_icon,built_in:!0,icon_size:[14,14]});r&&(r.userData.data=e,r.userData.type="equipment")})}dispose(){this.bmap.removeEventListener("switch_floor_after",this.onSwitchFloor),Array.from(this.bmap.context.currentFloor?.poiLayer.pois||[]).forEach(n=>{n.userData.type==="equipment"&&this.bmap.context.currentFloor?.poiLayer.removePoi(n)})}};function Wt(i){let n=new Blob([i],{type:"text/javascript"}),t=URL.createObjectURL(n),e=new Worker(t);return URL.revokeObjectURL(t),e}function Xt(){return Wt(`var E1=Object.create;var am=Object.defineProperty;var M1=Object.getOwnPropertyDescriptor;var S1=Object.getOwnPropertyNames;var w1=Object.getPrototypeOf,b1=Object.prototype.hasOwnProperty;var Kt=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports);var T1=(r,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of S1(t))!b1.call(r,a)&&a!==e&&am(r,a,{get:()=>t[a],enumerable:!(o=M1(t,a))||o.enumerable});return r};var Un=(r,t,e)=>(e=r!=null?E1(w1(r)):{},T1(t||!r||!r.__esModule?am(e,"default",{value:r,enumerable:!0}):e,r));var lm=Kt((eR,um)=>{var Af=class{constructor(){this.keys=new Set,this.queue=[]}sort(){this.queue.sort((t,e)=>t.priority-e.priority)}set(t,e){let o=Number(e);if(isNaN(o))throw new TypeError('"priority" must be a number');return this.keys.has(t)?this.queue.map(a=>(a.key===t&&Object.assign(a,{priority:o}),a)):(this.keys.add(t),this.queue.push({key:t,priority:o})),this.sort(),this.queue.length}next(){let t=this.queue.shift();return this.keys.delete(t.key),t}isEmpty(){return this.queue.length===0}has(t){return this.keys.has(t)}get(t){return this.queue.find(e=>e.key===t)}};um.exports=Af});var hm=Kt((nR,fm)=>{function cm(r,t){let e=new Map;for(let[o,a]of r)o!==t&&a instanceof Map?e.set(o,cm(a,t)):o!==t&&e.set(o,a);return e}fm.exports=cm});var mm=Kt((rR,dm)=>{function A1(r){let t=Number(r);return!(isNaN(t)||t<=0)}function pm(r){let t=new Map;return Object.keys(r).forEach(o=>{let a=r[o];if(a!==null&&typeof a=="object"&&!Array.isArray(a))return t.set(o,pm(a));if(!A1(a))throw new Error(\`Could not add node at key "\${o}", make sure it's a valid node\`,a);return t.set(o,Number(a))}),t}dm.exports=pm});var vm=Kt((iR,ym)=>{function gm(r){if(!(r instanceof Map))throw new Error(\`Invalid graph: Expected Map instead found \${typeof r}\`);r.forEach((t,e)=>{if(typeof t=="object"&&t instanceof Map){gm(t);return}if(typeof t!="number"||t<=0)throw new Error(\`Values must be numbers greater than 0. Found value \${t} at \${e}\`)})}ym.exports=gm});var Mm=Kt((oR,Em)=>{var C1=lm(),P1=hm(),_m=mm(),xm=vm(),Cf=class{constructor(t){t instanceof Map?(xm(t),this.graph=t):t?this.graph=_m(t):this.graph=new Map}addNode(t,e){let o;return e instanceof Map?(xm(e),o=e):o=_m(e),this.graph.set(t,o),this}addVertex(t,e){return this.addNode(t,e)}removeNode(t){return this.graph=P1(this.graph,t),this}path(t,e,o={}){if(!this.graph.size)return o.cost?{path:null,cost:0}:null;let a=new Set,l=new C1,f=new Map,h=[],p=0,d=[];if(o.avoid&&(d=[].concat(o.avoid)),d.includes(t))throw new Error(\`Starting node (\${t}) cannot be avoided\`);if(d.includes(e))throw new Error(\`Ending node (\${e}) cannot be avoided\`);for(l.set(t,0);!l.isEmpty();){let g=l.next();if(g.key===e){p=g.priority;let y=g.key;for(;f.has(y);)h.push(y),y=f.get(y);break}a.add(g.key),(this.graph.get(g.key)||new Map).forEach((y,M)=>{if(a.has(M)||d.includes(M))return null;if(!l.has(M))return f.set(M,g.key),l.set(M,g.priority+y);let w=l.get(M).priority,T=g.priority+y;return T<w?(f.set(M,g.key),l.set(M,T)):null})}return h.length?(o.trim?h.shift():h=h.concat([t]),o.reverse||(h=h.reverse()),o.cost?{path:h,cost:p}:h):o.cost?{path:null,cost:0}:null}shortestPath(...t){return this.path(...t)}};Em.exports=Cf});var mc=Kt((mR,p0)=>{"use strict";var h0=Object.getOwnPropertySymbols,Ib=Object.prototype.hasOwnProperty,Rb=Object.prototype.propertyIsEnumerable;function Lb(r){if(r==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(r)}function Nb(){try{if(!Object.assign)return!1;var r=new String("abc");if(r[5]="de",Object.getOwnPropertyNames(r)[0]==="5")return!1;for(var t={},e=0;e<10;e++)t["_"+String.fromCharCode(e)]=e;var o=Object.getOwnPropertyNames(t).map(function(l){return t[l]});if(o.join("")!=="0123456789")return!1;var a={};return"abcdefghijklmnopqrst".split("").forEach(function(l){a[l]=l}),Object.keys(Object.assign({},a)).join("")==="abcdefghijklmnopqrst"}catch(l){return!1}}p0.exports=Nb()?Object.assign:function(r,t){for(var e,o=Lb(r),a,l=1;l<arguments.length;l++){e=Object(arguments[l]);for(var f in e)Ib.call(e,f)&&(o[f]=e[f]);if(h0){a=h0(e);for(var h=0;h<a.length;h++)Rb.call(e,a[h])&&(o[a[h]]=e[a[h]])}}return o}});var tp=Kt((jh,Qh)=>{(function(r,t){typeof jh=="object"&&typeof Qh!="undefined"?Qh.exports=t():typeof define=="function"&&define.amd?define(t):(r=r||self).RBush=t()})(jh,function(){"use strict";function r(x,v,C,S,O){(function F(G,z,L,D,q){for(;D>L;){if(D-L>600){var nt=D-L+1,k=z-L+1,xt=Math.log(nt),X=.5*Math.exp(2*xt/3),it=.5*Math.sqrt(xt*X*(nt-X)/nt)*(k-nt/2<0?-1:1),vt=Math.max(L,Math.floor(z-k*X/nt+it)),pt=Math.min(D,Math.floor(z+(nt-k)*X/nt+it));F(G,z,vt,pt,q)}var et=G[z],ot=L,V=D;for(t(G,L,z),q(G[D],et)>0&&t(G,L,D);ot<V;){for(t(G,ot,V),ot++,V--;q(G[ot],et)<0;)ot++;for(;q(G[V],et)>0;)V--}q(G[L],et)===0?t(G,L,V):t(G,++V,D),V<=z&&(L=V+1),z<=V&&(D=V-1)}})(x,v,C||0,S||x.length-1,O||e)}function t(x,v,C){var S=x[v];x[v]=x[C],x[C]=S}function e(x,v){return x<v?-1:x>v?1:0}var o=function(x){x===void 0&&(x=9),this._maxEntries=Math.max(4,x),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function a(x,v,C){if(!C)return v.indexOf(x);for(var S=0;S<v.length;S++)if(C(x,v[S]))return S;return-1}function l(x,v){f(x,0,x.children.length,v,x)}function f(x,v,C,S,O){O||(O=w(null)),O.minX=1/0,O.minY=1/0,O.maxX=-1/0,O.maxY=-1/0;for(var F=v;F<C;F++){var G=x.children[F];h(O,x.leaf?S(G):G)}return O}function h(x,v){return x.minX=Math.min(x.minX,v.minX),x.minY=Math.min(x.minY,v.minY),x.maxX=Math.max(x.maxX,v.maxX),x.maxY=Math.max(x.maxY,v.maxY),x}function p(x,v){return x.minX-v.minX}function d(x,v){return x.minY-v.minY}function g(x){return(x.maxX-x.minX)*(x.maxY-x.minY)}function _(x){return x.maxX-x.minX+(x.maxY-x.minY)}function y(x,v){return x.minX<=v.minX&&x.minY<=v.minY&&v.maxX<=x.maxX&&v.maxY<=x.maxY}function M(x,v){return v.minX<=x.maxX&&v.minY<=x.maxY&&v.maxX>=x.minX&&v.maxY>=x.minY}function w(x){return{children:x,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function T(x,v,C,S,O){for(var F=[v,C];F.length;)if(!((C=F.pop())-(v=F.pop())<=S)){var G=v+Math.ceil((C-v)/S/2)*S;r(x,G,v,C,O),F.push(v,G,G,C)}}return o.prototype.all=function(){return this._all(this.data,[])},o.prototype.search=function(x){var v=this.data,C=[];if(!M(x,v))return C;for(var S=this.toBBox,O=[];v;){for(var F=0;F<v.children.length;F++){var G=v.children[F],z=v.leaf?S(G):G;M(x,z)&&(v.leaf?C.push(G):y(x,z)?this._all(G,C):O.push(G))}v=O.pop()}return C},o.prototype.collides=function(x){var v=this.data;if(!M(x,v))return!1;for(var C=[];v;){for(var S=0;S<v.children.length;S++){var O=v.children[S],F=v.leaf?this.toBBox(O):O;if(M(x,F)){if(v.leaf||y(x,F))return!0;C.push(O)}}v=C.pop()}return!1},o.prototype.load=function(x){if(!x||!x.length)return this;if(x.length<this._minEntries){for(var v=0;v<x.length;v++)this.insert(x[v]);return this}var C=this._build(x.slice(),0,x.length-1,0);if(this.data.children.length)if(this.data.height===C.height)this._splitRoot(this.data,C);else{if(this.data.height<C.height){var S=this.data;this.data=C,C=S}this._insert(C,this.data.height-C.height-1,!0)}else this.data=C;return this},o.prototype.insert=function(x){return x&&this._insert(x,this.data.height-1),this},o.prototype.clear=function(){return this.data=w([]),this},o.prototype.remove=function(x,v){if(!x)return this;for(var C,S,O,F=this.data,G=this.toBBox(x),z=[],L=[];F||z.length;){if(F||(F=z.pop(),S=z[z.length-1],C=L.pop(),O=!0),F.leaf){var D=a(x,F.children,v);if(D!==-1)return F.children.splice(D,1),z.push(F),this._condense(z),this}O||F.leaf||!y(F,G)?S?(C++,F=S.children[C],O=!1):F=null:(z.push(F),L.push(C),C=0,S=F,F=F.children[0])}return this},o.prototype.toBBox=function(x){return x},o.prototype.compareMinX=function(x,v){return x.minX-v.minX},o.prototype.compareMinY=function(x,v){return x.minY-v.minY},o.prototype.toJSON=function(){return this.data},o.prototype.fromJSON=function(x){return this.data=x,this},o.prototype._all=function(x,v){for(var C=[];x;)x.leaf?v.push.apply(v,x.children):C.push.apply(C,x.children),x=C.pop();return v},o.prototype._build=function(x,v,C,S){var O,F=C-v+1,G=this._maxEntries;if(F<=G)return l(O=w(x.slice(v,C+1)),this.toBBox),O;S||(S=Math.ceil(Math.log(F)/Math.log(G)),G=Math.ceil(F/Math.pow(G,S-1))),(O=w([])).leaf=!1,O.height=S;var z=Math.ceil(F/G),L=z*Math.ceil(Math.sqrt(G));T(x,v,C,L,this.compareMinX);for(var D=v;D<=C;D+=L){var q=Math.min(D+L-1,C);T(x,D,q,z,this.compareMinY);for(var nt=D;nt<=q;nt+=z){var k=Math.min(nt+z-1,q);O.children.push(this._build(x,nt,k,S-1))}}return l(O,this.toBBox),O},o.prototype._chooseSubtree=function(x,v,C,S){for(;S.push(v),!v.leaf&&S.length-1!==C;){for(var O=1/0,F=1/0,G=void 0,z=0;z<v.children.length;z++){var L=v.children[z],D=g(L),q=(nt=x,k=L,(Math.max(k.maxX,nt.maxX)-Math.min(k.minX,nt.minX))*(Math.max(k.maxY,nt.maxY)-Math.min(k.minY,nt.minY))-D);q<F?(F=q,O=D<O?D:O,G=L):q===F&&D<O&&(O=D,G=L)}v=G||v.children[0]}var nt,k;return v},o.prototype._insert=function(x,v,C){var S=C?x:this.toBBox(x),O=[],F=this._chooseSubtree(S,this.data,v,O);for(F.children.push(x),h(F,S);v>=0&&O[v].children.length>this._maxEntries;)this._split(O,v),v--;this._adjustParentBBoxes(S,O,v)},o.prototype._split=function(x,v){var C=x[v],S=C.children.length,O=this._minEntries;this._chooseSplitAxis(C,O,S);var F=this._chooseSplitIndex(C,O,S),G=w(C.children.splice(F,C.children.length-F));G.height=C.height,G.leaf=C.leaf,l(C,this.toBBox),l(G,this.toBBox),v?x[v-1].children.push(G):this._splitRoot(C,G)},o.prototype._splitRoot=function(x,v){this.data=w([x,v]),this.data.height=x.height+1,this.data.leaf=!1,l(this.data,this.toBBox)},o.prototype._chooseSplitIndex=function(x,v,C){for(var S,O,F,G,z,L,D,q=1/0,nt=1/0,k=v;k<=C-v;k++){var xt=f(x,0,k,this.toBBox),X=f(x,k,C,this.toBBox),it=(O=xt,F=X,G=void 0,z=void 0,L=void 0,D=void 0,G=Math.max(O.minX,F.minX),z=Math.max(O.minY,F.minY),L=Math.min(O.maxX,F.maxX),D=Math.min(O.maxY,F.maxY),Math.max(0,L-G)*Math.max(0,D-z)),vt=g(xt)+g(X);it<q?(q=it,S=k,nt=vt<nt?vt:nt):it===q&&vt<nt&&(nt=vt,S=k)}return S||C-v},o.prototype._chooseSplitAxis=function(x,v,C){var S=x.leaf?this.compareMinX:p,O=x.leaf?this.compareMinY:d;this._allDistMargin(x,v,C,S)<this._allDistMargin(x,v,C,O)&&x.children.sort(S)},o.prototype._allDistMargin=function(x,v,C,S){x.children.sort(S);for(var O=this.toBBox,F=f(x,0,v,O),G=f(x,C-v,C,O),z=_(F)+_(G),L=v;L<C-v;L++){var D=x.children[L];h(F,x.leaf?O(D):D),z+=_(F)}for(var q=C-v-1;q>=v;q--){var nt=x.children[q];h(G,x.leaf?O(nt):nt),z+=_(G)}return z},o.prototype._adjustParentBBoxes=function(x,v,C){for(var S=C;S>=0;S--)h(v[S],x)},o.prototype._condense=function(x){for(var v=x.length-1,C=void 0;v>=0;v--)x[v].children.length===0?v>0?(C=x[v-1].children).splice(C.indexOf(x[v]),1):this.clear():l(x[v],this.toBBox)},o})});var d0=Kt((ep,np)=>{(function(r,t){typeof ep=="object"&&typeof np!="undefined"?np.exports=t():typeof define=="function"&&define.amd?define(t):(r=r||self,r.TinyQueue=t())})(ep,function(){"use strict";var r=function(o,a){if(o===void 0&&(o=[]),a===void 0&&(a=t),this.data=o,this.length=this.data.length,this.compare=a,this.length>0)for(var l=(this.length>>1)-1;l>=0;l--)this._down(l)};r.prototype.push=function(o){this.data.push(o),this.length++,this._up(this.length-1)},r.prototype.pop=function(){if(this.length!==0){var o=this.data[0],a=this.data.pop();return this.length--,this.length>0&&(this.data[0]=a,this._down(0)),o}},r.prototype.peek=function(){return this.data[0]},r.prototype._up=function(o){for(var a=this,l=a.data,f=a.compare,h=l[o];o>0;){var p=o-1>>1,d=l[p];if(f(h,d)>=0)break;l[o]=d,o=p}l[o]=h},r.prototype._down=function(o){for(var a=this,l=a.data,f=a.compare,h=this.length>>1,p=l[o];o<h;){var d=(o<<1)+1,g=l[d],_=d+1;if(_<this.length&&f(l[_],g)<0&&(d=_,g=l[_]),f(g,p)>=0)break;l[o]=g,o=d}l[o]=p};function t(e,o){return e<o?-1:e>o?1:0}return r})});var g0=Kt((ER,m0)=>{m0.exports=function(t,e,o,a){var l=t[0],f=t[1],h=!1;o===void 0&&(o=0),a===void 0&&(a=e.length);for(var p=(a-o)/2,d=0,g=p-1;d<p;g=d++){var _=e[o+d*2+0],y=e[o+d*2+1],M=e[o+g*2+0],w=e[o+g*2+1],T=y>f!=w>f&&l<(M-_)*(f-y)/(w-y)+_;T&&(h=!h)}return h}});var v0=Kt((MR,y0)=>{y0.exports=function(t,e,o,a){var l=t[0],f=t[1],h=!1;o===void 0&&(o=0),a===void 0&&(a=e.length);for(var p=a-o,d=0,g=p-1;d<p;g=d++){var _=e[d+o][0],y=e[d+o][1],M=e[g+o][0],w=e[g+o][1],T=y>f!=w>f&&l<(M-_)*(f-y)/(w-y)+_;T&&(h=!h)}return h}});var E0=Kt((SR,vc)=>{var _0=g0(),x0=v0();vc.exports=function(t,e,o,a){return e.length>0&&Array.isArray(e[0])?x0(t,e,o,a):_0(t,e,o,a)};vc.exports.nested=x0;vc.exports.flat=_0});var S0=Kt((_c,M0)=>{(function(r,t){typeof _c=="object"&&typeof M0!="undefined"?t(_c):typeof define=="function"&&define.amd?define(["exports"],t):t((r=r||self).predicates={})})(_c,function(r){"use strict";let e=33306690738754706e-32;function o(M,w,T,x,v){let C,S,O,F,G=w[0],z=x[0],L=0,D=0;z>G==z>-G?(C=G,G=w[++L]):(C=z,z=x[++D]);let q=0;if(L<M&&D<T)for(z>G==z>-G?(O=C-((S=G+C)-G),G=w[++L]):(O=C-((S=z+C)-z),z=x[++D]),C=S,O!==0&&(v[q++]=O);L<M&&D<T;)z>G==z>-G?(O=C-((S=C+G)-(F=S-C))+(G-F),G=w[++L]):(O=C-((S=C+z)-(F=S-C))+(z-F),z=x[++D]),C=S,O!==0&&(v[q++]=O);for(;L<M;)O=C-((S=C+G)-(F=S-C))+(G-F),G=w[++L],C=S,O!==0&&(v[q++]=O);for(;D<T;)O=C-((S=C+z)-(F=S-C))+(z-F),z=x[++D],C=S,O!==0&&(v[q++]=O);return C===0&&q!==0||(v[q++]=C),q}function a(M){return new Float64Array(M)}let l=33306690738754716e-32,f=22204460492503146e-32,h=11093356479670487e-47,p=a(4),d=a(8),g=a(12),_=a(16),y=a(4);r.orient2d=function(M,w,T,x,v,C){let S=(w-C)*(T-v),O=(M-v)*(x-C),F=S-O;if(S===0||O===0||S>0!=O>0)return F;let G=Math.abs(S+O);return Math.abs(F)>=l*G?F:-function(z,L,D,q,nt,k,xt){let X,it,vt,pt,et,ot,V,K,at,Tt,dt,Ct,Yt,Wt,Nt,ne,Pt,Xt,tt=z-nt,nn=D-nt,Gt=L-k,te=q-k;et=(Nt=(K=tt-(V=(ot=134217729*tt)-(ot-tt)))*(Tt=te-(at=(ot=134217729*te)-(ot-te)))-((Wt=tt*te)-V*at-K*at-V*Tt))-(dt=Nt-(Pt=(K=Gt-(V=(ot=134217729*Gt)-(ot-Gt)))*(Tt=nn-(at=(ot=134217729*nn)-(ot-nn)))-((ne=Gt*nn)-V*at-K*at-V*Tt))),p[0]=Nt-(dt+et)+(et-Pt),et=(Yt=Wt-((Ct=Wt+dt)-(et=Ct-Wt))+(dt-et))-(dt=Yt-ne),p[1]=Yt-(dt+et)+(et-ne),et=(Xt=Ct+dt)-Ct,p[2]=Ct-(Xt-et)+(dt-et),p[3]=Xt;let qt=function(W,J){let I=J[0];for(let P=1;P<W;P++)I+=J[P];return I}(4,p),$=f*xt;if(qt>=$||-qt>=$||(X=z-(tt+(et=z-tt))+(et-nt),vt=D-(nn+(et=D-nn))+(et-nt),it=L-(Gt+(et=L-Gt))+(et-k),pt=q-(te+(et=q-te))+(et-k),X===0&&it===0&&vt===0&&pt===0)||($=h*xt+e*Math.abs(qt),(qt+=tt*pt+te*X-(Gt*vt+nn*it))>=$||-qt>=$))return qt;et=(Nt=(K=X-(V=(ot=134217729*X)-(ot-X)))*(Tt=te-(at=(ot=134217729*te)-(ot-te)))-((Wt=X*te)-V*at-K*at-V*Tt))-(dt=Nt-(Pt=(K=it-(V=(ot=134217729*it)-(ot-it)))*(Tt=nn-(at=(ot=134217729*nn)-(ot-nn)))-((ne=it*nn)-V*at-K*at-V*Tt))),y[0]=Nt-(dt+et)+(et-Pt),et=(Yt=Wt-((Ct=Wt+dt)-(et=Ct-Wt))+(dt-et))-(dt=Yt-ne),y[1]=Yt-(dt+et)+(et-ne),et=(Xt=Ct+dt)-Ct,y[2]=Ct-(Xt-et)+(dt-et),y[3]=Xt;let N=o(4,p,4,y,d);et=(Nt=(K=tt-(V=(ot=134217729*tt)-(ot-tt)))*(Tt=pt-(at=(ot=134217729*pt)-(ot-pt)))-((Wt=tt*pt)-V*at-K*at-V*Tt))-(dt=Nt-(Pt=(K=Gt-(V=(ot=134217729*Gt)-(ot-Gt)))*(Tt=vt-(at=(ot=134217729*vt)-(ot-vt)))-((ne=Gt*vt)-V*at-K*at-V*Tt))),y[0]=Nt-(dt+et)+(et-Pt),et=(Yt=Wt-((Ct=Wt+dt)-(et=Ct-Wt))+(dt-et))-(dt=Yt-ne),y[1]=Yt-(dt+et)+(et-ne),et=(Xt=Ct+dt)-Ct,y[2]=Ct-(Xt-et)+(dt-et),y[3]=Xt;let b=o(N,d,4,y,g);et=(Nt=(K=X-(V=(ot=134217729*X)-(ot-X)))*(Tt=pt-(at=(ot=134217729*pt)-(ot-pt)))-((Wt=X*pt)-V*at-K*at-V*Tt))-(dt=Nt-(Pt=(K=it-(V=(ot=134217729*it)-(ot-it)))*(Tt=vt-(at=(ot=134217729*vt)-(ot-vt)))-((ne=it*vt)-V*at-K*at-V*Tt))),y[0]=Nt-(dt+et)+(et-Pt),et=(Yt=Wt-((Ct=Wt+dt)-(et=Ct-Wt))+(dt-et))-(dt=Yt-ne),y[1]=Yt-(dt+et)+(et-ne),et=(Xt=Ct+dt)-Ct,y[2]=Ct-(Xt-et)+(dt-et),y[3]=Xt;let R=o(b,g,4,y,_);return _[R-1]}(M,w,T,x,v,C,G)},r.orient2dfast=function(M,w,T,x,v,C){return(w-C)*(T-v)-(M-v)*(x-C)},Object.defineProperty(r,"__esModule",{value:!0})})});var P0=Kt((wR,sp)=>{"use strict";var w0=tp(),Ec=d0(),Db=E0(),Fb=S0().orient2d;Ec.default&&(Ec=Ec.default);sp.exports=C0;sp.exports.default=C0;function C0(r,t,e){t=Math.max(0,t===void 0?2:t),e=e||0;var o=Gb(r),a=new w0(16);a.toBBox=function(C){return{minX:C[0],minY:C[1],maxX:C[0],maxY:C[1]}},a.compareMinX=function(C,S){return C[0]-S[0]},a.compareMinY=function(C,S){return C[1]-S[1]},a.load(r);for(var l=[],f=0,h;f<o.length;f++){var p=o[f];a.remove(p),h=A0(p,h),l.push(h)}var d=new w0(16);for(f=0;f<l.length;f++)d.insert(rp(l[f]));for(var g=t*t,_=e*e;l.length;){var y=l.shift(),M=y.p,w=y.next.p,T=ip(M,w);if(!(T<_)){var x=T/g;p=Ub(a,y.prev.p,M,w,y.next.next.p,x,d),p&&Math.min(ip(p,M),ip(p,w))<=x&&(l.push(y),l.push(A0(p,y)),a.remove(p),d.remove(y),d.insert(rp(y)),d.insert(rp(y.next)))}}y=h;var v=[];do v.push(y.p),y=y.next;while(y!==h);return v.push(y.p),v}function Ub(r,t,e,o,a,l,f){for(var h=new Ec([],Bb),p=r.data;p;){for(var d=0;d<p.children.length;d++){var g=p.children[d],_=p.leaf?op(g,e,o):zb(e,o,g);_>l||h.push({node:g,dist:_})}for(;h.length&&!h.peek().node.children;){var y=h.pop(),M=y.node,w=op(M,t,e),T=op(M,o,a);if(y.dist<w&&y.dist<T&&T0(e,M,f)&&T0(o,M,f))return M}p=h.pop(),p&&(p=p.node)}return null}function Bb(r,t){return r.dist-t.dist}function zb(r,t,e){if(b0(r,e)||b0(t,e))return 0;var o=xc(r[0],r[1],t[0],t[1],e.minX,e.minY,e.maxX,e.minY);if(o===0)return 0;var a=xc(r[0],r[1],t[0],t[1],e.minX,e.minY,e.minX,e.maxY);if(a===0)return 0;var l=xc(r[0],r[1],t[0],t[1],e.maxX,e.minY,e.maxX,e.maxY);if(l===0)return 0;var f=xc(r[0],r[1],t[0],t[1],e.minX,e.maxY,e.maxX,e.maxY);return f===0?0:Math.min(o,a,l,f)}function b0(r,t){return r[0]>=t.minX&&r[0]<=t.maxX&&r[1]>=t.minY&&r[1]<=t.maxY}function T0(r,t,e){for(var o=Math.min(r[0],t[0]),a=Math.min(r[1],t[1]),l=Math.max(r[0],t[0]),f=Math.max(r[1],t[1]),h=e.search({minX:o,minY:a,maxX:l,maxY:f}),p=0;p<h.length;p++)if(kb(h[p].p,h[p].next.p,r,t))return!1;return!0}function Ya(r,t,e){return Fb(r[0],r[1],t[0],t[1],e[0],e[1])}function kb(r,t,e,o){return r!==o&&t!==e&&Ya(r,t,e)>0!=Ya(r,t,o)>0&&Ya(e,o,r)>0!=Ya(e,o,t)>0}function rp(r){var t=r.p,e=r.next.p;return r.minX=Math.min(t[0],e[0]),r.minY=Math.min(t[1],e[1]),r.maxX=Math.max(t[0],e[0]),r.maxY=Math.max(t[1],e[1]),r}function Gb(r){for(var t=r[0],e=r[0],o=r[0],a=r[0],l=0;l<r.length;l++){var f=r[l];f[0]<t[0]&&(t=f),f[0]>o[0]&&(o=f),f[1]<e[1]&&(e=f),f[1]>a[1]&&(a=f)}var h=[t,e,o,a],p=h.slice();for(l=0;l<r.length;l++)Db(r[l],h)||p.push(r[l]);return Hb(p)}function A0(r,t){var e={p:r,prev:null,next:null,minX:0,minY:0,maxX:0,maxY:0};return t?(e.next=t.next,e.prev=t,t.next.prev=e,t.next=e):(e.prev=e,e.next=e),e}function ip(r,t){var e=r[0]-t[0],o=r[1]-t[1];return e*e+o*o}function op(r,t,e){var o=t[0],a=t[1],l=e[0]-o,f=e[1]-a;if(l!==0||f!==0){var h=((r[0]-o)*l+(r[1]-a)*f)/(l*l+f*f);h>1?(o=e[0],a=e[1]):h>0&&(o+=l*h,a+=f*h)}return l=r[0]-o,f=r[1]-a,l*l+f*f}function xc(r,t,e,o,a,l,f,h){var p=e-r,d=o-t,g=f-a,_=h-l,y=r-a,M=t-l,w=p*p+d*d,T=p*g+d*_,x=g*g+_*_,v=p*y+d*M,C=g*y+_*M,S=w*x-T*T,O,F,G,z,L=S,D=S;S===0?(F=0,L=1,z=C,D=x):(F=T*C-x*v,z=w*C-T*v,F<0?(F=0,z=C,D=x):F>L&&(F=L,z=C+T,D=x)),z<0?(z=0,-v<0?F=0:-v>w?F=L:(F=-v,L=w)):z>D&&(z=D,-v+T<0?F=0:-v+T>w?F=L:(F=-v+T,L=w)),O=F===0?0:F/L,G=z===0?0:z/D;var q=(1-O)*r+O*e,nt=(1-O)*t+O*o,k=(1-G)*a+G*f,xt=(1-G)*l+G*h,X=k-q,it=xt-nt;return X*X+it*it}function Vb(r,t){return r[0]===t[0]?r[1]-t[1]:r[0]-t[0]}function Hb(r){r.sort(Vb);for(var t=[],e=0;e<r.length;e++){for(;t.length>=2&&Ya(t[t.length-2],t[t.length-1],r[e])<=0;)t.pop();t.push(r[e])}for(var o=[],a=r.length-1;a>=0;a--){for(;o.length>=2&&Ya(o[o.length-2],o[o.length-1],r[a])<=0;)o.pop();o.push(r[a])}return o.pop(),t.pop(),t.concat(o)}});var D0=Kt((up,lp)=>{(function(r,t){typeof up=="object"&&typeof lp!="undefined"?lp.exports=t():typeof define=="function"&&define.amd?define(t):r.quickselect=t()})(up,function(){"use strict";function r(a,l,f,h,p){t(a,l,f||0,h||a.length-1,p||o)}function t(a,l,f,h,p){for(;h>f;){if(h-f>600){var d=h-f+1,g=l-f+1,_=Math.log(d),y=.5*Math.exp(2*_/3),M=.5*Math.sqrt(_*y*(d-y)/d)*(g-d/2<0?-1:1),w=Math.max(f,Math.floor(l-g*y/d+M)),T=Math.min(h,Math.floor(l+(d-g)*y/d+M));t(a,l,w,T,p)}var x=a[l],v=f,C=h;for(e(a,f,l),p(a[h],x)>0&&e(a,f,h);v<C;){for(e(a,v,C),v++,C--;p(a[v],x)<0;)v++;for(;p(a[C],x)>0;)C--}p(a[f],x)===0?e(a,f,C):(C++,e(a,C,h)),C<=l&&(f=C+1),l<=C&&(h=C-1)}}function e(a,l,f){var h=a[l];a[l]=a[f],a[f]=h}function o(a,l){return a<l?-1:a>l?1:0}return r})});var pp=Kt(($N,hp)=>{"use strict";hp.exports=Hu;hp.exports.default=Hu;var nT=D0();function Hu(r,t){if(!(this instanceof Hu))return new Hu(r,t);this._maxEntries=Math.max(4,r||9),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),t&&this._initFormat(t),this.clear()}Hu.prototype={all:function(){return this._all(this.data,[])},search:function(r){var t=this.data,e=[],o=this.toBBox;if(!Sc(r,t))return e;for(var a=[],l,f,h,p;t;){for(l=0,f=t.children.length;l<f;l++)h=t.children[l],p=t.leaf?o(h):h,Sc(r,p)&&(t.leaf?e.push(h):fp(r,p)?this._all(h,e):a.push(h));t=a.pop()}return e},collides:function(r){var t=this.data,e=this.toBBox;if(!Sc(r,t))return!1;for(var o=[],a,l,f,h;t;){for(a=0,l=t.children.length;a<l;a++)if(f=t.children[a],h=t.leaf?e(f):f,Sc(r,h)){if(t.leaf||fp(r,h))return!0;o.push(f)}t=o.pop()}return!1},load:function(r){if(!(r&&r.length))return this;if(r.length<this._minEntries){for(var t=0,e=r.length;t<e;t++)this.insert(r[t]);return this}var o=this._build(r.slice(),0,r.length-1,0);if(!this.data.children.length)this.data=o;else if(this.data.height===o.height)this._splitRoot(this.data,o);else{if(this.data.height<o.height){var a=this.data;this.data=o,o=a}this._insert(o,this.data.height-o.height-1,!0)}return this},insert:function(r){return r&&this._insert(r,this.data.height-1),this},clear:function(){return this.data=$a([]),this},remove:function(r,t){if(!r)return this;for(var e=this.data,o=this.toBBox(r),a=[],l=[],f,h,p,d;e||a.length;){if(e||(e=a.pop(),h=a[a.length-1],f=l.pop(),d=!0),e.leaf&&(p=rT(r,e.children,t),p!==-1))return e.children.splice(p,1),a.push(e),this._condense(a),this;!d&&!e.leaf&&fp(e,o)?(a.push(e),l.push(f),f=0,h=e,e=e.children[0]):h?(f++,e=h.children[f],d=!1):e=null}return this},toBBox:function(r){return r},compareMinX:F0,compareMinY:U0,toJSON:function(){return this.data},fromJSON:function(r){return this.data=r,this},_all:function(r,t){for(var e=[];r;)r.leaf?t.push.apply(t,r.children):e.push.apply(e,r.children),r=e.pop();return t},_build:function(r,t,e,o){var a=e-t+1,l=this._maxEntries,f;if(a<=l)return f=$a(r.slice(t,e+1)),Ja(f,this.toBBox),f;o||(o=Math.ceil(Math.log(a)/Math.log(l)),l=Math.ceil(a/Math.pow(l,o-1))),f=$a([]),f.leaf=!1,f.height=o;var h=Math.ceil(a/l),p=h*Math.ceil(Math.sqrt(l)),d,g,_,y;for(B0(r,t,e,p,this.compareMinX),d=t;d<=e;d+=p)for(_=Math.min(d+p-1,e),B0(r,d,_,h,this.compareMinY),g=d;g<=_;g+=h)y=Math.min(g+h-1,_),f.children.push(this._build(r,g,y,o-1));return Ja(f,this.toBBox),f},_chooseSubtree:function(r,t,e,o){for(var a,l,f,h,p,d,g,_;o.push(t),!(t.leaf||o.length-1===e);){for(g=_=1/0,a=0,l=t.children.length;a<l;a++)f=t.children[a],p=cp(f),d=iT(r,f)-p,d<_?(_=d,g=p<g?p:g,h=f):d===_&&p<g&&(g=p,h=f);t=h||t.children[0]}return t},_insert:function(r,t,e){var o=this.toBBox,a=e?r:o(r),l=[],f=this._chooseSubtree(a,this.data,t,l);for(f.children.push(r),Vu(f,a);t>=0&&l[t].children.length>this._maxEntries;)this._split(l,t),t--;this._adjustParentBBoxes(a,l,t)},_split:function(r,t){var e=r[t],o=e.children.length,a=this._minEntries;this._chooseSplitAxis(e,a,o);var l=this._chooseSplitIndex(e,a,o),f=$a(e.children.splice(l,e.children.length-l));f.height=e.height,f.leaf=e.leaf,Ja(e,this.toBBox),Ja(f,this.toBBox),t?r[t-1].children.push(f):this._splitRoot(e,f)},_splitRoot:function(r,t){this.data=$a([r,t]),this.data.height=r.height+1,this.data.leaf=!1,Ja(this.data,this.toBBox)},_chooseSplitIndex:function(r,t,e){var o,a,l,f,h,p,d,g;for(p=d=1/0,o=t;o<=e-t;o++)a=Gu(r,0,o,this.toBBox),l=Gu(r,o,e,this.toBBox),f=oT(a,l),h=cp(a)+cp(l),f<p?(p=f,g=o,d=h<d?h:d):f===p&&h<d&&(d=h,g=o);return g},_chooseSplitAxis:function(r,t,e){var o=r.leaf?this.compareMinX:F0,a=r.leaf?this.compareMinY:U0,l=this._allDistMargin(r,t,e,o),f=this._allDistMargin(r,t,e,a);l<f&&r.children.sort(o)},_allDistMargin:function(r,t,e,o){r.children.sort(o);var a=this.toBBox,l=Gu(r,0,t,a),f=Gu(r,e-t,e,a),h=Mc(l)+Mc(f),p,d;for(p=t;p<e-t;p++)d=r.children[p],Vu(l,r.leaf?a(d):d),h+=Mc(l);for(p=e-t-1;p>=t;p--)d=r.children[p],Vu(f,r.leaf?a(d):d),h+=Mc(f);return h},_adjustParentBBoxes:function(r,t,e){for(var o=e;o>=0;o--)Vu(t[o],r)},_condense:function(r){for(var t=r.length-1,e;t>=0;t--)r[t].children.length===0?t>0?(e=r[t-1].children,e.splice(e.indexOf(r[t]),1)):this.clear():Ja(r[t],this.toBBox)},_initFormat:function(r){var t=["return a"," - b",";"];this.compareMinX=new Function("a","b",t.join(r[0])),this.compareMinY=new Function("a","b",t.join(r[1])),this.toBBox=new Function("a","return {minX: a"+r[0]+", minY: a"+r[1]+", maxX: a"+r[2]+", maxY: a"+r[3]+"};")}};function rT(r,t,e){if(!e)return t.indexOf(r);for(var o=0;o<t.length;o++)if(e(r,t[o]))return o;return-1}function Ja(r,t){Gu(r,0,r.children.length,t,r)}function Gu(r,t,e,o,a){a||(a=$a(null)),a.minX=1/0,a.minY=1/0,a.maxX=-1/0,a.maxY=-1/0;for(var l=t,f;l<e;l++)f=r.children[l],Vu(a,r.leaf?o(f):f);return a}function Vu(r,t){return r.minX=Math.min(r.minX,t.minX),r.minY=Math.min(r.minY,t.minY),r.maxX=Math.max(r.maxX,t.maxX),r.maxY=Math.max(r.maxY,t.maxY),r}function F0(r,t){return r.minX-t.minX}function U0(r,t){return r.minY-t.minY}function cp(r){return(r.maxX-r.minX)*(r.maxY-r.minY)}function Mc(r){return r.maxX-r.minX+(r.maxY-r.minY)}function iT(r,t){return(Math.max(t.maxX,r.maxX)-Math.min(t.minX,r.minX))*(Math.max(t.maxY,r.maxY)-Math.min(t.minY,r.minY))}function oT(r,t){var e=Math.max(r.minX,t.minX),o=Math.max(r.minY,t.minY),a=Math.min(r.maxX,t.maxX),l=Math.min(r.maxY,t.maxY);return Math.max(0,a-e)*Math.max(0,l-o)}function fp(r,t){return r.minX<=t.minX&&r.minY<=t.minY&&t.maxX<=r.maxX&&t.maxY<=r.maxY}function Sc(r,t){return t.minX<=r.maxX&&t.minY<=r.maxY&&t.maxX>=r.minX&&t.maxY>=r.minY}function $a(r){return{children:r,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function B0(r,t,e,o,a){for(var l=[t,e],f;l.length;)e=l.pop(),t=l.pop(),!(e-t<=o)&&(f=t+Math.ceil((e-t)/o/2)*o,nT(r,f,t,e,a),l.push(t,f,f,e))}});var W0=Kt((lO,_p)=>{"use strict";_p.exports=Ac;_p.exports.default=Ac;function Ac(r,t,e){e=e||2;var o=t&&t.length,a=o?t[0]*e:r.length,l=G0(r,0,a,e,!0),f=[];if(!l||l.next===l.prev)return f;var h,p,d,g,_,y,M;if(o&&(l=mT(r,t,l,e)),r.length>80*e){h=d=r[0],p=g=r[1];for(var w=e;w<a;w+=e)_=r[w],y=r[w+1],_<h&&(h=_),y<p&&(p=y),_>d&&(d=_),y>g&&(g=y);M=Math.max(d-h,g-p),M=M!==0?32767/M:0}return Xu(l,f,e,h,p,M,0),f}function G0(r,t,e,o,a){var l,f;if(a===vp(r,t,e,o)>0)for(l=t;l<e;l+=o)f=k0(l,r[l],r[l+1],f);else for(l=e-o;l>=t;l-=o)f=k0(l,r[l],r[l+1],f);return f&&Cc(f,f.next)&&(Zu(f),f=f.next),f}function $s(r,t){if(!r)return r;t||(t=r);var e=r,o;do if(o=!1,!e.steiner&&(Cc(e,e.next)||Fn(e.prev,e,e.next)===0)){if(Zu(e),e=t=e.prev,e===e.next)break;o=!0}else e=e.next;while(o||e!==t);return t}function Xu(r,t,e,o,a,l,f){if(r){!f&&l&&xT(r,o,a,l);for(var h=r,p,d;r.prev!==r.next;){if(p=r.prev,d=r.next,l?hT(r,o,a,l):fT(r)){t.push(p.i/e|0),t.push(r.i/e|0),t.push(d.i/e|0),Zu(r),r=d.next,h=d.next;continue}if(r=d,r===h){f?f===1?(r=pT($s(r),t,e),Xu(r,t,e,o,a,l,2)):f===2&&dT(r,t,e,o,a,l):Xu($s(r),t,e,o,a,l,1);break}}}}function fT(r){var t=r.prev,e=r,o=r.next;if(Fn(t,e,o)>=0)return!1;for(var a=t.x,l=e.x,f=o.x,h=t.y,p=e.y,d=o.y,g=a<l?a<f?a:f:l<f?l:f,_=h<p?h<d?h:d:p<d?p:d,y=a>l?a>f?a:f:l>f?l:f,M=h>p?h>d?h:d:p>d?p:d,w=o.next;w!==t;){if(w.x>=g&&w.x<=y&&w.y>=_&&w.y<=M&&Qa(a,h,l,p,f,d,w.x,w.y)&&Fn(w.prev,w,w.next)>=0)return!1;w=w.next}return!0}function hT(r,t,e,o){var a=r.prev,l=r,f=r.next;if(Fn(a,l,f)>=0)return!1;for(var h=a.x,p=l.x,d=f.x,g=a.y,_=l.y,y=f.y,M=h<p?h<d?h:d:p<d?p:d,w=g<_?g<y?g:y:_<y?_:y,T=h>p?h>d?h:d:p>d?p:d,x=g>_?g>y?g:y:_>y?_:y,v=gp(M,w,t,e,o),C=gp(T,x,t,e,o),S=r.prevZ,O=r.nextZ;S&&S.z>=v&&O&&O.z<=C;){if(S.x>=M&&S.x<=T&&S.y>=w&&S.y<=x&&S!==a&&S!==f&&Qa(h,g,p,_,d,y,S.x,S.y)&&Fn(S.prev,S,S.next)>=0||(S=S.prevZ,O.x>=M&&O.x<=T&&O.y>=w&&O.y<=x&&O!==a&&O!==f&&Qa(h,g,p,_,d,y,O.x,O.y)&&Fn(O.prev,O,O.next)>=0))return!1;O=O.nextZ}for(;S&&S.z>=v;){if(S.x>=M&&S.x<=T&&S.y>=w&&S.y<=x&&S!==a&&S!==f&&Qa(h,g,p,_,d,y,S.x,S.y)&&Fn(S.prev,S,S.next)>=0)return!1;S=S.prevZ}for(;O&&O.z<=C;){if(O.x>=M&&O.x<=T&&O.y>=w&&O.y<=x&&O!==a&&O!==f&&Qa(h,g,p,_,d,y,O.x,O.y)&&Fn(O.prev,O,O.next)>=0)return!1;O=O.nextZ}return!0}function pT(r,t,e){var o=r;do{var a=o.prev,l=o.next.next;!Cc(a,l)&&V0(a,o,o.next,l)&&Yu(a,l)&&Yu(l,a)&&(t.push(a.i/e|0),t.push(o.i/e|0),t.push(l.i/e|0),Zu(o),Zu(o.next),o=r=l),o=o.next}while(o!==r);return $s(o)}function dT(r,t,e,o,a,l){var f=r;do{for(var h=f.next.next;h!==f.prev;){if(f.i!==h.i&&ST(f,h)){var p=H0(f,h);f=$s(f,f.next),p=$s(p,p.next),Xu(f,t,e,o,a,l,0),Xu(p,t,e,o,a,l,0);return}h=h.next}f=f.next}while(f!==r)}function mT(r,t,e,o){var a=[],l,f,h,p,d;for(l=0,f=t.length;l<f;l++)h=t[l]*o,p=l<f-1?t[l+1]*o:r.length,d=G0(r,h,p,o,!1),d===d.next&&(d.steiner=!0),a.push(MT(d));for(a.sort(gT),l=0;l<a.length;l++)e=yT(a[l],e);return e}function gT(r,t){return r.x-t.x}function yT(r,t){var e=vT(r,t);if(!e)return t;var o=H0(e,r);return $s(o,o.next),$s(e,e.next)}function vT(r,t){var e=t,o=r.x,a=r.y,l=-1/0,f;do{if(a<=e.y&&a>=e.next.y&&e.next.y!==e.y){var h=e.x+(a-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(h<=o&&h>l&&(l=h,f=e.x<e.next.x?e:e.next,h===o))return f}e=e.next}while(e!==t);if(!f)return null;var p=f,d=f.x,g=f.y,_=1/0,y;e=f;do o>=e.x&&e.x>=d&&o!==e.x&&Qa(a<g?o:l,a,d,g,a<g?l:o,a,e.x,e.y)&&(y=Math.abs(a-e.y)/(o-e.x),Yu(e,r)&&(y<_||y===_&&(e.x>f.x||e.x===f.x&&_T(f,e)))&&(f=e,_=y)),e=e.next;while(e!==p);return f}function _T(r,t){return Fn(r.prev,r,t.prev)<0&&Fn(t.next,r,r.next)<0}function xT(r,t,e,o){var a=r;do a.z===0&&(a.z=gp(a.x,a.y,t,e,o)),a.prevZ=a.prev,a.nextZ=a.next,a=a.next;while(a!==r);a.prevZ.nextZ=null,a.prevZ=null,ET(a)}function ET(r){var t,e,o,a,l,f,h,p,d=1;do{for(e=r,r=null,l=null,f=0;e;){for(f++,o=e,h=0,t=0;t<d&&(h++,o=o.nextZ,!!o);t++);for(p=d;h>0||p>0&&o;)h!==0&&(p===0||!o||e.z<=o.z)?(a=e,e=e.nextZ,h--):(a=o,o=o.nextZ,p--),l?l.nextZ=a:r=a,a.prevZ=l,l=a;e=o}l.nextZ=null,d*=2}while(f>1);return r}function gp(r,t,e,o,a){return r=(r-e)*a|0,t=(t-o)*a|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,r|t<<1}function MT(r){var t=r,e=r;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==r);return e}function Qa(r,t,e,o,a,l,f,h){return(a-f)*(t-h)>=(r-f)*(l-h)&&(r-f)*(o-h)>=(e-f)*(t-h)&&(e-f)*(l-h)>=(a-f)*(o-h)}function ST(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!wT(r,t)&&(Yu(r,t)&&Yu(t,r)&&bT(r,t)&&(Fn(r.prev,r,t.prev)||Fn(r,t.prev,t))||Cc(r,t)&&Fn(r.prev,r,r.next)>0&&Fn(t.prev,t,t.next)>0)}function Fn(r,t,e){return(t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y)}function Cc(r,t){return r.x===t.x&&r.y===t.y}function V0(r,t,e,o){var a=Tc(Fn(r,t,e)),l=Tc(Fn(r,t,o)),f=Tc(Fn(e,o,r)),h=Tc(Fn(e,o,t));return!!(a!==l&&f!==h||a===0&&bc(r,e,t)||l===0&&bc(r,o,t)||f===0&&bc(e,r,o)||h===0&&bc(e,t,o))}function bc(r,t,e){return t.x<=Math.max(r.x,e.x)&&t.x>=Math.min(r.x,e.x)&&t.y<=Math.max(r.y,e.y)&&t.y>=Math.min(r.y,e.y)}function Tc(r){return r>0?1:r<0?-1:0}function wT(r,t){var e=r;do{if(e.i!==r.i&&e.next.i!==r.i&&e.i!==t.i&&e.next.i!==t.i&&V0(e,e.next,r,t))return!0;e=e.next}while(e!==r);return!1}function Yu(r,t){return Fn(r.prev,r,r.next)<0?Fn(r,t,r.next)>=0&&Fn(r,r.prev,t)>=0:Fn(r,t,r.prev)<0||Fn(r,r.next,t)<0}function bT(r,t){var e=r,o=!1,a=(r.x+t.x)/2,l=(r.y+t.y)/2;do e.y>l!=e.next.y>l&&e.next.y!==e.y&&a<(e.next.x-e.x)*(l-e.y)/(e.next.y-e.y)+e.x&&(o=!o),e=e.next;while(e!==r);return o}function H0(r,t){var e=new yp(r.i,r.x,r.y),o=new yp(t.i,t.x,t.y),a=r.next,l=t.prev;return r.next=t,t.prev=r,e.next=a,a.prev=e,o.next=e,e.prev=o,l.next=o,o.prev=l,o}function k0(r,t,e,o){var a=new yp(r,t,e);return o?(a.next=o.next,a.prev=o,o.next.prev=a,o.next=a):(a.prev=a,a.next=a),a}function Zu(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function yp(r,t,e){this.i=r,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}Ac.deviation=function(r,t,e,o){var a=t&&t.length,l=a?t[0]*e:r.length,f=Math.abs(vp(r,0,l,e));if(a)for(var h=0,p=t.length;h<p;h++){var d=t[h]*e,g=h<p-1?t[h+1]*e:r.length;f-=Math.abs(vp(r,d,g,e))}var _=0;for(h=0;h<o.length;h+=3){var y=o[h]*e,M=o[h+1]*e,w=o[h+2]*e;_+=Math.abs((r[y]-r[w])*(r[M+1]-r[y+1])-(r[y]-r[M])*(r[w+1]-r[y+1]))}return f===0&&_===0?0:Math.abs((_-f)/f)};function vp(r,t,e,o){for(var a=0,l=t,f=e-o;l<e;l+=o)a+=(r[f]-r[l])*(r[l+1]+r[f+1]),f=l;return a}Ac.flatten=function(r){for(var t=r[0][0].length,e={vertices:[],holes:[],dimensions:t},o=0,a=0;a<r.length;a++){for(var l=0;l<r[a].length;l++)for(var f=0;f<t;f++)e.vertices.push(r[a][l][f]);a>0&&(o+=r[a-1].length,e.holes.push(o))}return e}});var wp=Kt(ue=>{"use strict";Object.defineProperty(ue,"__esModule",{value:!0});ue.earthRadius=63710088e-1;ue.factors={centimeters:ue.earthRadius*100,centimetres:ue.earthRadius*100,degrees:ue.earthRadius/111325,feet:ue.earthRadius*3.28084,inches:ue.earthRadius*39.37,kilometers:ue.earthRadius/1e3,kilometres:ue.earthRadius/1e3,meters:ue.earthRadius,metres:ue.earthRadius,miles:ue.earthRadius/1609.344,millimeters:ue.earthRadius*1e3,millimetres:ue.earthRadius*1e3,nauticalmiles:ue.earthRadius/1852,radians:1,yards:ue.earthRadius*1.0936};ue.unitsFactors={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:1/1e3,kilometres:1/1e3,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/ue.earthRadius,yards:1.0936133};ue.areaFactors={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,millimeters:1e6,millimetres:1e6,yards:1.195990046};function vs(r,t,e){e===void 0&&(e={});var o={type:"Feature"};return(e.id===0||e.id)&&(o.id=e.id),e.bbox&&(o.bbox=e.bbox),o.properties=t||{},o.geometry=r,o}ue.feature=vs;function AT(r,t,e){switch(e===void 0&&(e={}),r){case"Point":return xp(t).geometry;case"LineString":return Mp(t).geometry;case"Polygon":return Ep(t).geometry;case"MultiPoint":return X0(t).geometry;case"MultiLineString":return q0(t).geometry;case"MultiPolygon":return Y0(t).geometry;default:throw new Error(r+" is invalid")}}ue.geometry=AT;function xp(r,t,e){if(e===void 0&&(e={}),!r)throw new Error("coordinates is required");if(!Array.isArray(r))throw new Error("coordinates must be an Array");if(r.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Pc(r[0])||!Pc(r[1]))throw new Error("coordinates must contain numbers");var o={type:"Point",coordinates:r};return vs(o,t,e)}ue.point=xp;function CT(r,t,e){return e===void 0&&(e={}),Ic(r.map(function(o){return xp(o,t)}),e)}ue.points=CT;function Ep(r,t,e){e===void 0&&(e={});for(var o=0,a=r;o<a.length;o++){var l=a[o];if(l.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var f=0;f<l[l.length-1].length;f++)if(l[l.length-1][f]!==l[0][f])throw new Error("First and last Position are not equivalent.")}var h={type:"Polygon",coordinates:r};return vs(h,t,e)}ue.polygon=Ep;function PT(r,t,e){return e===void 0&&(e={}),Ic(r.map(function(o){return Ep(o,t)}),e)}ue.polygons=PT;function Mp(r,t,e){if(e===void 0&&(e={}),r.length<2)throw new Error("coordinates must be an array of two or more positions");var o={type:"LineString",coordinates:r};return vs(o,t,e)}ue.lineString=Mp;function IT(r,t,e){return e===void 0&&(e={}),Ic(r.map(function(o){return Mp(o,t)}),e)}ue.lineStrings=IT;function Ic(r,t){t===void 0&&(t={});var e={type:"FeatureCollection"};return t.id&&(e.id=t.id),t.bbox&&(e.bbox=t.bbox),e.features=r,e}ue.featureCollection=Ic;function q0(r,t,e){e===void 0&&(e={});var o={type:"MultiLineString",coordinates:r};return vs(o,t,e)}ue.multiLineString=q0;function X0(r,t,e){e===void 0&&(e={});var o={type:"MultiPoint",coordinates:r};return vs(o,t,e)}ue.multiPoint=X0;function Y0(r,t,e){e===void 0&&(e={});var o={type:"MultiPolygon",coordinates:r};return vs(o,t,e)}ue.multiPolygon=Y0;function RT(r,t,e){e===void 0&&(e={});var o={type:"GeometryCollection",geometries:r};return vs(o,t,e)}ue.geometryCollection=RT;function LT(r,t){if(t===void 0&&(t=0),t&&!(t>=0))throw new Error("precision must be a positive number");var e=Math.pow(10,t||0);return Math.round(r*e)/e}ue.round=LT;function Z0(r,t){t===void 0&&(t="kilometers");var e=ue.factors[t];if(!e)throw new Error(t+" units is invalid");return r*e}ue.radiansToLength=Z0;function Sp(r,t){t===void 0&&(t="kilometers");var e=ue.factors[t];if(!e)throw new Error(t+" units is invalid");return r/e}ue.lengthToRadians=Sp;function NT(r,t){return J0(Sp(r,t))}ue.lengthToDegrees=NT;function OT(r){var t=r%360;return t<0&&(t+=360),t}ue.bearingToAzimuth=OT;function J0(r){var t=r%(2*Math.PI);return t*180/Math.PI}ue.radiansToDegrees=J0;function DT(r){var t=r%360;return t*Math.PI/180}ue.degreesToRadians=DT;function FT(r,t,e){if(t===void 0&&(t="kilometers"),e===void 0&&(e="kilometers"),!(r>=0))throw new Error("length must be a positive number");return Z0(Sp(r,t),e)}ue.convertLength=FT;function UT(r,t,e){if(t===void 0&&(t="meters"),e===void 0&&(e="kilometers"),!(r>=0))throw new Error("area must be a positive number");var o=ue.areaFactors[t];if(!o)throw new Error("invalid original units");var a=ue.areaFactors[e];if(!a)throw new Error("invalid final units");return r/o*a}ue.convertArea=UT;function Pc(r){return!isNaN(r)&&r!==null&&!Array.isArray(r)}ue.isNumber=Pc;function BT(r){return!!r&&r.constructor===Object}ue.isObject=BT;function zT(r){if(!r)throw new Error("bbox is required");if(!Array.isArray(r))throw new Error("bbox must be an Array");if(r.length!==4&&r.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");r.forEach(function(t){if(!Pc(t))throw new Error("bbox must only contain numbers")})}ue.validateBBox=zT;function kT(r){if(!r)throw new Error("id is required");if(["string","number"].indexOf(typeof r)===-1)throw new Error("id must be a number or a string")}ue.validateId=kT});var Tp=Kt(ir=>{"use strict";Object.defineProperty(ir,"__esModule",{value:!0});var Gr=wp();function Ju(r,t,e){if(r!==null)for(var o,a,l,f,h,p,d,g=0,_=0,y,M=r.type,w=M==="FeatureCollection",T=M==="Feature",x=w?r.features.length:1,v=0;v<x;v++){d=w?r.features[v].geometry:T?r.geometry:r,y=d?d.type==="GeometryCollection":!1,h=y?d.geometries.length:1;for(var C=0;C<h;C++){var S=0,O=0;if(f=y?d.geometries[C]:d,f!==null){p=f.coordinates;var F=f.type;switch(g=e&&(F==="Polygon"||F==="MultiPolygon")?1:0,F){case null:break;case"Point":if(t(p,_,v,S,O)===!1)return!1;_++,S++;break;case"LineString":case"MultiPoint":for(o=0;o<p.length;o++){if(t(p[o],_,v,S,O)===!1)return!1;_++,F==="MultiPoint"&&S++}F==="LineString"&&S++;break;case"Polygon":case"MultiLineString":for(o=0;o<p.length;o++){for(a=0;a<p[o].length-g;a++){if(t(p[o][a],_,v,S,O)===!1)return!1;_++}F==="MultiLineString"&&S++,F==="Polygon"&&O++}F==="Polygon"&&S++;break;case"MultiPolygon":for(o=0;o<p.length;o++){for(O=0,a=0;a<p[o].length;a++){for(l=0;l<p[o][a].length-g;l++){if(t(p[o][a][l],_,v,S,O)===!1)return!1;_++}O++}S++}break;case"GeometryCollection":for(o=0;o<f.geometries.length;o++)if(Ju(f.geometries[o],t,e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function GT(r,t,e,o){var a=e;return Ju(r,function(l,f,h,p,d){f===0&&e===void 0?a=l:a=t(a,l,f,h,p,d)},o),a}function $0(r,t){var e;switch(r.type){case"FeatureCollection":for(e=0;e<r.features.length&&t(r.features[e].properties,e)!==!1;e++);break;case"Feature":t(r.properties,0);break}}function VT(r,t,e){var o=e;return $0(r,function(a,l){l===0&&e===void 0?o=a:o=t(o,a,l)}),o}function K0(r,t){if(r.type==="Feature")t(r,0);else if(r.type==="FeatureCollection")for(var e=0;e<r.features.length&&t(r.features[e],e)!==!1;e++);}function HT(r,t,e){var o=e;return K0(r,function(a,l){l===0&&e===void 0?o=a:o=t(o,a,l)}),o}function WT(r){var t=[];return Ju(r,function(e){t.push(e)}),t}function bp(r,t){var e,o,a,l,f,h,p,d,g,_,y=0,M=r.type==="FeatureCollection",w=r.type==="Feature",T=M?r.features.length:1;for(e=0;e<T;e++){for(h=M?r.features[e].geometry:w?r.geometry:r,d=M?r.features[e].properties:w?r.properties:{},g=M?r.features[e].bbox:w?r.bbox:void 0,_=M?r.features[e].id:w?r.id:void 0,p=h?h.type==="GeometryCollection":!1,f=p?h.geometries.length:1,a=0;a<f;a++){if(l=p?h.geometries[a]:h,l===null){if(t(null,y,d,g,_)===!1)return!1;continue}switch(l.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(t(l,y,d,g,_)===!1)return!1;break}case"GeometryCollection":{for(o=0;o<l.geometries.length;o++)if(t(l.geometries[o],y,d,g,_)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}y++}}function qT(r,t,e){var o=e;return bp(r,function(a,l,f,h,p){l===0&&e===void 0?o=a:o=t(o,a,l,f,h,p)}),o}function Rc(r,t){bp(r,function(e,o,a,l,f){var h=e===null?null:e.type;switch(h){case null:case"Point":case"LineString":case"Polygon":return t(Gr.feature(e,a,{bbox:l,id:f}),o,0)===!1?!1:void 0}var p;switch(h){case"MultiPoint":p="Point";break;case"MultiLineString":p="LineString";break;case"MultiPolygon":p="Polygon";break}for(var d=0;d<e.coordinates.length;d++){var g=e.coordinates[d],_={type:p,coordinates:g};if(t(Gr.feature(_,a),o,d)===!1)return!1}})}function XT(r,t,e){var o=e;return Rc(r,function(a,l,f){l===0&&f===0&&e===void 0?o=a:o=t(o,a,l,f)}),o}function j0(r,t){Rc(r,function(e,o,a){var l=0;if(e.geometry){var f=e.geometry.type;if(!(f==="Point"||f==="MultiPoint")){var h,p=0,d=0,g=0;if(Ju(e,function(_,y,M,w,T){if(h===void 0||o>p||w>d||T>g){h=_,p=o,d=w,g=T,l=0;return}var x=Gr.lineString([h,_],e.properties);if(t(x,o,a,T,l)===!1)return!1;l++,h=_})===!1)return!1}}})}function YT(r,t,e){var o=e,a=!1;return j0(r,function(l,f,h,p,d){a===!1&&e===void 0?o=l:o=t(o,l,f,h,p,d),a=!0}),o}function Q0(r,t){if(!r)throw new Error("geojson is required");Rc(r,function(e,o,a){if(e.geometry!==null){var l=e.geometry.type,f=e.geometry.coordinates;switch(l){case"LineString":if(t(e,o,a,0,0)===!1)return!1;break;case"Polygon":for(var h=0;h<f.length;h++)if(t(Gr.lineString(f[h],e.properties),o,a,h)===!1)return!1;break}}})}function ZT(r,t,e){var o=e;return Q0(r,function(a,l,f,h){l===0&&e===void 0?o=a:o=t(o,a,l,f,h)}),o}function JT(r,t){if(t=t||{},!Gr.isObject(t))throw new Error("options is invalid");var e=t.featureIndex||0,o=t.multiFeatureIndex||0,a=t.geometryIndex||0,l=t.segmentIndex||0,f=t.properties,h;switch(r.type){case"FeatureCollection":e<0&&(e=r.features.length+e),f=f||r.features[e].properties,h=r.features[e].geometry;break;case"Feature":f=f||r.properties,h=r.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":h=r;break;default:throw new Error("geojson is invalid")}if(h===null)return null;var p=h.coordinates;switch(h.type){case"Point":case"MultiPoint":return null;case"LineString":return l<0&&(l=p.length+l-1),Gr.lineString([p[l],p[l+1]],f,t);case"Polygon":return a<0&&(a=p.length+a),l<0&&(l=p[a].length+l-1),Gr.lineString([p[a][l],p[a][l+1]],f,t);case"MultiLineString":return o<0&&(o=p.length+o),l<0&&(l=p[o].length+l-1),Gr.lineString([p[o][l],p[o][l+1]],f,t);case"MultiPolygon":return o<0&&(o=p.length+o),a<0&&(a=p[o].length+a),l<0&&(l=p[o][a].length-l-1),Gr.lineString([p[o][a][l],p[o][a][l+1]],f,t)}throw new Error("geojson is invalid")}function $T(r,t){if(t=t||{},!Gr.isObject(t))throw new Error("options is invalid");var e=t.featureIndex||0,o=t.multiFeatureIndex||0,a=t.geometryIndex||0,l=t.coordIndex||0,f=t.properties,h;switch(r.type){case"FeatureCollection":e<0&&(e=r.features.length+e),f=f||r.features[e].properties,h=r.features[e].geometry;break;case"Feature":f=f||r.properties,h=r.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":h=r;break;default:throw new Error("geojson is invalid")}if(h===null)return null;var p=h.coordinates;switch(h.type){case"Point":return Gr.point(p,f,t);case"MultiPoint":return o<0&&(o=p.length+o),Gr.point(p[o],f,t);case"LineString":return l<0&&(l=p.length+l),Gr.point(p[l],f,t);case"Polygon":return a<0&&(a=p.length+a),l<0&&(l=p[a].length+l),Gr.point(p[a][l],f,t);case"MultiLineString":return o<0&&(o=p.length+o),l<0&&(l=p[o].length+l),Gr.point(p[o][l],f,t);case"MultiPolygon":return o<0&&(o=p.length+o),a<0&&(a=p[o].length+a),l<0&&(l=p[o][a].length-l),Gr.point(p[o][a][l],f,t)}throw new Error("geojson is invalid")}ir.coordAll=WT;ir.coordEach=Ju;ir.coordReduce=GT;ir.featureEach=K0;ir.featureReduce=HT;ir.findPoint=$T;ir.findSegment=JT;ir.flattenEach=Rc;ir.flattenReduce=XT;ir.geomEach=bp;ir.geomReduce=qT;ir.lineEach=Q0;ir.lineReduce=ZT;ir.propEach=$0;ir.propReduce=VT;ir.segmentEach=j0;ir.segmentReduce=YT});var ty=Kt(Cp=>{"use strict";Object.defineProperty(Cp,"__esModule",{value:!0});var KT=Tp();function Ap(r){var t=[1/0,1/0,-1/0,-1/0];return KT.coordEach(r,function(e){t[0]>e[0]&&(t[0]=e[0]),t[1]>e[1]&&(t[1]=e[1]),t[2]<e[0]&&(t[2]=e[0]),t[3]<e[1]&&(t[3]=e[1])}),t}Ap.default=Ap;Cp.default=Ap});var Lc=Kt((bO,Pp)=>{var po=tp(),ny=wp(),ry=Tp(),tu=ty().default,jT=ry.featureEach,SO=ry.coordEach,wO=ny.polygon,ey=ny.featureCollection;function iy(r){var t=new po(r);return t.insert=function(e){if(e.type!=="Feature")throw new Error("invalid feature");return e.bbox=e.bbox?e.bbox:tu(e),po.prototype.insert.call(this,e)},t.load=function(e){var o=[];return Array.isArray(e)?e.forEach(function(a){if(a.type!=="Feature")throw new Error("invalid features");a.bbox=a.bbox?a.bbox:tu(a),o.push(a)}):jT(e,function(a){if(a.type!=="Feature")throw new Error("invalid features");a.bbox=a.bbox?a.bbox:tu(a),o.push(a)}),po.prototype.load.call(this,o)},t.remove=function(e,o){if(e.type!=="Feature")throw new Error("invalid feature");return e.bbox=e.bbox?e.bbox:tu(e),po.prototype.remove.call(this,e,o)},t.clear=function(){return po.prototype.clear.call(this)},t.search=function(e){var o=po.prototype.search.call(this,this.toBBox(e));return ey(o)},t.collides=function(e){return po.prototype.collides.call(this,this.toBBox(e))},t.all=function(){var e=po.prototype.all.call(this);return ey(e)},t.toJSON=function(){return po.prototype.toJSON.call(this)},t.fromJSON=function(e){return po.prototype.fromJSON.call(this,e)},t.toBBox=function(e){var o;if(e.bbox)o=e.bbox;else if(Array.isArray(e)&&e.length===4)o=e;else if(Array.isArray(e)&&e.length===6)o=[e[0],e[1],e[3],e[4]];else if(e.type==="Feature")o=tu(e);else if(e.type==="FeatureCollection")o=tu(e);else throw new Error("invalid geojson");return{minX:o[0],minY:o[1],maxX:o[2],maxY:o[3]}},t}Pp.exports=iy;Pp.exports.default=iy});var Dp=Kt((O3,dy)=>{"use strict";var py=Object.prototype.toString;dy.exports=function(t){var e=py.call(t),o=e==="[object Arguments]";return o||(o=e!=="[object Array]"&&t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&py.call(t.callee)==="[object Function]"),o}});var Sy=Kt((D3,My)=>{"use strict";var Ey;Object.keys||(ju=Object.prototype.hasOwnProperty,Fp=Object.prototype.toString,my=Dp(),Up=Object.prototype.propertyIsEnumerable,gy=!Up.call({toString:null},"toString"),yy=Up.call(function(){},"prototype"),Qu=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],Uc=function(r){var t=r.constructor;return t&&t.prototype===r},vy={$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},_y=function(){if(typeof window=="undefined")return!1;for(var r in window)try{if(!vy["$"+r]&&ju.call(window,r)&&window[r]!==null&&typeof window[r]=="object")try{Uc(window[r])}catch(t){return!0}}catch(t){return!0}return!1}(),xy=function(r){if(typeof window=="undefined"||!_y)return Uc(r);try{return Uc(r)}catch(t){return!1}},Ey=function(t){var e=t!==null&&typeof t=="object",o=Fp.call(t)==="[object Function]",a=my(t),l=e&&Fp.call(t)==="[object String]",f=[];if(!e&&!o&&!a)throw new TypeError("Object.keys called on a non-object");var h=yy&&o;if(l&&t.length>0&&!ju.call(t,0))for(var p=0;p<t.length;++p)f.push(String(p));if(a&&t.length>0)for(var d=0;d<t.length;++d)f.push(String(d));else for(var g in t)!(h&&g==="prototype")&&ju.call(t,g)&&f.push(String(g));if(gy)for(var _=xy(t),y=0;y<Qu.length;++y)!(_&&Qu[y]==="constructor")&&ju.call(t,Qu[y])&&f.push(Qu[y]);return f});var ju,Fp,my,Up,gy,yy,Qu,Uc,vy,_y,xy;My.exports=Ey});var Bp=Kt((F3,Ty)=>{"use strict";var uA=Array.prototype.slice,lA=Dp(),wy=Object.keys,Bc=wy?function(t){return wy(t)}:Sy(),by=Object.keys;Bc.shim=function(){if(Object.keys){var t=function(){var e=Object.keys(arguments);return e&&e.length===arguments.length}(1,2);t||(Object.keys=function(o){return lA(o)?by(uA.call(o)):by(o)})}else Object.keys=Bc;return Object.keys||Bc};Ty.exports=Bc});var zp=Kt((U3,Ay)=>{"use strict";Ay.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},e=Symbol("test"),o=Object(e);if(typeof e=="string"||Object.prototype.toString.call(e)!=="[object Symbol]"||Object.prototype.toString.call(o)!=="[object Symbol]")return!1;var a=42;t[e]=a;for(e in t)return!1;if(typeof Object.keys=="function"&&Object.keys(t).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var l=Object.getOwnPropertySymbols(t);if(l.length!==1||l[0]!==e||!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var f=Object.getOwnPropertyDescriptor(t,e);if(f.value!==a||f.enumerable!==!0)return!1}return!0}});var zc=Kt((B3,Cy)=>{"use strict";var cA=zp();Cy.exports=function(){return cA()&&!!Symbol.toStringTag}});var Ry=Kt((z3,Iy)=>{"use strict";var Py=typeof Symbol!="undefined"&&Symbol,fA=zp();Iy.exports=function(){return typeof Py!="function"||typeof Symbol!="function"||typeof Py("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:fA()}});var Oy=Kt((k3,Ny)=>{"use strict";var Ly={foo:{}},hA=Object;Ny.exports=function(){return{__proto__:Ly}.foo===Ly.foo&&!({__proto__:null}instanceof hA)}});var Uy=Kt((G3,Fy)=>{"use strict";var pA="Function.prototype.bind called on incompatible ",dA=Object.prototype.toString,mA=Math.max,gA="[object Function]",Dy=function(t,e){for(var o=[],a=0;a<t.length;a+=1)o[a]=t[a];for(var l=0;l<e.length;l+=1)o[l+t.length]=e[l];return o},yA=function(t,e){for(var o=[],a=e||0,l=0;a<t.length;a+=1,l+=1)o[l]=t[a];return o},vA=function(r,t){for(var e="",o=0;o<r.length;o+=1)e+=r[o],o+1<r.length&&(e+=t);return e};Fy.exports=function(t){var e=this;if(typeof e!="function"||dA.apply(e)!==gA)throw new TypeError(pA+e);for(var o=yA(arguments,1),a,l=function(){if(this instanceof a){var g=e.apply(this,Dy(o,arguments));return Object(g)===g?g:this}return e.apply(t,Dy(o,arguments))},f=mA(0,e.length-o.length),h=[],p=0;p<f;p++)h[p]="$"+p;if(a=Function("binder","return function ("+vA(h,",")+"){ return binder.apply(this,arguments); }")(l),e.prototype){var d=function(){};d.prototype=e.prototype,a.prototype=new d,d.prototype=null}return a}});var kc=Kt((V3,By)=>{"use strict";var _A=Uy();By.exports=Function.prototype.bind||_A});var ky=Kt((H3,zy)=>{"use strict";var xA=Function.prototype.call,EA=Object.prototype.hasOwnProperty,MA=kc();zy.exports=MA.call(xA,EA)});var Qs=Kt((W3,qy)=>{"use strict";var tn,iu=SyntaxError,Wy=Function,ru=TypeError,kp=function(r){try{return Wy('"use strict"; return ('+r+").constructor;")()}catch(t){}},Ks=Object.getOwnPropertyDescriptor;if(Ks)try{Ks({},"")}catch(r){Ks=null}var Gp=function(){throw new ru},SA=Ks?function(){try{return arguments.callee,Gp}catch(r){try{return Ks(arguments,"callee").get}catch(t){return Gp}}}():Gp,eu=Ry()(),wA=Oy()(),vr=Object.getPrototypeOf||(wA?function(r){return r.__proto__}:null),nu={},bA=typeof Uint8Array=="undefined"||!vr?tn:vr(Uint8Array),js={"%AggregateError%":typeof AggregateError=="undefined"?tn:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer=="undefined"?tn:ArrayBuffer,"%ArrayIteratorPrototype%":eu&&vr?vr([][Symbol.iterator]()):tn,"%AsyncFromSyncIteratorPrototype%":tn,"%AsyncFunction%":nu,"%AsyncGenerator%":nu,"%AsyncGeneratorFunction%":nu,"%AsyncIteratorPrototype%":nu,"%Atomics%":typeof Atomics=="undefined"?tn:Atomics,"%BigInt%":typeof BigInt=="undefined"?tn:BigInt,"%BigInt64Array%":typeof BigInt64Array=="undefined"?tn:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array=="undefined"?tn:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView=="undefined"?tn:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array=="undefined"?tn:Float32Array,"%Float64Array%":typeof Float64Array=="undefined"?tn:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry=="undefined"?tn:FinalizationRegistry,"%Function%":Wy,"%GeneratorFunction%":nu,"%Int8Array%":typeof Int8Array=="undefined"?tn:Int8Array,"%Int16Array%":typeof Int16Array=="undefined"?tn:Int16Array,"%Int32Array%":typeof Int32Array=="undefined"?tn:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":eu&&vr?vr(vr([][Symbol.iterator]())):tn,"%JSON%":typeof JSON=="object"?JSON:tn,"%Map%":typeof Map=="undefined"?tn:Map,"%MapIteratorPrototype%":typeof Map=="undefined"||!eu||!vr?tn:vr(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise=="undefined"?tn:Promise,"%Proxy%":typeof Proxy=="undefined"?tn:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect=="undefined"?tn:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set=="undefined"?tn:Set,"%SetIteratorPrototype%":typeof Set=="undefined"||!eu||!vr?tn:vr(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer=="undefined"?tn:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":eu&&vr?vr(""[Symbol.iterator]()):tn,"%Symbol%":eu?Symbol:tn,"%SyntaxError%":iu,"%ThrowTypeError%":SA,"%TypedArray%":bA,"%TypeError%":ru,"%Uint8Array%":typeof Uint8Array=="undefined"?tn:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray=="undefined"?tn:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array=="undefined"?tn:Uint16Array,"%Uint32Array%":typeof Uint32Array=="undefined"?tn:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap=="undefined"?tn:WeakMap,"%WeakRef%":typeof WeakRef=="undefined"?tn:WeakRef,"%WeakSet%":typeof WeakSet=="undefined"?tn:WeakSet};if(vr)try{null.error}catch(r){Gy=vr(vr(r)),js["%Error.prototype%"]=Gy}var Gy,TA=function r(t){var e;if(t==="%AsyncFunction%")e=kp("async function () {}");else if(t==="%GeneratorFunction%")e=kp("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=kp("async function* () {}");else if(t==="%AsyncGenerator%"){var o=r("%AsyncGeneratorFunction%");o&&(e=o.prototype)}else if(t==="%AsyncIteratorPrototype%"){var a=r("%AsyncGenerator%");a&&vr&&(e=vr(a.prototype))}return js[t]=e,e},Vy={"%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"]},tl=kc(),Gc=ky(),AA=tl.call(Function.call,Array.prototype.concat),CA=tl.call(Function.apply,Array.prototype.splice),Hy=tl.call(Function.call,String.prototype.replace),Vc=tl.call(Function.call,String.prototype.slice),PA=tl.call(Function.call,RegExp.prototype.exec),IA=/[^%.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|(["'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|%$))/g,RA=/\\\\(\\\\)?/g,LA=function(t){var e=Vc(t,0,1),o=Vc(t,-1);if(e==="%"&&o!=="%")throw new iu("invalid intrinsic syntax, expected closing \`%\`");if(o==="%"&&e!=="%")throw new iu("invalid intrinsic syntax, expected opening \`%\`");var a=[];return Hy(t,IA,function(l,f,h,p){a[a.length]=h?Hy(p,RA,"$1"):f||l}),a},NA=function(t,e){var o=t,a;if(Gc(Vy,o)&&(a=Vy[o],o="%"+a[0]+"%"),Gc(js,o)){var l=js[o];if(l===nu&&(l=TA(o)),typeof l=="undefined"&&!e)throw new ru("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:a,name:o,value:l}}throw new iu("intrinsic "+t+" does not exist!")};qy.exports=function(t,e){if(typeof t!="string"||t.length===0)throw new ru("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new ru('"allowMissing" argument must be a boolean');if(PA(/^%?[^%]*%?$/,t)===null)throw new iu("\`%\` may not be present anywhere but at the beginning and end of the intrinsic name");var o=LA(t),a=o.length>0?o[0]:"",l=NA("%"+a+"%",e),f=l.name,h=l.value,p=!1,d=l.alias;d&&(a=d[0],CA(o,AA([0,1],d)));for(var g=1,_=!0;g<o.length;g+=1){var y=o[g],M=Vc(y,0,1),w=Vc(y,-1);if((M==='"'||M==="'"||M==="\`"||w==='"'||w==="'"||w==="\`")&&M!==w)throw new iu("property names with quotes must have matching quotes");if((y==="constructor"||!_)&&(p=!0),a+="."+y,f="%"+a+"%",Gc(js,f))h=js[f];else if(h!=null){if(!(y in h)){if(!e)throw new ru("base intrinsic for "+t+" exists, but the property is not available.");return}if(Ks&&g+1>=o.length){var T=Ks(h,y);_=!!T,_&&"get"in T&&!("originalValue"in T.get)?h=T.get:h=h[y]}else _=Gc(h,y),h=h[y];_&&!p&&(js[f]=h)}}return h}});var el=Kt((q3,Xy)=>{"use strict";var OA=Qs(),Vp=OA("%Object.defineProperty%",!0),Hp=function(){if(Vp)try{return Vp({},"a",{value:1}),!0}catch(t){return!1}return!1};Hp.hasArrayLengthDefineBug=function(){if(!Hp())return null;try{return Vp([],"length",{value:1}).length!==1}catch(t){return!0}};Xy.exports=Hp});var Wp=Kt((X3,Yy)=>{"use strict";var DA=Qs(),Hc=DA("%Object.getOwnPropertyDescriptor%",!0);if(Hc)try{Hc([],"length")}catch(r){Hc=null}Yy.exports=Hc});var Wc=Kt((Y3,Jy)=>{"use strict";var FA=el()(),qp=Qs(),nl=FA&&qp("%Object.defineProperty%",!0);if(nl)try{nl({},"a",{value:1})}catch(r){nl=!1}var UA=qp("%SyntaxError%"),ou=qp("%TypeError%"),Zy=Wp();Jy.exports=function(t,e,o){if(!t||typeof t!="object"&&typeof t!="function")throw new ou("\`obj\` must be an object or a function\`");if(typeof e!="string"&&typeof e!="symbol")throw new ou("\`property\` must be a string or a symbol\`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new ou("\`nonEnumerable\`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new ou("\`nonWritable\`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new ou("\`nonConfigurable\`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new ou("\`loose\`, if provided, must be a boolean");var a=arguments.length>3?arguments[3]:null,l=arguments.length>4?arguments[4]:null,f=arguments.length>5?arguments[5]:null,h=arguments.length>6?arguments[6]:!1,p=!!Zy&&Zy(t,e);if(nl)nl(t,e,{configurable:f===null&&p?p.configurable:!f,enumerable:a===null&&p?p.enumerable:!a,value:o,writable:l===null&&p?p.writable:!l});else if(h||!a&&!l&&!f)t[e]=o;else throw new UA("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var ev=Kt((Z3,tv)=>{"use strict";var Qy=Qs(),$y=Wc(),BA=el()(),Ky=Wp(),jy=Qy("%TypeError%"),zA=Qy("%Math.floor%");tv.exports=function(t,e){if(typeof t!="function")throw new jy("\`fn\` is not a function");if(typeof e!="number"||e<0||e>4294967295||zA(e)!==e)throw new jy("\`length\` must be a positive 32-bit integer");var o=arguments.length>2&&!!arguments[2],a=!0,l=!0;if("length"in t&&Ky){var f=Ky(t,"length");f&&!f.configurable&&(a=!1),f&&!f.writable&&(l=!1)}return(a||l||!o)&&(BA?$y(t,"length",e,!0,!0):$y(t,"length",e)),t}});var Xc=Kt((J3,qc)=>{"use strict";var Xp=kc(),su=Qs(),kA=ev(),GA=su("%TypeError%"),rv=su("%Function.prototype.apply%"),iv=su("%Function.prototype.call%"),ov=su("%Reflect.apply%",!0)||Xp.call(iv,rv),rl=su("%Object.defineProperty%",!0),VA=su("%Math.max%");if(rl)try{rl({},"a",{value:1})}catch(r){rl=null}qc.exports=function(t){if(typeof t!="function")throw new GA("a function is required");var e=ov(Xp,iv,arguments);return kA(e,1+VA(0,t.length-(arguments.length-1)),!0)};var nv=function(){return ov(Xp,rv,arguments)};rl?rl(qc.exports,"apply",{value:nv}):qc.exports.apply=nv});var Yp=Kt(($3,uv)=>{"use strict";var sv=Qs(),av=Xc(),HA=av(sv("String.prototype.indexOf"));uv.exports=function(t,e){var o=sv(t,!!e);return typeof o=="function"&&HA(t,".prototype.")>-1?av(o):o}});var fv=Kt((K3,cv)=>{"use strict";var WA=zc()(),qA=Yp(),Zp=qA("Object.prototype.toString"),Yc=function(t){return WA&&t&&typeof t=="object"&&Symbol.toStringTag in t?!1:Zp(t)==="[object Arguments]"},lv=function(t){return Yc(t)?!0:t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&Zp(t)!=="[object Array]"&&Zp(t.callee)==="[object Function]"},XA=function(){return Yc(arguments)}();Yc.isLegacyArguments=lv;cv.exports=XA?Yc:lv});var au=Kt((j3,mv)=>{"use strict";var YA=Bp(),ZA=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",JA=Object.prototype.toString,$A=Array.prototype.concat,hv=Wc(),KA=function(r){return typeof r=="function"&&JA.call(r)==="[object Function]"},pv=el()(),jA=function(r,t,e,o){if(t in r){if(o===!0){if(r[t]===e)return}else if(!KA(o)||!o())return}pv?hv(r,t,e,!0):hv(r,t,e)},dv=function(r,t){var e=arguments.length>2?arguments[2]:{},o=YA(t);ZA&&(o=$A.call(o,Object.getOwnPropertySymbols(t)));for(var a=0;a<o.length;a+=1)jA(r,o[a],t[o[a]],e[o[a]])};dv.supportsDescriptors=!!pv;mv.exports=dv});var Jp=Kt((Q3,yv)=>{"use strict";var gv=function(r){return r!==r};yv.exports=function(t,e){return t===0&&e===0?1/t===1/e:!!(t===e||gv(t)&&gv(e))}});var $p=Kt((tF,vv)=>{"use strict";var QA=Jp();vv.exports=function(){return typeof Object.is=="function"?Object.is:QA}});var xv=Kt((eF,_v)=>{"use strict";var tC=$p(),eC=au();_v.exports=function(){var t=tC();return eC(Object,{is:t},{is:function(){return Object.is!==t}}),t}});var wv=Kt((nF,Sv)=>{"use strict";var nC=au(),rC=Xc(),iC=Jp(),Ev=$p(),oC=xv(),Mv=rC(Ev(),Object);nC(Mv,{getPolyfill:Ev,implementation:iC,shim:oC});Sv.exports=Mv});var Pv=Kt((rF,Cv)=>{"use strict";var Kp=Yp(),bv=zc()(),Tv,Av,jp,Qp;bv&&(Tv=Kp("Object.prototype.hasOwnProperty"),Av=Kp("RegExp.prototype.exec"),jp={},Zc=function(){throw jp},Qp={toString:Zc,valueOf:Zc},typeof Symbol.toPrimitive=="symbol"&&(Qp[Symbol.toPrimitive]=Zc));var Zc,sC=Kp("Object.prototype.toString"),aC=Object.getOwnPropertyDescriptor,uC="[object RegExp]";Cv.exports=bv?function(t){if(!t||typeof t!="object")return!1;var e=aC(t,"lastIndex"),o=e&&Tv(e,"value");if(!o)return!1;try{Av(t,Qp)}catch(a){return a===jp}}:function(t){return!t||typeof t!="object"&&typeof t!="function"?!1:sC(t)===uC}});var Rv=Kt((iF,Iv)=>{"use strict";var ol=function(){return typeof function(){}.name=="string"},il=Object.getOwnPropertyDescriptor;if(il)try{il([],"length")}catch(r){il=null}ol.functionsHaveConfigurableNames=function(){if(!ol()||!il)return!1;var t=il(function(){},"name");return!!t&&!!t.configurable};var lC=Function.prototype.bind;ol.boundFunctionsHaveNames=function(){return ol()&&typeof lC=="function"&&function(){}.bind().name!==""};Iv.exports=ol});var Ov=Kt((oF,Nv)=>{"use strict";var Lv=Wc(),cC=el()(),fC=Rv().functionsHaveConfigurableNames(),hC=TypeError;Nv.exports=function(t,e){if(typeof t!="function")throw new hC("\`fn\` is not a function");var o=arguments.length>2&&!!arguments[2];return(!o||fC)&&(cC?Lv(t,"name",e,!0,!0):Lv(t,"name",e)),t}});var td=Kt((sF,Dv)=>{"use strict";var pC=Ov(),dC=Object,mC=TypeError;Dv.exports=pC(function(){if(this!=null&&this!==dC(this))throw new mC("RegExp.prototype.flags getter called on non-object");var t="";return this.hasIndices&&(t+="d"),this.global&&(t+="g"),this.ignoreCase&&(t+="i"),this.multiline&&(t+="m"),this.dotAll&&(t+="s"),this.unicode&&(t+="u"),this.unicodeSets&&(t+="v"),this.sticky&&(t+="y"),t},"get flags",!0)});var ed=Kt((aF,Fv)=>{"use strict";var gC=td(),yC=au().supportsDescriptors,vC=Object.getOwnPropertyDescriptor;Fv.exports=function(){if(yC&&/a/mig.flags==="gim"){var t=vC(RegExp.prototype,"flags");if(t&&typeof t.get=="function"&&typeof RegExp.prototype.dotAll=="boolean"&&typeof RegExp.prototype.hasIndices=="boolean"){var e="",o={};if(Object.defineProperty(o,"hasIndices",{get:function(){e+="d"}}),Object.defineProperty(o,"sticky",{get:function(){e+="y"}}),e==="dy")return t.get}}return gC}});var zv=Kt((uF,Bv)=>{"use strict";var _C=au().supportsDescriptors,xC=ed(),EC=Object.getOwnPropertyDescriptor,MC=Object.defineProperty,SC=TypeError,Uv=Object.getPrototypeOf,wC=/a/;Bv.exports=function(){if(!_C||!Uv)throw new SC("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var t=xC(),e=Uv(wC),o=EC(e,"flags");return(!o||o.get!==t)&&MC(e,"flags",{configurable:!0,enumerable:!1,get:t}),t}});var Hv=Kt((lF,Vv)=>{"use strict";var bC=au(),TC=Xc(),AC=td(),kv=ed(),CC=zv(),Gv=TC(kv());bC(Gv,{getPolyfill:kv,implementation:AC,shim:CC});Vv.exports=Gv});var qv=Kt((cF,Wv)=>{"use strict";var PC=Date.prototype.getDay,IC=function(t){try{return PC.call(t),!0}catch(e){return!1}},RC=Object.prototype.toString,LC="[object Date]",NC=zc()();Wv.exports=function(t){return typeof t!="object"||t===null?!1:NC?IC(t):RC.call(t)===LC}});var nd=Kt((fF,n_)=>{var Xv=Bp(),Yv=fv(),Zv=wv(),Jv=Pv(),$v=Hv(),Kv=qv(),jv=Date.prototype.getTime;function e_(r,t,e){var o=e||{};return(o.strict?Zv(r,t):r===t)?!0:!r||!t||typeof r!="object"&&typeof t!="object"?o.strict?Zv(r,t):r==t:OC(r,t,o)}function Qv(r){return r==null}function t_(r){return!(!r||typeof r!="object"||typeof r.length!="number"||typeof r.copy!="function"||typeof r.slice!="function"||r.length>0&&typeof r[0]!="number")}function OC(r,t,e){var o,a;if(typeof r!=typeof t||Qv(r)||Qv(t)||r.prototype!==t.prototype||Yv(r)!==Yv(t))return!1;var l=Jv(r),f=Jv(t);if(l!==f)return!1;if(l||f)return r.source===t.source&&$v(r)===$v(t);if(Kv(r)&&Kv(t))return jv.call(r)===jv.call(t);var h=t_(r),p=t_(t);if(h!==p)return!1;if(h||p){if(r.length!==t.length)return!1;for(o=0;o<r.length;o++)if(r[o]!==t[o])return!1;return!0}if(typeof r!=typeof t)return!1;try{var d=Xv(r),g=Xv(t)}catch(_){return!1}if(d.length!==g.length)return!1;for(d.sort(),g.sort(),o=d.length-1;o>=0;o--)if(d[o]!=g[o])return!1;for(o=d.length-1;o>=0;o--)if(a=d[o],!e_(r[a],t[a],e))return!1;return!0}n_.exports=e_});var dd=Kt((yB,l_)=>{var wP=nd(),mo=function(r){this.precision=r&&r.precision?r.precision:17,this.direction=r&&r.direction?r.direction:!1,this.pseudoNode=r&&r.pseudoNode?r.pseudoNode:!1,this.objectComparator=r&&r.objectComparator?r.objectComparator:bP};mo.prototype.compare=function(r,t){if(r.type!==t.type||!u_(r,t))return!1;switch(r.type){case"Point":return this.compareCoord(r.coordinates,t.coordinates);case"LineString":return this.compareLine(r.coordinates,t.coordinates,0,!1);case"Polygon":return this.comparePolygon(r,t);case"Feature":return this.compareFeature(r,t);default:if(r.type.indexOf("Multi")===0){var e=this,o=a_(r),a=a_(t);return o.every(function(l){return this.some(function(f){return e.compare(l,f)})},a)}}return!1};function a_(r){return r.coordinates.map(function(t){return{type:r.type.replace("Multi",""),coordinates:t}})}function u_(r,t){return r.hasOwnProperty("coordinates")?r.coordinates.length===t.coordinates.length:r.length===t.length}mo.prototype.compareCoord=function(r,t){if(r.length!==t.length)return!1;for(var e=0;e<r.length;e++)if(r[e].toFixed(this.precision)!==t[e].toFixed(this.precision))return!1;return!0};mo.prototype.compareLine=function(r,t,e,o){if(!u_(r,t))return!1;var a=this.pseudoNode?r:this.removePseudo(r),l=this.pseudoNode?t:this.removePseudo(t);if(!(o&&!this.compareCoord(a[0],l[0])&&(l=this.fixStartIndex(l,a),!l))){var f=this.compareCoord(a[e],l[e]);return this.direction||f?this.comparePath(a,l):this.compareCoord(a[e],l[l.length-(1+e)])?this.comparePath(a.slice().reverse(),l):!1}};mo.prototype.fixStartIndex=function(r,t){for(var e,o=-1,a=0;a<r.length;a++)if(this.compareCoord(r[a],t[0])){o=a;break}return o>=0&&(e=[].concat(r.slice(o,r.length),r.slice(1,o+1))),e};mo.prototype.comparePath=function(r,t){var e=this;return r.every(function(o,a){return e.compareCoord(o,this[a])},t)};mo.prototype.comparePolygon=function(r,t){if(this.compareLine(r.coordinates[0],t.coordinates[0],1,!0)){var e=r.coordinates.slice(1,r.coordinates.length),o=t.coordinates.slice(1,t.coordinates.length),a=this;return e.every(function(l){return this.some(function(f){return a.compareLine(l,f,1,!0)})},o)}else return!1};mo.prototype.compareFeature=function(r,t){return r.id!==t.id||!this.objectComparator(r.properties,t.properties)||!this.compareBBox(r,t)?!1:this.compare(r.geometry,t.geometry)};mo.prototype.compareBBox=function(r,t){return!!(!r.bbox&&!t.bbox||r.bbox&&t.bbox&&this.compareCoord(r.bbox,t.bbox))};mo.prototype.removePseudo=function(r){return r};function bP(r,t){return wP(r,t,{strict:!0})}l_.exports=mo});var c_=Kt((PB,Kc)=>{function xs(r,t,e,o){this.dataset=[],this.epsilon=1,this.minPts=2,this.distance=this._euclideanDistance,this.clusters=[],this.noise=[],this._visited=[],this._assigned=[],this._datasetLength=0,this._init(r,t,e,o)}xs.prototype.run=function(r,t,e,o){this._init(r,t,e,o);for(var a=0;a<this._datasetLength;a++)if(this._visited[a]!==1){this._visited[a]=1;var l=this._regionQuery(a);if(l.length<this.minPts)this.noise.push(a);else{var f=this.clusters.length;this.clusters.push([]),this._addToCluster(a,f),this._expandCluster(f,l)}}return this.clusters};xs.prototype._init=function(r,t,e,o){if(r){if(!(r instanceof Array))throw Error("Dataset must be of type array, "+typeof r+" given");this.dataset=r,this.clusters=[],this.noise=[],this._datasetLength=r.length,this._visited=new Array(this._datasetLength),this._assigned=new Array(this._datasetLength)}t&&(this.epsilon=t),e&&(this.minPts=e),o&&(this.distance=o)};xs.prototype._expandCluster=function(r,t){for(var e=0;e<t.length;e++){var o=t[e];if(this._visited[o]!==1){this._visited[o]=1;var a=this._regionQuery(o);a.length>=this.minPts&&(t=this._mergeArrays(t,a))}this._assigned[o]!==1&&this._addToCluster(o,r)}};xs.prototype._addToCluster=function(r,t){this.clusters[t].push(r),this._assigned[r]=1};xs.prototype._regionQuery=function(r){for(var t=[],e=0;e<this._datasetLength;e++){var o=this.distance(this.dataset[r],this.dataset[e]);o<this.epsilon&&t.push(e)}return t};xs.prototype._mergeArrays=function(r,t){for(var e=t.length,o=0;o<e;o++){var a=t[o];r.indexOf(a)<0&&r.push(a)}return r};xs.prototype._euclideanDistance=function(r,t){for(var e=0,o=Math.min(r.length,t.length);o--;)e+=(r[o]-t[o])*(r[o]-t[o]);return Math.sqrt(e)};typeof Kc!="undefined"&&Kc.exports&&(Kc.exports=xs)});var f_=Kt((IB,jc)=>{function Es(r,t,e){this.k=3,this.dataset=[],this.assignments=[],this.centroids=[],this.init(r,t,e)}Es.prototype.init=function(r,t,e){this.assignments=[],this.centroids=[],typeof r!="undefined"&&(this.dataset=r),typeof t!="undefined"&&(this.k=t),typeof e!="undefined"&&(this.distance=e)};Es.prototype.run=function(r,t){this.init(r,t);for(var e=this.dataset.length,o=0;o<this.k;o++)this.centroids[o]=this.randomCentroid();for(var a=!0;a;){a=this.assign();for(var l=0;l<this.k;l++){for(var f=new Array(g),h=0,p=0;p<g;p++)f[p]=0;for(var d=0;d<e;d++){var g=this.dataset[d].length;if(l===this.assignments[d]){for(var p=0;p<g;p++)f[p]+=this.dataset[d][p];h++}}if(h>0){for(var p=0;p<g;p++)f[p]/=h;this.centroids[l]=f}else this.centroids[l]=this.randomCentroid(),a=!0}}return this.getClusters()};Es.prototype.randomCentroid=function(){var r=this.dataset.length-1,t,e;do e=Math.round(Math.random()*r),t=this.dataset[e];while(this.centroids.indexOf(t)>=0);return t};Es.prototype.assign=function(){for(var r=!1,t=this.dataset.length,e,o=0;o<t;o++)e=this.argmin(this.dataset[o],this.centroids,this.distance),e!=this.assignments[o]&&(this.assignments[o]=e,r=!0);return r};Es.prototype.getClusters=function(){for(var r=new Array(this.k),t,e=0;e<this.assignments.length;e++)t=this.assignments[e],typeof r[t]=="undefined"&&(r[t]=[]),r[t].push(e);return r};Es.prototype.argmin=function(r,t,e){for(var o=Number.MAX_VALUE,a=0,l=t.length,f,h=0;h<l;h++)f=e(r,t[h]),f<o&&(o=f,a=h);return a};Es.prototype.distance=function(r,t){for(var e=0,o=Math.min(r.length,t.length);o--;){var a=r[o]-t[o];e+=a*a}return Math.sqrt(e)};typeof jc!="undefined"&&jc.exports&&(jc.exports=Es)});var md=Kt((RB,Qc)=>{function go(r,t,e){this._queue=[],this._priorities=[],this._sorting="desc",this._init(r,t,e)}go.prototype.insert=function(r,t){for(var e=this._queue.length,o=e;o--;){var a=this._priorities[o];this._sorting==="desc"?t>a&&(e=o):t<a&&(e=o)}this._insertAt(r,t,e)};go.prototype.remove=function(r){for(var t=this._queue.length;t--;){var e=this._queue[t];if(r===e){this._queue.splice(t,1),this._priorities.splice(t,1);break}}};go.prototype.forEach=function(r){this._queue.forEach(r)};go.prototype.getElements=function(){return this._queue};go.prototype.getElementPriority=function(r){return this._priorities[r]};go.prototype.getPriorities=function(){return this._priorities};go.prototype.getElementsWithPriorities=function(){for(var r=[],t=0,e=this._queue.length;t<e;t++)r.push([this._queue[t],this._priorities[t]]);return r};go.prototype._init=function(r,t,e){if(r&&t){if(this._queue=[],this._priorities=[],r.length!==t.length)throw new Error("Arrays must have the same length");for(var o=0;o<r.length;o++)this.insert(r[o],t[o])}e&&(this._sorting=e)};go.prototype._insertAt=function(r,t,e){this._queue.length===e?(this._queue.push(r),this._priorities.push(t)):(this._queue.splice(e,0,r),this._priorities.splice(e,0,t))};typeof Qc!="undefined"&&Qc.exports&&(Qc.exports=go)});var p_=Kt((LB,lu)=>{typeof lu!="undefined"&&lu.exports&&(h_=md());var h_;function Yo(r,t,e,o){this.epsilon=1,this.minPts=1,this.distance=this._euclideanDistance,this._reachability=[],this._processed=[],this._coreDistance=0,this._orderedList=[],this._init(r,t,e,o)}Yo.prototype.run=function(r,t,e,o){this._init(r,t,e,o);for(var a=0,l=this.dataset.length;a<l;a++)if(this._processed[a]!==1){this._processed[a]=1,this.clusters.push([a]);var f=this.clusters.length-1;this._orderedList.push(a);var h=new h_(null,null,"asc"),p=this._regionQuery(a);this._distanceToCore(a)!==void 0&&(this._updateQueue(a,p,h),this._expandCluster(f,h))}return this.clusters};Yo.prototype.getReachabilityPlot=function(){for(var r=[],t=0,e=this._orderedList.length;t<e;t++){var o=this._orderedList[t],a=this._reachability[o];r.push([o,a])}return r};Yo.prototype._init=function(r,t,e,o){if(r){if(!(r instanceof Array))throw Error("Dataset must be of type array, "+typeof r+" given");this.dataset=r,this.clusters=[],this._reachability=new Array(this.dataset.length),this._processed=new Array(this.dataset.length),this._coreDistance=0,this._orderedList=[]}t&&(this.epsilon=t),e&&(this.minPts=e),o&&(this.distance=o)};Yo.prototype._updateQueue=function(r,t,e){var o=this;this._coreDistance=this._distanceToCore(r),t.forEach(function(a){if(o._processed[a]===void 0){var l=o.distance(o.dataset[r],o.dataset[a]),f=Math.max(o._coreDistance,l);o._reachability[a]===void 0?(o._reachability[a]=f,e.insert(a,f)):f<o._reachability[a]&&(o._reachability[a]=f,e.remove(a),e.insert(a,f))}})};Yo.prototype._expandCluster=function(r,t){for(var e=t.getElements(),o=0,a=e.length;o<a;o++){var l=e[o];if(this._processed[l]===void 0){var f=this._regionQuery(l);this._processed[l]=1,this.clusters[r].push(l),this._orderedList.push(l),this._distanceToCore(l)!==void 0&&(this._updateQueue(l,f,t),this._expandCluster(r,t))}}};Yo.prototype._distanceToCore=function(r){for(var t=this.epsilon,e=0;e<t;e++){var o=this._regionQuery(r,e);if(o.length>=this.minPts)return e}};Yo.prototype._regionQuery=function(r,t){t=t||this.epsilon;for(var e=[],o=0,a=this.dataset.length;o<a;o++)this.distance(this.dataset[r],this.dataset[o])<t&&e.push(o);return e};Yo.prototype._euclideanDistance=function(r,t){for(var e=0,o=Math.min(r.length,t.length);o--;)e+=(r[o]-t[o])*(r[o]-t[o]);return Math.sqrt(e)};typeof lu!="undefined"&&lu.exports&&(lu.exports=Yo)});var d_=Kt((NB,tf)=>{typeof tf!="undefined"&&tf.exports&&(tf.exports={DBSCAN:c_(),KMEANS:f_(),OPTICS:p_(),PriorityQueue:md()})});var gd=Kt((zB,g_)=>{"use strict";g_.exports={eudist:function(t,e,o){for(var a=t.length,l=0,f=0;f<a;f++){var h=(t[f]||0)-(e[f]||0);l+=h*h}return o?Math.sqrt(l):l},mandist:function(t,e,o){for(var a=t.length,l=0,f=0;f<a;f++)l+=Math.abs((t[f]||0)-(e[f]||0));return o?Math.sqrt(l):l},dist:function(t,e,o){var a=Math.abs(t-e);return o?a:a*a}}});var __=Kt((kB,v_)=>{"use strict";var y_=gd(),RP=y_.eudist,LP=y_.dist;v_.exports={kmrand:function(t,e){for(var o={},a=[],l=e<<2,f=t.length,h=t[0].length>0;a.length<e&&l-- >0;){var p=t[Math.floor(Math.random()*f)],d=h?p.join("_"):""+p;o[d]||(o[d]=!0,a.push(p))}if(a.length<e)throw new Error("Error initializating clusters");return a},kmpp:function(t,e){var o=t[0].length?RP:LP,a=[],l=t.length,f=t[0].length>0,h={},p=t[Math.floor(Math.random()*l)],d=f?p.join("_"):""+p;for(a.push(p),h[d]=!0;a.length<e;){for(var g=[],_=a.length,y=0,M=[],w=0;w<l;w++){for(var T=1/0,x=0;x<_;x++){var v=o(t[w],a[x]);v<=T&&(T=v)}g[w]=T}for(var C=0;C<l;C++)y+=g[C];for(var S=0;S<l;S++)M[S]={i:S,v:t[S],pr:g[S]/y,cs:0};M.sort(function(z,L){return z.pr-L.pr}),M[0].cs=M[0].pr;for(var O=1;O<l;O++)M[O].cs=M[O-1].cs+M[O].pr;for(var F=Math.random(),G=0;G<l-1&&M[G++].cs<F;);a.push(M[G-1].v)}return a}}});var w_=Kt((HB,S_)=>{"use strict";var yd=gd(),M_=__(),NP=yd.eudist,GB=yd.mandist,VB=yd.dist,OP=M_.kmrand,DP=M_.kmpp,x_=1e4;function E_(r,t,e){e=e||[];for(var o=0;o<r;o++)e[o]=t;return e}function FP(r,t,e,o){var a=[],l=[],f=[],h=[],p=!1,d=o||x_,g=r.length,_=r[0].length,y=_>0,M=[];if(e)e=="kmrand"?a=OP(r,t):e=="kmpp"?a=DP(r,t):a=e;else for(var w={};a.length<t;){var T=Math.floor(Math.random()*g);w[T]||(w[T]=!0,a.push(r[T]))}do{E_(t,0,M);for(var x=0;x<g;x++){for(var v=1/0,C=0,S=0;S<t;S++){var h=y?NP(r[x],a[S]):Math.abs(r[x]-a[S]);h<=v&&(v=h,C=S)}f[x]=C,M[C]++}for(var O=[],l=[],F=0,G=0;G<t;G++)O[G]=y?E_(_,0,O[G]):0,l[G]=a[G];if(y){for(var z=0;z<t;z++)a[z]=[];for(var L=0;L<g;L++)for(var D=f[L],q=O[D],nt=r[L],k=0;k<_;k++)q[k]+=nt[k];p=!0;for(var xt=0;xt<t;xt++){for(var X=a[xt],it=O[xt],vt=l[xt],pt=M[xt],et=0;et<_;et++)X[et]=it[et]/pt||0;if(p){for(var ot=0;ot<_;ot++)if(vt[ot]!=X[ot]){p=!1;break}}}}else{for(var V=0;V<g;V++){var K=f[V];O[K]+=r[V]}for(var at=0;at<t;at++)a[at]=O[at]/M[at]||0;p=!0;for(var Tt=0;Tt<t;Tt++)if(l[Tt]!=a[Tt]){p=!1;break}}p=p||--d<=0}while(!p);return{it:x_-d,k:t,idxs:f,centroids:a}}S_.exports=FP});var du=Kt((Sd,wd)=>{(function(r,t){typeof Sd=="object"&&typeof wd!="undefined"?wd.exports=t():typeof define=="function"&&define.amd?define(t):(r=typeof globalThis!="undefined"?globalThis:r||self,r.polygonClipping=t())})(Sd,function(){"use strict";function r($,N){if(!($ instanceof N))throw new TypeError("Cannot call a class as a function")}function t($,N){for(var b=0;b<N.length;b++){var R=N[b];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty($,R.key,R)}}function e($,N,b){return N&&t($.prototype,N),b&&t($,b),$}var o=function(){function $(N,b){this.next=null,this.key=N,this.data=b,this.left=null,this.right=null}return $}();function a($,N){return $>N?1:$<N?-1:0}function l($,N,b){for(var R=new o(null,null),W=R,J=R;;){var I=b($,N.key);if(I<0){if(N.left===null)break;if(b($,N.left.key)<0){var P=N.left;if(N.left=P.right,P.right=N,N=P,N.left===null)break}J.left=N,J=N,N=N.left}else if(I>0){if(N.right===null)break;if(b($,N.right.key)>0){var P=N.right;if(N.right=P.left,P.left=N,N=P,N.right===null)break}W.right=N,W=N,N=N.right}else break}return W.right=N.left,J.left=N.right,N.left=R.right,N.right=R.left,N}function f($,N,b,R){var W=new o($,N);if(b===null)return W.left=W.right=null,W;b=l($,b,R);var J=R($,b.key);return J<0?(W.left=b.left,W.right=b,b.left=null):J>=0&&(W.right=b.right,W.left=b,b.right=null),W}function h($,N,b){var R=null,W=null;if(N){N=l($,N,b);var J=b(N.key,$);J===0?(R=N.left,W=N.right):J<0?(W=N.right,N.right=null,R=N):(R=N.left,N.left=null,W=N)}return{left:R,right:W}}function p($,N,b){return N===null?$:($===null||(N=l($.key,N,b),N.left=$),N)}function d($,N,b,R,W){if($){R(""+N+(b?"\\u2514\\u2500\\u2500 ":"\\u251C\\u2500\\u2500 ")+W($)+\`
38
+ `,c=new C.ShaderMaterial({uniforms:{uColor:{value:new C.Color(n[0]).convertLinearToSRGB()},uGradualColor:{value:new C.Color(n[1]).convertLinearToSRGB()},center:{value:t},maxValue:{value:e},opacity:{value:r},uDirection:{value:o},uMax:{value:s},uMin:{value:u}},vertexShader:a,fragmentShader:h,side:C.DoubleSide});return this.shaderMaterialMap.set(l,c),c}dispose(){this.lineMaterialMap.forEach((n,t)=>{n.dispose()}),this.lineMaterialMap.clear(),this.meshStandardMaterialMap.forEach((n,t)=>{n.dispose()}),this.meshStandardMaterialMap.clear(),this.meshBasicMaterialMap.forEach((n,t)=>{n.dispose()}),this.meshBasicMaterialMap.clear(),this.shaderMaterialMap.forEach((n,t)=>{n.dispose()}),this.shaderMaterialMap.clear()}};var Y=g("three");var Ot=class{constructor(n){this.context=n;this.registryEvent(),this.changePrevCamera()}prevCamera={position:new Y.Vector3,zoom:1,target:new Y.Vector3};enable=!0;setEnable(n){this.enable=n,n?this.registryEvent():this.unRegistryEvent()}changePrevCamera(){this.prevCamera={position:this.context.camera.position.clone(),zoom:this.context.camera.zoom,target:this.context.control.target.clone()}}backToPrevCamera(){this.setEnable(!1),this.context.camera.position.copy(this.prevCamera.position),this.context.camera.zoom=this.prevCamera.zoom,this.context.control.target.copy(this.prevCamera.target),this.context.control.update(),this.setEnable(!0)}registryEvent(){this.context.addEventListener("control-change",this.onCameraChange)}unRegistryEvent(){this.context.removeEventListener("control-change",this.onCameraChange)}getCurFloorScreenPosition(){if(!this.context.currentFloor)return null;let n=new Y.Box3().setFromObject(this.context.currentFloor.groundUpper),{camera:t,container:{clientWidth:e,clientHeight:r}}=this.context,{min:o,max:s}=n,u=y(o,t,e,r),l=y(s,t,e,r),a=y(new Y.Vector3(o.x,s.y,s.z),t,e,r),h=y(new Y.Vector3(s.x,o.y,o.z),t,e,r),c=Math.min(u.x,l.x,a.x,h.x),f=Math.max(u.x,l.x,a.x,h.x),m=Math.min(u.y,l.y,a.y,h.y),d=Math.max(u.y,l.y,a.y,h.y);return{left:c,right:f,top:m,bottom:d}}checkDistanceToScreenEdge({left:n,right:t,top:e,bottom:r}){let{width:o,height:s}=this.context.clientSize,[u,l,a,h]=this.context.config.cameraBound.padding;return n<=h&&o-t<=l&&e<=u&&s-r<=a}onCameraChange=()=>{};dispose(){this.unRegistryEvent()}};var Ft=class extends E.EventDispatcher{constructor(t,e){super();this.container=t;this.config=e;this.container.style.position="relative",this.container.style.overflow="hidden",this.init(),this.selection=new Lt(this),this.hoverHelper=new Nt(this),this.materialFactory=new Dt(this),this.resizeClientSize(),this.registryEvent()}scene=Jt();renderer=$t();camera;control;lights=te();timer=new U;tweenGroup=new Z.Group;currentFloor;selection;hoverHelper;basicRatio;materialFactory;cameraBound;clientSize={width:0,height:0,x:0,y:0};resizeClientSize(){let{x:t,y:e,width:r,height:o}=this.container.getBoundingClientRect();this.clientSize={width:r||this.container.clientWidth,height:o||this.container.clientHeight,x:t,y:e}}init(){let{clientWidth:t,clientHeight:e}=this.container;this.camera=Qt(t,e),this.renderer.setSize(t,e),this.control=ee(this.camera,this.renderer.domElement),this.control.maxPolarAngle=this.config.control.maxPolar,this.container.appendChild(this.renderer.domElement),this.scene.add(this.lights),this.basicRatio=this.getRatio(),this.control.addEventListener("change",()=>{let r=this.control.getPolarAngle();this.currentFloor?.setShadowOpacity(r/this.config.control.maxPolar),this.dispatchEvent({type:"change-ratio",px:(this.basicRatio||0)*this.camera.zoom}),this.dispatchEvent({type:"control-change"})}),this.cameraBound=new Ot(this)}getRatio(t=new E.Vector3(0,0,0),e=new E.Vector3(100,0,0)){let{clientWidth:r,clientHeight:o}=this.container,s=y(t,this.camera,r,o),u=y(e,this.camera,r,o);return Math.ceil(Math.sqrt((u.x-s.x)**2+(u.y-s.y)**2))}changeAmbientLightColor(t){this.lights.children.forEach(e=>{e instanceof E.AmbientLight&&(e.color=new E.Color(t))})}switchFloor(t){this.currentFloor&&(this.scene.remove(this.currentFloor),this.currentFloor.dispose()),this.currentFloor=t,this.scene.add(t);let e=t.getCenter();e&&(this.lights.position.x=e.x,this.lights.position.y=e.y)}onWindowResize=()=>{let{container:t,camera:e,renderer:r}=this,{clientWidth:o,clientHeight:s}=t;o=Math.max(1,o),s=Math.max(1,s),e.left=-o/2,e.right=o/2,e.top=s/2,e.bottom=-s/2,e.updateProjectionMatrix(),r.setSize(o,s),this.resizeClientSize(),this.dispatchEvent({type:"resize",width:o,height:s})};onClick=t=>{let{graphics:e,position:r}=this.getGraphicsByDeviceXy(t.offsetX,t.offsetY);e.length&&this.dispatchEvent({type:"graphic-click",graphics:e,position:r});let o=this.getPoisByDeviceXy(t.offsetX,t.offsetY);o.length&&this.dispatchEvent({type:"poi-click",pois:o})};getGraphicsByDeviceXy(t,e){let r=new E.Vector2;r.x=t/this.clientSize.width*2-1,r.y=e/this.clientSize.height*-2+1;let o=new E.Raycaster;return o.setFromCamera(r,this.camera),o.ray.origin.sub(o.ray.direction.clone().multiplyScalar(100)),this.currentFloor?.graphicLayer.getGraphicByRaycaster(o)||{graphics:[],position:null}}getPoisByDeviceXy(t,e){return this.currentFloor?.poiLayer.getPoiByDeviceXy(t,e)||[]}onPointerover=t=>{let{graphics:e,position:r}=this.getGraphicsByDeviceXy(t.offsetX,t.offsetY),o=this.getPoisByDeviceXy(t.offsetX,t.offsetY);this.dispatchEvent({type:"pointer-over",e:t,graphics:e,pois:o,position:r})};onPointermove=t=>{let{graphics:e,position:r}=this.getGraphicsByDeviceXy(t.offsetX,t.offsetY),o=this.getPoisByDeviceXy(t.offsetX,t.offsetY);this.dispatchEvent({type:"pointer-move",e:t,graphics:e,pois:o,position:r})};onPointerleave=()=>{this.dispatchEvent({type:"pointer-level"})};onSelectionSelect=({graphics:t,isMultipleSelect:e})=>{this.dispatchEvent({type:"select-graphic",graphics:t,isMultipleSelect:e})};onHoverChange=({graphics:t})=>{this.dispatchEvent({type:"hover",graphics:t})};registryEvent(){window.addEventListener("resize",this.onWindowResize),this.container.addEventListener("click",this.onClick),this.container.addEventListener("pointerover",this.onPointerover),this.container.addEventListener("pointermove",this.onPointermove),this.container.addEventListener("pointerleave",this.onPointerleave),this.selection.addEventListener("select",this.onSelectionSelect),this.hoverHelper.addEventListener("hover-change",this.onHoverChange)}unRegistryEvent(){window.removeEventListener("resize",this.onWindowResize),this.container.removeEventListener("click",this.onClick),this.container.removeEventListener("pointerover",this.onPointerover),this.container.removeEventListener("pointermove",this.onPointermove),this.container.removeEventListener("pointerleave",this.onPointerleave),this.selection.removeEventListener("select",this.onSelectionSelect),this.hoverHelper.removeEventListener("hover-change",this.onHoverChange)}setPolarAngle(t,e=500){return e===0?(this.control.maxPolarAngle=t,this.control.minPolarAngle=t,this.control.update(),this.control.maxPolarAngle=this.config.control.maxPolar,this.control.minPolarAngle=0,Promise.resolve()):X(new Promise(r=>{let o={polar:this.control.getPolarAngle()},s={polar:t},u=new Z.Tween(o,this.tweenGroup).to(s,e).onUpdate(()=>{this.control.maxPolarAngle=o.polar,this.control.minPolarAngle=o.polar,this.control.update()}).onComplete(()=>{this.control.enabled=!0,this.control.maxPolarAngle=this.config.control.maxPolar,this.control.minPolarAngle=0,this.tweenGroup.remove(u),r(!0)}).onStart(()=>{this.control.enabled=!1}).start()}),e+500)}setAzimuthalAngle(t,e=500){if(e===0){this.control.maxAzimuthAngle=t,this.control.minAzimuthAngle=t,this.control.update(),this.control.maxAzimuthAngle=1/0,this.control.minAzimuthAngle=1/0;return}return X(new Promise(r=>{let o={azimuthal:this.control.getAzimuthalAngle()},s={azimuthal:t},u=new Z.Tween(o,this.tweenGroup).to(s,e).onUpdate(()=>{this.control.maxAzimuthAngle=o.azimuthal,this.control.minAzimuthAngle=o.azimuthal,this.control.update()}).onComplete(()=>{this.control.enabled=!0,this.control.maxAzimuthAngle=1/0,this.control.minAzimuthAngle=1/0,this.tweenGroup.remove(u),r(!0)}).onStart(()=>{this.control.enabled=!1}).start()}),e+500)}getCameraLookAt(){return new E.Vector3().subVectors(this.control.target,this.camera.position)}setZoom(t,e,r=500){let o=this.getCameraLookAt(),s={zoom:this.camera.zoom,target:this.control.target.clone()};if(!r){this.camera.position.copy(e.clone().sub(o)),this.control.target.copy(e),this.camera.zoom=t,this.control.update();return}return X(new Promise(u=>{let l=new Z.Tween(s,this.tweenGroup).to({zoom:t,target:e},r).onUpdate(()=>{this.camera.position.copy(s.target.clone().sub(o)),this.control.target.copy(s.target),this.camera.zoom=s.zoom,this.control.update()}).onComplete(()=>{this.tweenGroup.remove(l),this.control.enabled=!0,u(!0)}).onStart(()=>{this.control.enabled=!1}).start()}),r+500)}getFitCameraToObjectZoom(t,e=[20,20,20,20],r=500,o=!0){let[s,u,l,a]=e,{clientSize:{width:h,height:c}}=this,f=this.control.getPolarAngle();o&&this.setPolarAngle(0,0);let m=new E.Box3().setFromObject(t);this.setPolarAngle(f,0);let{max:d,min:x}=m,v=new E.Vector3(x.x,d.y,d.z),A=new E.Vector3(d.x,d.y,d.z),R=new E.Vector3(d.x,x.y,x.z),G=new E.Vector3(x.x,x.y,x.z),T=y(v,this.camera,h,c),tt=y(A,this.camera,h,c),ot=y(G,this.camera,h,c),st=y(R,this.camera,h,c),jt=new E.Box2().setFromPoints([new E.Vector2(T.x,T.y),new E.Vector2(tt.x,tt.y),new E.Vector2(ot.x,ot.y),new E.Vector2(st.x,st.y)]).getSize(new E.Vector2),We=(h-u-a)/jt.x,Xe=(c-s-l)/jt.y,qe=Math.min(We,Xe),je=new E.Vector3((d.x+x.x)/2,(d.y+x.y)/2,(d.z+x.z)/2);return{zoom:qe*this.camera.zoom,center:je}}fitCameraToObject(t,e=[20,20,20,20],r=500,o=!0){let{zoom:s,center:u}=this.getFitCameraToObjectZoom(t,e,r,o);return this.setZoom(s,u,r)}getFitCameraToGroundZoom(t=[20,20,20,20],e=500,r=!0){if(this.currentFloor&&this.currentFloor.hasElement)return this.getFitCameraToObjectZoom(this.currentFloor.groundUpper,t,e,r).zoom}fitCameraToGround(t=[20,20,20,20],e=500,r=!0){return this.currentFloor&&this.currentFloor.hasElement?this.fitCameraToObject(this.currentFloor.groundUpper,t,e,r):Promise.resolve(!1)}setCameraPosition(t,e){return X(new Promise(r=>{let o=this.camera.position.clone(),s=this.getCameraLookAt(),u=new Z.Tween(o,this.tweenGroup).to(t,e).onUpdate(()=>{this.camera.position.copy(o.clone().sub(s)),this.control.target.copy(o.clone()),this.control.update()}).onComplete(()=>{this.tweenGroup.remove(u),this.camera.position.copy(o.clone().sub(s)),this.control.target.copy(t.clone()),this.control.update(),this.control.enabled=!0,r(!0)}).onStart(()=>{this.control.enabled=!1}).start()}),e+500)}render(){this.renderer.render(this.scene,this.camera),this.dispatchEvent({type:"update"}),this.timer.requestAnimationFrame(()=>{this.render()}),this.tweenGroup.update()}dispose(){this.cameraBound.dispose(),this.selection.dispose(),this.hoverHelper.dispose(),this.tweenGroup.getAll().forEach(t=>t.stop()),this.tweenGroup.removeAll(),this.unRegistryEvent(),this.container.removeChild(this.renderer.domElement),this.timer.dispose(),this.renderer.dispose(),this.lights.children.forEach(t=>t.dispose()),this.materialFactory.dispose(),z(this.scene)}};var Me=g("lodash"),un={apiDomain:"",apiInfo:{},apiPath:{floorGraphic:"/api/inception-map/floor/get",floorRange:"/api/inception-map/range/get",equipmentList:"/api/inception-map/equipment/get",roadNetwork:"/api/inception-map/road_network/get"},resizeObserver:!1,initTransToMark:!1,heatMap:{radius:50,gradient:{0:"#8F9FCD",.5:"#6284FF",1:"#F95D5D"}},useFloorCache:!0,control:{maxPolar:1.2,defaultPolar:1.1,defaultAzimuthal:0},defaultPadding:[20,20,20,20],svg:{circle:{radius:"2",fill:"#1CADFF"},line:{stroke:"#1CADFF"}},selectBox:{stroke:"#1CADFF",fill:"rgba(28, 173, 255, 0.3)"},hover:{time:100},ground:{color:"#F6F6F6",opacity:1,height:.001,stroke:!1,strokeColor:"#E6E6E6",strokeOpacity:1},markGraphic:{color:"#EEF0F3",opacity:1,height:.001,stroke:!1,strokeColor:"#000",strokeOpacity:1},graphic:{fillOpacity:1},cameraBound:{padding:[150,150,150,150]},poi:{boxScale:1}};function we(i){return(0,Me.merge)({},un,i)}var Pe=g("lodash");async function Te({brand:i,project:n},t){let{apiDomain:e,apiPath:{floorRange:r},apiInfo:o}=t,s=`${e}${r}?brand=${i}&project=${n}&phase=${n}&building=${n}`;return await fetch(s,o).then(l=>l.json()).then(l=>l.data).then(l=>{let a=(l||[])[0];return a&&(a.info=JSON.parse(a.info)),a})}async function Ut({brand:i,project:n,floor:t,ts:e,resource_type_list:r},o){let{apiDomain:s,apiPath:{floorGraphic:u},apiInfo:l}=o,a=`${s}${u}?brand=${i}&project=${n}&phase=${n}&building=${n}&floor=${t}&ts=${e}&resource_type_list=${r}`;return await fetch(a,l).then(c=>c.json()).then(c=>c.data).then(c=>((c||[]).map(f=>f.info=JSON.parse(f.info)),c||[]))}var hn=(t=>(t[t.D2=0]="D2",t[t.D3=1.1]="D3",t))(hn||{}),Ce=class extends Bt.EventDispatcher{constructor(t,e={}){super();this.container=t;this.config=we(e),this.context=new Ft(t,this.config),this.registryEvent(),this.context.render()}config;context;polarKeys=[];azimuthalKeys=[];svgLine;svgPolygon;basicZoom=1;prevCameraZoom=1;type="2d";floorDataMap=new Map;buildingGroundMap=new Map;buildingGroundPromiseMap=new Map;currentBuildGround=null;observe=null;buildingCenter=[0,0];timer=new U;plugins=[];async loadGraphics({brand:t,project:e,floor:r,ts:o,resource_type_list:s}){return await Ut({brand:t,project:e,floor:r,ts:o,resource_type_list:s},this.config)}changeBuildingCenter(t,{brand:e,project:r}){let o=t?kt(t.info.geometry.cds[0]):[0,0];this.buildingCenter=o,this.dispatchEvent({type:"center-change",center:o,project:r,brand:e})}async loadBuildingGround({brand:t,project:e}){let r=F({brand:t,project:e});if(this.buildingGroundMap.has(r)){let s=this.buildingGroundMap.get(r);return this.changeBuildingCenter(s||null,{brand:t,project:e}),s||null}if(this.buildingGroundPromiseMap.has(r))return this.buildingGroundPromiseMap.get(r);let o=new Promise(async s=>{let u=await Te({brand:t,project:e},this.config);this.buildingGroundMap.set(r,u),this.changeBuildingCenter(u||null,{brand:t,project:e}),this.buildingGroundPromiseMap.delete(r),s(u)});return this.buildingGroundPromiseMap.set(r,o),o}async load({brand:t,project:e,floor:r,ts:o,resource_type_list:s}){let u=F({brand:t,project:e,floor:r,ts:o,resource_type_list:s});if(this.floorDataMap.has(u))return this.floorDataMap.get(u);let[l,a]=await Promise.all([this.loadGraphics({brand:t,project:e,floor:r,ts:o,resource_type_list:s}),this.loadBuildingGround({brand:t,project:e})]);return this.transformGraphicData(l),l.forEach(h=>{h.info.transformToBuildingGround=!!a}),this.config.useFloorCache||this.floorDataMap.clear(),this.floorDataMap.set(u,l),l}transformGraphicData(t,e=this.buildingCenter,r=0){t.forEach(l=>{if(l.info.geometry.coords=JSON.parse(JSON.stringify(l.info.geometry.cds)),l.info.geometry.type==="polygon")l.info.geometry.coords.map(a=>{Array.isArray(a)&&a.forEach(h=>{h[0]-=e[0],h[1]-=e[1]})});else{let[a,h]=l.info.geometry.cds;l.info.geometry.coords=[a-e[0],h-e[1]]}});let{ground:o,markGraphic:s,graphic:u}=this.config;for(let l=0;l<t.length;l++){let a=t[l];a.info.deltaHeight=1e-5*(r+l+1),a.info.group==="ground"?(a.info.fillColor=o.color,a.info.fillOpacity=o.opacity,a.info.height=o.height,a.info.stroke=o.stroke,a.info.strokeColor=o.strokeColor,a.info.strokeOpacity=o.strokeOpacity):a.info.userData.mark?(a.info.height=s.height,a.info.fillColor=s.color,a.info.fillOpacity=s.opacity,a.info.stroke=s.stroke,a.info.strokeColor=s.strokeColor,a.info.strokeOpacity=s.strokeOpacity):(a.info.fillOpacity=u.fillOpacity,this.config.initTransToMark&&(a.info.height=s.height,a.info.fillColor=s.color,a.info.stroke=s.stroke,a.info.strokeColor=s.strokeColor,a.info.strokeOpacity=s.strokeOpacity))}}use(t){t.bmap=this,this.plugins.push(t)}unUse(t){this.plugins=this.plugins.filter(e=>e!==t)}createFloor(t){let e=new Ct(this.context);if(!t.length)return{curFloor:e,graphics:[]};let r=new Map,o=[];for(let s of t)if(s.info.group==="ground")e.createGround(s.info);else{let u=e.addGraphic(s.info);u.userData.data=s,r.set(s.legacy_id,u),o.push(u)}return e.userData.legacyToGraphicMap=r,{curFloor:e,graphics:o}}triggerHooks(t,e){this.dispatchEvent({type:t,data:e})}switchFloor({brand:t,project:e,floor:r,ts:o,resource_type_list:s}){let u=F({brand:t,project:e,floor:r,ts:o,resource_type_list:s}),l=this.floorDataMap.get(u);if(this.context.control.removeEventListener("change",this.onControlChange),l){let a=F({brand:t,project:e});this.currentBuildGround=this.buildingGroundMap.get(a)||null;let h=this.createFloor(l);h?(h.curFloor.name=r,this.triggerHooks("switch_floor_before",h),this.context.switchFloor(h.curFloor),this.initialFloorCamera(),this.triggerHooks("switch_floor_after",h)):console.warn("[switchFloor error] ["+r+"] \u697C\u5C42\u6CA1\u6709\u6570\u636E")}else console.warn("[switchFloor error] \u6CA1\u6709\u8FD9\u4E2A\u697C\u5C42\uFF0C\u8BF7\u5148\u8C03\u7528load\u65B9\u6CD5\u52A0\u8F7D\u697C\u5C42")}initialFloorCamera(){this.context.cameraBound.setEnable(!1),this.context.control.minZoom=0,this.context.control.maxZoom=1/0,this.context.camera.zoom=1,this.context.setAzimuthalAngle(this.config.control.defaultAzimuthal,0),this.context.fitCameraToGround(void 0,0),this.basicZoom=this.context.camera.zoom,this.context.control.minZoom=this.basicZoom,this.context.control.maxZoom=this.basicZoom*25,this.context.control.addEventListener("change",this.onControlChange),this.type==="3d"&&this.context.fitCameraToGround(this.config.defaultPadding,0,!1),this.onControlChange(),this.context.cameraBound.setEnable(!0)}onControlChange=()=>{let{camera:{zoom:t}}=this.context;t!==this.prevCameraZoom&&(this.dispatchEvent({type:"zoom-change",basicZoom:this.basicZoom,cameraZoom:this.context.camera.zoom}),this.prevCameraZoom=t)};addModel(t,e){if(t.options.geometry.type==="polygon"){let r=this.context.currentFloor?.addModel({...e,position:t.getPosition().setZ(.1),id:t.options.id});if(r){let{facilityAngle:o=0,facilityXScale:s=1,facilityYScale:u=1}=t.options.userData;r.rotateZ((180-o)/180*Math.PI),r.scale.set(s,u,1)}}}addHeatmap(t){return this.context.currentFloor?.addHeatmap(t)}getLegacyToGraphicMap(){return this.context.currentFloor?.userData.legacyToGraphicMap||new Map}getFloorAllGraphics(){return this.context.currentFloor?.graphicLayer.children.filter(t=>t instanceof I)||[]}createGraphicPoi(t,e){if(this.context.currentFloor){e.id===void 0&&(e.id=t.options.id);let r=t.getCenter();return this.context.currentFloor.addPoi({...e,position:{...r,z:r.z+t.options.height/2}})}return null}removeHeatMap(){this.context.currentFloor?.removeHeatMap()}translateElementToCenter(t,e=500){let r=t.getPosition();return this.context.setCameraPosition(r,e)}async translateElementToCenterX(t,e=500){return X(new Promise(r=>{let o=this.context.control.target.clone(),s=t.getPosition();this.timer.requestAnimationFrame(()=>{let{clientSize:{width:u,height:l},camera:a}=this.context,c=y(s,a,u,l).x-u/2,f=new Bt.Vector3;f.setFromMatrixColumn(this.context.camera.matrix,0),f.normalize(),f.multiplyScalar(c/this.context.camera.zoom),o.add(f),this.context.setCameraPosition(o,e).then(r)})}),e+500)}getElementDeviceCoordinate(t){let e=t.position.clone(),{clientWidth:r,clientHeight:o}=this.container;return y(e,this.context.camera,r,o)}changeMapType(t,e=500){return this.type=t,t==="2d"?this.context.setPolarAngle(0,e):this.context.setPolarAngle(1.1,e)}async resetView(t=300){let e=t/3;await this.context.setAzimuthalAngle(this.config.control.defaultAzimuthal,e),await this.changeMapType(this.type,e),await this.context.fitCameraToGround(this.config.defaultPadding,e,!1)}reduceMap(t=.5,e=500){let r=this.context.camera.zoom;return this.context.setZoom(r-t,this.context.control.target,e)}enlargeMap(t=.5,e=500){let r=this.context.camera.zoom;return this.context.setZoom(r+t,this.context.control.target,e)}onKeydown=t=>{this.polarKeys.includes(t.code)&&(this.context.control.maxPolarAngle=this.config.control.maxPolar,this.context.control.minPolarAngle=0),this.azimuthalKeys.includes(t.code)&&(this.context.control.maxAzimuthAngle=1/0,this.context.control.minAzimuthAngle=1/0)};onKeyUp=t=>{if(this.polarKeys.includes(t.code)){let e=this.context.control.getPolarAngle();this.context.control.maxPolarAngle=e,this.context.control.minPolarAngle=e}if(this.azimuthalKeys.includes(t.code)){let e=this.context.control.getAzimuthalAngle();this.context.control.maxAzimuthAngle=e,this.context.control.minAzimuthAngle=e}};registryEvent(){if(window.addEventListener("keydown",this.onKeydown),window.addEventListener("keyup",this.onKeyUp),this.config.resizeObserver){let t=new ResizeObserver((0,Pe.debounce)(this.resize,5));t.observe(this.container),this.observe=t}}unRegistryEvent(){window.removeEventListener("keydown",this.onKeydown),window.removeEventListener("keyup",this.onKeyUp),this.observe?.disconnect(),this.observe=null}configurePolarShortcutKeys(t){this.polarKeys=t}configureAzimuthalShortcutKeys(t){this.azimuthalKeys=t}rotateMap(t=.1){let e=this.context.control.getAzimuthalAngle();this.context.control.maxAzimuthAngle=e+t,this.context.control.minAzimuthAngle=e+t,this.context.control.update()}async measureDistance(){return this.cancelDistance(),new Promise((t,e)=>{this.changeMapType("2d",0),this.context.control.enableRotate=!1,this.svgLine=new At(this.context);let r=this.svgLine.dispose.bind(this.svgLine);this.svgLine.dispose=function(){r(),e("cancel")},this.svgLine.addEventListener("distance",({distance:o})=>{t(o)})})}cancelDistance(){this.svgLine&&(this.svgLine.dispose(),this.svgLine=void 0,this.context.control.enableRotate=!0)}measureArea(){return this.cancelArea(),new Promise((t,e)=>{this.changeMapType("2d",0),this.context.control.enableRotate=!1,this.svgPolygon=new Rt(this.context);let r=this.svgPolygon.dispose.bind(this.svgPolygon);this.svgPolygon.dispose=function(){r(),e("cancel")},this.svgPolygon.addEventListener("area",({area:o})=>{t(o)})})}cancelArea(){this.svgPolygon&&(this.svgPolygon.dispose(),this.svgPolygon=void 0,this.context.control.enableRotate=!0)}getGraphicByNodeId(t){return this.context.currentFloor?.graphicLayer.getGraphicByNodeId(t)||null}deleteGraphic(t){this.context.currentFloor?.graphicLayer.removeGraphic(t)}createGraphicByOptions(t){if(!t.transformToBuildingGround&&this.currentBuildGround){let e=kt(this.currentBuildGround.info.geometry.cds[0]);if(t.geometry.type==="polygon")t.geometry.coords=JSON.parse(JSON.stringify(t.geometry.cds)),t.geometry.coords.map(r=>{Array.isArray(r)&&r.forEach(o=>{o[0]-=e[0],o[1]-=e[1]})});else{let[r,o]=t.geometry.cds;t.geometry.coords=[r-e[0],o-e[1]]}}return this.context.currentFloor?.graphicLayer.createGraphic(t)}removePoiById(t){return this.context.currentFloor?.poiLayer.removePoiById(t)}getPoiById(t){return this.context.currentFloor?.poiLayer.getPoiById(t)}getPois(){return(this.context.currentFloor?.poiLayer.pois||[]).filter(t=>!t.options.built_in)}clearPoi(){this.context.currentFloor&&this.context.currentFloor.poiLayer.clear()}removeSelectGraphic(t){this.context.selection.remove(t)}resize=()=>{this.context.cameraBound.setEnable(!1),this.context.onWindowResize();let t=this.context.control.getAzimuthalAngle(),e=this.context.camera.zoom;this.context.control.minZoom=0,this.context.control.maxZoom=1/0,this.context.camera.zoom=1,this.context.setAzimuthalAngle(0,0);let r=this.context.getFitCameraToGroundZoom(void 0,0);this.basicZoom=r||0,this.context.control.minZoom=this.basicZoom,this.context.control.maxZoom=this.basicZoom*25,this.context.camera.zoom=e,this.context.control.addEventListener("change",this.onControlChange),this.context.setAzimuthalAngle(t,0),this.context.cameraBound.setEnable(!0)};dispose(){this.timer.dispose(),this.plugins.forEach(t=>t.dispose()),this.context.dispose(),this.floorDataMap.clear(),this.buildingGroundMap.clear(),oe(),se(),pe(),this.unRegistryEvent()}};var Ae=g("three"),V=class extends Ae.EventDispatcher{bmap;constructor(n){super(),this.bmap=n}dispose(){}};var Re=class extends V{equipmentList=[];equipmentMap=new Map;constructor(n){super(n),this.fetchEquipment(),this.bmap.addEventListener("switch_floor_after",this.onSwitchFloor)}async fetchEquipment(){let{apiDomain:n,apiPath:{equipmentList:t},apiInfo:e}=this.bmap.config,r=`${n}${t}`;await fetch(r,e).then(o=>o.json()).then(o=>o.data).then(o=>{this.equipmentList=o,this.equipmentMap=new Map(o.map(s=>[s.equipment_id,s]))}),this.bmap.context.currentFloor&&this.changeGraphicToEquipment(this.bmap.context.currentFloor.graphicLayer.children)}onSwitchFloor=({data:{graphics:n}})=>{this.equipmentList.length&&this.changeGraphicToEquipment(n)};getGraphicEquipment(n){return n.userData.data.info.userData.equipment}changeGraphicToEquipment(n){n.filter(t=>{let e=this.getGraphicEquipment(t);return e&&this.equipmentMap.has(e)}).forEach(t=>{let e=this.equipmentMap.get(this.getGraphicEquipment(t)),r=this.bmap.createGraphicPoi(t,{icon:e?.equipment_icon,built_in:!0,icon_size:[14,14]});r&&(r.userData.data=e,r.userData.type="equipment")})}dispose(){this.bmap.removeEventListener("switch_floor_after",this.onSwitchFloor),Array.from(this.bmap.context.currentFloor?.poiLayer.pois||[]).forEach(n=>{n.userData.type==="equipment"&&this.bmap.context.currentFloor?.poiLayer.removePoi(n)})}};function Wt(i){let n=new Blob([i],{type:"text/javascript"}),t=URL.createObjectURL(n),e=new Worker(t);return URL.revokeObjectURL(t),e}function Xt(){return Wt(`var E1=Object.create;var am=Object.defineProperty;var M1=Object.getOwnPropertyDescriptor;var S1=Object.getOwnPropertyNames;var w1=Object.getPrototypeOf,b1=Object.prototype.hasOwnProperty;var Kt=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports);var T1=(r,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of S1(t))!b1.call(r,a)&&a!==e&&am(r,a,{get:()=>t[a],enumerable:!(o=M1(t,a))||o.enumerable});return r};var Un=(r,t,e)=>(e=r!=null?E1(w1(r)):{},T1(t||!r||!r.__esModule?am(e,"default",{value:r,enumerable:!0}):e,r));var lm=Kt((eR,um)=>{var Af=class{constructor(){this.keys=new Set,this.queue=[]}sort(){this.queue.sort((t,e)=>t.priority-e.priority)}set(t,e){let o=Number(e);if(isNaN(o))throw new TypeError('"priority" must be a number');return this.keys.has(t)?this.queue.map(a=>(a.key===t&&Object.assign(a,{priority:o}),a)):(this.keys.add(t),this.queue.push({key:t,priority:o})),this.sort(),this.queue.length}next(){let t=this.queue.shift();return this.keys.delete(t.key),t}isEmpty(){return this.queue.length===0}has(t){return this.keys.has(t)}get(t){return this.queue.find(e=>e.key===t)}};um.exports=Af});var hm=Kt((nR,fm)=>{function cm(r,t){let e=new Map;for(let[o,a]of r)o!==t&&a instanceof Map?e.set(o,cm(a,t)):o!==t&&e.set(o,a);return e}fm.exports=cm});var mm=Kt((rR,dm)=>{function A1(r){let t=Number(r);return!(isNaN(t)||t<=0)}function pm(r){let t=new Map;return Object.keys(r).forEach(o=>{let a=r[o];if(a!==null&&typeof a=="object"&&!Array.isArray(a))return t.set(o,pm(a));if(!A1(a))throw new Error(\`Could not add node at key "\${o}", make sure it's a valid node\`,a);return t.set(o,Number(a))}),t}dm.exports=pm});var vm=Kt((iR,ym)=>{function gm(r){if(!(r instanceof Map))throw new Error(\`Invalid graph: Expected Map instead found \${typeof r}\`);r.forEach((t,e)=>{if(typeof t=="object"&&t instanceof Map){gm(t);return}if(typeof t!="number"||t<=0)throw new Error(\`Values must be numbers greater than 0. Found value \${t} at \${e}\`)})}ym.exports=gm});var Mm=Kt((oR,Em)=>{var C1=lm(),P1=hm(),_m=mm(),xm=vm(),Cf=class{constructor(t){t instanceof Map?(xm(t),this.graph=t):t?this.graph=_m(t):this.graph=new Map}addNode(t,e){let o;return e instanceof Map?(xm(e),o=e):o=_m(e),this.graph.set(t,o),this}addVertex(t,e){return this.addNode(t,e)}removeNode(t){return this.graph=P1(this.graph,t),this}path(t,e,o={}){if(!this.graph.size)return o.cost?{path:null,cost:0}:null;let a=new Set,l=new C1,f=new Map,h=[],p=0,d=[];if(o.avoid&&(d=[].concat(o.avoid)),d.includes(t))throw new Error(\`Starting node (\${t}) cannot be avoided\`);if(d.includes(e))throw new Error(\`Ending node (\${e}) cannot be avoided\`);for(l.set(t,0);!l.isEmpty();){let g=l.next();if(g.key===e){p=g.priority;let y=g.key;for(;f.has(y);)h.push(y),y=f.get(y);break}a.add(g.key),(this.graph.get(g.key)||new Map).forEach((y,M)=>{if(a.has(M)||d.includes(M))return null;if(!l.has(M))return f.set(M,g.key),l.set(M,g.priority+y);let w=l.get(M).priority,T=g.priority+y;return T<w?(f.set(M,g.key),l.set(M,T)):null})}return h.length?(o.trim?h.shift():h=h.concat([t]),o.reverse||(h=h.reverse()),o.cost?{path:h,cost:p}:h):o.cost?{path:null,cost:0}:null}shortestPath(...t){return this.path(...t)}};Em.exports=Cf});var mc=Kt((mR,p0)=>{"use strict";var h0=Object.getOwnPropertySymbols,Ib=Object.prototype.hasOwnProperty,Rb=Object.prototype.propertyIsEnumerable;function Lb(r){if(r==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(r)}function Nb(){try{if(!Object.assign)return!1;var r=new String("abc");if(r[5]="de",Object.getOwnPropertyNames(r)[0]==="5")return!1;for(var t={},e=0;e<10;e++)t["_"+String.fromCharCode(e)]=e;var o=Object.getOwnPropertyNames(t).map(function(l){return t[l]});if(o.join("")!=="0123456789")return!1;var a={};return"abcdefghijklmnopqrst".split("").forEach(function(l){a[l]=l}),Object.keys(Object.assign({},a)).join("")==="abcdefghijklmnopqrst"}catch(l){return!1}}p0.exports=Nb()?Object.assign:function(r,t){for(var e,o=Lb(r),a,l=1;l<arguments.length;l++){e=Object(arguments[l]);for(var f in e)Ib.call(e,f)&&(o[f]=e[f]);if(h0){a=h0(e);for(var h=0;h<a.length;h++)Rb.call(e,a[h])&&(o[a[h]]=e[a[h]])}}return o}});var tp=Kt((jh,Qh)=>{(function(r,t){typeof jh=="object"&&typeof Qh!="undefined"?Qh.exports=t():typeof define=="function"&&define.amd?define(t):(r=r||self).RBush=t()})(jh,function(){"use strict";function r(x,v,C,S,O){(function F(G,z,L,D,q){for(;D>L;){if(D-L>600){var nt=D-L+1,k=z-L+1,xt=Math.log(nt),X=.5*Math.exp(2*xt/3),it=.5*Math.sqrt(xt*X*(nt-X)/nt)*(k-nt/2<0?-1:1),vt=Math.max(L,Math.floor(z-k*X/nt+it)),pt=Math.min(D,Math.floor(z+(nt-k)*X/nt+it));F(G,z,vt,pt,q)}var et=G[z],ot=L,V=D;for(t(G,L,z),q(G[D],et)>0&&t(G,L,D);ot<V;){for(t(G,ot,V),ot++,V--;q(G[ot],et)<0;)ot++;for(;q(G[V],et)>0;)V--}q(G[L],et)===0?t(G,L,V):t(G,++V,D),V<=z&&(L=V+1),z<=V&&(D=V-1)}})(x,v,C||0,S||x.length-1,O||e)}function t(x,v,C){var S=x[v];x[v]=x[C],x[C]=S}function e(x,v){return x<v?-1:x>v?1:0}var o=function(x){x===void 0&&(x=9),this._maxEntries=Math.max(4,x),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function a(x,v,C){if(!C)return v.indexOf(x);for(var S=0;S<v.length;S++)if(C(x,v[S]))return S;return-1}function l(x,v){f(x,0,x.children.length,v,x)}function f(x,v,C,S,O){O||(O=w(null)),O.minX=1/0,O.minY=1/0,O.maxX=-1/0,O.maxY=-1/0;for(var F=v;F<C;F++){var G=x.children[F];h(O,x.leaf?S(G):G)}return O}function h(x,v){return x.minX=Math.min(x.minX,v.minX),x.minY=Math.min(x.minY,v.minY),x.maxX=Math.max(x.maxX,v.maxX),x.maxY=Math.max(x.maxY,v.maxY),x}function p(x,v){return x.minX-v.minX}function d(x,v){return x.minY-v.minY}function g(x){return(x.maxX-x.minX)*(x.maxY-x.minY)}function _(x){return x.maxX-x.minX+(x.maxY-x.minY)}function y(x,v){return x.minX<=v.minX&&x.minY<=v.minY&&v.maxX<=x.maxX&&v.maxY<=x.maxY}function M(x,v){return v.minX<=x.maxX&&v.minY<=x.maxY&&v.maxX>=x.minX&&v.maxY>=x.minY}function w(x){return{children:x,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function T(x,v,C,S,O){for(var F=[v,C];F.length;)if(!((C=F.pop())-(v=F.pop())<=S)){var G=v+Math.ceil((C-v)/S/2)*S;r(x,G,v,C,O),F.push(v,G,G,C)}}return o.prototype.all=function(){return this._all(this.data,[])},o.prototype.search=function(x){var v=this.data,C=[];if(!M(x,v))return C;for(var S=this.toBBox,O=[];v;){for(var F=0;F<v.children.length;F++){var G=v.children[F],z=v.leaf?S(G):G;M(x,z)&&(v.leaf?C.push(G):y(x,z)?this._all(G,C):O.push(G))}v=O.pop()}return C},o.prototype.collides=function(x){var v=this.data;if(!M(x,v))return!1;for(var C=[];v;){for(var S=0;S<v.children.length;S++){var O=v.children[S],F=v.leaf?this.toBBox(O):O;if(M(x,F)){if(v.leaf||y(x,F))return!0;C.push(O)}}v=C.pop()}return!1},o.prototype.load=function(x){if(!x||!x.length)return this;if(x.length<this._minEntries){for(var v=0;v<x.length;v++)this.insert(x[v]);return this}var C=this._build(x.slice(),0,x.length-1,0);if(this.data.children.length)if(this.data.height===C.height)this._splitRoot(this.data,C);else{if(this.data.height<C.height){var S=this.data;this.data=C,C=S}this._insert(C,this.data.height-C.height-1,!0)}else this.data=C;return this},o.prototype.insert=function(x){return x&&this._insert(x,this.data.height-1),this},o.prototype.clear=function(){return this.data=w([]),this},o.prototype.remove=function(x,v){if(!x)return this;for(var C,S,O,F=this.data,G=this.toBBox(x),z=[],L=[];F||z.length;){if(F||(F=z.pop(),S=z[z.length-1],C=L.pop(),O=!0),F.leaf){var D=a(x,F.children,v);if(D!==-1)return F.children.splice(D,1),z.push(F),this._condense(z),this}O||F.leaf||!y(F,G)?S?(C++,F=S.children[C],O=!1):F=null:(z.push(F),L.push(C),C=0,S=F,F=F.children[0])}return this},o.prototype.toBBox=function(x){return x},o.prototype.compareMinX=function(x,v){return x.minX-v.minX},o.prototype.compareMinY=function(x,v){return x.minY-v.minY},o.prototype.toJSON=function(){return this.data},o.prototype.fromJSON=function(x){return this.data=x,this},o.prototype._all=function(x,v){for(var C=[];x;)x.leaf?v.push.apply(v,x.children):C.push.apply(C,x.children),x=C.pop();return v},o.prototype._build=function(x,v,C,S){var O,F=C-v+1,G=this._maxEntries;if(F<=G)return l(O=w(x.slice(v,C+1)),this.toBBox),O;S||(S=Math.ceil(Math.log(F)/Math.log(G)),G=Math.ceil(F/Math.pow(G,S-1))),(O=w([])).leaf=!1,O.height=S;var z=Math.ceil(F/G),L=z*Math.ceil(Math.sqrt(G));T(x,v,C,L,this.compareMinX);for(var D=v;D<=C;D+=L){var q=Math.min(D+L-1,C);T(x,D,q,z,this.compareMinY);for(var nt=D;nt<=q;nt+=z){var k=Math.min(nt+z-1,q);O.children.push(this._build(x,nt,k,S-1))}}return l(O,this.toBBox),O},o.prototype._chooseSubtree=function(x,v,C,S){for(;S.push(v),!v.leaf&&S.length-1!==C;){for(var O=1/0,F=1/0,G=void 0,z=0;z<v.children.length;z++){var L=v.children[z],D=g(L),q=(nt=x,k=L,(Math.max(k.maxX,nt.maxX)-Math.min(k.minX,nt.minX))*(Math.max(k.maxY,nt.maxY)-Math.min(k.minY,nt.minY))-D);q<F?(F=q,O=D<O?D:O,G=L):q===F&&D<O&&(O=D,G=L)}v=G||v.children[0]}var nt,k;return v},o.prototype._insert=function(x,v,C){var S=C?x:this.toBBox(x),O=[],F=this._chooseSubtree(S,this.data,v,O);for(F.children.push(x),h(F,S);v>=0&&O[v].children.length>this._maxEntries;)this._split(O,v),v--;this._adjustParentBBoxes(S,O,v)},o.prototype._split=function(x,v){var C=x[v],S=C.children.length,O=this._minEntries;this._chooseSplitAxis(C,O,S);var F=this._chooseSplitIndex(C,O,S),G=w(C.children.splice(F,C.children.length-F));G.height=C.height,G.leaf=C.leaf,l(C,this.toBBox),l(G,this.toBBox),v?x[v-1].children.push(G):this._splitRoot(C,G)},o.prototype._splitRoot=function(x,v){this.data=w([x,v]),this.data.height=x.height+1,this.data.leaf=!1,l(this.data,this.toBBox)},o.prototype._chooseSplitIndex=function(x,v,C){for(var S,O,F,G,z,L,D,q=1/0,nt=1/0,k=v;k<=C-v;k++){var xt=f(x,0,k,this.toBBox),X=f(x,k,C,this.toBBox),it=(O=xt,F=X,G=void 0,z=void 0,L=void 0,D=void 0,G=Math.max(O.minX,F.minX),z=Math.max(O.minY,F.minY),L=Math.min(O.maxX,F.maxX),D=Math.min(O.maxY,F.maxY),Math.max(0,L-G)*Math.max(0,D-z)),vt=g(xt)+g(X);it<q?(q=it,S=k,nt=vt<nt?vt:nt):it===q&&vt<nt&&(nt=vt,S=k)}return S||C-v},o.prototype._chooseSplitAxis=function(x,v,C){var S=x.leaf?this.compareMinX:p,O=x.leaf?this.compareMinY:d;this._allDistMargin(x,v,C,S)<this._allDistMargin(x,v,C,O)&&x.children.sort(S)},o.prototype._allDistMargin=function(x,v,C,S){x.children.sort(S);for(var O=this.toBBox,F=f(x,0,v,O),G=f(x,C-v,C,O),z=_(F)+_(G),L=v;L<C-v;L++){var D=x.children[L];h(F,x.leaf?O(D):D),z+=_(F)}for(var q=C-v-1;q>=v;q--){var nt=x.children[q];h(G,x.leaf?O(nt):nt),z+=_(G)}return z},o.prototype._adjustParentBBoxes=function(x,v,C){for(var S=C;S>=0;S--)h(v[S],x)},o.prototype._condense=function(x){for(var v=x.length-1,C=void 0;v>=0;v--)x[v].children.length===0?v>0?(C=x[v-1].children).splice(C.indexOf(x[v]),1):this.clear():l(x[v],this.toBBox)},o})});var d0=Kt((ep,np)=>{(function(r,t){typeof ep=="object"&&typeof np!="undefined"?np.exports=t():typeof define=="function"&&define.amd?define(t):(r=r||self,r.TinyQueue=t())})(ep,function(){"use strict";var r=function(o,a){if(o===void 0&&(o=[]),a===void 0&&(a=t),this.data=o,this.length=this.data.length,this.compare=a,this.length>0)for(var l=(this.length>>1)-1;l>=0;l--)this._down(l)};r.prototype.push=function(o){this.data.push(o),this.length++,this._up(this.length-1)},r.prototype.pop=function(){if(this.length!==0){var o=this.data[0],a=this.data.pop();return this.length--,this.length>0&&(this.data[0]=a,this._down(0)),o}},r.prototype.peek=function(){return this.data[0]},r.prototype._up=function(o){for(var a=this,l=a.data,f=a.compare,h=l[o];o>0;){var p=o-1>>1,d=l[p];if(f(h,d)>=0)break;l[o]=d,o=p}l[o]=h},r.prototype._down=function(o){for(var a=this,l=a.data,f=a.compare,h=this.length>>1,p=l[o];o<h;){var d=(o<<1)+1,g=l[d],_=d+1;if(_<this.length&&f(l[_],g)<0&&(d=_,g=l[_]),f(g,p)>=0)break;l[o]=g,o=d}l[o]=p};function t(e,o){return e<o?-1:e>o?1:0}return r})});var g0=Kt((ER,m0)=>{m0.exports=function(t,e,o,a){var l=t[0],f=t[1],h=!1;o===void 0&&(o=0),a===void 0&&(a=e.length);for(var p=(a-o)/2,d=0,g=p-1;d<p;g=d++){var _=e[o+d*2+0],y=e[o+d*2+1],M=e[o+g*2+0],w=e[o+g*2+1],T=y>f!=w>f&&l<(M-_)*(f-y)/(w-y)+_;T&&(h=!h)}return h}});var v0=Kt((MR,y0)=>{y0.exports=function(t,e,o,a){var l=t[0],f=t[1],h=!1;o===void 0&&(o=0),a===void 0&&(a=e.length);for(var p=a-o,d=0,g=p-1;d<p;g=d++){var _=e[d+o][0],y=e[d+o][1],M=e[g+o][0],w=e[g+o][1],T=y>f!=w>f&&l<(M-_)*(f-y)/(w-y)+_;T&&(h=!h)}return h}});var E0=Kt((SR,vc)=>{var _0=g0(),x0=v0();vc.exports=function(t,e,o,a){return e.length>0&&Array.isArray(e[0])?x0(t,e,o,a):_0(t,e,o,a)};vc.exports.nested=x0;vc.exports.flat=_0});var S0=Kt((_c,M0)=>{(function(r,t){typeof _c=="object"&&typeof M0!="undefined"?t(_c):typeof define=="function"&&define.amd?define(["exports"],t):t((r=r||self).predicates={})})(_c,function(r){"use strict";let e=33306690738754706e-32;function o(M,w,T,x,v){let C,S,O,F,G=w[0],z=x[0],L=0,D=0;z>G==z>-G?(C=G,G=w[++L]):(C=z,z=x[++D]);let q=0;if(L<M&&D<T)for(z>G==z>-G?(O=C-((S=G+C)-G),G=w[++L]):(O=C-((S=z+C)-z),z=x[++D]),C=S,O!==0&&(v[q++]=O);L<M&&D<T;)z>G==z>-G?(O=C-((S=C+G)-(F=S-C))+(G-F),G=w[++L]):(O=C-((S=C+z)-(F=S-C))+(z-F),z=x[++D]),C=S,O!==0&&(v[q++]=O);for(;L<M;)O=C-((S=C+G)-(F=S-C))+(G-F),G=w[++L],C=S,O!==0&&(v[q++]=O);for(;D<T;)O=C-((S=C+z)-(F=S-C))+(z-F),z=x[++D],C=S,O!==0&&(v[q++]=O);return C===0&&q!==0||(v[q++]=C),q}function a(M){return new Float64Array(M)}let l=33306690738754716e-32,f=22204460492503146e-32,h=11093356479670487e-47,p=a(4),d=a(8),g=a(12),_=a(16),y=a(4);r.orient2d=function(M,w,T,x,v,C){let S=(w-C)*(T-v),O=(M-v)*(x-C),F=S-O;if(S===0||O===0||S>0!=O>0)return F;let G=Math.abs(S+O);return Math.abs(F)>=l*G?F:-function(z,L,D,q,nt,k,xt){let X,it,vt,pt,et,ot,V,K,at,Tt,dt,Ct,Yt,Wt,Nt,ne,Pt,Xt,tt=z-nt,nn=D-nt,Gt=L-k,te=q-k;et=(Nt=(K=tt-(V=(ot=134217729*tt)-(ot-tt)))*(Tt=te-(at=(ot=134217729*te)-(ot-te)))-((Wt=tt*te)-V*at-K*at-V*Tt))-(dt=Nt-(Pt=(K=Gt-(V=(ot=134217729*Gt)-(ot-Gt)))*(Tt=nn-(at=(ot=134217729*nn)-(ot-nn)))-((ne=Gt*nn)-V*at-K*at-V*Tt))),p[0]=Nt-(dt+et)+(et-Pt),et=(Yt=Wt-((Ct=Wt+dt)-(et=Ct-Wt))+(dt-et))-(dt=Yt-ne),p[1]=Yt-(dt+et)+(et-ne),et=(Xt=Ct+dt)-Ct,p[2]=Ct-(Xt-et)+(dt-et),p[3]=Xt;let qt=function(W,J){let I=J[0];for(let P=1;P<W;P++)I+=J[P];return I}(4,p),$=f*xt;if(qt>=$||-qt>=$||(X=z-(tt+(et=z-tt))+(et-nt),vt=D-(nn+(et=D-nn))+(et-nt),it=L-(Gt+(et=L-Gt))+(et-k),pt=q-(te+(et=q-te))+(et-k),X===0&&it===0&&vt===0&&pt===0)||($=h*xt+e*Math.abs(qt),(qt+=tt*pt+te*X-(Gt*vt+nn*it))>=$||-qt>=$))return qt;et=(Nt=(K=X-(V=(ot=134217729*X)-(ot-X)))*(Tt=te-(at=(ot=134217729*te)-(ot-te)))-((Wt=X*te)-V*at-K*at-V*Tt))-(dt=Nt-(Pt=(K=it-(V=(ot=134217729*it)-(ot-it)))*(Tt=nn-(at=(ot=134217729*nn)-(ot-nn)))-((ne=it*nn)-V*at-K*at-V*Tt))),y[0]=Nt-(dt+et)+(et-Pt),et=(Yt=Wt-((Ct=Wt+dt)-(et=Ct-Wt))+(dt-et))-(dt=Yt-ne),y[1]=Yt-(dt+et)+(et-ne),et=(Xt=Ct+dt)-Ct,y[2]=Ct-(Xt-et)+(dt-et),y[3]=Xt;let N=o(4,p,4,y,d);et=(Nt=(K=tt-(V=(ot=134217729*tt)-(ot-tt)))*(Tt=pt-(at=(ot=134217729*pt)-(ot-pt)))-((Wt=tt*pt)-V*at-K*at-V*Tt))-(dt=Nt-(Pt=(K=Gt-(V=(ot=134217729*Gt)-(ot-Gt)))*(Tt=vt-(at=(ot=134217729*vt)-(ot-vt)))-((ne=Gt*vt)-V*at-K*at-V*Tt))),y[0]=Nt-(dt+et)+(et-Pt),et=(Yt=Wt-((Ct=Wt+dt)-(et=Ct-Wt))+(dt-et))-(dt=Yt-ne),y[1]=Yt-(dt+et)+(et-ne),et=(Xt=Ct+dt)-Ct,y[2]=Ct-(Xt-et)+(dt-et),y[3]=Xt;let b=o(N,d,4,y,g);et=(Nt=(K=X-(V=(ot=134217729*X)-(ot-X)))*(Tt=pt-(at=(ot=134217729*pt)-(ot-pt)))-((Wt=X*pt)-V*at-K*at-V*Tt))-(dt=Nt-(Pt=(K=it-(V=(ot=134217729*it)-(ot-it)))*(Tt=vt-(at=(ot=134217729*vt)-(ot-vt)))-((ne=it*vt)-V*at-K*at-V*Tt))),y[0]=Nt-(dt+et)+(et-Pt),et=(Yt=Wt-((Ct=Wt+dt)-(et=Ct-Wt))+(dt-et))-(dt=Yt-ne),y[1]=Yt-(dt+et)+(et-ne),et=(Xt=Ct+dt)-Ct,y[2]=Ct-(Xt-et)+(dt-et),y[3]=Xt;let R=o(b,g,4,y,_);return _[R-1]}(M,w,T,x,v,C,G)},r.orient2dfast=function(M,w,T,x,v,C){return(w-C)*(T-v)-(M-v)*(x-C)},Object.defineProperty(r,"__esModule",{value:!0})})});var P0=Kt((wR,sp)=>{"use strict";var w0=tp(),Ec=d0(),Db=E0(),Fb=S0().orient2d;Ec.default&&(Ec=Ec.default);sp.exports=C0;sp.exports.default=C0;function C0(r,t,e){t=Math.max(0,t===void 0?2:t),e=e||0;var o=Gb(r),a=new w0(16);a.toBBox=function(C){return{minX:C[0],minY:C[1],maxX:C[0],maxY:C[1]}},a.compareMinX=function(C,S){return C[0]-S[0]},a.compareMinY=function(C,S){return C[1]-S[1]},a.load(r);for(var l=[],f=0,h;f<o.length;f++){var p=o[f];a.remove(p),h=A0(p,h),l.push(h)}var d=new w0(16);for(f=0;f<l.length;f++)d.insert(rp(l[f]));for(var g=t*t,_=e*e;l.length;){var y=l.shift(),M=y.p,w=y.next.p,T=ip(M,w);if(!(T<_)){var x=T/g;p=Ub(a,y.prev.p,M,w,y.next.next.p,x,d),p&&Math.min(ip(p,M),ip(p,w))<=x&&(l.push(y),l.push(A0(p,y)),a.remove(p),d.remove(y),d.insert(rp(y)),d.insert(rp(y.next)))}}y=h;var v=[];do v.push(y.p),y=y.next;while(y!==h);return v.push(y.p),v}function Ub(r,t,e,o,a,l,f){for(var h=new Ec([],Bb),p=r.data;p;){for(var d=0;d<p.children.length;d++){var g=p.children[d],_=p.leaf?op(g,e,o):zb(e,o,g);_>l||h.push({node:g,dist:_})}for(;h.length&&!h.peek().node.children;){var y=h.pop(),M=y.node,w=op(M,t,e),T=op(M,o,a);if(y.dist<w&&y.dist<T&&T0(e,M,f)&&T0(o,M,f))return M}p=h.pop(),p&&(p=p.node)}return null}function Bb(r,t){return r.dist-t.dist}function zb(r,t,e){if(b0(r,e)||b0(t,e))return 0;var o=xc(r[0],r[1],t[0],t[1],e.minX,e.minY,e.maxX,e.minY);if(o===0)return 0;var a=xc(r[0],r[1],t[0],t[1],e.minX,e.minY,e.minX,e.maxY);if(a===0)return 0;var l=xc(r[0],r[1],t[0],t[1],e.maxX,e.minY,e.maxX,e.maxY);if(l===0)return 0;var f=xc(r[0],r[1],t[0],t[1],e.minX,e.maxY,e.maxX,e.maxY);return f===0?0:Math.min(o,a,l,f)}function b0(r,t){return r[0]>=t.minX&&r[0]<=t.maxX&&r[1]>=t.minY&&r[1]<=t.maxY}function T0(r,t,e){for(var o=Math.min(r[0],t[0]),a=Math.min(r[1],t[1]),l=Math.max(r[0],t[0]),f=Math.max(r[1],t[1]),h=e.search({minX:o,minY:a,maxX:l,maxY:f}),p=0;p<h.length;p++)if(kb(h[p].p,h[p].next.p,r,t))return!1;return!0}function Ya(r,t,e){return Fb(r[0],r[1],t[0],t[1],e[0],e[1])}function kb(r,t,e,o){return r!==o&&t!==e&&Ya(r,t,e)>0!=Ya(r,t,o)>0&&Ya(e,o,r)>0!=Ya(e,o,t)>0}function rp(r){var t=r.p,e=r.next.p;return r.minX=Math.min(t[0],e[0]),r.minY=Math.min(t[1],e[1]),r.maxX=Math.max(t[0],e[0]),r.maxY=Math.max(t[1],e[1]),r}function Gb(r){for(var t=r[0],e=r[0],o=r[0],a=r[0],l=0;l<r.length;l++){var f=r[l];f[0]<t[0]&&(t=f),f[0]>o[0]&&(o=f),f[1]<e[1]&&(e=f),f[1]>a[1]&&(a=f)}var h=[t,e,o,a],p=h.slice();for(l=0;l<r.length;l++)Db(r[l],h)||p.push(r[l]);return Hb(p)}function A0(r,t){var e={p:r,prev:null,next:null,minX:0,minY:0,maxX:0,maxY:0};return t?(e.next=t.next,e.prev=t,t.next.prev=e,t.next=e):(e.prev=e,e.next=e),e}function ip(r,t){var e=r[0]-t[0],o=r[1]-t[1];return e*e+o*o}function op(r,t,e){var o=t[0],a=t[1],l=e[0]-o,f=e[1]-a;if(l!==0||f!==0){var h=((r[0]-o)*l+(r[1]-a)*f)/(l*l+f*f);h>1?(o=e[0],a=e[1]):h>0&&(o+=l*h,a+=f*h)}return l=r[0]-o,f=r[1]-a,l*l+f*f}function xc(r,t,e,o,a,l,f,h){var p=e-r,d=o-t,g=f-a,_=h-l,y=r-a,M=t-l,w=p*p+d*d,T=p*g+d*_,x=g*g+_*_,v=p*y+d*M,C=g*y+_*M,S=w*x-T*T,O,F,G,z,L=S,D=S;S===0?(F=0,L=1,z=C,D=x):(F=T*C-x*v,z=w*C-T*v,F<0?(F=0,z=C,D=x):F>L&&(F=L,z=C+T,D=x)),z<0?(z=0,-v<0?F=0:-v>w?F=L:(F=-v,L=w)):z>D&&(z=D,-v+T<0?F=0:-v+T>w?F=L:(F=-v+T,L=w)),O=F===0?0:F/L,G=z===0?0:z/D;var q=(1-O)*r+O*e,nt=(1-O)*t+O*o,k=(1-G)*a+G*f,xt=(1-G)*l+G*h,X=k-q,it=xt-nt;return X*X+it*it}function Vb(r,t){return r[0]===t[0]?r[1]-t[1]:r[0]-t[0]}function Hb(r){r.sort(Vb);for(var t=[],e=0;e<r.length;e++){for(;t.length>=2&&Ya(t[t.length-2],t[t.length-1],r[e])<=0;)t.pop();t.push(r[e])}for(var o=[],a=r.length-1;a>=0;a--){for(;o.length>=2&&Ya(o[o.length-2],o[o.length-1],r[a])<=0;)o.pop();o.push(r[a])}return o.pop(),t.pop(),t.concat(o)}});var D0=Kt((up,lp)=>{(function(r,t){typeof up=="object"&&typeof lp!="undefined"?lp.exports=t():typeof define=="function"&&define.amd?define(t):r.quickselect=t()})(up,function(){"use strict";function r(a,l,f,h,p){t(a,l,f||0,h||a.length-1,p||o)}function t(a,l,f,h,p){for(;h>f;){if(h-f>600){var d=h-f+1,g=l-f+1,_=Math.log(d),y=.5*Math.exp(2*_/3),M=.5*Math.sqrt(_*y*(d-y)/d)*(g-d/2<0?-1:1),w=Math.max(f,Math.floor(l-g*y/d+M)),T=Math.min(h,Math.floor(l+(d-g)*y/d+M));t(a,l,w,T,p)}var x=a[l],v=f,C=h;for(e(a,f,l),p(a[h],x)>0&&e(a,f,h);v<C;){for(e(a,v,C),v++,C--;p(a[v],x)<0;)v++;for(;p(a[C],x)>0;)C--}p(a[f],x)===0?e(a,f,C):(C++,e(a,C,h)),C<=l&&(f=C+1),l<=C&&(h=C-1)}}function e(a,l,f){var h=a[l];a[l]=a[f],a[f]=h}function o(a,l){return a<l?-1:a>l?1:0}return r})});var pp=Kt(($N,hp)=>{"use strict";hp.exports=Hu;hp.exports.default=Hu;var nT=D0();function Hu(r,t){if(!(this instanceof Hu))return new Hu(r,t);this._maxEntries=Math.max(4,r||9),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),t&&this._initFormat(t),this.clear()}Hu.prototype={all:function(){return this._all(this.data,[])},search:function(r){var t=this.data,e=[],o=this.toBBox;if(!Sc(r,t))return e;for(var a=[],l,f,h,p;t;){for(l=0,f=t.children.length;l<f;l++)h=t.children[l],p=t.leaf?o(h):h,Sc(r,p)&&(t.leaf?e.push(h):fp(r,p)?this._all(h,e):a.push(h));t=a.pop()}return e},collides:function(r){var t=this.data,e=this.toBBox;if(!Sc(r,t))return!1;for(var o=[],a,l,f,h;t;){for(a=0,l=t.children.length;a<l;a++)if(f=t.children[a],h=t.leaf?e(f):f,Sc(r,h)){if(t.leaf||fp(r,h))return!0;o.push(f)}t=o.pop()}return!1},load:function(r){if(!(r&&r.length))return this;if(r.length<this._minEntries){for(var t=0,e=r.length;t<e;t++)this.insert(r[t]);return this}var o=this._build(r.slice(),0,r.length-1,0);if(!this.data.children.length)this.data=o;else if(this.data.height===o.height)this._splitRoot(this.data,o);else{if(this.data.height<o.height){var a=this.data;this.data=o,o=a}this._insert(o,this.data.height-o.height-1,!0)}return this},insert:function(r){return r&&this._insert(r,this.data.height-1),this},clear:function(){return this.data=$a([]),this},remove:function(r,t){if(!r)return this;for(var e=this.data,o=this.toBBox(r),a=[],l=[],f,h,p,d;e||a.length;){if(e||(e=a.pop(),h=a[a.length-1],f=l.pop(),d=!0),e.leaf&&(p=rT(r,e.children,t),p!==-1))return e.children.splice(p,1),a.push(e),this._condense(a),this;!d&&!e.leaf&&fp(e,o)?(a.push(e),l.push(f),f=0,h=e,e=e.children[0]):h?(f++,e=h.children[f],d=!1):e=null}return this},toBBox:function(r){return r},compareMinX:F0,compareMinY:U0,toJSON:function(){return this.data},fromJSON:function(r){return this.data=r,this},_all:function(r,t){for(var e=[];r;)r.leaf?t.push.apply(t,r.children):e.push.apply(e,r.children),r=e.pop();return t},_build:function(r,t,e,o){var a=e-t+1,l=this._maxEntries,f;if(a<=l)return f=$a(r.slice(t,e+1)),Ja(f,this.toBBox),f;o||(o=Math.ceil(Math.log(a)/Math.log(l)),l=Math.ceil(a/Math.pow(l,o-1))),f=$a([]),f.leaf=!1,f.height=o;var h=Math.ceil(a/l),p=h*Math.ceil(Math.sqrt(l)),d,g,_,y;for(B0(r,t,e,p,this.compareMinX),d=t;d<=e;d+=p)for(_=Math.min(d+p-1,e),B0(r,d,_,h,this.compareMinY),g=d;g<=_;g+=h)y=Math.min(g+h-1,_),f.children.push(this._build(r,g,y,o-1));return Ja(f,this.toBBox),f},_chooseSubtree:function(r,t,e,o){for(var a,l,f,h,p,d,g,_;o.push(t),!(t.leaf||o.length-1===e);){for(g=_=1/0,a=0,l=t.children.length;a<l;a++)f=t.children[a],p=cp(f),d=iT(r,f)-p,d<_?(_=d,g=p<g?p:g,h=f):d===_&&p<g&&(g=p,h=f);t=h||t.children[0]}return t},_insert:function(r,t,e){var o=this.toBBox,a=e?r:o(r),l=[],f=this._chooseSubtree(a,this.data,t,l);for(f.children.push(r),Vu(f,a);t>=0&&l[t].children.length>this._maxEntries;)this._split(l,t),t--;this._adjustParentBBoxes(a,l,t)},_split:function(r,t){var e=r[t],o=e.children.length,a=this._minEntries;this._chooseSplitAxis(e,a,o);var l=this._chooseSplitIndex(e,a,o),f=$a(e.children.splice(l,e.children.length-l));f.height=e.height,f.leaf=e.leaf,Ja(e,this.toBBox),Ja(f,this.toBBox),t?r[t-1].children.push(f):this._splitRoot(e,f)},_splitRoot:function(r,t){this.data=$a([r,t]),this.data.height=r.height+1,this.data.leaf=!1,Ja(this.data,this.toBBox)},_chooseSplitIndex:function(r,t,e){var o,a,l,f,h,p,d,g;for(p=d=1/0,o=t;o<=e-t;o++)a=Gu(r,0,o,this.toBBox),l=Gu(r,o,e,this.toBBox),f=oT(a,l),h=cp(a)+cp(l),f<p?(p=f,g=o,d=h<d?h:d):f===p&&h<d&&(d=h,g=o);return g},_chooseSplitAxis:function(r,t,e){var o=r.leaf?this.compareMinX:F0,a=r.leaf?this.compareMinY:U0,l=this._allDistMargin(r,t,e,o),f=this._allDistMargin(r,t,e,a);l<f&&r.children.sort(o)},_allDistMargin:function(r,t,e,o){r.children.sort(o);var a=this.toBBox,l=Gu(r,0,t,a),f=Gu(r,e-t,e,a),h=Mc(l)+Mc(f),p,d;for(p=t;p<e-t;p++)d=r.children[p],Vu(l,r.leaf?a(d):d),h+=Mc(l);for(p=e-t-1;p>=t;p--)d=r.children[p],Vu(f,r.leaf?a(d):d),h+=Mc(f);return h},_adjustParentBBoxes:function(r,t,e){for(var o=e;o>=0;o--)Vu(t[o],r)},_condense:function(r){for(var t=r.length-1,e;t>=0;t--)r[t].children.length===0?t>0?(e=r[t-1].children,e.splice(e.indexOf(r[t]),1)):this.clear():Ja(r[t],this.toBBox)},_initFormat:function(r){var t=["return a"," - b",";"];this.compareMinX=new Function("a","b",t.join(r[0])),this.compareMinY=new Function("a","b",t.join(r[1])),this.toBBox=new Function("a","return {minX: a"+r[0]+", minY: a"+r[1]+", maxX: a"+r[2]+", maxY: a"+r[3]+"};")}};function rT(r,t,e){if(!e)return t.indexOf(r);for(var o=0;o<t.length;o++)if(e(r,t[o]))return o;return-1}function Ja(r,t){Gu(r,0,r.children.length,t,r)}function Gu(r,t,e,o,a){a||(a=$a(null)),a.minX=1/0,a.minY=1/0,a.maxX=-1/0,a.maxY=-1/0;for(var l=t,f;l<e;l++)f=r.children[l],Vu(a,r.leaf?o(f):f);return a}function Vu(r,t){return r.minX=Math.min(r.minX,t.minX),r.minY=Math.min(r.minY,t.minY),r.maxX=Math.max(r.maxX,t.maxX),r.maxY=Math.max(r.maxY,t.maxY),r}function F0(r,t){return r.minX-t.minX}function U0(r,t){return r.minY-t.minY}function cp(r){return(r.maxX-r.minX)*(r.maxY-r.minY)}function Mc(r){return r.maxX-r.minX+(r.maxY-r.minY)}function iT(r,t){return(Math.max(t.maxX,r.maxX)-Math.min(t.minX,r.minX))*(Math.max(t.maxY,r.maxY)-Math.min(t.minY,r.minY))}function oT(r,t){var e=Math.max(r.minX,t.minX),o=Math.max(r.minY,t.minY),a=Math.min(r.maxX,t.maxX),l=Math.min(r.maxY,t.maxY);return Math.max(0,a-e)*Math.max(0,l-o)}function fp(r,t){return r.minX<=t.minX&&r.minY<=t.minY&&t.maxX<=r.maxX&&t.maxY<=r.maxY}function Sc(r,t){return t.minX<=r.maxX&&t.minY<=r.maxY&&t.maxX>=r.minX&&t.maxY>=r.minY}function $a(r){return{children:r,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function B0(r,t,e,o,a){for(var l=[t,e],f;l.length;)e=l.pop(),t=l.pop(),!(e-t<=o)&&(f=t+Math.ceil((e-t)/o/2)*o,nT(r,f,t,e,a),l.push(t,f,f,e))}});var W0=Kt((lO,_p)=>{"use strict";_p.exports=Ac;_p.exports.default=Ac;function Ac(r,t,e){e=e||2;var o=t&&t.length,a=o?t[0]*e:r.length,l=G0(r,0,a,e,!0),f=[];if(!l||l.next===l.prev)return f;var h,p,d,g,_,y,M;if(o&&(l=mT(r,t,l,e)),r.length>80*e){h=d=r[0],p=g=r[1];for(var w=e;w<a;w+=e)_=r[w],y=r[w+1],_<h&&(h=_),y<p&&(p=y),_>d&&(d=_),y>g&&(g=y);M=Math.max(d-h,g-p),M=M!==0?32767/M:0}return Xu(l,f,e,h,p,M,0),f}function G0(r,t,e,o,a){var l,f;if(a===vp(r,t,e,o)>0)for(l=t;l<e;l+=o)f=k0(l,r[l],r[l+1],f);else for(l=e-o;l>=t;l-=o)f=k0(l,r[l],r[l+1],f);return f&&Cc(f,f.next)&&(Zu(f),f=f.next),f}function $s(r,t){if(!r)return r;t||(t=r);var e=r,o;do if(o=!1,!e.steiner&&(Cc(e,e.next)||Fn(e.prev,e,e.next)===0)){if(Zu(e),e=t=e.prev,e===e.next)break;o=!0}else e=e.next;while(o||e!==t);return t}function Xu(r,t,e,o,a,l,f){if(r){!f&&l&&xT(r,o,a,l);for(var h=r,p,d;r.prev!==r.next;){if(p=r.prev,d=r.next,l?hT(r,o,a,l):fT(r)){t.push(p.i/e|0),t.push(r.i/e|0),t.push(d.i/e|0),Zu(r),r=d.next,h=d.next;continue}if(r=d,r===h){f?f===1?(r=pT($s(r),t,e),Xu(r,t,e,o,a,l,2)):f===2&&dT(r,t,e,o,a,l):Xu($s(r),t,e,o,a,l,1);break}}}}function fT(r){var t=r.prev,e=r,o=r.next;if(Fn(t,e,o)>=0)return!1;for(var a=t.x,l=e.x,f=o.x,h=t.y,p=e.y,d=o.y,g=a<l?a<f?a:f:l<f?l:f,_=h<p?h<d?h:d:p<d?p:d,y=a>l?a>f?a:f:l>f?l:f,M=h>p?h>d?h:d:p>d?p:d,w=o.next;w!==t;){if(w.x>=g&&w.x<=y&&w.y>=_&&w.y<=M&&Qa(a,h,l,p,f,d,w.x,w.y)&&Fn(w.prev,w,w.next)>=0)return!1;w=w.next}return!0}function hT(r,t,e,o){var a=r.prev,l=r,f=r.next;if(Fn(a,l,f)>=0)return!1;for(var h=a.x,p=l.x,d=f.x,g=a.y,_=l.y,y=f.y,M=h<p?h<d?h:d:p<d?p:d,w=g<_?g<y?g:y:_<y?_:y,T=h>p?h>d?h:d:p>d?p:d,x=g>_?g>y?g:y:_>y?_:y,v=gp(M,w,t,e,o),C=gp(T,x,t,e,o),S=r.prevZ,O=r.nextZ;S&&S.z>=v&&O&&O.z<=C;){if(S.x>=M&&S.x<=T&&S.y>=w&&S.y<=x&&S!==a&&S!==f&&Qa(h,g,p,_,d,y,S.x,S.y)&&Fn(S.prev,S,S.next)>=0||(S=S.prevZ,O.x>=M&&O.x<=T&&O.y>=w&&O.y<=x&&O!==a&&O!==f&&Qa(h,g,p,_,d,y,O.x,O.y)&&Fn(O.prev,O,O.next)>=0))return!1;O=O.nextZ}for(;S&&S.z>=v;){if(S.x>=M&&S.x<=T&&S.y>=w&&S.y<=x&&S!==a&&S!==f&&Qa(h,g,p,_,d,y,S.x,S.y)&&Fn(S.prev,S,S.next)>=0)return!1;S=S.prevZ}for(;O&&O.z<=C;){if(O.x>=M&&O.x<=T&&O.y>=w&&O.y<=x&&O!==a&&O!==f&&Qa(h,g,p,_,d,y,O.x,O.y)&&Fn(O.prev,O,O.next)>=0)return!1;O=O.nextZ}return!0}function pT(r,t,e){var o=r;do{var a=o.prev,l=o.next.next;!Cc(a,l)&&V0(a,o,o.next,l)&&Yu(a,l)&&Yu(l,a)&&(t.push(a.i/e|0),t.push(o.i/e|0),t.push(l.i/e|0),Zu(o),Zu(o.next),o=r=l),o=o.next}while(o!==r);return $s(o)}function dT(r,t,e,o,a,l){var f=r;do{for(var h=f.next.next;h!==f.prev;){if(f.i!==h.i&&ST(f,h)){var p=H0(f,h);f=$s(f,f.next),p=$s(p,p.next),Xu(f,t,e,o,a,l,0),Xu(p,t,e,o,a,l,0);return}h=h.next}f=f.next}while(f!==r)}function mT(r,t,e,o){var a=[],l,f,h,p,d;for(l=0,f=t.length;l<f;l++)h=t[l]*o,p=l<f-1?t[l+1]*o:r.length,d=G0(r,h,p,o,!1),d===d.next&&(d.steiner=!0),a.push(MT(d));for(a.sort(gT),l=0;l<a.length;l++)e=yT(a[l],e);return e}function gT(r,t){return r.x-t.x}function yT(r,t){var e=vT(r,t);if(!e)return t;var o=H0(e,r);return $s(o,o.next),$s(e,e.next)}function vT(r,t){var e=t,o=r.x,a=r.y,l=-1/0,f;do{if(a<=e.y&&a>=e.next.y&&e.next.y!==e.y){var h=e.x+(a-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(h<=o&&h>l&&(l=h,f=e.x<e.next.x?e:e.next,h===o))return f}e=e.next}while(e!==t);if(!f)return null;var p=f,d=f.x,g=f.y,_=1/0,y;e=f;do o>=e.x&&e.x>=d&&o!==e.x&&Qa(a<g?o:l,a,d,g,a<g?l:o,a,e.x,e.y)&&(y=Math.abs(a-e.y)/(o-e.x),Yu(e,r)&&(y<_||y===_&&(e.x>f.x||e.x===f.x&&_T(f,e)))&&(f=e,_=y)),e=e.next;while(e!==p);return f}function _T(r,t){return Fn(r.prev,r,t.prev)<0&&Fn(t.next,r,r.next)<0}function xT(r,t,e,o){var a=r;do a.z===0&&(a.z=gp(a.x,a.y,t,e,o)),a.prevZ=a.prev,a.nextZ=a.next,a=a.next;while(a!==r);a.prevZ.nextZ=null,a.prevZ=null,ET(a)}function ET(r){var t,e,o,a,l,f,h,p,d=1;do{for(e=r,r=null,l=null,f=0;e;){for(f++,o=e,h=0,t=0;t<d&&(h++,o=o.nextZ,!!o);t++);for(p=d;h>0||p>0&&o;)h!==0&&(p===0||!o||e.z<=o.z)?(a=e,e=e.nextZ,h--):(a=o,o=o.nextZ,p--),l?l.nextZ=a:r=a,a.prevZ=l,l=a;e=o}l.nextZ=null,d*=2}while(f>1);return r}function gp(r,t,e,o,a){return r=(r-e)*a|0,t=(t-o)*a|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,r|t<<1}function MT(r){var t=r,e=r;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==r);return e}function Qa(r,t,e,o,a,l,f,h){return(a-f)*(t-h)>=(r-f)*(l-h)&&(r-f)*(o-h)>=(e-f)*(t-h)&&(e-f)*(l-h)>=(a-f)*(o-h)}function ST(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!wT(r,t)&&(Yu(r,t)&&Yu(t,r)&&bT(r,t)&&(Fn(r.prev,r,t.prev)||Fn(r,t.prev,t))||Cc(r,t)&&Fn(r.prev,r,r.next)>0&&Fn(t.prev,t,t.next)>0)}function Fn(r,t,e){return(t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y)}function Cc(r,t){return r.x===t.x&&r.y===t.y}function V0(r,t,e,o){var a=Tc(Fn(r,t,e)),l=Tc(Fn(r,t,o)),f=Tc(Fn(e,o,r)),h=Tc(Fn(e,o,t));return!!(a!==l&&f!==h||a===0&&bc(r,e,t)||l===0&&bc(r,o,t)||f===0&&bc(e,r,o)||h===0&&bc(e,t,o))}function bc(r,t,e){return t.x<=Math.max(r.x,e.x)&&t.x>=Math.min(r.x,e.x)&&t.y<=Math.max(r.y,e.y)&&t.y>=Math.min(r.y,e.y)}function Tc(r){return r>0?1:r<0?-1:0}function wT(r,t){var e=r;do{if(e.i!==r.i&&e.next.i!==r.i&&e.i!==t.i&&e.next.i!==t.i&&V0(e,e.next,r,t))return!0;e=e.next}while(e!==r);return!1}function Yu(r,t){return Fn(r.prev,r,r.next)<0?Fn(r,t,r.next)>=0&&Fn(r,r.prev,t)>=0:Fn(r,t,r.prev)<0||Fn(r,r.next,t)<0}function bT(r,t){var e=r,o=!1,a=(r.x+t.x)/2,l=(r.y+t.y)/2;do e.y>l!=e.next.y>l&&e.next.y!==e.y&&a<(e.next.x-e.x)*(l-e.y)/(e.next.y-e.y)+e.x&&(o=!o),e=e.next;while(e!==r);return o}function H0(r,t){var e=new yp(r.i,r.x,r.y),o=new yp(t.i,t.x,t.y),a=r.next,l=t.prev;return r.next=t,t.prev=r,e.next=a,a.prev=e,o.next=e,e.prev=o,l.next=o,o.prev=l,o}function k0(r,t,e,o){var a=new yp(r,t,e);return o?(a.next=o.next,a.prev=o,o.next.prev=a,o.next=a):(a.prev=a,a.next=a),a}function Zu(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function yp(r,t,e){this.i=r,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}Ac.deviation=function(r,t,e,o){var a=t&&t.length,l=a?t[0]*e:r.length,f=Math.abs(vp(r,0,l,e));if(a)for(var h=0,p=t.length;h<p;h++){var d=t[h]*e,g=h<p-1?t[h+1]*e:r.length;f-=Math.abs(vp(r,d,g,e))}var _=0;for(h=0;h<o.length;h+=3){var y=o[h]*e,M=o[h+1]*e,w=o[h+2]*e;_+=Math.abs((r[y]-r[w])*(r[M+1]-r[y+1])-(r[y]-r[M])*(r[w+1]-r[y+1]))}return f===0&&_===0?0:Math.abs((_-f)/f)};function vp(r,t,e,o){for(var a=0,l=t,f=e-o;l<e;l+=o)a+=(r[f]-r[l])*(r[l+1]+r[f+1]),f=l;return a}Ac.flatten=function(r){for(var t=r[0][0].length,e={vertices:[],holes:[],dimensions:t},o=0,a=0;a<r.length;a++){for(var l=0;l<r[a].length;l++)for(var f=0;f<t;f++)e.vertices.push(r[a][l][f]);a>0&&(o+=r[a-1].length,e.holes.push(o))}return e}});var wp=Kt(ue=>{"use strict";Object.defineProperty(ue,"__esModule",{value:!0});ue.earthRadius=63710088e-1;ue.factors={centimeters:ue.earthRadius*100,centimetres:ue.earthRadius*100,degrees:ue.earthRadius/111325,feet:ue.earthRadius*3.28084,inches:ue.earthRadius*39.37,kilometers:ue.earthRadius/1e3,kilometres:ue.earthRadius/1e3,meters:ue.earthRadius,metres:ue.earthRadius,miles:ue.earthRadius/1609.344,millimeters:ue.earthRadius*1e3,millimetres:ue.earthRadius*1e3,nauticalmiles:ue.earthRadius/1852,radians:1,yards:ue.earthRadius*1.0936};ue.unitsFactors={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:1/1e3,kilometres:1/1e3,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/ue.earthRadius,yards:1.0936133};ue.areaFactors={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,millimeters:1e6,millimetres:1e6,yards:1.195990046};function vs(r,t,e){e===void 0&&(e={});var o={type:"Feature"};return(e.id===0||e.id)&&(o.id=e.id),e.bbox&&(o.bbox=e.bbox),o.properties=t||{},o.geometry=r,o}ue.feature=vs;function AT(r,t,e){switch(e===void 0&&(e={}),r){case"Point":return xp(t).geometry;case"LineString":return Mp(t).geometry;case"Polygon":return Ep(t).geometry;case"MultiPoint":return X0(t).geometry;case"MultiLineString":return q0(t).geometry;case"MultiPolygon":return Y0(t).geometry;default:throw new Error(r+" is invalid")}}ue.geometry=AT;function xp(r,t,e){if(e===void 0&&(e={}),!r)throw new Error("coordinates is required");if(!Array.isArray(r))throw new Error("coordinates must be an Array");if(r.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Pc(r[0])||!Pc(r[1]))throw new Error("coordinates must contain numbers");var o={type:"Point",coordinates:r};return vs(o,t,e)}ue.point=xp;function CT(r,t,e){return e===void 0&&(e={}),Ic(r.map(function(o){return xp(o,t)}),e)}ue.points=CT;function Ep(r,t,e){e===void 0&&(e={});for(var o=0,a=r;o<a.length;o++){var l=a[o];if(l.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var f=0;f<l[l.length-1].length;f++)if(l[l.length-1][f]!==l[0][f])throw new Error("First and last Position are not equivalent.")}var h={type:"Polygon",coordinates:r};return vs(h,t,e)}ue.polygon=Ep;function PT(r,t,e){return e===void 0&&(e={}),Ic(r.map(function(o){return Ep(o,t)}),e)}ue.polygons=PT;function Mp(r,t,e){if(e===void 0&&(e={}),r.length<2)throw new Error("coordinates must be an array of two or more positions");var o={type:"LineString",coordinates:r};return vs(o,t,e)}ue.lineString=Mp;function IT(r,t,e){return e===void 0&&(e={}),Ic(r.map(function(o){return Mp(o,t)}),e)}ue.lineStrings=IT;function Ic(r,t){t===void 0&&(t={});var e={type:"FeatureCollection"};return t.id&&(e.id=t.id),t.bbox&&(e.bbox=t.bbox),e.features=r,e}ue.featureCollection=Ic;function q0(r,t,e){e===void 0&&(e={});var o={type:"MultiLineString",coordinates:r};return vs(o,t,e)}ue.multiLineString=q0;function X0(r,t,e){e===void 0&&(e={});var o={type:"MultiPoint",coordinates:r};return vs(o,t,e)}ue.multiPoint=X0;function Y0(r,t,e){e===void 0&&(e={});var o={type:"MultiPolygon",coordinates:r};return vs(o,t,e)}ue.multiPolygon=Y0;function RT(r,t,e){e===void 0&&(e={});var o={type:"GeometryCollection",geometries:r};return vs(o,t,e)}ue.geometryCollection=RT;function LT(r,t){if(t===void 0&&(t=0),t&&!(t>=0))throw new Error("precision must be a positive number");var e=Math.pow(10,t||0);return Math.round(r*e)/e}ue.round=LT;function Z0(r,t){t===void 0&&(t="kilometers");var e=ue.factors[t];if(!e)throw new Error(t+" units is invalid");return r*e}ue.radiansToLength=Z0;function Sp(r,t){t===void 0&&(t="kilometers");var e=ue.factors[t];if(!e)throw new Error(t+" units is invalid");return r/e}ue.lengthToRadians=Sp;function NT(r,t){return J0(Sp(r,t))}ue.lengthToDegrees=NT;function OT(r){var t=r%360;return t<0&&(t+=360),t}ue.bearingToAzimuth=OT;function J0(r){var t=r%(2*Math.PI);return t*180/Math.PI}ue.radiansToDegrees=J0;function DT(r){var t=r%360;return t*Math.PI/180}ue.degreesToRadians=DT;function FT(r,t,e){if(t===void 0&&(t="kilometers"),e===void 0&&(e="kilometers"),!(r>=0))throw new Error("length must be a positive number");return Z0(Sp(r,t),e)}ue.convertLength=FT;function UT(r,t,e){if(t===void 0&&(t="meters"),e===void 0&&(e="kilometers"),!(r>=0))throw new Error("area must be a positive number");var o=ue.areaFactors[t];if(!o)throw new Error("invalid original units");var a=ue.areaFactors[e];if(!a)throw new Error("invalid final units");return r/o*a}ue.convertArea=UT;function Pc(r){return!isNaN(r)&&r!==null&&!Array.isArray(r)}ue.isNumber=Pc;function BT(r){return!!r&&r.constructor===Object}ue.isObject=BT;function zT(r){if(!r)throw new Error("bbox is required");if(!Array.isArray(r))throw new Error("bbox must be an Array");if(r.length!==4&&r.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");r.forEach(function(t){if(!Pc(t))throw new Error("bbox must only contain numbers")})}ue.validateBBox=zT;function kT(r){if(!r)throw new Error("id is required");if(["string","number"].indexOf(typeof r)===-1)throw new Error("id must be a number or a string")}ue.validateId=kT});var Tp=Kt(ir=>{"use strict";Object.defineProperty(ir,"__esModule",{value:!0});var Gr=wp();function Ju(r,t,e){if(r!==null)for(var o,a,l,f,h,p,d,g=0,_=0,y,M=r.type,w=M==="FeatureCollection",T=M==="Feature",x=w?r.features.length:1,v=0;v<x;v++){d=w?r.features[v].geometry:T?r.geometry:r,y=d?d.type==="GeometryCollection":!1,h=y?d.geometries.length:1;for(var C=0;C<h;C++){var S=0,O=0;if(f=y?d.geometries[C]:d,f!==null){p=f.coordinates;var F=f.type;switch(g=e&&(F==="Polygon"||F==="MultiPolygon")?1:0,F){case null:break;case"Point":if(t(p,_,v,S,O)===!1)return!1;_++,S++;break;case"LineString":case"MultiPoint":for(o=0;o<p.length;o++){if(t(p[o],_,v,S,O)===!1)return!1;_++,F==="MultiPoint"&&S++}F==="LineString"&&S++;break;case"Polygon":case"MultiLineString":for(o=0;o<p.length;o++){for(a=0;a<p[o].length-g;a++){if(t(p[o][a],_,v,S,O)===!1)return!1;_++}F==="MultiLineString"&&S++,F==="Polygon"&&O++}F==="Polygon"&&S++;break;case"MultiPolygon":for(o=0;o<p.length;o++){for(O=0,a=0;a<p[o].length;a++){for(l=0;l<p[o][a].length-g;l++){if(t(p[o][a][l],_,v,S,O)===!1)return!1;_++}O++}S++}break;case"GeometryCollection":for(o=0;o<f.geometries.length;o++)if(Ju(f.geometries[o],t,e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function GT(r,t,e,o){var a=e;return Ju(r,function(l,f,h,p,d){f===0&&e===void 0?a=l:a=t(a,l,f,h,p,d)},o),a}function $0(r,t){var e;switch(r.type){case"FeatureCollection":for(e=0;e<r.features.length&&t(r.features[e].properties,e)!==!1;e++);break;case"Feature":t(r.properties,0);break}}function VT(r,t,e){var o=e;return $0(r,function(a,l){l===0&&e===void 0?o=a:o=t(o,a,l)}),o}function K0(r,t){if(r.type==="Feature")t(r,0);else if(r.type==="FeatureCollection")for(var e=0;e<r.features.length&&t(r.features[e],e)!==!1;e++);}function HT(r,t,e){var o=e;return K0(r,function(a,l){l===0&&e===void 0?o=a:o=t(o,a,l)}),o}function WT(r){var t=[];return Ju(r,function(e){t.push(e)}),t}function bp(r,t){var e,o,a,l,f,h,p,d,g,_,y=0,M=r.type==="FeatureCollection",w=r.type==="Feature",T=M?r.features.length:1;for(e=0;e<T;e++){for(h=M?r.features[e].geometry:w?r.geometry:r,d=M?r.features[e].properties:w?r.properties:{},g=M?r.features[e].bbox:w?r.bbox:void 0,_=M?r.features[e].id:w?r.id:void 0,p=h?h.type==="GeometryCollection":!1,f=p?h.geometries.length:1,a=0;a<f;a++){if(l=p?h.geometries[a]:h,l===null){if(t(null,y,d,g,_)===!1)return!1;continue}switch(l.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(t(l,y,d,g,_)===!1)return!1;break}case"GeometryCollection":{for(o=0;o<l.geometries.length;o++)if(t(l.geometries[o],y,d,g,_)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}y++}}function qT(r,t,e){var o=e;return bp(r,function(a,l,f,h,p){l===0&&e===void 0?o=a:o=t(o,a,l,f,h,p)}),o}function Rc(r,t){bp(r,function(e,o,a,l,f){var h=e===null?null:e.type;switch(h){case null:case"Point":case"LineString":case"Polygon":return t(Gr.feature(e,a,{bbox:l,id:f}),o,0)===!1?!1:void 0}var p;switch(h){case"MultiPoint":p="Point";break;case"MultiLineString":p="LineString";break;case"MultiPolygon":p="Polygon";break}for(var d=0;d<e.coordinates.length;d++){var g=e.coordinates[d],_={type:p,coordinates:g};if(t(Gr.feature(_,a),o,d)===!1)return!1}})}function XT(r,t,e){var o=e;return Rc(r,function(a,l,f){l===0&&f===0&&e===void 0?o=a:o=t(o,a,l,f)}),o}function j0(r,t){Rc(r,function(e,o,a){var l=0;if(e.geometry){var f=e.geometry.type;if(!(f==="Point"||f==="MultiPoint")){var h,p=0,d=0,g=0;if(Ju(e,function(_,y,M,w,T){if(h===void 0||o>p||w>d||T>g){h=_,p=o,d=w,g=T,l=0;return}var x=Gr.lineString([h,_],e.properties);if(t(x,o,a,T,l)===!1)return!1;l++,h=_})===!1)return!1}}})}function YT(r,t,e){var o=e,a=!1;return j0(r,function(l,f,h,p,d){a===!1&&e===void 0?o=l:o=t(o,l,f,h,p,d),a=!0}),o}function Q0(r,t){if(!r)throw new Error("geojson is required");Rc(r,function(e,o,a){if(e.geometry!==null){var l=e.geometry.type,f=e.geometry.coordinates;switch(l){case"LineString":if(t(e,o,a,0,0)===!1)return!1;break;case"Polygon":for(var h=0;h<f.length;h++)if(t(Gr.lineString(f[h],e.properties),o,a,h)===!1)return!1;break}}})}function ZT(r,t,e){var o=e;return Q0(r,function(a,l,f,h){l===0&&e===void 0?o=a:o=t(o,a,l,f,h)}),o}function JT(r,t){if(t=t||{},!Gr.isObject(t))throw new Error("options is invalid");var e=t.featureIndex||0,o=t.multiFeatureIndex||0,a=t.geometryIndex||0,l=t.segmentIndex||0,f=t.properties,h;switch(r.type){case"FeatureCollection":e<0&&(e=r.features.length+e),f=f||r.features[e].properties,h=r.features[e].geometry;break;case"Feature":f=f||r.properties,h=r.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":h=r;break;default:throw new Error("geojson is invalid")}if(h===null)return null;var p=h.coordinates;switch(h.type){case"Point":case"MultiPoint":return null;case"LineString":return l<0&&(l=p.length+l-1),Gr.lineString([p[l],p[l+1]],f,t);case"Polygon":return a<0&&(a=p.length+a),l<0&&(l=p[a].length+l-1),Gr.lineString([p[a][l],p[a][l+1]],f,t);case"MultiLineString":return o<0&&(o=p.length+o),l<0&&(l=p[o].length+l-1),Gr.lineString([p[o][l],p[o][l+1]],f,t);case"MultiPolygon":return o<0&&(o=p.length+o),a<0&&(a=p[o].length+a),l<0&&(l=p[o][a].length-l-1),Gr.lineString([p[o][a][l],p[o][a][l+1]],f,t)}throw new Error("geojson is invalid")}function $T(r,t){if(t=t||{},!Gr.isObject(t))throw new Error("options is invalid");var e=t.featureIndex||0,o=t.multiFeatureIndex||0,a=t.geometryIndex||0,l=t.coordIndex||0,f=t.properties,h;switch(r.type){case"FeatureCollection":e<0&&(e=r.features.length+e),f=f||r.features[e].properties,h=r.features[e].geometry;break;case"Feature":f=f||r.properties,h=r.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":h=r;break;default:throw new Error("geojson is invalid")}if(h===null)return null;var p=h.coordinates;switch(h.type){case"Point":return Gr.point(p,f,t);case"MultiPoint":return o<0&&(o=p.length+o),Gr.point(p[o],f,t);case"LineString":return l<0&&(l=p.length+l),Gr.point(p[l],f,t);case"Polygon":return a<0&&(a=p.length+a),l<0&&(l=p[a].length+l),Gr.point(p[a][l],f,t);case"MultiLineString":return o<0&&(o=p.length+o),l<0&&(l=p[o].length+l),Gr.point(p[o][l],f,t);case"MultiPolygon":return o<0&&(o=p.length+o),a<0&&(a=p[o].length+a),l<0&&(l=p[o][a].length-l),Gr.point(p[o][a][l],f,t)}throw new Error("geojson is invalid")}ir.coordAll=WT;ir.coordEach=Ju;ir.coordReduce=GT;ir.featureEach=K0;ir.featureReduce=HT;ir.findPoint=$T;ir.findSegment=JT;ir.flattenEach=Rc;ir.flattenReduce=XT;ir.geomEach=bp;ir.geomReduce=qT;ir.lineEach=Q0;ir.lineReduce=ZT;ir.propEach=$0;ir.propReduce=VT;ir.segmentEach=j0;ir.segmentReduce=YT});var ty=Kt(Cp=>{"use strict";Object.defineProperty(Cp,"__esModule",{value:!0});var KT=Tp();function Ap(r){var t=[1/0,1/0,-1/0,-1/0];return KT.coordEach(r,function(e){t[0]>e[0]&&(t[0]=e[0]),t[1]>e[1]&&(t[1]=e[1]),t[2]<e[0]&&(t[2]=e[0]),t[3]<e[1]&&(t[3]=e[1])}),t}Ap.default=Ap;Cp.default=Ap});var Lc=Kt((bO,Pp)=>{var po=tp(),ny=wp(),ry=Tp(),tu=ty().default,jT=ry.featureEach,SO=ry.coordEach,wO=ny.polygon,ey=ny.featureCollection;function iy(r){var t=new po(r);return t.insert=function(e){if(e.type!=="Feature")throw new Error("invalid feature");return e.bbox=e.bbox?e.bbox:tu(e),po.prototype.insert.call(this,e)},t.load=function(e){var o=[];return Array.isArray(e)?e.forEach(function(a){if(a.type!=="Feature")throw new Error("invalid features");a.bbox=a.bbox?a.bbox:tu(a),o.push(a)}):jT(e,function(a){if(a.type!=="Feature")throw new Error("invalid features");a.bbox=a.bbox?a.bbox:tu(a),o.push(a)}),po.prototype.load.call(this,o)},t.remove=function(e,o){if(e.type!=="Feature")throw new Error("invalid feature");return e.bbox=e.bbox?e.bbox:tu(e),po.prototype.remove.call(this,e,o)},t.clear=function(){return po.prototype.clear.call(this)},t.search=function(e){var o=po.prototype.search.call(this,this.toBBox(e));return ey(o)},t.collides=function(e){return po.prototype.collides.call(this,this.toBBox(e))},t.all=function(){var e=po.prototype.all.call(this);return ey(e)},t.toJSON=function(){return po.prototype.toJSON.call(this)},t.fromJSON=function(e){return po.prototype.fromJSON.call(this,e)},t.toBBox=function(e){var o;if(e.bbox)o=e.bbox;else if(Array.isArray(e)&&e.length===4)o=e;else if(Array.isArray(e)&&e.length===6)o=[e[0],e[1],e[3],e[4]];else if(e.type==="Feature")o=tu(e);else if(e.type==="FeatureCollection")o=tu(e);else throw new Error("invalid geojson");return{minX:o[0],minY:o[1],maxX:o[2],maxY:o[3]}},t}Pp.exports=iy;Pp.exports.default=iy});var Dp=Kt((O3,dy)=>{"use strict";var py=Object.prototype.toString;dy.exports=function(t){var e=py.call(t),o=e==="[object Arguments]";return o||(o=e!=="[object Array]"&&t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&py.call(t.callee)==="[object Function]"),o}});var Sy=Kt((D3,My)=>{"use strict";var Ey;Object.keys||(ju=Object.prototype.hasOwnProperty,Fp=Object.prototype.toString,my=Dp(),Up=Object.prototype.propertyIsEnumerable,gy=!Up.call({toString:null},"toString"),yy=Up.call(function(){},"prototype"),Qu=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],Uc=function(r){var t=r.constructor;return t&&t.prototype===r},vy={$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},_y=function(){if(typeof window=="undefined")return!1;for(var r in window)try{if(!vy["$"+r]&&ju.call(window,r)&&window[r]!==null&&typeof window[r]=="object")try{Uc(window[r])}catch(t){return!0}}catch(t){return!0}return!1}(),xy=function(r){if(typeof window=="undefined"||!_y)return Uc(r);try{return Uc(r)}catch(t){return!1}},Ey=function(t){var e=t!==null&&typeof t=="object",o=Fp.call(t)==="[object Function]",a=my(t),l=e&&Fp.call(t)==="[object String]",f=[];if(!e&&!o&&!a)throw new TypeError("Object.keys called on a non-object");var h=yy&&o;if(l&&t.length>0&&!ju.call(t,0))for(var p=0;p<t.length;++p)f.push(String(p));if(a&&t.length>0)for(var d=0;d<t.length;++d)f.push(String(d));else for(var g in t)!(h&&g==="prototype")&&ju.call(t,g)&&f.push(String(g));if(gy)for(var _=xy(t),y=0;y<Qu.length;++y)!(_&&Qu[y]==="constructor")&&ju.call(t,Qu[y])&&f.push(Qu[y]);return f});var ju,Fp,my,Up,gy,yy,Qu,Uc,vy,_y,xy;My.exports=Ey});var Bp=Kt((F3,Ty)=>{"use strict";var uA=Array.prototype.slice,lA=Dp(),wy=Object.keys,Bc=wy?function(t){return wy(t)}:Sy(),by=Object.keys;Bc.shim=function(){if(Object.keys){var t=function(){var e=Object.keys(arguments);return e&&e.length===arguments.length}(1,2);t||(Object.keys=function(o){return lA(o)?by(uA.call(o)):by(o)})}else Object.keys=Bc;return Object.keys||Bc};Ty.exports=Bc});var zp=Kt((U3,Ay)=>{"use strict";Ay.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},e=Symbol("test"),o=Object(e);if(typeof e=="string"||Object.prototype.toString.call(e)!=="[object Symbol]"||Object.prototype.toString.call(o)!=="[object Symbol]")return!1;var a=42;t[e]=a;for(e in t)return!1;if(typeof Object.keys=="function"&&Object.keys(t).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var l=Object.getOwnPropertySymbols(t);if(l.length!==1||l[0]!==e||!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var f=Object.getOwnPropertyDescriptor(t,e);if(f.value!==a||f.enumerable!==!0)return!1}return!0}});var zc=Kt((B3,Cy)=>{"use strict";var cA=zp();Cy.exports=function(){return cA()&&!!Symbol.toStringTag}});var Ry=Kt((z3,Iy)=>{"use strict";var Py=typeof Symbol!="undefined"&&Symbol,fA=zp();Iy.exports=function(){return typeof Py!="function"||typeof Symbol!="function"||typeof Py("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:fA()}});var Oy=Kt((k3,Ny)=>{"use strict";var Ly={foo:{}},hA=Object;Ny.exports=function(){return{__proto__:Ly}.foo===Ly.foo&&!({__proto__:null}instanceof hA)}});var Uy=Kt((G3,Fy)=>{"use strict";var pA="Function.prototype.bind called on incompatible ",dA=Object.prototype.toString,mA=Math.max,gA="[object Function]",Dy=function(t,e){for(var o=[],a=0;a<t.length;a+=1)o[a]=t[a];for(var l=0;l<e.length;l+=1)o[l+t.length]=e[l];return o},yA=function(t,e){for(var o=[],a=e||0,l=0;a<t.length;a+=1,l+=1)o[l]=t[a];return o},vA=function(r,t){for(var e="",o=0;o<r.length;o+=1)e+=r[o],o+1<r.length&&(e+=t);return e};Fy.exports=function(t){var e=this;if(typeof e!="function"||dA.apply(e)!==gA)throw new TypeError(pA+e);for(var o=yA(arguments,1),a,l=function(){if(this instanceof a){var g=e.apply(this,Dy(o,arguments));return Object(g)===g?g:this}return e.apply(t,Dy(o,arguments))},f=mA(0,e.length-o.length),h=[],p=0;p<f;p++)h[p]="$"+p;if(a=Function("binder","return function ("+vA(h,",")+"){ return binder.apply(this,arguments); }")(l),e.prototype){var d=function(){};d.prototype=e.prototype,a.prototype=new d,d.prototype=null}return a}});var kc=Kt((V3,By)=>{"use strict";var _A=Uy();By.exports=Function.prototype.bind||_A});var ky=Kt((H3,zy)=>{"use strict";var xA=Function.prototype.call,EA=Object.prototype.hasOwnProperty,MA=kc();zy.exports=MA.call(xA,EA)});var Qs=Kt((W3,qy)=>{"use strict";var tn,iu=SyntaxError,Wy=Function,ru=TypeError,kp=function(r){try{return Wy('"use strict"; return ('+r+").constructor;")()}catch(t){}},Ks=Object.getOwnPropertyDescriptor;if(Ks)try{Ks({},"")}catch(r){Ks=null}var Gp=function(){throw new ru},SA=Ks?function(){try{return arguments.callee,Gp}catch(r){try{return Ks(arguments,"callee").get}catch(t){return Gp}}}():Gp,eu=Ry()(),wA=Oy()(),vr=Object.getPrototypeOf||(wA?function(r){return r.__proto__}:null),nu={},bA=typeof Uint8Array=="undefined"||!vr?tn:vr(Uint8Array),js={"%AggregateError%":typeof AggregateError=="undefined"?tn:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer=="undefined"?tn:ArrayBuffer,"%ArrayIteratorPrototype%":eu&&vr?vr([][Symbol.iterator]()):tn,"%AsyncFromSyncIteratorPrototype%":tn,"%AsyncFunction%":nu,"%AsyncGenerator%":nu,"%AsyncGeneratorFunction%":nu,"%AsyncIteratorPrototype%":nu,"%Atomics%":typeof Atomics=="undefined"?tn:Atomics,"%BigInt%":typeof BigInt=="undefined"?tn:BigInt,"%BigInt64Array%":typeof BigInt64Array=="undefined"?tn:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array=="undefined"?tn:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView=="undefined"?tn:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array=="undefined"?tn:Float32Array,"%Float64Array%":typeof Float64Array=="undefined"?tn:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry=="undefined"?tn:FinalizationRegistry,"%Function%":Wy,"%GeneratorFunction%":nu,"%Int8Array%":typeof Int8Array=="undefined"?tn:Int8Array,"%Int16Array%":typeof Int16Array=="undefined"?tn:Int16Array,"%Int32Array%":typeof Int32Array=="undefined"?tn:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":eu&&vr?vr(vr([][Symbol.iterator]())):tn,"%JSON%":typeof JSON=="object"?JSON:tn,"%Map%":typeof Map=="undefined"?tn:Map,"%MapIteratorPrototype%":typeof Map=="undefined"||!eu||!vr?tn:vr(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise=="undefined"?tn:Promise,"%Proxy%":typeof Proxy=="undefined"?tn:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect=="undefined"?tn:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set=="undefined"?tn:Set,"%SetIteratorPrototype%":typeof Set=="undefined"||!eu||!vr?tn:vr(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer=="undefined"?tn:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":eu&&vr?vr(""[Symbol.iterator]()):tn,"%Symbol%":eu?Symbol:tn,"%SyntaxError%":iu,"%ThrowTypeError%":SA,"%TypedArray%":bA,"%TypeError%":ru,"%Uint8Array%":typeof Uint8Array=="undefined"?tn:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray=="undefined"?tn:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array=="undefined"?tn:Uint16Array,"%Uint32Array%":typeof Uint32Array=="undefined"?tn:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap=="undefined"?tn:WeakMap,"%WeakRef%":typeof WeakRef=="undefined"?tn:WeakRef,"%WeakSet%":typeof WeakSet=="undefined"?tn:WeakSet};if(vr)try{null.error}catch(r){Gy=vr(vr(r)),js["%Error.prototype%"]=Gy}var Gy,TA=function r(t){var e;if(t==="%AsyncFunction%")e=kp("async function () {}");else if(t==="%GeneratorFunction%")e=kp("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=kp("async function* () {}");else if(t==="%AsyncGenerator%"){var o=r("%AsyncGeneratorFunction%");o&&(e=o.prototype)}else if(t==="%AsyncIteratorPrototype%"){var a=r("%AsyncGenerator%");a&&vr&&(e=vr(a.prototype))}return js[t]=e,e},Vy={"%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"]},tl=kc(),Gc=ky(),AA=tl.call(Function.call,Array.prototype.concat),CA=tl.call(Function.apply,Array.prototype.splice),Hy=tl.call(Function.call,String.prototype.replace),Vc=tl.call(Function.call,String.prototype.slice),PA=tl.call(Function.call,RegExp.prototype.exec),IA=/[^%.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|(["'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|%$))/g,RA=/\\\\(\\\\)?/g,LA=function(t){var e=Vc(t,0,1),o=Vc(t,-1);if(e==="%"&&o!=="%")throw new iu("invalid intrinsic syntax, expected closing \`%\`");if(o==="%"&&e!=="%")throw new iu("invalid intrinsic syntax, expected opening \`%\`");var a=[];return Hy(t,IA,function(l,f,h,p){a[a.length]=h?Hy(p,RA,"$1"):f||l}),a},NA=function(t,e){var o=t,a;if(Gc(Vy,o)&&(a=Vy[o],o="%"+a[0]+"%"),Gc(js,o)){var l=js[o];if(l===nu&&(l=TA(o)),typeof l=="undefined"&&!e)throw new ru("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:a,name:o,value:l}}throw new iu("intrinsic "+t+" does not exist!")};qy.exports=function(t,e){if(typeof t!="string"||t.length===0)throw new ru("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new ru('"allowMissing" argument must be a boolean');if(PA(/^%?[^%]*%?$/,t)===null)throw new iu("\`%\` may not be present anywhere but at the beginning and end of the intrinsic name");var o=LA(t),a=o.length>0?o[0]:"",l=NA("%"+a+"%",e),f=l.name,h=l.value,p=!1,d=l.alias;d&&(a=d[0],CA(o,AA([0,1],d)));for(var g=1,_=!0;g<o.length;g+=1){var y=o[g],M=Vc(y,0,1),w=Vc(y,-1);if((M==='"'||M==="'"||M==="\`"||w==='"'||w==="'"||w==="\`")&&M!==w)throw new iu("property names with quotes must have matching quotes");if((y==="constructor"||!_)&&(p=!0),a+="."+y,f="%"+a+"%",Gc(js,f))h=js[f];else if(h!=null){if(!(y in h)){if(!e)throw new ru("base intrinsic for "+t+" exists, but the property is not available.");return}if(Ks&&g+1>=o.length){var T=Ks(h,y);_=!!T,_&&"get"in T&&!("originalValue"in T.get)?h=T.get:h=h[y]}else _=Gc(h,y),h=h[y];_&&!p&&(js[f]=h)}}return h}});var el=Kt((q3,Xy)=>{"use strict";var OA=Qs(),Vp=OA("%Object.defineProperty%",!0),Hp=function(){if(Vp)try{return Vp({},"a",{value:1}),!0}catch(t){return!1}return!1};Hp.hasArrayLengthDefineBug=function(){if(!Hp())return null;try{return Vp([],"length",{value:1}).length!==1}catch(t){return!0}};Xy.exports=Hp});var Wp=Kt((X3,Yy)=>{"use strict";var DA=Qs(),Hc=DA("%Object.getOwnPropertyDescriptor%",!0);if(Hc)try{Hc([],"length")}catch(r){Hc=null}Yy.exports=Hc});var Wc=Kt((Y3,Jy)=>{"use strict";var FA=el()(),qp=Qs(),nl=FA&&qp("%Object.defineProperty%",!0);if(nl)try{nl({},"a",{value:1})}catch(r){nl=!1}var UA=qp("%SyntaxError%"),ou=qp("%TypeError%"),Zy=Wp();Jy.exports=function(t,e,o){if(!t||typeof t!="object"&&typeof t!="function")throw new ou("\`obj\` must be an object or a function\`");if(typeof e!="string"&&typeof e!="symbol")throw new ou("\`property\` must be a string or a symbol\`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new ou("\`nonEnumerable\`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new ou("\`nonWritable\`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new ou("\`nonConfigurable\`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new ou("\`loose\`, if provided, must be a boolean");var a=arguments.length>3?arguments[3]:null,l=arguments.length>4?arguments[4]:null,f=arguments.length>5?arguments[5]:null,h=arguments.length>6?arguments[6]:!1,p=!!Zy&&Zy(t,e);if(nl)nl(t,e,{configurable:f===null&&p?p.configurable:!f,enumerable:a===null&&p?p.enumerable:!a,value:o,writable:l===null&&p?p.writable:!l});else if(h||!a&&!l&&!f)t[e]=o;else throw new UA("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var ev=Kt((Z3,tv)=>{"use strict";var Qy=Qs(),$y=Wc(),BA=el()(),Ky=Wp(),jy=Qy("%TypeError%"),zA=Qy("%Math.floor%");tv.exports=function(t,e){if(typeof t!="function")throw new jy("\`fn\` is not a function");if(typeof e!="number"||e<0||e>4294967295||zA(e)!==e)throw new jy("\`length\` must be a positive 32-bit integer");var o=arguments.length>2&&!!arguments[2],a=!0,l=!0;if("length"in t&&Ky){var f=Ky(t,"length");f&&!f.configurable&&(a=!1),f&&!f.writable&&(l=!1)}return(a||l||!o)&&(BA?$y(t,"length",e,!0,!0):$y(t,"length",e)),t}});var Xc=Kt((J3,qc)=>{"use strict";var Xp=kc(),su=Qs(),kA=ev(),GA=su("%TypeError%"),rv=su("%Function.prototype.apply%"),iv=su("%Function.prototype.call%"),ov=su("%Reflect.apply%",!0)||Xp.call(iv,rv),rl=su("%Object.defineProperty%",!0),VA=su("%Math.max%");if(rl)try{rl({},"a",{value:1})}catch(r){rl=null}qc.exports=function(t){if(typeof t!="function")throw new GA("a function is required");var e=ov(Xp,iv,arguments);return kA(e,1+VA(0,t.length-(arguments.length-1)),!0)};var nv=function(){return ov(Xp,rv,arguments)};rl?rl(qc.exports,"apply",{value:nv}):qc.exports.apply=nv});var Yp=Kt(($3,uv)=>{"use strict";var sv=Qs(),av=Xc(),HA=av(sv("String.prototype.indexOf"));uv.exports=function(t,e){var o=sv(t,!!e);return typeof o=="function"&&HA(t,".prototype.")>-1?av(o):o}});var fv=Kt((K3,cv)=>{"use strict";var WA=zc()(),qA=Yp(),Zp=qA("Object.prototype.toString"),Yc=function(t){return WA&&t&&typeof t=="object"&&Symbol.toStringTag in t?!1:Zp(t)==="[object Arguments]"},lv=function(t){return Yc(t)?!0:t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&Zp(t)!=="[object Array]"&&Zp(t.callee)==="[object Function]"},XA=function(){return Yc(arguments)}();Yc.isLegacyArguments=lv;cv.exports=XA?Yc:lv});var au=Kt((j3,mv)=>{"use strict";var YA=Bp(),ZA=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",JA=Object.prototype.toString,$A=Array.prototype.concat,hv=Wc(),KA=function(r){return typeof r=="function"&&JA.call(r)==="[object Function]"},pv=el()(),jA=function(r,t,e,o){if(t in r){if(o===!0){if(r[t]===e)return}else if(!KA(o)||!o())return}pv?hv(r,t,e,!0):hv(r,t,e)},dv=function(r,t){var e=arguments.length>2?arguments[2]:{},o=YA(t);ZA&&(o=$A.call(o,Object.getOwnPropertySymbols(t)));for(var a=0;a<o.length;a+=1)jA(r,o[a],t[o[a]],e[o[a]])};dv.supportsDescriptors=!!pv;mv.exports=dv});var Jp=Kt((Q3,yv)=>{"use strict";var gv=function(r){return r!==r};yv.exports=function(t,e){return t===0&&e===0?1/t===1/e:!!(t===e||gv(t)&&gv(e))}});var $p=Kt((tF,vv)=>{"use strict";var QA=Jp();vv.exports=function(){return typeof Object.is=="function"?Object.is:QA}});var xv=Kt((eF,_v)=>{"use strict";var tC=$p(),eC=au();_v.exports=function(){var t=tC();return eC(Object,{is:t},{is:function(){return Object.is!==t}}),t}});var wv=Kt((nF,Sv)=>{"use strict";var nC=au(),rC=Xc(),iC=Jp(),Ev=$p(),oC=xv(),Mv=rC(Ev(),Object);nC(Mv,{getPolyfill:Ev,implementation:iC,shim:oC});Sv.exports=Mv});var Pv=Kt((rF,Cv)=>{"use strict";var Kp=Yp(),bv=zc()(),Tv,Av,jp,Qp;bv&&(Tv=Kp("Object.prototype.hasOwnProperty"),Av=Kp("RegExp.prototype.exec"),jp={},Zc=function(){throw jp},Qp={toString:Zc,valueOf:Zc},typeof Symbol.toPrimitive=="symbol"&&(Qp[Symbol.toPrimitive]=Zc));var Zc,sC=Kp("Object.prototype.toString"),aC=Object.getOwnPropertyDescriptor,uC="[object RegExp]";Cv.exports=bv?function(t){if(!t||typeof t!="object")return!1;var e=aC(t,"lastIndex"),o=e&&Tv(e,"value");if(!o)return!1;try{Av(t,Qp)}catch(a){return a===jp}}:function(t){return!t||typeof t!="object"&&typeof t!="function"?!1:sC(t)===uC}});var Rv=Kt((iF,Iv)=>{"use strict";var ol=function(){return typeof function(){}.name=="string"},il=Object.getOwnPropertyDescriptor;if(il)try{il([],"length")}catch(r){il=null}ol.functionsHaveConfigurableNames=function(){if(!ol()||!il)return!1;var t=il(function(){},"name");return!!t&&!!t.configurable};var lC=Function.prototype.bind;ol.boundFunctionsHaveNames=function(){return ol()&&typeof lC=="function"&&function(){}.bind().name!==""};Iv.exports=ol});var Ov=Kt((oF,Nv)=>{"use strict";var Lv=Wc(),cC=el()(),fC=Rv().functionsHaveConfigurableNames(),hC=TypeError;Nv.exports=function(t,e){if(typeof t!="function")throw new hC("\`fn\` is not a function");var o=arguments.length>2&&!!arguments[2];return(!o||fC)&&(cC?Lv(t,"name",e,!0,!0):Lv(t,"name",e)),t}});var td=Kt((sF,Dv)=>{"use strict";var pC=Ov(),dC=Object,mC=TypeError;Dv.exports=pC(function(){if(this!=null&&this!==dC(this))throw new mC("RegExp.prototype.flags getter called on non-object");var t="";return this.hasIndices&&(t+="d"),this.global&&(t+="g"),this.ignoreCase&&(t+="i"),this.multiline&&(t+="m"),this.dotAll&&(t+="s"),this.unicode&&(t+="u"),this.unicodeSets&&(t+="v"),this.sticky&&(t+="y"),t},"get flags",!0)});var ed=Kt((aF,Fv)=>{"use strict";var gC=td(),yC=au().supportsDescriptors,vC=Object.getOwnPropertyDescriptor;Fv.exports=function(){if(yC&&/a/mig.flags==="gim"){var t=vC(RegExp.prototype,"flags");if(t&&typeof t.get=="function"&&typeof RegExp.prototype.dotAll=="boolean"&&typeof RegExp.prototype.hasIndices=="boolean"){var e="",o={};if(Object.defineProperty(o,"hasIndices",{get:function(){e+="d"}}),Object.defineProperty(o,"sticky",{get:function(){e+="y"}}),e==="dy")return t.get}}return gC}});var zv=Kt((uF,Bv)=>{"use strict";var _C=au().supportsDescriptors,xC=ed(),EC=Object.getOwnPropertyDescriptor,MC=Object.defineProperty,SC=TypeError,Uv=Object.getPrototypeOf,wC=/a/;Bv.exports=function(){if(!_C||!Uv)throw new SC("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var t=xC(),e=Uv(wC),o=EC(e,"flags");return(!o||o.get!==t)&&MC(e,"flags",{configurable:!0,enumerable:!1,get:t}),t}});var Hv=Kt((lF,Vv)=>{"use strict";var bC=au(),TC=Xc(),AC=td(),kv=ed(),CC=zv(),Gv=TC(kv());bC(Gv,{getPolyfill:kv,implementation:AC,shim:CC});Vv.exports=Gv});var qv=Kt((cF,Wv)=>{"use strict";var PC=Date.prototype.getDay,IC=function(t){try{return PC.call(t),!0}catch(e){return!1}},RC=Object.prototype.toString,LC="[object Date]",NC=zc()();Wv.exports=function(t){return typeof t!="object"||t===null?!1:NC?IC(t):RC.call(t)===LC}});var nd=Kt((fF,n_)=>{var Xv=Bp(),Yv=fv(),Zv=wv(),Jv=Pv(),$v=Hv(),Kv=qv(),jv=Date.prototype.getTime;function e_(r,t,e){var o=e||{};return(o.strict?Zv(r,t):r===t)?!0:!r||!t||typeof r!="object"&&typeof t!="object"?o.strict?Zv(r,t):r==t:OC(r,t,o)}function Qv(r){return r==null}function t_(r){return!(!r||typeof r!="object"||typeof r.length!="number"||typeof r.copy!="function"||typeof r.slice!="function"||r.length>0&&typeof r[0]!="number")}function OC(r,t,e){var o,a;if(typeof r!=typeof t||Qv(r)||Qv(t)||r.prototype!==t.prototype||Yv(r)!==Yv(t))return!1;var l=Jv(r),f=Jv(t);if(l!==f)return!1;if(l||f)return r.source===t.source&&$v(r)===$v(t);if(Kv(r)&&Kv(t))return jv.call(r)===jv.call(t);var h=t_(r),p=t_(t);if(h!==p)return!1;if(h||p){if(r.length!==t.length)return!1;for(o=0;o<r.length;o++)if(r[o]!==t[o])return!1;return!0}if(typeof r!=typeof t)return!1;try{var d=Xv(r),g=Xv(t)}catch(_){return!1}if(d.length!==g.length)return!1;for(d.sort(),g.sort(),o=d.length-1;o>=0;o--)if(d[o]!=g[o])return!1;for(o=d.length-1;o>=0;o--)if(a=d[o],!e_(r[a],t[a],e))return!1;return!0}n_.exports=e_});var dd=Kt((yB,l_)=>{var wP=nd(),mo=function(r){this.precision=r&&r.precision?r.precision:17,this.direction=r&&r.direction?r.direction:!1,this.pseudoNode=r&&r.pseudoNode?r.pseudoNode:!1,this.objectComparator=r&&r.objectComparator?r.objectComparator:bP};mo.prototype.compare=function(r,t){if(r.type!==t.type||!u_(r,t))return!1;switch(r.type){case"Point":return this.compareCoord(r.coordinates,t.coordinates);case"LineString":return this.compareLine(r.coordinates,t.coordinates,0,!1);case"Polygon":return this.comparePolygon(r,t);case"Feature":return this.compareFeature(r,t);default:if(r.type.indexOf("Multi")===0){var e=this,o=a_(r),a=a_(t);return o.every(function(l){return this.some(function(f){return e.compare(l,f)})},a)}}return!1};function a_(r){return r.coordinates.map(function(t){return{type:r.type.replace("Multi",""),coordinates:t}})}function u_(r,t){return r.hasOwnProperty("coordinates")?r.coordinates.length===t.coordinates.length:r.length===t.length}mo.prototype.compareCoord=function(r,t){if(r.length!==t.length)return!1;for(var e=0;e<r.length;e++)if(r[e].toFixed(this.precision)!==t[e].toFixed(this.precision))return!1;return!0};mo.prototype.compareLine=function(r,t,e,o){if(!u_(r,t))return!1;var a=this.pseudoNode?r:this.removePseudo(r),l=this.pseudoNode?t:this.removePseudo(t);if(!(o&&!this.compareCoord(a[0],l[0])&&(l=this.fixStartIndex(l,a),!l))){var f=this.compareCoord(a[e],l[e]);return this.direction||f?this.comparePath(a,l):this.compareCoord(a[e],l[l.length-(1+e)])?this.comparePath(a.slice().reverse(),l):!1}};mo.prototype.fixStartIndex=function(r,t){for(var e,o=-1,a=0;a<r.length;a++)if(this.compareCoord(r[a],t[0])){o=a;break}return o>=0&&(e=[].concat(r.slice(o,r.length),r.slice(1,o+1))),e};mo.prototype.comparePath=function(r,t){var e=this;return r.every(function(o,a){return e.compareCoord(o,this[a])},t)};mo.prototype.comparePolygon=function(r,t){if(this.compareLine(r.coordinates[0],t.coordinates[0],1,!0)){var e=r.coordinates.slice(1,r.coordinates.length),o=t.coordinates.slice(1,t.coordinates.length),a=this;return e.every(function(l){return this.some(function(f){return a.compareLine(l,f,1,!0)})},o)}else return!1};mo.prototype.compareFeature=function(r,t){return r.id!==t.id||!this.objectComparator(r.properties,t.properties)||!this.compareBBox(r,t)?!1:this.compare(r.geometry,t.geometry)};mo.prototype.compareBBox=function(r,t){return!!(!r.bbox&&!t.bbox||r.bbox&&t.bbox&&this.compareCoord(r.bbox,t.bbox))};mo.prototype.removePseudo=function(r){return r};function bP(r,t){return wP(r,t,{strict:!0})}l_.exports=mo});var c_=Kt((PB,Kc)=>{function xs(r,t,e,o){this.dataset=[],this.epsilon=1,this.minPts=2,this.distance=this._euclideanDistance,this.clusters=[],this.noise=[],this._visited=[],this._assigned=[],this._datasetLength=0,this._init(r,t,e,o)}xs.prototype.run=function(r,t,e,o){this._init(r,t,e,o);for(var a=0;a<this._datasetLength;a++)if(this._visited[a]!==1){this._visited[a]=1;var l=this._regionQuery(a);if(l.length<this.minPts)this.noise.push(a);else{var f=this.clusters.length;this.clusters.push([]),this._addToCluster(a,f),this._expandCluster(f,l)}}return this.clusters};xs.prototype._init=function(r,t,e,o){if(r){if(!(r instanceof Array))throw Error("Dataset must be of type array, "+typeof r+" given");this.dataset=r,this.clusters=[],this.noise=[],this._datasetLength=r.length,this._visited=new Array(this._datasetLength),this._assigned=new Array(this._datasetLength)}t&&(this.epsilon=t),e&&(this.minPts=e),o&&(this.distance=o)};xs.prototype._expandCluster=function(r,t){for(var e=0;e<t.length;e++){var o=t[e];if(this._visited[o]!==1){this._visited[o]=1;var a=this._regionQuery(o);a.length>=this.minPts&&(t=this._mergeArrays(t,a))}this._assigned[o]!==1&&this._addToCluster(o,r)}};xs.prototype._addToCluster=function(r,t){this.clusters[t].push(r),this._assigned[r]=1};xs.prototype._regionQuery=function(r){for(var t=[],e=0;e<this._datasetLength;e++){var o=this.distance(this.dataset[r],this.dataset[e]);o<this.epsilon&&t.push(e)}return t};xs.prototype._mergeArrays=function(r,t){for(var e=t.length,o=0;o<e;o++){var a=t[o];r.indexOf(a)<0&&r.push(a)}return r};xs.prototype._euclideanDistance=function(r,t){for(var e=0,o=Math.min(r.length,t.length);o--;)e+=(r[o]-t[o])*(r[o]-t[o]);return Math.sqrt(e)};typeof Kc!="undefined"&&Kc.exports&&(Kc.exports=xs)});var f_=Kt((IB,jc)=>{function Es(r,t,e){this.k=3,this.dataset=[],this.assignments=[],this.centroids=[],this.init(r,t,e)}Es.prototype.init=function(r,t,e){this.assignments=[],this.centroids=[],typeof r!="undefined"&&(this.dataset=r),typeof t!="undefined"&&(this.k=t),typeof e!="undefined"&&(this.distance=e)};Es.prototype.run=function(r,t){this.init(r,t);for(var e=this.dataset.length,o=0;o<this.k;o++)this.centroids[o]=this.randomCentroid();for(var a=!0;a;){a=this.assign();for(var l=0;l<this.k;l++){for(var f=new Array(g),h=0,p=0;p<g;p++)f[p]=0;for(var d=0;d<e;d++){var g=this.dataset[d].length;if(l===this.assignments[d]){for(var p=0;p<g;p++)f[p]+=this.dataset[d][p];h++}}if(h>0){for(var p=0;p<g;p++)f[p]/=h;this.centroids[l]=f}else this.centroids[l]=this.randomCentroid(),a=!0}}return this.getClusters()};Es.prototype.randomCentroid=function(){var r=this.dataset.length-1,t,e;do e=Math.round(Math.random()*r),t=this.dataset[e];while(this.centroids.indexOf(t)>=0);return t};Es.prototype.assign=function(){for(var r=!1,t=this.dataset.length,e,o=0;o<t;o++)e=this.argmin(this.dataset[o],this.centroids,this.distance),e!=this.assignments[o]&&(this.assignments[o]=e,r=!0);return r};Es.prototype.getClusters=function(){for(var r=new Array(this.k),t,e=0;e<this.assignments.length;e++)t=this.assignments[e],typeof r[t]=="undefined"&&(r[t]=[]),r[t].push(e);return r};Es.prototype.argmin=function(r,t,e){for(var o=Number.MAX_VALUE,a=0,l=t.length,f,h=0;h<l;h++)f=e(r,t[h]),f<o&&(o=f,a=h);return a};Es.prototype.distance=function(r,t){for(var e=0,o=Math.min(r.length,t.length);o--;){var a=r[o]-t[o];e+=a*a}return Math.sqrt(e)};typeof jc!="undefined"&&jc.exports&&(jc.exports=Es)});var md=Kt((RB,Qc)=>{function go(r,t,e){this._queue=[],this._priorities=[],this._sorting="desc",this._init(r,t,e)}go.prototype.insert=function(r,t){for(var e=this._queue.length,o=e;o--;){var a=this._priorities[o];this._sorting==="desc"?t>a&&(e=o):t<a&&(e=o)}this._insertAt(r,t,e)};go.prototype.remove=function(r){for(var t=this._queue.length;t--;){var e=this._queue[t];if(r===e){this._queue.splice(t,1),this._priorities.splice(t,1);break}}};go.prototype.forEach=function(r){this._queue.forEach(r)};go.prototype.getElements=function(){return this._queue};go.prototype.getElementPriority=function(r){return this._priorities[r]};go.prototype.getPriorities=function(){return this._priorities};go.prototype.getElementsWithPriorities=function(){for(var r=[],t=0,e=this._queue.length;t<e;t++)r.push([this._queue[t],this._priorities[t]]);return r};go.prototype._init=function(r,t,e){if(r&&t){if(this._queue=[],this._priorities=[],r.length!==t.length)throw new Error("Arrays must have the same length");for(var o=0;o<r.length;o++)this.insert(r[o],t[o])}e&&(this._sorting=e)};go.prototype._insertAt=function(r,t,e){this._queue.length===e?(this._queue.push(r),this._priorities.push(t)):(this._queue.splice(e,0,r),this._priorities.splice(e,0,t))};typeof Qc!="undefined"&&Qc.exports&&(Qc.exports=go)});var p_=Kt((LB,lu)=>{typeof lu!="undefined"&&lu.exports&&(h_=md());var h_;function Yo(r,t,e,o){this.epsilon=1,this.minPts=1,this.distance=this._euclideanDistance,this._reachability=[],this._processed=[],this._coreDistance=0,this._orderedList=[],this._init(r,t,e,o)}Yo.prototype.run=function(r,t,e,o){this._init(r,t,e,o);for(var a=0,l=this.dataset.length;a<l;a++)if(this._processed[a]!==1){this._processed[a]=1,this.clusters.push([a]);var f=this.clusters.length-1;this._orderedList.push(a);var h=new h_(null,null,"asc"),p=this._regionQuery(a);this._distanceToCore(a)!==void 0&&(this._updateQueue(a,p,h),this._expandCluster(f,h))}return this.clusters};Yo.prototype.getReachabilityPlot=function(){for(var r=[],t=0,e=this._orderedList.length;t<e;t++){var o=this._orderedList[t],a=this._reachability[o];r.push([o,a])}return r};Yo.prototype._init=function(r,t,e,o){if(r){if(!(r instanceof Array))throw Error("Dataset must be of type array, "+typeof r+" given");this.dataset=r,this.clusters=[],this._reachability=new Array(this.dataset.length),this._processed=new Array(this.dataset.length),this._coreDistance=0,this._orderedList=[]}t&&(this.epsilon=t),e&&(this.minPts=e),o&&(this.distance=o)};Yo.prototype._updateQueue=function(r,t,e){var o=this;this._coreDistance=this._distanceToCore(r),t.forEach(function(a){if(o._processed[a]===void 0){var l=o.distance(o.dataset[r],o.dataset[a]),f=Math.max(o._coreDistance,l);o._reachability[a]===void 0?(o._reachability[a]=f,e.insert(a,f)):f<o._reachability[a]&&(o._reachability[a]=f,e.remove(a),e.insert(a,f))}})};Yo.prototype._expandCluster=function(r,t){for(var e=t.getElements(),o=0,a=e.length;o<a;o++){var l=e[o];if(this._processed[l]===void 0){var f=this._regionQuery(l);this._processed[l]=1,this.clusters[r].push(l),this._orderedList.push(l),this._distanceToCore(l)!==void 0&&(this._updateQueue(l,f,t),this._expandCluster(r,t))}}};Yo.prototype._distanceToCore=function(r){for(var t=this.epsilon,e=0;e<t;e++){var o=this._regionQuery(r,e);if(o.length>=this.minPts)return e}};Yo.prototype._regionQuery=function(r,t){t=t||this.epsilon;for(var e=[],o=0,a=this.dataset.length;o<a;o++)this.distance(this.dataset[r],this.dataset[o])<t&&e.push(o);return e};Yo.prototype._euclideanDistance=function(r,t){for(var e=0,o=Math.min(r.length,t.length);o--;)e+=(r[o]-t[o])*(r[o]-t[o]);return Math.sqrt(e)};typeof lu!="undefined"&&lu.exports&&(lu.exports=Yo)});var d_=Kt((NB,tf)=>{typeof tf!="undefined"&&tf.exports&&(tf.exports={DBSCAN:c_(),KMEANS:f_(),OPTICS:p_(),PriorityQueue:md()})});var gd=Kt((zB,g_)=>{"use strict";g_.exports={eudist:function(t,e,o){for(var a=t.length,l=0,f=0;f<a;f++){var h=(t[f]||0)-(e[f]||0);l+=h*h}return o?Math.sqrt(l):l},mandist:function(t,e,o){for(var a=t.length,l=0,f=0;f<a;f++)l+=Math.abs((t[f]||0)-(e[f]||0));return o?Math.sqrt(l):l},dist:function(t,e,o){var a=Math.abs(t-e);return o?a:a*a}}});var __=Kt((kB,v_)=>{"use strict";var y_=gd(),RP=y_.eudist,LP=y_.dist;v_.exports={kmrand:function(t,e){for(var o={},a=[],l=e<<2,f=t.length,h=t[0].length>0;a.length<e&&l-- >0;){var p=t[Math.floor(Math.random()*f)],d=h?p.join("_"):""+p;o[d]||(o[d]=!0,a.push(p))}if(a.length<e)throw new Error("Error initializating clusters");return a},kmpp:function(t,e){var o=t[0].length?RP:LP,a=[],l=t.length,f=t[0].length>0,h={},p=t[Math.floor(Math.random()*l)],d=f?p.join("_"):""+p;for(a.push(p),h[d]=!0;a.length<e;){for(var g=[],_=a.length,y=0,M=[],w=0;w<l;w++){for(var T=1/0,x=0;x<_;x++){var v=o(t[w],a[x]);v<=T&&(T=v)}g[w]=T}for(var C=0;C<l;C++)y+=g[C];for(var S=0;S<l;S++)M[S]={i:S,v:t[S],pr:g[S]/y,cs:0};M.sort(function(z,L){return z.pr-L.pr}),M[0].cs=M[0].pr;for(var O=1;O<l;O++)M[O].cs=M[O-1].cs+M[O].pr;for(var F=Math.random(),G=0;G<l-1&&M[G++].cs<F;);a.push(M[G-1].v)}return a}}});var w_=Kt((HB,S_)=>{"use strict";var yd=gd(),M_=__(),NP=yd.eudist,GB=yd.mandist,VB=yd.dist,OP=M_.kmrand,DP=M_.kmpp,x_=1e4;function E_(r,t,e){e=e||[];for(var o=0;o<r;o++)e[o]=t;return e}function FP(r,t,e,o){var a=[],l=[],f=[],h=[],p=!1,d=o||x_,g=r.length,_=r[0].length,y=_>0,M=[];if(e)e=="kmrand"?a=OP(r,t):e=="kmpp"?a=DP(r,t):a=e;else for(var w={};a.length<t;){var T=Math.floor(Math.random()*g);w[T]||(w[T]=!0,a.push(r[T]))}do{E_(t,0,M);for(var x=0;x<g;x++){for(var v=1/0,C=0,S=0;S<t;S++){var h=y?NP(r[x],a[S]):Math.abs(r[x]-a[S]);h<=v&&(v=h,C=S)}f[x]=C,M[C]++}for(var O=[],l=[],F=0,G=0;G<t;G++)O[G]=y?E_(_,0,O[G]):0,l[G]=a[G];if(y){for(var z=0;z<t;z++)a[z]=[];for(var L=0;L<g;L++)for(var D=f[L],q=O[D],nt=r[L],k=0;k<_;k++)q[k]+=nt[k];p=!0;for(var xt=0;xt<t;xt++){for(var X=a[xt],it=O[xt],vt=l[xt],pt=M[xt],et=0;et<_;et++)X[et]=it[et]/pt||0;if(p){for(var ot=0;ot<_;ot++)if(vt[ot]!=X[ot]){p=!1;break}}}}else{for(var V=0;V<g;V++){var K=f[V];O[K]+=r[V]}for(var at=0;at<t;at++)a[at]=O[at]/M[at]||0;p=!0;for(var Tt=0;Tt<t;Tt++)if(l[Tt]!=a[Tt]){p=!1;break}}p=p||--d<=0}while(!p);return{it:x_-d,k:t,idxs:f,centroids:a}}S_.exports=FP});var du=Kt((Sd,wd)=>{(function(r,t){typeof Sd=="object"&&typeof wd!="undefined"?wd.exports=t():typeof define=="function"&&define.amd?define(t):(r=typeof globalThis!="undefined"?globalThis:r||self,r.polygonClipping=t())})(Sd,function(){"use strict";function r($,N){if(!($ instanceof N))throw new TypeError("Cannot call a class as a function")}function t($,N){for(var b=0;b<N.length;b++){var R=N[b];R.enumerable=R.enumerable||!1,R.configurable=!0,"value"in R&&(R.writable=!0),Object.defineProperty($,R.key,R)}}function e($,N,b){return N&&t($.prototype,N),b&&t($,b),$}var o=function(){function $(N,b){this.next=null,this.key=N,this.data=b,this.left=null,this.right=null}return $}();function a($,N){return $>N?1:$<N?-1:0}function l($,N,b){for(var R=new o(null,null),W=R,J=R;;){var I=b($,N.key);if(I<0){if(N.left===null)break;if(b($,N.left.key)<0){var P=N.left;if(N.left=P.right,P.right=N,N=P,N.left===null)break}J.left=N,J=N,N=N.left}else if(I>0){if(N.right===null)break;if(b($,N.right.key)>0){var P=N.right;if(N.right=P.left,P.left=N,N=P,N.right===null)break}W.right=N,W=N,N=N.right}else break}return W.right=N.left,J.left=N.right,N.left=R.right,N.right=R.left,N}function f($,N,b,R){var W=new o($,N);if(b===null)return W.left=W.right=null,W;b=l($,b,R);var J=R($,b.key);return J<0?(W.left=b.left,W.right=b,b.left=null):J>=0&&(W.right=b.right,W.left=b,b.right=null),W}function h($,N,b){var R=null,W=null;if(N){N=l($,N,b);var J=b(N.key,$);J===0?(R=N.left,W=N.right):J<0?(W=N.right,N.right=null,R=N):(R=N.left,N.left=null,W=N)}return{left:R,right:W}}function p($,N,b){return N===null?$:($===null||(N=l($.key,N,b),N.left=$),N)}function d($,N,b,R,W){if($){R(""+N+(b?"\\u2514\\u2500\\u2500 ":"\\u251C\\u2500\\u2500 ")+W($)+\`
39
39
  \`);var J=N+(b?" ":"\\u2502 ");$.left&&d($.left,J,!1,R,W),$.right&&d($.right,J,!0,R,W)}}var g=function(){function $(N){N===void 0&&(N=a),this._root=null,this._size=0,this._comparator=N}return $.prototype.insert=function(N,b){return this._size++,this._root=f(N,b,this._root,this._comparator)},$.prototype.add=function(N,b){var R=new o(N,b);this._root===null&&(R.left=R.right=null,this._size++,this._root=R);var W=this._comparator,J=l(N,this._root,W),I=W(N,J.key);return I===0?this._root=J:(I<0?(R.left=J.left,R.right=J,J.left=null):I>0&&(R.right=J.right,R.left=J,J.right=null),this._size++,this._root=R),this._root},$.prototype.remove=function(N){this._root=this._remove(N,this._root,this._comparator)},$.prototype._remove=function(N,b,R){var W;if(b===null)return null;b=l(N,b,R);var J=R(N,b.key);return J===0?(b.left===null?W=b.right:(W=l(N,b.left,R),W.right=b.right),this._size--,W):b},$.prototype.pop=function(){var N=this._root;if(N){for(;N.left;)N=N.left;return this._root=l(N.key,this._root,this._comparator),this._root=this._remove(N.key,this._root,this._comparator),{key:N.key,data:N.data}}return null},$.prototype.findStatic=function(N){for(var b=this._root,R=this._comparator;b;){var W=R(N,b.key);if(W===0)return b;W<0?b=b.left:b=b.right}return null},$.prototype.find=function(N){return this._root&&(this._root=l(N,this._root,this._comparator),this._comparator(N,this._root.key)!==0)?null:this._root},$.prototype.contains=function(N){for(var b=this._root,R=this._comparator;b;){var W=R(N,b.key);if(W===0)return!0;W<0?b=b.left:b=b.right}return!1},$.prototype.forEach=function(N,b){for(var R=this._root,W=[],J=!1;!J;)R!==null?(W.push(R),R=R.left):W.length!==0?(R=W.pop(),N.call(b,R),R=R.right):J=!0;return this},$.prototype.range=function(N,b,R,W){for(var J=[],I=this._comparator,P=this._root,B;J.length!==0||P;)if(P)J.push(P),P=P.left;else{if(P=J.pop(),B=I(P.key,b),B>0)break;if(I(P.key,N)>=0&&R.call(W,P))return this;P=P.right}return this},$.prototype.keys=function(){var N=[];return this.forEach(function(b){var R=b.key;return N.push(R)}),N},$.prototype.values=function(){var N=[];return this.forEach(function(b){var R=b.data;return N.push(R)}),N},$.prototype.min=function(){return this._root?this.minNode(this._root).key:null},$.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},$.prototype.minNode=function(N){if(N===void 0&&(N=this._root),N)for(;N.left;)N=N.left;return N},$.prototype.maxNode=function(N){if(N===void 0&&(N=this._root),N)for(;N.right;)N=N.right;return N},$.prototype.at=function(N){for(var b=this._root,R=!1,W=0,J=[];!R;)if(b)J.push(b),b=b.left;else if(J.length>0){if(b=J.pop(),W===N)return b;W++,b=b.right}else R=!0;return null},$.prototype.next=function(N){var b=this._root,R=null;if(N.right){for(R=N.right;R.left;)R=R.left;return R}for(var W=this._comparator;b;){var J=W(N.key,b.key);if(J===0)break;J<0?(R=b,b=b.left):b=b.right}return R},$.prototype.prev=function(N){var b=this._root,R=null;if(N.left!==null){for(R=N.left;R.right;)R=R.right;return R}for(var W=this._comparator;b;){var J=W(N.key,b.key);if(J===0)break;J<0?b=b.left:(R=b,b=b.right)}return R},$.prototype.clear=function(){return this._root=null,this._size=0,this},$.prototype.toList=function(){return M(this._root)},$.prototype.load=function(N,b,R){b===void 0&&(b=[]),R===void 0&&(R=!1);var W=N.length,J=this._comparator;if(R&&x(N,b,0,W-1,J),this._root===null)this._root=_(N,b,0,W),this._size=W;else{var I=T(this.toList(),y(N,b),J);W=this._size+W,this._root=w({head:I},0,W)}return this},$.prototype.isEmpty=function(){return this._root===null},Object.defineProperty($.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty($.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),$.prototype.toString=function(N){N===void 0&&(N=function(W){return String(W.key)});var b=[];return d(this._root,"",!0,function(R){return b.push(R)},N),b.join("")},$.prototype.update=function(N,b,R){var W=this._comparator,J=h(N,this._root,W),I=J.left,P=J.right;W(N,b)<0?P=f(b,R,P,W):I=f(b,R,I,W),this._root=p(I,P,W)},$.prototype.split=function(N){return h(N,this._root,this._comparator)},$}();function _($,N,b,R){var W=R-b;if(W>0){var J=b+Math.floor(W/2),I=$[J],P=N[J],B=new o(I,P);return B.left=_($,N,b,J),B.right=_($,N,J+1,R),B}return null}function y($,N){for(var b=new o(null,null),R=b,W=0;W<$.length;W++)R=R.next=new o($[W],N[W]);return R.next=null,b.next}function M($){for(var N=$,b=[],R=!1,W=new o(null,null),J=W;!R;)N?(b.push(N),N=N.left):b.length>0?(N=J=J.next=b.pop(),N=N.right):R=!0;return J.next=null,W.next}function w($,N,b){var R=b-N;if(R>0){var W=N+Math.floor(R/2),J=w($,N,W),I=$.head;return I.left=J,$.head=$.head.next,I.right=w($,W+1,b),I}return null}function T($,N,b){for(var R=new o(null,null),W=R,J=$,I=N;J!==null&&I!==null;)b(J.key,I.key)<0?(W.next=J,J=J.next):(W.next=I,I=I.next),W=W.next;return J!==null?W.next=J:I!==null&&(W.next=I),R.next}function x($,N,b,R,W){if(!(b>=R)){for(var J=$[b+R>>1],I=b-1,P=R+1;;){do I++;while(W($[I],J)<0);do P--;while(W($[P],J)>0);if(I>=P)break;var B=$[I];$[I]=$[P],$[P]=B,B=N[I],N[I]=N[P],N[P]=B}x($,N,b,P,W),x($,N,P+1,R,W)}}var v=function(N,b){return N.ll.x<=b.x&&b.x<=N.ur.x&&N.ll.y<=b.y&&b.y<=N.ur.y},C=function(N,b){if(b.ur.x<N.ll.x||N.ur.x<b.ll.x||b.ur.y<N.ll.y||N.ur.y<b.ll.y)return null;var R=N.ll.x<b.ll.x?b.ll.x:N.ll.x,W=N.ur.x<b.ur.x?N.ur.x:b.ur.x,J=N.ll.y<b.ll.y?b.ll.y:N.ll.y,I=N.ur.y<b.ur.y?N.ur.y:b.ur.y;return{ll:{x:R,y:J},ur:{x:W,y:I}}},S=Number.EPSILON;S===void 0&&(S=Math.pow(2,-52));var O=S*S,F=function(N,b){if(-S<N&&N<S&&-S<b&&b<S)return 0;var R=N-b;return R*R<O*N*b?0:N<b?-1:1},G=function(){function $(){r(this,$),this.reset()}return e($,[{key:"reset",value:function(){this.xRounder=new z,this.yRounder=new z}},{key:"round",value:function(b,R){return{x:this.xRounder.round(b),y:this.yRounder.round(R)}}}]),$}(),z=function(){function $(){r(this,$),this.tree=new g,this.round(0)}return e($,[{key:"round",value:function(b){var R=this.tree.add(b),W=this.tree.prev(R);if(W!==null&&F(R.key,W.key)===0)return this.tree.remove(b),W.key;var J=this.tree.next(R);return J!==null&&F(R.key,J.key)===0?(this.tree.remove(b),J.key):b}}]),$}(),L=new G,D=function(N,b){return N.x*b.y-N.y*b.x},q=function(N,b){return N.x*b.x+N.y*b.y},nt=function(N,b,R){var W={x:b.x-N.x,y:b.y-N.y},J={x:R.x-N.x,y:R.y-N.y},I=D(W,J);return F(I,0)},k=function(N){return Math.sqrt(q(N,N))},xt=function(N,b,R){var W={x:b.x-N.x,y:b.y-N.y},J={x:R.x-N.x,y:R.y-N.y};return D(J,W)/k(J)/k(W)},X=function(N,b,R){var W={x:b.x-N.x,y:b.y-N.y},J={x:R.x-N.x,y:R.y-N.y};return q(J,W)/k(J)/k(W)},it=function(N,b,R){return b.y===0?null:{x:N.x+b.x/b.y*(R-N.y),y:R}},vt=function(N,b,R){return b.x===0?null:{x:R,y:N.y+b.y/b.x*(R-N.x)}},pt=function(N,b,R,W){if(b.x===0)return vt(R,W,N.x);if(W.x===0)return vt(N,b,R.x);if(b.y===0)return it(R,W,N.y);if(W.y===0)return it(N,b,R.y);var J=D(b,W);if(J==0)return null;var I={x:R.x-N.x,y:R.y-N.y},P=D(I,b)/J,B=D(I,W)/J,lt=N.x+B*b.x,ct=R.x+P*W.x,Q=N.y+B*b.y,St=R.y+P*W.y,_t=(lt+ct)/2,Mt=(Q+St)/2;return{x:_t,y:Mt}},et=function(){e($,null,[{key:"compare",value:function(b,R){var W=$.comparePoints(b.point,R.point);return W!==0?W:(b.point!==R.point&&b.link(R),b.isLeft!==R.isLeft?b.isLeft?1:-1:V.compare(b.segment,R.segment))}},{key:"comparePoints",value:function(b,R){return b.x<R.x?-1:b.x>R.x?1:b.y<R.y?-1:b.y>R.y?1:0}}]);function $(N,b){r(this,$),N.events===void 0?N.events=[this]:N.events.push(this),this.point=N,this.isLeft=b}return e($,[{key:"link",value:function(b){if(b.point===this.point)throw new Error("Tried to link already linked events");for(var R=b.point.events,W=0,J=R.length;W<J;W++){var I=R[W];this.point.events.push(I),I.point=this.point}this.checkForConsuming()}},{key:"checkForConsuming",value:function(){for(var b=this.point.events.length,R=0;R<b;R++){var W=this.point.events[R];if(W.segment.consumedBy===void 0)for(var J=R+1;J<b;J++){var I=this.point.events[J];I.consumedBy===void 0&&W.otherSE.point.events===I.otherSE.point.events&&W.segment.consume(I.segment)}}}},{key:"getAvailableLinkedEvents",value:function(){for(var b=[],R=0,W=this.point.events.length;R<W;R++){var J=this.point.events[R];J!==this&&!J.segment.ringOut&&J.segment.isInResult()&&b.push(J)}return b}},{key:"getLeftmostComparator",value:function(b){var R=this,W=new Map,J=function(P){var B=P.otherSE;W.set(P,{sine:xt(R.point,b.point,B.point),cosine:X(R.point,b.point,B.point)})};return function(I,P){W.has(I)||J(I),W.has(P)||J(P);var B=W.get(I),lt=B.sine,ct=B.cosine,Q=W.get(P),St=Q.sine,_t=Q.cosine;return lt>=0&&St>=0?ct<_t?1:ct>_t?-1:0:lt<0&&St<0?ct<_t?-1:ct>_t?1:0:St<lt?-1:St>lt?1:0}}}]),$}(),ot=0,V=function(){e($,null,[{key:"compare",value:function(b,R){var W=b.leftSE.point.x,J=R.leftSE.point.x,I=b.rightSE.point.x,P=R.rightSE.point.x;if(P<W)return 1;if(I<J)return-1;var B=b.leftSE.point.y,lt=R.leftSE.point.y,ct=b.rightSE.point.y,Q=R.rightSE.point.y;if(W<J){if(lt<B&&lt<ct)return 1;if(lt>B&&lt>ct)return-1;var St=b.comparePoint(R.leftSE.point);if(St<0)return 1;if(St>0)return-1;var _t=R.comparePoint(b.rightSE.point);return _t!==0?_t:-1}if(W>J){if(B<lt&&B<Q)return-1;if(B>lt&&B>Q)return 1;var Mt=R.comparePoint(b.leftSE.point);if(Mt!==0)return Mt;var Lt=b.comparePoint(R.rightSE.point);return Lt<0?1:Lt>0?-1:1}if(B<lt)return-1;if(B>lt)return 1;if(I<P){var Jt=R.comparePoint(b.rightSE.point);if(Jt!==0)return Jt}if(I>P){var Et=b.comparePoint(R.rightSE.point);if(Et<0)return 1;if(Et>0)return-1}if(I!==P){var oe=ct-B,jt=I-W,Ht=Q-lt,Ot=P-J;if(oe>jt&&Ht<Ot)return 1;if(oe<jt&&Ht>Ot)return-1}return I>P?1:I<P||ct<Q?-1:ct>Q?1:b.id<R.id?-1:b.id>R.id?1:0}}]);function $(N,b,R,W){r(this,$),this.id=++ot,this.leftSE=N,N.segment=this,N.otherSE=b,this.rightSE=b,b.segment=this,b.otherSE=N,this.rings=R,this.windings=W}return e($,[{key:"replaceRightSE",value:function(b){this.rightSE=b,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}},{key:"bbox",value:function(){var b=this.leftSE.point.y,R=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:b<R?b:R},ur:{x:this.rightSE.point.x,y:b>R?b:R}}}},{key:"vector",value:function(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}},{key:"isAnEndpoint",value:function(b){return b.x===this.leftSE.point.x&&b.y===this.leftSE.point.y||b.x===this.rightSE.point.x&&b.y===this.rightSE.point.y}},{key:"comparePoint",value:function(b){if(this.isAnEndpoint(b))return 0;var R=this.leftSE.point,W=this.rightSE.point,J=this.vector();if(R.x===W.x)return b.x===R.x?0:b.x<R.x?1:-1;var I=(b.y-R.y)/J.y,P=R.x+I*J.x;if(b.x===P)return 0;var B=(b.x-R.x)/J.x,lt=R.y+B*J.y;return b.y===lt?0:b.y<lt?-1:1}},{key:"getIntersection",value:function(b){var R=this.bbox(),W=b.bbox(),J=C(R,W);if(J===null)return null;var I=this.leftSE.point,P=this.rightSE.point,B=b.leftSE.point,lt=b.rightSE.point,ct=v(R,B)&&this.comparePoint(B)===0,Q=v(W,I)&&b.comparePoint(I)===0,St=v(R,lt)&&this.comparePoint(lt)===0,_t=v(W,P)&&b.comparePoint(P)===0;if(Q&&ct)return _t&&!St?P:!_t&&St?lt:null;if(Q)return St&&I.x===lt.x&&I.y===lt.y?null:I;if(ct)return _t&&P.x===B.x&&P.y===B.y?null:B;if(_t&&St)return null;if(_t)return P;if(St)return lt;var Mt=pt(I,this.vector(),B,b.vector());return Mt===null||!v(J,Mt)?null:L.round(Mt.x,Mt.y)}},{key:"split",value:function(b){var R=[],W=b.events!==void 0,J=new et(b,!0),I=new et(b,!1),P=this.rightSE;this.replaceRightSE(I),R.push(I),R.push(J);var B=new $(J,P,this.rings.slice(),this.windings.slice());return et.comparePoints(B.leftSE.point,B.rightSE.point)>0&&B.swapEvents(),et.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),W&&(J.checkForConsuming(),I.checkForConsuming()),R}},{key:"swapEvents",value:function(){var b=this.rightSE;this.rightSE=this.leftSE,this.leftSE=b,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(var R=0,W=this.windings.length;R<W;R++)this.windings[R]*=-1}},{key:"consume",value:function(b){for(var R=this,W=b;R.consumedBy;)R=R.consumedBy;for(;W.consumedBy;)W=W.consumedBy;var J=$.compare(R,W);if(J!==0){if(J>0){var I=R;R=W,W=I}if(R.prev===W){var P=R;R=W,W=P}for(var B=0,lt=W.rings.length;B<lt;B++){var ct=W.rings[B],Q=W.windings[B],St=R.rings.indexOf(ct);St===-1?(R.rings.push(ct),R.windings.push(Q)):R.windings[St]+=Q}W.rings=null,W.windings=null,W.consumedBy=R,W.leftSE.consumedBy=R.leftSE,W.rightSE.consumedBy=R.rightSE}}},{key:"prevInResult",value:function(){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)}},{key:"beforeState",value:function(){if(this._beforeState!==void 0)return this._beforeState;if(!this.prev)this._beforeState={rings:[],windings:[],multiPolys:[]};else{var b=this.prev.consumedBy||this.prev;this._beforeState=b.afterState()}return this._beforeState}},{key:"afterState",value:function(){if(this._afterState!==void 0)return this._afterState;var b=this.beforeState();this._afterState={rings:b.rings.slice(0),windings:b.windings.slice(0),multiPolys:[]};for(var R=this._afterState.rings,W=this._afterState.windings,J=this._afterState.multiPolys,I=0,P=this.rings.length;I<P;I++){var B=this.rings[I],lt=this.windings[I],ct=R.indexOf(B);ct===-1?(R.push(B),W.push(lt)):W[ct]+=lt}for(var Q=[],St=[],_t=0,Mt=R.length;_t<Mt;_t++)if(W[_t]!==0){var Lt=R[_t],Jt=Lt.poly;if(St.indexOf(Jt)===-1)if(Lt.isExterior)Q.push(Jt);else{St.indexOf(Jt)===-1&&St.push(Jt);var Et=Q.indexOf(Lt.poly);Et!==-1&&Q.splice(Et,1)}}for(var oe=0,jt=Q.length;oe<jt;oe++){var Ht=Q[oe].multiPoly;J.indexOf(Ht)===-1&&J.push(Ht)}return this._afterState}},{key:"isInResult",value:function(){if(this.consumedBy)return!1;if(this._isInResult!==void 0)return this._isInResult;var b=this.beforeState().multiPolys,R=this.afterState().multiPolys;switch(Xt.type){case"union":{var W=b.length===0,J=R.length===0;this._isInResult=W!==J;break}case"intersection":{var I,P;b.length<R.length?(I=b.length,P=R.length):(I=R.length,P=b.length),this._isInResult=P===Xt.numMultiPolys&&I<P;break}case"xor":{var B=Math.abs(b.length-R.length);this._isInResult=B%2===1;break}case"difference":{var lt=function(Q){return Q.length===1&&Q[0].isSubject};this._isInResult=lt(b)!==lt(R);break}default:throw new Error("Unrecognized operation type found ".concat(Xt.type))}return this._isInResult}}],[{key:"fromRing",value:function(b,R,W){var J,I,P,B=et.comparePoints(b,R);if(B<0)J=b,I=R,P=1;else if(B>0)J=R,I=b,P=-1;else throw new Error("Tried to create degenerate segment at [".concat(b.x,", ").concat(b.y,"]"));var lt=new et(J,!0),ct=new et(I,!1);return new $(lt,ct,[W],[P])}}]),$}(),K=function(){function $(N,b,R){if(r(this,$),!Array.isArray(N)||N.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=b,this.isExterior=R,this.segments=[],typeof N[0][0]!="number"||typeof N[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var W=L.round(N[0][0],N[0][1]);this.bbox={ll:{x:W.x,y:W.y},ur:{x:W.x,y:W.y}};for(var J=W,I=1,P=N.length;I<P;I++){if(typeof N[I][0]!="number"||typeof N[I][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var B=L.round(N[I][0],N[I][1]);B.x===J.x&&B.y===J.y||(this.segments.push(V.fromRing(J,B,this)),B.x<this.bbox.ll.x&&(this.bbox.ll.x=B.x),B.y<this.bbox.ll.y&&(this.bbox.ll.y=B.y),B.x>this.bbox.ur.x&&(this.bbox.ur.x=B.x),B.y>this.bbox.ur.y&&(this.bbox.ur.y=B.y),J=B)}(W.x!==J.x||W.y!==J.y)&&this.segments.push(V.fromRing(J,W,this))}return e($,[{key:"getSweepEvents",value:function(){for(var b=[],R=0,W=this.segments.length;R<W;R++){var J=this.segments[R];b.push(J.leftSE),b.push(J.rightSE)}return b}}]),$}(),at=function(){function $(N,b){if(r(this,$),!Array.isArray(N))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new K(N[0],this,!0),this.bbox={ll:{x:this.exteriorRing.bbox.ll.x,y:this.exteriorRing.bbox.ll.y},ur:{x:this.exteriorRing.bbox.ur.x,y:this.exteriorRing.bbox.ur.y}},this.interiorRings=[];for(var R=1,W=N.length;R<W;R++){var J=new K(N[R],this,!1);J.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=J.bbox.ll.x),J.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=J.bbox.ll.y),J.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=J.bbox.ur.x),J.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=J.bbox.ur.y),this.interiorRings.push(J)}this.multiPoly=b}return e($,[{key:"getSweepEvents",value:function(){for(var b=this.exteriorRing.getSweepEvents(),R=0,W=this.interiorRings.length;R<W;R++)for(var J=this.interiorRings[R].getSweepEvents(),I=0,P=J.length;I<P;I++)b.push(J[I]);return b}}]),$}(),Tt=function(){function $(N,b){if(r(this,$),!Array.isArray(N))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{typeof N[0][0][0]=="number"&&(N=[N])}catch(I){}this.polys=[],this.bbox={ll:{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY},ur:{x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY}};for(var R=0,W=N.length;R<W;R++){var J=new at(N[R],this);J.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=J.bbox.ll.x),J.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=J.bbox.ll.y),J.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=J.bbox.ur.x),J.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=J.bbox.ur.y),this.polys.push(J)}this.isSubject=b}return e($,[{key:"getSweepEvents",value:function(){for(var b=[],R=0,W=this.polys.length;R<W;R++)for(var J=this.polys[R].getSweepEvents(),I=0,P=J.length;I<P;I++)b.push(J[I]);return b}}]),$}(),dt=function(){e($,null,[{key:"factory",value:function(b){for(var R=[],W=0,J=b.length;W<J;W++){var I=b[W];if(!(!I.isInResult()||I.ringOut)){for(var P=null,B=I.leftSE,lt=I.rightSE,ct=[B],Q=B.point,St=[];P=B,B=lt,ct.push(B),B.point!==Q;)for(;;){var _t=B.getAvailableLinkedEvents();if(_t.length===0){var Mt=ct[0].point,Lt=ct[ct.length-1].point;throw new Error("Unable to complete output ring starting at [".concat(Mt.x,",")+" ".concat(Mt.y,"]. Last matching segment found ends at")+" [".concat(Lt.x,", ").concat(Lt.y,"]."))}if(_t.length===1){lt=_t[0].otherSE;break}for(var Jt=null,Et=0,oe=St.length;Et<oe;Et++)if(St[Et].point===B.point){Jt=Et;break}if(Jt!==null){var jt=St.splice(Jt)[0],Ht=ct.splice(jt.index);Ht.unshift(Ht[0].otherSE),R.push(new $(Ht.reverse()));continue}St.push({index:ct.length,point:B.point});var Ot=B.getLeftmostComparator(P);lt=_t.sort(Ot)[0].otherSE;break}R.push(new $(ct))}}return R}}]);function $(N){r(this,$),this.events=N;for(var b=0,R=N.length;b<R;b++)N[b].segment.ringOut=this;this.poly=null}return e($,[{key:"getGeom",value:function(){for(var b=this.events[0].point,R=[b],W=1,J=this.events.length-1;W<J;W++){var I=this.events[W].point,P=this.events[W+1].point;nt(I,b,P)!==0&&(R.push(I),b=I)}if(R.length===1)return null;var B=R[0],lt=R[1];nt(B,b,lt)===0&&R.shift(),R.push(R[0]);for(var ct=this.isExteriorRing()?1:-1,Q=this.isExteriorRing()?0:R.length-1,St=this.isExteriorRing()?R.length:-1,_t=[],Mt=Q;Mt!=St;Mt+=ct)_t.push([R[Mt].x,R[Mt].y]);return _t}},{key:"isExteriorRing",value:function(){if(this._isExteriorRing===void 0){var b=this.enclosingRing();this._isExteriorRing=b?!b.isExteriorRing():!0}return this._isExteriorRing}},{key:"enclosingRing",value:function(){return this._enclosingRing===void 0&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}},{key:"_calcEnclosingRing",value:function(){for(var b=this.events[0],R=1,W=this.events.length;R<W;R++){var J=this.events[R];et.compare(b,J)>0&&(b=J)}for(var I=b.segment.prevInResult(),P=I?I.prevInResult():null;;){if(!I)return null;if(!P)return I.ringOut;if(P.ringOut!==I.ringOut)return P.ringOut.enclosingRing()!==I.ringOut?I.ringOut:I.ringOut.enclosingRing();I=P.prevInResult(),P=I?I.prevInResult():null}}}]),$}(),Ct=function(){function $(N){r(this,$),this.exteriorRing=N,N.poly=this,this.interiorRings=[]}return e($,[{key:"addInterior",value:function(b){this.interiorRings.push(b),b.poly=this}},{key:"getGeom",value:function(){var b=[this.exteriorRing.getGeom()];if(b[0]===null)return null;for(var R=0,W=this.interiorRings.length;R<W;R++){var J=this.interiorRings[R].getGeom();J!==null&&b.push(J)}return b}}]),$}(),Yt=function(){function $(N){r(this,$),this.rings=N,this.polys=this._composePolys(N)}return e($,[{key:"getGeom",value:function(){for(var b=[],R=0,W=this.polys.length;R<W;R++){var J=this.polys[R].getGeom();J!==null&&b.push(J)}return b}},{key:"_composePolys",value:function(b){for(var R=[],W=0,J=b.length;W<J;W++){var I=b[W];if(!I.poly)if(I.isExteriorRing())R.push(new Ct(I));else{var P=I.enclosingRing();P.poly||R.push(new Ct(P)),P.poly.addInterior(I)}}return R}}]),$}(),Wt=function(){function $(N){var b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:V.compare;r(this,$),this.queue=N,this.tree=new g(b),this.segments=[]}return e($,[{key:"process",value:function(b){var R=b.segment,W=[];if(b.consumedBy)return b.isLeft?this.queue.remove(b.otherSE):this.tree.remove(R),W;var J=b.isLeft?this.tree.insert(R):this.tree.find(R);if(!J)throw new Error("Unable to find segment #".concat(R.id," ")+"[".concat(R.leftSE.point.x,", ").concat(R.leftSE.point.y,"] -> ")+"[".concat(R.rightSE.point.x,", ").concat(R.rightSE.point.y,"] ")+"in SweepLine tree. Please submit a bug report.");for(var I=J,P=J,B=void 0,lt=void 0;B===void 0;)I=this.tree.prev(I),I===null?B=null:I.key.consumedBy===void 0&&(B=I.key);for(;lt===void 0;)P=this.tree.next(P),P===null?lt=null:P.key.consumedBy===void 0&&(lt=P.key);if(b.isLeft){var ct=null;if(B){var Q=B.getIntersection(R);if(Q!==null&&(R.isAnEndpoint(Q)||(ct=Q),!B.isAnEndpoint(Q)))for(var St=this._splitSafely(B,Q),_t=0,Mt=St.length;_t<Mt;_t++)W.push(St[_t])}var Lt=null;if(lt){var Jt=lt.getIntersection(R);if(Jt!==null&&(R.isAnEndpoint(Jt)||(Lt=Jt),!lt.isAnEndpoint(Jt)))for(var Et=this._splitSafely(lt,Jt),oe=0,jt=Et.length;oe<jt;oe++)W.push(Et[oe])}if(ct!==null||Lt!==null){var Ht=null;if(ct===null)Ht=Lt;else if(Lt===null)Ht=ct;else{var Ot=et.comparePoints(ct,Lt);Ht=Ot<=0?ct:Lt}this.queue.remove(R.rightSE),W.push(R.rightSE);for(var Y=R.split(Ht),wt=0,j=Y.length;wt<j;wt++)W.push(Y[wt])}W.length>0?(this.tree.remove(R),W.push(b)):(this.segments.push(R),R.prev=B)}else{if(B&&lt){var Ut=B.getIntersection(lt);if(Ut!==null){if(!B.isAnEndpoint(Ut))for(var Dt=this._splitSafely(B,Ut),ft=0,$t=Dt.length;ft<$t;ft++)W.push(Dt[ft]);if(!lt.isAnEndpoint(Ut))for(var re=this._splitSafely(lt,Ut),mn=0,He=re.length;mn<He;mn++)W.push(re[mn])}}this.tree.remove(R)}return W}},{key:"_splitSafely",value:function(b,R){this.tree.remove(b);var W=b.rightSE;this.queue.remove(W);var J=b.split(R);return J.push(W),b.consumedBy===void 0&&this.tree.insert(b),J}}]),$}(),Nt=typeof process!="undefined"&&process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,ne=typeof process!="undefined"&&process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6,Pt=function(){function $(){r(this,$)}return e($,[{key:"run",value:function(b,R,W){Xt.type=b,L.reset();for(var J=[new Tt(R,!0)],I=0,P=W.length;I<P;I++)J.push(new Tt(W[I],!1));if(Xt.numMultiPolys=J.length,Xt.type==="difference")for(var B=J[0],lt=1;lt<J.length;)C(J[lt].bbox,B.bbox)!==null?lt++:J.splice(lt,1);if(Xt.type==="intersection"){for(var ct=0,Q=J.length;ct<Q;ct++)for(var St=J[ct],_t=ct+1,Mt=J.length;_t<Mt;_t++)if(C(St.bbox,J[_t].bbox)===null)return[]}for(var Lt=new g(et.compare),Jt=0,Et=J.length;Jt<Et;Jt++)for(var oe=J[Jt].getSweepEvents(),jt=0,Ht=oe.length;jt<Ht;jt++)if(Lt.insert(oe[jt]),Lt.size>Nt)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big). Please file a bug report.");for(var Ot=new Wt(Lt),Y=Lt.size,wt=Lt.pop();wt;){var j=wt.key;if(Lt.size===Y){var Ut=j.segment;throw new Error("Unable to pop() ".concat(j.isLeft?"left":"right"," SweepEvent ")+"[".concat(j.point.x,", ").concat(j.point.y,"] from segment #").concat(Ut.id," ")+"[".concat(Ut.leftSE.point.x,", ").concat(Ut.leftSE.point.y,"] -> ")+"[".concat(Ut.rightSE.point.x,", ").concat(Ut.rightSE.point.y,"] from queue. ")+"Please file a bug report.")}if(Lt.size>Nt)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big). Please file a bug report.");if(Ot.segments.length>ne)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");for(var Dt=Ot.process(j),ft=0,$t=Dt.length;ft<$t;ft++){var re=Dt[ft];re.consumedBy===void 0&&Lt.insert(re)}Y=Lt.size,wt=Lt.pop()}L.reset();var mn=dt.factory(Ot.segments),He=new Yt(mn);return He.getGeom()}}]),$}(),Xt=new Pt,tt=function(N){for(var b=arguments.length,R=new Array(b>1?b-1:0),W=1;W<b;W++)R[W-1]=arguments[W];return Xt.run("union",N,R)},nn=function(N){for(var b=arguments.length,R=new Array(b>1?b-1:0),W=1;W<b;W++)R[W-1]=arguments[W];return Xt.run("intersection",N,R)},Gt=function(N){for(var b=arguments.length,R=new Array(b>1?b-1:0),W=1;W<b;W++)R[W-1]=arguments[W];return Xt.run("xor",N,R)},te=function(N){for(var b=arguments.length,R=new Array(b>1?b-1:0),W=1;W<b;W++)R[W-1]=arguments[W];return Xt.run("difference",N,R)},qt={union:tt,intersection:nn,xor:Gt,difference:te};return qt})});var H_=Kt((of,V_)=>{(function(r,t){typeof of=="object"&&typeof V_!="undefined"?t(of):typeof define=="function"&&define.amd?define(["exports"],t):t(r.jsts={})})(of,function(r){"use strict";function t(){}function e(n){this.message=n||""}function o(n){this.message=n||""}function a(n){this.message=n||""}function l(){}function f(n){return n===null?hi:n.color}function h(n){return n===null?null:n.parent}function p(n,i){n!==null&&(n.color=i)}function d(n){return n===null?null:n.left}function g(n){return n===null?null:n.right}function _(){this.root_=null,this.size_=0}function y(){}function M(){this.array_=[],arguments[0]instanceof Ot&&this.addAll(arguments[0])}function w(){}function T(n){this.message=n||""}function x(){this.array_=[]}"fill"in Array.prototype||Object.defineProperty(Array.prototype,"fill",{configurable:!0,value:function(n){if(this===void 0||this===null)throw new TypeError(this+" is not an object");var i=Object(this),s=Math.max(Math.min(i.length,9007199254740991),0)||0,u=1 in arguments&&parseInt(Number(arguments[1]),10)||0;u=u<0?Math.max(s+u,0):Math.min(u,s);var c=2 in arguments&&arguments[2]!==void 0?parseInt(Number(arguments[2]),10)||0:s;for(c=c<0?Math.max(s+arguments[2],0):Math.min(c,s);u<c;)i[u]=n,++u;return i},writable:!0}),Number.isFinite=Number.isFinite||function(n){return typeof n=="number"&&isFinite(n)},Number.isInteger=Number.isInteger||function(n){return typeof n=="number"&&isFinite(n)&&Math.floor(n)===n},Number.parseFloat=Number.parseFloat||parseFloat,Number.isNaN=Number.isNaN||function(n){return n!=n},Math.trunc=Math.trunc||function(n){return n<0?Math.ceil(n):Math.floor(n)};var v=function(){};v.prototype.interfaces_=function(){return[]},v.prototype.getClass=function(){return v},v.prototype.equalsWithTolerance=function(n,i,s){return Math.abs(n-i)<=s};var C=function(n){function i(s){n.call(this,s),this.name="IllegalArgumentException",this.message=s,this.stack=new n().stack}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i}(Error),S=function(){},O={MAX_VALUE:{configurable:!0}};S.isNaN=function(n){return Number.isNaN(n)},S.doubleToLongBits=function(n){return n},S.longBitsToDouble=function(n){return n},S.isInfinite=function(n){return!Number.isFinite(n)},O.MAX_VALUE.get=function(){return Number.MAX_VALUE},Object.defineProperties(S,O);var F=function(){},G=function(){},z=function(){},L=function n(){if(this.x=null,this.y=null,this.z=null,arguments.length===0)this.x=0,this.y=0,this.z=n.NULL_ORDINATE;else if(arguments.length===1){var i=arguments[0];this.x=i.x,this.y=i.y,this.z=i.z}else arguments.length===2?(this.x=arguments[0],this.y=arguments[1],this.z=n.NULL_ORDINATE):arguments.length===3&&(this.x=arguments[0],this.y=arguments[1],this.z=arguments[2])},D={DimensionalComparator:{configurable:!0},serialVersionUID:{configurable:!0},NULL_ORDINATE:{configurable:!0},X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0}};L.prototype.setOrdinate=function(n,i){switch(n){case L.X:this.x=i;break;case L.Y:this.y=i;break;case L.Z:this.z=i;break;default:throw new C("Invalid ordinate index: "+n)}},L.prototype.equals2D=function(){if(arguments.length===1){var n=arguments[0];return this.x===n.x&&this.y===n.y}if(arguments.length===2){var i=arguments[0],s=arguments[1];return!!v.equalsWithTolerance(this.x,i.x,s)&&!!v.equalsWithTolerance(this.y,i.y,s)}},L.prototype.getOrdinate=function(n){switch(n){case L.X:return this.x;case L.Y:return this.y;case L.Z:return this.z}throw new C("Invalid ordinate index: "+n)},L.prototype.equals3D=function(n){return this.x===n.x&&this.y===n.y&&(this.z===n.z||S.isNaN(this.z))&&S.isNaN(n.z)},L.prototype.equals=function(n){return n instanceof L&&this.equals2D(n)},L.prototype.equalInZ=function(n,i){return v.equalsWithTolerance(this.z,n.z,i)},L.prototype.compareTo=function(n){var i=n;return this.x<i.x?-1:this.x>i.x?1:this.y<i.y?-1:this.y>i.y?1:0},L.prototype.clone=function(){},L.prototype.copy=function(){return new L(this)},L.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},L.prototype.distance3D=function(n){var i=this.x-n.x,s=this.y-n.y,u=this.z-n.z;return Math.sqrt(i*i+s*s+u*u)},L.prototype.distance=function(n){var i=this.x-n.x,s=this.y-n.y;return Math.sqrt(i*i+s*s)},L.prototype.hashCode=function(){var n=17;return n=37*n+L.hashCode(this.x),n=37*n+L.hashCode(this.y)},L.prototype.setCoordinate=function(n){this.x=n.x,this.y=n.y,this.z=n.z},L.prototype.interfaces_=function(){return[F,G,t]},L.prototype.getClass=function(){return L},L.hashCode=function(){if(arguments.length===1){var n=arguments[0],i=S.doubleToLongBits(n);return Math.trunc((i^i)>>>32)}},D.DimensionalComparator.get=function(){return q},D.serialVersionUID.get=function(){return 6683108902428367e3},D.NULL_ORDINATE.get=function(){return S.NaN},D.X.get=function(){return 0},D.Y.get=function(){return 1},D.Z.get=function(){return 2},Object.defineProperties(L,D);var q=function(n){if(this._dimensionsToTest=2,arguments.length!==0){if(arguments.length===1){var i=arguments[0];if(i!==2&&i!==3)throw new C("only 2 or 3 dimensions may be specified");this._dimensionsToTest=i}}};q.prototype.compare=function(n,i){var s=n,u=i,c=q.compare(s.x,u.x);if(c!==0)return c;var m=q.compare(s.y,u.y);return m!==0?m:this._dimensionsToTest<=2?0:q.compare(s.z,u.z)},q.prototype.interfaces_=function(){return[z]},q.prototype.getClass=function(){return q},q.compare=function(n,i){return n<i?-1:n>i?1:S.isNaN(n)?S.isNaN(i)?0:-1:S.isNaN(i)?1:0};var nt=function(){};nt.prototype.create=function(){},nt.prototype.interfaces_=function(){return[]},nt.prototype.getClass=function(){return nt};var k=function(){},xt={INTERIOR:{configurable:!0},BOUNDARY:{configurable:!0},EXTERIOR:{configurable:!0},NONE:{configurable:!0}};k.prototype.interfaces_=function(){return[]},k.prototype.getClass=function(){return k},k.toLocationSymbol=function(n){switch(n){case k.EXTERIOR:return"e";case k.BOUNDARY:return"b";case k.INTERIOR:return"i";case k.NONE:return"-"}throw new C("Unknown location value: "+n)},xt.INTERIOR.get=function(){return 0},xt.BOUNDARY.get=function(){return 1},xt.EXTERIOR.get=function(){return 2},xt.NONE.get=function(){return-1},Object.defineProperties(k,xt);var X=function(n,i){return n.interfaces_&&n.interfaces_().indexOf(i)>-1},it=function(){},vt={LOG_10:{configurable:!0}};it.prototype.interfaces_=function(){return[]},it.prototype.getClass=function(){return it},it.log10=function(n){var i=Math.log(n);return S.isInfinite(i)||S.isNaN(i)?i:i/it.LOG_10},it.min=function(n,i,s,u){var c=n;return i<c&&(c=i),s<c&&(c=s),u<c&&(c=u),c},it.clamp=function(){if(typeof arguments[2]=="number"&&typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var n=arguments[0],i=arguments[1],s=arguments[2];return n<i?i:n>s?s:n}if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var u=arguments[0],c=arguments[1],m=arguments[2];return u<c?c:u>m?m:u}},it.wrap=function(n,i){return n<0?i- -n%i:n%i},it.max=function(){if(arguments.length===3){var n=arguments[0],i=arguments[1],s=arguments[2],u=n;return i>u&&(u=i),s>u&&(u=s),u}if(arguments.length===4){var c=arguments[0],m=arguments[1],E=arguments[2],A=arguments[3],U=c;return m>U&&(U=m),E>U&&(U=E),A>U&&(U=A),U}},it.average=function(n,i){return(n+i)/2},vt.LOG_10.get=function(){return Math.log(10)},Object.defineProperties(it,vt);var pt=function(n){this.str=n};pt.prototype.append=function(n){this.str+=n},pt.prototype.setCharAt=function(n,i){this.str=this.str.substr(0,n)+i+this.str.substr(n+1)},pt.prototype.toString=function(n){return this.str};var et=function(n){this.value=n};et.prototype.intValue=function(){return this.value},et.prototype.compareTo=function(n){return this.value<n?-1:this.value>n?1:0},et.isNaN=function(n){return Number.isNaN(n)};var ot=function(){};ot.isWhitespace=function(n){return n<=32&&n>=0||n===127},ot.toUpperCase=function(n){return n.toUpperCase()};var V=function n(){if(this._hi=0,this._lo=0,arguments.length===0)this.init(0);else if(arguments.length===1){if(typeof arguments[0]=="number"){var i=arguments[0];this.init(i)}else if(arguments[0]instanceof n){var s=arguments[0];this.init(s)}else if(typeof arguments[0]=="string"){var u=arguments[0];n.call(this,n.parse(u))}}else if(arguments.length===2){var c=arguments[0],m=arguments[1];this.init(c,m)}},K={PI:{configurable:!0},TWO_PI:{configurable:!0},PI_2:{configurable:!0},E:{configurable:!0},NaN:{configurable:!0},EPS:{configurable:!0},SPLIT:{configurable:!0},MAX_PRINT_DIGITS:{configurable:!0},TEN:{configurable:!0},ONE:{configurable:!0},SCI_NOT_EXPONENT_CHAR:{configurable:!0},SCI_NOT_ZERO:{configurable:!0}};V.prototype.le=function(n){return(this._hi<n._hi||this._hi===n._hi)&&this._lo<=n._lo},V.prototype.extractSignificantDigits=function(n,i){var s=this.abs(),u=V.magnitude(s._hi),c=V.TEN.pow(u);(s=s.divide(c)).gt(V.TEN)?(s=s.divide(V.TEN),u+=1):s.lt(V.ONE)&&(s=s.multiply(V.TEN),u-=1);for(var m=u+1,E=new pt,A=V.MAX_PRINT_DIGITS-1,U=0;U<=A;U++){n&&U===m&&E.append(".");var Z=Math.trunc(s._hi);if(Z<0)break;var ut=!1,ht=0;Z>9?(ut=!0,ht="9"):ht="0"+Z,E.append(ht),s=s.subtract(V.valueOf(Z)).multiply(V.TEN),ut&&s.selfAdd(V.TEN);var At=!0,Rt=V.magnitude(s._hi);if(Rt<0&&Math.abs(Rt)>=A-U&&(At=!1),!At)break}return i[0]=u,E.toString()},V.prototype.sqr=function(){return this.multiply(this)},V.prototype.doubleValue=function(){return this._hi+this._lo},V.prototype.subtract=function(){if(arguments[0]instanceof V){var n=arguments[0];return this.add(n.negate())}if(typeof arguments[0]=="number"){var i=arguments[0];return this.add(-i)}},V.prototype.equals=function(){if(arguments.length===1){var n=arguments[0];return this._hi===n._hi&&this._lo===n._lo}},V.prototype.isZero=function(){return this._hi===0&&this._lo===0},V.prototype.selfSubtract=function(){if(arguments[0]instanceof V){var n=arguments[0];return this.isNaN()?this:this.selfAdd(-n._hi,-n._lo)}if(typeof arguments[0]=="number"){var i=arguments[0];return this.isNaN()?this:this.selfAdd(-i,0)}},V.prototype.getSpecialNumberString=function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null},V.prototype.min=function(n){return this.le(n)?this:n},V.prototype.selfDivide=function(){if(arguments.length===1){if(arguments[0]instanceof V){var n=arguments[0];return this.selfDivide(n._hi,n._lo)}if(typeof arguments[0]=="number"){var i=arguments[0];return this.selfDivide(i,0)}}else if(arguments.length===2){var s=arguments[0],u=arguments[1],c=null,m=null,E=null,A=null,U=null,Z=null,ut=null,ht=null;return U=this._hi/s,Z=V.SPLIT*U,c=Z-U,ht=V.SPLIT*s,c=Z-c,m=U-c,E=ht-s,ut=U*s,E=ht-E,A=s-E,ht=c*E-ut+c*A+m*E+m*A,Z=(this._hi-ut-ht+this._lo-U*u)/s,ht=U+Z,this._hi=ht,this._lo=U-ht+Z,this}},V.prototype.dump=function(){return"DD<"+this._hi+", "+this._lo+">"},V.prototype.divide=function(){if(arguments[0]instanceof V){var n=arguments[0],i=null,s=null,u=null,c=null,m=null,E=null,A=null,U=null;return s=(m=this._hi/n._hi)-(i=(E=V.SPLIT*m)-(i=E-m)),U=i*(u=(U=V.SPLIT*n._hi)-(u=U-n._hi))-(A=m*n._hi)+i*(c=n._hi-u)+s*u+s*c,E=(this._hi-A-U+this._lo-m*n._lo)/n._hi,new V(U=m+E,m-U+E)}if(typeof arguments[0]=="number"){var Z=arguments[0];return S.isNaN(Z)?V.createNaN():V.copy(this).selfDivide(Z,0)}},V.prototype.ge=function(n){return(this._hi>n._hi||this._hi===n._hi)&&this._lo>=n._lo},V.prototype.pow=function(n){if(n===0)return V.valueOf(1);var i=new V(this),s=V.valueOf(1),u=Math.abs(n);if(u>1)for(;u>0;)u%2==1&&s.selfMultiply(i),(u/=2)>0&&(i=i.sqr());else s=i;return n<0?s.reciprocal():s},V.prototype.ceil=function(){if(this.isNaN())return V.NaN;var n=Math.ceil(this._hi),i=0;return n===this._hi&&(i=Math.ceil(this._lo)),new V(n,i)},V.prototype.compareTo=function(n){var i=n;return this._hi<i._hi?-1:this._hi>i._hi?1:this._lo<i._lo?-1:this._lo>i._lo?1:0},V.prototype.rint=function(){return this.isNaN()?this:this.add(.5).floor()},V.prototype.setValue=function(){if(arguments[0]instanceof V){var n=arguments[0];return this.init(n),this}if(typeof arguments[0]=="number"){var i=arguments[0];return this.init(i),this}},V.prototype.max=function(n){return this.ge(n)?this:n},V.prototype.sqrt=function(){if(this.isZero())return V.valueOf(0);if(this.isNegative())return V.NaN;var n=1/Math.sqrt(this._hi),i=this._hi*n,s=V.valueOf(i),u=this.subtract(s.sqr())._hi*(.5*n);return s.add(u)},V.prototype.selfAdd=function(){if(arguments.length===1){if(arguments[0]instanceof V){var n=arguments[0];return this.selfAdd(n._hi,n._lo)}if(typeof arguments[0]=="number"){var i=arguments[0],s=null,u=null,c=null,m=null,E=null,A=null;return c=this._hi+i,E=c-this._hi,m=c-E,m=i-E+(this._hi-m),A=m+this._lo,s=c+A,u=A+(c-s),this._hi=s+u,this._lo=u+(s-this._hi),this}}else if(arguments.length===2){var U=arguments[0],Z=arguments[1],ut=null,ht=null,At=null,Rt=null,kt=null,ee=null,on=null;Rt=this._hi+U,ht=this._lo+Z,kt=Rt-(ee=Rt-this._hi),At=ht-(on=ht-this._lo);var In=(ut=Rt+(ee=(kt=U-ee+(this._hi-kt))+ht))+(ee=(At=Z-on+(this._lo-At))+(ee+(Rt-ut))),pr=ee+(ut-In);return this._hi=In,this._lo=pr,this}},V.prototype.selfMultiply=function(){if(arguments.length===1){if(arguments[0]instanceof V){var n=arguments[0];return this.selfMultiply(n._hi,n._lo)}if(typeof arguments[0]=="number"){var i=arguments[0];return this.selfMultiply(i,0)}}else if(arguments.length===2){var s=arguments[0],u=arguments[1],c=null,m=null,E=null,A=null,U=null,Z=null;c=(U=V.SPLIT*this._hi)-this._hi,Z=V.SPLIT*s,c=U-c,m=this._hi-c,E=Z-s;var ut=(U=this._hi*s)+(Z=c*(E=Z-E)-U+c*(A=s-E)+m*E+m*A+(this._hi*u+this._lo*s)),ht=Z+(c=U-ut);return this._hi=ut,this._lo=ht,this}},V.prototype.selfSqr=function(){return this.selfMultiply(this)},V.prototype.floor=function(){if(this.isNaN())return V.NaN;var n=Math.floor(this._hi),i=0;return n===this._hi&&(i=Math.floor(this._lo)),new V(n,i)},V.prototype.negate=function(){return this.isNaN()?this:new V(-this._hi,-this._lo)},V.prototype.clone=function(){},V.prototype.multiply=function(){if(arguments[0]instanceof V){var n=arguments[0];return n.isNaN()?V.createNaN():V.copy(this).selfMultiply(n)}if(typeof arguments[0]=="number"){var i=arguments[0];return S.isNaN(i)?V.createNaN():V.copy(this).selfMultiply(i,0)}},V.prototype.isNaN=function(){return S.isNaN(this._hi)},V.prototype.intValue=function(){return Math.trunc(this._hi)},V.prototype.toString=function(){var n=V.magnitude(this._hi);return n>=-3&&n<=20?this.toStandardNotation():this.toSciNotation()},V.prototype.toStandardNotation=function(){var n=this.getSpecialNumberString();if(n!==null)return n;var i=new Array(1).fill(null),s=this.extractSignificantDigits(!0,i),u=i[0]+1,c=s;if(s.charAt(0)===".")c="0"+s;else if(u<0)c="0."+V.stringOfChar("0",-u)+s;else if(s.indexOf(".")===-1){var m=u-s.length;c=s+V.stringOfChar("0",m)+".0"}return this.isNegative()?"-"+c:c},V.prototype.reciprocal=function(){var n=null,i=null,s=null,u=null,c=null,m=null,E=null,A=null;i=(c=1/this._hi)-(n=(m=V.SPLIT*c)-(n=m-c)),s=(A=V.SPLIT*this._hi)-this._hi;var U=c+(m=(1-(E=c*this._hi)-(A=n*(s=A-s)-E+n*(u=this._hi-s)+i*s+i*u)-c*this._lo)/this._hi);return new V(U,c-U+m)},V.prototype.toSciNotation=function(){if(this.isZero())return V.SCI_NOT_ZERO;var n=this.getSpecialNumberString();if(n!==null)return n;var i=new Array(1).fill(null),s=this.extractSignificantDigits(!1,i),u=V.SCI_NOT_EXPONENT_CHAR+i[0];if(s.charAt(0)==="0")throw new Error("Found leading zero: "+s);var c="";s.length>1&&(c=s.substring(1));var m=s.charAt(0)+"."+c;return this.isNegative()?"-"+m+u:m+u},V.prototype.abs=function(){return this.isNaN()?V.NaN:this.isNegative()?this.negate():new V(this)},V.prototype.isPositive=function(){return(this._hi>0||this._hi===0)&&this._lo>0},V.prototype.lt=function(n){return(this._hi<n._hi||this._hi===n._hi)&&this._lo<n._lo},V.prototype.add=function(){if(arguments[0]instanceof V){var n=arguments[0];return V.copy(this).selfAdd(n)}if(typeof arguments[0]=="number"){var i=arguments[0];return V.copy(this).selfAdd(i)}},V.prototype.init=function(){if(arguments.length===1){if(typeof arguments[0]=="number"){var n=arguments[0];this._hi=n,this._lo=0}else if(arguments[0]instanceof V){var i=arguments[0];this._hi=i._hi,this._lo=i._lo}}else if(arguments.length===2){var s=arguments[0],u=arguments[1];this._hi=s,this._lo=u}},V.prototype.gt=function(n){return(this._hi>n._hi||this._hi===n._hi)&&this._lo>n._lo},V.prototype.isNegative=function(){return(this._hi<0||this._hi===0)&&this._lo<0},V.prototype.trunc=function(){return this.isNaN()?V.NaN:this.isPositive()?this.floor():this.ceil()},V.prototype.signum=function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0},V.prototype.interfaces_=function(){return[t,F,G]},V.prototype.getClass=function(){return V},V.sqr=function(n){return V.valueOf(n).selfMultiply(n)},V.valueOf=function(){if(typeof arguments[0]=="string"){var n=arguments[0];return V.parse(n)}if(typeof arguments[0]=="number"){var i=arguments[0];return new V(i)}},V.sqrt=function(n){return V.valueOf(n).sqrt()},V.parse=function(n){for(var i=0,s=n.length;ot.isWhitespace(n.charAt(i));)i++;var u=!1;if(i<s){var c=n.charAt(i);c!=="-"&&c!=="+"||(i++,c==="-"&&(u=!0))}for(var m=new V,E=0,A=0,U=0;!(i>=s);){var Z=n.charAt(i);if(i++,ot.isDigit(Z)){var ut=Z-"0";m.selfMultiply(V.TEN),m.selfAdd(ut),E++}else{if(Z!=="."){if(Z==="e"||Z==="E"){var ht=n.substring(i);try{U=et.parseInt(ht)}catch(on){throw on instanceof Error?new Error("Invalid exponent "+ht+" in string "+n):on}break}throw new Error("Unexpected character '"+Z+"' at position "+i+" in string "+n)}A=E}}var At=m,Rt=E-A-U;if(Rt===0)At=m;else if(Rt>0){var kt=V.TEN.pow(Rt);At=m.divide(kt)}else if(Rt<0){var ee=V.TEN.pow(-Rt);At=m.multiply(ee)}return u?At.negate():At},V.createNaN=function(){return new V(S.NaN,S.NaN)},V.copy=function(n){return new V(n)},V.magnitude=function(n){var i=Math.abs(n),s=Math.log(i)/Math.log(10),u=Math.trunc(Math.floor(s));return 10*Math.pow(10,u)<=i&&(u+=1),u},V.stringOfChar=function(n,i){for(var s=new pt,u=0;u<i;u++)s.append(n);return s.toString()},K.PI.get=function(){return new V(3.141592653589793,12246467991473532e-32)},K.TWO_PI.get=function(){return new V(6.283185307179586,24492935982947064e-32)},K.PI_2.get=function(){return new V(1.5707963267948966,6123233995736766e-32)},K.E.get=function(){return new V(2.718281828459045,14456468917292502e-32)},K.NaN.get=function(){return new V(S.NaN,S.NaN)},K.EPS.get=function(){return 123259516440783e-46},K.SPLIT.get=function(){return 134217729},K.MAX_PRINT_DIGITS.get=function(){return 32},K.TEN.get=function(){return V.valueOf(10)},K.ONE.get=function(){return V.valueOf(1)},K.SCI_NOT_EXPONENT_CHAR.get=function(){return"E"},K.SCI_NOT_ZERO.get=function(){return"0.0E0"},Object.defineProperties(V,K);var at=function(){},Tt={DP_SAFE_EPSILON:{configurable:!0}};at.prototype.interfaces_=function(){return[]},at.prototype.getClass=function(){return at},at.orientationIndex=function(n,i,s){var u=at.orientationIndexFilter(n,i,s);if(u<=1)return u;var c=V.valueOf(i.x).selfAdd(-n.x),m=V.valueOf(i.y).selfAdd(-n.y),E=V.valueOf(s.x).selfAdd(-i.x),A=V.valueOf(s.y).selfAdd(-i.y);return c.selfMultiply(A).selfSubtract(m.selfMultiply(E)).signum()},at.signOfDet2x2=function(n,i,s,u){return n.multiply(u).selfSubtract(i.multiply(s)).signum()},at.intersection=function(n,i,s,u){var c=V.valueOf(u.y).selfSubtract(s.y).selfMultiply(V.valueOf(i.x).selfSubtract(n.x)),m=V.valueOf(u.x).selfSubtract(s.x).selfMultiply(V.valueOf(i.y).selfSubtract(n.y)),E=c.subtract(m),A=V.valueOf(u.x).selfSubtract(s.x).selfMultiply(V.valueOf(n.y).selfSubtract(s.y)),U=V.valueOf(u.y).selfSubtract(s.y).selfMultiply(V.valueOf(n.x).selfSubtract(s.x)),Z=A.subtract(U).selfDivide(E).doubleValue(),ut=V.valueOf(n.x).selfAdd(V.valueOf(i.x).selfSubtract(n.x).selfMultiply(Z)).doubleValue(),ht=V.valueOf(i.x).selfSubtract(n.x).selfMultiply(V.valueOf(n.y).selfSubtract(s.y)),At=V.valueOf(i.y).selfSubtract(n.y).selfMultiply(V.valueOf(n.x).selfSubtract(s.x)),Rt=ht.subtract(At).selfDivide(E).doubleValue(),kt=V.valueOf(s.y).selfAdd(V.valueOf(u.y).selfSubtract(s.y).selfMultiply(Rt)).doubleValue();return new L(ut,kt)},at.orientationIndexFilter=function(n,i,s){var u=null,c=(n.x-s.x)*(i.y-s.y),m=(n.y-s.y)*(i.x-s.x),E=c-m;if(c>0){if(m<=0)return at.signum(E);u=c+m}else{if(!(c<0)||m>=0)return at.signum(E);u=-c-m}var A=at.DP_SAFE_EPSILON*u;return E>=A||-E>=A?at.signum(E):2},at.signum=function(n){return n>0?1:n<0?-1:0},Tt.DP_SAFE_EPSILON.get=function(){return 1e-15},Object.defineProperties(at,Tt);var dt=function(){},Ct={X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0},M:{configurable:!0}};Ct.X.get=function(){return 0},Ct.Y.get=function(){return 1},Ct.Z.get=function(){return 2},Ct.M.get=function(){return 3},dt.prototype.setOrdinate=function(n,i,s){},dt.prototype.size=function(){},dt.prototype.getOrdinate=function(n,i){},dt.prototype.getCoordinate=function(){},dt.prototype.getCoordinateCopy=function(n){},dt.prototype.getDimension=function(){},dt.prototype.getX=function(n){},dt.prototype.clone=function(){},dt.prototype.expandEnvelope=function(n){},dt.prototype.copy=function(){},dt.prototype.getY=function(n){},dt.prototype.toCoordinateArray=function(){},dt.prototype.interfaces_=function(){return[G]},dt.prototype.getClass=function(){return dt},Object.defineProperties(dt,Ct);var Yt=function(){},Wt=function(n){function i(){n.call(this,"Projective point not representable on the Cartesian plane.")}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(Yt),Nt=function(){};Nt.arraycopy=function(n,i,s,u,c){for(var m=0,E=i;E<i+c;E++)s[u+m]=n[E],m++},Nt.getProperty=function(n){return{"line.separator":\`
40
40
  \`}[n]};var ne=function n(){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 i=arguments[0];this.x=i.x,this.y=i.y,this.w=1}else if(arguments.length===2){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var s=arguments[0],u=arguments[1];this.x=s,this.y=u,this.w=1}else if(arguments[0]instanceof n&&arguments[1]instanceof n){var c=arguments[0],m=arguments[1];this.x=c.y*m.w-m.y*c.w,this.y=m.x*c.w-c.x*m.w,this.w=c.x*m.y-m.x*c.y}else if(arguments[0]instanceof L&&arguments[1]instanceof L){var E=arguments[0],A=arguments[1];this.x=E.y-A.y,this.y=A.x-E.x,this.w=E.x*A.y-A.x*E.y}}else if(arguments.length===3){var U=arguments[0],Z=arguments[1],ut=arguments[2];this.x=U,this.y=Z,this.w=ut}else if(arguments.length===4){var ht=arguments[0],At=arguments[1],Rt=arguments[2],kt=arguments[3],ee=ht.y-At.y,on=At.x-ht.x,In=ht.x*At.y-At.x*ht.y,pr=Rt.y-kt.y,Xi=kt.x-Rt.x,Lo=Rt.x*kt.y-kt.x*Rt.y;this.x=on*Lo-Xi*In,this.y=pr*In-ee*Lo,this.w=ee*Xi-pr*on}};ne.prototype.getY=function(){var n=this.y/this.w;if(S.isNaN(n)||S.isInfinite(n))throw new Wt;return n},ne.prototype.getX=function(){var n=this.x/this.w;if(S.isNaN(n)||S.isInfinite(n))throw new Wt;return n},ne.prototype.getCoordinate=function(){var n=new L;return n.x=this.getX(),n.y=this.getY(),n},ne.prototype.interfaces_=function(){return[]},ne.prototype.getClass=function(){return ne},ne.intersection=function(n,i,s,u){var c=n.y-i.y,m=i.x-n.x,E=n.x*i.y-i.x*n.y,A=s.y-u.y,U=u.x-s.x,Z=s.x*u.y-u.x*s.y,ut=c*U-A*m,ht=(m*Z-U*E)/ut,At=(A*E-c*Z)/ut;if(S.isNaN(ht)||S.isInfinite(ht)||S.isNaN(At)||S.isInfinite(At))throw new Wt;return new L(ht,At)};var Pt=function n(){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 L){var i=arguments[0];this.init(i.x,i.x,i.y,i.y)}else if(arguments[0]instanceof n){var s=arguments[0];this.init(s)}}else if(arguments.length===2){var u=arguments[0],c=arguments[1];this.init(u.x,c.x,u.y,c.y)}else if(arguments.length===4){var m=arguments[0],E=arguments[1],A=arguments[2],U=arguments[3];this.init(m,E,A,U)}},Xt={serialVersionUID:{configurable:!0}};Pt.prototype.getArea=function(){return this.getWidth()*this.getHeight()},Pt.prototype.equals=function(n){if(!(n instanceof Pt))return!1;var i=n;return this.isNull()?i.isNull():this._maxx===i.getMaxX()&&this._maxy===i.getMaxY()&&this._minx===i.getMinX()&&this._miny===i.getMinY()},Pt.prototype.intersection=function(n){if(this.isNull()||n.isNull()||!this.intersects(n))return new Pt;var i=this._minx>n._minx?this._minx:n._minx,s=this._miny>n._miny?this._miny:n._miny,u=this._maxx<n._maxx?this._maxx:n._maxx,c=this._maxy<n._maxy?this._maxy:n._maxy;return new Pt(i,u,s,c)},Pt.prototype.isNull=function(){return this._maxx<this._minx},Pt.prototype.getMaxX=function(){return this._maxx},Pt.prototype.covers=function(){if(arguments.length===1){if(arguments[0]instanceof L){var n=arguments[0];return this.covers(n.x,n.y)}if(arguments[0]instanceof Pt){var i=arguments[0];return!this.isNull()&&!i.isNull()&&i.getMinX()>=this._minx&&i.getMaxX()<=this._maxx&&i.getMinY()>=this._miny&&i.getMaxY()<=this._maxy}}else if(arguments.length===2){var s=arguments[0],u=arguments[1];return!this.isNull()&&s>=this._minx&&s<=this._maxx&&u>=this._miny&&u<=this._maxy}},Pt.prototype.intersects=function(){if(arguments.length===1){if(arguments[0]instanceof Pt){var n=arguments[0];return!this.isNull()&&!n.isNull()&&!(n._minx>this._maxx||n._maxx<this._minx||n._miny>this._maxy||n._maxy<this._miny)}if(arguments[0]instanceof L){var i=arguments[0];return this.intersects(i.x,i.y)}}else if(arguments.length===2){var s=arguments[0],u=arguments[1];return!this.isNull()&&!(s>this._maxx||s<this._minx||u>this._maxy||u<this._miny)}},Pt.prototype.getMinY=function(){return this._miny},Pt.prototype.getMinX=function(){return this._minx},Pt.prototype.expandToInclude=function(){if(arguments.length===1){if(arguments[0]instanceof L){var n=arguments[0];this.expandToInclude(n.x,n.y)}else if(arguments[0]instanceof Pt){var i=arguments[0];if(i.isNull())return null;this.isNull()?(this._minx=i.getMinX(),this._maxx=i.getMaxX(),this._miny=i.getMinY(),this._maxy=i.getMaxY()):(i._minx<this._minx&&(this._minx=i._minx),i._maxx>this._maxx&&(this._maxx=i._maxx),i._miny<this._miny&&(this._miny=i._miny),i._maxy>this._maxy&&(this._maxy=i._maxy))}}else if(arguments.length===2){var s=arguments[0],u=arguments[1];this.isNull()?(this._minx=s,this._maxx=s,this._miny=u,this._maxy=u):(s<this._minx&&(this._minx=s),s>this._maxx&&(this._maxx=s),u<this._miny&&(this._miny=u),u>this._maxy&&(this._maxy=u))}},Pt.prototype.minExtent=function(){if(this.isNull())return 0;var n=this.getWidth(),i=this.getHeight();return n<i?n:i},Pt.prototype.getWidth=function(){return this.isNull()?0:this._maxx-this._minx},Pt.prototype.compareTo=function(n){var i=n;return this.isNull()?i.isNull()?0:-1:i.isNull()?1:this._minx<i._minx?-1:this._minx>i._minx?1:this._miny<i._miny?-1:this._miny>i._miny?1:this._maxx<i._maxx?-1:this._maxx>i._maxx?1:this._maxy<i._maxy?-1:this._maxy>i._maxy?1:0},Pt.prototype.translate=function(n,i){if(this.isNull())return null;this.init(this.getMinX()+n,this.getMaxX()+n,this.getMinY()+i,this.getMaxY()+i)},Pt.prototype.toString=function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"},Pt.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1},Pt.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny},Pt.prototype.maxExtent=function(){if(this.isNull())return 0;var n=this.getWidth(),i=this.getHeight();return n>i?n:i},Pt.prototype.expandBy=function(){if(arguments.length===1){var n=arguments[0];this.expandBy(n,n)}else if(arguments.length===2){var i=arguments[0],s=arguments[1];if(this.isNull())return null;this._minx-=i,this._maxx+=i,this._miny-=s,this._maxy+=s,(this._minx>this._maxx||this._miny>this._maxy)&&this.setToNull()}},Pt.prototype.contains=function(){if(arguments.length===1){if(arguments[0]instanceof Pt){var n=arguments[0];return this.covers(n)}if(arguments[0]instanceof L){var i=arguments[0];return this.covers(i)}}else if(arguments.length===2){var s=arguments[0],u=arguments[1];return this.covers(s,u)}},Pt.prototype.centre=function(){return this.isNull()?null:new L((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)},Pt.prototype.init=function(){if(arguments.length===0)this.setToNull();else if(arguments.length===1){if(arguments[0]instanceof L){var n=arguments[0];this.init(n.x,n.x,n.y,n.y)}else if(arguments[0]instanceof Pt){var i=arguments[0];this._minx=i._minx,this._maxx=i._maxx,this._miny=i._miny,this._maxy=i._maxy}}else if(arguments.length===2){var s=arguments[0],u=arguments[1];this.init(s.x,u.x,s.y,u.y)}else if(arguments.length===4){var c=arguments[0],m=arguments[1],E=arguments[2],A=arguments[3];c<m?(this._minx=c,this._maxx=m):(this._minx=m,this._maxx=c),E<A?(this._miny=E,this._maxy=A):(this._miny=A,this._maxy=E)}},Pt.prototype.getMaxY=function(){return this._maxy},Pt.prototype.distance=function(n){if(this.intersects(n))return 0;var i=0;this._maxx<n._minx?i=n._minx-this._maxx:this._minx>n._maxx&&(i=this._minx-n._maxx);var s=0;return this._maxy<n._miny?s=n._miny-this._maxy:this._miny>n._maxy&&(s=this._miny-n._maxy),i===0?s:s===0?i:Math.sqrt(i*i+s*s)},Pt.prototype.hashCode=function(){var n=17;return n=37*n+L.hashCode(this._minx),n=37*n+L.hashCode(this._maxx),n=37*n+L.hashCode(this._miny),n=37*n+L.hashCode(this._maxy)},Pt.prototype.interfaces_=function(){return[F,t]},Pt.prototype.getClass=function(){return Pt},Pt.intersects=function(){if(arguments.length===3){var n=arguments[0],i=arguments[1],s=arguments[2];return s.x>=(n.x<i.x?n.x:i.x)&&s.x<=(n.x>i.x?n.x:i.x)&&s.y>=(n.y<i.y?n.y:i.y)&&s.y<=(n.y>i.y?n.y:i.y)}if(arguments.length===4){var u=arguments[0],c=arguments[1],m=arguments[2],E=arguments[3],A=Math.min(m.x,E.x),U=Math.max(m.x,E.x),Z=Math.min(u.x,c.x),ut=Math.max(u.x,c.x);return!(Z>U)&&!(ut<A)&&(A=Math.min(m.y,E.y),U=Math.max(m.y,E.y),Z=Math.min(u.y,c.y),ut=Math.max(u.y,c.y),!(Z>U)&&!(ut<A))}},Xt.serialVersionUID.get=function(){return 5873921885273102e3},Object.defineProperties(Pt,Xt);var tt={typeStr:/^\\s*(\\w+)\\s*\\(\\s*(.*)\\s*\\)\\s*$/,emptyTypeStr:/^\\s*(\\w+)\\s*EMPTY\\s*$/,spaces:/\\s+/,parenComma:/\\)\\s*,\\s*\\(/,doubleParenComma:/\\)\\s*\\)\\s*,\\s*\\(\\s*\\(/,trimParens:/^\\s*\\(?(.*?)\\)?\\s*$/},nn=function(n){this.geometryFactory=n||new le};nn.prototype.read=function(n){var i,s,u;n=n.replace(/[\\n\\r]/g," ");var c=tt.typeStr.exec(n);if(n.search("EMPTY")!==-1&&((c=tt.emptyTypeStr.exec(n))[2]=void 0),c&&(s=c[1].toLowerCase(),u=c[2],te[s]&&(i=te[s].apply(this,[u]))),i===void 0)throw new Error("Could not parse WKT "+n);return i},nn.prototype.write=function(n){return this.extractGeometry(n)},nn.prototype.extractGeometry=function(n){var i=n.getGeometryType().toLowerCase();if(!Gt[i])return null;var s=i.toUpperCase();return n.isEmpty()?s+" EMPTY":s+"("+Gt[i].apply(this,[n])+")"};var Gt={coordinate:function(n){return n.x+" "+n.y},point:function(n){return Gt.coordinate.call(this,n._coordinates._coordinates[0])},multipoint:function(n){for(var i=[],s=0,u=n._geometries.length;s<u;++s)i.push("("+Gt.point.apply(this,[n._geometries[s]])+")");return i.join(",")},linestring:function(n){for(var i=[],s=0,u=n._points._coordinates.length;s<u;++s)i.push(Gt.coordinate.apply(this,[n._points._coordinates[s]]));return i.join(",")},linearring:function(n){for(var i=[],s=0,u=n._points._coordinates.length;s<u;++s)i.push(Gt.coordinate.apply(this,[n._points._coordinates[s]]));return i.join(",")},multilinestring:function(n){for(var i=[],s=0,u=n._geometries.length;s<u;++s)i.push("("+Gt.linestring.apply(this,[n._geometries[s]])+")");return i.join(",")},polygon:function(n){var i=[];i.push("("+Gt.linestring.apply(this,[n._shell])+")");for(var s=0,u=n._holes.length;s<u;++s)i.push("("+Gt.linestring.apply(this,[n._holes[s]])+")");return i.join(",")},multipolygon:function(n){for(var i=[],s=0,u=n._geometries.length;s<u;++s)i.push("("+Gt.polygon.apply(this,[n._geometries[s]])+")");return i.join(",")},geometrycollection:function(n){for(var i=[],s=0,u=n._geometries.length;s<u;++s)i.push(this.extractGeometry(n._geometries[s]));return i.join(",")}},te={point:function(n){if(n===void 0)return this.geometryFactory.createPoint();var i=n.trim().split(tt.spaces);return this.geometryFactory.createPoint(new L(Number.parseFloat(i[0]),Number.parseFloat(i[1])))},multipoint:function(n){if(n===void 0)return this.geometryFactory.createMultiPoint();for(var i,s=n.trim().split(","),u=[],c=0,m=s.length;c<m;++c)i=s[c].replace(tt.trimParens,"$1"),u.push(te.point.apply(this,[i]));return this.geometryFactory.createMultiPoint(u)},linestring:function(n){if(n===void 0)return this.geometryFactory.createLineString();for(var i,s=n.trim().split(","),u=[],c=0,m=s.length;c<m;++c)i=s[c].trim().split(tt.spaces),u.push(new L(Number.parseFloat(i[0]),Number.parseFloat(i[1])));return this.geometryFactory.createLineString(u)},linearring:function(n){if(n===void 0)return this.geometryFactory.createLinearRing();for(var i,s=n.trim().split(","),u=[],c=0,m=s.length;c<m;++c)i=s[c].trim().split(tt.spaces),u.push(new L(Number.parseFloat(i[0]),Number.parseFloat(i[1])));return this.geometryFactory.createLinearRing(u)},multilinestring:function(n){if(n===void 0)return this.geometryFactory.createMultiLineString();for(var i,s=n.trim().split(tt.parenComma),u=[],c=0,m=s.length;c<m;++c)i=s[c].replace(tt.trimParens,"$1"),u.push(te.linestring.apply(this,[i]));return this.geometryFactory.createMultiLineString(u)},polygon:function(n){if(n===void 0)return this.geometryFactory.createPolygon();for(var i,s,u,c,m=n.trim().split(tt.parenComma),E=[],A=0,U=m.length;A<U;++A)i=m[A].replace(tt.trimParens,"$1"),s=te.linestring.apply(this,[i]),u=this.geometryFactory.createLinearRing(s._points),A===0?c=u:E.push(u);return this.geometryFactory.createPolygon(c,E)},multipolygon:function(n){if(n===void 0)return this.geometryFactory.createMultiPolygon();for(var i,s=n.trim().split(tt.doubleParenComma),u=[],c=0,m=s.length;c<m;++c)i=s[c].replace(tt.trimParens,"$1"),u.push(te.polygon.apply(this,[i]));return this.geometryFactory.createMultiPolygon(u)},geometrycollection:function(n){if(n===void 0)return this.geometryFactory.createGeometryCollection();for(var i=(n=n.replace(/,\\s*([A-Za-z])/g,"|$1")).trim().split("|"),s=[],u=0,c=i.length;u<c;++u)s.push(this.read(i[u]));return this.geometryFactory.createGeometryCollection(s)}},qt=function(n){this.parser=new nn(n)};qt.prototype.write=function(n){return this.parser.write(n)},qt.toLineString=function(n,i){if(arguments.length!==2)throw new Error("Not implemented");return"LINESTRING ( "+n.x+" "+n.y+", "+i.x+" "+i.y+" )"};var $=function(n){function i(s){n.call(this,s),this.name="RuntimeException",this.message=s,this.stack=new n().stack}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i}(Error),N=function(n){function i(){if(n.call(this),arguments.length===0)n.call(this);else if(arguments.length===1){var s=arguments[0];n.call(this,s)}}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}($),b=function(){};b.prototype.interfaces_=function(){return[]},b.prototype.getClass=function(){return b},b.shouldNeverReachHere=function(){if(arguments.length===0)b.shouldNeverReachHere(null);else if(arguments.length===1){var n=arguments[0];throw new N("Should never reach here"+(n!==null?": "+n:""))}},b.isTrue=function(){var n,i;if(arguments.length===1)n=arguments[0],b.isTrue(n,null);else if(arguments.length===2&&(n=arguments[0],i=arguments[1],!n))throw i===null?new N:new N(i)},b.equals=function(){var n,i,s;if(arguments.length===2)n=arguments[0],i=arguments[1],b.equals(n,i,null);else if(arguments.length===3&&(n=arguments[0],i=arguments[1],s=arguments[2],!i.equals(n)))throw new N("Expected "+n+" but encountered "+i+(s!==null?": "+s:""))};var R=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 L,this._intPt[1]=new L,this._pa=this._intPt[0],this._pb=this._intPt[1],this._result=0},W={DONT_INTERSECT:{configurable:!0},DO_INTERSECT:{configurable:!0},COLLINEAR:{configurable:!0},NO_INTERSECTION:{configurable:!0},POINT_INTERSECTION:{configurable:!0},COLLINEAR_INTERSECTION:{configurable:!0}};R.prototype.getIndexAlongSegment=function(n,i){return this.computeIntLineIndex(),this._intLineIndex[n][i]},R.prototype.getTopologySummary=function(){var n=new pt;return this.isEndPoint()&&n.append(" endpoint"),this._isProper&&n.append(" proper"),this.isCollinear()&&n.append(" collinear"),n.toString()},R.prototype.computeIntersection=function(n,i,s,u){this._inputLines[0][0]=n,this._inputLines[0][1]=i,this._inputLines[1][0]=s,this._inputLines[1][1]=u,this._result=this.computeIntersect(n,i,s,u)},R.prototype.getIntersectionNum=function(){return this._result},R.prototype.computeIntLineIndex=function(){if(arguments.length===0)this._intLineIndex===null&&(this._intLineIndex=Array(2).fill().map(function(){return Array(2)}),this.computeIntLineIndex(0),this.computeIntLineIndex(1));else if(arguments.length===1){var n=arguments[0];this.getEdgeDistance(n,0)>this.getEdgeDistance(n,1)?(this._intLineIndex[n][0]=0,this._intLineIndex[n][1]=1):(this._intLineIndex[n][0]=1,this._intLineIndex[n][1]=0)}},R.prototype.isProper=function(){return this.hasIntersection()&&this._isProper},R.prototype.setPrecisionModel=function(n){this._precisionModel=n},R.prototype.isInteriorIntersection=function(){if(arguments.length===0)return!!this.isInteriorIntersection(0)||!!this.isInteriorIntersection(1);if(arguments.length===1){for(var n=arguments[0],i=0;i<this._result;i++)if(!this._intPt[i].equals2D(this._inputLines[n][0])&&!this._intPt[i].equals2D(this._inputLines[n][1]))return!0;return!1}},R.prototype.getIntersection=function(n){return this._intPt[n]},R.prototype.isEndPoint=function(){return this.hasIntersection()&&!this._isProper},R.prototype.hasIntersection=function(){return this._result!==R.NO_INTERSECTION},R.prototype.getEdgeDistance=function(n,i){return R.computeEdgeDistance(this._intPt[i],this._inputLines[n][0],this._inputLines[n][1])},R.prototype.isCollinear=function(){return this._result===R.COLLINEAR_INTERSECTION},R.prototype.toString=function(){return qt.toLineString(this._inputLines[0][0],this._inputLines[0][1])+" - "+qt.toLineString(this._inputLines[1][0],this._inputLines[1][1])+this.getTopologySummary()},R.prototype.getEndpoint=function(n,i){return this._inputLines[n][i]},R.prototype.isIntersection=function(n){for(var i=0;i<this._result;i++)if(this._intPt[i].equals2D(n))return!0;return!1},R.prototype.getIntersectionAlongSegment=function(n,i){return this.computeIntLineIndex(),this._intPt[this._intLineIndex[n][i]]},R.prototype.interfaces_=function(){return[]},R.prototype.getClass=function(){return R},R.computeEdgeDistance=function(n,i,s){var u=Math.abs(s.x-i.x),c=Math.abs(s.y-i.y),m=-1;if(n.equals(i))m=0;else if(n.equals(s))m=u>c?u:c;else{var E=Math.abs(n.x-i.x),A=Math.abs(n.y-i.y);(m=u>c?E:A)!==0||n.equals(i)||(m=Math.max(E,A))}return b.isTrue(!(m===0&&!n.equals(i)),"Bad distance calculation"),m},R.nonRobustComputeEdgeDistance=function(n,i,s){var u=n.x-i.x,c=n.y-i.y,m=Math.sqrt(u*u+c*c);return b.isTrue(!(m===0&&!n.equals(i)),"Invalid distance calculation"),m},W.DONT_INTERSECT.get=function(){return 0},W.DO_INTERSECT.get=function(){return 1},W.COLLINEAR.get=function(){return 2},W.NO_INTERSECTION.get=function(){return 0},W.POINT_INTERSECTION.get=function(){return 1},W.COLLINEAR_INTERSECTION.get=function(){return 2},Object.defineProperties(R,W);var J=function(n){function i(){n.apply(this,arguments)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.isInSegmentEnvelopes=function(s){var u=new Pt(this._inputLines[0][0],this._inputLines[0][1]),c=new Pt(this._inputLines[1][0],this._inputLines[1][1]);return u.contains(s)&&c.contains(s)},i.prototype.computeIntersection=function(){if(arguments.length!==3)return n.prototype.computeIntersection.apply(this,arguments);var s=arguments[0],u=arguments[1],c=arguments[2];if(this._isProper=!1,Pt.intersects(u,c,s)&&B.orientationIndex(u,c,s)===0&&B.orientationIndex(c,u,s)===0)return this._isProper=!0,(s.equals(u)||s.equals(c))&&(this._isProper=!1),this._result=n.POINT_INTERSECTION,null;this._result=n.NO_INTERSECTION},i.prototype.normalizeToMinimum=function(s,u,c,m,E){E.x=this.smallestInAbsValue(s.x,u.x,c.x,m.x),E.y=this.smallestInAbsValue(s.y,u.y,c.y,m.y),s.x-=E.x,s.y-=E.y,u.x-=E.x,u.y-=E.y,c.x-=E.x,c.y-=E.y,m.x-=E.x,m.y-=E.y},i.prototype.safeHCoordinateIntersection=function(s,u,c,m){var E=null;try{E=ne.intersection(s,u,c,m)}catch(A){if(!(A instanceof Wt))throw A;E=i.nearestEndpoint(s,u,c,m)}return E},i.prototype.intersection=function(s,u,c,m){var E=this.intersectionWithNormalization(s,u,c,m);return this.isInSegmentEnvelopes(E)||(E=new L(i.nearestEndpoint(s,u,c,m))),this._precisionModel!==null&&this._precisionModel.makePrecise(E),E},i.prototype.smallestInAbsValue=function(s,u,c,m){var E=s,A=Math.abs(E);return Math.abs(u)<A&&(E=u,A=Math.abs(u)),Math.abs(c)<A&&(E=c,A=Math.abs(c)),Math.abs(m)<A&&(E=m),E},i.prototype.checkDD=function(s,u,c,m,E){var A=at.intersection(s,u,c,m),U=this.isInSegmentEnvelopes(A);Nt.out.println("DD in env = "+U+" --------------------- "+A),E.distance(A)>1e-4&&Nt.out.println("Distance = "+E.distance(A))},i.prototype.intersectionWithNormalization=function(s,u,c,m){var E=new L(s),A=new L(u),U=new L(c),Z=new L(m),ut=new L;this.normalizeToEnvCentre(E,A,U,Z,ut);var ht=this.safeHCoordinateIntersection(E,A,U,Z);return ht.x+=ut.x,ht.y+=ut.y,ht},i.prototype.computeCollinearIntersection=function(s,u,c,m){var E=Pt.intersects(s,u,c),A=Pt.intersects(s,u,m),U=Pt.intersects(c,m,s),Z=Pt.intersects(c,m,u);return E&&A?(this._intPt[0]=c,this._intPt[1]=m,n.COLLINEAR_INTERSECTION):U&&Z?(this._intPt[0]=s,this._intPt[1]=u,n.COLLINEAR_INTERSECTION):E&&U?(this._intPt[0]=c,this._intPt[1]=s,!c.equals(s)||A||Z?n.COLLINEAR_INTERSECTION:n.POINT_INTERSECTION):E&&Z?(this._intPt[0]=c,this._intPt[1]=u,!c.equals(u)||A||U?n.COLLINEAR_INTERSECTION:n.POINT_INTERSECTION):A&&U?(this._intPt[0]=m,this._intPt[1]=s,!m.equals(s)||E||Z?n.COLLINEAR_INTERSECTION:n.POINT_INTERSECTION):A&&Z?(this._intPt[0]=m,this._intPt[1]=u,!m.equals(u)||E||U?n.COLLINEAR_INTERSECTION:n.POINT_INTERSECTION):n.NO_INTERSECTION},i.prototype.normalizeToEnvCentre=function(s,u,c,m,E){var A=s.x<u.x?s.x:u.x,U=s.y<u.y?s.y:u.y,Z=s.x>u.x?s.x:u.x,ut=s.y>u.y?s.y:u.y,ht=c.x<m.x?c.x:m.x,At=c.y<m.y?c.y:m.y,Rt=c.x>m.x?c.x:m.x,kt=c.y>m.y?c.y:m.y,ee=((A>ht?A:ht)+(Z<Rt?Z:Rt))/2,on=((U>At?U:At)+(ut<kt?ut:kt))/2;E.x=ee,E.y=on,s.x-=E.x,s.y-=E.y,u.x-=E.x,u.y-=E.y,c.x-=E.x,c.y-=E.y,m.x-=E.x,m.y-=E.y},i.prototype.computeIntersect=function(s,u,c,m){if(this._isProper=!1,!Pt.intersects(s,u,c,m))return n.NO_INTERSECTION;var E=B.orientationIndex(s,u,c),A=B.orientationIndex(s,u,m);if(E>0&&A>0||E<0&&A<0)return n.NO_INTERSECTION;var U=B.orientationIndex(c,m,s),Z=B.orientationIndex(c,m,u);return U>0&&Z>0||U<0&&Z<0?n.NO_INTERSECTION:E===0&&A===0&&U===0&&Z===0?this.computeCollinearIntersection(s,u,c,m):(E===0||A===0||U===0||Z===0?(this._isProper=!1,s.equals2D(c)||s.equals2D(m)?this._intPt[0]=s:u.equals2D(c)||u.equals2D(m)?this._intPt[0]=u:E===0?this._intPt[0]=new L(c):A===0?this._intPt[0]=new L(m):U===0?this._intPt[0]=new L(s):Z===0&&(this._intPt[0]=new L(u))):(this._isProper=!0,this._intPt[0]=this.intersection(s,u,c,m)),n.POINT_INTERSECTION)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i.nearestEndpoint=function(s,u,c,m){var E=s,A=B.distancePointLine(s,c,m),U=B.distancePointLine(u,c,m);return U<A&&(A=U,E=u),(U=B.distancePointLine(c,s,u))<A&&(A=U,E=c),(U=B.distancePointLine(m,s,u))<A&&(A=U,E=m),E},i}(R),I=function(){};I.prototype.interfaces_=function(){return[]},I.prototype.getClass=function(){return I},I.orientationIndex=function(n,i,s){var u=i.x-n.x,c=i.y-n.y,m=s.x-i.x,E=s.y-i.y;return I.signOfDet2x2(u,c,m,E)},I.signOfDet2x2=function(n,i,s,u){var c=null,m=null,E=null;if(c=1,n===0||u===0)return i===0||s===0?0:i>0?s>0?-c:c:s>0?c:-c;if(i===0||s===0)return u>0?n>0?c:-c:n>0?-c:c;if(i>0?u>0?i<=u||(c=-c,m=n,n=s,s=m,m=i,i=u,u=m):i<=-u?(c=-c,s=-s,u=-u):(m=n,n=-s,s=m,m=i,i=-u,u=m):u>0?-i<=u?(c=-c,n=-n,i=-i):(m=-n,n=s,s=m,m=-i,i=u,u=m):i>=u?(n=-n,i=-i,s=-s,u=-u):(c=-c,m=-n,n=-s,s=m,m=-i,i=-u,u=m),n>0){if(!(s>0)||!(n<=s))return c}else{if(s>0||!(n>=s))return-c;c=-c,n=-n,s=-s}for(;;){if(E=Math.floor(s/n),s-=E*n,(u-=E*i)<0)return-c;if(u>i)return c;if(n>s+s){if(i<u+u)return c}else{if(i>u+u)return-c;s=n-s,u=i-u,c=-c}if(u===0)return s===0?0:-c;if(s===0||(E=Math.floor(n/s),n-=E*s,(i-=E*u)<0))return c;if(i>u)return-c;if(s>n+n){if(u<i+i)return-c}else{if(u>i+i)return c;n=s-n,i=u-i,c=-c}if(i===0)return n===0?0:c;if(n===0)return-c}};var P=function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var n=arguments[0];this._p=n};P.prototype.countSegment=function(n,i){if(n.x<this._p.x&&i.x<this._p.x)return null;if(this._p.x===i.x&&this._p.y===i.y)return this._isPointOnSegment=!0,null;if(n.y===this._p.y&&i.y===this._p.y){var s=n.x,u=i.x;return s>u&&(s=i.x,u=n.x),this._p.x>=s&&this._p.x<=u&&(this._isPointOnSegment=!0),null}if(n.y>this._p.y&&i.y<=this._p.y||i.y>this._p.y&&n.y<=this._p.y){var c=n.x-this._p.x,m=n.y-this._p.y,E=i.x-this._p.x,A=i.y-this._p.y,U=I.signOfDet2x2(c,m,E,A);if(U===0)return this._isPointOnSegment=!0,null;A<m&&(U=-U),U>0&&this._crossingCount++}},P.prototype.isPointInPolygon=function(){return this.getLocation()!==k.EXTERIOR},P.prototype.getLocation=function(){return this._isPointOnSegment?k.BOUNDARY:this._crossingCount%2==1?k.INTERIOR:k.EXTERIOR},P.prototype.isOnSegment=function(){return this._isPointOnSegment},P.prototype.interfaces_=function(){return[]},P.prototype.getClass=function(){return P},P.locatePointInRing=function(){if(arguments[0]instanceof L&&X(arguments[1],dt)){for(var n=arguments[0],i=arguments[1],s=new P(n),u=new L,c=new L,m=1;m<i.size();m++)if(i.getCoordinate(m,u),i.getCoordinate(m-1,c),s.countSegment(u,c),s.isOnSegment())return s.getLocation();return s.getLocation()}if(arguments[0]instanceof L&&arguments[1]instanceof Array){for(var E=arguments[0],A=arguments[1],U=new P(E),Z=1;Z<A.length;Z++){var ut=A[Z],ht=A[Z-1];if(U.countSegment(ut,ht),U.isOnSegment())return U.getLocation()}return U.getLocation()}};var B=function(){},lt={CLOCKWISE:{configurable:!0},RIGHT:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},LEFT:{configurable:!0},COLLINEAR:{configurable:!0},STRAIGHT:{configurable:!0}};B.prototype.interfaces_=function(){return[]},B.prototype.getClass=function(){return B},B.orientationIndex=function(n,i,s){return at.orientationIndex(n,i,s)},B.signedArea=function(){if(arguments[0]instanceof Array){var n=arguments[0];if(n.length<3)return 0;for(var i=0,s=n[0].x,u=1;u<n.length-1;u++){var c=n[u].x-s,m=n[u+1].y;i+=c*(n[u-1].y-m)}return i/2}if(X(arguments[0],dt)){var E=arguments[0],A=E.size();if(A<3)return 0;var U=new L,Z=new L,ut=new L;E.getCoordinate(0,Z),E.getCoordinate(1,ut);var ht=Z.x;ut.x-=ht;for(var At=0,Rt=1;Rt<A-1;Rt++)U.y=Z.y,Z.x=ut.x,Z.y=ut.y,E.getCoordinate(Rt+1,ut),ut.x-=ht,At+=Z.x*(U.y-ut.y);return At/2}},B.distanceLineLine=function(n,i,s,u){if(n.equals(i))return B.distancePointLine(n,s,u);if(s.equals(u))return B.distancePointLine(u,n,i);var c=!1;if(Pt.intersects(n,i,s,u)){var m=(i.x-n.x)*(u.y-s.y)-(i.y-n.y)*(u.x-s.x);if(m===0)c=!0;else{var E=(n.y-s.y)*(u.x-s.x)-(n.x-s.x)*(u.y-s.y),A=((n.y-s.y)*(i.x-n.x)-(n.x-s.x)*(i.y-n.y))/m,U=E/m;(U<0||U>1||A<0||A>1)&&(c=!0)}}else c=!0;return c?it.min(B.distancePointLine(n,s,u),B.distancePointLine(i,s,u),B.distancePointLine(s,n,i),B.distancePointLine(u,n,i)):0},B.isPointInRing=function(n,i){return B.locatePointInRing(n,i)!==k.EXTERIOR},B.computeLength=function(n){var i=n.size();if(i<=1)return 0;var s=0,u=new L;n.getCoordinate(0,u);for(var c=u.x,m=u.y,E=1;E<i;E++){n.getCoordinate(E,u);var A=u.x,U=u.y,Z=A-c,ut=U-m;s+=Math.sqrt(Z*Z+ut*ut),c=A,m=U}return s},B.isCCW=function(n){var i=n.length-1;if(i<3)throw new C("Ring has fewer than 4 points, so orientation cannot be determined");for(var s=n[0],u=0,c=1;c<=i;c++){var m=n[c];m.y>s.y&&(s=m,u=c)}var E=u;do(E-=1)<0&&(E=i);while(n[E].equals2D(s)&&E!==u);var A=u;do A=(A+1)%i;while(n[A].equals2D(s)&&A!==u);var U=n[E],Z=n[A];if(U.equals2D(s)||Z.equals2D(s)||U.equals2D(Z))return!1;var ut=B.computeOrientation(U,s,Z),ht=!1;return ht=ut===0?U.x>Z.x:ut>0,ht},B.locatePointInRing=function(n,i){return P.locatePointInRing(n,i)},B.distancePointLinePerpendicular=function(n,i,s){var u=(s.x-i.x)*(s.x-i.x)+(s.y-i.y)*(s.y-i.y),c=((i.y-n.y)*(s.x-i.x)-(i.x-n.x)*(s.y-i.y))/u;return Math.abs(c)*Math.sqrt(u)},B.computeOrientation=function(n,i,s){return B.orientationIndex(n,i,s)},B.distancePointLine=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];if(i.length===0)throw new C("Line array must contain at least one vertex");for(var s=n.distance(i[0]),u=0;u<i.length-1;u++){var c=B.distancePointLine(n,i[u],i[u+1]);c<s&&(s=c)}return s}if(arguments.length===3){var m=arguments[0],E=arguments[1],A=arguments[2];if(E.x===A.x&&E.y===A.y)return m.distance(E);var U=(A.x-E.x)*(A.x-E.x)+(A.y-E.y)*(A.y-E.y),Z=((m.x-E.x)*(A.x-E.x)+(m.y-E.y)*(A.y-E.y))/U;if(Z<=0)return m.distance(E);if(Z>=1)return m.distance(A);var ut=((E.y-m.y)*(A.x-E.x)-(E.x-m.x)*(A.y-E.y))/U;return Math.abs(ut)*Math.sqrt(U)}},B.isOnLine=function(n,i){for(var s=new J,u=1;u<i.length;u++){var c=i[u-1],m=i[u];if(s.computeIntersection(n,c,m),s.hasIntersection())return!0}return!1},lt.CLOCKWISE.get=function(){return-1},lt.RIGHT.get=function(){return B.CLOCKWISE},lt.COUNTERCLOCKWISE.get=function(){return 1},lt.LEFT.get=function(){return B.COUNTERCLOCKWISE},lt.COLLINEAR.get=function(){return 0},lt.STRAIGHT.get=function(){return B.COLLINEAR},Object.defineProperties(B,lt);var ct=function(){};ct.prototype.filter=function(n){},ct.prototype.interfaces_=function(){return[]},ct.prototype.getClass=function(){return ct};var Q=function(){var n=arguments[0];this._envelope=null,this._factory=null,this._SRID=null,this._userData=null,this._factory=n,this._SRID=n.getSRID()},St={serialVersionUID:{configurable:!0},SORTINDEX_POINT:{configurable:!0},SORTINDEX_MULTIPOINT:{configurable:!0},SORTINDEX_LINESTRING:{configurable:!0},SORTINDEX_LINEARRING:{configurable:!0},SORTINDEX_MULTILINESTRING:{configurable:!0},SORTINDEX_POLYGON:{configurable:!0},SORTINDEX_MULTIPOLYGON:{configurable:!0},SORTINDEX_GEOMETRYCOLLECTION:{configurable:!0},geometryChangedFilter:{configurable:!0}};Q.prototype.isGeometryCollection=function(){return this.getSortIndex()===Q.SORTINDEX_GEOMETRYCOLLECTION},Q.prototype.getFactory=function(){return this._factory},Q.prototype.getGeometryN=function(n){return this},Q.prototype.getArea=function(){return 0},Q.prototype.isRectangle=function(){return!1},Q.prototype.equals=function(){if(arguments[0]instanceof Q){var n=arguments[0];return n!==null&&this.equalsTopo(n)}if(arguments[0]instanceof Object){var i=arguments[0];if(!(i instanceof Q))return!1;var s=i;return this.equalsExact(s)}},Q.prototype.equalsExact=function(n){return this===n||this.equalsExact(n,0)},Q.prototype.geometryChanged=function(){this.apply(Q.geometryChangedFilter)},Q.prototype.geometryChangedAction=function(){this._envelope=null},Q.prototype.equalsNorm=function(n){return n!==null&&this.norm().equalsExact(n.norm())},Q.prototype.getLength=function(){return 0},Q.prototype.getNumGeometries=function(){return 1},Q.prototype.compareTo=function(){if(arguments.length===1){var n=arguments[0],i=n;return this.getSortIndex()!==i.getSortIndex()?this.getSortIndex()-i.getSortIndex():this.isEmpty()&&i.isEmpty()?0:this.isEmpty()?-1:i.isEmpty()?1:this.compareToSameClass(n)}if(arguments.length===2){var s=arguments[0],u=arguments[1];return this.getSortIndex()!==s.getSortIndex()?this.getSortIndex()-s.getSortIndex():this.isEmpty()&&s.isEmpty()?0:this.isEmpty()?-1:s.isEmpty()?1:this.compareToSameClass(s,u)}},Q.prototype.getUserData=function(){return this._userData},Q.prototype.getSRID=function(){return this._SRID},Q.prototype.getEnvelope=function(){return this.getFactory().toGeometry(this.getEnvelopeInternal())},Q.prototype.checkNotGeometryCollection=function(n){if(n.getSortIndex()===Q.SORTINDEX_GEOMETRYCOLLECTION)throw new C("This method does not support GeometryCollection arguments")},Q.prototype.equal=function(n,i,s){return s===0?n.equals(i):n.distance(i)<=s},Q.prototype.norm=function(){var n=this.copy();return n.normalize(),n},Q.prototype.getPrecisionModel=function(){return this._factory.getPrecisionModel()},Q.prototype.getEnvelopeInternal=function(){return this._envelope===null&&(this._envelope=this.computeEnvelopeInternal()),new Pt(this._envelope)},Q.prototype.setSRID=function(n){this._SRID=n},Q.prototype.setUserData=function(n){this._userData=n},Q.prototype.compare=function(n,i){for(var s=n.iterator(),u=i.iterator();s.hasNext()&&u.hasNext();){var c=s.next(),m=u.next(),E=c.compareTo(m);if(E!==0)return E}return s.hasNext()?1:u.hasNext()?-1:0},Q.prototype.hashCode=function(){return this.getEnvelopeInternal().hashCode()},Q.prototype.isGeometryCollectionOrDerived=function(){return this.getSortIndex()===Q.SORTINDEX_GEOMETRYCOLLECTION||this.getSortIndex()===Q.SORTINDEX_MULTIPOINT||this.getSortIndex()===Q.SORTINDEX_MULTILINESTRING||this.getSortIndex()===Q.SORTINDEX_MULTIPOLYGON},Q.prototype.interfaces_=function(){return[G,F,t]},Q.prototype.getClass=function(){return Q},Q.hasNonEmptyElements=function(n){for(var i=0;i<n.length;i++)if(!n[i].isEmpty())return!0;return!1},Q.hasNullElements=function(n){for(var i=0;i<n.length;i++)if(n[i]===null)return!0;return!1},St.serialVersionUID.get=function(){return 8763622679187377e3},St.SORTINDEX_POINT.get=function(){return 0},St.SORTINDEX_MULTIPOINT.get=function(){return 1},St.SORTINDEX_LINESTRING.get=function(){return 2},St.SORTINDEX_LINEARRING.get=function(){return 3},St.SORTINDEX_MULTILINESTRING.get=function(){return 4},St.SORTINDEX_POLYGON.get=function(){return 5},St.SORTINDEX_MULTIPOLYGON.get=function(){return 6},St.SORTINDEX_GEOMETRYCOLLECTION.get=function(){return 7},St.geometryChangedFilter.get=function(){return _t},Object.defineProperties(Q,St);var _t=function(){};_t.interfaces_=function(){return[ct]},_t.filter=function(n){n.geometryChangedAction()};var Mt=function(){};Mt.prototype.filter=function(n){},Mt.prototype.interfaces_=function(){return[]},Mt.prototype.getClass=function(){return Mt};var Lt=function(){},Jt={Mod2BoundaryNodeRule:{configurable:!0},EndPointBoundaryNodeRule:{configurable:!0},MultiValentEndPointBoundaryNodeRule:{configurable:!0},MonoValentEndPointBoundaryNodeRule:{configurable:!0},MOD2_BOUNDARY_RULE:{configurable:!0},ENDPOINT_BOUNDARY_RULE:{configurable:!0},MULTIVALENT_ENDPOINT_BOUNDARY_RULE:{configurable:!0},MONOVALENT_ENDPOINT_BOUNDARY_RULE:{configurable:!0},OGC_SFS_BOUNDARY_RULE:{configurable:!0}};Lt.prototype.isInBoundary=function(n){},Lt.prototype.interfaces_=function(){return[]},Lt.prototype.getClass=function(){return Lt},Jt.Mod2BoundaryNodeRule.get=function(){return Et},Jt.EndPointBoundaryNodeRule.get=function(){return oe},Jt.MultiValentEndPointBoundaryNodeRule.get=function(){return jt},Jt.MonoValentEndPointBoundaryNodeRule.get=function(){return Ht},Jt.MOD2_BOUNDARY_RULE.get=function(){return new Et},Jt.ENDPOINT_BOUNDARY_RULE.get=function(){return new oe},Jt.MULTIVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new jt},Jt.MONOVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new Ht},Jt.OGC_SFS_BOUNDARY_RULE.get=function(){return Lt.MOD2_BOUNDARY_RULE},Object.defineProperties(Lt,Jt);var Et=function(){};Et.prototype.isInBoundary=function(n){return n%2==1},Et.prototype.interfaces_=function(){return[Lt]},Et.prototype.getClass=function(){return Et};var oe=function(){};oe.prototype.isInBoundary=function(n){return n>0},oe.prototype.interfaces_=function(){return[Lt]},oe.prototype.getClass=function(){return oe};var jt=function(){};jt.prototype.isInBoundary=function(n){return n>1},jt.prototype.interfaces_=function(){return[Lt]},jt.prototype.getClass=function(){return jt};var Ht=function(){};Ht.prototype.isInBoundary=function(n){return n===1},Ht.prototype.interfaces_=function(){return[Lt]},Ht.prototype.getClass=function(){return Ht};var Ot=function(){};Ot.prototype.add=function(){},Ot.prototype.addAll=function(){},Ot.prototype.isEmpty=function(){},Ot.prototype.iterator=function(){},Ot.prototype.size=function(){},Ot.prototype.toArray=function(){},Ot.prototype.remove=function(){},(e.prototype=new Error).name="IndexOutOfBoundsException";var Y=function(){};Y.prototype.hasNext=function(){},Y.prototype.next=function(){},Y.prototype.remove=function(){};var wt=function(n){function i(){n.apply(this,arguments)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.get=function(){},i.prototype.set=function(){},i.prototype.isEmpty=function(){},i}(Ot);(o.prototype=new Error).name="NoSuchElementException";var j=function(n){function i(){n.call(this),this.array_=[],arguments[0]instanceof Ot&&this.addAll(arguments[0])}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.ensureCapacity=function(){},i.prototype.interfaces_=function(){return[n,Ot]},i.prototype.add=function(s){return arguments.length===1?this.array_.push(s):this.array_.splice(arguments[0],arguments[1]),!0},i.prototype.clear=function(){this.array_=[]},i.prototype.addAll=function(s){for(var u=s.iterator();u.hasNext();)this.add(u.next());return!0},i.prototype.set=function(s,u){var c=this.array_[s];return this.array_[s]=u,c},i.prototype.iterator=function(){return new Ut(this)},i.prototype.get=function(s){if(s<0||s>=this.size())throw new e;return this.array_[s]},i.prototype.isEmpty=function(){return this.array_.length===0},i.prototype.size=function(){return this.array_.length},i.prototype.toArray=function(){for(var s=[],u=0,c=this.array_.length;u<c;u++)s.push(this.array_[u]);return s},i.prototype.remove=function(s){for(var u=!1,c=0,m=this.array_.length;c<m;c++)if(this.array_[c]===s){this.array_.splice(c,1),u=!0;break}return u},i}(wt),Ut=function(n){function i(s){n.call(this),this.arrayList_=s,this.position_=0}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.next=function(){if(this.position_===this.arrayList_.size())throw new o;return this.arrayList_.get(this.position_++)},i.prototype.hasNext=function(){return this.position_<this.arrayList_.size()},i.prototype.set=function(s){return this.arrayList_.set(this.position_-1,s)},i.prototype.remove=function(){this.arrayList_.remove(this.arrayList_.get(this.position_))},i}(Y),Dt=function(n){function i(){if(n.call(this),arguments.length!==0){if(arguments.length===1){var u=arguments[0];this.ensureCapacity(u.length),this.add(u,!0)}else if(arguments.length===2){var c=arguments[0],m=arguments[1];this.ensureCapacity(c.length),this.add(c,m)}}}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={coordArrayType:{configurable:!0}};return s.coordArrayType.get=function(){return new Array(0).fill(null)},i.prototype.getCoordinate=function(u){return this.get(u)},i.prototype.addAll=function(){if(arguments.length===2){for(var u=arguments[0],c=arguments[1],m=!1,E=u.iterator();E.hasNext();)this.add(E.next(),c),m=!0;return m}return n.prototype.addAll.apply(this,arguments)},i.prototype.clone=function(){for(var u=n.prototype.clone.call(this),c=0;c<this.size();c++)u.add(c,this.get(c).copy());return u},i.prototype.toCoordinateArray=function(){return this.toArray(i.coordArrayType)},i.prototype.add=function(){if(arguments.length===1){var u=arguments[0];n.prototype.add.call(this,u)}else if(arguments.length===2){if(arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var c=arguments[0],m=arguments[1];return this.add(c,m,!0),!0}if(arguments[0]instanceof L&&typeof arguments[1]=="boolean"){var E=arguments[0];if(!arguments[1]&&this.size()>=1&&this.get(this.size()-1).equals2D(E))return null;n.prototype.add.call(this,E)}else if(arguments[0]instanceof Object&&typeof arguments[1]=="boolean"){var A=arguments[0],U=arguments[1];return this.add(A,U),!0}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var Z=arguments[0],ut=arguments[1];if(arguments[2])for(var ht=0;ht<Z.length;ht++)this.add(Z[ht],ut);else for(var At=Z.length-1;At>=0;At--)this.add(Z[At],ut);return!0}if(typeof arguments[2]=="boolean"&&Number.isInteger(arguments[0])&&arguments[1]instanceof L){var Rt=arguments[0],kt=arguments[1];if(!arguments[2]){var ee=this.size();if(ee>0&&(Rt>0&&this.get(Rt-1).equals2D(kt)||Rt<ee&&this.get(Rt).equals2D(kt)))return null}n.prototype.add.call(this,Rt,kt)}}else if(arguments.length===4){var on=arguments[0],In=arguments[1],pr=arguments[2],Xi=arguments[3],Lo=1;pr>Xi&&(Lo=-1);for(var Tf=pr;Tf!==Xi;Tf+=Lo)this.add(on[Tf],In);return!0}},i.prototype.closeRing=function(){this.size()>0&&this.add(new L(this.get(0)),!1)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},Object.defineProperties(i,s),i}(j),ft=function(){},$t={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};$t.ForwardComparator.get=function(){return re},$t.BidirectionalComparator.get=function(){return mn},$t.coordArrayType.get=function(){return new Array(0).fill(null)},ft.prototype.interfaces_=function(){return[]},ft.prototype.getClass=function(){return ft},ft.isRing=function(n){return!(n.length<4)&&!!n[0].equals2D(n[n.length-1])},ft.ptNotInList=function(n,i){for(var s=0;s<n.length;s++){var u=n[s];if(ft.indexOf(u,i)<0)return u}return null},ft.scroll=function(n,i){var s=ft.indexOf(i,n);if(s<0)return null;var u=new Array(n.length).fill(null);Nt.arraycopy(n,s,u,0,n.length-s),Nt.arraycopy(n,0,u,n.length-s,s),Nt.arraycopy(u,0,n,0,n.length)},ft.equals=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];if(n===i)return!0;if(n===null||i===null||n.length!==i.length)return!1;for(var s=0;s<n.length;s++)if(!n[s].equals(i[s]))return!1;return!0}if(arguments.length===3){var u=arguments[0],c=arguments[1],m=arguments[2];if(u===c)return!0;if(u===null||c===null||u.length!==c.length)return!1;for(var E=0;E<u.length;E++)if(m.compare(u[E],c[E])!==0)return!1;return!0}},ft.intersection=function(n,i){for(var s=new Dt,u=0;u<n.length;u++)i.intersects(n[u])&&s.add(n[u],!0);return s.toCoordinateArray()},ft.hasRepeatedPoints=function(n){for(var i=1;i<n.length;i++)if(n[i-1].equals(n[i]))return!0;return!1},ft.removeRepeatedPoints=function(n){return ft.hasRepeatedPoints(n)?new Dt(n,!1).toCoordinateArray():n},ft.reverse=function(n){for(var i=n.length-1,s=Math.trunc(i/2),u=0;u<=s;u++){var c=n[u];n[u]=n[i-u],n[i-u]=c}},ft.removeNull=function(n){for(var i=0,s=0;s<n.length;s++)n[s]!==null&&i++;var u=new Array(i).fill(null);if(i===0)return u;for(var c=0,m=0;m<n.length;m++)n[m]!==null&&(u[c++]=n[m]);return u},ft.copyDeep=function(){if(arguments.length===1){for(var n=arguments[0],i=new Array(n.length).fill(null),s=0;s<n.length;s++)i[s]=new L(n[s]);return i}if(arguments.length===5)for(var u=arguments[0],c=arguments[1],m=arguments[2],E=arguments[3],A=arguments[4],U=0;U<A;U++)m[E+U]=new L(u[c+U])},ft.isEqualReversed=function(n,i){for(var s=0;s<n.length;s++){var u=n[s],c=i[n.length-s-1];if(u.compareTo(c)!==0)return!1}return!0},ft.envelope=function(n){for(var i=new Pt,s=0;s<n.length;s++)i.expandToInclude(n[s]);return i},ft.toCoordinateArray=function(n){return n.toArray(ft.coordArrayType)},ft.atLeastNCoordinatesOrNothing=function(n,i){return i.length>=n?i:[]},ft.indexOf=function(n,i){for(var s=0;s<i.length;s++)if(n.equals(i[s]))return s;return-1},ft.increasingDirection=function(n){for(var i=0;i<Math.trunc(n.length/2);i++){var s=n.length-1-i,u=n[i].compareTo(n[s]);if(u!==0)return u}return 1},ft.compare=function(n,i){for(var s=0;s<n.length&&s<i.length;){var u=n[s].compareTo(i[s]);if(u!==0)return u;s++}return s<i.length?-1:s<n.length?1:0},ft.minCoordinate=function(n){for(var i=null,s=0;s<n.length;s++)(i===null||i.compareTo(n[s])>0)&&(i=n[s]);return i},ft.extract=function(n,i,s){i=it.clamp(i,0,n.length);var u=(s=it.clamp(s,-1,n.length))-i+1;s<0&&(u=0),i>=n.length&&(u=0),s<i&&(u=0);var c=new Array(u).fill(null);if(u===0)return c;for(var m=0,E=i;E<=s;E++)c[m++]=n[E];return c},Object.defineProperties(ft,$t);var re=function(){};re.prototype.compare=function(n,i){return ft.compare(n,i)},re.prototype.interfaces_=function(){return[z]},re.prototype.getClass=function(){return re};var mn=function(){};mn.prototype.compare=function(n,i){var s=n,u=i;if(s.length<u.length)return-1;if(s.length>u.length)return 1;if(s.length===0)return 0;var c=ft.compare(s,u);return ft.isEqualReversed(s,u)?0:c},mn.prototype.OLDcompare=function(n,i){var s=n,u=i;if(s.length<u.length)return-1;if(s.length>u.length)return 1;if(s.length===0)return 0;for(var c=ft.increasingDirection(s),m=ft.increasingDirection(u),E=c>0?0:s.length-1,A=m>0?0:s.length-1,U=0;U<s.length;U++){var Z=s[E].compareTo(u[A]);if(Z!==0)return Z;E+=c,A+=m}return 0},mn.prototype.interfaces_=function(){return[z]},mn.prototype.getClass=function(){return mn};var He=function(){};He.prototype.get=function(){},He.prototype.put=function(){},He.prototype.size=function(){},He.prototype.values=function(){},He.prototype.entrySet=function(){};var Mi=function(n){function i(){n.apply(this,arguments)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i}(He);(a.prototype=new Error).name="OperationNotSupported",(l.prototype=new Ot).contains=function(){};var $n=function(n){function i(){n.call(this),this.array_=[],arguments[0]instanceof Ot&&this.addAll(arguments[0])}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.contains=function(s){for(var u=0,c=this.array_.length;u<c;u++)if(this.array_[u]===s)return!0;return!1},i.prototype.add=function(s){return!this.contains(s)&&(this.array_.push(s),!0)},i.prototype.addAll=function(s){for(var u=s.iterator();u.hasNext();)this.add(u.next());return!0},i.prototype.remove=function(s){throw new Error},i.prototype.size=function(){return this.array_.length},i.prototype.isEmpty=function(){return this.array_.length===0},i.prototype.toArray=function(){for(var s=[],u=0,c=this.array_.length;u<c;u++)s.push(this.array_[u]);return s},i.prototype.iterator=function(){return new ml(this)},i}(l),ml=function(n){function i(s){n.call(this),this.hashSet_=s,this.position_=0}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.next=function(){if(this.position_===this.hashSet_.size())throw new o;return this.hashSet_.array_[this.position_++]},i.prototype.hasNext=function(){return this.position_<this.hashSet_.size()},i.prototype.remove=function(){throw new a},i}(Y),hi=0;(_.prototype=new Mi).get=function(n){for(var i=this.root_;i!==null;){var s=n.compareTo(i.key);if(s<0)i=i.left;else{if(!(s>0))return i.value;i=i.right}}return null},_.prototype.put=function(n,i){if(this.root_===null)return this.root_={key:n,value:i,left:null,right:null,parent:null,color:hi,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var s,u,c=this.root_;do if(s=c,(u=n.compareTo(c.key))<0)c=c.left;else{if(!(u>0)){var m=c.value;return c.value=i,m}c=c.right}while(c!==null);var E={key:n,left:null,right:null,value:i,parent:s,color:hi,getValue:function(){return this.value},getKey:function(){return this.key}};return u<0?s.left=E:s.right=E,this.fixAfterInsertion(E),this.size_++,null},_.prototype.fixAfterInsertion=function(n){for(n.color=1;n!=null&&n!==this.root_&&n.parent.color===1;)if(h(n)===d(h(h(n)))){var i=g(h(h(n)));f(i)===1?(p(h(n),hi),p(i,hi),p(h(h(n)),1),n=h(h(n))):(n===g(h(n))&&(n=h(n),this.rotateLeft(n)),p(h(n),hi),p(h(h(n)),1),this.rotateRight(h(h(n))))}else{var s=d(h(h(n)));f(s)===1?(p(h(n),hi),p(s,hi),p(h(h(n)),1),n=h(h(n))):(n===d(h(n))&&(n=h(n),this.rotateRight(n)),p(h(n),hi),p(h(h(n)),1),this.rotateLeft(h(h(n))))}this.root_.color=hi},_.prototype.values=function(){var n=new j,i=this.getFirstEntry();if(i!==null)for(n.add(i.value);(i=_.successor(i))!==null;)n.add(i.value);return n},_.prototype.entrySet=function(){var n=new $n,i=this.getFirstEntry();if(i!==null)for(n.add(i);(i=_.successor(i))!==null;)n.add(i);return n},_.prototype.rotateLeft=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}},_.prototype.rotateRight=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}},_.prototype.getFirstEntry=function(){var n=this.root_;if(n!=null)for(;n.left!=null;)n=n.left;return n},_.successor=function(n){if(n===null)return null;if(n.right!==null){for(var i=n.right;i.left!==null;)i=i.left;return i}for(var s=n.parent,u=n;s!==null&&u===s.right;)u=s,s=s.parent;return s},_.prototype.size=function(){return this.size_};var bs=function(){};bs.prototype.interfaces_=function(){return[]},bs.prototype.getClass=function(){return bs},y.prototype=new l,(M.prototype=new y).contains=function(n){for(var i=0,s=this.array_.length;i<s;i++)if(this.array_[i].compareTo(n)===0)return!0;return!1},M.prototype.add=function(n){if(this.contains(n))return!1;for(var i=0,s=this.array_.length;i<s;i++)if(this.array_[i].compareTo(n)===1)return this.array_.splice(i,0,n),!0;return this.array_.push(n),!0},M.prototype.addAll=function(n){for(var i=n.iterator();i.hasNext();)this.add(i.next());return!0},M.prototype.remove=function(n){throw new a},M.prototype.size=function(){return this.array_.length},M.prototype.isEmpty=function(){return this.array_.length===0},M.prototype.toArray=function(){for(var n=[],i=0,s=this.array_.length;i<s;i++)n.push(this.array_[i]);return n},M.prototype.iterator=function(){return new _o(this)};var _o=function(n){this.treeSet_=n,this.position_=0};_o.prototype.next=function(){if(this.position_===this.treeSet_.size())throw new o;return this.treeSet_.array_[this.position_++]},_o.prototype.hasNext=function(){return this.position_<this.treeSet_.size()},_o.prototype.remove=function(){throw new a};var Fi=function(){};Fi.sort=function(){var n,i,s,u,c=arguments[0];if(arguments.length===1)u=function(E,A){return E.compareTo(A)},c.sort(u);else if(arguments.length===2)s=arguments[1],u=function(E,A){return s.compare(E,A)},c.sort(u);else if(arguments.length===3){(i=c.slice(arguments[1],arguments[2])).sort();var m=c.slice(0,arguments[1]).concat(i,c.slice(arguments[2],c.length));for(c.splice(0,c.length),n=0;n<m.length;n++)c.push(m[n])}else if(arguments.length===4)for(i=c.slice(arguments[1],arguments[2]),s=arguments[3],u=function(E,A){return s.compare(E,A)},i.sort(u),m=c.slice(0,arguments[1]).concat(i,c.slice(arguments[2],c.length)),c.splice(0,c.length),n=0;n<m.length;n++)c.push(m[n])},Fi.asList=function(n){for(var i=new j,s=0,u=n.length;s<u;s++)i.add(n[s]);return i};var pe=function(){},Rr={P:{configurable:!0},L:{configurable:!0},A:{configurable:!0},FALSE:{configurable:!0},TRUE:{configurable:!0},DONTCARE:{configurable:!0},SYM_FALSE:{configurable:!0},SYM_TRUE:{configurable:!0},SYM_DONTCARE:{configurable:!0},SYM_P:{configurable:!0},SYM_L:{configurable:!0},SYM_A:{configurable:!0}};Rr.P.get=function(){return 0},Rr.L.get=function(){return 1},Rr.A.get=function(){return 2},Rr.FALSE.get=function(){return-1},Rr.TRUE.get=function(){return-2},Rr.DONTCARE.get=function(){return-3},Rr.SYM_FALSE.get=function(){return"F"},Rr.SYM_TRUE.get=function(){return"T"},Rr.SYM_DONTCARE.get=function(){return"*"},Rr.SYM_P.get=function(){return"0"},Rr.SYM_L.get=function(){return"1"},Rr.SYM_A.get=function(){return"2"},pe.prototype.interfaces_=function(){return[]},pe.prototype.getClass=function(){return pe},pe.toDimensionSymbol=function(n){switch(n){case pe.FALSE:return pe.SYM_FALSE;case pe.TRUE:return pe.SYM_TRUE;case pe.DONTCARE:return pe.SYM_DONTCARE;case pe.P:return pe.SYM_P;case pe.L:return pe.SYM_L;case pe.A:return pe.SYM_A}throw new C("Unknown dimension value: "+n)},pe.toDimensionValue=function(n){switch(ot.toUpperCase(n)){case pe.SYM_FALSE:return pe.FALSE;case pe.SYM_TRUE:return pe.TRUE;case pe.SYM_DONTCARE:return pe.DONTCARE;case pe.SYM_P:return pe.P;case pe.SYM_L:return pe.L;case pe.SYM_A:return pe.A}throw new C("Unknown dimension symbol: "+n)},Object.defineProperties(pe,Rr);var ei=function(){};ei.prototype.filter=function(n){},ei.prototype.interfaces_=function(){return[]},ei.prototype.getClass=function(){return ei};var Vr=function(){};Vr.prototype.filter=function(n,i){},Vr.prototype.isDone=function(){},Vr.prototype.isGeometryChanged=function(){},Vr.prototype.interfaces_=function(){return[]},Vr.prototype.getClass=function(){return Vr};var Vn=function(n){function i(u,c){if(n.call(this,c),this._geometries=u||[],n.hasNullElements(this._geometries))throw new C("geometries must not contain null elements")}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.computeEnvelopeInternal=function(){for(var u=new Pt,c=0;c<this._geometries.length;c++)u.expandToInclude(this._geometries[c].getEnvelopeInternal());return u},i.prototype.getGeometryN=function(u){return this._geometries[u]},i.prototype.getSortIndex=function(){return n.SORTINDEX_GEOMETRYCOLLECTION},i.prototype.getCoordinates=function(){for(var u=new Array(this.getNumPoints()).fill(null),c=-1,m=0;m<this._geometries.length;m++)for(var E=this._geometries[m].getCoordinates(),A=0;A<E.length;A++)u[++c]=E[A];return u},i.prototype.getArea=function(){for(var u=0,c=0;c<this._geometries.length;c++)u+=this._geometries[c].getArea();return u},i.prototype.equalsExact=function(){if(arguments.length===2){var u=arguments[0],c=arguments[1];if(!this.isEquivalentClass(u))return!1;var m=u;if(this._geometries.length!==m._geometries.length)return!1;for(var E=0;E<this._geometries.length;E++)if(!this._geometries[E].equalsExact(m._geometries[E],c))return!1;return!0}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.normalize=function(){for(var u=0;u<this._geometries.length;u++)this._geometries[u].normalize();Fi.sort(this._geometries)},i.prototype.getCoordinate=function(){return this.isEmpty()?null:this._geometries[0].getCoordinate()},i.prototype.getBoundaryDimension=function(){for(var u=pe.FALSE,c=0;c<this._geometries.length;c++)u=Math.max(u,this._geometries[c].getBoundaryDimension());return u},i.prototype.getDimension=function(){for(var u=pe.FALSE,c=0;c<this._geometries.length;c++)u=Math.max(u,this._geometries[c].getDimension());return u},i.prototype.getLength=function(){for(var u=0,c=0;c<this._geometries.length;c++)u+=this._geometries[c].getLength();return u},i.prototype.getNumPoints=function(){for(var u=0,c=0;c<this._geometries.length;c++)u+=this._geometries[c].getNumPoints();return u},i.prototype.getNumGeometries=function(){return this._geometries.length},i.prototype.reverse=function(){for(var u=this._geometries.length,c=new Array(u).fill(null),m=0;m<this._geometries.length;m++)c[m]=this._geometries[m].reverse();return this.getFactory().createGeometryCollection(c)},i.prototype.compareToSameClass=function(){if(arguments.length===1){var u=arguments[0],c=new M(Fi.asList(this._geometries)),m=new M(Fi.asList(u._geometries));return this.compare(c,m)}if(arguments.length===2){for(var E=arguments[0],A=arguments[1],U=E,Z=this.getNumGeometries(),ut=U.getNumGeometries(),ht=0;ht<Z&&ht<ut;){var At=this.getGeometryN(ht),Rt=U.getGeometryN(ht),kt=At.compareToSameClass(Rt,A);if(kt!==0)return kt;ht++}return ht<Z?1:ht<ut?-1:0}},i.prototype.apply=function(){if(X(arguments[0],Mt))for(var u=arguments[0],c=0;c<this._geometries.length;c++)this._geometries[c].apply(u);else if(X(arguments[0],Vr)){var m=arguments[0];if(this._geometries.length===0)return null;for(var E=0;E<this._geometries.length&&(this._geometries[E].apply(m),!m.isDone());E++);m.isGeometryChanged()&&this.geometryChanged()}else if(X(arguments[0],ei)){var A=arguments[0];A.filter(this);for(var U=0;U<this._geometries.length;U++)this._geometries[U].apply(A)}else if(X(arguments[0],ct)){var Z=arguments[0];Z.filter(this);for(var ut=0;ut<this._geometries.length;ut++)this._geometries[ut].apply(Z)}},i.prototype.getBoundary=function(){return this.checkNotGeometryCollection(this),b.shouldNeverReachHere(),null},i.prototype.clone=function(){var u=n.prototype.clone.call(this);u._geometries=new Array(this._geometries.length).fill(null);for(var c=0;c<this._geometries.length;c++)u._geometries[c]=this._geometries[c].clone();return u},i.prototype.getGeometryType=function(){return"GeometryCollection"},i.prototype.copy=function(){for(var u=new Array(this._geometries.length).fill(null),c=0;c<u.length;c++)u[c]=this._geometries[c].copy();return new i(u,this._factory)},i.prototype.isEmpty=function(){for(var u=0;u<this._geometries.length;u++)if(!this._geometries[u].isEmpty())return!1;return!0},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return-5694727726395021e3},Object.defineProperties(i,s),i}(Q),H=function(n){function i(){n.apply(this,arguments)}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.getSortIndex=function(){return Q.SORTINDEX_MULTILINESTRING},i.prototype.equalsExact=function(){if(arguments.length===2){var u=arguments[0],c=arguments[1];return!!this.isEquivalentClass(u)&&n.prototype.equalsExact.call(this,u,c)}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.getBoundaryDimension=function(){return this.isClosed()?pe.FALSE:0},i.prototype.isClosed=function(){if(this.isEmpty())return!1;for(var u=0;u<this._geometries.length;u++)if(!this._geometries[u].isClosed())return!1;return!0},i.prototype.getDimension=function(){return 1},i.prototype.reverse=function(){for(var u=this._geometries.length,c=new Array(u).fill(null),m=0;m<this._geometries.length;m++)c[u-1-m]=this._geometries[m].reverse();return this.getFactory().createMultiLineString(c)},i.prototype.getBoundary=function(){return new rt(this).getBoundary()},i.prototype.getGeometryType=function(){return"MultiLineString"},i.prototype.copy=function(){for(var u=new Array(this._geometries.length).fill(null),c=0;c<u.length;c++)u[c]=this._geometries[c].copy();return new i(u,this._factory)},i.prototype.interfaces_=function(){return[bs]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return 8166665132445434e3},Object.defineProperties(i,s),i}(Vn),rt=function(){if(this._geom=null,this._geomFact=null,this._bnRule=null,this._endpointMap=null,arguments.length===1){var n=arguments[0],i=Lt.MOD2_BOUNDARY_RULE;this._geom=n,this._geomFact=n.getFactory(),this._bnRule=i}else if(arguments.length===2){var s=arguments[0],u=arguments[1];this._geom=s,this._geomFact=s.getFactory(),this._bnRule=u}};rt.prototype.boundaryMultiLineString=function(n){if(this._geom.isEmpty())return this.getEmptyMultiPoint();var i=this.computeBoundaryCoordinates(n);return i.length===1?this._geomFact.createPoint(i[0]):this._geomFact.createMultiPointFromCoords(i)},rt.prototype.getBoundary=function(){return this._geom instanceof Bt?this.boundaryLineString(this._geom):this._geom instanceof H?this.boundaryMultiLineString(this._geom):this._geom.getBoundary()},rt.prototype.boundaryLineString=function(n){return this._geom.isEmpty()?this.getEmptyMultiPoint():n.isClosed()?this._bnRule.isInBoundary(2)?n.getStartPoint():this._geomFact.createMultiPoint():this._geomFact.createMultiPoint([n.getStartPoint(),n.getEndPoint()])},rt.prototype.getEmptyMultiPoint=function(){return this._geomFact.createMultiPoint()},rt.prototype.computeBoundaryCoordinates=function(n){var i=new j;this._endpointMap=new _;for(var s=0;s<n.getNumGeometries();s++){var u=n.getGeometryN(s);u.getNumPoints()!==0&&(this.addEndpoint(u.getCoordinateN(0)),this.addEndpoint(u.getCoordinateN(u.getNumPoints()-1)))}for(var c=this._endpointMap.entrySet().iterator();c.hasNext();){var m=c.next(),E=m.getValue().count;this._bnRule.isInBoundary(E)&&i.add(m.getKey())}return ft.toCoordinateArray(i)},rt.prototype.addEndpoint=function(n){var i=this._endpointMap.get(n);i===null&&(i=new gt,this._endpointMap.put(n,i)),i.count++},rt.prototype.interfaces_=function(){return[]},rt.prototype.getClass=function(){return rt},rt.getBoundary=function(){if(arguments.length===1){var n=arguments[0];return new rt(n).getBoundary()}if(arguments.length===2){var i=arguments[0],s=arguments[1];return new rt(i,s).getBoundary()}};var gt=function(){this.count=null};gt.prototype.interfaces_=function(){return[]},gt.prototype.getClass=function(){return gt};var st=function(){},yt={NEWLINE:{configurable:!0},SIMPLE_ORDINATE_FORMAT:{configurable:!0}};st.prototype.interfaces_=function(){return[]},st.prototype.getClass=function(){return st},st.chars=function(n,i){for(var s=new Array(i).fill(null),u=0;u<i;u++)s[u]=n;return String(s)},st.getStackTrace=function(){if(arguments.length===1){var n=arguments[0],i=new function(){},s=new function(){}(i);return n.printStackTrace(s),i.toString()}if(arguments.length===2){for(var u=arguments[0],c=arguments[1],m="",E=new function(){}(new function(){}(st.getStackTrace(u))),A=0;A<c;A++)try{m+=E.readLine()+st.NEWLINE}catch(U){if(!(U instanceof w))throw U;b.shouldNeverReachHere()}return m}},st.split=function(n,i){for(var s=i.length,u=new j,c=""+n,m=c.indexOf(i);m>=0;){var E=c.substring(0,m);u.add(E),m=(c=c.substring(m+s)).indexOf(i)}c.length>0&&u.add(c);for(var A=new Array(u.size()).fill(null),U=0;U<A.length;U++)A[U]=u.get(U);return A},st.toString=function(){if(arguments.length===1){var n=arguments[0];return st.SIMPLE_ORDINATE_FORMAT.format(n)}},st.spaces=function(n){return st.chars(" ",n)},yt.NEWLINE.get=function(){return Nt.getProperty("line.separator")},yt.SIMPLE_ORDINATE_FORMAT.get=function(){return new function(){}("0.#")},Object.defineProperties(st,yt);var It=function(){};It.prototype.interfaces_=function(){return[]},It.prototype.getClass=function(){return It},It.copyCoord=function(n,i,s,u){for(var c=Math.min(n.getDimension(),s.getDimension()),m=0;m<c;m++)s.setOrdinate(u,m,n.getOrdinate(i,m))},It.isRing=function(n){var i=n.size();return i===0||!(i<=3)&&n.getOrdinate(0,dt.X)===n.getOrdinate(i-1,dt.X)&&n.getOrdinate(0,dt.Y)===n.getOrdinate(i-1,dt.Y)},It.isEqual=function(n,i){var s=n.size();if(s!==i.size())return!1;for(var u=Math.min(n.getDimension(),i.getDimension()),c=0;c<s;c++)for(var m=0;m<u;m++){var E=n.getOrdinate(c,m),A=i.getOrdinate(c,m);if(n.getOrdinate(c,m)!==i.getOrdinate(c,m)&&(!S.isNaN(E)||!S.isNaN(A)))return!1}return!0},It.extend=function(n,i,s){var u=n.create(s,i.getDimension()),c=i.size();if(It.copy(i,0,u,0,c),c>0)for(var m=c;m<s;m++)It.copy(i,c-1,u,m,1);return u},It.reverse=function(n){for(var i=n.size()-1,s=Math.trunc(i/2),u=0;u<=s;u++)It.swap(n,u,i-u)},It.swap=function(n,i,s){if(i===s)return null;for(var u=0;u<n.getDimension();u++){var c=n.getOrdinate(i,u);n.setOrdinate(i,u,n.getOrdinate(s,u)),n.setOrdinate(s,u,c)}},It.copy=function(n,i,s,u,c){for(var m=0;m<c;m++)It.copyCoord(n,i+m,s,u+m)},It.toString=function(){if(arguments.length===1){var n=arguments[0],i=n.size();if(i===0)return"()";var s=n.getDimension(),u=new pt;u.append("(");for(var c=0;c<i;c++){c>0&&u.append(" ");for(var m=0;m<s;m++)m>0&&u.append(","),u.append(st.toString(n.getOrdinate(c,m)))}return u.append(")"),u.toString()}},It.ensureValidRing=function(n,i){var s=i.size();return s===0?i:s<=3?It.createClosedRing(n,i,4):i.getOrdinate(0,dt.X)===i.getOrdinate(s-1,dt.X)&&i.getOrdinate(0,dt.Y)===i.getOrdinate(s-1,dt.Y)?i:It.createClosedRing(n,i,s+1)},It.createClosedRing=function(n,i,s){var u=n.create(s,i.getDimension()),c=i.size();It.copy(i,0,u,0,c);for(var m=c;m<s;m++)It.copy(i,0,u,m,1);return u};var Bt=function(n){function i(u,c){n.call(this,c),this._points=null,this.init(u)}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.computeEnvelopeInternal=function(){return this.isEmpty()?new Pt:this._points.expandEnvelope(new Pt)},i.prototype.isRing=function(){return this.isClosed()&&this.isSimple()},i.prototype.getSortIndex=function(){return n.SORTINDEX_LINESTRING},i.prototype.getCoordinates=function(){return this._points.toCoordinateArray()},i.prototype.equalsExact=function(){if(arguments.length===2){var u=arguments[0],c=arguments[1];if(!this.isEquivalentClass(u))return!1;var m=u;if(this._points.size()!==m._points.size())return!1;for(var E=0;E<this._points.size();E++)if(!this.equal(this._points.getCoordinate(E),m._points.getCoordinate(E),c))return!1;return!0}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.normalize=function(){for(var u=0;u<Math.trunc(this._points.size()/2);u++){var c=this._points.size()-1-u;if(!this._points.getCoordinate(u).equals(this._points.getCoordinate(c)))return this._points.getCoordinate(u).compareTo(this._points.getCoordinate(c))>0&&It.reverse(this._points),null}},i.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},i.prototype.getBoundaryDimension=function(){return this.isClosed()?pe.FALSE:0},i.prototype.isClosed=function(){return!this.isEmpty()&&this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints()-1))},i.prototype.getEndPoint=function(){return this.isEmpty()?null:this.getPointN(this.getNumPoints()-1)},i.prototype.getDimension=function(){return 1},i.prototype.getLength=function(){return B.computeLength(this._points)},i.prototype.getNumPoints=function(){return this._points.size()},i.prototype.reverse=function(){var u=this._points.copy();return It.reverse(u),this.getFactory().createLineString(u)},i.prototype.compareToSameClass=function(){if(arguments.length===1){for(var u=arguments[0],c=0,m=0;c<this._points.size()&&m<u._points.size();){var E=this._points.getCoordinate(c).compareTo(u._points.getCoordinate(m));if(E!==0)return E;c++,m++}return c<this._points.size()?1:m<u._points.size()?-1:0}if(arguments.length===2){var A=arguments[0];return arguments[1].compare(this._points,A._points)}},i.prototype.apply=function(){if(X(arguments[0],Mt))for(var u=arguments[0],c=0;c<this._points.size();c++)u.filter(this._points.getCoordinate(c));else if(X(arguments[0],Vr)){var m=arguments[0];if(this._points.size()===0)return null;for(var E=0;E<this._points.size()&&(m.filter(this._points,E),!m.isDone());E++);m.isGeometryChanged()&&this.geometryChanged()}else X(arguments[0],ei)?arguments[0].filter(this):X(arguments[0],ct)&&arguments[0].filter(this)},i.prototype.getBoundary=function(){return new rt(this).getBoundary()},i.prototype.isEquivalentClass=function(u){return u instanceof i},i.prototype.clone=function(){var u=n.prototype.clone.call(this);return u._points=this._points.clone(),u},i.prototype.getCoordinateN=function(u){return this._points.getCoordinate(u)},i.prototype.getGeometryType=function(){return"LineString"},i.prototype.copy=function(){return new i(this._points.copy(),this._factory)},i.prototype.getCoordinateSequence=function(){return this._points},i.prototype.isEmpty=function(){return this._points.size()===0},i.prototype.init=function(u){if(u===null&&(u=this.getFactory().getCoordinateSequenceFactory().create([])),u.size()===1)throw new C("Invalid number of points in LineString (found "+u.size()+" - must be 0 or >= 2)");this._points=u},i.prototype.isCoordinate=function(u){for(var c=0;c<this._points.size();c++)if(this._points.getCoordinate(c).equals(u))return!0;return!1},i.prototype.getStartPoint=function(){return this.isEmpty()?null:this.getPointN(0)},i.prototype.getPointN=function(u){return this.getFactory().createPoint(this._points.getCoordinate(u))},i.prototype.interfaces_=function(){return[bs]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return 0x2b2b51ba435c8e00},Object.defineProperties(i,s),i}(Q),se=function(){};se.prototype.interfaces_=function(){return[]},se.prototype.getClass=function(){return se};var Qt=function(n){function i(u,c){n.call(this,c),this._coordinates=u||null,this.init(this._coordinates)}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.computeEnvelopeInternal=function(){if(this.isEmpty())return new Pt;var u=new Pt;return u.expandToInclude(this._coordinates.getX(0),this._coordinates.getY(0)),u},i.prototype.getSortIndex=function(){return n.SORTINDEX_POINT},i.prototype.getCoordinates=function(){return this.isEmpty()?[]:[this.getCoordinate()]},i.prototype.equalsExact=function(){if(arguments.length===2){var u=arguments[0],c=arguments[1];return!!this.isEquivalentClass(u)&&(!(!this.isEmpty()||!u.isEmpty())||this.isEmpty()===u.isEmpty()&&this.equal(u.getCoordinate(),this.getCoordinate(),c))}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.normalize=function(){},i.prototype.getCoordinate=function(){return this._coordinates.size()!==0?this._coordinates.getCoordinate(0):null},i.prototype.getBoundaryDimension=function(){return pe.FALSE},i.prototype.getDimension=function(){return 0},i.prototype.getNumPoints=function(){return this.isEmpty()?0:1},i.prototype.reverse=function(){return this.copy()},i.prototype.getX=function(){if(this.getCoordinate()===null)throw new Error("getX called on empty Point");return this.getCoordinate().x},i.prototype.compareToSameClass=function(){if(arguments.length===1){var u=arguments[0];return this.getCoordinate().compareTo(u.getCoordinate())}if(arguments.length===2){var c=arguments[0];return arguments[1].compare(this._coordinates,c._coordinates)}},i.prototype.apply=function(){if(X(arguments[0],Mt)){var u=arguments[0];if(this.isEmpty())return null;u.filter(this.getCoordinate())}else if(X(arguments[0],Vr)){var c=arguments[0];if(this.isEmpty())return null;c.filter(this._coordinates,0),c.isGeometryChanged()&&this.geometryChanged()}else X(arguments[0],ei)?arguments[0].filter(this):X(arguments[0],ct)&&arguments[0].filter(this)},i.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},i.prototype.clone=function(){var u=n.prototype.clone.call(this);return u._coordinates=this._coordinates.clone(),u},i.prototype.getGeometryType=function(){return"Point"},i.prototype.copy=function(){return new i(this._coordinates.copy(),this._factory)},i.prototype.getCoordinateSequence=function(){return this._coordinates},i.prototype.getY=function(){if(this.getCoordinate()===null)throw new Error("getY called on empty Point");return this.getCoordinate().y},i.prototype.isEmpty=function(){return this._coordinates.size()===0},i.prototype.init=function(u){u===null&&(u=this.getFactory().getCoordinateSequenceFactory().create([])),b.isTrue(u.size()<=1),this._coordinates=u},i.prototype.isSimple=function(){return!0},i.prototype.interfaces_=function(){return[se]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return 4902022702746615e3},Object.defineProperties(i,s),i}(Q),ce=function(){};ce.prototype.interfaces_=function(){return[]},ce.prototype.getClass=function(){return ce};var Vt=function(n){function i(u,c,m){if(n.call(this,m),this._shell=null,this._holes=null,u===null&&(u=this.getFactory().createLinearRing()),c===null&&(c=[]),n.hasNullElements(c))throw new C("holes must not contain null elements");if(u.isEmpty()&&n.hasNonEmptyElements(c))throw new C("shell is empty but holes are not");this._shell=u,this._holes=c}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.computeEnvelopeInternal=function(){return this._shell.getEnvelopeInternal()},i.prototype.getSortIndex=function(){return n.SORTINDEX_POLYGON},i.prototype.getCoordinates=function(){if(this.isEmpty())return[];for(var u=new Array(this.getNumPoints()).fill(null),c=-1,m=this._shell.getCoordinates(),E=0;E<m.length;E++)u[++c]=m[E];for(var A=0;A<this._holes.length;A++)for(var U=this._holes[A].getCoordinates(),Z=0;Z<U.length;Z++)u[++c]=U[Z];return u},i.prototype.getArea=function(){var u=0;u+=Math.abs(B.signedArea(this._shell.getCoordinateSequence()));for(var c=0;c<this._holes.length;c++)u-=Math.abs(B.signedArea(this._holes[c].getCoordinateSequence()));return u},i.prototype.isRectangle=function(){if(this.getNumInteriorRing()!==0||this._shell===null||this._shell.getNumPoints()!==5)return!1;for(var u=this._shell.getCoordinateSequence(),c=this.getEnvelopeInternal(),m=0;m<5;m++){var E=u.getX(m);if(E!==c.getMinX()&&E!==c.getMaxX())return!1;var A=u.getY(m);if(A!==c.getMinY()&&A!==c.getMaxY())return!1}for(var U=u.getX(0),Z=u.getY(0),ut=1;ut<=4;ut++){var ht=u.getX(ut),At=u.getY(ut);if(ht!==U==(At!==Z))return!1;U=ht,Z=At}return!0},i.prototype.equalsExact=function(){if(arguments.length===2){var u=arguments[0],c=arguments[1];if(!this.isEquivalentClass(u))return!1;var m=u,E=this._shell,A=m._shell;if(!E.equalsExact(A,c)||this._holes.length!==m._holes.length)return!1;for(var U=0;U<this._holes.length;U++)if(!this._holes[U].equalsExact(m._holes[U],c))return!1;return!0}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.normalize=function(){if(arguments.length===0){this.normalize(this._shell,!0);for(var u=0;u<this._holes.length;u++)this.normalize(this._holes[u],!1);Fi.sort(this._holes)}else if(arguments.length===2){var c=arguments[0],m=arguments[1];if(c.isEmpty())return null;var E=new Array(c.getCoordinates().length-1).fill(null);Nt.arraycopy(c.getCoordinates(),0,E,0,E.length);var A=ft.minCoordinate(c.getCoordinates());ft.scroll(E,A),Nt.arraycopy(E,0,c.getCoordinates(),0,E.length),c.getCoordinates()[E.length]=E[0],B.isCCW(c.getCoordinates())===m&&ft.reverse(c.getCoordinates())}},i.prototype.getCoordinate=function(){return this._shell.getCoordinate()},i.prototype.getNumInteriorRing=function(){return this._holes.length},i.prototype.getBoundaryDimension=function(){return 1},i.prototype.getDimension=function(){return 2},i.prototype.getLength=function(){var u=0;u+=this._shell.getLength();for(var c=0;c<this._holes.length;c++)u+=this._holes[c].getLength();return u},i.prototype.getNumPoints=function(){for(var u=this._shell.getNumPoints(),c=0;c<this._holes.length;c++)u+=this._holes[c].getNumPoints();return u},i.prototype.reverse=function(){var u=this.copy();u._shell=this._shell.copy().reverse(),u._holes=new Array(this._holes.length).fill(null);for(var c=0;c<this._holes.length;c++)u._holes[c]=this._holes[c].copy().reverse();return u},i.prototype.convexHull=function(){return this.getExteriorRing().convexHull()},i.prototype.compareToSameClass=function(){if(arguments.length===1){var u=arguments[0],c=this._shell,m=u._shell;return c.compareToSameClass(m)}if(arguments.length===2){var E=arguments[0],A=arguments[1],U=E,Z=this._shell,ut=U._shell,ht=Z.compareToSameClass(ut,A);if(ht!==0)return ht;for(var At=this.getNumInteriorRing(),Rt=U.getNumInteriorRing(),kt=0;kt<At&&kt<Rt;){var ee=this.getInteriorRingN(kt),on=U.getInteriorRingN(kt),In=ee.compareToSameClass(on,A);if(In!==0)return In;kt++}return kt<At?1:kt<Rt?-1:0}},i.prototype.apply=function(u){if(X(u,Mt)){this._shell.apply(u);for(var c=0;c<this._holes.length;c++)this._holes[c].apply(u)}else if(X(u,Vr)){if(this._shell.apply(u),!u.isDone())for(var m=0;m<this._holes.length&&(this._holes[m].apply(u),!u.isDone());m++);u.isGeometryChanged()&&this.geometryChanged()}else if(X(u,ei))u.filter(this);else if(X(u,ct)){u.filter(this),this._shell.apply(u);for(var E=0;E<this._holes.length;E++)this._holes[E].apply(u)}},i.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();var u=new Array(this._holes.length+1).fill(null);u[0]=this._shell;for(var c=0;c<this._holes.length;c++)u[c+1]=this._holes[c];return u.length<=1?this.getFactory().createLinearRing(u[0].getCoordinateSequence()):this.getFactory().createMultiLineString(u)},i.prototype.clone=function(){var u=n.prototype.clone.call(this);u._shell=this._shell.clone(),u._holes=new Array(this._holes.length).fill(null);for(var c=0;c<this._holes.length;c++)u._holes[c]=this._holes[c].clone();return u},i.prototype.getGeometryType=function(){return"Polygon"},i.prototype.copy=function(){for(var u=this._shell.copy(),c=new Array(this._holes.length).fill(null),m=0;m<c.length;m++)c[m]=this._holes[m].copy();return new i(u,c,this._factory)},i.prototype.getExteriorRing=function(){return this._shell},i.prototype.isEmpty=function(){return this._shell.isEmpty()},i.prototype.getInteriorRingN=function(u){return this._holes[u]},i.prototype.interfaces_=function(){return[ce]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return-0x307ffefd8dc97200},Object.defineProperties(i,s),i}(Q),fe=function(n){function i(){n.apply(this,arguments)}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.getSortIndex=function(){return Q.SORTINDEX_MULTIPOINT},i.prototype.isValid=function(){return!0},i.prototype.equalsExact=function(){if(arguments.length===2){var u=arguments[0],c=arguments[1];return!!this.isEquivalentClass(u)&&n.prototype.equalsExact.call(this,u,c)}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.getCoordinate=function(){if(arguments.length===1){var u=arguments[0];return this._geometries[u].getCoordinate()}return n.prototype.getCoordinate.apply(this,arguments)},i.prototype.getBoundaryDimension=function(){return pe.FALSE},i.prototype.getDimension=function(){return 0},i.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},i.prototype.getGeometryType=function(){return"MultiPoint"},i.prototype.copy=function(){for(var u=new Array(this._geometries.length).fill(null),c=0;c<u.length;c++)u[c]=this._geometries[c].copy();return new i(u,this._factory)},i.prototype.interfaces_=function(){return[se]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return-8048474874175356e3},Object.defineProperties(i,s),i}(Vn),sn=function(n){function i(u,c){u instanceof L&&c instanceof le&&(u=c.getCoordinateSequenceFactory().create(u)),n.call(this,u,c),this.validateConstruction()}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={MINIMUM_VALID_SIZE:{configurable:!0},serialVersionUID:{configurable:!0}};return i.prototype.getSortIndex=function(){return Q.SORTINDEX_LINEARRING},i.prototype.getBoundaryDimension=function(){return pe.FALSE},i.prototype.isClosed=function(){return!!this.isEmpty()||n.prototype.isClosed.call(this)},i.prototype.reverse=function(){var u=this._points.copy();return It.reverse(u),this.getFactory().createLinearRing(u)},i.prototype.validateConstruction=function(){if(!this.isEmpty()&&!n.prototype.isClosed.call(this))throw new C("Points of LinearRing do not form a closed linestring");if(this.getCoordinateSequence().size()>=1&&this.getCoordinateSequence().size()<i.MINIMUM_VALID_SIZE)throw new C("Invalid number of points in LinearRing (found "+this.getCoordinateSequence().size()+" - must be 0 or >= 4)")},i.prototype.getGeometryType=function(){return"LinearRing"},i.prototype.copy=function(){return new i(this._points.copy(),this._factory)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},s.MINIMUM_VALID_SIZE.get=function(){return 4},s.serialVersionUID.get=function(){return-0x3b229e262367a600},Object.defineProperties(i,s),i}(Bt),un=function(n){function i(){n.apply(this,arguments)}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.getSortIndex=function(){return Q.SORTINDEX_MULTIPOLYGON},i.prototype.equalsExact=function(){if(arguments.length===2){var u=arguments[0],c=arguments[1];return!!this.isEquivalentClass(u)&&n.prototype.equalsExact.call(this,u,c)}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.getBoundaryDimension=function(){return 1},i.prototype.getDimension=function(){return 2},i.prototype.reverse=function(){for(var u=this._geometries.length,c=new Array(u).fill(null),m=0;m<this._geometries.length;m++)c[m]=this._geometries[m].reverse();return this.getFactory().createMultiPolygon(c)},i.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();for(var u=new j,c=0;c<this._geometries.length;c++)for(var m=this._geometries[c].getBoundary(),E=0;E<m.getNumGeometries();E++)u.add(m.getGeometryN(E));var A=new Array(u.size()).fill(null);return this.getFactory().createMultiLineString(u.toArray(A))},i.prototype.getGeometryType=function(){return"MultiPolygon"},i.prototype.copy=function(){for(var u=new Array(this._geometries.length).fill(null),c=0;c<u.length;c++)u[c]=this._geometries[c].copy();return new i(u,this._factory)},i.prototype.interfaces_=function(){return[ce]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return-0x7a5aa1369171980},Object.defineProperties(i,s),i}(Vn),vn=function(n){this._factory=n||null,this._isUserDataCopied=!1},ni={NoOpGeometryOperation:{configurable:!0},CoordinateOperation:{configurable:!0},CoordinateSequenceOperation:{configurable:!0}};vn.prototype.setCopyUserData=function(n){this._isUserDataCopied=n},vn.prototype.edit=function(n,i){if(n===null)return null;var s=this.editInternal(n,i);return this._isUserDataCopied&&s.setUserData(n.getUserData()),s},vn.prototype.editInternal=function(n,i){return this._factory===null&&(this._factory=n.getFactory()),n instanceof Vn?this.editGeometryCollection(n,i):n instanceof Vt?this.editPolygon(n,i):n instanceof Qt?i.edit(n,this._factory):n instanceof Bt?i.edit(n,this._factory):(b.shouldNeverReachHere("Unsupported Geometry class: "+n.getClass().getName()),null)},vn.prototype.editGeometryCollection=function(n,i){for(var s=i.edit(n,this._factory),u=new j,c=0;c<s.getNumGeometries();c++){var m=this.edit(s.getGeometryN(c),i);m===null||m.isEmpty()||u.add(m)}return s.getClass()===fe?this._factory.createMultiPoint(u.toArray([])):s.getClass()===H?this._factory.createMultiLineString(u.toArray([])):s.getClass()===un?this._factory.createMultiPolygon(u.toArray([])):this._factory.createGeometryCollection(u.toArray([]))},vn.prototype.editPolygon=function(n,i){var s=i.edit(n,this._factory);if(s===null&&(s=this._factory.createPolygon(null)),s.isEmpty())return s;var u=this.edit(s.getExteriorRing(),i);if(u===null||u.isEmpty())return this._factory.createPolygon();for(var c=new j,m=0;m<s.getNumInteriorRing();m++){var E=this.edit(s.getInteriorRingN(m),i);E===null||E.isEmpty()||c.add(E)}return this._factory.createPolygon(u,c.toArray([]))},vn.prototype.interfaces_=function(){return[]},vn.prototype.getClass=function(){return vn},vn.GeometryEditorOperation=function(){},ni.NoOpGeometryOperation.get=function(){return En},ni.CoordinateOperation.get=function(){return de},ni.CoordinateSequenceOperation.get=function(){return xo},Object.defineProperties(vn,ni);var En=function(){};En.prototype.edit=function(n,i){return n},En.prototype.interfaces_=function(){return[vn.GeometryEditorOperation]},En.prototype.getClass=function(){return En};var de=function(){};de.prototype.edit=function(n,i){var s=this.editCoordinates(n.getCoordinates(),n);return s===null?n:n instanceof sn?i.createLinearRing(s):n instanceof Bt?i.createLineString(s):n instanceof Qt?s.length>0?i.createPoint(s[0]):i.createPoint():n},de.prototype.interfaces_=function(){return[vn.GeometryEditorOperation]},de.prototype.getClass=function(){return de};var xo=function(){};xo.prototype.edit=function(n,i){return n instanceof sn?i.createLinearRing(this.edit(n.getCoordinateSequence(),n)):n instanceof Bt?i.createLineString(this.edit(n.getCoordinateSequence(),n)):n instanceof Qt?i.createPoint(this.edit(n.getCoordinateSequence(),n)):n},xo.prototype.interfaces_=function(){return[vn.GeometryEditorOperation]},xo.prototype.getClass=function(){return xo};var he=function(){if(this._dimension=3,this._coordinates=null,arguments.length===1){if(arguments[0]instanceof Array)this._coordinates=arguments[0],this._dimension=3;else if(Number.isInteger(arguments[0])){var n=arguments[0];this._coordinates=new Array(n).fill(null);for(var i=0;i<n;i++)this._coordinates[i]=new L}else if(X(arguments[0],dt)){var s=arguments[0];if(s===null)return this._coordinates=new Array(0).fill(null),null;this._dimension=s.getDimension(),this._coordinates=new Array(s.size()).fill(null);for(var u=0;u<this._coordinates.length;u++)this._coordinates[u]=s.getCoordinateCopy(u)}}else if(arguments.length===2){if(arguments[0]instanceof Array&&Number.isInteger(arguments[1])){var c=arguments[0],m=arguments[1];this._coordinates=c,this._dimension=m,c===null&&(this._coordinates=new Array(0).fill(null))}else if(Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var E=arguments[0],A=arguments[1];this._coordinates=new Array(E).fill(null),this._dimension=A;for(var U=0;U<E;U++)this._coordinates[U]=new L}}},no={serialVersionUID:{configurable:!0}};he.prototype.setOrdinate=function(n,i,s){switch(i){case dt.X:this._coordinates[n].x=s;break;case dt.Y:this._coordinates[n].y=s;break;case dt.Z:this._coordinates[n].z=s;break;default:throw new C("invalid ordinateIndex")}},he.prototype.size=function(){return this._coordinates.length},he.prototype.getOrdinate=function(n,i){switch(i){case dt.X:return this._coordinates[n].x;case dt.Y:return this._coordinates[n].y;case dt.Z:return this._coordinates[n].z}return S.NaN},he.prototype.getCoordinate=function(){if(arguments.length===1){var n=arguments[0];return this._coordinates[n]}if(arguments.length===2){var i=arguments[0],s=arguments[1];s.x=this._coordinates[i].x,s.y=this._coordinates[i].y,s.z=this._coordinates[i].z}},he.prototype.getCoordinateCopy=function(n){return new L(this._coordinates[n])},he.prototype.getDimension=function(){return this._dimension},he.prototype.getX=function(n){return this._coordinates[n].x},he.prototype.clone=function(){for(var n=new Array(this.size()).fill(null),i=0;i<this._coordinates.length;i++)n[i]=this._coordinates[i].clone();return new he(n,this._dimension)},he.prototype.expandEnvelope=function(n){for(var i=0;i<this._coordinates.length;i++)n.expandToInclude(this._coordinates[i]);return n},he.prototype.copy=function(){for(var n=new Array(this.size()).fill(null),i=0;i<this._coordinates.length;i++)n[i]=this._coordinates[i].copy();return new he(n,this._dimension)},he.prototype.toString=function(){if(this._coordinates.length>0){var n=new pt(17*this._coordinates.length);n.append("("),n.append(this._coordinates[0]);for(var i=1;i<this._coordinates.length;i++)n.append(", "),n.append(this._coordinates[i]);return n.append(")"),n.toString()}return"()"},he.prototype.getY=function(n){return this._coordinates[n].y},he.prototype.toCoordinateArray=function(){return this._coordinates},he.prototype.interfaces_=function(){return[dt,t]},he.prototype.getClass=function(){return he},no.serialVersionUID.get=function(){return-0xcb44a778db18e00},Object.defineProperties(he,no);var ri=function(){},Eo={serialVersionUID:{configurable:!0},instanceObject:{configurable:!0}};ri.prototype.readResolve=function(){return ri.instance()},ri.prototype.create=function(){if(arguments.length===1){if(arguments[0]instanceof Array){var n=arguments[0];return new he(n)}if(X(arguments[0],dt)){var i=arguments[0];return new he(i)}}else if(arguments.length===2){var s=arguments[0],u=arguments[1];return u>3&&(u=3),u<2?new he(s):new he(s,u)}},ri.prototype.interfaces_=function(){return[nt,t]},ri.prototype.getClass=function(){return ri},ri.instance=function(){return ri.instanceObject},Eo.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00},Eo.instanceObject.get=function(){return new ri},Object.defineProperties(ri,Eo);var oa=function(n){function i(){n.call(this),this.map_=new Map}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.get=function(s){return this.map_.get(s)||null},i.prototype.put=function(s,u){return this.map_.set(s,u),u},i.prototype.values=function(){for(var s=new j,u=this.map_.values(),c=u.next();!c.done;)s.add(c.value),c=u.next();return s},i.prototype.entrySet=function(){var s=new $n;return this.map_.entries().forEach(function(u){return s.add(u)}),s},i.prototype.size=function(){return this.map_.size()},i}(He),ie=function n(){if(this._modelType=null,this._scale=null,arguments.length===0)this._modelType=n.FLOATING;else if(arguments.length===1){if(arguments[0]instanceof Lr){var i=arguments[0];this._modelType=i,i===n.FIXED&&this.setScale(1)}else if(typeof arguments[0]=="number"){var s=arguments[0];this._modelType=n.FIXED,this.setScale(s)}else if(arguments[0]instanceof n){var u=arguments[0];this._modelType=u._modelType,this._scale=u._scale}}},Ui={serialVersionUID:{configurable:!0},maximumPreciseValue:{configurable:!0}};ie.prototype.equals=function(n){if(!(n instanceof ie))return!1;var i=n;return this._modelType===i._modelType&&this._scale===i._scale},ie.prototype.compareTo=function(n){var i=n,s=this.getMaximumSignificantDigits(),u=i.getMaximumSignificantDigits();return new et(s).compareTo(new et(u))},ie.prototype.getScale=function(){return this._scale},ie.prototype.isFloating=function(){return this._modelType===ie.FLOATING||this._modelType===ie.FLOATING_SINGLE},ie.prototype.getType=function(){return this._modelType},ie.prototype.toString=function(){var n="UNKNOWN";return this._modelType===ie.FLOATING?n="Floating":this._modelType===ie.FLOATING_SINGLE?n="Floating-Single":this._modelType===ie.FIXED&&(n="Fixed (Scale="+this.getScale()+")"),n},ie.prototype.makePrecise=function(){if(typeof arguments[0]=="number"){var n=arguments[0];return S.isNaN(n)||this._modelType===ie.FLOATING_SINGLE?n:this._modelType===ie.FIXED?Math.round(n*this._scale)/this._scale:n}if(arguments[0]instanceof L){var i=arguments[0];if(this._modelType===ie.FLOATING)return null;i.x=this.makePrecise(i.x),i.y=this.makePrecise(i.y)}},ie.prototype.getMaximumSignificantDigits=function(){var n=16;return this._modelType===ie.FLOATING?n=16:this._modelType===ie.FLOATING_SINGLE?n=6:this._modelType===ie.FIXED&&(n=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),n},ie.prototype.setScale=function(n){this._scale=Math.abs(n)},ie.prototype.interfaces_=function(){return[t,F]},ie.prototype.getClass=function(){return ie},ie.mostPrecise=function(n,i){return n.compareTo(i)>=0?n:i},Ui.serialVersionUID.get=function(){return 7777263578777804e3},Ui.maximumPreciseValue.get=function(){return 9007199254740992},Object.defineProperties(ie,Ui);var Lr=function n(i){this._name=i||null,n.nameToTypeMap.put(i,this)},xr={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}};Lr.prototype.readResolve=function(){return Lr.nameToTypeMap.get(this._name)},Lr.prototype.toString=function(){return this._name},Lr.prototype.interfaces_=function(){return[t]},Lr.prototype.getClass=function(){return Lr},xr.serialVersionUID.get=function(){return-552860263173159e4},xr.nameToTypeMap.get=function(){return new oa},Object.defineProperties(Lr,xr),ie.Type=Lr,ie.FIXED=new Lr("FIXED"),ie.FLOATING=new Lr("FLOATING"),ie.FLOATING_SINGLE=new Lr("FLOATING SINGLE");var le=function n(){this._precisionModel=new ie,this._SRID=0,this._coordinateSequenceFactory=n.getDefaultCoordinateSequenceFactory(),arguments.length===0||(arguments.length===1?X(arguments[0],nt)?this._coordinateSequenceFactory=arguments[0]:arguments[0]instanceof ie&&(this._precisionModel=arguments[0]):arguments.length===2?(this._precisionModel=arguments[0],this._SRID=arguments[1]):arguments.length===3&&(this._precisionModel=arguments[0],this._SRID=arguments[1],this._coordinateSequenceFactory=arguments[2]))},gl={serialVersionUID:{configurable:!0}};le.prototype.toGeometry=function(n){return n.isNull()?this.createPoint(null):n.getMinX()===n.getMaxX()&&n.getMinY()===n.getMaxY()?this.createPoint(new L(n.getMinX(),n.getMinY())):n.getMinX()===n.getMaxX()||n.getMinY()===n.getMaxY()?this.createLineString([new L(n.getMinX(),n.getMinY()),new L(n.getMaxX(),n.getMaxY())]):this.createPolygon(this.createLinearRing([new L(n.getMinX(),n.getMinY()),new L(n.getMinX(),n.getMaxY()),new L(n.getMaxX(),n.getMaxY()),new L(n.getMaxX(),n.getMinY()),new L(n.getMinX(),n.getMinY())]),null)},le.prototype.createLineString=function(n){return n?n instanceof Array?new Bt(this.getCoordinateSequenceFactory().create(n),this):X(n,dt)?new Bt(n,this):void 0:new Bt(this.getCoordinateSequenceFactory().create([]),this)},le.prototype.createMultiLineString=function(){if(arguments.length===0)return new H(null,this);if(arguments.length===1){var n=arguments[0];return new H(n,this)}},le.prototype.buildGeometry=function(n){for(var i=null,s=!1,u=!1,c=n.iterator();c.hasNext();){var m=c.next(),E=m.getClass();i===null&&(i=E),E!==i&&(s=!0),m.isGeometryCollectionOrDerived()&&(u=!0)}if(i===null)return this.createGeometryCollection();if(s||u)return this.createGeometryCollection(le.toGeometryArray(n));var A=n.iterator().next();if(n.size()>1){if(A instanceof Vt)return this.createMultiPolygon(le.toPolygonArray(n));if(A instanceof Bt)return this.createMultiLineString(le.toLineStringArray(n));if(A instanceof Qt)return this.createMultiPoint(le.toPointArray(n));b.shouldNeverReachHere("Unhandled class: "+A.getClass().getName())}return A},le.prototype.createMultiPointFromCoords=function(n){return this.createMultiPoint(n!==null?this.getCoordinateSequenceFactory().create(n):null)},le.prototype.createPoint=function(){if(arguments.length===0)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof L){var n=arguments[0];return this.createPoint(n!==null?this.getCoordinateSequenceFactory().create([n]):null)}if(X(arguments[0],dt)){var i=arguments[0];return new Qt(i,this)}}},le.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory},le.prototype.createPolygon=function(){if(arguments.length===0)return new Vt(null,null,this);if(arguments.length===1){if(X(arguments[0],dt)){var n=arguments[0];return this.createPolygon(this.createLinearRing(n))}if(arguments[0]instanceof Array){var i=arguments[0];return this.createPolygon(this.createLinearRing(i))}if(arguments[0]instanceof sn){var s=arguments[0];return this.createPolygon(s,null)}}else if(arguments.length===2){var u=arguments[0],c=arguments[1];return new Vt(u,c,this)}},le.prototype.getSRID=function(){return this._SRID},le.prototype.createGeometryCollection=function(){if(arguments.length===0)return new Vn(null,this);if(arguments.length===1){var n=arguments[0];return new Vn(n,this)}},le.prototype.createGeometry=function(n){return new vn(this).edit(n,{edit:function(){if(arguments.length===2){var i=arguments[0];return this._coordinateSequenceFactory.create(i)}}})},le.prototype.getPrecisionModel=function(){return this._precisionModel},le.prototype.createLinearRing=function(){if(arguments.length===0)return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Array){var n=arguments[0];return this.createLinearRing(n!==null?this.getCoordinateSequenceFactory().create(n):null)}if(X(arguments[0],dt)){var i=arguments[0];return new sn(i,this)}}},le.prototype.createMultiPolygon=function(){if(arguments.length===0)return new un(null,this);if(arguments.length===1){var n=arguments[0];return new un(n,this)}},le.prototype.createMultiPoint=function(){if(arguments.length===0)return new fe(null,this);if(arguments.length===1){if(arguments[0]instanceof Array){var n=arguments[0];return new fe(n,this)}if(arguments[0]instanceof Array){var i=arguments[0];return this.createMultiPoint(i!==null?this.getCoordinateSequenceFactory().create(i):null)}if(X(arguments[0],dt)){var s=arguments[0];if(s===null)return this.createMultiPoint(new Array(0).fill(null));for(var u=new Array(s.size()).fill(null),c=0;c<s.size();c++){var m=this.getCoordinateSequenceFactory().create(1,s.getDimension());It.copy(s,c,m,0,1),u[c]=this.createPoint(m)}return this.createMultiPoint(u)}}},le.prototype.interfaces_=function(){return[t]},le.prototype.getClass=function(){return le},le.toMultiPolygonArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},le.toGeometryArray=function(n){if(n===null)return null;var i=new Array(n.size()).fill(null);return n.toArray(i)},le.getDefaultCoordinateSequenceFactory=function(){return ri.instance()},le.toMultiLineStringArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},le.toLineStringArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},le.toMultiPointArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},le.toLinearRingArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},le.toPointArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},le.toPolygonArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},le.createPointFromInternalCoord=function(n,i){return i.getPrecisionModel().makePrecise(n),i.getFactory().createPoint(n)},gl.serialVersionUID.get=function(){return-6820524753094096e3},Object.defineProperties(le,gl);var yl=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],vl=function(n){this.geometryFactory=n||new le};vl.prototype.read=function(n){var i,s=(i=typeof n=="string"?JSON.parse(n):n).type;if(!Si[s])throw new Error("Unknown GeoJSON type: "+i.type);return yl.indexOf(s)!==-1?Si[s].apply(this,[i.coordinates]):s==="GeometryCollection"?Si[s].apply(this,[i.geometries]):Si[s].apply(this,[i])},vl.prototype.write=function(n){var i=n.getGeometryType();if(!ro[i])throw new Error("Geometry is not supported");return ro[i].apply(this,[n])};var Si={Feature:function(n){var i={};for(var s in n)i[s]=n[s];if(n.geometry){var u=n.geometry.type;if(!Si[u])throw new Error("Unknown GeoJSON type: "+n.type);i.geometry=this.read(n.geometry)}return n.bbox&&(i.bbox=Si.bbox.apply(this,[n.bbox])),i},FeatureCollection:function(n){var i={};if(n.features){i.features=[];for(var s=0;s<n.features.length;++s)i.features.push(this.read(n.features[s]))}return n.bbox&&(i.bbox=this.parse.bbox.apply(this,[n.bbox])),i},coordinates:function(n){for(var i=[],s=0;s<n.length;++s){var u=n[s];i.push(new L(u[0],u[1]))}return i},bbox:function(n){return this.geometryFactory.createLinearRing([new L(n[0],n[1]),new L(n[2],n[1]),new L(n[2],n[3]),new L(n[0],n[3]),new L(n[0],n[1])])},Point:function(n){var i=new L(n[0],n[1]);return this.geometryFactory.createPoint(i)},MultiPoint:function(n){for(var i=[],s=0;s<n.length;++s)i.push(Si.Point.apply(this,[n[s]]));return this.geometryFactory.createMultiPoint(i)},LineString:function(n){var i=Si.coordinates.apply(this,[n]);return this.geometryFactory.createLineString(i)},MultiLineString:function(n){for(var i=[],s=0;s<n.length;++s)i.push(Si.LineString.apply(this,[n[s]]));return this.geometryFactory.createMultiLineString(i)},Polygon:function(n){for(var i=Si.coordinates.apply(this,[n[0]]),s=this.geometryFactory.createLinearRing(i),u=[],c=1;c<n.length;++c){var m=n[c],E=Si.coordinates.apply(this,[m]),A=this.geometryFactory.createLinearRing(E);u.push(A)}return this.geometryFactory.createPolygon(s,u)},MultiPolygon:function(n){for(var i=[],s=0;s<n.length;++s){var u=n[s];i.push(Si.Polygon.apply(this,[u]))}return this.geometryFactory.createMultiPolygon(i)},GeometryCollection:function(n){for(var i=[],s=0;s<n.length;++s){var u=n[s];i.push(this.read(u))}return this.geometryFactory.createGeometryCollection(i)}},ro={coordinate:function(n){return[n.x,n.y]},Point:function(n){return{type:"Point",coordinates:ro.coordinate.apply(this,[n.getCoordinate()])}},MultiPoint:function(n){for(var i=[],s=0;s<n._geometries.length;++s){var u=n._geometries[s],c=ro.Point.apply(this,[u]);i.push(c.coordinates)}return{type:"MultiPoint",coordinates:i}},LineString:function(n){for(var i=[],s=n.getCoordinates(),u=0;u<s.length;++u){var c=s[u];i.push(ro.coordinate.apply(this,[c]))}return{type:"LineString",coordinates:i}},MultiLineString:function(n){for(var i=[],s=0;s<n._geometries.length;++s){var u=n._geometries[s],c=ro.LineString.apply(this,[u]);i.push(c.coordinates)}return{type:"MultiLineString",coordinates:i}},Polygon:function(n){var i=[],s=ro.LineString.apply(this,[n._shell]);i.push(s.coordinates);for(var u=0;u<n._holes.length;++u){var c=n._holes[u],m=ro.LineString.apply(this,[c]);i.push(m.coordinates)}return{type:"Polygon",coordinates:i}},MultiPolygon:function(n){for(var i=[],s=0;s<n._geometries.length;++s){var u=n._geometries[s],c=ro.Polygon.apply(this,[u]);i.push(c.coordinates)}return{type:"MultiPolygon",coordinates:i}},GeometryCollection:function(n){for(var i=[],s=0;s<n._geometries.length;++s){var u=n._geometries[s],c=u.getGeometryType();i.push(ro[c].apply(this,[u]))}return{type:"GeometryCollection",geometries:i}}},gf=function(n){this.geometryFactory=n||new le,this.precisionModel=this.geometryFactory.getPrecisionModel(),this.parser=new vl(this.geometryFactory)};gf.prototype.read=function(n){var i=this.parser.read(n);return this.precisionModel.getType()===ie.FIXED&&this.reducePrecision(i),i},gf.prototype.reducePrecision=function(n){var i,s;if(n.coordinate)this.precisionModel.makePrecise(n.coordinate);else if(n.points)for(i=0,s=n.points.length;i<s;i++)this.precisionModel.makePrecise(n.points[i]);else if(n.geometries)for(i=0,s=n.geometries.length;i<s;i++)this.reducePrecision(n.geometries[i])};var Gd=function(){this.parser=new vl(this.geometryFactory)};Gd.prototype.write=function(n){return this.parser.write(n)};var bt=function(){},_l={ON:{configurable:!0},LEFT:{configurable:!0},RIGHT:{configurable:!0}};bt.prototype.interfaces_=function(){return[]},bt.prototype.getClass=function(){return bt},bt.opposite=function(n){return n===bt.LEFT?bt.RIGHT:n===bt.RIGHT?bt.LEFT:n},_l.ON.get=function(){return 0},_l.LEFT.get=function(){return 1},_l.RIGHT.get=function(){return 2},Object.defineProperties(bt,_l),(T.prototype=new Error).name="EmptyStackException",(x.prototype=new wt).add=function(n){return this.array_.push(n),!0},x.prototype.get=function(n){if(n<0||n>=this.size())throw new Error;return this.array_[n]},x.prototype.push=function(n){return this.array_.push(n),n},x.prototype.pop=function(n){if(this.array_.length===0)throw new T;return this.array_.pop()},x.prototype.peek=function(){if(this.array_.length===0)throw new T;return this.array_[this.array_.length-1]},x.prototype.empty=function(){return this.array_.length===0},x.prototype.isEmpty=function(){return this.empty()},x.prototype.search=function(n){return this.array_.indexOf(n)},x.prototype.size=function(){return this.array_.length},x.prototype.toArray=function(){for(var n=[],i=0,s=this.array_.length;i<s;i++)n.push(this.array_[i]);return n};var wi=function(){this._minIndex=-1,this._minCoord=null,this._minDe=null,this._orientedDe=null};wi.prototype.getCoordinate=function(){return this._minCoord},wi.prototype.getRightmostSide=function(n,i){var s=this.getRightmostSideOfSegment(n,i);return s<0&&(s=this.getRightmostSideOfSegment(n,i-1)),s<0&&(this._minCoord=null,this.checkForRightmostCoordinate(n)),s},wi.prototype.findRightmostEdgeAtVertex=function(){var n=this._minDe.getEdge().getCoordinates();b.isTrue(this._minIndex>0&&this._minIndex<n.length,"rightmost point expected to be interior vertex of edge");var i=n[this._minIndex-1],s=n[this._minIndex+1],u=B.computeOrientation(this._minCoord,s,i),c=!1;(i.y<this._minCoord.y&&s.y<this._minCoord.y&&u===B.COUNTERCLOCKWISE||i.y>this._minCoord.y&&s.y>this._minCoord.y&&u===B.CLOCKWISE)&&(c=!0),c&&(this._minIndex=this._minIndex-1)},wi.prototype.getRightmostSideOfSegment=function(n,i){var s=n.getEdge().getCoordinates();if(i<0||i+1>=s.length||s[i].y===s[i+1].y)return-1;var u=bt.LEFT;return s[i].y<s[i+1].y&&(u=bt.RIGHT),u},wi.prototype.getEdge=function(){return this._orientedDe},wi.prototype.checkForRightmostCoordinate=function(n){for(var i=n.getEdge().getCoordinates(),s=0;s<i.length-1;s++)(this._minCoord===null||i[s].x>this._minCoord.x)&&(this._minDe=n,this._minIndex=s,this._minCoord=i[s])},wi.prototype.findRightmostEdgeAtNode=function(){var n=this._minDe.getNode().getEdges();this._minDe=n.getRightmostEdge(),this._minDe.isForward()||(this._minDe=this._minDe.getSym(),this._minIndex=this._minDe.getEdge().getCoordinates().length-1)},wi.prototype.findEdge=function(n){for(var i=n.iterator();i.hasNext();){var s=i.next();s.isForward()&&this.checkForRightmostCoordinate(s)}b.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)===bt.LEFT&&(this._orientedDe=this._minDe.getSym())},wi.prototype.interfaces_=function(){return[]},wi.prototype.getClass=function(){return wi};var io=function(n){function i(s,u){n.call(this,i.msgWithCoord(s,u)),this.pt=u?new L(u):null,this.name="TopologyException"}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.getCoordinate=function(){return this.pt},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i.msgWithCoord=function(s,u){return u?s:s+" [ "+u+" ]"},i}($),xl=function(){this.array_=[]};xl.prototype.addLast=function(n){this.array_.push(n)},xl.prototype.removeFirst=function(){return this.array_.shift()},xl.prototype.isEmpty=function(){return this.array_.length===0};var sr=function(){this._finder=null,this._dirEdgeList=new j,this._nodes=new j,this._rightMostCoord=null,this._env=null,this._finder=new wi};sr.prototype.clearVisitedEdges=function(){for(var n=this._dirEdgeList.iterator();n.hasNext();)n.next().setVisited(!1)},sr.prototype.getRightmostCoordinate=function(){return this._rightMostCoord},sr.prototype.computeNodeDepth=function(n){for(var i=null,s=n.getEdges().iterator();s.hasNext();){var u=s.next();if(u.isVisited()||u.getSym().isVisited()){i=u;break}}if(i===null)throw new io("unable to find edge to compute depths at "+n.getCoordinate());n.getEdges().computeDepths(i);for(var c=n.getEdges().iterator();c.hasNext();){var m=c.next();m.setVisited(!0),this.copySymDepths(m)}},sr.prototype.computeDepth=function(n){this.clearVisitedEdges();var i=this._finder.getEdge();i.setEdgeDepths(bt.RIGHT,n),this.copySymDepths(i),this.computeDepths(i)},sr.prototype.create=function(n){this.addReachable(n),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()},sr.prototype.findResultEdges=function(){for(var n=this._dirEdgeList.iterator();n.hasNext();){var i=n.next();i.getDepth(bt.RIGHT)>=1&&i.getDepth(bt.LEFT)<=0&&!i.isInteriorAreaEdge()&&i.setInResult(!0)}},sr.prototype.computeDepths=function(n){var i=new $n,s=new xl,u=n.getNode();for(s.addLast(u),i.add(u),n.setVisited(!0);!s.isEmpty();){var c=s.removeFirst();i.add(c),this.computeNodeDepth(c);for(var m=c.getEdges().iterator();m.hasNext();){var E=m.next().getSym();if(!E.isVisited()){var A=E.getNode();i.contains(A)||(s.addLast(A),i.add(A))}}}},sr.prototype.compareTo=function(n){var i=n;return this._rightMostCoord.x<i._rightMostCoord.x?-1:this._rightMostCoord.x>i._rightMostCoord.x?1:0},sr.prototype.getEnvelope=function(){if(this._env===null){for(var n=new Pt,i=this._dirEdgeList.iterator();i.hasNext();)for(var s=i.next().getEdge().getCoordinates(),u=0;u<s.length-1;u++)n.expandToInclude(s[u]);this._env=n}return this._env},sr.prototype.addReachable=function(n){var i=new x;for(i.add(n);!i.empty();){var s=i.pop();this.add(s,i)}},sr.prototype.copySymDepths=function(n){var i=n.getSym();i.setDepth(bt.LEFT,n.getDepth(bt.RIGHT)),i.setDepth(bt.RIGHT,n.getDepth(bt.LEFT))},sr.prototype.add=function(n,i){n.setVisited(!0),this._nodes.add(n);for(var s=n.getEdges().iterator();s.hasNext();){var u=s.next();this._dirEdgeList.add(u);var c=u.getSym().getNode();c.isVisited()||i.push(c)}},sr.prototype.getNodes=function(){return this._nodes},sr.prototype.getDirectedEdges=function(){return this._dirEdgeList},sr.prototype.interfaces_=function(){return[F]},sr.prototype.getClass=function(){return sr};var hn=function n(){if(this.location=null,arguments.length===1){if(arguments[0]instanceof Array){var i=arguments[0];this.init(i.length)}else if(Number.isInteger(arguments[0])){var s=arguments[0];this.init(1),this.location[bt.ON]=s}else if(arguments[0]instanceof n){var u=arguments[0];if(this.init(u.location.length),u!==null)for(var c=0;c<this.location.length;c++)this.location[c]=u.location[c]}}else if(arguments.length===3){var m=arguments[0],E=arguments[1],A=arguments[2];this.init(3),this.location[bt.ON]=m,this.location[bt.LEFT]=E,this.location[bt.RIGHT]=A}};hn.prototype.setAllLocations=function(n){for(var i=0;i<this.location.length;i++)this.location[i]=n},hn.prototype.isNull=function(){for(var n=0;n<this.location.length;n++)if(this.location[n]!==k.NONE)return!1;return!0},hn.prototype.setAllLocationsIfNull=function(n){for(var i=0;i<this.location.length;i++)this.location[i]===k.NONE&&(this.location[i]=n)},hn.prototype.isLine=function(){return this.location.length===1},hn.prototype.merge=function(n){if(n.location.length>this.location.length){var i=new Array(3).fill(null);i[bt.ON]=this.location[bt.ON],i[bt.LEFT]=k.NONE,i[bt.RIGHT]=k.NONE,this.location=i}for(var s=0;s<this.location.length;s++)this.location[s]===k.NONE&&s<n.location.length&&(this.location[s]=n.location[s])},hn.prototype.getLocations=function(){return this.location},hn.prototype.flip=function(){if(this.location.length<=1)return null;var n=this.location[bt.LEFT];this.location[bt.LEFT]=this.location[bt.RIGHT],this.location[bt.RIGHT]=n},hn.prototype.toString=function(){var n=new pt;return this.location.length>1&&n.append(k.toLocationSymbol(this.location[bt.LEFT])),n.append(k.toLocationSymbol(this.location[bt.ON])),this.location.length>1&&n.append(k.toLocationSymbol(this.location[bt.RIGHT])),n.toString()},hn.prototype.setLocations=function(n,i,s){this.location[bt.ON]=n,this.location[bt.LEFT]=i,this.location[bt.RIGHT]=s},hn.prototype.get=function(n){return n<this.location.length?this.location[n]:k.NONE},hn.prototype.isArea=function(){return this.location.length>1},hn.prototype.isAnyNull=function(){for(var n=0;n<this.location.length;n++)if(this.location[n]===k.NONE)return!0;return!1},hn.prototype.setLocation=function(){if(arguments.length===1){var n=arguments[0];this.setLocation(bt.ON,n)}else if(arguments.length===2){var i=arguments[0],s=arguments[1];this.location[i]=s}},hn.prototype.init=function(n){this.location=new Array(n).fill(null),this.setAllLocations(k.NONE)},hn.prototype.isEqualOnSide=function(n,i){return this.location[i]===n.location[i]},hn.prototype.allPositionsEqual=function(n){for(var i=0;i<this.location.length;i++)if(this.location[i]!==n)return!1;return!0},hn.prototype.interfaces_=function(){return[]},hn.prototype.getClass=function(){return hn};var rn=function n(){if(this.elt=new Array(2).fill(null),arguments.length===1){if(Number.isInteger(arguments[0])){var i=arguments[0];this.elt[0]=new hn(i),this.elt[1]=new hn(i)}else if(arguments[0]instanceof n){var s=arguments[0];this.elt[0]=new hn(s.elt[0]),this.elt[1]=new hn(s.elt[1])}}else if(arguments.length===2){var u=arguments[0],c=arguments[1];this.elt[0]=new hn(k.NONE),this.elt[1]=new hn(k.NONE),this.elt[u].setLocation(c)}else if(arguments.length===3){var m=arguments[0],E=arguments[1],A=arguments[2];this.elt[0]=new hn(m,E,A),this.elt[1]=new hn(m,E,A)}else if(arguments.length===4){var U=arguments[0],Z=arguments[1],ut=arguments[2],ht=arguments[3];this.elt[0]=new hn(k.NONE,k.NONE,k.NONE),this.elt[1]=new hn(k.NONE,k.NONE,k.NONE),this.elt[U].setLocations(Z,ut,ht)}};rn.prototype.getGeometryCount=function(){var n=0;return this.elt[0].isNull()||n++,this.elt[1].isNull()||n++,n},rn.prototype.setAllLocations=function(n,i){this.elt[n].setAllLocations(i)},rn.prototype.isNull=function(n){return this.elt[n].isNull()},rn.prototype.setAllLocationsIfNull=function(){if(arguments.length===1){var n=arguments[0];this.setAllLocationsIfNull(0,n),this.setAllLocationsIfNull(1,n)}else if(arguments.length===2){var i=arguments[0],s=arguments[1];this.elt[i].setAllLocationsIfNull(s)}},rn.prototype.isLine=function(n){return this.elt[n].isLine()},rn.prototype.merge=function(n){for(var i=0;i<2;i++)this.elt[i]===null&&n.elt[i]!==null?this.elt[i]=new hn(n.elt[i]):this.elt[i].merge(n.elt[i])},rn.prototype.flip=function(){this.elt[0].flip(),this.elt[1].flip()},rn.prototype.getLocation=function(){if(arguments.length===1){var n=arguments[0];return this.elt[n].get(bt.ON)}if(arguments.length===2){var i=arguments[0],s=arguments[1];return this.elt[i].get(s)}},rn.prototype.toString=function(){var n=new pt;return this.elt[0]!==null&&(n.append("A:"),n.append(this.elt[0].toString())),this.elt[1]!==null&&(n.append(" B:"),n.append(this.elt[1].toString())),n.toString()},rn.prototype.isArea=function(){if(arguments.length===0)return this.elt[0].isArea()||this.elt[1].isArea();if(arguments.length===1){var n=arguments[0];return this.elt[n].isArea()}},rn.prototype.isAnyNull=function(n){return this.elt[n].isAnyNull()},rn.prototype.setLocation=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];this.elt[n].setLocation(bt.ON,i)}else if(arguments.length===3){var s=arguments[0],u=arguments[1],c=arguments[2];this.elt[s].setLocation(u,c)}},rn.prototype.isEqualOnSide=function(n,i){return this.elt[0].isEqualOnSide(n.elt[0],i)&&this.elt[1].isEqualOnSide(n.elt[1],i)},rn.prototype.allPositionsEqual=function(n,i){return this.elt[n].allPositionsEqual(i)},rn.prototype.toLine=function(n){this.elt[n].isArea()&&(this.elt[n]=new hn(this.elt[n].location[0]))},rn.prototype.interfaces_=function(){return[]},rn.prototype.getClass=function(){return rn},rn.toLineLabel=function(n){for(var i=new rn(k.NONE),s=0;s<2;s++)i.setLocation(s,n.getLocation(s));return i};var An=function(){this._startDe=null,this._maxNodeDegree=-1,this._edges=new j,this._pts=new j,this._label=new rn(k.NONE),this._ring=null,this._isHole=null,this._shell=null,this._holes=new j,this._geometryFactory=null;var n=arguments[0],i=arguments[1];this._geometryFactory=i,this.computePoints(n),this.computeRing()};An.prototype.computeRing=function(){if(this._ring!==null)return null;for(var n=new Array(this._pts.size()).fill(null),i=0;i<this._pts.size();i++)n[i]=this._pts.get(i);this._ring=this._geometryFactory.createLinearRing(n),this._isHole=B.isCCW(this._ring.getCoordinates())},An.prototype.isIsolated=function(){return this._label.getGeometryCount()===1},An.prototype.computePoints=function(n){this._startDe=n;var i=n,s=!0;do{if(i===null)throw new io("Found null DirectedEdge");if(i.getEdgeRing()===this)throw new io("Directed Edge visited twice during ring-building at "+i.getCoordinate());this._edges.add(i);var u=i.getLabel();b.isTrue(u.isArea()),this.mergeLabel(u),this.addPoints(i.getEdge(),i.isForward(),s),s=!1,this.setEdgeRing(i,this),i=this.getNext(i)}while(i!==this._startDe)},An.prototype.getLinearRing=function(){return this._ring},An.prototype.getCoordinate=function(n){return this._pts.get(n)},An.prototype.computeMaxNodeDegree=function(){this._maxNodeDegree=0;var n=this._startDe;do{var i=n.getNode().getEdges().getOutgoingDegree(this);i>this._maxNodeDegree&&(this._maxNodeDegree=i),n=this.getNext(n)}while(n!==this._startDe);this._maxNodeDegree*=2},An.prototype.addPoints=function(n,i,s){var u=n.getCoordinates();if(i){var c=1;s&&(c=0);for(var m=c;m<u.length;m++)this._pts.add(u[m])}else{var E=u.length-2;s&&(E=u.length-1);for(var A=E;A>=0;A--)this._pts.add(u[A])}},An.prototype.isHole=function(){return this._isHole},An.prototype.setInResult=function(){var n=this._startDe;do n.getEdge().setInResult(!0),n=n.getNext();while(n!==this._startDe)},An.prototype.containsPoint=function(n){var i=this.getLinearRing();if(!i.getEnvelopeInternal().contains(n)||!B.isPointInRing(n,i.getCoordinates()))return!1;for(var s=this._holes.iterator();s.hasNext();)if(s.next().containsPoint(n))return!1;return!0},An.prototype.addHole=function(n){this._holes.add(n)},An.prototype.isShell=function(){return this._shell===null},An.prototype.getLabel=function(){return this._label},An.prototype.getEdges=function(){return this._edges},An.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree},An.prototype.getShell=function(){return this._shell},An.prototype.mergeLabel=function(){if(arguments.length===1){var n=arguments[0];this.mergeLabel(n,0),this.mergeLabel(n,1)}else if(arguments.length===2){var i=arguments[0],s=arguments[1],u=i.getLocation(s,bt.RIGHT);if(u===k.NONE)return null;if(this._label.getLocation(s)===k.NONE)return this._label.setLocation(s,u),null}},An.prototype.setShell=function(n){this._shell=n,n!==null&&n.addHole(this)},An.prototype.toPolygon=function(n){for(var i=new Array(this._holes.size()).fill(null),s=0;s<this._holes.size();s++)i[s]=this._holes.get(s).getLinearRing();return n.createPolygon(this.getLinearRing(),i)},An.prototype.interfaces_=function(){return[]},An.prototype.getClass=function(){return An};var d1=function(n){function i(){var s=arguments[0],u=arguments[1];n.call(this,s,u)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.setEdgeRing=function(s,u){s.setMinEdgeRing(u)},i.prototype.getNext=function(s){return s.getNextMin()},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(An),m1=function(n){function i(){var s=arguments[0],u=arguments[1];n.call(this,s,u)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.buildMinimalRings=function(){var s=new j,u=this._startDe;do{if(u.getMinEdgeRing()===null){var c=new d1(u,this._geometryFactory);s.add(c)}u=u.getNext()}while(u!==this._startDe);return s},i.prototype.setEdgeRing=function(s,u){s.setEdgeRing(u)},i.prototype.linkDirectedEdgesForMinimalEdgeRings=function(){var s=this._startDe;do s.getNode().getEdges().linkMinimalDirectedEdges(this),s=s.getNext();while(s!==this._startDe)},i.prototype.getNext=function(s){return s.getNext()},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(An),Hr=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 n=arguments[0];this._label=n}}};Hr.prototype.setVisited=function(n){this._isVisited=n},Hr.prototype.setInResult=function(n){this._isInResult=n},Hr.prototype.isCovered=function(){return this._isCovered},Hr.prototype.isCoveredSet=function(){return this._isCoveredSet},Hr.prototype.setLabel=function(n){this._label=n},Hr.prototype.getLabel=function(){return this._label},Hr.prototype.setCovered=function(n){this._isCovered=n,this._isCoveredSet=!0},Hr.prototype.updateIM=function(n){b.isTrue(this._label.getGeometryCount()>=2,"found partial label"),this.computeIM(n)},Hr.prototype.isInResult=function(){return this._isInResult},Hr.prototype.isVisited=function(){return this._isVisited},Hr.prototype.interfaces_=function(){return[]},Hr.prototype.getClass=function(){return Hr};var El=function(n){function i(){n.call(this),this._coord=null,this._edges=null;var s=arguments[0],u=arguments[1];this._coord=s,this._edges=u,this._label=new rn(0,k.NONE)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.isIncidentEdgeInResult=function(){for(var s=this.getEdges().getEdges().iterator();s.hasNext();)if(s.next().getEdge().isInResult())return!0;return!1},i.prototype.isIsolated=function(){return this._label.getGeometryCount()===1},i.prototype.getCoordinate=function(){return this._coord},i.prototype.print=function(s){s.println("node "+this._coord+" lbl: "+this._label)},i.prototype.computeIM=function(s){},i.prototype.computeMergedLocation=function(s,u){var c=k.NONE;if(c=this._label.getLocation(u),!s.isNull(u)){var m=s.getLocation(u);c!==k.BOUNDARY&&(c=m)}return c},i.prototype.setLabel=function(){if(arguments.length!==2)return n.prototype.setLabel.apply(this,arguments);var s=arguments[0],u=arguments[1];this._label===null?this._label=new rn(s,u):this._label.setLocation(s,u)},i.prototype.getEdges=function(){return this._edges},i.prototype.mergeLabel=function(){if(arguments[0]instanceof i){var s=arguments[0];this.mergeLabel(s._label)}else if(arguments[0]instanceof rn)for(var u=arguments[0],c=0;c<2;c++){var m=this.computeMergedLocation(u,c);this._label.getLocation(c)===k.NONE&&this._label.setLocation(c,m)}},i.prototype.add=function(s){this._edges.insert(s),s.setNode(this)},i.prototype.setLabelBoundary=function(s){if(this._label===null)return null;var u=k.NONE;this._label!==null&&(u=this._label.getLocation(s));var c=null;switch(u){case k.BOUNDARY:c=k.INTERIOR;break;case k.INTERIOR:default:c=k.BOUNDARY}this._label.setLocation(s,c)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(Hr),bi=function(){this.nodeMap=new _,this.nodeFact=null;var n=arguments[0];this.nodeFact=n};bi.prototype.find=function(n){return this.nodeMap.get(n)},bi.prototype.addNode=function(){if(arguments[0]instanceof L){var n=arguments[0],i=this.nodeMap.get(n);return i===null&&(i=this.nodeFact.createNode(n),this.nodeMap.put(n,i)),i}if(arguments[0]instanceof El){var s=arguments[0],u=this.nodeMap.get(s.getCoordinate());return u===null?(this.nodeMap.put(s.getCoordinate(),s),s):(u.mergeLabel(s),u)}},bi.prototype.print=function(n){for(var i=this.iterator();i.hasNext();)i.next().print(n)},bi.prototype.iterator=function(){return this.nodeMap.values().iterator()},bi.prototype.values=function(){return this.nodeMap.values()},bi.prototype.getBoundaryNodes=function(n){for(var i=new j,s=this.iterator();s.hasNext();){var u=s.next();u.getLabel().getLocation(n)===k.BOUNDARY&&i.add(u)}return i},bi.prototype.add=function(n){var i=n.getCoordinate();this.addNode(i).add(n)},bi.prototype.interfaces_=function(){return[]},bi.prototype.getClass=function(){return bi};var ln=function(){},gu={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}};ln.prototype.interfaces_=function(){return[]},ln.prototype.getClass=function(){return ln},ln.isNorthern=function(n){return n===ln.NE||n===ln.NW},ln.isOpposite=function(n,i){return n===i?!1:(n-i+4)%4===2},ln.commonHalfPlane=function(n,i){if(n===i)return n;if((n-i+4)%4===2)return-1;var s=n<i?n:i;return s===0&&(n>i?n:i)===3?3:s},ln.isInHalfPlane=function(n,i){return i===ln.SE?n===ln.SE||n===ln.SW:n===i||n===i+1},ln.quadrant=function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var n=arguments[0],i=arguments[1];if(n===0&&i===0)throw new C("Cannot compute the quadrant for point ( "+n+", "+i+" )");return n>=0?i>=0?ln.NE:ln.SE:i>=0?ln.NW:ln.SW}if(arguments[0]instanceof L&&arguments[1]instanceof L){var s=arguments[0],u=arguments[1];if(u.x===s.x&&u.y===s.y)throw new C("Cannot compute the quadrant for two identical points "+s);return u.x>=s.x?u.y>=s.y?ln.NE:ln.SE:u.y>=s.y?ln.NW:ln.SW}},gu.NE.get=function(){return 0},gu.NW.get=function(){return 1},gu.SW.get=function(){return 2},gu.SE.get=function(){return 3},Object.defineProperties(ln,gu);var Kn=function(){if(this._edge=null,this._label=null,this._node=null,this._p0=null,this._p1=null,this._dx=null,this._dy=null,this._quadrant=null,arguments.length===1){var n=arguments[0];this._edge=n}else if(arguments.length===3){var i=arguments[0],s=arguments[1],u=arguments[2];this._edge=i,this.init(s,u),this._label=null}else if(arguments.length===4){var c=arguments[0],m=arguments[1],E=arguments[2],A=arguments[3];this._edge=c,this.init(m,E),this._label=A}};Kn.prototype.compareDirection=function(n){return this._dx===n._dx&&this._dy===n._dy?0:this._quadrant>n._quadrant?1:this._quadrant<n._quadrant?-1:B.computeOrientation(n._p0,n._p1,this._p1)},Kn.prototype.getDy=function(){return this._dy},Kn.prototype.getCoordinate=function(){return this._p0},Kn.prototype.setNode=function(n){this._node=n},Kn.prototype.print=function(n){var i=Math.atan2(this._dy,this._dx),s=this.getClass().getName(),u=s.lastIndexOf("."),c=s.substring(u+1);n.print(" "+c+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+i+" "+this._label)},Kn.prototype.compareTo=function(n){var i=n;return this.compareDirection(i)},Kn.prototype.getDirectedCoordinate=function(){return this._p1},Kn.prototype.getDx=function(){return this._dx},Kn.prototype.getLabel=function(){return this._label},Kn.prototype.getEdge=function(){return this._edge},Kn.prototype.getQuadrant=function(){return this._quadrant},Kn.prototype.getNode=function(){return this._node},Kn.prototype.toString=function(){var n=Math.atan2(this._dy,this._dx),i=this.getClass().getName(),s=i.lastIndexOf(".");return" "+i.substring(s+1)+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+n+" "+this._label},Kn.prototype.computeLabel=function(n){},Kn.prototype.init=function(n,i){this._p0=n,this._p1=i,this._dx=i.x-n.x,this._dy=i.y-n.y,this._quadrant=ln.quadrant(this._dx,this._dy),b.isTrue(!(this._dx===0&&this._dy===0),"EdgeEnd with identical endpoints found")},Kn.prototype.interfaces_=function(){return[F]},Kn.prototype.getClass=function(){return Kn};var yf=function(n){function i(){var s=arguments[0],u=arguments[1];if(n.call(this,s),this._isForward=null,this._isInResult=!1,this._isVisited=!1,this._sym=null,this._next=null,this._nextMin=null,this._edgeRing=null,this._minEdgeRing=null,this._depth=[0,-999,-999],this._isForward=u,u)this.init(s.getCoordinate(0),s.getCoordinate(1));else{var c=s.getNumPoints()-1;this.init(s.getCoordinate(c),s.getCoordinate(c-1))}this.computeDirectedLabel()}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.getNextMin=function(){return this._nextMin},i.prototype.getDepth=function(s){return this._depth[s]},i.prototype.setVisited=function(s){this._isVisited=s},i.prototype.computeDirectedLabel=function(){this._label=new rn(this._edge.getLabel()),this._isForward||this._label.flip()},i.prototype.getNext=function(){return this._next},i.prototype.setDepth=function(s,u){if(this._depth[s]!==-999&&this._depth[s]!==u)throw new io("assigned depths do not match",this.getCoordinate());this._depth[s]=u},i.prototype.isInteriorAreaEdge=function(){for(var s=!0,u=0;u<2;u++)this._label.isArea(u)&&this._label.getLocation(u,bt.LEFT)===k.INTERIOR&&this._label.getLocation(u,bt.RIGHT)===k.INTERIOR||(s=!1);return s},i.prototype.setNextMin=function(s){this._nextMin=s},i.prototype.print=function(s){n.prototype.print.call(this,s),s.print(" "+this._depth[bt.LEFT]+"/"+this._depth[bt.RIGHT]),s.print(" ("+this.getDepthDelta()+")"),this._isInResult&&s.print(" inResult")},i.prototype.setMinEdgeRing=function(s){this._minEdgeRing=s},i.prototype.isLineEdge=function(){var s=this._label.isLine(0)||this._label.isLine(1),u=!this._label.isArea(0)||this._label.allPositionsEqual(0,k.EXTERIOR),c=!this._label.isArea(1)||this._label.allPositionsEqual(1,k.EXTERIOR);return s&&u&&c},i.prototype.setEdgeRing=function(s){this._edgeRing=s},i.prototype.getMinEdgeRing=function(){return this._minEdgeRing},i.prototype.getDepthDelta=function(){var s=this._edge.getDepthDelta();return this._isForward||(s=-s),s},i.prototype.setInResult=function(s){this._isInResult=s},i.prototype.getSym=function(){return this._sym},i.prototype.isForward=function(){return this._isForward},i.prototype.getEdge=function(){return this._edge},i.prototype.printEdge=function(s){this.print(s),s.print(" "),this._isForward?this._edge.print(s):this._edge.printReverse(s)},i.prototype.setSym=function(s){this._sym=s},i.prototype.setVisitedEdge=function(s){this.setVisited(s),this._sym.setVisited(s)},i.prototype.setEdgeDepths=function(s,u){var c=this.getEdge().getDepthDelta();this._isForward||(c=-c);var m=1;s===bt.LEFT&&(m=-1);var E=bt.opposite(s),A=u+c*m;this.setDepth(s,u),this.setDepth(E,A)},i.prototype.getEdgeRing=function(){return this._edgeRing},i.prototype.isInResult=function(){return this._isInResult},i.prototype.setNext=function(s){this._next=s},i.prototype.isVisited=function(){return this._isVisited},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i.depthFactor=function(s,u){return s===k.EXTERIOR&&u===k.INTERIOR?1:s===k.INTERIOR&&u===k.EXTERIOR?-1:0},i}(Kn),sa=function(){};sa.prototype.createNode=function(n){return new El(n,null)},sa.prototype.interfaces_=function(){return[]},sa.prototype.getClass=function(){return sa};var _n=function(){if(this._edges=new j,this._nodes=null,this._edgeEndList=new j,arguments.length===0)this._nodes=new bi(new sa);else if(arguments.length===1){var n=arguments[0];this._nodes=new bi(n)}};_n.prototype.printEdges=function(n){n.println("Edges:");for(var i=0;i<this._edges.size();i++){n.println("edge "+i+":");var s=this._edges.get(i);s.print(n),s.eiList.print(n)}},_n.prototype.find=function(n){return this._nodes.find(n)},_n.prototype.addNode=function(){if(arguments[0]instanceof El){var n=arguments[0];return this._nodes.addNode(n)}if(arguments[0]instanceof L){var i=arguments[0];return this._nodes.addNode(i)}},_n.prototype.getNodeIterator=function(){return this._nodes.iterator()},_n.prototype.linkResultDirectedEdges=function(){for(var n=this._nodes.iterator();n.hasNext();)n.next().getEdges().linkResultDirectedEdges()},_n.prototype.debugPrintln=function(n){Nt.out.println(n)},_n.prototype.isBoundaryNode=function(n,i){var s=this._nodes.find(i);if(s===null)return!1;var u=s.getLabel();return u!==null&&u.getLocation(n)===k.BOUNDARY},_n.prototype.linkAllDirectedEdges=function(){for(var n=this._nodes.iterator();n.hasNext();)n.next().getEdges().linkAllDirectedEdges()},_n.prototype.matchInSameDirection=function(n,i,s,u){return!!n.equals(s)&&B.computeOrientation(n,i,u)===B.COLLINEAR&&ln.quadrant(n,i)===ln.quadrant(s,u)},_n.prototype.getEdgeEnds=function(){return this._edgeEndList},_n.prototype.debugPrint=function(n){Nt.out.print(n)},_n.prototype.getEdgeIterator=function(){return this._edges.iterator()},_n.prototype.findEdgeInSameDirection=function(n,i){for(var s=0;s<this._edges.size();s++){var u=this._edges.get(s),c=u.getCoordinates();if(this.matchInSameDirection(n,i,c[0],c[1])||this.matchInSameDirection(n,i,c[c.length-1],c[c.length-2]))return u}return null},_n.prototype.insertEdge=function(n){this._edges.add(n)},_n.prototype.findEdgeEnd=function(n){for(var i=this.getEdgeEnds().iterator();i.hasNext();){var s=i.next();if(s.getEdge()===n)return s}return null},_n.prototype.addEdges=function(n){for(var i=n.iterator();i.hasNext();){var s=i.next();this._edges.add(s);var u=new yf(s,!0),c=new yf(s,!1);u.setSym(c),c.setSym(u),this.add(u),this.add(c)}},_n.prototype.add=function(n){this._nodes.add(n),this._edgeEndList.add(n)},_n.prototype.getNodes=function(){return this._nodes.values()},_n.prototype.findEdge=function(n,i){for(var s=0;s<this._edges.size();s++){var u=this._edges.get(s),c=u.getCoordinates();if(n.equals(c[0])&&i.equals(c[1]))return u}return null},_n.prototype.interfaces_=function(){return[]},_n.prototype.getClass=function(){return _n},_n.linkResultDirectedEdges=function(n){for(var i=n.iterator();i.hasNext();)i.next().getEdges().linkResultDirectedEdges()};var Nr=function(){this._geometryFactory=null,this._shellList=new j;var n=arguments[0];this._geometryFactory=n};Nr.prototype.sortShellsAndHoles=function(n,i,s){for(var u=n.iterator();u.hasNext();){var c=u.next();c.isHole()?s.add(c):i.add(c)}},Nr.prototype.computePolygons=function(n){for(var i=new j,s=n.iterator();s.hasNext();){var u=s.next().toPolygon(this._geometryFactory);i.add(u)}return i},Nr.prototype.placeFreeHoles=function(n,i){for(var s=i.iterator();s.hasNext();){var u=s.next();if(u.getShell()===null){var c=this.findEdgeRingContaining(u,n);if(c===null)throw new io("unable to assign hole to a shell",u.getCoordinate(0));u.setShell(c)}}},Nr.prototype.buildMinimalEdgeRings=function(n,i,s){for(var u=new j,c=n.iterator();c.hasNext();){var m=c.next();if(m.getMaxNodeDegree()>2){m.linkDirectedEdgesForMinimalEdgeRings();var E=m.buildMinimalRings(),A=this.findShell(E);A!==null?(this.placePolygonHoles(A,E),i.add(A)):s.addAll(E)}else u.add(m)}return u},Nr.prototype.containsPoint=function(n){for(var i=this._shellList.iterator();i.hasNext();)if(i.next().containsPoint(n))return!0;return!1},Nr.prototype.buildMaximalEdgeRings=function(n){for(var i=new j,s=n.iterator();s.hasNext();){var u=s.next();if(u.isInResult()&&u.getLabel().isArea()&&u.getEdgeRing()===null){var c=new m1(u,this._geometryFactory);i.add(c),c.setInResult()}}return i},Nr.prototype.placePolygonHoles=function(n,i){for(var s=i.iterator();s.hasNext();){var u=s.next();u.isHole()&&u.setShell(n)}},Nr.prototype.getPolygons=function(){return this.computePolygons(this._shellList)},Nr.prototype.findEdgeRingContaining=function(n,i){for(var s=n.getLinearRing(),u=s.getEnvelopeInternal(),c=s.getCoordinateN(0),m=null,E=null,A=i.iterator();A.hasNext();){var U=A.next(),Z=U.getLinearRing(),ut=Z.getEnvelopeInternal();m!==null&&(E=m.getLinearRing().getEnvelopeInternal());var ht=!1;ut.contains(u)&&B.isPointInRing(c,Z.getCoordinates())&&(ht=!0),ht&&(m===null||E.contains(ut))&&(m=U)}return m},Nr.prototype.findShell=function(n){for(var i=0,s=null,u=n.iterator();u.hasNext();){var c=u.next();c.isHole()||(s=c,i++)}return b.isTrue(i<=1,"found two shells in MinimalEdgeRing list"),s},Nr.prototype.add=function(){if(arguments.length===1){var n=arguments[0];this.add(n.getEdgeEnds(),n.getNodes())}else if(arguments.length===2){var i=arguments[0],s=arguments[1];_n.linkResultDirectedEdges(s);var u=this.buildMaximalEdgeRings(i),c=new j,m=this.buildMinimalEdgeRings(u,this._shellList,c);this.sortShellsAndHoles(m,this._shellList,c),this.placeFreeHoles(this._shellList,c)}},Nr.prototype.interfaces_=function(){return[]},Nr.prototype.getClass=function(){return Nr};var aa=function(){};aa.prototype.getBounds=function(){},aa.prototype.interfaces_=function(){return[]},aa.prototype.getClass=function(){return aa};var pi=function(){this._bounds=null,this._item=null;var n=arguments[0],i=arguments[1];this._bounds=n,this._item=i};pi.prototype.getItem=function(){return this._item},pi.prototype.getBounds=function(){return this._bounds},pi.prototype.interfaces_=function(){return[aa,t]},pi.prototype.getClass=function(){return pi};var oo=function(){this._size=null,this._items=null,this._size=0,this._items=new j,this._items.add(null)};oo.prototype.poll=function(){if(this.isEmpty())return null;var n=this._items.get(1);return this._items.set(1,this._items.get(this._size)),this._size-=1,this.reorder(1),n},oo.prototype.size=function(){return this._size},oo.prototype.reorder=function(n){for(var i=null,s=this._items.get(n);2*n<=this._size&&((i=2*n)!==this._size&&this._items.get(i+1).compareTo(this._items.get(i))<0&&i++,this._items.get(i).compareTo(s)<0);n=i)this._items.set(n,this._items.get(i));this._items.set(n,s)},oo.prototype.clear=function(){this._size=0,this._items.clear()},oo.prototype.isEmpty=function(){return this._size===0},oo.prototype.add=function(n){this._items.add(null),this._size+=1;var i=this._size;for(this._items.set(0,n);n.compareTo(this._items.get(Math.trunc(i/2)))<0;i/=2)this._items.set(i,this._items.get(Math.trunc(i/2)));this._items.set(i,n)},oo.prototype.interfaces_=function(){return[]},oo.prototype.getClass=function(){return oo};var Mo=function(){};Mo.prototype.visitItem=function(n){},Mo.prototype.interfaces_=function(){return[]},Mo.prototype.getClass=function(){return Mo};var Ts=function(){};Ts.prototype.insert=function(n,i){},Ts.prototype.remove=function(n,i){},Ts.prototype.query=function(){},Ts.prototype.interfaces_=function(){return[]},Ts.prototype.getClass=function(){return Ts};var Nn=function(){if(this._childBoundables=new j,this._bounds=null,this._level=null,arguments.length!==0){if(arguments.length===1){var n=arguments[0];this._level=n}}},Vd={serialVersionUID:{configurable:!0}};Nn.prototype.getLevel=function(){return this._level},Nn.prototype.size=function(){return this._childBoundables.size()},Nn.prototype.getChildBoundables=function(){return this._childBoundables},Nn.prototype.addChildBoundable=function(n){b.isTrue(this._bounds===null),this._childBoundables.add(n)},Nn.prototype.isEmpty=function(){return this._childBoundables.isEmpty()},Nn.prototype.getBounds=function(){return this._bounds===null&&(this._bounds=this.computeBounds()),this._bounds},Nn.prototype.interfaces_=function(){return[aa,t]},Nn.prototype.getClass=function(){return Nn},Vd.serialVersionUID.get=function(){return 6493722185909574e3},Object.defineProperties(Nn,Vd);var di=function(){};di.reverseOrder=function(){return{compare:function(n,i){return i.compareTo(n)}}},di.min=function(n){return di.sort(n),n.get(0)},di.sort=function(n,i){var s=n.toArray();i?Fi.sort(s,i):Fi.sort(s);for(var u=n.iterator(),c=0,m=s.length;c<m;c++)u.next(),u.set(s[c])},di.singletonList=function(n){var i=new j;return i.add(n),i};var Cn=function(){this._boundable1=null,this._boundable2=null,this._distance=null,this._itemDistance=null;var n=arguments[0],i=arguments[1],s=arguments[2];this._boundable1=n,this._boundable2=i,this._itemDistance=s,this._distance=this.distance()};Cn.prototype.expandToQueue=function(n,i){var s=Cn.isComposite(this._boundable1),u=Cn.isComposite(this._boundable2);if(s&&u)return Cn.area(this._boundable1)>Cn.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,n,i),null):(this.expand(this._boundable2,this._boundable1,n,i),null);if(s)return this.expand(this._boundable1,this._boundable2,n,i),null;if(u)return this.expand(this._boundable2,this._boundable1,n,i),null;throw new C("neither boundable is composite")},Cn.prototype.isLeaves=function(){return!(Cn.isComposite(this._boundable1)||Cn.isComposite(this._boundable2))},Cn.prototype.compareTo=function(n){var i=n;return this._distance<i._distance?-1:this._distance>i._distance?1:0},Cn.prototype.expand=function(n,i,s,u){for(var c=n.getChildBoundables().iterator();c.hasNext();){var m=c.next(),E=new Cn(m,i,this._itemDistance);E.getDistance()<u&&s.add(E)}},Cn.prototype.getBoundable=function(n){return n===0?this._boundable1:this._boundable2},Cn.prototype.getDistance=function(){return this._distance},Cn.prototype.distance=function(){return this.isLeaves()?this._itemDistance.distance(this._boundable1,this._boundable2):this._boundable1.getBounds().distance(this._boundable2.getBounds())},Cn.prototype.interfaces_=function(){return[F]},Cn.prototype.getClass=function(){return Cn},Cn.area=function(n){return n.getBounds().getArea()},Cn.isComposite=function(n){return n instanceof Nn};var zn=function n(){if(this._root=null,this._built=!1,this._itemBoundables=new j,this._nodeCapacity=null,arguments.length===0){var i=n.DEFAULT_NODE_CAPACITY;this._nodeCapacity=i}else if(arguments.length===1){var s=arguments[0];b.isTrue(s>1,"Node capacity must be greater than 1"),this._nodeCapacity=s}},Ml={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};zn.prototype.getNodeCapacity=function(){return this._nodeCapacity},zn.prototype.lastNode=function(n){return n.get(n.size()-1)},zn.prototype.size=function(){if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.size(this._root));if(arguments.length===1){for(var n=0,i=arguments[0].getChildBoundables().iterator();i.hasNext();){var s=i.next();s instanceof Nn?n+=this.size(s):s instanceof pi&&(n+=1)}return n}},zn.prototype.removeItem=function(n,i){for(var s=null,u=n.getChildBoundables().iterator();u.hasNext();){var c=u.next();c instanceof pi&&c.getItem()===i&&(s=c)}return s!==null&&(n.getChildBoundables().remove(s),!0)},zn.prototype.itemsTree=function(){if(arguments.length===0){this.build();var n=this.itemsTree(this._root);return n===null?new j:n}if(arguments.length===1){for(var i=arguments[0],s=new j,u=i.getChildBoundables().iterator();u.hasNext();){var c=u.next();if(c instanceof Nn){var m=this.itemsTree(c);m!==null&&s.add(m)}else c instanceof pi?s.add(c.getItem()):b.shouldNeverReachHere()}return s.size()<=0?null:s}},zn.prototype.insert=function(n,i){b.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new pi(n,i))},zn.prototype.boundablesAtLevel=function(){if(arguments.length===1){var n=arguments[0],i=new j;return this.boundablesAtLevel(n,this._root,i),i}if(arguments.length===3){var s=arguments[0],u=arguments[1],c=arguments[2];if(b.isTrue(s>-2),u.getLevel()===s)return c.add(u),null;for(var m=u.getChildBoundables().iterator();m.hasNext();){var E=m.next();E instanceof Nn?this.boundablesAtLevel(s,E,c):(b.isTrue(E instanceof pi),s===-1&&c.add(E))}return null}},zn.prototype.query=function(){if(arguments.length===1){var n=arguments[0];this.build();var i=new j;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),n)&&this.query(n,this._root,i),i}if(arguments.length===2){var s=arguments[0],u=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),s)&&this.query(s,this._root,u)}else if(arguments.length===3){if(X(arguments[2],Mo)&&arguments[0]instanceof Object&&arguments[1]instanceof Nn)for(var c=arguments[0],m=arguments[1],E=arguments[2],A=m.getChildBoundables(),U=0;U<A.size();U++){var Z=A.get(U);this.getIntersectsOp().intersects(Z.getBounds(),c)&&(Z instanceof Nn?this.query(c,Z,E):Z instanceof pi?E.visitItem(Z.getItem()):b.shouldNeverReachHere())}else if(X(arguments[2],wt)&&arguments[0]instanceof Object&&arguments[1]instanceof Nn)for(var ut=arguments[0],ht=arguments[1],At=arguments[2],Rt=ht.getChildBoundables(),kt=0;kt<Rt.size();kt++){var ee=Rt.get(kt);this.getIntersectsOp().intersects(ee.getBounds(),ut)&&(ee instanceof Nn?this.query(ut,ee,At):ee instanceof pi?At.add(ee.getItem()):b.shouldNeverReachHere())}}},zn.prototype.build=function(){if(this._built)return null;this._root=this._itemBoundables.isEmpty()?this.createNode(0):this.createHigherLevels(this._itemBoundables,-1),this._itemBoundables=null,this._built=!0},zn.prototype.getRoot=function(){return this.build(),this._root},zn.prototype.remove=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];return this.build(),!!this.getIntersectsOp().intersects(this._root.getBounds(),n)&&this.remove(n,this._root,i)}if(arguments.length===3){var s=arguments[0],u=arguments[1],c=arguments[2],m=this.removeItem(u,c);if(m)return!0;for(var E=null,A=u.getChildBoundables().iterator();A.hasNext();){var U=A.next();if(this.getIntersectsOp().intersects(U.getBounds(),s)&&U instanceof Nn&&(m=this.remove(s,U,c))){E=U;break}}return E!==null&&E.getChildBoundables().isEmpty()&&u.getChildBoundables().remove(E),m}},zn.prototype.createHigherLevels=function(n,i){b.isTrue(!n.isEmpty());var s=this.createParentBoundables(n,i+1);return s.size()===1?s.get(0):this.createHigherLevels(s,i+1)},zn.prototype.depth=function(){if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.depth(this._root));if(arguments.length===1){for(var n=0,i=arguments[0].getChildBoundables().iterator();i.hasNext();){var s=i.next();if(s instanceof Nn){var u=this.depth(s);u>n&&(n=u)}}return n+1}},zn.prototype.createParentBoundables=function(n,i){b.isTrue(!n.isEmpty());var s=new j;s.add(this.createNode(i));var u=new j(n);di.sort(u,this.getComparator());for(var c=u.iterator();c.hasNext();){var m=c.next();this.lastNode(s).getChildBoundables().size()===this.getNodeCapacity()&&s.add(this.createNode(i)),this.lastNode(s).addChildBoundable(m)}return s},zn.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()},zn.prototype.interfaces_=function(){return[t]},zn.prototype.getClass=function(){return zn},zn.compareDoubles=function(n,i){return n>i?1:n<i?-1:0},Ml.IntersectsOp.get=function(){return g1},Ml.serialVersionUID.get=function(){return-3886435814360241e3},Ml.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(zn,Ml);var g1=function(){},ua=function(){};ua.prototype.distance=function(n,i){},ua.prototype.interfaces_=function(){return[]},ua.prototype.getClass=function(){return ua};var Hd=function(n){function i(u){u=u||i.DEFAULT_NODE_CAPACITY,n.call(this,u)}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={STRtreeNode:{configurable:!0},serialVersionUID:{configurable:!0},xComparator:{configurable:!0},yComparator:{configurable:!0},intersectsOp:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};return i.prototype.createParentBoundablesFromVerticalSlices=function(u,c){b.isTrue(u.length>0);for(var m=new j,E=0;E<u.length;E++)m.addAll(this.createParentBoundablesFromVerticalSlice(u[E],c));return m},i.prototype.createNode=function(u){return new Wd(u)},i.prototype.size=function(){return arguments.length===0?n.prototype.size.call(this):n.prototype.size.apply(this,arguments)},i.prototype.insert=function(){if(arguments.length!==2)return n.prototype.insert.apply(this,arguments);var u=arguments[0],c=arguments[1];if(u.isNull())return null;n.prototype.insert.call(this,u,c)},i.prototype.getIntersectsOp=function(){return i.intersectsOp},i.prototype.verticalSlices=function(u,c){for(var m=Math.trunc(Math.ceil(u.size()/c)),E=new Array(c).fill(null),A=u.iterator(),U=0;U<c;U++){E[U]=new j;for(var Z=0;A.hasNext()&&Z<m;){var ut=A.next();E[U].add(ut),Z++}}return E},i.prototype.query=function(){if(arguments.length===1){var u=arguments[0];return n.prototype.query.call(this,u)}if(arguments.length===2){var c=arguments[0],m=arguments[1];n.prototype.query.call(this,c,m)}else if(arguments.length===3){if(X(arguments[2],Mo)&&arguments[0]instanceof Object&&arguments[1]instanceof Nn){var E=arguments[0],A=arguments[1],U=arguments[2];n.prototype.query.call(this,E,A,U)}else if(X(arguments[2],wt)&&arguments[0]instanceof Object&&arguments[1]instanceof Nn){var Z=arguments[0],ut=arguments[1],ht=arguments[2];n.prototype.query.call(this,Z,ut,ht)}}},i.prototype.getComparator=function(){return i.yComparator},i.prototype.createParentBoundablesFromVerticalSlice=function(u,c){return n.prototype.createParentBoundables.call(this,u,c)},i.prototype.remove=function(){if(arguments.length===2){var u=arguments[0],c=arguments[1];return n.prototype.remove.call(this,u,c)}return n.prototype.remove.apply(this,arguments)},i.prototype.depth=function(){return arguments.length===0?n.prototype.depth.call(this):n.prototype.depth.apply(this,arguments)},i.prototype.createParentBoundables=function(u,c){b.isTrue(!u.isEmpty());var m=Math.trunc(Math.ceil(u.size()/this.getNodeCapacity())),E=new j(u);di.sort(E,i.xComparator);var A=this.verticalSlices(E,Math.trunc(Math.ceil(Math.sqrt(m))));return this.createParentBoundablesFromVerticalSlices(A,c)},i.prototype.nearestNeighbour=function(){if(arguments.length===1){if(X(arguments[0],ua)){var u=arguments[0],c=new Cn(this.getRoot(),this.getRoot(),u);return this.nearestNeighbour(c)}if(arguments[0]instanceof Cn){var m=arguments[0];return this.nearestNeighbour(m,S.POSITIVE_INFINITY)}}else if(arguments.length===2){if(arguments[0]instanceof i&&X(arguments[1],ua)){var E=arguments[0],A=arguments[1],U=new Cn(this.getRoot(),E.getRoot(),A);return this.nearestNeighbour(U)}if(arguments[0]instanceof Cn&&typeof arguments[1]=="number"){var Z=arguments[0],ut=arguments[1],ht=null,At=new oo;for(At.add(Z);!At.isEmpty()&&ut>0;){var Rt=At.poll(),kt=Rt.getDistance();if(kt>=ut)break;Rt.isLeaves()?(ut=kt,ht=Rt):Rt.expandToQueue(At,ut)}return[ht.getBoundable(0).getItem(),ht.getBoundable(1).getItem()]}}else if(arguments.length===3){var ee=arguments[0],on=arguments[1],In=arguments[2],pr=new pi(ee,on),Xi=new Cn(this.getRoot(),pr,In);return this.nearestNeighbour(Xi)[0]}},i.prototype.interfaces_=function(){return[Ts,t]},i.prototype.getClass=function(){return i},i.centreX=function(u){return i.avg(u.getMinX(),u.getMaxX())},i.avg=function(u,c){return(u+c)/2},i.centreY=function(u){return i.avg(u.getMinY(),u.getMaxY())},s.STRtreeNode.get=function(){return Wd},s.serialVersionUID.get=function(){return 0x39920f7d5f261e0},s.xComparator.get=function(){return{interfaces_:function(){return[z]},compare:function(u,c){return n.compareDoubles(i.centreX(u.getBounds()),i.centreX(c.getBounds()))}}},s.yComparator.get=function(){return{interfaces_:function(){return[z]},compare:function(u,c){return n.compareDoubles(i.centreY(u.getBounds()),i.centreY(c.getBounds()))}}},s.intersectsOp.get=function(){return{interfaces_:function(){return[n.IntersectsOp]},intersects:function(u,c){return u.intersects(c)}}},s.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(i,s),i}(zn),Wd=function(n){function i(){var s=arguments[0];n.call(this,s)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.computeBounds=function(){for(var s=null,u=this.getChildBoundables().iterator();u.hasNext();){var c=u.next();s===null?s=new Pt(c.getBounds()):s.expandToInclude(c.getBounds())}return s},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(Nn),Er=function(){};Er.prototype.interfaces_=function(){return[]},Er.prototype.getClass=function(){return Er},Er.relativeSign=function(n,i){return n<i?-1:n>i?1:0},Er.compare=function(n,i,s){if(i.equals2D(s))return 0;var u=Er.relativeSign(i.x,s.x),c=Er.relativeSign(i.y,s.y);switch(n){case 0:return Er.compareValue(u,c);case 1:return Er.compareValue(c,u);case 2:return Er.compareValue(c,-u);case 3:return Er.compareValue(-u,c);case 4:return Er.compareValue(-u,-c);case 5:return Er.compareValue(-c,-u);case 6:return Er.compareValue(-c,u);case 7:return Er.compareValue(u,-c)}return b.shouldNeverReachHere("invalid octant value"),0},Er.compareValue=function(n,i){return n<0?-1:n>0?1:i<0?-1:i>0?1:0};var So=function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var n=arguments[0],i=arguments[1],s=arguments[2],u=arguments[3];this._segString=n,this.coord=new L(i),this.segmentIndex=s,this._segmentOctant=u,this._isInterior=!i.equals2D(n.getCoordinate(s))};So.prototype.getCoordinate=function(){return this.coord},So.prototype.print=function(n){n.print(this.coord),n.print(" seg # = "+this.segmentIndex)},So.prototype.compareTo=function(n){var i=n;return this.segmentIndex<i.segmentIndex?-1:this.segmentIndex>i.segmentIndex?1:this.coord.equals2D(i.coord)?0:Er.compare(this._segmentOctant,this.coord,i.coord)},So.prototype.isEndPoint=function(n){return this.segmentIndex===0&&!this._isInterior||this.segmentIndex===n},So.prototype.isInterior=function(){return this._isInterior},So.prototype.interfaces_=function(){return[F]},So.prototype.getClass=function(){return So};var ar=function(){this._nodeMap=new _,this._edge=null;var n=arguments[0];this._edge=n};ar.prototype.getSplitCoordinates=function(){var n=new Dt;this.addEndpoints();for(var i=this.iterator(),s=i.next();i.hasNext();){var u=i.next();this.addEdgeCoordinates(s,u,n),s=u}return n.toCoordinateArray()},ar.prototype.addCollapsedNodes=function(){var n=new j;this.findCollapsesFromInsertedNodes(n),this.findCollapsesFromExistingVertices(n);for(var i=n.iterator();i.hasNext();){var s=i.next().intValue();this.add(this._edge.getCoordinate(s),s)}},ar.prototype.print=function(n){n.println("Intersections:");for(var i=this.iterator();i.hasNext();)i.next().print(n)},ar.prototype.findCollapsesFromExistingVertices=function(n){for(var i=0;i<this._edge.size()-2;i++){var s=this._edge.getCoordinate(i),u=this._edge.getCoordinate(i+2);s.equals2D(u)&&n.add(new et(i+1))}},ar.prototype.addEdgeCoordinates=function(n,i,s){var u=this._edge.getCoordinate(i.segmentIndex),c=i.isInterior()||!i.coord.equals2D(u);s.add(new L(n.coord),!1);for(var m=n.segmentIndex+1;m<=i.segmentIndex;m++)s.add(this._edge.getCoordinate(m));c&&s.add(new L(i.coord))},ar.prototype.iterator=function(){return this._nodeMap.values().iterator()},ar.prototype.addSplitEdges=function(n){this.addEndpoints(),this.addCollapsedNodes();for(var i=this.iterator(),s=i.next();i.hasNext();){var u=i.next(),c=this.createSplitEdge(s,u);n.add(c),s=u}},ar.prototype.findCollapseIndex=function(n,i,s){if(!n.coord.equals2D(i.coord))return!1;var u=i.segmentIndex-n.segmentIndex;return i.isInterior()||u--,u===1&&(s[0]=n.segmentIndex+1,!0)},ar.prototype.findCollapsesFromInsertedNodes=function(n){for(var i=new Array(1).fill(null),s=this.iterator(),u=s.next();s.hasNext();){var c=s.next();this.findCollapseIndex(u,c,i)&&n.add(new et(i[0])),u=c}},ar.prototype.getEdge=function(){return this._edge},ar.prototype.addEndpoints=function(){var n=this._edge.size()-1;this.add(this._edge.getCoordinate(0),0),this.add(this._edge.getCoordinate(n),n)},ar.prototype.createSplitEdge=function(n,i){var s=i.segmentIndex-n.segmentIndex+2,u=this._edge.getCoordinate(i.segmentIndex),c=i.isInterior()||!i.coord.equals2D(u);c||s--;var m=new Array(s).fill(null),E=0;m[E++]=new L(n.coord);for(var A=n.segmentIndex+1;A<=i.segmentIndex;A++)m[E++]=this._edge.getCoordinate(A);return c&&(m[E]=new L(i.coord)),new wn(m,this._edge.getData())},ar.prototype.add=function(n,i){var s=new So(this._edge,n,i,this._edge.getSegmentOctant(i)),u=this._nodeMap.get(s);return u!==null?(b.isTrue(u.coord.equals2D(n),"Found equal nodes with different coordinates"),u):(this._nodeMap.put(s,s),s)},ar.prototype.checkSplitEdgesCorrectness=function(n){var i=this._edge.getCoordinates(),s=n.get(0).getCoordinate(0);if(!s.equals2D(i[0]))throw new $("bad split edge start point at "+s);var u=n.get(n.size()-1).getCoordinates(),c=u[u.length-1];if(!c.equals2D(i[i.length-1]))throw new $("bad split edge end point at "+c)},ar.prototype.interfaces_=function(){return[]},ar.prototype.getClass=function(){return ar};var As=function(){};As.prototype.interfaces_=function(){return[]},As.prototype.getClass=function(){return As},As.octant=function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var n=arguments[0],i=arguments[1];if(n===0&&i===0)throw new C("Cannot compute the octant for point ( "+n+", "+i+" )");var s=Math.abs(n),u=Math.abs(i);return n>=0?i>=0?s>=u?0:1:s>=u?7:6:i>=0?s>=u?3:2:s>=u?4:5}if(arguments[0]instanceof L&&arguments[1]instanceof L){var c=arguments[0],m=arguments[1],E=m.x-c.x,A=m.y-c.y;if(E===0&&A===0)throw new C("Cannot compute the octant for two identical points "+c);return As.octant(E,A)}};var Bi=function(){};Bi.prototype.getCoordinates=function(){},Bi.prototype.size=function(){},Bi.prototype.getCoordinate=function(n){},Bi.prototype.isClosed=function(){},Bi.prototype.setData=function(n){},Bi.prototype.getData=function(){},Bi.prototype.interfaces_=function(){return[]},Bi.prototype.getClass=function(){return Bi};var yu=function(){};yu.prototype.addIntersection=function(n,i){},yu.prototype.interfaces_=function(){return[Bi]},yu.prototype.getClass=function(){return yu};var wn=function(){this._nodeList=new ar(this),this._pts=null,this._data=null;var n=arguments[0],i=arguments[1];this._pts=n,this._data=i};wn.prototype.getCoordinates=function(){return this._pts},wn.prototype.size=function(){return this._pts.length},wn.prototype.getCoordinate=function(n){return this._pts[n]},wn.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},wn.prototype.getSegmentOctant=function(n){return n===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(n),this.getCoordinate(n+1))},wn.prototype.setData=function(n){this._data=n},wn.prototype.safeOctant=function(n,i){return n.equals2D(i)?0:As.octant(n,i)},wn.prototype.getData=function(){return this._data},wn.prototype.addIntersection=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];this.addIntersectionNode(n,i)}else if(arguments.length===4){var s=arguments[0],u=arguments[1],c=arguments[3],m=new L(s.getIntersection(c));this.addIntersection(m,u)}},wn.prototype.toString=function(){return qt.toLineString(new he(this._pts))},wn.prototype.getNodeList=function(){return this._nodeList},wn.prototype.addIntersectionNode=function(n,i){var s=i,u=s+1;if(u<this._pts.length){var c=this._pts[u];n.equals2D(c)&&(s=u)}return this._nodeList.add(n,s)},wn.prototype.addIntersections=function(n,i,s){for(var u=0;u<n.getIntersectionNum();u++)this.addIntersection(n,i,s,u)},wn.prototype.interfaces_=function(){return[yu]},wn.prototype.getClass=function(){return wn},wn.getNodedSubstrings=function(){if(arguments.length===1){var n=arguments[0],i=new j;return wn.getNodedSubstrings(n,i),i}if(arguments.length===2)for(var s=arguments[0],u=arguments[1],c=s.iterator();c.hasNext();)c.next().getNodeList().addSplitEdges(u)};var Zt=function(){if(this.p0=null,this.p1=null,arguments.length===0)this.p0=new L,this.p1=new L;else if(arguments.length===1){var n=arguments[0];this.p0=new L(n.p0),this.p1=new L(n.p1)}else if(arguments.length===2)this.p0=arguments[0],this.p1=arguments[1];else if(arguments.length===4){var i=arguments[0],s=arguments[1],u=arguments[2],c=arguments[3];this.p0=new L(i,s),this.p1=new L(u,c)}},qd={serialVersionUID:{configurable:!0}};Zt.prototype.minX=function(){return Math.min(this.p0.x,this.p1.x)},Zt.prototype.orientationIndex=function(){if(arguments[0]instanceof Zt){var n=arguments[0],i=B.orientationIndex(this.p0,this.p1,n.p0),s=B.orientationIndex(this.p0,this.p1,n.p1);return i>=0&&s>=0||i<=0&&s<=0?Math.max(i,s):0}if(arguments[0]instanceof L){var u=arguments[0];return B.orientationIndex(this.p0,this.p1,u)}},Zt.prototype.toGeometry=function(n){return n.createLineString([this.p0,this.p1])},Zt.prototype.isVertical=function(){return this.p0.x===this.p1.x},Zt.prototype.equals=function(n){if(!(n instanceof Zt))return!1;var i=n;return this.p0.equals(i.p0)&&this.p1.equals(i.p1)},Zt.prototype.intersection=function(n){var i=new J;return i.computeIntersection(this.p0,this.p1,n.p0,n.p1),i.hasIntersection()?i.getIntersection(0):null},Zt.prototype.project=function(){if(arguments[0]instanceof L){var n=arguments[0];if(n.equals(this.p0)||n.equals(this.p1))return new L(n);var i=this.projectionFactor(n),s=new L;return s.x=this.p0.x+i*(this.p1.x-this.p0.x),s.y=this.p0.y+i*(this.p1.y-this.p0.y),s}if(arguments[0]instanceof Zt){var u=arguments[0],c=this.projectionFactor(u.p0),m=this.projectionFactor(u.p1);if(c>=1&&m>=1||c<=0&&m<=0)return null;var E=this.project(u.p0);c<0&&(E=this.p0),c>1&&(E=this.p1);var A=this.project(u.p1);return m<0&&(A=this.p0),m>1&&(A=this.p1),new Zt(E,A)}},Zt.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()},Zt.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)},Zt.prototype.getCoordinate=function(n){return n===0?this.p0:this.p1},Zt.prototype.distancePerpendicular=function(n){return B.distancePointLinePerpendicular(n,this.p0,this.p1)},Zt.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)},Zt.prototype.midPoint=function(){return Zt.midPoint(this.p0,this.p1)},Zt.prototype.projectionFactor=function(n){if(n.equals(this.p0))return 0;if(n.equals(this.p1))return 1;var i=this.p1.x-this.p0.x,s=this.p1.y-this.p0.y,u=i*i+s*s;return u<=0?S.NaN:((n.x-this.p0.x)*i+(n.y-this.p0.y)*s)/u},Zt.prototype.closestPoints=function(n){var i=this.intersection(n);if(i!==null)return[i,i];var s=new Array(2).fill(null),u=S.MAX_VALUE,c=null,m=this.closestPoint(n.p0);u=m.distance(n.p0),s[0]=m,s[1]=n.p0;var E=this.closestPoint(n.p1);(c=E.distance(n.p1))<u&&(u=c,s[0]=E,s[1]=n.p1);var A=n.closestPoint(this.p0);(c=A.distance(this.p0))<u&&(u=c,s[0]=this.p0,s[1]=A);var U=n.closestPoint(this.p1);return(c=U.distance(this.p1))<u&&(u=c,s[0]=this.p1,s[1]=U),s},Zt.prototype.closestPoint=function(n){var i=this.projectionFactor(n);return i>0&&i<1?this.project(n):this.p0.distance(n)<this.p1.distance(n)?this.p0:this.p1},Zt.prototype.maxX=function(){return Math.max(this.p0.x,this.p1.x)},Zt.prototype.getLength=function(){return this.p0.distance(this.p1)},Zt.prototype.compareTo=function(n){var i=n,s=this.p0.compareTo(i.p0);return s!==0?s:this.p1.compareTo(i.p1)},Zt.prototype.reverse=function(){var n=this.p0;this.p0=this.p1,this.p1=n},Zt.prototype.equalsTopo=function(n){return this.p0.equals(n.p0)&&(this.p1.equals(n.p1)||this.p0.equals(n.p1))&&this.p1.equals(n.p0)},Zt.prototype.lineIntersection=function(n){try{return ne.intersection(this.p0,this.p1,n.p0,n.p1)}catch(i){if(!(i instanceof Wt))throw i}return null},Zt.prototype.maxY=function(){return Math.max(this.p0.y,this.p1.y)},Zt.prototype.pointAlongOffset=function(n,i){var s=this.p0.x+n*(this.p1.x-this.p0.x),u=this.p0.y+n*(this.p1.y-this.p0.y),c=this.p1.x-this.p0.x,m=this.p1.y-this.p0.y,E=Math.sqrt(c*c+m*m),A=0,U=0;if(i!==0){if(E<=0)throw new Error("Cannot compute offset from zero-length line segment");A=i*c/E,U=i*m/E}return new L(s-U,u+A)},Zt.prototype.setCoordinates=function(){if(arguments.length===1){var n=arguments[0];this.setCoordinates(n.p0,n.p1)}else if(arguments.length===2){var i=arguments[0],s=arguments[1];this.p0.x=i.x,this.p0.y=i.y,this.p1.x=s.x,this.p1.y=s.y}},Zt.prototype.segmentFraction=function(n){var i=this.projectionFactor(n);return i<0?i=0:(i>1||S.isNaN(i))&&(i=1),i},Zt.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"},Zt.prototype.isHorizontal=function(){return this.p0.y===this.p1.y},Zt.prototype.distance=function(){if(arguments[0]instanceof Zt){var n=arguments[0];return B.distanceLineLine(this.p0,this.p1,n.p0,n.p1)}if(arguments[0]instanceof L){var i=arguments[0];return B.distancePointLine(i,this.p0,this.p1)}},Zt.prototype.pointAlong=function(n){var i=new L;return i.x=this.p0.x+n*(this.p1.x-this.p0.x),i.y=this.p0.y+n*(this.p1.y-this.p0.y),i},Zt.prototype.hashCode=function(){var n=S.doubleToLongBits(this.p0.x);n^=31*S.doubleToLongBits(this.p0.y);var i=Math.trunc(n)^Math.trunc(n>>32),s=S.doubleToLongBits(this.p1.x);return s^=31*S.doubleToLongBits(this.p1.y),i^(Math.trunc(s)^Math.trunc(s>>32))},Zt.prototype.interfaces_=function(){return[F,t]},Zt.prototype.getClass=function(){return Zt},Zt.midPoint=function(n,i){return new L((n.x+i.x)/2,(n.y+i.y)/2)},qd.serialVersionUID.get=function(){return 0x2d2172135f411c00},Object.defineProperties(Zt,qd);var vu=function(){this.tempEnv1=new Pt,this.tempEnv2=new Pt,this._overlapSeg1=new Zt,this._overlapSeg2=new Zt};vu.prototype.overlap=function(){if(arguments.length!==2){if(arguments.length===4){var n=arguments[0],i=arguments[1],s=arguments[2],u=arguments[3];n.getLineSegment(i,this._overlapSeg1),s.getLineSegment(u,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}}},vu.prototype.interfaces_=function(){return[]},vu.prototype.getClass=function(){return vu};var Or=function(){this._pts=null,this._start=null,this._end=null,this._env=null,this._context=null,this._id=null;var n=arguments[0],i=arguments[1],s=arguments[2],u=arguments[3];this._pts=n,this._start=i,this._end=s,this._context=u};Or.prototype.getLineSegment=function(n,i){i.p0=this._pts[n],i.p1=this._pts[n+1]},Or.prototype.computeSelect=function(n,i,s,u){var c=this._pts[i],m=this._pts[s];if(u.tempEnv1.init(c,m),s-i==1)return u.select(this,i),null;if(!n.intersects(u.tempEnv1))return null;var E=Math.trunc((i+s)/2);i<E&&this.computeSelect(n,i,E,u),E<s&&this.computeSelect(n,E,s,u)},Or.prototype.getCoordinates=function(){for(var n=new Array(this._end-this._start+1).fill(null),i=0,s=this._start;s<=this._end;s++)n[i++]=this._pts[s];return n},Or.prototype.computeOverlaps=function(n,i){this.computeOverlapsInternal(this._start,this._end,n,n._start,n._end,i)},Or.prototype.setId=function(n){this._id=n},Or.prototype.select=function(n,i){this.computeSelect(n,this._start,this._end,i)},Or.prototype.getEnvelope=function(){if(this._env===null){var n=this._pts[this._start],i=this._pts[this._end];this._env=new Pt(n,i)}return this._env},Or.prototype.getEndIndex=function(){return this._end},Or.prototype.getStartIndex=function(){return this._start},Or.prototype.getContext=function(){return this._context},Or.prototype.getId=function(){return this._id},Or.prototype.computeOverlapsInternal=function(n,i,s,u,c,m){var E=this._pts[n],A=this._pts[i],U=s._pts[u],Z=s._pts[c];if(i-n==1&&c-u==1)return m.overlap(this,n,s,u),null;if(m.tempEnv1.init(E,A),m.tempEnv2.init(U,Z),!m.tempEnv1.intersects(m.tempEnv2))return null;var ut=Math.trunc((n+i)/2),ht=Math.trunc((u+c)/2);n<ut&&(u<ht&&this.computeOverlapsInternal(n,ut,s,u,ht,m),ht<c&&this.computeOverlapsInternal(n,ut,s,ht,c,m)),ut<i&&(u<ht&&this.computeOverlapsInternal(ut,i,s,u,ht,m),ht<c&&this.computeOverlapsInternal(ut,i,s,ht,c,m))},Or.prototype.interfaces_=function(){return[]},Or.prototype.getClass=function(){return Or};var Ti=function(){};Ti.prototype.interfaces_=function(){return[]},Ti.prototype.getClass=function(){return Ti},Ti.getChainStartIndices=function(n){var i=0,s=new j;s.add(new et(i));do{var u=Ti.findChainEnd(n,i);s.add(new et(u)),i=u}while(i<n.length-1);return Ti.toIntArray(s)},Ti.findChainEnd=function(n,i){for(var s=i;s<n.length-1&&n[s].equals2D(n[s+1]);)s++;if(s>=n.length-1)return n.length-1;for(var u=ln.quadrant(n[s],n[s+1]),c=i+1;c<n.length&&!(!n[c-1].equals2D(n[c])&&ln.quadrant(n[c-1],n[c])!==u);)c++;return c-1},Ti.getChains=function(){if(arguments.length===1){var n=arguments[0];return Ti.getChains(n,null)}if(arguments.length===2){for(var i=arguments[0],s=arguments[1],u=new j,c=Ti.getChainStartIndices(i),m=0;m<c.length-1;m++){var E=new Or(i,c[m],c[m+1],s);u.add(E)}return u}},Ti.toIntArray=function(n){for(var i=new Array(n.size()).fill(null),s=0;s<i.length;s++)i[s]=n.get(s).intValue();return i};var Jo=function(){};Jo.prototype.computeNodes=function(n){},Jo.prototype.getNodedSubstrings=function(){},Jo.prototype.interfaces_=function(){return[]},Jo.prototype.getClass=function(){return Jo};var _u=function(){if(this._segInt=null,arguments.length!==0){if(arguments.length===1){var n=arguments[0];this.setSegmentIntersector(n)}}};_u.prototype.setSegmentIntersector=function(n){this._segInt=n},_u.prototype.interfaces_=function(){return[Jo]},_u.prototype.getClass=function(){return _u};var vf=function(n){function i(u){u?n.call(this,u):n.call(this),this._monoChains=new j,this._index=new Hd,this._idCounter=0,this._nodedSegStrings=null,this._nOverlaps=0}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={SegmentOverlapAction:{configurable:!0}};return i.prototype.getMonotoneChains=function(){return this._monoChains},i.prototype.getNodedSubstrings=function(){return wn.getNodedSubstrings(this._nodedSegStrings)},i.prototype.getIndex=function(){return this._index},i.prototype.add=function(u){for(var c=Ti.getChains(u.getCoordinates(),u).iterator();c.hasNext();){var m=c.next();m.setId(this._idCounter++),this._index.insert(m.getEnvelope(),m),this._monoChains.add(m)}},i.prototype.computeNodes=function(u){this._nodedSegStrings=u;for(var c=u.iterator();c.hasNext();)this.add(c.next());this.intersectChains()},i.prototype.intersectChains=function(){for(var u=new Xd(this._segInt),c=this._monoChains.iterator();c.hasNext();)for(var m=c.next(),E=this._index.query(m.getEnvelope()).iterator();E.hasNext();){var A=E.next();if(A.getId()>m.getId()&&(m.computeOverlaps(A,u),this._nOverlaps++),this._segInt.isDone())return null}},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},s.SegmentOverlapAction.get=function(){return Xd},Object.defineProperties(i,s),i}(_u),Xd=function(n){function i(){n.call(this),this._si=null;var s=arguments[0];this._si=s}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.overlap=function(){if(arguments.length!==4)return n.prototype.overlap.apply(this,arguments);var s=arguments[0],u=arguments[1],c=arguments[2],m=arguments[3],E=s.getContext(),A=c.getContext();this._si.processIntersections(E,u,A,m)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(vu),We=function n(){if(this._quadrantSegments=n.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=n.CAP_ROUND,this._joinStyle=n.JOIN_ROUND,this._mitreLimit=n.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=n.DEFAULT_SIMPLIFY_FACTOR,arguments.length!==0){if(arguments.length===1){var i=arguments[0];this.setQuadrantSegments(i)}else if(arguments.length===2){var s=arguments[0],u=arguments[1];this.setQuadrantSegments(s),this.setEndCapStyle(u)}else if(arguments.length===4){var c=arguments[0],m=arguments[1],E=arguments[2],A=arguments[3];this.setQuadrantSegments(c),this.setEndCapStyle(m),this.setJoinStyle(E),this.setMitreLimit(A)}}},so={CAP_ROUND:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},JOIN_ROUND:{configurable:!0},JOIN_MITRE:{configurable:!0},JOIN_BEVEL:{configurable:!0},DEFAULT_QUADRANT_SEGMENTS:{configurable:!0},DEFAULT_MITRE_LIMIT:{configurable:!0},DEFAULT_SIMPLIFY_FACTOR:{configurable:!0}};We.prototype.getEndCapStyle=function(){return this._endCapStyle},We.prototype.isSingleSided=function(){return this._isSingleSided},We.prototype.setQuadrantSegments=function(n){this._quadrantSegments=n,this._quadrantSegments===0&&(this._joinStyle=We.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=We.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),n<=0&&(this._quadrantSegments=1),this._joinStyle!==We.JOIN_ROUND&&(this._quadrantSegments=We.DEFAULT_QUADRANT_SEGMENTS)},We.prototype.getJoinStyle=function(){return this._joinStyle},We.prototype.setJoinStyle=function(n){this._joinStyle=n},We.prototype.setSimplifyFactor=function(n){this._simplifyFactor=n<0?0:n},We.prototype.getSimplifyFactor=function(){return this._simplifyFactor},We.prototype.getQuadrantSegments=function(){return this._quadrantSegments},We.prototype.setEndCapStyle=function(n){this._endCapStyle=n},We.prototype.getMitreLimit=function(){return this._mitreLimit},We.prototype.setMitreLimit=function(n){this._mitreLimit=n},We.prototype.setSingleSided=function(n){this._isSingleSided=n},We.prototype.interfaces_=function(){return[]},We.prototype.getClass=function(){return We},We.bufferDistanceError=function(n){var i=Math.PI/2/n;return 1-Math.cos(i/2)},so.CAP_ROUND.get=function(){return 1},so.CAP_FLAT.get=function(){return 2},so.CAP_SQUARE.get=function(){return 3},so.JOIN_ROUND.get=function(){return 1},so.JOIN_MITRE.get=function(){return 2},so.JOIN_BEVEL.get=function(){return 3},so.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8},so.DEFAULT_MITRE_LIMIT.get=function(){return 5},so.DEFAULT_SIMPLIFY_FACTOR.get=function(){return .01},Object.defineProperties(We,so);var Mn=function(n){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=B.COUNTERCLOCKWISE,this._inputLine=n||null},xu={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};Mn.prototype.isDeletable=function(n,i,s,u){var c=this._inputLine[n],m=this._inputLine[i],E=this._inputLine[s];return!!this.isConcave(c,m,E)&&!!this.isShallow(c,m,E,u)&&this.isShallowSampled(c,m,n,s,u)},Mn.prototype.deleteShallowConcavities=function(){for(var n=1,i=this.findNextNonDeletedIndex(n),s=this.findNextNonDeletedIndex(i),u=!1;s<this._inputLine.length;){var c=!1;this.isDeletable(n,i,s,this._distanceTol)&&(this._isDeleted[i]=Mn.DELETE,c=!0,u=!0),n=c?s:i,i=this.findNextNonDeletedIndex(n),s=this.findNextNonDeletedIndex(i)}return u},Mn.prototype.isShallowConcavity=function(n,i,s,u){return B.computeOrientation(n,i,s)!==this._angleOrientation?!1:B.distancePointLine(i,n,s)<u},Mn.prototype.isShallowSampled=function(n,i,s,u,c){var m=Math.trunc((u-s)/Mn.NUM_PTS_TO_CHECK);m<=0&&(m=1);for(var E=s;E<u;E+=m)if(!this.isShallow(n,i,this._inputLine[E],c))return!1;return!0},Mn.prototype.isConcave=function(n,i,s){var u=B.computeOrientation(n,i,s)===this._angleOrientation;return u},Mn.prototype.simplify=function(n){this._distanceTol=Math.abs(n),n<0&&(this._angleOrientation=B.CLOCKWISE),this._isDeleted=new Array(this._inputLine.length).fill(null);var i=!1;do i=this.deleteShallowConcavities();while(i);return this.collapseLine()},Mn.prototype.findNextNonDeletedIndex=function(n){for(var i=n+1;i<this._inputLine.length&&this._isDeleted[i]===Mn.DELETE;)i++;return i},Mn.prototype.isShallow=function(n,i,s,u){return B.distancePointLine(i,n,s)<u},Mn.prototype.collapseLine=function(){for(var n=new Dt,i=0;i<this._inputLine.length;i++)this._isDeleted[i]!==Mn.DELETE&&n.add(this._inputLine[i]);return n.toCoordinateArray()},Mn.prototype.interfaces_=function(){return[]},Mn.prototype.getClass=function(){return Mn},Mn.simplify=function(n,i){return new Mn(n).simplify(i)},xu.INIT.get=function(){return 0},xu.DELETE.get=function(){return 1},xu.KEEP.get=function(){return 1},xu.NUM_PTS_TO_CHECK.get=function(){return 10},Object.defineProperties(Mn,xu);var Wr=function(){this._ptList=null,this._precisionModel=null,this._minimimVertexDistance=0,this._ptList=new j},Yd={COORDINATE_ARRAY_TYPE:{configurable:!0}};Wr.prototype.getCoordinates=function(){return this._ptList.toArray(Wr.COORDINATE_ARRAY_TYPE)},Wr.prototype.setPrecisionModel=function(n){this._precisionModel=n},Wr.prototype.addPt=function(n){var i=new L(n);if(this._precisionModel.makePrecise(i),this.isRedundant(i))return null;this._ptList.add(i)},Wr.prototype.revere=function(){},Wr.prototype.addPts=function(n,i){if(i)for(var s=0;s<n.length;s++)this.addPt(n[s]);else for(var u=n.length-1;u>=0;u--)this.addPt(n[u])},Wr.prototype.isRedundant=function(n){if(this._ptList.size()<1)return!1;var i=this._ptList.get(this._ptList.size()-1);return n.distance(i)<this._minimimVertexDistance},Wr.prototype.toString=function(){return new le().createLineString(this.getCoordinates()).toString()},Wr.prototype.closeRing=function(){if(this._ptList.size()<1)return null;var n=new L(this._ptList.get(0)),i=this._ptList.get(this._ptList.size()-1);if(n.equals(i))return null;this._ptList.add(n)},Wr.prototype.setMinimumVertexDistance=function(n){this._minimimVertexDistance=n},Wr.prototype.interfaces_=function(){return[]},Wr.prototype.getClass=function(){return Wr},Yd.COORDINATE_ARRAY_TYPE.get=function(){return new Array(0).fill(null)},Object.defineProperties(Wr,Yd);var me=function(){},Cs={PI_TIMES_2:{configurable:!0},PI_OVER_2:{configurable:!0},PI_OVER_4:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},CLOCKWISE:{configurable:!0},NONE:{configurable:!0}};me.prototype.interfaces_=function(){return[]},me.prototype.getClass=function(){return me},me.toDegrees=function(n){return 180*n/Math.PI},me.normalize=function(n){for(;n>Math.PI;)n-=me.PI_TIMES_2;for(;n<=-Math.PI;)n+=me.PI_TIMES_2;return n},me.angle=function(){if(arguments.length===1){var n=arguments[0];return Math.atan2(n.y,n.x)}if(arguments.length===2){var i=arguments[0],s=arguments[1],u=s.x-i.x,c=s.y-i.y;return Math.atan2(c,u)}},me.isAcute=function(n,i,s){var u=n.x-i.x,c=n.y-i.y;return u*(s.x-i.x)+c*(s.y-i.y)>0},me.isObtuse=function(n,i,s){var u=n.x-i.x,c=n.y-i.y;return u*(s.x-i.x)+c*(s.y-i.y)<0},me.interiorAngle=function(n,i,s){var u=me.angle(i,n),c=me.angle(i,s);return Math.abs(c-u)},me.normalizePositive=function(n){if(n<0){for(;n<0;)n+=me.PI_TIMES_2;n>=me.PI_TIMES_2&&(n=0)}else{for(;n>=me.PI_TIMES_2;)n-=me.PI_TIMES_2;n<0&&(n=0)}return n},me.angleBetween=function(n,i,s){var u=me.angle(i,n),c=me.angle(i,s);return me.diff(u,c)},me.diff=function(n,i){var s=null;return(s=n<i?i-n:n-i)>Math.PI&&(s=2*Math.PI-s),s},me.toRadians=function(n){return n*Math.PI/180},me.getTurn=function(n,i){var s=Math.sin(i-n);return s>0?me.COUNTERCLOCKWISE:s<0?me.CLOCKWISE:me.NONE},me.angleBetweenOriented=function(n,i,s){var u=me.angle(i,n),c=me.angle(i,s)-u;return c<=-Math.PI?c+me.PI_TIMES_2:c>Math.PI?c-me.PI_TIMES_2:c},Cs.PI_TIMES_2.get=function(){return 2*Math.PI},Cs.PI_OVER_2.get=function(){return Math.PI/2},Cs.PI_OVER_4.get=function(){return Math.PI/4},Cs.COUNTERCLOCKWISE.get=function(){return B.COUNTERCLOCKWISE},Cs.CLOCKWISE.get=function(){return B.CLOCKWISE},Cs.NONE.get=function(){return B.COLLINEAR},Object.defineProperties(me,Cs);var pn=function n(){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 Zt,this._seg1=new Zt,this._offset0=new Zt,this._offset1=new Zt,this._side=0,this._hasNarrowConcaveAngle=!1;var i=arguments[0],s=arguments[1],u=arguments[2];this._precisionModel=i,this._bufParams=s,this._li=new J,this._filletAngleQuantum=Math.PI/2/s.getQuadrantSegments(),s.getQuadrantSegments()>=8&&s.getJoinStyle()===We.JOIN_ROUND&&(this._closingSegLengthFactor=n.MAX_CLOSING_SEG_LEN_FACTOR),this.init(u)},Eu={OFFSET_SEGMENT_SEPARATION_FACTOR:{configurable:!0},INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},CURVE_VERTEX_SNAP_DISTANCE_FACTOR:{configurable:!0},MAX_CLOSING_SEG_LEN_FACTOR:{configurable:!0}};pn.prototype.addNextSegment=function(n,i){if(this._s0=this._s1,this._s1=this._s2,this._s2=n,this._seg0.setCoordinates(this._s0,this._s1),this.computeOffsetSegment(this._seg0,this._side,this._distance,this._offset0),this._seg1.setCoordinates(this._s1,this._s2),this.computeOffsetSegment(this._seg1,this._side,this._distance,this._offset1),this._s1.equals(this._s2))return null;var s=B.computeOrientation(this._s0,this._s1,this._s2),u=s===B.CLOCKWISE&&this._side===bt.LEFT||s===B.COUNTERCLOCKWISE&&this._side===bt.RIGHT;s===0?this.addCollinear(i):u?this.addOutsideTurn(s,i):this.addInsideTurn(s,i)},pn.prototype.addLineEndCap=function(n,i){var s=new Zt(n,i),u=new Zt;this.computeOffsetSegment(s,bt.LEFT,this._distance,u);var c=new Zt;this.computeOffsetSegment(s,bt.RIGHT,this._distance,c);var m=i.x-n.x,E=i.y-n.y,A=Math.atan2(E,m);switch(this._bufParams.getEndCapStyle()){case We.CAP_ROUND:this._segList.addPt(u.p1),this.addFilletArc(i,A+Math.PI/2,A-Math.PI/2,B.CLOCKWISE,this._distance),this._segList.addPt(c.p1);break;case We.CAP_FLAT:this._segList.addPt(u.p1),this._segList.addPt(c.p1);break;case We.CAP_SQUARE:var U=new L;U.x=Math.abs(this._distance)*Math.cos(A),U.y=Math.abs(this._distance)*Math.sin(A);var Z=new L(u.p1.x+U.x,u.p1.y+U.y),ut=new L(c.p1.x+U.x,c.p1.y+U.y);this._segList.addPt(Z),this._segList.addPt(ut)}},pn.prototype.getCoordinates=function(){return this._segList.getCoordinates()},pn.prototype.addMitreJoin=function(n,i,s,u){var c=!0,m=null;try{m=ne.intersection(i.p0,i.p1,s.p0,s.p1),(u<=0?1:m.distance(n)/Math.abs(u))>this._bufParams.getMitreLimit()&&(c=!1)}catch(E){if(!(E instanceof Wt))throw E;m=new L(0,0),c=!1}c?this._segList.addPt(m):this.addLimitedMitreJoin(i,s,u,this._bufParams.getMitreLimit())},pn.prototype.addFilletCorner=function(n,i,s,u,c){var m=i.x-n.x,E=i.y-n.y,A=Math.atan2(E,m),U=s.x-n.x,Z=s.y-n.y,ut=Math.atan2(Z,U);u===B.CLOCKWISE?A<=ut&&(A+=2*Math.PI):A>=ut&&(A-=2*Math.PI),this._segList.addPt(i),this.addFilletArc(n,A,ut,u,c),this._segList.addPt(s)},pn.prototype.addOutsideTurn=function(n,i){if(this._offset0.p1.distance(this._offset1.p0)<this._distance*pn.OFFSET_SEGMENT_SEPARATION_FACTOR)return this._segList.addPt(this._offset0.p1),null;this._bufParams.getJoinStyle()===We.JOIN_MITRE?this.addMitreJoin(this._s1,this._offset0,this._offset1,this._distance):this._bufParams.getJoinStyle()===We.JOIN_BEVEL?this.addBevelJoin(this._offset0,this._offset1):(i&&this._segList.addPt(this._offset0.p1),this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,n,this._distance),this._segList.addPt(this._offset1.p0))},pn.prototype.createSquare=function(n){this._segList.addPt(new L(n.x+this._distance,n.y+this._distance)),this._segList.addPt(new L(n.x+this._distance,n.y-this._distance)),this._segList.addPt(new L(n.x-this._distance,n.y-this._distance)),this._segList.addPt(new L(n.x-this._distance,n.y+this._distance)),this._segList.closeRing()},pn.prototype.addSegments=function(n,i){this._segList.addPts(n,i)},pn.prototype.addFirstSegment=function(){this._segList.addPt(this._offset1.p0)},pn.prototype.addLastSegment=function(){this._segList.addPt(this._offset1.p1)},pn.prototype.initSideSegments=function(n,i,s){this._s1=n,this._s2=i,this._side=s,this._seg1.setCoordinates(n,i),this.computeOffsetSegment(this._seg1,s,this._distance,this._offset1)},pn.prototype.addLimitedMitreJoin=function(n,i,s,u){var c=this._seg0.p1,m=me.angle(c,this._seg0.p0),E=me.angleBetweenOriented(this._seg0.p0,c,this._seg1.p1)/2,A=me.normalize(m+E),U=me.normalize(A+Math.PI),Z=u*s,ut=s-Z*Math.abs(Math.sin(E)),ht=c.x+Z*Math.cos(U),At=c.y+Z*Math.sin(U),Rt=new L(ht,At),kt=new Zt(c,Rt),ee=kt.pointAlongOffset(1,ut),on=kt.pointAlongOffset(1,-ut);this._side===bt.LEFT?(this._segList.addPt(ee),this._segList.addPt(on)):(this._segList.addPt(on),this._segList.addPt(ee))},pn.prototype.computeOffsetSegment=function(n,i,s,u){var c=i===bt.LEFT?1:-1,m=n.p1.x-n.p0.x,E=n.p1.y-n.p0.y,A=Math.sqrt(m*m+E*E),U=c*s*m/A,Z=c*s*E/A;u.p0.x=n.p0.x-Z,u.p0.y=n.p0.y+U,u.p1.x=n.p1.x-Z,u.p1.y=n.p1.y+U},pn.prototype.addFilletArc=function(n,i,s,u,c){var m=u===B.CLOCKWISE?-1:1,E=Math.abs(i-s),A=Math.trunc(E/this._filletAngleQuantum+.5);if(A<1)return null;for(var U=E/A,Z=0,ut=new L;Z<E;){var ht=i+m*Z;ut.x=n.x+c*Math.cos(ht),ut.y=n.y+c*Math.sin(ht),this._segList.addPt(ut),Z+=U}},pn.prototype.addInsideTurn=function(n,i){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*pn.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR)this._segList.addPt(this._offset0.p1);else{if(this._segList.addPt(this._offset0.p1),this._closingSegLengthFactor>0){var s=new L((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(s);var u=new L((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(u)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}},pn.prototype.createCircle=function(n){var i=new L(n.x+this._distance,n.y);this._segList.addPt(i),this.addFilletArc(n,0,2*Math.PI,-1,this._distance),this._segList.closeRing()},pn.prototype.addBevelJoin=function(n,i){this._segList.addPt(n.p1),this._segList.addPt(i.p0)},pn.prototype.init=function(n){this._distance=n,this._maxCurveSegmentError=n*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new Wr,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(n*pn.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)},pn.prototype.addCollinear=function(n){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2),this._li.getIntersectionNum()>=2&&(this._bufParams.getJoinStyle()===We.JOIN_BEVEL||this._bufParams.getJoinStyle()===We.JOIN_MITRE?(n&&this._segList.addPt(this._offset0.p1),this._segList.addPt(this._offset1.p0)):this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,B.CLOCKWISE,this._distance))},pn.prototype.closeRing=function(){this._segList.closeRing()},pn.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle},pn.prototype.interfaces_=function(){return[]},pn.prototype.getClass=function(){return pn},Eu.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return .001},Eu.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return .001},Eu.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6},Eu.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80},Object.defineProperties(pn,Eu);var Mr=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var n=arguments[0],i=arguments[1];this._precisionModel=n,this._bufParams=i};Mr.prototype.getOffsetCurve=function(n,i){if(this._distance=i,i===0)return null;var s=i<0,u=Math.abs(i),c=this.getSegGen(u);n.length<=1?this.computePointCurve(n[0],c):this.computeOffsetCurve(n,s,c);var m=c.getCoordinates();return s&&ft.reverse(m),m},Mr.prototype.computeSingleSidedBufferCurve=function(n,i,s){var u=this.simplifyTolerance(this._distance);if(i){s.addSegments(n,!0);var c=Mn.simplify(n,-u),m=c.length-1;s.initSideSegments(c[m],c[m-1],bt.LEFT),s.addFirstSegment();for(var E=m-2;E>=0;E--)s.addNextSegment(c[E],!0)}else{s.addSegments(n,!1);var A=Mn.simplify(n,u),U=A.length-1;s.initSideSegments(A[0],A[1],bt.LEFT),s.addFirstSegment();for(var Z=2;Z<=U;Z++)s.addNextSegment(A[Z],!0)}s.addLastSegment(),s.closeRing()},Mr.prototype.computeRingBufferCurve=function(n,i,s){var u=this.simplifyTolerance(this._distance);i===bt.RIGHT&&(u=-u);var c=Mn.simplify(n,u),m=c.length-1;s.initSideSegments(c[m-1],c[0],i);for(var E=1;E<=m;E++){var A=E!==1;s.addNextSegment(c[E],A)}s.closeRing()},Mr.prototype.computeLineBufferCurve=function(n,i){var s=this.simplifyTolerance(this._distance),u=Mn.simplify(n,s),c=u.length-1;i.initSideSegments(u[0],u[1],bt.LEFT);for(var m=2;m<=c;m++)i.addNextSegment(u[m],!0);i.addLastSegment(),i.addLineEndCap(u[c-1],u[c]);var E=Mn.simplify(n,-s),A=E.length-1;i.initSideSegments(E[A],E[A-1],bt.LEFT);for(var U=A-2;U>=0;U--)i.addNextSegment(E[U],!0);i.addLastSegment(),i.addLineEndCap(E[1],E[0]),i.closeRing()},Mr.prototype.computePointCurve=function(n,i){switch(this._bufParams.getEndCapStyle()){case We.CAP_ROUND:i.createCircle(n);break;case We.CAP_SQUARE:i.createSquare(n)}},Mr.prototype.getLineCurve=function(n,i){if(this._distance=i,i<0&&!this._bufParams.isSingleSided()||i===0)return null;var s=Math.abs(i),u=this.getSegGen(s);if(n.length<=1)this.computePointCurve(n[0],u);else if(this._bufParams.isSingleSided()){var c=i<0;this.computeSingleSidedBufferCurve(n,c,u)}else this.computeLineBufferCurve(n,u);return u.getCoordinates()},Mr.prototype.getBufferParameters=function(){return this._bufParams},Mr.prototype.simplifyTolerance=function(n){return n*this._bufParams.getSimplifyFactor()},Mr.prototype.getRingCurve=function(n,i,s){if(this._distance=s,n.length<=2)return this.getLineCurve(n,s);if(s===0)return Mr.copyCoordinates(n);var u=this.getSegGen(s);return this.computeRingBufferCurve(n,i,u),u.getCoordinates()},Mr.prototype.computeOffsetCurve=function(n,i,s){var u=this.simplifyTolerance(this._distance);if(i){var c=Mn.simplify(n,-u),m=c.length-1;s.initSideSegments(c[m],c[m-1],bt.LEFT),s.addFirstSegment();for(var E=m-2;E>=0;E--)s.addNextSegment(c[E],!0)}else{var A=Mn.simplify(n,u),U=A.length-1;s.initSideSegments(A[0],A[1],bt.LEFT),s.addFirstSegment();for(var Z=2;Z<=U;Z++)s.addNextSegment(A[Z],!0)}s.addLastSegment()},Mr.prototype.getSegGen=function(n){return new pn(this._precisionModel,this._bufParams,n)},Mr.prototype.interfaces_=function(){return[]},Mr.prototype.getClass=function(){return Mr},Mr.copyCoordinates=function(n){for(var i=new Array(n.length).fill(null),s=0;s<i.length;s++)i[s]=new L(n[s]);return i};var Ps=function(){this._subgraphs=null,this._seg=new Zt,this._cga=new B;var n=arguments[0];this._subgraphs=n},Zd={DepthSegment:{configurable:!0}};Ps.prototype.findStabbedSegments=function(){if(arguments.length===1){for(var n=arguments[0],i=new j,s=this._subgraphs.iterator();s.hasNext();){var u=s.next(),c=u.getEnvelope();n.y<c.getMinY()||n.y>c.getMaxY()||this.findStabbedSegments(n,u.getDirectedEdges(),i)}return i}if(arguments.length===3){if(X(arguments[2],wt)&&arguments[0]instanceof L&&arguments[1]instanceof yf){for(var m=arguments[0],E=arguments[1],A=arguments[2],U=E.getEdge().getCoordinates(),Z=0;Z<U.length-1;Z++)if(this._seg.p0=U[Z],this._seg.p1=U[Z+1],this._seg.p0.y>this._seg.p1.y&&this._seg.reverse(),!(Math.max(this._seg.p0.x,this._seg.p1.x)<m.x)&&!(this._seg.isHorizontal()||m.y<this._seg.p0.y||m.y>this._seg.p1.y||B.computeOrientation(this._seg.p0,this._seg.p1,m)===B.RIGHT)){var ut=E.getDepth(bt.LEFT);this._seg.p0.equals(U[Z])||(ut=E.getDepth(bt.RIGHT));var ht=new $o(this._seg,ut);A.add(ht)}}else if(X(arguments[2],wt)&&arguments[0]instanceof L&&X(arguments[1],wt))for(var At=arguments[0],Rt=arguments[1],kt=arguments[2],ee=Rt.iterator();ee.hasNext();){var on=ee.next();on.isForward()&&this.findStabbedSegments(At,on,kt)}}},Ps.prototype.getDepth=function(n){var i=this.findStabbedSegments(n);return i.size()===0?0:di.min(i)._leftDepth},Ps.prototype.interfaces_=function(){return[]},Ps.prototype.getClass=function(){return Ps},Zd.DepthSegment.get=function(){return $o},Object.defineProperties(Ps,Zd);var $o=function(){this._upwardSeg=null,this._leftDepth=null;var n=arguments[0],i=arguments[1];this._upwardSeg=new Zt(n),this._leftDepth=i};$o.prototype.compareTo=function(n){var i=n;if(this._upwardSeg.minX()>=i._upwardSeg.maxX())return 1;if(this._upwardSeg.maxX()<=i._upwardSeg.minX())return-1;var s=this._upwardSeg.orientationIndex(i._upwardSeg);return s!==0||(s=-1*i._upwardSeg.orientationIndex(this._upwardSeg))!=0?s:this._upwardSeg.compareTo(i._upwardSeg)},$o.prototype.compareX=function(n,i){var s=n.p0.compareTo(i.p0);return s!==0?s:n.p1.compareTo(i.p1)},$o.prototype.toString=function(){return this._upwardSeg.toString()},$o.prototype.interfaces_=function(){return[F]},$o.prototype.getClass=function(){return $o};var qe=function(n,i,s){this.p0=n||null,this.p1=i||null,this.p2=s||null};qe.prototype.area=function(){return qe.area(this.p0,this.p1,this.p2)},qe.prototype.signedArea=function(){return qe.signedArea(this.p0,this.p1,this.p2)},qe.prototype.interpolateZ=function(n){if(n===null)throw new C("Supplied point is null.");return qe.interpolateZ(n,this.p0,this.p1,this.p2)},qe.prototype.longestSideLength=function(){return qe.longestSideLength(this.p0,this.p1,this.p2)},qe.prototype.isAcute=function(){return qe.isAcute(this.p0,this.p1,this.p2)},qe.prototype.circumcentre=function(){return qe.circumcentre(this.p0,this.p1,this.p2)},qe.prototype.area3D=function(){return qe.area3D(this.p0,this.p1,this.p2)},qe.prototype.centroid=function(){return qe.centroid(this.p0,this.p1,this.p2)},qe.prototype.inCentre=function(){return qe.inCentre(this.p0,this.p1,this.p2)},qe.prototype.interfaces_=function(){return[]},qe.prototype.getClass=function(){return qe},qe.area=function(n,i,s){return Math.abs(((s.x-n.x)*(i.y-n.y)-(i.x-n.x)*(s.y-n.y))/2)},qe.signedArea=function(n,i,s){return((s.x-n.x)*(i.y-n.y)-(i.x-n.x)*(s.y-n.y))/2},qe.det=function(n,i,s,u){return n*u-i*s},qe.interpolateZ=function(n,i,s,u){var c=i.x,m=i.y,E=s.x-c,A=u.x-c,U=s.y-m,Z=u.y-m,ut=E*Z-A*U,ht=n.x-c,At=n.y-m,Rt=(Z*ht-A*At)/ut,kt=(-U*ht+E*At)/ut;return i.z+Rt*(s.z-i.z)+kt*(u.z-i.z)},qe.longestSideLength=function(n,i,s){var u=n.distance(i),c=i.distance(s),m=s.distance(n),E=u;return c>E&&(E=c),m>E&&(E=m),E},qe.isAcute=function(n,i,s){return!!me.isAcute(n,i,s)&&!!me.isAcute(i,s,n)&&!!me.isAcute(s,n,i)},qe.circumcentre=function(n,i,s){var u=s.x,c=s.y,m=n.x-u,E=n.y-c,A=i.x-u,U=i.y-c,Z=2*qe.det(m,E,A,U),ut=qe.det(E,m*m+E*E,U,A*A+U*U),ht=qe.det(m,m*m+E*E,A,A*A+U*U);return new L(u-ut/Z,c+ht/Z)},qe.perpendicularBisector=function(n,i){var s=i.x-n.x,u=i.y-n.y,c=new ne(n.x+s/2,n.y+u/2,1),m=new ne(n.x-u+s/2,n.y+s+u/2,1);return new ne(c,m)},qe.angleBisector=function(n,i,s){var u=i.distance(n),c=u/(u+i.distance(s)),m=s.x-n.x,E=s.y-n.y;return new L(n.x+c*m,n.y+c*E)},qe.area3D=function(n,i,s){var u=i.x-n.x,c=i.y-n.y,m=i.z-n.z,E=s.x-n.x,A=s.y-n.y,U=s.z-n.z,Z=c*U-m*A,ut=m*E-u*U,ht=u*A-c*E,At=Z*Z+ut*ut+ht*ht,Rt=Math.sqrt(At)/2;return Rt},qe.centroid=function(n,i,s){var u=(n.x+i.x+s.x)/3,c=(n.y+i.y+s.y)/3;return new L(u,c)},qe.inCentre=function(n,i,s){var u=i.distance(s),c=n.distance(s),m=n.distance(i),E=u+c+m,A=(u*n.x+c*i.x+m*s.x)/E,U=(u*n.y+c*i.y+m*s.y)/E;return new L(A,U)};var ii=function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new j;var n=arguments[0],i=arguments[1],s=arguments[2];this._inputGeom=n,this._distance=i,this._curveBuilder=s};ii.prototype.addPoint=function(n){if(this._distance<=0)return null;var i=n.getCoordinates(),s=this._curveBuilder.getLineCurve(i,this._distance);this.addCurve(s,k.EXTERIOR,k.INTERIOR)},ii.prototype.addPolygon=function(n){var i=this._distance,s=bt.LEFT;this._distance<0&&(i=-this._distance,s=bt.RIGHT);var u=n.getExteriorRing(),c=ft.removeRepeatedPoints(u.getCoordinates());if(this._distance<0&&this.isErodedCompletely(u,this._distance)||this._distance<=0&&c.length<3)return null;this.addPolygonRing(c,i,s,k.EXTERIOR,k.INTERIOR);for(var m=0;m<n.getNumInteriorRing();m++){var E=n.getInteriorRingN(m),A=ft.removeRepeatedPoints(E.getCoordinates());this._distance>0&&this.isErodedCompletely(E,-this._distance)||this.addPolygonRing(A,i,bt.opposite(s),k.INTERIOR,k.EXTERIOR)}},ii.prototype.isTriangleErodedCompletely=function(n,i){var s=new qe(n[0],n[1],n[2]),u=s.inCentre();return B.distancePointLine(u,s.p0,s.p1)<Math.abs(i)},ii.prototype.addLineString=function(n){if(this._distance<=0&&!this._curveBuilder.getBufferParameters().isSingleSided())return null;var i=ft.removeRepeatedPoints(n.getCoordinates()),s=this._curveBuilder.getLineCurve(i,this._distance);this.addCurve(s,k.EXTERIOR,k.INTERIOR)},ii.prototype.addCurve=function(n,i,s){if(n===null||n.length<2)return null;var u=new wn(n,new rn(0,k.BOUNDARY,i,s));this._curveList.add(u)},ii.prototype.getCurves=function(){return this.add(this._inputGeom),this._curveList},ii.prototype.addPolygonRing=function(n,i,s,u,c){if(i===0&&n.length<sn.MINIMUM_VALID_SIZE)return null;var m=u,E=c;n.length>=sn.MINIMUM_VALID_SIZE&&B.isCCW(n)&&(m=c,E=u,s=bt.opposite(s));var A=this._curveBuilder.getRingCurve(n,s,i);this.addCurve(A,m,E)},ii.prototype.add=function(n){if(n.isEmpty())return null;n instanceof Vt?this.addPolygon(n):n instanceof Bt?this.addLineString(n):n instanceof Qt?this.addPoint(n):n instanceof fe?this.addCollection(n):n instanceof H?this.addCollection(n):n instanceof un?this.addCollection(n):n instanceof Vn&&this.addCollection(n)},ii.prototype.isErodedCompletely=function(n,i){var s=n.getCoordinates();if(s.length<4)return i<0;if(s.length===4)return this.isTriangleErodedCompletely(s,i);var u=n.getEnvelopeInternal(),c=Math.min(u.getHeight(),u.getWidth());return i<0&&2*Math.abs(i)>c},ii.prototype.addCollection=function(n){for(var i=0;i<n.getNumGeometries();i++){var s=n.getGeometryN(i);this.add(s)}},ii.prototype.interfaces_=function(){return[]},ii.prototype.getClass=function(){return ii};var la=function(){};la.prototype.locate=function(n){},la.prototype.interfaces_=function(){return[]},la.prototype.getClass=function(){return la};var zi=function(){this._parent=null,this._atStart=null,this._max=null,this._index=null,this._subcollectionIterator=null;var n=arguments[0];this._parent=n,this._atStart=!0,this._index=0,this._max=n.getNumGeometries()};zi.prototype.next=function(){if(this._atStart)return this._atStart=!1,zi.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 o;var n=this._parent.getGeometryN(this._index++);return n instanceof Vn?(this._subcollectionIterator=new zi(n),this._subcollectionIterator.next()):n},zi.prototype.remove=function(){throw new Error(this.getClass().getName())},zi.prototype.hasNext=function(){if(this._atStart)return!0;if(this._subcollectionIterator!==null){if(this._subcollectionIterator.hasNext())return!0;this._subcollectionIterator=null}return!(this._index>=this._max)},zi.prototype.interfaces_=function(){return[Y]},zi.prototype.getClass=function(){return zi},zi.isAtomic=function(n){return!(n instanceof Vn)};var qr=function(){this._geom=null;var n=arguments[0];this._geom=n};qr.prototype.locate=function(n){return qr.locate(n,this._geom)},qr.prototype.interfaces_=function(){return[la]},qr.prototype.getClass=function(){return qr},qr.isPointInRing=function(n,i){return!!i.getEnvelopeInternal().intersects(n)&&B.isPointInRing(n,i.getCoordinates())},qr.containsPointInPolygon=function(n,i){if(i.isEmpty())return!1;var s=i.getExteriorRing();if(!qr.isPointInRing(n,s))return!1;for(var u=0;u<i.getNumInteriorRing();u++){var c=i.getInteriorRingN(u);if(qr.isPointInRing(n,c))return!1}return!0},qr.containsPoint=function(n,i){if(i instanceof Vt)return qr.containsPointInPolygon(n,i);if(i instanceof Vn)for(var s=new zi(i);s.hasNext();){var u=s.next();if(u!==i&&qr.containsPoint(n,u))return!0}return!1},qr.locate=function(n,i){return i.isEmpty()?k.EXTERIOR:qr.containsPoint(n,i)?k.INTERIOR:k.EXTERIOR};var jn=function(){this._edgeMap=new _,this._edgeList=null,this._ptInAreaLocation=[k.NONE,k.NONE]};jn.prototype.getNextCW=function(n){this.getEdges();var i=this._edgeList.indexOf(n),s=i-1;return i===0&&(s=this._edgeList.size()-1),this._edgeList.get(s)},jn.prototype.propagateSideLabels=function(n){for(var i=k.NONE,s=this.iterator();s.hasNext();){var u=s.next().getLabel();u.isArea(n)&&u.getLocation(n,bt.LEFT)!==k.NONE&&(i=u.getLocation(n,bt.LEFT))}if(i===k.NONE)return null;for(var c=i,m=this.iterator();m.hasNext();){var E=m.next(),A=E.getLabel();if(A.getLocation(n,bt.ON)===k.NONE&&A.setLocation(n,bt.ON,c),A.isArea(n)){var U=A.getLocation(n,bt.LEFT),Z=A.getLocation(n,bt.RIGHT);if(Z!==k.NONE){if(Z!==c)throw new io("side location conflict",E.getCoordinate());U===k.NONE&&b.shouldNeverReachHere("found single null side (at "+E.getCoordinate()+")"),c=U}else b.isTrue(A.getLocation(n,bt.LEFT)===k.NONE,"found single null side"),A.setLocation(n,bt.RIGHT,c),A.setLocation(n,bt.LEFT,c)}}},jn.prototype.getCoordinate=function(){var n=this.iterator();return n.hasNext()?n.next().getCoordinate():null},jn.prototype.print=function(n){Nt.out.println("EdgeEndStar: "+this.getCoordinate());for(var i=this.iterator();i.hasNext();)i.next().print(n)},jn.prototype.isAreaLabelsConsistent=function(n){return this.computeEdgeEndLabels(n.getBoundaryNodeRule()),this.checkAreaLabelsConsistent(0)},jn.prototype.checkAreaLabelsConsistent=function(n){var i=this.getEdges();if(i.size()<=0)return!0;var s=i.size()-1,u=i.get(s).getLabel().getLocation(n,bt.LEFT);b.isTrue(u!==k.NONE,"Found unlabelled area edge");for(var c=u,m=this.iterator();m.hasNext();){var E=m.next().getLabel();b.isTrue(E.isArea(n),"Found non-area edge");var A=E.getLocation(n,bt.LEFT),U=E.getLocation(n,bt.RIGHT);if(A===U||U!==c)return!1;c=A}return!0},jn.prototype.findIndex=function(n){this.iterator();for(var i=0;i<this._edgeList.size();i++)if(this._edgeList.get(i)===n)return i;return-1},jn.prototype.iterator=function(){return this.getEdges().iterator()},jn.prototype.getEdges=function(){return this._edgeList===null&&(this._edgeList=new j(this._edgeMap.values())),this._edgeList},jn.prototype.getLocation=function(n,i,s){return this._ptInAreaLocation[n]===k.NONE&&(this._ptInAreaLocation[n]=qr.locate(i,s[n].getGeometry())),this._ptInAreaLocation[n]},jn.prototype.toString=function(){var n=new pt;n.append("EdgeEndStar: "+this.getCoordinate()),n.append(\`
41
41
  \`);for(var i=this.iterator();i.hasNext();){var s=i.next();n.append(s),n.append(\`