@aibee/crc-bmap 0.0.126 → 0.0.127

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.
@@ -1,4 +1,4 @@
1
- "use strict";var fr=Object.create;var Kt=Object.defineProperty;var dr=Object.getOwnPropertyDescriptor;var gr=Object.getOwnPropertyNames;var mr=Object.getPrototypeOf,yr=Object.prototype.hasOwnProperty;var lt=(o,n)=>()=>(n||o((n={exports:{}}).exports,n),n.exports),_r=(o,n)=>{for(var t in n)Kt(o,t,{get:n[t],enumerable:!0})},an=(o,n,t,e)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of gr(n))!yr.call(o,r)&&r!==t&&Kt(o,r,{get:()=>n[r],enumerable:!(e=dr(n,r))||e.enumerable});return o};var ye=(o,n,t)=>(t=o!=null?fr(mr(o)):{},an(n||!o||!o.__esModule?Kt(t,"default",{value:o,enumerable:!0}):t,o)),vr=o=>an(Kt({},"__esModule",{value:!0}),o);var fn=lt((pi,pn)=>{pn.exports=function(n,t){return n[0]=t[0],n[1]=t[1],n}});var mn=lt((fi,gn)=>{var dn=fn();gn.exports=function(o,n){Array.isArray(n)||(n=[]),o.length>0&&n.push(dn([0,0],o[0]));for(var t=0;t<o.length-1;t++){var e=o[t],r=o[t+1],i=e[0],s=e[1],l=r[0],u=r[1],a=[.75*i+.25*l,.75*s+.25*u],c=[.25*i+.75*l,.25*s+.75*u];n.push(a),n.push(c)}return o.length>1&&n.push(dn([0,0],o[o.length-1])),n}});var bn=lt((mi,En)=>{var Ge=class{constructor(){this.keys=new Set,this.queue=[]}sort(){this.queue.sort((n,t)=>n.priority-t.priority)}set(n,t){let e=Number(t);if(isNaN(e))throw new TypeError('"priority" must be a number');return this.keys.has(n)?this.queue.map(r=>(r.key===n&&Object.assign(r,{priority:e}),r)):(this.keys.add(n),this.queue.push({key:n,priority:e})),this.sort(),this.queue.length}next(){let n=this.queue.shift();return this.keys.delete(n.key),n}isEmpty(){return this.queue.length===0}has(n){return this.keys.has(n)}get(n){return this.queue.find(t=>t.key===n)}};En.exports=Ge});var wn=lt((yi,Sn)=>{function Mn(o,n){let t=new Map;for(let[e,r]of o)e!==n&&r instanceof Map?t.set(e,Mn(r,n)):e!==n&&t.set(e,r);return t}Sn.exports=Mn});var Pn=lt((_i,Cn)=>{function Ar(o){let n=Number(o);return!(isNaN(n)||n<=0)}function Tn(o){let n=new Map;return Object.keys(o).forEach(e=>{let r=o[e];if(r!==null&&typeof r=="object"&&!Array.isArray(r))return n.set(e,Tn(r));if(!Ar(r))throw new Error(`Could not add node at key "${e}", make sure it's a valid node`,r);return n.set(e,Number(r))}),n}Cn.exports=Tn});var Rn=lt((vi,An)=>{function Ln(o){if(!(o instanceof Map))throw new Error(`Invalid graph: Expected Map instead found ${typeof o}`);o.forEach((n,t)=>{if(typeof n=="object"&&n instanceof Map){Ln(n);return}if(typeof n!="number"||n<=0)throw new Error(`Values must be numbers greater than 0. Found value ${n} at ${t}`)})}An.exports=Ln});var ke=lt((xi,Dn)=>{var Rr=bn(),Ir=wn(),In=Pn(),Nn=Rn(),Be=class{constructor(n){n instanceof Map?(Nn(n),this.graph=n):n?this.graph=In(n):this.graph=new Map}addNode(n,t){let e;return t instanceof Map?(Nn(t),e=t):e=In(t),this.graph.set(n,e),this}addVertex(n,t){return this.addNode(n,t)}removeNode(n){return this.graph=Ir(this.graph,n),this}path(n,t,e={}){if(!this.graph.size)return e.cost?{path:null,cost:0}:null;let r=new Set,i=new Rr,s=new Map,l=[],u=0,a=[];if(e.avoid&&(a=[].concat(e.avoid)),a.includes(n))throw new Error(`Starting node (${n}) cannot be avoided`);if(a.includes(t))throw new Error(`Ending node (${t}) cannot be avoided`);for(i.set(n,0);!i.isEmpty();){let c=i.next();if(c.key===t){u=c.priority;let d=c.key;for(;s.has(d);)l.push(d),d=s.get(d);break}r.add(c.key),(this.graph.get(c.key)||new Map).forEach((d,m)=>{if(r.has(m)||a.includes(m))return null;if(!i.has(m))return s.set(m,c.key),i.set(m,c.priority+d);let g=i.get(m).priority,h=c.priority+d;return h<g?(s.set(m,c.key),i.set(m,h)):null})}return l.length?(e.trim?l.shift():l=l.concat([n]),e.reverse||(l=l.reverse()),e.cost?{path:l,cost:u}:l):e.cost?{path:null,cost:0}:null}shortestPath(...n){return this.path(...n)}};Dn.exports=Be});var zr={};_r(zr,{AibeeLoader:()=>on,BMap:()=>$e,BaseSvg:()=>K,Context:()=>Xt,Equipment:()=>Ke,Events:()=>Ne,Floor:()=>rt,GlbModel:()=>kt,Graphic:()=>D,GraphicLayer:()=>Ot,GroundTexture:()=>Bt,HeatmapElement:()=>Nt,HooksName:()=>Et,HoverHelper:()=>Wt,Lane:()=>zt,Layer:()=>U,MapTypePolar:()=>tr,MergeGraphic:()=>Vt,Model:()=>Dt,MulFloors:()=>nn,Navigation:()=>tn,Overlay:()=>It,PathDirection:()=>vn,Poi:()=>Mt,PoiLayer:()=>gt,RoadNetwork:()=>ze,RoadNetwork2:()=>Ve,SelectBox:()=>We,Selection:()=>Ht,Shadow:()=>Rt,SplitLoad:()=>en,SvgLine:()=>Ft,SvgPolygon:()=>Ut,Timer:()=>Y,UniqueKey:()=>ft,Wall:()=>Gt,addAlphaToHexColor:()=>Sr,calc_angle:()=>Pe,calc_direction:()=>xn,clearCanvas:()=>Ce,clearTextTexture:()=>Te,convertToSnakeCase:()=>He,createCanvas:()=>cn,createCircle:()=>xt,createLine:()=>Pt,createRect:()=>pt,createSvg:()=>Le,createSvgElement:()=>Ct,darkenColor:()=>nt,defaultAibeeLoaderOption:()=>kr,defaultConfig:()=>Jn,defaultGraphicOptions:()=>ne,defaultOptions:()=>zn,dispose:()=>z,disposeLoader:()=>Re,distancePointToSegment:()=>Fe,generatorKeyByObj:()=>W,getCenter:()=>Jt,getConfig:()=>je,getDirectPath:()=>Lr,getLength:()=>R,getLongestSideDir:()=>Er,getPathLength:()=>it,getTextureByText:()=>xr,hasChinese:()=>Se,initCamera:()=>xe,initCanvas:()=>un,initControl:()=>be,initDirectionalLight:()=>Me,initLight:()=>Ee,initRenderer:()=>ve,initScene:()=>_e,initShape:()=>$,isContain:()=>Tt,isControl:()=>ee,isMac:()=>At,loadBuildingGround:()=>Ye,loadGraphics:()=>qt,loadModel:()=>Lt,moveOnRoute:()=>Ue,proxyOptions:()=>ht,removeWeightPath:()=>_n,setCirclePosition:()=>st,setLineStartEnd:()=>V,setRectPosition:()=>H,simplifyPath:()=>Oe,sleepOnePromise:()=>Ae,sleepOneRf:()=>br,smoothPath:()=>De,strToNumber:()=>Mr,timeoutPromise:()=>ot,toWebWorker:()=>Nr,triggerWorker:()=>dt,vector3ToDevice:()=>_,xhrGet:()=>Tr});module.exports=vr(zr);var he=require("three");var Y=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=require("three"),ln=require("three/examples/jsm/controls/MapControls");function _e(){let o=new S.Scene;return o.background=new S.Color(16777215),o}function ve(){let o=new S.WebGLRenderer({antialias:!0});return o.autoClear=!0,o.setClearAlpha(1),o.setClearColor(16777215),o.setPixelRatio(window.devicePixelRatio),o.shadowMap.enabled=!0,o.shadowMap.autoUpdate=!0,o.shadowMap.type=S.PCFSoftShadowMap,o}function xe(o,n){let t=new S.OrthographicCamera(-o/2,o/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 Ee(){let o=new S.Group,n=new S.AmbientLight(16777215,2.6);return o.add(n),o}function be(o,n){let t=new ln.MapControls(o,n);return t.enableDamping=!1,t.zoomSpeed=2,t}function $(o,n=[]){let t=new S.Shape(o.map(e=>new S.Vector2(...e)));return n.length&&n.forEach(e=>{var r=new S.Path(e.map(i=>new S.Vector2(...i)));t.holes.push(r)}),t}function Me(o=16777215,n=1){let t=new S.DirectionalLight(o,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(o,n){if(n&&o.children&&o.children.length&&o.children.forEach(t=>{z(t,n)}),o.isMesh){let t=o;t.geometry&&t.geometry.dispose(),t.material&&(Array.isArray(t.material)?t.material.forEach(e=>{e.dispose()}):t.material.dispose())}o.isLight&&o.dispose?.()}function Se(o){return/[\u4E00-\u9FA5]+/g.test(o)}var ct=require("three");var Zt=new Map;function un(){let o=document.createElement("canvas");o.width=1024,o.height=64;let n=o.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:o,ctx:n}}var we,ut;function cn(){if(!we){let{canvas:o,ctx:n}=un();we=o,ut=n}}function xr(o){if(Zt.has(o))return Zt.get(o);cn(),ut.clearRect(0,0,1024,64);let n=Se(o)?4:8;ut.strokeText(o,2,n),ut.fillText(o,2,n);let t=Math.ceil(ut.measureText(o).width);t=t%2===0?t:t+1,t+=2;let e=ut.getImageData(0,0,t,64),r=new ct.DataTexture(Uint8Array.from(e.data),t,64,ct.RGBAFormat);return r.flipY=!0,r.minFilter=ct.LinearFilter,r.magFilter=ct.LinearFilter,Zt.set(o,r),r}function Te(){Zt.clear()}function Ce(){ut=null,we=null}var et=require("three"),vt=require("@turf/turf");function _(o,n,t,e){let r=o.clone().project(n),i=t/2,s=e/2,l=Math.round(r.x*i+i),u=Math.round(-r.y*s+s);return{x:l,y:u}}function Jt(o){let n=(0,vt.featureCollection)(o.map(e=>(0,vt.point)(e)));return(0,vt.center)(n).geometry.coordinates}function Tt(o,n,t){return o.x>=n.x&&o.x<=t.x&&o.y>=n.y&&o.y<=t.y}function Er(o){let n=0,t=new et.Vector3;for(let e=1;e<o.length;e++){let r=new et.Vector3(o[e-1][0],o[e-1][1],0),i=new et.Vector3(o[e][0],o[e][1],0),s=i.distanceTo(r);s>n&&(n=s,t=i.clone().sub(r).normalize())}return t}function R(o,n){return Math.sqrt((n[0]-o[0])**2+(n[1]-o[1])**2)}function it(o){let n=0;for(let t=0;t<o.length-1;t++)n+=R(o[t],o[t+1]);return n}function Pe(o,n,t){let e=new et.Vector2(n[0]-o[0],n[1]-o[1]),r=new et.Vector2(n[0]-t[0],n[1]-t[1]),s=e.angleTo(r)*180/Math.PI,l=new et.Vector2(n[0]-o[0],n[1]-o[1]);return new et.Vector2(t[0]-o[0],t[1]-o[1]).cross(l)>0?s:-s}function ht(o,n){return new Proxy(o,{get:(t,e,r)=>Reflect.get(t,e,r),set:(t,e,r,i)=>{let s=Reflect.get(t,e,i),l=Reflect.set(t,e,r,i);return s!==r&&n.dispatchEvent({type:`change-${e}`,value:r}),l}})}function ot(o,n){return Promise.race([o,new Promise((t,e)=>{setTimeout(()=>e(new Error("Promise timeout")),n)})])}function Ct(o){return document.createElementNS("http://www.w3.org/2000/svg",o)}function Le(o,n){let t=Ct("svg");return t.setAttribute("width",o),t.setAttribute("height",n),t.style.cssText="position: absolute; left: 0; top: 0; pointer-events: none;",t}function xt(o="2",n){let t=Ct("circle");return t.setAttribute("r",o),t.setAttribute("fill",n),t}function Pt(o){let n=Ct("line");return n.setAttribute("stroke",o),n}function pt(o,n){let t=Ct("rect");return t.setAttribute("stroke",o),t.setAttribute("fill",n),t}function st(o,n,t){o.setAttribute("cx",`${n}`),o.setAttribute("cy",`${t}`)}function V(o,n,t){n&&(o.setAttribute("x1",`${n.x}`),o.setAttribute("y1",`${n.y}`)),t&&(o.setAttribute("x2",`${t.x}`),o.setAttribute("y2",`${t.y}`))}function H(o,n,t,e,r){o.setAttribute("x",`${n}`),o.setAttribute("y",`${t}`),o.setAttribute("width",`${e}`),o.setAttribute("height",`${r}`)}function Ae(){return Promise.resolve()}function br(){return new Promise(o=>{requestAnimationFrame(o)})}function Mr(o){return parseInt(o.replace("#","0x"),16)}function Sr(o,n){let t=parseInt(o.substring(1,3),16),e=parseInt(o.substring(3,5),16),r=parseInt(o.substring(5,7),16),i=Math.round(t*n),s=Math.round(e*n),l=Math.round(r*n);return`#${(1<<24|i<<16|s<<8|l).toString(16).slice(1)}`}function nt(o,n=.85){let t,e,r;if(o.startsWith("#"))t=parseInt(o.substring(1,3),16),e=parseInt(o.substring(3,5),16),r=parseInt(o.substring(5,7),16);else{let s=o.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 hn=require("three/examples/jsm/loaders/GLTFLoader");function wr(){return new hn.GLTFLoader}var Qt=null,te=new Map;function Lt(o){if(te.has(o)){let t=te.get(o).then(e=>(e.scene=e.scene.clone(),e))}Qt||(Qt=wr());let n=new Promise((t,e)=>{Qt.load(o,r=>{t(r)},void 0,e)});return te.set(o,n),n.then(t=>(t.scene=t.scene.clone(),t))}function Re(){Qt=null,te.clear()}var At=navigator.userAgent.toUpperCase().indexOf("MAC")>=0;function ee(o){return At?o==="Meta":o==="Control"}var Ie="__once__",Ne=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=`${Ie}${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(`${Ie}${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(`${Ie}${n}`);!e&&!r||(e?.forEach(i=>{typeof i=="function"&&i(...t)}),r?.forEach(i=>{typeof i=="function"&&i(...t)}),r?.clear())}};var Et=(t=>(t.SWITCH_FLOOR_BEFORE="switch_floor_before",t.SWITCH_FLOOR_AFTER="switch_floor_after",t))(Et||{});function W(o){return Object.keys(o).sort().map(n=>`${n}=${o[n]}`).join("&")}function Tr(o,n){return new Promise((t,e)=>{let r=new XMLHttpRequest;r.open("GET",o,!0),Object.keys(n.headers||{}).forEach(i=>{r.setRequestHeader(i,n.headers[i])}),n.responseType&&(r.responseType=n.responseType),r.onload=()=>{if(r.status>=200&&r.status<300)if(n.responseType==="arraybuffer")t(r.response);else try{let i=JSON.parse(r.responseText);t(i)}catch(i){e(i)}else e(r.statusText)},r.onerror=()=>{e(r.statusText)},r.send()})}var ft=class o{keySet=new Set;static createKey(){return Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)}genUniqueKey(){let n=o.createKey();for(;this.keySet.has(n);)n=o.createKey();return n}removeKey(n){this.keySet.delete(n)}dispose(){this.keySet.clear()}};var bt=require("three"),yn=ye(mn(),1);function Cr(o,n){let t=o.clone().normalize(),e=n.clone().normalize();return Math.acos(t.dot(e))}function Pr(o){let n=0;return o.reduce(([t,e],[r,i])=>(n+=Math.sqrt((r-t)**2+(i-e)**2),[r,i])),n/o.length}function De(o,n=.25){if(Pr(o)<n)return o;let t=(0,yn.default)(o);return De(t,n)}function Oe(o,n=!1,t=!0,e=5,r=150,i=3){let s=[],l=!n;if(s.push(o[0]),o.length<2)return s;for(let a=0;a<o.length-2;a+=1){let c=o[a],p=o[a+1],d=o[a+2],m=new bt.Vector2(c[0]-p[0],c[1]-p[1]),g=new bt.Vector2(d[0]-p[0],d[1]-p[1]),h=Cr(m,g)/Math.PI*180,f=m.length()+g.length();(!l||h<r&&f>.01||f>e)&&(s.push(o[a+1]),l=!0)}if(s.push(o[o.length-1]),!t)return s;let u=[];u.push(s[0]);for(let a=0;a<s.length-2;a+=1){let c=new bt.Vector2(s[a][0],s[a][1]),p=new bt.Vector2(s[a+1][0],s[a+1][1]),d=new bt.Vector2(s[a+2][0],s[a+2][1]),m=c.distanceTo(p)/2,g=d.distanceTo(p)/2,h=p.clone(),f=p.clone();h.add(c.clone().sub(p).normalize().multiplyScalar(m>i?i/2:m)),f.add(d.clone().sub(p).normalize().multiplyScalar(g>i?i/2:g));let v=[[h.x,h.y],[p.x,p.y],[f.x,f.y]];u.push(...De(v,i/25))}return u.push(s[s.length-1]),_n(u)}function _n(o){if(o.length<=1)return o;let n=[],t;return o.forEach(([e,r])=>{t?e===t[0]&&r===t[1]||(t=[e,r],n.push([e,r])):(t=[e,r],n.push([e,r]))}),n}function Fe(o,n,t){let e=Math.sqrt((t[0]-n[0])**2+(t[1]-n[1])**2);if(e===0)return{distance:Math.sqrt((o[0]-n[0])**2+(o[1]-n[1])**2),closestPoint:n.slice(0)};let r=Math.max(0,Math.min(1,((o[0]-n[0])*(t[0]-n[0])+(o[1]-n[1])*(t[1]-n[1]))/e**2)),i=[n[0]+r*(t[0]-n[0]),n[1]+r*(t[1]-n[1])];return{distance:Math.sqrt((o[0]-i[0])**2+(o[1]-i[1])**2),closestPoint:i}}function Ue(o,n,t){let[e,r]=o,[i,s]=n,l=Math.sqrt(Math.pow(i-e,2)+Math.pow(s-r,2)),u=t/l,a=e+(i-e)*u,c=r+(s-r)*u;return[a,c]}var vn=(a=>(a.START="start",a.END="end",a.FRONT="front",a.RIGHT="right",a.LEFT="left",a.RIGHT_FRONT="right_front",a.LEFT_FRONT="left_front",a.RIGHT_BACK="right_back",a.LEFT_BACK="left_back",a))(vn||{});function xn(o,n,t){let e=Pe(o,n,t);return 180-Math.abs(e)<15?"front":e>135?"right_front":e<-135?"left_front":e<=135&&e>=60?"right":e>=-135&&e<=-60?"left":e<60&&e>0?"right_back":e>-60&&e<0?"left_back":"front"}function Lr(o){let n=[{direction:"start",distance:R(o[0],o[1]),points:[o[0],o[1]]}];for(let t=2;t<o.length;t++){let e=xn(o[t-2],o[t-1],o[t]);if(e==="front"){let r=n[n.length-1],i=R(o[t-1],o[t]);r.distance+=i,t!==2&&r.points.push(o[t-1])}else n.push({direction:e,distance:R(o[t-1],o[t]),points:[o[t-1],o[t]]})}return n.push({direction:"end",distance:0,points:[o[o.length-1]]}),n}var J=ye(ke(),1);var X="___",ze=class{constructor(n=3){this.lift_priority=n}roadInfo=[];pointMap=new Map;nodeMap=new Map;facilityMap=new Map;straightLadderMap=new Map;escalatorMap=new Map;staircaseMap=new Map;lineMap=new Map;baseRoute=new J.default;escalatorRoute=new J.default;straightLadderRoute=new J.default;initRoute(n){this.clear(),this.roadInfo=n,n.length&&(n.forEach(t=>{t.points.forEach(e=>{let r=`${t.floor}${X}${e.id}`;if(this.pointMap.set(r,e),this.nodeMap.set(`${e.floor}${X}${e.nodeId}`,r),e.type==="straightLadder"){let i=this.straightLadderMap.get(e.name)||[];i.push({...e}),this.straightLadderMap.set(e.name,i)}if(e.type==="staircase"){let i=this.staircaseMap.get(e.name)||[];i.push({...e}),this.staircaseMap.set(e.name,i)}if(e.type==="escalator"){let i=this.escalatorMap.get(e.name)||{};e.escalatorDirection==="exit"?i.end={floor:e.floor,id:e.id}:i.start={floor:e.floor,id:e.id},this.escalatorMap.set(e.name,i)}if(e.type==="facility"){let i=this.facilityMap.get(e.targetId)||[];i.push({...e}),this.facilityMap.set(e.targetId,i)}}),t.lines.filter(e=>e.direction!=="no").forEach(e=>{let r=`${t.floor}${X}${e.from}`,i=`${t.floor}${X}${e.to}`,s=this.pointMap.get(r)?.cds,l=this.pointMap.get(i)?.cds;if(s?.length&&l?.length){let u=R(s,l);this.addLineItem(r,i,u),e.direction==="double"&&this.addLineItem(i,r,u)}})}),this.initBaseRoute(),this.initEscalatorRoute(),this.initStraightLadderRoute())}addLineItem(n,t,e,r=this.lineMap){let i=r.get(n)||new Map;i.set(t,e),r.set(n,i)}addFacilityToLineMap(n,t,e,r){[...this.straightLadderMap,...this.staircaseMap].forEach(([i,s])=>{if(!(s.length<2))for(let l=0;l<s.length;l++){let u=`${s[l].floor}${X}${s[l].id}`;for(let a=0;a<s.length;a++)if(l!==a){let c=`${s[a].floor}${X}${s[a].id}`,p=this.pointMap.get(u)?.cds,d=this.pointMap.get(c)?.cds;if(p?.length&&d?.length)if(s[l].type==="straightLadder"){let m=t;this.addLineItem(u,c,m,r)}else{let m=e;this.addLineItem(u,c,m,r)}}}}),this.escalatorMap.forEach((i,s)=>{if(i.start&&i.end){let l=`${i.start.floor}${X}${i.start.id}`,u=`${i.end.floor}${X}${i.end.id}`,a=this.pointMap.get(l)?.cds,c=this.pointMap.get(u)?.cds;if(a?.length&&c?.length){let p=n;this.addLineItem(l,u,p,r)}}})}initBaseRoute(){let n=new Map([...this.lineMap]);this.addFacilityToLineMap(1,this.lift_priority,3e4,n),this.baseRoute=new J.default(n)}initEscalatorRoute(){let n=new Map([...this.lineMap]),t=1e4;this.addFacilityToLineMap(1*t,this.lift_priority*t,3e4*t,n),this.escalatorRoute=new J.default(n)}initStraightLadderRoute(){let n=new Map([...this.lineMap]),t=1e4;this.addFacilityToLineMap(3*t,1*t,3e4*t,n),this.straightLadderRoute=new J.default(n)}checkStart(n){return!(!n.floor||!n.nodeId&&(!n.coord||n.coord.length<2))}checkEnd(n){return n.facility?!0:this.checkStart(n)}transformStart(n){if(n.nodeId){let t=this.nodeMap.get(`${n.floor}${X}${n.nodeId}`);if(t){let[e,r]=t.split(X);return{floor:e,id:r}}}if(n.coord?.length){let t=this.roadInfo.find(r=>r.floor===n.floor);if(!t)return null;let e=t.points.reduce((r,i)=>{let s=R(n.coord,i.cds);return s<r.min&&(r.min=s,r.point=i),r},{min:1/0,point:t.points[0]});return{floor:e.point.floor,id:e.point.id}}return null}transformEnd(n){if(n.floor){let t=this.transformStart(n);if(t)return t}return n.facility&&this.facilityMap.get(n.facility)?.length?{floor:n.floor,facility:n.facility}:null}getPath(n,t,e=""){if(!this.checkStart(n))return"start-error";if(!this.checkEnd(t))return"end-error";let r=this.transformStart(n);if(!r)return"no-start";let i=this.transformEnd(t);if(!i)return"no-end";let s=this.getBasePath.bind(this);switch(e){case"escalator":s=this.getEscalatorPath.bind(this);case"straightLadder":s=this.getStraightLadderPath.bind(this);default:s=this.getBasePath.bind(this)}if(console.log(r,i),i.id)return s(r,i);if(i.facility){let l=this.facilityMap.get(i.facility).filter(a=>i.floor?a.floor===i.floor:!0);if(!l.length)return null;let u=l.map(a=>s(r,{floor:a.floor,id:a.id})).filter(a=>!!a);return u.reduce((a,c)=>{let p=c.reduce((d,m)=>d+it(m.points),0);return p<a.distance&&(a.distance=p,a.path=c),a},{distance:1/0,path:u[0]}).path}}getRoutePath(n,t,e){let r=`${n.floor}${X}${n.id}`,i=`${t.floor}${X}${t.id}`,s=e.path(r,i);if(console.log(r,i,s),!s)return null;let l=[];return s.map(u=>{let a=this.pointMap.get(u);if(a){let{floor:c}=a;if(l[l.length-1]?.floor===c){let p=l[l.length-1];p.points.push(a.cds),p.endType=a.type,p.destId=a.nodeId}else l.push({floor:c,points:[a.cds],endType:a.type,destId:a.nodeId})}}),l}getBasePath(n,t){return this.getRoutePath(n,t,this.baseRoute)}getEscalatorPath(n,t){return this.getRoutePath(n,t,this.escalatorRoute)}getStraightLadderPath(n,t){return this.getRoutePath(n,t,this.straightLadderRoute)}clear(){this.roadInfo=[],this.pointMap.clear(),this.nodeMap.clear(),this.facilityMap.clear(),this.straightLadderMap.clear(),this.escalatorMap.clear(),this.staircaseMap.clear(),this.lineMap.clear(),this.baseRoute=new J.default,this.escalatorRoute=new J.default,this.straightLadderRoute=new J.default}};var q=ye(ke(),1);var F="___",Ve=class{constructor(n=3){this.lift_priority=n}roadInfo=[];pointMap=new Map;nodeMap=new Map;facilityMap=new Map;straightLadderMap=new Map;escalatorMap=new Map;staircaseMap=new Map;parkingMap=new Map;lineMap=new Map;baseRoute=new q.default;escalatorRoute=new q.default;straightLadderRoute=new q.default;forwardLineMap=new Map;forwardRoute=new q.default;initRoute(n){this.clear(),this.roadInfo=n,n.length&&(n.forEach(t=>{t.points.forEach(e=>{let r=`${t.floor}${F}${e.id}`;if(this.pointMap.set(r,e),this.nodeMap.set(`${e.floor}${F}${e.nodeId}`,r),e.type==="straightLadder"){let i=this.straightLadderMap.get(e.name)||[];i.push({...e}),this.straightLadderMap.set(e.name,i)}if(e.type==="staircase"){let i=this.staircaseMap.get(e.name)||[];i.push({...e}),this.staircaseMap.set(e.name,i)}if(e.type==="escalator"){let i=this.escalatorMap.get(e.name)||{};e.escalatorDirection==="exit"?i.end={floor:e.floor,id:e.id}:i.start={floor:e.floor,id:e.id},this.escalatorMap.set(e.name,i)}if(e.type==="facility"){let i=this.facilityMap.get(e.targetId)||[];i.push({...e}),this.facilityMap.set(e.targetId,i)}e.type==="parkingSpace"&&this.parkingMap.set(`${e.floor}${F}${e.name}`,e)}),t.lines.filter(e=>e.direction!=="no").forEach(e=>{let r=`${t.floor}${F}${e.from}`,i=`${t.floor}${F}${e.to}`,s=this.pointMap.get(r)?.cds,l=this.pointMap.get(i)?.cds;if(s?.length&&l?.length){let u=R(s,l);switch(this.addLineItem(r,i,u),this.addLineItem(i,r,u),e.direction){case"double":this.addLineItem(r,i,u,this.forwardLineMap),this.addLineItem(i,r,u,this.forwardLineMap);break;case"single":this.addLineItem(r,i,u,this.forwardLineMap);break;case"back":this.addLineItem(i,r,u,this.forwardLineMap);break}}})}),this.initBaseRoute(),this.initEscalatorRoute(),this.initStraightLadderRoute(),this.initForwardRoute())}addLineItem(n,t,e,r=this.lineMap){let i=r.get(n)||new Map;i.set(t,e),r.set(n,i)}addFacilityToLineMap(n,t,e,r){[...this.straightLadderMap,...this.staircaseMap].forEach(([i,s])=>{if(!(s.length<2))for(let l=0;l<s.length;l++){let u=`${s[l].floor}${F}${s[l].id}`;for(let a=0;a<s.length;a++)if(l!==a){let c=`${s[a].floor}${F}${s[a].id}`,p=this.pointMap.get(u)?.cds,d=this.pointMap.get(c)?.cds;if(p?.length&&d?.length)if(s[l].type==="straightLadder"){let m=t;this.addLineItem(u,c,m,r)}else{let m=e;this.addLineItem(u,c,m,r)}}}}),this.escalatorMap.forEach((i,s)=>{if(i.start&&i.end){let l=`${i.start.floor}${F}${i.start.id}`,u=`${i.end.floor}${F}${i.end.id}`,a=this.pointMap.get(l)?.cds,c=this.pointMap.get(u)?.cds;if(a?.length&&c?.length){let p=n;this.addLineItem(l,u,p,r)}}})}initBaseRoute(){let n=new Map([...this.lineMap]);this.addFacilityToLineMap(1,this.lift_priority,3e4,n),this.baseRoute=new q.default(n)}initEscalatorRoute(){let n=new Map([...this.lineMap]),t=1e4;this.addFacilityToLineMap(1*t,this.lift_priority*t,3e4*t,n),this.escalatorRoute=new q.default(n)}initStraightLadderRoute(){let n=new Map([...this.lineMap]),t=1e4;this.addFacilityToLineMap(3*t,1*t,3e4*t,n),this.straightLadderRoute=new q.default(n)}initForwardRoute(){this.forwardRoute=new q.default(this.forwardLineMap)}checkStart(n){return!(!n.floor||!n.nodeId&&(!n.coord||n.coord.length<2))}checkEnd(n){return n.facility||n.parkingSpace&&n.floor?!0:this.checkStart(n)}transformStart(n){if(n.nodeId){let t=this.nodeMap.get(`${n.floor}${F}${n.nodeId}`);if(t){let[e,r]=t.split(F);return{floor:e,id:r}}}if(n.coord?.length){let t=this.roadInfo.find(r=>r.floor===n.floor);if(!t)return null;let e=t.points.reduce((r,i)=>{let s=R(n.coord,i.cds);return s<r.min&&(r.min=s,r.point=i),r},{min:1/0,point:t.points[0]});return{floor:e.point.floor,id:e.point.id}}return null}transformEnd(n){if(n.floor){if(n.parkingSpace){let e=this.parkingMap.get(`${n.floor}${F}${n.parkingSpace}`);if(e)return{floor:e.floor,id:e.id}}let t=this.transformStart(n);if(t)return t}return n.facility&&this.facilityMap.get(n.facility)?.length?{floor:n.floor,facility:n.facility}:null}getPath(n,t,e=""){if(!this.checkStart(n))return"start-error";if(!this.checkEnd(t))return"end-error";let r=this.transformStart(n);if(!r)return"no-start";let i=this.transformEnd(t);if(!i)return"no-end";let s=this.getBasePath.bind(this);switch(e){case"escalator":s=this.getEscalatorPath.bind(this);case"straightLadder":s=this.getStraightLadderPath.bind(this);case"forward":s=this.getForwardPath.bind(this);default:s=this.getBasePath.bind(this)}if(i.id)return s(r,i);if(i.facility){let l=this.facilityMap.get(i.facility).filter(a=>i.floor?a.floor===i.floor:!0);if(!l.length)return null;let u=l.map(a=>s(r,{floor:a.floor,id:a.id})).filter(a=>!!a);return u.reduce((a,c)=>{let p=c.reduce((d,m)=>d+it(m.points),0);return p<a.distance&&(a.distance=p,a.path=c),a},{distance:1/0,path:u[0]}).path}}getRoutePath(n,t,e){let r=`${n.floor}${F}${n.id}`,i=`${t.floor}${F}${t.id}`,s=e.path(r,i);if(!s)return null;let l=[];return s.map(u=>{let a=this.pointMap.get(u);if(a){let{floor:c}=a;if(l[l.length-1]?.floor===c){let p=l[l.length-1];p.points.push(a.cds),p.endType=a.type,p.destId=a.nodeId,p.distance=it(p.points)}else l.push({floor:c,points:[a.cds],endType:a.type,destId:a.nodeId,distance:0})}}),l}getBasePath(n,t){return this.getRoutePath(n,t,this.baseRoute)}getEscalatorPath(n,t){return this.getRoutePath(n,t,this.escalatorRoute)}getStraightLadderPath(n,t){return this.getRoutePath(n,t,this.straightLadderRoute)}getForwardPath(n,t){return this.getRoutePath(n,t,this.forwardRoute)}clear(){this.roadInfo=[],this.pointMap.clear(),this.nodeMap.clear(),this.facilityMap.clear(),this.straightLadderMap.clear(),this.escalatorMap.clear(),this.staircaseMap.clear(),this.lineMap.clear(),this.baseRoute=new q.default,this.escalatorRoute=new q.default,this.straightLadderRoute=new q.default}};function He(o){return o.replace(/[A-Z]/g,n=>"_"+n.toLowerCase()).replace(/^_/,"")}var On=new ft;function dt(o,n,t){return new Promise((e,r)=>{let i=On.genUniqueKey(),s=({data:l})=>{l.type===`${n}_result`&&l.key===i&&(On.removeKey(i),self.removeEventListener("message",s),l.error?r(l.error):e(l.data))};o.addEventListener("message",s),o.postMessage({type:n,key:i,data:t})})}function Nr(o){let n={};for(let e in o)e.startsWith("on")&&(n[He(e.slice(2))]=o[e]);let t=async({data:e})=>{if(n[e.type])try{let r=await n[e.type](e.data);self.postMessage({type:`${e.type}_result`,key:e.key,data:r})}catch(r){self.postMessage({type:`${e.type}_result`,key:e.key,error:r})}else self.postMessage({type:`${e.type}_result`,key:e.key,error:"no_event"})};return self.addEventListener("message",t),()=>{self.removeEventListener("message",t)}}var E=require("three"),_t=require("@tweenjs/tween.js");var qn=require("three");var x=require("three");var ne={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},D=class extends x.Object3D{constructor(t,e){super();this.context=t;if(this.options=ht({...ne,...e},this),this.options.geometry.type==="point"){let[r,i]=this.options.geometry.coords;return this.position.set(r,i,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 x.Vector3,e=new x.Box3;return e.setFromObject(this),e.getCenter(t),t}getSize(){if(this.options.geometry.type==="point")return new x.Vector3(0,0,0);let t=new x.Box3,e=new x.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=$(this.options.geometry.coords[0],this.options.geometry.coords.slice(1));return new x.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:nt(this.options.fillColor),opacity:this.options.fillOpacity});return this.material=[t,e],[t,e]}getMaxAndMin(t,e){let r=new x.Box3().setFromObject(this),i=t.clone().add(e.clone().multiplyScalar(1e3)),s=new x.Ray(i,e.clone().multiplyScalar(-1)),l=new x.Vector3;s.intersectBox(r,l);let u=t.clone().add(e.clone().multiplyScalar(-1e3)),a=new x.Ray(u,e.clone()),c=new x.Vector3;return a.intersectBox(r,c),{max:c,min:l}}initGradualMaterial(){let{max:t,min:e}=new x.Box3().setFromObject(this),r=t.clone().sub(e),i=Math.max(r.x,r.y,r.z)/2,s=this.getPosition(),l=new x.Vector3(-1,.2,0).normalize(),{max:u,min:a}=this.getMaxAndMin(s,l),c=this.context.materialFactory.createShaderMaterial({gradualColor:this.options.gradualColor,center:this.getPosition(),maxValue:i,opacity:this.options.fillOpacity,direction:new x.Vector3(-1,.2,0),max:u,min:a});if(this.options.height<=.1)return this.material=c,c;let p=this.getCenter(),d=new x.Vector3(-1,.2,1).normalize(),{max:m,min:g}=this.getMaxAndMin(p,d),h=this.context.materialFactory.createShaderMaterial({gradualColor:[nt(this.options.gradualColor[0],this.options.colorFactor),nt(this.options.gradualColor[1],this.options.colorFactor)],center:this.getCenter(),maxValue:i,opacity:this.options.fillOpacity,direction:new x.Vector3(-1,.2,1),max:m,min:g});return this.material=[c,h],[c,h]}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 x.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 i=0;i<r.length;i++){let s=r[i];for(let l=0;l<s.length;l++){let u=s[l],a=l+1===s.length?s[0]:s[l+1];t.push(new x.Vector3(u[0],u[1],e)),t.push(new x.Vector3(a[0],a[1],e))}}return t}initLineGeometry(){this.lineGeometry&&this.lineGeometry.dispose();let t=this.getBorderPoints(),e=new x.BufferGeometry().setFromPoints(t);this.lineGeometry=e}createBorder(){this.line&&this.remove(this.line);let t=new x.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:i}=e[0];return{position:r,distance:i}}return!1}dispose(){this.geometry?.dispose(),this.line?.geometry.dispose(),this.clear()}};var j=require("three");var Rt=class extends j.Object3D{directionalLight;plane;basicOpacity=.07;constructor(){super(),this.directionalLight=this.initLight(),this.initPlane()}initLight(){let n=Me(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 j.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 j.PlaneGeometry(n,t),r=new j.ShadowMaterial({transparent:!0,opacity:0,side:j.DoubleSide}),i=new j.Mesh(e,r);return i.receiveShadow=!0,i.position.z=-10,this.add(i),this.plane=i,i}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 re=require("three");var b=require("three");var Fn=require("lodash");var Dr={autoUpdate:!0,appendToBody:!1,autoChangePlacement:!1},It=class extends b.EventDispatcher{constructor(t,e={}){super();this.context=t;this.options={...Dr,...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,Fn.debounce)(()=>{this.div&&this.usePlacement()},100));t.observe(this.div,{childList:!0,subtree:!0,attributes:!0}),this.observer=t}getPlacementPosition(){if(this.element instanceof D&&this.element.options.geometry.type==="polygon"){let{max:i,min:s}=new b.Box3().setFromObject(this.element),l=(i.x+s.x)/2,u=(i.y+s.y)/2;return{left:new b.Vector3(s.x,u,i.z),leftTop:new b.Vector3(s.x,i.y,i.z),top:new b.Vector3(l,i.y,i.z),rightTop:new b.Vector3(i.x,i.y,i.z),right:new b.Vector3(i.x,u,i.z),rightBottom:new b.Vector3(i.x,s.y,i.z),bottom:new b.Vector3(l,s.y,i.z),leftBottom:new b.Vector3(s.x,s.y,i.z),center:new b.Vector3(l,u,i.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((i,s)=>{let{x:l,y:u}=_(r[s],this.context.camera,t,e);return i[s]={x:l,y:u},i},{})}checkOverflow(t,e){let{width:r,height:i}=this.context.clientSize;return e.x>0&&t.x<r&&e.y<i&&t.y>0}getPlacement(){let{clientWidth:t,clientHeight:e}=this.div,r=this.getPlacementScreenPosition(),i=t/2,s=e/2,l=[{type:"center",getBox(u,a){return{max:{x:i+u,y:a-e},min:{x:u-i,y:a}}}},{type:"left",getBox(u,a){return{max:{x:u,y:a-s},min:{x:u-t,y:a+s}}}},{type:"leftTop",getBox(u,a){return{max:{x:u,y:a-e},min:{x:u-t,y:a}}}},{type:"top",getBox(u,a){return{max:{x:u+i,y:a-e},min:{x:u-i,y:a}}}},{type:"rightTop",getBox(u,a){return{max:{x:u+t,y:a-e},min:{x:u,y:a}}}},{type:"right",getBox(u,a){return{max:{x:u+t,y:a-s},min:{x:u,y:a+s}}}},{type:"rightBottom",getBox(u,a){return{max:{x:u+t,y:a},min:{x:u,y:a+e}}}},{type:"bottom",getBox(u,a){return{max:{x:u+i,y:a},min:{x:u-i,y:a+e}}}},{type:"leftBottom",getBox(u,a){return{max:{x:u,y:a},min:{x:u-t,y:a+s}}}}];for(let u=0;u<l.length;u++){let a=l[u],c=r[a.type],{max:p,min:d}=a.getBox(c.x,c.y);if(this.checkOverflow(p,d))return{type:a.type,position:c}}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:i}=this.context.clientSize;return t>=0&&t<=r&&e>=0&&e<=i}_updatePosition(t,e){this.clientPos={x:t,y:e};let{width:r,height:i,x:s,y:l}=this.context.clientSize;this.options.appendToBody&&(this.div.style.left=`${s}px`,this.div.style.top=`${l+i}px`),this.options.autoUpdate?this.div.style.transform=`translate3d(${t}px, ${-i+e}px, 0)`:this.dispatchEvent({type:"update-position",x:t,y:e,width:r,height:i})}updatePosition(t=!1){let e=this.getPosition(),{width:r,height:i}=this.context.clientSize,{x:s,y:l}=_(e,this.context.camera,r,i);this.clientPos.x===s&&this.clientPos.y===l&&!t||this._updatePosition(s,l)}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 Or={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},Mt=class extends re.EventDispatcher{constructor(t,e){super();this.context=t;this.options=ht({...Or,...e},this),this.position.set(e.position?.x||0,e.position?.y||0,e.position?.z||0),this.overlay=new It(this.context,{autoUpdate:!1}),this.overlay.addEventListener("update-position",({x:r,y:i,height:s})=>{this.overlay.div.style.transform=`translate3d(calc(${r}px - 50%), calc(${-s+i}px - ${this.options.icon&&this.options.icon_position!=="center"?"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})=>{let i=this.textDiv;if(i){let s=this.initText();this.div.replaceChild(s,i)}else 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 re.Vector3;userData={};showTextStatus=!0;disposed=!1;get withinDisplayRange(){return this.overlay.withinDisplayRange}async resetSize(){if(await Ae(),!this.disposed)if(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[i,s]of Object.entries(e.styles))r.style[i]=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,i=e*t,s=r*t,{x:l,y:u}=this.overlay.clientPos;return{left:l-i/2,right:l+i/2,top:this.options.icon?u-s:u-s/2,bottom:this.options.icon?u:u+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 G=require("three");var I=require("three"),Un=require("@mars3d/heatmap.js"),at=require("@turf/turf"),Nt=class extends I.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:i,center:s}=this.getBox(t);this.heatmap=(0,Un.create)({width:e,height:r,container:this.div,...this.context.config.heatMap}),this.heatmap.setData(this.transformData(t,i)),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 I.PlaneGeometry(t,e),i=new I.Texture(this.div.firstChild);i.needsUpdate=!0;let s=new I.MeshBasicMaterial({transparent:!0,side:I.DoubleSide,map:i});s.needsUpdate=!0,this.plane=new I.Mesh(r,s),this.add(this.plane)}getTransMatrix({x:t,y:e}){return new I.Matrix3().makeScale(1,-1).multiply(new I.Matrix3().makeTranslation(0-t,0-e))}transformData(t,e){let r=this.getTransMatrix(e);return{data:t.data.map(s=>{let l=new I.Vector2(s.x,s.y).applyMatrix3(r);return{x:l.x,y:l.y,value:s.value}}),max:t.max,min:t.min}}getBox(t){let e=(0,at.featureCollection)(t.data.map(a=>(0,at.point)([a.x,a.y]))),r=(0,at.bbox)(e),i=r[2]-r[0],s=r[3]-r[1],l={x:r[0],y:r[3]},u=(0,at.center)(e);return{width:i,height:s,leftTop:l,center:u.geometry.coordinates}}dispose(){this.div=null,this.heatmap=void 0}};var ie=require("three");var Dt=class extends ie.Object3D{constructor(t,e){super();this.context=t;this.options=e;this.position.copy(e.position||new ie.Vector3(0,0,0)),this.loadModel()}model=null;async loadModel(){let t=await Lt(this.options.modelUrl);t.scene.rotation.set(Math.PI/2,Math.PI/2,0),this.add(t.scene),this.model=t}dispose(){z(this),this.model=null}};var oe=require("three");var Gn=require("three");var U=class extends Gn.Object3D{constructor(t){super();this.context=t}dispose(){z(this),this.children.forEach(t=>t.dispose?.()),this.clear()}};var Ot=class extends U{graphicMap=new Map;constructor(n){super(n)}getCenter(){return new oe.Box3().setFromObject(this).getCenter(new oe.Vector3)}createGraphic(n){let t=new D(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,i)=>{if(i instanceof D){let s=i.raycast(n);if(s){let{distance:l}=s;if(l<r.distance)return{distance:s.distance,position:s.position,graphic:i}}return r}else return r},t);return e===t?{graphics:[],position:null}:{graphics:[e.graphic],position:e.position}}};var Bn=require("lodash");var gt=class extends U{pois=[];debounceCollisionDetection;timer=new Y;constructor(n){super(n),this.registryEvent(),this.debounceCollisionDetection=(0,Bn.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 Mt(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 Mt&&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:i,right:s,top:l,bottom:u}=e.getBox();if(r===0||!e.options.collision_enable){n.push({left:i,right:s,top:l,bottom:u}),e.parentSetVisible(!0);return}let a=n.some(c=>c.left<s&&c.right>i&&c.top<u&&c.bottom>l);e.parentSetVisible(!a),a||n.push({left:i,right:s,top:l,bottom:u})})}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 rt=class extends G.Object3D{constructor(t){super();this.context=t;this.groundLayer=new U(this.context),this.graphicLayer=new Ot(this.context),this.poiLayer=new gt(this.context),this.wallLayer=new U(this.context),this.textureLayer=new U(this.context),this.glbModelLayer=new U(this.context),this.laneLayer=new U(this.context),this.mergeGraphicLayer=new U(this.context),this.groundUpper.add(this.graphicLayer),this.groundUpper.add(this.poiLayer),this.groundUpper.add(this.wallLayer),this.groundUpper.add(this.textureLayer),this.groundUpper.add(this.glbModelLayer),this.groundUpper.add(this.laneLayer),this.groundUpper.add(this.mergeGraphicLayer),this.add(this.groundUpper),this.add(this.groundLayer),this.add(this.models)}graphicLayer;poiLayer;wallLayer;textureLayer;glbModelLayer;laneLayer;mergeGraphicLayer;grounds=new Set;groundLayer;shadow=new Rt;heatmap;groundUpper=new G.Object3D;models=new G.Object3D;modelMap=new Map;groundMaxHeight=0;name="";key="";getPosition(){return new G.Box3().setFromObject(this).getCenter(new G.Vector3)}createGround(t){let e=new D(this.context,t);this.addGrounds([e])}addGrounds(t){t.forEach(e=>{this.grounds.has(e)||(e.mesh.castShadow=!0,this.grounds.add(e),this.groundLayer.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.groundUpper.position.z=this.groundMaxHeight}get hasElement(){return!!(this.grounds.size||this.graphicLayer.children.length)}getCenter(){return new G.Box3().setFromObject(this).getCenter(new G.Vector3)}addModel(t){let e=new Dt(this.context,t);return this.models.add(e),this.modelMap.set(t.id,e),e}addShadow(){let t=new G.Box3().setFromObject(this.groundUpper),e=t.getCenter(new G.Vector3),r=t.getSize(new G.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 Nt(this.context),this.add(this.heatmap)),this.heatmap.loadData(t);let e=new G.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.groundLayer.dispose(),this.graphicLayer.dispose(),this.poiLayer.dispose(),this.wallLayer.dispose(),this.textureLayer.dispose(),this.glbModelLayer.dispose(),this.laneLayer.dispose(),this.mergeGraphicLayer.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 se=require("three");var K=class extends se.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:i,offsetY:s}=t,{clientWidth:l,clientHeight:u}=r.domElement,a=i/l*2-1,c=1-s/u*2;return new se.Vector3(a,c,0).unproject(e)}getSvgCoordinate(t){let{camera:e,container:r}=this.context;return _(t,e,r.clientWidth,r.clientHeight)}dispose(){this._unRegistryEvent(),this.context.container.removeChild(this.svg),this.svg=null}};var Ft=class extends K{constructor(t){super(t);this.context=t;let{config:{svg:{circle:e,line:r}}}=t;this.circles=[xt(e.radius,e.fill),xt(e.radius,e.fill)],this.line=Pt(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]);st(this.circles[0],t.x,t.y),V(this.line,t)}if(this.points[1]){let t=this.getSvgCoordinate(this.points[1]);st(this.circles[1],t.x,t.y),V(this.line,void 0,t)}};onPointermove=t=>{this.points.length===1&&(this.line.style.display="block",V(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:i}=t,s=this.circles[this.points.length];st(s,r,i),this.points.length||V(this.line,{x:r,y:i},{x:r,y:i}),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:i}]=this.points;return Math.sqrt((r-t)**2+(i-e)**2)}dispose(){super.dispose(),this.unRegistryEvent(),this.line=null,this.circles=[]}};var Ut=class extends K{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]&&st(this.circles[t],e.x,e.y),t!==0&&V(this.lines[t-1],void 0,e),this.lines[t]&&V(this.lines[t],e)})};onPointermove=n=>{!this.lastLine||this.isClose||(this.lastLine.style.display="block",V(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:i,radius:s},line:{stroke:l}}=this.context.config.svg;if(!this.isClose){let u=xt(s,i);st(u,e,r),this.addCircle(u)}if(this.lines.length&&V(this.lastLine,void 0,{x:e,y:r}),!this.isClose){let u=Pt(l);V(u,{x:e,y:r},{x:e,y:r}),this.addLine(u)}}};checkAdsorb(n,t){if(this.points.length<3)return!1;let e=this.circles[0],r=+e.getAttribute("cx"),i=+e.getAttribute("cy");return Math.sqrt((n-r)**2+(t-i)**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 i=(r+1)%e;t+=n[r][0]*n[i][1]-n[i][0]*n[r][1]}return Math.abs(t/2)}dispose(){super.dispose(),this.unRegistryEvent(),this.lines=[],this.circles=[]}};var kn=require("three");var We=class extends K{constructor(t){super(t);this.context=t;let{config:{svg:{line:e}}}=t;this.rect=pt(e.stroke,"transparent"),this.svg.appendChild(this.rect);for(let r=0;r<4;r++)this.cornerRect[r]=pt(e.stroke,"#ffffff"),this.centerRect[r]=pt(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 kn.Box3().setFromObject(this.graphic),{camera:e,container:{clientWidth:r,clientHeight:i}}=this.context,{min:s,max:l}=t,u=_(s,e,r,i),a=_(l,e,r,i);H(this.rect,u.x,a.y,Math.abs(a.x-u.x),Math.abs(a.y-u.y));let{x:c,y:p}=u,{x:d,y:m}=a,g=5,h=[{x:c-g,y:m-g},{x:d-g,y:m-g},{x:c-g,y:p-g},{x:d-g,y:p-g}];for(let M=0;M<h.length;M++)H(this.cornerRect[M],h[M].x,h[M].y,g*2,g*2);let f=4,v=(c+d)/2,w=(p+m)/2,T=[{x:v-f,y:m-f},{x:c-f,y:w-f},{x:d-f,y:w-f},{x:v-f,y:p-f}];for(let M=0;M<T.length;M++)H(this.centerRect[M],T[M].x,T[M].y,f*2,f*2)}else{H(this.rect,0,0,0,0);for(let t=0;t<this.cornerRect.length;t++)H(this.cornerRect[t],0,0,0,0),H(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 C=require("three");var Xe=require("three/examples/jsm/utils/BufferGeometryUtils"),Gt=class extends C.Object3D{constructor(t,e){super();this.context=t;this.options=e;e.length&&this.init()}geometry;material;lineMaterial;lineGeometry;Mesh;LineMesh;initGeometry(){let t=this.options.map(e=>{let r=$(e.geometry.coords[0],e.geometry.coords.slice(1));return new C.ExtrudeGeometry(r,{steps:1,bevelEnabled:!1,depth:e.height,curveSegments:4})});this.geometry=(0,Xe.mergeGeometries)(t),t.forEach(e=>e.dispose())}initMaterial(){let t=`
1
+ "use strict";var fr=Object.create;var Kt=Object.defineProperty;var dr=Object.getOwnPropertyDescriptor;var gr=Object.getOwnPropertyNames;var mr=Object.getPrototypeOf,yr=Object.prototype.hasOwnProperty;var lt=(o,n)=>()=>(n||o((n={exports:{}}).exports,n),n.exports),_r=(o,n)=>{for(var t in n)Kt(o,t,{get:n[t],enumerable:!0})},an=(o,n,t,e)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of gr(n))!yr.call(o,r)&&r!==t&&Kt(o,r,{get:()=>n[r],enumerable:!(e=dr(n,r))||e.enumerable});return o};var ye=(o,n,t)=>(t=o!=null?fr(mr(o)):{},an(n||!o||!o.__esModule?Kt(t,"default",{value:o,enumerable:!0}):t,o)),vr=o=>an(Kt({},"__esModule",{value:!0}),o);var fn=lt((pi,pn)=>{pn.exports=function(n,t){return n[0]=t[0],n[1]=t[1],n}});var mn=lt((fi,gn)=>{var dn=fn();gn.exports=function(o,n){Array.isArray(n)||(n=[]),o.length>0&&n.push(dn([0,0],o[0]));for(var t=0;t<o.length-1;t++){var e=o[t],r=o[t+1],i=e[0],s=e[1],l=r[0],u=r[1],a=[.75*i+.25*l,.75*s+.25*u],c=[.25*i+.75*l,.25*s+.75*u];n.push(a),n.push(c)}return o.length>1&&n.push(dn([0,0],o[o.length-1])),n}});var bn=lt((mi,En)=>{var Ge=class{constructor(){this.keys=new Set,this.queue=[]}sort(){this.queue.sort((n,t)=>n.priority-t.priority)}set(n,t){let e=Number(t);if(isNaN(e))throw new TypeError('"priority" must be a number');return this.keys.has(n)?this.queue.map(r=>(r.key===n&&Object.assign(r,{priority:e}),r)):(this.keys.add(n),this.queue.push({key:n,priority:e})),this.sort(),this.queue.length}next(){let n=this.queue.shift();return this.keys.delete(n.key),n}isEmpty(){return this.queue.length===0}has(n){return this.keys.has(n)}get(n){return this.queue.find(t=>t.key===n)}};En.exports=Ge});var wn=lt((yi,Sn)=>{function Mn(o,n){let t=new Map;for(let[e,r]of o)e!==n&&r instanceof Map?t.set(e,Mn(r,n)):e!==n&&t.set(e,r);return t}Sn.exports=Mn});var Pn=lt((_i,Cn)=>{function Ar(o){let n=Number(o);return!(isNaN(n)||n<=0)}function Tn(o){let n=new Map;return Object.keys(o).forEach(e=>{let r=o[e];if(r!==null&&typeof r=="object"&&!Array.isArray(r))return n.set(e,Tn(r));if(!Ar(r))throw new Error(`Could not add node at key "${e}", make sure it's a valid node`,r);return n.set(e,Number(r))}),n}Cn.exports=Tn});var Rn=lt((vi,An)=>{function Ln(o){if(!(o instanceof Map))throw new Error(`Invalid graph: Expected Map instead found ${typeof o}`);o.forEach((n,t)=>{if(typeof n=="object"&&n instanceof Map){Ln(n);return}if(typeof n!="number"||n<=0)throw new Error(`Values must be numbers greater than 0. Found value ${n} at ${t}`)})}An.exports=Ln});var ke=lt((xi,Dn)=>{var Rr=bn(),Ir=wn(),In=Pn(),Nn=Rn(),Be=class{constructor(n){n instanceof Map?(Nn(n),this.graph=n):n?this.graph=In(n):this.graph=new Map}addNode(n,t){let e;return t instanceof Map?(Nn(t),e=t):e=In(t),this.graph.set(n,e),this}addVertex(n,t){return this.addNode(n,t)}removeNode(n){return this.graph=Ir(this.graph,n),this}path(n,t,e={}){if(!this.graph.size)return e.cost?{path:null,cost:0}:null;let r=new Set,i=new Rr,s=new Map,l=[],u=0,a=[];if(e.avoid&&(a=[].concat(e.avoid)),a.includes(n))throw new Error(`Starting node (${n}) cannot be avoided`);if(a.includes(t))throw new Error(`Ending node (${t}) cannot be avoided`);for(i.set(n,0);!i.isEmpty();){let c=i.next();if(c.key===t){u=c.priority;let d=c.key;for(;s.has(d);)l.push(d),d=s.get(d);break}r.add(c.key),(this.graph.get(c.key)||new Map).forEach((d,m)=>{if(r.has(m)||a.includes(m))return null;if(!i.has(m))return s.set(m,c.key),i.set(m,c.priority+d);let g=i.get(m).priority,h=c.priority+d;return h<g?(s.set(m,c.key),i.set(m,h)):null})}return l.length?(e.trim?l.shift():l=l.concat([n]),e.reverse||(l=l.reverse()),e.cost?{path:l,cost:u}:l):e.cost?{path:null,cost:0}:null}shortestPath(...n){return this.path(...n)}};Dn.exports=Be});var zr={};_r(zr,{AibeeLoader:()=>on,BMap:()=>$e,BaseSvg:()=>K,Context:()=>Xt,Equipment:()=>Ke,Events:()=>Ne,Floor:()=>rt,GlbModel:()=>kt,Graphic:()=>D,GraphicLayer:()=>Ot,GroundTexture:()=>Bt,HeatmapElement:()=>Nt,HooksName:()=>Et,HoverHelper:()=>Wt,Lane:()=>zt,Layer:()=>U,MapTypePolar:()=>tr,MergeGraphic:()=>Vt,Model:()=>Dt,MulFloors:()=>nn,Navigation:()=>tn,Overlay:()=>It,PathDirection:()=>vn,Poi:()=>Mt,PoiLayer:()=>gt,RoadNetwork:()=>ze,RoadNetwork2:()=>Ve,SelectBox:()=>We,Selection:()=>Ht,Shadow:()=>Rt,SplitLoad:()=>en,SvgLine:()=>Ft,SvgPolygon:()=>Ut,Timer:()=>Y,UniqueKey:()=>ft,Wall:()=>Gt,addAlphaToHexColor:()=>Sr,calc_angle:()=>Pe,calc_direction:()=>xn,clearCanvas:()=>Ce,clearTextTexture:()=>Te,convertToSnakeCase:()=>He,createCanvas:()=>cn,createCircle:()=>xt,createLine:()=>Pt,createRect:()=>pt,createSvg:()=>Le,createSvgElement:()=>Ct,darkenColor:()=>nt,defaultAibeeLoaderOption:()=>kr,defaultConfig:()=>Jn,defaultGraphicOptions:()=>ne,defaultOptions:()=>zn,dispose:()=>z,disposeLoader:()=>Re,distancePointToSegment:()=>Fe,generatorKeyByObj:()=>W,getCenter:()=>Jt,getConfig:()=>je,getDirectPath:()=>Lr,getLength:()=>R,getLongestSideDir:()=>Er,getPathLength:()=>it,getTextureByText:()=>xr,hasChinese:()=>Se,initCamera:()=>xe,initCanvas:()=>un,initControl:()=>be,initDirectionalLight:()=>Me,initLight:()=>Ee,initRenderer:()=>ve,initScene:()=>_e,initShape:()=>$,isContain:()=>Tt,isControl:()=>ee,isMac:()=>At,loadBuildingGround:()=>Ye,loadGraphics:()=>qt,loadModel:()=>Lt,moveOnRoute:()=>Ue,proxyOptions:()=>ht,removeWeightPath:()=>_n,setCirclePosition:()=>st,setLineStartEnd:()=>V,setRectPosition:()=>H,simplifyPath:()=>Oe,sleepOnePromise:()=>Ae,sleepOneRf:()=>br,smoothPath:()=>De,strToNumber:()=>Mr,timeoutPromise:()=>ot,toWebWorker:()=>Nr,triggerWorker:()=>dt,vector3ToDevice:()=>_,xhrGet:()=>Tr});module.exports=vr(zr);var he=require("three");var Y=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 w=require("three"),ln=require("three/examples/jsm/controls/MapControls");function _e(){let o=new w.Scene;return o.background=new w.Color(16777215),o}function ve(){let o=new w.WebGLRenderer({antialias:!0});return o.autoClear=!0,o.setClearAlpha(1),o.setClearColor(16777215),o.setPixelRatio(window.devicePixelRatio),o.shadowMap.enabled=!0,o.shadowMap.autoUpdate=!0,o.shadowMap.type=w.PCFSoftShadowMap,o}function xe(o,n){let t=new w.OrthographicCamera(-o/2,o/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 Ee(){let o=new w.Group,n=new w.AmbientLight(16777215,2.6);return o.add(n),o}function be(o,n){let t=new ln.MapControls(o,n);return t.enableDamping=!1,t.zoomSpeed=2,t}function $(o,n=[]){let t=new w.Shape(o.map(e=>new w.Vector2(...e)));return n.length&&n.forEach(e=>{var r=new w.Path(e.map(i=>new w.Vector2(...i)));t.holes.push(r)}),t}function Me(o=16777215,n=1){let t=new w.DirectionalLight(o,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(o,n){if(n&&o.children&&o.children.length&&o.children.forEach(t=>{z(t,n)}),o.isMesh){let t=o;t.geometry&&t.geometry.dispose(),t.material&&(Array.isArray(t.material)?t.material.forEach(e=>{e.dispose()}):t.material.dispose())}o.isLight&&o.dispose?.()}function Se(o){return/[\u4E00-\u9FA5]+/g.test(o)}var ct=require("three");var Zt=new Map;function un(){let o=document.createElement("canvas");o.width=1024,o.height=64;let n=o.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:o,ctx:n}}var we,ut;function cn(){if(!we){let{canvas:o,ctx:n}=un();we=o,ut=n}}function xr(o){if(Zt.has(o))return Zt.get(o);cn(),ut.clearRect(0,0,1024,64);let n=Se(o)?4:8;ut.strokeText(o,2,n),ut.fillText(o,2,n);let t=Math.ceil(ut.measureText(o).width);t=t%2===0?t:t+1,t+=2;let e=ut.getImageData(0,0,t,64),r=new ct.DataTexture(Uint8Array.from(e.data),t,64,ct.RGBAFormat);return r.flipY=!0,r.minFilter=ct.LinearFilter,r.magFilter=ct.LinearFilter,Zt.set(o,r),r}function Te(){Zt.clear()}function Ce(){ut=null,we=null}var et=require("three"),vt=require("@turf/turf");function _(o,n,t,e){let r=o.clone().project(n),i=t/2,s=e/2,l=Math.round(r.x*i+i),u=Math.round(-r.y*s+s);return{x:l,y:u}}function Jt(o){let n=(0,vt.featureCollection)(o.map(e=>(0,vt.point)(e)));return(0,vt.center)(n).geometry.coordinates}function Tt(o,n,t){return o.x>=n.x&&o.x<=t.x&&o.y>=n.y&&o.y<=t.y}function Er(o){let n=0,t=new et.Vector3;for(let e=1;e<o.length;e++){let r=new et.Vector3(o[e-1][0],o[e-1][1],0),i=new et.Vector3(o[e][0],o[e][1],0),s=i.distanceTo(r);s>n&&(n=s,t=i.clone().sub(r).normalize())}return t}function R(o,n){return Math.sqrt((n[0]-o[0])**2+(n[1]-o[1])**2)}function it(o){let n=0;for(let t=0;t<o.length-1;t++)n+=R(o[t],o[t+1]);return n}function Pe(o,n,t){let e=new et.Vector2(n[0]-o[0],n[1]-o[1]),r=new et.Vector2(n[0]-t[0],n[1]-t[1]),s=e.angleTo(r)*180/Math.PI,l=new et.Vector2(n[0]-o[0],n[1]-o[1]);return new et.Vector2(t[0]-o[0],t[1]-o[1]).cross(l)>0?s:-s}function ht(o,n){return new Proxy(o,{get:(t,e,r)=>Reflect.get(t,e,r),set:(t,e,r,i)=>{let s=Reflect.get(t,e,i),l=Reflect.set(t,e,r,i);return s!==r&&n.dispatchEvent({type:`change-${e}`,value:r}),l}})}function ot(o,n){return Promise.race([o,new Promise((t,e)=>{setTimeout(()=>e(new Error("Promise timeout")),n)})])}function Ct(o){return document.createElementNS("http://www.w3.org/2000/svg",o)}function Le(o,n){let t=Ct("svg");return t.setAttribute("width",o),t.setAttribute("height",n),t.style.cssText="position: absolute; left: 0; top: 0; pointer-events: none;",t}function xt(o="2",n){let t=Ct("circle");return t.setAttribute("r",o),t.setAttribute("fill",n),t}function Pt(o){let n=Ct("line");return n.setAttribute("stroke",o),n}function pt(o,n){let t=Ct("rect");return t.setAttribute("stroke",o),t.setAttribute("fill",n),t}function st(o,n,t){o.setAttribute("cx",`${n}`),o.setAttribute("cy",`${t}`)}function V(o,n,t){n&&(o.setAttribute("x1",`${n.x}`),o.setAttribute("y1",`${n.y}`)),t&&(o.setAttribute("x2",`${t.x}`),o.setAttribute("y2",`${t.y}`))}function H(o,n,t,e,r){o.setAttribute("x",`${n}`),o.setAttribute("y",`${t}`),o.setAttribute("width",`${e}`),o.setAttribute("height",`${r}`)}function Ae(){return Promise.resolve()}function br(){return new Promise(o=>{requestAnimationFrame(o)})}function Mr(o){return parseInt(o.replace("#","0x"),16)}function Sr(o,n){let t=parseInt(o.substring(1,3),16),e=parseInt(o.substring(3,5),16),r=parseInt(o.substring(5,7),16),i=Math.round(t*n),s=Math.round(e*n),l=Math.round(r*n);return`#${(1<<24|i<<16|s<<8|l).toString(16).slice(1)}`}function nt(o,n=.85){let t,e,r;if(o.startsWith("#"))t=parseInt(o.substring(1,3),16),e=parseInt(o.substring(3,5),16),r=parseInt(o.substring(5,7),16);else{let s=o.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 hn=require("three/examples/jsm/loaders/GLTFLoader");function wr(){return new hn.GLTFLoader}var Qt=null,te=new Map;function Lt(o){if(te.has(o)){let t=te.get(o).then(e=>(e.scene=e.scene.clone(),e))}Qt||(Qt=wr());let n=new Promise((t,e)=>{Qt.load(o,r=>{t(r)},void 0,e)});return te.set(o,n),n.then(t=>(t.scene=t.scene.clone(),t))}function Re(){Qt=null,te.clear()}var At=navigator.userAgent.toUpperCase().indexOf("MAC")>=0;function ee(o){return At?o==="Meta":o==="Control"}var Ie="__once__",Ne=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=`${Ie}${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(`${Ie}${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(`${Ie}${n}`);!e&&!r||(e?.forEach(i=>{typeof i=="function"&&i(...t)}),r?.forEach(i=>{typeof i=="function"&&i(...t)}),r?.clear())}};var Et=(t=>(t.SWITCH_FLOOR_BEFORE="switch_floor_before",t.SWITCH_FLOOR_AFTER="switch_floor_after",t))(Et||{});function W(o){return Object.keys(o).sort().map(n=>`${n}=${o[n]}`).join("&")}function Tr(o,n){return new Promise((t,e)=>{let r=new XMLHttpRequest;r.open("GET",o,!0),Object.keys(n.headers||{}).forEach(i=>{r.setRequestHeader(i,n.headers[i])}),n.responseType&&(r.responseType=n.responseType),r.onload=()=>{if(r.status>=200&&r.status<300)if(n.responseType==="arraybuffer")t(r.response);else try{let i=JSON.parse(r.responseText);t(i)}catch(i){e(i)}else e(r.statusText)},r.onerror=()=>{e(r.statusText)},r.send()})}var ft=class o{keySet=new Set;static createKey(){return Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)}genUniqueKey(){let n=o.createKey();for(;this.keySet.has(n);)n=o.createKey();return n}removeKey(n){this.keySet.delete(n)}dispose(){this.keySet.clear()}};var bt=require("three"),yn=ye(mn(),1);function Cr(o,n){let t=o.clone().normalize(),e=n.clone().normalize();return Math.acos(t.dot(e))}function Pr(o){let n=0;return o.reduce(([t,e],[r,i])=>(n+=Math.sqrt((r-t)**2+(i-e)**2),[r,i])),n/o.length}function De(o,n=.25){if(Pr(o)<n)return o;let t=(0,yn.default)(o);return De(t,n)}function Oe(o,n=!1,t=!0,e=5,r=150,i=3){let s=[],l=!n;if(s.push(o[0]),o.length<2)return s;for(let a=0;a<o.length-2;a+=1){let c=o[a],p=o[a+1],d=o[a+2],m=new bt.Vector2(c[0]-p[0],c[1]-p[1]),g=new bt.Vector2(d[0]-p[0],d[1]-p[1]),h=Cr(m,g)/Math.PI*180,f=m.length()+g.length();(!l||h<r&&f>.01||f>e)&&(s.push(o[a+1]),l=!0)}if(s.push(o[o.length-1]),!t)return s;let u=[];u.push(s[0]);for(let a=0;a<s.length-2;a+=1){let c=new bt.Vector2(s[a][0],s[a][1]),p=new bt.Vector2(s[a+1][0],s[a+1][1]),d=new bt.Vector2(s[a+2][0],s[a+2][1]),m=c.distanceTo(p)/2,g=d.distanceTo(p)/2,h=p.clone(),f=p.clone();h.add(c.clone().sub(p).normalize().multiplyScalar(m>i?i/2:m)),f.add(d.clone().sub(p).normalize().multiplyScalar(g>i?i/2:g));let x=[[h.x,h.y],[p.x,p.y],[f.x,f.y]];u.push(...De(x,i/25))}return u.push(s[s.length-1]),_n(u)}function _n(o){if(o.length<=1)return o;let n=[],t;return o.forEach(([e,r])=>{t?e===t[0]&&r===t[1]||(t=[e,r],n.push([e,r])):(t=[e,r],n.push([e,r]))}),n}function Fe(o,n,t){let e=Math.sqrt((t[0]-n[0])**2+(t[1]-n[1])**2);if(e===0)return{distance:Math.sqrt((o[0]-n[0])**2+(o[1]-n[1])**2),closestPoint:n.slice(0)};let r=Math.max(0,Math.min(1,((o[0]-n[0])*(t[0]-n[0])+(o[1]-n[1])*(t[1]-n[1]))/e**2)),i=[n[0]+r*(t[0]-n[0]),n[1]+r*(t[1]-n[1])];return{distance:Math.sqrt((o[0]-i[0])**2+(o[1]-i[1])**2),closestPoint:i}}function Ue(o,n,t){let[e,r]=o,[i,s]=n,l=Math.sqrt(Math.pow(i-e,2)+Math.pow(s-r,2)),u=t/l,a=e+(i-e)*u,c=r+(s-r)*u;return[a,c]}var vn=(a=>(a.START="start",a.END="end",a.FRONT="front",a.RIGHT="right",a.LEFT="left",a.RIGHT_FRONT="right_front",a.LEFT_FRONT="left_front",a.RIGHT_BACK="right_back",a.LEFT_BACK="left_back",a))(vn||{});function xn(o,n,t){let e=Pe(o,n,t);return 180-Math.abs(e)<15?"front":e>135?"right_front":e<-135?"left_front":e<=135&&e>=60?"right":e>=-135&&e<=-60?"left":e<60&&e>0?"right_back":e>-60&&e<0?"left_back":"front"}function Lr(o){let n=[{direction:"start",distance:R(o[0],o[1]),points:[o[0],o[1]]}];for(let t=2;t<o.length;t++){let e=xn(o[t-2],o[t-1],o[t]);if(e==="front"){let r=n[n.length-1],i=R(o[t-1],o[t]);r.distance+=i,t!==2&&r.points.push(o[t-1])}else n.push({direction:e,distance:R(o[t-1],o[t]),points:[o[t-1],o[t]]})}return n.push({direction:"end",distance:0,points:[o[o.length-1]]}),n}var J=ye(ke(),1);var X="___",ze=class{constructor(n=3){this.lift_priority=n}roadInfo=[];pointMap=new Map;nodeMap=new Map;facilityMap=new Map;straightLadderMap=new Map;escalatorMap=new Map;staircaseMap=new Map;lineMap=new Map;baseRoute=new J.default;escalatorRoute=new J.default;straightLadderRoute=new J.default;initRoute(n){this.clear(),this.roadInfo=n,n.length&&(n.forEach(t=>{t.points.forEach(e=>{let r=`${t.floor}${X}${e.id}`;if(this.pointMap.set(r,e),this.nodeMap.set(`${e.floor}${X}${e.nodeId}`,r),e.type==="straightLadder"){let i=this.straightLadderMap.get(e.name)||[];i.push({...e}),this.straightLadderMap.set(e.name,i)}if(e.type==="staircase"){let i=this.staircaseMap.get(e.name)||[];i.push({...e}),this.staircaseMap.set(e.name,i)}if(e.type==="escalator"){let i=this.escalatorMap.get(e.name)||{};e.escalatorDirection==="exit"?i.end={floor:e.floor,id:e.id}:i.start={floor:e.floor,id:e.id},this.escalatorMap.set(e.name,i)}if(e.type==="facility"){let i=this.facilityMap.get(e.targetId)||[];i.push({...e}),this.facilityMap.set(e.targetId,i)}}),t.lines.filter(e=>e.direction!=="no").forEach(e=>{let r=`${t.floor}${X}${e.from}`,i=`${t.floor}${X}${e.to}`,s=this.pointMap.get(r)?.cds,l=this.pointMap.get(i)?.cds;if(s?.length&&l?.length){let u=R(s,l);this.addLineItem(r,i,u),e.direction==="double"&&this.addLineItem(i,r,u)}})}),this.initBaseRoute(),this.initEscalatorRoute(),this.initStraightLadderRoute())}addLineItem(n,t,e,r=this.lineMap){let i=r.get(n)||new Map;i.set(t,e),r.set(n,i)}addFacilityToLineMap(n,t,e,r){[...this.straightLadderMap,...this.staircaseMap].forEach(([i,s])=>{if(!(s.length<2))for(let l=0;l<s.length;l++){let u=`${s[l].floor}${X}${s[l].id}`;for(let a=0;a<s.length;a++)if(l!==a){let c=`${s[a].floor}${X}${s[a].id}`,p=this.pointMap.get(u)?.cds,d=this.pointMap.get(c)?.cds;if(p?.length&&d?.length)if(s[l].type==="straightLadder"){let m=t;this.addLineItem(u,c,m,r)}else{let m=e;this.addLineItem(u,c,m,r)}}}}),this.escalatorMap.forEach((i,s)=>{if(i.start&&i.end){let l=`${i.start.floor}${X}${i.start.id}`,u=`${i.end.floor}${X}${i.end.id}`,a=this.pointMap.get(l)?.cds,c=this.pointMap.get(u)?.cds;if(a?.length&&c?.length){let p=n;this.addLineItem(l,u,p,r)}}})}initBaseRoute(){let n=new Map([...this.lineMap]);this.addFacilityToLineMap(1,this.lift_priority,3e4,n),this.baseRoute=new J.default(n)}initEscalatorRoute(){let n=new Map([...this.lineMap]),t=1e4;this.addFacilityToLineMap(1*t,this.lift_priority*t,3e4*t,n),this.escalatorRoute=new J.default(n)}initStraightLadderRoute(){let n=new Map([...this.lineMap]),t=1e4;this.addFacilityToLineMap(3*t,1*t,3e4*t,n),this.straightLadderRoute=new J.default(n)}checkStart(n){return!(!n.floor||!n.nodeId&&(!n.coord||n.coord.length<2))}checkEnd(n){return n.facility?!0:this.checkStart(n)}transformStart(n){if(n.nodeId){let t=this.nodeMap.get(`${n.floor}${X}${n.nodeId}`);if(t){let[e,r]=t.split(X);return{floor:e,id:r}}}if(n.coord?.length){let t=this.roadInfo.find(r=>r.floor===n.floor);if(!t)return null;let e=t.points.reduce((r,i)=>{let s=R(n.coord,i.cds);return s<r.min&&(r.min=s,r.point=i),r},{min:1/0,point:t.points[0]});return{floor:e.point.floor,id:e.point.id}}return null}transformEnd(n){if(n.floor){let t=this.transformStart(n);if(t)return t}return n.facility&&this.facilityMap.get(n.facility)?.length?{floor:n.floor,facility:n.facility}:null}getPath(n,t,e=""){if(!this.checkStart(n))return"start-error";if(!this.checkEnd(t))return"end-error";let r=this.transformStart(n);if(!r)return"no-start";let i=this.transformEnd(t);if(!i)return"no-end";let s=this.getBasePath.bind(this);switch(e){case"escalator":s=this.getEscalatorPath.bind(this);case"straightLadder":s=this.getStraightLadderPath.bind(this);default:s=this.getBasePath.bind(this)}if(console.log(r,i),i.id)return s(r,i);if(i.facility){let l=this.facilityMap.get(i.facility).filter(a=>i.floor?a.floor===i.floor:!0);if(!l.length)return null;let u=l.map(a=>s(r,{floor:a.floor,id:a.id})).filter(a=>!!a);return u.reduce((a,c)=>{let p=c.reduce((d,m)=>d+it(m.points),0);return p<a.distance&&(a.distance=p,a.path=c),a},{distance:1/0,path:u[0]}).path}}getRoutePath(n,t,e){let r=`${n.floor}${X}${n.id}`,i=`${t.floor}${X}${t.id}`,s=e.path(r,i);if(console.log(r,i,s),!s)return null;let l=[];return s.map(u=>{let a=this.pointMap.get(u);if(a){let{floor:c}=a;if(l[l.length-1]?.floor===c){let p=l[l.length-1];p.points.push(a.cds),p.endType=a.type,p.destId=a.nodeId}else l.push({floor:c,points:[a.cds],endType:a.type,destId:a.nodeId})}}),l}getBasePath(n,t){return this.getRoutePath(n,t,this.baseRoute)}getEscalatorPath(n,t){return this.getRoutePath(n,t,this.escalatorRoute)}getStraightLadderPath(n,t){return this.getRoutePath(n,t,this.straightLadderRoute)}clear(){this.roadInfo=[],this.pointMap.clear(),this.nodeMap.clear(),this.facilityMap.clear(),this.straightLadderMap.clear(),this.escalatorMap.clear(),this.staircaseMap.clear(),this.lineMap.clear(),this.baseRoute=new J.default,this.escalatorRoute=new J.default,this.straightLadderRoute=new J.default}};var q=ye(ke(),1);var F="___",Ve=class{constructor(n=3){this.lift_priority=n}roadInfo=[];pointMap=new Map;nodeMap=new Map;facilityMap=new Map;straightLadderMap=new Map;escalatorMap=new Map;staircaseMap=new Map;parkingMap=new Map;lineMap=new Map;baseRoute=new q.default;escalatorRoute=new q.default;straightLadderRoute=new q.default;forwardLineMap=new Map;forwardRoute=new q.default;initRoute(n){this.clear(),this.roadInfo=n,n.length&&(n.forEach(t=>{t.points.forEach(e=>{let r=`${t.floor}${F}${e.id}`;if(this.pointMap.set(r,e),this.nodeMap.set(`${e.floor}${F}${e.nodeId}`,r),e.type==="straightLadder"){let i=this.straightLadderMap.get(e.name)||[];i.push({...e}),this.straightLadderMap.set(e.name,i)}if(e.type==="staircase"){let i=this.staircaseMap.get(e.name)||[];i.push({...e}),this.staircaseMap.set(e.name,i)}if(e.type==="escalator"){let i=this.escalatorMap.get(e.name)||{};e.escalatorDirection==="exit"?i.end={floor:e.floor,id:e.id}:i.start={floor:e.floor,id:e.id},this.escalatorMap.set(e.name,i)}if(e.type==="facility"){let i=this.facilityMap.get(e.targetId)||[];i.push({...e}),this.facilityMap.set(e.targetId,i)}e.type==="parkingSpace"&&this.parkingMap.set(`${e.floor}${F}${e.name}`,e)}),t.lines.filter(e=>e.direction!=="no").forEach(e=>{let r=`${t.floor}${F}${e.from}`,i=`${t.floor}${F}${e.to}`,s=this.pointMap.get(r)?.cds,l=this.pointMap.get(i)?.cds;if(s?.length&&l?.length){let u=R(s,l);switch(this.addLineItem(r,i,u),this.addLineItem(i,r,u),e.direction){case"double":this.addLineItem(r,i,u,this.forwardLineMap),this.addLineItem(i,r,u,this.forwardLineMap);break;case"single":this.addLineItem(r,i,u,this.forwardLineMap);break;case"back":this.addLineItem(i,r,u,this.forwardLineMap);break}}})}),this.initBaseRoute(),this.initEscalatorRoute(),this.initStraightLadderRoute(),this.initForwardRoute())}addLineItem(n,t,e,r=this.lineMap){let i=r.get(n)||new Map;i.set(t,e),r.set(n,i)}addFacilityToLineMap(n,t,e,r){[...this.straightLadderMap,...this.staircaseMap].forEach(([i,s])=>{if(!(s.length<2))for(let l=0;l<s.length;l++){let u=`${s[l].floor}${F}${s[l].id}`;for(let a=0;a<s.length;a++)if(l!==a){let c=`${s[a].floor}${F}${s[a].id}`,p=this.pointMap.get(u)?.cds,d=this.pointMap.get(c)?.cds;if(p?.length&&d?.length)if(s[l].type==="straightLadder"){let m=t;this.addLineItem(u,c,m,r)}else{let m=e;this.addLineItem(u,c,m,r)}}}}),this.escalatorMap.forEach((i,s)=>{if(i.start&&i.end){let l=`${i.start.floor}${F}${i.start.id}`,u=`${i.end.floor}${F}${i.end.id}`,a=this.pointMap.get(l)?.cds,c=this.pointMap.get(u)?.cds;if(a?.length&&c?.length){let p=n;this.addLineItem(l,u,p,r)}}})}initBaseRoute(){let n=new Map([...this.lineMap]);this.addFacilityToLineMap(1,this.lift_priority,3e4,n),this.baseRoute=new q.default(n)}initEscalatorRoute(){let n=new Map([...this.lineMap]),t=1e4;this.addFacilityToLineMap(1*t,this.lift_priority*t,3e4*t,n),this.escalatorRoute=new q.default(n)}initStraightLadderRoute(){let n=new Map([...this.lineMap]),t=1e4;this.addFacilityToLineMap(3*t,1*t,3e4*t,n),this.straightLadderRoute=new q.default(n)}initForwardRoute(){this.forwardRoute=new q.default(this.forwardLineMap)}checkStart(n){return!(!n.floor||!n.nodeId&&(!n.coord||n.coord.length<2))}checkEnd(n){return n.facility||n.parkingSpace&&n.floor?!0:this.checkStart(n)}transformStart(n){if(n.nodeId){let t=this.nodeMap.get(`${n.floor}${F}${n.nodeId}`);if(t){let[e,r]=t.split(F);return{floor:e,id:r}}}if(n.coord?.length){let t=this.roadInfo.find(r=>r.floor===n.floor);if(!t)return null;let e=t.points.reduce((r,i)=>{let s=R(n.coord,i.cds);return s<r.min&&(r.min=s,r.point=i),r},{min:1/0,point:t.points[0]});return{floor:e.point.floor,id:e.point.id}}return null}transformEnd(n){if(n.floor){if(n.parkingSpace){let e=this.parkingMap.get(`${n.floor}${F}${n.parkingSpace}`);if(e)return{floor:e.floor,id:e.id}}let t=this.transformStart(n);if(t)return t}return n.facility&&this.facilityMap.get(n.facility)?.length?{floor:n.floor,facility:n.facility}:null}getPath(n,t,e=""){if(!this.checkStart(n))return"start-error";if(!this.checkEnd(t))return"end-error";let r=this.transformStart(n);if(!r)return"no-start";let i=this.transformEnd(t);if(!i)return"no-end";let s=this.getBasePath.bind(this);switch(e){case"escalator":s=this.getEscalatorPath.bind(this);case"straightLadder":s=this.getStraightLadderPath.bind(this);case"forward":s=this.getForwardPath.bind(this);default:s=this.getBasePath.bind(this)}if(i.id)return s(r,i);if(i.facility){let l=this.facilityMap.get(i.facility).filter(a=>i.floor?a.floor===i.floor:!0);if(!l.length)return null;let u=l.map(a=>s(r,{floor:a.floor,id:a.id})).filter(a=>!!a);return u.reduce((a,c)=>{let p=c.reduce((d,m)=>d+it(m.points),0);return p<a.distance&&(a.distance=p,a.path=c),a},{distance:1/0,path:u[0]}).path}}getRoutePath(n,t,e){let r=`${n.floor}${F}${n.id}`,i=`${t.floor}${F}${t.id}`,s=e.path(r,i);if(!s)return null;let l=[];return s.map(u=>{let a=this.pointMap.get(u);if(a){let{floor:c}=a;if(l[l.length-1]?.floor===c){let p=l[l.length-1];p.points.push(a.cds),p.endType=a.type,p.destId=a.nodeId,p.distance=it(p.points)}else l.push({floor:c,points:[a.cds],endType:a.type,destId:a.nodeId,distance:0})}}),l}getBasePath(n,t){return this.getRoutePath(n,t,this.baseRoute)}getEscalatorPath(n,t){return this.getRoutePath(n,t,this.escalatorRoute)}getStraightLadderPath(n,t){return this.getRoutePath(n,t,this.straightLadderRoute)}getForwardPath(n,t){return this.getRoutePath(n,t,this.forwardRoute)}clear(){this.roadInfo=[],this.pointMap.clear(),this.nodeMap.clear(),this.facilityMap.clear(),this.straightLadderMap.clear(),this.escalatorMap.clear(),this.staircaseMap.clear(),this.lineMap.clear(),this.baseRoute=new q.default,this.escalatorRoute=new q.default,this.straightLadderRoute=new q.default}};function He(o){return o.replace(/[A-Z]/g,n=>"_"+n.toLowerCase()).replace(/^_/,"")}var On=new ft;function dt(o,n,t){return new Promise((e,r)=>{let i=On.genUniqueKey(),s=({data:l})=>{l.type===`${n}_result`&&l.key===i&&(On.removeKey(i),self.removeEventListener("message",s),l.error?r(l.error):e(l.data))};o.addEventListener("message",s),o.postMessage({type:n,key:i,data:t})})}function Nr(o){let n={};for(let e in o)e.startsWith("on")&&(n[He(e.slice(2))]=o[e]);let t=async({data:e})=>{if(n[e.type])try{let r=await n[e.type](e.data);self.postMessage({type:`${e.type}_result`,key:e.key,data:r})}catch(r){self.postMessage({type:`${e.type}_result`,key:e.key,error:r})}else self.postMessage({type:`${e.type}_result`,key:e.key,error:"no_event"})};return self.addEventListener("message",t),()=>{self.removeEventListener("message",t)}}var b=require("three"),_t=require("@tweenjs/tween.js");var qn=require("three");var E=require("three");var ne={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},D=class extends E.Object3D{constructor(t,e){super();this.context=t;if(this.options=ht({...ne,...e},this),this.options.geometry.type==="point"){let[r,i]=this.options.geometry.coords;return this.position.set(r,i,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 E.Vector3,e=new E.Box3;return e.setFromObject(this),e.getCenter(t),t}getSize(){if(this.options.geometry.type==="point")return new E.Vector3(0,0,0);let t=new E.Box3,e=new E.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=$(this.options.geometry.coords[0],this.options.geometry.coords.slice(1));return new E.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:nt(this.options.fillColor),opacity:this.options.fillOpacity});return this.material=[t,e],[t,e]}getMaxAndMin(t,e){let r=new E.Box3().setFromObject(this),i=t.clone().add(e.clone().multiplyScalar(1e3)),s=new E.Ray(i,e.clone().multiplyScalar(-1)),l=new E.Vector3;s.intersectBox(r,l);let u=t.clone().add(e.clone().multiplyScalar(-1e3)),a=new E.Ray(u,e.clone()),c=new E.Vector3;return a.intersectBox(r,c),{max:c,min:l}}initGradualMaterial(){let{max:t,min:e}=new E.Box3().setFromObject(this),r=t.clone().sub(e),i=Math.max(r.x,r.y,r.z)/2,s=this.getPosition(),l=new E.Vector3(-1,.2,0).normalize(),{max:u,min:a}=this.getMaxAndMin(s,l),c=this.context.materialFactory.createShaderMaterial({gradualColor:this.options.gradualColor,center:this.getPosition(),maxValue:i,opacity:this.options.fillOpacity,direction:new E.Vector3(-1,.2,0),max:u,min:a});if(this.options.height<=.1)return this.material=c,c;let p=this.getCenter(),d=new E.Vector3(-1,.2,1).normalize(),{max:m,min:g}=this.getMaxAndMin(p,d),h=this.context.materialFactory.createShaderMaterial({gradualColor:[nt(this.options.gradualColor[0],this.options.colorFactor),nt(this.options.gradualColor[1],this.options.colorFactor)],center:this.getCenter(),maxValue:i,opacity:this.options.fillOpacity,direction:new E.Vector3(-1,.2,1),max:m,min:g});return this.material=[c,h],[c,h]}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 E.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 i=0;i<r.length;i++){let s=r[i];for(let l=0;l<s.length;l++){let u=s[l],a=l+1===s.length?s[0]:s[l+1];t.push(new E.Vector3(u[0],u[1],e)),t.push(new E.Vector3(a[0],a[1],e))}}return t}initLineGeometry(){this.lineGeometry&&this.lineGeometry.dispose();let t=this.getBorderPoints(),e=new E.BufferGeometry().setFromPoints(t);this.lineGeometry=e}createBorder(){this.line&&this.remove(this.line);let t=new E.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:i}=e[0];return{position:r,distance:i}}return!1}dispose(){this.geometry?.dispose(),this.line?.geometry.dispose(),this.clear()}};var j=require("three");var Rt=class extends j.Object3D{directionalLight;plane;basicOpacity=.07;constructor(){super(),this.directionalLight=this.initLight(),this.initPlane()}initLight(){let n=Me(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 j.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 j.PlaneGeometry(n,t),r=new j.ShadowMaterial({transparent:!0,opacity:0,side:j.DoubleSide}),i=new j.Mesh(e,r);return i.receiveShadow=!0,i.position.z=-10,this.add(i),this.plane=i,i}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 re=require("three");var M=require("three");var Fn=require("lodash");var Dr={autoUpdate:!0,appendToBody:!1,autoChangePlacement:!1},It=class extends M.EventDispatcher{constructor(t,e={}){super();this.context=t;this.options={...Dr,...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 M.Vector3;clientPos={x:0,y:0};visible=!0;options;placement="top";observer=null;initObserver(){let t=new MutationObserver((0,Fn.debounce)(()=>{this.div&&this.usePlacement()},100));t.observe(this.div,{childList:!0,subtree:!0,attributes:!0}),this.observer=t}getPlacementPosition(){if(this.element instanceof D&&this.element.options.geometry.type==="polygon"){let{max:i,min:s}=new M.Box3().setFromObject(this.element),l=(i.x+s.x)/2,u=(i.y+s.y)/2;return{left:new M.Vector3(s.x,u,i.z),leftTop:new M.Vector3(s.x,i.y,i.z),top:new M.Vector3(l,i.y,i.z),rightTop:new M.Vector3(i.x,i.y,i.z),right:new M.Vector3(i.x,u,i.z),rightBottom:new M.Vector3(i.x,s.y,i.z),bottom:new M.Vector3(l,s.y,i.z),leftBottom:new M.Vector3(s.x,s.y,i.z),center:new M.Vector3(l,u,i.z)}}let{x:t,y:e,z:r}=this.element?.getPosition?.()||this.position;return{left:new M.Vector3(t,e,r),leftTop:new M.Vector3(t,e,r),top:new M.Vector3(t,e,r),rightTop:new M.Vector3(t,e,r),right:new M.Vector3(t,e,r),rightBottom:new M.Vector3(t,e,r),bottom:new M.Vector3(t,e,r),leftBottom:new M.Vector3(t,e,r),center:new M.Vector3(t,e,r)}}getPlacementScreenPosition(){let{width:t,height:e}=this.context.clientSize,r=this.getPlacementPosition();return Object.keys(r).reduce((i,s)=>{let{x:l,y:u}=_(r[s],this.context.camera,t,e);return i[s]={x:l,y:u},i},{})}checkOverflow(t,e){let{width:r,height:i}=this.context.clientSize;return e.x>0&&t.x<r&&e.y<i&&t.y>0}getPlacement(){let{clientWidth:t,clientHeight:e}=this.div,r=this.getPlacementScreenPosition(),i=t/2,s=e/2,l=[{type:"center",getBox(u,a){return{max:{x:i+u,y:a-e},min:{x:u-i,y:a}}}},{type:"left",getBox(u,a){return{max:{x:u,y:a-s},min:{x:u-t,y:a+s}}}},{type:"leftTop",getBox(u,a){return{max:{x:u,y:a-e},min:{x:u-t,y:a}}}},{type:"top",getBox(u,a){return{max:{x:u+i,y:a-e},min:{x:u-i,y:a}}}},{type:"rightTop",getBox(u,a){return{max:{x:u+t,y:a-e},min:{x:u,y:a}}}},{type:"right",getBox(u,a){return{max:{x:u+t,y:a-s},min:{x:u,y:a+s}}}},{type:"rightBottom",getBox(u,a){return{max:{x:u+t,y:a},min:{x:u,y:a+e}}}},{type:"bottom",getBox(u,a){return{max:{x:u+i,y:a},min:{x:u-i,y:a+e}}}},{type:"leftBottom",getBox(u,a){return{max:{x:u,y:a},min:{x:u-t,y:a+s}}}}];for(let u=0;u<l.length;u++){let a=l[u],c=r[a.type],{max:p,min:d}=a.getBox(c.x,c.y);if(this.checkOverflow(p,d))return{type:a.type,position:c}}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 M.Box3().setFromObject(this.element).getCenter(new M.Vector3):this.position}get withinDisplayRange(){let{x:t,y:e}=this.clientPos,{width:r,height:i}=this.context.clientSize;return t>=0&&t<=r&&e>=0&&e<=i}_updatePosition(t,e){this.clientPos={x:t,y:e};let{width:r,height:i,x:s,y:l}=this.context.clientSize;this.options.appendToBody&&(this.div.style.left=`${s}px`,this.div.style.top=`${l+i}px`),this.options.autoUpdate?this.div.style.transform=`translate3d(${t}px, ${-i+e}px, 0)`:this.dispatchEvent({type:"update-position",x:t,y:e,width:r,height:i})}updatePosition(t=!1){let e=this.getPosition(),{width:r,height:i}=this.context.clientSize,{x:s,y:l}=_(e,this.context.camera,r,i);this.clientPos.x===s&&this.clientPos.y===l&&!t||this._updatePosition(s,l)}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 Or={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},Mt=class extends re.EventDispatcher{constructor(t,e){super();this.context=t;this.options=ht({...Or,...e},this),this.position.set(e.position?.x||0,e.position?.y||0,e.position?.z||0),this.overlay=new It(this.context,{autoUpdate:!1}),this.overlay.addEventListener("update-position",({x:r,y:i,height:s})=>{this.overlay.div.style.transform=`translate3d(calc(${r}px - 50%), calc(${-s+i}px - ${this.options.icon&&this.options.icon_position!=="center"?"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})=>{let i=this.textDiv;if(i){let s=this.initText();this.div.replaceChild(s,i)}else 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 re.Vector3;userData={};showTextStatus=!0;disposed=!1;get withinDisplayRange(){return this.overlay.withinDisplayRange}async resetSize(){if(await Ae(),!this.disposed)if(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[i,s]of Object.entries(e.styles))r.style[i]=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,i=e*t,s=r*t,{x:l,y:u}=this.overlay.clientPos;return{left:l-i/2,right:l+i/2,top:this.options.icon?u-s:u-s/2,bottom:this.options.icon?u:u+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 G=require("three");var I=require("three"),Un=require("@mars3d/heatmap.js"),at=require("@turf/turf"),Nt=class extends I.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:i,center:s}=this.getBox(t);this.heatmap=(0,Un.create)({width:e,height:r,container:this.div,...this.context.config.heatMap}),this.heatmap.setData(this.transformData(t,i)),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 I.PlaneGeometry(t,e),i=new I.Texture(this.div.firstChild);i.needsUpdate=!0;let s=new I.MeshBasicMaterial({transparent:!0,side:I.DoubleSide,map:i});s.needsUpdate=!0,this.plane=new I.Mesh(r,s),this.add(this.plane)}getTransMatrix({x:t,y:e}){return new I.Matrix3().makeScale(1,-1).multiply(new I.Matrix3().makeTranslation(0-t,0-e))}transformData(t,e){let r=this.getTransMatrix(e);return{data:t.data.map(s=>{let l=new I.Vector2(s.x,s.y).applyMatrix3(r);return{x:l.x,y:l.y,value:s.value}}),max:t.max,min:t.min}}getBox(t){let e=(0,at.featureCollection)(t.data.map(a=>(0,at.point)([a.x,a.y]))),r=(0,at.bbox)(e),i=r[2]-r[0],s=r[3]-r[1],l={x:r[0],y:r[3]},u=(0,at.center)(e);return{width:i,height:s,leftTop:l,center:u.geometry.coordinates}}dispose(){this.div=null,this.heatmap=void 0}};var ie=require("three");var Dt=class extends ie.Object3D{constructor(t,e){super();this.context=t;this.options=e;this.position.copy(e.position||new ie.Vector3(0,0,0)),this.loadModel()}model=null;async loadModel(){let t=await Lt(this.options.modelUrl);t.scene.rotation.set(Math.PI/2,Math.PI/2,0),this.add(t.scene),this.model=t}dispose(){z(this),this.model=null}};var oe=require("three");var Gn=require("three");var U=class extends Gn.Object3D{constructor(t){super();this.context=t}dispose(){z(this),this.children.forEach(t=>t.dispose?.()),this.clear()}};var Ot=class extends U{graphicMap=new Map;constructor(n){super(n)}getCenter(){return new oe.Box3().setFromObject(this).getCenter(new oe.Vector3)}createGraphic(n){let t=new D(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,i)=>{if(i instanceof D){let s=i.raycast(n);if(s){let{distance:l}=s;if(l<r.distance)return{distance:s.distance,position:s.position,graphic:i}}return r}else return r},t);return e===t?{graphics:[],position:null}:{graphics:[e.graphic],position:e.position}}};var Bn=require("lodash");var gt=class extends U{pois=[];debounceCollisionDetection;timer=new Y;constructor(n){super(n),this.registryEvent(),this.debounceCollisionDetection=(0,Bn.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 Mt(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 Mt&&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:i,right:s,top:l,bottom:u}=e.getBox();if(r===0||!e.options.collision_enable){n.push({left:i,right:s,top:l,bottom:u}),e.parentSetVisible(!0);return}let a=n.some(c=>c.left<s&&c.right>i&&c.top<u&&c.bottom>l);e.parentSetVisible(!a),a||n.push({left:i,right:s,top:l,bottom:u})})}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 rt=class extends G.Object3D{constructor(t){super();this.context=t;this.groundLayer=new U(this.context),this.graphicLayer=new Ot(this.context),this.poiLayer=new gt(this.context),this.wallLayer=new U(this.context),this.textureLayer=new U(this.context),this.glbModelLayer=new U(this.context),this.laneLayer=new U(this.context),this.mergeGraphicLayer=new U(this.context),this.groundUpper.add(this.graphicLayer),this.groundUpper.add(this.poiLayer),this.groundUpper.add(this.wallLayer),this.groundUpper.add(this.textureLayer),this.groundUpper.add(this.glbModelLayer),this.groundUpper.add(this.laneLayer),this.groundUpper.add(this.mergeGraphicLayer),this.add(this.groundUpper),this.add(this.groundLayer),this.add(this.models)}graphicLayer;poiLayer;wallLayer;textureLayer;glbModelLayer;laneLayer;mergeGraphicLayer;grounds=new Set;groundLayer;shadow=new Rt;heatmap;groundUpper=new G.Object3D;models=new G.Object3D;modelMap=new Map;groundMaxHeight=0;name="";key="";getPosition(){return new G.Box3().setFromObject(this).getCenter(new G.Vector3)}createGround(t){let e=new D(this.context,t);this.addGrounds([e])}addGrounds(t){t.forEach(e=>{this.grounds.has(e)||(e.mesh.castShadow=!0,this.grounds.add(e),this.groundLayer.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.groundUpper.position.z=this.groundMaxHeight}get hasElement(){return!!(this.grounds.size||this.graphicLayer.children.length)}getCenter(){return new G.Box3().setFromObject(this).getCenter(new G.Vector3)}addModel(t){let e=new Dt(this.context,t);return this.models.add(e),this.modelMap.set(t.id,e),e}addShadow(){let t=new G.Box3().setFromObject(this.groundUpper),e=t.getCenter(new G.Vector3),r=t.getSize(new G.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 Nt(this.context),this.add(this.heatmap)),this.heatmap.loadData(t);let e=new G.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.groundLayer.dispose(),this.graphicLayer.dispose(),this.poiLayer.dispose(),this.wallLayer.dispose(),this.textureLayer.dispose(),this.glbModelLayer.dispose(),this.laneLayer.dispose(),this.mergeGraphicLayer.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 se=require("three");var K=class extends se.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:i,offsetY:s}=t,{clientWidth:l,clientHeight:u}=r.domElement,a=i/l*2-1,c=1-s/u*2;return new se.Vector3(a,c,0).unproject(e)}getSvgCoordinate(t){let{camera:e,container:r}=this.context;return _(t,e,r.clientWidth,r.clientHeight)}dispose(){this._unRegistryEvent(),this.context.container.removeChild(this.svg),this.svg=null}};var Ft=class extends K{constructor(t){super(t);this.context=t;let{config:{svg:{circle:e,line:r}}}=t;this.circles=[xt(e.radius,e.fill),xt(e.radius,e.fill)],this.line=Pt(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]);st(this.circles[0],t.x,t.y),V(this.line,t)}if(this.points[1]){let t=this.getSvgCoordinate(this.points[1]);st(this.circles[1],t.x,t.y),V(this.line,void 0,t)}};onPointermove=t=>{this.points.length===1&&(this.line.style.display="block",V(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:i}=t,s=this.circles[this.points.length];st(s,r,i),this.points.length||V(this.line,{x:r,y:i},{x:r,y:i}),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:i}]=this.points;return Math.sqrt((r-t)**2+(i-e)**2)}dispose(){super.dispose(),this.unRegistryEvent(),this.line=null,this.circles=[]}};var Ut=class extends K{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]&&st(this.circles[t],e.x,e.y),t!==0&&V(this.lines[t-1],void 0,e),this.lines[t]&&V(this.lines[t],e)})};onPointermove=n=>{!this.lastLine||this.isClose||(this.lastLine.style.display="block",V(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:i,radius:s},line:{stroke:l}}=this.context.config.svg;if(!this.isClose){let u=xt(s,i);st(u,e,r),this.addCircle(u)}if(this.lines.length&&V(this.lastLine,void 0,{x:e,y:r}),!this.isClose){let u=Pt(l);V(u,{x:e,y:r},{x:e,y:r}),this.addLine(u)}}};checkAdsorb(n,t){if(this.points.length<3)return!1;let e=this.circles[0],r=+e.getAttribute("cx"),i=+e.getAttribute("cy");return Math.sqrt((n-r)**2+(t-i)**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 i=(r+1)%e;t+=n[r][0]*n[i][1]-n[i][0]*n[r][1]}return Math.abs(t/2)}dispose(){super.dispose(),this.unRegistryEvent(),this.lines=[],this.circles=[]}};var kn=require("three");var We=class extends K{constructor(t){super(t);this.context=t;let{config:{svg:{line:e}}}=t;this.rect=pt(e.stroke,"transparent"),this.svg.appendChild(this.rect);for(let r=0;r<4;r++)this.cornerRect[r]=pt(e.stroke,"#ffffff"),this.centerRect[r]=pt(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 kn.Box3().setFromObject(this.graphic),{camera:e,container:{clientWidth:r,clientHeight:i}}=this.context,{min:s,max:l}=t,u=_(s,e,r,i),a=_(l,e,r,i);H(this.rect,u.x,a.y,Math.abs(a.x-u.x),Math.abs(a.y-u.y));let{x:c,y:p}=u,{x:d,y:m}=a,g=5,h=[{x:c-g,y:m-g},{x:d-g,y:m-g},{x:c-g,y:p-g},{x:d-g,y:p-g}];for(let S=0;S<h.length;S++)H(this.cornerRect[S],h[S].x,h[S].y,g*2,g*2);let f=4,x=(c+d)/2,v=(p+m)/2,T=[{x:x-f,y:m-f},{x:c-f,y:v-f},{x:d-f,y:v-f},{x:x-f,y:p-f}];for(let S=0;S<T.length;S++)H(this.centerRect[S],T[S].x,T[S].y,f*2,f*2)}else{H(this.rect,0,0,0,0);for(let t=0;t<this.cornerRect.length;t++)H(this.cornerRect[t],0,0,0,0),H(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 C=require("three");var Xe=require("three/examples/jsm/utils/BufferGeometryUtils"),Gt=class extends C.Object3D{constructor(t,e){super();this.context=t;this.options=e;e.length&&this.init()}geometry;material;lineMaterial;lineGeometry;Mesh;LineMesh;initGeometry(){let t=this.options.map(e=>{let r=$(e.geometry.coords[0],e.geometry.coords.slice(1));return new C.ExtrudeGeometry(r,{steps:1,bevelEnabled:!1,depth:e.height,curveSegments:4})});this.geometry=(0,Xe.mergeGeometries)(t),t.forEach(e=>e.dispose())}initMaterial(){let t=`
2
2
  varying vec3 vPosition; // \u7528\u4E8E\u4F20\u9012\u9876\u70B9\u7684\u4F4D\u7F6E\u7ED9\u7247\u6BB5\u7740\u8272\u5668
3
3
  uniform float maxZ; // \u58F0\u660E\u4E00\u4E2Auniform\u53D8\u91CF
4
4
  uniform vec3 uColor;
@@ -24,7 +24,7 @@
24
24
  gl_FragColor = vec4(uColor2, uOpacity); // \u5176\u4ED6\u9762\u989C\u8272\uFF09
25
25
  }
26
26
  }
27
- `,r=-1/0,i=this.geometry.getAttribute("position");if(i)for(let l=0;l<i.count;l++){let u=i.getZ(l);u>r&&(r=u)}let s=new C.ShaderMaterial({uniforms:{maxZ:{value:r},uColor:{value:new C.Color(this.options[0].fillColor)},uColor2:{value:new C.Color(nt(this.options[0].fillColor))},uOpacity:{value:this.options[0].fillOpacity}},vertexShader:t,fragmentShader:e});this.material=s}initLineMaterial(){let{strokeColor:t,strokeOpacity:e}=this.options[0],r=this.context.materialFactory.createLineMaterial({color:t,opacity:e});return this.lineMaterial=r,r}getBorderPoints(t){let{height:e,deltaHeight:r,geometry:i}=t,s=[],l=e+(r||0),{coords:u}=i;for(let a=0;a<u.length;a++){let c=u[a];for(let p=0;p<c.length;p++){let d=c[p],m=p+1===c.length?c[0]:c[p+1];s.push(new C.Vector3(d[0],d[1],l)),s.push(new C.Vector3(m[0],m[1],l))}}return s}initLineGeometry(){let t=this.options.map(e=>{let r=this.getBorderPoints(e);return new C.BufferGeometry().setFromPoints(r)});this.lineGeometry=(0,Xe.mergeGeometries)(t)}createBorder(){let t=new C.LineSegments(this.lineGeometry,this.lineMaterial);return this.LineMesh=t,this.add(t),t}init(){this.initGeometry(),this.initMaterial();let t=new C.Mesh(this.geometry,this.material);this.add(t),this.initLineMaterial(),this.initLineGeometry(),this.createBorder()}dispose(){this.geometry?.dispose(),this.material?.dispose(),this.lineGeometry?.dispose(),this.clear()}};var St=require("three"),zn={uuid:"",iconUrl:"",name:"",secondRotate:0,airHeight:0,deltaHeight:0,height:0,geometry:{cds:[],type:"polygon",coords:[],curveCpt:[],curveIndex:[]},opacity:1,visible:!0},Bt=class extends St.Object3D{constructor(t,e){super();this.context=t;this.options=ht({...zn,...e},this),this.init()}options;mesh;async init(){let{deltaHeight:t,airHeight:e,geometry:r,iconUrl:i,opacity:s}=this.options,l=$(r.coords[0],r.coords.slice(1)),u=new St.ExtrudeGeometry(l,{steps:1,bevelEnabled:!1,depth:0,curveSegments:4}),a=await this.context.materialFactory.createGroundTextureMaterial({url:i,opacity:s}),c=new St.Mesh(u,a);this.mesh=c,this.mesh.position.z=e+t,this.add(c)}dispose(){this.mesh?.geometry.dispose(),this.clear()}};var mt=require("three");var Fr={url:"",geometry:{type:"polygon",cds:[],coords:[],curveCpt:[],curveIndex:[]},id:"",width:0,rotate:1,airHeight:1,deltaHeight:0},kt=class extends mt.Object3D{constructor(t,e){super();this.context=t;this.options=Object.assign({},Fr,e),this.loadModel()}model=null;options;async loadModel(){let t=await Lt(this.options.url);t.scene.rotation.set(Math.PI/2,Math.PI/2,0);let e=new mt.Box3().setFromObject(t.scene),r=e.getSize(new mt.Vector3),i=Math.max(r.x,r.y),s=this.options.width/i;this.scale.set(s,s,s),this.add(t.scene),this.position.copy(e.getCenter(new mt.Vector3)),this.position.z+=this.options.airHeight+this.options.deltaHeight,this.model=t}dispose(){z(this),this.model=null}};var B=require("three");var qe=require("three/examples/jsm/utils/BufferGeometryUtils"),Vn=require("three/examples/jsm/lines/Line2"),Hn=require("three/examples/jsm/lines/LineGeometry"),zt=class extends B.Object3D{constructor(t,e){super();this.context=t;this.options=e;e.length&&this.init()}geometry;material;lineMaterial;lineGeometry;Mesh;LineMesh;initGeometry(){let t=this.options.map(e=>{let r=$(e.geometry.coords[0],e.geometry.coords.slice(1));return new B.ExtrudeGeometry(r,{steps:1,bevelEnabled:!1,depth:0,curveSegments:4})});this.geometry=(0,qe.mergeGeometries)(t),t.forEach(e=>e.dispose())}initMaterial(){let{fillColor:t,fillOpacity:e}=this.options[0],r=this.context.materialFactory.createMeshBasicMaterial({color:t,opacity:e});return this.material=r,r}initLineMaterial(){let{strokeColor:t,strokeOpacity:e}=this.options[0],r=this.context.materialFactory.createLineMaterial({color:t,opacity:e});return this.lineMaterial=r,r}getBorderPoints(t){let{deltaHeight:e,geometry:r}=t,i=[],s=e||0,{coords:l}=r;for(let u=0;u<l.length;u++){let a=l[u];for(let c=0;c<a.length;c++){let p=a[c],d=c+1===a.length?a[0]:a[c+1];i.push(new B.Vector3(p[0],p[1],s)),i.push(new B.Vector3(d[0],d[1],s))}}return i}initDoubleLine(){let t=this.options.filter(r=>r.double&&r.geometry.otherCoords?.[1]?.length);if(!t.length)return;let e=t.reduce((r,i)=>{let s=`${i.secondColor}-${i.dashed}`;return r[s]&&r[s].push(i),r[s]||(r[s]=[i]),r},{});Object.values(e).map(r=>{let i=this.context.materialFactory.createLine2MaterialMap({color:r[0].secondColor,width:.2,dashed:r[0].dashed});r.map(s=>{let l=new Hn.LineGeometry,u=s.geometry.otherCoords[1].map(c=>[...c,0]).flat(2);l.setPositions(u);let a=new Vn.Line2(l,i);a.computeLineDistances(),a.position.z+=.001,this.add(a)})})}initLineGeometry(){let t=this.options.map(e=>{let r=this.getBorderPoints(e);return new B.BufferGeometry().setFromPoints(r)});this.lineGeometry=(0,qe.mergeGeometries)(t)}createBorder(){let t=new B.LineSegments(this.lineGeometry,this.lineMaterial);return this.LineMesh=t,this.add(t),t}init(){this.initGeometry(),this.initMaterial();let t=new B.Mesh(this.geometry,this.material);this.add(t),this.initLineMaterial(),this.initLineGeometry(),this.createBorder(),this.initDoubleLine(),this.position.z+=.002+(this.options[0].deltaHeight||0)}dispose(){this.geometry?.dispose(),this.lineGeometry?.dispose(),this.clear()}};var P=require("three");var Wn=require("three/examples/jsm/utils/BufferGeometryUtils"),Vt=class extends P.Object3D{constructor(t,e){super();this.context=t;this.options=e.map(r=>({...ne,...r})),this.init()}geometry;material;mesh;line;lineMaterial;lineGeometry;options;init(){this.geometry=this.initGeometry(),this.initMaterial(),this.initMesh(),this.mesh.position.z=this.options[0].deltaHeight,this.initLineMaterial(),this.initLineGeometry(),this.createBorder()}initGeometry(){let t=this.options.map(r=>{let i=$(r.geometry.coords[0],r.geometry.coords.slice(1));return new P.ExtrudeGeometry(i,{steps:1,bevelEnabled:!1,depth:r.height,curveSegments:4})}),e=(0,Wn.mergeGeometries)(t);return t.forEach(r=>r.dispose()),e}initMaterial(){let t=`
27
+ `,r=-1/0,i=this.geometry.getAttribute("position");if(i)for(let l=0;l<i.count;l++){let u=i.getZ(l);u>r&&(r=u)}let s=new C.ShaderMaterial({uniforms:{maxZ:{value:r},uColor:{value:new C.Color(this.options[0].fillColor)},uColor2:{value:new C.Color(nt(this.options[0].fillColor))},uOpacity:{value:this.options[0].fillOpacity}},vertexShader:t,fragmentShader:e});this.material=s}initLineMaterial(){let{strokeColor:t,strokeOpacity:e}=this.options[0],r=this.context.materialFactory.createLineMaterial({color:t,opacity:e});return this.lineMaterial=r,r}getBorderPoints(t){let{height:e,deltaHeight:r,geometry:i}=t,s=[],l=e+(r||0),{coords:u}=i;for(let a=0;a<u.length;a++){let c=u[a];for(let p=0;p<c.length;p++){let d=c[p],m=p+1===c.length?c[0]:c[p+1];s.push(new C.Vector3(d[0],d[1],l)),s.push(new C.Vector3(m[0],m[1],l))}}return s}initLineGeometry(){let t=this.options.map(e=>{let r=this.getBorderPoints(e);return new C.BufferGeometry().setFromPoints(r)});this.lineGeometry=(0,Xe.mergeGeometries)(t)}createBorder(){let t=new C.LineSegments(this.lineGeometry,this.lineMaterial);return this.LineMesh=t,this.add(t),t}init(){this.initGeometry(),this.initMaterial();let t=new C.Mesh(this.geometry,this.material);this.add(t),this.initLineMaterial(),this.initLineGeometry(),this.createBorder()}dispose(){this.geometry?.dispose(),this.material?.dispose(),this.lineGeometry?.dispose(),this.clear()}};var St=require("three"),zn={uuid:"",iconUrl:"",name:"",secondRotate:0,airHeight:0,deltaHeight:0,height:0,geometry:{cds:[],type:"polygon",coords:[],curveCpt:[],curveIndex:[]},opacity:1,visible:!0},Bt=class extends St.Object3D{constructor(t,e){super();this.context=t;this.options=ht({...zn,...e},this),this.init()}options;mesh;async init(){let{deltaHeight:t,airHeight:e,geometry:r,iconUrl:i,opacity:s}=this.options,l=$(r.coords[0],r.coords.slice(1)),u=new St.ExtrudeGeometry(l,{steps:1,bevelEnabled:!1,depth:0,curveSegments:4}),a=await this.context.materialFactory.createGroundTextureMaterial({url:i,opacity:s}),c=new St.Mesh(u,a);this.mesh=c,this.mesh.position.z=e+t,this.add(c)}dispose(){this.mesh?.geometry.dispose(),this.clear()}};var mt=require("three");var Fr={url:"",geometry:{type:"polygon",cds:[],coords:[],curveCpt:[],curveIndex:[]},id:"",width:0,rotate:1,airHeight:1,deltaHeight:0},kt=class extends mt.Object3D{constructor(t,e){super();this.context=t;this.options=Object.assign({},Fr,e),this.loadModel()}model=null;options;async loadModel(){let t=await Lt(this.options.url);t.scene.rotation.set(Math.PI/2,Math.PI/2,0);let e=new mt.Box3().setFromObject(t.scene),r=e.getSize(new mt.Vector3),i=Math.max(r.x,r.y),s=this.options.width/i;this.scale.set(s,s,s),this.add(t.scene),this.position.copy(e.getCenter(new mt.Vector3)),this.position.z+=this.options.airHeight+this.options.deltaHeight,this.model=t}dispose(){z(this),this.model=null}};var B=require("three");var qe=require("three/examples/jsm/utils/BufferGeometryUtils"),Vn=require("three/examples/jsm/lines/Line2"),Hn=require("three/examples/jsm/lines/LineGeometry"),zt=class extends B.Object3D{constructor(t,e){super();this.context=t;this.options=e;e.length&&this.init()}geometry;material;lineMaterial;lineGeometry;Mesh;LineMesh;initGeometry(){let t=this.options.map(e=>{let r=$(e.geometry.coords[0].slice(0,-1),e.geometry.coords.slice(1));return new B.ShapeGeometry(r,4)});this.geometry=(0,qe.mergeGeometries)(t),t.forEach(e=>e.dispose())}initMaterial(){let{fillColor:t,fillOpacity:e}=this.options[0],r=this.context.materialFactory.createMeshBasicMaterial({color:t,opacity:e});return this.material=r,r}initLineMaterial(){let{strokeColor:t,strokeOpacity:e}=this.options[0],r=this.context.materialFactory.createLineMaterial({color:t,opacity:e});return this.lineMaterial=r,r}getBorderPoints(t){let{deltaHeight:e,geometry:r}=t,i=[],s=e||0,{coords:l}=r;for(let u=0;u<l.length;u++){let a=l[u];for(let c=0;c<a.length;c++){let p=a[c],d=c+1===a.length?a[0]:a[c+1];i.push(new B.Vector3(p[0],p[1],s)),i.push(new B.Vector3(d[0],d[1],s))}}return i}initDoubleLine(){let t=this.options.filter(r=>r.double&&r.geometry.otherCoords?.[1]?.length);if(!t.length)return;let e=t.reduce((r,i)=>{let s=`${i.secondColor}-${i.dashed}`;return r[s]&&r[s].push(i),r[s]||(r[s]=[i]),r},{});Object.values(e).map(r=>{let i=this.context.materialFactory.createLine2MaterialMap({color:r[0].secondColor,width:.2,dashed:r[0].dashed});r.map(s=>{let l=new Hn.LineGeometry,u=s.geometry.otherCoords[1].map(c=>[...c,0]).flat(2);l.setPositions(u);let a=new Vn.Line2(l,i);a.computeLineDistances(),a.position.z+=.001,this.add(a)})})}initLineGeometry(){let t=this.options.map(e=>{let r=this.getBorderPoints(e);return new B.BufferGeometry().setFromPoints(r)});this.lineGeometry=(0,qe.mergeGeometries)(t)}createBorder(){let t=new B.LineSegments(this.lineGeometry,this.lineMaterial);return this.LineMesh=t,this.add(t),t}init(){this.initGeometry(),this.initMaterial();let t=new B.Mesh(this.geometry,this.material);this.add(t),this.initLineMaterial(),this.initLineGeometry(),this.createBorder(),this.initDoubleLine(),this.position.z+=.002+(this.options[0].deltaHeight||0)}dispose(){this.geometry?.dispose(),this.lineGeometry?.dispose(),this.clear()}};var P=require("three");var Wn=require("three/examples/jsm/utils/BufferGeometryUtils"),Vt=class extends P.Object3D{constructor(t,e){super();this.context=t;this.options=e.map(r=>({...ne,...r})),this.init()}geometry;material;mesh;line;lineMaterial;lineGeometry;options;init(){this.geometry=this.initGeometry(),this.initMaterial(),this.initMesh(),this.mesh.position.z=this.options[0].deltaHeight,this.initLineMaterial(),this.initLineGeometry(),this.createBorder()}initGeometry(){let t=this.options.map(r=>{let i=$(r.geometry.coords[0],r.geometry.coords.slice(1));return new P.ExtrudeGeometry(i,{steps:1,bevelEnabled:!1,depth:r.height,curveSegments:4})}),e=(0,Wn.mergeGeometries)(t);return t.forEach(r=>r.dispose()),e}initMaterial(){let t=`
28
28
  varying vec3 vPosition; // \u7528\u4E8E\u4F20\u9012\u9876\u70B9\u7684\u4F4D\u7F6E\u7ED9\u7247\u6BB5\u7740\u8272\u5668
29
29
  uniform float maxZ; // \u58F0\u660E\u4E00\u4E2Auniform\u53D8\u91CF
30
30
  uniform vec3 uColor;
@@ -87,7 +87,7 @@
87
87
  void main() {
88
88
  gl_FragColor = vec4(vColor.x, vColor.y, vColor.z, opacity);
89
89
  }
90
- `,p=new L.ShaderMaterial({uniforms:{uColor:{value:new L.Color(n[0]).convertLinearToSRGB()},uGradualColor:{value:new L.Color(n[1]).convertLinearToSRGB()},center:{value:t},maxValue:{value:e},opacity:{value:r},uDirection:{value:i},uMax:{value:s},uMin:{value:l}},vertexShader:a,fragmentShader:c,side:L.DoubleSide});return this.shaderMaterialMap.set(u,p),p}async createGroundTextureMaterial({url:n,opacity:t}){let e=`${n}-${t}`;if(this.groundTextureMaterialMap.has(e))return this.groundTextureMaterialMap.get(e);let r=await this.context.textureFactory.getTexture(n),i=new L.MeshBasicMaterial({map:r,transparent:!0,opacity:t});return this.groundTextureMaterialMap.set(e,i),i}createLine2MaterialMap({color:n,width:t,dashed:e}){let r=`${n}-${t}-${e}`;if(this.line2MaterialMap.has(r))return this.line2MaterialMap.get(r);let i=new $n.LineMaterial({color:parseInt(n.slice(1),16),dashed:e,linewidth:t,worldUnits:!0,dashSize:1,gapSize:3,dashScale:1,resolution:new L.Vector2(this.context.clientSize.width,this.context.clientSize.height)});return this.line2MaterialMap.set(r,i),i}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(),this.groundTextureMaterialMap.forEach((n,t)=>{n.dispose(),n.map?.dispose()}),this.groundTextureMaterialMap.clear(),this.line2MaterialMap.forEach((n,t)=>{n.dispose()}),this.line2MaterialMap.clear()}};var yt=require("three");var ue=class{constructor(n){this.context=n;this.registryEvent(),this.changePrevCamera()}prevCamera={position:new yt.Vector3,zoom:1,target:new yt.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.scene.children.filter(f=>f instanceof rt).length)return null;let t=new yt.Box3().setFromObject(this.context.scene),{camera:e,clientSize:{width:r,height:i}}=this.context,{min:s,max:l}=t,u=_(s,e,r,i),a=_(l,e,r,i),c=_(new yt.Vector3(s.x,l.y,l.z),e,r,i),p=_(new yt.Vector3(l.x,s.y,s.z),e,r,i),d=Math.min(u.x,a.x,c.x,p.x),m=Math.max(u.x,a.x,c.x,p.x),g=Math.min(u.y,a.y,c.y,p.y),h=Math.max(u.y,a.y,c.y,p.y);return{left:d,right:m,top:g,bottom:h}}checkDistanceToScreenEdge({left:n,right:t,top:e,bottom:r}){let{width:i,height:s}=this.context.clientSize,[l,u,a,c]=this.context.config.cameraBound.padding,p=t>=c,d=i-n>=u,m=s-e>=a,g=r>=l;return p&&d&&m&&g}onCameraChange=()=>{let n=this.getCurFloorScreenPosition();if(n){let{left:t,right:e,top:r,bottom:i}=n;this.checkDistanceToScreenEdge({left:t,right:e,top:r,bottom:i})?this.changePrevCamera():this.backToPrevCamera()}};dispose(){this.unRegistryEvent()}};var Kn=require("three"),ce=class{constructor(n){this.context=n}textureMap=new Map;loader=new Kn.TextureLoader;async getTexture(n){if(this.textureMap.has(n))return this.textureMap.get(n);let t=await this.loader.loadAsync(n);return this.textureMap.set(n,t),t}dispose(){this.textureMap.forEach(n=>{n.dispose()}),this.textureMap.clear()}};var Xt=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 Ht(this),this.hoverHelper=new Wt(this),this.materialFactory=new le(this),this.textureFactory=new ce(this),this.resizeClientSize(),this.registryEvent()}scene=_e();renderer=ve();camera;control;lights=Ee();timer=new Y;tweenGroup=new _t.Group;currentFloor;selection;hoverHelper;basicRatio;materialFactory;textureFactory;cameraBound;clientSize={width:0,height:0,x:0,y:0};renderRf=0;resizeClientSize(){let{x:t,y:e,width:r,height:i}=this.container.getBoundingClientRect();this.clientSize={width:r||this.container.clientWidth,height:i||this.container.clientHeight,x:t,y:e}}init(){let{clientWidth:t,clientHeight:e}=this.container;this.camera=xe(t,e),this.renderer.setSize(t,e),this.control=be(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 ue(this)}getRatio(t=new E.Vector3(0,0,0),e=new E.Vector3(100,0,0)){let{clientWidth:r,clientHeight:i}=this.container,s=_(t,this.camera,r,i),l=_(e,this.camera,r,i);return Math.ceil(Math.sqrt((l.x-s.x)**2+(l.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:i,clientHeight:s}=t;i=Math.max(1,i),s=Math.max(1,s),e.left=-i/2,e.right=i/2,e.top=s/2,e.bottom=-s/2,e.updateProjectionMatrix(),r.setSize(i,s),this.resizeClientSize(),this.dispatchEvent({type:"resize",width:i,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 i=this.getPoisByDeviceXy(t.offsetX,t.offsetY);i.length&&this.dispatchEvent({type:"poi-click",pois:i})};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 i=new E.Raycaster;return i.setFromCamera(r,this.camera),i.ray.origin.sub(i.ray.direction.clone().multiplyScalar(100)),this.currentFloor?.graphicLayer.getGraphicByRaycaster(i)||{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),i=this.getPoisByDeviceXy(t.offsetX,t.offsetY);this.dispatchEvent({type:"pointer-over",e:t,graphics:e,pois:i,position:r})};onPointermove=t=>{let{graphics:e,position:r}=this.getGraphicsByDeviceXy(t.offsetX,t.offsetY),i=this.getPoisByDeviceXy(t.offsetX,t.offsetY);this.dispatchEvent({type:"pointer-move",e:t,graphics:e,pois:i,position:r})};onPointerleave=t=>{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.container.addEventListener("pointercancel",this.onPointerleave),this.container.addEventListener("pointerout",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.container.removeEventListener("pointercancel",this.onPointerleave),this.container.removeEventListener("pointerout",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()):ot(new Promise(r=>{let i={polar:this.control.getPolarAngle()},s={polar:t},l=new _t.Tween(i,this.tweenGroup).to(s,e).onUpdate(()=>{this.control.maxPolarAngle=i.polar,this.control.minPolarAngle=i.polar,this.control.update()}).onComplete(()=>{this.control.enabled=!0,this.control.maxPolarAngle=this.config.control.maxPolar,this.control.minPolarAngle=0,this.tweenGroup.remove(l),r(!0)}).onStart(()=>{this.control.enabled=!1}).start()}),e+500)}setAzimuthalAngle(t,e=500){let{maxAzimuthAngle:r,minAzimuthAngle:i}=this.control,s=r===i;if(!(!s&&t>r&&t<i)){if(e===0){this.control.maxAzimuthAngle=t,this.control.minAzimuthAngle=t,this.control.update(),s||(this.control.maxAzimuthAngle=r,this.control.minAzimuthAngle=i);return}return ot(new Promise(l=>{let u={azimuthal:this.control.getAzimuthalAngle()},a={azimuthal:t},c=new _t.Tween(u,this.tweenGroup).to(a,e).onUpdate(()=>{this.control.maxAzimuthAngle=u.azimuthal,this.control.minAzimuthAngle=u.azimuthal,this.control.update()}).onComplete(()=>{this.control.enabled=!0,s||(this.control.maxAzimuthAngle=r,this.control.minAzimuthAngle=i),this.tweenGroup.remove(c),l(!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 i=this.getCameraLookAt(),s={zoom:this.camera.zoom,target:this.control.target.clone()};if(!r){this.camera.position.copy(e.clone().sub(i)),this.control.target.copy(e),this.camera.zoom=t,this.control.update();return}return ot(new Promise(l=>{let u=new _t.Tween(s,this.tweenGroup).to({zoom:t,target:e},r).onUpdate(()=>{this.camera.position.copy(s.target.clone().sub(i)),this.control.target.copy(s.target),this.camera.zoom=s.zoom,this.control.update()}).onComplete(()=>{this.tweenGroup.remove(u),this.control.enabled=!0,l(!0)}).onStart(()=>{this.control.enabled=!1}).start()}),r+500)}getFitCameraToObjectZoom(t,e=[20,20,20,20],r=500,i=!0){let[s,l,u,a]=e,{clientSize:{width:c,height:p}}=this,d=this.control.getPolarAngle();i&&this.setPolarAngle(0,0);let m=new E.Box3().setFromObject(t);this.setPolarAngle(d,0);let{max:g,min:h}=m,f=new E.Vector3(h.x,g.y,g.z),v=new E.Vector3(g.x,g.y,g.z),w=new E.Vector3(g.x,h.y,h.z),T=new E.Vector3(h.x,h.y,h.z),M=_(f,this.camera,c,p),O=_(v,this.camera,c,p),N=_(T,this.camera,c,p),Yt=_(w,this.camera,c,p),sn=new E.Box2().setFromPoints([new E.Vector2(M.x,M.y),new E.Vector2(O.x,O.y),new E.Vector2(N.x,N.y),new E.Vector2(Yt.x,Yt.y)]).getSize(new E.Vector2),ur=(c-l-a)/sn.x,cr=(p-s-u)/sn.y,hr=Math.min(ur,cr),pr=new E.Vector3((g.x+h.x)/2,(g.y+h.y)/2,(g.z+h.z)/2);return{zoom:hr*this.camera.zoom,center:pr}}fitCameraToObject(t,e=[20,20,20,20],r=500,i=!0){let{zoom:s,center:l}=this.getFitCameraToObjectZoom(t,e,r,i);return this.setZoom(s,l,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 ot(new Promise(r=>{let i=this.camera.position.clone(),s=this.getCameraLookAt(),l=new _t.Tween(i,this.tweenGroup).to(t,e).onUpdate(()=>{this.camera.position.copy(i.clone().sub(s)),this.control.target.copy(i.clone()),this.control.update()}).onComplete(()=>{this.tweenGroup.remove(l),this.camera.position.copy(i.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.renderRf=this.timer.requestAnimationFrame(()=>{this.render()}),this.tweenGroup.update()}pauseRender(){this.timer.cancelAnimationFrame(this.renderRf)}continueRender(){this.render()}dispose(){this.cameraBound.dispose(),this.selection.dispose(),this.hoverHelper.dispose(),this.tweenGroup.getAll().forEach(t=>t.stop()),this.tweenGroup.removeAll(),this.unRegistryEvent(),this.renderer.domElement.remove(),this.timer.dispose(),this.renderer.dispose(),this.lights.children.forEach(t=>t.dispose()),this.materialFactory.dispose(),this.textureFactory.dispose(),z(this.scene)}};var Zn=require("lodash"),Jn={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 je(o){return(0,Zn.merge)({},Jn,o)}var Qn=require("lodash");async function Ye({brand:o,project:n},t){let{apiDomain:e,apiPath:{floorRange:r},apiInfo:i}=t,s=`${e}${r}?brand=${o}&project=${n}&phase=${n}&building=${n}`;return await fetch(s,i).then(u=>u.json()).then(u=>u.data).then(u=>{let a=(u||[])[0];return a&&(a.info=JSON.parse(a.info)),a})}async function qt({brand:o,project:n,floor:t,ts:e,resource_type_list:r},i){let{apiDomain:s,apiPath:{floorGraphic:l},apiInfo:u}=i,a=`${s}${l}?brand=${o}&project=${n}&phase=${n}&building=${n}&floor=${t}&ts=${e}&resource_type_list=${r}`;return await fetch(a,u).then(p=>p.json()).then(p=>p.data).then(p=>((p||[]).map(d=>d.info=JSON.parse(d.info)),p||[]))}var tr=(t=>(t[t.D2=0]="D2",t[t.D3=1.1]="D3",t))(tr||{}),$e=class extends he.EventDispatcher{constructor(t,e={}){super();this.container=t;this.config=je(e),this.context=new Xt(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 Y;plugins=[];async loadGraphics({brand:t,project:e,floor:r,ts:i,resource_type_list:s}){return await qt({brand:t,project:e,floor:r,ts:i,resource_type_list:s},this.config)}changeBuildingCenter(t,{brand:e,project:r}){let i=t?Jt(t.info.geometry.cds[0]):[0,0];this.buildingCenter=i,this.dispatchEvent({type:"center-change",center:i,project:r,brand:e})}async loadBuildingGround({brand:t,project:e}){let r=W({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 i=new Promise(async s=>{let l=await Ye({brand:t,project:e},this.config);this.buildingGroundMap.set(r,l),this.changeBuildingCenter(l||null,{brand:t,project:e}),this.buildingGroundPromiseMap.delete(r),s(l)});return this.buildingGroundPromiseMap.set(r,i),i}async load({brand:t,project:e,floor:r,ts:i,resource_type_list:s}){let l=W({brand:t,project:e,floor:r,ts:i,resource_type_list:s});if(this.floorDataMap.has(l))return this.floorDataMap.get(l);let[u,a]=await Promise.all([this.loadGraphics({brand:t,project:e,floor:r,ts:i,resource_type_list:s}),this.loadBuildingGround({brand:t,project:e})]);return this.transformGraphicData(u),u.forEach(c=>{c.info.transformToBuildingGround=!!a}),this.config.useFloorCache||this.floorDataMap.clear(),this.floorDataMap.set(l,u),u}transformGraphicData(t,e=this.buildingCenter,r=0){t.forEach(u=>{if(u.info.geometry.coords=JSON.parse(JSON.stringify(u.info.geometry.cds)),u.info.geometry.type==="polygon")u.info.geometry.coords.map(a=>{Array.isArray(a)&&a.forEach(c=>{c[0]-=e[0],c[1]-=e[1]})});else{let[a,c]=u.info.geometry.cds;u.info.geometry.coords=[a-e[0],c-e[1]]}});let{ground:i,markGraphic:s,graphic:l}=this.config;for(let u=0;u<t.length;u++){let a=t[u];a.info.deltaHeight=1e-5*(r+u+1),a.info.group==="ground"?(a.info.fillColor=i.color,a.info.fillOpacity=i.opacity,a.info.height=i.height,a.info.stroke=i.stroke,a.info.strokeColor=i.strokeColor,a.info.strokeOpacity=i.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=l.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 rt(this.context);if(!t.length)return{curFloor:e,graphics:[]};let r=new Map,i=[];for(let s of t)if(s.info.group==="ground")e.createGround(s.info);else{let l=e.addGraphic(s.info);l.userData.data=s,r.set(s.legacy_id,l),i.push(l)}return e.userData.legacyToGraphicMap=r,{curFloor:e,graphics:i}}triggerHooks(t,e){this.dispatchEvent({type:t,data:e})}switchFloor({brand:t,project:e,floor:r,ts:i,resource_type_list:s}){let l=W({brand:t,project:e,floor:r,ts:i,resource_type_list:s}),u=this.floorDataMap.get(l);if(this.context.control.removeEventListener("change",this.onControlChange),u){let a=W({brand:t,project:e});this.currentBuildGround=this.buildingGroundMap.get(a)||null;let c=this.createFloor(u);c?(c.curFloor.name=r,this.triggerHooks("switch_floor_before",c),this.context.switchFloor(c.curFloor),this.initialFloorCamera(),this.triggerHooks("switch_floor_after",c)):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")}switchFloorByData(t,e,r=e){let{curFloor:i,graphics:s}=this.createFloor(t);i.name=e,i.key=r;let l=new Map;t.forEach(u=>{l.set(u.element_uuid,u)}),i.userData.graphicMap=l,this.switchFloorByFloor(i,s)}switchFloorByFloor(t,e=t.graphicLayer.children){this.triggerHooks("switch_floor_before",{curFloor:t,graphics:e}),this.context.switchFloor(t),this.initialFloorCamera(),this.triggerHooks("switch_floor_after",{curFloor:t,graphics:e})}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.setPolarAngle(this.config.control.defaultPolar,0),this.context.fitCameraToGround(void 0,0);let t=this.context.camera.zoom;this.context.control.minZoom=t,this.context.control.maxZoom=t*25,this.type==="3d"&&this.context.fitCameraToGround(this.config.defaultPadding,0,!1),this.basicZoom=this.context.camera.zoom,this.context.control.addEventListener("change",this.onControlChange),this.onControlChange(),this.context.cameraBound.setEnable(!0),this.context.cameraBound.changePrevCamera()}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:i=0,facilityXScale:s=1,facilityYScale:l=1}=t.options.userData;r.rotateZ((180-i)/180*Math.PI),r.scale.set(s,l,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 D)||[]}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 ot(new Promise(r=>{let i=this.context.control.target.clone(),s=t.getPosition();this.timer.requestAnimationFrame(()=>{let{clientSize:{width:l,height:u},camera:a}=this.context,p=_(s,a,l,u).x-l/2,d=new he.Vector3;d.setFromMatrixColumn(this.context.camera.matrix,0),d.normalize(),d.multiplyScalar(p/this.context.camera.zoom),i.add(d),this.context.setCameraPosition(i,e).then(r)})}),e+500)}getElementDeviceCoordinate(t){let e=t.position.clone(),{clientWidth:r,clientHeight:i}=this.container;return _(e,this.context.camera,r,i)}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.context.setPolarAngle(this.config.control.defaultPolar,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,Qn.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.setAzimuthalAngle(e+t,500)}async measureDistance(){return this.cancelDistance(),new Promise((t,e)=>{this.changeMapType("2d",0),this.context.control.enableRotate=!1,this.svgLine=new Ft(this.context);let r=this.svgLine.dispose.bind(this.svgLine);this.svgLine.dispose=function(){r(),e("cancel")},this.svgLine.addEventListener("distance",({distance:i})=>{t(i)})})}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 Ut(this.context);let r=this.svgPolygon.dispose.bind(this.svgPolygon);this.svgPolygon.dispose=function(){r(),e("cancel")},this.svgPolygon.addEventListener("area",({area:i})=>{t(i)})})}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=Jt(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(i=>{i[0]-=e[0],i[1]-=e[1]})});else{let[r,i]=t.geometry.cds;t.geometry.coords=[r-e[0],i-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)||1;this.context.camera.zoom=e,this.context.control.minZoom=r,this.context.control.maxZoom=r*25,this.basicZoom=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(),Te(),Ce(),Re(),this.unRegistryEvent()}};var er=require("three"),Q=class extends er.EventDispatcher{bmap;constructor(n){super(),this.bmap=n}dispose(){}};var Ke=class extends Q{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(i=>i.json()).then(i=>i.data).then(i=>{this.equipmentList=i,this.equipmentMap=new Map(i.map(s=>[s.equipment_id,s]))}),this.dispatchEvent({type:"change-equipment-list",data:this.equipmentList}),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 Ze(o){let n=new Blob([o],{type:"text/javascript"}),t=URL.createObjectURL(n),e=new Worker(t);return URL.revokeObjectURL(t),e}function Je(){return Ze(`var B1=Object.create;var Uf=Object.defineProperty;var z1=Object.getOwnPropertyDescriptor;var k1=Object.getOwnPropertyNames,gm=Object.getOwnPropertySymbols,G1=Object.getPrototypeOf,ym=Object.prototype.hasOwnProperty,V1=Object.prototype.propertyIsEnumerable;var Ff=(r,t,e)=>t in r?Uf(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,ls=(r,t)=>{for(var e in t||(t={}))ym.call(t,e)&&Ff(r,e,t[e]);if(gm)for(var e of gm(t))V1.call(t,e)&&Ff(r,e,t[e]);return r};var Zt=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports);var H1=(r,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of k1(t))!ym.call(r,a)&&a!==e&&Uf(r,a,{get:()=>t[a],enumerable:!(o=z1(t,a))||o.enumerable});return r};var Ln=(r,t,e)=>(e=r!=null?B1(G1(r)):{},H1(t||!r||!r.__esModule?Uf(e,"default",{value:r,enumerable:!0}):e,r));var dn=(r,t,e)=>Ff(r,typeof t!="symbol"?t+"":t,e);var _m=Zt((dR,vm)=>{var Bf=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)}};vm.exports=Bf});var Mm=Zt((mR,Em)=>{function xm(r,t){let e=new Map;for(let[o,a]of r)o!==t&&a instanceof Map?e.set(o,xm(a,t)):o!==t&&e.set(o,a);return e}Em.exports=xm});var bm=Zt((gR,Sm)=>{function W1(r){let t=Number(r);return!(isNaN(t)||t<=0)}function wm(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,wm(a));if(!W1(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}Sm.exports=wm});var Cm=Zt((yR,Am)=>{function Tm(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){Tm(t);return}if(typeof t!="number"||t<=0)throw new Error(\`Values must be numbers greater than 0. Found value \${t} at \${e}\`)})}Am.exports=Tm});var kf=Zt((vR,Rm)=>{var q1=_m(),X1=Mm(),Pm=bm(),Im=Cm(),zf=class{constructor(t){t instanceof Map?(Im(t),this.graph=t):t?this.graph=Pm(t):this.graph=new Map}addNode(t,e){let o;return e instanceof Map?(Im(e),o=e):o=Pm(e),this.graph.set(t,o),this}addVertex(t,e){return this.addNode(t,e)}removeNode(t){return this.graph=X1(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 q1,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 S=l.get(M).priority,T=g.priority+y;return T<S?(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)}};Rm.exports=zf});var Mc=Zt((AR,E0)=>{"use strict";var x0=Object.getOwnPropertySymbols,Yb=Object.prototype.hasOwnProperty,$b=Object.prototype.propertyIsEnumerable;function Zb(r){if(r==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(r)}function Jb(){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}}E0.exports=Jb()?Object.assign:function(r,t){for(var e,o=Zb(r),a,l=1;l<arguments.length;l++){e=Object(arguments[l]);for(var f in e)Yb.call(e,f)&&(o[f]=e[f]);if(x0){a=x0(e);for(var h=0;h<a.length;h++)$b.call(e,a[h])&&(o[a[h]]=e[a[h]])}}return o}});var hp=Zt((cp,fp)=>{(function(r,t){typeof cp=="object"&&typeof fp!="undefined"?fp.exports=t():typeof define=="function"&&define.amd?define(t):(r=r||self).RBush=t()})(cp,function(){"use strict";function r(x,v,C,w,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,w||x.length-1,O||e)}function t(x,v,C){var w=x[v];x[v]=x[C],x[C]=w}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 w=0;w<v.length;w++)if(C(x,v[w]))return w;return-1}function l(x,v){f(x,0,x.children.length,v,x)}function f(x,v,C,w,O){O||(O=S(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?w(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 S(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,w,O){for(var F=[v,C];F.length;)if(!((C=F.pop())-(v=F.pop())<=w)){var G=v+Math.ceil((C-v)/w/2)*w;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 w=this.toBBox,O=[];v;){for(var F=0;F<v.children.length;F++){var G=v.children[F],z=v.leaf?w(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 w=0;w<v.children.length;w++){var O=v.children[w],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 w=this.data;this.data=C,C=w}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=S([]),this},o.prototype.remove=function(x,v){if(!x)return this;for(var C,w,O,F=this.data,G=this.toBBox(x),z=[],L=[];F||z.length;){if(F||(F=z.pop(),w=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)?w?(C++,F=w.children[C],O=!1):F=null:(z.push(F),L.push(C),C=0,w=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,w){var O,F=C-v+1,G=this._maxEntries;if(F<=G)return l(O=S(x.slice(v,C+1)),this.toBBox),O;w||(w=Math.ceil(Math.log(F)/Math.log(G)),G=Math.ceil(F/Math.pow(G,w-1))),(O=S([])).leaf=!1,O.height=w;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,w-1))}}return l(O,this.toBBox),O},o.prototype._chooseSubtree=function(x,v,C,w){for(;w.push(v),!v.leaf&&w.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 w=C?x:this.toBBox(x),O=[],F=this._chooseSubtree(w,this.data,v,O);for(F.children.push(x),h(F,w);v>=0&&O[v].children.length>this._maxEntries;)this._split(O,v),v--;this._adjustParentBBoxes(w,O,v)},o.prototype._split=function(x,v){var C=x[v],w=C.children.length,O=this._minEntries;this._chooseSplitAxis(C,O,w);var F=this._chooseSplitIndex(C,O,w),G=S(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=S([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 w,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,w=k,nt=vt<nt?vt:nt):it===q&&vt<nt&&(nt=vt,w=k)}return w||C-v},o.prototype._chooseSplitAxis=function(x,v,C){var w=x.leaf?this.compareMinX:p,O=x.leaf?this.compareMinY:d;this._allDistMargin(x,v,C,w)<this._allDistMargin(x,v,C,O)&&x.children.sort(w)},o.prototype._allDistMargin=function(x,v,C,w){x.children.sort(w);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 w=C;w>=0;w--)h(v[w],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 M0=Zt((pp,dp)=>{(function(r,t){typeof pp=="object"&&typeof dp!="undefined"?dp.exports=t():typeof define=="function"&&define.amd?define(t):(r=r||self,r.TinyQueue=t())})(pp,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 S0=Zt((NR,w0)=>{w0.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],S=e[o+g*2+1],T=y>f!=S>f&&l<(M-_)*(f-y)/(S-y)+_;T&&(h=!h)}return h}});var T0=Zt((OR,b0)=>{b0.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],S=e[g+o][1],T=y>f!=S>f&&l<(M-_)*(f-y)/(S-y)+_;T&&(h=!h)}return h}});var P0=Zt((DR,bc)=>{var A0=S0(),C0=T0();bc.exports=function(t,e,o,a){return e.length>0&&Array.isArray(e[0])?C0(t,e,o,a):A0(t,e,o,a)};bc.exports.nested=C0;bc.exports.flat=A0});var R0=Zt((Tc,I0)=>{(function(r,t){typeof Tc=="object"&&typeof I0!="undefined"?t(Tc):typeof define=="function"&&define.amd?define(["exports"],t):t((r=r||self).predicates={})})(Tc,function(r){"use strict";let e=33306690738754706e-32;function o(M,S,T,x,v){let C,w,O,F,G=S[0],z=x[0],L=0,D=0;z>G==z>-G?(C=G,G=S[++L]):(C=z,z=x[++D]);let q=0;if(L<M&&D<T)for(z>G==z>-G?(O=C-((w=G+C)-G),G=S[++L]):(O=C-((w=z+C)-z),z=x[++D]),C=w,O!==0&&(v[q++]=O);L<M&&D<T;)z>G==z>-G?(O=C-((w=C+G)-(F=w-C))+(G-F),G=S[++L]):(O=C-((w=C+z)-(F=w-C))+(z-F),z=x[++D]),C=w,O!==0&&(v[q++]=O);for(;L<M;)O=C-((w=C+G)-(F=w-C))+(G-F),G=S[++L],C=w,O!==0&&(v[q++]=O);for(;D<T;)O=C-((w=C+z)-(F=w-C))+(z-F),z=x[++D],C=w,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,S,T,x,v,C){let w=(S-C)*(T-v),O=(M-v)*(x-C),F=w-O;if(w===0||O===0||w>0!=O>0)return F;let G=Math.abs(w+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,Z){let I=Z[0];for(let P=1;P<W;P++)I+=Z[P];return I}(4,p),J=f*xt;if(qt>=J||-qt>=J||(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)||(J=h*xt+e*Math.abs(qt),(qt+=tt*pt+te*X-(Gt*vt+nn*it))>=J||-qt>=J))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,S,T,x,v,C,G)},r.orient2dfast=function(M,S,T,x,v,C){return(S-C)*(T-v)-(M-v)*(x-C)},Object.defineProperty(r,"__esModule",{value:!0})})});var U0=Zt((FR,vp)=>{"use strict";var L0=hp(),Cc=M0(),Qb=P0(),jb=R0().orient2d;Cc.default&&(Cc=Cc.default);vp.exports=F0;vp.exports.default=F0;function F0(r,t,e){t=Math.max(0,t===void 0?2:t),e=e||0;var o=iT(r),a=new L0(16);a.toBBox=function(C){return{minX:C[0],minY:C[1],maxX:C[0],maxY:C[1]}},a.compareMinX=function(C,w){return C[0]-w[0]},a.compareMinY=function(C,w){return C[1]-w[1]},a.load(r);for(var l=[],f=0,h;f<o.length;f++){var p=o[f];a.remove(p),h=D0(p,h),l.push(h)}var d=new L0(16);for(f=0;f<l.length;f++)d.insert(mp(l[f]));for(var g=t*t,_=e*e;l.length;){var y=l.shift(),M=y.p,S=y.next.p,T=gp(M,S);if(!(T<_)){var x=T/g;p=tT(a,y.prev.p,M,S,y.next.next.p,x,d),p&&Math.min(gp(p,M),gp(p,S))<=x&&(l.push(y),l.push(D0(p,y)),a.remove(p),d.remove(y),d.insert(mp(y)),d.insert(mp(y.next)))}}y=h;var v=[];do v.push(y.p),y=y.next;while(y!==h);return v.push(y.p),v}function tT(r,t,e,o,a,l,f){for(var h=new Cc([],eT),p=r.data;p;){for(var d=0;d<p.children.length;d++){var g=p.children[d],_=p.leaf?yp(g,e,o):nT(e,o,g);_>l||h.push({node:g,dist:_})}for(;h.length&&!h.peek().node.children;){var y=h.pop(),M=y.node,S=yp(M,t,e),T=yp(M,o,a);if(y.dist<S&&y.dist<T&&O0(e,M,f)&&O0(o,M,f))return M}p=h.pop(),p&&(p=p.node)}return null}function eT(r,t){return r.dist-t.dist}function nT(r,t,e){if(N0(r,e)||N0(t,e))return 0;var o=Ac(r[0],r[1],t[0],t[1],e.minX,e.minY,e.maxX,e.minY);if(o===0)return 0;var a=Ac(r[0],r[1],t[0],t[1],e.minX,e.minY,e.minX,e.maxY);if(a===0)return 0;var l=Ac(r[0],r[1],t[0],t[1],e.maxX,e.minY,e.maxX,e.maxY);if(l===0)return 0;var f=Ac(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 N0(r,t){return r[0]>=t.minX&&r[0]<=t.maxX&&r[1]>=t.minY&&r[1]<=t.maxY}function O0(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(rT(h[p].p,h[p].next.p,r,t))return!1;return!0}function Qa(r,t,e){return jb(r[0],r[1],t[0],t[1],e[0],e[1])}function rT(r,t,e,o){return r!==o&&t!==e&&Qa(r,t,e)>0!=Qa(r,t,o)>0&&Qa(e,o,r)>0!=Qa(e,o,t)>0}function mp(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 iT(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++)Qb(r[l],h)||p.push(r[l]);return sT(p)}function D0(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 gp(r,t){var e=r[0]-t[0],o=r[1]-t[1];return e*e+o*o}function yp(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 Ac(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,S=p*p+d*d,T=p*g+d*_,x=g*g+_*_,v=p*y+d*M,C=g*y+_*M,w=S*x-T*T,O,F,G,z,L=w,D=w;w===0?(F=0,L=1,z=C,D=x):(F=T*C-x*v,z=S*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>S?F=L:(F=-v,L=S)):z>D&&(z=D,-v+T<0?F=0:-v+T>S?F=L:(F=-v+T,L=S)),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 oT(r,t){return r[0]===t[0]?r[1]-t[1]:r[0]-t[0]}function sT(r){r.sort(oT);for(var t=[],e=0;e<r.length;e++){for(;t.length>=2&&Qa(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&&Qa(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 H0=Zt((xp,Ep)=>{(function(r,t){typeof xp=="object"&&typeof Ep!="undefined"?Ep.exports=t():typeof define=="function"&&define.amd?define(t):r.quickselect=t()})(xp,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),S=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,S,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 bp=Zt((u2,Sp)=>{"use strict";Sp.exports=$u;Sp.exports.default=$u;var _T=H0();function $u(r,t){if(!(this instanceof $u))return new $u(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()}$u.prototype={all:function(){return this._all(this.data,[])},search:function(r){var t=this.data,e=[],o=this.toBBox;if(!Ic(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,Ic(r,p)&&(t.leaf?e.push(h):wp(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(!Ic(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,Ic(r,h)){if(t.leaf||wp(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=eu([]),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=xT(r,e.children,t),p!==-1))return e.children.splice(p,1),a.push(e),this._condense(a),this;!d&&!e.leaf&&wp(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:W0,compareMinY:q0,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=eu(r.slice(t,e+1)),tu(f,this.toBBox),f;o||(o=Math.ceil(Math.log(a)/Math.log(l)),l=Math.ceil(a/Math.pow(l,o-1))),f=eu([]),f.leaf=!1,f.height=o;var h=Math.ceil(a/l),p=h*Math.ceil(Math.sqrt(l)),d,g,_,y;for(X0(r,t,e,p,this.compareMinX),d=t;d<=e;d+=p)for(_=Math.min(d+p-1,e),X0(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 tu(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=Mp(f),d=ET(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),Yu(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=eu(e.children.splice(l,e.children.length-l));f.height=e.height,f.leaf=e.leaf,tu(e,this.toBBox),tu(f,this.toBBox),t?r[t-1].children.push(f):this._splitRoot(e,f)},_splitRoot:function(r,t){this.data=eu([r,t]),this.data.height=r.height+1,this.data.leaf=!1,tu(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=Xu(r,0,o,this.toBBox),l=Xu(r,o,e,this.toBBox),f=MT(a,l),h=Mp(a)+Mp(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:W0,a=r.leaf?this.compareMinY:q0,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=Xu(r,0,t,a),f=Xu(r,e-t,e,a),h=Pc(l)+Pc(f),p,d;for(p=t;p<e-t;p++)d=r.children[p],Yu(l,r.leaf?a(d):d),h+=Pc(l);for(p=e-t-1;p>=t;p--)d=r.children[p],Yu(f,r.leaf?a(d):d),h+=Pc(f);return h},_adjustParentBBoxes:function(r,t,e){for(var o=e;o>=0;o--)Yu(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():tu(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 xT(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 tu(r,t){Xu(r,0,r.children.length,t,r)}function Xu(r,t,e,o,a){a||(a=eu(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],Yu(a,r.leaf?o(f):f);return a}function Yu(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 W0(r,t){return r.minX-t.minX}function q0(r,t){return r.minY-t.minY}function Mp(r){return(r.maxX-r.minX)*(r.maxY-r.minY)}function Pc(r){return r.maxX-r.minX+(r.maxY-r.minY)}function ET(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 MT(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 wp(r,t){return r.minX<=t.minX&&r.minY<=t.minY&&t.maxX<=r.maxX&&t.maxY<=r.maxY}function Ic(r,t){return t.minX<=r.maxX&&t.minY<=r.maxY&&t.maxX>=r.minX&&t.maxY>=r.minY}function eu(r){return{children:r,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function X0(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,_T(r,f,t,e,a),l.push(t,f,f,e))}});var Q0=Zt((EO,Rp)=>{"use strict";Rp.exports=Oc;Rp.exports.default=Oc;function Oc(r,t,e){e=e||2;var o=t&&t.length,a=o?t[0]*e:r.length,l=Z0(r,0,a,e,!0),f=[];if(!l||l.next===l.prev)return f;var h,p,d,g,_,y,M;if(o&&(l=LT(r,t,l,e)),r.length>80*e){h=d=r[0],p=g=r[1];for(var S=e;S<a;S+=e)_=r[S],y=r[S+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 Ku(l,f,e,h,p,M,0),f}function Z0(r,t,e,o,a){var l,f;if(a===Ip(r,t,e,o)>0)for(l=t;l<e;l+=o)f=$0(l,r[l],r[l+1],f);else for(l=e-o;l>=t;l-=o)f=$0(l,r[l],r[l+1],f);return f&&Dc(f,f.next)&&(ju(f),f=f.next),f}function ea(r,t){if(!r)return r;t||(t=r);var e=r,o;do if(o=!1,!e.steiner&&(Dc(e,e.next)||Bn(e.prev,e,e.next)===0)){if(ju(e),e=t=e.prev,e===e.next)break;o=!0}else e=e.next;while(o||e!==t);return t}function Ku(r,t,e,o,a,l,f){if(r){!f&&l&&UT(r,o,a,l);for(var h=r,p,d;r.prev!==r.next;){if(p=r.prev,d=r.next,l?PT(r,o,a,l):CT(r)){t.push(p.i/e|0),t.push(r.i/e|0),t.push(d.i/e|0),ju(r),r=d.next,h=d.next;continue}if(r=d,r===h){f?f===1?(r=IT(ea(r),t,e),Ku(r,t,e,o,a,l,2)):f===2&&RT(r,t,e,o,a,l):Ku(ea(r),t,e,o,a,l,1);break}}}}function CT(r){var t=r.prev,e=r,o=r.next;if(Bn(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,S=o.next;S!==t;){if(S.x>=g&&S.x<=y&&S.y>=_&&S.y<=M&&iu(a,h,l,p,f,d,S.x,S.y)&&Bn(S.prev,S,S.next)>=0)return!1;S=S.next}return!0}function PT(r,t,e,o){var a=r.prev,l=r,f=r.next;if(Bn(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,S=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=Cp(M,S,t,e,o),C=Cp(T,x,t,e,o),w=r.prevZ,O=r.nextZ;w&&w.z>=v&&O&&O.z<=C;){if(w.x>=M&&w.x<=T&&w.y>=S&&w.y<=x&&w!==a&&w!==f&&iu(h,g,p,_,d,y,w.x,w.y)&&Bn(w.prev,w,w.next)>=0||(w=w.prevZ,O.x>=M&&O.x<=T&&O.y>=S&&O.y<=x&&O!==a&&O!==f&&iu(h,g,p,_,d,y,O.x,O.y)&&Bn(O.prev,O,O.next)>=0))return!1;O=O.nextZ}for(;w&&w.z>=v;){if(w.x>=M&&w.x<=T&&w.y>=S&&w.y<=x&&w!==a&&w!==f&&iu(h,g,p,_,d,y,w.x,w.y)&&Bn(w.prev,w,w.next)>=0)return!1;w=w.prevZ}for(;O&&O.z<=C;){if(O.x>=M&&O.x<=T&&O.y>=S&&O.y<=x&&O!==a&&O!==f&&iu(h,g,p,_,d,y,O.x,O.y)&&Bn(O.prev,O,O.next)>=0)return!1;O=O.nextZ}return!0}function IT(r,t,e){var o=r;do{var a=o.prev,l=o.next.next;!Dc(a,l)&&J0(a,o,o.next,l)&&Qu(a,l)&&Qu(l,a)&&(t.push(a.i/e|0),t.push(o.i/e|0),t.push(l.i/e|0),ju(o),ju(o.next),o=r=l),o=o.next}while(o!==r);return ea(o)}function RT(r,t,e,o,a,l){var f=r;do{for(var h=f.next.next;h!==f.prev;){if(f.i!==h.i&&kT(f,h)){var p=K0(f,h);f=ea(f,f.next),p=ea(p,p.next),Ku(f,t,e,o,a,l,0),Ku(p,t,e,o,a,l,0);return}h=h.next}f=f.next}while(f!==r)}function LT(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=Z0(r,h,p,o,!1),d===d.next&&(d.steiner=!0),a.push(zT(d));for(a.sort(NT),l=0;l<a.length;l++)e=OT(a[l],e);return e}function NT(r,t){return r.x-t.x}function OT(r,t){var e=DT(r,t);if(!e)return t;var o=K0(e,r);return ea(o,o.next),ea(e,e.next)}function DT(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&&iu(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),Qu(e,r)&&(y<_||y===_&&(e.x>f.x||e.x===f.x&&FT(f,e)))&&(f=e,_=y)),e=e.next;while(e!==p);return f}function FT(r,t){return Bn(r.prev,r,t.prev)<0&&Bn(t.next,r,r.next)<0}function UT(r,t,e,o){var a=r;do a.z===0&&(a.z=Cp(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,BT(a)}function BT(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 Cp(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 zT(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 iu(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 kT(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!GT(r,t)&&(Qu(r,t)&&Qu(t,r)&&VT(r,t)&&(Bn(r.prev,r,t.prev)||Bn(r,t.prev,t))||Dc(r,t)&&Bn(r.prev,r,r.next)>0&&Bn(t.prev,t,t.next)>0)}function Bn(r,t,e){return(t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y)}function Dc(r,t){return r.x===t.x&&r.y===t.y}function J0(r,t,e,o){var a=Nc(Bn(r,t,e)),l=Nc(Bn(r,t,o)),f=Nc(Bn(e,o,r)),h=Nc(Bn(e,o,t));return!!(a!==l&&f!==h||a===0&&Lc(r,e,t)||l===0&&Lc(r,o,t)||f===0&&Lc(e,r,o)||h===0&&Lc(e,t,o))}function Lc(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 Nc(r){return r>0?1:r<0?-1:0}function GT(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&&J0(e,e.next,r,t))return!0;e=e.next}while(e!==r);return!1}function Qu(r,t){return Bn(r.prev,r,r.next)<0?Bn(r,t,r.next)>=0&&Bn(r,r.prev,t)>=0:Bn(r,t,r.prev)<0||Bn(r,r.next,t)<0}function VT(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 K0(r,t){var e=new Pp(r.i,r.x,r.y),o=new Pp(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 $0(r,t,e,o){var a=new Pp(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 ju(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 Pp(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}Oc.deviation=function(r,t,e,o){var a=t&&t.length,l=a?t[0]*e:r.length,f=Math.abs(Ip(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(Ip(r,d,g,e))}var _=0;for(h=0;h<o.length;h+=3){var y=o[h]*e,M=o[h+1]*e,S=o[h+2]*e;_+=Math.abs((r[y]-r[S])*(r[M+1]-r[y+1])-(r[y]-r[M])*(r[S+1]-r[y+1]))}return f===0&&_===0?0:Math.abs((_-f)/f)};function Ip(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}Oc.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 Fp=Zt(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 Ss(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=Ss;function WT(r,t,e){switch(e===void 0&&(e={}),r){case"Point":return Lp(t).geometry;case"LineString":return Op(t).geometry;case"Polygon":return Np(t).geometry;case"MultiPoint":return ty(t).geometry;case"MultiLineString":return j0(t).geometry;case"MultiPolygon":return ey(t).geometry;default:throw new Error(r+" is invalid")}}ue.geometry=WT;function Lp(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(!Fc(r[0])||!Fc(r[1]))throw new Error("coordinates must contain numbers");var o={type:"Point",coordinates:r};return Ss(o,t,e)}ue.point=Lp;function qT(r,t,e){return e===void 0&&(e={}),Uc(r.map(function(o){return Lp(o,t)}),e)}ue.points=qT;function Np(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 Ss(h,t,e)}ue.polygon=Np;function XT(r,t,e){return e===void 0&&(e={}),Uc(r.map(function(o){return Np(o,t)}),e)}ue.polygons=XT;function Op(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 Ss(o,t,e)}ue.lineString=Op;function YT(r,t,e){return e===void 0&&(e={}),Uc(r.map(function(o){return Op(o,t)}),e)}ue.lineStrings=YT;function Uc(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=Uc;function j0(r,t,e){e===void 0&&(e={});var o={type:"MultiLineString",coordinates:r};return Ss(o,t,e)}ue.multiLineString=j0;function ty(r,t,e){e===void 0&&(e={});var o={type:"MultiPoint",coordinates:r};return Ss(o,t,e)}ue.multiPoint=ty;function ey(r,t,e){e===void 0&&(e={});var o={type:"MultiPolygon",coordinates:r};return Ss(o,t,e)}ue.multiPolygon=ey;function $T(r,t,e){e===void 0&&(e={});var o={type:"GeometryCollection",geometries:r};return Ss(o,t,e)}ue.geometryCollection=$T;function ZT(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=ZT;function ny(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=ny;function Dp(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=Dp;function JT(r,t){return ry(Dp(r,t))}ue.lengthToDegrees=JT;function KT(r){var t=r%360;return t<0&&(t+=360),t}ue.bearingToAzimuth=KT;function ry(r){var t=r%(2*Math.PI);return t*180/Math.PI}ue.radiansToDegrees=ry;function QT(r){var t=r%360;return t*Math.PI/180}ue.degreesToRadians=QT;function jT(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 ny(Dp(r,t),e)}ue.convertLength=jT;function tA(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=tA;function Fc(r){return!isNaN(r)&&r!==null&&!Array.isArray(r)}ue.isNumber=Fc;function eA(r){return!!r&&r.constructor===Object}ue.isObject=eA;function nA(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(!Fc(t))throw new Error("bbox must only contain numbers")})}ue.validateBBox=nA;function rA(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=rA});var Bp=Zt(or=>{"use strict";Object.defineProperty(or,"__esModule",{value:!0});var Vr=Fp();function tl(r,t,e){if(r!==null)for(var o,a,l,f,h,p,d,g=0,_=0,y,M=r.type,S=M==="FeatureCollection",T=M==="Feature",x=S?r.features.length:1,v=0;v<x;v++){d=S?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 w=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,w,O)===!1)return!1;_++,w++;break;case"LineString":case"MultiPoint":for(o=0;o<p.length;o++){if(t(p[o],_,v,w,O)===!1)return!1;_++,F==="MultiPoint"&&w++}F==="LineString"&&w++;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,w,O)===!1)return!1;_++}F==="MultiLineString"&&w++,F==="Polygon"&&O++}F==="Polygon"&&w++;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,w,O)===!1)return!1;_++}O++}w++}break;case"GeometryCollection":for(o=0;o<f.geometries.length;o++)if(tl(f.geometries[o],t,e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function iA(r,t,e,o){var a=e;return tl(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 iy(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 oA(r,t,e){var o=e;return iy(r,function(a,l){l===0&&e===void 0?o=a:o=t(o,a,l)}),o}function oy(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 sA(r,t,e){var o=e;return oy(r,function(a,l){l===0&&e===void 0?o=a:o=t(o,a,l)}),o}function aA(r){var t=[];return tl(r,function(e){t.push(e)}),t}function Up(r,t){var e,o,a,l,f,h,p,d,g,_,y=0,M=r.type==="FeatureCollection",S=r.type==="Feature",T=M?r.features.length:1;for(e=0;e<T;e++){for(h=M?r.features[e].geometry:S?r.geometry:r,d=M?r.features[e].properties:S?r.properties:{},g=M?r.features[e].bbox:S?r.bbox:void 0,_=M?r.features[e].id:S?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 uA(r,t,e){var o=e;return Up(r,function(a,l,f,h,p){l===0&&e===void 0?o=a:o=t(o,a,l,f,h,p)}),o}function Bc(r,t){Up(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(Vr.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(Vr.feature(_,a),o,d)===!1)return!1}})}function lA(r,t,e){var o=e;return Bc(r,function(a,l,f){l===0&&f===0&&e===void 0?o=a:o=t(o,a,l,f)}),o}function sy(r,t){Bc(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(tl(e,function(_,y,M,S,T){if(h===void 0||o>p||S>d||T>g){h=_,p=o,d=S,g=T,l=0;return}var x=Vr.lineString([h,_],e.properties);if(t(x,o,a,T,l)===!1)return!1;l++,h=_})===!1)return!1}}})}function cA(r,t,e){var o=e,a=!1;return sy(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 ay(r,t){if(!r)throw new Error("geojson is required");Bc(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(Vr.lineString(f[h],e.properties),o,a,h)===!1)return!1;break}}})}function fA(r,t,e){var o=e;return ay(r,function(a,l,f,h){l===0&&e===void 0?o=a:o=t(o,a,l,f,h)}),o}function hA(r,t){if(t=t||{},!Vr.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),Vr.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),Vr.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),Vr.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),Vr.lineString([p[o][a][l],p[o][a][l+1]],f,t)}throw new Error("geojson is invalid")}function pA(r,t){if(t=t||{},!Vr.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 Vr.point(p,f,t);case"MultiPoint":return o<0&&(o=p.length+o),Vr.point(p[o],f,t);case"LineString":return l<0&&(l=p.length+l),Vr.point(p[l],f,t);case"Polygon":return a<0&&(a=p.length+a),l<0&&(l=p[a].length+l),Vr.point(p[a][l],f,t);case"MultiLineString":return o<0&&(o=p.length+o),l<0&&(l=p[o].length+l),Vr.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),Vr.point(p[o][a][l],f,t)}throw new Error("geojson is invalid")}or.coordAll=aA;or.coordEach=tl;or.coordReduce=iA;or.featureEach=oy;or.featureReduce=sA;or.findPoint=pA;or.findSegment=hA;or.flattenEach=Bc;or.flattenReduce=lA;or.geomEach=Up;or.geomReduce=uA;or.lineEach=ay;or.lineReduce=fA;or.propEach=iy;or.propReduce=oA;or.segmentEach=sy;or.segmentReduce=cA});var uy=Zt(kp=>{"use strict";Object.defineProperty(kp,"__esModule",{value:!0});var dA=Bp();function zp(r){var t=[1/0,1/0,-1/0,-1/0];return dA.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}zp.default=zp;kp.default=zp});var zc=Zt((UO,Gp)=>{var _o=hp(),cy=Fp(),fy=Bp(),ou=uy().default,mA=fy.featureEach,DO=fy.coordEach,FO=cy.polygon,ly=cy.featureCollection;function hy(r){var t=new _o(r);return t.insert=function(e){if(e.type!=="Feature")throw new Error("invalid feature");return e.bbox=e.bbox?e.bbox:ou(e),_o.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:ou(a),o.push(a)}):mA(e,function(a){if(a.type!=="Feature")throw new Error("invalid features");a.bbox=a.bbox?a.bbox:ou(a),o.push(a)}),_o.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:ou(e),_o.prototype.remove.call(this,e,o)},t.clear=function(){return _o.prototype.clear.call(this)},t.search=function(e){var o=_o.prototype.search.call(this,this.toBBox(e));return ly(o)},t.collides=function(e){return _o.prototype.collides.call(this,this.toBBox(e))},t.all=function(){var e=_o.prototype.all.call(this);return ly(e)},t.toJSON=function(){return _o.prototype.toJSON.call(this)},t.fromJSON=function(e){return _o.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=ou(e);else if(e.type==="FeatureCollection")o=ou(e);else throw new Error("invalid geojson");return{minX:o[0],minY:o[1],maxX:o[2],maxY:o[3]}},t}Gp.exports=hy;Gp.exports.default=hy});var Yp=Zt((X3,My)=>{"use strict";var Ey=Object.prototype.toString;My.exports=function(t){var e=Ey.call(t),o=e==="[object Arguments]";return o||(o=e!=="[object Array]"&&t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&Ey.call(t.callee)==="[object Function]"),o}});var Ry=Zt((Y3,Iy)=>{"use strict";var Py;Object.keys||(rl=Object.prototype.hasOwnProperty,$p=Object.prototype.toString,wy=Yp(),Zp=Object.prototype.propertyIsEnumerable,Sy=!Zp.call({toString:null},"toString"),by=Zp.call(function(){},"prototype"),il=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],Wc=function(r){var t=r.constructor;return t&&t.prototype===r},Ty={$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},Ay=function(){if(typeof window=="undefined")return!1;for(var r in window)try{if(!Ty["$"+r]&&rl.call(window,r)&&window[r]!==null&&typeof window[r]=="object")try{Wc(window[r])}catch(t){return!0}}catch(t){return!0}return!1}(),Cy=function(r){if(typeof window=="undefined"||!Ay)return Wc(r);try{return Wc(r)}catch(t){return!1}},Py=function(t){var e=t!==null&&typeof t=="object",o=$p.call(t)==="[object Function]",a=wy(t),l=e&&$p.call(t)==="[object String]",f=[];if(!e&&!o&&!a)throw new TypeError("Object.keys called on a non-object");var h=by&&o;if(l&&t.length>0&&!rl.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")&&rl.call(t,g)&&f.push(String(g));if(Sy)for(var _=Cy(t),y=0;y<il.length;++y)!(_&&il[y]==="constructor")&&rl.call(t,il[y])&&f.push(il[y]);return f});var rl,$p,wy,Zp,Sy,by,il,Wc,Ty,Ay,Cy;Iy.exports=Py});var Jp=Zt(($3,Oy)=>{"use strict";var bA=Array.prototype.slice,TA=Yp(),Ly=Object.keys,qc=Ly?function(t){return Ly(t)}:Ry(),Ny=Object.keys;qc.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 TA(o)?Ny(bA.call(o)):Ny(o)})}else Object.keys=qc;return Object.keys||qc};Oy.exports=qc});var Kp=Zt((Z3,Dy)=>{"use strict";Dy.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 Xc=Zt((J3,Fy)=>{"use strict";var AA=Kp();Fy.exports=function(){return AA()&&!!Symbol.toStringTag}});var zy=Zt((K3,By)=>{"use strict";var Uy=typeof Symbol!="undefined"&&Symbol,CA=Kp();By.exports=function(){return typeof Uy!="function"||typeof Symbol!="function"||typeof Uy("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:CA()}});var Vy=Zt((Q3,Gy)=>{"use strict";var ky={foo:{}},PA=Object;Gy.exports=function(){return{__proto__:ky}.foo===ky.foo&&!({__proto__:null}instanceof PA)}});var qy=Zt((j3,Wy)=>{"use strict";var IA="Function.prototype.bind called on incompatible ",RA=Object.prototype.toString,LA=Math.max,NA="[object Function]",Hy=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},OA=function(t,e){for(var o=[],a=e||0,l=0;a<t.length;a+=1,l+=1)o[l]=t[a];return o},DA=function(r,t){for(var e="",o=0;o<r.length;o+=1)e+=r[o],o+1<r.length&&(e+=t);return e};Wy.exports=function(t){var e=this;if(typeof e!="function"||RA.apply(e)!==NA)throw new TypeError(IA+e);for(var o=OA(arguments,1),a,l=function(){if(this instanceof a){var g=e.apply(this,Hy(o,arguments));return Object(g)===g?g:this}return e.apply(t,Hy(o,arguments))},f=LA(0,e.length-o.length),h=[],p=0;p<f;p++)h[p]="$"+p;if(a=Function("binder","return function ("+DA(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 Yc=Zt((tF,Xy)=>{"use strict";var FA=qy();Xy.exports=Function.prototype.bind||FA});var $y=Zt((eF,Yy)=>{"use strict";var UA=Function.prototype.call,BA=Object.prototype.hasOwnProperty,zA=Yc();Yy.exports=zA.call(UA,BA)});var ia=Zt((nF,jy)=>{"use strict";var tn,lu=SyntaxError,Qy=Function,uu=TypeError,Qp=function(r){try{return Qy('"use strict"; return ('+r+").constructor;")()}catch(t){}},na=Object.getOwnPropertyDescriptor;if(na)try{na({},"")}catch(r){na=null}var jp=function(){throw new uu},kA=na?function(){try{return arguments.callee,jp}catch(r){try{return na(arguments,"callee").get}catch(t){return jp}}}():jp,su=zy()(),GA=Vy()(),_r=Object.getPrototypeOf||(GA?function(r){return r.__proto__}:null),au={},VA=typeof Uint8Array=="undefined"||!_r?tn:_r(Uint8Array),ra={"%AggregateError%":typeof AggregateError=="undefined"?tn:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer=="undefined"?tn:ArrayBuffer,"%ArrayIteratorPrototype%":su&&_r?_r([][Symbol.iterator]()):tn,"%AsyncFromSyncIteratorPrototype%":tn,"%AsyncFunction%":au,"%AsyncGenerator%":au,"%AsyncGeneratorFunction%":au,"%AsyncIteratorPrototype%":au,"%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%":Qy,"%GeneratorFunction%":au,"%Int8Array%":typeof Int8Array=="undefined"?tn:Int8Array,"%Int16Array%":typeof Int16Array=="undefined"?tn:Int16Array,"%Int32Array%":typeof Int32Array=="undefined"?tn:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":su&&_r?_r(_r([][Symbol.iterator]())):tn,"%JSON%":typeof JSON=="object"?JSON:tn,"%Map%":typeof Map=="undefined"?tn:Map,"%MapIteratorPrototype%":typeof Map=="undefined"||!su||!_r?tn:_r(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"||!su||!_r?tn:_r(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer=="undefined"?tn:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":su&&_r?_r(""[Symbol.iterator]()):tn,"%Symbol%":su?Symbol:tn,"%SyntaxError%":lu,"%ThrowTypeError%":kA,"%TypedArray%":VA,"%TypeError%":uu,"%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(_r)try{null.error}catch(r){Zy=_r(_r(r)),ra["%Error.prototype%"]=Zy}var Zy,HA=function r(t){var e;if(t==="%AsyncFunction%")e=Qp("async function () {}");else if(t==="%GeneratorFunction%")e=Qp("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=Qp("async function* () {}");else if(t==="%AsyncGenerator%"){var o=r("%AsyncGeneratorFunction%");o&&(e=o.prototype)}else if(t==="%AsyncIteratorPrototype%"){var a=r("%AsyncGenerator%");a&&_r&&(e=_r(a.prototype))}return ra[t]=e,e},Jy={"%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"]},ol=Yc(),$c=$y(),WA=ol.call(Function.call,Array.prototype.concat),qA=ol.call(Function.apply,Array.prototype.splice),Ky=ol.call(Function.call,String.prototype.replace),Zc=ol.call(Function.call,String.prototype.slice),XA=ol.call(Function.call,RegExp.prototype.exec),YA=/[^%.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|(["'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|%$))/g,$A=/\\\\(\\\\)?/g,ZA=function(t){var e=Zc(t,0,1),o=Zc(t,-1);if(e==="%"&&o!=="%")throw new lu("invalid intrinsic syntax, expected closing \`%\`");if(o==="%"&&e!=="%")throw new lu("invalid intrinsic syntax, expected opening \`%\`");var a=[];return Ky(t,YA,function(l,f,h,p){a[a.length]=h?Ky(p,$A,"$1"):f||l}),a},JA=function(t,e){var o=t,a;if($c(Jy,o)&&(a=Jy[o],o="%"+a[0]+"%"),$c(ra,o)){var l=ra[o];if(l===au&&(l=HA(o)),typeof l=="undefined"&&!e)throw new uu("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:a,name:o,value:l}}throw new lu("intrinsic "+t+" does not exist!")};jy.exports=function(t,e){if(typeof t!="string"||t.length===0)throw new uu("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new uu('"allowMissing" argument must be a boolean');if(XA(/^%?[^%]*%?$/,t)===null)throw new lu("\`%\` may not be present anywhere but at the beginning and end of the intrinsic name");var o=ZA(t),a=o.length>0?o[0]:"",l=JA("%"+a+"%",e),f=l.name,h=l.value,p=!1,d=l.alias;d&&(a=d[0],qA(o,WA([0,1],d)));for(var g=1,_=!0;g<o.length;g+=1){var y=o[g],M=Zc(y,0,1),S=Zc(y,-1);if((M==='"'||M==="'"||M==="\`"||S==='"'||S==="'"||S==="\`")&&M!==S)throw new lu("property names with quotes must have matching quotes");if((y==="constructor"||!_)&&(p=!0),a+="."+y,f="%"+a+"%",$c(ra,f))h=ra[f];else if(h!=null){if(!(y in h)){if(!e)throw new uu("base intrinsic for "+t+" exists, but the property is not available.");return}if(na&&g+1>=o.length){var T=na(h,y);_=!!T,_&&"get"in T&&!("originalValue"in T.get)?h=T.get:h=h[y]}else _=$c(h,y),h=h[y];_&&!p&&(ra[f]=h)}}return h}});var sl=Zt((rF,tv)=>{"use strict";var KA=ia(),td=KA("%Object.defineProperty%",!0),ed=function(){if(td)try{return td({},"a",{value:1}),!0}catch(t){return!1}return!1};ed.hasArrayLengthDefineBug=function(){if(!ed())return null;try{return td([],"length",{value:1}).length!==1}catch(t){return!0}};tv.exports=ed});var nd=Zt((iF,ev)=>{"use strict";var QA=ia(),Jc=QA("%Object.getOwnPropertyDescriptor%",!0);if(Jc)try{Jc([],"length")}catch(r){Jc=null}ev.exports=Jc});var Kc=Zt((oF,rv)=>{"use strict";var jA=sl()(),rd=ia(),al=jA&&rd("%Object.defineProperty%",!0);if(al)try{al({},"a",{value:1})}catch(r){al=!1}var tC=rd("%SyntaxError%"),cu=rd("%TypeError%"),nv=nd();rv.exports=function(t,e,o){if(!t||typeof t!="object"&&typeof t!="function")throw new cu("\`obj\` must be an object or a function\`");if(typeof e!="string"&&typeof e!="symbol")throw new cu("\`property\` must be a string or a symbol\`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new cu("\`nonEnumerable\`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new cu("\`nonWritable\`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new cu("\`nonConfigurable\`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new cu("\`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=!!nv&&nv(t,e);if(al)al(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 tC("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var lv=Zt((sF,uv)=>{"use strict";var av=ia(),iv=Kc(),eC=sl()(),ov=nd(),sv=av("%TypeError%"),nC=av("%Math.floor%");uv.exports=function(t,e){if(typeof t!="function")throw new sv("\`fn\` is not a function");if(typeof e!="number"||e<0||e>4294967295||nC(e)!==e)throw new sv("\`length\` must be a positive 32-bit integer");var o=arguments.length>2&&!!arguments[2],a=!0,l=!0;if("length"in t&&ov){var f=ov(t,"length");f&&!f.configurable&&(a=!1),f&&!f.writable&&(l=!1)}return(a||l||!o)&&(eC?iv(t,"length",e,!0,!0):iv(t,"length",e)),t}});var jc=Zt((aF,Qc)=>{"use strict";var id=Yc(),fu=ia(),rC=lv(),iC=fu("%TypeError%"),fv=fu("%Function.prototype.apply%"),hv=fu("%Function.prototype.call%"),pv=fu("%Reflect.apply%",!0)||id.call(hv,fv),ul=fu("%Object.defineProperty%",!0),oC=fu("%Math.max%");if(ul)try{ul({},"a",{value:1})}catch(r){ul=null}Qc.exports=function(t){if(typeof t!="function")throw new iC("a function is required");var e=pv(id,hv,arguments);return rC(e,1+oC(0,t.length-(arguments.length-1)),!0)};var cv=function(){return pv(id,fv,arguments)};ul?ul(Qc.exports,"apply",{value:cv}):Qc.exports.apply=cv});var od=Zt((uF,gv)=>{"use strict";var dv=ia(),mv=jc(),sC=mv(dv("String.prototype.indexOf"));gv.exports=function(t,e){var o=dv(t,!!e);return typeof o=="function"&&sC(t,".prototype.")>-1?mv(o):o}});var _v=Zt((lF,vv)=>{"use strict";var aC=Xc()(),uC=od(),sd=uC("Object.prototype.toString"),tf=function(t){return aC&&t&&typeof t=="object"&&Symbol.toStringTag in t?!1:sd(t)==="[object Arguments]"},yv=function(t){return tf(t)?!0:t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&sd(t)!=="[object Array]"&&sd(t.callee)==="[object Function]"},lC=function(){return tf(arguments)}();tf.isLegacyArguments=yv;vv.exports=lC?tf:yv});var hu=Zt((cF,wv)=>{"use strict";var cC=Jp(),fC=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",hC=Object.prototype.toString,pC=Array.prototype.concat,xv=Kc(),dC=function(r){return typeof r=="function"&&hC.call(r)==="[object Function]"},Ev=sl()(),mC=function(r,t,e,o){if(t in r){if(o===!0){if(r[t]===e)return}else if(!dC(o)||!o())return}Ev?xv(r,t,e,!0):xv(r,t,e)},Mv=function(r,t){var e=arguments.length>2?arguments[2]:{},o=cC(t);fC&&(o=pC.call(o,Object.getOwnPropertySymbols(t)));for(var a=0;a<o.length;a+=1)mC(r,o[a],t[o[a]],e[o[a]])};Mv.supportsDescriptors=!!Ev;wv.exports=Mv});var ad=Zt((fF,bv)=>{"use strict";var Sv=function(r){return r!==r};bv.exports=function(t,e){return t===0&&e===0?1/t===1/e:!!(t===e||Sv(t)&&Sv(e))}});var ud=Zt((hF,Tv)=>{"use strict";var gC=ad();Tv.exports=function(){return typeof Object.is=="function"?Object.is:gC}});var Cv=Zt((pF,Av)=>{"use strict";var yC=ud(),vC=hu();Av.exports=function(){var t=yC();return vC(Object,{is:t},{is:function(){return Object.is!==t}}),t}});var Lv=Zt((dF,Rv)=>{"use strict";var _C=hu(),xC=jc(),EC=ad(),Pv=ud(),MC=Cv(),Iv=xC(Pv(),Object);_C(Iv,{getPolyfill:Pv,implementation:EC,shim:MC});Rv.exports=Iv});var Uv=Zt((mF,Fv)=>{"use strict";var ld=od(),Nv=Xc()(),Ov,Dv,cd,fd;Nv&&(Ov=ld("Object.prototype.hasOwnProperty"),Dv=ld("RegExp.prototype.exec"),cd={},ef=function(){throw cd},fd={toString:ef,valueOf:ef},typeof Symbol.toPrimitive=="symbol"&&(fd[Symbol.toPrimitive]=ef));var ef,wC=ld("Object.prototype.toString"),SC=Object.getOwnPropertyDescriptor,bC="[object RegExp]";Fv.exports=Nv?function(t){if(!t||typeof t!="object")return!1;var e=SC(t,"lastIndex"),o=e&&Ov(e,"value");if(!o)return!1;try{Dv(t,fd)}catch(a){return a===cd}}:function(t){return!t||typeof t!="object"&&typeof t!="function"?!1:wC(t)===bC}});var zv=Zt((gF,Bv)=>{"use strict";var cl=function(){return typeof function(){}.name=="string"},ll=Object.getOwnPropertyDescriptor;if(ll)try{ll([],"length")}catch(r){ll=null}cl.functionsHaveConfigurableNames=function(){if(!cl()||!ll)return!1;var t=ll(function(){},"name");return!!t&&!!t.configurable};var TC=Function.prototype.bind;cl.boundFunctionsHaveNames=function(){return cl()&&typeof TC=="function"&&function(){}.bind().name!==""};Bv.exports=cl});var Vv=Zt((yF,Gv)=>{"use strict";var kv=Kc(),AC=sl()(),CC=zv().functionsHaveConfigurableNames(),PC=TypeError;Gv.exports=function(t,e){if(typeof t!="function")throw new PC("\`fn\` is not a function");var o=arguments.length>2&&!!arguments[2];return(!o||CC)&&(AC?kv(t,"name",e,!0,!0):kv(t,"name",e)),t}});var hd=Zt((vF,Hv)=>{"use strict";var IC=Vv(),RC=Object,LC=TypeError;Hv.exports=IC(function(){if(this!=null&&this!==RC(this))throw new LC("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 pd=Zt((_F,Wv)=>{"use strict";var NC=hd(),OC=hu().supportsDescriptors,DC=Object.getOwnPropertyDescriptor;Wv.exports=function(){if(OC&&/a/mig.flags==="gim"){var t=DC(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 NC}});var Yv=Zt((xF,Xv)=>{"use strict";var FC=hu().supportsDescriptors,UC=pd(),BC=Object.getOwnPropertyDescriptor,zC=Object.defineProperty,kC=TypeError,qv=Object.getPrototypeOf,GC=/a/;Xv.exports=function(){if(!FC||!qv)throw new kC("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var t=UC(),e=qv(GC),o=BC(e,"flags");return(!o||o.get!==t)&&zC(e,"flags",{configurable:!0,enumerable:!1,get:t}),t}});var Kv=Zt((EF,Jv)=>{"use strict";var VC=hu(),HC=jc(),WC=hd(),$v=pd(),qC=Yv(),Zv=HC($v());VC(Zv,{getPolyfill:$v,implementation:WC,shim:qC});Jv.exports=Zv});var jv=Zt((MF,Qv)=>{"use strict";var XC=Date.prototype.getDay,YC=function(t){try{return XC.call(t),!0}catch(e){return!1}},$C=Object.prototype.toString,ZC="[object Date]",JC=Xc()();Qv.exports=function(t){return typeof t!="object"||t===null?!1:JC?YC(t):$C.call(t)===ZC}});var dd=Zt((wF,c_)=>{var t_=Jp(),e_=_v(),n_=Lv(),r_=Uv(),i_=Kv(),o_=jv(),s_=Date.prototype.getTime;function l_(r,t,e){var o=e||{};return(o.strict?n_(r,t):r===t)?!0:!r||!t||typeof r!="object"&&typeof t!="object"?o.strict?n_(r,t):r==t:KC(r,t,o)}function a_(r){return r==null}function u_(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 KC(r,t,e){var o,a;if(typeof r!=typeof t||a_(r)||a_(t)||r.prototype!==t.prototype||e_(r)!==e_(t))return!1;var l=r_(r),f=r_(t);if(l!==f)return!1;if(l||f)return r.source===t.source&&i_(r)===i_(t);if(o_(r)&&o_(t))return s_.call(r)===s_.call(t);var h=u_(r),p=u_(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=t_(r),g=t_(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],!l_(r[a],t[a],e))return!1;return!0}c_.exports=l_});var Td=Zt((PB,y_)=>{var GP=dd(),xo=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:VP};xo.prototype.compare=function(r,t){if(r.type!==t.type||!g_(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=m_(r),a=m_(t);return o.every(function(l){return this.some(function(f){return e.compare(l,f)})},a)}}return!1};function m_(r){return r.coordinates.map(function(t){return{type:r.type.replace("Multi",""),coordinates:t}})}function g_(r,t){return r.hasOwnProperty("coordinates")?r.coordinates.length===t.coordinates.length:r.length===t.length}xo.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};xo.prototype.compareLine=function(r,t,e,o){if(!g_(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}};xo.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};xo.prototype.comparePath=function(r,t){var e=this;return r.every(function(o,a){return e.compareCoord(o,this[a])},t)};xo.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};xo.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)};xo.prototype.compareBBox=function(r,t){return!!(!r.bbox&&!t.bbox||r.bbox&&t.bbox&&this.compareCoord(r.bbox,t.bbox))};xo.prototype.removePseudo=function(r){return r};function VP(r,t){return GP(r,t,{strict:!0})}y_.exports=xo});var v_=Zt((GB,of)=>{function Ts(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)}Ts.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};Ts.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)};Ts.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)}};Ts.prototype._addToCluster=function(r,t){this.clusters[t].push(r),this._assigned[r]=1};Ts.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};Ts.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};Ts.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 of!="undefined"&&of.exports&&(of.exports=Ts)});var __=Zt((VB,sf)=>{function As(r,t,e){this.k=3,this.dataset=[],this.assignments=[],this.centroids=[],this.init(r,t,e)}As.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)};As.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()};As.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};As.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};As.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};As.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};As.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 sf!="undefined"&&sf.exports&&(sf.exports=As)});var Ad=Zt((HB,af)=>{function Eo(r,t,e){this._queue=[],this._priorities=[],this._sorting="desc",this._init(r,t,e)}Eo.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)};Eo.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}}};Eo.prototype.forEach=function(r){this._queue.forEach(r)};Eo.prototype.getElements=function(){return this._queue};Eo.prototype.getElementPriority=function(r){return this._priorities[r]};Eo.prototype.getPriorities=function(){return this._priorities};Eo.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};Eo.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)};Eo.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 af!="undefined"&&af.exports&&(af.exports=Eo)});var E_=Zt((WB,du)=>{typeof du!="undefined"&&du.exports&&(x_=Ad());var x_;function jo(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)}jo.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 x_(null,null,"asc"),p=this._regionQuery(a);this._distanceToCore(a)!==void 0&&(this._updateQueue(a,p,h),this._expandCluster(f,h))}return this.clusters};jo.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};jo.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)};jo.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))}})};jo.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))}}};jo.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}};jo.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};jo.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 du!="undefined"&&du.exports&&(du.exports=jo)});var M_=Zt((qB,uf)=>{typeof uf!="undefined"&&uf.exports&&(uf.exports={DBSCAN:v_(),KMEANS:__(),OPTICS:E_(),PriorityQueue:Ad()})});var Cd=Zt((KB,S_)=>{"use strict";S_.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 A_=Zt((QB,T_)=>{"use strict";var b_=Cd(),$P=b_.eudist,ZP=b_.dist;T_.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?$P:ZP,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=[],S=0;S<l;S++){for(var T=1/0,x=0;x<_;x++){var v=o(t[S],a[x]);v<=T&&(T=v)}g[S]=T}for(var C=0;C<l;C++)y+=g[C];for(var w=0;w<l;w++)M[w]={i:w,v:t[w],pr:g[w]/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 L_=Zt((ez,R_)=>{"use strict";var Pd=Cd(),I_=A_(),JP=Pd.eudist,jB=Pd.mandist,tz=Pd.dist,KP=I_.kmrand,QP=I_.kmpp,C_=1e4;function P_(r,t,e){e=e||[];for(var o=0;o<r;o++)e[o]=t;return e}function jP(r,t,e,o){var a=[],l=[],f=[],h=[],p=!1,d=o||C_,g=r.length,_=r[0].length,y=_>0,M=[];if(e)e=="kmrand"?a=KP(r,t):e=="kmpp"?a=QP(r,t):a=e;else for(var S={};a.length<t;){var T=Math.floor(Math.random()*g);S[T]||(S[T]=!0,a.push(r[T]))}do{P_(t,0,M);for(var x=0;x<g;x++){for(var v=1/0,C=0,w=0;w<t;w++){var h=y?JP(r[x],a[w]):Math.abs(r[x]-a[w]);h<=v&&(v=h,C=w)}f[x]=C,M[C]++}for(var O=[],l=[],F=0,G=0;G<t;G++)O[G]=y?P_(_,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:C_-d,k:t,idxs:f,centroids:a}}R_.exports=jP});var _u=Zt((Dd,Fd)=>{(function(r,t){typeof Dd=="object"&&typeof Fd!="undefined"?Fd.exports=t():typeof define=="function"&&define.amd?define(t):(r=typeof globalThis!="undefined"?globalThis:r||self,r.polygonClipping=t())})(Dd,function(){"use strict";function r(J,N){if(!(J instanceof N))throw new TypeError("Cannot call a class as a function")}function t(J,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(J,R.key,R)}}function e(J,N,b){return N&&t(J.prototype,N),b&&t(J,b),J}var o=function(){function J(N,b){this.next=null,this.key=N,this.data=b,this.left=null,this.right=null}return J}();function a(J,N){return J>N?1:J<N?-1:0}function l(J,N,b){for(var R=new o(null,null),W=R,Z=R;;){var I=b(J,N.key);if(I<0){if(N.left===null)break;if(b(J,N.left.key)<0){var P=N.left;if(N.left=P.right,P.right=N,N=P,N.left===null)break}Z.left=N,Z=N,N=N.left}else if(I>0){if(N.right===null)break;if(b(J,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,Z.left=N.right,N.left=R.right,N.right=R.left,N}function f(J,N,b,R){var W=new o(J,N);if(b===null)return W.left=W.right=null,W;b=l(J,b,R);var Z=R(J,b.key);return Z<0?(W.left=b.left,W.right=b,b.left=null):Z>=0&&(W.right=b.right,W.left=b,b.right=null),W}function h(J,N,b){var R=null,W=null;if(N){N=l(J,N,b);var Z=b(N.key,J);Z===0?(R=N.left,W=N.right):Z<0?(W=N.right,N.right=null,R=N):(R=N.left,N.left=null,W=N)}return{left:R,right:W}}function p(J,N,b){return N===null?J:(J===null||(N=l(J.key,N,b),N.left=J),N)}function d(J,N,b,R,W){if(J){R(""+N+(b?"\\u2514\\u2500\\u2500 ":"\\u251C\\u2500\\u2500 ")+W(J)+\`
90
+ `,p=new L.ShaderMaterial({uniforms:{uColor:{value:new L.Color(n[0]).convertLinearToSRGB()},uGradualColor:{value:new L.Color(n[1]).convertLinearToSRGB()},center:{value:t},maxValue:{value:e},opacity:{value:r},uDirection:{value:i},uMax:{value:s},uMin:{value:l}},vertexShader:a,fragmentShader:c,side:L.DoubleSide});return this.shaderMaterialMap.set(u,p),p}async createGroundTextureMaterial({url:n,opacity:t}){let e=`${n}-${t}`;if(this.groundTextureMaterialMap.has(e))return this.groundTextureMaterialMap.get(e);let r=await this.context.textureFactory.getTexture(n),i=new L.MeshBasicMaterial({map:r,transparent:!0,opacity:t});return this.groundTextureMaterialMap.set(e,i),i}createLine2MaterialMap({color:n,width:t,dashed:e}){let r=`${n}-${t}-${e}`;if(this.line2MaterialMap.has(r))return this.line2MaterialMap.get(r);let i=new $n.LineMaterial({color:parseInt(n.slice(1),16),dashed:e,linewidth:t,worldUnits:!0,dashSize:1,gapSize:3,dashScale:1,resolution:new L.Vector2(this.context.clientSize.width,this.context.clientSize.height)});return this.line2MaterialMap.set(r,i),i}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(),this.groundTextureMaterialMap.forEach((n,t)=>{n.dispose(),n.map?.dispose()}),this.groundTextureMaterialMap.clear(),this.line2MaterialMap.forEach((n,t)=>{n.dispose()}),this.line2MaterialMap.clear()}};var yt=require("three");var ue=class{constructor(n){this.context=n;this.registryEvent(),this.changePrevCamera()}prevCamera={position:new yt.Vector3,zoom:1,target:new yt.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.scene.children.filter(f=>f instanceof rt).length)return null;let t=new yt.Box3().setFromObject(this.context.scene),{camera:e,clientSize:{width:r,height:i}}=this.context,{min:s,max:l}=t,u=_(s,e,r,i),a=_(l,e,r,i),c=_(new yt.Vector3(s.x,l.y,l.z),e,r,i),p=_(new yt.Vector3(l.x,s.y,s.z),e,r,i),d=Math.min(u.x,a.x,c.x,p.x),m=Math.max(u.x,a.x,c.x,p.x),g=Math.min(u.y,a.y,c.y,p.y),h=Math.max(u.y,a.y,c.y,p.y);return{left:d,right:m,top:g,bottom:h}}checkDistanceToScreenEdge({left:n,right:t,top:e,bottom:r}){let{width:i,height:s}=this.context.clientSize,[l,u,a,c]=this.context.config.cameraBound.padding,p=t>=c,d=i-n>=u,m=s-e>=a,g=r>=l;return p&&d&&m&&g}onCameraChange=()=>{let n=this.getCurFloorScreenPosition();if(n){let{left:t,right:e,top:r,bottom:i}=n;this.checkDistanceToScreenEdge({left:t,right:e,top:r,bottom:i})?this.changePrevCamera():this.backToPrevCamera()}};dispose(){this.unRegistryEvent()}};var Kn=require("three"),ce=class{constructor(n){this.context=n}textureMap=new Map;loader=new Kn.TextureLoader;async getTexture(n){if(this.textureMap.has(n))return this.textureMap.get(n);let t=await this.loader.loadAsync(n);return this.textureMap.set(n,t),t}dispose(){this.textureMap.forEach(n=>{n.dispose()}),this.textureMap.clear()}};var Xt=class extends b.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 Ht(this),this.hoverHelper=new Wt(this),this.materialFactory=new le(this),this.textureFactory=new ce(this),this.resizeClientSize(),this.registryEvent()}scene=_e();renderer=ve();camera;control;lights=Ee();timer=new Y;tweenGroup=new _t.Group;currentFloor;selection;hoverHelper;basicRatio;materialFactory;textureFactory;cameraBound;clientSize={width:0,height:0,x:0,y:0};renderRf=0;resizeClientSize(){let{x:t,y:e,width:r,height:i}=this.container.getBoundingClientRect();this.clientSize={width:r||this.container.clientWidth,height:i||this.container.clientHeight,x:t,y:e}}init(){let{clientWidth:t,clientHeight:e}=this.container;this.camera=xe(t,e),this.renderer.setSize(t,e),this.control=be(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 ue(this)}getRatio(t=new b.Vector3(0,0,0),e=new b.Vector3(100,0,0)){let{clientWidth:r,clientHeight:i}=this.container,s=_(t,this.camera,r,i),l=_(e,this.camera,r,i);return Math.ceil(Math.sqrt((l.x-s.x)**2+(l.y-s.y)**2))}changeAmbientLightColor(t){this.lights.children.forEach(e=>{e instanceof b.AmbientLight&&(e.color=new b.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:i,clientHeight:s}=t;i=Math.max(1,i),s=Math.max(1,s),e.left=-i/2,e.right=i/2,e.top=s/2,e.bottom=-s/2,e.updateProjectionMatrix(),r.setSize(i,s),this.resizeClientSize(),this.dispatchEvent({type:"resize",width:i,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 i=this.getPoisByDeviceXy(t.offsetX,t.offsetY);i.length&&this.dispatchEvent({type:"poi-click",pois:i})};getGraphicsByDeviceXy(t,e){let r=new b.Vector2;r.x=t/this.clientSize.width*2-1,r.y=e/this.clientSize.height*-2+1;let i=new b.Raycaster;return i.setFromCamera(r,this.camera),i.ray.origin.sub(i.ray.direction.clone().multiplyScalar(100)),this.currentFloor?.graphicLayer.getGraphicByRaycaster(i)||{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),i=this.getPoisByDeviceXy(t.offsetX,t.offsetY);this.dispatchEvent({type:"pointer-over",e:t,graphics:e,pois:i,position:r})};onPointermove=t=>{let{graphics:e,position:r}=this.getGraphicsByDeviceXy(t.offsetX,t.offsetY),i=this.getPoisByDeviceXy(t.offsetX,t.offsetY);this.dispatchEvent({type:"pointer-move",e:t,graphics:e,pois:i,position:r})};onPointerleave=t=>{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.container.addEventListener("pointercancel",this.onPointerleave),this.container.addEventListener("pointerout",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.container.removeEventListener("pointercancel",this.onPointerleave),this.container.removeEventListener("pointerout",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()):ot(new Promise(r=>{let i={polar:this.control.getPolarAngle()},s={polar:t},l=new _t.Tween(i,this.tweenGroup).to(s,e).onUpdate(()=>{this.control.maxPolarAngle=i.polar,this.control.minPolarAngle=i.polar,this.control.update()}).onComplete(()=>{this.control.enabled=!0,this.control.maxPolarAngle=this.config.control.maxPolar,this.control.minPolarAngle=0,this.tweenGroup.remove(l),r(!0)}).onStart(()=>{this.control.enabled=!1}).start()}),e+500)}setAzimuthalAngle(t,e=500){let{maxAzimuthAngle:r,minAzimuthAngle:i}=this.control,s=r===i;if(!(!s&&t>r&&t<i)){if(e===0){this.control.maxAzimuthAngle=t,this.control.minAzimuthAngle=t,this.control.update(),s||(this.control.maxAzimuthAngle=r,this.control.minAzimuthAngle=i);return}return ot(new Promise(l=>{let u={azimuthal:this.control.getAzimuthalAngle()},a={azimuthal:t},c=new _t.Tween(u,this.tweenGroup).to(a,e).onUpdate(()=>{this.control.maxAzimuthAngle=u.azimuthal,this.control.minAzimuthAngle=u.azimuthal,this.control.update()}).onComplete(()=>{this.control.enabled=!0,s||(this.control.maxAzimuthAngle=r,this.control.minAzimuthAngle=i),this.tweenGroup.remove(c),l(!0)}).onStart(()=>{this.control.enabled=!1}).start()}),e+500)}}getCameraLookAt(){return new b.Vector3().subVectors(this.control.target,this.camera.position)}setZoom(t,e,r=500){let i=this.getCameraLookAt(),s={zoom:this.camera.zoom,target:this.control.target.clone()};if(!r){this.camera.position.copy(e.clone().sub(i)),this.control.target.copy(e),this.camera.zoom=t,this.control.update();return}return ot(new Promise(l=>{let u=new _t.Tween(s,this.tweenGroup).to({zoom:t,target:e},r).onUpdate(()=>{this.camera.position.copy(s.target.clone().sub(i)),this.control.target.copy(s.target),this.camera.zoom=s.zoom,this.control.update()}).onComplete(()=>{this.tweenGroup.remove(u),this.control.enabled=!0,l(!0)}).onStart(()=>{this.control.enabled=!1}).start()}),r+500)}getFitCameraToObjectZoom(t,e=[20,20,20,20],r=500,i=!0){let[s,l,u,a]=e,{clientSize:{width:c,height:p}}=this,d=this.control.getPolarAngle();i&&this.setPolarAngle(0,0);let m=new b.Box3().setFromObject(t);this.setPolarAngle(d,0);let{max:g,min:h}=m,f=new b.Vector3(h.x,g.y,g.z),x=new b.Vector3(g.x,g.y,g.z),v=new b.Vector3(g.x,h.y,h.z),T=new b.Vector3(h.x,h.y,h.z),S=_(f,this.camera,c,p),O=_(x,this.camera,c,p),N=_(T,this.camera,c,p),Yt=_(v,this.camera,c,p),sn=new b.Box2().setFromPoints([new b.Vector2(S.x,S.y),new b.Vector2(O.x,O.y),new b.Vector2(N.x,N.y),new b.Vector2(Yt.x,Yt.y)]).getSize(new b.Vector2),ur=(c-l-a)/sn.x,cr=(p-s-u)/sn.y,hr=Math.min(ur,cr),pr=new b.Vector3((g.x+h.x)/2,(g.y+h.y)/2,(g.z+h.z)/2);return{zoom:hr*this.camera.zoom,center:pr}}fitCameraToObject(t,e=[20,20,20,20],r=500,i=!0){let{zoom:s,center:l}=this.getFitCameraToObjectZoom(t,e,r,i);return this.setZoom(s,l,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 ot(new Promise(r=>{let i=this.camera.position.clone(),s=this.getCameraLookAt(),l=new _t.Tween(i,this.tweenGroup).to(t,e).onUpdate(()=>{this.camera.position.copy(i.clone().sub(s)),this.control.target.copy(i.clone()),this.control.update()}).onComplete(()=>{this.tweenGroup.remove(l),this.camera.position.copy(i.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.renderRf=this.timer.requestAnimationFrame(()=>{this.render()}),this.tweenGroup.update()}pauseRender(){this.timer.cancelAnimationFrame(this.renderRf)}continueRender(){this.render()}dispose(){this.cameraBound.dispose(),this.selection.dispose(),this.hoverHelper.dispose(),this.tweenGroup.getAll().forEach(t=>t.stop()),this.tweenGroup.removeAll(),this.unRegistryEvent(),this.renderer.domElement.remove(),this.timer.dispose(),this.renderer.dispose(),this.lights.children.forEach(t=>t.dispose()),this.materialFactory.dispose(),this.textureFactory.dispose(),z(this.scene)}};var Zn=require("lodash"),Jn={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 je(o){return(0,Zn.merge)({},Jn,o)}var Qn=require("lodash");async function Ye({brand:o,project:n},t){let{apiDomain:e,apiPath:{floorRange:r},apiInfo:i}=t,s=`${e}${r}?brand=${o}&project=${n}&phase=${n}&building=${n}`;return await fetch(s,i).then(u=>u.json()).then(u=>u.data).then(u=>{let a=(u||[])[0];return a&&(a.info=JSON.parse(a.info)),a})}async function qt({brand:o,project:n,floor:t,ts:e,resource_type_list:r},i){let{apiDomain:s,apiPath:{floorGraphic:l},apiInfo:u}=i,a=`${s}${l}?brand=${o}&project=${n}&phase=${n}&building=${n}&floor=${t}&ts=${e}&resource_type_list=${r}`;return await fetch(a,u).then(p=>p.json()).then(p=>p.data).then(p=>((p||[]).map(d=>d.info=JSON.parse(d.info)),p||[]))}var tr=(t=>(t[t.D2=0]="D2",t[t.D3=1.1]="D3",t))(tr||{}),$e=class extends he.EventDispatcher{constructor(t,e={}){super();this.container=t;this.config=je(e),this.context=new Xt(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 Y;plugins=[];async loadGraphics({brand:t,project:e,floor:r,ts:i,resource_type_list:s}){return await qt({brand:t,project:e,floor:r,ts:i,resource_type_list:s},this.config)}changeBuildingCenter(t,{brand:e,project:r}){let i=t?Jt(t.info.geometry.cds[0]):[0,0];this.buildingCenter=i,this.dispatchEvent({type:"center-change",center:i,project:r,brand:e})}async loadBuildingGround({brand:t,project:e}){let r=W({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 i=new Promise(async s=>{let l=await Ye({brand:t,project:e},this.config);this.buildingGroundMap.set(r,l),this.changeBuildingCenter(l||null,{brand:t,project:e}),this.buildingGroundPromiseMap.delete(r),s(l)});return this.buildingGroundPromiseMap.set(r,i),i}async load({brand:t,project:e,floor:r,ts:i,resource_type_list:s}){let l=W({brand:t,project:e,floor:r,ts:i,resource_type_list:s});if(this.floorDataMap.has(l))return this.floorDataMap.get(l);let[u,a]=await Promise.all([this.loadGraphics({brand:t,project:e,floor:r,ts:i,resource_type_list:s}),this.loadBuildingGround({brand:t,project:e})]);return this.transformGraphicData(u),u.forEach(c=>{c.info.transformToBuildingGround=!!a}),this.config.useFloorCache||this.floorDataMap.clear(),this.floorDataMap.set(l,u),u}transformGraphicData(t,e=this.buildingCenter,r=0){t.forEach(u=>{if(u.info.geometry.coords=JSON.parse(JSON.stringify(u.info.geometry.cds)),u.info.geometry.type==="polygon")u.info.geometry.coords.map(a=>{Array.isArray(a)&&a.forEach(c=>{c[0]-=e[0],c[1]-=e[1]})});else{let[a,c]=u.info.geometry.cds;u.info.geometry.coords=[a-e[0],c-e[1]]}});let{ground:i,markGraphic:s,graphic:l}=this.config;for(let u=0;u<t.length;u++){let a=t[u];a.info.deltaHeight=1e-5*(r+u+1),a.info.group==="ground"?(a.info.fillColor=i.color,a.info.fillOpacity=i.opacity,a.info.height=i.height,a.info.stroke=i.stroke,a.info.strokeColor=i.strokeColor,a.info.strokeOpacity=i.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=l.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 rt(this.context);if(!t.length)return{curFloor:e,graphics:[]};let r=new Map,i=[];for(let s of t)if(s.info.group==="ground")e.createGround(s.info);else{let l=e.addGraphic(s.info);l.userData.data=s,r.set(s.legacy_id,l),i.push(l)}return e.userData.legacyToGraphicMap=r,{curFloor:e,graphics:i}}triggerHooks(t,e){this.dispatchEvent({type:t,data:e})}switchFloor({brand:t,project:e,floor:r,ts:i,resource_type_list:s}){let l=W({brand:t,project:e,floor:r,ts:i,resource_type_list:s}),u=this.floorDataMap.get(l);if(this.context.control.removeEventListener("change",this.onControlChange),u){let a=W({brand:t,project:e});this.currentBuildGround=this.buildingGroundMap.get(a)||null;let c=this.createFloor(u);c?(c.curFloor.name=r,this.triggerHooks("switch_floor_before",c),this.context.switchFloor(c.curFloor),this.initialFloorCamera(),this.triggerHooks("switch_floor_after",c)):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")}switchFloorByData(t,e,r=e){let{curFloor:i,graphics:s}=this.createFloor(t);i.name=e,i.key=r;let l=new Map;t.forEach(u=>{l.set(u.element_uuid,u)}),i.userData.graphicMap=l,this.switchFloorByFloor(i,s)}switchFloorByFloor(t,e=t.graphicLayer.children){this.triggerHooks("switch_floor_before",{curFloor:t,graphics:e}),this.context.switchFloor(t),this.initialFloorCamera(),this.triggerHooks("switch_floor_after",{curFloor:t,graphics:e})}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.setPolarAngle(this.config.control.defaultPolar,0),this.context.fitCameraToGround(void 0,0);let t=this.context.camera.zoom;this.context.control.minZoom=t,this.context.control.maxZoom=t*25,this.type==="3d"&&this.context.fitCameraToGround(this.config.defaultPadding,0,!1),this.basicZoom=this.context.camera.zoom,this.context.control.addEventListener("change",this.onControlChange),this.onControlChange(),this.context.cameraBound.setEnable(!0),this.context.cameraBound.changePrevCamera()}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:i=0,facilityXScale:s=1,facilityYScale:l=1}=t.options.userData;r.rotateZ((180-i)/180*Math.PI),r.scale.set(s,l,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 D)||[]}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 ot(new Promise(r=>{let i=this.context.control.target.clone(),s=t.getPosition();this.timer.requestAnimationFrame(()=>{let{clientSize:{width:l,height:u},camera:a}=this.context,p=_(s,a,l,u).x-l/2,d=new he.Vector3;d.setFromMatrixColumn(this.context.camera.matrix,0),d.normalize(),d.multiplyScalar(p/this.context.camera.zoom),i.add(d),this.context.setCameraPosition(i,e).then(r)})}),e+500)}getElementDeviceCoordinate(t){let e=t.position.clone(),{clientWidth:r,clientHeight:i}=this.container;return _(e,this.context.camera,r,i)}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.context.setPolarAngle(this.config.control.defaultPolar,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,Qn.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.setAzimuthalAngle(e+t,500)}async measureDistance(){return this.cancelDistance(),new Promise((t,e)=>{this.changeMapType("2d",0),this.context.control.enableRotate=!1,this.svgLine=new Ft(this.context);let r=this.svgLine.dispose.bind(this.svgLine);this.svgLine.dispose=function(){r(),e("cancel")},this.svgLine.addEventListener("distance",({distance:i})=>{t(i)})})}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 Ut(this.context);let r=this.svgPolygon.dispose.bind(this.svgPolygon);this.svgPolygon.dispose=function(){r(),e("cancel")},this.svgPolygon.addEventListener("area",({area:i})=>{t(i)})})}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=Jt(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(i=>{i[0]-=e[0],i[1]-=e[1]})});else{let[r,i]=t.geometry.cds;t.geometry.coords=[r-e[0],i-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)||1;this.context.camera.zoom=e,this.context.control.minZoom=r,this.context.control.maxZoom=r*25,this.basicZoom=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(),Te(),Ce(),Re(),this.unRegistryEvent()}};var er=require("three"),Q=class extends er.EventDispatcher{bmap;constructor(n){super(),this.bmap=n}dispose(){}};var Ke=class extends Q{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(i=>i.json()).then(i=>i.data).then(i=>{this.equipmentList=i,this.equipmentMap=new Map(i.map(s=>[s.equipment_id,s]))}),this.dispatchEvent({type:"change-equipment-list",data:this.equipmentList}),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 Ze(o){let n=new Blob([o],{type:"text/javascript"}),t=URL.createObjectURL(n),e=new Worker(t);return URL.revokeObjectURL(t),e}function Je(){return Ze(`var B1=Object.create;var Uf=Object.defineProperty;var z1=Object.getOwnPropertyDescriptor;var k1=Object.getOwnPropertyNames,gm=Object.getOwnPropertySymbols,G1=Object.getPrototypeOf,ym=Object.prototype.hasOwnProperty,V1=Object.prototype.propertyIsEnumerable;var Ff=(r,t,e)=>t in r?Uf(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,ls=(r,t)=>{for(var e in t||(t={}))ym.call(t,e)&&Ff(r,e,t[e]);if(gm)for(var e of gm(t))V1.call(t,e)&&Ff(r,e,t[e]);return r};var Zt=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports);var H1=(r,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of k1(t))!ym.call(r,a)&&a!==e&&Uf(r,a,{get:()=>t[a],enumerable:!(o=z1(t,a))||o.enumerable});return r};var Ln=(r,t,e)=>(e=r!=null?B1(G1(r)):{},H1(t||!r||!r.__esModule?Uf(e,"default",{value:r,enumerable:!0}):e,r));var dn=(r,t,e)=>Ff(r,typeof t!="symbol"?t+"":t,e);var _m=Zt((dR,vm)=>{var Bf=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)}};vm.exports=Bf});var Mm=Zt((mR,Em)=>{function xm(r,t){let e=new Map;for(let[o,a]of r)o!==t&&a instanceof Map?e.set(o,xm(a,t)):o!==t&&e.set(o,a);return e}Em.exports=xm});var bm=Zt((gR,Sm)=>{function W1(r){let t=Number(r);return!(isNaN(t)||t<=0)}function wm(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,wm(a));if(!W1(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}Sm.exports=wm});var Cm=Zt((yR,Am)=>{function Tm(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){Tm(t);return}if(typeof t!="number"||t<=0)throw new Error(\`Values must be numbers greater than 0. Found value \${t} at \${e}\`)})}Am.exports=Tm});var kf=Zt((vR,Rm)=>{var q1=_m(),X1=Mm(),Pm=bm(),Im=Cm(),zf=class{constructor(t){t instanceof Map?(Im(t),this.graph=t):t?this.graph=Pm(t):this.graph=new Map}addNode(t,e){let o;return e instanceof Map?(Im(e),o=e):o=Pm(e),this.graph.set(t,o),this}addVertex(t,e){return this.addNode(t,e)}removeNode(t){return this.graph=X1(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 q1,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 S=l.get(M).priority,T=g.priority+y;return T<S?(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)}};Rm.exports=zf});var Mc=Zt((AR,E0)=>{"use strict";var x0=Object.getOwnPropertySymbols,Yb=Object.prototype.hasOwnProperty,$b=Object.prototype.propertyIsEnumerable;function Zb(r){if(r==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(r)}function Jb(){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}}E0.exports=Jb()?Object.assign:function(r,t){for(var e,o=Zb(r),a,l=1;l<arguments.length;l++){e=Object(arguments[l]);for(var f in e)Yb.call(e,f)&&(o[f]=e[f]);if(x0){a=x0(e);for(var h=0;h<a.length;h++)$b.call(e,a[h])&&(o[a[h]]=e[a[h]])}}return o}});var hp=Zt((cp,fp)=>{(function(r,t){typeof cp=="object"&&typeof fp!="undefined"?fp.exports=t():typeof define=="function"&&define.amd?define(t):(r=r||self).RBush=t()})(cp,function(){"use strict";function r(x,v,C,w,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,w||x.length-1,O||e)}function t(x,v,C){var w=x[v];x[v]=x[C],x[C]=w}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 w=0;w<v.length;w++)if(C(x,v[w]))return w;return-1}function l(x,v){f(x,0,x.children.length,v,x)}function f(x,v,C,w,O){O||(O=S(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?w(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 S(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,w,O){for(var F=[v,C];F.length;)if(!((C=F.pop())-(v=F.pop())<=w)){var G=v+Math.ceil((C-v)/w/2)*w;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 w=this.toBBox,O=[];v;){for(var F=0;F<v.children.length;F++){var G=v.children[F],z=v.leaf?w(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 w=0;w<v.children.length;w++){var O=v.children[w],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 w=this.data;this.data=C,C=w}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=S([]),this},o.prototype.remove=function(x,v){if(!x)return this;for(var C,w,O,F=this.data,G=this.toBBox(x),z=[],L=[];F||z.length;){if(F||(F=z.pop(),w=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)?w?(C++,F=w.children[C],O=!1):F=null:(z.push(F),L.push(C),C=0,w=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,w){var O,F=C-v+1,G=this._maxEntries;if(F<=G)return l(O=S(x.slice(v,C+1)),this.toBBox),O;w||(w=Math.ceil(Math.log(F)/Math.log(G)),G=Math.ceil(F/Math.pow(G,w-1))),(O=S([])).leaf=!1,O.height=w;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,w-1))}}return l(O,this.toBBox),O},o.prototype._chooseSubtree=function(x,v,C,w){for(;w.push(v),!v.leaf&&w.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 w=C?x:this.toBBox(x),O=[],F=this._chooseSubtree(w,this.data,v,O);for(F.children.push(x),h(F,w);v>=0&&O[v].children.length>this._maxEntries;)this._split(O,v),v--;this._adjustParentBBoxes(w,O,v)},o.prototype._split=function(x,v){var C=x[v],w=C.children.length,O=this._minEntries;this._chooseSplitAxis(C,O,w);var F=this._chooseSplitIndex(C,O,w),G=S(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=S([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 w,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,w=k,nt=vt<nt?vt:nt):it===q&&vt<nt&&(nt=vt,w=k)}return w||C-v},o.prototype._chooseSplitAxis=function(x,v,C){var w=x.leaf?this.compareMinX:p,O=x.leaf?this.compareMinY:d;this._allDistMargin(x,v,C,w)<this._allDistMargin(x,v,C,O)&&x.children.sort(w)},o.prototype._allDistMargin=function(x,v,C,w){x.children.sort(w);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 w=C;w>=0;w--)h(v[w],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 M0=Zt((pp,dp)=>{(function(r,t){typeof pp=="object"&&typeof dp!="undefined"?dp.exports=t():typeof define=="function"&&define.amd?define(t):(r=r||self,r.TinyQueue=t())})(pp,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 S0=Zt((NR,w0)=>{w0.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],S=e[o+g*2+1],T=y>f!=S>f&&l<(M-_)*(f-y)/(S-y)+_;T&&(h=!h)}return h}});var T0=Zt((OR,b0)=>{b0.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],S=e[g+o][1],T=y>f!=S>f&&l<(M-_)*(f-y)/(S-y)+_;T&&(h=!h)}return h}});var P0=Zt((DR,bc)=>{var A0=S0(),C0=T0();bc.exports=function(t,e,o,a){return e.length>0&&Array.isArray(e[0])?C0(t,e,o,a):A0(t,e,o,a)};bc.exports.nested=C0;bc.exports.flat=A0});var R0=Zt((Tc,I0)=>{(function(r,t){typeof Tc=="object"&&typeof I0!="undefined"?t(Tc):typeof define=="function"&&define.amd?define(["exports"],t):t((r=r||self).predicates={})})(Tc,function(r){"use strict";let e=33306690738754706e-32;function o(M,S,T,x,v){let C,w,O,F,G=S[0],z=x[0],L=0,D=0;z>G==z>-G?(C=G,G=S[++L]):(C=z,z=x[++D]);let q=0;if(L<M&&D<T)for(z>G==z>-G?(O=C-((w=G+C)-G),G=S[++L]):(O=C-((w=z+C)-z),z=x[++D]),C=w,O!==0&&(v[q++]=O);L<M&&D<T;)z>G==z>-G?(O=C-((w=C+G)-(F=w-C))+(G-F),G=S[++L]):(O=C-((w=C+z)-(F=w-C))+(z-F),z=x[++D]),C=w,O!==0&&(v[q++]=O);for(;L<M;)O=C-((w=C+G)-(F=w-C))+(G-F),G=S[++L],C=w,O!==0&&(v[q++]=O);for(;D<T;)O=C-((w=C+z)-(F=w-C))+(z-F),z=x[++D],C=w,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,S,T,x,v,C){let w=(S-C)*(T-v),O=(M-v)*(x-C),F=w-O;if(w===0||O===0||w>0!=O>0)return F;let G=Math.abs(w+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,Z){let I=Z[0];for(let P=1;P<W;P++)I+=Z[P];return I}(4,p),J=f*xt;if(qt>=J||-qt>=J||(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)||(J=h*xt+e*Math.abs(qt),(qt+=tt*pt+te*X-(Gt*vt+nn*it))>=J||-qt>=J))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,S,T,x,v,C,G)},r.orient2dfast=function(M,S,T,x,v,C){return(S-C)*(T-v)-(M-v)*(x-C)},Object.defineProperty(r,"__esModule",{value:!0})})});var U0=Zt((FR,vp)=>{"use strict";var L0=hp(),Cc=M0(),Qb=P0(),jb=R0().orient2d;Cc.default&&(Cc=Cc.default);vp.exports=F0;vp.exports.default=F0;function F0(r,t,e){t=Math.max(0,t===void 0?2:t),e=e||0;var o=iT(r),a=new L0(16);a.toBBox=function(C){return{minX:C[0],minY:C[1],maxX:C[0],maxY:C[1]}},a.compareMinX=function(C,w){return C[0]-w[0]},a.compareMinY=function(C,w){return C[1]-w[1]},a.load(r);for(var l=[],f=0,h;f<o.length;f++){var p=o[f];a.remove(p),h=D0(p,h),l.push(h)}var d=new L0(16);for(f=0;f<l.length;f++)d.insert(mp(l[f]));for(var g=t*t,_=e*e;l.length;){var y=l.shift(),M=y.p,S=y.next.p,T=gp(M,S);if(!(T<_)){var x=T/g;p=tT(a,y.prev.p,M,S,y.next.next.p,x,d),p&&Math.min(gp(p,M),gp(p,S))<=x&&(l.push(y),l.push(D0(p,y)),a.remove(p),d.remove(y),d.insert(mp(y)),d.insert(mp(y.next)))}}y=h;var v=[];do v.push(y.p),y=y.next;while(y!==h);return v.push(y.p),v}function tT(r,t,e,o,a,l,f){for(var h=new Cc([],eT),p=r.data;p;){for(var d=0;d<p.children.length;d++){var g=p.children[d],_=p.leaf?yp(g,e,o):nT(e,o,g);_>l||h.push({node:g,dist:_})}for(;h.length&&!h.peek().node.children;){var y=h.pop(),M=y.node,S=yp(M,t,e),T=yp(M,o,a);if(y.dist<S&&y.dist<T&&O0(e,M,f)&&O0(o,M,f))return M}p=h.pop(),p&&(p=p.node)}return null}function eT(r,t){return r.dist-t.dist}function nT(r,t,e){if(N0(r,e)||N0(t,e))return 0;var o=Ac(r[0],r[1],t[0],t[1],e.minX,e.minY,e.maxX,e.minY);if(o===0)return 0;var a=Ac(r[0],r[1],t[0],t[1],e.minX,e.minY,e.minX,e.maxY);if(a===0)return 0;var l=Ac(r[0],r[1],t[0],t[1],e.maxX,e.minY,e.maxX,e.maxY);if(l===0)return 0;var f=Ac(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 N0(r,t){return r[0]>=t.minX&&r[0]<=t.maxX&&r[1]>=t.minY&&r[1]<=t.maxY}function O0(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(rT(h[p].p,h[p].next.p,r,t))return!1;return!0}function Qa(r,t,e){return jb(r[0],r[1],t[0],t[1],e[0],e[1])}function rT(r,t,e,o){return r!==o&&t!==e&&Qa(r,t,e)>0!=Qa(r,t,o)>0&&Qa(e,o,r)>0!=Qa(e,o,t)>0}function mp(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 iT(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++)Qb(r[l],h)||p.push(r[l]);return sT(p)}function D0(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 gp(r,t){var e=r[0]-t[0],o=r[1]-t[1];return e*e+o*o}function yp(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 Ac(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,S=p*p+d*d,T=p*g+d*_,x=g*g+_*_,v=p*y+d*M,C=g*y+_*M,w=S*x-T*T,O,F,G,z,L=w,D=w;w===0?(F=0,L=1,z=C,D=x):(F=T*C-x*v,z=S*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>S?F=L:(F=-v,L=S)):z>D&&(z=D,-v+T<0?F=0:-v+T>S?F=L:(F=-v+T,L=S)),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 oT(r,t){return r[0]===t[0]?r[1]-t[1]:r[0]-t[0]}function sT(r){r.sort(oT);for(var t=[],e=0;e<r.length;e++){for(;t.length>=2&&Qa(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&&Qa(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 H0=Zt((xp,Ep)=>{(function(r,t){typeof xp=="object"&&typeof Ep!="undefined"?Ep.exports=t():typeof define=="function"&&define.amd?define(t):r.quickselect=t()})(xp,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),S=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,S,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 bp=Zt((u2,Sp)=>{"use strict";Sp.exports=$u;Sp.exports.default=$u;var _T=H0();function $u(r,t){if(!(this instanceof $u))return new $u(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()}$u.prototype={all:function(){return this._all(this.data,[])},search:function(r){var t=this.data,e=[],o=this.toBBox;if(!Ic(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,Ic(r,p)&&(t.leaf?e.push(h):wp(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(!Ic(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,Ic(r,h)){if(t.leaf||wp(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=eu([]),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=xT(r,e.children,t),p!==-1))return e.children.splice(p,1),a.push(e),this._condense(a),this;!d&&!e.leaf&&wp(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:W0,compareMinY:q0,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=eu(r.slice(t,e+1)),tu(f,this.toBBox),f;o||(o=Math.ceil(Math.log(a)/Math.log(l)),l=Math.ceil(a/Math.pow(l,o-1))),f=eu([]),f.leaf=!1,f.height=o;var h=Math.ceil(a/l),p=h*Math.ceil(Math.sqrt(l)),d,g,_,y;for(X0(r,t,e,p,this.compareMinX),d=t;d<=e;d+=p)for(_=Math.min(d+p-1,e),X0(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 tu(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=Mp(f),d=ET(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),Yu(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=eu(e.children.splice(l,e.children.length-l));f.height=e.height,f.leaf=e.leaf,tu(e,this.toBBox),tu(f,this.toBBox),t?r[t-1].children.push(f):this._splitRoot(e,f)},_splitRoot:function(r,t){this.data=eu([r,t]),this.data.height=r.height+1,this.data.leaf=!1,tu(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=Xu(r,0,o,this.toBBox),l=Xu(r,o,e,this.toBBox),f=MT(a,l),h=Mp(a)+Mp(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:W0,a=r.leaf?this.compareMinY:q0,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=Xu(r,0,t,a),f=Xu(r,e-t,e,a),h=Pc(l)+Pc(f),p,d;for(p=t;p<e-t;p++)d=r.children[p],Yu(l,r.leaf?a(d):d),h+=Pc(l);for(p=e-t-1;p>=t;p--)d=r.children[p],Yu(f,r.leaf?a(d):d),h+=Pc(f);return h},_adjustParentBBoxes:function(r,t,e){for(var o=e;o>=0;o--)Yu(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():tu(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 xT(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 tu(r,t){Xu(r,0,r.children.length,t,r)}function Xu(r,t,e,o,a){a||(a=eu(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],Yu(a,r.leaf?o(f):f);return a}function Yu(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 W0(r,t){return r.minX-t.minX}function q0(r,t){return r.minY-t.minY}function Mp(r){return(r.maxX-r.minX)*(r.maxY-r.minY)}function Pc(r){return r.maxX-r.minX+(r.maxY-r.minY)}function ET(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 MT(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 wp(r,t){return r.minX<=t.minX&&r.minY<=t.minY&&t.maxX<=r.maxX&&t.maxY<=r.maxY}function Ic(r,t){return t.minX<=r.maxX&&t.minY<=r.maxY&&t.maxX>=r.minX&&t.maxY>=r.minY}function eu(r){return{children:r,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function X0(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,_T(r,f,t,e,a),l.push(t,f,f,e))}});var Q0=Zt((EO,Rp)=>{"use strict";Rp.exports=Oc;Rp.exports.default=Oc;function Oc(r,t,e){e=e||2;var o=t&&t.length,a=o?t[0]*e:r.length,l=Z0(r,0,a,e,!0),f=[];if(!l||l.next===l.prev)return f;var h,p,d,g,_,y,M;if(o&&(l=LT(r,t,l,e)),r.length>80*e){h=d=r[0],p=g=r[1];for(var S=e;S<a;S+=e)_=r[S],y=r[S+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 Ku(l,f,e,h,p,M,0),f}function Z0(r,t,e,o,a){var l,f;if(a===Ip(r,t,e,o)>0)for(l=t;l<e;l+=o)f=$0(l,r[l],r[l+1],f);else for(l=e-o;l>=t;l-=o)f=$0(l,r[l],r[l+1],f);return f&&Dc(f,f.next)&&(ju(f),f=f.next),f}function ea(r,t){if(!r)return r;t||(t=r);var e=r,o;do if(o=!1,!e.steiner&&(Dc(e,e.next)||Bn(e.prev,e,e.next)===0)){if(ju(e),e=t=e.prev,e===e.next)break;o=!0}else e=e.next;while(o||e!==t);return t}function Ku(r,t,e,o,a,l,f){if(r){!f&&l&&UT(r,o,a,l);for(var h=r,p,d;r.prev!==r.next;){if(p=r.prev,d=r.next,l?PT(r,o,a,l):CT(r)){t.push(p.i/e|0),t.push(r.i/e|0),t.push(d.i/e|0),ju(r),r=d.next,h=d.next;continue}if(r=d,r===h){f?f===1?(r=IT(ea(r),t,e),Ku(r,t,e,o,a,l,2)):f===2&&RT(r,t,e,o,a,l):Ku(ea(r),t,e,o,a,l,1);break}}}}function CT(r){var t=r.prev,e=r,o=r.next;if(Bn(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,S=o.next;S!==t;){if(S.x>=g&&S.x<=y&&S.y>=_&&S.y<=M&&iu(a,h,l,p,f,d,S.x,S.y)&&Bn(S.prev,S,S.next)>=0)return!1;S=S.next}return!0}function PT(r,t,e,o){var a=r.prev,l=r,f=r.next;if(Bn(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,S=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=Cp(M,S,t,e,o),C=Cp(T,x,t,e,o),w=r.prevZ,O=r.nextZ;w&&w.z>=v&&O&&O.z<=C;){if(w.x>=M&&w.x<=T&&w.y>=S&&w.y<=x&&w!==a&&w!==f&&iu(h,g,p,_,d,y,w.x,w.y)&&Bn(w.prev,w,w.next)>=0||(w=w.prevZ,O.x>=M&&O.x<=T&&O.y>=S&&O.y<=x&&O!==a&&O!==f&&iu(h,g,p,_,d,y,O.x,O.y)&&Bn(O.prev,O,O.next)>=0))return!1;O=O.nextZ}for(;w&&w.z>=v;){if(w.x>=M&&w.x<=T&&w.y>=S&&w.y<=x&&w!==a&&w!==f&&iu(h,g,p,_,d,y,w.x,w.y)&&Bn(w.prev,w,w.next)>=0)return!1;w=w.prevZ}for(;O&&O.z<=C;){if(O.x>=M&&O.x<=T&&O.y>=S&&O.y<=x&&O!==a&&O!==f&&iu(h,g,p,_,d,y,O.x,O.y)&&Bn(O.prev,O,O.next)>=0)return!1;O=O.nextZ}return!0}function IT(r,t,e){var o=r;do{var a=o.prev,l=o.next.next;!Dc(a,l)&&J0(a,o,o.next,l)&&Qu(a,l)&&Qu(l,a)&&(t.push(a.i/e|0),t.push(o.i/e|0),t.push(l.i/e|0),ju(o),ju(o.next),o=r=l),o=o.next}while(o!==r);return ea(o)}function RT(r,t,e,o,a,l){var f=r;do{for(var h=f.next.next;h!==f.prev;){if(f.i!==h.i&&kT(f,h)){var p=K0(f,h);f=ea(f,f.next),p=ea(p,p.next),Ku(f,t,e,o,a,l,0),Ku(p,t,e,o,a,l,0);return}h=h.next}f=f.next}while(f!==r)}function LT(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=Z0(r,h,p,o,!1),d===d.next&&(d.steiner=!0),a.push(zT(d));for(a.sort(NT),l=0;l<a.length;l++)e=OT(a[l],e);return e}function NT(r,t){return r.x-t.x}function OT(r,t){var e=DT(r,t);if(!e)return t;var o=K0(e,r);return ea(o,o.next),ea(e,e.next)}function DT(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&&iu(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),Qu(e,r)&&(y<_||y===_&&(e.x>f.x||e.x===f.x&&FT(f,e)))&&(f=e,_=y)),e=e.next;while(e!==p);return f}function FT(r,t){return Bn(r.prev,r,t.prev)<0&&Bn(t.next,r,r.next)<0}function UT(r,t,e,o){var a=r;do a.z===0&&(a.z=Cp(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,BT(a)}function BT(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 Cp(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 zT(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 iu(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 kT(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!GT(r,t)&&(Qu(r,t)&&Qu(t,r)&&VT(r,t)&&(Bn(r.prev,r,t.prev)||Bn(r,t.prev,t))||Dc(r,t)&&Bn(r.prev,r,r.next)>0&&Bn(t.prev,t,t.next)>0)}function Bn(r,t,e){return(t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y)}function Dc(r,t){return r.x===t.x&&r.y===t.y}function J0(r,t,e,o){var a=Nc(Bn(r,t,e)),l=Nc(Bn(r,t,o)),f=Nc(Bn(e,o,r)),h=Nc(Bn(e,o,t));return!!(a!==l&&f!==h||a===0&&Lc(r,e,t)||l===0&&Lc(r,o,t)||f===0&&Lc(e,r,o)||h===0&&Lc(e,t,o))}function Lc(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 Nc(r){return r>0?1:r<0?-1:0}function GT(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&&J0(e,e.next,r,t))return!0;e=e.next}while(e!==r);return!1}function Qu(r,t){return Bn(r.prev,r,r.next)<0?Bn(r,t,r.next)>=0&&Bn(r,r.prev,t)>=0:Bn(r,t,r.prev)<0||Bn(r,r.next,t)<0}function VT(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 K0(r,t){var e=new Pp(r.i,r.x,r.y),o=new Pp(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 $0(r,t,e,o){var a=new Pp(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 ju(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 Pp(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}Oc.deviation=function(r,t,e,o){var a=t&&t.length,l=a?t[0]*e:r.length,f=Math.abs(Ip(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(Ip(r,d,g,e))}var _=0;for(h=0;h<o.length;h+=3){var y=o[h]*e,M=o[h+1]*e,S=o[h+2]*e;_+=Math.abs((r[y]-r[S])*(r[M+1]-r[y+1])-(r[y]-r[M])*(r[S+1]-r[y+1]))}return f===0&&_===0?0:Math.abs((_-f)/f)};function Ip(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}Oc.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 Fp=Zt(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 Ss(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=Ss;function WT(r,t,e){switch(e===void 0&&(e={}),r){case"Point":return Lp(t).geometry;case"LineString":return Op(t).geometry;case"Polygon":return Np(t).geometry;case"MultiPoint":return ty(t).geometry;case"MultiLineString":return j0(t).geometry;case"MultiPolygon":return ey(t).geometry;default:throw new Error(r+" is invalid")}}ue.geometry=WT;function Lp(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(!Fc(r[0])||!Fc(r[1]))throw new Error("coordinates must contain numbers");var o={type:"Point",coordinates:r};return Ss(o,t,e)}ue.point=Lp;function qT(r,t,e){return e===void 0&&(e={}),Uc(r.map(function(o){return Lp(o,t)}),e)}ue.points=qT;function Np(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 Ss(h,t,e)}ue.polygon=Np;function XT(r,t,e){return e===void 0&&(e={}),Uc(r.map(function(o){return Np(o,t)}),e)}ue.polygons=XT;function Op(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 Ss(o,t,e)}ue.lineString=Op;function YT(r,t,e){return e===void 0&&(e={}),Uc(r.map(function(o){return Op(o,t)}),e)}ue.lineStrings=YT;function Uc(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=Uc;function j0(r,t,e){e===void 0&&(e={});var o={type:"MultiLineString",coordinates:r};return Ss(o,t,e)}ue.multiLineString=j0;function ty(r,t,e){e===void 0&&(e={});var o={type:"MultiPoint",coordinates:r};return Ss(o,t,e)}ue.multiPoint=ty;function ey(r,t,e){e===void 0&&(e={});var o={type:"MultiPolygon",coordinates:r};return Ss(o,t,e)}ue.multiPolygon=ey;function $T(r,t,e){e===void 0&&(e={});var o={type:"GeometryCollection",geometries:r};return Ss(o,t,e)}ue.geometryCollection=$T;function ZT(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=ZT;function ny(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=ny;function Dp(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=Dp;function JT(r,t){return ry(Dp(r,t))}ue.lengthToDegrees=JT;function KT(r){var t=r%360;return t<0&&(t+=360),t}ue.bearingToAzimuth=KT;function ry(r){var t=r%(2*Math.PI);return t*180/Math.PI}ue.radiansToDegrees=ry;function QT(r){var t=r%360;return t*Math.PI/180}ue.degreesToRadians=QT;function jT(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 ny(Dp(r,t),e)}ue.convertLength=jT;function tA(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=tA;function Fc(r){return!isNaN(r)&&r!==null&&!Array.isArray(r)}ue.isNumber=Fc;function eA(r){return!!r&&r.constructor===Object}ue.isObject=eA;function nA(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(!Fc(t))throw new Error("bbox must only contain numbers")})}ue.validateBBox=nA;function rA(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=rA});var Bp=Zt(or=>{"use strict";Object.defineProperty(or,"__esModule",{value:!0});var Vr=Fp();function tl(r,t,e){if(r!==null)for(var o,a,l,f,h,p,d,g=0,_=0,y,M=r.type,S=M==="FeatureCollection",T=M==="Feature",x=S?r.features.length:1,v=0;v<x;v++){d=S?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 w=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,w,O)===!1)return!1;_++,w++;break;case"LineString":case"MultiPoint":for(o=0;o<p.length;o++){if(t(p[o],_,v,w,O)===!1)return!1;_++,F==="MultiPoint"&&w++}F==="LineString"&&w++;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,w,O)===!1)return!1;_++}F==="MultiLineString"&&w++,F==="Polygon"&&O++}F==="Polygon"&&w++;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,w,O)===!1)return!1;_++}O++}w++}break;case"GeometryCollection":for(o=0;o<f.geometries.length;o++)if(tl(f.geometries[o],t,e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function iA(r,t,e,o){var a=e;return tl(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 iy(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 oA(r,t,e){var o=e;return iy(r,function(a,l){l===0&&e===void 0?o=a:o=t(o,a,l)}),o}function oy(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 sA(r,t,e){var o=e;return oy(r,function(a,l){l===0&&e===void 0?o=a:o=t(o,a,l)}),o}function aA(r){var t=[];return tl(r,function(e){t.push(e)}),t}function Up(r,t){var e,o,a,l,f,h,p,d,g,_,y=0,M=r.type==="FeatureCollection",S=r.type==="Feature",T=M?r.features.length:1;for(e=0;e<T;e++){for(h=M?r.features[e].geometry:S?r.geometry:r,d=M?r.features[e].properties:S?r.properties:{},g=M?r.features[e].bbox:S?r.bbox:void 0,_=M?r.features[e].id:S?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 uA(r,t,e){var o=e;return Up(r,function(a,l,f,h,p){l===0&&e===void 0?o=a:o=t(o,a,l,f,h,p)}),o}function Bc(r,t){Up(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(Vr.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(Vr.feature(_,a),o,d)===!1)return!1}})}function lA(r,t,e){var o=e;return Bc(r,function(a,l,f){l===0&&f===0&&e===void 0?o=a:o=t(o,a,l,f)}),o}function sy(r,t){Bc(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(tl(e,function(_,y,M,S,T){if(h===void 0||o>p||S>d||T>g){h=_,p=o,d=S,g=T,l=0;return}var x=Vr.lineString([h,_],e.properties);if(t(x,o,a,T,l)===!1)return!1;l++,h=_})===!1)return!1}}})}function cA(r,t,e){var o=e,a=!1;return sy(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 ay(r,t){if(!r)throw new Error("geojson is required");Bc(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(Vr.lineString(f[h],e.properties),o,a,h)===!1)return!1;break}}})}function fA(r,t,e){var o=e;return ay(r,function(a,l,f,h){l===0&&e===void 0?o=a:o=t(o,a,l,f,h)}),o}function hA(r,t){if(t=t||{},!Vr.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),Vr.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),Vr.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),Vr.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),Vr.lineString([p[o][a][l],p[o][a][l+1]],f,t)}throw new Error("geojson is invalid")}function pA(r,t){if(t=t||{},!Vr.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 Vr.point(p,f,t);case"MultiPoint":return o<0&&(o=p.length+o),Vr.point(p[o],f,t);case"LineString":return l<0&&(l=p.length+l),Vr.point(p[l],f,t);case"Polygon":return a<0&&(a=p.length+a),l<0&&(l=p[a].length+l),Vr.point(p[a][l],f,t);case"MultiLineString":return o<0&&(o=p.length+o),l<0&&(l=p[o].length+l),Vr.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),Vr.point(p[o][a][l],f,t)}throw new Error("geojson is invalid")}or.coordAll=aA;or.coordEach=tl;or.coordReduce=iA;or.featureEach=oy;or.featureReduce=sA;or.findPoint=pA;or.findSegment=hA;or.flattenEach=Bc;or.flattenReduce=lA;or.geomEach=Up;or.geomReduce=uA;or.lineEach=ay;or.lineReduce=fA;or.propEach=iy;or.propReduce=oA;or.segmentEach=sy;or.segmentReduce=cA});var uy=Zt(kp=>{"use strict";Object.defineProperty(kp,"__esModule",{value:!0});var dA=Bp();function zp(r){var t=[1/0,1/0,-1/0,-1/0];return dA.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}zp.default=zp;kp.default=zp});var zc=Zt((UO,Gp)=>{var _o=hp(),cy=Fp(),fy=Bp(),ou=uy().default,mA=fy.featureEach,DO=fy.coordEach,FO=cy.polygon,ly=cy.featureCollection;function hy(r){var t=new _o(r);return t.insert=function(e){if(e.type!=="Feature")throw new Error("invalid feature");return e.bbox=e.bbox?e.bbox:ou(e),_o.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:ou(a),o.push(a)}):mA(e,function(a){if(a.type!=="Feature")throw new Error("invalid features");a.bbox=a.bbox?a.bbox:ou(a),o.push(a)}),_o.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:ou(e),_o.prototype.remove.call(this,e,o)},t.clear=function(){return _o.prototype.clear.call(this)},t.search=function(e){var o=_o.prototype.search.call(this,this.toBBox(e));return ly(o)},t.collides=function(e){return _o.prototype.collides.call(this,this.toBBox(e))},t.all=function(){var e=_o.prototype.all.call(this);return ly(e)},t.toJSON=function(){return _o.prototype.toJSON.call(this)},t.fromJSON=function(e){return _o.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=ou(e);else if(e.type==="FeatureCollection")o=ou(e);else throw new Error("invalid geojson");return{minX:o[0],minY:o[1],maxX:o[2],maxY:o[3]}},t}Gp.exports=hy;Gp.exports.default=hy});var Yp=Zt((X3,My)=>{"use strict";var Ey=Object.prototype.toString;My.exports=function(t){var e=Ey.call(t),o=e==="[object Arguments]";return o||(o=e!=="[object Array]"&&t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&Ey.call(t.callee)==="[object Function]"),o}});var Ry=Zt((Y3,Iy)=>{"use strict";var Py;Object.keys||(rl=Object.prototype.hasOwnProperty,$p=Object.prototype.toString,wy=Yp(),Zp=Object.prototype.propertyIsEnumerable,Sy=!Zp.call({toString:null},"toString"),by=Zp.call(function(){},"prototype"),il=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],Wc=function(r){var t=r.constructor;return t&&t.prototype===r},Ty={$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},Ay=function(){if(typeof window=="undefined")return!1;for(var r in window)try{if(!Ty["$"+r]&&rl.call(window,r)&&window[r]!==null&&typeof window[r]=="object")try{Wc(window[r])}catch(t){return!0}}catch(t){return!0}return!1}(),Cy=function(r){if(typeof window=="undefined"||!Ay)return Wc(r);try{return Wc(r)}catch(t){return!1}},Py=function(t){var e=t!==null&&typeof t=="object",o=$p.call(t)==="[object Function]",a=wy(t),l=e&&$p.call(t)==="[object String]",f=[];if(!e&&!o&&!a)throw new TypeError("Object.keys called on a non-object");var h=by&&o;if(l&&t.length>0&&!rl.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")&&rl.call(t,g)&&f.push(String(g));if(Sy)for(var _=Cy(t),y=0;y<il.length;++y)!(_&&il[y]==="constructor")&&rl.call(t,il[y])&&f.push(il[y]);return f});var rl,$p,wy,Zp,Sy,by,il,Wc,Ty,Ay,Cy;Iy.exports=Py});var Jp=Zt(($3,Oy)=>{"use strict";var bA=Array.prototype.slice,TA=Yp(),Ly=Object.keys,qc=Ly?function(t){return Ly(t)}:Ry(),Ny=Object.keys;qc.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 TA(o)?Ny(bA.call(o)):Ny(o)})}else Object.keys=qc;return Object.keys||qc};Oy.exports=qc});var Kp=Zt((Z3,Dy)=>{"use strict";Dy.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 Xc=Zt((J3,Fy)=>{"use strict";var AA=Kp();Fy.exports=function(){return AA()&&!!Symbol.toStringTag}});var zy=Zt((K3,By)=>{"use strict";var Uy=typeof Symbol!="undefined"&&Symbol,CA=Kp();By.exports=function(){return typeof Uy!="function"||typeof Symbol!="function"||typeof Uy("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:CA()}});var Vy=Zt((Q3,Gy)=>{"use strict";var ky={foo:{}},PA=Object;Gy.exports=function(){return{__proto__:ky}.foo===ky.foo&&!({__proto__:null}instanceof PA)}});var qy=Zt((j3,Wy)=>{"use strict";var IA="Function.prototype.bind called on incompatible ",RA=Object.prototype.toString,LA=Math.max,NA="[object Function]",Hy=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},OA=function(t,e){for(var o=[],a=e||0,l=0;a<t.length;a+=1,l+=1)o[l]=t[a];return o},DA=function(r,t){for(var e="",o=0;o<r.length;o+=1)e+=r[o],o+1<r.length&&(e+=t);return e};Wy.exports=function(t){var e=this;if(typeof e!="function"||RA.apply(e)!==NA)throw new TypeError(IA+e);for(var o=OA(arguments,1),a,l=function(){if(this instanceof a){var g=e.apply(this,Hy(o,arguments));return Object(g)===g?g:this}return e.apply(t,Hy(o,arguments))},f=LA(0,e.length-o.length),h=[],p=0;p<f;p++)h[p]="$"+p;if(a=Function("binder","return function ("+DA(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 Yc=Zt((tF,Xy)=>{"use strict";var FA=qy();Xy.exports=Function.prototype.bind||FA});var $y=Zt((eF,Yy)=>{"use strict";var UA=Function.prototype.call,BA=Object.prototype.hasOwnProperty,zA=Yc();Yy.exports=zA.call(UA,BA)});var ia=Zt((nF,jy)=>{"use strict";var tn,lu=SyntaxError,Qy=Function,uu=TypeError,Qp=function(r){try{return Qy('"use strict"; return ('+r+").constructor;")()}catch(t){}},na=Object.getOwnPropertyDescriptor;if(na)try{na({},"")}catch(r){na=null}var jp=function(){throw new uu},kA=na?function(){try{return arguments.callee,jp}catch(r){try{return na(arguments,"callee").get}catch(t){return jp}}}():jp,su=zy()(),GA=Vy()(),_r=Object.getPrototypeOf||(GA?function(r){return r.__proto__}:null),au={},VA=typeof Uint8Array=="undefined"||!_r?tn:_r(Uint8Array),ra={"%AggregateError%":typeof AggregateError=="undefined"?tn:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer=="undefined"?tn:ArrayBuffer,"%ArrayIteratorPrototype%":su&&_r?_r([][Symbol.iterator]()):tn,"%AsyncFromSyncIteratorPrototype%":tn,"%AsyncFunction%":au,"%AsyncGenerator%":au,"%AsyncGeneratorFunction%":au,"%AsyncIteratorPrototype%":au,"%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%":Qy,"%GeneratorFunction%":au,"%Int8Array%":typeof Int8Array=="undefined"?tn:Int8Array,"%Int16Array%":typeof Int16Array=="undefined"?tn:Int16Array,"%Int32Array%":typeof Int32Array=="undefined"?tn:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":su&&_r?_r(_r([][Symbol.iterator]())):tn,"%JSON%":typeof JSON=="object"?JSON:tn,"%Map%":typeof Map=="undefined"?tn:Map,"%MapIteratorPrototype%":typeof Map=="undefined"||!su||!_r?tn:_r(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"||!su||!_r?tn:_r(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer=="undefined"?tn:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":su&&_r?_r(""[Symbol.iterator]()):tn,"%Symbol%":su?Symbol:tn,"%SyntaxError%":lu,"%ThrowTypeError%":kA,"%TypedArray%":VA,"%TypeError%":uu,"%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(_r)try{null.error}catch(r){Zy=_r(_r(r)),ra["%Error.prototype%"]=Zy}var Zy,HA=function r(t){var e;if(t==="%AsyncFunction%")e=Qp("async function () {}");else if(t==="%GeneratorFunction%")e=Qp("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=Qp("async function* () {}");else if(t==="%AsyncGenerator%"){var o=r("%AsyncGeneratorFunction%");o&&(e=o.prototype)}else if(t==="%AsyncIteratorPrototype%"){var a=r("%AsyncGenerator%");a&&_r&&(e=_r(a.prototype))}return ra[t]=e,e},Jy={"%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"]},ol=Yc(),$c=$y(),WA=ol.call(Function.call,Array.prototype.concat),qA=ol.call(Function.apply,Array.prototype.splice),Ky=ol.call(Function.call,String.prototype.replace),Zc=ol.call(Function.call,String.prototype.slice),XA=ol.call(Function.call,RegExp.prototype.exec),YA=/[^%.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|(["'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|%$))/g,$A=/\\\\(\\\\)?/g,ZA=function(t){var e=Zc(t,0,1),o=Zc(t,-1);if(e==="%"&&o!=="%")throw new lu("invalid intrinsic syntax, expected closing \`%\`");if(o==="%"&&e!=="%")throw new lu("invalid intrinsic syntax, expected opening \`%\`");var a=[];return Ky(t,YA,function(l,f,h,p){a[a.length]=h?Ky(p,$A,"$1"):f||l}),a},JA=function(t,e){var o=t,a;if($c(Jy,o)&&(a=Jy[o],o="%"+a[0]+"%"),$c(ra,o)){var l=ra[o];if(l===au&&(l=HA(o)),typeof l=="undefined"&&!e)throw new uu("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:a,name:o,value:l}}throw new lu("intrinsic "+t+" does not exist!")};jy.exports=function(t,e){if(typeof t!="string"||t.length===0)throw new uu("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new uu('"allowMissing" argument must be a boolean');if(XA(/^%?[^%]*%?$/,t)===null)throw new lu("\`%\` may not be present anywhere but at the beginning and end of the intrinsic name");var o=ZA(t),a=o.length>0?o[0]:"",l=JA("%"+a+"%",e),f=l.name,h=l.value,p=!1,d=l.alias;d&&(a=d[0],qA(o,WA([0,1],d)));for(var g=1,_=!0;g<o.length;g+=1){var y=o[g],M=Zc(y,0,1),S=Zc(y,-1);if((M==='"'||M==="'"||M==="\`"||S==='"'||S==="'"||S==="\`")&&M!==S)throw new lu("property names with quotes must have matching quotes");if((y==="constructor"||!_)&&(p=!0),a+="."+y,f="%"+a+"%",$c(ra,f))h=ra[f];else if(h!=null){if(!(y in h)){if(!e)throw new uu("base intrinsic for "+t+" exists, but the property is not available.");return}if(na&&g+1>=o.length){var T=na(h,y);_=!!T,_&&"get"in T&&!("originalValue"in T.get)?h=T.get:h=h[y]}else _=$c(h,y),h=h[y];_&&!p&&(ra[f]=h)}}return h}});var sl=Zt((rF,tv)=>{"use strict";var KA=ia(),td=KA("%Object.defineProperty%",!0),ed=function(){if(td)try{return td({},"a",{value:1}),!0}catch(t){return!1}return!1};ed.hasArrayLengthDefineBug=function(){if(!ed())return null;try{return td([],"length",{value:1}).length!==1}catch(t){return!0}};tv.exports=ed});var nd=Zt((iF,ev)=>{"use strict";var QA=ia(),Jc=QA("%Object.getOwnPropertyDescriptor%",!0);if(Jc)try{Jc([],"length")}catch(r){Jc=null}ev.exports=Jc});var Kc=Zt((oF,rv)=>{"use strict";var jA=sl()(),rd=ia(),al=jA&&rd("%Object.defineProperty%",!0);if(al)try{al({},"a",{value:1})}catch(r){al=!1}var tC=rd("%SyntaxError%"),cu=rd("%TypeError%"),nv=nd();rv.exports=function(t,e,o){if(!t||typeof t!="object"&&typeof t!="function")throw new cu("\`obj\` must be an object or a function\`");if(typeof e!="string"&&typeof e!="symbol")throw new cu("\`property\` must be a string or a symbol\`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new cu("\`nonEnumerable\`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new cu("\`nonWritable\`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new cu("\`nonConfigurable\`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new cu("\`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=!!nv&&nv(t,e);if(al)al(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 tC("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var lv=Zt((sF,uv)=>{"use strict";var av=ia(),iv=Kc(),eC=sl()(),ov=nd(),sv=av("%TypeError%"),nC=av("%Math.floor%");uv.exports=function(t,e){if(typeof t!="function")throw new sv("\`fn\` is not a function");if(typeof e!="number"||e<0||e>4294967295||nC(e)!==e)throw new sv("\`length\` must be a positive 32-bit integer");var o=arguments.length>2&&!!arguments[2],a=!0,l=!0;if("length"in t&&ov){var f=ov(t,"length");f&&!f.configurable&&(a=!1),f&&!f.writable&&(l=!1)}return(a||l||!o)&&(eC?iv(t,"length",e,!0,!0):iv(t,"length",e)),t}});var jc=Zt((aF,Qc)=>{"use strict";var id=Yc(),fu=ia(),rC=lv(),iC=fu("%TypeError%"),fv=fu("%Function.prototype.apply%"),hv=fu("%Function.prototype.call%"),pv=fu("%Reflect.apply%",!0)||id.call(hv,fv),ul=fu("%Object.defineProperty%",!0),oC=fu("%Math.max%");if(ul)try{ul({},"a",{value:1})}catch(r){ul=null}Qc.exports=function(t){if(typeof t!="function")throw new iC("a function is required");var e=pv(id,hv,arguments);return rC(e,1+oC(0,t.length-(arguments.length-1)),!0)};var cv=function(){return pv(id,fv,arguments)};ul?ul(Qc.exports,"apply",{value:cv}):Qc.exports.apply=cv});var od=Zt((uF,gv)=>{"use strict";var dv=ia(),mv=jc(),sC=mv(dv("String.prototype.indexOf"));gv.exports=function(t,e){var o=dv(t,!!e);return typeof o=="function"&&sC(t,".prototype.")>-1?mv(o):o}});var _v=Zt((lF,vv)=>{"use strict";var aC=Xc()(),uC=od(),sd=uC("Object.prototype.toString"),tf=function(t){return aC&&t&&typeof t=="object"&&Symbol.toStringTag in t?!1:sd(t)==="[object Arguments]"},yv=function(t){return tf(t)?!0:t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&sd(t)!=="[object Array]"&&sd(t.callee)==="[object Function]"},lC=function(){return tf(arguments)}();tf.isLegacyArguments=yv;vv.exports=lC?tf:yv});var hu=Zt((cF,wv)=>{"use strict";var cC=Jp(),fC=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",hC=Object.prototype.toString,pC=Array.prototype.concat,xv=Kc(),dC=function(r){return typeof r=="function"&&hC.call(r)==="[object Function]"},Ev=sl()(),mC=function(r,t,e,o){if(t in r){if(o===!0){if(r[t]===e)return}else if(!dC(o)||!o())return}Ev?xv(r,t,e,!0):xv(r,t,e)},Mv=function(r,t){var e=arguments.length>2?arguments[2]:{},o=cC(t);fC&&(o=pC.call(o,Object.getOwnPropertySymbols(t)));for(var a=0;a<o.length;a+=1)mC(r,o[a],t[o[a]],e[o[a]])};Mv.supportsDescriptors=!!Ev;wv.exports=Mv});var ad=Zt((fF,bv)=>{"use strict";var Sv=function(r){return r!==r};bv.exports=function(t,e){return t===0&&e===0?1/t===1/e:!!(t===e||Sv(t)&&Sv(e))}});var ud=Zt((hF,Tv)=>{"use strict";var gC=ad();Tv.exports=function(){return typeof Object.is=="function"?Object.is:gC}});var Cv=Zt((pF,Av)=>{"use strict";var yC=ud(),vC=hu();Av.exports=function(){var t=yC();return vC(Object,{is:t},{is:function(){return Object.is!==t}}),t}});var Lv=Zt((dF,Rv)=>{"use strict";var _C=hu(),xC=jc(),EC=ad(),Pv=ud(),MC=Cv(),Iv=xC(Pv(),Object);_C(Iv,{getPolyfill:Pv,implementation:EC,shim:MC});Rv.exports=Iv});var Uv=Zt((mF,Fv)=>{"use strict";var ld=od(),Nv=Xc()(),Ov,Dv,cd,fd;Nv&&(Ov=ld("Object.prototype.hasOwnProperty"),Dv=ld("RegExp.prototype.exec"),cd={},ef=function(){throw cd},fd={toString:ef,valueOf:ef},typeof Symbol.toPrimitive=="symbol"&&(fd[Symbol.toPrimitive]=ef));var ef,wC=ld("Object.prototype.toString"),SC=Object.getOwnPropertyDescriptor,bC="[object RegExp]";Fv.exports=Nv?function(t){if(!t||typeof t!="object")return!1;var e=SC(t,"lastIndex"),o=e&&Ov(e,"value");if(!o)return!1;try{Dv(t,fd)}catch(a){return a===cd}}:function(t){return!t||typeof t!="object"&&typeof t!="function"?!1:wC(t)===bC}});var zv=Zt((gF,Bv)=>{"use strict";var cl=function(){return typeof function(){}.name=="string"},ll=Object.getOwnPropertyDescriptor;if(ll)try{ll([],"length")}catch(r){ll=null}cl.functionsHaveConfigurableNames=function(){if(!cl()||!ll)return!1;var t=ll(function(){},"name");return!!t&&!!t.configurable};var TC=Function.prototype.bind;cl.boundFunctionsHaveNames=function(){return cl()&&typeof TC=="function"&&function(){}.bind().name!==""};Bv.exports=cl});var Vv=Zt((yF,Gv)=>{"use strict";var kv=Kc(),AC=sl()(),CC=zv().functionsHaveConfigurableNames(),PC=TypeError;Gv.exports=function(t,e){if(typeof t!="function")throw new PC("\`fn\` is not a function");var o=arguments.length>2&&!!arguments[2];return(!o||CC)&&(AC?kv(t,"name",e,!0,!0):kv(t,"name",e)),t}});var hd=Zt((vF,Hv)=>{"use strict";var IC=Vv(),RC=Object,LC=TypeError;Hv.exports=IC(function(){if(this!=null&&this!==RC(this))throw new LC("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 pd=Zt((_F,Wv)=>{"use strict";var NC=hd(),OC=hu().supportsDescriptors,DC=Object.getOwnPropertyDescriptor;Wv.exports=function(){if(OC&&/a/mig.flags==="gim"){var t=DC(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 NC}});var Yv=Zt((xF,Xv)=>{"use strict";var FC=hu().supportsDescriptors,UC=pd(),BC=Object.getOwnPropertyDescriptor,zC=Object.defineProperty,kC=TypeError,qv=Object.getPrototypeOf,GC=/a/;Xv.exports=function(){if(!FC||!qv)throw new kC("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var t=UC(),e=qv(GC),o=BC(e,"flags");return(!o||o.get!==t)&&zC(e,"flags",{configurable:!0,enumerable:!1,get:t}),t}});var Kv=Zt((EF,Jv)=>{"use strict";var VC=hu(),HC=jc(),WC=hd(),$v=pd(),qC=Yv(),Zv=HC($v());VC(Zv,{getPolyfill:$v,implementation:WC,shim:qC});Jv.exports=Zv});var jv=Zt((MF,Qv)=>{"use strict";var XC=Date.prototype.getDay,YC=function(t){try{return XC.call(t),!0}catch(e){return!1}},$C=Object.prototype.toString,ZC="[object Date]",JC=Xc()();Qv.exports=function(t){return typeof t!="object"||t===null?!1:JC?YC(t):$C.call(t)===ZC}});var dd=Zt((wF,c_)=>{var t_=Jp(),e_=_v(),n_=Lv(),r_=Uv(),i_=Kv(),o_=jv(),s_=Date.prototype.getTime;function l_(r,t,e){var o=e||{};return(o.strict?n_(r,t):r===t)?!0:!r||!t||typeof r!="object"&&typeof t!="object"?o.strict?n_(r,t):r==t:KC(r,t,o)}function a_(r){return r==null}function u_(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 KC(r,t,e){var o,a;if(typeof r!=typeof t||a_(r)||a_(t)||r.prototype!==t.prototype||e_(r)!==e_(t))return!1;var l=r_(r),f=r_(t);if(l!==f)return!1;if(l||f)return r.source===t.source&&i_(r)===i_(t);if(o_(r)&&o_(t))return s_.call(r)===s_.call(t);var h=u_(r),p=u_(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=t_(r),g=t_(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],!l_(r[a],t[a],e))return!1;return!0}c_.exports=l_});var Td=Zt((PB,y_)=>{var GP=dd(),xo=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:VP};xo.prototype.compare=function(r,t){if(r.type!==t.type||!g_(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=m_(r),a=m_(t);return o.every(function(l){return this.some(function(f){return e.compare(l,f)})},a)}}return!1};function m_(r){return r.coordinates.map(function(t){return{type:r.type.replace("Multi",""),coordinates:t}})}function g_(r,t){return r.hasOwnProperty("coordinates")?r.coordinates.length===t.coordinates.length:r.length===t.length}xo.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};xo.prototype.compareLine=function(r,t,e,o){if(!g_(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}};xo.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};xo.prototype.comparePath=function(r,t){var e=this;return r.every(function(o,a){return e.compareCoord(o,this[a])},t)};xo.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};xo.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)};xo.prototype.compareBBox=function(r,t){return!!(!r.bbox&&!t.bbox||r.bbox&&t.bbox&&this.compareCoord(r.bbox,t.bbox))};xo.prototype.removePseudo=function(r){return r};function VP(r,t){return GP(r,t,{strict:!0})}y_.exports=xo});var v_=Zt((GB,of)=>{function Ts(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)}Ts.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};Ts.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)};Ts.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)}};Ts.prototype._addToCluster=function(r,t){this.clusters[t].push(r),this._assigned[r]=1};Ts.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};Ts.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};Ts.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 of!="undefined"&&of.exports&&(of.exports=Ts)});var __=Zt((VB,sf)=>{function As(r,t,e){this.k=3,this.dataset=[],this.assignments=[],this.centroids=[],this.init(r,t,e)}As.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)};As.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()};As.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};As.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};As.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};As.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};As.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 sf!="undefined"&&sf.exports&&(sf.exports=As)});var Ad=Zt((HB,af)=>{function Eo(r,t,e){this._queue=[],this._priorities=[],this._sorting="desc",this._init(r,t,e)}Eo.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)};Eo.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}}};Eo.prototype.forEach=function(r){this._queue.forEach(r)};Eo.prototype.getElements=function(){return this._queue};Eo.prototype.getElementPriority=function(r){return this._priorities[r]};Eo.prototype.getPriorities=function(){return this._priorities};Eo.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};Eo.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)};Eo.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 af!="undefined"&&af.exports&&(af.exports=Eo)});var E_=Zt((WB,du)=>{typeof du!="undefined"&&du.exports&&(x_=Ad());var x_;function jo(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)}jo.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 x_(null,null,"asc"),p=this._regionQuery(a);this._distanceToCore(a)!==void 0&&(this._updateQueue(a,p,h),this._expandCluster(f,h))}return this.clusters};jo.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};jo.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)};jo.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))}})};jo.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))}}};jo.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}};jo.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};jo.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 du!="undefined"&&du.exports&&(du.exports=jo)});var M_=Zt((qB,uf)=>{typeof uf!="undefined"&&uf.exports&&(uf.exports={DBSCAN:v_(),KMEANS:__(),OPTICS:E_(),PriorityQueue:Ad()})});var Cd=Zt((KB,S_)=>{"use strict";S_.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 A_=Zt((QB,T_)=>{"use strict";var b_=Cd(),$P=b_.eudist,ZP=b_.dist;T_.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?$P:ZP,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=[],S=0;S<l;S++){for(var T=1/0,x=0;x<_;x++){var v=o(t[S],a[x]);v<=T&&(T=v)}g[S]=T}for(var C=0;C<l;C++)y+=g[C];for(var w=0;w<l;w++)M[w]={i:w,v:t[w],pr:g[w]/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 L_=Zt((ez,R_)=>{"use strict";var Pd=Cd(),I_=A_(),JP=Pd.eudist,jB=Pd.mandist,tz=Pd.dist,KP=I_.kmrand,QP=I_.kmpp,C_=1e4;function P_(r,t,e){e=e||[];for(var o=0;o<r;o++)e[o]=t;return e}function jP(r,t,e,o){var a=[],l=[],f=[],h=[],p=!1,d=o||C_,g=r.length,_=r[0].length,y=_>0,M=[];if(e)e=="kmrand"?a=KP(r,t):e=="kmpp"?a=QP(r,t):a=e;else for(var S={};a.length<t;){var T=Math.floor(Math.random()*g);S[T]||(S[T]=!0,a.push(r[T]))}do{P_(t,0,M);for(var x=0;x<g;x++){for(var v=1/0,C=0,w=0;w<t;w++){var h=y?JP(r[x],a[w]):Math.abs(r[x]-a[w]);h<=v&&(v=h,C=w)}f[x]=C,M[C]++}for(var O=[],l=[],F=0,G=0;G<t;G++)O[G]=y?P_(_,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:C_-d,k:t,idxs:f,centroids:a}}R_.exports=jP});var _u=Zt((Dd,Fd)=>{(function(r,t){typeof Dd=="object"&&typeof Fd!="undefined"?Fd.exports=t():typeof define=="function"&&define.amd?define(t):(r=typeof globalThis!="undefined"?globalThis:r||self,r.polygonClipping=t())})(Dd,function(){"use strict";function r(J,N){if(!(J instanceof N))throw new TypeError("Cannot call a class as a function")}function t(J,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(J,R.key,R)}}function e(J,N,b){return N&&t(J.prototype,N),b&&t(J,b),J}var o=function(){function J(N,b){this.next=null,this.key=N,this.data=b,this.left=null,this.right=null}return J}();function a(J,N){return J>N?1:J<N?-1:0}function l(J,N,b){for(var R=new o(null,null),W=R,Z=R;;){var I=b(J,N.key);if(I<0){if(N.left===null)break;if(b(J,N.left.key)<0){var P=N.left;if(N.left=P.right,P.right=N,N=P,N.left===null)break}Z.left=N,Z=N,N=N.left}else if(I>0){if(N.right===null)break;if(b(J,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,Z.left=N.right,N.left=R.right,N.right=R.left,N}function f(J,N,b,R){var W=new o(J,N);if(b===null)return W.left=W.right=null,W;b=l(J,b,R);var Z=R(J,b.key);return Z<0?(W.left=b.left,W.right=b,b.left=null):Z>=0&&(W.right=b.right,W.left=b,b.right=null),W}function h(J,N,b){var R=null,W=null;if(N){N=l(J,N,b);var Z=b(N.key,J);Z===0?(R=N.left,W=N.right):Z<0?(W=N.right,N.right=null,R=N):(R=N.left,N.left=null,W=N)}return{left:R,right:W}}function p(J,N,b){return N===null?J:(J===null||(N=l(J.key,N,b),N.left=J),N)}function d(J,N,b,R,W){if(J){R(""+N+(b?"\\u2514\\u2500\\u2500 ":"\\u251C\\u2500\\u2500 ")+W(J)+\`
91
91
  \`);var Z=N+(b?" ":"\\u2502 ");J.left&&d(J.left,Z,!1,R,W),J.right&&d(J.right,Z,!0,R,W)}}var g=function(){function J(N){N===void 0&&(N=a),this._root=null,this._size=0,this._comparator=N}return J.prototype.insert=function(N,b){return this._size++,this._root=f(N,b,this._root,this._comparator)},J.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,Z=l(N,this._root,W),I=W(N,Z.key);return I===0?this._root=Z:(I<0?(R.left=Z.left,R.right=Z,Z.left=null):I>0&&(R.right=Z.right,R.left=Z,Z.right=null),this._size++,this._root=R),this._root},J.prototype.remove=function(N){this._root=this._remove(N,this._root,this._comparator)},J.prototype._remove=function(N,b,R){var W;if(b===null)return null;b=l(N,b,R);var Z=R(N,b.key);return Z===0?(b.left===null?W=b.right:(W=l(N,b.left,R),W.right=b.right),this._size--,W):b},J.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},J.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},J.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},J.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},J.prototype.forEach=function(N,b){for(var R=this._root,W=[],Z=!1;!Z;)R!==null?(W.push(R),R=R.left):W.length!==0?(R=W.pop(),N.call(b,R),R=R.right):Z=!0;return this},J.prototype.range=function(N,b,R,W){for(var Z=[],I=this._comparator,P=this._root,B;Z.length!==0||P;)if(P)Z.push(P),P=P.left;else{if(P=Z.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},J.prototype.keys=function(){var N=[];return this.forEach(function(b){var R=b.key;return N.push(R)}),N},J.prototype.values=function(){var N=[];return this.forEach(function(b){var R=b.data;return N.push(R)}),N},J.prototype.min=function(){return this._root?this.minNode(this._root).key:null},J.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},J.prototype.minNode=function(N){if(N===void 0&&(N=this._root),N)for(;N.left;)N=N.left;return N},J.prototype.maxNode=function(N){if(N===void 0&&(N=this._root),N)for(;N.right;)N=N.right;return N},J.prototype.at=function(N){for(var b=this._root,R=!1,W=0,Z=[];!R;)if(b)Z.push(b),b=b.left;else if(Z.length>0){if(b=Z.pop(),W===N)return b;W++,b=b.right}else R=!0;return null},J.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 Z=W(N.key,b.key);if(Z===0)break;Z<0?(R=b,b=b.left):b=b.right}return R},J.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 Z=W(N.key,b.key);if(Z===0)break;Z<0?b=b.left:(R=b,b=b.right)}return R},J.prototype.clear=function(){return this._root=null,this._size=0,this},J.prototype.toList=function(){return M(this._root)},J.prototype.load=function(N,b,R){b===void 0&&(b=[]),R===void 0&&(R=!1);var W=N.length,Z=this._comparator;if(R&&x(N,b,0,W-1,Z),this._root===null)this._root=_(N,b,0,W),this._size=W;else{var I=T(this.toList(),y(N,b),Z);W=this._size+W,this._root=S({head:I},0,W)}return this},J.prototype.isEmpty=function(){return this._root===null},Object.defineProperty(J.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(J.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),J.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("")},J.prototype.update=function(N,b,R){var W=this._comparator,Z=h(N,this._root,W),I=Z.left,P=Z.right;W(N,b)<0?P=f(b,R,P,W):I=f(b,R,I,W),this._root=p(I,P,W)},J.prototype.split=function(N){return h(N,this._root,this._comparator)},J}();function _(J,N,b,R){var W=R-b;if(W>0){var Z=b+Math.floor(W/2),I=J[Z],P=N[Z],B=new o(I,P);return B.left=_(J,N,b,Z),B.right=_(J,N,Z+1,R),B}return null}function y(J,N){for(var b=new o(null,null),R=b,W=0;W<J.length;W++)R=R.next=new o(J[W],N[W]);return R.next=null,b.next}function M(J){for(var N=J,b=[],R=!1,W=new o(null,null),Z=W;!R;)N?(b.push(N),N=N.left):b.length>0?(N=Z=Z.next=b.pop(),N=N.right):R=!0;return Z.next=null,W.next}function S(J,N,b){var R=b-N;if(R>0){var W=N+Math.floor(R/2),Z=S(J,N,W),I=J.head;return I.left=Z,J.head=J.head.next,I.right=S(J,W+1,b),I}return null}function T(J,N,b){for(var R=new o(null,null),W=R,Z=J,I=N;Z!==null&&I!==null;)b(Z.key,I.key)<0?(W.next=Z,Z=Z.next):(W.next=I,I=I.next),W=W.next;return Z!==null?W.next=Z:I!==null&&(W.next=I),R.next}function x(J,N,b,R,W){if(!(b>=R)){for(var Z=J[b+R>>1],I=b-1,P=R+1;;){do I++;while(W(J[I],Z)<0);do P--;while(W(J[P],Z)>0);if(I>=P)break;var B=J[I];J[I]=J[P],J[P]=B,B=N[I],N[I]=N[P],N[P]=B}x(J,N,b,P,W),x(J,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,Z=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:Z},ur:{x:W,y:I}}},w=Number.EPSILON;w===void 0&&(w=Math.pow(2,-52));var O=w*w,F=function(N,b){if(-w<N&&N<w&&-w<b&&b<w)return 0;var R=N-b;return R*R<O*N*b?0:N<b?-1:1},G=function(){function J(){r(this,J),this.reset()}return e(J,[{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)}}}]),J}(),z=function(){function J(){r(this,J),this.tree=new g,this.round(0)}return e(J,[{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 Z=this.tree.next(R);return Z!==null&&F(R.key,Z.key)===0?(this.tree.remove(b),Z.key):b}}]),J}(),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},Z={x:R.x-N.x,y:R.y-N.y},I=D(W,Z);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},Z={x:R.x-N.x,y:R.y-N.y};return D(Z,W)/k(Z)/k(W)},X=function(N,b,R){var W={x:b.x-N.x,y:b.y-N.y},Z={x:R.x-N.x,y:R.y-N.y};return q(Z,W)/k(Z)/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 Z=D(b,W);if(Z==0)return null;var I={x:R.x-N.x,y:R.y-N.y},P=D(I,b)/Z,B=D(I,W)/Z,lt=N.x+B*b.x,ct=R.x+P*W.x,j=N.y+B*b.y,wt=R.y+P*W.y,_t=(lt+ct)/2,Mt=(j+wt)/2;return{x:_t,y:Mt}},et=function(){e(J,null,[{key:"compare",value:function(b,R){var W=J.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 J(N,b){r(this,J),N.events===void 0?N.events=[this]:N.events.push(this),this.point=N,this.isLeft=b}return e(J,[{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,Z=R.length;W<Z;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 Z=R+1;Z<b;Z++){var I=this.point.events[Z];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 Z=this.point.events[R];Z!==this&&!Z.segment.ringOut&&Z.segment.isInResult()&&b.push(Z)}return b}},{key:"getLeftmostComparator",value:function(b){var R=this,W=new Map,Z=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)||Z(I),W.has(P)||Z(P);var B=W.get(I),lt=B.sine,ct=B.cosine,j=W.get(P),wt=j.sine,_t=j.cosine;return lt>=0&&wt>=0?ct<_t?1:ct>_t?-1:0:lt<0&&wt<0?ct<_t?-1:ct>_t?1:0:wt<lt?-1:wt>lt?1:0}}}]),J}(),ot=0,V=function(){e(J,null,[{key:"compare",value:function(b,R){var W=b.leftSE.point.x,Z=R.leftSE.point.x,I=b.rightSE.point.x,P=R.rightSE.point.x;if(P<W)return 1;if(I<Z)return-1;var B=b.leftSE.point.y,lt=R.leftSE.point.y,ct=b.rightSE.point.y,j=R.rightSE.point.y;if(W<Z){if(lt<B&&lt<ct)return 1;if(lt>B&&lt>ct)return-1;var wt=b.comparePoint(R.leftSE.point);if(wt<0)return 1;if(wt>0)return-1;var _t=R.comparePoint(b.rightSE.point);return _t!==0?_t:-1}if(W>Z){if(B<lt&&B<j)return-1;if(B>lt&&B>j)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,Qt=I-W,Ht=j-lt,Ot=P-Z;if(oe>Qt&&Ht<Ot)return 1;if(oe<Qt&&Ht>Ot)return-1}return I>P?1:I<P||ct<j?-1:ct>j?1:b.id<R.id?-1:b.id>R.id?1:0}}]);function J(N,b,R,W){r(this,J),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(J,[{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,Z=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)/Z.y,P=R.x+I*Z.x;if(b.x===P)return 0;var B=(b.x-R.x)/Z.x,lt=R.y+B*Z.y;return b.y===lt?0:b.y<lt?-1:1}},{key:"getIntersection",value:function(b){var R=this.bbox(),W=b.bbox(),Z=C(R,W);if(Z===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,j=v(W,I)&&b.comparePoint(I)===0,wt=v(R,lt)&&this.comparePoint(lt)===0,_t=v(W,P)&&b.comparePoint(P)===0;if(j&&ct)return _t&&!wt?P:!_t&&wt?lt:null;if(j)return wt&&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&&wt)return null;if(_t)return P;if(wt)return lt;var Mt=pt(I,this.vector(),B,b.vector());return Mt===null||!v(Z,Mt)?null:L.round(Mt.x,Mt.y)}},{key:"split",value:function(b){var R=[],W=b.events!==void 0,Z=new et(b,!0),I=new et(b,!1),P=this.rightSE;this.replaceRightSE(I),R.push(I),R.push(Z);var B=new J(Z,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&&(Z.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 Z=J.compare(R,W);if(Z!==0){if(Z>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],j=W.windings[B],wt=R.rings.indexOf(ct);wt===-1?(R.rings.push(ct),R.windings.push(j)):R.windings[wt]+=j}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,Z=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 j=[],wt=[],_t=0,Mt=R.length;_t<Mt;_t++)if(W[_t]!==0){var Lt=R[_t],Jt=Lt.poly;if(wt.indexOf(Jt)===-1)if(Lt.isExterior)j.push(Jt);else{wt.indexOf(Jt)===-1&&wt.push(Jt);var Et=j.indexOf(Lt.poly);Et!==-1&&j.splice(Et,1)}}for(var oe=0,Qt=j.length;oe<Qt;oe++){var Ht=j[oe].multiPoly;Z.indexOf(Ht)===-1&&Z.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,Z=R.length===0;this._isInResult=W!==Z;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(j){return j.length===1&&j[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 Z,I,P,B=et.comparePoints(b,R);if(B<0)Z=b,I=R,P=1;else if(B>0)Z=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(Z,!0),ct=new et(I,!1);return new J(lt,ct,[W],[P])}}]),J}(),K=function(){function J(N,b,R){if(r(this,J),!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 Z=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===Z.x&&B.y===Z.y||(this.segments.push(V.fromRing(Z,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),Z=B)}(W.x!==Z.x||W.y!==Z.y)&&this.segments.push(V.fromRing(Z,W,this))}return e(J,[{key:"getSweepEvents",value:function(){for(var b=[],R=0,W=this.segments.length;R<W;R++){var Z=this.segments[R];b.push(Z.leftSE),b.push(Z.rightSE)}return b}}]),J}(),at=function(){function J(N,b){if(r(this,J),!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 Z=new K(N[R],this,!1);Z.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=Z.bbox.ll.x),Z.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=Z.bbox.ll.y),Z.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=Z.bbox.ur.x),Z.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=Z.bbox.ur.y),this.interiorRings.push(Z)}this.multiPoly=b}return e(J,[{key:"getSweepEvents",value:function(){for(var b=this.exteriorRing.getSweepEvents(),R=0,W=this.interiorRings.length;R<W;R++)for(var Z=this.interiorRings[R].getSweepEvents(),I=0,P=Z.length;I<P;I++)b.push(Z[I]);return b}}]),J}(),Tt=function(){function J(N,b){if(r(this,J),!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 Z=new at(N[R],this);Z.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=Z.bbox.ll.x),Z.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=Z.bbox.ll.y),Z.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=Z.bbox.ur.x),Z.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=Z.bbox.ur.y),this.polys.push(Z)}this.isSubject=b}return e(J,[{key:"getSweepEvents",value:function(){for(var b=[],R=0,W=this.polys.length;R<W;R++)for(var Z=this.polys[R].getSweepEvents(),I=0,P=Z.length;I<P;I++)b.push(Z[I]);return b}}]),J}(),dt=function(){e(J,null,[{key:"factory",value:function(b){for(var R=[],W=0,Z=b.length;W<Z;W++){var I=b[W];if(!(!I.isInResult()||I.ringOut)){for(var P=null,B=I.leftSE,lt=I.rightSE,ct=[B],j=B.point,wt=[];P=B,B=lt,ct.push(B),B.point!==j;)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=wt.length;Et<oe;Et++)if(wt[Et].point===B.point){Jt=Et;break}if(Jt!==null){var Qt=wt.splice(Jt)[0],Ht=ct.splice(Qt.index);Ht.unshift(Ht[0].otherSE),R.push(new J(Ht.reverse()));continue}wt.push({index:ct.length,point:B.point});var Ot=B.getLeftmostComparator(P);lt=_t.sort(Ot)[0].otherSE;break}R.push(new J(ct))}}return R}}]);function J(N){r(this,J),this.events=N;for(var b=0,R=N.length;b<R;b++)N[b].segment.ringOut=this;this.poly=null}return e(J,[{key:"getGeom",value:function(){for(var b=this.events[0].point,R=[b],W=1,Z=this.events.length-1;W<Z;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,j=this.isExteriorRing()?0:R.length-1,wt=this.isExteriorRing()?R.length:-1,_t=[],Mt=j;Mt!=wt;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 Z=this.events[R];et.compare(b,Z)>0&&(b=Z)}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}}}]),J}(),Ct=function(){function J(N){r(this,J),this.exteriorRing=N,N.poly=this,this.interiorRings=[]}return e(J,[{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 Z=this.interiorRings[R].getGeom();Z!==null&&b.push(Z)}return b}}]),J}(),Yt=function(){function J(N){r(this,J),this.rings=N,this.polys=this._composePolys(N)}return e(J,[{key:"getGeom",value:function(){for(var b=[],R=0,W=this.polys.length;R<W;R++){var Z=this.polys[R].getGeom();Z!==null&&b.push(Z)}return b}},{key:"_composePolys",value:function(b){for(var R=[],W=0,Z=b.length;W<Z;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}}]),J}(),Wt=function(){function J(N){var b=arguments.length>1&&arguments[1]!==void 0?arguments[1]:V.compare;r(this,J),this.queue=N,this.tree=new g(b),this.segments=[]}return e(J,[{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 Z=b.isLeft?this.tree.insert(R):this.tree.find(R);if(!Z)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=Z,P=Z,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 j=B.getIntersection(R);if(j!==null&&(R.isAnEndpoint(j)||(ct=j),!B.isAnEndpoint(j)))for(var wt=this._splitSafely(B,j),_t=0,Mt=wt.length;_t<Mt;_t++)W.push(wt[_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,Qt=Et.length;oe<Qt;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),St=0,Q=Y.length;St<Q;St++)W.push(Y[St])}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,Kt=Dt.length;ft<Kt;ft++)W.push(Dt[ft]);if(!lt.isAnEndpoint(Ut))for(var re=this._splitSafely(lt,Ut),gn=0,He=re.length;gn<He;gn++)W.push(re[gn])}}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 Z=b.split(R);return Z.push(W),b.consumedBy===void 0&&this.tree.insert(b),Z}}]),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 J(){r(this,J)}return e(J,[{key:"run",value:function(b,R,W){Xt.type=b,L.reset();for(var Z=[new Tt(R,!0)],I=0,P=W.length;I<P;I++)Z.push(new Tt(W[I],!1));if(Xt.numMultiPolys=Z.length,Xt.type==="difference")for(var B=Z[0],lt=1;lt<Z.length;)C(Z[lt].bbox,B.bbox)!==null?lt++:Z.splice(lt,1);if(Xt.type==="intersection"){for(var ct=0,j=Z.length;ct<j;ct++)for(var wt=Z[ct],_t=ct+1,Mt=Z.length;_t<Mt;_t++)if(C(wt.bbox,Z[_t].bbox)===null)return[]}for(var Lt=new g(et.compare),Jt=0,Et=Z.length;Jt<Et;Jt++)for(var oe=Z[Jt].getSweepEvents(),Qt=0,Ht=oe.length;Qt<Ht;Qt++)if(Lt.insert(oe[Qt]),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,St=Lt.pop();St;){var Q=St.key;if(Lt.size===Y){var Ut=Q.segment;throw new Error("Unable to pop() ".concat(Q.isLeft?"left":"right"," SweepEvent ")+"[".concat(Q.point.x,", ").concat(Q.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(Q),ft=0,Kt=Dt.length;ft<Kt;ft++){var re=Dt[ft];re.consumedBy===void 0&&Lt.insert(re)}Y=Lt.size,St=Lt.pop()}L.reset();var gn=dt.factory(Ot.segments),He=new Yt(gn);return He.getGeom()}}]),J}(),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 K_=Zt((hf,J_)=>{(function(r,t){typeof hf=="object"&&typeof J_!="undefined"?t(hf):typeof define=="function"&&define.amd?define(["exports"],t):t(r.jsts={})})(hf,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?di: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 S(){}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),w=function(){},O={MAX_VALUE:{configurable:!0}};w.isNaN=function(n){return Number.isNaN(n)},w.doubleToLongBits=function(n){return n},w.longBitsToDouble=function(n){return n},w.isInfinite=function(n){return!Number.isFinite(n)},O.MAX_VALUE.get=function(){return Number.MAX_VALUE},Object.defineProperties(w,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||w.isNaN(this.z))&&w.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=w.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 w.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:w.isNaN(n)?w.isNaN(i)?0:-1:w.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 w.isInfinite(i)||w.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 $=Math.trunc(s._hi);if($<0)break;var ut=!1,ht=0;$>9?(ut=!0,ht="9"):ht="0"+$,E.append(ht),s=s.subtract(V.valueOf($)).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,$=null,ut=null,ht=null;return U=this._hi/s,$=V.SPLIT*U,c=$-U,ht=V.SPLIT*s,c=$-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,$=(this._hi-ut-ht+this._lo-U*u)/s,ht=U+$,this._hi=ht,this._lo=U-ht+$,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 $=arguments[0];return w.isNaN($)?V.createNaN():V.copy(this).selfDivide($,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],$=arguments[1],ut=null,ht=null,At=null,Rt=null,kt=null,ee=null,on=null;Rt=this._hi+U,ht=this._lo+$,kt=Rt-(ee=Rt-this._hi),At=ht-(on=ht-this._lo);var Rn=(ut=Rt+(ee=(kt=U-ee+(this._hi-kt))+ht))+(ee=(At=$-on+(this._lo-At))+(ee+(Rt-ut))),dr=ee+(ut-Rn);return this._hi=Rn,this._lo=dr,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,$=null;c=(U=V.SPLIT*this._hi)-this._hi,$=V.SPLIT*s,c=U-c,m=this._hi-c,E=$-s;var ut=(U=this._hi*s)+($=c*(E=$-E)-U+c*(A=s-E)+m*E+m*A+(this._hi*u+this._lo*s)),ht=$+(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 w.isNaN(i)?V.createNaN():V.copy(this).selfMultiply(i,0)}},V.prototype.isNaN=function(){return w.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 $=n.charAt(i);if(i++,ot.isDigit($)){var ut=$-"0";m.selfMultiply(V.TEN),m.selfAdd(ut),E++}else{if($!=="."){if($==="e"||$==="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 '"+$+"' 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(w.NaN,w.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(w.NaN,w.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)),$=A.subtract(U).selfDivide(E).doubleValue(),ut=V.valueOf(n.x).selfAdd(V.valueOf(i.x).selfSubtract(n.x).selfMultiply($)).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":\`
92
92
  \`}[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],$=arguments[1],ut=arguments[2];this.x=U,this.y=$,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,Rn=ht.x*At.y-At.x*ht.y,dr=Rt.y-kt.y,Ji=kt.x-Rt.x,Bo=Rt.x*kt.y-kt.x*Rt.y;this.x=on*Bo-Ji*Rn,this.y=dr*Rn-ee*Bo,this.w=ee*Ji-dr*on}};ne.prototype.getY=function(){var n=this.y/this.w;if(w.isNaN(n)||w.isInfinite(n))throw new Wt;return n},ne.prototype.getX=function(){var n=this.x/this.w;if(w.isNaN(n)||w.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,$=s.x*u.y-u.x*s.y,ut=c*U-A*m,ht=(m*$-U*E)/ut,At=(A*E-c*$)/ut;if(w.isNaN(ht)||w.isInfinite(ht)||w.isNaN(At)||w.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),$=Math.min(u.x,c.x),ut=Math.max(u.x,c.x);return!($>U)&&!(ut<A)&&(A=Math.min(m.y,E.y),U=Math.max(m.y,E.y),$=Math.min(u.y,c.y),ut=Math.max(u.y,c.y),!($>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 J=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}(J),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 Z=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),$=new L(m),ut=new L;this.normalizeToEnvCentre(E,A,U,$,ut);var ht=this.safeHCoordinateIntersection(E,A,U,$);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),$=Pt.intersects(c,m,u);return E&&A?(this._intPt[0]=c,this._intPt[1]=m,n.COLLINEAR_INTERSECTION):U&&$?(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||$?n.COLLINEAR_INTERSECTION:n.POINT_INTERSECTION):E&&$?(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||$?n.COLLINEAR_INTERSECTION:n.POINT_INTERSECTION):A&&$?(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,$=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)+($<Rt?$: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),$=B.orientationIndex(c,m,u);return U>0&&$>0||U<0&&$<0?n.NO_INTERSECTION:E===0&&A===0&&U===0&&$===0?this.computeCollinearIntersection(s,u,c,m):(E===0||A===0||U===0||$===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):$===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),$=1;$<A.length;$++){var ut=A[$],ht=A[$-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,$=new L,ut=new L;E.getCoordinate(0,$),E.getCoordinate(1,ut);var ht=$.x;ut.x-=ht;for(var At=0,Rt=1;Rt<A-1;Rt++)U.y=$.y,$.x=ut.x,$.y=ut.y,E.getCoordinate(Rt+1,ut),ut.x-=ht,At+=$.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,$=A-c,ut=U-m;s+=Math.sqrt($*$+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],$=n[A];if(U.equals2D(s)||$.equals2D(s)||U.equals2D($))return!1;var ut=B.computeOrientation(U,s,$),ht=!1;return ht=ut===0?U.x>$.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),$=((m.x-E.x)*(A.x-E.x)+(m.y-E.y)*(A.y-E.y))/U;if($<=0)return m.distance(E);if($>=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 Z,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 j=function(){var n=arguments[0];this._envelope=null,this._factory=null,this._SRID=null,this._userData=null,this._factory=n,this._SRID=n.getSRID()},wt={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}};j.prototype.isGeometryCollection=function(){return this.getSortIndex()===j.SORTINDEX_GEOMETRYCOLLECTION},j.prototype.getFactory=function(){return this._factory},j.prototype.getGeometryN=function(n){return this},j.prototype.getArea=function(){return 0},j.prototype.isRectangle=function(){return!1},j.prototype.equals=function(){if(arguments[0]instanceof j){var n=arguments[0];return n!==null&&this.equalsTopo(n)}if(arguments[0]instanceof Object){var i=arguments[0];if(!(i instanceof j))return!1;var s=i;return this.equalsExact(s)}},j.prototype.equalsExact=function(n){return this===n||this.equalsExact(n,0)},j.prototype.geometryChanged=function(){this.apply(j.geometryChangedFilter)},j.prototype.geometryChangedAction=function(){this._envelope=null},j.prototype.equalsNorm=function(n){return n!==null&&this.norm().equalsExact(n.norm())},j.prototype.getLength=function(){return 0},j.prototype.getNumGeometries=function(){return 1},j.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)}},j.prototype.getUserData=function(){return this._userData},j.prototype.getSRID=function(){return this._SRID},j.prototype.getEnvelope=function(){return this.getFactory().toGeometry(this.getEnvelopeInternal())},j.prototype.checkNotGeometryCollection=function(n){if(n.getSortIndex()===j.SORTINDEX_GEOMETRYCOLLECTION)throw new C("This method does not support GeometryCollection arguments")},j.prototype.equal=function(n,i,s){return s===0?n.equals(i):n.distance(i)<=s},j.prototype.norm=function(){var n=this.copy();return n.normalize(),n},j.prototype.getPrecisionModel=function(){return this._factory.getPrecisionModel()},j.prototype.getEnvelopeInternal=function(){return this._envelope===null&&(this._envelope=this.computeEnvelopeInternal()),new Pt(this._envelope)},j.prototype.setSRID=function(n){this._SRID=n},j.prototype.setUserData=function(n){this._userData=n},j.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},j.prototype.hashCode=function(){return this.getEnvelopeInternal().hashCode()},j.prototype.isGeometryCollectionOrDerived=function(){return this.getSortIndex()===j.SORTINDEX_GEOMETRYCOLLECTION||this.getSortIndex()===j.SORTINDEX_MULTIPOINT||this.getSortIndex()===j.SORTINDEX_MULTILINESTRING||this.getSortIndex()===j.SORTINDEX_MULTIPOLYGON},j.prototype.interfaces_=function(){return[G,F,t]},j.prototype.getClass=function(){return j},j.hasNonEmptyElements=function(n){for(var i=0;i<n.length;i++)if(!n[i].isEmpty())return!0;return!1},j.hasNullElements=function(n){for(var i=0;i<n.length;i++)if(n[i]===null)return!0;return!1},wt.serialVersionUID.get=function(){return 8763622679187377e3},wt.SORTINDEX_POINT.get=function(){return 0},wt.SORTINDEX_MULTIPOINT.get=function(){return 1},wt.SORTINDEX_LINESTRING.get=function(){return 2},wt.SORTINDEX_LINEARRING.get=function(){return 3},wt.SORTINDEX_MULTILINESTRING.get=function(){return 4},wt.SORTINDEX_POLYGON.get=function(){return 5},wt.SORTINDEX_MULTIPOLYGON.get=function(){return 6},wt.SORTINDEX_GEOMETRYCOLLECTION.get=function(){return 7},wt.geometryChangedFilter.get=function(){return _t},Object.defineProperties(j,wt);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 Qt},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 Qt},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 Qt=function(){};Qt.prototype.isInBoundary=function(n){return n>1},Qt.prototype.interfaces_=function(){return[Lt]},Qt.prototype.getClass=function(){return Qt};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 St=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 Q=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}(St),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 $=arguments[0],ut=arguments[1];if(arguments[2])for(var ht=0;ht<$.length;ht++)this.add($[ht],ut);else for(var At=$.length-1;At>=0;At--)this.add($[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],Rn=arguments[1],dr=arguments[2],Ji=arguments[3],Bo=1;dr>Ji&&(Bo=-1);for(var Df=dr;Df!==Ji;Df+=Bo)this.add(on[Df],Rn);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}(Q),ft=function(){},Kt={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};Kt.ForwardComparator.get=function(){return re},Kt.BidirectionalComparator.get=function(){return gn},Kt.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,Kt);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 gn=function(){};gn.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},gn.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 $=s[E].compareTo(u[A]);if($!==0)return $;E+=c,A+=m}return 0},gn.prototype.interfaces_=function(){return[z]},gn.prototype.getClass=function(){return gn};var He=function(){};He.prototype.get=function(){},He.prototype.put=function(){},He.prototype.size=function(){},He.prototype.values=function(){},He.prototype.entrySet=function(){};var Si=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 Kn=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),di=0;(_.prototype=new Si).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:di,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:di,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),di),p(i,di),p(h(h(n)),1),n=h(h(n))):(n===g(h(n))&&(n=h(n),this.rotateLeft(n)),p(h(n),di),p(h(h(n)),1),this.rotateRight(h(h(n))))}else{var s=d(h(h(n)));f(s)===1?(p(h(n),di),p(s,di),p(h(h(n)),1),n=h(h(n))):(n===d(h(n))&&(n=h(n),this.rotateRight(n)),p(h(n),di),p(h(h(n)),1),this.rotateLeft(h(h(n))))}this.root_.color=di},_.prototype.values=function(){var n=new Q,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 Kn,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 Is=function(){};Is.prototype.interfaces_=function(){return[]},Is.prototype.getClass=function(){return Is},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 bo(this)};var bo=function(n){this.treeSet_=n,this.position_=0};bo.prototype.next=function(){if(this.position_===this.treeSet_.size())throw new o;return this.treeSet_.array_[this.position_++]},bo.prototype.hasNext=function(){return this.position_<this.treeSet_.size()},bo.prototype.remove=function(){throw new a};var ki=function(){};ki.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])},ki.asList=function(n){for(var i=new Q,s=0,u=n.length;s<u;s++)i.add(n[s]);return i};var pe=function(){},Lr={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}};Lr.P.get=function(){return 0},Lr.L.get=function(){return 1},Lr.A.get=function(){return 2},Lr.FALSE.get=function(){return-1},Lr.TRUE.get=function(){return-2},Lr.DONTCARE.get=function(){return-3},Lr.SYM_FALSE.get=function(){return"F"},Lr.SYM_TRUE.get=function(){return"T"},Lr.SYM_DONTCARE.get=function(){return"*"},Lr.SYM_P.get=function(){return"0"},Lr.SYM_L.get=function(){return"1"},Lr.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,Lr);var ni=function(){};ni.prototype.filter=function(n){},ni.prototype.interfaces_=function(){return[]},ni.prototype.getClass=function(){return ni};var Hr=function(){};Hr.prototype.filter=function(n,i){},Hr.prototype.isDone=function(){},Hr.prototype.isGeometryChanged=function(){},Hr.prototype.interfaces_=function(){return[]},Hr.prototype.getClass=function(){return Hr};var Hn=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();ki.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(ki.asList(this._geometries)),m=new M(ki.asList(u._geometries));return this.compare(c,m)}if(arguments.length===2){for(var E=arguments[0],A=arguments[1],U=E,$=this.getNumGeometries(),ut=U.getNumGeometries(),ht=0;ht<$&&ht<ut;){var At=this.getGeometryN(ht),Rt=U.getGeometryN(ht),kt=At.compareToSameClass(Rt,A);if(kt!==0)return kt;ht++}return ht<$?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],Hr)){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],ni)){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 $=arguments[0];$.filter(this);for(var ut=0;ut<this._geometries.length;ut++)this._geometries[ut].apply($)}},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}(j),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 j.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[Is]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return 8166665132445434e3},Object.defineProperties(i,s),i}(Hn),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 Q;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 S))throw U;b.shouldNeverReachHere()}return m}},st.split=function(n,i){for(var s=i.length,u=new Q,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)&&(!w.isNaN(E)||!w.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],Hr)){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],ni)?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[Is]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return 0x2b2b51ba435c8e00},Object.defineProperties(i,s),i}(j),se=function(){};se.prototype.interfaces_=function(){return[]},se.prototype.getClass=function(){return se};var jt=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],Hr)){var c=arguments[0];if(this.isEmpty())return null;c.filter(this._coordinates,0),c.isGeometryChanged()&&this.geometryChanged()}else X(arguments[0],ni)?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}(j),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(),$=0;$<U.length;$++)u[++c]=U[$];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),$=u.getY(0),ut=1;ut<=4;ut++){var ht=u.getX(ut),At=u.getY(ut);if(ht!==U==(At!==$))return!1;U=ht,$=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);ki.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,$=this._shell,ut=U._shell,ht=$.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),Rn=ee.compareToSameClass(on,A);if(Rn!==0)return Rn;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,Hr)){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,ni))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}(j),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 j.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}(Hn),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 j.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 j.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 Q,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}(Hn),_n=function(n){this._factory=n||null,this._isUserDataCopied=!1},ri={NoOpGeometryOperation:{configurable:!0},CoordinateOperation:{configurable:!0},CoordinateSequenceOperation:{configurable:!0}};_n.prototype.setCopyUserData=function(n){this._isUserDataCopied=n},_n.prototype.edit=function(n,i){if(n===null)return null;var s=this.editInternal(n,i);return this._isUserDataCopied&&s.setUserData(n.getUserData()),s},_n.prototype.editInternal=function(n,i){return this._factory===null&&(this._factory=n.getFactory()),n instanceof Hn?this.editGeometryCollection(n,i):n instanceof Vt?this.editPolygon(n,i):n instanceof jt?i.edit(n,this._factory):n instanceof Bt?i.edit(n,this._factory):(b.shouldNeverReachHere("Unsupported Geometry class: "+n.getClass().getName()),null)},_n.prototype.editGeometryCollection=function(n,i){for(var s=i.edit(n,this._factory),u=new Q,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([]))},_n.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 Q,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([]))},_n.prototype.interfaces_=function(){return[]},_n.prototype.getClass=function(){return _n},_n.GeometryEditorOperation=function(){},ri.NoOpGeometryOperation.get=function(){return Mn},ri.CoordinateOperation.get=function(){return de},ri.CoordinateSequenceOperation.get=function(){return To},Object.defineProperties(_n,ri);var Mn=function(){};Mn.prototype.edit=function(n,i){return n},Mn.prototype.interfaces_=function(){return[_n.GeometryEditorOperation]},Mn.prototype.getClass=function(){return Mn};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 jt?s.length>0?i.createPoint(s[0]):i.createPoint():n},de.prototype.interfaces_=function(){return[_n.GeometryEditorOperation]},de.prototype.getClass=function(){return de};var To=function(){};To.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 jt?i.createPoint(this.edit(n.getCoordinateSequence(),n)):n},To.prototype.interfaces_=function(){return[_n.GeometryEditorOperation]},To.prototype.getClass=function(){return To};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}}},ao={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 w.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},ao.serialVersionUID.get=function(){return-0xcb44a778db18e00},Object.defineProperties(he,ao);var ii=function(){},Ao={serialVersionUID:{configurable:!0},instanceObject:{configurable:!0}};ii.prototype.readResolve=function(){return ii.instance()},ii.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)}},ii.prototype.interfaces_=function(){return[nt,t]},ii.prototype.getClass=function(){return ii},ii.instance=function(){return ii.instanceObject},Ao.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00},Ao.instanceObject.get=function(){return new ii},Object.defineProperties(ii,Ao);var ca=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 Q,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 Kn;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 Nr){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}}},Gi={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 w.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},Gi.serialVersionUID.get=function(){return 7777263578777804e3},Gi.maximumPreciseValue.get=function(){return 9007199254740992},Object.defineProperties(ie,Gi);var Nr=function n(i){this._name=i||null,n.nameToTypeMap.put(i,this)},Er={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}};Nr.prototype.readResolve=function(){return Nr.nameToTypeMap.get(this._name)},Nr.prototype.toString=function(){return this._name},Nr.prototype.interfaces_=function(){return[t]},Nr.prototype.getClass=function(){return Nr},Er.serialVersionUID.get=function(){return-552860263173159e4},Er.nameToTypeMap.get=function(){return new ca},Object.defineProperties(Nr,Er),ie.Type=Nr,ie.FIXED=new Nr("FIXED"),ie.FLOATING=new Nr("FLOATING"),ie.FLOATING_SINGLE=new Nr("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]))},wl={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 jt)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 jt(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 Hn(null,this);if(arguments.length===1){var n=arguments[0];return new Hn(n,this)}},le.prototype.createGeometry=function(n){return new _n(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 ii.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)},wl.serialVersionUID.get=function(){return-6820524753094096e3},Object.defineProperties(le,wl);var Sl=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],bl=function(n){this.geometryFactory=n||new le};bl.prototype.read=function(n){var i,s=(i=typeof n=="string"?JSON.parse(n):n).type;if(!bi[s])throw new Error("Unknown GeoJSON type: "+i.type);return Sl.indexOf(s)!==-1?bi[s].apply(this,[i.coordinates]):s==="GeometryCollection"?bi[s].apply(this,[i.geometries]):bi[s].apply(this,[i])},bl.prototype.write=function(n){var i=n.getGeometryType();if(!uo[i])throw new Error("Geometry is not supported");return uo[i].apply(this,[n])};var bi={Feature:function(n){var i={};for(var s in n)i[s]=n[s];if(n.geometry){var u=n.geometry.type;if(!bi[u])throw new Error("Unknown GeoJSON type: "+n.type);i.geometry=this.read(n.geometry)}return n.bbox&&(i.bbox=bi.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(bi.Point.apply(this,[n[s]]));return this.geometryFactory.createMultiPoint(i)},LineString:function(n){var i=bi.coordinates.apply(this,[n]);return this.geometryFactory.createLineString(i)},MultiLineString:function(n){for(var i=[],s=0;s<n.length;++s)i.push(bi.LineString.apply(this,[n[s]]));return this.geometryFactory.createMultiLineString(i)},Polygon:function(n){for(var i=bi.coordinates.apply(this,[n[0]]),s=this.geometryFactory.createLinearRing(i),u=[],c=1;c<n.length;++c){var m=n[c],E=bi.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(bi.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)}},uo={coordinate:function(n){return[n.x,n.y]},Point:function(n){return{type:"Point",coordinates:uo.coordinate.apply(this,[n.getCoordinate()])}},MultiPoint:function(n){for(var i=[],s=0;s<n._geometries.length;++s){var u=n._geometries[s],c=uo.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(uo.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=uo.LineString.apply(this,[u]);i.push(c.coordinates)}return{type:"MultiLineString",coordinates:i}},Polygon:function(n){var i=[],s=uo.LineString.apply(this,[n._shell]);i.push(s.coordinates);for(var u=0;u<n._holes.length;++u){var c=n._holes[u],m=uo.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=uo.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(uo[c].apply(this,[u]))}return{type:"GeometryCollection",geometries:i}}},bf=function(n){this.geometryFactory=n||new le,this.precisionModel=this.geometryFactory.getPrecisionModel(),this.parser=new bl(this.geometryFactory)};bf.prototype.read=function(n){var i=this.parser.read(n);return this.precisionModel.getType()===ie.FIXED&&this.reducePrecision(i),i},bf.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 Jd=function(){this.parser=new bl(this.geometryFactory)};Jd.prototype.write=function(n){return this.parser.write(n)};var bt=function(){},Tl={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},Tl.ON.get=function(){return 0},Tl.LEFT.get=function(){return 1},Tl.RIGHT.get=function(){return 2},Object.defineProperties(bt,Tl),(T.prototype=new Error).name="EmptyStackException",(x.prototype=new St).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 Ti=function(){this._minIndex=-1,this._minCoord=null,this._minDe=null,this._orientedDe=null};Ti.prototype.getCoordinate=function(){return this._minCoord},Ti.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},Ti.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)},Ti.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},Ti.prototype.getEdge=function(){return this._orientedDe},Ti.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])},Ti.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)},Ti.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())},Ti.prototype.interfaces_=function(){return[]},Ti.prototype.getClass=function(){return Ti};var lo=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}(J),Al=function(){this.array_=[]};Al.prototype.addLast=function(n){this.array_.push(n)},Al.prototype.removeFirst=function(){return this.array_.shift()},Al.prototype.isEmpty=function(){return this.array_.length===0};var ar=function(){this._finder=null,this._dirEdgeList=new Q,this._nodes=new Q,this._rightMostCoord=null,this._env=null,this._finder=new Ti};ar.prototype.clearVisitedEdges=function(){for(var n=this._dirEdgeList.iterator();n.hasNext();)n.next().setVisited(!1)},ar.prototype.getRightmostCoordinate=function(){return this._rightMostCoord},ar.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 lo("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)}},ar.prototype.computeDepth=function(n){this.clearVisitedEdges();var i=this._finder.getEdge();i.setEdgeDepths(bt.RIGHT,n),this.copySymDepths(i),this.computeDepths(i)},ar.prototype.create=function(n){this.addReachable(n),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()},ar.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)}},ar.prototype.computeDepths=function(n){var i=new Kn,s=new Al,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))}}}},ar.prototype.compareTo=function(n){var i=n;return this._rightMostCoord.x<i._rightMostCoord.x?-1:this._rightMostCoord.x>i._rightMostCoord.x?1:0},ar.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},ar.prototype.addReachable=function(n){var i=new x;for(i.add(n);!i.empty();){var s=i.pop();this.add(s,i)}},ar.prototype.copySymDepths=function(n){var i=n.getSym();i.setDepth(bt.LEFT,n.getDepth(bt.RIGHT)),i.setDepth(bt.RIGHT,n.getDepth(bt.LEFT))},ar.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)}},ar.prototype.getNodes=function(){return this._nodes},ar.prototype.getDirectedEdges=function(){return this._dirEdgeList},ar.prototype.interfaces_=function(){return[F]},ar.prototype.getClass=function(){return ar};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],$=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($,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 Cn=function(){this._startDe=null,this._maxNodeDegree=-1,this._edges=new Q,this._pts=new Q,this._label=new rn(k.NONE),this._ring=null,this._isHole=null,this._shell=null,this._holes=new Q,this._geometryFactory=null;var n=arguments[0],i=arguments[1];this._geometryFactory=i,this.computePoints(n),this.computeRing()};Cn.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())},Cn.prototype.isIsolated=function(){return this._label.getGeometryCount()===1},Cn.prototype.computePoints=function(n){this._startDe=n;var i=n,s=!0;do{if(i===null)throw new lo("Found null DirectedEdge");if(i.getEdgeRing()===this)throw new lo("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)},Cn.prototype.getLinearRing=function(){return this._ring},Cn.prototype.getCoordinate=function(n){return this._pts.get(n)},Cn.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},Cn.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])}},Cn.prototype.isHole=function(){return this._isHole},Cn.prototype.setInResult=function(){var n=this._startDe;do n.getEdge().setInResult(!0),n=n.getNext();while(n!==this._startDe)},Cn.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},Cn.prototype.addHole=function(n){this._holes.add(n)},Cn.prototype.isShell=function(){return this._shell===null},Cn.prototype.getLabel=function(){return this._label},Cn.prototype.getEdges=function(){return this._edges},Cn.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree},Cn.prototype.getShell=function(){return this._shell},Cn.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}},Cn.prototype.setShell=function(n){this._shell=n,n!==null&&n.addHole(this)},Cn.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)},Cn.prototype.interfaces_=function(){return[]},Cn.prototype.getClass=function(){return Cn};var R1=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}(Cn),L1=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 Q,u=this._startDe;do{if(u.getMinEdgeRing()===null){var c=new R1(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}(Cn),Wr=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}}};Wr.prototype.setVisited=function(n){this._isVisited=n},Wr.prototype.setInResult=function(n){this._isInResult=n},Wr.prototype.isCovered=function(){return this._isCovered},Wr.prototype.isCoveredSet=function(){return this._isCoveredSet},Wr.prototype.setLabel=function(n){this._label=n},Wr.prototype.getLabel=function(){return this._label},Wr.prototype.setCovered=function(n){this._isCovered=n,this._isCoveredSet=!0},Wr.prototype.updateIM=function(n){b.isTrue(this._label.getGeometryCount()>=2,"found partial label"),this.computeIM(n)},Wr.prototype.isInResult=function(){return this._isInResult},Wr.prototype.isVisited=function(){return this._isVisited},Wr.prototype.interfaces_=function(){return[]},Wr.prototype.getClass=function(){return Wr};var Cl=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}(Wr),Ai=function(){this.nodeMap=new _,this.nodeFact=null;var n=arguments[0];this.nodeFact=n};Ai.prototype.find=function(n){return this.nodeMap.get(n)},Ai.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 Cl){var s=arguments[0],u=this.nodeMap.get(s.getCoordinate());return u===null?(this.nodeMap.put(s.getCoordinate(),s),s):(u.mergeLabel(s),u)}},Ai.prototype.print=function(n){for(var i=this.iterator();i.hasNext();)i.next().print(n)},Ai.prototype.iterator=function(){return this.nodeMap.values().iterator()},Ai.prototype.values=function(){return this.nodeMap.values()},Ai.prototype.getBoundaryNodes=function(n){for(var i=new Q,s=this.iterator();s.hasNext();){var u=s.next();u.getLabel().getLocation(n)===k.BOUNDARY&&i.add(u)}return i},Ai.prototype.add=function(n){var i=n.getCoordinate();this.addNode(i).add(n)},Ai.prototype.interfaces_=function(){return[]},Ai.prototype.getClass=function(){return Ai};var ln=function(){},Eu={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}},Eu.NE.get=function(){return 0},Eu.NW.get=function(){return 1},Eu.SW.get=function(){return 2},Eu.SE.get=function(){return 3},Object.defineProperties(ln,Eu);var Qn=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}};Qn.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)},Qn.prototype.getDy=function(){return this._dy},Qn.prototype.getCoordinate=function(){return this._p0},Qn.prototype.setNode=function(n){this._node=n},Qn.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)},Qn.prototype.compareTo=function(n){var i=n;return this.compareDirection(i)},Qn.prototype.getDirectedCoordinate=function(){return this._p1},Qn.prototype.getDx=function(){return this._dx},Qn.prototype.getLabel=function(){return this._label},Qn.prototype.getEdge=function(){return this._edge},Qn.prototype.getQuadrant=function(){return this._quadrant},Qn.prototype.getNode=function(){return this._node},Qn.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},Qn.prototype.computeLabel=function(n){},Qn.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")},Qn.prototype.interfaces_=function(){return[F]},Qn.prototype.getClass=function(){return Qn};var Tf=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 lo("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}(Qn),fa=function(){};fa.prototype.createNode=function(n){return new Cl(n,null)},fa.prototype.interfaces_=function(){return[]},fa.prototype.getClass=function(){return fa};var xn=function(){if(this._edges=new Q,this._nodes=null,this._edgeEndList=new Q,arguments.length===0)this._nodes=new Ai(new fa);else if(arguments.length===1){var n=arguments[0];this._nodes=new Ai(n)}};xn.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)}},xn.prototype.find=function(n){return this._nodes.find(n)},xn.prototype.addNode=function(){if(arguments[0]instanceof Cl){var n=arguments[0];return this._nodes.addNode(n)}if(arguments[0]instanceof L){var i=arguments[0];return this._nodes.addNode(i)}},xn.prototype.getNodeIterator=function(){return this._nodes.iterator()},xn.prototype.linkResultDirectedEdges=function(){for(var n=this._nodes.iterator();n.hasNext();)n.next().getEdges().linkResultDirectedEdges()},xn.prototype.debugPrintln=function(n){Nt.out.println(n)},xn.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},xn.prototype.linkAllDirectedEdges=function(){for(var n=this._nodes.iterator();n.hasNext();)n.next().getEdges().linkAllDirectedEdges()},xn.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)},xn.prototype.getEdgeEnds=function(){return this._edgeEndList},xn.prototype.debugPrint=function(n){Nt.out.print(n)},xn.prototype.getEdgeIterator=function(){return this._edges.iterator()},xn.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},xn.prototype.insertEdge=function(n){this._edges.add(n)},xn.prototype.findEdgeEnd=function(n){for(var i=this.getEdgeEnds().iterator();i.hasNext();){var s=i.next();if(s.getEdge()===n)return s}return null},xn.prototype.addEdges=function(n){for(var i=n.iterator();i.hasNext();){var s=i.next();this._edges.add(s);var u=new Tf(s,!0),c=new Tf(s,!1);u.setSym(c),c.setSym(u),this.add(u),this.add(c)}},xn.prototype.add=function(n){this._nodes.add(n),this._edgeEndList.add(n)},xn.prototype.getNodes=function(){return this._nodes.values()},xn.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},xn.prototype.interfaces_=function(){return[]},xn.prototype.getClass=function(){return xn},xn.linkResultDirectedEdges=function(n){for(var i=n.iterator();i.hasNext();)i.next().getEdges().linkResultDirectedEdges()};var Or=function(){this._geometryFactory=null,this._shellList=new Q;var n=arguments[0];this._geometryFactory=n};Or.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)}},Or.prototype.computePolygons=function(n){for(var i=new Q,s=n.iterator();s.hasNext();){var u=s.next().toPolygon(this._geometryFactory);i.add(u)}return i},Or.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 lo("unable to assign hole to a shell",u.getCoordinate(0));u.setShell(c)}}},Or.prototype.buildMinimalEdgeRings=function(n,i,s){for(var u=new Q,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},Or.prototype.containsPoint=function(n){for(var i=this._shellList.iterator();i.hasNext();)if(i.next().containsPoint(n))return!0;return!1},Or.prototype.buildMaximalEdgeRings=function(n){for(var i=new Q,s=n.iterator();s.hasNext();){var u=s.next();if(u.isInResult()&&u.getLabel().isArea()&&u.getEdgeRing()===null){var c=new L1(u,this._geometryFactory);i.add(c),c.setInResult()}}return i},Or.prototype.placePolygonHoles=function(n,i){for(var s=i.iterator();s.hasNext();){var u=s.next();u.isHole()&&u.setShell(n)}},Or.prototype.getPolygons=function(){return this.computePolygons(this._shellList)},Or.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(),$=U.getLinearRing(),ut=$.getEnvelopeInternal();m!==null&&(E=m.getLinearRing().getEnvelopeInternal());var ht=!1;ut.contains(u)&&B.isPointInRing(c,$.getCoordinates())&&(ht=!0),ht&&(m===null||E.contains(ut))&&(m=U)}return m},Or.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},Or.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];xn.linkResultDirectedEdges(s);var u=this.buildMaximalEdgeRings(i),c=new Q,m=this.buildMinimalEdgeRings(u,this._shellList,c);this.sortShellsAndHoles(m,this._shellList,c),this.placeFreeHoles(this._shellList,c)}},Or.prototype.interfaces_=function(){return[]},Or.prototype.getClass=function(){return Or};var ha=function(){};ha.prototype.getBounds=function(){},ha.prototype.interfaces_=function(){return[]},ha.prototype.getClass=function(){return ha};var mi=function(){this._bounds=null,this._item=null;var n=arguments[0],i=arguments[1];this._bounds=n,this._item=i};mi.prototype.getItem=function(){return this._item},mi.prototype.getBounds=function(){return this._bounds},mi.prototype.interfaces_=function(){return[ha,t]},mi.prototype.getClass=function(){return mi};var co=function(){this._size=null,this._items=null,this._size=0,this._items=new Q,this._items.add(null)};co.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},co.prototype.size=function(){return this._size},co.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)},co.prototype.clear=function(){this._size=0,this._items.clear()},co.prototype.isEmpty=function(){return this._size===0},co.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)},co.prototype.interfaces_=function(){return[]},co.prototype.getClass=function(){return co};var Co=function(){};Co.prototype.visitItem=function(n){},Co.prototype.interfaces_=function(){return[]},Co.prototype.getClass=function(){return Co};var Rs=function(){};Rs.prototype.insert=function(n,i){},Rs.prototype.remove=function(n,i){},Rs.prototype.query=function(){},Rs.prototype.interfaces_=function(){return[]},Rs.prototype.getClass=function(){return Rs};var Dn=function(){if(this._childBoundables=new Q,this._bounds=null,this._level=null,arguments.length!==0){if(arguments.length===1){var n=arguments[0];this._level=n}}},Kd={serialVersionUID:{configurable:!0}};Dn.prototype.getLevel=function(){return this._level},Dn.prototype.size=function(){return this._childBoundables.size()},Dn.prototype.getChildBoundables=function(){return this._childBoundables},Dn.prototype.addChildBoundable=function(n){b.isTrue(this._bounds===null),this._childBoundables.add(n)},Dn.prototype.isEmpty=function(){return this._childBoundables.isEmpty()},Dn.prototype.getBounds=function(){return this._bounds===null&&(this._bounds=this.computeBounds()),this._bounds},Dn.prototype.interfaces_=function(){return[ha,t]},Dn.prototype.getClass=function(){return Dn},Kd.serialVersionUID.get=function(){return 6493722185909574e3},Object.defineProperties(Dn,Kd);var gi=function(){};gi.reverseOrder=function(){return{compare:function(n,i){return i.compareTo(n)}}},gi.min=function(n){return gi.sort(n),n.get(0)},gi.sort=function(n,i){var s=n.toArray();i?ki.sort(s,i):ki.sort(s);for(var u=n.iterator(),c=0,m=s.length;c<m;c++)u.next(),u.set(s[c])},gi.singletonList=function(n){var i=new Q;return i.add(n),i};var Pn=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()};Pn.prototype.expandToQueue=function(n,i){var s=Pn.isComposite(this._boundable1),u=Pn.isComposite(this._boundable2);if(s&&u)return Pn.area(this._boundable1)>Pn.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")},Pn.prototype.isLeaves=function(){return!(Pn.isComposite(this._boundable1)||Pn.isComposite(this._boundable2))},Pn.prototype.compareTo=function(n){var i=n;return this._distance<i._distance?-1:this._distance>i._distance?1:0},Pn.prototype.expand=function(n,i,s,u){for(var c=n.getChildBoundables().iterator();c.hasNext();){var m=c.next(),E=new Pn(m,i,this._itemDistance);E.getDistance()<u&&s.add(E)}},Pn.prototype.getBoundable=function(n){return n===0?this._boundable1:this._boundable2},Pn.prototype.getDistance=function(){return this._distance},Pn.prototype.distance=function(){return this.isLeaves()?this._itemDistance.distance(this._boundable1,this._boundable2):this._boundable1.getBounds().distance(this._boundable2.getBounds())},Pn.prototype.interfaces_=function(){return[F]},Pn.prototype.getClass=function(){return Pn},Pn.area=function(n){return n.getBounds().getArea()},Pn.isComposite=function(n){return n instanceof Dn};var kn=function n(){if(this._root=null,this._built=!1,this._itemBoundables=new Q,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}},Pl={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};kn.prototype.getNodeCapacity=function(){return this._nodeCapacity},kn.prototype.lastNode=function(n){return n.get(n.size()-1)},kn.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 Dn?n+=this.size(s):s instanceof mi&&(n+=1)}return n}},kn.prototype.removeItem=function(n,i){for(var s=null,u=n.getChildBoundables().iterator();u.hasNext();){var c=u.next();c instanceof mi&&c.getItem()===i&&(s=c)}return s!==null&&(n.getChildBoundables().remove(s),!0)},kn.prototype.itemsTree=function(){if(arguments.length===0){this.build();var n=this.itemsTree(this._root);return n===null?new Q:n}if(arguments.length===1){for(var i=arguments[0],s=new Q,u=i.getChildBoundables().iterator();u.hasNext();){var c=u.next();if(c instanceof Dn){var m=this.itemsTree(c);m!==null&&s.add(m)}else c instanceof mi?s.add(c.getItem()):b.shouldNeverReachHere()}return s.size()<=0?null:s}},kn.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 mi(n,i))},kn.prototype.boundablesAtLevel=function(){if(arguments.length===1){var n=arguments[0],i=new Q;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 Dn?this.boundablesAtLevel(s,E,c):(b.isTrue(E instanceof mi),s===-1&&c.add(E))}return null}},kn.prototype.query=function(){if(arguments.length===1){var n=arguments[0];this.build();var i=new Q;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],Co)&&arguments[0]instanceof Object&&arguments[1]instanceof Dn)for(var c=arguments[0],m=arguments[1],E=arguments[2],A=m.getChildBoundables(),U=0;U<A.size();U++){var $=A.get(U);this.getIntersectsOp().intersects($.getBounds(),c)&&($ instanceof Dn?this.query(c,$,E):$ instanceof mi?E.visitItem($.getItem()):b.shouldNeverReachHere())}else if(X(arguments[2],St)&&arguments[0]instanceof Object&&arguments[1]instanceof Dn)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 Dn?this.query(ut,ee,At):ee instanceof mi?At.add(ee.getItem()):b.shouldNeverReachHere())}}},kn.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},kn.prototype.getRoot=function(){return this.build(),this._root},kn.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 Dn&&(m=this.remove(s,U,c))){E=U;break}}return E!==null&&E.getChildBoundables().isEmpty()&&u.getChildBoundables().remove(E),m}},kn.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)},kn.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 Dn){var u=this.depth(s);u>n&&(n=u)}}return n+1}},kn.prototype.createParentBoundables=function(n,i){b.isTrue(!n.isEmpty());var s=new Q;s.add(this.createNode(i));var u=new Q(n);gi.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},kn.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()},kn.prototype.interfaces_=function(){return[t]},kn.prototype.getClass=function(){return kn},kn.compareDoubles=function(n,i){return n>i?1:n<i?-1:0},Pl.IntersectsOp.get=function(){return N1},Pl.serialVersionUID.get=function(){return-3886435814360241e3},Pl.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(kn,Pl);var N1=function(){},pa=function(){};pa.prototype.distance=function(n,i){},pa.prototype.interfaces_=function(){return[]},pa.prototype.getClass=function(){return pa};var Qd=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 Q,E=0;E<u.length;E++)m.addAll(this.createParentBoundablesFromVerticalSlice(u[E],c));return m},i.prototype.createNode=function(u){return new jd(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 Q;for(var $=0;A.hasNext()&&$<m;){var ut=A.next();E[U].add(ut),$++}}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],Co)&&arguments[0]instanceof Object&&arguments[1]instanceof Dn){var E=arguments[0],A=arguments[1],U=arguments[2];n.prototype.query.call(this,E,A,U)}else if(X(arguments[2],St)&&arguments[0]instanceof Object&&arguments[1]instanceof Dn){var $=arguments[0],ut=arguments[1],ht=arguments[2];n.prototype.query.call(this,$,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 Q(u);gi.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],pa)){var u=arguments[0],c=new Pn(this.getRoot(),this.getRoot(),u);return this.nearestNeighbour(c)}if(arguments[0]instanceof Pn){var m=arguments[0];return this.nearestNeighbour(m,w.POSITIVE_INFINITY)}}else if(arguments.length===2){if(arguments[0]instanceof i&&X(arguments[1],pa)){var E=arguments[0],A=arguments[1],U=new Pn(this.getRoot(),E.getRoot(),A);return this.nearestNeighbour(U)}if(arguments[0]instanceof Pn&&typeof arguments[1]=="number"){var $=arguments[0],ut=arguments[1],ht=null,At=new co;for(At.add($);!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],Rn=arguments[2],dr=new mi(ee,on),Ji=new Pn(this.getRoot(),dr,Rn);return this.nearestNeighbour(Ji)[0]}},i.prototype.interfaces_=function(){return[Rs,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 jd},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}(kn),jd=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}(Dn),Mr=function(){};Mr.prototype.interfaces_=function(){return[]},Mr.prototype.getClass=function(){return Mr},Mr.relativeSign=function(n,i){return n<i?-1:n>i?1:0},Mr.compare=function(n,i,s){if(i.equals2D(s))return 0;var u=Mr.relativeSign(i.x,s.x),c=Mr.relativeSign(i.y,s.y);switch(n){case 0:return Mr.compareValue(u,c);case 1:return Mr.compareValue(c,u);case 2:return Mr.compareValue(c,-u);case 3:return Mr.compareValue(-u,c);case 4:return Mr.compareValue(-u,-c);case 5:return Mr.compareValue(-c,-u);case 6:return Mr.compareValue(-c,u);case 7:return Mr.compareValue(u,-c)}return b.shouldNeverReachHere("invalid octant value"),0},Mr.compareValue=function(n,i){return n<0?-1:n>0?1:i<0?-1:i>0?1:0};var Po=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))};Po.prototype.getCoordinate=function(){return this.coord},Po.prototype.print=function(n){n.print(this.coord),n.print(" seg # = "+this.segmentIndex)},Po.prototype.compareTo=function(n){var i=n;return this.segmentIndex<i.segmentIndex?-1:this.segmentIndex>i.segmentIndex?1:this.coord.equals2D(i.coord)?0:Mr.compare(this._segmentOctant,this.coord,i.coord)},Po.prototype.isEndPoint=function(n){return this.segmentIndex===0&&!this._isInterior||this.segmentIndex===n},Po.prototype.isInterior=function(){return this._isInterior},Po.prototype.interfaces_=function(){return[F]},Po.prototype.getClass=function(){return Po};var ur=function(){this._nodeMap=new _,this._edge=null;var n=arguments[0];this._edge=n};ur.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()},ur.prototype.addCollapsedNodes=function(){var n=new Q;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)}},ur.prototype.print=function(n){n.println("Intersections:");for(var i=this.iterator();i.hasNext();)i.next().print(n)},ur.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))}},ur.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))},ur.prototype.iterator=function(){return this._nodeMap.values().iterator()},ur.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}},ur.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)},ur.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}},ur.prototype.getEdge=function(){return this._edge},ur.prototype.addEndpoints=function(){var n=this._edge.size()-1;this.add(this._edge.getCoordinate(0),0),this.add(this._edge.getCoordinate(n),n)},ur.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 bn(m,this._edge.getData())},ur.prototype.add=function(n,i){var s=new Po(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)},ur.prototype.checkSplitEdgesCorrectness=function(n){var i=this._edge.getCoordinates(),s=n.get(0).getCoordinate(0);if(!s.equals2D(i[0]))throw new J("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 J("bad split edge end point at "+c)},ur.prototype.interfaces_=function(){return[]},ur.prototype.getClass=function(){return ur};var Ls=function(){};Ls.prototype.interfaces_=function(){return[]},Ls.prototype.getClass=function(){return Ls},Ls.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 Ls.octant(E,A)}};var Vi=function(){};Vi.prototype.getCoordinates=function(){},Vi.prototype.size=function(){},Vi.prototype.getCoordinate=function(n){},Vi.prototype.isClosed=function(){},Vi.prototype.setData=function(n){},Vi.prototype.getData=function(){},Vi.prototype.interfaces_=function(){return[]},Vi.prototype.getClass=function(){return Vi};var Mu=function(){};Mu.prototype.addIntersection=function(n,i){},Mu.prototype.interfaces_=function(){return[Vi]},Mu.prototype.getClass=function(){return Mu};var bn=function(){this._nodeList=new ur(this),this._pts=null,this._data=null;var n=arguments[0],i=arguments[1];this._pts=n,this._data=i};bn.prototype.getCoordinates=function(){return this._pts},bn.prototype.size=function(){return this._pts.length},bn.prototype.getCoordinate=function(n){return this._pts[n]},bn.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},bn.prototype.getSegmentOctant=function(n){return n===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(n),this.getCoordinate(n+1))},bn.prototype.setData=function(n){this._data=n},bn.prototype.safeOctant=function(n,i){return n.equals2D(i)?0:Ls.octant(n,i)},bn.prototype.getData=function(){return this._data},bn.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)}},bn.prototype.toString=function(){return qt.toLineString(new he(this._pts))},bn.prototype.getNodeList=function(){return this._nodeList},bn.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)},bn.prototype.addIntersections=function(n,i,s){for(var u=0;u<n.getIntersectionNum();u++)this.addIntersection(n,i,s,u)},bn.prototype.interfaces_=function(){return[Mu]},bn.prototype.getClass=function(){return bn},bn.getNodedSubstrings=function(){if(arguments.length===1){var n=arguments[0],i=new Q;return bn.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 $t=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)}},tm={serialVersionUID:{configurable:!0}};$t.prototype.minX=function(){return Math.min(this.p0.x,this.p1.x)},$t.prototype.orientationIndex=function(){if(arguments[0]instanceof $t){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)}},$t.prototype.toGeometry=function(n){return n.createLineString([this.p0,this.p1])},$t.prototype.isVertical=function(){return this.p0.x===this.p1.x},$t.prototype.equals=function(n){if(!(n instanceof $t))return!1;var i=n;return this.p0.equals(i.p0)&&this.p1.equals(i.p1)},$t.prototype.intersection=function(n){var i=new Z;return i.computeIntersection(this.p0,this.p1,n.p0,n.p1),i.hasIntersection()?i.getIntersection(0):null},$t.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 $t){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 $t(E,A)}},$t.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()},$t.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)},$t.prototype.getCoordinate=function(n){return n===0?this.p0:this.p1},$t.prototype.distancePerpendicular=function(n){return B.distancePointLinePerpendicular(n,this.p0,this.p1)},$t.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)},$t.prototype.midPoint=function(){return $t.midPoint(this.p0,this.p1)},$t.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?w.NaN:((n.x-this.p0.x)*i+(n.y-this.p0.y)*s)/u},$t.prototype.closestPoints=function(n){var i=this.intersection(n);if(i!==null)return[i,i];var s=new Array(2).fill(null),u=w.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},$t.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},$t.prototype.maxX=function(){return Math.max(this.p0.x,this.p1.x)},$t.prototype.getLength=function(){return this.p0.distance(this.p1)},$t.prototype.compareTo=function(n){var i=n,s=this.p0.compareTo(i.p0);return s!==0?s:this.p1.compareTo(i.p1)},$t.prototype.reverse=function(){var n=this.p0;this.p0=this.p1,this.p1=n},$t.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)},$t.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},$t.prototype.maxY=function(){return Math.max(this.p0.y,this.p1.y)},$t.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)},$t.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}},$t.prototype.segmentFraction=function(n){var i=this.projectionFactor(n);return i<0?i=0:(i>1||w.isNaN(i))&&(i=1),i},$t.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"},$t.prototype.isHorizontal=function(){return this.p0.y===this.p1.y},$t.prototype.distance=function(){if(arguments[0]instanceof $t){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)}},$t.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},$t.prototype.hashCode=function(){var n=w.doubleToLongBits(this.p0.x);n^=31*w.doubleToLongBits(this.p0.y);var i=Math.trunc(n)^Math.trunc(n>>32),s=w.doubleToLongBits(this.p1.x);return s^=31*w.doubleToLongBits(this.p1.y),i^(Math.trunc(s)^Math.trunc(s>>32))},$t.prototype.interfaces_=function(){return[F,t]},$t.prototype.getClass=function(){return $t},$t.midPoint=function(n,i){return new L((n.x+i.x)/2,(n.y+i.y)/2)},tm.serialVersionUID.get=function(){return 0x2d2172135f411c00},Object.defineProperties($t,tm);var wu=function(){this.tempEnv1=new Pt,this.tempEnv2=new Pt,this._overlapSeg1=new $t,this._overlapSeg2=new $t};wu.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)}}},wu.prototype.interfaces_=function(){return[]},wu.prototype.getClass=function(){return wu};var Dr=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};Dr.prototype.getLineSegment=function(n,i){i.p0=this._pts[n],i.p1=this._pts[n+1]},Dr.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)},Dr.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},Dr.prototype.computeOverlaps=function(n,i){this.computeOverlapsInternal(this._start,this._end,n,n._start,n._end,i)},Dr.prototype.setId=function(n){this._id=n},Dr.prototype.select=function(n,i){this.computeSelect(n,this._start,this._end,i)},Dr.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},Dr.prototype.getEndIndex=function(){return this._end},Dr.prototype.getStartIndex=function(){return this._start},Dr.prototype.getContext=function(){return this._context},Dr.prototype.getId=function(){return this._id},Dr.prototype.computeOverlapsInternal=function(n,i,s,u,c,m){var E=this._pts[n],A=this._pts[i],U=s._pts[u],$=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,$),!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))},Dr.prototype.interfaces_=function(){return[]},Dr.prototype.getClass=function(){return Dr};var Ci=function(){};Ci.prototype.interfaces_=function(){return[]},Ci.prototype.getClass=function(){return Ci},Ci.getChainStartIndices=function(n){var i=0,s=new Q;s.add(new et(i));do{var u=Ci.findChainEnd(n,i);s.add(new et(u)),i=u}while(i<n.length-1);return Ci.toIntArray(s)},Ci.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},Ci.getChains=function(){if(arguments.length===1){var n=arguments[0];return Ci.getChains(n,null)}if(arguments.length===2){for(var i=arguments[0],s=arguments[1],u=new Q,c=Ci.getChainStartIndices(i),m=0;m<c.length-1;m++){var E=new Dr(i,c[m],c[m+1],s);u.add(E)}return u}},Ci.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 ts=function(){};ts.prototype.computeNodes=function(n){},ts.prototype.getNodedSubstrings=function(){},ts.prototype.interfaces_=function(){return[]},ts.prototype.getClass=function(){return ts};var Su=function(){if(this._segInt=null,arguments.length!==0){if(arguments.length===1){var n=arguments[0];this.setSegmentIntersector(n)}}};Su.prototype.setSegmentIntersector=function(n){this._segInt=n},Su.prototype.interfaces_=function(){return[ts]},Su.prototype.getClass=function(){return Su};var Af=function(n){function i(u){u?n.call(this,u):n.call(this),this._monoChains=new Q,this._index=new Qd,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 bn.getNodedSubstrings(this._nodedSegStrings)},i.prototype.getIndex=function(){return this._index},i.prototype.add=function(u){for(var c=Ci.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 em(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 em},Object.defineProperties(i,s),i}(Su),em=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}(wu),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)}}},fo={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)},fo.CAP_ROUND.get=function(){return 1},fo.CAP_FLAT.get=function(){return 2},fo.CAP_SQUARE.get=function(){return 3},fo.JOIN_ROUND.get=function(){return 1},fo.JOIN_MITRE.get=function(){return 2},fo.JOIN_BEVEL.get=function(){return 3},fo.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8},fo.DEFAULT_MITRE_LIMIT.get=function(){return 5},fo.DEFAULT_SIMPLIFY_FACTOR.get=function(){return .01},Object.defineProperties(We,fo);var wn=function(n){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=B.COUNTERCLOCKWISE,this._inputLine=n||null},bu={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};wn.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)},wn.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]=wn.DELETE,c=!0,u=!0),n=c?s:i,i=this.findNextNonDeletedIndex(n),s=this.findNextNonDeletedIndex(i)}return u},wn.prototype.isShallowConcavity=function(n,i,s,u){return B.computeOrientation(n,i,s)!==this._angleOrientation?!1:B.distancePointLine(i,n,s)<u},wn.prototype.isShallowSampled=function(n,i,s,u,c){var m=Math.trunc((u-s)/wn.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},wn.prototype.isConcave=function(n,i,s){var u=B.computeOrientation(n,i,s)===this._angleOrientation;return u},wn.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()},wn.prototype.findNextNonDeletedIndex=function(n){for(var i=n+1;i<this._inputLine.length&&this._isDeleted[i]===wn.DELETE;)i++;return i},wn.prototype.isShallow=function(n,i,s,u){return B.distancePointLine(i,n,s)<u},wn.prototype.collapseLine=function(){for(var n=new Dt,i=0;i<this._inputLine.length;i++)this._isDeleted[i]!==wn.DELETE&&n.add(this._inputLine[i]);return n.toCoordinateArray()},wn.prototype.interfaces_=function(){return[]},wn.prototype.getClass=function(){return wn},wn.simplify=function(n,i){return new wn(n).simplify(i)},bu.INIT.get=function(){return 0},bu.DELETE.get=function(){return 1},bu.KEEP.get=function(){return 1},bu.NUM_PTS_TO_CHECK.get=function(){return 10},Object.defineProperties(wn,bu);var qr=function(){this._ptList=null,this._precisionModel=null,this._minimimVertexDistance=0,this._ptList=new Q},nm={COORDINATE_ARRAY_TYPE:{configurable:!0}};qr.prototype.getCoordinates=function(){return this._ptList.toArray(qr.COORDINATE_ARRAY_TYPE)},qr.prototype.setPrecisionModel=function(n){this._precisionModel=n},qr.prototype.addPt=function(n){var i=new L(n);if(this._precisionModel.makePrecise(i),this.isRedundant(i))return null;this._ptList.add(i)},qr.prototype.revere=function(){},qr.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])},qr.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},qr.prototype.toString=function(){return new le().createLineString(this.getCoordinates()).toString()},qr.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)},qr.prototype.setMinimumVertexDistance=function(n){this._minimimVertexDistance=n},qr.prototype.interfaces_=function(){return[]},qr.prototype.getClass=function(){return qr},nm.COORDINATE_ARRAY_TYPE.get=function(){return new Array(0).fill(null)},Object.defineProperties(qr,nm);var me=function(){},Ns={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},Ns.PI_TIMES_2.get=function(){return 2*Math.PI},Ns.PI_OVER_2.get=function(){return Math.PI/2},Ns.PI_OVER_4.get=function(){return Math.PI/4},Ns.COUNTERCLOCKWISE.get=function(){return B.COUNTERCLOCKWISE},Ns.CLOCKWISE.get=function(){return B.CLOCKWISE},Ns.NONE.get=function(){return B.COLLINEAR},Object.defineProperties(me,Ns);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 $t,this._seg1=new $t,this._offset0=new $t,this._offset1=new $t,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 Z,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)},Tu={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 $t(n,i),u=new $t;this.computeOffsetSegment(s,bt.LEFT,this._distance,u);var c=new $t;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 $=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($),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,$=s.y-n.y,ut=Math.atan2($,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),$=u*s,ut=s-$*Math.abs(Math.sin(E)),ht=c.x+$*Math.cos(U),At=c.y+$*Math.sin(U),Rt=new L(ht,At),kt=new $t(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,$=c*s*E/A;u.p0.x=n.p0.x-$,u.p0.y=n.p0.y+U,u.p1.x=n.p1.x-$,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,$=0,ut=new L;$<E;){var ht=i+m*$;ut.x=n.x+c*Math.cos(ht),ut.y=n.y+c*Math.sin(ht),this._segList.addPt(ut),$+=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 qr,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},Tu.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return .001},Tu.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return .001},Tu.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6},Tu.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80},Object.defineProperties(pn,Tu);var wr=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var n=arguments[0],i=arguments[1];this._precisionModel=n,this._bufParams=i};wr.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},wr.prototype.computeSingleSidedBufferCurve=function(n,i,s){var u=this.simplifyTolerance(this._distance);if(i){s.addSegments(n,!0);var c=wn.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=wn.simplify(n,u),U=A.length-1;s.initSideSegments(A[0],A[1],bt.LEFT),s.addFirstSegment();for(var $=2;$<=U;$++)s.addNextSegment(A[$],!0)}s.addLastSegment(),s.closeRing()},wr.prototype.computeRingBufferCurve=function(n,i,s){var u=this.simplifyTolerance(this._distance);i===bt.RIGHT&&(u=-u);var c=wn.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()},wr.prototype.computeLineBufferCurve=function(n,i){var s=this.simplifyTolerance(this._distance),u=wn.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=wn.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()},wr.prototype.computePointCurve=function(n,i){switch(this._bufParams.getEndCapStyle()){case We.CAP_ROUND:i.createCircle(n);break;case We.CAP_SQUARE:i.createSquare(n)}},wr.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()},wr.prototype.getBufferParameters=function(){return this._bufParams},wr.prototype.simplifyTolerance=function(n){return n*this._bufParams.getSimplifyFactor()},wr.prototype.getRingCurve=function(n,i,s){if(this._distance=s,n.length<=2)return this.getLineCurve(n,s);if(s===0)return wr.copyCoordinates(n);var u=this.getSegGen(s);return this.computeRingBufferCurve(n,i,u),u.getCoordinates()},wr.prototype.computeOffsetCurve=function(n,i,s){var u=this.simplifyTolerance(this._distance);if(i){var c=wn.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=wn.simplify(n,u),U=A.length-1;s.initSideSegments(A[0],A[1],bt.LEFT),s.addFirstSegment();for(var $=2;$<=U;$++)s.addNextSegment(A[$],!0)}s.addLastSegment()},wr.prototype.getSegGen=function(n){return new pn(this._precisionModel,this._bufParams,n)},wr.prototype.interfaces_=function(){return[]},wr.prototype.getClass=function(){return wr},wr.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 Os=function(){this._subgraphs=null,this._seg=new $t,this._cga=new B;var n=arguments[0];this._subgraphs=n},rm={DepthSegment:{configurable:!0}};Os.prototype.findStabbedSegments=function(){if(arguments.length===1){for(var n=arguments[0],i=new Q,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],St)&&arguments[0]instanceof L&&arguments[1]instanceof Tf){for(var m=arguments[0],E=arguments[1],A=arguments[2],U=E.getEdge().getCoordinates(),$=0;$<U.length-1;$++)if(this._seg.p0=U[$],this._seg.p1=U[$+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[$])||(ut=E.getDepth(bt.RIGHT));var ht=new es(this._seg,ut);A.add(ht)}}else if(X(arguments[2],St)&&arguments[0]instanceof L&&X(arguments[1],St))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)}}},Os.prototype.getDepth=function(n){var i=this.findStabbedSegments(n);return i.size()===0?0:gi.min(i)._leftDepth},Os.prototype.interfaces_=function(){return[]},Os.prototype.getClass=function(){return Os},rm.DepthSegment.get=function(){return es},Object.defineProperties(Os,rm);var es=function(){this._upwardSeg=null,this._leftDepth=null;var n=arguments[0],i=arguments[1];this._upwardSeg=new $t(n),this._leftDepth=i};es.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)},es.prototype.compareX=function(n,i){var s=n.p0.compareTo(i.p0);return s!==0?s:n.p1.compareTo(i.p1)},es.prototype.toString=function(){return this._upwardSeg.toString()},es.prototype.interfaces_=function(){return[F]},es.prototype.getClass=function(){return es};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,$=u.y-m,ut=E*$-A*U,ht=n.x-c,At=n.y-m,Rt=($*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,$=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/$,c+ht/$)},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,$=c*U-m*A,ut=m*E-u*U,ht=u*A-c*E,At=$*$+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 oi=function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new Q;var n=arguments[0],i=arguments[1],s=arguments[2];this._inputGeom=n,this._distance=i,this._curveBuilder=s};oi.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)},oi.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)}},oi.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)},oi.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)},oi.prototype.addCurve=function(n,i,s){if(n===null||n.length<2)return null;var u=new bn(n,new rn(0,k.BOUNDARY,i,s));this._curveList.add(u)},oi.prototype.getCurves=function(){return this.add(this._inputGeom),this._curveList},oi.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)},oi.prototype.add=function(n){if(n.isEmpty())return null;n instanceof Vt?this.addPolygon(n):n instanceof Bt?this.addLineString(n):n instanceof jt?this.addPoint(n):n instanceof fe?this.addCollection(n):n instanceof H?this.addCollection(n):n instanceof un?this.addCollection(n):n instanceof Hn&&this.addCollection(n)},oi.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},oi.prototype.addCollection=function(n){for(var i=0;i<n.getNumGeometries();i++){var s=n.getGeometryN(i);this.add(s)}},oi.prototype.interfaces_=function(){return[]},oi.prototype.getClass=function(){return oi};var da=function(){};da.prototype.locate=function(n){},da.prototype.interfaces_=function(){return[]},da.prototype.getClass=function(){return da};var Hi=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()};Hi.prototype.next=function(){if(this._atStart)return this._atStart=!1,Hi.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 Hn?(this._subcollectionIterator=new Hi(n),this._subcollectionIterator.next()):n},Hi.prototype.remove=function(){throw new Error(this.getClass().getName())},Hi.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)},Hi.prototype.interfaces_=function(){return[Y]},Hi.prototype.getClass=function(){return Hi},Hi.isAtomic=function(n){return!(n instanceof Hn)};var Xr=function(){this._geom=null;var n=arguments[0];this._geom=n};Xr.prototype.locate=function(n){return Xr.locate(n,this._geom)},Xr.prototype.interfaces_=function(){return[da]},Xr.prototype.getClass=function(){return Xr},Xr.isPointInRing=function(n,i){return!!i.getEnvelopeInternal().intersects(n)&&B.isPointInRing(n,i.getCoordinates())},Xr.containsPointInPolygon=function(n,i){if(i.isEmpty())return!1;var s=i.getExteriorRing();if(!Xr.isPointInRing(n,s))return!1;for(var u=0;u<i.getNumInteriorRing();u++){var c=i.getInteriorRingN(u);if(Xr.isPointInRing(n,c))return!1}return!0},Xr.containsPoint=function(n,i){if(i instanceof Vt)return Xr.containsPointInPolygon(n,i);if(i instanceof Hn)for(var s=new Hi(i);s.hasNext();){var u=s.next();if(u!==i&&Xr.containsPoint(n,u))return!0}return!1},Xr.locate=function(n,i){return i.isEmpty()?k.EXTERIOR:Xr.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),$=A.getLocation(n,bt.RIGHT);if($!==k.NONE){if($!==c)throw new lo("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 Q(this._edgeMap.values())),this._edgeList},jn.prototype.getLocation=function(n,i,s){return this._ptInAreaLocation[n]===k.NONE&&(this._ptInAreaLocation[n]=Xr.locate(i,s[n].getGeometry())),this._ptInAreaLocation[n]},jn.prototype.toString=function(){var n=new pt;n.append("EdgeEndStar: "+this.getCoordinate()),n.append(\`
93
93
  \`);for(var i=this.iterator();i.hasNext();){var s=i.next();n.append(s),n.append(\`
@@ -3773,7 +3773,7 @@ three/build/three.module.js:
3773
3773
  * along with MarchingSquaresJS. If not, see <http://www.gnu.org/licenses/>.
3774
3774
  *)
3775
3775
  */
3776
- `)}var A=require("three");var y=require("three"),k=class extends y.BufferGeometry{constructor(){super(),this.isMeshLine=!0,this.type="MeshLine",this.positions=[],this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[],this.counters=[],this._points=[],this._geom=null,this.widthCallback=null,this.matrixWorld=new y.Matrix4,Object.defineProperties(this,{geometry:{enumerable:!0,get:function(){return this}},geom:{enumerable:!0,get:function(){return this._geom},set:function(n){this.setGeometry(n,this.widthCallback)}},points:{enumerable:!0,get:function(){return this._points},set:function(n){this.setPoints(n,this.widthCallback)}}})}};k.prototype.setMatrixWorld=function(o){this.matrixWorld=o};k.prototype.setGeometry=function(o,n){this._geometry=o,this.setPoints(o.getAttribute("position").array,n)};k.prototype.setPoints=function(o,n){if(!(o instanceof Float32Array)&&!(o instanceof Array)){console.error("ERROR: The BufferArray of points is not instancied correctly.");return}if(this._points=o,this.widthCallback=n,this.positions=[],this.counters=[],o.length&&o[0]instanceof y.Vector3)for(var t=0;t<o.length;t++){var e=o[t],r=t/o.length;this.positions.push(e.x,e.y,e.z),this.positions.push(e.x,e.y,e.z),this.counters.push(r),this.counters.push(r)}else for(var t=0;t<o.length;t+=3){var r=t/o.length;this.positions.push(o[t],o[t+1],o[t+2]),this.positions.push(o[t],o[t+1],o[t+2]),this.counters.push(r),this.counters.push(r)}this.process()};function Ur(o,n){var t=new y.Matrix4,e=new y.Ray,r=new y.Sphere,i=new y.Vector3,s=this.geometry;if(s.boundingSphere||s.computeBoundingSphere(),r.copy(s.boundingSphere),r.applyMatrix4(this.matrixWorld),o.ray.intersectSphere(r,i)!==!1){t.copy(this.matrixWorld).invert(),e.copy(o.ray).applyMatrix4(t);var l=new y.Vector3,u=new y.Vector3,a=new y.Vector3,c=this instanceof y.LineSegments?2:1,p=s.index,d=s.attributes;if(p!==null)for(var m=p.array,g=d.position.array,h=d.width.array,f=0,v=m.length-1;f<v;f+=c){var w=m[f],T=m[f+1];l.fromArray(g,w*3),u.fromArray(g,T*3);var M=h[Math.floor(f/3)]!==void 0?h[Math.floor(f/3)]:1,O=o.params.Line.threshold+this.material.lineWidth*M/2,N=O*O,Yt=e.distanceSqToSegment(l,u,i,a);if(!(Yt>N)){i.applyMatrix4(this.matrixWorld);var $t=o.ray.origin.distanceTo(i);$t<o.near||$t>o.far||(n.push({distance:$t,point:a.clone().applyMatrix4(this.matrixWorld),index:f,face:null,faceIndex:null,object:this}),f=v)}}}}k.prototype.raycast=Ur;k.prototype.compareV3=function(o,n){var t=o*6,e=n*6;return this.positions[t]===this.positions[e]&&this.positions[t+1]===this.positions[e+1]&&this.positions[t+2]===this.positions[e+2]};k.prototype.copyV3=function(o){var n=o*6;return[this.positions[n],this.positions[n+1],this.positions[n+2]]};k.prototype.getDistance=function(o){let n=0;for(let t=0;t<o;t++){let e=6*t,r=new y.Vector3(this.positions[e],this.positions[e+1],this.positions[e+2]),i=new y.Vector3(this.positions[e+6],this.positions[e+7],this.positions[e+8]),s=r.distanceTo(i);n+=s}return n};k.prototype.process=function(){var o=this.positions.length/6;this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[];var n;let t=this.getDistance(o-1);var e;this.compareV3(0,o-1)?e=this.copyV3(o-2):e=this.copyV3(0),this.previous.push(e[0],e[1],e[2]),this.previous.push(e[0],e[1],e[2]);for(var r=0;r<o;r++){if(this.side.push(1),this.side.push(-1),this.widthCallback?n=this.widthCallback(r/(o-1)):n=1,this.width.push(n),this.width.push(n),r===0)this.uvs.push(0,0),this.uvs.push(0,1);else if(r===o-1)this.uvs.push(1,0),this.uvs.push(1,1);else{let s=this.getDistance(r)/t;this.uvs.push(s,0),this.uvs.push(s,1)}if(r<o-1){e=this.copyV3(r),this.previous.push(e[0],e[1],e[2]),this.previous.push(e[0],e[1],e[2]);var i=r*2;this.indices_array.push(i,i+1,i+2),this.indices_array.push(i+2,i+1,i+3)}r>0&&(e=this.copyV3(r),this.next.push(e[0],e[1],e[2]),this.next.push(e[0],e[1],e[2]))}this.compareV3(o-1,0)?e=this.copyV3(1):e=this.copyV3(o-1),this.next.push(e[0],e[1],e[2]),this.next.push(e[0],e[1],e[2]),!this._attributes||this._attributes.position.count!==this.positions.length?this._attributes={position:new y.BufferAttribute(new Float32Array(this.positions),3),previous:new y.BufferAttribute(new Float32Array(this.previous),3),next:new y.BufferAttribute(new Float32Array(this.next),3),side:new y.BufferAttribute(new Float32Array(this.side),1),width:new y.BufferAttribute(new Float32Array(this.width),1),uv:new y.BufferAttribute(new Float32Array(this.uvs),2),index:new y.BufferAttribute(new Uint16Array(this.indices_array),1),counters:new y.BufferAttribute(new Float32Array(this.counters),1)}:(this._attributes.position.copyArray(new Float32Array(this.positions)),this._attributes.position.needsUpdate=!0,this._attributes.previous.copyArray(new Float32Array(this.previous)),this._attributes.previous.needsUpdate=!0,this._attributes.next.copyArray(new Float32Array(this.next)),this._attributes.next.needsUpdate=!0,this._attributes.side.copyArray(new Float32Array(this.side)),this._attributes.side.needsUpdate=!0,this._attributes.width.copyArray(new Float32Array(this.width)),this._attributes.width.needsUpdate=!0,this._attributes.uv.copyArray(new Float32Array(this.uvs)),this._attributes.uv.needsUpdate=!0,this._attributes.index.copyArray(new Uint16Array(this.indices_array)),this._attributes.index.needsUpdate=!0),this.setAttribute("position",this._attributes.position),this.setAttribute("previous",this._attributes.previous),this.setAttribute("next",this._attributes.next),this.setAttribute("side",this._attributes.side),this.setAttribute("width",this._attributes.width),this.setAttribute("uv",this._attributes.uv),this.setAttribute("counters",this._attributes.counters),this.setIndex(this._attributes.index),this.computeBoundingSphere(),this.computeBoundingBox()};function Qe(o,n,t,e,r){var i;if(o=o.subarray||o.slice?o:o.buffer,t=t.subarray||t.slice?t:t.buffer,o=n?o.subarray?o.subarray(n,r&&n+r):o.slice(n,r&&n+r):o,t.set)t.set(o,e);else for(i=0;i<o.length;i++)t[i+e]=o[i];return t}k.prototype.advance=function(o){var n=this._attributes.position.array,t=this._attributes.previous.array,e=this._attributes.next.array,r=n.length;Qe(n,0,t,0,r),Qe(n,6,n,0,r-6),n[r-6]=o.x,n[r-5]=o.y,n[r-4]=o.z,n[r-3]=o.x,n[r-2]=o.y,n[r-1]=o.z,Qe(n,6,e,0,r-6),e[r-6]=o.x,e[r-5]=o.y,e[r-4]=o.z,e[r-3]=o.x,e[r-2]=o.y,e[r-1]=o.z,this._attributes.position.needsUpdate=!0,this._attributes.previous.needsUpdate=!0,this._attributes.next.needsUpdate=!0};y.ShaderChunk.meshline_vert=["",y.ShaderChunk.logdepthbuf_pars_vertex,y.ShaderChunk.fog_pars_vertex,"","attribute vec3 previous;","attribute vec3 next;","attribute float side;","attribute float width;","attribute float counters;","","uniform vec2 resolution;","uniform float lineWidth;","uniform vec3 color;","uniform float opacity;","uniform float sizeAttenuation;","","varying vec2 vUV;","varying vec4 vColor;","varying float vCounters;","","vec2 fix( vec4 i, float aspect ) {",""," vec2 res = i.xy / i.w;"," res.x *= aspect;"," vCounters = counters;"," return res;","","}","","void main() {",""," float aspect = resolution.x / resolution.y;",""," vColor = vec4( color, opacity );"," vUV = uv;",""," mat4 m = projectionMatrix * modelViewMatrix;"," vec4 finalPosition = m * vec4( position, 1.0 );"," vec4 prevPos = m * vec4( previous, 1.0 );"," vec4 nextPos = m * vec4( next, 1.0 );",""," vec2 currentP = fix( finalPosition, aspect );"," vec2 prevP = fix( prevPos, aspect );"," vec2 nextP = fix( nextPos, aspect );",""," float w = lineWidth * width;",""," vec2 dir;"," if( nextP == currentP ) dir = normalize( currentP - prevP );"," else if( prevP == currentP ) dir = normalize( nextP - currentP );"," else {"," vec2 dir1 = normalize( currentP - prevP );"," vec2 dir2 = normalize( nextP - currentP );"," dir = normalize( dir1 + dir2 );",""," vec2 perp = vec2( -dir1.y, dir1.x );"," vec2 miter = vec2( -dir.y, dir.x );"," //w = clamp( w / dot( miter, perp ), 0., 4. * lineWidth * width );",""," }",""," //vec2 normal = ( cross( vec3( dir, 0. ), vec3( 0., 0., 1. ) ) ).xy;"," vec4 normal = vec4( -dir.y, dir.x, 0., 1. );"," normal.xy *= .5 * w;"," normal *= projectionMatrix;"," if( sizeAttenuation == 0. ) {"," normal.xy *= finalPosition.w;"," normal.xy /= ( vec4( resolution, 0., 1. ) * projectionMatrix ).xy;"," }",""," finalPosition.xy += normal.xy * side;",""," gl_Position = finalPosition;","",y.ShaderChunk.logdepthbuf_vertex,y.ShaderChunk.fog_vertex&&" vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",y.ShaderChunk.fog_vertex,"}"].join(`
3776
+ `)}var A=require("three");var y=require("three"),k=class extends y.BufferGeometry{constructor(){super(),this.isMeshLine=!0,this.type="MeshLine",this.positions=[],this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[],this.counters=[],this._points=[],this._geom=null,this.widthCallback=null,this.matrixWorld=new y.Matrix4,Object.defineProperties(this,{geometry:{enumerable:!0,get:function(){return this}},geom:{enumerable:!0,get:function(){return this._geom},set:function(n){this.setGeometry(n,this.widthCallback)}},points:{enumerable:!0,get:function(){return this._points},set:function(n){this.setPoints(n,this.widthCallback)}}})}};k.prototype.setMatrixWorld=function(o){this.matrixWorld=o};k.prototype.setGeometry=function(o,n){this._geometry=o,this.setPoints(o.getAttribute("position").array,n)};k.prototype.setPoints=function(o,n){if(!(o instanceof Float32Array)&&!(o instanceof Array)){console.error("ERROR: The BufferArray of points is not instancied correctly.");return}if(this._points=o,this.widthCallback=n,this.positions=[],this.counters=[],o.length&&o[0]instanceof y.Vector3)for(var t=0;t<o.length;t++){var e=o[t],r=t/o.length;this.positions.push(e.x,e.y,e.z),this.positions.push(e.x,e.y,e.z),this.counters.push(r),this.counters.push(r)}else for(var t=0;t<o.length;t+=3){var r=t/o.length;this.positions.push(o[t],o[t+1],o[t+2]),this.positions.push(o[t],o[t+1],o[t+2]),this.counters.push(r),this.counters.push(r)}this.process()};function Ur(o,n){var t=new y.Matrix4,e=new y.Ray,r=new y.Sphere,i=new y.Vector3,s=this.geometry;if(s.boundingSphere||s.computeBoundingSphere(),r.copy(s.boundingSphere),r.applyMatrix4(this.matrixWorld),o.ray.intersectSphere(r,i)!==!1){t.copy(this.matrixWorld).invert(),e.copy(o.ray).applyMatrix4(t);var l=new y.Vector3,u=new y.Vector3,a=new y.Vector3,c=this instanceof y.LineSegments?2:1,p=s.index,d=s.attributes;if(p!==null)for(var m=p.array,g=d.position.array,h=d.width.array,f=0,x=m.length-1;f<x;f+=c){var v=m[f],T=m[f+1];l.fromArray(g,v*3),u.fromArray(g,T*3);var S=h[Math.floor(f/3)]!==void 0?h[Math.floor(f/3)]:1,O=o.params.Line.threshold+this.material.lineWidth*S/2,N=O*O,Yt=e.distanceSqToSegment(l,u,i,a);if(!(Yt>N)){i.applyMatrix4(this.matrixWorld);var $t=o.ray.origin.distanceTo(i);$t<o.near||$t>o.far||(n.push({distance:$t,point:a.clone().applyMatrix4(this.matrixWorld),index:f,face:null,faceIndex:null,object:this}),f=x)}}}}k.prototype.raycast=Ur;k.prototype.compareV3=function(o,n){var t=o*6,e=n*6;return this.positions[t]===this.positions[e]&&this.positions[t+1]===this.positions[e+1]&&this.positions[t+2]===this.positions[e+2]};k.prototype.copyV3=function(o){var n=o*6;return[this.positions[n],this.positions[n+1],this.positions[n+2]]};k.prototype.getDistance=function(o){let n=0;for(let t=0;t<o;t++){let e=6*t,r=new y.Vector3(this.positions[e],this.positions[e+1],this.positions[e+2]),i=new y.Vector3(this.positions[e+6],this.positions[e+7],this.positions[e+8]),s=r.distanceTo(i);n+=s}return n};k.prototype.process=function(){var o=this.positions.length/6;this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[];var n;let t=this.getDistance(o-1);var e;this.compareV3(0,o-1)?e=this.copyV3(o-2):e=this.copyV3(0),this.previous.push(e[0],e[1],e[2]),this.previous.push(e[0],e[1],e[2]);for(var r=0;r<o;r++){if(this.side.push(1),this.side.push(-1),this.widthCallback?n=this.widthCallback(r/(o-1)):n=1,this.width.push(n),this.width.push(n),r===0)this.uvs.push(0,0),this.uvs.push(0,1);else if(r===o-1)this.uvs.push(1,0),this.uvs.push(1,1);else{let s=this.getDistance(r)/t;this.uvs.push(s,0),this.uvs.push(s,1)}if(r<o-1){e=this.copyV3(r),this.previous.push(e[0],e[1],e[2]),this.previous.push(e[0],e[1],e[2]);var i=r*2;this.indices_array.push(i,i+1,i+2),this.indices_array.push(i+2,i+1,i+3)}r>0&&(e=this.copyV3(r),this.next.push(e[0],e[1],e[2]),this.next.push(e[0],e[1],e[2]))}this.compareV3(o-1,0)?e=this.copyV3(1):e=this.copyV3(o-1),this.next.push(e[0],e[1],e[2]),this.next.push(e[0],e[1],e[2]),!this._attributes||this._attributes.position.count!==this.positions.length?this._attributes={position:new y.BufferAttribute(new Float32Array(this.positions),3),previous:new y.BufferAttribute(new Float32Array(this.previous),3),next:new y.BufferAttribute(new Float32Array(this.next),3),side:new y.BufferAttribute(new Float32Array(this.side),1),width:new y.BufferAttribute(new Float32Array(this.width),1),uv:new y.BufferAttribute(new Float32Array(this.uvs),2),index:new y.BufferAttribute(new Uint16Array(this.indices_array),1),counters:new y.BufferAttribute(new Float32Array(this.counters),1)}:(this._attributes.position.copyArray(new Float32Array(this.positions)),this._attributes.position.needsUpdate=!0,this._attributes.previous.copyArray(new Float32Array(this.previous)),this._attributes.previous.needsUpdate=!0,this._attributes.next.copyArray(new Float32Array(this.next)),this._attributes.next.needsUpdate=!0,this._attributes.side.copyArray(new Float32Array(this.side)),this._attributes.side.needsUpdate=!0,this._attributes.width.copyArray(new Float32Array(this.width)),this._attributes.width.needsUpdate=!0,this._attributes.uv.copyArray(new Float32Array(this.uvs)),this._attributes.uv.needsUpdate=!0,this._attributes.index.copyArray(new Uint16Array(this.indices_array)),this._attributes.index.needsUpdate=!0),this.setAttribute("position",this._attributes.position),this.setAttribute("previous",this._attributes.previous),this.setAttribute("next",this._attributes.next),this.setAttribute("side",this._attributes.side),this.setAttribute("width",this._attributes.width),this.setAttribute("uv",this._attributes.uv),this.setAttribute("counters",this._attributes.counters),this.setIndex(this._attributes.index),this.computeBoundingSphere(),this.computeBoundingBox()};function Qe(o,n,t,e,r){var i;if(o=o.subarray||o.slice?o:o.buffer,t=t.subarray||t.slice?t:t.buffer,o=n?o.subarray?o.subarray(n,r&&n+r):o.slice(n,r&&n+r):o,t.set)t.set(o,e);else for(i=0;i<o.length;i++)t[i+e]=o[i];return t}k.prototype.advance=function(o){var n=this._attributes.position.array,t=this._attributes.previous.array,e=this._attributes.next.array,r=n.length;Qe(n,0,t,0,r),Qe(n,6,n,0,r-6),n[r-6]=o.x,n[r-5]=o.y,n[r-4]=o.z,n[r-3]=o.x,n[r-2]=o.y,n[r-1]=o.z,Qe(n,6,e,0,r-6),e[r-6]=o.x,e[r-5]=o.y,e[r-4]=o.z,e[r-3]=o.x,e[r-2]=o.y,e[r-1]=o.z,this._attributes.position.needsUpdate=!0,this._attributes.previous.needsUpdate=!0,this._attributes.next.needsUpdate=!0};y.ShaderChunk.meshline_vert=["",y.ShaderChunk.logdepthbuf_pars_vertex,y.ShaderChunk.fog_pars_vertex,"","attribute vec3 previous;","attribute vec3 next;","attribute float side;","attribute float width;","attribute float counters;","","uniform vec2 resolution;","uniform float lineWidth;","uniform vec3 color;","uniform float opacity;","uniform float sizeAttenuation;","","varying vec2 vUV;","varying vec4 vColor;","varying float vCounters;","","vec2 fix( vec4 i, float aspect ) {",""," vec2 res = i.xy / i.w;"," res.x *= aspect;"," vCounters = counters;"," return res;","","}","","void main() {",""," float aspect = resolution.x / resolution.y;",""," vColor = vec4( color, opacity );"," vUV = uv;",""," mat4 m = projectionMatrix * modelViewMatrix;"," vec4 finalPosition = m * vec4( position, 1.0 );"," vec4 prevPos = m * vec4( previous, 1.0 );"," vec4 nextPos = m * vec4( next, 1.0 );",""," vec2 currentP = fix( finalPosition, aspect );"," vec2 prevP = fix( prevPos, aspect );"," vec2 nextP = fix( nextPos, aspect );",""," float w = lineWidth * width;",""," vec2 dir;"," if( nextP == currentP ) dir = normalize( currentP - prevP );"," else if( prevP == currentP ) dir = normalize( nextP - currentP );"," else {"," vec2 dir1 = normalize( currentP - prevP );"," vec2 dir2 = normalize( nextP - currentP );"," dir = normalize( dir1 + dir2 );",""," vec2 perp = vec2( -dir1.y, dir1.x );"," vec2 miter = vec2( -dir.y, dir.x );"," //w = clamp( w / dot( miter, perp ), 0., 4. * lineWidth * width );",""," }",""," //vec2 normal = ( cross( vec3( dir, 0. ), vec3( 0., 0., 1. ) ) ).xy;"," vec4 normal = vec4( -dir.y, dir.x, 0., 1. );"," normal.xy *= .5 * w;"," normal *= projectionMatrix;"," if( sizeAttenuation == 0. ) {"," normal.xy *= finalPosition.w;"," normal.xy /= ( vec4( resolution, 0., 1. ) * projectionMatrix ).xy;"," }",""," finalPosition.xy += normal.xy * side;",""," gl_Position = finalPosition;","",y.ShaderChunk.logdepthbuf_vertex,y.ShaderChunk.fog_vertex&&" vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",y.ShaderChunk.fog_vertex,"}"].join(`
3777
3777
  `);y.ShaderChunk.meshline_frag=["",y.ShaderChunk.fog_pars_fragment,y.ShaderChunk.logdepthbuf_pars_fragment,"","uniform sampler2D map;","uniform sampler2D alphaMap;","uniform float useMap;","uniform float useAlphaMap;","uniform float useDash;","uniform float dashArray;","uniform float dashOffset;","uniform float dashRatio;","uniform float visibility;","uniform float alphaTest;","uniform vec2 repeat;","","varying vec2 vUV;","varying vec4 vColor;","varying float vCounters;","","void main() {","",y.ShaderChunk.logdepthbuf_fragment,""," vec4 c = vColor;"," if( useMap == 1. ) c *= texture2D( map, vUV * repeat );"," if( useAlphaMap == 1. ) c.a *= texture2D( alphaMap, vUV * repeat ).a;"," if( c.a < alphaTest ) discard;"," if( useDash == 1. ){"," c.a *= ceil(mod(vCounters + dashOffset, dashArray) - (dashArray * dashRatio));"," }"," gl_FragColor = c;"," gl_FragColor.a *= step(vCounters, visibility);","",y.ShaderChunk.fog_fragment,"}"].join(`
3778
- `);var jt=class extends y.ShaderMaterial{constructor(n){super({uniforms:Object.assign({},y.UniformsLib.fog,{lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},color:{value:new y.Color(16777215)},opacity:{value:1},resolution:{value:new y.Vector2(1,1)},sizeAttenuation:{value:1},dashArray:{value:0},dashOffset:{value:0},dashRatio:{value:.5},useDash:{value:0},visibility:{value:1},alphaTest:{value:0},repeat:{value:new y.Vector2(1,1)}}),vertexShader:y.ShaderChunk.meshline_vert,fragmentShader:y.ShaderChunk.meshline_frag}),this.isMeshLineMaterial=!0,this.type="MeshLineMaterial",Object.defineProperties(this,{lineWidth:{enumerable:!0,get:function(){return this.uniforms.lineWidth.value},set:function(t){this.uniforms.lineWidth.value=t}},map:{enumerable:!0,get:function(){return this.uniforms.map.value},set:function(t){this.uniforms.map.value=t}},useMap:{enumerable:!0,get:function(){return this.uniforms.useMap.value},set:function(t){this.uniforms.useMap.value=t}},alphaMap:{enumerable:!0,get:function(){return this.uniforms.alphaMap.value},set:function(t){this.uniforms.alphaMap.value=t}},useAlphaMap:{enumerable:!0,get:function(){return this.uniforms.useAlphaMap.value},set:function(t){this.uniforms.useAlphaMap.value=t}},color:{enumerable:!0,get:function(){return this.uniforms.color.value},set:function(t){this.uniforms.color.value=t}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(t){this.uniforms.opacity.value=t}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(t){this.uniforms.resolution.value.copy(t)}},sizeAttenuation:{enumerable:!0,get:function(){return this.uniforms.sizeAttenuation.value},set:function(t){this.uniforms.sizeAttenuation.value=t}},dashArray:{enumerable:!0,get:function(){return this.uniforms.dashArray.value},set:function(t){this.uniforms.dashArray.value=t,this.useDash=t!==0?1:0}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(t){this.uniforms.dashOffset.value=t}},dashRatio:{enumerable:!0,get:function(){return this.uniforms.dashRatio.value},set:function(t){this.uniforms.dashRatio.value=t}},useDash:{enumerable:!0,get:function(){return this.uniforms.useDash.value},set:function(t){this.uniforms.useDash.value=t}},visibility:{enumerable:!0,get:function(){return this.uniforms.visibility.value},set:function(t){this.uniforms.visibility.value=t}},alphaTest:{enumerable:!0,get:function(){return this.uniforms.alphaTest.value},set:function(t){this.uniforms.alphaTest.value=t}},repeat:{enumerable:!0,get:function(){return this.uniforms.repeat.value},set:function(t){this.uniforms.repeat.value.copy(t)}}}),this.setValues(n)}};jt.prototype.copy=function(o){return y.ShaderMaterial.prototype.copy.call(this,o),this.lineWidth=o.lineWidth,this.map=o.map,this.useMap=o.useMap,this.alphaMap=o.alphaMap,this.useAlphaMap=o.useAlphaMap,this.color.copy(o.color),this.opacity=o.opacity,this.resolution.copy(o.resolution),this.sizeAttenuation=o.sizeAttenuation,this.dashArray.copy(o.dashArray),this.dashOffset.copy(o.dashOffset),this.dashRatio.copy(o.dashRatio),this.useDash=o.useDash,this.visibility=o.visibility,this.alphaTest=o.alphaTest,this.repeat.copy(o.repeat),this};var nr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAAAQCAMAAACROYkbAAABrVBMVEVsjPdsjPdqi/doifdpivdrjPdsjPdsjPd/m/igtfqTq/lykfdri/dsjPdtjfe/zPv8/f/w8/6zw/p0kvdri/dsjPdtjffU3vz////////3+f62xfpzkfdri/dsjPdsjPeZr/nr8P7////////4+f62xfp0kvdri/dsjPdsjPdujveXrvne5v3////////3+f63x/t2lPdri/dsjPdsjPdsjPdri/eMpfjb4/3+/v/////4+v+7yft1k/dri/dsjPdsjPdri/eJovjl6/3////////3+f6Jo/lqivdsjPdri/dvjveluPry9f7////////i6f2BnPhqi/dsjPdrjPdvjveluPrv8v7////////l6/6Uq/lsjPdsjPdsjPdvjveluPrv8v7////////m6/6Uq/lsjPdsjPdsjPdsjPeZr/nv8v7////////s8f6XrvlsjPdsjPdtjffS2/z////////w9P6bsfltjfdsjPdtjffBz/v7/P/y9f6svvpxkPdrjPdsjPdsjPd+mviftPqVrPlykfdri/dsjPdsjPdri/doifdpifdrjPdsjPclkRlrAAAAx0lEQVQ4y2NgwAsYmZhZWNkYyAfsHJxc3Dy85BvAxy8gKCQsIkq2AWLiEpJS0jKycuQaIK+gqKSsoqqmrkGmAZpa2jq6evoGhkbG5BlgYmpmbmFpZW1ja0emE+wdHJ2cXVzd3D3INMDTy9vH188/IDCIPP3BIaFh4RGRUdExseQZEBefkJiUnJKalp5BngGZWdk5uXn5BemFZAZBUXFJaVl5RSWZ9jMwVFXX1NbVNzSSq5+hqbmlta29g2z9DJ1d3T29ffhUAABKPSh5Xst3GwAAAABJRU5ErkJggg==";var rr={texture_url:nr,lineWidth:8,color:16777215},pe=class extends A.Object3D{constructor(t,e){super();this.navigation=t;this.config=Object.assign({},rr,e),this.registryEvent()}mesh=null;geometry=null;material=null;texture=null;config=rr;points=[];basicRepeat=1;registryEvent(){this.navigation.bmap.context.addEventListener("control-change",this.onControlChange),this.navigation.bmap.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.navigation.bmap.context.removeEventListener("control-change",this.onControlChange),this.navigation.bmap.context.removeEventListener("update",this.onUpdate)}onControlChange=()=>{this.changeRepeat()};onUpdate=()=>{this.texture};getRepeat(){let{points:t,navigation:{bmap:{context:{camera:e,clientSize:{width:r,height:i}}}}}=this,s=t.map(([u,a])=>_(new A.Vector3(u,a,0),e,r,i)).map(({x:u,y:a})=>[u,a]);return it(s)/32}changeRepeat(){if(!this.material)return;let t=this.getRepeat();this.material.repeat=new A.Vector2(t,1)}loadTexture(t){return new Promise((e,r)=>{new A.TextureLoader().load(t,e,void 0,r)})}transformPoints(t){let e=[];for(let r=0;r<t.length;r++)e.push(...t[r],0);return e}updatePoints(t){this.points=t,this.changeRepeat();let e=this.transformPoints(t);this.geometry&&this.geometry.setPoints(e)}async create(t){let e=this.geometry=new k;if(this.updatePoints(t),!this.texture){let s=this.texture=await this.loadTexture(this.config.texture_url);s.wrapS=s.wrapT=A.RepeatWrapping}let r=this.material=new jt({useMap:!0,color:new A.Color(this.config.color),transparent:!0,resolution:new A.Vector2(this.navigation.bmap.context.clientSize.width,this.navigation.bmap.context.clientSize.height),depthTest:!0,sizeAttenuation:!1,lineWidth:this.config.lineWidth*2,map:this.texture,blending:A.NormalBlending,repeat:new A.Vector2(this.getRepeat(),1)}),i=this.mesh=new A.Mesh(e,r);return this.add(i),i}dispose(){this.unRegistryEvent(),this.clear(),this.geometry?.dispose(),this.material?.dispose(),this.texture?.dispose()}};var fe=require("@tweenjs/tween.js"),Br={path:{},speed:10,cheapMaximumDistance:20,needStartPoi:!1,startPoi:{},loadRoad:!0,roadNetwork:"RoadNetwork"},tn=class extends Q{path=null;worker=Je();fetchRoadStatus=!1;uniqueKey=new ft;paths=[];options;pathTween=new fe.Group;startPoi=null;animationPathOptions={cPathIndex:0};cPath=[];constructor(n,t,e={}){super(n),this.options=Object.assign({},Br,e);let{apiDomain:r,apiPath:{roadNetwork:i},apiInfo:s}=this.bmap.config;this.registryEvent(),this.options.loadRoad&&dt(this.worker,"load_road",{url:`${r||location.origin}${i}?project=${t}`,...s}).then(l=>{this.fetchRoadStatus=!0,this.dispatchEvent({type:"fetch-road-status",status:!0}),this.dispatchEvent({type:"fetch-road-data",roadInfo:l})}).catch(l=>{console.log("[\u52A0\u8F7D\u8DEF\u7F51\u5931\u8D25]",l)}),this.options.roadNetwork!=="RoadNetwork"&&dt(this.worker,"change_road_network",this.options.roadNetwork)}registryEvent(){this.bmap.context.addEventListener("update",this.onUpdate),this.bmap.addEventListener("switch_floor_after",this.onSwitchFloor)}unRegistryEvent(){this.bmap.context.removeEventListener("update",this.onUpdate),this.bmap.removeEventListener("switch_floor_after",this.onSwitchFloor)}onUpdate=()=>{this.pathTween.update()};async setRoadData(n){this.fetchRoadStatus=!1,this.dispatchEvent({type:"fetch-road-status",status:!1}),await dt(this.worker,"set_road_info",n),this.fetchRoadStatus=!0,this.dispatchEvent({type:"fetch-road-status",status:!0})}clearPath(){this.path&&(this.bmap.context.scene.remove(this.path),this.path.dispose(),this.path=null,this.pathTween.getAll().forEach(n=>n.stop()),this.pathTween.removeAll())}onSwitchFloor=({data:{curFloor:n}})=>{if(this.paths.length){let t=this.paths.find(e=>e.floor===n.name);t?this.renderPath(this.translatePoints(t.points)):this.clearPath()}else this.clearPath()};getDirectionPath(n){return dt(this.worker,"get_direction_path",n)}addPath(n){this.paths=n;let t=this.bmap.context.currentFloor?.name,e=n.find(r=>r.floor===t);if(e)if(this.bmap.currentBuildGround)this.renderPath(this.translatePoints(e.points));else{let r=()=>{this.bmap.removeEventListener("center-change",r),this.renderPath(this.translatePoints(e.points))};this.bmap.addEventListener("center-change",r)}else this.clearPath()}translatePoints(n){let[t,e]=this.bmap.buildingCenter;return n.map(r=>[r[0]-t,r[1]-e])}getPath(n,t,e=""){return new Promise((r,i)=>{let s=()=>{dt(this.worker,"get_path",{start:n,end:t,type:e}).then(l=>{l?typeof l=="string"?i(l):r(l):i("no-path")})};if(this.fetchRoadStatus)s();else{let l=({status:u})=>{u&&(this.removeEventListener("fetch-road-status",l),s())};this.addEventListener("fetch-road-status",l)}})}renderPath(n){let t=this.catmullRomCurve3(n);this.cPath=t,this.animationPathOptions={cPathIndex:0},this.path?this.path.updatePoints(t):(this.path=new pe(this,this.options.path),this.path.create(t),this.path.position.z=this.bmap.context.currentFloor.groundMaxHeight+.5,this.bmap.context.scene.add(this.path)),this.startPoi&&(this.startPoi.dispose(),this.startPoi=null),this.options.needStartPoi&&(this.startPoi=this.bmap.context.currentFloor?.addPoi({...this.options.startPoi,position:{x:t[0][0],y:t[0][1],z:1e-4},collision_enable:!1})||null)}catmullRomCurve3(n){return Oe(n,!1,!0,.1,150,2.5)}async animationTo(n,t=this.options.speed){if(n.floor!==this.bmap.context.currentFloor?.name||!this.path)return;let{animationPathOptions:{cPathIndex:e}}=this,r=[this.path.points[0],...this.cPath.slice(e+1)],i=this.translatePoints([n.pos])[0],{distance:s,pos:l,index:u}=r.reduce((g,h,f,v)=>{if(f===v.length-1)return g;let{distance:w,closestPoint:T}=Fe(i,h,v[f+1]);return w<g.distance&&(g.distance=w,g.pos=T,g.index=f),g},{distance:Number.MAX_SAFE_INTEGER,pos:n.pos,index:0});if(s>this.options.cheapMaximumDistance||this.path.points[0][0]===l[0]&&this.path.points[0][1]===l[1])return;let a=0,c=[];if(u===0)a=R(r[0],l),c=[a];else{c=[R(r[0],r[1])];for(let g=1;g<u;g++)c.push(R(r[g],r[g+1]));c.push(R(r[u],l)),a=c.reduce((g,h)=>g+h,0)}let p=this.kmPerHourToMetersPerSecond(t),d=a/p;this.pathTween.getAll().forEach(g=>g.stop()),this.pathTween.removeAll();let m={distance:0};return new Promise(g=>{let h=new fe.Tween(m,this.pathTween).to({distance:a},d*1e3).onUpdate(()=>{for(let f=0;f<c.length;f++){let v=c.slice(0,f+1).reduce((w,T)=>w+T,0);if(v>=m.distance){let w=v-c[f],T=m.distance-w,M=r[f],O=r[f+1],N=Ue(M,O,T);this.path?.updatePoints([N,...r.slice(f+1)]),this.animationPathOptions.cPathIndex+=f,this.startPoi&&this.startPoi.position.setX(N[0]).setY(N[1]),this.dispatchEvent({type:"path-animation"});return}}}).onComplete(()=>{this.pathTween.remove(h),this.dispatchEvent({type:"path-animation-end"}),g(!0)}).start()})}kmPerHourToMetersPerSecond(n){return n*1e3/3600}dispose(){this.worker.terminate(),this.unRegistryEvent(),this.path?.dispose(),this.uniqueKey.dispose(),this.startPoi?.dispose()}};var en=class extends Q{cacheData=new Map;floorDataLengthMap=new Map;async load(n){let t=W(n);if(this.cacheData.has(t))return this.cacheData.get(t);console.time("floor/get\u8BF7\u6C42"+n.resource_type_list);let[,e]=await Promise.all([this.loadBuildGround(n),qt(n,this.bmap.config)]);console.timeEnd("floor/get\u8BF7\u6C42"+n.resource_type_list);let r=W({floor:n.floor,ts:n.ts});this.bmap.transformGraphicData(e,this.bmap.buildingCenter,this.floorDataLengthMap.get(r)||0),e.forEach(s=>s.info.transformToBuildingGround=!1),this.cacheData.set(t,e);let i=this.floorDataLengthMap.get(r)||0;return this.floorDataLengthMap.set(r,i+e.length),e}isSameFloor(n){return this.bmap.context.currentFloor?.key===W(n)}switchFloorByData(n,t){if(this.isSameFloor(t)){if(!n.length)return;let e=this.bmap.context.currentFloor,r=e.userData.legacyToGraphicMap,i=e.userData.graphicMap,s=[];for(let l of n){if(l.info.group==="ground")e.createGround(l.info);else{let u=e.addGraphic(l.info);u.userData.data=l,r.set(l.legacy_id,u),s.push(u)}i.set(l.element_uuid,l)}this.bmap.triggerHooks("switch_floor_before",{curFloor:e,graphics:s}),this.bmap.initialFloorCamera(),this.bmap.triggerHooks("switch_floor_after",{curFloor:e,graphics:s})}else{let e=W(t),{curFloor:r,graphics:i}=this.bmap.createFloor(n);r.name=t.floor,r.key=e;let s=new Map;n.forEach(l=>{s.set(l.element_uuid,l)}),r.userData.graphicMap=s,this.bmap.triggerHooks("switch_floor_before",{curFloor:r,graphics:i}),this.bmap.context.switchFloor(r),this.bmap.initialFloorCamera(),this.bmap.triggerHooks("switch_floor_after",{curFloor:r,graphics:i})}}filterData(n,t){if(!this.isSameFloor(t))return n;let e=this.bmap.context.currentFloor.userData.graphicMap;return n.filter(r=>!e.has(r.element_uuid))}async switchFloorByStoreData(n){let t=await this.load({...n,resource_type_list:"6"}),e=this.filterData(t,n);this.switchFloorByData(e,n)}async switchFloorByOtherData(n){let t=await this.load({...n,resource_type_list:"1,2,3,4"}),e=this.filterData(t,n);this.switchFloorByData(e,n)}async loadBuildGround({brand:n,project:t}){let e=W({brand:n,project:t});return await this.bmap.loadBuildingGround({brand:n,project:t}),this.bmap.currentBuildGround=this.bmap.buildingGroundMap.get(e)||null,this.bmap.currentBuildGround}async changeFloor(n){return await Promise.all([this.switchFloorByStoreData(n),this.switchFloorByOtherData(n)]),Array.from(this.bmap.context.currentFloor.userData.graphicMap.values())}};var ir=require("three"),nn=class extends Q{poiLayer;floors=[];group=new ir.Group;constructor(n){super(n),this.poiLayer=new gt(n.context)}show(n){let t=n[0].userData.height;n.forEach(i=>{i.poiLayer.pois.forEach(s=>{this.poiLayer.pushPoi(s)}),i.poiLayer.pois.length=0,i.poiLayer.dispose(),i.position.z=t,t+=i.userData.height});let{scene:e,currentFloor:r}=this.bmap.context;r&&(e.remove(r),r.dispose()),this.group.add(this.poiLayer,...n),e.add(this.group),this.floors=n}hide(){let{scene:n}=this.bmap.context;n.remove(this.group),this.poiLayer.clear(!0),this.floors.forEach(t=>{t.dispose()}),this.floors=[],this.group.clear()}fitCamera(){let{context:n,config:t,type:e}=this.bmap;n.cameraBound.setEnable(!1),n.control.minZoom=0,n.control.maxZoom=1/0,n.camera.zoom=1,n.setAzimuthalAngle(t.control.defaultAzimuthal,0),n.setPolarAngle(t.control.defaultPolar,0),n.fitCameraToObject(this.group,void 0,0);let r=n.camera.zoom;n.control.minZoom=r,n.control.maxZoom=r*25,e==="3d"&&n.fitCameraToObject(this.group,t.defaultPadding,0,!1),this.bmap.basicZoom=n.camera.zoom,n.control.addEventListener("change",this.bmap.onControlChange.bind(this.bmap)),this.bmap.onControlChange(),n.cameraBound.setEnable(!0)}dispose(){this.poiLayer.dispose(),this.floors.forEach(n=>n.dispose()),this.floors=[]}};var Z;function or(o="aibee_map"){return new Promise((n,t)=>{if(Z)return n({db:Z,type:"success"});let e=indexedDB.open(o);e.onupgradeneeded=function(r){Z=r.target.result,console.log("onupgradeneeded"),n({db:Z,type:"onupgradeneeded"})},e.onsuccess=r=>{Z=r.target.result,n({db:Z,type:"success"})},e.onerror=r=>{t(r)}})}function sr(o,n,t=Z){return new Promise((e,r)=>{t||r("\u6CA1\u6709db");let s=t.transaction([o],"readonly").objectStore(o).get(n);s.onsuccess=()=>{s.result?e(s.result.value):e(null)},s.onerror=l=>{console.log("[getVersionByKey]",l),e(null)}})}function ar(o,n,t,e=Z){return new Promise((r,i)=>(e||i("\u6CA1\u6709db"),new Promise((s,l)=>{let a=e.transaction([o],"readwrite").objectStore(o).add({key:n,value:t});a.onsuccess=function(c){s(c)},a.onerror=function(c){l(c)}})))}function de(o,n=Z){n&&(n.objectStoreNames.contains(o)||n.createObjectStore(o,{keyPath:"key"}))}function lr(){Z?.close(),Z=null}function tt(o,n,t=0){o.forEach(e=>{e.geometry.coords=JSON.parse(JSON.stringify(e.geometry.cds)),e.geometry.type==="polygon"?(e.geometry.coords.map(r=>{Array.isArray(r)&&r.forEach(i=>{i[0]-=n[0],i[1]-=n[1]})}),e.geometry.otherCds&&(e.geometry.otherCoords=e.geometry.otherCds.map(r=>r.map(i=>wt(i,n))))):e.geometry.coords=wt(e.geometry.cds,n)});for(let e=0;e<o.length;e++){let r=o[e];r.deltaHeight=1e-5*(t+e+1)}}function wt(o,n){return[o[0]-n[0],o[1]-n[1]]}var kr={loadRoadNetwork:!1},ge="version",rn="map_data",me="road_network_data",on=class{constructor(n){this.bmap=n;this.initDb()}floors=[];async initDb(){try{let{db:n,type:t}=await or();t==="onupgradeneeded"&&(de(ge),de(rn),de(me))}catch(n){console.log("[\u6253\u5F00indexDb\u9519\u8BEF]",n)}}async load(n){if(this.clear(),Array.isArray(n))this.floors=n;else{let t=await fetch(n).then(e=>e.json());t.code==="0"&&(this.floors=t.data.list)}}setCacheData(n,t,e){return ar(n,`${t}`,e)}getCacheData(n,t){return sr(n,`${t}`)}getFloorCacheKey(n){return`${n.floor_id}`}async getFloorData(n){let t=this.floors.find(r=>r.floor===n);if(!t)return null;let e=this.getFloorCacheKey(t);try{if(await this.getCacheData(ge,e)===t.version_id){let i=await this.getCacheData(rn,e);if(i)return this.getDataByJson(i)}return this.getFloorDataByFloorInfo(t)}catch{return this.getFloorDataByFloorInfo(t)}}async getFloorDataByFloorInfo(n){let t=this.getFloorCacheKey(n);console.time("zstd_json");let e=await fetch(n.map_url).then(r=>r.json());return console.timeEnd("zstd_json"),this.setCacheData(rn,t,e),this.setCacheData(ge,t,n.version_id),this.getDataByJson(e)}async getRoadNetworkData(){return(await Promise.all(this.floors.map(async t=>{let e=this.getFloorCacheKey(t);try{if(await this.getCacheData(ge,e)===t.version_id){let s=await this.getCacheData(me,e);if(s)return s}let i=await fetch(t.route_url).then(s=>s.json());return await this.setCacheData(me,e,i),i}catch{let r=await fetch(t.route_url).then(i=>i.json());return await this.setCacheData(me,e,r),r}}))).filter(t=>t.points)}async getOtherDataByFreeTime(){}async getMulFloorsData(n){return Promise.all(n.map(t=>this.getFloorData(t))).then(t=>t.filter(e=>e))}async getDataByUrl(n){let t=await fetch(n).then(e=>e.json());return this.getDataByJson(t)}getDataByJson(n){let t=new rt(this.bmap.context),e=[0,0];return n.layers.forEach(r=>{switch(r.l_type){case"range":let i=r.elements[0];e=[i.center_x,i.center_y];break;case"graph":let s=[],l=new Map;tt(r.elements,e);let u=[];r.elements.forEach(h=>{if(h.group==="ground")t.createGround(h);else if(h.canMerge)u.push(h);else{let f=t.addGraphic(h);s.push(f),l.set(h.id,f)}}),t.userData.graphics=s,t.userData.graphicMap=l;let a=u.reduce((h,f)=>{let{fillColor:v,fillOpacity:w,strokeColor:T,strokeOpacity:M,height:O}=f,N=`${v}-${w}-${T}-${M}-${O}`;return h[N]?h[N].push(f):h[N]=[f],h},{});Object.values(a).forEach(h=>{let f=new Vt(this.bmap.context,h);t.mergeGraphicLayer.add(f)});break;case"ground":tt(r.elements,e);let c=r.elements.map(h=>new D(this.bmap.context,h));t.addGrounds(c);break;case"wall":tt(r.elements,e);let p=r.elements.reduce((h,f)=>{let{fillColor:v,fillOpacity:w,strokeColor:T,strokeOpacity:M,height:O}=f,N=`${v}-${w}-${T}-${M}-${O}`;return h[N]?h[N].push(f):h[N]=[f],h},{});Object.values(p).forEach(h=>{let f=new Gt(this.bmap.context,h);t.wallLayer.add(f)});break;case"lane":tt(r.elements,e);let d=r.elements.reduce((h,f)=>{let{fillColor:v,fillOpacity:w,strokeColor:T,strokeOpacity:M}=f,O=`${v}-${w}-${T}-${M}`;return h[O]?h[O].push(f):h[O]=[f],h},{});Object.values(d).forEach(h=>{let f=new zt(this.bmap.context,h);t.laneLayer.add(f)});break;case"texture2d":case"texture3d":tt(r.elements,e),r.elements.forEach(h=>{let f=new Bt(this.bmap.context,h);t.textureLayer.add(f)});break;case"glb":tt(r.elements,e),r.elements.forEach(h=>{let f=new kt(this.bmap.context,{...h,url:h.secondUrl,rotate:h.secondRotate,width:h.secondWidth});t.glbModelLayer.add(f)});break;case"store":tt(r.elements,e),r.elements.map(h=>{let f=wt([h.center_x,h.center_y],e),v=t.addGraphic(h);t.userData.graphics.push(v),t.userData.graphicMap.set(h.id,v),t.poiLayer.createPoi({id:h.id,icon:h.poi_info.icon,texts:[{text:h.poi_info.showName||h.store_name||h.poi_info.text}],position:{x:f[0],y:f[1],z:h.airHeight},icon_size:[18,18]})});break;case"facility":tt(r.elements,e),r.elements.map(h=>{let f=wt(h.geometry.cds,e),v=t.addGraphic(h);t.userData.graphics.push(v),t.userData.graphicMap.set(h.id,v),h.poi_info&&t.poiLayer.createPoi({id:h.id,icon:h.poi_info.icon,texts:[{text:h.poi_info.showName||h.store_name||h.poi_info.text}],position:{x:f[0],y:f[1],z:h.airHeight},icon_size:[18,18]})});break;case"parkingSpace":tt(r.elements,e);let m=[],g=new Map;r.elements.forEach(h=>{let f=t.addGraphic(h);m.push(f),g.set(h.id,f);let v=wt([h.center_x,h.center_y],e);h.texts[0]&&t.poiLayer.createPoi({id:h.id,texts:[{text:h.texts[0]}],position:{x:v[0],y:v[1],z:h.airHeight}})}),t.userData.parkingSpaces=m,t.userData.parkingSpacesGraphicMap=g;break}}),t.userData.center=e,t.userData.height=n.floorHeight,t.name=n.floor,t}clear(){}dispose(){this.clear(),lr()}};
3778
+ `);var jt=class extends y.ShaderMaterial{constructor(n){super({uniforms:Object.assign({},y.UniformsLib.fog,{lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},color:{value:new y.Color(16777215)},opacity:{value:1},resolution:{value:new y.Vector2(1,1)},sizeAttenuation:{value:1},dashArray:{value:0},dashOffset:{value:0},dashRatio:{value:.5},useDash:{value:0},visibility:{value:1},alphaTest:{value:0},repeat:{value:new y.Vector2(1,1)}}),vertexShader:y.ShaderChunk.meshline_vert,fragmentShader:y.ShaderChunk.meshline_frag}),this.isMeshLineMaterial=!0,this.type="MeshLineMaterial",Object.defineProperties(this,{lineWidth:{enumerable:!0,get:function(){return this.uniforms.lineWidth.value},set:function(t){this.uniforms.lineWidth.value=t}},map:{enumerable:!0,get:function(){return this.uniforms.map.value},set:function(t){this.uniforms.map.value=t}},useMap:{enumerable:!0,get:function(){return this.uniforms.useMap.value},set:function(t){this.uniforms.useMap.value=t}},alphaMap:{enumerable:!0,get:function(){return this.uniforms.alphaMap.value},set:function(t){this.uniforms.alphaMap.value=t}},useAlphaMap:{enumerable:!0,get:function(){return this.uniforms.useAlphaMap.value},set:function(t){this.uniforms.useAlphaMap.value=t}},color:{enumerable:!0,get:function(){return this.uniforms.color.value},set:function(t){this.uniforms.color.value=t}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(t){this.uniforms.opacity.value=t}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(t){this.uniforms.resolution.value.copy(t)}},sizeAttenuation:{enumerable:!0,get:function(){return this.uniforms.sizeAttenuation.value},set:function(t){this.uniforms.sizeAttenuation.value=t}},dashArray:{enumerable:!0,get:function(){return this.uniforms.dashArray.value},set:function(t){this.uniforms.dashArray.value=t,this.useDash=t!==0?1:0}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(t){this.uniforms.dashOffset.value=t}},dashRatio:{enumerable:!0,get:function(){return this.uniforms.dashRatio.value},set:function(t){this.uniforms.dashRatio.value=t}},useDash:{enumerable:!0,get:function(){return this.uniforms.useDash.value},set:function(t){this.uniforms.useDash.value=t}},visibility:{enumerable:!0,get:function(){return this.uniforms.visibility.value},set:function(t){this.uniforms.visibility.value=t}},alphaTest:{enumerable:!0,get:function(){return this.uniforms.alphaTest.value},set:function(t){this.uniforms.alphaTest.value=t}},repeat:{enumerable:!0,get:function(){return this.uniforms.repeat.value},set:function(t){this.uniforms.repeat.value.copy(t)}}}),this.setValues(n)}};jt.prototype.copy=function(o){return y.ShaderMaterial.prototype.copy.call(this,o),this.lineWidth=o.lineWidth,this.map=o.map,this.useMap=o.useMap,this.alphaMap=o.alphaMap,this.useAlphaMap=o.useAlphaMap,this.color.copy(o.color),this.opacity=o.opacity,this.resolution.copy(o.resolution),this.sizeAttenuation=o.sizeAttenuation,this.dashArray.copy(o.dashArray),this.dashOffset.copy(o.dashOffset),this.dashRatio.copy(o.dashRatio),this.useDash=o.useDash,this.visibility=o.visibility,this.alphaTest=o.alphaTest,this.repeat.copy(o.repeat),this};var nr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAAAQCAMAAACROYkbAAABrVBMVEVsjPdsjPdqi/doifdpivdrjPdsjPdsjPd/m/igtfqTq/lykfdri/dsjPdtjfe/zPv8/f/w8/6zw/p0kvdri/dsjPdtjffU3vz////////3+f62xfpzkfdri/dsjPdsjPeZr/nr8P7////////4+f62xfp0kvdri/dsjPdsjPdujveXrvne5v3////////3+f63x/t2lPdri/dsjPdsjPdsjPdri/eMpfjb4/3+/v/////4+v+7yft1k/dri/dsjPdsjPdri/eJovjl6/3////////3+f6Jo/lqivdsjPdri/dvjveluPry9f7////////i6f2BnPhqi/dsjPdrjPdvjveluPrv8v7////////l6/6Uq/lsjPdsjPdsjPdvjveluPrv8v7////////m6/6Uq/lsjPdsjPdsjPdsjPeZr/nv8v7////////s8f6XrvlsjPdsjPdtjffS2/z////////w9P6bsfltjfdsjPdtjffBz/v7/P/y9f6svvpxkPdrjPdsjPdsjPd+mviftPqVrPlykfdri/dsjPdsjPdri/doifdpifdrjPdsjPclkRlrAAAAx0lEQVQ4y2NgwAsYmZhZWNkYyAfsHJxc3Dy85BvAxy8gKCQsIkq2AWLiEpJS0jKycuQaIK+gqKSsoqqmrkGmAZpa2jq6evoGhkbG5BlgYmpmbmFpZW1ja0emE+wdHJ2cXVzd3D3INMDTy9vH188/IDCIPP3BIaFh4RGRUdExseQZEBefkJiUnJKalp5BngGZWdk5uXn5BemFZAZBUXFJaVl5RSWZ9jMwVFXX1NbVNzSSq5+hqbmlta29g2z9DJ1d3T29ffhUAABKPSh5Xst3GwAAAABJRU5ErkJggg==";var rr={texture_url:nr,lineWidth:8,color:16777215},pe=class extends A.Object3D{constructor(t,e){super();this.navigation=t;this.config=Object.assign({},rr,e),this.registryEvent()}mesh=null;geometry=null;material=null;texture=null;config=rr;points=[];basicRepeat=1;registryEvent(){this.navigation.bmap.context.addEventListener("control-change",this.onControlChange),this.navigation.bmap.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.navigation.bmap.context.removeEventListener("control-change",this.onControlChange),this.navigation.bmap.context.removeEventListener("update",this.onUpdate)}onControlChange=()=>{this.changeRepeat()};onUpdate=()=>{this.texture};getRepeat(){let{points:t,navigation:{bmap:{context:{camera:e,clientSize:{width:r,height:i}}}}}=this,s=t.map(([u,a])=>_(new A.Vector3(u,a,0),e,r,i)).map(({x:u,y:a})=>[u,a]);return it(s)/32}changeRepeat(){if(!this.material)return;let t=this.getRepeat();this.material.repeat=new A.Vector2(t,1)}loadTexture(t){return new Promise((e,r)=>{new A.TextureLoader().load(t,e,void 0,r)})}transformPoints(t){let e=[];for(let r=0;r<t.length;r++)e.push(...t[r],0);return e}updatePoints(t){this.points=t,this.changeRepeat();let e=this.transformPoints(t);this.geometry&&this.geometry.setPoints(e)}async create(t){let e=this.geometry=new k;if(this.updatePoints(t),!this.texture){let s=this.texture=await this.loadTexture(this.config.texture_url);s.wrapS=s.wrapT=A.RepeatWrapping}let r=this.material=new jt({useMap:!0,color:new A.Color(this.config.color),transparent:!0,resolution:new A.Vector2(this.navigation.bmap.context.clientSize.width,this.navigation.bmap.context.clientSize.height),depthTest:!0,sizeAttenuation:!1,lineWidth:this.config.lineWidth*2,map:this.texture,blending:A.NormalBlending,repeat:new A.Vector2(this.getRepeat(),1)}),i=this.mesh=new A.Mesh(e,r);return this.add(i),i}dispose(){this.unRegistryEvent(),this.clear(),this.geometry?.dispose(),this.material?.dispose(),this.texture?.dispose()}};var fe=require("@tweenjs/tween.js"),Br={path:{},speed:10,cheapMaximumDistance:20,needStartPoi:!1,startPoi:{},loadRoad:!0,roadNetwork:"RoadNetwork"},tn=class extends Q{path=null;worker=Je();fetchRoadStatus=!1;uniqueKey=new ft;paths=[];options;pathTween=new fe.Group;startPoi=null;animationPathOptions={cPathIndex:0};cPath=[];constructor(n,t,e={}){super(n),this.options=Object.assign({},Br,e);let{apiDomain:r,apiPath:{roadNetwork:i},apiInfo:s}=this.bmap.config;this.registryEvent(),this.options.loadRoad&&dt(this.worker,"load_road",{url:`${r||location.origin}${i}?project=${t}`,...s}).then(l=>{this.fetchRoadStatus=!0,this.dispatchEvent({type:"fetch-road-status",status:!0}),this.dispatchEvent({type:"fetch-road-data",roadInfo:l})}).catch(l=>{console.log("[\u52A0\u8F7D\u8DEF\u7F51\u5931\u8D25]",l)}),this.options.roadNetwork!=="RoadNetwork"&&dt(this.worker,"change_road_network",this.options.roadNetwork)}registryEvent(){this.bmap.context.addEventListener("update",this.onUpdate),this.bmap.addEventListener("switch_floor_after",this.onSwitchFloor)}unRegistryEvent(){this.bmap.context.removeEventListener("update",this.onUpdate),this.bmap.removeEventListener("switch_floor_after",this.onSwitchFloor)}onUpdate=()=>{this.pathTween.update()};async setRoadData(n){this.fetchRoadStatus=!1,this.dispatchEvent({type:"fetch-road-status",status:!1}),await dt(this.worker,"set_road_info",n),this.fetchRoadStatus=!0,this.dispatchEvent({type:"fetch-road-status",status:!0})}clearPath(){this.path&&(this.bmap.context.scene.remove(this.path),this.path.dispose(),this.path=null,this.pathTween.getAll().forEach(n=>n.stop()),this.pathTween.removeAll())}onSwitchFloor=({data:{curFloor:n}})=>{if(this.paths.length){let t=this.paths.find(e=>e.floor===n.name);t?this.renderPath(this.translatePoints(t.points)):this.clearPath()}else this.clearPath()};getDirectionPath(n){return dt(this.worker,"get_direction_path",n)}addPath(n){this.paths=n;let t=this.bmap.context.currentFloor?.name,e=n.find(r=>r.floor===t);if(e)if(this.bmap.currentBuildGround)this.renderPath(this.translatePoints(e.points));else{let r=()=>{this.bmap.removeEventListener("center-change",r),this.renderPath(this.translatePoints(e.points))};this.bmap.addEventListener("center-change",r)}else this.clearPath()}translatePoints(n){let[t,e]=this.bmap.buildingCenter;return n.map(r=>[r[0]-t,r[1]-e])}getPath(n,t,e=""){return new Promise((r,i)=>{let s=()=>{dt(this.worker,"get_path",{start:n,end:t,type:e}).then(l=>{l?typeof l=="string"?i(l):r(l):i("no-path")})};if(this.fetchRoadStatus)s();else{let l=({status:u})=>{u&&(this.removeEventListener("fetch-road-status",l),s())};this.addEventListener("fetch-road-status",l)}})}renderPath(n){let t=this.catmullRomCurve3(n);this.cPath=t,this.animationPathOptions={cPathIndex:0},this.path?this.path.updatePoints(t):(this.path=new pe(this,this.options.path),this.path.create(t),this.path.position.z=this.bmap.context.currentFloor.groundMaxHeight+.5,this.bmap.context.scene.add(this.path)),this.startPoi&&(this.startPoi.dispose(),this.startPoi=null),this.options.needStartPoi&&(this.startPoi=this.bmap.context.currentFloor?.addPoi({...this.options.startPoi,position:{x:t[0][0],y:t[0][1],z:1e-4},collision_enable:!1})||null)}catmullRomCurve3(n){return Oe(n,!1,!0,.1,150,2.5)}async animationTo(n,t=this.options.speed){if(n.floor!==this.bmap.context.currentFloor?.name||!this.path)return;let{animationPathOptions:{cPathIndex:e}}=this,r=[this.path.points[0],...this.cPath.slice(e+1)],i=this.translatePoints([n.pos])[0],{distance:s,pos:l,index:u}=r.reduce((g,h,f,x)=>{if(f===x.length-1)return g;let{distance:v,closestPoint:T}=Fe(i,h,x[f+1]);return v<g.distance&&(g.distance=v,g.pos=T,g.index=f),g},{distance:Number.MAX_SAFE_INTEGER,pos:n.pos,index:0});if(s>this.options.cheapMaximumDistance||this.path.points[0][0]===l[0]&&this.path.points[0][1]===l[1])return;let a=0,c=[];if(u===0)a=R(r[0],l),c=[a];else{c=[R(r[0],r[1])];for(let g=1;g<u;g++)c.push(R(r[g],r[g+1]));c.push(R(r[u],l)),a=c.reduce((g,h)=>g+h,0)}let p=this.kmPerHourToMetersPerSecond(t),d=a/p;this.pathTween.getAll().forEach(g=>g.stop()),this.pathTween.removeAll();let m={distance:0};return new Promise(g=>{let h=new fe.Tween(m,this.pathTween).to({distance:a},d*1e3).onUpdate(()=>{for(let f=0;f<c.length;f++){let x=c.slice(0,f+1).reduce((v,T)=>v+T,0);if(x>=m.distance){let v=x-c[f],T=m.distance-v,S=r[f],O=r[f+1],N=Ue(S,O,T);this.path?.updatePoints([N,...r.slice(f+1)]),this.animationPathOptions.cPathIndex+=f,this.startPoi&&this.startPoi.position.setX(N[0]).setY(N[1]),this.dispatchEvent({type:"path-animation"});return}}}).onComplete(()=>{this.pathTween.remove(h),this.dispatchEvent({type:"path-animation-end"}),g(!0)}).start()})}kmPerHourToMetersPerSecond(n){return n*1e3/3600}dispose(){this.worker.terminate(),this.unRegistryEvent(),this.path?.dispose(),this.uniqueKey.dispose(),this.startPoi?.dispose()}};var en=class extends Q{cacheData=new Map;floorDataLengthMap=new Map;async load(n){let t=W(n);if(this.cacheData.has(t))return this.cacheData.get(t);console.time("floor/get\u8BF7\u6C42"+n.resource_type_list);let[,e]=await Promise.all([this.loadBuildGround(n),qt(n,this.bmap.config)]);console.timeEnd("floor/get\u8BF7\u6C42"+n.resource_type_list);let r=W({floor:n.floor,ts:n.ts});this.bmap.transformGraphicData(e,this.bmap.buildingCenter,this.floorDataLengthMap.get(r)||0),e.forEach(s=>s.info.transformToBuildingGround=!1),this.cacheData.set(t,e);let i=this.floorDataLengthMap.get(r)||0;return this.floorDataLengthMap.set(r,i+e.length),e}isSameFloor(n){return this.bmap.context.currentFloor?.key===W(n)}switchFloorByData(n,t){if(this.isSameFloor(t)){if(!n.length)return;let e=this.bmap.context.currentFloor,r=e.userData.legacyToGraphicMap,i=e.userData.graphicMap,s=[];for(let l of n){if(l.info.group==="ground")e.createGround(l.info);else{let u=e.addGraphic(l.info);u.userData.data=l,r.set(l.legacy_id,u),s.push(u)}i.set(l.element_uuid,l)}this.bmap.triggerHooks("switch_floor_before",{curFloor:e,graphics:s}),this.bmap.initialFloorCamera(),this.bmap.triggerHooks("switch_floor_after",{curFloor:e,graphics:s})}else{let e=W(t),{curFloor:r,graphics:i}=this.bmap.createFloor(n);r.name=t.floor,r.key=e;let s=new Map;n.forEach(l=>{s.set(l.element_uuid,l)}),r.userData.graphicMap=s,this.bmap.triggerHooks("switch_floor_before",{curFloor:r,graphics:i}),this.bmap.context.switchFloor(r),this.bmap.initialFloorCamera(),this.bmap.triggerHooks("switch_floor_after",{curFloor:r,graphics:i})}}filterData(n,t){if(!this.isSameFloor(t))return n;let e=this.bmap.context.currentFloor.userData.graphicMap;return n.filter(r=>!e.has(r.element_uuid))}async switchFloorByStoreData(n){let t=await this.load({...n,resource_type_list:"6"}),e=this.filterData(t,n);this.switchFloorByData(e,n)}async switchFloorByOtherData(n){let t=await this.load({...n,resource_type_list:"1,2,3,4"}),e=this.filterData(t,n);this.switchFloorByData(e,n)}async loadBuildGround({brand:n,project:t}){let e=W({brand:n,project:t});return await this.bmap.loadBuildingGround({brand:n,project:t}),this.bmap.currentBuildGround=this.bmap.buildingGroundMap.get(e)||null,this.bmap.currentBuildGround}async changeFloor(n){return await Promise.all([this.switchFloorByStoreData(n),this.switchFloorByOtherData(n)]),Array.from(this.bmap.context.currentFloor.userData.graphicMap.values())}};var ir=require("three"),nn=class extends Q{poiLayer;floors=[];group=new ir.Group;constructor(n){super(n),this.poiLayer=new gt(n.context)}show(n){let t=n[0].userData.height;n.forEach(i=>{i.poiLayer.pois.forEach(s=>{this.poiLayer.pushPoi(s)}),i.poiLayer.pois.length=0,i.poiLayer.dispose(),i.position.z=t,t+=i.userData.height});let{scene:e,currentFloor:r}=this.bmap.context;r&&(e.remove(r),r.dispose()),this.group.add(this.poiLayer,...n),e.add(this.group),this.floors=n}hide(){let{scene:n}=this.bmap.context;n.remove(this.group),this.poiLayer.clear(!0),this.floors.forEach(t=>{t.dispose()}),this.floors=[],this.group.clear()}fitCamera(){let{context:n,config:t,type:e}=this.bmap;n.cameraBound.setEnable(!1),n.control.minZoom=0,n.control.maxZoom=1/0,n.camera.zoom=1,n.setAzimuthalAngle(t.control.defaultAzimuthal,0),n.setPolarAngle(t.control.defaultPolar,0),n.fitCameraToObject(this.group,void 0,0);let r=n.camera.zoom;n.control.minZoom=r,n.control.maxZoom=r*25,e==="3d"&&n.fitCameraToObject(this.group,t.defaultPadding,0,!1),this.bmap.basicZoom=n.camera.zoom,n.control.addEventListener("change",this.bmap.onControlChange.bind(this.bmap)),this.bmap.onControlChange(),n.cameraBound.setEnable(!0)}dispose(){this.poiLayer.dispose(),this.floors.forEach(n=>n.dispose()),this.floors=[]}};var Z;function or(o="aibee_map"){return new Promise((n,t)=>{if(Z)return n({db:Z,type:"success"});let e=indexedDB.open(o);e.onupgradeneeded=function(r){Z=r.target.result,console.log("onupgradeneeded"),n({db:Z,type:"onupgradeneeded"})},e.onsuccess=r=>{Z=r.target.result,n({db:Z,type:"success"})},e.onerror=r=>{t(r)}})}function sr(o,n,t=Z){return new Promise((e,r)=>{t||r("\u6CA1\u6709db");let s=t.transaction([o],"readonly").objectStore(o).get(n);s.onsuccess=()=>{s.result?e(s.result.value):e(null)},s.onerror=l=>{console.log("[getVersionByKey]",l),e(null)}})}function ar(o,n,t,e=Z){return new Promise((r,i)=>(e||i("\u6CA1\u6709db"),new Promise((s,l)=>{let a=e.transaction([o],"readwrite").objectStore(o).add({key:n,value:t});a.onsuccess=function(c){s(c)},a.onerror=function(c){l(c)}})))}function de(o,n=Z){n&&(n.objectStoreNames.contains(o)||n.createObjectStore(o,{keyPath:"key"}))}function lr(){Z?.close(),Z=null}function tt(o,n,t=0){o.forEach(e=>{e.geometry.coords=JSON.parse(JSON.stringify(e.geometry.cds)),e.geometry.type==="polygon"?(e.geometry.coords.map(r=>{Array.isArray(r)&&r.forEach(i=>{i[0]-=n[0],i[1]-=n[1]})}),e.geometry.otherCds&&(e.geometry.otherCoords=e.geometry.otherCds.map(r=>r.map(i=>wt(i,n))))):e.geometry.coords=wt(e.geometry.cds,n)});for(let e=0;e<o.length;e++){let r=o[e];r.deltaHeight=1e-5*(t+e+1)}}function wt(o,n){return[o[0]-n[0],o[1]-n[1]]}var kr={loadRoadNetwork:!1},ge="version",rn="map_data",me="road_network_data",on=class{constructor(n){this.bmap=n;this.initDb()}floors=[];async initDb(){try{let{db:n,type:t}=await or();t==="onupgradeneeded"&&(de(ge),de(rn),de(me))}catch(n){console.log("[\u6253\u5F00indexDb\u9519\u8BEF]",n)}}async load(n){if(this.clear(),Array.isArray(n))this.floors=n;else{let t=await fetch(n).then(e=>e.json());t.code==="0"&&(this.floors=t.data.list)}}setCacheData(n,t,e){return ar(n,`${t}`,e)}getCacheData(n,t){return sr(n,`${t}`)}getFloorCacheKey(n){return`${n.floor_id}`}async getFloorData(n){let t=this.floors.find(r=>r.floor===n);if(!t)return null;let e=this.getFloorCacheKey(t);try{if(await this.getCacheData(ge,e)===t.version_id){let i=await this.getCacheData(rn,e);if(i)return this.getDataByJson(i)}return this.getFloorDataByFloorInfo(t)}catch{return this.getFloorDataByFloorInfo(t)}}async getFloorDataByFloorInfo(n){let t=this.getFloorCacheKey(n);console.time("zstd_json");let e=await fetch(n.map_url).then(r=>r.json());return console.timeEnd("zstd_json"),this.setCacheData(rn,t,e),this.setCacheData(ge,t,n.version_id),this.getDataByJson(e)}async getRoadNetworkData(){return(await Promise.all(this.floors.map(async t=>{let e=this.getFloorCacheKey(t);try{if(await this.getCacheData(ge,e)===t.version_id){let s=await this.getCacheData(me,e);if(s)return s}let i=await fetch(t.route_url).then(s=>s.json());return await this.setCacheData(me,e,i),i}catch{let r=await fetch(t.route_url).then(i=>i.json());return await this.setCacheData(me,e,r),r}}))).filter(t=>t.points)}async getOtherDataByFreeTime(){}async getMulFloorsData(n){return Promise.all(n.map(t=>this.getFloorData(t))).then(t=>t.filter(e=>e))}async getDataByUrl(n){let t=await fetch(n).then(e=>e.json());return this.getDataByJson(t)}getDataByJson(n){let t=new rt(this.bmap.context),e=[0,0];return n.layers.forEach(r=>{switch(r.l_type){case"range":let i=r.elements[0];e=[i.center_x,i.center_y];break;case"graph":let s=[],l=new Map;tt(r.elements,e);let u=[];r.elements.forEach(h=>{if(h.group==="ground")t.createGround(h);else if(h.canMerge)u.push(h);else{let f=t.addGraphic(h);s.push(f),l.set(h.id,f)}}),t.userData.graphics=s,t.userData.graphicMap=l;let a=u.reduce((h,f)=>{let{fillColor:x,fillOpacity:v,strokeColor:T,strokeOpacity:S,height:O}=f,N=`${x}-${v}-${T}-${S}-${O}`;return h[N]?h[N].push(f):h[N]=[f],h},{});Object.values(a).forEach(h=>{let f=new Vt(this.bmap.context,h);t.mergeGraphicLayer.add(f)});break;case"ground":tt(r.elements,e);let c=r.elements.map(h=>new D(this.bmap.context,h));t.addGrounds(c);break;case"wall":tt(r.elements,e);let p=r.elements.reduce((h,f)=>{let{fillColor:x,fillOpacity:v,strokeColor:T,strokeOpacity:S,height:O}=f,N=`${x}-${v}-${T}-${S}-${O}`;return h[N]?h[N].push(f):h[N]=[f],h},{});Object.values(p).forEach(h=>{let f=new Gt(this.bmap.context,h);t.wallLayer.add(f)});break;case"lane":tt(r.elements,e);let d=r.elements.reduce((h,f)=>{let{fillColor:x,fillOpacity:v,strokeColor:T,strokeOpacity:S}=f,O=`${x}-${v}-${T}-${S}`;return h[O]?h[O].push(f):h[O]=[f],h},{});Object.values(d).forEach(h=>{let f=new zt(this.bmap.context,h);t.laneLayer.add(f)});break;case"texture2d":case"texture3d":tt(r.elements,e),r.elements.forEach(h=>{let f=new Bt(this.bmap.context,h);t.textureLayer.add(f)});break;case"glb":tt(r.elements,e),r.elements.forEach(h=>{let f=new kt(this.bmap.context,{...h,url:h.secondUrl,rotate:h.secondRotate,width:h.secondWidth});t.glbModelLayer.add(f)});break;case"store":tt(r.elements,e),r.elements.map(h=>{let f=wt([h.center_x,h.center_y],e),x=t.addGraphic(h);t.userData.graphics.push(x),t.userData.graphicMap.set(h.id,x);let v=t.poiLayer.createPoi({id:h.id,icon:h.poi_info.icon,texts:[{text:h.poi_info.showName||h.store_name||h.poi_info.text}],position:{x:f[0],y:f[1],z:h.airHeight},icon_size:[18,18]});v&&(v.userData.type="store",v.userData.data=h)});break;case"facility":tt(r.elements,e),r.elements.map(h=>{let f=wt(h.geometry.cds,e),x=t.addGraphic(h);if(t.userData.graphics.push(x),t.userData.graphicMap.set(h.id,x),h.poi_info){let v=t.poiLayer.createPoi({id:h.id,icon:h.poi_info.icon,texts:[{text:h.poi_info.showName||h.store_name||h.poi_info.text}],position:{x:f[0],y:f[1],z:h.airHeight},icon_size:[18,18]});v&&(v.userData.type="facility",v.userData.data=h)}});break;case"parkingSpace":tt(r.elements,e);let m=[],g=new Map;r.elements.forEach(h=>{let f=t.addGraphic(h);m.push(f),g.set(h.id,f);let x=wt([h.center_x,h.center_y],e);if(h.texts[0]){let v=t.poiLayer.createPoi({id:h.id,texts:[{text:h.texts[0]}],position:{x:x[0],y:x[1],z:h.airHeight}});v&&(v.userData.type="parkingSpace",v.userData.data=h)}}),t.userData.parkingSpaces=m,t.userData.parkingSpacesGraphicMap=g;break}}),t.userData.center=e,t.userData.height=n.floorHeight,t.name=n.floor,t}clear(){}dispose(){this.clear(),lr()}};
3779
3779
  //# sourceMappingURL=bmap.cjs.min.js.map