@aibee/crc-bmap 0.14.27 → 0.14.29

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.
@@ -2,11 +2,11 @@ var AU=Object.create;var wE=Object.defineProperty;var TU=Object.getOwnPropertyDe
2
2
  `)&&n.flags==="s")})});var Zb=st((dtt,$b)=>{"use strict";var t5=mi(),e5=so(),n5=e5.RegExp;$b.exports=t5(function(){var n=n5("(?<a>b)","g");return n.exec("b").groups.a!=="b"||"b".replace(n,"$<a>c")!=="bc"})});var Yp=st((gtt,Jb)=>{"use strict";var mc=Ls(),Xp=yi(),r5=Vp(),i5=Hb(),o5=Wb(),s5=Ep(),a5=Yf(),u5=Cp().get,l5=Yb(),c5=Zb(),f5=s5("native-string-replace",String.prototype.replace),Wp=RegExp.prototype.exec,ry=Wp,h5=Xp("".charAt),p5=Xp("".indexOf),d5=Xp("".replace),ny=Xp("".slice),iy=function(){var n=/a/,t=/b*/g;return mc(Wp,n,"a"),mc(Wp,t,"a"),n.lastIndex!==0||t.lastIndex!==0}(),Kb=o5.BROKEN_CARET,oy=/()??/.exec("")[1]!==void 0,g5=iy||oy||Kb||l5||c5;g5&&(ry=function(t){var e=this,o=u5(e),s=r5(t),u=o.raw,p,f,g,m,v,w,S;if(u)return u.lastIndex=e.lastIndex,p=mc(ry,u,s),e.lastIndex=u.lastIndex,p;var b=o.groups,C=Kb&&e.sticky,R=mc(i5,e),x=e.source,E=0,I=s;if(C&&(R=d5(R,"y",""),p5(R,"g")===-1&&(R+="g"),I=ny(s,e.lastIndex),e.lastIndex>0&&(!e.multiline||e.multiline&&h5(s,e.lastIndex-1)!==`
3
3
  `)&&(x="(?: "+x+")",I=" "+I,E++),f=new RegExp("^(?:"+x+")",R)),oy&&(f=new RegExp("^"+x+"$(?!\\s)",R)),iy&&(g=e.lastIndex),m=mc(Wp,C?f:e,I),C?m?(m.input=ny(m.input,E),m[0]=ny(m[0],E),m.index=e.lastIndex,e.lastIndex+=m[0].length):e.lastIndex=0:iy&&m&&(e.lastIndex=e.global?m.index+m[0].length:g),oy&&m&&m.length>1&&mc(f5,m[0],f,function(){for(v=1;v<arguments.length-2;v++)arguments[v]===void 0&&(m[v]=void 0)}),m&&b)for(m.groups=w=a5(null),v=0;v<b.length;v++)S=b[v],w[S[0]]=m[S[1]];return m});Jb.exports=ry});var $p=st(()=>{"use strict";var m5=Os(),jb=Yp();m5({target:"RegExp",proto:!0,forced:/./.exec!==jb},{exec:jb})});var iA=st((vtt,rA)=>{"use strict";$p();var Qb=Ls(),tA=Vf(),y5=Yp(),eA=mi(),nA=Ns(),v5=pc(),_5=nA("species"),sy=RegExp.prototype;rA.exports=function(n,t,e,o){var s=nA(n),u=!eA(function(){var m={};return m[s]=function(){return 7},""[n](m)!==7}),p=u&&!eA(function(){var m=!1,v=/a/;return n==="split"&&(v={},v.constructor={},v.constructor[_5]=function(){return v},v.flags="",v[s]=/./[s]),v.exec=function(){return m=!0,null},v[s](""),!m});if(!u||!p||e){var f=/./[s],g=t(s,""[n],function(m,v,w,S,b){var C=v.exec;return C===y5||C===sy.exec?u&&!b?{done:!0,value:Qb(f,v,w,S)}:{done:!0,value:Qb(m,w,v,S)}:{done:!1}});tA(String.prototype,n,g[0]),tA(sy,s,g[1])}o&&v5(sy[s],"sham",!0)}});var uA=st((_tt,aA)=>{"use strict";var ay=yi(),x5=wl(),E5=Vp(),w5=uc(),S5=ay("".charAt),oA=ay("".charCodeAt),M5=ay("".slice),sA=function(n){return function(t,e){var o=E5(w5(t)),s=x5(e),u=o.length,p,f;return s<0||s>=u?n?"":void 0:(p=oA(o,s),p<55296||p>56319||s+1===u||(f=oA(o,s+1))<56320||f>57343?n?S5(o,s):p:n?M5(o,s,s+2):(p-55296<<10)+(f-56320)+65536)}};aA.exports={codeAt:sA(!1),charAt:sA(!0)}});var cA=st((xtt,lA)=>{"use strict";var b5=uA().charAt;lA.exports=function(n,t,e){return t+(e?b5(n,t).length:1)}});var hA=st((Ett,fA)=>{"use strict";var cy=yi(),A5=fc(),T5=Math.floor,uy=cy("".charAt),C5=cy("".replace),ly=cy("".slice),P5=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,I5=/\$([$&'`]|\d{1,2})/g;fA.exports=function(n,t,e,o,s,u){var p=e+n.length,f=o.length,g=I5;return s!==void 0&&(s=A5(s),g=P5),C5(u,g,function(m,v){var w;switch(uy(v,0)){case"$":return"$";case"&":return n;case"`":return ly(t,0,e);case"'":return ly(t,p);case"<":w=s[ly(v,1,-1)];break;default:var S=+v;if(S===0)return m;if(S>f){var b=T5(S/10);return b===0?m:b<=f?o[b-1]===void 0?uy(v,1):o[b-1]+uy(v,1):m}w=o[S-1]}return w===void 0?"":w})}});var gA=st((wtt,dA)=>{"use strict";var pA=Ls(),R5=Ma(),L5=Ui(),N5=ac(),O5=Yp(),D5=TypeError;dA.exports=function(n,t){var e=n.exec;if(L5(e)){var o=pA(e,n,t);return o!==null&&R5(o),o}if(N5(n)==="RegExp")return pA(O5,n,t);throw new D5("RegExp#exec called on incompatible receiver")}});var xA=st(()=>{"use strict";var F5=Fb(),mA=Ls(),Zp=yi(),U5=iA(),B5=mi(),z5=Ma(),G5=Ui(),k5=Ys(),q5=wl(),H5=A0(),yc=Vp(),V5=uc(),W5=cA(),X5=vp(),Y5=hA(),$5=gA(),Z5=Ns(),hy=Z5("replace"),K5=Math.max,J5=Math.min,j5=Zp([].concat),fy=Zp([].push),yA=Zp("".indexOf),vA=Zp("".slice),Q5=function(n){return n===void 0?n:String(n)},tH=function(){return"a".replace(/./,"$0")==="$0"}(),_A=function(){return/./[hy]?/./[hy]("a","$0")==="":!1}(),eH=!B5(function(){var n=/./;return n.exec=function(){var t=[];return t.groups={a:"7"},t},"".replace(n,"$<a>")!=="7"});U5("replace",function(n,t,e){var o=_A?"$":"$0";return[function(u,p){var f=V5(this),g=k5(u)?X5(u,hy):void 0;return g?mA(g,u,f,p):mA(t,yc(f),u,p)},function(s,u){var p=z5(this),f=yc(s);if(typeof u=="string"&&yA(u,o)===-1&&yA(u,"$<")===-1){var g=e(t,p,f,u);if(g.done)return g.value}var m=G5(u);m||(u=yc(u));var v=p.global,w;v&&(w=p.unicode,p.lastIndex=0);for(var S=[],b;b=$5(p,f),!(b===null||(fy(S,b),!v));){var C=yc(b[0]);C===""&&(p.lastIndex=W5(f,H5(p.lastIndex),w))}for(var R="",x=0,E=0;E<S.length;E++){b=S[E];for(var I=yc(b[0]),A=K5(J5(q5(b.index),f.length),0),F=[],V,X=1;X<b.length;X++)fy(F,Q5(b[X]));var q=b.groups;if(m){var D=j5([I],F,A,f);q!==void 0&&fy(D,q),V=yc(F5(u,void 0,D))}else V=Y5(I,f,A,F,q,u);A>=x&&(R+=vA(f,x,A)+V,x=A+I.length)}return R+vA(f,x)}]},!eH||!tH||_A)});var Kp=st((btt,EA)=>{"use strict";var nH=ac();EA.exports=Array.isArray||function(t){return nH(t)==="Array"}});var SA=st((Att,wA)=>{"use strict";var rH=Xs(),iH=Kp(),oH=TypeError,sH=Object.getOwnPropertyDescriptor,aH=rH&&!function(){if(this!==void 0)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(n){return n instanceof TypeError}}();wA.exports=aH?function(n,t){if(iH(n)&&!sH(n,"length").writable)throw new oH("Cannot set read only .length");return n.length=t}:function(n,t){return n.length=t}});var py=st((Ttt,MA)=>{"use strict";var uH=TypeError,lH=9007199254740991;MA.exports=function(n){if(n>lH)throw uH("Maximum allowed index exceeded");return n}});var Jp=st(()=>{"use strict";var cH=Os(),fH=fc(),hH=Wf(),pH=SA(),dH=py(),gH=mi(),mH=gH(function(){return[].push.call({length:4294967296},1)!==4294967297}),yH=function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(n){return n instanceof TypeError}},vH=mH||!yH();cH({target:"Array",proto:!0,arity:1,forced:vH},{push:function(t){var e=fH(this),o=hH(e),s=arguments.length;dH(o+s);for(var u=0;u<s;u++)e[o]=arguments[u],o++;return pH(e,o),o}})});var CA=st((Btt,TA)=>{"use strict";var _H=ac(),xH=yi();TA.exports=function(n){if(_H(n)==="Function")return xH(n)}});var RA=st((ztt,IA)=>{"use strict";var PA=CA(),EH=kf(),wH=Gf(),SH=PA(PA.bind);IA.exports=function(n,t){return EH(n),t===void 0?n:wH?SH(n,t):function(){return n.apply(t,arguments)}}});var OA=st((Gtt,NA)=>{"use strict";var MH=Kp(),bH=Wf(),AH=py(),TH=RA(),LA=function(n,t,e,o,s,u,p,f){for(var g=s,m=0,v=p?TH(p,f):!1,w,S;m<o;)m in e&&(w=v?v(e[m],m,t):e[m],u>0&&MH(w)?(S=bH(w),g=LA(n,t,w,S,g,u-1)-1):(AH(g+1),n[g]=w),g++),m++;return g};NA.exports=LA});var GA=st((ktt,zA)=>{"use strict";var CH=yi(),PH=mi(),DA=Ui(),IH=j0(),RH=cc(),LH=x0(),FA=function(){},UA=RH("Reflect","construct"),dy=/^\s*(?:class|function)\b/,NH=CH(dy.exec),OH=!dy.test(FA),Jf=function(t){if(!DA(t))return!1;try{return UA(FA,[],t),!0}catch(e){return!1}},BA=function(t){if(!DA(t))return!1;switch(IH(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return OH||!!NH(dy,LH(t))}catch(e){return!0}};BA.sham=!0;zA.exports=!UA||PH(function(){var n;return Jf(Jf.call)||!Jf(Object)||!Jf(function(){n=!0})||n})?BA:Jf});var VA=st((qtt,HA)=>{"use strict";var kA=Kp(),DH=GA(),FH=Ys(),UH=Ns(),BH=UH("species"),qA=Array;HA.exports=function(n){var t;return kA(n)&&(t=n.constructor,DH(t)&&(t===qA||kA(t.prototype))?t=void 0:FH(t)&&(t=t[BH],t===null&&(t=void 0))),t===void 0?qA:t}});var XA=st((Htt,WA)=>{"use strict";var zH=VA();WA.exports=function(n,t){return new(zH(n))(t===0?0:t)}});var YA=st(()=>{"use strict";var GH=Os(),kH=OA(),qH=fc(),HH=Wf(),VH=wl(),WH=XA();GH({target:"Array",proto:!0},{flat:function(){var t=arguments.length?arguments[0]:void 0,e=qH(this),o=HH(e),s=WH(e,0);return s.length=kH(s,e,e,o,0,t===void 0?1:VH(t)),s}})});var $A=st(()=>{"use strict";var XH=G0();XH("flat")});var KA=st(($tt,ZA)=>{var gy=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(s=>(s.key===t&&Object.assign(s,{priority:o}),s)):(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)}};ZA.exports=gy});var QA=st((Ztt,jA)=>{function JA(n,t){let e=new Map;for(let[o,s]of n)o!==t&&s instanceof Map?e.set(o,JA(s,t)):o!==t&&e.set(o,s);return e}jA.exports=JA});var nT=st((Ktt,eT)=>{function YH(n){let t=Number(n);return!(isNaN(t)||t<=0)}function tT(n){let t=new Map;return Object.keys(n).forEach(o=>{let s=n[o];if(s!==null&&typeof s=="object"&&!Array.isArray(s))return t.set(o,tT(s));if(!YH(s))throw new Error(`Could not add node at key "${o}", make sure it's a valid node`,s);return t.set(o,Number(s))}),t}eT.exports=tT});var oT=st((Jtt,iT)=>{function rT(n){if(!(n instanceof Map))throw new Error(`Invalid graph: Expected Map instead found ${typeof n}`);n.forEach((t,e)=>{if(typeof t=="object"&&t instanceof Map){rT(t);return}if(typeof t!="number"||t<=0)throw new Error(`Values must be numbers greater than 0. Found value ${t} at ${e}`)})}iT.exports=rT});var lT=st((jtt,uT)=>{var $H=KA(),ZH=QA(),sT=nT(),aT=oT(),my=class{constructor(t){t instanceof Map?(aT(t),this.graph=t):t?this.graph=sT(t):this.graph=new Map}addNode(t,e){let o;return e instanceof Map?(aT(e),o=e):o=sT(e),this.graph.set(t,o),this}addVertex(t,e){return this.addNode(t,e)}removeNode(t){return this.graph=ZH(this.graph,t),this}path(t,e,o={}){if(!this.graph.size)return o.cost?{path:null,cost:0}:null;let s=new Set,u=new $H,p=new Map,f=[],g=0,m=[];if(o.avoid&&(m=[].concat(o.avoid)),m.includes(t))throw new Error(`Starting node (${t}) cannot be avoided`);if(m.includes(e))throw new Error(`Ending node (${e}) cannot be avoided`);for(u.set(t,0);!u.isEmpty();){let v=u.next();if(v.key===e){g=v.priority;let S=v.key;for(;p.has(S);)f.push(S),S=p.get(S);break}s.add(v.key),(this.graph.get(v.key)||new Map).forEach((S,b)=>{if(s.has(b)||m.includes(b))return null;if(!u.has(b))return p.set(b,v.key),u.set(b,v.priority+S);let C=u.get(b).priority,R=v.priority+S;return R<C?(p.set(b,v.key),u.set(b,R)):null})}return f.length?(o.trim?f.shift():f=f.concat([t]),o.reverse||(f=f.reverse()),o.cost?{path:f,cost:g}:f):o.cost?{path:null,cost:0}:null}shortestPath(...t){return this.path(...t)}};uT.exports=my});var $d=st((fet,oP)=>{"use strict";var iP=Object.getOwnPropertySymbols,a7=Object.prototype.hasOwnProperty,u7=Object.prototype.propertyIsEnumerable;function l7(n){if(n==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(n)}function c7(){try{if(!Object.assign)return!1;var n=new String("abc");if(n[5]="de",Object.getOwnPropertyNames(n)[0]==="5")return!1;for(var t={},e=0;e<10;e++)t["_"+String.fromCharCode(e)]=e;var o=Object.getOwnPropertyNames(t).map(function(u){return t[u]});if(o.join("")!=="0123456789")return!1;var s={};return"abcdefghijklmnopqrst".split("").forEach(function(u){s[u]=u}),Object.keys(Object.assign({},s)).join("")==="abcdefghijklmnopqrst"}catch(u){return!1}}oP.exports=c7()?Object.assign:function(n,t){for(var e,o=l7(n),s,u=1;u<arguments.length;u++){e=Object(arguments[u]);for(var p in e)a7.call(e,p)&&(o[p]=e[p]);if(iP){s=iP(e);for(var f=0;f<s.length;f++)u7.call(e,s[f])&&(o[s[f]]=e[s[f]])}}return o}});var Kv=st(($v,Zv)=>{(function(n,t){typeof $v=="object"&&typeof Zv!="undefined"?Zv.exports=t():typeof define=="function"&&define.amd?define(t):(n=n||self).RBush=t()})($v,function(){"use strict";function n(x,E,I,A,F){(function V(X,q,D,xt,B){for(;xt>D;){if(xt-D>600){var j=xt-D+1,K=q-D+1,Dt=Math.log(j),Q=.5*Math.exp(2*Dt/3),At=.5*Math.sqrt(Dt*Q*(j-Q)/j)*(K-j/2<0?-1:1),Mt=Math.max(D,Math.floor(q-K*Q/j+At)),Lt=Math.min(xt,Math.floor(q+(j-K)*Q/j+At));V(X,q,Mt,Lt,B)}var pt=X[q],yt=D,J=xt;for(t(X,D,q),B(X[xt],pt)>0&&t(X,D,xt);yt<J;){for(t(X,yt,J),yt++,J--;B(X[yt],pt)<0;)yt++;for(;B(X[J],pt)>0;)J--}B(X[D],pt)===0?t(X,D,J):t(X,++J,xt),J<=q&&(D=J+1),q<=J&&(xt=J-1)}})(x,E,I||0,A||x.length-1,F||e)}function t(x,E,I){var A=x[E];x[E]=x[I],x[I]=A}function e(x,E){return x<E?-1:x>E?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 s(x,E,I){if(!I)return E.indexOf(x);for(var A=0;A<E.length;A++)if(I(x,E[A]))return A;return-1}function u(x,E){p(x,0,x.children.length,E,x)}function p(x,E,I,A,F){F||(F=C(null)),F.minX=1/0,F.minY=1/0,F.maxX=-1/0,F.maxY=-1/0;for(var V=E;V<I;V++){var X=x.children[V];f(F,x.leaf?A(X):X)}return F}function f(x,E){return x.minX=Math.min(x.minX,E.minX),x.minY=Math.min(x.minY,E.minY),x.maxX=Math.max(x.maxX,E.maxX),x.maxY=Math.max(x.maxY,E.maxY),x}function g(x,E){return x.minX-E.minX}function m(x,E){return x.minY-E.minY}function v(x){return(x.maxX-x.minX)*(x.maxY-x.minY)}function w(x){return x.maxX-x.minX+(x.maxY-x.minY)}function S(x,E){return x.minX<=E.minX&&x.minY<=E.minY&&E.maxX<=x.maxX&&E.maxY<=x.maxY}function b(x,E){return E.minX<=x.maxX&&E.minY<=x.maxY&&E.maxX>=x.minX&&E.maxY>=x.minY}function C(x){return{children:x,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function R(x,E,I,A,F){for(var V=[E,I];V.length;)if(!((I=V.pop())-(E=V.pop())<=A)){var X=E+Math.ceil((I-E)/A/2)*A;n(x,X,E,I,F),V.push(E,X,X,I)}}return o.prototype.all=function(){return this._all(this.data,[])},o.prototype.search=function(x){var E=this.data,I=[];if(!b(x,E))return I;for(var A=this.toBBox,F=[];E;){for(var V=0;V<E.children.length;V++){var X=E.children[V],q=E.leaf?A(X):X;b(x,q)&&(E.leaf?I.push(X):S(x,q)?this._all(X,I):F.push(X))}E=F.pop()}return I},o.prototype.collides=function(x){var E=this.data;if(!b(x,E))return!1;for(var I=[];E;){for(var A=0;A<E.children.length;A++){var F=E.children[A],V=E.leaf?this.toBBox(F):F;if(b(x,V)){if(E.leaf||S(x,V))return!0;I.push(F)}}E=I.pop()}return!1},o.prototype.load=function(x){if(!x||!x.length)return this;if(x.length<this._minEntries){for(var E=0;E<x.length;E++)this.insert(x[E]);return this}var I=this._build(x.slice(),0,x.length-1,0);if(this.data.children.length)if(this.data.height===I.height)this._splitRoot(this.data,I);else{if(this.data.height<I.height){var A=this.data;this.data=I,I=A}this._insert(I,this.data.height-I.height-1,!0)}else this.data=I;return this},o.prototype.insert=function(x){return x&&this._insert(x,this.data.height-1),this},o.prototype.clear=function(){return this.data=C([]),this},o.prototype.remove=function(x,E){if(!x)return this;for(var I,A,F,V=this.data,X=this.toBBox(x),q=[],D=[];V||q.length;){if(V||(V=q.pop(),A=q[q.length-1],I=D.pop(),F=!0),V.leaf){var xt=s(x,V.children,E);if(xt!==-1)return V.children.splice(xt,1),q.push(V),this._condense(q),this}F||V.leaf||!S(V,X)?A?(I++,V=A.children[I],F=!1):V=null:(q.push(V),D.push(I),I=0,A=V,V=V.children[0])}return this},o.prototype.toBBox=function(x){return x},o.prototype.compareMinX=function(x,E){return x.minX-E.minX},o.prototype.compareMinY=function(x,E){return x.minY-E.minY},o.prototype.toJSON=function(){return this.data},o.prototype.fromJSON=function(x){return this.data=x,this},o.prototype._all=function(x,E){for(var I=[];x;)x.leaf?E.push.apply(E,x.children):I.push.apply(I,x.children),x=I.pop();return E},o.prototype._build=function(x,E,I,A){var F,V=I-E+1,X=this._maxEntries;if(V<=X)return u(F=C(x.slice(E,I+1)),this.toBBox),F;A||(A=Math.ceil(Math.log(V)/Math.log(X)),X=Math.ceil(V/Math.pow(X,A-1))),(F=C([])).leaf=!1,F.height=A;var q=Math.ceil(V/X),D=q*Math.ceil(Math.sqrt(X));R(x,E,I,D,this.compareMinX);for(var xt=E;xt<=I;xt+=D){var B=Math.min(xt+D-1,I);R(x,xt,B,q,this.compareMinY);for(var j=xt;j<=B;j+=q){var K=Math.min(j+q-1,B);F.children.push(this._build(x,j,K,A-1))}}return u(F,this.toBBox),F},o.prototype._chooseSubtree=function(x,E,I,A){for(;A.push(E),!E.leaf&&A.length-1!==I;){for(var F=1/0,V=1/0,X=void 0,q=0;q<E.children.length;q++){var D=E.children[q],xt=v(D),B=(j=x,K=D,(Math.max(K.maxX,j.maxX)-Math.min(K.minX,j.minX))*(Math.max(K.maxY,j.maxY)-Math.min(K.minY,j.minY))-xt);B<V?(V=B,F=xt<F?xt:F,X=D):B===V&&xt<F&&(F=xt,X=D)}E=X||E.children[0]}var j,K;return E},o.prototype._insert=function(x,E,I){var A=I?x:this.toBBox(x),F=[],V=this._chooseSubtree(A,this.data,E,F);for(V.children.push(x),f(V,A);E>=0&&F[E].children.length>this._maxEntries;)this._split(F,E),E--;this._adjustParentBBoxes(A,F,E)},o.prototype._split=function(x,E){var I=x[E],A=I.children.length,F=this._minEntries;this._chooseSplitAxis(I,F,A);var V=this._chooseSplitIndex(I,F,A),X=C(I.children.splice(V,I.children.length-V));X.height=I.height,X.leaf=I.leaf,u(I,this.toBBox),u(X,this.toBBox),E?x[E-1].children.push(X):this._splitRoot(I,X)},o.prototype._splitRoot=function(x,E){this.data=C([x,E]),this.data.height=x.height+1,this.data.leaf=!1,u(this.data,this.toBBox)},o.prototype._chooseSplitIndex=function(x,E,I){for(var A,F,V,X,q,D,xt,B=1/0,j=1/0,K=E;K<=I-E;K++){var Dt=p(x,0,K,this.toBBox),Q=p(x,K,I,this.toBBox),At=(F=Dt,V=Q,X=void 0,q=void 0,D=void 0,xt=void 0,X=Math.max(F.minX,V.minX),q=Math.max(F.minY,V.minY),D=Math.min(F.maxX,V.maxX),xt=Math.min(F.maxY,V.maxY),Math.max(0,D-X)*Math.max(0,xt-q)),Mt=v(Dt)+v(Q);At<B?(B=At,A=K,j=Mt<j?Mt:j):At===B&&Mt<j&&(j=Mt,A=K)}return A||I-E},o.prototype._chooseSplitAxis=function(x,E,I){var A=x.leaf?this.compareMinX:g,F=x.leaf?this.compareMinY:m;this._allDistMargin(x,E,I,A)<this._allDistMargin(x,E,I,F)&&x.children.sort(A)},o.prototype._allDistMargin=function(x,E,I,A){x.children.sort(A);for(var F=this.toBBox,V=p(x,0,E,F),X=p(x,I-E,I,F),q=w(V)+w(X),D=E;D<I-E;D++){var xt=x.children[D];f(V,x.leaf?F(xt):xt),q+=w(V)}for(var B=I-E-1;B>=E;B--){var j=x.children[B];f(X,x.leaf?F(j):j),q+=w(X)}return q},o.prototype._adjustParentBBoxes=function(x,E,I){for(var A=I;A>=0;A--)f(E[A],x)},o.prototype._condense=function(x){for(var E=x.length-1,I=void 0;E>=0;E--)x[E].children.length===0?E>0?(I=x[E-1].children).splice(I.indexOf(x[E]),1):this.clear():u(x[E],this.toBBox)},o})});var sP=st((Jv,jv)=>{(function(n,t){typeof Jv=="object"&&typeof jv!="undefined"?jv.exports=t():typeof define=="function"&&define.amd?define(t):(n=n||self,n.TinyQueue=t())})(Jv,function(){"use strict";var n=function(o,s){if(o===void 0&&(o=[]),s===void 0&&(s=t),this.data=o,this.length=this.data.length,this.compare=s,this.length>0)for(var u=(this.length>>1)-1;u>=0;u--)this._down(u)};n.prototype.push=function(o){this.data.push(o),this.length++,this._up(this.length-1)},n.prototype.pop=function(){if(this.length!==0){var o=this.data[0],s=this.data.pop();return this.length--,this.length>0&&(this.data[0]=s,this._down(0)),o}},n.prototype.peek=function(){return this.data[0]},n.prototype._up=function(o){for(var s=this,u=s.data,p=s.compare,f=u[o];o>0;){var g=o-1>>1,m=u[g];if(p(f,m)>=0)break;u[o]=m,o=g}u[o]=f},n.prototype._down=function(o){for(var s=this,u=s.data,p=s.compare,f=this.length>>1,g=u[o];o<f;){var m=(o<<1)+1,v=u[m],w=m+1;if(w<this.length&&p(u[w],v)<0&&(m=w,v=u[w]),p(v,g)>=0)break;u[o]=v,o=m}u[o]=g};function t(e,o){return e<o?-1:e>o?1:0}return n})});var uP=st((yet,aP)=>{aP.exports=function(t,e,o,s){var u=t[0],p=t[1],f=!1;o===void 0&&(o=0),s===void 0&&(s=e.length);for(var g=(s-o)/2,m=0,v=g-1;m<g;v=m++){var w=e[o+m*2+0],S=e[o+m*2+1],b=e[o+v*2+0],C=e[o+v*2+1],R=S>p!=C>p&&u<(b-w)*(p-S)/(C-S)+w;R&&(f=!f)}return f}});var cP=st((vet,lP)=>{lP.exports=function(t,e,o,s){var u=t[0],p=t[1],f=!1;o===void 0&&(o=0),s===void 0&&(s=e.length);for(var g=s-o,m=0,v=g-1;m<g;v=m++){var w=e[m+o][0],S=e[m+o][1],b=e[v+o][0],C=e[v+o][1],R=S>p!=C>p&&u<(b-w)*(p-S)/(C-S)+w;R&&(f=!f)}return f}});var pP=st((_et,Jd)=>{var fP=uP(),hP=cP();Jd.exports=function(t,e,o,s){return e.length>0&&Array.isArray(e[0])?hP(t,e,o,s):fP(t,e,o,s)};Jd.exports.nested=hP;Jd.exports.flat=fP});var gP=st((jd,dP)=>{(function(n,t){typeof jd=="object"&&typeof dP!="undefined"?t(jd):typeof define=="function"&&define.amd?define(["exports"],t):t((n=n||self).predicates={})})(jd,function(n){"use strict";let e=33306690738754706e-32;function o(b,C,R,x,E){let I,A,F,V,X=C[0],q=x[0],D=0,xt=0;q>X==q>-X?(I=X,X=C[++D]):(I=q,q=x[++xt]);let B=0;if(D<b&&xt<R)for(q>X==q>-X?(F=I-((A=X+I)-X),X=C[++D]):(F=I-((A=q+I)-q),q=x[++xt]),I=A,F!==0&&(E[B++]=F);D<b&&xt<R;)q>X==q>-X?(F=I-((A=I+X)-(V=A-I))+(X-V),X=C[++D]):(F=I-((A=I+q)-(V=A-I))+(q-V),q=x[++xt]),I=A,F!==0&&(E[B++]=F);for(;D<b;)F=I-((A=I+X)-(V=A-I))+(X-V),X=C[++D],I=A,F!==0&&(E[B++]=F);for(;xt<R;)F=I-((A=I+q)-(V=A-I))+(q-V),q=x[++xt],I=A,F!==0&&(E[B++]=F);return I===0&&B!==0||(E[B++]=I),B}function s(b){return new Float64Array(b)}let u=33306690738754716e-32,p=22204460492503146e-32,f=11093356479670487e-47,g=s(4),m=s(8),v=s(12),w=s(16),S=s(4);n.orient2d=function(b,C,R,x,E,I){let A=(C-I)*(R-E),F=(b-E)*(x-I),V=A-F;if(A===0||F===0||A>0!=F>0)return V;let X=Math.abs(A+F);return Math.abs(V)>=u*X?V:-function(q,D,xt,B,j,K,Dt){let Q,At,Mt,Lt,pt,yt,J,Bt,Gt,ae,ut,Ut,jt,ce,te,$t,qt,xe,ft=q-j,We=xt-j,ee=D-K,ge=B-K;pt=(te=(Bt=ft-(J=(yt=134217729*ft)-(yt-ft)))*(ae=ge-(Gt=(yt=134217729*ge)-(yt-ge)))-((ce=ft*ge)-J*Gt-Bt*Gt-J*ae))-(ut=te-(qt=(Bt=ee-(J=(yt=134217729*ee)-(yt-ee)))*(ae=We-(Gt=(yt=134217729*We)-(yt-We)))-(($t=ee*We)-J*Gt-Bt*Gt-J*ae))),g[0]=te-(ut+pt)+(pt-qt),pt=(jt=ce-((Ut=ce+ut)-(pt=Ut-ce))+(ut-pt))-(ut=jt-$t),g[1]=jt-(ut+pt)+(pt-$t),pt=(xe=Ut+ut)-Ut,g[2]=Ut-(xe-pt)+(ut-pt),g[3]=xe;let fe=function(tt,z){let Pt=z[0];for(let Ot=1;Ot<tt;Ot++)Pt+=z[Ot];return Pt}(4,g),Te=p*Dt;if(fe>=Te||-fe>=Te||(Q=q-(ft+(pt=q-ft))+(pt-j),Mt=xt-(We+(pt=xt-We))+(pt-j),At=D-(ee+(pt=D-ee))+(pt-K),Lt=B-(ge+(pt=B-ge))+(pt-K),Q===0&&At===0&&Mt===0&&Lt===0)||(Te=f*Dt+e*Math.abs(fe),(fe+=ft*Lt+ge*Q-(ee*Mt+We*At))>=Te||-fe>=Te))return fe;pt=(te=(Bt=Q-(J=(yt=134217729*Q)-(yt-Q)))*(ae=ge-(Gt=(yt=134217729*ge)-(yt-ge)))-((ce=Q*ge)-J*Gt-Bt*Gt-J*ae))-(ut=te-(qt=(Bt=At-(J=(yt=134217729*At)-(yt-At)))*(ae=We-(Gt=(yt=134217729*We)-(yt-We)))-(($t=At*We)-J*Gt-Bt*Gt-J*ae))),S[0]=te-(ut+pt)+(pt-qt),pt=(jt=ce-((Ut=ce+ut)-(pt=Ut-ce))+(ut-pt))-(ut=jt-$t),S[1]=jt-(ut+pt)+(pt-$t),pt=(xe=Ut+ut)-Ut,S[2]=Ut-(xe-pt)+(ut-pt),S[3]=xe;let be=o(4,g,4,S,m);pt=(te=(Bt=ft-(J=(yt=134217729*ft)-(yt-ft)))*(ae=Lt-(Gt=(yt=134217729*Lt)-(yt-Lt)))-((ce=ft*Lt)-J*Gt-Bt*Gt-J*ae))-(ut=te-(qt=(Bt=ee-(J=(yt=134217729*ee)-(yt-ee)))*(ae=Mt-(Gt=(yt=134217729*Mt)-(yt-Mt)))-(($t=ee*Mt)-J*Gt-Bt*Gt-J*ae))),S[0]=te-(ut+pt)+(pt-qt),pt=(jt=ce-((Ut=ce+ut)-(pt=Ut-ce))+(ut-pt))-(ut=jt-$t),S[1]=jt-(ut+pt)+(pt-$t),pt=(xe=Ut+ut)-Ut,S[2]=Ut-(xe-pt)+(ut-pt),S[3]=xe;let Wt=o(be,m,4,S,v);pt=(te=(Bt=Q-(J=(yt=134217729*Q)-(yt-Q)))*(ae=Lt-(Gt=(yt=134217729*Lt)-(yt-Lt)))-((ce=Q*Lt)-J*Gt-Bt*Gt-J*ae))-(ut=te-(qt=(Bt=At-(J=(yt=134217729*At)-(yt-At)))*(ae=Mt-(Gt=(yt=134217729*Mt)-(yt-Mt)))-(($t=At*Mt)-J*Gt-Bt*Gt-J*ae))),S[0]=te-(ut+pt)+(pt-qt),pt=(jt=ce-((Ut=ce+ut)-(pt=Ut-ce))+(ut-pt))-(ut=jt-$t),S[1]=jt-(ut+pt)+(pt-$t),pt=(xe=Ut+ut)-Ut,S[2]=Ut-(xe-pt)+(ut-pt),S[3]=xe;let Me=o(Wt,v,4,S,w);return w[Me-1]}(b,C,R,x,E,I,X)},n.orient2dfast=function(b,C,R,x,E,I){return(C-I)*(R-E)-(b-E)*(x-I)},Object.defineProperty(n,"__esModule",{value:!0})})});var EP=st((xet,n_)=>{"use strict";var mP=Kv(),tg=sP(),h7=pP(),p7=gP().orient2d;tg.default&&(tg=tg.default);n_.exports=xP;n_.exports.default=xP;function xP(n,t,e){t=Math.max(0,t===void 0?2:t),e=e||0;var o=v7(n),s=new mP(16);s.toBBox=function(I){return{minX:I[0],minY:I[1],maxX:I[0],maxY:I[1]}},s.compareMinX=function(I,A){return I[0]-A[0]},s.compareMinY=function(I,A){return I[1]-A[1]},s.load(n);for(var u=[],p=0,f;p<o.length;p++){var g=o[p];s.remove(g),f=_P(g,f),u.push(f)}var m=new mP(16);for(p=0;p<u.length;p++)m.insert(Qv(u[p]));for(var v=t*t,w=e*e;u.length;){var S=u.shift(),b=S.p,C=S.next.p,R=t_(b,C);if(!(R<w)){var x=R/v;g=d7(s,S.prev.p,b,C,S.next.next.p,x,m),g&&Math.min(t_(g,b),t_(g,C))<=x&&(u.push(S),u.push(_P(g,S)),s.remove(g),m.remove(S),m.insert(Qv(S)),m.insert(Qv(S.next)))}}S=f;var E=[];do E.push(S.p),S=S.next;while(S!==f);return E.push(S.p),E}function d7(n,t,e,o,s,u,p){for(var f=new tg([],g7),g=n.data;g;){for(var m=0;m<g.children.length;m++){var v=g.children[m],w=g.leaf?e_(v,e,o):m7(e,o,v);w>u||f.push({node:v,dist:w})}for(;f.length&&!f.peek().node.children;){var S=f.pop(),b=S.node,C=e_(b,t,e),R=e_(b,o,s);if(S.dist<C&&S.dist<R&&vP(e,b,p)&&vP(o,b,p))return b}g=f.pop(),g&&(g=g.node)}return null}function g7(n,t){return n.dist-t.dist}function m7(n,t,e){if(yP(n,e)||yP(t,e))return 0;var o=Qd(n[0],n[1],t[0],t[1],e.minX,e.minY,e.maxX,e.minY);if(o===0)return 0;var s=Qd(n[0],n[1],t[0],t[1],e.minX,e.minY,e.minX,e.maxY);if(s===0)return 0;var u=Qd(n[0],n[1],t[0],t[1],e.maxX,e.minY,e.maxX,e.maxY);if(u===0)return 0;var p=Qd(n[0],n[1],t[0],t[1],e.minX,e.maxY,e.maxX,e.maxY);return p===0?0:Math.min(o,s,u,p)}function yP(n,t){return n[0]>=t.minX&&n[0]<=t.maxX&&n[1]>=t.minY&&n[1]<=t.maxY}function vP(n,t,e){for(var o=Math.min(n[0],t[0]),s=Math.min(n[1],t[1]),u=Math.max(n[0],t[0]),p=Math.max(n[1],t[1]),f=e.search({minX:o,minY:s,maxX:u,maxY:p}),g=0;g<f.length;g++)if(y7(f[g].p,f[g].next.p,n,t))return!1;return!0}function Zc(n,t,e){return p7(n[0],n[1],t[0],t[1],e[0],e[1])}function y7(n,t,e,o){return n!==o&&t!==e&&Zc(n,t,e)>0!=Zc(n,t,o)>0&&Zc(e,o,n)>0!=Zc(e,o,t)>0}function Qv(n){var t=n.p,e=n.next.p;return n.minX=Math.min(t[0],e[0]),n.minY=Math.min(t[1],e[1]),n.maxX=Math.max(t[0],e[0]),n.maxY=Math.max(t[1],e[1]),n}function v7(n){for(var t=n[0],e=n[0],o=n[0],s=n[0],u=0;u<n.length;u++){var p=n[u];p[0]<t[0]&&(t=p),p[0]>o[0]&&(o=p),p[1]<e[1]&&(e=p),p[1]>s[1]&&(s=p)}var f=[t,e,o,s],g=f.slice();for(u=0;u<n.length;u++)h7(n[u],f)||g.push(n[u]);return x7(g)}function _P(n,t){var e={p:n,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 t_(n,t){var e=n[0]-t[0],o=n[1]-t[1];return e*e+o*o}function e_(n,t,e){var o=t[0],s=t[1],u=e[0]-o,p=e[1]-s;if(u!==0||p!==0){var f=((n[0]-o)*u+(n[1]-s)*p)/(u*u+p*p);f>1?(o=e[0],s=e[1]):f>0&&(o+=u*f,s+=p*f)}return u=n[0]-o,p=n[1]-s,u*u+p*p}function Qd(n,t,e,o,s,u,p,f){var g=e-n,m=o-t,v=p-s,w=f-u,S=n-s,b=t-u,C=g*g+m*m,R=g*v+m*w,x=v*v+w*w,E=g*S+m*b,I=v*S+w*b,A=C*x-R*R,F,V,X,q,D=A,xt=A;A===0?(V=0,D=1,q=I,xt=x):(V=R*I-x*E,q=C*I-R*E,V<0?(V=0,q=I,xt=x):V>D&&(V=D,q=I+R,xt=x)),q<0?(q=0,-E<0?V=0:-E>C?V=D:(V=-E,D=C)):q>xt&&(q=xt,-E+R<0?V=0:-E+R>C?V=D:(V=-E+R,D=C)),F=V===0?0:V/D,X=q===0?0:q/xt;var B=(1-F)*n+F*e,j=(1-F)*t+F*o,K=(1-X)*s+X*p,Dt=(1-X)*u+X*f,Q=K-B,At=Dt-j;return Q*Q+At*At}function _7(n,t){return n[0]===t[0]?n[1]-t[1]:n[0]-t[0]}function x7(n){n.sort(_7);for(var t=[],e=0;e<n.length;e++){for(;t.length>=2&&Zc(t[t.length-2],t[t.length-1],n[e])<=0;)t.pop();t.push(n[e])}for(var o=[],s=n.length-1;s>=0;s--){for(;o.length>=2&&Zc(o[o.length-2],o[o.length-1],n[s])<=0;)o.pop();o.push(n[s])}return o.pop(),t.pop(),t.concat(o)}});var TP=st((i_,o_)=>{(function(n,t){typeof i_=="object"&&typeof o_!="undefined"?o_.exports=t():typeof define=="function"&&define.amd?define(t):n.quickselect=t()})(i_,function(){"use strict";function n(s,u,p,f,g){t(s,u,p||0,f||s.length-1,g||o)}function t(s,u,p,f,g){for(;f>p;){if(f-p>600){var m=f-p+1,v=u-p+1,w=Math.log(m),S=.5*Math.exp(2*w/3),b=.5*Math.sqrt(w*S*(m-S)/m)*(v-m/2<0?-1:1),C=Math.max(p,Math.floor(u-v*S/m+b)),R=Math.min(f,Math.floor(u+(m-v)*S/m+b));t(s,u,C,R,g)}var x=s[u],E=p,I=f;for(e(s,p,u),g(s[f],x)>0&&e(s,p,f);E<I;){for(e(s,E,I),E++,I--;g(s[E],x)<0;)E++;for(;g(s[I],x)>0;)I--}g(s[p],x)===0?e(s,p,I):(I++,e(s,I,f)),I<=u&&(p=I+1),u<=I&&(f=I-1)}}function e(s,u,p){var f=s[u];s[u]=s[p],s[p]=f}function o(s,u){return s<u?-1:s>u?1:0}return n})});var l_=st((Yrt,u_)=>{"use strict";u_.exports=ph;u_.exports.default=ph;var N7=TP();function ph(n,t){if(!(this instanceof ph))return new ph(n,t);this._maxEntries=Math.max(4,n||9),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),t&&this._initFormat(t),this.clear()}ph.prototype={all:function(){return this._all(this.data,[])},search:function(n){var t=this.data,e=[],o=this.toBBox;if(!ng(n,t))return e;for(var s=[],u,p,f,g;t;){for(u=0,p=t.children.length;u<p;u++)f=t.children[u],g=t.leaf?o(f):f,ng(n,g)&&(t.leaf?e.push(f):a_(n,g)?this._all(f,e):s.push(f));t=s.pop()}return e},collides:function(n){var t=this.data,e=this.toBBox;if(!ng(n,t))return!1;for(var o=[],s,u,p,f;t;){for(s=0,u=t.children.length;s<u;s++)if(p=t.children[s],f=t.leaf?e(p):p,ng(n,f)){if(t.leaf||a_(n,f))return!0;o.push(p)}t=o.pop()}return!1},load:function(n){if(!(n&&n.length))return this;if(n.length<this._minEntries){for(var t=0,e=n.length;t<e;t++)this.insert(n[t]);return this}var o=this._build(n.slice(),0,n.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 s=this.data;this.data=o,o=s}this._insert(o,this.data.height-o.height-1,!0)}return this},insert:function(n){return n&&this._insert(n,this.data.height-1),this},clear:function(){return this.data=jc([]),this},remove:function(n,t){if(!n)return this;for(var e=this.data,o=this.toBBox(n),s=[],u=[],p,f,g,m;e||s.length;){if(e||(e=s.pop(),f=s[s.length-1],p=u.pop(),m=!0),e.leaf&&(g=O7(n,e.children,t),g!==-1))return e.children.splice(g,1),s.push(e),this._condense(s),this;!m&&!e.leaf&&a_(e,o)?(s.push(e),u.push(p),p=0,f=e,e=e.children[0]):f?(p++,e=f.children[p],m=!1):e=null}return this},toBBox:function(n){return n},compareMinX:CP,compareMinY:PP,toJSON:function(){return this.data},fromJSON:function(n){return this.data=n,this},_all:function(n,t){for(var e=[];n;)n.leaf?t.push.apply(t,n.children):e.push.apply(e,n.children),n=e.pop();return t},_build:function(n,t,e,o){var s=e-t+1,u=this._maxEntries,p;if(s<=u)return p=jc(n.slice(t,e+1)),Jc(p,this.toBBox),p;o||(o=Math.ceil(Math.log(s)/Math.log(u)),u=Math.ceil(s/Math.pow(u,o-1))),p=jc([]),p.leaf=!1,p.height=o;var f=Math.ceil(s/u),g=f*Math.ceil(Math.sqrt(u)),m,v,w,S;for(IP(n,t,e,g,this.compareMinX),m=t;m<=e;m+=g)for(w=Math.min(m+g-1,e),IP(n,m,w,f,this.compareMinY),v=m;v<=w;v+=f)S=Math.min(v+f-1,w),p.children.push(this._build(n,v,S,o-1));return Jc(p,this.toBBox),p},_chooseSubtree:function(n,t,e,o){for(var s,u,p,f,g,m,v,w;o.push(t),!(t.leaf||o.length-1===e);){for(v=w=1/0,s=0,u=t.children.length;s<u;s++)p=t.children[s],g=s_(p),m=D7(n,p)-g,m<w?(w=m,v=g<v?g:v,f=p):m===w&&g<v&&(v=g,f=p);t=f||t.children[0]}return t},_insert:function(n,t,e){var o=this.toBBox,s=e?n:o(n),u=[],p=this._chooseSubtree(s,this.data,t,u);for(p.children.push(n),hh(p,s);t>=0&&u[t].children.length>this._maxEntries;)this._split(u,t),t--;this._adjustParentBBoxes(s,u,t)},_split:function(n,t){var e=n[t],o=e.children.length,s=this._minEntries;this._chooseSplitAxis(e,s,o);var u=this._chooseSplitIndex(e,s,o),p=jc(e.children.splice(u,e.children.length-u));p.height=e.height,p.leaf=e.leaf,Jc(e,this.toBBox),Jc(p,this.toBBox),t?n[t-1].children.push(p):this._splitRoot(e,p)},_splitRoot:function(n,t){this.data=jc([n,t]),this.data.height=n.height+1,this.data.leaf=!1,Jc(this.data,this.toBBox)},_chooseSplitIndex:function(n,t,e){var o,s,u,p,f,g,m,v;for(g=m=1/0,o=t;o<=e-t;o++)s=fh(n,0,o,this.toBBox),u=fh(n,o,e,this.toBBox),p=F7(s,u),f=s_(s)+s_(u),p<g?(g=p,v=o,m=f<m?f:m):p===g&&f<m&&(m=f,v=o);return v},_chooseSplitAxis:function(n,t,e){var o=n.leaf?this.compareMinX:CP,s=n.leaf?this.compareMinY:PP,u=this._allDistMargin(n,t,e,o),p=this._allDistMargin(n,t,e,s);u<p&&n.children.sort(o)},_allDistMargin:function(n,t,e,o){n.children.sort(o);var s=this.toBBox,u=fh(n,0,t,s),p=fh(n,e-t,e,s),f=eg(u)+eg(p),g,m;for(g=t;g<e-t;g++)m=n.children[g],hh(u,n.leaf?s(m):m),f+=eg(u);for(g=e-t-1;g>=t;g--)m=n.children[g],hh(p,n.leaf?s(m):m),f+=eg(p);return f},_adjustParentBBoxes:function(n,t,e){for(var o=e;o>=0;o--)hh(t[o],n)},_condense:function(n){for(var t=n.length-1,e;t>=0;t--)n[t].children.length===0?t>0?(e=n[t-1].children,e.splice(e.indexOf(n[t]),1)):this.clear():Jc(n[t],this.toBBox)},_initFormat:function(n){var t=["return a"," - b",";"];this.compareMinX=new Function("a","b",t.join(n[0])),this.compareMinY=new Function("a","b",t.join(n[1])),this.toBBox=new Function("a","return {minX: a"+n[0]+", minY: a"+n[1]+", maxX: a"+n[2]+", maxY: a"+n[3]+"};")}};function O7(n,t,e){if(!e)return t.indexOf(n);for(var o=0;o<t.length;o++)if(e(n,t[o]))return o;return-1}function Jc(n,t){fh(n,0,n.children.length,t,n)}function fh(n,t,e,o,s){s||(s=jc(null)),s.minX=1/0,s.minY=1/0,s.maxX=-1/0,s.maxY=-1/0;for(var u=t,p;u<e;u++)p=n.children[u],hh(s,n.leaf?o(p):p);return s}function hh(n,t){return n.minX=Math.min(n.minX,t.minX),n.minY=Math.min(n.minY,t.minY),n.maxX=Math.max(n.maxX,t.maxX),n.maxY=Math.max(n.maxY,t.maxY),n}function CP(n,t){return n.minX-t.minX}function PP(n,t){return n.minY-t.minY}function s_(n){return(n.maxX-n.minX)*(n.maxY-n.minY)}function eg(n){return n.maxX-n.minX+(n.maxY-n.minY)}function D7(n,t){return(Math.max(t.maxX,n.maxX)-Math.min(t.minX,n.minX))*(Math.max(t.maxY,n.maxY)-Math.min(t.minY,n.minY))}function F7(n,t){var e=Math.max(n.minX,t.minX),o=Math.max(n.minY,t.minY),s=Math.min(n.maxX,t.maxX),u=Math.min(n.maxY,t.maxY);return Math.max(0,s-e)*Math.max(0,u-o)}function a_(n,t){return n.minX<=t.minX&&n.minY<=t.minY&&t.maxX<=n.maxX&&t.maxY<=n.maxY}function ng(n,t){return t.minX<=n.maxX&&t.minY<=n.maxY&&t.maxX>=n.minX&&t.maxY>=n.minY}function jc(n){return{children:n,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function IP(n,t,e,o,s){for(var u=[t,e],p;u.length;)e=u.pop(),t=u.pop(),!(e-t<=o)&&(p=t+Math.ceil((e-t)/o/2)*o,N7(n,p,t,e,s),u.push(t,p,p,e))}});var FP=st((sot,g_)=>{"use strict";g_.exports=sg;g_.exports.default=sg;function sg(n,t,e){e=e||2;var o=t&&t.length,s=o?t[0]*e:n.length,u=NP(n,0,s,e,!0),p=[];if(!u||u.next===u.prev)return p;var f,g,m,v,w,S,b;if(o&&(u=X7(n,t,u,e)),n.length>80*e){f=m=n[0],g=v=n[1];for(var C=e;C<s;C+=e)w=n[C],S=n[C+1],w<f&&(f=w),S<g&&(g=S),w>m&&(m=w),S>v&&(v=S);b=Math.max(m-f,v-g),b=b!==0?32767/b:0}return mh(u,p,e,f,g,b,0),p}function NP(n,t,e,o,s){var u,p;if(s===d_(n,t,e,o)>0)for(u=t;u<e;u+=o)p=LP(u,n[u],n[u+1],p);else for(u=e-o;u>=t;u-=o)p=LP(u,n[u],n[u+1],p);return p&&ag(p,p.next)&&(vh(p),p=p.next),p}function kl(n,t){if(!n)return n;t||(t=n);var e=n,o;do if(o=!1,!e.steiner&&(ag(e,e.next)||Hr(e.prev,e,e.next)===0)){if(vh(e),e=t=e.prev,e===e.next)break;o=!0}else e=e.next;while(o||e!==t);return t}function mh(n,t,e,o,s,u,p){if(n){!p&&u&&J7(n,o,s,u);for(var f=n,g,m;n.prev!==n.next;){if(g=n.prev,m=n.next,u?H7(n,o,s,u):q7(n)){t.push(g.i/e|0),t.push(n.i/e|0),t.push(m.i/e|0),vh(n),n=m.next,f=m.next;continue}if(n=m,n===f){p?p===1?(n=V7(kl(n),t,e),mh(n,t,e,o,s,u,2)):p===2&&W7(n,t,e,o,s,u):mh(kl(n),t,e,o,s,u,1);break}}}}function q7(n){var t=n.prev,e=n,o=n.next;if(Hr(t,e,o)>=0)return!1;for(var s=t.x,u=e.x,p=o.x,f=t.y,g=e.y,m=o.y,v=s<u?s<p?s:p:u<p?u:p,w=f<g?f<m?f:m:g<m?g:m,S=s>u?s>p?s:p:u>p?u:p,b=f>g?f>m?f:m:g>m?g:m,C=o.next;C!==t;){if(C.x>=v&&C.x<=S&&C.y>=w&&C.y<=b&&ef(s,f,u,g,p,m,C.x,C.y)&&Hr(C.prev,C,C.next)>=0)return!1;C=C.next}return!0}function H7(n,t,e,o){var s=n.prev,u=n,p=n.next;if(Hr(s,u,p)>=0)return!1;for(var f=s.x,g=u.x,m=p.x,v=s.y,w=u.y,S=p.y,b=f<g?f<m?f:m:g<m?g:m,C=v<w?v<S?v:S:w<S?w:S,R=f>g?f>m?f:m:g>m?g:m,x=v>w?v>S?v:S:w>S?w:S,E=h_(b,C,t,e,o),I=h_(R,x,t,e,o),A=n.prevZ,F=n.nextZ;A&&A.z>=E&&F&&F.z<=I;){if(A.x>=b&&A.x<=R&&A.y>=C&&A.y<=x&&A!==s&&A!==p&&ef(f,v,g,w,m,S,A.x,A.y)&&Hr(A.prev,A,A.next)>=0||(A=A.prevZ,F.x>=b&&F.x<=R&&F.y>=C&&F.y<=x&&F!==s&&F!==p&&ef(f,v,g,w,m,S,F.x,F.y)&&Hr(F.prev,F,F.next)>=0))return!1;F=F.nextZ}for(;A&&A.z>=E;){if(A.x>=b&&A.x<=R&&A.y>=C&&A.y<=x&&A!==s&&A!==p&&ef(f,v,g,w,m,S,A.x,A.y)&&Hr(A.prev,A,A.next)>=0)return!1;A=A.prevZ}for(;F&&F.z<=I;){if(F.x>=b&&F.x<=R&&F.y>=C&&F.y<=x&&F!==s&&F!==p&&ef(f,v,g,w,m,S,F.x,F.y)&&Hr(F.prev,F,F.next)>=0)return!1;F=F.nextZ}return!0}function V7(n,t,e){var o=n;do{var s=o.prev,u=o.next.next;!ag(s,u)&&OP(s,o,o.next,u)&&yh(s,u)&&yh(u,s)&&(t.push(s.i/e|0),t.push(o.i/e|0),t.push(u.i/e|0),vh(o),vh(o.next),o=n=u),o=o.next}while(o!==n);return kl(o)}function W7(n,t,e,o,s,u){var p=n;do{for(var f=p.next.next;f!==p.prev;){if(p.i!==f.i&&tY(p,f)){var g=DP(p,f);p=kl(p,p.next),g=kl(g,g.next),mh(p,t,e,o,s,u,0),mh(g,t,e,o,s,u,0);return}f=f.next}p=p.next}while(p!==n)}function X7(n,t,e,o){var s=[],u,p,f,g,m;for(u=0,p=t.length;u<p;u++)f=t[u]*o,g=u<p-1?t[u+1]*o:n.length,m=NP(n,f,g,o,!1),m===m.next&&(m.steiner=!0),s.push(Q7(m));for(s.sort(Y7),u=0;u<s.length;u++)e=$7(s[u],e);return e}function Y7(n,t){return n.x-t.x}function $7(n,t){var e=Z7(n,t);if(!e)return t;var o=DP(e,n);return kl(o,o.next),kl(e,e.next)}function Z7(n,t){var e=t,o=n.x,s=n.y,u=-1/0,p;do{if(s<=e.y&&s>=e.next.y&&e.next.y!==e.y){var f=e.x+(s-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(f<=o&&f>u&&(u=f,p=e.x<e.next.x?e:e.next,f===o))return p}e=e.next}while(e!==t);if(!p)return null;var g=p,m=p.x,v=p.y,w=1/0,S;e=p;do o>=e.x&&e.x>=m&&o!==e.x&&ef(s<v?o:u,s,m,v,s<v?u:o,s,e.x,e.y)&&(S=Math.abs(s-e.y)/(o-e.x),yh(e,n)&&(S<w||S===w&&(e.x>p.x||e.x===p.x&&K7(p,e)))&&(p=e,w=S)),e=e.next;while(e!==g);return p}function K7(n,t){return Hr(n.prev,n,t.prev)<0&&Hr(t.next,n,n.next)<0}function J7(n,t,e,o){var s=n;do s.z===0&&(s.z=h_(s.x,s.y,t,e,o)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==n);s.prevZ.nextZ=null,s.prevZ=null,j7(s)}function j7(n){var t,e,o,s,u,p,f,g,m=1;do{for(e=n,n=null,u=null,p=0;e;){for(p++,o=e,f=0,t=0;t<m&&(f++,o=o.nextZ,!!o);t++);for(g=m;f>0||g>0&&o;)f!==0&&(g===0||!o||e.z<=o.z)?(s=e,e=e.nextZ,f--):(s=o,o=o.nextZ,g--),u?u.nextZ=s:n=s,s.prevZ=u,u=s;e=o}u.nextZ=null,m*=2}while(p>1);return n}function h_(n,t,e,o,s){return n=(n-e)*s|0,t=(t-o)*s|0,n=(n|n<<8)&16711935,n=(n|n<<4)&252645135,n=(n|n<<2)&858993459,n=(n|n<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,n|t<<1}function Q7(n){var t=n,e=n;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==n);return e}function ef(n,t,e,o,s,u,p,f){return(s-p)*(t-f)>=(n-p)*(u-f)&&(n-p)*(o-f)>=(e-p)*(t-f)&&(e-p)*(u-f)>=(s-p)*(o-f)}function tY(n,t){return n.next.i!==t.i&&n.prev.i!==t.i&&!eY(n,t)&&(yh(n,t)&&yh(t,n)&&nY(n,t)&&(Hr(n.prev,n,t.prev)||Hr(n,t.prev,t))||ag(n,t)&&Hr(n.prev,n,n.next)>0&&Hr(t.prev,t,t.next)>0)}function Hr(n,t,e){return(t.y-n.y)*(e.x-t.x)-(t.x-n.x)*(e.y-t.y)}function ag(n,t){return n.x===t.x&&n.y===t.y}function OP(n,t,e,o){var s=og(Hr(n,t,e)),u=og(Hr(n,t,o)),p=og(Hr(e,o,n)),f=og(Hr(e,o,t));return!!(s!==u&&p!==f||s===0&&ig(n,e,t)||u===0&&ig(n,o,t)||p===0&&ig(e,n,o)||f===0&&ig(e,t,o))}function ig(n,t,e){return t.x<=Math.max(n.x,e.x)&&t.x>=Math.min(n.x,e.x)&&t.y<=Math.max(n.y,e.y)&&t.y>=Math.min(n.y,e.y)}function og(n){return n>0?1:n<0?-1:0}function eY(n,t){var e=n;do{if(e.i!==n.i&&e.next.i!==n.i&&e.i!==t.i&&e.next.i!==t.i&&OP(e,e.next,n,t))return!0;e=e.next}while(e!==n);return!1}function yh(n,t){return Hr(n.prev,n,n.next)<0?Hr(n,t,n.next)>=0&&Hr(n,n.prev,t)>=0:Hr(n,t,n.prev)<0||Hr(n,n.next,t)<0}function nY(n,t){var e=n,o=!1,s=(n.x+t.x)/2,u=(n.y+t.y)/2;do e.y>u!=e.next.y>u&&e.next.y!==e.y&&s<(e.next.x-e.x)*(u-e.y)/(e.next.y-e.y)+e.x&&(o=!o),e=e.next;while(e!==n);return o}function DP(n,t){var e=new p_(n.i,n.x,n.y),o=new p_(t.i,t.x,t.y),s=n.next,u=t.prev;return n.next=t,t.prev=n,e.next=s,s.prev=e,o.next=e,e.prev=o,u.next=o,o.prev=u,o}function LP(n,t,e,o){var s=new p_(n,t,e);return o?(s.next=o.next,s.prev=o,o.next.prev=s,o.next=s):(s.prev=s,s.next=s),s}function vh(n){n.next.prev=n.prev,n.prev.next=n.next,n.prevZ&&(n.prevZ.nextZ=n.nextZ),n.nextZ&&(n.nextZ.prevZ=n.prevZ)}function p_(n,t,e){this.i=n,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}sg.deviation=function(n,t,e,o){var s=t&&t.length,u=s?t[0]*e:n.length,p=Math.abs(d_(n,0,u,e));if(s)for(var f=0,g=t.length;f<g;f++){var m=t[f]*e,v=f<g-1?t[f+1]*e:n.length;p-=Math.abs(d_(n,m,v,e))}var w=0;for(f=0;f<o.length;f+=3){var S=o[f]*e,b=o[f+1]*e,C=o[f+2]*e;w+=Math.abs((n[S]-n[C])*(n[b+1]-n[S+1])-(n[S]-n[b])*(n[C+1]-n[S+1]))}return p===0&&w===0?0:Math.abs((w-p)/p)};function d_(n,t,e,o){for(var s=0,u=t,p=e-o;u<e;u+=o)s+=(n[p]-n[u])*(n[u+1]+n[p+1]),p=u;return s}sg.flatten=function(n){for(var t=n[0][0].length,e={vertices:[],holes:[],dimensions:t},o=0,s=0;s<n.length;s++){for(var u=0;u<n[s].length;u++)for(var p=0;p<t;p++)e.vertices.push(n[s][u][p]);s>0&&(o+=n[s-1].length,e.holes.push(o))}return e}});var x_=st(Oe=>{"use strict";Object.defineProperty(Oe,"__esModule",{value:!0});Oe.earthRadius=63710088e-1;Oe.factors={centimeters:Oe.earthRadius*100,centimetres:Oe.earthRadius*100,degrees:Oe.earthRadius/111325,feet:Oe.earthRadius*3.28084,inches:Oe.earthRadius*39.37,kilometers:Oe.earthRadius/1e3,kilometres:Oe.earthRadius/1e3,meters:Oe.earthRadius,metres:Oe.earthRadius,miles:Oe.earthRadius/1609.344,millimeters:Oe.earthRadius*1e3,millimetres:Oe.earthRadius*1e3,nauticalmiles:Oe.earthRadius/1852,radians:1,yards:Oe.earthRadius*1.0936};Oe.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/Oe.earthRadius,yards:1.0936133};Oe.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 nl(n,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=n,o}Oe.feature=nl;function iY(n,t,e){switch(e===void 0&&(e={}),n){case"Point":return m_(t).geometry;case"LineString":return v_(t).geometry;case"Polygon":return y_(t).geometry;case"MultiPoint":return BP(t).geometry;case"MultiLineString":return UP(t).geometry;case"MultiPolygon":return zP(t).geometry;default:throw new Error(n+" is invalid")}}Oe.geometry=iY;function m_(n,t,e){if(e===void 0&&(e={}),!n)throw new Error("coordinates is required");if(!Array.isArray(n))throw new Error("coordinates must be an Array");if(n.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!ug(n[0])||!ug(n[1]))throw new Error("coordinates must contain numbers");var o={type:"Point",coordinates:n};return nl(o,t,e)}Oe.point=m_;function oY(n,t,e){return e===void 0&&(e={}),lg(n.map(function(o){return m_(o,t)}),e)}Oe.points=oY;function y_(n,t,e){e===void 0&&(e={});for(var o=0,s=n;o<s.length;o++){var u=s[o];if(u.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var p=0;p<u[u.length-1].length;p++)if(u[u.length-1][p]!==u[0][p])throw new Error("First and last Position are not equivalent.")}var f={type:"Polygon",coordinates:n};return nl(f,t,e)}Oe.polygon=y_;function sY(n,t,e){return e===void 0&&(e={}),lg(n.map(function(o){return y_(o,t)}),e)}Oe.polygons=sY;function v_(n,t,e){if(e===void 0&&(e={}),n.length<2)throw new Error("coordinates must be an array of two or more positions");var o={type:"LineString",coordinates:n};return nl(o,t,e)}Oe.lineString=v_;function aY(n,t,e){return e===void 0&&(e={}),lg(n.map(function(o){return v_(o,t)}),e)}Oe.lineStrings=aY;function lg(n,t){t===void 0&&(t={});var e={type:"FeatureCollection"};return t.id&&(e.id=t.id),t.bbox&&(e.bbox=t.bbox),e.features=n,e}Oe.featureCollection=lg;function UP(n,t,e){e===void 0&&(e={});var o={type:"MultiLineString",coordinates:n};return nl(o,t,e)}Oe.multiLineString=UP;function BP(n,t,e){e===void 0&&(e={});var o={type:"MultiPoint",coordinates:n};return nl(o,t,e)}Oe.multiPoint=BP;function zP(n,t,e){e===void 0&&(e={});var o={type:"MultiPolygon",coordinates:n};return nl(o,t,e)}Oe.multiPolygon=zP;function uY(n,t,e){e===void 0&&(e={});var o={type:"GeometryCollection",geometries:n};return nl(o,t,e)}Oe.geometryCollection=uY;function lY(n,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(n*e)/e}Oe.round=lY;function GP(n,t){t===void 0&&(t="kilometers");var e=Oe.factors[t];if(!e)throw new Error(t+" units is invalid");return n*e}Oe.radiansToLength=GP;function __(n,t){t===void 0&&(t="kilometers");var e=Oe.factors[t];if(!e)throw new Error(t+" units is invalid");return n/e}Oe.lengthToRadians=__;function cY(n,t){return kP(__(n,t))}Oe.lengthToDegrees=cY;function fY(n){var t=n%360;return t<0&&(t+=360),t}Oe.bearingToAzimuth=fY;function kP(n){var t=n%(2*Math.PI);return t*180/Math.PI}Oe.radiansToDegrees=kP;function hY(n){var t=n%360;return t*Math.PI/180}Oe.degreesToRadians=hY;function pY(n,t,e){if(t===void 0&&(t="kilometers"),e===void 0&&(e="kilometers"),!(n>=0))throw new Error("length must be a positive number");return GP(__(n,t),e)}Oe.convertLength=pY;function dY(n,t,e){if(t===void 0&&(t="meters"),e===void 0&&(e="kilometers"),!(n>=0))throw new Error("area must be a positive number");var o=Oe.areaFactors[t];if(!o)throw new Error("invalid original units");var s=Oe.areaFactors[e];if(!s)throw new Error("invalid final units");return n/o*s}Oe.convertArea=dY;function ug(n){return!isNaN(n)&&n!==null&&!Array.isArray(n)}Oe.isNumber=ug;function gY(n){return!!n&&n.constructor===Object}Oe.isObject=gY;function mY(n){if(!n)throw new Error("bbox is required");if(!Array.isArray(n))throw new Error("bbox must be an Array");if(n.length!==4&&n.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");n.forEach(function(t){if(!ug(t))throw new Error("bbox must only contain numbers")})}Oe.validateBBox=mY;function yY(n){if(!n)throw new Error("id is required");if(["string","number"].indexOf(typeof n)===-1)throw new Error("id must be a number or a string")}Oe.validateId=yY});var w_=st(Si=>{"use strict";Object.defineProperty(Si,"__esModule",{value:!0});var co=x_();function _h(n,t,e){if(n!==null)for(var o,s,u,p,f,g,m,v=0,w=0,S,b=n.type,C=b==="FeatureCollection",R=b==="Feature",x=C?n.features.length:1,E=0;E<x;E++){m=C?n.features[E].geometry:R?n.geometry:n,S=m?m.type==="GeometryCollection":!1,f=S?m.geometries.length:1;for(var I=0;I<f;I++){var A=0,F=0;if(p=S?m.geometries[I]:m,p!==null){g=p.coordinates;var V=p.type;switch(v=e&&(V==="Polygon"||V==="MultiPolygon")?1:0,V){case null:break;case"Point":if(t(g,w,E,A,F)===!1)return!1;w++,A++;break;case"LineString":case"MultiPoint":for(o=0;o<g.length;o++){if(t(g[o],w,E,A,F)===!1)return!1;w++,V==="MultiPoint"&&A++}V==="LineString"&&A++;break;case"Polygon":case"MultiLineString":for(o=0;o<g.length;o++){for(s=0;s<g[o].length-v;s++){if(t(g[o][s],w,E,A,F)===!1)return!1;w++}V==="MultiLineString"&&A++,V==="Polygon"&&F++}V==="Polygon"&&A++;break;case"MultiPolygon":for(o=0;o<g.length;o++){for(F=0,s=0;s<g[o].length;s++){for(u=0;u<g[o][s].length-v;u++){if(t(g[o][s][u],w,E,A,F)===!1)return!1;w++}F++}A++}break;case"GeometryCollection":for(o=0;o<p.geometries.length;o++)if(_h(p.geometries[o],t,e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function vY(n,t,e,o){var s=e;return _h(n,function(u,p,f,g,m){p===0&&e===void 0?s=u:s=t(s,u,p,f,g,m)},o),s}function qP(n,t){var e;switch(n.type){case"FeatureCollection":for(e=0;e<n.features.length&&t(n.features[e].properties,e)!==!1;e++);break;case"Feature":t(n.properties,0);break}}function _Y(n,t,e){var o=e;return qP(n,function(s,u){u===0&&e===void 0?o=s:o=t(o,s,u)}),o}function HP(n,t){if(n.type==="Feature")t(n,0);else if(n.type==="FeatureCollection")for(var e=0;e<n.features.length&&t(n.features[e],e)!==!1;e++);}function xY(n,t,e){var o=e;return HP(n,function(s,u){u===0&&e===void 0?o=s:o=t(o,s,u)}),o}function EY(n){var t=[];return _h(n,function(e){t.push(e)}),t}function E_(n,t){var e,o,s,u,p,f,g,m,v,w,S=0,b=n.type==="FeatureCollection",C=n.type==="Feature",R=b?n.features.length:1;for(e=0;e<R;e++){for(f=b?n.features[e].geometry:C?n.geometry:n,m=b?n.features[e].properties:C?n.properties:{},v=b?n.features[e].bbox:C?n.bbox:void 0,w=b?n.features[e].id:C?n.id:void 0,g=f?f.type==="GeometryCollection":!1,p=g?f.geometries.length:1,s=0;s<p;s++){if(u=g?f.geometries[s]:f,u===null){if(t(null,S,m,v,w)===!1)return!1;continue}switch(u.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(t(u,S,m,v,w)===!1)return!1;break}case"GeometryCollection":{for(o=0;o<u.geometries.length;o++)if(t(u.geometries[o],S,m,v,w)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}S++}}function wY(n,t,e){var o=e;return E_(n,function(s,u,p,f,g){u===0&&e===void 0?o=s:o=t(o,s,u,p,f,g)}),o}function cg(n,t){E_(n,function(e,o,s,u,p){var f=e===null?null:e.type;switch(f){case null:case"Point":case"LineString":case"Polygon":return t(co.feature(e,s,{bbox:u,id:p}),o,0)===!1?!1:void 0}var g;switch(f){case"MultiPoint":g="Point";break;case"MultiLineString":g="LineString";break;case"MultiPolygon":g="Polygon";break}for(var m=0;m<e.coordinates.length;m++){var v=e.coordinates[m],w={type:g,coordinates:v};if(t(co.feature(w,s),o,m)===!1)return!1}})}function SY(n,t,e){var o=e;return cg(n,function(s,u,p){u===0&&p===0&&e===void 0?o=s:o=t(o,s,u,p)}),o}function VP(n,t){cg(n,function(e,o,s){var u=0;if(e.geometry){var p=e.geometry.type;if(!(p==="Point"||p==="MultiPoint")){var f,g=0,m=0,v=0;if(_h(e,function(w,S,b,C,R){if(f===void 0||o>g||C>m||R>v){f=w,g=o,m=C,v=R,u=0;return}var x=co.lineString([f,w],e.properties);if(t(x,o,s,R,u)===!1)return!1;u++,f=w})===!1)return!1}}})}function MY(n,t,e){var o=e,s=!1;return VP(n,function(u,p,f,g,m){s===!1&&e===void 0?o=u:o=t(o,u,p,f,g,m),s=!0}),o}function WP(n,t){if(!n)throw new Error("geojson is required");cg(n,function(e,o,s){if(e.geometry!==null){var u=e.geometry.type,p=e.geometry.coordinates;switch(u){case"LineString":if(t(e,o,s,0,0)===!1)return!1;break;case"Polygon":for(var f=0;f<p.length;f++)if(t(co.lineString(p[f],e.properties),o,s,f)===!1)return!1;break}}})}function bY(n,t,e){var o=e;return WP(n,function(s,u,p,f){u===0&&e===void 0?o=s:o=t(o,s,u,p,f)}),o}function AY(n,t){if(t=t||{},!co.isObject(t))throw new Error("options is invalid");var e=t.featureIndex||0,o=t.multiFeatureIndex||0,s=t.geometryIndex||0,u=t.segmentIndex||0,p=t.properties,f;switch(n.type){case"FeatureCollection":e<0&&(e=n.features.length+e),p=p||n.features[e].properties,f=n.features[e].geometry;break;case"Feature":p=p||n.properties,f=n.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":f=n;break;default:throw new Error("geojson is invalid")}if(f===null)return null;var g=f.coordinates;switch(f.type){case"Point":case"MultiPoint":return null;case"LineString":return u<0&&(u=g.length+u-1),co.lineString([g[u],g[u+1]],p,t);case"Polygon":return s<0&&(s=g.length+s),u<0&&(u=g[s].length+u-1),co.lineString([g[s][u],g[s][u+1]],p,t);case"MultiLineString":return o<0&&(o=g.length+o),u<0&&(u=g[o].length+u-1),co.lineString([g[o][u],g[o][u+1]],p,t);case"MultiPolygon":return o<0&&(o=g.length+o),s<0&&(s=g[o].length+s),u<0&&(u=g[o][s].length-u-1),co.lineString([g[o][s][u],g[o][s][u+1]],p,t)}throw new Error("geojson is invalid")}function TY(n,t){if(t=t||{},!co.isObject(t))throw new Error("options is invalid");var e=t.featureIndex||0,o=t.multiFeatureIndex||0,s=t.geometryIndex||0,u=t.coordIndex||0,p=t.properties,f;switch(n.type){case"FeatureCollection":e<0&&(e=n.features.length+e),p=p||n.features[e].properties,f=n.features[e].geometry;break;case"Feature":p=p||n.properties,f=n.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":f=n;break;default:throw new Error("geojson is invalid")}if(f===null)return null;var g=f.coordinates;switch(f.type){case"Point":return co.point(g,p,t);case"MultiPoint":return o<0&&(o=g.length+o),co.point(g[o],p,t);case"LineString":return u<0&&(u=g.length+u),co.point(g[u],p,t);case"Polygon":return s<0&&(s=g.length+s),u<0&&(u=g[s].length+u),co.point(g[s][u],p,t);case"MultiLineString":return o<0&&(o=g.length+o),u<0&&(u=g[o].length+u),co.point(g[o][u],p,t);case"MultiPolygon":return o<0&&(o=g.length+o),s<0&&(s=g[o].length+s),u<0&&(u=g[o][s].length-u),co.point(g[o][s][u],p,t)}throw new Error("geojson is invalid")}Si.coordAll=EY;Si.coordEach=_h;Si.coordReduce=vY;Si.featureEach=HP;Si.featureReduce=xY;Si.findPoint=TY;Si.findSegment=AY;Si.flattenEach=cg;Si.flattenReduce=SY;Si.geomEach=E_;Si.geomReduce=wY;Si.lineEach=WP;Si.lineReduce=bY;Si.propEach=qP;Si.propReduce=_Y;Si.segmentEach=VP;Si.segmentReduce=MY});var XP=st(M_=>{"use strict";Object.defineProperty(M_,"__esModule",{value:!0});var CY=w_();function S_(n){var t=[1/0,1/0,-1/0,-1/0];return CY.coordEach(n,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}S_.default=S_;M_.default=S_});var fg=st((wot,b_)=>{var Ia=Kv(),$P=x_(),ZP=w_(),nf=XP().default,PY=ZP.featureEach,xot=ZP.coordEach,Eot=$P.polygon,YP=$P.featureCollection;function KP(n){var t=new Ia(n);return t.insert=function(e){if(e.type!=="Feature")throw new Error("invalid feature");return e.bbox=e.bbox?e.bbox:nf(e),Ia.prototype.insert.call(this,e)},t.load=function(e){var o=[];return Array.isArray(e)?e.forEach(function(s){if(s.type!=="Feature")throw new Error("invalid features");s.bbox=s.bbox?s.bbox:nf(s),o.push(s)}):PY(e,function(s){if(s.type!=="Feature")throw new Error("invalid features");s.bbox=s.bbox?s.bbox:nf(s),o.push(s)}),Ia.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:nf(e),Ia.prototype.remove.call(this,e,o)},t.clear=function(){return Ia.prototype.clear.call(this)},t.search=function(e){var o=Ia.prototype.search.call(this,this.toBBox(e));return YP(o)},t.collides=function(e){return Ia.prototype.collides.call(this,this.toBBox(e))},t.all=function(){var e=Ia.prototype.all.call(this);return YP(e)},t.toJSON=function(){return Ia.prototype.toJSON.call(this)},t.fromJSON=function(e){return Ia.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=nf(e);else if(e.type==="FeatureCollection")o=nf(e);else throw new Error("invalid geojson");return{minX:o[0],minY:o[1],maxX:o[2],maxY:o[3]}},t}b_.exports=KP;b_.exports.default=KP});var R_=st((Rat,sI)=>{"use strict";var oI=Object.prototype.toString;sI.exports=function(t){var e=oI.call(t),o=e==="[object Arguments]";return o||(o=e!=="[object Array]"&&t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&oI.call(t.callee)==="[object Function]"),o}});var gI=st((Lat,dI)=>{"use strict";var pI;Object.keys||(wh=Object.prototype.hasOwnProperty,L_=Object.prototype.toString,aI=R_(),N_=Object.prototype.propertyIsEnumerable,uI=!N_.call({toString:null},"toString"),lI=N_.call(function(){},"prototype"),Sh=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],mg=function(n){var t=n.constructor;return t&&t.prototype===n},cI={$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},fI=function(){if(typeof window=="undefined")return!1;for(var n in window)try{if(!cI["$"+n]&&wh.call(window,n)&&window[n]!==null&&typeof window[n]=="object")try{mg(window[n])}catch(t){return!0}}catch(t){return!0}return!1}(),hI=function(n){if(typeof window=="undefined"||!fI)return mg(n);try{return mg(n)}catch(t){return!1}},pI=function(t){var e=t!==null&&typeof t=="object",o=L_.call(t)==="[object Function]",s=aI(t),u=e&&L_.call(t)==="[object String]",p=[];if(!e&&!o&&!s)throw new TypeError("Object.keys called on a non-object");var f=lI&&o;if(u&&t.length>0&&!wh.call(t,0))for(var g=0;g<t.length;++g)p.push(String(g));if(s&&t.length>0)for(var m=0;m<t.length;++m)p.push(String(m));else for(var v in t)!(f&&v==="prototype")&&wh.call(t,v)&&p.push(String(v));if(uI)for(var w=hI(t),S=0;S<Sh.length;++S)!(w&&Sh[S]==="constructor")&&wh.call(t,Sh[S])&&p.push(Sh[S]);return p});var wh,L_,aI,N_,uI,lI,Sh,mg,cI,fI,hI;dI.exports=pI});var O_=st((Nat,vI)=>{"use strict";var zY=Array.prototype.slice,GY=R_(),mI=Object.keys,yg=mI?function(t){return mI(t)}:gI(),yI=Object.keys;yg.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 GY(o)?yI(zY.call(o)):yI(o)})}else Object.keys=yg;return Object.keys||yg};vI.exports=yg});var D_=st((Oat,_I)=>{"use strict";_I.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 s=42;t[e]=s;for(var u 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 p=Object.getOwnPropertySymbols(t);if(p.length!==1||p[0]!==e||!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var f=Object.getOwnPropertyDescriptor(t,e);if(f.value!==s||f.enumerable!==!0)return!1}return!0}});var vg=st((Dat,xI)=>{"use strict";var kY=D_();xI.exports=function(){return kY()&&!!Symbol.toStringTag}});var F_=st((Fat,EI)=>{"use strict";EI.exports=Object});var U_=st((Uat,wI)=>{"use strict";wI.exports=Error});var MI=st((Bat,SI)=>{"use strict";SI.exports=EvalError});var AI=st((zat,bI)=>{"use strict";bI.exports=RangeError});var CI=st((Gat,TI)=>{"use strict";TI.exports=ReferenceError});var B_=st((kat,PI)=>{"use strict";PI.exports=SyntaxError});var ql=st((qat,II)=>{"use strict";II.exports=TypeError});var LI=st((Hat,RI)=>{"use strict";RI.exports=URIError});var OI=st((Vat,NI)=>{"use strict";NI.exports=Math.abs});var FI=st((Wat,DI)=>{"use strict";DI.exports=Math.floor});var BI=st((Xat,UI)=>{"use strict";UI.exports=Math.max});var GI=st((Yat,zI)=>{"use strict";zI.exports=Math.min});var qI=st(($at,kI)=>{"use strict";kI.exports=Math.pow});var VI=st((Zat,HI)=>{"use strict";HI.exports=Math.round});var XI=st((Kat,WI)=>{"use strict";WI.exports=Number.isNaN||function(t){return t!==t}});var $I=st((Jat,YI)=>{"use strict";var qY=XI();YI.exports=function(t){return qY(t)||t===0?t:t<0?-1:1}});var KI=st((jat,ZI)=>{"use strict";ZI.exports=Object.getOwnPropertyDescriptor});var Hl=st((Qat,JI)=>{"use strict";var _g=KI();if(_g)try{_g([],"length")}catch(n){_g=null}JI.exports=_g});var Mh=st((tut,jI)=>{"use strict";var xg=Object.defineProperty||!1;if(xg)try{xg({},"a",{value:1})}catch(n){xg=!1}jI.exports=xg});var eR=st((eut,tR)=>{"use strict";var QI=typeof Symbol!="undefined"&&Symbol,HY=D_();tR.exports=function(){return typeof QI!="function"||typeof Symbol!="function"||typeof QI("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:HY()}});var z_=st((nut,nR)=>{"use strict";nR.exports=typeof Reflect!="undefined"&&Reflect.getPrototypeOf||null});var G_=st((rut,rR)=>{"use strict";var VY=F_();rR.exports=VY.getPrototypeOf||null});var sR=st((iut,oR)=>{"use strict";var WY="Function.prototype.bind called on incompatible ",XY=Object.prototype.toString,YY=Math.max,$Y="[object Function]",iR=function(t,e){for(var o=[],s=0;s<t.length;s+=1)o[s]=t[s];for(var u=0;u<e.length;u+=1)o[u+t.length]=e[u];return o},ZY=function(t,e){for(var o=[],s=e||0,u=0;s<t.length;s+=1,u+=1)o[u]=t[s];return o},KY=function(n,t){for(var e="",o=0;o<n.length;o+=1)e+=n[o],o+1<n.length&&(e+=t);return e};oR.exports=function(t){var e=this;if(typeof e!="function"||XY.apply(e)!==$Y)throw new TypeError(WY+e);for(var o=ZY(arguments,1),s,u=function(){if(this instanceof s){var v=e.apply(this,iR(o,arguments));return Object(v)===v?v:this}return e.apply(t,iR(o,arguments))},p=YY(0,e.length-o.length),f=[],g=0;g<p;g++)f[g]="$"+g;if(s=Function("binder","return function ("+KY(f,",")+"){ return binder.apply(this,arguments); }")(u),e.prototype){var m=function(){};m.prototype=e.prototype,s.prototype=new m,m.prototype=null}return s}});var rf=st((out,aR)=>{"use strict";var JY=sR();aR.exports=Function.prototype.bind||JY});var Eg=st((sut,uR)=>{"use strict";uR.exports=Function.prototype.call});var wg=st((aut,lR)=>{"use strict";lR.exports=Function.prototype.apply});var fR=st((uut,cR)=>{"use strict";cR.exports=typeof Reflect!="undefined"&&Reflect&&Reflect.apply});var k_=st((lut,hR)=>{"use strict";var jY=rf(),QY=wg(),t$=Eg(),e$=fR();hR.exports=e$||jY.call(t$,QY)});var Sg=st((cut,pR)=>{"use strict";var n$=rf(),r$=ql(),i$=Eg(),o$=k_();pR.exports=function(t){if(t.length<1||typeof t[0]!="function")throw new r$("a function is required");return o$(n$,i$,t)}});var _R=st((fut,vR)=>{"use strict";var s$=Sg(),dR=Hl(),mR;try{mR=[].__proto__===Array.prototype}catch(n){if(!n||typeof n!="object"||!("code"in n)||n.code!=="ERR_PROTO_ACCESS")throw n}var q_=!!mR&&dR&&dR(Object.prototype,"__proto__"),yR=Object,gR=yR.getPrototypeOf;vR.exports=q_&&typeof q_.get=="function"?s$([q_.get]):typeof gR=="function"?function(t){return gR(t==null?t:yR(t))}:!1});var H_=st((hut,SR)=>{"use strict";var xR=z_(),ER=G_(),wR=_R();SR.exports=xR?function(t){return xR(t)}:ER?function(t){if(!t||typeof t!="object"&&typeof t!="function")throw new TypeError("getProto: not an object");return ER(t)}:wR?function(t){return wR(t)}:null});var V_=st((put,MR)=>{"use strict";var a$=Function.prototype.call,u$=Object.prototype.hasOwnProperty,l$=rf();MR.exports=l$.call(a$,u$)});var Y_=st((dut,IR)=>{"use strict";var Un,c$=F_(),f$=U_(),h$=MI(),p$=AI(),d$=CI(),uf=B_(),af=ql(),g$=LI(),m$=OI(),y$=FI(),v$=BI(),_$=GI(),x$=qI(),E$=VI(),w$=$I(),CR=Function,W_=function(n){try{return CR('"use strict"; return ('+n+").constructor;")()}catch(t){}},bh=Hl(),S$=Mh(),X_=function(){throw new af},M$=bh?function(){try{return arguments.callee,X_}catch(n){try{return bh(arguments,"callee").get}catch(t){return X_}}}():X_,of=eR()(),qi=H_(),b$=G_(),A$=z_(),PR=wg(),Ah=Eg(),sf={},T$=typeof Uint8Array=="undefined"||!qi?Un:qi(Uint8Array),Vl={__proto__:null,"%AggregateError%":typeof AggregateError=="undefined"?Un:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer=="undefined"?Un:ArrayBuffer,"%ArrayIteratorPrototype%":of&&qi?qi([][Symbol.iterator]()):Un,"%AsyncFromSyncIteratorPrototype%":Un,"%AsyncFunction%":sf,"%AsyncGenerator%":sf,"%AsyncGeneratorFunction%":sf,"%AsyncIteratorPrototype%":sf,"%Atomics%":typeof Atomics=="undefined"?Un:Atomics,"%BigInt%":typeof BigInt=="undefined"?Un:BigInt,"%BigInt64Array%":typeof BigInt64Array=="undefined"?Un:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array=="undefined"?Un:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView=="undefined"?Un:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":f$,"%eval%":eval,"%EvalError%":h$,"%Float16Array%":typeof Float16Array=="undefined"?Un:Float16Array,"%Float32Array%":typeof Float32Array=="undefined"?Un:Float32Array,"%Float64Array%":typeof Float64Array=="undefined"?Un:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry=="undefined"?Un:FinalizationRegistry,"%Function%":CR,"%GeneratorFunction%":sf,"%Int8Array%":typeof Int8Array=="undefined"?Un:Int8Array,"%Int16Array%":typeof Int16Array=="undefined"?Un:Int16Array,"%Int32Array%":typeof Int32Array=="undefined"?Un:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":of&&qi?qi(qi([][Symbol.iterator]())):Un,"%JSON%":typeof JSON=="object"?JSON:Un,"%Map%":typeof Map=="undefined"?Un:Map,"%MapIteratorPrototype%":typeof Map=="undefined"||!of||!qi?Un:qi(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":c$,"%Object.getOwnPropertyDescriptor%":bh,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise=="undefined"?Un:Promise,"%Proxy%":typeof Proxy=="undefined"?Un:Proxy,"%RangeError%":p$,"%ReferenceError%":d$,"%Reflect%":typeof Reflect=="undefined"?Un:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set=="undefined"?Un:Set,"%SetIteratorPrototype%":typeof Set=="undefined"||!of||!qi?Un:qi(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer=="undefined"?Un:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":of&&qi?qi(""[Symbol.iterator]()):Un,"%Symbol%":of?Symbol:Un,"%SyntaxError%":uf,"%ThrowTypeError%":M$,"%TypedArray%":T$,"%TypeError%":af,"%Uint8Array%":typeof Uint8Array=="undefined"?Un:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray=="undefined"?Un:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array=="undefined"?Un:Uint16Array,"%Uint32Array%":typeof Uint32Array=="undefined"?Un:Uint32Array,"%URIError%":g$,"%WeakMap%":typeof WeakMap=="undefined"?Un:WeakMap,"%WeakRef%":typeof WeakRef=="undefined"?Un:WeakRef,"%WeakSet%":typeof WeakSet=="undefined"?Un:WeakSet,"%Function.prototype.call%":Ah,"%Function.prototype.apply%":PR,"%Object.defineProperty%":S$,"%Object.getPrototypeOf%":b$,"%Math.abs%":m$,"%Math.floor%":y$,"%Math.max%":v$,"%Math.min%":_$,"%Math.pow%":x$,"%Math.round%":E$,"%Math.sign%":w$,"%Reflect.getPrototypeOf%":A$};if(qi)try{null.error}catch(n){bR=qi(qi(n)),Vl["%Error.prototype%"]=bR}var bR,C$=function n(t){var e;if(t==="%AsyncFunction%")e=W_("async function () {}");else if(t==="%GeneratorFunction%")e=W_("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=W_("async function* () {}");else if(t==="%AsyncGenerator%"){var o=n("%AsyncGeneratorFunction%");o&&(e=o.prototype)}else if(t==="%AsyncIteratorPrototype%"){var s=n("%AsyncGenerator%");s&&qi&&(e=qi(s.prototype))}return Vl[t]=e,e},AR={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},Th=rf(),Mg=V_(),P$=Th.call(Ah,Array.prototype.concat),I$=Th.call(PR,Array.prototype.splice),TR=Th.call(Ah,String.prototype.replace),bg=Th.call(Ah,String.prototype.slice),R$=Th.call(Ah,RegExp.prototype.exec),L$=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,N$=/\\(\\)?/g,O$=function(t){var e=bg(t,0,1),o=bg(t,-1);if(e==="%"&&o!=="%")throw new uf("invalid intrinsic syntax, expected closing `%`");if(o==="%"&&e!=="%")throw new uf("invalid intrinsic syntax, expected opening `%`");var s=[];return TR(t,L$,function(u,p,f,g){s[s.length]=f?TR(g,N$,"$1"):p||u}),s},D$=function(t,e){var o=t,s;if(Mg(AR,o)&&(s=AR[o],o="%"+s[0]+"%"),Mg(Vl,o)){var u=Vl[o];if(u===sf&&(u=C$(o)),typeof u=="undefined"&&!e)throw new af("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:s,name:o,value:u}}throw new uf("intrinsic "+t+" does not exist!")};IR.exports=function(t,e){if(typeof t!="string"||t.length===0)throw new af("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new af('"allowMissing" argument must be a boolean');if(R$(/^%?[^%]*%?$/,t)===null)throw new uf("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var o=O$(t),s=o.length>0?o[0]:"",u=D$("%"+s+"%",e),p=u.name,f=u.value,g=!1,m=u.alias;m&&(s=m[0],I$(o,P$([0,1],m)));for(var v=1,w=!0;v<o.length;v+=1){var S=o[v],b=bg(S,0,1),C=bg(S,-1);if((b==='"'||b==="'"||b==="`"||C==='"'||C==="'"||C==="`")&&b!==C)throw new uf("property names with quotes must have matching quotes");if((S==="constructor"||!w)&&(g=!0),s+="."+S,p="%"+s+"%",Mg(Vl,p))f=Vl[p];else if(f!=null){if(!(S in f)){if(!e)throw new af("base intrinsic for "+t+" exists, but the property is not available.");return}if(bh&&v+1>=o.length){var R=bh(f,S);w=!!R,w&&"get"in R&&!("originalValue"in R.get)?f=R.get:f=f[S]}else w=Mg(f,S),f=f[S];w&&!g&&(Vl[p]=f)}}return f}});var Ag=st((gut,NR)=>{"use strict";var RR=Y_(),LR=Sg(),F$=LR([RR("%String.prototype.indexOf%")]);NR.exports=function(t,e){var o=RR(t,!!e);return typeof o=="function"&&F$(t,".prototype.")>-1?LR([o]):o}});var FR=st((mut,DR)=>{"use strict";var U$=vg()(),B$=Ag(),$_=B$("Object.prototype.toString"),Tg=function(t){return U$&&t&&typeof t=="object"&&Symbol.toStringTag in t?!1:$_(t)==="[object Arguments]"},OR=function(t){return Tg(t)?!0:t!==null&&typeof t=="object"&&"length"in t&&typeof t.length=="number"&&t.length>=0&&$_(t)!=="[object Array]"&&"callee"in t&&$_(t.callee)==="[object Function]"},z$=function(){return Tg(arguments)}();Tg.isLegacyArguments=OR;DR.exports=z$?Tg:OR});var Cg=st((yut,zR)=>{"use strict";var UR=Mh(),G$=B_(),lf=ql(),BR=Hl();zR.exports=function(t,e,o){if(!t||typeof t!="object"&&typeof t!="function")throw new lf("`obj` must be an object or a function`");if(typeof e!="string"&&typeof e!="symbol")throw new lf("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new lf("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new lf("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new lf("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new lf("`loose`, if provided, must be a boolean");var s=arguments.length>3?arguments[3]:null,u=arguments.length>4?arguments[4]:null,p=arguments.length>5?arguments[5]:null,f=arguments.length>6?arguments[6]:!1,g=!!BR&&BR(t,e);if(UR)UR(t,e,{configurable:p===null&&g?g.configurable:!p,enumerable:s===null&&g?g.enumerable:!s,value:o,writable:u===null&&g?g.writable:!u});else if(f||!s&&!u&&!p)t[e]=o;else throw new G$("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var Pg=st((vut,kR)=>{"use strict";var Z_=Mh(),GR=function(){return!!Z_};GR.hasArrayLengthDefineBug=function(){if(!Z_)return null;try{return Z_([],"length",{value:1}).length!==1}catch(t){return!0}};kR.exports=GR});var cf=st((_ut,WR)=>{"use strict";var k$=O_(),q$=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",H$=Object.prototype.toString,V$=Array.prototype.concat,qR=Cg(),W$=function(n){return typeof n=="function"&&H$.call(n)==="[object Function]"},HR=Pg()(),X$=function(n,t,e,o){if(t in n){if(o===!0){if(n[t]===e)return}else if(!W$(o)||!o())return}HR?qR(n,t,e,!0):qR(n,t,e)},VR=function(n,t){var e=arguments.length>2?arguments[2]:{},o=k$(t);q$&&(o=V$.call(o,Object.getOwnPropertySymbols(t)));for(var s=0;s<o.length;s+=1)X$(n,o[s],t[o[s]],e[o[s]])};VR.supportsDescriptors=!!HR;WR.exports=VR});var KR=st((xut,ZR)=>{"use strict";var Y$=Y_(),XR=Cg(),$$=Pg()(),YR=Hl(),$R=ql(),Z$=Y$("%Math.floor%");ZR.exports=function(t,e){if(typeof t!="function")throw new $R("`fn` is not a function");if(typeof e!="number"||e<0||e>4294967295||Z$(e)!==e)throw new $R("`length` must be a positive 32-bit integer");var o=arguments.length>2&&!!arguments[2],s=!0,u=!0;if("length"in t&&YR){var p=YR(t,"length");p&&!p.configurable&&(s=!1),p&&!p.writable&&(u=!1)}return(s||u||!o)&&($$?XR(t,"length",e,!0,!0):XR(t,"length",e)),t}});var jR=st((Eut,JR)=>{"use strict";var K$=rf(),J$=wg(),j$=k_();JR.exports=function(){return j$(K$,J$,arguments)}});var K_=st((wut,Ig)=>{"use strict";var Q$=KR(),QR=Mh(),tZ=Sg(),tL=jR();Ig.exports=function(t){var e=tZ(arguments),o=t.length-(arguments.length-1);return Q$(e,1+(o>0?o:0),!0)};QR?QR(Ig.exports,"apply",{value:tL}):Ig.exports.apply=tL});var J_=st((Sut,nL)=>{"use strict";var eL=function(n){return n!==n};nL.exports=function(t,e){return t===0&&e===0?1/t===1/e:!!(t===e||eL(t)&&eL(e))}});var j_=st((Mut,rL)=>{"use strict";var eZ=J_();rL.exports=function(){return typeof Object.is=="function"?Object.is:eZ}});var oL=st((but,iL)=>{"use strict";var nZ=j_(),rZ=cf();iL.exports=function(){var t=nZ();return rZ(Object,{is:t},{is:function(){return Object.is!==t}}),t}});var lL=st((Aut,uL)=>{"use strict";var iZ=cf(),oZ=K_(),sZ=J_(),sL=j_(),aZ=oL(),aL=oZ(sL(),Object);iZ(aL,{getPolyfill:sL,implementation:sZ,shim:aZ});uL.exports=aL});var gL=st((Tut,dL)=>{"use strict";var cL=Ag(),uZ=vg()(),lZ=V_(),cZ=Hl(),e1;uZ?(fL=cL("RegExp.prototype.exec"),Q_={},Rg=function(){throw Q_},t1={toString:Rg,valueOf:Rg},typeof Symbol.toPrimitive=="symbol"&&(t1[Symbol.toPrimitive]=Rg),e1=function(t){if(!t||typeof t!="object")return!1;var e=cZ(t,"lastIndex"),o=e&&lZ(e,"value");if(!o)return!1;try{fL(t,t1)}catch(s){return s===Q_}}):(hL=cL("Object.prototype.toString"),pL="[object RegExp]",e1=function(t){return!t||typeof t!="object"&&typeof t!="function"?!1:hL(t)===pL});var fL,Q_,Rg,t1,hL,pL;dL.exports=e1});var yL=st((Cut,mL)=>{"use strict";var Ph=function(){return typeof function(){}.name=="string"},Ch=Object.getOwnPropertyDescriptor;if(Ch)try{Ch([],"length")}catch(n){Ch=null}Ph.functionsHaveConfigurableNames=function(){if(!Ph()||!Ch)return!1;var t=Ch(function(){},"name");return!!t&&!!t.configurable};var fZ=Function.prototype.bind;Ph.boundFunctionsHaveNames=function(){return Ph()&&typeof fZ=="function"&&function(){}.bind().name!==""};mL.exports=Ph});var xL=st((Put,_L)=>{"use strict";var vL=Cg(),hZ=Pg()(),pZ=yL().functionsHaveConfigurableNames(),dZ=ql();_L.exports=function(t,e){if(typeof t!="function")throw new dZ("`fn` is not a function");var o=arguments.length>2&&!!arguments[2];return(!o||pZ)&&(hZ?vL(t,"name",e,!0,!0):vL(t,"name",e)),t}});var n1=st((Iut,EL)=>{"use strict";var gZ=xL(),mZ=ql(),yZ=Object;EL.exports=gZ(function(){if(this==null||this!==yZ(this))throw new mZ("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 r1=st((Rut,wL)=>{"use strict";var vZ=n1(),_Z=cf().supportsDescriptors,xZ=Object.getOwnPropertyDescriptor;wL.exports=function(){if(_Z&&/a/mig.flags==="gim"){var t=xZ(RegExp.prototype,"flags");if(t&&typeof t.get=="function"&&"dotAll"in RegExp.prototype&&"hasIndices"in RegExp.prototype){var e="",o={};if(Object.defineProperty(o,"hasIndices",{get:function(){e+="d"}}),Object.defineProperty(o,"sticky",{get:function(){e+="y"}}),t.get.call(o),e==="dy")return t.get}}return vZ}});var bL=st((Lut,ML)=>{"use strict";var EZ=cf().supportsDescriptors,wZ=r1(),SZ=Hl(),MZ=Object.defineProperty,bZ=U_(),SL=H_(),AZ=/a/;ML.exports=function(){if(!EZ||!SL)throw new bZ("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var t=wZ(),e=SL(AZ),o=SZ(e,"flags");return(!o||o.get!==t)&&MZ(e,"flags",{configurable:!0,enumerable:!1,get:t}),t}});var PL=st((Nut,CL)=>{"use strict";var TZ=cf(),CZ=K_(),PZ=n1(),AL=r1(),IZ=bL(),TL=CZ(AL());TZ(TL,{getPolyfill:AL,implementation:PZ,shim:IZ});CL.exports=TL});var LL=st((Out,RL)=>{"use strict";var IL=Ag(),RZ=IL("Date.prototype.getDay"),LZ=function(t){try{return RZ(t),!0}catch(e){return!1}},NZ=IL("Object.prototype.toString"),OZ="[object Date]",DZ=vg()();RL.exports=function(t){return typeof t!="object"||t===null?!1:DZ?LZ(t):NZ(t)===OZ}});var i1=st((Dut,HL)=>{var NL=O_(),OL=FR(),DL=lL(),FL=gL(),UL=PL(),BL=LL(),zL=Date.prototype.getTime;function qL(n,t,e){var o=e||{};return(o.strict?DL(n,t):n===t)?!0:!n||!t||typeof n!="object"&&typeof t!="object"?o.strict?DL(n,t):n==t:FZ(n,t,o)}function GL(n){return n==null}function kL(n){return!(!n||typeof n!="object"||typeof n.length!="number"||typeof n.copy!="function"||typeof n.slice!="function"||n.length>0&&typeof n[0]!="number")}function FZ(n,t,e){var o,s;if(typeof n!=typeof t||GL(n)||GL(t)||n.prototype!==t.prototype||OL(n)!==OL(t))return!1;var u=FL(n),p=FL(t);if(u!==p)return!1;if(u||p)return n.source===t.source&&UL(n)===UL(t);if(BL(n)&&BL(t))return zL.call(n)===zL.call(t);var f=kL(n),g=kL(t);if(f!==g)return!1;if(f||g){if(n.length!==t.length)return!1;for(o=0;o<n.length;o++)if(n[o]!==t[o])return!1;return!0}if(typeof n!=typeof t)return!1;try{var m=NL(n),v=NL(t)}catch(w){return!1}if(m.length!==v.length)return!1;for(m.sort(),v.sort(),o=m.length-1;o>=0;o--)if(m[o]!=v[o])return!1;for(o=m.length-1;o>=0;o--)if(s=m[o],!qL(n[s],t[s],e))return!1;return!0}HL.exports=qL});var m1=st((kct,KL)=>{var AK=i1(),Ra=function(n){this.precision=n&&n.precision?n.precision:17,this.direction=n&&n.direction?n.direction:!1,this.pseudoNode=n&&n.pseudoNode?n.pseudoNode:!1,this.objectComparator=n&&n.objectComparator?n.objectComparator:TK};Ra.prototype.compare=function(n,t){if(n.type!==t.type||!ZL(n,t))return!1;switch(n.type){case"Point":return this.compareCoord(n.coordinates,t.coordinates);case"LineString":return this.compareLine(n.coordinates,t.coordinates,0,!1);case"Polygon":return this.comparePolygon(n,t);case"Feature":return this.compareFeature(n,t);default:if(n.type.indexOf("Multi")===0){var e=this,o=$L(n),s=$L(t);return o.every(function(u){return this.some(function(p){return e.compare(u,p)})},s)}}return!1};function $L(n){return n.coordinates.map(function(t){return{type:n.type.replace("Multi",""),coordinates:t}})}function ZL(n,t){return n.hasOwnProperty("coordinates")?n.coordinates.length===t.coordinates.length:n.length===t.length}Ra.prototype.compareCoord=function(n,t){if(n.length!==t.length)return!1;for(var e=0;e<n.length;e++)if(n[e].toFixed(this.precision)!==t[e].toFixed(this.precision))return!1;return!0};Ra.prototype.compareLine=function(n,t,e,o){if(!ZL(n,t))return!1;var s=this.pseudoNode?n:this.removePseudo(n),u=this.pseudoNode?t:this.removePseudo(t);if(!(o&&!this.compareCoord(s[0],u[0])&&(u=this.fixStartIndex(u,s),!u))){var p=this.compareCoord(s[e],u[e]);return this.direction||p?this.comparePath(s,u):this.compareCoord(s[e],u[u.length-(1+e)])?this.comparePath(s.slice().reverse(),u):!1}};Ra.prototype.fixStartIndex=function(n,t){for(var e,o=-1,s=0;s<n.length;s++)if(this.compareCoord(n[s],t[0])){o=s;break}return o>=0&&(e=[].concat(n.slice(o,n.length),n.slice(1,o+1))),e};Ra.prototype.comparePath=function(n,t){var e=this;return n.every(function(o,s){return e.compareCoord(o,this[s])},t)};Ra.prototype.comparePolygon=function(n,t){if(this.compareLine(n.coordinates[0],t.coordinates[0],1,!0)){var e=n.coordinates.slice(1,n.coordinates.length),o=t.coordinates.slice(1,t.coordinates.length),s=this;return e.every(function(u){return this.some(function(p){return s.compareLine(u,p,1,!0)})},o)}else return!1};Ra.prototype.compareFeature=function(n,t){return n.id!==t.id||!this.objectComparator(n.properties,t.properties)||!this.compareBBox(n,t)?!1:this.compare(n.geometry,t.geometry)};Ra.prototype.compareBBox=function(n,t){return!!(!n.bbox&&!t.bbox||n.bbox&&t.bbox&&this.compareCoord(n.bbox,t.bbox))};Ra.prototype.removePseudo=function(n){return n};function TK(n,t){return AK(n,t,{strict:!0})}KL.exports=Ra});var JL=st((Qct,Og)=>{function il(n,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(n,t,e,o)}il.prototype.run=function(n,t,e,o){this._init(n,t,e,o);for(var s=0;s<this._datasetLength;s++)if(this._visited[s]!==1){this._visited[s]=1;var u=this._regionQuery(s);if(u.length<this.minPts)this.noise.push(s);else{var p=this.clusters.length;this.clusters.push([]),this._addToCluster(s,p),this._expandCluster(p,u)}}return this.clusters};il.prototype._init=function(n,t,e,o){if(n){if(!(n instanceof Array))throw Error("Dataset must be of type array, "+typeof n+" given");this.dataset=n,this.clusters=[],this.noise=[],this._datasetLength=n.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)};il.prototype._expandCluster=function(n,t){for(var e=0;e<t.length;e++){var o=t[e];if(this._visited[o]!==1){this._visited[o]=1;var s=this._regionQuery(o);s.length>=this.minPts&&(t=this._mergeArrays(t,s))}this._assigned[o]!==1&&this._addToCluster(o,n)}};il.prototype._addToCluster=function(n,t){this.clusters[t].push(n),this._assigned[n]=1};il.prototype._regionQuery=function(n){for(var t=[],e=0;e<this._datasetLength;e++){var o=this.distance(this.dataset[n],this.dataset[e]);o<this.epsilon&&t.push(e)}return t};il.prototype._mergeArrays=function(n,t){for(var e=t.length,o=0;o<e;o++){var s=t[o];n.indexOf(s)<0&&n.push(s)}return n};il.prototype._euclideanDistance=function(n,t){for(var e=0,o=Math.min(n.length,t.length);o--;)e+=(n[o]-t[o])*(n[o]-t[o]);return Math.sqrt(e)};typeof Og!="undefined"&&Og.exports&&(Og.exports=il)});var jL=st((tft,Dg)=>{function ol(n,t,e){this.k=3,this.dataset=[],this.assignments=[],this.centroids=[],this.init(n,t,e)}ol.prototype.init=function(n,t,e){this.assignments=[],this.centroids=[],typeof n!="undefined"&&(this.dataset=n),typeof t!="undefined"&&(this.k=t),typeof e!="undefined"&&(this.distance=e)};ol.prototype.run=function(n,t){this.init(n,t);for(var e=this.dataset.length,o=0;o<this.k;o++)this.centroids[o]=this.randomCentroid();for(var s=!0;s;){s=this.assign();for(var u=0;u<this.k;u++){for(var p=new Array(v),f=0,g=0;g<v;g++)p[g]=0;for(var m=0;m<e;m++){var v=this.dataset[m].length;if(u===this.assignments[m]){for(var g=0;g<v;g++)p[g]+=this.dataset[m][g];f++}}if(f>0){for(var g=0;g<v;g++)p[g]/=f;this.centroids[u]=p}else this.centroids[u]=this.randomCentroid(),s=!0}}return this.getClusters()};ol.prototype.randomCentroid=function(){var n=this.dataset.length-1,t,e;do e=Math.round(Math.random()*n),t=this.dataset[e];while(this.centroids.indexOf(t)>=0);return t};ol.prototype.assign=function(){for(var n=!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,n=!0);return n};ol.prototype.getClusters=function(){for(var n=new Array(this.k),t,e=0;e<this.assignments.length;e++)t=this.assignments[e],typeof n[t]=="undefined"&&(n[t]=[]),n[t].push(e);return n};ol.prototype.argmin=function(n,t,e){for(var o=Number.MAX_VALUE,s=0,u=t.length,p,f=0;f<u;f++)p=e(n,t[f]),p<o&&(o=p,s=f);return s};ol.prototype.distance=function(n,t){for(var e=0,o=Math.min(n.length,t.length);o--;){var s=n[o]-t[o];e+=s*s}return Math.sqrt(e)};typeof Dg!="undefined"&&Dg.exports&&(Dg.exports=ol)});var y1=st((eft,Fg)=>{function La(n,t,e){this._queue=[],this._priorities=[],this._sorting="desc",this._init(n,t,e)}La.prototype.insert=function(n,t){for(var e=this._queue.length,o=e;o--;){var s=this._priorities[o];this._sorting==="desc"?t>s&&(e=o):t<s&&(e=o)}this._insertAt(n,t,e)};La.prototype.remove=function(n){for(var t=this._queue.length;t--;){var e=this._queue[t];if(n===e){this._queue.splice(t,1),this._priorities.splice(t,1);break}}};La.prototype.forEach=function(n){this._queue.forEach(n)};La.prototype.getElements=function(){return this._queue};La.prototype.getElementPriority=function(n){return this._priorities[n]};La.prototype.getPriorities=function(){return this._priorities};La.prototype.getElementsWithPriorities=function(){for(var n=[],t=0,e=this._queue.length;t<e;t++)n.push([this._queue[t],this._priorities[t]]);return n};La.prototype._init=function(n,t,e){if(n&&t){if(this._queue=[],this._priorities=[],n.length!==t.length)throw new Error("Arrays must have the same length");for(var o=0;o<n.length;o++)this.insert(n[o],t[o])}e&&(this._sorting=e)};La.prototype._insertAt=function(n,t,e){this._queue.length===e?(this._queue.push(n),this._priorities.push(t)):(this._queue.splice(e,0,n),this._priorities.splice(e,0,t))};typeof Fg!="undefined"&&Fg.exports&&(Fg.exports=La)});var tN=st((nft,hf)=>{typeof hf!="undefined"&&hf.exports&&(QL=y1());var QL;function du(n,t,e,o){this.epsilon=1,this.minPts=1,this.distance=this._euclideanDistance,this._reachability=[],this._processed=[],this._coreDistance=0,this._orderedList=[],this._init(n,t,e,o)}du.prototype.run=function(n,t,e,o){this._init(n,t,e,o);for(var s=0,u=this.dataset.length;s<u;s++)if(this._processed[s]!==1){this._processed[s]=1,this.clusters.push([s]);var p=this.clusters.length-1;this._orderedList.push(s);var f=new QL(null,null,"asc"),g=this._regionQuery(s);this._distanceToCore(s)!==void 0&&(this._updateQueue(s,g,f),this._expandCluster(p,f))}return this.clusters};du.prototype.getReachabilityPlot=function(){for(var n=[],t=0,e=this._orderedList.length;t<e;t++){var o=this._orderedList[t],s=this._reachability[o];n.push([o,s])}return n};du.prototype._init=function(n,t,e,o){if(n){if(!(n instanceof Array))throw Error("Dataset must be of type array, "+typeof n+" given");this.dataset=n,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)};du.prototype._updateQueue=function(n,t,e){var o=this;this._coreDistance=this._distanceToCore(n),t.forEach(function(s){if(o._processed[s]===void 0){var u=o.distance(o.dataset[n],o.dataset[s]),p=Math.max(o._coreDistance,u);o._reachability[s]===void 0?(o._reachability[s]=p,e.insert(s,p)):p<o._reachability[s]&&(o._reachability[s]=p,e.remove(s),e.insert(s,p))}})};du.prototype._expandCluster=function(n,t){for(var e=t.getElements(),o=0,s=e.length;o<s;o++){var u=e[o];if(this._processed[u]===void 0){var p=this._regionQuery(u);this._processed[u]=1,this.clusters[n].push(u),this._orderedList.push(u),this._distanceToCore(u)!==void 0&&(this._updateQueue(u,p,t),this._expandCluster(n,t))}}};du.prototype._distanceToCore=function(n){for(var t=this.epsilon,e=0;e<t;e++){var o=this._regionQuery(n,e);if(o.length>=this.minPts)return e}};du.prototype._regionQuery=function(n,t){t=t||this.epsilon;for(var e=[],o=0,s=this.dataset.length;o<s;o++)this.distance(this.dataset[n],this.dataset[o])<t&&e.push(o);return e};du.prototype._euclideanDistance=function(n,t){for(var e=0,o=Math.min(n.length,t.length);o--;)e+=(n[o]-t[o])*(n[o]-t[o]);return Math.sqrt(e)};typeof hf!="undefined"&&hf.exports&&(hf.exports=du)});var eN=st((rft,Ug)=>{typeof Ug!="undefined"&&Ug.exports&&(Ug.exports={DBSCAN:JL(),KMEANS:jL(),OPTICS:tN(),PriorityQueue:y1()})});var v1=st((lft,rN)=>{"use strict";rN.exports={eudist:function(t,e,o){for(var s=t.length,u=0,p=0;p<s;p++){var f=(t[p]||0)-(e[p]||0);u+=f*f}return o?Math.sqrt(u):u},mandist:function(t,e,o){for(var s=t.length,u=0,p=0;p<s;p++)u+=Math.abs((t[p]||0)-(e[p]||0));return o?Math.sqrt(u):u},dist:function(t,e,o){var s=Math.abs(t-e);return o?s:s*s}}});var sN=st((cft,oN)=>{"use strict";var iN=v1(),NK=iN.eudist,OK=iN.dist;oN.exports={kmrand:function(t,e){for(var o={},s=[],u=e<<2,p=t.length,f=t[0].length>0;s.length<e&&u-- >0;){var g=t[Math.floor(Math.random()*p)],m=f?g.join("_"):""+g;o[m]||(o[m]=!0,s.push(g))}if(s.length<e)throw new Error("Error initializating clusters");return s},kmpp:function(t,e){var o=t[0].length?NK:OK,s=[],u=t.length,p=t[0].length>0,f={},g=t[Math.floor(Math.random()*u)],m=p?g.join("_"):""+g;for(s.push(g),f[m]=!0;s.length<e;){for(var v=[],w=s.length,S=0,b=[],C=0;C<u;C++){for(var R=1/0,x=0;x<w;x++){var E=o(t[C],s[x]);E<=R&&(R=E)}v[C]=R}for(var I=0;I<u;I++)S+=v[I];for(var A=0;A<u;A++)b[A]={i:A,v:t[A],pr:v[A]/S,cs:0};b.sort(function(q,D){return q.pr-D.pr}),b[0].cs=b[0].pr;for(var F=1;F<u;F++)b[F].cs=b[F-1].cs+b[F].pr;for(var V=Math.random(),X=0;X<u-1&&b[X++].cs<V;);s.push(b[X-1].v)}return s}}});var fN=st((pft,cN)=>{"use strict";var _1=v1(),lN=sN(),DK=_1.eudist,fft=_1.mandist,hft=_1.dist,FK=lN.kmrand,UK=lN.kmpp,aN=1e4;function uN(n,t,e){e=e||[];for(var o=0;o<n;o++)e[o]=t;return e}function BK(n,t,e,o){var s=[],u=[],p=[],f=[],g=!1,m=o||aN,v=n.length,w=n[0].length,S=w>0,b=[];if(e)e=="kmrand"?s=FK(n,t):e=="kmpp"?s=UK(n,t):s=e;else for(var C={};s.length<t;){var R=Math.floor(Math.random()*v);C[R]||(C[R]=!0,s.push(n[R]))}do{uN(t,0,b);for(var x=0;x<v;x++){for(var E=1/0,I=0,A=0;A<t;A++){var f=S?DK(n[x],s[A]):Math.abs(n[x]-s[A]);f<=E&&(E=f,I=A)}p[x]=I,b[I]++}for(var F=[],u=[],V=0,X=0;X<t;X++)F[X]=S?uN(w,0,F[X]):0,u[X]=s[X];if(S){for(var q=0;q<t;q++)s[q]=[];for(var D=0;D<v;D++)for(var xt=p[D],B=F[xt],j=n[D],K=0;K<w;K++)B[K]+=j[K];g=!0;for(var Dt=0;Dt<t;Dt++){for(var Q=s[Dt],At=F[Dt],Mt=u[Dt],Lt=b[Dt],pt=0;pt<w;pt++)Q[pt]=At[pt]/Lt||0;if(g){for(var yt=0;yt<w;yt++)if(Mt[yt]!=Q[yt]){g=!1;break}}}}else{for(var J=0;J<v;J++){var Bt=p[J];F[Bt]+=n[J]}for(var Gt=0;Gt<t;Gt++)s[Gt]=F[Gt]/b[Gt]||0;g=!0;for(var ae=0;ae<t;ae++)if(u[ae]!=s[ae]){g=!1;break}}g=g||--m<=0}while(!g);return{it:aN-m,k:t,idxs:p,centroids:s}}cN.exports=BK});var yf=st((b1,A1)=>{(function(n,t){typeof b1=="object"&&typeof A1!="undefined"?A1.exports=t():typeof define=="function"&&define.amd?define(t):(n=typeof globalThis!="undefined"?globalThis:n||self,n.polygonClipping=t())})(b1,function(){"use strict";function n(rt,P){var N={label:0,sent:function(){if(W[0]&1)throw W[1];return W[1]},trys:[],ops:[]},k,$,W,ht;return ht={next:at(0),throw:at(1),return:at(2)},typeof Symbol=="function"&&(ht[Symbol.iterator]=function(){return this}),ht;function at(Et){return function(G){return wt([Et,G])}}function wt(Et){if(k)throw new TypeError("Generator is already executing.");for(;N;)try{if(k=1,$&&(W=Et[0]&2?$.return:Et[0]?$.throw||((W=$.return)&&W.call($),0):$.next)&&!(W=W.call($,Et[1])).done)return W;switch($=0,W&&(Et=[Et[0]&2,W.value]),Et[0]){case 0:case 1:W=Et;break;case 4:return N.label++,{value:Et[1],done:!1};case 5:N.label++,$=Et[1],Et=[0];continue;case 7:Et=N.ops.pop(),N.trys.pop();continue;default:if(W=N.trys,!(W=W.length>0&&W[W.length-1])&&(Et[0]===6||Et[0]===2)){N=0;continue}if(Et[0]===3&&(!W||Et[1]>W[0]&&Et[1]<W[3])){N.label=Et[1];break}if(Et[0]===6&&N.label<W[1]){N.label=W[1],W=Et;break}if(W&&N.label<W[2]){N.label=W[2],N.ops.push(Et);break}W[2]&&N.ops.pop(),N.trys.pop();continue}Et=P.call(rt,N)}catch(G){Et=[6,G],$=0}finally{k=W=0}if(Et[0]&5)throw Et[1];return{value:Et[0]?Et[1]:void 0,done:!0}}}var t=function(){function rt(P,N){this.next=null,this.key=P,this.data=N,this.left=null,this.right=null}return rt}();function e(rt,P){return rt>P?1:rt<P?-1:0}function o(rt,P,N){for(var k=new t(null,null),$=k,W=k;;){var ht=N(rt,P.key);if(ht<0){if(P.left===null)break;if(N(rt,P.left.key)<0){var at=P.left;if(P.left=at.right,at.right=P,P=at,P.left===null)break}W.left=P,W=P,P=P.left}else if(ht>0){if(P.right===null)break;if(N(rt,P.right.key)>0){var at=P.right;if(P.right=at.left,at.left=P,P=at,P.right===null)break}$.right=P,$=P,P=P.right}else break}return $.right=P.left,W.left=P.right,P.left=k.right,P.right=k.left,P}function s(rt,P,N,k){var $=new t(rt,P);if(N===null)return $.left=$.right=null,$;N=o(rt,N,k);var W=k(rt,N.key);return W<0?($.left=N.left,$.right=N,N.left=null):W>=0&&($.right=N.right,$.left=N,N.right=null),$}function u(rt,P,N){var k=null,$=null;if(P){P=o(rt,P,N);var W=N(P.key,rt);W===0?(k=P.left,$=P.right):W<0?($=P.right,P.right=null,k=P):(k=P.left,P.left=null,$=P)}return{left:k,right:$}}function p(rt,P,N){return P===null?rt:(rt===null||(P=o(rt.key,P,N),P.left=rt),P)}function f(rt,P,N,k,$){if(rt){k(""+P+(N?"\u2514\u2500\u2500 ":"\u251C\u2500\u2500 ")+$(rt)+`
4
4
  `);var W=P+(N?" ":"\u2502 ");rt.left&&f(rt.left,W,!1,k,$),rt.right&&f(rt.right,W,!0,k,$)}}var g=function(){function rt(P){P===void 0&&(P=e),this._root=null,this._size=0,this._comparator=P}return rt.prototype.insert=function(P,N){return this._size++,this._root=s(P,N,this._root,this._comparator)},rt.prototype.add=function(P,N){var k=new t(P,N);this._root===null&&(k.left=k.right=null,this._size++,this._root=k);var $=this._comparator,W=o(P,this._root,$),ht=$(P,W.key);return ht===0?this._root=W:(ht<0?(k.left=W.left,k.right=W,W.left=null):ht>0&&(k.right=W.right,k.left=W,W.right=null),this._size++,this._root=k),this._root},rt.prototype.remove=function(P){this._root=this._remove(P,this._root,this._comparator)},rt.prototype._remove=function(P,N,k){var $;if(N===null)return null;N=o(P,N,k);var W=k(P,N.key);return W===0?(N.left===null?$=N.right:($=o(P,N.left,k),$.right=N.right),this._size--,$):N},rt.prototype.pop=function(){var P=this._root;if(P){for(;P.left;)P=P.left;return this._root=o(P.key,this._root,this._comparator),this._root=this._remove(P.key,this._root,this._comparator),{key:P.key,data:P.data}}return null},rt.prototype.findStatic=function(P){for(var N=this._root,k=this._comparator;N;){var $=k(P,N.key);if($===0)return N;$<0?N=N.left:N=N.right}return null},rt.prototype.find=function(P){return this._root&&(this._root=o(P,this._root,this._comparator),this._comparator(P,this._root.key)!==0)?null:this._root},rt.prototype.contains=function(P){for(var N=this._root,k=this._comparator;N;){var $=k(P,N.key);if($===0)return!0;$<0?N=N.left:N=N.right}return!1},rt.prototype.forEach=function(P,N){for(var k=this._root,$=[],W=!1;!W;)k!==null?($.push(k),k=k.left):$.length!==0?(k=$.pop(),P.call(N,k),k=k.right):W=!0;return this},rt.prototype.range=function(P,N,k,$){for(var W=[],ht=this._comparator,at=this._root,wt;W.length!==0||at;)if(at)W.push(at),at=at.left;else{if(at=W.pop(),wt=ht(at.key,N),wt>0)break;if(ht(at.key,P)>=0&&k.call($,at))return this;at=at.right}return this},rt.prototype.keys=function(){var P=[];return this.forEach(function(N){var k=N.key;return P.push(k)}),P},rt.prototype.values=function(){var P=[];return this.forEach(function(N){var k=N.data;return P.push(k)}),P},rt.prototype.min=function(){return this._root?this.minNode(this._root).key:null},rt.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},rt.prototype.minNode=function(P){if(P===void 0&&(P=this._root),P)for(;P.left;)P=P.left;return P},rt.prototype.maxNode=function(P){if(P===void 0&&(P=this._root),P)for(;P.right;)P=P.right;return P},rt.prototype.at=function(P){for(var N=this._root,k=!1,$=0,W=[];!k;)if(N)W.push(N),N=N.left;else if(W.length>0){if(N=W.pop(),$===P)return N;$++,N=N.right}else k=!0;return null},rt.prototype.next=function(P){var N=this._root,k=null;if(P.right){for(k=P.right;k.left;)k=k.left;return k}for(var $=this._comparator;N;){var W=$(P.key,N.key);if(W===0)break;W<0?(k=N,N=N.left):N=N.right}return k},rt.prototype.prev=function(P){var N=this._root,k=null;if(P.left!==null){for(k=P.left;k.right;)k=k.right;return k}for(var $=this._comparator;N;){var W=$(P.key,N.key);if(W===0)break;W<0?N=N.left:(k=N,N=N.right)}return k},rt.prototype.clear=function(){return this._root=null,this._size=0,this},rt.prototype.toList=function(){return w(this._root)},rt.prototype.load=function(P,N,k){N===void 0&&(N=[]),k===void 0&&(k=!1);var $=P.length,W=this._comparator;if(k&&C(P,N,0,$-1,W),this._root===null)this._root=m(P,N,0,$),this._size=$;else{var ht=b(this.toList(),v(P,N),W);$=this._size+$,this._root=S({head:ht},0,$)}return this},rt.prototype.isEmpty=function(){return this._root===null},Object.defineProperty(rt.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(rt.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),rt.prototype.toString=function(P){P===void 0&&(P=function(k){return String(k.key)});var N=[];return f(this._root,"",!0,function(k){return N.push(k)},P),N.join("")},rt.prototype.update=function(P,N,k){var $=this._comparator,W=u(P,this._root,$),ht=W.left,at=W.right;$(P,N)<0?at=s(N,k,at,$):ht=s(N,k,ht,$),this._root=p(ht,at,$)},rt.prototype.split=function(P){return u(P,this._root,this._comparator)},rt.prototype[Symbol.iterator]=function(){var P,N,k;return n(this,function($){switch($.label){case 0:P=this._root,N=[],k=!1,$.label=1;case 1:return k?[3,6]:P===null?[3,2]:(N.push(P),P=P.left,[3,5]);case 2:return N.length===0?[3,4]:(P=N.pop(),[4,P]);case 3:return $.sent(),P=P.right,[3,5];case 4:k=!0,$.label=5;case 5:return[3,1];case 6:return[2]}})},rt}();function m(rt,P,N,k){var $=k-N;if($>0){var W=N+Math.floor($/2),ht=rt[W],at=P[W],wt=new t(ht,at);return wt.left=m(rt,P,N,W),wt.right=m(rt,P,W+1,k),wt}return null}function v(rt,P){for(var N=new t(null,null),k=N,$=0;$<rt.length;$++)k=k.next=new t(rt[$],P[$]);return k.next=null,N.next}function w(rt){for(var P=rt,N=[],k=!1,$=new t(null,null),W=$;!k;)P?(N.push(P),P=P.left):N.length>0?(P=W=W.next=N.pop(),P=P.right):k=!0;return W.next=null,$.next}function S(rt,P,N){var k=N-P;if(k>0){var $=P+Math.floor(k/2),W=S(rt,P,$),ht=rt.head;return ht.left=W,rt.head=rt.head.next,ht.right=S(rt,$+1,N),ht}return null}function b(rt,P,N){for(var k=new t(null,null),$=k,W=rt,ht=P;W!==null&&ht!==null;)N(W.key,ht.key)<0?($.next=W,W=W.next):($.next=ht,ht=ht.next),$=$.next;return W!==null?$.next=W:ht!==null&&($.next=ht),k.next}function C(rt,P,N,k,$){if(!(N>=k)){for(var W=rt[N+k>>1],ht=N-1,at=k+1;;){do ht++;while($(rt[ht],W)<0);do at--;while($(rt[at],W)>0);if(ht>=at)break;var wt=rt[ht];rt[ht]=rt[at],rt[at]=wt,wt=P[ht],P[ht]=P[at],P[at]=wt}C(rt,P,N,at,$),C(rt,P,at+1,k,$)}}let R=(rt,P)=>rt.ll.x<=P.x&&P.x<=rt.ur.x&&rt.ll.y<=P.y&&P.y<=rt.ur.y,x=(rt,P)=>{if(P.ur.x<rt.ll.x||rt.ur.x<P.ll.x||P.ur.y<rt.ll.y||rt.ur.y<P.ll.y)return null;let N=rt.ll.x<P.ll.x?P.ll.x:rt.ll.x,k=rt.ur.x<P.ur.x?rt.ur.x:P.ur.x,$=rt.ll.y<P.ll.y?P.ll.y:rt.ll.y,W=rt.ur.y<P.ur.y?rt.ur.y:P.ur.y;return{ll:{x:N,y:$},ur:{x:k,y:W}}},E=Number.EPSILON;E===void 0&&(E=Math.pow(2,-52));let I=E*E,A=(rt,P)=>{if(-E<rt&&rt<E&&-E<P&&P<E)return 0;let N=rt-P;return N*N<I*rt*P?0:rt<P?-1:1};class F{constructor(){this.reset()}reset(){this.xRounder=new V,this.yRounder=new V}round(P,N){return{x:this.xRounder.round(P),y:this.yRounder.round(N)}}}class V{constructor(){this.tree=new g,this.round(0)}round(P){let N=this.tree.add(P),k=this.tree.prev(N);if(k!==null&&A(N.key,k.key)===0)return this.tree.remove(P),k.key;let $=this.tree.next(N);return $!==null&&A(N.key,$.key)===0?(this.tree.remove(P),$.key):P}}let X=new F,q=11102230246251565e-32,D=134217729,xt=(3+8*q)*q;function B(rt,P,N,k,$){let W,ht,at,wt,Et=P[0],G=k[0],ot=0,et=0;G>Et==G>-Et?(W=Et,Et=P[++ot]):(W=G,G=k[++et]);let lt=0;if(ot<rt&&et<N)for(G>Et==G>-Et?(ht=Et+W,at=W-(ht-Et),Et=P[++ot]):(ht=G+W,at=W-(ht-G),G=k[++et]),W=ht,at!==0&&($[lt++]=at);ot<rt&&et<N;)G>Et==G>-Et?(ht=W+Et,wt=ht-W,at=W-(ht-wt)+(Et-wt),Et=P[++ot]):(ht=W+G,wt=ht-W,at=W-(ht-wt)+(G-wt),G=k[++et]),W=ht,at!==0&&($[lt++]=at);for(;ot<rt;)ht=W+Et,wt=ht-W,at=W-(ht-wt)+(Et-wt),Et=P[++ot],W=ht,at!==0&&($[lt++]=at);for(;et<N;)ht=W+G,wt=ht-W,at=W-(ht-wt)+(G-wt),G=k[++et],W=ht,at!==0&&($[lt++]=at);return(W!==0||lt===0)&&($[lt++]=W),lt}function j(rt,P){let N=P[0];for(let k=1;k<rt;k++)N+=P[k];return N}function K(rt){return new Float64Array(rt)}let Dt=(3+16*q)*q,Q=(2+12*q)*q,At=(9+64*q)*q*q,Mt=K(4),Lt=K(8),pt=K(12),yt=K(16),J=K(4);function Bt(rt,P,N,k,$,W,ht){let at,wt,Et,G,ot,et,lt,Ft,Jt,me,ve,qe,Ue,Xe,Je,wr,Kr,nr,Ie=rt-$,rr=N-$,pr=P-W,ur=k-W;Xe=Ie*ur,et=D*Ie,lt=et-(et-Ie),Ft=Ie-lt,et=D*ur,Jt=et-(et-ur),me=ur-Jt,Je=Ft*me-(Xe-lt*Jt-Ft*Jt-lt*me),wr=pr*rr,et=D*pr,lt=et-(et-pr),Ft=pr-lt,et=D*rr,Jt=et-(et-rr),me=rr-Jt,Kr=Ft*me-(wr-lt*Jt-Ft*Jt-lt*me),ve=Je-Kr,ot=Je-ve,Mt[0]=Je-(ve+ot)+(ot-Kr),qe=Xe+ve,ot=qe-Xe,Ue=Xe-(qe-ot)+(ve-ot),ve=Ue-wr,ot=Ue-ve,Mt[1]=Ue-(ve+ot)+(ot-wr),nr=qe+ve,ot=nr-qe,Mt[2]=qe-(nr-ot)+(ve-ot),Mt[3]=nr;let Qn=j(4,Mt),bi=Q*ht;if(Qn>=bi||-Qn>=bi||(ot=rt-Ie,at=rt-(Ie+ot)+(ot-$),ot=N-rr,Et=N-(rr+ot)+(ot-$),ot=P-pr,wt=P-(pr+ot)+(ot-W),ot=k-ur,G=k-(ur+ot)+(ot-W),at===0&&wt===0&&Et===0&&G===0)||(bi=At*ht+xt*Math.abs(Qn),Qn+=Ie*G+ur*at-(pr*Et+rr*wt),Qn>=bi||-Qn>=bi))return Qn;Xe=at*ur,et=D*at,lt=et-(et-at),Ft=at-lt,et=D*ur,Jt=et-(et-ur),me=ur-Jt,Je=Ft*me-(Xe-lt*Jt-Ft*Jt-lt*me),wr=wt*rr,et=D*wt,lt=et-(et-wt),Ft=wt-lt,et=D*rr,Jt=et-(et-rr),me=rr-Jt,Kr=Ft*me-(wr-lt*Jt-Ft*Jt-lt*me),ve=Je-Kr,ot=Je-ve,J[0]=Je-(ve+ot)+(ot-Kr),qe=Xe+ve,ot=qe-Xe,Ue=Xe-(qe-ot)+(ve-ot),ve=Ue-wr,ot=Ue-ve,J[1]=Ue-(ve+ot)+(ot-wr),nr=qe+ve,ot=nr-qe,J[2]=qe-(nr-ot)+(ve-ot),J[3]=nr;let oi=B(4,Mt,4,J,Lt);Xe=Ie*G,et=D*Ie,lt=et-(et-Ie),Ft=Ie-lt,et=D*G,Jt=et-(et-G),me=G-Jt,Je=Ft*me-(Xe-lt*Jt-Ft*Jt-lt*me),wr=pr*Et,et=D*pr,lt=et-(et-pr),Ft=pr-lt,et=D*Et,Jt=et-(et-Et),me=Et-Jt,Kr=Ft*me-(wr-lt*Jt-Ft*Jt-lt*me),ve=Je-Kr,ot=Je-ve,J[0]=Je-(ve+ot)+(ot-Kr),qe=Xe+ve,ot=qe-Xe,Ue=Xe-(qe-ot)+(ve-ot),ve=Ue-wr,ot=Ue-ve,J[1]=Ue-(ve+ot)+(ot-wr),nr=qe+ve,ot=nr-qe,J[2]=qe-(nr-ot)+(ve-ot),J[3]=nr;let Z=B(oi,Lt,4,J,pt);Xe=at*G,et=D*at,lt=et-(et-at),Ft=at-lt,et=D*G,Jt=et-(et-G),me=G-Jt,Je=Ft*me-(Xe-lt*Jt-Ft*Jt-lt*me),wr=wt*Et,et=D*wt,lt=et-(et-wt),Ft=wt-lt,et=D*Et,Jt=et-(et-Et),me=Et-Jt,Kr=Ft*me-(wr-lt*Jt-Ft*Jt-lt*me),ve=Je-Kr,ot=Je-ve,J[0]=Je-(ve+ot)+(ot-Kr),qe=Xe+ve,ot=qe-Xe,Ue=Xe-(qe-ot)+(ve-ot),ve=Ue-wr,ot=Ue-ve,J[1]=Ue-(ve+ot)+(ot-wr),nr=qe+ve,ot=nr-qe,J[2]=qe-(nr-ot)+(ve-ot),J[3]=nr;let mt=B(Z,pt,4,J,yt);return yt[mt-1]}function Gt(rt,P,N,k,$,W){let ht=(P-W)*(N-$),at=(rt-$)*(k-W),wt=ht-at,Et=Math.abs(ht+at);return Math.abs(wt)>=Dt*Et?wt:-Bt(rt,P,N,k,$,W,Et)}let ae=(rt,P)=>rt.x*P.y-rt.y*P.x,ut=(rt,P)=>rt.x*P.x+rt.y*P.y,Ut=(rt,P,N)=>{let k=Gt(rt.x,rt.y,P.x,P.y,N.x,N.y);return k>0?-1:k<0?1:0},jt=rt=>Math.sqrt(ut(rt,rt)),ce=(rt,P,N)=>{let k={x:P.x-rt.x,y:P.y-rt.y},$={x:N.x-rt.x,y:N.y-rt.y};return ae($,k)/jt($)/jt(k)},te=(rt,P,N)=>{let k={x:P.x-rt.x,y:P.y-rt.y},$={x:N.x-rt.x,y:N.y-rt.y};return ut($,k)/jt($)/jt(k)},$t=(rt,P,N)=>P.y===0?null:{x:rt.x+P.x/P.y*(N-rt.y),y:N},qt=(rt,P,N)=>P.x===0?null:{x:N,y:rt.y+P.y/P.x*(N-rt.x)},xe=(rt,P,N,k)=>{if(P.x===0)return qt(N,k,rt.x);if(k.x===0)return qt(rt,P,N.x);if(P.y===0)return $t(N,k,rt.y);if(k.y===0)return $t(rt,P,N.y);let $=ae(P,k);if($==0)return null;let W={x:N.x-rt.x,y:N.y-rt.y},ht=ae(W,P)/$,at=ae(W,k)/$,wt=rt.x+at*P.x,Et=N.x+ht*k.x,G=rt.y+at*P.y,ot=N.y+ht*k.y,et=(wt+Et)/2,lt=(G+ot)/2;return{x:et,y:lt}};class ft{static compare(P,N){let k=ft.comparePoints(P.point,N.point);return k!==0?k:(P.point!==N.point&&P.link(N),P.isLeft!==N.isLeft?P.isLeft?1:-1:ee.compare(P.segment,N.segment))}static comparePoints(P,N){return P.x<N.x?-1:P.x>N.x?1:P.y<N.y?-1:P.y>N.y?1:0}constructor(P,N){P.events===void 0?P.events=[this]:P.events.push(this),this.point=P,this.isLeft=N}link(P){if(P.point===this.point)throw new Error("Tried to link already linked events");let N=P.point.events;for(let k=0,$=N.length;k<$;k++){let W=N[k];this.point.events.push(W),W.point=this.point}this.checkForConsuming()}checkForConsuming(){let P=this.point.events.length;for(let N=0;N<P;N++){let k=this.point.events[N];if(k.segment.consumedBy===void 0)for(let $=N+1;$<P;$++){let W=this.point.events[$];W.consumedBy===void 0&&k.otherSE.point.events===W.otherSE.point.events&&k.segment.consume(W.segment)}}}getAvailableLinkedEvents(){let P=[];for(let N=0,k=this.point.events.length;N<k;N++){let $=this.point.events[N];$!==this&&!$.segment.ringOut&&$.segment.isInResult()&&P.push($)}return P}getLeftmostComparator(P){let N=new Map,k=$=>{let W=$.otherSE;N.set($,{sine:ce(this.point,P.point,W.point),cosine:te(this.point,P.point,W.point)})};return($,W)=>{N.has($)||k($),N.has(W)||k(W);let{sine:ht,cosine:at}=N.get($),{sine:wt,cosine:Et}=N.get(W);return ht>=0&&wt>=0?at<Et?1:at>Et?-1:0:ht<0&&wt<0?at<Et?-1:at>Et?1:0:wt<ht?-1:wt>ht?1:0}}}let We=0;class ee{static compare(P,N){let k=P.leftSE.point.x,$=N.leftSE.point.x,W=P.rightSE.point.x,ht=N.rightSE.point.x;if(ht<k)return 1;if(W<$)return-1;let at=P.leftSE.point.y,wt=N.leftSE.point.y,Et=P.rightSE.point.y,G=N.rightSE.point.y;if(k<$){if(wt<at&&wt<Et)return 1;if(wt>at&&wt>Et)return-1;let ot=P.comparePoint(N.leftSE.point);if(ot<0)return 1;if(ot>0)return-1;let et=N.comparePoint(P.rightSE.point);return et!==0?et:-1}if(k>$){if(at<wt&&at<G)return-1;if(at>wt&&at>G)return 1;let ot=N.comparePoint(P.leftSE.point);if(ot!==0)return ot;let et=P.comparePoint(N.rightSE.point);return et<0?1:et>0?-1:1}if(at<wt)return-1;if(at>wt)return 1;if(W<ht){let ot=N.comparePoint(P.rightSE.point);if(ot!==0)return ot}if(W>ht){let ot=P.comparePoint(N.rightSE.point);if(ot<0)return 1;if(ot>0)return-1}if(W!==ht){let ot=Et-at,et=W-k,lt=G-wt,Ft=ht-$;if(ot>et&&lt<Ft)return 1;if(ot<et&&lt>Ft)return-1}return W>ht?1:W<ht||Et<G?-1:Et>G?1:P.id<N.id?-1:P.id>N.id?1:0}constructor(P,N,k,$){this.id=++We,this.leftSE=P,P.segment=this,P.otherSE=N,this.rightSE=N,N.segment=this,N.otherSE=P,this.rings=k,this.windings=$}static fromRing(P,N,k){let $,W,ht,at=ft.comparePoints(P,N);if(at<0)$=P,W=N,ht=1;else if(at>0)$=N,W=P,ht=-1;else throw new Error(`Tried to create degenerate segment at [${P.x}, ${P.y}]`);let wt=new ft($,!0),Et=new ft(W,!1);return new ee(wt,Et,[k],[ht])}replaceRightSE(P){this.rightSE=P,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}bbox(){let P=this.leftSE.point.y,N=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:P<N?P:N},ur:{x:this.rightSE.point.x,y:P>N?P:N}}}vector(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}isAnEndpoint(P){return P.x===this.leftSE.point.x&&P.y===this.leftSE.point.y||P.x===this.rightSE.point.x&&P.y===this.rightSE.point.y}comparePoint(P){if(this.isAnEndpoint(P))return 0;let N=this.leftSE.point,k=this.rightSE.point,$=this.vector();if(N.x===k.x)return P.x===N.x?0:P.x<N.x?1:-1;let W=(P.y-N.y)/$.y,ht=N.x+W*$.x;if(P.x===ht)return 0;let at=(P.x-N.x)/$.x,wt=N.y+at*$.y;return P.y===wt?0:P.y<wt?-1:1}getIntersection(P){let N=this.bbox(),k=P.bbox(),$=x(N,k);if($===null)return null;let W=this.leftSE.point,ht=this.rightSE.point,at=P.leftSE.point,wt=P.rightSE.point,Et=R(N,at)&&this.comparePoint(at)===0,G=R(k,W)&&P.comparePoint(W)===0,ot=R(N,wt)&&this.comparePoint(wt)===0,et=R(k,ht)&&P.comparePoint(ht)===0;if(G&&Et)return et&&!ot?ht:!et&&ot?wt:null;if(G)return ot&&W.x===wt.x&&W.y===wt.y?null:W;if(Et)return et&&ht.x===at.x&&ht.y===at.y?null:at;if(et&&ot)return null;if(et)return ht;if(ot)return wt;let lt=xe(W,this.vector(),at,P.vector());return lt===null||!R($,lt)?null:X.round(lt.x,lt.y)}split(P){let N=[],k=P.events!==void 0,$=new ft(P,!0),W=new ft(P,!1),ht=this.rightSE;this.replaceRightSE(W),N.push(W),N.push($);let at=new ee($,ht,this.rings.slice(),this.windings.slice());return ft.comparePoints(at.leftSE.point,at.rightSE.point)>0&&at.swapEvents(),ft.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),k&&($.checkForConsuming(),W.checkForConsuming()),N}swapEvents(){let P=this.rightSE;this.rightSE=this.leftSE,this.leftSE=P,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(let N=0,k=this.windings.length;N<k;N++)this.windings[N]*=-1}consume(P){let N=this,k=P;for(;N.consumedBy;)N=N.consumedBy;for(;k.consumedBy;)k=k.consumedBy;let $=ee.compare(N,k);if($!==0){if($>0){let W=N;N=k,k=W}if(N.prev===k){let W=N;N=k,k=W}for(let W=0,ht=k.rings.length;W<ht;W++){let at=k.rings[W],wt=k.windings[W],Et=N.rings.indexOf(at);Et===-1?(N.rings.push(at),N.windings.push(wt)):N.windings[Et]+=wt}k.rings=null,k.windings=null,k.consumedBy=N,k.leftSE.consumedBy=N.leftSE,k.rightSE.consumedBy=N.rightSE}}prevInResult(){return this._prevInResult!==void 0?this._prevInResult:(this.prev?this.prev.isInResult()?this._prevInResult=this.prev:this._prevInResult=this.prev.prevInResult():this._prevInResult=null,this._prevInResult)}beforeState(){if(this._beforeState!==void 0)return this._beforeState;if(!this.prev)this._beforeState={rings:[],windings:[],multiPolys:[]};else{let P=this.prev.consumedBy||this.prev;this._beforeState=P.afterState()}return this._beforeState}afterState(){if(this._afterState!==void 0)return this._afterState;let P=this.beforeState();this._afterState={rings:P.rings.slice(0),windings:P.windings.slice(0),multiPolys:[]};let N=this._afterState.rings,k=this._afterState.windings,$=this._afterState.multiPolys;for(let at=0,wt=this.rings.length;at<wt;at++){let Et=this.rings[at],G=this.windings[at],ot=N.indexOf(Et);ot===-1?(N.push(Et),k.push(G)):k[ot]+=G}let W=[],ht=[];for(let at=0,wt=N.length;at<wt;at++){if(k[at]===0)continue;let Et=N[at],G=Et.poly;if(ht.indexOf(G)===-1)if(Et.isExterior)W.push(G);else{ht.indexOf(G)===-1&&ht.push(G);let ot=W.indexOf(Et.poly);ot!==-1&&W.splice(ot,1)}}for(let at=0,wt=W.length;at<wt;at++){let Et=W[at].multiPoly;$.indexOf(Et)===-1&&$.push(Et)}return this._afterState}isInResult(){if(this.consumedBy)return!1;if(this._isInResult!==void 0)return this._isInResult;let P=this.beforeState().multiPolys,N=this.afterState().multiPolys;switch(dt.type){case"union":{let k=P.length===0,$=N.length===0;this._isInResult=k!==$;break}case"intersection":{let k,$;P.length<N.length?(k=P.length,$=N.length):(k=N.length,$=P.length),this._isInResult=$===dt.numMultiPolys&&k<$;break}case"xor":{let k=Math.abs(P.length-N.length);this._isInResult=k%2===1;break}case"difference":{let k=$=>$.length===1&&$[0].isSubject;this._isInResult=k(P)!==k(N);break}default:throw new Error(`Unrecognized operation type found ${dt.type}`)}return this._isInResult}}class ge{constructor(P,N,k){if(!Array.isArray(P)||P.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=N,this.isExterior=k,this.segments=[],typeof P[0][0]!="number"||typeof P[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");let $=X.round(P[0][0],P[0][1]);this.bbox={ll:{x:$.x,y:$.y},ur:{x:$.x,y:$.y}};let W=$;for(let ht=1,at=P.length;ht<at;ht++){if(typeof P[ht][0]!="number"||typeof P[ht][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");let wt=X.round(P[ht][0],P[ht][1]);wt.x===W.x&&wt.y===W.y||(this.segments.push(ee.fromRing(W,wt,this)),wt.x<this.bbox.ll.x&&(this.bbox.ll.x=wt.x),wt.y<this.bbox.ll.y&&(this.bbox.ll.y=wt.y),wt.x>this.bbox.ur.x&&(this.bbox.ur.x=wt.x),wt.y>this.bbox.ur.y&&(this.bbox.ur.y=wt.y),W=wt)}($.x!==W.x||$.y!==W.y)&&this.segments.push(ee.fromRing(W,$,this))}getSweepEvents(){let P=[];for(let N=0,k=this.segments.length;N<k;N++){let $=this.segments[N];P.push($.leftSE),P.push($.rightSE)}return P}}class fe{constructor(P,N){if(!Array.isArray(P))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new ge(P[0],this,!0),this.bbox={ll:{x:this.exteriorRing.bbox.ll.x,y:this.exteriorRing.bbox.ll.y},ur:{x:this.exteriorRing.bbox.ur.x,y:this.exteriorRing.bbox.ur.y}},this.interiorRings=[];for(let k=1,$=P.length;k<$;k++){let W=new ge(P[k],this,!1);W.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=W.bbox.ll.x),W.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=W.bbox.ll.y),W.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=W.bbox.ur.x),W.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=W.bbox.ur.y),this.interiorRings.push(W)}this.multiPoly=N}getSweepEvents(){let P=this.exteriorRing.getSweepEvents();for(let N=0,k=this.interiorRings.length;N<k;N++){let $=this.interiorRings[N].getSweepEvents();for(let W=0,ht=$.length;W<ht;W++)P.push($[W])}return P}}class Te{constructor(P,N){if(!Array.isArray(P))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{typeof P[0][0][0]=="number"&&(P=[P])}catch(k){}this.polys=[],this.bbox={ll:{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY},ur:{x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY}};for(let k=0,$=P.length;k<$;k++){let W=new fe(P[k],this);W.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=W.bbox.ll.x),W.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=W.bbox.ll.y),W.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=W.bbox.ur.x),W.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=W.bbox.ur.y),this.polys.push(W)}this.isSubject=N}getSweepEvents(){let P=[];for(let N=0,k=this.polys.length;N<k;N++){let $=this.polys[N].getSweepEvents();for(let W=0,ht=$.length;W<ht;W++)P.push($[W])}return P}}class be{static factory(P){let N=[];for(let k=0,$=P.length;k<$;k++){let W=P[k];if(!W.isInResult()||W.ringOut)continue;let ht=null,at=W.leftSE,wt=W.rightSE,Et=[at],G=at.point,ot=[];for(;ht=at,at=wt,Et.push(at),at.point!==G;)for(;;){let et=at.getAvailableLinkedEvents();if(et.length===0){let Jt=Et[0].point,me=Et[Et.length-1].point;throw new Error(`Unable to complete output ring starting at [${Jt.x}, ${Jt.y}]. Last matching segment found ends at [${me.x}, ${me.y}].`)}if(et.length===1){wt=et[0].otherSE;break}let lt=null;for(let Jt=0,me=ot.length;Jt<me;Jt++)if(ot[Jt].point===at.point){lt=Jt;break}if(lt!==null){let Jt=ot.splice(lt)[0],me=Et.splice(Jt.index);me.unshift(me[0].otherSE),N.push(new be(me.reverse()));continue}ot.push({index:Et.length,point:at.point});let Ft=at.getLeftmostComparator(ht);wt=et.sort(Ft)[0].otherSE;break}N.push(new be(Et))}return N}constructor(P){this.events=P;for(let N=0,k=P.length;N<k;N++)P[N].segment.ringOut=this;this.poly=null}getGeom(){let P=this.events[0].point,N=[P];for(let Et=1,G=this.events.length-1;Et<G;Et++){let ot=this.events[Et].point,et=this.events[Et+1].point;Ut(ot,P,et)!==0&&(N.push(ot),P=ot)}if(N.length===1)return null;let k=N[0],$=N[1];Ut(k,P,$)===0&&N.shift(),N.push(N[0]);let W=this.isExteriorRing()?1:-1,ht=this.isExteriorRing()?0:N.length-1,at=this.isExteriorRing()?N.length:-1,wt=[];for(let Et=ht;Et!=at;Et+=W)wt.push([N[Et].x,N[Et].y]);return wt}isExteriorRing(){if(this._isExteriorRing===void 0){let P=this.enclosingRing();this._isExteriorRing=P?!P.isExteriorRing():!0}return this._isExteriorRing}enclosingRing(){return this._enclosingRing===void 0&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}_calcEnclosingRing(){let P=this.events[0];for(let $=1,W=this.events.length;$<W;$++){let ht=this.events[$];ft.compare(P,ht)>0&&(P=ht)}let N=P.segment.prevInResult(),k=N?N.prevInResult():null;for(;;){if(!N)return null;if(!k)return N.ringOut;if(k.ringOut!==N.ringOut)return k.ringOut.enclosingRing()!==N.ringOut?N.ringOut:N.ringOut.enclosingRing();N=k.prevInResult(),k=N?N.prevInResult():null}}}class Wt{constructor(P){this.exteriorRing=P,P.poly=this,this.interiorRings=[]}addInterior(P){this.interiorRings.push(P),P.poly=this}getGeom(){let P=[this.exteriorRing.getGeom()];if(P[0]===null)return null;for(let N=0,k=this.interiorRings.length;N<k;N++){let $=this.interiorRings[N].getGeom();$!==null&&P.push($)}return P}}class Me{constructor(P){this.rings=P,this.polys=this._composePolys(P)}getGeom(){let P=[];for(let N=0,k=this.polys.length;N<k;N++){let $=this.polys[N].getGeom();$!==null&&P.push($)}return P}_composePolys(P){let N=[];for(let k=0,$=P.length;k<$;k++){let W=P[k];if(!W.poly)if(W.isExteriorRing())N.push(new Wt(W));else{let ht=W.enclosingRing();ht.poly||N.push(new Wt(ht)),ht.poly.addInterior(W)}}return N}}class tt{constructor(P){let N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ee.compare;this.queue=P,this.tree=new g(N),this.segments=[]}process(P){let N=P.segment,k=[];if(P.consumedBy)return P.isLeft?this.queue.remove(P.otherSE):this.tree.remove(N),k;let $=P.isLeft?this.tree.add(N):this.tree.find(N);if(!$)throw new Error(`Unable to find segment #${N.id} [${N.leftSE.point.x}, ${N.leftSE.point.y}] -> [${N.rightSE.point.x}, ${N.rightSE.point.y}] in SweepLine tree.`);let W=$,ht=$,at,wt;for(;at===void 0;)W=this.tree.prev(W),W===null?at=null:W.key.consumedBy===void 0&&(at=W.key);for(;wt===void 0;)ht=this.tree.next(ht),ht===null?wt=null:ht.key.consumedBy===void 0&&(wt=ht.key);if(P.isLeft){let Et=null;if(at){let ot=at.getIntersection(N);if(ot!==null&&(N.isAnEndpoint(ot)||(Et=ot),!at.isAnEndpoint(ot))){let et=this._splitSafely(at,ot);for(let lt=0,Ft=et.length;lt<Ft;lt++)k.push(et[lt])}}let G=null;if(wt){let ot=wt.getIntersection(N);if(ot!==null&&(N.isAnEndpoint(ot)||(G=ot),!wt.isAnEndpoint(ot))){let et=this._splitSafely(wt,ot);for(let lt=0,Ft=et.length;lt<Ft;lt++)k.push(et[lt])}}if(Et!==null||G!==null){let ot=null;Et===null?ot=G:G===null?ot=Et:ot=ft.comparePoints(Et,G)<=0?Et:G,this.queue.remove(N.rightSE),k.push(N.rightSE);let et=N.split(ot);for(let lt=0,Ft=et.length;lt<Ft;lt++)k.push(et[lt])}k.length>0?(this.tree.remove(N),k.push(P)):(this.segments.push(N),N.prev=at)}else{if(at&&wt){let Et=at.getIntersection(wt);if(Et!==null){if(!at.isAnEndpoint(Et)){let G=this._splitSafely(at,Et);for(let ot=0,et=G.length;ot<et;ot++)k.push(G[ot])}if(!wt.isAnEndpoint(Et)){let G=this._splitSafely(wt,Et);for(let ot=0,et=G.length;ot<et;ot++)k.push(G[ot])}}}this.tree.remove(N)}return k}_splitSafely(P,N){this.tree.remove(P);let k=P.rightSE;this.queue.remove(k);let $=P.split(N);return $.push(k),P.consumedBy===void 0&&this.tree.add(P),$}}let z=typeof process!="undefined"&&process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,Pt=typeof process!="undefined"&&process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6;class Ot{run(P,N,k){dt.type=P,X.reset();let $=[new Te(N,!0)];for(let ot=0,et=k.length;ot<et;ot++)$.push(new Te(k[ot],!1));if(dt.numMultiPolys=$.length,dt.type==="difference"){let ot=$[0],et=1;for(;et<$.length;)x($[et].bbox,ot.bbox)!==null?et++:$.splice(et,1)}if(dt.type==="intersection")for(let ot=0,et=$.length;ot<et;ot++){let lt=$[ot];for(let Ft=ot+1,Jt=$.length;Ft<Jt;Ft++)if(x(lt.bbox,$[Ft].bbox)===null)return[]}let W=new g(ft.compare);for(let ot=0,et=$.length;ot<et;ot++){let lt=$[ot].getSweepEvents();for(let Ft=0,Jt=lt.length;Ft<Jt;Ft++)if(W.insert(lt[Ft]),W.size>z)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big).")}let ht=new tt(W),at=W.size,wt=W.pop();for(;wt;){let ot=wt.key;if(W.size===at){let lt=ot.segment;throw new Error(`Unable to pop() ${ot.isLeft?"left":"right"} SweepEvent [${ot.point.x}, ${ot.point.y}] from segment #${lt.id} [${lt.leftSE.point.x}, ${lt.leftSE.point.y}] -> [${lt.rightSE.point.x}, ${lt.rightSE.point.y}] from queue.`)}if(W.size>z)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big).");if(ht.segments.length>Pt)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments).");let et=ht.process(ot);for(let lt=0,Ft=et.length;lt<Ft;lt++){let Jt=et[lt];Jt.consumedBy===void 0&&W.insert(Jt)}at=W.size,wt=W.pop()}X.reset();let Et=be.factory(ht.segments);return new Me(Et).getGeom()}}let dt=new Ot;var ne={union:function(rt){for(var P=arguments.length,N=new Array(P>1?P-1:0),k=1;k<P;k++)N[k-1]=arguments[k];return dt.run("union",rt,N)},intersection:function(rt){for(var P=arguments.length,N=new Array(P>1?P-1:0),k=1;k<P;k++)N[k-1]=arguments[k];return dt.run("intersection",rt,N)},xor:function(rt){for(var P=arguments.length,N=new Array(P>1?P-1:0),k=1;k<P;k++)N[k-1]=arguments[k];return dt.run("xor",rt,N)},difference:function(rt){for(var P=arguments.length,N=new Array(P>1?P-1:0),k=1;k<P;k++)N[k-1]=arguments[k];return dt.run("difference",rt,N)}};return ne})});var IN=st((kg,PN)=>{(function(n,t){typeof kg=="object"&&typeof PN!="undefined"?t(kg):typeof define=="function"&&define.amd?define(["exports"],t):t(n.jsts={})})(kg,function(n){"use strict";function t(){}function e(r){this.message=r||""}function o(r){this.message=r||""}function s(r){this.message=r||""}function u(){}function p(r){return r===null?Je:r.color}function f(r){return r===null?null:r.parent}function g(r,i){r!==null&&(r.color=i)}function m(r){return r===null?null:r.left}function v(r){return r===null?null:r.right}function w(){this.root_=null,this.size_=0}function S(){}function b(){this.array_=[],arguments[0]instanceof at&&this.addAll(arguments[0])}function C(){}function R(r){this.message=r||""}function x(){this.array_=[]}"fill"in Array.prototype||Object.defineProperty(Array.prototype,"fill",{configurable:!0,value:function(r){if(this===void 0||this===null)throw new TypeError(this+" is not an object");var i=Object(this),a=Math.max(Math.min(i.length,9007199254740991),0)||0,c=1 in arguments&&parseInt(Number(arguments[1]),10)||0;c=c<0?Math.max(a+c,0):Math.min(c,a);var d=2 in arguments&&arguments[2]!==void 0?parseInt(Number(arguments[2]),10)||0:a;for(d=d<0?Math.max(a+arguments[2],0):Math.min(d,a);c<d;)i[c]=r,++c;return i},writable:!0}),Number.isFinite=Number.isFinite||function(r){return typeof r=="number"&&isFinite(r)},Number.isInteger=Number.isInteger||function(r){return typeof r=="number"&&isFinite(r)&&Math.floor(r)===r},Number.parseFloat=Number.parseFloat||parseFloat,Number.isNaN=Number.isNaN||function(r){return r!=r},Math.trunc=Math.trunc||function(r){return r<0?Math.ceil(r):Math.floor(r)};var E=function(){};E.prototype.interfaces_=function(){return[]},E.prototype.getClass=function(){return E},E.prototype.equalsWithTolerance=function(r,i,a){return Math.abs(r-i)<=a};var I=function(r){function i(a){r.call(this,a),this.name="IllegalArgumentException",this.message=a,this.stack=new r().stack}return r&&(i.__proto__=r),i.prototype=Object.create(r&&r.prototype),i.prototype.constructor=i,i}(Error),A=function(){},F={MAX_VALUE:{configurable:!0}};A.isNaN=function(r){return Number.isNaN(r)},A.doubleToLongBits=function(r){return r},A.longBitsToDouble=function(r){return r},A.isInfinite=function(r){return!Number.isFinite(r)},F.MAX_VALUE.get=function(){return Number.MAX_VALUE},Object.defineProperties(A,F);var V=function(){},X=function(){},q=function(){},D=function r(){if(this.x=null,this.y=null,this.z=null,arguments.length===0)this.x=0,this.y=0,this.z=r.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=r.NULL_ORDINATE):arguments.length===3&&(this.x=arguments[0],this.y=arguments[1],this.z=arguments[2])},xt={DimensionalComparator:{configurable:!0},serialVersionUID:{configurable:!0},NULL_ORDINATE:{configurable:!0},X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0}};D.prototype.setOrdinate=function(r,i){switch(r){case D.X:this.x=i;break;case D.Y:this.y=i;break;case D.Z:this.z=i;break;default:throw new I("Invalid ordinate index: "+r)}},D.prototype.equals2D=function(){if(arguments.length===1){var r=arguments[0];return this.x===r.x&&this.y===r.y}if(arguments.length===2){var i=arguments[0],a=arguments[1];return!!E.equalsWithTolerance(this.x,i.x,a)&&!!E.equalsWithTolerance(this.y,i.y,a)}},D.prototype.getOrdinate=function(r){switch(r){case D.X:return this.x;case D.Y:return this.y;case D.Z:return this.z}throw new I("Invalid ordinate index: "+r)},D.prototype.equals3D=function(r){return this.x===r.x&&this.y===r.y&&(this.z===r.z||A.isNaN(this.z))&&A.isNaN(r.z)},D.prototype.equals=function(r){return r instanceof D&&this.equals2D(r)},D.prototype.equalInZ=function(r,i){return E.equalsWithTolerance(this.z,r.z,i)},D.prototype.compareTo=function(r){var i=r;return this.x<i.x?-1:this.x>i.x?1:this.y<i.y?-1:this.y>i.y?1:0},D.prototype.clone=function(){},D.prototype.copy=function(){return new D(this)},D.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},D.prototype.distance3D=function(r){var i=this.x-r.x,a=this.y-r.y,c=this.z-r.z;return Math.sqrt(i*i+a*a+c*c)},D.prototype.distance=function(r){var i=this.x-r.x,a=this.y-r.y;return Math.sqrt(i*i+a*a)},D.prototype.hashCode=function(){var r=17;return r=37*r+D.hashCode(this.x),r=37*r+D.hashCode(this.y)},D.prototype.setCoordinate=function(r){this.x=r.x,this.y=r.y,this.z=r.z},D.prototype.interfaces_=function(){return[V,X,t]},D.prototype.getClass=function(){return D},D.hashCode=function(){if(arguments.length===1){var r=arguments[0],i=A.doubleToLongBits(r);return Math.trunc((i^i)>>>32)}},xt.DimensionalComparator.get=function(){return B},xt.serialVersionUID.get=function(){return 6683108902428367e3},xt.NULL_ORDINATE.get=function(){return A.NaN},xt.X.get=function(){return 0},xt.Y.get=function(){return 1},xt.Z.get=function(){return 2},Object.defineProperties(D,xt);var B=function(r){if(this._dimensionsToTest=2,arguments.length!==0){if(arguments.length===1){var i=arguments[0];if(i!==2&&i!==3)throw new I("only 2 or 3 dimensions may be specified");this._dimensionsToTest=i}}};B.prototype.compare=function(r,i){var a=r,c=i,d=B.compare(a.x,c.x);if(d!==0)return d;var _=B.compare(a.y,c.y);return _!==0?_:this._dimensionsToTest<=2?0:B.compare(a.z,c.z)},B.prototype.interfaces_=function(){return[q]},B.prototype.getClass=function(){return B},B.compare=function(r,i){return r<i?-1:r>i?1:A.isNaN(r)?A.isNaN(i)?0:-1:A.isNaN(i)?1:0};var j=function(){};j.prototype.create=function(){},j.prototype.interfaces_=function(){return[]},j.prototype.getClass=function(){return j};var K=function(){},Dt={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(r){switch(r){case K.EXTERIOR:return"e";case K.BOUNDARY:return"b";case K.INTERIOR:return"i";case K.NONE:return"-"}throw new I("Unknown location value: "+r)},Dt.INTERIOR.get=function(){return 0},Dt.BOUNDARY.get=function(){return 1},Dt.EXTERIOR.get=function(){return 2},Dt.NONE.get=function(){return-1},Object.defineProperties(K,Dt);var Q=function(r,i){return r.interfaces_&&r.interfaces_().indexOf(i)>-1},At=function(){},Mt={LOG_10:{configurable:!0}};At.prototype.interfaces_=function(){return[]},At.prototype.getClass=function(){return At},At.log10=function(r){var i=Math.log(r);return A.isInfinite(i)||A.isNaN(i)?i:i/At.LOG_10},At.min=function(r,i,a,c){var d=r;return i<d&&(d=i),a<d&&(d=a),c<d&&(d=c),d},At.clamp=function(){if(typeof arguments[2]=="number"&&typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var r=arguments[0],i=arguments[1],a=arguments[2];return r<i?i:r>a?a:r}if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var c=arguments[0],d=arguments[1],_=arguments[2];return c<d?d:c>_?_:c}},At.wrap=function(r,i){return r<0?i- -r%i:r%i},At.max=function(){if(arguments.length===3){var r=arguments[0],i=arguments[1],a=arguments[2],c=r;return i>c&&(c=i),a>c&&(c=a),c}if(arguments.length===4){var d=arguments[0],_=arguments[1],M=arguments[2],L=arguments[3],H=d;return _>H&&(H=_),M>H&&(H=M),L>H&&(H=L),H}},At.average=function(r,i){return(r+i)/2},Mt.LOG_10.get=function(){return Math.log(10)},Object.defineProperties(At,Mt);var Lt=function(r){this.str=r};Lt.prototype.append=function(r){this.str+=r},Lt.prototype.setCharAt=function(r,i){this.str=this.str.substr(0,r)+i+this.str.substr(r+1)},Lt.prototype.toString=function(r){return this.str};var pt=function(r){this.value=r};pt.prototype.intValue=function(){return this.value},pt.prototype.compareTo=function(r){return this.value<r?-1:this.value>r?1:0},pt.isNaN=function(r){return Number.isNaN(r)};var yt=function(){};yt.isWhitespace=function(r){return r<=32&&r>=0||r===127},yt.toUpperCase=function(r){return r.toUpperCase()};var J=function r(){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 r){var a=arguments[0];this.init(a)}else if(typeof arguments[0]=="string"){var c=arguments[0];r.call(this,r.parse(c))}}else if(arguments.length===2){var d=arguments[0],_=arguments[1];this.init(d,_)}},Bt={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}};J.prototype.le=function(r){return(this._hi<r._hi||this._hi===r._hi)&&this._lo<=r._lo},J.prototype.extractSignificantDigits=function(r,i){var a=this.abs(),c=J.magnitude(a._hi),d=J.TEN.pow(c);(a=a.divide(d)).gt(J.TEN)?(a=a.divide(J.TEN),c+=1):a.lt(J.ONE)&&(a=a.multiply(J.TEN),c-=1);for(var _=c+1,M=new Lt,L=J.MAX_PRINT_DIGITS-1,H=0;H<=L;H++){r&&H===_&&M.append(".");var it=Math.trunc(a._hi);if(it<0)break;var bt=!1,Tt=0;it>9?(bt=!0,Tt="9"):Tt="0"+it,M.append(Tt),a=a.subtract(J.valueOf(it)).multiply(J.TEN),bt&&a.selfAdd(J.TEN);var Kt=!0,Qt=J.magnitude(a._hi);if(Qt<0&&Math.abs(Qt)>=L-H&&(Kt=!1),!Kt)break}return i[0]=c,M.toString()},J.prototype.sqr=function(){return this.multiply(this)},J.prototype.doubleValue=function(){return this._hi+this._lo},J.prototype.subtract=function(){if(arguments[0]instanceof J){var r=arguments[0];return this.add(r.negate())}if(typeof arguments[0]=="number"){var i=arguments[0];return this.add(-i)}},J.prototype.equals=function(){if(arguments.length===1){var r=arguments[0];return this._hi===r._hi&&this._lo===r._lo}},J.prototype.isZero=function(){return this._hi===0&&this._lo===0},J.prototype.selfSubtract=function(){if(arguments[0]instanceof J){var r=arguments[0];return this.isNaN()?this:this.selfAdd(-r._hi,-r._lo)}if(typeof arguments[0]=="number"){var i=arguments[0];return this.isNaN()?this:this.selfAdd(-i,0)}},J.prototype.getSpecialNumberString=function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null},J.prototype.min=function(r){return this.le(r)?this:r},J.prototype.selfDivide=function(){if(arguments.length===1){if(arguments[0]instanceof J){var r=arguments[0];return this.selfDivide(r._hi,r._lo)}if(typeof arguments[0]=="number"){var i=arguments[0];return this.selfDivide(i,0)}}else if(arguments.length===2){var a=arguments[0],c=arguments[1],d=null,_=null,M=null,L=null,H=null,it=null,bt=null,Tt=null;return H=this._hi/a,it=J.SPLIT*H,d=it-H,Tt=J.SPLIT*a,d=it-d,_=H-d,M=Tt-a,bt=H*a,M=Tt-M,L=a-M,Tt=d*M-bt+d*L+_*M+_*L,it=(this._hi-bt-Tt+this._lo-H*c)/a,Tt=H+it,this._hi=Tt,this._lo=H-Tt+it,this}},J.prototype.dump=function(){return"DD<"+this._hi+", "+this._lo+">"},J.prototype.divide=function(){if(arguments[0]instanceof J){var r=arguments[0],i=null,a=null,c=null,d=null,_=null,M=null,L=null,H=null;return a=(_=this._hi/r._hi)-(i=(M=J.SPLIT*_)-(i=M-_)),H=i*(c=(H=J.SPLIT*r._hi)-(c=H-r._hi))-(L=_*r._hi)+i*(d=r._hi-c)+a*c+a*d,M=(this._hi-L-H+this._lo-_*r._lo)/r._hi,new J(H=_+M,_-H+M)}if(typeof arguments[0]=="number"){var it=arguments[0];return A.isNaN(it)?J.createNaN():J.copy(this).selfDivide(it,0)}},J.prototype.ge=function(r){return(this._hi>r._hi||this._hi===r._hi)&&this._lo>=r._lo},J.prototype.pow=function(r){if(r===0)return J.valueOf(1);var i=new J(this),a=J.valueOf(1),c=Math.abs(r);if(c>1)for(;c>0;)c%2==1&&a.selfMultiply(i),(c/=2)>0&&(i=i.sqr());else a=i;return r<0?a.reciprocal():a},J.prototype.ceil=function(){if(this.isNaN())return J.NaN;var r=Math.ceil(this._hi),i=0;return r===this._hi&&(i=Math.ceil(this._lo)),new J(r,i)},J.prototype.compareTo=function(r){var i=r;return this._hi<i._hi?-1:this._hi>i._hi?1:this._lo<i._lo?-1:this._lo>i._lo?1:0},J.prototype.rint=function(){return this.isNaN()?this:this.add(.5).floor()},J.prototype.setValue=function(){if(arguments[0]instanceof J){var r=arguments[0];return this.init(r),this}if(typeof arguments[0]=="number"){var i=arguments[0];return this.init(i),this}},J.prototype.max=function(r){return this.ge(r)?this:r},J.prototype.sqrt=function(){if(this.isZero())return J.valueOf(0);if(this.isNegative())return J.NaN;var r=1/Math.sqrt(this._hi),i=this._hi*r,a=J.valueOf(i),c=this.subtract(a.sqr())._hi*(.5*r);return a.add(c)},J.prototype.selfAdd=function(){if(arguments.length===1){if(arguments[0]instanceof J){var r=arguments[0];return this.selfAdd(r._hi,r._lo)}if(typeof arguments[0]=="number"){var i=arguments[0],a=null,c=null,d=null,_=null,M=null,L=null;return d=this._hi+i,M=d-this._hi,_=d-M,_=i-M+(this._hi-_),L=_+this._lo,a=d+L,c=L+(d-a),this._hi=a+c,this._lo=c+(a-this._hi),this}}else if(arguments.length===2){var H=arguments[0],it=arguments[1],bt=null,Tt=null,Kt=null,Qt=null,le=null,Ee=null,Dn=null;Qt=this._hi+H,Tt=this._lo+it,le=Qt-(Ee=Qt-this._hi),Kt=Tt-(Dn=Tt-this._lo);var Jn=(bt=Qt+(Ee=(le=H-Ee+(this._hi-le))+Tt))+(Ee=(Kt=it-Dn+(this._lo-Kt))+(Ee+(Qt-bt))),fi=Ee+(bt-Jn);return this._hi=Jn,this._lo=fi,this}},J.prototype.selfMultiply=function(){if(arguments.length===1){if(arguments[0]instanceof J){var r=arguments[0];return this.selfMultiply(r._hi,r._lo)}if(typeof arguments[0]=="number"){var i=arguments[0];return this.selfMultiply(i,0)}}else if(arguments.length===2){var a=arguments[0],c=arguments[1],d=null,_=null,M=null,L=null,H=null,it=null;d=(H=J.SPLIT*this._hi)-this._hi,it=J.SPLIT*a,d=H-d,_=this._hi-d,M=it-a;var bt=(H=this._hi*a)+(it=d*(M=it-M)-H+d*(L=a-M)+_*M+_*L+(this._hi*c+this._lo*a)),Tt=it+(d=H-bt);return this._hi=bt,this._lo=Tt,this}},J.prototype.selfSqr=function(){return this.selfMultiply(this)},J.prototype.floor=function(){if(this.isNaN())return J.NaN;var r=Math.floor(this._hi),i=0;return r===this._hi&&(i=Math.floor(this._lo)),new J(r,i)},J.prototype.negate=function(){return this.isNaN()?this:new J(-this._hi,-this._lo)},J.prototype.clone=function(){},J.prototype.multiply=function(){if(arguments[0]instanceof J){var r=arguments[0];return r.isNaN()?J.createNaN():J.copy(this).selfMultiply(r)}if(typeof arguments[0]=="number"){var i=arguments[0];return A.isNaN(i)?J.createNaN():J.copy(this).selfMultiply(i,0)}},J.prototype.isNaN=function(){return A.isNaN(this._hi)},J.prototype.intValue=function(){return Math.trunc(this._hi)},J.prototype.toString=function(){var r=J.magnitude(this._hi);return r>=-3&&r<=20?this.toStandardNotation():this.toSciNotation()},J.prototype.toStandardNotation=function(){var r=this.getSpecialNumberString();if(r!==null)return r;var i=new Array(1).fill(null),a=this.extractSignificantDigits(!0,i),c=i[0]+1,d=a;if(a.charAt(0)===".")d="0"+a;else if(c<0)d="0."+J.stringOfChar("0",-c)+a;else if(a.indexOf(".")===-1){var _=c-a.length;d=a+J.stringOfChar("0",_)+".0"}return this.isNegative()?"-"+d:d},J.prototype.reciprocal=function(){var r=null,i=null,a=null,c=null,d=null,_=null,M=null,L=null;i=(d=1/this._hi)-(r=(_=J.SPLIT*d)-(r=_-d)),a=(L=J.SPLIT*this._hi)-this._hi;var H=d+(_=(1-(M=d*this._hi)-(L=r*(a=L-a)-M+r*(c=this._hi-a)+i*a+i*c)-d*this._lo)/this._hi);return new J(H,d-H+_)},J.prototype.toSciNotation=function(){if(this.isZero())return J.SCI_NOT_ZERO;var r=this.getSpecialNumberString();if(r!==null)return r;var i=new Array(1).fill(null),a=this.extractSignificantDigits(!1,i),c=J.SCI_NOT_EXPONENT_CHAR+i[0];if(a.charAt(0)==="0")throw new Error("Found leading zero: "+a);var d="";a.length>1&&(d=a.substring(1));var _=a.charAt(0)+"."+d;return this.isNegative()?"-"+_+c:_+c},J.prototype.abs=function(){return this.isNaN()?J.NaN:this.isNegative()?this.negate():new J(this)},J.prototype.isPositive=function(){return(this._hi>0||this._hi===0)&&this._lo>0},J.prototype.lt=function(r){return(this._hi<r._hi||this._hi===r._hi)&&this._lo<r._lo},J.prototype.add=function(){if(arguments[0]instanceof J){var r=arguments[0];return J.copy(this).selfAdd(r)}if(typeof arguments[0]=="number"){var i=arguments[0];return J.copy(this).selfAdd(i)}},J.prototype.init=function(){if(arguments.length===1){if(typeof arguments[0]=="number"){var r=arguments[0];this._hi=r,this._lo=0}else if(arguments[0]instanceof J){var i=arguments[0];this._hi=i._hi,this._lo=i._lo}}else if(arguments.length===2){var a=arguments[0],c=arguments[1];this._hi=a,this._lo=c}},J.prototype.gt=function(r){return(this._hi>r._hi||this._hi===r._hi)&&this._lo>r._lo},J.prototype.isNegative=function(){return(this._hi<0||this._hi===0)&&this._lo<0},J.prototype.trunc=function(){return this.isNaN()?J.NaN:this.isPositive()?this.floor():this.ceil()},J.prototype.signum=function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0},J.prototype.interfaces_=function(){return[t,V,X]},J.prototype.getClass=function(){return J},J.sqr=function(r){return J.valueOf(r).selfMultiply(r)},J.valueOf=function(){if(typeof arguments[0]=="string"){var r=arguments[0];return J.parse(r)}if(typeof arguments[0]=="number"){var i=arguments[0];return new J(i)}},J.sqrt=function(r){return J.valueOf(r).sqrt()},J.parse=function(r){for(var i=0,a=r.length;yt.isWhitespace(r.charAt(i));)i++;var c=!1;if(i<a){var d=r.charAt(i);d!=="-"&&d!=="+"||(i++,d==="-"&&(c=!0))}for(var _=new J,M=0,L=0,H=0;!(i>=a);){var it=r.charAt(i);if(i++,yt.isDigit(it)){var bt=it-"0";_.selfMultiply(J.TEN),_.selfAdd(bt),M++}else{if(it!=="."){if(it==="e"||it==="E"){var Tt=r.substring(i);try{H=pt.parseInt(Tt)}catch(Dn){throw Dn instanceof Error?new Error("Invalid exponent "+Tt+" in string "+r):Dn}break}throw new Error("Unexpected character '"+it+"' at position "+i+" in string "+r)}L=M}}var Kt=_,Qt=M-L-H;if(Qt===0)Kt=_;else if(Qt>0){var le=J.TEN.pow(Qt);Kt=_.divide(le)}else if(Qt<0){var Ee=J.TEN.pow(-Qt);Kt=_.multiply(Ee)}return c?Kt.negate():Kt},J.createNaN=function(){return new J(A.NaN,A.NaN)},J.copy=function(r){return new J(r)},J.magnitude=function(r){var i=Math.abs(r),a=Math.log(i)/Math.log(10),c=Math.trunc(Math.floor(a));return 10*Math.pow(10,c)<=i&&(c+=1),c},J.stringOfChar=function(r,i){for(var a=new Lt,c=0;c<i;c++)a.append(r);return a.toString()},Bt.PI.get=function(){return new J(3.141592653589793,12246467991473532e-32)},Bt.TWO_PI.get=function(){return new J(6.283185307179586,24492935982947064e-32)},Bt.PI_2.get=function(){return new J(1.5707963267948966,6123233995736766e-32)},Bt.E.get=function(){return new J(2.718281828459045,14456468917292502e-32)},Bt.NaN.get=function(){return new J(A.NaN,A.NaN)},Bt.EPS.get=function(){return 123259516440783e-46},Bt.SPLIT.get=function(){return 134217729},Bt.MAX_PRINT_DIGITS.get=function(){return 32},Bt.TEN.get=function(){return J.valueOf(10)},Bt.ONE.get=function(){return J.valueOf(1)},Bt.SCI_NOT_EXPONENT_CHAR.get=function(){return"E"},Bt.SCI_NOT_ZERO.get=function(){return"0.0E0"},Object.defineProperties(J,Bt);var Gt=function(){},ae={DP_SAFE_EPSILON:{configurable:!0}};Gt.prototype.interfaces_=function(){return[]},Gt.prototype.getClass=function(){return Gt},Gt.orientationIndex=function(r,i,a){var c=Gt.orientationIndexFilter(r,i,a);if(c<=1)return c;var d=J.valueOf(i.x).selfAdd(-r.x),_=J.valueOf(i.y).selfAdd(-r.y),M=J.valueOf(a.x).selfAdd(-i.x),L=J.valueOf(a.y).selfAdd(-i.y);return d.selfMultiply(L).selfSubtract(_.selfMultiply(M)).signum()},Gt.signOfDet2x2=function(r,i,a,c){return r.multiply(c).selfSubtract(i.multiply(a)).signum()},Gt.intersection=function(r,i,a,c){var d=J.valueOf(c.y).selfSubtract(a.y).selfMultiply(J.valueOf(i.x).selfSubtract(r.x)),_=J.valueOf(c.x).selfSubtract(a.x).selfMultiply(J.valueOf(i.y).selfSubtract(r.y)),M=d.subtract(_),L=J.valueOf(c.x).selfSubtract(a.x).selfMultiply(J.valueOf(r.y).selfSubtract(a.y)),H=J.valueOf(c.y).selfSubtract(a.y).selfMultiply(J.valueOf(r.x).selfSubtract(a.x)),it=L.subtract(H).selfDivide(M).doubleValue(),bt=J.valueOf(r.x).selfAdd(J.valueOf(i.x).selfSubtract(r.x).selfMultiply(it)).doubleValue(),Tt=J.valueOf(i.x).selfSubtract(r.x).selfMultiply(J.valueOf(r.y).selfSubtract(a.y)),Kt=J.valueOf(i.y).selfSubtract(r.y).selfMultiply(J.valueOf(r.x).selfSubtract(a.x)),Qt=Tt.subtract(Kt).selfDivide(M).doubleValue(),le=J.valueOf(a.y).selfAdd(J.valueOf(c.y).selfSubtract(a.y).selfMultiply(Qt)).doubleValue();return new D(bt,le)},Gt.orientationIndexFilter=function(r,i,a){var c=null,d=(r.x-a.x)*(i.y-a.y),_=(r.y-a.y)*(i.x-a.x),M=d-_;if(d>0){if(_<=0)return Gt.signum(M);c=d+_}else{if(!(d<0)||_>=0)return Gt.signum(M);c=-d-_}var L=Gt.DP_SAFE_EPSILON*c;return M>=L||-M>=L?Gt.signum(M):2},Gt.signum=function(r){return r>0?1:r<0?-1:0},ae.DP_SAFE_EPSILON.get=function(){return 1e-15},Object.defineProperties(Gt,ae);var ut=function(){},Ut={X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0},M:{configurable:!0}};Ut.X.get=function(){return 0},Ut.Y.get=function(){return 1},Ut.Z.get=function(){return 2},Ut.M.get=function(){return 3},ut.prototype.setOrdinate=function(r,i,a){},ut.prototype.size=function(){},ut.prototype.getOrdinate=function(r,i){},ut.prototype.getCoordinate=function(){},ut.prototype.getCoordinateCopy=function(r){},ut.prototype.getDimension=function(){},ut.prototype.getX=function(r){},ut.prototype.clone=function(){},ut.prototype.expandEnvelope=function(r){},ut.prototype.copy=function(){},ut.prototype.getY=function(r){},ut.prototype.toCoordinateArray=function(){},ut.prototype.interfaces_=function(){return[X]},ut.prototype.getClass=function(){return ut},Object.defineProperties(ut,Ut);var jt=function(){},ce=function(r){function i(){r.call(this,"Projective point not representable on the Cartesian plane.")}return r&&(i.__proto__=r),i.prototype=Object.create(r&&r.prototype),i.prototype.constructor=i,i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(jt),te=function(){};te.arraycopy=function(r,i,a,c,d){for(var _=0,M=i;M<i+d;M++)a[c+_]=r[M],_++},te.getProperty=function(r){return{"line.separator":`
5
- `}[r]};var $t=function r(){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 a=arguments[0],c=arguments[1];this.x=a,this.y=c,this.w=1}else if(arguments[0]instanceof r&&arguments[1]instanceof r){var d=arguments[0],_=arguments[1];this.x=d.y*_.w-_.y*d.w,this.y=_.x*d.w-d.x*_.w,this.w=d.x*_.y-_.x*d.y}else if(arguments[0]instanceof D&&arguments[1]instanceof D){var M=arguments[0],L=arguments[1];this.x=M.y-L.y,this.y=L.x-M.x,this.w=M.x*L.y-L.x*M.y}}else if(arguments.length===3){var H=arguments[0],it=arguments[1],bt=arguments[2];this.x=H,this.y=it,this.w=bt}else if(arguments.length===4){var Tt=arguments[0],Kt=arguments[1],Qt=arguments[2],le=arguments[3],Ee=Tt.y-Kt.y,Dn=Kt.x-Tt.x,Jn=Tt.x*Kt.y-Kt.x*Tt.y,fi=Qt.y-le.y,as=le.x-Qt.x,qs=Qt.x*le.y-le.x*Qt.y;this.x=Dn*qs-as*Jn,this.y=fi*Jn-Ee*qs,this.w=Ee*as-fi*Dn}};$t.prototype.getY=function(){var r=this.y/this.w;if(A.isNaN(r)||A.isInfinite(r))throw new ce;return r},$t.prototype.getX=function(){var r=this.x/this.w;if(A.isNaN(r)||A.isInfinite(r))throw new ce;return r},$t.prototype.getCoordinate=function(){var r=new D;return r.x=this.getX(),r.y=this.getY(),r},$t.prototype.interfaces_=function(){return[]},$t.prototype.getClass=function(){return $t},$t.intersection=function(r,i,a,c){var d=r.y-i.y,_=i.x-r.x,M=r.x*i.y-i.x*r.y,L=a.y-c.y,H=c.x-a.x,it=a.x*c.y-c.x*a.y,bt=d*H-L*_,Tt=(_*it-H*M)/bt,Kt=(L*M-d*it)/bt;if(A.isNaN(Tt)||A.isInfinite(Tt)||A.isNaN(Kt)||A.isInfinite(Kt))throw new ce;return new D(Tt,Kt)};var qt=function r(){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 D){var i=arguments[0];this.init(i.x,i.x,i.y,i.y)}else if(arguments[0]instanceof r){var a=arguments[0];this.init(a)}}else if(arguments.length===2){var c=arguments[0],d=arguments[1];this.init(c.x,d.x,c.y,d.y)}else if(arguments.length===4){var _=arguments[0],M=arguments[1],L=arguments[2],H=arguments[3];this.init(_,M,L,H)}},xe={serialVersionUID:{configurable:!0}};qt.prototype.getArea=function(){return this.getWidth()*this.getHeight()},qt.prototype.equals=function(r){if(!(r instanceof qt))return!1;var i=r;return this.isNull()?i.isNull():this._maxx===i.getMaxX()&&this._maxy===i.getMaxY()&&this._minx===i.getMinX()&&this._miny===i.getMinY()},qt.prototype.intersection=function(r){if(this.isNull()||r.isNull()||!this.intersects(r))return new qt;var i=this._minx>r._minx?this._minx:r._minx,a=this._miny>r._miny?this._miny:r._miny,c=this._maxx<r._maxx?this._maxx:r._maxx,d=this._maxy<r._maxy?this._maxy:r._maxy;return new qt(i,c,a,d)},qt.prototype.isNull=function(){return this._maxx<this._minx},qt.prototype.getMaxX=function(){return this._maxx},qt.prototype.covers=function(){if(arguments.length===1){if(arguments[0]instanceof D){var r=arguments[0];return this.covers(r.x,r.y)}if(arguments[0]instanceof qt){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 a=arguments[0],c=arguments[1];return!this.isNull()&&a>=this._minx&&a<=this._maxx&&c>=this._miny&&c<=this._maxy}},qt.prototype.intersects=function(){if(arguments.length===1){if(arguments[0]instanceof qt){var r=arguments[0];return!this.isNull()&&!r.isNull()&&!(r._minx>this._maxx||r._maxx<this._minx||r._miny>this._maxy||r._maxy<this._miny)}if(arguments[0]instanceof D){var i=arguments[0];return this.intersects(i.x,i.y)}}else if(arguments.length===2){var a=arguments[0],c=arguments[1];return!this.isNull()&&!(a>this._maxx||a<this._minx||c>this._maxy||c<this._miny)}},qt.prototype.getMinY=function(){return this._miny},qt.prototype.getMinX=function(){return this._minx},qt.prototype.expandToInclude=function(){if(arguments.length===1){if(arguments[0]instanceof D){var r=arguments[0];this.expandToInclude(r.x,r.y)}else if(arguments[0]instanceof qt){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 a=arguments[0],c=arguments[1];this.isNull()?(this._minx=a,this._maxx=a,this._miny=c,this._maxy=c):(a<this._minx&&(this._minx=a),a>this._maxx&&(this._maxx=a),c<this._miny&&(this._miny=c),c>this._maxy&&(this._maxy=c))}},qt.prototype.minExtent=function(){if(this.isNull())return 0;var r=this.getWidth(),i=this.getHeight();return r<i?r:i},qt.prototype.getWidth=function(){return this.isNull()?0:this._maxx-this._minx},qt.prototype.compareTo=function(r){var i=r;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},qt.prototype.translate=function(r,i){if(this.isNull())return null;this.init(this.getMinX()+r,this.getMaxX()+r,this.getMinY()+i,this.getMaxY()+i)},qt.prototype.toString=function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"},qt.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1},qt.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny},qt.prototype.maxExtent=function(){if(this.isNull())return 0;var r=this.getWidth(),i=this.getHeight();return r>i?r:i},qt.prototype.expandBy=function(){if(arguments.length===1){var r=arguments[0];this.expandBy(r,r)}else if(arguments.length===2){var i=arguments[0],a=arguments[1];if(this.isNull())return null;this._minx-=i,this._maxx+=i,this._miny-=a,this._maxy+=a,(this._minx>this._maxx||this._miny>this._maxy)&&this.setToNull()}},qt.prototype.contains=function(){if(arguments.length===1){if(arguments[0]instanceof qt){var r=arguments[0];return this.covers(r)}if(arguments[0]instanceof D){var i=arguments[0];return this.covers(i)}}else if(arguments.length===2){var a=arguments[0],c=arguments[1];return this.covers(a,c)}},qt.prototype.centre=function(){return this.isNull()?null:new D((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)},qt.prototype.init=function(){if(arguments.length===0)this.setToNull();else if(arguments.length===1){if(arguments[0]instanceof D){var r=arguments[0];this.init(r.x,r.x,r.y,r.y)}else if(arguments[0]instanceof qt){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 a=arguments[0],c=arguments[1];this.init(a.x,c.x,a.y,c.y)}else if(arguments.length===4){var d=arguments[0],_=arguments[1],M=arguments[2],L=arguments[3];d<_?(this._minx=d,this._maxx=_):(this._minx=_,this._maxx=d),M<L?(this._miny=M,this._maxy=L):(this._miny=L,this._maxy=M)}},qt.prototype.getMaxY=function(){return this._maxy},qt.prototype.distance=function(r){if(this.intersects(r))return 0;var i=0;this._maxx<r._minx?i=r._minx-this._maxx:this._minx>r._maxx&&(i=this._minx-r._maxx);var a=0;return this._maxy<r._miny?a=r._miny-this._maxy:this._miny>r._maxy&&(a=this._miny-r._maxy),i===0?a:a===0?i:Math.sqrt(i*i+a*a)},qt.prototype.hashCode=function(){var r=17;return r=37*r+D.hashCode(this._minx),r=37*r+D.hashCode(this._maxx),r=37*r+D.hashCode(this._miny),r=37*r+D.hashCode(this._maxy)},qt.prototype.interfaces_=function(){return[V,t]},qt.prototype.getClass=function(){return qt},qt.intersects=function(){if(arguments.length===3){var r=arguments[0],i=arguments[1],a=arguments[2];return a.x>=(r.x<i.x?r.x:i.x)&&a.x<=(r.x>i.x?r.x:i.x)&&a.y>=(r.y<i.y?r.y:i.y)&&a.y<=(r.y>i.y?r.y:i.y)}if(arguments.length===4){var c=arguments[0],d=arguments[1],_=arguments[2],M=arguments[3],L=Math.min(_.x,M.x),H=Math.max(_.x,M.x),it=Math.min(c.x,d.x),bt=Math.max(c.x,d.x);return!(it>H)&&!(bt<L)&&(L=Math.min(_.y,M.y),H=Math.max(_.y,M.y),it=Math.min(c.y,d.y),bt=Math.max(c.y,d.y),!(it>H)&&!(bt<L))}},xe.serialVersionUID.get=function(){return 5873921885273102e3},Object.defineProperties(qt,xe);var ft={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*$/},We=function(r){this.geometryFactory=r||new Le};We.prototype.read=function(r){var i,a,c;r=r.replace(/[\n\r]/g," ");var d=ft.typeStr.exec(r);if(r.search("EMPTY")!==-1&&((d=ft.emptyTypeStr.exec(r))[2]=void 0),d&&(a=d[1].toLowerCase(),c=d[2],ge[a]&&(i=ge[a].apply(this,[c]))),i===void 0)throw new Error("Could not parse WKT "+r);return i},We.prototype.write=function(r){return this.extractGeometry(r)},We.prototype.extractGeometry=function(r){var i=r.getGeometryType().toLowerCase();if(!ee[i])return null;var a=i.toUpperCase();return r.isEmpty()?a+" EMPTY":a+"("+ee[i].apply(this,[r])+")"};var ee={coordinate:function(r){return r.x+" "+r.y},point:function(r){return ee.coordinate.call(this,r._coordinates._coordinates[0])},multipoint:function(r){for(var i=[],a=0,c=r._geometries.length;a<c;++a)i.push("("+ee.point.apply(this,[r._geometries[a]])+")");return i.join(",")},linestring:function(r){for(var i=[],a=0,c=r._points._coordinates.length;a<c;++a)i.push(ee.coordinate.apply(this,[r._points._coordinates[a]]));return i.join(",")},linearring:function(r){for(var i=[],a=0,c=r._points._coordinates.length;a<c;++a)i.push(ee.coordinate.apply(this,[r._points._coordinates[a]]));return i.join(",")},multilinestring:function(r){for(var i=[],a=0,c=r._geometries.length;a<c;++a)i.push("("+ee.linestring.apply(this,[r._geometries[a]])+")");return i.join(",")},polygon:function(r){var i=[];i.push("("+ee.linestring.apply(this,[r._shell])+")");for(var a=0,c=r._holes.length;a<c;++a)i.push("("+ee.linestring.apply(this,[r._holes[a]])+")");return i.join(",")},multipolygon:function(r){for(var i=[],a=0,c=r._geometries.length;a<c;++a)i.push("("+ee.polygon.apply(this,[r._geometries[a]])+")");return i.join(",")},geometrycollection:function(r){for(var i=[],a=0,c=r._geometries.length;a<c;++a)i.push(this.extractGeometry(r._geometries[a]));return i.join(",")}},ge={point:function(r){if(r===void 0)return this.geometryFactory.createPoint();var i=r.trim().split(ft.spaces);return this.geometryFactory.createPoint(new D(Number.parseFloat(i[0]),Number.parseFloat(i[1])))},multipoint:function(r){if(r===void 0)return this.geometryFactory.createMultiPoint();for(var i,a=r.trim().split(","),c=[],d=0,_=a.length;d<_;++d)i=a[d].replace(ft.trimParens,"$1"),c.push(ge.point.apply(this,[i]));return this.geometryFactory.createMultiPoint(c)},linestring:function(r){if(r===void 0)return this.geometryFactory.createLineString();for(var i,a=r.trim().split(","),c=[],d=0,_=a.length;d<_;++d)i=a[d].trim().split(ft.spaces),c.push(new D(Number.parseFloat(i[0]),Number.parseFloat(i[1])));return this.geometryFactory.createLineString(c)},linearring:function(r){if(r===void 0)return this.geometryFactory.createLinearRing();for(var i,a=r.trim().split(","),c=[],d=0,_=a.length;d<_;++d)i=a[d].trim().split(ft.spaces),c.push(new D(Number.parseFloat(i[0]),Number.parseFloat(i[1])));return this.geometryFactory.createLinearRing(c)},multilinestring:function(r){if(r===void 0)return this.geometryFactory.createMultiLineString();for(var i,a=r.trim().split(ft.parenComma),c=[],d=0,_=a.length;d<_;++d)i=a[d].replace(ft.trimParens,"$1"),c.push(ge.linestring.apply(this,[i]));return this.geometryFactory.createMultiLineString(c)},polygon:function(r){if(r===void 0)return this.geometryFactory.createPolygon();for(var i,a,c,d,_=r.trim().split(ft.parenComma),M=[],L=0,H=_.length;L<H;++L)i=_[L].replace(ft.trimParens,"$1"),a=ge.linestring.apply(this,[i]),c=this.geometryFactory.createLinearRing(a._points),L===0?d=c:M.push(c);return this.geometryFactory.createPolygon(d,M)},multipolygon:function(r){if(r===void 0)return this.geometryFactory.createMultiPolygon();for(var i,a=r.trim().split(ft.doubleParenComma),c=[],d=0,_=a.length;d<_;++d)i=a[d].replace(ft.trimParens,"$1"),c.push(ge.polygon.apply(this,[i]));return this.geometryFactory.createMultiPolygon(c)},geometrycollection:function(r){if(r===void 0)return this.geometryFactory.createGeometryCollection();for(var i=(r=r.replace(/,\s*([A-Za-z])/g,"|$1")).trim().split("|"),a=[],c=0,d=i.length;c<d;++c)a.push(this.read(i[c]));return this.geometryFactory.createGeometryCollection(a)}},fe=function(r){this.parser=new We(r)};fe.prototype.write=function(r){return this.parser.write(r)},fe.toLineString=function(r,i){if(arguments.length!==2)throw new Error("Not implemented");return"LINESTRING ( "+r.x+" "+r.y+", "+i.x+" "+i.y+" )"};var Te=function(r){function i(a){r.call(this,a),this.name="RuntimeException",this.message=a,this.stack=new r().stack}return r&&(i.__proto__=r),i.prototype=Object.create(r&&r.prototype),i.prototype.constructor=i,i}(Error),be=function(r){function i(){if(r.call(this),arguments.length===0)r.call(this);else if(arguments.length===1){var a=arguments[0];r.call(this,a)}}return r&&(i.__proto__=r),i.prototype=Object.create(r&&r.prototype),i.prototype.constructor=i,i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(Te),Wt=function(){};Wt.prototype.interfaces_=function(){return[]},Wt.prototype.getClass=function(){return Wt},Wt.shouldNeverReachHere=function(){if(arguments.length===0)Wt.shouldNeverReachHere(null);else if(arguments.length===1){var r=arguments[0];throw new be("Should never reach here"+(r!==null?": "+r:""))}},Wt.isTrue=function(){var r,i;if(arguments.length===1)r=arguments[0],Wt.isTrue(r,null);else if(arguments.length===2&&(r=arguments[0],i=arguments[1],!r))throw i===null?new be:new be(i)},Wt.equals=function(){var r,i,a;if(arguments.length===2)r=arguments[0],i=arguments[1],Wt.equals(r,i,null);else if(arguments.length===3&&(r=arguments[0],i=arguments[1],a=arguments[2],!i.equals(r)))throw new be("Expected "+r+" but encountered "+i+(a!==null?": "+a:""))};var Me=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 D,this._intPt[1]=new D,this._pa=this._intPt[0],this._pb=this._intPt[1],this._result=0},tt={DONT_INTERSECT:{configurable:!0},DO_INTERSECT:{configurable:!0},COLLINEAR:{configurable:!0},NO_INTERSECTION:{configurable:!0},POINT_INTERSECTION:{configurable:!0},COLLINEAR_INTERSECTION:{configurable:!0}};Me.prototype.getIndexAlongSegment=function(r,i){return this.computeIntLineIndex(),this._intLineIndex[r][i]},Me.prototype.getTopologySummary=function(){var r=new Lt;return this.isEndPoint()&&r.append(" endpoint"),this._isProper&&r.append(" proper"),this.isCollinear()&&r.append(" collinear"),r.toString()},Me.prototype.computeIntersection=function(r,i,a,c){this._inputLines[0][0]=r,this._inputLines[0][1]=i,this._inputLines[1][0]=a,this._inputLines[1][1]=c,this._result=this.computeIntersect(r,i,a,c)},Me.prototype.getIntersectionNum=function(){return this._result},Me.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 r=arguments[0];this.getEdgeDistance(r,0)>this.getEdgeDistance(r,1)?(this._intLineIndex[r][0]=0,this._intLineIndex[r][1]=1):(this._intLineIndex[r][0]=1,this._intLineIndex[r][1]=0)}},Me.prototype.isProper=function(){return this.hasIntersection()&&this._isProper},Me.prototype.setPrecisionModel=function(r){this._precisionModel=r},Me.prototype.isInteriorIntersection=function(){if(arguments.length===0)return!!this.isInteriorIntersection(0)||!!this.isInteriorIntersection(1);if(arguments.length===1){for(var r=arguments[0],i=0;i<this._result;i++)if(!this._intPt[i].equals2D(this._inputLines[r][0])&&!this._intPt[i].equals2D(this._inputLines[r][1]))return!0;return!1}},Me.prototype.getIntersection=function(r){return this._intPt[r]},Me.prototype.isEndPoint=function(){return this.hasIntersection()&&!this._isProper},Me.prototype.hasIntersection=function(){return this._result!==Me.NO_INTERSECTION},Me.prototype.getEdgeDistance=function(r,i){return Me.computeEdgeDistance(this._intPt[i],this._inputLines[r][0],this._inputLines[r][1])},Me.prototype.isCollinear=function(){return this._result===Me.COLLINEAR_INTERSECTION},Me.prototype.toString=function(){return fe.toLineString(this._inputLines[0][0],this._inputLines[0][1])+" - "+fe.toLineString(this._inputLines[1][0],this._inputLines[1][1])+this.getTopologySummary()},Me.prototype.getEndpoint=function(r,i){return this._inputLines[r][i]},Me.prototype.isIntersection=function(r){for(var i=0;i<this._result;i++)if(this._intPt[i].equals2D(r))return!0;return!1},Me.prototype.getIntersectionAlongSegment=function(r,i){return this.computeIntLineIndex(),this._intPt[this._intLineIndex[r][i]]},Me.prototype.interfaces_=function(){return[]},Me.prototype.getClass=function(){return Me},Me.computeEdgeDistance=function(r,i,a){var c=Math.abs(a.x-i.x),d=Math.abs(a.y-i.y),_=-1;if(r.equals(i))_=0;else if(r.equals(a))_=c>d?c:d;else{var M=Math.abs(r.x-i.x),L=Math.abs(r.y-i.y);(_=c>d?M:L)!==0||r.equals(i)||(_=Math.max(M,L))}return Wt.isTrue(!(_===0&&!r.equals(i)),"Bad distance calculation"),_},Me.nonRobustComputeEdgeDistance=function(r,i,a){var c=r.x-i.x,d=r.y-i.y,_=Math.sqrt(c*c+d*d);return Wt.isTrue(!(_===0&&!r.equals(i)),"Invalid distance calculation"),_},tt.DONT_INTERSECT.get=function(){return 0},tt.DO_INTERSECT.get=function(){return 1},tt.COLLINEAR.get=function(){return 2},tt.NO_INTERSECTION.get=function(){return 0},tt.POINT_INTERSECTION.get=function(){return 1},tt.COLLINEAR_INTERSECTION.get=function(){return 2},Object.defineProperties(Me,tt);var z=function(r){function i(){r.apply(this,arguments)}return r&&(i.__proto__=r),i.prototype=Object.create(r&&r.prototype),i.prototype.constructor=i,i.prototype.isInSegmentEnvelopes=function(a){var c=new qt(this._inputLines[0][0],this._inputLines[0][1]),d=new qt(this._inputLines[1][0],this._inputLines[1][1]);return c.contains(a)&&d.contains(a)},i.prototype.computeIntersection=function(){if(arguments.length!==3)return r.prototype.computeIntersection.apply(this,arguments);var a=arguments[0],c=arguments[1],d=arguments[2];if(this._isProper=!1,qt.intersects(c,d,a)&&dt.orientationIndex(c,d,a)===0&&dt.orientationIndex(d,c,a)===0)return this._isProper=!0,(a.equals(c)||a.equals(d))&&(this._isProper=!1),this._result=r.POINT_INTERSECTION,null;this._result=r.NO_INTERSECTION},i.prototype.normalizeToMinimum=function(a,c,d,_,M){M.x=this.smallestInAbsValue(a.x,c.x,d.x,_.x),M.y=this.smallestInAbsValue(a.y,c.y,d.y,_.y),a.x-=M.x,a.y-=M.y,c.x-=M.x,c.y-=M.y,d.x-=M.x,d.y-=M.y,_.x-=M.x,_.y-=M.y},i.prototype.safeHCoordinateIntersection=function(a,c,d,_){var M=null;try{M=$t.intersection(a,c,d,_)}catch(L){if(!(L instanceof ce))throw L;M=i.nearestEndpoint(a,c,d,_)}return M},i.prototype.intersection=function(a,c,d,_){var M=this.intersectionWithNormalization(a,c,d,_);return this.isInSegmentEnvelopes(M)||(M=new D(i.nearestEndpoint(a,c,d,_))),this._precisionModel!==null&&this._precisionModel.makePrecise(M),M},i.prototype.smallestInAbsValue=function(a,c,d,_){var M=a,L=Math.abs(M);return Math.abs(c)<L&&(M=c,L=Math.abs(c)),Math.abs(d)<L&&(M=d,L=Math.abs(d)),Math.abs(_)<L&&(M=_),M},i.prototype.checkDD=function(a,c,d,_,M){var L=Gt.intersection(a,c,d,_),H=this.isInSegmentEnvelopes(L);te.out.println("DD in env = "+H+" --------------------- "+L),M.distance(L)>1e-4&&te.out.println("Distance = "+M.distance(L))},i.prototype.intersectionWithNormalization=function(a,c,d,_){var M=new D(a),L=new D(c),H=new D(d),it=new D(_),bt=new D;this.normalizeToEnvCentre(M,L,H,it,bt);var Tt=this.safeHCoordinateIntersection(M,L,H,it);return Tt.x+=bt.x,Tt.y+=bt.y,Tt},i.prototype.computeCollinearIntersection=function(a,c,d,_){var M=qt.intersects(a,c,d),L=qt.intersects(a,c,_),H=qt.intersects(d,_,a),it=qt.intersects(d,_,c);return M&&L?(this._intPt[0]=d,this._intPt[1]=_,r.COLLINEAR_INTERSECTION):H&&it?(this._intPt[0]=a,this._intPt[1]=c,r.COLLINEAR_INTERSECTION):M&&H?(this._intPt[0]=d,this._intPt[1]=a,!d.equals(a)||L||it?r.COLLINEAR_INTERSECTION:r.POINT_INTERSECTION):M&&it?(this._intPt[0]=d,this._intPt[1]=c,!d.equals(c)||L||H?r.COLLINEAR_INTERSECTION:r.POINT_INTERSECTION):L&&H?(this._intPt[0]=_,this._intPt[1]=a,!_.equals(a)||M||it?r.COLLINEAR_INTERSECTION:r.POINT_INTERSECTION):L&&it?(this._intPt[0]=_,this._intPt[1]=c,!_.equals(c)||M||H?r.COLLINEAR_INTERSECTION:r.POINT_INTERSECTION):r.NO_INTERSECTION},i.prototype.normalizeToEnvCentre=function(a,c,d,_,M){var L=a.x<c.x?a.x:c.x,H=a.y<c.y?a.y:c.y,it=a.x>c.x?a.x:c.x,bt=a.y>c.y?a.y:c.y,Tt=d.x<_.x?d.x:_.x,Kt=d.y<_.y?d.y:_.y,Qt=d.x>_.x?d.x:_.x,le=d.y>_.y?d.y:_.y,Ee=((L>Tt?L:Tt)+(it<Qt?it:Qt))/2,Dn=((H>Kt?H:Kt)+(bt<le?bt:le))/2;M.x=Ee,M.y=Dn,a.x-=M.x,a.y-=M.y,c.x-=M.x,c.y-=M.y,d.x-=M.x,d.y-=M.y,_.x-=M.x,_.y-=M.y},i.prototype.computeIntersect=function(a,c,d,_){if(this._isProper=!1,!qt.intersects(a,c,d,_))return r.NO_INTERSECTION;var M=dt.orientationIndex(a,c,d),L=dt.orientationIndex(a,c,_);if(M>0&&L>0||M<0&&L<0)return r.NO_INTERSECTION;var H=dt.orientationIndex(d,_,a),it=dt.orientationIndex(d,_,c);return H>0&&it>0||H<0&&it<0?r.NO_INTERSECTION:M===0&&L===0&&H===0&&it===0?this.computeCollinearIntersection(a,c,d,_):(M===0||L===0||H===0||it===0?(this._isProper=!1,a.equals2D(d)||a.equals2D(_)?this._intPt[0]=a:c.equals2D(d)||c.equals2D(_)?this._intPt[0]=c:M===0?this._intPt[0]=new D(d):L===0?this._intPt[0]=new D(_):H===0?this._intPt[0]=new D(a):it===0&&(this._intPt[0]=new D(c))):(this._isProper=!0,this._intPt[0]=this.intersection(a,c,d,_)),r.POINT_INTERSECTION)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i.nearestEndpoint=function(a,c,d,_){var M=a,L=dt.distancePointLine(a,d,_),H=dt.distancePointLine(c,d,_);return H<L&&(L=H,M=c),(H=dt.distancePointLine(d,a,c))<L&&(L=H,M=d),(H=dt.distancePointLine(_,a,c))<L&&(L=H,M=_),M},i}(Me),Pt=function(){};Pt.prototype.interfaces_=function(){return[]},Pt.prototype.getClass=function(){return Pt},Pt.orientationIndex=function(r,i,a){var c=i.x-r.x,d=i.y-r.y,_=a.x-i.x,M=a.y-i.y;return Pt.signOfDet2x2(c,d,_,M)},Pt.signOfDet2x2=function(r,i,a,c){var d=null,_=null,M=null;if(d=1,r===0||c===0)return i===0||a===0?0:i>0?a>0?-d:d:a>0?d:-d;if(i===0||a===0)return c>0?r>0?d:-d:r>0?-d:d;if(i>0?c>0?i<=c||(d=-d,_=r,r=a,a=_,_=i,i=c,c=_):i<=-c?(d=-d,a=-a,c=-c):(_=r,r=-a,a=_,_=i,i=-c,c=_):c>0?-i<=c?(d=-d,r=-r,i=-i):(_=-r,r=a,a=_,_=-i,i=c,c=_):i>=c?(r=-r,i=-i,a=-a,c=-c):(d=-d,_=-r,r=-a,a=_,_=-i,i=-c,c=_),r>0){if(!(a>0)||!(r<=a))return d}else{if(a>0||!(r>=a))return-d;d=-d,r=-r,a=-a}for(;;){if(M=Math.floor(a/r),a-=M*r,(c-=M*i)<0)return-d;if(c>i)return d;if(r>a+a){if(i<c+c)return d}else{if(i>c+c)return-d;a=r-a,c=i-c,d=-d}if(c===0)return a===0?0:-d;if(a===0||(M=Math.floor(r/a),r-=M*a,(i-=M*c)<0))return d;if(i>c)return-d;if(a>r+r){if(c<i+i)return-d}else{if(c>i+i)return d;r=a-r,i=c-i,d=-d}if(i===0)return r===0?0:d;if(r===0)return-d}};var Ot=function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var r=arguments[0];this._p=r};Ot.prototype.countSegment=function(r,i){if(r.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(r.y===this._p.y&&i.y===this._p.y){var a=r.x,c=i.x;return a>c&&(a=i.x,c=r.x),this._p.x>=a&&this._p.x<=c&&(this._isPointOnSegment=!0),null}if(r.y>this._p.y&&i.y<=this._p.y||i.y>this._p.y&&r.y<=this._p.y){var d=r.x-this._p.x,_=r.y-this._p.y,M=i.x-this._p.x,L=i.y-this._p.y,H=Pt.signOfDet2x2(d,_,M,L);if(H===0)return this._isPointOnSegment=!0,null;L<_&&(H=-H),H>0&&this._crossingCount++}},Ot.prototype.isPointInPolygon=function(){return this.getLocation()!==K.EXTERIOR},Ot.prototype.getLocation=function(){return this._isPointOnSegment?K.BOUNDARY:this._crossingCount%2==1?K.INTERIOR:K.EXTERIOR},Ot.prototype.isOnSegment=function(){return this._isPointOnSegment},Ot.prototype.interfaces_=function(){return[]},Ot.prototype.getClass=function(){return Ot},Ot.locatePointInRing=function(){if(arguments[0]instanceof D&&Q(arguments[1],ut)){for(var r=arguments[0],i=arguments[1],a=new Ot(r),c=new D,d=new D,_=1;_<i.size();_++)if(i.getCoordinate(_,c),i.getCoordinate(_-1,d),a.countSegment(c,d),a.isOnSegment())return a.getLocation();return a.getLocation()}if(arguments[0]instanceof D&&arguments[1]instanceof Array){for(var M=arguments[0],L=arguments[1],H=new Ot(M),it=1;it<L.length;it++){var bt=L[it],Tt=L[it-1];if(H.countSegment(bt,Tt),H.isOnSegment())return H.getLocation()}return H.getLocation()}};var dt=function(){},Ht={CLOCKWISE:{configurable:!0},RIGHT:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},LEFT:{configurable:!0},COLLINEAR:{configurable:!0},STRAIGHT:{configurable:!0}};dt.prototype.interfaces_=function(){return[]},dt.prototype.getClass=function(){return dt},dt.orientationIndex=function(r,i,a){return Gt.orientationIndex(r,i,a)},dt.signedArea=function(){if(arguments[0]instanceof Array){var r=arguments[0];if(r.length<3)return 0;for(var i=0,a=r[0].x,c=1;c<r.length-1;c++){var d=r[c].x-a,_=r[c+1].y;i+=d*(r[c-1].y-_)}return i/2}if(Q(arguments[0],ut)){var M=arguments[0],L=M.size();if(L<3)return 0;var H=new D,it=new D,bt=new D;M.getCoordinate(0,it),M.getCoordinate(1,bt);var Tt=it.x;bt.x-=Tt;for(var Kt=0,Qt=1;Qt<L-1;Qt++)H.y=it.y,it.x=bt.x,it.y=bt.y,M.getCoordinate(Qt+1,bt),bt.x-=Tt,Kt+=it.x*(H.y-bt.y);return Kt/2}},dt.distanceLineLine=function(r,i,a,c){if(r.equals(i))return dt.distancePointLine(r,a,c);if(a.equals(c))return dt.distancePointLine(c,r,i);var d=!1;if(qt.intersects(r,i,a,c)){var _=(i.x-r.x)*(c.y-a.y)-(i.y-r.y)*(c.x-a.x);if(_===0)d=!0;else{var M=(r.y-a.y)*(c.x-a.x)-(r.x-a.x)*(c.y-a.y),L=((r.y-a.y)*(i.x-r.x)-(r.x-a.x)*(i.y-r.y))/_,H=M/_;(H<0||H>1||L<0||L>1)&&(d=!0)}}else d=!0;return d?At.min(dt.distancePointLine(r,a,c),dt.distancePointLine(i,a,c),dt.distancePointLine(a,r,i),dt.distancePointLine(c,r,i)):0},dt.isPointInRing=function(r,i){return dt.locatePointInRing(r,i)!==K.EXTERIOR},dt.computeLength=function(r){var i=r.size();if(i<=1)return 0;var a=0,c=new D;r.getCoordinate(0,c);for(var d=c.x,_=c.y,M=1;M<i;M++){r.getCoordinate(M,c);var L=c.x,H=c.y,it=L-d,bt=H-_;a+=Math.sqrt(it*it+bt*bt),d=L,_=H}return a},dt.isCCW=function(r){var i=r.length-1;if(i<3)throw new I("Ring has fewer than 4 points, so orientation cannot be determined");for(var a=r[0],c=0,d=1;d<=i;d++){var _=r[d];_.y>a.y&&(a=_,c=d)}var M=c;do(M-=1)<0&&(M=i);while(r[M].equals2D(a)&&M!==c);var L=c;do L=(L+1)%i;while(r[L].equals2D(a)&&L!==c);var H=r[M],it=r[L];if(H.equals2D(a)||it.equals2D(a)||H.equals2D(it))return!1;var bt=dt.computeOrientation(H,a,it),Tt=!1;return Tt=bt===0?H.x>it.x:bt>0,Tt},dt.locatePointInRing=function(r,i){return Ot.locatePointInRing(r,i)},dt.distancePointLinePerpendicular=function(r,i,a){var c=(a.x-i.x)*(a.x-i.x)+(a.y-i.y)*(a.y-i.y),d=((i.y-r.y)*(a.x-i.x)-(i.x-r.x)*(a.y-i.y))/c;return Math.abs(d)*Math.sqrt(c)},dt.computeOrientation=function(r,i,a){return dt.orientationIndex(r,i,a)},dt.distancePointLine=function(){if(arguments.length===2){var r=arguments[0],i=arguments[1];if(i.length===0)throw new I("Line array must contain at least one vertex");for(var a=r.distance(i[0]),c=0;c<i.length-1;c++){var d=dt.distancePointLine(r,i[c],i[c+1]);d<a&&(a=d)}return a}if(arguments.length===3){var _=arguments[0],M=arguments[1],L=arguments[2];if(M.x===L.x&&M.y===L.y)return _.distance(M);var H=(L.x-M.x)*(L.x-M.x)+(L.y-M.y)*(L.y-M.y),it=((_.x-M.x)*(L.x-M.x)+(_.y-M.y)*(L.y-M.y))/H;if(it<=0)return _.distance(M);if(it>=1)return _.distance(L);var bt=((M.y-_.y)*(L.x-M.x)-(M.x-_.x)*(L.y-M.y))/H;return Math.abs(bt)*Math.sqrt(H)}},dt.isOnLine=function(r,i){for(var a=new z,c=1;c<i.length;c++){var d=i[c-1],_=i[c];if(a.computeIntersection(r,d,_),a.hasIntersection())return!0}return!1},Ht.CLOCKWISE.get=function(){return-1},Ht.RIGHT.get=function(){return dt.CLOCKWISE},Ht.COUNTERCLOCKWISE.get=function(){return 1},Ht.LEFT.get=function(){return dt.COUNTERCLOCKWISE},Ht.COLLINEAR.get=function(){return 0},Ht.STRAIGHT.get=function(){return dt.COLLINEAR},Object.defineProperties(dt,Ht);var Ce=function(){};Ce.prototype.filter=function(r){},Ce.prototype.interfaces_=function(){return[]},Ce.prototype.getClass=function(){return Ce};var Vt=function(){var r=arguments[0];this._envelope=null,this._factory=null,this._SRID=null,this._userData=null,this._factory=r,this._SRID=r.getSRID()},Zt={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}};Vt.prototype.isGeometryCollection=function(){return this.getSortIndex()===Vt.SORTINDEX_GEOMETRYCOLLECTION},Vt.prototype.getFactory=function(){return this._factory},Vt.prototype.getGeometryN=function(r){return this},Vt.prototype.getArea=function(){return 0},Vt.prototype.isRectangle=function(){return!1},Vt.prototype.equals=function(){if(arguments[0]instanceof Vt){var r=arguments[0];return r!==null&&this.equalsTopo(r)}if(arguments[0]instanceof Object){var i=arguments[0];if(!(i instanceof Vt))return!1;var a=i;return this.equalsExact(a)}},Vt.prototype.equalsExact=function(r){return this===r||this.equalsExact(r,0)},Vt.prototype.geometryChanged=function(){this.apply(Vt.geometryChangedFilter)},Vt.prototype.geometryChangedAction=function(){this._envelope=null},Vt.prototype.equalsNorm=function(r){return r!==null&&this.norm().equalsExact(r.norm())},Vt.prototype.getLength=function(){return 0},Vt.prototype.getNumGeometries=function(){return 1},Vt.prototype.compareTo=function(){if(arguments.length===1){var r=arguments[0],i=r;return this.getSortIndex()!==i.getSortIndex()?this.getSortIndex()-i.getSortIndex():this.isEmpty()&&i.isEmpty()?0:this.isEmpty()?-1:i.isEmpty()?1:this.compareToSameClass(r)}if(arguments.length===2){var a=arguments[0],c=arguments[1];return this.getSortIndex()!==a.getSortIndex()?this.getSortIndex()-a.getSortIndex():this.isEmpty()&&a.isEmpty()?0:this.isEmpty()?-1:a.isEmpty()?1:this.compareToSameClass(a,c)}},Vt.prototype.getUserData=function(){return this._userData},Vt.prototype.getSRID=function(){return this._SRID},Vt.prototype.getEnvelope=function(){return this.getFactory().toGeometry(this.getEnvelopeInternal())},Vt.prototype.checkNotGeometryCollection=function(r){if(r.getSortIndex()===Vt.SORTINDEX_GEOMETRYCOLLECTION)throw new I("This method does not support GeometryCollection arguments")},Vt.prototype.equal=function(r,i,a){return a===0?r.equals(i):r.distance(i)<=a},Vt.prototype.norm=function(){var r=this.copy();return r.normalize(),r},Vt.prototype.getPrecisionModel=function(){return this._factory.getPrecisionModel()},Vt.prototype.getEnvelopeInternal=function(){return this._envelope===null&&(this._envelope=this.computeEnvelopeInternal()),new qt(this._envelope)},Vt.prototype.setSRID=function(r){this._SRID=r},Vt.prototype.setUserData=function(r){this._userData=r},Vt.prototype.compare=function(r,i){for(var a=r.iterator(),c=i.iterator();a.hasNext()&&c.hasNext();){var d=a.next(),_=c.next(),M=d.compareTo(_);if(M!==0)return M}return a.hasNext()?1:c.hasNext()?-1:0},Vt.prototype.hashCode=function(){return this.getEnvelopeInternal().hashCode()},Vt.prototype.isGeometryCollectionOrDerived=function(){return this.getSortIndex()===Vt.SORTINDEX_GEOMETRYCOLLECTION||this.getSortIndex()===Vt.SORTINDEX_MULTIPOINT||this.getSortIndex()===Vt.SORTINDEX_MULTILINESTRING||this.getSortIndex()===Vt.SORTINDEX_MULTIPOLYGON},Vt.prototype.interfaces_=function(){return[X,V,t]},Vt.prototype.getClass=function(){return Vt},Vt.hasNonEmptyElements=function(r){for(var i=0;i<r.length;i++)if(!r[i].isEmpty())return!0;return!1},Vt.hasNullElements=function(r){for(var i=0;i<r.length;i++)if(r[i]===null)return!0;return!1},Zt.serialVersionUID.get=function(){return 8763622679187377e3},Zt.SORTINDEX_POINT.get=function(){return 0},Zt.SORTINDEX_MULTIPOINT.get=function(){return 1},Zt.SORTINDEX_LINESTRING.get=function(){return 2},Zt.SORTINDEX_LINEARRING.get=function(){return 3},Zt.SORTINDEX_MULTILINESTRING.get=function(){return 4},Zt.SORTINDEX_POLYGON.get=function(){return 5},Zt.SORTINDEX_MULTIPOLYGON.get=function(){return 6},Zt.SORTINDEX_GEOMETRYCOLLECTION.get=function(){return 7},Zt.geometryChangedFilter.get=function(){return ne},Object.defineProperties(Vt,Zt);var ne=function(){};ne.interfaces_=function(){return[Ce]},ne.filter=function(r){r.geometryChangedAction()};var rt=function(){};rt.prototype.filter=function(r){},rt.prototype.interfaces_=function(){return[]},rt.prototype.getClass=function(){return rt};var P=function(){},N={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}};P.prototype.isInBoundary=function(r){},P.prototype.interfaces_=function(){return[]},P.prototype.getClass=function(){return P},N.Mod2BoundaryNodeRule.get=function(){return k},N.EndPointBoundaryNodeRule.get=function(){return $},N.MultiValentEndPointBoundaryNodeRule.get=function(){return W},N.MonoValentEndPointBoundaryNodeRule.get=function(){return ht},N.MOD2_BOUNDARY_RULE.get=function(){return new k},N.ENDPOINT_BOUNDARY_RULE.get=function(){return new $},N.MULTIVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new W},N.MONOVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new ht},N.OGC_SFS_BOUNDARY_RULE.get=function(){return P.MOD2_BOUNDARY_RULE},Object.defineProperties(P,N);var k=function(){};k.prototype.isInBoundary=function(r){return r%2==1},k.prototype.interfaces_=function(){return[P]},k.prototype.getClass=function(){return k};var $=function(){};$.prototype.isInBoundary=function(r){return r>0},$.prototype.interfaces_=function(){return[P]},$.prototype.getClass=function(){return $};var W=function(){};W.prototype.isInBoundary=function(r){return r>1},W.prototype.interfaces_=function(){return[P]},W.prototype.getClass=function(){return W};var ht=function(){};ht.prototype.isInBoundary=function(r){return r===1},ht.prototype.interfaces_=function(){return[P]},ht.prototype.getClass=function(){return ht};var at=function(){};at.prototype.add=function(){},at.prototype.addAll=function(){},at.prototype.isEmpty=function(){},at.prototype.iterator=function(){},at.prototype.size=function(){},at.prototype.toArray=function(){},at.prototype.remove=function(){},(e.prototype=new Error).name="IndexOutOfBoundsException";var wt=function(){};wt.prototype.hasNext=function(){},wt.prototype.next=function(){},wt.prototype.remove=function(){};var Et=function(r){function i(){r.apply(this,arguments)}return r&&(i.__proto__=r),i.prototype=Object.create(r&&r.prototype),i.prototype.constructor=i,i.prototype.get=function(){},i.prototype.set=function(){},i.prototype.isEmpty=function(){},i}(at);(o.prototype=new Error).name="NoSuchElementException";var G=function(r){function i(){r.call(this),this.array_=[],arguments[0]instanceof at&&this.addAll(arguments[0])}return r&&(i.__proto__=r),i.prototype=Object.create(r&&r.prototype),i.prototype.constructor=i,i.prototype.ensureCapacity=function(){},i.prototype.interfaces_=function(){return[r,at]},i.prototype.add=function(a){return arguments.length===1?this.array_.push(a):this.array_.splice(arguments[0],arguments[1]),!0},i.prototype.clear=function(){this.array_=[]},i.prototype.addAll=function(a){for(var c=a.iterator();c.hasNext();)this.add(c.next());return!0},i.prototype.set=function(a,c){var d=this.array_[a];return this.array_[a]=c,d},i.prototype.iterator=function(){return new ot(this)},i.prototype.get=function(a){if(a<0||a>=this.size())throw new e;return this.array_[a]},i.prototype.isEmpty=function(){return this.array_.length===0},i.prototype.size=function(){return this.array_.length},i.prototype.toArray=function(){for(var a=[],c=0,d=this.array_.length;c<d;c++)a.push(this.array_[c]);return a},i.prototype.remove=function(a){for(var c=!1,d=0,_=this.array_.length;d<_;d++)if(this.array_[d]===a){this.array_.splice(d,1),c=!0;break}return c},i}(Et),ot=function(r){function i(a){r.call(this),this.arrayList_=a,this.position_=0}return r&&(i.__proto__=r),i.prototype=Object.create(r&&r.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(a){return this.arrayList_.set(this.position_-1,a)},i.prototype.remove=function(){this.arrayList_.remove(this.arrayList_.get(this.position_))},i}(wt),et=function(r){function i(){if(r.call(this),arguments.length!==0){if(arguments.length===1){var c=arguments[0];this.ensureCapacity(c.length),this.add(c,!0)}else if(arguments.length===2){var d=arguments[0],_=arguments[1];this.ensureCapacity(d.length),this.add(d,_)}}}r&&(i.__proto__=r),(i.prototype=Object.create(r&&r.prototype)).constructor=i;var a={coordArrayType:{configurable:!0}};return a.coordArrayType.get=function(){return new Array(0).fill(null)},i.prototype.getCoordinate=function(c){return this.get(c)},i.prototype.addAll=function(){if(arguments.length===2){for(var c=arguments[0],d=arguments[1],_=!1,M=c.iterator();M.hasNext();)this.add(M.next(),d),_=!0;return _}return r.prototype.addAll.apply(this,arguments)},i.prototype.clone=function(){for(var c=r.prototype.clone.call(this),d=0;d<this.size();d++)c.add(d,this.get(d).copy());return c},i.prototype.toCoordinateArray=function(){return this.toArray(i.coordArrayType)},i.prototype.add=function(){if(arguments.length===1){var c=arguments[0];r.prototype.add.call(this,c)}else if(arguments.length===2){if(arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var d=arguments[0],_=arguments[1];return this.add(d,_,!0),!0}if(arguments[0]instanceof D&&typeof arguments[1]=="boolean"){var M=arguments[0];if(!arguments[1]&&this.size()>=1&&this.get(this.size()-1).equals2D(M))return null;r.prototype.add.call(this,M)}else if(arguments[0]instanceof Object&&typeof arguments[1]=="boolean"){var L=arguments[0],H=arguments[1];return this.add(L,H),!0}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var it=arguments[0],bt=arguments[1];if(arguments[2])for(var Tt=0;Tt<it.length;Tt++)this.add(it[Tt],bt);else for(var Kt=it.length-1;Kt>=0;Kt--)this.add(it[Kt],bt);return!0}if(typeof arguments[2]=="boolean"&&Number.isInteger(arguments[0])&&arguments[1]instanceof D){var Qt=arguments[0],le=arguments[1];if(!arguments[2]){var Ee=this.size();if(Ee>0&&(Qt>0&&this.get(Qt-1).equals2D(le)||Qt<Ee&&this.get(Qt).equals2D(le)))return null}r.prototype.add.call(this,Qt,le)}}else if(arguments.length===4){var Dn=arguments[0],Jn=arguments[1],fi=arguments[2],as=arguments[3],qs=1;fi>as&&(qs=-1);for(var Pf=fi;Pf!==as;Pf+=qs)this.add(Dn[Pf],Jn);return!0}},i.prototype.closeRing=function(){this.size()>0&&this.add(new D(this.get(0)),!1)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},Object.defineProperties(i,a),i}(G),lt=function(){},Ft={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};Ft.ForwardComparator.get=function(){return Jt},Ft.BidirectionalComparator.get=function(){return me},Ft.coordArrayType.get=function(){return new Array(0).fill(null)},lt.prototype.interfaces_=function(){return[]},lt.prototype.getClass=function(){return lt},lt.isRing=function(r){return!(r.length<4)&&!!r[0].equals2D(r[r.length-1])},lt.ptNotInList=function(r,i){for(var a=0;a<r.length;a++){var c=r[a];if(lt.indexOf(c,i)<0)return c}return null},lt.scroll=function(r,i){var a=lt.indexOf(i,r);if(a<0)return null;var c=new Array(r.length).fill(null);te.arraycopy(r,a,c,0,r.length-a),te.arraycopy(r,0,c,r.length-a,a),te.arraycopy(c,0,r,0,r.length)},lt.equals=function(){if(arguments.length===2){var r=arguments[0],i=arguments[1];if(r===i)return!0;if(r===null||i===null||r.length!==i.length)return!1;for(var a=0;a<r.length;a++)if(!r[a].equals(i[a]))return!1;return!0}if(arguments.length===3){var c=arguments[0],d=arguments[1],_=arguments[2];if(c===d)return!0;if(c===null||d===null||c.length!==d.length)return!1;for(var M=0;M<c.length;M++)if(_.compare(c[M],d[M])!==0)return!1;return!0}},lt.intersection=function(r,i){for(var a=new et,c=0;c<r.length;c++)i.intersects(r[c])&&a.add(r[c],!0);return a.toCoordinateArray()},lt.hasRepeatedPoints=function(r){for(var i=1;i<r.length;i++)if(r[i-1].equals(r[i]))return!0;return!1},lt.removeRepeatedPoints=function(r){return lt.hasRepeatedPoints(r)?new et(r,!1).toCoordinateArray():r},lt.reverse=function(r){for(var i=r.length-1,a=Math.trunc(i/2),c=0;c<=a;c++){var d=r[c];r[c]=r[i-c],r[i-c]=d}},lt.removeNull=function(r){for(var i=0,a=0;a<r.length;a++)r[a]!==null&&i++;var c=new Array(i).fill(null);if(i===0)return c;for(var d=0,_=0;_<r.length;_++)r[_]!==null&&(c[d++]=r[_]);return c},lt.copyDeep=function(){if(arguments.length===1){for(var r=arguments[0],i=new Array(r.length).fill(null),a=0;a<r.length;a++)i[a]=new D(r[a]);return i}if(arguments.length===5)for(var c=arguments[0],d=arguments[1],_=arguments[2],M=arguments[3],L=arguments[4],H=0;H<L;H++)_[M+H]=new D(c[d+H])},lt.isEqualReversed=function(r,i){for(var a=0;a<r.length;a++){var c=r[a],d=i[r.length-a-1];if(c.compareTo(d)!==0)return!1}return!0},lt.envelope=function(r){for(var i=new qt,a=0;a<r.length;a++)i.expandToInclude(r[a]);return i},lt.toCoordinateArray=function(r){return r.toArray(lt.coordArrayType)},lt.atLeastNCoordinatesOrNothing=function(r,i){return i.length>=r?i:[]},lt.indexOf=function(r,i){for(var a=0;a<i.length;a++)if(r.equals(i[a]))return a;return-1},lt.increasingDirection=function(r){for(var i=0;i<Math.trunc(r.length/2);i++){var a=r.length-1-i,c=r[i].compareTo(r[a]);if(c!==0)return c}return 1},lt.compare=function(r,i){for(var a=0;a<r.length&&a<i.length;){var c=r[a].compareTo(i[a]);if(c!==0)return c;a++}return a<i.length?-1:a<r.length?1:0},lt.minCoordinate=function(r){for(var i=null,a=0;a<r.length;a++)(i===null||i.compareTo(r[a])>0)&&(i=r[a]);return i},lt.extract=function(r,i,a){i=At.clamp(i,0,r.length);var c=(a=At.clamp(a,-1,r.length))-i+1;a<0&&(c=0),i>=r.length&&(c=0),a<i&&(c=0);var d=new Array(c).fill(null);if(c===0)return d;for(var _=0,M=i;M<=a;M++)d[_++]=r[M];return d},Object.defineProperties(lt,Ft);var Jt=function(){};Jt.prototype.compare=function(r,i){return lt.compare(r,i)},Jt.prototype.interfaces_=function(){return[q]},Jt.prototype.getClass=function(){return Jt};var me=function(){};me.prototype.compare=function(r,i){var a=r,c=i;if(a.length<c.length)return-1;if(a.length>c.length)return 1;if(a.length===0)return 0;var d=lt.compare(a,c);return lt.isEqualReversed(a,c)?0:d},me.prototype.OLDcompare=function(r,i){var a=r,c=i;if(a.length<c.length)return-1;if(a.length>c.length)return 1;if(a.length===0)return 0;for(var d=lt.increasingDirection(a),_=lt.increasingDirection(c),M=d>0?0:a.length-1,L=_>0?0:a.length-1,H=0;H<a.length;H++){var it=a[M].compareTo(c[L]);if(it!==0)return it;M+=d,L+=_}return 0},me.prototype.interfaces_=function(){return[q]},me.prototype.getClass=function(){return me};var ve=function(){};ve.prototype.get=function(){},ve.prototype.put=function(){},ve.prototype.size=function(){},ve.prototype.values=function(){},ve.prototype.entrySet=function(){};var qe=function(r){function i(){r.apply(this,arguments)}return r&&(i.__proto__=r),i.prototype=Object.create(r&&r.prototype),i.prototype.constructor=i,i}(ve);(s.prototype=new Error).name="OperationNotSupported",(u.prototype=new at).contains=function(){};var Ue=function(r){function i(){r.call(this),this.array_=[],arguments[0]instanceof at&&this.addAll(arguments[0])}return r&&(i.__proto__=r),i.prototype=Object.create(r&&r.prototype),i.prototype.constructor=i,i.prototype.contains=function(a){for(var c=0,d=this.array_.length;c<d;c++)if(this.array_[c]===a)return!0;return!1},i.prototype.add=function(a){return!this.contains(a)&&(this.array_.push(a),!0)},i.prototype.addAll=function(a){for(var c=a.iterator();c.hasNext();)this.add(c.next());return!0},i.prototype.remove=function(a){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 a=[],c=0,d=this.array_.length;c<d;c++)a.push(this.array_[c]);return a},i.prototype.iterator=function(){return new Xe(this)},i}(u),Xe=function(r){function i(a){r.call(this),this.hashSet_=a,this.position_=0}return r&&(i.__proto__=r),i.prototype=Object.create(r&&r.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 s},i}(wt),Je=0;(w.prototype=new qe).get=function(r){for(var i=this.root_;i!==null;){var a=r.compareTo(i.key);if(a<0)i=i.left;else{if(!(a>0))return i.value;i=i.right}}return null},w.prototype.put=function(r,i){if(this.root_===null)return this.root_={key:r,value:i,left:null,right:null,parent:null,color:Je,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var a,c,d=this.root_;do if(a=d,(c=r.compareTo(d.key))<0)d=d.left;else{if(!(c>0)){var _=d.value;return d.value=i,_}d=d.right}while(d!==null);var M={key:r,left:null,right:null,value:i,parent:a,color:Je,getValue:function(){return this.value},getKey:function(){return this.key}};return c<0?a.left=M:a.right=M,this.fixAfterInsertion(M),this.size_++,null},w.prototype.fixAfterInsertion=function(r){for(r.color=1;r!=null&&r!==this.root_&&r.parent.color===1;)if(f(r)===m(f(f(r)))){var i=v(f(f(r)));p(i)===1?(g(f(r),Je),g(i,Je),g(f(f(r)),1),r=f(f(r))):(r===v(f(r))&&(r=f(r),this.rotateLeft(r)),g(f(r),Je),g(f(f(r)),1),this.rotateRight(f(f(r))))}else{var a=m(f(f(r)));p(a)===1?(g(f(r),Je),g(a,Je),g(f(f(r)),1),r=f(f(r))):(r===m(f(r))&&(r=f(r),this.rotateRight(r)),g(f(r),Je),g(f(f(r)),1),this.rotateLeft(f(f(r))))}this.root_.color=Je},w.prototype.values=function(){var r=new G,i=this.getFirstEntry();if(i!==null)for(r.add(i.value);(i=w.successor(i))!==null;)r.add(i.value);return r},w.prototype.entrySet=function(){var r=new Ue,i=this.getFirstEntry();if(i!==null)for(r.add(i);(i=w.successor(i))!==null;)r.add(i);return r},w.prototype.rotateLeft=function(r){if(r!=null){var i=r.right;r.right=i.left,i.left!=null&&(i.left.parent=r),i.parent=r.parent,r.parent===null?this.root_=i:r.parent.left===r?r.parent.left=i:r.parent.right=i,i.left=r,r.parent=i}},w.prototype.rotateRight=function(r){if(r!=null){var i=r.left;r.left=i.right,i.right!=null&&(i.right.parent=r),i.parent=r.parent,r.parent===null?this.root_=i:r.parent.right===r?r.parent.right=i:r.parent.left=i,i.right=r,r.parent=i}},w.prototype.getFirstEntry=function(){var r=this.root_;if(r!=null)for(;r.left!=null;)r=r.left;return r},w.successor=function(r){if(r===null)return null;if(r.right!==null){for(var i=r.right;i.left!==null;)i=i.left;return i}for(var a=r.parent,c=r;a!==null&&c===a.right;)c=a,a=a.parent;return a},w.prototype.size=function(){return this.size_};var wr=function(){};wr.prototype.interfaces_=function(){return[]},wr.prototype.getClass=function(){return wr},S.prototype=new u,(b.prototype=new S).contains=function(r){for(var i=0,a=this.array_.length;i<a;i++)if(this.array_[i].compareTo(r)===0)return!0;return!1},b.prototype.add=function(r){if(this.contains(r))return!1;for(var i=0,a=this.array_.length;i<a;i++)if(this.array_[i].compareTo(r)===1)return this.array_.splice(i,0,r),!0;return this.array_.push(r),!0},b.prototype.addAll=function(r){for(var i=r.iterator();i.hasNext();)this.add(i.next());return!0},b.prototype.remove=function(r){throw new s},b.prototype.size=function(){return this.array_.length},b.prototype.isEmpty=function(){return this.array_.length===0},b.prototype.toArray=function(){for(var r=[],i=0,a=this.array_.length;i<a;i++)r.push(this.array_[i]);return r},b.prototype.iterator=function(){return new Kr(this)};var Kr=function(r){this.treeSet_=r,this.position_=0};Kr.prototype.next=function(){if(this.position_===this.treeSet_.size())throw new o;return this.treeSet_.array_[this.position_++]},Kr.prototype.hasNext=function(){return this.position_<this.treeSet_.size()},Kr.prototype.remove=function(){throw new s};var nr=function(){};nr.sort=function(){var r,i,a,c,d=arguments[0];if(arguments.length===1)c=function(M,L){return M.compareTo(L)},d.sort(c);else if(arguments.length===2)a=arguments[1],c=function(M,L){return a.compare(M,L)},d.sort(c);else if(arguments.length===3){(i=d.slice(arguments[1],arguments[2])).sort();var _=d.slice(0,arguments[1]).concat(i,d.slice(arguments[2],d.length));for(d.splice(0,d.length),r=0;r<_.length;r++)d.push(_[r])}else if(arguments.length===4)for(i=d.slice(arguments[1],arguments[2]),a=arguments[3],c=function(M,L){return a.compare(M,L)},i.sort(c),_=d.slice(0,arguments[1]).concat(i,d.slice(arguments[2],d.length)),d.splice(0,d.length),r=0;r<_.length;r++)d.push(_[r])},nr.asList=function(r){for(var i=new G,a=0,c=r.length;a<c;a++)i.add(r[a]);return i};var Ie=function(){},rr={P:{configurable:!0},L:{configurable:!0},A:{configurable:!0},FALSE:{configurable:!0},TRUE:{configurable:!0},DONTCARE:{configurable:!0},SYM_FALSE:{configurable:!0},SYM_TRUE:{configurable:!0},SYM_DONTCARE:{configurable:!0},SYM_P:{configurable:!0},SYM_L:{configurable:!0},SYM_A:{configurable:!0}};rr.P.get=function(){return 0},rr.L.get=function(){return 1},rr.A.get=function(){return 2},rr.FALSE.get=function(){return-1},rr.TRUE.get=function(){return-2},rr.DONTCARE.get=function(){return-3},rr.SYM_FALSE.get=function(){return"F"},rr.SYM_TRUE.get=function(){return"T"},rr.SYM_DONTCARE.get=function(){return"*"},rr.SYM_P.get=function(){return"0"},rr.SYM_L.get=function(){return"1"},rr.SYM_A.get=function(){return"2"},Ie.prototype.interfaces_=function(){return[]},Ie.prototype.getClass=function(){return Ie},Ie.toDimensionSymbol=function(r){switch(r){case Ie.FALSE:return Ie.SYM_FALSE;case Ie.TRUE:return Ie.SYM_TRUE;case Ie.DONTCARE:return Ie.SYM_DONTCARE;case Ie.P:return Ie.SYM_P;case Ie.L:return Ie.SYM_L;case Ie.A:return Ie.SYM_A}throw new I("Unknown dimension value: "+r)},Ie.toDimensionValue=function(r){switch(yt.toUpperCase(r)){case Ie.SYM_FALSE:return Ie.FALSE;case Ie.SYM_TRUE:return Ie.TRUE;case Ie.SYM_DONTCARE:return Ie.DONTCARE;case Ie.SYM_P:return Ie.P;case Ie.SYM_L:return Ie.L;case Ie.SYM_A:return Ie.A}throw new I("Unknown dimension symbol: "+r)},Object.defineProperties(Ie,rr);var pr=function(){};pr.prototype.filter=function(r){},pr.prototype.interfaces_=function(){return[]},pr.prototype.getClass=function(){return pr};var ur=function(){};ur.prototype.filter=function(r,i){},ur.prototype.isDone=function(){},ur.prototype.isGeometryChanged=function(){},ur.prototype.interfaces_=function(){return[]},ur.prototype.getClass=function(){return ur};var Qn=function(r){function i(c,d){if(r.call(this,d),this._geometries=c||[],r.hasNullElements(this._geometries))throw new I("geometries must not contain null elements")}r&&(i.__proto__=r),(i.prototype=Object.create(r&&r.prototype)).constructor=i;var a={serialVersionUID:{configurable:!0}};return i.prototype.computeEnvelopeInternal=function(){for(var c=new qt,d=0;d<this._geometries.length;d++)c.expandToInclude(this._geometries[d].getEnvelopeInternal());return c},i.prototype.getGeometryN=function(c){return this._geometries[c]},i.prototype.getSortIndex=function(){return r.SORTINDEX_GEOMETRYCOLLECTION},i.prototype.getCoordinates=function(){for(var c=new Array(this.getNumPoints()).fill(null),d=-1,_=0;_<this._geometries.length;_++)for(var M=this._geometries[_].getCoordinates(),L=0;L<M.length;L++)c[++d]=M[L];return c},i.prototype.getArea=function(){for(var c=0,d=0;d<this._geometries.length;d++)c+=this._geometries[d].getArea();return c},i.prototype.equalsExact=function(){if(arguments.length===2){var c=arguments[0],d=arguments[1];if(!this.isEquivalentClass(c))return!1;var _=c;if(this._geometries.length!==_._geometries.length)return!1;for(var M=0;M<this._geometries.length;M++)if(!this._geometries[M].equalsExact(_._geometries[M],d))return!1;return!0}return r.prototype.equalsExact.apply(this,arguments)},i.prototype.normalize=function(){for(var c=0;c<this._geometries.length;c++)this._geometries[c].normalize();nr.sort(this._geometries)},i.prototype.getCoordinate=function(){return this.isEmpty()?null:this._geometries[0].getCoordinate()},i.prototype.getBoundaryDimension=function(){for(var c=Ie.FALSE,d=0;d<this._geometries.length;d++)c=Math.max(c,this._geometries[d].getBoundaryDimension());return c},i.prototype.getDimension=function(){for(var c=Ie.FALSE,d=0;d<this._geometries.length;d++)c=Math.max(c,this._geometries[d].getDimension());return c},i.prototype.getLength=function(){for(var c=0,d=0;d<this._geometries.length;d++)c+=this._geometries[d].getLength();return c},i.prototype.getNumPoints=function(){for(var c=0,d=0;d<this._geometries.length;d++)c+=this._geometries[d].getNumPoints();return c},i.prototype.getNumGeometries=function(){return this._geometries.length},i.prototype.reverse=function(){for(var c=this._geometries.length,d=new Array(c).fill(null),_=0;_<this._geometries.length;_++)d[_]=this._geometries[_].reverse();return this.getFactory().createGeometryCollection(d)},i.prototype.compareToSameClass=function(){if(arguments.length===1){var c=arguments[0],d=new b(nr.asList(this._geometries)),_=new b(nr.asList(c._geometries));return this.compare(d,_)}if(arguments.length===2){for(var M=arguments[0],L=arguments[1],H=M,it=this.getNumGeometries(),bt=H.getNumGeometries(),Tt=0;Tt<it&&Tt<bt;){var Kt=this.getGeometryN(Tt),Qt=H.getGeometryN(Tt),le=Kt.compareToSameClass(Qt,L);if(le!==0)return le;Tt++}return Tt<it?1:Tt<bt?-1:0}},i.prototype.apply=function(){if(Q(arguments[0],rt))for(var c=arguments[0],d=0;d<this._geometries.length;d++)this._geometries[d].apply(c);else if(Q(arguments[0],ur)){var _=arguments[0];if(this._geometries.length===0)return null;for(var M=0;M<this._geometries.length&&(this._geometries[M].apply(_),!_.isDone());M++);_.isGeometryChanged()&&this.geometryChanged()}else if(Q(arguments[0],pr)){var L=arguments[0];L.filter(this);for(var H=0;H<this._geometries.length;H++)this._geometries[H].apply(L)}else if(Q(arguments[0],Ce)){var it=arguments[0];it.filter(this);for(var bt=0;bt<this._geometries.length;bt++)this._geometries[bt].apply(it)}},i.prototype.getBoundary=function(){return this.checkNotGeometryCollection(this),Wt.shouldNeverReachHere(),null},i.prototype.clone=function(){var c=r.prototype.clone.call(this);c._geometries=new Array(this._geometries.length).fill(null);for(var d=0;d<this._geometries.length;d++)c._geometries[d]=this._geometries[d].clone();return c},i.prototype.getGeometryType=function(){return"GeometryCollection"},i.prototype.copy=function(){for(var c=new Array(this._geometries.length).fill(null),d=0;d<c.length;d++)c[d]=this._geometries[d].copy();return new i(c,this._factory)},i.prototype.isEmpty=function(){for(var c=0;c<this._geometries.length;c++)if(!this._geometries[c].isEmpty())return!1;return!0},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},a.serialVersionUID.get=function(){return-5694727726395021e3},Object.defineProperties(i,a),i}(Vt),bi=function(r){function i(){r.apply(this,arguments)}r&&(i.__proto__=r),(i.prototype=Object.create(r&&r.prototype)).constructor=i;var a={serialVersionUID:{configurable:!0}};return i.prototype.getSortIndex=function(){return Vt.SORTINDEX_MULTILINESTRING},i.prototype.equalsExact=function(){if(arguments.length===2){var c=arguments[0],d=arguments[1];return!!this.isEquivalentClass(c)&&r.prototype.equalsExact.call(this,c,d)}return r.prototype.equalsExact.apply(this,arguments)},i.prototype.getBoundaryDimension=function(){return this.isClosed()?Ie.FALSE:0},i.prototype.isClosed=function(){if(this.isEmpty())return!1;for(var c=0;c<this._geometries.length;c++)if(!this._geometries[c].isClosed())return!1;return!0},i.prototype.getDimension=function(){return 1},i.prototype.reverse=function(){for(var c=this._geometries.length,d=new Array(c).fill(null),_=0;_<this._geometries.length;_++)d[c-1-_]=this._geometries[_].reverse();return this.getFactory().createMultiLineString(d)},i.prototype.getBoundary=function(){return new oi(this).getBoundary()},i.prototype.getGeometryType=function(){return"MultiLineString"},i.prototype.copy=function(){for(var c=new Array(this._geometries.length).fill(null),d=0;d<c.length;d++)c[d]=this._geometries[d].copy();return new i(c,this._factory)},i.prototype.interfaces_=function(){return[wr]},i.prototype.getClass=function(){return i},a.serialVersionUID.get=function(){return 8166665132445434e3},Object.defineProperties(i,a),i}(Qn),oi=function(){if(this._geom=null,this._geomFact=null,this._bnRule=null,this._endpointMap=null,arguments.length===1){var r=arguments[0],i=P.MOD2_BOUNDARY_RULE;this._geom=r,this._geomFact=r.getFactory(),this._bnRule=i}else if(arguments.length===2){var a=arguments[0],c=arguments[1];this._geom=a,this._geomFact=a.getFactory(),this._bnRule=c}};oi.prototype.boundaryMultiLineString=function(r){if(this._geom.isEmpty())return this.getEmptyMultiPoint();var i=this.computeBoundaryCoordinates(r);return i.length===1?this._geomFact.createPoint(i[0]):this._geomFact.createMultiPointFromCoords(i)},oi.prototype.getBoundary=function(){return this._geom instanceof vt?this.boundaryLineString(this._geom):this._geom instanceof bi?this.boundaryMultiLineString(this._geom):this._geom.getBoundary()},oi.prototype.boundaryLineString=function(r){return this._geom.isEmpty()?this.getEmptyMultiPoint():r.isClosed()?this._bnRule.isInBoundary(2)?r.getStartPoint():this._geomFact.createMultiPoint():this._geomFact.createMultiPoint([r.getStartPoint(),r.getEndPoint()])},oi.prototype.getEmptyMultiPoint=function(){return this._geomFact.createMultiPoint()},oi.prototype.computeBoundaryCoordinates=function(r){var i=new G;this._endpointMap=new w;for(var a=0;a<r.getNumGeometries();a++){var c=r.getGeometryN(a);c.getNumPoints()!==0&&(this.addEndpoint(c.getCoordinateN(0)),this.addEndpoint(c.getCoordinateN(c.getNumPoints()-1)))}for(var d=this._endpointMap.entrySet().iterator();d.hasNext();){var _=d.next(),M=_.getValue().count;this._bnRule.isInBoundary(M)&&i.add(_.getKey())}return lt.toCoordinateArray(i)},oi.prototype.addEndpoint=function(r){var i=this._endpointMap.get(r);i===null&&(i=new Z,this._endpointMap.put(r,i)),i.count++},oi.prototype.interfaces_=function(){return[]},oi.prototype.getClass=function(){return oi},oi.getBoundary=function(){if(arguments.length===1){var r=arguments[0];return new oi(r).getBoundary()}if(arguments.length===2){var i=arguments[0],a=arguments[1];return new oi(i,a).getBoundary()}};var Z=function(){this.count=null};Z.prototype.interfaces_=function(){return[]},Z.prototype.getClass=function(){return Z};var mt=function(){},It={NEWLINE:{configurable:!0},SIMPLE_ORDINATE_FORMAT:{configurable:!0}};mt.prototype.interfaces_=function(){return[]},mt.prototype.getClass=function(){return mt},mt.chars=function(r,i){for(var a=new Array(i).fill(null),c=0;c<i;c++)a[c]=r;return String(a)},mt.getStackTrace=function(){if(arguments.length===1){var r=arguments[0],i=new function(){},a=new function(){}(i);return r.printStackTrace(a),i.toString()}if(arguments.length===2){for(var c=arguments[0],d=arguments[1],_="",M=new function(){}(new function(){}(mt.getStackTrace(c))),L=0;L<d;L++)try{_+=M.readLine()+mt.NEWLINE}catch(H){if(!(H instanceof C))throw H;Wt.shouldNeverReachHere()}return _}},mt.split=function(r,i){for(var a=i.length,c=new G,d=""+r,_=d.indexOf(i);_>=0;){var M=d.substring(0,_);c.add(M),_=(d=d.substring(_+a)).indexOf(i)}d.length>0&&c.add(d);for(var L=new Array(c.size()).fill(null),H=0;H<L.length;H++)L[H]=c.get(H);return L},mt.toString=function(){if(arguments.length===1){var r=arguments[0];return mt.SIMPLE_ORDINATE_FORMAT.format(r)}},mt.spaces=function(r){return mt.chars(" ",r)},It.NEWLINE.get=function(){return te.getProperty("line.separator")},It.SIMPLE_ORDINATE_FORMAT.get=function(){return new function(){}("0.#")},Object.defineProperties(mt,It);var St=function(){};St.prototype.interfaces_=function(){return[]},St.prototype.getClass=function(){return St},St.copyCoord=function(r,i,a,c){for(var d=Math.min(r.getDimension(),a.getDimension()),_=0;_<d;_++)a.setOrdinate(c,_,r.getOrdinate(i,_))},St.isRing=function(r){var i=r.size();return i===0||!(i<=3)&&r.getOrdinate(0,ut.X)===r.getOrdinate(i-1,ut.X)&&r.getOrdinate(0,ut.Y)===r.getOrdinate(i-1,ut.Y)},St.isEqual=function(r,i){var a=r.size();if(a!==i.size())return!1;for(var c=Math.min(r.getDimension(),i.getDimension()),d=0;d<a;d++)for(var _=0;_<c;_++){var M=r.getOrdinate(d,_),L=i.getOrdinate(d,_);if(r.getOrdinate(d,_)!==i.getOrdinate(d,_)&&(!A.isNaN(M)||!A.isNaN(L)))return!1}return!0},St.extend=function(r,i,a){var c=r.create(a,i.getDimension()),d=i.size();if(St.copy(i,0,c,0,d),d>0)for(var _=d;_<a;_++)St.copy(i,d-1,c,_,1);return c},St.reverse=function(r){for(var i=r.size()-1,a=Math.trunc(i/2),c=0;c<=a;c++)St.swap(r,c,i-c)},St.swap=function(r,i,a){if(i===a)return null;for(var c=0;c<r.getDimension();c++){var d=r.getOrdinate(i,c);r.setOrdinate(i,c,r.getOrdinate(a,c)),r.setOrdinate(a,c,d)}},St.copy=function(r,i,a,c,d){for(var _=0;_<d;_++)St.copyCoord(r,i+_,a,c+_)},St.toString=function(){if(arguments.length===1){var r=arguments[0],i=r.size();if(i===0)return"()";var a=r.getDimension(),c=new Lt;c.append("(");for(var d=0;d<i;d++){d>0&&c.append(" ");for(var _=0;_<a;_++)_>0&&c.append(","),c.append(mt.toString(r.getOrdinate(d,_)))}return c.append(")"),c.toString()}},St.ensureValidRing=function(r,i){var a=i.size();return a===0?i:a<=3?St.createClosedRing(r,i,4):i.getOrdinate(0,ut.X)===i.getOrdinate(a-1,ut.X)&&i.getOrdinate(0,ut.Y)===i.getOrdinate(a-1,ut.Y)?i:St.createClosedRing(r,i,a+1)},St.createClosedRing=function(r,i,a){var c=r.create(a,i.getDimension()),d=i.size();St.copy(i,0,c,0,d);for(var _=d;_<a;_++)St.copy(i,0,c,_,1);return c};var vt=function(r){function i(c,d){r.call(this,d),this._points=null,this.init(c)}r&&(i.__proto__=r),(i.prototype=Object.create(r&&r.prototype)).constructor=i;var a={serialVersionUID:{configurable:!0}};return i.prototype.computeEnvelopeInternal=function(){return this.isEmpty()?new qt:this._points.expandEnvelope(new qt)},i.prototype.isRing=function(){return this.isClosed()&&this.isSimple()},i.prototype.getSortIndex=function(){return r.SORTINDEX_LINESTRING},i.prototype.getCoordinates=function(){return this._points.toCoordinateArray()},i.prototype.equalsExact=function(){if(arguments.length===2){var c=arguments[0],d=arguments[1];if(!this.isEquivalentClass(c))return!1;var _=c;if(this._points.size()!==_._points.size())return!1;for(var M=0;M<this._points.size();M++)if(!this.equal(this._points.getCoordinate(M),_._points.getCoordinate(M),d))return!1;return!0}return r.prototype.equalsExact.apply(this,arguments)},i.prototype.normalize=function(){for(var c=0;c<Math.trunc(this._points.size()/2);c++){var d=this._points.size()-1-c;if(!this._points.getCoordinate(c).equals(this._points.getCoordinate(d)))return this._points.getCoordinate(c).compareTo(this._points.getCoordinate(d))>0&&St.reverse(this._points),null}},i.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},i.prototype.getBoundaryDimension=function(){return this.isClosed()?Ie.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 dt.computeLength(this._points)},i.prototype.getNumPoints=function(){return this._points.size()},i.prototype.reverse=function(){var c=this._points.copy();return St.reverse(c),this.getFactory().createLineString(c)},i.prototype.compareToSameClass=function(){if(arguments.length===1){for(var c=arguments[0],d=0,_=0;d<this._points.size()&&_<c._points.size();){var M=this._points.getCoordinate(d).compareTo(c._points.getCoordinate(_));if(M!==0)return M;d++,_++}return d<this._points.size()?1:_<c._points.size()?-1:0}if(arguments.length===2){var L=arguments[0];return arguments[1].compare(this._points,L._points)}},i.prototype.apply=function(){if(Q(arguments[0],rt))for(var c=arguments[0],d=0;d<this._points.size();d++)c.filter(this._points.getCoordinate(d));else if(Q(arguments[0],ur)){var _=arguments[0];if(this._points.size()===0)return null;for(var M=0;M<this._points.size()&&(_.filter(this._points,M),!_.isDone());M++);_.isGeometryChanged()&&this.geometryChanged()}else Q(arguments[0],pr)?arguments[0].filter(this):Q(arguments[0],Ce)&&arguments[0].filter(this)},i.prototype.getBoundary=function(){return new oi(this).getBoundary()},i.prototype.isEquivalentClass=function(c){return c instanceof i},i.prototype.clone=function(){var c=r.prototype.clone.call(this);return c._points=this._points.clone(),c},i.prototype.getCoordinateN=function(c){return this._points.getCoordinate(c)},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(c){if(c===null&&(c=this.getFactory().getCoordinateSequenceFactory().create([])),c.size()===1)throw new I("Invalid number of points in LineString (found "+c.size()+" - must be 0 or >= 2)");this._points=c},i.prototype.isCoordinate=function(c){for(var d=0;d<this._points.size();d++)if(this._points.getCoordinate(d).equals(c))return!0;return!1},i.prototype.getStartPoint=function(){return this.isEmpty()?null:this.getPointN(0)},i.prototype.getPointN=function(c){return this.getFactory().createPoint(this._points.getCoordinate(c))},i.prototype.interfaces_=function(){return[wr]},i.prototype.getClass=function(){return i},a.serialVersionUID.get=function(){return 0x2b2b51ba435c8e00},Object.defineProperties(i,a),i}(Vt),he=function(){};he.prototype.interfaces_=function(){return[]},he.prototype.getClass=function(){return he};var ue=function(r){function i(c,d){r.call(this,d),this._coordinates=c||null,this.init(this._coordinates)}r&&(i.__proto__=r),(i.prototype=Object.create(r&&r.prototype)).constructor=i;var a={serialVersionUID:{configurable:!0}};return i.prototype.computeEnvelopeInternal=function(){if(this.isEmpty())return new qt;var c=new qt;return c.expandToInclude(this._coordinates.getX(0),this._coordinates.getY(0)),c},i.prototype.getSortIndex=function(){return r.SORTINDEX_POINT},i.prototype.getCoordinates=function(){return this.isEmpty()?[]:[this.getCoordinate()]},i.prototype.equalsExact=function(){if(arguments.length===2){var c=arguments[0],d=arguments[1];return!!this.isEquivalentClass(c)&&(!(!this.isEmpty()||!c.isEmpty())||this.isEmpty()===c.isEmpty()&&this.equal(c.getCoordinate(),this.getCoordinate(),d))}return r.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 Ie.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 c=arguments[0];return this.getCoordinate().compareTo(c.getCoordinate())}if(arguments.length===2){var d=arguments[0];return arguments[1].compare(this._coordinates,d._coordinates)}},i.prototype.apply=function(){if(Q(arguments[0],rt)){var c=arguments[0];if(this.isEmpty())return null;c.filter(this.getCoordinate())}else if(Q(arguments[0],ur)){var d=arguments[0];if(this.isEmpty())return null;d.filter(this._coordinates,0),d.isGeometryChanged()&&this.geometryChanged()}else Q(arguments[0],pr)?arguments[0].filter(this):Q(arguments[0],Ce)&&arguments[0].filter(this)},i.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},i.prototype.clone=function(){var c=r.prototype.clone.call(this);return c._coordinates=this._coordinates.clone(),c},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(c){c===null&&(c=this.getFactory().getCoordinateSequenceFactory().create([])),Wt.isTrue(c.size()<=1),this._coordinates=c},i.prototype.isSimple=function(){return!0},i.prototype.interfaces_=function(){return[he]},i.prototype.getClass=function(){return i},a.serialVersionUID.get=function(){return 4902022702746615e3},Object.defineProperties(i,a),i}(Vt),we=function(){};we.prototype.interfaces_=function(){return[]},we.prototype.getClass=function(){return we};var de=function(r){function i(c,d,_){if(r.call(this,_),this._shell=null,this._holes=null,c===null&&(c=this.getFactory().createLinearRing()),d===null&&(d=[]),r.hasNullElements(d))throw new I("holes must not contain null elements");if(c.isEmpty()&&r.hasNonEmptyElements(d))throw new I("shell is empty but holes are not");this._shell=c,this._holes=d}r&&(i.__proto__=r),(i.prototype=Object.create(r&&r.prototype)).constructor=i;var a={serialVersionUID:{configurable:!0}};return i.prototype.computeEnvelopeInternal=function(){return this._shell.getEnvelopeInternal()},i.prototype.getSortIndex=function(){return r.SORTINDEX_POLYGON},i.prototype.getCoordinates=function(){if(this.isEmpty())return[];for(var c=new Array(this.getNumPoints()).fill(null),d=-1,_=this._shell.getCoordinates(),M=0;M<_.length;M++)c[++d]=_[M];for(var L=0;L<this._holes.length;L++)for(var H=this._holes[L].getCoordinates(),it=0;it<H.length;it++)c[++d]=H[it];return c},i.prototype.getArea=function(){var c=0;c+=Math.abs(dt.signedArea(this._shell.getCoordinateSequence()));for(var d=0;d<this._holes.length;d++)c-=Math.abs(dt.signedArea(this._holes[d].getCoordinateSequence()));return c},i.prototype.isRectangle=function(){if(this.getNumInteriorRing()!==0||this._shell===null||this._shell.getNumPoints()!==5)return!1;for(var c=this._shell.getCoordinateSequence(),d=this.getEnvelopeInternal(),_=0;_<5;_++){var M=c.getX(_);if(M!==d.getMinX()&&M!==d.getMaxX())return!1;var L=c.getY(_);if(L!==d.getMinY()&&L!==d.getMaxY())return!1}for(var H=c.getX(0),it=c.getY(0),bt=1;bt<=4;bt++){var Tt=c.getX(bt),Kt=c.getY(bt);if(Tt!==H==(Kt!==it))return!1;H=Tt,it=Kt}return!0},i.prototype.equalsExact=function(){if(arguments.length===2){var c=arguments[0],d=arguments[1];if(!this.isEquivalentClass(c))return!1;var _=c,M=this._shell,L=_._shell;if(!M.equalsExact(L,d)||this._holes.length!==_._holes.length)return!1;for(var H=0;H<this._holes.length;H++)if(!this._holes[H].equalsExact(_._holes[H],d))return!1;return!0}return r.prototype.equalsExact.apply(this,arguments)},i.prototype.normalize=function(){if(arguments.length===0){this.normalize(this._shell,!0);for(var c=0;c<this._holes.length;c++)this.normalize(this._holes[c],!1);nr.sort(this._holes)}else if(arguments.length===2){var d=arguments[0],_=arguments[1];if(d.isEmpty())return null;var M=new Array(d.getCoordinates().length-1).fill(null);te.arraycopy(d.getCoordinates(),0,M,0,M.length);var L=lt.minCoordinate(d.getCoordinates());lt.scroll(M,L),te.arraycopy(M,0,d.getCoordinates(),0,M.length),d.getCoordinates()[M.length]=M[0],dt.isCCW(d.getCoordinates())===_&&lt.reverse(d.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 c=0;c+=this._shell.getLength();for(var d=0;d<this._holes.length;d++)c+=this._holes[d].getLength();return c},i.prototype.getNumPoints=function(){for(var c=this._shell.getNumPoints(),d=0;d<this._holes.length;d++)c+=this._holes[d].getNumPoints();return c},i.prototype.reverse=function(){var c=this.copy();c._shell=this._shell.copy().reverse(),c._holes=new Array(this._holes.length).fill(null);for(var d=0;d<this._holes.length;d++)c._holes[d]=this._holes[d].copy().reverse();return c},i.prototype.convexHull=function(){return this.getExteriorRing().convexHull()},i.prototype.compareToSameClass=function(){if(arguments.length===1){var c=arguments[0],d=this._shell,_=c._shell;return d.compareToSameClass(_)}if(arguments.length===2){var M=arguments[0],L=arguments[1],H=M,it=this._shell,bt=H._shell,Tt=it.compareToSameClass(bt,L);if(Tt!==0)return Tt;for(var Kt=this.getNumInteriorRing(),Qt=H.getNumInteriorRing(),le=0;le<Kt&&le<Qt;){var Ee=this.getInteriorRingN(le),Dn=H.getInteriorRingN(le),Jn=Ee.compareToSameClass(Dn,L);if(Jn!==0)return Jn;le++}return le<Kt?1:le<Qt?-1:0}},i.prototype.apply=function(c){if(Q(c,rt)){this._shell.apply(c);for(var d=0;d<this._holes.length;d++)this._holes[d].apply(c)}else if(Q(c,ur)){if(this._shell.apply(c),!c.isDone())for(var _=0;_<this._holes.length&&(this._holes[_].apply(c),!c.isDone());_++);c.isGeometryChanged()&&this.geometryChanged()}else if(Q(c,pr))c.filter(this);else if(Q(c,Ce)){c.filter(this),this._shell.apply(c);for(var M=0;M<this._holes.length;M++)this._holes[M].apply(c)}},i.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();var c=new Array(this._holes.length+1).fill(null);c[0]=this._shell;for(var d=0;d<this._holes.length;d++)c[d+1]=this._holes[d];return c.length<=1?this.getFactory().createLinearRing(c[0].getCoordinateSequence()):this.getFactory().createMultiLineString(c)},i.prototype.clone=function(){var c=r.prototype.clone.call(this);c._shell=this._shell.clone(),c._holes=new Array(this._holes.length).fill(null);for(var d=0;d<this._holes.length;d++)c._holes[d]=this._holes[d].clone();return c},i.prototype.getGeometryType=function(){return"Polygon"},i.prototype.copy=function(){for(var c=this._shell.copy(),d=new Array(this._holes.length).fill(null),_=0;_<d.length;_++)d[_]=this._holes[_].copy();return new i(c,d,this._factory)},i.prototype.getExteriorRing=function(){return this._shell},i.prototype.isEmpty=function(){return this._shell.isEmpty()},i.prototype.getInteriorRingN=function(c){return this._holes[c]},i.prototype.interfaces_=function(){return[we]},i.prototype.getClass=function(){return i},a.serialVersionUID.get=function(){return-0x307ffefd8dc97200},Object.defineProperties(i,a),i}(Vt),Be=function(r){function i(){r.apply(this,arguments)}r&&(i.__proto__=r),(i.prototype=Object.create(r&&r.prototype)).constructor=i;var a={serialVersionUID:{configurable:!0}};return i.prototype.getSortIndex=function(){return Vt.SORTINDEX_MULTIPOINT},i.prototype.isValid=function(){return!0},i.prototype.equalsExact=function(){if(arguments.length===2){var c=arguments[0],d=arguments[1];return!!this.isEquivalentClass(c)&&r.prototype.equalsExact.call(this,c,d)}return r.prototype.equalsExact.apply(this,arguments)},i.prototype.getCoordinate=function(){if(arguments.length===1){var c=arguments[0];return this._geometries[c].getCoordinate()}return r.prototype.getCoordinate.apply(this,arguments)},i.prototype.getBoundaryDimension=function(){return Ie.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 c=new Array(this._geometries.length).fill(null),d=0;d<c.length;d++)c[d]=this._geometries[d].copy();return new i(c,this._factory)},i.prototype.interfaces_=function(){return[he]},i.prototype.getClass=function(){return i},a.serialVersionUID.get=function(){return-8048474874175356e3},Object.defineProperties(i,a),i}(Qn),Ae=function(r){function i(c,d){c instanceof D&&d instanceof Le&&(c=d.getCoordinateSequenceFactory().create(c)),r.call(this,c,d),this.validateConstruction()}r&&(i.__proto__=r),(i.prototype=Object.create(r&&r.prototype)).constructor=i;var a={MINIMUM_VALID_SIZE:{configurable:!0},serialVersionUID:{configurable:!0}};return i.prototype.getSortIndex=function(){return Vt.SORTINDEX_LINEARRING},i.prototype.getBoundaryDimension=function(){return Ie.FALSE},i.prototype.isClosed=function(){return!!this.isEmpty()||r.prototype.isClosed.call(this)},i.prototype.reverse=function(){var c=this._points.copy();return St.reverse(c),this.getFactory().createLinearRing(c)},i.prototype.validateConstruction=function(){if(!this.isEmpty()&&!r.prototype.isClosed.call(this))throw new I("Points of LinearRing do not form a closed linestring");if(this.getCoordinateSequence().size()>=1&&this.getCoordinateSequence().size()<i.MINIMUM_VALID_SIZE)throw new I("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},a.MINIMUM_VALID_SIZE.get=function(){return 4},a.serialVersionUID.get=function(){return-0x3b229e262367a600},Object.defineProperties(i,a),i}(vt),Pe=function(r){function i(){r.apply(this,arguments)}r&&(i.__proto__=r),(i.prototype=Object.create(r&&r.prototype)).constructor=i;var a={serialVersionUID:{configurable:!0}};return i.prototype.getSortIndex=function(){return Vt.SORTINDEX_MULTIPOLYGON},i.prototype.equalsExact=function(){if(arguments.length===2){var c=arguments[0],d=arguments[1];return!!this.isEquivalentClass(c)&&r.prototype.equalsExact.call(this,c,d)}return r.prototype.equalsExact.apply(this,arguments)},i.prototype.getBoundaryDimension=function(){return 1},i.prototype.getDimension=function(){return 2},i.prototype.reverse=function(){for(var c=this._geometries.length,d=new Array(c).fill(null),_=0;_<this._geometries.length;_++)d[_]=this._geometries[_].reverse();return this.getFactory().createMultiPolygon(d)},i.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();for(var c=new G,d=0;d<this._geometries.length;d++)for(var _=this._geometries[d].getBoundary(),M=0;M<_.getNumGeometries();M++)c.add(_.getGeometryN(M));var L=new Array(c.size()).fill(null);return this.getFactory().createMultiLineString(c.toArray(L))},i.prototype.getGeometryType=function(){return"MultiPolygon"},i.prototype.copy=function(){for(var c=new Array(this._geometries.length).fill(null),d=0;d<c.length;d++)c[d]=this._geometries[d].copy();return new i(c,this._factory)},i.prototype.interfaces_=function(){return[we]},i.prototype.getClass=function(){return i},a.serialVersionUID.get=function(){return-0x7a5aa1369171980},Object.defineProperties(i,a),i}(Qn),rn=function(r){this._factory=r||null,this._isUserDataCopied=!1},si={NoOpGeometryOperation:{configurable:!0},CoordinateOperation:{configurable:!0},CoordinateSequenceOperation:{configurable:!0}};rn.prototype.setCopyUserData=function(r){this._isUserDataCopied=r},rn.prototype.edit=function(r,i){if(r===null)return null;var a=this.editInternal(r,i);return this._isUserDataCopied&&a.setUserData(r.getUserData()),a},rn.prototype.editInternal=function(r,i){return this._factory===null&&(this._factory=r.getFactory()),r instanceof Qn?this.editGeometryCollection(r,i):r instanceof de?this.editPolygon(r,i):r instanceof ue?i.edit(r,this._factory):r instanceof vt?i.edit(r,this._factory):(Wt.shouldNeverReachHere("Unsupported Geometry class: "+r.getClass().getName()),null)},rn.prototype.editGeometryCollection=function(r,i){for(var a=i.edit(r,this._factory),c=new G,d=0;d<a.getNumGeometries();d++){var _=this.edit(a.getGeometryN(d),i);_===null||_.isEmpty()||c.add(_)}return a.getClass()===Be?this._factory.createMultiPoint(c.toArray([])):a.getClass()===bi?this._factory.createMultiLineString(c.toArray([])):a.getClass()===Pe?this._factory.createMultiPolygon(c.toArray([])):this._factory.createGeometryCollection(c.toArray([]))},rn.prototype.editPolygon=function(r,i){var a=i.edit(r,this._factory);if(a===null&&(a=this._factory.createPolygon(null)),a.isEmpty())return a;var c=this.edit(a.getExteriorRing(),i);if(c===null||c.isEmpty())return this._factory.createPolygon();for(var d=new G,_=0;_<a.getNumInteriorRing();_++){var M=this.edit(a.getInteriorRingN(_),i);M===null||M.isEmpty()||d.add(M)}return this._factory.createPolygon(c,d.toArray([]))},rn.prototype.interfaces_=function(){return[]},rn.prototype.getClass=function(){return rn},rn.GeometryEditorOperation=function(){},si.NoOpGeometryOperation.get=function(){return br},si.CoordinateOperation.get=function(){return Wi},si.CoordinateSequenceOperation.get=function(){return sr},Object.defineProperties(rn,si);var br=function(){};br.prototype.edit=function(r,i){return r},br.prototype.interfaces_=function(){return[rn.GeometryEditorOperation]},br.prototype.getClass=function(){return br};var Wi=function(){};Wi.prototype.edit=function(r,i){var a=this.editCoordinates(r.getCoordinates(),r);return a===null?r:r instanceof Ae?i.createLinearRing(a):r instanceof vt?i.createLineString(a):r instanceof ue?a.length>0?i.createPoint(a[0]):i.createPoint():r},Wi.prototype.interfaces_=function(){return[rn.GeometryEditorOperation]},Wi.prototype.getClass=function(){return Wi};var sr=function(){};sr.prototype.edit=function(r,i){return r instanceof Ae?i.createLinearRing(this.edit(r.getCoordinateSequence(),r)):r instanceof vt?i.createLineString(this.edit(r.getCoordinateSequence(),r)):r instanceof ue?i.createPoint(this.edit(r.getCoordinateSequence(),r)):r},sr.prototype.interfaces_=function(){return[rn.GeometryEditorOperation]},sr.prototype.getClass=function(){return sr};var ye=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 r=arguments[0];this._coordinates=new Array(r).fill(null);for(var i=0;i<r;i++)this._coordinates[i]=new D}else if(Q(arguments[0],ut)){var a=arguments[0];if(a===null)return this._coordinates=new Array(0).fill(null),null;this._dimension=a.getDimension(),this._coordinates=new Array(a.size()).fill(null);for(var c=0;c<this._coordinates.length;c++)this._coordinates[c]=a.getCoordinateCopy(c)}}else if(arguments.length===2){if(arguments[0]instanceof Array&&Number.isInteger(arguments[1])){var d=arguments[0],_=arguments[1];this._coordinates=d,this._dimension=_,d===null&&(this._coordinates=new Array(0).fill(null))}else if(Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var M=arguments[0],L=arguments[1];this._coordinates=new Array(M).fill(null),this._dimension=L;for(var H=0;H<M;H++)this._coordinates[H]=new D}}},Da={serialVersionUID:{configurable:!0}};ye.prototype.setOrdinate=function(r,i,a){switch(i){case ut.X:this._coordinates[r].x=a;break;case ut.Y:this._coordinates[r].y=a;break;case ut.Z:this._coordinates[r].z=a;break;default:throw new I("invalid ordinateIndex")}},ye.prototype.size=function(){return this._coordinates.length},ye.prototype.getOrdinate=function(r,i){switch(i){case ut.X:return this._coordinates[r].x;case ut.Y:return this._coordinates[r].y;case ut.Z:return this._coordinates[r].z}return A.NaN},ye.prototype.getCoordinate=function(){if(arguments.length===1){var r=arguments[0];return this._coordinates[r]}if(arguments.length===2){var i=arguments[0],a=arguments[1];a.x=this._coordinates[i].x,a.y=this._coordinates[i].y,a.z=this._coordinates[i].z}},ye.prototype.getCoordinateCopy=function(r){return new D(this._coordinates[r])},ye.prototype.getDimension=function(){return this._dimension},ye.prototype.getX=function(r){return this._coordinates[r].x},ye.prototype.clone=function(){for(var r=new Array(this.size()).fill(null),i=0;i<this._coordinates.length;i++)r[i]=this._coordinates[i].clone();return new ye(r,this._dimension)},ye.prototype.expandEnvelope=function(r){for(var i=0;i<this._coordinates.length;i++)r.expandToInclude(this._coordinates[i]);return r},ye.prototype.copy=function(){for(var r=new Array(this.size()).fill(null),i=0;i<this._coordinates.length;i++)r[i]=this._coordinates[i].copy();return new ye(r,this._dimension)},ye.prototype.toString=function(){if(this._coordinates.length>0){var r=new Lt(17*this._coordinates.length);r.append("("),r.append(this._coordinates[0]);for(var i=1;i<this._coordinates.length;i++)r.append(", "),r.append(this._coordinates[i]);return r.append(")"),r.toString()}return"()"},ye.prototype.getY=function(r){return this._coordinates[r].y},ye.prototype.toCoordinateArray=function(){return this._coordinates},ye.prototype.interfaces_=function(){return[ut,t]},ye.prototype.getClass=function(){return ye},Da.serialVersionUID.get=function(){return-0xcb44a778db18e00},Object.defineProperties(ye,Da);var on=function(){},fo={serialVersionUID:{configurable:!0},instanceObject:{configurable:!0}};on.prototype.readResolve=function(){return on.instance()},on.prototype.create=function(){if(arguments.length===1){if(arguments[0]instanceof Array){var r=arguments[0];return new ye(r)}if(Q(arguments[0],ut)){var i=arguments[0];return new ye(i)}}else if(arguments.length===2){var a=arguments[0],c=arguments[1];return c>3&&(c=3),c<2?new ye(a):new ye(a,c)}},on.prototype.interfaces_=function(){return[j,t]},on.prototype.getClass=function(){return on},on.instance=function(){return on.instanceObject},fo.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00},fo.instanceObject.get=function(){return new on},Object.defineProperties(on,fo);var ul=function(r){function i(){r.call(this),this.map_=new Map}return r&&(i.__proto__=r),i.prototype=Object.create(r&&r.prototype),i.prototype.constructor=i,i.prototype.get=function(a){return this.map_.get(a)||null},i.prototype.put=function(a,c){return this.map_.set(a,c),c},i.prototype.values=function(){for(var a=new G,c=this.map_.values(),d=c.next();!d.done;)a.add(d.value),d=c.next();return a},i.prototype.entrySet=function(){var a=new Ue;return this.map_.entries().forEach(function(c){return a.add(c)}),a},i.prototype.size=function(){return this.map_.size()},i}(ve),ze=function r(){if(this._modelType=null,this._scale=null,arguments.length===0)this._modelType=r.FLOATING;else if(arguments.length===1){if(arguments[0]instanceof ir){var i=arguments[0];this._modelType=i,i===r.FIXED&&this.setScale(1)}else if(typeof arguments[0]=="number"){var a=arguments[0];this._modelType=r.FIXED,this.setScale(a)}else if(arguments[0]instanceof r){var c=arguments[0];this._modelType=c._modelType,this._scale=c._scale}}},ys={serialVersionUID:{configurable:!0},maximumPreciseValue:{configurable:!0}};ze.prototype.equals=function(r){if(!(r instanceof ze))return!1;var i=r;return this._modelType===i._modelType&&this._scale===i._scale},ze.prototype.compareTo=function(r){var i=r,a=this.getMaximumSignificantDigits(),c=i.getMaximumSignificantDigits();return new pt(a).compareTo(new pt(c))},ze.prototype.getScale=function(){return this._scale},ze.prototype.isFloating=function(){return this._modelType===ze.FLOATING||this._modelType===ze.FLOATING_SINGLE},ze.prototype.getType=function(){return this._modelType},ze.prototype.toString=function(){var r="UNKNOWN";return this._modelType===ze.FLOATING?r="Floating":this._modelType===ze.FLOATING_SINGLE?r="Floating-Single":this._modelType===ze.FIXED&&(r="Fixed (Scale="+this.getScale()+")"),r},ze.prototype.makePrecise=function(){if(typeof arguments[0]=="number"){var r=arguments[0];return A.isNaN(r)||this._modelType===ze.FLOATING_SINGLE?r:this._modelType===ze.FIXED?Math.round(r*this._scale)/this._scale:r}if(arguments[0]instanceof D){var i=arguments[0];if(this._modelType===ze.FLOATING)return null;i.x=this.makePrecise(i.x),i.y=this.makePrecise(i.y)}},ze.prototype.getMaximumSignificantDigits=function(){var r=16;return this._modelType===ze.FLOATING?r=16:this._modelType===ze.FLOATING_SINGLE?r=6:this._modelType===ze.FIXED&&(r=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),r},ze.prototype.setScale=function(r){this._scale=Math.abs(r)},ze.prototype.interfaces_=function(){return[t,V]},ze.prototype.getClass=function(){return ze},ze.mostPrecise=function(r,i){return r.compareTo(i)>=0?r:i},ys.serialVersionUID.get=function(){return 7777263578777804e3},ys.maximumPreciseValue.get=function(){return 9007199254740992},Object.defineProperties(ze,ys);var ir=function r(i){this._name=i||null,r.nameToTypeMap.put(i,this)},jo={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}};ir.prototype.readResolve=function(){return ir.nameToTypeMap.get(this._name)},ir.prototype.toString=function(){return this._name},ir.prototype.interfaces_=function(){return[t]},ir.prototype.getClass=function(){return ir},jo.serialVersionUID.get=function(){return-552860263173159e4},jo.nameToTypeMap.get=function(){return new ul},Object.defineProperties(ir,jo),ze.Type=ir,ze.FIXED=new ir("FIXED"),ze.FLOATING=new ir("FLOATING"),ze.FLOATING_SINGLE=new ir("FLOATING SINGLE");var Le=function r(){this._precisionModel=new ze,this._SRID=0,this._coordinateSequenceFactory=r.getDefaultCoordinateSequenceFactory(),arguments.length===0||(arguments.length===1?Q(arguments[0],j)?this._coordinateSequenceFactory=arguments[0]:arguments[0]instanceof ze&&(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]))},Ai={serialVersionUID:{configurable:!0}};Le.prototype.toGeometry=function(r){return r.isNull()?this.createPoint(null):r.getMinX()===r.getMaxX()&&r.getMinY()===r.getMaxY()?this.createPoint(new D(r.getMinX(),r.getMinY())):r.getMinX()===r.getMaxX()||r.getMinY()===r.getMaxY()?this.createLineString([new D(r.getMinX(),r.getMinY()),new D(r.getMaxX(),r.getMaxY())]):this.createPolygon(this.createLinearRing([new D(r.getMinX(),r.getMinY()),new D(r.getMinX(),r.getMaxY()),new D(r.getMaxX(),r.getMaxY()),new D(r.getMaxX(),r.getMinY()),new D(r.getMinX(),r.getMinY())]),null)},Le.prototype.createLineString=function(r){return r?r instanceof Array?new vt(this.getCoordinateSequenceFactory().create(r),this):Q(r,ut)?new vt(r,this):void 0:new vt(this.getCoordinateSequenceFactory().create([]),this)},Le.prototype.createMultiLineString=function(){if(arguments.length===0)return new bi(null,this);if(arguments.length===1){var r=arguments[0];return new bi(r,this)}},Le.prototype.buildGeometry=function(r){for(var i=null,a=!1,c=!1,d=r.iterator();d.hasNext();){var _=d.next(),M=_.getClass();i===null&&(i=M),M!==i&&(a=!0),_.isGeometryCollectionOrDerived()&&(c=!0)}if(i===null)return this.createGeometryCollection();if(a||c)return this.createGeometryCollection(Le.toGeometryArray(r));var L=r.iterator().next();if(r.size()>1){if(L instanceof de)return this.createMultiPolygon(Le.toPolygonArray(r));if(L instanceof vt)return this.createMultiLineString(Le.toLineStringArray(r));if(L instanceof ue)return this.createMultiPoint(Le.toPointArray(r));Wt.shouldNeverReachHere("Unhandled class: "+L.getClass().getName())}return L},Le.prototype.createMultiPointFromCoords=function(r){return this.createMultiPoint(r!==null?this.getCoordinateSequenceFactory().create(r):null)},Le.prototype.createPoint=function(){if(arguments.length===0)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof D){var r=arguments[0];return this.createPoint(r!==null?this.getCoordinateSequenceFactory().create([r]):null)}if(Q(arguments[0],ut)){var i=arguments[0];return new ue(i,this)}}},Le.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory},Le.prototype.createPolygon=function(){if(arguments.length===0)return new de(null,null,this);if(arguments.length===1){if(Q(arguments[0],ut)){var r=arguments[0];return this.createPolygon(this.createLinearRing(r))}if(arguments[0]instanceof Array){var i=arguments[0];return this.createPolygon(this.createLinearRing(i))}if(arguments[0]instanceof Ae){var a=arguments[0];return this.createPolygon(a,null)}}else if(arguments.length===2){var c=arguments[0],d=arguments[1];return new de(c,d,this)}},Le.prototype.getSRID=function(){return this._SRID},Le.prototype.createGeometryCollection=function(){if(arguments.length===0)return new Qn(null,this);if(arguments.length===1){var r=arguments[0];return new Qn(r,this)}},Le.prototype.createGeometry=function(r){return new rn(this).edit(r,{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 r=arguments[0];return this.createLinearRing(r!==null?this.getCoordinateSequenceFactory().create(r):null)}if(Q(arguments[0],ut)){var i=arguments[0];return new Ae(i,this)}}},Le.prototype.createMultiPolygon=function(){if(arguments.length===0)return new Pe(null,this);if(arguments.length===1){var r=arguments[0];return new Pe(r,this)}},Le.prototype.createMultiPoint=function(){if(arguments.length===0)return new Be(null,this);if(arguments.length===1){if(arguments[0]instanceof Array){var r=arguments[0];return new Be(r,this)}if(arguments[0]instanceof Array){var i=arguments[0];return this.createMultiPoint(i!==null?this.getCoordinateSequenceFactory().create(i):null)}if(Q(arguments[0],ut)){var a=arguments[0];if(a===null)return this.createMultiPoint(new Array(0).fill(null));for(var c=new Array(a.size()).fill(null),d=0;d<a.size();d++){var _=this.getCoordinateSequenceFactory().create(1,a.getDimension());St.copy(a,d,_,0,1),c[d]=this.createPoint(_)}return this.createMultiPoint(c)}}},Le.prototype.interfaces_=function(){return[t]},Le.prototype.getClass=function(){return Le},Le.toMultiPolygonArray=function(r){var i=new Array(r.size()).fill(null);return r.toArray(i)},Le.toGeometryArray=function(r){if(r===null)return null;var i=new Array(r.size()).fill(null);return r.toArray(i)},Le.getDefaultCoordinateSequenceFactory=function(){return on.instance()},Le.toMultiLineStringArray=function(r){var i=new Array(r.size()).fill(null);return r.toArray(i)},Le.toLineStringArray=function(r){var i=new Array(r.size()).fill(null);return r.toArray(i)},Le.toMultiPointArray=function(r){var i=new Array(r.size()).fill(null);return r.toArray(i)},Le.toLinearRingArray=function(r){var i=new Array(r.size()).fill(null);return r.toArray(i)},Le.toPointArray=function(r){var i=new Array(r.size()).fill(null);return r.toArray(i)},Le.toPolygonArray=function(r){var i=new Array(r.size()).fill(null);return r.toArray(i)},Le.createPointFromInternalCoord=function(r,i){return i.getPrecisionModel().makePrecise(r),i.getFactory().createPoint(r)},Ai.serialVersionUID.get=function(){return-6820524753094096e3},Object.defineProperties(Le,Ai);var Fa=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],mu=function(r){this.geometryFactory=r||new Le};mu.prototype.read=function(r){var i,a=(i=typeof r=="string"?JSON.parse(r):r).type;if(!Ti[a])throw new Error("Unknown GeoJSON type: "+i.type);return Fa.indexOf(a)!==-1?Ti[a].apply(this,[i.coordinates]):a==="GeometryCollection"?Ti[a].apply(this,[i.geometries]):Ti[a].apply(this,[i])},mu.prototype.write=function(r){var i=r.getGeometryType();if(!Po[i])throw new Error("Geometry is not supported");return Po[i].apply(this,[r])};var Ti={Feature:function(r){var i={};for(var a in r)i[a]=r[a];if(r.geometry){var c=r.geometry.type;if(!Ti[c])throw new Error("Unknown GeoJSON type: "+r.type);i.geometry=this.read(r.geometry)}return r.bbox&&(i.bbox=Ti.bbox.apply(this,[r.bbox])),i},FeatureCollection:function(r){var i={};if(r.features){i.features=[];for(var a=0;a<r.features.length;++a)i.features.push(this.read(r.features[a]))}return r.bbox&&(i.bbox=this.parse.bbox.apply(this,[r.bbox])),i},coordinates:function(r){for(var i=[],a=0;a<r.length;++a){var c=r[a];i.push(new D(c[0],c[1]))}return i},bbox:function(r){return this.geometryFactory.createLinearRing([new D(r[0],r[1]),new D(r[2],r[1]),new D(r[2],r[3]),new D(r[0],r[3]),new D(r[0],r[1])])},Point:function(r){var i=new D(r[0],r[1]);return this.geometryFactory.createPoint(i)},MultiPoint:function(r){for(var i=[],a=0;a<r.length;++a)i.push(Ti.Point.apply(this,[r[a]]));return this.geometryFactory.createMultiPoint(i)},LineString:function(r){var i=Ti.coordinates.apply(this,[r]);return this.geometryFactory.createLineString(i)},MultiLineString:function(r){for(var i=[],a=0;a<r.length;++a)i.push(Ti.LineString.apply(this,[r[a]]));return this.geometryFactory.createMultiLineString(i)},Polygon:function(r){for(var i=Ti.coordinates.apply(this,[r[0]]),a=this.geometryFactory.createLinearRing(i),c=[],d=1;d<r.length;++d){var _=r[d],M=Ti.coordinates.apply(this,[_]),L=this.geometryFactory.createLinearRing(M);c.push(L)}return this.geometryFactory.createPolygon(a,c)},MultiPolygon:function(r){for(var i=[],a=0;a<r.length;++a){var c=r[a];i.push(Ti.Polygon.apply(this,[c]))}return this.geometryFactory.createMultiPolygon(i)},GeometryCollection:function(r){for(var i=[],a=0;a<r.length;++a){var c=r[a];i.push(this.read(c))}return this.geometryFactory.createGeometryCollection(i)}},Po={coordinate:function(r){return[r.x,r.y]},Point:function(r){return{type:"Point",coordinates:Po.coordinate.apply(this,[r.getCoordinate()])}},MultiPoint:function(r){for(var i=[],a=0;a<r._geometries.length;++a){var c=r._geometries[a],d=Po.Point.apply(this,[c]);i.push(d.coordinates)}return{type:"MultiPoint",coordinates:i}},LineString:function(r){for(var i=[],a=r.getCoordinates(),c=0;c<a.length;++c){var d=a[c];i.push(Po.coordinate.apply(this,[d]))}return{type:"LineString",coordinates:i}},MultiLineString:function(r){for(var i=[],a=0;a<r._geometries.length;++a){var c=r._geometries[a],d=Po.LineString.apply(this,[c]);i.push(d.coordinates)}return{type:"MultiLineString",coordinates:i}},Polygon:function(r){var i=[],a=Po.LineString.apply(this,[r._shell]);i.push(a.coordinates);for(var c=0;c<r._holes.length;++c){var d=r._holes[c],_=Po.LineString.apply(this,[d]);i.push(_.coordinates)}return{type:"Polygon",coordinates:i}},MultiPolygon:function(r){for(var i=[],a=0;a<r._geometries.length;++a){var c=r._geometries[a],d=Po.Polygon.apply(this,[c]);i.push(d.coordinates)}return{type:"MultiPolygon",coordinates:i}},GeometryCollection:function(r){for(var i=[],a=0;a<r._geometries.length;++a){var c=r._geometries[a],d=c.getGeometryType();i.push(Po[d].apply(this,[c]))}return{type:"GeometryCollection",geometries:i}}},ll=function(r){this.geometryFactory=r||new Le,this.precisionModel=this.geometryFactory.getPrecisionModel(),this.parser=new mu(this.geometryFactory)};ll.prototype.read=function(r){var i=this.parser.read(r);return this.precisionModel.getType()===ze.FIXED&&this.reducePrecision(i),i},ll.prototype.reducePrecision=function(r){var i,a;if(r.coordinate)this.precisionModel.makePrecise(r.coordinate);else if(r.points)for(i=0,a=r.points.length;i<a;i++)this.precisionModel.makePrecise(r.points[i]);else if(r.geometries)for(i=0,a=r.geometries.length;i<a;i++)this.reducePrecision(r.geometries[i])};var Ua=function(){this.parser=new mu(this.geometryFactory)};Ua.prototype.write=function(r){return this.parser.write(r)};var Xt=function(){},cl={ON:{configurable:!0},LEFT:{configurable:!0},RIGHT:{configurable:!0}};Xt.prototype.interfaces_=function(){return[]},Xt.prototype.getClass=function(){return Xt},Xt.opposite=function(r){return r===Xt.LEFT?Xt.RIGHT:r===Xt.RIGHT?Xt.LEFT:r},cl.ON.get=function(){return 0},cl.LEFT.get=function(){return 1},cl.RIGHT.get=function(){return 2},Object.defineProperties(Xt,cl),(R.prototype=new Error).name="EmptyStackException",(x.prototype=new Et).add=function(r){return this.array_.push(r),!0},x.prototype.get=function(r){if(r<0||r>=this.size())throw new Error;return this.array_[r]},x.prototype.push=function(r){return this.array_.push(r),r},x.prototype.pop=function(r){if(this.array_.length===0)throw new R;return this.array_.pop()},x.prototype.peek=function(){if(this.array_.length===0)throw new R;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(r){return this.array_.indexOf(r)},x.prototype.size=function(){return this.array_.length},x.prototype.toArray=function(){for(var r=[],i=0,a=this.array_.length;i<a;i++)r.push(this.array_[i]);return r};var Io=function(){this._minIndex=-1,this._minCoord=null,this._minDe=null,this._orientedDe=null};Io.prototype.getCoordinate=function(){return this._minCoord},Io.prototype.getRightmostSide=function(r,i){var a=this.getRightmostSideOfSegment(r,i);return a<0&&(a=this.getRightmostSideOfSegment(r,i-1)),a<0&&(this._minCoord=null,this.checkForRightmostCoordinate(r)),a},Io.prototype.findRightmostEdgeAtVertex=function(){var r=this._minDe.getEdge().getCoordinates();Wt.isTrue(this._minIndex>0&&this._minIndex<r.length,"rightmost point expected to be interior vertex of edge");var i=r[this._minIndex-1],a=r[this._minIndex+1],c=dt.computeOrientation(this._minCoord,a,i),d=!1;(i.y<this._minCoord.y&&a.y<this._minCoord.y&&c===dt.COUNTERCLOCKWISE||i.y>this._minCoord.y&&a.y>this._minCoord.y&&c===dt.CLOCKWISE)&&(d=!0),d&&(this._minIndex=this._minIndex-1)},Io.prototype.getRightmostSideOfSegment=function(r,i){var a=r.getEdge().getCoordinates();if(i<0||i+1>=a.length||a[i].y===a[i+1].y)return-1;var c=Xt.LEFT;return a[i].y<a[i+1].y&&(c=Xt.RIGHT),c},Io.prototype.getEdge=function(){return this._orientedDe},Io.prototype.checkForRightmostCoordinate=function(r){for(var i=r.getEdge().getCoordinates(),a=0;a<i.length-1;a++)(this._minCoord===null||i[a].x>this._minCoord.x)&&(this._minDe=r,this._minIndex=a,this._minCoord=i[a])},Io.prototype.findRightmostEdgeAtNode=function(){var r=this._minDe.getNode().getEdges();this._minDe=r.getRightmostEdge(),this._minDe.isForward()||(this._minDe=this._minDe.getSym(),this._minIndex=this._minDe.getEdge().getCoordinates().length-1)},Io.prototype.findEdge=function(r){for(var i=r.iterator();i.hasNext();){var a=i.next();a.isForward()&&this.checkForRightmostCoordinate(a)}Wt.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)===Xt.LEFT&&(this._orientedDe=this._minDe.getSym())},Io.prototype.interfaces_=function(){return[]},Io.prototype.getClass=function(){return Io};var Qo=function(r){function i(a,c){r.call(this,i.msgWithCoord(a,c)),this.pt=c?new D(c):null,this.name="TopologyException"}return r&&(i.__proto__=r),i.prototype=Object.create(r&&r.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(a,c){return c?a:a+" [ "+c+" ]"},i}(Te),fl=function(){this.array_=[]};fl.prototype.addLast=function(r){this.array_.push(r)},fl.prototype.removeFirst=function(){return this.array_.shift()},fl.prototype.isEmpty=function(){return this.array_.length===0};var Jr=function(){this._finder=null,this._dirEdgeList=new G,this._nodes=new G,this._rightMostCoord=null,this._env=null,this._finder=new Io};Jr.prototype.clearVisitedEdges=function(){for(var r=this._dirEdgeList.iterator();r.hasNext();)r.next().setVisited(!1)},Jr.prototype.getRightmostCoordinate=function(){return this._rightMostCoord},Jr.prototype.computeNodeDepth=function(r){for(var i=null,a=r.getEdges().iterator();a.hasNext();){var c=a.next();if(c.isVisited()||c.getSym().isVisited()){i=c;break}}if(i===null)throw new Qo("unable to find edge to compute depths at "+r.getCoordinate());r.getEdges().computeDepths(i);for(var d=r.getEdges().iterator();d.hasNext();){var _=d.next();_.setVisited(!0),this.copySymDepths(_)}},Jr.prototype.computeDepth=function(r){this.clearVisitedEdges();var i=this._finder.getEdge();i.setEdgeDepths(Xt.RIGHT,r),this.copySymDepths(i),this.computeDepths(i)},Jr.prototype.create=function(r){this.addReachable(r),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()},Jr.prototype.findResultEdges=function(){for(var r=this._dirEdgeList.iterator();r.hasNext();){var i=r.next();i.getDepth(Xt.RIGHT)>=1&&i.getDepth(Xt.LEFT)<=0&&!i.isInteriorAreaEdge()&&i.setInResult(!0)}},Jr.prototype.computeDepths=function(r){var i=new Ue,a=new fl,c=r.getNode();for(a.addLast(c),i.add(c),r.setVisited(!0);!a.isEmpty();){var d=a.removeFirst();i.add(d),this.computeNodeDepth(d);for(var _=d.getEdges().iterator();_.hasNext();){var M=_.next().getSym();if(!M.isVisited()){var L=M.getNode();i.contains(L)||(a.addLast(L),i.add(L))}}}},Jr.prototype.compareTo=function(r){var i=r;return this._rightMostCoord.x<i._rightMostCoord.x?-1:this._rightMostCoord.x>i._rightMostCoord.x?1:0},Jr.prototype.getEnvelope=function(){if(this._env===null){for(var r=new qt,i=this._dirEdgeList.iterator();i.hasNext();)for(var a=i.next().getEdge().getCoordinates(),c=0;c<a.length-1;c++)r.expandToInclude(a[c]);this._env=r}return this._env},Jr.prototype.addReachable=function(r){var i=new x;for(i.add(r);!i.empty();){var a=i.pop();this.add(a,i)}},Jr.prototype.copySymDepths=function(r){var i=r.getSym();i.setDepth(Xt.LEFT,r.getDepth(Xt.RIGHT)),i.setDepth(Xt.RIGHT,r.getDepth(Xt.LEFT))},Jr.prototype.add=function(r,i){r.setVisited(!0),this._nodes.add(r);for(var a=r.getEdges().iterator();a.hasNext();){var c=a.next();this._dirEdgeList.add(c);var d=c.getSym().getNode();d.isVisited()||i.push(d)}},Jr.prototype.getNodes=function(){return this._nodes},Jr.prototype.getDirectedEdges=function(){return this._dirEdgeList},Jr.prototype.interfaces_=function(){return[V]},Jr.prototype.getClass=function(){return Jr};var Zn=function r(){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 a=arguments[0];this.init(1),this.location[Xt.ON]=a}else if(arguments[0]instanceof r){var c=arguments[0];if(this.init(c.location.length),c!==null)for(var d=0;d<this.location.length;d++)this.location[d]=c.location[d]}}else if(arguments.length===3){var _=arguments[0],M=arguments[1],L=arguments[2];this.init(3),this.location[Xt.ON]=_,this.location[Xt.LEFT]=M,this.location[Xt.RIGHT]=L}};Zn.prototype.setAllLocations=function(r){for(var i=0;i<this.location.length;i++)this.location[i]=r},Zn.prototype.isNull=function(){for(var r=0;r<this.location.length;r++)if(this.location[r]!==K.NONE)return!1;return!0},Zn.prototype.setAllLocationsIfNull=function(r){for(var i=0;i<this.location.length;i++)this.location[i]===K.NONE&&(this.location[i]=r)},Zn.prototype.isLine=function(){return this.location.length===1},Zn.prototype.merge=function(r){if(r.location.length>this.location.length){var i=new Array(3).fill(null);i[Xt.ON]=this.location[Xt.ON],i[Xt.LEFT]=K.NONE,i[Xt.RIGHT]=K.NONE,this.location=i}for(var a=0;a<this.location.length;a++)this.location[a]===K.NONE&&a<r.location.length&&(this.location[a]=r.location[a])},Zn.prototype.getLocations=function(){return this.location},Zn.prototype.flip=function(){if(this.location.length<=1)return null;var r=this.location[Xt.LEFT];this.location[Xt.LEFT]=this.location[Xt.RIGHT],this.location[Xt.RIGHT]=r},Zn.prototype.toString=function(){var r=new Lt;return this.location.length>1&&r.append(K.toLocationSymbol(this.location[Xt.LEFT])),r.append(K.toLocationSymbol(this.location[Xt.ON])),this.location.length>1&&r.append(K.toLocationSymbol(this.location[Xt.RIGHT])),r.toString()},Zn.prototype.setLocations=function(r,i,a){this.location[Xt.ON]=r,this.location[Xt.LEFT]=i,this.location[Xt.RIGHT]=a},Zn.prototype.get=function(r){return r<this.location.length?this.location[r]:K.NONE},Zn.prototype.isArea=function(){return this.location.length>1},Zn.prototype.isAnyNull=function(){for(var r=0;r<this.location.length;r++)if(this.location[r]===K.NONE)return!0;return!1},Zn.prototype.setLocation=function(){if(arguments.length===1){var r=arguments[0];this.setLocation(Xt.ON,r)}else if(arguments.length===2){var i=arguments[0],a=arguments[1];this.location[i]=a}},Zn.prototype.init=function(r){this.location=new Array(r).fill(null),this.setAllLocations(K.NONE)},Zn.prototype.isEqualOnSide=function(r,i){return this.location[i]===r.location[i]},Zn.prototype.allPositionsEqual=function(r){for(var i=0;i<this.location.length;i++)if(this.location[i]!==r)return!1;return!0},Zn.prototype.interfaces_=function(){return[]},Zn.prototype.getClass=function(){return Zn};var On=function r(){if(this.elt=new Array(2).fill(null),arguments.length===1){if(Number.isInteger(arguments[0])){var i=arguments[0];this.elt[0]=new Zn(i),this.elt[1]=new Zn(i)}else if(arguments[0]instanceof r){var a=arguments[0];this.elt[0]=new Zn(a.elt[0]),this.elt[1]=new Zn(a.elt[1])}}else if(arguments.length===2){var c=arguments[0],d=arguments[1];this.elt[0]=new Zn(K.NONE),this.elt[1]=new Zn(K.NONE),this.elt[c].setLocation(d)}else if(arguments.length===3){var _=arguments[0],M=arguments[1],L=arguments[2];this.elt[0]=new Zn(_,M,L),this.elt[1]=new Zn(_,M,L)}else if(arguments.length===4){var H=arguments[0],it=arguments[1],bt=arguments[2],Tt=arguments[3];this.elt[0]=new Zn(K.NONE,K.NONE,K.NONE),this.elt[1]=new Zn(K.NONE,K.NONE,K.NONE),this.elt[H].setLocations(it,bt,Tt)}};On.prototype.getGeometryCount=function(){var r=0;return this.elt[0].isNull()||r++,this.elt[1].isNull()||r++,r},On.prototype.setAllLocations=function(r,i){this.elt[r].setAllLocations(i)},On.prototype.isNull=function(r){return this.elt[r].isNull()},On.prototype.setAllLocationsIfNull=function(){if(arguments.length===1){var r=arguments[0];this.setAllLocationsIfNull(0,r),this.setAllLocationsIfNull(1,r)}else if(arguments.length===2){var i=arguments[0],a=arguments[1];this.elt[i].setAllLocationsIfNull(a)}},On.prototype.isLine=function(r){return this.elt[r].isLine()},On.prototype.merge=function(r){for(var i=0;i<2;i++)this.elt[i]===null&&r.elt[i]!==null?this.elt[i]=new Zn(r.elt[i]):this.elt[i].merge(r.elt[i])},On.prototype.flip=function(){this.elt[0].flip(),this.elt[1].flip()},On.prototype.getLocation=function(){if(arguments.length===1){var r=arguments[0];return this.elt[r].get(Xt.ON)}if(arguments.length===2){var i=arguments[0],a=arguments[1];return this.elt[i].get(a)}},On.prototype.toString=function(){var r=new Lt;return this.elt[0]!==null&&(r.append("A:"),r.append(this.elt[0].toString())),this.elt[1]!==null&&(r.append(" B:"),r.append(this.elt[1].toString())),r.toString()},On.prototype.isArea=function(){if(arguments.length===0)return this.elt[0].isArea()||this.elt[1].isArea();if(arguments.length===1){var r=arguments[0];return this.elt[r].isArea()}},On.prototype.isAnyNull=function(r){return this.elt[r].isAnyNull()},On.prototype.setLocation=function(){if(arguments.length===2){var r=arguments[0],i=arguments[1];this.elt[r].setLocation(Xt.ON,i)}else if(arguments.length===3){var a=arguments[0],c=arguments[1],d=arguments[2];this.elt[a].setLocation(c,d)}},On.prototype.isEqualOnSide=function(r,i){return this.elt[0].isEqualOnSide(r.elt[0],i)&&this.elt[1].isEqualOnSide(r.elt[1],i)},On.prototype.allPositionsEqual=function(r,i){return this.elt[r].allPositionsEqual(i)},On.prototype.toLine=function(r){this.elt[r].isArea()&&(this.elt[r]=new Zn(this.elt[r].location[0]))},On.prototype.interfaces_=function(){return[]},On.prototype.getClass=function(){return On},On.toLineLabel=function(r){for(var i=new On(K.NONE),a=0;a<2;a++)i.setLocation(a,r.getLocation(a));return i};var Ar=function(){this._startDe=null,this._maxNodeDegree=-1,this._edges=new G,this._pts=new G,this._label=new On(K.NONE),this._ring=null,this._isHole=null,this._shell=null,this._holes=new G,this._geometryFactory=null;var r=arguments[0],i=arguments[1];this._geometryFactory=i,this.computePoints(r),this.computeRing()};Ar.prototype.computeRing=function(){if(this._ring!==null)return null;for(var r=new Array(this._pts.size()).fill(null),i=0;i<this._pts.size();i++)r[i]=this._pts.get(i);this._ring=this._geometryFactory.createLinearRing(r),this._isHole=dt.isCCW(this._ring.getCoordinates())},Ar.prototype.isIsolated=function(){return this._label.getGeometryCount()===1},Ar.prototype.computePoints=function(r){this._startDe=r;var i=r,a=!0;do{if(i===null)throw new Qo("Found null DirectedEdge");if(i.getEdgeRing()===this)throw new Qo("Directed Edge visited twice during ring-building at "+i.getCoordinate());this._edges.add(i);var c=i.getLabel();Wt.isTrue(c.isArea()),this.mergeLabel(c),this.addPoints(i.getEdge(),i.isForward(),a),a=!1,this.setEdgeRing(i,this),i=this.getNext(i)}while(i!==this._startDe)},Ar.prototype.getLinearRing=function(){return this._ring},Ar.prototype.getCoordinate=function(r){return this._pts.get(r)},Ar.prototype.computeMaxNodeDegree=function(){this._maxNodeDegree=0;var r=this._startDe;do{var i=r.getNode().getEdges().getOutgoingDegree(this);i>this._maxNodeDegree&&(this._maxNodeDegree=i),r=this.getNext(r)}while(r!==this._startDe);this._maxNodeDegree*=2},Ar.prototype.addPoints=function(r,i,a){var c=r.getCoordinates();if(i){var d=1;a&&(d=0);for(var _=d;_<c.length;_++)this._pts.add(c[_])}else{var M=c.length-2;a&&(M=c.length-1);for(var L=M;L>=0;L--)this._pts.add(c[L])}},Ar.prototype.isHole=function(){return this._isHole},Ar.prototype.setInResult=function(){var r=this._startDe;do r.getEdge().setInResult(!0),r=r.getNext();while(r!==this._startDe)},Ar.prototype.containsPoint=function(r){var i=this.getLinearRing();if(!i.getEnvelopeInternal().contains(r)||!dt.isPointInRing(r,i.getCoordinates()))return!1;for(var a=this._holes.iterator();a.hasNext();)if(a.next().containsPoint(r))return!1;return!0},Ar.prototype.addHole=function(r){this._holes.add(r)},Ar.prototype.isShell=function(){return this._shell===null},Ar.prototype.getLabel=function(){return this._label},Ar.prototype.getEdges=function(){return this._edges},Ar.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree},Ar.prototype.getShell=function(){return this._shell},Ar.prototype.mergeLabel=function(){if(arguments.length===1){var r=arguments[0];this.mergeLabel(r,0),this.mergeLabel(r,1)}else if(arguments.length===2){var i=arguments[0],a=arguments[1],c=i.getLocation(a,Xt.RIGHT);if(c===K.NONE)return null;if(this._label.getLocation(a)===K.NONE)return this._label.setLocation(a,c),null}},Ar.prototype.setShell=function(r){this._shell=r,r!==null&&r.addHole(this)},Ar.prototype.toPolygon=function(r){for(var i=new Array(this._holes.size()).fill(null),a=0;a<this._holes.size();a++)i[a]=this._holes.get(a).getLinearRing();return r.createPolygon(this.getLinearRing(),i)},Ar.prototype.interfaces_=function(){return[]},Ar.prototype.getClass=function(){return Ar};var tm=function(r){function i(){var a=arguments[0],c=arguments[1];r.call(this,a,c)}return r&&(i.__proto__=r),i.prototype=Object.create(r&&r.prototype),i.prototype.constructor=i,i.prototype.setEdgeRing=function(a,c){a.setMinEdgeRing(c)},i.prototype.getNext=function(a){return a.getNextMin()},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(Ar),zh=function(r){function i(){var a=arguments[0],c=arguments[1];r.call(this,a,c)}return r&&(i.__proto__=r),i.prototype=Object.create(r&&r.prototype),i.prototype.constructor=i,i.prototype.buildMinimalRings=function(){var a=new G,c=this._startDe;do{if(c.getMinEdgeRing()===null){var d=new tm(c,this._geometryFactory);a.add(d)}c=c.getNext()}while(c!==this._startDe);return a},i.prototype.setEdgeRing=function(a,c){a.setEdgeRing(c)},i.prototype.linkDirectedEdgesForMinimalEdgeRings=function(){var a=this._startDe;do a.getNode().getEdges().linkMinimalDirectedEdges(this),a=a.getNext();while(a!==this._startDe)},i.prototype.getNext=function(a){return a.getNext()},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(Ar),Xi=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 r=arguments[0];this._label=r}}};Xi.prototype.setVisited=function(r){this._isVisited=r},Xi.prototype.setInResult=function(r){this._isInResult=r},Xi.prototype.isCovered=function(){return this._isCovered},Xi.prototype.isCoveredSet=function(){return this._isCoveredSet},Xi.prototype.setLabel=function(r){this._label=r},Xi.prototype.getLabel=function(){return this._label},Xi.prototype.setCovered=function(r){this._isCovered=r,this._isCoveredSet=!0},Xi.prototype.updateIM=function(r){Wt.isTrue(this._label.getGeometryCount()>=2,"found partial label"),this.computeIM(r)},Xi.prototype.isInResult=function(){return this._isInResult},Xi.prototype.isVisited=function(){return this._isVisited},Xi.prototype.interfaces_=function(){return[]},Xi.prototype.getClass=function(){return Xi};var Kl=function(r){function i(){r.call(this),this._coord=null,this._edges=null;var a=arguments[0],c=arguments[1];this._coord=a,this._edges=c,this._label=new On(0,K.NONE)}return r&&(i.__proto__=r),i.prototype=Object.create(r&&r.prototype),i.prototype.constructor=i,i.prototype.isIncidentEdgeInResult=function(){for(var a=this.getEdges().getEdges().iterator();a.hasNext();)if(a.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(a){a.println("node "+this._coord+" lbl: "+this._label)},i.prototype.computeIM=function(a){},i.prototype.computeMergedLocation=function(a,c){var d=K.NONE;if(d=this._label.getLocation(c),!a.isNull(c)){var _=a.getLocation(c);d!==K.BOUNDARY&&(d=_)}return d},i.prototype.setLabel=function(){if(arguments.length!==2)return r.prototype.setLabel.apply(this,arguments);var a=arguments[0],c=arguments[1];this._label===null?this._label=new On(a,c):this._label.setLocation(a,c)},i.prototype.getEdges=function(){return this._edges},i.prototype.mergeLabel=function(){if(arguments[0]instanceof i){var a=arguments[0];this.mergeLabel(a._label)}else if(arguments[0]instanceof On)for(var c=arguments[0],d=0;d<2;d++){var _=this.computeMergedLocation(c,d);this._label.getLocation(d)===K.NONE&&this._label.setLocation(d,_)}},i.prototype.add=function(a){this._edges.insert(a),a.setNode(this)},i.prototype.setLabelBoundary=function(a){if(this._label===null)return null;var c=K.NONE;this._label!==null&&(c=this._label.getLocation(a));var d=null;switch(c){case K.BOUNDARY:d=K.INTERIOR;break;case K.INTERIOR:default:d=K.BOUNDARY}this._label.setLocation(a,d)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(Xi),Ro=function(){this.nodeMap=new w,this.nodeFact=null;var r=arguments[0];this.nodeFact=r};Ro.prototype.find=function(r){return this.nodeMap.get(r)},Ro.prototype.addNode=function(){if(arguments[0]instanceof D){var r=arguments[0],i=this.nodeMap.get(r);return i===null&&(i=this.nodeFact.createNode(r),this.nodeMap.put(r,i)),i}if(arguments[0]instanceof Kl){var a=arguments[0],c=this.nodeMap.get(a.getCoordinate());return c===null?(this.nodeMap.put(a.getCoordinate(),a),a):(c.mergeLabel(a),c)}},Ro.prototype.print=function(r){for(var i=this.iterator();i.hasNext();)i.next().print(r)},Ro.prototype.iterator=function(){return this.nodeMap.values().iterator()},Ro.prototype.values=function(){return this.nodeMap.values()},Ro.prototype.getBoundaryNodes=function(r){for(var i=new G,a=this.iterator();a.hasNext();){var c=a.next();c.getLabel().getLocation(r)===K.BOUNDARY&&i.add(c)}return i},Ro.prototype.add=function(r){var i=r.getCoordinate();this.addNode(i).add(r)},Ro.prototype.interfaces_=function(){return[]},Ro.prototype.getClass=function(){return Ro};var Yn=function(){},Ba={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}};Yn.prototype.interfaces_=function(){return[]},Yn.prototype.getClass=function(){return Yn},Yn.isNorthern=function(r){return r===Yn.NE||r===Yn.NW},Yn.isOpposite=function(r,i){return r===i?!1:(r-i+4)%4===2},Yn.commonHalfPlane=function(r,i){if(r===i)return r;if((r-i+4)%4===2)return-1;var a=r<i?r:i;return a===0&&(r>i?r:i)===3?3:a},Yn.isInHalfPlane=function(r,i){return i===Yn.SE?r===Yn.SE||r===Yn.SW:r===i||r===i+1},Yn.quadrant=function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var r=arguments[0],i=arguments[1];if(r===0&&i===0)throw new I("Cannot compute the quadrant for point ( "+r+", "+i+" )");return r>=0?i>=0?Yn.NE:Yn.SE:i>=0?Yn.NW:Yn.SW}if(arguments[0]instanceof D&&arguments[1]instanceof D){var a=arguments[0],c=arguments[1];if(c.x===a.x&&c.y===a.y)throw new I("Cannot compute the quadrant for two identical points "+a);return c.x>=a.x?c.y>=a.y?Yn.NE:Yn.SE:c.y>=a.y?Yn.NW:Yn.SW}},Ba.NE.get=function(){return 0},Ba.NW.get=function(){return 1},Ba.SW.get=function(){return 2},Ba.SE.get=function(){return 3},Object.defineProperties(Yn,Ba);var jr=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 r=arguments[0];this._edge=r}else if(arguments.length===3){var i=arguments[0],a=arguments[1],c=arguments[2];this._edge=i,this.init(a,c),this._label=null}else if(arguments.length===4){var d=arguments[0],_=arguments[1],M=arguments[2],L=arguments[3];this._edge=d,this.init(_,M),this._label=L}};jr.prototype.compareDirection=function(r){return this._dx===r._dx&&this._dy===r._dy?0:this._quadrant>r._quadrant?1:this._quadrant<r._quadrant?-1:dt.computeOrientation(r._p0,r._p1,this._p1)},jr.prototype.getDy=function(){return this._dy},jr.prototype.getCoordinate=function(){return this._p0},jr.prototype.setNode=function(r){this._node=r},jr.prototype.print=function(r){var i=Math.atan2(this._dy,this._dx),a=this.getClass().getName(),c=a.lastIndexOf("."),d=a.substring(c+1);r.print(" "+d+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+i+" "+this._label)},jr.prototype.compareTo=function(r){var i=r;return this.compareDirection(i)},jr.prototype.getDirectedCoordinate=function(){return this._p1},jr.prototype.getDx=function(){return this._dx},jr.prototype.getLabel=function(){return this._label},jr.prototype.getEdge=function(){return this._edge},jr.prototype.getQuadrant=function(){return this._quadrant},jr.prototype.getNode=function(){return this._node},jr.prototype.toString=function(){var r=Math.atan2(this._dy,this._dx),i=this.getClass().getName(),a=i.lastIndexOf(".");return" "+i.substring(a+1)+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+r+" "+this._label},jr.prototype.computeLabel=function(r){},jr.prototype.init=function(r,i){this._p0=r,this._p1=i,this._dx=i.x-r.x,this._dy=i.y-r.y,this._quadrant=Yn.quadrant(this._dx,this._dy),Wt.isTrue(!(this._dx===0&&this._dy===0),"EdgeEnd with identical endpoints found")},jr.prototype.interfaces_=function(){return[V]},jr.prototype.getClass=function(){return jr};var wf=function(r){function i(){var a=arguments[0],c=arguments[1];if(r.call(this,a),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=c,c)this.init(a.getCoordinate(0),a.getCoordinate(1));else{var d=a.getNumPoints()-1;this.init(a.getCoordinate(d),a.getCoordinate(d-1))}this.computeDirectedLabel()}return r&&(i.__proto__=r),i.prototype=Object.create(r&&r.prototype),i.prototype.constructor=i,i.prototype.getNextMin=function(){return this._nextMin},i.prototype.getDepth=function(a){return this._depth[a]},i.prototype.setVisited=function(a){this._isVisited=a},i.prototype.computeDirectedLabel=function(){this._label=new On(this._edge.getLabel()),this._isForward||this._label.flip()},i.prototype.getNext=function(){return this._next},i.prototype.setDepth=function(a,c){if(this._depth[a]!==-999&&this._depth[a]!==c)throw new Qo("assigned depths do not match",this.getCoordinate());this._depth[a]=c},i.prototype.isInteriorAreaEdge=function(){for(var a=!0,c=0;c<2;c++)this._label.isArea(c)&&this._label.getLocation(c,Xt.LEFT)===K.INTERIOR&&this._label.getLocation(c,Xt.RIGHT)===K.INTERIOR||(a=!1);return a},i.prototype.setNextMin=function(a){this._nextMin=a},i.prototype.print=function(a){r.prototype.print.call(this,a),a.print(" "+this._depth[Xt.LEFT]+"/"+this._depth[Xt.RIGHT]),a.print(" ("+this.getDepthDelta()+")"),this._isInResult&&a.print(" inResult")},i.prototype.setMinEdgeRing=function(a){this._minEdgeRing=a},i.prototype.isLineEdge=function(){var a=this._label.isLine(0)||this._label.isLine(1),c=!this._label.isArea(0)||this._label.allPositionsEqual(0,K.EXTERIOR),d=!this._label.isArea(1)||this._label.allPositionsEqual(1,K.EXTERIOR);return a&&c&&d},i.prototype.setEdgeRing=function(a){this._edgeRing=a},i.prototype.getMinEdgeRing=function(){return this._minEdgeRing},i.prototype.getDepthDelta=function(){var a=this._edge.getDepthDelta();return this._isForward||(a=-a),a},i.prototype.setInResult=function(a){this._isInResult=a},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(a){this.print(a),a.print(" "),this._isForward?this._edge.print(a):this._edge.printReverse(a)},i.prototype.setSym=function(a){this._sym=a},i.prototype.setVisitedEdge=function(a){this.setVisited(a),this._sym.setVisited(a)},i.prototype.setEdgeDepths=function(a,c){var d=this.getEdge().getDepthDelta();this._isForward||(d=-d);var _=1;a===Xt.LEFT&&(_=-1);var M=Xt.opposite(a),L=c+d*_;this.setDepth(a,c),this.setDepth(M,L)},i.prototype.getEdgeRing=function(){return this._edgeRing},i.prototype.isInResult=function(){return this._isInResult},i.prototype.setNext=function(a){this._next=a},i.prototype.isVisited=function(){return this._isVisited},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i.depthFactor=function(a,c){return a===K.EXTERIOR&&c===K.INTERIOR?1:a===K.INTERIOR&&c===K.EXTERIOR?-1:0},i}(jr),yu=function(){};yu.prototype.createNode=function(r){return new Kl(r,null)},yu.prototype.interfaces_=function(){return[]},yu.prototype.getClass=function(){return yu};var dr=function(){if(this._edges=new G,this._nodes=null,this._edgeEndList=new G,arguments.length===0)this._nodes=new Ro(new yu);else if(arguments.length===1){var r=arguments[0];this._nodes=new Ro(r)}};dr.prototype.printEdges=function(r){r.println("Edges:");for(var i=0;i<this._edges.size();i++){r.println("edge "+i+":");var a=this._edges.get(i);a.print(r),a.eiList.print(r)}},dr.prototype.find=function(r){return this._nodes.find(r)},dr.prototype.addNode=function(){if(arguments[0]instanceof Kl){var r=arguments[0];return this._nodes.addNode(r)}if(arguments[0]instanceof D){var i=arguments[0];return this._nodes.addNode(i)}},dr.prototype.getNodeIterator=function(){return this._nodes.iterator()},dr.prototype.linkResultDirectedEdges=function(){for(var r=this._nodes.iterator();r.hasNext();)r.next().getEdges().linkResultDirectedEdges()},dr.prototype.debugPrintln=function(r){te.out.println(r)},dr.prototype.isBoundaryNode=function(r,i){var a=this._nodes.find(i);if(a===null)return!1;var c=a.getLabel();return c!==null&&c.getLocation(r)===K.BOUNDARY},dr.prototype.linkAllDirectedEdges=function(){for(var r=this._nodes.iterator();r.hasNext();)r.next().getEdges().linkAllDirectedEdges()},dr.prototype.matchInSameDirection=function(r,i,a,c){return!!r.equals(a)&&dt.computeOrientation(r,i,c)===dt.COLLINEAR&&Yn.quadrant(r,i)===Yn.quadrant(a,c)},dr.prototype.getEdgeEnds=function(){return this._edgeEndList},dr.prototype.debugPrint=function(r){te.out.print(r)},dr.prototype.getEdgeIterator=function(){return this._edges.iterator()},dr.prototype.findEdgeInSameDirection=function(r,i){for(var a=0;a<this._edges.size();a++){var c=this._edges.get(a),d=c.getCoordinates();if(this.matchInSameDirection(r,i,d[0],d[1])||this.matchInSameDirection(r,i,d[d.length-1],d[d.length-2]))return c}return null},dr.prototype.insertEdge=function(r){this._edges.add(r)},dr.prototype.findEdgeEnd=function(r){for(var i=this.getEdgeEnds().iterator();i.hasNext();){var a=i.next();if(a.getEdge()===r)return a}return null},dr.prototype.addEdges=function(r){for(var i=r.iterator();i.hasNext();){var a=i.next();this._edges.add(a);var c=new wf(a,!0),d=new wf(a,!1);c.setSym(d),d.setSym(c),this.add(c),this.add(d)}},dr.prototype.add=function(r){this._nodes.add(r),this._edgeEndList.add(r)},dr.prototype.getNodes=function(){return this._nodes.values()},dr.prototype.findEdge=function(r,i){for(var a=0;a<this._edges.size();a++){var c=this._edges.get(a),d=c.getCoordinates();if(r.equals(d[0])&&i.equals(d[1]))return c}return null},dr.prototype.interfaces_=function(){return[]},dr.prototype.getClass=function(){return dr},dr.linkResultDirectedEdges=function(r){for(var i=r.iterator();i.hasNext();)i.next().getEdges().linkResultDirectedEdges()};var Ci=function(){this._geometryFactory=null,this._shellList=new G;var r=arguments[0];this._geometryFactory=r};Ci.prototype.sortShellsAndHoles=function(r,i,a){for(var c=r.iterator();c.hasNext();){var d=c.next();d.isHole()?a.add(d):i.add(d)}},Ci.prototype.computePolygons=function(r){for(var i=new G,a=r.iterator();a.hasNext();){var c=a.next().toPolygon(this._geometryFactory);i.add(c)}return i},Ci.prototype.placeFreeHoles=function(r,i){for(var a=i.iterator();a.hasNext();){var c=a.next();if(c.getShell()===null){var d=this.findEdgeRingContaining(c,r);if(d===null)throw new Qo("unable to assign hole to a shell",c.getCoordinate(0));c.setShell(d)}}},Ci.prototype.buildMinimalEdgeRings=function(r,i,a){for(var c=new G,d=r.iterator();d.hasNext();){var _=d.next();if(_.getMaxNodeDegree()>2){_.linkDirectedEdgesForMinimalEdgeRings();var M=_.buildMinimalRings(),L=this.findShell(M);L!==null?(this.placePolygonHoles(L,M),i.add(L)):a.addAll(M)}else c.add(_)}return c},Ci.prototype.containsPoint=function(r){for(var i=this._shellList.iterator();i.hasNext();)if(i.next().containsPoint(r))return!0;return!1},Ci.prototype.buildMaximalEdgeRings=function(r){for(var i=new G,a=r.iterator();a.hasNext();){var c=a.next();if(c.isInResult()&&c.getLabel().isArea()&&c.getEdgeRing()===null){var d=new zh(c,this._geometryFactory);i.add(d),d.setInResult()}}return i},Ci.prototype.placePolygonHoles=function(r,i){for(var a=i.iterator();a.hasNext();){var c=a.next();c.isHole()&&c.setShell(r)}},Ci.prototype.getPolygons=function(){return this.computePolygons(this._shellList)},Ci.prototype.findEdgeRingContaining=function(r,i){for(var a=r.getLinearRing(),c=a.getEnvelopeInternal(),d=a.getCoordinateN(0),_=null,M=null,L=i.iterator();L.hasNext();){var H=L.next(),it=H.getLinearRing(),bt=it.getEnvelopeInternal();_!==null&&(M=_.getLinearRing().getEnvelopeInternal());var Tt=!1;bt.contains(c)&&dt.isPointInRing(d,it.getCoordinates())&&(Tt=!0),Tt&&(_===null||M.contains(bt))&&(_=H)}return _},Ci.prototype.findShell=function(r){for(var i=0,a=null,c=r.iterator();c.hasNext();){var d=c.next();d.isHole()||(a=d,i++)}return Wt.isTrue(i<=1,"found two shells in MinimalEdgeRing list"),a},Ci.prototype.add=function(){if(arguments.length===1){var r=arguments[0];this.add(r.getEdgeEnds(),r.getNodes())}else if(arguments.length===2){var i=arguments[0],a=arguments[1];dr.linkResultDirectedEdges(a);var c=this.buildMaximalEdgeRings(i),d=new G,_=this.buildMinimalEdgeRings(c,this._shellList,d);this.sortShellsAndHoles(_,this._shellList,d),this.placeFreeHoles(this._shellList,d)}},Ci.prototype.interfaces_=function(){return[]},Ci.prototype.getClass=function(){return Ci};var or=function(){};or.prototype.getBounds=function(){},or.prototype.interfaces_=function(){return[]},or.prototype.getClass=function(){return or};var je=function(){this._bounds=null,this._item=null;var r=arguments[0],i=arguments[1];this._bounds=r,this._item=i};je.prototype.getItem=function(){return this._item},je.prototype.getBounds=function(){return this._bounds},je.prototype.interfaces_=function(){return[or,t]},je.prototype.getClass=function(){return je};var vs=function(){this._size=null,this._items=null,this._size=0,this._items=new G,this._items.add(null)};vs.prototype.poll=function(){if(this.isEmpty())return null;var r=this._items.get(1);return this._items.set(1,this._items.get(this._size)),this._size-=1,this.reorder(1),r},vs.prototype.size=function(){return this._size},vs.prototype.reorder=function(r){for(var i=null,a=this._items.get(r);2*r<=this._size&&((i=2*r)!==this._size&&this._items.get(i+1).compareTo(this._items.get(i))<0&&i++,this._items.get(i).compareTo(a)<0);r=i)this._items.set(r,this._items.get(i));this._items.set(r,a)},vs.prototype.clear=function(){this._size=0,this._items.clear()},vs.prototype.isEmpty=function(){return this._size===0},vs.prototype.add=function(r){this._items.add(null),this._size+=1;var i=this._size;for(this._items.set(0,r);r.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,r)},vs.prototype.interfaces_=function(){return[]},vs.prototype.getClass=function(){return vs};var Us=function(){};Us.prototype.visitItem=function(r){},Us.prototype.interfaces_=function(){return[]},Us.prototype.getClass=function(){return Us};var za=function(){};za.prototype.insert=function(r,i){},za.prototype.remove=function(r,i){},za.prototype.query=function(){},za.prototype.interfaces_=function(){return[]},za.prototype.getClass=function(){return za};var Ir=function(){if(this._childBoundables=new G,this._bounds=null,this._level=null,arguments.length!==0){if(arguments.length===1){var r=arguments[0];this._level=r}}},Gh={serialVersionUID:{configurable:!0}};Ir.prototype.getLevel=function(){return this._level},Ir.prototype.size=function(){return this._childBoundables.size()},Ir.prototype.getChildBoundables=function(){return this._childBoundables},Ir.prototype.addChildBoundable=function(r){Wt.isTrue(this._bounds===null),this._childBoundables.add(r)},Ir.prototype.isEmpty=function(){return this._childBoundables.isEmpty()},Ir.prototype.getBounds=function(){return this._bounds===null&&(this._bounds=this.computeBounds()),this._bounds},Ir.prototype.interfaces_=function(){return[or,t]},Ir.prototype.getClass=function(){return Ir},Gh.serialVersionUID.get=function(){return 6493722185909574e3},Object.defineProperties(Ir,Gh);var ho=function(){};ho.reverseOrder=function(){return{compare:function(r,i){return i.compareTo(r)}}},ho.min=function(r){return ho.sort(r),r.get(0)},ho.sort=function(r,i){var a=r.toArray();i?nr.sort(a,i):nr.sort(a);for(var c=r.iterator(),d=0,_=a.length;d<_;d++)c.next(),c.set(a[d])},ho.singletonList=function(r){var i=new G;return i.add(r),i};var Sr=function(){this._boundable1=null,this._boundable2=null,this._distance=null,this._itemDistance=null;var r=arguments[0],i=arguments[1],a=arguments[2];this._boundable1=r,this._boundable2=i,this._itemDistance=a,this._distance=this.distance()};Sr.prototype.expandToQueue=function(r,i){var a=Sr.isComposite(this._boundable1),c=Sr.isComposite(this._boundable2);if(a&&c)return Sr.area(this._boundable1)>Sr.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,r,i),null):(this.expand(this._boundable2,this._boundable1,r,i),null);if(a)return this.expand(this._boundable1,this._boundable2,r,i),null;if(c)return this.expand(this._boundable2,this._boundable1,r,i),null;throw new I("neither boundable is composite")},Sr.prototype.isLeaves=function(){return!(Sr.isComposite(this._boundable1)||Sr.isComposite(this._boundable2))},Sr.prototype.compareTo=function(r){var i=r;return this._distance<i._distance?-1:this._distance>i._distance?1:0},Sr.prototype.expand=function(r,i,a,c){for(var d=r.getChildBoundables().iterator();d.hasNext();){var _=d.next(),M=new Sr(_,i,this._itemDistance);M.getDistance()<c&&a.add(M)}},Sr.prototype.getBoundable=function(r){return r===0?this._boundable1:this._boundable2},Sr.prototype.getDistance=function(){return this._distance},Sr.prototype.distance=function(){return this.isLeaves()?this._itemDistance.distance(this._boundable1,this._boundable2):this._boundable1.getBounds().distance(this._boundable2.getBounds())},Sr.prototype.interfaces_=function(){return[V]},Sr.prototype.getClass=function(){return Sr},Sr.area=function(r){return r.getBounds().getArea()},Sr.isComposite=function(r){return r instanceof Ir};var Fr=function r(){if(this._root=null,this._built=!1,this._itemBoundables=new G,this._nodeCapacity=null,arguments.length===0){var i=r.DEFAULT_NODE_CAPACITY;this._nodeCapacity=i}else if(arguments.length===1){var a=arguments[0];Wt.isTrue(a>1,"Node capacity must be greater than 1"),this._nodeCapacity=a}},Ur={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};Fr.prototype.getNodeCapacity=function(){return this._nodeCapacity},Fr.prototype.lastNode=function(r){return r.get(r.size()-1)},Fr.prototype.size=function(){if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.size(this._root));if(arguments.length===1){for(var r=0,i=arguments[0].getChildBoundables().iterator();i.hasNext();){var a=i.next();a instanceof Ir?r+=this.size(a):a instanceof je&&(r+=1)}return r}},Fr.prototype.removeItem=function(r,i){for(var a=null,c=r.getChildBoundables().iterator();c.hasNext();){var d=c.next();d instanceof je&&d.getItem()===i&&(a=d)}return a!==null&&(r.getChildBoundables().remove(a),!0)},Fr.prototype.itemsTree=function(){if(arguments.length===0){this.build();var r=this.itemsTree(this._root);return r===null?new G:r}if(arguments.length===1){for(var i=arguments[0],a=new G,c=i.getChildBoundables().iterator();c.hasNext();){var d=c.next();if(d instanceof Ir){var _=this.itemsTree(d);_!==null&&a.add(_)}else d instanceof je?a.add(d.getItem()):Wt.shouldNeverReachHere()}return a.size()<=0?null:a}},Fr.prototype.insert=function(r,i){Wt.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new je(r,i))},Fr.prototype.boundablesAtLevel=function(){if(arguments.length===1){var r=arguments[0],i=new G;return this.boundablesAtLevel(r,this._root,i),i}if(arguments.length===3){var a=arguments[0],c=arguments[1],d=arguments[2];if(Wt.isTrue(a>-2),c.getLevel()===a)return d.add(c),null;for(var _=c.getChildBoundables().iterator();_.hasNext();){var M=_.next();M instanceof Ir?this.boundablesAtLevel(a,M,d):(Wt.isTrue(M instanceof je),a===-1&&d.add(M))}return null}},Fr.prototype.query=function(){if(arguments.length===1){var r=arguments[0];this.build();var i=new G;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),r)&&this.query(r,this._root,i),i}if(arguments.length===2){var a=arguments[0],c=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),a)&&this.query(a,this._root,c)}else if(arguments.length===3){if(Q(arguments[2],Us)&&arguments[0]instanceof Object&&arguments[1]instanceof Ir)for(var d=arguments[0],_=arguments[1],M=arguments[2],L=_.getChildBoundables(),H=0;H<L.size();H++){var it=L.get(H);this.getIntersectsOp().intersects(it.getBounds(),d)&&(it instanceof Ir?this.query(d,it,M):it instanceof je?M.visitItem(it.getItem()):Wt.shouldNeverReachHere())}else if(Q(arguments[2],Et)&&arguments[0]instanceof Object&&arguments[1]instanceof Ir)for(var bt=arguments[0],Tt=arguments[1],Kt=arguments[2],Qt=Tt.getChildBoundables(),le=0;le<Qt.size();le++){var Ee=Qt.get(le);this.getIntersectsOp().intersects(Ee.getBounds(),bt)&&(Ee instanceof Ir?this.query(bt,Ee,Kt):Ee instanceof je?Kt.add(Ee.getItem()):Wt.shouldNeverReachHere())}}},Fr.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},Fr.prototype.getRoot=function(){return this.build(),this._root},Fr.prototype.remove=function(){if(arguments.length===2){var r=arguments[0],i=arguments[1];return this.build(),!!this.getIntersectsOp().intersects(this._root.getBounds(),r)&&this.remove(r,this._root,i)}if(arguments.length===3){var a=arguments[0],c=arguments[1],d=arguments[2],_=this.removeItem(c,d);if(_)return!0;for(var M=null,L=c.getChildBoundables().iterator();L.hasNext();){var H=L.next();if(this.getIntersectsOp().intersects(H.getBounds(),a)&&H instanceof Ir&&(_=this.remove(a,H,d))){M=H;break}}return M!==null&&M.getChildBoundables().isEmpty()&&c.getChildBoundables().remove(M),_}},Fr.prototype.createHigherLevels=function(r,i){Wt.isTrue(!r.isEmpty());var a=this.createParentBoundables(r,i+1);return a.size()===1?a.get(0):this.createHigherLevels(a,i+1)},Fr.prototype.depth=function(){if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.depth(this._root));if(arguments.length===1){for(var r=0,i=arguments[0].getChildBoundables().iterator();i.hasNext();){var a=i.next();if(a instanceof Ir){var c=this.depth(a);c>r&&(r=c)}}return r+1}},Fr.prototype.createParentBoundables=function(r,i){Wt.isTrue(!r.isEmpty());var a=new G;a.add(this.createNode(i));var c=new G(r);ho.sort(c,this.getComparator());for(var d=c.iterator();d.hasNext();){var _=d.next();this.lastNode(a).getChildBoundables().size()===this.getNodeCapacity()&&a.add(this.createNode(i)),this.lastNode(a).addChildBoundable(_)}return a},Fr.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()},Fr.prototype.interfaces_=function(){return[t]},Fr.prototype.getClass=function(){return Fr},Fr.compareDoubles=function(r,i){return r>i?1:r<i?-1:0},Ur.IntersectsOp.get=function(){return Sf},Ur.serialVersionUID.get=function(){return-3886435814360241e3},Ur.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(Fr,Ur);var Sf=function(){},Lo=function(){};Lo.prototype.distance=function(r,i){},Lo.prototype.interfaces_=function(){return[]},Lo.prototype.getClass=function(){return Lo};var Mf=function(r){function i(c){c=c||i.DEFAULT_NODE_CAPACITY,r.call(this,c)}r&&(i.__proto__=r),(i.prototype=Object.create(r&&r.prototype)).constructor=i;var a={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(c,d){Wt.isTrue(c.length>0);for(var _=new G,M=0;M<c.length;M++)_.addAll(this.createParentBoundablesFromVerticalSlice(c[M],d));return _},i.prototype.createNode=function(c){return new Jl(c)},i.prototype.size=function(){return arguments.length===0?r.prototype.size.call(this):r.prototype.size.apply(this,arguments)},i.prototype.insert=function(){if(arguments.length!==2)return r.prototype.insert.apply(this,arguments);var c=arguments[0],d=arguments[1];if(c.isNull())return null;r.prototype.insert.call(this,c,d)},i.prototype.getIntersectsOp=function(){return i.intersectsOp},i.prototype.verticalSlices=function(c,d){for(var _=Math.trunc(Math.ceil(c.size()/d)),M=new Array(d).fill(null),L=c.iterator(),H=0;H<d;H++){M[H]=new G;for(var it=0;L.hasNext()&&it<_;){var bt=L.next();M[H].add(bt),it++}}return M},i.prototype.query=function(){if(arguments.length===1){var c=arguments[0];return r.prototype.query.call(this,c)}if(arguments.length===2){var d=arguments[0],_=arguments[1];r.prototype.query.call(this,d,_)}else if(arguments.length===3){if(Q(arguments[2],Us)&&arguments[0]instanceof Object&&arguments[1]instanceof Ir){var M=arguments[0],L=arguments[1],H=arguments[2];r.prototype.query.call(this,M,L,H)}else if(Q(arguments[2],Et)&&arguments[0]instanceof Object&&arguments[1]instanceof Ir){var it=arguments[0],bt=arguments[1],Tt=arguments[2];r.prototype.query.call(this,it,bt,Tt)}}},i.prototype.getComparator=function(){return i.yComparator},i.prototype.createParentBoundablesFromVerticalSlice=function(c,d){return r.prototype.createParentBoundables.call(this,c,d)},i.prototype.remove=function(){if(arguments.length===2){var c=arguments[0],d=arguments[1];return r.prototype.remove.call(this,c,d)}return r.prototype.remove.apply(this,arguments)},i.prototype.depth=function(){return arguments.length===0?r.prototype.depth.call(this):r.prototype.depth.apply(this,arguments)},i.prototype.createParentBoundables=function(c,d){Wt.isTrue(!c.isEmpty());var _=Math.trunc(Math.ceil(c.size()/this.getNodeCapacity())),M=new G(c);ho.sort(M,i.xComparator);var L=this.verticalSlices(M,Math.trunc(Math.ceil(Math.sqrt(_))));return this.createParentBoundablesFromVerticalSlices(L,d)},i.prototype.nearestNeighbour=function(){if(arguments.length===1){if(Q(arguments[0],Lo)){var c=arguments[0],d=new Sr(this.getRoot(),this.getRoot(),c);return this.nearestNeighbour(d)}if(arguments[0]instanceof Sr){var _=arguments[0];return this.nearestNeighbour(_,A.POSITIVE_INFINITY)}}else if(arguments.length===2){if(arguments[0]instanceof i&&Q(arguments[1],Lo)){var M=arguments[0],L=arguments[1],H=new Sr(this.getRoot(),M.getRoot(),L);return this.nearestNeighbour(H)}if(arguments[0]instanceof Sr&&typeof arguments[1]=="number"){var it=arguments[0],bt=arguments[1],Tt=null,Kt=new vs;for(Kt.add(it);!Kt.isEmpty()&&bt>0;){var Qt=Kt.poll(),le=Qt.getDistance();if(le>=bt)break;Qt.isLeaves()?(bt=le,Tt=Qt):Qt.expandToQueue(Kt,bt)}return[Tt.getBoundable(0).getItem(),Tt.getBoundable(1).getItem()]}}else if(arguments.length===3){var Ee=arguments[0],Dn=arguments[1],Jn=arguments[2],fi=new je(Ee,Dn),as=new Sr(this.getRoot(),fi,Jn);return this.nearestNeighbour(as)[0]}},i.prototype.interfaces_=function(){return[za,t]},i.prototype.getClass=function(){return i},i.centreX=function(c){return i.avg(c.getMinX(),c.getMaxX())},i.avg=function(c,d){return(c+d)/2},i.centreY=function(c){return i.avg(c.getMinY(),c.getMaxY())},a.STRtreeNode.get=function(){return Jl},a.serialVersionUID.get=function(){return 0x39920f7d5f261e0},a.xComparator.get=function(){return{interfaces_:function(){return[q]},compare:function(c,d){return r.compareDoubles(i.centreX(c.getBounds()),i.centreX(d.getBounds()))}}},a.yComparator.get=function(){return{interfaces_:function(){return[q]},compare:function(c,d){return r.compareDoubles(i.centreY(c.getBounds()),i.centreY(d.getBounds()))}}},a.intersectsOp.get=function(){return{interfaces_:function(){return[r.IntersectsOp]},intersects:function(c,d){return c.intersects(d)}}},a.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(i,a),i}(Fr),Jl=function(r){function i(){var a=arguments[0];r.call(this,a)}return r&&(i.__proto__=r),i.prototype=Object.create(r&&r.prototype),i.prototype.constructor=i,i.prototype.computeBounds=function(){for(var a=null,c=this.getChildBoundables().iterator();c.hasNext();){var d=c.next();a===null?a=new qt(d.getBounds()):a.expandToInclude(d.getBounds())}return a},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(Ir),lr=function(){};lr.prototype.interfaces_=function(){return[]},lr.prototype.getClass=function(){return lr},lr.relativeSign=function(r,i){return r<i?-1:r>i?1:0},lr.compare=function(r,i,a){if(i.equals2D(a))return 0;var c=lr.relativeSign(i.x,a.x),d=lr.relativeSign(i.y,a.y);switch(r){case 0:return lr.compareValue(c,d);case 1:return lr.compareValue(d,c);case 2:return lr.compareValue(d,-c);case 3:return lr.compareValue(-c,d);case 4:return lr.compareValue(-c,-d);case 5:return lr.compareValue(-d,-c);case 6:return lr.compareValue(-d,c);case 7:return lr.compareValue(c,-d)}return Wt.shouldNeverReachHere("invalid octant value"),0},lr.compareValue=function(r,i){return r<0?-1:r>0?1:i<0?-1:i>0?1:0};var _s=function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var r=arguments[0],i=arguments[1],a=arguments[2],c=arguments[3];this._segString=r,this.coord=new D(i),this.segmentIndex=a,this._segmentOctant=c,this._isInterior=!i.equals2D(r.getCoordinate(a))};_s.prototype.getCoordinate=function(){return this.coord},_s.prototype.print=function(r){r.print(this.coord),r.print(" seg # = "+this.segmentIndex)},_s.prototype.compareTo=function(r){var i=r;return this.segmentIndex<i.segmentIndex?-1:this.segmentIndex>i.segmentIndex?1:this.coord.equals2D(i.coord)?0:lr.compare(this._segmentOctant,this.coord,i.coord)},_s.prototype.isEndPoint=function(r){return this.segmentIndex===0&&!this._isInterior||this.segmentIndex===r},_s.prototype.isInterior=function(){return this._isInterior},_s.prototype.interfaces_=function(){return[V]},_s.prototype.getClass=function(){return _s};var Qr=function(){this._nodeMap=new w,this._edge=null;var r=arguments[0];this._edge=r};Qr.prototype.getSplitCoordinates=function(){var r=new et;this.addEndpoints();for(var i=this.iterator(),a=i.next();i.hasNext();){var c=i.next();this.addEdgeCoordinates(a,c,r),a=c}return r.toCoordinateArray()},Qr.prototype.addCollapsedNodes=function(){var r=new G;this.findCollapsesFromInsertedNodes(r),this.findCollapsesFromExistingVertices(r);for(var i=r.iterator();i.hasNext();){var a=i.next().intValue();this.add(this._edge.getCoordinate(a),a)}},Qr.prototype.print=function(r){r.println("Intersections:");for(var i=this.iterator();i.hasNext();)i.next().print(r)},Qr.prototype.findCollapsesFromExistingVertices=function(r){for(var i=0;i<this._edge.size()-2;i++){var a=this._edge.getCoordinate(i),c=this._edge.getCoordinate(i+2);a.equals2D(c)&&r.add(new pt(i+1))}},Qr.prototype.addEdgeCoordinates=function(r,i,a){var c=this._edge.getCoordinate(i.segmentIndex),d=i.isInterior()||!i.coord.equals2D(c);a.add(new D(r.coord),!1);for(var _=r.segmentIndex+1;_<=i.segmentIndex;_++)a.add(this._edge.getCoordinate(_));d&&a.add(new D(i.coord))},Qr.prototype.iterator=function(){return this._nodeMap.values().iterator()},Qr.prototype.addSplitEdges=function(r){this.addEndpoints(),this.addCollapsedNodes();for(var i=this.iterator(),a=i.next();i.hasNext();){var c=i.next(),d=this.createSplitEdge(a,c);r.add(d),a=c}},Qr.prototype.findCollapseIndex=function(r,i,a){if(!r.coord.equals2D(i.coord))return!1;var c=i.segmentIndex-r.segmentIndex;return i.isInterior()||c--,c===1&&(a[0]=r.segmentIndex+1,!0)},Qr.prototype.findCollapsesFromInsertedNodes=function(r){for(var i=new Array(1).fill(null),a=this.iterator(),c=a.next();a.hasNext();){var d=a.next();this.findCollapseIndex(c,d,i)&&r.add(new pt(i[0])),c=d}},Qr.prototype.getEdge=function(){return this._edge},Qr.prototype.addEndpoints=function(){var r=this._edge.size()-1;this.add(this._edge.getCoordinate(0),0),this.add(this._edge.getCoordinate(r),r)},Qr.prototype.createSplitEdge=function(r,i){var a=i.segmentIndex-r.segmentIndex+2,c=this._edge.getCoordinate(i.segmentIndex),d=i.isInterior()||!i.coord.equals2D(c);d||a--;var _=new Array(a).fill(null),M=0;_[M++]=new D(r.coord);for(var L=r.segmentIndex+1;L<=i.segmentIndex;L++)_[M++]=this._edge.getCoordinate(L);return d&&(_[M]=new D(i.coord)),new mr(_,this._edge.getData())},Qr.prototype.add=function(r,i){var a=new _s(this._edge,r,i,this._edge.getSegmentOctant(i)),c=this._nodeMap.get(a);return c!==null?(Wt.isTrue(c.coord.equals2D(r),"Found equal nodes with different coordinates"),c):(this._nodeMap.put(a,a),a)},Qr.prototype.checkSplitEdgesCorrectness=function(r){var i=this._edge.getCoordinates(),a=r.get(0).getCoordinate(0);if(!a.equals2D(i[0]))throw new Te("bad split edge start point at "+a);var c=r.get(r.size()-1).getCoordinates(),d=c[c.length-1];if(!d.equals2D(i[i.length-1]))throw new Te("bad split edge end point at "+d)},Qr.prototype.interfaces_=function(){return[]},Qr.prototype.getClass=function(){return Qr};var ua=function(){};ua.prototype.interfaces_=function(){return[]},ua.prototype.getClass=function(){return ua},ua.octant=function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var r=arguments[0],i=arguments[1];if(r===0&&i===0)throw new I("Cannot compute the octant for point ( "+r+", "+i+" )");var a=Math.abs(r),c=Math.abs(i);return r>=0?i>=0?a>=c?0:1:a>=c?7:6:i>=0?a>=c?3:2:a>=c?4:5}if(arguments[0]instanceof D&&arguments[1]instanceof D){var d=arguments[0],_=arguments[1],M=_.x-d.x,L=_.y-d.y;if(M===0&&L===0)throw new I("Cannot compute the octant for two identical points "+d);return ua.octant(M,L)}};var No=function(){};No.prototype.getCoordinates=function(){},No.prototype.size=function(){},No.prototype.getCoordinate=function(r){},No.prototype.isClosed=function(){},No.prototype.setData=function(r){},No.prototype.getData=function(){},No.prototype.interfaces_=function(){return[]},No.prototype.getClass=function(){return No};var vu=function(){};vu.prototype.addIntersection=function(r,i){},vu.prototype.interfaces_=function(){return[No]},vu.prototype.getClass=function(){return vu};var mr=function(){this._nodeList=new Qr(this),this._pts=null,this._data=null;var r=arguments[0],i=arguments[1];this._pts=r,this._data=i};mr.prototype.getCoordinates=function(){return this._pts},mr.prototype.size=function(){return this._pts.length},mr.prototype.getCoordinate=function(r){return this._pts[r]},mr.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},mr.prototype.getSegmentOctant=function(r){return r===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(r),this.getCoordinate(r+1))},mr.prototype.setData=function(r){this._data=r},mr.prototype.safeOctant=function(r,i){return r.equals2D(i)?0:ua.octant(r,i)},mr.prototype.getData=function(){return this._data},mr.prototype.addIntersection=function(){if(arguments.length===2){var r=arguments[0],i=arguments[1];this.addIntersectionNode(r,i)}else if(arguments.length===4){var a=arguments[0],c=arguments[1],d=arguments[3],_=new D(a.getIntersection(d));this.addIntersection(_,c)}},mr.prototype.toString=function(){return fe.toLineString(new ye(this._pts))},mr.prototype.getNodeList=function(){return this._nodeList},mr.prototype.addIntersectionNode=function(r,i){var a=i,c=a+1;if(c<this._pts.length){var d=this._pts[c];r.equals2D(d)&&(a=c)}return this._nodeList.add(r,a)},mr.prototype.addIntersections=function(r,i,a){for(var c=0;c<r.getIntersectionNum();c++)this.addIntersection(r,i,a,c)},mr.prototype.interfaces_=function(){return[vu]},mr.prototype.getClass=function(){return mr},mr.getNodedSubstrings=function(){if(arguments.length===1){var r=arguments[0],i=new G;return mr.getNodedSubstrings(r,i),i}if(arguments.length===2)for(var a=arguments[0],c=arguments[1],d=a.iterator();d.hasNext();)d.next().getNodeList().addSplitEdges(c)};var ie=function(){if(this.p0=null,this.p1=null,arguments.length===0)this.p0=new D,this.p1=new D;else if(arguments.length===1){var r=arguments[0];this.p0=new D(r.p0),this.p1=new D(r.p1)}else if(arguments.length===2)this.p0=arguments[0],this.p1=arguments[1];else if(arguments.length===4){var i=arguments[0],a=arguments[1],c=arguments[2],d=arguments[3];this.p0=new D(i,a),this.p1=new D(c,d)}},kh={serialVersionUID:{configurable:!0}};ie.prototype.minX=function(){return Math.min(this.p0.x,this.p1.x)},ie.prototype.orientationIndex=function(){if(arguments[0]instanceof ie){var r=arguments[0],i=dt.orientationIndex(this.p0,this.p1,r.p0),a=dt.orientationIndex(this.p0,this.p1,r.p1);return i>=0&&a>=0||i<=0&&a<=0?Math.max(i,a):0}if(arguments[0]instanceof D){var c=arguments[0];return dt.orientationIndex(this.p0,this.p1,c)}},ie.prototype.toGeometry=function(r){return r.createLineString([this.p0,this.p1])},ie.prototype.isVertical=function(){return this.p0.x===this.p1.x},ie.prototype.equals=function(r){if(!(r instanceof ie))return!1;var i=r;return this.p0.equals(i.p0)&&this.p1.equals(i.p1)},ie.prototype.intersection=function(r){var i=new z;return i.computeIntersection(this.p0,this.p1,r.p0,r.p1),i.hasIntersection()?i.getIntersection(0):null},ie.prototype.project=function(){if(arguments[0]instanceof D){var r=arguments[0];if(r.equals(this.p0)||r.equals(this.p1))return new D(r);var i=this.projectionFactor(r),a=new D;return a.x=this.p0.x+i*(this.p1.x-this.p0.x),a.y=this.p0.y+i*(this.p1.y-this.p0.y),a}if(arguments[0]instanceof ie){var c=arguments[0],d=this.projectionFactor(c.p0),_=this.projectionFactor(c.p1);if(d>=1&&_>=1||d<=0&&_<=0)return null;var M=this.project(c.p0);d<0&&(M=this.p0),d>1&&(M=this.p1);var L=this.project(c.p1);return _<0&&(L=this.p0),_>1&&(L=this.p1),new ie(M,L)}},ie.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()},ie.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)},ie.prototype.getCoordinate=function(r){return r===0?this.p0:this.p1},ie.prototype.distancePerpendicular=function(r){return dt.distancePointLinePerpendicular(r,this.p0,this.p1)},ie.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)},ie.prototype.midPoint=function(){return ie.midPoint(this.p0,this.p1)},ie.prototype.projectionFactor=function(r){if(r.equals(this.p0))return 0;if(r.equals(this.p1))return 1;var i=this.p1.x-this.p0.x,a=this.p1.y-this.p0.y,c=i*i+a*a;return c<=0?A.NaN:((r.x-this.p0.x)*i+(r.y-this.p0.y)*a)/c},ie.prototype.closestPoints=function(r){var i=this.intersection(r);if(i!==null)return[i,i];var a=new Array(2).fill(null),c=A.MAX_VALUE,d=null,_=this.closestPoint(r.p0);c=_.distance(r.p0),a[0]=_,a[1]=r.p0;var M=this.closestPoint(r.p1);(d=M.distance(r.p1))<c&&(c=d,a[0]=M,a[1]=r.p1);var L=r.closestPoint(this.p0);(d=L.distance(this.p0))<c&&(c=d,a[0]=this.p0,a[1]=L);var H=r.closestPoint(this.p1);return(d=H.distance(this.p1))<c&&(c=d,a[0]=this.p1,a[1]=H),a},ie.prototype.closestPoint=function(r){var i=this.projectionFactor(r);return i>0&&i<1?this.project(r):this.p0.distance(r)<this.p1.distance(r)?this.p0:this.p1},ie.prototype.maxX=function(){return Math.max(this.p0.x,this.p1.x)},ie.prototype.getLength=function(){return this.p0.distance(this.p1)},ie.prototype.compareTo=function(r){var i=r,a=this.p0.compareTo(i.p0);return a!==0?a:this.p1.compareTo(i.p1)},ie.prototype.reverse=function(){var r=this.p0;this.p0=this.p1,this.p1=r},ie.prototype.equalsTopo=function(r){return this.p0.equals(r.p0)&&(this.p1.equals(r.p1)||this.p0.equals(r.p1))&&this.p1.equals(r.p0)},ie.prototype.lineIntersection=function(r){try{return $t.intersection(this.p0,this.p1,r.p0,r.p1)}catch(i){if(!(i instanceof ce))throw i}return null},ie.prototype.maxY=function(){return Math.max(this.p0.y,this.p1.y)},ie.prototype.pointAlongOffset=function(r,i){var a=this.p0.x+r*(this.p1.x-this.p0.x),c=this.p0.y+r*(this.p1.y-this.p0.y),d=this.p1.x-this.p0.x,_=this.p1.y-this.p0.y,M=Math.sqrt(d*d+_*_),L=0,H=0;if(i!==0){if(M<=0)throw new Error("Cannot compute offset from zero-length line segment");L=i*d/M,H=i*_/M}return new D(a-H,c+L)},ie.prototype.setCoordinates=function(){if(arguments.length===1){var r=arguments[0];this.setCoordinates(r.p0,r.p1)}else if(arguments.length===2){var i=arguments[0],a=arguments[1];this.p0.x=i.x,this.p0.y=i.y,this.p1.x=a.x,this.p1.y=a.y}},ie.prototype.segmentFraction=function(r){var i=this.projectionFactor(r);return i<0?i=0:(i>1||A.isNaN(i))&&(i=1),i},ie.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"},ie.prototype.isHorizontal=function(){return this.p0.y===this.p1.y},ie.prototype.distance=function(){if(arguments[0]instanceof ie){var r=arguments[0];return dt.distanceLineLine(this.p0,this.p1,r.p0,r.p1)}if(arguments[0]instanceof D){var i=arguments[0];return dt.distancePointLine(i,this.p0,this.p1)}},ie.prototype.pointAlong=function(r){var i=new D;return i.x=this.p0.x+r*(this.p1.x-this.p0.x),i.y=this.p0.y+r*(this.p1.y-this.p0.y),i},ie.prototype.hashCode=function(){var r=A.doubleToLongBits(this.p0.x);r^=31*A.doubleToLongBits(this.p0.y);var i=Math.trunc(r)^Math.trunc(r>>32),a=A.doubleToLongBits(this.p1.x);return a^=31*A.doubleToLongBits(this.p1.y),i^(Math.trunc(a)^Math.trunc(a>>32))},ie.prototype.interfaces_=function(){return[V,t]},ie.prototype.getClass=function(){return ie},ie.midPoint=function(r,i){return new D((r.x+i.x)/2,(r.y+i.y)/2)},kh.serialVersionUID.get=function(){return 0x2d2172135f411c00},Object.defineProperties(ie,kh);var Pi=function(){this.tempEnv1=new qt,this.tempEnv2=new qt,this._overlapSeg1=new ie,this._overlapSeg2=new ie};Pi.prototype.overlap=function(){if(arguments.length!==2){if(arguments.length===4){var r=arguments[0],i=arguments[1],a=arguments[2],c=arguments[3];r.getLineSegment(i,this._overlapSeg1),a.getLineSegment(c,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}}},Pi.prototype.interfaces_=function(){return[]},Pi.prototype.getClass=function(){return Pi};var Ii=function(){this._pts=null,this._start=null,this._end=null,this._env=null,this._context=null,this._id=null;var r=arguments[0],i=arguments[1],a=arguments[2],c=arguments[3];this._pts=r,this._start=i,this._end=a,this._context=c};Ii.prototype.getLineSegment=function(r,i){i.p0=this._pts[r],i.p1=this._pts[r+1]},Ii.prototype.computeSelect=function(r,i,a,c){var d=this._pts[i],_=this._pts[a];if(c.tempEnv1.init(d,_),a-i==1)return c.select(this,i),null;if(!r.intersects(c.tempEnv1))return null;var M=Math.trunc((i+a)/2);i<M&&this.computeSelect(r,i,M,c),M<a&&this.computeSelect(r,M,a,c)},Ii.prototype.getCoordinates=function(){for(var r=new Array(this._end-this._start+1).fill(null),i=0,a=this._start;a<=this._end;a++)r[i++]=this._pts[a];return r},Ii.prototype.computeOverlaps=function(r,i){this.computeOverlapsInternal(this._start,this._end,r,r._start,r._end,i)},Ii.prototype.setId=function(r){this._id=r},Ii.prototype.select=function(r,i){this.computeSelect(r,this._start,this._end,i)},Ii.prototype.getEnvelope=function(){if(this._env===null){var r=this._pts[this._start],i=this._pts[this._end];this._env=new qt(r,i)}return this._env},Ii.prototype.getEndIndex=function(){return this._end},Ii.prototype.getStartIndex=function(){return this._start},Ii.prototype.getContext=function(){return this._context},Ii.prototype.getId=function(){return this._id},Ii.prototype.computeOverlapsInternal=function(r,i,a,c,d,_){var M=this._pts[r],L=this._pts[i],H=a._pts[c],it=a._pts[d];if(i-r==1&&d-c==1)return _.overlap(this,r,a,c),null;if(_.tempEnv1.init(M,L),_.tempEnv2.init(H,it),!_.tempEnv1.intersects(_.tempEnv2))return null;var bt=Math.trunc((r+i)/2),Tt=Math.trunc((c+d)/2);r<bt&&(c<Tt&&this.computeOverlapsInternal(r,bt,a,c,Tt,_),Tt<d&&this.computeOverlapsInternal(r,bt,a,Tt,d,_)),bt<i&&(c<Tt&&this.computeOverlapsInternal(bt,i,a,c,Tt,_),Tt<d&&this.computeOverlapsInternal(bt,i,a,Tt,d,_))},Ii.prototype.interfaces_=function(){return[]},Ii.prototype.getClass=function(){return Ii};var po=function(){};po.prototype.interfaces_=function(){return[]},po.prototype.getClass=function(){return po},po.getChainStartIndices=function(r){var i=0,a=new G;a.add(new pt(i));do{var c=po.findChainEnd(r,i);a.add(new pt(c)),i=c}while(i<r.length-1);return po.toIntArray(a)},po.findChainEnd=function(r,i){for(var a=i;a<r.length-1&&r[a].equals2D(r[a+1]);)a++;if(a>=r.length-1)return r.length-1;for(var c=Yn.quadrant(r[a],r[a+1]),d=i+1;d<r.length&&!(!r[d-1].equals2D(r[d])&&Yn.quadrant(r[d-1],r[d])!==c);)d++;return d-1},po.getChains=function(){if(arguments.length===1){var r=arguments[0];return po.getChains(r,null)}if(arguments.length===2){for(var i=arguments[0],a=arguments[1],c=new G,d=po.getChainStartIndices(i),_=0;_<d.length-1;_++){var M=new Ii(i,d[_],d[_+1],a);c.add(M)}return c}},po.toIntArray=function(r){for(var i=new Array(r.size()).fill(null),a=0;a<i.length;a++)i[a]=r.get(a).intValue();return i};var Yi=function(){};Yi.prototype.computeNodes=function(r){},Yi.prototype.getNodedSubstrings=function(){},Yi.prototype.interfaces_=function(){return[]},Yi.prototype.getClass=function(){return Yi};var la=function(){if(this._segInt=null,arguments.length!==0){if(arguments.length===1){var r=arguments[0];this.setSegmentIntersector(r)}}};la.prototype.setSegmentIntersector=function(r){this._segInt=r},la.prototype.interfaces_=function(){return[Yi]},la.prototype.getClass=function(){return la};var hl=function(r){function i(c){c?r.call(this,c):r.call(this),this._monoChains=new G,this._index=new Mf,this._idCounter=0,this._nodedSegStrings=null,this._nOverlaps=0}r&&(i.__proto__=r),(i.prototype=Object.create(r&&r.prototype)).constructor=i;var a={SegmentOverlapAction:{configurable:!0}};return i.prototype.getMonotoneChains=function(){return this._monoChains},i.prototype.getNodedSubstrings=function(){return mr.getNodedSubstrings(this._nodedSegStrings)},i.prototype.getIndex=function(){return this._index},i.prototype.add=function(c){for(var d=po.getChains(c.getCoordinates(),c).iterator();d.hasNext();){var _=d.next();_.setId(this._idCounter++),this._index.insert(_.getEnvelope(),_),this._monoChains.add(_)}},i.prototype.computeNodes=function(c){this._nodedSegStrings=c;for(var d=c.iterator();d.hasNext();)this.add(d.next());this.intersectChains()},i.prototype.intersectChains=function(){for(var c=new Mr(this._segInt),d=this._monoChains.iterator();d.hasNext();)for(var _=d.next(),M=this._index.query(_.getEnvelope()).iterator();M.hasNext();){var L=M.next();if(L.getId()>_.getId()&&(_.computeOverlaps(L,c),this._nOverlaps++),this._segInt.isDone())return null}},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},a.SegmentOverlapAction.get=function(){return Mr},Object.defineProperties(i,a),i}(la),Mr=function(r){function i(){r.call(this),this._si=null;var a=arguments[0];this._si=a}return r&&(i.__proto__=r),i.prototype=Object.create(r&&r.prototype),i.prototype.constructor=i,i.prototype.overlap=function(){if(arguments.length!==4)return r.prototype.overlap.apply(this,arguments);var a=arguments[0],c=arguments[1],d=arguments[2],_=arguments[3],M=a.getContext(),L=d.getContext();this._si.processIntersections(M,c,L,_)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(Pi),Ge=function r(){if(this._quadrantSegments=r.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=r.CAP_ROUND,this._joinStyle=r.JOIN_ROUND,this._mitreLimit=r.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=r.DEFAULT_SIMPLIFY_FACTOR,arguments.length!==0){if(arguments.length===1){var i=arguments[0];this.setQuadrantSegments(i)}else if(arguments.length===2){var a=arguments[0],c=arguments[1];this.setQuadrantSegments(a),this.setEndCapStyle(c)}else if(arguments.length===4){var d=arguments[0],_=arguments[1],M=arguments[2],L=arguments[3];this.setQuadrantSegments(d),this.setEndCapStyle(_),this.setJoinStyle(M),this.setMitreLimit(L)}}},Oo={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}};Ge.prototype.getEndCapStyle=function(){return this._endCapStyle},Ge.prototype.isSingleSided=function(){return this._isSingleSided},Ge.prototype.setQuadrantSegments=function(r){this._quadrantSegments=r,this._quadrantSegments===0&&(this._joinStyle=Ge.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=Ge.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),r<=0&&(this._quadrantSegments=1),this._joinStyle!==Ge.JOIN_ROUND&&(this._quadrantSegments=Ge.DEFAULT_QUADRANT_SEGMENTS)},Ge.prototype.getJoinStyle=function(){return this._joinStyle},Ge.prototype.setJoinStyle=function(r){this._joinStyle=r},Ge.prototype.setSimplifyFactor=function(r){this._simplifyFactor=r<0?0:r},Ge.prototype.getSimplifyFactor=function(){return this._simplifyFactor},Ge.prototype.getQuadrantSegments=function(){return this._quadrantSegments},Ge.prototype.setEndCapStyle=function(r){this._endCapStyle=r},Ge.prototype.getMitreLimit=function(){return this._mitreLimit},Ge.prototype.setMitreLimit=function(r){this._mitreLimit=r},Ge.prototype.setSingleSided=function(r){this._isSingleSided=r},Ge.prototype.interfaces_=function(){return[]},Ge.prototype.getClass=function(){return Ge},Ge.bufferDistanceError=function(r){var i=Math.PI/2/r;return 1-Math.cos(i/2)},Oo.CAP_ROUND.get=function(){return 1},Oo.CAP_FLAT.get=function(){return 2},Oo.CAP_SQUARE.get=function(){return 3},Oo.JOIN_ROUND.get=function(){return 1},Oo.JOIN_MITRE.get=function(){return 2},Oo.JOIN_BEVEL.get=function(){return 3},Oo.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8},Oo.DEFAULT_MITRE_LIMIT.get=function(){return 5},Oo.DEFAULT_SIMPLIFY_FACTOR.get=function(){return .01},Object.defineProperties(Ge,Oo);var yr=function(r){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=dt.COUNTERCLOCKWISE,this._inputLine=r||null},Ga={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};yr.prototype.isDeletable=function(r,i,a,c){var d=this._inputLine[r],_=this._inputLine[i],M=this._inputLine[a];return!!this.isConcave(d,_,M)&&!!this.isShallow(d,_,M,c)&&this.isShallowSampled(d,_,r,a,c)},yr.prototype.deleteShallowConcavities=function(){for(var r=1,i=this.findNextNonDeletedIndex(r),a=this.findNextNonDeletedIndex(i),c=!1;a<this._inputLine.length;){var d=!1;this.isDeletable(r,i,a,this._distanceTol)&&(this._isDeleted[i]=yr.DELETE,d=!0,c=!0),r=d?a:i,i=this.findNextNonDeletedIndex(r),a=this.findNextNonDeletedIndex(i)}return c},yr.prototype.isShallowConcavity=function(r,i,a,c){return dt.computeOrientation(r,i,a)!==this._angleOrientation?!1:dt.distancePointLine(i,r,a)<c},yr.prototype.isShallowSampled=function(r,i,a,c,d){var _=Math.trunc((c-a)/yr.NUM_PTS_TO_CHECK);_<=0&&(_=1);for(var M=a;M<c;M+=_)if(!this.isShallow(r,i,this._inputLine[M],d))return!1;return!0},yr.prototype.isConcave=function(r,i,a){var c=dt.computeOrientation(r,i,a)===this._angleOrientation;return c},yr.prototype.simplify=function(r){this._distanceTol=Math.abs(r),r<0&&(this._angleOrientation=dt.CLOCKWISE),this._isDeleted=new Array(this._inputLine.length).fill(null);var i=!1;do i=this.deleteShallowConcavities();while(i);return this.collapseLine()},yr.prototype.findNextNonDeletedIndex=function(r){for(var i=r+1;i<this._inputLine.length&&this._isDeleted[i]===yr.DELETE;)i++;return i},yr.prototype.isShallow=function(r,i,a,c){return dt.distancePointLine(i,r,a)<c},yr.prototype.collapseLine=function(){for(var r=new et,i=0;i<this._inputLine.length;i++)this._isDeleted[i]!==yr.DELETE&&r.add(this._inputLine[i]);return r.toCoordinateArray()},yr.prototype.interfaces_=function(){return[]},yr.prototype.getClass=function(){return yr},yr.simplify=function(r,i){return new yr(r).simplify(i)},Ga.INIT.get=function(){return 0},Ga.DELETE.get=function(){return 1},Ga.KEEP.get=function(){return 1},Ga.NUM_PTS_TO_CHECK.get=function(){return 10},Object.defineProperties(yr,Ga);var $i=function(){this._ptList=null,this._precisionModel=null,this._minimimVertexDistance=0,this._ptList=new G},qh={COORDINATE_ARRAY_TYPE:{configurable:!0}};$i.prototype.getCoordinates=function(){return this._ptList.toArray($i.COORDINATE_ARRAY_TYPE)},$i.prototype.setPrecisionModel=function(r){this._precisionModel=r},$i.prototype.addPt=function(r){var i=new D(r);if(this._precisionModel.makePrecise(i),this.isRedundant(i))return null;this._ptList.add(i)},$i.prototype.revere=function(){},$i.prototype.addPts=function(r,i){if(i)for(var a=0;a<r.length;a++)this.addPt(r[a]);else for(var c=r.length-1;c>=0;c--)this.addPt(r[c])},$i.prototype.isRedundant=function(r){if(this._ptList.size()<1)return!1;var i=this._ptList.get(this._ptList.size()-1);return r.distance(i)<this._minimimVertexDistance},$i.prototype.toString=function(){return new Le().createLineString(this.getCoordinates()).toString()},$i.prototype.closeRing=function(){if(this._ptList.size()<1)return null;var r=new D(this._ptList.get(0)),i=this._ptList.get(this._ptList.size()-1);if(r.equals(i))return null;this._ptList.add(r)},$i.prototype.setMinimumVertexDistance=function(r){this._minimimVertexDistance=r},$i.prototype.interfaces_=function(){return[]},$i.prototype.getClass=function(){return $i},qh.COORDINATE_ARRAY_TYPE.get=function(){return new Array(0).fill(null)},Object.defineProperties($i,qh);var He=function(){},ca={PI_TIMES_2:{configurable:!0},PI_OVER_2:{configurable:!0},PI_OVER_4:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},CLOCKWISE:{configurable:!0},NONE:{configurable:!0}};He.prototype.interfaces_=function(){return[]},He.prototype.getClass=function(){return He},He.toDegrees=function(r){return 180*r/Math.PI},He.normalize=function(r){for(;r>Math.PI;)r-=He.PI_TIMES_2;for(;r<=-Math.PI;)r+=He.PI_TIMES_2;return r},He.angle=function(){if(arguments.length===1){var r=arguments[0];return Math.atan2(r.y,r.x)}if(arguments.length===2){var i=arguments[0],a=arguments[1],c=a.x-i.x,d=a.y-i.y;return Math.atan2(d,c)}},He.isAcute=function(r,i,a){var c=r.x-i.x,d=r.y-i.y;return c*(a.x-i.x)+d*(a.y-i.y)>0},He.isObtuse=function(r,i,a){var c=r.x-i.x,d=r.y-i.y;return c*(a.x-i.x)+d*(a.y-i.y)<0},He.interiorAngle=function(r,i,a){var c=He.angle(i,r),d=He.angle(i,a);return Math.abs(d-c)},He.normalizePositive=function(r){if(r<0){for(;r<0;)r+=He.PI_TIMES_2;r>=He.PI_TIMES_2&&(r=0)}else{for(;r>=He.PI_TIMES_2;)r-=He.PI_TIMES_2;r<0&&(r=0)}return r},He.angleBetween=function(r,i,a){var c=He.angle(i,r),d=He.angle(i,a);return He.diff(c,d)},He.diff=function(r,i){var a=null;return(a=r<i?i-r:r-i)>Math.PI&&(a=2*Math.PI-a),a},He.toRadians=function(r){return r*Math.PI/180},He.getTurn=function(r,i){var a=Math.sin(i-r);return a>0?He.COUNTERCLOCKWISE:a<0?He.CLOCKWISE:He.NONE},He.angleBetweenOriented=function(r,i,a){var c=He.angle(i,r),d=He.angle(i,a)-c;return d<=-Math.PI?d+He.PI_TIMES_2:d>Math.PI?d-He.PI_TIMES_2:d},ca.PI_TIMES_2.get=function(){return 2*Math.PI},ca.PI_OVER_2.get=function(){return Math.PI/2},ca.PI_OVER_4.get=function(){return Math.PI/4},ca.COUNTERCLOCKWISE.get=function(){return dt.COUNTERCLOCKWISE},ca.CLOCKWISE.get=function(){return dt.CLOCKWISE},ca.NONE.get=function(){return dt.COLLINEAR},Object.defineProperties(He,ca);var Kn=function r(){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 ie,this._seg1=new ie,this._offset0=new ie,this._offset1=new ie,this._side=0,this._hasNarrowConcaveAngle=!1;var i=arguments[0],a=arguments[1],c=arguments[2];this._precisionModel=i,this._bufParams=a,this._li=new z,this._filletAngleQuantum=Math.PI/2/a.getQuadrantSegments(),a.getQuadrantSegments()>=8&&a.getJoinStyle()===Ge.JOIN_ROUND&&(this._closingSegLengthFactor=r.MAX_CLOSING_SEG_LEN_FACTOR),this.init(c)},xs={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}};Kn.prototype.addNextSegment=function(r,i){if(this._s0=this._s1,this._s1=this._s2,this._s2=r,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 a=dt.computeOrientation(this._s0,this._s1,this._s2),c=a===dt.CLOCKWISE&&this._side===Xt.LEFT||a===dt.COUNTERCLOCKWISE&&this._side===Xt.RIGHT;a===0?this.addCollinear(i):c?this.addOutsideTurn(a,i):this.addInsideTurn(a,i)},Kn.prototype.addLineEndCap=function(r,i){var a=new ie(r,i),c=new ie;this.computeOffsetSegment(a,Xt.LEFT,this._distance,c);var d=new ie;this.computeOffsetSegment(a,Xt.RIGHT,this._distance,d);var _=i.x-r.x,M=i.y-r.y,L=Math.atan2(M,_);switch(this._bufParams.getEndCapStyle()){case Ge.CAP_ROUND:this._segList.addPt(c.p1),this.addFilletArc(i,L+Math.PI/2,L-Math.PI/2,dt.CLOCKWISE,this._distance),this._segList.addPt(d.p1);break;case Ge.CAP_FLAT:this._segList.addPt(c.p1),this._segList.addPt(d.p1);break;case Ge.CAP_SQUARE:var H=new D;H.x=Math.abs(this._distance)*Math.cos(L),H.y=Math.abs(this._distance)*Math.sin(L);var it=new D(c.p1.x+H.x,c.p1.y+H.y),bt=new D(d.p1.x+H.x,d.p1.y+H.y);this._segList.addPt(it),this._segList.addPt(bt)}},Kn.prototype.getCoordinates=function(){return this._segList.getCoordinates()},Kn.prototype.addMitreJoin=function(r,i,a,c){var d=!0,_=null;try{_=$t.intersection(i.p0,i.p1,a.p0,a.p1),(c<=0?1:_.distance(r)/Math.abs(c))>this._bufParams.getMitreLimit()&&(d=!1)}catch(M){if(!(M instanceof ce))throw M;_=new D(0,0),d=!1}d?this._segList.addPt(_):this.addLimitedMitreJoin(i,a,c,this._bufParams.getMitreLimit())},Kn.prototype.addFilletCorner=function(r,i,a,c,d){var _=i.x-r.x,M=i.y-r.y,L=Math.atan2(M,_),H=a.x-r.x,it=a.y-r.y,bt=Math.atan2(it,H);c===dt.CLOCKWISE?L<=bt&&(L+=2*Math.PI):L>=bt&&(L-=2*Math.PI),this._segList.addPt(i),this.addFilletArc(r,L,bt,c,d),this._segList.addPt(a)},Kn.prototype.addOutsideTurn=function(r,i){if(this._offset0.p1.distance(this._offset1.p0)<this._distance*Kn.OFFSET_SEGMENT_SEPARATION_FACTOR)return this._segList.addPt(this._offset0.p1),null;this._bufParams.getJoinStyle()===Ge.JOIN_MITRE?this.addMitreJoin(this._s1,this._offset0,this._offset1,this._distance):this._bufParams.getJoinStyle()===Ge.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,r,this._distance),this._segList.addPt(this._offset1.p0))},Kn.prototype.createSquare=function(r){this._segList.addPt(new D(r.x+this._distance,r.y+this._distance)),this._segList.addPt(new D(r.x+this._distance,r.y-this._distance)),this._segList.addPt(new D(r.x-this._distance,r.y-this._distance)),this._segList.addPt(new D(r.x-this._distance,r.y+this._distance)),this._segList.closeRing()},Kn.prototype.addSegments=function(r,i){this._segList.addPts(r,i)},Kn.prototype.addFirstSegment=function(){this._segList.addPt(this._offset1.p0)},Kn.prototype.addLastSegment=function(){this._segList.addPt(this._offset1.p1)},Kn.prototype.initSideSegments=function(r,i,a){this._s1=r,this._s2=i,this._side=a,this._seg1.setCoordinates(r,i),this.computeOffsetSegment(this._seg1,a,this._distance,this._offset1)},Kn.prototype.addLimitedMitreJoin=function(r,i,a,c){var d=this._seg0.p1,_=He.angle(d,this._seg0.p0),M=He.angleBetweenOriented(this._seg0.p0,d,this._seg1.p1)/2,L=He.normalize(_+M),H=He.normalize(L+Math.PI),it=c*a,bt=a-it*Math.abs(Math.sin(M)),Tt=d.x+it*Math.cos(H),Kt=d.y+it*Math.sin(H),Qt=new D(Tt,Kt),le=new ie(d,Qt),Ee=le.pointAlongOffset(1,bt),Dn=le.pointAlongOffset(1,-bt);this._side===Xt.LEFT?(this._segList.addPt(Ee),this._segList.addPt(Dn)):(this._segList.addPt(Dn),this._segList.addPt(Ee))},Kn.prototype.computeOffsetSegment=function(r,i,a,c){var d=i===Xt.LEFT?1:-1,_=r.p1.x-r.p0.x,M=r.p1.y-r.p0.y,L=Math.sqrt(_*_+M*M),H=d*a*_/L,it=d*a*M/L;c.p0.x=r.p0.x-it,c.p0.y=r.p0.y+H,c.p1.x=r.p1.x-it,c.p1.y=r.p1.y+H},Kn.prototype.addFilletArc=function(r,i,a,c,d){var _=c===dt.CLOCKWISE?-1:1,M=Math.abs(i-a),L=Math.trunc(M/this._filletAngleQuantum+.5);if(L<1)return null;for(var H=M/L,it=0,bt=new D;it<M;){var Tt=i+_*it;bt.x=r.x+d*Math.cos(Tt),bt.y=r.y+d*Math.sin(Tt),this._segList.addPt(bt),it+=H}},Kn.prototype.addInsideTurn=function(r,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*Kn.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR)this._segList.addPt(this._offset0.p1);else{if(this._segList.addPt(this._offset0.p1),this._closingSegLengthFactor>0){var a=new D((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(a);var c=new D((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(c)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}},Kn.prototype.createCircle=function(r){var i=new D(r.x+this._distance,r.y);this._segList.addPt(i),this.addFilletArc(r,0,2*Math.PI,-1,this._distance),this._segList.closeRing()},Kn.prototype.addBevelJoin=function(r,i){this._segList.addPt(r.p1),this._segList.addPt(i.p0)},Kn.prototype.init=function(r){this._distance=r,this._maxCurveSegmentError=r*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new $i,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(r*Kn.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)},Kn.prototype.addCollinear=function(r){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2),this._li.getIntersectionNum()>=2&&(this._bufParams.getJoinStyle()===Ge.JOIN_BEVEL||this._bufParams.getJoinStyle()===Ge.JOIN_MITRE?(r&&this._segList.addPt(this._offset0.p1),this._segList.addPt(this._offset1.p0)):this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,dt.CLOCKWISE,this._distance))},Kn.prototype.closeRing=function(){this._segList.closeRing()},Kn.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle},Kn.prototype.interfaces_=function(){return[]},Kn.prototype.getClass=function(){return Kn},xs.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return .001},xs.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return .001},xs.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6},xs.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80},Object.defineProperties(Kn,xs);var pi=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var r=arguments[0],i=arguments[1];this._precisionModel=r,this._bufParams=i};pi.prototype.getOffsetCurve=function(r,i){if(this._distance=i,i===0)return null;var a=i<0,c=Math.abs(i),d=this.getSegGen(c);r.length<=1?this.computePointCurve(r[0],d):this.computeOffsetCurve(r,a,d);var _=d.getCoordinates();return a&&lt.reverse(_),_},pi.prototype.computeSingleSidedBufferCurve=function(r,i,a){var c=this.simplifyTolerance(this._distance);if(i){a.addSegments(r,!0);var d=yr.simplify(r,-c),_=d.length-1;a.initSideSegments(d[_],d[_-1],Xt.LEFT),a.addFirstSegment();for(var M=_-2;M>=0;M--)a.addNextSegment(d[M],!0)}else{a.addSegments(r,!1);var L=yr.simplify(r,c),H=L.length-1;a.initSideSegments(L[0],L[1],Xt.LEFT),a.addFirstSegment();for(var it=2;it<=H;it++)a.addNextSegment(L[it],!0)}a.addLastSegment(),a.closeRing()},pi.prototype.computeRingBufferCurve=function(r,i,a){var c=this.simplifyTolerance(this._distance);i===Xt.RIGHT&&(c=-c);var d=yr.simplify(r,c),_=d.length-1;a.initSideSegments(d[_-1],d[0],i);for(var M=1;M<=_;M++){var L=M!==1;a.addNextSegment(d[M],L)}a.closeRing()},pi.prototype.computeLineBufferCurve=function(r,i){var a=this.simplifyTolerance(this._distance),c=yr.simplify(r,a),d=c.length-1;i.initSideSegments(c[0],c[1],Xt.LEFT);for(var _=2;_<=d;_++)i.addNextSegment(c[_],!0);i.addLastSegment(),i.addLineEndCap(c[d-1],c[d]);var M=yr.simplify(r,-a),L=M.length-1;i.initSideSegments(M[L],M[L-1],Xt.LEFT);for(var H=L-2;H>=0;H--)i.addNextSegment(M[H],!0);i.addLastSegment(),i.addLineEndCap(M[1],M[0]),i.closeRing()},pi.prototype.computePointCurve=function(r,i){switch(this._bufParams.getEndCapStyle()){case Ge.CAP_ROUND:i.createCircle(r);break;case Ge.CAP_SQUARE:i.createSquare(r)}},pi.prototype.getLineCurve=function(r,i){if(this._distance=i,i<0&&!this._bufParams.isSingleSided()||i===0)return null;var a=Math.abs(i),c=this.getSegGen(a);if(r.length<=1)this.computePointCurve(r[0],c);else if(this._bufParams.isSingleSided()){var d=i<0;this.computeSingleSidedBufferCurve(r,d,c)}else this.computeLineBufferCurve(r,c);return c.getCoordinates()},pi.prototype.getBufferParameters=function(){return this._bufParams},pi.prototype.simplifyTolerance=function(r){return r*this._bufParams.getSimplifyFactor()},pi.prototype.getRingCurve=function(r,i,a){if(this._distance=a,r.length<=2)return this.getLineCurve(r,a);if(a===0)return pi.copyCoordinates(r);var c=this.getSegGen(a);return this.computeRingBufferCurve(r,i,c),c.getCoordinates()},pi.prototype.computeOffsetCurve=function(r,i,a){var c=this.simplifyTolerance(this._distance);if(i){var d=yr.simplify(r,-c),_=d.length-1;a.initSideSegments(d[_],d[_-1],Xt.LEFT),a.addFirstSegment();for(var M=_-2;M>=0;M--)a.addNextSegment(d[M],!0)}else{var L=yr.simplify(r,c),H=L.length-1;a.initSideSegments(L[0],L[1],Xt.LEFT),a.addFirstSegment();for(var it=2;it<=H;it++)a.addNextSegment(L[it],!0)}a.addLastSegment()},pi.prototype.getSegGen=function(r){return new Kn(this._precisionModel,this._bufParams,r)},pi.prototype.interfaces_=function(){return[]},pi.prototype.getClass=function(){return pi},pi.copyCoordinates=function(r){for(var i=new Array(r.length).fill(null),a=0;a<i.length;a++)i[a]=new D(r[a]);return i};var fa=function(){this._subgraphs=null,this._seg=new ie,this._cga=new dt;var r=arguments[0];this._subgraphs=r},bf={DepthSegment:{configurable:!0}};fa.prototype.findStabbedSegments=function(){if(arguments.length===1){for(var r=arguments[0],i=new G,a=this._subgraphs.iterator();a.hasNext();){var c=a.next(),d=c.getEnvelope();r.y<d.getMinY()||r.y>d.getMaxY()||this.findStabbedSegments(r,c.getDirectedEdges(),i)}return i}if(arguments.length===3){if(Q(arguments[2],Et)&&arguments[0]instanceof D&&arguments[1]instanceof wf){for(var _=arguments[0],M=arguments[1],L=arguments[2],H=M.getEdge().getCoordinates(),it=0;it<H.length-1;it++)if(this._seg.p0=H[it],this._seg.p1=H[it+1],this._seg.p0.y>this._seg.p1.y&&this._seg.reverse(),!(Math.max(this._seg.p0.x,this._seg.p1.x)<_.x)&&!(this._seg.isHorizontal()||_.y<this._seg.p0.y||_.y>this._seg.p1.y||dt.computeOrientation(this._seg.p0,this._seg.p1,_)===dt.RIGHT)){var bt=M.getDepth(Xt.LEFT);this._seg.p0.equals(H[it])||(bt=M.getDepth(Xt.RIGHT));var Tt=new Es(this._seg,bt);L.add(Tt)}}else if(Q(arguments[2],Et)&&arguments[0]instanceof D&&Q(arguments[1],Et))for(var Kt=arguments[0],Qt=arguments[1],le=arguments[2],Ee=Qt.iterator();Ee.hasNext();){var Dn=Ee.next();Dn.isForward()&&this.findStabbedSegments(Kt,Dn,le)}}},fa.prototype.getDepth=function(r){var i=this.findStabbedSegments(r);return i.size()===0?0:ho.min(i)._leftDepth},fa.prototype.interfaces_=function(){return[]},fa.prototype.getClass=function(){return fa},bf.DepthSegment.get=function(){return Es},Object.defineProperties(fa,bf);var Es=function(){this._upwardSeg=null,this._leftDepth=null;var r=arguments[0],i=arguments[1];this._upwardSeg=new ie(r),this._leftDepth=i};Es.prototype.compareTo=function(r){var i=r;if(this._upwardSeg.minX()>=i._upwardSeg.maxX())return 1;if(this._upwardSeg.maxX()<=i._upwardSeg.minX())return-1;var a=this._upwardSeg.orientationIndex(i._upwardSeg);return a!==0||(a=-1*i._upwardSeg.orientationIndex(this._upwardSeg))!=0?a:this._upwardSeg.compareTo(i._upwardSeg)},Es.prototype.compareX=function(r,i){var a=r.p0.compareTo(i.p0);return a!==0?a:r.p1.compareTo(i.p1)},Es.prototype.toString=function(){return this._upwardSeg.toString()},Es.prototype.interfaces_=function(){return[V]},Es.prototype.getClass=function(){return Es};var Ze=function(r,i,a){this.p0=r||null,this.p1=i||null,this.p2=a||null};Ze.prototype.area=function(){return Ze.area(this.p0,this.p1,this.p2)},Ze.prototype.signedArea=function(){return Ze.signedArea(this.p0,this.p1,this.p2)},Ze.prototype.interpolateZ=function(r){if(r===null)throw new I("Supplied point is null.");return Ze.interpolateZ(r,this.p0,this.p1,this.p2)},Ze.prototype.longestSideLength=function(){return Ze.longestSideLength(this.p0,this.p1,this.p2)},Ze.prototype.isAcute=function(){return Ze.isAcute(this.p0,this.p1,this.p2)},Ze.prototype.circumcentre=function(){return Ze.circumcentre(this.p0,this.p1,this.p2)},Ze.prototype.area3D=function(){return Ze.area3D(this.p0,this.p1,this.p2)},Ze.prototype.centroid=function(){return Ze.centroid(this.p0,this.p1,this.p2)},Ze.prototype.inCentre=function(){return Ze.inCentre(this.p0,this.p1,this.p2)},Ze.prototype.interfaces_=function(){return[]},Ze.prototype.getClass=function(){return Ze},Ze.area=function(r,i,a){return Math.abs(((a.x-r.x)*(i.y-r.y)-(i.x-r.x)*(a.y-r.y))/2)},Ze.signedArea=function(r,i,a){return((a.x-r.x)*(i.y-r.y)-(i.x-r.x)*(a.y-r.y))/2},Ze.det=function(r,i,a,c){return r*c-i*a},Ze.interpolateZ=function(r,i,a,c){var d=i.x,_=i.y,M=a.x-d,L=c.x-d,H=a.y-_,it=c.y-_,bt=M*it-L*H,Tt=r.x-d,Kt=r.y-_,Qt=(it*Tt-L*Kt)/bt,le=(-H*Tt+M*Kt)/bt;return i.z+Qt*(a.z-i.z)+le*(c.z-i.z)},Ze.longestSideLength=function(r,i,a){var c=r.distance(i),d=i.distance(a),_=a.distance(r),M=c;return d>M&&(M=d),_>M&&(M=_),M},Ze.isAcute=function(r,i,a){return!!He.isAcute(r,i,a)&&!!He.isAcute(i,a,r)&&!!He.isAcute(a,r,i)},Ze.circumcentre=function(r,i,a){var c=a.x,d=a.y,_=r.x-c,M=r.y-d,L=i.x-c,H=i.y-d,it=2*Ze.det(_,M,L,H),bt=Ze.det(M,_*_+M*M,H,L*L+H*H),Tt=Ze.det(_,_*_+M*M,L,L*L+H*H);return new D(c-bt/it,d+Tt/it)},Ze.perpendicularBisector=function(r,i){var a=i.x-r.x,c=i.y-r.y,d=new $t(r.x+a/2,r.y+c/2,1),_=new $t(r.x-c+a/2,r.y+a+c/2,1);return new $t(d,_)},Ze.angleBisector=function(r,i,a){var c=i.distance(r),d=c/(c+i.distance(a)),_=a.x-r.x,M=a.y-r.y;return new D(r.x+d*_,r.y+d*M)},Ze.area3D=function(r,i,a){var c=i.x-r.x,d=i.y-r.y,_=i.z-r.z,M=a.x-r.x,L=a.y-r.y,H=a.z-r.z,it=d*H-_*L,bt=_*M-c*H,Tt=c*L-d*M,Kt=it*it+bt*bt+Tt*Tt,Qt=Math.sqrt(Kt)/2;return Qt},Ze.centroid=function(r,i,a){var c=(r.x+i.x+a.x)/3,d=(r.y+i.y+a.y)/3;return new D(c,d)},Ze.inCentre=function(r,i,a){var c=i.distance(a),d=r.distance(a),_=r.distance(i),M=c+d+_,L=(c*r.x+d*i.x+_*a.x)/M,H=(c*r.y+d*i.y+_*a.y)/M;return new D(L,H)};var Zi=function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new G;var r=arguments[0],i=arguments[1],a=arguments[2];this._inputGeom=r,this._distance=i,this._curveBuilder=a};Zi.prototype.addPoint=function(r){if(this._distance<=0)return null;var i=r.getCoordinates(),a=this._curveBuilder.getLineCurve(i,this._distance);this.addCurve(a,K.EXTERIOR,K.INTERIOR)},Zi.prototype.addPolygon=function(r){var i=this._distance,a=Xt.LEFT;this._distance<0&&(i=-this._distance,a=Xt.RIGHT);var c=r.getExteriorRing(),d=lt.removeRepeatedPoints(c.getCoordinates());if(this._distance<0&&this.isErodedCompletely(c,this._distance)||this._distance<=0&&d.length<3)return null;this.addPolygonRing(d,i,a,K.EXTERIOR,K.INTERIOR);for(var _=0;_<r.getNumInteriorRing();_++){var M=r.getInteriorRingN(_),L=lt.removeRepeatedPoints(M.getCoordinates());this._distance>0&&this.isErodedCompletely(M,-this._distance)||this.addPolygonRing(L,i,Xt.opposite(a),K.INTERIOR,K.EXTERIOR)}},Zi.prototype.isTriangleErodedCompletely=function(r,i){var a=new Ze(r[0],r[1],r[2]),c=a.inCentre();return dt.distancePointLine(c,a.p0,a.p1)<Math.abs(i)},Zi.prototype.addLineString=function(r){if(this._distance<=0&&!this._curveBuilder.getBufferParameters().isSingleSided())return null;var i=lt.removeRepeatedPoints(r.getCoordinates()),a=this._curveBuilder.getLineCurve(i,this._distance);this.addCurve(a,K.EXTERIOR,K.INTERIOR)},Zi.prototype.addCurve=function(r,i,a){if(r===null||r.length<2)return null;var c=new mr(r,new On(0,K.BOUNDARY,i,a));this._curveList.add(c)},Zi.prototype.getCurves=function(){return this.add(this._inputGeom),this._curveList},Zi.prototype.addPolygonRing=function(r,i,a,c,d){if(i===0&&r.length<Ae.MINIMUM_VALID_SIZE)return null;var _=c,M=d;r.length>=Ae.MINIMUM_VALID_SIZE&&dt.isCCW(r)&&(_=d,M=c,a=Xt.opposite(a));var L=this._curveBuilder.getRingCurve(r,a,i);this.addCurve(L,_,M)},Zi.prototype.add=function(r){if(r.isEmpty())return null;r instanceof de?this.addPolygon(r):r instanceof vt?this.addLineString(r):r instanceof ue?this.addPoint(r):r instanceof Be?this.addCollection(r):r instanceof bi?this.addCollection(r):r instanceof Pe?this.addCollection(r):r instanceof Qn&&this.addCollection(r)},Zi.prototype.isErodedCompletely=function(r,i){var a=r.getCoordinates();if(a.length<4)return i<0;if(a.length===4)return this.isTriangleErodedCompletely(a,i);var c=r.getEnvelopeInternal(),d=Math.min(c.getHeight(),c.getWidth());return i<0&&2*Math.abs(i)>d},Zi.prototype.addCollection=function(r){for(var i=0;i<r.getNumGeometries();i++){var a=r.getGeometryN(i);this.add(a)}},Zi.prototype.interfaces_=function(){return[]},Zi.prototype.getClass=function(){return Zi};var _u=function(){};_u.prototype.locate=function(r){},_u.prototype.interfaces_=function(){return[]},_u.prototype.getClass=function(){return _u};var go=function(){this._parent=null,this._atStart=null,this._max=null,this._index=null,this._subcollectionIterator=null;var r=arguments[0];this._parent=r,this._atStart=!0,this._index=0,this._max=r.getNumGeometries()};go.prototype.next=function(){if(this._atStart)return this._atStart=!1,go.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 r=this._parent.getGeometryN(this._index++);return r instanceof Qn?(this._subcollectionIterator=new go(r),this._subcollectionIterator.next()):r},go.prototype.remove=function(){throw new Error(this.getClass().getName())},go.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)},go.prototype.interfaces_=function(){return[wt]},go.prototype.getClass=function(){return go},go.isAtomic=function(r){return!(r instanceof Qn)};var di=function(){this._geom=null;var r=arguments[0];this._geom=r};di.prototype.locate=function(r){return di.locate(r,this._geom)},di.prototype.interfaces_=function(){return[_u]},di.prototype.getClass=function(){return di},di.isPointInRing=function(r,i){return!!i.getEnvelopeInternal().intersects(r)&&dt.isPointInRing(r,i.getCoordinates())},di.containsPointInPolygon=function(r,i){if(i.isEmpty())return!1;var a=i.getExteriorRing();if(!di.isPointInRing(r,a))return!1;for(var c=0;c<i.getNumInteriorRing();c++){var d=i.getInteriorRingN(c);if(di.isPointInRing(r,d))return!1}return!0},di.containsPoint=function(r,i){if(i instanceof de)return di.containsPointInPolygon(r,i);if(i instanceof Qn)for(var a=new go(i);a.hasNext();){var c=a.next();if(c!==i&&di.containsPoint(r,c))return!0}return!1},di.locate=function(r,i){return i.isEmpty()?K.EXTERIOR:di.containsPoint(r,i)?K.INTERIOR:K.EXTERIOR};var ti=function(){this._edgeMap=new w,this._edgeList=null,this._ptInAreaLocation=[K.NONE,K.NONE]};ti.prototype.getNextCW=function(r){this.getEdges();var i=this._edgeList.indexOf(r),a=i-1;return i===0&&(a=this._edgeList.size()-1),this._edgeList.get(a)},ti.prototype.propagateSideLabels=function(r){for(var i=K.NONE,a=this.iterator();a.hasNext();){var c=a.next().getLabel();c.isArea(r)&&c.getLocation(r,Xt.LEFT)!==K.NONE&&(i=c.getLocation(r,Xt.LEFT))}if(i===K.NONE)return null;for(var d=i,_=this.iterator();_.hasNext();){var M=_.next(),L=M.getLabel();if(L.getLocation(r,Xt.ON)===K.NONE&&L.setLocation(r,Xt.ON,d),L.isArea(r)){var H=L.getLocation(r,Xt.LEFT),it=L.getLocation(r,Xt.RIGHT);if(it!==K.NONE){if(it!==d)throw new Qo("side location conflict",M.getCoordinate());H===K.NONE&&Wt.shouldNeverReachHere("found single null side (at "+M.getCoordinate()+")"),d=H}else Wt.isTrue(L.getLocation(r,Xt.LEFT)===K.NONE,"found single null side"),L.setLocation(r,Xt.RIGHT,d),L.setLocation(r,Xt.LEFT,d)}}},ti.prototype.getCoordinate=function(){var r=this.iterator();return r.hasNext()?r.next().getCoordinate():null},ti.prototype.print=function(r){te.out.println("EdgeEndStar: "+this.getCoordinate());for(var i=this.iterator();i.hasNext();)i.next().print(r)},ti.prototype.isAreaLabelsConsistent=function(r){return this.computeEdgeEndLabels(r.getBoundaryNodeRule()),this.checkAreaLabelsConsistent(0)},ti.prototype.checkAreaLabelsConsistent=function(r){var i=this.getEdges();if(i.size()<=0)return!0;var a=i.size()-1,c=i.get(a).getLabel().getLocation(r,Xt.LEFT);Wt.isTrue(c!==K.NONE,"Found unlabelled area edge");for(var d=c,_=this.iterator();_.hasNext();){var M=_.next().getLabel();Wt.isTrue(M.isArea(r),"Found non-area edge");var L=M.getLocation(r,Xt.LEFT),H=M.getLocation(r,Xt.RIGHT);if(L===H||H!==d)return!1;d=L}return!0},ti.prototype.findIndex=function(r){this.iterator();for(var i=0;i<this._edgeList.size();i++)if(this._edgeList.get(i)===r)return i;return-1},ti.prototype.iterator=function(){return this.getEdges().iterator()},ti.prototype.getEdges=function(){return this._edgeList===null&&(this._edgeList=new G(this._edgeMap.values())),this._edgeList},ti.prototype.getLocation=function(r,i,a){return this._ptInAreaLocation[r]===K.NONE&&(this._ptInAreaLocation[r]=di.locate(i,a[r].getGeometry())),this._ptInAreaLocation[r]},ti.prototype.toString=function(){var r=new Lt;r.append("EdgeEndStar: "+this.getCoordinate()),r.append(`
5
+ `}[r]};var $t=function r(){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 a=arguments[0],c=arguments[1];this.x=a,this.y=c,this.w=1}else if(arguments[0]instanceof r&&arguments[1]instanceof r){var d=arguments[0],_=arguments[1];this.x=d.y*_.w-_.y*d.w,this.y=_.x*d.w-d.x*_.w,this.w=d.x*_.y-_.x*d.y}else if(arguments[0]instanceof D&&arguments[1]instanceof D){var M=arguments[0],L=arguments[1];this.x=M.y-L.y,this.y=L.x-M.x,this.w=M.x*L.y-L.x*M.y}}else if(arguments.length===3){var H=arguments[0],it=arguments[1],bt=arguments[2];this.x=H,this.y=it,this.w=bt}else if(arguments.length===4){var Tt=arguments[0],Kt=arguments[1],Qt=arguments[2],le=arguments[3],Ee=Tt.y-Kt.y,Dn=Kt.x-Tt.x,Jn=Tt.x*Kt.y-Kt.x*Tt.y,fi=Qt.y-le.y,as=le.x-Qt.x,qs=Qt.x*le.y-le.x*Qt.y;this.x=Dn*qs-as*Jn,this.y=fi*Jn-Ee*qs,this.w=Ee*as-fi*Dn}};$t.prototype.getY=function(){var r=this.y/this.w;if(A.isNaN(r)||A.isInfinite(r))throw new ce;return r},$t.prototype.getX=function(){var r=this.x/this.w;if(A.isNaN(r)||A.isInfinite(r))throw new ce;return r},$t.prototype.getCoordinate=function(){var r=new D;return r.x=this.getX(),r.y=this.getY(),r},$t.prototype.interfaces_=function(){return[]},$t.prototype.getClass=function(){return $t},$t.intersection=function(r,i,a,c){var d=r.y-i.y,_=i.x-r.x,M=r.x*i.y-i.x*r.y,L=a.y-c.y,H=c.x-a.x,it=a.x*c.y-c.x*a.y,bt=d*H-L*_,Tt=(_*it-H*M)/bt,Kt=(L*M-d*it)/bt;if(A.isNaN(Tt)||A.isInfinite(Tt)||A.isNaN(Kt)||A.isInfinite(Kt))throw new ce;return new D(Tt,Kt)};var qt=function r(){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 D){var i=arguments[0];this.init(i.x,i.x,i.y,i.y)}else if(arguments[0]instanceof r){var a=arguments[0];this.init(a)}}else if(arguments.length===2){var c=arguments[0],d=arguments[1];this.init(c.x,d.x,c.y,d.y)}else if(arguments.length===4){var _=arguments[0],M=arguments[1],L=arguments[2],H=arguments[3];this.init(_,M,L,H)}},xe={serialVersionUID:{configurable:!0}};qt.prototype.getArea=function(){return this.getWidth()*this.getHeight()},qt.prototype.equals=function(r){if(!(r instanceof qt))return!1;var i=r;return this.isNull()?i.isNull():this._maxx===i.getMaxX()&&this._maxy===i.getMaxY()&&this._minx===i.getMinX()&&this._miny===i.getMinY()},qt.prototype.intersection=function(r){if(this.isNull()||r.isNull()||!this.intersects(r))return new qt;var i=this._minx>r._minx?this._minx:r._minx,a=this._miny>r._miny?this._miny:r._miny,c=this._maxx<r._maxx?this._maxx:r._maxx,d=this._maxy<r._maxy?this._maxy:r._maxy;return new qt(i,c,a,d)},qt.prototype.isNull=function(){return this._maxx<this._minx},qt.prototype.getMaxX=function(){return this._maxx},qt.prototype.covers=function(){if(arguments.length===1){if(arguments[0]instanceof D){var r=arguments[0];return this.covers(r.x,r.y)}if(arguments[0]instanceof qt){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 a=arguments[0],c=arguments[1];return!this.isNull()&&a>=this._minx&&a<=this._maxx&&c>=this._miny&&c<=this._maxy}},qt.prototype.intersects=function(){if(arguments.length===1){if(arguments[0]instanceof qt){var r=arguments[0];return!this.isNull()&&!r.isNull()&&!(r._minx>this._maxx||r._maxx<this._minx||r._miny>this._maxy||r._maxy<this._miny)}if(arguments[0]instanceof D){var i=arguments[0];return this.intersects(i.x,i.y)}}else if(arguments.length===2){var a=arguments[0],c=arguments[1];return!this.isNull()&&!(a>this._maxx||a<this._minx||c>this._maxy||c<this._miny)}},qt.prototype.getMinY=function(){return this._miny},qt.prototype.getMinX=function(){return this._minx},qt.prototype.expandToInclude=function(){if(arguments.length===1){if(arguments[0]instanceof D){var r=arguments[0];this.expandToInclude(r.x,r.y)}else if(arguments[0]instanceof qt){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 a=arguments[0],c=arguments[1];this.isNull()?(this._minx=a,this._maxx=a,this._miny=c,this._maxy=c):(a<this._minx&&(this._minx=a),a>this._maxx&&(this._maxx=a),c<this._miny&&(this._miny=c),c>this._maxy&&(this._maxy=c))}},qt.prototype.minExtent=function(){if(this.isNull())return 0;var r=this.getWidth(),i=this.getHeight();return r<i?r:i},qt.prototype.getWidth=function(){return this.isNull()?0:this._maxx-this._minx},qt.prototype.compareTo=function(r){var i=r;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},qt.prototype.translate=function(r,i){if(this.isNull())return null;this.init(this.getMinX()+r,this.getMaxX()+r,this.getMinY()+i,this.getMaxY()+i)},qt.prototype.toString=function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"},qt.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1},qt.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny},qt.prototype.maxExtent=function(){if(this.isNull())return 0;var r=this.getWidth(),i=this.getHeight();return r>i?r:i},qt.prototype.expandBy=function(){if(arguments.length===1){var r=arguments[0];this.expandBy(r,r)}else if(arguments.length===2){var i=arguments[0],a=arguments[1];if(this.isNull())return null;this._minx-=i,this._maxx+=i,this._miny-=a,this._maxy+=a,(this._minx>this._maxx||this._miny>this._maxy)&&this.setToNull()}},qt.prototype.contains=function(){if(arguments.length===1){if(arguments[0]instanceof qt){var r=arguments[0];return this.covers(r)}if(arguments[0]instanceof D){var i=arguments[0];return this.covers(i)}}else if(arguments.length===2){var a=arguments[0],c=arguments[1];return this.covers(a,c)}},qt.prototype.centre=function(){return this.isNull()?null:new D((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)},qt.prototype.init=function(){if(arguments.length===0)this.setToNull();else if(arguments.length===1){if(arguments[0]instanceof D){var r=arguments[0];this.init(r.x,r.x,r.y,r.y)}else if(arguments[0]instanceof qt){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 a=arguments[0],c=arguments[1];this.init(a.x,c.x,a.y,c.y)}else if(arguments.length===4){var d=arguments[0],_=arguments[1],M=arguments[2],L=arguments[3];d<_?(this._minx=d,this._maxx=_):(this._minx=_,this._maxx=d),M<L?(this._miny=M,this._maxy=L):(this._miny=L,this._maxy=M)}},qt.prototype.getMaxY=function(){return this._maxy},qt.prototype.distance=function(r){if(this.intersects(r))return 0;var i=0;this._maxx<r._minx?i=r._minx-this._maxx:this._minx>r._maxx&&(i=this._minx-r._maxx);var a=0;return this._maxy<r._miny?a=r._miny-this._maxy:this._miny>r._maxy&&(a=this._miny-r._maxy),i===0?a:a===0?i:Math.sqrt(i*i+a*a)},qt.prototype.hashCode=function(){var r=17;return r=37*r+D.hashCode(this._minx),r=37*r+D.hashCode(this._maxx),r=37*r+D.hashCode(this._miny),r=37*r+D.hashCode(this._maxy)},qt.prototype.interfaces_=function(){return[V,t]},qt.prototype.getClass=function(){return qt},qt.intersects=function(){if(arguments.length===3){var r=arguments[0],i=arguments[1],a=arguments[2];return a.x>=(r.x<i.x?r.x:i.x)&&a.x<=(r.x>i.x?r.x:i.x)&&a.y>=(r.y<i.y?r.y:i.y)&&a.y<=(r.y>i.y?r.y:i.y)}if(arguments.length===4){var c=arguments[0],d=arguments[1],_=arguments[2],M=arguments[3],L=Math.min(_.x,M.x),H=Math.max(_.x,M.x),it=Math.min(c.x,d.x),bt=Math.max(c.x,d.x);return!(it>H)&&!(bt<L)&&(L=Math.min(_.y,M.y),H=Math.max(_.y,M.y),it=Math.min(c.y,d.y),bt=Math.max(c.y,d.y),!(it>H)&&!(bt<L))}},xe.serialVersionUID.get=function(){return 5873921885273102e3},Object.defineProperties(qt,xe);var ft={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*$/},We=function(r){this.geometryFactory=r||new Le};We.prototype.read=function(r){var i,a,c;r=r.replace(/[\n\r]/g," ");var d=ft.typeStr.exec(r);if(r.search("EMPTY")!==-1&&((d=ft.emptyTypeStr.exec(r))[2]=void 0),d&&(a=d[1].toLowerCase(),c=d[2],ge[a]&&(i=ge[a].apply(this,[c]))),i===void 0)throw new Error("Could not parse WKT "+r);return i},We.prototype.write=function(r){return this.extractGeometry(r)},We.prototype.extractGeometry=function(r){var i=r.getGeometryType().toLowerCase();if(!ee[i])return null;var a=i.toUpperCase();return r.isEmpty()?a+" EMPTY":a+"("+ee[i].apply(this,[r])+")"};var ee={coordinate:function(r){return r.x+" "+r.y},point:function(r){return ee.coordinate.call(this,r._coordinates._coordinates[0])},multipoint:function(r){for(var i=[],a=0,c=r._geometries.length;a<c;++a)i.push("("+ee.point.apply(this,[r._geometries[a]])+")");return i.join(",")},linestring:function(r){for(var i=[],a=0,c=r._points._coordinates.length;a<c;++a)i.push(ee.coordinate.apply(this,[r._points._coordinates[a]]));return i.join(",")},linearring:function(r){for(var i=[],a=0,c=r._points._coordinates.length;a<c;++a)i.push(ee.coordinate.apply(this,[r._points._coordinates[a]]));return i.join(",")},multilinestring:function(r){for(var i=[],a=0,c=r._geometries.length;a<c;++a)i.push("("+ee.linestring.apply(this,[r._geometries[a]])+")");return i.join(",")},polygon:function(r){var i=[];i.push("("+ee.linestring.apply(this,[r._shell])+")");for(var a=0,c=r._holes.length;a<c;++a)i.push("("+ee.linestring.apply(this,[r._holes[a]])+")");return i.join(",")},multipolygon:function(r){for(var i=[],a=0,c=r._geometries.length;a<c;++a)i.push("("+ee.polygon.apply(this,[r._geometries[a]])+")");return i.join(",")},geometrycollection:function(r){for(var i=[],a=0,c=r._geometries.length;a<c;++a)i.push(this.extractGeometry(r._geometries[a]));return i.join(",")}},ge={point:function(r){if(r===void 0)return this.geometryFactory.createPoint();var i=r.trim().split(ft.spaces);return this.geometryFactory.createPoint(new D(Number.parseFloat(i[0]),Number.parseFloat(i[1])))},multipoint:function(r){if(r===void 0)return this.geometryFactory.createMultiPoint();for(var i,a=r.trim().split(","),c=[],d=0,_=a.length;d<_;++d)i=a[d].replace(ft.trimParens,"$1"),c.push(ge.point.apply(this,[i]));return this.geometryFactory.createMultiPoint(c)},linestring:function(r){if(r===void 0)return this.geometryFactory.createLineString();for(var i,a=r.trim().split(","),c=[],d=0,_=a.length;d<_;++d)i=a[d].trim().split(ft.spaces),c.push(new D(Number.parseFloat(i[0]),Number.parseFloat(i[1])));return this.geometryFactory.createLineString(c)},linearring:function(r){if(r===void 0)return this.geometryFactory.createLinearRing();for(var i,a=r.trim().split(","),c=[],d=0,_=a.length;d<_;++d)i=a[d].trim().split(ft.spaces),c.push(new D(Number.parseFloat(i[0]),Number.parseFloat(i[1])));return this.geometryFactory.createLinearRing(c)},multilinestring:function(r){if(r===void 0)return this.geometryFactory.createMultiLineString();for(var i,a=r.trim().split(ft.parenComma),c=[],d=0,_=a.length;d<_;++d)i=a[d].replace(ft.trimParens,"$1"),c.push(ge.linestring.apply(this,[i]));return this.geometryFactory.createMultiLineString(c)},polygon:function(r){if(r===void 0)return this.geometryFactory.createPolygon();for(var i,a,c,d,_=r.trim().split(ft.parenComma),M=[],L=0,H=_.length;L<H;++L)i=_[L].replace(ft.trimParens,"$1"),a=ge.linestring.apply(this,[i]),c=this.geometryFactory.createLinearRing(a._points),L===0?d=c:M.push(c);return this.geometryFactory.createPolygon(d,M)},multipolygon:function(r){if(r===void 0)return this.geometryFactory.createMultiPolygon();for(var i,a=r.trim().split(ft.doubleParenComma),c=[],d=0,_=a.length;d<_;++d)i=a[d].replace(ft.trimParens,"$1"),c.push(ge.polygon.apply(this,[i]));return this.geometryFactory.createMultiPolygon(c)},geometrycollection:function(r){if(r===void 0)return this.geometryFactory.createGeometryCollection();for(var i=(r=r.replace(/,\s*([A-Za-z])/g,"|$1")).trim().split("|"),a=[],c=0,d=i.length;c<d;++c)a.push(this.read(i[c]));return this.geometryFactory.createGeometryCollection(a)}},fe=function(r){this.parser=new We(r)};fe.prototype.write=function(r){return this.parser.write(r)},fe.toLineString=function(r,i){if(arguments.length!==2)throw new Error("Not implemented");return"LINESTRING ( "+r.x+" "+r.y+", "+i.x+" "+i.y+" )"};var Te=function(r){function i(a){r.call(this,a),this.name="RuntimeException",this.message=a,this.stack=new r().stack}return r&&(i.__proto__=r),i.prototype=Object.create(r&&r.prototype),i.prototype.constructor=i,i}(Error),be=function(r){function i(){if(r.call(this),arguments.length===0)r.call(this);else if(arguments.length===1){var a=arguments[0];r.call(this,a)}}return r&&(i.__proto__=r),i.prototype=Object.create(r&&r.prototype),i.prototype.constructor=i,i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(Te),Wt=function(){};Wt.prototype.interfaces_=function(){return[]},Wt.prototype.getClass=function(){return Wt},Wt.shouldNeverReachHere=function(){if(arguments.length===0)Wt.shouldNeverReachHere(null);else if(arguments.length===1){var r=arguments[0];throw new be("Should never reach here"+(r!==null?": "+r:""))}},Wt.isTrue=function(){var r,i;if(arguments.length===1)r=arguments[0],Wt.isTrue(r,null);else if(arguments.length===2&&(r=arguments[0],i=arguments[1],!r))throw i===null?new be:new be(i)},Wt.equals=function(){var r,i,a;if(arguments.length===2)r=arguments[0],i=arguments[1],Wt.equals(r,i,null);else if(arguments.length===3&&(r=arguments[0],i=arguments[1],a=arguments[2],!i.equals(r)))throw new be("Expected "+r+" but encountered "+i+(a!==null?": "+a:""))};var Me=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 D,this._intPt[1]=new D,this._pa=this._intPt[0],this._pb=this._intPt[1],this._result=0},tt={DONT_INTERSECT:{configurable:!0},DO_INTERSECT:{configurable:!0},COLLINEAR:{configurable:!0},NO_INTERSECTION:{configurable:!0},POINT_INTERSECTION:{configurable:!0},COLLINEAR_INTERSECTION:{configurable:!0}};Me.prototype.getIndexAlongSegment=function(r,i){return this.computeIntLineIndex(),this._intLineIndex[r][i]},Me.prototype.getTopologySummary=function(){var r=new Lt;return this.isEndPoint()&&r.append(" endpoint"),this._isProper&&r.append(" proper"),this.isCollinear()&&r.append(" collinear"),r.toString()},Me.prototype.computeIntersection=function(r,i,a,c){this._inputLines[0][0]=r,this._inputLines[0][1]=i,this._inputLines[1][0]=a,this._inputLines[1][1]=c,this._result=this.computeIntersect(r,i,a,c)},Me.prototype.getIntersectionNum=function(){return this._result},Me.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 r=arguments[0];this.getEdgeDistance(r,0)>this.getEdgeDistance(r,1)?(this._intLineIndex[r][0]=0,this._intLineIndex[r][1]=1):(this._intLineIndex[r][0]=1,this._intLineIndex[r][1]=0)}},Me.prototype.isProper=function(){return this.hasIntersection()&&this._isProper},Me.prototype.setPrecisionModel=function(r){this._precisionModel=r},Me.prototype.isInteriorIntersection=function(){if(arguments.length===0)return!!this.isInteriorIntersection(0)||!!this.isInteriorIntersection(1);if(arguments.length===1){for(var r=arguments[0],i=0;i<this._result;i++)if(!this._intPt[i].equals2D(this._inputLines[r][0])&&!this._intPt[i].equals2D(this._inputLines[r][1]))return!0;return!1}},Me.prototype.getIntersection=function(r){return this._intPt[r]},Me.prototype.isEndPoint=function(){return this.hasIntersection()&&!this._isProper},Me.prototype.hasIntersection=function(){return this._result!==Me.NO_INTERSECTION},Me.prototype.getEdgeDistance=function(r,i){return Me.computeEdgeDistance(this._intPt[i],this._inputLines[r][0],this._inputLines[r][1])},Me.prototype.isCollinear=function(){return this._result===Me.COLLINEAR_INTERSECTION},Me.prototype.toString=function(){return fe.toLineString(this._inputLines[0][0],this._inputLines[0][1])+" - "+fe.toLineString(this._inputLines[1][0],this._inputLines[1][1])+this.getTopologySummary()},Me.prototype.getEndpoint=function(r,i){return this._inputLines[r][i]},Me.prototype.isIntersection=function(r){for(var i=0;i<this._result;i++)if(this._intPt[i].equals2D(r))return!0;return!1},Me.prototype.getIntersectionAlongSegment=function(r,i){return this.computeIntLineIndex(),this._intPt[this._intLineIndex[r][i]]},Me.prototype.interfaces_=function(){return[]},Me.prototype.getClass=function(){return Me},Me.computeEdgeDistance=function(r,i,a){var c=Math.abs(a.x-i.x),d=Math.abs(a.y-i.y),_=-1;if(r.equals(i))_=0;else if(r.equals(a))_=c>d?c:d;else{var M=Math.abs(r.x-i.x),L=Math.abs(r.y-i.y);(_=c>d?M:L)!==0||r.equals(i)||(_=Math.max(M,L))}return Wt.isTrue(!(_===0&&!r.equals(i)),"Bad distance calculation"),_},Me.nonRobustComputeEdgeDistance=function(r,i,a){var c=r.x-i.x,d=r.y-i.y,_=Math.sqrt(c*c+d*d);return Wt.isTrue(!(_===0&&!r.equals(i)),"Invalid distance calculation"),_},tt.DONT_INTERSECT.get=function(){return 0},tt.DO_INTERSECT.get=function(){return 1},tt.COLLINEAR.get=function(){return 2},tt.NO_INTERSECTION.get=function(){return 0},tt.POINT_INTERSECTION.get=function(){return 1},tt.COLLINEAR_INTERSECTION.get=function(){return 2},Object.defineProperties(Me,tt);var z=function(r){function i(){r.apply(this,arguments)}return r&&(i.__proto__=r),i.prototype=Object.create(r&&r.prototype),i.prototype.constructor=i,i.prototype.isInSegmentEnvelopes=function(a){var c=new qt(this._inputLines[0][0],this._inputLines[0][1]),d=new qt(this._inputLines[1][0],this._inputLines[1][1]);return c.contains(a)&&d.contains(a)},i.prototype.computeIntersection=function(){if(arguments.length!==3)return r.prototype.computeIntersection.apply(this,arguments);var a=arguments[0],c=arguments[1],d=arguments[2];if(this._isProper=!1,qt.intersects(c,d,a)&&dt.orientationIndex(c,d,a)===0&&dt.orientationIndex(d,c,a)===0)return this._isProper=!0,(a.equals(c)||a.equals(d))&&(this._isProper=!1),this._result=r.POINT_INTERSECTION,null;this._result=r.NO_INTERSECTION},i.prototype.normalizeToMinimum=function(a,c,d,_,M){M.x=this.smallestInAbsValue(a.x,c.x,d.x,_.x),M.y=this.smallestInAbsValue(a.y,c.y,d.y,_.y),a.x-=M.x,a.y-=M.y,c.x-=M.x,c.y-=M.y,d.x-=M.x,d.y-=M.y,_.x-=M.x,_.y-=M.y},i.prototype.safeHCoordinateIntersection=function(a,c,d,_){var M=null;try{M=$t.intersection(a,c,d,_)}catch(L){if(!(L instanceof ce))throw L;M=i.nearestEndpoint(a,c,d,_)}return M},i.prototype.intersection=function(a,c,d,_){var M=this.intersectionWithNormalization(a,c,d,_);return this.isInSegmentEnvelopes(M)||(M=new D(i.nearestEndpoint(a,c,d,_))),this._precisionModel!==null&&this._precisionModel.makePrecise(M),M},i.prototype.smallestInAbsValue=function(a,c,d,_){var M=a,L=Math.abs(M);return Math.abs(c)<L&&(M=c,L=Math.abs(c)),Math.abs(d)<L&&(M=d,L=Math.abs(d)),Math.abs(_)<L&&(M=_),M},i.prototype.checkDD=function(a,c,d,_,M){var L=Gt.intersection(a,c,d,_),H=this.isInSegmentEnvelopes(L);te.out.println("DD in env = "+H+" --------------------- "+L),M.distance(L)>1e-4&&te.out.println("Distance = "+M.distance(L))},i.prototype.intersectionWithNormalization=function(a,c,d,_){var M=new D(a),L=new D(c),H=new D(d),it=new D(_),bt=new D;this.normalizeToEnvCentre(M,L,H,it,bt);var Tt=this.safeHCoordinateIntersection(M,L,H,it);return Tt.x+=bt.x,Tt.y+=bt.y,Tt},i.prototype.computeCollinearIntersection=function(a,c,d,_){var M=qt.intersects(a,c,d),L=qt.intersects(a,c,_),H=qt.intersects(d,_,a),it=qt.intersects(d,_,c);return M&&L?(this._intPt[0]=d,this._intPt[1]=_,r.COLLINEAR_INTERSECTION):H&&it?(this._intPt[0]=a,this._intPt[1]=c,r.COLLINEAR_INTERSECTION):M&&H?(this._intPt[0]=d,this._intPt[1]=a,!d.equals(a)||L||it?r.COLLINEAR_INTERSECTION:r.POINT_INTERSECTION):M&&it?(this._intPt[0]=d,this._intPt[1]=c,!d.equals(c)||L||H?r.COLLINEAR_INTERSECTION:r.POINT_INTERSECTION):L&&H?(this._intPt[0]=_,this._intPt[1]=a,!_.equals(a)||M||it?r.COLLINEAR_INTERSECTION:r.POINT_INTERSECTION):L&&it?(this._intPt[0]=_,this._intPt[1]=c,!_.equals(c)||M||H?r.COLLINEAR_INTERSECTION:r.POINT_INTERSECTION):r.NO_INTERSECTION},i.prototype.normalizeToEnvCentre=function(a,c,d,_,M){var L=a.x<c.x?a.x:c.x,H=a.y<c.y?a.y:c.y,it=a.x>c.x?a.x:c.x,bt=a.y>c.y?a.y:c.y,Tt=d.x<_.x?d.x:_.x,Kt=d.y<_.y?d.y:_.y,Qt=d.x>_.x?d.x:_.x,le=d.y>_.y?d.y:_.y,Ee=((L>Tt?L:Tt)+(it<Qt?it:Qt))/2,Dn=((H>Kt?H:Kt)+(bt<le?bt:le))/2;M.x=Ee,M.y=Dn,a.x-=M.x,a.y-=M.y,c.x-=M.x,c.y-=M.y,d.x-=M.x,d.y-=M.y,_.x-=M.x,_.y-=M.y},i.prototype.computeIntersect=function(a,c,d,_){if(this._isProper=!1,!qt.intersects(a,c,d,_))return r.NO_INTERSECTION;var M=dt.orientationIndex(a,c,d),L=dt.orientationIndex(a,c,_);if(M>0&&L>0||M<0&&L<0)return r.NO_INTERSECTION;var H=dt.orientationIndex(d,_,a),it=dt.orientationIndex(d,_,c);return H>0&&it>0||H<0&&it<0?r.NO_INTERSECTION:M===0&&L===0&&H===0&&it===0?this.computeCollinearIntersection(a,c,d,_):(M===0||L===0||H===0||it===0?(this._isProper=!1,a.equals2D(d)||a.equals2D(_)?this._intPt[0]=a:c.equals2D(d)||c.equals2D(_)?this._intPt[0]=c:M===0?this._intPt[0]=new D(d):L===0?this._intPt[0]=new D(_):H===0?this._intPt[0]=new D(a):it===0&&(this._intPt[0]=new D(c))):(this._isProper=!0,this._intPt[0]=this.intersection(a,c,d,_)),r.POINT_INTERSECTION)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i.nearestEndpoint=function(a,c,d,_){var M=a,L=dt.distancePointLine(a,d,_),H=dt.distancePointLine(c,d,_);return H<L&&(L=H,M=c),(H=dt.distancePointLine(d,a,c))<L&&(L=H,M=d),(H=dt.distancePointLine(_,a,c))<L&&(L=H,M=_),M},i}(Me),Pt=function(){};Pt.prototype.interfaces_=function(){return[]},Pt.prototype.getClass=function(){return Pt},Pt.orientationIndex=function(r,i,a){var c=i.x-r.x,d=i.y-r.y,_=a.x-i.x,M=a.y-i.y;return Pt.signOfDet2x2(c,d,_,M)},Pt.signOfDet2x2=function(r,i,a,c){var d=null,_=null,M=null;if(d=1,r===0||c===0)return i===0||a===0?0:i>0?a>0?-d:d:a>0?d:-d;if(i===0||a===0)return c>0?r>0?d:-d:r>0?-d:d;if(i>0?c>0?i<=c||(d=-d,_=r,r=a,a=_,_=i,i=c,c=_):i<=-c?(d=-d,a=-a,c=-c):(_=r,r=-a,a=_,_=i,i=-c,c=_):c>0?-i<=c?(d=-d,r=-r,i=-i):(_=-r,r=a,a=_,_=-i,i=c,c=_):i>=c?(r=-r,i=-i,a=-a,c=-c):(d=-d,_=-r,r=-a,a=_,_=-i,i=-c,c=_),r>0){if(!(a>0)||!(r<=a))return d}else{if(a>0||!(r>=a))return-d;d=-d,r=-r,a=-a}for(;;){if(M=Math.floor(a/r),a-=M*r,(c-=M*i)<0)return-d;if(c>i)return d;if(r>a+a){if(i<c+c)return d}else{if(i>c+c)return-d;a=r-a,c=i-c,d=-d}if(c===0)return a===0?0:-d;if(a===0||(M=Math.floor(r/a),r-=M*a,(i-=M*c)<0))return d;if(i>c)return-d;if(a>r+r){if(c<i+i)return-d}else{if(c>i+i)return d;r=a-r,i=c-i,d=-d}if(i===0)return r===0?0:d;if(r===0)return-d}};var Ot=function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var r=arguments[0];this._p=r};Ot.prototype.countSegment=function(r,i){if(r.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(r.y===this._p.y&&i.y===this._p.y){var a=r.x,c=i.x;return a>c&&(a=i.x,c=r.x),this._p.x>=a&&this._p.x<=c&&(this._isPointOnSegment=!0),null}if(r.y>this._p.y&&i.y<=this._p.y||i.y>this._p.y&&r.y<=this._p.y){var d=r.x-this._p.x,_=r.y-this._p.y,M=i.x-this._p.x,L=i.y-this._p.y,H=Pt.signOfDet2x2(d,_,M,L);if(H===0)return this._isPointOnSegment=!0,null;L<_&&(H=-H),H>0&&this._crossingCount++}},Ot.prototype.isPointInPolygon=function(){return this.getLocation()!==K.EXTERIOR},Ot.prototype.getLocation=function(){return this._isPointOnSegment?K.BOUNDARY:this._crossingCount%2==1?K.INTERIOR:K.EXTERIOR},Ot.prototype.isOnSegment=function(){return this._isPointOnSegment},Ot.prototype.interfaces_=function(){return[]},Ot.prototype.getClass=function(){return Ot},Ot.locatePointInRing=function(){if(arguments[0]instanceof D&&Q(arguments[1],ut)){for(var r=arguments[0],i=arguments[1],a=new Ot(r),c=new D,d=new D,_=1;_<i.size();_++)if(i.getCoordinate(_,c),i.getCoordinate(_-1,d),a.countSegment(c,d),a.isOnSegment())return a.getLocation();return a.getLocation()}if(arguments[0]instanceof D&&arguments[1]instanceof Array){for(var M=arguments[0],L=arguments[1],H=new Ot(M),it=1;it<L.length;it++){var bt=L[it],Tt=L[it-1];if(H.countSegment(bt,Tt),H.isOnSegment())return H.getLocation()}return H.getLocation()}};var dt=function(){},Ht={CLOCKWISE:{configurable:!0},RIGHT:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},LEFT:{configurable:!0},COLLINEAR:{configurable:!0},STRAIGHT:{configurable:!0}};dt.prototype.interfaces_=function(){return[]},dt.prototype.getClass=function(){return dt},dt.orientationIndex=function(r,i,a){return Gt.orientationIndex(r,i,a)},dt.signedArea=function(){if(arguments[0]instanceof Array){var r=arguments[0];if(r.length<3)return 0;for(var i=0,a=r[0].x,c=1;c<r.length-1;c++){var d=r[c].x-a,_=r[c+1].y;i+=d*(r[c-1].y-_)}return i/2}if(Q(arguments[0],ut)){var M=arguments[0],L=M.size();if(L<3)return 0;var H=new D,it=new D,bt=new D;M.getCoordinate(0,it),M.getCoordinate(1,bt);var Tt=it.x;bt.x-=Tt;for(var Kt=0,Qt=1;Qt<L-1;Qt++)H.y=it.y,it.x=bt.x,it.y=bt.y,M.getCoordinate(Qt+1,bt),bt.x-=Tt,Kt+=it.x*(H.y-bt.y);return Kt/2}},dt.distanceLineLine=function(r,i,a,c){if(r.equals(i))return dt.distancePointLine(r,a,c);if(a.equals(c))return dt.distancePointLine(c,r,i);var d=!1;if(qt.intersects(r,i,a,c)){var _=(i.x-r.x)*(c.y-a.y)-(i.y-r.y)*(c.x-a.x);if(_===0)d=!0;else{var M=(r.y-a.y)*(c.x-a.x)-(r.x-a.x)*(c.y-a.y),L=((r.y-a.y)*(i.x-r.x)-(r.x-a.x)*(i.y-r.y))/_,H=M/_;(H<0||H>1||L<0||L>1)&&(d=!0)}}else d=!0;return d?At.min(dt.distancePointLine(r,a,c),dt.distancePointLine(i,a,c),dt.distancePointLine(a,r,i),dt.distancePointLine(c,r,i)):0},dt.isPointInRing=function(r,i){return dt.locatePointInRing(r,i)!==K.EXTERIOR},dt.computeLength=function(r){var i=r.size();if(i<=1)return 0;var a=0,c=new D;r.getCoordinate(0,c);for(var d=c.x,_=c.y,M=1;M<i;M++){r.getCoordinate(M,c);var L=c.x,H=c.y,it=L-d,bt=H-_;a+=Math.sqrt(it*it+bt*bt),d=L,_=H}return a},dt.isCCW=function(r){var i=r.length-1;if(i<3)throw new I("Ring has fewer than 4 points, so orientation cannot be determined");for(var a=r[0],c=0,d=1;d<=i;d++){var _=r[d];_.y>a.y&&(a=_,c=d)}var M=c;do(M-=1)<0&&(M=i);while(r[M].equals2D(a)&&M!==c);var L=c;do L=(L+1)%i;while(r[L].equals2D(a)&&L!==c);var H=r[M],it=r[L];if(H.equals2D(a)||it.equals2D(a)||H.equals2D(it))return!1;var bt=dt.computeOrientation(H,a,it),Tt=!1;return Tt=bt===0?H.x>it.x:bt>0,Tt},dt.locatePointInRing=function(r,i){return Ot.locatePointInRing(r,i)},dt.distancePointLinePerpendicular=function(r,i,a){var c=(a.x-i.x)*(a.x-i.x)+(a.y-i.y)*(a.y-i.y),d=((i.y-r.y)*(a.x-i.x)-(i.x-r.x)*(a.y-i.y))/c;return Math.abs(d)*Math.sqrt(c)},dt.computeOrientation=function(r,i,a){return dt.orientationIndex(r,i,a)},dt.distancePointLine=function(){if(arguments.length===2){var r=arguments[0],i=arguments[1];if(i.length===0)throw new I("Line array must contain at least one vertex");for(var a=r.distance(i[0]),c=0;c<i.length-1;c++){var d=dt.distancePointLine(r,i[c],i[c+1]);d<a&&(a=d)}return a}if(arguments.length===3){var _=arguments[0],M=arguments[1],L=arguments[2];if(M.x===L.x&&M.y===L.y)return _.distance(M);var H=(L.x-M.x)*(L.x-M.x)+(L.y-M.y)*(L.y-M.y),it=((_.x-M.x)*(L.x-M.x)+(_.y-M.y)*(L.y-M.y))/H;if(it<=0)return _.distance(M);if(it>=1)return _.distance(L);var bt=((M.y-_.y)*(L.x-M.x)-(M.x-_.x)*(L.y-M.y))/H;return Math.abs(bt)*Math.sqrt(H)}},dt.isOnLine=function(r,i){for(var a=new z,c=1;c<i.length;c++){var d=i[c-1],_=i[c];if(a.computeIntersection(r,d,_),a.hasIntersection())return!0}return!1},Ht.CLOCKWISE.get=function(){return-1},Ht.RIGHT.get=function(){return dt.CLOCKWISE},Ht.COUNTERCLOCKWISE.get=function(){return 1},Ht.LEFT.get=function(){return dt.COUNTERCLOCKWISE},Ht.COLLINEAR.get=function(){return 0},Ht.STRAIGHT.get=function(){return dt.COLLINEAR},Object.defineProperties(dt,Ht);var Ce=function(){};Ce.prototype.filter=function(r){},Ce.prototype.interfaces_=function(){return[]},Ce.prototype.getClass=function(){return Ce};var Vt=function(){var r=arguments[0];this._envelope=null,this._factory=null,this._SRID=null,this._userData=null,this._factory=r,this._SRID=r.getSRID()},Zt={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}};Vt.prototype.isGeometryCollection=function(){return this.getSortIndex()===Vt.SORTINDEX_GEOMETRYCOLLECTION},Vt.prototype.getFactory=function(){return this._factory},Vt.prototype.getGeometryN=function(r){return this},Vt.prototype.getArea=function(){return 0},Vt.prototype.isRectangle=function(){return!1},Vt.prototype.equals=function(){if(arguments[0]instanceof Vt){var r=arguments[0];return r!==null&&this.equalsTopo(r)}if(arguments[0]instanceof Object){var i=arguments[0];if(!(i instanceof Vt))return!1;var a=i;return this.equalsExact(a)}},Vt.prototype.equalsExact=function(r){return this===r||this.equalsExact(r,0)},Vt.prototype.geometryChanged=function(){this.apply(Vt.geometryChangedFilter)},Vt.prototype.geometryChangedAction=function(){this._envelope=null},Vt.prototype.equalsNorm=function(r){return r!==null&&this.norm().equalsExact(r.norm())},Vt.prototype.getLength=function(){return 0},Vt.prototype.getNumGeometries=function(){return 1},Vt.prototype.compareTo=function(){if(arguments.length===1){var r=arguments[0],i=r;return this.getSortIndex()!==i.getSortIndex()?this.getSortIndex()-i.getSortIndex():this.isEmpty()&&i.isEmpty()?0:this.isEmpty()?-1:i.isEmpty()?1:this.compareToSameClass(r)}if(arguments.length===2){var a=arguments[0],c=arguments[1];return this.getSortIndex()!==a.getSortIndex()?this.getSortIndex()-a.getSortIndex():this.isEmpty()&&a.isEmpty()?0:this.isEmpty()?-1:a.isEmpty()?1:this.compareToSameClass(a,c)}},Vt.prototype.getUserData=function(){return this._userData},Vt.prototype.getSRID=function(){return this._SRID},Vt.prototype.getEnvelope=function(){return this.getFactory().toGeometry(this.getEnvelopeInternal())},Vt.prototype.checkNotGeometryCollection=function(r){if(r.getSortIndex()===Vt.SORTINDEX_GEOMETRYCOLLECTION)throw new I("This method does not support GeometryCollection arguments")},Vt.prototype.equal=function(r,i,a){return a===0?r.equals(i):r.distance(i)<=a},Vt.prototype.norm=function(){var r=this.copy();return r.normalize(),r},Vt.prototype.getPrecisionModel=function(){return this._factory.getPrecisionModel()},Vt.prototype.getEnvelopeInternal=function(){return this._envelope===null&&(this._envelope=this.computeEnvelopeInternal()),new qt(this._envelope)},Vt.prototype.setSRID=function(r){this._SRID=r},Vt.prototype.setUserData=function(r){this._userData=r},Vt.prototype.compare=function(r,i){for(var a=r.iterator(),c=i.iterator();a.hasNext()&&c.hasNext();){var d=a.next(),_=c.next(),M=d.compareTo(_);if(M!==0)return M}return a.hasNext()?1:c.hasNext()?-1:0},Vt.prototype.hashCode=function(){return this.getEnvelopeInternal().hashCode()},Vt.prototype.isGeometryCollectionOrDerived=function(){return this.getSortIndex()===Vt.SORTINDEX_GEOMETRYCOLLECTION||this.getSortIndex()===Vt.SORTINDEX_MULTIPOINT||this.getSortIndex()===Vt.SORTINDEX_MULTILINESTRING||this.getSortIndex()===Vt.SORTINDEX_MULTIPOLYGON},Vt.prototype.interfaces_=function(){return[X,V,t]},Vt.prototype.getClass=function(){return Vt},Vt.hasNonEmptyElements=function(r){for(var i=0;i<r.length;i++)if(!r[i].isEmpty())return!0;return!1},Vt.hasNullElements=function(r){for(var i=0;i<r.length;i++)if(r[i]===null)return!0;return!1},Zt.serialVersionUID.get=function(){return 8763622679187377e3},Zt.SORTINDEX_POINT.get=function(){return 0},Zt.SORTINDEX_MULTIPOINT.get=function(){return 1},Zt.SORTINDEX_LINESTRING.get=function(){return 2},Zt.SORTINDEX_LINEARRING.get=function(){return 3},Zt.SORTINDEX_MULTILINESTRING.get=function(){return 4},Zt.SORTINDEX_POLYGON.get=function(){return 5},Zt.SORTINDEX_MULTIPOLYGON.get=function(){return 6},Zt.SORTINDEX_GEOMETRYCOLLECTION.get=function(){return 7},Zt.geometryChangedFilter.get=function(){return ne},Object.defineProperties(Vt,Zt);var ne=function(){};ne.interfaces_=function(){return[Ce]},ne.filter=function(r){r.geometryChangedAction()};var rt=function(){};rt.prototype.filter=function(r){},rt.prototype.interfaces_=function(){return[]},rt.prototype.getClass=function(){return rt};var P=function(){},N={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}};P.prototype.isInBoundary=function(r){},P.prototype.interfaces_=function(){return[]},P.prototype.getClass=function(){return P},N.Mod2BoundaryNodeRule.get=function(){return k},N.EndPointBoundaryNodeRule.get=function(){return $},N.MultiValentEndPointBoundaryNodeRule.get=function(){return W},N.MonoValentEndPointBoundaryNodeRule.get=function(){return ht},N.MOD2_BOUNDARY_RULE.get=function(){return new k},N.ENDPOINT_BOUNDARY_RULE.get=function(){return new $},N.MULTIVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new W},N.MONOVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new ht},N.OGC_SFS_BOUNDARY_RULE.get=function(){return P.MOD2_BOUNDARY_RULE},Object.defineProperties(P,N);var k=function(){};k.prototype.isInBoundary=function(r){return r%2==1},k.prototype.interfaces_=function(){return[P]},k.prototype.getClass=function(){return k};var $=function(){};$.prototype.isInBoundary=function(r){return r>0},$.prototype.interfaces_=function(){return[P]},$.prototype.getClass=function(){return $};var W=function(){};W.prototype.isInBoundary=function(r){return r>1},W.prototype.interfaces_=function(){return[P]},W.prototype.getClass=function(){return W};var ht=function(){};ht.prototype.isInBoundary=function(r){return r===1},ht.prototype.interfaces_=function(){return[P]},ht.prototype.getClass=function(){return ht};var at=function(){};at.prototype.add=function(){},at.prototype.addAll=function(){},at.prototype.isEmpty=function(){},at.prototype.iterator=function(){},at.prototype.size=function(){},at.prototype.toArray=function(){},at.prototype.remove=function(){},(e.prototype=new Error).name="IndexOutOfBoundsException";var wt=function(){};wt.prototype.hasNext=function(){},wt.prototype.next=function(){},wt.prototype.remove=function(){};var Et=function(r){function i(){r.apply(this,arguments)}return r&&(i.__proto__=r),i.prototype=Object.create(r&&r.prototype),i.prototype.constructor=i,i.prototype.get=function(){},i.prototype.set=function(){},i.prototype.isEmpty=function(){},i}(at);(o.prototype=new Error).name="NoSuchElementException";var G=function(r){function i(){r.call(this),this.array_=[],arguments[0]instanceof at&&this.addAll(arguments[0])}return r&&(i.__proto__=r),i.prototype=Object.create(r&&r.prototype),i.prototype.constructor=i,i.prototype.ensureCapacity=function(){},i.prototype.interfaces_=function(){return[r,at]},i.prototype.add=function(a){return arguments.length===1?this.array_.push(a):this.array_.splice(arguments[0],arguments[1]),!0},i.prototype.clear=function(){this.array_=[]},i.prototype.addAll=function(a){for(var c=a.iterator();c.hasNext();)this.add(c.next());return!0},i.prototype.set=function(a,c){var d=this.array_[a];return this.array_[a]=c,d},i.prototype.iterator=function(){return new ot(this)},i.prototype.get=function(a){if(a<0||a>=this.size())throw new e;return this.array_[a]},i.prototype.isEmpty=function(){return this.array_.length===0},i.prototype.size=function(){return this.array_.length},i.prototype.toArray=function(){for(var a=[],c=0,d=this.array_.length;c<d;c++)a.push(this.array_[c]);return a},i.prototype.remove=function(a){for(var c=!1,d=0,_=this.array_.length;d<_;d++)if(this.array_[d]===a){this.array_.splice(d,1),c=!0;break}return c},i}(Et),ot=function(r){function i(a){r.call(this),this.arrayList_=a,this.position_=0}return r&&(i.__proto__=r),i.prototype=Object.create(r&&r.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(a){return this.arrayList_.set(this.position_-1,a)},i.prototype.remove=function(){this.arrayList_.remove(this.arrayList_.get(this.position_))},i}(wt),et=function(r){function i(){if(r.call(this),arguments.length!==0){if(arguments.length===1){var c=arguments[0];this.ensureCapacity(c.length),this.add(c,!0)}else if(arguments.length===2){var d=arguments[0],_=arguments[1];this.ensureCapacity(d.length),this.add(d,_)}}}r&&(i.__proto__=r),(i.prototype=Object.create(r&&r.prototype)).constructor=i;var a={coordArrayType:{configurable:!0}};return a.coordArrayType.get=function(){return new Array(0).fill(null)},i.prototype.getCoordinate=function(c){return this.get(c)},i.prototype.addAll=function(){if(arguments.length===2){for(var c=arguments[0],d=arguments[1],_=!1,M=c.iterator();M.hasNext();)this.add(M.next(),d),_=!0;return _}return r.prototype.addAll.apply(this,arguments)},i.prototype.clone=function(){for(var c=r.prototype.clone.call(this),d=0;d<this.size();d++)c.add(d,this.get(d).copy());return c},i.prototype.toCoordinateArray=function(){return this.toArray(i.coordArrayType)},i.prototype.add=function(){if(arguments.length===1){var c=arguments[0];r.prototype.add.call(this,c)}else if(arguments.length===2){if(arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var d=arguments[0],_=arguments[1];return this.add(d,_,!0),!0}if(arguments[0]instanceof D&&typeof arguments[1]=="boolean"){var M=arguments[0];if(!arguments[1]&&this.size()>=1&&this.get(this.size()-1).equals2D(M))return null;r.prototype.add.call(this,M)}else if(arguments[0]instanceof Object&&typeof arguments[1]=="boolean"){var L=arguments[0],H=arguments[1];return this.add(L,H),!0}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var it=arguments[0],bt=arguments[1];if(arguments[2])for(var Tt=0;Tt<it.length;Tt++)this.add(it[Tt],bt);else for(var Kt=it.length-1;Kt>=0;Kt--)this.add(it[Kt],bt);return!0}if(typeof arguments[2]=="boolean"&&Number.isInteger(arguments[0])&&arguments[1]instanceof D){var Qt=arguments[0],le=arguments[1];if(!arguments[2]){var Ee=this.size();if(Ee>0&&(Qt>0&&this.get(Qt-1).equals2D(le)||Qt<Ee&&this.get(Qt).equals2D(le)))return null}r.prototype.add.call(this,Qt,le)}}else if(arguments.length===4){var Dn=arguments[0],Jn=arguments[1],fi=arguments[2],as=arguments[3],qs=1;fi>as&&(qs=-1);for(var Pf=fi;Pf!==as;Pf+=qs)this.add(Dn[Pf],Jn);return!0}},i.prototype.closeRing=function(){this.size()>0&&this.add(new D(this.get(0)),!1)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},Object.defineProperties(i,a),i}(G),lt=function(){},Ft={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};Ft.ForwardComparator.get=function(){return Jt},Ft.BidirectionalComparator.get=function(){return me},Ft.coordArrayType.get=function(){return new Array(0).fill(null)},lt.prototype.interfaces_=function(){return[]},lt.prototype.getClass=function(){return lt},lt.isRing=function(r){return!(r.length<4)&&!!r[0].equals2D(r[r.length-1])},lt.ptNotInList=function(r,i){for(var a=0;a<r.length;a++){var c=r[a];if(lt.indexOf(c,i)<0)return c}return null},lt.scroll=function(r,i){var a=lt.indexOf(i,r);if(a<0)return null;var c=new Array(r.length).fill(null);te.arraycopy(r,a,c,0,r.length-a),te.arraycopy(r,0,c,r.length-a,a),te.arraycopy(c,0,r,0,r.length)},lt.equals=function(){if(arguments.length===2){var r=arguments[0],i=arguments[1];if(r===i)return!0;if(r===null||i===null||r.length!==i.length)return!1;for(var a=0;a<r.length;a++)if(!r[a].equals(i[a]))return!1;return!0}if(arguments.length===3){var c=arguments[0],d=arguments[1],_=arguments[2];if(c===d)return!0;if(c===null||d===null||c.length!==d.length)return!1;for(var M=0;M<c.length;M++)if(_.compare(c[M],d[M])!==0)return!1;return!0}},lt.intersection=function(r,i){for(var a=new et,c=0;c<r.length;c++)i.intersects(r[c])&&a.add(r[c],!0);return a.toCoordinateArray()},lt.hasRepeatedPoints=function(r){for(var i=1;i<r.length;i++)if(r[i-1].equals(r[i]))return!0;return!1},lt.removeRepeatedPoints=function(r){return lt.hasRepeatedPoints(r)?new et(r,!1).toCoordinateArray():r},lt.reverse=function(r){for(var i=r.length-1,a=Math.trunc(i/2),c=0;c<=a;c++){var d=r[c];r[c]=r[i-c],r[i-c]=d}},lt.removeNull=function(r){for(var i=0,a=0;a<r.length;a++)r[a]!==null&&i++;var c=new Array(i).fill(null);if(i===0)return c;for(var d=0,_=0;_<r.length;_++)r[_]!==null&&(c[d++]=r[_]);return c},lt.copyDeep=function(){if(arguments.length===1){for(var r=arguments[0],i=new Array(r.length).fill(null),a=0;a<r.length;a++)i[a]=new D(r[a]);return i}if(arguments.length===5)for(var c=arguments[0],d=arguments[1],_=arguments[2],M=arguments[3],L=arguments[4],H=0;H<L;H++)_[M+H]=new D(c[d+H])},lt.isEqualReversed=function(r,i){for(var a=0;a<r.length;a++){var c=r[a],d=i[r.length-a-1];if(c.compareTo(d)!==0)return!1}return!0},lt.envelope=function(r){for(var i=new qt,a=0;a<r.length;a++)i.expandToInclude(r[a]);return i},lt.toCoordinateArray=function(r){return r.toArray(lt.coordArrayType)},lt.atLeastNCoordinatesOrNothing=function(r,i){return i.length>=r?i:[]},lt.indexOf=function(r,i){for(var a=0;a<i.length;a++)if(r.equals(i[a]))return a;return-1},lt.increasingDirection=function(r){for(var i=0;i<Math.trunc(r.length/2);i++){var a=r.length-1-i,c=r[i].compareTo(r[a]);if(c!==0)return c}return 1},lt.compare=function(r,i){for(var a=0;a<r.length&&a<i.length;){var c=r[a].compareTo(i[a]);if(c!==0)return c;a++}return a<i.length?-1:a<r.length?1:0},lt.minCoordinate=function(r){for(var i=null,a=0;a<r.length;a++)(i===null||i.compareTo(r[a])>0)&&(i=r[a]);return i},lt.extract=function(r,i,a){i=At.clamp(i,0,r.length);var c=(a=At.clamp(a,-1,r.length))-i+1;a<0&&(c=0),i>=r.length&&(c=0),a<i&&(c=0);var d=new Array(c).fill(null);if(c===0)return d;for(var _=0,M=i;M<=a;M++)d[_++]=r[M];return d},Object.defineProperties(lt,Ft);var Jt=function(){};Jt.prototype.compare=function(r,i){return lt.compare(r,i)},Jt.prototype.interfaces_=function(){return[q]},Jt.prototype.getClass=function(){return Jt};var me=function(){};me.prototype.compare=function(r,i){var a=r,c=i;if(a.length<c.length)return-1;if(a.length>c.length)return 1;if(a.length===0)return 0;var d=lt.compare(a,c);return lt.isEqualReversed(a,c)?0:d},me.prototype.OLDcompare=function(r,i){var a=r,c=i;if(a.length<c.length)return-1;if(a.length>c.length)return 1;if(a.length===0)return 0;for(var d=lt.increasingDirection(a),_=lt.increasingDirection(c),M=d>0?0:a.length-1,L=_>0?0:a.length-1,H=0;H<a.length;H++){var it=a[M].compareTo(c[L]);if(it!==0)return it;M+=d,L+=_}return 0},me.prototype.interfaces_=function(){return[q]},me.prototype.getClass=function(){return me};var ve=function(){};ve.prototype.get=function(){},ve.prototype.put=function(){},ve.prototype.size=function(){},ve.prototype.values=function(){},ve.prototype.entrySet=function(){};var qe=function(r){function i(){r.apply(this,arguments)}return r&&(i.__proto__=r),i.prototype=Object.create(r&&r.prototype),i.prototype.constructor=i,i}(ve);(s.prototype=new Error).name="OperationNotSupported",(u.prototype=new at).contains=function(){};var Ue=function(r){function i(){r.call(this),this.array_=[],arguments[0]instanceof at&&this.addAll(arguments[0])}return r&&(i.__proto__=r),i.prototype=Object.create(r&&r.prototype),i.prototype.constructor=i,i.prototype.contains=function(a){for(var c=0,d=this.array_.length;c<d;c++)if(this.array_[c]===a)return!0;return!1},i.prototype.add=function(a){return!this.contains(a)&&(this.array_.push(a),!0)},i.prototype.addAll=function(a){for(var c=a.iterator();c.hasNext();)this.add(c.next());return!0},i.prototype.remove=function(a){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 a=[],c=0,d=this.array_.length;c<d;c++)a.push(this.array_[c]);return a},i.prototype.iterator=function(){return new Xe(this)},i}(u),Xe=function(r){function i(a){r.call(this),this.hashSet_=a,this.position_=0}return r&&(i.__proto__=r),i.prototype=Object.create(r&&r.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 s},i}(wt),Je=0;(w.prototype=new qe).get=function(r){for(var i=this.root_;i!==null;){var a=r.compareTo(i.key);if(a<0)i=i.left;else{if(!(a>0))return i.value;i=i.right}}return null},w.prototype.put=function(r,i){if(this.root_===null)return this.root_={key:r,value:i,left:null,right:null,parent:null,color:Je,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var a,c,d=this.root_;do if(a=d,(c=r.compareTo(d.key))<0)d=d.left;else{if(!(c>0)){var _=d.value;return d.value=i,_}d=d.right}while(d!==null);var M={key:r,left:null,right:null,value:i,parent:a,color:Je,getValue:function(){return this.value},getKey:function(){return this.key}};return c<0?a.left=M:a.right=M,this.fixAfterInsertion(M),this.size_++,null},w.prototype.fixAfterInsertion=function(r){for(r.color=1;r!=null&&r!==this.root_&&r.parent.color===1;)if(f(r)===m(f(f(r)))){var i=v(f(f(r)));p(i)===1?(g(f(r),Je),g(i,Je),g(f(f(r)),1),r=f(f(r))):(r===v(f(r))&&(r=f(r),this.rotateLeft(r)),g(f(r),Je),g(f(f(r)),1),this.rotateRight(f(f(r))))}else{var a=m(f(f(r)));p(a)===1?(g(f(r),Je),g(a,Je),g(f(f(r)),1),r=f(f(r))):(r===m(f(r))&&(r=f(r),this.rotateRight(r)),g(f(r),Je),g(f(f(r)),1),this.rotateLeft(f(f(r))))}this.root_.color=Je},w.prototype.values=function(){var r=new G,i=this.getFirstEntry();if(i!==null)for(r.add(i.value);(i=w.successor(i))!==null;)r.add(i.value);return r},w.prototype.entrySet=function(){var r=new Ue,i=this.getFirstEntry();if(i!==null)for(r.add(i);(i=w.successor(i))!==null;)r.add(i);return r},w.prototype.rotateLeft=function(r){if(r!=null){var i=r.right;r.right=i.left,i.left!=null&&(i.left.parent=r),i.parent=r.parent,r.parent===null?this.root_=i:r.parent.left===r?r.parent.left=i:r.parent.right=i,i.left=r,r.parent=i}},w.prototype.rotateRight=function(r){if(r!=null){var i=r.left;r.left=i.right,i.right!=null&&(i.right.parent=r),i.parent=r.parent,r.parent===null?this.root_=i:r.parent.right===r?r.parent.right=i:r.parent.left=i,i.right=r,r.parent=i}},w.prototype.getFirstEntry=function(){var r=this.root_;if(r!=null)for(;r.left!=null;)r=r.left;return r},w.successor=function(r){if(r===null)return null;if(r.right!==null){for(var i=r.right;i.left!==null;)i=i.left;return i}for(var a=r.parent,c=r;a!==null&&c===a.right;)c=a,a=a.parent;return a},w.prototype.size=function(){return this.size_};var wr=function(){};wr.prototype.interfaces_=function(){return[]},wr.prototype.getClass=function(){return wr},S.prototype=new u,(b.prototype=new S).contains=function(r){for(var i=0,a=this.array_.length;i<a;i++)if(this.array_[i].compareTo(r)===0)return!0;return!1},b.prototype.add=function(r){if(this.contains(r))return!1;for(var i=0,a=this.array_.length;i<a;i++)if(this.array_[i].compareTo(r)===1)return this.array_.splice(i,0,r),!0;return this.array_.push(r),!0},b.prototype.addAll=function(r){for(var i=r.iterator();i.hasNext();)this.add(i.next());return!0},b.prototype.remove=function(r){throw new s},b.prototype.size=function(){return this.array_.length},b.prototype.isEmpty=function(){return this.array_.length===0},b.prototype.toArray=function(){for(var r=[],i=0,a=this.array_.length;i<a;i++)r.push(this.array_[i]);return r},b.prototype.iterator=function(){return new Kr(this)};var Kr=function(r){this.treeSet_=r,this.position_=0};Kr.prototype.next=function(){if(this.position_===this.treeSet_.size())throw new o;return this.treeSet_.array_[this.position_++]},Kr.prototype.hasNext=function(){return this.position_<this.treeSet_.size()},Kr.prototype.remove=function(){throw new s};var nr=function(){};nr.sort=function(){var r,i,a,c,d=arguments[0];if(arguments.length===1)c=function(M,L){return M.compareTo(L)},d.sort(c);else if(arguments.length===2)a=arguments[1],c=function(M,L){return a.compare(M,L)},d.sort(c);else if(arguments.length===3){(i=d.slice(arguments[1],arguments[2])).sort();var _=d.slice(0,arguments[1]).concat(i,d.slice(arguments[2],d.length));for(d.splice(0,d.length),r=0;r<_.length;r++)d.push(_[r])}else if(arguments.length===4)for(i=d.slice(arguments[1],arguments[2]),a=arguments[3],c=function(M,L){return a.compare(M,L)},i.sort(c),_=d.slice(0,arguments[1]).concat(i,d.slice(arguments[2],d.length)),d.splice(0,d.length),r=0;r<_.length;r++)d.push(_[r])},nr.asList=function(r){for(var i=new G,a=0,c=r.length;a<c;a++)i.add(r[a]);return i};var Ie=function(){},rr={P:{configurable:!0},L:{configurable:!0},A:{configurable:!0},FALSE:{configurable:!0},TRUE:{configurable:!0},DONTCARE:{configurable:!0},SYM_FALSE:{configurable:!0},SYM_TRUE:{configurable:!0},SYM_DONTCARE:{configurable:!0},SYM_P:{configurable:!0},SYM_L:{configurable:!0},SYM_A:{configurable:!0}};rr.P.get=function(){return 0},rr.L.get=function(){return 1},rr.A.get=function(){return 2},rr.FALSE.get=function(){return-1},rr.TRUE.get=function(){return-2},rr.DONTCARE.get=function(){return-3},rr.SYM_FALSE.get=function(){return"F"},rr.SYM_TRUE.get=function(){return"T"},rr.SYM_DONTCARE.get=function(){return"*"},rr.SYM_P.get=function(){return"0"},rr.SYM_L.get=function(){return"1"},rr.SYM_A.get=function(){return"2"},Ie.prototype.interfaces_=function(){return[]},Ie.prototype.getClass=function(){return Ie},Ie.toDimensionSymbol=function(r){switch(r){case Ie.FALSE:return Ie.SYM_FALSE;case Ie.TRUE:return Ie.SYM_TRUE;case Ie.DONTCARE:return Ie.SYM_DONTCARE;case Ie.P:return Ie.SYM_P;case Ie.L:return Ie.SYM_L;case Ie.A:return Ie.SYM_A}throw new I("Unknown dimension value: "+r)},Ie.toDimensionValue=function(r){switch(yt.toUpperCase(r)){case Ie.SYM_FALSE:return Ie.FALSE;case Ie.SYM_TRUE:return Ie.TRUE;case Ie.SYM_DONTCARE:return Ie.DONTCARE;case Ie.SYM_P:return Ie.P;case Ie.SYM_L:return Ie.L;case Ie.SYM_A:return Ie.A}throw new I("Unknown dimension symbol: "+r)},Object.defineProperties(Ie,rr);var pr=function(){};pr.prototype.filter=function(r){},pr.prototype.interfaces_=function(){return[]},pr.prototype.getClass=function(){return pr};var ur=function(){};ur.prototype.filter=function(r,i){},ur.prototype.isDone=function(){},ur.prototype.isGeometryChanged=function(){},ur.prototype.interfaces_=function(){return[]},ur.prototype.getClass=function(){return ur};var Qn=function(r){function i(c,d){if(r.call(this,d),this._geometries=c||[],r.hasNullElements(this._geometries))throw new I("geometries must not contain null elements")}r&&(i.__proto__=r),(i.prototype=Object.create(r&&r.prototype)).constructor=i;var a={serialVersionUID:{configurable:!0}};return i.prototype.computeEnvelopeInternal=function(){for(var c=new qt,d=0;d<this._geometries.length;d++)c.expandToInclude(this._geometries[d].getEnvelopeInternal());return c},i.prototype.getGeometryN=function(c){return this._geometries[c]},i.prototype.getSortIndex=function(){return r.SORTINDEX_GEOMETRYCOLLECTION},i.prototype.getCoordinates=function(){for(var c=new Array(this.getNumPoints()).fill(null),d=-1,_=0;_<this._geometries.length;_++)for(var M=this._geometries[_].getCoordinates(),L=0;L<M.length;L++)c[++d]=M[L];return c},i.prototype.getArea=function(){for(var c=0,d=0;d<this._geometries.length;d++)c+=this._geometries[d].getArea();return c},i.prototype.equalsExact=function(){if(arguments.length===2){var c=arguments[0],d=arguments[1];if(!this.isEquivalentClass(c))return!1;var _=c;if(this._geometries.length!==_._geometries.length)return!1;for(var M=0;M<this._geometries.length;M++)if(!this._geometries[M].equalsExact(_._geometries[M],d))return!1;return!0}return r.prototype.equalsExact.apply(this,arguments)},i.prototype.normalize=function(){for(var c=0;c<this._geometries.length;c++)this._geometries[c].normalize();nr.sort(this._geometries)},i.prototype.getCoordinate=function(){return this.isEmpty()?null:this._geometries[0].getCoordinate()},i.prototype.getBoundaryDimension=function(){for(var c=Ie.FALSE,d=0;d<this._geometries.length;d++)c=Math.max(c,this._geometries[d].getBoundaryDimension());return c},i.prototype.getDimension=function(){for(var c=Ie.FALSE,d=0;d<this._geometries.length;d++)c=Math.max(c,this._geometries[d].getDimension());return c},i.prototype.getLength=function(){for(var c=0,d=0;d<this._geometries.length;d++)c+=this._geometries[d].getLength();return c},i.prototype.getNumPoints=function(){for(var c=0,d=0;d<this._geometries.length;d++)c+=this._geometries[d].getNumPoints();return c},i.prototype.getNumGeometries=function(){return this._geometries.length},i.prototype.reverse=function(){for(var c=this._geometries.length,d=new Array(c).fill(null),_=0;_<this._geometries.length;_++)d[_]=this._geometries[_].reverse();return this.getFactory().createGeometryCollection(d)},i.prototype.compareToSameClass=function(){if(arguments.length===1){var c=arguments[0],d=new b(nr.asList(this._geometries)),_=new b(nr.asList(c._geometries));return this.compare(d,_)}if(arguments.length===2){for(var M=arguments[0],L=arguments[1],H=M,it=this.getNumGeometries(),bt=H.getNumGeometries(),Tt=0;Tt<it&&Tt<bt;){var Kt=this.getGeometryN(Tt),Qt=H.getGeometryN(Tt),le=Kt.compareToSameClass(Qt,L);if(le!==0)return le;Tt++}return Tt<it?1:Tt<bt?-1:0}},i.prototype.apply=function(){if(Q(arguments[0],rt))for(var c=arguments[0],d=0;d<this._geometries.length;d++)this._geometries[d].apply(c);else if(Q(arguments[0],ur)){var _=arguments[0];if(this._geometries.length===0)return null;for(var M=0;M<this._geometries.length&&(this._geometries[M].apply(_),!_.isDone());M++);_.isGeometryChanged()&&this.geometryChanged()}else if(Q(arguments[0],pr)){var L=arguments[0];L.filter(this);for(var H=0;H<this._geometries.length;H++)this._geometries[H].apply(L)}else if(Q(arguments[0],Ce)){var it=arguments[0];it.filter(this);for(var bt=0;bt<this._geometries.length;bt++)this._geometries[bt].apply(it)}},i.prototype.getBoundary=function(){return this.checkNotGeometryCollection(this),Wt.shouldNeverReachHere(),null},i.prototype.clone=function(){var c=r.prototype.clone.call(this);c._geometries=new Array(this._geometries.length).fill(null);for(var d=0;d<this._geometries.length;d++)c._geometries[d]=this._geometries[d].clone();return c},i.prototype.getGeometryType=function(){return"GeometryCollection"},i.prototype.copy=function(){for(var c=new Array(this._geometries.length).fill(null),d=0;d<c.length;d++)c[d]=this._geometries[d].copy();return new i(c,this._factory)},i.prototype.isEmpty=function(){for(var c=0;c<this._geometries.length;c++)if(!this._geometries[c].isEmpty())return!1;return!0},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},a.serialVersionUID.get=function(){return-5694727726395021e3},Object.defineProperties(i,a),i}(Vt),bi=function(r){function i(){r.apply(this,arguments)}r&&(i.__proto__=r),(i.prototype=Object.create(r&&r.prototype)).constructor=i;var a={serialVersionUID:{configurable:!0}};return i.prototype.getSortIndex=function(){return Vt.SORTINDEX_MULTILINESTRING},i.prototype.equalsExact=function(){if(arguments.length===2){var c=arguments[0],d=arguments[1];return!!this.isEquivalentClass(c)&&r.prototype.equalsExact.call(this,c,d)}return r.prototype.equalsExact.apply(this,arguments)},i.prototype.getBoundaryDimension=function(){return this.isClosed()?Ie.FALSE:0},i.prototype.isClosed=function(){if(this.isEmpty())return!1;for(var c=0;c<this._geometries.length;c++)if(!this._geometries[c].isClosed())return!1;return!0},i.prototype.getDimension=function(){return 1},i.prototype.reverse=function(){for(var c=this._geometries.length,d=new Array(c).fill(null),_=0;_<this._geometries.length;_++)d[c-1-_]=this._geometries[_].reverse();return this.getFactory().createMultiLineString(d)},i.prototype.getBoundary=function(){return new oi(this).getBoundary()},i.prototype.getGeometryType=function(){return"MultiLineString"},i.prototype.copy=function(){for(var c=new Array(this._geometries.length).fill(null),d=0;d<c.length;d++)c[d]=this._geometries[d].copy();return new i(c,this._factory)},i.prototype.interfaces_=function(){return[wr]},i.prototype.getClass=function(){return i},a.serialVersionUID.get=function(){return 8166665132445434e3},Object.defineProperties(i,a),i}(Qn),oi=function(){if(this._geom=null,this._geomFact=null,this._bnRule=null,this._endpointMap=null,arguments.length===1){var r=arguments[0],i=P.MOD2_BOUNDARY_RULE;this._geom=r,this._geomFact=r.getFactory(),this._bnRule=i}else if(arguments.length===2){var a=arguments[0],c=arguments[1];this._geom=a,this._geomFact=a.getFactory(),this._bnRule=c}};oi.prototype.boundaryMultiLineString=function(r){if(this._geom.isEmpty())return this.getEmptyMultiPoint();var i=this.computeBoundaryCoordinates(r);return i.length===1?this._geomFact.createPoint(i[0]):this._geomFact.createMultiPointFromCoords(i)},oi.prototype.getBoundary=function(){return this._geom instanceof vt?this.boundaryLineString(this._geom):this._geom instanceof bi?this.boundaryMultiLineString(this._geom):this._geom.getBoundary()},oi.prototype.boundaryLineString=function(r){return this._geom.isEmpty()?this.getEmptyMultiPoint():r.isClosed()?this._bnRule.isInBoundary(2)?r.getStartPoint():this._geomFact.createMultiPoint():this._geomFact.createMultiPoint([r.getStartPoint(),r.getEndPoint()])},oi.prototype.getEmptyMultiPoint=function(){return this._geomFact.createMultiPoint()},oi.prototype.computeBoundaryCoordinates=function(r){var i=new G;this._endpointMap=new w;for(var a=0;a<r.getNumGeometries();a++){var c=r.getGeometryN(a);c.getNumPoints()!==0&&(this.addEndpoint(c.getCoordinateN(0)),this.addEndpoint(c.getCoordinateN(c.getNumPoints()-1)))}for(var d=this._endpointMap.entrySet().iterator();d.hasNext();){var _=d.next(),M=_.getValue().count;this._bnRule.isInBoundary(M)&&i.add(_.getKey())}return lt.toCoordinateArray(i)},oi.prototype.addEndpoint=function(r){var i=this._endpointMap.get(r);i===null&&(i=new Z,this._endpointMap.put(r,i)),i.count++},oi.prototype.interfaces_=function(){return[]},oi.prototype.getClass=function(){return oi},oi.getBoundary=function(){if(arguments.length===1){var r=arguments[0];return new oi(r).getBoundary()}if(arguments.length===2){var i=arguments[0],a=arguments[1];return new oi(i,a).getBoundary()}};var Z=function(){this.count=null};Z.prototype.interfaces_=function(){return[]},Z.prototype.getClass=function(){return Z};var mt=function(){},It={NEWLINE:{configurable:!0},SIMPLE_ORDINATE_FORMAT:{configurable:!0}};mt.prototype.interfaces_=function(){return[]},mt.prototype.getClass=function(){return mt},mt.chars=function(r,i){for(var a=new Array(i).fill(null),c=0;c<i;c++)a[c]=r;return String(a)},mt.getStackTrace=function(){if(arguments.length===1){var r=arguments[0],i=new function(){},a=new function(){}(i);return r.printStackTrace(a),i.toString()}if(arguments.length===2){for(var c=arguments[0],d=arguments[1],_="",M=new function(){}(new function(){}(mt.getStackTrace(c))),L=0;L<d;L++)try{_+=M.readLine()+mt.NEWLINE}catch(H){if(!(H instanceof C))throw H;Wt.shouldNeverReachHere()}return _}},mt.split=function(r,i){for(var a=i.length,c=new G,d=""+r,_=d.indexOf(i);_>=0;){var M=d.substring(0,_);c.add(M),_=(d=d.substring(_+a)).indexOf(i)}d.length>0&&c.add(d);for(var L=new Array(c.size()).fill(null),H=0;H<L.length;H++)L[H]=c.get(H);return L},mt.toString=function(){if(arguments.length===1){var r=arguments[0];return mt.SIMPLE_ORDINATE_FORMAT.format(r)}},mt.spaces=function(r){return mt.chars(" ",r)},It.NEWLINE.get=function(){return te.getProperty("line.separator")},It.SIMPLE_ORDINATE_FORMAT.get=function(){return new function(){}("0.#")},Object.defineProperties(mt,It);var St=function(){};St.prototype.interfaces_=function(){return[]},St.prototype.getClass=function(){return St},St.copyCoord=function(r,i,a,c){for(var d=Math.min(r.getDimension(),a.getDimension()),_=0;_<d;_++)a.setOrdinate(c,_,r.getOrdinate(i,_))},St.isRing=function(r){var i=r.size();return i===0||!(i<=3)&&r.getOrdinate(0,ut.X)===r.getOrdinate(i-1,ut.X)&&r.getOrdinate(0,ut.Y)===r.getOrdinate(i-1,ut.Y)},St.isEqual=function(r,i){var a=r.size();if(a!==i.size())return!1;for(var c=Math.min(r.getDimension(),i.getDimension()),d=0;d<a;d++)for(var _=0;_<c;_++){var M=r.getOrdinate(d,_),L=i.getOrdinate(d,_);if(r.getOrdinate(d,_)!==i.getOrdinate(d,_)&&(!A.isNaN(M)||!A.isNaN(L)))return!1}return!0},St.extend=function(r,i,a){var c=r.create(a,i.getDimension()),d=i.size();if(St.copy(i,0,c,0,d),d>0)for(var _=d;_<a;_++)St.copy(i,d-1,c,_,1);return c},St.reverse=function(r){for(var i=r.size()-1,a=Math.trunc(i/2),c=0;c<=a;c++)St.swap(r,c,i-c)},St.swap=function(r,i,a){if(i===a)return null;for(var c=0;c<r.getDimension();c++){var d=r.getOrdinate(i,c);r.setOrdinate(i,c,r.getOrdinate(a,c)),r.setOrdinate(a,c,d)}},St.copy=function(r,i,a,c,d){for(var _=0;_<d;_++)St.copyCoord(r,i+_,a,c+_)},St.toString=function(){if(arguments.length===1){var r=arguments[0],i=r.size();if(i===0)return"()";var a=r.getDimension(),c=new Lt;c.append("(");for(var d=0;d<i;d++){d>0&&c.append(" ");for(var _=0;_<a;_++)_>0&&c.append(","),c.append(mt.toString(r.getOrdinate(d,_)))}return c.append(")"),c.toString()}},St.ensureValidRing=function(r,i){var a=i.size();return a===0?i:a<=3?St.createClosedRing(r,i,4):i.getOrdinate(0,ut.X)===i.getOrdinate(a-1,ut.X)&&i.getOrdinate(0,ut.Y)===i.getOrdinate(a-1,ut.Y)?i:St.createClosedRing(r,i,a+1)},St.createClosedRing=function(r,i,a){var c=r.create(a,i.getDimension()),d=i.size();St.copy(i,0,c,0,d);for(var _=d;_<a;_++)St.copy(i,0,c,_,1);return c};var vt=function(r){function i(c,d){r.call(this,d),this._points=null,this.init(c)}r&&(i.__proto__=r),(i.prototype=Object.create(r&&r.prototype)).constructor=i;var a={serialVersionUID:{configurable:!0}};return i.prototype.computeEnvelopeInternal=function(){return this.isEmpty()?new qt:this._points.expandEnvelope(new qt)},i.prototype.isRing=function(){return this.isClosed()&&this.isSimple()},i.prototype.getSortIndex=function(){return r.SORTINDEX_LINESTRING},i.prototype.getCoordinates=function(){return this._points.toCoordinateArray()},i.prototype.equalsExact=function(){if(arguments.length===2){var c=arguments[0],d=arguments[1];if(!this.isEquivalentClass(c))return!1;var _=c;if(this._points.size()!==_._points.size())return!1;for(var M=0;M<this._points.size();M++)if(!this.equal(this._points.getCoordinate(M),_._points.getCoordinate(M),d))return!1;return!0}return r.prototype.equalsExact.apply(this,arguments)},i.prototype.normalize=function(){for(var c=0;c<Math.trunc(this._points.size()/2);c++){var d=this._points.size()-1-c;if(!this._points.getCoordinate(c).equals(this._points.getCoordinate(d)))return this._points.getCoordinate(c).compareTo(this._points.getCoordinate(d))>0&&St.reverse(this._points),null}},i.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},i.prototype.getBoundaryDimension=function(){return this.isClosed()?Ie.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 dt.computeLength(this._points)},i.prototype.getNumPoints=function(){return this._points.size()},i.prototype.reverse=function(){var c=this._points.copy();return St.reverse(c),this.getFactory().createLineString(c)},i.prototype.compareToSameClass=function(){if(arguments.length===1){for(var c=arguments[0],d=0,_=0;d<this._points.size()&&_<c._points.size();){var M=this._points.getCoordinate(d).compareTo(c._points.getCoordinate(_));if(M!==0)return M;d++,_++}return d<this._points.size()?1:_<c._points.size()?-1:0}if(arguments.length===2){var L=arguments[0];return arguments[1].compare(this._points,L._points)}},i.prototype.apply=function(){if(Q(arguments[0],rt))for(var c=arguments[0],d=0;d<this._points.size();d++)c.filter(this._points.getCoordinate(d));else if(Q(arguments[0],ur)){var _=arguments[0];if(this._points.size()===0)return null;for(var M=0;M<this._points.size()&&(_.filter(this._points,M),!_.isDone());M++);_.isGeometryChanged()&&this.geometryChanged()}else Q(arguments[0],pr)?arguments[0].filter(this):Q(arguments[0],Ce)&&arguments[0].filter(this)},i.prototype.getBoundary=function(){return new oi(this).getBoundary()},i.prototype.isEquivalentClass=function(c){return c instanceof i},i.prototype.clone=function(){var c=r.prototype.clone.call(this);return c._points=this._points.clone(),c},i.prototype.getCoordinateN=function(c){return this._points.getCoordinate(c)},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(c){if(c===null&&(c=this.getFactory().getCoordinateSequenceFactory().create([])),c.size()===1)throw new I("Invalid number of points in LineString (found "+c.size()+" - must be 0 or >= 2)");this._points=c},i.prototype.isCoordinate=function(c){for(var d=0;d<this._points.size();d++)if(this._points.getCoordinate(d).equals(c))return!0;return!1},i.prototype.getStartPoint=function(){return this.isEmpty()?null:this.getPointN(0)},i.prototype.getPointN=function(c){return this.getFactory().createPoint(this._points.getCoordinate(c))},i.prototype.interfaces_=function(){return[wr]},i.prototype.getClass=function(){return i},a.serialVersionUID.get=function(){return 0x2b2b51ba435c8e00},Object.defineProperties(i,a),i}(Vt),he=function(){};he.prototype.interfaces_=function(){return[]},he.prototype.getClass=function(){return he};var ue=function(r){function i(c,d){r.call(this,d),this._coordinates=c||null,this.init(this._coordinates)}r&&(i.__proto__=r),(i.prototype=Object.create(r&&r.prototype)).constructor=i;var a={serialVersionUID:{configurable:!0}};return i.prototype.computeEnvelopeInternal=function(){if(this.isEmpty())return new qt;var c=new qt;return c.expandToInclude(this._coordinates.getX(0),this._coordinates.getY(0)),c},i.prototype.getSortIndex=function(){return r.SORTINDEX_POINT},i.prototype.getCoordinates=function(){return this.isEmpty()?[]:[this.getCoordinate()]},i.prototype.equalsExact=function(){if(arguments.length===2){var c=arguments[0],d=arguments[1];return!!this.isEquivalentClass(c)&&(!(!this.isEmpty()||!c.isEmpty())||this.isEmpty()===c.isEmpty()&&this.equal(c.getCoordinate(),this.getCoordinate(),d))}return r.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 Ie.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 c=arguments[0];return this.getCoordinate().compareTo(c.getCoordinate())}if(arguments.length===2){var d=arguments[0];return arguments[1].compare(this._coordinates,d._coordinates)}},i.prototype.apply=function(){if(Q(arguments[0],rt)){var c=arguments[0];if(this.isEmpty())return null;c.filter(this.getCoordinate())}else if(Q(arguments[0],ur)){var d=arguments[0];if(this.isEmpty())return null;d.filter(this._coordinates,0),d.isGeometryChanged()&&this.geometryChanged()}else Q(arguments[0],pr)?arguments[0].filter(this):Q(arguments[0],Ce)&&arguments[0].filter(this)},i.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},i.prototype.clone=function(){var c=r.prototype.clone.call(this);return c._coordinates=this._coordinates.clone(),c},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(c){c===null&&(c=this.getFactory().getCoordinateSequenceFactory().create([])),Wt.isTrue(c.size()<=1),this._coordinates=c},i.prototype.isSimple=function(){return!0},i.prototype.interfaces_=function(){return[he]},i.prototype.getClass=function(){return i},a.serialVersionUID.get=function(){return 4902022702746615e3},Object.defineProperties(i,a),i}(Vt),we=function(){};we.prototype.interfaces_=function(){return[]},we.prototype.getClass=function(){return we};var de=function(r){function i(c,d,_){if(r.call(this,_),this._shell=null,this._holes=null,c===null&&(c=this.getFactory().createLinearRing()),d===null&&(d=[]),r.hasNullElements(d))throw new I("holes must not contain null elements");if(c.isEmpty()&&r.hasNonEmptyElements(d))throw new I("shell is empty but holes are not");this._shell=c,this._holes=d}r&&(i.__proto__=r),(i.prototype=Object.create(r&&r.prototype)).constructor=i;var a={serialVersionUID:{configurable:!0}};return i.prototype.computeEnvelopeInternal=function(){return this._shell.getEnvelopeInternal()},i.prototype.getSortIndex=function(){return r.SORTINDEX_POLYGON},i.prototype.getCoordinates=function(){if(this.isEmpty())return[];for(var c=new Array(this.getNumPoints()).fill(null),d=-1,_=this._shell.getCoordinates(),M=0;M<_.length;M++)c[++d]=_[M];for(var L=0;L<this._holes.length;L++)for(var H=this._holes[L].getCoordinates(),it=0;it<H.length;it++)c[++d]=H[it];return c},i.prototype.getArea=function(){var c=0;c+=Math.abs(dt.signedArea(this._shell.getCoordinateSequence()));for(var d=0;d<this._holes.length;d++)c-=Math.abs(dt.signedArea(this._holes[d].getCoordinateSequence()));return c},i.prototype.isRectangle=function(){if(this.getNumInteriorRing()!==0||this._shell===null||this._shell.getNumPoints()!==5)return!1;for(var c=this._shell.getCoordinateSequence(),d=this.getEnvelopeInternal(),_=0;_<5;_++){var M=c.getX(_);if(M!==d.getMinX()&&M!==d.getMaxX())return!1;var L=c.getY(_);if(L!==d.getMinY()&&L!==d.getMaxY())return!1}for(var H=c.getX(0),it=c.getY(0),bt=1;bt<=4;bt++){var Tt=c.getX(bt),Kt=c.getY(bt);if(Tt!==H==(Kt!==it))return!1;H=Tt,it=Kt}return!0},i.prototype.equalsExact=function(){if(arguments.length===2){var c=arguments[0],d=arguments[1];if(!this.isEquivalentClass(c))return!1;var _=c,M=this._shell,L=_._shell;if(!M.equalsExact(L,d)||this._holes.length!==_._holes.length)return!1;for(var H=0;H<this._holes.length;H++)if(!this._holes[H].equalsExact(_._holes[H],d))return!1;return!0}return r.prototype.equalsExact.apply(this,arguments)},i.prototype.normalize=function(){if(arguments.length===0){this.normalize(this._shell,!0);for(var c=0;c<this._holes.length;c++)this.normalize(this._holes[c],!1);nr.sort(this._holes)}else if(arguments.length===2){var d=arguments[0],_=arguments[1];if(d.isEmpty())return null;var M=new Array(d.getCoordinates().length-1).fill(null);te.arraycopy(d.getCoordinates(),0,M,0,M.length);var L=lt.minCoordinate(d.getCoordinates());lt.scroll(M,L),te.arraycopy(M,0,d.getCoordinates(),0,M.length),d.getCoordinates()[M.length]=M[0],dt.isCCW(d.getCoordinates())===_&&lt.reverse(d.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 c=0;c+=this._shell.getLength();for(var d=0;d<this._holes.length;d++)c+=this._holes[d].getLength();return c},i.prototype.getNumPoints=function(){for(var c=this._shell.getNumPoints(),d=0;d<this._holes.length;d++)c+=this._holes[d].getNumPoints();return c},i.prototype.reverse=function(){var c=this.copy();c._shell=this._shell.copy().reverse(),c._holes=new Array(this._holes.length).fill(null);for(var d=0;d<this._holes.length;d++)c._holes[d]=this._holes[d].copy().reverse();return c},i.prototype.convexHull=function(){return this.getExteriorRing().convexHull()},i.prototype.compareToSameClass=function(){if(arguments.length===1){var c=arguments[0],d=this._shell,_=c._shell;return d.compareToSameClass(_)}if(arguments.length===2){var M=arguments[0],L=arguments[1],H=M,it=this._shell,bt=H._shell,Tt=it.compareToSameClass(bt,L);if(Tt!==0)return Tt;for(var Kt=this.getNumInteriorRing(),Qt=H.getNumInteriorRing(),le=0;le<Kt&&le<Qt;){var Ee=this.getInteriorRingN(le),Dn=H.getInteriorRingN(le),Jn=Ee.compareToSameClass(Dn,L);if(Jn!==0)return Jn;le++}return le<Kt?1:le<Qt?-1:0}},i.prototype.apply=function(c){if(Q(c,rt)){this._shell.apply(c);for(var d=0;d<this._holes.length;d++)this._holes[d].apply(c)}else if(Q(c,ur)){if(this._shell.apply(c),!c.isDone())for(var _=0;_<this._holes.length&&(this._holes[_].apply(c),!c.isDone());_++);c.isGeometryChanged()&&this.geometryChanged()}else if(Q(c,pr))c.filter(this);else if(Q(c,Ce)){c.filter(this),this._shell.apply(c);for(var M=0;M<this._holes.length;M++)this._holes[M].apply(c)}},i.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();var c=new Array(this._holes.length+1).fill(null);c[0]=this._shell;for(var d=0;d<this._holes.length;d++)c[d+1]=this._holes[d];return c.length<=1?this.getFactory().createLinearRing(c[0].getCoordinateSequence()):this.getFactory().createMultiLineString(c)},i.prototype.clone=function(){var c=r.prototype.clone.call(this);c._shell=this._shell.clone(),c._holes=new Array(this._holes.length).fill(null);for(var d=0;d<this._holes.length;d++)c._holes[d]=this._holes[d].clone();return c},i.prototype.getGeometryType=function(){return"Polygon"},i.prototype.copy=function(){for(var c=this._shell.copy(),d=new Array(this._holes.length).fill(null),_=0;_<d.length;_++)d[_]=this._holes[_].copy();return new i(c,d,this._factory)},i.prototype.getExteriorRing=function(){return this._shell},i.prototype.isEmpty=function(){return this._shell.isEmpty()},i.prototype.getInteriorRingN=function(c){return this._holes[c]},i.prototype.interfaces_=function(){return[we]},i.prototype.getClass=function(){return i},a.serialVersionUID.get=function(){return-0x307ffefd8dc97200},Object.defineProperties(i,a),i}(Vt),Be=function(r){function i(){r.apply(this,arguments)}r&&(i.__proto__=r),(i.prototype=Object.create(r&&r.prototype)).constructor=i;var a={serialVersionUID:{configurable:!0}};return i.prototype.getSortIndex=function(){return Vt.SORTINDEX_MULTIPOINT},i.prototype.isValid=function(){return!0},i.prototype.equalsExact=function(){if(arguments.length===2){var c=arguments[0],d=arguments[1];return!!this.isEquivalentClass(c)&&r.prototype.equalsExact.call(this,c,d)}return r.prototype.equalsExact.apply(this,arguments)},i.prototype.getCoordinate=function(){if(arguments.length===1){var c=arguments[0];return this._geometries[c].getCoordinate()}return r.prototype.getCoordinate.apply(this,arguments)},i.prototype.getBoundaryDimension=function(){return Ie.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 c=new Array(this._geometries.length).fill(null),d=0;d<c.length;d++)c[d]=this._geometries[d].copy();return new i(c,this._factory)},i.prototype.interfaces_=function(){return[he]},i.prototype.getClass=function(){return i},a.serialVersionUID.get=function(){return-8048474874175356e3},Object.defineProperties(i,a),i}(Qn),Ae=function(r){function i(c,d){c instanceof D&&d instanceof Le&&(c=d.getCoordinateSequenceFactory().create(c)),r.call(this,c,d),this.validateConstruction()}r&&(i.__proto__=r),(i.prototype=Object.create(r&&r.prototype)).constructor=i;var a={MINIMUM_VALID_SIZE:{configurable:!0},serialVersionUID:{configurable:!0}};return i.prototype.getSortIndex=function(){return Vt.SORTINDEX_LINEARRING},i.prototype.getBoundaryDimension=function(){return Ie.FALSE},i.prototype.isClosed=function(){return!!this.isEmpty()||r.prototype.isClosed.call(this)},i.prototype.reverse=function(){var c=this._points.copy();return St.reverse(c),this.getFactory().createLinearRing(c)},i.prototype.validateConstruction=function(){if(!this.isEmpty()&&!r.prototype.isClosed.call(this))throw new I("Points of LinearRing do not form a closed linestring");if(this.getCoordinateSequence().size()>=1&&this.getCoordinateSequence().size()<i.MINIMUM_VALID_SIZE)throw new I("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},a.MINIMUM_VALID_SIZE.get=function(){return 4},a.serialVersionUID.get=function(){return-0x3b229e262367a600},Object.defineProperties(i,a),i}(vt),Pe=function(r){function i(){r.apply(this,arguments)}r&&(i.__proto__=r),(i.prototype=Object.create(r&&r.prototype)).constructor=i;var a={serialVersionUID:{configurable:!0}};return i.prototype.getSortIndex=function(){return Vt.SORTINDEX_MULTIPOLYGON},i.prototype.equalsExact=function(){if(arguments.length===2){var c=arguments[0],d=arguments[1];return!!this.isEquivalentClass(c)&&r.prototype.equalsExact.call(this,c,d)}return r.prototype.equalsExact.apply(this,arguments)},i.prototype.getBoundaryDimension=function(){return 1},i.prototype.getDimension=function(){return 2},i.prototype.reverse=function(){for(var c=this._geometries.length,d=new Array(c).fill(null),_=0;_<this._geometries.length;_++)d[_]=this._geometries[_].reverse();return this.getFactory().createMultiPolygon(d)},i.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();for(var c=new G,d=0;d<this._geometries.length;d++)for(var _=this._geometries[d].getBoundary(),M=0;M<_.getNumGeometries();M++)c.add(_.getGeometryN(M));var L=new Array(c.size()).fill(null);return this.getFactory().createMultiLineString(c.toArray(L))},i.prototype.getGeometryType=function(){return"MultiPolygon"},i.prototype.copy=function(){for(var c=new Array(this._geometries.length).fill(null),d=0;d<c.length;d++)c[d]=this._geometries[d].copy();return new i(c,this._factory)},i.prototype.interfaces_=function(){return[we]},i.prototype.getClass=function(){return i},a.serialVersionUID.get=function(){return-0x7a5aa1369171980},Object.defineProperties(i,a),i}(Qn),rn=function(r){this._factory=r||null,this._isUserDataCopied=!1},si={NoOpGeometryOperation:{configurable:!0},CoordinateOperation:{configurable:!0},CoordinateSequenceOperation:{configurable:!0}};rn.prototype.setCopyUserData=function(r){this._isUserDataCopied=r},rn.prototype.edit=function(r,i){if(r===null)return null;var a=this.editInternal(r,i);return this._isUserDataCopied&&a.setUserData(r.getUserData()),a},rn.prototype.editInternal=function(r,i){return this._factory===null&&(this._factory=r.getFactory()),r instanceof Qn?this.editGeometryCollection(r,i):r instanceof de?this.editPolygon(r,i):r instanceof ue?i.edit(r,this._factory):r instanceof vt?i.edit(r,this._factory):(Wt.shouldNeverReachHere("Unsupported Geometry class: "+r.getClass().getName()),null)},rn.prototype.editGeometryCollection=function(r,i){for(var a=i.edit(r,this._factory),c=new G,d=0;d<a.getNumGeometries();d++){var _=this.edit(a.getGeometryN(d),i);_===null||_.isEmpty()||c.add(_)}return a.getClass()===Be?this._factory.createMultiPoint(c.toArray([])):a.getClass()===bi?this._factory.createMultiLineString(c.toArray([])):a.getClass()===Pe?this._factory.createMultiPolygon(c.toArray([])):this._factory.createGeometryCollection(c.toArray([]))},rn.prototype.editPolygon=function(r,i){var a=i.edit(r,this._factory);if(a===null&&(a=this._factory.createPolygon(null)),a.isEmpty())return a;var c=this.edit(a.getExteriorRing(),i);if(c===null||c.isEmpty())return this._factory.createPolygon();for(var d=new G,_=0;_<a.getNumInteriorRing();_++){var M=this.edit(a.getInteriorRingN(_),i);M===null||M.isEmpty()||d.add(M)}return this._factory.createPolygon(c,d.toArray([]))},rn.prototype.interfaces_=function(){return[]},rn.prototype.getClass=function(){return rn},rn.GeometryEditorOperation=function(){},si.NoOpGeometryOperation.get=function(){return br},si.CoordinateOperation.get=function(){return Wi},si.CoordinateSequenceOperation.get=function(){return sr},Object.defineProperties(rn,si);var br=function(){};br.prototype.edit=function(r,i){return r},br.prototype.interfaces_=function(){return[rn.GeometryEditorOperation]},br.prototype.getClass=function(){return br};var Wi=function(){};Wi.prototype.edit=function(r,i){var a=this.editCoordinates(r.getCoordinates(),r);return a===null?r:r instanceof Ae?i.createLinearRing(a):r instanceof vt?i.createLineString(a):r instanceof ue?a.length>0?i.createPoint(a[0]):i.createPoint():r},Wi.prototype.interfaces_=function(){return[rn.GeometryEditorOperation]},Wi.prototype.getClass=function(){return Wi};var sr=function(){};sr.prototype.edit=function(r,i){return r instanceof Ae?i.createLinearRing(this.edit(r.getCoordinateSequence(),r)):r instanceof vt?i.createLineString(this.edit(r.getCoordinateSequence(),r)):r instanceof ue?i.createPoint(this.edit(r.getCoordinateSequence(),r)):r},sr.prototype.interfaces_=function(){return[rn.GeometryEditorOperation]},sr.prototype.getClass=function(){return sr};var ye=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 r=arguments[0];this._coordinates=new Array(r).fill(null);for(var i=0;i<r;i++)this._coordinates[i]=new D}else if(Q(arguments[0],ut)){var a=arguments[0];if(a===null)return this._coordinates=new Array(0).fill(null),null;this._dimension=a.getDimension(),this._coordinates=new Array(a.size()).fill(null);for(var c=0;c<this._coordinates.length;c++)this._coordinates[c]=a.getCoordinateCopy(c)}}else if(arguments.length===2){if(arguments[0]instanceof Array&&Number.isInteger(arguments[1])){var d=arguments[0],_=arguments[1];this._coordinates=d,this._dimension=_,d===null&&(this._coordinates=new Array(0).fill(null))}else if(Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var M=arguments[0],L=arguments[1];this._coordinates=new Array(M).fill(null),this._dimension=L;for(var H=0;H<M;H++)this._coordinates[H]=new D}}},Da={serialVersionUID:{configurable:!0}};ye.prototype.setOrdinate=function(r,i,a){switch(i){case ut.X:this._coordinates[r].x=a;break;case ut.Y:this._coordinates[r].y=a;break;case ut.Z:this._coordinates[r].z=a;break;default:throw new I("invalid ordinateIndex")}},ye.prototype.size=function(){return this._coordinates.length},ye.prototype.getOrdinate=function(r,i){switch(i){case ut.X:return this._coordinates[r].x;case ut.Y:return this._coordinates[r].y;case ut.Z:return this._coordinates[r].z}return A.NaN},ye.prototype.getCoordinate=function(){if(arguments.length===1){var r=arguments[0];return this._coordinates[r]}if(arguments.length===2){var i=arguments[0],a=arguments[1];a.x=this._coordinates[i].x,a.y=this._coordinates[i].y,a.z=this._coordinates[i].z}},ye.prototype.getCoordinateCopy=function(r){return new D(this._coordinates[r])},ye.prototype.getDimension=function(){return this._dimension},ye.prototype.getX=function(r){return this._coordinates[r].x},ye.prototype.clone=function(){for(var r=new Array(this.size()).fill(null),i=0;i<this._coordinates.length;i++)r[i]=this._coordinates[i].clone();return new ye(r,this._dimension)},ye.prototype.expandEnvelope=function(r){for(var i=0;i<this._coordinates.length;i++)r.expandToInclude(this._coordinates[i]);return r},ye.prototype.copy=function(){for(var r=new Array(this.size()).fill(null),i=0;i<this._coordinates.length;i++)r[i]=this._coordinates[i].copy();return new ye(r,this._dimension)},ye.prototype.toString=function(){if(this._coordinates.length>0){var r=new Lt(17*this._coordinates.length);r.append("("),r.append(this._coordinates[0]);for(var i=1;i<this._coordinates.length;i++)r.append(", "),r.append(this._coordinates[i]);return r.append(")"),r.toString()}return"()"},ye.prototype.getY=function(r){return this._coordinates[r].y},ye.prototype.toCoordinateArray=function(){return this._coordinates},ye.prototype.interfaces_=function(){return[ut,t]},ye.prototype.getClass=function(){return ye},Da.serialVersionUID.get=function(){return-0xcb44a778db18e00},Object.defineProperties(ye,Da);var on=function(){},fo={serialVersionUID:{configurable:!0},instanceObject:{configurable:!0}};on.prototype.readResolve=function(){return on.instance()},on.prototype.create=function(){if(arguments.length===1){if(arguments[0]instanceof Array){var r=arguments[0];return new ye(r)}if(Q(arguments[0],ut)){var i=arguments[0];return new ye(i)}}else if(arguments.length===2){var a=arguments[0],c=arguments[1];return c>3&&(c=3),c<2?new ye(a):new ye(a,c)}},on.prototype.interfaces_=function(){return[j,t]},on.prototype.getClass=function(){return on},on.instance=function(){return on.instanceObject},fo.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00},fo.instanceObject.get=function(){return new on},Object.defineProperties(on,fo);var ul=function(r){function i(){r.call(this),this.map_=new Map}return r&&(i.__proto__=r),i.prototype=Object.create(r&&r.prototype),i.prototype.constructor=i,i.prototype.get=function(a){return this.map_.get(a)||null},i.prototype.put=function(a,c){return this.map_.set(a,c),c},i.prototype.values=function(){for(var a=new G,c=this.map_.values(),d=c.next();!d.done;)a.add(d.value),d=c.next();return a},i.prototype.entrySet=function(){var a=new Ue;return this.map_.entries().forEach(function(c){return a.add(c)}),a},i.prototype.size=function(){return this.map_.size()},i}(ve),ze=function r(){if(this._modelType=null,this._scale=null,arguments.length===0)this._modelType=r.FLOATING;else if(arguments.length===1){if(arguments[0]instanceof ir){var i=arguments[0];this._modelType=i,i===r.FIXED&&this.setScale(1)}else if(typeof arguments[0]=="number"){var a=arguments[0];this._modelType=r.FIXED,this.setScale(a)}else if(arguments[0]instanceof r){var c=arguments[0];this._modelType=c._modelType,this._scale=c._scale}}},ys={serialVersionUID:{configurable:!0},maximumPreciseValue:{configurable:!0}};ze.prototype.equals=function(r){if(!(r instanceof ze))return!1;var i=r;return this._modelType===i._modelType&&this._scale===i._scale},ze.prototype.compareTo=function(r){var i=r,a=this.getMaximumSignificantDigits(),c=i.getMaximumSignificantDigits();return new pt(a).compareTo(new pt(c))},ze.prototype.getScale=function(){return this._scale},ze.prototype.isFloating=function(){return this._modelType===ze.FLOATING||this._modelType===ze.FLOATING_SINGLE},ze.prototype.getType=function(){return this._modelType},ze.prototype.toString=function(){var r="UNKNOWN";return this._modelType===ze.FLOATING?r="Floating":this._modelType===ze.FLOATING_SINGLE?r="Floating-Single":this._modelType===ze.FIXED&&(r="Fixed (Scale="+this.getScale()+")"),r},ze.prototype.makePrecise=function(){if(typeof arguments[0]=="number"){var r=arguments[0];return A.isNaN(r)||this._modelType===ze.FLOATING_SINGLE?r:this._modelType===ze.FIXED?Math.round(r*this._scale)/this._scale:r}if(arguments[0]instanceof D){var i=arguments[0];if(this._modelType===ze.FLOATING)return null;i.x=this.makePrecise(i.x),i.y=this.makePrecise(i.y)}},ze.prototype.getMaximumSignificantDigits=function(){var r=16;return this._modelType===ze.FLOATING?r=16:this._modelType===ze.FLOATING_SINGLE?r=6:this._modelType===ze.FIXED&&(r=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),r},ze.prototype.setScale=function(r){this._scale=Math.abs(r)},ze.prototype.interfaces_=function(){return[t,V]},ze.prototype.getClass=function(){return ze},ze.mostPrecise=function(r,i){return r.compareTo(i)>=0?r:i},ys.serialVersionUID.get=function(){return 7777263578777804e3},ys.maximumPreciseValue.get=function(){return 9007199254740992},Object.defineProperties(ze,ys);var ir=function r(i){this._name=i||null,r.nameToTypeMap.put(i,this)},jo={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}};ir.prototype.readResolve=function(){return ir.nameToTypeMap.get(this._name)},ir.prototype.toString=function(){return this._name},ir.prototype.interfaces_=function(){return[t]},ir.prototype.getClass=function(){return ir},jo.serialVersionUID.get=function(){return-552860263173159e4},jo.nameToTypeMap.get=function(){return new ul},Object.defineProperties(ir,jo),ze.Type=ir,ze.FIXED=new ir("FIXED"),ze.FLOATING=new ir("FLOATING"),ze.FLOATING_SINGLE=new ir("FLOATING SINGLE");var Le=function r(){this._precisionModel=new ze,this._SRID=0,this._coordinateSequenceFactory=r.getDefaultCoordinateSequenceFactory(),arguments.length===0||(arguments.length===1?Q(arguments[0],j)?this._coordinateSequenceFactory=arguments[0]:arguments[0]instanceof ze&&(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]))},Ai={serialVersionUID:{configurable:!0}};Le.prototype.toGeometry=function(r){return r.isNull()?this.createPoint(null):r.getMinX()===r.getMaxX()&&r.getMinY()===r.getMaxY()?this.createPoint(new D(r.getMinX(),r.getMinY())):r.getMinX()===r.getMaxX()||r.getMinY()===r.getMaxY()?this.createLineString([new D(r.getMinX(),r.getMinY()),new D(r.getMaxX(),r.getMaxY())]):this.createPolygon(this.createLinearRing([new D(r.getMinX(),r.getMinY()),new D(r.getMinX(),r.getMaxY()),new D(r.getMaxX(),r.getMaxY()),new D(r.getMaxX(),r.getMinY()),new D(r.getMinX(),r.getMinY())]),null)},Le.prototype.createLineString=function(r){return r?r instanceof Array?new vt(this.getCoordinateSequenceFactory().create(r),this):Q(r,ut)?new vt(r,this):void 0:new vt(this.getCoordinateSequenceFactory().create([]),this)},Le.prototype.createMultiLineString=function(){if(arguments.length===0)return new bi(null,this);if(arguments.length===1){var r=arguments[0];return new bi(r,this)}},Le.prototype.buildGeometry=function(r){for(var i=null,a=!1,c=!1,d=r.iterator();d.hasNext();){var _=d.next(),M=_.getClass();i===null&&(i=M),M!==i&&(a=!0),_.isGeometryCollectionOrDerived()&&(c=!0)}if(i===null)return this.createGeometryCollection();if(a||c)return this.createGeometryCollection(Le.toGeometryArray(r));var L=r.iterator().next();if(r.size()>1){if(L instanceof de)return this.createMultiPolygon(Le.toPolygonArray(r));if(L instanceof vt)return this.createMultiLineString(Le.toLineStringArray(r));if(L instanceof ue)return this.createMultiPoint(Le.toPointArray(r));Wt.shouldNeverReachHere("Unhandled class: "+L.getClass().getName())}return L},Le.prototype.createMultiPointFromCoords=function(r){return this.createMultiPoint(r!==null?this.getCoordinateSequenceFactory().create(r):null)},Le.prototype.createPoint=function(){if(arguments.length===0)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof D){var r=arguments[0];return this.createPoint(r!==null?this.getCoordinateSequenceFactory().create([r]):null)}if(Q(arguments[0],ut)){var i=arguments[0];return new ue(i,this)}}},Le.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory},Le.prototype.createPolygon=function(){if(arguments.length===0)return new de(null,null,this);if(arguments.length===1){if(Q(arguments[0],ut)){var r=arguments[0];return this.createPolygon(this.createLinearRing(r))}if(arguments[0]instanceof Array){var i=arguments[0];return this.createPolygon(this.createLinearRing(i))}if(arguments[0]instanceof Ae){var a=arguments[0];return this.createPolygon(a,null)}}else if(arguments.length===2){var c=arguments[0],d=arguments[1];return new de(c,d,this)}},Le.prototype.getSRID=function(){return this._SRID},Le.prototype.createGeometryCollection=function(){if(arguments.length===0)return new Qn(null,this);if(arguments.length===1){var r=arguments[0];return new Qn(r,this)}},Le.prototype.createGeometry=function(r){return new rn(this).edit(r,{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 r=arguments[0];return this.createLinearRing(r!==null?this.getCoordinateSequenceFactory().create(r):null)}if(Q(arguments[0],ut)){var i=arguments[0];return new Ae(i,this)}}},Le.prototype.createMultiPolygon=function(){if(arguments.length===0)return new Pe(null,this);if(arguments.length===1){var r=arguments[0];return new Pe(r,this)}},Le.prototype.createMultiPoint=function(){if(arguments.length===0)return new Be(null,this);if(arguments.length===1){if(arguments[0]instanceof Array){var r=arguments[0];return new Be(r,this)}if(arguments[0]instanceof Array){var i=arguments[0];return this.createMultiPoint(i!==null?this.getCoordinateSequenceFactory().create(i):null)}if(Q(arguments[0],ut)){var a=arguments[0];if(a===null)return this.createMultiPoint(new Array(0).fill(null));for(var c=new Array(a.size()).fill(null),d=0;d<a.size();d++){var _=this.getCoordinateSequenceFactory().create(1,a.getDimension());St.copy(a,d,_,0,1),c[d]=this.createPoint(_)}return this.createMultiPoint(c)}}},Le.prototype.interfaces_=function(){return[t]},Le.prototype.getClass=function(){return Le},Le.toMultiPolygonArray=function(r){var i=new Array(r.size()).fill(null);return r.toArray(i)},Le.toGeometryArray=function(r){if(r===null)return null;var i=new Array(r.size()).fill(null);return r.toArray(i)},Le.getDefaultCoordinateSequenceFactory=function(){return on.instance()},Le.toMultiLineStringArray=function(r){var i=new Array(r.size()).fill(null);return r.toArray(i)},Le.toLineStringArray=function(r){var i=new Array(r.size()).fill(null);return r.toArray(i)},Le.toMultiPointArray=function(r){var i=new Array(r.size()).fill(null);return r.toArray(i)},Le.toLinearRingArray=function(r){var i=new Array(r.size()).fill(null);return r.toArray(i)},Le.toPointArray=function(r){var i=new Array(r.size()).fill(null);return r.toArray(i)},Le.toPolygonArray=function(r){var i=new Array(r.size()).fill(null);return r.toArray(i)},Le.createPointFromInternalCoord=function(r,i){return i.getPrecisionModel().makePrecise(r),i.getFactory().createPoint(r)},Ai.serialVersionUID.get=function(){return-6820524753094096e3},Object.defineProperties(Le,Ai);var Fa=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],mu=function(r){this.geometryFactory=r||new Le};mu.prototype.read=function(r){var i,a=(i=typeof r=="string"?JSON.parse(r):r).type;if(!Ti[a])throw new Error("Unknown GeoJSON type: "+i.type);return Fa.indexOf(a)!==-1?Ti[a].apply(this,[i.coordinates]):a==="GeometryCollection"?Ti[a].apply(this,[i.geometries]):Ti[a].apply(this,[i])},mu.prototype.write=function(r){var i=r.getGeometryType();if(!Po[i])throw new Error("Geometry is not supported");return Po[i].apply(this,[r])};var Ti={Feature:function(r){var i={};for(var a in r)i[a]=r[a];if(r.geometry){var c=r.geometry.type;if(!Ti[c])throw new Error("Unknown GeoJSON type: "+r.type);i.geometry=this.read(r.geometry)}return r.bbox&&(i.bbox=Ti.bbox.apply(this,[r.bbox])),i},FeatureCollection:function(r){var i={};if(r.features){i.features=[];for(var a=0;a<r.features.length;++a)i.features.push(this.read(r.features[a]))}return r.bbox&&(i.bbox=this.parse.bbox.apply(this,[r.bbox])),i},coordinates:function(r){for(var i=[],a=0;a<r.length;++a){var c=r[a];i.push(new D(c[0],c[1]))}return i},bbox:function(r){return this.geometryFactory.createLinearRing([new D(r[0],r[1]),new D(r[2],r[1]),new D(r[2],r[3]),new D(r[0],r[3]),new D(r[0],r[1])])},Point:function(r){var i=new D(r[0],r[1]);return this.geometryFactory.createPoint(i)},MultiPoint:function(r){for(var i=[],a=0;a<r.length;++a)i.push(Ti.Point.apply(this,[r[a]]));return this.geometryFactory.createMultiPoint(i)},LineString:function(r){var i=Ti.coordinates.apply(this,[r]);return this.geometryFactory.createLineString(i)},MultiLineString:function(r){for(var i=[],a=0;a<r.length;++a)i.push(Ti.LineString.apply(this,[r[a]]));return this.geometryFactory.createMultiLineString(i)},Polygon:function(r){for(var i=Ti.coordinates.apply(this,[r[0]]),a=this.geometryFactory.createLinearRing(i),c=[],d=1;d<r.length;++d){var _=r[d],M=Ti.coordinates.apply(this,[_]),L=this.geometryFactory.createLinearRing(M);c.push(L)}return this.geometryFactory.createPolygon(a,c)},MultiPolygon:function(r){for(var i=[],a=0;a<r.length;++a){var c=r[a];i.push(Ti.Polygon.apply(this,[c]))}return this.geometryFactory.createMultiPolygon(i)},GeometryCollection:function(r){for(var i=[],a=0;a<r.length;++a){var c=r[a];i.push(this.read(c))}return this.geometryFactory.createGeometryCollection(i)}},Po={coordinate:function(r){return[r.x,r.y]},Point:function(r){return{type:"Point",coordinates:Po.coordinate.apply(this,[r.getCoordinate()])}},MultiPoint:function(r){for(var i=[],a=0;a<r._geometries.length;++a){var c=r._geometries[a],d=Po.Point.apply(this,[c]);i.push(d.coordinates)}return{type:"MultiPoint",coordinates:i}},LineString:function(r){for(var i=[],a=r.getCoordinates(),c=0;c<a.length;++c){var d=a[c];i.push(Po.coordinate.apply(this,[d]))}return{type:"LineString",coordinates:i}},MultiLineString:function(r){for(var i=[],a=0;a<r._geometries.length;++a){var c=r._geometries[a],d=Po.LineString.apply(this,[c]);i.push(d.coordinates)}return{type:"MultiLineString",coordinates:i}},Polygon:function(r){var i=[],a=Po.LineString.apply(this,[r._shell]);i.push(a.coordinates);for(var c=0;c<r._holes.length;++c){var d=r._holes[c],_=Po.LineString.apply(this,[d]);i.push(_.coordinates)}return{type:"Polygon",coordinates:i}},MultiPolygon:function(r){for(var i=[],a=0;a<r._geometries.length;++a){var c=r._geometries[a],d=Po.Polygon.apply(this,[c]);i.push(d.coordinates)}return{type:"MultiPolygon",coordinates:i}},GeometryCollection:function(r){for(var i=[],a=0;a<r._geometries.length;++a){var c=r._geometries[a],d=c.getGeometryType();i.push(Po[d].apply(this,[c]))}return{type:"GeometryCollection",geometries:i}}},ll=function(r){this.geometryFactory=r||new Le,this.precisionModel=this.geometryFactory.getPrecisionModel(),this.parser=new mu(this.geometryFactory)};ll.prototype.read=function(r){var i=this.parser.read(r);return this.precisionModel.getType()===ze.FIXED&&this.reducePrecision(i),i},ll.prototype.reducePrecision=function(r){var i,a;if(r.coordinate)this.precisionModel.makePrecise(r.coordinate);else if(r.points)for(i=0,a=r.points.length;i<a;i++)this.precisionModel.makePrecise(r.points[i]);else if(r.geometries)for(i=0,a=r.geometries.length;i<a;i++)this.reducePrecision(r.geometries[i])};var Ua=function(){this.parser=new mu(this.geometryFactory)};Ua.prototype.write=function(r){return this.parser.write(r)};var Xt=function(){},cl={ON:{configurable:!0},LEFT:{configurable:!0},RIGHT:{configurable:!0}};Xt.prototype.interfaces_=function(){return[]},Xt.prototype.getClass=function(){return Xt},Xt.opposite=function(r){return r===Xt.LEFT?Xt.RIGHT:r===Xt.RIGHT?Xt.LEFT:r},cl.ON.get=function(){return 0},cl.LEFT.get=function(){return 1},cl.RIGHT.get=function(){return 2},Object.defineProperties(Xt,cl),(R.prototype=new Error).name="EmptyStackException",(x.prototype=new Et).add=function(r){return this.array_.push(r),!0},x.prototype.get=function(r){if(r<0||r>=this.size())throw new Error;return this.array_[r]},x.prototype.push=function(r){return this.array_.push(r),r},x.prototype.pop=function(r){if(this.array_.length===0)throw new R;return this.array_.pop()},x.prototype.peek=function(){if(this.array_.length===0)throw new R;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(r){return this.array_.indexOf(r)},x.prototype.size=function(){return this.array_.length},x.prototype.toArray=function(){for(var r=[],i=0,a=this.array_.length;i<a;i++)r.push(this.array_[i]);return r};var Io=function(){this._minIndex=-1,this._minCoord=null,this._minDe=null,this._orientedDe=null};Io.prototype.getCoordinate=function(){return this._minCoord},Io.prototype.getRightmostSide=function(r,i){var a=this.getRightmostSideOfSegment(r,i);return a<0&&(a=this.getRightmostSideOfSegment(r,i-1)),a<0&&(this._minCoord=null,this.checkForRightmostCoordinate(r)),a},Io.prototype.findRightmostEdgeAtVertex=function(){var r=this._minDe.getEdge().getCoordinates();Wt.isTrue(this._minIndex>0&&this._minIndex<r.length,"rightmost point expected to be interior vertex of edge");var i=r[this._minIndex-1],a=r[this._minIndex+1],c=dt.computeOrientation(this._minCoord,a,i),d=!1;(i.y<this._minCoord.y&&a.y<this._minCoord.y&&c===dt.COUNTERCLOCKWISE||i.y>this._minCoord.y&&a.y>this._minCoord.y&&c===dt.CLOCKWISE)&&(d=!0),d&&(this._minIndex=this._minIndex-1)},Io.prototype.getRightmostSideOfSegment=function(r,i){var a=r.getEdge().getCoordinates();if(i<0||i+1>=a.length||a[i].y===a[i+1].y)return-1;var c=Xt.LEFT;return a[i].y<a[i+1].y&&(c=Xt.RIGHT),c},Io.prototype.getEdge=function(){return this._orientedDe},Io.prototype.checkForRightmostCoordinate=function(r){for(var i=r.getEdge().getCoordinates(),a=0;a<i.length-1;a++)(this._minCoord===null||i[a].x>this._minCoord.x)&&(this._minDe=r,this._minIndex=a,this._minCoord=i[a])},Io.prototype.findRightmostEdgeAtNode=function(){var r=this._minDe.getNode().getEdges();this._minDe=r.getRightmostEdge(),this._minDe.isForward()||(this._minDe=this._minDe.getSym(),this._minIndex=this._minDe.getEdge().getCoordinates().length-1)},Io.prototype.findEdge=function(r){for(var i=r.iterator();i.hasNext();){var a=i.next();a.isForward()&&this.checkForRightmostCoordinate(a)}Wt.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)===Xt.LEFT&&(this._orientedDe=this._minDe.getSym())},Io.prototype.interfaces_=function(){return[]},Io.prototype.getClass=function(){return Io};var Qo=function(r){function i(a,c){r.call(this,i.msgWithCoord(a,c)),this.pt=c?new D(c):null,this.name="TopologyException"}return r&&(i.__proto__=r),i.prototype=Object.create(r&&r.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(a,c){return c?a:a+" [ "+c+" ]"},i}(Te),fl=function(){this.array_=[]};fl.prototype.addLast=function(r){this.array_.push(r)},fl.prototype.removeFirst=function(){return this.array_.shift()},fl.prototype.isEmpty=function(){return this.array_.length===0};var Jr=function(){this._finder=null,this._dirEdgeList=new G,this._nodes=new G,this._rightMostCoord=null,this._env=null,this._finder=new Io};Jr.prototype.clearVisitedEdges=function(){for(var r=this._dirEdgeList.iterator();r.hasNext();)r.next().setVisited(!1)},Jr.prototype.getRightmostCoordinate=function(){return this._rightMostCoord},Jr.prototype.computeNodeDepth=function(r){for(var i=null,a=r.getEdges().iterator();a.hasNext();){var c=a.next();if(c.isVisited()||c.getSym().isVisited()){i=c;break}}if(i===null)throw new Qo("unable to find edge to compute depths at "+r.getCoordinate());r.getEdges().computeDepths(i);for(var d=r.getEdges().iterator();d.hasNext();){var _=d.next();_.setVisited(!0),this.copySymDepths(_)}},Jr.prototype.computeDepth=function(r){this.clearVisitedEdges();var i=this._finder.getEdge();i.setEdgeDepths(Xt.RIGHT,r),this.copySymDepths(i),this.computeDepths(i)},Jr.prototype.create=function(r){this.addReachable(r),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()},Jr.prototype.findResultEdges=function(){for(var r=this._dirEdgeList.iterator();r.hasNext();){var i=r.next();i.getDepth(Xt.RIGHT)>=1&&i.getDepth(Xt.LEFT)<=0&&!i.isInteriorAreaEdge()&&i.setInResult(!0)}},Jr.prototype.computeDepths=function(r){var i=new Ue,a=new fl,c=r.getNode();for(a.addLast(c),i.add(c),r.setVisited(!0);!a.isEmpty();){var d=a.removeFirst();i.add(d),this.computeNodeDepth(d);for(var _=d.getEdges().iterator();_.hasNext();){var M=_.next().getSym();if(!M.isVisited()){var L=M.getNode();i.contains(L)||(a.addLast(L),i.add(L))}}}},Jr.prototype.compareTo=function(r){var i=r;return this._rightMostCoord.x<i._rightMostCoord.x?-1:this._rightMostCoord.x>i._rightMostCoord.x?1:0},Jr.prototype.getEnvelope=function(){if(this._env===null){for(var r=new qt,i=this._dirEdgeList.iterator();i.hasNext();)for(var a=i.next().getEdge().getCoordinates(),c=0;c<a.length-1;c++)r.expandToInclude(a[c]);this._env=r}return this._env},Jr.prototype.addReachable=function(r){var i=new x;for(i.add(r);!i.empty();){var a=i.pop();this.add(a,i)}},Jr.prototype.copySymDepths=function(r){var i=r.getSym();i.setDepth(Xt.LEFT,r.getDepth(Xt.RIGHT)),i.setDepth(Xt.RIGHT,r.getDepth(Xt.LEFT))},Jr.prototype.add=function(r,i){r.setVisited(!0),this._nodes.add(r);for(var a=r.getEdges().iterator();a.hasNext();){var c=a.next();this._dirEdgeList.add(c);var d=c.getSym().getNode();d.isVisited()||i.push(d)}},Jr.prototype.getNodes=function(){return this._nodes},Jr.prototype.getDirectedEdges=function(){return this._dirEdgeList},Jr.prototype.interfaces_=function(){return[V]},Jr.prototype.getClass=function(){return Jr};var Zn=function r(){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 a=arguments[0];this.init(1),this.location[Xt.ON]=a}else if(arguments[0]instanceof r){var c=arguments[0];if(this.init(c.location.length),c!==null)for(var d=0;d<this.location.length;d++)this.location[d]=c.location[d]}}else if(arguments.length===3){var _=arguments[0],M=arguments[1],L=arguments[2];this.init(3),this.location[Xt.ON]=_,this.location[Xt.LEFT]=M,this.location[Xt.RIGHT]=L}};Zn.prototype.setAllLocations=function(r){for(var i=0;i<this.location.length;i++)this.location[i]=r},Zn.prototype.isNull=function(){for(var r=0;r<this.location.length;r++)if(this.location[r]!==K.NONE)return!1;return!0},Zn.prototype.setAllLocationsIfNull=function(r){for(var i=0;i<this.location.length;i++)this.location[i]===K.NONE&&(this.location[i]=r)},Zn.prototype.isLine=function(){return this.location.length===1},Zn.prototype.merge=function(r){if(r.location.length>this.location.length){var i=new Array(3).fill(null);i[Xt.ON]=this.location[Xt.ON],i[Xt.LEFT]=K.NONE,i[Xt.RIGHT]=K.NONE,this.location=i}for(var a=0;a<this.location.length;a++)this.location[a]===K.NONE&&a<r.location.length&&(this.location[a]=r.location[a])},Zn.prototype.getLocations=function(){return this.location},Zn.prototype.flip=function(){if(this.location.length<=1)return null;var r=this.location[Xt.LEFT];this.location[Xt.LEFT]=this.location[Xt.RIGHT],this.location[Xt.RIGHT]=r},Zn.prototype.toString=function(){var r=new Lt;return this.location.length>1&&r.append(K.toLocationSymbol(this.location[Xt.LEFT])),r.append(K.toLocationSymbol(this.location[Xt.ON])),this.location.length>1&&r.append(K.toLocationSymbol(this.location[Xt.RIGHT])),r.toString()},Zn.prototype.setLocations=function(r,i,a){this.location[Xt.ON]=r,this.location[Xt.LEFT]=i,this.location[Xt.RIGHT]=a},Zn.prototype.get=function(r){return r<this.location.length?this.location[r]:K.NONE},Zn.prototype.isArea=function(){return this.location.length>1},Zn.prototype.isAnyNull=function(){for(var r=0;r<this.location.length;r++)if(this.location[r]===K.NONE)return!0;return!1},Zn.prototype.setLocation=function(){if(arguments.length===1){var r=arguments[0];this.setLocation(Xt.ON,r)}else if(arguments.length===2){var i=arguments[0],a=arguments[1];this.location[i]=a}},Zn.prototype.init=function(r){this.location=new Array(r).fill(null),this.setAllLocations(K.NONE)},Zn.prototype.isEqualOnSide=function(r,i){return this.location[i]===r.location[i]},Zn.prototype.allPositionsEqual=function(r){for(var i=0;i<this.location.length;i++)if(this.location[i]!==r)return!1;return!0},Zn.prototype.interfaces_=function(){return[]},Zn.prototype.getClass=function(){return Zn};var On=function r(){if(this.elt=new Array(2).fill(null),arguments.length===1){if(Number.isInteger(arguments[0])){var i=arguments[0];this.elt[0]=new Zn(i),this.elt[1]=new Zn(i)}else if(arguments[0]instanceof r){var a=arguments[0];this.elt[0]=new Zn(a.elt[0]),this.elt[1]=new Zn(a.elt[1])}}else if(arguments.length===2){var c=arguments[0],d=arguments[1];this.elt[0]=new Zn(K.NONE),this.elt[1]=new Zn(K.NONE),this.elt[c].setLocation(d)}else if(arguments.length===3){var _=arguments[0],M=arguments[1],L=arguments[2];this.elt[0]=new Zn(_,M,L),this.elt[1]=new Zn(_,M,L)}else if(arguments.length===4){var H=arguments[0],it=arguments[1],bt=arguments[2],Tt=arguments[3];this.elt[0]=new Zn(K.NONE,K.NONE,K.NONE),this.elt[1]=new Zn(K.NONE,K.NONE,K.NONE),this.elt[H].setLocations(it,bt,Tt)}};On.prototype.getGeometryCount=function(){var r=0;return this.elt[0].isNull()||r++,this.elt[1].isNull()||r++,r},On.prototype.setAllLocations=function(r,i){this.elt[r].setAllLocations(i)},On.prototype.isNull=function(r){return this.elt[r].isNull()},On.prototype.setAllLocationsIfNull=function(){if(arguments.length===1){var r=arguments[0];this.setAllLocationsIfNull(0,r),this.setAllLocationsIfNull(1,r)}else if(arguments.length===2){var i=arguments[0],a=arguments[1];this.elt[i].setAllLocationsIfNull(a)}},On.prototype.isLine=function(r){return this.elt[r].isLine()},On.prototype.merge=function(r){for(var i=0;i<2;i++)this.elt[i]===null&&r.elt[i]!==null?this.elt[i]=new Zn(r.elt[i]):this.elt[i].merge(r.elt[i])},On.prototype.flip=function(){this.elt[0].flip(),this.elt[1].flip()},On.prototype.getLocation=function(){if(arguments.length===1){var r=arguments[0];return this.elt[r].get(Xt.ON)}if(arguments.length===2){var i=arguments[0],a=arguments[1];return this.elt[i].get(a)}},On.prototype.toString=function(){var r=new Lt;return this.elt[0]!==null&&(r.append("A:"),r.append(this.elt[0].toString())),this.elt[1]!==null&&(r.append(" B:"),r.append(this.elt[1].toString())),r.toString()},On.prototype.isArea=function(){if(arguments.length===0)return this.elt[0].isArea()||this.elt[1].isArea();if(arguments.length===1){var r=arguments[0];return this.elt[r].isArea()}},On.prototype.isAnyNull=function(r){return this.elt[r].isAnyNull()},On.prototype.setLocation=function(){if(arguments.length===2){var r=arguments[0],i=arguments[1];this.elt[r].setLocation(Xt.ON,i)}else if(arguments.length===3){var a=arguments[0],c=arguments[1],d=arguments[2];this.elt[a].setLocation(c,d)}},On.prototype.isEqualOnSide=function(r,i){return this.elt[0].isEqualOnSide(r.elt[0],i)&&this.elt[1].isEqualOnSide(r.elt[1],i)},On.prototype.allPositionsEqual=function(r,i){return this.elt[r].allPositionsEqual(i)},On.prototype.toLine=function(r){this.elt[r].isArea()&&(this.elt[r]=new Zn(this.elt[r].location[0]))},On.prototype.interfaces_=function(){return[]},On.prototype.getClass=function(){return On},On.toLineLabel=function(r){for(var i=new On(K.NONE),a=0;a<2;a++)i.setLocation(a,r.getLocation(a));return i};var Ar=function(){this._startDe=null,this._maxNodeDegree=-1,this._edges=new G,this._pts=new G,this._label=new On(K.NONE),this._ring=null,this._isHole=null,this._shell=null,this._holes=new G,this._geometryFactory=null;var r=arguments[0],i=arguments[1];this._geometryFactory=i,this.computePoints(r),this.computeRing()};Ar.prototype.computeRing=function(){if(this._ring!==null)return null;for(var r=new Array(this._pts.size()).fill(null),i=0;i<this._pts.size();i++)r[i]=this._pts.get(i);this._ring=this._geometryFactory.createLinearRing(r),this._isHole=dt.isCCW(this._ring.getCoordinates())},Ar.prototype.isIsolated=function(){return this._label.getGeometryCount()===1},Ar.prototype.computePoints=function(r){this._startDe=r;var i=r,a=!0;do{if(i===null)throw new Qo("Found null DirectedEdge");if(i.getEdgeRing()===this)throw new Qo("Directed Edge visited twice during ring-building at "+i.getCoordinate());this._edges.add(i);var c=i.getLabel();Wt.isTrue(c.isArea()),this.mergeLabel(c),this.addPoints(i.getEdge(),i.isForward(),a),a=!1,this.setEdgeRing(i,this),i=this.getNext(i)}while(i!==this._startDe)},Ar.prototype.getLinearRing=function(){return this._ring},Ar.prototype.getCoordinate=function(r){return this._pts.get(r)},Ar.prototype.computeMaxNodeDegree=function(){this._maxNodeDegree=0;var r=this._startDe;do{var i=r.getNode().getEdges().getOutgoingDegree(this);i>this._maxNodeDegree&&(this._maxNodeDegree=i),r=this.getNext(r)}while(r!==this._startDe);this._maxNodeDegree*=2},Ar.prototype.addPoints=function(r,i,a){var c=r.getCoordinates();if(i){var d=1;a&&(d=0);for(var _=d;_<c.length;_++)this._pts.add(c[_])}else{var M=c.length-2;a&&(M=c.length-1);for(var L=M;L>=0;L--)this._pts.add(c[L])}},Ar.prototype.isHole=function(){return this._isHole},Ar.prototype.setInResult=function(){var r=this._startDe;do r.getEdge().setInResult(!0),r=r.getNext();while(r!==this._startDe)},Ar.prototype.containsPoint=function(r){var i=this.getLinearRing();if(!i.getEnvelopeInternal().contains(r)||!dt.isPointInRing(r,i.getCoordinates()))return!1;for(var a=this._holes.iterator();a.hasNext();)if(a.next().containsPoint(r))return!1;return!0},Ar.prototype.addHole=function(r){this._holes.add(r)},Ar.prototype.isShell=function(){return this._shell===null},Ar.prototype.getLabel=function(){return this._label},Ar.prototype.getEdges=function(){return this._edges},Ar.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree},Ar.prototype.getShell=function(){return this._shell},Ar.prototype.mergeLabel=function(){if(arguments.length===1){var r=arguments[0];this.mergeLabel(r,0),this.mergeLabel(r,1)}else if(arguments.length===2){var i=arguments[0],a=arguments[1],c=i.getLocation(a,Xt.RIGHT);if(c===K.NONE)return null;if(this._label.getLocation(a)===K.NONE)return this._label.setLocation(a,c),null}},Ar.prototype.setShell=function(r){this._shell=r,r!==null&&r.addHole(this)},Ar.prototype.toPolygon=function(r){for(var i=new Array(this._holes.size()).fill(null),a=0;a<this._holes.size();a++)i[a]=this._holes.get(a).getLinearRing();return r.createPolygon(this.getLinearRing(),i)},Ar.prototype.interfaces_=function(){return[]},Ar.prototype.getClass=function(){return Ar};var tm=function(r){function i(){var a=arguments[0],c=arguments[1];r.call(this,a,c)}return r&&(i.__proto__=r),i.prototype=Object.create(r&&r.prototype),i.prototype.constructor=i,i.prototype.setEdgeRing=function(a,c){a.setMinEdgeRing(c)},i.prototype.getNext=function(a){return a.getNextMin()},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(Ar),zh=function(r){function i(){var a=arguments[0],c=arguments[1];r.call(this,a,c)}return r&&(i.__proto__=r),i.prototype=Object.create(r&&r.prototype),i.prototype.constructor=i,i.prototype.buildMinimalRings=function(){var a=new G,c=this._startDe;do{if(c.getMinEdgeRing()===null){var d=new tm(c,this._geometryFactory);a.add(d)}c=c.getNext()}while(c!==this._startDe);return a},i.prototype.setEdgeRing=function(a,c){a.setEdgeRing(c)},i.prototype.linkDirectedEdgesForMinimalEdgeRings=function(){var a=this._startDe;do a.getNode().getEdges().linkMinimalDirectedEdges(this),a=a.getNext();while(a!==this._startDe)},i.prototype.getNext=function(a){return a.getNext()},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(Ar),Xi=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 r=arguments[0];this._label=r}}};Xi.prototype.setVisited=function(r){this._isVisited=r},Xi.prototype.setInResult=function(r){this._isInResult=r},Xi.prototype.isCovered=function(){return this._isCovered},Xi.prototype.isCoveredSet=function(){return this._isCoveredSet},Xi.prototype.setLabel=function(r){this._label=r},Xi.prototype.getLabel=function(){return this._label},Xi.prototype.setCovered=function(r){this._isCovered=r,this._isCoveredSet=!0},Xi.prototype.updateIM=function(r){Wt.isTrue(this._label.getGeometryCount()>=2,"found partial label"),this.computeIM(r)},Xi.prototype.isInResult=function(){return this._isInResult},Xi.prototype.isVisited=function(){return this._isVisited},Xi.prototype.interfaces_=function(){return[]},Xi.prototype.getClass=function(){return Xi};var Kl=function(r){function i(){r.call(this),this._coord=null,this._edges=null;var a=arguments[0],c=arguments[1];this._coord=a,this._edges=c,this._label=new On(0,K.NONE)}return r&&(i.__proto__=r),i.prototype=Object.create(r&&r.prototype),i.prototype.constructor=i,i.prototype.isIncidentEdgeInResult=function(){for(var a=this.getEdges().getEdges().iterator();a.hasNext();)if(a.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(a){a.println("node "+this._coord+" lbl: "+this._label)},i.prototype.computeIM=function(a){},i.prototype.computeMergedLocation=function(a,c){var d=K.NONE;if(d=this._label.getLocation(c),!a.isNull(c)){var _=a.getLocation(c);d!==K.BOUNDARY&&(d=_)}return d},i.prototype.setLabel=function(){if(arguments.length!==2)return r.prototype.setLabel.apply(this,arguments);var a=arguments[0],c=arguments[1];this._label===null?this._label=new On(a,c):this._label.setLocation(a,c)},i.prototype.getEdges=function(){return this._edges},i.prototype.mergeLabel=function(){if(arguments[0]instanceof i){var a=arguments[0];this.mergeLabel(a._label)}else if(arguments[0]instanceof On)for(var c=arguments[0],d=0;d<2;d++){var _=this.computeMergedLocation(c,d);this._label.getLocation(d)===K.NONE&&this._label.setLocation(d,_)}},i.prototype.add=function(a){this._edges.insert(a),a.setNode(this)},i.prototype.setLabelBoundary=function(a){if(this._label===null)return null;var c=K.NONE;this._label!==null&&(c=this._label.getLocation(a));var d=null;switch(c){case K.BOUNDARY:d=K.INTERIOR;break;case K.INTERIOR:default:d=K.BOUNDARY}this._label.setLocation(a,d)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(Xi),Ro=function(){this.nodeMap=new w,this.nodeFact=null;var r=arguments[0];this.nodeFact=r};Ro.prototype.find=function(r){return this.nodeMap.get(r)},Ro.prototype.addNode=function(){if(arguments[0]instanceof D){var r=arguments[0],i=this.nodeMap.get(r);return i===null&&(i=this.nodeFact.createNode(r),this.nodeMap.put(r,i)),i}if(arguments[0]instanceof Kl){var a=arguments[0],c=this.nodeMap.get(a.getCoordinate());return c===null?(this.nodeMap.put(a.getCoordinate(),a),a):(c.mergeLabel(a),c)}},Ro.prototype.print=function(r){for(var i=this.iterator();i.hasNext();)i.next().print(r)},Ro.prototype.iterator=function(){return this.nodeMap.values().iterator()},Ro.prototype.values=function(){return this.nodeMap.values()},Ro.prototype.getBoundaryNodes=function(r){for(var i=new G,a=this.iterator();a.hasNext();){var c=a.next();c.getLabel().getLocation(r)===K.BOUNDARY&&i.add(c)}return i},Ro.prototype.add=function(r){var i=r.getCoordinate();this.addNode(i).add(r)},Ro.prototype.interfaces_=function(){return[]},Ro.prototype.getClass=function(){return Ro};var Yn=function(){},Ba={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}};Yn.prototype.interfaces_=function(){return[]},Yn.prototype.getClass=function(){return Yn},Yn.isNorthern=function(r){return r===Yn.NE||r===Yn.NW},Yn.isOpposite=function(r,i){return r===i?!1:(r-i+4)%4===2},Yn.commonHalfPlane=function(r,i){if(r===i)return r;if((r-i+4)%4===2)return-1;var a=r<i?r:i;return a===0&&(r>i?r:i)===3?3:a},Yn.isInHalfPlane=function(r,i){return i===Yn.SE?r===Yn.SE||r===Yn.SW:r===i||r===i+1},Yn.quadrant=function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var r=arguments[0],i=arguments[1];if(r===0&&i===0)throw new I("Cannot compute the quadrant for point ( "+r+", "+i+" )");return r>=0?i>=0?Yn.NE:Yn.SE:i>=0?Yn.NW:Yn.SW}if(arguments[0]instanceof D&&arguments[1]instanceof D){var a=arguments[0],c=arguments[1];if(c.x===a.x&&c.y===a.y)throw new I("Cannot compute the quadrant for two identical points "+a);return c.x>=a.x?c.y>=a.y?Yn.NE:Yn.SE:c.y>=a.y?Yn.NW:Yn.SW}},Ba.NE.get=function(){return 0},Ba.NW.get=function(){return 1},Ba.SW.get=function(){return 2},Ba.SE.get=function(){return 3},Object.defineProperties(Yn,Ba);var jr=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 r=arguments[0];this._edge=r}else if(arguments.length===3){var i=arguments[0],a=arguments[1],c=arguments[2];this._edge=i,this.init(a,c),this._label=null}else if(arguments.length===4){var d=arguments[0],_=arguments[1],M=arguments[2],L=arguments[3];this._edge=d,this.init(_,M),this._label=L}};jr.prototype.compareDirection=function(r){return this._dx===r._dx&&this._dy===r._dy?0:this._quadrant>r._quadrant?1:this._quadrant<r._quadrant?-1:dt.computeOrientation(r._p0,r._p1,this._p1)},jr.prototype.getDy=function(){return this._dy},jr.prototype.getCoordinate=function(){return this._p0},jr.prototype.setNode=function(r){this._node=r},jr.prototype.print=function(r){var i=Math.atan2(this._dy,this._dx),a=this.getClass().getName(),c=a.lastIndexOf("."),d=a.substring(c+1);r.print(" "+d+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+i+" "+this._label)},jr.prototype.compareTo=function(r){var i=r;return this.compareDirection(i)},jr.prototype.getDirectedCoordinate=function(){return this._p1},jr.prototype.getDx=function(){return this._dx},jr.prototype.getLabel=function(){return this._label},jr.prototype.getEdge=function(){return this._edge},jr.prototype.getQuadrant=function(){return this._quadrant},jr.prototype.getNode=function(){return this._node},jr.prototype.toString=function(){var r=Math.atan2(this._dy,this._dx),i=this.getClass().getName(),a=i.lastIndexOf(".");return" "+i.substring(a+1)+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+r+" "+this._label},jr.prototype.computeLabel=function(r){},jr.prototype.init=function(r,i){this._p0=r,this._p1=i,this._dx=i.x-r.x,this._dy=i.y-r.y,this._quadrant=Yn.quadrant(this._dx,this._dy),Wt.isTrue(!(this._dx===0&&this._dy===0),"EdgeEnd with identical endpoints found")},jr.prototype.interfaces_=function(){return[V]},jr.prototype.getClass=function(){return jr};var wf=function(r){function i(){var a=arguments[0],c=arguments[1];if(r.call(this,a),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=c,c)this.init(a.getCoordinate(0),a.getCoordinate(1));else{var d=a.getNumPoints()-1;this.init(a.getCoordinate(d),a.getCoordinate(d-1))}this.computeDirectedLabel()}return r&&(i.__proto__=r),i.prototype=Object.create(r&&r.prototype),i.prototype.constructor=i,i.prototype.getNextMin=function(){return this._nextMin},i.prototype.getDepth=function(a){return this._depth[a]},i.prototype.setVisited=function(a){this._isVisited=a},i.prototype.computeDirectedLabel=function(){this._label=new On(this._edge.getLabel()),this._isForward||this._label.flip()},i.prototype.getNext=function(){return this._next},i.prototype.setDepth=function(a,c){if(this._depth[a]!==-999&&this._depth[a]!==c)throw new Qo("assigned depths do not match",this.getCoordinate());this._depth[a]=c},i.prototype.isInteriorAreaEdge=function(){for(var a=!0,c=0;c<2;c++)this._label.isArea(c)&&this._label.getLocation(c,Xt.LEFT)===K.INTERIOR&&this._label.getLocation(c,Xt.RIGHT)===K.INTERIOR||(a=!1);return a},i.prototype.setNextMin=function(a){this._nextMin=a},i.prototype.print=function(a){r.prototype.print.call(this,a),a.print(" "+this._depth[Xt.LEFT]+"/"+this._depth[Xt.RIGHT]),a.print(" ("+this.getDepthDelta()+")"),this._isInResult&&a.print(" inResult")},i.prototype.setMinEdgeRing=function(a){this._minEdgeRing=a},i.prototype.isLineEdge=function(){var a=this._label.isLine(0)||this._label.isLine(1),c=!this._label.isArea(0)||this._label.allPositionsEqual(0,K.EXTERIOR),d=!this._label.isArea(1)||this._label.allPositionsEqual(1,K.EXTERIOR);return a&&c&&d},i.prototype.setEdgeRing=function(a){this._edgeRing=a},i.prototype.getMinEdgeRing=function(){return this._minEdgeRing},i.prototype.getDepthDelta=function(){var a=this._edge.getDepthDelta();return this._isForward||(a=-a),a},i.prototype.setInResult=function(a){this._isInResult=a},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(a){this.print(a),a.print(" "),this._isForward?this._edge.print(a):this._edge.printReverse(a)},i.prototype.setSym=function(a){this._sym=a},i.prototype.setVisitedEdge=function(a){this.setVisited(a),this._sym.setVisited(a)},i.prototype.setEdgeDepths=function(a,c){var d=this.getEdge().getDepthDelta();this._isForward||(d=-d);var _=1;a===Xt.LEFT&&(_=-1);var M=Xt.opposite(a),L=c+d*_;this.setDepth(a,c),this.setDepth(M,L)},i.prototype.getEdgeRing=function(){return this._edgeRing},i.prototype.isInResult=function(){return this._isInResult},i.prototype.setNext=function(a){this._next=a},i.prototype.isVisited=function(){return this._isVisited},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i.depthFactor=function(a,c){return a===K.EXTERIOR&&c===K.INTERIOR?1:a===K.INTERIOR&&c===K.EXTERIOR?-1:0},i}(jr),yu=function(){};yu.prototype.createNode=function(r){return new Kl(r,null)},yu.prototype.interfaces_=function(){return[]},yu.prototype.getClass=function(){return yu};var dr=function(){if(this._edges=new G,this._nodes=null,this._edgeEndList=new G,arguments.length===0)this._nodes=new Ro(new yu);else if(arguments.length===1){var r=arguments[0];this._nodes=new Ro(r)}};dr.prototype.printEdges=function(r){r.println("Edges:");for(var i=0;i<this._edges.size();i++){r.println("edge "+i+":");var a=this._edges.get(i);a.print(r),a.eiList.print(r)}},dr.prototype.find=function(r){return this._nodes.find(r)},dr.prototype.addNode=function(){if(arguments[0]instanceof Kl){var r=arguments[0];return this._nodes.addNode(r)}if(arguments[0]instanceof D){var i=arguments[0];return this._nodes.addNode(i)}},dr.prototype.getNodeIterator=function(){return this._nodes.iterator()},dr.prototype.linkResultDirectedEdges=function(){for(var r=this._nodes.iterator();r.hasNext();)r.next().getEdges().linkResultDirectedEdges()},dr.prototype.debugPrintln=function(r){te.out.println(r)},dr.prototype.isBoundaryNode=function(r,i){var a=this._nodes.find(i);if(a===null)return!1;var c=a.getLabel();return c!==null&&c.getLocation(r)===K.BOUNDARY},dr.prototype.linkAllDirectedEdges=function(){for(var r=this._nodes.iterator();r.hasNext();)r.next().getEdges().linkAllDirectedEdges()},dr.prototype.matchInSameDirection=function(r,i,a,c){return!!r.equals(a)&&dt.computeOrientation(r,i,c)===dt.COLLINEAR&&Yn.quadrant(r,i)===Yn.quadrant(a,c)},dr.prototype.getEdgeEnds=function(){return this._edgeEndList},dr.prototype.debugPrint=function(r){te.out.print(r)},dr.prototype.getEdgeIterator=function(){return this._edges.iterator()},dr.prototype.findEdgeInSameDirection=function(r,i){for(var a=0;a<this._edges.size();a++){var c=this._edges.get(a),d=c.getCoordinates();if(this.matchInSameDirection(r,i,d[0],d[1])||this.matchInSameDirection(r,i,d[d.length-1],d[d.length-2]))return c}return null},dr.prototype.insertEdge=function(r){this._edges.add(r)},dr.prototype.findEdgeEnd=function(r){for(var i=this.getEdgeEnds().iterator();i.hasNext();){var a=i.next();if(a.getEdge()===r)return a}return null},dr.prototype.addEdges=function(r){for(var i=r.iterator();i.hasNext();){var a=i.next();this._edges.add(a);var c=new wf(a,!0),d=new wf(a,!1);c.setSym(d),d.setSym(c),this.add(c),this.add(d)}},dr.prototype.add=function(r){this._nodes.add(r),this._edgeEndList.add(r)},dr.prototype.getNodes=function(){return this._nodes.values()},dr.prototype.findEdge=function(r,i){for(var a=0;a<this._edges.size();a++){var c=this._edges.get(a),d=c.getCoordinates();if(r.equals(d[0])&&i.equals(d[1]))return c}return null},dr.prototype.interfaces_=function(){return[]},dr.prototype.getClass=function(){return dr},dr.linkResultDirectedEdges=function(r){for(var i=r.iterator();i.hasNext();)i.next().getEdges().linkResultDirectedEdges()};var Ci=function(){this._geometryFactory=null,this._shellList=new G;var r=arguments[0];this._geometryFactory=r};Ci.prototype.sortShellsAndHoles=function(r,i,a){for(var c=r.iterator();c.hasNext();){var d=c.next();d.isHole()?a.add(d):i.add(d)}},Ci.prototype.computePolygons=function(r){for(var i=new G,a=r.iterator();a.hasNext();){var c=a.next().toPolygon(this._geometryFactory);i.add(c)}return i},Ci.prototype.placeFreeHoles=function(r,i){for(var a=i.iterator();a.hasNext();){var c=a.next();if(c.getShell()===null){var d=this.findEdgeRingContaining(c,r);if(d===null)throw new Qo("unable to assign hole to a shell",c.getCoordinate(0));c.setShell(d)}}},Ci.prototype.buildMinimalEdgeRings=function(r,i,a){for(var c=new G,d=r.iterator();d.hasNext();){var _=d.next();if(_.getMaxNodeDegree()>2){_.linkDirectedEdgesForMinimalEdgeRings();var M=_.buildMinimalRings(),L=this.findShell(M);L!==null?(this.placePolygonHoles(L,M),i.add(L)):a.addAll(M)}else c.add(_)}return c},Ci.prototype.containsPoint=function(r){for(var i=this._shellList.iterator();i.hasNext();)if(i.next().containsPoint(r))return!0;return!1},Ci.prototype.buildMaximalEdgeRings=function(r){for(var i=new G,a=r.iterator();a.hasNext();){var c=a.next();if(c.isInResult()&&c.getLabel().isArea()&&c.getEdgeRing()===null){var d=new zh(c,this._geometryFactory);i.add(d),d.setInResult()}}return i},Ci.prototype.placePolygonHoles=function(r,i){for(var a=i.iterator();a.hasNext();){var c=a.next();c.isHole()&&c.setShell(r)}},Ci.prototype.getPolygons=function(){return this.computePolygons(this._shellList)},Ci.prototype.findEdgeRingContaining=function(r,i){for(var a=r.getLinearRing(),c=a.getEnvelopeInternal(),d=a.getCoordinateN(0),_=null,M=null,L=i.iterator();L.hasNext();){var H=L.next(),it=H.getLinearRing(),bt=it.getEnvelopeInternal();_!==null&&(M=_.getLinearRing().getEnvelopeInternal());var Tt=!1;bt.contains(c)&&dt.isPointInRing(d,it.getCoordinates())&&(Tt=!0),Tt&&(_===null||M.contains(bt))&&(_=H)}return _},Ci.prototype.findShell=function(r){for(var i=0,a=null,c=r.iterator();c.hasNext();){var d=c.next();d.isHole()||(a=d,i++)}return Wt.isTrue(i<=1,"found two shells in MinimalEdgeRing list"),a},Ci.prototype.add=function(){if(arguments.length===1){var r=arguments[0];this.add(r.getEdgeEnds(),r.getNodes())}else if(arguments.length===2){var i=arguments[0],a=arguments[1];dr.linkResultDirectedEdges(a);var c=this.buildMaximalEdgeRings(i),d=new G,_=this.buildMinimalEdgeRings(c,this._shellList,d);this.sortShellsAndHoles(_,this._shellList,d),this.placeFreeHoles(this._shellList,d)}},Ci.prototype.interfaces_=function(){return[]},Ci.prototype.getClass=function(){return Ci};var or=function(){};or.prototype.getBounds=function(){},or.prototype.interfaces_=function(){return[]},or.prototype.getClass=function(){return or};var je=function(){this._bounds=null,this._item=null;var r=arguments[0],i=arguments[1];this._bounds=r,this._item=i};je.prototype.getItem=function(){return this._item},je.prototype.getBounds=function(){return this._bounds},je.prototype.interfaces_=function(){return[or,t]},je.prototype.getClass=function(){return je};var vs=function(){this._size=null,this._items=null,this._size=0,this._items=new G,this._items.add(null)};vs.prototype.poll=function(){if(this.isEmpty())return null;var r=this._items.get(1);return this._items.set(1,this._items.get(this._size)),this._size-=1,this.reorder(1),r},vs.prototype.size=function(){return this._size},vs.prototype.reorder=function(r){for(var i=null,a=this._items.get(r);2*r<=this._size&&((i=2*r)!==this._size&&this._items.get(i+1).compareTo(this._items.get(i))<0&&i++,this._items.get(i).compareTo(a)<0);r=i)this._items.set(r,this._items.get(i));this._items.set(r,a)},vs.prototype.clear=function(){this._size=0,this._items.clear()},vs.prototype.isEmpty=function(){return this._size===0},vs.prototype.add=function(r){this._items.add(null),this._size+=1;var i=this._size;for(this._items.set(0,r);r.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,r)},vs.prototype.interfaces_=function(){return[]},vs.prototype.getClass=function(){return vs};var Us=function(){};Us.prototype.visitItem=function(r){},Us.prototype.interfaces_=function(){return[]},Us.prototype.getClass=function(){return Us};var za=function(){};za.prototype.insert=function(r,i){},za.prototype.remove=function(r,i){},za.prototype.query=function(){},za.prototype.interfaces_=function(){return[]},za.prototype.getClass=function(){return za};var Ir=function(){if(this._childBoundables=new G,this._bounds=null,this._level=null,arguments.length!==0){if(arguments.length===1){var r=arguments[0];this._level=r}}},Gh={serialVersionUID:{configurable:!0}};Ir.prototype.getLevel=function(){return this._level},Ir.prototype.size=function(){return this._childBoundables.size()},Ir.prototype.getChildBoundables=function(){return this._childBoundables},Ir.prototype.addChildBoundable=function(r){Wt.isTrue(this._bounds===null),this._childBoundables.add(r)},Ir.prototype.isEmpty=function(){return this._childBoundables.isEmpty()},Ir.prototype.getBounds=function(){return this._bounds===null&&(this._bounds=this.computeBounds()),this._bounds},Ir.prototype.interfaces_=function(){return[or,t]},Ir.prototype.getClass=function(){return Ir},Gh.serialVersionUID.get=function(){return 6493722185909574e3},Object.defineProperties(Ir,Gh);var ho=function(){};ho.reverseOrder=function(){return{compare:function(r,i){return i.compareTo(r)}}},ho.min=function(r){return ho.sort(r),r.get(0)},ho.sort=function(r,i){var a=r.toArray();i?nr.sort(a,i):nr.sort(a);for(var c=r.iterator(),d=0,_=a.length;d<_;d++)c.next(),c.set(a[d])},ho.singletonList=function(r){var i=new G;return i.add(r),i};var Sr=function(){this._boundable1=null,this._boundable2=null,this._distance=null,this._itemDistance=null;var r=arguments[0],i=arguments[1],a=arguments[2];this._boundable1=r,this._boundable2=i,this._itemDistance=a,this._distance=this.distance()};Sr.prototype.expandToQueue=function(r,i){var a=Sr.isComposite(this._boundable1),c=Sr.isComposite(this._boundable2);if(a&&c)return Sr.area(this._boundable1)>Sr.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,r,i),null):(this.expand(this._boundable2,this._boundable1,r,i),null);if(a)return this.expand(this._boundable1,this._boundable2,r,i),null;if(c)return this.expand(this._boundable2,this._boundable1,r,i),null;throw new I("neither boundable is composite")},Sr.prototype.isLeaves=function(){return!(Sr.isComposite(this._boundable1)||Sr.isComposite(this._boundable2))},Sr.prototype.compareTo=function(r){var i=r;return this._distance<i._distance?-1:this._distance>i._distance?1:0},Sr.prototype.expand=function(r,i,a,c){for(var d=r.getChildBoundables().iterator();d.hasNext();){var _=d.next(),M=new Sr(_,i,this._itemDistance);M.getDistance()<c&&a.add(M)}},Sr.prototype.getBoundable=function(r){return r===0?this._boundable1:this._boundable2},Sr.prototype.getDistance=function(){return this._distance},Sr.prototype.distance=function(){return this.isLeaves()?this._itemDistance.distance(this._boundable1,this._boundable2):this._boundable1.getBounds().distance(this._boundable2.getBounds())},Sr.prototype.interfaces_=function(){return[V]},Sr.prototype.getClass=function(){return Sr},Sr.area=function(r){return r.getBounds().getArea()},Sr.isComposite=function(r){return r instanceof Ir};var Fr=function r(){if(this._root=null,this._built=!1,this._itemBoundables=new G,this._nodeCapacity=null,arguments.length===0){var i=r.DEFAULT_NODE_CAPACITY;this._nodeCapacity=i}else if(arguments.length===1){var a=arguments[0];Wt.isTrue(a>1,"Node capacity must be greater than 1"),this._nodeCapacity=a}},Ur={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};Fr.prototype.getNodeCapacity=function(){return this._nodeCapacity},Fr.prototype.lastNode=function(r){return r.get(r.size()-1)},Fr.prototype.size=function(){if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.size(this._root));if(arguments.length===1){for(var r=0,i=arguments[0].getChildBoundables().iterator();i.hasNext();){var a=i.next();a instanceof Ir?r+=this.size(a):a instanceof je&&(r+=1)}return r}},Fr.prototype.removeItem=function(r,i){for(var a=null,c=r.getChildBoundables().iterator();c.hasNext();){var d=c.next();d instanceof je&&d.getItem()===i&&(a=d)}return a!==null&&(r.getChildBoundables().remove(a),!0)},Fr.prototype.itemsTree=function(){if(arguments.length===0){this.build();var r=this.itemsTree(this._root);return r===null?new G:r}if(arguments.length===1){for(var i=arguments[0],a=new G,c=i.getChildBoundables().iterator();c.hasNext();){var d=c.next();if(d instanceof Ir){var _=this.itemsTree(d);_!==null&&a.add(_)}else d instanceof je?a.add(d.getItem()):Wt.shouldNeverReachHere()}return a.size()<=0?null:a}},Fr.prototype.insert=function(r,i){Wt.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new je(r,i))},Fr.prototype.boundablesAtLevel=function(){if(arguments.length===1){var r=arguments[0],i=new G;return this.boundablesAtLevel(r,this._root,i),i}if(arguments.length===3){var a=arguments[0],c=arguments[1],d=arguments[2];if(Wt.isTrue(a>-2),c.getLevel()===a)return d.add(c),null;for(var _=c.getChildBoundables().iterator();_.hasNext();){var M=_.next();M instanceof Ir?this.boundablesAtLevel(a,M,d):(Wt.isTrue(M instanceof je),a===-1&&d.add(M))}return null}},Fr.prototype.query=function(){if(arguments.length===1){var r=arguments[0];this.build();var i=new G;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),r)&&this.query(r,this._root,i),i}if(arguments.length===2){var a=arguments[0],c=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),a)&&this.query(a,this._root,c)}else if(arguments.length===3){if(Q(arguments[2],Us)&&arguments[0]instanceof Object&&arguments[1]instanceof Ir)for(var d=arguments[0],_=arguments[1],M=arguments[2],L=_.getChildBoundables(),H=0;H<L.size();H++){var it=L.get(H);this.getIntersectsOp().intersects(it.getBounds(),d)&&(it instanceof Ir?this.query(d,it,M):it instanceof je?M.visitItem(it.getItem()):Wt.shouldNeverReachHere())}else if(Q(arguments[2],Et)&&arguments[0]instanceof Object&&arguments[1]instanceof Ir)for(var bt=arguments[0],Tt=arguments[1],Kt=arguments[2],Qt=Tt.getChildBoundables(),le=0;le<Qt.size();le++){var Ee=Qt.get(le);this.getIntersectsOp().intersects(Ee.getBounds(),bt)&&(Ee instanceof Ir?this.query(bt,Ee,Kt):Ee instanceof je?Kt.add(Ee.getItem()):Wt.shouldNeverReachHere())}}},Fr.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},Fr.prototype.getRoot=function(){return this.build(),this._root},Fr.prototype.remove=function(){if(arguments.length===2){var r=arguments[0],i=arguments[1];return this.build(),!!this.getIntersectsOp().intersects(this._root.getBounds(),r)&&this.remove(r,this._root,i)}if(arguments.length===3){var a=arguments[0],c=arguments[1],d=arguments[2],_=this.removeItem(c,d);if(_)return!0;for(var M=null,L=c.getChildBoundables().iterator();L.hasNext();){var H=L.next();if(this.getIntersectsOp().intersects(H.getBounds(),a)&&H instanceof Ir&&(_=this.remove(a,H,d))){M=H;break}}return M!==null&&M.getChildBoundables().isEmpty()&&c.getChildBoundables().remove(M),_}},Fr.prototype.createHigherLevels=function(r,i){Wt.isTrue(!r.isEmpty());var a=this.createParentBoundables(r,i+1);return a.size()===1?a.get(0):this.createHigherLevels(a,i+1)},Fr.prototype.depth=function(){if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.depth(this._root));if(arguments.length===1){for(var r=0,i=arguments[0].getChildBoundables().iterator();i.hasNext();){var a=i.next();if(a instanceof Ir){var c=this.depth(a);c>r&&(r=c)}}return r+1}},Fr.prototype.createParentBoundables=function(r,i){Wt.isTrue(!r.isEmpty());var a=new G;a.add(this.createNode(i));var c=new G(r);ho.sort(c,this.getComparator());for(var d=c.iterator();d.hasNext();){var _=d.next();this.lastNode(a).getChildBoundables().size()===this.getNodeCapacity()&&a.add(this.createNode(i)),this.lastNode(a).addChildBoundable(_)}return a},Fr.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()},Fr.prototype.interfaces_=function(){return[t]},Fr.prototype.getClass=function(){return Fr},Fr.compareDoubles=function(r,i){return r>i?1:r<i?-1:0},Ur.IntersectsOp.get=function(){return Sf},Ur.serialVersionUID.get=function(){return-3886435814360241e3},Ur.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(Fr,Ur);var Sf=function(){},Lo=function(){};Lo.prototype.distance=function(r,i){},Lo.prototype.interfaces_=function(){return[]},Lo.prototype.getClass=function(){return Lo};var Mf=function(r){function i(c){c=c||i.DEFAULT_NODE_CAPACITY,r.call(this,c)}r&&(i.__proto__=r),(i.prototype=Object.create(r&&r.prototype)).constructor=i;var a={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(c,d){Wt.isTrue(c.length>0);for(var _=new G,M=0;M<c.length;M++)_.addAll(this.createParentBoundablesFromVerticalSlice(c[M],d));return _},i.prototype.createNode=function(c){return new Jl(c)},i.prototype.size=function(){return arguments.length===0?r.prototype.size.call(this):r.prototype.size.apply(this,arguments)},i.prototype.insert=function(){if(arguments.length!==2)return r.prototype.insert.apply(this,arguments);var c=arguments[0],d=arguments[1];if(c.isNull())return null;r.prototype.insert.call(this,c,d)},i.prototype.getIntersectsOp=function(){return i.intersectsOp},i.prototype.verticalSlices=function(c,d){for(var _=Math.trunc(Math.ceil(c.size()/d)),M=new Array(d).fill(null),L=c.iterator(),H=0;H<d;H++){M[H]=new G;for(var it=0;L.hasNext()&&it<_;){var bt=L.next();M[H].add(bt),it++}}return M},i.prototype.query=function(){if(arguments.length===1){var c=arguments[0];return r.prototype.query.call(this,c)}if(arguments.length===2){var d=arguments[0],_=arguments[1];r.prototype.query.call(this,d,_)}else if(arguments.length===3){if(Q(arguments[2],Us)&&arguments[0]instanceof Object&&arguments[1]instanceof Ir){var M=arguments[0],L=arguments[1],H=arguments[2];r.prototype.query.call(this,M,L,H)}else if(Q(arguments[2],Et)&&arguments[0]instanceof Object&&arguments[1]instanceof Ir){var it=arguments[0],bt=arguments[1],Tt=arguments[2];r.prototype.query.call(this,it,bt,Tt)}}},i.prototype.getComparator=function(){return i.yComparator},i.prototype.createParentBoundablesFromVerticalSlice=function(c,d){return r.prototype.createParentBoundables.call(this,c,d)},i.prototype.remove=function(){if(arguments.length===2){var c=arguments[0],d=arguments[1];return r.prototype.remove.call(this,c,d)}return r.prototype.remove.apply(this,arguments)},i.prototype.depth=function(){return arguments.length===0?r.prototype.depth.call(this):r.prototype.depth.apply(this,arguments)},i.prototype.createParentBoundables=function(c,d){Wt.isTrue(!c.isEmpty());var _=Math.trunc(Math.ceil(c.size()/this.getNodeCapacity())),M=new G(c);ho.sort(M,i.xComparator);var L=this.verticalSlices(M,Math.trunc(Math.ceil(Math.sqrt(_))));return this.createParentBoundablesFromVerticalSlices(L,d)},i.prototype.nearestNeighbour=function(){if(arguments.length===1){if(Q(arguments[0],Lo)){var c=arguments[0],d=new Sr(this.getRoot(),this.getRoot(),c);return this.nearestNeighbour(d)}if(arguments[0]instanceof Sr){var _=arguments[0];return this.nearestNeighbour(_,A.POSITIVE_INFINITY)}}else if(arguments.length===2){if(arguments[0]instanceof i&&Q(arguments[1],Lo)){var M=arguments[0],L=arguments[1],H=new Sr(this.getRoot(),M.getRoot(),L);return this.nearestNeighbour(H)}if(arguments[0]instanceof Sr&&typeof arguments[1]=="number"){var it=arguments[0],bt=arguments[1],Tt=null,Kt=new vs;for(Kt.add(it);!Kt.isEmpty()&&bt>0;){var Qt=Kt.poll(),le=Qt.getDistance();if(le>=bt)break;Qt.isLeaves()?(bt=le,Tt=Qt):Qt.expandToQueue(Kt,bt)}return[Tt.getBoundable(0).getItem(),Tt.getBoundable(1).getItem()]}}else if(arguments.length===3){var Ee=arguments[0],Dn=arguments[1],Jn=arguments[2],fi=new je(Ee,Dn),as=new Sr(this.getRoot(),fi,Jn);return this.nearestNeighbour(as)[0]}},i.prototype.interfaces_=function(){return[za,t]},i.prototype.getClass=function(){return i},i.centreX=function(c){return i.avg(c.getMinX(),c.getMaxX())},i.avg=function(c,d){return(c+d)/2},i.centreY=function(c){return i.avg(c.getMinY(),c.getMaxY())},a.STRtreeNode.get=function(){return Jl},a.serialVersionUID.get=function(){return 0x39920f7d5f261e0},a.xComparator.get=function(){return{interfaces_:function(){return[q]},compare:function(c,d){return r.compareDoubles(i.centreX(c.getBounds()),i.centreX(d.getBounds()))}}},a.yComparator.get=function(){return{interfaces_:function(){return[q]},compare:function(c,d){return r.compareDoubles(i.centreY(c.getBounds()),i.centreY(d.getBounds()))}}},a.intersectsOp.get=function(){return{interfaces_:function(){return[r.IntersectsOp]},intersects:function(c,d){return c.intersects(d)}}},a.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(i,a),i}(Fr),Jl=function(r){function i(){var a=arguments[0];r.call(this,a)}return r&&(i.__proto__=r),i.prototype=Object.create(r&&r.prototype),i.prototype.constructor=i,i.prototype.computeBounds=function(){for(var a=null,c=this.getChildBoundables().iterator();c.hasNext();){var d=c.next();a===null?a=new qt(d.getBounds()):a.expandToInclude(d.getBounds())}return a},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(Ir),lr=function(){};lr.prototype.interfaces_=function(){return[]},lr.prototype.getClass=function(){return lr},lr.relativeSign=function(r,i){return r<i?-1:r>i?1:0},lr.compare=function(r,i,a){if(i.equals2D(a))return 0;var c=lr.relativeSign(i.x,a.x),d=lr.relativeSign(i.y,a.y);switch(r){case 0:return lr.compareValue(c,d);case 1:return lr.compareValue(d,c);case 2:return lr.compareValue(d,-c);case 3:return lr.compareValue(-c,d);case 4:return lr.compareValue(-c,-d);case 5:return lr.compareValue(-d,-c);case 6:return lr.compareValue(-d,c);case 7:return lr.compareValue(c,-d)}return Wt.shouldNeverReachHere("invalid octant value"),0},lr.compareValue=function(r,i){return r<0?-1:r>0?1:i<0?-1:i>0?1:0};var _s=function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var r=arguments[0],i=arguments[1],a=arguments[2],c=arguments[3];this._segString=r,this.coord=new D(i),this.segmentIndex=a,this._segmentOctant=c,this._isInterior=!i.equals2D(r.getCoordinate(a))};_s.prototype.getCoordinate=function(){return this.coord},_s.prototype.print=function(r){r.print(this.coord),r.print(" seg # = "+this.segmentIndex)},_s.prototype.compareTo=function(r){var i=r;return this.segmentIndex<i.segmentIndex?-1:this.segmentIndex>i.segmentIndex?1:this.coord.equals2D(i.coord)?0:lr.compare(this._segmentOctant,this.coord,i.coord)},_s.prototype.isEndPoint=function(r){return this.segmentIndex===0&&!this._isInterior||this.segmentIndex===r},_s.prototype.isInterior=function(){return this._isInterior},_s.prototype.interfaces_=function(){return[V]},_s.prototype.getClass=function(){return _s};var Qr=function(){this._nodeMap=new w,this._edge=null;var r=arguments[0];this._edge=r};Qr.prototype.getSplitCoordinates=function(){var r=new et;this.addEndpoints();for(var i=this.iterator(),a=i.next();i.hasNext();){var c=i.next();this.addEdgeCoordinates(a,c,r),a=c}return r.toCoordinateArray()},Qr.prototype.addCollapsedNodes=function(){var r=new G;this.findCollapsesFromInsertedNodes(r),this.findCollapsesFromExistingVertices(r);for(var i=r.iterator();i.hasNext();){var a=i.next().intValue();this.add(this._edge.getCoordinate(a),a)}},Qr.prototype.print=function(r){r.println("Intersections:");for(var i=this.iterator();i.hasNext();)i.next().print(r)},Qr.prototype.findCollapsesFromExistingVertices=function(r){for(var i=0;i<this._edge.size()-2;i++){var a=this._edge.getCoordinate(i),c=this._edge.getCoordinate(i+2);a.equals2D(c)&&r.add(new pt(i+1))}},Qr.prototype.addEdgeCoordinates=function(r,i,a){var c=this._edge.getCoordinate(i.segmentIndex),d=i.isInterior()||!i.coord.equals2D(c);a.add(new D(r.coord),!1);for(var _=r.segmentIndex+1;_<=i.segmentIndex;_++)a.add(this._edge.getCoordinate(_));d&&a.add(new D(i.coord))},Qr.prototype.iterator=function(){return this._nodeMap.values().iterator()},Qr.prototype.addSplitEdges=function(r){this.addEndpoints(),this.addCollapsedNodes();for(var i=this.iterator(),a=i.next();i.hasNext();){var c=i.next(),d=this.createSplitEdge(a,c);r.add(d),a=c}},Qr.prototype.findCollapseIndex=function(r,i,a){if(!r.coord.equals2D(i.coord))return!1;var c=i.segmentIndex-r.segmentIndex;return i.isInterior()||c--,c===1&&(a[0]=r.segmentIndex+1,!0)},Qr.prototype.findCollapsesFromInsertedNodes=function(r){for(var i=new Array(1).fill(null),a=this.iterator(),c=a.next();a.hasNext();){var d=a.next();this.findCollapseIndex(c,d,i)&&r.add(new pt(i[0])),c=d}},Qr.prototype.getEdge=function(){return this._edge},Qr.prototype.addEndpoints=function(){var r=this._edge.size()-1;this.add(this._edge.getCoordinate(0),0),this.add(this._edge.getCoordinate(r),r)},Qr.prototype.createSplitEdge=function(r,i){var a=i.segmentIndex-r.segmentIndex+2,c=this._edge.getCoordinate(i.segmentIndex),d=i.isInterior()||!i.coord.equals2D(c);d||a--;var _=new Array(a).fill(null),M=0;_[M++]=new D(r.coord);for(var L=r.segmentIndex+1;L<=i.segmentIndex;L++)_[M++]=this._edge.getCoordinate(L);return d&&(_[M]=new D(i.coord)),new mr(_,this._edge.getData())},Qr.prototype.add=function(r,i){var a=new _s(this._edge,r,i,this._edge.getSegmentOctant(i)),c=this._nodeMap.get(a);return c!==null?(Wt.isTrue(c.coord.equals2D(r),"Found equal nodes with different coordinates"),c):(this._nodeMap.put(a,a),a)},Qr.prototype.checkSplitEdgesCorrectness=function(r){var i=this._edge.getCoordinates(),a=r.get(0).getCoordinate(0);if(!a.equals2D(i[0]))throw new Te("bad split edge start point at "+a);var c=r.get(r.size()-1).getCoordinates(),d=c[c.length-1];if(!d.equals2D(i[i.length-1]))throw new Te("bad split edge end point at "+d)},Qr.prototype.interfaces_=function(){return[]},Qr.prototype.getClass=function(){return Qr};var ua=function(){};ua.prototype.interfaces_=function(){return[]},ua.prototype.getClass=function(){return ua},ua.octant=function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var r=arguments[0],i=arguments[1];if(r===0&&i===0)throw new I("Cannot compute the octant for point ( "+r+", "+i+" )");var a=Math.abs(r),c=Math.abs(i);return r>=0?i>=0?a>=c?0:1:a>=c?7:6:i>=0?a>=c?3:2:a>=c?4:5}if(arguments[0]instanceof D&&arguments[1]instanceof D){var d=arguments[0],_=arguments[1],M=_.x-d.x,L=_.y-d.y;if(M===0&&L===0)throw new I("Cannot compute the octant for two identical points "+d);return ua.octant(M,L)}};var No=function(){};No.prototype.getCoordinates=function(){},No.prototype.size=function(){},No.prototype.getCoordinate=function(r){},No.prototype.isClosed=function(){},No.prototype.setData=function(r){},No.prototype.getData=function(){},No.prototype.interfaces_=function(){return[]},No.prototype.getClass=function(){return No};var vu=function(){};vu.prototype.addIntersection=function(r,i){},vu.prototype.interfaces_=function(){return[No]},vu.prototype.getClass=function(){return vu};var mr=function(){this._nodeList=new Qr(this),this._pts=null,this._data=null;var r=arguments[0],i=arguments[1];this._pts=r,this._data=i};mr.prototype.getCoordinates=function(){return this._pts},mr.prototype.size=function(){return this._pts.length},mr.prototype.getCoordinate=function(r){return this._pts[r]},mr.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},mr.prototype.getSegmentOctant=function(r){return r===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(r),this.getCoordinate(r+1))},mr.prototype.setData=function(r){this._data=r},mr.prototype.safeOctant=function(r,i){return r.equals2D(i)?0:ua.octant(r,i)},mr.prototype.getData=function(){return this._data},mr.prototype.addIntersection=function(){if(arguments.length===2){var r=arguments[0],i=arguments[1];this.addIntersectionNode(r,i)}else if(arguments.length===4){var a=arguments[0],c=arguments[1],d=arguments[3],_=new D(a.getIntersection(d));this.addIntersection(_,c)}},mr.prototype.toString=function(){return fe.toLineString(new ye(this._pts))},mr.prototype.getNodeList=function(){return this._nodeList},mr.prototype.addIntersectionNode=function(r,i){var a=i,c=a+1;if(c<this._pts.length){var d=this._pts[c];r.equals2D(d)&&(a=c)}return this._nodeList.add(r,a)},mr.prototype.addIntersections=function(r,i,a){for(var c=0;c<r.getIntersectionNum();c++)this.addIntersection(r,i,a,c)},mr.prototype.interfaces_=function(){return[vu]},mr.prototype.getClass=function(){return mr},mr.getNodedSubstrings=function(){if(arguments.length===1){var r=arguments[0],i=new G;return mr.getNodedSubstrings(r,i),i}if(arguments.length===2)for(var a=arguments[0],c=arguments[1],d=a.iterator();d.hasNext();)d.next().getNodeList().addSplitEdges(c)};var ie=function(){if(this.p0=null,this.p1=null,arguments.length===0)this.p0=new D,this.p1=new D;else if(arguments.length===1){var r=arguments[0];this.p0=new D(r.p0),this.p1=new D(r.p1)}else if(arguments.length===2)this.p0=arguments[0],this.p1=arguments[1];else if(arguments.length===4){var i=arguments[0],a=arguments[1],c=arguments[2],d=arguments[3];this.p0=new D(i,a),this.p1=new D(c,d)}},kh={serialVersionUID:{configurable:!0}};ie.prototype.minX=function(){return Math.min(this.p0.x,this.p1.x)},ie.prototype.orientationIndex=function(){if(arguments[0]instanceof ie){var r=arguments[0],i=dt.orientationIndex(this.p0,this.p1,r.p0),a=dt.orientationIndex(this.p0,this.p1,r.p1);return i>=0&&a>=0||i<=0&&a<=0?Math.max(i,a):0}if(arguments[0]instanceof D){var c=arguments[0];return dt.orientationIndex(this.p0,this.p1,c)}},ie.prototype.toGeometry=function(r){return r.createLineString([this.p0,this.p1])},ie.prototype.isVertical=function(){return this.p0.x===this.p1.x},ie.prototype.equals=function(r){if(!(r instanceof ie))return!1;var i=r;return this.p0.equals(i.p0)&&this.p1.equals(i.p1)},ie.prototype.intersection=function(r){var i=new z;return i.computeIntersection(this.p0,this.p1,r.p0,r.p1),i.hasIntersection()?i.getIntersection(0):null},ie.prototype.project=function(){if(arguments[0]instanceof D){var r=arguments[0];if(r.equals(this.p0)||r.equals(this.p1))return new D(r);var i=this.projectionFactor(r),a=new D;return a.x=this.p0.x+i*(this.p1.x-this.p0.x),a.y=this.p0.y+i*(this.p1.y-this.p0.y),a}if(arguments[0]instanceof ie){var c=arguments[0],d=this.projectionFactor(c.p0),_=this.projectionFactor(c.p1);if(d>=1&&_>=1||d<=0&&_<=0)return null;var M=this.project(c.p0);d<0&&(M=this.p0),d>1&&(M=this.p1);var L=this.project(c.p1);return _<0&&(L=this.p0),_>1&&(L=this.p1),new ie(M,L)}},ie.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()},ie.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)},ie.prototype.getCoordinate=function(r){return r===0?this.p0:this.p1},ie.prototype.distancePerpendicular=function(r){return dt.distancePointLinePerpendicular(r,this.p0,this.p1)},ie.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)},ie.prototype.midPoint=function(){return ie.midPoint(this.p0,this.p1)},ie.prototype.projectionFactor=function(r){if(r.equals(this.p0))return 0;if(r.equals(this.p1))return 1;var i=this.p1.x-this.p0.x,a=this.p1.y-this.p0.y,c=i*i+a*a;return c<=0?A.NaN:((r.x-this.p0.x)*i+(r.y-this.p0.y)*a)/c},ie.prototype.closestPoints=function(r){var i=this.intersection(r);if(i!==null)return[i,i];var a=new Array(2).fill(null),c=A.MAX_VALUE,d=null,_=this.closestPoint(r.p0);c=_.distance(r.p0),a[0]=_,a[1]=r.p0;var M=this.closestPoint(r.p1);(d=M.distance(r.p1))<c&&(c=d,a[0]=M,a[1]=r.p1);var L=r.closestPoint(this.p0);(d=L.distance(this.p0))<c&&(c=d,a[0]=this.p0,a[1]=L);var H=r.closestPoint(this.p1);return(d=H.distance(this.p1))<c&&(c=d,a[0]=this.p1,a[1]=H),a},ie.prototype.closestPoint=function(r){var i=this.projectionFactor(r);return i>0&&i<1?this.project(r):this.p0.distance(r)<this.p1.distance(r)?this.p0:this.p1},ie.prototype.maxX=function(){return Math.max(this.p0.x,this.p1.x)},ie.prototype.getLength=function(){return this.p0.distance(this.p1)},ie.prototype.compareTo=function(r){var i=r,a=this.p0.compareTo(i.p0);return a!==0?a:this.p1.compareTo(i.p1)},ie.prototype.reverse=function(){var r=this.p0;this.p0=this.p1,this.p1=r},ie.prototype.equalsTopo=function(r){return this.p0.equals(r.p0)&&(this.p1.equals(r.p1)||this.p0.equals(r.p1))&&this.p1.equals(r.p0)},ie.prototype.lineIntersection=function(r){try{return $t.intersection(this.p0,this.p1,r.p0,r.p1)}catch(i){if(!(i instanceof ce))throw i}return null},ie.prototype.maxY=function(){return Math.max(this.p0.y,this.p1.y)},ie.prototype.pointAlongOffset=function(r,i){var a=this.p0.x+r*(this.p1.x-this.p0.x),c=this.p0.y+r*(this.p1.y-this.p0.y),d=this.p1.x-this.p0.x,_=this.p1.y-this.p0.y,M=Math.sqrt(d*d+_*_),L=0,H=0;if(i!==0){if(M<=0)throw new Error("Cannot compute offset from zero-length line segment");L=i*d/M,H=i*_/M}return new D(a-H,c+L)},ie.prototype.setCoordinates=function(){if(arguments.length===1){var r=arguments[0];this.setCoordinates(r.p0,r.p1)}else if(arguments.length===2){var i=arguments[0],a=arguments[1];this.p0.x=i.x,this.p0.y=i.y,this.p1.x=a.x,this.p1.y=a.y}},ie.prototype.segmentFraction=function(r){var i=this.projectionFactor(r);return i<0?i=0:(i>1||A.isNaN(i))&&(i=1),i},ie.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"},ie.prototype.isHorizontal=function(){return this.p0.y===this.p1.y},ie.prototype.distance=function(){if(arguments[0]instanceof ie){var r=arguments[0];return dt.distanceLineLine(this.p0,this.p1,r.p0,r.p1)}if(arguments[0]instanceof D){var i=arguments[0];return dt.distancePointLine(i,this.p0,this.p1)}},ie.prototype.pointAlong=function(r){var i=new D;return i.x=this.p0.x+r*(this.p1.x-this.p0.x),i.y=this.p0.y+r*(this.p1.y-this.p0.y),i},ie.prototype.hashCode=function(){var r=A.doubleToLongBits(this.p0.x);r^=31*A.doubleToLongBits(this.p0.y);var i=Math.trunc(r)^Math.trunc(r>>32),a=A.doubleToLongBits(this.p1.x);return a^=31*A.doubleToLongBits(this.p1.y),i^(Math.trunc(a)^Math.trunc(a>>32))},ie.prototype.interfaces_=function(){return[V,t]},ie.prototype.getClass=function(){return ie},ie.midPoint=function(r,i){return new D((r.x+i.x)/2,(r.y+i.y)/2)},kh.serialVersionUID.get=function(){return 0x2d2172135f411c00},Object.defineProperties(ie,kh);var Pi=function(){this.tempEnv1=new qt,this.tempEnv2=new qt,this._overlapSeg1=new ie,this._overlapSeg2=new ie};Pi.prototype.overlap=function(){if(arguments.length!==2){if(arguments.length===4){var r=arguments[0],i=arguments[1],a=arguments[2],c=arguments[3];r.getLineSegment(i,this._overlapSeg1),a.getLineSegment(c,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}}},Pi.prototype.interfaces_=function(){return[]},Pi.prototype.getClass=function(){return Pi};var Ii=function(){this._pts=null,this._start=null,this._end=null,this._env=null,this._context=null,this._id=null;var r=arguments[0],i=arguments[1],a=arguments[2],c=arguments[3];this._pts=r,this._start=i,this._end=a,this._context=c};Ii.prototype.getLineSegment=function(r,i){i.p0=this._pts[r],i.p1=this._pts[r+1]},Ii.prototype.computeSelect=function(r,i,a,c){var d=this._pts[i],_=this._pts[a];if(c.tempEnv1.init(d,_),a-i==1)return c.select(this,i),null;if(!r.intersects(c.tempEnv1))return null;var M=Math.trunc((i+a)/2);i<M&&this.computeSelect(r,i,M,c),M<a&&this.computeSelect(r,M,a,c)},Ii.prototype.getCoordinates=function(){for(var r=new Array(this._end-this._start+1).fill(null),i=0,a=this._start;a<=this._end;a++)r[i++]=this._pts[a];return r},Ii.prototype.computeOverlaps=function(r,i){this.computeOverlapsInternal(this._start,this._end,r,r._start,r._end,i)},Ii.prototype.setId=function(r){this._id=r},Ii.prototype.select=function(r,i){this.computeSelect(r,this._start,this._end,i)},Ii.prototype.getEnvelope=function(){if(this._env===null){var r=this._pts[this._start],i=this._pts[this._end];this._env=new qt(r,i)}return this._env},Ii.prototype.getEndIndex=function(){return this._end},Ii.prototype.getStartIndex=function(){return this._start},Ii.prototype.getContext=function(){return this._context},Ii.prototype.getId=function(){return this._id},Ii.prototype.computeOverlapsInternal=function(r,i,a,c,d,_){var M=this._pts[r],L=this._pts[i],H=a._pts[c],it=a._pts[d];if(i-r==1&&d-c==1)return _.overlap(this,r,a,c),null;if(_.tempEnv1.init(M,L),_.tempEnv2.init(H,it),!_.tempEnv1.intersects(_.tempEnv2))return null;var bt=Math.trunc((r+i)/2),Tt=Math.trunc((c+d)/2);r<bt&&(c<Tt&&this.computeOverlapsInternal(r,bt,a,c,Tt,_),Tt<d&&this.computeOverlapsInternal(r,bt,a,Tt,d,_)),bt<i&&(c<Tt&&this.computeOverlapsInternal(bt,i,a,c,Tt,_),Tt<d&&this.computeOverlapsInternal(bt,i,a,Tt,d,_))},Ii.prototype.interfaces_=function(){return[]},Ii.prototype.getClass=function(){return Ii};var po=function(){};po.prototype.interfaces_=function(){return[]},po.prototype.getClass=function(){return po},po.getChainStartIndices=function(r){var i=0,a=new G;a.add(new pt(i));do{var c=po.findChainEnd(r,i);a.add(new pt(c)),i=c}while(i<r.length-1);return po.toIntArray(a)},po.findChainEnd=function(r,i){for(var a=i;a<r.length-1&&r[a].equals2D(r[a+1]);)a++;if(a>=r.length-1)return r.length-1;for(var c=Yn.quadrant(r[a],r[a+1]),d=i+1;d<r.length&&!(!r[d-1].equals2D(r[d])&&Yn.quadrant(r[d-1],r[d])!==c);)d++;return d-1},po.getChains=function(){if(arguments.length===1){var r=arguments[0];return po.getChains(r,null)}if(arguments.length===2){for(var i=arguments[0],a=arguments[1],c=new G,d=po.getChainStartIndices(i),_=0;_<d.length-1;_++){var M=new Ii(i,d[_],d[_+1],a);c.add(M)}return c}},po.toIntArray=function(r){for(var i=new Array(r.size()).fill(null),a=0;a<i.length;a++)i[a]=r.get(a).intValue();return i};var Yi=function(){};Yi.prototype.computeNodes=function(r){},Yi.prototype.getNodedSubstrings=function(){},Yi.prototype.interfaces_=function(){return[]},Yi.prototype.getClass=function(){return Yi};var la=function(){if(this._segInt=null,arguments.length!==0){if(arguments.length===1){var r=arguments[0];this.setSegmentIntersector(r)}}};la.prototype.setSegmentIntersector=function(r){this._segInt=r},la.prototype.interfaces_=function(){return[Yi]},la.prototype.getClass=function(){return la};var hl=function(r){function i(c){c?r.call(this,c):r.call(this),this._monoChains=new G,this._index=new Mf,this._idCounter=0,this._nodedSegStrings=null,this._nOverlaps=0}r&&(i.__proto__=r),(i.prototype=Object.create(r&&r.prototype)).constructor=i;var a={SegmentOverlapAction:{configurable:!0}};return i.prototype.getMonotoneChains=function(){return this._monoChains},i.prototype.getNodedSubstrings=function(){return mr.getNodedSubstrings(this._nodedSegStrings)},i.prototype.getIndex=function(){return this._index},i.prototype.add=function(c){for(var d=po.getChains(c.getCoordinates(),c).iterator();d.hasNext();){var _=d.next();_.setId(this._idCounter++),this._index.insert(_.getEnvelope(),_),this._monoChains.add(_)}},i.prototype.computeNodes=function(c){this._nodedSegStrings=c;for(var d=c.iterator();d.hasNext();)this.add(d.next());this.intersectChains()},i.prototype.intersectChains=function(){for(var c=new Mr(this._segInt),d=this._monoChains.iterator();d.hasNext();)for(var _=d.next(),M=this._index.query(_.getEnvelope()).iterator();M.hasNext();){var L=M.next();if(L.getId()>_.getId()&&(_.computeOverlaps(L,c),this._nOverlaps++),this._segInt.isDone())return null}},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},a.SegmentOverlapAction.get=function(){return Mr},Object.defineProperties(i,a),i}(la),Mr=function(r){function i(){r.call(this),this._si=null;var a=arguments[0];this._si=a}return r&&(i.__proto__=r),i.prototype=Object.create(r&&r.prototype),i.prototype.constructor=i,i.prototype.overlap=function(){if(arguments.length!==4)return r.prototype.overlap.apply(this,arguments);var a=arguments[0],c=arguments[1],d=arguments[2],_=arguments[3],M=a.getContext(),L=d.getContext();this._si.processIntersections(M,c,L,_)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(Pi),Ge=function r(){if(this._quadrantSegments=r.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=r.CAP_ROUND,this._joinStyle=r.JOIN_ROUND,this._mitreLimit=r.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=r.DEFAULT_SIMPLIFY_FACTOR,arguments.length!==0){if(arguments.length===1){var i=arguments[0];this.setQuadrantSegments(i)}else if(arguments.length===2){var a=arguments[0],c=arguments[1];this.setQuadrantSegments(a),this.setEndCapStyle(c)}else if(arguments.length===4){var d=arguments[0],_=arguments[1],M=arguments[2],L=arguments[3];this.setQuadrantSegments(d),this.setEndCapStyle(_),this.setJoinStyle(M),this.setMitreLimit(L)}}},Oo={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}};Ge.prototype.getEndCapStyle=function(){return this._endCapStyle},Ge.prototype.isSingleSided=function(){return this._isSingleSided},Ge.prototype.setQuadrantSegments=function(r){this._quadrantSegments=r,this._quadrantSegments===0&&(this._joinStyle=Ge.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=Ge.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),r<=0&&(this._quadrantSegments=1),this._joinStyle!==Ge.JOIN_ROUND&&(this._quadrantSegments=Ge.DEFAULT_QUADRANT_SEGMENTS)},Ge.prototype.getJoinStyle=function(){return this._joinStyle},Ge.prototype.setJoinStyle=function(r){this._joinStyle=r},Ge.prototype.setSimplifyFactor=function(r){this._simplifyFactor=r<0?0:r},Ge.prototype.getSimplifyFactor=function(){return this._simplifyFactor},Ge.prototype.getQuadrantSegments=function(){return this._quadrantSegments},Ge.prototype.setEndCapStyle=function(r){this._endCapStyle=r},Ge.prototype.getMitreLimit=function(){return this._mitreLimit},Ge.prototype.setMitreLimit=function(r){this._mitreLimit=r},Ge.prototype.setSingleSided=function(r){this._isSingleSided=r},Ge.prototype.interfaces_=function(){return[]},Ge.prototype.getClass=function(){return Ge},Ge.bufferDistanceError=function(r){var i=Math.PI/2/r;return 1-Math.cos(i/2)},Oo.CAP_ROUND.get=function(){return 1},Oo.CAP_FLAT.get=function(){return 2},Oo.CAP_SQUARE.get=function(){return 3},Oo.JOIN_ROUND.get=function(){return 1},Oo.JOIN_MITRE.get=function(){return 2},Oo.JOIN_BEVEL.get=function(){return 3},Oo.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8},Oo.DEFAULT_MITRE_LIMIT.get=function(){return 5},Oo.DEFAULT_SIMPLIFY_FACTOR.get=function(){return .01},Object.defineProperties(Ge,Oo);var yr=function(r){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=dt.COUNTERCLOCKWISE,this._inputLine=r||null},Ga={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};yr.prototype.isDeletable=function(r,i,a,c){var d=this._inputLine[r],_=this._inputLine[i],M=this._inputLine[a];return!!this.isConcave(d,_,M)&&!!this.isShallow(d,_,M,c)&&this.isShallowSampled(d,_,r,a,c)},yr.prototype.deleteShallowConcavities=function(){for(var r=1,i=this.findNextNonDeletedIndex(r),a=this.findNextNonDeletedIndex(i),c=!1;a<this._inputLine.length;){var d=!1;this.isDeletable(r,i,a,this._distanceTol)&&(this._isDeleted[i]=yr.DELETE,d=!0,c=!0),r=d?a:i,i=this.findNextNonDeletedIndex(r),a=this.findNextNonDeletedIndex(i)}return c},yr.prototype.isShallowConcavity=function(r,i,a,c){return dt.computeOrientation(r,i,a)!==this._angleOrientation?!1:dt.distancePointLine(i,r,a)<c},yr.prototype.isShallowSampled=function(r,i,a,c,d){var _=Math.trunc((c-a)/yr.NUM_PTS_TO_CHECK);_<=0&&(_=1);for(var M=a;M<c;M+=_)if(!this.isShallow(r,i,this._inputLine[M],d))return!1;return!0},yr.prototype.isConcave=function(r,i,a){var c=dt.computeOrientation(r,i,a)===this._angleOrientation;return c},yr.prototype.simplify=function(r){this._distanceTol=Math.abs(r),r<0&&(this._angleOrientation=dt.CLOCKWISE),this._isDeleted=new Array(this._inputLine.length).fill(null);var i=!1;do i=this.deleteShallowConcavities();while(i);return this.collapseLine()},yr.prototype.findNextNonDeletedIndex=function(r){for(var i=r+1;i<this._inputLine.length&&this._isDeleted[i]===yr.DELETE;)i++;return i},yr.prototype.isShallow=function(r,i,a,c){return dt.distancePointLine(i,r,a)<c},yr.prototype.collapseLine=function(){for(var r=new et,i=0;i<this._inputLine.length;i++)this._isDeleted[i]!==yr.DELETE&&r.add(this._inputLine[i]);return r.toCoordinateArray()},yr.prototype.interfaces_=function(){return[]},yr.prototype.getClass=function(){return yr},yr.simplify=function(r,i){return new yr(r).simplify(i)},Ga.INIT.get=function(){return 0},Ga.DELETE.get=function(){return 1},Ga.KEEP.get=function(){return 1},Ga.NUM_PTS_TO_CHECK.get=function(){return 10},Object.defineProperties(yr,Ga);var $i=function(){this._ptList=null,this._precisionModel=null,this._minimimVertexDistance=0,this._ptList=new G},qh={COORDINATE_ARRAY_TYPE:{configurable:!0}};$i.prototype.getCoordinates=function(){return this._ptList.toArray($i.COORDINATE_ARRAY_TYPE)},$i.prototype.setPrecisionModel=function(r){this._precisionModel=r},$i.prototype.addPt=function(r){var i=new D(r);if(this._precisionModel.makePrecise(i),this.isRedundant(i))return null;this._ptList.add(i)},$i.prototype.revere=function(){},$i.prototype.addPts=function(r,i){if(i)for(var a=0;a<r.length;a++)this.addPt(r[a]);else for(var c=r.length-1;c>=0;c--)this.addPt(r[c])},$i.prototype.isRedundant=function(r){if(this._ptList.size()<1)return!1;var i=this._ptList.get(this._ptList.size()-1);return r.distance(i)<this._minimimVertexDistance},$i.prototype.toString=function(){return new Le().createLineString(this.getCoordinates()).toString()},$i.prototype.closeRing=function(){if(this._ptList.size()<1)return null;var r=new D(this._ptList.get(0)),i=this._ptList.get(this._ptList.size()-1);if(r.equals(i))return null;this._ptList.add(r)},$i.prototype.setMinimumVertexDistance=function(r){this._minimimVertexDistance=r},$i.prototype.interfaces_=function(){return[]},$i.prototype.getClass=function(){return $i},qh.COORDINATE_ARRAY_TYPE.get=function(){return new Array(0).fill(null)},Object.defineProperties($i,qh);var He=function(){},ca={PI_TIMES_2:{configurable:!0},PI_OVER_2:{configurable:!0},PI_OVER_4:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},CLOCKWISE:{configurable:!0},NONE:{configurable:!0}};He.prototype.interfaces_=function(){return[]},He.prototype.getClass=function(){return He},He.toDegrees=function(r){return 180*r/Math.PI},He.normalize=function(r){for(;r>Math.PI;)r-=He.PI_TIMES_2;for(;r<=-Math.PI;)r+=He.PI_TIMES_2;return r},He.angle=function(){if(arguments.length===1){var r=arguments[0];return Math.atan2(r.y,r.x)}if(arguments.length===2){var i=arguments[0],a=arguments[1],c=a.x-i.x,d=a.y-i.y;return Math.atan2(d,c)}},He.isAcute=function(r,i,a){var c=r.x-i.x,d=r.y-i.y;return c*(a.x-i.x)+d*(a.y-i.y)>0},He.isObtuse=function(r,i,a){var c=r.x-i.x,d=r.y-i.y;return c*(a.x-i.x)+d*(a.y-i.y)<0},He.interiorAngle=function(r,i,a){var c=He.angle(i,r),d=He.angle(i,a);return Math.abs(d-c)},He.normalizePositive=function(r){if(r<0){for(;r<0;)r+=He.PI_TIMES_2;r>=He.PI_TIMES_2&&(r=0)}else{for(;r>=He.PI_TIMES_2;)r-=He.PI_TIMES_2;r<0&&(r=0)}return r},He.angleBetween=function(r,i,a){var c=He.angle(i,r),d=He.angle(i,a);return He.diff(c,d)},He.diff=function(r,i){var a=null;return(a=r<i?i-r:r-i)>Math.PI&&(a=2*Math.PI-a),a},He.toRadians=function(r){return r*Math.PI/180},He.getTurn=function(r,i){var a=Math.sin(i-r);return a>0?He.COUNTERCLOCKWISE:a<0?He.CLOCKWISE:He.NONE},He.angleBetweenOriented=function(r,i,a){var c=He.angle(i,r),d=He.angle(i,a)-c;return d<=-Math.PI?d+He.PI_TIMES_2:d>Math.PI?d-He.PI_TIMES_2:d},ca.PI_TIMES_2.get=function(){return 2*Math.PI},ca.PI_OVER_2.get=function(){return Math.PI/2},ca.PI_OVER_4.get=function(){return Math.PI/4},ca.COUNTERCLOCKWISE.get=function(){return dt.COUNTERCLOCKWISE},ca.CLOCKWISE.get=function(){return dt.CLOCKWISE},ca.NONE.get=function(){return dt.COLLINEAR},Object.defineProperties(He,ca);var Kn=function r(){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 ie,this._seg1=new ie,this._offset0=new ie,this._offset1=new ie,this._side=0,this._hasNarrowConcaveAngle=!1;var i=arguments[0],a=arguments[1],c=arguments[2];this._precisionModel=i,this._bufParams=a,this._li=new z,this._filletAngleQuantum=Math.PI/2/a.getQuadrantSegments(),a.getQuadrantSegments()>=8&&a.getJoinStyle()===Ge.JOIN_ROUND&&(this._closingSegLengthFactor=r.MAX_CLOSING_SEG_LEN_FACTOR),this.init(c)},xs={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}};Kn.prototype.addNextSegment=function(r,i){if(this._s0=this._s1,this._s1=this._s2,this._s2=r,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 a=dt.computeOrientation(this._s0,this._s1,this._s2),c=a===dt.CLOCKWISE&&this._side===Xt.LEFT||a===dt.COUNTERCLOCKWISE&&this._side===Xt.RIGHT;a===0?this.addCollinear(i):c?this.addOutsideTurn(a,i):this.addInsideTurn(a,i)},Kn.prototype.addLineEndCap=function(r,i){var a=new ie(r,i),c=new ie;this.computeOffsetSegment(a,Xt.LEFT,this._distance,c);var d=new ie;this.computeOffsetSegment(a,Xt.RIGHT,this._distance,d);var _=i.x-r.x,M=i.y-r.y,L=Math.atan2(M,_);switch(this._bufParams.getEndCapStyle()){case Ge.CAP_ROUND:this._segList.addPt(c.p1),this.addFilletArc(i,L+Math.PI/2,L-Math.PI/2,dt.CLOCKWISE,this._distance),this._segList.addPt(d.p1);break;case Ge.CAP_FLAT:this._segList.addPt(c.p1),this._segList.addPt(d.p1);break;case Ge.CAP_SQUARE:var H=new D;H.x=Math.abs(this._distance)*Math.cos(L),H.y=Math.abs(this._distance)*Math.sin(L);var it=new D(c.p1.x+H.x,c.p1.y+H.y),bt=new D(d.p1.x+H.x,d.p1.y+H.y);this._segList.addPt(it),this._segList.addPt(bt)}},Kn.prototype.getCoordinates=function(){return this._segList.getCoordinates()},Kn.prototype.addMitreJoin=function(r,i,a,c){var d=!0,_=null;try{_=$t.intersection(i.p0,i.p1,a.p0,a.p1),(c<=0?1:_.distance(r)/Math.abs(c))>this._bufParams.getMitreLimit()&&(d=!1)}catch(M){if(!(M instanceof ce))throw M;_=new D(0,0),d=!1}d?this._segList.addPt(_):this.addLimitedMitreJoin(i,a,c,this._bufParams.getMitreLimit())},Kn.prototype.addFilletCorner=function(r,i,a,c,d){var _=i.x-r.x,M=i.y-r.y,L=Math.atan2(M,_),H=a.x-r.x,it=a.y-r.y,bt=Math.atan2(it,H);c===dt.CLOCKWISE?L<=bt&&(L+=2*Math.PI):L>=bt&&(L-=2*Math.PI),this._segList.addPt(i),this.addFilletArc(r,L,bt,c,d),this._segList.addPt(a)},Kn.prototype.addOutsideTurn=function(r,i){if(this._offset0.p1.distance(this._offset1.p0)<this._distance*Kn.OFFSET_SEGMENT_SEPARATION_FACTOR)return this._segList.addPt(this._offset0.p1),null;this._bufParams.getJoinStyle()===Ge.JOIN_MITRE?this.addMitreJoin(this._s1,this._offset0,this._offset1,this._distance):this._bufParams.getJoinStyle()===Ge.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,r,this._distance),this._segList.addPt(this._offset1.p0))},Kn.prototype.createSquare=function(r){this._segList.addPt(new D(r.x+this._distance,r.y+this._distance)),this._segList.addPt(new D(r.x+this._distance,r.y-this._distance)),this._segList.addPt(new D(r.x-this._distance,r.y-this._distance)),this._segList.addPt(new D(r.x-this._distance,r.y+this._distance)),this._segList.closeRing()},Kn.prototype.addSegments=function(r,i){this._segList.addPts(r,i)},Kn.prototype.addFirstSegment=function(){this._segList.addPt(this._offset1.p0)},Kn.prototype.addLastSegment=function(){this._segList.addPt(this._offset1.p1)},Kn.prototype.initSideSegments=function(r,i,a){this._s1=r,this._s2=i,this._side=a,this._seg1.setCoordinates(r,i),this.computeOffsetSegment(this._seg1,a,this._distance,this._offset1)},Kn.prototype.addLimitedMitreJoin=function(r,i,a,c){var d=this._seg0.p1,_=He.angle(d,this._seg0.p0),M=He.angleBetweenOriented(this._seg0.p0,d,this._seg1.p1)/2,L=He.normalize(_+M),H=He.normalize(L+Math.PI),it=c*a,bt=a-it*Math.abs(Math.sin(M)),Tt=d.x+it*Math.cos(H),Kt=d.y+it*Math.sin(H),Qt=new D(Tt,Kt),le=new ie(d,Qt),Ee=le.pointAlongOffset(1,bt),Dn=le.pointAlongOffset(1,-bt);this._side===Xt.LEFT?(this._segList.addPt(Ee),this._segList.addPt(Dn)):(this._segList.addPt(Dn),this._segList.addPt(Ee))},Kn.prototype.computeOffsetSegment=function(r,i,a,c){var d=i===Xt.LEFT?1:-1,_=r.p1.x-r.p0.x,M=r.p1.y-r.p0.y,L=Math.sqrt(_*_+M*M),H=d*a*_/L,it=d*a*M/L;c.p0.x=r.p0.x-it,c.p0.y=r.p0.y+H,c.p1.x=r.p1.x-it,c.p1.y=r.p1.y+H},Kn.prototype.addFilletArc=function(r,i,a,c,d){var _=c===dt.CLOCKWISE?-1:1,M=Math.abs(i-a),L=Math.trunc(M/this._filletAngleQuantum+.5);if(L<1)return null;for(var H=M/L,it=0,bt=new D;it<M;){var Tt=i+_*it;bt.x=r.x+d*Math.cos(Tt),bt.y=r.y+d*Math.sin(Tt),this._segList.addPt(bt),it+=H}},Kn.prototype.addInsideTurn=function(r,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*Kn.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR)this._segList.addPt(this._offset0.p1);else{if(this._segList.addPt(this._offset0.p1),this._closingSegLengthFactor>0){var a=new D((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(a);var c=new D((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(c)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}},Kn.prototype.createCircle=function(r){var i=new D(r.x+this._distance,r.y);this._segList.addPt(i),this.addFilletArc(r,0,2*Math.PI,-1,this._distance),this._segList.closeRing()},Kn.prototype.addBevelJoin=function(r,i){this._segList.addPt(r.p1),this._segList.addPt(i.p0)},Kn.prototype.init=function(r){this._distance=r,this._maxCurveSegmentError=r*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new $i,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(r*Kn.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)},Kn.prototype.addCollinear=function(r){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2),this._li.getIntersectionNum()>=2&&(this._bufParams.getJoinStyle()===Ge.JOIN_BEVEL||this._bufParams.getJoinStyle()===Ge.JOIN_MITRE?(r&&this._segList.addPt(this._offset0.p1),this._segList.addPt(this._offset1.p0)):this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,dt.CLOCKWISE,this._distance))},Kn.prototype.closeRing=function(){this._segList.closeRing()},Kn.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle},Kn.prototype.interfaces_=function(){return[]},Kn.prototype.getClass=function(){return Kn},xs.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return .001},xs.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return .001},xs.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6},xs.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80},Object.defineProperties(Kn,xs);var pi=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var r=arguments[0],i=arguments[1];this._precisionModel=r,this._bufParams=i};pi.prototype.getOffsetCurve=function(r,i){if(this._distance=i,i===0)return null;var a=i<0,c=Math.abs(i),d=this.getSegGen(c);r.length<=1?this.computePointCurve(r[0],d):this.computeOffsetCurve(r,a,d);var _=d.getCoordinates();return a&&lt.reverse(_),_},pi.prototype.computeSingleSidedBufferCurve=function(r,i,a){var c=this.simplifyTolerance(this._distance);if(i){a.addSegments(r,!0);var d=yr.simplify(r,-c),_=d.length-1;a.initSideSegments(d[_],d[_-1],Xt.LEFT),a.addFirstSegment();for(var M=_-2;M>=0;M--)a.addNextSegment(d[M],!0)}else{a.addSegments(r,!1);var L=yr.simplify(r,c),H=L.length-1;a.initSideSegments(L[0],L[1],Xt.LEFT),a.addFirstSegment();for(var it=2;it<=H;it++)a.addNextSegment(L[it],!0)}a.addLastSegment(),a.closeRing()},pi.prototype.computeRingBufferCurve=function(r,i,a){var c=this.simplifyTolerance(this._distance);i===Xt.RIGHT&&(c=-c);var d=yr.simplify(r,c),_=d.length-1;a.initSideSegments(d[_-1],d[0],i);for(var M=1;M<=_;M++){var L=M!==1;a.addNextSegment(d[M],L)}a.closeRing()},pi.prototype.computeLineBufferCurve=function(r,i){var a=this.simplifyTolerance(this._distance),c=yr.simplify(r,a),d=c.length-1;i.initSideSegments(c[0],c[1],Xt.LEFT);for(var _=2;_<=d;_++)i.addNextSegment(c[_],!0);i.addLastSegment(),i.addLineEndCap(c[d-1],c[d]);var M=yr.simplify(r,-a),L=M.length-1;i.initSideSegments(M[L],M[L-1],Xt.LEFT);for(var H=L-2;H>=0;H--)i.addNextSegment(M[H],!0);i.addLastSegment(),i.addLineEndCap(M[1],M[0]),i.closeRing()},pi.prototype.computePointCurve=function(r,i){switch(this._bufParams.getEndCapStyle()){case Ge.CAP_ROUND:i.createCircle(r);break;case Ge.CAP_SQUARE:i.createSquare(r)}},pi.prototype.getLineCurve=function(r,i){if(this._distance=i,i<0&&!this._bufParams.isSingleSided()||i===0)return null;var a=Math.abs(i),c=this.getSegGen(a);if(r.length<=1)this.computePointCurve(r[0],c);else if(this._bufParams.isSingleSided()){var d=i<0;this.computeSingleSidedBufferCurve(r,d,c)}else this.computeLineBufferCurve(r,c);return c.getCoordinates()},pi.prototype.getBufferParameters=function(){return this._bufParams},pi.prototype.simplifyTolerance=function(r){return r*this._bufParams.getSimplifyFactor()},pi.prototype.getRingCurve=function(r,i,a){if(this._distance=a,r.length<=2)return this.getLineCurve(r,a);if(a===0)return pi.copyCoordinates(r);var c=this.getSegGen(a);return this.computeRingBufferCurve(r,i,c),c.getCoordinates()},pi.prototype.computeOffsetCurve=function(r,i,a){var c=this.simplifyTolerance(this._distance);if(i){var d=yr.simplify(r,-c),_=d.length-1;a.initSideSegments(d[_],d[_-1],Xt.LEFT),a.addFirstSegment();for(var M=_-2;M>=0;M--)a.addNextSegment(d[M],!0)}else{var L=yr.simplify(r,c),H=L.length-1;a.initSideSegments(L[0],L[1],Xt.LEFT),a.addFirstSegment();for(var it=2;it<=H;it++)a.addNextSegment(L[it],!0)}a.addLastSegment()},pi.prototype.getSegGen=function(r){return new Kn(this._precisionModel,this._bufParams,r)},pi.prototype.interfaces_=function(){return[]},pi.prototype.getClass=function(){return pi},pi.copyCoordinates=function(r){for(var i=new Array(r.length).fill(null),a=0;a<i.length;a++)i[a]=new D(r[a]);return i};var fa=function(){this._subgraphs=null,this._seg=new ie,this._cga=new dt;var r=arguments[0];this._subgraphs=r},bf={DepthSegment:{configurable:!0}};fa.prototype.findStabbedSegments=function(){if(arguments.length===1){for(var r=arguments[0],i=new G,a=this._subgraphs.iterator();a.hasNext();){var c=a.next(),d=c.getEnvelope();r.y<d.getMinY()||r.y>d.getMaxY()||this.findStabbedSegments(r,c.getDirectedEdges(),i)}return i}if(arguments.length===3){if(Q(arguments[2],Et)&&arguments[0]instanceof D&&arguments[1]instanceof wf){for(var _=arguments[0],M=arguments[1],L=arguments[2],H=M.getEdge().getCoordinates(),it=0;it<H.length-1;it++)if(this._seg.p0=H[it],this._seg.p1=H[it+1],this._seg.p0.y>this._seg.p1.y&&this._seg.reverse(),!(Math.max(this._seg.p0.x,this._seg.p1.x)<_.x)&&!(this._seg.isHorizontal()||_.y<this._seg.p0.y||_.y>this._seg.p1.y||dt.computeOrientation(this._seg.p0,this._seg.p1,_)===dt.RIGHT)){var bt=M.getDepth(Xt.LEFT);this._seg.p0.equals(H[it])||(bt=M.getDepth(Xt.RIGHT));var Tt=new Es(this._seg,bt);L.add(Tt)}}else if(Q(arguments[2],Et)&&arguments[0]instanceof D&&Q(arguments[1],Et))for(var Kt=arguments[0],Qt=arguments[1],le=arguments[2],Ee=Qt.iterator();Ee.hasNext();){var Dn=Ee.next();Dn.isForward()&&this.findStabbedSegments(Kt,Dn,le)}}},fa.prototype.getDepth=function(r){var i=this.findStabbedSegments(r);return i.size()===0?0:ho.min(i)._leftDepth},fa.prototype.interfaces_=function(){return[]},fa.prototype.getClass=function(){return fa},bf.DepthSegment.get=function(){return Es},Object.defineProperties(fa,bf);var Es=function(){this._upwardSeg=null,this._leftDepth=null;var r=arguments[0],i=arguments[1];this._upwardSeg=new ie(r),this._leftDepth=i};Es.prototype.compareTo=function(r){var i=r;if(this._upwardSeg.minX()>=i._upwardSeg.maxX())return 1;if(this._upwardSeg.maxX()<=i._upwardSeg.minX())return-1;var a=this._upwardSeg.orientationIndex(i._upwardSeg);return a!==0||(a=-1*i._upwardSeg.orientationIndex(this._upwardSeg))!=0?a:this._upwardSeg.compareTo(i._upwardSeg)},Es.prototype.compareX=function(r,i){var a=r.p0.compareTo(i.p0);return a!==0?a:r.p1.compareTo(i.p1)},Es.prototype.toString=function(){return this._upwardSeg.toString()},Es.prototype.interfaces_=function(){return[V]},Es.prototype.getClass=function(){return Es};var $e=function(r,i,a){this.p0=r||null,this.p1=i||null,this.p2=a||null};$e.prototype.area=function(){return $e.area(this.p0,this.p1,this.p2)},$e.prototype.signedArea=function(){return $e.signedArea(this.p0,this.p1,this.p2)},$e.prototype.interpolateZ=function(r){if(r===null)throw new I("Supplied point is null.");return $e.interpolateZ(r,this.p0,this.p1,this.p2)},$e.prototype.longestSideLength=function(){return $e.longestSideLength(this.p0,this.p1,this.p2)},$e.prototype.isAcute=function(){return $e.isAcute(this.p0,this.p1,this.p2)},$e.prototype.circumcentre=function(){return $e.circumcentre(this.p0,this.p1,this.p2)},$e.prototype.area3D=function(){return $e.area3D(this.p0,this.p1,this.p2)},$e.prototype.centroid=function(){return $e.centroid(this.p0,this.p1,this.p2)},$e.prototype.inCentre=function(){return $e.inCentre(this.p0,this.p1,this.p2)},$e.prototype.interfaces_=function(){return[]},$e.prototype.getClass=function(){return $e},$e.area=function(r,i,a){return Math.abs(((a.x-r.x)*(i.y-r.y)-(i.x-r.x)*(a.y-r.y))/2)},$e.signedArea=function(r,i,a){return((a.x-r.x)*(i.y-r.y)-(i.x-r.x)*(a.y-r.y))/2},$e.det=function(r,i,a,c){return r*c-i*a},$e.interpolateZ=function(r,i,a,c){var d=i.x,_=i.y,M=a.x-d,L=c.x-d,H=a.y-_,it=c.y-_,bt=M*it-L*H,Tt=r.x-d,Kt=r.y-_,Qt=(it*Tt-L*Kt)/bt,le=(-H*Tt+M*Kt)/bt;return i.z+Qt*(a.z-i.z)+le*(c.z-i.z)},$e.longestSideLength=function(r,i,a){var c=r.distance(i),d=i.distance(a),_=a.distance(r),M=c;return d>M&&(M=d),_>M&&(M=_),M},$e.isAcute=function(r,i,a){return!!He.isAcute(r,i,a)&&!!He.isAcute(i,a,r)&&!!He.isAcute(a,r,i)},$e.circumcentre=function(r,i,a){var c=a.x,d=a.y,_=r.x-c,M=r.y-d,L=i.x-c,H=i.y-d,it=2*$e.det(_,M,L,H),bt=$e.det(M,_*_+M*M,H,L*L+H*H),Tt=$e.det(_,_*_+M*M,L,L*L+H*H);return new D(c-bt/it,d+Tt/it)},$e.perpendicularBisector=function(r,i){var a=i.x-r.x,c=i.y-r.y,d=new $t(r.x+a/2,r.y+c/2,1),_=new $t(r.x-c+a/2,r.y+a+c/2,1);return new $t(d,_)},$e.angleBisector=function(r,i,a){var c=i.distance(r),d=c/(c+i.distance(a)),_=a.x-r.x,M=a.y-r.y;return new D(r.x+d*_,r.y+d*M)},$e.area3D=function(r,i,a){var c=i.x-r.x,d=i.y-r.y,_=i.z-r.z,M=a.x-r.x,L=a.y-r.y,H=a.z-r.z,it=d*H-_*L,bt=_*M-c*H,Tt=c*L-d*M,Kt=it*it+bt*bt+Tt*Tt,Qt=Math.sqrt(Kt)/2;return Qt},$e.centroid=function(r,i,a){var c=(r.x+i.x+a.x)/3,d=(r.y+i.y+a.y)/3;return new D(c,d)},$e.inCentre=function(r,i,a){var c=i.distance(a),d=r.distance(a),_=r.distance(i),M=c+d+_,L=(c*r.x+d*i.x+_*a.x)/M,H=(c*r.y+d*i.y+_*a.y)/M;return new D(L,H)};var Zi=function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new G;var r=arguments[0],i=arguments[1],a=arguments[2];this._inputGeom=r,this._distance=i,this._curveBuilder=a};Zi.prototype.addPoint=function(r){if(this._distance<=0)return null;var i=r.getCoordinates(),a=this._curveBuilder.getLineCurve(i,this._distance);this.addCurve(a,K.EXTERIOR,K.INTERIOR)},Zi.prototype.addPolygon=function(r){var i=this._distance,a=Xt.LEFT;this._distance<0&&(i=-this._distance,a=Xt.RIGHT);var c=r.getExteriorRing(),d=lt.removeRepeatedPoints(c.getCoordinates());if(this._distance<0&&this.isErodedCompletely(c,this._distance)||this._distance<=0&&d.length<3)return null;this.addPolygonRing(d,i,a,K.EXTERIOR,K.INTERIOR);for(var _=0;_<r.getNumInteriorRing();_++){var M=r.getInteriorRingN(_),L=lt.removeRepeatedPoints(M.getCoordinates());this._distance>0&&this.isErodedCompletely(M,-this._distance)||this.addPolygonRing(L,i,Xt.opposite(a),K.INTERIOR,K.EXTERIOR)}},Zi.prototype.isTriangleErodedCompletely=function(r,i){var a=new $e(r[0],r[1],r[2]),c=a.inCentre();return dt.distancePointLine(c,a.p0,a.p1)<Math.abs(i)},Zi.prototype.addLineString=function(r){if(this._distance<=0&&!this._curveBuilder.getBufferParameters().isSingleSided())return null;var i=lt.removeRepeatedPoints(r.getCoordinates()),a=this._curveBuilder.getLineCurve(i,this._distance);this.addCurve(a,K.EXTERIOR,K.INTERIOR)},Zi.prototype.addCurve=function(r,i,a){if(r===null||r.length<2)return null;var c=new mr(r,new On(0,K.BOUNDARY,i,a));this._curveList.add(c)},Zi.prototype.getCurves=function(){return this.add(this._inputGeom),this._curveList},Zi.prototype.addPolygonRing=function(r,i,a,c,d){if(i===0&&r.length<Ae.MINIMUM_VALID_SIZE)return null;var _=c,M=d;r.length>=Ae.MINIMUM_VALID_SIZE&&dt.isCCW(r)&&(_=d,M=c,a=Xt.opposite(a));var L=this._curveBuilder.getRingCurve(r,a,i);this.addCurve(L,_,M)},Zi.prototype.add=function(r){if(r.isEmpty())return null;r instanceof de?this.addPolygon(r):r instanceof vt?this.addLineString(r):r instanceof ue?this.addPoint(r):r instanceof Be?this.addCollection(r):r instanceof bi?this.addCollection(r):r instanceof Pe?this.addCollection(r):r instanceof Qn&&this.addCollection(r)},Zi.prototype.isErodedCompletely=function(r,i){var a=r.getCoordinates();if(a.length<4)return i<0;if(a.length===4)return this.isTriangleErodedCompletely(a,i);var c=r.getEnvelopeInternal(),d=Math.min(c.getHeight(),c.getWidth());return i<0&&2*Math.abs(i)>d},Zi.prototype.addCollection=function(r){for(var i=0;i<r.getNumGeometries();i++){var a=r.getGeometryN(i);this.add(a)}},Zi.prototype.interfaces_=function(){return[]},Zi.prototype.getClass=function(){return Zi};var _u=function(){};_u.prototype.locate=function(r){},_u.prototype.interfaces_=function(){return[]},_u.prototype.getClass=function(){return _u};var go=function(){this._parent=null,this._atStart=null,this._max=null,this._index=null,this._subcollectionIterator=null;var r=arguments[0];this._parent=r,this._atStart=!0,this._index=0,this._max=r.getNumGeometries()};go.prototype.next=function(){if(this._atStart)return this._atStart=!1,go.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 r=this._parent.getGeometryN(this._index++);return r instanceof Qn?(this._subcollectionIterator=new go(r),this._subcollectionIterator.next()):r},go.prototype.remove=function(){throw new Error(this.getClass().getName())},go.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)},go.prototype.interfaces_=function(){return[wt]},go.prototype.getClass=function(){return go},go.isAtomic=function(r){return!(r instanceof Qn)};var di=function(){this._geom=null;var r=arguments[0];this._geom=r};di.prototype.locate=function(r){return di.locate(r,this._geom)},di.prototype.interfaces_=function(){return[_u]},di.prototype.getClass=function(){return di},di.isPointInRing=function(r,i){return!!i.getEnvelopeInternal().intersects(r)&&dt.isPointInRing(r,i.getCoordinates())},di.containsPointInPolygon=function(r,i){if(i.isEmpty())return!1;var a=i.getExteriorRing();if(!di.isPointInRing(r,a))return!1;for(var c=0;c<i.getNumInteriorRing();c++){var d=i.getInteriorRingN(c);if(di.isPointInRing(r,d))return!1}return!0},di.containsPoint=function(r,i){if(i instanceof de)return di.containsPointInPolygon(r,i);if(i instanceof Qn)for(var a=new go(i);a.hasNext();){var c=a.next();if(c!==i&&di.containsPoint(r,c))return!0}return!1},di.locate=function(r,i){return i.isEmpty()?K.EXTERIOR:di.containsPoint(r,i)?K.INTERIOR:K.EXTERIOR};var ti=function(){this._edgeMap=new w,this._edgeList=null,this._ptInAreaLocation=[K.NONE,K.NONE]};ti.prototype.getNextCW=function(r){this.getEdges();var i=this._edgeList.indexOf(r),a=i-1;return i===0&&(a=this._edgeList.size()-1),this._edgeList.get(a)},ti.prototype.propagateSideLabels=function(r){for(var i=K.NONE,a=this.iterator();a.hasNext();){var c=a.next().getLabel();c.isArea(r)&&c.getLocation(r,Xt.LEFT)!==K.NONE&&(i=c.getLocation(r,Xt.LEFT))}if(i===K.NONE)return null;for(var d=i,_=this.iterator();_.hasNext();){var M=_.next(),L=M.getLabel();if(L.getLocation(r,Xt.ON)===K.NONE&&L.setLocation(r,Xt.ON,d),L.isArea(r)){var H=L.getLocation(r,Xt.LEFT),it=L.getLocation(r,Xt.RIGHT);if(it!==K.NONE){if(it!==d)throw new Qo("side location conflict",M.getCoordinate());H===K.NONE&&Wt.shouldNeverReachHere("found single null side (at "+M.getCoordinate()+")"),d=H}else Wt.isTrue(L.getLocation(r,Xt.LEFT)===K.NONE,"found single null side"),L.setLocation(r,Xt.RIGHT,d),L.setLocation(r,Xt.LEFT,d)}}},ti.prototype.getCoordinate=function(){var r=this.iterator();return r.hasNext()?r.next().getCoordinate():null},ti.prototype.print=function(r){te.out.println("EdgeEndStar: "+this.getCoordinate());for(var i=this.iterator();i.hasNext();)i.next().print(r)},ti.prototype.isAreaLabelsConsistent=function(r){return this.computeEdgeEndLabels(r.getBoundaryNodeRule()),this.checkAreaLabelsConsistent(0)},ti.prototype.checkAreaLabelsConsistent=function(r){var i=this.getEdges();if(i.size()<=0)return!0;var a=i.size()-1,c=i.get(a).getLabel().getLocation(r,Xt.LEFT);Wt.isTrue(c!==K.NONE,"Found unlabelled area edge");for(var d=c,_=this.iterator();_.hasNext();){var M=_.next().getLabel();Wt.isTrue(M.isArea(r),"Found non-area edge");var L=M.getLocation(r,Xt.LEFT),H=M.getLocation(r,Xt.RIGHT);if(L===H||H!==d)return!1;d=L}return!0},ti.prototype.findIndex=function(r){this.iterator();for(var i=0;i<this._edgeList.size();i++)if(this._edgeList.get(i)===r)return i;return-1},ti.prototype.iterator=function(){return this.getEdges().iterator()},ti.prototype.getEdges=function(){return this._edgeList===null&&(this._edgeList=new G(this._edgeMap.values())),this._edgeList},ti.prototype.getLocation=function(r,i,a){return this._ptInAreaLocation[r]===K.NONE&&(this._ptInAreaLocation[r]=di.locate(i,a[r].getGeometry())),this._ptInAreaLocation[r]},ti.prototype.toString=function(){var r=new Lt;r.append("EdgeEndStar: "+this.getCoordinate()),r.append(`
6
6
  `);for(var i=this.iterator();i.hasNext();){var a=i.next();r.append(a),r.append(`
7
- `)}return r.toString()},ti.prototype.computeEdgeEndLabels=function(r){for(var i=this.iterator();i.hasNext();)i.next().computeLabel(r)},ti.prototype.computeLabelling=function(r){this.computeEdgeEndLabels(r[0].getBoundaryNodeRule()),this.propagateSideLabels(0),this.propagateSideLabels(1);for(var i=[!1,!1],a=this.iterator();a.hasNext();)for(var c=a.next().getLabel(),d=0;d<2;d++)c.isLine(d)&&c.getLocation(d)===K.BOUNDARY&&(i[d]=!0);for(var _=this.iterator();_.hasNext();)for(var M=_.next(),L=M.getLabel(),H=0;H<2;H++)if(L.isAnyNull(H)){var it=K.NONE;if(i[H])it=K.EXTERIOR;else{var bt=M.getCoordinate();it=this.getLocation(H,bt,r)}L.setAllLocationsIfNull(H,it)}},ti.prototype.getDegree=function(){return this._edgeMap.size()},ti.prototype.insertEdgeEnd=function(r,i){this._edgeMap.put(r,i),this._edgeList=null},ti.prototype.interfaces_=function(){return[]},ti.prototype.getClass=function(){return ti};var Hh=function(r){function i(){r.call(this),this._resultAreaEdgeList=null,this._label=null,this._SCANNING_FOR_INCOMING=1,this._LINKING_TO_OUTGOING=2}return r&&(i.__proto__=r),i.prototype=Object.create(r&&r.prototype),i.prototype.constructor=i,i.prototype.linkResultDirectedEdges=function(){this.getResultAreaEdges();for(var a=null,c=null,d=this._SCANNING_FOR_INCOMING,_=0;_<this._resultAreaEdgeList.size();_++){var M=this._resultAreaEdgeList.get(_),L=M.getSym();if(M.getLabel().isArea())switch(a===null&&M.isInResult()&&(a=M),d){case this._SCANNING_FOR_INCOMING:if(!L.isInResult())continue;c=L,d=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(!M.isInResult())continue;c.setNext(M),d=this._SCANNING_FOR_INCOMING}}if(d===this._LINKING_TO_OUTGOING){if(a===null)throw new Qo("no outgoing dirEdge found",this.getCoordinate());Wt.isTrue(a.isInResult(),"unable to link last incoming dirEdge"),c.setNext(a)}},i.prototype.insert=function(a){var c=a;this.insertEdgeEnd(c,c)},i.prototype.getRightmostEdge=function(){var a=this.getEdges(),c=a.size();if(c<1)return null;var d=a.get(0);if(c===1)return d;var _=a.get(c-1),M=d.getQuadrant(),L=_.getQuadrant();return Yn.isNorthern(M)&&Yn.isNorthern(L)?d:Yn.isNorthern(M)||Yn.isNorthern(L)?d.getDy()!==0?d:_.getDy()!==0?_:(Wt.shouldNeverReachHere("found two horizontal edges incident on node"),null):_},i.prototype.print=function(a){te.out.println("DirectedEdgeStar: "+this.getCoordinate());for(var c=this.iterator();c.hasNext();){var d=c.next();a.print("out "),d.print(a),a.println(),a.print("in "),d.getSym().print(a),a.println()}},i.prototype.getResultAreaEdges=function(){if(this._resultAreaEdgeList!==null)return this._resultAreaEdgeList;this._resultAreaEdgeList=new G;for(var a=this.iterator();a.hasNext();){var c=a.next();(c.isInResult()||c.getSym().isInResult())&&this._resultAreaEdgeList.add(c)}return this._resultAreaEdgeList},i.prototype.updateLabelling=function(a){for(var c=this.iterator();c.hasNext();){var d=c.next().getLabel();d.setAllLocationsIfNull(0,a.getLocation(0)),d.setAllLocationsIfNull(1,a.getLocation(1))}},i.prototype.linkAllDirectedEdges=function(){this.getEdges();for(var a=null,c=null,d=this._edgeList.size()-1;d>=0;d--){var _=this._edgeList.get(d),M=_.getSym();c===null&&(c=M),a!==null&&M.setNext(a),a=_}c.setNext(a)},i.prototype.computeDepths=function(){if(arguments.length===1){var a=arguments[0],c=this.findIndex(a),d=a.getDepth(Xt.LEFT),_=a.getDepth(Xt.RIGHT),M=this.computeDepths(c+1,this._edgeList.size(),d);if(this.computeDepths(0,c,M)!==_)throw new Qo("depth mismatch at "+a.getCoordinate())}else if(arguments.length===3){for(var L=arguments[0],H=arguments[1],it=arguments[2],bt=L;bt<H;bt++){var Tt=this._edgeList.get(bt);Tt.setEdgeDepths(Xt.RIGHT,it),it=Tt.getDepth(Xt.LEFT)}return it}},i.prototype.mergeSymLabels=function(){for(var a=this.iterator();a.hasNext();){var c=a.next();c.getLabel().merge(c.getSym().getLabel())}},i.prototype.linkMinimalDirectedEdges=function(a){for(var c=null,d=null,_=this._SCANNING_FOR_INCOMING,M=this._resultAreaEdgeList.size()-1;M>=0;M--){var L=this._resultAreaEdgeList.get(M),H=L.getSym();switch(c===null&&L.getEdgeRing()===a&&(c=L),_){case this._SCANNING_FOR_INCOMING:if(H.getEdgeRing()!==a)continue;d=H,_=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(L.getEdgeRing()!==a)continue;d.setNextMin(L),_=this._SCANNING_FOR_INCOMING}}_===this._LINKING_TO_OUTGOING&&(Wt.isTrue(c!==null,"found null for first outgoing dirEdge"),Wt.isTrue(c.getEdgeRing()===a,"unable to link last incoming dirEdge"),d.setNextMin(c))},i.prototype.getOutgoingDegree=function(){if(arguments.length===0){for(var a=0,c=this.iterator();c.hasNext();)c.next().isInResult()&&a++;return a}if(arguments.length===1){for(var d=arguments[0],_=0,M=this.iterator();M.hasNext();)M.next().getEdgeRing()===d&&_++;return _}},i.prototype.getLabel=function(){return this._label},i.prototype.findCoveredLineEdges=function(){for(var a=K.NONE,c=this.iterator();c.hasNext();){var d=c.next(),_=d.getSym();if(!d.isLineEdge()){if(d.isInResult()){a=K.INTERIOR;break}if(_.isInResult()){a=K.EXTERIOR;break}}}if(a===K.NONE)return null;for(var M=a,L=this.iterator();L.hasNext();){var H=L.next(),it=H.getSym();H.isLineEdge()?H.getEdge().setCovered(M===K.INTERIOR):(H.isInResult()&&(M=K.EXTERIOR),it.isInResult()&&(M=K.INTERIOR))}},i.prototype.computeLabelling=function(a){r.prototype.computeLabelling.call(this,a),this._label=new On(K.NONE);for(var c=this.iterator();c.hasNext();)for(var d=c.next().getEdge().getLabel(),_=0;_<2;_++){var M=d.getLocation(_);M!==K.INTERIOR&&M!==K.BOUNDARY||this._label.setLocation(_,K.INTERIOR)}},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(ti),io=function(r){function i(){r.apply(this,arguments)}return r&&(i.__proto__=r),i.prototype=Object.create(r&&r.prototype),i.prototype.constructor=i,i.prototype.createNode=function(a){return new Kl(a,new Hh)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(yu),ts=function r(){this._pts=null,this._orientation=null;var i=arguments[0];this._pts=i,this._orientation=r.orientation(i)};ts.prototype.compareTo=function(r){var i=r;return ts.compareOriented(this._pts,this._orientation,i._pts,i._orientation)},ts.prototype.interfaces_=function(){return[V]},ts.prototype.getClass=function(){return ts},ts.orientation=function(r){return lt.increasingDirection(r)===1},ts.compareOriented=function(r,i,a,c){for(var d=i?1:-1,_=c?1:-1,M=i?r.length:-1,L=c?a.length:-1,H=i?0:r.length-1,it=c?0:a.length-1;;){var bt=r[H].compareTo(a[it]);if(bt!==0)return bt;var Tt=(H+=d)===M,Kt=(it+=_)===L;if(Tt&&!Kt)return-1;if(!Tt&&Kt)return 1;if(Tt&&Kt)return 0}};var gi=function(){this._edges=new G,this._ocaMap=new w};gi.prototype.print=function(r){r.print("MULTILINESTRING ( ");for(var i=0;i<this._edges.size();i++){var a=this._edges.get(i);i>0&&r.print(","),r.print("(");for(var c=a.getCoordinates(),d=0;d<c.length;d++)d>0&&r.print(","),r.print(c[d].x+" "+c[d].y);r.println(")")}r.print(") ")},gi.prototype.addAll=function(r){for(var i=r.iterator();i.hasNext();)this.add(i.next())},gi.prototype.findEdgeIndex=function(r){for(var i=0;i<this._edges.size();i++)if(this._edges.get(i).equals(r))return i;return-1},gi.prototype.iterator=function(){return this._edges.iterator()},gi.prototype.getEdges=function(){return this._edges},gi.prototype.get=function(r){return this._edges.get(r)},gi.prototype.findEqualEdge=function(r){var i=new ts(r.getCoordinates());return this._ocaMap.get(i)},gi.prototype.add=function(r){this._edges.add(r);var i=new ts(r.getCoordinates());this._ocaMap.put(i,r)},gi.prototype.interfaces_=function(){return[]},gi.prototype.getClass=function(){return gi};var Bs=function(){};Bs.prototype.processIntersections=function(r,i,a,c){},Bs.prototype.isDone=function(){},Bs.prototype.interfaces_=function(){return[]},Bs.prototype.getClass=function(){return Bs};var Ri=function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._hasInterior=!1,this._properIntersectionPoint=null,this._li=null,this._isSelfIntersection=null,this.numIntersections=0,this.numInteriorIntersections=0,this.numProperIntersections=0,this.numTests=0;var r=arguments[0];this._li=r};Ri.prototype.isTrivialIntersection=function(r,i,a,c){if(r===a&&this._li.getIntersectionNum()===1){if(Ri.isAdjacentSegments(i,c))return!0;if(r.isClosed()){var d=r.size()-1;if(i===0&&c===d||c===0&&i===d)return!0}}return!1},Ri.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},Ri.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},Ri.prototype.getLineIntersector=function(){return this._li},Ri.prototype.hasProperIntersection=function(){return this._hasProper},Ri.prototype.processIntersections=function(r,i,a,c){if(r===a&&i===c)return null;this.numTests++;var d=r.getCoordinates()[i],_=r.getCoordinates()[i+1],M=a.getCoordinates()[c],L=a.getCoordinates()[c+1];this._li.computeIntersection(d,_,M,L),this._li.hasIntersection()&&(this.numIntersections++,this._li.isInteriorIntersection()&&(this.numInteriorIntersections++,this._hasInterior=!0),this.isTrivialIntersection(r,i,a,c)||(this._hasIntersection=!0,r.addIntersections(this._li,i,0),a.addIntersections(this._li,c,1),this._li.isProper()&&(this.numProperIntersections++,this._hasProper=!0,this._hasProperInterior=!0)))},Ri.prototype.hasIntersection=function(){return this._hasIntersection},Ri.prototype.isDone=function(){return!1},Ri.prototype.hasInteriorIntersection=function(){return this._hasInterior},Ri.prototype.interfaces_=function(){return[Bs]},Ri.prototype.getClass=function(){return Ri},Ri.isAdjacentSegments=function(r,i){return Math.abs(r-i)===1};var Do=function(){this.coord=null,this.segmentIndex=null,this.dist=null;var r=arguments[0],i=arguments[1],a=arguments[2];this.coord=new D(r),this.segmentIndex=i,this.dist=a};Do.prototype.getSegmentIndex=function(){return this.segmentIndex},Do.prototype.getCoordinate=function(){return this.coord},Do.prototype.print=function(r){r.print(this.coord),r.print(" seg # = "+this.segmentIndex),r.println(" dist = "+this.dist)},Do.prototype.compareTo=function(r){var i=r;return this.compare(i.segmentIndex,i.dist)},Do.prototype.isEndPoint=function(r){return this.segmentIndex===0&&this.dist===0||this.segmentIndex===r},Do.prototype.toString=function(){return this.coord+" seg # = "+this.segmentIndex+" dist = "+this.dist},Do.prototype.getDistance=function(){return this.dist},Do.prototype.compare=function(r,i){return this.segmentIndex<r?-1:this.segmentIndex>r?1:this.dist<i?-1:this.dist>i?1:0},Do.prototype.interfaces_=function(){return[V]},Do.prototype.getClass=function(){return Do};var es=function(){this._nodeMap=new w,this.edge=null;var r=arguments[0];this.edge=r};es.prototype.print=function(r){r.println("Intersections:");for(var i=this.iterator();i.hasNext();)i.next().print(r)},es.prototype.iterator=function(){return this._nodeMap.values().iterator()},es.prototype.addSplitEdges=function(r){this.addEndpoints();for(var i=this.iterator(),a=i.next();i.hasNext();){var c=i.next(),d=this.createSplitEdge(a,c);r.add(d),a=c}},es.prototype.addEndpoints=function(){var r=this.edge.pts.length-1;this.add(this.edge.pts[0],0,0),this.add(this.edge.pts[r],r,0)},es.prototype.createSplitEdge=function(r,i){var a=i.segmentIndex-r.segmentIndex+2,c=this.edge.pts[i.segmentIndex],d=i.dist>0||!i.coord.equals2D(c);d||a--;var _=new Array(a).fill(null),M=0;_[M++]=new D(r.coord);for(var L=r.segmentIndex+1;L<=i.segmentIndex;L++)_[M++]=this.edge.pts[L];return d&&(_[M]=i.coord),new jl(_,new On(this.edge._label))},es.prototype.add=function(r,i,a){var c=new Do(r,i,a),d=this._nodeMap.get(c);return d!==null?d:(this._nodeMap.put(c,c),c)},es.prototype.isIntersection=function(r){for(var i=this.iterator();i.hasNext();)if(i.next().coord.equals(r))return!0;return!1},es.prototype.interfaces_=function(){return[]},es.prototype.getClass=function(){return es};var ha=function(){};ha.prototype.getChainStartIndices=function(r){var i=0,a=new G;a.add(new pt(i));do{var c=this.findChainEnd(r,i);a.add(new pt(c)),i=c}while(i<r.length-1);return ha.toIntArray(a)},ha.prototype.findChainEnd=function(r,i){for(var a=Yn.quadrant(r[i],r[i+1]),c=i+1;c<r.length&&Yn.quadrant(r[c-1],r[c])===a;)c++;return c-1},ha.prototype.interfaces_=function(){return[]},ha.prototype.getClass=function(){return ha},ha.toIntArray=function(r){for(var i=new Array(r.size()).fill(null),a=0;a<i.length;a++)i[a]=r.get(a).intValue();return i};var ws=function(){this.e=null,this.pts=null,this.startIndex=null,this.env1=new qt,this.env2=new qt;var r=arguments[0];this.e=r,this.pts=r.getCoordinates();var i=new ha;this.startIndex=i.getChainStartIndices(this.pts)};ws.prototype.getCoordinates=function(){return this.pts},ws.prototype.getMaxX=function(r){var i=this.pts[this.startIndex[r]].x,a=this.pts[this.startIndex[r+1]].x;return i>a?i:a},ws.prototype.getMinX=function(r){var i=this.pts[this.startIndex[r]].x,a=this.pts[this.startIndex[r+1]].x;return i<a?i:a},ws.prototype.computeIntersectsForChain=function(){if(arguments.length===4){var r=arguments[0],i=arguments[1],a=arguments[2],c=arguments[3];this.computeIntersectsForChain(this.startIndex[r],this.startIndex[r+1],i,i.startIndex[a],i.startIndex[a+1],c)}else if(arguments.length===6){var d=arguments[0],_=arguments[1],M=arguments[2],L=arguments[3],H=arguments[4],it=arguments[5],bt=this.pts[d],Tt=this.pts[_],Kt=M.pts[L],Qt=M.pts[H];if(_-d==1&&H-L==1)return it.addIntersections(this.e,d,M.e,L),null;if(this.env1.init(bt,Tt),this.env2.init(Kt,Qt),!this.env1.intersects(this.env2))return null;var le=Math.trunc((d+_)/2),Ee=Math.trunc((L+H)/2);d<le&&(L<Ee&&this.computeIntersectsForChain(d,le,M,L,Ee,it),Ee<H&&this.computeIntersectsForChain(d,le,M,Ee,H,it)),le<_&&(L<Ee&&this.computeIntersectsForChain(le,_,M,L,Ee,it),Ee<H&&this.computeIntersectsForChain(le,_,M,Ee,H,it))}},ws.prototype.getStartIndexes=function(){return this.startIndex},ws.prototype.computeIntersects=function(r,i){for(var a=0;a<this.startIndex.length-1;a++)for(var c=0;c<r.startIndex.length-1;c++)this.computeIntersectsForChain(a,r,c,i)},ws.prototype.interfaces_=function(){return[]},ws.prototype.getClass=function(){return ws};var Vr=function r(){this._depth=Array(2).fill().map(function(){return Array(3)});for(var i=0;i<2;i++)for(var a=0;a<3;a++)this._depth[i][a]=r.NULL_VALUE},ka={NULL_VALUE:{configurable:!0}};Vr.prototype.getDepth=function(r,i){return this._depth[r][i]},Vr.prototype.setDepth=function(r,i,a){this._depth[r][i]=a},Vr.prototype.isNull=function(){if(arguments.length===0){for(var r=0;r<2;r++)for(var i=0;i<3;i++)if(this._depth[r][i]!==Vr.NULL_VALUE)return!1;return!0}if(arguments.length===1){var a=arguments[0];return this._depth[a][1]===Vr.NULL_VALUE}if(arguments.length===2){var c=arguments[0],d=arguments[1];return this._depth[c][d]===Vr.NULL_VALUE}},Vr.prototype.normalize=function(){for(var r=0;r<2;r++)if(!this.isNull(r)){var i=this._depth[r][1];this._depth[r][2]<i&&(i=this._depth[r][2]),i<0&&(i=0);for(var a=1;a<3;a++){var c=0;this._depth[r][a]>i&&(c=1),this._depth[r][a]=c}}},Vr.prototype.getDelta=function(r){return this._depth[r][Xt.RIGHT]-this._depth[r][Xt.LEFT]},Vr.prototype.getLocation=function(r,i){return this._depth[r][i]<=0?K.EXTERIOR:K.INTERIOR},Vr.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]},Vr.prototype.add=function(){if(arguments.length===1)for(var r=arguments[0],i=0;i<2;i++)for(var a=1;a<3;a++){var c=r.getLocation(i,a);c!==K.EXTERIOR&&c!==K.INTERIOR||(this.isNull(i,a)?this._depth[i][a]=Vr.depthAtLocation(c):this._depth[i][a]+=Vr.depthAtLocation(c))}else if(arguments.length===3){var d=arguments[0],_=arguments[1];arguments[2]===K.INTERIOR&&this._depth[d][_]++}},Vr.prototype.interfaces_=function(){return[]},Vr.prototype.getClass=function(){return Vr},Vr.depthAtLocation=function(r){return r===K.EXTERIOR?0:r===K.INTERIOR?1:Vr.NULL_VALUE},ka.NULL_VALUE.get=function(){return-1},Object.defineProperties(Vr,ka);var jl=function(r){function i(){if(r.call(this),this.pts=null,this._env=null,this.eiList=new es(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new Vr,this._depthDelta=0,arguments.length===1){var a=arguments[0];i.call(this,a,null)}else if(arguments.length===2){var c=arguments[0],d=arguments[1];this.pts=c,this._label=d}}return r&&(i.__proto__=r),i.prototype=Object.create(r&&r.prototype),i.prototype.constructor=i,i.prototype.getDepth=function(){return this._depth},i.prototype.getCollapsedEdge=function(){var a=new Array(2).fill(null);return a[0]=this.pts[0],a[1]=this.pts[1],new i(a,On.toLineLabel(this._label))},i.prototype.isIsolated=function(){return this._isIsolated},i.prototype.getCoordinates=function(){return this.pts},i.prototype.setIsolated=function(a){this._isIsolated=a},i.prototype.setName=function(a){this._name=a},i.prototype.equals=function(a){if(!(a instanceof i))return!1;var c=a;if(this.pts.length!==c.pts.length)return!1;for(var d=!0,_=!0,M=this.pts.length,L=0;L<this.pts.length;L++)if(this.pts[L].equals2D(c.pts[L])||(d=!1),this.pts[L].equals2D(c.pts[--M])||(_=!1),!d&&!_)return!1;return!0},i.prototype.getCoordinate=function(){if(arguments.length===0)return this.pts.length>0?this.pts[0]:null;if(arguments.length===1){var a=arguments[0];return this.pts[a]}},i.prototype.print=function(a){a.print("edge "+this._name+": "),a.print("LINESTRING (");for(var c=0;c<this.pts.length;c++)c>0&&a.print(","),a.print(this.pts[c].x+" "+this.pts[c].y);a.print(") "+this._label+" "+this._depthDelta)},i.prototype.computeIM=function(a){i.updateIM(this._label,a)},i.prototype.isCollapsed=function(){return!!this._label.isArea()&&this.pts.length===3&&!!this.pts[0].equals(this.pts[2])},i.prototype.isClosed=function(){return this.pts[0].equals(this.pts[this.pts.length-1])},i.prototype.getMaximumSegmentIndex=function(){return this.pts.length-1},i.prototype.getDepthDelta=function(){return this._depthDelta},i.prototype.getNumPoints=function(){return this.pts.length},i.prototype.printReverse=function(a){a.print("edge "+this._name+": ");for(var c=this.pts.length-1;c>=0;c--)a.print(this.pts[c]+" ");a.println("")},i.prototype.getMonotoneChainEdge=function(){return this._mce===null&&(this._mce=new ws(this)),this._mce},i.prototype.getEnvelope=function(){if(this._env===null){this._env=new qt;for(var a=0;a<this.pts.length;a++)this._env.expandToInclude(this.pts[a])}return this._env},i.prototype.addIntersection=function(a,c,d,_){var M=new D(a.getIntersection(_)),L=c,H=a.getEdgeDistance(d,_),it=L+1;if(it<this.pts.length){var bt=this.pts[it];M.equals2D(bt)&&(L=it,H=0)}this.eiList.add(M,L,H)},i.prototype.toString=function(){var a=new Lt;a.append("edge "+this._name+": "),a.append("LINESTRING (");for(var c=0;c<this.pts.length;c++)c>0&&a.append(","),a.append(this.pts[c].x+" "+this.pts[c].y);return a.append(") "+this._label+" "+this._depthDelta),a.toString()},i.prototype.isPointwiseEqual=function(a){if(this.pts.length!==a.pts.length)return!1;for(var c=0;c<this.pts.length;c++)if(!this.pts[c].equals2D(a.pts[c]))return!1;return!0},i.prototype.setDepthDelta=function(a){this._depthDelta=a},i.prototype.getEdgeIntersectionList=function(){return this.eiList},i.prototype.addIntersections=function(a,c,d){for(var _=0;_<a.getIntersectionNum();_++)this.addIntersection(a,c,d,_)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i.updateIM=function(){if(arguments.length!==2)return r.prototype.updateIM.apply(this,arguments);var a=arguments[0],c=arguments[1];c.setAtLeastIfValid(a.getLocation(0,Xt.ON),a.getLocation(1,Xt.ON),1),a.isArea()&&(c.setAtLeastIfValid(a.getLocation(0,Xt.LEFT),a.getLocation(1,Xt.LEFT),2),c.setAtLeastIfValid(a.getLocation(0,Xt.RIGHT),a.getLocation(1,Xt.RIGHT),2))},i}(Xi),ai=function(r){this._workingPrecisionModel=null,this._workingNoder=null,this._geomFact=null,this._graph=null,this._edgeList=new gi,this._bufParams=r||null};ai.prototype.setWorkingPrecisionModel=function(r){this._workingPrecisionModel=r},ai.prototype.insertUniqueEdge=function(r){var i=this._edgeList.findEqualEdge(r);if(i!==null){var a=i.getLabel(),c=r.getLabel();i.isPointwiseEqual(r)||(c=new On(r.getLabel())).flip(),a.merge(c);var d=ai.depthDelta(c),_=i.getDepthDelta()+d;i.setDepthDelta(_)}else this._edgeList.add(r),r.setDepthDelta(ai.depthDelta(r.getLabel()))},ai.prototype.buildSubgraphs=function(r,i){for(var a=new G,c=r.iterator();c.hasNext();){var d=c.next(),_=d.getRightmostCoordinate(),M=new fa(a).getDepth(_);d.computeDepth(M),d.findResultEdges(),a.add(d),i.add(d.getDirectedEdges(),d.getNodes())}},ai.prototype.createSubgraphs=function(r){for(var i=new G,a=r.getNodes().iterator();a.hasNext();){var c=a.next();if(!c.isVisited()){var d=new Jr;d.create(c),i.add(d)}}return ho.sort(i,ho.reverseOrder()),i},ai.prototype.createEmptyResultGeometry=function(){return this._geomFact.createPolygon()},ai.prototype.getNoder=function(r){if(this._workingNoder!==null)return this._workingNoder;var i=new hl,a=new z;return a.setPrecisionModel(r),i.setSegmentIntersector(new Ri(a)),i},ai.prototype.buffer=function(r,i){var a=this._workingPrecisionModel;a===null&&(a=r.getPrecisionModel()),this._geomFact=r.getFactory();var c=new pi(a,this._bufParams),d=new Zi(r,i,c).getCurves();if(d.size()<=0)return this.createEmptyResultGeometry();this.computeNodedEdges(d,a),this._graph=new dr(new io),this._graph.addEdges(this._edgeList.getEdges());var _=this.createSubgraphs(this._graph),M=new Ci(this._geomFact);this.buildSubgraphs(_,M);var L=M.getPolygons();return L.size()<=0?this.createEmptyResultGeometry():this._geomFact.buildGeometry(L)},ai.prototype.computeNodedEdges=function(r,i){var a=this.getNoder(i);a.computeNodes(r);for(var c=a.getNodedSubstrings().iterator();c.hasNext();){var d=c.next(),_=d.getCoordinates();if(_.length!==2||!_[0].equals2D(_[1])){var M=d.getData(),L=new jl(d.getCoordinates(),new On(M));this.insertUniqueEdge(L)}}},ai.prototype.setNoder=function(r){this._workingNoder=r},ai.prototype.interfaces_=function(){return[]},ai.prototype.getClass=function(){return ai},ai.depthDelta=function(r){var i=r.getLocation(0,Xt.LEFT),a=r.getLocation(0,Xt.RIGHT);return i===K.INTERIOR&&a===K.EXTERIOR?1:i===K.EXTERIOR&&a===K.INTERIOR?-1:0},ai.convertSegStrings=function(r){for(var i=new Le,a=new G;r.hasNext();){var c=r.next(),d=i.createLineString(c.getCoordinates());a.add(d)}return i.buildGeometry(a)};var ns=function(){if(this._noder=null,this._scaleFactor=null,this._offsetX=null,this._offsetY=null,this._isScaled=!1,arguments.length===2){var r=arguments[0],i=arguments[1];this._noder=r,this._scaleFactor=i,this._offsetX=0,this._offsetY=0,this._isScaled=!this.isIntegerPrecision()}else if(arguments.length===4){var a=arguments[0],c=arguments[1],d=arguments[2],_=arguments[3];this._noder=a,this._scaleFactor=c,this._offsetX=d,this._offsetY=_,this._isScaled=!this.isIntegerPrecision()}};ns.prototype.rescale=function(){if(Q(arguments[0],at))for(var r=arguments[0].iterator();r.hasNext();){var i=r.next();this.rescale(i.getCoordinates())}else if(arguments[0]instanceof Array){for(var a=arguments[0],c=0;c<a.length;c++)a[c].x=a[c].x/this._scaleFactor+this._offsetX,a[c].y=a[c].y/this._scaleFactor+this._offsetY;a.length===2&&a[0].equals2D(a[1])&&te.out.println(a)}},ns.prototype.scale=function(){if(Q(arguments[0],at)){for(var r=arguments[0],i=new G,a=r.iterator();a.hasNext();){var c=a.next();i.add(new mr(this.scale(c.getCoordinates()),c.getData()))}return i}if(arguments[0]instanceof Array){for(var d=arguments[0],_=new Array(d.length).fill(null),M=0;M<d.length;M++)_[M]=new D(Math.round((d[M].x-this._offsetX)*this._scaleFactor),Math.round((d[M].y-this._offsetY)*this._scaleFactor),d[M].z);return lt.removeRepeatedPoints(_)}},ns.prototype.isIntegerPrecision=function(){return this._scaleFactor===1},ns.prototype.getNodedSubstrings=function(){var r=this._noder.getNodedSubstrings();return this._isScaled&&this.rescale(r),r},ns.prototype.computeNodes=function(r){var i=r;this._isScaled&&(i=this.scale(r)),this._noder.computeNodes(i)},ns.prototype.interfaces_=function(){return[Yi]},ns.prototype.getClass=function(){return ns};var mo=function(){this._li=new z,this._segStrings=null;var r=arguments[0];this._segStrings=r},zs={fact:{configurable:!0}};mo.prototype.checkEndPtVertexIntersections=function(){if(arguments.length===0)for(var r=this._segStrings.iterator();r.hasNext();){var i=r.next().getCoordinates();this.checkEndPtVertexIntersections(i[0],this._segStrings),this.checkEndPtVertexIntersections(i[i.length-1],this._segStrings)}else if(arguments.length===2){for(var a=arguments[0],c=arguments[1].iterator();c.hasNext();)for(var d=c.next().getCoordinates(),_=1;_<d.length-1;_++)if(d[_].equals(a))throw new Te("found endpt/interior pt intersection at index "+_+" :pt "+a)}},mo.prototype.checkInteriorIntersections=function(){if(arguments.length===0)for(var r=this._segStrings.iterator();r.hasNext();)for(var i=r.next(),a=this._segStrings.iterator();a.hasNext();){var c=a.next();this.checkInteriorIntersections(i,c)}else if(arguments.length===2)for(var d=arguments[0],_=arguments[1],M=d.getCoordinates(),L=_.getCoordinates(),H=0;H<M.length-1;H++)for(var it=0;it<L.length-1;it++)this.checkInteriorIntersections(d,H,_,it);else if(arguments.length===4){var bt=arguments[0],Tt=arguments[1],Kt=arguments[2],Qt=arguments[3];if(bt===Kt&&Tt===Qt)return null;var le=bt.getCoordinates()[Tt],Ee=bt.getCoordinates()[Tt+1],Dn=Kt.getCoordinates()[Qt],Jn=Kt.getCoordinates()[Qt+1];if(this._li.computeIntersection(le,Ee,Dn,Jn),this._li.hasIntersection()&&(this._li.isProper()||this.hasInteriorIntersection(this._li,le,Ee)||this.hasInteriorIntersection(this._li,Dn,Jn)))throw new Te("found non-noded intersection at "+le+"-"+Ee+" and "+Dn+"-"+Jn)}},mo.prototype.checkValid=function(){this.checkEndPtVertexIntersections(),this.checkInteriorIntersections(),this.checkCollapses()},mo.prototype.checkCollapses=function(){if(arguments.length===0)for(var r=this._segStrings.iterator();r.hasNext();){var i=r.next();this.checkCollapses(i)}else if(arguments.length===1)for(var a=arguments[0].getCoordinates(),c=0;c<a.length-2;c++)this.checkCollapse(a[c],a[c+1],a[c+2])},mo.prototype.hasInteriorIntersection=function(r,i,a){for(var c=0;c<r.getIntersectionNum();c++){var d=r.getIntersection(c);if(!d.equals(i)&&!d.equals(a))return!0}return!1},mo.prototype.checkCollapse=function(r,i,a){if(r.equals(a))throw new Te("found non-noded collapse at "+mo.fact.createLineString([r,i,a]))},mo.prototype.interfaces_=function(){return[]},mo.prototype.getClass=function(){return mo},zs.fact.get=function(){return new Le},Object.defineProperties(mo,zs);var Wr=function(){this._li=null,this._pt=null,this._originalPt=null,this._ptScaled=null,this._p0Scaled=null,this._p1Scaled=null,this._scaleFactor=null,this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,this._corner=new Array(4).fill(null),this._safeEnv=null;var r=arguments[0],i=arguments[1],a=arguments[2];if(this._originalPt=r,this._pt=r,this._scaleFactor=i,this._li=a,i<=0)throw new I("Scale factor must be non-zero");i!==1&&(this._pt=new D(this.scale(r.x),this.scale(r.y)),this._p0Scaled=new D,this._p1Scaled=new D),this.initCorners(this._pt)},Vh={SAFE_ENV_EXPANSION_FACTOR:{configurable:!0}};Wr.prototype.intersectsScaled=function(r,i){var a=Math.min(r.x,i.x),c=Math.max(r.x,i.x),d=Math.min(r.y,i.y),_=Math.max(r.y,i.y),M=this._maxx<a||this._minx>c||this._maxy<d||this._miny>_;if(M)return!1;var L=this.intersectsToleranceSquare(r,i);return Wt.isTrue(!(M&&L),"Found bad envelope test"),L},Wr.prototype.initCorners=function(r){this._minx=r.x-.5,this._maxx=r.x+.5,this._miny=r.y-.5,this._maxy=r.y+.5,this._corner[0]=new D(this._maxx,this._maxy),this._corner[1]=new D(this._minx,this._maxy),this._corner[2]=new D(this._minx,this._miny),this._corner[3]=new D(this._maxx,this._miny)},Wr.prototype.intersects=function(r,i){return this._scaleFactor===1?this.intersectsScaled(r,i):(this.copyScaled(r,this._p0Scaled),this.copyScaled(i,this._p1Scaled),this.intersectsScaled(this._p0Scaled,this._p1Scaled))},Wr.prototype.scale=function(r){return Math.round(r*this._scaleFactor)},Wr.prototype.getCoordinate=function(){return this._originalPt},Wr.prototype.copyScaled=function(r,i){i.x=this.scale(r.x),i.y=this.scale(r.y)},Wr.prototype.getSafeEnvelope=function(){if(this._safeEnv===null){var r=Wr.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new qt(this._originalPt.x-r,this._originalPt.x+r,this._originalPt.y-r,this._originalPt.y+r)}return this._safeEnv},Wr.prototype.intersectsPixelClosure=function(r,i){return this._li.computeIntersection(r,i,this._corner[0],this._corner[1]),!!this._li.hasIntersection()||(this._li.computeIntersection(r,i,this._corner[1],this._corner[2]),!!this._li.hasIntersection()||(this._li.computeIntersection(r,i,this._corner[2],this._corner[3]),!!this._li.hasIntersection()||(this._li.computeIntersection(r,i,this._corner[3],this._corner[0]),!!this._li.hasIntersection())))},Wr.prototype.intersectsToleranceSquare=function(r,i){var a=!1,c=!1;return this._li.computeIntersection(r,i,this._corner[0],this._corner[1]),!!this._li.isProper()||(this._li.computeIntersection(r,i,this._corner[1],this._corner[2]),!!this._li.isProper()||(this._li.hasIntersection()&&(a=!0),this._li.computeIntersection(r,i,this._corner[2],this._corner[3]),!!this._li.isProper()||(this._li.hasIntersection()&&(c=!0),this._li.computeIntersection(r,i,this._corner[3],this._corner[0]),!!this._li.isProper()||!(!a||!c)||!!r.equals(this._pt)||!!i.equals(this._pt))))},Wr.prototype.addSnappedNode=function(r,i){var a=r.getCoordinate(i),c=r.getCoordinate(i+1);return!!this.intersects(a,c)&&(r.addIntersection(this.getCoordinate(),i),!0)},Wr.prototype.interfaces_=function(){return[]},Wr.prototype.getClass=function(){return Wr},Vh.SAFE_ENV_EXPANSION_FACTOR.get=function(){return .75},Object.defineProperties(Wr,Vh);var pl=function(){this.tempEnv1=new qt,this.selectedSegment=new ie};pl.prototype.select=function(){if(arguments.length!==1){if(arguments.length===2){var r=arguments[0],i=arguments[1];r.getLineSegment(i,this.selectedSegment),this.select(this.selectedSegment)}}},pl.prototype.interfaces_=function(){return[]},pl.prototype.getClass=function(){return pl};var xu=function(){this._index=null;var r=arguments[0];this._index=r},qa={HotPixelSnapAction:{configurable:!0}};xu.prototype.snap=function(){if(arguments.length===1){var r=arguments[0];return this.snap(r,null,-1)}if(arguments.length===3){var i=arguments[0],a=arguments[1],c=arguments[2],d=i.getSafeEnvelope(),_=new Fo(i,a,c);return this._index.query(d,{interfaces_:function(){return[Us]},visitItem:function(M){M.select(d,_)}}),_.isNodeAdded()}},xu.prototype.interfaces_=function(){return[]},xu.prototype.getClass=function(){return xu},qa.HotPixelSnapAction.get=function(){return Fo},Object.defineProperties(xu,qa);var Fo=function(r){function i(){r.call(this),this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var a=arguments[0],c=arguments[1],d=arguments[2];this._hotPixel=a,this._parentEdge=c,this._hotPixelVertexIndex=d}return r&&(i.__proto__=r),i.prototype=Object.create(r&&r.prototype),i.prototype.constructor=i,i.prototype.isNodeAdded=function(){return this._isNodeAdded},i.prototype.select=function(){if(arguments.length!==2)return r.prototype.select.apply(this,arguments);var a=arguments[0],c=arguments[1],d=a.getContext();if(this._parentEdge!==null&&d===this._parentEdge&&c===this._hotPixelVertexIndex)return null;this._isNodeAdded=this._hotPixel.addSnappedNode(d,c)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(pl),pa=function(){this._li=null,this._interiorIntersections=null;var r=arguments[0];this._li=r,this._interiorIntersections=new G};pa.prototype.processIntersections=function(r,i,a,c){if(r===a&&i===c)return null;var d=r.getCoordinates()[i],_=r.getCoordinates()[i+1],M=a.getCoordinates()[c],L=a.getCoordinates()[c+1];if(this._li.computeIntersection(d,_,M,L),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var H=0;H<this._li.getIntersectionNum();H++)this._interiorIntersections.add(this._li.getIntersection(H));r.addIntersections(this._li,i,0),a.addIntersections(this._li,c,1)}},pa.prototype.isDone=function(){return!1},pa.prototype.getInteriorIntersections=function(){return this._interiorIntersections},pa.prototype.interfaces_=function(){return[Bs]},pa.prototype.getClass=function(){return pa};var rs=function(){this._pm=null,this._li=null,this._scaleFactor=null,this._noder=null,this._pointSnapper=null,this._nodedSegStrings=null;var r=arguments[0];this._pm=r,this._li=new z,this._li.setPrecisionModel(r),this._scaleFactor=r.getScale()};rs.prototype.checkCorrectness=function(r){var i=mr.getNodedSubstrings(r),a=new mo(i);try{a.checkValid()}catch(c){if(!(c instanceof jt))throw c;c.printStackTrace()}},rs.prototype.getNodedSubstrings=function(){return mr.getNodedSubstrings(this._nodedSegStrings)},rs.prototype.snapRound=function(r,i){var a=this.findInteriorIntersections(r,i);this.computeIntersectionSnaps(a),this.computeVertexSnaps(r)},rs.prototype.findInteriorIntersections=function(r,i){var a=new pa(i);return this._noder.setSegmentIntersector(a),this._noder.computeNodes(r),a.getInteriorIntersections()},rs.prototype.computeVertexSnaps=function(){if(Q(arguments[0],at))for(var r=arguments[0].iterator();r.hasNext();){var i=r.next();this.computeVertexSnaps(i)}else if(arguments[0]instanceof mr)for(var a=arguments[0],c=a.getCoordinates(),d=0;d<c.length;d++){var _=new Wr(c[d],this._scaleFactor,this._li);this._pointSnapper.snap(_,a,d)&&a.addIntersection(c[d],d)}},rs.prototype.computeNodes=function(r){this._nodedSegStrings=r,this._noder=new hl,this._pointSnapper=new xu(this._noder.getIndex()),this.snapRound(r,this._li)},rs.prototype.computeIntersectionSnaps=function(r){for(var i=r.iterator();i.hasNext();){var a=i.next(),c=new Wr(a,this._scaleFactor,this._li);this._pointSnapper.snap(c)}},rs.prototype.interfaces_=function(){return[Yi]},rs.prototype.getClass=function(){return rs};var Xr=function(){if(this._argGeom=null,this._distance=null,this._bufParams=new Ge,this._resultGeometry=null,this._saveException=null,arguments.length===1){var r=arguments[0];this._argGeom=r}else if(arguments.length===2){var i=arguments[0],a=arguments[1];this._argGeom=i,this._bufParams=a}},Eu={CAP_ROUND:{configurable:!0},CAP_BUTT:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},MAX_PRECISION_DIGITS:{configurable:!0}};Xr.prototype.bufferFixedPrecision=function(r){var i=new ns(new rs(new ze(1)),r.getScale()),a=new ai(this._bufParams);a.setWorkingPrecisionModel(r),a.setNoder(i),this._resultGeometry=a.buffer(this._argGeom,this._distance)},Xr.prototype.bufferReducedPrecision=function(){var r=this;if(arguments.length===0){for(var i=Xr.MAX_PRECISION_DIGITS;i>=0;i--){try{r.bufferReducedPrecision(i)}catch(_){if(!(_ instanceof Qo))throw _;r._saveException=_}if(r._resultGeometry!==null)return null}throw this._saveException}if(arguments.length===1){var a=arguments[0],c=Xr.precisionScaleFactor(this._argGeom,this._distance,a),d=new ze(c);this.bufferFixedPrecision(d)}},Xr.prototype.computeGeometry=function(){if(this.bufferOriginalPrecision(),this._resultGeometry!==null)return null;var r=this._argGeom.getFactory().getPrecisionModel();r.getType()===ze.FIXED?this.bufferFixedPrecision(r):this.bufferReducedPrecision()},Xr.prototype.setQuadrantSegments=function(r){this._bufParams.setQuadrantSegments(r)},Xr.prototype.bufferOriginalPrecision=function(){try{var r=new ai(this._bufParams);this._resultGeometry=r.buffer(this._argGeom,this._distance)}catch(i){if(!(i instanceof Te))throw i;this._saveException=i}},Xr.prototype.getResultGeometry=function(r){return this._distance=r,this.computeGeometry(),this._resultGeometry},Xr.prototype.setEndCapStyle=function(r){this._bufParams.setEndCapStyle(r)},Xr.prototype.interfaces_=function(){return[]},Xr.prototype.getClass=function(){return Xr},Xr.bufferOp=function(){if(arguments.length===2){var r=arguments[0],i=arguments[1];return new Xr(r).getResultGeometry(i)}if(arguments.length===3){if(Number.isInteger(arguments[2])&&arguments[0]instanceof Vt&&typeof arguments[1]=="number"){var a=arguments[0],c=arguments[1],d=arguments[2],_=new Xr(a);return _.setQuadrantSegments(d),_.getResultGeometry(c)}if(arguments[2]instanceof Ge&&arguments[0]instanceof Vt&&typeof arguments[1]=="number"){var M=arguments[0],L=arguments[1],H=arguments[2];return new Xr(M,H).getResultGeometry(L)}}else if(arguments.length===4){var it=arguments[0],bt=arguments[1],Tt=arguments[2],Kt=arguments[3],Qt=new Xr(it);return Qt.setQuadrantSegments(Tt),Qt.setEndCapStyle(Kt),Qt.getResultGeometry(bt)}},Xr.precisionScaleFactor=function(r,i,a){var c=r.getEnvelopeInternal(),d=At.max(Math.abs(c.getMaxX()),Math.abs(c.getMaxY()),Math.abs(c.getMinX()),Math.abs(c.getMinY()))+2*(i>0?i:0),_=a-Math.trunc(Math.log(d)/Math.log(10)+1);return Math.pow(10,_)},Eu.CAP_ROUND.get=function(){return Ge.CAP_ROUND},Eu.CAP_BUTT.get=function(){return Ge.CAP_FLAT},Eu.CAP_FLAT.get=function(){return Ge.CAP_FLAT},Eu.CAP_SQUARE.get=function(){return Ge.CAP_SQUARE},Eu.MAX_PRECISION_DIGITS.get=function(){return 12},Object.defineProperties(Xr,Eu);var ui=function(){this._pt=[new D,new D],this._distance=A.NaN,this._isNull=!0};ui.prototype.getCoordinates=function(){return this._pt},ui.prototype.getCoordinate=function(r){return this._pt[r]},ui.prototype.setMinimum=function(){if(arguments.length===1){var r=arguments[0];this.setMinimum(r._pt[0],r._pt[1])}else if(arguments.length===2){var i=arguments[0],a=arguments[1];if(this._isNull)return this.initialize(i,a),null;var c=i.distance(a);c<this._distance&&this.initialize(i,a,c)}},ui.prototype.initialize=function(){if(arguments.length===0)this._isNull=!0;else if(arguments.length===2){var r=arguments[0],i=arguments[1];this._pt[0].setCoordinate(r),this._pt[1].setCoordinate(i),this._distance=r.distance(i),this._isNull=!1}else if(arguments.length===3){var a=arguments[0],c=arguments[1],d=arguments[2];this._pt[0].setCoordinate(a),this._pt[1].setCoordinate(c),this._distance=d,this._isNull=!1}},ui.prototype.getDistance=function(){return this._distance},ui.prototype.setMaximum=function(){if(arguments.length===1){var r=arguments[0];this.setMaximum(r._pt[0],r._pt[1])}else if(arguments.length===2){var i=arguments[0],a=arguments[1];if(this._isNull)return this.initialize(i,a),null;var c=i.distance(a);c>this._distance&&this.initialize(i,a,c)}},ui.prototype.interfaces_=function(){return[]},ui.prototype.getClass=function(){return ui};var is=function(){};is.prototype.interfaces_=function(){return[]},is.prototype.getClass=function(){return is},is.computeDistance=function(){if(arguments[2]instanceof ui&&arguments[0]instanceof vt&&arguments[1]instanceof D)for(var r=arguments[0],i=arguments[1],a=arguments[2],c=r.getCoordinates(),d=new ie,_=0;_<c.length-1;_++){d.setCoordinates(c[_],c[_+1]);var M=d.closestPoint(i);a.setMinimum(M,i)}else if(arguments[2]instanceof ui&&arguments[0]instanceof de&&arguments[1]instanceof D){var L=arguments[0],H=arguments[1],it=arguments[2];is.computeDistance(L.getExteriorRing(),H,it);for(var bt=0;bt<L.getNumInteriorRing();bt++)is.computeDistance(L.getInteriorRingN(bt),H,it)}else if(arguments[2]instanceof ui&&arguments[0]instanceof Vt&&arguments[1]instanceof D){var Tt=arguments[0],Kt=arguments[1],Qt=arguments[2];if(Tt instanceof vt)is.computeDistance(Tt,Kt,Qt);else if(Tt instanceof de)is.computeDistance(Tt,Kt,Qt);else if(Tt instanceof Qn)for(var le=Tt,Ee=0;Ee<le.getNumGeometries();Ee++){var Dn=le.getGeometryN(Ee);is.computeDistance(Dn,Kt,Qt)}else Qt.setMinimum(Tt.getCoordinate(),Kt)}else if(arguments[2]instanceof ui&&arguments[0]instanceof ie&&arguments[1]instanceof D){var Jn=arguments[0],fi=arguments[1],as=arguments[2],qs=Jn.closestPoint(fi);as.setMinimum(qs,fi)}};var Ki=function(r){this._maxPtDist=new ui,this._inputGeom=r||null},gt={MaxPointDistanceFilter:{configurable:!0},MaxMidpointDistanceFilter:{configurable:!0}};Ki.prototype.computeMaxMidpointDistance=function(r){var i=new Ct(this._inputGeom);r.apply(i),this._maxPtDist.setMaximum(i.getMaxPointDistance())},Ki.prototype.computeMaxVertexDistance=function(r){var i=new Nt(this._inputGeom);r.apply(i),this._maxPtDist.setMaximum(i.getMaxPointDistance())},Ki.prototype.findDistance=function(r){return this.computeMaxVertexDistance(r),this.computeMaxMidpointDistance(r),this._maxPtDist.getDistance()},Ki.prototype.getDistancePoints=function(){return this._maxPtDist},Ki.prototype.interfaces_=function(){return[]},Ki.prototype.getClass=function(){return Ki},gt.MaxPointDistanceFilter.get=function(){return Nt},gt.MaxMidpointDistanceFilter.get=function(){return Ct},Object.defineProperties(Ki,gt);var Nt=function(r){this._maxPtDist=new ui,this._minPtDist=new ui,this._geom=r||null};Nt.prototype.filter=function(r){this._minPtDist.initialize(),is.computeDistance(this._geom,r,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},Nt.prototype.getMaxPointDistance=function(){return this._maxPtDist},Nt.prototype.interfaces_=function(){return[rt]},Nt.prototype.getClass=function(){return Nt};var Ct=function(r){this._maxPtDist=new ui,this._minPtDist=new ui,this._geom=r||null};Ct.prototype.filter=function(r,i){if(i===0)return null;var a=r.getCoordinate(i-1),c=r.getCoordinate(i),d=new D((a.x+c.x)/2,(a.y+c.y)/2);this._minPtDist.initialize(),is.computeDistance(this._geom,d,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},Ct.prototype.isDone=function(){return!1},Ct.prototype.isGeometryChanged=function(){return!1},Ct.prototype.getMaxPointDistance=function(){return this._maxPtDist},Ct.prototype.interfaces_=function(){return[ur]},Ct.prototype.getClass=function(){return Ct};var se=function(r){this._comps=r||null};se.prototype.filter=function(r){r instanceof de&&this._comps.add(r)},se.prototype.interfaces_=function(){return[pr]},se.prototype.getClass=function(){return se},se.getPolygons=function(){if(arguments.length===1){var r=arguments[0];return se.getPolygons(r,new G)}if(arguments.length===2){var i=arguments[0],a=arguments[1];return i instanceof de?a.add(i):i instanceof Qn&&i.apply(new se(a)),a}};var _e=function(){if(this._lines=null,this._isForcedToLineString=!1,arguments.length===1){var r=arguments[0];this._lines=r}else if(arguments.length===2){var i=arguments[0],a=arguments[1];this._lines=i,this._isForcedToLineString=a}};_e.prototype.filter=function(r){if(this._isForcedToLineString&&r instanceof Ae){var i=r.getFactory().createLineString(r.getCoordinateSequence());return this._lines.add(i),null}r instanceof vt&&this._lines.add(r)},_e.prototype.setForceToLineString=function(r){this._isForcedToLineString=r},_e.prototype.interfaces_=function(){return[Ce]},_e.prototype.getClass=function(){return _e},_e.getGeometry=function(){if(arguments.length===1){var r=arguments[0];return r.getFactory().buildGeometry(_e.getLines(r))}if(arguments.length===2){var i=arguments[0],a=arguments[1];return i.getFactory().buildGeometry(_e.getLines(i,a))}},_e.getLines=function(){if(arguments.length===1){var r=arguments[0];return _e.getLines(r,!1)}if(arguments.length===2){if(Q(arguments[0],at)&&Q(arguments[1],at)){for(var i=arguments[0],a=arguments[1],c=i.iterator();c.hasNext();){var d=c.next();_e.getLines(d,a)}return a}if(arguments[0]instanceof Vt&&typeof arguments[1]=="boolean"){var _=arguments[0],M=arguments[1],L=new G;return _.apply(new _e(L,M)),L}if(arguments[0]instanceof Vt&&Q(arguments[1],at)){var H=arguments[0],it=arguments[1];return H instanceof vt?it.add(H):H.apply(new _e(it)),it}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&Q(arguments[0],at)&&Q(arguments[1],at)){for(var bt=arguments[0],Tt=arguments[1],Kt=arguments[2],Qt=bt.iterator();Qt.hasNext();){var le=Qt.next();_e.getLines(le,Tt,Kt)}return Tt}if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Vt&&Q(arguments[1],at)){var Ee=arguments[0],Dn=arguments[1],Jn=arguments[2];return Ee.apply(new _e(Dn,Jn)),Dn}}};var ke=function(){if(this._boundaryRule=P.OGC_SFS_BOUNDARY_RULE,this._isIn=null,this._numBoundaries=null,arguments.length!==0){if(arguments.length===1){var r=arguments[0];if(r===null)throw new I("Rule must be non-null");this._boundaryRule=r}}};ke.prototype.locateInternal=function(){if(arguments[0]instanceof D&&arguments[1]instanceof de){var r=arguments[0],i=arguments[1];if(i.isEmpty())return K.EXTERIOR;var a=i.getExteriorRing(),c=this.locateInPolygonRing(r,a);if(c===K.EXTERIOR)return K.EXTERIOR;if(c===K.BOUNDARY)return K.BOUNDARY;for(var d=0;d<i.getNumInteriorRing();d++){var _=i.getInteriorRingN(d),M=this.locateInPolygonRing(r,_);if(M===K.INTERIOR)return K.EXTERIOR;if(M===K.BOUNDARY)return K.BOUNDARY}return K.INTERIOR}if(arguments[0]instanceof D&&arguments[1]instanceof vt){var L=arguments[0],H=arguments[1];if(!H.getEnvelopeInternal().intersects(L))return K.EXTERIOR;var it=H.getCoordinates();return H.isClosed()||!L.equals(it[0])&&!L.equals(it[it.length-1])?dt.isOnLine(L,it)?K.INTERIOR:K.EXTERIOR:K.BOUNDARY}if(arguments[0]instanceof D&&arguments[1]instanceof ue){var bt=arguments[0];return arguments[1].getCoordinate().equals2D(bt)?K.INTERIOR:K.EXTERIOR}},ke.prototype.locateInPolygonRing=function(r,i){return i.getEnvelopeInternal().intersects(r)?dt.locatePointInRing(r,i.getCoordinates()):K.EXTERIOR},ke.prototype.intersects=function(r,i){return this.locate(r,i)!==K.EXTERIOR},ke.prototype.updateLocationInfo=function(r){r===K.INTERIOR&&(this._isIn=!0),r===K.BOUNDARY&&this._numBoundaries++},ke.prototype.computeLocation=function(r,i){if(i instanceof ue&&this.updateLocationInfo(this.locateInternal(r,i)),i instanceof vt)this.updateLocationInfo(this.locateInternal(r,i));else if(i instanceof de)this.updateLocationInfo(this.locateInternal(r,i));else if(i instanceof bi)for(var a=i,c=0;c<a.getNumGeometries();c++){var d=a.getGeometryN(c);this.updateLocationInfo(this.locateInternal(r,d))}else if(i instanceof Pe)for(var _=i,M=0;M<_.getNumGeometries();M++){var L=_.getGeometryN(M);this.updateLocationInfo(this.locateInternal(r,L))}else if(i instanceof Qn)for(var H=new go(i);H.hasNext();){var it=H.next();it!==i&&this.computeLocation(r,it)}},ke.prototype.locate=function(r,i){return i.isEmpty()?K.EXTERIOR:i instanceof vt?this.locateInternal(r,i):i instanceof de?this.locateInternal(r,i):(this._isIn=!1,this._numBoundaries=0,this.computeLocation(r,i),this._boundaryRule.isInBoundary(this._numBoundaries)?K.BOUNDARY:this._numBoundaries>0||this._isIn?K.INTERIOR:K.EXTERIOR)},ke.prototype.interfaces_=function(){return[]},ke.prototype.getClass=function(){return ke};var ln=function r(){if(this._component=null,this._segIndex=null,this._pt=null,arguments.length===2){var i=arguments[0],a=arguments[1];r.call(this,i,r.INSIDE_AREA,a)}else if(arguments.length===3){var c=arguments[0],d=arguments[1],_=arguments[2];this._component=c,this._segIndex=d,this._pt=_}},cr={INSIDE_AREA:{configurable:!0}};ln.prototype.isInsideArea=function(){return this._segIndex===ln.INSIDE_AREA},ln.prototype.getCoordinate=function(){return this._pt},ln.prototype.getGeometryComponent=function(){return this._component},ln.prototype.getSegmentIndex=function(){return this._segIndex},ln.prototype.interfaces_=function(){return[]},ln.prototype.getClass=function(){return ln},cr.INSIDE_AREA.get=function(){return-1},Object.defineProperties(ln,cr);var os=function(r){this._pts=r||null};os.prototype.filter=function(r){r instanceof ue&&this._pts.add(r)},os.prototype.interfaces_=function(){return[pr]},os.prototype.getClass=function(){return os},os.getPoints=function(){if(arguments.length===1){var r=arguments[0];return r instanceof ue?ho.singletonList(r):os.getPoints(r,new G)}if(arguments.length===2){var i=arguments[0],a=arguments[1];return i instanceof ue?a.add(i):i instanceof Qn&&i.apply(new os(a)),a}};var Ha=function(){this._locations=null;var r=arguments[0];this._locations=r};Ha.prototype.filter=function(r){(r instanceof ue||r instanceof vt||r instanceof de)&&this._locations.add(new ln(r,0,r.getCoordinate()))},Ha.prototype.interfaces_=function(){return[pr]},Ha.prototype.getClass=function(){return Ha},Ha.getLocations=function(r){var i=new G;return r.apply(new Ha(i)),i};var tr=function(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new ke,this._minDistanceLocation=null,this._minDistance=A.MAX_VALUE,arguments.length===2){var r=arguments[0],i=arguments[1];this._geom=[r,i],this._terminateDistance=0}else if(arguments.length===3){var a=arguments[0],c=arguments[1],d=arguments[2];this._geom=new Array(2).fill(null),this._geom[0]=a,this._geom[1]=c,this._terminateDistance=d}};tr.prototype.computeContainmentDistance=function(){if(arguments.length===0){var r=new Array(2).fill(null);if(this.computeContainmentDistance(0,r),this._minDistance<=this._terminateDistance)return null;this.computeContainmentDistance(1,r)}else if(arguments.length===2){var i=arguments[0],a=arguments[1],c=1-i,d=se.getPolygons(this._geom[i]);if(d.size()>0){var _=Ha.getLocations(this._geom[c]);if(this.computeContainmentDistance(_,d,a),this._minDistance<=this._terminateDistance)return this._minDistanceLocation[c]=a[0],this._minDistanceLocation[i]=a[1],null}}else if(arguments.length===3){if(arguments[2]instanceof Array&&Q(arguments[0],Et)&&Q(arguments[1],Et)){for(var M=arguments[0],L=arguments[1],H=arguments[2],it=0;it<M.size();it++)for(var bt=M.get(it),Tt=0;Tt<L.size();Tt++)if(this.computeContainmentDistance(bt,L.get(Tt),H),this._minDistance<=this._terminateDistance)return null}else if(arguments[2]instanceof Array&&arguments[0]instanceof ln&&arguments[1]instanceof de){var Kt=arguments[0],Qt=arguments[1],le=arguments[2],Ee=Kt.getCoordinate();if(K.EXTERIOR!==this._ptLocator.locate(Ee,Qt))return this._minDistance=0,le[0]=Kt,le[1]=new ln(Qt,Ee),null}}},tr.prototype.computeMinDistanceLinesPoints=function(r,i,a){for(var c=0;c<r.size();c++)for(var d=r.get(c),_=0;_<i.size();_++){var M=i.get(_);if(this.computeMinDistance(d,M,a),this._minDistance<=this._terminateDistance)return null}},tr.prototype.computeFacetDistance=function(){var r=new Array(2).fill(null),i=_e.getLines(this._geom[0]),a=_e.getLines(this._geom[1]),c=os.getPoints(this._geom[0]),d=os.getPoints(this._geom[1]);return this.computeMinDistanceLines(i,a,r),this.updateMinDistance(r,!1),this._minDistance<=this._terminateDistance?null:(r[0]=null,r[1]=null,this.computeMinDistanceLinesPoints(i,d,r),this.updateMinDistance(r,!1),this._minDistance<=this._terminateDistance?null:(r[0]=null,r[1]=null,this.computeMinDistanceLinesPoints(a,c,r),this.updateMinDistance(r,!0),this._minDistance<=this._terminateDistance?null:(r[0]=null,r[1]=null,this.computeMinDistancePoints(c,d,r),void this.updateMinDistance(r,!1))))},tr.prototype.nearestLocations=function(){return this.computeMinDistance(),this._minDistanceLocation},tr.prototype.updateMinDistance=function(r,i){if(r[0]===null)return null;i?(this._minDistanceLocation[0]=r[1],this._minDistanceLocation[1]=r[0]):(this._minDistanceLocation[0]=r[0],this._minDistanceLocation[1]=r[1])},tr.prototype.nearestPoints=function(){return this.computeMinDistance(),[this._minDistanceLocation[0].getCoordinate(),this._minDistanceLocation[1].getCoordinate()]},tr.prototype.computeMinDistance=function(){if(arguments.length===0){if(this._minDistanceLocation!==null||(this._minDistanceLocation=new Array(2).fill(null),this.computeContainmentDistance(),this._minDistance<=this._terminateDistance))return null;this.computeFacetDistance()}else if(arguments.length===3){if(arguments[2]instanceof Array&&arguments[0]instanceof vt&&arguments[1]instanceof ue){var r=arguments[0],i=arguments[1],a=arguments[2];if(r.getEnvelopeInternal().distance(i.getEnvelopeInternal())>this._minDistance)return null;for(var c=r.getCoordinates(),d=i.getCoordinate(),_=0;_<c.length-1;_++){var M=dt.distancePointLine(d,c[_],c[_+1]);if(M<this._minDistance){this._minDistance=M;var L=new ie(c[_],c[_+1]).closestPoint(d);a[0]=new ln(r,_,L),a[1]=new ln(i,0,d)}if(this._minDistance<=this._terminateDistance)return null}}else if(arguments[2]instanceof Array&&arguments[0]instanceof vt&&arguments[1]instanceof vt){var H=arguments[0],it=arguments[1],bt=arguments[2];if(H.getEnvelopeInternal().distance(it.getEnvelopeInternal())>this._minDistance)return null;for(var Tt=H.getCoordinates(),Kt=it.getCoordinates(),Qt=0;Qt<Tt.length-1;Qt++)for(var le=0;le<Kt.length-1;le++){var Ee=dt.distanceLineLine(Tt[Qt],Tt[Qt+1],Kt[le],Kt[le+1]);if(Ee<this._minDistance){this._minDistance=Ee;var Dn=new ie(Tt[Qt],Tt[Qt+1]),Jn=new ie(Kt[le],Kt[le+1]),fi=Dn.closestPoints(Jn);bt[0]=new ln(H,Qt,fi[0]),bt[1]=new ln(it,le,fi[1])}if(this._minDistance<=this._terminateDistance)return null}}}},tr.prototype.computeMinDistancePoints=function(r,i,a){for(var c=0;c<r.size();c++)for(var d=r.get(c),_=0;_<i.size();_++){var M=i.get(_),L=d.getCoordinate().distance(M.getCoordinate());if(L<this._minDistance&&(this._minDistance=L,a[0]=new ln(d,0,d.getCoordinate()),a[1]=new ln(M,0,M.getCoordinate())),this._minDistance<=this._terminateDistance)return null}},tr.prototype.distance=function(){if(this._geom[0]===null||this._geom[1]===null)throw new I("null geometries are not supported");return this._geom[0].isEmpty()||this._geom[1].isEmpty()?0:(this.computeMinDistance(),this._minDistance)},tr.prototype.computeMinDistanceLines=function(r,i,a){for(var c=0;c<r.size();c++)for(var d=r.get(c),_=0;_<i.size();_++){var M=i.get(_);if(this.computeMinDistance(d,M,a),this._minDistance<=this._terminateDistance)return null}},tr.prototype.interfaces_=function(){return[]},tr.prototype.getClass=function(){return tr},tr.distance=function(r,i){return new tr(r,i).distance()},tr.isWithinDistance=function(r,i,a){return new tr(r,i,a).distance()<=a},tr.nearestPoints=function(r,i){return new tr(r,i).nearestPoints()};var Nr=function(){this._pt=[new D,new D],this._distance=A.NaN,this._isNull=!0};Nr.prototype.getCoordinates=function(){return this._pt},Nr.prototype.getCoordinate=function(r){return this._pt[r]},Nr.prototype.setMinimum=function(){if(arguments.length===1){var r=arguments[0];this.setMinimum(r._pt[0],r._pt[1])}else if(arguments.length===2){var i=arguments[0],a=arguments[1];if(this._isNull)return this.initialize(i,a),null;var c=i.distance(a);c<this._distance&&this.initialize(i,a,c)}},Nr.prototype.initialize=function(){if(arguments.length===0)this._isNull=!0;else if(arguments.length===2){var r=arguments[0],i=arguments[1];this._pt[0].setCoordinate(r),this._pt[1].setCoordinate(i),this._distance=r.distance(i),this._isNull=!1}else if(arguments.length===3){var a=arguments[0],c=arguments[1],d=arguments[2];this._pt[0].setCoordinate(a),this._pt[1].setCoordinate(c),this._distance=d,this._isNull=!1}},Nr.prototype.toString=function(){return fe.toLineString(this._pt[0],this._pt[1])},Nr.prototype.getDistance=function(){return this._distance},Nr.prototype.setMaximum=function(){if(arguments.length===1){var r=arguments[0];this.setMaximum(r._pt[0],r._pt[1])}else if(arguments.length===2){var i=arguments[0],a=arguments[1];if(this._isNull)return this.initialize(i,a),null;var c=i.distance(a);c>this._distance&&this.initialize(i,a,c)}},Nr.prototype.interfaces_=function(){return[]},Nr.prototype.getClass=function(){return Nr};var Uo=function(){};Uo.prototype.interfaces_=function(){return[]},Uo.prototype.getClass=function(){return Uo},Uo.computeDistance=function(){if(arguments[2]instanceof Nr&&arguments[0]instanceof vt&&arguments[1]instanceof D)for(var r=arguments[0],i=arguments[1],a=arguments[2],c=new ie,d=r.getCoordinates(),_=0;_<d.length-1;_++){c.setCoordinates(d[_],d[_+1]);var M=c.closestPoint(i);a.setMinimum(M,i)}else if(arguments[2]instanceof Nr&&arguments[0]instanceof de&&arguments[1]instanceof D){var L=arguments[0],H=arguments[1],it=arguments[2];Uo.computeDistance(L.getExteriorRing(),H,it);for(var bt=0;bt<L.getNumInteriorRing();bt++)Uo.computeDistance(L.getInteriorRingN(bt),H,it)}else if(arguments[2]instanceof Nr&&arguments[0]instanceof Vt&&arguments[1]instanceof D){var Tt=arguments[0],Kt=arguments[1],Qt=arguments[2];if(Tt instanceof vt)Uo.computeDistance(Tt,Kt,Qt);else if(Tt instanceof de)Uo.computeDistance(Tt,Kt,Qt);else if(Tt instanceof Qn)for(var le=Tt,Ee=0;Ee<le.getNumGeometries();Ee++){var Dn=le.getGeometryN(Ee);Uo.computeDistance(Dn,Kt,Qt)}else Qt.setMinimum(Tt.getCoordinate(),Kt)}else if(arguments[2]instanceof Nr&&arguments[0]instanceof ie&&arguments[1]instanceof D){var Jn=arguments[0],fi=arguments[1],as=arguments[2],qs=Jn.closestPoint(fi);as.setMinimum(qs,fi)}};var ei=function(){this._g0=null,this._g1=null,this._ptDist=new Nr,this._densifyFrac=0;var r=arguments[0],i=arguments[1];this._g0=r,this._g1=i},wu={MaxPointDistanceFilter:{configurable:!0},MaxDensifiedByFractionDistanceFilter:{configurable:!0}};ei.prototype.getCoordinates=function(){return this._ptDist.getCoordinates()},ei.prototype.setDensifyFraction=function(r){if(r>1||r<=0)throw new I("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=r},ei.prototype.compute=function(r,i){this.computeOrientedDistance(r,i,this._ptDist),this.computeOrientedDistance(i,r,this._ptDist)},ei.prototype.distance=function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()},ei.prototype.computeOrientedDistance=function(r,i,a){var c=new Ss(i);if(r.apply(c),a.setMaximum(c.getMaxPointDistance()),this._densifyFrac>0){var d=new sn(i,this._densifyFrac);r.apply(d),a.setMaximum(d.getMaxPointDistance())}},ei.prototype.orientedDistance=function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()},ei.prototype.interfaces_=function(){return[]},ei.prototype.getClass=function(){return ei},ei.distance=function(){if(arguments.length===2){var r=arguments[0],i=arguments[1];return new ei(r,i).distance()}if(arguments.length===3){var a=arguments[0],c=arguments[1],d=arguments[2],_=new ei(a,c);return _.setDensifyFraction(d),_.distance()}},wu.MaxPointDistanceFilter.get=function(){return Ss},wu.MaxDensifiedByFractionDistanceFilter.get=function(){return sn},Object.defineProperties(ei,wu);var Ss=function(){this._maxPtDist=new Nr,this._minPtDist=new Nr,this._euclideanDist=new Uo,this._geom=null;var r=arguments[0];this._geom=r};Ss.prototype.filter=function(r){this._minPtDist.initialize(),Uo.computeDistance(this._geom,r,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},Ss.prototype.getMaxPointDistance=function(){return this._maxPtDist},Ss.prototype.interfaces_=function(){return[rt]},Ss.prototype.getClass=function(){return Ss};var sn=function(){this._maxPtDist=new Nr,this._minPtDist=new Nr,this._geom=null,this._numSubSegs=0;var r=arguments[0],i=arguments[1];this._geom=r,this._numSubSegs=Math.trunc(Math.round(1/i))};sn.prototype.filter=function(r,i){if(i===0)return null;for(var a=r.getCoordinate(i-1),c=r.getCoordinate(i),d=(c.x-a.x)/this._numSubSegs,_=(c.y-a.y)/this._numSubSegs,M=0;M<this._numSubSegs;M++){var L=a.x+M*d,H=a.y+M*_,it=new D(L,H);this._minPtDist.initialize(),Uo.computeDistance(this._geom,it,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)}},sn.prototype.isDone=function(){return!1},sn.prototype.isGeometryChanged=function(){return!1},sn.prototype.getMaxPointDistance=function(){return this._maxPtDist},sn.prototype.interfaces_=function(){return[ur]},sn.prototype.getClass=function(){return sn};var Li=function(r,i,a){this._minValidDistance=null,this._maxValidDistance=null,this._minDistanceFound=null,this._maxDistanceFound=null,this._isValid=!0,this._errMsg=null,this._errorLocation=null,this._errorIndicator=null,this._input=r||null,this._bufDistance=i||null,this._result=a||null},Ql={VERBOSE:{configurable:!0},MAX_DISTANCE_DIFF_FRAC:{configurable:!0}};Li.prototype.checkMaximumDistance=function(r,i,a){var c=new ei(i,r);if(c.setDensifyFraction(.25),this._maxDistanceFound=c.orientedDistance(),this._maxDistanceFound>a){this._isValid=!1;var d=c.getCoordinates();this._errorLocation=d[1],this._errorIndicator=r.getFactory().createLineString(d),this._errMsg="Distance between buffer curve and input is too large ("+this._maxDistanceFound+" at "+fe.toLineString(d[0],d[1])+")"}},Li.prototype.isValid=function(){var r=Math.abs(this._bufDistance),i=Li.MAX_DISTANCE_DIFF_FRAC*r;return this._minValidDistance=r-i,this._maxValidDistance=r+i,!(!this._input.isEmpty()&&!this._result.isEmpty())||(this._bufDistance>0?this.checkPositiveValid():this.checkNegativeValid(),Li.VERBOSE&&te.out.println("Min Dist= "+this._minDistanceFound+" err= "+(1-this._minDistanceFound/this._bufDistance)+" Max Dist= "+this._maxDistanceFound+" err= "+(this._maxDistanceFound/this._bufDistance-1)),this._isValid)},Li.prototype.checkNegativeValid=function(){if(!(this._input instanceof de||this._input instanceof Pe||this._input instanceof Qn))return null;var r=this.getPolygonLines(this._input);if(this.checkMinimumDistance(r,this._result,this._minValidDistance),!this._isValid)return null;this.checkMaximumDistance(r,this._result,this._maxValidDistance)},Li.prototype.getErrorIndicator=function(){return this._errorIndicator},Li.prototype.checkMinimumDistance=function(r,i,a){var c=new tr(r,i,a);if(this._minDistanceFound=c.distance(),this._minDistanceFound<a){this._isValid=!1;var d=c.nearestPoints();this._errorLocation=c.nearestPoints()[1],this._errorIndicator=r.getFactory().createLineString(d),this._errMsg="Distance between buffer curve and input is too small ("+this._minDistanceFound+" at "+fe.toLineString(d[0],d[1])+" )"}},Li.prototype.checkPositiveValid=function(){var r=this._result.getBoundary();if(this.checkMinimumDistance(this._input,r,this._minValidDistance),!this._isValid)return null;this.checkMaximumDistance(this._input,r,this._maxValidDistance)},Li.prototype.getErrorLocation=function(){return this._errorLocation},Li.prototype.getPolygonLines=function(r){for(var i=new G,a=new _e(i),c=se.getPolygons(r).iterator();c.hasNext();)c.next().apply(a);return r.getFactory().buildGeometry(i)},Li.prototype.getErrorMessage=function(){return this._errMsg},Li.prototype.interfaces_=function(){return[]},Li.prototype.getClass=function(){return Li},Ql.VERBOSE.get=function(){return!1},Ql.MAX_DISTANCE_DIFF_FRAC.get=function(){return .012},Object.defineProperties(Li,Ql);var Rr=function(r,i,a){this._isValid=!0,this._errorMsg=null,this._errorLocation=null,this._errorIndicator=null,this._input=r||null,this._distance=i||null,this._result=a||null},Af={VERBOSE:{configurable:!0},MAX_ENV_DIFF_FRAC:{configurable:!0}};Rr.prototype.isValid=function(){return this.checkPolygonal(),this._isValid?(this.checkExpectedEmpty(),this._isValid?(this.checkEnvelope(),this._isValid?(this.checkArea(),this._isValid?(this.checkDistance(),this._isValid):this._isValid):this._isValid):this._isValid):this._isValid},Rr.prototype.checkEnvelope=function(){if(this._distance<0)return null;var r=this._distance*Rr.MAX_ENV_DIFF_FRAC;r===0&&(r=.001);var i=new qt(this._input.getEnvelopeInternal());i.expandBy(this._distance);var a=new qt(this._result.getEnvelopeInternal());a.expandBy(r),a.contains(i)||(this._isValid=!1,this._errorMsg="Buffer envelope is incorrect",this._errorIndicator=this._input.getFactory().toGeometry(a)),this.report("Envelope")},Rr.prototype.checkDistance=function(){var r=new Li(this._input,this._distance,this._result);r.isValid()||(this._isValid=!1,this._errorMsg=r.getErrorMessage(),this._errorLocation=r.getErrorLocation(),this._errorIndicator=r.getErrorIndicator()),this.report("Distance")},Rr.prototype.checkArea=function(){var r=this._input.getArea(),i=this._result.getArea();this._distance>0&&r>i&&(this._isValid=!1,this._errorMsg="Area of positive buffer is smaller than input",this._errorIndicator=this._result),this._distance<0&&r<i&&(this._isValid=!1,this._errorMsg="Area of negative buffer is larger than input",this._errorIndicator=this._result),this.report("Area")},Rr.prototype.checkPolygonal=function(){this._result instanceof de||this._result instanceof Pe||(this._isValid=!1),this._errorMsg="Result is not polygonal",this._errorIndicator=this._result,this.report("Polygonal")},Rr.prototype.getErrorIndicator=function(){return this._errorIndicator},Rr.prototype.getErrorLocation=function(){return this._errorLocation},Rr.prototype.checkExpectedEmpty=function(){return this._input.getDimension()>=2||this._distance>0?null:(this._result.isEmpty()||(this._isValid=!1,this._errorMsg="Result is non-empty",this._errorIndicator=this._result),void this.report("ExpectedEmpty"))},Rr.prototype.report=function(r){if(!Rr.VERBOSE)return null;te.out.println("Check "+r+": "+(this._isValid?"passed":"FAILED"))},Rr.prototype.getErrorMessage=function(){return this._errorMsg},Rr.prototype.interfaces_=function(){return[]},Rr.prototype.getClass=function(){return Rr},Rr.isValidMsg=function(r,i,a){var c=new Rr(r,i,a);return c.isValid()?null:c.getErrorMessage()},Rr.isValid=function(r,i,a){return!!new Rr(r,i,a).isValid()},Af.VERBOSE.get=function(){return!1},Af.MAX_ENV_DIFF_FRAC.get=function(){return .012},Object.defineProperties(Rr,Af);var Bo=function(){this._pts=null,this._data=null;var r=arguments[0],i=arguments[1];this._pts=r,this._data=i};Bo.prototype.getCoordinates=function(){return this._pts},Bo.prototype.size=function(){return this._pts.length},Bo.prototype.getCoordinate=function(r){return this._pts[r]},Bo.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},Bo.prototype.getSegmentOctant=function(r){return r===this._pts.length-1?-1:ua.octant(this.getCoordinate(r),this.getCoordinate(r+1))},Bo.prototype.setData=function(r){this._data=r},Bo.prototype.getData=function(){return this._data},Bo.prototype.toString=function(){return fe.toLineString(new ye(this._pts))},Bo.prototype.interfaces_=function(){return[No]},Bo.prototype.getClass=function(){return Bo};var Br=function(){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new G,this._intersectionCount=0,this._keepIntersections=!0;var r=arguments[0];this._li=r,this._interiorIntersection=null};Br.prototype.getInteriorIntersection=function(){return this._interiorIntersection},Br.prototype.setCheckEndSegmentsOnly=function(r){this._isCheckEndSegmentsOnly=r},Br.prototype.getIntersectionSegments=function(){return this._intSegments},Br.prototype.count=function(){return this._intersectionCount},Br.prototype.getIntersections=function(){return this._intersections},Br.prototype.setFindAllIntersections=function(r){this._findAllIntersections=r},Br.prototype.setKeepIntersections=function(r){this._keepIntersections=r},Br.prototype.processIntersections=function(r,i,a,c){if(!this._findAllIntersections&&this.hasIntersection()||r===a&&i===c||this._isCheckEndSegmentsOnly&&!(this.isEndSegment(r,i)||this.isEndSegment(a,c)))return null;var d=r.getCoordinates()[i],_=r.getCoordinates()[i+1],M=a.getCoordinates()[c],L=a.getCoordinates()[c+1];this._li.computeIntersection(d,_,M,L),this._li.hasIntersection()&&this._li.isInteriorIntersection()&&(this._intSegments=new Array(4).fill(null),this._intSegments[0]=d,this._intSegments[1]=_,this._intSegments[2]=M,this._intSegments[3]=L,this._interiorIntersection=this._li.getIntersection(0),this._keepIntersections&&this._intersections.add(this._interiorIntersection),this._intersectionCount++)},Br.prototype.isEndSegment=function(r,i){return i===0||i>=r.size()-2},Br.prototype.hasIntersection=function(){return this._interiorIntersection!==null},Br.prototype.isDone=function(){return!this._findAllIntersections&&this._interiorIntersection!==null},Br.prototype.interfaces_=function(){return[Bs]},Br.prototype.getClass=function(){return Br},Br.createAllIntersectionsFinder=function(r){var i=new Br(r);return i.setFindAllIntersections(!0),i},Br.createAnyIntersectionFinder=function(r){return new Br(r)},Br.createIntersectionCounter=function(r){var i=new Br(r);return i.setFindAllIntersections(!0),i.setKeepIntersections(!1),i};var Ni=function(){this._li=new z,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;var r=arguments[0];this._segStrings=r};Ni.prototype.execute=function(){if(this._segInt!==null)return null;this.checkInteriorIntersections()},Ni.prototype.getIntersections=function(){return this._segInt.getIntersections()},Ni.prototype.isValid=function(){return this.execute(),this._isValid},Ni.prototype.setFindAllIntersections=function(r){this._findAllIntersections=r},Ni.prototype.checkInteriorIntersections=function(){this._isValid=!0,this._segInt=new Br(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var r=new hl;if(r.setSegmentIntersector(this._segInt),r.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null},Ni.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new Qo(this.getErrorMessage(),this._segInt.getInteriorIntersection())},Ni.prototype.getErrorMessage=function(){if(this._isValid)return"no intersections found";var r=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+fe.toLineString(r[0],r[1])+" and "+fe.toLineString(r[2],r[3])},Ni.prototype.interfaces_=function(){return[]},Ni.prototype.getClass=function(){return Ni},Ni.computeIntersections=function(r){var i=new Ni(r);return i.setFindAllIntersections(!0),i.isValid(),i.getIntersections()};var Ji=function r(){this._nv=null;var i=arguments[0];this._nv=new Ni(r.toSegmentStrings(i))};Ji.prototype.checkValid=function(){this._nv.checkValid()},Ji.prototype.interfaces_=function(){return[]},Ji.prototype.getClass=function(){return Ji},Ji.toSegmentStrings=function(r){for(var i=new G,a=r.iterator();a.hasNext();){var c=a.next();i.add(new Bo(c.getCoordinates(),c))}return i},Ji.checkValid=function(r){new Ji(r).checkValid()};var Ms=function(r){this._mapOp=r};Ms.prototype.map=function(r){for(var i=new G,a=0;a<r.getNumGeometries();a++){var c=this._mapOp.map(r.getGeometryN(a));c.isEmpty()||i.add(c)}return r.getFactory().createGeometryCollection(Le.toGeometryArray(i))},Ms.prototype.interfaces_=function(){return[]},Ms.prototype.getClass=function(){return Ms},Ms.map=function(r,i){return new Ms(i).map(r)};var yo=function(){this._op=null,this._geometryFactory=null,this._ptLocator=null,this._lineEdgesList=new G,this._resultLineList=new G;var r=arguments[0],i=arguments[1],a=arguments[2];this._op=r,this._geometryFactory=i,this._ptLocator=a};yo.prototype.collectLines=function(r){for(var i=this._op.getGraph().getEdgeEnds().iterator();i.hasNext();){var a=i.next();this.collectLineEdge(a,r,this._lineEdgesList),this.collectBoundaryTouchEdge(a,r,this._lineEdgesList)}},yo.prototype.labelIsolatedLine=function(r,i){var a=this._ptLocator.locate(r.getCoordinate(),this._op.getArgGeometry(i));r.getLabel().setLocation(i,a)},yo.prototype.build=function(r){return this.findCoveredLineEdges(),this.collectLines(r),this.buildLines(r),this._resultLineList},yo.prototype.collectLineEdge=function(r,i,a){var c=r.getLabel(),d=r.getEdge();r.isLineEdge()&&(r.isVisited()||!Re.isResultOfOp(c,i)||d.isCovered()||(a.add(d),r.setVisitedEdge(!0)))},yo.prototype.findCoveredLineEdges=function(){for(var r=this._op.getGraph().getNodes().iterator();r.hasNext();)r.next().getEdges().findCoveredLineEdges();for(var i=this._op.getGraph().getEdgeEnds().iterator();i.hasNext();){var a=i.next(),c=a.getEdge();if(a.isLineEdge()&&!c.isCoveredSet()){var d=this._op.isCoveredByA(a.getCoordinate());c.setCovered(d)}}},yo.prototype.labelIsolatedLines=function(r){for(var i=r.iterator();i.hasNext();){var a=i.next(),c=a.getLabel();a.isIsolated()&&(c.isNull(0)?this.labelIsolatedLine(a,0):this.labelIsolatedLine(a,1))}},yo.prototype.buildLines=function(r){for(var i=this._lineEdgesList.iterator();i.hasNext();){var a=i.next(),c=this._geometryFactory.createLineString(a.getCoordinates());this._resultLineList.add(c),a.setInResult(!0)}},yo.prototype.collectBoundaryTouchEdge=function(r,i,a){var c=r.getLabel();return r.isLineEdge()||r.isVisited()||r.isInteriorAreaEdge()||r.getEdge().isInResult()?null:(Wt.isTrue(!(r.isInResult()||r.getSym().isInResult())||!r.getEdge().isInResult()),void(Re.isResultOfOp(c,i)&&i===Re.INTERSECTION&&(a.add(r.getEdge()),r.setVisitedEdge(!0))))},yo.prototype.interfaces_=function(){return[]},yo.prototype.getClass=function(){return yo};var bs=function(){this._op=null,this._geometryFactory=null,this._resultPointList=new G;var r=arguments[0],i=arguments[1];this._op=r,this._geometryFactory=i};bs.prototype.filterCoveredNodeToPoint=function(r){var i=r.getCoordinate();if(!this._op.isCoveredByLA(i)){var a=this._geometryFactory.createPoint(i);this._resultPointList.add(a)}},bs.prototype.extractNonCoveredResultNodes=function(r){for(var i=this._op.getGraph().getNodes().iterator();i.hasNext();){var a=i.next();if(!a.isInResult()&&!a.isIncidentEdgeInResult()&&(a.getEdges().getDegree()===0||r===Re.INTERSECTION)){var c=a.getLabel();Re.isResultOfOp(c,r)&&this.filterCoveredNodeToPoint(a)}}},bs.prototype.build=function(r){return this.extractNonCoveredResultNodes(r),this._resultPointList},bs.prototype.interfaces_=function(){return[]},bs.prototype.getClass=function(){return bs};var li=function(){this._inputGeom=null,this._factory=null,this._pruneEmptyGeometry=!0,this._preserveGeometryCollectionType=!0,this._preserveCollections=!1,this._preserveType=!1};li.prototype.transformPoint=function(r,i){return this._factory.createPoint(this.transformCoordinates(r.getCoordinateSequence(),r))},li.prototype.transformPolygon=function(r,i){var a=!0,c=this.transformLinearRing(r.getExteriorRing(),r);c!==null&&c instanceof Ae&&!c.isEmpty()||(a=!1);for(var d=new G,_=0;_<r.getNumInteriorRing();_++){var M=this.transformLinearRing(r.getInteriorRingN(_),r);M===null||M.isEmpty()||(M instanceof Ae||(a=!1),d.add(M))}if(a)return this._factory.createPolygon(c,d.toArray([]));var L=new G;return c!==null&&L.add(c),L.addAll(d),this._factory.buildGeometry(L)},li.prototype.createCoordinateSequence=function(r){return this._factory.getCoordinateSequenceFactory().create(r)},li.prototype.getInputGeometry=function(){return this._inputGeom},li.prototype.transformMultiLineString=function(r,i){for(var a=new G,c=0;c<r.getNumGeometries();c++){var d=this.transformLineString(r.getGeometryN(c),r);d!==null&&(d.isEmpty()||a.add(d))}return this._factory.buildGeometry(a)},li.prototype.transformCoordinates=function(r,i){return this.copy(r)},li.prototype.transformLineString=function(r,i){return this._factory.createLineString(this.transformCoordinates(r.getCoordinateSequence(),r))},li.prototype.transformMultiPoint=function(r,i){for(var a=new G,c=0;c<r.getNumGeometries();c++){var d=this.transformPoint(r.getGeometryN(c),r);d!==null&&(d.isEmpty()||a.add(d))}return this._factory.buildGeometry(a)},li.prototype.transformMultiPolygon=function(r,i){for(var a=new G,c=0;c<r.getNumGeometries();c++){var d=this.transformPolygon(r.getGeometryN(c),r);d!==null&&(d.isEmpty()||a.add(d))}return this._factory.buildGeometry(a)},li.prototype.copy=function(r){return r.copy()},li.prototype.transformGeometryCollection=function(r,i){for(var a=new G,c=0;c<r.getNumGeometries();c++){var d=this.transform(r.getGeometryN(c));d!==null&&(this._pruneEmptyGeometry&&d.isEmpty()||a.add(d))}return this._preserveGeometryCollectionType?this._factory.createGeometryCollection(Le.toGeometryArray(a)):this._factory.buildGeometry(a)},li.prototype.transform=function(r){if(this._inputGeom=r,this._factory=r.getFactory(),r instanceof ue)return this.transformPoint(r,null);if(r instanceof Be)return this.transformMultiPoint(r,null);if(r instanceof Ae)return this.transformLinearRing(r,null);if(r instanceof vt)return this.transformLineString(r,null);if(r instanceof bi)return this.transformMultiLineString(r,null);if(r instanceof de)return this.transformPolygon(r,null);if(r instanceof Pe)return this.transformMultiPolygon(r,null);if(r instanceof Qn)return this.transformGeometryCollection(r,null);throw new I("Unknown Geometry subtype: "+r.getClass().getName())},li.prototype.transformLinearRing=function(r,i){var a=this.transformCoordinates(r.getCoordinateSequence(),r);if(a===null)return this._factory.createLinearRing(null);var c=a.size();return c>0&&c<4&&!this._preserveType?this._factory.createLineString(a):this._factory.createLinearRing(a)},li.prototype.interfaces_=function(){return[]},li.prototype.getClass=function(){return li};var zo=function r(){if(this._snapTolerance=0,this._srcPts=null,this._seg=new ie,this._allowSnappingToSourceVertices=!1,this._isClosed=!1,arguments[0]instanceof vt&&typeof arguments[1]=="number"){var i=arguments[0],a=arguments[1];r.call(this,i.getCoordinates(),a)}else if(arguments[0]instanceof Array&&typeof arguments[1]=="number"){var c=arguments[0],d=arguments[1];this._srcPts=c,this._isClosed=r.isClosed(c),this._snapTolerance=d}};zo.prototype.snapVertices=function(r,i){for(var a=this._isClosed?r.size()-1:r.size(),c=0;c<a;c++){var d=r.get(c),_=this.findSnapForVertex(d,i);_!==null&&(r.set(c,new D(_)),c===0&&this._isClosed&&r.set(r.size()-1,new D(_)))}},zo.prototype.findSnapForVertex=function(r,i){for(var a=0;a<i.length;a++){if(r.equals2D(i[a]))return null;if(r.distance(i[a])<this._snapTolerance)return i[a]}return null},zo.prototype.snapTo=function(r){var i=new et(this._srcPts);return this.snapVertices(i,r),this.snapSegments(i,r),i.toCoordinateArray()},zo.prototype.snapSegments=function(r,i){if(i.length===0)return null;var a=i.length;i[0].equals2D(i[i.length-1])&&(a=i.length-1);for(var c=0;c<a;c++){var d=i[c],_=this.findSegmentIndexToSnap(d,r);_>=0&&r.add(_+1,new D(d),!1)}},zo.prototype.findSegmentIndexToSnap=function(r,i){for(var a=A.MAX_VALUE,c=-1,d=0;d<i.size()-1;d++){if(this._seg.p0=i.get(d),this._seg.p1=i.get(d+1),this._seg.p0.equals2D(r)||this._seg.p1.equals2D(r)){if(this._allowSnappingToSourceVertices)continue;return-1}var _=this._seg.distance(r);_<this._snapTolerance&&_<a&&(a=_,c=d)}return c},zo.prototype.setAllowSnappingToSourceVertices=function(r){this._allowSnappingToSourceVertices=r},zo.prototype.interfaces_=function(){return[]},zo.prototype.getClass=function(){return zo},zo.isClosed=function(r){return!(r.length<=1)&&r[0].equals2D(r[r.length-1])};var fr=function(r){this._srcGeom=r||null},Tf={SNAP_PRECISION_FACTOR:{configurable:!0}};fr.prototype.snapTo=function(r,i){var a=this.extractTargetCoordinates(r);return new Su(i,a).transform(this._srcGeom)},fr.prototype.snapToSelf=function(r,i){var a=this.extractTargetCoordinates(this._srcGeom),c=new Su(r,a,!0).transform(this._srcGeom),d=c;return i&&Q(d,we)&&(d=c.buffer(0)),d},fr.prototype.computeSnapTolerance=function(r){return this.computeMinimumSegmentLength(r)/10},fr.prototype.extractTargetCoordinates=function(r){for(var i=new b,a=r.getCoordinates(),c=0;c<a.length;c++)i.add(a[c]);return i.toArray(new Array(0).fill(null))},fr.prototype.computeMinimumSegmentLength=function(r){for(var i=A.MAX_VALUE,a=0;a<r.length-1;a++){var c=r[a].distance(r[a+1]);c<i&&(i=c)}return i},fr.prototype.interfaces_=function(){return[]},fr.prototype.getClass=function(){return fr},fr.snap=function(r,i,a){var c=new Array(2).fill(null),d=new fr(r);c[0]=d.snapTo(i,a);var _=new fr(i);return c[1]=_.snapTo(c[0],a),c},fr.computeOverlaySnapTolerance=function(){if(arguments.length===1){var r=arguments[0],i=fr.computeSizeBasedSnapTolerance(r),a=r.getPrecisionModel();if(a.getType()===ze.FIXED){var c=1/a.getScale()*2/1.415;c>i&&(i=c)}return i}if(arguments.length===2){var d=arguments[0],_=arguments[1];return Math.min(fr.computeOverlaySnapTolerance(d),fr.computeOverlaySnapTolerance(_))}},fr.computeSizeBasedSnapTolerance=function(r){var i=r.getEnvelopeInternal();return Math.min(i.getHeight(),i.getWidth())*fr.SNAP_PRECISION_FACTOR},fr.snapToSelf=function(r,i,a){return new fr(r).snapToSelf(i,a)},Tf.SNAP_PRECISION_FACTOR.get=function(){return 1e-9},Object.defineProperties(fr,Tf);var Su=function(r){function i(a,c,d){r.call(this),this._snapTolerance=a||null,this._snapPts=c||null,this._isSelfSnap=d!==void 0&&d}return r&&(i.__proto__=r),i.prototype=Object.create(r&&r.prototype),i.prototype.constructor=i,i.prototype.snapLine=function(a,c){var d=new zo(a,this._snapTolerance);return d.setAllowSnappingToSourceVertices(this._isSelfSnap),d.snapTo(c)},i.prototype.transformCoordinates=function(a,c){var d=a.toCoordinateArray(),_=this.snapLine(d,this._snapPts);return this._factory.getCoordinateSequenceFactory().create(_)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(li),Tr=function(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=0,this._commonSignExp=null};Tr.prototype.getCommon=function(){return A.longBitsToDouble(this._commonBits)},Tr.prototype.add=function(r){var i=A.doubleToLongBits(r);if(this._isFirst)return this._commonBits=i,this._commonSignExp=Tr.signExpBits(this._commonBits),this._isFirst=!1,null;if(Tr.signExpBits(i)!==this._commonSignExp)return this._commonBits=0,null;this._commonMantissaBitsCount=Tr.numCommonMostSigMantissaBits(this._commonBits,i),this._commonBits=Tr.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))},Tr.prototype.toString=function(){if(arguments.length===1){var r=arguments[0],i=A.longBitsToDouble(r),a="0000000000000000000000000000000000000000000000000000000000000000"+A.toBinaryString(r),c=a.substring(a.length-64);return c.substring(0,1)+" "+c.substring(1,12)+"(exp) "+c.substring(12)+" [ "+i+" ]"}},Tr.prototype.interfaces_=function(){return[]},Tr.prototype.getClass=function(){return Tr},Tr.getBit=function(r,i){return r&1<<i?1:0},Tr.signExpBits=function(r){return r>>52},Tr.zeroLowerBits=function(r,i){return r&~((1<<i)-1)},Tr.numCommonMostSigMantissaBits=function(r,i){for(var a=0,c=52;c>=0;c--){if(Tr.getBit(r,c)!==Tr.getBit(i,c))return a;a++}return 52};var Go=function(){this._commonCoord=null,this._ccFilter=new Va},Cf={CommonCoordinateFilter:{configurable:!0},Translater:{configurable:!0}};Go.prototype.addCommonBits=function(r){var i=new Gs(this._commonCoord);r.apply(i),r.geometryChanged()},Go.prototype.removeCommonBits=function(r){if(this._commonCoord.x===0&&this._commonCoord.y===0)return r;var i=new D(this._commonCoord);i.x=-i.x,i.y=-i.y;var a=new Gs(i);return r.apply(a),r.geometryChanged(),r},Go.prototype.getCommonCoordinate=function(){return this._commonCoord},Go.prototype.add=function(r){r.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()},Go.prototype.interfaces_=function(){return[]},Go.prototype.getClass=function(){return Go},Cf.CommonCoordinateFilter.get=function(){return Va},Cf.Translater.get=function(){return Gs},Object.defineProperties(Go,Cf);var Va=function(){this._commonBitsX=new Tr,this._commonBitsY=new Tr};Va.prototype.filter=function(r){this._commonBitsX.add(r.x),this._commonBitsY.add(r.y)},Va.prototype.getCommonCoordinate=function(){return new D(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())},Va.prototype.interfaces_=function(){return[rt]},Va.prototype.getClass=function(){return Va};var Gs=function(){this.trans=null;var r=arguments[0];this.trans=r};Gs.prototype.filter=function(r,i){var a=r.getOrdinate(i,0)+this.trans.x,c=r.getOrdinate(i,1)+this.trans.y;r.setOrdinate(i,0,a),r.setOrdinate(i,1,c)},Gs.prototype.isDone=function(){return!1},Gs.prototype.isGeometryChanged=function(){return!0},Gs.prototype.interfaces_=function(){return[ur]},Gs.prototype.getClass=function(){return Gs};var Cr=function(r,i){this._geom=new Array(2).fill(null),this._snapTolerance=null,this._cbr=null,this._geom[0]=r,this._geom[1]=i,this.computeSnapTolerance()};Cr.prototype.selfSnap=function(r){return new fr(r).snapTo(r,this._snapTolerance)},Cr.prototype.removeCommonBits=function(r){this._cbr=new Go,this._cbr.add(r[0]),this._cbr.add(r[1]);var i=new Array(2).fill(null);return i[0]=this._cbr.removeCommonBits(r[0].copy()),i[1]=this._cbr.removeCommonBits(r[1].copy()),i},Cr.prototype.prepareResult=function(r){return this._cbr.addCommonBits(r),r},Cr.prototype.getResultGeometry=function(r){var i=this.snap(this._geom),a=Re.overlayOp(i[0],i[1],r);return this.prepareResult(a)},Cr.prototype.checkValid=function(r){r.isValid()||te.out.println("Snapped geometry is invalid")},Cr.prototype.computeSnapTolerance=function(){this._snapTolerance=fr.computeOverlaySnapTolerance(this._geom[0],this._geom[1])},Cr.prototype.snap=function(r){var i=this.removeCommonBits(r);return fr.snap(i[0],i[1],this._snapTolerance)},Cr.prototype.interfaces_=function(){return[]},Cr.prototype.getClass=function(){return Cr},Cr.overlayOp=function(r,i,a){return new Cr(r,i).getResultGeometry(a)},Cr.union=function(r,i){return Cr.overlayOp(r,i,Re.UNION)},Cr.intersection=function(r,i){return Cr.overlayOp(r,i,Re.INTERSECTION)},Cr.symDifference=function(r,i){return Cr.overlayOp(r,i,Re.SYMDIFFERENCE)},Cr.difference=function(r,i){return Cr.overlayOp(r,i,Re.DIFFERENCE)};var zr=function(r,i){this._geom=new Array(2).fill(null),this._geom[0]=r,this._geom[1]=i};zr.prototype.getResultGeometry=function(r){var i=null,a=!1,c=null;try{i=Re.overlayOp(this._geom[0],this._geom[1],r),a=!0}catch(d){if(!(d instanceof Te))throw d;c=d}if(!a)try{i=Cr.overlayOp(this._geom[0],this._geom[1],r)}catch(d){throw d instanceof Te?c:d}return i},zr.prototype.interfaces_=function(){return[]},zr.prototype.getClass=function(){return zr},zr.overlayOp=function(r,i,a){return new zr(r,i).getResultGeometry(a)},zr.union=function(r,i){return zr.overlayOp(r,i,Re.UNION)},zr.intersection=function(r,i){return zr.overlayOp(r,i,Re.INTERSECTION)},zr.symDifference=function(r,i){return zr.overlayOp(r,i,Re.SYMDIFFERENCE)},zr.difference=function(r,i){return zr.overlayOp(r,i,Re.DIFFERENCE)};var Wa=function(){this.mce=null,this.chainIndex=null;var r=arguments[0],i=arguments[1];this.mce=r,this.chainIndex=i};Wa.prototype.computeIntersections=function(r,i){this.mce.computeIntersectsForChain(this.chainIndex,r.mce,r.chainIndex,i)},Wa.prototype.interfaces_=function(){return[]},Wa.prototype.getClass=function(){return Wa};var Oi=function r(){if(this._label=null,this._xValue=null,this._eventType=null,this._insertEvent=null,this._deleteEventIndex=null,this._obj=null,arguments.length===2){var i=arguments[0],a=arguments[1];this._eventType=r.DELETE,this._xValue=i,this._insertEvent=a}else if(arguments.length===3){var c=arguments[0],d=arguments[1],_=arguments[2];this._eventType=r.INSERT,this._label=c,this._xValue=d,this._obj=_}},tc={INSERT:{configurable:!0},DELETE:{configurable:!0}};Oi.prototype.isDelete=function(){return this._eventType===Oi.DELETE},Oi.prototype.setDeleteEventIndex=function(r){this._deleteEventIndex=r},Oi.prototype.getObject=function(){return this._obj},Oi.prototype.compareTo=function(r){var i=r;return this._xValue<i._xValue?-1:this._xValue>i._xValue?1:this._eventType<i._eventType?-1:this._eventType>i._eventType?1:0},Oi.prototype.getInsertEvent=function(){return this._insertEvent},Oi.prototype.isInsert=function(){return this._eventType===Oi.INSERT},Oi.prototype.isSameLabel=function(r){return this._label!==null&&this._label===r._label},Oi.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex},Oi.prototype.interfaces_=function(){return[V]},Oi.prototype.getClass=function(){return Oi},tc.INSERT.get=function(){return 1},tc.DELETE.get=function(){return 2},Object.defineProperties(Oi,tc);var ec=function(){};ec.prototype.interfaces_=function(){return[]},ec.prototype.getClass=function(){return ec};var Yr=function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._properIntersectionPoint=null,this._li=null,this._includeProper=null,this._recordIsolated=null,this._isSelfIntersection=null,this._numIntersections=0,this.numTests=0,this._bdyNodes=null,this._isDone=!1,this._isDoneWhenProperInt=!1;var r=arguments[0],i=arguments[1],a=arguments[2];this._li=r,this._includeProper=i,this._recordIsolated=a};Yr.prototype.isTrivialIntersection=function(r,i,a,c){if(r===a&&this._li.getIntersectionNum()===1){if(Yr.isAdjacentSegments(i,c))return!0;if(r.isClosed()){var d=r.getNumPoints()-1;if(i===0&&c===d||c===0&&i===d)return!0}}return!1},Yr.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},Yr.prototype.setIsDoneIfProperInt=function(r){this._isDoneWhenProperInt=r},Yr.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},Yr.prototype.isBoundaryPointInternal=function(r,i){for(var a=i.iterator();a.hasNext();){var c=a.next().getCoordinate();if(r.isIntersection(c))return!0}return!1},Yr.prototype.hasProperIntersection=function(){return this._hasProper},Yr.prototype.hasIntersection=function(){return this._hasIntersection},Yr.prototype.isDone=function(){return this._isDone},Yr.prototype.isBoundaryPoint=function(r,i){return i!==null&&(!!this.isBoundaryPointInternal(r,i[0])||!!this.isBoundaryPointInternal(r,i[1]))},Yr.prototype.setBoundaryNodes=function(r,i){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=r,this._bdyNodes[1]=i},Yr.prototype.addIntersections=function(r,i,a,c){if(r===a&&i===c)return null;this.numTests++;var d=r.getCoordinates()[i],_=r.getCoordinates()[i+1],M=a.getCoordinates()[c],L=a.getCoordinates()[c+1];this._li.computeIntersection(d,_,M,L),this._li.hasIntersection()&&(this._recordIsolated&&(r.setIsolated(!1),a.setIsolated(!1)),this._numIntersections++,this.isTrivialIntersection(r,i,a,c)||(this._hasIntersection=!0,!this._includeProper&&this._li.isProper()||(r.addIntersections(this._li,i,0),a.addIntersections(this._li,c,1)),this._li.isProper()&&(this._properIntersectionPoint=this._li.getIntersection(0).copy(),this._hasProper=!0,this._isDoneWhenProperInt&&(this._isDone=!0),this.isBoundaryPoint(this._li,this._bdyNodes)||(this._hasProperInterior=!0))))},Yr.prototype.interfaces_=function(){return[]},Yr.prototype.getClass=function(){return Yr},Yr.isAdjacentSegments=function(r,i){return Math.abs(r-i)===1};var ni=function(r){function i(){r.call(this),this.events=new G,this.nOverlaps=null}return r&&(i.__proto__=r),i.prototype=Object.create(r&&r.prototype),i.prototype.constructor=i,i.prototype.prepareEvents=function(){ho.sort(this.events);for(var a=0;a<this.events.size();a++){var c=this.events.get(a);c.isDelete()&&c.getInsertEvent().setDeleteEventIndex(a)}},i.prototype.computeIntersections=function(){if(arguments.length===1){var a=arguments[0];this.nOverlaps=0,this.prepareEvents();for(var c=0;c<this.events.size();c++){var d=this.events.get(c);if(d.isInsert()&&this.processOverlaps(c,d.getDeleteEventIndex(),d,a),a.isDone())break}}else if(arguments.length===3){if(arguments[2]instanceof Yr&&Q(arguments[0],Et)&&Q(arguments[1],Et)){var _=arguments[0],M=arguments[1],L=arguments[2];this.addEdges(_,_),this.addEdges(M,M),this.computeIntersections(L)}else if(typeof arguments[2]=="boolean"&&Q(arguments[0],Et)&&arguments[1]instanceof Yr){var H=arguments[0],it=arguments[1];arguments[2]?this.addEdges(H,null):this.addEdges(H),this.computeIntersections(it)}}},i.prototype.addEdge=function(a,c){for(var d=a.getMonotoneChainEdge(),_=d.getStartIndexes(),M=0;M<_.length-1;M++){var L=new Wa(d,M),H=new Oi(c,d.getMinX(M),L);this.events.add(H),this.events.add(new Oi(d.getMaxX(M),H))}},i.prototype.processOverlaps=function(a,c,d,_){for(var M=d.getObject(),L=a;L<c;L++){var H=this.events.get(L);if(H.isInsert()){var it=H.getObject();d.isSameLabel(H)||(M.computeIntersections(it,_),this.nOverlaps++)}}},i.prototype.addEdges=function(){if(arguments.length===1)for(var a=arguments[0].iterator();a.hasNext();){var c=a.next();this.addEdge(c,c)}else if(arguments.length===2)for(var d=arguments[0],_=arguments[1],M=d.iterator();M.hasNext();){var L=M.next();this.addEdge(L,_)}},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(ec),vr=function(){this._min=A.POSITIVE_INFINITY,this._max=A.NEGATIVE_INFINITY},Wh={NodeComparator:{configurable:!0}};vr.prototype.getMin=function(){return this._min},vr.prototype.intersects=function(r,i){return!(this._min>i||this._max<r)},vr.prototype.getMax=function(){return this._max},vr.prototype.toString=function(){return fe.toLineString(new D(this._min,0),new D(this._max,0))},vr.prototype.interfaces_=function(){return[]},vr.prototype.getClass=function(){return vr},Wh.NodeComparator.get=function(){return dl},Object.defineProperties(vr,Wh);var dl=function(){};dl.prototype.compare=function(r,i){var a=r,c=i,d=(a._min+a._max)/2,_=(c._min+c._max)/2;return d<_?-1:d>_?1:0},dl.prototype.interfaces_=function(){return[q]},dl.prototype.getClass=function(){return dl};var Xh=function(r){function i(){r.call(this),this._item=null;var a=arguments[0],c=arguments[1],d=arguments[2];this._min=a,this._max=c,this._item=d}return r&&(i.__proto__=r),i.prototype=Object.create(r&&r.prototype),i.prototype.constructor=i,i.prototype.query=function(a,c,d){if(!this.intersects(a,c))return null;d.visitItem(this._item)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(vr),em=function(r){function i(){r.call(this),this._node1=null,this._node2=null;var a=arguments[0],c=arguments[1];this._node1=a,this._node2=c,this.buildExtent(this._node1,this._node2)}return r&&(i.__proto__=r),i.prototype=Object.create(r&&r.prototype),i.prototype.constructor=i,i.prototype.buildExtent=function(a,c){this._min=Math.min(a._min,c._min),this._max=Math.max(a._max,c._max)},i.prototype.query=function(a,c,d){if(!this.intersects(a,c))return null;this._node1!==null&&this._node1.query(a,c,d),this._node2!==null&&this._node2.query(a,c,d)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(vr),vo=function(){this._leaves=new G,this._root=null,this._level=0};vo.prototype.buildTree=function(){ho.sort(this._leaves,new vr.NodeComparator);for(var r=this._leaves,i=null,a=new G;;){if(this.buildLevel(r,a),a.size()===1)return a.get(0);i=r,r=a,a=i}},vo.prototype.insert=function(r,i,a){if(this._root!==null)throw new Error("Index cannot be added to once it has been queried");this._leaves.add(new Xh(r,i,a))},vo.prototype.query=function(r,i,a){this.init(),this._root.query(r,i,a)},vo.prototype.buildRoot=function(){if(this._root!==null)return null;this._root=this.buildTree()},vo.prototype.printNode=function(r){te.out.println(fe.toLineString(new D(r._min,this._level),new D(r._max,this._level)))},vo.prototype.init=function(){if(this._root!==null)return null;this.buildRoot()},vo.prototype.buildLevel=function(r,i){this._level++,i.clear();for(var a=0;a<r.size();a+=2){var c=r.get(a);if((a+1<r.size()?r.get(a):null)===null)i.add(c);else{var d=new em(r.get(a),r.get(a+1));i.add(d)}}},vo.prototype.interfaces_=function(){return[]},vo.prototype.getClass=function(){return vo};var As=function(){this._items=new G};As.prototype.visitItem=function(r){this._items.add(r)},As.prototype.getItems=function(){return this._items},As.prototype.interfaces_=function(){return[Us]},As.prototype.getClass=function(){return As};var da=function(){this._index=null;var r=arguments[0];if(!Q(r,we))throw new I("Argument must be Polygonal");this._index=new ko(r)},ga={SegmentVisitor:{configurable:!0},IntervalIndexedGeometry:{configurable:!0}};da.prototype.locate=function(r){var i=new Ot(r),a=new Ts(i);return this._index.query(r.y,r.y,a),i.getLocation()},da.prototype.interfaces_=function(){return[_u]},da.prototype.getClass=function(){return da},ga.SegmentVisitor.get=function(){return Ts},ga.IntervalIndexedGeometry.get=function(){return ko},Object.defineProperties(da,ga);var Ts=function(){this._counter=null;var r=arguments[0];this._counter=r};Ts.prototype.visitItem=function(r){var i=r;this._counter.countSegment(i.getCoordinate(0),i.getCoordinate(1))},Ts.prototype.interfaces_=function(){return[Us]},Ts.prototype.getClass=function(){return Ts};var ko=function(){this._index=new vo;var r=arguments[0];this.init(r)};ko.prototype.init=function(r){for(var i=_e.getLines(r).iterator();i.hasNext();){var a=i.next().getCoordinates();this.addLine(a)}},ko.prototype.addLine=function(r){for(var i=1;i<r.length;i++){var a=new ie(r[i-1],r[i]),c=Math.min(a.p0.y,a.p1.y),d=Math.max(a.p0.y,a.p1.y);this._index.insert(c,d,a)}},ko.prototype.query=function(){if(arguments.length===2){var r=arguments[0],i=arguments[1],a=new As;return this._index.query(r,i,a),a.getItems()}if(arguments.length===3){var c=arguments[0],d=arguments[1],_=arguments[2];this._index.query(c,d,_)}},ko.prototype.interfaces_=function(){return[]},ko.prototype.getClass=function(){return ko};var ma=function(r){function i(){if(r.call(this),this._parentGeom=null,this._lineEdgeMap=new ul,this._boundaryNodeRule=null,this._useBoundaryDeterminationRule=!0,this._argIndex=null,this._boundaryNodes=null,this._hasTooFewPoints=!1,this._invalidPoint=null,this._areaPtLocator=null,this._ptLocator=new ke,arguments.length===2){var a=arguments[0],c=arguments[1],d=P.OGC_SFS_BOUNDARY_RULE;this._argIndex=a,this._parentGeom=c,this._boundaryNodeRule=d,c!==null&&this.add(c)}else if(arguments.length===3){var _=arguments[0],M=arguments[1],L=arguments[2];this._argIndex=_,this._parentGeom=M,this._boundaryNodeRule=L,M!==null&&this.add(M)}}return r&&(i.__proto__=r),i.prototype=Object.create(r&&r.prototype),i.prototype.constructor=i,i.prototype.insertBoundaryPoint=function(a,c){var d=this._nodes.addNode(c).getLabel(),_=1;K.NONE,d.getLocation(a,Xt.ON)===K.BOUNDARY&&_++;var M=i.determineBoundary(this._boundaryNodeRule,_);d.setLocation(a,M)},i.prototype.computeSelfNodes=function(){if(arguments.length===2){var a=arguments[0],c=arguments[1];return this.computeSelfNodes(a,c,!1)}if(arguments.length===3){var d=arguments[0],_=arguments[1],M=arguments[2],L=new Yr(d,!0,!1);L.setIsDoneIfProperInt(M);var H=this.createEdgeSetIntersector(),it=this._parentGeom instanceof Ae||this._parentGeom instanceof de||this._parentGeom instanceof Pe,bt=_||!it;return H.computeIntersections(this._edges,L,bt),this.addSelfIntersectionNodes(this._argIndex),L}},i.prototype.computeSplitEdges=function(a){for(var c=this._edges.iterator();c.hasNext();)c.next().eiList.addSplitEdges(a)},i.prototype.computeEdgeIntersections=function(a,c,d){var _=new Yr(c,d,!0);return _.setBoundaryNodes(this.getBoundaryNodes(),a.getBoundaryNodes()),this.createEdgeSetIntersector().computeIntersections(this._edges,a._edges,_),_},i.prototype.getGeometry=function(){return this._parentGeom},i.prototype.getBoundaryNodeRule=function(){return this._boundaryNodeRule},i.prototype.hasTooFewPoints=function(){return this._hasTooFewPoints},i.prototype.addPoint=function(){if(arguments[0]instanceof ue){var a=arguments[0].getCoordinate();this.insertPoint(this._argIndex,a,K.INTERIOR)}else if(arguments[0]instanceof D){var c=arguments[0];this.insertPoint(this._argIndex,c,K.INTERIOR)}},i.prototype.addPolygon=function(a){this.addPolygonRing(a.getExteriorRing(),K.EXTERIOR,K.INTERIOR);for(var c=0;c<a.getNumInteriorRing();c++){var d=a.getInteriorRingN(c);this.addPolygonRing(d,K.INTERIOR,K.EXTERIOR)}},i.prototype.addEdge=function(a){this.insertEdge(a);var c=a.getCoordinates();this.insertPoint(this._argIndex,c[0],K.BOUNDARY),this.insertPoint(this._argIndex,c[c.length-1],K.BOUNDARY)},i.prototype.addLineString=function(a){var c=lt.removeRepeatedPoints(a.getCoordinates());if(c.length<2)return this._hasTooFewPoints=!0,this._invalidPoint=c[0],null;var d=new jl(c,new On(this._argIndex,K.INTERIOR));this._lineEdgeMap.put(a,d),this.insertEdge(d),Wt.isTrue(c.length>=2,"found LineString with single point"),this.insertBoundaryPoint(this._argIndex,c[0]),this.insertBoundaryPoint(this._argIndex,c[c.length-1])},i.prototype.getInvalidPoint=function(){return this._invalidPoint},i.prototype.getBoundaryPoints=function(){for(var a=this.getBoundaryNodes(),c=new Array(a.size()).fill(null),d=0,_=a.iterator();_.hasNext();){var M=_.next();c[d++]=M.getCoordinate().copy()}return c},i.prototype.getBoundaryNodes=function(){return this._boundaryNodes===null&&(this._boundaryNodes=this._nodes.getBoundaryNodes(this._argIndex)),this._boundaryNodes},i.prototype.addSelfIntersectionNode=function(a,c,d){if(this.isBoundaryNode(a,c))return null;d===K.BOUNDARY&&this._useBoundaryDeterminationRule?this.insertBoundaryPoint(a,c):this.insertPoint(a,c,d)},i.prototype.addPolygonRing=function(a,c,d){if(a.isEmpty())return null;var _=lt.removeRepeatedPoints(a.getCoordinates());if(_.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=_[0],null;var M=c,L=d;dt.isCCW(_)&&(M=d,L=c);var H=new jl(_,new On(this._argIndex,K.BOUNDARY,M,L));this._lineEdgeMap.put(a,H),this.insertEdge(H),this.insertPoint(this._argIndex,_[0],K.BOUNDARY)},i.prototype.insertPoint=function(a,c,d){var _=this._nodes.addNode(c),M=_.getLabel();M===null?_._label=new On(a,d):M.setLocation(a,d)},i.prototype.createEdgeSetIntersector=function(){return new ni},i.prototype.addSelfIntersectionNodes=function(a){for(var c=this._edges.iterator();c.hasNext();)for(var d=c.next(),_=d.getLabel().getLocation(a),M=d.eiList.iterator();M.hasNext();){var L=M.next();this.addSelfIntersectionNode(a,L.coord,_)}},i.prototype.add=function(){if(arguments.length!==1)return r.prototype.add.apply(this,arguments);var a=arguments[0];if(a.isEmpty())return null;if(a instanceof Pe&&(this._useBoundaryDeterminationRule=!1),a instanceof de)this.addPolygon(a);else if(a instanceof vt)this.addLineString(a);else if(a instanceof ue)this.addPoint(a);else if(a instanceof Be)this.addCollection(a);else if(a instanceof bi)this.addCollection(a);else if(a instanceof Pe)this.addCollection(a);else{if(!(a instanceof Qn))throw new Error(a.getClass().getName());this.addCollection(a)}},i.prototype.addCollection=function(a){for(var c=0;c<a.getNumGeometries();c++){var d=a.getGeometryN(c);this.add(d)}},i.prototype.locate=function(a){return Q(this._parentGeom,we)&&this._parentGeom.getNumGeometries()>50?(this._areaPtLocator===null&&(this._areaPtLocator=new da(this._parentGeom)),this._areaPtLocator.locate(a)):this._ptLocator.locate(a,this._parentGeom)},i.prototype.findEdge=function(){if(arguments.length===1){var a=arguments[0];return this._lineEdgeMap.get(a)}return r.prototype.findEdge.apply(this,arguments)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i.determineBoundary=function(a,c){return a.isInBoundary(c)?K.BOUNDARY:K.INTERIOR},i}(dr),ss=function(){if(this._li=new z,this._resultPrecisionModel=null,this._arg=null,arguments.length===1){var r=arguments[0];this.setComputationPrecision(r.getPrecisionModel()),this._arg=new Array(1).fill(null),this._arg[0]=new ma(0,r)}else if(arguments.length===2){var i=arguments[0],a=arguments[1],c=P.OGC_SFS_BOUNDARY_RULE;i.getPrecisionModel().compareTo(a.getPrecisionModel())>=0?this.setComputationPrecision(i.getPrecisionModel()):this.setComputationPrecision(a.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new ma(0,i,c),this._arg[1]=new ma(1,a,c)}else if(arguments.length===3){var d=arguments[0],_=arguments[1],M=arguments[2];d.getPrecisionModel().compareTo(_.getPrecisionModel())>=0?this.setComputationPrecision(d.getPrecisionModel()):this.setComputationPrecision(_.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new ma(0,d,M),this._arg[1]=new ma(1,_,M)}};ss.prototype.getArgGeometry=function(r){return this._arg[r].getGeometry()},ss.prototype.setComputationPrecision=function(r){this._resultPrecisionModel=r,this._li.setPrecisionModel(this._resultPrecisionModel)},ss.prototype.interfaces_=function(){return[]},ss.prototype.getClass=function(){return ss};var ya=function(){};ya.prototype.interfaces_=function(){return[]},ya.prototype.getClass=function(){return ya},ya.map=function(){if(arguments[0]instanceof Vt&&Q(arguments[1],ya.MapOp)){for(var r=arguments[0],i=arguments[1],a=new G,c=0;c<r.getNumGeometries();c++){var d=i.map(r.getGeometryN(c));d!==null&&a.add(d)}return r.getFactory().buildGeometry(a)}if(Q(arguments[0],at)&&Q(arguments[1],ya.MapOp)){for(var _=arguments[0],M=arguments[1],L=new G,H=_.iterator();H.hasNext();){var it=H.next(),bt=M.map(it);bt!==null&&L.add(bt)}return L}},ya.MapOp=function(){};var Re=function(r){function i(){var a=arguments[0],c=arguments[1];r.call(this,a,c),this._ptLocator=new ke,this._geomFact=null,this._resultGeom=null,this._graph=null,this._edgeList=new gi,this._resultPolyList=new G,this._resultLineList=new G,this._resultPointList=new G,this._graph=new dr(new io),this._geomFact=a.getFactory()}return r&&(i.__proto__=r),i.prototype=Object.create(r&&r.prototype),i.prototype.constructor=i,i.prototype.insertUniqueEdge=function(a){var c=this._edgeList.findEqualEdge(a);if(c!==null){var d=c.getLabel(),_=a.getLabel();c.isPointwiseEqual(a)||(_=new On(a.getLabel())).flip();var M=c.getDepth();M.isNull()&&M.add(d),M.add(_),d.merge(_)}else this._edgeList.add(a)},i.prototype.getGraph=function(){return this._graph},i.prototype.cancelDuplicateResultEdges=function(){for(var a=this._graph.getEdgeEnds().iterator();a.hasNext();){var c=a.next(),d=c.getSym();c.isInResult()&&d.isInResult()&&(c.setInResult(!1),d.setInResult(!1))}},i.prototype.isCoveredByLA=function(a){return!!this.isCovered(a,this._resultLineList)||!!this.isCovered(a,this._resultPolyList)},i.prototype.computeGeometry=function(a,c,d,_){var M=new G;return M.addAll(a),M.addAll(c),M.addAll(d),M.isEmpty()?i.createEmptyResult(_,this._arg[0].getGeometry(),this._arg[1].getGeometry(),this._geomFact):this._geomFact.buildGeometry(M)},i.prototype.mergeSymLabels=function(){for(var a=this._graph.getNodes().iterator();a.hasNext();)a.next().getEdges().mergeSymLabels()},i.prototype.isCovered=function(a,c){for(var d=c.iterator();d.hasNext();){var _=d.next();if(this._ptLocator.locate(a,_)!==K.EXTERIOR)return!0}return!1},i.prototype.replaceCollapsedEdges=function(){for(var a=new G,c=this._edgeList.iterator();c.hasNext();){var d=c.next();d.isCollapsed()&&(c.remove(),a.add(d.getCollapsedEdge()))}this._edgeList.addAll(a)},i.prototype.updateNodeLabelling=function(){for(var a=this._graph.getNodes().iterator();a.hasNext();){var c=a.next(),d=c.getEdges().getLabel();c.getLabel().merge(d)}},i.prototype.getResultGeometry=function(a){return this.computeOverlay(a),this._resultGeom},i.prototype.insertUniqueEdges=function(a){for(var c=a.iterator();c.hasNext();){var d=c.next();this.insertUniqueEdge(d)}},i.prototype.computeOverlay=function(a){this.copyPoints(0),this.copyPoints(1),this._arg[0].computeSelfNodes(this._li,!1),this._arg[1].computeSelfNodes(this._li,!1),this._arg[0].computeEdgeIntersections(this._arg[1],this._li,!0);var c=new G;this._arg[0].computeSplitEdges(c),this._arg[1].computeSplitEdges(c),this.insertUniqueEdges(c),this.computeLabelsFromDepths(),this.replaceCollapsedEdges(),Ji.checkValid(this._edgeList.getEdges()),this._graph.addEdges(this._edgeList.getEdges()),this.computeLabelling(),this.labelIncompleteNodes(),this.findResultAreaEdges(a),this.cancelDuplicateResultEdges();var d=new Ci(this._geomFact);d.add(this._graph),this._resultPolyList=d.getPolygons();var _=new yo(this,this._geomFact,this._ptLocator);this._resultLineList=_.build(a);var M=new bs(this,this._geomFact,this._ptLocator);this._resultPointList=M.build(a),this._resultGeom=this.computeGeometry(this._resultPointList,this._resultLineList,this._resultPolyList,a)},i.prototype.labelIncompleteNode=function(a,c){var d=this._ptLocator.locate(a.getCoordinate(),this._arg[c].getGeometry());a.getLabel().setLocation(c,d)},i.prototype.copyPoints=function(a){for(var c=this._arg[a].getNodeIterator();c.hasNext();){var d=c.next();this._graph.addNode(d.getCoordinate()).setLabel(a,d.getLabel().getLocation(a))}},i.prototype.findResultAreaEdges=function(a){for(var c=this._graph.getEdgeEnds().iterator();c.hasNext();){var d=c.next(),_=d.getLabel();_.isArea()&&!d.isInteriorAreaEdge()&&i.isResultOfOp(_.getLocation(0,Xt.RIGHT),_.getLocation(1,Xt.RIGHT),a)&&d.setInResult(!0)}},i.prototype.computeLabelsFromDepths=function(){for(var a=this._edgeList.iterator();a.hasNext();){var c=a.next(),d=c.getLabel(),_=c.getDepth();if(!_.isNull()){_.normalize();for(var M=0;M<2;M++)d.isNull(M)||!d.isArea()||_.isNull(M)||(_.getDelta(M)===0?d.toLine(M):(Wt.isTrue(!_.isNull(M,Xt.LEFT),"depth of LEFT side has not been initialized"),d.setLocation(M,Xt.LEFT,_.getLocation(M,Xt.LEFT)),Wt.isTrue(!_.isNull(M,Xt.RIGHT),"depth of RIGHT side has not been initialized"),d.setLocation(M,Xt.RIGHT,_.getLocation(M,Xt.RIGHT))))}}},i.prototype.computeLabelling=function(){for(var a=this._graph.getNodes().iterator();a.hasNext();)a.next().getEdges().computeLabelling(this._arg);this.mergeSymLabels(),this.updateNodeLabelling()},i.prototype.labelIncompleteNodes=function(){for(var a=this._graph.getNodes().iterator();a.hasNext();){var c=a.next(),d=c.getLabel();c.isIsolated()&&(d.isNull(0)?this.labelIncompleteNode(c,0):this.labelIncompleteNode(c,1)),c.getEdges().updateLabelling(d)}},i.prototype.isCoveredByA=function(a){return!!this.isCovered(a,this._resultPolyList)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(ss);Re.overlayOp=function(r,i,a){return new Re(r,i).getResultGeometry(a)},Re.intersection=function(r,i){if(r.isEmpty()||i.isEmpty())return Re.createEmptyResult(Re.INTERSECTION,r,i,r.getFactory());if(r.isGeometryCollection()){var a=i;return Ms.map(r,{interfaces_:function(){return[ya.MapOp]},map:function(c){return c.intersection(a)}})}return r.checkNotGeometryCollection(r),r.checkNotGeometryCollection(i),zr.overlayOp(r,i,Re.INTERSECTION)},Re.symDifference=function(r,i){if(r.isEmpty()||i.isEmpty()){if(r.isEmpty()&&i.isEmpty())return Re.createEmptyResult(Re.SYMDIFFERENCE,r,i,r.getFactory());if(r.isEmpty())return i.copy();if(i.isEmpty())return r.copy()}return r.checkNotGeometryCollection(r),r.checkNotGeometryCollection(i),zr.overlayOp(r,i,Re.SYMDIFFERENCE)},Re.resultDimension=function(r,i,a){var c=i.getDimension(),d=a.getDimension(),_=-1;switch(r){case Re.INTERSECTION:_=Math.min(c,d);break;case Re.UNION:_=Math.max(c,d);break;case Re.DIFFERENCE:_=c;break;case Re.SYMDIFFERENCE:_=Math.max(c,d)}return _},Re.createEmptyResult=function(r,i,a,c){var d=null;switch(Re.resultDimension(r,i,a)){case-1:d=c.createGeometryCollection(new Array(0).fill(null));break;case 0:d=c.createPoint();break;case 1:d=c.createLineString();break;case 2:d=c.createPolygon()}return d},Re.difference=function(r,i){return r.isEmpty()?Re.createEmptyResult(Re.DIFFERENCE,r,i,r.getFactory()):i.isEmpty()?r.copy():(r.checkNotGeometryCollection(r),r.checkNotGeometryCollection(i),zr.overlayOp(r,i,Re.DIFFERENCE))},Re.isResultOfOp=function(){if(arguments.length===2){var r=arguments[0],i=arguments[1],a=r.getLocation(0),c=r.getLocation(1);return Re.isResultOfOp(a,c,i)}if(arguments.length===3){var d=arguments[0],_=arguments[1],M=arguments[2];switch(d===K.BOUNDARY&&(d=K.INTERIOR),_===K.BOUNDARY&&(_=K.INTERIOR),M){case Re.INTERSECTION:return d===K.INTERIOR&&_===K.INTERIOR;case Re.UNION:return d===K.INTERIOR||_===K.INTERIOR;case Re.DIFFERENCE:return d===K.INTERIOR&&_!==K.INTERIOR;case Re.SYMDIFFERENCE:return d===K.INTERIOR&&_!==K.INTERIOR||d!==K.INTERIOR&&_===K.INTERIOR}return!1}},Re.INTERSECTION=1,Re.UNION=2,Re.DIFFERENCE=3,Re.SYMDIFFERENCE=4;var ks=function(){this._g=null,this._boundaryDistanceTolerance=null,this._linework=null,this._ptLocator=new ke,this._seg=new ie;var r=arguments[0],i=arguments[1];this._g=r,this._boundaryDistanceTolerance=i,this._linework=this.extractLinework(r)};ks.prototype.isWithinToleranceOfBoundary=function(r){for(var i=0;i<this._linework.getNumGeometries();i++)for(var a=this._linework.getGeometryN(i).getCoordinateSequence(),c=0;c<a.size()-1;c++)if(a.getCoordinate(c,this._seg.p0),a.getCoordinate(c+1,this._seg.p1),this._seg.distance(r)<=this._boundaryDistanceTolerance)return!0;return!1},ks.prototype.getLocation=function(r){return this.isWithinToleranceOfBoundary(r)?K.BOUNDARY:this._ptLocator.locate(r,this._g)},ks.prototype.extractLinework=function(r){var i=new Mu;r.apply(i);var a=i.getLinework(),c=Le.toLineStringArray(a);return r.getFactory().createMultiLineString(c)},ks.prototype.interfaces_=function(){return[]},ks.prototype.getClass=function(){return ks};var Mu=function(){this._linework=null,this._linework=new G};Mu.prototype.getLinework=function(){return this._linework},Mu.prototype.filter=function(r){if(r instanceof de){var i=r;this._linework.add(i.getExteriorRing());for(var a=0;a<i.getNumInteriorRing();a++)this._linework.add(i.getInteriorRingN(a))}},Mu.prototype.interfaces_=function(){return[pr]},Mu.prototype.getClass=function(){return Mu};var va=function(){this._g=null,this._doLeft=!0,this._doRight=!0;var r=arguments[0];this._g=r};va.prototype.extractPoints=function(r,i,a){for(var c=r.getCoordinates(),d=0;d<c.length-1;d++)this.computeOffsetPoints(c[d],c[d+1],i,a)},va.prototype.setSidesToGenerate=function(r,i){this._doLeft=r,this._doRight=i},va.prototype.getPoints=function(r){for(var i=new G,a=_e.getLines(this._g).iterator();a.hasNext();){var c=a.next();this.extractPoints(c,r,i)}return i},va.prototype.computeOffsetPoints=function(r,i,a,c){var d=i.x-r.x,_=i.y-r.y,M=Math.sqrt(d*d+_*_),L=a*d/M,H=a*_/M,it=(i.x+r.x)/2,bt=(i.y+r.y)/2;if(this._doLeft){var Tt=new D(it-H,bt+L);c.add(Tt)}if(this._doRight){var Kt=new D(it+H,bt-L);c.add(Kt)}},va.prototype.interfaces_=function(){return[]},va.prototype.getClass=function(){return va};var ci=function r(){this._geom=null,this._locFinder=null,this._location=new Array(3).fill(null),this._invalidLocation=null,this._boundaryDistanceTolerance=r.TOLERANCE,this._testCoords=new G;var i=arguments[0],a=arguments[1],c=arguments[2];this._boundaryDistanceTolerance=r.computeBoundaryDistanceTolerance(i,a),this._geom=[i,a,c],this._locFinder=[new ks(this._geom[0],this._boundaryDistanceTolerance),new ks(this._geom[1],this._boundaryDistanceTolerance),new ks(this._geom[2],this._boundaryDistanceTolerance)]},bu={TOLERANCE:{configurable:!0}};ci.prototype.reportResult=function(r,i,a){te.out.println("Overlay result invalid - A:"+K.toLocationSymbol(i[0])+" B:"+K.toLocationSymbol(i[1])+" expected:"+(a?"i":"e")+" actual:"+K.toLocationSymbol(i[2]))},ci.prototype.isValid=function(r){this.addTestPts(this._geom[0]),this.addTestPts(this._geom[1]);var i=this.checkValid(r);return i},ci.prototype.checkValid=function(){if(arguments.length===1){for(var r=arguments[0],i=0;i<this._testCoords.size();i++){var a=this._testCoords.get(i);if(!this.checkValid(r,a))return this._invalidLocation=a,!1}return!0}if(arguments.length===2){var c=arguments[0],d=arguments[1];return this._location[0]=this._locFinder[0].getLocation(d),this._location[1]=this._locFinder[1].getLocation(d),this._location[2]=this._locFinder[2].getLocation(d),!!ci.hasLocation(this._location,K.BOUNDARY)||this.isValidResult(c,this._location)}},ci.prototype.addTestPts=function(r){var i=new va(r);this._testCoords.addAll(i.getPoints(5*this._boundaryDistanceTolerance))},ci.prototype.isValidResult=function(r,i){var a=Re.isResultOfOp(i[0],i[1],r),c=!(a^i[2]===K.INTERIOR);return c||this.reportResult(r,i,a),c},ci.prototype.getInvalidLocation=function(){return this._invalidLocation},ci.prototype.interfaces_=function(){return[]},ci.prototype.getClass=function(){return ci},ci.hasLocation=function(r,i){for(var a=0;a<3;a++)if(r[a]===i)return!0;return!1},ci.computeBoundaryDistanceTolerance=function(r,i){return Math.min(fr.computeSizeBasedSnapTolerance(r),fr.computeSizeBasedSnapTolerance(i))},ci.isValid=function(r,i,a,c){return new ci(r,i,c).isValid(a)},bu.TOLERANCE.get=function(){return 1e-6},Object.defineProperties(ci,bu);var Di=function r(i){this._geomFactory=null,this._skipEmpty=!1,this._inputGeoms=null,this._geomFactory=r.extractFactory(i),this._inputGeoms=i};Di.prototype.extractElements=function(r,i){if(r===null)return null;for(var a=0;a<r.getNumGeometries();a++){var c=r.getGeometryN(a);this._skipEmpty&&c.isEmpty()||i.add(c)}},Di.prototype.combine=function(){for(var r=new G,i=this._inputGeoms.iterator();i.hasNext();){var a=i.next();this.extractElements(a,r)}return r.size()===0?this._geomFactory!==null?this._geomFactory.createGeometryCollection(null):null:this._geomFactory.buildGeometry(r)},Di.prototype.interfaces_=function(){return[]},Di.prototype.getClass=function(){return Di},Di.combine=function(){if(arguments.length===1){var r=arguments[0];return new Di(r).combine()}if(arguments.length===2){var i=arguments[0],a=arguments[1];return new Di(Di.createList(i,a)).combine()}if(arguments.length===3){var c=arguments[0],d=arguments[1],_=arguments[2];return new Di(Di.createList(c,d,_)).combine()}},Di.extractFactory=function(r){return r.isEmpty()?null:r.iterator().next().getFactory()},Di.createList=function(){if(arguments.length===2){var r=arguments[0],i=arguments[1],a=new G;return a.add(r),a.add(i),a}if(arguments.length===3){var c=arguments[0],d=arguments[1],_=arguments[2],M=new G;return M.add(c),M.add(d),M.add(_),M}};var U=function(){this._inputPolys=null,this._geomFactory=null;var r=arguments[0];this._inputPolys=r,this._inputPolys===null&&(this._inputPolys=new G)},Xa={STRTREE_NODE_CAPACITY:{configurable:!0}};U.prototype.reduceToGeometries=function(r){for(var i=new G,a=r.iterator();a.hasNext();){var c=a.next(),d=null;Q(c,Et)?d=this.unionTree(c):c instanceof Vt&&(d=c),i.add(d)}return i},U.prototype.extractByEnvelope=function(r,i,a){for(var c=new G,d=0;d<i.getNumGeometries();d++){var _=i.getGeometryN(d);_.getEnvelopeInternal().intersects(r)?c.add(_):a.add(_)}return this._geomFactory.buildGeometry(c)},U.prototype.unionOptimized=function(r,i){var a=r.getEnvelopeInternal(),c=i.getEnvelopeInternal();if(!a.intersects(c))return Di.combine(r,i);if(r.getNumGeometries()<=1&&i.getNumGeometries()<=1)return this.unionActual(r,i);var d=a.intersection(c);return this.unionUsingEnvelopeIntersection(r,i,d)},U.prototype.union=function(){if(this._inputPolys===null)throw new Error("union() method cannot be called twice");if(this._inputPolys.isEmpty())return null;this._geomFactory=this._inputPolys.iterator().next().getFactory();for(var r=new Mf(U.STRTREE_NODE_CAPACITY),i=this._inputPolys.iterator();i.hasNext();){var a=i.next();r.insert(a.getEnvelopeInternal(),a)}this._inputPolys=null;var c=r.itemsTree();return this.unionTree(c)},U.prototype.binaryUnion=function(){if(arguments.length===1){var r=arguments[0];return this.binaryUnion(r,0,r.size())}if(arguments.length===3){var i=arguments[0],a=arguments[1],c=arguments[2];if(c-a<=1){var d=U.getGeometry(i,a);return this.unionSafe(d,null)}if(c-a==2)return this.unionSafe(U.getGeometry(i,a),U.getGeometry(i,a+1));var _=Math.trunc((c+a)/2),M=this.binaryUnion(i,a,_),L=this.binaryUnion(i,_,c);return this.unionSafe(M,L)}},U.prototype.repeatedUnion=function(r){for(var i=null,a=r.iterator();a.hasNext();){var c=a.next();i=i===null?c.copy():i.union(c)}return i},U.prototype.unionSafe=function(r,i){return r===null&&i===null?null:r===null?i.copy():i===null?r.copy():this.unionOptimized(r,i)},U.prototype.unionActual=function(r,i){return U.restrictToPolygons(r.union(i))},U.prototype.unionTree=function(r){var i=this.reduceToGeometries(r);return this.binaryUnion(i)},U.prototype.unionUsingEnvelopeIntersection=function(r,i,a){var c=new G,d=this.extractByEnvelope(a,r,c),_=this.extractByEnvelope(a,i,c),M=this.unionActual(d,_);return c.add(M),Di.combine(c)},U.prototype.bufferUnion=function(){if(arguments.length===1){var r=arguments[0];return r.get(0).getFactory().buildGeometry(r).buffer(0)}if(arguments.length===2){var i=arguments[0],a=arguments[1];return i.getFactory().createGeometryCollection([i,a]).buffer(0)}},U.prototype.interfaces_=function(){return[]},U.prototype.getClass=function(){return U},U.restrictToPolygons=function(r){if(Q(r,we))return r;var i=se.getPolygons(r);return i.size()===1?i.get(0):r.getFactory().createMultiPolygon(Le.toPolygonArray(i))},U.getGeometry=function(r,i){return i>=r.size()?null:r.get(i)},U.union=function(r){return new U(r).union()},Xa.STRTREE_NODE_CAPACITY.get=function(){return 4},Object.defineProperties(U,Xa);var _a=function(){};_a.prototype.interfaces_=function(){return[]},_a.prototype.getClass=function(){return _a},_a.union=function(r,i){if(r.isEmpty()||i.isEmpty()){if(r.isEmpty()&&i.isEmpty())return Re.createEmptyResult(Re.UNION,r,i,r.getFactory());if(r.isEmpty())return i.copy();if(i.isEmpty())return r.copy()}return r.checkNotGeometryCollection(r),r.checkNotGeometryCollection(i),zr.overlayOp(r,i,Re.UNION)},n.GeoJSONReader=ll,n.GeoJSONWriter=Ua,n.OverlayOp=Re,n.UnionOp=_a,n.BufferOp=Xr,Object.defineProperty(n,"__esModule",{value:!0})})});var e2=st((xf,Bh)=>{(function(){var n,t="4.17.21",e=200,o="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",s="Expected a function",u="Invalid `variable` option passed into `_.template`",p="__lodash_hash_undefined__",f=500,g="__lodash_placeholder__",m=1,v=2,w=4,S=1,b=2,C=1,R=2,x=4,E=8,I=16,A=32,F=64,V=128,X=256,q=512,D=30,xt="...",B=800,j=16,K=1,Dt=2,Q=3,At=1/0,Mt=9007199254740991,Lt=17976931348623157e292,pt=NaN,yt=4294967295,J=yt-1,Bt=yt>>>1,Gt=[["ary",V],["bind",C],["bindKey",R],["curry",E],["curryRight",I],["flip",q],["partial",A],["partialRight",F],["rearg",X]],ae="[object Arguments]",ut="[object Array]",Ut="[object AsyncFunction]",jt="[object Boolean]",ce="[object Date]",te="[object DOMException]",$t="[object Error]",qt="[object Function]",xe="[object GeneratorFunction]",ft="[object Map]",We="[object Number]",ee="[object Null]",ge="[object Object]",fe="[object Promise]",Te="[object Proxy]",be="[object RegExp]",Wt="[object Set]",Me="[object String]",tt="[object Symbol]",z="[object Undefined]",Pt="[object WeakMap]",Ot="[object WeakSet]",dt="[object ArrayBuffer]",Ht="[object DataView]",Ce="[object Float32Array]",Vt="[object Float64Array]",Zt="[object Int8Array]",ne="[object Int16Array]",rt="[object Int32Array]",P="[object Uint8Array]",N="[object Uint8ClampedArray]",k="[object Uint16Array]",$="[object Uint32Array]",W=/\b__p \+= '';/g,ht=/\b(__p \+=) '' \+/g,at=/(__e\(.*?\)|\b__t\)) \+\n'';/g,wt=/&(?:amp|lt|gt|quot|#39);/g,Et=/[&<>"']/g,G=RegExp(wt.source),ot=RegExp(Et.source),et=/<%-([\s\S]+?)%>/g,lt=/<%([\s\S]+?)%>/g,Ft=/<%=([\s\S]+?)%>/g,Jt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,me=/^\w*$/,ve=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,qe=/[\\^$.*+?()[\]{}|]/g,Ue=RegExp(qe.source),Xe=/^\s+/,Je=/\s/,wr=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Kr=/\{\n\/\* \[wrapped with (.+)\] \*/,nr=/,? & /,Ie=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,rr=/[()=,{}\[\]\/\s]/,pr=/\\(\\)?/g,ur=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Qn=/\w*$/,bi=/^[-+]0x[0-9a-f]+$/i,oi=/^0b[01]+$/i,Z=/^\[object .+?Constructor\]$/,mt=/^0o[0-7]+$/i,It=/^(?:0|[1-9]\d*)$/,St=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,vt=/($^)/,he=/['\n\r\u2028\u2029\\]/g,ue="\\ud800-\\udfff",we="\\u0300-\\u036f",de="\\ufe20-\\ufe2f",Be="\\u20d0-\\u20ff",Ae=we+de+Be,Pe="\\u2700-\\u27bf",rn="a-z\\xdf-\\xf6\\xf8-\\xff",si="\\xac\\xb1\\xd7\\xf7",br="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Wi="\\u2000-\\u206f",sr=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",ye="A-Z\\xc0-\\xd6\\xd8-\\xde",Da="\\ufe0e\\ufe0f",on=si+br+Wi+sr,fo="['\u2019]",ul="["+ue+"]",ze="["+on+"]",ys="["+Ae+"]",ir="\\d+",jo="["+Pe+"]",Le="["+rn+"]",Ai="[^"+ue+on+ir+Pe+rn+ye+"]",Fa="\\ud83c[\\udffb-\\udfff]",mu="(?:"+ys+"|"+Fa+")",Ti="[^"+ue+"]",Po="(?:\\ud83c[\\udde6-\\uddff]){2}",ll="[\\ud800-\\udbff][\\udc00-\\udfff]",Ua="["+ye+"]",Xt="\\u200d",cl="(?:"+Le+"|"+Ai+")",Io="(?:"+Ua+"|"+Ai+")",Qo="(?:"+fo+"(?:d|ll|m|re|s|t|ve))?",fl="(?:"+fo+"(?:D|LL|M|RE|S|T|VE))?",Jr=mu+"?",Zn="["+Da+"]?",On="(?:"+Xt+"(?:"+[Ti,Po,ll].join("|")+")"+Zn+Jr+")*",Ar="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",tm="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",zh=Zn+Jr+On,Xi="(?:"+[jo,Po,ll].join("|")+")"+zh,Kl="(?:"+[Ti+ys+"?",ys,Po,ll,ul].join("|")+")",Ro=RegExp(fo,"g"),Yn=RegExp(ys,"g"),Ba=RegExp(Fa+"(?="+Fa+")|"+Kl+zh,"g"),jr=RegExp([Ua+"?"+Le+"+"+Qo+"(?="+[ze,Ua,"$"].join("|")+")",Io+"+"+fl+"(?="+[ze,Ua+cl,"$"].join("|")+")",Ua+"?"+cl+"+"+Qo,Ua+"+"+fl,tm,Ar,ir,Xi].join("|"),"g"),wf=RegExp("["+Xt+ue+Ae+Da+"]"),yu=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,dr=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Ci=-1,or={};or[Ce]=or[Vt]=or[Zt]=or[ne]=or[rt]=or[P]=or[N]=or[k]=or[$]=!0,or[ae]=or[ut]=or[dt]=or[jt]=or[Ht]=or[ce]=or[$t]=or[qt]=or[ft]=or[We]=or[ge]=or[be]=or[Wt]=or[Me]=or[Pt]=!1;var je={};je[ae]=je[ut]=je[dt]=je[Ht]=je[jt]=je[ce]=je[Ce]=je[Vt]=je[Zt]=je[ne]=je[rt]=je[ft]=je[We]=je[ge]=je[be]=je[Wt]=je[Me]=je[tt]=je[P]=je[N]=je[k]=je[$]=!0,je[$t]=je[qt]=je[Pt]=!1;var vs={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},Us={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},za={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},Ir={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Gh=parseFloat,ho=parseInt,Sr=typeof global=="object"&&global&&global.Object===Object&&global,Fr=typeof self=="object"&&self&&self.Object===Object&&self,Ur=Sr||Fr||Function("return this")(),Sf=typeof xf=="object"&&xf&&!xf.nodeType&&xf,Lo=Sf&&typeof Bh=="object"&&Bh&&!Bh.nodeType&&Bh,Mf=Lo&&Lo.exports===Sf,Jl=Mf&&Sr.process,lr=function(){try{var gt=Lo&&Lo.require&&Lo.require("util").types;return gt||Jl&&Jl.binding&&Jl.binding("util")}catch(Nt){}}(),_s=lr&&lr.isArrayBuffer,Qr=lr&&lr.isDate,ua=lr&&lr.isMap,No=lr&&lr.isRegExp,vu=lr&&lr.isSet,mr=lr&&lr.isTypedArray;function ie(gt,Nt,Ct){switch(Ct.length){case 0:return gt.call(Nt);case 1:return gt.call(Nt,Ct[0]);case 2:return gt.call(Nt,Ct[0],Ct[1]);case 3:return gt.call(Nt,Ct[0],Ct[1],Ct[2])}return gt.apply(Nt,Ct)}function kh(gt,Nt,Ct,se){for(var _e=-1,ke=gt==null?0:gt.length;++_e<ke;){var ln=gt[_e];Nt(se,ln,Ct(ln),gt)}return se}function Pi(gt,Nt){for(var Ct=-1,se=gt==null?0:gt.length;++Ct<se&&Nt(gt[Ct],Ct,gt)!==!1;);return gt}function Ii(gt,Nt){for(var Ct=gt==null?0:gt.length;Ct--&&Nt(gt[Ct],Ct,gt)!==!1;);return gt}function po(gt,Nt){for(var Ct=-1,se=gt==null?0:gt.length;++Ct<se;)if(!Nt(gt[Ct],Ct,gt))return!1;return!0}function Yi(gt,Nt){for(var Ct=-1,se=gt==null?0:gt.length,_e=0,ke=[];++Ct<se;){var ln=gt[Ct];Nt(ln,Ct,gt)&&(ke[_e++]=ln)}return ke}function la(gt,Nt){var Ct=gt==null?0:gt.length;return!!Ct&&xs(gt,Nt,0)>-1}function hl(gt,Nt,Ct){for(var se=-1,_e=gt==null?0:gt.length;++se<_e;)if(Ct(Nt,gt[se]))return!0;return!1}function Mr(gt,Nt){for(var Ct=-1,se=gt==null?0:gt.length,_e=Array(se);++Ct<se;)_e[Ct]=Nt(gt[Ct],Ct,gt);return _e}function Ge(gt,Nt){for(var Ct=-1,se=Nt.length,_e=gt.length;++Ct<se;)gt[_e+Ct]=Nt[Ct];return gt}function Oo(gt,Nt,Ct,se){var _e=-1,ke=gt==null?0:gt.length;for(se&&ke&&(Ct=gt[++_e]);++_e<ke;)Ct=Nt(Ct,gt[_e],_e,gt);return Ct}function yr(gt,Nt,Ct,se){var _e=gt==null?0:gt.length;for(se&&_e&&(Ct=gt[--_e]);_e--;)Ct=Nt(Ct,gt[_e],_e,gt);return Ct}function Ga(gt,Nt){for(var Ct=-1,se=gt==null?0:gt.length;++Ct<se;)if(Nt(gt[Ct],Ct,gt))return!0;return!1}var $i=Es("length");function qh(gt){return gt.split("")}function He(gt){return gt.match(Ie)||[]}function ca(gt,Nt,Ct){var se;return Ct(gt,function(_e,ke,ln){if(Nt(_e,ke,ln))return se=ke,!1}),se}function Kn(gt,Nt,Ct,se){for(var _e=gt.length,ke=Ct+(se?1:-1);se?ke--:++ke<_e;)if(Nt(gt[ke],ke,gt))return ke;return-1}function xs(gt,Nt,Ct){return Nt===Nt?pl(gt,Nt,Ct):Kn(gt,fa,Ct)}function pi(gt,Nt,Ct,se){for(var _e=Ct-1,ke=gt.length;++_e<ke;)if(se(gt[_e],Nt))return _e;return-1}function fa(gt){return gt!==gt}function bf(gt,Nt){var Ct=gt==null?0:gt.length;return Ct?go(gt,Nt)/Ct:pt}function Es(gt){return function(Nt){return Nt==null?n:Nt[gt]}}function Ze(gt){return function(Nt){return gt==null?n:gt[Nt]}}function Zi(gt,Nt,Ct,se,_e){return _e(gt,function(ke,ln,cr){Ct=se?(se=!1,ke):Nt(Ct,ke,ln,cr)}),Ct}function _u(gt,Nt){var Ct=gt.length;for(gt.sort(Nt);Ct--;)gt[Ct]=gt[Ct].value;return gt}function go(gt,Nt){for(var Ct,se=-1,_e=gt.length;++se<_e;){var ke=Nt(gt[se]);ke!==n&&(Ct=Ct===n?ke:Ct+ke)}return Ct}function di(gt,Nt){for(var Ct=-1,se=Array(gt);++Ct<gt;)se[Ct]=Nt(Ct);return se}function ti(gt,Nt){return Mr(Nt,function(Ct){return[Ct,gt[Ct]]})}function Hh(gt){return gt&&gt.slice(0,pa(gt)+1).replace(Xe,"")}function io(gt){return function(Nt){return gt(Nt)}}function ts(gt,Nt){return Mr(Nt,function(Ct){return gt[Ct]})}function gi(gt,Nt){return gt.has(Nt)}function Bs(gt,Nt){for(var Ct=-1,se=gt.length;++Ct<se&&xs(Nt,gt[Ct],0)>-1;);return Ct}function Ri(gt,Nt){for(var Ct=gt.length;Ct--&&xs(Nt,gt[Ct],0)>-1;);return Ct}function Do(gt,Nt){for(var Ct=gt.length,se=0;Ct--;)gt[Ct]===Nt&&++se;return se}var es=Ze(vs),ha=Ze(Us);function ws(gt){return"\\"+Ir[gt]}function Vr(gt,Nt){return gt==null?n:gt[Nt]}function ka(gt){return wf.test(gt)}function jl(gt){return yu.test(gt)}function ai(gt){for(var Nt,Ct=[];!(Nt=gt.next()).done;)Ct.push(Nt.value);return Ct}function ns(gt){var Nt=-1,Ct=Array(gt.size);return gt.forEach(function(se,_e){Ct[++Nt]=[_e,se]}),Ct}function mo(gt,Nt){return function(Ct){return gt(Nt(Ct))}}function zs(gt,Nt){for(var Ct=-1,se=gt.length,_e=0,ke=[];++Ct<se;){var ln=gt[Ct];(ln===Nt||ln===g)&&(gt[Ct]=g,ke[_e++]=Ct)}return ke}function Wr(gt){var Nt=-1,Ct=Array(gt.size);return gt.forEach(function(se){Ct[++Nt]=se}),Ct}function Vh(gt){var Nt=-1,Ct=Array(gt.size);return gt.forEach(function(se){Ct[++Nt]=[se,se]}),Ct}function pl(gt,Nt,Ct){for(var se=Ct-1,_e=gt.length;++se<_e;)if(gt[se]===Nt)return se;return-1}function xu(gt,Nt,Ct){for(var se=Ct+1;se--;)if(gt[se]===Nt)return se;return se}function qa(gt){return ka(gt)?Xr(gt):$i(gt)}function Fo(gt){return ka(gt)?Eu(gt):qh(gt)}function pa(gt){for(var Nt=gt.length;Nt--&&Je.test(gt.charAt(Nt)););return Nt}var rs=Ze(za);function Xr(gt){for(var Nt=Ba.lastIndex=0;Ba.test(gt);)++Nt;return Nt}function Eu(gt){return gt.match(Ba)||[]}function ui(gt){return gt.match(jr)||[]}var is=function gt(Nt){Nt=Nt==null?Ur:Ki.defaults(Ur.Object(),Nt,Ki.pick(Ur,dr));var Ct=Nt.Array,se=Nt.Date,_e=Nt.Error,ke=Nt.Function,ln=Nt.Math,cr=Nt.Object,os=Nt.RegExp,Ha=Nt.String,tr=Nt.TypeError,Nr=Ct.prototype,Uo=ke.prototype,ei=cr.prototype,wu=Nt["__core-js_shared__"],Ss=Uo.toString,sn=ei.hasOwnProperty,Li=0,Ql=function(){var l=/[^.]+$/.exec(wu&&wu.keys&&wu.keys.IE_PROTO||"");return l?"Symbol(src)_1."+l:""}(),Rr=ei.toString,Af=Ss.call(cr),Bo=Ur._,Br=os("^"+Ss.call(sn).replace(qe,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ni=Mf?Nt.Buffer:n,Ji=Nt.Symbol,Ms=Nt.Uint8Array,yo=Ni?Ni.allocUnsafe:n,bs=mo(cr.getPrototypeOf,cr),li=cr.create,zo=ei.propertyIsEnumerable,fr=Nr.splice,Tf=Ji?Ji.isConcatSpreadable:n,Su=Ji?Ji.iterator:n,Tr=Ji?Ji.toStringTag:n,Go=function(){try{var l=vl(cr,"defineProperty");return l({},"",{}),l}catch(h){}}(),Cf=Nt.clearTimeout!==Ur.clearTimeout&&Nt.clearTimeout,Va=se&&se.now!==Ur.Date.now&&se.now,Gs=Nt.setTimeout!==Ur.setTimeout&&Nt.setTimeout,Cr=ln.ceil,zr=ln.floor,Wa=cr.getOwnPropertySymbols,Oi=Ni?Ni.isBuffer:n,tc=Nt.isFinite,ec=Nr.join,Yr=mo(cr.keys,cr),ni=ln.max,vr=ln.min,Wh=se.now,dl=Nt.parseInt,Xh=ln.random,em=Nr.reverse,vo=vl(Nt,"DataView"),As=vl(Nt,"Map"),da=vl(Nt,"Promise"),ga=vl(Nt,"Set"),Ts=vl(Nt,"WeakMap"),ko=vl(cr,"create"),ma=Ts&&new Ts,ss={},ya=_l(vo),Re=_l(As),ks=_l(da),Mu=_l(ga),va=_l(Ts),ci=Ji?Ji.prototype:n,bu=ci?ci.valueOf:n,Di=ci?ci.toString:n;function U(l){if($r(l)&&!Ve(l)&&!(l instanceof i)){if(l instanceof r)return l;if(sn.call(l,"__wrapped__"))return kx(l)}return new r(l)}var Xa=function(){function l(){}return function(h){if(!Gr(h))return{};if(li)return li(h);l.prototype=h;var y=new l;return l.prototype=n,y}}();function _a(){}function r(l,h){this.__wrapped__=l,this.__actions__=[],this.__chain__=!!h,this.__index__=0,this.__values__=n}U.templateSettings={escape:et,evaluate:lt,interpolate:Ft,variable:"",imports:{_:U}},U.prototype=_a.prototype,U.prototype.constructor=U,r.prototype=Xa(_a.prototype),r.prototype.constructor=r;function i(l){this.__wrapped__=l,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=yt,this.__views__=[]}function a(){var l=new i(this.__wrapped__);return l.__actions__=qo(this.__actions__),l.__dir__=this.__dir__,l.__filtered__=this.__filtered__,l.__iteratees__=qo(this.__iteratees__),l.__takeCount__=this.__takeCount__,l.__views__=qo(this.__views__),l}function c(){if(this.__filtered__){var l=new i(this);l.__dir__=-1,l.__filtered__=!0}else l=this.clone(),l.__dir__*=-1;return l}function d(){var l=this.__wrapped__.value(),h=this.__dir__,y=Ve(l),T=h<0,O=y?l.length:0,Y=Q2(0,O,this.__views__),nt=Y.start,ct=Y.end,_t=ct-nt,zt=T?ct:nt-1,kt=this.__iteratees__,Yt=kt.length,pe=0,Se=vr(_t,this.__takeCount__);if(!y||!T&&O==_t&&Se==_t)return cx(l,this.__actions__);var De=[];t:for(;_t--&&pe<Se;){zt+=h;for(var Qe=-1,Fe=l[zt];++Qe<Yt;){var Fn=kt[Qe],$n=Fn.iteratee,cs=Fn.type,Eo=$n(Fe);if(cs==Dt)Fe=Eo;else if(!Eo){if(cs==K)continue t;break t}}De[pe++]=Fe}return De}i.prototype=Xa(_a.prototype),i.prototype.constructor=i;function _(l){var h=-1,y=l==null?0:l.length;for(this.clear();++h<y;){var T=l[h];this.set(T[0],T[1])}}function M(){this.__data__=ko?ko(null):{},this.size=0}function L(l){var h=this.has(l)&&delete this.__data__[l];return this.size-=h?1:0,h}function H(l){var h=this.__data__;if(ko){var y=h[l];return y===p?n:y}return sn.call(h,l)?h[l]:n}function it(l){var h=this.__data__;return ko?h[l]!==n:sn.call(h,l)}function bt(l,h){var y=this.__data__;return this.size+=this.has(l)?0:1,y[l]=ko&&h===n?p:h,this}_.prototype.clear=M,_.prototype.delete=L,_.prototype.get=H,_.prototype.has=it,_.prototype.set=bt;function Tt(l){var h=-1,y=l==null?0:l.length;for(this.clear();++h<y;){var T=l[h];this.set(T[0],T[1])}}function Kt(){this.__data__=[],this.size=0}function Qt(l){var h=this.__data__,y=Yh(h,l);if(y<0)return!1;var T=h.length-1;return y==T?h.pop():fr.call(h,y,1),--this.size,!0}function le(l){var h=this.__data__,y=Yh(h,l);return y<0?n:h[y][1]}function Ee(l){return Yh(this.__data__,l)>-1}function Dn(l,h){var y=this.__data__,T=Yh(y,l);return T<0?(++this.size,y.push([l,h])):y[T][1]=h,this}Tt.prototype.clear=Kt,Tt.prototype.delete=Qt,Tt.prototype.get=le,Tt.prototype.has=Ee,Tt.prototype.set=Dn;function Jn(l){var h=-1,y=l==null?0:l.length;for(this.clear();++h<y;){var T=l[h];this.set(T[0],T[1])}}function fi(){this.size=0,this.__data__={hash:new _,map:new(As||Tt),string:new _}}function as(l){var h=op(this,l).delete(l);return this.size-=h?1:0,h}function qs(l){return op(this,l).get(l)}function Pf(l){return op(this,l).has(l)}function n2(l,h){var y=op(this,l),T=y.size;return y.set(l,h),this.size+=y.size==T?0:1,this}Jn.prototype.clear=fi,Jn.prototype.delete=as,Jn.prototype.get=qs,Jn.prototype.has=Pf,Jn.prototype.set=n2;function gl(l){var h=-1,y=l==null?0:l.length;for(this.__data__=new Jn;++h<y;)this.add(l[h])}function r2(l){return this.__data__.set(l,p),this}function i2(l){return this.__data__.has(l)}gl.prototype.add=gl.prototype.push=r2,gl.prototype.has=i2;function Hs(l){var h=this.__data__=new Tt(l);this.size=h.size}function o2(){this.__data__=new Tt,this.size=0}function s2(l){var h=this.__data__,y=h.delete(l);return this.size=h.size,y}function a2(l){return this.__data__.get(l)}function u2(l){return this.__data__.has(l)}function l2(l,h){var y=this.__data__;if(y instanceof Tt){var T=y.__data__;if(!As||T.length<e-1)return T.push([l,h]),this.size=++y.size,this;y=this.__data__=new Jn(T)}return y.set(l,h),this.size=y.size,this}Hs.prototype.clear=o2,Hs.prototype.delete=s2,Hs.prototype.get=a2,Hs.prototype.has=u2,Hs.prototype.set=l2;function k1(l,h){var y=Ve(l),T=!y&&xl(l),O=!y&&!T&&Iu(l),Y=!y&&!T&&!O&&oc(l),nt=y||T||O||Y,ct=nt?di(l.length,Ha):[],_t=ct.length;for(var zt in l)(h||sn.call(l,zt))&&!(nt&&(zt=="length"||O&&(zt=="offset"||zt=="parent")||Y&&(zt=="buffer"||zt=="byteLength"||zt=="byteOffset")||Ka(zt,_t)))&&ct.push(zt);return ct}function q1(l){var h=l.length;return h?l[hm(0,h-1)]:n}function c2(l,h){return sp(qo(l),ml(h,0,l.length))}function f2(l){return sp(qo(l))}function nm(l,h,y){(y!==n&&!Vs(l[h],y)||y===n&&!(h in l))&&Ya(l,h,y)}function If(l,h,y){var T=l[h];(!(sn.call(l,h)&&Vs(T,y))||y===n&&!(h in l))&&Ya(l,h,y)}function Yh(l,h){for(var y=l.length;y--;)if(Vs(l[y][0],h))return y;return-1}function h2(l,h,y,T){return Au(l,function(O,Y,nt){h(T,O,y(O),nt)}),T}function H1(l,h){return l&&Ea(h,Fi(h),l)}function p2(l,h){return l&&Ea(h,Vo(h),l)}function Ya(l,h,y){h=="__proto__"&&Go?Go(l,h,{configurable:!0,enumerable:!0,value:y,writable:!0}):l[h]=y}function rm(l,h){for(var y=-1,T=h.length,O=Ct(T),Y=l==null;++y<T;)O[y]=Y?n:Um(l,h[y]);return O}function ml(l,h,y){return l===l&&(y!==n&&(l=l<=y?l:y),h!==n&&(l=l>=h?l:h)),l}function Cs(l,h,y,T,O,Y){var nt,ct=h&m,_t=h&v,zt=h&w;if(y&&(nt=O?y(l,T,O,Y):y(l)),nt!==n)return nt;if(!Gr(l))return l;var kt=Ve(l);if(kt){if(nt=eO(l),!ct)return qo(l,nt)}else{var Yt=oo(l),pe=Yt==qt||Yt==xe;if(Iu(l))return px(l,ct);if(Yt==ge||Yt==ae||pe&&!O){if(nt=_t||pe?{}:Lx(l),!ct)return _t?V2(l,p2(nt,l)):H2(l,H1(nt,l))}else{if(!je[Yt])return O?l:{};nt=nO(l,Yt,ct)}}Y||(Y=new Hs);var Se=Y.get(l);if(Se)return Se;Y.set(l,nt),aE(l)?l.forEach(function(Fe){nt.add(Cs(Fe,h,y,Fe,l,Y))}):oE(l)&&l.forEach(function(Fe,Fn){nt.set(Fn,Cs(Fe,h,y,Fn,l,Y))});var De=zt?_t?Sm:wm:_t?Vo:Fi,Qe=kt?n:De(l);return Pi(Qe||l,function(Fe,Fn){Qe&&(Fn=Fe,Fe=l[Fn]),If(nt,Fn,Cs(Fe,h,y,Fn,l,Y))}),nt}function d2(l){var h=Fi(l);return function(y){return V1(y,l,h)}}function V1(l,h,y){var T=y.length;if(l==null)return!T;for(l=cr(l);T--;){var O=y[T],Y=h[O],nt=l[O];if(nt===n&&!(O in l)||!Y(nt))return!1}return!0}function W1(l,h,y){if(typeof l!="function")throw new tr(s);return Uf(function(){l.apply(n,y)},h)}function Rf(l,h,y,T){var O=-1,Y=la,nt=!0,ct=l.length,_t=[],zt=h.length;if(!ct)return _t;y&&(h=Mr(h,io(y))),T?(Y=hl,nt=!1):h.length>=e&&(Y=gi,nt=!1,h=new gl(h));t:for(;++O<ct;){var kt=l[O],Yt=y==null?kt:y(kt);if(kt=T||kt!==0?kt:0,nt&&Yt===Yt){for(var pe=zt;pe--;)if(h[pe]===Yt)continue t;_t.push(kt)}else Y(h,Yt,T)||_t.push(kt)}return _t}var Au=vx(xa),X1=vx(om,!0);function g2(l,h){var y=!0;return Au(l,function(T,O,Y){return y=!!h(T,O,Y),y}),y}function $h(l,h,y){for(var T=-1,O=l.length;++T<O;){var Y=l[T],nt=h(Y);if(nt!=null&&(ct===n?nt===nt&&!ls(nt):y(nt,ct)))var ct=nt,_t=Y}return _t}function m2(l,h,y,T){var O=l.length;for(y=Ke(y),y<0&&(y=-y>O?0:O+y),T=T===n||T>O?O:Ke(T),T<0&&(T+=O),T=y>T?0:lE(T);y<T;)l[y++]=h;return l}function Y1(l,h){var y=[];return Au(l,function(T,O,Y){h(T,O,Y)&&y.push(T)}),y}function ji(l,h,y,T,O){var Y=-1,nt=l.length;for(y||(y=iO),O||(O=[]);++Y<nt;){var ct=l[Y];h>0&&y(ct)?h>1?ji(ct,h-1,y,T,O):Ge(O,ct):T||(O[O.length]=ct)}return O}var im=_x(),$1=_x(!0);function xa(l,h){return l&&im(l,h,Fi)}function om(l,h){return l&&$1(l,h,Fi)}function Zh(l,h){return Yi(h,function(y){return Ja(l[y])})}function yl(l,h){h=Cu(h,l);for(var y=0,T=h.length;l!=null&&y<T;)l=l[wa(h[y++])];return y&&y==T?l:n}function Z1(l,h,y){var T=h(l);return Ve(l)?T:Ge(T,y(l))}function _o(l){return l==null?l===n?z:ee:Tr&&Tr in cr(l)?j2(l):fO(l)}function sm(l,h){return l>h}function y2(l,h){return l!=null&&sn.call(l,h)}function v2(l,h){return l!=null&&h in cr(l)}function _2(l,h,y){return l>=vr(h,y)&&l<ni(h,y)}function am(l,h,y){for(var T=y?hl:la,O=l[0].length,Y=l.length,nt=Y,ct=Ct(Y),_t=1/0,zt=[];nt--;){var kt=l[nt];nt&&h&&(kt=Mr(kt,io(h))),_t=vr(kt.length,_t),ct[nt]=!y&&(h||O>=120&&kt.length>=120)?new gl(nt&&kt):n}kt=l[0];var Yt=-1,pe=ct[0];t:for(;++Yt<O&&zt.length<_t;){var Se=kt[Yt],De=h?h(Se):Se;if(Se=y||Se!==0?Se:0,!(pe?gi(pe,De):T(zt,De,y))){for(nt=Y;--nt;){var Qe=ct[nt];if(!(Qe?gi(Qe,De):T(l[nt],De,y)))continue t}pe&&pe.push(De),zt.push(Se)}}return zt}function x2(l,h,y,T){return xa(l,function(O,Y,nt){h(T,y(O),Y,nt)}),T}function Lf(l,h,y){h=Cu(h,l),l=Fx(l,h);var T=l==null?l:l[wa(Is(h))];return T==null?n:ie(T,l,y)}function K1(l){return $r(l)&&_o(l)==ae}function E2(l){return $r(l)&&_o(l)==dt}function w2(l){return $r(l)&&_o(l)==ce}function Nf(l,h,y,T,O){return l===h?!0:l==null||h==null||!$r(l)&&!$r(h)?l!==l&&h!==h:S2(l,h,y,T,Nf,O)}function S2(l,h,y,T,O,Y){var nt=Ve(l),ct=Ve(h),_t=nt?ut:oo(l),zt=ct?ut:oo(h);_t=_t==ae?ge:_t,zt=zt==ae?ge:zt;var kt=_t==ge,Yt=zt==ge,pe=_t==zt;if(pe&&Iu(l)){if(!Iu(h))return!1;nt=!0,kt=!1}if(pe&&!kt)return Y||(Y=new Hs),nt||oc(l)?Px(l,h,y,T,O,Y):K2(l,h,_t,y,T,O,Y);if(!(y&S)){var Se=kt&&sn.call(l,"__wrapped__"),De=Yt&&sn.call(h,"__wrapped__");if(Se||De){var Qe=Se?l.value():l,Fe=De?h.value():h;return Y||(Y=new Hs),O(Qe,Fe,y,T,Y)}}return pe?(Y||(Y=new Hs),J2(l,h,y,T,O,Y)):!1}function M2(l){return $r(l)&&oo(l)==ft}function um(l,h,y,T){var O=y.length,Y=O,nt=!T;if(l==null)return!Y;for(l=cr(l);O--;){var ct=y[O];if(nt&&ct[2]?ct[1]!==l[ct[0]]:!(ct[0]in l))return!1}for(;++O<Y;){ct=y[O];var _t=ct[0],zt=l[_t],kt=ct[1];if(nt&&ct[2]){if(zt===n&&!(_t in l))return!1}else{var Yt=new Hs;if(T)var pe=T(zt,kt,_t,l,h,Yt);if(!(pe===n?Nf(kt,zt,S|b,T,Yt):pe))return!1}}return!0}function J1(l){if(!Gr(l)||sO(l))return!1;var h=Ja(l)?Br:Z;return h.test(_l(l))}function b2(l){return $r(l)&&_o(l)==be}function A2(l){return $r(l)&&oo(l)==Wt}function T2(l){return $r(l)&&hp(l.length)&&!!or[_o(l)]}function j1(l){return typeof l=="function"?l:l==null?Wo:typeof l=="object"?Ve(l)?ex(l[0],l[1]):tx(l):xE(l)}function lm(l){if(!Ff(l))return Yr(l);var h=[];for(var y in cr(l))sn.call(l,y)&&y!="constructor"&&h.push(y);return h}function C2(l){if(!Gr(l))return cO(l);var h=Ff(l),y=[];for(var T in l)T=="constructor"&&(h||!sn.call(l,T))||y.push(T);return y}function cm(l,h){return l<h}function Q1(l,h){var y=-1,T=Ho(l)?Ct(l.length):[];return Au(l,function(O,Y,nt){T[++y]=h(O,Y,nt)}),T}function tx(l){var h=bm(l);return h.length==1&&h[0][2]?Ox(h[0][0],h[0][1]):function(y){return y===l||um(y,l,h)}}function ex(l,h){return Tm(l)&&Nx(h)?Ox(wa(l),h):function(y){var T=Um(y,l);return T===n&&T===h?Bm(y,l):Nf(h,T,S|b)}}function Kh(l,h,y,T,O){l!==h&&im(h,function(Y,nt){if(O||(O=new Hs),Gr(Y))P2(l,h,nt,y,Kh,T,O);else{var ct=T?T(Pm(l,nt),Y,nt+"",l,h,O):n;ct===n&&(ct=Y),nm(l,nt,ct)}},Vo)}function P2(l,h,y,T,O,Y,nt){var ct=Pm(l,y),_t=Pm(h,y),zt=nt.get(_t);if(zt){nm(l,y,zt);return}var kt=Y?Y(ct,_t,y+"",l,h,nt):n,Yt=kt===n;if(Yt){var pe=Ve(_t),Se=!pe&&Iu(_t),De=!pe&&!Se&&oc(_t);kt=_t,pe||Se||De?Ve(ct)?kt=ct:ri(ct)?kt=qo(ct):Se?(Yt=!1,kt=px(_t,!0)):De?(Yt=!1,kt=dx(_t,!0)):kt=[]:Bf(_t)||xl(_t)?(kt=ct,xl(ct)?kt=cE(ct):(!Gr(ct)||Ja(ct))&&(kt=Lx(_t))):Yt=!1}Yt&&(nt.set(_t,kt),O(kt,_t,T,Y,nt),nt.delete(_t)),nm(l,y,kt)}function nx(l,h){var y=l.length;if(y)return h+=h<0?y:0,Ka(h,y)?l[h]:n}function rx(l,h,y){h.length?h=Mr(h,function(Y){return Ve(Y)?function(nt){return yl(nt,Y.length===1?Y[0]:Y)}:Y}):h=[Wo];var T=-1;h=Mr(h,io(Ne()));var O=Q1(l,function(Y,nt,ct){var _t=Mr(h,function(zt){return zt(Y)});return{criteria:_t,index:++T,value:Y}});return _u(O,function(Y,nt){return q2(Y,nt,y)})}function I2(l,h){return ix(l,h,function(y,T){return Bm(l,T)})}function ix(l,h,y){for(var T=-1,O=h.length,Y={};++T<O;){var nt=h[T],ct=yl(l,nt);y(ct,nt)&&Of(Y,Cu(nt,l),ct)}return Y}function R2(l){return function(h){return yl(h,l)}}function fm(l,h,y,T){var O=T?pi:xs,Y=-1,nt=h.length,ct=l;for(l===h&&(h=qo(h)),y&&(ct=Mr(l,io(y)));++Y<nt;)for(var _t=0,zt=h[Y],kt=y?y(zt):zt;(_t=O(ct,kt,_t,T))>-1;)ct!==l&&fr.call(ct,_t,1),fr.call(l,_t,1);return l}function ox(l,h){for(var y=l?h.length:0,T=y-1;y--;){var O=h[y];if(y==T||O!==Y){var Y=O;Ka(O)?fr.call(l,O,1):gm(l,O)}}return l}function hm(l,h){return l+zr(Xh()*(h-l+1))}function L2(l,h,y,T){for(var O=-1,Y=ni(Cr((h-l)/(y||1)),0),nt=Ct(Y);Y--;)nt[T?Y:++O]=l,l+=y;return nt}function pm(l,h){var y="";if(!l||h<1||h>Mt)return y;do h%2&&(y+=l),h=zr(h/2),h&&(l+=l);while(h);return y}function an(l,h){return Im(Dx(l,h,Wo),l+"")}function N2(l){return q1(sc(l))}function O2(l,h){var y=sc(l);return sp(y,ml(h,0,y.length))}function Of(l,h,y,T){if(!Gr(l))return l;h=Cu(h,l);for(var O=-1,Y=h.length,nt=Y-1,ct=l;ct!=null&&++O<Y;){var _t=wa(h[O]),zt=y;if(_t==="__proto__"||_t==="constructor"||_t==="prototype")return l;if(O!=nt){var kt=ct[_t];zt=T?T(kt,_t,ct):n,zt===n&&(zt=Gr(kt)?kt:Ka(h[O+1])?[]:{})}If(ct,_t,zt),ct=ct[_t]}return l}var sx=ma?function(l,h){return ma.set(l,h),l}:Wo,D2=Go?function(l,h){return Go(l,"toString",{configurable:!0,enumerable:!1,value:Gm(h),writable:!0})}:Wo;function F2(l){return sp(sc(l))}function Ps(l,h,y){var T=-1,O=l.length;h<0&&(h=-h>O?0:O+h),y=y>O?O:y,y<0&&(y+=O),O=h>y?0:y-h>>>0,h>>>=0;for(var Y=Ct(O);++T<O;)Y[T]=l[T+h];return Y}function U2(l,h){var y;return Au(l,function(T,O,Y){return y=h(T,O,Y),!y}),!!y}function Jh(l,h,y){var T=0,O=l==null?T:l.length;if(typeof h=="number"&&h===h&&O<=Bt){for(;T<O;){var Y=T+O>>>1,nt=l[Y];nt!==null&&!ls(nt)&&(y?nt<=h:nt<h)?T=Y+1:O=Y}return O}return dm(l,h,Wo,y)}function dm(l,h,y,T){var O=0,Y=l==null?0:l.length;if(Y===0)return 0;h=y(h);for(var nt=h!==h,ct=h===null,_t=ls(h),zt=h===n;O<Y;){var kt=zr((O+Y)/2),Yt=y(l[kt]),pe=Yt!==n,Se=Yt===null,De=Yt===Yt,Qe=ls(Yt);if(nt)var Fe=T||De;else zt?Fe=De&&(T||pe):ct?Fe=De&&pe&&(T||!Se):_t?Fe=De&&pe&&!Se&&(T||!Qe):Se||Qe?Fe=!1:Fe=T?Yt<=h:Yt<h;Fe?O=kt+1:Y=kt}return vr(Y,J)}function ax(l,h){for(var y=-1,T=l.length,O=0,Y=[];++y<T;){var nt=l[y],ct=h?h(nt):nt;if(!y||!Vs(ct,_t)){var _t=ct;Y[O++]=nt===0?0:nt}}return Y}function ux(l){return typeof l=="number"?l:ls(l)?pt:+l}function us(l){if(typeof l=="string")return l;if(Ve(l))return Mr(l,us)+"";if(ls(l))return Di?Di.call(l):"";var h=l+"";return h=="0"&&1/l==-At?"-0":h}function Tu(l,h,y){var T=-1,O=la,Y=l.length,nt=!0,ct=[],_t=ct;if(y)nt=!1,O=hl;else if(Y>=e){var zt=h?null:$2(l);if(zt)return Wr(zt);nt=!1,O=gi,_t=new gl}else _t=h?[]:ct;t:for(;++T<Y;){var kt=l[T],Yt=h?h(kt):kt;if(kt=y||kt!==0?kt:0,nt&&Yt===Yt){for(var pe=_t.length;pe--;)if(_t[pe]===Yt)continue t;h&&_t.push(Yt),ct.push(kt)}else O(_t,Yt,y)||(_t!==ct&&_t.push(Yt),ct.push(kt))}return ct}function gm(l,h){return h=Cu(h,l),l=Fx(l,h),l==null||delete l[wa(Is(h))]}function lx(l,h,y,T){return Of(l,h,y(yl(l,h)),T)}function jh(l,h,y,T){for(var O=l.length,Y=T?O:-1;(T?Y--:++Y<O)&&h(l[Y],Y,l););return y?Ps(l,T?0:Y,T?Y+1:O):Ps(l,T?Y+1:0,T?O:Y)}function cx(l,h){var y=l;return y instanceof i&&(y=y.value()),Oo(h,function(T,O){return O.func.apply(O.thisArg,Ge([T],O.args))},y)}function mm(l,h,y){var T=l.length;if(T<2)return T?Tu(l[0]):[];for(var O=-1,Y=Ct(T);++O<T;)for(var nt=l[O],ct=-1;++ct<T;)ct!=O&&(Y[O]=Rf(Y[O]||nt,l[ct],h,y));return Tu(ji(Y,1),h,y)}function fx(l,h,y){for(var T=-1,O=l.length,Y=h.length,nt={};++T<O;){var ct=T<Y?h[T]:n;y(nt,l[T],ct)}return nt}function ym(l){return ri(l)?l:[]}function vm(l){return typeof l=="function"?l:Wo}function Cu(l,h){return Ve(l)?l:Tm(l,h)?[l]:Gx(hr(l))}var B2=an;function Pu(l,h,y){var T=l.length;return y=y===n?T:y,!h&&y>=T?l:Ps(l,h,y)}var hx=Cf||function(l){return Ur.clearTimeout(l)};function px(l,h){if(h)return l.slice();var y=l.length,T=yo?yo(y):new l.constructor(y);return l.copy(T),T}function _m(l){var h=new l.constructor(l.byteLength);return new Ms(h).set(new Ms(l)),h}function z2(l,h){var y=h?_m(l.buffer):l.buffer;return new l.constructor(y,l.byteOffset,l.byteLength)}function G2(l){var h=new l.constructor(l.source,Qn.exec(l));return h.lastIndex=l.lastIndex,h}function k2(l){return bu?cr(bu.call(l)):{}}function dx(l,h){var y=h?_m(l.buffer):l.buffer;return new l.constructor(y,l.byteOffset,l.length)}function gx(l,h){if(l!==h){var y=l!==n,T=l===null,O=l===l,Y=ls(l),nt=h!==n,ct=h===null,_t=h===h,zt=ls(h);if(!ct&&!zt&&!Y&&l>h||Y&&nt&&_t&&!ct&&!zt||T&&nt&&_t||!y&&_t||!O)return 1;if(!T&&!Y&&!zt&&l<h||zt&&y&&O&&!T&&!Y||ct&&y&&O||!nt&&O||!_t)return-1}return 0}function q2(l,h,y){for(var T=-1,O=l.criteria,Y=h.criteria,nt=O.length,ct=y.length;++T<nt;){var _t=gx(O[T],Y[T]);if(_t){if(T>=ct)return _t;var zt=y[T];return _t*(zt=="desc"?-1:1)}}return l.index-h.index}function mx(l,h,y,T){for(var O=-1,Y=l.length,nt=y.length,ct=-1,_t=h.length,zt=ni(Y-nt,0),kt=Ct(_t+zt),Yt=!T;++ct<_t;)kt[ct]=h[ct];for(;++O<nt;)(Yt||O<Y)&&(kt[y[O]]=l[O]);for(;zt--;)kt[ct++]=l[O++];return kt}function yx(l,h,y,T){for(var O=-1,Y=l.length,nt=-1,ct=y.length,_t=-1,zt=h.length,kt=ni(Y-ct,0),Yt=Ct(kt+zt),pe=!T;++O<kt;)Yt[O]=l[O];for(var Se=O;++_t<zt;)Yt[Se+_t]=h[_t];for(;++nt<ct;)(pe||O<Y)&&(Yt[Se+y[nt]]=l[O++]);return Yt}function qo(l,h){var y=-1,T=l.length;for(h||(h=Ct(T));++y<T;)h[y]=l[y];return h}function Ea(l,h,y,T){var O=!y;y||(y={});for(var Y=-1,nt=h.length;++Y<nt;){var ct=h[Y],_t=T?T(y[ct],l[ct],ct,y,l):n;_t===n&&(_t=l[ct]),O?Ya(y,ct,_t):If(y,ct,_t)}return y}function H2(l,h){return Ea(l,Am(l),h)}function V2(l,h){return Ea(l,Ix(l),h)}function Qh(l,h){return function(y,T){var O=Ve(y)?kh:h2,Y=h?h():{};return O(y,l,Ne(T,2),Y)}}function nc(l){return an(function(h,y){var T=-1,O=y.length,Y=O>1?y[O-1]:n,nt=O>2?y[2]:n;for(Y=l.length>3&&typeof Y=="function"?(O--,Y):n,nt&&xo(y[0],y[1],nt)&&(Y=O<3?n:Y,O=1),h=cr(h);++T<O;){var ct=y[T];ct&&l(h,ct,T,Y)}return h})}function vx(l,h){return function(y,T){if(y==null)return y;if(!Ho(y))return l(y,T);for(var O=y.length,Y=h?O:-1,nt=cr(y);(h?Y--:++Y<O)&&T(nt[Y],Y,nt)!==!1;);return y}}function _x(l){return function(h,y,T){for(var O=-1,Y=cr(h),nt=T(h),ct=nt.length;ct--;){var _t=nt[l?ct:++O];if(y(Y[_t],_t,Y)===!1)break}return h}}function W2(l,h,y){var T=h&C,O=Df(l);function Y(){var nt=this&&this!==Ur&&this instanceof Y?O:l;return nt.apply(T?y:this,arguments)}return Y}function xx(l){return function(h){h=hr(h);var y=ka(h)?Fo(h):n,T=y?y[0]:h.charAt(0),O=y?Pu(y,1).join(""):h.slice(1);return T[l]()+O}}function rc(l){return function(h){return Oo(vE(yE(h).replace(Ro,"")),l,"")}}function Df(l){return function(){var h=arguments;switch(h.length){case 0:return new l;case 1:return new l(h[0]);case 2:return new l(h[0],h[1]);case 3:return new l(h[0],h[1],h[2]);case 4:return new l(h[0],h[1],h[2],h[3]);case 5:return new l(h[0],h[1],h[2],h[3],h[4]);case 6:return new l(h[0],h[1],h[2],h[3],h[4],h[5]);case 7:return new l(h[0],h[1],h[2],h[3],h[4],h[5],h[6])}var y=Xa(l.prototype),T=l.apply(y,h);return Gr(T)?T:y}}function X2(l,h,y){var T=Df(l);function O(){for(var Y=arguments.length,nt=Ct(Y),ct=Y,_t=ic(O);ct--;)nt[ct]=arguments[ct];var zt=Y<3&&nt[0]!==_t&&nt[Y-1]!==_t?[]:zs(nt,_t);if(Y-=zt.length,Y<y)return bx(l,h,tp,O.placeholder,n,nt,zt,n,n,y-Y);var kt=this&&this!==Ur&&this instanceof O?T:l;return ie(kt,this,nt)}return O}function Ex(l){return function(h,y,T){var O=cr(h);if(!Ho(h)){var Y=Ne(y,3);h=Fi(h),y=function(ct){return Y(O[ct],ct,O)}}var nt=l(h,y,T);return nt>-1?O[Y?h[nt]:nt]:n}}function wx(l){return Za(function(h){var y=h.length,T=y,O=r.prototype.thru;for(l&&h.reverse();T--;){var Y=h[T];if(typeof Y!="function")throw new tr(s);if(O&&!nt&&ip(Y)=="wrapper")var nt=new r([],!0)}for(T=nt?T:y;++T<y;){Y=h[T];var ct=ip(Y),_t=ct=="wrapper"?Mm(Y):n;_t&&Cm(_t[0])&&_t[1]==(V|E|A|X)&&!_t[4].length&&_t[9]==1?nt=nt[ip(_t[0])].apply(nt,_t[3]):nt=Y.length==1&&Cm(Y)?nt[ct]():nt.thru(Y)}return function(){var zt=arguments,kt=zt[0];if(nt&&zt.length==1&&Ve(kt))return nt.plant(kt).value();for(var Yt=0,pe=y?h[Yt].apply(this,zt):kt;++Yt<y;)pe=h[Yt].call(this,pe);return pe}})}function tp(l,h,y,T,O,Y,nt,ct,_t,zt){var kt=h&V,Yt=h&C,pe=h&R,Se=h&(E|I),De=h&q,Qe=pe?n:Df(l);function Fe(){for(var Fn=arguments.length,$n=Ct(Fn),cs=Fn;cs--;)$n[cs]=arguments[cs];if(Se)var Eo=ic(Fe),fs=Do($n,Eo);if(T&&($n=mx($n,T,O,Se)),Y&&($n=yx($n,Y,nt,Se)),Fn-=fs,Se&&Fn<zt){var ii=zs($n,Eo);return bx(l,h,tp,Fe.placeholder,y,$n,ii,ct,_t,zt-Fn)}var Ws=Yt?y:this,Qa=pe?Ws[l]:l;return Fn=$n.length,ct?$n=hO($n,ct):De&&Fn>1&&$n.reverse(),kt&&_t<Fn&&($n.length=_t),this&&this!==Ur&&this instanceof Fe&&(Qa=Qe||Df(Qa)),Qa.apply(Ws,$n)}return Fe}function Sx(l,h){return function(y,T){return x2(y,l,h(T),{})}}function ep(l,h){return function(y,T){var O;if(y===n&&T===n)return h;if(y!==n&&(O=y),T!==n){if(O===n)return T;typeof y=="string"||typeof T=="string"?(y=us(y),T=us(T)):(y=ux(y),T=ux(T)),O=l(y,T)}return O}}function xm(l){return Za(function(h){return h=Mr(h,io(Ne())),an(function(y){var T=this;return l(h,function(O){return ie(O,T,y)})})})}function np(l,h){h=h===n?" ":us(h);var y=h.length;if(y<2)return y?pm(h,l):h;var T=pm(h,Cr(l/qa(h)));return ka(h)?Pu(Fo(T),0,l).join(""):T.slice(0,l)}function Y2(l,h,y,T){var O=h&C,Y=Df(l);function nt(){for(var ct=-1,_t=arguments.length,zt=-1,kt=T.length,Yt=Ct(kt+_t),pe=this&&this!==Ur&&this instanceof nt?Y:l;++zt<kt;)Yt[zt]=T[zt];for(;_t--;)Yt[zt++]=arguments[++ct];return ie(pe,O?y:this,Yt)}return nt}function Mx(l){return function(h,y,T){return T&&typeof T!="number"&&xo(h,y,T)&&(y=T=n),h=ja(h),y===n?(y=h,h=0):y=ja(y),T=T===n?h<y?1:-1:ja(T),L2(h,y,T,l)}}function rp(l){return function(h,y){return typeof h=="string"&&typeof y=="string"||(h=Rs(h),y=Rs(y)),l(h,y)}}function bx(l,h,y,T,O,Y,nt,ct,_t,zt){var kt=h&E,Yt=kt?nt:n,pe=kt?n:nt,Se=kt?Y:n,De=kt?n:Y;h|=kt?A:F,h&=~(kt?F:A),h&x||(h&=~(C|R));var Qe=[l,h,O,Se,Yt,De,pe,ct,_t,zt],Fe=y.apply(n,Qe);return Cm(l)&&Ux(Fe,Qe),Fe.placeholder=T,Bx(Fe,l,h)}function Em(l){var h=ln[l];return function(y,T){if(y=Rs(y),T=T==null?0:vr(Ke(T),292),T&&tc(y)){var O=(hr(y)+"e").split("e"),Y=h(O[0]+"e"+(+O[1]+T));return O=(hr(Y)+"e").split("e"),+(O[0]+"e"+(+O[1]-T))}return h(y)}}var $2=ga&&1/Wr(new ga([,-0]))[1]==At?function(l){return new ga(l)}:Hm;function Ax(l){return function(h){var y=oo(h);return y==ft?ns(h):y==Wt?Vh(h):ti(h,l(h))}}function $a(l,h,y,T,O,Y,nt,ct){var _t=h&R;if(!_t&&typeof l!="function")throw new tr(s);var zt=T?T.length:0;if(zt||(h&=~(A|F),T=O=n),nt=nt===n?nt:ni(Ke(nt),0),ct=ct===n?ct:Ke(ct),zt-=O?O.length:0,h&F){var kt=T,Yt=O;T=O=n}var pe=_t?n:Mm(l),Se=[l,h,y,T,O,kt,Yt,Y,nt,ct];if(pe&&lO(Se,pe),l=Se[0],h=Se[1],y=Se[2],T=Se[3],O=Se[4],ct=Se[9]=Se[9]===n?_t?0:l.length:ni(Se[9]-zt,0),!ct&&h&(E|I)&&(h&=~(E|I)),!h||h==C)var De=W2(l,h,y);else h==E||h==I?De=X2(l,h,ct):(h==A||h==(C|A))&&!O.length?De=Y2(l,h,y,T):De=tp.apply(n,Se);var Qe=pe?sx:Ux;return Bx(Qe(De,Se),l,h)}function Tx(l,h,y,T){return l===n||Vs(l,ei[y])&&!sn.call(T,y)?h:l}function Cx(l,h,y,T,O,Y){return Gr(l)&&Gr(h)&&(Y.set(h,l),Kh(l,h,n,Cx,Y),Y.delete(h)),l}function Z2(l){return Bf(l)?n:l}function Px(l,h,y,T,O,Y){var nt=y&S,ct=l.length,_t=h.length;if(ct!=_t&&!(nt&&_t>ct))return!1;var zt=Y.get(l),kt=Y.get(h);if(zt&&kt)return zt==h&&kt==l;var Yt=-1,pe=!0,Se=y&b?new gl:n;for(Y.set(l,h),Y.set(h,l);++Yt<ct;){var De=l[Yt],Qe=h[Yt];if(T)var Fe=nt?T(Qe,De,Yt,h,l,Y):T(De,Qe,Yt,l,h,Y);if(Fe!==n){if(Fe)continue;pe=!1;break}if(Se){if(!Ga(h,function(Fn,$n){if(!gi(Se,$n)&&(De===Fn||O(De,Fn,y,T,Y)))return Se.push($n)})){pe=!1;break}}else if(!(De===Qe||O(De,Qe,y,T,Y))){pe=!1;break}}return Y.delete(l),Y.delete(h),pe}function K2(l,h,y,T,O,Y,nt){switch(y){case Ht:if(l.byteLength!=h.byteLength||l.byteOffset!=h.byteOffset)return!1;l=l.buffer,h=h.buffer;case dt:return!(l.byteLength!=h.byteLength||!Y(new Ms(l),new Ms(h)));case jt:case ce:case We:return Vs(+l,+h);case $t:return l.name==h.name&&l.message==h.message;case be:case Me:return l==h+"";case ft:var ct=ns;case Wt:var _t=T&S;if(ct||(ct=Wr),l.size!=h.size&&!_t)return!1;var zt=nt.get(l);if(zt)return zt==h;T|=b,nt.set(l,h);var kt=Px(ct(l),ct(h),T,O,Y,nt);return nt.delete(l),kt;case tt:if(bu)return bu.call(l)==bu.call(h)}return!1}function J2(l,h,y,T,O,Y){var nt=y&S,ct=wm(l),_t=ct.length,zt=wm(h),kt=zt.length;if(_t!=kt&&!nt)return!1;for(var Yt=_t;Yt--;){var pe=ct[Yt];if(!(nt?pe in h:sn.call(h,pe)))return!1}var Se=Y.get(l),De=Y.get(h);if(Se&&De)return Se==h&&De==l;var Qe=!0;Y.set(l,h),Y.set(h,l);for(var Fe=nt;++Yt<_t;){pe=ct[Yt];var Fn=l[pe],$n=h[pe];if(T)var cs=nt?T($n,Fn,pe,h,l,Y):T(Fn,$n,pe,l,h,Y);if(!(cs===n?Fn===$n||O(Fn,$n,y,T,Y):cs)){Qe=!1;break}Fe||(Fe=pe=="constructor")}if(Qe&&!Fe){var Eo=l.constructor,fs=h.constructor;Eo!=fs&&"constructor"in l&&"constructor"in h&&!(typeof Eo=="function"&&Eo instanceof Eo&&typeof fs=="function"&&fs instanceof fs)&&(Qe=!1)}return Y.delete(l),Y.delete(h),Qe}function Za(l){return Im(Dx(l,n,Vx),l+"")}function wm(l){return Z1(l,Fi,Am)}function Sm(l){return Z1(l,Vo,Ix)}var Mm=ma?function(l){return ma.get(l)}:Hm;function ip(l){for(var h=l.name+"",y=ss[h],T=sn.call(ss,h)?y.length:0;T--;){var O=y[T],Y=O.func;if(Y==null||Y==l)return O.name}return h}function ic(l){var h=sn.call(U,"placeholder")?U:l;return h.placeholder}function Ne(){var l=U.iteratee||km;return l=l===km?j1:l,arguments.length?l(arguments[0],arguments[1]):l}function op(l,h){var y=l.__data__;return oO(h)?y[typeof h=="string"?"string":"hash"]:y.map}function bm(l){for(var h=Fi(l),y=h.length;y--;){var T=h[y],O=l[T];h[y]=[T,O,Nx(O)]}return h}function vl(l,h){var y=Vr(l,h);return J1(y)?y:n}function j2(l){var h=sn.call(l,Tr),y=l[Tr];try{l[Tr]=n;var T=!0}catch(Y){}var O=Rr.call(l);return T&&(h?l[Tr]=y:delete l[Tr]),O}var Am=Wa?function(l){return l==null?[]:(l=cr(l),Yi(Wa(l),function(h){return zo.call(l,h)}))}:Vm,Ix=Wa?function(l){for(var h=[];l;)Ge(h,Am(l)),l=bs(l);return h}:Vm,oo=_o;(vo&&oo(new vo(new ArrayBuffer(1)))!=Ht||As&&oo(new As)!=ft||da&&oo(da.resolve())!=fe||ga&&oo(new ga)!=Wt||Ts&&oo(new Ts)!=Pt)&&(oo=function(l){var h=_o(l),y=h==ge?l.constructor:n,T=y?_l(y):"";if(T)switch(T){case ya:return Ht;case Re:return ft;case ks:return fe;case Mu:return Wt;case va:return Pt}return h});function Q2(l,h,y){for(var T=-1,O=y.length;++T<O;){var Y=y[T],nt=Y.size;switch(Y.type){case"drop":l+=nt;break;case"dropRight":h-=nt;break;case"take":h=vr(h,l+nt);break;case"takeRight":l=ni(l,h-nt);break}}return{start:l,end:h}}function tO(l){var h=l.match(Kr);return h?h[1].split(nr):[]}function Rx(l,h,y){h=Cu(h,l);for(var T=-1,O=h.length,Y=!1;++T<O;){var nt=wa(h[T]);if(!(Y=l!=null&&y(l,nt)))break;l=l[nt]}return Y||++T!=O?Y:(O=l==null?0:l.length,!!O&&hp(O)&&Ka(nt,O)&&(Ve(l)||xl(l)))}function eO(l){var h=l.length,y=new l.constructor(h);return h&&typeof l[0]=="string"&&sn.call(l,"index")&&(y.index=l.index,y.input=l.input),y}function Lx(l){return typeof l.constructor=="function"&&!Ff(l)?Xa(bs(l)):{}}function nO(l,h,y){var T=l.constructor;switch(h){case dt:return _m(l);case jt:case ce:return new T(+l);case Ht:return z2(l,y);case Ce:case Vt:case Zt:case ne:case rt:case P:case N:case k:case $:return dx(l,y);case ft:return new T;case We:case Me:return new T(l);case be:return G2(l);case Wt:return new T;case tt:return k2(l)}}function rO(l,h){var y=h.length;if(!y)return l;var T=y-1;return h[T]=(y>1?"& ":"")+h[T],h=h.join(y>2?", ":" "),l.replace(wr,`{
7
+ `)}return r.toString()},ti.prototype.computeEdgeEndLabels=function(r){for(var i=this.iterator();i.hasNext();)i.next().computeLabel(r)},ti.prototype.computeLabelling=function(r){this.computeEdgeEndLabels(r[0].getBoundaryNodeRule()),this.propagateSideLabels(0),this.propagateSideLabels(1);for(var i=[!1,!1],a=this.iterator();a.hasNext();)for(var c=a.next().getLabel(),d=0;d<2;d++)c.isLine(d)&&c.getLocation(d)===K.BOUNDARY&&(i[d]=!0);for(var _=this.iterator();_.hasNext();)for(var M=_.next(),L=M.getLabel(),H=0;H<2;H++)if(L.isAnyNull(H)){var it=K.NONE;if(i[H])it=K.EXTERIOR;else{var bt=M.getCoordinate();it=this.getLocation(H,bt,r)}L.setAllLocationsIfNull(H,it)}},ti.prototype.getDegree=function(){return this._edgeMap.size()},ti.prototype.insertEdgeEnd=function(r,i){this._edgeMap.put(r,i),this._edgeList=null},ti.prototype.interfaces_=function(){return[]},ti.prototype.getClass=function(){return ti};var Hh=function(r){function i(){r.call(this),this._resultAreaEdgeList=null,this._label=null,this._SCANNING_FOR_INCOMING=1,this._LINKING_TO_OUTGOING=2}return r&&(i.__proto__=r),i.prototype=Object.create(r&&r.prototype),i.prototype.constructor=i,i.prototype.linkResultDirectedEdges=function(){this.getResultAreaEdges();for(var a=null,c=null,d=this._SCANNING_FOR_INCOMING,_=0;_<this._resultAreaEdgeList.size();_++){var M=this._resultAreaEdgeList.get(_),L=M.getSym();if(M.getLabel().isArea())switch(a===null&&M.isInResult()&&(a=M),d){case this._SCANNING_FOR_INCOMING:if(!L.isInResult())continue;c=L,d=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(!M.isInResult())continue;c.setNext(M),d=this._SCANNING_FOR_INCOMING}}if(d===this._LINKING_TO_OUTGOING){if(a===null)throw new Qo("no outgoing dirEdge found",this.getCoordinate());Wt.isTrue(a.isInResult(),"unable to link last incoming dirEdge"),c.setNext(a)}},i.prototype.insert=function(a){var c=a;this.insertEdgeEnd(c,c)},i.prototype.getRightmostEdge=function(){var a=this.getEdges(),c=a.size();if(c<1)return null;var d=a.get(0);if(c===1)return d;var _=a.get(c-1),M=d.getQuadrant(),L=_.getQuadrant();return Yn.isNorthern(M)&&Yn.isNorthern(L)?d:Yn.isNorthern(M)||Yn.isNorthern(L)?d.getDy()!==0?d:_.getDy()!==0?_:(Wt.shouldNeverReachHere("found two horizontal edges incident on node"),null):_},i.prototype.print=function(a){te.out.println("DirectedEdgeStar: "+this.getCoordinate());for(var c=this.iterator();c.hasNext();){var d=c.next();a.print("out "),d.print(a),a.println(),a.print("in "),d.getSym().print(a),a.println()}},i.prototype.getResultAreaEdges=function(){if(this._resultAreaEdgeList!==null)return this._resultAreaEdgeList;this._resultAreaEdgeList=new G;for(var a=this.iterator();a.hasNext();){var c=a.next();(c.isInResult()||c.getSym().isInResult())&&this._resultAreaEdgeList.add(c)}return this._resultAreaEdgeList},i.prototype.updateLabelling=function(a){for(var c=this.iterator();c.hasNext();){var d=c.next().getLabel();d.setAllLocationsIfNull(0,a.getLocation(0)),d.setAllLocationsIfNull(1,a.getLocation(1))}},i.prototype.linkAllDirectedEdges=function(){this.getEdges();for(var a=null,c=null,d=this._edgeList.size()-1;d>=0;d--){var _=this._edgeList.get(d),M=_.getSym();c===null&&(c=M),a!==null&&M.setNext(a),a=_}c.setNext(a)},i.prototype.computeDepths=function(){if(arguments.length===1){var a=arguments[0],c=this.findIndex(a),d=a.getDepth(Xt.LEFT),_=a.getDepth(Xt.RIGHT),M=this.computeDepths(c+1,this._edgeList.size(),d);if(this.computeDepths(0,c,M)!==_)throw new Qo("depth mismatch at "+a.getCoordinate())}else if(arguments.length===3){for(var L=arguments[0],H=arguments[1],it=arguments[2],bt=L;bt<H;bt++){var Tt=this._edgeList.get(bt);Tt.setEdgeDepths(Xt.RIGHT,it),it=Tt.getDepth(Xt.LEFT)}return it}},i.prototype.mergeSymLabels=function(){for(var a=this.iterator();a.hasNext();){var c=a.next();c.getLabel().merge(c.getSym().getLabel())}},i.prototype.linkMinimalDirectedEdges=function(a){for(var c=null,d=null,_=this._SCANNING_FOR_INCOMING,M=this._resultAreaEdgeList.size()-1;M>=0;M--){var L=this._resultAreaEdgeList.get(M),H=L.getSym();switch(c===null&&L.getEdgeRing()===a&&(c=L),_){case this._SCANNING_FOR_INCOMING:if(H.getEdgeRing()!==a)continue;d=H,_=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(L.getEdgeRing()!==a)continue;d.setNextMin(L),_=this._SCANNING_FOR_INCOMING}}_===this._LINKING_TO_OUTGOING&&(Wt.isTrue(c!==null,"found null for first outgoing dirEdge"),Wt.isTrue(c.getEdgeRing()===a,"unable to link last incoming dirEdge"),d.setNextMin(c))},i.prototype.getOutgoingDegree=function(){if(arguments.length===0){for(var a=0,c=this.iterator();c.hasNext();)c.next().isInResult()&&a++;return a}if(arguments.length===1){for(var d=arguments[0],_=0,M=this.iterator();M.hasNext();)M.next().getEdgeRing()===d&&_++;return _}},i.prototype.getLabel=function(){return this._label},i.prototype.findCoveredLineEdges=function(){for(var a=K.NONE,c=this.iterator();c.hasNext();){var d=c.next(),_=d.getSym();if(!d.isLineEdge()){if(d.isInResult()){a=K.INTERIOR;break}if(_.isInResult()){a=K.EXTERIOR;break}}}if(a===K.NONE)return null;for(var M=a,L=this.iterator();L.hasNext();){var H=L.next(),it=H.getSym();H.isLineEdge()?H.getEdge().setCovered(M===K.INTERIOR):(H.isInResult()&&(M=K.EXTERIOR),it.isInResult()&&(M=K.INTERIOR))}},i.prototype.computeLabelling=function(a){r.prototype.computeLabelling.call(this,a),this._label=new On(K.NONE);for(var c=this.iterator();c.hasNext();)for(var d=c.next().getEdge().getLabel(),_=0;_<2;_++){var M=d.getLocation(_);M!==K.INTERIOR&&M!==K.BOUNDARY||this._label.setLocation(_,K.INTERIOR)}},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(ti),io=function(r){function i(){r.apply(this,arguments)}return r&&(i.__proto__=r),i.prototype=Object.create(r&&r.prototype),i.prototype.constructor=i,i.prototype.createNode=function(a){return new Kl(a,new Hh)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(yu),ts=function r(){this._pts=null,this._orientation=null;var i=arguments[0];this._pts=i,this._orientation=r.orientation(i)};ts.prototype.compareTo=function(r){var i=r;return ts.compareOriented(this._pts,this._orientation,i._pts,i._orientation)},ts.prototype.interfaces_=function(){return[V]},ts.prototype.getClass=function(){return ts},ts.orientation=function(r){return lt.increasingDirection(r)===1},ts.compareOriented=function(r,i,a,c){for(var d=i?1:-1,_=c?1:-1,M=i?r.length:-1,L=c?a.length:-1,H=i?0:r.length-1,it=c?0:a.length-1;;){var bt=r[H].compareTo(a[it]);if(bt!==0)return bt;var Tt=(H+=d)===M,Kt=(it+=_)===L;if(Tt&&!Kt)return-1;if(!Tt&&Kt)return 1;if(Tt&&Kt)return 0}};var gi=function(){this._edges=new G,this._ocaMap=new w};gi.prototype.print=function(r){r.print("MULTILINESTRING ( ");for(var i=0;i<this._edges.size();i++){var a=this._edges.get(i);i>0&&r.print(","),r.print("(");for(var c=a.getCoordinates(),d=0;d<c.length;d++)d>0&&r.print(","),r.print(c[d].x+" "+c[d].y);r.println(")")}r.print(") ")},gi.prototype.addAll=function(r){for(var i=r.iterator();i.hasNext();)this.add(i.next())},gi.prototype.findEdgeIndex=function(r){for(var i=0;i<this._edges.size();i++)if(this._edges.get(i).equals(r))return i;return-1},gi.prototype.iterator=function(){return this._edges.iterator()},gi.prototype.getEdges=function(){return this._edges},gi.prototype.get=function(r){return this._edges.get(r)},gi.prototype.findEqualEdge=function(r){var i=new ts(r.getCoordinates());return this._ocaMap.get(i)},gi.prototype.add=function(r){this._edges.add(r);var i=new ts(r.getCoordinates());this._ocaMap.put(i,r)},gi.prototype.interfaces_=function(){return[]},gi.prototype.getClass=function(){return gi};var Bs=function(){};Bs.prototype.processIntersections=function(r,i,a,c){},Bs.prototype.isDone=function(){},Bs.prototype.interfaces_=function(){return[]},Bs.prototype.getClass=function(){return Bs};var Ri=function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._hasInterior=!1,this._properIntersectionPoint=null,this._li=null,this._isSelfIntersection=null,this.numIntersections=0,this.numInteriorIntersections=0,this.numProperIntersections=0,this.numTests=0;var r=arguments[0];this._li=r};Ri.prototype.isTrivialIntersection=function(r,i,a,c){if(r===a&&this._li.getIntersectionNum()===1){if(Ri.isAdjacentSegments(i,c))return!0;if(r.isClosed()){var d=r.size()-1;if(i===0&&c===d||c===0&&i===d)return!0}}return!1},Ri.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},Ri.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},Ri.prototype.getLineIntersector=function(){return this._li},Ri.prototype.hasProperIntersection=function(){return this._hasProper},Ri.prototype.processIntersections=function(r,i,a,c){if(r===a&&i===c)return null;this.numTests++;var d=r.getCoordinates()[i],_=r.getCoordinates()[i+1],M=a.getCoordinates()[c],L=a.getCoordinates()[c+1];this._li.computeIntersection(d,_,M,L),this._li.hasIntersection()&&(this.numIntersections++,this._li.isInteriorIntersection()&&(this.numInteriorIntersections++,this._hasInterior=!0),this.isTrivialIntersection(r,i,a,c)||(this._hasIntersection=!0,r.addIntersections(this._li,i,0),a.addIntersections(this._li,c,1),this._li.isProper()&&(this.numProperIntersections++,this._hasProper=!0,this._hasProperInterior=!0)))},Ri.prototype.hasIntersection=function(){return this._hasIntersection},Ri.prototype.isDone=function(){return!1},Ri.prototype.hasInteriorIntersection=function(){return this._hasInterior},Ri.prototype.interfaces_=function(){return[Bs]},Ri.prototype.getClass=function(){return Ri},Ri.isAdjacentSegments=function(r,i){return Math.abs(r-i)===1};var Do=function(){this.coord=null,this.segmentIndex=null,this.dist=null;var r=arguments[0],i=arguments[1],a=arguments[2];this.coord=new D(r),this.segmentIndex=i,this.dist=a};Do.prototype.getSegmentIndex=function(){return this.segmentIndex},Do.prototype.getCoordinate=function(){return this.coord},Do.prototype.print=function(r){r.print(this.coord),r.print(" seg # = "+this.segmentIndex),r.println(" dist = "+this.dist)},Do.prototype.compareTo=function(r){var i=r;return this.compare(i.segmentIndex,i.dist)},Do.prototype.isEndPoint=function(r){return this.segmentIndex===0&&this.dist===0||this.segmentIndex===r},Do.prototype.toString=function(){return this.coord+" seg # = "+this.segmentIndex+" dist = "+this.dist},Do.prototype.getDistance=function(){return this.dist},Do.prototype.compare=function(r,i){return this.segmentIndex<r?-1:this.segmentIndex>r?1:this.dist<i?-1:this.dist>i?1:0},Do.prototype.interfaces_=function(){return[V]},Do.prototype.getClass=function(){return Do};var es=function(){this._nodeMap=new w,this.edge=null;var r=arguments[0];this.edge=r};es.prototype.print=function(r){r.println("Intersections:");for(var i=this.iterator();i.hasNext();)i.next().print(r)},es.prototype.iterator=function(){return this._nodeMap.values().iterator()},es.prototype.addSplitEdges=function(r){this.addEndpoints();for(var i=this.iterator(),a=i.next();i.hasNext();){var c=i.next(),d=this.createSplitEdge(a,c);r.add(d),a=c}},es.prototype.addEndpoints=function(){var r=this.edge.pts.length-1;this.add(this.edge.pts[0],0,0),this.add(this.edge.pts[r],r,0)},es.prototype.createSplitEdge=function(r,i){var a=i.segmentIndex-r.segmentIndex+2,c=this.edge.pts[i.segmentIndex],d=i.dist>0||!i.coord.equals2D(c);d||a--;var _=new Array(a).fill(null),M=0;_[M++]=new D(r.coord);for(var L=r.segmentIndex+1;L<=i.segmentIndex;L++)_[M++]=this.edge.pts[L];return d&&(_[M]=i.coord),new jl(_,new On(this.edge._label))},es.prototype.add=function(r,i,a){var c=new Do(r,i,a),d=this._nodeMap.get(c);return d!==null?d:(this._nodeMap.put(c,c),c)},es.prototype.isIntersection=function(r){for(var i=this.iterator();i.hasNext();)if(i.next().coord.equals(r))return!0;return!1},es.prototype.interfaces_=function(){return[]},es.prototype.getClass=function(){return es};var ha=function(){};ha.prototype.getChainStartIndices=function(r){var i=0,a=new G;a.add(new pt(i));do{var c=this.findChainEnd(r,i);a.add(new pt(c)),i=c}while(i<r.length-1);return ha.toIntArray(a)},ha.prototype.findChainEnd=function(r,i){for(var a=Yn.quadrant(r[i],r[i+1]),c=i+1;c<r.length&&Yn.quadrant(r[c-1],r[c])===a;)c++;return c-1},ha.prototype.interfaces_=function(){return[]},ha.prototype.getClass=function(){return ha},ha.toIntArray=function(r){for(var i=new Array(r.size()).fill(null),a=0;a<i.length;a++)i[a]=r.get(a).intValue();return i};var ws=function(){this.e=null,this.pts=null,this.startIndex=null,this.env1=new qt,this.env2=new qt;var r=arguments[0];this.e=r,this.pts=r.getCoordinates();var i=new ha;this.startIndex=i.getChainStartIndices(this.pts)};ws.prototype.getCoordinates=function(){return this.pts},ws.prototype.getMaxX=function(r){var i=this.pts[this.startIndex[r]].x,a=this.pts[this.startIndex[r+1]].x;return i>a?i:a},ws.prototype.getMinX=function(r){var i=this.pts[this.startIndex[r]].x,a=this.pts[this.startIndex[r+1]].x;return i<a?i:a},ws.prototype.computeIntersectsForChain=function(){if(arguments.length===4){var r=arguments[0],i=arguments[1],a=arguments[2],c=arguments[3];this.computeIntersectsForChain(this.startIndex[r],this.startIndex[r+1],i,i.startIndex[a],i.startIndex[a+1],c)}else if(arguments.length===6){var d=arguments[0],_=arguments[1],M=arguments[2],L=arguments[3],H=arguments[4],it=arguments[5],bt=this.pts[d],Tt=this.pts[_],Kt=M.pts[L],Qt=M.pts[H];if(_-d==1&&H-L==1)return it.addIntersections(this.e,d,M.e,L),null;if(this.env1.init(bt,Tt),this.env2.init(Kt,Qt),!this.env1.intersects(this.env2))return null;var le=Math.trunc((d+_)/2),Ee=Math.trunc((L+H)/2);d<le&&(L<Ee&&this.computeIntersectsForChain(d,le,M,L,Ee,it),Ee<H&&this.computeIntersectsForChain(d,le,M,Ee,H,it)),le<_&&(L<Ee&&this.computeIntersectsForChain(le,_,M,L,Ee,it),Ee<H&&this.computeIntersectsForChain(le,_,M,Ee,H,it))}},ws.prototype.getStartIndexes=function(){return this.startIndex},ws.prototype.computeIntersects=function(r,i){for(var a=0;a<this.startIndex.length-1;a++)for(var c=0;c<r.startIndex.length-1;c++)this.computeIntersectsForChain(a,r,c,i)},ws.prototype.interfaces_=function(){return[]},ws.prototype.getClass=function(){return ws};var Vr=function r(){this._depth=Array(2).fill().map(function(){return Array(3)});for(var i=0;i<2;i++)for(var a=0;a<3;a++)this._depth[i][a]=r.NULL_VALUE},ka={NULL_VALUE:{configurable:!0}};Vr.prototype.getDepth=function(r,i){return this._depth[r][i]},Vr.prototype.setDepth=function(r,i,a){this._depth[r][i]=a},Vr.prototype.isNull=function(){if(arguments.length===0){for(var r=0;r<2;r++)for(var i=0;i<3;i++)if(this._depth[r][i]!==Vr.NULL_VALUE)return!1;return!0}if(arguments.length===1){var a=arguments[0];return this._depth[a][1]===Vr.NULL_VALUE}if(arguments.length===2){var c=arguments[0],d=arguments[1];return this._depth[c][d]===Vr.NULL_VALUE}},Vr.prototype.normalize=function(){for(var r=0;r<2;r++)if(!this.isNull(r)){var i=this._depth[r][1];this._depth[r][2]<i&&(i=this._depth[r][2]),i<0&&(i=0);for(var a=1;a<3;a++){var c=0;this._depth[r][a]>i&&(c=1),this._depth[r][a]=c}}},Vr.prototype.getDelta=function(r){return this._depth[r][Xt.RIGHT]-this._depth[r][Xt.LEFT]},Vr.prototype.getLocation=function(r,i){return this._depth[r][i]<=0?K.EXTERIOR:K.INTERIOR},Vr.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]},Vr.prototype.add=function(){if(arguments.length===1)for(var r=arguments[0],i=0;i<2;i++)for(var a=1;a<3;a++){var c=r.getLocation(i,a);c!==K.EXTERIOR&&c!==K.INTERIOR||(this.isNull(i,a)?this._depth[i][a]=Vr.depthAtLocation(c):this._depth[i][a]+=Vr.depthAtLocation(c))}else if(arguments.length===3){var d=arguments[0],_=arguments[1];arguments[2]===K.INTERIOR&&this._depth[d][_]++}},Vr.prototype.interfaces_=function(){return[]},Vr.prototype.getClass=function(){return Vr},Vr.depthAtLocation=function(r){return r===K.EXTERIOR?0:r===K.INTERIOR?1:Vr.NULL_VALUE},ka.NULL_VALUE.get=function(){return-1},Object.defineProperties(Vr,ka);var jl=function(r){function i(){if(r.call(this),this.pts=null,this._env=null,this.eiList=new es(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new Vr,this._depthDelta=0,arguments.length===1){var a=arguments[0];i.call(this,a,null)}else if(arguments.length===2){var c=arguments[0],d=arguments[1];this.pts=c,this._label=d}}return r&&(i.__proto__=r),i.prototype=Object.create(r&&r.prototype),i.prototype.constructor=i,i.prototype.getDepth=function(){return this._depth},i.prototype.getCollapsedEdge=function(){var a=new Array(2).fill(null);return a[0]=this.pts[0],a[1]=this.pts[1],new i(a,On.toLineLabel(this._label))},i.prototype.isIsolated=function(){return this._isIsolated},i.prototype.getCoordinates=function(){return this.pts},i.prototype.setIsolated=function(a){this._isIsolated=a},i.prototype.setName=function(a){this._name=a},i.prototype.equals=function(a){if(!(a instanceof i))return!1;var c=a;if(this.pts.length!==c.pts.length)return!1;for(var d=!0,_=!0,M=this.pts.length,L=0;L<this.pts.length;L++)if(this.pts[L].equals2D(c.pts[L])||(d=!1),this.pts[L].equals2D(c.pts[--M])||(_=!1),!d&&!_)return!1;return!0},i.prototype.getCoordinate=function(){if(arguments.length===0)return this.pts.length>0?this.pts[0]:null;if(arguments.length===1){var a=arguments[0];return this.pts[a]}},i.prototype.print=function(a){a.print("edge "+this._name+": "),a.print("LINESTRING (");for(var c=0;c<this.pts.length;c++)c>0&&a.print(","),a.print(this.pts[c].x+" "+this.pts[c].y);a.print(") "+this._label+" "+this._depthDelta)},i.prototype.computeIM=function(a){i.updateIM(this._label,a)},i.prototype.isCollapsed=function(){return!!this._label.isArea()&&this.pts.length===3&&!!this.pts[0].equals(this.pts[2])},i.prototype.isClosed=function(){return this.pts[0].equals(this.pts[this.pts.length-1])},i.prototype.getMaximumSegmentIndex=function(){return this.pts.length-1},i.prototype.getDepthDelta=function(){return this._depthDelta},i.prototype.getNumPoints=function(){return this.pts.length},i.prototype.printReverse=function(a){a.print("edge "+this._name+": ");for(var c=this.pts.length-1;c>=0;c--)a.print(this.pts[c]+" ");a.println("")},i.prototype.getMonotoneChainEdge=function(){return this._mce===null&&(this._mce=new ws(this)),this._mce},i.prototype.getEnvelope=function(){if(this._env===null){this._env=new qt;for(var a=0;a<this.pts.length;a++)this._env.expandToInclude(this.pts[a])}return this._env},i.prototype.addIntersection=function(a,c,d,_){var M=new D(a.getIntersection(_)),L=c,H=a.getEdgeDistance(d,_),it=L+1;if(it<this.pts.length){var bt=this.pts[it];M.equals2D(bt)&&(L=it,H=0)}this.eiList.add(M,L,H)},i.prototype.toString=function(){var a=new Lt;a.append("edge "+this._name+": "),a.append("LINESTRING (");for(var c=0;c<this.pts.length;c++)c>0&&a.append(","),a.append(this.pts[c].x+" "+this.pts[c].y);return a.append(") "+this._label+" "+this._depthDelta),a.toString()},i.prototype.isPointwiseEqual=function(a){if(this.pts.length!==a.pts.length)return!1;for(var c=0;c<this.pts.length;c++)if(!this.pts[c].equals2D(a.pts[c]))return!1;return!0},i.prototype.setDepthDelta=function(a){this._depthDelta=a},i.prototype.getEdgeIntersectionList=function(){return this.eiList},i.prototype.addIntersections=function(a,c,d){for(var _=0;_<a.getIntersectionNum();_++)this.addIntersection(a,c,d,_)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i.updateIM=function(){if(arguments.length!==2)return r.prototype.updateIM.apply(this,arguments);var a=arguments[0],c=arguments[1];c.setAtLeastIfValid(a.getLocation(0,Xt.ON),a.getLocation(1,Xt.ON),1),a.isArea()&&(c.setAtLeastIfValid(a.getLocation(0,Xt.LEFT),a.getLocation(1,Xt.LEFT),2),c.setAtLeastIfValid(a.getLocation(0,Xt.RIGHT),a.getLocation(1,Xt.RIGHT),2))},i}(Xi),ai=function(r){this._workingPrecisionModel=null,this._workingNoder=null,this._geomFact=null,this._graph=null,this._edgeList=new gi,this._bufParams=r||null};ai.prototype.setWorkingPrecisionModel=function(r){this._workingPrecisionModel=r},ai.prototype.insertUniqueEdge=function(r){var i=this._edgeList.findEqualEdge(r);if(i!==null){var a=i.getLabel(),c=r.getLabel();i.isPointwiseEqual(r)||(c=new On(r.getLabel())).flip(),a.merge(c);var d=ai.depthDelta(c),_=i.getDepthDelta()+d;i.setDepthDelta(_)}else this._edgeList.add(r),r.setDepthDelta(ai.depthDelta(r.getLabel()))},ai.prototype.buildSubgraphs=function(r,i){for(var a=new G,c=r.iterator();c.hasNext();){var d=c.next(),_=d.getRightmostCoordinate(),M=new fa(a).getDepth(_);d.computeDepth(M),d.findResultEdges(),a.add(d),i.add(d.getDirectedEdges(),d.getNodes())}},ai.prototype.createSubgraphs=function(r){for(var i=new G,a=r.getNodes().iterator();a.hasNext();){var c=a.next();if(!c.isVisited()){var d=new Jr;d.create(c),i.add(d)}}return ho.sort(i,ho.reverseOrder()),i},ai.prototype.createEmptyResultGeometry=function(){return this._geomFact.createPolygon()},ai.prototype.getNoder=function(r){if(this._workingNoder!==null)return this._workingNoder;var i=new hl,a=new z;return a.setPrecisionModel(r),i.setSegmentIntersector(new Ri(a)),i},ai.prototype.buffer=function(r,i){var a=this._workingPrecisionModel;a===null&&(a=r.getPrecisionModel()),this._geomFact=r.getFactory();var c=new pi(a,this._bufParams),d=new Zi(r,i,c).getCurves();if(d.size()<=0)return this.createEmptyResultGeometry();this.computeNodedEdges(d,a),this._graph=new dr(new io),this._graph.addEdges(this._edgeList.getEdges());var _=this.createSubgraphs(this._graph),M=new Ci(this._geomFact);this.buildSubgraphs(_,M);var L=M.getPolygons();return L.size()<=0?this.createEmptyResultGeometry():this._geomFact.buildGeometry(L)},ai.prototype.computeNodedEdges=function(r,i){var a=this.getNoder(i);a.computeNodes(r);for(var c=a.getNodedSubstrings().iterator();c.hasNext();){var d=c.next(),_=d.getCoordinates();if(_.length!==2||!_[0].equals2D(_[1])){var M=d.getData(),L=new jl(d.getCoordinates(),new On(M));this.insertUniqueEdge(L)}}},ai.prototype.setNoder=function(r){this._workingNoder=r},ai.prototype.interfaces_=function(){return[]},ai.prototype.getClass=function(){return ai},ai.depthDelta=function(r){var i=r.getLocation(0,Xt.LEFT),a=r.getLocation(0,Xt.RIGHT);return i===K.INTERIOR&&a===K.EXTERIOR?1:i===K.EXTERIOR&&a===K.INTERIOR?-1:0},ai.convertSegStrings=function(r){for(var i=new Le,a=new G;r.hasNext();){var c=r.next(),d=i.createLineString(c.getCoordinates());a.add(d)}return i.buildGeometry(a)};var ns=function(){if(this._noder=null,this._scaleFactor=null,this._offsetX=null,this._offsetY=null,this._isScaled=!1,arguments.length===2){var r=arguments[0],i=arguments[1];this._noder=r,this._scaleFactor=i,this._offsetX=0,this._offsetY=0,this._isScaled=!this.isIntegerPrecision()}else if(arguments.length===4){var a=arguments[0],c=arguments[1],d=arguments[2],_=arguments[3];this._noder=a,this._scaleFactor=c,this._offsetX=d,this._offsetY=_,this._isScaled=!this.isIntegerPrecision()}};ns.prototype.rescale=function(){if(Q(arguments[0],at))for(var r=arguments[0].iterator();r.hasNext();){var i=r.next();this.rescale(i.getCoordinates())}else if(arguments[0]instanceof Array){for(var a=arguments[0],c=0;c<a.length;c++)a[c].x=a[c].x/this._scaleFactor+this._offsetX,a[c].y=a[c].y/this._scaleFactor+this._offsetY;a.length===2&&a[0].equals2D(a[1])&&te.out.println(a)}},ns.prototype.scale=function(){if(Q(arguments[0],at)){for(var r=arguments[0],i=new G,a=r.iterator();a.hasNext();){var c=a.next();i.add(new mr(this.scale(c.getCoordinates()),c.getData()))}return i}if(arguments[0]instanceof Array){for(var d=arguments[0],_=new Array(d.length).fill(null),M=0;M<d.length;M++)_[M]=new D(Math.round((d[M].x-this._offsetX)*this._scaleFactor),Math.round((d[M].y-this._offsetY)*this._scaleFactor),d[M].z);return lt.removeRepeatedPoints(_)}},ns.prototype.isIntegerPrecision=function(){return this._scaleFactor===1},ns.prototype.getNodedSubstrings=function(){var r=this._noder.getNodedSubstrings();return this._isScaled&&this.rescale(r),r},ns.prototype.computeNodes=function(r){var i=r;this._isScaled&&(i=this.scale(r)),this._noder.computeNodes(i)},ns.prototype.interfaces_=function(){return[Yi]},ns.prototype.getClass=function(){return ns};var mo=function(){this._li=new z,this._segStrings=null;var r=arguments[0];this._segStrings=r},zs={fact:{configurable:!0}};mo.prototype.checkEndPtVertexIntersections=function(){if(arguments.length===0)for(var r=this._segStrings.iterator();r.hasNext();){var i=r.next().getCoordinates();this.checkEndPtVertexIntersections(i[0],this._segStrings),this.checkEndPtVertexIntersections(i[i.length-1],this._segStrings)}else if(arguments.length===2){for(var a=arguments[0],c=arguments[1].iterator();c.hasNext();)for(var d=c.next().getCoordinates(),_=1;_<d.length-1;_++)if(d[_].equals(a))throw new Te("found endpt/interior pt intersection at index "+_+" :pt "+a)}},mo.prototype.checkInteriorIntersections=function(){if(arguments.length===0)for(var r=this._segStrings.iterator();r.hasNext();)for(var i=r.next(),a=this._segStrings.iterator();a.hasNext();){var c=a.next();this.checkInteriorIntersections(i,c)}else if(arguments.length===2)for(var d=arguments[0],_=arguments[1],M=d.getCoordinates(),L=_.getCoordinates(),H=0;H<M.length-1;H++)for(var it=0;it<L.length-1;it++)this.checkInteriorIntersections(d,H,_,it);else if(arguments.length===4){var bt=arguments[0],Tt=arguments[1],Kt=arguments[2],Qt=arguments[3];if(bt===Kt&&Tt===Qt)return null;var le=bt.getCoordinates()[Tt],Ee=bt.getCoordinates()[Tt+1],Dn=Kt.getCoordinates()[Qt],Jn=Kt.getCoordinates()[Qt+1];if(this._li.computeIntersection(le,Ee,Dn,Jn),this._li.hasIntersection()&&(this._li.isProper()||this.hasInteriorIntersection(this._li,le,Ee)||this.hasInteriorIntersection(this._li,Dn,Jn)))throw new Te("found non-noded intersection at "+le+"-"+Ee+" and "+Dn+"-"+Jn)}},mo.prototype.checkValid=function(){this.checkEndPtVertexIntersections(),this.checkInteriorIntersections(),this.checkCollapses()},mo.prototype.checkCollapses=function(){if(arguments.length===0)for(var r=this._segStrings.iterator();r.hasNext();){var i=r.next();this.checkCollapses(i)}else if(arguments.length===1)for(var a=arguments[0].getCoordinates(),c=0;c<a.length-2;c++)this.checkCollapse(a[c],a[c+1],a[c+2])},mo.prototype.hasInteriorIntersection=function(r,i,a){for(var c=0;c<r.getIntersectionNum();c++){var d=r.getIntersection(c);if(!d.equals(i)&&!d.equals(a))return!0}return!1},mo.prototype.checkCollapse=function(r,i,a){if(r.equals(a))throw new Te("found non-noded collapse at "+mo.fact.createLineString([r,i,a]))},mo.prototype.interfaces_=function(){return[]},mo.prototype.getClass=function(){return mo},zs.fact.get=function(){return new Le},Object.defineProperties(mo,zs);var Wr=function(){this._li=null,this._pt=null,this._originalPt=null,this._ptScaled=null,this._p0Scaled=null,this._p1Scaled=null,this._scaleFactor=null,this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,this._corner=new Array(4).fill(null),this._safeEnv=null;var r=arguments[0],i=arguments[1],a=arguments[2];if(this._originalPt=r,this._pt=r,this._scaleFactor=i,this._li=a,i<=0)throw new I("Scale factor must be non-zero");i!==1&&(this._pt=new D(this.scale(r.x),this.scale(r.y)),this._p0Scaled=new D,this._p1Scaled=new D),this.initCorners(this._pt)},Vh={SAFE_ENV_EXPANSION_FACTOR:{configurable:!0}};Wr.prototype.intersectsScaled=function(r,i){var a=Math.min(r.x,i.x),c=Math.max(r.x,i.x),d=Math.min(r.y,i.y),_=Math.max(r.y,i.y),M=this._maxx<a||this._minx>c||this._maxy<d||this._miny>_;if(M)return!1;var L=this.intersectsToleranceSquare(r,i);return Wt.isTrue(!(M&&L),"Found bad envelope test"),L},Wr.prototype.initCorners=function(r){this._minx=r.x-.5,this._maxx=r.x+.5,this._miny=r.y-.5,this._maxy=r.y+.5,this._corner[0]=new D(this._maxx,this._maxy),this._corner[1]=new D(this._minx,this._maxy),this._corner[2]=new D(this._minx,this._miny),this._corner[3]=new D(this._maxx,this._miny)},Wr.prototype.intersects=function(r,i){return this._scaleFactor===1?this.intersectsScaled(r,i):(this.copyScaled(r,this._p0Scaled),this.copyScaled(i,this._p1Scaled),this.intersectsScaled(this._p0Scaled,this._p1Scaled))},Wr.prototype.scale=function(r){return Math.round(r*this._scaleFactor)},Wr.prototype.getCoordinate=function(){return this._originalPt},Wr.prototype.copyScaled=function(r,i){i.x=this.scale(r.x),i.y=this.scale(r.y)},Wr.prototype.getSafeEnvelope=function(){if(this._safeEnv===null){var r=Wr.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new qt(this._originalPt.x-r,this._originalPt.x+r,this._originalPt.y-r,this._originalPt.y+r)}return this._safeEnv},Wr.prototype.intersectsPixelClosure=function(r,i){return this._li.computeIntersection(r,i,this._corner[0],this._corner[1]),!!this._li.hasIntersection()||(this._li.computeIntersection(r,i,this._corner[1],this._corner[2]),!!this._li.hasIntersection()||(this._li.computeIntersection(r,i,this._corner[2],this._corner[3]),!!this._li.hasIntersection()||(this._li.computeIntersection(r,i,this._corner[3],this._corner[0]),!!this._li.hasIntersection())))},Wr.prototype.intersectsToleranceSquare=function(r,i){var a=!1,c=!1;return this._li.computeIntersection(r,i,this._corner[0],this._corner[1]),!!this._li.isProper()||(this._li.computeIntersection(r,i,this._corner[1],this._corner[2]),!!this._li.isProper()||(this._li.hasIntersection()&&(a=!0),this._li.computeIntersection(r,i,this._corner[2],this._corner[3]),!!this._li.isProper()||(this._li.hasIntersection()&&(c=!0),this._li.computeIntersection(r,i,this._corner[3],this._corner[0]),!!this._li.isProper()||!(!a||!c)||!!r.equals(this._pt)||!!i.equals(this._pt))))},Wr.prototype.addSnappedNode=function(r,i){var a=r.getCoordinate(i),c=r.getCoordinate(i+1);return!!this.intersects(a,c)&&(r.addIntersection(this.getCoordinate(),i),!0)},Wr.prototype.interfaces_=function(){return[]},Wr.prototype.getClass=function(){return Wr},Vh.SAFE_ENV_EXPANSION_FACTOR.get=function(){return .75},Object.defineProperties(Wr,Vh);var pl=function(){this.tempEnv1=new qt,this.selectedSegment=new ie};pl.prototype.select=function(){if(arguments.length!==1){if(arguments.length===2){var r=arguments[0],i=arguments[1];r.getLineSegment(i,this.selectedSegment),this.select(this.selectedSegment)}}},pl.prototype.interfaces_=function(){return[]},pl.prototype.getClass=function(){return pl};var xu=function(){this._index=null;var r=arguments[0];this._index=r},qa={HotPixelSnapAction:{configurable:!0}};xu.prototype.snap=function(){if(arguments.length===1){var r=arguments[0];return this.snap(r,null,-1)}if(arguments.length===3){var i=arguments[0],a=arguments[1],c=arguments[2],d=i.getSafeEnvelope(),_=new Fo(i,a,c);return this._index.query(d,{interfaces_:function(){return[Us]},visitItem:function(M){M.select(d,_)}}),_.isNodeAdded()}},xu.prototype.interfaces_=function(){return[]},xu.prototype.getClass=function(){return xu},qa.HotPixelSnapAction.get=function(){return Fo},Object.defineProperties(xu,qa);var Fo=function(r){function i(){r.call(this),this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var a=arguments[0],c=arguments[1],d=arguments[2];this._hotPixel=a,this._parentEdge=c,this._hotPixelVertexIndex=d}return r&&(i.__proto__=r),i.prototype=Object.create(r&&r.prototype),i.prototype.constructor=i,i.prototype.isNodeAdded=function(){return this._isNodeAdded},i.prototype.select=function(){if(arguments.length!==2)return r.prototype.select.apply(this,arguments);var a=arguments[0],c=arguments[1],d=a.getContext();if(this._parentEdge!==null&&d===this._parentEdge&&c===this._hotPixelVertexIndex)return null;this._isNodeAdded=this._hotPixel.addSnappedNode(d,c)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(pl),pa=function(){this._li=null,this._interiorIntersections=null;var r=arguments[0];this._li=r,this._interiorIntersections=new G};pa.prototype.processIntersections=function(r,i,a,c){if(r===a&&i===c)return null;var d=r.getCoordinates()[i],_=r.getCoordinates()[i+1],M=a.getCoordinates()[c],L=a.getCoordinates()[c+1];if(this._li.computeIntersection(d,_,M,L),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var H=0;H<this._li.getIntersectionNum();H++)this._interiorIntersections.add(this._li.getIntersection(H));r.addIntersections(this._li,i,0),a.addIntersections(this._li,c,1)}},pa.prototype.isDone=function(){return!1},pa.prototype.getInteriorIntersections=function(){return this._interiorIntersections},pa.prototype.interfaces_=function(){return[Bs]},pa.prototype.getClass=function(){return pa};var rs=function(){this._pm=null,this._li=null,this._scaleFactor=null,this._noder=null,this._pointSnapper=null,this._nodedSegStrings=null;var r=arguments[0];this._pm=r,this._li=new z,this._li.setPrecisionModel(r),this._scaleFactor=r.getScale()};rs.prototype.checkCorrectness=function(r){var i=mr.getNodedSubstrings(r),a=new mo(i);try{a.checkValid()}catch(c){if(!(c instanceof jt))throw c;c.printStackTrace()}},rs.prototype.getNodedSubstrings=function(){return mr.getNodedSubstrings(this._nodedSegStrings)},rs.prototype.snapRound=function(r,i){var a=this.findInteriorIntersections(r,i);this.computeIntersectionSnaps(a),this.computeVertexSnaps(r)},rs.prototype.findInteriorIntersections=function(r,i){var a=new pa(i);return this._noder.setSegmentIntersector(a),this._noder.computeNodes(r),a.getInteriorIntersections()},rs.prototype.computeVertexSnaps=function(){if(Q(arguments[0],at))for(var r=arguments[0].iterator();r.hasNext();){var i=r.next();this.computeVertexSnaps(i)}else if(arguments[0]instanceof mr)for(var a=arguments[0],c=a.getCoordinates(),d=0;d<c.length;d++){var _=new Wr(c[d],this._scaleFactor,this._li);this._pointSnapper.snap(_,a,d)&&a.addIntersection(c[d],d)}},rs.prototype.computeNodes=function(r){this._nodedSegStrings=r,this._noder=new hl,this._pointSnapper=new xu(this._noder.getIndex()),this.snapRound(r,this._li)},rs.prototype.computeIntersectionSnaps=function(r){for(var i=r.iterator();i.hasNext();){var a=i.next(),c=new Wr(a,this._scaleFactor,this._li);this._pointSnapper.snap(c)}},rs.prototype.interfaces_=function(){return[Yi]},rs.prototype.getClass=function(){return rs};var Xr=function(){if(this._argGeom=null,this._distance=null,this._bufParams=new Ge,this._resultGeometry=null,this._saveException=null,arguments.length===1){var r=arguments[0];this._argGeom=r}else if(arguments.length===2){var i=arguments[0],a=arguments[1];this._argGeom=i,this._bufParams=a}},Eu={CAP_ROUND:{configurable:!0},CAP_BUTT:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},MAX_PRECISION_DIGITS:{configurable:!0}};Xr.prototype.bufferFixedPrecision=function(r){var i=new ns(new rs(new ze(1)),r.getScale()),a=new ai(this._bufParams);a.setWorkingPrecisionModel(r),a.setNoder(i),this._resultGeometry=a.buffer(this._argGeom,this._distance)},Xr.prototype.bufferReducedPrecision=function(){var r=this;if(arguments.length===0){for(var i=Xr.MAX_PRECISION_DIGITS;i>=0;i--){try{r.bufferReducedPrecision(i)}catch(_){if(!(_ instanceof Qo))throw _;r._saveException=_}if(r._resultGeometry!==null)return null}throw this._saveException}if(arguments.length===1){var a=arguments[0],c=Xr.precisionScaleFactor(this._argGeom,this._distance,a),d=new ze(c);this.bufferFixedPrecision(d)}},Xr.prototype.computeGeometry=function(){if(this.bufferOriginalPrecision(),this._resultGeometry!==null)return null;var r=this._argGeom.getFactory().getPrecisionModel();r.getType()===ze.FIXED?this.bufferFixedPrecision(r):this.bufferReducedPrecision()},Xr.prototype.setQuadrantSegments=function(r){this._bufParams.setQuadrantSegments(r)},Xr.prototype.bufferOriginalPrecision=function(){try{var r=new ai(this._bufParams);this._resultGeometry=r.buffer(this._argGeom,this._distance)}catch(i){if(!(i instanceof Te))throw i;this._saveException=i}},Xr.prototype.getResultGeometry=function(r){return this._distance=r,this.computeGeometry(),this._resultGeometry},Xr.prototype.setEndCapStyle=function(r){this._bufParams.setEndCapStyle(r)},Xr.prototype.interfaces_=function(){return[]},Xr.prototype.getClass=function(){return Xr},Xr.bufferOp=function(){if(arguments.length===2){var r=arguments[0],i=arguments[1];return new Xr(r).getResultGeometry(i)}if(arguments.length===3){if(Number.isInteger(arguments[2])&&arguments[0]instanceof Vt&&typeof arguments[1]=="number"){var a=arguments[0],c=arguments[1],d=arguments[2],_=new Xr(a);return _.setQuadrantSegments(d),_.getResultGeometry(c)}if(arguments[2]instanceof Ge&&arguments[0]instanceof Vt&&typeof arguments[1]=="number"){var M=arguments[0],L=arguments[1],H=arguments[2];return new Xr(M,H).getResultGeometry(L)}}else if(arguments.length===4){var it=arguments[0],bt=arguments[1],Tt=arguments[2],Kt=arguments[3],Qt=new Xr(it);return Qt.setQuadrantSegments(Tt),Qt.setEndCapStyle(Kt),Qt.getResultGeometry(bt)}},Xr.precisionScaleFactor=function(r,i,a){var c=r.getEnvelopeInternal(),d=At.max(Math.abs(c.getMaxX()),Math.abs(c.getMaxY()),Math.abs(c.getMinX()),Math.abs(c.getMinY()))+2*(i>0?i:0),_=a-Math.trunc(Math.log(d)/Math.log(10)+1);return Math.pow(10,_)},Eu.CAP_ROUND.get=function(){return Ge.CAP_ROUND},Eu.CAP_BUTT.get=function(){return Ge.CAP_FLAT},Eu.CAP_FLAT.get=function(){return Ge.CAP_FLAT},Eu.CAP_SQUARE.get=function(){return Ge.CAP_SQUARE},Eu.MAX_PRECISION_DIGITS.get=function(){return 12},Object.defineProperties(Xr,Eu);var ui=function(){this._pt=[new D,new D],this._distance=A.NaN,this._isNull=!0};ui.prototype.getCoordinates=function(){return this._pt},ui.prototype.getCoordinate=function(r){return this._pt[r]},ui.prototype.setMinimum=function(){if(arguments.length===1){var r=arguments[0];this.setMinimum(r._pt[0],r._pt[1])}else if(arguments.length===2){var i=arguments[0],a=arguments[1];if(this._isNull)return this.initialize(i,a),null;var c=i.distance(a);c<this._distance&&this.initialize(i,a,c)}},ui.prototype.initialize=function(){if(arguments.length===0)this._isNull=!0;else if(arguments.length===2){var r=arguments[0],i=arguments[1];this._pt[0].setCoordinate(r),this._pt[1].setCoordinate(i),this._distance=r.distance(i),this._isNull=!1}else if(arguments.length===3){var a=arguments[0],c=arguments[1],d=arguments[2];this._pt[0].setCoordinate(a),this._pt[1].setCoordinate(c),this._distance=d,this._isNull=!1}},ui.prototype.getDistance=function(){return this._distance},ui.prototype.setMaximum=function(){if(arguments.length===1){var r=arguments[0];this.setMaximum(r._pt[0],r._pt[1])}else if(arguments.length===2){var i=arguments[0],a=arguments[1];if(this._isNull)return this.initialize(i,a),null;var c=i.distance(a);c>this._distance&&this.initialize(i,a,c)}},ui.prototype.interfaces_=function(){return[]},ui.prototype.getClass=function(){return ui};var is=function(){};is.prototype.interfaces_=function(){return[]},is.prototype.getClass=function(){return is},is.computeDistance=function(){if(arguments[2]instanceof ui&&arguments[0]instanceof vt&&arguments[1]instanceof D)for(var r=arguments[0],i=arguments[1],a=arguments[2],c=r.getCoordinates(),d=new ie,_=0;_<c.length-1;_++){d.setCoordinates(c[_],c[_+1]);var M=d.closestPoint(i);a.setMinimum(M,i)}else if(arguments[2]instanceof ui&&arguments[0]instanceof de&&arguments[1]instanceof D){var L=arguments[0],H=arguments[1],it=arguments[2];is.computeDistance(L.getExteriorRing(),H,it);for(var bt=0;bt<L.getNumInteriorRing();bt++)is.computeDistance(L.getInteriorRingN(bt),H,it)}else if(arguments[2]instanceof ui&&arguments[0]instanceof Vt&&arguments[1]instanceof D){var Tt=arguments[0],Kt=arguments[1],Qt=arguments[2];if(Tt instanceof vt)is.computeDistance(Tt,Kt,Qt);else if(Tt instanceof de)is.computeDistance(Tt,Kt,Qt);else if(Tt instanceof Qn)for(var le=Tt,Ee=0;Ee<le.getNumGeometries();Ee++){var Dn=le.getGeometryN(Ee);is.computeDistance(Dn,Kt,Qt)}else Qt.setMinimum(Tt.getCoordinate(),Kt)}else if(arguments[2]instanceof ui&&arguments[0]instanceof ie&&arguments[1]instanceof D){var Jn=arguments[0],fi=arguments[1],as=arguments[2],qs=Jn.closestPoint(fi);as.setMinimum(qs,fi)}};var Ki=function(r){this._maxPtDist=new ui,this._inputGeom=r||null},gt={MaxPointDistanceFilter:{configurable:!0},MaxMidpointDistanceFilter:{configurable:!0}};Ki.prototype.computeMaxMidpointDistance=function(r){var i=new Ct(this._inputGeom);r.apply(i),this._maxPtDist.setMaximum(i.getMaxPointDistance())},Ki.prototype.computeMaxVertexDistance=function(r){var i=new Nt(this._inputGeom);r.apply(i),this._maxPtDist.setMaximum(i.getMaxPointDistance())},Ki.prototype.findDistance=function(r){return this.computeMaxVertexDistance(r),this.computeMaxMidpointDistance(r),this._maxPtDist.getDistance()},Ki.prototype.getDistancePoints=function(){return this._maxPtDist},Ki.prototype.interfaces_=function(){return[]},Ki.prototype.getClass=function(){return Ki},gt.MaxPointDistanceFilter.get=function(){return Nt},gt.MaxMidpointDistanceFilter.get=function(){return Ct},Object.defineProperties(Ki,gt);var Nt=function(r){this._maxPtDist=new ui,this._minPtDist=new ui,this._geom=r||null};Nt.prototype.filter=function(r){this._minPtDist.initialize(),is.computeDistance(this._geom,r,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},Nt.prototype.getMaxPointDistance=function(){return this._maxPtDist},Nt.prototype.interfaces_=function(){return[rt]},Nt.prototype.getClass=function(){return Nt};var Ct=function(r){this._maxPtDist=new ui,this._minPtDist=new ui,this._geom=r||null};Ct.prototype.filter=function(r,i){if(i===0)return null;var a=r.getCoordinate(i-1),c=r.getCoordinate(i),d=new D((a.x+c.x)/2,(a.y+c.y)/2);this._minPtDist.initialize(),is.computeDistance(this._geom,d,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},Ct.prototype.isDone=function(){return!1},Ct.prototype.isGeometryChanged=function(){return!1},Ct.prototype.getMaxPointDistance=function(){return this._maxPtDist},Ct.prototype.interfaces_=function(){return[ur]},Ct.prototype.getClass=function(){return Ct};var se=function(r){this._comps=r||null};se.prototype.filter=function(r){r instanceof de&&this._comps.add(r)},se.prototype.interfaces_=function(){return[pr]},se.prototype.getClass=function(){return se},se.getPolygons=function(){if(arguments.length===1){var r=arguments[0];return se.getPolygons(r,new G)}if(arguments.length===2){var i=arguments[0],a=arguments[1];return i instanceof de?a.add(i):i instanceof Qn&&i.apply(new se(a)),a}};var _e=function(){if(this._lines=null,this._isForcedToLineString=!1,arguments.length===1){var r=arguments[0];this._lines=r}else if(arguments.length===2){var i=arguments[0],a=arguments[1];this._lines=i,this._isForcedToLineString=a}};_e.prototype.filter=function(r){if(this._isForcedToLineString&&r instanceof Ae){var i=r.getFactory().createLineString(r.getCoordinateSequence());return this._lines.add(i),null}r instanceof vt&&this._lines.add(r)},_e.prototype.setForceToLineString=function(r){this._isForcedToLineString=r},_e.prototype.interfaces_=function(){return[Ce]},_e.prototype.getClass=function(){return _e},_e.getGeometry=function(){if(arguments.length===1){var r=arguments[0];return r.getFactory().buildGeometry(_e.getLines(r))}if(arguments.length===2){var i=arguments[0],a=arguments[1];return i.getFactory().buildGeometry(_e.getLines(i,a))}},_e.getLines=function(){if(arguments.length===1){var r=arguments[0];return _e.getLines(r,!1)}if(arguments.length===2){if(Q(arguments[0],at)&&Q(arguments[1],at)){for(var i=arguments[0],a=arguments[1],c=i.iterator();c.hasNext();){var d=c.next();_e.getLines(d,a)}return a}if(arguments[0]instanceof Vt&&typeof arguments[1]=="boolean"){var _=arguments[0],M=arguments[1],L=new G;return _.apply(new _e(L,M)),L}if(arguments[0]instanceof Vt&&Q(arguments[1],at)){var H=arguments[0],it=arguments[1];return H instanceof vt?it.add(H):H.apply(new _e(it)),it}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&Q(arguments[0],at)&&Q(arguments[1],at)){for(var bt=arguments[0],Tt=arguments[1],Kt=arguments[2],Qt=bt.iterator();Qt.hasNext();){var le=Qt.next();_e.getLines(le,Tt,Kt)}return Tt}if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Vt&&Q(arguments[1],at)){var Ee=arguments[0],Dn=arguments[1],Jn=arguments[2];return Ee.apply(new _e(Dn,Jn)),Dn}}};var ke=function(){if(this._boundaryRule=P.OGC_SFS_BOUNDARY_RULE,this._isIn=null,this._numBoundaries=null,arguments.length!==0){if(arguments.length===1){var r=arguments[0];if(r===null)throw new I("Rule must be non-null");this._boundaryRule=r}}};ke.prototype.locateInternal=function(){if(arguments[0]instanceof D&&arguments[1]instanceof de){var r=arguments[0],i=arguments[1];if(i.isEmpty())return K.EXTERIOR;var a=i.getExteriorRing(),c=this.locateInPolygonRing(r,a);if(c===K.EXTERIOR)return K.EXTERIOR;if(c===K.BOUNDARY)return K.BOUNDARY;for(var d=0;d<i.getNumInteriorRing();d++){var _=i.getInteriorRingN(d),M=this.locateInPolygonRing(r,_);if(M===K.INTERIOR)return K.EXTERIOR;if(M===K.BOUNDARY)return K.BOUNDARY}return K.INTERIOR}if(arguments[0]instanceof D&&arguments[1]instanceof vt){var L=arguments[0],H=arguments[1];if(!H.getEnvelopeInternal().intersects(L))return K.EXTERIOR;var it=H.getCoordinates();return H.isClosed()||!L.equals(it[0])&&!L.equals(it[it.length-1])?dt.isOnLine(L,it)?K.INTERIOR:K.EXTERIOR:K.BOUNDARY}if(arguments[0]instanceof D&&arguments[1]instanceof ue){var bt=arguments[0];return arguments[1].getCoordinate().equals2D(bt)?K.INTERIOR:K.EXTERIOR}},ke.prototype.locateInPolygonRing=function(r,i){return i.getEnvelopeInternal().intersects(r)?dt.locatePointInRing(r,i.getCoordinates()):K.EXTERIOR},ke.prototype.intersects=function(r,i){return this.locate(r,i)!==K.EXTERIOR},ke.prototype.updateLocationInfo=function(r){r===K.INTERIOR&&(this._isIn=!0),r===K.BOUNDARY&&this._numBoundaries++},ke.prototype.computeLocation=function(r,i){if(i instanceof ue&&this.updateLocationInfo(this.locateInternal(r,i)),i instanceof vt)this.updateLocationInfo(this.locateInternal(r,i));else if(i instanceof de)this.updateLocationInfo(this.locateInternal(r,i));else if(i instanceof bi)for(var a=i,c=0;c<a.getNumGeometries();c++){var d=a.getGeometryN(c);this.updateLocationInfo(this.locateInternal(r,d))}else if(i instanceof Pe)for(var _=i,M=0;M<_.getNumGeometries();M++){var L=_.getGeometryN(M);this.updateLocationInfo(this.locateInternal(r,L))}else if(i instanceof Qn)for(var H=new go(i);H.hasNext();){var it=H.next();it!==i&&this.computeLocation(r,it)}},ke.prototype.locate=function(r,i){return i.isEmpty()?K.EXTERIOR:i instanceof vt?this.locateInternal(r,i):i instanceof de?this.locateInternal(r,i):(this._isIn=!1,this._numBoundaries=0,this.computeLocation(r,i),this._boundaryRule.isInBoundary(this._numBoundaries)?K.BOUNDARY:this._numBoundaries>0||this._isIn?K.INTERIOR:K.EXTERIOR)},ke.prototype.interfaces_=function(){return[]},ke.prototype.getClass=function(){return ke};var ln=function r(){if(this._component=null,this._segIndex=null,this._pt=null,arguments.length===2){var i=arguments[0],a=arguments[1];r.call(this,i,r.INSIDE_AREA,a)}else if(arguments.length===3){var c=arguments[0],d=arguments[1],_=arguments[2];this._component=c,this._segIndex=d,this._pt=_}},cr={INSIDE_AREA:{configurable:!0}};ln.prototype.isInsideArea=function(){return this._segIndex===ln.INSIDE_AREA},ln.prototype.getCoordinate=function(){return this._pt},ln.prototype.getGeometryComponent=function(){return this._component},ln.prototype.getSegmentIndex=function(){return this._segIndex},ln.prototype.interfaces_=function(){return[]},ln.prototype.getClass=function(){return ln},cr.INSIDE_AREA.get=function(){return-1},Object.defineProperties(ln,cr);var os=function(r){this._pts=r||null};os.prototype.filter=function(r){r instanceof ue&&this._pts.add(r)},os.prototype.interfaces_=function(){return[pr]},os.prototype.getClass=function(){return os},os.getPoints=function(){if(arguments.length===1){var r=arguments[0];return r instanceof ue?ho.singletonList(r):os.getPoints(r,new G)}if(arguments.length===2){var i=arguments[0],a=arguments[1];return i instanceof ue?a.add(i):i instanceof Qn&&i.apply(new os(a)),a}};var Ha=function(){this._locations=null;var r=arguments[0];this._locations=r};Ha.prototype.filter=function(r){(r instanceof ue||r instanceof vt||r instanceof de)&&this._locations.add(new ln(r,0,r.getCoordinate()))},Ha.prototype.interfaces_=function(){return[pr]},Ha.prototype.getClass=function(){return Ha},Ha.getLocations=function(r){var i=new G;return r.apply(new Ha(i)),i};var tr=function(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new ke,this._minDistanceLocation=null,this._minDistance=A.MAX_VALUE,arguments.length===2){var r=arguments[0],i=arguments[1];this._geom=[r,i],this._terminateDistance=0}else if(arguments.length===3){var a=arguments[0],c=arguments[1],d=arguments[2];this._geom=new Array(2).fill(null),this._geom[0]=a,this._geom[1]=c,this._terminateDistance=d}};tr.prototype.computeContainmentDistance=function(){if(arguments.length===0){var r=new Array(2).fill(null);if(this.computeContainmentDistance(0,r),this._minDistance<=this._terminateDistance)return null;this.computeContainmentDistance(1,r)}else if(arguments.length===2){var i=arguments[0],a=arguments[1],c=1-i,d=se.getPolygons(this._geom[i]);if(d.size()>0){var _=Ha.getLocations(this._geom[c]);if(this.computeContainmentDistance(_,d,a),this._minDistance<=this._terminateDistance)return this._minDistanceLocation[c]=a[0],this._minDistanceLocation[i]=a[1],null}}else if(arguments.length===3){if(arguments[2]instanceof Array&&Q(arguments[0],Et)&&Q(arguments[1],Et)){for(var M=arguments[0],L=arguments[1],H=arguments[2],it=0;it<M.size();it++)for(var bt=M.get(it),Tt=0;Tt<L.size();Tt++)if(this.computeContainmentDistance(bt,L.get(Tt),H),this._minDistance<=this._terminateDistance)return null}else if(arguments[2]instanceof Array&&arguments[0]instanceof ln&&arguments[1]instanceof de){var Kt=arguments[0],Qt=arguments[1],le=arguments[2],Ee=Kt.getCoordinate();if(K.EXTERIOR!==this._ptLocator.locate(Ee,Qt))return this._minDistance=0,le[0]=Kt,le[1]=new ln(Qt,Ee),null}}},tr.prototype.computeMinDistanceLinesPoints=function(r,i,a){for(var c=0;c<r.size();c++)for(var d=r.get(c),_=0;_<i.size();_++){var M=i.get(_);if(this.computeMinDistance(d,M,a),this._minDistance<=this._terminateDistance)return null}},tr.prototype.computeFacetDistance=function(){var r=new Array(2).fill(null),i=_e.getLines(this._geom[0]),a=_e.getLines(this._geom[1]),c=os.getPoints(this._geom[0]),d=os.getPoints(this._geom[1]);return this.computeMinDistanceLines(i,a,r),this.updateMinDistance(r,!1),this._minDistance<=this._terminateDistance?null:(r[0]=null,r[1]=null,this.computeMinDistanceLinesPoints(i,d,r),this.updateMinDistance(r,!1),this._minDistance<=this._terminateDistance?null:(r[0]=null,r[1]=null,this.computeMinDistanceLinesPoints(a,c,r),this.updateMinDistance(r,!0),this._minDistance<=this._terminateDistance?null:(r[0]=null,r[1]=null,this.computeMinDistancePoints(c,d,r),void this.updateMinDistance(r,!1))))},tr.prototype.nearestLocations=function(){return this.computeMinDistance(),this._minDistanceLocation},tr.prototype.updateMinDistance=function(r,i){if(r[0]===null)return null;i?(this._minDistanceLocation[0]=r[1],this._minDistanceLocation[1]=r[0]):(this._minDistanceLocation[0]=r[0],this._minDistanceLocation[1]=r[1])},tr.prototype.nearestPoints=function(){return this.computeMinDistance(),[this._minDistanceLocation[0].getCoordinate(),this._minDistanceLocation[1].getCoordinate()]},tr.prototype.computeMinDistance=function(){if(arguments.length===0){if(this._minDistanceLocation!==null||(this._minDistanceLocation=new Array(2).fill(null),this.computeContainmentDistance(),this._minDistance<=this._terminateDistance))return null;this.computeFacetDistance()}else if(arguments.length===3){if(arguments[2]instanceof Array&&arguments[0]instanceof vt&&arguments[1]instanceof ue){var r=arguments[0],i=arguments[1],a=arguments[2];if(r.getEnvelopeInternal().distance(i.getEnvelopeInternal())>this._minDistance)return null;for(var c=r.getCoordinates(),d=i.getCoordinate(),_=0;_<c.length-1;_++){var M=dt.distancePointLine(d,c[_],c[_+1]);if(M<this._minDistance){this._minDistance=M;var L=new ie(c[_],c[_+1]).closestPoint(d);a[0]=new ln(r,_,L),a[1]=new ln(i,0,d)}if(this._minDistance<=this._terminateDistance)return null}}else if(arguments[2]instanceof Array&&arguments[0]instanceof vt&&arguments[1]instanceof vt){var H=arguments[0],it=arguments[1],bt=arguments[2];if(H.getEnvelopeInternal().distance(it.getEnvelopeInternal())>this._minDistance)return null;for(var Tt=H.getCoordinates(),Kt=it.getCoordinates(),Qt=0;Qt<Tt.length-1;Qt++)for(var le=0;le<Kt.length-1;le++){var Ee=dt.distanceLineLine(Tt[Qt],Tt[Qt+1],Kt[le],Kt[le+1]);if(Ee<this._minDistance){this._minDistance=Ee;var Dn=new ie(Tt[Qt],Tt[Qt+1]),Jn=new ie(Kt[le],Kt[le+1]),fi=Dn.closestPoints(Jn);bt[0]=new ln(H,Qt,fi[0]),bt[1]=new ln(it,le,fi[1])}if(this._minDistance<=this._terminateDistance)return null}}}},tr.prototype.computeMinDistancePoints=function(r,i,a){for(var c=0;c<r.size();c++)for(var d=r.get(c),_=0;_<i.size();_++){var M=i.get(_),L=d.getCoordinate().distance(M.getCoordinate());if(L<this._minDistance&&(this._minDistance=L,a[0]=new ln(d,0,d.getCoordinate()),a[1]=new ln(M,0,M.getCoordinate())),this._minDistance<=this._terminateDistance)return null}},tr.prototype.distance=function(){if(this._geom[0]===null||this._geom[1]===null)throw new I("null geometries are not supported");return this._geom[0].isEmpty()||this._geom[1].isEmpty()?0:(this.computeMinDistance(),this._minDistance)},tr.prototype.computeMinDistanceLines=function(r,i,a){for(var c=0;c<r.size();c++)for(var d=r.get(c),_=0;_<i.size();_++){var M=i.get(_);if(this.computeMinDistance(d,M,a),this._minDistance<=this._terminateDistance)return null}},tr.prototype.interfaces_=function(){return[]},tr.prototype.getClass=function(){return tr},tr.distance=function(r,i){return new tr(r,i).distance()},tr.isWithinDistance=function(r,i,a){return new tr(r,i,a).distance()<=a},tr.nearestPoints=function(r,i){return new tr(r,i).nearestPoints()};var Nr=function(){this._pt=[new D,new D],this._distance=A.NaN,this._isNull=!0};Nr.prototype.getCoordinates=function(){return this._pt},Nr.prototype.getCoordinate=function(r){return this._pt[r]},Nr.prototype.setMinimum=function(){if(arguments.length===1){var r=arguments[0];this.setMinimum(r._pt[0],r._pt[1])}else if(arguments.length===2){var i=arguments[0],a=arguments[1];if(this._isNull)return this.initialize(i,a),null;var c=i.distance(a);c<this._distance&&this.initialize(i,a,c)}},Nr.prototype.initialize=function(){if(arguments.length===0)this._isNull=!0;else if(arguments.length===2){var r=arguments[0],i=arguments[1];this._pt[0].setCoordinate(r),this._pt[1].setCoordinate(i),this._distance=r.distance(i),this._isNull=!1}else if(arguments.length===3){var a=arguments[0],c=arguments[1],d=arguments[2];this._pt[0].setCoordinate(a),this._pt[1].setCoordinate(c),this._distance=d,this._isNull=!1}},Nr.prototype.toString=function(){return fe.toLineString(this._pt[0],this._pt[1])},Nr.prototype.getDistance=function(){return this._distance},Nr.prototype.setMaximum=function(){if(arguments.length===1){var r=arguments[0];this.setMaximum(r._pt[0],r._pt[1])}else if(arguments.length===2){var i=arguments[0],a=arguments[1];if(this._isNull)return this.initialize(i,a),null;var c=i.distance(a);c>this._distance&&this.initialize(i,a,c)}},Nr.prototype.interfaces_=function(){return[]},Nr.prototype.getClass=function(){return Nr};var Uo=function(){};Uo.prototype.interfaces_=function(){return[]},Uo.prototype.getClass=function(){return Uo},Uo.computeDistance=function(){if(arguments[2]instanceof Nr&&arguments[0]instanceof vt&&arguments[1]instanceof D)for(var r=arguments[0],i=arguments[1],a=arguments[2],c=new ie,d=r.getCoordinates(),_=0;_<d.length-1;_++){c.setCoordinates(d[_],d[_+1]);var M=c.closestPoint(i);a.setMinimum(M,i)}else if(arguments[2]instanceof Nr&&arguments[0]instanceof de&&arguments[1]instanceof D){var L=arguments[0],H=arguments[1],it=arguments[2];Uo.computeDistance(L.getExteriorRing(),H,it);for(var bt=0;bt<L.getNumInteriorRing();bt++)Uo.computeDistance(L.getInteriorRingN(bt),H,it)}else if(arguments[2]instanceof Nr&&arguments[0]instanceof Vt&&arguments[1]instanceof D){var Tt=arguments[0],Kt=arguments[1],Qt=arguments[2];if(Tt instanceof vt)Uo.computeDistance(Tt,Kt,Qt);else if(Tt instanceof de)Uo.computeDistance(Tt,Kt,Qt);else if(Tt instanceof Qn)for(var le=Tt,Ee=0;Ee<le.getNumGeometries();Ee++){var Dn=le.getGeometryN(Ee);Uo.computeDistance(Dn,Kt,Qt)}else Qt.setMinimum(Tt.getCoordinate(),Kt)}else if(arguments[2]instanceof Nr&&arguments[0]instanceof ie&&arguments[1]instanceof D){var Jn=arguments[0],fi=arguments[1],as=arguments[2],qs=Jn.closestPoint(fi);as.setMinimum(qs,fi)}};var ei=function(){this._g0=null,this._g1=null,this._ptDist=new Nr,this._densifyFrac=0;var r=arguments[0],i=arguments[1];this._g0=r,this._g1=i},wu={MaxPointDistanceFilter:{configurable:!0},MaxDensifiedByFractionDistanceFilter:{configurable:!0}};ei.prototype.getCoordinates=function(){return this._ptDist.getCoordinates()},ei.prototype.setDensifyFraction=function(r){if(r>1||r<=0)throw new I("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=r},ei.prototype.compute=function(r,i){this.computeOrientedDistance(r,i,this._ptDist),this.computeOrientedDistance(i,r,this._ptDist)},ei.prototype.distance=function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()},ei.prototype.computeOrientedDistance=function(r,i,a){var c=new Ss(i);if(r.apply(c),a.setMaximum(c.getMaxPointDistance()),this._densifyFrac>0){var d=new sn(i,this._densifyFrac);r.apply(d),a.setMaximum(d.getMaxPointDistance())}},ei.prototype.orientedDistance=function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()},ei.prototype.interfaces_=function(){return[]},ei.prototype.getClass=function(){return ei},ei.distance=function(){if(arguments.length===2){var r=arguments[0],i=arguments[1];return new ei(r,i).distance()}if(arguments.length===3){var a=arguments[0],c=arguments[1],d=arguments[2],_=new ei(a,c);return _.setDensifyFraction(d),_.distance()}},wu.MaxPointDistanceFilter.get=function(){return Ss},wu.MaxDensifiedByFractionDistanceFilter.get=function(){return sn},Object.defineProperties(ei,wu);var Ss=function(){this._maxPtDist=new Nr,this._minPtDist=new Nr,this._euclideanDist=new Uo,this._geom=null;var r=arguments[0];this._geom=r};Ss.prototype.filter=function(r){this._minPtDist.initialize(),Uo.computeDistance(this._geom,r,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},Ss.prototype.getMaxPointDistance=function(){return this._maxPtDist},Ss.prototype.interfaces_=function(){return[rt]},Ss.prototype.getClass=function(){return Ss};var sn=function(){this._maxPtDist=new Nr,this._minPtDist=new Nr,this._geom=null,this._numSubSegs=0;var r=arguments[0],i=arguments[1];this._geom=r,this._numSubSegs=Math.trunc(Math.round(1/i))};sn.prototype.filter=function(r,i){if(i===0)return null;for(var a=r.getCoordinate(i-1),c=r.getCoordinate(i),d=(c.x-a.x)/this._numSubSegs,_=(c.y-a.y)/this._numSubSegs,M=0;M<this._numSubSegs;M++){var L=a.x+M*d,H=a.y+M*_,it=new D(L,H);this._minPtDist.initialize(),Uo.computeDistance(this._geom,it,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)}},sn.prototype.isDone=function(){return!1},sn.prototype.isGeometryChanged=function(){return!1},sn.prototype.getMaxPointDistance=function(){return this._maxPtDist},sn.prototype.interfaces_=function(){return[ur]},sn.prototype.getClass=function(){return sn};var Li=function(r,i,a){this._minValidDistance=null,this._maxValidDistance=null,this._minDistanceFound=null,this._maxDistanceFound=null,this._isValid=!0,this._errMsg=null,this._errorLocation=null,this._errorIndicator=null,this._input=r||null,this._bufDistance=i||null,this._result=a||null},Ql={VERBOSE:{configurable:!0},MAX_DISTANCE_DIFF_FRAC:{configurable:!0}};Li.prototype.checkMaximumDistance=function(r,i,a){var c=new ei(i,r);if(c.setDensifyFraction(.25),this._maxDistanceFound=c.orientedDistance(),this._maxDistanceFound>a){this._isValid=!1;var d=c.getCoordinates();this._errorLocation=d[1],this._errorIndicator=r.getFactory().createLineString(d),this._errMsg="Distance between buffer curve and input is too large ("+this._maxDistanceFound+" at "+fe.toLineString(d[0],d[1])+")"}},Li.prototype.isValid=function(){var r=Math.abs(this._bufDistance),i=Li.MAX_DISTANCE_DIFF_FRAC*r;return this._minValidDistance=r-i,this._maxValidDistance=r+i,!(!this._input.isEmpty()&&!this._result.isEmpty())||(this._bufDistance>0?this.checkPositiveValid():this.checkNegativeValid(),Li.VERBOSE&&te.out.println("Min Dist= "+this._minDistanceFound+" err= "+(1-this._minDistanceFound/this._bufDistance)+" Max Dist= "+this._maxDistanceFound+" err= "+(this._maxDistanceFound/this._bufDistance-1)),this._isValid)},Li.prototype.checkNegativeValid=function(){if(!(this._input instanceof de||this._input instanceof Pe||this._input instanceof Qn))return null;var r=this.getPolygonLines(this._input);if(this.checkMinimumDistance(r,this._result,this._minValidDistance),!this._isValid)return null;this.checkMaximumDistance(r,this._result,this._maxValidDistance)},Li.prototype.getErrorIndicator=function(){return this._errorIndicator},Li.prototype.checkMinimumDistance=function(r,i,a){var c=new tr(r,i,a);if(this._minDistanceFound=c.distance(),this._minDistanceFound<a){this._isValid=!1;var d=c.nearestPoints();this._errorLocation=c.nearestPoints()[1],this._errorIndicator=r.getFactory().createLineString(d),this._errMsg="Distance between buffer curve and input is too small ("+this._minDistanceFound+" at "+fe.toLineString(d[0],d[1])+" )"}},Li.prototype.checkPositiveValid=function(){var r=this._result.getBoundary();if(this.checkMinimumDistance(this._input,r,this._minValidDistance),!this._isValid)return null;this.checkMaximumDistance(this._input,r,this._maxValidDistance)},Li.prototype.getErrorLocation=function(){return this._errorLocation},Li.prototype.getPolygonLines=function(r){for(var i=new G,a=new _e(i),c=se.getPolygons(r).iterator();c.hasNext();)c.next().apply(a);return r.getFactory().buildGeometry(i)},Li.prototype.getErrorMessage=function(){return this._errMsg},Li.prototype.interfaces_=function(){return[]},Li.prototype.getClass=function(){return Li},Ql.VERBOSE.get=function(){return!1},Ql.MAX_DISTANCE_DIFF_FRAC.get=function(){return .012},Object.defineProperties(Li,Ql);var Rr=function(r,i,a){this._isValid=!0,this._errorMsg=null,this._errorLocation=null,this._errorIndicator=null,this._input=r||null,this._distance=i||null,this._result=a||null},Af={VERBOSE:{configurable:!0},MAX_ENV_DIFF_FRAC:{configurable:!0}};Rr.prototype.isValid=function(){return this.checkPolygonal(),this._isValid?(this.checkExpectedEmpty(),this._isValid?(this.checkEnvelope(),this._isValid?(this.checkArea(),this._isValid?(this.checkDistance(),this._isValid):this._isValid):this._isValid):this._isValid):this._isValid},Rr.prototype.checkEnvelope=function(){if(this._distance<0)return null;var r=this._distance*Rr.MAX_ENV_DIFF_FRAC;r===0&&(r=.001);var i=new qt(this._input.getEnvelopeInternal());i.expandBy(this._distance);var a=new qt(this._result.getEnvelopeInternal());a.expandBy(r),a.contains(i)||(this._isValid=!1,this._errorMsg="Buffer envelope is incorrect",this._errorIndicator=this._input.getFactory().toGeometry(a)),this.report("Envelope")},Rr.prototype.checkDistance=function(){var r=new Li(this._input,this._distance,this._result);r.isValid()||(this._isValid=!1,this._errorMsg=r.getErrorMessage(),this._errorLocation=r.getErrorLocation(),this._errorIndicator=r.getErrorIndicator()),this.report("Distance")},Rr.prototype.checkArea=function(){var r=this._input.getArea(),i=this._result.getArea();this._distance>0&&r>i&&(this._isValid=!1,this._errorMsg="Area of positive buffer is smaller than input",this._errorIndicator=this._result),this._distance<0&&r<i&&(this._isValid=!1,this._errorMsg="Area of negative buffer is larger than input",this._errorIndicator=this._result),this.report("Area")},Rr.prototype.checkPolygonal=function(){this._result instanceof de||this._result instanceof Pe||(this._isValid=!1),this._errorMsg="Result is not polygonal",this._errorIndicator=this._result,this.report("Polygonal")},Rr.prototype.getErrorIndicator=function(){return this._errorIndicator},Rr.prototype.getErrorLocation=function(){return this._errorLocation},Rr.prototype.checkExpectedEmpty=function(){return this._input.getDimension()>=2||this._distance>0?null:(this._result.isEmpty()||(this._isValid=!1,this._errorMsg="Result is non-empty",this._errorIndicator=this._result),void this.report("ExpectedEmpty"))},Rr.prototype.report=function(r){if(!Rr.VERBOSE)return null;te.out.println("Check "+r+": "+(this._isValid?"passed":"FAILED"))},Rr.prototype.getErrorMessage=function(){return this._errorMsg},Rr.prototype.interfaces_=function(){return[]},Rr.prototype.getClass=function(){return Rr},Rr.isValidMsg=function(r,i,a){var c=new Rr(r,i,a);return c.isValid()?null:c.getErrorMessage()},Rr.isValid=function(r,i,a){return!!new Rr(r,i,a).isValid()},Af.VERBOSE.get=function(){return!1},Af.MAX_ENV_DIFF_FRAC.get=function(){return .012},Object.defineProperties(Rr,Af);var Bo=function(){this._pts=null,this._data=null;var r=arguments[0],i=arguments[1];this._pts=r,this._data=i};Bo.prototype.getCoordinates=function(){return this._pts},Bo.prototype.size=function(){return this._pts.length},Bo.prototype.getCoordinate=function(r){return this._pts[r]},Bo.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},Bo.prototype.getSegmentOctant=function(r){return r===this._pts.length-1?-1:ua.octant(this.getCoordinate(r),this.getCoordinate(r+1))},Bo.prototype.setData=function(r){this._data=r},Bo.prototype.getData=function(){return this._data},Bo.prototype.toString=function(){return fe.toLineString(new ye(this._pts))},Bo.prototype.interfaces_=function(){return[No]},Bo.prototype.getClass=function(){return Bo};var Br=function(){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new G,this._intersectionCount=0,this._keepIntersections=!0;var r=arguments[0];this._li=r,this._interiorIntersection=null};Br.prototype.getInteriorIntersection=function(){return this._interiorIntersection},Br.prototype.setCheckEndSegmentsOnly=function(r){this._isCheckEndSegmentsOnly=r},Br.prototype.getIntersectionSegments=function(){return this._intSegments},Br.prototype.count=function(){return this._intersectionCount},Br.prototype.getIntersections=function(){return this._intersections},Br.prototype.setFindAllIntersections=function(r){this._findAllIntersections=r},Br.prototype.setKeepIntersections=function(r){this._keepIntersections=r},Br.prototype.processIntersections=function(r,i,a,c){if(!this._findAllIntersections&&this.hasIntersection()||r===a&&i===c||this._isCheckEndSegmentsOnly&&!(this.isEndSegment(r,i)||this.isEndSegment(a,c)))return null;var d=r.getCoordinates()[i],_=r.getCoordinates()[i+1],M=a.getCoordinates()[c],L=a.getCoordinates()[c+1];this._li.computeIntersection(d,_,M,L),this._li.hasIntersection()&&this._li.isInteriorIntersection()&&(this._intSegments=new Array(4).fill(null),this._intSegments[0]=d,this._intSegments[1]=_,this._intSegments[2]=M,this._intSegments[3]=L,this._interiorIntersection=this._li.getIntersection(0),this._keepIntersections&&this._intersections.add(this._interiorIntersection),this._intersectionCount++)},Br.prototype.isEndSegment=function(r,i){return i===0||i>=r.size()-2},Br.prototype.hasIntersection=function(){return this._interiorIntersection!==null},Br.prototype.isDone=function(){return!this._findAllIntersections&&this._interiorIntersection!==null},Br.prototype.interfaces_=function(){return[Bs]},Br.prototype.getClass=function(){return Br},Br.createAllIntersectionsFinder=function(r){var i=new Br(r);return i.setFindAllIntersections(!0),i},Br.createAnyIntersectionFinder=function(r){return new Br(r)},Br.createIntersectionCounter=function(r){var i=new Br(r);return i.setFindAllIntersections(!0),i.setKeepIntersections(!1),i};var Ni=function(){this._li=new z,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;var r=arguments[0];this._segStrings=r};Ni.prototype.execute=function(){if(this._segInt!==null)return null;this.checkInteriorIntersections()},Ni.prototype.getIntersections=function(){return this._segInt.getIntersections()},Ni.prototype.isValid=function(){return this.execute(),this._isValid},Ni.prototype.setFindAllIntersections=function(r){this._findAllIntersections=r},Ni.prototype.checkInteriorIntersections=function(){this._isValid=!0,this._segInt=new Br(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var r=new hl;if(r.setSegmentIntersector(this._segInt),r.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null},Ni.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new Qo(this.getErrorMessage(),this._segInt.getInteriorIntersection())},Ni.prototype.getErrorMessage=function(){if(this._isValid)return"no intersections found";var r=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+fe.toLineString(r[0],r[1])+" and "+fe.toLineString(r[2],r[3])},Ni.prototype.interfaces_=function(){return[]},Ni.prototype.getClass=function(){return Ni},Ni.computeIntersections=function(r){var i=new Ni(r);return i.setFindAllIntersections(!0),i.isValid(),i.getIntersections()};var Ji=function r(){this._nv=null;var i=arguments[0];this._nv=new Ni(r.toSegmentStrings(i))};Ji.prototype.checkValid=function(){this._nv.checkValid()},Ji.prototype.interfaces_=function(){return[]},Ji.prototype.getClass=function(){return Ji},Ji.toSegmentStrings=function(r){for(var i=new G,a=r.iterator();a.hasNext();){var c=a.next();i.add(new Bo(c.getCoordinates(),c))}return i},Ji.checkValid=function(r){new Ji(r).checkValid()};var Ms=function(r){this._mapOp=r};Ms.prototype.map=function(r){for(var i=new G,a=0;a<r.getNumGeometries();a++){var c=this._mapOp.map(r.getGeometryN(a));c.isEmpty()||i.add(c)}return r.getFactory().createGeometryCollection(Le.toGeometryArray(i))},Ms.prototype.interfaces_=function(){return[]},Ms.prototype.getClass=function(){return Ms},Ms.map=function(r,i){return new Ms(i).map(r)};var yo=function(){this._op=null,this._geometryFactory=null,this._ptLocator=null,this._lineEdgesList=new G,this._resultLineList=new G;var r=arguments[0],i=arguments[1],a=arguments[2];this._op=r,this._geometryFactory=i,this._ptLocator=a};yo.prototype.collectLines=function(r){for(var i=this._op.getGraph().getEdgeEnds().iterator();i.hasNext();){var a=i.next();this.collectLineEdge(a,r,this._lineEdgesList),this.collectBoundaryTouchEdge(a,r,this._lineEdgesList)}},yo.prototype.labelIsolatedLine=function(r,i){var a=this._ptLocator.locate(r.getCoordinate(),this._op.getArgGeometry(i));r.getLabel().setLocation(i,a)},yo.prototype.build=function(r){return this.findCoveredLineEdges(),this.collectLines(r),this.buildLines(r),this._resultLineList},yo.prototype.collectLineEdge=function(r,i,a){var c=r.getLabel(),d=r.getEdge();r.isLineEdge()&&(r.isVisited()||!Re.isResultOfOp(c,i)||d.isCovered()||(a.add(d),r.setVisitedEdge(!0)))},yo.prototype.findCoveredLineEdges=function(){for(var r=this._op.getGraph().getNodes().iterator();r.hasNext();)r.next().getEdges().findCoveredLineEdges();for(var i=this._op.getGraph().getEdgeEnds().iterator();i.hasNext();){var a=i.next(),c=a.getEdge();if(a.isLineEdge()&&!c.isCoveredSet()){var d=this._op.isCoveredByA(a.getCoordinate());c.setCovered(d)}}},yo.prototype.labelIsolatedLines=function(r){for(var i=r.iterator();i.hasNext();){var a=i.next(),c=a.getLabel();a.isIsolated()&&(c.isNull(0)?this.labelIsolatedLine(a,0):this.labelIsolatedLine(a,1))}},yo.prototype.buildLines=function(r){for(var i=this._lineEdgesList.iterator();i.hasNext();){var a=i.next(),c=this._geometryFactory.createLineString(a.getCoordinates());this._resultLineList.add(c),a.setInResult(!0)}},yo.prototype.collectBoundaryTouchEdge=function(r,i,a){var c=r.getLabel();return r.isLineEdge()||r.isVisited()||r.isInteriorAreaEdge()||r.getEdge().isInResult()?null:(Wt.isTrue(!(r.isInResult()||r.getSym().isInResult())||!r.getEdge().isInResult()),void(Re.isResultOfOp(c,i)&&i===Re.INTERSECTION&&(a.add(r.getEdge()),r.setVisitedEdge(!0))))},yo.prototype.interfaces_=function(){return[]},yo.prototype.getClass=function(){return yo};var bs=function(){this._op=null,this._geometryFactory=null,this._resultPointList=new G;var r=arguments[0],i=arguments[1];this._op=r,this._geometryFactory=i};bs.prototype.filterCoveredNodeToPoint=function(r){var i=r.getCoordinate();if(!this._op.isCoveredByLA(i)){var a=this._geometryFactory.createPoint(i);this._resultPointList.add(a)}},bs.prototype.extractNonCoveredResultNodes=function(r){for(var i=this._op.getGraph().getNodes().iterator();i.hasNext();){var a=i.next();if(!a.isInResult()&&!a.isIncidentEdgeInResult()&&(a.getEdges().getDegree()===0||r===Re.INTERSECTION)){var c=a.getLabel();Re.isResultOfOp(c,r)&&this.filterCoveredNodeToPoint(a)}}},bs.prototype.build=function(r){return this.extractNonCoveredResultNodes(r),this._resultPointList},bs.prototype.interfaces_=function(){return[]},bs.prototype.getClass=function(){return bs};var li=function(){this._inputGeom=null,this._factory=null,this._pruneEmptyGeometry=!0,this._preserveGeometryCollectionType=!0,this._preserveCollections=!1,this._preserveType=!1};li.prototype.transformPoint=function(r,i){return this._factory.createPoint(this.transformCoordinates(r.getCoordinateSequence(),r))},li.prototype.transformPolygon=function(r,i){var a=!0,c=this.transformLinearRing(r.getExteriorRing(),r);c!==null&&c instanceof Ae&&!c.isEmpty()||(a=!1);for(var d=new G,_=0;_<r.getNumInteriorRing();_++){var M=this.transformLinearRing(r.getInteriorRingN(_),r);M===null||M.isEmpty()||(M instanceof Ae||(a=!1),d.add(M))}if(a)return this._factory.createPolygon(c,d.toArray([]));var L=new G;return c!==null&&L.add(c),L.addAll(d),this._factory.buildGeometry(L)},li.prototype.createCoordinateSequence=function(r){return this._factory.getCoordinateSequenceFactory().create(r)},li.prototype.getInputGeometry=function(){return this._inputGeom},li.prototype.transformMultiLineString=function(r,i){for(var a=new G,c=0;c<r.getNumGeometries();c++){var d=this.transformLineString(r.getGeometryN(c),r);d!==null&&(d.isEmpty()||a.add(d))}return this._factory.buildGeometry(a)},li.prototype.transformCoordinates=function(r,i){return this.copy(r)},li.prototype.transformLineString=function(r,i){return this._factory.createLineString(this.transformCoordinates(r.getCoordinateSequence(),r))},li.prototype.transformMultiPoint=function(r,i){for(var a=new G,c=0;c<r.getNumGeometries();c++){var d=this.transformPoint(r.getGeometryN(c),r);d!==null&&(d.isEmpty()||a.add(d))}return this._factory.buildGeometry(a)},li.prototype.transformMultiPolygon=function(r,i){for(var a=new G,c=0;c<r.getNumGeometries();c++){var d=this.transformPolygon(r.getGeometryN(c),r);d!==null&&(d.isEmpty()||a.add(d))}return this._factory.buildGeometry(a)},li.prototype.copy=function(r){return r.copy()},li.prototype.transformGeometryCollection=function(r,i){for(var a=new G,c=0;c<r.getNumGeometries();c++){var d=this.transform(r.getGeometryN(c));d!==null&&(this._pruneEmptyGeometry&&d.isEmpty()||a.add(d))}return this._preserveGeometryCollectionType?this._factory.createGeometryCollection(Le.toGeometryArray(a)):this._factory.buildGeometry(a)},li.prototype.transform=function(r){if(this._inputGeom=r,this._factory=r.getFactory(),r instanceof ue)return this.transformPoint(r,null);if(r instanceof Be)return this.transformMultiPoint(r,null);if(r instanceof Ae)return this.transformLinearRing(r,null);if(r instanceof vt)return this.transformLineString(r,null);if(r instanceof bi)return this.transformMultiLineString(r,null);if(r instanceof de)return this.transformPolygon(r,null);if(r instanceof Pe)return this.transformMultiPolygon(r,null);if(r instanceof Qn)return this.transformGeometryCollection(r,null);throw new I("Unknown Geometry subtype: "+r.getClass().getName())},li.prototype.transformLinearRing=function(r,i){var a=this.transformCoordinates(r.getCoordinateSequence(),r);if(a===null)return this._factory.createLinearRing(null);var c=a.size();return c>0&&c<4&&!this._preserveType?this._factory.createLineString(a):this._factory.createLinearRing(a)},li.prototype.interfaces_=function(){return[]},li.prototype.getClass=function(){return li};var zo=function r(){if(this._snapTolerance=0,this._srcPts=null,this._seg=new ie,this._allowSnappingToSourceVertices=!1,this._isClosed=!1,arguments[0]instanceof vt&&typeof arguments[1]=="number"){var i=arguments[0],a=arguments[1];r.call(this,i.getCoordinates(),a)}else if(arguments[0]instanceof Array&&typeof arguments[1]=="number"){var c=arguments[0],d=arguments[1];this._srcPts=c,this._isClosed=r.isClosed(c),this._snapTolerance=d}};zo.prototype.snapVertices=function(r,i){for(var a=this._isClosed?r.size()-1:r.size(),c=0;c<a;c++){var d=r.get(c),_=this.findSnapForVertex(d,i);_!==null&&(r.set(c,new D(_)),c===0&&this._isClosed&&r.set(r.size()-1,new D(_)))}},zo.prototype.findSnapForVertex=function(r,i){for(var a=0;a<i.length;a++){if(r.equals2D(i[a]))return null;if(r.distance(i[a])<this._snapTolerance)return i[a]}return null},zo.prototype.snapTo=function(r){var i=new et(this._srcPts);return this.snapVertices(i,r),this.snapSegments(i,r),i.toCoordinateArray()},zo.prototype.snapSegments=function(r,i){if(i.length===0)return null;var a=i.length;i[0].equals2D(i[i.length-1])&&(a=i.length-1);for(var c=0;c<a;c++){var d=i[c],_=this.findSegmentIndexToSnap(d,r);_>=0&&r.add(_+1,new D(d),!1)}},zo.prototype.findSegmentIndexToSnap=function(r,i){for(var a=A.MAX_VALUE,c=-1,d=0;d<i.size()-1;d++){if(this._seg.p0=i.get(d),this._seg.p1=i.get(d+1),this._seg.p0.equals2D(r)||this._seg.p1.equals2D(r)){if(this._allowSnappingToSourceVertices)continue;return-1}var _=this._seg.distance(r);_<this._snapTolerance&&_<a&&(a=_,c=d)}return c},zo.prototype.setAllowSnappingToSourceVertices=function(r){this._allowSnappingToSourceVertices=r},zo.prototype.interfaces_=function(){return[]},zo.prototype.getClass=function(){return zo},zo.isClosed=function(r){return!(r.length<=1)&&r[0].equals2D(r[r.length-1])};var fr=function(r){this._srcGeom=r||null},Tf={SNAP_PRECISION_FACTOR:{configurable:!0}};fr.prototype.snapTo=function(r,i){var a=this.extractTargetCoordinates(r);return new Su(i,a).transform(this._srcGeom)},fr.prototype.snapToSelf=function(r,i){var a=this.extractTargetCoordinates(this._srcGeom),c=new Su(r,a,!0).transform(this._srcGeom),d=c;return i&&Q(d,we)&&(d=c.buffer(0)),d},fr.prototype.computeSnapTolerance=function(r){return this.computeMinimumSegmentLength(r)/10},fr.prototype.extractTargetCoordinates=function(r){for(var i=new b,a=r.getCoordinates(),c=0;c<a.length;c++)i.add(a[c]);return i.toArray(new Array(0).fill(null))},fr.prototype.computeMinimumSegmentLength=function(r){for(var i=A.MAX_VALUE,a=0;a<r.length-1;a++){var c=r[a].distance(r[a+1]);c<i&&(i=c)}return i},fr.prototype.interfaces_=function(){return[]},fr.prototype.getClass=function(){return fr},fr.snap=function(r,i,a){var c=new Array(2).fill(null),d=new fr(r);c[0]=d.snapTo(i,a);var _=new fr(i);return c[1]=_.snapTo(c[0],a),c},fr.computeOverlaySnapTolerance=function(){if(arguments.length===1){var r=arguments[0],i=fr.computeSizeBasedSnapTolerance(r),a=r.getPrecisionModel();if(a.getType()===ze.FIXED){var c=1/a.getScale()*2/1.415;c>i&&(i=c)}return i}if(arguments.length===2){var d=arguments[0],_=arguments[1];return Math.min(fr.computeOverlaySnapTolerance(d),fr.computeOverlaySnapTolerance(_))}},fr.computeSizeBasedSnapTolerance=function(r){var i=r.getEnvelopeInternal();return Math.min(i.getHeight(),i.getWidth())*fr.SNAP_PRECISION_FACTOR},fr.snapToSelf=function(r,i,a){return new fr(r).snapToSelf(i,a)},Tf.SNAP_PRECISION_FACTOR.get=function(){return 1e-9},Object.defineProperties(fr,Tf);var Su=function(r){function i(a,c,d){r.call(this),this._snapTolerance=a||null,this._snapPts=c||null,this._isSelfSnap=d!==void 0&&d}return r&&(i.__proto__=r),i.prototype=Object.create(r&&r.prototype),i.prototype.constructor=i,i.prototype.snapLine=function(a,c){var d=new zo(a,this._snapTolerance);return d.setAllowSnappingToSourceVertices(this._isSelfSnap),d.snapTo(c)},i.prototype.transformCoordinates=function(a,c){var d=a.toCoordinateArray(),_=this.snapLine(d,this._snapPts);return this._factory.getCoordinateSequenceFactory().create(_)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(li),Tr=function(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=0,this._commonSignExp=null};Tr.prototype.getCommon=function(){return A.longBitsToDouble(this._commonBits)},Tr.prototype.add=function(r){var i=A.doubleToLongBits(r);if(this._isFirst)return this._commonBits=i,this._commonSignExp=Tr.signExpBits(this._commonBits),this._isFirst=!1,null;if(Tr.signExpBits(i)!==this._commonSignExp)return this._commonBits=0,null;this._commonMantissaBitsCount=Tr.numCommonMostSigMantissaBits(this._commonBits,i),this._commonBits=Tr.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))},Tr.prototype.toString=function(){if(arguments.length===1){var r=arguments[0],i=A.longBitsToDouble(r),a="0000000000000000000000000000000000000000000000000000000000000000"+A.toBinaryString(r),c=a.substring(a.length-64);return c.substring(0,1)+" "+c.substring(1,12)+"(exp) "+c.substring(12)+" [ "+i+" ]"}},Tr.prototype.interfaces_=function(){return[]},Tr.prototype.getClass=function(){return Tr},Tr.getBit=function(r,i){return r&1<<i?1:0},Tr.signExpBits=function(r){return r>>52},Tr.zeroLowerBits=function(r,i){return r&~((1<<i)-1)},Tr.numCommonMostSigMantissaBits=function(r,i){for(var a=0,c=52;c>=0;c--){if(Tr.getBit(r,c)!==Tr.getBit(i,c))return a;a++}return 52};var Go=function(){this._commonCoord=null,this._ccFilter=new Va},Cf={CommonCoordinateFilter:{configurable:!0},Translater:{configurable:!0}};Go.prototype.addCommonBits=function(r){var i=new Gs(this._commonCoord);r.apply(i),r.geometryChanged()},Go.prototype.removeCommonBits=function(r){if(this._commonCoord.x===0&&this._commonCoord.y===0)return r;var i=new D(this._commonCoord);i.x=-i.x,i.y=-i.y;var a=new Gs(i);return r.apply(a),r.geometryChanged(),r},Go.prototype.getCommonCoordinate=function(){return this._commonCoord},Go.prototype.add=function(r){r.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()},Go.prototype.interfaces_=function(){return[]},Go.prototype.getClass=function(){return Go},Cf.CommonCoordinateFilter.get=function(){return Va},Cf.Translater.get=function(){return Gs},Object.defineProperties(Go,Cf);var Va=function(){this._commonBitsX=new Tr,this._commonBitsY=new Tr};Va.prototype.filter=function(r){this._commonBitsX.add(r.x),this._commonBitsY.add(r.y)},Va.prototype.getCommonCoordinate=function(){return new D(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())},Va.prototype.interfaces_=function(){return[rt]},Va.prototype.getClass=function(){return Va};var Gs=function(){this.trans=null;var r=arguments[0];this.trans=r};Gs.prototype.filter=function(r,i){var a=r.getOrdinate(i,0)+this.trans.x,c=r.getOrdinate(i,1)+this.trans.y;r.setOrdinate(i,0,a),r.setOrdinate(i,1,c)},Gs.prototype.isDone=function(){return!1},Gs.prototype.isGeometryChanged=function(){return!0},Gs.prototype.interfaces_=function(){return[ur]},Gs.prototype.getClass=function(){return Gs};var Cr=function(r,i){this._geom=new Array(2).fill(null),this._snapTolerance=null,this._cbr=null,this._geom[0]=r,this._geom[1]=i,this.computeSnapTolerance()};Cr.prototype.selfSnap=function(r){return new fr(r).snapTo(r,this._snapTolerance)},Cr.prototype.removeCommonBits=function(r){this._cbr=new Go,this._cbr.add(r[0]),this._cbr.add(r[1]);var i=new Array(2).fill(null);return i[0]=this._cbr.removeCommonBits(r[0].copy()),i[1]=this._cbr.removeCommonBits(r[1].copy()),i},Cr.prototype.prepareResult=function(r){return this._cbr.addCommonBits(r),r},Cr.prototype.getResultGeometry=function(r){var i=this.snap(this._geom),a=Re.overlayOp(i[0],i[1],r);return this.prepareResult(a)},Cr.prototype.checkValid=function(r){r.isValid()||te.out.println("Snapped geometry is invalid")},Cr.prototype.computeSnapTolerance=function(){this._snapTolerance=fr.computeOverlaySnapTolerance(this._geom[0],this._geom[1])},Cr.prototype.snap=function(r){var i=this.removeCommonBits(r);return fr.snap(i[0],i[1],this._snapTolerance)},Cr.prototype.interfaces_=function(){return[]},Cr.prototype.getClass=function(){return Cr},Cr.overlayOp=function(r,i,a){return new Cr(r,i).getResultGeometry(a)},Cr.union=function(r,i){return Cr.overlayOp(r,i,Re.UNION)},Cr.intersection=function(r,i){return Cr.overlayOp(r,i,Re.INTERSECTION)},Cr.symDifference=function(r,i){return Cr.overlayOp(r,i,Re.SYMDIFFERENCE)},Cr.difference=function(r,i){return Cr.overlayOp(r,i,Re.DIFFERENCE)};var zr=function(r,i){this._geom=new Array(2).fill(null),this._geom[0]=r,this._geom[1]=i};zr.prototype.getResultGeometry=function(r){var i=null,a=!1,c=null;try{i=Re.overlayOp(this._geom[0],this._geom[1],r),a=!0}catch(d){if(!(d instanceof Te))throw d;c=d}if(!a)try{i=Cr.overlayOp(this._geom[0],this._geom[1],r)}catch(d){throw d instanceof Te?c:d}return i},zr.prototype.interfaces_=function(){return[]},zr.prototype.getClass=function(){return zr},zr.overlayOp=function(r,i,a){return new zr(r,i).getResultGeometry(a)},zr.union=function(r,i){return zr.overlayOp(r,i,Re.UNION)},zr.intersection=function(r,i){return zr.overlayOp(r,i,Re.INTERSECTION)},zr.symDifference=function(r,i){return zr.overlayOp(r,i,Re.SYMDIFFERENCE)},zr.difference=function(r,i){return zr.overlayOp(r,i,Re.DIFFERENCE)};var Wa=function(){this.mce=null,this.chainIndex=null;var r=arguments[0],i=arguments[1];this.mce=r,this.chainIndex=i};Wa.prototype.computeIntersections=function(r,i){this.mce.computeIntersectsForChain(this.chainIndex,r.mce,r.chainIndex,i)},Wa.prototype.interfaces_=function(){return[]},Wa.prototype.getClass=function(){return Wa};var Oi=function r(){if(this._label=null,this._xValue=null,this._eventType=null,this._insertEvent=null,this._deleteEventIndex=null,this._obj=null,arguments.length===2){var i=arguments[0],a=arguments[1];this._eventType=r.DELETE,this._xValue=i,this._insertEvent=a}else if(arguments.length===3){var c=arguments[0],d=arguments[1],_=arguments[2];this._eventType=r.INSERT,this._label=c,this._xValue=d,this._obj=_}},tc={INSERT:{configurable:!0},DELETE:{configurable:!0}};Oi.prototype.isDelete=function(){return this._eventType===Oi.DELETE},Oi.prototype.setDeleteEventIndex=function(r){this._deleteEventIndex=r},Oi.prototype.getObject=function(){return this._obj},Oi.prototype.compareTo=function(r){var i=r;return this._xValue<i._xValue?-1:this._xValue>i._xValue?1:this._eventType<i._eventType?-1:this._eventType>i._eventType?1:0},Oi.prototype.getInsertEvent=function(){return this._insertEvent},Oi.prototype.isInsert=function(){return this._eventType===Oi.INSERT},Oi.prototype.isSameLabel=function(r){return this._label!==null&&this._label===r._label},Oi.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex},Oi.prototype.interfaces_=function(){return[V]},Oi.prototype.getClass=function(){return Oi},tc.INSERT.get=function(){return 1},tc.DELETE.get=function(){return 2},Object.defineProperties(Oi,tc);var ec=function(){};ec.prototype.interfaces_=function(){return[]},ec.prototype.getClass=function(){return ec};var Yr=function(){this._hasIntersection=!1,this._hasProper=!1,this._hasProperInterior=!1,this._properIntersectionPoint=null,this._li=null,this._includeProper=null,this._recordIsolated=null,this._isSelfIntersection=null,this._numIntersections=0,this.numTests=0,this._bdyNodes=null,this._isDone=!1,this._isDoneWhenProperInt=!1;var r=arguments[0],i=arguments[1],a=arguments[2];this._li=r,this._includeProper=i,this._recordIsolated=a};Yr.prototype.isTrivialIntersection=function(r,i,a,c){if(r===a&&this._li.getIntersectionNum()===1){if(Yr.isAdjacentSegments(i,c))return!0;if(r.isClosed()){var d=r.getNumPoints()-1;if(i===0&&c===d||c===0&&i===d)return!0}}return!1},Yr.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},Yr.prototype.setIsDoneIfProperInt=function(r){this._isDoneWhenProperInt=r},Yr.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},Yr.prototype.isBoundaryPointInternal=function(r,i){for(var a=i.iterator();a.hasNext();){var c=a.next().getCoordinate();if(r.isIntersection(c))return!0}return!1},Yr.prototype.hasProperIntersection=function(){return this._hasProper},Yr.prototype.hasIntersection=function(){return this._hasIntersection},Yr.prototype.isDone=function(){return this._isDone},Yr.prototype.isBoundaryPoint=function(r,i){return i!==null&&(!!this.isBoundaryPointInternal(r,i[0])||!!this.isBoundaryPointInternal(r,i[1]))},Yr.prototype.setBoundaryNodes=function(r,i){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=r,this._bdyNodes[1]=i},Yr.prototype.addIntersections=function(r,i,a,c){if(r===a&&i===c)return null;this.numTests++;var d=r.getCoordinates()[i],_=r.getCoordinates()[i+1],M=a.getCoordinates()[c],L=a.getCoordinates()[c+1];this._li.computeIntersection(d,_,M,L),this._li.hasIntersection()&&(this._recordIsolated&&(r.setIsolated(!1),a.setIsolated(!1)),this._numIntersections++,this.isTrivialIntersection(r,i,a,c)||(this._hasIntersection=!0,!this._includeProper&&this._li.isProper()||(r.addIntersections(this._li,i,0),a.addIntersections(this._li,c,1)),this._li.isProper()&&(this._properIntersectionPoint=this._li.getIntersection(0).copy(),this._hasProper=!0,this._isDoneWhenProperInt&&(this._isDone=!0),this.isBoundaryPoint(this._li,this._bdyNodes)||(this._hasProperInterior=!0))))},Yr.prototype.interfaces_=function(){return[]},Yr.prototype.getClass=function(){return Yr},Yr.isAdjacentSegments=function(r,i){return Math.abs(r-i)===1};var ni=function(r){function i(){r.call(this),this.events=new G,this.nOverlaps=null}return r&&(i.__proto__=r),i.prototype=Object.create(r&&r.prototype),i.prototype.constructor=i,i.prototype.prepareEvents=function(){ho.sort(this.events);for(var a=0;a<this.events.size();a++){var c=this.events.get(a);c.isDelete()&&c.getInsertEvent().setDeleteEventIndex(a)}},i.prototype.computeIntersections=function(){if(arguments.length===1){var a=arguments[0];this.nOverlaps=0,this.prepareEvents();for(var c=0;c<this.events.size();c++){var d=this.events.get(c);if(d.isInsert()&&this.processOverlaps(c,d.getDeleteEventIndex(),d,a),a.isDone())break}}else if(arguments.length===3){if(arguments[2]instanceof Yr&&Q(arguments[0],Et)&&Q(arguments[1],Et)){var _=arguments[0],M=arguments[1],L=arguments[2];this.addEdges(_,_),this.addEdges(M,M),this.computeIntersections(L)}else if(typeof arguments[2]=="boolean"&&Q(arguments[0],Et)&&arguments[1]instanceof Yr){var H=arguments[0],it=arguments[1];arguments[2]?this.addEdges(H,null):this.addEdges(H),this.computeIntersections(it)}}},i.prototype.addEdge=function(a,c){for(var d=a.getMonotoneChainEdge(),_=d.getStartIndexes(),M=0;M<_.length-1;M++){var L=new Wa(d,M),H=new Oi(c,d.getMinX(M),L);this.events.add(H),this.events.add(new Oi(d.getMaxX(M),H))}},i.prototype.processOverlaps=function(a,c,d,_){for(var M=d.getObject(),L=a;L<c;L++){var H=this.events.get(L);if(H.isInsert()){var it=H.getObject();d.isSameLabel(H)||(M.computeIntersections(it,_),this.nOverlaps++)}}},i.prototype.addEdges=function(){if(arguments.length===1)for(var a=arguments[0].iterator();a.hasNext();){var c=a.next();this.addEdge(c,c)}else if(arguments.length===2)for(var d=arguments[0],_=arguments[1],M=d.iterator();M.hasNext();){var L=M.next();this.addEdge(L,_)}},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(ec),vr=function(){this._min=A.POSITIVE_INFINITY,this._max=A.NEGATIVE_INFINITY},Wh={NodeComparator:{configurable:!0}};vr.prototype.getMin=function(){return this._min},vr.prototype.intersects=function(r,i){return!(this._min>i||this._max<r)},vr.prototype.getMax=function(){return this._max},vr.prototype.toString=function(){return fe.toLineString(new D(this._min,0),new D(this._max,0))},vr.prototype.interfaces_=function(){return[]},vr.prototype.getClass=function(){return vr},Wh.NodeComparator.get=function(){return dl},Object.defineProperties(vr,Wh);var dl=function(){};dl.prototype.compare=function(r,i){var a=r,c=i,d=(a._min+a._max)/2,_=(c._min+c._max)/2;return d<_?-1:d>_?1:0},dl.prototype.interfaces_=function(){return[q]},dl.prototype.getClass=function(){return dl};var Xh=function(r){function i(){r.call(this),this._item=null;var a=arguments[0],c=arguments[1],d=arguments[2];this._min=a,this._max=c,this._item=d}return r&&(i.__proto__=r),i.prototype=Object.create(r&&r.prototype),i.prototype.constructor=i,i.prototype.query=function(a,c,d){if(!this.intersects(a,c))return null;d.visitItem(this._item)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(vr),em=function(r){function i(){r.call(this),this._node1=null,this._node2=null;var a=arguments[0],c=arguments[1];this._node1=a,this._node2=c,this.buildExtent(this._node1,this._node2)}return r&&(i.__proto__=r),i.prototype=Object.create(r&&r.prototype),i.prototype.constructor=i,i.prototype.buildExtent=function(a,c){this._min=Math.min(a._min,c._min),this._max=Math.max(a._max,c._max)},i.prototype.query=function(a,c,d){if(!this.intersects(a,c))return null;this._node1!==null&&this._node1.query(a,c,d),this._node2!==null&&this._node2.query(a,c,d)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(vr),vo=function(){this._leaves=new G,this._root=null,this._level=0};vo.prototype.buildTree=function(){ho.sort(this._leaves,new vr.NodeComparator);for(var r=this._leaves,i=null,a=new G;;){if(this.buildLevel(r,a),a.size()===1)return a.get(0);i=r,r=a,a=i}},vo.prototype.insert=function(r,i,a){if(this._root!==null)throw new Error("Index cannot be added to once it has been queried");this._leaves.add(new Xh(r,i,a))},vo.prototype.query=function(r,i,a){this.init(),this._root.query(r,i,a)},vo.prototype.buildRoot=function(){if(this._root!==null)return null;this._root=this.buildTree()},vo.prototype.printNode=function(r){te.out.println(fe.toLineString(new D(r._min,this._level),new D(r._max,this._level)))},vo.prototype.init=function(){if(this._root!==null)return null;this.buildRoot()},vo.prototype.buildLevel=function(r,i){this._level++,i.clear();for(var a=0;a<r.size();a+=2){var c=r.get(a);if((a+1<r.size()?r.get(a):null)===null)i.add(c);else{var d=new em(r.get(a),r.get(a+1));i.add(d)}}},vo.prototype.interfaces_=function(){return[]},vo.prototype.getClass=function(){return vo};var As=function(){this._items=new G};As.prototype.visitItem=function(r){this._items.add(r)},As.prototype.getItems=function(){return this._items},As.prototype.interfaces_=function(){return[Us]},As.prototype.getClass=function(){return As};var da=function(){this._index=null;var r=arguments[0];if(!Q(r,we))throw new I("Argument must be Polygonal");this._index=new ko(r)},ga={SegmentVisitor:{configurable:!0},IntervalIndexedGeometry:{configurable:!0}};da.prototype.locate=function(r){var i=new Ot(r),a=new Ts(i);return this._index.query(r.y,r.y,a),i.getLocation()},da.prototype.interfaces_=function(){return[_u]},da.prototype.getClass=function(){return da},ga.SegmentVisitor.get=function(){return Ts},ga.IntervalIndexedGeometry.get=function(){return ko},Object.defineProperties(da,ga);var Ts=function(){this._counter=null;var r=arguments[0];this._counter=r};Ts.prototype.visitItem=function(r){var i=r;this._counter.countSegment(i.getCoordinate(0),i.getCoordinate(1))},Ts.prototype.interfaces_=function(){return[Us]},Ts.prototype.getClass=function(){return Ts};var ko=function(){this._index=new vo;var r=arguments[0];this.init(r)};ko.prototype.init=function(r){for(var i=_e.getLines(r).iterator();i.hasNext();){var a=i.next().getCoordinates();this.addLine(a)}},ko.prototype.addLine=function(r){for(var i=1;i<r.length;i++){var a=new ie(r[i-1],r[i]),c=Math.min(a.p0.y,a.p1.y),d=Math.max(a.p0.y,a.p1.y);this._index.insert(c,d,a)}},ko.prototype.query=function(){if(arguments.length===2){var r=arguments[0],i=arguments[1],a=new As;return this._index.query(r,i,a),a.getItems()}if(arguments.length===3){var c=arguments[0],d=arguments[1],_=arguments[2];this._index.query(c,d,_)}},ko.prototype.interfaces_=function(){return[]},ko.prototype.getClass=function(){return ko};var ma=function(r){function i(){if(r.call(this),this._parentGeom=null,this._lineEdgeMap=new ul,this._boundaryNodeRule=null,this._useBoundaryDeterminationRule=!0,this._argIndex=null,this._boundaryNodes=null,this._hasTooFewPoints=!1,this._invalidPoint=null,this._areaPtLocator=null,this._ptLocator=new ke,arguments.length===2){var a=arguments[0],c=arguments[1],d=P.OGC_SFS_BOUNDARY_RULE;this._argIndex=a,this._parentGeom=c,this._boundaryNodeRule=d,c!==null&&this.add(c)}else if(arguments.length===3){var _=arguments[0],M=arguments[1],L=arguments[2];this._argIndex=_,this._parentGeom=M,this._boundaryNodeRule=L,M!==null&&this.add(M)}}return r&&(i.__proto__=r),i.prototype=Object.create(r&&r.prototype),i.prototype.constructor=i,i.prototype.insertBoundaryPoint=function(a,c){var d=this._nodes.addNode(c).getLabel(),_=1;K.NONE,d.getLocation(a,Xt.ON)===K.BOUNDARY&&_++;var M=i.determineBoundary(this._boundaryNodeRule,_);d.setLocation(a,M)},i.prototype.computeSelfNodes=function(){if(arguments.length===2){var a=arguments[0],c=arguments[1];return this.computeSelfNodes(a,c,!1)}if(arguments.length===3){var d=arguments[0],_=arguments[1],M=arguments[2],L=new Yr(d,!0,!1);L.setIsDoneIfProperInt(M);var H=this.createEdgeSetIntersector(),it=this._parentGeom instanceof Ae||this._parentGeom instanceof de||this._parentGeom instanceof Pe,bt=_||!it;return H.computeIntersections(this._edges,L,bt),this.addSelfIntersectionNodes(this._argIndex),L}},i.prototype.computeSplitEdges=function(a){for(var c=this._edges.iterator();c.hasNext();)c.next().eiList.addSplitEdges(a)},i.prototype.computeEdgeIntersections=function(a,c,d){var _=new Yr(c,d,!0);return _.setBoundaryNodes(this.getBoundaryNodes(),a.getBoundaryNodes()),this.createEdgeSetIntersector().computeIntersections(this._edges,a._edges,_),_},i.prototype.getGeometry=function(){return this._parentGeom},i.prototype.getBoundaryNodeRule=function(){return this._boundaryNodeRule},i.prototype.hasTooFewPoints=function(){return this._hasTooFewPoints},i.prototype.addPoint=function(){if(arguments[0]instanceof ue){var a=arguments[0].getCoordinate();this.insertPoint(this._argIndex,a,K.INTERIOR)}else if(arguments[0]instanceof D){var c=arguments[0];this.insertPoint(this._argIndex,c,K.INTERIOR)}},i.prototype.addPolygon=function(a){this.addPolygonRing(a.getExteriorRing(),K.EXTERIOR,K.INTERIOR);for(var c=0;c<a.getNumInteriorRing();c++){var d=a.getInteriorRingN(c);this.addPolygonRing(d,K.INTERIOR,K.EXTERIOR)}},i.prototype.addEdge=function(a){this.insertEdge(a);var c=a.getCoordinates();this.insertPoint(this._argIndex,c[0],K.BOUNDARY),this.insertPoint(this._argIndex,c[c.length-1],K.BOUNDARY)},i.prototype.addLineString=function(a){var c=lt.removeRepeatedPoints(a.getCoordinates());if(c.length<2)return this._hasTooFewPoints=!0,this._invalidPoint=c[0],null;var d=new jl(c,new On(this._argIndex,K.INTERIOR));this._lineEdgeMap.put(a,d),this.insertEdge(d),Wt.isTrue(c.length>=2,"found LineString with single point"),this.insertBoundaryPoint(this._argIndex,c[0]),this.insertBoundaryPoint(this._argIndex,c[c.length-1])},i.prototype.getInvalidPoint=function(){return this._invalidPoint},i.prototype.getBoundaryPoints=function(){for(var a=this.getBoundaryNodes(),c=new Array(a.size()).fill(null),d=0,_=a.iterator();_.hasNext();){var M=_.next();c[d++]=M.getCoordinate().copy()}return c},i.prototype.getBoundaryNodes=function(){return this._boundaryNodes===null&&(this._boundaryNodes=this._nodes.getBoundaryNodes(this._argIndex)),this._boundaryNodes},i.prototype.addSelfIntersectionNode=function(a,c,d){if(this.isBoundaryNode(a,c))return null;d===K.BOUNDARY&&this._useBoundaryDeterminationRule?this.insertBoundaryPoint(a,c):this.insertPoint(a,c,d)},i.prototype.addPolygonRing=function(a,c,d){if(a.isEmpty())return null;var _=lt.removeRepeatedPoints(a.getCoordinates());if(_.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=_[0],null;var M=c,L=d;dt.isCCW(_)&&(M=d,L=c);var H=new jl(_,new On(this._argIndex,K.BOUNDARY,M,L));this._lineEdgeMap.put(a,H),this.insertEdge(H),this.insertPoint(this._argIndex,_[0],K.BOUNDARY)},i.prototype.insertPoint=function(a,c,d){var _=this._nodes.addNode(c),M=_.getLabel();M===null?_._label=new On(a,d):M.setLocation(a,d)},i.prototype.createEdgeSetIntersector=function(){return new ni},i.prototype.addSelfIntersectionNodes=function(a){for(var c=this._edges.iterator();c.hasNext();)for(var d=c.next(),_=d.getLabel().getLocation(a),M=d.eiList.iterator();M.hasNext();){var L=M.next();this.addSelfIntersectionNode(a,L.coord,_)}},i.prototype.add=function(){if(arguments.length!==1)return r.prototype.add.apply(this,arguments);var a=arguments[0];if(a.isEmpty())return null;if(a instanceof Pe&&(this._useBoundaryDeterminationRule=!1),a instanceof de)this.addPolygon(a);else if(a instanceof vt)this.addLineString(a);else if(a instanceof ue)this.addPoint(a);else if(a instanceof Be)this.addCollection(a);else if(a instanceof bi)this.addCollection(a);else if(a instanceof Pe)this.addCollection(a);else{if(!(a instanceof Qn))throw new Error(a.getClass().getName());this.addCollection(a)}},i.prototype.addCollection=function(a){for(var c=0;c<a.getNumGeometries();c++){var d=a.getGeometryN(c);this.add(d)}},i.prototype.locate=function(a){return Q(this._parentGeom,we)&&this._parentGeom.getNumGeometries()>50?(this._areaPtLocator===null&&(this._areaPtLocator=new da(this._parentGeom)),this._areaPtLocator.locate(a)):this._ptLocator.locate(a,this._parentGeom)},i.prototype.findEdge=function(){if(arguments.length===1){var a=arguments[0];return this._lineEdgeMap.get(a)}return r.prototype.findEdge.apply(this,arguments)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i.determineBoundary=function(a,c){return a.isInBoundary(c)?K.BOUNDARY:K.INTERIOR},i}(dr),ss=function(){if(this._li=new z,this._resultPrecisionModel=null,this._arg=null,arguments.length===1){var r=arguments[0];this.setComputationPrecision(r.getPrecisionModel()),this._arg=new Array(1).fill(null),this._arg[0]=new ma(0,r)}else if(arguments.length===2){var i=arguments[0],a=arguments[1],c=P.OGC_SFS_BOUNDARY_RULE;i.getPrecisionModel().compareTo(a.getPrecisionModel())>=0?this.setComputationPrecision(i.getPrecisionModel()):this.setComputationPrecision(a.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new ma(0,i,c),this._arg[1]=new ma(1,a,c)}else if(arguments.length===3){var d=arguments[0],_=arguments[1],M=arguments[2];d.getPrecisionModel().compareTo(_.getPrecisionModel())>=0?this.setComputationPrecision(d.getPrecisionModel()):this.setComputationPrecision(_.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new ma(0,d,M),this._arg[1]=new ma(1,_,M)}};ss.prototype.getArgGeometry=function(r){return this._arg[r].getGeometry()},ss.prototype.setComputationPrecision=function(r){this._resultPrecisionModel=r,this._li.setPrecisionModel(this._resultPrecisionModel)},ss.prototype.interfaces_=function(){return[]},ss.prototype.getClass=function(){return ss};var ya=function(){};ya.prototype.interfaces_=function(){return[]},ya.prototype.getClass=function(){return ya},ya.map=function(){if(arguments[0]instanceof Vt&&Q(arguments[1],ya.MapOp)){for(var r=arguments[0],i=arguments[1],a=new G,c=0;c<r.getNumGeometries();c++){var d=i.map(r.getGeometryN(c));d!==null&&a.add(d)}return r.getFactory().buildGeometry(a)}if(Q(arguments[0],at)&&Q(arguments[1],ya.MapOp)){for(var _=arguments[0],M=arguments[1],L=new G,H=_.iterator();H.hasNext();){var it=H.next(),bt=M.map(it);bt!==null&&L.add(bt)}return L}},ya.MapOp=function(){};var Re=function(r){function i(){var a=arguments[0],c=arguments[1];r.call(this,a,c),this._ptLocator=new ke,this._geomFact=null,this._resultGeom=null,this._graph=null,this._edgeList=new gi,this._resultPolyList=new G,this._resultLineList=new G,this._resultPointList=new G,this._graph=new dr(new io),this._geomFact=a.getFactory()}return r&&(i.__proto__=r),i.prototype=Object.create(r&&r.prototype),i.prototype.constructor=i,i.prototype.insertUniqueEdge=function(a){var c=this._edgeList.findEqualEdge(a);if(c!==null){var d=c.getLabel(),_=a.getLabel();c.isPointwiseEqual(a)||(_=new On(a.getLabel())).flip();var M=c.getDepth();M.isNull()&&M.add(d),M.add(_),d.merge(_)}else this._edgeList.add(a)},i.prototype.getGraph=function(){return this._graph},i.prototype.cancelDuplicateResultEdges=function(){for(var a=this._graph.getEdgeEnds().iterator();a.hasNext();){var c=a.next(),d=c.getSym();c.isInResult()&&d.isInResult()&&(c.setInResult(!1),d.setInResult(!1))}},i.prototype.isCoveredByLA=function(a){return!!this.isCovered(a,this._resultLineList)||!!this.isCovered(a,this._resultPolyList)},i.prototype.computeGeometry=function(a,c,d,_){var M=new G;return M.addAll(a),M.addAll(c),M.addAll(d),M.isEmpty()?i.createEmptyResult(_,this._arg[0].getGeometry(),this._arg[1].getGeometry(),this._geomFact):this._geomFact.buildGeometry(M)},i.prototype.mergeSymLabels=function(){for(var a=this._graph.getNodes().iterator();a.hasNext();)a.next().getEdges().mergeSymLabels()},i.prototype.isCovered=function(a,c){for(var d=c.iterator();d.hasNext();){var _=d.next();if(this._ptLocator.locate(a,_)!==K.EXTERIOR)return!0}return!1},i.prototype.replaceCollapsedEdges=function(){for(var a=new G,c=this._edgeList.iterator();c.hasNext();){var d=c.next();d.isCollapsed()&&(c.remove(),a.add(d.getCollapsedEdge()))}this._edgeList.addAll(a)},i.prototype.updateNodeLabelling=function(){for(var a=this._graph.getNodes().iterator();a.hasNext();){var c=a.next(),d=c.getEdges().getLabel();c.getLabel().merge(d)}},i.prototype.getResultGeometry=function(a){return this.computeOverlay(a),this._resultGeom},i.prototype.insertUniqueEdges=function(a){for(var c=a.iterator();c.hasNext();){var d=c.next();this.insertUniqueEdge(d)}},i.prototype.computeOverlay=function(a){this.copyPoints(0),this.copyPoints(1),this._arg[0].computeSelfNodes(this._li,!1),this._arg[1].computeSelfNodes(this._li,!1),this._arg[0].computeEdgeIntersections(this._arg[1],this._li,!0);var c=new G;this._arg[0].computeSplitEdges(c),this._arg[1].computeSplitEdges(c),this.insertUniqueEdges(c),this.computeLabelsFromDepths(),this.replaceCollapsedEdges(),Ji.checkValid(this._edgeList.getEdges()),this._graph.addEdges(this._edgeList.getEdges()),this.computeLabelling(),this.labelIncompleteNodes(),this.findResultAreaEdges(a),this.cancelDuplicateResultEdges();var d=new Ci(this._geomFact);d.add(this._graph),this._resultPolyList=d.getPolygons();var _=new yo(this,this._geomFact,this._ptLocator);this._resultLineList=_.build(a);var M=new bs(this,this._geomFact,this._ptLocator);this._resultPointList=M.build(a),this._resultGeom=this.computeGeometry(this._resultPointList,this._resultLineList,this._resultPolyList,a)},i.prototype.labelIncompleteNode=function(a,c){var d=this._ptLocator.locate(a.getCoordinate(),this._arg[c].getGeometry());a.getLabel().setLocation(c,d)},i.prototype.copyPoints=function(a){for(var c=this._arg[a].getNodeIterator();c.hasNext();){var d=c.next();this._graph.addNode(d.getCoordinate()).setLabel(a,d.getLabel().getLocation(a))}},i.prototype.findResultAreaEdges=function(a){for(var c=this._graph.getEdgeEnds().iterator();c.hasNext();){var d=c.next(),_=d.getLabel();_.isArea()&&!d.isInteriorAreaEdge()&&i.isResultOfOp(_.getLocation(0,Xt.RIGHT),_.getLocation(1,Xt.RIGHT),a)&&d.setInResult(!0)}},i.prototype.computeLabelsFromDepths=function(){for(var a=this._edgeList.iterator();a.hasNext();){var c=a.next(),d=c.getLabel(),_=c.getDepth();if(!_.isNull()){_.normalize();for(var M=0;M<2;M++)d.isNull(M)||!d.isArea()||_.isNull(M)||(_.getDelta(M)===0?d.toLine(M):(Wt.isTrue(!_.isNull(M,Xt.LEFT),"depth of LEFT side has not been initialized"),d.setLocation(M,Xt.LEFT,_.getLocation(M,Xt.LEFT)),Wt.isTrue(!_.isNull(M,Xt.RIGHT),"depth of RIGHT side has not been initialized"),d.setLocation(M,Xt.RIGHT,_.getLocation(M,Xt.RIGHT))))}}},i.prototype.computeLabelling=function(){for(var a=this._graph.getNodes().iterator();a.hasNext();)a.next().getEdges().computeLabelling(this._arg);this.mergeSymLabels(),this.updateNodeLabelling()},i.prototype.labelIncompleteNodes=function(){for(var a=this._graph.getNodes().iterator();a.hasNext();){var c=a.next(),d=c.getLabel();c.isIsolated()&&(d.isNull(0)?this.labelIncompleteNode(c,0):this.labelIncompleteNode(c,1)),c.getEdges().updateLabelling(d)}},i.prototype.isCoveredByA=function(a){return!!this.isCovered(a,this._resultPolyList)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(ss);Re.overlayOp=function(r,i,a){return new Re(r,i).getResultGeometry(a)},Re.intersection=function(r,i){if(r.isEmpty()||i.isEmpty())return Re.createEmptyResult(Re.INTERSECTION,r,i,r.getFactory());if(r.isGeometryCollection()){var a=i;return Ms.map(r,{interfaces_:function(){return[ya.MapOp]},map:function(c){return c.intersection(a)}})}return r.checkNotGeometryCollection(r),r.checkNotGeometryCollection(i),zr.overlayOp(r,i,Re.INTERSECTION)},Re.symDifference=function(r,i){if(r.isEmpty()||i.isEmpty()){if(r.isEmpty()&&i.isEmpty())return Re.createEmptyResult(Re.SYMDIFFERENCE,r,i,r.getFactory());if(r.isEmpty())return i.copy();if(i.isEmpty())return r.copy()}return r.checkNotGeometryCollection(r),r.checkNotGeometryCollection(i),zr.overlayOp(r,i,Re.SYMDIFFERENCE)},Re.resultDimension=function(r,i,a){var c=i.getDimension(),d=a.getDimension(),_=-1;switch(r){case Re.INTERSECTION:_=Math.min(c,d);break;case Re.UNION:_=Math.max(c,d);break;case Re.DIFFERENCE:_=c;break;case Re.SYMDIFFERENCE:_=Math.max(c,d)}return _},Re.createEmptyResult=function(r,i,a,c){var d=null;switch(Re.resultDimension(r,i,a)){case-1:d=c.createGeometryCollection(new Array(0).fill(null));break;case 0:d=c.createPoint();break;case 1:d=c.createLineString();break;case 2:d=c.createPolygon()}return d},Re.difference=function(r,i){return r.isEmpty()?Re.createEmptyResult(Re.DIFFERENCE,r,i,r.getFactory()):i.isEmpty()?r.copy():(r.checkNotGeometryCollection(r),r.checkNotGeometryCollection(i),zr.overlayOp(r,i,Re.DIFFERENCE))},Re.isResultOfOp=function(){if(arguments.length===2){var r=arguments[0],i=arguments[1],a=r.getLocation(0),c=r.getLocation(1);return Re.isResultOfOp(a,c,i)}if(arguments.length===3){var d=arguments[0],_=arguments[1],M=arguments[2];switch(d===K.BOUNDARY&&(d=K.INTERIOR),_===K.BOUNDARY&&(_=K.INTERIOR),M){case Re.INTERSECTION:return d===K.INTERIOR&&_===K.INTERIOR;case Re.UNION:return d===K.INTERIOR||_===K.INTERIOR;case Re.DIFFERENCE:return d===K.INTERIOR&&_!==K.INTERIOR;case Re.SYMDIFFERENCE:return d===K.INTERIOR&&_!==K.INTERIOR||d!==K.INTERIOR&&_===K.INTERIOR}return!1}},Re.INTERSECTION=1,Re.UNION=2,Re.DIFFERENCE=3,Re.SYMDIFFERENCE=4;var ks=function(){this._g=null,this._boundaryDistanceTolerance=null,this._linework=null,this._ptLocator=new ke,this._seg=new ie;var r=arguments[0],i=arguments[1];this._g=r,this._boundaryDistanceTolerance=i,this._linework=this.extractLinework(r)};ks.prototype.isWithinToleranceOfBoundary=function(r){for(var i=0;i<this._linework.getNumGeometries();i++)for(var a=this._linework.getGeometryN(i).getCoordinateSequence(),c=0;c<a.size()-1;c++)if(a.getCoordinate(c,this._seg.p0),a.getCoordinate(c+1,this._seg.p1),this._seg.distance(r)<=this._boundaryDistanceTolerance)return!0;return!1},ks.prototype.getLocation=function(r){return this.isWithinToleranceOfBoundary(r)?K.BOUNDARY:this._ptLocator.locate(r,this._g)},ks.prototype.extractLinework=function(r){var i=new Mu;r.apply(i);var a=i.getLinework(),c=Le.toLineStringArray(a);return r.getFactory().createMultiLineString(c)},ks.prototype.interfaces_=function(){return[]},ks.prototype.getClass=function(){return ks};var Mu=function(){this._linework=null,this._linework=new G};Mu.prototype.getLinework=function(){return this._linework},Mu.prototype.filter=function(r){if(r instanceof de){var i=r;this._linework.add(i.getExteriorRing());for(var a=0;a<i.getNumInteriorRing();a++)this._linework.add(i.getInteriorRingN(a))}},Mu.prototype.interfaces_=function(){return[pr]},Mu.prototype.getClass=function(){return Mu};var va=function(){this._g=null,this._doLeft=!0,this._doRight=!0;var r=arguments[0];this._g=r};va.prototype.extractPoints=function(r,i,a){for(var c=r.getCoordinates(),d=0;d<c.length-1;d++)this.computeOffsetPoints(c[d],c[d+1],i,a)},va.prototype.setSidesToGenerate=function(r,i){this._doLeft=r,this._doRight=i},va.prototype.getPoints=function(r){for(var i=new G,a=_e.getLines(this._g).iterator();a.hasNext();){var c=a.next();this.extractPoints(c,r,i)}return i},va.prototype.computeOffsetPoints=function(r,i,a,c){var d=i.x-r.x,_=i.y-r.y,M=Math.sqrt(d*d+_*_),L=a*d/M,H=a*_/M,it=(i.x+r.x)/2,bt=(i.y+r.y)/2;if(this._doLeft){var Tt=new D(it-H,bt+L);c.add(Tt)}if(this._doRight){var Kt=new D(it+H,bt-L);c.add(Kt)}},va.prototype.interfaces_=function(){return[]},va.prototype.getClass=function(){return va};var ci=function r(){this._geom=null,this._locFinder=null,this._location=new Array(3).fill(null),this._invalidLocation=null,this._boundaryDistanceTolerance=r.TOLERANCE,this._testCoords=new G;var i=arguments[0],a=arguments[1],c=arguments[2];this._boundaryDistanceTolerance=r.computeBoundaryDistanceTolerance(i,a),this._geom=[i,a,c],this._locFinder=[new ks(this._geom[0],this._boundaryDistanceTolerance),new ks(this._geom[1],this._boundaryDistanceTolerance),new ks(this._geom[2],this._boundaryDistanceTolerance)]},bu={TOLERANCE:{configurable:!0}};ci.prototype.reportResult=function(r,i,a){te.out.println("Overlay result invalid - A:"+K.toLocationSymbol(i[0])+" B:"+K.toLocationSymbol(i[1])+" expected:"+(a?"i":"e")+" actual:"+K.toLocationSymbol(i[2]))},ci.prototype.isValid=function(r){this.addTestPts(this._geom[0]),this.addTestPts(this._geom[1]);var i=this.checkValid(r);return i},ci.prototype.checkValid=function(){if(arguments.length===1){for(var r=arguments[0],i=0;i<this._testCoords.size();i++){var a=this._testCoords.get(i);if(!this.checkValid(r,a))return this._invalidLocation=a,!1}return!0}if(arguments.length===2){var c=arguments[0],d=arguments[1];return this._location[0]=this._locFinder[0].getLocation(d),this._location[1]=this._locFinder[1].getLocation(d),this._location[2]=this._locFinder[2].getLocation(d),!!ci.hasLocation(this._location,K.BOUNDARY)||this.isValidResult(c,this._location)}},ci.prototype.addTestPts=function(r){var i=new va(r);this._testCoords.addAll(i.getPoints(5*this._boundaryDistanceTolerance))},ci.prototype.isValidResult=function(r,i){var a=Re.isResultOfOp(i[0],i[1],r),c=!(a^i[2]===K.INTERIOR);return c||this.reportResult(r,i,a),c},ci.prototype.getInvalidLocation=function(){return this._invalidLocation},ci.prototype.interfaces_=function(){return[]},ci.prototype.getClass=function(){return ci},ci.hasLocation=function(r,i){for(var a=0;a<3;a++)if(r[a]===i)return!0;return!1},ci.computeBoundaryDistanceTolerance=function(r,i){return Math.min(fr.computeSizeBasedSnapTolerance(r),fr.computeSizeBasedSnapTolerance(i))},ci.isValid=function(r,i,a,c){return new ci(r,i,c).isValid(a)},bu.TOLERANCE.get=function(){return 1e-6},Object.defineProperties(ci,bu);var Di=function r(i){this._geomFactory=null,this._skipEmpty=!1,this._inputGeoms=null,this._geomFactory=r.extractFactory(i),this._inputGeoms=i};Di.prototype.extractElements=function(r,i){if(r===null)return null;for(var a=0;a<r.getNumGeometries();a++){var c=r.getGeometryN(a);this._skipEmpty&&c.isEmpty()||i.add(c)}},Di.prototype.combine=function(){for(var r=new G,i=this._inputGeoms.iterator();i.hasNext();){var a=i.next();this.extractElements(a,r)}return r.size()===0?this._geomFactory!==null?this._geomFactory.createGeometryCollection(null):null:this._geomFactory.buildGeometry(r)},Di.prototype.interfaces_=function(){return[]},Di.prototype.getClass=function(){return Di},Di.combine=function(){if(arguments.length===1){var r=arguments[0];return new Di(r).combine()}if(arguments.length===2){var i=arguments[0],a=arguments[1];return new Di(Di.createList(i,a)).combine()}if(arguments.length===3){var c=arguments[0],d=arguments[1],_=arguments[2];return new Di(Di.createList(c,d,_)).combine()}},Di.extractFactory=function(r){return r.isEmpty()?null:r.iterator().next().getFactory()},Di.createList=function(){if(arguments.length===2){var r=arguments[0],i=arguments[1],a=new G;return a.add(r),a.add(i),a}if(arguments.length===3){var c=arguments[0],d=arguments[1],_=arguments[2],M=new G;return M.add(c),M.add(d),M.add(_),M}};var U=function(){this._inputPolys=null,this._geomFactory=null;var r=arguments[0];this._inputPolys=r,this._inputPolys===null&&(this._inputPolys=new G)},Xa={STRTREE_NODE_CAPACITY:{configurable:!0}};U.prototype.reduceToGeometries=function(r){for(var i=new G,a=r.iterator();a.hasNext();){var c=a.next(),d=null;Q(c,Et)?d=this.unionTree(c):c instanceof Vt&&(d=c),i.add(d)}return i},U.prototype.extractByEnvelope=function(r,i,a){for(var c=new G,d=0;d<i.getNumGeometries();d++){var _=i.getGeometryN(d);_.getEnvelopeInternal().intersects(r)?c.add(_):a.add(_)}return this._geomFactory.buildGeometry(c)},U.prototype.unionOptimized=function(r,i){var a=r.getEnvelopeInternal(),c=i.getEnvelopeInternal();if(!a.intersects(c))return Di.combine(r,i);if(r.getNumGeometries()<=1&&i.getNumGeometries()<=1)return this.unionActual(r,i);var d=a.intersection(c);return this.unionUsingEnvelopeIntersection(r,i,d)},U.prototype.union=function(){if(this._inputPolys===null)throw new Error("union() method cannot be called twice");if(this._inputPolys.isEmpty())return null;this._geomFactory=this._inputPolys.iterator().next().getFactory();for(var r=new Mf(U.STRTREE_NODE_CAPACITY),i=this._inputPolys.iterator();i.hasNext();){var a=i.next();r.insert(a.getEnvelopeInternal(),a)}this._inputPolys=null;var c=r.itemsTree();return this.unionTree(c)},U.prototype.binaryUnion=function(){if(arguments.length===1){var r=arguments[0];return this.binaryUnion(r,0,r.size())}if(arguments.length===3){var i=arguments[0],a=arguments[1],c=arguments[2];if(c-a<=1){var d=U.getGeometry(i,a);return this.unionSafe(d,null)}if(c-a==2)return this.unionSafe(U.getGeometry(i,a),U.getGeometry(i,a+1));var _=Math.trunc((c+a)/2),M=this.binaryUnion(i,a,_),L=this.binaryUnion(i,_,c);return this.unionSafe(M,L)}},U.prototype.repeatedUnion=function(r){for(var i=null,a=r.iterator();a.hasNext();){var c=a.next();i=i===null?c.copy():i.union(c)}return i},U.prototype.unionSafe=function(r,i){return r===null&&i===null?null:r===null?i.copy():i===null?r.copy():this.unionOptimized(r,i)},U.prototype.unionActual=function(r,i){return U.restrictToPolygons(r.union(i))},U.prototype.unionTree=function(r){var i=this.reduceToGeometries(r);return this.binaryUnion(i)},U.prototype.unionUsingEnvelopeIntersection=function(r,i,a){var c=new G,d=this.extractByEnvelope(a,r,c),_=this.extractByEnvelope(a,i,c),M=this.unionActual(d,_);return c.add(M),Di.combine(c)},U.prototype.bufferUnion=function(){if(arguments.length===1){var r=arguments[0];return r.get(0).getFactory().buildGeometry(r).buffer(0)}if(arguments.length===2){var i=arguments[0],a=arguments[1];return i.getFactory().createGeometryCollection([i,a]).buffer(0)}},U.prototype.interfaces_=function(){return[]},U.prototype.getClass=function(){return U},U.restrictToPolygons=function(r){if(Q(r,we))return r;var i=se.getPolygons(r);return i.size()===1?i.get(0):r.getFactory().createMultiPolygon(Le.toPolygonArray(i))},U.getGeometry=function(r,i){return i>=r.size()?null:r.get(i)},U.union=function(r){return new U(r).union()},Xa.STRTREE_NODE_CAPACITY.get=function(){return 4},Object.defineProperties(U,Xa);var _a=function(){};_a.prototype.interfaces_=function(){return[]},_a.prototype.getClass=function(){return _a},_a.union=function(r,i){if(r.isEmpty()||i.isEmpty()){if(r.isEmpty()&&i.isEmpty())return Re.createEmptyResult(Re.UNION,r,i,r.getFactory());if(r.isEmpty())return i.copy();if(i.isEmpty())return r.copy()}return r.checkNotGeometryCollection(r),r.checkNotGeometryCollection(i),zr.overlayOp(r,i,Re.UNION)},n.GeoJSONReader=ll,n.GeoJSONWriter=Ua,n.OverlayOp=Re,n.UnionOp=_a,n.BufferOp=Xr,Object.defineProperty(n,"__esModule",{value:!0})})});var e2=st((xf,Bh)=>{(function(){var n,t="4.17.21",e=200,o="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",s="Expected a function",u="Invalid `variable` option passed into `_.template`",p="__lodash_hash_undefined__",f=500,g="__lodash_placeholder__",m=1,v=2,w=4,S=1,b=2,C=1,R=2,x=4,E=8,I=16,A=32,F=64,V=128,X=256,q=512,D=30,xt="...",B=800,j=16,K=1,Dt=2,Q=3,At=1/0,Mt=9007199254740991,Lt=17976931348623157e292,pt=NaN,yt=4294967295,J=yt-1,Bt=yt>>>1,Gt=[["ary",V],["bind",C],["bindKey",R],["curry",E],["curryRight",I],["flip",q],["partial",A],["partialRight",F],["rearg",X]],ae="[object Arguments]",ut="[object Array]",Ut="[object AsyncFunction]",jt="[object Boolean]",ce="[object Date]",te="[object DOMException]",$t="[object Error]",qt="[object Function]",xe="[object GeneratorFunction]",ft="[object Map]",We="[object Number]",ee="[object Null]",ge="[object Object]",fe="[object Promise]",Te="[object Proxy]",be="[object RegExp]",Wt="[object Set]",Me="[object String]",tt="[object Symbol]",z="[object Undefined]",Pt="[object WeakMap]",Ot="[object WeakSet]",dt="[object ArrayBuffer]",Ht="[object DataView]",Ce="[object Float32Array]",Vt="[object Float64Array]",Zt="[object Int8Array]",ne="[object Int16Array]",rt="[object Int32Array]",P="[object Uint8Array]",N="[object Uint8ClampedArray]",k="[object Uint16Array]",$="[object Uint32Array]",W=/\b__p \+= '';/g,ht=/\b(__p \+=) '' \+/g,at=/(__e\(.*?\)|\b__t\)) \+\n'';/g,wt=/&(?:amp|lt|gt|quot|#39);/g,Et=/[&<>"']/g,G=RegExp(wt.source),ot=RegExp(Et.source),et=/<%-([\s\S]+?)%>/g,lt=/<%([\s\S]+?)%>/g,Ft=/<%=([\s\S]+?)%>/g,Jt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,me=/^\w*$/,ve=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,qe=/[\\^$.*+?()[\]{}|]/g,Ue=RegExp(qe.source),Xe=/^\s+/,Je=/\s/,wr=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Kr=/\{\n\/\* \[wrapped with (.+)\] \*/,nr=/,? & /,Ie=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,rr=/[()=,{}\[\]\/\s]/,pr=/\\(\\)?/g,ur=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Qn=/\w*$/,bi=/^[-+]0x[0-9a-f]+$/i,oi=/^0b[01]+$/i,Z=/^\[object .+?Constructor\]$/,mt=/^0o[0-7]+$/i,It=/^(?:0|[1-9]\d*)$/,St=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,vt=/($^)/,he=/['\n\r\u2028\u2029\\]/g,ue="\\ud800-\\udfff",we="\\u0300-\\u036f",de="\\ufe20-\\ufe2f",Be="\\u20d0-\\u20ff",Ae=we+de+Be,Pe="\\u2700-\\u27bf",rn="a-z\\xdf-\\xf6\\xf8-\\xff",si="\\xac\\xb1\\xd7\\xf7",br="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Wi="\\u2000-\\u206f",sr=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",ye="A-Z\\xc0-\\xd6\\xd8-\\xde",Da="\\ufe0e\\ufe0f",on=si+br+Wi+sr,fo="['\u2019]",ul="["+ue+"]",ze="["+on+"]",ys="["+Ae+"]",ir="\\d+",jo="["+Pe+"]",Le="["+rn+"]",Ai="[^"+ue+on+ir+Pe+rn+ye+"]",Fa="\\ud83c[\\udffb-\\udfff]",mu="(?:"+ys+"|"+Fa+")",Ti="[^"+ue+"]",Po="(?:\\ud83c[\\udde6-\\uddff]){2}",ll="[\\ud800-\\udbff][\\udc00-\\udfff]",Ua="["+ye+"]",Xt="\\u200d",cl="(?:"+Le+"|"+Ai+")",Io="(?:"+Ua+"|"+Ai+")",Qo="(?:"+fo+"(?:d|ll|m|re|s|t|ve))?",fl="(?:"+fo+"(?:D|LL|M|RE|S|T|VE))?",Jr=mu+"?",Zn="["+Da+"]?",On="(?:"+Xt+"(?:"+[Ti,Po,ll].join("|")+")"+Zn+Jr+")*",Ar="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",tm="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",zh=Zn+Jr+On,Xi="(?:"+[jo,Po,ll].join("|")+")"+zh,Kl="(?:"+[Ti+ys+"?",ys,Po,ll,ul].join("|")+")",Ro=RegExp(fo,"g"),Yn=RegExp(ys,"g"),Ba=RegExp(Fa+"(?="+Fa+")|"+Kl+zh,"g"),jr=RegExp([Ua+"?"+Le+"+"+Qo+"(?="+[ze,Ua,"$"].join("|")+")",Io+"+"+fl+"(?="+[ze,Ua+cl,"$"].join("|")+")",Ua+"?"+cl+"+"+Qo,Ua+"+"+fl,tm,Ar,ir,Xi].join("|"),"g"),wf=RegExp("["+Xt+ue+Ae+Da+"]"),yu=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,dr=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Ci=-1,or={};or[Ce]=or[Vt]=or[Zt]=or[ne]=or[rt]=or[P]=or[N]=or[k]=or[$]=!0,or[ae]=or[ut]=or[dt]=or[jt]=or[Ht]=or[ce]=or[$t]=or[qt]=or[ft]=or[We]=or[ge]=or[be]=or[Wt]=or[Me]=or[Pt]=!1;var je={};je[ae]=je[ut]=je[dt]=je[Ht]=je[jt]=je[ce]=je[Ce]=je[Vt]=je[Zt]=je[ne]=je[rt]=je[ft]=je[We]=je[ge]=je[be]=je[Wt]=je[Me]=je[tt]=je[P]=je[N]=je[k]=je[$]=!0,je[$t]=je[qt]=je[Pt]=!1;var vs={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},Us={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},za={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},Ir={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Gh=parseFloat,ho=parseInt,Sr=typeof global=="object"&&global&&global.Object===Object&&global,Fr=typeof self=="object"&&self&&self.Object===Object&&self,Ur=Sr||Fr||Function("return this")(),Sf=typeof xf=="object"&&xf&&!xf.nodeType&&xf,Lo=Sf&&typeof Bh=="object"&&Bh&&!Bh.nodeType&&Bh,Mf=Lo&&Lo.exports===Sf,Jl=Mf&&Sr.process,lr=function(){try{var gt=Lo&&Lo.require&&Lo.require("util").types;return gt||Jl&&Jl.binding&&Jl.binding("util")}catch(Nt){}}(),_s=lr&&lr.isArrayBuffer,Qr=lr&&lr.isDate,ua=lr&&lr.isMap,No=lr&&lr.isRegExp,vu=lr&&lr.isSet,mr=lr&&lr.isTypedArray;function ie(gt,Nt,Ct){switch(Ct.length){case 0:return gt.call(Nt);case 1:return gt.call(Nt,Ct[0]);case 2:return gt.call(Nt,Ct[0],Ct[1]);case 3:return gt.call(Nt,Ct[0],Ct[1],Ct[2])}return gt.apply(Nt,Ct)}function kh(gt,Nt,Ct,se){for(var _e=-1,ke=gt==null?0:gt.length;++_e<ke;){var ln=gt[_e];Nt(se,ln,Ct(ln),gt)}return se}function Pi(gt,Nt){for(var Ct=-1,se=gt==null?0:gt.length;++Ct<se&&Nt(gt[Ct],Ct,gt)!==!1;);return gt}function Ii(gt,Nt){for(var Ct=gt==null?0:gt.length;Ct--&&Nt(gt[Ct],Ct,gt)!==!1;);return gt}function po(gt,Nt){for(var Ct=-1,se=gt==null?0:gt.length;++Ct<se;)if(!Nt(gt[Ct],Ct,gt))return!1;return!0}function Yi(gt,Nt){for(var Ct=-1,se=gt==null?0:gt.length,_e=0,ke=[];++Ct<se;){var ln=gt[Ct];Nt(ln,Ct,gt)&&(ke[_e++]=ln)}return ke}function la(gt,Nt){var Ct=gt==null?0:gt.length;return!!Ct&&xs(gt,Nt,0)>-1}function hl(gt,Nt,Ct){for(var se=-1,_e=gt==null?0:gt.length;++se<_e;)if(Ct(Nt,gt[se]))return!0;return!1}function Mr(gt,Nt){for(var Ct=-1,se=gt==null?0:gt.length,_e=Array(se);++Ct<se;)_e[Ct]=Nt(gt[Ct],Ct,gt);return _e}function Ge(gt,Nt){for(var Ct=-1,se=Nt.length,_e=gt.length;++Ct<se;)gt[_e+Ct]=Nt[Ct];return gt}function Oo(gt,Nt,Ct,se){var _e=-1,ke=gt==null?0:gt.length;for(se&&ke&&(Ct=gt[++_e]);++_e<ke;)Ct=Nt(Ct,gt[_e],_e,gt);return Ct}function yr(gt,Nt,Ct,se){var _e=gt==null?0:gt.length;for(se&&_e&&(Ct=gt[--_e]);_e--;)Ct=Nt(Ct,gt[_e],_e,gt);return Ct}function Ga(gt,Nt){for(var Ct=-1,se=gt==null?0:gt.length;++Ct<se;)if(Nt(gt[Ct],Ct,gt))return!0;return!1}var $i=Es("length");function qh(gt){return gt.split("")}function He(gt){return gt.match(Ie)||[]}function ca(gt,Nt,Ct){var se;return Ct(gt,function(_e,ke,ln){if(Nt(_e,ke,ln))return se=ke,!1}),se}function Kn(gt,Nt,Ct,se){for(var _e=gt.length,ke=Ct+(se?1:-1);se?ke--:++ke<_e;)if(Nt(gt[ke],ke,gt))return ke;return-1}function xs(gt,Nt,Ct){return Nt===Nt?pl(gt,Nt,Ct):Kn(gt,fa,Ct)}function pi(gt,Nt,Ct,se){for(var _e=Ct-1,ke=gt.length;++_e<ke;)if(se(gt[_e],Nt))return _e;return-1}function fa(gt){return gt!==gt}function bf(gt,Nt){var Ct=gt==null?0:gt.length;return Ct?go(gt,Nt)/Ct:pt}function Es(gt){return function(Nt){return Nt==null?n:Nt[gt]}}function $e(gt){return function(Nt){return gt==null?n:gt[Nt]}}function Zi(gt,Nt,Ct,se,_e){return _e(gt,function(ke,ln,cr){Ct=se?(se=!1,ke):Nt(Ct,ke,ln,cr)}),Ct}function _u(gt,Nt){var Ct=gt.length;for(gt.sort(Nt);Ct--;)gt[Ct]=gt[Ct].value;return gt}function go(gt,Nt){for(var Ct,se=-1,_e=gt.length;++se<_e;){var ke=Nt(gt[se]);ke!==n&&(Ct=Ct===n?ke:Ct+ke)}return Ct}function di(gt,Nt){for(var Ct=-1,se=Array(gt);++Ct<gt;)se[Ct]=Nt(Ct);return se}function ti(gt,Nt){return Mr(Nt,function(Ct){return[Ct,gt[Ct]]})}function Hh(gt){return gt&&gt.slice(0,pa(gt)+1).replace(Xe,"")}function io(gt){return function(Nt){return gt(Nt)}}function ts(gt,Nt){return Mr(Nt,function(Ct){return gt[Ct]})}function gi(gt,Nt){return gt.has(Nt)}function Bs(gt,Nt){for(var Ct=-1,se=gt.length;++Ct<se&&xs(Nt,gt[Ct],0)>-1;);return Ct}function Ri(gt,Nt){for(var Ct=gt.length;Ct--&&xs(Nt,gt[Ct],0)>-1;);return Ct}function Do(gt,Nt){for(var Ct=gt.length,se=0;Ct--;)gt[Ct]===Nt&&++se;return se}var es=$e(vs),ha=$e(Us);function ws(gt){return"\\"+Ir[gt]}function Vr(gt,Nt){return gt==null?n:gt[Nt]}function ka(gt){return wf.test(gt)}function jl(gt){return yu.test(gt)}function ai(gt){for(var Nt,Ct=[];!(Nt=gt.next()).done;)Ct.push(Nt.value);return Ct}function ns(gt){var Nt=-1,Ct=Array(gt.size);return gt.forEach(function(se,_e){Ct[++Nt]=[_e,se]}),Ct}function mo(gt,Nt){return function(Ct){return gt(Nt(Ct))}}function zs(gt,Nt){for(var Ct=-1,se=gt.length,_e=0,ke=[];++Ct<se;){var ln=gt[Ct];(ln===Nt||ln===g)&&(gt[Ct]=g,ke[_e++]=Ct)}return ke}function Wr(gt){var Nt=-1,Ct=Array(gt.size);return gt.forEach(function(se){Ct[++Nt]=se}),Ct}function Vh(gt){var Nt=-1,Ct=Array(gt.size);return gt.forEach(function(se){Ct[++Nt]=[se,se]}),Ct}function pl(gt,Nt,Ct){for(var se=Ct-1,_e=gt.length;++se<_e;)if(gt[se]===Nt)return se;return-1}function xu(gt,Nt,Ct){for(var se=Ct+1;se--;)if(gt[se]===Nt)return se;return se}function qa(gt){return ka(gt)?Xr(gt):$i(gt)}function Fo(gt){return ka(gt)?Eu(gt):qh(gt)}function pa(gt){for(var Nt=gt.length;Nt--&&Je.test(gt.charAt(Nt)););return Nt}var rs=$e(za);function Xr(gt){for(var Nt=Ba.lastIndex=0;Ba.test(gt);)++Nt;return Nt}function Eu(gt){return gt.match(Ba)||[]}function ui(gt){return gt.match(jr)||[]}var is=function gt(Nt){Nt=Nt==null?Ur:Ki.defaults(Ur.Object(),Nt,Ki.pick(Ur,dr));var Ct=Nt.Array,se=Nt.Date,_e=Nt.Error,ke=Nt.Function,ln=Nt.Math,cr=Nt.Object,os=Nt.RegExp,Ha=Nt.String,tr=Nt.TypeError,Nr=Ct.prototype,Uo=ke.prototype,ei=cr.prototype,wu=Nt["__core-js_shared__"],Ss=Uo.toString,sn=ei.hasOwnProperty,Li=0,Ql=function(){var l=/[^.]+$/.exec(wu&&wu.keys&&wu.keys.IE_PROTO||"");return l?"Symbol(src)_1."+l:""}(),Rr=ei.toString,Af=Ss.call(cr),Bo=Ur._,Br=os("^"+Ss.call(sn).replace(qe,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ni=Mf?Nt.Buffer:n,Ji=Nt.Symbol,Ms=Nt.Uint8Array,yo=Ni?Ni.allocUnsafe:n,bs=mo(cr.getPrototypeOf,cr),li=cr.create,zo=ei.propertyIsEnumerable,fr=Nr.splice,Tf=Ji?Ji.isConcatSpreadable:n,Su=Ji?Ji.iterator:n,Tr=Ji?Ji.toStringTag:n,Go=function(){try{var l=vl(cr,"defineProperty");return l({},"",{}),l}catch(h){}}(),Cf=Nt.clearTimeout!==Ur.clearTimeout&&Nt.clearTimeout,Va=se&&se.now!==Ur.Date.now&&se.now,Gs=Nt.setTimeout!==Ur.setTimeout&&Nt.setTimeout,Cr=ln.ceil,zr=ln.floor,Wa=cr.getOwnPropertySymbols,Oi=Ni?Ni.isBuffer:n,tc=Nt.isFinite,ec=Nr.join,Yr=mo(cr.keys,cr),ni=ln.max,vr=ln.min,Wh=se.now,dl=Nt.parseInt,Xh=ln.random,em=Nr.reverse,vo=vl(Nt,"DataView"),As=vl(Nt,"Map"),da=vl(Nt,"Promise"),ga=vl(Nt,"Set"),Ts=vl(Nt,"WeakMap"),ko=vl(cr,"create"),ma=Ts&&new Ts,ss={},ya=_l(vo),Re=_l(As),ks=_l(da),Mu=_l(ga),va=_l(Ts),ci=Ji?Ji.prototype:n,bu=ci?ci.valueOf:n,Di=ci?ci.toString:n;function U(l){if($r(l)&&!Ve(l)&&!(l instanceof i)){if(l instanceof r)return l;if(sn.call(l,"__wrapped__"))return kx(l)}return new r(l)}var Xa=function(){function l(){}return function(h){if(!Gr(h))return{};if(li)return li(h);l.prototype=h;var y=new l;return l.prototype=n,y}}();function _a(){}function r(l,h){this.__wrapped__=l,this.__actions__=[],this.__chain__=!!h,this.__index__=0,this.__values__=n}U.templateSettings={escape:et,evaluate:lt,interpolate:Ft,variable:"",imports:{_:U}},U.prototype=_a.prototype,U.prototype.constructor=U,r.prototype=Xa(_a.prototype),r.prototype.constructor=r;function i(l){this.__wrapped__=l,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=yt,this.__views__=[]}function a(){var l=new i(this.__wrapped__);return l.__actions__=qo(this.__actions__),l.__dir__=this.__dir__,l.__filtered__=this.__filtered__,l.__iteratees__=qo(this.__iteratees__),l.__takeCount__=this.__takeCount__,l.__views__=qo(this.__views__),l}function c(){if(this.__filtered__){var l=new i(this);l.__dir__=-1,l.__filtered__=!0}else l=this.clone(),l.__dir__*=-1;return l}function d(){var l=this.__wrapped__.value(),h=this.__dir__,y=Ve(l),T=h<0,O=y?l.length:0,Y=Q2(0,O,this.__views__),nt=Y.start,ct=Y.end,_t=ct-nt,zt=T?ct:nt-1,kt=this.__iteratees__,Yt=kt.length,pe=0,Se=vr(_t,this.__takeCount__);if(!y||!T&&O==_t&&Se==_t)return cx(l,this.__actions__);var De=[];t:for(;_t--&&pe<Se;){zt+=h;for(var Qe=-1,Fe=l[zt];++Qe<Yt;){var Fn=kt[Qe],$n=Fn.iteratee,cs=Fn.type,Eo=$n(Fe);if(cs==Dt)Fe=Eo;else if(!Eo){if(cs==K)continue t;break t}}De[pe++]=Fe}return De}i.prototype=Xa(_a.prototype),i.prototype.constructor=i;function _(l){var h=-1,y=l==null?0:l.length;for(this.clear();++h<y;){var T=l[h];this.set(T[0],T[1])}}function M(){this.__data__=ko?ko(null):{},this.size=0}function L(l){var h=this.has(l)&&delete this.__data__[l];return this.size-=h?1:0,h}function H(l){var h=this.__data__;if(ko){var y=h[l];return y===p?n:y}return sn.call(h,l)?h[l]:n}function it(l){var h=this.__data__;return ko?h[l]!==n:sn.call(h,l)}function bt(l,h){var y=this.__data__;return this.size+=this.has(l)?0:1,y[l]=ko&&h===n?p:h,this}_.prototype.clear=M,_.prototype.delete=L,_.prototype.get=H,_.prototype.has=it,_.prototype.set=bt;function Tt(l){var h=-1,y=l==null?0:l.length;for(this.clear();++h<y;){var T=l[h];this.set(T[0],T[1])}}function Kt(){this.__data__=[],this.size=0}function Qt(l){var h=this.__data__,y=Yh(h,l);if(y<0)return!1;var T=h.length-1;return y==T?h.pop():fr.call(h,y,1),--this.size,!0}function le(l){var h=this.__data__,y=Yh(h,l);return y<0?n:h[y][1]}function Ee(l){return Yh(this.__data__,l)>-1}function Dn(l,h){var y=this.__data__,T=Yh(y,l);return T<0?(++this.size,y.push([l,h])):y[T][1]=h,this}Tt.prototype.clear=Kt,Tt.prototype.delete=Qt,Tt.prototype.get=le,Tt.prototype.has=Ee,Tt.prototype.set=Dn;function Jn(l){var h=-1,y=l==null?0:l.length;for(this.clear();++h<y;){var T=l[h];this.set(T[0],T[1])}}function fi(){this.size=0,this.__data__={hash:new _,map:new(As||Tt),string:new _}}function as(l){var h=op(this,l).delete(l);return this.size-=h?1:0,h}function qs(l){return op(this,l).get(l)}function Pf(l){return op(this,l).has(l)}function n2(l,h){var y=op(this,l),T=y.size;return y.set(l,h),this.size+=y.size==T?0:1,this}Jn.prototype.clear=fi,Jn.prototype.delete=as,Jn.prototype.get=qs,Jn.prototype.has=Pf,Jn.prototype.set=n2;function gl(l){var h=-1,y=l==null?0:l.length;for(this.__data__=new Jn;++h<y;)this.add(l[h])}function r2(l){return this.__data__.set(l,p),this}function i2(l){return this.__data__.has(l)}gl.prototype.add=gl.prototype.push=r2,gl.prototype.has=i2;function Hs(l){var h=this.__data__=new Tt(l);this.size=h.size}function o2(){this.__data__=new Tt,this.size=0}function s2(l){var h=this.__data__,y=h.delete(l);return this.size=h.size,y}function a2(l){return this.__data__.get(l)}function u2(l){return this.__data__.has(l)}function l2(l,h){var y=this.__data__;if(y instanceof Tt){var T=y.__data__;if(!As||T.length<e-1)return T.push([l,h]),this.size=++y.size,this;y=this.__data__=new Jn(T)}return y.set(l,h),this.size=y.size,this}Hs.prototype.clear=o2,Hs.prototype.delete=s2,Hs.prototype.get=a2,Hs.prototype.has=u2,Hs.prototype.set=l2;function k1(l,h){var y=Ve(l),T=!y&&xl(l),O=!y&&!T&&Iu(l),Y=!y&&!T&&!O&&oc(l),nt=y||T||O||Y,ct=nt?di(l.length,Ha):[],_t=ct.length;for(var zt in l)(h||sn.call(l,zt))&&!(nt&&(zt=="length"||O&&(zt=="offset"||zt=="parent")||Y&&(zt=="buffer"||zt=="byteLength"||zt=="byteOffset")||Ka(zt,_t)))&&ct.push(zt);return ct}function q1(l){var h=l.length;return h?l[hm(0,h-1)]:n}function c2(l,h){return sp(qo(l),ml(h,0,l.length))}function f2(l){return sp(qo(l))}function nm(l,h,y){(y!==n&&!Vs(l[h],y)||y===n&&!(h in l))&&Ya(l,h,y)}function If(l,h,y){var T=l[h];(!(sn.call(l,h)&&Vs(T,y))||y===n&&!(h in l))&&Ya(l,h,y)}function Yh(l,h){for(var y=l.length;y--;)if(Vs(l[y][0],h))return y;return-1}function h2(l,h,y,T){return Au(l,function(O,Y,nt){h(T,O,y(O),nt)}),T}function H1(l,h){return l&&Ea(h,Fi(h),l)}function p2(l,h){return l&&Ea(h,Vo(h),l)}function Ya(l,h,y){h=="__proto__"&&Go?Go(l,h,{configurable:!0,enumerable:!0,value:y,writable:!0}):l[h]=y}function rm(l,h){for(var y=-1,T=h.length,O=Ct(T),Y=l==null;++y<T;)O[y]=Y?n:Um(l,h[y]);return O}function ml(l,h,y){return l===l&&(y!==n&&(l=l<=y?l:y),h!==n&&(l=l>=h?l:h)),l}function Cs(l,h,y,T,O,Y){var nt,ct=h&m,_t=h&v,zt=h&w;if(y&&(nt=O?y(l,T,O,Y):y(l)),nt!==n)return nt;if(!Gr(l))return l;var kt=Ve(l);if(kt){if(nt=eO(l),!ct)return qo(l,nt)}else{var Yt=oo(l),pe=Yt==qt||Yt==xe;if(Iu(l))return px(l,ct);if(Yt==ge||Yt==ae||pe&&!O){if(nt=_t||pe?{}:Lx(l),!ct)return _t?V2(l,p2(nt,l)):H2(l,H1(nt,l))}else{if(!je[Yt])return O?l:{};nt=nO(l,Yt,ct)}}Y||(Y=new Hs);var Se=Y.get(l);if(Se)return Se;Y.set(l,nt),aE(l)?l.forEach(function(Fe){nt.add(Cs(Fe,h,y,Fe,l,Y))}):oE(l)&&l.forEach(function(Fe,Fn){nt.set(Fn,Cs(Fe,h,y,Fn,l,Y))});var De=zt?_t?Sm:wm:_t?Vo:Fi,Qe=kt?n:De(l);return Pi(Qe||l,function(Fe,Fn){Qe&&(Fn=Fe,Fe=l[Fn]),If(nt,Fn,Cs(Fe,h,y,Fn,l,Y))}),nt}function d2(l){var h=Fi(l);return function(y){return V1(y,l,h)}}function V1(l,h,y){var T=y.length;if(l==null)return!T;for(l=cr(l);T--;){var O=y[T],Y=h[O],nt=l[O];if(nt===n&&!(O in l)||!Y(nt))return!1}return!0}function W1(l,h,y){if(typeof l!="function")throw new tr(s);return Uf(function(){l.apply(n,y)},h)}function Rf(l,h,y,T){var O=-1,Y=la,nt=!0,ct=l.length,_t=[],zt=h.length;if(!ct)return _t;y&&(h=Mr(h,io(y))),T?(Y=hl,nt=!1):h.length>=e&&(Y=gi,nt=!1,h=new gl(h));t:for(;++O<ct;){var kt=l[O],Yt=y==null?kt:y(kt);if(kt=T||kt!==0?kt:0,nt&&Yt===Yt){for(var pe=zt;pe--;)if(h[pe]===Yt)continue t;_t.push(kt)}else Y(h,Yt,T)||_t.push(kt)}return _t}var Au=vx(xa),X1=vx(om,!0);function g2(l,h){var y=!0;return Au(l,function(T,O,Y){return y=!!h(T,O,Y),y}),y}function $h(l,h,y){for(var T=-1,O=l.length;++T<O;){var Y=l[T],nt=h(Y);if(nt!=null&&(ct===n?nt===nt&&!ls(nt):y(nt,ct)))var ct=nt,_t=Y}return _t}function m2(l,h,y,T){var O=l.length;for(y=Ze(y),y<0&&(y=-y>O?0:O+y),T=T===n||T>O?O:Ze(T),T<0&&(T+=O),T=y>T?0:lE(T);y<T;)l[y++]=h;return l}function Y1(l,h){var y=[];return Au(l,function(T,O,Y){h(T,O,Y)&&y.push(T)}),y}function ji(l,h,y,T,O){var Y=-1,nt=l.length;for(y||(y=iO),O||(O=[]);++Y<nt;){var ct=l[Y];h>0&&y(ct)?h>1?ji(ct,h-1,y,T,O):Ge(O,ct):T||(O[O.length]=ct)}return O}var im=_x(),$1=_x(!0);function xa(l,h){return l&&im(l,h,Fi)}function om(l,h){return l&&$1(l,h,Fi)}function Zh(l,h){return Yi(h,function(y){return Ja(l[y])})}function yl(l,h){h=Cu(h,l);for(var y=0,T=h.length;l!=null&&y<T;)l=l[wa(h[y++])];return y&&y==T?l:n}function Z1(l,h,y){var T=h(l);return Ve(l)?T:Ge(T,y(l))}function _o(l){return l==null?l===n?z:ee:Tr&&Tr in cr(l)?j2(l):fO(l)}function sm(l,h){return l>h}function y2(l,h){return l!=null&&sn.call(l,h)}function v2(l,h){return l!=null&&h in cr(l)}function _2(l,h,y){return l>=vr(h,y)&&l<ni(h,y)}function am(l,h,y){for(var T=y?hl:la,O=l[0].length,Y=l.length,nt=Y,ct=Ct(Y),_t=1/0,zt=[];nt--;){var kt=l[nt];nt&&h&&(kt=Mr(kt,io(h))),_t=vr(kt.length,_t),ct[nt]=!y&&(h||O>=120&&kt.length>=120)?new gl(nt&&kt):n}kt=l[0];var Yt=-1,pe=ct[0];t:for(;++Yt<O&&zt.length<_t;){var Se=kt[Yt],De=h?h(Se):Se;if(Se=y||Se!==0?Se:0,!(pe?gi(pe,De):T(zt,De,y))){for(nt=Y;--nt;){var Qe=ct[nt];if(!(Qe?gi(Qe,De):T(l[nt],De,y)))continue t}pe&&pe.push(De),zt.push(Se)}}return zt}function x2(l,h,y,T){return xa(l,function(O,Y,nt){h(T,y(O),Y,nt)}),T}function Lf(l,h,y){h=Cu(h,l),l=Fx(l,h);var T=l==null?l:l[wa(Is(h))];return T==null?n:ie(T,l,y)}function K1(l){return $r(l)&&_o(l)==ae}function E2(l){return $r(l)&&_o(l)==dt}function w2(l){return $r(l)&&_o(l)==ce}function Nf(l,h,y,T,O){return l===h?!0:l==null||h==null||!$r(l)&&!$r(h)?l!==l&&h!==h:S2(l,h,y,T,Nf,O)}function S2(l,h,y,T,O,Y){var nt=Ve(l),ct=Ve(h),_t=nt?ut:oo(l),zt=ct?ut:oo(h);_t=_t==ae?ge:_t,zt=zt==ae?ge:zt;var kt=_t==ge,Yt=zt==ge,pe=_t==zt;if(pe&&Iu(l)){if(!Iu(h))return!1;nt=!0,kt=!1}if(pe&&!kt)return Y||(Y=new Hs),nt||oc(l)?Px(l,h,y,T,O,Y):K2(l,h,_t,y,T,O,Y);if(!(y&S)){var Se=kt&&sn.call(l,"__wrapped__"),De=Yt&&sn.call(h,"__wrapped__");if(Se||De){var Qe=Se?l.value():l,Fe=De?h.value():h;return Y||(Y=new Hs),O(Qe,Fe,y,T,Y)}}return pe?(Y||(Y=new Hs),J2(l,h,y,T,O,Y)):!1}function M2(l){return $r(l)&&oo(l)==ft}function um(l,h,y,T){var O=y.length,Y=O,nt=!T;if(l==null)return!Y;for(l=cr(l);O--;){var ct=y[O];if(nt&&ct[2]?ct[1]!==l[ct[0]]:!(ct[0]in l))return!1}for(;++O<Y;){ct=y[O];var _t=ct[0],zt=l[_t],kt=ct[1];if(nt&&ct[2]){if(zt===n&&!(_t in l))return!1}else{var Yt=new Hs;if(T)var pe=T(zt,kt,_t,l,h,Yt);if(!(pe===n?Nf(kt,zt,S|b,T,Yt):pe))return!1}}return!0}function J1(l){if(!Gr(l)||sO(l))return!1;var h=Ja(l)?Br:Z;return h.test(_l(l))}function b2(l){return $r(l)&&_o(l)==be}function A2(l){return $r(l)&&oo(l)==Wt}function T2(l){return $r(l)&&hp(l.length)&&!!or[_o(l)]}function j1(l){return typeof l=="function"?l:l==null?Wo:typeof l=="object"?Ve(l)?ex(l[0],l[1]):tx(l):xE(l)}function lm(l){if(!Ff(l))return Yr(l);var h=[];for(var y in cr(l))sn.call(l,y)&&y!="constructor"&&h.push(y);return h}function C2(l){if(!Gr(l))return cO(l);var h=Ff(l),y=[];for(var T in l)T=="constructor"&&(h||!sn.call(l,T))||y.push(T);return y}function cm(l,h){return l<h}function Q1(l,h){var y=-1,T=Ho(l)?Ct(l.length):[];return Au(l,function(O,Y,nt){T[++y]=h(O,Y,nt)}),T}function tx(l){var h=bm(l);return h.length==1&&h[0][2]?Ox(h[0][0],h[0][1]):function(y){return y===l||um(y,l,h)}}function ex(l,h){return Tm(l)&&Nx(h)?Ox(wa(l),h):function(y){var T=Um(y,l);return T===n&&T===h?Bm(y,l):Nf(h,T,S|b)}}function Kh(l,h,y,T,O){l!==h&&im(h,function(Y,nt){if(O||(O=new Hs),Gr(Y))P2(l,h,nt,y,Kh,T,O);else{var ct=T?T(Pm(l,nt),Y,nt+"",l,h,O):n;ct===n&&(ct=Y),nm(l,nt,ct)}},Vo)}function P2(l,h,y,T,O,Y,nt){var ct=Pm(l,y),_t=Pm(h,y),zt=nt.get(_t);if(zt){nm(l,y,zt);return}var kt=Y?Y(ct,_t,y+"",l,h,nt):n,Yt=kt===n;if(Yt){var pe=Ve(_t),Se=!pe&&Iu(_t),De=!pe&&!Se&&oc(_t);kt=_t,pe||Se||De?Ve(ct)?kt=ct:ri(ct)?kt=qo(ct):Se?(Yt=!1,kt=px(_t,!0)):De?(Yt=!1,kt=dx(_t,!0)):kt=[]:Bf(_t)||xl(_t)?(kt=ct,xl(ct)?kt=cE(ct):(!Gr(ct)||Ja(ct))&&(kt=Lx(_t))):Yt=!1}Yt&&(nt.set(_t,kt),O(kt,_t,T,Y,nt),nt.delete(_t)),nm(l,y,kt)}function nx(l,h){var y=l.length;if(y)return h+=h<0?y:0,Ka(h,y)?l[h]:n}function rx(l,h,y){h.length?h=Mr(h,function(Y){return Ve(Y)?function(nt){return yl(nt,Y.length===1?Y[0]:Y)}:Y}):h=[Wo];var T=-1;h=Mr(h,io(Ne()));var O=Q1(l,function(Y,nt,ct){var _t=Mr(h,function(zt){return zt(Y)});return{criteria:_t,index:++T,value:Y}});return _u(O,function(Y,nt){return q2(Y,nt,y)})}function I2(l,h){return ix(l,h,function(y,T){return Bm(l,T)})}function ix(l,h,y){for(var T=-1,O=h.length,Y={};++T<O;){var nt=h[T],ct=yl(l,nt);y(ct,nt)&&Of(Y,Cu(nt,l),ct)}return Y}function R2(l){return function(h){return yl(h,l)}}function fm(l,h,y,T){var O=T?pi:xs,Y=-1,nt=h.length,ct=l;for(l===h&&(h=qo(h)),y&&(ct=Mr(l,io(y)));++Y<nt;)for(var _t=0,zt=h[Y],kt=y?y(zt):zt;(_t=O(ct,kt,_t,T))>-1;)ct!==l&&fr.call(ct,_t,1),fr.call(l,_t,1);return l}function ox(l,h){for(var y=l?h.length:0,T=y-1;y--;){var O=h[y];if(y==T||O!==Y){var Y=O;Ka(O)?fr.call(l,O,1):gm(l,O)}}return l}function hm(l,h){return l+zr(Xh()*(h-l+1))}function L2(l,h,y,T){for(var O=-1,Y=ni(Cr((h-l)/(y||1)),0),nt=Ct(Y);Y--;)nt[T?Y:++O]=l,l+=y;return nt}function pm(l,h){var y="";if(!l||h<1||h>Mt)return y;do h%2&&(y+=l),h=zr(h/2),h&&(l+=l);while(h);return y}function an(l,h){return Im(Dx(l,h,Wo),l+"")}function N2(l){return q1(sc(l))}function O2(l,h){var y=sc(l);return sp(y,ml(h,0,y.length))}function Of(l,h,y,T){if(!Gr(l))return l;h=Cu(h,l);for(var O=-1,Y=h.length,nt=Y-1,ct=l;ct!=null&&++O<Y;){var _t=wa(h[O]),zt=y;if(_t==="__proto__"||_t==="constructor"||_t==="prototype")return l;if(O!=nt){var kt=ct[_t];zt=T?T(kt,_t,ct):n,zt===n&&(zt=Gr(kt)?kt:Ka(h[O+1])?[]:{})}If(ct,_t,zt),ct=ct[_t]}return l}var sx=ma?function(l,h){return ma.set(l,h),l}:Wo,D2=Go?function(l,h){return Go(l,"toString",{configurable:!0,enumerable:!1,value:Gm(h),writable:!0})}:Wo;function F2(l){return sp(sc(l))}function Ps(l,h,y){var T=-1,O=l.length;h<0&&(h=-h>O?0:O+h),y=y>O?O:y,y<0&&(y+=O),O=h>y?0:y-h>>>0,h>>>=0;for(var Y=Ct(O);++T<O;)Y[T]=l[T+h];return Y}function U2(l,h){var y;return Au(l,function(T,O,Y){return y=h(T,O,Y),!y}),!!y}function Jh(l,h,y){var T=0,O=l==null?T:l.length;if(typeof h=="number"&&h===h&&O<=Bt){for(;T<O;){var Y=T+O>>>1,nt=l[Y];nt!==null&&!ls(nt)&&(y?nt<=h:nt<h)?T=Y+1:O=Y}return O}return dm(l,h,Wo,y)}function dm(l,h,y,T){var O=0,Y=l==null?0:l.length;if(Y===0)return 0;h=y(h);for(var nt=h!==h,ct=h===null,_t=ls(h),zt=h===n;O<Y;){var kt=zr((O+Y)/2),Yt=y(l[kt]),pe=Yt!==n,Se=Yt===null,De=Yt===Yt,Qe=ls(Yt);if(nt)var Fe=T||De;else zt?Fe=De&&(T||pe):ct?Fe=De&&pe&&(T||!Se):_t?Fe=De&&pe&&!Se&&(T||!Qe):Se||Qe?Fe=!1:Fe=T?Yt<=h:Yt<h;Fe?O=kt+1:Y=kt}return vr(Y,J)}function ax(l,h){for(var y=-1,T=l.length,O=0,Y=[];++y<T;){var nt=l[y],ct=h?h(nt):nt;if(!y||!Vs(ct,_t)){var _t=ct;Y[O++]=nt===0?0:nt}}return Y}function ux(l){return typeof l=="number"?l:ls(l)?pt:+l}function us(l){if(typeof l=="string")return l;if(Ve(l))return Mr(l,us)+"";if(ls(l))return Di?Di.call(l):"";var h=l+"";return h=="0"&&1/l==-At?"-0":h}function Tu(l,h,y){var T=-1,O=la,Y=l.length,nt=!0,ct=[],_t=ct;if(y)nt=!1,O=hl;else if(Y>=e){var zt=h?null:$2(l);if(zt)return Wr(zt);nt=!1,O=gi,_t=new gl}else _t=h?[]:ct;t:for(;++T<Y;){var kt=l[T],Yt=h?h(kt):kt;if(kt=y||kt!==0?kt:0,nt&&Yt===Yt){for(var pe=_t.length;pe--;)if(_t[pe]===Yt)continue t;h&&_t.push(Yt),ct.push(kt)}else O(_t,Yt,y)||(_t!==ct&&_t.push(Yt),ct.push(kt))}return ct}function gm(l,h){return h=Cu(h,l),l=Fx(l,h),l==null||delete l[wa(Is(h))]}function lx(l,h,y,T){return Of(l,h,y(yl(l,h)),T)}function jh(l,h,y,T){for(var O=l.length,Y=T?O:-1;(T?Y--:++Y<O)&&h(l[Y],Y,l););return y?Ps(l,T?0:Y,T?Y+1:O):Ps(l,T?Y+1:0,T?O:Y)}function cx(l,h){var y=l;return y instanceof i&&(y=y.value()),Oo(h,function(T,O){return O.func.apply(O.thisArg,Ge([T],O.args))},y)}function mm(l,h,y){var T=l.length;if(T<2)return T?Tu(l[0]):[];for(var O=-1,Y=Ct(T);++O<T;)for(var nt=l[O],ct=-1;++ct<T;)ct!=O&&(Y[O]=Rf(Y[O]||nt,l[ct],h,y));return Tu(ji(Y,1),h,y)}function fx(l,h,y){for(var T=-1,O=l.length,Y=h.length,nt={};++T<O;){var ct=T<Y?h[T]:n;y(nt,l[T],ct)}return nt}function ym(l){return ri(l)?l:[]}function vm(l){return typeof l=="function"?l:Wo}function Cu(l,h){return Ve(l)?l:Tm(l,h)?[l]:Gx(hr(l))}var B2=an;function Pu(l,h,y){var T=l.length;return y=y===n?T:y,!h&&y>=T?l:Ps(l,h,y)}var hx=Cf||function(l){return Ur.clearTimeout(l)};function px(l,h){if(h)return l.slice();var y=l.length,T=yo?yo(y):new l.constructor(y);return l.copy(T),T}function _m(l){var h=new l.constructor(l.byteLength);return new Ms(h).set(new Ms(l)),h}function z2(l,h){var y=h?_m(l.buffer):l.buffer;return new l.constructor(y,l.byteOffset,l.byteLength)}function G2(l){var h=new l.constructor(l.source,Qn.exec(l));return h.lastIndex=l.lastIndex,h}function k2(l){return bu?cr(bu.call(l)):{}}function dx(l,h){var y=h?_m(l.buffer):l.buffer;return new l.constructor(y,l.byteOffset,l.length)}function gx(l,h){if(l!==h){var y=l!==n,T=l===null,O=l===l,Y=ls(l),nt=h!==n,ct=h===null,_t=h===h,zt=ls(h);if(!ct&&!zt&&!Y&&l>h||Y&&nt&&_t&&!ct&&!zt||T&&nt&&_t||!y&&_t||!O)return 1;if(!T&&!Y&&!zt&&l<h||zt&&y&&O&&!T&&!Y||ct&&y&&O||!nt&&O||!_t)return-1}return 0}function q2(l,h,y){for(var T=-1,O=l.criteria,Y=h.criteria,nt=O.length,ct=y.length;++T<nt;){var _t=gx(O[T],Y[T]);if(_t){if(T>=ct)return _t;var zt=y[T];return _t*(zt=="desc"?-1:1)}}return l.index-h.index}function mx(l,h,y,T){for(var O=-1,Y=l.length,nt=y.length,ct=-1,_t=h.length,zt=ni(Y-nt,0),kt=Ct(_t+zt),Yt=!T;++ct<_t;)kt[ct]=h[ct];for(;++O<nt;)(Yt||O<Y)&&(kt[y[O]]=l[O]);for(;zt--;)kt[ct++]=l[O++];return kt}function yx(l,h,y,T){for(var O=-1,Y=l.length,nt=-1,ct=y.length,_t=-1,zt=h.length,kt=ni(Y-ct,0),Yt=Ct(kt+zt),pe=!T;++O<kt;)Yt[O]=l[O];for(var Se=O;++_t<zt;)Yt[Se+_t]=h[_t];for(;++nt<ct;)(pe||O<Y)&&(Yt[Se+y[nt]]=l[O++]);return Yt}function qo(l,h){var y=-1,T=l.length;for(h||(h=Ct(T));++y<T;)h[y]=l[y];return h}function Ea(l,h,y,T){var O=!y;y||(y={});for(var Y=-1,nt=h.length;++Y<nt;){var ct=h[Y],_t=T?T(y[ct],l[ct],ct,y,l):n;_t===n&&(_t=l[ct]),O?Ya(y,ct,_t):If(y,ct,_t)}return y}function H2(l,h){return Ea(l,Am(l),h)}function V2(l,h){return Ea(l,Ix(l),h)}function Qh(l,h){return function(y,T){var O=Ve(y)?kh:h2,Y=h?h():{};return O(y,l,Ne(T,2),Y)}}function nc(l){return an(function(h,y){var T=-1,O=y.length,Y=O>1?y[O-1]:n,nt=O>2?y[2]:n;for(Y=l.length>3&&typeof Y=="function"?(O--,Y):n,nt&&xo(y[0],y[1],nt)&&(Y=O<3?n:Y,O=1),h=cr(h);++T<O;){var ct=y[T];ct&&l(h,ct,T,Y)}return h})}function vx(l,h){return function(y,T){if(y==null)return y;if(!Ho(y))return l(y,T);for(var O=y.length,Y=h?O:-1,nt=cr(y);(h?Y--:++Y<O)&&T(nt[Y],Y,nt)!==!1;);return y}}function _x(l){return function(h,y,T){for(var O=-1,Y=cr(h),nt=T(h),ct=nt.length;ct--;){var _t=nt[l?ct:++O];if(y(Y[_t],_t,Y)===!1)break}return h}}function W2(l,h,y){var T=h&C,O=Df(l);function Y(){var nt=this&&this!==Ur&&this instanceof Y?O:l;return nt.apply(T?y:this,arguments)}return Y}function xx(l){return function(h){h=hr(h);var y=ka(h)?Fo(h):n,T=y?y[0]:h.charAt(0),O=y?Pu(y,1).join(""):h.slice(1);return T[l]()+O}}function rc(l){return function(h){return Oo(vE(yE(h).replace(Ro,"")),l,"")}}function Df(l){return function(){var h=arguments;switch(h.length){case 0:return new l;case 1:return new l(h[0]);case 2:return new l(h[0],h[1]);case 3:return new l(h[0],h[1],h[2]);case 4:return new l(h[0],h[1],h[2],h[3]);case 5:return new l(h[0],h[1],h[2],h[3],h[4]);case 6:return new l(h[0],h[1],h[2],h[3],h[4],h[5]);case 7:return new l(h[0],h[1],h[2],h[3],h[4],h[5],h[6])}var y=Xa(l.prototype),T=l.apply(y,h);return Gr(T)?T:y}}function X2(l,h,y){var T=Df(l);function O(){for(var Y=arguments.length,nt=Ct(Y),ct=Y,_t=ic(O);ct--;)nt[ct]=arguments[ct];var zt=Y<3&&nt[0]!==_t&&nt[Y-1]!==_t?[]:zs(nt,_t);if(Y-=zt.length,Y<y)return bx(l,h,tp,O.placeholder,n,nt,zt,n,n,y-Y);var kt=this&&this!==Ur&&this instanceof O?T:l;return ie(kt,this,nt)}return O}function Ex(l){return function(h,y,T){var O=cr(h);if(!Ho(h)){var Y=Ne(y,3);h=Fi(h),y=function(ct){return Y(O[ct],ct,O)}}var nt=l(h,y,T);return nt>-1?O[Y?h[nt]:nt]:n}}function wx(l){return Za(function(h){var y=h.length,T=y,O=r.prototype.thru;for(l&&h.reverse();T--;){var Y=h[T];if(typeof Y!="function")throw new tr(s);if(O&&!nt&&ip(Y)=="wrapper")var nt=new r([],!0)}for(T=nt?T:y;++T<y;){Y=h[T];var ct=ip(Y),_t=ct=="wrapper"?Mm(Y):n;_t&&Cm(_t[0])&&_t[1]==(V|E|A|X)&&!_t[4].length&&_t[9]==1?nt=nt[ip(_t[0])].apply(nt,_t[3]):nt=Y.length==1&&Cm(Y)?nt[ct]():nt.thru(Y)}return function(){var zt=arguments,kt=zt[0];if(nt&&zt.length==1&&Ve(kt))return nt.plant(kt).value();for(var Yt=0,pe=y?h[Yt].apply(this,zt):kt;++Yt<y;)pe=h[Yt].call(this,pe);return pe}})}function tp(l,h,y,T,O,Y,nt,ct,_t,zt){var kt=h&V,Yt=h&C,pe=h&R,Se=h&(E|I),De=h&q,Qe=pe?n:Df(l);function Fe(){for(var Fn=arguments.length,$n=Ct(Fn),cs=Fn;cs--;)$n[cs]=arguments[cs];if(Se)var Eo=ic(Fe),fs=Do($n,Eo);if(T&&($n=mx($n,T,O,Se)),Y&&($n=yx($n,Y,nt,Se)),Fn-=fs,Se&&Fn<zt){var ii=zs($n,Eo);return bx(l,h,tp,Fe.placeholder,y,$n,ii,ct,_t,zt-Fn)}var Ws=Yt?y:this,Qa=pe?Ws[l]:l;return Fn=$n.length,ct?$n=hO($n,ct):De&&Fn>1&&$n.reverse(),kt&&_t<Fn&&($n.length=_t),this&&this!==Ur&&this instanceof Fe&&(Qa=Qe||Df(Qa)),Qa.apply(Ws,$n)}return Fe}function Sx(l,h){return function(y,T){return x2(y,l,h(T),{})}}function ep(l,h){return function(y,T){var O;if(y===n&&T===n)return h;if(y!==n&&(O=y),T!==n){if(O===n)return T;typeof y=="string"||typeof T=="string"?(y=us(y),T=us(T)):(y=ux(y),T=ux(T)),O=l(y,T)}return O}}function xm(l){return Za(function(h){return h=Mr(h,io(Ne())),an(function(y){var T=this;return l(h,function(O){return ie(O,T,y)})})})}function np(l,h){h=h===n?" ":us(h);var y=h.length;if(y<2)return y?pm(h,l):h;var T=pm(h,Cr(l/qa(h)));return ka(h)?Pu(Fo(T),0,l).join(""):T.slice(0,l)}function Y2(l,h,y,T){var O=h&C,Y=Df(l);function nt(){for(var ct=-1,_t=arguments.length,zt=-1,kt=T.length,Yt=Ct(kt+_t),pe=this&&this!==Ur&&this instanceof nt?Y:l;++zt<kt;)Yt[zt]=T[zt];for(;_t--;)Yt[zt++]=arguments[++ct];return ie(pe,O?y:this,Yt)}return nt}function Mx(l){return function(h,y,T){return T&&typeof T!="number"&&xo(h,y,T)&&(y=T=n),h=ja(h),y===n?(y=h,h=0):y=ja(y),T=T===n?h<y?1:-1:ja(T),L2(h,y,T,l)}}function rp(l){return function(h,y){return typeof h=="string"&&typeof y=="string"||(h=Rs(h),y=Rs(y)),l(h,y)}}function bx(l,h,y,T,O,Y,nt,ct,_t,zt){var kt=h&E,Yt=kt?nt:n,pe=kt?n:nt,Se=kt?Y:n,De=kt?n:Y;h|=kt?A:F,h&=~(kt?F:A),h&x||(h&=~(C|R));var Qe=[l,h,O,Se,Yt,De,pe,ct,_t,zt],Fe=y.apply(n,Qe);return Cm(l)&&Ux(Fe,Qe),Fe.placeholder=T,Bx(Fe,l,h)}function Em(l){var h=ln[l];return function(y,T){if(y=Rs(y),T=T==null?0:vr(Ze(T),292),T&&tc(y)){var O=(hr(y)+"e").split("e"),Y=h(O[0]+"e"+(+O[1]+T));return O=(hr(Y)+"e").split("e"),+(O[0]+"e"+(+O[1]-T))}return h(y)}}var $2=ga&&1/Wr(new ga([,-0]))[1]==At?function(l){return new ga(l)}:Hm;function Ax(l){return function(h){var y=oo(h);return y==ft?ns(h):y==Wt?Vh(h):ti(h,l(h))}}function $a(l,h,y,T,O,Y,nt,ct){var _t=h&R;if(!_t&&typeof l!="function")throw new tr(s);var zt=T?T.length:0;if(zt||(h&=~(A|F),T=O=n),nt=nt===n?nt:ni(Ze(nt),0),ct=ct===n?ct:Ze(ct),zt-=O?O.length:0,h&F){var kt=T,Yt=O;T=O=n}var pe=_t?n:Mm(l),Se=[l,h,y,T,O,kt,Yt,Y,nt,ct];if(pe&&lO(Se,pe),l=Se[0],h=Se[1],y=Se[2],T=Se[3],O=Se[4],ct=Se[9]=Se[9]===n?_t?0:l.length:ni(Se[9]-zt,0),!ct&&h&(E|I)&&(h&=~(E|I)),!h||h==C)var De=W2(l,h,y);else h==E||h==I?De=X2(l,h,ct):(h==A||h==(C|A))&&!O.length?De=Y2(l,h,y,T):De=tp.apply(n,Se);var Qe=pe?sx:Ux;return Bx(Qe(De,Se),l,h)}function Tx(l,h,y,T){return l===n||Vs(l,ei[y])&&!sn.call(T,y)?h:l}function Cx(l,h,y,T,O,Y){return Gr(l)&&Gr(h)&&(Y.set(h,l),Kh(l,h,n,Cx,Y),Y.delete(h)),l}function Z2(l){return Bf(l)?n:l}function Px(l,h,y,T,O,Y){var nt=y&S,ct=l.length,_t=h.length;if(ct!=_t&&!(nt&&_t>ct))return!1;var zt=Y.get(l),kt=Y.get(h);if(zt&&kt)return zt==h&&kt==l;var Yt=-1,pe=!0,Se=y&b?new gl:n;for(Y.set(l,h),Y.set(h,l);++Yt<ct;){var De=l[Yt],Qe=h[Yt];if(T)var Fe=nt?T(Qe,De,Yt,h,l,Y):T(De,Qe,Yt,l,h,Y);if(Fe!==n){if(Fe)continue;pe=!1;break}if(Se){if(!Ga(h,function(Fn,$n){if(!gi(Se,$n)&&(De===Fn||O(De,Fn,y,T,Y)))return Se.push($n)})){pe=!1;break}}else if(!(De===Qe||O(De,Qe,y,T,Y))){pe=!1;break}}return Y.delete(l),Y.delete(h),pe}function K2(l,h,y,T,O,Y,nt){switch(y){case Ht:if(l.byteLength!=h.byteLength||l.byteOffset!=h.byteOffset)return!1;l=l.buffer,h=h.buffer;case dt:return!(l.byteLength!=h.byteLength||!Y(new Ms(l),new Ms(h)));case jt:case ce:case We:return Vs(+l,+h);case $t:return l.name==h.name&&l.message==h.message;case be:case Me:return l==h+"";case ft:var ct=ns;case Wt:var _t=T&S;if(ct||(ct=Wr),l.size!=h.size&&!_t)return!1;var zt=nt.get(l);if(zt)return zt==h;T|=b,nt.set(l,h);var kt=Px(ct(l),ct(h),T,O,Y,nt);return nt.delete(l),kt;case tt:if(bu)return bu.call(l)==bu.call(h)}return!1}function J2(l,h,y,T,O,Y){var nt=y&S,ct=wm(l),_t=ct.length,zt=wm(h),kt=zt.length;if(_t!=kt&&!nt)return!1;for(var Yt=_t;Yt--;){var pe=ct[Yt];if(!(nt?pe in h:sn.call(h,pe)))return!1}var Se=Y.get(l),De=Y.get(h);if(Se&&De)return Se==h&&De==l;var Qe=!0;Y.set(l,h),Y.set(h,l);for(var Fe=nt;++Yt<_t;){pe=ct[Yt];var Fn=l[pe],$n=h[pe];if(T)var cs=nt?T($n,Fn,pe,h,l,Y):T(Fn,$n,pe,l,h,Y);if(!(cs===n?Fn===$n||O(Fn,$n,y,T,Y):cs)){Qe=!1;break}Fe||(Fe=pe=="constructor")}if(Qe&&!Fe){var Eo=l.constructor,fs=h.constructor;Eo!=fs&&"constructor"in l&&"constructor"in h&&!(typeof Eo=="function"&&Eo instanceof Eo&&typeof fs=="function"&&fs instanceof fs)&&(Qe=!1)}return Y.delete(l),Y.delete(h),Qe}function Za(l){return Im(Dx(l,n,Vx),l+"")}function wm(l){return Z1(l,Fi,Am)}function Sm(l){return Z1(l,Vo,Ix)}var Mm=ma?function(l){return ma.get(l)}:Hm;function ip(l){for(var h=l.name+"",y=ss[h],T=sn.call(ss,h)?y.length:0;T--;){var O=y[T],Y=O.func;if(Y==null||Y==l)return O.name}return h}function ic(l){var h=sn.call(U,"placeholder")?U:l;return h.placeholder}function Ne(){var l=U.iteratee||km;return l=l===km?j1:l,arguments.length?l(arguments[0],arguments[1]):l}function op(l,h){var y=l.__data__;return oO(h)?y[typeof h=="string"?"string":"hash"]:y.map}function bm(l){for(var h=Fi(l),y=h.length;y--;){var T=h[y],O=l[T];h[y]=[T,O,Nx(O)]}return h}function vl(l,h){var y=Vr(l,h);return J1(y)?y:n}function j2(l){var h=sn.call(l,Tr),y=l[Tr];try{l[Tr]=n;var T=!0}catch(Y){}var O=Rr.call(l);return T&&(h?l[Tr]=y:delete l[Tr]),O}var Am=Wa?function(l){return l==null?[]:(l=cr(l),Yi(Wa(l),function(h){return zo.call(l,h)}))}:Vm,Ix=Wa?function(l){for(var h=[];l;)Ge(h,Am(l)),l=bs(l);return h}:Vm,oo=_o;(vo&&oo(new vo(new ArrayBuffer(1)))!=Ht||As&&oo(new As)!=ft||da&&oo(da.resolve())!=fe||ga&&oo(new ga)!=Wt||Ts&&oo(new Ts)!=Pt)&&(oo=function(l){var h=_o(l),y=h==ge?l.constructor:n,T=y?_l(y):"";if(T)switch(T){case ya:return Ht;case Re:return ft;case ks:return fe;case Mu:return Wt;case va:return Pt}return h});function Q2(l,h,y){for(var T=-1,O=y.length;++T<O;){var Y=y[T],nt=Y.size;switch(Y.type){case"drop":l+=nt;break;case"dropRight":h-=nt;break;case"take":h=vr(h,l+nt);break;case"takeRight":l=ni(l,h-nt);break}}return{start:l,end:h}}function tO(l){var h=l.match(Kr);return h?h[1].split(nr):[]}function Rx(l,h,y){h=Cu(h,l);for(var T=-1,O=h.length,Y=!1;++T<O;){var nt=wa(h[T]);if(!(Y=l!=null&&y(l,nt)))break;l=l[nt]}return Y||++T!=O?Y:(O=l==null?0:l.length,!!O&&hp(O)&&Ka(nt,O)&&(Ve(l)||xl(l)))}function eO(l){var h=l.length,y=new l.constructor(h);return h&&typeof l[0]=="string"&&sn.call(l,"index")&&(y.index=l.index,y.input=l.input),y}function Lx(l){return typeof l.constructor=="function"&&!Ff(l)?Xa(bs(l)):{}}function nO(l,h,y){var T=l.constructor;switch(h){case dt:return _m(l);case jt:case ce:return new T(+l);case Ht:return z2(l,y);case Ce:case Vt:case Zt:case ne:case rt:case P:case N:case k:case $:return dx(l,y);case ft:return new T;case We:case Me:return new T(l);case be:return G2(l);case Wt:return new T;case tt:return k2(l)}}function rO(l,h){var y=h.length;if(!y)return l;var T=y-1;return h[T]=(y>1?"& ":"")+h[T],h=h.join(y>2?", ":" "),l.replace(wr,`{
8
8
  /* [wrapped with `+h+`] */
9
- `)}function iO(l){return Ve(l)||xl(l)||!!(Tf&&l&&l[Tf])}function Ka(l,h){var y=typeof l;return h=h==null?Mt:h,!!h&&(y=="number"||y!="symbol"&&It.test(l))&&l>-1&&l%1==0&&l<h}function xo(l,h,y){if(!Gr(y))return!1;var T=typeof h;return(T=="number"?Ho(y)&&Ka(h,y.length):T=="string"&&h in y)?Vs(y[h],l):!1}function Tm(l,h){if(Ve(l))return!1;var y=typeof l;return y=="number"||y=="symbol"||y=="boolean"||l==null||ls(l)?!0:me.test(l)||!Jt.test(l)||h!=null&&l in cr(h)}function oO(l){var h=typeof l;return h=="string"||h=="number"||h=="symbol"||h=="boolean"?l!=="__proto__":l===null}function Cm(l){var h=ip(l),y=U[h];if(typeof y!="function"||!(h in i.prototype))return!1;if(l===y)return!0;var T=Mm(y);return!!T&&l===T[0]}function sO(l){return!!Ql&&Ql in l}var aO=wu?Ja:Wm;function Ff(l){var h=l&&l.constructor,y=typeof h=="function"&&h.prototype||ei;return l===y}function Nx(l){return l===l&&!Gr(l)}function Ox(l,h){return function(y){return y==null?!1:y[l]===h&&(h!==n||l in cr(y))}}function uO(l){var h=cp(l,function(T){return y.size===f&&y.clear(),T}),y=h.cache;return h}function lO(l,h){var y=l[1],T=h[1],O=y|T,Y=O<(C|R|V),nt=T==V&&y==E||T==V&&y==X&&l[7].length<=h[8]||T==(V|X)&&h[7].length<=h[8]&&y==E;if(!(Y||nt))return l;T&C&&(l[2]=h[2],O|=y&C?0:x);var ct=h[3];if(ct){var _t=l[3];l[3]=_t?mx(_t,ct,h[4]):ct,l[4]=_t?zs(l[3],g):h[4]}return ct=h[5],ct&&(_t=l[5],l[5]=_t?yx(_t,ct,h[6]):ct,l[6]=_t?zs(l[5],g):h[6]),ct=h[7],ct&&(l[7]=ct),T&V&&(l[8]=l[8]==null?h[8]:vr(l[8],h[8])),l[9]==null&&(l[9]=h[9]),l[0]=h[0],l[1]=O,l}function cO(l){var h=[];if(l!=null)for(var y in cr(l))h.push(y);return h}function fO(l){return Rr.call(l)}function Dx(l,h,y){return h=ni(h===n?l.length-1:h,0),function(){for(var T=arguments,O=-1,Y=ni(T.length-h,0),nt=Ct(Y);++O<Y;)nt[O]=T[h+O];O=-1;for(var ct=Ct(h+1);++O<h;)ct[O]=T[O];return ct[h]=y(nt),ie(l,this,ct)}}function Fx(l,h){return h.length<2?l:yl(l,Ps(h,0,-1))}function hO(l,h){for(var y=l.length,T=vr(h.length,y),O=qo(l);T--;){var Y=h[T];l[T]=Ka(Y,y)?O[Y]:n}return l}function Pm(l,h){if(!(h==="constructor"&&typeof l[h]=="function")&&h!="__proto__")return l[h]}var Ux=zx(sx),Uf=Gs||function(l,h){return Ur.setTimeout(l,h)},Im=zx(D2);function Bx(l,h,y){var T=h+"";return Im(l,rO(T,pO(tO(T),y)))}function zx(l){var h=0,y=0;return function(){var T=Wh(),O=j-(T-y);if(y=T,O>0){if(++h>=B)return arguments[0]}else h=0;return l.apply(n,arguments)}}function sp(l,h){var y=-1,T=l.length,O=T-1;for(h=h===n?T:h;++y<h;){var Y=hm(y,O),nt=l[Y];l[Y]=l[y],l[y]=nt}return l.length=h,l}var Gx=uO(function(l){var h=[];return l.charCodeAt(0)===46&&h.push(""),l.replace(ve,function(y,T,O,Y){h.push(O?Y.replace(pr,"$1"):T||y)}),h});function wa(l){if(typeof l=="string"||ls(l))return l;var h=l+"";return h=="0"&&1/l==-At?"-0":h}function _l(l){if(l!=null){try{return Ss.call(l)}catch(h){}try{return l+""}catch(h){}}return""}function pO(l,h){return Pi(Gt,function(y){var T="_."+y[0];h&y[1]&&!la(l,T)&&l.push(T)}),l.sort()}function kx(l){if(l instanceof i)return l.clone();var h=new r(l.__wrapped__,l.__chain__);return h.__actions__=qo(l.__actions__),h.__index__=l.__index__,h.__values__=l.__values__,h}function dO(l,h,y){(y?xo(l,h,y):h===n)?h=1:h=ni(Ke(h),0);var T=l==null?0:l.length;if(!T||h<1)return[];for(var O=0,Y=0,nt=Ct(Cr(T/h));O<T;)nt[Y++]=Ps(l,O,O+=h);return nt}function gO(l){for(var h=-1,y=l==null?0:l.length,T=0,O=[];++h<y;){var Y=l[h];Y&&(O[T++]=Y)}return O}function mO(){var l=arguments.length;if(!l)return[];for(var h=Ct(l-1),y=arguments[0],T=l;T--;)h[T-1]=arguments[T];return Ge(Ve(y)?qo(y):[y],ji(h,1))}var yO=an(function(l,h){return ri(l)?Rf(l,ji(h,1,ri,!0)):[]}),vO=an(function(l,h){var y=Is(h);return ri(y)&&(y=n),ri(l)?Rf(l,ji(h,1,ri,!0),Ne(y,2)):[]}),_O=an(function(l,h){var y=Is(h);return ri(y)&&(y=n),ri(l)?Rf(l,ji(h,1,ri,!0),n,y):[]});function xO(l,h,y){var T=l==null?0:l.length;return T?(h=y||h===n?1:Ke(h),Ps(l,h<0?0:h,T)):[]}function EO(l,h,y){var T=l==null?0:l.length;return T?(h=y||h===n?1:Ke(h),h=T-h,Ps(l,0,h<0?0:h)):[]}function wO(l,h){return l&&l.length?jh(l,Ne(h,3),!0,!0):[]}function SO(l,h){return l&&l.length?jh(l,Ne(h,3),!0):[]}function MO(l,h,y,T){var O=l==null?0:l.length;return O?(y&&typeof y!="number"&&xo(l,h,y)&&(y=0,T=O),m2(l,h,y,T)):[]}function qx(l,h,y){var T=l==null?0:l.length;if(!T)return-1;var O=y==null?0:Ke(y);return O<0&&(O=ni(T+O,0)),Kn(l,Ne(h,3),O)}function Hx(l,h,y){var T=l==null?0:l.length;if(!T)return-1;var O=T-1;return y!==n&&(O=Ke(y),O=y<0?ni(T+O,0):vr(O,T-1)),Kn(l,Ne(h,3),O,!0)}function Vx(l){var h=l==null?0:l.length;return h?ji(l,1):[]}function bO(l){var h=l==null?0:l.length;return h?ji(l,At):[]}function AO(l,h){var y=l==null?0:l.length;return y?(h=h===n?1:Ke(h),ji(l,h)):[]}function TO(l){for(var h=-1,y=l==null?0:l.length,T={};++h<y;){var O=l[h];T[O[0]]=O[1]}return T}function Wx(l){return l&&l.length?l[0]:n}function CO(l,h,y){var T=l==null?0:l.length;if(!T)return-1;var O=y==null?0:Ke(y);return O<0&&(O=ni(T+O,0)),xs(l,h,O)}function PO(l){var h=l==null?0:l.length;return h?Ps(l,0,-1):[]}var IO=an(function(l){var h=Mr(l,ym);return h.length&&h[0]===l[0]?am(h):[]}),RO=an(function(l){var h=Is(l),y=Mr(l,ym);return h===Is(y)?h=n:y.pop(),y.length&&y[0]===l[0]?am(y,Ne(h,2)):[]}),LO=an(function(l){var h=Is(l),y=Mr(l,ym);return h=typeof h=="function"?h:n,h&&y.pop(),y.length&&y[0]===l[0]?am(y,n,h):[]});function NO(l,h){return l==null?"":ec.call(l,h)}function Is(l){var h=l==null?0:l.length;return h?l[h-1]:n}function OO(l,h,y){var T=l==null?0:l.length;if(!T)return-1;var O=T;return y!==n&&(O=Ke(y),O=O<0?ni(T+O,0):vr(O,T-1)),h===h?xu(l,h,O):Kn(l,fa,O,!0)}function DO(l,h){return l&&l.length?nx(l,Ke(h)):n}var FO=an(Xx);function Xx(l,h){return l&&l.length&&h&&h.length?fm(l,h):l}function UO(l,h,y){return l&&l.length&&h&&h.length?fm(l,h,Ne(y,2)):l}function BO(l,h,y){return l&&l.length&&h&&h.length?fm(l,h,n,y):l}var zO=Za(function(l,h){var y=l==null?0:l.length,T=rm(l,h);return ox(l,Mr(h,function(O){return Ka(O,y)?+O:O}).sort(gx)),T});function GO(l,h){var y=[];if(!(l&&l.length))return y;var T=-1,O=[],Y=l.length;for(h=Ne(h,3);++T<Y;){var nt=l[T];h(nt,T,l)&&(y.push(nt),O.push(T))}return ox(l,O),y}function Rm(l){return l==null?l:em.call(l)}function kO(l,h,y){var T=l==null?0:l.length;return T?(y&&typeof y!="number"&&xo(l,h,y)?(h=0,y=T):(h=h==null?0:Ke(h),y=y===n?T:Ke(y)),Ps(l,h,y)):[]}function qO(l,h){return Jh(l,h)}function HO(l,h,y){return dm(l,h,Ne(y,2))}function VO(l,h){var y=l==null?0:l.length;if(y){var T=Jh(l,h);if(T<y&&Vs(l[T],h))return T}return-1}function WO(l,h){return Jh(l,h,!0)}function XO(l,h,y){return dm(l,h,Ne(y,2),!0)}function YO(l,h){var y=l==null?0:l.length;if(y){var T=Jh(l,h,!0)-1;if(Vs(l[T],h))return T}return-1}function $O(l){return l&&l.length?ax(l):[]}function ZO(l,h){return l&&l.length?ax(l,Ne(h,2)):[]}function KO(l){var h=l==null?0:l.length;return h?Ps(l,1,h):[]}function JO(l,h,y){return l&&l.length?(h=y||h===n?1:Ke(h),Ps(l,0,h<0?0:h)):[]}function jO(l,h,y){var T=l==null?0:l.length;return T?(h=y||h===n?1:Ke(h),h=T-h,Ps(l,h<0?0:h,T)):[]}function QO(l,h){return l&&l.length?jh(l,Ne(h,3),!1,!0):[]}function tD(l,h){return l&&l.length?jh(l,Ne(h,3)):[]}var eD=an(function(l){return Tu(ji(l,1,ri,!0))}),nD=an(function(l){var h=Is(l);return ri(h)&&(h=n),Tu(ji(l,1,ri,!0),Ne(h,2))}),rD=an(function(l){var h=Is(l);return h=typeof h=="function"?h:n,Tu(ji(l,1,ri,!0),n,h)});function iD(l){return l&&l.length?Tu(l):[]}function oD(l,h){return l&&l.length?Tu(l,Ne(h,2)):[]}function sD(l,h){return h=typeof h=="function"?h:n,l&&l.length?Tu(l,n,h):[]}function Lm(l){if(!(l&&l.length))return[];var h=0;return l=Yi(l,function(y){if(ri(y))return h=ni(y.length,h),!0}),di(h,function(y){return Mr(l,Es(y))})}function Yx(l,h){if(!(l&&l.length))return[];var y=Lm(l);return h==null?y:Mr(y,function(T){return ie(h,n,T)})}var aD=an(function(l,h){return ri(l)?Rf(l,h):[]}),uD=an(function(l){return mm(Yi(l,ri))}),lD=an(function(l){var h=Is(l);return ri(h)&&(h=n),mm(Yi(l,ri),Ne(h,2))}),cD=an(function(l){var h=Is(l);return h=typeof h=="function"?h:n,mm(Yi(l,ri),n,h)}),fD=an(Lm);function hD(l,h){return fx(l||[],h||[],If)}function pD(l,h){return fx(l||[],h||[],Of)}var dD=an(function(l){var h=l.length,y=h>1?l[h-1]:n;return y=typeof y=="function"?(l.pop(),y):n,Yx(l,y)});function $x(l){var h=U(l);return h.__chain__=!0,h}function gD(l,h){return h(l),l}function ap(l,h){return h(l)}var mD=Za(function(l){var h=l.length,y=h?l[0]:0,T=this.__wrapped__,O=function(Y){return rm(Y,l)};return h>1||this.__actions__.length||!(T instanceof i)||!Ka(y)?this.thru(O):(T=T.slice(y,+y+(h?1:0)),T.__actions__.push({func:ap,args:[O],thisArg:n}),new r(T,this.__chain__).thru(function(Y){return h&&!Y.length&&Y.push(n),Y}))});function yD(){return $x(this)}function vD(){return new r(this.value(),this.__chain__)}function _D(){this.__values__===n&&(this.__values__=uE(this.value()));var l=this.__index__>=this.__values__.length,h=l?n:this.__values__[this.__index__++];return{done:l,value:h}}function xD(){return this}function ED(l){for(var h,y=this;y instanceof _a;){var T=kx(y);T.__index__=0,T.__values__=n,h?O.__wrapped__=T:h=T;var O=T;y=y.__wrapped__}return O.__wrapped__=l,h}function wD(){var l=this.__wrapped__;if(l instanceof i){var h=l;return this.__actions__.length&&(h=new i(this)),h=h.reverse(),h.__actions__.push({func:ap,args:[Rm],thisArg:n}),new r(h,this.__chain__)}return this.thru(Rm)}function SD(){return cx(this.__wrapped__,this.__actions__)}var MD=Qh(function(l,h,y){sn.call(l,y)?++l[y]:Ya(l,y,1)});function bD(l,h,y){var T=Ve(l)?po:g2;return y&&xo(l,h,y)&&(h=n),T(l,Ne(h,3))}function AD(l,h){var y=Ve(l)?Yi:Y1;return y(l,Ne(h,3))}var TD=Ex(qx),CD=Ex(Hx);function PD(l,h){return ji(up(l,h),1)}function ID(l,h){return ji(up(l,h),At)}function RD(l,h,y){return y=y===n?1:Ke(y),ji(up(l,h),y)}function Zx(l,h){var y=Ve(l)?Pi:Au;return y(l,Ne(h,3))}function Kx(l,h){var y=Ve(l)?Ii:X1;return y(l,Ne(h,3))}var LD=Qh(function(l,h,y){sn.call(l,y)?l[y].push(h):Ya(l,y,[h])});function ND(l,h,y,T){l=Ho(l)?l:sc(l),y=y&&!T?Ke(y):0;var O=l.length;return y<0&&(y=ni(O+y,0)),pp(l)?y<=O&&l.indexOf(h,y)>-1:!!O&&xs(l,h,y)>-1}var OD=an(function(l,h,y){var T=-1,O=typeof h=="function",Y=Ho(l)?Ct(l.length):[];return Au(l,function(nt){Y[++T]=O?ie(h,nt,y):Lf(nt,h,y)}),Y}),DD=Qh(function(l,h,y){Ya(l,y,h)});function up(l,h){var y=Ve(l)?Mr:Q1;return y(l,Ne(h,3))}function FD(l,h,y,T){return l==null?[]:(Ve(h)||(h=h==null?[]:[h]),y=T?n:y,Ve(y)||(y=y==null?[]:[y]),rx(l,h,y))}var UD=Qh(function(l,h,y){l[y?0:1].push(h)},function(){return[[],[]]});function BD(l,h,y){var T=Ve(l)?Oo:Zi,O=arguments.length<3;return T(l,Ne(h,4),y,O,Au)}function zD(l,h,y){var T=Ve(l)?yr:Zi,O=arguments.length<3;return T(l,Ne(h,4),y,O,X1)}function GD(l,h){var y=Ve(l)?Yi:Y1;return y(l,fp(Ne(h,3)))}function kD(l){var h=Ve(l)?q1:N2;return h(l)}function qD(l,h,y){(y?xo(l,h,y):h===n)?h=1:h=Ke(h);var T=Ve(l)?c2:O2;return T(l,h)}function HD(l){var h=Ve(l)?f2:F2;return h(l)}function VD(l){if(l==null)return 0;if(Ho(l))return pp(l)?qa(l):l.length;var h=oo(l);return h==ft||h==Wt?l.size:lm(l).length}function WD(l,h,y){var T=Ve(l)?Ga:U2;return y&&xo(l,h,y)&&(h=n),T(l,Ne(h,3))}var XD=an(function(l,h){if(l==null)return[];var y=h.length;return y>1&&xo(l,h[0],h[1])?h=[]:y>2&&xo(h[0],h[1],h[2])&&(h=[h[0]]),rx(l,ji(h,1),[])}),lp=Va||function(){return Ur.Date.now()};function YD(l,h){if(typeof h!="function")throw new tr(s);return l=Ke(l),function(){if(--l<1)return h.apply(this,arguments)}}function Jx(l,h,y){return h=y?n:h,h=l&&h==null?l.length:h,$a(l,V,n,n,n,n,h)}function jx(l,h){var y;if(typeof h!="function")throw new tr(s);return l=Ke(l),function(){return--l>0&&(y=h.apply(this,arguments)),l<=1&&(h=n),y}}var Nm=an(function(l,h,y){var T=C;if(y.length){var O=zs(y,ic(Nm));T|=A}return $a(l,T,h,y,O)}),Qx=an(function(l,h,y){var T=C|R;if(y.length){var O=zs(y,ic(Qx));T|=A}return $a(h,T,l,y,O)});function tE(l,h,y){h=y?n:h;var T=$a(l,E,n,n,n,n,n,h);return T.placeholder=tE.placeholder,T}function eE(l,h,y){h=y?n:h;var T=$a(l,I,n,n,n,n,n,h);return T.placeholder=eE.placeholder,T}function nE(l,h,y){var T,O,Y,nt,ct,_t,zt=0,kt=!1,Yt=!1,pe=!0;if(typeof l!="function")throw new tr(s);h=Rs(h)||0,Gr(y)&&(kt=!!y.leading,Yt="maxWait"in y,Y=Yt?ni(Rs(y.maxWait)||0,h):Y,pe="trailing"in y?!!y.trailing:pe);function Se(ii){var Ws=T,Qa=O;return T=O=n,zt=ii,nt=l.apply(Qa,Ws),nt}function De(ii){return zt=ii,ct=Uf(Fn,h),kt?Se(ii):nt}function Qe(ii){var Ws=ii-_t,Qa=ii-zt,EE=h-Ws;return Yt?vr(EE,Y-Qa):EE}function Fe(ii){var Ws=ii-_t,Qa=ii-zt;return _t===n||Ws>=h||Ws<0||Yt&&Qa>=Y}function Fn(){var ii=lp();if(Fe(ii))return $n(ii);ct=Uf(Fn,Qe(ii))}function $n(ii){return ct=n,pe&&T?Se(ii):(T=O=n,nt)}function cs(){ct!==n&&hx(ct),zt=0,T=_t=O=ct=n}function Eo(){return ct===n?nt:$n(lp())}function fs(){var ii=lp(),Ws=Fe(ii);if(T=arguments,O=this,_t=ii,Ws){if(ct===n)return De(_t);if(Yt)return hx(ct),ct=Uf(Fn,h),Se(_t)}return ct===n&&(ct=Uf(Fn,h)),nt}return fs.cancel=cs,fs.flush=Eo,fs}var $D=an(function(l,h){return W1(l,1,h)}),ZD=an(function(l,h,y){return W1(l,Rs(h)||0,y)});function KD(l){return $a(l,q)}function cp(l,h){if(typeof l!="function"||h!=null&&typeof h!="function")throw new tr(s);var y=function(){var T=arguments,O=h?h.apply(this,T):T[0],Y=y.cache;if(Y.has(O))return Y.get(O);var nt=l.apply(this,T);return y.cache=Y.set(O,nt)||Y,nt};return y.cache=new(cp.Cache||Jn),y}cp.Cache=Jn;function fp(l){if(typeof l!="function")throw new tr(s);return function(){var h=arguments;switch(h.length){case 0:return!l.call(this);case 1:return!l.call(this,h[0]);case 2:return!l.call(this,h[0],h[1]);case 3:return!l.call(this,h[0],h[1],h[2])}return!l.apply(this,h)}}function JD(l){return jx(2,l)}var jD=B2(function(l,h){h=h.length==1&&Ve(h[0])?Mr(h[0],io(Ne())):Mr(ji(h,1),io(Ne()));var y=h.length;return an(function(T){for(var O=-1,Y=vr(T.length,y);++O<Y;)T[O]=h[O].call(this,T[O]);return ie(l,this,T)})}),Om=an(function(l,h){var y=zs(h,ic(Om));return $a(l,A,n,h,y)}),rE=an(function(l,h){var y=zs(h,ic(rE));return $a(l,F,n,h,y)}),QD=Za(function(l,h){return $a(l,X,n,n,n,h)});function t3(l,h){if(typeof l!="function")throw new tr(s);return h=h===n?h:Ke(h),an(l,h)}function e3(l,h){if(typeof l!="function")throw new tr(s);return h=h==null?0:ni(Ke(h),0),an(function(y){var T=y[h],O=Pu(y,0,h);return T&&Ge(O,T),ie(l,this,O)})}function n3(l,h,y){var T=!0,O=!0;if(typeof l!="function")throw new tr(s);return Gr(y)&&(T="leading"in y?!!y.leading:T,O="trailing"in y?!!y.trailing:O),nE(l,h,{leading:T,maxWait:h,trailing:O})}function r3(l){return Jx(l,1)}function i3(l,h){return Om(vm(h),l)}function o3(){if(!arguments.length)return[];var l=arguments[0];return Ve(l)?l:[l]}function s3(l){return Cs(l,w)}function a3(l,h){return h=typeof h=="function"?h:n,Cs(l,w,h)}function u3(l){return Cs(l,m|w)}function l3(l,h){return h=typeof h=="function"?h:n,Cs(l,m|w,h)}function c3(l,h){return h==null||V1(l,h,Fi(h))}function Vs(l,h){return l===h||l!==l&&h!==h}var f3=rp(sm),h3=rp(function(l,h){return l>=h}),xl=K1(function(){return arguments}())?K1:function(l){return $r(l)&&sn.call(l,"callee")&&!zo.call(l,"callee")},Ve=Ct.isArray,p3=_s?io(_s):E2;function Ho(l){return l!=null&&hp(l.length)&&!Ja(l)}function ri(l){return $r(l)&&Ho(l)}function d3(l){return l===!0||l===!1||$r(l)&&_o(l)==jt}var Iu=Oi||Wm,g3=Qr?io(Qr):w2;function m3(l){return $r(l)&&l.nodeType===1&&!Bf(l)}function y3(l){if(l==null)return!0;if(Ho(l)&&(Ve(l)||typeof l=="string"||typeof l.splice=="function"||Iu(l)||oc(l)||xl(l)))return!l.length;var h=oo(l);if(h==ft||h==Wt)return!l.size;if(Ff(l))return!lm(l).length;for(var y in l)if(sn.call(l,y))return!1;return!0}function v3(l,h){return Nf(l,h)}function _3(l,h,y){y=typeof y=="function"?y:n;var T=y?y(l,h):n;return T===n?Nf(l,h,n,y):!!T}function Dm(l){if(!$r(l))return!1;var h=_o(l);return h==$t||h==te||typeof l.message=="string"&&typeof l.name=="string"&&!Bf(l)}function x3(l){return typeof l=="number"&&tc(l)}function Ja(l){if(!Gr(l))return!1;var h=_o(l);return h==qt||h==xe||h==Ut||h==Te}function iE(l){return typeof l=="number"&&l==Ke(l)}function hp(l){return typeof l=="number"&&l>-1&&l%1==0&&l<=Mt}function Gr(l){var h=typeof l;return l!=null&&(h=="object"||h=="function")}function $r(l){return l!=null&&typeof l=="object"}var oE=ua?io(ua):M2;function E3(l,h){return l===h||um(l,h,bm(h))}function w3(l,h,y){return y=typeof y=="function"?y:n,um(l,h,bm(h),y)}function S3(l){return sE(l)&&l!=+l}function M3(l){if(aO(l))throw new _e(o);return J1(l)}function b3(l){return l===null}function A3(l){return l==null}function sE(l){return typeof l=="number"||$r(l)&&_o(l)==We}function Bf(l){if(!$r(l)||_o(l)!=ge)return!1;var h=bs(l);if(h===null)return!0;var y=sn.call(h,"constructor")&&h.constructor;return typeof y=="function"&&y instanceof y&&Ss.call(y)==Af}var Fm=No?io(No):b2;function T3(l){return iE(l)&&l>=-Mt&&l<=Mt}var aE=vu?io(vu):A2;function pp(l){return typeof l=="string"||!Ve(l)&&$r(l)&&_o(l)==Me}function ls(l){return typeof l=="symbol"||$r(l)&&_o(l)==tt}var oc=mr?io(mr):T2;function C3(l){return l===n}function P3(l){return $r(l)&&oo(l)==Pt}function I3(l){return $r(l)&&_o(l)==Ot}var R3=rp(cm),L3=rp(function(l,h){return l<=h});function uE(l){if(!l)return[];if(Ho(l))return pp(l)?Fo(l):qo(l);if(Su&&l[Su])return ai(l[Su]());var h=oo(l),y=h==ft?ns:h==Wt?Wr:sc;return y(l)}function ja(l){if(!l)return l===0?l:0;if(l=Rs(l),l===At||l===-At){var h=l<0?-1:1;return h*Lt}return l===l?l:0}function Ke(l){var h=ja(l),y=h%1;return h===h?y?h-y:h:0}function lE(l){return l?ml(Ke(l),0,yt):0}function Rs(l){if(typeof l=="number")return l;if(ls(l))return pt;if(Gr(l)){var h=typeof l.valueOf=="function"?l.valueOf():l;l=Gr(h)?h+"":h}if(typeof l!="string")return l===0?l:+l;l=Hh(l);var y=oi.test(l);return y||mt.test(l)?ho(l.slice(2),y?2:8):bi.test(l)?pt:+l}function cE(l){return Ea(l,Vo(l))}function N3(l){return l?ml(Ke(l),-Mt,Mt):l===0?l:0}function hr(l){return l==null?"":us(l)}var O3=nc(function(l,h){if(Ff(h)||Ho(h)){Ea(h,Fi(h),l);return}for(var y in h)sn.call(h,y)&&If(l,y,h[y])}),fE=nc(function(l,h){Ea(h,Vo(h),l)}),dp=nc(function(l,h,y,T){Ea(h,Vo(h),l,T)}),D3=nc(function(l,h,y,T){Ea(h,Fi(h),l,T)}),F3=Za(rm);function U3(l,h){var y=Xa(l);return h==null?y:H1(y,h)}var B3=an(function(l,h){l=cr(l);var y=-1,T=h.length,O=T>2?h[2]:n;for(O&&xo(h[0],h[1],O)&&(T=1);++y<T;)for(var Y=h[y],nt=Vo(Y),ct=-1,_t=nt.length;++ct<_t;){var zt=nt[ct],kt=l[zt];(kt===n||Vs(kt,ei[zt])&&!sn.call(l,zt))&&(l[zt]=Y[zt])}return l}),z3=an(function(l){return l.push(n,Cx),ie(hE,n,l)});function G3(l,h){return ca(l,Ne(h,3),xa)}function k3(l,h){return ca(l,Ne(h,3),om)}function q3(l,h){return l==null?l:im(l,Ne(h,3),Vo)}function H3(l,h){return l==null?l:$1(l,Ne(h,3),Vo)}function V3(l,h){return l&&xa(l,Ne(h,3))}function W3(l,h){return l&&om(l,Ne(h,3))}function X3(l){return l==null?[]:Zh(l,Fi(l))}function Y3(l){return l==null?[]:Zh(l,Vo(l))}function Um(l,h,y){var T=l==null?n:yl(l,h);return T===n?y:T}function $3(l,h){return l!=null&&Rx(l,h,y2)}function Bm(l,h){return l!=null&&Rx(l,h,v2)}var Z3=Sx(function(l,h,y){h!=null&&typeof h.toString!="function"&&(h=Rr.call(h)),l[h]=y},Gm(Wo)),K3=Sx(function(l,h,y){h!=null&&typeof h.toString!="function"&&(h=Rr.call(h)),sn.call(l,h)?l[h].push(y):l[h]=[y]},Ne),J3=an(Lf);function Fi(l){return Ho(l)?k1(l):lm(l)}function Vo(l){return Ho(l)?k1(l,!0):C2(l)}function j3(l,h){var y={};return h=Ne(h,3),xa(l,function(T,O,Y){Ya(y,h(T,O,Y),T)}),y}function Q3(l,h){var y={};return h=Ne(h,3),xa(l,function(T,O,Y){Ya(y,O,h(T,O,Y))}),y}var tF=nc(function(l,h,y){Kh(l,h,y)}),hE=nc(function(l,h,y,T){Kh(l,h,y,T)}),eF=Za(function(l,h){var y={};if(l==null)return y;var T=!1;h=Mr(h,function(Y){return Y=Cu(Y,l),T||(T=Y.length>1),Y}),Ea(l,Sm(l),y),T&&(y=Cs(y,m|v|w,Z2));for(var O=h.length;O--;)gm(y,h[O]);return y});function nF(l,h){return pE(l,fp(Ne(h)))}var rF=Za(function(l,h){return l==null?{}:I2(l,h)});function pE(l,h){if(l==null)return{};var y=Mr(Sm(l),function(T){return[T]});return h=Ne(h),ix(l,y,function(T,O){return h(T,O[0])})}function iF(l,h,y){h=Cu(h,l);var T=-1,O=h.length;for(O||(O=1,l=n);++T<O;){var Y=l==null?n:l[wa(h[T])];Y===n&&(T=O,Y=y),l=Ja(Y)?Y.call(l):Y}return l}function oF(l,h,y){return l==null?l:Of(l,h,y)}function sF(l,h,y,T){return T=typeof T=="function"?T:n,l==null?l:Of(l,h,y,T)}var dE=Ax(Fi),gE=Ax(Vo);function aF(l,h,y){var T=Ve(l),O=T||Iu(l)||oc(l);if(h=Ne(h,4),y==null){var Y=l&&l.constructor;O?y=T?new Y:[]:Gr(l)?y=Ja(Y)?Xa(bs(l)):{}:y={}}return(O?Pi:xa)(l,function(nt,ct,_t){return h(y,nt,ct,_t)}),y}function uF(l,h){return l==null?!0:gm(l,h)}function lF(l,h,y){return l==null?l:lx(l,h,vm(y))}function cF(l,h,y,T){return T=typeof T=="function"?T:n,l==null?l:lx(l,h,vm(y),T)}function sc(l){return l==null?[]:ts(l,Fi(l))}function fF(l){return l==null?[]:ts(l,Vo(l))}function hF(l,h,y){return y===n&&(y=h,h=n),y!==n&&(y=Rs(y),y=y===y?y:0),h!==n&&(h=Rs(h),h=h===h?h:0),ml(Rs(l),h,y)}function pF(l,h,y){return h=ja(h),y===n?(y=h,h=0):y=ja(y),l=Rs(l),_2(l,h,y)}function dF(l,h,y){if(y&&typeof y!="boolean"&&xo(l,h,y)&&(h=y=n),y===n&&(typeof h=="boolean"?(y=h,h=n):typeof l=="boolean"&&(y=l,l=n)),l===n&&h===n?(l=0,h=1):(l=ja(l),h===n?(h=l,l=0):h=ja(h)),l>h){var T=l;l=h,h=T}if(y||l%1||h%1){var O=Xh();return vr(l+O*(h-l+Gh("1e-"+((O+"").length-1))),h)}return hm(l,h)}var gF=rc(function(l,h,y){return h=h.toLowerCase(),l+(y?mE(h):h)});function mE(l){return zm(hr(l).toLowerCase())}function yE(l){return l=hr(l),l&&l.replace(St,es).replace(Yn,"")}function mF(l,h,y){l=hr(l),h=us(h);var T=l.length;y=y===n?T:ml(Ke(y),0,T);var O=y;return y-=h.length,y>=0&&l.slice(y,O)==h}function yF(l){return l=hr(l),l&&ot.test(l)?l.replace(Et,ha):l}function vF(l){return l=hr(l),l&&Ue.test(l)?l.replace(qe,"\\$&"):l}var _F=rc(function(l,h,y){return l+(y?"-":"")+h.toLowerCase()}),xF=rc(function(l,h,y){return l+(y?" ":"")+h.toLowerCase()}),EF=xx("toLowerCase");function wF(l,h,y){l=hr(l),h=Ke(h);var T=h?qa(l):0;if(!h||T>=h)return l;var O=(h-T)/2;return np(zr(O),y)+l+np(Cr(O),y)}function SF(l,h,y){l=hr(l),h=Ke(h);var T=h?qa(l):0;return h&&T<h?l+np(h-T,y):l}function MF(l,h,y){l=hr(l),h=Ke(h);var T=h?qa(l):0;return h&&T<h?np(h-T,y)+l:l}function bF(l,h,y){return y||h==null?h=0:h&&(h=+h),dl(hr(l).replace(Xe,""),h||0)}function AF(l,h,y){return(y?xo(l,h,y):h===n)?h=1:h=Ke(h),pm(hr(l),h)}function TF(){var l=arguments,h=hr(l[0]);return l.length<3?h:h.replace(l[1],l[2])}var CF=rc(function(l,h,y){return l+(y?"_":"")+h.toLowerCase()});function PF(l,h,y){return y&&typeof y!="number"&&xo(l,h,y)&&(h=y=n),y=y===n?yt:y>>>0,y?(l=hr(l),l&&(typeof h=="string"||h!=null&&!Fm(h))&&(h=us(h),!h&&ka(l))?Pu(Fo(l),0,y):l.split(h,y)):[]}var IF=rc(function(l,h,y){return l+(y?" ":"")+zm(h)});function RF(l,h,y){return l=hr(l),y=y==null?0:ml(Ke(y),0,l.length),h=us(h),l.slice(y,y+h.length)==h}function LF(l,h,y){var T=U.templateSettings;y&&xo(l,h,y)&&(h=n),l=hr(l),h=dp({},h,T,Tx);var O=dp({},h.imports,T.imports,Tx),Y=Fi(O),nt=ts(O,Y),ct,_t,zt=0,kt=h.interpolate||vt,Yt="__p += '",pe=os((h.escape||vt).source+"|"+kt.source+"|"+(kt===Ft?ur:vt).source+"|"+(h.evaluate||vt).source+"|$","g"),Se="//# sourceURL="+(sn.call(h,"sourceURL")?(h.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Ci+"]")+`
9
+ `)}function iO(l){return Ve(l)||xl(l)||!!(Tf&&l&&l[Tf])}function Ka(l,h){var y=typeof l;return h=h==null?Mt:h,!!h&&(y=="number"||y!="symbol"&&It.test(l))&&l>-1&&l%1==0&&l<h}function xo(l,h,y){if(!Gr(y))return!1;var T=typeof h;return(T=="number"?Ho(y)&&Ka(h,y.length):T=="string"&&h in y)?Vs(y[h],l):!1}function Tm(l,h){if(Ve(l))return!1;var y=typeof l;return y=="number"||y=="symbol"||y=="boolean"||l==null||ls(l)?!0:me.test(l)||!Jt.test(l)||h!=null&&l in cr(h)}function oO(l){var h=typeof l;return h=="string"||h=="number"||h=="symbol"||h=="boolean"?l!=="__proto__":l===null}function Cm(l){var h=ip(l),y=U[h];if(typeof y!="function"||!(h in i.prototype))return!1;if(l===y)return!0;var T=Mm(y);return!!T&&l===T[0]}function sO(l){return!!Ql&&Ql in l}var aO=wu?Ja:Wm;function Ff(l){var h=l&&l.constructor,y=typeof h=="function"&&h.prototype||ei;return l===y}function Nx(l){return l===l&&!Gr(l)}function Ox(l,h){return function(y){return y==null?!1:y[l]===h&&(h!==n||l in cr(y))}}function uO(l){var h=cp(l,function(T){return y.size===f&&y.clear(),T}),y=h.cache;return h}function lO(l,h){var y=l[1],T=h[1],O=y|T,Y=O<(C|R|V),nt=T==V&&y==E||T==V&&y==X&&l[7].length<=h[8]||T==(V|X)&&h[7].length<=h[8]&&y==E;if(!(Y||nt))return l;T&C&&(l[2]=h[2],O|=y&C?0:x);var ct=h[3];if(ct){var _t=l[3];l[3]=_t?mx(_t,ct,h[4]):ct,l[4]=_t?zs(l[3],g):h[4]}return ct=h[5],ct&&(_t=l[5],l[5]=_t?yx(_t,ct,h[6]):ct,l[6]=_t?zs(l[5],g):h[6]),ct=h[7],ct&&(l[7]=ct),T&V&&(l[8]=l[8]==null?h[8]:vr(l[8],h[8])),l[9]==null&&(l[9]=h[9]),l[0]=h[0],l[1]=O,l}function cO(l){var h=[];if(l!=null)for(var y in cr(l))h.push(y);return h}function fO(l){return Rr.call(l)}function Dx(l,h,y){return h=ni(h===n?l.length-1:h,0),function(){for(var T=arguments,O=-1,Y=ni(T.length-h,0),nt=Ct(Y);++O<Y;)nt[O]=T[h+O];O=-1;for(var ct=Ct(h+1);++O<h;)ct[O]=T[O];return ct[h]=y(nt),ie(l,this,ct)}}function Fx(l,h){return h.length<2?l:yl(l,Ps(h,0,-1))}function hO(l,h){for(var y=l.length,T=vr(h.length,y),O=qo(l);T--;){var Y=h[T];l[T]=Ka(Y,y)?O[Y]:n}return l}function Pm(l,h){if(!(h==="constructor"&&typeof l[h]=="function")&&h!="__proto__")return l[h]}var Ux=zx(sx),Uf=Gs||function(l,h){return Ur.setTimeout(l,h)},Im=zx(D2);function Bx(l,h,y){var T=h+"";return Im(l,rO(T,pO(tO(T),y)))}function zx(l){var h=0,y=0;return function(){var T=Wh(),O=j-(T-y);if(y=T,O>0){if(++h>=B)return arguments[0]}else h=0;return l.apply(n,arguments)}}function sp(l,h){var y=-1,T=l.length,O=T-1;for(h=h===n?T:h;++y<h;){var Y=hm(y,O),nt=l[Y];l[Y]=l[y],l[y]=nt}return l.length=h,l}var Gx=uO(function(l){var h=[];return l.charCodeAt(0)===46&&h.push(""),l.replace(ve,function(y,T,O,Y){h.push(O?Y.replace(pr,"$1"):T||y)}),h});function wa(l){if(typeof l=="string"||ls(l))return l;var h=l+"";return h=="0"&&1/l==-At?"-0":h}function _l(l){if(l!=null){try{return Ss.call(l)}catch(h){}try{return l+""}catch(h){}}return""}function pO(l,h){return Pi(Gt,function(y){var T="_."+y[0];h&y[1]&&!la(l,T)&&l.push(T)}),l.sort()}function kx(l){if(l instanceof i)return l.clone();var h=new r(l.__wrapped__,l.__chain__);return h.__actions__=qo(l.__actions__),h.__index__=l.__index__,h.__values__=l.__values__,h}function dO(l,h,y){(y?xo(l,h,y):h===n)?h=1:h=ni(Ze(h),0);var T=l==null?0:l.length;if(!T||h<1)return[];for(var O=0,Y=0,nt=Ct(Cr(T/h));O<T;)nt[Y++]=Ps(l,O,O+=h);return nt}function gO(l){for(var h=-1,y=l==null?0:l.length,T=0,O=[];++h<y;){var Y=l[h];Y&&(O[T++]=Y)}return O}function mO(){var l=arguments.length;if(!l)return[];for(var h=Ct(l-1),y=arguments[0],T=l;T--;)h[T-1]=arguments[T];return Ge(Ve(y)?qo(y):[y],ji(h,1))}var yO=an(function(l,h){return ri(l)?Rf(l,ji(h,1,ri,!0)):[]}),vO=an(function(l,h){var y=Is(h);return ri(y)&&(y=n),ri(l)?Rf(l,ji(h,1,ri,!0),Ne(y,2)):[]}),_O=an(function(l,h){var y=Is(h);return ri(y)&&(y=n),ri(l)?Rf(l,ji(h,1,ri,!0),n,y):[]});function xO(l,h,y){var T=l==null?0:l.length;return T?(h=y||h===n?1:Ze(h),Ps(l,h<0?0:h,T)):[]}function EO(l,h,y){var T=l==null?0:l.length;return T?(h=y||h===n?1:Ze(h),h=T-h,Ps(l,0,h<0?0:h)):[]}function wO(l,h){return l&&l.length?jh(l,Ne(h,3),!0,!0):[]}function SO(l,h){return l&&l.length?jh(l,Ne(h,3),!0):[]}function MO(l,h,y,T){var O=l==null?0:l.length;return O?(y&&typeof y!="number"&&xo(l,h,y)&&(y=0,T=O),m2(l,h,y,T)):[]}function qx(l,h,y){var T=l==null?0:l.length;if(!T)return-1;var O=y==null?0:Ze(y);return O<0&&(O=ni(T+O,0)),Kn(l,Ne(h,3),O)}function Hx(l,h,y){var T=l==null?0:l.length;if(!T)return-1;var O=T-1;return y!==n&&(O=Ze(y),O=y<0?ni(T+O,0):vr(O,T-1)),Kn(l,Ne(h,3),O,!0)}function Vx(l){var h=l==null?0:l.length;return h?ji(l,1):[]}function bO(l){var h=l==null?0:l.length;return h?ji(l,At):[]}function AO(l,h){var y=l==null?0:l.length;return y?(h=h===n?1:Ze(h),ji(l,h)):[]}function TO(l){for(var h=-1,y=l==null?0:l.length,T={};++h<y;){var O=l[h];T[O[0]]=O[1]}return T}function Wx(l){return l&&l.length?l[0]:n}function CO(l,h,y){var T=l==null?0:l.length;if(!T)return-1;var O=y==null?0:Ze(y);return O<0&&(O=ni(T+O,0)),xs(l,h,O)}function PO(l){var h=l==null?0:l.length;return h?Ps(l,0,-1):[]}var IO=an(function(l){var h=Mr(l,ym);return h.length&&h[0]===l[0]?am(h):[]}),RO=an(function(l){var h=Is(l),y=Mr(l,ym);return h===Is(y)?h=n:y.pop(),y.length&&y[0]===l[0]?am(y,Ne(h,2)):[]}),LO=an(function(l){var h=Is(l),y=Mr(l,ym);return h=typeof h=="function"?h:n,h&&y.pop(),y.length&&y[0]===l[0]?am(y,n,h):[]});function NO(l,h){return l==null?"":ec.call(l,h)}function Is(l){var h=l==null?0:l.length;return h?l[h-1]:n}function OO(l,h,y){var T=l==null?0:l.length;if(!T)return-1;var O=T;return y!==n&&(O=Ze(y),O=O<0?ni(T+O,0):vr(O,T-1)),h===h?xu(l,h,O):Kn(l,fa,O,!0)}function DO(l,h){return l&&l.length?nx(l,Ze(h)):n}var FO=an(Xx);function Xx(l,h){return l&&l.length&&h&&h.length?fm(l,h):l}function UO(l,h,y){return l&&l.length&&h&&h.length?fm(l,h,Ne(y,2)):l}function BO(l,h,y){return l&&l.length&&h&&h.length?fm(l,h,n,y):l}var zO=Za(function(l,h){var y=l==null?0:l.length,T=rm(l,h);return ox(l,Mr(h,function(O){return Ka(O,y)?+O:O}).sort(gx)),T});function GO(l,h){var y=[];if(!(l&&l.length))return y;var T=-1,O=[],Y=l.length;for(h=Ne(h,3);++T<Y;){var nt=l[T];h(nt,T,l)&&(y.push(nt),O.push(T))}return ox(l,O),y}function Rm(l){return l==null?l:em.call(l)}function kO(l,h,y){var T=l==null?0:l.length;return T?(y&&typeof y!="number"&&xo(l,h,y)?(h=0,y=T):(h=h==null?0:Ze(h),y=y===n?T:Ze(y)),Ps(l,h,y)):[]}function qO(l,h){return Jh(l,h)}function HO(l,h,y){return dm(l,h,Ne(y,2))}function VO(l,h){var y=l==null?0:l.length;if(y){var T=Jh(l,h);if(T<y&&Vs(l[T],h))return T}return-1}function WO(l,h){return Jh(l,h,!0)}function XO(l,h,y){return dm(l,h,Ne(y,2),!0)}function YO(l,h){var y=l==null?0:l.length;if(y){var T=Jh(l,h,!0)-1;if(Vs(l[T],h))return T}return-1}function $O(l){return l&&l.length?ax(l):[]}function ZO(l,h){return l&&l.length?ax(l,Ne(h,2)):[]}function KO(l){var h=l==null?0:l.length;return h?Ps(l,1,h):[]}function JO(l,h,y){return l&&l.length?(h=y||h===n?1:Ze(h),Ps(l,0,h<0?0:h)):[]}function jO(l,h,y){var T=l==null?0:l.length;return T?(h=y||h===n?1:Ze(h),h=T-h,Ps(l,h<0?0:h,T)):[]}function QO(l,h){return l&&l.length?jh(l,Ne(h,3),!1,!0):[]}function tD(l,h){return l&&l.length?jh(l,Ne(h,3)):[]}var eD=an(function(l){return Tu(ji(l,1,ri,!0))}),nD=an(function(l){var h=Is(l);return ri(h)&&(h=n),Tu(ji(l,1,ri,!0),Ne(h,2))}),rD=an(function(l){var h=Is(l);return h=typeof h=="function"?h:n,Tu(ji(l,1,ri,!0),n,h)});function iD(l){return l&&l.length?Tu(l):[]}function oD(l,h){return l&&l.length?Tu(l,Ne(h,2)):[]}function sD(l,h){return h=typeof h=="function"?h:n,l&&l.length?Tu(l,n,h):[]}function Lm(l){if(!(l&&l.length))return[];var h=0;return l=Yi(l,function(y){if(ri(y))return h=ni(y.length,h),!0}),di(h,function(y){return Mr(l,Es(y))})}function Yx(l,h){if(!(l&&l.length))return[];var y=Lm(l);return h==null?y:Mr(y,function(T){return ie(h,n,T)})}var aD=an(function(l,h){return ri(l)?Rf(l,h):[]}),uD=an(function(l){return mm(Yi(l,ri))}),lD=an(function(l){var h=Is(l);return ri(h)&&(h=n),mm(Yi(l,ri),Ne(h,2))}),cD=an(function(l){var h=Is(l);return h=typeof h=="function"?h:n,mm(Yi(l,ri),n,h)}),fD=an(Lm);function hD(l,h){return fx(l||[],h||[],If)}function pD(l,h){return fx(l||[],h||[],Of)}var dD=an(function(l){var h=l.length,y=h>1?l[h-1]:n;return y=typeof y=="function"?(l.pop(),y):n,Yx(l,y)});function $x(l){var h=U(l);return h.__chain__=!0,h}function gD(l,h){return h(l),l}function ap(l,h){return h(l)}var mD=Za(function(l){var h=l.length,y=h?l[0]:0,T=this.__wrapped__,O=function(Y){return rm(Y,l)};return h>1||this.__actions__.length||!(T instanceof i)||!Ka(y)?this.thru(O):(T=T.slice(y,+y+(h?1:0)),T.__actions__.push({func:ap,args:[O],thisArg:n}),new r(T,this.__chain__).thru(function(Y){return h&&!Y.length&&Y.push(n),Y}))});function yD(){return $x(this)}function vD(){return new r(this.value(),this.__chain__)}function _D(){this.__values__===n&&(this.__values__=uE(this.value()));var l=this.__index__>=this.__values__.length,h=l?n:this.__values__[this.__index__++];return{done:l,value:h}}function xD(){return this}function ED(l){for(var h,y=this;y instanceof _a;){var T=kx(y);T.__index__=0,T.__values__=n,h?O.__wrapped__=T:h=T;var O=T;y=y.__wrapped__}return O.__wrapped__=l,h}function wD(){var l=this.__wrapped__;if(l instanceof i){var h=l;return this.__actions__.length&&(h=new i(this)),h=h.reverse(),h.__actions__.push({func:ap,args:[Rm],thisArg:n}),new r(h,this.__chain__)}return this.thru(Rm)}function SD(){return cx(this.__wrapped__,this.__actions__)}var MD=Qh(function(l,h,y){sn.call(l,y)?++l[y]:Ya(l,y,1)});function bD(l,h,y){var T=Ve(l)?po:g2;return y&&xo(l,h,y)&&(h=n),T(l,Ne(h,3))}function AD(l,h){var y=Ve(l)?Yi:Y1;return y(l,Ne(h,3))}var TD=Ex(qx),CD=Ex(Hx);function PD(l,h){return ji(up(l,h),1)}function ID(l,h){return ji(up(l,h),At)}function RD(l,h,y){return y=y===n?1:Ze(y),ji(up(l,h),y)}function Zx(l,h){var y=Ve(l)?Pi:Au;return y(l,Ne(h,3))}function Kx(l,h){var y=Ve(l)?Ii:X1;return y(l,Ne(h,3))}var LD=Qh(function(l,h,y){sn.call(l,y)?l[y].push(h):Ya(l,y,[h])});function ND(l,h,y,T){l=Ho(l)?l:sc(l),y=y&&!T?Ze(y):0;var O=l.length;return y<0&&(y=ni(O+y,0)),pp(l)?y<=O&&l.indexOf(h,y)>-1:!!O&&xs(l,h,y)>-1}var OD=an(function(l,h,y){var T=-1,O=typeof h=="function",Y=Ho(l)?Ct(l.length):[];return Au(l,function(nt){Y[++T]=O?ie(h,nt,y):Lf(nt,h,y)}),Y}),DD=Qh(function(l,h,y){Ya(l,y,h)});function up(l,h){var y=Ve(l)?Mr:Q1;return y(l,Ne(h,3))}function FD(l,h,y,T){return l==null?[]:(Ve(h)||(h=h==null?[]:[h]),y=T?n:y,Ve(y)||(y=y==null?[]:[y]),rx(l,h,y))}var UD=Qh(function(l,h,y){l[y?0:1].push(h)},function(){return[[],[]]});function BD(l,h,y){var T=Ve(l)?Oo:Zi,O=arguments.length<3;return T(l,Ne(h,4),y,O,Au)}function zD(l,h,y){var T=Ve(l)?yr:Zi,O=arguments.length<3;return T(l,Ne(h,4),y,O,X1)}function GD(l,h){var y=Ve(l)?Yi:Y1;return y(l,fp(Ne(h,3)))}function kD(l){var h=Ve(l)?q1:N2;return h(l)}function qD(l,h,y){(y?xo(l,h,y):h===n)?h=1:h=Ze(h);var T=Ve(l)?c2:O2;return T(l,h)}function HD(l){var h=Ve(l)?f2:F2;return h(l)}function VD(l){if(l==null)return 0;if(Ho(l))return pp(l)?qa(l):l.length;var h=oo(l);return h==ft||h==Wt?l.size:lm(l).length}function WD(l,h,y){var T=Ve(l)?Ga:U2;return y&&xo(l,h,y)&&(h=n),T(l,Ne(h,3))}var XD=an(function(l,h){if(l==null)return[];var y=h.length;return y>1&&xo(l,h[0],h[1])?h=[]:y>2&&xo(h[0],h[1],h[2])&&(h=[h[0]]),rx(l,ji(h,1),[])}),lp=Va||function(){return Ur.Date.now()};function YD(l,h){if(typeof h!="function")throw new tr(s);return l=Ze(l),function(){if(--l<1)return h.apply(this,arguments)}}function Jx(l,h,y){return h=y?n:h,h=l&&h==null?l.length:h,$a(l,V,n,n,n,n,h)}function jx(l,h){var y;if(typeof h!="function")throw new tr(s);return l=Ze(l),function(){return--l>0&&(y=h.apply(this,arguments)),l<=1&&(h=n),y}}var Nm=an(function(l,h,y){var T=C;if(y.length){var O=zs(y,ic(Nm));T|=A}return $a(l,T,h,y,O)}),Qx=an(function(l,h,y){var T=C|R;if(y.length){var O=zs(y,ic(Qx));T|=A}return $a(h,T,l,y,O)});function tE(l,h,y){h=y?n:h;var T=$a(l,E,n,n,n,n,n,h);return T.placeholder=tE.placeholder,T}function eE(l,h,y){h=y?n:h;var T=$a(l,I,n,n,n,n,n,h);return T.placeholder=eE.placeholder,T}function nE(l,h,y){var T,O,Y,nt,ct,_t,zt=0,kt=!1,Yt=!1,pe=!0;if(typeof l!="function")throw new tr(s);h=Rs(h)||0,Gr(y)&&(kt=!!y.leading,Yt="maxWait"in y,Y=Yt?ni(Rs(y.maxWait)||0,h):Y,pe="trailing"in y?!!y.trailing:pe);function Se(ii){var Ws=T,Qa=O;return T=O=n,zt=ii,nt=l.apply(Qa,Ws),nt}function De(ii){return zt=ii,ct=Uf(Fn,h),kt?Se(ii):nt}function Qe(ii){var Ws=ii-_t,Qa=ii-zt,EE=h-Ws;return Yt?vr(EE,Y-Qa):EE}function Fe(ii){var Ws=ii-_t,Qa=ii-zt;return _t===n||Ws>=h||Ws<0||Yt&&Qa>=Y}function Fn(){var ii=lp();if(Fe(ii))return $n(ii);ct=Uf(Fn,Qe(ii))}function $n(ii){return ct=n,pe&&T?Se(ii):(T=O=n,nt)}function cs(){ct!==n&&hx(ct),zt=0,T=_t=O=ct=n}function Eo(){return ct===n?nt:$n(lp())}function fs(){var ii=lp(),Ws=Fe(ii);if(T=arguments,O=this,_t=ii,Ws){if(ct===n)return De(_t);if(Yt)return hx(ct),ct=Uf(Fn,h),Se(_t)}return ct===n&&(ct=Uf(Fn,h)),nt}return fs.cancel=cs,fs.flush=Eo,fs}var $D=an(function(l,h){return W1(l,1,h)}),ZD=an(function(l,h,y){return W1(l,Rs(h)||0,y)});function KD(l){return $a(l,q)}function cp(l,h){if(typeof l!="function"||h!=null&&typeof h!="function")throw new tr(s);var y=function(){var T=arguments,O=h?h.apply(this,T):T[0],Y=y.cache;if(Y.has(O))return Y.get(O);var nt=l.apply(this,T);return y.cache=Y.set(O,nt)||Y,nt};return y.cache=new(cp.Cache||Jn),y}cp.Cache=Jn;function fp(l){if(typeof l!="function")throw new tr(s);return function(){var h=arguments;switch(h.length){case 0:return!l.call(this);case 1:return!l.call(this,h[0]);case 2:return!l.call(this,h[0],h[1]);case 3:return!l.call(this,h[0],h[1],h[2])}return!l.apply(this,h)}}function JD(l){return jx(2,l)}var jD=B2(function(l,h){h=h.length==1&&Ve(h[0])?Mr(h[0],io(Ne())):Mr(ji(h,1),io(Ne()));var y=h.length;return an(function(T){for(var O=-1,Y=vr(T.length,y);++O<Y;)T[O]=h[O].call(this,T[O]);return ie(l,this,T)})}),Om=an(function(l,h){var y=zs(h,ic(Om));return $a(l,A,n,h,y)}),rE=an(function(l,h){var y=zs(h,ic(rE));return $a(l,F,n,h,y)}),QD=Za(function(l,h){return $a(l,X,n,n,n,h)});function t3(l,h){if(typeof l!="function")throw new tr(s);return h=h===n?h:Ze(h),an(l,h)}function e3(l,h){if(typeof l!="function")throw new tr(s);return h=h==null?0:ni(Ze(h),0),an(function(y){var T=y[h],O=Pu(y,0,h);return T&&Ge(O,T),ie(l,this,O)})}function n3(l,h,y){var T=!0,O=!0;if(typeof l!="function")throw new tr(s);return Gr(y)&&(T="leading"in y?!!y.leading:T,O="trailing"in y?!!y.trailing:O),nE(l,h,{leading:T,maxWait:h,trailing:O})}function r3(l){return Jx(l,1)}function i3(l,h){return Om(vm(h),l)}function o3(){if(!arguments.length)return[];var l=arguments[0];return Ve(l)?l:[l]}function s3(l){return Cs(l,w)}function a3(l,h){return h=typeof h=="function"?h:n,Cs(l,w,h)}function u3(l){return Cs(l,m|w)}function l3(l,h){return h=typeof h=="function"?h:n,Cs(l,m|w,h)}function c3(l,h){return h==null||V1(l,h,Fi(h))}function Vs(l,h){return l===h||l!==l&&h!==h}var f3=rp(sm),h3=rp(function(l,h){return l>=h}),xl=K1(function(){return arguments}())?K1:function(l){return $r(l)&&sn.call(l,"callee")&&!zo.call(l,"callee")},Ve=Ct.isArray,p3=_s?io(_s):E2;function Ho(l){return l!=null&&hp(l.length)&&!Ja(l)}function ri(l){return $r(l)&&Ho(l)}function d3(l){return l===!0||l===!1||$r(l)&&_o(l)==jt}var Iu=Oi||Wm,g3=Qr?io(Qr):w2;function m3(l){return $r(l)&&l.nodeType===1&&!Bf(l)}function y3(l){if(l==null)return!0;if(Ho(l)&&(Ve(l)||typeof l=="string"||typeof l.splice=="function"||Iu(l)||oc(l)||xl(l)))return!l.length;var h=oo(l);if(h==ft||h==Wt)return!l.size;if(Ff(l))return!lm(l).length;for(var y in l)if(sn.call(l,y))return!1;return!0}function v3(l,h){return Nf(l,h)}function _3(l,h,y){y=typeof y=="function"?y:n;var T=y?y(l,h):n;return T===n?Nf(l,h,n,y):!!T}function Dm(l){if(!$r(l))return!1;var h=_o(l);return h==$t||h==te||typeof l.message=="string"&&typeof l.name=="string"&&!Bf(l)}function x3(l){return typeof l=="number"&&tc(l)}function Ja(l){if(!Gr(l))return!1;var h=_o(l);return h==qt||h==xe||h==Ut||h==Te}function iE(l){return typeof l=="number"&&l==Ze(l)}function hp(l){return typeof l=="number"&&l>-1&&l%1==0&&l<=Mt}function Gr(l){var h=typeof l;return l!=null&&(h=="object"||h=="function")}function $r(l){return l!=null&&typeof l=="object"}var oE=ua?io(ua):M2;function E3(l,h){return l===h||um(l,h,bm(h))}function w3(l,h,y){return y=typeof y=="function"?y:n,um(l,h,bm(h),y)}function S3(l){return sE(l)&&l!=+l}function M3(l){if(aO(l))throw new _e(o);return J1(l)}function b3(l){return l===null}function A3(l){return l==null}function sE(l){return typeof l=="number"||$r(l)&&_o(l)==We}function Bf(l){if(!$r(l)||_o(l)!=ge)return!1;var h=bs(l);if(h===null)return!0;var y=sn.call(h,"constructor")&&h.constructor;return typeof y=="function"&&y instanceof y&&Ss.call(y)==Af}var Fm=No?io(No):b2;function T3(l){return iE(l)&&l>=-Mt&&l<=Mt}var aE=vu?io(vu):A2;function pp(l){return typeof l=="string"||!Ve(l)&&$r(l)&&_o(l)==Me}function ls(l){return typeof l=="symbol"||$r(l)&&_o(l)==tt}var oc=mr?io(mr):T2;function C3(l){return l===n}function P3(l){return $r(l)&&oo(l)==Pt}function I3(l){return $r(l)&&_o(l)==Ot}var R3=rp(cm),L3=rp(function(l,h){return l<=h});function uE(l){if(!l)return[];if(Ho(l))return pp(l)?Fo(l):qo(l);if(Su&&l[Su])return ai(l[Su]());var h=oo(l),y=h==ft?ns:h==Wt?Wr:sc;return y(l)}function ja(l){if(!l)return l===0?l:0;if(l=Rs(l),l===At||l===-At){var h=l<0?-1:1;return h*Lt}return l===l?l:0}function Ze(l){var h=ja(l),y=h%1;return h===h?y?h-y:h:0}function lE(l){return l?ml(Ze(l),0,yt):0}function Rs(l){if(typeof l=="number")return l;if(ls(l))return pt;if(Gr(l)){var h=typeof l.valueOf=="function"?l.valueOf():l;l=Gr(h)?h+"":h}if(typeof l!="string")return l===0?l:+l;l=Hh(l);var y=oi.test(l);return y||mt.test(l)?ho(l.slice(2),y?2:8):bi.test(l)?pt:+l}function cE(l){return Ea(l,Vo(l))}function N3(l){return l?ml(Ze(l),-Mt,Mt):l===0?l:0}function hr(l){return l==null?"":us(l)}var O3=nc(function(l,h){if(Ff(h)||Ho(h)){Ea(h,Fi(h),l);return}for(var y in h)sn.call(h,y)&&If(l,y,h[y])}),fE=nc(function(l,h){Ea(h,Vo(h),l)}),dp=nc(function(l,h,y,T){Ea(h,Vo(h),l,T)}),D3=nc(function(l,h,y,T){Ea(h,Fi(h),l,T)}),F3=Za(rm);function U3(l,h){var y=Xa(l);return h==null?y:H1(y,h)}var B3=an(function(l,h){l=cr(l);var y=-1,T=h.length,O=T>2?h[2]:n;for(O&&xo(h[0],h[1],O)&&(T=1);++y<T;)for(var Y=h[y],nt=Vo(Y),ct=-1,_t=nt.length;++ct<_t;){var zt=nt[ct],kt=l[zt];(kt===n||Vs(kt,ei[zt])&&!sn.call(l,zt))&&(l[zt]=Y[zt])}return l}),z3=an(function(l){return l.push(n,Cx),ie(hE,n,l)});function G3(l,h){return ca(l,Ne(h,3),xa)}function k3(l,h){return ca(l,Ne(h,3),om)}function q3(l,h){return l==null?l:im(l,Ne(h,3),Vo)}function H3(l,h){return l==null?l:$1(l,Ne(h,3),Vo)}function V3(l,h){return l&&xa(l,Ne(h,3))}function W3(l,h){return l&&om(l,Ne(h,3))}function X3(l){return l==null?[]:Zh(l,Fi(l))}function Y3(l){return l==null?[]:Zh(l,Vo(l))}function Um(l,h,y){var T=l==null?n:yl(l,h);return T===n?y:T}function $3(l,h){return l!=null&&Rx(l,h,y2)}function Bm(l,h){return l!=null&&Rx(l,h,v2)}var Z3=Sx(function(l,h,y){h!=null&&typeof h.toString!="function"&&(h=Rr.call(h)),l[h]=y},Gm(Wo)),K3=Sx(function(l,h,y){h!=null&&typeof h.toString!="function"&&(h=Rr.call(h)),sn.call(l,h)?l[h].push(y):l[h]=[y]},Ne),J3=an(Lf);function Fi(l){return Ho(l)?k1(l):lm(l)}function Vo(l){return Ho(l)?k1(l,!0):C2(l)}function j3(l,h){var y={};return h=Ne(h,3),xa(l,function(T,O,Y){Ya(y,h(T,O,Y),T)}),y}function Q3(l,h){var y={};return h=Ne(h,3),xa(l,function(T,O,Y){Ya(y,O,h(T,O,Y))}),y}var tF=nc(function(l,h,y){Kh(l,h,y)}),hE=nc(function(l,h,y,T){Kh(l,h,y,T)}),eF=Za(function(l,h){var y={};if(l==null)return y;var T=!1;h=Mr(h,function(Y){return Y=Cu(Y,l),T||(T=Y.length>1),Y}),Ea(l,Sm(l),y),T&&(y=Cs(y,m|v|w,Z2));for(var O=h.length;O--;)gm(y,h[O]);return y});function nF(l,h){return pE(l,fp(Ne(h)))}var rF=Za(function(l,h){return l==null?{}:I2(l,h)});function pE(l,h){if(l==null)return{};var y=Mr(Sm(l),function(T){return[T]});return h=Ne(h),ix(l,y,function(T,O){return h(T,O[0])})}function iF(l,h,y){h=Cu(h,l);var T=-1,O=h.length;for(O||(O=1,l=n);++T<O;){var Y=l==null?n:l[wa(h[T])];Y===n&&(T=O,Y=y),l=Ja(Y)?Y.call(l):Y}return l}function oF(l,h,y){return l==null?l:Of(l,h,y)}function sF(l,h,y,T){return T=typeof T=="function"?T:n,l==null?l:Of(l,h,y,T)}var dE=Ax(Fi),gE=Ax(Vo);function aF(l,h,y){var T=Ve(l),O=T||Iu(l)||oc(l);if(h=Ne(h,4),y==null){var Y=l&&l.constructor;O?y=T?new Y:[]:Gr(l)?y=Ja(Y)?Xa(bs(l)):{}:y={}}return(O?Pi:xa)(l,function(nt,ct,_t){return h(y,nt,ct,_t)}),y}function uF(l,h){return l==null?!0:gm(l,h)}function lF(l,h,y){return l==null?l:lx(l,h,vm(y))}function cF(l,h,y,T){return T=typeof T=="function"?T:n,l==null?l:lx(l,h,vm(y),T)}function sc(l){return l==null?[]:ts(l,Fi(l))}function fF(l){return l==null?[]:ts(l,Vo(l))}function hF(l,h,y){return y===n&&(y=h,h=n),y!==n&&(y=Rs(y),y=y===y?y:0),h!==n&&(h=Rs(h),h=h===h?h:0),ml(Rs(l),h,y)}function pF(l,h,y){return h=ja(h),y===n?(y=h,h=0):y=ja(y),l=Rs(l),_2(l,h,y)}function dF(l,h,y){if(y&&typeof y!="boolean"&&xo(l,h,y)&&(h=y=n),y===n&&(typeof h=="boolean"?(y=h,h=n):typeof l=="boolean"&&(y=l,l=n)),l===n&&h===n?(l=0,h=1):(l=ja(l),h===n?(h=l,l=0):h=ja(h)),l>h){var T=l;l=h,h=T}if(y||l%1||h%1){var O=Xh();return vr(l+O*(h-l+Gh("1e-"+((O+"").length-1))),h)}return hm(l,h)}var gF=rc(function(l,h,y){return h=h.toLowerCase(),l+(y?mE(h):h)});function mE(l){return zm(hr(l).toLowerCase())}function yE(l){return l=hr(l),l&&l.replace(St,es).replace(Yn,"")}function mF(l,h,y){l=hr(l),h=us(h);var T=l.length;y=y===n?T:ml(Ze(y),0,T);var O=y;return y-=h.length,y>=0&&l.slice(y,O)==h}function yF(l){return l=hr(l),l&&ot.test(l)?l.replace(Et,ha):l}function vF(l){return l=hr(l),l&&Ue.test(l)?l.replace(qe,"\\$&"):l}var _F=rc(function(l,h,y){return l+(y?"-":"")+h.toLowerCase()}),xF=rc(function(l,h,y){return l+(y?" ":"")+h.toLowerCase()}),EF=xx("toLowerCase");function wF(l,h,y){l=hr(l),h=Ze(h);var T=h?qa(l):0;if(!h||T>=h)return l;var O=(h-T)/2;return np(zr(O),y)+l+np(Cr(O),y)}function SF(l,h,y){l=hr(l),h=Ze(h);var T=h?qa(l):0;return h&&T<h?l+np(h-T,y):l}function MF(l,h,y){l=hr(l),h=Ze(h);var T=h?qa(l):0;return h&&T<h?np(h-T,y)+l:l}function bF(l,h,y){return y||h==null?h=0:h&&(h=+h),dl(hr(l).replace(Xe,""),h||0)}function AF(l,h,y){return(y?xo(l,h,y):h===n)?h=1:h=Ze(h),pm(hr(l),h)}function TF(){var l=arguments,h=hr(l[0]);return l.length<3?h:h.replace(l[1],l[2])}var CF=rc(function(l,h,y){return l+(y?"_":"")+h.toLowerCase()});function PF(l,h,y){return y&&typeof y!="number"&&xo(l,h,y)&&(h=y=n),y=y===n?yt:y>>>0,y?(l=hr(l),l&&(typeof h=="string"||h!=null&&!Fm(h))&&(h=us(h),!h&&ka(l))?Pu(Fo(l),0,y):l.split(h,y)):[]}var IF=rc(function(l,h,y){return l+(y?" ":"")+zm(h)});function RF(l,h,y){return l=hr(l),y=y==null?0:ml(Ze(y),0,l.length),h=us(h),l.slice(y,y+h.length)==h}function LF(l,h,y){var T=U.templateSettings;y&&xo(l,h,y)&&(h=n),l=hr(l),h=dp({},h,T,Tx);var O=dp({},h.imports,T.imports,Tx),Y=Fi(O),nt=ts(O,Y),ct,_t,zt=0,kt=h.interpolate||vt,Yt="__p += '",pe=os((h.escape||vt).source+"|"+kt.source+"|"+(kt===Ft?ur:vt).source+"|"+(h.evaluate||vt).source+"|$","g"),Se="//# sourceURL="+(sn.call(h,"sourceURL")?(h.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Ci+"]")+`
10
10
  `;l.replace(pe,function(Fe,Fn,$n,cs,Eo,fs){return $n||($n=cs),Yt+=l.slice(zt,fs).replace(he,ws),Fn&&(ct=!0,Yt+=`' +
11
11
  __e(`+Fn+`) +
12
12
  '`),Eo&&(_t=!0,Yt+=`';
@@ -23,7 +23,7 @@ __p += '`),$n&&(Yt+=`' +
23
23
  function print() { __p += __j.call(arguments, '') }
24
24
  `:`;
25
25
  `)+Yt+`return __p
26
- }`;var Qe=_E(function(){return ke(Y,Se+"return "+Yt).apply(n,nt)});if(Qe.source=Yt,Dm(Qe))throw Qe;return Qe}function NF(l){return hr(l).toLowerCase()}function OF(l){return hr(l).toUpperCase()}function DF(l,h,y){if(l=hr(l),l&&(y||h===n))return Hh(l);if(!l||!(h=us(h)))return l;var T=Fo(l),O=Fo(h),Y=Bs(T,O),nt=Ri(T,O)+1;return Pu(T,Y,nt).join("")}function FF(l,h,y){if(l=hr(l),l&&(y||h===n))return l.slice(0,pa(l)+1);if(!l||!(h=us(h)))return l;var T=Fo(l),O=Ri(T,Fo(h))+1;return Pu(T,0,O).join("")}function UF(l,h,y){if(l=hr(l),l&&(y||h===n))return l.replace(Xe,"");if(!l||!(h=us(h)))return l;var T=Fo(l),O=Bs(T,Fo(h));return Pu(T,O).join("")}function BF(l,h){var y=D,T=xt;if(Gr(h)){var O="separator"in h?h.separator:O;y="length"in h?Ke(h.length):y,T="omission"in h?us(h.omission):T}l=hr(l);var Y=l.length;if(ka(l)){var nt=Fo(l);Y=nt.length}if(y>=Y)return l;var ct=y-qa(T);if(ct<1)return T;var _t=nt?Pu(nt,0,ct).join(""):l.slice(0,ct);if(O===n)return _t+T;if(nt&&(ct+=_t.length-ct),Fm(O)){if(l.slice(ct).search(O)){var zt,kt=_t;for(O.global||(O=os(O.source,hr(Qn.exec(O))+"g")),O.lastIndex=0;zt=O.exec(kt);)var Yt=zt.index;_t=_t.slice(0,Yt===n?ct:Yt)}}else if(l.indexOf(us(O),ct)!=ct){var pe=_t.lastIndexOf(O);pe>-1&&(_t=_t.slice(0,pe))}return _t+T}function zF(l){return l=hr(l),l&&G.test(l)?l.replace(wt,rs):l}var GF=rc(function(l,h,y){return l+(y?" ":"")+h.toUpperCase()}),zm=xx("toUpperCase");function vE(l,h,y){return l=hr(l),h=y?n:h,h===n?jl(l)?ui(l):He(l):l.match(h)||[]}var _E=an(function(l,h){try{return ie(l,n,h)}catch(y){return Dm(y)?y:new _e(y)}}),kF=Za(function(l,h){return Pi(h,function(y){y=wa(y),Ya(l,y,Nm(l[y],l))}),l});function qF(l){var h=l==null?0:l.length,y=Ne();return l=h?Mr(l,function(T){if(typeof T[1]!="function")throw new tr(s);return[y(T[0]),T[1]]}):[],an(function(T){for(var O=-1;++O<h;){var Y=l[O];if(ie(Y[0],this,T))return ie(Y[1],this,T)}})}function HF(l){return d2(Cs(l,m))}function Gm(l){return function(){return l}}function VF(l,h){return l==null||l!==l?h:l}var WF=wx(),XF=wx(!0);function Wo(l){return l}function km(l){return j1(typeof l=="function"?l:Cs(l,m))}function YF(l){return tx(Cs(l,m))}function $F(l,h){return ex(l,Cs(h,m))}var ZF=an(function(l,h){return function(y){return Lf(y,l,h)}}),KF=an(function(l,h){return function(y){return Lf(l,y,h)}});function qm(l,h,y){var T=Fi(h),O=Zh(h,T);y==null&&!(Gr(h)&&(O.length||!T.length))&&(y=h,h=l,l=this,O=Zh(h,Fi(h)));var Y=!(Gr(y)&&"chain"in y)||!!y.chain,nt=Ja(l);return Pi(O,function(ct){var _t=h[ct];l[ct]=_t,nt&&(l.prototype[ct]=function(){var zt=this.__chain__;if(Y||zt){var kt=l(this.__wrapped__),Yt=kt.__actions__=qo(this.__actions__);return Yt.push({func:_t,args:arguments,thisArg:l}),kt.__chain__=zt,kt}return _t.apply(l,Ge([this.value()],arguments))})}),l}function JF(){return Ur._===this&&(Ur._=Bo),this}function Hm(){}function jF(l){return l=Ke(l),an(function(h){return nx(h,l)})}var QF=xm(Mr),tU=xm(po),eU=xm(Ga);function xE(l){return Tm(l)?Es(wa(l)):R2(l)}function nU(l){return function(h){return l==null?n:yl(l,h)}}var rU=Mx(),iU=Mx(!0);function Vm(){return[]}function Wm(){return!1}function oU(){return{}}function sU(){return""}function aU(){return!0}function uU(l,h){if(l=Ke(l),l<1||l>Mt)return[];var y=yt,T=vr(l,yt);h=Ne(h),l-=yt;for(var O=di(T,h);++y<l;)h(y);return O}function lU(l){return Ve(l)?Mr(l,wa):ls(l)?[l]:qo(Gx(hr(l)))}function cU(l){var h=++Li;return hr(l)+h}var fU=ep(function(l,h){return l+h},0),hU=Em("ceil"),pU=ep(function(l,h){return l/h},1),dU=Em("floor");function gU(l){return l&&l.length?$h(l,Wo,sm):n}function mU(l,h){return l&&l.length?$h(l,Ne(h,2),sm):n}function yU(l){return bf(l,Wo)}function vU(l,h){return bf(l,Ne(h,2))}function _U(l){return l&&l.length?$h(l,Wo,cm):n}function xU(l,h){return l&&l.length?$h(l,Ne(h,2),cm):n}var EU=ep(function(l,h){return l*h},1),wU=Em("round"),SU=ep(function(l,h){return l-h},0);function MU(l){return l&&l.length?go(l,Wo):0}function bU(l,h){return l&&l.length?go(l,Ne(h,2)):0}return U.after=YD,U.ary=Jx,U.assign=O3,U.assignIn=fE,U.assignInWith=dp,U.assignWith=D3,U.at=F3,U.before=jx,U.bind=Nm,U.bindAll=kF,U.bindKey=Qx,U.castArray=o3,U.chain=$x,U.chunk=dO,U.compact=gO,U.concat=mO,U.cond=qF,U.conforms=HF,U.constant=Gm,U.countBy=MD,U.create=U3,U.curry=tE,U.curryRight=eE,U.debounce=nE,U.defaults=B3,U.defaultsDeep=z3,U.defer=$D,U.delay=ZD,U.difference=yO,U.differenceBy=vO,U.differenceWith=_O,U.drop=xO,U.dropRight=EO,U.dropRightWhile=wO,U.dropWhile=SO,U.fill=MO,U.filter=AD,U.flatMap=PD,U.flatMapDeep=ID,U.flatMapDepth=RD,U.flatten=Vx,U.flattenDeep=bO,U.flattenDepth=AO,U.flip=KD,U.flow=WF,U.flowRight=XF,U.fromPairs=TO,U.functions=X3,U.functionsIn=Y3,U.groupBy=LD,U.initial=PO,U.intersection=IO,U.intersectionBy=RO,U.intersectionWith=LO,U.invert=Z3,U.invertBy=K3,U.invokeMap=OD,U.iteratee=km,U.keyBy=DD,U.keys=Fi,U.keysIn=Vo,U.map=up,U.mapKeys=j3,U.mapValues=Q3,U.matches=YF,U.matchesProperty=$F,U.memoize=cp,U.merge=tF,U.mergeWith=hE,U.method=ZF,U.methodOf=KF,U.mixin=qm,U.negate=fp,U.nthArg=jF,U.omit=eF,U.omitBy=nF,U.once=JD,U.orderBy=FD,U.over=QF,U.overArgs=jD,U.overEvery=tU,U.overSome=eU,U.partial=Om,U.partialRight=rE,U.partition=UD,U.pick=rF,U.pickBy=pE,U.property=xE,U.propertyOf=nU,U.pull=FO,U.pullAll=Xx,U.pullAllBy=UO,U.pullAllWith=BO,U.pullAt=zO,U.range=rU,U.rangeRight=iU,U.rearg=QD,U.reject=GD,U.remove=GO,U.rest=t3,U.reverse=Rm,U.sampleSize=qD,U.set=oF,U.setWith=sF,U.shuffle=HD,U.slice=kO,U.sortBy=XD,U.sortedUniq=$O,U.sortedUniqBy=ZO,U.split=PF,U.spread=e3,U.tail=KO,U.take=JO,U.takeRight=jO,U.takeRightWhile=QO,U.takeWhile=tD,U.tap=gD,U.throttle=n3,U.thru=ap,U.toArray=uE,U.toPairs=dE,U.toPairsIn=gE,U.toPath=lU,U.toPlainObject=cE,U.transform=aF,U.unary=r3,U.union=eD,U.unionBy=nD,U.unionWith=rD,U.uniq=iD,U.uniqBy=oD,U.uniqWith=sD,U.unset=uF,U.unzip=Lm,U.unzipWith=Yx,U.update=lF,U.updateWith=cF,U.values=sc,U.valuesIn=fF,U.without=aD,U.words=vE,U.wrap=i3,U.xor=uD,U.xorBy=lD,U.xorWith=cD,U.zip=fD,U.zipObject=hD,U.zipObjectDeep=pD,U.zipWith=dD,U.entries=dE,U.entriesIn=gE,U.extend=fE,U.extendWith=dp,qm(U,U),U.add=fU,U.attempt=_E,U.camelCase=gF,U.capitalize=mE,U.ceil=hU,U.clamp=hF,U.clone=s3,U.cloneDeep=u3,U.cloneDeepWith=l3,U.cloneWith=a3,U.conformsTo=c3,U.deburr=yE,U.defaultTo=VF,U.divide=pU,U.endsWith=mF,U.eq=Vs,U.escape=yF,U.escapeRegExp=vF,U.every=bD,U.find=TD,U.findIndex=qx,U.findKey=G3,U.findLast=CD,U.findLastIndex=Hx,U.findLastKey=k3,U.floor=dU,U.forEach=Zx,U.forEachRight=Kx,U.forIn=q3,U.forInRight=H3,U.forOwn=V3,U.forOwnRight=W3,U.get=Um,U.gt=f3,U.gte=h3,U.has=$3,U.hasIn=Bm,U.head=Wx,U.identity=Wo,U.includes=ND,U.indexOf=CO,U.inRange=pF,U.invoke=J3,U.isArguments=xl,U.isArray=Ve,U.isArrayBuffer=p3,U.isArrayLike=Ho,U.isArrayLikeObject=ri,U.isBoolean=d3,U.isBuffer=Iu,U.isDate=g3,U.isElement=m3,U.isEmpty=y3,U.isEqual=v3,U.isEqualWith=_3,U.isError=Dm,U.isFinite=x3,U.isFunction=Ja,U.isInteger=iE,U.isLength=hp,U.isMap=oE,U.isMatch=E3,U.isMatchWith=w3,U.isNaN=S3,U.isNative=M3,U.isNil=A3,U.isNull=b3,U.isNumber=sE,U.isObject=Gr,U.isObjectLike=$r,U.isPlainObject=Bf,U.isRegExp=Fm,U.isSafeInteger=T3,U.isSet=aE,U.isString=pp,U.isSymbol=ls,U.isTypedArray=oc,U.isUndefined=C3,U.isWeakMap=P3,U.isWeakSet=I3,U.join=NO,U.kebabCase=_F,U.last=Is,U.lastIndexOf=OO,U.lowerCase=xF,U.lowerFirst=EF,U.lt=R3,U.lte=L3,U.max=gU,U.maxBy=mU,U.mean=yU,U.meanBy=vU,U.min=_U,U.minBy=xU,U.stubArray=Vm,U.stubFalse=Wm,U.stubObject=oU,U.stubString=sU,U.stubTrue=aU,U.multiply=EU,U.nth=DO,U.noConflict=JF,U.noop=Hm,U.now=lp,U.pad=wF,U.padEnd=SF,U.padStart=MF,U.parseInt=bF,U.random=dF,U.reduce=BD,U.reduceRight=zD,U.repeat=AF,U.replace=TF,U.result=iF,U.round=wU,U.runInContext=gt,U.sample=kD,U.size=VD,U.snakeCase=CF,U.some=WD,U.sortedIndex=qO,U.sortedIndexBy=HO,U.sortedIndexOf=VO,U.sortedLastIndex=WO,U.sortedLastIndexBy=XO,U.sortedLastIndexOf=YO,U.startCase=IF,U.startsWith=RF,U.subtract=SU,U.sum=MU,U.sumBy=bU,U.template=LF,U.times=uU,U.toFinite=ja,U.toInteger=Ke,U.toLength=lE,U.toLower=NF,U.toNumber=Rs,U.toSafeInteger=N3,U.toString=hr,U.toUpper=OF,U.trim=DF,U.trimEnd=FF,U.trimStart=UF,U.truncate=BF,U.unescape=zF,U.uniqueId=cU,U.upperCase=GF,U.upperFirst=zm,U.each=Zx,U.eachRight=Kx,U.first=Wx,qm(U,function(){var l={};return xa(U,function(h,y){sn.call(U.prototype,y)||(l[y]=h)}),l}(),{chain:!1}),U.VERSION=t,Pi(["bind","bindKey","curry","curryRight","partial","partialRight"],function(l){U[l].placeholder=U}),Pi(["drop","take"],function(l,h){i.prototype[l]=function(y){y=y===n?1:ni(Ke(y),0);var T=this.__filtered__&&!h?new i(this):this.clone();return T.__filtered__?T.__takeCount__=vr(y,T.__takeCount__):T.__views__.push({size:vr(y,yt),type:l+(T.__dir__<0?"Right":"")}),T},i.prototype[l+"Right"]=function(y){return this.reverse()[l](y).reverse()}}),Pi(["filter","map","takeWhile"],function(l,h){var y=h+1,T=y==K||y==Q;i.prototype[l]=function(O){var Y=this.clone();return Y.__iteratees__.push({iteratee:Ne(O,3),type:y}),Y.__filtered__=Y.__filtered__||T,Y}}),Pi(["head","last"],function(l,h){var y="take"+(h?"Right":"");i.prototype[l]=function(){return this[y](1).value()[0]}}),Pi(["initial","tail"],function(l,h){var y="drop"+(h?"":"Right");i.prototype[l]=function(){return this.__filtered__?new i(this):this[y](1)}}),i.prototype.compact=function(){return this.filter(Wo)},i.prototype.find=function(l){return this.filter(l).head()},i.prototype.findLast=function(l){return this.reverse().find(l)},i.prototype.invokeMap=an(function(l,h){return typeof l=="function"?new i(this):this.map(function(y){return Lf(y,l,h)})}),i.prototype.reject=function(l){return this.filter(fp(Ne(l)))},i.prototype.slice=function(l,h){l=Ke(l);var y=this;return y.__filtered__&&(l>0||h<0)?new i(y):(l<0?y=y.takeRight(-l):l&&(y=y.drop(l)),h!==n&&(h=Ke(h),y=h<0?y.dropRight(-h):y.take(h-l)),y)},i.prototype.takeRightWhile=function(l){return this.reverse().takeWhile(l).reverse()},i.prototype.toArray=function(){return this.take(yt)},xa(i.prototype,function(l,h){var y=/^(?:filter|find|map|reject)|While$/.test(h),T=/^(?:head|last)$/.test(h),O=U[T?"take"+(h=="last"?"Right":""):h],Y=T||/^find/.test(h);O&&(U.prototype[h]=function(){var nt=this.__wrapped__,ct=T?[1]:arguments,_t=nt instanceof i,zt=ct[0],kt=_t||Ve(nt),Yt=function(Fn){var $n=O.apply(U,Ge([Fn],ct));return T&&pe?$n[0]:$n};kt&&y&&typeof zt=="function"&&zt.length!=1&&(_t=kt=!1);var pe=this.__chain__,Se=!!this.__actions__.length,De=Y&&!pe,Qe=_t&&!Se;if(!Y&&kt){nt=Qe?nt:new i(this);var Fe=l.apply(nt,ct);return Fe.__actions__.push({func:ap,args:[Yt],thisArg:n}),new r(Fe,pe)}return De&&Qe?l.apply(this,ct):(Fe=this.thru(Yt),De?T?Fe.value()[0]:Fe.value():Fe)})}),Pi(["pop","push","shift","sort","splice","unshift"],function(l){var h=Nr[l],y=/^(?:push|sort|unshift)$/.test(l)?"tap":"thru",T=/^(?:pop|shift)$/.test(l);U.prototype[l]=function(){var O=arguments;if(T&&!this.__chain__){var Y=this.value();return h.apply(Ve(Y)?Y:[],O)}return this[y](function(nt){return h.apply(Ve(nt)?nt:[],O)})}}),xa(i.prototype,function(l,h){var y=U[h];if(y){var T=y.name+"";sn.call(ss,T)||(ss[T]=[]),ss[T].push({name:h,func:y})}}),ss[tp(n,R).name]=[{name:"wrapper",func:n}],i.prototype.clone=a,i.prototype.reverse=c,i.prototype.value=d,U.prototype.at=mD,U.prototype.chain=yD,U.prototype.commit=vD,U.prototype.next=_D,U.prototype.plant=ED,U.prototype.reverse=wD,U.prototype.toJSON=U.prototype.valueOf=U.prototype.value=SD,U.prototype.first=U.prototype.head,Su&&(U.prototype[Su]=xD),U},Ki=is();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(Ur._=Ki,define(function(){return Ki})):Lo?((Lo.exports=Ki)._=Ki,Sf._=Ki):Ur._=Ki}).call(xf)});var Itt=tn(xA(),1),Rtt=tn($p(),1),Ltt=tn(Jp(),1);function bA(n){return n.replace(/[A-Z]/g,t=>"_"+t.toLowerCase()).replace(/^_/,"")}function AA(n){let t={};for(let o in n)o.startsWith("on")&&(t[bA(o.slice(2))]=n[o],t[o]=n[o]);let e=o=>Ru(this,null,function*(){let{data:s}=o;if(t[s.type])try{let u=yield t[s.type](s.data);if(u!=null&&u.$transfer&&Array.isArray(u.$transfer)){let p=u.$transfer;delete u.$transfer,self.postMessage({type:""+s.type+"_result",key:s.key,data:u},p)}else self.postMessage({type:""+s.type+"_result",key:s.key,data:u})}catch(u){self.postMessage({type:""+s.type+"_result",key:s.key,error:u})}else self.postMessage({type:""+s.type+"_result",key:s.key,error:"no_event"})});return self.addEventListener("message",e),()=>{self.removeEventListener("message",e)}}var uwt=tn(Jp(),1);function eu(){return eu=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var o=arguments[e];for(var s in o)Object.prototype.hasOwnProperty.call(o,s)&&(t[s]=o[s])}return t},eu.apply(this,arguments)}var YEt=tn(J0(),1),$Et=tn($p(),1),ZEt=tn(Jp(),1),KEt=tn(iM(),1),JEt=tn(uM(),1),jEt=tn(pM(),1),QEt=tn(mM(),1),twt=tn(_M(),1),ewt=tn(wM(),1),nwt=tn(bM(),1),rwt=tn(YA(),1),iwt=tn($A(),1),Vi=tn(lT(),1);var HEt=tn(J0(),1);var zv="162";var KH=0,cT=1,JH=2;var DC=1,jH=2,au=3,Ku=0,$o=1,lu=2,Xu=0,Gc=1,fT=2,hT=3,pT=4,QH=5,Il=100,t6=101,e6=102,dT=103,gT=104,n6=200,r6=201,i6=202,o6=203,Jy=204,jy=205,s6=206,a6=207,u6=208,l6=209,c6=210,f6=211,h6=212,p6=213,d6=214,g6=0,m6=1,y6=2,Sd=3,v6=4,_6=5,x6=6,E6=7,FC=0,w6=1,S6=2,Yu=0,M6=1,b6=2,A6=3,T6=4,C6=5,P6=6,I6=7;var UC=300,Hc=301,Vc=302,Qy=303,tv=304,Wd=306,ev=1e3,ta=1001,nv=1002,Mo=1003,mT=1004;var jf=1005;var Xo=1006,yy=1007;var Ll=1008;var $u=1009,R6=1010,L6=1011,Gv=1012,BC=1013,Wu=1014,cu=1015,ah=1016,zC=1017,GC=1018,Ol=1020,N6=1021,ea=1023,O6=1024,D6=1025,Dl=1026,Wc=1027,F6=1028,kC=1029,U6=1030,qC=1031,HC=1033,vy=33776,_y=33777,xy=33778,Ey=33779,yT=35840,vT=35841,_T=35842,xT=35843,VC=36196,ET=37492,wT=37496,ST=37808,MT=37809,bT=37810,AT=37811,TT=37812,CT=37813,PT=37814,IT=37815,RT=37816,LT=37817,NT=37818,OT=37819,DT=37820,FT=37821,wy=36492,UT=36494,BT=36495,B6=36283,zT=36284,GT=36285,kT=36286;var Md=2300,bd=2301,Sy=2302,qT=2400,HT=2401,VT=2402;var z6=3200,G6=3201,k6=0,q6=1,Vu="",ba="srgb",tl="srgb-linear",kv="display-p3",Xd="display-p3-linear",Ad="linear",Lr="srgb",Td="rec709",Cd="p3";var vc=7680;var WT=519,H6=512,V6=513,W6=514,WC=515,X6=516,Y6=517,$6=518,Z6=519,rv=35044;var XT="300 es",iv=1035,fu=2e3,Pd=2001,Ju=class{addEventListener(t,e){this._listeners===void 0&&(this._listeners={});let o=this._listeners;o[t]===void 0&&(o[t]=[]),o[t].indexOf(e)===-1&&o[t].push(e)}hasEventListener(t,e){if(this._listeners===void 0)return!1;let o=this._listeners;return o[t]!==void 0&&o[t].indexOf(e)!==-1}removeEventListener(t,e){if(this._listeners===void 0)return;let s=this._listeners[t];if(s!==void 0){let u=s.indexOf(e);u!==-1&&s.splice(u,1)}}dispatchEvent(t){if(this._listeners===void 0)return;let o=this._listeners[t.type];if(o!==void 0){t.target=this;let s=o.slice(0);for(let u=0,p=s.length;u<p;u++)s[u].call(this,t);t.target=null}}},ao=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];var My=Math.PI/180,ov=180/Math.PI;function Zu(){let n=Math.random()*4294967295|0,t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,o=Math.random()*4294967295|0;return(ao[n&255]+ao[n>>8&255]+ao[n>>16&255]+ao[n>>24&255]+"-"+ao[t&255]+ao[t>>8&255]+"-"+ao[t>>16&15|64]+ao[t>>24&255]+"-"+ao[e&63|128]+ao[e>>8&255]+"-"+ao[e>>16&255]+ao[e>>24&255]+ao[o&255]+ao[o>>8&255]+ao[o>>16&255]+ao[o>>24&255]).toLowerCase()}function Yo(n,t,e){return Math.max(t,Math.min(e,n))}function K6(n,t){return(n%t+t)%t}function by(n,t,e){return(1-e)*n+e*t}function YT(n){return(n&n-1)===0&&n!==0}function sv(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function Ta(n,t){switch(t.constructor){case Float32Array:return n;case Uint32Array:return n/4294967295;case Uint16Array:return n/65535;case Uint8Array:return n/255;case Int32Array:return Math.max(n/2147483647,-1);case Int16Array:return Math.max(n/32767,-1);case Int8Array:return Math.max(n/127,-1);default:throw new Error("Invalid component type.")}}function _r(n,t){switch(t.constructor){case Float32Array:return n;case Uint32Array:return Math.round(n*4294967295);case Uint16Array:return Math.round(n*65535);case Uint8Array:return Math.round(n*255);case Int32Array:return Math.round(n*2147483647);case Int16Array:return Math.round(n*32767);case Int8Array:return Math.round(n*127);default:throw new Error("Invalid component type.")}}var Ye=class n{constructor(t=0,e=0){n.prototype.isVector2=!0,this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){let e=this.x,o=this.y,s=t.elements;return this.x=s[0]*e+s[3]*o+s[6],this.y=s[1]*e+s[4]*o+s[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clampLength(t,e){let o=this.length();return this.divideScalar(o||1).multiplyScalar(Math.max(t,Math.min(e,o)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(t){let e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;let o=this.dot(t)/e;return Math.acos(Yo(o,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let e=this.x-t.x,o=this.y-t.y;return e*e+o*o}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,o){return this.x=t.x+(e.x-t.x)*o,this.y=t.y+(e.y-t.y)*o,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){let o=Math.cos(e),s=Math.sin(e),u=this.x-t.x,p=this.y-t.y;return this.x=u*o-p*s+t.x,this.y=u*s+p*o+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},nn=class n{constructor(t,e,o,s,u,p,f,g,m){n.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],t!==void 0&&this.set(t,e,o,s,u,p,f,g,m)}set(t,e,o,s,u,p,f,g,m){let v=this.elements;return v[0]=t,v[1]=s,v[2]=f,v[3]=e,v[4]=u,v[5]=g,v[6]=o,v[7]=p,v[8]=m,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){let e=this.elements,o=t.elements;return e[0]=o[0],e[1]=o[1],e[2]=o[2],e[3]=o[3],e[4]=o[4],e[5]=o[5],e[6]=o[6],e[7]=o[7],e[8]=o[8],this}extractBasis(t,e,o){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),o.setFromMatrix3Column(this,2),this}setFromMatrix4(t){let e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){let o=t.elements,s=e.elements,u=this.elements,p=o[0],f=o[3],g=o[6],m=o[1],v=o[4],w=o[7],S=o[2],b=o[5],C=o[8],R=s[0],x=s[3],E=s[6],I=s[1],A=s[4],F=s[7],V=s[2],X=s[5],q=s[8];return u[0]=p*R+f*I+g*V,u[3]=p*x+f*A+g*X,u[6]=p*E+f*F+g*q,u[1]=m*R+v*I+w*V,u[4]=m*x+v*A+w*X,u[7]=m*E+v*F+w*q,u[2]=S*R+b*I+C*V,u[5]=S*x+b*A+C*X,u[8]=S*E+b*F+C*q,this}multiplyScalar(t){let e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){let t=this.elements,e=t[0],o=t[1],s=t[2],u=t[3],p=t[4],f=t[5],g=t[6],m=t[7],v=t[8];return e*p*v-e*f*m-o*u*v+o*f*g+s*u*m-s*p*g}invert(){let t=this.elements,e=t[0],o=t[1],s=t[2],u=t[3],p=t[4],f=t[5],g=t[6],m=t[7],v=t[8],w=v*p-f*m,S=f*g-v*u,b=m*u-p*g,C=e*w+o*S+s*b;if(C===0)return this.set(0,0,0,0,0,0,0,0,0);let R=1/C;return t[0]=w*R,t[1]=(s*m-v*o)*R,t[2]=(f*o-s*p)*R,t[3]=S*R,t[4]=(v*e-s*g)*R,t[5]=(s*u-f*e)*R,t[6]=b*R,t[7]=(o*g-m*e)*R,t[8]=(p*e-o*u)*R,this}transpose(){let t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){let e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,o,s,u,p,f){let g=Math.cos(u),m=Math.sin(u);return this.set(o*g,o*m,-o*(g*p+m*f)+p+t,-s*m,s*g,-s*(-m*p+g*f)+f+e,0,0,1),this}scale(t,e){return this.premultiply(Ay.makeScale(t,e)),this}rotate(t){return this.premultiply(Ay.makeRotation(-t)),this}translate(t,e){return this.premultiply(Ay.makeTranslation(t,e)),this}makeTranslation(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){let e=Math.cos(t),o=Math.sin(t);return this.set(e,-o,0,o,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){let e=this.elements,o=t.elements;for(let s=0;s<9;s++)if(e[s]!==o[s])return!1;return!0}fromArray(t,e=0){for(let o=0;o<9;o++)this.elements[o]=t[o+e];return this}toArray(t=[],e=0){let o=this.elements;return t[e]=o[0],t[e+1]=o[1],t[e+2]=o[2],t[e+3]=o[3],t[e+4]=o[4],t[e+5]=o[5],t[e+6]=o[6],t[e+7]=o[7],t[e+8]=o[8],t}clone(){return new this.constructor().fromArray(this.elements)}},Ay=new nn;function XC(n){for(let t=n.length-1;t>=0;--t)if(n[t]>=65535)return!0;return!1}function Id(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function J6(){let n=Id("canvas");return n.style.display="block",n}var $T={};function YC(n){n in $T||($T[n]=!0,console.warn(n))}var ZT=new nn().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),KT=new nn().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),jp={[tl]:{transfer:Ad,primaries:Td,toReference:n=>n,fromReference:n=>n},[ba]:{transfer:Lr,primaries:Td,toReference:n=>n.convertSRGBToLinear(),fromReference:n=>n.convertLinearToSRGB()},[Xd]:{transfer:Ad,primaries:Cd,toReference:n=>n.applyMatrix3(KT),fromReference:n=>n.applyMatrix3(ZT)},[kv]:{transfer:Lr,primaries:Cd,toReference:n=>n.convertSRGBToLinear().applyMatrix3(KT),fromReference:n=>n.applyMatrix3(ZT).convertLinearToSRGB()}},j6=new Set([tl,Xd]),xr={enabled:!0,_workingColorSpace:tl,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(n){if(!j6.has(n))throw new Error(`Unsupported working color space, "${n}".`);this._workingColorSpace=n},convert:function(n,t,e){if(this.enabled===!1||t===e||!t||!e)return n;let o=jp[t].toReference,s=jp[e].fromReference;return s(o(n))},fromWorkingColorSpace:function(n,t){return this.convert(n,this._workingColorSpace,t)},toWorkingColorSpace:function(n,t){return this.convert(n,t,this._workingColorSpace)},getPrimaries:function(n){return jp[n].primaries},getTransfer:function(n){return n===Vu?Ad:jp[n].transfer}};function kc(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function Ty(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}var _c,Rd=class{static getDataURL(t){if(/^data:/i.test(t.src)||typeof HTMLCanvasElement=="undefined")return t.src;let e;if(t instanceof HTMLCanvasElement)e=t;else{_c===void 0&&(_c=Id("canvas")),_c.width=t.width,_c.height=t.height;let o=_c.getContext("2d");t instanceof ImageData?o.putImageData(t,0,0):o.drawImage(t,0,0,t.width,t.height),e=_c}return e.width>2048||e.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",t),e.toDataURL("image/jpeg",.6)):e.toDataURL("image/png")}static sRGBToLinear(t){if(typeof HTMLImageElement!="undefined"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&t instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&t instanceof ImageBitmap){let e=Id("canvas");e.width=t.width,e.height=t.height;let o=e.getContext("2d");o.drawImage(t,0,0,t.width,t.height);let s=o.getImageData(0,0,t.width,t.height),u=s.data;for(let p=0;p<u.length;p++)u[p]=kc(u[p]/255)*255;return o.putImageData(s,0,0),e}else if(t.data){let e=t.data.slice(0);for(let o=0;o<e.length;o++)e instanceof Uint8Array||e instanceof Uint8ClampedArray?e[o]=Math.floor(kc(e[o]/255)*255):e[o]=kc(e[o]);return{data:e,width:t.width,height:t.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),t}},Q6=0,Ld=class{constructor(t=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Q6++}),this.uuid=Zu(),this.data=t,this.dataReady=!0,this.version=0}set needsUpdate(t){t===!0&&this.version++}toJSON(t){let e=t===void 0||typeof t=="string";if(!e&&t.images[this.uuid]!==void 0)return t.images[this.uuid];let o={uuid:this.uuid,url:""},s=this.data;if(s!==null){let u;if(Array.isArray(s)){u=[];for(let p=0,f=s.length;p<f;p++)s[p].isDataTexture?u.push(Cy(s[p].image)):u.push(Cy(s[p]))}else u=Cy(s);o.url=u}return e||(t.images[this.uuid]=o),o}};function Cy(n){return typeof HTMLImageElement!="undefined"&&n instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&n instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&n instanceof ImageBitmap?Rd.getDataURL(n):n.data?{data:Array.from(n.data),width:n.width,height:n.height,type:n.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}var tV=0,Fs=class n extends Ju{constructor(t=n.DEFAULT_IMAGE,e=n.DEFAULT_MAPPING,o=ta,s=ta,u=Xo,p=Ll,f=ea,g=$u,m=n.DEFAULT_ANISOTROPY,v=Vu){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:tV++}),this.uuid=Zu(),this.name="",this.source=new Ld(t),this.mipmaps=[],this.mapping=e,this.channel=0,this.wrapS=o,this.wrapT=s,this.magFilter=u,this.minFilter=p,this.anisotropy=m,this.format=f,this.internalFormat=null,this.type=g,this.offset=new Ye(0,0),this.repeat=new Ye(1,1),this.center=new Ye(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new nn,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=v,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.needsPMREMUpdate=!1}get image(){return this.source.data}set image(t=null){this.source.data=t}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return new this.constructor().copy(this)}copy(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.channel=t.channel,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.colorSpace=t.colorSpace,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}toJSON(t){let e=t===void 0||typeof t=="string";if(!e&&t.textures[this.uuid]!==void 0)return t.textures[this.uuid];let o={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(o.userData=this.userData),e||(t.textures[this.uuid]=o),o}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(this.mapping!==UC)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case ev:t.x=t.x-Math.floor(t.x);break;case ta:t.x=t.x<0?0:1;break;case nv:Math.abs(Math.floor(t.x)%2)===1?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x);break}if(t.y<0||t.y>1)switch(this.wrapT){case ev:t.y=t.y-Math.floor(t.y);break;case ta:t.y=t.y<0?0:1;break;case nv:Math.abs(Math.floor(t.y)%2)===1?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y);break}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){t===!0&&(this.version++,this.source.needsUpdate=!0)}};Fs.DEFAULT_IMAGE=null;Fs.DEFAULT_MAPPING=UC;Fs.DEFAULT_ANISOTROPY=1;var Qi=class n{constructor(t=0,e=0,o=0,s=1){n.prototype.isVector4=!0,this.x=t,this.y=e,this.z=o,this.w=s}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,o,s){return this.x=t,this.y=e,this.z=o,this.w=s,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w!==void 0?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){let e=this.x,o=this.y,s=this.z,u=this.w,p=t.elements;return this.x=p[0]*e+p[4]*o+p[8]*s+p[12]*u,this.y=p[1]*e+p[5]*o+p[9]*s+p[13]*u,this.z=p[2]*e+p[6]*o+p[10]*s+p[14]*u,this.w=p[3]*e+p[7]*o+p[11]*s+p[15]*u,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);let e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,o,s,u,g=t.elements,m=g[0],v=g[4],w=g[8],S=g[1],b=g[5],C=g[9],R=g[2],x=g[6],E=g[10];if(Math.abs(v-S)<.01&&Math.abs(w-R)<.01&&Math.abs(C-x)<.01){if(Math.abs(v+S)<.1&&Math.abs(w+R)<.1&&Math.abs(C+x)<.1&&Math.abs(m+b+E-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;let A=(m+1)/2,F=(b+1)/2,V=(E+1)/2,X=(v+S)/4,q=(w+R)/4,D=(C+x)/4;return A>F&&A>V?A<.01?(o=0,s=.707106781,u=.707106781):(o=Math.sqrt(A),s=X/o,u=q/o):F>V?F<.01?(o=.707106781,s=0,u=.707106781):(s=Math.sqrt(F),o=X/s,u=D/s):V<.01?(o=.707106781,s=.707106781,u=0):(u=Math.sqrt(V),o=q/u,s=D/u),this.set(o,s,u,e),this}let I=Math.sqrt((x-C)*(x-C)+(w-R)*(w-R)+(S-v)*(S-v));return Math.abs(I)<.001&&(I=1),this.x=(x-C)/I,this.y=(w-R)/I,this.z=(S-v)/I,this.w=Math.acos((m+b+E-1)/2),this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this.w=Math.max(t,Math.min(e,this.w)),this}clampLength(t,e){let o=this.length();return this.divideScalar(o||1).multiplyScalar(Math.max(t,Math.min(e,o)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,o){return this.x=t.x+(e.x-t.x)*o,this.y=t.y+(e.y-t.y)*o,this.z=t.z+(e.z-t.z)*o,this.w=t.w+(e.w-t.w)*o,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}},av=class extends Ju{constructor(t=1,e=1,o={}){super(),this.isRenderTarget=!0,this.width=t,this.height=e,this.depth=1,this.scissor=new Qi(0,0,t,e),this.scissorTest=!1,this.viewport=new Qi(0,0,t,e);let s={width:t,height:e,depth:1};o=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Xo,depthBuffer:!0,stencilBuffer:!1,depthTexture:null,samples:0,count:1},o);let u=new Fs(s,o.mapping,o.wrapS,o.wrapT,o.magFilter,o.minFilter,o.format,o.type,o.anisotropy,o.colorSpace);u.flipY=!1,u.generateMipmaps=o.generateMipmaps,u.internalFormat=o.internalFormat,this.textures=[];let p=o.count;for(let f=0;f<p;f++)this.textures[f]=u.clone(),this.textures[f].isRenderTargetTexture=!0;this.depthBuffer=o.depthBuffer,this.stencilBuffer=o.stencilBuffer,this.depthTexture=o.depthTexture,this.samples=o.samples}get texture(){return this.textures[0]}set texture(t){this.textures[0]=t}setSize(t,e,o=1){if(this.width!==t||this.height!==e||this.depth!==o){this.width=t,this.height=e,this.depth=o;for(let s=0,u=this.textures.length;s<u;s++)this.textures[s].image.width=t,this.textures[s].image.height=e,this.textures[s].image.depth=o;this.dispose()}this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)}clone(){return new this.constructor().copy(this)}copy(t){this.width=t.width,this.height=t.height,this.depth=t.depth,this.scissor.copy(t.scissor),this.scissorTest=t.scissorTest,this.viewport.copy(t.viewport),this.textures.length=0;for(let o=0,s=t.textures.length;o<s;o++)this.textures[o]=t.textures[o].clone(),this.textures[o].isRenderTargetTexture=!0;let e=Object.assign({},t.texture.image);return this.texture.source=new Ld(e),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,t.depthTexture!==null&&(this.depthTexture=t.depthTexture.clone()),this.samples=t.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}},pu=class extends av{constructor(t=1,e=1,o={}){super(t,e,o),this.isWebGLRenderTarget=!0}},Nd=class extends Fs{constructor(t=null,e=1,o=1,s=1){super(null),this.isDataArrayTexture=!0,this.image={data:t,width:e,height:o,depth:s},this.magFilter=Mo,this.minFilter=Mo,this.wrapR=ta,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var uv=class extends Fs{constructor(t=null,e=1,o=1,s=1){super(null),this.isData3DTexture=!0,this.image={data:t,width:e,height:o,depth:s},this.magFilter=Mo,this.minFilter=Mo,this.wrapR=ta,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var ju=class{constructor(t=0,e=0,o=0,s=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=o,this._w=s}static slerpFlat(t,e,o,s,u,p,f){let g=o[s+0],m=o[s+1],v=o[s+2],w=o[s+3],S=u[p+0],b=u[p+1],C=u[p+2],R=u[p+3];if(f===0){t[e+0]=g,t[e+1]=m,t[e+2]=v,t[e+3]=w;return}if(f===1){t[e+0]=S,t[e+1]=b,t[e+2]=C,t[e+3]=R;return}if(w!==R||g!==S||m!==b||v!==C){let x=1-f,E=g*S+m*b+v*C+w*R,I=E>=0?1:-1,A=1-E*E;if(A>Number.EPSILON){let V=Math.sqrt(A),X=Math.atan2(V,E*I);x=Math.sin(x*X)/V,f=Math.sin(f*X)/V}let F=f*I;if(g=g*x+S*F,m=m*x+b*F,v=v*x+C*F,w=w*x+R*F,x===1-f){let V=1/Math.sqrt(g*g+m*m+v*v+w*w);g*=V,m*=V,v*=V,w*=V}}t[e]=g,t[e+1]=m,t[e+2]=v,t[e+3]=w}static multiplyQuaternionsFlat(t,e,o,s,u,p){let f=o[s],g=o[s+1],m=o[s+2],v=o[s+3],w=u[p],S=u[p+1],b=u[p+2],C=u[p+3];return t[e]=f*C+v*w+g*b-m*S,t[e+1]=g*C+v*S+m*w-f*b,t[e+2]=m*C+v*b+f*S-g*w,t[e+3]=v*C-f*w-g*S-m*b,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,o,s){return this._x=t,this._y=e,this._z=o,this._w=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e=!0){let o=t._x,s=t._y,u=t._z,p=t._order,f=Math.cos,g=Math.sin,m=f(o/2),v=f(s/2),w=f(u/2),S=g(o/2),b=g(s/2),C=g(u/2);switch(p){case"XYZ":this._x=S*v*w+m*b*C,this._y=m*b*w-S*v*C,this._z=m*v*C+S*b*w,this._w=m*v*w-S*b*C;break;case"YXZ":this._x=S*v*w+m*b*C,this._y=m*b*w-S*v*C,this._z=m*v*C-S*b*w,this._w=m*v*w+S*b*C;break;case"ZXY":this._x=S*v*w-m*b*C,this._y=m*b*w+S*v*C,this._z=m*v*C+S*b*w,this._w=m*v*w-S*b*C;break;case"ZYX":this._x=S*v*w-m*b*C,this._y=m*b*w+S*v*C,this._z=m*v*C-S*b*w,this._w=m*v*w+S*b*C;break;case"YZX":this._x=S*v*w+m*b*C,this._y=m*b*w+S*v*C,this._z=m*v*C-S*b*w,this._w=m*v*w-S*b*C;break;case"XZY":this._x=S*v*w-m*b*C,this._y=m*b*w-S*v*C,this._z=m*v*C+S*b*w,this._w=m*v*w+S*b*C;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+p)}return e===!0&&this._onChangeCallback(),this}setFromAxisAngle(t,e){let o=e/2,s=Math.sin(o);return this._x=t.x*s,this._y=t.y*s,this._z=t.z*s,this._w=Math.cos(o),this._onChangeCallback(),this}setFromRotationMatrix(t){let e=t.elements,o=e[0],s=e[4],u=e[8],p=e[1],f=e[5],g=e[9],m=e[2],v=e[6],w=e[10],S=o+f+w;if(S>0){let b=.5/Math.sqrt(S+1);this._w=.25/b,this._x=(v-g)*b,this._y=(u-m)*b,this._z=(p-s)*b}else if(o>f&&o>w){let b=2*Math.sqrt(1+o-f-w);this._w=(v-g)/b,this._x=.25*b,this._y=(s+p)/b,this._z=(u+m)/b}else if(f>w){let b=2*Math.sqrt(1+f-o-w);this._w=(u-m)/b,this._x=(s+p)/b,this._y=.25*b,this._z=(g+v)/b}else{let b=2*Math.sqrt(1+w-o-f);this._w=(p-s)/b,this._x=(u+m)/b,this._y=(g+v)/b,this._z=.25*b}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let o=t.dot(e)+1;return o<Number.EPSILON?(o=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=o):(this._x=0,this._y=-t.z,this._z=t.y,this._w=o)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=o),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(Yo(this.dot(t),-1,1)))}rotateTowards(t,e){let o=this.angleTo(t);if(o===0)return this;let s=Math.min(1,e/o);return this.slerp(t,s),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return t===0?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){let o=t._x,s=t._y,u=t._z,p=t._w,f=e._x,g=e._y,m=e._z,v=e._w;return this._x=o*v+p*f+s*m-u*g,this._y=s*v+p*g+u*f-o*m,this._z=u*v+p*m+o*g-s*f,this._w=p*v-o*f-s*g-u*m,this._onChangeCallback(),this}slerp(t,e){if(e===0)return this;if(e===1)return this.copy(t);let o=this._x,s=this._y,u=this._z,p=this._w,f=p*t._w+o*t._x+s*t._y+u*t._z;if(f<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,f=-f):this.copy(t),f>=1)return this._w=p,this._x=o,this._y=s,this._z=u,this;let g=1-f*f;if(g<=Number.EPSILON){let b=1-e;return this._w=b*p+e*this._w,this._x=b*o+e*this._x,this._y=b*s+e*this._y,this._z=b*u+e*this._z,this.normalize(),this}let m=Math.sqrt(g),v=Math.atan2(m,f),w=Math.sin((1-e)*v)/m,S=Math.sin(e*v)/m;return this._w=p*w+this._w*S,this._x=o*w+this._x*S,this._y=s*w+this._y*S,this._z=u*w+this._z*S,this._onChangeCallback(),this}slerpQuaternions(t,e,o){return this.copy(t).slerp(e,o)}random(){let t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),o=Math.random(),s=Math.sqrt(1-o),u=Math.sqrt(o);return this.set(s*Math.sin(t),s*Math.cos(t),u*Math.sin(e),u*Math.cos(e))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},Rt=class n{constructor(t=0,e=0,o=0){n.prototype.isVector3=!0,this.x=t,this.y=e,this.z=o}set(t,e,o){return o===void 0&&(o=this.z),this.x=t,this.y=e,this.z=o,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(JT.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(JT.setFromAxisAngle(t,e))}applyMatrix3(t){let e=this.x,o=this.y,s=this.z,u=t.elements;return this.x=u[0]*e+u[3]*o+u[6]*s,this.y=u[1]*e+u[4]*o+u[7]*s,this.z=u[2]*e+u[5]*o+u[8]*s,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){let e=this.x,o=this.y,s=this.z,u=t.elements,p=1/(u[3]*e+u[7]*o+u[11]*s+u[15]);return this.x=(u[0]*e+u[4]*o+u[8]*s+u[12])*p,this.y=(u[1]*e+u[5]*o+u[9]*s+u[13])*p,this.z=(u[2]*e+u[6]*o+u[10]*s+u[14])*p,this}applyQuaternion(t){let e=this.x,o=this.y,s=this.z,u=t.x,p=t.y,f=t.z,g=t.w,m=2*(p*s-f*o),v=2*(f*e-u*s),w=2*(u*o-p*e);return this.x=e+g*m+p*w-f*v,this.y=o+g*v+f*m-u*w,this.z=s+g*w+u*v-p*m,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){let e=this.x,o=this.y,s=this.z,u=t.elements;return this.x=u[0]*e+u[4]*o+u[8]*s,this.y=u[1]*e+u[5]*o+u[9]*s,this.z=u[2]*e+u[6]*o+u[10]*s,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this}clampLength(t,e){let o=this.length();return this.divideScalar(o||1).multiplyScalar(Math.max(t,Math.min(e,o)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,o){return this.x=t.x+(e.x-t.x)*o,this.y=t.y+(e.y-t.y)*o,this.z=t.z+(e.z-t.z)*o,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){let o=t.x,s=t.y,u=t.z,p=e.x,f=e.y,g=e.z;return this.x=s*g-u*f,this.y=u*p-o*g,this.z=o*f-s*p,this}projectOnVector(t){let e=t.lengthSq();if(e===0)return this.set(0,0,0);let o=t.dot(this)/e;return this.copy(t).multiplyScalar(o)}projectOnPlane(t){return Py.copy(this).projectOnVector(t),this.sub(Py)}reflect(t){return this.sub(Py.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){let e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;let o=this.dot(t)/e;return Math.acos(Yo(o,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let e=this.x-t.x,o=this.y-t.y,s=this.z-t.z;return e*e+o*o+s*s}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,o){let s=Math.sin(e)*t;return this.x=s*Math.sin(o),this.y=Math.cos(e)*t,this.z=s*Math.cos(o),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,o){return this.x=t*Math.sin(e),this.y=o,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){let e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){let e=this.setFromMatrixColumn(t,0).length(),o=this.setFromMatrixColumn(t,1).length(),s=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=o,this.z=s,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,e*4)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,e*3)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let t=Math.random()*Math.PI*2,e=Math.random()*2-1,o=Math.sqrt(1-e*e);return this.x=o*Math.cos(t),this.y=e,this.z=o*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},Py=new Rt,JT=new ju,Fl=class{constructor(t=new Rt(1/0,1/0,1/0),e=new Rt(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,o=t.length;e<o;e+=3)this.expandByPoint(Js.fromArray(t,e));return this}setFromBufferAttribute(t){this.makeEmpty();for(let e=0,o=t.count;e<o;e++)this.expandByPoint(Js.fromBufferAttribute(t,e));return this}setFromPoints(t){this.makeEmpty();for(let e=0,o=t.length;e<o;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){let o=Js.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(o),this.max.copy(t).add(o),this}setFromObject(t,e=!1){return this.makeEmpty(),this.expandByObject(t,e)}clone(){return new this.constructor().copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t,e=!1){t.updateWorldMatrix(!1,!1);let o=t.geometry;if(o!==void 0){let u=o.getAttribute("position");if(e===!0&&u!==void 0&&t.isInstancedMesh!==!0)for(let p=0,f=u.count;p<f;p++)t.isMesh===!0?t.getVertexPosition(p,Js):Js.fromBufferAttribute(u,p),Js.applyMatrix4(t.matrixWorld),this.expandByPoint(Js);else t.boundingBox!==void 0?(t.boundingBox===null&&t.computeBoundingBox(),Qp.copy(t.boundingBox)):(o.boundingBox===null&&o.computeBoundingBox(),Qp.copy(o.boundingBox)),Qp.applyMatrix4(t.matrixWorld),this.union(Qp)}let s=t.children;for(let u=0,p=s.length;u<p;u++)this.expandByObject(s[u],e);return this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)}intersectsSphere(t){return this.clampPoint(t.center,Js),Js.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,o;return t.normal.x>0?(e=t.normal.x*this.min.x,o=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,o=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,o+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,o+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,o+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,o+=t.normal.z*this.min.z),e<=-t.constant&&o>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(Qf),td.subVectors(this.max,Qf),xc.subVectors(t.a,Qf),Ec.subVectors(t.b,Qf),wc.subVectors(t.c,Qf),Uu.subVectors(Ec,xc),Bu.subVectors(wc,Ec),Sl.subVectors(xc,wc);let e=[0,-Uu.z,Uu.y,0,-Bu.z,Bu.y,0,-Sl.z,Sl.y,Uu.z,0,-Uu.x,Bu.z,0,-Bu.x,Sl.z,0,-Sl.x,-Uu.y,Uu.x,0,-Bu.y,Bu.x,0,-Sl.y,Sl.x,0];return!Iy(e,xc,Ec,wc,td)||(e=[1,0,0,0,1,0,0,0,1],!Iy(e,xc,Ec,wc,td))?!1:(ed.crossVectors(Uu,Bu),e=[ed.x,ed.y,ed.z],Iy(e,xc,Ec,wc,td))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,Js).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=this.getSize(Js).length()*.5),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()?this:(nu[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),nu[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),nu[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),nu[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),nu[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),nu[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),nu[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),nu[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(nu),this)}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}},nu=[new Rt,new Rt,new Rt,new Rt,new Rt,new Rt,new Rt,new Rt],Js=new Rt,Qp=new Fl,xc=new Rt,Ec=new Rt,wc=new Rt,Uu=new Rt,Bu=new Rt,Sl=new Rt,Qf=new Rt,td=new Rt,ed=new Rt,Ml=new Rt;function Iy(n,t,e,o,s){for(let u=0,p=n.length-3;u<=p;u+=3){Ml.fromArray(n,u);let f=s.x*Math.abs(Ml.x)+s.y*Math.abs(Ml.y)+s.z*Math.abs(Ml.z),g=t.dot(Ml),m=e.dot(Ml),v=o.dot(Ml);if(Math.max(-Math.max(g,m,v),Math.min(g,m,v))>f)return!1}return!0}var eV=new Fl,th=new Rt,Ry=new Rt,uh=class{constructor(t=new Rt,e=-1){this.isSphere=!0,this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){let o=this.center;e!==void 0?o.copy(e):eV.setFromPoints(t).getCenter(o);let s=0;for(let u=0,p=t.length;u<p;u++)s=Math.max(s,o.distanceToSquared(t[u]));return this.radius=Math.sqrt(s),this}copy(t){return this.center.copy(t.center),this.radius=t.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(t){return t.distanceTo(this.center)-this.radius}intersectsSphere(t){let e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e}intersectsBox(t){return t.intersectsSphere(this)}intersectsPlane(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}clampPoint(t,e){let o=this.center.distanceToSquared(t);return e.copy(t),o>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;th.subVectors(t,this.center);let e=th.lengthSq();if(e>this.radius*this.radius){let o=Math.sqrt(e),s=(o-this.radius)*.5;this.center.addScaledVector(th,s/o),this.radius+=s}return this}union(t){return t.isEmpty()?this:this.isEmpty()?(this.copy(t),this):(this.center.equals(t.center)===!0?this.radius=Math.max(this.radius,t.radius):(Ry.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(th.copy(t.center).add(Ry)),this.expandByPoint(th.copy(t.center).sub(Ry))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return new this.constructor().copy(this)}},ru=new Rt,Ly=new Rt,nd=new Rt,zu=new Rt,Ny=new Rt,rd=new Rt,Oy=new Rt,lv=class{constructor(t=new Rt,e=new Rt(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.origin).addScaledVector(this.direction,t)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,ru)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);let o=e.dot(this.direction);return o<0?e.copy(this.origin):e.copy(this.origin).addScaledVector(this.direction,o)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){let e=ru.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(ru.copy(this.origin).addScaledVector(this.direction,e),ru.distanceToSquared(t))}distanceSqToSegment(t,e,o,s){Ly.copy(t).add(e).multiplyScalar(.5),nd.copy(e).sub(t).normalize(),zu.copy(this.origin).sub(Ly);let u=t.distanceTo(e)*.5,p=-this.direction.dot(nd),f=zu.dot(this.direction),g=-zu.dot(nd),m=zu.lengthSq(),v=Math.abs(1-p*p),w,S,b,C;if(v>0)if(w=p*g-f,S=p*f-g,C=u*v,w>=0)if(S>=-C)if(S<=C){let R=1/v;w*=R,S*=R,b=w*(w+p*S+2*f)+S*(p*w+S+2*g)+m}else S=u,w=Math.max(0,-(p*S+f)),b=-w*w+S*(S+2*g)+m;else S=-u,w=Math.max(0,-(p*S+f)),b=-w*w+S*(S+2*g)+m;else S<=-C?(w=Math.max(0,-(-p*u+f)),S=w>0?-u:Math.min(Math.max(-u,-g),u),b=-w*w+S*(S+2*g)+m):S<=C?(w=0,S=Math.min(Math.max(-u,-g),u),b=S*(S+2*g)+m):(w=Math.max(0,-(p*u+f)),S=w>0?u:Math.min(Math.max(-u,-g),u),b=-w*w+S*(S+2*g)+m);else S=p>0?-u:u,w=Math.max(0,-(p*S+f)),b=-w*w+S*(S+2*g)+m;return o&&o.copy(this.origin).addScaledVector(this.direction,w),s&&s.copy(Ly).addScaledVector(nd,S),b}intersectSphere(t,e){ru.subVectors(t.center,this.origin);let o=ru.dot(this.direction),s=ru.dot(ru)-o*o,u=t.radius*t.radius;if(s>u)return null;let p=Math.sqrt(u-s),f=o-p,g=o+p;return g<0?null:f<0?this.at(g,e):this.at(f,e)}intersectsSphere(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){let e=t.normal.dot(this.direction);if(e===0)return t.distanceToPoint(this.origin)===0?0:null;let o=-(this.origin.dot(t.normal)+t.constant)/e;return o>=0?o:null}intersectPlane(t,e){let o=this.distanceToPlane(t);return o===null?null:this.at(o,e)}intersectsPlane(t){let e=t.distanceToPoint(this.origin);return e===0||t.normal.dot(this.direction)*e<0}intersectBox(t,e){let o,s,u,p,f,g,m=1/this.direction.x,v=1/this.direction.y,w=1/this.direction.z,S=this.origin;return m>=0?(o=(t.min.x-S.x)*m,s=(t.max.x-S.x)*m):(o=(t.max.x-S.x)*m,s=(t.min.x-S.x)*m),v>=0?(u=(t.min.y-S.y)*v,p=(t.max.y-S.y)*v):(u=(t.max.y-S.y)*v,p=(t.min.y-S.y)*v),o>p||u>s||((u>o||isNaN(o))&&(o=u),(p<s||isNaN(s))&&(s=p),w>=0?(f=(t.min.z-S.z)*w,g=(t.max.z-S.z)*w):(f=(t.max.z-S.z)*w,g=(t.min.z-S.z)*w),o>g||f>s)||((f>o||o!==o)&&(o=f),(g<s||s!==s)&&(s=g),s<0)?null:this.at(o>=0?o:s,e)}intersectsBox(t){return this.intersectBox(t,ru)!==null}intersectTriangle(t,e,o,s,u){Ny.subVectors(e,t),rd.subVectors(o,t),Oy.crossVectors(Ny,rd);let p=this.direction.dot(Oy),f;if(p>0){if(s)return null;f=1}else if(p<0)f=-1,p=-p;else return null;zu.subVectors(this.origin,t);let g=f*this.direction.dot(rd.crossVectors(zu,rd));if(g<0)return null;let m=f*this.direction.dot(Ny.cross(zu));if(m<0||g+m>p)return null;let v=-f*zu.dot(Oy);return v<0?null:this.at(v/p,u)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}},vi=class n{constructor(t,e,o,s,u,p,f,g,m,v,w,S,b,C,R,x){n.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!==void 0&&this.set(t,e,o,s,u,p,f,g,m,v,w,S,b,C,R,x)}set(t,e,o,s,u,p,f,g,m,v,w,S,b,C,R,x){let E=this.elements;return E[0]=t,E[4]=e,E[8]=o,E[12]=s,E[1]=u,E[5]=p,E[9]=f,E[13]=g,E[2]=m,E[6]=v,E[10]=w,E[14]=S,E[3]=b,E[7]=C,E[11]=R,E[15]=x,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new n().fromArray(this.elements)}copy(t){let e=this.elements,o=t.elements;return e[0]=o[0],e[1]=o[1],e[2]=o[2],e[3]=o[3],e[4]=o[4],e[5]=o[5],e[6]=o[6],e[7]=o[7],e[8]=o[8],e[9]=o[9],e[10]=o[10],e[11]=o[11],e[12]=o[12],e[13]=o[13],e[14]=o[14],e[15]=o[15],this}copyPosition(t){let e=this.elements,o=t.elements;return e[12]=o[12],e[13]=o[13],e[14]=o[14],this}setFromMatrix3(t){let e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,o){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),o.setFromMatrixColumn(this,2),this}makeBasis(t,e,o){return this.set(t.x,e.x,o.x,0,t.y,e.y,o.y,0,t.z,e.z,o.z,0,0,0,0,1),this}extractRotation(t){let e=this.elements,o=t.elements,s=1/Sc.setFromMatrixColumn(t,0).length(),u=1/Sc.setFromMatrixColumn(t,1).length(),p=1/Sc.setFromMatrixColumn(t,2).length();return e[0]=o[0]*s,e[1]=o[1]*s,e[2]=o[2]*s,e[3]=0,e[4]=o[4]*u,e[5]=o[5]*u,e[6]=o[6]*u,e[7]=0,e[8]=o[8]*p,e[9]=o[9]*p,e[10]=o[10]*p,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){let e=this.elements,o=t.x,s=t.y,u=t.z,p=Math.cos(o),f=Math.sin(o),g=Math.cos(s),m=Math.sin(s),v=Math.cos(u),w=Math.sin(u);if(t.order==="XYZ"){let S=p*v,b=p*w,C=f*v,R=f*w;e[0]=g*v,e[4]=-g*w,e[8]=m,e[1]=b+C*m,e[5]=S-R*m,e[9]=-f*g,e[2]=R-S*m,e[6]=C+b*m,e[10]=p*g}else if(t.order==="YXZ"){let S=g*v,b=g*w,C=m*v,R=m*w;e[0]=S+R*f,e[4]=C*f-b,e[8]=p*m,e[1]=p*w,e[5]=p*v,e[9]=-f,e[2]=b*f-C,e[6]=R+S*f,e[10]=p*g}else if(t.order==="ZXY"){let S=g*v,b=g*w,C=m*v,R=m*w;e[0]=S-R*f,e[4]=-p*w,e[8]=C+b*f,e[1]=b+C*f,e[5]=p*v,e[9]=R-S*f,e[2]=-p*m,e[6]=f,e[10]=p*g}else if(t.order==="ZYX"){let S=p*v,b=p*w,C=f*v,R=f*w;e[0]=g*v,e[4]=C*m-b,e[8]=S*m+R,e[1]=g*w,e[5]=R*m+S,e[9]=b*m-C,e[2]=-m,e[6]=f*g,e[10]=p*g}else if(t.order==="YZX"){let S=p*g,b=p*m,C=f*g,R=f*m;e[0]=g*v,e[4]=R-S*w,e[8]=C*w+b,e[1]=w,e[5]=p*v,e[9]=-f*v,e[2]=-m*v,e[6]=b*w+C,e[10]=S-R*w}else if(t.order==="XZY"){let S=p*g,b=p*m,C=f*g,R=f*m;e[0]=g*v,e[4]=-w,e[8]=m*v,e[1]=S*w+R,e[5]=p*v,e[9]=b*w-C,e[2]=C*w-b,e[6]=f*v,e[10]=R*w+S}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(nV,t,rV)}lookAt(t,e,o){let s=this.elements;return hs.subVectors(t,e),hs.lengthSq()===0&&(hs.z=1),hs.normalize(),Gu.crossVectors(o,hs),Gu.lengthSq()===0&&(Math.abs(o.z)===1?hs.x+=1e-4:hs.z+=1e-4,hs.normalize(),Gu.crossVectors(o,hs)),Gu.normalize(),id.crossVectors(hs,Gu),s[0]=Gu.x,s[4]=id.x,s[8]=hs.x,s[1]=Gu.y,s[5]=id.y,s[9]=hs.y,s[2]=Gu.z,s[6]=id.z,s[10]=hs.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){let o=t.elements,s=e.elements,u=this.elements,p=o[0],f=o[4],g=o[8],m=o[12],v=o[1],w=o[5],S=o[9],b=o[13],C=o[2],R=o[6],x=o[10],E=o[14],I=o[3],A=o[7],F=o[11],V=o[15],X=s[0],q=s[4],D=s[8],xt=s[12],B=s[1],j=s[5],K=s[9],Dt=s[13],Q=s[2],At=s[6],Mt=s[10],Lt=s[14],pt=s[3],yt=s[7],J=s[11],Bt=s[15];return u[0]=p*X+f*B+g*Q+m*pt,u[4]=p*q+f*j+g*At+m*yt,u[8]=p*D+f*K+g*Mt+m*J,u[12]=p*xt+f*Dt+g*Lt+m*Bt,u[1]=v*X+w*B+S*Q+b*pt,u[5]=v*q+w*j+S*At+b*yt,u[9]=v*D+w*K+S*Mt+b*J,u[13]=v*xt+w*Dt+S*Lt+b*Bt,u[2]=C*X+R*B+x*Q+E*pt,u[6]=C*q+R*j+x*At+E*yt,u[10]=C*D+R*K+x*Mt+E*J,u[14]=C*xt+R*Dt+x*Lt+E*Bt,u[3]=I*X+A*B+F*Q+V*pt,u[7]=I*q+A*j+F*At+V*yt,u[11]=I*D+A*K+F*Mt+V*J,u[15]=I*xt+A*Dt+F*Lt+V*Bt,this}multiplyScalar(t){let e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){let t=this.elements,e=t[0],o=t[4],s=t[8],u=t[12],p=t[1],f=t[5],g=t[9],m=t[13],v=t[2],w=t[6],S=t[10],b=t[14],C=t[3],R=t[7],x=t[11],E=t[15];return C*(+u*g*w-s*m*w-u*f*S+o*m*S+s*f*b-o*g*b)+R*(+e*g*b-e*m*S+u*p*S-s*p*b+s*m*v-u*g*v)+x*(+e*m*w-e*f*b-u*p*w+o*p*b+u*f*v-o*m*v)+E*(-s*f*v-e*g*w+e*f*S+s*p*w-o*p*S+o*g*v)}transpose(){let t=this.elements,e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,o){let s=this.elements;return t.isVector3?(s[12]=t.x,s[13]=t.y,s[14]=t.z):(s[12]=t,s[13]=e,s[14]=o),this}invert(){let t=this.elements,e=t[0],o=t[1],s=t[2],u=t[3],p=t[4],f=t[5],g=t[6],m=t[7],v=t[8],w=t[9],S=t[10],b=t[11],C=t[12],R=t[13],x=t[14],E=t[15],I=w*x*m-R*S*m+R*g*b-f*x*b-w*g*E+f*S*E,A=C*S*m-v*x*m-C*g*b+p*x*b+v*g*E-p*S*E,F=v*R*m-C*w*m+C*f*b-p*R*b-v*f*E+p*w*E,V=C*w*g-v*R*g-C*f*S+p*R*S+v*f*x-p*w*x,X=e*I+o*A+s*F+u*V;if(X===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let q=1/X;return t[0]=I*q,t[1]=(R*S*u-w*x*u-R*s*b+o*x*b+w*s*E-o*S*E)*q,t[2]=(f*x*u-R*g*u+R*s*m-o*x*m-f*s*E+o*g*E)*q,t[3]=(w*g*u-f*S*u-w*s*m+o*S*m+f*s*b-o*g*b)*q,t[4]=A*q,t[5]=(v*x*u-C*S*u+C*s*b-e*x*b-v*s*E+e*S*E)*q,t[6]=(C*g*u-p*x*u-C*s*m+e*x*m+p*s*E-e*g*E)*q,t[7]=(p*S*u-v*g*u+v*s*m-e*S*m-p*s*b+e*g*b)*q,t[8]=F*q,t[9]=(C*w*u-v*R*u-C*o*b+e*R*b+v*o*E-e*w*E)*q,t[10]=(p*R*u-C*f*u+C*o*m-e*R*m-p*o*E+e*f*E)*q,t[11]=(v*f*u-p*w*u-v*o*m+e*w*m+p*o*b-e*f*b)*q,t[12]=V*q,t[13]=(v*R*s-C*w*s+C*o*S-e*R*S-v*o*x+e*w*x)*q,t[14]=(C*f*s-p*R*s-C*o*g+e*R*g+p*o*x-e*f*x)*q,t[15]=(p*w*s-v*f*s+v*o*g-e*w*g-p*o*S+e*f*S)*q,this}scale(t){let e=this.elements,o=t.x,s=t.y,u=t.z;return e[0]*=o,e[4]*=s,e[8]*=u,e[1]*=o,e[5]*=s,e[9]*=u,e[2]*=o,e[6]*=s,e[10]*=u,e[3]*=o,e[7]*=s,e[11]*=u,this}getMaxScaleOnAxis(){let t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],o=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],s=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,o,s))}makeTranslation(t,e,o){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,o,0,0,0,1),this}makeRotationX(t){let e=Math.cos(t),o=Math.sin(t);return this.set(1,0,0,0,0,e,-o,0,0,o,e,0,0,0,0,1),this}makeRotationY(t){let e=Math.cos(t),o=Math.sin(t);return this.set(e,0,o,0,0,1,0,0,-o,0,e,0,0,0,0,1),this}makeRotationZ(t){let e=Math.cos(t),o=Math.sin(t);return this.set(e,-o,0,0,o,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){let o=Math.cos(e),s=Math.sin(e),u=1-o,p=t.x,f=t.y,g=t.z,m=u*p,v=u*f;return this.set(m*p+o,m*f-s*g,m*g+s*f,0,m*f+s*g,v*f+o,v*g-s*p,0,m*g-s*f,v*g+s*p,u*g*g+o,0,0,0,0,1),this}makeScale(t,e,o){return this.set(t,0,0,0,0,e,0,0,0,0,o,0,0,0,0,1),this}makeShear(t,e,o,s,u,p){return this.set(1,o,u,0,t,1,p,0,e,s,1,0,0,0,0,1),this}compose(t,e,o){let s=this.elements,u=e._x,p=e._y,f=e._z,g=e._w,m=u+u,v=p+p,w=f+f,S=u*m,b=u*v,C=u*w,R=p*v,x=p*w,E=f*w,I=g*m,A=g*v,F=g*w,V=o.x,X=o.y,q=o.z;return s[0]=(1-(R+E))*V,s[1]=(b+F)*V,s[2]=(C-A)*V,s[3]=0,s[4]=(b-F)*X,s[5]=(1-(S+E))*X,s[6]=(x+I)*X,s[7]=0,s[8]=(C+A)*q,s[9]=(x-I)*q,s[10]=(1-(S+R))*q,s[11]=0,s[12]=t.x,s[13]=t.y,s[14]=t.z,s[15]=1,this}decompose(t,e,o){let s=this.elements,u=Sc.set(s[0],s[1],s[2]).length(),p=Sc.set(s[4],s[5],s[6]).length(),f=Sc.set(s[8],s[9],s[10]).length();this.determinant()<0&&(u=-u),t.x=s[12],t.y=s[13],t.z=s[14],js.copy(this);let m=1/u,v=1/p,w=1/f;return js.elements[0]*=m,js.elements[1]*=m,js.elements[2]*=m,js.elements[4]*=v,js.elements[5]*=v,js.elements[6]*=v,js.elements[8]*=w,js.elements[9]*=w,js.elements[10]*=w,e.setFromRotationMatrix(js),o.x=u,o.y=p,o.z=f,this}makePerspective(t,e,o,s,u,p,f=fu){let g=this.elements,m=2*u/(e-t),v=2*u/(o-s),w=(e+t)/(e-t),S=(o+s)/(o-s),b,C;if(f===fu)b=-(p+u)/(p-u),C=-2*p*u/(p-u);else if(f===Pd)b=-p/(p-u),C=-p*u/(p-u);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+f);return g[0]=m,g[4]=0,g[8]=w,g[12]=0,g[1]=0,g[5]=v,g[9]=S,g[13]=0,g[2]=0,g[6]=0,g[10]=b,g[14]=C,g[3]=0,g[7]=0,g[11]=-1,g[15]=0,this}makeOrthographic(t,e,o,s,u,p,f=fu){let g=this.elements,m=1/(e-t),v=1/(o-s),w=1/(p-u),S=(e+t)*m,b=(o+s)*v,C,R;if(f===fu)C=(p+u)*w,R=-2*w;else if(f===Pd)C=u*w,R=-1*w;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+f);return g[0]=2*m,g[4]=0,g[8]=0,g[12]=-S,g[1]=0,g[5]=2*v,g[9]=0,g[13]=-b,g[2]=0,g[6]=0,g[10]=R,g[14]=-C,g[3]=0,g[7]=0,g[11]=0,g[15]=1,this}equals(t){let e=this.elements,o=t.elements;for(let s=0;s<16;s++)if(e[s]!==o[s])return!1;return!0}fromArray(t,e=0){for(let o=0;o<16;o++)this.elements[o]=t[o+e];return this}toArray(t=[],e=0){let o=this.elements;return t[e]=o[0],t[e+1]=o[1],t[e+2]=o[2],t[e+3]=o[3],t[e+4]=o[4],t[e+5]=o[5],t[e+6]=o[6],t[e+7]=o[7],t[e+8]=o[8],t[e+9]=o[9],t[e+10]=o[10],t[e+11]=o[11],t[e+12]=o[12],t[e+13]=o[13],t[e+14]=o[14],t[e+15]=o[15],t}},Sc=new Rt,js=new vi,nV=new Rt(0,0,0),rV=new Rt(1,1,1),Gu=new Rt,id=new Rt,hs=new Rt,jT=new vi,QT=new ju,Ul=class n{constructor(t=0,e=0,o=0,s=n.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=e,this._z=o,this._order=s}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,o,s=this._order){return this._x=t,this._y=e,this._z=o,this._order=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,o=!0){let s=t.elements,u=s[0],p=s[4],f=s[8],g=s[1],m=s[5],v=s[9],w=s[2],S=s[6],b=s[10];switch(e){case"XYZ":this._y=Math.asin(Yo(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(-v,b),this._z=Math.atan2(-p,u)):(this._x=Math.atan2(S,m),this._z=0);break;case"YXZ":this._x=Math.asin(-Yo(v,-1,1)),Math.abs(v)<.9999999?(this._y=Math.atan2(f,b),this._z=Math.atan2(g,m)):(this._y=Math.atan2(-w,u),this._z=0);break;case"ZXY":this._x=Math.asin(Yo(S,-1,1)),Math.abs(S)<.9999999?(this._y=Math.atan2(-w,b),this._z=Math.atan2(-p,m)):(this._y=0,this._z=Math.atan2(g,u));break;case"ZYX":this._y=Math.asin(-Yo(w,-1,1)),Math.abs(w)<.9999999?(this._x=Math.atan2(S,b),this._z=Math.atan2(g,u)):(this._x=0,this._z=Math.atan2(-p,m));break;case"YZX":this._z=Math.asin(Yo(g,-1,1)),Math.abs(g)<.9999999?(this._x=Math.atan2(-v,m),this._y=Math.atan2(-w,u)):(this._x=0,this._y=Math.atan2(f,b));break;case"XZY":this._z=Math.asin(-Yo(p,-1,1)),Math.abs(p)<.9999999?(this._x=Math.atan2(S,m),this._y=Math.atan2(f,u)):(this._x=Math.atan2(-v,b),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,o===!0&&this._onChangeCallback(),this}setFromQuaternion(t,e,o){return jT.makeRotationFromQuaternion(t),this.setFromRotationMatrix(jT,e,o)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return QT.setFromEuler(this),this.setFromQuaternion(QT,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],t[3]!==void 0&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};Ul.DEFAULT_ORDER="XYZ";var Od=class{constructor(){this.mask=1}set(t){this.mask=(1<<t|0)>>>0}enable(t){this.mask|=1<<t|0}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t|0}disable(t){this.mask&=~(1<<t|0)}disableAll(){this.mask=0}test(t){return(this.mask&t.mask)!==0}isEnabled(t){return(this.mask&(1<<t|0))!==0}},iV=0,tC=new Rt,Mc=new ju,iu=new vi,od=new Rt,eh=new Rt,oV=new Rt,sV=new ju,eC=new Rt(1,0,0),nC=new Rt(0,1,0),rC=new Rt(0,0,1),aV={type:"added"},uV={type:"removed"},Dy={type:"childadded",child:null},Fy={type:"childremoved",child:null},ra=class n extends Ju{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:iV++}),this.uuid=Zu(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=n.DEFAULT_UP.clone();let t=new Rt,e=new Ul,o=new ju,s=new Rt(1,1,1);function u(){o.setFromEuler(e,!1)}function p(){e.setFromQuaternion(o,void 0,!1)}e._onChange(u),o._onChange(p),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:o},scale:{configurable:!0,enumerable:!0,value:s},modelViewMatrix:{value:new vi},normalMatrix:{value:new nn}}),this.matrix=new vi,this.matrixWorld=new vi,this.matrixAutoUpdate=n.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=n.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Od,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,e){this.quaternion.setFromAxisAngle(t,e)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,e){return Mc.setFromAxisAngle(t,e),this.quaternion.multiply(Mc),this}rotateOnWorldAxis(t,e){return Mc.setFromAxisAngle(t,e),this.quaternion.premultiply(Mc),this}rotateX(t){return this.rotateOnAxis(eC,t)}rotateY(t){return this.rotateOnAxis(nC,t)}rotateZ(t){return this.rotateOnAxis(rC,t)}translateOnAxis(t,e){return tC.copy(t).applyQuaternion(this.quaternion),this.position.add(tC.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(eC,t)}translateY(t){return this.translateOnAxis(nC,t)}translateZ(t){return this.translateOnAxis(rC,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(iu.copy(this.matrixWorld).invert())}lookAt(t,e,o){t.isVector3?od.copy(t):od.set(t,e,o);let s=this.parent;this.updateWorldMatrix(!0,!1),eh.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?iu.lookAt(eh,od,this.up):iu.lookAt(od,eh,this.up),this.quaternion.setFromRotationMatrix(iu),s&&(iu.extractRotation(s.matrixWorld),Mc.setFromRotationMatrix(iu),this.quaternion.premultiply(Mc.invert()))}add(t){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return t===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(t.parent!==null&&t.parent.remove(t),t.parent=this,this.children.push(t),t.dispatchEvent(aV),Dy.child=t,this.dispatchEvent(Dy),Dy.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)}remove(t){if(arguments.length>1){for(let o=0;o<arguments.length;o++)this.remove(arguments[o]);return this}let e=this.children.indexOf(t);return e!==-1&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(uV),Fy.child=t,this.dispatchEvent(Fy),Fy.child=null),this}removeFromParent(){let t=this.parent;return t!==null&&t.remove(this),this}clear(){return this.remove(...this.children)}attach(t){return this.updateWorldMatrix(!0,!1),iu.copy(this.matrixWorld).invert(),t.parent!==null&&(t.parent.updateWorldMatrix(!0,!1),iu.multiply(t.parent.matrixWorld)),t.applyMatrix4(iu),this.add(t),t.updateWorldMatrix(!1,!0),this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,e){if(this[t]===e)return this;for(let o=0,s=this.children.length;o<s;o++){let p=this.children[o].getObjectByProperty(t,e);if(p!==void 0)return p}}getObjectsByProperty(t,e,o=[]){this[t]===e&&o.push(this);let s=this.children;for(let u=0,p=s.length;u<p;u++)s[u].getObjectsByProperty(t,e,o);return o}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(eh,t,oV),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(eh,sV,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);let e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()}raycast(){}traverse(t){t(this);let e=this.children;for(let o=0,s=e.length;o<s;o++)e[o].traverse(t)}traverseVisible(t){if(this.visible===!1)return;t(this);let e=this.children;for(let o=0,s=e.length;o<s;o++)e[o].traverseVisible(t)}traverseAncestors(t){let e=this.parent;e!==null&&(t(e),e.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,t=!0);let e=this.children;for(let o=0,s=e.length;o<s;o++){let u=e[o];(u.matrixWorldAutoUpdate===!0||t===!0)&&u.updateMatrixWorld(t)}}updateWorldMatrix(t,e){let o=this.parent;if(t===!0&&o!==null&&o.matrixWorldAutoUpdate===!0&&o.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),e===!0){let s=this.children;for(let u=0,p=s.length;u<p;u++){let f=s[u];f.matrixWorldAutoUpdate===!0&&f.updateWorldMatrix(!1,!0)}}}toJSON(t){let e=t===void 0||typeof t=="string",o={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},o.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});let s={};s.uuid=this.uuid,s.type=this.type,this.name!==""&&(s.name=this.name),this.castShadow===!0&&(s.castShadow=!0),this.receiveShadow===!0&&(s.receiveShadow=!0),this.visible===!1&&(s.visible=!1),this.frustumCulled===!1&&(s.frustumCulled=!1),this.renderOrder!==0&&(s.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(s.userData=this.userData),s.layers=this.layers.mask,s.matrix=this.matrix.toArray(),s.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(s.matrixAutoUpdate=!1),this.isInstancedMesh&&(s.type="InstancedMesh",s.count=this.count,s.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(s.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(s.type="BatchedMesh",s.perObjectFrustumCulled=this.perObjectFrustumCulled,s.sortObjects=this.sortObjects,s.drawRanges=this._drawRanges,s.reservedRanges=this._reservedRanges,s.visibility=this._visibility,s.active=this._active,s.bounds=this._bounds.map(f=>({boxInitialized:f.boxInitialized,boxMin:f.box.min.toArray(),boxMax:f.box.max.toArray(),sphereInitialized:f.sphereInitialized,sphereRadius:f.sphere.radius,sphereCenter:f.sphere.center.toArray()})),s.maxGeometryCount=this._maxGeometryCount,s.maxVertexCount=this._maxVertexCount,s.maxIndexCount=this._maxIndexCount,s.geometryInitialized=this._geometryInitialized,s.geometryCount=this._geometryCount,s.matricesTexture=this._matricesTexture.toJSON(t),this.boundingSphere!==null&&(s.boundingSphere={center:s.boundingSphere.center.toArray(),radius:s.boundingSphere.radius}),this.boundingBox!==null&&(s.boundingBox={min:s.boundingBox.min.toArray(),max:s.boundingBox.max.toArray()}));function u(f,g){return f[g.uuid]===void 0&&(f[g.uuid]=g.toJSON(t)),g.uuid}if(this.isScene)this.background&&(this.background.isColor?s.background=this.background.toJSON():this.background.isTexture&&(s.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(s.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){s.geometry=u(t.geometries,this.geometry);let f=this.geometry.parameters;if(f!==void 0&&f.shapes!==void 0){let g=f.shapes;if(Array.isArray(g))for(let m=0,v=g.length;m<v;m++){let w=g[m];u(t.shapes,w)}else u(t.shapes,g)}}if(this.isSkinnedMesh&&(s.bindMode=this.bindMode,s.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(u(t.skeletons,this.skeleton),s.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let f=[];for(let g=0,m=this.material.length;g<m;g++)f.push(u(t.materials,this.material[g]));s.material=f}else s.material=u(t.materials,this.material);if(this.children.length>0){s.children=[];for(let f=0;f<this.children.length;f++)s.children.push(this.children[f].toJSON(t).object)}if(this.animations.length>0){s.animations=[];for(let f=0;f<this.animations.length;f++){let g=this.animations[f];s.animations.push(u(t.animations,g))}}if(e){let f=p(t.geometries),g=p(t.materials),m=p(t.textures),v=p(t.images),w=p(t.shapes),S=p(t.skeletons),b=p(t.animations),C=p(t.nodes);f.length>0&&(o.geometries=f),g.length>0&&(o.materials=g),m.length>0&&(o.textures=m),v.length>0&&(o.images=v),w.length>0&&(o.shapes=w),S.length>0&&(o.skeletons=S),b.length>0&&(o.animations=b),C.length>0&&(o.nodes=C)}return o.object=s,o;function p(f){let g=[];for(let m in f){let v=f[m];delete v.metadata,g.push(v)}return g}}clone(t){return new this.constructor().copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),e===!0)for(let o=0;o<t.children.length;o++){let s=t.children[o];this.add(s.clone())}return this}};ra.DEFAULT_UP=new Rt(0,1,0);ra.DEFAULT_MATRIX_AUTO_UPDATE=!0;ra.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var Qs=new Rt,ou=new Rt,Uy=new Rt,su=new Rt,bc=new Rt,Ac=new Rt,iC=new Rt,By=new Rt,zy=new Rt,Gy=new Rt,Nl=class n{constructor(t=new Rt,e=new Rt,o=new Rt){this.a=t,this.b=e,this.c=o}static getNormal(t,e,o,s){s.subVectors(o,e),Qs.subVectors(t,e),s.cross(Qs);let u=s.lengthSq();return u>0?s.multiplyScalar(1/Math.sqrt(u)):s.set(0,0,0)}static getBarycoord(t,e,o,s,u){Qs.subVectors(s,e),ou.subVectors(o,e),Uy.subVectors(t,e);let p=Qs.dot(Qs),f=Qs.dot(ou),g=Qs.dot(Uy),m=ou.dot(ou),v=ou.dot(Uy),w=p*m-f*f;if(w===0)return u.set(0,0,0),null;let S=1/w,b=(m*g-f*v)*S,C=(p*v-f*g)*S;return u.set(1-b-C,C,b)}static containsPoint(t,e,o,s){return this.getBarycoord(t,e,o,s,su)===null?!1:su.x>=0&&su.y>=0&&su.x+su.y<=1}static getInterpolation(t,e,o,s,u,p,f,g){return this.getBarycoord(t,e,o,s,su)===null?(g.x=0,g.y=0,"z"in g&&(g.z=0),"w"in g&&(g.w=0),null):(g.setScalar(0),g.addScaledVector(u,su.x),g.addScaledVector(p,su.y),g.addScaledVector(f,su.z),g)}static isFrontFacing(t,e,o,s){return Qs.subVectors(o,e),ou.subVectors(t,e),Qs.cross(ou).dot(s)<0}set(t,e,o){return this.a.copy(t),this.b.copy(e),this.c.copy(o),this}setFromPointsAndIndices(t,e,o,s){return this.a.copy(t[e]),this.b.copy(t[o]),this.c.copy(t[s]),this}setFromAttributeAndIndices(t,e,o,s){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,o),this.c.fromBufferAttribute(t,s),this}clone(){return new this.constructor().copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return Qs.subVectors(this.c,this.b),ou.subVectors(this.a,this.b),Qs.cross(ou).length()*.5}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return n.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return n.getBarycoord(t,this.a,this.b,this.c,e)}getInterpolation(t,e,o,s,u){return n.getInterpolation(t,this.a,this.b,this.c,e,o,s,u)}containsPoint(t){return n.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return n.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){let o=this.a,s=this.b,u=this.c,p,f;bc.subVectors(s,o),Ac.subVectors(u,o),By.subVectors(t,o);let g=bc.dot(By),m=Ac.dot(By);if(g<=0&&m<=0)return e.copy(o);zy.subVectors(t,s);let v=bc.dot(zy),w=Ac.dot(zy);if(v>=0&&w<=v)return e.copy(s);let S=g*w-v*m;if(S<=0&&g>=0&&v<=0)return p=g/(g-v),e.copy(o).addScaledVector(bc,p);Gy.subVectors(t,u);let b=bc.dot(Gy),C=Ac.dot(Gy);if(C>=0&&b<=C)return e.copy(u);let R=b*m-g*C;if(R<=0&&m>=0&&C<=0)return f=m/(m-C),e.copy(o).addScaledVector(Ac,f);let x=v*C-b*w;if(x<=0&&w-v>=0&&b-C>=0)return iC.subVectors(u,s),f=(w-v)/(w-v+(b-C)),e.copy(s).addScaledVector(iC,f);let E=1/(x+R+S);return p=R*E,f=S*E,e.copy(o).addScaledVector(bc,p).addScaledVector(Ac,f)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}},$C={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},ku={h:0,s:0,l:0},sd={h:0,s:0,l:0};function ky(n,t,e){return e<0&&(e+=1),e>1&&(e-=1),e<1/6?n+(t-n)*6*e:e<1/2?t:e<2/3?n+(t-n)*6*(2/3-e):n}var ar=class{constructor(t,e,o){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,e,o)}set(t,e,o){if(e===void 0&&o===void 0){let s=t;s&&s.isColor?this.copy(s):typeof s=="number"?this.setHex(s):typeof s=="string"&&this.setStyle(s)}else this.setRGB(t,e,o);return this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=ba){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(t&255)/255,xr.toWorkingColorSpace(this,e),this}setRGB(t,e,o,s=xr.workingColorSpace){return this.r=t,this.g=e,this.b=o,xr.toWorkingColorSpace(this,s),this}setHSL(t,e,o,s=xr.workingColorSpace){if(t=K6(t,1),e=Yo(e,0,1),o=Yo(o,0,1),e===0)this.r=this.g=this.b=o;else{let u=o<=.5?o*(1+e):o+e-o*e,p=2*o-u;this.r=ky(p,u,t+1/3),this.g=ky(p,u,t),this.b=ky(p,u,t-1/3)}return xr.toWorkingColorSpace(this,s),this}setStyle(t,e=ba){function o(u){u!==void 0&&parseFloat(u)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}let s;if(s=/^(\w+)\(([^\)]*)\)/.exec(t)){let u,p=s[1],f=s[2];switch(p){case"rgb":case"rgba":if(u=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(f))return o(u[4]),this.setRGB(Math.min(255,parseInt(u[1],10))/255,Math.min(255,parseInt(u[2],10))/255,Math.min(255,parseInt(u[3],10))/255,e);if(u=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(f))return o(u[4]),this.setRGB(Math.min(100,parseInt(u[1],10))/100,Math.min(100,parseInt(u[2],10))/100,Math.min(100,parseInt(u[3],10))/100,e);break;case"hsl":case"hsla":if(u=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(f))return o(u[4]),this.setHSL(parseFloat(u[1])/360,parseFloat(u[2])/100,parseFloat(u[3])/100,e);break;default:console.warn("THREE.Color: Unknown color model "+t)}}else if(s=/^\#([A-Fa-f\d]+)$/.exec(t)){let u=s[1],p=u.length;if(p===3)return this.setRGB(parseInt(u.charAt(0),16)/15,parseInt(u.charAt(1),16)/15,parseInt(u.charAt(2),16)/15,e);if(p===6)return this.setHex(parseInt(u,16),e);console.warn("THREE.Color: Invalid hex color "+t)}else if(t&&t.length>0)return this.setColorName(t,e);return this}setColorName(t,e=ba){let o=$C[t.toLowerCase()];return o!==void 0?this.setHex(o,e):console.warn("THREE.Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=kc(t.r),this.g=kc(t.g),this.b=kc(t.b),this}copyLinearToSRGB(t){return this.r=Ty(t.r),this.g=Ty(t.g),this.b=Ty(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=ba){return xr.fromWorkingColorSpace(uo.copy(this),t),Math.round(Yo(uo.r*255,0,255))*65536+Math.round(Yo(uo.g*255,0,255))*256+Math.round(Yo(uo.b*255,0,255))}getHexString(t=ba){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=xr.workingColorSpace){xr.fromWorkingColorSpace(uo.copy(this),e);let o=uo.r,s=uo.g,u=uo.b,p=Math.max(o,s,u),f=Math.min(o,s,u),g,m,v=(f+p)/2;if(f===p)g=0,m=0;else{let w=p-f;switch(m=v<=.5?w/(p+f):w/(2-p-f),p){case o:g=(s-u)/w+(s<u?6:0);break;case s:g=(u-o)/w+2;break;case u:g=(o-s)/w+4;break}g/=6}return t.h=g,t.s=m,t.l=v,t}getRGB(t,e=xr.workingColorSpace){return xr.fromWorkingColorSpace(uo.copy(this),e),t.r=uo.r,t.g=uo.g,t.b=uo.b,t}getStyle(t=ba){xr.fromWorkingColorSpace(uo.copy(this),t);let e=uo.r,o=uo.g,s=uo.b;return t!==ba?`color(${t} ${e.toFixed(3)} ${o.toFixed(3)} ${s.toFixed(3)})`:`rgb(${Math.round(e*255)},${Math.round(o*255)},${Math.round(s*255)})`}offsetHSL(t,e,o){return this.getHSL(ku),this.setHSL(ku.h+t,ku.s+e,ku.l+o)}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,o){return this.r=t.r+(e.r-t.r)*o,this.g=t.g+(e.g-t.g)*o,this.b=t.b+(e.b-t.b)*o,this}lerpHSL(t,e){this.getHSL(ku),t.getHSL(sd);let o=by(ku.h,sd.h,e),s=by(ku.s,sd.s,e),u=by(ku.l,sd.l,e);return this.setHSL(o,s,u),this}setFromVector3(t){return this.r=t.x,this.g=t.y,this.b=t.z,this}applyMatrix3(t){let e=this.r,o=this.g,s=this.b,u=t.elements;return this.r=u[0]*e+u[3]*o+u[6]*s,this.g=u[1]*e+u[4]*o+u[7]*s,this.b=u[2]*e+u[5]*o+u[8]*s,this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this}toArray(t=[],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}},uo=new ar;ar.NAMES=$C;var lV=0,Bl=class extends Ju{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:lV++}),this.uuid=Zu(),this.name="",this.type="Material",this.blending=Gc,this.side=Ku,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Jy,this.blendDst=jy,this.blendEquation=Il,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new ar(0,0,0),this.blendAlpha=0,this.depthFunc=Sd,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=WT,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=vc,this.stencilZFail=vc,this.stencilZPass=vc,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(t){this._alphaTest>0!=t>0&&this.version++,this._alphaTest=t}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(t!==void 0)for(let e in t){let o=t[e];if(o===void 0){console.warn(`THREE.Material: parameter '${e}' has value of undefined.`);continue}let s=this[e];if(s===void 0){console.warn(`THREE.Material: '${e}' is not a property of THREE.${this.type}.`);continue}s&&s.isColor?s.set(o):s&&s.isVector3&&o&&o.isVector3?s.copy(o):this[e]=o}}toJSON(t){let e=t===void 0||typeof t=="string";e&&(t={textures:{},images:{}});let o={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};o.uuid=this.uuid,o.type=this.type,this.name!==""&&(o.name=this.name),this.color&&this.color.isColor&&(o.color=this.color.getHex()),this.roughness!==void 0&&(o.roughness=this.roughness),this.metalness!==void 0&&(o.metalness=this.metalness),this.sheen!==void 0&&(o.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(o.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(o.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(o.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(o.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(o.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(o.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(o.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(o.shininess=this.shininess),this.clearcoat!==void 0&&(o.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(o.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(o.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(o.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(o.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,o.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.iridescence!==void 0&&(o.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(o.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(o.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(o.iridescenceMap=this.iridescenceMap.toJSON(t).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(o.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(t).uuid),this.anisotropy!==void 0&&(o.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(o.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(o.anisotropyMap=this.anisotropyMap.toJSON(t).uuid),this.map&&this.map.isTexture&&(o.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(o.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(o.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(o.lightMap=this.lightMap.toJSON(t).uuid,o.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(o.aoMap=this.aoMap.toJSON(t).uuid,o.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(o.bumpMap=this.bumpMap.toJSON(t).uuid,o.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(o.normalMap=this.normalMap.toJSON(t).uuid,o.normalMapType=this.normalMapType,o.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(o.displacementMap=this.displacementMap.toJSON(t).uuid,o.displacementScale=this.displacementScale,o.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(o.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(o.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(o.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(o.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(o.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(o.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(o.envMap=this.envMap.toJSON(t).uuid,this.combine!==void 0&&(o.combine=this.combine)),this.envMapRotation!==void 0&&(o.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(o.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(o.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(o.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(o.gradientMap=this.gradientMap.toJSON(t).uuid),this.transmission!==void 0&&(o.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(o.transmissionMap=this.transmissionMap.toJSON(t).uuid),this.thickness!==void 0&&(o.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(o.thicknessMap=this.thicknessMap.toJSON(t).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(o.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(o.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(o.size=this.size),this.shadowSide!==null&&(o.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(o.sizeAttenuation=this.sizeAttenuation),this.blending!==Gc&&(o.blending=this.blending),this.side!==Ku&&(o.side=this.side),this.vertexColors===!0&&(o.vertexColors=!0),this.opacity<1&&(o.opacity=this.opacity),this.transparent===!0&&(o.transparent=!0),this.blendSrc!==Jy&&(o.blendSrc=this.blendSrc),this.blendDst!==jy&&(o.blendDst=this.blendDst),this.blendEquation!==Il&&(o.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(o.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(o.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(o.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(o.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(o.blendAlpha=this.blendAlpha),this.depthFunc!==Sd&&(o.depthFunc=this.depthFunc),this.depthTest===!1&&(o.depthTest=this.depthTest),this.depthWrite===!1&&(o.depthWrite=this.depthWrite),this.colorWrite===!1&&(o.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(o.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==WT&&(o.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(o.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(o.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==vc&&(o.stencilFail=this.stencilFail),this.stencilZFail!==vc&&(o.stencilZFail=this.stencilZFail),this.stencilZPass!==vc&&(o.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(o.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(o.rotation=this.rotation),this.polygonOffset===!0&&(o.polygonOffset=!0),this.polygonOffsetFactor!==0&&(o.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(o.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(o.linewidth=this.linewidth),this.dashSize!==void 0&&(o.dashSize=this.dashSize),this.gapSize!==void 0&&(o.gapSize=this.gapSize),this.scale!==void 0&&(o.scale=this.scale),this.dithering===!0&&(o.dithering=!0),this.alphaTest>0&&(o.alphaTest=this.alphaTest),this.alphaHash===!0&&(o.alphaHash=!0),this.alphaToCoverage===!0&&(o.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(o.premultipliedAlpha=!0),this.forceSinglePass===!0&&(o.forceSinglePass=!0),this.wireframe===!0&&(o.wireframe=!0),this.wireframeLinewidth>1&&(o.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(o.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(o.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(o.flatShading=!0),this.visible===!1&&(o.visible=!1),this.toneMapped===!1&&(o.toneMapped=!1),this.fog===!1&&(o.fog=!1),Object.keys(this.userData).length>0&&(o.userData=this.userData);function s(u){let p=[];for(let f in u){let g=u[f];delete g.metadata,p.push(g)}return p}if(e){let u=s(t.textures),p=s(t.images);u.length>0&&(o.textures=u),p.length>0&&(o.images=p)}return o}clone(){return new this.constructor().copy(this)}copy(t){this.name=t.name,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.blendColor.copy(t.blendColor),this.blendAlpha=t.blendAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;let e=t.clippingPlanes,o=null;if(e!==null){let s=e.length;o=new Array(s);for(let u=0;u!==s;++u)o[u]=e[u].clone()}return this.clippingPlanes=o,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaHash=t.alphaHash,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.forceSinglePass=t.forceSinglePass,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){t===!0&&this.version++}},Dd=class extends Bl{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new ar(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ul,this.combine=FC,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}};var hi=new Rt,ad=new Ye,gs=class{constructor(t,e,o=!1){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=t,this.itemSize=e,this.count=t!==void 0?t.length/e:0,this.normalized=o,this.usage=rv,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=cu,this.version=0}onUploadCallback(){}set needsUpdate(t){t===!0&&this.version++}get updateRange(){return YC("THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this.gpuType=t.gpuType,this}copyAt(t,e,o){t*=this.itemSize,o*=e.itemSize;for(let s=0,u=this.itemSize;s<u;s++)this.array[t+s]=e.array[o+s];return this}copyArray(t){return this.array.set(t),this}applyMatrix3(t){if(this.itemSize===2)for(let e=0,o=this.count;e<o;e++)ad.fromBufferAttribute(this,e),ad.applyMatrix3(t),this.setXY(e,ad.x,ad.y);else if(this.itemSize===3)for(let e=0,o=this.count;e<o;e++)hi.fromBufferAttribute(this,e),hi.applyMatrix3(t),this.setXYZ(e,hi.x,hi.y,hi.z);return this}applyMatrix4(t){for(let e=0,o=this.count;e<o;e++)hi.fromBufferAttribute(this,e),hi.applyMatrix4(t),this.setXYZ(e,hi.x,hi.y,hi.z);return this}applyNormalMatrix(t){for(let e=0,o=this.count;e<o;e++)hi.fromBufferAttribute(this,e),hi.applyNormalMatrix(t),this.setXYZ(e,hi.x,hi.y,hi.z);return this}transformDirection(t){for(let e=0,o=this.count;e<o;e++)hi.fromBufferAttribute(this,e),hi.transformDirection(t),this.setXYZ(e,hi.x,hi.y,hi.z);return this}set(t,e=0){return this.array.set(t,e),this}getComponent(t,e){let o=this.array[t*this.itemSize+e];return this.normalized&&(o=Ta(o,this.array)),o}setComponent(t,e,o){return this.normalized&&(o=_r(o,this.array)),this.array[t*this.itemSize+e]=o,this}getX(t){let e=this.array[t*this.itemSize];return this.normalized&&(e=Ta(e,this.array)),e}setX(t,e){return this.normalized&&(e=_r(e,this.array)),this.array[t*this.itemSize]=e,this}getY(t){let e=this.array[t*this.itemSize+1];return this.normalized&&(e=Ta(e,this.array)),e}setY(t,e){return this.normalized&&(e=_r(e,this.array)),this.array[t*this.itemSize+1]=e,this}getZ(t){let e=this.array[t*this.itemSize+2];return this.normalized&&(e=Ta(e,this.array)),e}setZ(t,e){return this.normalized&&(e=_r(e,this.array)),this.array[t*this.itemSize+2]=e,this}getW(t){let e=this.array[t*this.itemSize+3];return this.normalized&&(e=Ta(e,this.array)),e}setW(t,e){return this.normalized&&(e=_r(e,this.array)),this.array[t*this.itemSize+3]=e,this}setXY(t,e,o){return t*=this.itemSize,this.normalized&&(e=_r(e,this.array),o=_r(o,this.array)),this.array[t+0]=e,this.array[t+1]=o,this}setXYZ(t,e,o,s){return t*=this.itemSize,this.normalized&&(e=_r(e,this.array),o=_r(o,this.array),s=_r(s,this.array)),this.array[t+0]=e,this.array[t+1]=o,this.array[t+2]=s,this}setXYZW(t,e,o,s,u){return t*=this.itemSize,this.normalized&&(e=_r(e,this.array),o=_r(o,this.array),s=_r(s,this.array),u=_r(u,this.array)),this.array[t+0]=e,this.array[t+1]=o,this.array[t+2]=s,this.array[t+3]=u,this}onUpload(t){return this.onUploadCallback=t,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let t={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(t.name=this.name),this.usage!==rv&&(t.usage=this.usage),t}};var Fd=class extends gs{constructor(t,e,o){super(new Uint16Array(t),e,o)}};var Ud=class extends gs{constructor(t,e,o){super(new Uint32Array(t),e,o)}};var hu=class extends gs{constructor(t,e,o){super(new Float32Array(t),e,o)}},cV=0,Ds=new vi,qy=new ra,Tc=new Rt,ps=new Fl,nh=new Fl,Bi=new Rt,Qu=class n extends Ju{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:cV++}),this.uuid=Zu(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(t){return Array.isArray(t)?this.index=new(XC(t)?Ud:Fd)(t,1):this.index=t,this}getAttribute(t){return this.attributes[t]}setAttribute(t,e){return this.attributes[t]=e,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return this.attributes[t]!==void 0}addGroup(t,e,o=0){this.groups.push({start:t,count:e,materialIndex:o})}clearGroups(){this.groups=[]}setDrawRange(t,e){this.drawRange.start=t,this.drawRange.count=e}applyMatrix4(t){let e=this.attributes.position;e!==void 0&&(e.applyMatrix4(t),e.needsUpdate=!0);let o=this.attributes.normal;if(o!==void 0){let u=new nn().getNormalMatrix(t);o.applyNormalMatrix(u),o.needsUpdate=!0}let s=this.attributes.tangent;return s!==void 0&&(s.transformDirection(t),s.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(t){return Ds.makeRotationFromQuaternion(t),this.applyMatrix4(Ds),this}rotateX(t){return Ds.makeRotationX(t),this.applyMatrix4(Ds),this}rotateY(t){return Ds.makeRotationY(t),this.applyMatrix4(Ds),this}rotateZ(t){return Ds.makeRotationZ(t),this.applyMatrix4(Ds),this}translate(t,e,o){return Ds.makeTranslation(t,e,o),this.applyMatrix4(Ds),this}scale(t,e,o){return Ds.makeScale(t,e,o),this.applyMatrix4(Ds),this}lookAt(t){return qy.lookAt(t),qy.updateMatrix(),this.applyMatrix4(qy.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Tc).negate(),this.translate(Tc.x,Tc.y,Tc.z),this}setFromPoints(t){let e=[];for(let o=0,s=t.length;o<s;o++){let u=t[o];e.push(u.x,u.y,u.z||0)}return this.setAttribute("position",new hu(e,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Fl);let t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new Rt(-1/0,-1/0,-1/0),new Rt(1/0,1/0,1/0));return}if(t!==void 0){if(this.boundingBox.setFromBufferAttribute(t),e)for(let o=0,s=e.length;o<s;o++){let u=e[o];ps.setFromBufferAttribute(u),this.morphTargetsRelative?(Bi.addVectors(this.boundingBox.min,ps.min),this.boundingBox.expandByPoint(Bi),Bi.addVectors(this.boundingBox.max,ps.max),this.boundingBox.expandByPoint(Bi)):(this.boundingBox.expandByPoint(ps.min),this.boundingBox.expandByPoint(ps.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new uh);let t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new Rt,1/0);return}if(t){let o=this.boundingSphere.center;if(ps.setFromBufferAttribute(t),e)for(let u=0,p=e.length;u<p;u++){let f=e[u];nh.setFromBufferAttribute(f),this.morphTargetsRelative?(Bi.addVectors(ps.min,nh.min),ps.expandByPoint(Bi),Bi.addVectors(ps.max,nh.max),ps.expandByPoint(Bi)):(ps.expandByPoint(nh.min),ps.expandByPoint(nh.max))}ps.getCenter(o);let s=0;for(let u=0,p=t.count;u<p;u++)Bi.fromBufferAttribute(t,u),s=Math.max(s,o.distanceToSquared(Bi));if(e)for(let u=0,p=e.length;u<p;u++){let f=e[u],g=this.morphTargetsRelative;for(let m=0,v=f.count;m<v;m++)Bi.fromBufferAttribute(f,m),g&&(Tc.fromBufferAttribute(t,m),Bi.add(Tc)),s=Math.max(s,o.distanceToSquared(Bi))}this.boundingSphere.radius=Math.sqrt(s),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let t=this.index,e=this.attributes;if(t===null||e.position===void 0||e.normal===void 0||e.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}let o=e.position,s=e.normal,u=e.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new gs(new Float32Array(4*o.count),4));let p=this.getAttribute("tangent"),f=[],g=[];for(let D=0;D<o.count;D++)f[D]=new Rt,g[D]=new Rt;let m=new Rt,v=new Rt,w=new Rt,S=new Ye,b=new Ye,C=new Ye,R=new Rt,x=new Rt;function E(D,xt,B){m.fromBufferAttribute(o,D),v.fromBufferAttribute(o,xt),w.fromBufferAttribute(o,B),S.fromBufferAttribute(u,D),b.fromBufferAttribute(u,xt),C.fromBufferAttribute(u,B),v.sub(m),w.sub(m),b.sub(S),C.sub(S);let j=1/(b.x*C.y-C.x*b.y);isFinite(j)&&(R.copy(v).multiplyScalar(C.y).addScaledVector(w,-b.y).multiplyScalar(j),x.copy(w).multiplyScalar(b.x).addScaledVector(v,-C.x).multiplyScalar(j),f[D].add(R),f[xt].add(R),f[B].add(R),g[D].add(x),g[xt].add(x),g[B].add(x))}let I=this.groups;I.length===0&&(I=[{start:0,count:t.count}]);for(let D=0,xt=I.length;D<xt;++D){let B=I[D],j=B.start,K=B.count;for(let Dt=j,Q=j+K;Dt<Q;Dt+=3)E(t.getX(Dt+0),t.getX(Dt+1),t.getX(Dt+2))}let A=new Rt,F=new Rt,V=new Rt,X=new Rt;function q(D){V.fromBufferAttribute(s,D),X.copy(V);let xt=f[D];A.copy(xt),A.sub(V.multiplyScalar(V.dot(xt))).normalize(),F.crossVectors(X,xt);let j=F.dot(g[D])<0?-1:1;p.setXYZW(D,A.x,A.y,A.z,j)}for(let D=0,xt=I.length;D<xt;++D){let B=I[D],j=B.start,K=B.count;for(let Dt=j,Q=j+K;Dt<Q;Dt+=3)q(t.getX(Dt+0)),q(t.getX(Dt+1)),q(t.getX(Dt+2))}}computeVertexNormals(){let t=this.index,e=this.getAttribute("position");if(e!==void 0){let o=this.getAttribute("normal");if(o===void 0)o=new gs(new Float32Array(e.count*3),3),this.setAttribute("normal",o);else for(let S=0,b=o.count;S<b;S++)o.setXYZ(S,0,0,0);let s=new Rt,u=new Rt,p=new Rt,f=new Rt,g=new Rt,m=new Rt,v=new Rt,w=new Rt;if(t)for(let S=0,b=t.count;S<b;S+=3){let C=t.getX(S+0),R=t.getX(S+1),x=t.getX(S+2);s.fromBufferAttribute(e,C),u.fromBufferAttribute(e,R),p.fromBufferAttribute(e,x),v.subVectors(p,u),w.subVectors(s,u),v.cross(w),f.fromBufferAttribute(o,C),g.fromBufferAttribute(o,R),m.fromBufferAttribute(o,x),f.add(v),g.add(v),m.add(v),o.setXYZ(C,f.x,f.y,f.z),o.setXYZ(R,g.x,g.y,g.z),o.setXYZ(x,m.x,m.y,m.z)}else for(let S=0,b=e.count;S<b;S+=3)s.fromBufferAttribute(e,S+0),u.fromBufferAttribute(e,S+1),p.fromBufferAttribute(e,S+2),v.subVectors(p,u),w.subVectors(s,u),v.cross(w),o.setXYZ(S+0,v.x,v.y,v.z),o.setXYZ(S+1,v.x,v.y,v.z),o.setXYZ(S+2,v.x,v.y,v.z);this.normalizeNormals(),o.needsUpdate=!0}}normalizeNormals(){let t=this.attributes.normal;for(let e=0,o=t.count;e<o;e++)Bi.fromBufferAttribute(t,e),Bi.normalize(),t.setXYZ(e,Bi.x,Bi.y,Bi.z)}toNonIndexed(){function t(f,g){let m=f.array,v=f.itemSize,w=f.normalized,S=new m.constructor(g.length*v),b=0,C=0;for(let R=0,x=g.length;R<x;R++){f.isInterleavedBufferAttribute?b=g[R]*f.data.stride+f.offset:b=g[R]*v;for(let E=0;E<v;E++)S[C++]=m[b++]}return new gs(S,v,w)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let e=new n,o=this.index.array,s=this.attributes;for(let f in s){let g=s[f],m=t(g,o);e.setAttribute(f,m)}let u=this.morphAttributes;for(let f in u){let g=[],m=u[f];for(let v=0,w=m.length;v<w;v++){let S=m[v],b=t(S,o);g.push(b)}e.morphAttributes[f]=g}e.morphTargetsRelative=this.morphTargetsRelative;let p=this.groups;for(let f=0,g=p.length;f<g;f++){let m=p[f];e.addGroup(m.start,m.count,m.materialIndex)}return e}toJSON(){let t={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,this.name!==""&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),this.parameters!==void 0){let g=this.parameters;for(let m in g)g[m]!==void 0&&(t[m]=g[m]);return t}t.data={attributes:{}};let e=this.index;e!==null&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});let o=this.attributes;for(let g in o){let m=o[g];t.data.attributes[g]=m.toJSON(t.data)}let s={},u=!1;for(let g in this.morphAttributes){let m=this.morphAttributes[g],v=[];for(let w=0,S=m.length;w<S;w++){let b=m[w];v.push(b.toJSON(t.data))}v.length>0&&(s[g]=v,u=!0)}u&&(t.data.morphAttributes=s,t.data.morphTargetsRelative=this.morphTargetsRelative);let p=this.groups;p.length>0&&(t.data.groups=JSON.parse(JSON.stringify(p)));let f=this.boundingSphere;return f!==null&&(t.data.boundingSphere={center:f.center.toArray(),radius:f.radius}),t}clone(){return new this.constructor().copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let e={};this.name=t.name;let o=t.index;o!==null&&this.setIndex(o.clone(e));let s=t.attributes;for(let m in s){let v=s[m];this.setAttribute(m,v.clone(e))}let u=t.morphAttributes;for(let m in u){let v=[],w=u[m];for(let S=0,b=w.length;S<b;S++)v.push(w[S].clone(e));this.morphAttributes[m]=v}this.morphTargetsRelative=t.morphTargetsRelative;let p=t.groups;for(let m=0,v=p.length;m<v;m++){let w=p[m];this.addGroup(w.start,w.count,w.materialIndex)}let f=t.boundingBox;f!==null&&(this.boundingBox=f.clone());let g=t.boundingSphere;return g!==null&&(this.boundingSphere=g.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}},oC=new vi,bl=new lv,ud=new uh,sC=new Rt,Cc=new Rt,Pc=new Rt,Ic=new Rt,Hy=new Rt,ld=new Rt,cd=new Ye,fd=new Ye,hd=new Ye,aC=new Rt,uC=new Rt,lC=new Rt,pd=new Rt,dd=new Rt,na=class extends ra{constructor(t=new Qu,e=new Dd){super(),this.isMesh=!0,this.type="Mesh",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),t.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),t.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}updateMorphTargets(){let e=this.geometry.morphAttributes,o=Object.keys(e);if(o.length>0){let s=e[o[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let u=0,p=s.length;u<p;u++){let f=s[u].name||String(u);this.morphTargetInfluences.push(0),this.morphTargetDictionary[f]=u}}}}getVertexPosition(t,e){let o=this.geometry,s=o.attributes.position,u=o.morphAttributes.position,p=o.morphTargetsRelative;e.fromBufferAttribute(s,t);let f=this.morphTargetInfluences;if(u&&f){ld.set(0,0,0);for(let g=0,m=u.length;g<m;g++){let v=f[g],w=u[g];v!==0&&(Hy.fromBufferAttribute(w,t),p?ld.addScaledVector(Hy,v):ld.addScaledVector(Hy.sub(e),v))}e.add(ld)}return e}raycast(t,e){let o=this.geometry,s=this.material,u=this.matrixWorld;s!==void 0&&(o.boundingSphere===null&&o.computeBoundingSphere(),ud.copy(o.boundingSphere),ud.applyMatrix4(u),bl.copy(t.ray).recast(t.near),!(ud.containsPoint(bl.origin)===!1&&(bl.intersectSphere(ud,sC)===null||bl.origin.distanceToSquared(sC)>(t.far-t.near)**2))&&(oC.copy(u).invert(),bl.copy(t.ray).applyMatrix4(oC),!(o.boundingBox!==null&&bl.intersectsBox(o.boundingBox)===!1)&&this._computeIntersections(t,e,bl)))}_computeIntersections(t,e,o){let s,u=this.geometry,p=this.material,f=u.index,g=u.attributes.position,m=u.attributes.uv,v=u.attributes.uv1,w=u.attributes.normal,S=u.groups,b=u.drawRange;if(f!==null)if(Array.isArray(p))for(let C=0,R=S.length;C<R;C++){let x=S[C],E=p[x.materialIndex],I=Math.max(x.start,b.start),A=Math.min(f.count,Math.min(x.start+x.count,b.start+b.count));for(let F=I,V=A;F<V;F+=3){let X=f.getX(F),q=f.getX(F+1),D=f.getX(F+2);s=gd(this,E,t,o,m,v,w,X,q,D),s&&(s.faceIndex=Math.floor(F/3),s.face.materialIndex=x.materialIndex,e.push(s))}}else{let C=Math.max(0,b.start),R=Math.min(f.count,b.start+b.count);for(let x=C,E=R;x<E;x+=3){let I=f.getX(x),A=f.getX(x+1),F=f.getX(x+2);s=gd(this,p,t,o,m,v,w,I,A,F),s&&(s.faceIndex=Math.floor(x/3),e.push(s))}}else if(g!==void 0)if(Array.isArray(p))for(let C=0,R=S.length;C<R;C++){let x=S[C],E=p[x.materialIndex],I=Math.max(x.start,b.start),A=Math.min(g.count,Math.min(x.start+x.count,b.start+b.count));for(let F=I,V=A;F<V;F+=3){let X=F,q=F+1,D=F+2;s=gd(this,E,t,o,m,v,w,X,q,D),s&&(s.faceIndex=Math.floor(F/3),s.face.materialIndex=x.materialIndex,e.push(s))}}else{let C=Math.max(0,b.start),R=Math.min(g.count,b.start+b.count);for(let x=C,E=R;x<E;x+=3){let I=x,A=x+1,F=x+2;s=gd(this,p,t,o,m,v,w,I,A,F),s&&(s.faceIndex=Math.floor(x/3),e.push(s))}}}};function fV(n,t,e,o,s,u,p,f){let g;if(t.side===$o?g=o.intersectTriangle(p,u,s,!0,f):g=o.intersectTriangle(s,u,p,t.side===Ku,f),g===null)return null;dd.copy(f),dd.applyMatrix4(n.matrixWorld);let m=e.ray.origin.distanceTo(dd);return m<e.near||m>e.far?null:{distance:m,point:dd.clone(),object:n}}function gd(n,t,e,o,s,u,p,f,g,m){n.getVertexPosition(f,Cc),n.getVertexPosition(g,Pc),n.getVertexPosition(m,Ic);let v=fV(n,t,e,o,Cc,Pc,Ic,pd);if(v){s&&(cd.fromBufferAttribute(s,f),fd.fromBufferAttribute(s,g),hd.fromBufferAttribute(s,m),v.uv=Nl.getInterpolation(pd,Cc,Pc,Ic,cd,fd,hd,new Ye)),u&&(cd.fromBufferAttribute(u,f),fd.fromBufferAttribute(u,g),hd.fromBufferAttribute(u,m),v.uv1=Nl.getInterpolation(pd,Cc,Pc,Ic,cd,fd,hd,new Ye)),p&&(aC.fromBufferAttribute(p,f),uC.fromBufferAttribute(p,g),lC.fromBufferAttribute(p,m),v.normal=Nl.getInterpolation(pd,Cc,Pc,Ic,aC,uC,lC,new Rt),v.normal.dot(o.direction)>0&&v.normal.multiplyScalar(-1));let w={a:f,b:g,c:m,normal:new Rt,materialIndex:0};Nl.getNormal(Cc,Pc,Ic,w.normal),v.face=w}return v}var lh=class n extends Qu{constructor(t=1,e=1,o=1,s=1,u=1,p=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:o,widthSegments:s,heightSegments:u,depthSegments:p};let f=this;s=Math.floor(s),u=Math.floor(u),p=Math.floor(p);let g=[],m=[],v=[],w=[],S=0,b=0;C("z","y","x",-1,-1,o,e,t,p,u,0),C("z","y","x",1,-1,o,e,-t,p,u,1),C("x","z","y",1,1,t,o,e,s,p,2),C("x","z","y",1,-1,t,o,-e,s,p,3),C("x","y","z",1,-1,t,e,o,s,u,4),C("x","y","z",-1,-1,t,e,-o,s,u,5),this.setIndex(g),this.setAttribute("position",new hu(m,3)),this.setAttribute("normal",new hu(v,3)),this.setAttribute("uv",new hu(w,2));function C(R,x,E,I,A,F,V,X,q,D,xt){let B=F/q,j=V/D,K=F/2,Dt=V/2,Q=X/2,At=q+1,Mt=D+1,Lt=0,pt=0,yt=new Rt;for(let J=0;J<Mt;J++){let Bt=J*j-Dt;for(let Gt=0;Gt<At;Gt++){let ae=Gt*B-K;yt[R]=ae*I,yt[x]=Bt*A,yt[E]=Q,m.push(yt.x,yt.y,yt.z),yt[R]=0,yt[x]=0,yt[E]=X>0?1:-1,v.push(yt.x,yt.y,yt.z),w.push(Gt/q),w.push(1-J/D),Lt+=1}}for(let J=0;J<D;J++)for(let Bt=0;Bt<q;Bt++){let Gt=S+Bt+At*J,ae=S+Bt+At*(J+1),ut=S+(Bt+1)+At*(J+1),Ut=S+(Bt+1)+At*J;g.push(Gt,ae,Ut),g.push(ae,ut,Ut),pt+=6}f.addGroup(b,pt,xt),b+=pt,S+=Lt}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new n(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}};function Xc(n){let t={};for(let e in n){t[e]={};for(let o in n[e]){let s=n[e][o];s&&(s.isColor||s.isMatrix3||s.isMatrix4||s.isVector2||s.isVector3||s.isVector4||s.isTexture||s.isQuaternion)?s.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),t[e][o]=null):t[e][o]=s.clone():Array.isArray(s)?t[e][o]=s.slice():t[e][o]=s}}return t}function So(n){let t={};for(let e=0;e<n.length;e++){let o=Xc(n[e]);for(let s in o)t[s]=o[s]}return t}function hV(n){let t=[];for(let e=0;e<n.length;e++)t.push(n[e].clone());return t}function ZC(n){return n.getRenderTarget()===null?n.outputColorSpace:xr.workingColorSpace}var pV={clone:Xc,merge:So},dV=`void main() {
26
+ }`;var Qe=_E(function(){return ke(Y,Se+"return "+Yt).apply(n,nt)});if(Qe.source=Yt,Dm(Qe))throw Qe;return Qe}function NF(l){return hr(l).toLowerCase()}function OF(l){return hr(l).toUpperCase()}function DF(l,h,y){if(l=hr(l),l&&(y||h===n))return Hh(l);if(!l||!(h=us(h)))return l;var T=Fo(l),O=Fo(h),Y=Bs(T,O),nt=Ri(T,O)+1;return Pu(T,Y,nt).join("")}function FF(l,h,y){if(l=hr(l),l&&(y||h===n))return l.slice(0,pa(l)+1);if(!l||!(h=us(h)))return l;var T=Fo(l),O=Ri(T,Fo(h))+1;return Pu(T,0,O).join("")}function UF(l,h,y){if(l=hr(l),l&&(y||h===n))return l.replace(Xe,"");if(!l||!(h=us(h)))return l;var T=Fo(l),O=Bs(T,Fo(h));return Pu(T,O).join("")}function BF(l,h){var y=D,T=xt;if(Gr(h)){var O="separator"in h?h.separator:O;y="length"in h?Ze(h.length):y,T="omission"in h?us(h.omission):T}l=hr(l);var Y=l.length;if(ka(l)){var nt=Fo(l);Y=nt.length}if(y>=Y)return l;var ct=y-qa(T);if(ct<1)return T;var _t=nt?Pu(nt,0,ct).join(""):l.slice(0,ct);if(O===n)return _t+T;if(nt&&(ct+=_t.length-ct),Fm(O)){if(l.slice(ct).search(O)){var zt,kt=_t;for(O.global||(O=os(O.source,hr(Qn.exec(O))+"g")),O.lastIndex=0;zt=O.exec(kt);)var Yt=zt.index;_t=_t.slice(0,Yt===n?ct:Yt)}}else if(l.indexOf(us(O),ct)!=ct){var pe=_t.lastIndexOf(O);pe>-1&&(_t=_t.slice(0,pe))}return _t+T}function zF(l){return l=hr(l),l&&G.test(l)?l.replace(wt,rs):l}var GF=rc(function(l,h,y){return l+(y?" ":"")+h.toUpperCase()}),zm=xx("toUpperCase");function vE(l,h,y){return l=hr(l),h=y?n:h,h===n?jl(l)?ui(l):He(l):l.match(h)||[]}var _E=an(function(l,h){try{return ie(l,n,h)}catch(y){return Dm(y)?y:new _e(y)}}),kF=Za(function(l,h){return Pi(h,function(y){y=wa(y),Ya(l,y,Nm(l[y],l))}),l});function qF(l){var h=l==null?0:l.length,y=Ne();return l=h?Mr(l,function(T){if(typeof T[1]!="function")throw new tr(s);return[y(T[0]),T[1]]}):[],an(function(T){for(var O=-1;++O<h;){var Y=l[O];if(ie(Y[0],this,T))return ie(Y[1],this,T)}})}function HF(l){return d2(Cs(l,m))}function Gm(l){return function(){return l}}function VF(l,h){return l==null||l!==l?h:l}var WF=wx(),XF=wx(!0);function Wo(l){return l}function km(l){return j1(typeof l=="function"?l:Cs(l,m))}function YF(l){return tx(Cs(l,m))}function $F(l,h){return ex(l,Cs(h,m))}var ZF=an(function(l,h){return function(y){return Lf(y,l,h)}}),KF=an(function(l,h){return function(y){return Lf(l,y,h)}});function qm(l,h,y){var T=Fi(h),O=Zh(h,T);y==null&&!(Gr(h)&&(O.length||!T.length))&&(y=h,h=l,l=this,O=Zh(h,Fi(h)));var Y=!(Gr(y)&&"chain"in y)||!!y.chain,nt=Ja(l);return Pi(O,function(ct){var _t=h[ct];l[ct]=_t,nt&&(l.prototype[ct]=function(){var zt=this.__chain__;if(Y||zt){var kt=l(this.__wrapped__),Yt=kt.__actions__=qo(this.__actions__);return Yt.push({func:_t,args:arguments,thisArg:l}),kt.__chain__=zt,kt}return _t.apply(l,Ge([this.value()],arguments))})}),l}function JF(){return Ur._===this&&(Ur._=Bo),this}function Hm(){}function jF(l){return l=Ze(l),an(function(h){return nx(h,l)})}var QF=xm(Mr),tU=xm(po),eU=xm(Ga);function xE(l){return Tm(l)?Es(wa(l)):R2(l)}function nU(l){return function(h){return l==null?n:yl(l,h)}}var rU=Mx(),iU=Mx(!0);function Vm(){return[]}function Wm(){return!1}function oU(){return{}}function sU(){return""}function aU(){return!0}function uU(l,h){if(l=Ze(l),l<1||l>Mt)return[];var y=yt,T=vr(l,yt);h=Ne(h),l-=yt;for(var O=di(T,h);++y<l;)h(y);return O}function lU(l){return Ve(l)?Mr(l,wa):ls(l)?[l]:qo(Gx(hr(l)))}function cU(l){var h=++Li;return hr(l)+h}var fU=ep(function(l,h){return l+h},0),hU=Em("ceil"),pU=ep(function(l,h){return l/h},1),dU=Em("floor");function gU(l){return l&&l.length?$h(l,Wo,sm):n}function mU(l,h){return l&&l.length?$h(l,Ne(h,2),sm):n}function yU(l){return bf(l,Wo)}function vU(l,h){return bf(l,Ne(h,2))}function _U(l){return l&&l.length?$h(l,Wo,cm):n}function xU(l,h){return l&&l.length?$h(l,Ne(h,2),cm):n}var EU=ep(function(l,h){return l*h},1),wU=Em("round"),SU=ep(function(l,h){return l-h},0);function MU(l){return l&&l.length?go(l,Wo):0}function bU(l,h){return l&&l.length?go(l,Ne(h,2)):0}return U.after=YD,U.ary=Jx,U.assign=O3,U.assignIn=fE,U.assignInWith=dp,U.assignWith=D3,U.at=F3,U.before=jx,U.bind=Nm,U.bindAll=kF,U.bindKey=Qx,U.castArray=o3,U.chain=$x,U.chunk=dO,U.compact=gO,U.concat=mO,U.cond=qF,U.conforms=HF,U.constant=Gm,U.countBy=MD,U.create=U3,U.curry=tE,U.curryRight=eE,U.debounce=nE,U.defaults=B3,U.defaultsDeep=z3,U.defer=$D,U.delay=ZD,U.difference=yO,U.differenceBy=vO,U.differenceWith=_O,U.drop=xO,U.dropRight=EO,U.dropRightWhile=wO,U.dropWhile=SO,U.fill=MO,U.filter=AD,U.flatMap=PD,U.flatMapDeep=ID,U.flatMapDepth=RD,U.flatten=Vx,U.flattenDeep=bO,U.flattenDepth=AO,U.flip=KD,U.flow=WF,U.flowRight=XF,U.fromPairs=TO,U.functions=X3,U.functionsIn=Y3,U.groupBy=LD,U.initial=PO,U.intersection=IO,U.intersectionBy=RO,U.intersectionWith=LO,U.invert=Z3,U.invertBy=K3,U.invokeMap=OD,U.iteratee=km,U.keyBy=DD,U.keys=Fi,U.keysIn=Vo,U.map=up,U.mapKeys=j3,U.mapValues=Q3,U.matches=YF,U.matchesProperty=$F,U.memoize=cp,U.merge=tF,U.mergeWith=hE,U.method=ZF,U.methodOf=KF,U.mixin=qm,U.negate=fp,U.nthArg=jF,U.omit=eF,U.omitBy=nF,U.once=JD,U.orderBy=FD,U.over=QF,U.overArgs=jD,U.overEvery=tU,U.overSome=eU,U.partial=Om,U.partialRight=rE,U.partition=UD,U.pick=rF,U.pickBy=pE,U.property=xE,U.propertyOf=nU,U.pull=FO,U.pullAll=Xx,U.pullAllBy=UO,U.pullAllWith=BO,U.pullAt=zO,U.range=rU,U.rangeRight=iU,U.rearg=QD,U.reject=GD,U.remove=GO,U.rest=t3,U.reverse=Rm,U.sampleSize=qD,U.set=oF,U.setWith=sF,U.shuffle=HD,U.slice=kO,U.sortBy=XD,U.sortedUniq=$O,U.sortedUniqBy=ZO,U.split=PF,U.spread=e3,U.tail=KO,U.take=JO,U.takeRight=jO,U.takeRightWhile=QO,U.takeWhile=tD,U.tap=gD,U.throttle=n3,U.thru=ap,U.toArray=uE,U.toPairs=dE,U.toPairsIn=gE,U.toPath=lU,U.toPlainObject=cE,U.transform=aF,U.unary=r3,U.union=eD,U.unionBy=nD,U.unionWith=rD,U.uniq=iD,U.uniqBy=oD,U.uniqWith=sD,U.unset=uF,U.unzip=Lm,U.unzipWith=Yx,U.update=lF,U.updateWith=cF,U.values=sc,U.valuesIn=fF,U.without=aD,U.words=vE,U.wrap=i3,U.xor=uD,U.xorBy=lD,U.xorWith=cD,U.zip=fD,U.zipObject=hD,U.zipObjectDeep=pD,U.zipWith=dD,U.entries=dE,U.entriesIn=gE,U.extend=fE,U.extendWith=dp,qm(U,U),U.add=fU,U.attempt=_E,U.camelCase=gF,U.capitalize=mE,U.ceil=hU,U.clamp=hF,U.clone=s3,U.cloneDeep=u3,U.cloneDeepWith=l3,U.cloneWith=a3,U.conformsTo=c3,U.deburr=yE,U.defaultTo=VF,U.divide=pU,U.endsWith=mF,U.eq=Vs,U.escape=yF,U.escapeRegExp=vF,U.every=bD,U.find=TD,U.findIndex=qx,U.findKey=G3,U.findLast=CD,U.findLastIndex=Hx,U.findLastKey=k3,U.floor=dU,U.forEach=Zx,U.forEachRight=Kx,U.forIn=q3,U.forInRight=H3,U.forOwn=V3,U.forOwnRight=W3,U.get=Um,U.gt=f3,U.gte=h3,U.has=$3,U.hasIn=Bm,U.head=Wx,U.identity=Wo,U.includes=ND,U.indexOf=CO,U.inRange=pF,U.invoke=J3,U.isArguments=xl,U.isArray=Ve,U.isArrayBuffer=p3,U.isArrayLike=Ho,U.isArrayLikeObject=ri,U.isBoolean=d3,U.isBuffer=Iu,U.isDate=g3,U.isElement=m3,U.isEmpty=y3,U.isEqual=v3,U.isEqualWith=_3,U.isError=Dm,U.isFinite=x3,U.isFunction=Ja,U.isInteger=iE,U.isLength=hp,U.isMap=oE,U.isMatch=E3,U.isMatchWith=w3,U.isNaN=S3,U.isNative=M3,U.isNil=A3,U.isNull=b3,U.isNumber=sE,U.isObject=Gr,U.isObjectLike=$r,U.isPlainObject=Bf,U.isRegExp=Fm,U.isSafeInteger=T3,U.isSet=aE,U.isString=pp,U.isSymbol=ls,U.isTypedArray=oc,U.isUndefined=C3,U.isWeakMap=P3,U.isWeakSet=I3,U.join=NO,U.kebabCase=_F,U.last=Is,U.lastIndexOf=OO,U.lowerCase=xF,U.lowerFirst=EF,U.lt=R3,U.lte=L3,U.max=gU,U.maxBy=mU,U.mean=yU,U.meanBy=vU,U.min=_U,U.minBy=xU,U.stubArray=Vm,U.stubFalse=Wm,U.stubObject=oU,U.stubString=sU,U.stubTrue=aU,U.multiply=EU,U.nth=DO,U.noConflict=JF,U.noop=Hm,U.now=lp,U.pad=wF,U.padEnd=SF,U.padStart=MF,U.parseInt=bF,U.random=dF,U.reduce=BD,U.reduceRight=zD,U.repeat=AF,U.replace=TF,U.result=iF,U.round=wU,U.runInContext=gt,U.sample=kD,U.size=VD,U.snakeCase=CF,U.some=WD,U.sortedIndex=qO,U.sortedIndexBy=HO,U.sortedIndexOf=VO,U.sortedLastIndex=WO,U.sortedLastIndexBy=XO,U.sortedLastIndexOf=YO,U.startCase=IF,U.startsWith=RF,U.subtract=SU,U.sum=MU,U.sumBy=bU,U.template=LF,U.times=uU,U.toFinite=ja,U.toInteger=Ze,U.toLength=lE,U.toLower=NF,U.toNumber=Rs,U.toSafeInteger=N3,U.toString=hr,U.toUpper=OF,U.trim=DF,U.trimEnd=FF,U.trimStart=UF,U.truncate=BF,U.unescape=zF,U.uniqueId=cU,U.upperCase=GF,U.upperFirst=zm,U.each=Zx,U.eachRight=Kx,U.first=Wx,qm(U,function(){var l={};return xa(U,function(h,y){sn.call(U.prototype,y)||(l[y]=h)}),l}(),{chain:!1}),U.VERSION=t,Pi(["bind","bindKey","curry","curryRight","partial","partialRight"],function(l){U[l].placeholder=U}),Pi(["drop","take"],function(l,h){i.prototype[l]=function(y){y=y===n?1:ni(Ze(y),0);var T=this.__filtered__&&!h?new i(this):this.clone();return T.__filtered__?T.__takeCount__=vr(y,T.__takeCount__):T.__views__.push({size:vr(y,yt),type:l+(T.__dir__<0?"Right":"")}),T},i.prototype[l+"Right"]=function(y){return this.reverse()[l](y).reverse()}}),Pi(["filter","map","takeWhile"],function(l,h){var y=h+1,T=y==K||y==Q;i.prototype[l]=function(O){var Y=this.clone();return Y.__iteratees__.push({iteratee:Ne(O,3),type:y}),Y.__filtered__=Y.__filtered__||T,Y}}),Pi(["head","last"],function(l,h){var y="take"+(h?"Right":"");i.prototype[l]=function(){return this[y](1).value()[0]}}),Pi(["initial","tail"],function(l,h){var y="drop"+(h?"":"Right");i.prototype[l]=function(){return this.__filtered__?new i(this):this[y](1)}}),i.prototype.compact=function(){return this.filter(Wo)},i.prototype.find=function(l){return this.filter(l).head()},i.prototype.findLast=function(l){return this.reverse().find(l)},i.prototype.invokeMap=an(function(l,h){return typeof l=="function"?new i(this):this.map(function(y){return Lf(y,l,h)})}),i.prototype.reject=function(l){return this.filter(fp(Ne(l)))},i.prototype.slice=function(l,h){l=Ze(l);var y=this;return y.__filtered__&&(l>0||h<0)?new i(y):(l<0?y=y.takeRight(-l):l&&(y=y.drop(l)),h!==n&&(h=Ze(h),y=h<0?y.dropRight(-h):y.take(h-l)),y)},i.prototype.takeRightWhile=function(l){return this.reverse().takeWhile(l).reverse()},i.prototype.toArray=function(){return this.take(yt)},xa(i.prototype,function(l,h){var y=/^(?:filter|find|map|reject)|While$/.test(h),T=/^(?:head|last)$/.test(h),O=U[T?"take"+(h=="last"?"Right":""):h],Y=T||/^find/.test(h);O&&(U.prototype[h]=function(){var nt=this.__wrapped__,ct=T?[1]:arguments,_t=nt instanceof i,zt=ct[0],kt=_t||Ve(nt),Yt=function(Fn){var $n=O.apply(U,Ge([Fn],ct));return T&&pe?$n[0]:$n};kt&&y&&typeof zt=="function"&&zt.length!=1&&(_t=kt=!1);var pe=this.__chain__,Se=!!this.__actions__.length,De=Y&&!pe,Qe=_t&&!Se;if(!Y&&kt){nt=Qe?nt:new i(this);var Fe=l.apply(nt,ct);return Fe.__actions__.push({func:ap,args:[Yt],thisArg:n}),new r(Fe,pe)}return De&&Qe?l.apply(this,ct):(Fe=this.thru(Yt),De?T?Fe.value()[0]:Fe.value():Fe)})}),Pi(["pop","push","shift","sort","splice","unshift"],function(l){var h=Nr[l],y=/^(?:push|sort|unshift)$/.test(l)?"tap":"thru",T=/^(?:pop|shift)$/.test(l);U.prototype[l]=function(){var O=arguments;if(T&&!this.__chain__){var Y=this.value();return h.apply(Ve(Y)?Y:[],O)}return this[y](function(nt){return h.apply(Ve(nt)?nt:[],O)})}}),xa(i.prototype,function(l,h){var y=U[h];if(y){var T=y.name+"";sn.call(ss,T)||(ss[T]=[]),ss[T].push({name:h,func:y})}}),ss[tp(n,R).name]=[{name:"wrapper",func:n}],i.prototype.clone=a,i.prototype.reverse=c,i.prototype.value=d,U.prototype.at=mD,U.prototype.chain=yD,U.prototype.commit=vD,U.prototype.next=_D,U.prototype.plant=ED,U.prototype.reverse=wD,U.prototype.toJSON=U.prototype.valueOf=U.prototype.value=SD,U.prototype.first=U.prototype.head,Su&&(U.prototype[Su]=xD),U},Ki=is();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(Ur._=Ki,define(function(){return Ki})):Lo?((Lo.exports=Ki)._=Ki,Sf._=Ki):Ur._=Ki}).call(xf)});var Itt=tn(xA(),1),Rtt=tn($p(),1),Ltt=tn(Jp(),1);function bA(n){return n.replace(/[A-Z]/g,t=>"_"+t.toLowerCase()).replace(/^_/,"")}function AA(n){let t={};for(let o in n)o.startsWith("on")&&(t[bA(o.slice(2))]=n[o],t[o]=n[o]);let e=o=>Ru(this,null,function*(){let{data:s}=o;if(t[s.type])try{let u=yield t[s.type](s.data);if(u!=null&&u.$transfer&&Array.isArray(u.$transfer)){let p=u.$transfer;delete u.$transfer,self.postMessage({type:""+s.type+"_result",key:s.key,data:u},p)}else self.postMessage({type:""+s.type+"_result",key:s.key,data:u})}catch(u){self.postMessage({type:""+s.type+"_result",key:s.key,error:u})}else self.postMessage({type:""+s.type+"_result",key:s.key,error:"no_event"})});return self.addEventListener("message",e),()=>{self.removeEventListener("message",e)}}var uwt=tn(Jp(),1);function eu(){return eu=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var o=arguments[e];for(var s in o)Object.prototype.hasOwnProperty.call(o,s)&&(t[s]=o[s])}return t},eu.apply(this,arguments)}var YEt=tn(J0(),1),$Et=tn($p(),1),ZEt=tn(Jp(),1),KEt=tn(iM(),1),JEt=tn(uM(),1),jEt=tn(pM(),1),QEt=tn(mM(),1),twt=tn(_M(),1),ewt=tn(wM(),1),nwt=tn(bM(),1),rwt=tn(YA(),1),iwt=tn($A(),1),Vi=tn(lT(),1);var HEt=tn(J0(),1);var zv="162";var KH=0,cT=1,JH=2;var DC=1,jH=2,au=3,Ku=0,$o=1,lu=2,Xu=0,Gc=1,fT=2,hT=3,pT=4,QH=5,Il=100,t6=101,e6=102,dT=103,gT=104,n6=200,r6=201,i6=202,o6=203,Jy=204,jy=205,s6=206,a6=207,u6=208,l6=209,c6=210,f6=211,h6=212,p6=213,d6=214,g6=0,m6=1,y6=2,Sd=3,v6=4,_6=5,x6=6,E6=7,FC=0,w6=1,S6=2,Yu=0,M6=1,b6=2,A6=3,T6=4,C6=5,P6=6,I6=7;var UC=300,Hc=301,Vc=302,Qy=303,tv=304,Wd=306,ev=1e3,ta=1001,nv=1002,Mo=1003,mT=1004;var jf=1005;var Xo=1006,yy=1007;var Ll=1008;var $u=1009,R6=1010,L6=1011,Gv=1012,BC=1013,Wu=1014,cu=1015,ah=1016,zC=1017,GC=1018,Ol=1020,N6=1021,ea=1023,O6=1024,D6=1025,Dl=1026,Wc=1027,F6=1028,kC=1029,U6=1030,qC=1031,HC=1033,vy=33776,_y=33777,xy=33778,Ey=33779,yT=35840,vT=35841,_T=35842,xT=35843,VC=36196,ET=37492,wT=37496,ST=37808,MT=37809,bT=37810,AT=37811,TT=37812,CT=37813,PT=37814,IT=37815,RT=37816,LT=37817,NT=37818,OT=37819,DT=37820,FT=37821,wy=36492,UT=36494,BT=36495,B6=36283,zT=36284,GT=36285,kT=36286;var Md=2300,bd=2301,Sy=2302,qT=2400,HT=2401,VT=2402;var z6=3200,G6=3201,k6=0,q6=1,Vu="",ba="srgb",tl="srgb-linear",kv="display-p3",Xd="display-p3-linear",Ad="linear",Lr="srgb",Td="rec709",Cd="p3";var vc=7680;var WT=519,H6=512,V6=513,W6=514,WC=515,X6=516,Y6=517,$6=518,Z6=519,rv=35044;var XT="300 es",iv=1035,fu=2e3,Pd=2001,Ju=class{addEventListener(t,e){this._listeners===void 0&&(this._listeners={});let o=this._listeners;o[t]===void 0&&(o[t]=[]),o[t].indexOf(e)===-1&&o[t].push(e)}hasEventListener(t,e){if(this._listeners===void 0)return!1;let o=this._listeners;return o[t]!==void 0&&o[t].indexOf(e)!==-1}removeEventListener(t,e){if(this._listeners===void 0)return;let s=this._listeners[t];if(s!==void 0){let u=s.indexOf(e);u!==-1&&s.splice(u,1)}}dispatchEvent(t){if(this._listeners===void 0)return;let o=this._listeners[t.type];if(o!==void 0){t.target=this;let s=o.slice(0);for(let u=0,p=s.length;u<p;u++)s[u].call(this,t);t.target=null}}},ao=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];var My=Math.PI/180,ov=180/Math.PI;function Zu(){let n=Math.random()*4294967295|0,t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,o=Math.random()*4294967295|0;return(ao[n&255]+ao[n>>8&255]+ao[n>>16&255]+ao[n>>24&255]+"-"+ao[t&255]+ao[t>>8&255]+"-"+ao[t>>16&15|64]+ao[t>>24&255]+"-"+ao[e&63|128]+ao[e>>8&255]+"-"+ao[e>>16&255]+ao[e>>24&255]+ao[o&255]+ao[o>>8&255]+ao[o>>16&255]+ao[o>>24&255]).toLowerCase()}function Yo(n,t,e){return Math.max(t,Math.min(e,n))}function K6(n,t){return(n%t+t)%t}function by(n,t,e){return(1-e)*n+e*t}function YT(n){return(n&n-1)===0&&n!==0}function sv(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function Ta(n,t){switch(t.constructor){case Float32Array:return n;case Uint32Array:return n/4294967295;case Uint16Array:return n/65535;case Uint8Array:return n/255;case Int32Array:return Math.max(n/2147483647,-1);case Int16Array:return Math.max(n/32767,-1);case Int8Array:return Math.max(n/127,-1);default:throw new Error("Invalid component type.")}}function _r(n,t){switch(t.constructor){case Float32Array:return n;case Uint32Array:return Math.round(n*4294967295);case Uint16Array:return Math.round(n*65535);case Uint8Array:return Math.round(n*255);case Int32Array:return Math.round(n*2147483647);case Int16Array:return Math.round(n*32767);case Int8Array:return Math.round(n*127);default:throw new Error("Invalid component type.")}}var Ye=class n{constructor(t=0,e=0){n.prototype.isVector2=!0,this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){let e=this.x,o=this.y,s=t.elements;return this.x=s[0]*e+s[3]*o+s[6],this.y=s[1]*e+s[4]*o+s[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this}clampLength(t,e){let o=this.length();return this.divideScalar(o||1).multiplyScalar(Math.max(t,Math.min(e,o)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(t){let e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;let o=this.dot(t)/e;return Math.acos(Yo(o,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let e=this.x-t.x,o=this.y-t.y;return e*e+o*o}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,o){return this.x=t.x+(e.x-t.x)*o,this.y=t.y+(e.y-t.y)*o,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){let o=Math.cos(e),s=Math.sin(e),u=this.x-t.x,p=this.y-t.y;return this.x=u*o-p*s+t.x,this.y=u*s+p*o+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},nn=class n{constructor(t,e,o,s,u,p,f,g,m){n.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],t!==void 0&&this.set(t,e,o,s,u,p,f,g,m)}set(t,e,o,s,u,p,f,g,m){let v=this.elements;return v[0]=t,v[1]=s,v[2]=f,v[3]=e,v[4]=u,v[5]=g,v[6]=o,v[7]=p,v[8]=m,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){let e=this.elements,o=t.elements;return e[0]=o[0],e[1]=o[1],e[2]=o[2],e[3]=o[3],e[4]=o[4],e[5]=o[5],e[6]=o[6],e[7]=o[7],e[8]=o[8],this}extractBasis(t,e,o){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),o.setFromMatrix3Column(this,2),this}setFromMatrix4(t){let e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){let o=t.elements,s=e.elements,u=this.elements,p=o[0],f=o[3],g=o[6],m=o[1],v=o[4],w=o[7],S=o[2],b=o[5],C=o[8],R=s[0],x=s[3],E=s[6],I=s[1],A=s[4],F=s[7],V=s[2],X=s[5],q=s[8];return u[0]=p*R+f*I+g*V,u[3]=p*x+f*A+g*X,u[6]=p*E+f*F+g*q,u[1]=m*R+v*I+w*V,u[4]=m*x+v*A+w*X,u[7]=m*E+v*F+w*q,u[2]=S*R+b*I+C*V,u[5]=S*x+b*A+C*X,u[8]=S*E+b*F+C*q,this}multiplyScalar(t){let e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){let t=this.elements,e=t[0],o=t[1],s=t[2],u=t[3],p=t[4],f=t[5],g=t[6],m=t[7],v=t[8];return e*p*v-e*f*m-o*u*v+o*f*g+s*u*m-s*p*g}invert(){let t=this.elements,e=t[0],o=t[1],s=t[2],u=t[3],p=t[4],f=t[5],g=t[6],m=t[7],v=t[8],w=v*p-f*m,S=f*g-v*u,b=m*u-p*g,C=e*w+o*S+s*b;if(C===0)return this.set(0,0,0,0,0,0,0,0,0);let R=1/C;return t[0]=w*R,t[1]=(s*m-v*o)*R,t[2]=(f*o-s*p)*R,t[3]=S*R,t[4]=(v*e-s*g)*R,t[5]=(s*u-f*e)*R,t[6]=b*R,t[7]=(o*g-m*e)*R,t[8]=(p*e-o*u)*R,this}transpose(){let t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){let e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,o,s,u,p,f){let g=Math.cos(u),m=Math.sin(u);return this.set(o*g,o*m,-o*(g*p+m*f)+p+t,-s*m,s*g,-s*(-m*p+g*f)+f+e,0,0,1),this}scale(t,e){return this.premultiply(Ay.makeScale(t,e)),this}rotate(t){return this.premultiply(Ay.makeRotation(-t)),this}translate(t,e){return this.premultiply(Ay.makeTranslation(t,e)),this}makeTranslation(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){let e=Math.cos(t),o=Math.sin(t);return this.set(e,-o,0,o,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){let e=this.elements,o=t.elements;for(let s=0;s<9;s++)if(e[s]!==o[s])return!1;return!0}fromArray(t,e=0){for(let o=0;o<9;o++)this.elements[o]=t[o+e];return this}toArray(t=[],e=0){let o=this.elements;return t[e]=o[0],t[e+1]=o[1],t[e+2]=o[2],t[e+3]=o[3],t[e+4]=o[4],t[e+5]=o[5],t[e+6]=o[6],t[e+7]=o[7],t[e+8]=o[8],t}clone(){return new this.constructor().fromArray(this.elements)}},Ay=new nn;function XC(n){for(let t=n.length-1;t>=0;--t)if(n[t]>=65535)return!0;return!1}function Id(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function J6(){let n=Id("canvas");return n.style.display="block",n}var $T={};function YC(n){n in $T||($T[n]=!0,console.warn(n))}var ZT=new nn().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),KT=new nn().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),jp={[tl]:{transfer:Ad,primaries:Td,toReference:n=>n,fromReference:n=>n},[ba]:{transfer:Lr,primaries:Td,toReference:n=>n.convertSRGBToLinear(),fromReference:n=>n.convertLinearToSRGB()},[Xd]:{transfer:Ad,primaries:Cd,toReference:n=>n.applyMatrix3(KT),fromReference:n=>n.applyMatrix3(ZT)},[kv]:{transfer:Lr,primaries:Cd,toReference:n=>n.convertSRGBToLinear().applyMatrix3(KT),fromReference:n=>n.applyMatrix3(ZT).convertLinearToSRGB()}},j6=new Set([tl,Xd]),xr={enabled:!0,_workingColorSpace:tl,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(n){if(!j6.has(n))throw new Error(`Unsupported working color space, "${n}".`);this._workingColorSpace=n},convert:function(n,t,e){if(this.enabled===!1||t===e||!t||!e)return n;let o=jp[t].toReference,s=jp[e].fromReference;return s(o(n))},fromWorkingColorSpace:function(n,t){return this.convert(n,this._workingColorSpace,t)},toWorkingColorSpace:function(n,t){return this.convert(n,t,this._workingColorSpace)},getPrimaries:function(n){return jp[n].primaries},getTransfer:function(n){return n===Vu?Ad:jp[n].transfer}};function kc(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function Ty(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}var _c,Rd=class{static getDataURL(t){if(/^data:/i.test(t.src)||typeof HTMLCanvasElement=="undefined")return t.src;let e;if(t instanceof HTMLCanvasElement)e=t;else{_c===void 0&&(_c=Id("canvas")),_c.width=t.width,_c.height=t.height;let o=_c.getContext("2d");t instanceof ImageData?o.putImageData(t,0,0):o.drawImage(t,0,0,t.width,t.height),e=_c}return e.width>2048||e.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",t),e.toDataURL("image/jpeg",.6)):e.toDataURL("image/png")}static sRGBToLinear(t){if(typeof HTMLImageElement!="undefined"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&t instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&t instanceof ImageBitmap){let e=Id("canvas");e.width=t.width,e.height=t.height;let o=e.getContext("2d");o.drawImage(t,0,0,t.width,t.height);let s=o.getImageData(0,0,t.width,t.height),u=s.data;for(let p=0;p<u.length;p++)u[p]=kc(u[p]/255)*255;return o.putImageData(s,0,0),e}else if(t.data){let e=t.data.slice(0);for(let o=0;o<e.length;o++)e instanceof Uint8Array||e instanceof Uint8ClampedArray?e[o]=Math.floor(kc(e[o]/255)*255):e[o]=kc(e[o]);return{data:e,width:t.width,height:t.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),t}},Q6=0,Ld=class{constructor(t=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Q6++}),this.uuid=Zu(),this.data=t,this.dataReady=!0,this.version=0}set needsUpdate(t){t===!0&&this.version++}toJSON(t){let e=t===void 0||typeof t=="string";if(!e&&t.images[this.uuid]!==void 0)return t.images[this.uuid];let o={uuid:this.uuid,url:""},s=this.data;if(s!==null){let u;if(Array.isArray(s)){u=[];for(let p=0,f=s.length;p<f;p++)s[p].isDataTexture?u.push(Cy(s[p].image)):u.push(Cy(s[p]))}else u=Cy(s);o.url=u}return e||(t.images[this.uuid]=o),o}};function Cy(n){return typeof HTMLImageElement!="undefined"&&n instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&n instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&n instanceof ImageBitmap?Rd.getDataURL(n):n.data?{data:Array.from(n.data),width:n.width,height:n.height,type:n.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}var tV=0,Fs=class n extends Ju{constructor(t=n.DEFAULT_IMAGE,e=n.DEFAULT_MAPPING,o=ta,s=ta,u=Xo,p=Ll,f=ea,g=$u,m=n.DEFAULT_ANISOTROPY,v=Vu){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:tV++}),this.uuid=Zu(),this.name="",this.source=new Ld(t),this.mipmaps=[],this.mapping=e,this.channel=0,this.wrapS=o,this.wrapT=s,this.magFilter=u,this.minFilter=p,this.anisotropy=m,this.format=f,this.internalFormat=null,this.type=g,this.offset=new Ye(0,0),this.repeat=new Ye(1,1),this.center=new Ye(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new nn,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=v,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.needsPMREMUpdate=!1}get image(){return this.source.data}set image(t=null){this.source.data=t}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return new this.constructor().copy(this)}copy(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.channel=t.channel,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.colorSpace=t.colorSpace,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}toJSON(t){let e=t===void 0||typeof t=="string";if(!e&&t.textures[this.uuid]!==void 0)return t.textures[this.uuid];let o={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(o.userData=this.userData),e||(t.textures[this.uuid]=o),o}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(this.mapping!==UC)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case ev:t.x=t.x-Math.floor(t.x);break;case ta:t.x=t.x<0?0:1;break;case nv:Math.abs(Math.floor(t.x)%2)===1?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x);break}if(t.y<0||t.y>1)switch(this.wrapT){case ev:t.y=t.y-Math.floor(t.y);break;case ta:t.y=t.y<0?0:1;break;case nv:Math.abs(Math.floor(t.y)%2)===1?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y);break}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){t===!0&&(this.version++,this.source.needsUpdate=!0)}};Fs.DEFAULT_IMAGE=null;Fs.DEFAULT_MAPPING=UC;Fs.DEFAULT_ANISOTROPY=1;var Qi=class n{constructor(t=0,e=0,o=0,s=1){n.prototype.isVector4=!0,this.x=t,this.y=e,this.z=o,this.w=s}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,o,s){return this.x=t,this.y=e,this.z=o,this.w=s,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w!==void 0?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){let e=this.x,o=this.y,s=this.z,u=this.w,p=t.elements;return this.x=p[0]*e+p[4]*o+p[8]*s+p[12]*u,this.y=p[1]*e+p[5]*o+p[9]*s+p[13]*u,this.z=p[2]*e+p[6]*o+p[10]*s+p[14]*u,this.w=p[3]*e+p[7]*o+p[11]*s+p[15]*u,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);let e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,o,s,u,g=t.elements,m=g[0],v=g[4],w=g[8],S=g[1],b=g[5],C=g[9],R=g[2],x=g[6],E=g[10];if(Math.abs(v-S)<.01&&Math.abs(w-R)<.01&&Math.abs(C-x)<.01){if(Math.abs(v+S)<.1&&Math.abs(w+R)<.1&&Math.abs(C+x)<.1&&Math.abs(m+b+E-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;let A=(m+1)/2,F=(b+1)/2,V=(E+1)/2,X=(v+S)/4,q=(w+R)/4,D=(C+x)/4;return A>F&&A>V?A<.01?(o=0,s=.707106781,u=.707106781):(o=Math.sqrt(A),s=X/o,u=q/o):F>V?F<.01?(o=.707106781,s=0,u=.707106781):(s=Math.sqrt(F),o=X/s,u=D/s):V<.01?(o=.707106781,s=.707106781,u=0):(u=Math.sqrt(V),o=q/u,s=D/u),this.set(o,s,u,e),this}let I=Math.sqrt((x-C)*(x-C)+(w-R)*(w-R)+(S-v)*(S-v));return Math.abs(I)<.001&&(I=1),this.x=(x-C)/I,this.y=(w-R)/I,this.z=(S-v)/I,this.w=Math.acos((m+b+E-1)/2),this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this.w=Math.max(t.w,Math.min(e.w,this.w)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this.w=Math.max(t,Math.min(e,this.w)),this}clampLength(t,e){let o=this.length();return this.divideScalar(o||1).multiplyScalar(Math.max(t,Math.min(e,o)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,o){return this.x=t.x+(e.x-t.x)*o,this.y=t.y+(e.y-t.y)*o,this.z=t.z+(e.z-t.z)*o,this.w=t.w+(e.w-t.w)*o,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}},av=class extends Ju{constructor(t=1,e=1,o={}){super(),this.isRenderTarget=!0,this.width=t,this.height=e,this.depth=1,this.scissor=new Qi(0,0,t,e),this.scissorTest=!1,this.viewport=new Qi(0,0,t,e);let s={width:t,height:e,depth:1};o=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Xo,depthBuffer:!0,stencilBuffer:!1,depthTexture:null,samples:0,count:1},o);let u=new Fs(s,o.mapping,o.wrapS,o.wrapT,o.magFilter,o.minFilter,o.format,o.type,o.anisotropy,o.colorSpace);u.flipY=!1,u.generateMipmaps=o.generateMipmaps,u.internalFormat=o.internalFormat,this.textures=[];let p=o.count;for(let f=0;f<p;f++)this.textures[f]=u.clone(),this.textures[f].isRenderTargetTexture=!0;this.depthBuffer=o.depthBuffer,this.stencilBuffer=o.stencilBuffer,this.depthTexture=o.depthTexture,this.samples=o.samples}get texture(){return this.textures[0]}set texture(t){this.textures[0]=t}setSize(t,e,o=1){if(this.width!==t||this.height!==e||this.depth!==o){this.width=t,this.height=e,this.depth=o;for(let s=0,u=this.textures.length;s<u;s++)this.textures[s].image.width=t,this.textures[s].image.height=e,this.textures[s].image.depth=o;this.dispose()}this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)}clone(){return new this.constructor().copy(this)}copy(t){this.width=t.width,this.height=t.height,this.depth=t.depth,this.scissor.copy(t.scissor),this.scissorTest=t.scissorTest,this.viewport.copy(t.viewport),this.textures.length=0;for(let o=0,s=t.textures.length;o<s;o++)this.textures[o]=t.textures[o].clone(),this.textures[o].isRenderTargetTexture=!0;let e=Object.assign({},t.texture.image);return this.texture.source=new Ld(e),this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,t.depthTexture!==null&&(this.depthTexture=t.depthTexture.clone()),this.samples=t.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}},pu=class extends av{constructor(t=1,e=1,o={}){super(t,e,o),this.isWebGLRenderTarget=!0}},Nd=class extends Fs{constructor(t=null,e=1,o=1,s=1){super(null),this.isDataArrayTexture=!0,this.image={data:t,width:e,height:o,depth:s},this.magFilter=Mo,this.minFilter=Mo,this.wrapR=ta,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var uv=class extends Fs{constructor(t=null,e=1,o=1,s=1){super(null),this.isData3DTexture=!0,this.image={data:t,width:e,height:o,depth:s},this.magFilter=Mo,this.minFilter=Mo,this.wrapR=ta,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var ju=class{constructor(t=0,e=0,o=0,s=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=o,this._w=s}static slerpFlat(t,e,o,s,u,p,f){let g=o[s+0],m=o[s+1],v=o[s+2],w=o[s+3],S=u[p+0],b=u[p+1],C=u[p+2],R=u[p+3];if(f===0){t[e+0]=g,t[e+1]=m,t[e+2]=v,t[e+3]=w;return}if(f===1){t[e+0]=S,t[e+1]=b,t[e+2]=C,t[e+3]=R;return}if(w!==R||g!==S||m!==b||v!==C){let x=1-f,E=g*S+m*b+v*C+w*R,I=E>=0?1:-1,A=1-E*E;if(A>Number.EPSILON){let V=Math.sqrt(A),X=Math.atan2(V,E*I);x=Math.sin(x*X)/V,f=Math.sin(f*X)/V}let F=f*I;if(g=g*x+S*F,m=m*x+b*F,v=v*x+C*F,w=w*x+R*F,x===1-f){let V=1/Math.sqrt(g*g+m*m+v*v+w*w);g*=V,m*=V,v*=V,w*=V}}t[e]=g,t[e+1]=m,t[e+2]=v,t[e+3]=w}static multiplyQuaternionsFlat(t,e,o,s,u,p){let f=o[s],g=o[s+1],m=o[s+2],v=o[s+3],w=u[p],S=u[p+1],b=u[p+2],C=u[p+3];return t[e]=f*C+v*w+g*b-m*S,t[e+1]=g*C+v*S+m*w-f*b,t[e+2]=m*C+v*b+f*S-g*w,t[e+3]=v*C-f*w-g*S-m*b,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,o,s){return this._x=t,this._y=e,this._z=o,this._w=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e=!0){let o=t._x,s=t._y,u=t._z,p=t._order,f=Math.cos,g=Math.sin,m=f(o/2),v=f(s/2),w=f(u/2),S=g(o/2),b=g(s/2),C=g(u/2);switch(p){case"XYZ":this._x=S*v*w+m*b*C,this._y=m*b*w-S*v*C,this._z=m*v*C+S*b*w,this._w=m*v*w-S*b*C;break;case"YXZ":this._x=S*v*w+m*b*C,this._y=m*b*w-S*v*C,this._z=m*v*C-S*b*w,this._w=m*v*w+S*b*C;break;case"ZXY":this._x=S*v*w-m*b*C,this._y=m*b*w+S*v*C,this._z=m*v*C+S*b*w,this._w=m*v*w-S*b*C;break;case"ZYX":this._x=S*v*w-m*b*C,this._y=m*b*w+S*v*C,this._z=m*v*C-S*b*w,this._w=m*v*w+S*b*C;break;case"YZX":this._x=S*v*w+m*b*C,this._y=m*b*w+S*v*C,this._z=m*v*C-S*b*w,this._w=m*v*w-S*b*C;break;case"XZY":this._x=S*v*w-m*b*C,this._y=m*b*w-S*v*C,this._z=m*v*C+S*b*w,this._w=m*v*w+S*b*C;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+p)}return e===!0&&this._onChangeCallback(),this}setFromAxisAngle(t,e){let o=e/2,s=Math.sin(o);return this._x=t.x*s,this._y=t.y*s,this._z=t.z*s,this._w=Math.cos(o),this._onChangeCallback(),this}setFromRotationMatrix(t){let e=t.elements,o=e[0],s=e[4],u=e[8],p=e[1],f=e[5],g=e[9],m=e[2],v=e[6],w=e[10],S=o+f+w;if(S>0){let b=.5/Math.sqrt(S+1);this._w=.25/b,this._x=(v-g)*b,this._y=(u-m)*b,this._z=(p-s)*b}else if(o>f&&o>w){let b=2*Math.sqrt(1+o-f-w);this._w=(v-g)/b,this._x=.25*b,this._y=(s+p)/b,this._z=(u+m)/b}else if(f>w){let b=2*Math.sqrt(1+f-o-w);this._w=(u-m)/b,this._x=(s+p)/b,this._y=.25*b,this._z=(g+v)/b}else{let b=2*Math.sqrt(1+w-o-f);this._w=(p-s)/b,this._x=(u+m)/b,this._y=(g+v)/b,this._z=.25*b}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let o=t.dot(e)+1;return o<Number.EPSILON?(o=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=o):(this._x=0,this._y=-t.z,this._z=t.y,this._w=o)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=o),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(Yo(this.dot(t),-1,1)))}rotateTowards(t,e){let o=this.angleTo(t);if(o===0)return this;let s=Math.min(1,e/o);return this.slerp(t,s),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return t===0?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){let o=t._x,s=t._y,u=t._z,p=t._w,f=e._x,g=e._y,m=e._z,v=e._w;return this._x=o*v+p*f+s*m-u*g,this._y=s*v+p*g+u*f-o*m,this._z=u*v+p*m+o*g-s*f,this._w=p*v-o*f-s*g-u*m,this._onChangeCallback(),this}slerp(t,e){if(e===0)return this;if(e===1)return this.copy(t);let o=this._x,s=this._y,u=this._z,p=this._w,f=p*t._w+o*t._x+s*t._y+u*t._z;if(f<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,f=-f):this.copy(t),f>=1)return this._w=p,this._x=o,this._y=s,this._z=u,this;let g=1-f*f;if(g<=Number.EPSILON){let b=1-e;return this._w=b*p+e*this._w,this._x=b*o+e*this._x,this._y=b*s+e*this._y,this._z=b*u+e*this._z,this.normalize(),this}let m=Math.sqrt(g),v=Math.atan2(m,f),w=Math.sin((1-e)*v)/m,S=Math.sin(e*v)/m;return this._w=p*w+this._w*S,this._x=o*w+this._x*S,this._y=s*w+this._y*S,this._z=u*w+this._z*S,this._onChangeCallback(),this}slerpQuaternions(t,e,o){return this.copy(t).slerp(e,o)}random(){let t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),o=Math.random(),s=Math.sqrt(1-o),u=Math.sqrt(o);return this.set(s*Math.sin(t),s*Math.cos(t),u*Math.sin(e),u*Math.cos(e))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},Rt=class n{constructor(t=0,e=0,o=0){n.prototype.isVector3=!0,this.x=t,this.y=e,this.z=o}set(t,e,o){return o===void 0&&(o=this.z),this.x=t,this.y=e,this.z=o,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(JT.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(JT.setFromAxisAngle(t,e))}applyMatrix3(t){let e=this.x,o=this.y,s=this.z,u=t.elements;return this.x=u[0]*e+u[3]*o+u[6]*s,this.y=u[1]*e+u[4]*o+u[7]*s,this.z=u[2]*e+u[5]*o+u[8]*s,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){let e=this.x,o=this.y,s=this.z,u=t.elements,p=1/(u[3]*e+u[7]*o+u[11]*s+u[15]);return this.x=(u[0]*e+u[4]*o+u[8]*s+u[12])*p,this.y=(u[1]*e+u[5]*o+u[9]*s+u[13])*p,this.z=(u[2]*e+u[6]*o+u[10]*s+u[14])*p,this}applyQuaternion(t){let e=this.x,o=this.y,s=this.z,u=t.x,p=t.y,f=t.z,g=t.w,m=2*(p*s-f*o),v=2*(f*e-u*s),w=2*(u*o-p*e);return this.x=e+g*m+p*w-f*v,this.y=o+g*v+f*m-u*w,this.z=s+g*w+u*v-p*m,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){let e=this.x,o=this.y,s=this.z,u=t.elements;return this.x=u[0]*e+u[4]*o+u[8]*s,this.y=u[1]*e+u[5]*o+u[9]*s,this.z=u[2]*e+u[6]*o+u[10]*s,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=Math.max(t.x,Math.min(e.x,this.x)),this.y=Math.max(t.y,Math.min(e.y,this.y)),this.z=Math.max(t.z,Math.min(e.z,this.z)),this}clampScalar(t,e){return this.x=Math.max(t,Math.min(e,this.x)),this.y=Math.max(t,Math.min(e,this.y)),this.z=Math.max(t,Math.min(e,this.z)),this}clampLength(t,e){let o=this.length();return this.divideScalar(o||1).multiplyScalar(Math.max(t,Math.min(e,o)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,o){return this.x=t.x+(e.x-t.x)*o,this.y=t.y+(e.y-t.y)*o,this.z=t.z+(e.z-t.z)*o,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){let o=t.x,s=t.y,u=t.z,p=e.x,f=e.y,g=e.z;return this.x=s*g-u*f,this.y=u*p-o*g,this.z=o*f-s*p,this}projectOnVector(t){let e=t.lengthSq();if(e===0)return this.set(0,0,0);let o=t.dot(this)/e;return this.copy(t).multiplyScalar(o)}projectOnPlane(t){return Py.copy(this).projectOnVector(t),this.sub(Py)}reflect(t){return this.sub(Py.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){let e=Math.sqrt(this.lengthSq()*t.lengthSq());if(e===0)return Math.PI/2;let o=this.dot(t)/e;return Math.acos(Yo(o,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let e=this.x-t.x,o=this.y-t.y,s=this.z-t.z;return e*e+o*o+s*s}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,o){let s=Math.sin(e)*t;return this.x=s*Math.sin(o),this.y=Math.cos(e)*t,this.z=s*Math.cos(o),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,o){return this.x=t*Math.sin(e),this.y=o,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){let e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){let e=this.setFromMatrixColumn(t,0).length(),o=this.setFromMatrixColumn(t,1).length(),s=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=o,this.z=s,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,e*4)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,e*3)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let t=Math.random()*Math.PI*2,e=Math.random()*2-1,o=Math.sqrt(1-e*e);return this.x=o*Math.cos(t),this.y=e,this.z=o*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},Py=new Rt,JT=new ju,Fl=class{constructor(t=new Rt(1/0,1/0,1/0),e=new Rt(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,o=t.length;e<o;e+=3)this.expandByPoint(Js.fromArray(t,e));return this}setFromBufferAttribute(t){this.makeEmpty();for(let e=0,o=t.count;e<o;e++)this.expandByPoint(Js.fromBufferAttribute(t,e));return this}setFromPoints(t){this.makeEmpty();for(let e=0,o=t.length;e<o;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){let o=Js.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(o),this.max.copy(t).add(o),this}setFromObject(t,e=!1){return this.makeEmpty(),this.expandByObject(t,e)}clone(){return new this.constructor().copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t,e=!1){t.updateWorldMatrix(!1,!1);let o=t.geometry;if(o!==void 0){let u=o.getAttribute("position");if(e===!0&&u!==void 0&&t.isInstancedMesh!==!0)for(let p=0,f=u.count;p<f;p++)t.isMesh===!0?t.getVertexPosition(p,Js):Js.fromBufferAttribute(u,p),Js.applyMatrix4(t.matrixWorld),this.expandByPoint(Js);else t.boundingBox!==void 0?(t.boundingBox===null&&t.computeBoundingBox(),Qp.copy(t.boundingBox)):(o.boundingBox===null&&o.computeBoundingBox(),Qp.copy(o.boundingBox)),Qp.applyMatrix4(t.matrixWorld),this.union(Qp)}let s=t.children;for(let u=0,p=s.length;u<p;u++)this.expandByObject(s[u],e);return this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)}intersectsSphere(t){return this.clampPoint(t.center,Js),Js.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,o;return t.normal.x>0?(e=t.normal.x*this.min.x,o=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,o=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,o+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,o+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,o+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,o+=t.normal.z*this.min.z),e<=-t.constant&&o>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(Qf),td.subVectors(this.max,Qf),xc.subVectors(t.a,Qf),Ec.subVectors(t.b,Qf),wc.subVectors(t.c,Qf),Uu.subVectors(Ec,xc),Bu.subVectors(wc,Ec),Sl.subVectors(xc,wc);let e=[0,-Uu.z,Uu.y,0,-Bu.z,Bu.y,0,-Sl.z,Sl.y,Uu.z,0,-Uu.x,Bu.z,0,-Bu.x,Sl.z,0,-Sl.x,-Uu.y,Uu.x,0,-Bu.y,Bu.x,0,-Sl.y,Sl.x,0];return!Iy(e,xc,Ec,wc,td)||(e=[1,0,0,0,1,0,0,0,1],!Iy(e,xc,Ec,wc,td))?!1:(ed.crossVectors(Uu,Bu),e=[ed.x,ed.y,ed.z],Iy(e,xc,Ec,wc,td))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,Js).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=this.getSize(Js).length()*.5),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()?this:(nu[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),nu[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),nu[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),nu[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),nu[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),nu[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),nu[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),nu[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(nu),this)}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}},nu=[new Rt,new Rt,new Rt,new Rt,new Rt,new Rt,new Rt,new Rt],Js=new Rt,Qp=new Fl,xc=new Rt,Ec=new Rt,wc=new Rt,Uu=new Rt,Bu=new Rt,Sl=new Rt,Qf=new Rt,td=new Rt,ed=new Rt,Ml=new Rt;function Iy(n,t,e,o,s){for(let u=0,p=n.length-3;u<=p;u+=3){Ml.fromArray(n,u);let f=s.x*Math.abs(Ml.x)+s.y*Math.abs(Ml.y)+s.z*Math.abs(Ml.z),g=t.dot(Ml),m=e.dot(Ml),v=o.dot(Ml);if(Math.max(-Math.max(g,m,v),Math.min(g,m,v))>f)return!1}return!0}var eV=new Fl,th=new Rt,Ry=new Rt,uh=class{constructor(t=new Rt,e=-1){this.isSphere=!0,this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){let o=this.center;e!==void 0?o.copy(e):eV.setFromPoints(t).getCenter(o);let s=0;for(let u=0,p=t.length;u<p;u++)s=Math.max(s,o.distanceToSquared(t[u]));return this.radius=Math.sqrt(s),this}copy(t){return this.center.copy(t.center),this.radius=t.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(t){return t.distanceTo(this.center)-this.radius}intersectsSphere(t){let e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e}intersectsBox(t){return t.intersectsSphere(this)}intersectsPlane(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}clampPoint(t,e){let o=this.center.distanceToSquared(t);return e.copy(t),o>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;th.subVectors(t,this.center);let e=th.lengthSq();if(e>this.radius*this.radius){let o=Math.sqrt(e),s=(o-this.radius)*.5;this.center.addScaledVector(th,s/o),this.radius+=s}return this}union(t){return t.isEmpty()?this:this.isEmpty()?(this.copy(t),this):(this.center.equals(t.center)===!0?this.radius=Math.max(this.radius,t.radius):(Ry.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(th.copy(t.center).add(Ry)),this.expandByPoint(th.copy(t.center).sub(Ry))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return new this.constructor().copy(this)}},ru=new Rt,Ly=new Rt,nd=new Rt,zu=new Rt,Ny=new Rt,rd=new Rt,Oy=new Rt,lv=class{constructor(t=new Rt,e=new Rt(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.origin).addScaledVector(this.direction,t)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,ru)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);let o=e.dot(this.direction);return o<0?e.copy(this.origin):e.copy(this.origin).addScaledVector(this.direction,o)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){let e=ru.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(ru.copy(this.origin).addScaledVector(this.direction,e),ru.distanceToSquared(t))}distanceSqToSegment(t,e,o,s){Ly.copy(t).add(e).multiplyScalar(.5),nd.copy(e).sub(t).normalize(),zu.copy(this.origin).sub(Ly);let u=t.distanceTo(e)*.5,p=-this.direction.dot(nd),f=zu.dot(this.direction),g=-zu.dot(nd),m=zu.lengthSq(),v=Math.abs(1-p*p),w,S,b,C;if(v>0)if(w=p*g-f,S=p*f-g,C=u*v,w>=0)if(S>=-C)if(S<=C){let R=1/v;w*=R,S*=R,b=w*(w+p*S+2*f)+S*(p*w+S+2*g)+m}else S=u,w=Math.max(0,-(p*S+f)),b=-w*w+S*(S+2*g)+m;else S=-u,w=Math.max(0,-(p*S+f)),b=-w*w+S*(S+2*g)+m;else S<=-C?(w=Math.max(0,-(-p*u+f)),S=w>0?-u:Math.min(Math.max(-u,-g),u),b=-w*w+S*(S+2*g)+m):S<=C?(w=0,S=Math.min(Math.max(-u,-g),u),b=S*(S+2*g)+m):(w=Math.max(0,-(p*u+f)),S=w>0?u:Math.min(Math.max(-u,-g),u),b=-w*w+S*(S+2*g)+m);else S=p>0?-u:u,w=Math.max(0,-(p*S+f)),b=-w*w+S*(S+2*g)+m;return o&&o.copy(this.origin).addScaledVector(this.direction,w),s&&s.copy(Ly).addScaledVector(nd,S),b}intersectSphere(t,e){ru.subVectors(t.center,this.origin);let o=ru.dot(this.direction),s=ru.dot(ru)-o*o,u=t.radius*t.radius;if(s>u)return null;let p=Math.sqrt(u-s),f=o-p,g=o+p;return g<0?null:f<0?this.at(g,e):this.at(f,e)}intersectsSphere(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){let e=t.normal.dot(this.direction);if(e===0)return t.distanceToPoint(this.origin)===0?0:null;let o=-(this.origin.dot(t.normal)+t.constant)/e;return o>=0?o:null}intersectPlane(t,e){let o=this.distanceToPlane(t);return o===null?null:this.at(o,e)}intersectsPlane(t){let e=t.distanceToPoint(this.origin);return e===0||t.normal.dot(this.direction)*e<0}intersectBox(t,e){let o,s,u,p,f,g,m=1/this.direction.x,v=1/this.direction.y,w=1/this.direction.z,S=this.origin;return m>=0?(o=(t.min.x-S.x)*m,s=(t.max.x-S.x)*m):(o=(t.max.x-S.x)*m,s=(t.min.x-S.x)*m),v>=0?(u=(t.min.y-S.y)*v,p=(t.max.y-S.y)*v):(u=(t.max.y-S.y)*v,p=(t.min.y-S.y)*v),o>p||u>s||((u>o||isNaN(o))&&(o=u),(p<s||isNaN(s))&&(s=p),w>=0?(f=(t.min.z-S.z)*w,g=(t.max.z-S.z)*w):(f=(t.max.z-S.z)*w,g=(t.min.z-S.z)*w),o>g||f>s)||((f>o||o!==o)&&(o=f),(g<s||s!==s)&&(s=g),s<0)?null:this.at(o>=0?o:s,e)}intersectsBox(t){return this.intersectBox(t,ru)!==null}intersectTriangle(t,e,o,s,u){Ny.subVectors(e,t),rd.subVectors(o,t),Oy.crossVectors(Ny,rd);let p=this.direction.dot(Oy),f;if(p>0){if(s)return null;f=1}else if(p<0)f=-1,p=-p;else return null;zu.subVectors(this.origin,t);let g=f*this.direction.dot(rd.crossVectors(zu,rd));if(g<0)return null;let m=f*this.direction.dot(Ny.cross(zu));if(m<0||g+m>p)return null;let v=-f*zu.dot(Oy);return v<0?null:this.at(v/p,u)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}},vi=class n{constructor(t,e,o,s,u,p,f,g,m,v,w,S,b,C,R,x){n.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!==void 0&&this.set(t,e,o,s,u,p,f,g,m,v,w,S,b,C,R,x)}set(t,e,o,s,u,p,f,g,m,v,w,S,b,C,R,x){let E=this.elements;return E[0]=t,E[4]=e,E[8]=o,E[12]=s,E[1]=u,E[5]=p,E[9]=f,E[13]=g,E[2]=m,E[6]=v,E[10]=w,E[14]=S,E[3]=b,E[7]=C,E[11]=R,E[15]=x,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new n().fromArray(this.elements)}copy(t){let e=this.elements,o=t.elements;return e[0]=o[0],e[1]=o[1],e[2]=o[2],e[3]=o[3],e[4]=o[4],e[5]=o[5],e[6]=o[6],e[7]=o[7],e[8]=o[8],e[9]=o[9],e[10]=o[10],e[11]=o[11],e[12]=o[12],e[13]=o[13],e[14]=o[14],e[15]=o[15],this}copyPosition(t){let e=this.elements,o=t.elements;return e[12]=o[12],e[13]=o[13],e[14]=o[14],this}setFromMatrix3(t){let e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,o){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),o.setFromMatrixColumn(this,2),this}makeBasis(t,e,o){return this.set(t.x,e.x,o.x,0,t.y,e.y,o.y,0,t.z,e.z,o.z,0,0,0,0,1),this}extractRotation(t){let e=this.elements,o=t.elements,s=1/Sc.setFromMatrixColumn(t,0).length(),u=1/Sc.setFromMatrixColumn(t,1).length(),p=1/Sc.setFromMatrixColumn(t,2).length();return e[0]=o[0]*s,e[1]=o[1]*s,e[2]=o[2]*s,e[3]=0,e[4]=o[4]*u,e[5]=o[5]*u,e[6]=o[6]*u,e[7]=0,e[8]=o[8]*p,e[9]=o[9]*p,e[10]=o[10]*p,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){let e=this.elements,o=t.x,s=t.y,u=t.z,p=Math.cos(o),f=Math.sin(o),g=Math.cos(s),m=Math.sin(s),v=Math.cos(u),w=Math.sin(u);if(t.order==="XYZ"){let S=p*v,b=p*w,C=f*v,R=f*w;e[0]=g*v,e[4]=-g*w,e[8]=m,e[1]=b+C*m,e[5]=S-R*m,e[9]=-f*g,e[2]=R-S*m,e[6]=C+b*m,e[10]=p*g}else if(t.order==="YXZ"){let S=g*v,b=g*w,C=m*v,R=m*w;e[0]=S+R*f,e[4]=C*f-b,e[8]=p*m,e[1]=p*w,e[5]=p*v,e[9]=-f,e[2]=b*f-C,e[6]=R+S*f,e[10]=p*g}else if(t.order==="ZXY"){let S=g*v,b=g*w,C=m*v,R=m*w;e[0]=S-R*f,e[4]=-p*w,e[8]=C+b*f,e[1]=b+C*f,e[5]=p*v,e[9]=R-S*f,e[2]=-p*m,e[6]=f,e[10]=p*g}else if(t.order==="ZYX"){let S=p*v,b=p*w,C=f*v,R=f*w;e[0]=g*v,e[4]=C*m-b,e[8]=S*m+R,e[1]=g*w,e[5]=R*m+S,e[9]=b*m-C,e[2]=-m,e[6]=f*g,e[10]=p*g}else if(t.order==="YZX"){let S=p*g,b=p*m,C=f*g,R=f*m;e[0]=g*v,e[4]=R-S*w,e[8]=C*w+b,e[1]=w,e[5]=p*v,e[9]=-f*v,e[2]=-m*v,e[6]=b*w+C,e[10]=S-R*w}else if(t.order==="XZY"){let S=p*g,b=p*m,C=f*g,R=f*m;e[0]=g*v,e[4]=-w,e[8]=m*v,e[1]=S*w+R,e[5]=p*v,e[9]=b*w-C,e[2]=C*w-b,e[6]=f*v,e[10]=R*w+S}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(nV,t,rV)}lookAt(t,e,o){let s=this.elements;return hs.subVectors(t,e),hs.lengthSq()===0&&(hs.z=1),hs.normalize(),Gu.crossVectors(o,hs),Gu.lengthSq()===0&&(Math.abs(o.z)===1?hs.x+=1e-4:hs.z+=1e-4,hs.normalize(),Gu.crossVectors(o,hs)),Gu.normalize(),id.crossVectors(hs,Gu),s[0]=Gu.x,s[4]=id.x,s[8]=hs.x,s[1]=Gu.y,s[5]=id.y,s[9]=hs.y,s[2]=Gu.z,s[6]=id.z,s[10]=hs.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){let o=t.elements,s=e.elements,u=this.elements,p=o[0],f=o[4],g=o[8],m=o[12],v=o[1],w=o[5],S=o[9],b=o[13],C=o[2],R=o[6],x=o[10],E=o[14],I=o[3],A=o[7],F=o[11],V=o[15],X=s[0],q=s[4],D=s[8],xt=s[12],B=s[1],j=s[5],K=s[9],Dt=s[13],Q=s[2],At=s[6],Mt=s[10],Lt=s[14],pt=s[3],yt=s[7],J=s[11],Bt=s[15];return u[0]=p*X+f*B+g*Q+m*pt,u[4]=p*q+f*j+g*At+m*yt,u[8]=p*D+f*K+g*Mt+m*J,u[12]=p*xt+f*Dt+g*Lt+m*Bt,u[1]=v*X+w*B+S*Q+b*pt,u[5]=v*q+w*j+S*At+b*yt,u[9]=v*D+w*K+S*Mt+b*J,u[13]=v*xt+w*Dt+S*Lt+b*Bt,u[2]=C*X+R*B+x*Q+E*pt,u[6]=C*q+R*j+x*At+E*yt,u[10]=C*D+R*K+x*Mt+E*J,u[14]=C*xt+R*Dt+x*Lt+E*Bt,u[3]=I*X+A*B+F*Q+V*pt,u[7]=I*q+A*j+F*At+V*yt,u[11]=I*D+A*K+F*Mt+V*J,u[15]=I*xt+A*Dt+F*Lt+V*Bt,this}multiplyScalar(t){let e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){let t=this.elements,e=t[0],o=t[4],s=t[8],u=t[12],p=t[1],f=t[5],g=t[9],m=t[13],v=t[2],w=t[6],S=t[10],b=t[14],C=t[3],R=t[7],x=t[11],E=t[15];return C*(+u*g*w-s*m*w-u*f*S+o*m*S+s*f*b-o*g*b)+R*(+e*g*b-e*m*S+u*p*S-s*p*b+s*m*v-u*g*v)+x*(+e*m*w-e*f*b-u*p*w+o*p*b+u*f*v-o*m*v)+E*(-s*f*v-e*g*w+e*f*S+s*p*w-o*p*S+o*g*v)}transpose(){let t=this.elements,e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,o){let s=this.elements;return t.isVector3?(s[12]=t.x,s[13]=t.y,s[14]=t.z):(s[12]=t,s[13]=e,s[14]=o),this}invert(){let t=this.elements,e=t[0],o=t[1],s=t[2],u=t[3],p=t[4],f=t[5],g=t[6],m=t[7],v=t[8],w=t[9],S=t[10],b=t[11],C=t[12],R=t[13],x=t[14],E=t[15],I=w*x*m-R*S*m+R*g*b-f*x*b-w*g*E+f*S*E,A=C*S*m-v*x*m-C*g*b+p*x*b+v*g*E-p*S*E,F=v*R*m-C*w*m+C*f*b-p*R*b-v*f*E+p*w*E,V=C*w*g-v*R*g-C*f*S+p*R*S+v*f*x-p*w*x,X=e*I+o*A+s*F+u*V;if(X===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let q=1/X;return t[0]=I*q,t[1]=(R*S*u-w*x*u-R*s*b+o*x*b+w*s*E-o*S*E)*q,t[2]=(f*x*u-R*g*u+R*s*m-o*x*m-f*s*E+o*g*E)*q,t[3]=(w*g*u-f*S*u-w*s*m+o*S*m+f*s*b-o*g*b)*q,t[4]=A*q,t[5]=(v*x*u-C*S*u+C*s*b-e*x*b-v*s*E+e*S*E)*q,t[6]=(C*g*u-p*x*u-C*s*m+e*x*m+p*s*E-e*g*E)*q,t[7]=(p*S*u-v*g*u+v*s*m-e*S*m-p*s*b+e*g*b)*q,t[8]=F*q,t[9]=(C*w*u-v*R*u-C*o*b+e*R*b+v*o*E-e*w*E)*q,t[10]=(p*R*u-C*f*u+C*o*m-e*R*m-p*o*E+e*f*E)*q,t[11]=(v*f*u-p*w*u-v*o*m+e*w*m+p*o*b-e*f*b)*q,t[12]=V*q,t[13]=(v*R*s-C*w*s+C*o*S-e*R*S-v*o*x+e*w*x)*q,t[14]=(C*f*s-p*R*s-C*o*g+e*R*g+p*o*x-e*f*x)*q,t[15]=(p*w*s-v*f*s+v*o*g-e*w*g-p*o*S+e*f*S)*q,this}scale(t){let e=this.elements,o=t.x,s=t.y,u=t.z;return e[0]*=o,e[4]*=s,e[8]*=u,e[1]*=o,e[5]*=s,e[9]*=u,e[2]*=o,e[6]*=s,e[10]*=u,e[3]*=o,e[7]*=s,e[11]*=u,this}getMaxScaleOnAxis(){let t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],o=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],s=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,o,s))}makeTranslation(t,e,o){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,o,0,0,0,1),this}makeRotationX(t){let e=Math.cos(t),o=Math.sin(t);return this.set(1,0,0,0,0,e,-o,0,0,o,e,0,0,0,0,1),this}makeRotationY(t){let e=Math.cos(t),o=Math.sin(t);return this.set(e,0,o,0,0,1,0,0,-o,0,e,0,0,0,0,1),this}makeRotationZ(t){let e=Math.cos(t),o=Math.sin(t);return this.set(e,-o,0,0,o,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){let o=Math.cos(e),s=Math.sin(e),u=1-o,p=t.x,f=t.y,g=t.z,m=u*p,v=u*f;return this.set(m*p+o,m*f-s*g,m*g+s*f,0,m*f+s*g,v*f+o,v*g-s*p,0,m*g-s*f,v*g+s*p,u*g*g+o,0,0,0,0,1),this}makeScale(t,e,o){return this.set(t,0,0,0,0,e,0,0,0,0,o,0,0,0,0,1),this}makeShear(t,e,o,s,u,p){return this.set(1,o,u,0,t,1,p,0,e,s,1,0,0,0,0,1),this}compose(t,e,o){let s=this.elements,u=e._x,p=e._y,f=e._z,g=e._w,m=u+u,v=p+p,w=f+f,S=u*m,b=u*v,C=u*w,R=p*v,x=p*w,E=f*w,I=g*m,A=g*v,F=g*w,V=o.x,X=o.y,q=o.z;return s[0]=(1-(R+E))*V,s[1]=(b+F)*V,s[2]=(C-A)*V,s[3]=0,s[4]=(b-F)*X,s[5]=(1-(S+E))*X,s[6]=(x+I)*X,s[7]=0,s[8]=(C+A)*q,s[9]=(x-I)*q,s[10]=(1-(S+R))*q,s[11]=0,s[12]=t.x,s[13]=t.y,s[14]=t.z,s[15]=1,this}decompose(t,e,o){let s=this.elements,u=Sc.set(s[0],s[1],s[2]).length(),p=Sc.set(s[4],s[5],s[6]).length(),f=Sc.set(s[8],s[9],s[10]).length();this.determinant()<0&&(u=-u),t.x=s[12],t.y=s[13],t.z=s[14],js.copy(this);let m=1/u,v=1/p,w=1/f;return js.elements[0]*=m,js.elements[1]*=m,js.elements[2]*=m,js.elements[4]*=v,js.elements[5]*=v,js.elements[6]*=v,js.elements[8]*=w,js.elements[9]*=w,js.elements[10]*=w,e.setFromRotationMatrix(js),o.x=u,o.y=p,o.z=f,this}makePerspective(t,e,o,s,u,p,f=fu){let g=this.elements,m=2*u/(e-t),v=2*u/(o-s),w=(e+t)/(e-t),S=(o+s)/(o-s),b,C;if(f===fu)b=-(p+u)/(p-u),C=-2*p*u/(p-u);else if(f===Pd)b=-p/(p-u),C=-p*u/(p-u);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+f);return g[0]=m,g[4]=0,g[8]=w,g[12]=0,g[1]=0,g[5]=v,g[9]=S,g[13]=0,g[2]=0,g[6]=0,g[10]=b,g[14]=C,g[3]=0,g[7]=0,g[11]=-1,g[15]=0,this}makeOrthographic(t,e,o,s,u,p,f=fu){let g=this.elements,m=1/(e-t),v=1/(o-s),w=1/(p-u),S=(e+t)*m,b=(o+s)*v,C,R;if(f===fu)C=(p+u)*w,R=-2*w;else if(f===Pd)C=u*w,R=-1*w;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+f);return g[0]=2*m,g[4]=0,g[8]=0,g[12]=-S,g[1]=0,g[5]=2*v,g[9]=0,g[13]=-b,g[2]=0,g[6]=0,g[10]=R,g[14]=-C,g[3]=0,g[7]=0,g[11]=0,g[15]=1,this}equals(t){let e=this.elements,o=t.elements;for(let s=0;s<16;s++)if(e[s]!==o[s])return!1;return!0}fromArray(t,e=0){for(let o=0;o<16;o++)this.elements[o]=t[o+e];return this}toArray(t=[],e=0){let o=this.elements;return t[e]=o[0],t[e+1]=o[1],t[e+2]=o[2],t[e+3]=o[3],t[e+4]=o[4],t[e+5]=o[5],t[e+6]=o[6],t[e+7]=o[7],t[e+8]=o[8],t[e+9]=o[9],t[e+10]=o[10],t[e+11]=o[11],t[e+12]=o[12],t[e+13]=o[13],t[e+14]=o[14],t[e+15]=o[15],t}},Sc=new Rt,js=new vi,nV=new Rt(0,0,0),rV=new Rt(1,1,1),Gu=new Rt,id=new Rt,hs=new Rt,jT=new vi,QT=new ju,Ul=class n{constructor(t=0,e=0,o=0,s=n.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=e,this._z=o,this._order=s}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,o,s=this._order){return this._x=t,this._y=e,this._z=o,this._order=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,o=!0){let s=t.elements,u=s[0],p=s[4],f=s[8],g=s[1],m=s[5],v=s[9],w=s[2],S=s[6],b=s[10];switch(e){case"XYZ":this._y=Math.asin(Yo(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(-v,b),this._z=Math.atan2(-p,u)):(this._x=Math.atan2(S,m),this._z=0);break;case"YXZ":this._x=Math.asin(-Yo(v,-1,1)),Math.abs(v)<.9999999?(this._y=Math.atan2(f,b),this._z=Math.atan2(g,m)):(this._y=Math.atan2(-w,u),this._z=0);break;case"ZXY":this._x=Math.asin(Yo(S,-1,1)),Math.abs(S)<.9999999?(this._y=Math.atan2(-w,b),this._z=Math.atan2(-p,m)):(this._y=0,this._z=Math.atan2(g,u));break;case"ZYX":this._y=Math.asin(-Yo(w,-1,1)),Math.abs(w)<.9999999?(this._x=Math.atan2(S,b),this._z=Math.atan2(g,u)):(this._x=0,this._z=Math.atan2(-p,m));break;case"YZX":this._z=Math.asin(Yo(g,-1,1)),Math.abs(g)<.9999999?(this._x=Math.atan2(-v,m),this._y=Math.atan2(-w,u)):(this._x=0,this._y=Math.atan2(f,b));break;case"XZY":this._z=Math.asin(-Yo(p,-1,1)),Math.abs(p)<.9999999?(this._x=Math.atan2(S,m),this._y=Math.atan2(f,u)):(this._x=Math.atan2(-v,b),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,o===!0&&this._onChangeCallback(),this}setFromQuaternion(t,e,o){return jT.makeRotationFromQuaternion(t),this.setFromRotationMatrix(jT,e,o)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return QT.setFromEuler(this),this.setFromQuaternion(QT,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],t[3]!==void 0&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};Ul.DEFAULT_ORDER="XYZ";var Od=class{constructor(){this.mask=1}set(t){this.mask=(1<<t|0)>>>0}enable(t){this.mask|=1<<t|0}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t|0}disable(t){this.mask&=~(1<<t|0)}disableAll(){this.mask=0}test(t){return(this.mask&t.mask)!==0}isEnabled(t){return(this.mask&(1<<t|0))!==0}},iV=0,tC=new Rt,Mc=new ju,iu=new vi,od=new Rt,eh=new Rt,oV=new Rt,sV=new ju,eC=new Rt(1,0,0),nC=new Rt(0,1,0),rC=new Rt(0,0,1),aV={type:"added"},uV={type:"removed"},Dy={type:"childadded",child:null},Fy={type:"childremoved",child:null},ra=class n extends Ju{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:iV++}),this.uuid=Zu(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=n.DEFAULT_UP.clone();let t=new Rt,e=new Ul,o=new ju,s=new Rt(1,1,1);function u(){o.setFromEuler(e,!1)}function p(){e.setFromQuaternion(o,void 0,!1)}e._onChange(u),o._onChange(p),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:o},scale:{configurable:!0,enumerable:!0,value:s},modelViewMatrix:{value:new vi},normalMatrix:{value:new nn}}),this.matrix=new vi,this.matrixWorld=new vi,this.matrixAutoUpdate=n.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=n.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Od,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,e){this.quaternion.setFromAxisAngle(t,e)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,e){return Mc.setFromAxisAngle(t,e),this.quaternion.multiply(Mc),this}rotateOnWorldAxis(t,e){return Mc.setFromAxisAngle(t,e),this.quaternion.premultiply(Mc),this}rotateX(t){return this.rotateOnAxis(eC,t)}rotateY(t){return this.rotateOnAxis(nC,t)}rotateZ(t){return this.rotateOnAxis(rC,t)}translateOnAxis(t,e){return tC.copy(t).applyQuaternion(this.quaternion),this.position.add(tC.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(eC,t)}translateY(t){return this.translateOnAxis(nC,t)}translateZ(t){return this.translateOnAxis(rC,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(iu.copy(this.matrixWorld).invert())}lookAt(t,e,o){t.isVector3?od.copy(t):od.set(t,e,o);let s=this.parent;this.updateWorldMatrix(!0,!1),eh.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?iu.lookAt(eh,od,this.up):iu.lookAt(od,eh,this.up),this.quaternion.setFromRotationMatrix(iu),s&&(iu.extractRotation(s.matrixWorld),Mc.setFromRotationMatrix(iu),this.quaternion.premultiply(Mc.invert()))}add(t){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return t===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(t.parent!==null&&t.parent.remove(t),t.parent=this,this.children.push(t),t.dispatchEvent(aV),Dy.child=t,this.dispatchEvent(Dy),Dy.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)}remove(t){if(arguments.length>1){for(let o=0;o<arguments.length;o++)this.remove(arguments[o]);return this}let e=this.children.indexOf(t);return e!==-1&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(uV),Fy.child=t,this.dispatchEvent(Fy),Fy.child=null),this}removeFromParent(){let t=this.parent;return t!==null&&t.remove(this),this}clear(){return this.remove(...this.children)}attach(t){return this.updateWorldMatrix(!0,!1),iu.copy(this.matrixWorld).invert(),t.parent!==null&&(t.parent.updateWorldMatrix(!0,!1),iu.multiply(t.parent.matrixWorld)),t.applyMatrix4(iu),this.add(t),t.updateWorldMatrix(!1,!0),this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,e){if(this[t]===e)return this;for(let o=0,s=this.children.length;o<s;o++){let p=this.children[o].getObjectByProperty(t,e);if(p!==void 0)return p}}getObjectsByProperty(t,e,o=[]){this[t]===e&&o.push(this);let s=this.children;for(let u=0,p=s.length;u<p;u++)s[u].getObjectsByProperty(t,e,o);return o}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(eh,t,oV),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(eh,sV,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);let e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()}raycast(){}traverse(t){t(this);let e=this.children;for(let o=0,s=e.length;o<s;o++)e[o].traverse(t)}traverseVisible(t){if(this.visible===!1)return;t(this);let e=this.children;for(let o=0,s=e.length;o<s;o++)e[o].traverseVisible(t)}traverseAncestors(t){let e=this.parent;e!==null&&(t(e),e.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,t=!0);let e=this.children;for(let o=0,s=e.length;o<s;o++){let u=e[o];(u.matrixWorldAutoUpdate===!0||t===!0)&&u.updateMatrixWorld(t)}}updateWorldMatrix(t,e){let o=this.parent;if(t===!0&&o!==null&&o.matrixWorldAutoUpdate===!0&&o.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),e===!0){let s=this.children;for(let u=0,p=s.length;u<p;u++){let f=s[u];f.matrixWorldAutoUpdate===!0&&f.updateWorldMatrix(!1,!0)}}}toJSON(t){let e=t===void 0||typeof t=="string",o={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},o.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});let s={};s.uuid=this.uuid,s.type=this.type,this.name!==""&&(s.name=this.name),this.castShadow===!0&&(s.castShadow=!0),this.receiveShadow===!0&&(s.receiveShadow=!0),this.visible===!1&&(s.visible=!1),this.frustumCulled===!1&&(s.frustumCulled=!1),this.renderOrder!==0&&(s.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(s.userData=this.userData),s.layers=this.layers.mask,s.matrix=this.matrix.toArray(),s.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(s.matrixAutoUpdate=!1),this.isInstancedMesh&&(s.type="InstancedMesh",s.count=this.count,s.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(s.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(s.type="BatchedMesh",s.perObjectFrustumCulled=this.perObjectFrustumCulled,s.sortObjects=this.sortObjects,s.drawRanges=this._drawRanges,s.reservedRanges=this._reservedRanges,s.visibility=this._visibility,s.active=this._active,s.bounds=this._bounds.map(f=>({boxInitialized:f.boxInitialized,boxMin:f.box.min.toArray(),boxMax:f.box.max.toArray(),sphereInitialized:f.sphereInitialized,sphereRadius:f.sphere.radius,sphereCenter:f.sphere.center.toArray()})),s.maxGeometryCount=this._maxGeometryCount,s.maxVertexCount=this._maxVertexCount,s.maxIndexCount=this._maxIndexCount,s.geometryInitialized=this._geometryInitialized,s.geometryCount=this._geometryCount,s.matricesTexture=this._matricesTexture.toJSON(t),this.boundingSphere!==null&&(s.boundingSphere={center:s.boundingSphere.center.toArray(),radius:s.boundingSphere.radius}),this.boundingBox!==null&&(s.boundingBox={min:s.boundingBox.min.toArray(),max:s.boundingBox.max.toArray()}));function u(f,g){return f[g.uuid]===void 0&&(f[g.uuid]=g.toJSON(t)),g.uuid}if(this.isScene)this.background&&(this.background.isColor?s.background=this.background.toJSON():this.background.isTexture&&(s.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(s.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){s.geometry=u(t.geometries,this.geometry);let f=this.geometry.parameters;if(f!==void 0&&f.shapes!==void 0){let g=f.shapes;if(Array.isArray(g))for(let m=0,v=g.length;m<v;m++){let w=g[m];u(t.shapes,w)}else u(t.shapes,g)}}if(this.isSkinnedMesh&&(s.bindMode=this.bindMode,s.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(u(t.skeletons,this.skeleton),s.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let f=[];for(let g=0,m=this.material.length;g<m;g++)f.push(u(t.materials,this.material[g]));s.material=f}else s.material=u(t.materials,this.material);if(this.children.length>0){s.children=[];for(let f=0;f<this.children.length;f++)s.children.push(this.children[f].toJSON(t).object)}if(this.animations.length>0){s.animations=[];for(let f=0;f<this.animations.length;f++){let g=this.animations[f];s.animations.push(u(t.animations,g))}}if(e){let f=p(t.geometries),g=p(t.materials),m=p(t.textures),v=p(t.images),w=p(t.shapes),S=p(t.skeletons),b=p(t.animations),C=p(t.nodes);f.length>0&&(o.geometries=f),g.length>0&&(o.materials=g),m.length>0&&(o.textures=m),v.length>0&&(o.images=v),w.length>0&&(o.shapes=w),S.length>0&&(o.skeletons=S),b.length>0&&(o.animations=b),C.length>0&&(o.nodes=C)}return o.object=s,o;function p(f){let g=[];for(let m in f){let v=f[m];delete v.metadata,g.push(v)}return g}}clone(t){return new this.constructor().copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),e===!0)for(let o=0;o<t.children.length;o++){let s=t.children[o];this.add(s.clone())}return this}};ra.DEFAULT_UP=new Rt(0,1,0);ra.DEFAULT_MATRIX_AUTO_UPDATE=!0;ra.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var Qs=new Rt,ou=new Rt,Uy=new Rt,su=new Rt,bc=new Rt,Ac=new Rt,iC=new Rt,By=new Rt,zy=new Rt,Gy=new Rt,Nl=class n{constructor(t=new Rt,e=new Rt,o=new Rt){this.a=t,this.b=e,this.c=o}static getNormal(t,e,o,s){s.subVectors(o,e),Qs.subVectors(t,e),s.cross(Qs);let u=s.lengthSq();return u>0?s.multiplyScalar(1/Math.sqrt(u)):s.set(0,0,0)}static getBarycoord(t,e,o,s,u){Qs.subVectors(s,e),ou.subVectors(o,e),Uy.subVectors(t,e);let p=Qs.dot(Qs),f=Qs.dot(ou),g=Qs.dot(Uy),m=ou.dot(ou),v=ou.dot(Uy),w=p*m-f*f;if(w===0)return u.set(0,0,0),null;let S=1/w,b=(m*g-f*v)*S,C=(p*v-f*g)*S;return u.set(1-b-C,C,b)}static containsPoint(t,e,o,s){return this.getBarycoord(t,e,o,s,su)===null?!1:su.x>=0&&su.y>=0&&su.x+su.y<=1}static getInterpolation(t,e,o,s,u,p,f,g){return this.getBarycoord(t,e,o,s,su)===null?(g.x=0,g.y=0,"z"in g&&(g.z=0),"w"in g&&(g.w=0),null):(g.setScalar(0),g.addScaledVector(u,su.x),g.addScaledVector(p,su.y),g.addScaledVector(f,su.z),g)}static isFrontFacing(t,e,o,s){return Qs.subVectors(o,e),ou.subVectors(t,e),Qs.cross(ou).dot(s)<0}set(t,e,o){return this.a.copy(t),this.b.copy(e),this.c.copy(o),this}setFromPointsAndIndices(t,e,o,s){return this.a.copy(t[e]),this.b.copy(t[o]),this.c.copy(t[s]),this}setFromAttributeAndIndices(t,e,o,s){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,o),this.c.fromBufferAttribute(t,s),this}clone(){return new this.constructor().copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return Qs.subVectors(this.c,this.b),ou.subVectors(this.a,this.b),Qs.cross(ou).length()*.5}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return n.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return n.getBarycoord(t,this.a,this.b,this.c,e)}getInterpolation(t,e,o,s,u){return n.getInterpolation(t,this.a,this.b,this.c,e,o,s,u)}containsPoint(t){return n.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return n.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){let o=this.a,s=this.b,u=this.c,p,f;bc.subVectors(s,o),Ac.subVectors(u,o),By.subVectors(t,o);let g=bc.dot(By),m=Ac.dot(By);if(g<=0&&m<=0)return e.copy(o);zy.subVectors(t,s);let v=bc.dot(zy),w=Ac.dot(zy);if(v>=0&&w<=v)return e.copy(s);let S=g*w-v*m;if(S<=0&&g>=0&&v<=0)return p=g/(g-v),e.copy(o).addScaledVector(bc,p);Gy.subVectors(t,u);let b=bc.dot(Gy),C=Ac.dot(Gy);if(C>=0&&b<=C)return e.copy(u);let R=b*m-g*C;if(R<=0&&m>=0&&C<=0)return f=m/(m-C),e.copy(o).addScaledVector(Ac,f);let x=v*C-b*w;if(x<=0&&w-v>=0&&b-C>=0)return iC.subVectors(u,s),f=(w-v)/(w-v+(b-C)),e.copy(s).addScaledVector(iC,f);let E=1/(x+R+S);return p=R*E,f=S*E,e.copy(o).addScaledVector(bc,p).addScaledVector(Ac,f)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}},$C={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},ku={h:0,s:0,l:0},sd={h:0,s:0,l:0};function ky(n,t,e){return e<0&&(e+=1),e>1&&(e-=1),e<1/6?n+(t-n)*6*e:e<1/2?t:e<2/3?n+(t-n)*6*(2/3-e):n}var ar=class{constructor(t,e,o){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,e,o)}set(t,e,o){if(e===void 0&&o===void 0){let s=t;s&&s.isColor?this.copy(s):typeof s=="number"?this.setHex(s):typeof s=="string"&&this.setStyle(s)}else this.setRGB(t,e,o);return this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=ba){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(t&255)/255,xr.toWorkingColorSpace(this,e),this}setRGB(t,e,o,s=xr.workingColorSpace){return this.r=t,this.g=e,this.b=o,xr.toWorkingColorSpace(this,s),this}setHSL(t,e,o,s=xr.workingColorSpace){if(t=K6(t,1),e=Yo(e,0,1),o=Yo(o,0,1),e===0)this.r=this.g=this.b=o;else{let u=o<=.5?o*(1+e):o+e-o*e,p=2*o-u;this.r=ky(p,u,t+1/3),this.g=ky(p,u,t),this.b=ky(p,u,t-1/3)}return xr.toWorkingColorSpace(this,s),this}setStyle(t,e=ba){function o(u){u!==void 0&&parseFloat(u)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}let s;if(s=/^(\w+)\(([^\)]*)\)/.exec(t)){let u,p=s[1],f=s[2];switch(p){case"rgb":case"rgba":if(u=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(f))return o(u[4]),this.setRGB(Math.min(255,parseInt(u[1],10))/255,Math.min(255,parseInt(u[2],10))/255,Math.min(255,parseInt(u[3],10))/255,e);if(u=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(f))return o(u[4]),this.setRGB(Math.min(100,parseInt(u[1],10))/100,Math.min(100,parseInt(u[2],10))/100,Math.min(100,parseInt(u[3],10))/100,e);break;case"hsl":case"hsla":if(u=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(f))return o(u[4]),this.setHSL(parseFloat(u[1])/360,parseFloat(u[2])/100,parseFloat(u[3])/100,e);break;default:console.warn("THREE.Color: Unknown color model "+t)}}else if(s=/^\#([A-Fa-f\d]+)$/.exec(t)){let u=s[1],p=u.length;if(p===3)return this.setRGB(parseInt(u.charAt(0),16)/15,parseInt(u.charAt(1),16)/15,parseInt(u.charAt(2),16)/15,e);if(p===6)return this.setHex(parseInt(u,16),e);console.warn("THREE.Color: Invalid hex color "+t)}else if(t&&t.length>0)return this.setColorName(t,e);return this}setColorName(t,e=ba){let o=$C[t.toLowerCase()];return o!==void 0?this.setHex(o,e):console.warn("THREE.Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=kc(t.r),this.g=kc(t.g),this.b=kc(t.b),this}copyLinearToSRGB(t){return this.r=Ty(t.r),this.g=Ty(t.g),this.b=Ty(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=ba){return xr.fromWorkingColorSpace(uo.copy(this),t),Math.round(Yo(uo.r*255,0,255))*65536+Math.round(Yo(uo.g*255,0,255))*256+Math.round(Yo(uo.b*255,0,255))}getHexString(t=ba){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=xr.workingColorSpace){xr.fromWorkingColorSpace(uo.copy(this),e);let o=uo.r,s=uo.g,u=uo.b,p=Math.max(o,s,u),f=Math.min(o,s,u),g,m,v=(f+p)/2;if(f===p)g=0,m=0;else{let w=p-f;switch(m=v<=.5?w/(p+f):w/(2-p-f),p){case o:g=(s-u)/w+(s<u?6:0);break;case s:g=(u-o)/w+2;break;case u:g=(o-s)/w+4;break}g/=6}return t.h=g,t.s=m,t.l=v,t}getRGB(t,e=xr.workingColorSpace){return xr.fromWorkingColorSpace(uo.copy(this),e),t.r=uo.r,t.g=uo.g,t.b=uo.b,t}getStyle(t=ba){xr.fromWorkingColorSpace(uo.copy(this),t);let e=uo.r,o=uo.g,s=uo.b;return t!==ba?`color(${t} ${e.toFixed(3)} ${o.toFixed(3)} ${s.toFixed(3)})`:`rgb(${Math.round(e*255)},${Math.round(o*255)},${Math.round(s*255)})`}offsetHSL(t,e,o){return this.getHSL(ku),this.setHSL(ku.h+t,ku.s+e,ku.l+o)}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,o){return this.r=t.r+(e.r-t.r)*o,this.g=t.g+(e.g-t.g)*o,this.b=t.b+(e.b-t.b)*o,this}lerpHSL(t,e){this.getHSL(ku),t.getHSL(sd);let o=by(ku.h,sd.h,e),s=by(ku.s,sd.s,e),u=by(ku.l,sd.l,e);return this.setHSL(o,s,u),this}setFromVector3(t){return this.r=t.x,this.g=t.y,this.b=t.z,this}applyMatrix3(t){let e=this.r,o=this.g,s=this.b,u=t.elements;return this.r=u[0]*e+u[3]*o+u[6]*s,this.g=u[1]*e+u[4]*o+u[7]*s,this.b=u[2]*e+u[5]*o+u[8]*s,this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this}toArray(t=[],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}},uo=new ar;ar.NAMES=$C;var lV=0,Bl=class extends Ju{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:lV++}),this.uuid=Zu(),this.name="",this.type="Material",this.blending=Gc,this.side=Ku,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Jy,this.blendDst=jy,this.blendEquation=Il,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new ar(0,0,0),this.blendAlpha=0,this.depthFunc=Sd,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=WT,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=vc,this.stencilZFail=vc,this.stencilZPass=vc,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(t){this._alphaTest>0!=t>0&&this.version++,this._alphaTest=t}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(t!==void 0)for(let e in t){let o=t[e];if(o===void 0){console.warn(`THREE.Material: parameter '${e}' has value of undefined.`);continue}let s=this[e];if(s===void 0){console.warn(`THREE.Material: '${e}' is not a property of THREE.${this.type}.`);continue}s&&s.isColor?s.set(o):s&&s.isVector3&&o&&o.isVector3?s.copy(o):this[e]=o}}toJSON(t){let e=t===void 0||typeof t=="string";e&&(t={textures:{},images:{}});let o={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};o.uuid=this.uuid,o.type=this.type,this.name!==""&&(o.name=this.name),this.color&&this.color.isColor&&(o.color=this.color.getHex()),this.roughness!==void 0&&(o.roughness=this.roughness),this.metalness!==void 0&&(o.metalness=this.metalness),this.sheen!==void 0&&(o.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(o.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(o.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(o.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(o.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(o.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(o.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(o.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(o.shininess=this.shininess),this.clearcoat!==void 0&&(o.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(o.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(o.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(o.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(o.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,o.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.iridescence!==void 0&&(o.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(o.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(o.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(o.iridescenceMap=this.iridescenceMap.toJSON(t).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(o.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(t).uuid),this.anisotropy!==void 0&&(o.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(o.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(o.anisotropyMap=this.anisotropyMap.toJSON(t).uuid),this.map&&this.map.isTexture&&(o.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(o.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(o.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(o.lightMap=this.lightMap.toJSON(t).uuid,o.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(o.aoMap=this.aoMap.toJSON(t).uuid,o.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(o.bumpMap=this.bumpMap.toJSON(t).uuid,o.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(o.normalMap=this.normalMap.toJSON(t).uuid,o.normalMapType=this.normalMapType,o.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(o.displacementMap=this.displacementMap.toJSON(t).uuid,o.displacementScale=this.displacementScale,o.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(o.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(o.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(o.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(o.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(o.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(o.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(o.envMap=this.envMap.toJSON(t).uuid,this.combine!==void 0&&(o.combine=this.combine)),this.envMapRotation!==void 0&&(o.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(o.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(o.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(o.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(o.gradientMap=this.gradientMap.toJSON(t).uuid),this.transmission!==void 0&&(o.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(o.transmissionMap=this.transmissionMap.toJSON(t).uuid),this.thickness!==void 0&&(o.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(o.thicknessMap=this.thicknessMap.toJSON(t).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(o.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(o.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(o.size=this.size),this.shadowSide!==null&&(o.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(o.sizeAttenuation=this.sizeAttenuation),this.blending!==Gc&&(o.blending=this.blending),this.side!==Ku&&(o.side=this.side),this.vertexColors===!0&&(o.vertexColors=!0),this.opacity<1&&(o.opacity=this.opacity),this.transparent===!0&&(o.transparent=!0),this.blendSrc!==Jy&&(o.blendSrc=this.blendSrc),this.blendDst!==jy&&(o.blendDst=this.blendDst),this.blendEquation!==Il&&(o.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(o.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(o.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(o.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(o.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(o.blendAlpha=this.blendAlpha),this.depthFunc!==Sd&&(o.depthFunc=this.depthFunc),this.depthTest===!1&&(o.depthTest=this.depthTest),this.depthWrite===!1&&(o.depthWrite=this.depthWrite),this.colorWrite===!1&&(o.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(o.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==WT&&(o.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(o.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(o.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==vc&&(o.stencilFail=this.stencilFail),this.stencilZFail!==vc&&(o.stencilZFail=this.stencilZFail),this.stencilZPass!==vc&&(o.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(o.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(o.rotation=this.rotation),this.polygonOffset===!0&&(o.polygonOffset=!0),this.polygonOffsetFactor!==0&&(o.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(o.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(o.linewidth=this.linewidth),this.dashSize!==void 0&&(o.dashSize=this.dashSize),this.gapSize!==void 0&&(o.gapSize=this.gapSize),this.scale!==void 0&&(o.scale=this.scale),this.dithering===!0&&(o.dithering=!0),this.alphaTest>0&&(o.alphaTest=this.alphaTest),this.alphaHash===!0&&(o.alphaHash=!0),this.alphaToCoverage===!0&&(o.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(o.premultipliedAlpha=!0),this.forceSinglePass===!0&&(o.forceSinglePass=!0),this.wireframe===!0&&(o.wireframe=!0),this.wireframeLinewidth>1&&(o.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(o.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(o.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(o.flatShading=!0),this.visible===!1&&(o.visible=!1),this.toneMapped===!1&&(o.toneMapped=!1),this.fog===!1&&(o.fog=!1),Object.keys(this.userData).length>0&&(o.userData=this.userData);function s(u){let p=[];for(let f in u){let g=u[f];delete g.metadata,p.push(g)}return p}if(e){let u=s(t.textures),p=s(t.images);u.length>0&&(o.textures=u),p.length>0&&(o.images=p)}return o}clone(){return new this.constructor().copy(this)}copy(t){this.name=t.name,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.blendColor.copy(t.blendColor),this.blendAlpha=t.blendAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;let e=t.clippingPlanes,o=null;if(e!==null){let s=e.length;o=new Array(s);for(let u=0;u!==s;++u)o[u]=e[u].clone()}return this.clippingPlanes=o,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaHash=t.alphaHash,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.forceSinglePass=t.forceSinglePass,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){t===!0&&this.version++}},Dd=class extends Bl{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new ar(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ul,this.combine=FC,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}};var hi=new Rt,ad=new Ye,gs=class{constructor(t,e,o=!1){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=t,this.itemSize=e,this.count=t!==void 0?t.length/e:0,this.normalized=o,this.usage=rv,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=cu,this.version=0}onUploadCallback(){}set needsUpdate(t){t===!0&&this.version++}get updateRange(){return YC("THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this.gpuType=t.gpuType,this}copyAt(t,e,o){t*=this.itemSize,o*=e.itemSize;for(let s=0,u=this.itemSize;s<u;s++)this.array[t+s]=e.array[o+s];return this}copyArray(t){return this.array.set(t),this}applyMatrix3(t){if(this.itemSize===2)for(let e=0,o=this.count;e<o;e++)ad.fromBufferAttribute(this,e),ad.applyMatrix3(t),this.setXY(e,ad.x,ad.y);else if(this.itemSize===3)for(let e=0,o=this.count;e<o;e++)hi.fromBufferAttribute(this,e),hi.applyMatrix3(t),this.setXYZ(e,hi.x,hi.y,hi.z);return this}applyMatrix4(t){for(let e=0,o=this.count;e<o;e++)hi.fromBufferAttribute(this,e),hi.applyMatrix4(t),this.setXYZ(e,hi.x,hi.y,hi.z);return this}applyNormalMatrix(t){for(let e=0,o=this.count;e<o;e++)hi.fromBufferAttribute(this,e),hi.applyNormalMatrix(t),this.setXYZ(e,hi.x,hi.y,hi.z);return this}transformDirection(t){for(let e=0,o=this.count;e<o;e++)hi.fromBufferAttribute(this,e),hi.transformDirection(t),this.setXYZ(e,hi.x,hi.y,hi.z);return this}set(t,e=0){return this.array.set(t,e),this}getComponent(t,e){let o=this.array[t*this.itemSize+e];return this.normalized&&(o=Ta(o,this.array)),o}setComponent(t,e,o){return this.normalized&&(o=_r(o,this.array)),this.array[t*this.itemSize+e]=o,this}getX(t){let e=this.array[t*this.itemSize];return this.normalized&&(e=Ta(e,this.array)),e}setX(t,e){return this.normalized&&(e=_r(e,this.array)),this.array[t*this.itemSize]=e,this}getY(t){let e=this.array[t*this.itemSize+1];return this.normalized&&(e=Ta(e,this.array)),e}setY(t,e){return this.normalized&&(e=_r(e,this.array)),this.array[t*this.itemSize+1]=e,this}getZ(t){let e=this.array[t*this.itemSize+2];return this.normalized&&(e=Ta(e,this.array)),e}setZ(t,e){return this.normalized&&(e=_r(e,this.array)),this.array[t*this.itemSize+2]=e,this}getW(t){let e=this.array[t*this.itemSize+3];return this.normalized&&(e=Ta(e,this.array)),e}setW(t,e){return this.normalized&&(e=_r(e,this.array)),this.array[t*this.itemSize+3]=e,this}setXY(t,e,o){return t*=this.itemSize,this.normalized&&(e=_r(e,this.array),o=_r(o,this.array)),this.array[t+0]=e,this.array[t+1]=o,this}setXYZ(t,e,o,s){return t*=this.itemSize,this.normalized&&(e=_r(e,this.array),o=_r(o,this.array),s=_r(s,this.array)),this.array[t+0]=e,this.array[t+1]=o,this.array[t+2]=s,this}setXYZW(t,e,o,s,u){return t*=this.itemSize,this.normalized&&(e=_r(e,this.array),o=_r(o,this.array),s=_r(s,this.array),u=_r(u,this.array)),this.array[t+0]=e,this.array[t+1]=o,this.array[t+2]=s,this.array[t+3]=u,this}onUpload(t){return this.onUploadCallback=t,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let t={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(t.name=this.name),this.usage!==rv&&(t.usage=this.usage),t}};var Fd=class extends gs{constructor(t,e,o){super(new Uint16Array(t),e,o)}};var Ud=class extends gs{constructor(t,e,o){super(new Uint32Array(t),e,o)}};var hu=class extends gs{constructor(t,e,o){super(new Float32Array(t),e,o)}},cV=0,Ds=new vi,qy=new ra,Tc=new Rt,ps=new Fl,nh=new Fl,Bi=new Rt,Qu=class n extends Ju{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:cV++}),this.uuid=Zu(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(t){return Array.isArray(t)?this.index=new(XC(t)?Ud:Fd)(t,1):this.index=t,this}getAttribute(t){return this.attributes[t]}setAttribute(t,e){return this.attributes[t]=e,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return this.attributes[t]!==void 0}addGroup(t,e,o=0){this.groups.push({start:t,count:e,materialIndex:o})}clearGroups(){this.groups=[]}setDrawRange(t,e){this.drawRange.start=t,this.drawRange.count=e}applyMatrix4(t){let e=this.attributes.position;e!==void 0&&(e.applyMatrix4(t),e.needsUpdate=!0);let o=this.attributes.normal;if(o!==void 0){let u=new nn().getNormalMatrix(t);o.applyNormalMatrix(u),o.needsUpdate=!0}let s=this.attributes.tangent;return s!==void 0&&(s.transformDirection(t),s.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(t){return Ds.makeRotationFromQuaternion(t),this.applyMatrix4(Ds),this}rotateX(t){return Ds.makeRotationX(t),this.applyMatrix4(Ds),this}rotateY(t){return Ds.makeRotationY(t),this.applyMatrix4(Ds),this}rotateZ(t){return Ds.makeRotationZ(t),this.applyMatrix4(Ds),this}translate(t,e,o){return Ds.makeTranslation(t,e,o),this.applyMatrix4(Ds),this}scale(t,e,o){return Ds.makeScale(t,e,o),this.applyMatrix4(Ds),this}lookAt(t){return qy.lookAt(t),qy.updateMatrix(),this.applyMatrix4(qy.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Tc).negate(),this.translate(Tc.x,Tc.y,Tc.z),this}setFromPoints(t){let e=[];for(let o=0,s=t.length;o<s;o++){let u=t[o];e.push(u.x,u.y,u.z||0)}return this.setAttribute("position",new hu(e,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Fl);let t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new Rt(-1/0,-1/0,-1/0),new Rt(1/0,1/0,1/0));return}if(t!==void 0){if(this.boundingBox.setFromBufferAttribute(t),e)for(let o=0,s=e.length;o<s;o++){let u=e[o];ps.setFromBufferAttribute(u),this.morphTargetsRelative?(Bi.addVectors(this.boundingBox.min,ps.min),this.boundingBox.expandByPoint(Bi),Bi.addVectors(this.boundingBox.max,ps.max),this.boundingBox.expandByPoint(Bi)):(this.boundingBox.expandByPoint(ps.min),this.boundingBox.expandByPoint(ps.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new uh);let t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new Rt,1/0);return}if(t){let o=this.boundingSphere.center;if(ps.setFromBufferAttribute(t),e)for(let u=0,p=e.length;u<p;u++){let f=e[u];nh.setFromBufferAttribute(f),this.morphTargetsRelative?(Bi.addVectors(ps.min,nh.min),ps.expandByPoint(Bi),Bi.addVectors(ps.max,nh.max),ps.expandByPoint(Bi)):(ps.expandByPoint(nh.min),ps.expandByPoint(nh.max))}ps.getCenter(o);let s=0;for(let u=0,p=t.count;u<p;u++)Bi.fromBufferAttribute(t,u),s=Math.max(s,o.distanceToSquared(Bi));if(e)for(let u=0,p=e.length;u<p;u++){let f=e[u],g=this.morphTargetsRelative;for(let m=0,v=f.count;m<v;m++)Bi.fromBufferAttribute(f,m),g&&(Tc.fromBufferAttribute(t,m),Bi.add(Tc)),s=Math.max(s,o.distanceToSquared(Bi))}this.boundingSphere.radius=Math.sqrt(s),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let t=this.index,e=this.attributes;if(t===null||e.position===void 0||e.normal===void 0||e.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}let o=e.position,s=e.normal,u=e.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new gs(new Float32Array(4*o.count),4));let p=this.getAttribute("tangent"),f=[],g=[];for(let D=0;D<o.count;D++)f[D]=new Rt,g[D]=new Rt;let m=new Rt,v=new Rt,w=new Rt,S=new Ye,b=new Ye,C=new Ye,R=new Rt,x=new Rt;function E(D,xt,B){m.fromBufferAttribute(o,D),v.fromBufferAttribute(o,xt),w.fromBufferAttribute(o,B),S.fromBufferAttribute(u,D),b.fromBufferAttribute(u,xt),C.fromBufferAttribute(u,B),v.sub(m),w.sub(m),b.sub(S),C.sub(S);let j=1/(b.x*C.y-C.x*b.y);isFinite(j)&&(R.copy(v).multiplyScalar(C.y).addScaledVector(w,-b.y).multiplyScalar(j),x.copy(w).multiplyScalar(b.x).addScaledVector(v,-C.x).multiplyScalar(j),f[D].add(R),f[xt].add(R),f[B].add(R),g[D].add(x),g[xt].add(x),g[B].add(x))}let I=this.groups;I.length===0&&(I=[{start:0,count:t.count}]);for(let D=0,xt=I.length;D<xt;++D){let B=I[D],j=B.start,K=B.count;for(let Dt=j,Q=j+K;Dt<Q;Dt+=3)E(t.getX(Dt+0),t.getX(Dt+1),t.getX(Dt+2))}let A=new Rt,F=new Rt,V=new Rt,X=new Rt;function q(D){V.fromBufferAttribute(s,D),X.copy(V);let xt=f[D];A.copy(xt),A.sub(V.multiplyScalar(V.dot(xt))).normalize(),F.crossVectors(X,xt);let j=F.dot(g[D])<0?-1:1;p.setXYZW(D,A.x,A.y,A.z,j)}for(let D=0,xt=I.length;D<xt;++D){let B=I[D],j=B.start,K=B.count;for(let Dt=j,Q=j+K;Dt<Q;Dt+=3)q(t.getX(Dt+0)),q(t.getX(Dt+1)),q(t.getX(Dt+2))}}computeVertexNormals(){let t=this.index,e=this.getAttribute("position");if(e!==void 0){let o=this.getAttribute("normal");if(o===void 0)o=new gs(new Float32Array(e.count*3),3),this.setAttribute("normal",o);else for(let S=0,b=o.count;S<b;S++)o.setXYZ(S,0,0,0);let s=new Rt,u=new Rt,p=new Rt,f=new Rt,g=new Rt,m=new Rt,v=new Rt,w=new Rt;if(t)for(let S=0,b=t.count;S<b;S+=3){let C=t.getX(S+0),R=t.getX(S+1),x=t.getX(S+2);s.fromBufferAttribute(e,C),u.fromBufferAttribute(e,R),p.fromBufferAttribute(e,x),v.subVectors(p,u),w.subVectors(s,u),v.cross(w),f.fromBufferAttribute(o,C),g.fromBufferAttribute(o,R),m.fromBufferAttribute(o,x),f.add(v),g.add(v),m.add(v),o.setXYZ(C,f.x,f.y,f.z),o.setXYZ(R,g.x,g.y,g.z),o.setXYZ(x,m.x,m.y,m.z)}else for(let S=0,b=e.count;S<b;S+=3)s.fromBufferAttribute(e,S+0),u.fromBufferAttribute(e,S+1),p.fromBufferAttribute(e,S+2),v.subVectors(p,u),w.subVectors(s,u),v.cross(w),o.setXYZ(S+0,v.x,v.y,v.z),o.setXYZ(S+1,v.x,v.y,v.z),o.setXYZ(S+2,v.x,v.y,v.z);this.normalizeNormals(),o.needsUpdate=!0}}normalizeNormals(){let t=this.attributes.normal;for(let e=0,o=t.count;e<o;e++)Bi.fromBufferAttribute(t,e),Bi.normalize(),t.setXYZ(e,Bi.x,Bi.y,Bi.z)}toNonIndexed(){function t(f,g){let m=f.array,v=f.itemSize,w=f.normalized,S=new m.constructor(g.length*v),b=0,C=0;for(let R=0,x=g.length;R<x;R++){f.isInterleavedBufferAttribute?b=g[R]*f.data.stride+f.offset:b=g[R]*v;for(let E=0;E<v;E++)S[C++]=m[b++]}return new gs(S,v,w)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let e=new n,o=this.index.array,s=this.attributes;for(let f in s){let g=s[f],m=t(g,o);e.setAttribute(f,m)}let u=this.morphAttributes;for(let f in u){let g=[],m=u[f];for(let v=0,w=m.length;v<w;v++){let S=m[v],b=t(S,o);g.push(b)}e.morphAttributes[f]=g}e.morphTargetsRelative=this.morphTargetsRelative;let p=this.groups;for(let f=0,g=p.length;f<g;f++){let m=p[f];e.addGroup(m.start,m.count,m.materialIndex)}return e}toJSON(){let t={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,this.name!==""&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),this.parameters!==void 0){let g=this.parameters;for(let m in g)g[m]!==void 0&&(t[m]=g[m]);return t}t.data={attributes:{}};let e=this.index;e!==null&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});let o=this.attributes;for(let g in o){let m=o[g];t.data.attributes[g]=m.toJSON(t.data)}let s={},u=!1;for(let g in this.morphAttributes){let m=this.morphAttributes[g],v=[];for(let w=0,S=m.length;w<S;w++){let b=m[w];v.push(b.toJSON(t.data))}v.length>0&&(s[g]=v,u=!0)}u&&(t.data.morphAttributes=s,t.data.morphTargetsRelative=this.morphTargetsRelative);let p=this.groups;p.length>0&&(t.data.groups=JSON.parse(JSON.stringify(p)));let f=this.boundingSphere;return f!==null&&(t.data.boundingSphere={center:f.center.toArray(),radius:f.radius}),t}clone(){return new this.constructor().copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let e={};this.name=t.name;let o=t.index;o!==null&&this.setIndex(o.clone(e));let s=t.attributes;for(let m in s){let v=s[m];this.setAttribute(m,v.clone(e))}let u=t.morphAttributes;for(let m in u){let v=[],w=u[m];for(let S=0,b=w.length;S<b;S++)v.push(w[S].clone(e));this.morphAttributes[m]=v}this.morphTargetsRelative=t.morphTargetsRelative;let p=t.groups;for(let m=0,v=p.length;m<v;m++){let w=p[m];this.addGroup(w.start,w.count,w.materialIndex)}let f=t.boundingBox;f!==null&&(this.boundingBox=f.clone());let g=t.boundingSphere;return g!==null&&(this.boundingSphere=g.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}},oC=new vi,bl=new lv,ud=new uh,sC=new Rt,Cc=new Rt,Pc=new Rt,Ic=new Rt,Hy=new Rt,ld=new Rt,cd=new Ye,fd=new Ye,hd=new Ye,aC=new Rt,uC=new Rt,lC=new Rt,pd=new Rt,dd=new Rt,na=class extends ra{constructor(t=new Qu,e=new Dd){super(),this.isMesh=!0,this.type="Mesh",this.geometry=t,this.material=e,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),t.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),t.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}updateMorphTargets(){let e=this.geometry.morphAttributes,o=Object.keys(e);if(o.length>0){let s=e[o[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let u=0,p=s.length;u<p;u++){let f=s[u].name||String(u);this.morphTargetInfluences.push(0),this.morphTargetDictionary[f]=u}}}}getVertexPosition(t,e){let o=this.geometry,s=o.attributes.position,u=o.morphAttributes.position,p=o.morphTargetsRelative;e.fromBufferAttribute(s,t);let f=this.morphTargetInfluences;if(u&&f){ld.set(0,0,0);for(let g=0,m=u.length;g<m;g++){let v=f[g],w=u[g];v!==0&&(Hy.fromBufferAttribute(w,t),p?ld.addScaledVector(Hy,v):ld.addScaledVector(Hy.sub(e),v))}e.add(ld)}return e}raycast(t,e){let o=this.geometry,s=this.material,u=this.matrixWorld;s!==void 0&&(o.boundingSphere===null&&o.computeBoundingSphere(),ud.copy(o.boundingSphere),ud.applyMatrix4(u),bl.copy(t.ray).recast(t.near),!(ud.containsPoint(bl.origin)===!1&&(bl.intersectSphere(ud,sC)===null||bl.origin.distanceToSquared(sC)>(t.far-t.near)**2))&&(oC.copy(u).invert(),bl.copy(t.ray).applyMatrix4(oC),!(o.boundingBox!==null&&bl.intersectsBox(o.boundingBox)===!1)&&this._computeIntersections(t,e,bl)))}_computeIntersections(t,e,o){let s,u=this.geometry,p=this.material,f=u.index,g=u.attributes.position,m=u.attributes.uv,v=u.attributes.uv1,w=u.attributes.normal,S=u.groups,b=u.drawRange;if(f!==null)if(Array.isArray(p))for(let C=0,R=S.length;C<R;C++){let x=S[C],E=p[x.materialIndex],I=Math.max(x.start,b.start),A=Math.min(f.count,Math.min(x.start+x.count,b.start+b.count));for(let F=I,V=A;F<V;F+=3){let X=f.getX(F),q=f.getX(F+1),D=f.getX(F+2);s=gd(this,E,t,o,m,v,w,X,q,D),s&&(s.faceIndex=Math.floor(F/3),s.face.materialIndex=x.materialIndex,e.push(s))}}else{let C=Math.max(0,b.start),R=Math.min(f.count,b.start+b.count);for(let x=C,E=R;x<E;x+=3){let I=f.getX(x),A=f.getX(x+1),F=f.getX(x+2);s=gd(this,p,t,o,m,v,w,I,A,F),s&&(s.faceIndex=Math.floor(x/3),e.push(s))}}else if(g!==void 0)if(Array.isArray(p))for(let C=0,R=S.length;C<R;C++){let x=S[C],E=p[x.materialIndex],I=Math.max(x.start,b.start),A=Math.min(g.count,Math.min(x.start+x.count,b.start+b.count));for(let F=I,V=A;F<V;F+=3){let X=F,q=F+1,D=F+2;s=gd(this,E,t,o,m,v,w,X,q,D),s&&(s.faceIndex=Math.floor(F/3),s.face.materialIndex=x.materialIndex,e.push(s))}}else{let C=Math.max(0,b.start),R=Math.min(g.count,b.start+b.count);for(let x=C,E=R;x<E;x+=3){let I=x,A=x+1,F=x+2;s=gd(this,p,t,o,m,v,w,I,A,F),s&&(s.faceIndex=Math.floor(x/3),e.push(s))}}}};function fV(n,t,e,o,s,u,p,f){let g;if(t.side===$o?g=o.intersectTriangle(p,u,s,!0,f):g=o.intersectTriangle(s,u,p,t.side===Ku,f),g===null)return null;dd.copy(f),dd.applyMatrix4(n.matrixWorld);let m=e.ray.origin.distanceTo(dd);return m<e.near||m>e.far?null:{distance:m,point:dd.clone(),object:n}}function gd(n,t,e,o,s,u,p,f,g,m){n.getVertexPosition(f,Cc),n.getVertexPosition(g,Pc),n.getVertexPosition(m,Ic);let v=fV(n,t,e,o,Cc,Pc,Ic,pd);if(v){s&&(cd.fromBufferAttribute(s,f),fd.fromBufferAttribute(s,g),hd.fromBufferAttribute(s,m),v.uv=Nl.getInterpolation(pd,Cc,Pc,Ic,cd,fd,hd,new Ye)),u&&(cd.fromBufferAttribute(u,f),fd.fromBufferAttribute(u,g),hd.fromBufferAttribute(u,m),v.uv1=Nl.getInterpolation(pd,Cc,Pc,Ic,cd,fd,hd,new Ye)),p&&(aC.fromBufferAttribute(p,f),uC.fromBufferAttribute(p,g),lC.fromBufferAttribute(p,m),v.normal=Nl.getInterpolation(pd,Cc,Pc,Ic,aC,uC,lC,new Rt),v.normal.dot(o.direction)>0&&v.normal.multiplyScalar(-1));let w={a:f,b:g,c:m,normal:new Rt,materialIndex:0};Nl.getNormal(Cc,Pc,Ic,w.normal),v.face=w}return v}var lh=class n extends Qu{constructor(t=1,e=1,o=1,s=1,u=1,p=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:o,widthSegments:s,heightSegments:u,depthSegments:p};let f=this;s=Math.floor(s),u=Math.floor(u),p=Math.floor(p);let g=[],m=[],v=[],w=[],S=0,b=0;C("z","y","x",-1,-1,o,e,t,p,u,0),C("z","y","x",1,-1,o,e,-t,p,u,1),C("x","z","y",1,1,t,o,e,s,p,2),C("x","z","y",1,-1,t,o,-e,s,p,3),C("x","y","z",1,-1,t,e,o,s,u,4),C("x","y","z",-1,-1,t,e,-o,s,u,5),this.setIndex(g),this.setAttribute("position",new hu(m,3)),this.setAttribute("normal",new hu(v,3)),this.setAttribute("uv",new hu(w,2));function C(R,x,E,I,A,F,V,X,q,D,xt){let B=F/q,j=V/D,K=F/2,Dt=V/2,Q=X/2,At=q+1,Mt=D+1,Lt=0,pt=0,yt=new Rt;for(let J=0;J<Mt;J++){let Bt=J*j-Dt;for(let Gt=0;Gt<At;Gt++){let ae=Gt*B-K;yt[R]=ae*I,yt[x]=Bt*A,yt[E]=Q,m.push(yt.x,yt.y,yt.z),yt[R]=0,yt[x]=0,yt[E]=X>0?1:-1,v.push(yt.x,yt.y,yt.z),w.push(Gt/q),w.push(1-J/D),Lt+=1}}for(let J=0;J<D;J++)for(let Bt=0;Bt<q;Bt++){let Gt=S+Bt+At*J,ae=S+Bt+At*(J+1),ut=S+(Bt+1)+At*(J+1),Ut=S+(Bt+1)+At*J;g.push(Gt,ae,Ut),g.push(ae,ut,Ut),pt+=6}f.addGroup(b,pt,xt),b+=pt,S+=Lt}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new n(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}};function Xc(n){let t={};for(let e in n){t[e]={};for(let o in n[e]){let s=n[e][o];s&&(s.isColor||s.isMatrix3||s.isMatrix4||s.isVector2||s.isVector3||s.isVector4||s.isTexture||s.isQuaternion)?s.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),t[e][o]=null):t[e][o]=s.clone():Array.isArray(s)?t[e][o]=s.slice():t[e][o]=s}}return t}function So(n){let t={};for(let e=0;e<n.length;e++){let o=Xc(n[e]);for(let s in o)t[s]=o[s]}return t}function hV(n){let t=[];for(let e=0;e<n.length;e++)t.push(n[e].clone());return t}function ZC(n){return n.getRenderTarget()===null?n.outputColorSpace:xr.workingColorSpace}var pV={clone:Xc,merge:So},dV=`void main() {
27
27
  gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
28
28
  }`,gV=`void main() {
29
29
  gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
@@ -3822,4 +3822,4 @@ void main() {
3822
3822
  }
3823
3823
 
3824
3824
  }`,wv=class{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(t,e,o){if(this.texture===null){let s=new Fs,u=t.properties.get(s);u.__webglTexture=e.texture,(e.depthNear!=o.depthNear||e.depthFar!=o.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=s}}render(t,e){if(this.texture!==null){if(this.mesh===null){let o=e.cameras[0].viewport,s=new Ca({extensions:{fragDepth:!0},vertexShader:HX,fragmentShader:VX,uniforms:{depthColor:{value:this.texture},depthWidth:{value:o.z},depthHeight:{value:o.w}}});this.mesh=new na(new kd(20,20),s)}t.render(this.mesh,e)}}reset(){this.texture=null,this.mesh=null}},Sv=class extends Ju{constructor(t,e){super();let o=this,s=null,u=1,p=null,f="local-floor",g=1,m=null,v=null,w=null,S=null,b=null,C=null,R=new wv,x=e.getContextAttributes(),E=null,I=null,A=[],F=[],V=new Ye,X=null,q=new ds;q.layers.enable(1),q.viewport=new Qi;let D=new ds;D.layers.enable(2),D.viewport=new Qi;let xt=[q,D],B=new Ev;B.layers.enable(1),B.layers.enable(2);let j=null,K=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(ut){let Ut=A[ut];return Ut===void 0&&(Ut=new sh,A[ut]=Ut),Ut.getTargetRaySpace()},this.getControllerGrip=function(ut){let Ut=A[ut];return Ut===void 0&&(Ut=new sh,A[ut]=Ut),Ut.getGripSpace()},this.getHand=function(ut){let Ut=A[ut];return Ut===void 0&&(Ut=new sh,A[ut]=Ut),Ut.getHandSpace()};function Dt(ut){let Ut=F.indexOf(ut.inputSource);if(Ut===-1)return;let jt=A[Ut];jt!==void 0&&(jt.update(ut.inputSource,ut.frame,m||p),jt.dispatchEvent({type:ut.type,data:ut.inputSource}))}function Q(){s.removeEventListener("select",Dt),s.removeEventListener("selectstart",Dt),s.removeEventListener("selectend",Dt),s.removeEventListener("squeeze",Dt),s.removeEventListener("squeezestart",Dt),s.removeEventListener("squeezeend",Dt),s.removeEventListener("end",Q),s.removeEventListener("inputsourceschange",At);for(let ut=0;ut<A.length;ut++){let Ut=F[ut];Ut!==null&&(F[ut]=null,A[ut].disconnect(Ut))}j=null,K=null,R.reset(),t.setRenderTarget(E),b=null,S=null,w=null,s=null,I=null,ae.stop(),o.isPresenting=!1,t.setPixelRatio(X),t.setSize(V.width,V.height,!1),o.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(ut){u=ut,o.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(ut){f=ut,o.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return m||p},this.setReferenceSpace=function(ut){m=ut},this.getBaseLayer=function(){return S!==null?S:b},this.getBinding=function(){return w},this.getFrame=function(){return C},this.getSession=function(){return s},this.setSession=function(ut){return Ru(this,null,function*(){if(s=ut,s!==null){if(E=t.getRenderTarget(),s.addEventListener("select",Dt),s.addEventListener("selectstart",Dt),s.addEventListener("selectend",Dt),s.addEventListener("squeeze",Dt),s.addEventListener("squeezestart",Dt),s.addEventListener("squeezeend",Dt),s.addEventListener("end",Q),s.addEventListener("inputsourceschange",At),x.xrCompatible!==!0&&(yield e.makeXRCompatible()),X=t.getPixelRatio(),t.getSize(V),s.renderState.layers===void 0||t.capabilities.isWebGL2===!1){let Ut={antialias:s.renderState.layers===void 0?x.antialias:!0,alpha:!0,depth:x.depth,stencil:x.stencil,framebufferScaleFactor:u};b=new XRWebGLLayer(s,e,Ut),s.updateRenderState({baseLayer:b}),t.setPixelRatio(1),t.setSize(b.framebufferWidth,b.framebufferHeight,!1),I=new pu(b.framebufferWidth,b.framebufferHeight,{format:ea,type:$u,colorSpace:t.outputColorSpace,stencilBuffer:x.stencil})}else{let Ut=null,jt=null,ce=null;x.depth&&(ce=x.stencil?e.DEPTH24_STENCIL8:e.DEPTH_COMPONENT24,Ut=x.stencil?Wc:Dl,jt=x.stencil?Ol:Wu);let te={colorFormat:e.RGBA8,depthFormat:ce,scaleFactor:u};w=new XRWebGLBinding(s,e),S=w.createProjectionLayer(te),s.updateRenderState({layers:[S]}),t.setPixelRatio(1),t.setSize(S.textureWidth,S.textureHeight,!1),I=new pu(S.textureWidth,S.textureHeight,{format:ea,type:$u,depthTexture:new Hd(S.textureWidth,S.textureHeight,jt,void 0,void 0,void 0,void 0,void 0,void 0,Ut),stencilBuffer:x.stencil,colorSpace:t.outputColorSpace,samples:x.antialias?4:0});let $t=t.properties.get(I);$t.__ignoreDepthValues=S.ignoreDepthValues}I.isXRRenderTarget=!0,this.setFoveation(g),m=null,p=yield s.requestReferenceSpace(f),ae.setContext(s),ae.start(),o.isPresenting=!0,o.dispatchEvent({type:"sessionstart"})}})},this.getEnvironmentBlendMode=function(){if(s!==null)return s.environmentBlendMode};function At(ut){for(let Ut=0;Ut<ut.removed.length;Ut++){let jt=ut.removed[Ut],ce=F.indexOf(jt);ce>=0&&(F[ce]=null,A[ce].disconnect(jt))}for(let Ut=0;Ut<ut.added.length;Ut++){let jt=ut.added[Ut],ce=F.indexOf(jt);if(ce===-1){for(let $t=0;$t<A.length;$t++)if($t>=F.length){F.push(jt),ce=$t;break}else if(F[$t]===null){F[$t]=jt,ce=$t;break}if(ce===-1)break}let te=A[ce];te&&te.connect(jt)}}let Mt=new Rt,Lt=new Rt;function pt(ut,Ut,jt){Mt.setFromMatrixPosition(Ut.matrixWorld),Lt.setFromMatrixPosition(jt.matrixWorld);let ce=Mt.distanceTo(Lt),te=Ut.projectionMatrix.elements,$t=jt.projectionMatrix.elements,qt=te[14]/(te[10]-1),xe=te[14]/(te[10]+1),ft=(te[9]+1)/te[5],We=(te[9]-1)/te[5],ee=(te[8]-1)/te[0],ge=($t[8]+1)/$t[0],fe=qt*ee,Te=qt*ge,be=ce/(-ee+ge),Wt=be*-ee;Ut.matrixWorld.decompose(ut.position,ut.quaternion,ut.scale),ut.translateX(Wt),ut.translateZ(be),ut.matrixWorld.compose(ut.position,ut.quaternion,ut.scale),ut.matrixWorldInverse.copy(ut.matrixWorld).invert();let Me=qt+be,tt=xe+be,z=fe-Wt,Pt=Te+(ce-Wt),Ot=ft*xe/tt*Me,dt=We*xe/tt*Me;ut.projectionMatrix.makePerspective(z,Pt,Ot,dt,Me,tt),ut.projectionMatrixInverse.copy(ut.projectionMatrix).invert()}function yt(ut,Ut){Ut===null?ut.matrixWorld.copy(ut.matrix):ut.matrixWorld.multiplyMatrices(Ut.matrixWorld,ut.matrix),ut.matrixWorldInverse.copy(ut.matrixWorld).invert()}this.updateCamera=function(ut){if(s===null)return;R.texture!==null&&(ut.near=R.depthNear,ut.far=R.depthFar),B.near=D.near=q.near=ut.near,B.far=D.far=q.far=ut.far,(j!==B.near||K!==B.far)&&(s.updateRenderState({depthNear:B.near,depthFar:B.far}),j=B.near,K=B.far,q.near=j,q.far=K,D.near=j,D.far=K,q.updateProjectionMatrix(),D.updateProjectionMatrix(),ut.updateProjectionMatrix());let Ut=ut.parent,jt=B.cameras;yt(B,Ut);for(let ce=0;ce<jt.length;ce++)yt(jt[ce],Ut);jt.length===2?pt(B,q,D):B.projectionMatrix.copy(q.projectionMatrix),J(ut,B,Ut)};function J(ut,Ut,jt){jt===null?ut.matrix.copy(Ut.matrixWorld):(ut.matrix.copy(jt.matrixWorld),ut.matrix.invert(),ut.matrix.multiply(Ut.matrixWorld)),ut.matrix.decompose(ut.position,ut.quaternion,ut.scale),ut.updateMatrixWorld(!0),ut.projectionMatrix.copy(Ut.projectionMatrix),ut.projectionMatrixInverse.copy(Ut.projectionMatrixInverse),ut.isPerspectiveCamera&&(ut.fov=ov*2*Math.atan(1/ut.projectionMatrix.elements[5]),ut.zoom=1)}this.getCamera=function(){return B},this.getFoveation=function(){if(!(S===null&&b===null))return g},this.setFoveation=function(ut){g=ut,S!==null&&(S.fixedFoveation=ut),b!==null&&b.fixedFoveation!==void 0&&(b.fixedFoveation=ut)},this.hasDepthSensing=function(){return R.texture!==null};let Bt=null;function Gt(ut,Ut){if(v=Ut.getViewerPose(m||p),C=Ut,v!==null){let jt=v.views;b!==null&&(t.setRenderTargetFramebuffer(I,b.framebuffer),t.setRenderTarget(I));let ce=!1;jt.length!==B.cameras.length&&(B.cameras.length=0,ce=!0);for(let $t=0;$t<jt.length;$t++){let qt=jt[$t],xe=null;if(b!==null)xe=b.getViewport(qt);else{let We=w.getViewSubImage(S,qt);xe=We.viewport,$t===0&&(t.setRenderTargetTextures(I,We.colorTexture,S.ignoreDepthValues?void 0:We.depthStencilTexture),t.setRenderTarget(I))}let ft=xt[$t];ft===void 0&&(ft=new ds,ft.layers.enable($t),ft.viewport=new Qi,xt[$t]=ft),ft.matrix.fromArray(qt.transform.matrix),ft.matrix.decompose(ft.position,ft.quaternion,ft.scale),ft.projectionMatrix.fromArray(qt.projectionMatrix),ft.projectionMatrixInverse.copy(ft.projectionMatrix).invert(),ft.viewport.set(xe.x,xe.y,xe.width,xe.height),$t===0&&(B.matrix.copy(ft.matrix),B.matrix.decompose(B.position,B.quaternion,B.scale)),ce===!0&&B.cameras.push(ft)}let te=s.enabledFeatures;if(te&&te.includes("depth-sensing")){let $t=w.getDepthInformation(jt[0]);$t&&$t.isValid&&$t.texture&&R.init(t,$t,s.renderState)}}for(let jt=0;jt<A.length;jt++){let ce=F[jt],te=A[jt];ce!==null&&te!==void 0&&te.update(ce,Ut,m||p)}R.render(t,B),Bt&&Bt(ut,Ut),Ut.detectedPlanes&&o.dispatchEvent({type:"planesdetected",data:Ut}),C=null}let ae=new KC;ae.setAnimationLoop(Gt),this.setAnimationLoop=function(ut){Bt=ut},this.dispose=function(){}}},Cl=new Ul,WX=new vi;function XX(n,t){function e(x,E){x.matrixAutoUpdate===!0&&x.updateMatrix(),E.value.copy(x.matrix)}function o(x,E){E.color.getRGB(x.fogColor.value,ZC(n)),E.isFog?(x.fogNear.value=E.near,x.fogFar.value=E.far):E.isFogExp2&&(x.fogDensity.value=E.density)}function s(x,E,I,A,F){E.isMeshBasicMaterial||E.isMeshLambertMaterial?u(x,E):E.isMeshToonMaterial?(u(x,E),w(x,E)):E.isMeshPhongMaterial?(u(x,E),v(x,E)):E.isMeshStandardMaterial?(u(x,E),S(x,E),E.isMeshPhysicalMaterial&&b(x,E,F)):E.isMeshMatcapMaterial?(u(x,E),C(x,E)):E.isMeshDepthMaterial?u(x,E):E.isMeshDistanceMaterial?(u(x,E),R(x,E)):E.isMeshNormalMaterial?u(x,E):E.isLineBasicMaterial?(p(x,E),E.isLineDashedMaterial&&f(x,E)):E.isPointsMaterial?g(x,E,I,A):E.isSpriteMaterial?m(x,E):E.isShadowMaterial?(x.color.value.copy(E.color),x.opacity.value=E.opacity):E.isShaderMaterial&&(E.uniformsNeedUpdate=!1)}function u(x,E){x.opacity.value=E.opacity,E.color&&x.diffuse.value.copy(E.color),E.emissive&&x.emissive.value.copy(E.emissive).multiplyScalar(E.emissiveIntensity),E.map&&(x.map.value=E.map,e(E.map,x.mapTransform)),E.alphaMap&&(x.alphaMap.value=E.alphaMap,e(E.alphaMap,x.alphaMapTransform)),E.bumpMap&&(x.bumpMap.value=E.bumpMap,e(E.bumpMap,x.bumpMapTransform),x.bumpScale.value=E.bumpScale,E.side===$o&&(x.bumpScale.value*=-1)),E.normalMap&&(x.normalMap.value=E.normalMap,e(E.normalMap,x.normalMapTransform),x.normalScale.value.copy(E.normalScale),E.side===$o&&x.normalScale.value.negate()),E.displacementMap&&(x.displacementMap.value=E.displacementMap,e(E.displacementMap,x.displacementMapTransform),x.displacementScale.value=E.displacementScale,x.displacementBias.value=E.displacementBias),E.emissiveMap&&(x.emissiveMap.value=E.emissiveMap,e(E.emissiveMap,x.emissiveMapTransform)),E.specularMap&&(x.specularMap.value=E.specularMap,e(E.specularMap,x.specularMapTransform)),E.alphaTest>0&&(x.alphaTest.value=E.alphaTest);let I=t.get(E),A=I.envMap,F=I.envMapRotation;if(A&&(x.envMap.value=A,Cl.copy(F),Cl.x*=-1,Cl.y*=-1,Cl.z*=-1,A.isCubeTexture&&A.isRenderTargetTexture===!1&&(Cl.y*=-1,Cl.z*=-1),x.envMapRotation.value.setFromMatrix4(WX.makeRotationFromEuler(Cl)),x.flipEnvMap.value=A.isCubeTexture&&A.isRenderTargetTexture===!1?-1:1,x.reflectivity.value=E.reflectivity,x.ior.value=E.ior,x.refractionRatio.value=E.refractionRatio),E.lightMap){x.lightMap.value=E.lightMap;let V=n._useLegacyLights===!0?Math.PI:1;x.lightMapIntensity.value=E.lightMapIntensity*V,e(E.lightMap,x.lightMapTransform)}E.aoMap&&(x.aoMap.value=E.aoMap,x.aoMapIntensity.value=E.aoMapIntensity,e(E.aoMap,x.aoMapTransform))}function p(x,E){x.diffuse.value.copy(E.color),x.opacity.value=E.opacity,E.map&&(x.map.value=E.map,e(E.map,x.mapTransform))}function f(x,E){x.dashSize.value=E.dashSize,x.totalSize.value=E.dashSize+E.gapSize,x.scale.value=E.scale}function g(x,E,I,A){x.diffuse.value.copy(E.color),x.opacity.value=E.opacity,x.size.value=E.size*I,x.scale.value=A*.5,E.map&&(x.map.value=E.map,e(E.map,x.uvTransform)),E.alphaMap&&(x.alphaMap.value=E.alphaMap,e(E.alphaMap,x.alphaMapTransform)),E.alphaTest>0&&(x.alphaTest.value=E.alphaTest)}function m(x,E){x.diffuse.value.copy(E.color),x.opacity.value=E.opacity,x.rotation.value=E.rotation,E.map&&(x.map.value=E.map,e(E.map,x.mapTransform)),E.alphaMap&&(x.alphaMap.value=E.alphaMap,e(E.alphaMap,x.alphaMapTransform)),E.alphaTest>0&&(x.alphaTest.value=E.alphaTest)}function v(x,E){x.specular.value.copy(E.specular),x.shininess.value=Math.max(E.shininess,1e-4)}function w(x,E){E.gradientMap&&(x.gradientMap.value=E.gradientMap)}function S(x,E){x.metalness.value=E.metalness,E.metalnessMap&&(x.metalnessMap.value=E.metalnessMap,e(E.metalnessMap,x.metalnessMapTransform)),x.roughness.value=E.roughness,E.roughnessMap&&(x.roughnessMap.value=E.roughnessMap,e(E.roughnessMap,x.roughnessMapTransform)),t.get(E).envMap&&(x.envMapIntensity.value=E.envMapIntensity)}function b(x,E,I){x.ior.value=E.ior,E.sheen>0&&(x.sheenColor.value.copy(E.sheenColor).multiplyScalar(E.sheen),x.sheenRoughness.value=E.sheenRoughness,E.sheenColorMap&&(x.sheenColorMap.value=E.sheenColorMap,e(E.sheenColorMap,x.sheenColorMapTransform)),E.sheenRoughnessMap&&(x.sheenRoughnessMap.value=E.sheenRoughnessMap,e(E.sheenRoughnessMap,x.sheenRoughnessMapTransform))),E.clearcoat>0&&(x.clearcoat.value=E.clearcoat,x.clearcoatRoughness.value=E.clearcoatRoughness,E.clearcoatMap&&(x.clearcoatMap.value=E.clearcoatMap,e(E.clearcoatMap,x.clearcoatMapTransform)),E.clearcoatRoughnessMap&&(x.clearcoatRoughnessMap.value=E.clearcoatRoughnessMap,e(E.clearcoatRoughnessMap,x.clearcoatRoughnessMapTransform)),E.clearcoatNormalMap&&(x.clearcoatNormalMap.value=E.clearcoatNormalMap,e(E.clearcoatNormalMap,x.clearcoatNormalMapTransform),x.clearcoatNormalScale.value.copy(E.clearcoatNormalScale),E.side===$o&&x.clearcoatNormalScale.value.negate())),E.iridescence>0&&(x.iridescence.value=E.iridescence,x.iridescenceIOR.value=E.iridescenceIOR,x.iridescenceThicknessMinimum.value=E.iridescenceThicknessRange[0],x.iridescenceThicknessMaximum.value=E.iridescenceThicknessRange[1],E.iridescenceMap&&(x.iridescenceMap.value=E.iridescenceMap,e(E.iridescenceMap,x.iridescenceMapTransform)),E.iridescenceThicknessMap&&(x.iridescenceThicknessMap.value=E.iridescenceThicknessMap,e(E.iridescenceThicknessMap,x.iridescenceThicknessMapTransform))),E.transmission>0&&(x.transmission.value=E.transmission,x.transmissionSamplerMap.value=I.texture,x.transmissionSamplerSize.value.set(I.width,I.height),E.transmissionMap&&(x.transmissionMap.value=E.transmissionMap,e(E.transmissionMap,x.transmissionMapTransform)),x.thickness.value=E.thickness,E.thicknessMap&&(x.thicknessMap.value=E.thicknessMap,e(E.thicknessMap,x.thicknessMapTransform)),x.attenuationDistance.value=E.attenuationDistance,x.attenuationColor.value.copy(E.attenuationColor)),E.anisotropy>0&&(x.anisotropyVector.value.set(E.anisotropy*Math.cos(E.anisotropyRotation),E.anisotropy*Math.sin(E.anisotropyRotation)),E.anisotropyMap&&(x.anisotropyMap.value=E.anisotropyMap,e(E.anisotropyMap,x.anisotropyMapTransform))),x.specularIntensity.value=E.specularIntensity,x.specularColor.value.copy(E.specularColor),E.specularColorMap&&(x.specularColorMap.value=E.specularColorMap,e(E.specularColorMap,x.specularColorMapTransform)),E.specularIntensityMap&&(x.specularIntensityMap.value=E.specularIntensityMap,e(E.specularIntensityMap,x.specularIntensityMapTransform))}function C(x,E){E.matcap&&(x.matcap.value=E.matcap)}function R(x,E){let I=t.get(E).light;x.referencePosition.value.setFromMatrixPosition(I.matrixWorld),x.nearDistance.value=I.shadow.camera.near,x.farDistance.value=I.shadow.camera.far}return{refreshFogUniforms:o,refreshMaterialUniforms:s}}function YX(n,t,e,o){let s={},u={},p=[],f=e.isWebGL2?n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS):0;function g(I,A){let F=A.program;o.uniformBlockBinding(I,F)}function m(I,A){let F=s[I.id];F===void 0&&(C(I),F=v(I),s[I.id]=F,I.addEventListener("dispose",x));let V=A.program;o.updateUBOMapping(I,V);let X=t.render.frame;u[I.id]!==X&&(S(I),u[I.id]=X)}function v(I){let A=w();I.__bindingPointIndex=A;let F=n.createBuffer(),V=I.__size,X=I.usage;return n.bindBuffer(n.UNIFORM_BUFFER,F),n.bufferData(n.UNIFORM_BUFFER,V,X),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,A,F),F}function w(){for(let I=0;I<f;I++)if(p.indexOf(I)===-1)return p.push(I),I;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function S(I){let A=s[I.id],F=I.uniforms,V=I.__cache;n.bindBuffer(n.UNIFORM_BUFFER,A);for(let X=0,q=F.length;X<q;X++){let D=Array.isArray(F[X])?F[X]:[F[X]];for(let xt=0,B=D.length;xt<B;xt++){let j=D[xt];if(b(j,X,xt,V)===!0){let K=j.__offset,Dt=Array.isArray(j.value)?j.value:[j.value],Q=0;for(let At=0;At<Dt.length;At++){let Mt=Dt[At],Lt=R(Mt);typeof Mt=="number"||typeof Mt=="boolean"?(j.__data[0]=Mt,n.bufferSubData(n.UNIFORM_BUFFER,K+Q,j.__data)):Mt.isMatrix3?(j.__data[0]=Mt.elements[0],j.__data[1]=Mt.elements[1],j.__data[2]=Mt.elements[2],j.__data[3]=0,j.__data[4]=Mt.elements[3],j.__data[5]=Mt.elements[4],j.__data[6]=Mt.elements[5],j.__data[7]=0,j.__data[8]=Mt.elements[6],j.__data[9]=Mt.elements[7],j.__data[10]=Mt.elements[8],j.__data[11]=0):(Mt.toArray(j.__data,Q),Q+=Lt.storage/Float32Array.BYTES_PER_ELEMENT)}n.bufferSubData(n.UNIFORM_BUFFER,K,j.__data)}}}n.bindBuffer(n.UNIFORM_BUFFER,null)}function b(I,A,F,V){let X=I.value,q=A+"_"+F;if(V[q]===void 0)return typeof X=="number"||typeof X=="boolean"?V[q]=X:V[q]=X.clone(),!0;{let D=V[q];if(typeof X=="number"||typeof X=="boolean"){if(D!==X)return V[q]=X,!0}else if(D.equals(X)===!1)return D.copy(X),!0}return!1}function C(I){let A=I.uniforms,F=0,V=16;for(let q=0,D=A.length;q<D;q++){let xt=Array.isArray(A[q])?A[q]:[A[q]];for(let B=0,j=xt.length;B<j;B++){let K=xt[B],Dt=Array.isArray(K.value)?K.value:[K.value];for(let Q=0,At=Dt.length;Q<At;Q++){let Mt=Dt[Q],Lt=R(Mt),pt=F%V;pt!==0&&V-pt<Lt.boundary&&(F+=V-pt),K.__data=new Float32Array(Lt.storage/Float32Array.BYTES_PER_ELEMENT),K.__offset=F,F+=Lt.storage}}}let X=F%V;return X>0&&(F+=V-X),I.__size=F,I.__cache={},this}function R(I){let A={boundary:0,storage:0};return typeof I=="number"||typeof I=="boolean"?(A.boundary=4,A.storage=4):I.isVector2?(A.boundary=8,A.storage=8):I.isVector3||I.isColor?(A.boundary=16,A.storage=12):I.isVector4?(A.boundary=16,A.storage=16):I.isMatrix3?(A.boundary=48,A.storage=48):I.isMatrix4?(A.boundary=64,A.storage=64):I.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",I),A}function x(I){let A=I.target;A.removeEventListener("dispose",x);let F=p.indexOf(A.__bindingPointIndex);p.splice(F,1),n.deleteBuffer(s[A.id]),delete s[A.id],delete u[A.id]}function E(){for(let I in s)n.deleteBuffer(s[I]);p=[],s={},u={}}return{bind:g,update:m,dispose:E}}var Mv=class{constructor(t={}){let{canvas:e=J6(),context:o=null,depth:s=!0,stencil:u=!0,alpha:p=!1,antialias:f=!1,premultipliedAlpha:g=!0,preserveDrawingBuffer:m=!1,powerPreference:v="default",failIfMajorPerformanceCaveat:w=!1}=t;this.isWebGLRenderer=!0;let S;o!==null?S=o.getContextAttributes().alpha:S=p;let b=new Uint32Array(4),C=new Int32Array(4),R=null,x=null,E=[],I=[];this.domElement=e,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=ba,this._useLegacyLights=!1,this.toneMapping=Yu,this.toneMappingExposure=1;let A=this,F=!1,V=0,X=0,q=null,D=-1,xt=null,B=new Qi,j=new Qi,K=null,Dt=new ar(0),Q=0,At=e.width,Mt=e.height,Lt=1,pt=null,yt=null,J=new Qi(0,0,At,Mt),Bt=new Qi(0,0,At,Mt),Gt=!1,ae=new Gd,ut=!1,Ut=!1,jt=null,ce=new vi,te=new Ye,$t=new Rt,qt={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function xe(){return q===null?Lt:1}let ft=o;function We(Z,mt){for(let It=0;It<Z.length;It++){let St=Z[It],vt=e.getContext(St,mt);if(vt!==null)return vt}return null}try{let Z={alpha:!0,depth:s,stencil:u,antialias:f,premultipliedAlpha:g,preserveDrawingBuffer:m,powerPreference:v,failIfMajorPerformanceCaveat:w};if("setAttribute"in e&&e.setAttribute("data-engine",`three.js r${zv}`),e.addEventListener("webglcontextlost",Et,!1),e.addEventListener("webglcontextrestored",G,!1),e.addEventListener("webglcontextcreationerror",ot,!1),ft===null){let mt=["webgl2","webgl","experimental-webgl"];if(A.isWebGL1Renderer===!0&&mt.shift(),ft=We(mt,Z),ft===null)throw We(mt)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}typeof WebGLRenderingContext!="undefined"&&ft instanceof WebGLRenderingContext&&console.warn("THREE.WebGLRenderer: WebGL 1 support was deprecated in r153 and will be removed in r163."),ft.getShaderPrecisionFormat===void 0&&(ft.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(Z){throw console.error("THREE.WebGLRenderer: "+Z.message),Z}let ee,ge,fe,Te,be,Wt,Me,tt,z,Pt,Ot,dt,Ht,Ce,Vt,Zt,ne,rt,P,N,k,$,W,ht;function at(){ee=new l9(ft),ge=new r9(ft,ee,t),ee.init(ge),$=new kX(ft,ee,ge),fe=new zX(ft,ee,ge),Te=new h9(ft),be=new TX,Wt=new GX(ft,ee,fe,be,ge,$,Te),Me=new o9(A),tt=new u9(A),z=new vV(ft,ge),W=new e9(ft,ee,z,ge),Pt=new c9(ft,z,Te,W),Ot=new m9(ft,Pt,z,Te),P=new g9(ft,ge,Wt),Zt=new i9(be),dt=new AX(A,Me,tt,ee,ge,W,Zt),Ht=new XX(A,be),Ce=new PX,Vt=new DX(ee,ge),rt=new t9(A,Me,tt,fe,Ot,S,g),ne=new BX(A,Ot,ge),ht=new YX(ft,Te,ge,fe),N=new n9(ft,ee,Te,ge),k=new f9(ft,ee,Te,ge),Te.programs=dt.programs,A.capabilities=ge,A.extensions=ee,A.properties=be,A.renderLists=Ce,A.shadowMap=ne,A.state=fe,A.info=Te}at();let wt=new Sv(A,ft);this.xr=wt,this.getContext=function(){return ft},this.getContextAttributes=function(){return ft.getContextAttributes()},this.forceContextLoss=function(){let Z=ee.get("WEBGL_lose_context");Z&&Z.loseContext()},this.forceContextRestore=function(){let Z=ee.get("WEBGL_lose_context");Z&&Z.restoreContext()},this.getPixelRatio=function(){return Lt},this.setPixelRatio=function(Z){Z!==void 0&&(Lt=Z,this.setSize(At,Mt,!1))},this.getSize=function(Z){return Z.set(At,Mt)},this.setSize=function(Z,mt,It=!0){if(wt.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}At=Z,Mt=mt,e.width=Math.floor(Z*Lt),e.height=Math.floor(mt*Lt),It===!0&&(e.style.width=Z+"px",e.style.height=mt+"px"),this.setViewport(0,0,Z,mt)},this.getDrawingBufferSize=function(Z){return Z.set(At*Lt,Mt*Lt).floor()},this.setDrawingBufferSize=function(Z,mt,It){At=Z,Mt=mt,Lt=It,e.width=Math.floor(Z*It),e.height=Math.floor(mt*It),this.setViewport(0,0,Z,mt)},this.getCurrentViewport=function(Z){return Z.copy(B)},this.getViewport=function(Z){return Z.copy(J)},this.setViewport=function(Z,mt,It,St){Z.isVector4?J.set(Z.x,Z.y,Z.z,Z.w):J.set(Z,mt,It,St),fe.viewport(B.copy(J).multiplyScalar(Lt).round())},this.getScissor=function(Z){return Z.copy(Bt)},this.setScissor=function(Z,mt,It,St){Z.isVector4?Bt.set(Z.x,Z.y,Z.z,Z.w):Bt.set(Z,mt,It,St),fe.scissor(j.copy(Bt).multiplyScalar(Lt).round())},this.getScissorTest=function(){return Gt},this.setScissorTest=function(Z){fe.setScissorTest(Gt=Z)},this.setOpaqueSort=function(Z){pt=Z},this.setTransparentSort=function(Z){yt=Z},this.getClearColor=function(Z){return Z.copy(rt.getClearColor())},this.setClearColor=function(){rt.setClearColor.apply(rt,arguments)},this.getClearAlpha=function(){return rt.getClearAlpha()},this.setClearAlpha=function(){rt.setClearAlpha.apply(rt,arguments)},this.clear=function(Z=!0,mt=!0,It=!0){let St=0;if(Z){let vt=!1;if(q!==null){let he=q.texture.format;vt=he===HC||he===qC||he===kC}if(vt){let he=q.texture.type,ue=he===$u||he===Wu||he===Gv||he===Ol||he===zC||he===GC,we=rt.getClearColor(),de=rt.getClearAlpha(),Be=we.r,Ae=we.g,Pe=we.b;ue?(b[0]=Be,b[1]=Ae,b[2]=Pe,b[3]=de,ft.clearBufferuiv(ft.COLOR,0,b)):(C[0]=Be,C[1]=Ae,C[2]=Pe,C[3]=de,ft.clearBufferiv(ft.COLOR,0,C))}else St|=ft.COLOR_BUFFER_BIT}mt&&(St|=ft.DEPTH_BUFFER_BIT),It&&(St|=ft.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),ft.clear(St)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){e.removeEventListener("webglcontextlost",Et,!1),e.removeEventListener("webglcontextrestored",G,!1),e.removeEventListener("webglcontextcreationerror",ot,!1),Ce.dispose(),Vt.dispose(),be.dispose(),Me.dispose(),tt.dispose(),Ot.dispose(),W.dispose(),ht.dispose(),dt.dispose(),ne.dispose(),wt.dispose(),wt.removeEventListener("sessionstart",qe),wt.removeEventListener("sessionend",Ue),jt&&(jt.dispose(),jt=null),Xe.stop()};function Et(Z){Z.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),F=!0}function G(){console.log("THREE.WebGLRenderer: Context Restored."),F=!1;let Z=Te.autoReset,mt=ne.enabled,It=ne.autoUpdate,St=ne.needsUpdate,vt=ne.type;at(),Te.autoReset=Z,ne.enabled=mt,ne.autoUpdate=It,ne.needsUpdate=St,ne.type=vt}function ot(Z){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",Z.statusMessage)}function et(Z){let mt=Z.target;mt.removeEventListener("dispose",et),lt(mt)}function lt(Z){Ft(Z),be.remove(Z)}function Ft(Z){let mt=be.get(Z).programs;mt!==void 0&&(mt.forEach(function(It){dt.releaseProgram(It)}),Z.isShaderMaterial&&dt.releaseShaderCache(Z))}this.renderBufferDirect=function(Z,mt,It,St,vt,he){mt===null&&(mt=qt);let ue=vt.isMesh&&vt.matrixWorld.determinant()<0,we=Qn(Z,mt,It,St,vt);fe.setMaterial(St,ue);let de=It.index,Be=1;if(St.wireframe===!0){if(de=Pt.getWireframeAttribute(It),de===void 0)return;Be=2}let Ae=It.drawRange,Pe=It.attributes.position,rn=Ae.start*Be,si=(Ae.start+Ae.count)*Be;he!==null&&(rn=Math.max(rn,he.start*Be),si=Math.min(si,(he.start+he.count)*Be)),de!==null?(rn=Math.max(rn,0),si=Math.min(si,de.count)):Pe!=null&&(rn=Math.max(rn,0),si=Math.min(si,Pe.count));let br=si-rn;if(br<0||br===1/0)return;W.setup(vt,St,we,It,de);let Wi,sr=N;if(de!==null&&(Wi=z.get(de),sr=k,sr.setIndex(Wi)),vt.isMesh)St.wireframe===!0?(fe.setLineWidth(St.wireframeLinewidth*xe()),sr.setMode(ft.LINES)):sr.setMode(ft.TRIANGLES);else if(vt.isLine){let ye=St.linewidth;ye===void 0&&(ye=1),fe.setLineWidth(ye*xe()),vt.isLineSegments?sr.setMode(ft.LINES):vt.isLineLoop?sr.setMode(ft.LINE_LOOP):sr.setMode(ft.LINE_STRIP)}else vt.isPoints?sr.setMode(ft.POINTS):vt.isSprite&&sr.setMode(ft.TRIANGLES);if(vt.isBatchedMesh)sr.renderMultiDraw(vt._multiDrawStarts,vt._multiDrawCounts,vt._multiDrawCount);else if(vt.isInstancedMesh)sr.renderInstances(rn,br,vt.count);else if(It.isInstancedBufferGeometry){let ye=It._maxInstanceCount!==void 0?It._maxInstanceCount:1/0,Da=Math.min(It.instanceCount,ye);sr.renderInstances(rn,br,Da)}else sr.render(rn,br)};function Jt(Z,mt,It){Z.transparent===!0&&Z.side===lu&&Z.forceSinglePass===!1?(Z.side=$o,Z.needsUpdate=!0,rr(Z,mt,It),Z.side=Ku,Z.needsUpdate=!0,rr(Z,mt,It),Z.side=lu):rr(Z,mt,It)}this.compile=function(Z,mt,It=null){It===null&&(It=Z),x=Vt.get(It),x.init(),I.push(x),It.traverseVisible(function(vt){vt.isLight&&vt.layers.test(mt.layers)&&(x.pushLight(vt),vt.castShadow&&x.pushShadow(vt))}),Z!==It&&Z.traverseVisible(function(vt){vt.isLight&&vt.layers.test(mt.layers)&&(x.pushLight(vt),vt.castShadow&&x.pushShadow(vt))}),x.setupLights(A._useLegacyLights);let St=new Set;return Z.traverse(function(vt){let he=vt.material;if(he)if(Array.isArray(he))for(let ue=0;ue<he.length;ue++){let we=he[ue];Jt(we,It,vt),St.add(we)}else Jt(he,It,vt),St.add(he)}),I.pop(),x=null,St},this.compileAsync=function(Z,mt,It=null){let St=this.compile(Z,mt,It);return new Promise(vt=>{function he(){if(St.forEach(function(ue){be.get(ue).currentProgram.isReady()&&St.delete(ue)}),St.size===0){vt(Z);return}setTimeout(he,10)}ee.get("KHR_parallel_shader_compile")!==null?he():setTimeout(he,10)})};let me=null;function ve(Z){me&&me(Z)}function qe(){Xe.stop()}function Ue(){Xe.start()}let Xe=new KC;Xe.setAnimationLoop(ve),typeof self!="undefined"&&Xe.setContext(self),this.setAnimationLoop=function(Z){me=Z,wt.setAnimationLoop(Z),Z===null?Xe.stop():Xe.start()},wt.addEventListener("sessionstart",qe),wt.addEventListener("sessionend",Ue),this.render=function(Z,mt){if(mt!==void 0&&mt.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(F===!0)return;Z.matrixWorldAutoUpdate===!0&&Z.updateMatrixWorld(),mt.parent===null&&mt.matrixWorldAutoUpdate===!0&&mt.updateMatrixWorld(),wt.enabled===!0&&wt.isPresenting===!0&&(wt.cameraAutoUpdate===!0&&wt.updateCamera(mt),mt=wt.getCamera()),Z.isScene===!0&&Z.onBeforeRender(A,Z,mt,q),x=Vt.get(Z,I.length),x.init(),I.push(x),ce.multiplyMatrices(mt.projectionMatrix,mt.matrixWorldInverse),ae.setFromProjectionMatrix(ce),Ut=this.localClippingEnabled,ut=Zt.init(this.clippingPlanes,Ut),R=Ce.get(Z,E.length),R.init(),E.push(R),Je(Z,mt,0,A.sortObjects),R.finish(),A.sortObjects===!0&&R.sort(pt,yt),this.info.render.frame++,ut===!0&&Zt.beginShadows();let It=x.state.shadowsArray;if(ne.render(It,Z,mt),ut===!0&&Zt.endShadows(),this.info.autoReset===!0&&this.info.reset(),(wt.enabled===!1||wt.isPresenting===!1||wt.hasDepthSensing()===!1)&&rt.render(R,Z),x.setupLights(A._useLegacyLights),mt.isArrayCamera){let St=mt.cameras;for(let vt=0,he=St.length;vt<he;vt++){let ue=St[vt];wr(R,Z,ue,ue.viewport)}}else wr(R,Z,mt);q!==null&&(Wt.updateMultisampleRenderTarget(q),Wt.updateRenderTargetMipmap(q)),Z.isScene===!0&&Z.onAfterRender(A,Z,mt),W.resetDefaultState(),D=-1,xt=null,I.pop(),I.length>0?x=I[I.length-1]:x=null,E.pop(),E.length>0?R=E[E.length-1]:R=null};function Je(Z,mt,It,St){if(Z.visible===!1)return;if(Z.layers.test(mt.layers)){if(Z.isGroup)It=Z.renderOrder;else if(Z.isLOD)Z.autoUpdate===!0&&Z.update(mt);else if(Z.isLight)x.pushLight(Z),Z.castShadow&&x.pushShadow(Z);else if(Z.isSprite){if(!Z.frustumCulled||ae.intersectsSprite(Z)){St&&$t.setFromMatrixPosition(Z.matrixWorld).applyMatrix4(ce);let ue=Ot.update(Z),we=Z.material;we.visible&&R.push(Z,ue,we,It,$t.z,null)}}else if((Z.isMesh||Z.isLine||Z.isPoints)&&(!Z.frustumCulled||ae.intersectsObject(Z))){let ue=Ot.update(Z),we=Z.material;if(St&&(Z.boundingSphere!==void 0?(Z.boundingSphere===null&&Z.computeBoundingSphere(),$t.copy(Z.boundingSphere.center)):(ue.boundingSphere===null&&ue.computeBoundingSphere(),$t.copy(ue.boundingSphere.center)),$t.applyMatrix4(Z.matrixWorld).applyMatrix4(ce)),Array.isArray(we)){let de=ue.groups;for(let Be=0,Ae=de.length;Be<Ae;Be++){let Pe=de[Be],rn=we[Pe.materialIndex];rn&&rn.visible&&R.push(Z,ue,rn,It,$t.z,Pe)}}else we.visible&&R.push(Z,ue,we,It,$t.z,null)}}let he=Z.children;for(let ue=0,we=he.length;ue<we;ue++)Je(he[ue],mt,It,St)}function wr(Z,mt,It,St){let vt=Z.opaque,he=Z.transmissive,ue=Z.transparent;x.setupLightsView(It),ut===!0&&Zt.setGlobalState(A.clippingPlanes,It),he.length>0&&Kr(vt,he,mt,It),St&&fe.viewport(B.copy(St)),vt.length>0&&nr(vt,mt,It),he.length>0&&nr(he,mt,It),ue.length>0&&nr(ue,mt,It),fe.buffers.depth.setTest(!0),fe.buffers.depth.setMask(!0),fe.buffers.color.setMask(!0),fe.setPolygonOffset(!1)}function Kr(Z,mt,It,St){if((It.isScene===!0?It.overrideMaterial:null)!==null)return;let he=ge.isWebGL2;jt===null&&(jt=new pu(1,1,{generateMipmaps:!0,type:ee.has("EXT_color_buffer_half_float")?ah:$u,minFilter:Ll,samples:he?4:0})),A.getDrawingBufferSize(te),he?jt.setSize(te.x,te.y):jt.setSize(sv(te.x),sv(te.y));let ue=A.getRenderTarget();A.setRenderTarget(jt),A.getClearColor(Dt),Q=A.getClearAlpha(),Q<1&&A.setClearColor(16777215,.5),A.clear();let we=A.toneMapping;A.toneMapping=Yu,nr(Z,It,St),Wt.updateMultisampleRenderTarget(jt),Wt.updateRenderTargetMipmap(jt);let de=!1;for(let Be=0,Ae=mt.length;Be<Ae;Be++){let Pe=mt[Be],rn=Pe.object,si=Pe.geometry,br=Pe.material,Wi=Pe.group;if(br.side===lu&&rn.layers.test(St.layers)){let sr=br.side;br.side=$o,br.needsUpdate=!0,Ie(rn,It,St,si,br,Wi),br.side=sr,br.needsUpdate=!0,de=!0}}de===!0&&(Wt.updateMultisampleRenderTarget(jt),Wt.updateRenderTargetMipmap(jt)),A.setRenderTarget(ue),A.setClearColor(Dt,Q),A.toneMapping=we}function nr(Z,mt,It){let St=mt.isScene===!0?mt.overrideMaterial:null;for(let vt=0,he=Z.length;vt<he;vt++){let ue=Z[vt],we=ue.object,de=ue.geometry,Be=St===null?ue.material:St,Ae=ue.group;we.layers.test(It.layers)&&Ie(we,mt,It,de,Be,Ae)}}function Ie(Z,mt,It,St,vt,he){Z.onBeforeRender(A,mt,It,St,vt,he),Z.modelViewMatrix.multiplyMatrices(It.matrixWorldInverse,Z.matrixWorld),Z.normalMatrix.getNormalMatrix(Z.modelViewMatrix),vt.onBeforeRender(A,mt,It,St,Z,he),vt.transparent===!0&&vt.side===lu&&vt.forceSinglePass===!1?(vt.side=$o,vt.needsUpdate=!0,A.renderBufferDirect(It,mt,St,vt,Z,he),vt.side=Ku,vt.needsUpdate=!0,A.renderBufferDirect(It,mt,St,vt,Z,he),vt.side=lu):A.renderBufferDirect(It,mt,St,vt,Z,he),Z.onAfterRender(A,mt,It,St,vt,he)}function rr(Z,mt,It){mt.isScene!==!0&&(mt=qt);let St=be.get(Z),vt=x.state.lights,he=x.state.shadowsArray,ue=vt.state.version,we=dt.getParameters(Z,vt.state,he,mt,It),de=dt.getProgramCacheKey(we),Be=St.programs;St.environment=Z.isMeshStandardMaterial?mt.environment:null,St.fog=mt.fog,St.envMap=(Z.isMeshStandardMaterial?tt:Me).get(Z.envMap||St.environment),St.envMapRotation=St.environment!==null&&Z.envMap===null?mt.environmentRotation:Z.envMapRotation,Be===void 0&&(Z.addEventListener("dispose",et),Be=new Map,St.programs=Be);let Ae=Be.get(de);if(Ae!==void 0){if(St.currentProgram===Ae&&St.lightsStateVersion===ue)return ur(Z,we),Ae}else we.uniforms=dt.getUniforms(Z),Z.onBuild(It,we,A),Z.onBeforeCompile(we,A),Ae=dt.acquireProgram(we,de),Be.set(de,Ae),St.uniforms=we.uniforms;let Pe=St.uniforms;return(!Z.isShaderMaterial&&!Z.isRawShaderMaterial||Z.clipping===!0)&&(Pe.clippingPlanes=Zt.uniform),ur(Z,we),St.needsLights=oi(Z),St.lightsStateVersion=ue,St.needsLights&&(Pe.ambientLightColor.value=vt.state.ambient,Pe.lightProbe.value=vt.state.probe,Pe.directionalLights.value=vt.state.directional,Pe.directionalLightShadows.value=vt.state.directionalShadow,Pe.spotLights.value=vt.state.spot,Pe.spotLightShadows.value=vt.state.spotShadow,Pe.rectAreaLights.value=vt.state.rectArea,Pe.ltc_1.value=vt.state.rectAreaLTC1,Pe.ltc_2.value=vt.state.rectAreaLTC2,Pe.pointLights.value=vt.state.point,Pe.pointLightShadows.value=vt.state.pointShadow,Pe.hemisphereLights.value=vt.state.hemi,Pe.directionalShadowMap.value=vt.state.directionalShadowMap,Pe.directionalShadowMatrix.value=vt.state.directionalShadowMatrix,Pe.spotShadowMap.value=vt.state.spotShadowMap,Pe.spotLightMatrix.value=vt.state.spotLightMatrix,Pe.spotLightMap.value=vt.state.spotLightMap,Pe.pointShadowMap.value=vt.state.pointShadowMap,Pe.pointShadowMatrix.value=vt.state.pointShadowMatrix),St.currentProgram=Ae,St.uniformsList=null,Ae}function pr(Z){if(Z.uniformsList===null){let mt=Z.currentProgram.getUniforms();Z.uniformsList=qc.seqWithValue(mt.seq,Z.uniforms)}return Z.uniformsList}function ur(Z,mt){let It=be.get(Z);It.outputColorSpace=mt.outputColorSpace,It.batching=mt.batching,It.instancing=mt.instancing,It.instancingColor=mt.instancingColor,It.instancingMorph=mt.instancingMorph,It.skinning=mt.skinning,It.morphTargets=mt.morphTargets,It.morphNormals=mt.morphNormals,It.morphColors=mt.morphColors,It.morphTargetsCount=mt.morphTargetsCount,It.numClippingPlanes=mt.numClippingPlanes,It.numIntersection=mt.numClipIntersection,It.vertexAlphas=mt.vertexAlphas,It.vertexTangents=mt.vertexTangents,It.toneMapping=mt.toneMapping}function Qn(Z,mt,It,St,vt){mt.isScene!==!0&&(mt=qt),Wt.resetTextureUnits();let he=mt.fog,ue=St.isMeshStandardMaterial?mt.environment:null,we=q===null?A.outputColorSpace:q.isXRRenderTarget===!0?q.texture.colorSpace:tl,de=(St.isMeshStandardMaterial?tt:Me).get(St.envMap||ue),Be=St.vertexColors===!0&&!!It.attributes.color&&It.attributes.color.itemSize===4,Ae=!!It.attributes.tangent&&(!!St.normalMap||St.anisotropy>0),Pe=!!It.morphAttributes.position,rn=!!It.morphAttributes.normal,si=!!It.morphAttributes.color,br=Yu;St.toneMapped&&(q===null||q.isXRRenderTarget===!0)&&(br=A.toneMapping);let Wi=It.morphAttributes.position||It.morphAttributes.normal||It.morphAttributes.color,sr=Wi!==void 0?Wi.length:0,ye=be.get(St),Da=x.state.lights;if(ut===!0&&(Ut===!0||Z!==xt)){let Ai=Z===xt&&St.id===D;Zt.setState(St,Z,Ai)}let on=!1;St.version===ye.__version?(ye.needsLights&&ye.lightsStateVersion!==Da.state.version||ye.outputColorSpace!==we||vt.isBatchedMesh&&ye.batching===!1||!vt.isBatchedMesh&&ye.batching===!0||vt.isInstancedMesh&&ye.instancing===!1||!vt.isInstancedMesh&&ye.instancing===!0||vt.isSkinnedMesh&&ye.skinning===!1||!vt.isSkinnedMesh&&ye.skinning===!0||vt.isInstancedMesh&&ye.instancingColor===!0&&vt.instanceColor===null||vt.isInstancedMesh&&ye.instancingColor===!1&&vt.instanceColor!==null||vt.isInstancedMesh&&ye.instancingMorph===!0&&vt.morphTexture===null||vt.isInstancedMesh&&ye.instancingMorph===!1&&vt.morphTexture!==null||ye.envMap!==de||St.fog===!0&&ye.fog!==he||ye.numClippingPlanes!==void 0&&(ye.numClippingPlanes!==Zt.numPlanes||ye.numIntersection!==Zt.numIntersection)||ye.vertexAlphas!==Be||ye.vertexTangents!==Ae||ye.morphTargets!==Pe||ye.morphNormals!==rn||ye.morphColors!==si||ye.toneMapping!==br||ge.isWebGL2===!0&&ye.morphTargetsCount!==sr)&&(on=!0):(on=!0,ye.__version=St.version);let fo=ye.currentProgram;on===!0&&(fo=rr(St,mt,vt));let ul=!1,ze=!1,ys=!1,ir=fo.getUniforms(),jo=ye.uniforms;if(fe.useProgram(fo.program)&&(ul=!0,ze=!0,ys=!0),St.id!==D&&(D=St.id,ze=!0),ul||xt!==Z){ir.setValue(ft,"projectionMatrix",Z.projectionMatrix),ir.setValue(ft,"viewMatrix",Z.matrixWorldInverse);let Ai=ir.map.cameraPosition;Ai!==void 0&&Ai.setValue(ft,$t.setFromMatrixPosition(Z.matrixWorld)),ge.logarithmicDepthBuffer&&ir.setValue(ft,"logDepthBufFC",2/(Math.log(Z.far+1)/Math.LN2)),(St.isMeshPhongMaterial||St.isMeshToonMaterial||St.isMeshLambertMaterial||St.isMeshBasicMaterial||St.isMeshStandardMaterial||St.isShaderMaterial)&&ir.setValue(ft,"isOrthographic",Z.isOrthographicCamera===!0),xt!==Z&&(xt=Z,ze=!0,ys=!0)}if(vt.isSkinnedMesh){ir.setOptional(ft,vt,"bindMatrix"),ir.setOptional(ft,vt,"bindMatrixInverse");let Ai=vt.skeleton;Ai&&(ge.floatVertexTextures?(Ai.boneTexture===null&&Ai.computeBoneTexture(),ir.setValue(ft,"boneTexture",Ai.boneTexture,Wt)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}vt.isBatchedMesh&&(ir.setOptional(ft,vt,"batchingTexture"),ir.setValue(ft,"batchingTexture",vt._matricesTexture,Wt));let Le=It.morphAttributes;if((Le.position!==void 0||Le.normal!==void 0||Le.color!==void 0&&ge.isWebGL2===!0)&&P.update(vt,It,fo),(ze||ye.receiveShadow!==vt.receiveShadow)&&(ye.receiveShadow=vt.receiveShadow,ir.setValue(ft,"receiveShadow",vt.receiveShadow)),St.isMeshGouraudMaterial&&St.envMap!==null&&(jo.envMap.value=de,jo.flipEnvMap.value=de.isCubeTexture&&de.isRenderTargetTexture===!1?-1:1),ze&&(ir.setValue(ft,"toneMappingExposure",A.toneMappingExposure),ye.needsLights&&bi(jo,ys),he&&St.fog===!0&&Ht.refreshFogUniforms(jo,he),Ht.refreshMaterialUniforms(jo,St,Lt,Mt,jt),qc.upload(ft,pr(ye),jo,Wt)),St.isShaderMaterial&&St.uniformsNeedUpdate===!0&&(qc.upload(ft,pr(ye),jo,Wt),St.uniformsNeedUpdate=!1),St.isSpriteMaterial&&ir.setValue(ft,"center",vt.center),ir.setValue(ft,"modelViewMatrix",vt.modelViewMatrix),ir.setValue(ft,"normalMatrix",vt.normalMatrix),ir.setValue(ft,"modelMatrix",vt.matrixWorld),St.isShaderMaterial||St.isRawShaderMaterial){let Ai=St.uniformsGroups;for(let Fa=0,mu=Ai.length;Fa<mu;Fa++)if(ge.isWebGL2){let Ti=Ai[Fa];ht.update(Ti,fo),ht.bind(Ti,fo)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return fo}function bi(Z,mt){Z.ambientLightColor.needsUpdate=mt,Z.lightProbe.needsUpdate=mt,Z.directionalLights.needsUpdate=mt,Z.directionalLightShadows.needsUpdate=mt,Z.pointLights.needsUpdate=mt,Z.pointLightShadows.needsUpdate=mt,Z.spotLights.needsUpdate=mt,Z.spotLightShadows.needsUpdate=mt,Z.rectAreaLights.needsUpdate=mt,Z.hemisphereLights.needsUpdate=mt}function oi(Z){return Z.isMeshLambertMaterial||Z.isMeshToonMaterial||Z.isMeshPhongMaterial||Z.isMeshStandardMaterial||Z.isShadowMaterial||Z.isShaderMaterial&&Z.lights===!0}this.getActiveCubeFace=function(){return V},this.getActiveMipmapLevel=function(){return X},this.getRenderTarget=function(){return q},this.setRenderTargetTextures=function(Z,mt,It){be.get(Z.texture).__webglTexture=mt,be.get(Z.depthTexture).__webglTexture=It;let St=be.get(Z);St.__hasExternalTextures=!0,St.__autoAllocateDepthBuffer=It===void 0,St.__autoAllocateDepthBuffer||ee.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),St.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(Z,mt){let It=be.get(Z);It.__webglFramebuffer=mt,It.__useDefaultFramebuffer=mt===void 0},this.setRenderTarget=function(Z,mt=0,It=0){q=Z,V=mt,X=It;let St=!0,vt=null,he=!1,ue=!1;if(Z){let de=be.get(Z);de.__useDefaultFramebuffer!==void 0?(fe.bindFramebuffer(ft.FRAMEBUFFER,null),St=!1):de.__webglFramebuffer===void 0?Wt.setupRenderTarget(Z):de.__hasExternalTextures&&Wt.rebindTextures(Z,be.get(Z.texture).__webglTexture,be.get(Z.depthTexture).__webglTexture);let Be=Z.texture;(Be.isData3DTexture||Be.isDataArrayTexture||Be.isCompressedArrayTexture)&&(ue=!0);let Ae=be.get(Z).__webglFramebuffer;Z.isWebGLCubeRenderTarget?(Array.isArray(Ae[mt])?vt=Ae[mt][It]:vt=Ae[mt],he=!0):ge.isWebGL2&&Z.samples>0&&Wt.useMultisampledRTT(Z)===!1?vt=be.get(Z).__webglMultisampledFramebuffer:Array.isArray(Ae)?vt=Ae[It]:vt=Ae,B.copy(Z.viewport),j.copy(Z.scissor),K=Z.scissorTest}else B.copy(J).multiplyScalar(Lt).floor(),j.copy(Bt).multiplyScalar(Lt).floor(),K=Gt;if(fe.bindFramebuffer(ft.FRAMEBUFFER,vt)&&ge.drawBuffers&&St&&fe.drawBuffers(Z,vt),fe.viewport(B),fe.scissor(j),fe.setScissorTest(K),he){let de=be.get(Z.texture);ft.framebufferTexture2D(ft.FRAMEBUFFER,ft.COLOR_ATTACHMENT0,ft.TEXTURE_CUBE_MAP_POSITIVE_X+mt,de.__webglTexture,It)}else if(ue){let de=be.get(Z.texture),Be=mt||0;ft.framebufferTextureLayer(ft.FRAMEBUFFER,ft.COLOR_ATTACHMENT0,de.__webglTexture,It||0,Be)}D=-1},this.readRenderTargetPixels=function(Z,mt,It,St,vt,he,ue){if(!(Z&&Z.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let we=be.get(Z).__webglFramebuffer;if(Z.isWebGLCubeRenderTarget&&ue!==void 0&&(we=we[ue]),we){fe.bindFramebuffer(ft.FRAMEBUFFER,we);try{let de=Z.texture,Be=de.format,Ae=de.type;if(Be!==ea&&$.convert(Be)!==ft.getParameter(ft.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}let Pe=Ae===ah&&(ee.has("EXT_color_buffer_half_float")||ge.isWebGL2&&ee.has("EXT_color_buffer_float"));if(Ae!==$u&&$.convert(Ae)!==ft.getParameter(ft.IMPLEMENTATION_COLOR_READ_TYPE)&&!(Ae===cu&&(ge.isWebGL2||ee.has("OES_texture_float")||ee.has("WEBGL_color_buffer_float")))&&!Pe){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}mt>=0&&mt<=Z.width-St&&It>=0&&It<=Z.height-vt&&ft.readPixels(mt,It,St,vt,$.convert(Be),$.convert(Ae),he)}finally{let de=q!==null?be.get(q).__webglFramebuffer:null;fe.bindFramebuffer(ft.FRAMEBUFFER,de)}}},this.copyFramebufferToTexture=function(Z,mt,It=0){let St=Math.pow(2,-It),vt=Math.floor(mt.image.width*St),he=Math.floor(mt.image.height*St);Wt.setTexture2D(mt,0),ft.copyTexSubImage2D(ft.TEXTURE_2D,It,0,0,Z.x,Z.y,vt,he),fe.unbindTexture()},this.copyTextureToTexture=function(Z,mt,It,St=0){let vt=mt.image.width,he=mt.image.height,ue=$.convert(It.format),we=$.convert(It.type);Wt.setTexture2D(It,0),ft.pixelStorei(ft.UNPACK_FLIP_Y_WEBGL,It.flipY),ft.pixelStorei(ft.UNPACK_PREMULTIPLY_ALPHA_WEBGL,It.premultiplyAlpha),ft.pixelStorei(ft.UNPACK_ALIGNMENT,It.unpackAlignment),mt.isDataTexture?ft.texSubImage2D(ft.TEXTURE_2D,St,Z.x,Z.y,vt,he,ue,we,mt.image.data):mt.isCompressedTexture?ft.compressedTexSubImage2D(ft.TEXTURE_2D,St,Z.x,Z.y,mt.mipmaps[0].width,mt.mipmaps[0].height,ue,mt.mipmaps[0].data):ft.texSubImage2D(ft.TEXTURE_2D,St,Z.x,Z.y,ue,we,mt.image),St===0&&It.generateMipmaps&&ft.generateMipmap(ft.TEXTURE_2D),fe.unbindTexture()},this.copyTextureToTexture3D=function(Z,mt,It,St,vt=0){if(A.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}let he=Math.round(Z.max.x-Z.min.x),ue=Math.round(Z.max.y-Z.min.y),we=Z.max.z-Z.min.z+1,de=$.convert(St.format),Be=$.convert(St.type),Ae;if(St.isData3DTexture)Wt.setTexture3D(St,0),Ae=ft.TEXTURE_3D;else if(St.isDataArrayTexture||St.isCompressedArrayTexture)Wt.setTexture2DArray(St,0),Ae=ft.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}ft.pixelStorei(ft.UNPACK_FLIP_Y_WEBGL,St.flipY),ft.pixelStorei(ft.UNPACK_PREMULTIPLY_ALPHA_WEBGL,St.premultiplyAlpha),ft.pixelStorei(ft.UNPACK_ALIGNMENT,St.unpackAlignment);let Pe=ft.getParameter(ft.UNPACK_ROW_LENGTH),rn=ft.getParameter(ft.UNPACK_IMAGE_HEIGHT),si=ft.getParameter(ft.UNPACK_SKIP_PIXELS),br=ft.getParameter(ft.UNPACK_SKIP_ROWS),Wi=ft.getParameter(ft.UNPACK_SKIP_IMAGES),sr=It.isCompressedTexture?It.mipmaps[vt]:It.image;ft.pixelStorei(ft.UNPACK_ROW_LENGTH,sr.width),ft.pixelStorei(ft.UNPACK_IMAGE_HEIGHT,sr.height),ft.pixelStorei(ft.UNPACK_SKIP_PIXELS,Z.min.x),ft.pixelStorei(ft.UNPACK_SKIP_ROWS,Z.min.y),ft.pixelStorei(ft.UNPACK_SKIP_IMAGES,Z.min.z),It.isDataTexture||It.isData3DTexture?ft.texSubImage3D(Ae,vt,mt.x,mt.y,mt.z,he,ue,we,de,Be,sr.data):St.isCompressedArrayTexture?ft.compressedTexSubImage3D(Ae,vt,mt.x,mt.y,mt.z,he,ue,we,de,sr.data):ft.texSubImage3D(Ae,vt,mt.x,mt.y,mt.z,he,ue,we,de,Be,sr),ft.pixelStorei(ft.UNPACK_ROW_LENGTH,Pe),ft.pixelStorei(ft.UNPACK_IMAGE_HEIGHT,rn),ft.pixelStorei(ft.UNPACK_SKIP_PIXELS,si),ft.pixelStorei(ft.UNPACK_SKIP_ROWS,br),ft.pixelStorei(ft.UNPACK_SKIP_IMAGES,Wi),vt===0&&St.generateMipmaps&&ft.generateMipmap(Ae),fe.unbindTexture()},this.initTexture=function(Z){Z.isCubeTexture?Wt.setTextureCube(Z,0):Z.isData3DTexture?Wt.setTexture3D(Z,0):Z.isDataArrayTexture||Z.isCompressedArrayTexture?Wt.setTexture2DArray(Z,0):Wt.setTexture2D(Z,0),fe.unbindTexture()},this.resetState=function(){V=0,X=0,q=null,fe.reset(),W.reset()},typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return fu}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(t){this._outputColorSpace=t;let e=this.getContext();e.drawingBufferColorSpace=t===kv?"display-p3":"srgb",e.unpackColorSpace=xr.workingColorSpace===Xd?"display-p3":"srgb"}get useLegacyLights(){return console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights}set useLegacyLights(t){console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights=t}},bv=class extends Mv{};bv.prototype.isWebGL1Renderer=!0;var Av=class{constructor(t,e){this.isInterleavedBuffer=!0,this.array=t,this.stride=e,this.count=t!==void 0?t.length/e:0,this.usage=rv,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.version=0,this.uuid=Zu()}onUploadCallback(){}set needsUpdate(t){t===!0&&this.version++}get updateRange(){return YC("THREE.InterleavedBuffer: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this}copyAt(t,e,o){t*=this.stride,o*=e.stride;for(let s=0,u=this.stride;s<u;s++)this.array[t+s]=e.array[o+s];return this}set(t,e=0){return this.array.set(t,e),this}clone(t){t.arrayBuffers===void 0&&(t.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Zu()),t.arrayBuffers[this.array.buffer._uuid]===void 0&&(t.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);let e=new this.array.constructor(t.arrayBuffers[this.array.buffer._uuid]),o=new this.constructor(e,this.stride);return o.setUsage(this.usage),o}onUpload(t){return this.onUploadCallback=t,this}toJSON(t){return t.arrayBuffers===void 0&&(t.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Zu()),t.arrayBuffers[this.array.buffer._uuid]===void 0&&(t.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}},wo=new Rt,Vd=class n{constructor(t,e,o,s=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=t,this.itemSize=e,this.offset=o,this.normalized=s}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(t){this.data.needsUpdate=t}applyMatrix4(t){for(let e=0,o=this.data.count;e<o;e++)wo.fromBufferAttribute(this,e),wo.applyMatrix4(t),this.setXYZ(e,wo.x,wo.y,wo.z);return this}applyNormalMatrix(t){for(let e=0,o=this.count;e<o;e++)wo.fromBufferAttribute(this,e),wo.applyNormalMatrix(t),this.setXYZ(e,wo.x,wo.y,wo.z);return this}transformDirection(t){for(let e=0,o=this.count;e<o;e++)wo.fromBufferAttribute(this,e),wo.transformDirection(t),this.setXYZ(e,wo.x,wo.y,wo.z);return this}getComponent(t,e){let o=this.array[t*this.data.stride+this.offset+e];return this.normalized&&(o=Ta(o,this.array)),o}setComponent(t,e,o){return this.normalized&&(o=_r(o,this.array)),this.data.array[t*this.data.stride+this.offset+e]=o,this}setX(t,e){return this.normalized&&(e=_r(e,this.array)),this.data.array[t*this.data.stride+this.offset]=e,this}setY(t,e){return this.normalized&&(e=_r(e,this.array)),this.data.array[t*this.data.stride+this.offset+1]=e,this}setZ(t,e){return this.normalized&&(e=_r(e,this.array)),this.data.array[t*this.data.stride+this.offset+2]=e,this}setW(t,e){return this.normalized&&(e=_r(e,this.array)),this.data.array[t*this.data.stride+this.offset+3]=e,this}getX(t){let e=this.data.array[t*this.data.stride+this.offset];return this.normalized&&(e=Ta(e,this.array)),e}getY(t){let e=this.data.array[t*this.data.stride+this.offset+1];return this.normalized&&(e=Ta(e,this.array)),e}getZ(t){let e=this.data.array[t*this.data.stride+this.offset+2];return this.normalized&&(e=Ta(e,this.array)),e}getW(t){let e=this.data.array[t*this.data.stride+this.offset+3];return this.normalized&&(e=Ta(e,this.array)),e}setXY(t,e,o){return t=t*this.data.stride+this.offset,this.normalized&&(e=_r(e,this.array),o=_r(o,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=o,this}setXYZ(t,e,o,s){return t=t*this.data.stride+this.offset,this.normalized&&(e=_r(e,this.array),o=_r(o,this.array),s=_r(s,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=o,this.data.array[t+2]=s,this}setXYZW(t,e,o,s,u){return t=t*this.data.stride+this.offset,this.normalized&&(e=_r(e,this.array),o=_r(o,this.array),s=_r(s,this.array),u=_r(u,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=o,this.data.array[t+2]=s,this.data.array[t+3]=u,this}clone(t){if(t===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");let e=[];for(let o=0;o<this.count;o++){let s=o*this.data.stride+this.offset;for(let u=0;u<this.itemSize;u++)e.push(this.data.array[s+u])}return new gs(new this.array.constructor(e),this.itemSize,this.normalized)}else return t.interleavedBuffers===void 0&&(t.interleavedBuffers={}),t.interleavedBuffers[this.data.uuid]===void 0&&(t.interleavedBuffers[this.data.uuid]=this.data.clone(t)),new n(t.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(t){if(t===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");let e=[];for(let o=0;o<this.count;o++){let s=o*this.data.stride+this.offset;for(let u=0;u<this.itemSize;u++)e.push(this.data.array[s+u])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:e,normalized:this.normalized}}else return t.interleavedBuffers===void 0&&(t.interleavedBuffers={}),t.interleavedBuffers[this.data.uuid]===void 0&&(t.interleavedBuffers[this.data.uuid]=this.data.toJSON(t)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}},Tv=class extends Bl{constructor(t){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new ar(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.rotation=t.rotation,this.sizeAttenuation=t.sizeAttenuation,this.fog=t.fog,this}},Hu,rh=new Rt,Oc=new Rt,Dc=new Rt,Fc=new Ye,ih=new Ye,nP=new vi,_d=new Rt,oh=new Rt,xd=new Rt,NC=new Ye,Ky=new Ye,OC=new Ye,Cv=class extends ra{constructor(t=new Tv){if(super(),this.isSprite=!0,this.type="Sprite",Hu===void 0){Hu=new Qu;let e=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),o=new Av(e,5);Hu.setIndex([0,1,2,0,2,3]),Hu.setAttribute("position",new Vd(o,3,0,!1)),Hu.setAttribute("uv",new Vd(o,2,3,!1))}this.geometry=Hu,this.material=t,this.center=new Ye(.5,.5)}raycast(t,e){t.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Oc.setFromMatrixScale(this.matrixWorld),nP.copy(t.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(t.camera.matrixWorldInverse,this.matrixWorld),Dc.setFromMatrixPosition(this.modelViewMatrix),t.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Oc.multiplyScalar(-Dc.z);let o=this.material.rotation,s,u;o!==0&&(u=Math.cos(o),s=Math.sin(o));let p=this.center;Ed(_d.set(-.5,-.5,0),Dc,p,Oc,s,u),Ed(oh.set(.5,-.5,0),Dc,p,Oc,s,u),Ed(xd.set(.5,.5,0),Dc,p,Oc,s,u),NC.set(0,0),Ky.set(1,0),OC.set(1,1);let f=t.ray.intersectTriangle(_d,oh,xd,!1,rh);if(f===null&&(Ed(oh.set(-.5,.5,0),Dc,p,Oc,s,u),Ky.set(0,1),f=t.ray.intersectTriangle(_d,xd,oh,!1,rh),f===null))return;let g=t.ray.origin.distanceTo(rh);g<t.near||g>t.far||e.push({distance:g,point:rh.clone(),uv:Nl.getInterpolation(rh,_d,oh,xd,NC,Ky,OC,new Ye),face:null,object:this})}copy(t,e){return super.copy(t,e),t.center!==void 0&&this.center.copy(t.center),this.material=t.material,this}};Cv.Dispose=function(){Hu.dispose(),Hu=void 0};function Ed(n,t,e,o,s,u){Fc.subVectors(n,e).addScalar(.5).multiply(o),s!==void 0?(ih.x=u*Fc.x-s*Fc.y,ih.y=s*Fc.x+u*Fc.y):ih.copy(Fc),n.copy(t),n.x+=ih.x,n.y+=ih.y,n.applyMatrix4(nP)}function wd(n,t,e){return!n||!e&&n.constructor===t?n:typeof t.BYTES_PER_ELEMENT=="number"?new t(n):Array.prototype.slice.call(n)}function $X(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}var Yc=class{constructor(t,e,o,s){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=s!==void 0?s:new e.constructor(o),this.sampleValues=e,this.valueSize=o,this.settings=null,this.DefaultSettings_={}}evaluate(t){let e=this.parameterPositions,o=this._cachedIndex,s=e[o],u=e[o-1];t:{e:{let p;n:{r:if(!(t<s)){for(let f=o+2;;){if(s===void 0){if(t<u)break r;return o=e.length,this._cachedIndex=o,this.copySampleValue_(o-1)}if(o===f)break;if(u=s,s=e[++o],t<s)break e}p=e.length;break n}if(!(t>=u)){let f=e[1];t<f&&(o=2,u=f);for(let g=o-2;;){if(u===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(o===g)break;if(s=u,u=e[--o-1],t>=u)break e}p=o,o=0;break n}break t}for(;o<p;){let f=o+p>>>1;t<e[f]?p=f:o=f+1}if(s=e[o],u=e[o-1],u===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(s===void 0)return o=e.length,this._cachedIndex=o,this.copySampleValue_(o-1)}this._cachedIndex=o,this.intervalChanged_(o,u,s)}return this.interpolate_(o,u,t,s)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){let e=this.resultBuffer,o=this.sampleValues,s=this.valueSize,u=t*s;for(let p=0;p!==s;++p)e[p]=o[u+p];return e}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}},Pv=class extends Yc{constructor(t,e,o,s){super(t,e,o,s),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:qT,endingEnd:qT}}intervalChanged_(t,e,o){let s=this.parameterPositions,u=t-2,p=t+1,f=s[u],g=s[p];if(f===void 0)switch(this.getSettings_().endingStart){case HT:u=t,f=2*e-o;break;case VT:u=s.length-2,f=e+s[u]-s[u+1];break;default:u=t,f=o}if(g===void 0)switch(this.getSettings_().endingEnd){case HT:p=t,g=2*o-e;break;case VT:p=1,g=o+s[1]-s[0];break;default:p=t-1,g=e}let m=(o-e)*.5,v=this.valueSize;this._weightPrev=m/(e-f),this._weightNext=m/(g-o),this._offsetPrev=u*v,this._offsetNext=p*v}interpolate_(t,e,o,s){let u=this.resultBuffer,p=this.sampleValues,f=this.valueSize,g=t*f,m=g-f,v=this._offsetPrev,w=this._offsetNext,S=this._weightPrev,b=this._weightNext,C=(o-e)/(s-e),R=C*C,x=R*C,E=-S*x+2*S*R-S*C,I=(1+S)*x+(-1.5-2*S)*R+(-.5+S)*C+1,A=(-1-b)*x+(1.5+b)*R+.5*C,F=b*x-b*R;for(let V=0;V!==f;++V)u[V]=E*p[v+V]+I*p[m+V]+A*p[g+V]+F*p[w+V];return u}},Iv=class extends Yc{constructor(t,e,o,s){super(t,e,o,s)}interpolate_(t,e,o,s){let u=this.resultBuffer,p=this.sampleValues,f=this.valueSize,g=t*f,m=g-f,v=(o-e)/(s-e),w=1-v;for(let S=0;S!==f;++S)u[S]=p[m+S]*w+p[g+S]*v;return u}},Rv=class extends Yc{constructor(t,e,o,s){super(t,e,o,s)}interpolate_(t){return this.copySampleValue_(t-1)}},ia=class{constructor(t,e,o,s){if(t===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(e===void 0||e.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=wd(e,this.TimeBufferType),this.values=wd(o,this.ValueBufferType),this.setInterpolation(s||this.DefaultInterpolation)}static toJSON(t){let e=t.constructor,o;if(e.toJSON!==this.toJSON)o=e.toJSON(t);else{o={name:t.name,times:wd(t.times,Array),values:wd(t.values,Array)};let s=t.getInterpolation();s!==t.DefaultInterpolation&&(o.interpolation=s)}return o.type=t.ValueTypeName,o}InterpolantFactoryMethodDiscrete(t){return new Rv(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new Iv(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new Pv(this.times,this.values,this.getValueSize(),t)}setInterpolation(t){let e;switch(t){case Md:e=this.InterpolantFactoryMethodDiscrete;break;case bd:e=this.InterpolantFactoryMethodLinear;break;case Sy:e=this.InterpolantFactoryMethodSmooth;break}if(e===void 0){let o="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(t!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(o);return console.warn("THREE.KeyframeTrack:",o),this}return this.createInterpolant=e,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Md;case this.InterpolantFactoryMethodLinear:return bd;case this.InterpolantFactoryMethodSmooth:return Sy}}getValueSize(){return this.values.length/this.times.length}shift(t){if(t!==0){let e=this.times;for(let o=0,s=e.length;o!==s;++o)e[o]+=t}return this}scale(t){if(t!==1){let e=this.times;for(let o=0,s=e.length;o!==s;++o)e[o]*=t}return this}trim(t,e){let o=this.times,s=o.length,u=0,p=s-1;for(;u!==s&&o[u]<t;)++u;for(;p!==-1&&o[p]>e;)--p;if(++p,u!==0||p!==s){u>=p&&(p=Math.max(p,1),u=p-1);let f=this.getValueSize();this.times=o.slice(u,p),this.values=this.values.slice(u*f,p*f)}return this}validate(){let t=!0,e=this.getValueSize();e-Math.floor(e)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);let o=this.times,s=this.values,u=o.length;u===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let p=null;for(let f=0;f!==u;f++){let g=o[f];if(typeof g=="number"&&isNaN(g)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,f,g),t=!1;break}if(p!==null&&p>g){console.error("THREE.KeyframeTrack: Out of order keys.",this,f,g,p),t=!1;break}p=g}if(s!==void 0&&$X(s))for(let f=0,g=s.length;f!==g;++f){let m=s[f];if(isNaN(m)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,f,m),t=!1;break}}return t}optimize(){let t=this.times.slice(),e=this.values.slice(),o=this.getValueSize(),s=this.getInterpolation()===Sy,u=t.length-1,p=1;for(let f=1;f<u;++f){let g=!1,m=t[f],v=t[f+1];if(m!==v&&(f!==1||m!==t[0]))if(s)g=!0;else{let w=f*o,S=w-o,b=w+o;for(let C=0;C!==o;++C){let R=e[w+C];if(R!==e[S+C]||R!==e[b+C]){g=!0;break}}}if(g){if(f!==p){t[p]=t[f];let w=f*o,S=p*o;for(let b=0;b!==o;++b)e[S+b]=e[w+b]}++p}}if(u>0){t[p]=t[u];for(let f=u*o,g=p*o,m=0;m!==o;++m)e[g+m]=e[f+m];++p}return p!==t.length?(this.times=t.slice(0,p),this.values=e.slice(0,p*o)):(this.times=t,this.values=e),this}clone(){let t=this.times.slice(),e=this.values.slice(),o=this.constructor,s=new o(this.name,t,e);return s.createInterpolant=this.createInterpolant,s}};ia.prototype.TimeBufferType=Float32Array;ia.prototype.ValueBufferType=Float32Array;ia.prototype.DefaultInterpolation=bd;var zl=class extends ia{};zl.prototype.ValueTypeName="bool";zl.prototype.ValueBufferType=Array;zl.prototype.DefaultInterpolation=Md;zl.prototype.InterpolantFactoryMethodLinear=void 0;zl.prototype.InterpolantFactoryMethodSmooth=void 0;var Lv=class extends ia{};Lv.prototype.ValueTypeName="color";var Nv=class extends ia{};Nv.prototype.ValueTypeName="number";var Ov=class extends Yc{constructor(t,e,o,s){super(t,e,o,s)}interpolate_(t,e,o,s){let u=this.resultBuffer,p=this.sampleValues,f=this.valueSize,g=(o-e)/(s-e),m=t*f;for(let v=m+f;m!==v;m+=4)ju.slerpFlat(u,0,p,m-f,p,m,g);return u}},ch=class extends ia{InterpolantFactoryMethodLinear(t){return new Ov(this.times,this.values,this.getValueSize(),t)}};ch.prototype.ValueTypeName="quaternion";ch.prototype.DefaultInterpolation=bd;ch.prototype.InterpolantFactoryMethodSmooth=void 0;var Gl=class extends ia{};Gl.prototype.ValueTypeName="string";Gl.prototype.ValueBufferType=Array;Gl.prototype.DefaultInterpolation=Md;Gl.prototype.InterpolantFactoryMethodLinear=void 0;Gl.prototype.InterpolantFactoryMethodSmooth=void 0;var Dv=class extends ia{};Dv.prototype.ValueTypeName="vector";var Fv=class{constructor(t,e,o){let s=this,u=!1,p=0,f=0,g,m=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=o,this.itemStart=function(v){f++,u===!1&&s.onStart!==void 0&&s.onStart(v,p,f),u=!0},this.itemEnd=function(v){p++,s.onProgress!==void 0&&s.onProgress(v,p,f),p===f&&(u=!1,s.onLoad!==void 0&&s.onLoad())},this.itemError=function(v){s.onError!==void 0&&s.onError(v)},this.resolveURL=function(v){return g?g(v):v},this.setURLModifier=function(v){return g=v,this},this.addHandler=function(v,w){return m.push(v,w),this},this.removeHandler=function(v){let w=m.indexOf(v);return w!==-1&&m.splice(w,2),this},this.getHandler=function(v){for(let w=0,S=m.length;w<S;w+=2){let b=m[w],C=m[w+1];if(b.global&&(b.lastIndex=0),b.test(v))return C}return null}}},ZX=new Fv,Uv=class{constructor(t){this.manager=t!==void 0?t:ZX,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(t,e){let o=this;return new Promise(function(s,u){o.load(t,s,e,u)})}parse(){}setCrossOrigin(t){return this.crossOrigin=t,this}setWithCredentials(t){return this.withCredentials=t,this}setPath(t){return this.path=t,this}setResourcePath(t){return this.resourcePath=t,this}setRequestHeader(t){return this.requestHeader=t,this}};Uv.DEFAULT_MATERIAL_NAME="__DEFAULT";var Hv="\\[\\]\\.:\\/",KX=new RegExp("["+Hv+"]","g"),Vv="[^"+Hv+"]",JX="[^"+Hv.replace("\\.","")+"]",jX=/((?:WC+[\/:])*)/.source.replace("WC",Vv),QX=/(WCOD+)?/.source.replace("WCOD",JX),t7=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Vv),e7=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Vv),n7=new RegExp("^"+jX+QX+t7+e7+"$"),r7=["material","materials","bones","map"],Bv=class{constructor(t,e,o){let s=o||Or.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,s)}getValue(t,e){this.bind();let o=this._targetGroup.nCachedObjects_,s=this._bindings[o];s!==void 0&&s.getValue(t,e)}setValue(t,e){let o=this._bindings;for(let s=this._targetGroup.nCachedObjects_,u=o.length;s!==u;++s)o[s].setValue(t,e)}bind(){let t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,o=t.length;e!==o;++e)t[e].bind()}unbind(){let t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,o=t.length;e!==o;++e)t[e].unbind()}},Or=class n{constructor(t,e,o){this.path=e,this.parsedPath=o||n.parseTrackName(e),this.node=n.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,o){return t&&t.isAnimationObjectGroup?new n.Composite(t,e,o):new n(t,e,o)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(KX,"")}static parseTrackName(t){let e=n7.exec(t);if(e===null)throw new Error("PropertyBinding: Cannot parse trackName: "+t);let o={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},s=o.nodeName&&o.nodeName.lastIndexOf(".");if(s!==void 0&&s!==-1){let u=o.nodeName.substring(s+1);r7.indexOf(u)!==-1&&(o.nodeName=o.nodeName.substring(0,s),o.objectName=u)}if(o.propertyName===null||o.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return o}static findNode(t,e){if(e===void 0||e===""||e==="."||e===-1||e===t.name||e===t.uuid)return t;if(t.skeleton){let o=t.skeleton.getBoneByName(e);if(o!==void 0)return o}if(t.children){let o=function(u){for(let p=0;p<u.length;p++){let f=u[p];if(f.name===e||f.uuid===e)return f;let g=o(f.children);if(g)return g}return null},s=o(t.children);if(s)return s}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(t,e){t[e]=this.targetObject[this.propertyName]}_getValue_array(t,e){let o=this.resolvedProperty;for(let s=0,u=o.length;s!==u;++s)t[e++]=o[s]}_getValue_arrayElement(t,e){t[e]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(t,e){this.resolvedProperty.toArray(t,e)}_setValue_direct(t,e){this.targetObject[this.propertyName]=t[e]}_setValue_direct_setNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(t,e){let o=this.resolvedProperty;for(let s=0,u=o.length;s!==u;++s)o[s]=t[e++]}_setValue_array_setNeedsUpdate(t,e){let o=this.resolvedProperty;for(let s=0,u=o.length;s!==u;++s)o[s]=t[e++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,e){let o=this.resolvedProperty;for(let s=0,u=o.length;s!==u;++s)o[s]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(t,e){this.resolvedProperty[this.propertyIndex]=t[e]}_setValue_arrayElement_setNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(t,e){this.resolvedProperty.fromArray(t,e)}_setValue_fromArray_setNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(t,e){this.bind(),this.getValue(t,e)}_setValue_unbound(t,e){this.bind(),this.setValue(t,e)}bind(){let t=this.node,e=this.parsedPath,o=e.objectName,s=e.propertyName,u=e.propertyIndex;if(t||(t=n.findNode(this.rootNode,e.nodeName),this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t){console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");return}if(o){let m=e.objectIndex;switch(o){case"materials":if(!t.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!t.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}t=t.material.materials;break;case"bones":if(!t.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}t=t.skeleton.bones;for(let v=0;v<t.length;v++)if(t[v].name===m){m=v;break}break;case"map":if("map"in t){t=t.map;break}if(!t.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!t.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}t=t.material.map;break;default:if(t[o]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}t=t[o]}if(m!==void 0){if(t[m]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);return}t=t[m]}}let p=t[s];if(p===void 0){let m=e.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+m+"."+s+" but it wasn't found.",t);return}let f=this.Versioning.None;this.targetObject=t,t.needsUpdate!==void 0?f=this.Versioning.NeedsUpdate:t.matrixWorldNeedsUpdate!==void 0&&(f=this.Versioning.MatrixWorldNeedsUpdate);let g=this.BindingType.Direct;if(u!==void 0){if(s==="morphTargetInfluences"){if(!t.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!t.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}t.morphTargetDictionary[u]!==void 0&&(u=t.morphTargetDictionary[u])}g=this.BindingType.ArrayElement,this.resolvedProperty=p,this.propertyIndex=u}else p.fromArray!==void 0&&p.toArray!==void 0?(g=this.BindingType.HasFromToArray,this.resolvedProperty=p):Array.isArray(p)?(g=this.BindingType.EntireArray,this.resolvedProperty=p):this.propertyName=s;this.getValue=this.GetterByBindingType[g],this.setValue=this.SetterByBindingTypeAndVersioning[g][f]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};Or.Composite=Bv;Or.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};Or.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};Or.prototype.GetterByBindingType=[Or.prototype._getValue_direct,Or.prototype._getValue_array,Or.prototype._getValue_arrayElement,Or.prototype._getValue_toArray];Or.prototype.SetterByBindingTypeAndVersioning=[[Or.prototype._setValue_direct,Or.prototype._setValue_direct_setNeedsUpdate,Or.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Or.prototype._setValue_array,Or.prototype._setValue_array_setNeedsUpdate,Or.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Or.prototype._setValue_arrayElement,Or.prototype._setValue_arrayElement_setNeedsUpdate,Or.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Or.prototype._setValue_fromArray,Or.prototype._setValue_fromArray_setNeedsUpdate,Or.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var eet=new Float32Array(1);typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:zv}}));typeof window!="undefined"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=zv);var zi=63710088e-1,iet={centimeters:zi*100,centimetres:zi*100,degrees:zi/111325,feet:zi*3.28084,inches:zi*39.37,kilometers:zi/1e3,kilometres:zi/1e3,meters:zi,metres:zi,miles:zi/1609.344,millimeters:zi*1e3,millimetres:zi*1e3,nauticalmiles:zi/1852,radians:1,yards:zi*1.0936},oet={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/zi,yards:1.0936133};function bo(n,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=n,o}function Pr(n,t,e){if(e===void 0&&(e={}),!n)throw new Error("coordinates is required");if(!Array.isArray(n))throw new Error("coordinates must be an Array");if(n.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Pa(n[0])||!Pa(n[1]))throw new Error("coordinates must contain numbers");var o={type:"Point",coordinates:n};return bo(o,t,e)}function Dr(n,t,e){e===void 0&&(e={});for(var o=0,s=n;o<s.length;o++){var u=s[o];if(u.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var p=0;p<u[u.length-1].length;p++)if(u[u.length-1][p]!==u[0][p])throw new Error("First and last Position are not equivalent.")}var f={type:"Polygon",coordinates:n};return bo(f,t,e)}function Gi(n,t,e){if(e===void 0&&(e={}),n.length<2)throw new Error("coordinates must be an array of two or more positions");var o={type:"LineString",coordinates:n};return bo(o,t,e)}function Wv(n,t,e){e===void 0&&(e={});var o={type:"MultiPoint",coordinates:n};return bo(o,t,e)}function Pa(n){return!isNaN(n)&&n!==null&&!Array.isArray(n)}function Ei(n,t,e){if(n!==null)for(var o,s,u,p,f,g,m,v=0,w=0,S,b=n.type,C=b==="FeatureCollection",R=b==="Feature",x=C?n.features.length:1,E=0;E<x;E++){m=C?n.features[E].geometry:R?n.geometry:n,S=m?m.type==="GeometryCollection":!1,f=S?m.geometries.length:1;for(var I=0;I<f;I++){var A=0,F=0;if(p=S?m.geometries[I]:m,p!==null){g=p.coordinates;var V=p.type;switch(v=e&&(V==="Polygon"||V==="MultiPolygon")?1:0,V){case null:break;case"Point":if(t(g,w,E,A,F)===!1)return!1;w++,A++;break;case"LineString":case"MultiPoint":for(o=0;o<g.length;o++){if(t(g[o],w,E,A,F)===!1)return!1;w++,V==="MultiPoint"&&A++}V==="LineString"&&A++;break;case"Polygon":case"MultiLineString":for(o=0;o<g.length;o++){for(s=0;s<g[o].length-v;s++){if(t(g[o][s],w,E,A,F)===!1)return!1;w++}V==="MultiLineString"&&A++,V==="Polygon"&&F++}V==="Polygon"&&A++;break;case"MultiPolygon":for(o=0;o<g.length;o++){for(F=0,s=0;s<g[o].length;s++){for(u=0;u<g[o][s].length-v;u++){if(t(g[o][s][u],w,E,A,F)===!1)return!1;w++}F++}A++}break;case"GeometryCollection":for(o=0;o<p.geometries.length;o++)if(Ei(p.geometries[o],t,e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function rP(n,t,e,o){var s=e;return Ei(n,function(u,p,f,g,m){p===0&&e===void 0?s=u:s=t(s,u,p,f,g,m)},o),s}function el(n,t){var e,o,s,u,p,f,g,m,v,w,S=0,b=n.type==="FeatureCollection",C=n.type==="Feature",R=b?n.features.length:1;for(e=0;e<R;e++){for(f=b?n.features[e].geometry:C?n.geometry:n,m=b?n.features[e].properties:C?n.properties:{},v=b?n.features[e].bbox:C?n.bbox:void 0,w=b?n.features[e].id:C?n.id:void 0,g=f?f.type==="GeometryCollection":!1,p=g?f.geometries.length:1,s=0;s<p;s++){if(u=g?f.geometries[s]:f,u===null){if(t(null,S,m,v,w)===!1)return!1;continue}switch(u.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(t(u,S,m,v,w)===!1)return!1;break}case"GeometryCollection":{for(o=0;o<u.geometries.length;o++)if(t(u.geometries[o],S,m,v,w)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}S++}}function ms(n,t){el(n,function(e,o,s,u,p){var f=e===null?null:e.type;switch(f){case null:case"Point":case"LineString":case"Polygon":return t(bo(e,s,{bbox:u,id:p}),o,0)===!1?!1:void 0}var g;switch(f){case"MultiPoint":g="Point";break;case"MultiLineString":g="LineString";break;case"MultiPolygon":g="Polygon";break}for(var m=0;m<e.coordinates.length;m++){var v=e.coordinates[m],w={type:g,coordinates:v};if(t(bo(w,s),o,m)===!1)return!1}})}function Xv(n){var t=[1/0,1/0,-1/0,-1/0];return Ei(n,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}Xv.default=Xv;var Ao=Xv;function to(n){if(!n)throw new Error("coord is required");if(!Array.isArray(n)){if(n.type==="Feature"&&n.geometry!==null&&n.geometry.type==="Point")return n.geometry.coordinates;if(n.type==="Point")return n.coordinates}if(Array.isArray(n)&&n.length>=2&&!Array.isArray(n[0])&&!Array.isArray(n[1]))return n;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function Yv(n,t,e){if(!n)throw new Error("No feature passed");if(!e)throw new Error(".featureOf() requires a name");if(!n||n.type!=="Feature"||!n.geometry)throw new Error("Invalid input to "+e+", Feature with geometry required");if(!n.geometry||n.geometry.type!==t)throw new Error("Invalid input to "+e+": must be a "+t+", given "+n.geometry.type)}function eo(n){return n.type==="Feature"?n.geometry:n}var f7=tn($d(),1);var E7=tn(EP(),1);function ki(n,t,e){if(e===void 0&&(e={}),!n)throw new Error("point is required");if(!t)throw new Error("polygon is required");var o=to(n),s=eo(t),u=s.type,p=t.bbox,f=s.coordinates;if(p&&w7(o,p)===!1)return!1;u==="Polygon"&&(f=[f]);for(var g=!1,m=0;m<f.length&&!g;m++)if(wP(o,f[m][0],e.ignoreBoundary)){for(var v=!1,w=1;w<f[m].length&&!v;)wP(o,f[m][w],!e.ignoreBoundary)&&(v=!0),w++;v||(g=!0)}return g}function wP(n,t,e){var o=!1;t[0][0]===t[t.length-1][0]&&t[0][1]===t[t.length-1][1]&&(t=t.slice(0,t.length-1));for(var s=0,u=t.length-1;s<t.length;u=s++){var p=t[s][0],f=t[s][1],g=t[u][0],m=t[u][1],v=n[1]*(p-g)+f*(g-n[0])+m*(n[0]-p)===0&&(p-n[0])*(g-n[0])<=0&&(f-n[1])*(m-n[1])<=0;if(v)return!e;var w=f>n[1]!=m>n[1]&&n[0]<(g-p)*(n[1]-f)/(m-f)+p;w&&(o=!o)}return o}function w7(n,t){return t[0]<=n[0]&&t[1]<=n[1]&&t[2]>=n[0]&&t[3]>=n[1]}var bP=new ArrayBuffer(16),Fnt=new Float64Array(bP),Unt=new Uint32Array(bP);var U7=tn(l_(),1);var lit=function(){function n(t){this.points=t.points||[],this.duration=t.duration||1e4,this.sharpness=t.sharpness||.85,this.centers=[],this.controls=[],this.stepLength=t.stepLength||60,this.length=this.points.length,this.delay=0;for(var e=0;e<this.length;e++)this.points[e].z=this.points[e].z||0;for(var e=0;e<this.length-1;e++){var o=this.points[e],s=this.points[e+1];this.centers.push({x:(o.x+s.x)/2,y:(o.y+s.y)/2,z:(o.z+s.z)/2})}this.controls.push([this.points[0],this.points[0]]);for(var e=0;e<this.centers.length-1;e++){var u=this.points[e+1].x-(this.centers[e].x+this.centers[e+1].x)/2,p=this.points[e+1].y-(this.centers[e].y+this.centers[e+1].y)/2,f=this.points[e+1].z-(this.centers[e].y+this.centers[e+1].z)/2;this.controls.push([{x:(1-this.sharpness)*this.points[e+1].x+this.sharpness*(this.centers[e].x+u),y:(1-this.sharpness)*this.points[e+1].y+this.sharpness*(this.centers[e].y+p),z:(1-this.sharpness)*this.points[e+1].z+this.sharpness*(this.centers[e].z+f)},{x:(1-this.sharpness)*this.points[e+1].x+this.sharpness*(this.centers[e+1].x+u),y:(1-this.sharpness)*this.points[e+1].y+this.sharpness*(this.centers[e+1].y+p),z:(1-this.sharpness)*this.points[e+1].z+this.sharpness*(this.centers[e+1].z+f)}])}return this.controls.push([this.points[this.length-1],this.points[this.length-1]]),this.steps=this.cacheSteps(this.stepLength),this}return n.prototype.cacheSteps=function(t){var e=[],o=this.pos(0);e.push(0);for(var s=0;s<this.duration;s+=10){var u=this.pos(s),p=Math.sqrt((u.x-o.x)*(u.x-o.x)+(u.y-o.y)*(u.y-o.y)+(u.z-o.z)*(u.z-o.z));p>t&&(e.push(s),o=u)}return e},n.prototype.vector=function(t){var e=this.pos(t+10),o=this.pos(t-10);return{angle:180*Math.atan2(e.y-o.y,e.x-o.x)/3.14,speed:Math.sqrt((o.x-e.x)*(o.x-e.x)+(o.y-e.y)*(o.y-e.y)+(o.z-e.z)*(o.z-e.z))}},n.prototype.pos=function(t){var e=t-this.delay;e<0&&(e=0),e>this.duration&&(e=this.duration-1);var o=e/this.duration;if(o>=1)return this.points[this.length-1];var s=Math.floor((this.points.length-1)*o),u=(this.length-1)*o-s;return B7(u,this.points[s],this.controls[s][1],this.controls[s+1][0],this.points[s+1])},n}();function B7(n,t,e,o,s){var u=z7(n),p={x:s.x*u[0]+o.x*u[1]+e.x*u[2]+t.x*u[3],y:s.y*u[0]+o.y*u[1]+e.y*u[2]+t.y*u[3],z:s.z*u[0]+o.z*u[1]+e.z*u[2]+t.z*u[3]};return p}function z7(n){var t=n*n,e=t*n;return[e,3*t*(1-n),3*n*(1-n)*(1-n),(1-n)*(1-n)*(1-n)]}function dh(n,t){t===void 0&&(t={});var e=Number(n[0]),o=Number(n[1]),s=Number(n[2]),u=Number(n[3]);if(n.length===6)throw new Error("@turf/bbox-polygon does not support BBox with 6 positions");var p=[e,o],f=[e,u],g=[s,u],m=[s,o];return Dr([[p,m,g,f,p]],t.properties,{bbox:n,id:t.id})}function G7(n){return dh(Ao(n))}var c_=G7;var rY=tn(FP(),1);var IY=tn(fg(),1);var LY=tn($d(),1);var DY=tn(l_(),1);var tI=Math.PI/180,eI=180/Math.PI,Eh=function(n,t){this.lon=n,this.lat=t,this.x=tI*n,this.y=tI*t};Eh.prototype.view=function(){return String(this.lon).slice(0,4)+","+String(this.lat).slice(0,4)};Eh.prototype.antipode=function(){var n=-1*this.lat,t=this.lon<0?180+this.lon:(180-this.lon)*-1;return new Eh(t,n)};var nI=function(){this.coords=[],this.length=0};nI.prototype.move_to=function(n){this.length++,this.coords.push(n)};var I_=function(n){this.properties=n||{},this.geometries=[]};I_.prototype.json=function(){if(this.geometries.length<=0)return{geometry:{type:"LineString",coordinates:null},type:"Feature",properties:this.properties};if(this.geometries.length===1)return{geometry:{type:"LineString",coordinates:this.geometries[0].coords},type:"Feature",properties:this.properties};for(var n=[],t=0;t<this.geometries.length;t++)n.push(this.geometries[t].coords);return{geometry:{type:"MultiLineString",coordinates:n},type:"Feature",properties:this.properties}};I_.prototype.wkt=function(){for(var n="",t="LINESTRING(",e=function(u){t+=u[0]+" "+u[1]+","},o=0;o<this.geometries.length;o++){if(this.geometries[o].coords.length===0)return"LINESTRING(empty)";var s=this.geometries[o].coords;s.forEach(e),n+=t.substring(0,t.length-1)+")"}return n};var rI=function(n,t,e){if(!n||n.x===void 0||n.y===void 0)throw new Error("GreatCircle constructor expects two args: start and end objects with x and y properties");if(!t||t.x===void 0||t.y===void 0)throw new Error("GreatCircle constructor expects two args: start and end objects with x and y properties");this.start=new Eh(n.x,n.y),this.end=new Eh(t.x,t.y),this.properties=e||{};var o=this.start.x-this.end.x,s=this.start.y-this.end.y,u=Math.pow(Math.sin(s/2),2)+Math.cos(this.start.y)*Math.cos(this.end.y)*Math.pow(Math.sin(o/2),2);if(this.g=2*Math.asin(Math.sqrt(u)),this.g===Math.PI)throw new Error("it appears "+n.view()+" and "+t.view()+" are 'antipodal', e.g diametrically opposite, thus there is no single route but rather infinite");if(isNaN(this.g))throw new Error("could not calculate great circle between "+n+" and "+t)};rI.prototype.interpolate=function(n){var t=Math.sin((1-n)*this.g)/Math.sin(this.g),e=Math.sin(n*this.g)/Math.sin(this.g),o=t*Math.cos(this.start.y)*Math.cos(this.start.x)+e*Math.cos(this.end.y)*Math.cos(this.end.x),s=t*Math.cos(this.start.y)*Math.sin(this.start.x)+e*Math.cos(this.end.y)*Math.sin(this.end.x),u=t*Math.sin(this.start.y)+e*Math.sin(this.end.y),p=eI*Math.atan2(u,Math.sqrt(Math.pow(o,2)+Math.pow(s,2))),f=eI*Math.atan2(s,o);return[f,p]};rI.prototype.Arc=function(n,t){var e=[];if(!n||n<=2)e.push([this.start.lon,this.start.lat]),e.push([this.end.lon,this.end.lat]);else for(var o=1/(n-1),s=0;s<n;++s){var u=o*s,p=this.interpolate(u);e.push(p)}for(var f=!1,g=0,m=t&&t.offset?t.offset:10,v=180-m,w=-180+m,S=360-m,b=1;b<e.length;++b){var C=e[b-1][0],R=e[b][0],x=Math.abs(R-C);x>S&&(R>v&&C<w||C>v&&R<w)?f=!0:x>g&&(g=x)}var E=[];if(f&&g<m){var I=[];E.push(I);for(var A=0;A<e.length;++A){var F=parseFloat(e[A][0]);if(A>0&&Math.abs(F-e[A-1][0])>S){var V=parseFloat(e[A-1][0]),X=parseFloat(e[A-1][1]),q=parseFloat(e[A][0]),D=parseFloat(e[A][1]);if(V>-180&&V<w&&q===180&&A+1<e.length&&e[A-1][0]>-180&&e[A-1][0]<w){I.push([-180,e[A][1]]),A++,I.push([e[A][0],e[A][1]]);continue}else if(V>v&&V<180&&q===-180&&A+1<e.length&&e[A-1][0]>v&&e[A-1][0]<180){I.push([180,e[A][1]]),A++,I.push([e[A][0],e[A][1]]);continue}if(V<w&&q>v){var xt=V;V=q,q=xt;var B=X;X=D,D=B}if(V>v&&q<w&&(q+=360),V<=180&&q>=180&&V<q){var j=(180-V)/(q-V),K=j*D+(1-j)*X;I.push([e[A-1][0]>v?180:-180,K]),I=[],I.push([e[A-1][0]>v?-180:180,K]),E.push(I)}else I=[],E.push(I);I.push([F,e[A][1]])}else I.push([e[A][0],e[A][1]])}}else{var Dt=[];E.push(Dt);for(var Q=0;Q<e.length;++Q)Dt.push([e[Q][0],e[Q][1]])}for(var At=new I_(this.properties),Mt=0;Mt<E.length;++Mt){var Lt=new nI;At.geometries.push(Lt);for(var pt=E[Mt],yt=0;yt<pt.length;++yt)Lt.move_to(pt[yt])}return At};var BY=tn(fg(),1);var UZ=tn(fg(),1);var BZ=tn(i1(),1);var kZ=tn($d(),1);var cn=[],fn=[],hn=[],pn=[],dn=[],gn=[],mn=[],yn=[],vn=[],_n=[],xn=[],En=[],wn=[],Sn=[],Mn=[],bn=[],An=[],Tn=[],Cn=[],Pn=[],In=[],Rn=[],Ln=[],Nn=[];mn[85]=_n[85]=-1;yn[85]=xn[85]=0;vn[85]=En[85]=1;Cn[85]=Rn[85]=1;Pn[85]=Ln[85]=0;In[85]=Nn[85]=1;cn[85]=pn[85]=0;fn[85]=dn[85]=-1;hn[85]=Mn[85]=0;bn[85]=wn[85]=0;An[85]=Sn[85]=1;gn[85]=Tn[85]=1;Rn[1]=Rn[169]=0;Ln[1]=Ln[169]=-1;Nn[1]=Nn[169]=0;wn[1]=wn[169]=-1;Sn[1]=Sn[169]=0;Mn[1]=Mn[169]=0;_n[4]=_n[166]=0;xn[4]=xn[166]=-1;En[4]=En[166]=1;bn[4]=bn[166]=1;An[4]=An[166]=0;Tn[4]=Tn[166]=0;mn[16]=mn[154]=0;yn[16]=yn[154]=1;vn[16]=vn[154]=1;pn[16]=pn[154]=1;dn[16]=dn[154]=0;gn[16]=gn[154]=1;Cn[64]=Cn[106]=0;Pn[64]=Pn[106]=1;In[64]=In[106]=0;cn[64]=cn[106]=-1;fn[64]=fn[106]=0;hn[64]=hn[106]=1;Cn[2]=Cn[168]=0;Pn[2]=Pn[168]=-1;In[2]=In[168]=1;Rn[2]=Rn[168]=0;Ln[2]=Ln[168]=-1;Nn[2]=Nn[168]=0;wn[2]=wn[168]=-1;Sn[2]=Sn[168]=0;Mn[2]=Mn[168]=0;bn[2]=bn[168]=-1;An[2]=An[168]=0;Tn[2]=Tn[168]=1;mn[8]=mn[162]=0;yn[8]=yn[162]=-1;vn[8]=vn[162]=0;_n[8]=_n[162]=0;xn[8]=xn[162]=-1;En[8]=En[162]=1;wn[8]=wn[162]=1;Sn[8]=Sn[162]=0;Mn[8]=Mn[162]=1;bn[8]=bn[162]=1;An[8]=An[162]=0;Tn[8]=Tn[162]=0;mn[32]=mn[138]=0;yn[32]=yn[138]=1;vn[32]=vn[138]=1;_n[32]=_n[138]=0;xn[32]=xn[138]=1;En[32]=En[138]=0;cn[32]=cn[138]=1;fn[32]=fn[138]=0;hn[32]=hn[138]=0;pn[32]=pn[138]=1;dn[32]=dn[138]=0;gn[32]=gn[138]=1;Rn[128]=Rn[42]=0;Ln[128]=Ln[42]=1;Nn[128]=Nn[42]=1;Cn[128]=Cn[42]=0;Pn[128]=Pn[42]=1;In[128]=In[42]=0;cn[128]=cn[42]=-1;fn[128]=fn[42]=0;hn[128]=hn[42]=1;pn[128]=pn[42]=-1;dn[128]=dn[42]=0;gn[128]=gn[42]=0;_n[5]=_n[165]=-1;xn[5]=xn[165]=0;En[5]=En[165]=0;Rn[5]=Rn[165]=1;Ln[5]=Ln[165]=0;Nn[5]=Nn[165]=0;bn[20]=bn[150]=0;An[20]=An[150]=1;Tn[20]=Tn[150]=1;pn[20]=pn[150]=0;dn[20]=dn[150]=-1;gn[20]=gn[150]=1;mn[80]=mn[90]=-1;yn[80]=yn[90]=0;vn[80]=vn[90]=1;Cn[80]=Cn[90]=1;Pn[80]=Pn[90]=0;In[80]=In[90]=1;wn[65]=wn[105]=0;Sn[65]=Sn[105]=1;Mn[65]=Mn[105]=0;cn[65]=cn[105]=0;fn[65]=fn[105]=-1;hn[65]=hn[105]=0;mn[160]=mn[10]=-1;yn[160]=yn[10]=0;vn[160]=vn[10]=1;_n[160]=_n[10]=-1;xn[160]=xn[10]=0;En[160]=En[10]=0;Rn[160]=Rn[10]=1;Ln[160]=Ln[10]=0;Nn[160]=Nn[10]=0;Cn[160]=Cn[10]=1;Pn[160]=Pn[10]=0;In[160]=In[10]=1;bn[130]=bn[40]=0;An[130]=An[40]=1;Tn[130]=Tn[40]=1;wn[130]=wn[40]=0;Sn[130]=Sn[40]=1;Mn[130]=Mn[40]=0;cn[130]=cn[40]=0;fn[130]=fn[40]=-1;hn[130]=hn[40]=0;pn[130]=pn[40]=0;dn[130]=dn[40]=-1;gn[130]=gn[40]=1;_n[37]=_n[133]=0;xn[37]=xn[133]=1;En[37]=En[133]=1;Rn[37]=Rn[133]=0;Ln[37]=Ln[133]=1;Nn[37]=Nn[133]=0;cn[37]=cn[133]=-1;fn[37]=fn[133]=0;hn[37]=hn[133]=0;pn[37]=pn[133]=1;dn[37]=dn[133]=0;gn[37]=gn[133]=0;bn[148]=bn[22]=-1;An[148]=An[22]=0;Tn[148]=Tn[22]=0;Rn[148]=Rn[22]=0;Ln[148]=Ln[22]=-1;Nn[148]=Nn[22]=1;Cn[148]=Cn[22]=0;Pn[148]=Pn[22]=1;In[148]=In[22]=1;pn[148]=pn[22]=-1;dn[148]=dn[22]=0;gn[148]=gn[22]=1;mn[82]=mn[88]=0;yn[82]=yn[88]=-1;vn[82]=vn[88]=1;bn[82]=bn[88]=1;An[82]=An[88]=0;Tn[82]=Tn[88]=1;wn[82]=wn[88]=-1;Sn[82]=Sn[88]=0;Mn[82]=Mn[88]=1;Cn[82]=Cn[88]=0;Pn[82]=Pn[88]=-1;In[82]=In[88]=0;mn[73]=mn[97]=0;yn[73]=yn[97]=1;vn[73]=vn[97]=0;_n[73]=_n[97]=0;xn[73]=xn[97]=-1;En[73]=En[97]=0;wn[73]=wn[97]=1;Sn[73]=Sn[97]=0;Mn[73]=Mn[97]=0;cn[73]=cn[97]=1;fn[73]=fn[97]=0;hn[73]=hn[97]=1;mn[145]=mn[25]=0;yn[145]=yn[25]=-1;vn[145]=vn[25]=0;wn[145]=wn[25]=1;Sn[145]=Sn[25]=0;Mn[145]=Mn[25]=1;Rn[145]=Rn[25]=0;Ln[145]=Ln[25]=1;Nn[145]=Nn[25]=1;pn[145]=pn[25]=-1;dn[145]=dn[25]=0;gn[145]=gn[25]=0;_n[70]=_n[100]=0;xn[70]=xn[100]=1;En[70]=En[100]=0;bn[70]=bn[100]=-1;An[70]=An[100]=0;Tn[70]=Tn[100]=1;Cn[70]=Cn[100]=0;Pn[70]=Pn[100]=-1;In[70]=In[100]=1;cn[70]=cn[100]=1;fn[70]=fn[100]=0;hn[70]=hn[100]=0;_n[101]=_n[69]=0;xn[101]=xn[69]=1;En[101]=En[69]=0;cn[101]=cn[69]=1;fn[101]=fn[69]=0;hn[101]=hn[69]=0;Rn[149]=Rn[21]=0;Ln[149]=Ln[21]=1;Nn[149]=Nn[21]=1;pn[149]=pn[21]=-1;dn[149]=dn[21]=0;gn[149]=gn[21]=0;bn[86]=bn[84]=-1;An[86]=An[84]=0;Tn[86]=Tn[84]=1;Cn[86]=Cn[84]=0;Pn[86]=Pn[84]=-1;In[86]=In[84]=1;mn[89]=mn[81]=0;yn[89]=yn[81]=-1;vn[89]=vn[81]=0;wn[89]=wn[81]=1;Sn[89]=Sn[81]=0;Mn[89]=Mn[81]=1;mn[96]=mn[74]=0;yn[96]=yn[74]=1;vn[96]=vn[74]=0;_n[96]=_n[74]=-1;xn[96]=xn[74]=0;En[96]=En[74]=1;Cn[96]=Cn[74]=1;Pn[96]=Pn[74]=0;In[96]=In[74]=0;cn[96]=cn[74]=1;fn[96]=fn[74]=0;hn[96]=hn[74]=1;mn[24]=mn[146]=0;yn[24]=yn[146]=-1;vn[24]=vn[146]=1;bn[24]=bn[146]=1;An[24]=An[146]=0;Tn[24]=Tn[146]=1;wn[24]=wn[146]=0;Sn[24]=Sn[146]=1;Mn[24]=Mn[146]=1;pn[24]=pn[146]=0;dn[24]=dn[146]=-1;gn[24]=gn[146]=0;_n[6]=_n[164]=-1;xn[6]=xn[164]=0;En[6]=En[164]=1;bn[6]=bn[164]=-1;An[6]=An[164]=0;Tn[6]=Tn[164]=0;Rn[6]=Rn[164]=0;Ln[6]=Ln[164]=-1;Nn[6]=Nn[164]=1;Cn[6]=Cn[164]=1;Pn[6]=Pn[164]=0;In[6]=In[164]=0;wn[129]=wn[41]=0;Sn[129]=Sn[41]=1;Mn[129]=Mn[41]=1;Rn[129]=Rn[41]=0;Ln[129]=Ln[41]=1;Nn[129]=Nn[41]=0;cn[129]=cn[41]=-1;fn[129]=fn[41]=0;hn[129]=hn[41]=0;pn[129]=pn[41]=0;dn[129]=dn[41]=-1;gn[129]=gn[41]=0;bn[66]=bn[104]=0;An[66]=An[104]=1;Tn[66]=Tn[104]=0;wn[66]=wn[104]=-1;Sn[66]=Sn[104]=0;Mn[66]=Mn[104]=1;Cn[66]=Cn[104]=0;Pn[66]=Pn[104]=-1;In[66]=In[104]=0;cn[66]=cn[104]=0;fn[66]=fn[104]=-1;hn[66]=hn[104]=1;mn[144]=mn[26]=-1;yn[144]=yn[26]=0;vn[144]=vn[26]=0;Rn[144]=Rn[26]=1;Ln[144]=Ln[26]=0;Nn[144]=Nn[26]=1;Cn[144]=Cn[26]=0;Pn[144]=Pn[26]=1;In[144]=In[26]=1;pn[144]=pn[26]=-1;dn[144]=dn[26]=0;gn[144]=gn[26]=1;_n[36]=_n[134]=0;xn[36]=xn[134]=1;En[36]=En[134]=1;bn[36]=bn[134]=0;An[36]=An[134]=1;Tn[36]=Tn[134]=0;cn[36]=cn[134]=0;fn[36]=fn[134]=-1;hn[36]=hn[134]=1;pn[36]=pn[134]=1;dn[36]=dn[134]=0;gn[36]=gn[134]=0;mn[9]=mn[161]=-1;yn[9]=yn[161]=0;vn[9]=vn[161]=0;_n[9]=_n[161]=0;xn[9]=xn[161]=-1;En[9]=En[161]=0;wn[9]=wn[161]=1;Sn[9]=Sn[161]=0;Mn[9]=Mn[161]=0;Rn[9]=Rn[161]=1;Ln[9]=Ln[161]=0;Nn[9]=Nn[161]=1;mn[136]=0;yn[136]=1;vn[136]=1;_n[136]=0;xn[136]=1;En[136]=0;bn[136]=-1;An[136]=0;Tn[136]=1;wn[136]=-1;Sn[136]=0;Mn[136]=0;Rn[136]=0;Ln[136]=-1;Nn[136]=0;Cn[136]=0;Pn[136]=-1;In[136]=1;cn[136]=1;fn[136]=0;hn[136]=0;pn[136]=1;dn[136]=0;gn[136]=1;mn[34]=0;yn[34]=-1;vn[34]=0;_n[34]=0;xn[34]=-1;En[34]=1;bn[34]=1;An[34]=0;Tn[34]=0;wn[34]=1;Sn[34]=0;Mn[34]=1;Rn[34]=0;Ln[34]=1;Nn[34]=1;Cn[34]=0;Pn[34]=1;In[34]=0;cn[34]=-1;fn[34]=0;hn[34]=1;pn[34]=-1;dn[34]=0;gn[34]=0;mn[35]=0;yn[35]=1;vn[35]=1;_n[35]=0;xn[35]=-1;En[35]=1;bn[35]=1;An[35]=0;Tn[35]=0;wn[35]=-1;Sn[35]=0;Mn[35]=0;Rn[35]=0;Ln[35]=-1;Nn[35]=0;Cn[35]=0;Pn[35]=1;In[35]=0;cn[35]=-1;fn[35]=0;hn[35]=1;pn[35]=1;dn[35]=0;gn[35]=1;mn[153]=0;yn[153]=1;vn[153]=1;wn[153]=-1;Sn[153]=0;Mn[153]=0;Rn[153]=0;Ln[153]=-1;Nn[153]=0;pn[153]=1;dn[153]=0;gn[153]=1;_n[102]=0;xn[102]=-1;En[102]=1;bn[102]=1;An[102]=0;Tn[102]=0;Cn[102]=0;Pn[102]=1;In[102]=0;cn[102]=-1;fn[102]=0;hn[102]=1;mn[155]=0;yn[155]=-1;vn[155]=0;wn[155]=1;Sn[155]=0;Mn[155]=1;Rn[155]=0;Ln[155]=1;Nn[155]=1;pn[155]=-1;dn[155]=0;gn[155]=0;_n[103]=0;xn[103]=1;En[103]=0;bn[103]=-1;An[103]=0;Tn[103]=1;Cn[103]=0;Pn[103]=-1;In[103]=1;cn[103]=1;fn[103]=0;hn[103]=0;mn[152]=0;yn[152]=1;vn[152]=1;bn[152]=-1;An[152]=0;Tn[152]=1;wn[152]=-1;Sn[152]=0;Mn[152]=0;Rn[152]=0;Ln[152]=-1;Nn[152]=0;Cn[152]=0;Pn[152]=-1;In[152]=1;pn[152]=1;dn[152]=0;gn[152]=1;mn[156]=0;yn[156]=-1;vn[156]=1;bn[156]=1;An[156]=0;Tn[156]=1;wn[156]=-1;Sn[156]=0;Mn[156]=0;Rn[156]=0;Ln[156]=-1;Nn[156]=0;Cn[156]=0;Pn[156]=1;In[156]=1;pn[156]=-1;dn[156]=0;gn[156]=1;mn[137]=0;yn[137]=1;vn[137]=1;_n[137]=0;xn[137]=1;En[137]=0;wn[137]=-1;Sn[137]=0;Mn[137]=0;Rn[137]=0;Ln[137]=-1;Nn[137]=0;cn[137]=1;fn[137]=0;hn[137]=0;pn[137]=1;dn[137]=0;gn[137]=1;mn[139]=0;yn[139]=1;vn[139]=1;_n[139]=0;xn[139]=-1;En[139]=0;wn[139]=1;Sn[139]=0;Mn[139]=0;Rn[139]=0;Ln[139]=1;Nn[139]=0;cn[139]=-1;fn[139]=0;hn[139]=0;pn[139]=1;dn[139]=0;gn[139]=1;mn[98]=0;yn[98]=-1;vn[98]=0;_n[98]=0;xn[98]=-1;En[98]=1;bn[98]=1;An[98]=0;Tn[98]=0;wn[98]=1;Sn[98]=0;Mn[98]=1;Cn[98]=0;Pn[98]=1;In[98]=0;cn[98]=-1;fn[98]=0;hn[98]=1;mn[99]=0;yn[99]=1;vn[99]=0;_n[99]=0;xn[99]=-1;En[99]=1;bn[99]=1;An[99]=0;Tn[99]=0;wn[99]=-1;Sn[99]=0;Mn[99]=1;Cn[99]=0;Pn[99]=-1;In[99]=0;cn[99]=1;fn[99]=0;hn[99]=1;_n[38]=0;xn[38]=-1;En[38]=1;bn[38]=1;An[38]=0;Tn[38]=0;Rn[38]=0;Ln[38]=1;Nn[38]=1;Cn[38]=0;Pn[38]=1;In[38]=0;cn[38]=-1;fn[38]=0;hn[38]=1;pn[38]=-1;dn[38]=0;gn[38]=0;_n[39]=0;xn[39]=1;En[39]=1;bn[39]=-1;An[39]=0;Tn[39]=0;Rn[39]=0;Ln[39]=-1;Nn[39]=1;Cn[39]=0;Pn[39]=1;In[39]=0;cn[39]=-1;fn[39]=0;hn[39]=1;pn[39]=1;dn[39]=0;gn[39]=0;var o1=function(n){return[[n.bottomleft,0],[0,0],[0,n.leftbottom]]},s1=function(n){return[[1,n.rightbottom],[1,0],[n.bottomright,0]]},a1=function(n){return[[n.topright,1],[1,1],[1,n.righttop]]},u1=function(n){return[[0,n.lefttop],[0,1],[n.topleft,1]]},l1=function(n){return[[n.bottomright,0],[n.bottomleft,0],[0,n.leftbottom],[0,n.lefttop]]},c1=function(n){return[[n.bottomright,0],[n.bottomleft,0],[1,n.righttop],[1,n.rightbottom]]},f1=function(n){return[[1,n.righttop],[1,n.rightbottom],[n.topleft,1],[n.topright,1]]},h1=function(n){return[[0,n.leftbottom],[0,n.lefttop],[n.topleft,1],[n.topright,1]]},qZ=function(n){return[[0,0],[0,n.leftbottom],[1,n.rightbottom],[1,0]]},HZ=function(n){return[[1,0],[n.bottomright,0],[n.topright,1],[1,1]]},VZ=function(n){return[[1,1],[1,n.righttop],[0,n.lefttop],[0,1]]},WZ=function(n){return[[n.bottomleft,0],[0,0],[0,1],[n.topleft,1]]},XZ=function(n){return[[1,n.righttop],[1,n.rightbottom],[0,n.leftbottom],[0,n.lefttop]]},YZ=function(n){return[[n.topleft,1],[n.topright,1],[n.bottomright,0],[n.bottomleft,0]]},$Z=function(){return[[0,0],[0,1],[1,1],[1,0]]},ZZ=function(n){return[[1,n.rightbottom],[1,0],[0,0],[0,1],[n.topleft,1]]},KZ=function(n){return[[n.topright,1],[1,1],[1,0],[0,0],[0,n.leftbottom]]},JZ=function(n){return[[1,0],[n.bottomright,0],[0,n.lefttop],[0,1],[1,1]]},jZ=function(n){return[[1,1],[1,n.righttop],[n.bottomleft,0],[0,0],[0,1]]},QZ=function(n){return[[1,n.righttop],[1,n.rightbottom],[0,n.lefttop],[0,1],[n.topleft,1]]},tK=function(n){return[[1,1],[1,n.righttop],[n.bottomright,0],[n.bottomleft,0],[n.topright,1]]},eK=function(n){return[[1,n.rightbottom],[1,0],[n.bottomright,0],[0,n.leftbottom],[0,n.lefttop]]},nK=function(n){return[[n.topright,1],[n.bottomleft,0],[0,0],[0,n.leftbottom],[n.topleft,1]]},rK=function(n){return[[n.bottomright,0],[n.bottomleft,0],[0,n.lefttop],[0,1],[n.topleft,1]]},iK=function(n){return[[1,1],[1,n.righttop],[0,n.leftbottom],[0,n.lefttop],[n.topright,1]]},oK=function(n){return[[1,n.rightbottom],[1,0],[n.bottomright,0],[n.topleft,1],[n.topright,1]]},sK=function(n){return[[1,n.righttop],[1,n.rightbottom],[n.bottomleft,0],[0,0],[0,n.leftbottom]]},aK=function(n){return[[1,n.rightbottom],[1,0],[0,0],[0,n.leftbottom],[n.topleft,1],[n.topright,1]]},uK=function(n){return[[1,1],[1,0],[n.bottomright,0],[0,n.leftbottom],[0,n.lefttop],[n.topright,1]]},lK=function(n){return[[1,1],[1,n.righttop],[n.bottomright,0],[n.bottomleft,0],[0,n.lefttop],[0,1]]},cK=function(n){return[[1,n.righttop],[1,n.rightbottom],[n.bottomleft,0],[0,0],[0,1],[n.topleft,1]]},fK=function(n){return[[1,1],[1,n.righttop],[n.bottomleft,0],[0,0],[0,n.leftbottom],[n.topright,1]]},hK=function(n){return[[1,n.rightbottom],[1,0],[n.bottomright,0],[0,n.lefttop],[0,1],[n.topleft,1]]},pK=function(n){return[[1,n.righttop],[1,n.rightbottom],[n.bottomright,0],[n.bottomleft,0],[0,n.leftbottom],[0,n.lefttop],[n.topleft,1],[n.topright,1]]},dK=function(n){return[[1,1],[1,n.righttop],[n.bottomleft,0],[0,0],[0,n.leftbottom],[n.topright,1]]},gK=function(n){return[[1,n.rightbottom],[1,0],[n.bottomright,0],[0,n.lefttop],[0,1],[n.topleft,1]]},mK=function(n){return[[1,1],[1,n.righttop],[n.bottomright,0],[n.bottomleft,0],[0,n.leftbottom],[0,n.lefttop],[n.topright,1]]},yK=function(n){return[[1,n.righttop],[1,n.rightbottom],[n.bottomleft,0],[0,0],[0,n.leftbottom],[n.topleft,1],[n.topright,1]]},vK=function(n){return[[1,n.righttop],[1,n.rightbottom],[n.bottomright,0],[n.bottomleft,0],[0,n.lefttop],[0,1],[n.topleft,1]]},_K=function(n){return[[1,n.rightbottom],[1,0],[n.bottomright,0],[0,n.leftbottom],[0,n.lefttop],[n.topleft,1],[n.topright,1]]},Bn=[],zn=[],Gn=[],kn=[],qn=[],Hn=[],Vn=[],Wn=[];kn[1]=qn[1]=18;kn[169]=qn[169]=18;Gn[4]=zn[4]=12;Gn[166]=zn[166]=12;Bn[16]=Wn[16]=4;Bn[154]=Wn[154]=4;Hn[64]=Vn[64]=22;Hn[106]=Vn[106]=22;Gn[2]=Hn[2]=17;kn[2]=qn[2]=18;Gn[168]=Hn[168]=17;kn[168]=qn[168]=18;Bn[8]=kn[8]=9;zn[8]=Gn[8]=12;Bn[162]=kn[162]=9;zn[162]=Gn[162]=12;Bn[32]=Wn[32]=4;zn[32]=Vn[32]=1;Bn[138]=Wn[138]=4;zn[138]=Vn[138]=1;qn[128]=Wn[128]=21;Hn[128]=Vn[128]=22;qn[42]=Wn[42]=21;Hn[42]=Vn[42]=22;zn[5]=qn[5]=14;zn[165]=qn[165]=14;Gn[20]=Wn[20]=6;Gn[150]=Wn[150]=6;Bn[80]=Hn[80]=11;Bn[90]=Hn[90]=11;kn[65]=Vn[65]=3;kn[105]=Vn[105]=3;Bn[160]=Hn[160]=11;zn[160]=qn[160]=14;Bn[10]=Hn[10]=11;zn[10]=qn[10]=14;Gn[130]=Wn[130]=6;kn[130]=Vn[130]=3;Gn[40]=Wn[40]=6;kn[40]=Vn[40]=3;zn[101]=Vn[101]=1;zn[69]=Vn[69]=1;qn[149]=Wn[149]=21;qn[21]=Wn[21]=21;Gn[86]=Hn[86]=17;Gn[84]=Hn[84]=17;Bn[89]=kn[89]=9;Bn[81]=kn[81]=9;Bn[96]=Vn[96]=0;zn[96]=Hn[96]=15;Bn[74]=Vn[74]=0;zn[74]=Hn[74]=15;Bn[24]=Gn[24]=8;kn[24]=Wn[24]=7;Bn[146]=Gn[146]=8;kn[146]=Wn[146]=7;zn[6]=Hn[6]=15;Gn[6]=qn[6]=16;zn[164]=Hn[164]=15;Gn[164]=qn[164]=16;kn[129]=Wn[129]=7;qn[129]=Vn[129]=20;kn[41]=Wn[41]=7;qn[41]=Vn[41]=20;Gn[66]=Vn[66]=2;kn[66]=Hn[66]=19;Gn[104]=Vn[104]=2;kn[104]=Hn[104]=19;Bn[144]=qn[144]=10;Hn[144]=Wn[144]=23;Bn[26]=qn[26]=10;Hn[26]=Wn[26]=23;zn[36]=Wn[36]=5;Gn[36]=Vn[36]=2;zn[134]=Wn[134]=5;Gn[134]=Vn[134]=2;Bn[9]=qn[9]=10;zn[9]=kn[9]=13;Bn[161]=qn[161]=10;zn[161]=kn[161]=13;zn[37]=Wn[37]=5;qn[37]=Vn[37]=20;zn[133]=Wn[133]=5;qn[133]=Vn[133]=20;Gn[148]=qn[148]=16;Hn[148]=Wn[148]=23;Gn[22]=qn[22]=16;Hn[22]=Wn[22]=23;Bn[82]=Gn[82]=8;kn[82]=Hn[82]=19;Bn[88]=Gn[88]=8;kn[88]=Hn[88]=19;Bn[73]=Vn[73]=0;zn[73]=kn[73]=13;Bn[97]=Vn[97]=0;zn[97]=kn[97]=13;Bn[145]=kn[145]=9;qn[145]=Wn[145]=21;Bn[25]=kn[25]=9;qn[25]=Wn[25]=21;zn[70]=Vn[70]=1;Gn[70]=Hn[70]=17;zn[100]=Vn[100]=1;Gn[100]=Hn[100]=17;Bn[34]=kn[34]=9;zn[34]=Gn[34]=12;qn[34]=Wn[34]=21;Hn[34]=Vn[34]=22;Bn[136]=Wn[136]=4;zn[136]=Vn[136]=1;Gn[136]=Hn[136]=17;kn[136]=qn[136]=18;Bn[35]=Wn[35]=4;zn[35]=Gn[35]=12;kn[35]=qn[35]=18;Hn[35]=Vn[35]=22;Bn[153]=Wn[153]=4;kn[153]=qn[153]=18;zn[102]=Gn[102]=12;Hn[102]=Vn[102]=22;Bn[155]=kn[155]=9;qn[155]=Wn[155]=23;zn[103]=Vn[103]=1;Gn[103]=Hn[103]=17;Bn[152]=Wn[152]=4;Gn[152]=Hn[152]=17;kn[152]=qn[152]=18;Bn[156]=Gn[156]=8;kn[156]=qn[156]=18;Hn[156]=Wn[156]=23;Bn[137]=Wn[137]=4;zn[137]=Vn[137]=1;kn[137]=qn[137]=18;Bn[139]=Wn[139]=4;zn[139]=kn[139]=13;qn[139]=Vn[139]=20;Bn[98]=kn[98]=9;zn[98]=Gn[98]=12;Hn[98]=Vn[98]=22;Bn[99]=Vn[99]=0;zn[99]=Gn[99]=12;kn[99]=Hn[99]=19;zn[38]=Gn[38]=12;qn[38]=Wn[38]=21;Hn[38]=Vn[38]=22;zn[39]=Wn[39]=5;Gn[39]=qn[39]=16;Hn[39]=Vn[39]=22;var re=[];re[1]=re[169]=o1;re[4]=re[166]=s1;re[16]=re[154]=a1;re[64]=re[106]=u1;re[168]=re[2]=l1;re[162]=re[8]=c1;re[138]=re[32]=f1;re[42]=re[128]=h1;re[5]=re[165]=qZ;re[20]=re[150]=HZ;re[80]=re[90]=VZ;re[65]=re[105]=WZ;re[160]=re[10]=XZ;re[130]=re[40]=YZ;re[85]=$Z;re[101]=re[69]=ZZ;re[149]=re[21]=KZ;re[86]=re[84]=JZ;re[89]=re[81]=jZ;re[96]=re[74]=QZ;re[24]=re[146]=tK;re[6]=re[164]=eK;re[129]=re[41]=nK;re[66]=re[104]=rK;re[144]=re[26]=iK;re[36]=re[134]=oK;re[9]=re[161]=sK;re[37]=re[133]=aK;re[148]=re[22]=uK;re[82]=re[88]=lK;re[73]=re[97]=cK;re[145]=re[25]=fK;re[70]=re[100]=hK;re[34]=function(n){return[h1(n),c1(n)]};re[35]=pK;re[136]=function(n){return[f1(n),l1(n)]};re[153]=function(n){return[a1(n),o1(n)]};re[102]=function(n){return[s1(n),u1(n)]};re[155]=dK;re[103]=gK;re[152]=function(n){return[a1(n),l1(n)]};re[156]=mK;re[137]=function(n){return[f1(n),o1(n)]};re[139]=yK;re[98]=function(n){return[c1(n),u1(n)]};re[99]=vK;re[38]=function(n){return[s1(n),h1(n)]};re[39]=_K;function EK(n){return(n>0)-(n<0)||+n}function ff(n,t,e){var o=t[0]-n[0],s=t[1]-n[1],u=e[0]-t[0],p=e[1]-t[1];return EK(o*p-u*s)}function VL(n,t){var e=n.geometry.coordinates[0].map(function(p){return p[0]}),o=n.geometry.coordinates[0].map(function(p){return p[1]}),s=t.geometry.coordinates[0].map(function(p){return p[0]}),u=t.geometry.coordinates[0].map(function(p){return p[1]});return Math.max.apply(null,e)===Math.max.apply(null,s)&&Math.max.apply(null,o)===Math.max.apply(null,u)&&Math.min.apply(null,e)===Math.min.apply(null,s)&&Math.min.apply(null,o)===Math.min.apply(null,u)}function p1(n,t){return t.geometry.coordinates[0].every(function(e){return ki(Pr(e),n)})}function WL(n,t){return n[0]===t[0]&&n[1]===t[1]}var wK=function(){function n(t){this.id=n.buildId(t),this.coordinates=t,this.innerEdges=[],this.outerEdges=[],this.outerEdgesSorted=!1}return n.buildId=function(t){return t.join(",")},n.prototype.removeInnerEdge=function(t){this.innerEdges=this.innerEdges.filter(function(e){return e.from.id!==t.from.id})},n.prototype.removeOuterEdge=function(t){this.outerEdges=this.outerEdges.filter(function(e){return e.to.id!==t.to.id})},n.prototype.addOuterEdge=function(t){this.outerEdges.push(t),this.outerEdgesSorted=!1},n.prototype.sortOuterEdges=function(){var t=this;this.outerEdgesSorted||(this.outerEdges.sort(function(e,o){var s=e.to,u=o.to;if(s.coordinates[0]-t.coordinates[0]>=0&&u.coordinates[0]-t.coordinates[0]<0)return 1;if(s.coordinates[0]-t.coordinates[0]<0&&u.coordinates[0]-t.coordinates[0]>=0)return-1;if(s.coordinates[0]-t.coordinates[0]===0&&u.coordinates[0]-t.coordinates[0]===0)return s.coordinates[1]-t.coordinates[1]>=0||u.coordinates[1]-t.coordinates[1]>=0?s.coordinates[1]-u.coordinates[1]:u.coordinates[1]-s.coordinates[1];var p=ff(t.coordinates,s.coordinates,u.coordinates);if(p<0)return 1;if(p>0)return-1;var f=Math.pow(s.coordinates[0]-t.coordinates[0],2)+Math.pow(s.coordinates[1]-t.coordinates[1],2),g=Math.pow(u.coordinates[0]-t.coordinates[0],2)+Math.pow(u.coordinates[1]-t.coordinates[1],2);return f-g}),this.outerEdgesSorted=!0)},n.prototype.getOuterEdges=function(){return this.sortOuterEdges(),this.outerEdges},n.prototype.getOuterEdge=function(t){return this.sortOuterEdges(),this.outerEdges[t]},n.prototype.addInnerEdge=function(t){this.innerEdges.push(t)},n}(),d1=wK;var SK=function(){function n(t,e){this.from=t,this.to=e,this.next=void 0,this.label=void 0,this.symetric=void 0,this.ring=void 0,this.from.addOuterEdge(this),this.to.addInnerEdge(this)}return n.prototype.getSymetric=function(){return this.symetric||(this.symetric=new n(this.to,this.from),this.symetric.symetric=this),this.symetric},n.prototype.deleteEdge=function(){this.from.removeOuterEdge(this),this.to.removeInnerEdge(this)},n.prototype.isEqual=function(t){return this.from.id===t.from.id&&this.to.id===t.to.id},n.prototype.toString=function(){return"Edge { "+this.from.id+" -> "+this.to.id+" }"},n.prototype.toLineString=function(){return Gi([this.from.coordinates,this.to.coordinates])},n.prototype.compareTo=function(t){return ff(t.from.coordinates,t.to.coordinates,this.to.coordinates)},n}(),XL=SK;var MK=function(){function n(){this.edges=[],this.polygon=void 0,this.envelope=void 0}return n.prototype.push=function(t){this.edges.push(t),this.polygon=this.envelope=void 0},n.prototype.get=function(t){return this.edges[t]},Object.defineProperty(n.prototype,"length",{get:function(){return this.edges.length},enumerable:!0,configurable:!0}),n.prototype.forEach=function(t){this.edges.forEach(t)},n.prototype.map=function(t){return this.edges.map(t)},n.prototype.some=function(t){return this.edges.some(t)},n.prototype.isValid=function(){return!0},n.prototype.isHole=function(){var t=this,e=this.edges.reduce(function(p,f,g){return f.from.coordinates[1]>t.edges[p].from.coordinates[1]&&(p=g),p},0),o=(e===0?this.length:e)-1,s=(e+1)%this.length,u=ff(this.edges[o].from.coordinates,this.edges[e].from.coordinates,this.edges[s].from.coordinates);return u===0?this.edges[o].from.coordinates[0]>this.edges[s].from.coordinates[0]:u>0},n.prototype.toMultiPoint=function(){return Wv(this.edges.map(function(t){return t.from.coordinates}))},n.prototype.toPolygon=function(){if(this.polygon)return this.polygon;var t=this.edges.map(function(e){return e.from.coordinates});return t.push(this.edges[0].from.coordinates),this.polygon=Dr([t])},n.prototype.getEnvelope=function(){return this.envelope?this.envelope:this.envelope=c_(this.toPolygon())},n.findEdgeRingContaining=function(t,e){var o=t.getEnvelope(),s,u;return e.forEach(function(p){var f=p.getEnvelope();if(u&&(s=u.getEnvelope()),!VL(f,o)&&p1(f,o)){for(var g=t.map(function(C){return C.from.coordinates}),m=void 0,v=function(C){p.some(function(R){return WL(C,R.from.coordinates)})||(m=C)},w=0,S=g;w<S.length;w++){var b=S[w];v(b)}m&&p.inside(Pr(m))&&(!u||p1(s,f))&&(u=p)}}),u},n.prototype.inside=function(t){return ki(t,this.toPolygon())},n}(),g1=MK;function bK(n){if(!n)throw new Error("No geojson passed");if(n.type!=="FeatureCollection"&&n.type!=="GeometryCollection"&&n.type!=="MultiLineString"&&n.type!=="LineString"&&n.type!=="Feature")throw new Error("Invalid input type '"+n.type+"'. Geojson must be FeatureCollection, GeometryCollection, LineString, MultiLineString or Feature")}var yct=function(){function n(){this.edges=[],this.nodes={}}return n.fromGeoJson=function(t){bK(t);var e=new n;return ms(t,function(o){Yv(o,"LineString","Graph::fromGeoJson"),rP(o,function(s,u){if(s){var p=e.getNode(s),f=e.getNode(u);e.addEdge(p,f)}return u})}),e},n.prototype.getNode=function(t){var e=d1.buildId(t),o=this.nodes[e];return o||(o=this.nodes[e]=new d1(t)),o},n.prototype.addEdge=function(t,e){var o=new XL(t,e),s=o.getSymetric();this.edges.push(o),this.edges.push(s)},n.prototype.deleteDangles=function(){var t=this;Object.keys(this.nodes).map(function(e){return t.nodes[e]}).forEach(function(e){return t._removeIfDangle(e)})},n.prototype._removeIfDangle=function(t){var e=this;if(t.innerEdges.length<=1){var o=t.getOuterEdges().map(function(s){return s.to});this.removeNode(t),o.forEach(function(s){return e._removeIfDangle(s)})}},n.prototype.deleteCutEdges=function(){var t=this;this._computeNextCWEdges(),this._findLabeledEdgeRings(),this.edges.forEach(function(e){e.label===e.symetric.label&&(t.removeEdge(e.symetric),t.removeEdge(e))})},n.prototype._computeNextCWEdges=function(t){var e=this;typeof t=="undefined"?Object.keys(this.nodes).forEach(function(o){return e._computeNextCWEdges(e.nodes[o])}):t.getOuterEdges().forEach(function(o,s){t.getOuterEdge((s===0?t.getOuterEdges().length:s)-1).symetric.next=o})},n.prototype._computeNextCCWEdges=function(t,e){for(var o=t.getOuterEdges(),s,u,p=o.length-1;p>=0;--p){var f=o[p],g=f.symetric,m=void 0,v=void 0;f.label===e&&(m=f),g.label===e&&(v=g),!(!m||!v)&&(v&&(u=v),m&&(u&&(u.next=m,u=void 0),s||(s=m)))}u&&(u.next=s)},n.prototype._findLabeledEdgeRings=function(){var t=[],e=0;return this.edges.forEach(function(o){if(!(o.label>=0)){t.push(o);var s=o;do s.label=e,s=s.next;while(!o.isEqual(s));e++}}),t},n.prototype.getEdgeRings=function(){var t=this;this._computeNextCWEdges(),this.edges.forEach(function(o){o.label=void 0}),this._findLabeledEdgeRings().forEach(function(o){t._findIntersectionNodes(o).forEach(function(s){t._computeNextCCWEdges(s,o.label)})});var e=[];return this.edges.forEach(function(o){o.ring||e.push(t._findEdgeRing(o))}),e},n.prototype._findIntersectionNodes=function(t){var e=[],o=t,s=function(){var u=0;o.from.getOuterEdges().forEach(function(p){p.label===t.label&&++u}),u>1&&e.push(o.from),o=o.next};do s();while(!t.isEqual(o));return e},n.prototype._findEdgeRing=function(t){var e=t,o=new g1;do o.push(e),e.ring=o,e=e.next;while(!t.isEqual(e));return o},n.prototype.removeNode=function(t){var e=this;t.getOuterEdges().forEach(function(o){return e.removeEdge(o)}),t.innerEdges.forEach(function(o){return e.removeEdge(o)}),delete this.nodes[t.id]},n.prototype.removeEdge=function(t){this.edges=this.edges.filter(function(e){return!e.isEqual(t)}),t.deleteEdge()},n}();var PK=tn(m1(),1);var IK=tn(m1(),1);var LK=tn(eN(),1);var zK=tn(fN(),1);function pN(n){for(var t=n,e=[];t.parent;)e.unshift(t),t=t.parent;return e}function kK(){return new dN(function(n){return n.f})}var x1={search:function(n,t,e,o){n.cleanDirty(),o=o||{};var s=o.heuristic||x1.heuristics.manhattan,u=o.closest||!1,p=kK(),f=t;for(t.h=s(t,e),p.push(t);p.size()>0;){var g=p.pop();if(g===e)return pN(g);g.closed=!0;for(var m=n.neighbors(g),v=0,w=m.length;v<w;++v){var S=m[v];if(!(S.closed||S.isWall())){var b=g.g+S.getCost(g),C=S.visited;(!C||b<S.g)&&(S.visited=!0,S.parent=g,S.h=S.h||s(S,e),S.g=b,S.f=S.g+S.h,n.markDirty(S),u&&(S.h<f.h||S.h===f.h&&S.g<f.g)&&(f=S),C?p.rescoreElement(S):p.push(S))}}}return u?pN(f):[]},heuristics:{manhattan:function(n,t){var e=Math.abs(t.x-n.x),o=Math.abs(t.y-n.y);return e+o},diagonal:function(n,t){var e=1,o=Math.sqrt(2),s=Math.abs(t.x-n.x),u=Math.abs(t.y-n.y);return e*(s+u)+(o-2*e)*Math.min(s,u)}},cleanNode:function(n){n.f=0,n.g=0,n.h=0,n.visited=!1,n.closed=!1,n.parent=null}};function Ih(n,t){t=t||{},this.nodes=[],this.diagonal=!!t.diagonal,this.grid=[];for(var e=0;e<n.length;e++){this.grid[e]=[];for(var o=0,s=n[e];o<s.length;o++){var u=new Bg(e,o,s[o]);this.grid[e][o]=u,this.nodes.push(u)}}this.init()}Ih.prototype.init=function(){this.dirtyNodes=[];for(var n=0;n<this.nodes.length;n++)x1.cleanNode(this.nodes[n])};Ih.prototype.cleanDirty=function(){for(var n=0;n<this.dirtyNodes.length;n++)x1.cleanNode(this.dirtyNodes[n]);this.dirtyNodes=[]};Ih.prototype.markDirty=function(n){this.dirtyNodes.push(n)};Ih.prototype.neighbors=function(n){var t=[],e=n.x,o=n.y,s=this.grid;return s[e-1]&&s[e-1][o]&&t.push(s[e-1][o]),s[e+1]&&s[e+1][o]&&t.push(s[e+1][o]),s[e]&&s[e][o-1]&&t.push(s[e][o-1]),s[e]&&s[e][o+1]&&t.push(s[e][o+1]),this.diagonal&&(s[e-1]&&s[e-1][o-1]&&t.push(s[e-1][o-1]),s[e+1]&&s[e+1][o-1]&&t.push(s[e+1][o-1]),s[e-1]&&s[e-1][o+1]&&t.push(s[e-1][o+1]),s[e+1]&&s[e+1][o+1]&&t.push(s[e+1][o+1])),t};Ih.prototype.toString=function(){for(var n=[],t=this.grid,e,o,s,u,p=0,f=t.length;p<f;p++){for(e=[],o=t[p],s=0,u=o.length;s<u;s++)e.push(o[s].weight);n.push(e.join(" "))}return n.join(`
3825
- `)};function Bg(n,t,e){this.x=n,this.y=t,this.weight=e}Bg.prototype.toString=function(){return"["+this.x+" "+this.y+"]"};Bg.prototype.getCost=function(n){return n&&n.x!==this.x&&n.y!==this.y?this.weight*1.41421:this.weight};Bg.prototype.isWall=function(){return this.weight===0};function dN(n){this.content=[],this.scoreFunction=n}dN.prototype={push:function(n){this.content.push(n),this.sinkDown(this.content.length-1)},pop:function(){var n=this.content[0],t=this.content.pop();return this.content.length>0&&(this.content[0]=t,this.bubbleUp(0)),n},remove:function(n){var t=this.content.indexOf(n),e=this.content.pop();t!==this.content.length-1&&(this.content[t]=e,this.scoreFunction(e)<this.scoreFunction(n)?this.sinkDown(t):this.bubbleUp(t))},size:function(){return this.content.length},rescoreElement:function(n){this.sinkDown(this.content.indexOf(n))},sinkDown:function(n){for(var t=this.content[n];n>0;){var e=(n+1>>1)-1,o=this.content[e];if(this.scoreFunction(t)<this.scoreFunction(o))this.content[e]=t,this.content[n]=o,n=e;else break}},bubbleUp:function(n){for(var t=this.content.length,e=this.content[n],o=this.scoreFunction(e);;){var s=n+1<<1,u=s-1,p=null,f;if(u<t){var g=this.content[u];f=this.scoreFunction(g),f<o&&(p=u)}if(s<t){var m=this.content[s],v=this.scoreFunction(m);v<(p===null?o:f)&&(p=s)}if(p!==null)this.content[n]=this.content[p],this.content[p]=e,n=p;else break}}};function E1(){this._=null}function pf(n){n.U=n.C=n.L=n.R=n.P=n.N=null}E1.prototype={constructor:E1,insert:function(n,t){var e,o,s;if(n){if(t.P=n,t.N=n.N,n.N&&(n.N.P=t),n.N=t,n.R){for(n=n.R;n.L;)n=n.L;n.L=t}else n.R=t;e=n}else this._?(n=gN(this._),t.P=null,t.N=n,n.P=n.L=t,e=n):(t.P=t.N=null,this._=t,e=null);for(t.L=t.R=null,t.U=e,t.C=!0,n=t;e&&e.C;)o=e.U,e===o.L?(s=o.R,s&&s.C?(e.C=s.C=!1,o.C=!0,n=o):(n===e.R&&(Rh(this,e),n=e,e=n.U),e.C=!1,o.C=!0,Lh(this,o))):(s=o.L,s&&s.C?(e.C=s.C=!1,o.C=!0,n=o):(n===e.L&&(Lh(this,e),n=e,e=n.U),e.C=!1,o.C=!0,Rh(this,o))),e=n.U;this._.C=!1},remove:function(n){n.N&&(n.N.P=n.P),n.P&&(n.P.N=n.N),n.N=n.P=null;var t=n.U,e,o=n.L,s=n.R,u,p;if(o?s?u=gN(s):u=o:u=s,t?t.L===n?t.L=u:t.R=u:this._=u,o&&s?(p=u.C,u.C=n.C,u.L=o,o.U=u,u!==s?(t=u.U,u.U=n.U,n=u.R,t.L=n,u.R=s,s.U=u):(u.U=t,t=u,n=u.R)):(p=n.C,n=u),n&&(n.U=t),!p){if(n&&n.C){n.C=!1;return}do{if(n===this._)break;if(n===t.L){if(e=t.R,e.C&&(e.C=!1,t.C=!0,Rh(this,t),e=t.R),e.L&&e.L.C||e.R&&e.R.C){(!e.R||!e.R.C)&&(e.L.C=!1,e.C=!0,Lh(this,e),e=t.R),e.C=t.C,t.C=e.R.C=!1,Rh(this,t),n=this._;break}}else if(e=t.L,e.C&&(e.C=!1,t.C=!0,Lh(this,t),e=t.L),e.L&&e.L.C||e.R&&e.R.C){(!e.L||!e.L.C)&&(e.R.C=!1,e.C=!0,Rh(this,e),e=t.L),e.C=t.C,t.C=e.L.C=!1,Lh(this,t),n=this._;break}e.C=!0,n=t,t=t.U}while(!n.C);n&&(n.C=!1)}}};function Rh(n,t){var e=t,o=t.R,s=e.U;s?s.L===e?s.L=o:s.R=o:n._=o,o.U=s,e.U=o,e.R=o.L,e.R&&(e.R.U=e),o.L=e}function Lh(n,t){var e=t,o=t.L,s=e.U;s?s.L===e?s.L=o:s.R=o:n._=o,o.U=s,e.U=o,e.L=o.R,e.L&&(e.L.U=e),o.R=e}function gN(n){for(;n.L;)n=n.L;return n}var w1=E1;function df(n,t,e,o){var s=[null,null],u=Hi.push(s)-1;return s.left=n,s.right=t,e&&Nh(s,n,t,e),o&&Nh(s,t,n,o),To[n.index].halfedges.push(u),To[t.index].halfedges.push(u),s}function gf(n,t,e){var o=[t,e];return o.left=n,o}function Nh(n,t,e,o){!n[0]&&!n[1]?(n[0]=o,n.left=t,n.right=e):n.left===e?n[1]=o:n[0]=o}function qK(n,t,e,o,s){var u=n[0],p=n[1],f=u[0],g=u[1],m=p[0],v=p[1],w=0,S=1,b=m-f,C=v-g,R;if(R=t-f,!(!b&&R>0)){if(R/=b,b<0){if(R<w)return;R<S&&(S=R)}else if(b>0){if(R>S)return;R>w&&(w=R)}if(R=o-f,!(!b&&R<0)){if(R/=b,b<0){if(R>S)return;R>w&&(w=R)}else if(b>0){if(R<w)return;R<S&&(S=R)}if(R=e-g,!(!C&&R>0)){if(R/=C,C<0){if(R<w)return;R<S&&(S=R)}else if(C>0){if(R>S)return;R>w&&(w=R)}if(R=s-g,!(!C&&R<0)){if(R/=C,C<0){if(R>S)return;R>w&&(w=R)}else if(C>0){if(R<w)return;R<S&&(S=R)}return!(w>0)&&!(S<1)||(w>0&&(n[0]=[f+w*b,g+w*C]),S<1&&(n[1]=[f+S*b,g+S*C])),!0}}}}}function HK(n,t,e,o,s){var u=n[1];if(u)return!0;var p=n[0],f=n.left,g=n.right,m=f[0],v=f[1],w=g[0],S=g[1],b=(m+w)/2,C=(v+S)/2,R,x;if(S===v){if(b<t||b>=o)return;if(m>w){if(!p)p=[b,e];else if(p[1]>=s)return;u=[b,s]}else{if(!p)p=[b,s];else if(p[1]<e)return;u=[b,e]}}else if(R=(m-w)/(S-v),x=C-R*b,R<-1||R>1)if(m>w){if(!p)p=[(e-x)/R,e];else if(p[1]>=s)return;u=[(s-x)/R,s]}else{if(!p)p=[(s-x)/R,s];else if(p[1]<e)return;u=[(e-x)/R,e]}else if(v<S){if(!p)p=[t,R*t+x];else if(p[0]>=o)return;u=[o,R*o+x]}else{if(!p)p=[o,R*o+x];else if(p[0]<t)return;u=[t,R*t+x]}return n[0]=p,n[1]=u,!0}function mN(n,t,e,o){for(var s=Hi.length,u;s--;)(!HK(u=Hi[s],n,t,e,o)||!qK(u,n,t,e,o)||!(Math.abs(u[0][0]-u[1][0])>Er||Math.abs(u[0][1]-u[1][1])>Er))&&delete Hi[s]}function yN(n){return To[n.index]={site:n,halfedges:[]}}function VK(n,t){var e=n.site,o=t.left,s=t.right;return e===s&&(s=o,o=e),s?Math.atan2(s[1]-o[1],s[0]-o[0]):(e===o?(o=t[1],s=t[0]):(o=t[0],s=t[1]),Math.atan2(o[0]-s[0],s[1]-o[1]))}function S1(n,t){return t[+(t.left!==n.site)]}function WK(n,t){return t[+(t.left===n.site)]}function vN(){for(var n=0,t=To.length,e,o,s,u;n<t;++n)if((e=To[n])&&(u=(o=e.halfedges).length)){var p=new Array(u),f=new Array(u);for(s=0;s<u;++s)p[s]=s,f[s]=VK(e,Hi[o[s]]);for(p.sort(function(g,m){return f[m]-f[g]}),s=0;s<u;++s)f[s]=o[p[s]];for(s=0;s<u;++s)o[s]=f[s]}}function _N(n,t,e,o){var s=To.length,u,p,f,g,m,v,w,S,b,C,R,x,E=!0;for(u=0;u<s;++u)if(p=To[u]){for(f=p.site,m=p.halfedges,g=m.length;g--;)Hi[m[g]]||m.splice(g,1);for(g=0,v=m.length;g<v;)C=WK(p,Hi[m[g]]),R=C[0],x=C[1],w=S1(p,Hi[m[++g%v]]),S=w[0],b=w[1],(Math.abs(R-S)>Er||Math.abs(x-b)>Er)&&(m.splice(g,0,Hi.push(gf(f,C,Math.abs(R-n)<Er&&o-x>Er?[n,Math.abs(S-n)<Er?b:o]:Math.abs(x-o)<Er&&e-R>Er?[Math.abs(b-o)<Er?S:e,o]:Math.abs(R-e)<Er&&x-t>Er?[e,Math.abs(S-e)<Er?b:t]:Math.abs(x-t)<Er&&R-n>Er?[Math.abs(b-t)<Er?S:n,t]:null))-1),++v);v&&(E=!1)}if(E){var I,A,F,V=1/0;for(u=0,E=null;u<s;++u)(p=To[u])&&(f=p.site,I=f[0]-n,A=f[1]-t,F=I*I+A*A,F<V&&(V=F,E=p));if(E){var X=[n,t],q=[n,o],D=[e,o],xt=[e,t];E.halfedges.push(Hi.push(gf(f=E.site,X,q))-1,Hi.push(gf(f,q,D))-1,Hi.push(gf(f,D,xt))-1,Hi.push(gf(f,xt,X))-1)}}for(u=0;u<s;++u)(p=To[u])&&(p.halfedges.length||delete To[u])}var xN=[],zg;function XK(){pf(this),this.x=this.y=this.arc=this.site=this.cy=null}function Wl(n){var t=n.P,e=n.N;if(!(!t||!e)){var o=t.site,s=n.site,u=e.site;if(o!==u){var p=s[0],f=s[1],g=o[0]-p,m=o[1]-f,v=u[0]-p,w=u[1]-f,S=2*(g*w-m*v);if(!(S>=-EN)){var b=g*g+m*m,C=v*v+w*w,R=(w*b-m*C)/S,x=(g*C-v*b)/S,E=xN.pop()||new XK;E.arc=n,E.site=s,E.x=R+p,E.y=(E.cy=x+f)+Math.sqrt(R*R+x*x),n.circle=E;for(var I=null,A=mf._;A;)if(E.y<A.y||E.y===A.y&&E.x<=A.x)if(A.L)A=A.L;else{I=A.P;break}else if(A.R)A=A.R;else{I=A;break}mf.insert(I,E),I||(zg=E)}}}}function Xl(n){var t=n.circle;t&&(t.P||(zg=t.N),mf.remove(t),xN.push(t),pf(t),n.circle=null)}var SN=[];function YK(){pf(this),this.edge=this.site=this.circle=null}function wN(n){var t=SN.pop()||new YK;return t.site=n,t}function M1(n){Xl(n),Yl.remove(n),SN.push(n),pf(n)}function MN(n){var t=n.circle,e=t.x,o=t.cy,s=[e,o],u=n.P,p=n.N,f=[n];M1(n);for(var g=u;g.circle&&Math.abs(e-g.circle.x)<Er&&Math.abs(o-g.circle.cy)<Er;)u=g.P,f.unshift(g),M1(g),g=u;f.unshift(g),Xl(g);for(var m=p;m.circle&&Math.abs(e-m.circle.x)<Er&&Math.abs(o-m.circle.cy)<Er;)p=m.N,f.push(m),M1(m),m=p;f.push(m),Xl(m);var v=f.length,w;for(w=1;w<v;++w)m=f[w],g=f[w-1],Nh(m.edge,g.site,m.site,s);g=f[0],m=f[v-1],m.edge=df(g.site,m.site,null,s),Wl(g),Wl(m)}function bN(n){for(var t=n[0],e=n[1],o,s,u,p,f=Yl._;f;)if(u=AN(f,e)-t,u>Er)f=f.L;else if(p=t-$K(f,e),p>Er){if(!f.R){o=f;break}f=f.R}else{u>-Er?(o=f.P,s=f):p>-Er?(o=f,s=f.N):o=s=f;break}yN(n);var g=wN(n);if(Yl.insert(o,g),!(!o&&!s)){if(o===s){Xl(o),s=wN(o.site),Yl.insert(g,s),g.edge=s.edge=df(o.site,g.site),Wl(o),Wl(s);return}if(!s){g.edge=df(o.site,g.site);return}Xl(o),Xl(s);var m=o.site,v=m[0],w=m[1],S=n[0]-v,b=n[1]-w,C=s.site,R=C[0]-v,x=C[1]-w,E=2*(S*x-b*R),I=S*S+b*b,A=R*R+x*x,F=[(x*I-b*A)/E+v,(S*A-R*I)/E+w];Nh(s.edge,m,C,F),g.edge=df(m,n,null,F),s.edge=df(n,C,null,F),Wl(o),Wl(s)}}function AN(n,t){var e=n.site,o=e[0],s=e[1],u=s-t;if(!u)return o;var p=n.P;if(!p)return-1/0;e=p.site;var f=e[0],g=e[1],m=g-t;if(!m)return f;var v=f-o,w=1/u-1/m,S=v/m;return w?(-S+Math.sqrt(S*S-2*w*(v*v/(-2*m)-g+m/2+s-u/2)))/w+o:(o+f)/2}function $K(n,t){var e=n.N;if(e)return AN(e,t);var o=n.site;return o[1]===t?o[0]:1/0}var Er=1e-6,EN=1e-12,Yl,To,mf,Hi;function ZK(n,t,e){return(n[0]-e[0])*(t[1]-n[1])-(n[0]-t[0])*(e[1]-n[1])}function KK(n,t){return t[1]-n[1]||t[0]-n[0]}function Gg(n,t){var e=n.sort(KK).pop(),o,s,u;for(Hi=[],To=new Array(n.length),Yl=new w1,mf=new w1;;)if(u=zg,e&&(!u||e[1]<u.y||e[1]===u.y&&e[0]<u.x))(e[0]!==o||e[1]!==s)&&(bN(e),o=e[0],s=e[1]),e=n.pop();else if(u)MN(u.arc);else break;if(vN(),t){var p=+t[0][0],f=+t[0][1],g=+t[1][0],m=+t[1][1];mN(p,f,g,m),_N(p,f,g,m)}this.edges=Hi,this.cells=To,Yl=mf=Hi=To=null}Gg.prototype={constructor:Gg,polygons:function(){var n=this.edges;return this.cells.map(function(t){var e=t.halfedges.map(function(o){return S1(t,n[o])});return e.data=t.site.data,e})},triangles:function(){var n=[],t=this.edges;return this.cells.forEach(function(e,o){if(f=(u=e.halfedges).length)for(var s=e.site,u,p=-1,f,g,m=t[u[f-1]],v=m.left===s?m.right:m.left;++p<f;)g=v,m=t[u[p]],v=m.left===s?m.right:m.left,g&&v&&o<g.index&&o<v.index&&ZK(s,g,v)<0&&n.push([s.data,g.data,v.data])}),n},links:function(){return this.edges.filter(function(n){return n.right}).map(function(n){return{source:n.left.data,target:n.right.data}})},find:function(n,t,e){for(var o=this,s,u=o._found||0,p=o.cells.length,f;!(f=o.cells[u]);)if(++u>=p)return null;var g=n-f.site[0],m=t-f.site[1],v=g*g+m*m;do f=o.cells[s=u],u=null,f.halfedges.forEach(function(w){var S=o.edges[w],b=S.left;if(!((b===f.site||!b)&&!(b=S.right))){var C=n-b[0],R=t-b[1],x=C*C+R*R;x<v&&(v=x,u=b.index)}});while(u!==null);return o._found=s,e==null||v<=e*e?f.site:null}};var iJ=tn(yf(),1);var z1=tn(IN(),1);function Zo(){return new Hg}function Hg(){this.reset()}Hg.prototype={constructor:Hg,reset:function(){this.s=this.t=0},add:function(n){RN(qg,n,this.t),RN(this,qg.s,this.s),this.s?this.t+=qg.t:this.s=qg.t},valueOf:function(){return this.s}};var qg=new Hg;function RN(n,t,e){var o=n.s=t+e,s=o-t,u=o-s;n.t=t-u+(e-s)}var er=1e-6;var gr=Math.PI,Mi=gr/2,Vg=gr/4,Na=gr*2,$l=180/gr,Ko=gr/180,Zr=Math.abs,sa=Math.atan,Jo=Math.atan2,Xn=Math.cos;var Wg=Math.exp;var Oh=Math.log;var un=Math.sin;var ro=Math.sqrt,Dh=Math.tan;function T1(n){return n>1?0:n<-1?gr:Math.acos(n)}function Co(n){return n>1?Mi:n<-1?-Mi:Math.asin(n)}function aa(){}var oJ=Zo(),fpt=Zo();function Zl(n){var t=n[0],e=n[1],o=Xn(e);return[o*Xn(t),o*un(t),un(e)]}function Fh(n,t){return[n[1]*t[2]-n[2]*t[1],n[2]*t[0]-n[0]*t[2],n[0]*t[1]-n[1]*t[0]]}function Uh(n){var t=ro(n[0]*n[0]+n[1]*n[1]+n[2]*n[2]);n[0]/=t,n[1]/=t,n[2]/=t}var Ept=Zo();function NN(n,t){return[n>gr?n-Na:n<-gr?n+Na:n,t]}NN.invert=NN;function C1(){var n=[],t;return{point:function(e,o){t.push([e,o])},lineStart:function(){n.push(t=[])},lineEnd:aa,rejoin:function(){n.length>1&&n.push(n.pop().concat(n.shift()))},result:function(){var e=n;return n=[],t=null,e}}}function P1(n,t){return Zr(n[0]-t[0])<er&&Zr(n[1]-t[1])<er}function Xg(n,t,e,o){this.x=n,this.z=t,this.o=e,this.e=o,this.v=!1,this.n=this.p=null}function I1(n,t,e,o,s){var u=[],p=[],f,g;if(n.forEach(function(C){if(!((R=C.length-1)<=0)){var R,x=C[0],E=C[R],I;if(P1(x,E)){for(s.lineStart(),f=0;f<R;++f)s.point((x=C[f])[0],x[1]);s.lineEnd();return}u.push(I=new Xg(x,C,null,!0)),p.push(I.o=new Xg(x,null,I,!1)),u.push(I=new Xg(E,C,null,!1)),p.push(I.o=new Xg(E,null,I,!0))}}),!!u.length){for(p.sort(t),ON(u),ON(p),f=0,g=p.length;f<g;++f)p[f].e=e=!e;for(var m=u[0],v,w;;){for(var S=m,b=!0;S.v;)if((S=S.n)===m)return;v=S.z,s.lineStart();do{if(S.v=S.o.v=!0,S.e){if(b)for(f=0,g=v.length;f<g;++f)s.point((w=v[f])[0],w[1]);else o(S.x,S.n.x,1,s);S=S.n}else{if(b)for(v=S.p.z,f=v.length-1;f>=0;--f)s.point((w=v[f])[0],w[1]);else o(S.x,S.p.x,-1,s);S=S.p}S=S.o,v=S.z,b=!b}while(!S.v);s.lineEnd()}}}function ON(n){if(t=n.length){for(var t,e=0,o=n[0],s;++e<t;)o.n=s=n[e],s.p=o,o=s;o.n=s=n[0],s.p=o}}function sl(n,t){return n<t?-1:n>t?1:n>=t?0:NaN}function R1(n){return n.length===1&&(n=uJ(n)),{left:function(t,e,o,s){for(o==null&&(o=0),s==null&&(s=t.length);o<s;){var u=o+s>>>1;n(t[u],e)<0?o=u+1:s=u}return o},right:function(t,e,o,s){for(o==null&&(o=0),s==null&&(s=t.length);o<s;){var u=o+s>>>1;n(t[u],e)>0?s=u:o=u+1}return o}}}function uJ(n){return function(t,e){return sl(n(t),e)}}var DN=R1(sl),lJ=DN.right,cJ=DN.left;var FN=Array.prototype,hJ=FN.slice,pJ=FN.map;var pdt=Math.sqrt(50),ddt=Math.sqrt(10),gdt=Math.sqrt(2);function $g(n){for(var t=n.length,e,o=-1,s=0,u,p;++o<t;)s+=n[o].length;for(u=new Array(s);--t>=0;)for(p=n[t],e=p.length;--e>=0;)u[--s]=p[e];return u}var EJ=1e9,jgt=-EJ;var L1=Zo();function N1(n,t){var e=t[0],o=t[1],s=[un(e),-Xn(e),0],u=0,p=0;L1.reset();for(var f=0,g=n.length;f<g;++f)if(v=(m=n[f]).length)for(var m,v,w=m[v-1],S=w[0],b=w[1]/2+Vg,C=un(b),R=Xn(b),x=0;x<v;++x,S=I,C=F,R=V,w=E){var E=m[x],I=E[0],A=E[1]/2+Vg,F=un(A),V=Xn(A),X=I-S,q=X>=0?1:-1,D=q*X,xt=D>gr,B=C*F;if(L1.add(Jo(B*q*un(D),R*V+B*Xn(D))),u+=xt?X+q*Na:X,xt^S>=e^I>=e){var j=Fh(Zl(w),Zl(E));Uh(j);var K=Fh(s,j);Uh(K);var Dt=(xt^X>=0?-1:1)*Co(K[2]);(o>Dt||o===Dt&&(j[0]||j[1]))&&(p+=xt^X>=0?1:-1)}}return(u<-er||u<er&&L1<-er)^p&1}var umt=Zo();var Tmt=Zo(),Cmt=Zo();var MJ=1/0;var Rmt=-MJ;function O1(n){this._context=n}O1.prototype={_radius:4.5,pointRadius:function(n){return this._radius=n,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._context.closePath(),this._point=NaN},point:function(n,t){switch(this._point){case 0:{this._context.moveTo(n,t),this._point=1;break}case 1:{this._context.lineTo(n,t);break}default:{this._context.moveTo(n+this._radius,t),this._context.arc(n,t,this._radius,0,Na);break}}},result:aa};var kmt=Zo();function D1(){this._string=[]}D1.prototype={_radius:4.5,_circle:zN(4.5),pointRadius:function(n){return(n=+n)!==this._radius&&(this._radius=n,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._string.push("Z"),this._point=NaN},point:function(n,t){switch(this._point){case 0:{this._string.push("M",n,",",t),this._point=1;break}case 1:{this._string.push("L",n,",",t);break}default:{this._circle==null&&(this._circle=zN(this._radius)),this._string.push("M",n,",",t,this._circle);break}}},result:function(){if(this._string.length){var n=this._string.join("");return this._string=[],n}else return null}};function zN(n){return"m0,"+n+"a"+n+","+n+" 0 1,1 0,"+-2*n+"a"+n+","+n+" 0 1,1 0,"+2*n+"z"}function F1(n,t,e,o){return function(s,u){var p=t(u),f=s.invert(o[0],o[1]),g=C1(),m=t(g),v=!1,w,S,b,C={point:R,lineStart:E,lineEnd:I,polygonStart:function(){C.point=A,C.lineStart=F,C.lineEnd=V,S=[],w=[]},polygonEnd:function(){C.point=R,C.lineStart=E,C.lineEnd=I,S=$g(S);var X=N1(w,f);S.length?(v||(u.polygonStart(),v=!0),I1(S,TJ,X,e,u)):X&&(v||(u.polygonStart(),v=!0),u.lineStart(),e(null,null,1,u),u.lineEnd()),v&&(u.polygonEnd(),v=!1),S=w=null},sphere:function(){u.polygonStart(),u.lineStart(),e(null,null,1,u),u.lineEnd(),u.polygonEnd()}};function R(X,q){var D=s(X,q);n(X=D[0],q=D[1])&&u.point(X,q)}function x(X,q){var D=s(X,q);p.point(D[0],D[1])}function E(){C.point=x,p.lineStart()}function I(){C.point=R,p.lineEnd()}function A(X,q){b.push([X,q]);var D=s(X,q);m.point(D[0],D[1])}function F(){m.lineStart(),b=[]}function V(){A(b[0][0],b[0][1]),m.lineEnd();var X=m.clean(),q=g.result(),D,xt=q.length,B,j,K;if(b.pop(),w.push(b),b=null,!!xt){if(X&1){if(j=q[0],(B=j.length-1)>0){for(v||(u.polygonStart(),v=!0),u.lineStart(),D=0;D<B;++D)u.point((K=j[D])[0],K[1]);u.lineEnd()}return}xt>1&&X&2&&q.push(q.pop().concat(q.shift())),S.push(q.filter(AJ))}}return C}}function AJ(n){return n.length>1}function TJ(n,t){return((n=n.x)[0]<0?n[1]-Mi-er:Mi-n[1])-((t=t.x)[0]<0?t[1]-Mi-er:Mi-t[1])}var CJ=F1(function(){return!0},PJ,RJ,[-gr,-Mi]);function PJ(n){var t=NaN,e=NaN,o=NaN,s;return{lineStart:function(){n.lineStart(),s=1},point:function(u,p){var f=u>0?gr:-gr,g=Zr(u-t);Zr(g-gr)<er?(n.point(t,e=(e+p)/2>0?Mi:-Mi),n.point(o,e),n.lineEnd(),n.lineStart(),n.point(f,e),n.point(u,e),s=0):o!==f&&g>=gr&&(Zr(t-o)<er&&(t-=o*er),Zr(u-f)<er&&(u-=f*er),e=IJ(t,e,u,p),n.point(o,e),n.lineEnd(),n.lineStart(),n.point(f,e),s=0),n.point(t=u,e=p),o=f},lineEnd:function(){n.lineEnd(),t=e=NaN},clean:function(){return 2-s}}}function IJ(n,t,e,o){var s,u,p=un(n-e);return Zr(p)>er?sa((un(t)*(u=Xn(o))*un(e)-un(o)*(s=Xn(t))*un(n))/(s*u*p)):(t+o)/2}function RJ(n,t,e,o){var s;if(n==null)s=e*Mi,o.point(-gr,s),o.point(0,s),o.point(gr,s),o.point(gr,0),o.point(gr,-s),o.point(0,-s),o.point(-gr,-s),o.point(-gr,0),o.point(-gr,s);else if(Zr(n[0]-t[0])>er){var u=n[0]<t[0]?gr:-gr;s=e*u/2,o.point(-u,s),o.point(0,s),o.point(u,s)}else o.point(t[0],t[1])}function Zg(n){return function(t){var e=new U1;for(var o in n)e[o]=n[o];return e.stream=t,e}}function U1(){}U1.prototype={constructor:U1,point:function(n,t){this.stream.point(n,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var C0t=Xn(30*Ko);var q0t=Zg({point:function(n,t){this.stream.point(n*Ko,t*Ko)}});function Kg(n){return function(t,e){var o=Xn(t),s=Xn(e),u=n(o*s);return[u*s*un(t),u*un(e)]}}function Oa(n){return function(t,e){var o=ro(t*t+e*e),s=n(o),u=un(s),p=Xn(s);return[Jo(t*u,o*p),Co(o&&e*u/o)]}}var XN=Kg(function(n){return ro(2/(1+n))});XN.invert=Oa(function(n){return 2*Co(n/2)});var YN=Kg(function(n){return(n=T1(n))&&n/un(n)});YN.invert=Oa(function(n){return n});function B1(n,t){return[n,Oh(Dh((Mi+t)/2))]}B1.invert=function(n,t){return[n,2*sa(Wg(t))-Mi]};function Jg(n,t){return[n,t]}Jg.invert=Jg;function $N(n,t){var e=Xn(t),o=Xn(n)*e;return[e*un(n)/o,un(t)/o]}$N.invert=Oa(sa);function ZN(n,t){var e=t*t,o=e*e;return[n*(.8707-.131979*e+o*(-.013791+o*(.003971*e-.001529*o))),t*(1.007226+e*(.015085+o*(-.044475+.028874*e-.005916*o)))]}ZN.invert=function(n,t){var e=t,o=25,s;do{var u=e*e,p=u*u;e-=s=(e*(1.007226+u*(.015085+p*(-.044475+.028874*u-.005916*p)))-t)/(1.007226+u*(.015085*3+p*(-.044475*7+.028874*9*u-.005916*11*p)))}while(Zr(s)>er&&--o>0);return[n/(.8707+(u=e*e)*(-.131979+u*(-.013791+u*u*u*(.003971-.001529*u)))),e]};function KN(n,t){return[Xn(t)*un(n),un(t)]}KN.invert=Oa(Co);function JN(n,t){var e=Xn(t),o=1+Xn(n)*e;return[e*un(n)/o,un(t)/o]}JN.invert=Oa(function(n){return 2*sa(n)});function jN(n,t){return[Oh(Dh((Mi+t)/2)),-n]}jN.invert=function(n,t){return[-t,2*sa(Wg(n))-Mi]};var UJ=tn(yf(),1);var BJ=tn(yf(),1);var GJ=tn(yf(),1);var kJ=tn(yf(),1);function _f(n,t){return Math.sqrt((t[0]-n[0])**2+(t[1]-n[1])**2)}function t2(n){let t=0;for(let e=0;e<n.length-1;e++)t+=_f(n[e],n[e+1]);return t}var Ef=tn(e2(),1);var $e="___",KJ=1e4;function gu(n){let t=new Map;return n.forEach((e,o)=>{t.set(o,new Map(e))}),t}var jg=class{setLiftPriority(t){this.lift_priority=t}isFacilityByType(t){return["facility","escalator","straightLadder","staircase","ramp","connectionPoint"].includes(t)}initFacilities(t){this.facilities=t.map(e=>{let o=[];try{o=JSON.parse(e.entry_end_floor)}catch(u){o=[]}let s=[];try{s=JSON.parse(e.entry_start_floor)}catch(u){s=[]}return eu({},e,{entry_start_floor:s,entry_end_floor:o})})}getParkingSpaceInfo(t,e){let o=""+t+$e+e;var s;return(s=this.parkingMap.get(o))!=null?s:null}getNodeInfo(t,e){let o=""+t+$e+e,s=this.nodeMap.get(o);if(!(s!=null&&s.length))return null;let u=this.pointMap.get(s[0]);return u!=null?u:null}initRoute(t,e){this.clear(),this.roadInfo=t,this.initFacilities(e);let o=new Date,s=o.getHours()*60+o.getMinutes();t.length&&(t.forEach(u=>{let p=(u.points||[]).filter(f=>!(0,Ef.isNil)(f.passWeight)&&f.passWeight!==1&&!(0,Ef.isNil)(f.coverageArea)&&f.coverageArea!==0);this.weightPointMap.set(u.floor,p),(u.points||[]).filter(f=>f.openStatus!==!1).filter(f=>{if(!f.startTime||!f.endTime)return!0;let[g,m]=f.startTime.split(":").map(C=>+C),[v,w]=f.endTime.split(":").map(C=>+C),S=g*60+m,b=v*60+w;return s>=S&&s<=b}).forEach(f=>{f.floor=u.floor;let g=""+u.floor+$e+f.id,m=""+u.floor+$e+f.nodeId,v=this.nodeMap.get(m)||[];if(v.push(""+u.floor+$e+(f.relatedId||f.id)),this.nodeMap.set(""+u.floor+$e+f.nodeId,v),this.pointMap.set(g,f),this.isFacilityByType(f.type)){let w=this.facilities.find(S=>S.id===+f.targetId);if(w){switch(w.entry_infra_type){case"straightLadder":if(w.entry_end_floor.find(x=>x.floor===u.floor)&&w.entry_start_floor.find(x=>x.floor===u.floor)){let x=this.straightLadderMap.get(f.targetId)||[];x.push(eu({},f)),this.straightLadderMap.set(f.targetId,x)}break;case"staircase":if(w.entry_end_floor.find(x=>x.floor===u.floor)&&w.entry_start_floor.find(x=>x.floor===u.floor)){let x=this.staircaseMap.get(f.targetId)||[];x.push(eu({},f)),this.staircaseMap.set(f.targetId,x)}break;case"escalator":let b=this.escalatorMap.get(f.targetId)||[];if(w.entry_start_floor.find(x=>x.floor===u.floor)){let x=b.find(E=>{var I;return((I=E.end)==null?void 0:I.floor)!==u.floor&&!E.start});x?x.start=f:b.push({start:f})}if(w.entry_end_floor.find(x=>x.floor===u.floor)){let x=b.find(E=>{var I;return((I=E.start)==null?void 0:I.floor)!==u.floor&&!E.end});x?x.end=f:b.push({end:f})}this.escalatorMap.set(f.targetId,b);break;case"ramp":let C=this.rampMap.get(f.targetId)||[];if(w.entry_start_floor.find(x=>x.floor===u.floor)){let x=C.find(E=>{var I;return((I=E.end)==null?void 0:I.floor)!==u.floor&&!E.start});x?x.start=f:C.push({start:f})}if(w.entry_end_floor.find(x=>x.floor===u.floor)){let x=C.find(E=>{var I;return((I=E.start)==null?void 0:I.floor)!==u.floor&&!E.end});x?x.end=f:C.push({end:f})}this.rampMap.set(f.targetId,C);break;case"connectionPoint":let R=this.connectionPointMap.get(f.targetId)||[];if(w.entry_start_floor.find(x=>x.floor===u.floor)){let x=R.find(E=>{var I;return((I=E.end)==null?void 0:I.floor)!==u.floor&&!E.start});x?x.start=f:R.push({start:f})}if(w.entry_end_floor.find(x=>x.floor===u.floor)){let x=R.find(E=>{var I;return((I=E.start)==null?void 0:I.floor)!==u.floor&&!E.end});x?x.end=f:R.push({end:f})}this.connectionPointMap.set(f.targetId,R);break}let S=this.facilityMap.get(f.targetId)||[];S.push(eu({},f)),this.facilityMap.set(f.targetId,S)}}f.type==="parkingSpace"&&f.name.split(/[,,]/).forEach(S=>{this.parkingMap.set(""+u.floor+$e+S,f)})}),(u.lines||[]).filter(f=>f.to!==f.from).forEach(f=>{let g=""+u.floor+$e+f.from,m=""+u.floor+$e+f.to,v=this.pointMap.get(g),w=this.pointMap.get(m);if(!v||!w)return;let S=v.cds,b=w.cds,C=_f(S,b);if(!v.permission&&!w.permission){switch(f.direction){case"single-people":this.addLineItem(g,m,C);break;case"back-people":this.addLineItem(m,g,C);break;default:this.addLineItem(g,m,C),this.addLineItem(m,g,C)}switch(f.direction){case"double":this.addLineItem(g,m,C,this.forwardLineMap),this.addLineItem(m,g,C,this.forwardLineMap);break;case"single":this.addLineItem(g,m,C,this.forwardLineMap);break;case"back":this.addLineItem(m,g,C,this.forwardLineMap);break}(v.type==="parkingSpace"||w.type==="parkingSpace")&&f.direction==="noDir"&&(this.addLineItem(g,m,C,this.forwardLineMap),this.addLineItem(m,g,C,this.forwardLineMap))}else v.permission&&this.setPermissionLine(g,m,v.permission,C,"",f.direction),w.permission&&w.permission!==v.permission&&this.setPermissionLine(g,m,w.permission,C,"",f.direction)})}),this.addPermissionFacility(),this.initBaseRoute(),this.initEscalatorRoute(),this.initStraightLadderRoute(),this.initForwardRoute())}getPermissionMap(t){return this["permission_"+t]||(this["permission_"+t]=new Set),this["permission_"+t]}setPermissionLine(t,e,o,s,u,p){this.getPermissionMap(o).add({fromKey:t,toKey:e,distance:s,type:u,direction:p})}addPermissionFacility(){this.straightLadderMap.forEach((t,e)=>{if(t.length<2){this.straightLadderMap.delete(e);return}for(let o=0;o<t.length;o++){let s=""+t[o].floor+$e+t[o].id,u=this.pointMap.get(s);if(u){for(let p=0;p<t.length;p++)if(o!==p){let f=""+t[p].floor+$e+t[p].id,g=this.pointMap.get(f);if(!g)continue;u.permission&&this.setPermissionLine(s,f,u.permission,1,"straightLadder"),g.permission&&g.permission!==u.permission&&this.setPermissionLine(s,f,g.permission,1,"straightLadder")}}}}),this.staircaseMap.forEach((t,e)=>{if(t.length<2){this.staircaseMap.delete(e);return}for(let o=0;o<t.length;o++){let s=""+t[o].floor+$e+t[o].id,u=this.pointMap.get(s);if(u){for(let p=0;p<t.length;p++)if(o!==p){let f=""+t[p].floor+$e+t[p].id,g=this.pointMap.get(f);if(!g)continue;u.permission&&this.setPermissionLine(s,f,u.permission,1,"staircase"),g.permission&&g.permission!==u.permission&&this.setPermissionLine(s,f,g.permission,1,"staircase")}}}}),this.escalatorMap.forEach((t,e)=>{t.forEach(o=>{if(o.start&&o.end){let s=""+o.start.floor+$e+o.start.id,u=""+o.end.floor+$e+o.end.id,p=this.pointMap.get(s),f=this.pointMap.get(u);p&&f&&(p.permission&&this.setPermissionLine(s,u,p.permission,1,"escalator"),f.permission&&f.permission!==p.permission&&this.setPermissionLine(s,u,f.permission,1,"escalator"))}})}),this.rampMap.forEach((t,e)=>{t.forEach(o=>{if(o.start&&o.end){let s=""+o.start.floor+$e+o.start.id,u=""+o.end.floor+$e+o.end.id,p=this.pointMap.get(s),f=this.pointMap.get(u);p&&f&&(p.permission&&this.setPermissionLine(s,u,p.permission,10,"ramp"),f.permission&&f.permission!==p.permission&&this.setPermissionLine(s,u,f.permission,10,"ramp"))}})}),this.connectionPointMap.forEach((t,e)=>{t.forEach(o=>{if(o.start&&o.end){let s=""+o.start.floor+$e+o.start.id,u=""+o.end.floor+$e+o.end.id,p=this.pointMap.get(s),f=this.pointMap.get(u);p&&f&&(p.permission&&this.setPermissionLine(s,u,p.permission,1,"connectionPoint"),f.permission&&f.permission!==p.permission&&this.setPermissionLine(s,u,f.permission,1,"connectionPoint"))}})})}addPermissionLineToMap(t,e,o,s){this.getPermissionMap(t).forEach(p=>{if(e.includes(p.type))if(p.type==="")switch(p.direction){case"single":this.addLineItem(p.fromKey,p.toKey,p.distance,o);break;case"back":this.addLineItem(p.toKey,p.fromKey,p.distance,o);break;case"single-people":this.addLineItem(p.fromKey,p.toKey,p.distance,o);break;case"back-people":this.addLineItem(p.toKey,p.fromKey,p.distance,o);break;default:this.addLineItem(p.fromKey,p.toKey,p.distance,o),this.addLineItem(p.toKey,p.fromKey,p.distance,o);break}else this.addLineItem(p.fromKey,p.toKey,s.get(p.type),o)})}addLineItem(t,e,o,s){s===void 0&&(s=this.lineMap);let u=s.get(t)||new Map,p=this.pointMap.get(t),f=this.pointMap.get(e);if(!p||!f)return;let g=this.weightPointMap.get(p.floor)||[],m=this.weightPointMap.get(f.floor)||[];g.forEach(v=>{v.id===p.id&&(o=o/v.passWeight),_f(p.cds,v.cds)<=v.coverageArea&&(o=o/v.passWeight)}),m.forEach(v=>{v.id===f.id&&(o=o/v.passWeight),_f(f.cds,v.cds)<=v.coverageArea&&(o=o/v.passWeight)}),u.set(e,o),s.set(t,u)}addFacilityToLineMap(t,e,o,s){[...this.straightLadderMap,...this.staircaseMap].forEach(u=>{let[p,f]=u;if(!(f.length<2))for(let g=0;g<f.length;g++){let m=""+f[g].floor+$e+f[g].id,v=this.pointMap.get(m);if(!(!v||v.permission)){for(let w=0;w<f.length;w++)if(g!==w){let S=""+f[w].floor+$e+f[w].id,b=this.pointMap.get(S);if(!b||b.permission)continue;if(f[g].type==="straightLadder"){let C=e;this.addLineItem(m,S,C,s)}else{let C=o;this.addLineItem(m,S,C,s)}}}}}),this.escalatorMap.forEach((u,p)=>{u.forEach(f=>{if(f.start&&f.end){let g=""+f.start.floor+$e+f.start.id,m=""+f.end.floor+$e+f.end.id,v=this.pointMap.get(g),w=this.pointMap.get(m);if(v&&w&&!v.permission&&!w.permission){let S=t;this.addLineItem(g,m,S,s)}}})}),this.connectionPointMap.forEach((u,p)=>{u.forEach(f=>{if(f.start&&f.end){let g=""+f.start.floor+$e+f.start.id,m=""+f.end.floor+$e+f.end.id,v=this.pointMap.get(g),w=this.pointMap.get(m);v&&w&&!v.permission&&!w.permission&&this.addLineItem(g,m,100,s)}})})}initBaseRoute(){let t=new Map(gu(this.lineMap));this.addFacilityToLineMap(100,100*this.lift_priority,3e4,t),this.baseRoute=new Vi.default(t)}initEscalatorRoute(){let t=new Map(gu(this.lineMap)),e=1e4;this.addFacilityToLineMap(100,this.lift_priority*e,3e4*e,t),this.escalatorRoute=new Vi.default(t)}initStraightLadderRoute(){let t=new Map(gu(this.lineMap)),e=1e4;this.addFacilityToLineMap(3*e,300,3e4*e,t),this.straightLadderRoute=new Vi.default(t)}initForwardRoute(){this.rampMap.forEach((t,e)=>{t.forEach(o=>{if(o.start&&o.end){let s=""+o.start.floor+$e+o.start.id,u=""+o.end.floor+$e+o.end.id,p=this.pointMap.get(s),f=this.pointMap.get(u);p&&f&&!p.permission&&!f.permission&&this.addLineItem(s,u,10,this.forwardLineMap)}})}),this.connectionPointMap.forEach((t,e)=>{t.forEach(o=>{if(o.start&&o.end){let s=""+o.start.floor+$e+o.start.id,u=""+o.end.floor+$e+o.end.id,p=this.pointMap.get(s),f=this.pointMap.get(u);p&&f&&!p.permission&&!f.permission&&this.addLineItem(s,u,100,this.forwardLineMap)}})}),this.forwardRoute=new Vi.default(this.forwardLineMap)}addNoProofWeight(t,e){let o=(s,u)=>{let p=t.get(s),f=p==null?void 0:p.get(u);p&&!(0,Ef.isNil)(f)&&p.set(u,f*KJ)};this.roadInfo.forEach(s=>{(s.lines||[]).filter(u=>u.to!==u.from&&u[e]===!1).forEach(u=>{let p=""+s.floor+$e+u.from,f=""+s.floor+$e+u.to;switch(u.direction){case"single-people":o(p,f);break;case"back-people":o(f,p);break;default:o(p,f),o(f,p)}})})}getRouteByType(t){switch(t){case"escalator":return this.escalatorRoute;case"straightLadder":return this.straightLadderRoute;case"forward":return this.forwardRoute;default:return this.baseRoute}}getProofRoute(t,e,o){let s=""+t+$e+e+$e+o,u=this.proofRouteMap.get(s);if(u)return u;let p=new Map(gu(this.getRouteByType(t).graph));e&&this.addNoProofWeight(p,"sunProof"),o&&this.addNoProofWeight(p,"rain");let f=new Vi.default(p);return this.proofRouteMap.set(s,f),f}checkStart(t){return!(!t.floor||!t.routePointId&&!t.nodeId&&(!t.coord||t.coord.length<2))}checkEnd(t){return t.facility||t.parkingSpace&&t.floor?!0:this.checkStart(t)}transformStart(t,e,o){o===void 0&&(o={});var s;if(t.routePointId)return[{floor:t.floor,id:t.routePointId}];if(t.nodeId){let u=this.nodeMap.get(""+t.floor+$e+t.nodeId);if(u!=null&&u.length)return u.map(p=>{let[f,g]=p.split($e);return{floor:f,id:g}})}if((s=t.coord)!=null&&s.length){let u=this.roadInfo.find(m=>m.floor===t.floor);if(!u)return null;let p=u.points.filter(m=>m.isStarted),f=u.points.filter(m=>{let v=""+m.floor+$e+m.id;if(e==="forward"){if(!this.forwardLineMap.has(v)||o.adsorptionIntersection&&p.length&&!m.isStarted)return!1}else if(!this.lineMap.has(v))return!1;return!0});if(!f.length)return null;let g=f.reduce((m,v)=>{if(v.relatedId)return m;let w=_f(t.coord,v.cds);return w<m.min&&(m.min=w,m.point=v),m},{min:1/0,point:f[0]});return[{floor:u.floor,id:g.point.id}]}return null}transformEnd(t,e){if(t.routePointId&&t.floor)return[{floor:t.floor,id:t.routePointId}];if(t.floor){if(t.parkingSpace){let s=this.parkingMap.get(""+t.floor+$e+t.parkingSpace);if(s)return[{floor:t.floor,id:s.id}]}let o=this.transformStart(t,e);if(o)return o}if(t.facility){let s=this.facilities.filter(u=>+u.type_id==+t.facility).map(u=>u.id).map(u=>this.facilityMap.get(""+u)).flat(2);if(s!=null&&s.length)return{floor:t.floor,facility:t.facility}}return null}getPath(t,e,o,s,u,p){if(o===void 0&&(o=""),p===void 0&&(p={}),!this.checkStart(t))return"start-error";if(!this.checkEnd(e))return"end-error";let f=this.transformStart(t,o,p);if(!f)return"no-start";let g=this.transformEnd(e,o);if(!g)return"no-end";let m=[];if(Array.isArray(g))for(let R=0;R<f.length;R++){let x=f[R];for(let E=0;E<g.length;E++){let I=g[E];if(x.floor===I.floor&&x.id===I.id)return"near"}}else{m=this.facilities.filter(x=>+x.type_id==+e.facility).map(x=>x.id).map(x=>this.facilityMap.get(""+x)).flat(2).filter(x=>x).filter(x=>g.floor?x.floor===g.floor:!0);for(let x=0;x<f.length;x++){let E=f[x];for(let I=0;I<m.length;I++){let A=m[I];if(E.floor===A.floor&&E.id===A.id)return"near"}}}let v=Array.isArray(p.proof)?p.proof:p.proof?[p.proof]:[],w=o!=="forward"&&v.includes("sunProof"),S=o!=="forward"&&v.includes("rain"),b;switch(o){case"escalator":b=(R,x,E)=>this.getEscalatorPath(R,x,E,w,S);break;case"straightLadder":b=(R,x,E)=>this.getStraightLadderPath(R,x,E,w,S);break;case"forward":b=this.getForwardPath.bind(this);break;default:b=(R,x,E)=>this.getBasePath(R,x,E,w,S);break}let C=null;return f.forEach(R=>{if(Array.isArray(g))g.forEach(x=>{let E=b(R,x,s,u);E&&E&&(!C||E[0].consume<C[0].consume)&&(C=E)});else{if(!m.length)return null;let x=m.map(E=>b(R,{floor:E.floor,id:E.id},s,u)).filter(E=>!!E);C=x.reduce((E,I)=>{let A=I[0].consume;return A<E.distance&&(E.distance=A,E.path=I),E},{distance:1/0,path:x[0]}).path}}),C}getRoutePath(t,e,o){let s=""+t.floor+$e+t.id,u=this.pointMap.get(s),p=""+e.floor+$e+e.id,f=this.pointMap.get(p);if(!u||!f)return null;let g=""+u.floor+$e+(u.relatedId||u.id),m=""+f.floor+$e+(f.relatedId||f.id),v=o.path(g,m);if(!v)return null;let w=[],S=v.reduce((b,C,R,x)=>{if(R===0)return 0;let E=x[R-1],I=o.graph.get(E).get(C);return b+I},0);return v.map(b=>{let C=this.pointMap.get(b);if(C){var R;let{floor:x}=C,E=C.type;if(this.isFacilityByType(C.type)){let I=this.facilities.find(A=>A.id===+C.targetId);I&&(E=I.entry_infra_type)}if(((R=w[w.length-1])==null?void 0:R.floor)===x){let I=w[w.length-1];I.points.push(C.cds),I.pointInfos.push(C),I.endType=E,I.destId=C.nodeId,I.distance=t2(I.points)}else w.push({floor:x,points:[C.cds],pointInfos:[C],endType:E,destId:C.nodeId,distance:0,consume:S})}}),w}getBasePath(t,e,o,s,u){s===void 0&&(s=!1),u===void 0&&(u=!1);let p=s||u?this.getProofRoute("",s,u):this.baseRoute;if(!o)return this.getRoutePath(t,e,p);let f=gu(p.graph),g=v=>{this.addPermissionLineToMap(v,["","escalator","staircase","straightLadder","connectionPoint"],f,new Map([["escalator",100],["connectionPoint",100],["straightLadder",100*this.lift_priority],["staircase",3e4]]))};Array.isArray(o)?o.forEach(v=>{g(v)}):g(o);let m=new Vi.default(f);return this.getRoutePath(t,e,m)}getEscalatorPath(t,e,o,s,u){s===void 0&&(s=!1),u===void 0&&(u=!1);let p=s||u?this.getProofRoute("escalator",s,u):this.escalatorRoute;if(!o)return this.getRoutePath(t,e,p);let f=gu(p.graph),g=1e4,m=w=>{this.addPermissionLineToMap(w,["","escalator","staircase","straightLadder","connectionPoint"],f,new Map([["escalator",100],["connectionPoint",100],["straightLadder",this.lift_priority*g],["staircase",3e4*g]]))};Array.isArray(o)?o.forEach(w=>{m(w)}):m(o);let v=new Vi.default(f);return this.getRoutePath(t,e,v)}getStraightLadderPath(t,e,o,s,u){s===void 0&&(s=!1),u===void 0&&(u=!1);let p=s||u?this.getProofRoute("straightLadder",s,u):this.straightLadderRoute;if(!o)return this.getRoutePath(t,e,p);let f=gu(p.graph),g=1e4,m=w=>{this.addPermissionLineToMap(w,["","escalator","staircase","straightLadder","connectionPoint"],f,new Map([["escalator",3*g],["connectionPoint",100],["straightLadder",300],["staircase",3e4*g]]))};Array.isArray(o)?o.forEach(w=>{m(w)}):m(o);let v=new Vi.default(f);return this.getRoutePath(t,e,v)}getSunProofPath(t,e,o,s,u,p){return o===void 0&&(o=""),p===void 0&&(p={}),this.getPath(t,e,o,s,u,eu({},p,{proof:"sunProof"}))}getRainProofPath(t,e,o,s,u,p){return o===void 0&&(o=""),p===void 0&&(p={}),this.getPath(t,e,o,s,u,eu({},p,{proof:"rain"}))}getForwardPath(t,e,o,s){let u=new Map,p=b=>{let C=this.forwardRoute.graph.get(g);b.forEach(R=>{let x=C.get(R);(0,Ef.isNil)(x)||(u.set(R,x),C.delete(R))})},f=()=>{let b=this.forwardRoute.graph.get(g);u.forEach((C,R)=>{b.set(R,C)})},g=""+t.floor+$e+t.id;if(!(0,Ef.isNil)(s)){let b=this.forwardLineMap.get(g),C=this.pointMap.get(g);if(C&&(b!=null&&b.size)&&b.size>1){let R=new Ye(C.cds[0],C.cds[1]),x=new Map;b.forEach((I,A)=>{let F=this.pointMap.get(A);if(F){let V=new Ye(F.cds[0],F.cds[1]),q=360-(new Ye().subVectors(V,R).angle()/Math.PI*180-90+360)%360;x.set(A,q)}});let E=Array.from(x).filter(I=>{let[A,F]=I;return Math.abs(F-s)<=60}).map(I=>{let[A]=I;return A});if(E.length)E.forEach(I=>x.delete(I)),p([...x.keys()]);else{let I=Array.from(x).reduce((A,F)=>{let V=Math.abs(F[1]-s);return V<A.diff?{diff:V,key:F[0]}:A},{diff:1/0,key:""});x.delete(I.key),p([...x.keys()])}}}if(!o){let b=this.getRoutePath(t,e,this.forwardRoute);return f(),b||this.getRoutePath(t,e,this.forwardRoute)}let m=gu(this.forwardRoute.graph),v=b=>{this.addPermissionLineToMap(b,["","ramp"],m,new Map([["ramp",10]]))};Array.isArray(o)?o.forEach(b=>{v(b)}):v(o);let w=new Vi.default(m),S=this.getRoutePath(t,e,w);if(f(),S)return S;{let b=gu(this.forwardRoute.graph);Array.isArray(o)?o.forEach(x=>{v(x)}):v(o);let C=new Vi.default(b);return this.getRoutePath(t,e,C)}}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 Vi.default,this.escalatorRoute=new Vi.default,this.straightLadderRoute=new Vi.default,this.proofRouteMap.clear()}constructor(t=3){this.lift_priority=t,this.roadInfo=[],this.facilities=[],this.pointMap=new Map,this.nodeMap=new Map,this.facilityMap=new Map,this.straightLadderMap=new Map,this.escalatorMap=new Map,this.rampMap=new Map,this.staircaseMap=new Map,this.connectionPointMap=new Map,this.parkingMap=new Map,this.lineMap=new Map,this.weightPointMap=new Map,this.baseRoute=new Vi.default,this.escalatorRoute=new Vi.default,this.straightLadderRoute=new Vi.default,this.forwardLineMap=new Map,this.forwardRoute=new Vi.default,this.proofRouteMap=new Map}};var Qg=class{setRoadData(t,e){this.roadNetwork.initRoute(t,e),this.roadReadyResolve(!0)}setRoadNetwork(t){this.roadNetwork=t}recommend(t,e,o,s,u){return Ru(this,null,function*(){yield this.roadReadyPromise;let p=e.reduce((v,w)=>(v[w.floor]?v[w.floor].push(w):v[w.floor]=[w],v),{}),f=this.roadNetwork.roadInfo.map(v=>v.floor),g=this.transformStart(t);if(!g)return null;let m=o?this.transformEnd(o):null;if(u){let v=e.filter(w=>{let S=this.roadNetwork.getParkingSpaceInfo(w.floor,w.lot_id);return S?S.parkingType===u:!1});if(v.length>0){let w=v.reduce((S,b)=>(S[b.floor]?S[b.floor].push(b):S[b.floor]=[b],S),{});if(m){let S=this.recommendByEnd(g,m,w,f,s);if(S)return S}else{let S=this.recommendByStart(g.floor,g.coord,g.routePointId,w,f,s);if(S)return S}}}return m?this.recommendByEnd(g,m,p,f,s):this.recommendByStart(g.floor,g.coord,g.routePointId,p,f,s)})}dispose(){this.roadNetwork.clear()}getFloorCarByDistance(t,e,o){let{floor:s,coord:u,routePointId:p}=t,f=null;return(e||[]).forEach(g=>{let m=this.roadNetwork.getPath({floor:s,coord:u,routePointId:p},{floor:g.floor,parkingSpace:g.lot_id},"forward",0,o);if(m==="near"){f={floor:g.floor,spaceNo:g.lot_id,distance:0};return}if(!m||typeof m=="string")return;let v={floor:g.floor,spaceNo:g.lot_id,distance:m[0].consume};f||(f=v),f.distance>v.distance&&(f=v)}),f}recommendByStart(t,e,o,s,u,p){let f=this.getFloorCarByDistance({floor:t,coord:e,routePointId:o},s[t],p);return f||this.recommendByStartNearFloor(t,e,o,s,u,p)}recommendByStartNearFloor(t,e,o,s,u,p){let f=u.indexOf(t);f===-1&&(f=u.length);let g=1,m=null;for(;g<=u.length;){if(u.filter((w,S)=>S===f-g||S===f+g).forEach(w=>{let S=this.getFloorCarByDistance({floor:t,coord:e,routePointId:o},s[w],p);m?S&&m.distance>S.distance&&(m=S):m=S}),m)return m;g++}return m}recommendByEnd(t,e,o,s,u){console.time("recommendByEnd");let p=this.recommendFloorCarByEndDistance(t,e,e.floor,o,u);if(p)return p;console.timeEnd("recommendByEnd"),console.time("recommendByStart");let f=this.recommendFloorCarByEndDistance(t,e,t.floor,o,u);return console.timeEnd("recommendByStart"),f||this.recommendByStartNearFloorAndEnd(t,e,t.floor,o,s,u)}recommendFloorCarByEndDistance(t,e,o,s,u){let p=s[o]||[];if(!p.length)return null;let f=null;return p.forEach(g=>{let m=this.roadNetwork.getParkingSpaceInfo(g.floor,g.lot_id);if(!m)return;console.time("path2");let v=this.roadNetwork.getPath({floor:g.floor,routePointId:m.id},e,"",0);if(console.timeEnd("path2"),v==="near"){f={floor:g.floor,spaceNo:g.lot_id,distance:0};return}if(!v||typeof v=="string")return;let w={floor:g.floor,spaceNo:g.lot_id,distance:v[0].consume},S={floor:g.floor,routePointId:m.id};if(f){if(f.distance>w.distance){console.count("forward");let b=this.roadNetwork.getPath(t,S,"forward",0,u);if(!b||typeof b=="string"&&b!=="near")return;f=w}}else{console.count("forward");let b=this.roadNetwork.getPath(t,S,"forward",0,u);if(!b||typeof b=="string"&&b!=="near")return;f=w}}),f}recommendByStartNearFloorAndEnd(t,e,o,s,u,p){let f=u.indexOf(o);f===-1&&(f=u.length);let g=1,m=null;for(;g<=u.length;){if(u.filter((w,S)=>S===f-g||S===f+g).forEach(w=>{let S=this.recommendFloorCarByEndDistance(t,e,w,s,p);m?S&&m.distance>S.distance&&(m=S):m=S}),m)return m;g++}return m}transformStart(t){if(t.routePointId)return{floor:t.floor,routePointId:t.routePointId};if(t.coord)return{floor:t.floor,coord:t.coord};if(t.nodeId){let e=this.roadNetwork.getNodeInfo(t.floor,t.nodeId);if(e)return{floor:e.floor,coord:e.cds}}return null}transformEnd(t){if(t.routePointId&&t.floor)return{floor:t.floor,routePointId:t.routePointId};if(t.coord)return{floor:t.floor,coord:t.coord};if(t.nodeId){let e=this.roadNetwork.getNodeInfo(t.floor,t.nodeId);if(e)return{floor:e.floor,coord:e.cds}}if(t.parkingSpace){let e=this.roadNetwork.getParkingSpaceInfo(t.floor,t.parkingSpace);if(e)return{floor:e.floor,coord:e.cds,routePointId:e.id}}return null}constructor(){this.roadNetwork=new jg,this.roadReadyPromise=new Promise(t=>{this.roadReadyResolve=t})}};var G1=new Qg;AA({onSetRoadInfo(n){let{roadData:t,facilities:e}=n;G1.setRoadData(t,e)},onRecommend(n){return Ru(this,null,function*(){let{start:t,end:e,travelDirection:o,carLotStatus:s,parkingType:u}=n;return G1.recommend(t,s,e,o,u)})},onClear(){G1.dispose()}});
3825
+ `)};function Bg(n,t,e){this.x=n,this.y=t,this.weight=e}Bg.prototype.toString=function(){return"["+this.x+" "+this.y+"]"};Bg.prototype.getCost=function(n){return n&&n.x!==this.x&&n.y!==this.y?this.weight*1.41421:this.weight};Bg.prototype.isWall=function(){return this.weight===0};function dN(n){this.content=[],this.scoreFunction=n}dN.prototype={push:function(n){this.content.push(n),this.sinkDown(this.content.length-1)},pop:function(){var n=this.content[0],t=this.content.pop();return this.content.length>0&&(this.content[0]=t,this.bubbleUp(0)),n},remove:function(n){var t=this.content.indexOf(n),e=this.content.pop();t!==this.content.length-1&&(this.content[t]=e,this.scoreFunction(e)<this.scoreFunction(n)?this.sinkDown(t):this.bubbleUp(t))},size:function(){return this.content.length},rescoreElement:function(n){this.sinkDown(this.content.indexOf(n))},sinkDown:function(n){for(var t=this.content[n];n>0;){var e=(n+1>>1)-1,o=this.content[e];if(this.scoreFunction(t)<this.scoreFunction(o))this.content[e]=t,this.content[n]=o,n=e;else break}},bubbleUp:function(n){for(var t=this.content.length,e=this.content[n],o=this.scoreFunction(e);;){var s=n+1<<1,u=s-1,p=null,f;if(u<t){var g=this.content[u];f=this.scoreFunction(g),f<o&&(p=u)}if(s<t){var m=this.content[s],v=this.scoreFunction(m);v<(p===null?o:f)&&(p=s)}if(p!==null)this.content[n]=this.content[p],this.content[p]=e,n=p;else break}}};function E1(){this._=null}function pf(n){n.U=n.C=n.L=n.R=n.P=n.N=null}E1.prototype={constructor:E1,insert:function(n,t){var e,o,s;if(n){if(t.P=n,t.N=n.N,n.N&&(n.N.P=t),n.N=t,n.R){for(n=n.R;n.L;)n=n.L;n.L=t}else n.R=t;e=n}else this._?(n=gN(this._),t.P=null,t.N=n,n.P=n.L=t,e=n):(t.P=t.N=null,this._=t,e=null);for(t.L=t.R=null,t.U=e,t.C=!0,n=t;e&&e.C;)o=e.U,e===o.L?(s=o.R,s&&s.C?(e.C=s.C=!1,o.C=!0,n=o):(n===e.R&&(Rh(this,e),n=e,e=n.U),e.C=!1,o.C=!0,Lh(this,o))):(s=o.L,s&&s.C?(e.C=s.C=!1,o.C=!0,n=o):(n===e.L&&(Lh(this,e),n=e,e=n.U),e.C=!1,o.C=!0,Rh(this,o))),e=n.U;this._.C=!1},remove:function(n){n.N&&(n.N.P=n.P),n.P&&(n.P.N=n.N),n.N=n.P=null;var t=n.U,e,o=n.L,s=n.R,u,p;if(o?s?u=gN(s):u=o:u=s,t?t.L===n?t.L=u:t.R=u:this._=u,o&&s?(p=u.C,u.C=n.C,u.L=o,o.U=u,u!==s?(t=u.U,u.U=n.U,n=u.R,t.L=n,u.R=s,s.U=u):(u.U=t,t=u,n=u.R)):(p=n.C,n=u),n&&(n.U=t),!p){if(n&&n.C){n.C=!1;return}do{if(n===this._)break;if(n===t.L){if(e=t.R,e.C&&(e.C=!1,t.C=!0,Rh(this,t),e=t.R),e.L&&e.L.C||e.R&&e.R.C){(!e.R||!e.R.C)&&(e.L.C=!1,e.C=!0,Lh(this,e),e=t.R),e.C=t.C,t.C=e.R.C=!1,Rh(this,t),n=this._;break}}else if(e=t.L,e.C&&(e.C=!1,t.C=!0,Lh(this,t),e=t.L),e.L&&e.L.C||e.R&&e.R.C){(!e.L||!e.L.C)&&(e.R.C=!1,e.C=!0,Rh(this,e),e=t.L),e.C=t.C,t.C=e.L.C=!1,Lh(this,t),n=this._;break}e.C=!0,n=t,t=t.U}while(!n.C);n&&(n.C=!1)}}};function Rh(n,t){var e=t,o=t.R,s=e.U;s?s.L===e?s.L=o:s.R=o:n._=o,o.U=s,e.U=o,e.R=o.L,e.R&&(e.R.U=e),o.L=e}function Lh(n,t){var e=t,o=t.L,s=e.U;s?s.L===e?s.L=o:s.R=o:n._=o,o.U=s,e.U=o,e.L=o.R,e.L&&(e.L.U=e),o.R=e}function gN(n){for(;n.L;)n=n.L;return n}var w1=E1;function df(n,t,e,o){var s=[null,null],u=Hi.push(s)-1;return s.left=n,s.right=t,e&&Nh(s,n,t,e),o&&Nh(s,t,n,o),To[n.index].halfedges.push(u),To[t.index].halfedges.push(u),s}function gf(n,t,e){var o=[t,e];return o.left=n,o}function Nh(n,t,e,o){!n[0]&&!n[1]?(n[0]=o,n.left=t,n.right=e):n.left===e?n[1]=o:n[0]=o}function qK(n,t,e,o,s){var u=n[0],p=n[1],f=u[0],g=u[1],m=p[0],v=p[1],w=0,S=1,b=m-f,C=v-g,R;if(R=t-f,!(!b&&R>0)){if(R/=b,b<0){if(R<w)return;R<S&&(S=R)}else if(b>0){if(R>S)return;R>w&&(w=R)}if(R=o-f,!(!b&&R<0)){if(R/=b,b<0){if(R>S)return;R>w&&(w=R)}else if(b>0){if(R<w)return;R<S&&(S=R)}if(R=e-g,!(!C&&R>0)){if(R/=C,C<0){if(R<w)return;R<S&&(S=R)}else if(C>0){if(R>S)return;R>w&&(w=R)}if(R=s-g,!(!C&&R<0)){if(R/=C,C<0){if(R>S)return;R>w&&(w=R)}else if(C>0){if(R<w)return;R<S&&(S=R)}return!(w>0)&&!(S<1)||(w>0&&(n[0]=[f+w*b,g+w*C]),S<1&&(n[1]=[f+S*b,g+S*C])),!0}}}}}function HK(n,t,e,o,s){var u=n[1];if(u)return!0;var p=n[0],f=n.left,g=n.right,m=f[0],v=f[1],w=g[0],S=g[1],b=(m+w)/2,C=(v+S)/2,R,x;if(S===v){if(b<t||b>=o)return;if(m>w){if(!p)p=[b,e];else if(p[1]>=s)return;u=[b,s]}else{if(!p)p=[b,s];else if(p[1]<e)return;u=[b,e]}}else if(R=(m-w)/(S-v),x=C-R*b,R<-1||R>1)if(m>w){if(!p)p=[(e-x)/R,e];else if(p[1]>=s)return;u=[(s-x)/R,s]}else{if(!p)p=[(s-x)/R,s];else if(p[1]<e)return;u=[(e-x)/R,e]}else if(v<S){if(!p)p=[t,R*t+x];else if(p[0]>=o)return;u=[o,R*o+x]}else{if(!p)p=[o,R*o+x];else if(p[0]<t)return;u=[t,R*t+x]}return n[0]=p,n[1]=u,!0}function mN(n,t,e,o){for(var s=Hi.length,u;s--;)(!HK(u=Hi[s],n,t,e,o)||!qK(u,n,t,e,o)||!(Math.abs(u[0][0]-u[1][0])>Er||Math.abs(u[0][1]-u[1][1])>Er))&&delete Hi[s]}function yN(n){return To[n.index]={site:n,halfedges:[]}}function VK(n,t){var e=n.site,o=t.left,s=t.right;return e===s&&(s=o,o=e),s?Math.atan2(s[1]-o[1],s[0]-o[0]):(e===o?(o=t[1],s=t[0]):(o=t[0],s=t[1]),Math.atan2(o[0]-s[0],s[1]-o[1]))}function S1(n,t){return t[+(t.left!==n.site)]}function WK(n,t){return t[+(t.left===n.site)]}function vN(){for(var n=0,t=To.length,e,o,s,u;n<t;++n)if((e=To[n])&&(u=(o=e.halfedges).length)){var p=new Array(u),f=new Array(u);for(s=0;s<u;++s)p[s]=s,f[s]=VK(e,Hi[o[s]]);for(p.sort(function(g,m){return f[m]-f[g]}),s=0;s<u;++s)f[s]=o[p[s]];for(s=0;s<u;++s)o[s]=f[s]}}function _N(n,t,e,o){var s=To.length,u,p,f,g,m,v,w,S,b,C,R,x,E=!0;for(u=0;u<s;++u)if(p=To[u]){for(f=p.site,m=p.halfedges,g=m.length;g--;)Hi[m[g]]||m.splice(g,1);for(g=0,v=m.length;g<v;)C=WK(p,Hi[m[g]]),R=C[0],x=C[1],w=S1(p,Hi[m[++g%v]]),S=w[0],b=w[1],(Math.abs(R-S)>Er||Math.abs(x-b)>Er)&&(m.splice(g,0,Hi.push(gf(f,C,Math.abs(R-n)<Er&&o-x>Er?[n,Math.abs(S-n)<Er?b:o]:Math.abs(x-o)<Er&&e-R>Er?[Math.abs(b-o)<Er?S:e,o]:Math.abs(R-e)<Er&&x-t>Er?[e,Math.abs(S-e)<Er?b:t]:Math.abs(x-t)<Er&&R-n>Er?[Math.abs(b-t)<Er?S:n,t]:null))-1),++v);v&&(E=!1)}if(E){var I,A,F,V=1/0;for(u=0,E=null;u<s;++u)(p=To[u])&&(f=p.site,I=f[0]-n,A=f[1]-t,F=I*I+A*A,F<V&&(V=F,E=p));if(E){var X=[n,t],q=[n,o],D=[e,o],xt=[e,t];E.halfedges.push(Hi.push(gf(f=E.site,X,q))-1,Hi.push(gf(f,q,D))-1,Hi.push(gf(f,D,xt))-1,Hi.push(gf(f,xt,X))-1)}}for(u=0;u<s;++u)(p=To[u])&&(p.halfedges.length||delete To[u])}var xN=[],zg;function XK(){pf(this),this.x=this.y=this.arc=this.site=this.cy=null}function Wl(n){var t=n.P,e=n.N;if(!(!t||!e)){var o=t.site,s=n.site,u=e.site;if(o!==u){var p=s[0],f=s[1],g=o[0]-p,m=o[1]-f,v=u[0]-p,w=u[1]-f,S=2*(g*w-m*v);if(!(S>=-EN)){var b=g*g+m*m,C=v*v+w*w,R=(w*b-m*C)/S,x=(g*C-v*b)/S,E=xN.pop()||new XK;E.arc=n,E.site=s,E.x=R+p,E.y=(E.cy=x+f)+Math.sqrt(R*R+x*x),n.circle=E;for(var I=null,A=mf._;A;)if(E.y<A.y||E.y===A.y&&E.x<=A.x)if(A.L)A=A.L;else{I=A.P;break}else if(A.R)A=A.R;else{I=A;break}mf.insert(I,E),I||(zg=E)}}}}function Xl(n){var t=n.circle;t&&(t.P||(zg=t.N),mf.remove(t),xN.push(t),pf(t),n.circle=null)}var SN=[];function YK(){pf(this),this.edge=this.site=this.circle=null}function wN(n){var t=SN.pop()||new YK;return t.site=n,t}function M1(n){Xl(n),Yl.remove(n),SN.push(n),pf(n)}function MN(n){var t=n.circle,e=t.x,o=t.cy,s=[e,o],u=n.P,p=n.N,f=[n];M1(n);for(var g=u;g.circle&&Math.abs(e-g.circle.x)<Er&&Math.abs(o-g.circle.cy)<Er;)u=g.P,f.unshift(g),M1(g),g=u;f.unshift(g),Xl(g);for(var m=p;m.circle&&Math.abs(e-m.circle.x)<Er&&Math.abs(o-m.circle.cy)<Er;)p=m.N,f.push(m),M1(m),m=p;f.push(m),Xl(m);var v=f.length,w;for(w=1;w<v;++w)m=f[w],g=f[w-1],Nh(m.edge,g.site,m.site,s);g=f[0],m=f[v-1],m.edge=df(g.site,m.site,null,s),Wl(g),Wl(m)}function bN(n){for(var t=n[0],e=n[1],o,s,u,p,f=Yl._;f;)if(u=AN(f,e)-t,u>Er)f=f.L;else if(p=t-$K(f,e),p>Er){if(!f.R){o=f;break}f=f.R}else{u>-Er?(o=f.P,s=f):p>-Er?(o=f,s=f.N):o=s=f;break}yN(n);var g=wN(n);if(Yl.insert(o,g),!(!o&&!s)){if(o===s){Xl(o),s=wN(o.site),Yl.insert(g,s),g.edge=s.edge=df(o.site,g.site),Wl(o),Wl(s);return}if(!s){g.edge=df(o.site,g.site);return}Xl(o),Xl(s);var m=o.site,v=m[0],w=m[1],S=n[0]-v,b=n[1]-w,C=s.site,R=C[0]-v,x=C[1]-w,E=2*(S*x-b*R),I=S*S+b*b,A=R*R+x*x,F=[(x*I-b*A)/E+v,(S*A-R*I)/E+w];Nh(s.edge,m,C,F),g.edge=df(m,n,null,F),s.edge=df(n,C,null,F),Wl(o),Wl(s)}}function AN(n,t){var e=n.site,o=e[0],s=e[1],u=s-t;if(!u)return o;var p=n.P;if(!p)return-1/0;e=p.site;var f=e[0],g=e[1],m=g-t;if(!m)return f;var v=f-o,w=1/u-1/m,S=v/m;return w?(-S+Math.sqrt(S*S-2*w*(v*v/(-2*m)-g+m/2+s-u/2)))/w+o:(o+f)/2}function $K(n,t){var e=n.N;if(e)return AN(e,t);var o=n.site;return o[1]===t?o[0]:1/0}var Er=1e-6,EN=1e-12,Yl,To,mf,Hi;function ZK(n,t,e){return(n[0]-e[0])*(t[1]-n[1])-(n[0]-t[0])*(e[1]-n[1])}function KK(n,t){return t[1]-n[1]||t[0]-n[0]}function Gg(n,t){var e=n.sort(KK).pop(),o,s,u;for(Hi=[],To=new Array(n.length),Yl=new w1,mf=new w1;;)if(u=zg,e&&(!u||e[1]<u.y||e[1]===u.y&&e[0]<u.x))(e[0]!==o||e[1]!==s)&&(bN(e),o=e[0],s=e[1]),e=n.pop();else if(u)MN(u.arc);else break;if(vN(),t){var p=+t[0][0],f=+t[0][1],g=+t[1][0],m=+t[1][1];mN(p,f,g,m),_N(p,f,g,m)}this.edges=Hi,this.cells=To,Yl=mf=Hi=To=null}Gg.prototype={constructor:Gg,polygons:function(){var n=this.edges;return this.cells.map(function(t){var e=t.halfedges.map(function(o){return S1(t,n[o])});return e.data=t.site.data,e})},triangles:function(){var n=[],t=this.edges;return this.cells.forEach(function(e,o){if(f=(u=e.halfedges).length)for(var s=e.site,u,p=-1,f,g,m=t[u[f-1]],v=m.left===s?m.right:m.left;++p<f;)g=v,m=t[u[p]],v=m.left===s?m.right:m.left,g&&v&&o<g.index&&o<v.index&&ZK(s,g,v)<0&&n.push([s.data,g.data,v.data])}),n},links:function(){return this.edges.filter(function(n){return n.right}).map(function(n){return{source:n.left.data,target:n.right.data}})},find:function(n,t,e){for(var o=this,s,u=o._found||0,p=o.cells.length,f;!(f=o.cells[u]);)if(++u>=p)return null;var g=n-f.site[0],m=t-f.site[1],v=g*g+m*m;do f=o.cells[s=u],u=null,f.halfedges.forEach(function(w){var S=o.edges[w],b=S.left;if(!((b===f.site||!b)&&!(b=S.right))){var C=n-b[0],R=t-b[1],x=C*C+R*R;x<v&&(v=x,u=b.index)}});while(u!==null);return o._found=s,e==null||v<=e*e?f.site:null}};var iJ=tn(yf(),1);var z1=tn(IN(),1);function Zo(){return new Hg}function Hg(){this.reset()}Hg.prototype={constructor:Hg,reset:function(){this.s=this.t=0},add:function(n){RN(qg,n,this.t),RN(this,qg.s,this.s),this.s?this.t+=qg.t:this.s=qg.t},valueOf:function(){return this.s}};var qg=new Hg;function RN(n,t,e){var o=n.s=t+e,s=o-t,u=o-s;n.t=t-u+(e-s)}var er=1e-6;var gr=Math.PI,Mi=gr/2,Vg=gr/4,Na=gr*2,$l=180/gr,Ko=gr/180,Zr=Math.abs,sa=Math.atan,Jo=Math.atan2,Xn=Math.cos;var Wg=Math.exp;var Oh=Math.log;var un=Math.sin;var ro=Math.sqrt,Dh=Math.tan;function T1(n){return n>1?0:n<-1?gr:Math.acos(n)}function Co(n){return n>1?Mi:n<-1?-Mi:Math.asin(n)}function aa(){}var oJ=Zo(),fpt=Zo();function Zl(n){var t=n[0],e=n[1],o=Xn(e);return[o*Xn(t),o*un(t),un(e)]}function Fh(n,t){return[n[1]*t[2]-n[2]*t[1],n[2]*t[0]-n[0]*t[2],n[0]*t[1]-n[1]*t[0]]}function Uh(n){var t=ro(n[0]*n[0]+n[1]*n[1]+n[2]*n[2]);n[0]/=t,n[1]/=t,n[2]/=t}var Ept=Zo();function NN(n,t){return[n>gr?n-Na:n<-gr?n+Na:n,t]}NN.invert=NN;function C1(){var n=[],t;return{point:function(e,o){t.push([e,o])},lineStart:function(){n.push(t=[])},lineEnd:aa,rejoin:function(){n.length>1&&n.push(n.pop().concat(n.shift()))},result:function(){var e=n;return n=[],t=null,e}}}function P1(n,t){return Zr(n[0]-t[0])<er&&Zr(n[1]-t[1])<er}function Xg(n,t,e,o){this.x=n,this.z=t,this.o=e,this.e=o,this.v=!1,this.n=this.p=null}function I1(n,t,e,o,s){var u=[],p=[],f,g;if(n.forEach(function(C){if(!((R=C.length-1)<=0)){var R,x=C[0],E=C[R],I;if(P1(x,E)){for(s.lineStart(),f=0;f<R;++f)s.point((x=C[f])[0],x[1]);s.lineEnd();return}u.push(I=new Xg(x,C,null,!0)),p.push(I.o=new Xg(x,null,I,!1)),u.push(I=new Xg(E,C,null,!1)),p.push(I.o=new Xg(E,null,I,!0))}}),!!u.length){for(p.sort(t),ON(u),ON(p),f=0,g=p.length;f<g;++f)p[f].e=e=!e;for(var m=u[0],v,w;;){for(var S=m,b=!0;S.v;)if((S=S.n)===m)return;v=S.z,s.lineStart();do{if(S.v=S.o.v=!0,S.e){if(b)for(f=0,g=v.length;f<g;++f)s.point((w=v[f])[0],w[1]);else o(S.x,S.n.x,1,s);S=S.n}else{if(b)for(v=S.p.z,f=v.length-1;f>=0;--f)s.point((w=v[f])[0],w[1]);else o(S.x,S.p.x,-1,s);S=S.p}S=S.o,v=S.z,b=!b}while(!S.v);s.lineEnd()}}}function ON(n){if(t=n.length){for(var t,e=0,o=n[0],s;++e<t;)o.n=s=n[e],s.p=o,o=s;o.n=s=n[0],s.p=o}}function sl(n,t){return n<t?-1:n>t?1:n>=t?0:NaN}function R1(n){return n.length===1&&(n=uJ(n)),{left:function(t,e,o,s){for(o==null&&(o=0),s==null&&(s=t.length);o<s;){var u=o+s>>>1;n(t[u],e)<0?o=u+1:s=u}return o},right:function(t,e,o,s){for(o==null&&(o=0),s==null&&(s=t.length);o<s;){var u=o+s>>>1;n(t[u],e)>0?s=u:o=u+1}return o}}}function uJ(n){return function(t,e){return sl(n(t),e)}}var DN=R1(sl),lJ=DN.right,cJ=DN.left;var FN=Array.prototype,hJ=FN.slice,pJ=FN.map;var pdt=Math.sqrt(50),ddt=Math.sqrt(10),gdt=Math.sqrt(2);function $g(n){for(var t=n.length,e,o=-1,s=0,u,p;++o<t;)s+=n[o].length;for(u=new Array(s);--t>=0;)for(p=n[t],e=p.length;--e>=0;)u[--s]=p[e];return u}var EJ=1e9,jgt=-EJ;var L1=Zo();function N1(n,t){var e=t[0],o=t[1],s=[un(e),-Xn(e),0],u=0,p=0;L1.reset();for(var f=0,g=n.length;f<g;++f)if(v=(m=n[f]).length)for(var m,v,w=m[v-1],S=w[0],b=w[1]/2+Vg,C=un(b),R=Xn(b),x=0;x<v;++x,S=I,C=F,R=V,w=E){var E=m[x],I=E[0],A=E[1]/2+Vg,F=un(A),V=Xn(A),X=I-S,q=X>=0?1:-1,D=q*X,xt=D>gr,B=C*F;if(L1.add(Jo(B*q*un(D),R*V+B*Xn(D))),u+=xt?X+q*Na:X,xt^S>=e^I>=e){var j=Fh(Zl(w),Zl(E));Uh(j);var K=Fh(s,j);Uh(K);var Dt=(xt^X>=0?-1:1)*Co(K[2]);(o>Dt||o===Dt&&(j[0]||j[1]))&&(p+=xt^X>=0?1:-1)}}return(u<-er||u<er&&L1<-er)^p&1}var umt=Zo();var Tmt=Zo(),Cmt=Zo();var MJ=1/0;var Rmt=-MJ;function O1(n){this._context=n}O1.prototype={_radius:4.5,pointRadius:function(n){return this._radius=n,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._context.closePath(),this._point=NaN},point:function(n,t){switch(this._point){case 0:{this._context.moveTo(n,t),this._point=1;break}case 1:{this._context.lineTo(n,t);break}default:{this._context.moveTo(n+this._radius,t),this._context.arc(n,t,this._radius,0,Na);break}}},result:aa};var kmt=Zo();function D1(){this._string=[]}D1.prototype={_radius:4.5,_circle:zN(4.5),pointRadius:function(n){return(n=+n)!==this._radius&&(this._radius=n,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._string.push("Z"),this._point=NaN},point:function(n,t){switch(this._point){case 0:{this._string.push("M",n,",",t),this._point=1;break}case 1:{this._string.push("L",n,",",t);break}default:{this._circle==null&&(this._circle=zN(this._radius)),this._string.push("M",n,",",t,this._circle);break}}},result:function(){if(this._string.length){var n=this._string.join("");return this._string=[],n}else return null}};function zN(n){return"m0,"+n+"a"+n+","+n+" 0 1,1 0,"+-2*n+"a"+n+","+n+" 0 1,1 0,"+2*n+"z"}function F1(n,t,e,o){return function(s,u){var p=t(u),f=s.invert(o[0],o[1]),g=C1(),m=t(g),v=!1,w,S,b,C={point:R,lineStart:E,lineEnd:I,polygonStart:function(){C.point=A,C.lineStart=F,C.lineEnd=V,S=[],w=[]},polygonEnd:function(){C.point=R,C.lineStart=E,C.lineEnd=I,S=$g(S);var X=N1(w,f);S.length?(v||(u.polygonStart(),v=!0),I1(S,TJ,X,e,u)):X&&(v||(u.polygonStart(),v=!0),u.lineStart(),e(null,null,1,u),u.lineEnd()),v&&(u.polygonEnd(),v=!1),S=w=null},sphere:function(){u.polygonStart(),u.lineStart(),e(null,null,1,u),u.lineEnd(),u.polygonEnd()}};function R(X,q){var D=s(X,q);n(X=D[0],q=D[1])&&u.point(X,q)}function x(X,q){var D=s(X,q);p.point(D[0],D[1])}function E(){C.point=x,p.lineStart()}function I(){C.point=R,p.lineEnd()}function A(X,q){b.push([X,q]);var D=s(X,q);m.point(D[0],D[1])}function F(){m.lineStart(),b=[]}function V(){A(b[0][0],b[0][1]),m.lineEnd();var X=m.clean(),q=g.result(),D,xt=q.length,B,j,K;if(b.pop(),w.push(b),b=null,!!xt){if(X&1){if(j=q[0],(B=j.length-1)>0){for(v||(u.polygonStart(),v=!0),u.lineStart(),D=0;D<B;++D)u.point((K=j[D])[0],K[1]);u.lineEnd()}return}xt>1&&X&2&&q.push(q.pop().concat(q.shift())),S.push(q.filter(AJ))}}return C}}function AJ(n){return n.length>1}function TJ(n,t){return((n=n.x)[0]<0?n[1]-Mi-er:Mi-n[1])-((t=t.x)[0]<0?t[1]-Mi-er:Mi-t[1])}var CJ=F1(function(){return!0},PJ,RJ,[-gr,-Mi]);function PJ(n){var t=NaN,e=NaN,o=NaN,s;return{lineStart:function(){n.lineStart(),s=1},point:function(u,p){var f=u>0?gr:-gr,g=Zr(u-t);Zr(g-gr)<er?(n.point(t,e=(e+p)/2>0?Mi:-Mi),n.point(o,e),n.lineEnd(),n.lineStart(),n.point(f,e),n.point(u,e),s=0):o!==f&&g>=gr&&(Zr(t-o)<er&&(t-=o*er),Zr(u-f)<er&&(u-=f*er),e=IJ(t,e,u,p),n.point(o,e),n.lineEnd(),n.lineStart(),n.point(f,e),s=0),n.point(t=u,e=p),o=f},lineEnd:function(){n.lineEnd(),t=e=NaN},clean:function(){return 2-s}}}function IJ(n,t,e,o){var s,u,p=un(n-e);return Zr(p)>er?sa((un(t)*(u=Xn(o))*un(e)-un(o)*(s=Xn(t))*un(n))/(s*u*p)):(t+o)/2}function RJ(n,t,e,o){var s;if(n==null)s=e*Mi,o.point(-gr,s),o.point(0,s),o.point(gr,s),o.point(gr,0),o.point(gr,-s),o.point(0,-s),o.point(-gr,-s),o.point(-gr,0),o.point(-gr,s);else if(Zr(n[0]-t[0])>er){var u=n[0]<t[0]?gr:-gr;s=e*u/2,o.point(-u,s),o.point(0,s),o.point(u,s)}else o.point(t[0],t[1])}function Zg(n){return function(t){var e=new U1;for(var o in n)e[o]=n[o];return e.stream=t,e}}function U1(){}U1.prototype={constructor:U1,point:function(n,t){this.stream.point(n,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var C0t=Xn(30*Ko);var q0t=Zg({point:function(n,t){this.stream.point(n*Ko,t*Ko)}});function Kg(n){return function(t,e){var o=Xn(t),s=Xn(e),u=n(o*s);return[u*s*un(t),u*un(e)]}}function Oa(n){return function(t,e){var o=ro(t*t+e*e),s=n(o),u=un(s),p=Xn(s);return[Jo(t*u,o*p),Co(o&&e*u/o)]}}var XN=Kg(function(n){return ro(2/(1+n))});XN.invert=Oa(function(n){return 2*Co(n/2)});var YN=Kg(function(n){return(n=T1(n))&&n/un(n)});YN.invert=Oa(function(n){return n});function B1(n,t){return[n,Oh(Dh((Mi+t)/2))]}B1.invert=function(n,t){return[n,2*sa(Wg(t))-Mi]};function Jg(n,t){return[n,t]}Jg.invert=Jg;function $N(n,t){var e=Xn(t),o=Xn(n)*e;return[e*un(n)/o,un(t)/o]}$N.invert=Oa(sa);function ZN(n,t){var e=t*t,o=e*e;return[n*(.8707-.131979*e+o*(-.013791+o*(.003971*e-.001529*o))),t*(1.007226+e*(.015085+o*(-.044475+.028874*e-.005916*o)))]}ZN.invert=function(n,t){var e=t,o=25,s;do{var u=e*e,p=u*u;e-=s=(e*(1.007226+u*(.015085+p*(-.044475+.028874*u-.005916*p)))-t)/(1.007226+u*(.015085*3+p*(-.044475*7+.028874*9*u-.005916*11*p)))}while(Zr(s)>er&&--o>0);return[n/(.8707+(u=e*e)*(-.131979+u*(-.013791+u*u*u*(.003971-.001529*u)))),e]};function KN(n,t){return[Xn(t)*un(n),un(t)]}KN.invert=Oa(Co);function JN(n,t){var e=Xn(t),o=1+Xn(n)*e;return[e*un(n)/o,un(t)/o]}JN.invert=Oa(function(n){return 2*sa(n)});function jN(n,t){return[Oh(Dh((Mi+t)/2)),-n]}jN.invert=function(n,t){return[-t,2*sa(Wg(n))-Mi]};var UJ=tn(yf(),1);var BJ=tn(yf(),1);var GJ=tn(yf(),1);var kJ=tn(yf(),1);function _f(n,t){return Math.sqrt((t[0]-n[0])**2+(t[1]-n[1])**2)}function t2(n){let t=0;for(let e=0;e<n.length-1;e++)t+=_f(n[e],n[e+1]);return t}var Ef=tn(e2(),1);var Ke="___",KJ=1e4;function gu(n){let t=new Map;return n.forEach((e,o)=>{t.set(o,new Map(e))}),t}var jg=class{setLiftPriority(t){this.lift_priority=t}isFacilityByType(t){return["facility","escalator","straightLadder","staircase","ramp","connectionPoint"].includes(t)}initFacilities(t){this.facilities=t.map(e=>{let o=[];try{o=JSON.parse(e.entry_end_floor)}catch(u){o=[]}let s=[];try{s=JSON.parse(e.entry_start_floor)}catch(u){s=[]}return eu({},e,{entry_start_floor:s,entry_end_floor:o})})}getParkingSpaceInfo(t,e){let o=""+t+Ke+e;var s;return(s=this.parkingMap.get(o))!=null?s:null}getNodeInfo(t,e){let o=""+t+Ke+e,s=this.nodeMap.get(o);if(!(s!=null&&s.length))return null;let u=this.pointMap.get(s[0]);return u!=null?u:null}initRoute(t,e){this.clear(),this.roadInfo=t,this.initFacilities(e);let o=new Date,s=o.getHours()*60+o.getMinutes();t.length&&(t.forEach(u=>{let p=(u.points||[]).filter(f=>!(0,Ef.isNil)(f.passWeight)&&f.passWeight!==1&&!(0,Ef.isNil)(f.coverageArea)&&f.coverageArea!==0);this.weightPointMap.set(u.floor,p),(u.points||[]).filter(f=>f.openStatus!==!1).filter(f=>{if(!f.startTime||!f.endTime)return!0;let[g,m]=f.startTime.split(":").map(C=>+C),[v,w]=f.endTime.split(":").map(C=>+C),S=g*60+m,b=v*60+w;return s>=S&&s<=b}).forEach(f=>{f.floor=u.floor;let g=""+u.floor+Ke+f.id,m=""+u.floor+Ke+f.nodeId,v=this.nodeMap.get(m)||[];if(v.push(""+u.floor+Ke+(f.relatedId||f.id)),this.nodeMap.set(""+u.floor+Ke+f.nodeId,v),this.pointMap.set(g,f),this.isFacilityByType(f.type)){let w=this.facilities.find(S=>S.id===+f.targetId);if(w){switch(w.entry_infra_type){case"straightLadder":if(w.entry_end_floor.find(x=>x.floor===u.floor)&&w.entry_start_floor.find(x=>x.floor===u.floor)){let x=this.straightLadderMap.get(f.targetId)||[];x.push(eu({},f)),this.straightLadderMap.set(f.targetId,x)}break;case"staircase":if(w.entry_end_floor.find(x=>x.floor===u.floor)&&w.entry_start_floor.find(x=>x.floor===u.floor)){let x=this.staircaseMap.get(f.targetId)||[];x.push(eu({},f)),this.staircaseMap.set(f.targetId,x)}break;case"escalator":let b=this.escalatorMap.get(f.targetId)||[];if(w.entry_start_floor.find(x=>x.floor===u.floor)){let x=b.find(E=>{var I;return((I=E.end)==null?void 0:I.floor)!==u.floor&&!E.start});x?x.start=f:b.push({start:f})}if(w.entry_end_floor.find(x=>x.floor===u.floor)){let x=b.find(E=>{var I;return((I=E.start)==null?void 0:I.floor)!==u.floor&&!E.end});x?x.end=f:b.push({end:f})}this.escalatorMap.set(f.targetId,b);break;case"ramp":let C=this.rampMap.get(f.targetId)||[];if(w.entry_start_floor.find(x=>x.floor===u.floor)){let x=C.find(E=>{var I;return((I=E.end)==null?void 0:I.floor)!==u.floor&&!E.start});x?x.start=f:C.push({start:f})}if(w.entry_end_floor.find(x=>x.floor===u.floor)){let x=C.find(E=>{var I;return((I=E.start)==null?void 0:I.floor)!==u.floor&&!E.end});x?x.end=f:C.push({end:f})}this.rampMap.set(f.targetId,C);break;case"connectionPoint":let R=this.connectionPointMap.get(f.targetId)||[];if(w.entry_start_floor.find(x=>x.floor===u.floor)){let x=R.find(E=>{var I;return((I=E.end)==null?void 0:I.floor)!==u.floor&&!E.start});x?x.start=f:R.push({start:f})}if(w.entry_end_floor.find(x=>x.floor===u.floor)){let x=R.find(E=>{var I;return((I=E.start)==null?void 0:I.floor)!==u.floor&&!E.end});x?x.end=f:R.push({end:f})}this.connectionPointMap.set(f.targetId,R);break}let S=this.facilityMap.get(f.targetId)||[];S.push(eu({},f)),this.facilityMap.set(f.targetId,S)}}f.type==="parkingSpace"&&f.name.split(/[,,]/).forEach(S=>{this.parkingMap.set(""+u.floor+Ke+S,f)})}),(u.lines||[]).filter(f=>f.to!==f.from).forEach(f=>{let g=""+u.floor+Ke+f.from,m=""+u.floor+Ke+f.to,v=this.pointMap.get(g),w=this.pointMap.get(m);if(!v||!w)return;let S=v.cds,b=w.cds,C=_f(S,b);if(!v.permission&&!w.permission){switch(f.direction){case"single-people":this.addLineItem(g,m,C);break;case"back-people":this.addLineItem(m,g,C);break;default:this.addLineItem(g,m,C),this.addLineItem(m,g,C)}switch(f.direction){case"double":this.addLineItem(g,m,C,this.forwardLineMap),this.addLineItem(m,g,C,this.forwardLineMap);break;case"single":this.addLineItem(g,m,C,this.forwardLineMap);break;case"back":this.addLineItem(m,g,C,this.forwardLineMap);break}(v.type==="parkingSpace"||w.type==="parkingSpace")&&f.direction==="noDir"&&(this.addLineItem(g,m,C,this.forwardLineMap),this.addLineItem(m,g,C,this.forwardLineMap))}else v.permission&&this.setPermissionLine(g,m,v.permission,C,"",f.direction),w.permission&&w.permission!==v.permission&&this.setPermissionLine(g,m,w.permission,C,"",f.direction)})}),this.addPermissionFacility(),this.initBaseRoute(),this.initEscalatorRoute(),this.initStraightLadderRoute(),this.initForwardRoute())}getPermissionMap(t){return this["permission_"+t]||(this["permission_"+t]=new Set),this["permission_"+t]}setPermissionLine(t,e,o,s,u,p){this.getPermissionMap(o).add({fromKey:t,toKey:e,distance:s,type:u,direction:p})}addPermissionFacility(){this.straightLadderMap.forEach((t,e)=>{if(t.length<2){this.straightLadderMap.delete(e);return}for(let o=0;o<t.length;o++){let s=""+t[o].floor+Ke+t[o].id,u=this.pointMap.get(s);if(u){for(let p=0;p<t.length;p++)if(o!==p){let f=""+t[p].floor+Ke+t[p].id,g=this.pointMap.get(f);if(!g)continue;u.permission&&this.setPermissionLine(s,f,u.permission,1,"straightLadder"),g.permission&&g.permission!==u.permission&&this.setPermissionLine(s,f,g.permission,1,"straightLadder")}}}}),this.staircaseMap.forEach((t,e)=>{if(t.length<2){this.staircaseMap.delete(e);return}for(let o=0;o<t.length;o++){let s=""+t[o].floor+Ke+t[o].id,u=this.pointMap.get(s);if(u){for(let p=0;p<t.length;p++)if(o!==p){let f=""+t[p].floor+Ke+t[p].id,g=this.pointMap.get(f);if(!g)continue;u.permission&&this.setPermissionLine(s,f,u.permission,1,"staircase"),g.permission&&g.permission!==u.permission&&this.setPermissionLine(s,f,g.permission,1,"staircase")}}}}),this.escalatorMap.forEach((t,e)=>{t.forEach(o=>{if(o.start&&o.end){let s=""+o.start.floor+Ke+o.start.id,u=""+o.end.floor+Ke+o.end.id,p=this.pointMap.get(s),f=this.pointMap.get(u);p&&f&&(p.permission&&this.setPermissionLine(s,u,p.permission,1,"escalator"),f.permission&&f.permission!==p.permission&&this.setPermissionLine(s,u,f.permission,1,"escalator"))}})}),this.rampMap.forEach((t,e)=>{t.forEach(o=>{if(o.start&&o.end){let s=""+o.start.floor+Ke+o.start.id,u=""+o.end.floor+Ke+o.end.id,p=this.pointMap.get(s),f=this.pointMap.get(u);p&&f&&(p.permission&&this.setPermissionLine(s,u,p.permission,10,"ramp"),f.permission&&f.permission!==p.permission&&this.setPermissionLine(s,u,f.permission,10,"ramp"))}})}),this.connectionPointMap.forEach((t,e)=>{t.forEach(o=>{if(o.start&&o.end){let s=""+o.start.floor+Ke+o.start.id,u=""+o.end.floor+Ke+o.end.id,p=this.pointMap.get(s),f=this.pointMap.get(u);p&&f&&(p.permission&&this.setPermissionLine(s,u,p.permission,1,"connectionPoint"),f.permission&&f.permission!==p.permission&&this.setPermissionLine(s,u,f.permission,1,"connectionPoint"))}})})}addPermissionLineToMap(t,e,o,s){this.getPermissionMap(t).forEach(p=>{if(e.includes(p.type))if(p.type==="")switch(p.direction){case"single":this.addLineItem(p.fromKey,p.toKey,p.distance,o);break;case"back":this.addLineItem(p.toKey,p.fromKey,p.distance,o);break;case"single-people":this.addLineItem(p.fromKey,p.toKey,p.distance,o);break;case"back-people":this.addLineItem(p.toKey,p.fromKey,p.distance,o);break;default:this.addLineItem(p.fromKey,p.toKey,p.distance,o),this.addLineItem(p.toKey,p.fromKey,p.distance,o);break}else this.addLineItem(p.fromKey,p.toKey,s.get(p.type),o)})}addLineItem(t,e,o,s){s===void 0&&(s=this.lineMap);let u=s.get(t)||new Map,p=this.pointMap.get(t),f=this.pointMap.get(e);if(!p||!f)return;let g=this.weightPointMap.get(p.floor)||[],m=this.weightPointMap.get(f.floor)||[];g.forEach(v=>{v.id===p.id&&(o=o/v.passWeight),_f(p.cds,v.cds)<=v.coverageArea&&(o=o/v.passWeight)}),m.forEach(v=>{v.id===f.id&&(o=o/v.passWeight),_f(f.cds,v.cds)<=v.coverageArea&&(o=o/v.passWeight)}),u.set(e,o),s.set(t,u)}addFacilityToLineMap(t,e,o,s){[...this.straightLadderMap,...this.staircaseMap].forEach(u=>{let[p,f]=u;if(!(f.length<2))for(let g=0;g<f.length;g++){let m=""+f[g].floor+Ke+f[g].id,v=this.pointMap.get(m);if(!(!v||v.permission)){for(let w=0;w<f.length;w++)if(g!==w){let S=""+f[w].floor+Ke+f[w].id,b=this.pointMap.get(S);if(!b||b.permission)continue;if(f[g].type==="straightLadder"){let C=e;this.addLineItem(m,S,C,s)}else{let C=o;this.addLineItem(m,S,C,s)}}}}}),this.escalatorMap.forEach((u,p)=>{u.forEach(f=>{if(f.start&&f.end){let g=""+f.start.floor+Ke+f.start.id,m=""+f.end.floor+Ke+f.end.id,v=this.pointMap.get(g),w=this.pointMap.get(m);if(v&&w&&!v.permission&&!w.permission){let S=t;this.addLineItem(g,m,S,s)}}})}),this.connectionPointMap.forEach((u,p)=>{u.forEach(f=>{if(f.start&&f.end){let g=""+f.start.floor+Ke+f.start.id,m=""+f.end.floor+Ke+f.end.id,v=this.pointMap.get(g),w=this.pointMap.get(m);v&&w&&!v.permission&&!w.permission&&this.addLineItem(g,m,100,s)}})})}initBaseRoute(){let t=new Map(gu(this.lineMap));this.addFacilityToLineMap(100,100*this.lift_priority,3e4,t),this.baseRoute=new Vi.default(t)}initEscalatorRoute(){let t=new Map(gu(this.lineMap)),e=1e4;this.addFacilityToLineMap(100,this.lift_priority*e,3e4*e,t),this.escalatorRoute=new Vi.default(t)}initStraightLadderRoute(){let t=new Map(gu(this.lineMap)),e=1e4;this.addFacilityToLineMap(3*e,300,3e4*e,t),this.straightLadderRoute=new Vi.default(t)}initForwardRoute(){this.rampMap.forEach((t,e)=>{t.forEach(o=>{if(o.start&&o.end){let s=""+o.start.floor+Ke+o.start.id,u=""+o.end.floor+Ke+o.end.id,p=this.pointMap.get(s),f=this.pointMap.get(u);p&&f&&!p.permission&&!f.permission&&this.addLineItem(s,u,10,this.forwardLineMap)}})}),this.connectionPointMap.forEach((t,e)=>{t.forEach(o=>{if(o.start&&o.end){let s=""+o.start.floor+Ke+o.start.id,u=""+o.end.floor+Ke+o.end.id,p=this.pointMap.get(s),f=this.pointMap.get(u);p&&f&&!p.permission&&!f.permission&&this.addLineItem(s,u,100,this.forwardLineMap)}})}),this.forwardRoute=new Vi.default(this.forwardLineMap)}addNoProofWeight(t,e){let o=(s,u)=>{let p=t.get(s),f=p==null?void 0:p.get(u);p&&!(0,Ef.isNil)(f)&&p.set(u,f*KJ)};this.roadInfo.forEach(s=>{(s.lines||[]).filter(u=>u.to!==u.from&&u[e]===!1).forEach(u=>{let p=""+s.floor+Ke+u.from,f=""+s.floor+Ke+u.to;switch(u.direction){case"single-people":o(p,f);break;case"back-people":o(f,p);break;default:o(p,f),o(f,p)}})})}getRouteByType(t){switch(t){case"escalator":return this.escalatorRoute;case"straightLadder":return this.straightLadderRoute;case"forward":return this.forwardRoute;default:return this.baseRoute}}getProofRoute(t,e,o){let s=""+t+Ke+e+Ke+o,u=this.proofRouteMap.get(s);if(u)return u;let p=new Map(gu(this.getRouteByType(t).graph));e&&this.addNoProofWeight(p,"sunProof"),o&&this.addNoProofWeight(p,"rain");let f=new Vi.default(p);return this.proofRouteMap.set(s,f),f}checkStart(t){return t.floor?t.parkingSpace?!0:!(!t.routePointId&&!t.nodeId&&(!t.coord||t.coord.length<2)):!1}checkEnd(t){return t.facility?!0:this.checkStart(t)}transformStart(t,e,o){o===void 0&&(o={});var s;if(t.routePointId)return[{floor:t.floor,id:t.routePointId}];if(t.floor&&t.parkingSpace){let u=this.getParkingSpaceInfo(t.floor,t.parkingSpace);if(u)return[{floor:u.floor,id:u.id}]}if(t.nodeId){let u=this.nodeMap.get(""+t.floor+Ke+t.nodeId);if(u!=null&&u.length)return u.map(p=>{let[f,g]=p.split(Ke);return{floor:f,id:g}})}if((s=t.coord)!=null&&s.length){let u=this.roadInfo.find(m=>m.floor===t.floor);if(!u)return null;let p=u.points.filter(m=>m.isStarted),f=u.points.filter(m=>{let v=""+m.floor+Ke+m.id;if(e==="forward"){if(!this.forwardLineMap.has(v)||o.adsorptionIntersection&&p.length&&!m.isStarted)return!1}else if(!this.lineMap.has(v))return!1;return!0});if(!f.length)return null;let g=f.reduce((m,v)=>{if(v.relatedId)return m;let w=_f(t.coord,v.cds);return w<m.min&&(m.min=w,m.point=v),m},{min:1/0,point:f[0]});return[{floor:u.floor,id:g.point.id}]}return null}transformEnd(t,e){if(t.routePointId&&t.floor)return[{floor:t.floor,id:t.routePointId}];if(t.floor){let o=this.transformStart(t,e);if(o)return o}if(t.facility){let s=this.facilities.filter(u=>+u.type_id==+t.facility).map(u=>u.id).map(u=>this.facilityMap.get(""+u)).flat(2);if(s!=null&&s.length)return{floor:t.floor,facility:t.facility}}return null}getPath(t,e,o,s,u,p){if(o===void 0&&(o=""),p===void 0&&(p={}),!this.checkStart(t))return"start-error";if(!this.checkEnd(e))return"end-error";let f=this.transformStart(t,o,p);if(!f)return"no-start";let g=this.transformEnd(e,o);if(!g)return"no-end";let m=[];if(Array.isArray(g))for(let R=0;R<f.length;R++){let x=f[R];for(let E=0;E<g.length;E++){let I=g[E];if(x.floor===I.floor&&x.id===I.id)return"near"}}else{m=this.facilities.filter(x=>+x.type_id==+e.facility).map(x=>x.id).map(x=>this.facilityMap.get(""+x)).flat(2).filter(x=>x).filter(x=>g.floor?x.floor===g.floor:!0);for(let x=0;x<f.length;x++){let E=f[x];for(let I=0;I<m.length;I++){let A=m[I];if(E.floor===A.floor&&E.id===A.id)return"near"}}}let v=Array.isArray(p.proof)?p.proof:p.proof?[p.proof]:[],w=o!=="forward"&&v.includes("sunProof"),S=o!=="forward"&&v.includes("rain"),b;switch(o){case"escalator":b=(R,x,E)=>this.getEscalatorPath(R,x,E,w,S);break;case"straightLadder":b=(R,x,E)=>this.getStraightLadderPath(R,x,E,w,S);break;case"forward":b=this.getForwardPath.bind(this);break;default:b=(R,x,E)=>this.getBasePath(R,x,E,w,S);break}let C=null;return f.forEach(R=>{if(Array.isArray(g))g.forEach(x=>{let E=b(R,x,s,u);E&&E&&(!C||E[0].consume<C[0].consume)&&(C=E)});else{if(!m.length)return null;let x=m.map(E=>b(R,{floor:E.floor,id:E.id},s,u)).filter(E=>!!E);C=x.reduce((E,I)=>{let A=I[0].consume;return A<E.distance&&(E.distance=A,E.path=I),E},{distance:1/0,path:x[0]}).path}}),C}getRoutePath(t,e,o){let s=""+t.floor+Ke+t.id,u=this.pointMap.get(s),p=""+e.floor+Ke+e.id,f=this.pointMap.get(p);if(!u||!f)return null;let g=""+u.floor+Ke+(u.relatedId||u.id),m=""+f.floor+Ke+(f.relatedId||f.id),v=o.path(g,m);if(!v)return null;let w=[],S=v.reduce((b,C,R,x)=>{if(R===0)return 0;let E=x[R-1],I=o.graph.get(E).get(C);return b+I},0);return v.map(b=>{let C=this.pointMap.get(b);if(C){var R;let{floor:x}=C,E=C.type;if(this.isFacilityByType(C.type)){let I=this.facilities.find(A=>A.id===+C.targetId);I&&(E=I.entry_infra_type)}if(((R=w[w.length-1])==null?void 0:R.floor)===x){let I=w[w.length-1];I.points.push(C.cds),I.pointInfos.push(C),I.endType=E,I.destId=C.nodeId,I.distance=t2(I.points)}else w.push({floor:x,points:[C.cds],pointInfos:[C],endType:E,destId:C.nodeId,distance:0,consume:S})}}),w}getBasePath(t,e,o,s,u){s===void 0&&(s=!1),u===void 0&&(u=!1);let p=s||u?this.getProofRoute("",s,u):this.baseRoute;if(!o)return this.getRoutePath(t,e,p);let f=gu(p.graph),g=v=>{this.addPermissionLineToMap(v,["","escalator","staircase","straightLadder","connectionPoint"],f,new Map([["escalator",100],["connectionPoint",100],["straightLadder",100*this.lift_priority],["staircase",3e4]]))};Array.isArray(o)?o.forEach(v=>{g(v)}):g(o);let m=new Vi.default(f);return this.getRoutePath(t,e,m)}getEscalatorPath(t,e,o,s,u){s===void 0&&(s=!1),u===void 0&&(u=!1);let p=s||u?this.getProofRoute("escalator",s,u):this.escalatorRoute;if(!o)return this.getRoutePath(t,e,p);let f=gu(p.graph),g=1e4,m=w=>{this.addPermissionLineToMap(w,["","escalator","staircase","straightLadder","connectionPoint"],f,new Map([["escalator",100],["connectionPoint",100],["straightLadder",this.lift_priority*g],["staircase",3e4*g]]))};Array.isArray(o)?o.forEach(w=>{m(w)}):m(o);let v=new Vi.default(f);return this.getRoutePath(t,e,v)}getStraightLadderPath(t,e,o,s,u){s===void 0&&(s=!1),u===void 0&&(u=!1);let p=s||u?this.getProofRoute("straightLadder",s,u):this.straightLadderRoute;if(!o)return this.getRoutePath(t,e,p);let f=gu(p.graph),g=1e4,m=w=>{this.addPermissionLineToMap(w,["","escalator","staircase","straightLadder","connectionPoint"],f,new Map([["escalator",3*g],["connectionPoint",100],["straightLadder",300],["staircase",3e4*g]]))};Array.isArray(o)?o.forEach(w=>{m(w)}):m(o);let v=new Vi.default(f);return this.getRoutePath(t,e,v)}getSunProofPath(t,e,o,s,u,p){return o===void 0&&(o=""),p===void 0&&(p={}),this.getPath(t,e,o,s,u,eu({},p,{proof:"sunProof"}))}getRainProofPath(t,e,o,s,u,p){return o===void 0&&(o=""),p===void 0&&(p={}),this.getPath(t,e,o,s,u,eu({},p,{proof:"rain"}))}getForwardPath(t,e,o,s){let u=new Map,p=b=>{let C=this.forwardRoute.graph.get(g);b.forEach(R=>{let x=C.get(R);(0,Ef.isNil)(x)||(u.set(R,x),C.delete(R))})},f=()=>{let b=this.forwardRoute.graph.get(g);u.forEach((C,R)=>{b.set(R,C)})},g=""+t.floor+Ke+t.id;if(!(0,Ef.isNil)(s)){let b=this.forwardLineMap.get(g),C=this.pointMap.get(g);if(C&&(b!=null&&b.size)&&b.size>1){let R=new Ye(C.cds[0],C.cds[1]),x=new Map;b.forEach((I,A)=>{let F=this.pointMap.get(A);if(F){let V=new Ye(F.cds[0],F.cds[1]),q=360-(new Ye().subVectors(V,R).angle()/Math.PI*180-90+360)%360;x.set(A,q)}});let E=Array.from(x).filter(I=>{let[A,F]=I;return Math.abs(F-s)<=60}).map(I=>{let[A]=I;return A});if(E.length)E.forEach(I=>x.delete(I)),p([...x.keys()]);else{let I=Array.from(x).reduce((A,F)=>{let V=Math.abs(F[1]-s);return V<A.diff?{diff:V,key:F[0]}:A},{diff:1/0,key:""});x.delete(I.key),p([...x.keys()])}}}if(!o){let b=this.getRoutePath(t,e,this.forwardRoute);return f(),b||this.getRoutePath(t,e,this.forwardRoute)}let m=gu(this.forwardRoute.graph),v=b=>{this.addPermissionLineToMap(b,["","ramp"],m,new Map([["ramp",10]]))};Array.isArray(o)?o.forEach(b=>{v(b)}):v(o);let w=new Vi.default(m),S=this.getRoutePath(t,e,w);if(f(),S)return S;{let b=gu(this.forwardRoute.graph);Array.isArray(o)?o.forEach(x=>{v(x)}):v(o);let C=new Vi.default(b);return this.getRoutePath(t,e,C)}}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 Vi.default,this.escalatorRoute=new Vi.default,this.straightLadderRoute=new Vi.default,this.proofRouteMap.clear()}constructor(t=3){this.lift_priority=t,this.roadInfo=[],this.facilities=[],this.pointMap=new Map,this.nodeMap=new Map,this.facilityMap=new Map,this.straightLadderMap=new Map,this.escalatorMap=new Map,this.rampMap=new Map,this.staircaseMap=new Map,this.connectionPointMap=new Map,this.parkingMap=new Map,this.lineMap=new Map,this.weightPointMap=new Map,this.baseRoute=new Vi.default,this.escalatorRoute=new Vi.default,this.straightLadderRoute=new Vi.default,this.forwardLineMap=new Map,this.forwardRoute=new Vi.default,this.proofRouteMap=new Map}};var Qg=class{setRoadData(t,e){this.roadNetwork.initRoute(t,e),this.roadReadyResolve(!0)}setRoadNetwork(t){this.roadNetwork=t}recommend(t,e,o,s,u){return Ru(this,null,function*(){yield this.roadReadyPromise;let p=e.reduce((v,w)=>(v[w.floor]?v[w.floor].push(w):v[w.floor]=[w],v),{}),f=this.roadNetwork.roadInfo.map(v=>v.floor),g=this.transformStart(t);if(!g)return null;let m=o?this.transformEnd(o):null;if(u){let v=e.filter(w=>{let S=this.roadNetwork.getParkingSpaceInfo(w.floor,w.lot_id);return S?S.parkingType===u:!1});if(v.length>0){let w=v.reduce((S,b)=>(S[b.floor]?S[b.floor].push(b):S[b.floor]=[b],S),{});if(m){let S=this.recommendByEnd(g,m,w,f,s);if(S)return S}else{let S=this.recommendByStart(g.floor,g.coord,g.routePointId,w,f,s);if(S)return S}}}return m?this.recommendByEnd(g,m,p,f,s):this.recommendByStart(g.floor,g.coord,g.routePointId,p,f,s)})}dispose(){this.roadNetwork.clear()}getFloorCarByDistance(t,e,o){let{floor:s,coord:u,routePointId:p}=t,f=null;return(e||[]).forEach(g=>{let m=this.roadNetwork.getPath({floor:s,coord:u,routePointId:p},{floor:g.floor,parkingSpace:g.lot_id},"forward",0,o);if(m==="near"){f={floor:g.floor,spaceNo:g.lot_id,distance:0};return}if(!m||typeof m=="string")return;let v={floor:g.floor,spaceNo:g.lot_id,distance:m[0].consume};f||(f=v),f.distance>v.distance&&(f=v)}),f}recommendByStart(t,e,o,s,u,p){let f=this.getFloorCarByDistance({floor:t,coord:e,routePointId:o},s[t],p);return f||this.recommendByStartNearFloor(t,e,o,s,u,p)}recommendByStartNearFloor(t,e,o,s,u,p){let f=u.indexOf(t);f===-1&&(f=u.length);let g=1,m=null;for(;g<=u.length;){if(u.filter((w,S)=>S===f-g||S===f+g).forEach(w=>{let S=this.getFloorCarByDistance({floor:t,coord:e,routePointId:o},s[w],p);m?S&&m.distance>S.distance&&(m=S):m=S}),m)return m;g++}return m}recommendByEnd(t,e,o,s,u){console.time("recommendByEnd");let p=this.recommendFloorCarByEndDistance(t,e,e.floor,o,u);if(p)return p;console.timeEnd("recommendByEnd"),console.time("recommendByStart");let f=this.recommendFloorCarByEndDistance(t,e,t.floor,o,u);return console.timeEnd("recommendByStart"),f||this.recommendByStartNearFloorAndEnd(t,e,t.floor,o,s,u)}recommendFloorCarByEndDistance(t,e,o,s,u){let p=s[o]||[];if(!p.length)return null;let f=null;return p.forEach(g=>{let m=this.roadNetwork.getParkingSpaceInfo(g.floor,g.lot_id);if(!m)return;console.time("path2");let v=this.roadNetwork.getPath({floor:g.floor,routePointId:m.id},e,"",0);if(console.timeEnd("path2"),v==="near"){f={floor:g.floor,spaceNo:g.lot_id,distance:0};return}if(!v||typeof v=="string")return;let w={floor:g.floor,spaceNo:g.lot_id,distance:v[0].consume},S={floor:g.floor,routePointId:m.id};if(f){if(f.distance>w.distance){console.count("forward");let b=this.roadNetwork.getPath(t,S,"forward",0,u);if(!b||typeof b=="string"&&b!=="near")return;f=w}}else{console.count("forward");let b=this.roadNetwork.getPath(t,S,"forward",0,u);if(!b||typeof b=="string"&&b!=="near")return;f=w}}),f}recommendByStartNearFloorAndEnd(t,e,o,s,u,p){let f=u.indexOf(o);f===-1&&(f=u.length);let g=1,m=null;for(;g<=u.length;){if(u.filter((w,S)=>S===f-g||S===f+g).forEach(w=>{let S=this.recommendFloorCarByEndDistance(t,e,w,s,p);m?S&&m.distance>S.distance&&(m=S):m=S}),m)return m;g++}return m}transformStart(t){if(t.routePointId)return{floor:t.floor,routePointId:t.routePointId};if(t.coord)return{floor:t.floor,coord:t.coord};if(t.nodeId){let e=this.roadNetwork.getNodeInfo(t.floor,t.nodeId);if(e)return{floor:e.floor,coord:e.cds}}return null}transformEnd(t){if(t.routePointId&&t.floor)return{floor:t.floor,routePointId:t.routePointId};if(t.coord)return{floor:t.floor,coord:t.coord};if(t.nodeId){let e=this.roadNetwork.getNodeInfo(t.floor,t.nodeId);if(e)return{floor:e.floor,coord:e.cds}}if(t.parkingSpace){let e=this.roadNetwork.getParkingSpaceInfo(t.floor,t.parkingSpace);if(e)return{floor:e.floor,coord:e.cds,routePointId:e.id}}return null}constructor(){this.roadNetwork=new jg,this.roadReadyPromise=new Promise(t=>{this.roadReadyResolve=t})}};var G1=new Qg;AA({onSetRoadInfo(n){let{roadData:t,facilities:e}=n;G1.setRoadData(t,e)},onRecommend(n){return Ru(this,null,function*(){let{start:t,end:e,travelDirection:o,carLotStatus:s,parkingType:u}=n;return G1.recommend(t,s,e,o,u)})},onClear(){G1.dispose()}});