@aibee/crc-bmap 0.13.18 → 0.13.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.cjs +20 -20
- package/lib/index.esm.min.js +16 -16
- package/lib/meta.json +84 -73
- package/lib/src/config.d.ts +1 -1
- package/lib/src/elements/poi2.d.ts +19 -1
- package/lib/src/factory/text-texture.d.ts +10 -0
- package/lib/src/utils/index-db.d.ts +1 -1
- package/lib/src/utils/string.d.ts +6 -0
- package/lib/worker/{cr-path.worker-ZDKDAMIB.js → cr-path.worker-RCWZ3ILJ.js} +16 -16
- package/lib/worker/lazy-indexdb-text-texture.worker-FBOQVHPE.js +3 -0
- package/lib/worker/lazy-indexdb-text-texture.worker-QOESQHP5.js +1 -0
- package/lib/worker/{loader.worker-IS25OEA2.js → loader.worker-2YT5X6XQ.js} +14 -14
- package/lib/worker/{merge-geometry.worker-67ZM4O2E.js → merge-geometry.worker-5R2BBSOQ.js} +10 -10
- package/lib/worker/{path.worker-E2G23DXJ.js → path.worker-DVQJOSTJ.js} +18 -18
- package/lib/worker/{recommend.worker-RHEDDLIV.js → recommend.worker-FFNYEN5G.js} +21 -21
- package/lib/worker/text-texture.worker-6IXOXREW.js +3 -0
- package/lib/worker/{text-texture.worker-WPZ6XUBC.js → text-texture.worker-U4G7IIG7.js} +1 -1
- package/package.json +1 -1
- package/lib/worker/lazy-indexdb-text-texture.worker-OWGTI3AK.js +0 -1
- package/lib/worker/lazy-indexdb-text-texture.worker-SA6GQYIP.js +0 -3
- package/lib/worker/text-texture.worker-R5BSUG6A.js +0 -3
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
var rC=Object.create;var Ey=Object.defineProperty;var iC=Object.getOwnPropertyDescriptor;var oC=Object.getOwnPropertyNames;var sC=Object.getPrototypeOf,aC=Object.prototype.hasOwnProperty;var nt=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports);var uC=(r,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of oC(t))!aC.call(r,a)&&a!==e&&Ey(r,a,{get:()=>t[a],enumerable:!(o=iC(t,a))||o.enumerable});return r};var yn=(r,t,e)=>(e=r!=null?rC(sC(r)):{},uC(t||!r||!r.__esModule?Ey(e,"default",{value:r,enumerable:!0}):e,r));var gc=(r,t,e)=>new Promise((o,a)=>{var l=p=>{try{f(e.next(p))}catch(d){a(d)}},h=p=>{try{f(e.throw(p))}catch(d){a(d)}},f=p=>p.done?o(p.value):Promise.resolve(p.value).then(l,h);f((e=e.apply(r,t)).next())});var Zr=nt((hp,My)=>{"use strict";var hl=function(r){return r&&r.Math===Math&&r};My.exports=hl(typeof globalThis=="object"&&globalThis)||hl(typeof window=="object"&&window)||hl(typeof self=="object"&&self)||hl(typeof global=="object"&&global)||hl(typeof hp=="object"&&hp)||function(){return this}()||Function("return this")()});var Ur=nt((Sq,Sy)=>{"use strict";Sy.exports=function(r){try{return!!r()}catch(t){return!0}}});var ro=nt((wq,wy)=>{"use strict";var lC=Ur();wy.exports=!lC(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7})});var yc=nt((bq,by)=>{"use strict";var cC=Ur();by.exports=!cC(function(){var r=function(){}.bind();return typeof r!="function"||r.hasOwnProperty("prototype")})});var Zo=nt((Tq,Ty)=>{"use strict";var fC=yc(),vc=Function.prototype.call;Ty.exports=fC?vc.bind(vc):function(){return vc.apply(vc,arguments)}});var Iy=nt(Py=>{"use strict";var Ay={}.propertyIsEnumerable,Cy=Object.getOwnPropertyDescriptor,hC=Cy&&!Ay.call({1:2},1);Py.f=hC?function(t){var e=Cy(this,t);return!!e&&e.enumerable}:Ay});var _c=nt((Cq,Ry)=>{"use strict";Ry.exports=function(r,t){return{enumerable:!(r&1),configurable:!(r&2),writable:!(r&4),value:t}}});var li=nt((Pq,Oy)=>{"use strict";var Ly=yc(),Ny=Function.prototype,pp=Ny.call,pC=Ly&&Ny.bind.bind(pp,pp);Oy.exports=Ly?pC:function(r){return function(){return pp.apply(r,arguments)}}});var pl=nt((Iq,Fy)=>{"use strict";var Dy=li(),dC=Dy({}.toString),mC=Dy("".slice);Fy.exports=function(r){return mC(dC(r),8,-1)}});var By=nt((Rq,Uy)=>{"use strict";var gC=li(),yC=Ur(),vC=pl(),dp=Object,_C=gC("".split);Uy.exports=yC(function(){return!dp("z").propertyIsEnumerable(0)})?function(r){return vC(r)==="String"?_C(r,""):dp(r)}:dp});var mp=nt((Lq,zy)=>{"use strict";zy.exports=function(r){return r==null}});var Ya=nt((Nq,Gy)=>{"use strict";var xC=mp(),EC=TypeError;Gy.exports=function(r){if(xC(r))throw new EC("Can't call method on "+r);return r}});var $a=nt((Oq,ky)=>{"use strict";var MC=By(),SC=Ya();ky.exports=function(r){return MC(SC(r))}});var Br=nt((Dq,qy)=>{"use strict";var gp=typeof document=="object"&&document.all;qy.exports=typeof gp=="undefined"&&gp!==void 0?function(r){return typeof r=="function"||r===gp}:function(r){return typeof r=="function"}});var bo=nt((Fq,Vy)=>{"use strict";var wC=Br();Vy.exports=function(r){return typeof r=="object"?r!==null:wC(r)}});var xc=nt((Uq,Hy)=>{"use strict";var yp=Zr(),bC=Br(),TC=function(r){return bC(r)?r:void 0};Hy.exports=function(r,t){return arguments.length<2?TC(yp[r]):yp[r]&&yp[r][t]}});var Xy=nt((Bq,Wy)=>{"use strict";var AC=li();Wy.exports=AC({}.isPrototypeOf)});var Jy=nt((zq,Zy)=>{"use strict";var CC=Zr(),Yy=CC.navigator,$y=Yy&&Yy.userAgent;Zy.exports=$y?String($y):""});var rv=nt((Gq,nv)=>{"use strict";var ev=Zr(),vp=Jy(),Ky=ev.process,jy=ev.Deno,Qy=Ky&&Ky.versions||jy&&jy.version,tv=Qy&&Qy.v8,io,Ec;tv&&(io=tv.split("."),Ec=io[0]>0&&io[0]<4?1:+(io[0]+io[1]));!Ec&&vp&&(io=vp.match(/Edge\/(\d+)/),(!io||io[1]>=74)&&(io=vp.match(/Chrome\/(\d+)/),io&&(Ec=+io[1])));nv.exports=Ec});var _p=nt((kq,ov)=>{"use strict";var iv=rv(),PC=Ur(),IC=Zr(),RC=IC.String;ov.exports=!!Object.getOwnPropertySymbols&&!PC(function(){var r=Symbol("symbol detection");return!RC(r)||!(Object(r)instanceof Symbol)||!Symbol.sham&&iv&&iv<41})});var xp=nt((qq,sv)=>{"use strict";var LC=_p();sv.exports=LC&&!Symbol.sham&&typeof Symbol.iterator=="symbol"});var Ep=nt((Vq,av)=>{"use strict";var NC=xc(),OC=Br(),DC=Xy(),FC=xp(),UC=Object;av.exports=FC?function(r){return typeof r=="symbol"}:function(r){var t=NC("Symbol");return OC(t)&&DC(t.prototype,UC(r))}});var lv=nt((Hq,uv)=>{"use strict";var BC=String;uv.exports=function(r){try{return BC(r)}catch(t){return"Object"}}});var Mp=nt((Wq,cv)=>{"use strict";var zC=Br(),GC=lv(),kC=TypeError;cv.exports=function(r){if(zC(r))return r;throw new kC(GC(r)+" is not a function")}});var Sp=nt((Xq,fv)=>{"use strict";var qC=Mp(),VC=mp();fv.exports=function(r,t){var e=r[t];return VC(e)?void 0:qC(e)}});var pv=nt((Yq,hv)=>{"use strict";var wp=Zo(),bp=Br(),Tp=bo(),HC=TypeError;hv.exports=function(r,t){var e,o;if(t==="string"&&bp(e=r.toString)&&!Tp(o=wp(e,r))||bp(e=r.valueOf)&&!Tp(o=wp(e,r))||t!=="string"&&bp(e=r.toString)&&!Tp(o=wp(e,r)))return o;throw new HC("Can't convert object to primitive value")}});var dl=nt(($q,dv)=>{"use strict";dv.exports=!1});var Mc=nt((Zq,gv)=>{"use strict";var mv=Zr(),WC=Object.defineProperty;gv.exports=function(r,t){try{WC(mv,r,{value:t,configurable:!0,writable:!0})}catch(e){mv[r]=t}return t}});var Sc=nt((Jq,_v)=>{"use strict";var XC=dl(),YC=Zr(),$C=Mc(),yv="__core-js_shared__",vv=_v.exports=YC[yv]||$C(yv,{});(vv.versions||(vv.versions=[])).push({version:"3.42.0",mode:XC?"pure":"global",copyright:"\xA9 2014-2025 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.42.0/LICENSE",source:"https://github.com/zloirock/core-js"})});var wc=nt((Kq,Ev)=>{"use strict";var xv=Sc();Ev.exports=function(r,t){return xv[r]||(xv[r]=t||{})}});var ml=nt((jq,Mv)=>{"use strict";var ZC=Ya(),JC=Object;Mv.exports=function(r){return JC(ZC(r))}});var To=nt((Qq,Sv)=>{"use strict";var KC=li(),jC=ml(),QC=KC({}.hasOwnProperty);Sv.exports=Object.hasOwn||function(t,e){return QC(jC(t),e)}});var Ap=nt((tV,wv)=>{"use strict";var tP=li(),eP=0,nP=Math.random(),rP=tP(1 .toString);wv.exports=function(r){return"Symbol("+(r===void 0?"":r)+")_"+rP(++eP+nP,36)}});var oo=nt((eV,Tv)=>{"use strict";var iP=Zr(),oP=wc(),bv=To(),sP=Ap(),aP=_p(),uP=xp(),Za=iP.Symbol,Cp=oP("wks"),lP=uP?Za.for||Za:Za&&Za.withoutSetter||sP;Tv.exports=function(r){return bv(Cp,r)||(Cp[r]=aP&&bv(Za,r)?Za[r]:lP("Symbol."+r)),Cp[r]}});var Iv=nt((nV,Pv)=>{"use strict";var cP=Zo(),Av=bo(),Cv=Ep(),fP=Sp(),hP=pv(),pP=oo(),dP=TypeError,mP=pP("toPrimitive");Pv.exports=function(r,t){if(!Av(r)||Cv(r))return r;var e=fP(r,mP),o;if(e){if(t===void 0&&(t="default"),o=cP(e,r,t),!Av(o)||Cv(o))return o;throw new dP("Can't convert object to primitive value")}return t===void 0&&(t="number"),hP(r,t)}});var Pp=nt((rV,Rv)=>{"use strict";var gP=Iv(),yP=Ep();Rv.exports=function(r){var t=gP(r,"string");return yP(t)?t:t+""}});var bc=nt((iV,Nv)=>{"use strict";var vP=Zr(),Lv=bo(),Ip=vP.document,_P=Lv(Ip)&&Lv(Ip.createElement);Nv.exports=function(r){return _P?Ip.createElement(r):{}}});var Rp=nt((oV,Ov)=>{"use strict";var xP=ro(),EP=Ur(),MP=bc();Ov.exports=!xP&&!EP(function(){return Object.defineProperty(MP("div"),"a",{get:function(){return 7}}).a!==7})});var Lp=nt(Fv=>{"use strict";var SP=ro(),wP=Zo(),bP=Iy(),TP=_c(),AP=$a(),CP=Pp(),PP=To(),IP=Rp(),Dv=Object.getOwnPropertyDescriptor;Fv.f=SP?Dv:function(t,e){if(t=AP(t),e=CP(e),IP)try{return Dv(t,e)}catch(o){}if(PP(t,e))return TP(!wP(bP.f,t,e),t[e])}});var Np=nt((aV,Uv)=>{"use strict";var RP=ro(),LP=Ur();Uv.exports=RP&&LP(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42})});var _s=nt((uV,Bv)=>{"use strict";var NP=bo(),OP=String,DP=TypeError;Bv.exports=function(r){if(NP(r))return r;throw new DP(OP(r)+" is not an object")}});var xs=nt(Gv=>{"use strict";var FP=ro(),UP=Rp(),BP=Np(),Tc=_s(),zv=Pp(),zP=TypeError,Op=Object.defineProperty,GP=Object.getOwnPropertyDescriptor,Dp="enumerable",Fp="configurable",Up="writable";Gv.f=FP?BP?function(t,e,o){if(Tc(t),e=zv(e),Tc(o),typeof t=="function"&&e==="prototype"&&"value"in o&&Up in o&&!o[Up]){var a=GP(t,e);a&&a[Up]&&(t[e]=o.value,o={configurable:Fp in o?o[Fp]:a[Fp],enumerable:Dp in o?o[Dp]:a[Dp],writable:!1})}return Op(t,e,o)}:Op:function(t,e,o){if(Tc(t),e=zv(e),Tc(o),UP)try{return Op(t,e,o)}catch(a){}if("get"in o||"set"in o)throw new zP("Accessors not supported");return"value"in o&&(t[e]=o.value),t}});var Ja=nt((cV,kv)=>{"use strict";var kP=ro(),qP=xs(),VP=_c();kv.exports=kP?function(r,t,e){return qP.f(r,t,VP(1,e))}:function(r,t,e){return r[t]=e,r}});var Gp=nt((fV,Vv)=>{"use strict";var Bp=ro(),HP=To(),qv=Function.prototype,WP=Bp&&Object.getOwnPropertyDescriptor,zp=HP(qv,"name"),XP=zp&&function(){}.name==="something",YP=zp&&(!Bp||Bp&&WP(qv,"name").configurable);Vv.exports={EXISTS:zp,PROPER:XP,CONFIGURABLE:YP}});var Wv=nt((hV,Hv)=>{"use strict";var $P=li(),ZP=Br(),kp=Sc(),JP=$P(Function.toString);ZP(kp.inspectSource)||(kp.inspectSource=function(r){return JP(r)});Hv.exports=kp.inspectSource});var $v=nt((pV,Yv)=>{"use strict";var KP=Zr(),jP=Br(),Xv=KP.WeakMap;Yv.exports=jP(Xv)&&/native code/.test(String(Xv))});var Ac=nt((dV,Jv)=>{"use strict";var QP=wc(),tI=Ap(),Zv=QP("keys");Jv.exports=function(r){return Zv[r]||(Zv[r]=tI(r))}});var Cc=nt((mV,Kv)=>{"use strict";Kv.exports={}});var Rc=nt((gV,t_)=>{"use strict";var eI=$v(),Qv=Zr(),nI=bo(),rI=Ja(),qp=To(),Vp=Sc(),iI=Ac(),oI=Cc(),jv="Object already initialized",Hp=Qv.TypeError,sI=Qv.WeakMap,Pc,gl,Ic,aI=function(r){return Ic(r)?gl(r):Pc(r,{})},uI=function(r){return function(t){var e;if(!nI(t)||(e=gl(t)).type!==r)throw new Hp("Incompatible receiver, "+r+" required");return e}};eI||Vp.state?(so=Vp.state||(Vp.state=new sI),so.get=so.get,so.has=so.has,so.set=so.set,Pc=function(r,t){if(so.has(r))throw new Hp(jv);return t.facade=r,so.set(r,t),t},gl=function(r){return so.get(r)||{}},Ic=function(r){return so.has(r)}):(oa=iI("state"),oI[oa]=!0,Pc=function(r,t){if(qp(r,oa))throw new Hp(jv);return t.facade=r,rI(r,oa,t),t},gl=function(r){return qp(r,oa)?r[oa]:{}},Ic=function(r){return qp(r,oa)});var so,oa;t_.exports={set:Pc,get:gl,has:Ic,enforce:aI,getterFor:uI}});var i_=nt((yV,r_)=>{"use strict";var Xp=li(),lI=Ur(),cI=Br(),Lc=To(),Wp=ro(),fI=Gp().CONFIGURABLE,hI=Wv(),n_=Rc(),pI=n_.enforce,dI=n_.get,e_=String,Nc=Object.defineProperty,mI=Xp("".slice),gI=Xp("".replace),yI=Xp([].join),vI=Wp&&!lI(function(){return Nc(function(){},"length",{value:8}).length!==8}),_I=String(String).split("String"),xI=r_.exports=function(r,t,e){mI(e_(t),0,7)==="Symbol("&&(t="["+gI(e_(t),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),e&&e.getter&&(t="get "+t),e&&e.setter&&(t="set "+t),(!Lc(r,"name")||fI&&r.name!==t)&&(Wp?Nc(r,"name",{value:t,configurable:!0}):r.name=t),vI&&e&&Lc(e,"arity")&&r.length!==e.arity&&Nc(r,"length",{value:e.arity});try{e&&Lc(e,"constructor")&&e.constructor?Wp&&Nc(r,"prototype",{writable:!1}):r.prototype&&(r.prototype=void 0)}catch(a){}var o=pI(r);return Lc(o,"source")||(o.source=yI(_I,typeof t=="string"?t:"")),r};Function.prototype.toString=xI(function(){return cI(this)&&dI(this).source||hI(this)},"toString")});var yl=nt((vV,o_)=>{"use strict";var EI=Br(),MI=xs(),SI=i_(),wI=Mc();o_.exports=function(r,t,e,o){o||(o={});var a=o.enumerable,l=o.name!==void 0?o.name:t;if(EI(e)&&SI(e,l,o),o.global)a?r[t]=e:wI(t,e);else{try{o.unsafe?r[t]&&(a=!0):delete r[t]}catch(h){}a?r[t]=e:MI.f(r,t,{value:e,enumerable:!1,configurable:!o.nonConfigurable,writable:!o.nonWritable})}return r}});var a_=nt((_V,s_)=>{"use strict";var bI=Math.ceil,TI=Math.floor;s_.exports=Math.trunc||function(t){var e=+t;return(e>0?TI:bI)(e)}});var vl=nt((xV,u_)=>{"use strict";var AI=a_();u_.exports=function(r){var t=+r;return t!==t||t===0?0:AI(t)}});var c_=nt((EV,l_)=>{"use strict";var CI=vl(),PI=Math.max,II=Math.min;l_.exports=function(r,t){var e=CI(r);return e<0?PI(e+t,0):II(e,t)}});var Yp=nt((MV,f_)=>{"use strict";var RI=vl(),LI=Math.min;f_.exports=function(r){var t=RI(r);return t>0?LI(t,9007199254740991):0}});var $p=nt((SV,h_)=>{"use strict";var NI=Yp();h_.exports=function(r){return NI(r.length)}});var m_=nt((wV,d_)=>{"use strict";var OI=$a(),DI=c_(),FI=$p(),p_=function(r){return function(t,e,o){var a=OI(t),l=FI(a);if(l===0)return!r&&-1;var h=DI(o,l),f;if(r&&e!==e){for(;l>h;)if(f=a[h++],f!==f)return!0}else for(;l>h;h++)if((r||h in a)&&a[h]===e)return r||h||0;return!r&&-1}};d_.exports={includes:p_(!0),indexOf:p_(!1)}});var Jp=nt((bV,y_)=>{"use strict";var UI=li(),Zp=To(),BI=$a(),zI=m_().indexOf,GI=Cc(),g_=UI([].push);y_.exports=function(r,t){var e=BI(r),o=0,a=[],l;for(l in e)!Zp(GI,l)&&Zp(e,l)&&g_(a,l);for(;t.length>o;)Zp(e,l=t[o++])&&(~zI(a,l)||g_(a,l));return a}});var Oc=nt((TV,v_)=>{"use strict";v_.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]});var x_=nt(__=>{"use strict";var kI=Jp(),qI=Oc(),VI=qI.concat("length","prototype");__.f=Object.getOwnPropertyNames||function(t){return kI(t,VI)}});var M_=nt(E_=>{"use strict";E_.f=Object.getOwnPropertySymbols});var w_=nt((PV,S_)=>{"use strict";var HI=xc(),WI=li(),XI=x_(),YI=M_(),$I=_s(),ZI=WI([].concat);S_.exports=HI("Reflect","ownKeys")||function(t){var e=XI.f($I(t)),o=YI.f;return o?ZI(e,o(t)):e}});var A_=nt((IV,T_)=>{"use strict";var b_=To(),JI=w_(),KI=Lp(),jI=xs();T_.exports=function(r,t,e){for(var o=JI(t),a=jI.f,l=KI.f,h=0;h<o.length;h++){var f=o[h];!b_(r,f)&&!(e&&b_(e,f))&&a(r,f,l(t,f))}}});var P_=nt((RV,C_)=>{"use strict";var QI=Ur(),tR=Br(),eR=/#|\.prototype\./,_l=function(r,t){var e=rR[nR(r)];return e===oR?!0:e===iR?!1:tR(t)?QI(t):!!t},nR=_l.normalize=function(r){return String(r).replace(eR,".").toLowerCase()},rR=_l.data={},iR=_l.NATIVE="N",oR=_l.POLYFILL="P";C_.exports=_l});var Fc=nt((LV,I_)=>{"use strict";var Dc=Zr(),sR=Lp().f,aR=Ja(),uR=yl(),lR=Mc(),cR=A_(),fR=P_();I_.exports=function(r,t){var e=r.target,o=r.global,a=r.stat,l,h,f,p,d,g;if(o?h=Dc:a?h=Dc[e]||lR(e,{}):h=Dc[e]&&Dc[e].prototype,h)for(f in t){if(d=t[f],r.dontCallGetSet?(g=sR(h,f),p=g&&g.value):p=h[f],l=fR(o?f:e+(a?".":"#")+f,r.forced),!l&&p!==void 0){if(typeof d==typeof p)continue;cR(d,p)}(r.sham||p&&p.sham)&&aR(d,"sham",!0),uR(h,f,d,r)}}});var L_=nt((NV,R_)=>{"use strict";var hR=pl();R_.exports=Array.isArray||function(t){return hR(t)==="Array"}});var O_=nt((OV,N_)=>{"use strict";var pR=ro(),dR=L_(),mR=TypeError,gR=Object.getOwnPropertyDescriptor,yR=pR&&!function(){if(this!==void 0)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(r){return r instanceof TypeError}}();N_.exports=yR?function(r,t){if(dR(r)&&!gR(r,"length").writable)throw new mR("Cannot set read only .length");return r.length=t}:function(r,t){return r.length=t}});var F_=nt((DV,D_)=>{"use strict";var vR=TypeError,_R=9007199254740991;D_.exports=function(r){if(r>_R)throw vR("Maximum allowed index exceeded");return r}});var Kp=nt(()=>{"use strict";var xR=Fc(),ER=ml(),MR=$p(),SR=O_(),wR=F_(),bR=Ur(),TR=bR(function(){return[].push.call({length:4294967296},1)!==4294967297}),AR=function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(r){return r instanceof TypeError}},CR=TR||!AR();xR({target:"Array",proto:!0,arity:1,forced:CR},{push:function(t){var e=ER(this),o=MR(e),a=arguments.length;wR(o+a);for(var l=0;l<a;l++)e[o]=arguments[l],o++;return SR(e,o),o}})});var B_=nt((BV,U_)=>{"use strict";U_.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}});var k_=nt((zV,G_)=>{"use strict";var PR=bc(),jp=PR("span").classList,z_=jp&&jp.constructor&&jp.constructor.prototype;G_.exports=z_===Object.prototype?void 0:z_});var V_=nt((GV,q_)=>{"use strict";var IR=Jp(),RR=Oc();q_.exports=Object.keys||function(t){return IR(t,RR)}});var W_=nt(H_=>{"use strict";var LR=ro(),NR=Np(),OR=xs(),DR=_s(),FR=$a(),UR=V_();H_.f=LR&&!NR?Object.defineProperties:function(t,e){DR(t);for(var o=FR(e),a=UR(e),l=a.length,h=0,f;l>h;)OR.f(t,f=a[h++],o[f]);return t}});var Y_=nt((qV,X_)=>{"use strict";var BR=xc();X_.exports=BR("document","documentElement")});var xl=nt((VV,tx)=>{"use strict";var zR=_s(),GR=W_(),$_=Oc(),kR=Cc(),qR=Y_(),VR=bc(),HR=Ac(),Z_=">",J_="<",td="prototype",ed="script",j_=HR("IE_PROTO"),Qp=function(){},Q_=function(r){return J_+ed+Z_+r+J_+"/"+ed+Z_},K_=function(r){r.write(Q_("")),r.close();var t=r.parentWindow.Object;return r=null,t},WR=function(){var r=VR("iframe"),t="java"+ed+":",e;return r.style.display="none",qR.appendChild(r),r.src=String(t),e=r.contentWindow.document,e.open(),e.write(Q_("document.F=Object")),e.close(),e.F},Uc,Bc=function(){try{Uc=new ActiveXObject("htmlfile")}catch(t){}Bc=typeof document!="undefined"?document.domain&&Uc?K_(Uc):WR():K_(Uc);for(var r=$_.length;r--;)delete Bc[td][$_[r]];return Bc()};kR[j_]=!0;tx.exports=Object.create||function(t,e){var o;return t!==null?(Qp[td]=zR(t),o=new Qp,Qp[td]=null,o[j_]=t):o=Bc(),e===void 0?o:GR.f(o,e)}});var nx=nt((HV,ex)=>{"use strict";var XR=oo(),YR=xl(),$R=xs().f,nd=XR("unscopables"),rd=Array.prototype;rd[nd]===void 0&&$R(rd,nd,{configurable:!0,value:YR(null)});ex.exports=function(r){rd[nd][r]=!0}});var zc=nt((WV,rx)=>{"use strict";rx.exports={}});var ox=nt((XV,ix)=>{"use strict";var ZR=Ur();ix.exports=!ZR(function(){function r(){}return r.prototype.constructor=null,Object.getPrototypeOf(new r)!==r.prototype})});var od=nt((YV,ax)=>{"use strict";var JR=To(),KR=Br(),jR=ml(),QR=Ac(),tL=ox(),sx=QR("IE_PROTO"),id=Object,eL=id.prototype;ax.exports=tL?id.getPrototypeOf:function(r){var t=jR(r);if(JR(t,sx))return t[sx];var e=t.constructor;return KR(e)&&t instanceof e?e.prototype:t instanceof id?eL:null}});var ld=nt(($V,cx)=>{"use strict";var nL=Ur(),rL=Br(),iL=bo(),oL=xl(),ux=od(),sL=yl(),aL=oo(),uL=dl(),ud=aL("iterator"),lx=!1,Jo,sd,ad;[].keys&&(ad=[].keys(),"next"in ad?(sd=ux(ux(ad)),sd!==Object.prototype&&(Jo=sd)):lx=!0);var lL=!iL(Jo)||nL(function(){var r={};return Jo[ud].call(r)!==r});lL?Jo={}:uL&&(Jo=oL(Jo));rL(Jo[ud])||sL(Jo,ud,function(){return this});cx.exports={IteratorPrototype:Jo,BUGGY_SAFARI_ITERATORS:lx}});var Gc=nt((ZV,hx)=>{"use strict";var cL=xs().f,fL=To(),hL=oo(),fx=hL("toStringTag");hx.exports=function(r,t,e){r&&!e&&(r=r.prototype),r&&!fL(r,fx)&&cL(r,fx,{configurable:!0,value:t})}});var dx=nt((JV,px)=>{"use strict";var pL=ld().IteratorPrototype,dL=xl(),mL=_c(),gL=Gc(),yL=zc(),vL=function(){return this};px.exports=function(r,t,e,o){var a=t+" Iterator";return r.prototype=dL(pL,{next:mL(+!o,e)}),gL(r,a,!1,!0),yL[a]=vL,r}});var gx=nt((KV,mx)=>{"use strict";var _L=li(),xL=Mp();mx.exports=function(r,t,e){try{return _L(xL(Object.getOwnPropertyDescriptor(r,t)[e]))}catch(o){}}});var vx=nt((jV,yx)=>{"use strict";var EL=bo();yx.exports=function(r){return EL(r)||r===null}});var xx=nt((QV,_x)=>{"use strict";var ML=vx(),SL=String,wL=TypeError;_x.exports=function(r){if(ML(r))return r;throw new wL("Can't set "+SL(r)+" as a prototype")}});var Mx=nt((tH,Ex)=>{"use strict";var bL=gx(),TL=bo(),AL=Ya(),CL=xx();Ex.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var r=!1,t={},e;try{e=bL(Object.prototype,"__proto__","set"),e(t,[]),r=t instanceof Array}catch(o){}return function(a,l){return AL(a),CL(l),TL(a)&&(r?e(a,l):a.__proto__=l),a}}():void 0)});var Nx=nt((eH,Lx)=>{"use strict";var PL=Fc(),IL=Zo(),kc=dl(),Ix=Gp(),RL=Br(),LL=dx(),Sx=od(),wx=Mx(),NL=Gc(),OL=Ja(),cd=yl(),DL=oo(),bx=zc(),Rx=ld(),FL=Ix.PROPER,UL=Ix.CONFIGURABLE,Tx=Rx.IteratorPrototype,qc=Rx.BUGGY_SAFARI_ITERATORS,El=DL("iterator"),Ax="keys",Ml="values",Cx="entries",Px=function(){return this};Lx.exports=function(r,t,e,o,a,l,h){LL(e,t,o);var f=function(y){if(y===a&&v)return v;if(!qc&&y&&y in g)return g[y];switch(y){case Ax:return function(){return new e(this,y)};case Ml:return function(){return new e(this,y)};case Cx:return function(){return new e(this,y)}}return function(){return new e(this)}},p=t+" Iterator",d=!1,g=r.prototype,x=g[El]||g["@@iterator"]||a&&g[a],v=!qc&&x||f(a),M=t==="Array"&&g.entries||x,b,T,_;if(M&&(b=Sx(M.call(new r)),b!==Object.prototype&&b.next&&(!kc&&Sx(b)!==Tx&&(wx?wx(b,Tx):RL(b[El])||cd(b,El,Px)),NL(b,p,!0,!0),kc&&(bx[p]=Px))),FL&&a===Ml&&x&&x.name!==Ml&&(!kc&&UL?OL(g,"name",Ml):(d=!0,v=function(){return IL(x,this)})),a)if(T={values:f(Ml),keys:l?v:f(Ax),entries:f(Cx)},h)for(_ in T)(qc||d||!(_ in g))&&cd(g,_,T[_]);else PL({target:t,proto:!0,forced:qc||d},T);return(!kc||h)&&g[El]!==v&&cd(g,El,v,{name:a}),bx[t]=v,T}});var Dx=nt((nH,Ox)=>{"use strict";Ox.exports=function(r,t){return{value:r,done:t}}});var kx=nt((rH,Gx)=>{"use strict";var BL=$a(),fd=nx(),Fx=zc(),Bx=Rc(),zL=xs().f,GL=Nx(),Vc=Dx(),kL=dl(),qL=ro(),zx="Array Iterator",VL=Bx.set,HL=Bx.getterFor(zx);Gx.exports=GL(Array,"Array",function(r,t){VL(this,{type:zx,target:BL(r),index:0,kind:t})},function(){var r=HL(this),t=r.target,e=r.index++;if(!t||e>=t.length)return r.target=null,Vc(void 0,!0);switch(r.kind){case"keys":return Vc(e,!1);case"values":return Vc(t[e],!1)}return Vc([e,t[e]],!1)},"values");var Ux=Fx.Arguments=Fx.Array;fd("keys");fd("values");fd("entries");if(!kL&&qL&&Ux.name!=="values")try{zL(Ux,"name",{value:"values"})}catch(r){}});var Wc=nt(()=>{"use strict";var qx=Zr(),Hx=B_(),WL=k_(),Sl=kx(),Vx=Ja(),XL=Gc(),YL=oo(),hd=YL("iterator"),pd=Sl.values,Wx=function(r,t){if(r){if(r[hd]!==pd)try{Vx(r,hd,pd)}catch(o){r[hd]=pd}if(XL(r,t,!0),Hx[t]){for(var e in Sl)if(r[e]!==Sl[e])try{Vx(r,e,Sl[e])}catch(o){r[e]=Sl[e]}}}};for(Hc in Hx)Wx(qx[Hc]&&qx[Hc].prototype,Hc);var Hc;Wx(WL,"DOMTokenList")});var $x=nt((sH,Yx)=>{"use strict";var $L=oo(),ZL=$L("toStringTag"),Xx={};Xx[ZL]="z";Yx.exports=String(Xx)==="[object z]"});var Jx=nt((aH,Zx)=>{"use strict";var JL=$x(),KL=Br(),Xc=pl(),jL=oo(),QL=jL("toStringTag"),tN=Object,eN=Xc(function(){return arguments}())==="Arguments",nN=function(r,t){try{return r[t]}catch(e){}};Zx.exports=JL?Xc:function(r){var t,e,o;return r===void 0?"Undefined":r===null?"Null":typeof(e=nN(t=tN(r),QL))=="string"?e:eN?Xc(t):(o=Xc(t))==="Object"&&KL(t.callee)?"Arguments":o}});var Yc=nt((uH,Kx)=>{"use strict";var rN=Jx(),iN=String;Kx.exports=function(r){if(rN(r)==="Symbol")throw new TypeError("Cannot convert a Symbol value to a string");return iN(r)}});var Qx=nt((lH,jx)=>{"use strict";var oN=_s();jx.exports=function(){var r=oN(this),t="";return r.hasIndices&&(t+="d"),r.global&&(t+="g"),r.ignoreCase&&(t+="i"),r.multiline&&(t+="m"),r.dotAll&&(t+="s"),r.unicode&&(t+="u"),r.unicodeSets&&(t+="v"),r.sticky&&(t+="y"),t}});var e1=nt((cH,t1)=>{"use strict";var dd=Ur(),sN=Zr(),md=sN.RegExp,gd=dd(function(){var r=md("a","y");return r.lastIndex=2,r.exec("abcd")!==null}),aN=gd||dd(function(){return!md("a","y").sticky}),uN=gd||dd(function(){var r=md("^r","gy");return r.lastIndex=2,r.exec("str")!==null});t1.exports={BROKEN_CARET:uN,MISSED_STICKY:aN,UNSUPPORTED_Y:gd}});var r1=nt((fH,n1)=>{"use strict";var lN=Ur(),cN=Zr(),fN=cN.RegExp;n1.exports=lN(function(){var r=fN(".","s");return!(r.dotAll&&r.test(`
|
|
2
|
-
`)&&r.flags==="s")})});var o1=nt((hH,i1)=>{"use strict";var hN=Ur(),pN=Zr(),dN=pN.RegExp;i1.exports=hN(function(){var r=dN("(?<a>b)","g");return r.exec("b").groups.a!=="b"||"b".replace(r,"$<a>c")!=="bc"})});var
|
|
3
|
-
`)&&(_="(?: "+_+")",A=" "+A,y++),f=new RegExp("^(?:"+_+")",T)),xd&&(f=new RegExp("^"+_+"$(?!\\s)",T)),_d&&(p=e.lastIndex),d=Ka($c,b?f:e,A),b?d?(d.input=yd(d.input,y),d[0]=yd(d[0],y),d.index=e.lastIndex,e.lastIndex+=d[0].length):e.lastIndex=0:_d&&d&&(e.lastIndex=e.global?d.index+d[0].length:p),xd&&d&&d.length>1&&Ka(SN,d[0],f,function(){for(g=1;g<arguments.length-2;g++)arguments[g]===void 0&&(d[g]=void 0)}),d&&M)for(d.groups=x=_N(null),g=0;g<M.length;g++)v=M[g],x[v[0]]=d[v[1]];return d});a1.exports=vd});var Kc=nt(()=>{"use strict";var CN=Fc(),u1=Jc();CN({target:"RegExp",proto:!0,forced:/./.exec!==u1},{exec:u1})});var c1=nt((gH,l1)=>{var Ed=class{constructor(){this.keys=new Set,this.queue=[]}sort(){this.queue.sort((t,e)=>t.priority-e.priority)}set(t,e){let o=Number(e);if(isNaN(o))throw new TypeError('"priority" must be a number');return this.keys.has(t)?this.queue.map(a=>(a.key===t&&Object.assign(a,{priority:o}),a)):(this.keys.add(t),this.queue.push({key:t,priority:o})),this.sort(),this.queue.length}next(){let t=this.queue.shift();return this.keys.delete(t.key),t}isEmpty(){return this.queue.length===0}has(t){return this.keys.has(t)}get(t){return this.queue.find(e=>e.key===t)}};l1.exports=Ed});var p1=nt((yH,h1)=>{function f1(r,t){let e=new Map;for(let[o,a]of r)o!==t&&a instanceof Map?e.set(o,f1(a,t)):o!==t&&e.set(o,a);return e}h1.exports=f1});var g1=nt((vH,m1)=>{function PN(r){let t=Number(r);return!(isNaN(t)||t<=0)}function d1(r){let t=new Map;return Object.keys(r).forEach(o=>{let a=r[o];if(a!==null&&typeof a=="object"&&!Array.isArray(a))return t.set(o,d1(a));if(!PN(a))throw new Error(`Could not add node at key "${o}", make sure it's a valid node`,a);return t.set(o,Number(a))}),t}m1.exports=d1});var _1=nt((_H,v1)=>{function y1(r){if(!(r instanceof Map))throw new Error(`Invalid graph: Expected Map instead found ${typeof r}`);r.forEach((t,e)=>{if(typeof t=="object"&&t instanceof Map){y1(t);return}if(typeof t!="number"||t<=0)throw new Error(`Values must be numbers greater than 0. Found value ${t} at ${e}`)})}v1.exports=y1});var S1=nt((xH,M1)=>{var IN=c1(),RN=p1(),x1=g1(),E1=_1(),Md=class{constructor(t){t instanceof Map?(E1(t),this.graph=t):t?this.graph=x1(t):this.graph=new Map}addNode(t,e){let o;return e instanceof Map?(E1(e),o=e):o=x1(e),this.graph.set(t,o),this}addVertex(t,e){return this.addNode(t,e)}removeNode(t){return this.graph=RN(this.graph,t),this}path(t,e,o={}){if(!this.graph.size)return o.cost?{path:null,cost:0}:null;let a=new Set,l=new IN,h=new Map,f=[],p=0,d=[];if(o.avoid&&(d=[].concat(o.avoid)),d.includes(t))throw new Error(`Starting node (${t}) cannot be avoided`);if(d.includes(e))throw new Error(`Ending node (${e}) cannot be avoided`);for(l.set(t,0);!l.isEmpty();){let g=l.next();if(g.key===e){p=g.priority;let v=g.key;for(;h.has(v);)f.push(v),v=h.get(v);break}a.add(g.key),(this.graph.get(g.key)||new Map).forEach((v,M)=>{if(a.has(M)||d.includes(M))return null;if(!l.has(M))return h.set(M,g.key),l.set(M,g.priority+v);let b=l.get(M).priority,T=g.priority+v;return T<b?(h.set(M,g.key),l.set(M,T)):null})}return f.length?(o.trim?f.shift():f=f.concat([t]),o.reverse||(f=f.reverse()),o.cost?{path:f,cost:p}:f):o.cost?{path:null,cost:0}:null}shortestPath(...t){return this.path(...t)}};M1.exports=Md});var Zf=nt((LH,_M)=>{"use strict";var vM=Object.getOwnPropertySymbols,VU=Object.prototype.hasOwnProperty,HU=Object.prototype.propertyIsEnumerable;function WU(r){if(r==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(r)}function XU(){try{if(!Object.assign)return!1;var r=new String("abc");if(r[5]="de",Object.getOwnPropertyNames(r)[0]==="5")return!1;for(var t={},e=0;e<10;e++)t["_"+String.fromCharCode(e)]=e;var o=Object.getOwnPropertyNames(t).map(function(l){return t[l]});if(o.join("")!=="0123456789")return!1;var a={};return"abcdefghijklmnopqrst".split("").forEach(function(l){a[l]=l}),Object.keys(Object.assign({},a)).join("")==="abcdefghijklmnopqrst"}catch(l){return!1}}_M.exports=XU()?Object.assign:function(r,t){for(var e,o=WU(r),a,l=1;l<arguments.length;l++){e=Object(arguments[l]);for(var h in e)VU.call(e,h)&&(o[h]=e[h]);if(vM){a=vM(e);for(var f=0;f<a.length;f++)HU.call(e,a[f])&&(o[a[f]]=e[a[f]])}}return o}});var ng=nt((tg,eg)=>{(function(r,t){typeof tg=="object"&&typeof eg!="undefined"?eg.exports=t():typeof define=="function"&&define.amd?define(t):(r=r||self).RBush=t()})(tg,function(){"use strict";function r(_,y,A,S,L){(function G(z,F,I,ut,R){for(;ut>I;){if(ut-I>600){var W=ut-I+1,V=F-I+1,Mt=Math.log(W),X=.5*Math.exp(2*Mt/3),mt=.5*Math.sqrt(Mt*X*(W-X)/W)*(V-W/2<0?-1:1),dt=Math.max(I,Math.floor(F-V*X/W+mt)),_t=Math.min(ut,Math.floor(F+(W-V)*X/W+mt));G(z,F,dt,_t,R)}var it=z[F],lt=I,H=ut;for(t(z,I,F),R(z[ut],it)>0&&t(z,I,ut);lt<H;){for(t(z,lt,H),lt++,H--;R(z[lt],it)<0;)lt++;for(;R(z[H],it)>0;)H--}R(z[I],it)===0?t(z,I,H):t(z,++H,ut),H<=F&&(I=H+1),F<=H&&(ut=H-1)}})(_,y,A||0,S||_.length-1,L||e)}function t(_,y,A){var S=_[y];_[y]=_[A],_[A]=S}function e(_,y){return _<y?-1:_>y?1:0}var o=function(_){_===void 0&&(_=9),this._maxEntries=Math.max(4,_),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function a(_,y,A){if(!A)return y.indexOf(_);for(var S=0;S<y.length;S++)if(A(_,y[S]))return S;return-1}function l(_,y){h(_,0,_.children.length,y,_)}function h(_,y,A,S,L){L||(L=b(null)),L.minX=1/0,L.minY=1/0,L.maxX=-1/0,L.maxY=-1/0;for(var G=y;G<A;G++){var z=_.children[G];f(L,_.leaf?S(z):z)}return L}function f(_,y){return _.minX=Math.min(_.minX,y.minX),_.minY=Math.min(_.minY,y.minY),_.maxX=Math.max(_.maxX,y.maxX),_.maxY=Math.max(_.maxY,y.maxY),_}function p(_,y){return _.minX-y.minX}function d(_,y){return _.minY-y.minY}function g(_){return(_.maxX-_.minX)*(_.maxY-_.minY)}function x(_){return _.maxX-_.minX+(_.maxY-_.minY)}function v(_,y){return _.minX<=y.minX&&_.minY<=y.minY&&y.maxX<=_.maxX&&y.maxY<=_.maxY}function M(_,y){return y.minX<=_.maxX&&y.minY<=_.maxY&&y.maxX>=_.minX&&y.maxY>=_.minY}function b(_){return{children:_,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function T(_,y,A,S,L){for(var G=[y,A];G.length;)if(!((A=G.pop())-(y=G.pop())<=S)){var z=y+Math.ceil((A-y)/S/2)*S;r(_,z,y,A,L),G.push(y,z,z,A)}}return o.prototype.all=function(){return this._all(this.data,[])},o.prototype.search=function(_){var y=this.data,A=[];if(!M(_,y))return A;for(var S=this.toBBox,L=[];y;){for(var G=0;G<y.children.length;G++){var z=y.children[G],F=y.leaf?S(z):z;M(_,F)&&(y.leaf?A.push(z):v(_,F)?this._all(z,A):L.push(z))}y=L.pop()}return A},o.prototype.collides=function(_){var y=this.data;if(!M(_,y))return!1;for(var A=[];y;){for(var S=0;S<y.children.length;S++){var L=y.children[S],G=y.leaf?this.toBBox(L):L;if(M(_,G)){if(y.leaf||v(_,G))return!0;A.push(L)}}y=A.pop()}return!1},o.prototype.load=function(_){if(!_||!_.length)return this;if(_.length<this._minEntries){for(var y=0;y<_.length;y++)this.insert(_[y]);return this}var A=this._build(_.slice(),0,_.length-1,0);if(this.data.children.length)if(this.data.height===A.height)this._splitRoot(this.data,A);else{if(this.data.height<A.height){var S=this.data;this.data=A,A=S}this._insert(A,this.data.height-A.height-1,!0)}else this.data=A;return this},o.prototype.insert=function(_){return _&&this._insert(_,this.data.height-1),this},o.prototype.clear=function(){return this.data=b([]),this},o.prototype.remove=function(_,y){if(!_)return this;for(var A,S,L,G=this.data,z=this.toBBox(_),F=[],I=[];G||F.length;){if(G||(G=F.pop(),S=F[F.length-1],A=I.pop(),L=!0),G.leaf){var ut=a(_,G.children,y);if(ut!==-1)return G.children.splice(ut,1),F.push(G),this._condense(F),this}L||G.leaf||!v(G,z)?S?(A++,G=S.children[A],L=!1):G=null:(F.push(G),I.push(A),A=0,S=G,G=G.children[0])}return this},o.prototype.toBBox=function(_){return _},o.prototype.compareMinX=function(_,y){return _.minX-y.minX},o.prototype.compareMinY=function(_,y){return _.minY-y.minY},o.prototype.toJSON=function(){return this.data},o.prototype.fromJSON=function(_){return this.data=_,this},o.prototype._all=function(_,y){for(var A=[];_;)_.leaf?y.push.apply(y,_.children):A.push.apply(A,_.children),_=A.pop();return y},o.prototype._build=function(_,y,A,S){var L,G=A-y+1,z=this._maxEntries;if(G<=z)return l(L=b(_.slice(y,A+1)),this.toBBox),L;S||(S=Math.ceil(Math.log(G)/Math.log(z)),z=Math.ceil(G/Math.pow(z,S-1))),(L=b([])).leaf=!1,L.height=S;var F=Math.ceil(G/z),I=F*Math.ceil(Math.sqrt(z));T(_,y,A,I,this.compareMinX);for(var ut=y;ut<=A;ut+=I){var R=Math.min(ut+I-1,A);T(_,ut,R,F,this.compareMinY);for(var W=ut;W<=R;W+=F){var V=Math.min(W+F-1,R);L.children.push(this._build(_,W,V,S-1))}}return l(L,this.toBBox),L},o.prototype._chooseSubtree=function(_,y,A,S){for(;S.push(y),!y.leaf&&S.length-1!==A;){for(var L=1/0,G=1/0,z=void 0,F=0;F<y.children.length;F++){var I=y.children[F],ut=g(I),R=(W=_,V=I,(Math.max(V.maxX,W.maxX)-Math.min(V.minX,W.minX))*(Math.max(V.maxY,W.maxY)-Math.min(V.minY,W.minY))-ut);R<G?(G=R,L=ut<L?ut:L,z=I):R===G&&ut<L&&(L=ut,z=I)}y=z||y.children[0]}var W,V;return y},o.prototype._insert=function(_,y,A){var S=A?_:this.toBBox(_),L=[],G=this._chooseSubtree(S,this.data,y,L);for(G.children.push(_),f(G,S);y>=0&&L[y].children.length>this._maxEntries;)this._split(L,y),y--;this._adjustParentBBoxes(S,L,y)},o.prototype._split=function(_,y){var A=_[y],S=A.children.length,L=this._minEntries;this._chooseSplitAxis(A,L,S);var G=this._chooseSplitIndex(A,L,S),z=b(A.children.splice(G,A.children.length-G));z.height=A.height,z.leaf=A.leaf,l(A,this.toBBox),l(z,this.toBBox),y?_[y-1].children.push(z):this._splitRoot(A,z)},o.prototype._splitRoot=function(_,y){this.data=b([_,y]),this.data.height=_.height+1,this.data.leaf=!1,l(this.data,this.toBBox)},o.prototype._chooseSplitIndex=function(_,y,A){for(var S,L,G,z,F,I,ut,R=1/0,W=1/0,V=y;V<=A-y;V++){var Mt=h(_,0,V,this.toBBox),X=h(_,V,A,this.toBBox),mt=(L=Mt,G=X,z=void 0,F=void 0,I=void 0,ut=void 0,z=Math.max(L.minX,G.minX),F=Math.max(L.minY,G.minY),I=Math.min(L.maxX,G.maxX),ut=Math.min(L.maxY,G.maxY),Math.max(0,I-z)*Math.max(0,ut-F)),dt=g(Mt)+g(X);mt<R?(R=mt,S=V,W=dt<W?dt:W):mt===R&&dt<W&&(W=dt,S=V)}return S||A-y},o.prototype._chooseSplitAxis=function(_,y,A){var S=_.leaf?this.compareMinX:p,L=_.leaf?this.compareMinY:d;this._allDistMargin(_,y,A,S)<this._allDistMargin(_,y,A,L)&&_.children.sort(S)},o.prototype._allDistMargin=function(_,y,A,S){_.children.sort(S);for(var L=this.toBBox,G=h(_,0,y,L),z=h(_,A-y,A,L),F=x(G)+x(z),I=y;I<A-y;I++){var ut=_.children[I];f(G,_.leaf?L(ut):ut),F+=x(G)}for(var R=A-y-1;R>=y;R--){var W=_.children[R];f(z,_.leaf?L(W):W),F+=x(z)}return F},o.prototype._adjustParentBBoxes=function(_,y,A){for(var S=A;S>=0;S--)f(y[S],_)},o.prototype._condense=function(_){for(var y=_.length-1,A=void 0;y>=0;y--)_[y].children.length===0?y>0?(A=_[y-1].children).splice(A.indexOf(_[y]),1):this.clear():l(_[y],this.toBBox)},o})});var xM=nt((rg,ig)=>{(function(r,t){typeof rg=="object"&&typeof ig!="undefined"?ig.exports=t():typeof define=="function"&&define.amd?define(t):(r=r||self,r.TinyQueue=t())})(rg,function(){"use strict";var r=function(o,a){if(o===void 0&&(o=[]),a===void 0&&(a=t),this.data=o,this.length=this.data.length,this.compare=a,this.length>0)for(var l=(this.length>>1)-1;l>=0;l--)this._down(l)};r.prototype.push=function(o){this.data.push(o),this.length++,this._up(this.length-1)},r.prototype.pop=function(){if(this.length!==0){var o=this.data[0],a=this.data.pop();return this.length--,this.length>0&&(this.data[0]=a,this._down(0)),o}},r.prototype.peek=function(){return this.data[0]},r.prototype._up=function(o){for(var a=this,l=a.data,h=a.compare,f=l[o];o>0;){var p=o-1>>1,d=l[p];if(h(f,d)>=0)break;l[o]=d,o=p}l[o]=f},r.prototype._down=function(o){for(var a=this,l=a.data,h=a.compare,f=this.length>>1,p=l[o];o<f;){var d=(o<<1)+1,g=l[d],x=d+1;if(x<this.length&&h(l[x],g)<0&&(d=x,g=l[x]),h(g,p)>=0)break;l[o]=g,o=d}l[o]=p};function t(e,o){return e<o?-1:e>o?1:0}return r})});var MM=nt((BH,EM)=>{EM.exports=function(t,e,o,a){var l=t[0],h=t[1],f=!1;o===void 0&&(o=0),a===void 0&&(a=e.length);for(var p=(a-o)/2,d=0,g=p-1;d<p;g=d++){var x=e[o+d*2+0],v=e[o+d*2+1],M=e[o+g*2+0],b=e[o+g*2+1],T=v>h!=b>h&&l<(M-x)*(h-v)/(b-v)+x;T&&(f=!f)}return f}});var wM=nt((zH,SM)=>{SM.exports=function(t,e,o,a){var l=t[0],h=t[1],f=!1;o===void 0&&(o=0),a===void 0&&(a=e.length);for(var p=a-o,d=0,g=p-1;d<p;g=d++){var x=e[d+o][0],v=e[d+o][1],M=e[g+o][0],b=e[g+o][1],T=v>h!=b>h&&l<(M-x)*(h-v)/(b-v)+x;T&&(f=!f)}return f}});var AM=nt((GH,jf)=>{var bM=MM(),TM=wM();jf.exports=function(t,e,o,a){return e.length>0&&Array.isArray(e[0])?TM(t,e,o,a):bM(t,e,o,a)};jf.exports.nested=TM;jf.exports.flat=bM});var PM=nt((Qf,CM)=>{(function(r,t){typeof Qf=="object"&&typeof CM!="undefined"?t(Qf):typeof define=="function"&&define.amd?define(["exports"],t):t((r=r||self).predicates={})})(Qf,function(r){"use strict";let e=33306690738754706e-32;function o(M,b,T,_,y){let A,S,L,G,z=b[0],F=_[0],I=0,ut=0;F>z==F>-z?(A=z,z=b[++I]):(A=F,F=_[++ut]);let R=0;if(I<M&&ut<T)for(F>z==F>-z?(L=A-((S=z+A)-z),z=b[++I]):(L=A-((S=F+A)-F),F=_[++ut]),A=S,L!==0&&(y[R++]=L);I<M&&ut<T;)F>z==F>-z?(L=A-((S=A+z)-(G=S-A))+(z-G),z=b[++I]):(L=A-((S=A+F)-(G=S-A))+(F-G),F=_[++ut]),A=S,L!==0&&(y[R++]=L);for(;I<M;)L=A-((S=A+z)-(G=S-A))+(z-G),z=b[++I],A=S,L!==0&&(y[R++]=L);for(;ut<T;)L=A-((S=A+F)-(G=S-A))+(F-G),F=_[++ut],A=S,L!==0&&(y[R++]=L);return A===0&&R!==0||(y[R++]=A),R}function a(M){return new Float64Array(M)}let l=33306690738754716e-32,h=22204460492503146e-32,f=11093356479670487e-47,p=a(4),d=a(8),g=a(12),x=a(16),v=a(4);r.orient2d=function(M,b,T,_,y,A){let S=(b-A)*(T-y),L=(M-y)*(_-A),G=S-L;if(S===0||L===0||S>0!=L>0)return G;let z=Math.abs(S+L);return Math.abs(G)>=l*z?G:-function(F,I,ut,R,W,V,Mt){let X,mt,dt,_t,it,lt,H,bt,Tt,Yt,tt,wt,Bt,$t,Ut,Dt,At,te,rt=F-W,an=ut-W,zt=I-V,ne=R-V;it=(Ut=(bt=rt-(H=(lt=134217729*rt)-(lt-rt)))*(Yt=ne-(Tt=(lt=134217729*ne)-(lt-ne)))-(($t=rt*ne)-H*Tt-bt*Tt-H*Yt))-(tt=Ut-(At=(bt=zt-(H=(lt=134217729*zt)-(lt-zt)))*(Yt=an-(Tt=(lt=134217729*an)-(lt-an)))-((Dt=zt*an)-H*Tt-bt*Tt-H*Yt))),p[0]=Ut-(tt+it)+(it-At),it=(Bt=$t-((wt=$t+tt)-(it=wt-$t))+(tt-it))-(tt=Bt-Dt),p[1]=Bt-(tt+it)+(it-Dt),it=(te=wt+tt)-wt,p[2]=wt-(te-it)+(tt-it),p[3]=te;let Wt=function(Y,N){let xt=N[0];for(let Et=1;Et<Y;Et++)xt+=N[Et];return xt}(4,p),ie=h*Mt;if(Wt>=ie||-Wt>=ie||(X=F-(rt+(it=F-rt))+(it-W),dt=ut-(an+(it=ut-an))+(it-W),mt=I-(zt+(it=I-zt))+(it-V),_t=R-(ne+(it=R-ne))+(it-V),X===0&&mt===0&&dt===0&&_t===0)||(ie=f*Mt+e*Math.abs(Wt),(Wt+=rt*_t+ne*X-(zt*dt+an*mt))>=ie||-Wt>=ie))return Wt;it=(Ut=(bt=X-(H=(lt=134217729*X)-(lt-X)))*(Yt=ne-(Tt=(lt=134217729*ne)-(lt-ne)))-(($t=X*ne)-H*Tt-bt*Tt-H*Yt))-(tt=Ut-(At=(bt=mt-(H=(lt=134217729*mt)-(lt-mt)))*(Yt=an-(Tt=(lt=134217729*an)-(lt-an)))-((Dt=mt*an)-H*Tt-bt*Tt-H*Yt))),v[0]=Ut-(tt+it)+(it-At),it=(Bt=$t-((wt=$t+tt)-(it=wt-$t))+(tt-it))-(tt=Bt-Dt),v[1]=Bt-(tt+it)+(it-Dt),it=(te=wt+tt)-wt,v[2]=wt-(te-it)+(tt-it),v[3]=te;let ce=o(4,p,4,v,d);it=(Ut=(bt=rt-(H=(lt=134217729*rt)-(lt-rt)))*(Yt=_t-(Tt=(lt=134217729*_t)-(lt-_t)))-(($t=rt*_t)-H*Tt-bt*Tt-H*Yt))-(tt=Ut-(At=(bt=zt-(H=(lt=134217729*zt)-(lt-zt)))*(Yt=dt-(Tt=(lt=134217729*dt)-(lt-dt)))-((Dt=zt*dt)-H*Tt-bt*Tt-H*Yt))),v[0]=Ut-(tt+it)+(it-At),it=(Bt=$t-((wt=$t+tt)-(it=wt-$t))+(tt-it))-(tt=Bt-Dt),v[1]=Bt-(tt+it)+(it-Dt),it=(te=wt+tt)-wt,v[2]=wt-(te-it)+(tt-it),v[3]=te;let Lt=o(ce,d,4,v,g);it=(Ut=(bt=X-(H=(lt=134217729*X)-(lt-X)))*(Yt=_t-(Tt=(lt=134217729*_t)-(lt-_t)))-(($t=X*_t)-H*Tt-bt*Tt-H*Yt))-(tt=Ut-(At=(bt=mt-(H=(lt=134217729*mt)-(lt-mt)))*(Yt=dt-(Tt=(lt=134217729*dt)-(lt-dt)))-((Dt=mt*dt)-H*Tt-bt*Tt-H*Yt))),v[0]=Ut-(tt+it)+(it-At),it=(Bt=$t-((wt=$t+tt)-(it=wt-$t))+(tt-it))-(tt=Bt-Dt),v[1]=Bt-(tt+it)+(it-Dt),it=(te=wt+tt)-wt,v[2]=wt-(te-it)+(tt-it),v[3]=te;let se=o(Lt,g,4,v,x);return x[se-1]}(M,b,T,_,y,A,z)},r.orient2dfast=function(M,b,T,_,y,A){return(b-A)*(T-y)-(M-y)*(_-A)},Object.defineProperty(r,"__esModule",{value:!0})})});var DM=nt((kH,ug)=>{"use strict";var IM=ng(),eh=xM(),$U=AM(),ZU=PM().orient2d;eh.default&&(eh=eh.default);ug.exports=OM;ug.exports.default=OM;function OM(r,t,e){t=Math.max(0,t===void 0?2:t),e=e||0;var o=tB(r),a=new IM(16);a.toBBox=function(A){return{minX:A[0],minY:A[1],maxX:A[0],maxY:A[1]}},a.compareMinX=function(A,S){return A[0]-S[0]},a.compareMinY=function(A,S){return A[1]-S[1]},a.load(r);for(var l=[],h=0,f;h<o.length;h++){var p=o[h];a.remove(p),f=NM(p,f),l.push(f)}var d=new IM(16);for(h=0;h<l.length;h++)d.insert(og(l[h]));for(var g=t*t,x=e*e;l.length;){var v=l.shift(),M=v.p,b=v.next.p,T=sg(M,b);if(!(T<x)){var _=T/g;p=JU(a,v.prev.p,M,b,v.next.next.p,_,d),p&&Math.min(sg(p,M),sg(p,b))<=_&&(l.push(v),l.push(NM(p,v)),a.remove(p),d.remove(v),d.insert(og(v)),d.insert(og(v.next)))}}v=f;var y=[];do y.push(v.p),v=v.next;while(v!==f);return y.push(v.p),y}function JU(r,t,e,o,a,l,h){for(var f=new eh([],KU),p=r.data;p;){for(var d=0;d<p.children.length;d++){var g=p.children[d],x=p.leaf?ag(g,e,o):jU(e,o,g);x>l||f.push({node:g,dist:x})}for(;f.length&&!f.peek().node.children;){var v=f.pop(),M=v.node,b=ag(M,t,e),T=ag(M,o,a);if(v.dist<b&&v.dist<T&&LM(e,M,h)&&LM(o,M,h))return M}p=f.pop(),p&&(p=p.node)}return null}function KU(r,t){return r.dist-t.dist}function jU(r,t,e){if(RM(r,e)||RM(t,e))return 0;var o=th(r[0],r[1],t[0],t[1],e.minX,e.minY,e.maxX,e.minY);if(o===0)return 0;var a=th(r[0],r[1],t[0],t[1],e.minX,e.minY,e.minX,e.maxY);if(a===0)return 0;var l=th(r[0],r[1],t[0],t[1],e.maxX,e.minY,e.maxX,e.maxY);if(l===0)return 0;var h=th(r[0],r[1],t[0],t[1],e.minX,e.maxY,e.maxX,e.maxY);return h===0?0:Math.min(o,a,l,h)}function RM(r,t){return r[0]>=t.minX&&r[0]<=t.maxX&&r[1]>=t.minY&&r[1]<=t.maxY}function LM(r,t,e){for(var o=Math.min(r[0],t[0]),a=Math.min(r[1],t[1]),l=Math.max(r[0],t[0]),h=Math.max(r[1],t[1]),f=e.search({minX:o,minY:a,maxX:l,maxY:h}),p=0;p<f.length;p++)if(QU(f[p].p,f[p].next.p,r,t))return!1;return!0}function Pu(r,t,e){return ZU(r[0],r[1],t[0],t[1],e[0],e[1])}function QU(r,t,e,o){return r!==o&&t!==e&&Pu(r,t,e)>0!=Pu(r,t,o)>0&&Pu(e,o,r)>0!=Pu(e,o,t)>0}function og(r){var t=r.p,e=r.next.p;return r.minX=Math.min(t[0],e[0]),r.minY=Math.min(t[1],e[1]),r.maxX=Math.max(t[0],e[0]),r.maxY=Math.max(t[1],e[1]),r}function tB(r){for(var t=r[0],e=r[0],o=r[0],a=r[0],l=0;l<r.length;l++){var h=r[l];h[0]<t[0]&&(t=h),h[0]>o[0]&&(o=h),h[1]<e[1]&&(e=h),h[1]>a[1]&&(a=h)}var f=[t,e,o,a],p=f.slice();for(l=0;l<r.length;l++)$U(r[l],f)||p.push(r[l]);return nB(p)}function NM(r,t){var e={p:r,prev:null,next:null,minX:0,minY:0,maxX:0,maxY:0};return t?(e.next=t.next,e.prev=t,t.next.prev=e,t.next=e):(e.prev=e,e.next=e),e}function sg(r,t){var e=r[0]-t[0],o=r[1]-t[1];return e*e+o*o}function ag(r,t,e){var o=t[0],a=t[1],l=e[0]-o,h=e[1]-a;if(l!==0||h!==0){var f=((r[0]-o)*l+(r[1]-a)*h)/(l*l+h*h);f>1?(o=e[0],a=e[1]):f>0&&(o+=l*f,a+=h*f)}return l=r[0]-o,h=r[1]-a,l*l+h*h}function th(r,t,e,o,a,l,h,f){var p=e-r,d=o-t,g=h-a,x=f-l,v=r-a,M=t-l,b=p*p+d*d,T=p*g+d*x,_=g*g+x*x,y=p*v+d*M,A=g*v+x*M,S=b*_-T*T,L,G,z,F,I=S,ut=S;S===0?(G=0,I=1,F=A,ut=_):(G=T*A-_*y,F=b*A-T*y,G<0?(G=0,F=A,ut=_):G>I&&(G=I,F=A+T,ut=_)),F<0?(F=0,-y<0?G=0:-y>b?G=I:(G=-y,I=b)):F>ut&&(F=ut,-y+T<0?G=0:-y+T>b?G=I:(G=-y+T,I=b)),L=G===0?0:G/I,z=F===0?0:F/ut;var R=(1-L)*r+L*e,W=(1-L)*t+L*o,V=(1-z)*a+z*h,Mt=(1-z)*l+z*f,X=V-R,mt=Mt-W;return X*X+mt*mt}function eB(r,t){return r[0]===t[0]?r[1]-t[1]:r[0]-t[0]}function nB(r){r.sort(eB);for(var t=[],e=0;e<r.length;e++){for(;t.length>=2&&Pu(t[t.length-2],t[t.length-1],r[e])<=0;)t.pop();t.push(r[e])}for(var o=[],a=r.length-1;a>=0;a--){for(;o.length>=2&&Pu(o[o.length-2],o[o.length-1],r[a])<=0;)o.pop();o.push(r[a])}return o.pop(),t.pop(),t.concat(o)}});var kM=nt((cg,fg)=>{(function(r,t){typeof cg=="object"&&typeof fg!="undefined"?fg.exports=t():typeof define=="function"&&define.amd?define(t):r.quickselect=t()})(cg,function(){"use strict";function r(a,l,h,f,p){t(a,l,h||0,f||a.length-1,p||o)}function t(a,l,h,f,p){for(;f>h;){if(f-h>600){var d=f-h+1,g=l-h+1,x=Math.log(d),v=.5*Math.exp(2*x/3),M=.5*Math.sqrt(x*v*(d-v)/d)*(g-d/2<0?-1:1),b=Math.max(h,Math.floor(l-g*v/d+M)),T=Math.min(f,Math.floor(l+(d-g)*v/d+M));t(a,l,b,T,p)}var _=a[l],y=h,A=f;for(e(a,h,l),p(a[f],_)>0&&e(a,h,f);y<A;){for(e(a,y,A),y++,A--;p(a[y],_)<0;)y++;for(;p(a[A],_)>0;)A--}p(a[h],_)===0?e(a,h,A):(A++,e(a,A,f)),A<=l&&(h=A+1),l<=A&&(f=A-1)}}function e(a,l,h){var f=a[l];a[l]=a[h],a[h]=f}function o(a,l){return a<l?-1:a>l?1:0}return r})});var mg=nt((pW,dg)=>{"use strict";dg.exports=zl;dg.exports.default=zl;var mB=kM();function zl(r,t){if(!(this instanceof zl))return new zl(r,t);this._maxEntries=Math.max(4,r||9),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),t&&this._initFormat(t),this.clear()}zl.prototype={all:function(){return this._all(this.data,[])},search:function(r){var t=this.data,e=[],o=this.toBBox;if(!rh(r,t))return e;for(var a=[],l,h,f,p;t;){for(l=0,h=t.children.length;l<h;l++)f=t.children[l],p=t.leaf?o(f):f,rh(r,p)&&(t.leaf?e.push(f):pg(r,p)?this._all(f,e):a.push(f));t=a.pop()}return e},collides:function(r){var t=this.data,e=this.toBBox;if(!rh(r,t))return!1;for(var o=[],a,l,h,f;t;){for(a=0,l=t.children.length;a<l;a++)if(h=t.children[a],f=t.leaf?e(h):h,rh(r,f)){if(t.leaf||pg(r,f))return!0;o.push(h)}t=o.pop()}return!1},load:function(r){if(!(r&&r.length))return this;if(r.length<this._minEntries){for(var t=0,e=r.length;t<e;t++)this.insert(r[t]);return this}var o=this._build(r.slice(),0,r.length-1,0);if(!this.data.children.length)this.data=o;else if(this.data.height===o.height)this._splitRoot(this.data,o);else{if(this.data.height<o.height){var a=this.data;this.data=o,o=a}this._insert(o,this.data.height-o.height-1,!0)}return this},insert:function(r){return r&&this._insert(r,this.data.height-1),this},clear:function(){return this.data=Lu([]),this},remove:function(r,t){if(!r)return this;for(var e=this.data,o=this.toBBox(r),a=[],l=[],h,f,p,d;e||a.length;){if(e||(e=a.pop(),f=a[a.length-1],h=l.pop(),d=!0),e.leaf&&(p=gB(r,e.children,t),p!==-1))return e.children.splice(p,1),a.push(e),this._condense(a),this;!d&&!e.leaf&&pg(e,o)?(a.push(e),l.push(h),h=0,f=e,e=e.children[0]):f?(h++,e=f.children[h],d=!1):e=null}return this},toBBox:function(r){return r},compareMinX:qM,compareMinY:VM,toJSON:function(){return this.data},fromJSON:function(r){return this.data=r,this},_all:function(r,t){for(var e=[];r;)r.leaf?t.push.apply(t,r.children):e.push.apply(e,r.children),r=e.pop();return t},_build:function(r,t,e,o){var a=e-t+1,l=this._maxEntries,h;if(a<=l)return h=Lu(r.slice(t,e+1)),Ru(h,this.toBBox),h;o||(o=Math.ceil(Math.log(a)/Math.log(l)),l=Math.ceil(a/Math.pow(l,o-1))),h=Lu([]),h.leaf=!1,h.height=o;var f=Math.ceil(a/l),p=f*Math.ceil(Math.sqrt(l)),d,g,x,v;for(HM(r,t,e,p,this.compareMinX),d=t;d<=e;d+=p)for(x=Math.min(d+p-1,e),HM(r,d,x,f,this.compareMinY),g=d;g<=x;g+=f)v=Math.min(g+f-1,x),h.children.push(this._build(r,g,v,o-1));return Ru(h,this.toBBox),h},_chooseSubtree:function(r,t,e,o){for(var a,l,h,f,p,d,g,x;o.push(t),!(t.leaf||o.length-1===e);){for(g=x=1/0,a=0,l=t.children.length;a<l;a++)h=t.children[a],p=hg(h),d=yB(r,h)-p,d<x?(x=d,g=p<g?p:g,f=h):d===x&&p<g&&(g=p,f=h);t=f||t.children[0]}return t},_insert:function(r,t,e){var o=this.toBBox,a=e?r:o(r),l=[],h=this._chooseSubtree(a,this.data,t,l);for(h.children.push(r),Bl(h,a);t>=0&&l[t].children.length>this._maxEntries;)this._split(l,t),t--;this._adjustParentBBoxes(a,l,t)},_split:function(r,t){var e=r[t],o=e.children.length,a=this._minEntries;this._chooseSplitAxis(e,a,o);var l=this._chooseSplitIndex(e,a,o),h=Lu(e.children.splice(l,e.children.length-l));h.height=e.height,h.leaf=e.leaf,Ru(e,this.toBBox),Ru(h,this.toBBox),t?r[t-1].children.push(h):this._splitRoot(e,h)},_splitRoot:function(r,t){this.data=Lu([r,t]),this.data.height=r.height+1,this.data.leaf=!1,Ru(this.data,this.toBBox)},_chooseSplitIndex:function(r,t,e){var o,a,l,h,f,p,d,g;for(p=d=1/0,o=t;o<=e-t;o++)a=Ul(r,0,o,this.toBBox),l=Ul(r,o,e,this.toBBox),h=vB(a,l),f=hg(a)+hg(l),h<p?(p=h,g=o,d=f<d?f:d):h===p&&f<d&&(d=f,g=o);return g},_chooseSplitAxis:function(r,t,e){var o=r.leaf?this.compareMinX:qM,a=r.leaf?this.compareMinY:VM,l=this._allDistMargin(r,t,e,o),h=this._allDistMargin(r,t,e,a);l<h&&r.children.sort(o)},_allDistMargin:function(r,t,e,o){r.children.sort(o);var a=this.toBBox,l=Ul(r,0,t,a),h=Ul(r,e-t,e,a),f=nh(l)+nh(h),p,d;for(p=t;p<e-t;p++)d=r.children[p],Bl(l,r.leaf?a(d):d),f+=nh(l);for(p=e-t-1;p>=t;p--)d=r.children[p],Bl(h,r.leaf?a(d):d),f+=nh(h);return f},_adjustParentBBoxes:function(r,t,e){for(var o=e;o>=0;o--)Bl(t[o],r)},_condense:function(r){for(var t=r.length-1,e;t>=0;t--)r[t].children.length===0?t>0?(e=r[t-1].children,e.splice(e.indexOf(r[t]),1)):this.clear():Ru(r[t],this.toBBox)},_initFormat:function(r){var t=["return a"," - b",";"];this.compareMinX=new Function("a","b",t.join(r[0])),this.compareMinY=new Function("a","b",t.join(r[1])),this.toBBox=new Function("a","return {minX: a"+r[0]+", minY: a"+r[1]+", maxX: a"+r[2]+", maxY: a"+r[3]+"};")}};function gB(r,t,e){if(!e)return t.indexOf(r);for(var o=0;o<t.length;o++)if(e(r,t[o]))return o;return-1}function Ru(r,t){Ul(r,0,r.children.length,t,r)}function Ul(r,t,e,o,a){a||(a=Lu(null)),a.minX=1/0,a.minY=1/0,a.maxX=-1/0,a.maxY=-1/0;for(var l=t,h;l<e;l++)h=r.children[l],Bl(a,r.leaf?o(h):h);return a}function Bl(r,t){return r.minX=Math.min(r.minX,t.minX),r.minY=Math.min(r.minY,t.minY),r.maxX=Math.max(r.maxX,t.maxX),r.maxY=Math.max(r.maxY,t.maxY),r}function qM(r,t){return r.minX-t.minX}function VM(r,t){return r.minY-t.minY}function hg(r){return(r.maxX-r.minX)*(r.maxY-r.minY)}function nh(r){return r.maxX-r.minX+(r.maxY-r.minY)}function yB(r,t){return(Math.max(t.maxX,r.maxX)-Math.min(t.minX,r.minX))*(Math.max(t.maxY,r.maxY)-Math.min(t.minY,r.minY))}function vB(r,t){var e=Math.max(r.minX,t.minX),o=Math.max(r.minY,t.minY),a=Math.min(r.maxX,t.maxX),l=Math.min(r.maxY,t.maxY);return Math.max(0,a-e)*Math.max(0,l-o)}function pg(r,t){return r.minX<=t.minX&&r.minY<=t.minY&&t.maxX<=r.maxX&&t.maxY<=r.maxY}function rh(r,t){return t.minX<=r.maxX&&t.minY<=r.maxY&&t.maxX>=r.minX&&t.maxY>=r.minY}function Lu(r){return{children:r,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function HM(r,t,e,o,a){for(var l=[t,e],h;l.length;)e=l.pop(),t=l.pop(),!(e-t<=o)&&(h=t+Math.ceil((e-t)/o/2)*o,mB(r,h,t,e,a),l.push(t,h,h,e))}});var JM=nt((TX,Eg)=>{"use strict";Eg.exports=ah;Eg.exports.default=ah;function ah(r,t,e){e=e||2;var o=t&&t.length,a=o?t[0]*e:r.length,l=YM(r,0,a,e,!0),h=[];if(!l||l.next===l.prev)return h;var f,p,d,g,x,v,M;if(o&&(l=CB(r,t,l,e)),r.length>80*e){f=d=r[0],p=g=r[1];for(var b=e;b<a;b+=e)x=r[b],v=r[b+1],x<f&&(f=x),v<p&&(p=v),x>d&&(d=x),v>g&&(g=v);M=Math.max(d-f,g-p),M=M!==0?32767/M:0}return ql(l,h,e,f,p,M,0),h}function YM(r,t,e,o,a){var l,h;if(a===xg(r,t,e,o)>0)for(l=t;l<e;l+=o)h=XM(l,r[l],r[l+1],h);else for(l=e-o;l>=t;l-=o)h=XM(l,r[l],r[l+1],h);return h&&uh(h,h.next)&&(Hl(h),h=h.next),h}function wa(r,t){if(!r)return r;t||(t=r);var e=r,o;do if(o=!1,!e.steiner&&(uh(e,e.next)||$n(e.prev,e,e.next)===0)){if(Hl(e),e=t=e.prev,e===e.next)break;o=!0}else e=e.next;while(o||e!==t);return t}function ql(r,t,e,o,a,l,h){if(r){!h&&l&&NB(r,o,a,l);for(var f=r,p,d;r.prev!==r.next;){if(p=r.prev,d=r.next,l?bB(r,o,a,l):wB(r)){t.push(p.i/e|0),t.push(r.i/e|0),t.push(d.i/e|0),Hl(r),r=d.next,f=d.next;continue}if(r=d,r===f){h?h===1?(r=TB(wa(r),t,e),ql(r,t,e,o,a,l,2)):h===2&&AB(r,t,e,o,a,l):ql(wa(r),t,e,o,a,l,1);break}}}}function wB(r){var t=r.prev,e=r,o=r.next;if($n(t,e,o)>=0)return!1;for(var a=t.x,l=e.x,h=o.x,f=t.y,p=e.y,d=o.y,g=a<l?a<h?a:h:l<h?l:h,x=f<p?f<d?f:d:p<d?p:d,v=a>l?a>h?a:h:l>h?l:h,M=f>p?f>d?f:d:p>d?p:d,b=o.next;b!==t;){if(b.x>=g&&b.x<=v&&b.y>=x&&b.y<=M&&Du(a,f,l,p,h,d,b.x,b.y)&&$n(b.prev,b,b.next)>=0)return!1;b=b.next}return!0}function bB(r,t,e,o){var a=r.prev,l=r,h=r.next;if($n(a,l,h)>=0)return!1;for(var f=a.x,p=l.x,d=h.x,g=a.y,x=l.y,v=h.y,M=f<p?f<d?f:d:p<d?p:d,b=g<x?g<v?g:v:x<v?x:v,T=f>p?f>d?f:d:p>d?p:d,_=g>x?g>v?g:v:x>v?x:v,y=vg(M,b,t,e,o),A=vg(T,_,t,e,o),S=r.prevZ,L=r.nextZ;S&&S.z>=y&&L&&L.z<=A;){if(S.x>=M&&S.x<=T&&S.y>=b&&S.y<=_&&S!==a&&S!==h&&Du(f,g,p,x,d,v,S.x,S.y)&&$n(S.prev,S,S.next)>=0||(S=S.prevZ,L.x>=M&&L.x<=T&&L.y>=b&&L.y<=_&&L!==a&&L!==h&&Du(f,g,p,x,d,v,L.x,L.y)&&$n(L.prev,L,L.next)>=0))return!1;L=L.nextZ}for(;S&&S.z>=y;){if(S.x>=M&&S.x<=T&&S.y>=b&&S.y<=_&&S!==a&&S!==h&&Du(f,g,p,x,d,v,S.x,S.y)&&$n(S.prev,S,S.next)>=0)return!1;S=S.prevZ}for(;L&&L.z<=A;){if(L.x>=M&&L.x<=T&&L.y>=b&&L.y<=_&&L!==a&&L!==h&&Du(f,g,p,x,d,v,L.x,L.y)&&$n(L.prev,L,L.next)>=0)return!1;L=L.nextZ}return!0}function TB(r,t,e){var o=r;do{var a=o.prev,l=o.next.next;!uh(a,l)&&$M(a,o,o.next,l)&&Vl(a,l)&&Vl(l,a)&&(t.push(a.i/e|0),t.push(o.i/e|0),t.push(l.i/e|0),Hl(o),Hl(o.next),o=r=l),o=o.next}while(o!==r);return wa(o)}function AB(r,t,e,o,a,l){var h=r;do{for(var f=h.next.next;f!==h.prev;){if(h.i!==f.i&&FB(h,f)){var p=ZM(h,f);h=wa(h,h.next),p=wa(p,p.next),ql(h,t,e,o,a,l,0),ql(p,t,e,o,a,l,0);return}f=f.next}h=h.next}while(h!==r)}function CB(r,t,e,o){var a=[],l,h,f,p,d;for(l=0,h=t.length;l<h;l++)f=t[l]*o,p=l<h-1?t[l+1]*o:r.length,d=YM(r,f,p,o,!1),d===d.next&&(d.steiner=!0),a.push(DB(d));for(a.sort(PB),l=0;l<a.length;l++)e=IB(a[l],e);return e}function PB(r,t){return r.x-t.x}function IB(r,t){var e=RB(r,t);if(!e)return t;var o=ZM(e,r);return wa(o,o.next),wa(e,e.next)}function RB(r,t){var e=t,o=r.x,a=r.y,l=-1/0,h;do{if(a<=e.y&&a>=e.next.y&&e.next.y!==e.y){var f=e.x+(a-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(f<=o&&f>l&&(l=f,h=e.x<e.next.x?e:e.next,f===o))return h}e=e.next}while(e!==t);if(!h)return null;var p=h,d=h.x,g=h.y,x=1/0,v;e=h;do o>=e.x&&e.x>=d&&o!==e.x&&Du(a<g?o:l,a,d,g,a<g?l:o,a,e.x,e.y)&&(v=Math.abs(a-e.y)/(o-e.x),Vl(e,r)&&(v<x||v===x&&(e.x>h.x||e.x===h.x&&LB(h,e)))&&(h=e,x=v)),e=e.next;while(e!==p);return h}function LB(r,t){return $n(r.prev,r,t.prev)<0&&$n(t.next,r,r.next)<0}function NB(r,t,e,o){var a=r;do a.z===0&&(a.z=vg(a.x,a.y,t,e,o)),a.prevZ=a.prev,a.nextZ=a.next,a=a.next;while(a!==r);a.prevZ.nextZ=null,a.prevZ=null,OB(a)}function OB(r){var t,e,o,a,l,h,f,p,d=1;do{for(e=r,r=null,l=null,h=0;e;){for(h++,o=e,f=0,t=0;t<d&&(f++,o=o.nextZ,!!o);t++);for(p=d;f>0||p>0&&o;)f!==0&&(p===0||!o||e.z<=o.z)?(a=e,e=e.nextZ,f--):(a=o,o=o.nextZ,p--),l?l.nextZ=a:r=a,a.prevZ=l,l=a;e=o}l.nextZ=null,d*=2}while(h>1);return r}function vg(r,t,e,o,a){return r=(r-e)*a|0,t=(t-o)*a|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,r|t<<1}function DB(r){var t=r,e=r;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==r);return e}function Du(r,t,e,o,a,l,h,f){return(a-h)*(t-f)>=(r-h)*(l-f)&&(r-h)*(o-f)>=(e-h)*(t-f)&&(e-h)*(l-f)>=(a-h)*(o-f)}function FB(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!UB(r,t)&&(Vl(r,t)&&Vl(t,r)&&BB(r,t)&&($n(r.prev,r,t.prev)||$n(r,t.prev,t))||uh(r,t)&&$n(r.prev,r,r.next)>0&&$n(t.prev,t,t.next)>0)}function $n(r,t,e){return(t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y)}function uh(r,t){return r.x===t.x&&r.y===t.y}function $M(r,t,e,o){var a=sh($n(r,t,e)),l=sh($n(r,t,o)),h=sh($n(e,o,r)),f=sh($n(e,o,t));return!!(a!==l&&h!==f||a===0&&oh(r,e,t)||l===0&&oh(r,o,t)||h===0&&oh(e,r,o)||f===0&&oh(e,t,o))}function oh(r,t,e){return t.x<=Math.max(r.x,e.x)&&t.x>=Math.min(r.x,e.x)&&t.y<=Math.max(r.y,e.y)&&t.y>=Math.min(r.y,e.y)}function sh(r){return r>0?1:r<0?-1:0}function UB(r,t){var e=r;do{if(e.i!==r.i&&e.next.i!==r.i&&e.i!==t.i&&e.next.i!==t.i&&$M(e,e.next,r,t))return!0;e=e.next}while(e!==r);return!1}function Vl(r,t){return $n(r.prev,r,r.next)<0?$n(r,t,r.next)>=0&&$n(r,r.prev,t)>=0:$n(r,t,r.prev)<0||$n(r,r.next,t)<0}function BB(r,t){var e=r,o=!1,a=(r.x+t.x)/2,l=(r.y+t.y)/2;do e.y>l!=e.next.y>l&&e.next.y!==e.y&&a<(e.next.x-e.x)*(l-e.y)/(e.next.y-e.y)+e.x&&(o=!o),e=e.next;while(e!==r);return o}function ZM(r,t){var e=new _g(r.i,r.x,r.y),o=new _g(t.i,t.x,t.y),a=r.next,l=t.prev;return r.next=t,t.prev=r,e.next=a,a.prev=e,o.next=e,e.prev=o,l.next=o,o.prev=l,o}function XM(r,t,e,o){var a=new _g(r,t,e);return o?(a.next=o.next,a.prev=o,o.next.prev=a,o.next=a):(a.prev=a,a.next=a),a}function Hl(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function _g(r,t,e){this.i=r,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}ah.deviation=function(r,t,e,o){var a=t&&t.length,l=a?t[0]*e:r.length,h=Math.abs(xg(r,0,l,e));if(a)for(var f=0,p=t.length;f<p;f++){var d=t[f]*e,g=f<p-1?t[f+1]*e:r.length;h-=Math.abs(xg(r,d,g,e))}var x=0;for(f=0;f<o.length;f+=3){var v=o[f]*e,M=o[f+1]*e,b=o[f+2]*e;x+=Math.abs((r[v]-r[b])*(r[M+1]-r[v+1])-(r[v]-r[M])*(r[b+1]-r[v+1]))}return h===0&&x===0?0:Math.abs((x-h)/h)};function xg(r,t,e,o){for(var a=0,l=t,h=e-o;l<e;l+=o)a+=(r[h]-r[l])*(r[l+1]+r[h+1]),h=l;return a}ah.flatten=function(r){for(var t=r[0][0].length,e={vertices:[],holes:[],dimensions:t},o=0,a=0;a<r.length;a++){for(var l=0;l<r[a].length;l++)for(var h=0;h<t;h++)e.vertices.push(r[a][l][h]);a>0&&(o+=r[a-1].length,e.holes.push(o))}return e}});var Tg=nt(he=>{"use strict";Object.defineProperty(he,"__esModule",{value:!0});he.earthRadius=63710088e-1;he.factors={centimeters:he.earthRadius*100,centimetres:he.earthRadius*100,degrees:he.earthRadius/111325,feet:he.earthRadius*3.28084,inches:he.earthRadius*39.37,kilometers:he.earthRadius/1e3,kilometres:he.earthRadius/1e3,meters:he.earthRadius,metres:he.earthRadius,miles:he.earthRadius/1609.344,millimeters:he.earthRadius*1e3,millimetres:he.earthRadius*1e3,nauticalmiles:he.earthRadius/1852,radians:1,yards:he.earthRadius*1.0936};he.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/he.earthRadius,yards:1.0936133};he.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 Gs(r,t,e){e===void 0&&(e={});var o={type:"Feature"};return(e.id===0||e.id)&&(o.id=e.id),e.bbox&&(o.bbox=e.bbox),o.properties=t||{},o.geometry=r,o}he.feature=Gs;function GB(r,t,e){switch(e===void 0&&(e={}),r){case"Point":return Mg(t).geometry;case"LineString":return wg(t).geometry;case"Polygon":return Sg(t).geometry;case"MultiPoint":return jM(t).geometry;case"MultiLineString":return KM(t).geometry;case"MultiPolygon":return QM(t).geometry;default:throw new Error(r+" is invalid")}}he.geometry=GB;function Mg(r,t,e){if(e===void 0&&(e={}),!r)throw new Error("coordinates is required");if(!Array.isArray(r))throw new Error("coordinates must be an Array");if(r.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!lh(r[0])||!lh(r[1]))throw new Error("coordinates must contain numbers");var o={type:"Point",coordinates:r};return Gs(o,t,e)}he.point=Mg;function kB(r,t,e){return e===void 0&&(e={}),ch(r.map(function(o){return Mg(o,t)}),e)}he.points=kB;function Sg(r,t,e){e===void 0&&(e={});for(var o=0,a=r;o<a.length;o++){var l=a[o];if(l.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var h=0;h<l[l.length-1].length;h++)if(l[l.length-1][h]!==l[0][h])throw new Error("First and last Position are not equivalent.")}var f={type:"Polygon",coordinates:r};return Gs(f,t,e)}he.polygon=Sg;function qB(r,t,e){return e===void 0&&(e={}),ch(r.map(function(o){return Sg(o,t)}),e)}he.polygons=qB;function wg(r,t,e){if(e===void 0&&(e={}),r.length<2)throw new Error("coordinates must be an array of two or more positions");var o={type:"LineString",coordinates:r};return Gs(o,t,e)}he.lineString=wg;function VB(r,t,e){return e===void 0&&(e={}),ch(r.map(function(o){return wg(o,t)}),e)}he.lineStrings=VB;function ch(r,t){t===void 0&&(t={});var e={type:"FeatureCollection"};return t.id&&(e.id=t.id),t.bbox&&(e.bbox=t.bbox),e.features=r,e}he.featureCollection=ch;function KM(r,t,e){e===void 0&&(e={});var o={type:"MultiLineString",coordinates:r};return Gs(o,t,e)}he.multiLineString=KM;function jM(r,t,e){e===void 0&&(e={});var o={type:"MultiPoint",coordinates:r};return Gs(o,t,e)}he.multiPoint=jM;function QM(r,t,e){e===void 0&&(e={});var o={type:"MultiPolygon",coordinates:r};return Gs(o,t,e)}he.multiPolygon=QM;function HB(r,t,e){e===void 0&&(e={});var o={type:"GeometryCollection",geometries:r};return Gs(o,t,e)}he.geometryCollection=HB;function WB(r,t){if(t===void 0&&(t=0),t&&!(t>=0))throw new Error("precision must be a positive number");var e=Math.pow(10,t||0);return Math.round(r*e)/e}he.round=WB;function tS(r,t){t===void 0&&(t="kilometers");var e=he.factors[t];if(!e)throw new Error(t+" units is invalid");return r*e}he.radiansToLength=tS;function bg(r,t){t===void 0&&(t="kilometers");var e=he.factors[t];if(!e)throw new Error(t+" units is invalid");return r/e}he.lengthToRadians=bg;function XB(r,t){return eS(bg(r,t))}he.lengthToDegrees=XB;function YB(r){var t=r%360;return t<0&&(t+=360),t}he.bearingToAzimuth=YB;function eS(r){var t=r%(2*Math.PI);return t*180/Math.PI}he.radiansToDegrees=eS;function $B(r){var t=r%360;return t*Math.PI/180}he.degreesToRadians=$B;function ZB(r,t,e){if(t===void 0&&(t="kilometers"),e===void 0&&(e="kilometers"),!(r>=0))throw new Error("length must be a positive number");return tS(bg(r,t),e)}he.convertLength=ZB;function JB(r,t,e){if(t===void 0&&(t="meters"),e===void 0&&(e="kilometers"),!(r>=0))throw new Error("area must be a positive number");var o=he.areaFactors[t];if(!o)throw new Error("invalid original units");var a=he.areaFactors[e];if(!a)throw new Error("invalid final units");return r/o*a}he.convertArea=JB;function lh(r){return!isNaN(r)&&r!==null&&!Array.isArray(r)}he.isNumber=lh;function KB(r){return!!r&&r.constructor===Object}he.isObject=KB;function jB(r){if(!r)throw new Error("bbox is required");if(!Array.isArray(r))throw new Error("bbox must be an Array");if(r.length!==4&&r.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");r.forEach(function(t){if(!lh(t))throw new Error("bbox must only contain numbers")})}he.validateBBox=jB;function QB(r){if(!r)throw new Error("id is required");if(["string","number"].indexOf(typeof r)===-1)throw new Error("id must be a number or a string")}he.validateId=QB});var Cg=nt(mr=>{"use strict";Object.defineProperty(mr,"__esModule",{value:!0});var Qr=Tg();function Wl(r,t,e){if(r!==null)for(var o,a,l,h,f,p,d,g=0,x=0,v,M=r.type,b=M==="FeatureCollection",T=M==="Feature",_=b?r.features.length:1,y=0;y<_;y++){d=b?r.features[y].geometry:T?r.geometry:r,v=d?d.type==="GeometryCollection":!1,f=v?d.geometries.length:1;for(var A=0;A<f;A++){var S=0,L=0;if(h=v?d.geometries[A]:d,h!==null){p=h.coordinates;var G=h.type;switch(g=e&&(G==="Polygon"||G==="MultiPolygon")?1:0,G){case null:break;case"Point":if(t(p,x,y,S,L)===!1)return!1;x++,S++;break;case"LineString":case"MultiPoint":for(o=0;o<p.length;o++){if(t(p[o],x,y,S,L)===!1)return!1;x++,G==="MultiPoint"&&S++}G==="LineString"&&S++;break;case"Polygon":case"MultiLineString":for(o=0;o<p.length;o++){for(a=0;a<p[o].length-g;a++){if(t(p[o][a],x,y,S,L)===!1)return!1;x++}G==="MultiLineString"&&S++,G==="Polygon"&&L++}G==="Polygon"&&S++;break;case"MultiPolygon":for(o=0;o<p.length;o++){for(L=0,a=0;a<p[o].length;a++){for(l=0;l<p[o][a].length-g;l++){if(t(p[o][a][l],x,y,S,L)===!1)return!1;x++}L++}S++}break;case"GeometryCollection":for(o=0;o<h.geometries.length;o++)if(Wl(h.geometries[o],t,e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function tz(r,t,e,o){var a=e;return Wl(r,function(l,h,f,p,d){h===0&&e===void 0?a=l:a=t(a,l,h,f,p,d)},o),a}function nS(r,t){var e;switch(r.type){case"FeatureCollection":for(e=0;e<r.features.length&&t(r.features[e].properties,e)!==!1;e++);break;case"Feature":t(r.properties,0);break}}function ez(r,t,e){var o=e;return nS(r,function(a,l){l===0&&e===void 0?o=a:o=t(o,a,l)}),o}function rS(r,t){if(r.type==="Feature")t(r,0);else if(r.type==="FeatureCollection")for(var e=0;e<r.features.length&&t(r.features[e],e)!==!1;e++);}function nz(r,t,e){var o=e;return rS(r,function(a,l){l===0&&e===void 0?o=a:o=t(o,a,l)}),o}function rz(r){var t=[];return Wl(r,function(e){t.push(e)}),t}function Ag(r,t){var e,o,a,l,h,f,p,d,g,x,v=0,M=r.type==="FeatureCollection",b=r.type==="Feature",T=M?r.features.length:1;for(e=0;e<T;e++){for(f=M?r.features[e].geometry:b?r.geometry:r,d=M?r.features[e].properties:b?r.properties:{},g=M?r.features[e].bbox:b?r.bbox:void 0,x=M?r.features[e].id:b?r.id:void 0,p=f?f.type==="GeometryCollection":!1,h=p?f.geometries.length:1,a=0;a<h;a++){if(l=p?f.geometries[a]:f,l===null){if(t(null,v,d,g,x)===!1)return!1;continue}switch(l.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(t(l,v,d,g,x)===!1)return!1;break}case"GeometryCollection":{for(o=0;o<l.geometries.length;o++)if(t(l.geometries[o],v,d,g,x)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}v++}}function iz(r,t,e){var o=e;return Ag(r,function(a,l,h,f,p){l===0&&e===void 0?o=a:o=t(o,a,l,h,f,p)}),o}function fh(r,t){Ag(r,function(e,o,a,l,h){var f=e===null?null:e.type;switch(f){case null:case"Point":case"LineString":case"Polygon":return t(Qr.feature(e,a,{bbox:l,id:h}),o,0)===!1?!1:void 0}var p;switch(f){case"MultiPoint":p="Point";break;case"MultiLineString":p="LineString";break;case"MultiPolygon":p="Polygon";break}for(var d=0;d<e.coordinates.length;d++){var g=e.coordinates[d],x={type:p,coordinates:g};if(t(Qr.feature(x,a),o,d)===!1)return!1}})}function oz(r,t,e){var o=e;return fh(r,function(a,l,h){l===0&&h===0&&e===void 0?o=a:o=t(o,a,l,h)}),o}function iS(r,t){fh(r,function(e,o,a){var l=0;if(e.geometry){var h=e.geometry.type;if(!(h==="Point"||h==="MultiPoint")){var f,p=0,d=0,g=0;if(Wl(e,function(x,v,M,b,T){if(f===void 0||o>p||b>d||T>g){f=x,p=o,d=b,g=T,l=0;return}var _=Qr.lineString([f,x],e.properties);if(t(_,o,a,T,l)===!1)return!1;l++,f=x})===!1)return!1}}})}function sz(r,t,e){var o=e,a=!1;return iS(r,function(l,h,f,p,d){a===!1&&e===void 0?o=l:o=t(o,l,h,f,p,d),a=!0}),o}function oS(r,t){if(!r)throw new Error("geojson is required");fh(r,function(e,o,a){if(e.geometry!==null){var l=e.geometry.type,h=e.geometry.coordinates;switch(l){case"LineString":if(t(e,o,a,0,0)===!1)return!1;break;case"Polygon":for(var f=0;f<h.length;f++)if(t(Qr.lineString(h[f],e.properties),o,a,f)===!1)return!1;break}}})}function az(r,t,e){var o=e;return oS(r,function(a,l,h,f){l===0&&e===void 0?o=a:o=t(o,a,l,h,f)}),o}function uz(r,t){if(t=t||{},!Qr.isObject(t))throw new Error("options is invalid");var e=t.featureIndex||0,o=t.multiFeatureIndex||0,a=t.geometryIndex||0,l=t.segmentIndex||0,h=t.properties,f;switch(r.type){case"FeatureCollection":e<0&&(e=r.features.length+e),h=h||r.features[e].properties,f=r.features[e].geometry;break;case"Feature":h=h||r.properties,f=r.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":f=r;break;default:throw new Error("geojson is invalid")}if(f===null)return null;var p=f.coordinates;switch(f.type){case"Point":case"MultiPoint":return null;case"LineString":return l<0&&(l=p.length+l-1),Qr.lineString([p[l],p[l+1]],h,t);case"Polygon":return a<0&&(a=p.length+a),l<0&&(l=p[a].length+l-1),Qr.lineString([p[a][l],p[a][l+1]],h,t);case"MultiLineString":return o<0&&(o=p.length+o),l<0&&(l=p[o].length+l-1),Qr.lineString([p[o][l],p[o][l+1]],h,t);case"MultiPolygon":return o<0&&(o=p.length+o),a<0&&(a=p[o].length+a),l<0&&(l=p[o][a].length-l-1),Qr.lineString([p[o][a][l],p[o][a][l+1]],h,t)}throw new Error("geojson is invalid")}function lz(r,t){if(t=t||{},!Qr.isObject(t))throw new Error("options is invalid");var e=t.featureIndex||0,o=t.multiFeatureIndex||0,a=t.geometryIndex||0,l=t.coordIndex||0,h=t.properties,f;switch(r.type){case"FeatureCollection":e<0&&(e=r.features.length+e),h=h||r.features[e].properties,f=r.features[e].geometry;break;case"Feature":h=h||r.properties,f=r.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":f=r;break;default:throw new Error("geojson is invalid")}if(f===null)return null;var p=f.coordinates;switch(f.type){case"Point":return Qr.point(p,h,t);case"MultiPoint":return o<0&&(o=p.length+o),Qr.point(p[o],h,t);case"LineString":return l<0&&(l=p.length+l),Qr.point(p[l],h,t);case"Polygon":return a<0&&(a=p.length+a),l<0&&(l=p[a].length+l),Qr.point(p[a][l],h,t);case"MultiLineString":return o<0&&(o=p.length+o),l<0&&(l=p[o].length+l),Qr.point(p[o][l],h,t);case"MultiPolygon":return o<0&&(o=p.length+o),a<0&&(a=p[o].length+a),l<0&&(l=p[o][a].length-l),Qr.point(p[o][a][l],h,t)}throw new Error("geojson is invalid")}mr.coordAll=rz;mr.coordEach=Wl;mr.coordReduce=tz;mr.featureEach=rS;mr.featureReduce=nz;mr.findPoint=lz;mr.findSegment=uz;mr.flattenEach=fh;mr.flattenReduce=oz;mr.geomEach=Ag;mr.geomReduce=iz;mr.lineEach=oS;mr.lineReduce=az;mr.propEach=nS;mr.propReduce=ez;mr.segmentEach=iS;mr.segmentReduce=sz});var sS=nt(Ig=>{"use strict";Object.defineProperty(Ig,"__esModule",{value:!0});var cz=Cg();function Pg(r){var t=[1/0,1/0,-1/0,-1/0];return cz.coordEach(r,function(e){t[0]>e[0]&&(t[0]=e[0]),t[1]>e[1]&&(t[1]=e[1]),t[2]<e[0]&&(t[2]=e[0]),t[3]<e[1]&&(t[3]=e[1])}),t}Pg.default=Pg;Ig.default=Pg});var hh=nt((qX,Rg)=>{var Lo=ng(),uS=Tg(),lS=Cg(),Fu=sS().default,fz=lS.featureEach,GX=lS.coordEach,kX=uS.polygon,aS=uS.featureCollection;function cS(r){var t=new Lo(r);return t.insert=function(e){if(e.type!=="Feature")throw new Error("invalid feature");return e.bbox=e.bbox?e.bbox:Fu(e),Lo.prototype.insert.call(this,e)},t.load=function(e){var o=[];return Array.isArray(e)?e.forEach(function(a){if(a.type!=="Feature")throw new Error("invalid features");a.bbox=a.bbox?a.bbox:Fu(a),o.push(a)}):fz(e,function(a){if(a.type!=="Feature")throw new Error("invalid features");a.bbox=a.bbox?a.bbox:Fu(a),o.push(a)}),Lo.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:Fu(e),Lo.prototype.remove.call(this,e,o)},t.clear=function(){return Lo.prototype.clear.call(this)},t.search=function(e){var o=Lo.prototype.search.call(this,this.toBBox(e));return aS(o)},t.collides=function(e){return Lo.prototype.collides.call(this,this.toBBox(e))},t.all=function(){var e=Lo.prototype.all.call(this);return aS(e)},t.toJSON=function(){return Lo.prototype.toJSON.call(this)},t.fromJSON=function(e){return Lo.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=Fu(e);else if(e.type==="FeatureCollection")o=Fu(e);else throw new Error("invalid geojson");return{minX:o[0],minY:o[1],maxX:o[2],maxY:o[3]}},t}Rg.exports=cS;Rg.exports.default=cS});var Ug=nt((K7,xS)=>{"use strict";var _S=Object.prototype.toString;xS.exports=function(t){var e=_S.call(t),o=e==="[object Arguments]";return o||(o=e!=="[object Array]"&&t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&_S.call(t.callee)==="[object Function]"),o}});var PS=nt((j7,CS)=>{"use strict";var AS;Object.keys||($l=Object.prototype.hasOwnProperty,Bg=Object.prototype.toString,ES=Ug(),zg=Object.prototype.propertyIsEnumerable,MS=!zg.call({toString:null},"toString"),SS=zg.call(function(){},"prototype"),Zl=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],yh=function(r){var t=r.constructor;return t&&t.prototype===r},wS={$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},bS=function(){if(typeof window=="undefined")return!1;for(var r in window)try{if(!wS["$"+r]&&$l.call(window,r)&&window[r]!==null&&typeof window[r]=="object")try{yh(window[r])}catch(t){return!0}}catch(t){return!0}return!1}(),TS=function(r){if(typeof window=="undefined"||!bS)return yh(r);try{return yh(r)}catch(t){return!1}},AS=function(t){var e=t!==null&&typeof t=="object",o=Bg.call(t)==="[object Function]",a=ES(t),l=e&&Bg.call(t)==="[object String]",h=[];if(!e&&!o&&!a)throw new TypeError("Object.keys called on a non-object");var f=SS&&o;if(l&&t.length>0&&!$l.call(t,0))for(var p=0;p<t.length;++p)h.push(String(p));if(a&&t.length>0)for(var d=0;d<t.length;++d)h.push(String(d));else for(var g in t)!(f&&g==="prototype")&&$l.call(t,g)&&h.push(String(g));if(MS)for(var x=TS(t),v=0;v<Zl.length;++v)!(x&&Zl[v]==="constructor")&&$l.call(t,Zl[v])&&h.push(Zl[v]);return h});var $l,Bg,ES,zg,MS,SS,Zl,yh,wS,bS,TS;CS.exports=AS});var Gg=nt((Q7,LS)=>{"use strict";var Ez=Array.prototype.slice,Mz=Ug(),IS=Object.keys,vh=IS?function(t){return IS(t)}:PS(),RS=Object.keys;vh.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 Mz(o)?RS(Ez.call(o)):RS(o)})}else Object.keys=vh;return Object.keys||vh};LS.exports=vh});var kg=nt((tY,NS)=>{"use strict";NS.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},e=Symbol("test"),o=Object(e);if(typeof e=="string"||Object.prototype.toString.call(e)!=="[object Symbol]"||Object.prototype.toString.call(o)!=="[object Symbol]")return!1;var a=42;t[e]=a;for(var l 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 h=Object.getOwnPropertySymbols(t);if(h.length!==1||h[0]!==e||!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var f=Object.getOwnPropertyDescriptor(t,e);if(f.value!==a||f.enumerable!==!0)return!1}return!0}});var _h=nt((eY,OS)=>{"use strict";var Sz=kg();OS.exports=function(){return Sz()&&!!Symbol.toStringTag}});var qg=nt((nY,DS)=>{"use strict";DS.exports=Object});var Vg=nt((rY,FS)=>{"use strict";FS.exports=Error});var BS=nt((iY,US)=>{"use strict";US.exports=EvalError});var GS=nt((oY,zS)=>{"use strict";zS.exports=RangeError});var qS=nt((sY,kS)=>{"use strict";kS.exports=ReferenceError});var Hg=nt((aY,VS)=>{"use strict";VS.exports=SyntaxError});var ba=nt((uY,HS)=>{"use strict";HS.exports=TypeError});var XS=nt((lY,WS)=>{"use strict";WS.exports=URIError});var $S=nt((cY,YS)=>{"use strict";YS.exports=Math.abs});var JS=nt((fY,ZS)=>{"use strict";ZS.exports=Math.floor});var jS=nt((hY,KS)=>{"use strict";KS.exports=Math.max});var tw=nt((pY,QS)=>{"use strict";QS.exports=Math.min});var nw=nt((dY,ew)=>{"use strict";ew.exports=Math.pow});var iw=nt((mY,rw)=>{"use strict";rw.exports=Math.round});var sw=nt((gY,ow)=>{"use strict";ow.exports=Number.isNaN||function(t){return t!==t}});var uw=nt((yY,aw)=>{"use strict";var wz=sw();aw.exports=function(t){return wz(t)||t===0?t:t<0?-1:1}});var cw=nt((vY,lw)=>{"use strict";lw.exports=Object.getOwnPropertyDescriptor});var Ta=nt((_Y,fw)=>{"use strict";var xh=cw();if(xh)try{xh([],"length")}catch(r){xh=null}fw.exports=xh});var Jl=nt((xY,hw)=>{"use strict";var Eh=Object.defineProperty||!1;if(Eh)try{Eh({},"a",{value:1})}catch(r){Eh=!1}hw.exports=Eh});var mw=nt((EY,dw)=>{"use strict";var pw=typeof Symbol!="undefined"&&Symbol,bz=kg();dw.exports=function(){return typeof pw!="function"||typeof Symbol!="function"||typeof pw("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:bz()}});var Wg=nt((MY,gw)=>{"use strict";gw.exports=typeof Reflect!="undefined"&&Reflect.getPrototypeOf||null});var Xg=nt((SY,yw)=>{"use strict";var Tz=qg();yw.exports=Tz.getPrototypeOf||null});var xw=nt((wY,_w)=>{"use strict";var Az="Function.prototype.bind called on incompatible ",Cz=Object.prototype.toString,Pz=Math.max,Iz="[object Function]",vw=function(t,e){for(var o=[],a=0;a<t.length;a+=1)o[a]=t[a];for(var l=0;l<e.length;l+=1)o[l+t.length]=e[l];return o},Rz=function(t,e){for(var o=[],a=e||0,l=0;a<t.length;a+=1,l+=1)o[l]=t[a];return o},Lz=function(r,t){for(var e="",o=0;o<r.length;o+=1)e+=r[o],o+1<r.length&&(e+=t);return e};_w.exports=function(t){var e=this;if(typeof e!="function"||Cz.apply(e)!==Iz)throw new TypeError(Az+e);for(var o=Rz(arguments,1),a,l=function(){if(this instanceof a){var g=e.apply(this,vw(o,arguments));return Object(g)===g?g:this}return e.apply(t,vw(o,arguments))},h=Pz(0,e.length-o.length),f=[],p=0;p<h;p++)f[p]="$"+p;if(a=Function("binder","return function ("+Lz(f,",")+"){ return binder.apply(this,arguments); }")(l),e.prototype){var d=function(){};d.prototype=e.prototype,a.prototype=new d,d.prototype=null}return a}});var Uu=nt((bY,Ew)=>{"use strict";var Nz=xw();Ew.exports=Function.prototype.bind||Nz});var Mh=nt((TY,Mw)=>{"use strict";Mw.exports=Function.prototype.call});var Sh=nt((AY,Sw)=>{"use strict";Sw.exports=Function.prototype.apply});var bw=nt((CY,ww)=>{"use strict";ww.exports=typeof Reflect!="undefined"&&Reflect&&Reflect.apply});var Yg=nt((PY,Tw)=>{"use strict";var Oz=Uu(),Dz=Sh(),Fz=Mh(),Uz=bw();Tw.exports=Uz||Oz.call(Fz,Dz)});var wh=nt((IY,Aw)=>{"use strict";var Bz=Uu(),zz=ba(),Gz=Mh(),kz=Yg();Aw.exports=function(t){if(t.length<1||typeof t[0]!="function")throw new zz("a function is required");return kz(Bz,Gz,t)}});var Nw=nt((RY,Lw)=>{"use strict";var qz=wh(),Cw=Ta(),Iw;try{Iw=[].__proto__===Array.prototype}catch(r){if(!r||typeof r!="object"||!("code"in r)||r.code!=="ERR_PROTO_ACCESS")throw r}var $g=!!Iw&&Cw&&Cw(Object.prototype,"__proto__"),Rw=Object,Pw=Rw.getPrototypeOf;Lw.exports=$g&&typeof $g.get=="function"?qz([$g.get]):typeof Pw=="function"?function(t){return Pw(t==null?t:Rw(t))}:!1});var Zg=nt((LY,Uw)=>{"use strict";var Ow=Wg(),Dw=Xg(),Fw=Nw();Uw.exports=Ow?function(t){return Ow(t)}:Dw?function(t){if(!t||typeof t!="object"&&typeof t!="function")throw new TypeError("getProto: not an object");return Dw(t)}:Fw?function(t){return Fw(t)}:null});var Jg=nt((NY,Bw)=>{"use strict";var Vz=Function.prototype.call,Hz=Object.prototype.hasOwnProperty,Wz=Uu();Bw.exports=Wz.call(Vz,Hz)});var Qg=nt((OY,Hw)=>{"use strict";var Ke,Xz=qg(),Yz=Vg(),$z=BS(),Zz=GS(),Jz=qS(),ku=Hg(),Gu=ba(),Kz=XS(),jz=$S(),Qz=JS(),tG=jS(),eG=tw(),nG=nw(),rG=iw(),iG=uw(),qw=Function,Kg=function(r){try{return qw('"use strict"; return ('+r+").constructor;")()}catch(t){}},Kl=Ta(),oG=Jl(),jg=function(){throw new Gu},sG=Kl?function(){try{return arguments.callee,jg}catch(r){try{return Kl(arguments,"callee").get}catch(t){return jg}}}():jg,Bu=mw()(),Rr=Zg(),aG=Xg(),uG=Wg(),Vw=Sh(),jl=Mh(),zu={},lG=typeof Uint8Array=="undefined"||!Rr?Ke:Rr(Uint8Array),Aa={__proto__:null,"%AggregateError%":typeof AggregateError=="undefined"?Ke:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer=="undefined"?Ke:ArrayBuffer,"%ArrayIteratorPrototype%":Bu&&Rr?Rr([][Symbol.iterator]()):Ke,"%AsyncFromSyncIteratorPrototype%":Ke,"%AsyncFunction%":zu,"%AsyncGenerator%":zu,"%AsyncGeneratorFunction%":zu,"%AsyncIteratorPrototype%":zu,"%Atomics%":typeof Atomics=="undefined"?Ke:Atomics,"%BigInt%":typeof BigInt=="undefined"?Ke:BigInt,"%BigInt64Array%":typeof BigInt64Array=="undefined"?Ke:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array=="undefined"?Ke:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView=="undefined"?Ke:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Yz,"%eval%":eval,"%EvalError%":$z,"%Float16Array%":typeof Float16Array=="undefined"?Ke:Float16Array,"%Float32Array%":typeof Float32Array=="undefined"?Ke:Float32Array,"%Float64Array%":typeof Float64Array=="undefined"?Ke:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry=="undefined"?Ke:FinalizationRegistry,"%Function%":qw,"%GeneratorFunction%":zu,"%Int8Array%":typeof Int8Array=="undefined"?Ke:Int8Array,"%Int16Array%":typeof Int16Array=="undefined"?Ke:Int16Array,"%Int32Array%":typeof Int32Array=="undefined"?Ke:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Bu&&Rr?Rr(Rr([][Symbol.iterator]())):Ke,"%JSON%":typeof JSON=="object"?JSON:Ke,"%Map%":typeof Map=="undefined"?Ke:Map,"%MapIteratorPrototype%":typeof Map=="undefined"||!Bu||!Rr?Ke:Rr(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Xz,"%Object.getOwnPropertyDescriptor%":Kl,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise=="undefined"?Ke:Promise,"%Proxy%":typeof Proxy=="undefined"?Ke:Proxy,"%RangeError%":Zz,"%ReferenceError%":Jz,"%Reflect%":typeof Reflect=="undefined"?Ke:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set=="undefined"?Ke:Set,"%SetIteratorPrototype%":typeof Set=="undefined"||!Bu||!Rr?Ke:Rr(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer=="undefined"?Ke:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Bu&&Rr?Rr(""[Symbol.iterator]()):Ke,"%Symbol%":Bu?Symbol:Ke,"%SyntaxError%":ku,"%ThrowTypeError%":sG,"%TypedArray%":lG,"%TypeError%":Gu,"%Uint8Array%":typeof Uint8Array=="undefined"?Ke:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray=="undefined"?Ke:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array=="undefined"?Ke:Uint16Array,"%Uint32Array%":typeof Uint32Array=="undefined"?Ke:Uint32Array,"%URIError%":Kz,"%WeakMap%":typeof WeakMap=="undefined"?Ke:WeakMap,"%WeakRef%":typeof WeakRef=="undefined"?Ke:WeakRef,"%WeakSet%":typeof WeakSet=="undefined"?Ke:WeakSet,"%Function.prototype.call%":jl,"%Function.prototype.apply%":Vw,"%Object.defineProperty%":oG,"%Object.getPrototypeOf%":aG,"%Math.abs%":jz,"%Math.floor%":Qz,"%Math.max%":tG,"%Math.min%":eG,"%Math.pow%":nG,"%Math.round%":rG,"%Math.sign%":iG,"%Reflect.getPrototypeOf%":uG};if(Rr)try{null.error}catch(r){zw=Rr(Rr(r)),Aa["%Error.prototype%"]=zw}var zw,cG=function r(t){var e;if(t==="%AsyncFunction%")e=Kg("async function () {}");else if(t==="%GeneratorFunction%")e=Kg("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=Kg("async function* () {}");else if(t==="%AsyncGenerator%"){var o=r("%AsyncGeneratorFunction%");o&&(e=o.prototype)}else if(t==="%AsyncIteratorPrototype%"){var a=r("%AsyncGenerator%");a&&Rr&&(e=Rr(a.prototype))}return Aa[t]=e,e},Gw={__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"]},Ql=Uu(),bh=Jg(),fG=Ql.call(jl,Array.prototype.concat),hG=Ql.call(Vw,Array.prototype.splice),kw=Ql.call(jl,String.prototype.replace),Th=Ql.call(jl,String.prototype.slice),pG=Ql.call(jl,RegExp.prototype.exec),dG=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,mG=/\\(\\)?/g,gG=function(t){var e=Th(t,0,1),o=Th(t,-1);if(e==="%"&&o!=="%")throw new ku("invalid intrinsic syntax, expected closing `%`");if(o==="%"&&e!=="%")throw new ku("invalid intrinsic syntax, expected opening `%`");var a=[];return kw(t,dG,function(l,h,f,p){a[a.length]=f?kw(p,mG,"$1"):h||l}),a},yG=function(t,e){var o=t,a;if(bh(Gw,o)&&(a=Gw[o],o="%"+a[0]+"%"),bh(Aa,o)){var l=Aa[o];if(l===zu&&(l=cG(o)),typeof l=="undefined"&&!e)throw new Gu("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:a,name:o,value:l}}throw new ku("intrinsic "+t+" does not exist!")};Hw.exports=function(t,e){if(typeof t!="string"||t.length===0)throw new Gu("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new Gu('"allowMissing" argument must be a boolean');if(pG(/^%?[^%]*%?$/,t)===null)throw new ku("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var o=gG(t),a=o.length>0?o[0]:"",l=yG("%"+a+"%",e),h=l.name,f=l.value,p=!1,d=l.alias;d&&(a=d[0],hG(o,fG([0,1],d)));for(var g=1,x=!0;g<o.length;g+=1){var v=o[g],M=Th(v,0,1),b=Th(v,-1);if((M==='"'||M==="'"||M==="`"||b==='"'||b==="'"||b==="`")&&M!==b)throw new ku("property names with quotes must have matching quotes");if((v==="constructor"||!x)&&(p=!0),a+="."+v,h="%"+a+"%",bh(Aa,h))f=Aa[h];else if(f!=null){if(!(v in f)){if(!e)throw new Gu("base intrinsic for "+t+" exists, but the property is not available.");return}if(Kl&&g+1>=o.length){var T=Kl(f,v);x=!!T,x&&"get"in T&&!("originalValue"in T.get)?f=T.get:f=f[v]}else x=bh(f,v),f=f[v];x&&!p&&(Aa[h]=f)}}return f}});var Ah=nt((DY,Yw)=>{"use strict";var Ww=Qg(),Xw=wh(),vG=Xw([Ww("%String.prototype.indexOf%")]);Yw.exports=function(t,e){var o=Ww(t,!!e);return typeof o=="function"&&vG(t,".prototype.")>-1?Xw([o]):o}});var Jw=nt((FY,Zw)=>{"use strict";var _G=_h()(),xG=Ah(),t0=xG("Object.prototype.toString"),Ch=function(t){return _G&&t&&typeof t=="object"&&Symbol.toStringTag in t?!1:t0(t)==="[object Arguments]"},$w=function(t){return Ch(t)?!0:t!==null&&typeof t=="object"&&"length"in t&&typeof t.length=="number"&&t.length>=0&&t0(t)!=="[object Array]"&&"callee"in t&&t0(t.callee)==="[object Function]"},EG=function(){return Ch(arguments)}();Ch.isLegacyArguments=$w;Zw.exports=EG?Ch:$w});var Ph=nt((UY,Qw)=>{"use strict";var Kw=Jl(),MG=Hg(),qu=ba(),jw=Ta();Qw.exports=function(t,e,o){if(!t||typeof t!="object"&&typeof t!="function")throw new qu("`obj` must be an object or a function`");if(typeof e!="string"&&typeof e!="symbol")throw new qu("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new qu("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new qu("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new qu("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new qu("`loose`, if provided, must be a boolean");var a=arguments.length>3?arguments[3]:null,l=arguments.length>4?arguments[4]:null,h=arguments.length>5?arguments[5]:null,f=arguments.length>6?arguments[6]:!1,p=!!jw&&jw(t,e);if(Kw)Kw(t,e,{configurable:h===null&&p?p.configurable:!h,enumerable:a===null&&p?p.enumerable:!a,value:o,writable:l===null&&p?p.writable:!l});else if(f||!a&&!l&&!h)t[e]=o;else throw new MG("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var Ih=nt((BY,eb)=>{"use strict";var e0=Jl(),tb=function(){return!!e0};tb.hasArrayLengthDefineBug=function(){if(!e0)return null;try{return e0([],"length",{value:1}).length!==1}catch(t){return!0}};eb.exports=tb});var Vu=nt((zY,ob)=>{"use strict";var SG=Gg(),wG=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",bG=Object.prototype.toString,TG=Array.prototype.concat,nb=Ph(),AG=function(r){return typeof r=="function"&&bG.call(r)==="[object Function]"},rb=Ih()(),CG=function(r,t,e,o){if(t in r){if(o===!0){if(r[t]===e)return}else if(!AG(o)||!o())return}rb?nb(r,t,e,!0):nb(r,t,e)},ib=function(r,t){var e=arguments.length>2?arguments[2]:{},o=SG(t);wG&&(o=TG.call(o,Object.getOwnPropertySymbols(t)));for(var a=0;a<o.length;a+=1)CG(r,o[a],t[o[a]],e[o[a]])};ib.supportsDescriptors=!!rb;ob.exports=ib});var cb=nt((GY,lb)=>{"use strict";var PG=Qg(),sb=Ph(),IG=Ih()(),ab=Ta(),ub=ba(),RG=PG("%Math.floor%");lb.exports=function(t,e){if(typeof t!="function")throw new ub("`fn` is not a function");if(typeof e!="number"||e<0||e>4294967295||RG(e)!==e)throw new ub("`length` must be a positive 32-bit integer");var o=arguments.length>2&&!!arguments[2],a=!0,l=!0;if("length"in t&&ab){var h=ab(t,"length");h&&!h.configurable&&(a=!1),h&&!h.writable&&(l=!1)}return(a||l||!o)&&(IG?sb(t,"length",e,!0,!0):sb(t,"length",e)),t}});var hb=nt((kY,fb)=>{"use strict";var LG=Uu(),NG=Sh(),OG=Yg();fb.exports=function(){return OG(LG,NG,arguments)}});var n0=nt((qY,Rh)=>{"use strict";var DG=cb(),pb=Jl(),FG=wh(),db=hb();Rh.exports=function(t){var e=FG(arguments),o=t.length-(arguments.length-1);return DG(e,1+(o>0?o:0),!0)};pb?pb(Rh.exports,"apply",{value:db}):Rh.exports.apply=db});var r0=nt((VY,gb)=>{"use strict";var mb=function(r){return r!==r};gb.exports=function(t,e){return t===0&&e===0?1/t===1/e:!!(t===e||mb(t)&&mb(e))}});var i0=nt((HY,yb)=>{"use strict";var UG=r0();yb.exports=function(){return typeof Object.is=="function"?Object.is:UG}});var _b=nt((WY,vb)=>{"use strict";var BG=i0(),zG=Vu();vb.exports=function(){var t=BG();return zG(Object,{is:t},{is:function(){return Object.is!==t}}),t}});var Sb=nt((XY,Mb)=>{"use strict";var GG=Vu(),kG=n0(),qG=r0(),xb=i0(),VG=_b(),Eb=kG(xb(),Object);GG(Eb,{getPolyfill:xb,implementation:qG,shim:VG});Mb.exports=Eb});var Pb=nt((YY,Cb)=>{"use strict";var wb=Ah(),HG=_h()(),WG=Jg(),XG=Ta(),a0;HG?(bb=wb("RegExp.prototype.exec"),o0={},Lh=function(){throw o0},s0={toString:Lh,valueOf:Lh},typeof Symbol.toPrimitive=="symbol"&&(s0[Symbol.toPrimitive]=Lh),a0=function(t){if(!t||typeof t!="object")return!1;var e=XG(t,"lastIndex"),o=e&&WG(e,"value");if(!o)return!1;try{bb(t,s0)}catch(a){return a===o0}}):(Tb=wb("Object.prototype.toString"),Ab="[object RegExp]",a0=function(t){return!t||typeof t!="object"&&typeof t!="function"?!1:Tb(t)===Ab});var bb,o0,Lh,s0,Tb,Ab;Cb.exports=a0});var Rb=nt(($Y,Ib)=>{"use strict";var ec=function(){return typeof function(){}.name=="string"},tc=Object.getOwnPropertyDescriptor;if(tc)try{tc([],"length")}catch(r){tc=null}ec.functionsHaveConfigurableNames=function(){if(!ec()||!tc)return!1;var t=tc(function(){},"name");return!!t&&!!t.configurable};var YG=Function.prototype.bind;ec.boundFunctionsHaveNames=function(){return ec()&&typeof YG=="function"&&function(){}.bind().name!==""};Ib.exports=ec});var Ob=nt((ZY,Nb)=>{"use strict";var Lb=Ph(),$G=Ih()(),ZG=Rb().functionsHaveConfigurableNames(),JG=ba();Nb.exports=function(t,e){if(typeof t!="function")throw new JG("`fn` is not a function");var o=arguments.length>2&&!!arguments[2];return(!o||ZG)&&($G?Lb(t,"name",e,!0,!0):Lb(t,"name",e)),t}});var u0=nt((JY,Db)=>{"use strict";var KG=Ob(),jG=ba(),QG=Object;Db.exports=KG(function(){if(this==null||this!==QG(this))throw new jG("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 l0=nt((KY,Fb)=>{"use strict";var tk=u0(),ek=Vu().supportsDescriptors,nk=Object.getOwnPropertyDescriptor;Fb.exports=function(){if(ek&&/a/mig.flags==="gim"){var t=nk(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 tk}});var zb=nt((jY,Bb)=>{"use strict";var rk=Vu().supportsDescriptors,ik=l0(),ok=Ta(),sk=Object.defineProperty,ak=Vg(),Ub=Zg(),uk=/a/;Bb.exports=function(){if(!rk||!Ub)throw new ak("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var t=ik(),e=Ub(uk),o=ok(e,"flags");return(!o||o.get!==t)&&sk(e,"flags",{configurable:!0,enumerable:!1,get:t}),t}});var Vb=nt((QY,qb)=>{"use strict";var lk=Vu(),ck=n0(),fk=u0(),Gb=l0(),hk=zb(),kb=ck(Gb());lk(kb,{getPolyfill:Gb,implementation:fk,shim:hk});qb.exports=kb});var Xb=nt((t$,Wb)=>{"use strict";var Hb=Ah(),pk=Hb("Date.prototype.getDay"),dk=function(t){try{return pk(t),!0}catch(e){return!1}},mk=Hb("Object.prototype.toString"),gk="[object Date]",yk=_h()();Wb.exports=function(t){return typeof t!="object"||t===null?!1:yk?dk(t):mk(t)===gk}});var c0=nt((e$,rT)=>{var Yb=Gg(),$b=Jw(),Zb=Sb(),Jb=Pb(),Kb=Vb(),jb=Xb(),Qb=Date.prototype.getTime;function nT(r,t,e){var o=e||{};return(o.strict?Zb(r,t):r===t)?!0:!r||!t||typeof r!="object"&&typeof t!="object"?o.strict?Zb(r,t):r==t:vk(r,t,o)}function tT(r){return r==null}function eT(r){return!(!r||typeof r!="object"||typeof r.length!="number"||typeof r.copy!="function"||typeof r.slice!="function"||r.length>0&&typeof r[0]!="number")}function vk(r,t,e){var o,a;if(typeof r!=typeof t||tT(r)||tT(t)||r.prototype!==t.prototype||$b(r)!==$b(t))return!1;var l=Jb(r),h=Jb(t);if(l!==h)return!1;if(l||h)return r.source===t.source&&Kb(r)===Kb(t);if(jb(r)&&jb(t))return Qb.call(r)===Qb.call(t);var f=eT(r),p=eT(t);if(f!==p)return!1;if(f||p){if(r.length!==t.length)return!1;for(o=0;o<r.length;o++)if(r[o]!==t[o])return!1;return!0}if(typeof r!=typeof t)return!1;try{var d=Yb(r),g=Yb(t)}catch(x){return!1}if(d.length!==g.length)return!1;for(d.sort(),g.sort(),o=d.length-1;o>=0;o--)if(d[o]!=g[o])return!1;for(o=d.length-1;o>=0;o--)if(a=d[o],!nT(r[a],t[a],e))return!1;return!0}rT.exports=nT});var M0=nt((aJ,cT)=>{var u4=c0(),No=function(r){this.precision=r&&r.precision?r.precision:17,this.direction=r&&r.direction?r.direction:!1,this.pseudoNode=r&&r.pseudoNode?r.pseudoNode:!1,this.objectComparator=r&&r.objectComparator?r.objectComparator:l4};No.prototype.compare=function(r,t){if(r.type!==t.type||!lT(r,t))return!1;switch(r.type){case"Point":return this.compareCoord(r.coordinates,t.coordinates);case"LineString":return this.compareLine(r.coordinates,t.coordinates,0,!1);case"Polygon":return this.comparePolygon(r,t);case"Feature":return this.compareFeature(r,t);default:if(r.type.indexOf("Multi")===0){var e=this,o=uT(r),a=uT(t);return o.every(function(l){return this.some(function(h){return e.compare(l,h)})},a)}}return!1};function uT(r){return r.coordinates.map(function(t){return{type:r.type.replace("Multi",""),coordinates:t}})}function lT(r,t){return r.hasOwnProperty("coordinates")?r.coordinates.length===t.coordinates.length:r.length===t.length}No.prototype.compareCoord=function(r,t){if(r.length!==t.length)return!1;for(var e=0;e<r.length;e++)if(r[e].toFixed(this.precision)!==t[e].toFixed(this.precision))return!1;return!0};No.prototype.compareLine=function(r,t,e,o){if(!lT(r,t))return!1;var a=this.pseudoNode?r:this.removePseudo(r),l=this.pseudoNode?t:this.removePseudo(t);if(!(o&&!this.compareCoord(a[0],l[0])&&(l=this.fixStartIndex(l,a),!l))){var h=this.compareCoord(a[e],l[e]);return this.direction||h?this.comparePath(a,l):this.compareCoord(a[e],l[l.length-(1+e)])?this.comparePath(a.slice().reverse(),l):!1}};No.prototype.fixStartIndex=function(r,t){for(var e,o=-1,a=0;a<r.length;a++)if(this.compareCoord(r[a],t[0])){o=a;break}return o>=0&&(e=[].concat(r.slice(o,r.length),r.slice(1,o+1))),e};No.prototype.comparePath=function(r,t){var e=this;return r.every(function(o,a){return e.compareCoord(o,this[a])},t)};No.prototype.comparePolygon=function(r,t){if(this.compareLine(r.coordinates[0],t.coordinates[0],1,!0)){var e=r.coordinates.slice(1,r.coordinates.length),o=t.coordinates.slice(1,t.coordinates.length),a=this;return e.every(function(l){return this.some(function(h){return a.compareLine(l,h,1,!0)})},o)}else return!1};No.prototype.compareFeature=function(r,t){return r.id!==t.id||!this.objectComparator(r.properties,t.properties)||!this.compareBBox(r,t)?!1:this.compare(r.geometry,t.geometry)};No.prototype.compareBBox=function(r,t){return!!(!r.bbox&&!t.bbox||r.bbox&&t.bbox&&this.compareCoord(r.bbox,t.bbox))};No.prototype.removePseudo=function(r){return r};function l4(r,t){return u4(r,t,{strict:!0})}cT.exports=No});var fT=nt((_J,Dh)=>{function qs(r,t,e,o){this.dataset=[],this.epsilon=1,this.minPts=2,this.distance=this._euclideanDistance,this.clusters=[],this.noise=[],this._visited=[],this._assigned=[],this._datasetLength=0,this._init(r,t,e,o)}qs.prototype.run=function(r,t,e,o){this._init(r,t,e,o);for(var a=0;a<this._datasetLength;a++)if(this._visited[a]!==1){this._visited[a]=1;var l=this._regionQuery(a);if(l.length<this.minPts)this.noise.push(a);else{var h=this.clusters.length;this.clusters.push([]),this._addToCluster(a,h),this._expandCluster(h,l)}}return this.clusters};qs.prototype._init=function(r,t,e,o){if(r){if(!(r instanceof Array))throw Error("Dataset must be of type array, "+typeof r+" given");this.dataset=r,this.clusters=[],this.noise=[],this._datasetLength=r.length,this._visited=new Array(this._datasetLength),this._assigned=new Array(this._datasetLength)}t&&(this.epsilon=t),e&&(this.minPts=e),o&&(this.distance=o)};qs.prototype._expandCluster=function(r,t){for(var e=0;e<t.length;e++){var o=t[e];if(this._visited[o]!==1){this._visited[o]=1;var a=this._regionQuery(o);a.length>=this.minPts&&(t=this._mergeArrays(t,a))}this._assigned[o]!==1&&this._addToCluster(o,r)}};qs.prototype._addToCluster=function(r,t){this.clusters[t].push(r),this._assigned[r]=1};qs.prototype._regionQuery=function(r){for(var t=[],e=0;e<this._datasetLength;e++){var o=this.distance(this.dataset[r],this.dataset[e]);o<this.epsilon&&t.push(e)}return t};qs.prototype._mergeArrays=function(r,t){for(var e=t.length,o=0;o<e;o++){var a=t[o];r.indexOf(a)<0&&r.push(a)}return r};qs.prototype._euclideanDistance=function(r,t){for(var e=0,o=Math.min(r.length,t.length);o--;)e+=(r[o]-t[o])*(r[o]-t[o]);return Math.sqrt(e)};typeof Dh!="undefined"&&Dh.exports&&(Dh.exports=qs)});var hT=nt((xJ,Fh)=>{function Vs(r,t,e){this.k=3,this.dataset=[],this.assignments=[],this.centroids=[],this.init(r,t,e)}Vs.prototype.init=function(r,t,e){this.assignments=[],this.centroids=[],typeof r!="undefined"&&(this.dataset=r),typeof t!="undefined"&&(this.k=t),typeof e!="undefined"&&(this.distance=e)};Vs.prototype.run=function(r,t){this.init(r,t);for(var e=this.dataset.length,o=0;o<this.k;o++)this.centroids[o]=this.randomCentroid();for(var a=!0;a;){a=this.assign();for(var l=0;l<this.k;l++){for(var h=new Array(g),f=0,p=0;p<g;p++)h[p]=0;for(var d=0;d<e;d++){var g=this.dataset[d].length;if(l===this.assignments[d]){for(var p=0;p<g;p++)h[p]+=this.dataset[d][p];f++}}if(f>0){for(var p=0;p<g;p++)h[p]/=f;this.centroids[l]=h}else this.centroids[l]=this.randomCentroid(),a=!0}}return this.getClusters()};Vs.prototype.randomCentroid=function(){var r=this.dataset.length-1,t,e;do e=Math.round(Math.random()*r),t=this.dataset[e];while(this.centroids.indexOf(t)>=0);return t};Vs.prototype.assign=function(){for(var r=!1,t=this.dataset.length,e,o=0;o<t;o++)e=this.argmin(this.dataset[o],this.centroids,this.distance),e!=this.assignments[o]&&(this.assignments[o]=e,r=!0);return r};Vs.prototype.getClusters=function(){for(var r=new Array(this.k),t,e=0;e<this.assignments.length;e++)t=this.assignments[e],typeof r[t]=="undefined"&&(r[t]=[]),r[t].push(e);return r};Vs.prototype.argmin=function(r,t,e){for(var o=Number.MAX_VALUE,a=0,l=t.length,h,f=0;f<l;f++)h=e(r,t[f]),h<o&&(o=h,a=f);return a};Vs.prototype.distance=function(r,t){for(var e=0,o=Math.min(r.length,t.length);o--;){var a=r[o]-t[o];e+=a*a}return Math.sqrt(e)};typeof Fh!="undefined"&&Fh.exports&&(Fh.exports=Vs)});var S0=nt((EJ,Uh)=>{function Oo(r,t,e){this._queue=[],this._priorities=[],this._sorting="desc",this._init(r,t,e)}Oo.prototype.insert=function(r,t){for(var e=this._queue.length,o=e;o--;){var a=this._priorities[o];this._sorting==="desc"?t>a&&(e=o):t<a&&(e=o)}this._insertAt(r,t,e)};Oo.prototype.remove=function(r){for(var t=this._queue.length;t--;){var e=this._queue[t];if(r===e){this._queue.splice(t,1),this._priorities.splice(t,1);break}}};Oo.prototype.forEach=function(r){this._queue.forEach(r)};Oo.prototype.getElements=function(){return this._queue};Oo.prototype.getElementPriority=function(r){return this._priorities[r]};Oo.prototype.getPriorities=function(){return this._priorities};Oo.prototype.getElementsWithPriorities=function(){for(var r=[],t=0,e=this._queue.length;t<e;t++)r.push([this._queue[t],this._priorities[t]]);return r};Oo.prototype._init=function(r,t,e){if(r&&t){if(this._queue=[],this._priorities=[],r.length!==t.length)throw new Error("Arrays must have the same length");for(var o=0;o<r.length;o++)this.insert(r[o],t[o])}e&&(this._sorting=e)};Oo.prototype._insertAt=function(r,t,e){this._queue.length===e?(this._queue.push(r),this._priorities.push(t)):(this._queue.splice(e,0,r),this._priorities.splice(e,0,t))};typeof Uh!="undefined"&&Uh.exports&&(Uh.exports=Oo)});var dT=nt((MJ,Wu)=>{typeof Wu!="undefined"&&Wu.exports&&(pT=S0());var pT;function ls(r,t,e,o){this.epsilon=1,this.minPts=1,this.distance=this._euclideanDistance,this._reachability=[],this._processed=[],this._coreDistance=0,this._orderedList=[],this._init(r,t,e,o)}ls.prototype.run=function(r,t,e,o){this._init(r,t,e,o);for(var a=0,l=this.dataset.length;a<l;a++)if(this._processed[a]!==1){this._processed[a]=1,this.clusters.push([a]);var h=this.clusters.length-1;this._orderedList.push(a);var f=new pT(null,null,"asc"),p=this._regionQuery(a);this._distanceToCore(a)!==void 0&&(this._updateQueue(a,p,f),this._expandCluster(h,f))}return this.clusters};ls.prototype.getReachabilityPlot=function(){for(var r=[],t=0,e=this._orderedList.length;t<e;t++){var o=this._orderedList[t],a=this._reachability[o];r.push([o,a])}return r};ls.prototype._init=function(r,t,e,o){if(r){if(!(r instanceof Array))throw Error("Dataset must be of type array, "+typeof r+" given");this.dataset=r,this.clusters=[],this._reachability=new Array(this.dataset.length),this._processed=new Array(this.dataset.length),this._coreDistance=0,this._orderedList=[]}t&&(this.epsilon=t),e&&(this.minPts=e),o&&(this.distance=o)};ls.prototype._updateQueue=function(r,t,e){var o=this;this._coreDistance=this._distanceToCore(r),t.forEach(function(a){if(o._processed[a]===void 0){var l=o.distance(o.dataset[r],o.dataset[a]),h=Math.max(o._coreDistance,l);o._reachability[a]===void 0?(o._reachability[a]=h,e.insert(a,h)):h<o._reachability[a]&&(o._reachability[a]=h,e.remove(a),e.insert(a,h))}})};ls.prototype._expandCluster=function(r,t){for(var e=t.getElements(),o=0,a=e.length;o<a;o++){var l=e[o];if(this._processed[l]===void 0){var h=this._regionQuery(l);this._processed[l]=1,this.clusters[r].push(l),this._orderedList.push(l),this._distanceToCore(l)!==void 0&&(this._updateQueue(l,h,t),this._expandCluster(r,t))}}};ls.prototype._distanceToCore=function(r){for(var t=this.epsilon,e=0;e<t;e++){var o=this._regionQuery(r,e);if(o.length>=this.minPts)return e}};ls.prototype._regionQuery=function(r,t){t=t||this.epsilon;for(var e=[],o=0,a=this.dataset.length;o<a;o++)this.distance(this.dataset[r],this.dataset[o])<t&&e.push(o);return e};ls.prototype._euclideanDistance=function(r,t){for(var e=0,o=Math.min(r.length,t.length);o--;)e+=(r[o]-t[o])*(r[o]-t[o]);return Math.sqrt(e)};typeof Wu!="undefined"&&Wu.exports&&(Wu.exports=ls)});var mT=nt((SJ,Bh)=>{typeof Bh!="undefined"&&Bh.exports&&(Bh.exports={DBSCAN:fT(),KMEANS:hT(),OPTICS:dT(),PriorityQueue:S0()})});var w0=nt((PJ,yT)=>{"use strict";yT.exports={eudist:function(t,e,o){for(var a=t.length,l=0,h=0;h<a;h++){var f=(t[h]||0)-(e[h]||0);l+=f*f}return o?Math.sqrt(l):l},mandist:function(t,e,o){for(var a=t.length,l=0,h=0;h<a;h++)l+=Math.abs((t[h]||0)-(e[h]||0));return o?Math.sqrt(l):l},dist:function(t,e,o){var a=Math.abs(t-e);return o?a:a*a}}});var xT=nt((IJ,_T)=>{"use strict";var vT=w0(),m4=vT.eudist,g4=vT.dist;_T.exports={kmrand:function(t,e){for(var o={},a=[],l=e<<2,h=t.length,f=t[0].length>0;a.length<e&&l-- >0;){var p=t[Math.floor(Math.random()*h)],d=f?p.join("_"):""+p;o[d]||(o[d]=!0,a.push(p))}if(a.length<e)throw new Error("Error initializating clusters");return a},kmpp:function(t,e){var o=t[0].length?m4:g4,a=[],l=t.length,h=t[0].length>0,f={},p=t[Math.floor(Math.random()*l)],d=h?p.join("_"):""+p;for(a.push(p),f[d]=!0;a.length<e;){for(var g=[],x=a.length,v=0,M=[],b=0;b<l;b++){for(var T=1/0,_=0;_<x;_++){var y=o(t[b],a[_]);y<=T&&(T=y)}g[b]=T}for(var A=0;A<l;A++)v+=g[A];for(var S=0;S<l;S++)M[S]={i:S,v:t[S],pr:g[S]/v,cs:0};M.sort(function(F,I){return F.pr-I.pr}),M[0].cs=M[0].pr;for(var L=1;L<l;L++)M[L].cs=M[L-1].cs+M[L].pr;for(var G=Math.random(),z=0;z<l-1&&M[z++].cs<G;);a.push(M[z-1].v)}return a}}});var bT=nt((NJ,wT)=>{"use strict";var b0=w0(),ST=xT(),y4=b0.eudist,RJ=b0.mandist,LJ=b0.dist,v4=ST.kmrand,_4=ST.kmpp,ET=1e4;function MT(r,t,e){e=e||[];for(var o=0;o<r;o++)e[o]=t;return e}function x4(r,t,e,o){var a=[],l=[],h=[],f=[],p=!1,d=o||ET,g=r.length,x=r[0].length,v=x>0,M=[];if(e)e=="kmrand"?a=v4(r,t):e=="kmpp"?a=_4(r,t):a=e;else for(var b={};a.length<t;){var T=Math.floor(Math.random()*g);b[T]||(b[T]=!0,a.push(r[T]))}do{MT(t,0,M);for(var _=0;_<g;_++){for(var y=1/0,A=0,S=0;S<t;S++){var f=v?y4(r[_],a[S]):Math.abs(r[_]-a[S]);f<=y&&(y=f,A=S)}h[_]=A,M[A]++}for(var L=[],l=[],G=0,z=0;z<t;z++)L[z]=v?MT(x,0,L[z]):0,l[z]=a[z];if(v){for(var F=0;F<t;F++)a[F]=[];for(var I=0;I<g;I++)for(var ut=h[I],R=L[ut],W=r[I],V=0;V<x;V++)R[V]+=W[V];p=!0;for(var Mt=0;Mt<t;Mt++){for(var X=a[Mt],mt=L[Mt],dt=l[Mt],_t=M[Mt],it=0;it<x;it++)X[it]=mt[it]/_t||0;if(p){for(var lt=0;lt<x;lt++)if(dt[lt]!=X[lt]){p=!1;break}}}}else{for(var H=0;H<g;H++){var bt=h[H];L[bt]+=r[H]}for(var Tt=0;Tt<t;Tt++)a[Tt]=L[Tt]/M[Tt]||0;p=!0;for(var Yt=0;Yt<t;Yt++)if(l[Yt]!=a[Yt]){p=!1;break}}p=p||--d<=0}while(!p);return{it:ET-d,k:t,idxs:h,centroids:a}}wT.exports=x4});var Ju=nt((R0,L0)=>{(function(r,t){typeof R0=="object"&&typeof L0!="undefined"?L0.exports=t():typeof define=="function"&&define.amd?define(t):(r=typeof globalThis!="undefined"?globalThis:r||self,r.polygonClipping=t())})(R0,function(){"use strict";function r(J,w){var P={label:0,sent:function(){if(B[0]&1)throw B[1];return B[1]},trys:[],ops:[]},D,k,B,et;return et={next:j(0),throw:j(1),return:j(2)},typeof Symbol=="function"&&(et[Symbol.iterator]=function(){return this}),et;function j(ct){return function(O){return ft([ct,O])}}function ft(ct){if(D)throw new TypeError("Generator is already executing.");for(;P;)try{if(D=1,k&&(B=ct[0]&2?k.return:ct[0]?k.throw||((B=k.return)&&B.call(k),0):k.next)&&!(B=B.call(k,ct[1])).done)return B;switch(k=0,B&&(ct=[ct[0]&2,B.value]),ct[0]){case 0:case 1:B=ct;break;case 4:return P.label++,{value:ct[1],done:!1};case 5:P.label++,k=ct[1],ct=[0];continue;case 7:ct=P.ops.pop(),P.trys.pop();continue;default:if(B=P.trys,!(B=B.length>0&&B[B.length-1])&&(ct[0]===6||ct[0]===2)){P=0;continue}if(ct[0]===3&&(!B||ct[1]>B[0]&&ct[1]<B[3])){P.label=ct[1];break}if(ct[0]===6&&P.label<B[1]){P.label=B[1],B=ct;break}if(B&&P.label<B[2]){P.label=B[2],P.ops.push(ct);break}B[2]&&P.ops.pop(),P.trys.pop();continue}ct=w.call(J,P)}catch(O){ct=[6,O],k=0}finally{D=B=0}if(ct[0]&5)throw ct[1];return{value:ct[0]?ct[1]:void 0,done:!0}}}var t=function(){function J(w,P){this.next=null,this.key=w,this.data=P,this.left=null,this.right=null}return J}();function e(J,w){return J>w?1:J<w?-1:0}function o(J,w,P){for(var D=new t(null,null),k=D,B=D;;){var et=P(J,w.key);if(et<0){if(w.left===null)break;if(P(J,w.left.key)<0){var j=w.left;if(w.left=j.right,j.right=w,w=j,w.left===null)break}B.left=w,B=w,w=w.left}else if(et>0){if(w.right===null)break;if(P(J,w.right.key)>0){var j=w.right;if(w.right=j.left,j.left=w,w=j,w.right===null)break}k.right=w,k=w,w=w.right}else break}return k.right=w.left,B.left=w.right,w.left=D.right,w.right=D.left,w}function a(J,w,P,D){var k=new t(J,w);if(P===null)return k.left=k.right=null,k;P=o(J,P,D);var B=D(J,P.key);return B<0?(k.left=P.left,k.right=P,P.left=null):B>=0&&(k.right=P.right,k.left=P,P.right=null),k}function l(J,w,P){var D=null,k=null;if(w){w=o(J,w,P);var B=P(w.key,J);B===0?(D=w.left,k=w.right):B<0?(k=w.right,w.right=null,D=w):(D=w.left,w.left=null,k=w)}return{left:D,right:k}}function h(J,w,P){return w===null?J:(J===null||(w=o(J.key,w,P),w.left=J),w)}function f(J,w,P,D,k){if(J){D(""+w+(P?"\u2514\u2500\u2500 ":"\u251C\u2500\u2500 ")+k(J)+`
|
|
4
|
-
`);var B=w+(P?" ":"\u2502 ");J.left&&f(J.left,B,!1,D,k),J.right&&f(J.right,B,!0,D,k)}}var p=function(){function J(w){w===void 0&&(w=e),this._root=null,this._size=0,this._comparator=w}return J.prototype.insert=function(w,P){return this._size++,this._root=a(w,P,this._root,this._comparator)},J.prototype.add=function(w,P){var D=new t(w,P);this._root===null&&(D.left=D.right=null,this._size++,this._root=D);var k=this._comparator,B=o(w,this._root,k),et=k(w,B.key);return et===0?this._root=B:(et<0?(D.left=B.left,D.right=B,B.left=null):et>0&&(D.right=B.right,D.left=B,B.right=null),this._size++,this._root=D),this._root},J.prototype.remove=function(w){this._root=this._remove(w,this._root,this._comparator)},J.prototype._remove=function(w,P,D){var k;if(P===null)return null;P=o(w,P,D);var B=D(w,P.key);return B===0?(P.left===null?k=P.right:(k=o(w,P.left,D),k.right=P.right),this._size--,k):P},J.prototype.pop=function(){var w=this._root;if(w){for(;w.left;)w=w.left;return this._root=o(w.key,this._root,this._comparator),this._root=this._remove(w.key,this._root,this._comparator),{key:w.key,data:w.data}}return null},J.prototype.findStatic=function(w){for(var P=this._root,D=this._comparator;P;){var k=D(w,P.key);if(k===0)return P;k<0?P=P.left:P=P.right}return null},J.prototype.find=function(w){return this._root&&(this._root=o(w,this._root,this._comparator),this._comparator(w,this._root.key)!==0)?null:this._root},J.prototype.contains=function(w){for(var P=this._root,D=this._comparator;P;){var k=D(w,P.key);if(k===0)return!0;k<0?P=P.left:P=P.right}return!1},J.prototype.forEach=function(w,P){for(var D=this._root,k=[],B=!1;!B;)D!==null?(k.push(D),D=D.left):k.length!==0?(D=k.pop(),w.call(P,D),D=D.right):B=!0;return this},J.prototype.range=function(w,P,D,k){for(var B=[],et=this._comparator,j=this._root,ft;B.length!==0||j;)if(j)B.push(j),j=j.left;else{if(j=B.pop(),ft=et(j.key,P),ft>0)break;if(et(j.key,w)>=0&&D.call(k,j))return this;j=j.right}return this},J.prototype.keys=function(){var w=[];return this.forEach(function(P){var D=P.key;return w.push(D)}),w},J.prototype.values=function(){var w=[];return this.forEach(function(P){var D=P.data;return w.push(D)}),w},J.prototype.min=function(){return this._root?this.minNode(this._root).key:null},J.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},J.prototype.minNode=function(w){if(w===void 0&&(w=this._root),w)for(;w.left;)w=w.left;return w},J.prototype.maxNode=function(w){if(w===void 0&&(w=this._root),w)for(;w.right;)w=w.right;return w},J.prototype.at=function(w){for(var P=this._root,D=!1,k=0,B=[];!D;)if(P)B.push(P),P=P.left;else if(B.length>0){if(P=B.pop(),k===w)return P;k++,P=P.right}else D=!0;return null},J.prototype.next=function(w){var P=this._root,D=null;if(w.right){for(D=w.right;D.left;)D=D.left;return D}for(var k=this._comparator;P;){var B=k(w.key,P.key);if(B===0)break;B<0?(D=P,P=P.left):P=P.right}return D},J.prototype.prev=function(w){var P=this._root,D=null;if(w.left!==null){for(D=w.left;D.right;)D=D.right;return D}for(var k=this._comparator;P;){var B=k(w.key,P.key);if(B===0)break;B<0?P=P.left:(D=P,P=P.right)}return D},J.prototype.clear=function(){return this._root=null,this._size=0,this},J.prototype.toList=function(){return x(this._root)},J.prototype.load=function(w,P,D){P===void 0&&(P=[]),D===void 0&&(D=!1);var k=w.length,B=this._comparator;if(D&&b(w,P,0,k-1,B),this._root===null)this._root=d(w,P,0,k),this._size=k;else{var et=M(this.toList(),g(w,P),B);k=this._size+k,this._root=v({head:et},0,k)}return this},J.prototype.isEmpty=function(){return this._root===null},Object.defineProperty(J.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(J.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),J.prototype.toString=function(w){w===void 0&&(w=function(D){return String(D.key)});var P=[];return f(this._root,"",!0,function(D){return P.push(D)},w),P.join("")},J.prototype.update=function(w,P,D){var k=this._comparator,B=l(w,this._root,k),et=B.left,j=B.right;k(w,P)<0?j=a(P,D,j,k):et=a(P,D,et,k),this._root=h(et,j,k)},J.prototype.split=function(w){return l(w,this._root,this._comparator)},J.prototype[Symbol.iterator]=function(){var w,P,D;return r(this,function(k){switch(k.label){case 0:w=this._root,P=[],D=!1,k.label=1;case 1:return D?[3,6]:w===null?[3,2]:(P.push(w),w=w.left,[3,5]);case 2:return P.length===0?[3,4]:(w=P.pop(),[4,w]);case 3:return k.sent(),w=w.right,[3,5];case 4:D=!0,k.label=5;case 5:return[3,1];case 6:return[2]}})},J}();function d(J,w,P,D){var k=D-P;if(k>0){var B=P+Math.floor(k/2),et=J[B],j=w[B],ft=new t(et,j);return ft.left=d(J,w,P,B),ft.right=d(J,w,B+1,D),ft}return null}function g(J,w){for(var P=new t(null,null),D=P,k=0;k<J.length;k++)D=D.next=new t(J[k],w[k]);return D.next=null,P.next}function x(J){for(var w=J,P=[],D=!1,k=new t(null,null),B=k;!D;)w?(P.push(w),w=w.left):P.length>0?(w=B=B.next=P.pop(),w=w.right):D=!0;return B.next=null,k.next}function v(J,w,P){var D=P-w;if(D>0){var k=w+Math.floor(D/2),B=v(J,w,k),et=J.head;return et.left=B,J.head=J.head.next,et.right=v(J,k+1,P),et}return null}function M(J,w,P){for(var D=new t(null,null),k=D,B=J,et=w;B!==null&&et!==null;)P(B.key,et.key)<0?(k.next=B,B=B.next):(k.next=et,et=et.next),k=k.next;return B!==null?k.next=B:et!==null&&(k.next=et),D.next}function b(J,w,P,D,k){if(!(P>=D)){for(var B=J[P+D>>1],et=P-1,j=D+1;;){do et++;while(k(J[et],B)<0);do j--;while(k(J[j],B)>0);if(et>=j)break;var ft=J[et];J[et]=J[j],J[j]=ft,ft=w[et],w[et]=w[j],w[j]=ft}b(J,w,P,j,k),b(J,w,j+1,D,k)}}let T=(J,w)=>J.ll.x<=w.x&&w.x<=J.ur.x&&J.ll.y<=w.y&&w.y<=J.ur.y,_=(J,w)=>{if(w.ur.x<J.ll.x||J.ur.x<w.ll.x||w.ur.y<J.ll.y||J.ur.y<w.ll.y)return null;let P=J.ll.x<w.ll.x?w.ll.x:J.ll.x,D=J.ur.x<w.ur.x?J.ur.x:w.ur.x,k=J.ll.y<w.ll.y?w.ll.y:J.ll.y,B=J.ur.y<w.ur.y?J.ur.y:w.ur.y;return{ll:{x:P,y:k},ur:{x:D,y:B}}},y=Number.EPSILON;y===void 0&&(y=Math.pow(2,-52));let A=y*y,S=(J,w)=>{if(-y<J&&J<y&&-y<w&&w<y)return 0;let P=J-w;return P*P<A*J*w?0:J<w?-1:1};class L{constructor(){this.reset()}reset(){this.xRounder=new G,this.yRounder=new G}round(w,P){return{x:this.xRounder.round(w),y:this.yRounder.round(P)}}}class G{constructor(){this.tree=new p,this.round(0)}round(w){let P=this.tree.add(w),D=this.tree.prev(P);if(D!==null&&S(P.key,D.key)===0)return this.tree.remove(w),D.key;let k=this.tree.next(P);return k!==null&&S(P.key,k.key)===0?(this.tree.remove(w),k.key):w}}let z=new L,F=11102230246251565e-32,I=134217729,ut=(3+8*F)*F;function R(J,w,P,D,k){let B,et,j,ft,ct=w[0],O=D[0],K=0,$=0;O>ct==O>-ct?(B=ct,ct=w[++K]):(B=O,O=D[++$]);let Q=0;if(K<J&&$<P)for(O>ct==O>-ct?(et=ct+B,j=B-(et-ct),ct=w[++K]):(et=O+B,j=B-(et-O),O=D[++$]),B=et,j!==0&&(k[Q++]=j);K<J&&$<P;)O>ct==O>-ct?(et=B+ct,ft=et-B,j=B-(et-ft)+(ct-ft),ct=w[++K]):(et=B+O,ft=et-B,j=B-(et-ft)+(O-ft),O=D[++$]),B=et,j!==0&&(k[Q++]=j);for(;K<J;)et=B+ct,ft=et-B,j=B-(et-ft)+(ct-ft),ct=w[++K],B=et,j!==0&&(k[Q++]=j);for(;$<P;)et=B+O,ft=et-B,j=B-(et-ft)+(O-ft),O=D[++$],B=et,j!==0&&(k[Q++]=j);return(B!==0||Q===0)&&(k[Q++]=B),Q}function W(J,w){let P=w[0];for(let D=1;D<J;D++)P+=w[D];return P}function V(J){return new Float64Array(J)}let Mt=(3+16*F)*F,X=(2+12*F)*F,mt=(9+64*F)*F*F,dt=V(4),_t=V(8),it=V(12),lt=V(16),H=V(4);function bt(J,w,P,D,k,B,et){let j,ft,ct,O,K,$,Q,St,Nt,Jt,Kt,Ee,de,Se,we,On,sr,_n,le=J-k,xn=P-k,In=w-B,Tn=D-B;Se=le*Tn,$=I*le,Q=$-($-le),St=le-Q,$=I*Tn,Nt=$-($-Tn),Jt=Tn-Nt,we=St*Jt-(Se-Q*Nt-St*Nt-Q*Jt),On=In*xn,$=I*In,Q=$-($-In),St=In-Q,$=I*xn,Nt=$-($-xn),Jt=xn-Nt,sr=St*Jt-(On-Q*Nt-St*Nt-Q*Jt),Kt=we-sr,K=we-Kt,dt[0]=we-(Kt+K)+(K-sr),Ee=Se+Kt,K=Ee-Se,de=Se-(Ee-K)+(Kt-K),Kt=de-On,K=de-Kt,dt[1]=de-(Kt+K)+(K-On),_n=Ee+Kt,K=_n-Ee,dt[2]=Ee-(_n-K)+(Kt-K),dt[3]=_n;let En=W(4,dt),Hr=X*et;if(En>=Hr||-En>=Hr||(K=J-le,j=J-(le+K)+(K-k),K=P-xn,ct=P-(xn+K)+(K-k),K=w-In,ft=w-(In+K)+(K-B),K=D-Tn,O=D-(Tn+K)+(K-B),j===0&&ft===0&&ct===0&&O===0)||(Hr=mt*et+ut*Math.abs(En),En+=le*O+Tn*j-(In*ct+xn*ft),En>=Hr||-En>=Hr))return En;Se=j*Tn,$=I*j,Q=$-($-j),St=j-Q,$=I*Tn,Nt=$-($-Tn),Jt=Tn-Nt,we=St*Jt-(Se-Q*Nt-St*Nt-Q*Jt),On=ft*xn,$=I*ft,Q=$-($-ft),St=ft-Q,$=I*xn,Nt=$-($-xn),Jt=xn-Nt,sr=St*Jt-(On-Q*Nt-St*Nt-Q*Jt),Kt=we-sr,K=we-Kt,H[0]=we-(Kt+K)+(K-sr),Ee=Se+Kt,K=Ee-Se,de=Se-(Ee-K)+(Kt-K),Kt=de-On,K=de-Kt,H[1]=de-(Kt+K)+(K-On),_n=Ee+Kt,K=_n-Ee,H[2]=Ee-(_n-K)+(Kt-K),H[3]=_n;let yr=R(4,dt,4,H,_t);Se=le*O,$=I*le,Q=$-($-le),St=le-Q,$=I*O,Nt=$-($-O),Jt=O-Nt,we=St*Jt-(Se-Q*Nt-St*Nt-Q*Jt),On=In*ct,$=I*In,Q=$-($-In),St=In-Q,$=I*ct,Nt=$-($-ct),Jt=ct-Nt,sr=St*Jt-(On-Q*Nt-St*Nt-Q*Jt),Kt=we-sr,K=we-Kt,H[0]=we-(Kt+K)+(K-sr),Ee=Se+Kt,K=Ee-Se,de=Se-(Ee-K)+(Kt-K),Kt=de-On,K=de-Kt,H[1]=de-(Kt+K)+(K-On),_n=Ee+Kt,K=_n-Ee,H[2]=Ee-(_n-K)+(Kt-K),H[3]=_n;let q=R(yr,_t,4,H,it);Se=j*O,$=I*j,Q=$-($-j),St=j-Q,$=I*O,Nt=$-($-O),Jt=O-Nt,we=St*Jt-(Se-Q*Nt-St*Nt-Q*Jt),On=ft*ct,$=I*ft,Q=$-($-ft),St=ft-Q,$=I*ct,Nt=$-($-ct),Jt=ct-Nt,sr=St*Jt-(On-Q*Nt-St*Nt-Q*Jt),Kt=we-sr,K=we-Kt,H[0]=we-(Kt+K)+(K-sr),Ee=Se+Kt,K=Ee-Se,de=Se-(Ee-K)+(Kt-K),Kt=de-On,K=de-Kt,H[1]=de-(Kt+K)+(K-On),_n=Ee+Kt,K=_n-Ee,H[2]=Ee-(_n-K)+(Kt-K),H[3]=_n;let st=R(q,it,4,H,lt);return lt[st-1]}function Tt(J,w,P,D,k,B){let et=(w-B)*(P-k),j=(J-k)*(D-B),ft=et-j,ct=Math.abs(et+j);return Math.abs(ft)>=Mt*ct?ft:-bt(J,w,P,D,k,B,ct)}let Yt=(J,w)=>J.x*w.y-J.y*w.x,tt=(J,w)=>J.x*w.x+J.y*w.y,wt=(J,w,P)=>{let D=Tt(J.x,J.y,w.x,w.y,P.x,P.y);return D>0?-1:D<0?1:0},Bt=J=>Math.sqrt(tt(J,J)),$t=(J,w,P)=>{let D={x:w.x-J.x,y:w.y-J.y},k={x:P.x-J.x,y:P.y-J.y};return Yt(k,D)/Bt(k)/Bt(D)},Ut=(J,w,P)=>{let D={x:w.x-J.x,y:w.y-J.y},k={x:P.x-J.x,y:P.y-J.y};return tt(k,D)/Bt(k)/Bt(D)},Dt=(J,w,P)=>w.y===0?null:{x:J.x+w.x/w.y*(P-J.y),y:P},At=(J,w,P)=>w.x===0?null:{x:P,y:J.y+w.y/w.x*(P-J.x)},te=(J,w,P,D)=>{if(w.x===0)return At(P,D,J.x);if(D.x===0)return At(J,w,P.x);if(w.y===0)return Dt(P,D,J.y);if(D.y===0)return Dt(J,w,P.y);let k=Yt(w,D);if(k==0)return null;let B={x:P.x-J.x,y:P.y-J.y},et=Yt(B,w)/k,j=Yt(B,D)/k,ft=J.x+j*w.x,ct=P.x+et*D.x,O=J.y+j*w.y,K=P.y+et*D.y,$=(ft+ct)/2,Q=(O+K)/2;return{x:$,y:Q}};class rt{static compare(w,P){let D=rt.comparePoints(w.point,P.point);return D!==0?D:(w.point!==P.point&&w.link(P),w.isLeft!==P.isLeft?w.isLeft?1:-1:zt.compare(w.segment,P.segment))}static comparePoints(w,P){return w.x<P.x?-1:w.x>P.x?1:w.y<P.y?-1:w.y>P.y?1:0}constructor(w,P){w.events===void 0?w.events=[this]:w.events.push(this),this.point=w,this.isLeft=P}link(w){if(w.point===this.point)throw new Error("Tried to link already linked events");let P=w.point.events;for(let D=0,k=P.length;D<k;D++){let B=P[D];this.point.events.push(B),B.point=this.point}this.checkForConsuming()}checkForConsuming(){let w=this.point.events.length;for(let P=0;P<w;P++){let D=this.point.events[P];if(D.segment.consumedBy===void 0)for(let k=P+1;k<w;k++){let B=this.point.events[k];B.consumedBy===void 0&&D.otherSE.point.events===B.otherSE.point.events&&D.segment.consume(B.segment)}}}getAvailableLinkedEvents(){let w=[];for(let P=0,D=this.point.events.length;P<D;P++){let k=this.point.events[P];k!==this&&!k.segment.ringOut&&k.segment.isInResult()&&w.push(k)}return w}getLeftmostComparator(w){let P=new Map,D=k=>{let B=k.otherSE;P.set(k,{sine:$t(this.point,w.point,B.point),cosine:Ut(this.point,w.point,B.point)})};return(k,B)=>{P.has(k)||D(k),P.has(B)||D(B);let{sine:et,cosine:j}=P.get(k),{sine:ft,cosine:ct}=P.get(B);return et>=0&&ft>=0?j<ct?1:j>ct?-1:0:et<0&&ft<0?j<ct?-1:j>ct?1:0:ft<et?-1:ft>et?1:0}}}let an=0;class zt{static compare(w,P){let D=w.leftSE.point.x,k=P.leftSE.point.x,B=w.rightSE.point.x,et=P.rightSE.point.x;if(et<D)return 1;if(B<k)return-1;let j=w.leftSE.point.y,ft=P.leftSE.point.y,ct=w.rightSE.point.y,O=P.rightSE.point.y;if(D<k){if(ft<j&&ft<ct)return 1;if(ft>j&&ft>ct)return-1;let K=w.comparePoint(P.leftSE.point);if(K<0)return 1;if(K>0)return-1;let $=P.comparePoint(w.rightSE.point);return $!==0?$:-1}if(D>k){if(j<ft&&j<O)return-1;if(j>ft&&j>O)return 1;let K=P.comparePoint(w.leftSE.point);if(K!==0)return K;let $=w.comparePoint(P.rightSE.point);return $<0?1:$>0?-1:1}if(j<ft)return-1;if(j>ft)return 1;if(B<et){let K=P.comparePoint(w.rightSE.point);if(K!==0)return K}if(B>et){let K=w.comparePoint(P.rightSE.point);if(K<0)return 1;if(K>0)return-1}if(B!==et){let K=ct-j,$=B-D,Q=O-ft,St=et-k;if(K>$&&Q<St)return 1;if(K<$&&Q>St)return-1}return B>et?1:B<et||ct<O?-1:ct>O?1:w.id<P.id?-1:w.id>P.id?1:0}constructor(w,P,D,k){this.id=++an,this.leftSE=w,w.segment=this,w.otherSE=P,this.rightSE=P,P.segment=this,P.otherSE=w,this.rings=D,this.windings=k}static fromRing(w,P,D){let k,B,et,j=rt.comparePoints(w,P);if(j<0)k=w,B=P,et=1;else if(j>0)k=P,B=w,et=-1;else throw new Error(`Tried to create degenerate segment at [${w.x}, ${w.y}]`);let ft=new rt(k,!0),ct=new rt(B,!1);return new zt(ft,ct,[D],[et])}replaceRightSE(w){this.rightSE=w,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}bbox(){let w=this.leftSE.point.y,P=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:w<P?w:P},ur:{x:this.rightSE.point.x,y:w>P?w:P}}}vector(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}isAnEndpoint(w){return w.x===this.leftSE.point.x&&w.y===this.leftSE.point.y||w.x===this.rightSE.point.x&&w.y===this.rightSE.point.y}comparePoint(w){if(this.isAnEndpoint(w))return 0;let P=this.leftSE.point,D=this.rightSE.point,k=this.vector();if(P.x===D.x)return w.x===P.x?0:w.x<P.x?1:-1;let B=(w.y-P.y)/k.y,et=P.x+B*k.x;if(w.x===et)return 0;let j=(w.x-P.x)/k.x,ft=P.y+j*k.y;return w.y===ft?0:w.y<ft?-1:1}getIntersection(w){let P=this.bbox(),D=w.bbox(),k=_(P,D);if(k===null)return null;let B=this.leftSE.point,et=this.rightSE.point,j=w.leftSE.point,ft=w.rightSE.point,ct=T(P,j)&&this.comparePoint(j)===0,O=T(D,B)&&w.comparePoint(B)===0,K=T(P,ft)&&this.comparePoint(ft)===0,$=T(D,et)&&w.comparePoint(et)===0;if(O&&ct)return $&&!K?et:!$&&K?ft:null;if(O)return K&&B.x===ft.x&&B.y===ft.y?null:B;if(ct)return $&&et.x===j.x&&et.y===j.y?null:j;if($&&K)return null;if($)return et;if(K)return ft;let Q=te(B,this.vector(),j,w.vector());return Q===null||!T(k,Q)?null:z.round(Q.x,Q.y)}split(w){let P=[],D=w.events!==void 0,k=new rt(w,!0),B=new rt(w,!1),et=this.rightSE;this.replaceRightSE(B),P.push(B),P.push(k);let j=new zt(k,et,this.rings.slice(),this.windings.slice());return rt.comparePoints(j.leftSE.point,j.rightSE.point)>0&&j.swapEvents(),rt.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),D&&(k.checkForConsuming(),B.checkForConsuming()),P}swapEvents(){let w=this.rightSE;this.rightSE=this.leftSE,this.leftSE=w,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(let P=0,D=this.windings.length;P<D;P++)this.windings[P]*=-1}consume(w){let P=this,D=w;for(;P.consumedBy;)P=P.consumedBy;for(;D.consumedBy;)D=D.consumedBy;let k=zt.compare(P,D);if(k!==0){if(k>0){let B=P;P=D,D=B}if(P.prev===D){let B=P;P=D,D=B}for(let B=0,et=D.rings.length;B<et;B++){let j=D.rings[B],ft=D.windings[B],ct=P.rings.indexOf(j);ct===-1?(P.rings.push(j),P.windings.push(ft)):P.windings[ct]+=ft}D.rings=null,D.windings=null,D.consumedBy=P,D.leftSE.consumedBy=P.leftSE,D.rightSE.consumedBy=P.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 w=this.prev.consumedBy||this.prev;this._beforeState=w.afterState()}return this._beforeState}afterState(){if(this._afterState!==void 0)return this._afterState;let w=this.beforeState();this._afterState={rings:w.rings.slice(0),windings:w.windings.slice(0),multiPolys:[]};let P=this._afterState.rings,D=this._afterState.windings,k=this._afterState.multiPolys;for(let j=0,ft=this.rings.length;j<ft;j++){let ct=this.rings[j],O=this.windings[j],K=P.indexOf(ct);K===-1?(P.push(ct),D.push(O)):D[K]+=O}let B=[],et=[];for(let j=0,ft=P.length;j<ft;j++){if(D[j]===0)continue;let ct=P[j],O=ct.poly;if(et.indexOf(O)===-1)if(ct.isExterior)B.push(O);else{et.indexOf(O)===-1&&et.push(O);let K=B.indexOf(ct.poly);K!==-1&&B.splice(K,1)}}for(let j=0,ft=B.length;j<ft;j++){let ct=B[j].multiPoly;k.indexOf(ct)===-1&&k.push(ct)}return this._afterState}isInResult(){if(this.consumedBy)return!1;if(this._isInResult!==void 0)return this._isInResult;let w=this.beforeState().multiPolys,P=this.afterState().multiPolys;switch(ot.type){case"union":{let D=w.length===0,k=P.length===0;this._isInResult=D!==k;break}case"intersection":{let D,k;w.length<P.length?(D=w.length,k=P.length):(D=P.length,k=w.length),this._isInResult=k===ot.numMultiPolys&&D<k;break}case"xor":{let D=Math.abs(w.length-P.length);this._isInResult=D%2===1;break}case"difference":{let D=k=>k.length===1&&k[0].isSubject;this._isInResult=D(w)!==D(P);break}default:throw new Error(`Unrecognized operation type found ${ot.type}`)}return this._isInResult}}class ne{constructor(w,P,D){if(!Array.isArray(w)||w.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=P,this.isExterior=D,this.segments=[],typeof w[0][0]!="number"||typeof w[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");let k=z.round(w[0][0],w[0][1]);this.bbox={ll:{x:k.x,y:k.y},ur:{x:k.x,y:k.y}};let B=k;for(let et=1,j=w.length;et<j;et++){if(typeof w[et][0]!="number"||typeof w[et][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");let ft=z.round(w[et][0],w[et][1]);ft.x===B.x&&ft.y===B.y||(this.segments.push(zt.fromRing(B,ft,this)),ft.x<this.bbox.ll.x&&(this.bbox.ll.x=ft.x),ft.y<this.bbox.ll.y&&(this.bbox.ll.y=ft.y),ft.x>this.bbox.ur.x&&(this.bbox.ur.x=ft.x),ft.y>this.bbox.ur.y&&(this.bbox.ur.y=ft.y),B=ft)}(k.x!==B.x||k.y!==B.y)&&this.segments.push(zt.fromRing(B,k,this))}getSweepEvents(){let w=[];for(let P=0,D=this.segments.length;P<D;P++){let k=this.segments[P];w.push(k.leftSE),w.push(k.rightSE)}return w}}class Wt{constructor(w,P){if(!Array.isArray(w))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new ne(w[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 D=1,k=w.length;D<k;D++){let B=new ne(w[D],this,!1);B.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=B.bbox.ll.x),B.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=B.bbox.ll.y),B.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=B.bbox.ur.x),B.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=B.bbox.ur.y),this.interiorRings.push(B)}this.multiPoly=P}getSweepEvents(){let w=this.exteriorRing.getSweepEvents();for(let P=0,D=this.interiorRings.length;P<D;P++){let k=this.interiorRings[P].getSweepEvents();for(let B=0,et=k.length;B<et;B++)w.push(k[B])}return w}}class ie{constructor(w,P){if(!Array.isArray(w))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{typeof w[0][0][0]=="number"&&(w=[w])}catch(D){}this.polys=[],this.bbox={ll:{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY},ur:{x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY}};for(let D=0,k=w.length;D<k;D++){let B=new Wt(w[D],this);B.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=B.bbox.ll.x),B.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=B.bbox.ll.y),B.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=B.bbox.ur.x),B.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=B.bbox.ur.y),this.polys.push(B)}this.isSubject=P}getSweepEvents(){let w=[];for(let P=0,D=this.polys.length;P<D;P++){let k=this.polys[P].getSweepEvents();for(let B=0,et=k.length;B<et;B++)w.push(k[B])}return w}}class ce{static factory(w){let P=[];for(let D=0,k=w.length;D<k;D++){let B=w[D];if(!B.isInResult()||B.ringOut)continue;let et=null,j=B.leftSE,ft=B.rightSE,ct=[j],O=j.point,K=[];for(;et=j,j=ft,ct.push(j),j.point!==O;)for(;;){let $=j.getAvailableLinkedEvents();if($.length===0){let Nt=ct[0].point,Jt=ct[ct.length-1].point;throw new Error(`Unable to complete output ring starting at [${Nt.x}, ${Nt.y}]. Last matching segment found ends at [${Jt.x}, ${Jt.y}].`)}if($.length===1){ft=$[0].otherSE;break}let Q=null;for(let Nt=0,Jt=K.length;Nt<Jt;Nt++)if(K[Nt].point===j.point){Q=Nt;break}if(Q!==null){let Nt=K.splice(Q)[0],Jt=ct.splice(Nt.index);Jt.unshift(Jt[0].otherSE),P.push(new ce(Jt.reverse()));continue}K.push({index:ct.length,point:j.point});let St=j.getLeftmostComparator(et);ft=$.sort(St)[0].otherSE;break}P.push(new ce(ct))}return P}constructor(w){this.events=w;for(let P=0,D=w.length;P<D;P++)w[P].segment.ringOut=this;this.poly=null}getGeom(){let w=this.events[0].point,P=[w];for(let ct=1,O=this.events.length-1;ct<O;ct++){let K=this.events[ct].point,$=this.events[ct+1].point;wt(K,w,$)!==0&&(P.push(K),w=K)}if(P.length===1)return null;let D=P[0],k=P[1];wt(D,w,k)===0&&P.shift(),P.push(P[0]);let B=this.isExteriorRing()?1:-1,et=this.isExteriorRing()?0:P.length-1,j=this.isExteriorRing()?P.length:-1,ft=[];for(let ct=et;ct!=j;ct+=B)ft.push([P[ct].x,P[ct].y]);return ft}isExteriorRing(){if(this._isExteriorRing===void 0){let w=this.enclosingRing();this._isExteriorRing=w?!w.isExteriorRing():!0}return this._isExteriorRing}enclosingRing(){return this._enclosingRing===void 0&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}_calcEnclosingRing(){let w=this.events[0];for(let k=1,B=this.events.length;k<B;k++){let et=this.events[k];rt.compare(w,et)>0&&(w=et)}let P=w.segment.prevInResult(),D=P?P.prevInResult():null;for(;;){if(!P)return null;if(!D)return P.ringOut;if(D.ringOut!==P.ringOut)return D.ringOut.enclosingRing()!==P.ringOut?P.ringOut:P.ringOut.enclosingRing();P=D.prevInResult(),D=P?P.prevInResult():null}}}class Lt{constructor(w){this.exteriorRing=w,w.poly=this,this.interiorRings=[]}addInterior(w){this.interiorRings.push(w),w.poly=this}getGeom(){let w=[this.exteriorRing.getGeom()];if(w[0]===null)return null;for(let P=0,D=this.interiorRings.length;P<D;P++){let k=this.interiorRings[P].getGeom();k!==null&&w.push(k)}return w}}class se{constructor(w){this.rings=w,this.polys=this._composePolys(w)}getGeom(){let w=[];for(let P=0,D=this.polys.length;P<D;P++){let k=this.polys[P].getGeom();k!==null&&w.push(k)}return w}_composePolys(w){let P=[];for(let D=0,k=w.length;D<k;D++){let B=w[D];if(!B.poly)if(B.isExteriorRing())P.push(new Lt(B));else{let et=B.enclosingRing();et.poly||P.push(new Lt(et)),et.poly.addInterior(B)}}return P}}class Y{constructor(w){let P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:zt.compare;this.queue=w,this.tree=new p(P),this.segments=[]}process(w){let P=w.segment,D=[];if(w.consumedBy)return w.isLeft?this.queue.remove(w.otherSE):this.tree.remove(P),D;let k=w.isLeft?this.tree.add(P):this.tree.find(P);if(!k)throw new Error(`Unable to find segment #${P.id} [${P.leftSE.point.x}, ${P.leftSE.point.y}] -> [${P.rightSE.point.x}, ${P.rightSE.point.y}] in SweepLine tree.`);let B=k,et=k,j,ft;for(;j===void 0;)B=this.tree.prev(B),B===null?j=null:B.key.consumedBy===void 0&&(j=B.key);for(;ft===void 0;)et=this.tree.next(et),et===null?ft=null:et.key.consumedBy===void 0&&(ft=et.key);if(w.isLeft){let ct=null;if(j){let K=j.getIntersection(P);if(K!==null&&(P.isAnEndpoint(K)||(ct=K),!j.isAnEndpoint(K))){let $=this._splitSafely(j,K);for(let Q=0,St=$.length;Q<St;Q++)D.push($[Q])}}let O=null;if(ft){let K=ft.getIntersection(P);if(K!==null&&(P.isAnEndpoint(K)||(O=K),!ft.isAnEndpoint(K))){let $=this._splitSafely(ft,K);for(let Q=0,St=$.length;Q<St;Q++)D.push($[Q])}}if(ct!==null||O!==null){let K=null;ct===null?K=O:O===null?K=ct:K=rt.comparePoints(ct,O)<=0?ct:O,this.queue.remove(P.rightSE),D.push(P.rightSE);let $=P.split(K);for(let Q=0,St=$.length;Q<St;Q++)D.push($[Q])}D.length>0?(this.tree.remove(P),D.push(w)):(this.segments.push(P),P.prev=j)}else{if(j&&ft){let ct=j.getIntersection(ft);if(ct!==null){if(!j.isAnEndpoint(ct)){let O=this._splitSafely(j,ct);for(let K=0,$=O.length;K<$;K++)D.push(O[K])}if(!ft.isAnEndpoint(ct)){let O=this._splitSafely(ft,ct);for(let K=0,$=O.length;K<$;K++)D.push(O[K])}}}this.tree.remove(P)}return D}_splitSafely(w,P){this.tree.remove(w);let D=w.rightSE;this.queue.remove(D);let k=w.split(P);return k.push(D),w.consumedBy===void 0&&this.tree.add(w),k}}let N=typeof process!="undefined"&&process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,xt=typeof process!="undefined"&&process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6;class Et{run(w,P,D){ot.type=w,z.reset();let k=[new ie(P,!0)];for(let K=0,$=D.length;K<$;K++)k.push(new ie(D[K],!1));if(ot.numMultiPolys=k.length,ot.type==="difference"){let K=k[0],$=1;for(;$<k.length;)_(k[$].bbox,K.bbox)!==null?$++:k.splice($,1)}if(ot.type==="intersection")for(let K=0,$=k.length;K<$;K++){let Q=k[K];for(let St=K+1,Nt=k.length;St<Nt;St++)if(_(Q.bbox,k[St].bbox)===null)return[]}let B=new p(rt.compare);for(let K=0,$=k.length;K<$;K++){let Q=k[K].getSweepEvents();for(let St=0,Nt=Q.length;St<Nt;St++)if(B.insert(Q[St]),B.size>N)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big).")}let et=new Y(B),j=B.size,ft=B.pop();for(;ft;){let K=ft.key;if(B.size===j){let Q=K.segment;throw new Error(`Unable to pop() ${K.isLeft?"left":"right"} SweepEvent [${K.point.x}, ${K.point.y}] from segment #${Q.id} [${Q.leftSE.point.x}, ${Q.leftSE.point.y}] -> [${Q.rightSE.point.x}, ${Q.rightSE.point.y}] from queue.`)}if(B.size>N)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big).");if(et.segments.length>xt)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments).");let $=et.process(K);for(let Q=0,St=$.length;Q<St;Q++){let Nt=$[Q];Nt.consumedBy===void 0&&B.insert(Nt)}j=B.size,ft=B.pop()}z.reset();let ct=ce.factory(et.segments);return new se(ct).getGeom()}}let ot=new Et;var kt={union:function(J){for(var w=arguments.length,P=new Array(w>1?w-1:0),D=1;D<w;D++)P[D-1]=arguments[D];return ot.run("union",J,P)},intersection:function(J){for(var w=arguments.length,P=new Array(w>1?w-1:0),D=1;D<w;D++)P[D-1]=arguments[D];return ot.run("intersection",J,P)},xor:function(J){for(var w=arguments.length,P=new Array(w>1?w-1:0),D=1;D<w;D++)P[D-1]=arguments[D];return ot.run("xor",J,P)},difference:function(J){for(var w=arguments.length,P=new Array(w>1?w-1:0),D=1;D<w;D++)P[D-1]=arguments[D];return ot.run("difference",J,P)}};return kt})});var HT=nt((qh,VT)=>{(function(r,t){typeof qh=="object"&&typeof VT!="undefined"?t(qh):typeof define=="function"&&define.amd?define(["exports"],t):t(r.jsts={})})(qh,function(r){"use strict";function t(){}function e(n){this.message=n||""}function o(n){this.message=n||""}function a(n){this.message=n||""}function l(){}function h(n){return n===null?we:n.color}function f(n){return n===null?null:n.parent}function p(n,i){n!==null&&(n.color=i)}function d(n){return n===null?null:n.left}function g(n){return n===null?null:n.right}function x(){this.root_=null,this.size_=0}function v(){}function M(){this.array_=[],arguments[0]instanceof j&&this.addAll(arguments[0])}function b(){}function T(n){this.message=n||""}function _(){this.array_=[]}"fill"in Array.prototype||Object.defineProperty(Array.prototype,"fill",{configurable:!0,value:function(n){if(this===void 0||this===null)throw new TypeError(this+" is not an object");var i=Object(this),s=Math.max(Math.min(i.length,9007199254740991),0)||0,u=1 in arguments&&parseInt(Number(arguments[1]),10)||0;u=u<0?Math.max(s+u,0):Math.min(u,s);var c=2 in arguments&&arguments[2]!==void 0?parseInt(Number(arguments[2]),10)||0:s;for(c=c<0?Math.max(s+arguments[2],0):Math.min(c,s);u<c;)i[u]=n,++u;return i},writable:!0}),Number.isFinite=Number.isFinite||function(n){return typeof n=="number"&&isFinite(n)},Number.isInteger=Number.isInteger||function(n){return typeof n=="number"&&isFinite(n)&&Math.floor(n)===n},Number.parseFloat=Number.parseFloat||parseFloat,Number.isNaN=Number.isNaN||function(n){return n!=n},Math.trunc=Math.trunc||function(n){return n<0?Math.ceil(n):Math.floor(n)};var y=function(){};y.prototype.interfaces_=function(){return[]},y.prototype.getClass=function(){return y},y.prototype.equalsWithTolerance=function(n,i,s){return Math.abs(n-i)<=s};var A=function(n){function i(s){n.call(this,s),this.name="IllegalArgumentException",this.message=s,this.stack=new n().stack}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i}(Error),S=function(){},L={MAX_VALUE:{configurable:!0}};S.isNaN=function(n){return Number.isNaN(n)},S.doubleToLongBits=function(n){return n},S.longBitsToDouble=function(n){return n},S.isInfinite=function(n){return!Number.isFinite(n)},L.MAX_VALUE.get=function(){return Number.MAX_VALUE},Object.defineProperties(S,L);var G=function(){},z=function(){},F=function(){},I=function n(){if(this.x=null,this.y=null,this.z=null,arguments.length===0)this.x=0,this.y=0,this.z=n.NULL_ORDINATE;else if(arguments.length===1){var i=arguments[0];this.x=i.x,this.y=i.y,this.z=i.z}else arguments.length===2?(this.x=arguments[0],this.y=arguments[1],this.z=n.NULL_ORDINATE):arguments.length===3&&(this.x=arguments[0],this.y=arguments[1],this.z=arguments[2])},ut={DimensionalComparator:{configurable:!0},serialVersionUID:{configurable:!0},NULL_ORDINATE:{configurable:!0},X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0}};I.prototype.setOrdinate=function(n,i){switch(n){case I.X:this.x=i;break;case I.Y:this.y=i;break;case I.Z:this.z=i;break;default:throw new A("Invalid ordinate index: "+n)}},I.prototype.equals2D=function(){if(arguments.length===1){var n=arguments[0];return this.x===n.x&&this.y===n.y}if(arguments.length===2){var i=arguments[0],s=arguments[1];return!!y.equalsWithTolerance(this.x,i.x,s)&&!!y.equalsWithTolerance(this.y,i.y,s)}},I.prototype.getOrdinate=function(n){switch(n){case I.X:return this.x;case I.Y:return this.y;case I.Z:return this.z}throw new A("Invalid ordinate index: "+n)},I.prototype.equals3D=function(n){return this.x===n.x&&this.y===n.y&&(this.z===n.z||S.isNaN(this.z))&&S.isNaN(n.z)},I.prototype.equals=function(n){return n instanceof I&&this.equals2D(n)},I.prototype.equalInZ=function(n,i){return y.equalsWithTolerance(this.z,n.z,i)},I.prototype.compareTo=function(n){var i=n;return this.x<i.x?-1:this.x>i.x?1:this.y<i.y?-1:this.y>i.y?1:0},I.prototype.clone=function(){},I.prototype.copy=function(){return new I(this)},I.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},I.prototype.distance3D=function(n){var i=this.x-n.x,s=this.y-n.y,u=this.z-n.z;return Math.sqrt(i*i+s*s+u*u)},I.prototype.distance=function(n){var i=this.x-n.x,s=this.y-n.y;return Math.sqrt(i*i+s*s)},I.prototype.hashCode=function(){var n=17;return n=37*n+I.hashCode(this.x),n=37*n+I.hashCode(this.y)},I.prototype.setCoordinate=function(n){this.x=n.x,this.y=n.y,this.z=n.z},I.prototype.interfaces_=function(){return[G,z,t]},I.prototype.getClass=function(){return I},I.hashCode=function(){if(arguments.length===1){var n=arguments[0],i=S.doubleToLongBits(n);return Math.trunc((i^i)>>>32)}},ut.DimensionalComparator.get=function(){return R},ut.serialVersionUID.get=function(){return 6683108902428367e3},ut.NULL_ORDINATE.get=function(){return S.NaN},ut.X.get=function(){return 0},ut.Y.get=function(){return 1},ut.Z.get=function(){return 2},Object.defineProperties(I,ut);var R=function(n){if(this._dimensionsToTest=2,arguments.length!==0){if(arguments.length===1){var i=arguments[0];if(i!==2&&i!==3)throw new A("only 2 or 3 dimensions may be specified");this._dimensionsToTest=i}}};R.prototype.compare=function(n,i){var s=n,u=i,c=R.compare(s.x,u.x);if(c!==0)return c;var m=R.compare(s.y,u.y);return m!==0?m:this._dimensionsToTest<=2?0:R.compare(s.z,u.z)},R.prototype.interfaces_=function(){return[F]},R.prototype.getClass=function(){return R},R.compare=function(n,i){return n<i?-1:n>i?1:S.isNaN(n)?S.isNaN(i)?0:-1:S.isNaN(i)?1:0};var W=function(){};W.prototype.create=function(){},W.prototype.interfaces_=function(){return[]},W.prototype.getClass=function(){return W};var V=function(){},Mt={INTERIOR:{configurable:!0},BOUNDARY:{configurable:!0},EXTERIOR:{configurable:!0},NONE:{configurable:!0}};V.prototype.interfaces_=function(){return[]},V.prototype.getClass=function(){return V},V.toLocationSymbol=function(n){switch(n){case V.EXTERIOR:return"e";case V.BOUNDARY:return"b";case V.INTERIOR:return"i";case V.NONE:return"-"}throw new A("Unknown location value: "+n)},Mt.INTERIOR.get=function(){return 0},Mt.BOUNDARY.get=function(){return 1},Mt.EXTERIOR.get=function(){return 2},Mt.NONE.get=function(){return-1},Object.defineProperties(V,Mt);var X=function(n,i){return n.interfaces_&&n.interfaces_().indexOf(i)>-1},mt=function(){},dt={LOG_10:{configurable:!0}};mt.prototype.interfaces_=function(){return[]},mt.prototype.getClass=function(){return mt},mt.log10=function(n){var i=Math.log(n);return S.isInfinite(i)||S.isNaN(i)?i:i/mt.LOG_10},mt.min=function(n,i,s,u){var c=n;return i<c&&(c=i),s<c&&(c=s),u<c&&(c=u),c},mt.clamp=function(){if(typeof arguments[2]=="number"&&typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var n=arguments[0],i=arguments[1],s=arguments[2];return n<i?i:n>s?s:n}if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var u=arguments[0],c=arguments[1],m=arguments[2];return u<c?c:u>m?m:u}},mt.wrap=function(n,i){return n<0?i- -n%i:n%i},mt.max=function(){if(arguments.length===3){var n=arguments[0],i=arguments[1],s=arguments[2],u=n;return i>u&&(u=i),s>u&&(u=s),u}if(arguments.length===4){var c=arguments[0],m=arguments[1],E=arguments[2],C=arguments[3],U=c;return m>U&&(U=m),E>U&&(U=E),C>U&&(U=C),U}},mt.average=function(n,i){return(n+i)/2},dt.LOG_10.get=function(){return Math.log(10)},Object.defineProperties(mt,dt);var _t=function(n){this.str=n};_t.prototype.append=function(n){this.str+=n},_t.prototype.setCharAt=function(n,i){this.str=this.str.substr(0,n)+i+this.str.substr(n+1)},_t.prototype.toString=function(n){return this.str};var it=function(n){this.value=n};it.prototype.intValue=function(){return this.value},it.prototype.compareTo=function(n){return this.value<n?-1:this.value>n?1:0},it.isNaN=function(n){return Number.isNaN(n)};var lt=function(){};lt.isWhitespace=function(n){return n<=32&&n>=0||n===127},lt.toUpperCase=function(n){return n.toUpperCase()};var H=function n(){if(this._hi=0,this._lo=0,arguments.length===0)this.init(0);else if(arguments.length===1){if(typeof arguments[0]=="number"){var i=arguments[0];this.init(i)}else if(arguments[0]instanceof n){var s=arguments[0];this.init(s)}else if(typeof arguments[0]=="string"){var u=arguments[0];n.call(this,n.parse(u))}}else if(arguments.length===2){var c=arguments[0],m=arguments[1];this.init(c,m)}},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}};H.prototype.le=function(n){return(this._hi<n._hi||this._hi===n._hi)&&this._lo<=n._lo},H.prototype.extractSignificantDigits=function(n,i){var s=this.abs(),u=H.magnitude(s._hi),c=H.TEN.pow(u);(s=s.divide(c)).gt(H.TEN)?(s=s.divide(H.TEN),u+=1):s.lt(H.ONE)&&(s=s.multiply(H.TEN),u-=1);for(var m=u+1,E=new _t,C=H.MAX_PRINT_DIGITS-1,U=0;U<=C;U++){n&&U===m&&E.append(".");var Z=Math.trunc(s._hi);if(Z<0)break;var pt=!1,gt=0;Z>9?(pt=!0,gt="9"):gt="0"+Z,E.append(gt),s=s.subtract(H.valueOf(Z)).multiply(H.TEN),pt&&s.selfAdd(H.TEN);var Rt=!0,Ft=H.magnitude(s._hi);if(Ft<0&&Math.abs(Ft)>=C-U&&(Rt=!1),!Rt)break}return i[0]=u,E.toString()},H.prototype.sqr=function(){return this.multiply(this)},H.prototype.doubleValue=function(){return this._hi+this._lo},H.prototype.subtract=function(){if(arguments[0]instanceof H){var n=arguments[0];return this.add(n.negate())}if(typeof arguments[0]=="number"){var i=arguments[0];return this.add(-i)}},H.prototype.equals=function(){if(arguments.length===1){var n=arguments[0];return this._hi===n._hi&&this._lo===n._lo}},H.prototype.isZero=function(){return this._hi===0&&this._lo===0},H.prototype.selfSubtract=function(){if(arguments[0]instanceof H){var n=arguments[0];return this.isNaN()?this:this.selfAdd(-n._hi,-n._lo)}if(typeof arguments[0]=="number"){var i=arguments[0];return this.isNaN()?this:this.selfAdd(-i,0)}},H.prototype.getSpecialNumberString=function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null},H.prototype.min=function(n){return this.le(n)?this:n},H.prototype.selfDivide=function(){if(arguments.length===1){if(arguments[0]instanceof H){var n=arguments[0];return this.selfDivide(n._hi,n._lo)}if(typeof arguments[0]=="number"){var i=arguments[0];return this.selfDivide(i,0)}}else if(arguments.length===2){var s=arguments[0],u=arguments[1],c=null,m=null,E=null,C=null,U=null,Z=null,pt=null,gt=null;return U=this._hi/s,Z=H.SPLIT*U,c=Z-U,gt=H.SPLIT*s,c=Z-c,m=U-c,E=gt-s,pt=U*s,E=gt-E,C=s-E,gt=c*E-pt+c*C+m*E+m*C,Z=(this._hi-pt-gt+this._lo-U*u)/s,gt=U+Z,this._hi=gt,this._lo=U-gt+Z,this}},H.prototype.dump=function(){return"DD<"+this._hi+", "+this._lo+">"},H.prototype.divide=function(){if(arguments[0]instanceof H){var n=arguments[0],i=null,s=null,u=null,c=null,m=null,E=null,C=null,U=null;return s=(m=this._hi/n._hi)-(i=(E=H.SPLIT*m)-(i=E-m)),U=i*(u=(U=H.SPLIT*n._hi)-(u=U-n._hi))-(C=m*n._hi)+i*(c=n._hi-u)+s*u+s*c,E=(this._hi-C-U+this._lo-m*n._lo)/n._hi,new H(U=m+E,m-U+E)}if(typeof arguments[0]=="number"){var Z=arguments[0];return S.isNaN(Z)?H.createNaN():H.copy(this).selfDivide(Z,0)}},H.prototype.ge=function(n){return(this._hi>n._hi||this._hi===n._hi)&&this._lo>=n._lo},H.prototype.pow=function(n){if(n===0)return H.valueOf(1);var i=new H(this),s=H.valueOf(1),u=Math.abs(n);if(u>1)for(;u>0;)u%2==1&&s.selfMultiply(i),(u/=2)>0&&(i=i.sqr());else s=i;return n<0?s.reciprocal():s},H.prototype.ceil=function(){if(this.isNaN())return H.NaN;var n=Math.ceil(this._hi),i=0;return n===this._hi&&(i=Math.ceil(this._lo)),new H(n,i)},H.prototype.compareTo=function(n){var i=n;return this._hi<i._hi?-1:this._hi>i._hi?1:this._lo<i._lo?-1:this._lo>i._lo?1:0},H.prototype.rint=function(){return this.isNaN()?this:this.add(.5).floor()},H.prototype.setValue=function(){if(arguments[0]instanceof H){var n=arguments[0];return this.init(n),this}if(typeof arguments[0]=="number"){var i=arguments[0];return this.init(i),this}},H.prototype.max=function(n){return this.ge(n)?this:n},H.prototype.sqrt=function(){if(this.isZero())return H.valueOf(0);if(this.isNegative())return H.NaN;var n=1/Math.sqrt(this._hi),i=this._hi*n,s=H.valueOf(i),u=this.subtract(s.sqr())._hi*(.5*n);return s.add(u)},H.prototype.selfAdd=function(){if(arguments.length===1){if(arguments[0]instanceof H){var n=arguments[0];return this.selfAdd(n._hi,n._lo)}if(typeof arguments[0]=="number"){var i=arguments[0],s=null,u=null,c=null,m=null,E=null,C=null;return c=this._hi+i,E=c-this._hi,m=c-E,m=i-E+(this._hi-m),C=m+this._lo,s=c+C,u=C+(c-s),this._hi=s+u,this._lo=u+(s-this._hi),this}}else if(arguments.length===2){var U=arguments[0],Z=arguments[1],pt=null,gt=null,Rt=null,Ft=null,Vt=null,ee=null,hn=null;Ft=this._hi+U,gt=this._lo+Z,Vt=Ft-(ee=Ft-this._hi),Rt=gt-(hn=gt-this._lo);var qn=(pt=Ft+(ee=(Vt=U-ee+(this._hi-Vt))+gt))+(ee=(Rt=Z-hn+(this._lo-Rt))+(ee+(Ft-pt))),Tr=ee+(pt-qn);return this._hi=qn,this._lo=Tr,this}},H.prototype.selfMultiply=function(){if(arguments.length===1){if(arguments[0]instanceof H){var n=arguments[0];return this.selfMultiply(n._hi,n._lo)}if(typeof arguments[0]=="number"){var i=arguments[0];return this.selfMultiply(i,0)}}else if(arguments.length===2){var s=arguments[0],u=arguments[1],c=null,m=null,E=null,C=null,U=null,Z=null;c=(U=H.SPLIT*this._hi)-this._hi,Z=H.SPLIT*s,c=U-c,m=this._hi-c,E=Z-s;var pt=(U=this._hi*s)+(Z=c*(E=Z-E)-U+c*(C=s-E)+m*E+m*C+(this._hi*u+this._lo*s)),gt=Z+(c=U-pt);return this._hi=pt,this._lo=gt,this}},H.prototype.selfSqr=function(){return this.selfMultiply(this)},H.prototype.floor=function(){if(this.isNaN())return H.NaN;var n=Math.floor(this._hi),i=0;return n===this._hi&&(i=Math.floor(this._lo)),new H(n,i)},H.prototype.negate=function(){return this.isNaN()?this:new H(-this._hi,-this._lo)},H.prototype.clone=function(){},H.prototype.multiply=function(){if(arguments[0]instanceof H){var n=arguments[0];return n.isNaN()?H.createNaN():H.copy(this).selfMultiply(n)}if(typeof arguments[0]=="number"){var i=arguments[0];return S.isNaN(i)?H.createNaN():H.copy(this).selfMultiply(i,0)}},H.prototype.isNaN=function(){return S.isNaN(this._hi)},H.prototype.intValue=function(){return Math.trunc(this._hi)},H.prototype.toString=function(){var n=H.magnitude(this._hi);return n>=-3&&n<=20?this.toStandardNotation():this.toSciNotation()},H.prototype.toStandardNotation=function(){var n=this.getSpecialNumberString();if(n!==null)return n;var i=new Array(1).fill(null),s=this.extractSignificantDigits(!0,i),u=i[0]+1,c=s;if(s.charAt(0)===".")c="0"+s;else if(u<0)c="0."+H.stringOfChar("0",-u)+s;else if(s.indexOf(".")===-1){var m=u-s.length;c=s+H.stringOfChar("0",m)+".0"}return this.isNegative()?"-"+c:c},H.prototype.reciprocal=function(){var n=null,i=null,s=null,u=null,c=null,m=null,E=null,C=null;i=(c=1/this._hi)-(n=(m=H.SPLIT*c)-(n=m-c)),s=(C=H.SPLIT*this._hi)-this._hi;var U=c+(m=(1-(E=c*this._hi)-(C=n*(s=C-s)-E+n*(u=this._hi-s)+i*s+i*u)-c*this._lo)/this._hi);return new H(U,c-U+m)},H.prototype.toSciNotation=function(){if(this.isZero())return H.SCI_NOT_ZERO;var n=this.getSpecialNumberString();if(n!==null)return n;var i=new Array(1).fill(null),s=this.extractSignificantDigits(!1,i),u=H.SCI_NOT_EXPONENT_CHAR+i[0];if(s.charAt(0)==="0")throw new Error("Found leading zero: "+s);var c="";s.length>1&&(c=s.substring(1));var m=s.charAt(0)+"."+c;return this.isNegative()?"-"+m+u:m+u},H.prototype.abs=function(){return this.isNaN()?H.NaN:this.isNegative()?this.negate():new H(this)},H.prototype.isPositive=function(){return(this._hi>0||this._hi===0)&&this._lo>0},H.prototype.lt=function(n){return(this._hi<n._hi||this._hi===n._hi)&&this._lo<n._lo},H.prototype.add=function(){if(arguments[0]instanceof H){var n=arguments[0];return H.copy(this).selfAdd(n)}if(typeof arguments[0]=="number"){var i=arguments[0];return H.copy(this).selfAdd(i)}},H.prototype.init=function(){if(arguments.length===1){if(typeof arguments[0]=="number"){var n=arguments[0];this._hi=n,this._lo=0}else if(arguments[0]instanceof H){var i=arguments[0];this._hi=i._hi,this._lo=i._lo}}else if(arguments.length===2){var s=arguments[0],u=arguments[1];this._hi=s,this._lo=u}},H.prototype.gt=function(n){return(this._hi>n._hi||this._hi===n._hi)&&this._lo>n._lo},H.prototype.isNegative=function(){return(this._hi<0||this._hi===0)&&this._lo<0},H.prototype.trunc=function(){return this.isNaN()?H.NaN:this.isPositive()?this.floor():this.ceil()},H.prototype.signum=function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0},H.prototype.interfaces_=function(){return[t,G,z]},H.prototype.getClass=function(){return H},H.sqr=function(n){return H.valueOf(n).selfMultiply(n)},H.valueOf=function(){if(typeof arguments[0]=="string"){var n=arguments[0];return H.parse(n)}if(typeof arguments[0]=="number"){var i=arguments[0];return new H(i)}},H.sqrt=function(n){return H.valueOf(n).sqrt()},H.parse=function(n){for(var i=0,s=n.length;lt.isWhitespace(n.charAt(i));)i++;var u=!1;if(i<s){var c=n.charAt(i);c!=="-"&&c!=="+"||(i++,c==="-"&&(u=!0))}for(var m=new H,E=0,C=0,U=0;!(i>=s);){var Z=n.charAt(i);if(i++,lt.isDigit(Z)){var pt=Z-"0";m.selfMultiply(H.TEN),m.selfAdd(pt),E++}else{if(Z!=="."){if(Z==="e"||Z==="E"){var gt=n.substring(i);try{U=it.parseInt(gt)}catch(hn){throw hn instanceof Error?new Error("Invalid exponent "+gt+" in string "+n):hn}break}throw new Error("Unexpected character '"+Z+"' at position "+i+" in string "+n)}C=E}}var Rt=m,Ft=E-C-U;if(Ft===0)Rt=m;else if(Ft>0){var Vt=H.TEN.pow(Ft);Rt=m.divide(Vt)}else if(Ft<0){var ee=H.TEN.pow(-Ft);Rt=m.multiply(ee)}return u?Rt.negate():Rt},H.createNaN=function(){return new H(S.NaN,S.NaN)},H.copy=function(n){return new H(n)},H.magnitude=function(n){var i=Math.abs(n),s=Math.log(i)/Math.log(10),u=Math.trunc(Math.floor(s));return 10*Math.pow(10,u)<=i&&(u+=1),u},H.stringOfChar=function(n,i){for(var s=new _t,u=0;u<i;u++)s.append(n);return s.toString()},bt.PI.get=function(){return new H(3.141592653589793,12246467991473532e-32)},bt.TWO_PI.get=function(){return new H(6.283185307179586,24492935982947064e-32)},bt.PI_2.get=function(){return new H(1.5707963267948966,6123233995736766e-32)},bt.E.get=function(){return new H(2.718281828459045,14456468917292502e-32)},bt.NaN.get=function(){return new H(S.NaN,S.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 H.valueOf(10)},bt.ONE.get=function(){return H.valueOf(1)},bt.SCI_NOT_EXPONENT_CHAR.get=function(){return"E"},bt.SCI_NOT_ZERO.get=function(){return"0.0E0"},Object.defineProperties(H,bt);var Tt=function(){},Yt={DP_SAFE_EPSILON:{configurable:!0}};Tt.prototype.interfaces_=function(){return[]},Tt.prototype.getClass=function(){return Tt},Tt.orientationIndex=function(n,i,s){var u=Tt.orientationIndexFilter(n,i,s);if(u<=1)return u;var c=H.valueOf(i.x).selfAdd(-n.x),m=H.valueOf(i.y).selfAdd(-n.y),E=H.valueOf(s.x).selfAdd(-i.x),C=H.valueOf(s.y).selfAdd(-i.y);return c.selfMultiply(C).selfSubtract(m.selfMultiply(E)).signum()},Tt.signOfDet2x2=function(n,i,s,u){return n.multiply(u).selfSubtract(i.multiply(s)).signum()},Tt.intersection=function(n,i,s,u){var c=H.valueOf(u.y).selfSubtract(s.y).selfMultiply(H.valueOf(i.x).selfSubtract(n.x)),m=H.valueOf(u.x).selfSubtract(s.x).selfMultiply(H.valueOf(i.y).selfSubtract(n.y)),E=c.subtract(m),C=H.valueOf(u.x).selfSubtract(s.x).selfMultiply(H.valueOf(n.y).selfSubtract(s.y)),U=H.valueOf(u.y).selfSubtract(s.y).selfMultiply(H.valueOf(n.x).selfSubtract(s.x)),Z=C.subtract(U).selfDivide(E).doubleValue(),pt=H.valueOf(n.x).selfAdd(H.valueOf(i.x).selfSubtract(n.x).selfMultiply(Z)).doubleValue(),gt=H.valueOf(i.x).selfSubtract(n.x).selfMultiply(H.valueOf(n.y).selfSubtract(s.y)),Rt=H.valueOf(i.y).selfSubtract(n.y).selfMultiply(H.valueOf(n.x).selfSubtract(s.x)),Ft=gt.subtract(Rt).selfDivide(E).doubleValue(),Vt=H.valueOf(s.y).selfAdd(H.valueOf(u.y).selfSubtract(s.y).selfMultiply(Ft)).doubleValue();return new I(pt,Vt)},Tt.orientationIndexFilter=function(n,i,s){var u=null,c=(n.x-s.x)*(i.y-s.y),m=(n.y-s.y)*(i.x-s.x),E=c-m;if(c>0){if(m<=0)return Tt.signum(E);u=c+m}else{if(!(c<0)||m>=0)return Tt.signum(E);u=-c-m}var C=Tt.DP_SAFE_EPSILON*u;return E>=C||-E>=C?Tt.signum(E):2},Tt.signum=function(n){return n>0?1:n<0?-1:0},Yt.DP_SAFE_EPSILON.get=function(){return 1e-15},Object.defineProperties(Tt,Yt);var tt=function(){},wt={X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0},M:{configurable:!0}};wt.X.get=function(){return 0},wt.Y.get=function(){return 1},wt.Z.get=function(){return 2},wt.M.get=function(){return 3},tt.prototype.setOrdinate=function(n,i,s){},tt.prototype.size=function(){},tt.prototype.getOrdinate=function(n,i){},tt.prototype.getCoordinate=function(){},tt.prototype.getCoordinateCopy=function(n){},tt.prototype.getDimension=function(){},tt.prototype.getX=function(n){},tt.prototype.clone=function(){},tt.prototype.expandEnvelope=function(n){},tt.prototype.copy=function(){},tt.prototype.getY=function(n){},tt.prototype.toCoordinateArray=function(){},tt.prototype.interfaces_=function(){return[z]},tt.prototype.getClass=function(){return tt},Object.defineProperties(tt,wt);var Bt=function(){},$t=function(n){function i(){n.call(this,"Projective point not representable on the Cartesian plane.")}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(Bt),Ut=function(){};Ut.arraycopy=function(n,i,s,u,c){for(var m=0,E=i;E<i+c;E++)s[u+m]=n[E],m++},Ut.getProperty=function(n){return{"line.separator":`
|
|
5
|
-
`}[n]};var Dt=function n(){if(this.x=null,this.y=null,this.w=null,arguments.length===0)this.x=0,this.y=0,this.w=1;else if(arguments.length===1){var i=arguments[0];this.x=i.x,this.y=i.y,this.w=1}else if(arguments.length===2){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var s=arguments[0],u=arguments[1];this.x=s,this.y=u,this.w=1}else if(arguments[0]instanceof n&&arguments[1]instanceof n){var c=arguments[0],m=arguments[1];this.x=c.y*m.w-m.y*c.w,this.y=m.x*c.w-c.x*m.w,this.w=c.x*m.y-m.x*c.y}else if(arguments[0]instanceof I&&arguments[1]instanceof I){var E=arguments[0],C=arguments[1];this.x=E.y-C.y,this.y=C.x-E.x,this.w=E.x*C.y-C.x*E.y}}else if(arguments.length===3){var U=arguments[0],Z=arguments[1],pt=arguments[2];this.x=U,this.y=Z,this.w=pt}else if(arguments.length===4){var gt=arguments[0],Rt=arguments[1],Ft=arguments[2],Vt=arguments[3],ee=gt.y-Rt.y,hn=Rt.x-gt.x,qn=gt.x*Rt.y-Rt.x*gt.y,Tr=Ft.y-Vt.y,no=Vt.x-Ft.x,$o=Ft.x*Vt.y-Vt.x*Ft.y;this.x=hn*$o-no*qn,this.y=Tr*qn-ee*$o,this.w=ee*no-Tr*hn}};Dt.prototype.getY=function(){var n=this.y/this.w;if(S.isNaN(n)||S.isInfinite(n))throw new $t;return n},Dt.prototype.getX=function(){var n=this.x/this.w;if(S.isNaN(n)||S.isInfinite(n))throw new $t;return n},Dt.prototype.getCoordinate=function(){var n=new I;return n.x=this.getX(),n.y=this.getY(),n},Dt.prototype.interfaces_=function(){return[]},Dt.prototype.getClass=function(){return Dt},Dt.intersection=function(n,i,s,u){var c=n.y-i.y,m=i.x-n.x,E=n.x*i.y-i.x*n.y,C=s.y-u.y,U=u.x-s.x,Z=s.x*u.y-u.x*s.y,pt=c*U-C*m,gt=(m*Z-U*E)/pt,Rt=(C*E-c*Z)/pt;if(S.isNaN(gt)||S.isInfinite(gt)||S.isNaN(Rt)||S.isInfinite(Rt))throw new $t;return new I(gt,Rt)};var At=function n(){if(this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,arguments.length===0)this.init();else if(arguments.length===1){if(arguments[0]instanceof I){var i=arguments[0];this.init(i.x,i.x,i.y,i.y)}else if(arguments[0]instanceof n){var s=arguments[0];this.init(s)}}else if(arguments.length===2){var u=arguments[0],c=arguments[1];this.init(u.x,c.x,u.y,c.y)}else if(arguments.length===4){var m=arguments[0],E=arguments[1],C=arguments[2],U=arguments[3];this.init(m,E,C,U)}},te={serialVersionUID:{configurable:!0}};At.prototype.getArea=function(){return this.getWidth()*this.getHeight()},At.prototype.equals=function(n){if(!(n instanceof At))return!1;var i=n;return this.isNull()?i.isNull():this._maxx===i.getMaxX()&&this._maxy===i.getMaxY()&&this._minx===i.getMinX()&&this._miny===i.getMinY()},At.prototype.intersection=function(n){if(this.isNull()||n.isNull()||!this.intersects(n))return new At;var i=this._minx>n._minx?this._minx:n._minx,s=this._miny>n._miny?this._miny:n._miny,u=this._maxx<n._maxx?this._maxx:n._maxx,c=this._maxy<n._maxy?this._maxy:n._maxy;return new At(i,u,s,c)},At.prototype.isNull=function(){return this._maxx<this._minx},At.prototype.getMaxX=function(){return this._maxx},At.prototype.covers=function(){if(arguments.length===1){if(arguments[0]instanceof I){var n=arguments[0];return this.covers(n.x,n.y)}if(arguments[0]instanceof At){var i=arguments[0];return!this.isNull()&&!i.isNull()&&i.getMinX()>=this._minx&&i.getMaxX()<=this._maxx&&i.getMinY()>=this._miny&&i.getMaxY()<=this._maxy}}else if(arguments.length===2){var s=arguments[0],u=arguments[1];return!this.isNull()&&s>=this._minx&&s<=this._maxx&&u>=this._miny&&u<=this._maxy}},At.prototype.intersects=function(){if(arguments.length===1){if(arguments[0]instanceof At){var n=arguments[0];return!this.isNull()&&!n.isNull()&&!(n._minx>this._maxx||n._maxx<this._minx||n._miny>this._maxy||n._maxy<this._miny)}if(arguments[0]instanceof I){var i=arguments[0];return this.intersects(i.x,i.y)}}else if(arguments.length===2){var s=arguments[0],u=arguments[1];return!this.isNull()&&!(s>this._maxx||s<this._minx||u>this._maxy||u<this._miny)}},At.prototype.getMinY=function(){return this._miny},At.prototype.getMinX=function(){return this._minx},At.prototype.expandToInclude=function(){if(arguments.length===1){if(arguments[0]instanceof I){var n=arguments[0];this.expandToInclude(n.x,n.y)}else if(arguments[0]instanceof At){var i=arguments[0];if(i.isNull())return null;this.isNull()?(this._minx=i.getMinX(),this._maxx=i.getMaxX(),this._miny=i.getMinY(),this._maxy=i.getMaxY()):(i._minx<this._minx&&(this._minx=i._minx),i._maxx>this._maxx&&(this._maxx=i._maxx),i._miny<this._miny&&(this._miny=i._miny),i._maxy>this._maxy&&(this._maxy=i._maxy))}}else if(arguments.length===2){var s=arguments[0],u=arguments[1];this.isNull()?(this._minx=s,this._maxx=s,this._miny=u,this._maxy=u):(s<this._minx&&(this._minx=s),s>this._maxx&&(this._maxx=s),u<this._miny&&(this._miny=u),u>this._maxy&&(this._maxy=u))}},At.prototype.minExtent=function(){if(this.isNull())return 0;var n=this.getWidth(),i=this.getHeight();return n<i?n:i},At.prototype.getWidth=function(){return this.isNull()?0:this._maxx-this._minx},At.prototype.compareTo=function(n){var i=n;return this.isNull()?i.isNull()?0:-1:i.isNull()?1:this._minx<i._minx?-1:this._minx>i._minx?1:this._miny<i._miny?-1:this._miny>i._miny?1:this._maxx<i._maxx?-1:this._maxx>i._maxx?1:this._maxy<i._maxy?-1:this._maxy>i._maxy?1:0},At.prototype.translate=function(n,i){if(this.isNull())return null;this.init(this.getMinX()+n,this.getMaxX()+n,this.getMinY()+i,this.getMaxY()+i)},At.prototype.toString=function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"},At.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1},At.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny},At.prototype.maxExtent=function(){if(this.isNull())return 0;var n=this.getWidth(),i=this.getHeight();return n>i?n:i},At.prototype.expandBy=function(){if(arguments.length===1){var n=arguments[0];this.expandBy(n,n)}else if(arguments.length===2){var i=arguments[0],s=arguments[1];if(this.isNull())return null;this._minx-=i,this._maxx+=i,this._miny-=s,this._maxy+=s,(this._minx>this._maxx||this._miny>this._maxy)&&this.setToNull()}},At.prototype.contains=function(){if(arguments.length===1){if(arguments[0]instanceof At){var n=arguments[0];return this.covers(n)}if(arguments[0]instanceof I){var i=arguments[0];return this.covers(i)}}else if(arguments.length===2){var s=arguments[0],u=arguments[1];return this.covers(s,u)}},At.prototype.centre=function(){return this.isNull()?null:new I((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)},At.prototype.init=function(){if(arguments.length===0)this.setToNull();else if(arguments.length===1){if(arguments[0]instanceof I){var n=arguments[0];this.init(n.x,n.x,n.y,n.y)}else if(arguments[0]instanceof At){var i=arguments[0];this._minx=i._minx,this._maxx=i._maxx,this._miny=i._miny,this._maxy=i._maxy}}else if(arguments.length===2){var s=arguments[0],u=arguments[1];this.init(s.x,u.x,s.y,u.y)}else if(arguments.length===4){var c=arguments[0],m=arguments[1],E=arguments[2],C=arguments[3];c<m?(this._minx=c,this._maxx=m):(this._minx=m,this._maxx=c),E<C?(this._miny=E,this._maxy=C):(this._miny=C,this._maxy=E)}},At.prototype.getMaxY=function(){return this._maxy},At.prototype.distance=function(n){if(this.intersects(n))return 0;var i=0;this._maxx<n._minx?i=n._minx-this._maxx:this._minx>n._maxx&&(i=this._minx-n._maxx);var s=0;return this._maxy<n._miny?s=n._miny-this._maxy:this._miny>n._maxy&&(s=this._miny-n._maxy),i===0?s:s===0?i:Math.sqrt(i*i+s*s)},At.prototype.hashCode=function(){var n=17;return n=37*n+I.hashCode(this._minx),n=37*n+I.hashCode(this._maxx),n=37*n+I.hashCode(this._miny),n=37*n+I.hashCode(this._maxy)},At.prototype.interfaces_=function(){return[G,t]},At.prototype.getClass=function(){return At},At.intersects=function(){if(arguments.length===3){var n=arguments[0],i=arguments[1],s=arguments[2];return s.x>=(n.x<i.x?n.x:i.x)&&s.x<=(n.x>i.x?n.x:i.x)&&s.y>=(n.y<i.y?n.y:i.y)&&s.y<=(n.y>i.y?n.y:i.y)}if(arguments.length===4){var u=arguments[0],c=arguments[1],m=arguments[2],E=arguments[3],C=Math.min(m.x,E.x),U=Math.max(m.x,E.x),Z=Math.min(u.x,c.x),pt=Math.max(u.x,c.x);return!(Z>U)&&!(pt<C)&&(C=Math.min(m.y,E.y),U=Math.max(m.y,E.y),Z=Math.min(u.y,c.y),pt=Math.max(u.y,c.y),!(Z>U)&&!(pt<C))}},te.serialVersionUID.get=function(){return 5873921885273102e3},Object.defineProperties(At,te);var rt={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*$/},an=function(n){this.geometryFactory=n||new pe};an.prototype.read=function(n){var i,s,u;n=n.replace(/[\n\r]/g," ");var c=rt.typeStr.exec(n);if(n.search("EMPTY")!==-1&&((c=rt.emptyTypeStr.exec(n))[2]=void 0),c&&(s=c[1].toLowerCase(),u=c[2],ne[s]&&(i=ne[s].apply(this,[u]))),i===void 0)throw new Error("Could not parse WKT "+n);return i},an.prototype.write=function(n){return this.extractGeometry(n)},an.prototype.extractGeometry=function(n){var i=n.getGeometryType().toLowerCase();if(!zt[i])return null;var s=i.toUpperCase();return n.isEmpty()?s+" EMPTY":s+"("+zt[i].apply(this,[n])+")"};var zt={coordinate:function(n){return n.x+" "+n.y},point:function(n){return zt.coordinate.call(this,n._coordinates._coordinates[0])},multipoint:function(n){for(var i=[],s=0,u=n._geometries.length;s<u;++s)i.push("("+zt.point.apply(this,[n._geometries[s]])+")");return i.join(",")},linestring:function(n){for(var i=[],s=0,u=n._points._coordinates.length;s<u;++s)i.push(zt.coordinate.apply(this,[n._points._coordinates[s]]));return i.join(",")},linearring:function(n){for(var i=[],s=0,u=n._points._coordinates.length;s<u;++s)i.push(zt.coordinate.apply(this,[n._points._coordinates[s]]));return i.join(",")},multilinestring:function(n){for(var i=[],s=0,u=n._geometries.length;s<u;++s)i.push("("+zt.linestring.apply(this,[n._geometries[s]])+")");return i.join(",")},polygon:function(n){var i=[];i.push("("+zt.linestring.apply(this,[n._shell])+")");for(var s=0,u=n._holes.length;s<u;++s)i.push("("+zt.linestring.apply(this,[n._holes[s]])+")");return i.join(",")},multipolygon:function(n){for(var i=[],s=0,u=n._geometries.length;s<u;++s)i.push("("+zt.polygon.apply(this,[n._geometries[s]])+")");return i.join(",")},geometrycollection:function(n){for(var i=[],s=0,u=n._geometries.length;s<u;++s)i.push(this.extractGeometry(n._geometries[s]));return i.join(",")}},ne={point:function(n){if(n===void 0)return this.geometryFactory.createPoint();var i=n.trim().split(rt.spaces);return this.geometryFactory.createPoint(new I(Number.parseFloat(i[0]),Number.parseFloat(i[1])))},multipoint:function(n){if(n===void 0)return this.geometryFactory.createMultiPoint();for(var i,s=n.trim().split(","),u=[],c=0,m=s.length;c<m;++c)i=s[c].replace(rt.trimParens,"$1"),u.push(ne.point.apply(this,[i]));return this.geometryFactory.createMultiPoint(u)},linestring:function(n){if(n===void 0)return this.geometryFactory.createLineString();for(var i,s=n.trim().split(","),u=[],c=0,m=s.length;c<m;++c)i=s[c].trim().split(rt.spaces),u.push(new I(Number.parseFloat(i[0]),Number.parseFloat(i[1])));return this.geometryFactory.createLineString(u)},linearring:function(n){if(n===void 0)return this.geometryFactory.createLinearRing();for(var i,s=n.trim().split(","),u=[],c=0,m=s.length;c<m;++c)i=s[c].trim().split(rt.spaces),u.push(new I(Number.parseFloat(i[0]),Number.parseFloat(i[1])));return this.geometryFactory.createLinearRing(u)},multilinestring:function(n){if(n===void 0)return this.geometryFactory.createMultiLineString();for(var i,s=n.trim().split(rt.parenComma),u=[],c=0,m=s.length;c<m;++c)i=s[c].replace(rt.trimParens,"$1"),u.push(ne.linestring.apply(this,[i]));return this.geometryFactory.createMultiLineString(u)},polygon:function(n){if(n===void 0)return this.geometryFactory.createPolygon();for(var i,s,u,c,m=n.trim().split(rt.parenComma),E=[],C=0,U=m.length;C<U;++C)i=m[C].replace(rt.trimParens,"$1"),s=ne.linestring.apply(this,[i]),u=this.geometryFactory.createLinearRing(s._points),C===0?c=u:E.push(u);return this.geometryFactory.createPolygon(c,E)},multipolygon:function(n){if(n===void 0)return this.geometryFactory.createMultiPolygon();for(var i,s=n.trim().split(rt.doubleParenComma),u=[],c=0,m=s.length;c<m;++c)i=s[c].replace(rt.trimParens,"$1"),u.push(ne.polygon.apply(this,[i]));return this.geometryFactory.createMultiPolygon(u)},geometrycollection:function(n){if(n===void 0)return this.geometryFactory.createGeometryCollection();for(var i=(n=n.replace(/,\s*([A-Za-z])/g,"|$1")).trim().split("|"),s=[],u=0,c=i.length;u<c;++u)s.push(this.read(i[u]));return this.geometryFactory.createGeometryCollection(s)}},Wt=function(n){this.parser=new an(n)};Wt.prototype.write=function(n){return this.parser.write(n)},Wt.toLineString=function(n,i){if(arguments.length!==2)throw new Error("Not implemented");return"LINESTRING ( "+n.x+" "+n.y+", "+i.x+" "+i.y+" )"};var ie=function(n){function i(s){n.call(this,s),this.name="RuntimeException",this.message=s,this.stack=new n().stack}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i}(Error),ce=function(n){function i(){if(n.call(this),arguments.length===0)n.call(this);else if(arguments.length===1){var s=arguments[0];n.call(this,s)}}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(ie),Lt=function(){};Lt.prototype.interfaces_=function(){return[]},Lt.prototype.getClass=function(){return Lt},Lt.shouldNeverReachHere=function(){if(arguments.length===0)Lt.shouldNeverReachHere(null);else if(arguments.length===1){var n=arguments[0];throw new ce("Should never reach here"+(n!==null?": "+n:""))}},Lt.isTrue=function(){var n,i;if(arguments.length===1)n=arguments[0],Lt.isTrue(n,null);else if(arguments.length===2&&(n=arguments[0],i=arguments[1],!n))throw i===null?new ce:new ce(i)},Lt.equals=function(){var n,i,s;if(arguments.length===2)n=arguments[0],i=arguments[1],Lt.equals(n,i,null);else if(arguments.length===3&&(n=arguments[0],i=arguments[1],s=arguments[2],!i.equals(n)))throw new ce("Expected "+n+" but encountered "+i+(s!==null?": "+s:""))};var se=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 I,this._intPt[1]=new I,this._pa=this._intPt[0],this._pb=this._intPt[1],this._result=0},Y={DONT_INTERSECT:{configurable:!0},DO_INTERSECT:{configurable:!0},COLLINEAR:{configurable:!0},NO_INTERSECTION:{configurable:!0},POINT_INTERSECTION:{configurable:!0},COLLINEAR_INTERSECTION:{configurable:!0}};se.prototype.getIndexAlongSegment=function(n,i){return this.computeIntLineIndex(),this._intLineIndex[n][i]},se.prototype.getTopologySummary=function(){var n=new _t;return this.isEndPoint()&&n.append(" endpoint"),this._isProper&&n.append(" proper"),this.isCollinear()&&n.append(" collinear"),n.toString()},se.prototype.computeIntersection=function(n,i,s,u){this._inputLines[0][0]=n,this._inputLines[0][1]=i,this._inputLines[1][0]=s,this._inputLines[1][1]=u,this._result=this.computeIntersect(n,i,s,u)},se.prototype.getIntersectionNum=function(){return this._result},se.prototype.computeIntLineIndex=function(){if(arguments.length===0)this._intLineIndex===null&&(this._intLineIndex=Array(2).fill().map(function(){return Array(2)}),this.computeIntLineIndex(0),this.computeIntLineIndex(1));else if(arguments.length===1){var n=arguments[0];this.getEdgeDistance(n,0)>this.getEdgeDistance(n,1)?(this._intLineIndex[n][0]=0,this._intLineIndex[n][1]=1):(this._intLineIndex[n][0]=1,this._intLineIndex[n][1]=0)}},se.prototype.isProper=function(){return this.hasIntersection()&&this._isProper},se.prototype.setPrecisionModel=function(n){this._precisionModel=n},se.prototype.isInteriorIntersection=function(){if(arguments.length===0)return!!this.isInteriorIntersection(0)||!!this.isInteriorIntersection(1);if(arguments.length===1){for(var n=arguments[0],i=0;i<this._result;i++)if(!this._intPt[i].equals2D(this._inputLines[n][0])&&!this._intPt[i].equals2D(this._inputLines[n][1]))return!0;return!1}},se.prototype.getIntersection=function(n){return this._intPt[n]},se.prototype.isEndPoint=function(){return this.hasIntersection()&&!this._isProper},se.prototype.hasIntersection=function(){return this._result!==se.NO_INTERSECTION},se.prototype.getEdgeDistance=function(n,i){return se.computeEdgeDistance(this._intPt[i],this._inputLines[n][0],this._inputLines[n][1])},se.prototype.isCollinear=function(){return this._result===se.COLLINEAR_INTERSECTION},se.prototype.toString=function(){return Wt.toLineString(this._inputLines[0][0],this._inputLines[0][1])+" - "+Wt.toLineString(this._inputLines[1][0],this._inputLines[1][1])+this.getTopologySummary()},se.prototype.getEndpoint=function(n,i){return this._inputLines[n][i]},se.prototype.isIntersection=function(n){for(var i=0;i<this._result;i++)if(this._intPt[i].equals2D(n))return!0;return!1},se.prototype.getIntersectionAlongSegment=function(n,i){return this.computeIntLineIndex(),this._intPt[this._intLineIndex[n][i]]},se.prototype.interfaces_=function(){return[]},se.prototype.getClass=function(){return se},se.computeEdgeDistance=function(n,i,s){var u=Math.abs(s.x-i.x),c=Math.abs(s.y-i.y),m=-1;if(n.equals(i))m=0;else if(n.equals(s))m=u>c?u:c;else{var E=Math.abs(n.x-i.x),C=Math.abs(n.y-i.y);(m=u>c?E:C)!==0||n.equals(i)||(m=Math.max(E,C))}return Lt.isTrue(!(m===0&&!n.equals(i)),"Bad distance calculation"),m},se.nonRobustComputeEdgeDistance=function(n,i,s){var u=n.x-i.x,c=n.y-i.y,m=Math.sqrt(u*u+c*c);return Lt.isTrue(!(m===0&&!n.equals(i)),"Invalid distance calculation"),m},Y.DONT_INTERSECT.get=function(){return 0},Y.DO_INTERSECT.get=function(){return 1},Y.COLLINEAR.get=function(){return 2},Y.NO_INTERSECTION.get=function(){return 0},Y.POINT_INTERSECTION.get=function(){return 1},Y.COLLINEAR_INTERSECTION.get=function(){return 2},Object.defineProperties(se,Y);var N=function(n){function i(){n.apply(this,arguments)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.isInSegmentEnvelopes=function(s){var u=new At(this._inputLines[0][0],this._inputLines[0][1]),c=new At(this._inputLines[1][0],this._inputLines[1][1]);return u.contains(s)&&c.contains(s)},i.prototype.computeIntersection=function(){if(arguments.length!==3)return n.prototype.computeIntersection.apply(this,arguments);var s=arguments[0],u=arguments[1],c=arguments[2];if(this._isProper=!1,At.intersects(u,c,s)&&ot.orientationIndex(u,c,s)===0&&ot.orientationIndex(c,u,s)===0)return this._isProper=!0,(s.equals(u)||s.equals(c))&&(this._isProper=!1),this._result=n.POINT_INTERSECTION,null;this._result=n.NO_INTERSECTION},i.prototype.normalizeToMinimum=function(s,u,c,m,E){E.x=this.smallestInAbsValue(s.x,u.x,c.x,m.x),E.y=this.smallestInAbsValue(s.y,u.y,c.y,m.y),s.x-=E.x,s.y-=E.y,u.x-=E.x,u.y-=E.y,c.x-=E.x,c.y-=E.y,m.x-=E.x,m.y-=E.y},i.prototype.safeHCoordinateIntersection=function(s,u,c,m){var E=null;try{E=Dt.intersection(s,u,c,m)}catch(C){if(!(C instanceof $t))throw C;E=i.nearestEndpoint(s,u,c,m)}return E},i.prototype.intersection=function(s,u,c,m){var E=this.intersectionWithNormalization(s,u,c,m);return this.isInSegmentEnvelopes(E)||(E=new I(i.nearestEndpoint(s,u,c,m))),this._precisionModel!==null&&this._precisionModel.makePrecise(E),E},i.prototype.smallestInAbsValue=function(s,u,c,m){var E=s,C=Math.abs(E);return Math.abs(u)<C&&(E=u,C=Math.abs(u)),Math.abs(c)<C&&(E=c,C=Math.abs(c)),Math.abs(m)<C&&(E=m),E},i.prototype.checkDD=function(s,u,c,m,E){var C=Tt.intersection(s,u,c,m),U=this.isInSegmentEnvelopes(C);Ut.out.println("DD in env = "+U+" --------------------- "+C),E.distance(C)>1e-4&&Ut.out.println("Distance = "+E.distance(C))},i.prototype.intersectionWithNormalization=function(s,u,c,m){var E=new I(s),C=new I(u),U=new I(c),Z=new I(m),pt=new I;this.normalizeToEnvCentre(E,C,U,Z,pt);var gt=this.safeHCoordinateIntersection(E,C,U,Z);return gt.x+=pt.x,gt.y+=pt.y,gt},i.prototype.computeCollinearIntersection=function(s,u,c,m){var E=At.intersects(s,u,c),C=At.intersects(s,u,m),U=At.intersects(c,m,s),Z=At.intersects(c,m,u);return E&&C?(this._intPt[0]=c,this._intPt[1]=m,n.COLLINEAR_INTERSECTION):U&&Z?(this._intPt[0]=s,this._intPt[1]=u,n.COLLINEAR_INTERSECTION):E&&U?(this._intPt[0]=c,this._intPt[1]=s,!c.equals(s)||C||Z?n.COLLINEAR_INTERSECTION:n.POINT_INTERSECTION):E&&Z?(this._intPt[0]=c,this._intPt[1]=u,!c.equals(u)||C||U?n.COLLINEAR_INTERSECTION:n.POINT_INTERSECTION):C&&U?(this._intPt[0]=m,this._intPt[1]=s,!m.equals(s)||E||Z?n.COLLINEAR_INTERSECTION:n.POINT_INTERSECTION):C&&Z?(this._intPt[0]=m,this._intPt[1]=u,!m.equals(u)||E||U?n.COLLINEAR_INTERSECTION:n.POINT_INTERSECTION):n.NO_INTERSECTION},i.prototype.normalizeToEnvCentre=function(s,u,c,m,E){var C=s.x<u.x?s.x:u.x,U=s.y<u.y?s.y:u.y,Z=s.x>u.x?s.x:u.x,pt=s.y>u.y?s.y:u.y,gt=c.x<m.x?c.x:m.x,Rt=c.y<m.y?c.y:m.y,Ft=c.x>m.x?c.x:m.x,Vt=c.y>m.y?c.y:m.y,ee=((C>gt?C:gt)+(Z<Ft?Z:Ft))/2,hn=((U>Rt?U:Rt)+(pt<Vt?pt:Vt))/2;E.x=ee,E.y=hn,s.x-=E.x,s.y-=E.y,u.x-=E.x,u.y-=E.y,c.x-=E.x,c.y-=E.y,m.x-=E.x,m.y-=E.y},i.prototype.computeIntersect=function(s,u,c,m){if(this._isProper=!1,!At.intersects(s,u,c,m))return n.NO_INTERSECTION;var E=ot.orientationIndex(s,u,c),C=ot.orientationIndex(s,u,m);if(E>0&&C>0||E<0&&C<0)return n.NO_INTERSECTION;var U=ot.orientationIndex(c,m,s),Z=ot.orientationIndex(c,m,u);return U>0&&Z>0||U<0&&Z<0?n.NO_INTERSECTION:E===0&&C===0&&U===0&&Z===0?this.computeCollinearIntersection(s,u,c,m):(E===0||C===0||U===0||Z===0?(this._isProper=!1,s.equals2D(c)||s.equals2D(m)?this._intPt[0]=s:u.equals2D(c)||u.equals2D(m)?this._intPt[0]=u:E===0?this._intPt[0]=new I(c):C===0?this._intPt[0]=new I(m):U===0?this._intPt[0]=new I(s):Z===0&&(this._intPt[0]=new I(u))):(this._isProper=!0,this._intPt[0]=this.intersection(s,u,c,m)),n.POINT_INTERSECTION)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i.nearestEndpoint=function(s,u,c,m){var E=s,C=ot.distancePointLine(s,c,m),U=ot.distancePointLine(u,c,m);return U<C&&(C=U,E=u),(U=ot.distancePointLine(c,s,u))<C&&(C=U,E=c),(U=ot.distancePointLine(m,s,u))<C&&(C=U,E=m),E},i}(se),xt=function(){};xt.prototype.interfaces_=function(){return[]},xt.prototype.getClass=function(){return xt},xt.orientationIndex=function(n,i,s){var u=i.x-n.x,c=i.y-n.y,m=s.x-i.x,E=s.y-i.y;return xt.signOfDet2x2(u,c,m,E)},xt.signOfDet2x2=function(n,i,s,u){var c=null,m=null,E=null;if(c=1,n===0||u===0)return i===0||s===0?0:i>0?s>0?-c:c:s>0?c:-c;if(i===0||s===0)return u>0?n>0?c:-c:n>0?-c:c;if(i>0?u>0?i<=u||(c=-c,m=n,n=s,s=m,m=i,i=u,u=m):i<=-u?(c=-c,s=-s,u=-u):(m=n,n=-s,s=m,m=i,i=-u,u=m):u>0?-i<=u?(c=-c,n=-n,i=-i):(m=-n,n=s,s=m,m=-i,i=u,u=m):i>=u?(n=-n,i=-i,s=-s,u=-u):(c=-c,m=-n,n=-s,s=m,m=-i,i=-u,u=m),n>0){if(!(s>0)||!(n<=s))return c}else{if(s>0||!(n>=s))return-c;c=-c,n=-n,s=-s}for(;;){if(E=Math.floor(s/n),s-=E*n,(u-=E*i)<0)return-c;if(u>i)return c;if(n>s+s){if(i<u+u)return c}else{if(i>u+u)return-c;s=n-s,u=i-u,c=-c}if(u===0)return s===0?0:-c;if(s===0||(E=Math.floor(n/s),n-=E*s,(i-=E*u)<0))return c;if(i>u)return-c;if(s>n+n){if(u<i+i)return-c}else{if(u>i+i)return c;n=s-n,i=u-i,c=-c}if(i===0)return n===0?0:c;if(n===0)return-c}};var Et=function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var n=arguments[0];this._p=n};Et.prototype.countSegment=function(n,i){if(n.x<this._p.x&&i.x<this._p.x)return null;if(this._p.x===i.x&&this._p.y===i.y)return this._isPointOnSegment=!0,null;if(n.y===this._p.y&&i.y===this._p.y){var s=n.x,u=i.x;return s>u&&(s=i.x,u=n.x),this._p.x>=s&&this._p.x<=u&&(this._isPointOnSegment=!0),null}if(n.y>this._p.y&&i.y<=this._p.y||i.y>this._p.y&&n.y<=this._p.y){var c=n.x-this._p.x,m=n.y-this._p.y,E=i.x-this._p.x,C=i.y-this._p.y,U=xt.signOfDet2x2(c,m,E,C);if(U===0)return this._isPointOnSegment=!0,null;C<m&&(U=-U),U>0&&this._crossingCount++}},Et.prototype.isPointInPolygon=function(){return this.getLocation()!==V.EXTERIOR},Et.prototype.getLocation=function(){return this._isPointOnSegment?V.BOUNDARY:this._crossingCount%2==1?V.INTERIOR:V.EXTERIOR},Et.prototype.isOnSegment=function(){return this._isPointOnSegment},Et.prototype.interfaces_=function(){return[]},Et.prototype.getClass=function(){return Et},Et.locatePointInRing=function(){if(arguments[0]instanceof I&&X(arguments[1],tt)){for(var n=arguments[0],i=arguments[1],s=new Et(n),u=new I,c=new I,m=1;m<i.size();m++)if(i.getCoordinate(m,u),i.getCoordinate(m-1,c),s.countSegment(u,c),s.isOnSegment())return s.getLocation();return s.getLocation()}if(arguments[0]instanceof I&&arguments[1]instanceof Array){for(var E=arguments[0],C=arguments[1],U=new Et(E),Z=1;Z<C.length;Z++){var pt=C[Z],gt=C[Z-1];if(U.countSegment(pt,gt),U.isOnSegment())return U.getLocation()}return U.getLocation()}};var ot=function(){},Pt={CLOCKWISE:{configurable:!0},RIGHT:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},LEFT:{configurable:!0},COLLINEAR:{configurable:!0},STRAIGHT:{configurable:!0}};ot.prototype.interfaces_=function(){return[]},ot.prototype.getClass=function(){return ot},ot.orientationIndex=function(n,i,s){return Tt.orientationIndex(n,i,s)},ot.signedArea=function(){if(arguments[0]instanceof Array){var n=arguments[0];if(n.length<3)return 0;for(var i=0,s=n[0].x,u=1;u<n.length-1;u++){var c=n[u].x-s,m=n[u+1].y;i+=c*(n[u-1].y-m)}return i/2}if(X(arguments[0],tt)){var E=arguments[0],C=E.size();if(C<3)return 0;var U=new I,Z=new I,pt=new I;E.getCoordinate(0,Z),E.getCoordinate(1,pt);var gt=Z.x;pt.x-=gt;for(var Rt=0,Ft=1;Ft<C-1;Ft++)U.y=Z.y,Z.x=pt.x,Z.y=pt.y,E.getCoordinate(Ft+1,pt),pt.x-=gt,Rt+=Z.x*(U.y-pt.y);return Rt/2}},ot.distanceLineLine=function(n,i,s,u){if(n.equals(i))return ot.distancePointLine(n,s,u);if(s.equals(u))return ot.distancePointLine(u,n,i);var c=!1;if(At.intersects(n,i,s,u)){var m=(i.x-n.x)*(u.y-s.y)-(i.y-n.y)*(u.x-s.x);if(m===0)c=!0;else{var E=(n.y-s.y)*(u.x-s.x)-(n.x-s.x)*(u.y-s.y),C=((n.y-s.y)*(i.x-n.x)-(n.x-s.x)*(i.y-n.y))/m,U=E/m;(U<0||U>1||C<0||C>1)&&(c=!0)}}else c=!0;return c?mt.min(ot.distancePointLine(n,s,u),ot.distancePointLine(i,s,u),ot.distancePointLine(s,n,i),ot.distancePointLine(u,n,i)):0},ot.isPointInRing=function(n,i){return ot.locatePointInRing(n,i)!==V.EXTERIOR},ot.computeLength=function(n){var i=n.size();if(i<=1)return 0;var s=0,u=new I;n.getCoordinate(0,u);for(var c=u.x,m=u.y,E=1;E<i;E++){n.getCoordinate(E,u);var C=u.x,U=u.y,Z=C-c,pt=U-m;s+=Math.sqrt(Z*Z+pt*pt),c=C,m=U}return s},ot.isCCW=function(n){var i=n.length-1;if(i<3)throw new A("Ring has fewer than 4 points, so orientation cannot be determined");for(var s=n[0],u=0,c=1;c<=i;c++){var m=n[c];m.y>s.y&&(s=m,u=c)}var E=u;do(E-=1)<0&&(E=i);while(n[E].equals2D(s)&&E!==u);var C=u;do C=(C+1)%i;while(n[C].equals2D(s)&&C!==u);var U=n[E],Z=n[C];if(U.equals2D(s)||Z.equals2D(s)||U.equals2D(Z))return!1;var pt=ot.computeOrientation(U,s,Z),gt=!1;return gt=pt===0?U.x>Z.x:pt>0,gt},ot.locatePointInRing=function(n,i){return Et.locatePointInRing(n,i)},ot.distancePointLinePerpendicular=function(n,i,s){var u=(s.x-i.x)*(s.x-i.x)+(s.y-i.y)*(s.y-i.y),c=((i.y-n.y)*(s.x-i.x)-(i.x-n.x)*(s.y-i.y))/u;return Math.abs(c)*Math.sqrt(u)},ot.computeOrientation=function(n,i,s){return ot.orientationIndex(n,i,s)},ot.distancePointLine=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];if(i.length===0)throw new A("Line array must contain at least one vertex");for(var s=n.distance(i[0]),u=0;u<i.length-1;u++){var c=ot.distancePointLine(n,i[u],i[u+1]);c<s&&(s=c)}return s}if(arguments.length===3){var m=arguments[0],E=arguments[1],C=arguments[2];if(E.x===C.x&&E.y===C.y)return m.distance(E);var U=(C.x-E.x)*(C.x-E.x)+(C.y-E.y)*(C.y-E.y),Z=((m.x-E.x)*(C.x-E.x)+(m.y-E.y)*(C.y-E.y))/U;if(Z<=0)return m.distance(E);if(Z>=1)return m.distance(C);var pt=((E.y-m.y)*(C.x-E.x)-(E.x-m.x)*(C.y-E.y))/U;return Math.abs(pt)*Math.sqrt(U)}},ot.isOnLine=function(n,i){for(var s=new N,u=1;u<i.length;u++){var c=i[u-1],m=i[u];if(s.computeIntersection(n,c,m),s.hasIntersection())return!0}return!1},Pt.CLOCKWISE.get=function(){return-1},Pt.RIGHT.get=function(){return ot.CLOCKWISE},Pt.COUNTERCLOCKWISE.get=function(){return 1},Pt.LEFT.get=function(){return ot.COUNTERCLOCKWISE},Pt.COLLINEAR.get=function(){return 0},Pt.STRAIGHT.get=function(){return ot.COLLINEAR},Object.defineProperties(ot,Pt);var ue=function(){};ue.prototype.filter=function(n){},ue.prototype.interfaces_=function(){return[]},ue.prototype.getClass=function(){return ue};var Ct=function(){var n=arguments[0];this._envelope=null,this._factory=null,this._SRID=null,this._userData=null,this._factory=n,this._SRID=n.getSRID()},Ot={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}};Ct.prototype.isGeometryCollection=function(){return this.getSortIndex()===Ct.SORTINDEX_GEOMETRYCOLLECTION},Ct.prototype.getFactory=function(){return this._factory},Ct.prototype.getGeometryN=function(n){return this},Ct.prototype.getArea=function(){return 0},Ct.prototype.isRectangle=function(){return!1},Ct.prototype.equals=function(){if(arguments[0]instanceof Ct){var n=arguments[0];return n!==null&&this.equalsTopo(n)}if(arguments[0]instanceof Object){var i=arguments[0];if(!(i instanceof Ct))return!1;var s=i;return this.equalsExact(s)}},Ct.prototype.equalsExact=function(n){return this===n||this.equalsExact(n,0)},Ct.prototype.geometryChanged=function(){this.apply(Ct.geometryChangedFilter)},Ct.prototype.geometryChangedAction=function(){this._envelope=null},Ct.prototype.equalsNorm=function(n){return n!==null&&this.norm().equalsExact(n.norm())},Ct.prototype.getLength=function(){return 0},Ct.prototype.getNumGeometries=function(){return 1},Ct.prototype.compareTo=function(){if(arguments.length===1){var n=arguments[0],i=n;return this.getSortIndex()!==i.getSortIndex()?this.getSortIndex()-i.getSortIndex():this.isEmpty()&&i.isEmpty()?0:this.isEmpty()?-1:i.isEmpty()?1:this.compareToSameClass(n)}if(arguments.length===2){var s=arguments[0],u=arguments[1];return this.getSortIndex()!==s.getSortIndex()?this.getSortIndex()-s.getSortIndex():this.isEmpty()&&s.isEmpty()?0:this.isEmpty()?-1:s.isEmpty()?1:this.compareToSameClass(s,u)}},Ct.prototype.getUserData=function(){return this._userData},Ct.prototype.getSRID=function(){return this._SRID},Ct.prototype.getEnvelope=function(){return this.getFactory().toGeometry(this.getEnvelopeInternal())},Ct.prototype.checkNotGeometryCollection=function(n){if(n.getSortIndex()===Ct.SORTINDEX_GEOMETRYCOLLECTION)throw new A("This method does not support GeometryCollection arguments")},Ct.prototype.equal=function(n,i,s){return s===0?n.equals(i):n.distance(i)<=s},Ct.prototype.norm=function(){var n=this.copy();return n.normalize(),n},Ct.prototype.getPrecisionModel=function(){return this._factory.getPrecisionModel()},Ct.prototype.getEnvelopeInternal=function(){return this._envelope===null&&(this._envelope=this.computeEnvelopeInternal()),new At(this._envelope)},Ct.prototype.setSRID=function(n){this._SRID=n},Ct.prototype.setUserData=function(n){this._userData=n},Ct.prototype.compare=function(n,i){for(var s=n.iterator(),u=i.iterator();s.hasNext()&&u.hasNext();){var c=s.next(),m=u.next(),E=c.compareTo(m);if(E!==0)return E}return s.hasNext()?1:u.hasNext()?-1:0},Ct.prototype.hashCode=function(){return this.getEnvelopeInternal().hashCode()},Ct.prototype.isGeometryCollectionOrDerived=function(){return this.getSortIndex()===Ct.SORTINDEX_GEOMETRYCOLLECTION||this.getSortIndex()===Ct.SORTINDEX_MULTIPOINT||this.getSortIndex()===Ct.SORTINDEX_MULTILINESTRING||this.getSortIndex()===Ct.SORTINDEX_MULTIPOLYGON},Ct.prototype.interfaces_=function(){return[z,G,t]},Ct.prototype.getClass=function(){return Ct},Ct.hasNonEmptyElements=function(n){for(var i=0;i<n.length;i++)if(!n[i].isEmpty())return!0;return!1},Ct.hasNullElements=function(n){for(var i=0;i<n.length;i++)if(n[i]===null)return!0;return!1},Ot.serialVersionUID.get=function(){return 8763622679187377e3},Ot.SORTINDEX_POINT.get=function(){return 0},Ot.SORTINDEX_MULTIPOINT.get=function(){return 1},Ot.SORTINDEX_LINESTRING.get=function(){return 2},Ot.SORTINDEX_LINEARRING.get=function(){return 3},Ot.SORTINDEX_MULTILINESTRING.get=function(){return 4},Ot.SORTINDEX_POLYGON.get=function(){return 5},Ot.SORTINDEX_MULTIPOLYGON.get=function(){return 6},Ot.SORTINDEX_GEOMETRYCOLLECTION.get=function(){return 7},Ot.geometryChangedFilter.get=function(){return kt},Object.defineProperties(Ct,Ot);var kt=function(){};kt.interfaces_=function(){return[ue]},kt.filter=function(n){n.geometryChangedAction()};var J=function(){};J.prototype.filter=function(n){},J.prototype.interfaces_=function(){return[]},J.prototype.getClass=function(){return J};var w=function(){},P={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}};w.prototype.isInBoundary=function(n){},w.prototype.interfaces_=function(){return[]},w.prototype.getClass=function(){return w},P.Mod2BoundaryNodeRule.get=function(){return D},P.EndPointBoundaryNodeRule.get=function(){return k},P.MultiValentEndPointBoundaryNodeRule.get=function(){return B},P.MonoValentEndPointBoundaryNodeRule.get=function(){return et},P.MOD2_BOUNDARY_RULE.get=function(){return new D},P.ENDPOINT_BOUNDARY_RULE.get=function(){return new k},P.MULTIVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new B},P.MONOVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new et},P.OGC_SFS_BOUNDARY_RULE.get=function(){return w.MOD2_BOUNDARY_RULE},Object.defineProperties(w,P);var D=function(){};D.prototype.isInBoundary=function(n){return n%2==1},D.prototype.interfaces_=function(){return[w]},D.prototype.getClass=function(){return D};var k=function(){};k.prototype.isInBoundary=function(n){return n>0},k.prototype.interfaces_=function(){return[w]},k.prototype.getClass=function(){return k};var B=function(){};B.prototype.isInBoundary=function(n){return n>1},B.prototype.interfaces_=function(){return[w]},B.prototype.getClass=function(){return B};var et=function(){};et.prototype.isInBoundary=function(n){return n===1},et.prototype.interfaces_=function(){return[w]},et.prototype.getClass=function(){return et};var j=function(){};j.prototype.add=function(){},j.prototype.addAll=function(){},j.prototype.isEmpty=function(){},j.prototype.iterator=function(){},j.prototype.size=function(){},j.prototype.toArray=function(){},j.prototype.remove=function(){},(e.prototype=new Error).name="IndexOutOfBoundsException";var ft=function(){};ft.prototype.hasNext=function(){},ft.prototype.next=function(){},ft.prototype.remove=function(){};var ct=function(n){function i(){n.apply(this,arguments)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.get=function(){},i.prototype.set=function(){},i.prototype.isEmpty=function(){},i}(j);(o.prototype=new Error).name="NoSuchElementException";var O=function(n){function i(){n.call(this),this.array_=[],arguments[0]instanceof j&&this.addAll(arguments[0])}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.ensureCapacity=function(){},i.prototype.interfaces_=function(){return[n,j]},i.prototype.add=function(s){return arguments.length===1?this.array_.push(s):this.array_.splice(arguments[0],arguments[1]),!0},i.prototype.clear=function(){this.array_=[]},i.prototype.addAll=function(s){for(var u=s.iterator();u.hasNext();)this.add(u.next());return!0},i.prototype.set=function(s,u){var c=this.array_[s];return this.array_[s]=u,c},i.prototype.iterator=function(){return new K(this)},i.prototype.get=function(s){if(s<0||s>=this.size())throw new e;return this.array_[s]},i.prototype.isEmpty=function(){return this.array_.length===0},i.prototype.size=function(){return this.array_.length},i.prototype.toArray=function(){for(var s=[],u=0,c=this.array_.length;u<c;u++)s.push(this.array_[u]);return s},i.prototype.remove=function(s){for(var u=!1,c=0,m=this.array_.length;c<m;c++)if(this.array_[c]===s){this.array_.splice(c,1),u=!0;break}return u},i}(ct),K=function(n){function i(s){n.call(this),this.arrayList_=s,this.position_=0}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.next=function(){if(this.position_===this.arrayList_.size())throw new o;return this.arrayList_.get(this.position_++)},i.prototype.hasNext=function(){return this.position_<this.arrayList_.size()},i.prototype.set=function(s){return this.arrayList_.set(this.position_-1,s)},i.prototype.remove=function(){this.arrayList_.remove(this.arrayList_.get(this.position_))},i}(ft),$=function(n){function i(){if(n.call(this),arguments.length!==0){if(arguments.length===1){var u=arguments[0];this.ensureCapacity(u.length),this.add(u,!0)}else if(arguments.length===2){var c=arguments[0],m=arguments[1];this.ensureCapacity(c.length),this.add(c,m)}}}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={coordArrayType:{configurable:!0}};return s.coordArrayType.get=function(){return new Array(0).fill(null)},i.prototype.getCoordinate=function(u){return this.get(u)},i.prototype.addAll=function(){if(arguments.length===2){for(var u=arguments[0],c=arguments[1],m=!1,E=u.iterator();E.hasNext();)this.add(E.next(),c),m=!0;return m}return n.prototype.addAll.apply(this,arguments)},i.prototype.clone=function(){for(var u=n.prototype.clone.call(this),c=0;c<this.size();c++)u.add(c,this.get(c).copy());return u},i.prototype.toCoordinateArray=function(){return this.toArray(i.coordArrayType)},i.prototype.add=function(){if(arguments.length===1){var u=arguments[0];n.prototype.add.call(this,u)}else if(arguments.length===2){if(arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var c=arguments[0],m=arguments[1];return this.add(c,m,!0),!0}if(arguments[0]instanceof I&&typeof arguments[1]=="boolean"){var E=arguments[0];if(!arguments[1]&&this.size()>=1&&this.get(this.size()-1).equals2D(E))return null;n.prototype.add.call(this,E)}else if(arguments[0]instanceof Object&&typeof arguments[1]=="boolean"){var C=arguments[0],U=arguments[1];return this.add(C,U),!0}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var Z=arguments[0],pt=arguments[1];if(arguments[2])for(var gt=0;gt<Z.length;gt++)this.add(Z[gt],pt);else for(var Rt=Z.length-1;Rt>=0;Rt--)this.add(Z[Rt],pt);return!0}if(typeof arguments[2]=="boolean"&&Number.isInteger(arguments[0])&&arguments[1]instanceof I){var Ft=arguments[0],Vt=arguments[1];if(!arguments[2]){var ee=this.size();if(ee>0&&(Ft>0&&this.get(Ft-1).equals2D(Vt)||Ft<ee&&this.get(Ft).equals2D(Vt)))return null}n.prototype.add.call(this,Ft,Vt)}}else if(arguments.length===4){var hn=arguments[0],qn=arguments[1],Tr=arguments[2],no=arguments[3],$o=1;Tr>no&&($o=-1);for(var fp=Tr;fp!==no;fp+=$o)this.add(hn[fp],qn);return!0}},i.prototype.closeRing=function(){this.size()>0&&this.add(new I(this.get(0)),!1)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},Object.defineProperties(i,s),i}(O),Q=function(){},St={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};St.ForwardComparator.get=function(){return Nt},St.BidirectionalComparator.get=function(){return Jt},St.coordArrayType.get=function(){return new Array(0).fill(null)},Q.prototype.interfaces_=function(){return[]},Q.prototype.getClass=function(){return Q},Q.isRing=function(n){return!(n.length<4)&&!!n[0].equals2D(n[n.length-1])},Q.ptNotInList=function(n,i){for(var s=0;s<n.length;s++){var u=n[s];if(Q.indexOf(u,i)<0)return u}return null},Q.scroll=function(n,i){var s=Q.indexOf(i,n);if(s<0)return null;var u=new Array(n.length).fill(null);Ut.arraycopy(n,s,u,0,n.length-s),Ut.arraycopy(n,0,u,n.length-s,s),Ut.arraycopy(u,0,n,0,n.length)},Q.equals=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];if(n===i)return!0;if(n===null||i===null||n.length!==i.length)return!1;for(var s=0;s<n.length;s++)if(!n[s].equals(i[s]))return!1;return!0}if(arguments.length===3){var u=arguments[0],c=arguments[1],m=arguments[2];if(u===c)return!0;if(u===null||c===null||u.length!==c.length)return!1;for(var E=0;E<u.length;E++)if(m.compare(u[E],c[E])!==0)return!1;return!0}},Q.intersection=function(n,i){for(var s=new $,u=0;u<n.length;u++)i.intersects(n[u])&&s.add(n[u],!0);return s.toCoordinateArray()},Q.hasRepeatedPoints=function(n){for(var i=1;i<n.length;i++)if(n[i-1].equals(n[i]))return!0;return!1},Q.removeRepeatedPoints=function(n){return Q.hasRepeatedPoints(n)?new $(n,!1).toCoordinateArray():n},Q.reverse=function(n){for(var i=n.length-1,s=Math.trunc(i/2),u=0;u<=s;u++){var c=n[u];n[u]=n[i-u],n[i-u]=c}},Q.removeNull=function(n){for(var i=0,s=0;s<n.length;s++)n[s]!==null&&i++;var u=new Array(i).fill(null);if(i===0)return u;for(var c=0,m=0;m<n.length;m++)n[m]!==null&&(u[c++]=n[m]);return u},Q.copyDeep=function(){if(arguments.length===1){for(var n=arguments[0],i=new Array(n.length).fill(null),s=0;s<n.length;s++)i[s]=new I(n[s]);return i}if(arguments.length===5)for(var u=arguments[0],c=arguments[1],m=arguments[2],E=arguments[3],C=arguments[4],U=0;U<C;U++)m[E+U]=new I(u[c+U])},Q.isEqualReversed=function(n,i){for(var s=0;s<n.length;s++){var u=n[s],c=i[n.length-s-1];if(u.compareTo(c)!==0)return!1}return!0},Q.envelope=function(n){for(var i=new At,s=0;s<n.length;s++)i.expandToInclude(n[s]);return i},Q.toCoordinateArray=function(n){return n.toArray(Q.coordArrayType)},Q.atLeastNCoordinatesOrNothing=function(n,i){return i.length>=n?i:[]},Q.indexOf=function(n,i){for(var s=0;s<i.length;s++)if(n.equals(i[s]))return s;return-1},Q.increasingDirection=function(n){for(var i=0;i<Math.trunc(n.length/2);i++){var s=n.length-1-i,u=n[i].compareTo(n[s]);if(u!==0)return u}return 1},Q.compare=function(n,i){for(var s=0;s<n.length&&s<i.length;){var u=n[s].compareTo(i[s]);if(u!==0)return u;s++}return s<i.length?-1:s<n.length?1:0},Q.minCoordinate=function(n){for(var i=null,s=0;s<n.length;s++)(i===null||i.compareTo(n[s])>0)&&(i=n[s]);return i},Q.extract=function(n,i,s){i=mt.clamp(i,0,n.length);var u=(s=mt.clamp(s,-1,n.length))-i+1;s<0&&(u=0),i>=n.length&&(u=0),s<i&&(u=0);var c=new Array(u).fill(null);if(u===0)return c;for(var m=0,E=i;E<=s;E++)c[m++]=n[E];return c},Object.defineProperties(Q,St);var Nt=function(){};Nt.prototype.compare=function(n,i){return Q.compare(n,i)},Nt.prototype.interfaces_=function(){return[F]},Nt.prototype.getClass=function(){return Nt};var Jt=function(){};Jt.prototype.compare=function(n,i){var s=n,u=i;if(s.length<u.length)return-1;if(s.length>u.length)return 1;if(s.length===0)return 0;var c=Q.compare(s,u);return Q.isEqualReversed(s,u)?0:c},Jt.prototype.OLDcompare=function(n,i){var s=n,u=i;if(s.length<u.length)return-1;if(s.length>u.length)return 1;if(s.length===0)return 0;for(var c=Q.increasingDirection(s),m=Q.increasingDirection(u),E=c>0?0:s.length-1,C=m>0?0:s.length-1,U=0;U<s.length;U++){var Z=s[E].compareTo(u[C]);if(Z!==0)return Z;E+=c,C+=m}return 0},Jt.prototype.interfaces_=function(){return[F]},Jt.prototype.getClass=function(){return Jt};var Kt=function(){};Kt.prototype.get=function(){},Kt.prototype.put=function(){},Kt.prototype.size=function(){},Kt.prototype.values=function(){},Kt.prototype.entrySet=function(){};var Ee=function(n){function i(){n.apply(this,arguments)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i}(Kt);(a.prototype=new Error).name="OperationNotSupported",(l.prototype=new j).contains=function(){};var de=function(n){function i(){n.call(this),this.array_=[],arguments[0]instanceof j&&this.addAll(arguments[0])}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.contains=function(s){for(var u=0,c=this.array_.length;u<c;u++)if(this.array_[u]===s)return!0;return!1},i.prototype.add=function(s){return!this.contains(s)&&(this.array_.push(s),!0)},i.prototype.addAll=function(s){for(var u=s.iterator();u.hasNext();)this.add(u.next());return!0},i.prototype.remove=function(s){throw new Error},i.prototype.size=function(){return this.array_.length},i.prototype.isEmpty=function(){return this.array_.length===0},i.prototype.toArray=function(){for(var s=[],u=0,c=this.array_.length;u<c;u++)s.push(this.array_[u]);return s},i.prototype.iterator=function(){return new Se(this)},i}(l),Se=function(n){function i(s){n.call(this),this.hashSet_=s,this.position_=0}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.next=function(){if(this.position_===this.hashSet_.size())throw new o;return this.hashSet_.array_[this.position_++]},i.prototype.hasNext=function(){return this.position_<this.hashSet_.size()},i.prototype.remove=function(){throw new a},i}(ft),we=0;(x.prototype=new Ee).get=function(n){for(var i=this.root_;i!==null;){var s=n.compareTo(i.key);if(s<0)i=i.left;else{if(!(s>0))return i.value;i=i.right}}return null},x.prototype.put=function(n,i){if(this.root_===null)return this.root_={key:n,value:i,left:null,right:null,parent:null,color:we,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var s,u,c=this.root_;do if(s=c,(u=n.compareTo(c.key))<0)c=c.left;else{if(!(u>0)){var m=c.value;return c.value=i,m}c=c.right}while(c!==null);var E={key:n,left:null,right:null,value:i,parent:s,color:we,getValue:function(){return this.value},getKey:function(){return this.key}};return u<0?s.left=E:s.right=E,this.fixAfterInsertion(E),this.size_++,null},x.prototype.fixAfterInsertion=function(n){for(n.color=1;n!=null&&n!==this.root_&&n.parent.color===1;)if(f(n)===d(f(f(n)))){var i=g(f(f(n)));h(i)===1?(p(f(n),we),p(i,we),p(f(f(n)),1),n=f(f(n))):(n===g(f(n))&&(n=f(n),this.rotateLeft(n)),p(f(n),we),p(f(f(n)),1),this.rotateRight(f(f(n))))}else{var s=d(f(f(n)));h(s)===1?(p(f(n),we),p(s,we),p(f(f(n)),1),n=f(f(n))):(n===d(f(n))&&(n=f(n),this.rotateRight(n)),p(f(n),we),p(f(f(n)),1),this.rotateLeft(f(f(n))))}this.root_.color=we},x.prototype.values=function(){var n=new O,i=this.getFirstEntry();if(i!==null)for(n.add(i.value);(i=x.successor(i))!==null;)n.add(i.value);return n},x.prototype.entrySet=function(){var n=new de,i=this.getFirstEntry();if(i!==null)for(n.add(i);(i=x.successor(i))!==null;)n.add(i);return n},x.prototype.rotateLeft=function(n){if(n!=null){var i=n.right;n.right=i.left,i.left!=null&&(i.left.parent=n),i.parent=n.parent,n.parent===null?this.root_=i:n.parent.left===n?n.parent.left=i:n.parent.right=i,i.left=n,n.parent=i}},x.prototype.rotateRight=function(n){if(n!=null){var i=n.left;n.left=i.right,i.right!=null&&(i.right.parent=n),i.parent=n.parent,n.parent===null?this.root_=i:n.parent.right===n?n.parent.right=i:n.parent.left=i,i.right=n,n.parent=i}},x.prototype.getFirstEntry=function(){var n=this.root_;if(n!=null)for(;n.left!=null;)n=n.left;return n},x.successor=function(n){if(n===null)return null;if(n.right!==null){for(var i=n.right;i.left!==null;)i=i.left;return i}for(var s=n.parent,u=n;s!==null&&u===s.right;)u=s,s=s.parent;return s},x.prototype.size=function(){return this.size_};var On=function(){};On.prototype.interfaces_=function(){return[]},On.prototype.getClass=function(){return On},v.prototype=new l,(M.prototype=new v).contains=function(n){for(var i=0,s=this.array_.length;i<s;i++)if(this.array_[i].compareTo(n)===0)return!0;return!1},M.prototype.add=function(n){if(this.contains(n))return!1;for(var i=0,s=this.array_.length;i<s;i++)if(this.array_[i].compareTo(n)===1)return this.array_.splice(i,0,n),!0;return this.array_.push(n),!0},M.prototype.addAll=function(n){for(var i=n.iterator();i.hasNext();)this.add(i.next());return!0},M.prototype.remove=function(n){throw new a},M.prototype.size=function(){return this.array_.length},M.prototype.isEmpty=function(){return this.array_.length===0},M.prototype.toArray=function(){for(var n=[],i=0,s=this.array_.length;i<s;i++)n.push(this.array_[i]);return n},M.prototype.iterator=function(){return new sr(this)};var sr=function(n){this.treeSet_=n,this.position_=0};sr.prototype.next=function(){if(this.position_===this.treeSet_.size())throw new o;return this.treeSet_.array_[this.position_++]},sr.prototype.hasNext=function(){return this.position_<this.treeSet_.size()},sr.prototype.remove=function(){throw new a};var _n=function(){};_n.sort=function(){var n,i,s,u,c=arguments[0];if(arguments.length===1)u=function(E,C){return E.compareTo(C)},c.sort(u);else if(arguments.length===2)s=arguments[1],u=function(E,C){return s.compare(E,C)},c.sort(u);else if(arguments.length===3){(i=c.slice(arguments[1],arguments[2])).sort();var m=c.slice(0,arguments[1]).concat(i,c.slice(arguments[2],c.length));for(c.splice(0,c.length),n=0;n<m.length;n++)c.push(m[n])}else if(arguments.length===4)for(i=c.slice(arguments[1],arguments[2]),s=arguments[3],u=function(E,C){return s.compare(E,C)},i.sort(u),m=c.slice(0,arguments[1]).concat(i,c.slice(arguments[2],c.length)),c.splice(0,c.length),n=0;n<m.length;n++)c.push(m[n])},_n.asList=function(n){for(var i=new O,s=0,u=n.length;s<u;s++)i.add(n[s]);return i};var le=function(){},xn={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}};xn.P.get=function(){return 0},xn.L.get=function(){return 1},xn.A.get=function(){return 2},xn.FALSE.get=function(){return-1},xn.TRUE.get=function(){return-2},xn.DONTCARE.get=function(){return-3},xn.SYM_FALSE.get=function(){return"F"},xn.SYM_TRUE.get=function(){return"T"},xn.SYM_DONTCARE.get=function(){return"*"},xn.SYM_P.get=function(){return"0"},xn.SYM_L.get=function(){return"1"},xn.SYM_A.get=function(){return"2"},le.prototype.interfaces_=function(){return[]},le.prototype.getClass=function(){return le},le.toDimensionSymbol=function(n){switch(n){case le.FALSE:return le.SYM_FALSE;case le.TRUE:return le.SYM_TRUE;case le.DONTCARE:return le.SYM_DONTCARE;case le.P:return le.SYM_P;case le.L:return le.SYM_L;case le.A:return le.SYM_A}throw new A("Unknown dimension value: "+n)},le.toDimensionValue=function(n){switch(lt.toUpperCase(n)){case le.SYM_FALSE:return le.FALSE;case le.SYM_TRUE:return le.TRUE;case le.SYM_DONTCARE:return le.DONTCARE;case le.SYM_P:return le.P;case le.SYM_L:return le.L;case le.SYM_A:return le.A}throw new A("Unknown dimension symbol: "+n)},Object.defineProperties(le,xn);var In=function(){};In.prototype.filter=function(n){},In.prototype.interfaces_=function(){return[]},In.prototype.getClass=function(){return In};var Tn=function(){};Tn.prototype.filter=function(n,i){},Tn.prototype.isDone=function(){},Tn.prototype.isGeometryChanged=function(){},Tn.prototype.interfaces_=function(){return[]},Tn.prototype.getClass=function(){return Tn};var En=function(n){function i(u,c){if(n.call(this,c),this._geometries=u||[],n.hasNullElements(this._geometries))throw new A("geometries must not contain null elements")}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.computeEnvelopeInternal=function(){for(var u=new At,c=0;c<this._geometries.length;c++)u.expandToInclude(this._geometries[c].getEnvelopeInternal());return u},i.prototype.getGeometryN=function(u){return this._geometries[u]},i.prototype.getSortIndex=function(){return n.SORTINDEX_GEOMETRYCOLLECTION},i.prototype.getCoordinates=function(){for(var u=new Array(this.getNumPoints()).fill(null),c=-1,m=0;m<this._geometries.length;m++)for(var E=this._geometries[m].getCoordinates(),C=0;C<E.length;C++)u[++c]=E[C];return u},i.prototype.getArea=function(){for(var u=0,c=0;c<this._geometries.length;c++)u+=this._geometries[c].getArea();return u},i.prototype.equalsExact=function(){if(arguments.length===2){var u=arguments[0],c=arguments[1];if(!this.isEquivalentClass(u))return!1;var m=u;if(this._geometries.length!==m._geometries.length)return!1;for(var E=0;E<this._geometries.length;E++)if(!this._geometries[E].equalsExact(m._geometries[E],c))return!1;return!0}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.normalize=function(){for(var u=0;u<this._geometries.length;u++)this._geometries[u].normalize();_n.sort(this._geometries)},i.prototype.getCoordinate=function(){return this.isEmpty()?null:this._geometries[0].getCoordinate()},i.prototype.getBoundaryDimension=function(){for(var u=le.FALSE,c=0;c<this._geometries.length;c++)u=Math.max(u,this._geometries[c].getBoundaryDimension());return u},i.prototype.getDimension=function(){for(var u=le.FALSE,c=0;c<this._geometries.length;c++)u=Math.max(u,this._geometries[c].getDimension());return u},i.prototype.getLength=function(){for(var u=0,c=0;c<this._geometries.length;c++)u+=this._geometries[c].getLength();return u},i.prototype.getNumPoints=function(){for(var u=0,c=0;c<this._geometries.length;c++)u+=this._geometries[c].getNumPoints();return u},i.prototype.getNumGeometries=function(){return this._geometries.length},i.prototype.reverse=function(){for(var u=this._geometries.length,c=new Array(u).fill(null),m=0;m<this._geometries.length;m++)c[m]=this._geometries[m].reverse();return this.getFactory().createGeometryCollection(c)},i.prototype.compareToSameClass=function(){if(arguments.length===1){var u=arguments[0],c=new M(_n.asList(this._geometries)),m=new M(_n.asList(u._geometries));return this.compare(c,m)}if(arguments.length===2){for(var E=arguments[0],C=arguments[1],U=E,Z=this.getNumGeometries(),pt=U.getNumGeometries(),gt=0;gt<Z&><pt;){var Rt=this.getGeometryN(gt),Ft=U.getGeometryN(gt),Vt=Rt.compareToSameClass(Ft,C);if(Vt!==0)return Vt;gt++}return gt<Z?1:gt<pt?-1:0}},i.prototype.apply=function(){if(X(arguments[0],J))for(var u=arguments[0],c=0;c<this._geometries.length;c++)this._geometries[c].apply(u);else if(X(arguments[0],Tn)){var m=arguments[0];if(this._geometries.length===0)return null;for(var E=0;E<this._geometries.length&&(this._geometries[E].apply(m),!m.isDone());E++);m.isGeometryChanged()&&this.geometryChanged()}else if(X(arguments[0],In)){var C=arguments[0];C.filter(this);for(var U=0;U<this._geometries.length;U++)this._geometries[U].apply(C)}else if(X(arguments[0],ue)){var Z=arguments[0];Z.filter(this);for(var pt=0;pt<this._geometries.length;pt++)this._geometries[pt].apply(Z)}},i.prototype.getBoundary=function(){return this.checkNotGeometryCollection(this),Lt.shouldNeverReachHere(),null},i.prototype.clone=function(){var u=n.prototype.clone.call(this);u._geometries=new Array(this._geometries.length).fill(null);for(var c=0;c<this._geometries.length;c++)u._geometries[c]=this._geometries[c].clone();return u},i.prototype.getGeometryType=function(){return"GeometryCollection"},i.prototype.copy=function(){for(var u=new Array(this._geometries.length).fill(null),c=0;c<u.length;c++)u[c]=this._geometries[c].copy();return new i(u,this._factory)},i.prototype.isEmpty=function(){for(var u=0;u<this._geometries.length;u++)if(!this._geometries[u].isEmpty())return!1;return!0},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return-5694727726395021e3},Object.defineProperties(i,s),i}(Ct),Hr=function(n){function i(){n.apply(this,arguments)}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.getSortIndex=function(){return Ct.SORTINDEX_MULTILINESTRING},i.prototype.equalsExact=function(){if(arguments.length===2){var u=arguments[0],c=arguments[1];return!!this.isEquivalentClass(u)&&n.prototype.equalsExact.call(this,u,c)}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.getBoundaryDimension=function(){return this.isClosed()?le.FALSE:0},i.prototype.isClosed=function(){if(this.isEmpty())return!1;for(var u=0;u<this._geometries.length;u++)if(!this._geometries[u].isClosed())return!1;return!0},i.prototype.getDimension=function(){return 1},i.prototype.reverse=function(){for(var u=this._geometries.length,c=new Array(u).fill(null),m=0;m<this._geometries.length;m++)c[u-1-m]=this._geometries[m].reverse();return this.getFactory().createMultiLineString(c)},i.prototype.getBoundary=function(){return new yr(this).getBoundary()},i.prototype.getGeometryType=function(){return"MultiLineString"},i.prototype.copy=function(){for(var u=new Array(this._geometries.length).fill(null),c=0;c<u.length;c++)u[c]=this._geometries[c].copy();return new i(u,this._factory)},i.prototype.interfaces_=function(){return[On]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return 8166665132445434e3},Object.defineProperties(i,s),i}(En),yr=function(){if(this._geom=null,this._geomFact=null,this._bnRule=null,this._endpointMap=null,arguments.length===1){var n=arguments[0],i=w.MOD2_BOUNDARY_RULE;this._geom=n,this._geomFact=n.getFactory(),this._bnRule=i}else if(arguments.length===2){var s=arguments[0],u=arguments[1];this._geom=s,this._geomFact=s.getFactory(),this._bnRule=u}};yr.prototype.boundaryMultiLineString=function(n){if(this._geom.isEmpty())return this.getEmptyMultiPoint();var i=this.computeBoundaryCoordinates(n);return i.length===1?this._geomFact.createPoint(i[0]):this._geomFact.createMultiPointFromCoords(i)},yr.prototype.getBoundary=function(){return this._geom instanceof at?this.boundaryLineString(this._geom):this._geom instanceof Hr?this.boundaryMultiLineString(this._geom):this._geom.getBoundary()},yr.prototype.boundaryLineString=function(n){return this._geom.isEmpty()?this.getEmptyMultiPoint():n.isClosed()?this._bnRule.isInBoundary(2)?n.getStartPoint():this._geomFact.createMultiPoint():this._geomFact.createMultiPoint([n.getStartPoint(),n.getEndPoint()])},yr.prototype.getEmptyMultiPoint=function(){return this._geomFact.createMultiPoint()},yr.prototype.computeBoundaryCoordinates=function(n){var i=new O;this._endpointMap=new x;for(var s=0;s<n.getNumGeometries();s++){var u=n.getGeometryN(s);u.getNumPoints()!==0&&(this.addEndpoint(u.getCoordinateN(0)),this.addEndpoint(u.getCoordinateN(u.getNumPoints()-1)))}for(var c=this._endpointMap.entrySet().iterator();c.hasNext();){var m=c.next(),E=m.getValue().count;this._bnRule.isInBoundary(E)&&i.add(m.getKey())}return Q.toCoordinateArray(i)},yr.prototype.addEndpoint=function(n){var i=this._endpointMap.get(n);i===null&&(i=new q,this._endpointMap.put(n,i)),i.count++},yr.prototype.interfaces_=function(){return[]},yr.prototype.getClass=function(){return yr},yr.getBoundary=function(){if(arguments.length===1){var n=arguments[0];return new yr(n).getBoundary()}if(arguments.length===2){var i=arguments[0],s=arguments[1];return new yr(i,s).getBoundary()}};var q=function(){this.count=null};q.prototype.interfaces_=function(){return[]},q.prototype.getClass=function(){return q};var st=function(){},vt={NEWLINE:{configurable:!0},SIMPLE_ORDINATE_FORMAT:{configurable:!0}};st.prototype.interfaces_=function(){return[]},st.prototype.getClass=function(){return st},st.chars=function(n,i){for(var s=new Array(i).fill(null),u=0;u<i;u++)s[u]=n;return String(s)},st.getStackTrace=function(){if(arguments.length===1){var n=arguments[0],i=new function(){},s=new function(){}(i);return n.printStackTrace(s),i.toString()}if(arguments.length===2){for(var u=arguments[0],c=arguments[1],m="",E=new function(){}(new function(){}(st.getStackTrace(u))),C=0;C<c;C++)try{m+=E.readLine()+st.NEWLINE}catch(U){if(!(U instanceof b))throw U;Lt.shouldNeverReachHere()}return m}},st.split=function(n,i){for(var s=i.length,u=new O,c=""+n,m=c.indexOf(i);m>=0;){var E=c.substring(0,m);u.add(E),m=(c=c.substring(m+s)).indexOf(i)}c.length>0&&u.add(c);for(var C=new Array(u.size()).fill(null),U=0;U<C.length;U++)C[U]=u.get(U);return C},st.toString=function(){if(arguments.length===1){var n=arguments[0];return st.SIMPLE_ORDINATE_FORMAT.format(n)}},st.spaces=function(n){return st.chars(" ",n)},vt.NEWLINE.get=function(){return Ut.getProperty("line.separator")},vt.SIMPLE_ORDINATE_FORMAT.get=function(){return new function(){}("0.#")},Object.defineProperties(st,vt);var ht=function(){};ht.prototype.interfaces_=function(){return[]},ht.prototype.getClass=function(){return ht},ht.copyCoord=function(n,i,s,u){for(var c=Math.min(n.getDimension(),s.getDimension()),m=0;m<c;m++)s.setOrdinate(u,m,n.getOrdinate(i,m))},ht.isRing=function(n){var i=n.size();return i===0||!(i<=3)&&n.getOrdinate(0,tt.X)===n.getOrdinate(i-1,tt.X)&&n.getOrdinate(0,tt.Y)===n.getOrdinate(i-1,tt.Y)},ht.isEqual=function(n,i){var s=n.size();if(s!==i.size())return!1;for(var u=Math.min(n.getDimension(),i.getDimension()),c=0;c<s;c++)for(var m=0;m<u;m++){var E=n.getOrdinate(c,m),C=i.getOrdinate(c,m);if(n.getOrdinate(c,m)!==i.getOrdinate(c,m)&&(!S.isNaN(E)||!S.isNaN(C)))return!1}return!0},ht.extend=function(n,i,s){var u=n.create(s,i.getDimension()),c=i.size();if(ht.copy(i,0,u,0,c),c>0)for(var m=c;m<s;m++)ht.copy(i,c-1,u,m,1);return u},ht.reverse=function(n){for(var i=n.size()-1,s=Math.trunc(i/2),u=0;u<=s;u++)ht.swap(n,u,i-u)},ht.swap=function(n,i,s){if(i===s)return null;for(var u=0;u<n.getDimension();u++){var c=n.getOrdinate(i,u);n.setOrdinate(i,u,n.getOrdinate(s,u)),n.setOrdinate(s,u,c)}},ht.copy=function(n,i,s,u,c){for(var m=0;m<c;m++)ht.copyCoord(n,i+m,s,u+m)},ht.toString=function(){if(arguments.length===1){var n=arguments[0],i=n.size();if(i===0)return"()";var s=n.getDimension(),u=new _t;u.append("(");for(var c=0;c<i;c++){c>0&&u.append(" ");for(var m=0;m<s;m++)m>0&&u.append(","),u.append(st.toString(n.getOrdinate(c,m)))}return u.append(")"),u.toString()}},ht.ensureValidRing=function(n,i){var s=i.size();return s===0?i:s<=3?ht.createClosedRing(n,i,4):i.getOrdinate(0,tt.X)===i.getOrdinate(s-1,tt.X)&&i.getOrdinate(0,tt.Y)===i.getOrdinate(s-1,tt.Y)?i:ht.createClosedRing(n,i,s+1)},ht.createClosedRing=function(n,i,s){var u=n.create(s,i.getDimension()),c=i.size();ht.copy(i,0,u,0,c);for(var m=c;m<s;m++)ht.copy(i,0,u,m,1);return u};var at=function(n){function i(u,c){n.call(this,c),this._points=null,this.init(u)}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.computeEnvelopeInternal=function(){return this.isEmpty()?new At:this._points.expandEnvelope(new At)},i.prototype.isRing=function(){return this.isClosed()&&this.isSimple()},i.prototype.getSortIndex=function(){return n.SORTINDEX_LINESTRING},i.prototype.getCoordinates=function(){return this._points.toCoordinateArray()},i.prototype.equalsExact=function(){if(arguments.length===2){var u=arguments[0],c=arguments[1];if(!this.isEquivalentClass(u))return!1;var m=u;if(this._points.size()!==m._points.size())return!1;for(var E=0;E<this._points.size();E++)if(!this.equal(this._points.getCoordinate(E),m._points.getCoordinate(E),c))return!1;return!0}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.normalize=function(){for(var u=0;u<Math.trunc(this._points.size()/2);u++){var c=this._points.size()-1-u;if(!this._points.getCoordinate(u).equals(this._points.getCoordinate(c)))return this._points.getCoordinate(u).compareTo(this._points.getCoordinate(c))>0&&ht.reverse(this._points),null}},i.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},i.prototype.getBoundaryDimension=function(){return this.isClosed()?le.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 ot.computeLength(this._points)},i.prototype.getNumPoints=function(){return this._points.size()},i.prototype.reverse=function(){var u=this._points.copy();return ht.reverse(u),this.getFactory().createLineString(u)},i.prototype.compareToSameClass=function(){if(arguments.length===1){for(var u=arguments[0],c=0,m=0;c<this._points.size()&&m<u._points.size();){var E=this._points.getCoordinate(c).compareTo(u._points.getCoordinate(m));if(E!==0)return E;c++,m++}return c<this._points.size()?1:m<u._points.size()?-1:0}if(arguments.length===2){var C=arguments[0];return arguments[1].compare(this._points,C._points)}},i.prototype.apply=function(){if(X(arguments[0],J))for(var u=arguments[0],c=0;c<this._points.size();c++)u.filter(this._points.getCoordinate(c));else if(X(arguments[0],Tn)){var m=arguments[0];if(this._points.size()===0)return null;for(var E=0;E<this._points.size()&&(m.filter(this._points,E),!m.isDone());E++);m.isGeometryChanged()&&this.geometryChanged()}else X(arguments[0],In)?arguments[0].filter(this):X(arguments[0],ue)&&arguments[0].filter(this)},i.prototype.getBoundary=function(){return new yr(this).getBoundary()},i.prototype.isEquivalentClass=function(u){return u instanceof i},i.prototype.clone=function(){var u=n.prototype.clone.call(this);return u._points=this._points.clone(),u},i.prototype.getCoordinateN=function(u){return this._points.getCoordinate(u)},i.prototype.getGeometryType=function(){return"LineString"},i.prototype.copy=function(){return new i(this._points.copy(),this._factory)},i.prototype.getCoordinateSequence=function(){return this._points},i.prototype.isEmpty=function(){return this._points.size()===0},i.prototype.init=function(u){if(u===null&&(u=this.getFactory().getCoordinateSequenceFactory().create([])),u.size()===1)throw new A("Invalid number of points in LineString (found "+u.size()+" - must be 0 or >= 2)");this._points=u},i.prototype.isCoordinate=function(u){for(var c=0;c<this._points.size();c++)if(this._points.getCoordinate(c).equals(u))return!0;return!1},i.prototype.getStartPoint=function(){return this.isEmpty()?null:this.getPointN(0)},i.prototype.getPointN=function(u){return this.getFactory().createPoint(this._points.getCoordinate(u))},i.prototype.interfaces_=function(){return[On]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return 0x2b2b51ba435c8e00},Object.defineProperties(i,s),i}(Ct),Ht=function(){};Ht.prototype.interfaces_=function(){return[]},Ht.prototype.getClass=function(){return Ht};var Xt=function(n){function i(u,c){n.call(this,c),this._coordinates=u||null,this.init(this._coordinates)}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.computeEnvelopeInternal=function(){if(this.isEmpty())return new At;var u=new At;return u.expandToInclude(this._coordinates.getX(0),this._coordinates.getY(0)),u},i.prototype.getSortIndex=function(){return n.SORTINDEX_POINT},i.prototype.getCoordinates=function(){return this.isEmpty()?[]:[this.getCoordinate()]},i.prototype.equalsExact=function(){if(arguments.length===2){var u=arguments[0],c=arguments[1];return!!this.isEquivalentClass(u)&&(!(!this.isEmpty()||!u.isEmpty())||this.isEmpty()===u.isEmpty()&&this.equal(u.getCoordinate(),this.getCoordinate(),c))}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.normalize=function(){},i.prototype.getCoordinate=function(){return this._coordinates.size()!==0?this._coordinates.getCoordinate(0):null},i.prototype.getBoundaryDimension=function(){return le.FALSE},i.prototype.getDimension=function(){return 0},i.prototype.getNumPoints=function(){return this.isEmpty()?0:1},i.prototype.reverse=function(){return this.copy()},i.prototype.getX=function(){if(this.getCoordinate()===null)throw new Error("getX called on empty Point");return this.getCoordinate().x},i.prototype.compareToSameClass=function(){if(arguments.length===1){var u=arguments[0];return this.getCoordinate().compareTo(u.getCoordinate())}if(arguments.length===2){var c=arguments[0];return arguments[1].compare(this._coordinates,c._coordinates)}},i.prototype.apply=function(){if(X(arguments[0],J)){var u=arguments[0];if(this.isEmpty())return null;u.filter(this.getCoordinate())}else if(X(arguments[0],Tn)){var c=arguments[0];if(this.isEmpty())return null;c.filter(this._coordinates,0),c.isGeometryChanged()&&this.geometryChanged()}else X(arguments[0],In)?arguments[0].filter(this):X(arguments[0],ue)&&arguments[0].filter(this)},i.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},i.prototype.clone=function(){var u=n.prototype.clone.call(this);return u._coordinates=this._coordinates.clone(),u},i.prototype.getGeometryType=function(){return"Point"},i.prototype.copy=function(){return new i(this._coordinates.copy(),this._factory)},i.prototype.getCoordinateSequence=function(){return this._coordinates},i.prototype.getY=function(){if(this.getCoordinate()===null)throw new Error("getY called on empty Point");return this.getCoordinate().y},i.prototype.isEmpty=function(){return this._coordinates.size()===0},i.prototype.init=function(u){u===null&&(u=this.getFactory().getCoordinateSequenceFactory().create([])),Lt.isTrue(u.size()<=1),this._coordinates=u},i.prototype.isSimple=function(){return!0},i.prototype.interfaces_=function(){return[Ht]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return 4902022702746615e3},Object.defineProperties(i,s),i}(Ct),re=function(){};re.prototype.interfaces_=function(){return[]},re.prototype.getClass=function(){return re};var Zt=function(n){function i(u,c,m){if(n.call(this,m),this._shell=null,this._holes=null,u===null&&(u=this.getFactory().createLinearRing()),c===null&&(c=[]),n.hasNullElements(c))throw new A("holes must not contain null elements");if(u.isEmpty()&&n.hasNonEmptyElements(c))throw new A("shell is empty but holes are not");this._shell=u,this._holes=c}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.computeEnvelopeInternal=function(){return this._shell.getEnvelopeInternal()},i.prototype.getSortIndex=function(){return n.SORTINDEX_POLYGON},i.prototype.getCoordinates=function(){if(this.isEmpty())return[];for(var u=new Array(this.getNumPoints()).fill(null),c=-1,m=this._shell.getCoordinates(),E=0;E<m.length;E++)u[++c]=m[E];for(var C=0;C<this._holes.length;C++)for(var U=this._holes[C].getCoordinates(),Z=0;Z<U.length;Z++)u[++c]=U[Z];return u},i.prototype.getArea=function(){var u=0;u+=Math.abs(ot.signedArea(this._shell.getCoordinateSequence()));for(var c=0;c<this._holes.length;c++)u-=Math.abs(ot.signedArea(this._holes[c].getCoordinateSequence()));return u},i.prototype.isRectangle=function(){if(this.getNumInteriorRing()!==0||this._shell===null||this._shell.getNumPoints()!==5)return!1;for(var u=this._shell.getCoordinateSequence(),c=this.getEnvelopeInternal(),m=0;m<5;m++){var E=u.getX(m);if(E!==c.getMinX()&&E!==c.getMaxX())return!1;var C=u.getY(m);if(C!==c.getMinY()&&C!==c.getMaxY())return!1}for(var U=u.getX(0),Z=u.getY(0),pt=1;pt<=4;pt++){var gt=u.getX(pt),Rt=u.getY(pt);if(gt!==U==(Rt!==Z))return!1;U=gt,Z=Rt}return!0},i.prototype.equalsExact=function(){if(arguments.length===2){var u=arguments[0],c=arguments[1];if(!this.isEquivalentClass(u))return!1;var m=u,E=this._shell,C=m._shell;if(!E.equalsExact(C,c)||this._holes.length!==m._holes.length)return!1;for(var U=0;U<this._holes.length;U++)if(!this._holes[U].equalsExact(m._holes[U],c))return!1;return!0}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.normalize=function(){if(arguments.length===0){this.normalize(this._shell,!0);for(var u=0;u<this._holes.length;u++)this.normalize(this._holes[u],!1);_n.sort(this._holes)}else if(arguments.length===2){var c=arguments[0],m=arguments[1];if(c.isEmpty())return null;var E=new Array(c.getCoordinates().length-1).fill(null);Ut.arraycopy(c.getCoordinates(),0,E,0,E.length);var C=Q.minCoordinate(c.getCoordinates());Q.scroll(E,C),Ut.arraycopy(E,0,c.getCoordinates(),0,E.length),c.getCoordinates()[E.length]=E[0],ot.isCCW(c.getCoordinates())===m&&Q.reverse(c.getCoordinates())}},i.prototype.getCoordinate=function(){return this._shell.getCoordinate()},i.prototype.getNumInteriorRing=function(){return this._holes.length},i.prototype.getBoundaryDimension=function(){return 1},i.prototype.getDimension=function(){return 2},i.prototype.getLength=function(){var u=0;u+=this._shell.getLength();for(var c=0;c<this._holes.length;c++)u+=this._holes[c].getLength();return u},i.prototype.getNumPoints=function(){for(var u=this._shell.getNumPoints(),c=0;c<this._holes.length;c++)u+=this._holes[c].getNumPoints();return u},i.prototype.reverse=function(){var u=this.copy();u._shell=this._shell.copy().reverse(),u._holes=new Array(this._holes.length).fill(null);for(var c=0;c<this._holes.length;c++)u._holes[c]=this._holes[c].copy().reverse();return u},i.prototype.convexHull=function(){return this.getExteriorRing().convexHull()},i.prototype.compareToSameClass=function(){if(arguments.length===1){var u=arguments[0],c=this._shell,m=u._shell;return c.compareToSameClass(m)}if(arguments.length===2){var E=arguments[0],C=arguments[1],U=E,Z=this._shell,pt=U._shell,gt=Z.compareToSameClass(pt,C);if(gt!==0)return gt;for(var Rt=this.getNumInteriorRing(),Ft=U.getNumInteriorRing(),Vt=0;Vt<Rt&&Vt<Ft;){var ee=this.getInteriorRingN(Vt),hn=U.getInteriorRingN(Vt),qn=ee.compareToSameClass(hn,C);if(qn!==0)return qn;Vt++}return Vt<Rt?1:Vt<Ft?-1:0}},i.prototype.apply=function(u){if(X(u,J)){this._shell.apply(u);for(var c=0;c<this._holes.length;c++)this._holes[c].apply(u)}else if(X(u,Tn)){if(this._shell.apply(u),!u.isDone())for(var m=0;m<this._holes.length&&(this._holes[m].apply(u),!u.isDone());m++);u.isGeometryChanged()&&this.geometryChanged()}else if(X(u,In))u.filter(this);else if(X(u,ue)){u.filter(this),this._shell.apply(u);for(var E=0;E<this._holes.length;E++)this._holes[E].apply(u)}},i.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();var u=new Array(this._holes.length+1).fill(null);u[0]=this._shell;for(var c=0;c<this._holes.length;c++)u[c+1]=this._holes[c];return u.length<=1?this.getFactory().createLinearRing(u[0].getCoordinateSequence()):this.getFactory().createMultiLineString(u)},i.prototype.clone=function(){var u=n.prototype.clone.call(this);u._shell=this._shell.clone(),u._holes=new Array(this._holes.length).fill(null);for(var c=0;c<this._holes.length;c++)u._holes[c]=this._holes[c].clone();return u},i.prototype.getGeometryType=function(){return"Polygon"},i.prototype.copy=function(){for(var u=this._shell.copy(),c=new Array(this._holes.length).fill(null),m=0;m<c.length;m++)c[m]=this._holes[m].copy();return new i(u,c,this._factory)},i.prototype.getExteriorRing=function(){return this._shell},i.prototype.isEmpty=function(){return this._shell.isEmpty()},i.prototype.getInteriorRingN=function(u){return this._holes[u]},i.prototype.interfaces_=function(){return[re]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return-0x307ffefd8dc97200},Object.defineProperties(i,s),i}(Ct),me=function(n){function i(){n.apply(this,arguments)}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.getSortIndex=function(){return Ct.SORTINDEX_MULTIPOINT},i.prototype.isValid=function(){return!0},i.prototype.equalsExact=function(){if(arguments.length===2){var u=arguments[0],c=arguments[1];return!!this.isEquivalentClass(u)&&n.prototype.equalsExact.call(this,u,c)}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.getCoordinate=function(){if(arguments.length===1){var u=arguments[0];return this._geometries[u].getCoordinate()}return n.prototype.getCoordinate.apply(this,arguments)},i.prototype.getBoundaryDimension=function(){return le.FALSE},i.prototype.getDimension=function(){return 0},i.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},i.prototype.getGeometryType=function(){return"MultiPoint"},i.prototype.copy=function(){for(var u=new Array(this._geometries.length).fill(null),c=0;c<u.length;c++)u[c]=this._geometries[c].copy();return new i(u,this._factory)},i.prototype.interfaces_=function(){return[Ht]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return-8048474874175356e3},Object.defineProperties(i,s),i}(En),oe=function(n){function i(u,c){u instanceof I&&c instanceof pe&&(u=c.getCoordinateSequenceFactory().create(u)),n.call(this,u,c),this.validateConstruction()}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={MINIMUM_VALID_SIZE:{configurable:!0},serialVersionUID:{configurable:!0}};return i.prototype.getSortIndex=function(){return Ct.SORTINDEX_LINEARRING},i.prototype.getBoundaryDimension=function(){return le.FALSE},i.prototype.isClosed=function(){return!!this.isEmpty()||n.prototype.isClosed.call(this)},i.prototype.reverse=function(){var u=this._points.copy();return ht.reverse(u),this.getFactory().createLinearRing(u)},i.prototype.validateConstruction=function(){if(!this.isEmpty()&&!n.prototype.isClosed.call(this))throw new A("Points of LinearRing do not form a closed linestring");if(this.getCoordinateSequence().size()>=1&&this.getCoordinateSequence().size()<i.MINIMUM_VALID_SIZE)throw new A("Invalid number of points in LinearRing (found "+this.getCoordinateSequence().size()+" - must be 0 or >= 4)")},i.prototype.getGeometryType=function(){return"LinearRing"},i.prototype.copy=function(){return new i(this._points.copy(),this._factory)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},s.MINIMUM_VALID_SIZE.get=function(){return 4},s.serialVersionUID.get=function(){return-0x3b229e262367a600},Object.defineProperties(i,s),i}(at),ae=function(n){function i(){n.apply(this,arguments)}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.getSortIndex=function(){return Ct.SORTINDEX_MULTIPOLYGON},i.prototype.equalsExact=function(){if(arguments.length===2){var u=arguments[0],c=arguments[1];return!!this.isEquivalentClass(u)&&n.prototype.equalsExact.call(this,u,c)}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.getBoundaryDimension=function(){return 1},i.prototype.getDimension=function(){return 2},i.prototype.reverse=function(){for(var u=this._geometries.length,c=new Array(u).fill(null),m=0;m<this._geometries.length;m++)c[m]=this._geometries[m].reverse();return this.getFactory().createMultiPolygon(c)},i.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();for(var u=new O,c=0;c<this._geometries.length;c++)for(var m=this._geometries[c].getBoundary(),E=0;E<m.getNumGeometries();E++)u.add(m.getGeometryN(E));var C=new Array(u.size()).fill(null);return this.getFactory().createMultiLineString(u.toArray(C))},i.prototype.getGeometryType=function(){return"MultiPolygon"},i.prototype.copy=function(){for(var u=new Array(this._geometries.length).fill(null),c=0;c<u.length;c++)u[c]=this._geometries[c].copy();return new i(u,this._factory)},i.prototype.interfaces_=function(){return[re]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return-0x7a5aa1369171980},Object.defineProperties(i,s),i}(En),un=function(n){this._factory=n||null,this._isUserDataCopied=!1},vr={NoOpGeometryOperation:{configurable:!0},CoordinateOperation:{configurable:!0},CoordinateSequenceOperation:{configurable:!0}};un.prototype.setCopyUserData=function(n){this._isUserDataCopied=n},un.prototype.edit=function(n,i){if(n===null)return null;var s=this.editInternal(n,i);return this._isUserDataCopied&&s.setUserData(n.getUserData()),s},un.prototype.editInternal=function(n,i){return this._factory===null&&(this._factory=n.getFactory()),n instanceof En?this.editGeometryCollection(n,i):n instanceof Zt?this.editPolygon(n,i):n instanceof Xt?i.edit(n,this._factory):n instanceof at?i.edit(n,this._factory):(Lt.shouldNeverReachHere("Unsupported Geometry class: "+n.getClass().getName()),null)},un.prototype.editGeometryCollection=function(n,i){for(var s=i.edit(n,this._factory),u=new O,c=0;c<s.getNumGeometries();c++){var m=this.edit(s.getGeometryN(c),i);m===null||m.isEmpty()||u.add(m)}return s.getClass()===me?this._factory.createMultiPoint(u.toArray([])):s.getClass()===Hr?this._factory.createMultiLineString(u.toArray([])):s.getClass()===ae?this._factory.createMultiPolygon(u.toArray([])):this._factory.createGeometryCollection(u.toArray([]))},un.prototype.editPolygon=function(n,i){var s=i.edit(n,this._factory);if(s===null&&(s=this._factory.createPolygon(null)),s.isEmpty())return s;var u=this.edit(s.getExteriorRing(),i);if(u===null||u.isEmpty())return this._factory.createPolygon();for(var c=new O,m=0;m<s.getNumInteriorRing();m++){var E=this.edit(s.getInteriorRingN(m),i);E===null||E.isEmpty()||c.add(E)}return this._factory.createPolygon(u,c.toArray([]))},un.prototype.interfaces_=function(){return[]},un.prototype.getClass=function(){return un},un.GeometryEditorOperation=function(){},vr.NoOpGeometryOperation.get=function(){return Bn},vr.CoordinateOperation.get=function(){return ti},vr.CoordinateSequenceOperation.get=function(){return Mn},Object.defineProperties(un,vr);var Bn=function(){};Bn.prototype.edit=function(n,i){return n},Bn.prototype.interfaces_=function(){return[un.GeometryEditorOperation]},Bn.prototype.getClass=function(){return Bn};var ti=function(){};ti.prototype.edit=function(n,i){var s=this.editCoordinates(n.getCoordinates(),n);return s===null?n:n instanceof oe?i.createLinearRing(s):n instanceof at?i.createLineString(s):n instanceof Xt?s.length>0?i.createPoint(s[0]):i.createPoint():n},ti.prototype.interfaces_=function(){return[un.GeometryEditorOperation]},ti.prototype.getClass=function(){return ti};var Mn=function(){};Mn.prototype.edit=function(n,i){return n instanceof oe?i.createLinearRing(this.edit(n.getCoordinateSequence(),n)):n instanceof at?i.createLineString(this.edit(n.getCoordinateSequence(),n)):n instanceof Xt?i.createPoint(this.edit(n.getCoordinateSequence(),n)):n},Mn.prototype.interfaces_=function(){return[un.GeometryEditorOperation]},Mn.prototype.getClass=function(){return Mn};var jt=function(){if(this._dimension=3,this._coordinates=null,arguments.length===1){if(arguments[0]instanceof Array)this._coordinates=arguments[0],this._dimension=3;else if(Number.isInteger(arguments[0])){var n=arguments[0];this._coordinates=new Array(n).fill(null);for(var i=0;i<n;i++)this._coordinates[i]=new I}else if(X(arguments[0],tt)){var s=arguments[0];if(s===null)return this._coordinates=new Array(0).fill(null),null;this._dimension=s.getDimension(),this._coordinates=new Array(s.size()).fill(null);for(var u=0;u<this._coordinates.length;u++)this._coordinates[u]=s.getCoordinateCopy(u)}}else if(arguments.length===2){if(arguments[0]instanceof Array&&Number.isInteger(arguments[1])){var c=arguments[0],m=arguments[1];this._coordinates=c,this._dimension=m,c===null&&(this._coordinates=new Array(0).fill(null))}else if(Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var E=arguments[0],C=arguments[1];this._coordinates=new Array(E).fill(null),this._dimension=C;for(var U=0;U<E;U++)this._coordinates[U]=new I}}},Na={serialVersionUID:{configurable:!0}};jt.prototype.setOrdinate=function(n,i,s){switch(i){case tt.X:this._coordinates[n].x=s;break;case tt.Y:this._coordinates[n].y=s;break;case tt.Z:this._coordinates[n].z=s;break;default:throw new A("invalid ordinateIndex")}},jt.prototype.size=function(){return this._coordinates.length},jt.prototype.getOrdinate=function(n,i){switch(i){case tt.X:return this._coordinates[n].x;case tt.Y:return this._coordinates[n].y;case tt.Z:return this._coordinates[n].z}return S.NaN},jt.prototype.getCoordinate=function(){if(arguments.length===1){var n=arguments[0];return this._coordinates[n]}if(arguments.length===2){var i=arguments[0],s=arguments[1];s.x=this._coordinates[i].x,s.y=this._coordinates[i].y,s.z=this._coordinates[i].z}},jt.prototype.getCoordinateCopy=function(n){return new I(this._coordinates[n])},jt.prototype.getDimension=function(){return this._dimension},jt.prototype.getX=function(n){return this._coordinates[n].x},jt.prototype.clone=function(){for(var n=new Array(this.size()).fill(null),i=0;i<this._coordinates.length;i++)n[i]=this._coordinates[i].clone();return new jt(n,this._dimension)},jt.prototype.expandEnvelope=function(n){for(var i=0;i<this._coordinates.length;i++)n.expandToInclude(this._coordinates[i]);return n},jt.prototype.copy=function(){for(var n=new Array(this.size()).fill(null),i=0;i<this._coordinates.length;i++)n[i]=this._coordinates[i].copy();return new jt(n,this._dimension)},jt.prototype.toString=function(){if(this._coordinates.length>0){var n=new _t(17*this._coordinates.length);n.append("("),n.append(this._coordinates[0]);for(var i=1;i<this._coordinates.length;i++)n.append(", "),n.append(this._coordinates[i]);return n.append(")"),n.toString()}return"()"},jt.prototype.getY=function(n){return this._coordinates[n].y},jt.prototype.toCoordinateArray=function(){return this._coordinates},jt.prototype.interfaces_=function(){return[tt,t]},jt.prototype.getClass=function(){return jt},Na.serialVersionUID.get=function(){return-0xcb44a778db18e00},Object.defineProperties(jt,Na);var ln=function(){},Xi={serialVersionUID:{configurable:!0},instanceObject:{configurable:!0}};ln.prototype.readResolve=function(){return ln.instance()},ln.prototype.create=function(){if(arguments.length===1){if(arguments[0]instanceof Array){var n=arguments[0];return new jt(n)}if(X(arguments[0],tt)){var i=arguments[0];return new jt(i)}}else if(arguments.length===2){var s=arguments[0],u=arguments[1];return u>3&&(u=3),u<2?new jt(s):new jt(s,u)}},ln.prototype.interfaces_=function(){return[W,t]},ln.prototype.getClass=function(){return ln},ln.instance=function(){return ln.instanceObject},Xi.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00},Xi.instanceObject.get=function(){return new ln},Object.defineProperties(ln,Xi);var Qu=function(n){function i(){n.call(this),this.map_=new Map}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.get=function(s){return this.map_.get(s)||null},i.prototype.put=function(s,u){return this.map_.set(s,u),u},i.prototype.values=function(){for(var s=new O,u=this.map_.values(),c=u.next();!c.done;)s.add(c.value),c=u.next();return s},i.prototype.entrySet=function(){var s=new de;return this.map_.entries().forEach(function(u){return s.add(u)}),s},i.prototype.size=function(){return this.map_.size()},i}(Kt),ge=function n(){if(this._modelType=null,this._scale=null,arguments.length===0)this._modelType=n.FLOATING;else if(arguments.length===1){if(arguments[0]instanceof Sn){var i=arguments[0];this._modelType=i,i===n.FIXED&&this.setScale(1)}else if(typeof arguments[0]=="number"){var s=arguments[0];this._modelType=n.FIXED,this.setScale(s)}else if(arguments[0]instanceof n){var u=arguments[0];this._modelType=u._modelType,this._scale=u._scale}}},Ys={serialVersionUID:{configurable:!0},maximumPreciseValue:{configurable:!0}};ge.prototype.equals=function(n){if(!(n instanceof ge))return!1;var i=n;return this._modelType===i._modelType&&this._scale===i._scale},ge.prototype.compareTo=function(n){var i=n,s=this.getMaximumSignificantDigits(),u=i.getMaximumSignificantDigits();return new it(s).compareTo(new it(u))},ge.prototype.getScale=function(){return this._scale},ge.prototype.isFloating=function(){return this._modelType===ge.FLOATING||this._modelType===ge.FLOATING_SINGLE},ge.prototype.getType=function(){return this._modelType},ge.prototype.toString=function(){var n="UNKNOWN";return this._modelType===ge.FLOATING?n="Floating":this._modelType===ge.FLOATING_SINGLE?n="Floating-Single":this._modelType===ge.FIXED&&(n="Fixed (Scale="+this.getScale()+")"),n},ge.prototype.makePrecise=function(){if(typeof arguments[0]=="number"){var n=arguments[0];return S.isNaN(n)||this._modelType===ge.FLOATING_SINGLE?n:this._modelType===ge.FIXED?Math.round(n*this._scale)/this._scale:n}if(arguments[0]instanceof I){var i=arguments[0];if(this._modelType===ge.FLOATING)return null;i.x=this.makePrecise(i.x),i.y=this.makePrecise(i.y)}},ge.prototype.getMaximumSignificantDigits=function(){var n=16;return this._modelType===ge.FLOATING?n=16:this._modelType===ge.FLOATING_SINGLE?n=6:this._modelType===ge.FIXED&&(n=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),n},ge.prototype.setScale=function(n){this._scale=Math.abs(n)},ge.prototype.interfaces_=function(){return[t,G]},ge.prototype.getClass=function(){return ge},ge.mostPrecise=function(n,i){return n.compareTo(i)>=0?n:i},Ys.serialVersionUID.get=function(){return 7777263578777804e3},Ys.maximumPreciseValue.get=function(){return 9007199254740992},Object.defineProperties(ge,Ys);var Sn=function n(i){this._name=i||null,n.nameToTypeMap.put(i,this)},Yi={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}};Sn.prototype.readResolve=function(){return Sn.nameToTypeMap.get(this._name)},Sn.prototype.toString=function(){return this._name},Sn.prototype.interfaces_=function(){return[t]},Sn.prototype.getClass=function(){return Sn},Yi.serialVersionUID.get=function(){return-552860263173159e4},Yi.nameToTypeMap.get=function(){return new Qu},Object.defineProperties(Sn,Yi),ge.Type=Sn,ge.FIXED=new Sn("FIXED"),ge.FLOATING=new Sn("FLOATING"),ge.FLOATING_SINGLE=new Sn("FLOATING SINGLE");var pe=function n(){this._precisionModel=new ge,this._SRID=0,this._coordinateSequenceFactory=n.getDefaultCoordinateSequenceFactory(),arguments.length===0||(arguments.length===1?X(arguments[0],W)?this._coordinateSequenceFactory=arguments[0]:arguments[0]instanceof ge&&(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]))},ei={serialVersionUID:{configurable:!0}};pe.prototype.toGeometry=function(n){return n.isNull()?this.createPoint(null):n.getMinX()===n.getMaxX()&&n.getMinY()===n.getMaxY()?this.createPoint(new I(n.getMinX(),n.getMinY())):n.getMinX()===n.getMaxX()||n.getMinY()===n.getMaxY()?this.createLineString([new I(n.getMinX(),n.getMinY()),new I(n.getMaxX(),n.getMaxY())]):this.createPolygon(this.createLinearRing([new I(n.getMinX(),n.getMinY()),new I(n.getMinX(),n.getMaxY()),new I(n.getMaxX(),n.getMaxY()),new I(n.getMaxX(),n.getMinY()),new I(n.getMinX(),n.getMinY())]),null)},pe.prototype.createLineString=function(n){return n?n instanceof Array?new at(this.getCoordinateSequenceFactory().create(n),this):X(n,tt)?new at(n,this):void 0:new at(this.getCoordinateSequenceFactory().create([]),this)},pe.prototype.createMultiLineString=function(){if(arguments.length===0)return new Hr(null,this);if(arguments.length===1){var n=arguments[0];return new Hr(n,this)}},pe.prototype.buildGeometry=function(n){for(var i=null,s=!1,u=!1,c=n.iterator();c.hasNext();){var m=c.next(),E=m.getClass();i===null&&(i=E),E!==i&&(s=!0),m.isGeometryCollectionOrDerived()&&(u=!0)}if(i===null)return this.createGeometryCollection();if(s||u)return this.createGeometryCollection(pe.toGeometryArray(n));var C=n.iterator().next();if(n.size()>1){if(C instanceof Zt)return this.createMultiPolygon(pe.toPolygonArray(n));if(C instanceof at)return this.createMultiLineString(pe.toLineStringArray(n));if(C instanceof Xt)return this.createMultiPoint(pe.toPointArray(n));Lt.shouldNeverReachHere("Unhandled class: "+C.getClass().getName())}return C},pe.prototype.createMultiPointFromCoords=function(n){return this.createMultiPoint(n!==null?this.getCoordinateSequenceFactory().create(n):null)},pe.prototype.createPoint=function(){if(arguments.length===0)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof I){var n=arguments[0];return this.createPoint(n!==null?this.getCoordinateSequenceFactory().create([n]):null)}if(X(arguments[0],tt)){var i=arguments[0];return new Xt(i,this)}}},pe.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory},pe.prototype.createPolygon=function(){if(arguments.length===0)return new Zt(null,null,this);if(arguments.length===1){if(X(arguments[0],tt)){var n=arguments[0];return this.createPolygon(this.createLinearRing(n))}if(arguments[0]instanceof Array){var i=arguments[0];return this.createPolygon(this.createLinearRing(i))}if(arguments[0]instanceof oe){var s=arguments[0];return this.createPolygon(s,null)}}else if(arguments.length===2){var u=arguments[0],c=arguments[1];return new Zt(u,c,this)}},pe.prototype.getSRID=function(){return this._SRID},pe.prototype.createGeometryCollection=function(){if(arguments.length===0)return new En(null,this);if(arguments.length===1){var n=arguments[0];return new En(n,this)}},pe.prototype.createGeometry=function(n){return new un(this).edit(n,{edit:function(){if(arguments.length===2){var i=arguments[0];return this._coordinateSequenceFactory.create(i)}}})},pe.prototype.getPrecisionModel=function(){return this._precisionModel},pe.prototype.createLinearRing=function(){if(arguments.length===0)return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Array){var n=arguments[0];return this.createLinearRing(n!==null?this.getCoordinateSequenceFactory().create(n):null)}if(X(arguments[0],tt)){var i=arguments[0];return new oe(i,this)}}},pe.prototype.createMultiPolygon=function(){if(arguments.length===0)return new ae(null,this);if(arguments.length===1){var n=arguments[0];return new ae(n,this)}},pe.prototype.createMultiPoint=function(){if(arguments.length===0)return new me(null,this);if(arguments.length===1){if(arguments[0]instanceof Array){var n=arguments[0];return new me(n,this)}if(arguments[0]instanceof Array){var i=arguments[0];return this.createMultiPoint(i!==null?this.getCoordinateSequenceFactory().create(i):null)}if(X(arguments[0],tt)){var s=arguments[0];if(s===null)return this.createMultiPoint(new Array(0).fill(null));for(var u=new Array(s.size()).fill(null),c=0;c<s.size();c++){var m=this.getCoordinateSequenceFactory().create(1,s.getDimension());ht.copy(s,c,m,0,1),u[c]=this.createPoint(m)}return this.createMultiPoint(u)}}},pe.prototype.interfaces_=function(){return[t]},pe.prototype.getClass=function(){return pe},pe.toMultiPolygonArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},pe.toGeometryArray=function(n){if(n===null)return null;var i=new Array(n.size()).fill(null);return n.toArray(i)},pe.getDefaultCoordinateSequenceFactory=function(){return ln.instance()},pe.toMultiLineStringArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},pe.toLineStringArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},pe.toMultiPointArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},pe.toLinearRingArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},pe.toPointArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},pe.toPolygonArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},pe.createPointFromInternalCoord=function(n,i){return i.getPrecisionModel().makePrecise(n),i.getFactory().createPoint(n)},ei.serialVersionUID.get=function(){return-6820524753094096e3},Object.defineProperties(pe,ei);var tl=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],Oa=function(n){this.geometryFactory=n||new pe};Oa.prototype.read=function(n){var i,s=(i=typeof n=="string"?JSON.parse(n):n).type;if(!ni[s])throw new Error("Unknown GeoJSON type: "+i.type);return tl.indexOf(s)!==-1?ni[s].apply(this,[i.coordinates]):s==="GeometryCollection"?ni[s].apply(this,[i.geometries]):ni[s].apply(this,[i])},Oa.prototype.write=function(n){var i=n.getGeometryType();if(!_o[i])throw new Error("Geometry is not supported");return _o[i].apply(this,[n])};var ni={Feature:function(n){var i={};for(var s in n)i[s]=n[s];if(n.geometry){var u=n.geometry.type;if(!ni[u])throw new Error("Unknown GeoJSON type: "+n.type);i.geometry=this.read(n.geometry)}return n.bbox&&(i.bbox=ni.bbox.apply(this,[n.bbox])),i},FeatureCollection:function(n){var i={};if(n.features){i.features=[];for(var s=0;s<n.features.length;++s)i.features.push(this.read(n.features[s]))}return n.bbox&&(i.bbox=this.parse.bbox.apply(this,[n.bbox])),i},coordinates:function(n){for(var i=[],s=0;s<n.length;++s){var u=n[s];i.push(new I(u[0],u[1]))}return i},bbox:function(n){return this.geometryFactory.createLinearRing([new I(n[0],n[1]),new I(n[2],n[1]),new I(n[2],n[3]),new I(n[0],n[3]),new I(n[0],n[1])])},Point:function(n){var i=new I(n[0],n[1]);return this.geometryFactory.createPoint(i)},MultiPoint:function(n){for(var i=[],s=0;s<n.length;++s)i.push(ni.Point.apply(this,[n[s]]));return this.geometryFactory.createMultiPoint(i)},LineString:function(n){var i=ni.coordinates.apply(this,[n]);return this.geometryFactory.createLineString(i)},MultiLineString:function(n){for(var i=[],s=0;s<n.length;++s)i.push(ni.LineString.apply(this,[n[s]]));return this.geometryFactory.createMultiLineString(i)},Polygon:function(n){for(var i=ni.coordinates.apply(this,[n[0]]),s=this.geometryFactory.createLinearRing(i),u=[],c=1;c<n.length;++c){var m=n[c],E=ni.coordinates.apply(this,[m]),C=this.geometryFactory.createLinearRing(E);u.push(C)}return this.geometryFactory.createPolygon(s,u)},MultiPolygon:function(n){for(var i=[],s=0;s<n.length;++s){var u=n[s];i.push(ni.Polygon.apply(this,[u]))}return this.geometryFactory.createMultiPolygon(i)},GeometryCollection:function(n){for(var i=[],s=0;s<n.length;++s){var u=n[s];i.push(this.read(u))}return this.geometryFactory.createGeometryCollection(i)}},_o={coordinate:function(n){return[n.x,n.y]},Point:function(n){return{type:"Point",coordinates:_o.coordinate.apply(this,[n.getCoordinate()])}},MultiPoint:function(n){for(var i=[],s=0;s<n._geometries.length;++s){var u=n._geometries[s],c=_o.Point.apply(this,[u]);i.push(c.coordinates)}return{type:"MultiPoint",coordinates:i}},LineString:function(n){for(var i=[],s=n.getCoordinates(),u=0;u<s.length;++u){var c=s[u];i.push(_o.coordinate.apply(this,[c]))}return{type:"LineString",coordinates:i}},MultiLineString:function(n){for(var i=[],s=0;s<n._geometries.length;++s){var u=n._geometries[s],c=_o.LineString.apply(this,[u]);i.push(c.coordinates)}return{type:"MultiLineString",coordinates:i}},Polygon:function(n){var i=[],s=_o.LineString.apply(this,[n._shell]);i.push(s.coordinates);for(var u=0;u<n._holes.length;++u){var c=n._holes[u],m=_o.LineString.apply(this,[c]);i.push(m.coordinates)}return{type:"Polygon",coordinates:i}},MultiPolygon:function(n){for(var i=[],s=0;s<n._geometries.length;++s){var u=n._geometries[s],c=_o.Polygon.apply(this,[u]);i.push(c.coordinates)}return{type:"MultiPolygon",coordinates:i}},GeometryCollection:function(n){for(var i=[],s=0;s<n._geometries.length;++s){var u=n._geometries[s],c=u.getGeometryType();i.push(_o[c].apply(this,[u]))}return{type:"GeometryCollection",geometries:i}}},ep=function(n){this.geometryFactory=n||new pe,this.precisionModel=this.geometryFactory.getPrecisionModel(),this.parser=new Oa(this.geometryFactory)};ep.prototype.read=function(n){var i=this.parser.read(n);return this.precisionModel.getType()===ge.FIXED&&this.reducePrecision(i),i},ep.prototype.reducePrecision=function(n){var i,s;if(n.coordinate)this.precisionModel.makePrecise(n.coordinate);else if(n.points)for(i=0,s=n.points.length;i<s;i++)this.precisionModel.makePrecise(n.points[i]);else if(n.geometries)for(i=0,s=n.geometries.length;i<s;i++)this.reducePrecision(n.geometries[i])};var ey=function(){this.parser=new Oa(this.geometryFactory)};ey.prototype.write=function(n){return this.parser.write(n)};var It=function(){},cc={ON:{configurable:!0},LEFT:{configurable:!0},RIGHT:{configurable:!0}};It.prototype.interfaces_=function(){return[]},It.prototype.getClass=function(){return It},It.opposite=function(n){return n===It.LEFT?It.RIGHT:n===It.RIGHT?It.LEFT:n},cc.ON.get=function(){return 0},cc.LEFT.get=function(){return 1},cc.RIGHT.get=function(){return 2},Object.defineProperties(It,cc),(T.prototype=new Error).name="EmptyStackException",(_.prototype=new ct).add=function(n){return this.array_.push(n),!0},_.prototype.get=function(n){if(n<0||n>=this.size())throw new Error;return this.array_[n]},_.prototype.push=function(n){return this.array_.push(n),n},_.prototype.pop=function(n){if(this.array_.length===0)throw new T;return this.array_.pop()},_.prototype.peek=function(){if(this.array_.length===0)throw new T;return this.array_[this.array_.length-1]},_.prototype.empty=function(){return this.array_.length===0},_.prototype.isEmpty=function(){return this.empty()},_.prototype.search=function(n){return this.array_.indexOf(n)},_.prototype.size=function(){return this.array_.length},_.prototype.toArray=function(){for(var n=[],i=0,s=this.array_.length;i<s;i++)n.push(this.array_[i]);return n};var Di=function(){this._minIndex=-1,this._minCoord=null,this._minDe=null,this._orientedDe=null};Di.prototype.getCoordinate=function(){return this._minCoord},Di.prototype.getRightmostSide=function(n,i){var s=this.getRightmostSideOfSegment(n,i);return s<0&&(s=this.getRightmostSideOfSegment(n,i-1)),s<0&&(this._minCoord=null,this.checkForRightmostCoordinate(n)),s},Di.prototype.findRightmostEdgeAtVertex=function(){var n=this._minDe.getEdge().getCoordinates();Lt.isTrue(this._minIndex>0&&this._minIndex<n.length,"rightmost point expected to be interior vertex of edge");var i=n[this._minIndex-1],s=n[this._minIndex+1],u=ot.computeOrientation(this._minCoord,s,i),c=!1;(i.y<this._minCoord.y&&s.y<this._minCoord.y&&u===ot.COUNTERCLOCKWISE||i.y>this._minCoord.y&&s.y>this._minCoord.y&&u===ot.CLOCKWISE)&&(c=!0),c&&(this._minIndex=this._minIndex-1)},Di.prototype.getRightmostSideOfSegment=function(n,i){var s=n.getEdge().getCoordinates();if(i<0||i+1>=s.length||s[i].y===s[i+1].y)return-1;var u=It.LEFT;return s[i].y<s[i+1].y&&(u=It.RIGHT),u},Di.prototype.getEdge=function(){return this._orientedDe},Di.prototype.checkForRightmostCoordinate=function(n){for(var i=n.getEdge().getCoordinates(),s=0;s<i.length-1;s++)(this._minCoord===null||i[s].x>this._minCoord.x)&&(this._minDe=n,this._minIndex=s,this._minCoord=i[s])},Di.prototype.findRightmostEdgeAtNode=function(){var n=this._minDe.getNode().getEdges();this._minDe=n.getRightmostEdge(),this._minDe.isForward()||(this._minDe=this._minDe.getSym(),this._minIndex=this._minDe.getEdge().getCoordinates().length-1)},Di.prototype.findEdge=function(n){for(var i=n.iterator();i.hasNext();){var s=i.next();s.isForward()&&this.checkForRightmostCoordinate(s)}Lt.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)===It.LEFT&&(this._orientedDe=this._minDe.getSym())},Di.prototype.interfaces_=function(){return[]},Di.prototype.getClass=function(){return Di};var xo=function(n){function i(s,u){n.call(this,i.msgWithCoord(s,u)),this.pt=u?new I(u):null,this.name="TopologyException"}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.getCoordinate=function(){return this.pt},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i.msgWithCoord=function(s,u){return u?s:s+" [ "+u+" ]"},i}(ie),fc=function(){this.array_=[]};fc.prototype.addLast=function(n){this.array_.push(n)},fc.prototype.removeFirst=function(){return this.array_.shift()},fc.prototype.isEmpty=function(){return this.array_.length===0};var _r=function(){this._finder=null,this._dirEdgeList=new O,this._nodes=new O,this._rightMostCoord=null,this._env=null,this._finder=new Di};_r.prototype.clearVisitedEdges=function(){for(var n=this._dirEdgeList.iterator();n.hasNext();)n.next().setVisited(!1)},_r.prototype.getRightmostCoordinate=function(){return this._rightMostCoord},_r.prototype.computeNodeDepth=function(n){for(var i=null,s=n.getEdges().iterator();s.hasNext();){var u=s.next();if(u.isVisited()||u.getSym().isVisited()){i=u;break}}if(i===null)throw new xo("unable to find edge to compute depths at "+n.getCoordinate());n.getEdges().computeDepths(i);for(var c=n.getEdges().iterator();c.hasNext();){var m=c.next();m.setVisited(!0),this.copySymDepths(m)}},_r.prototype.computeDepth=function(n){this.clearVisitedEdges();var i=this._finder.getEdge();i.setEdgeDepths(It.RIGHT,n),this.copySymDepths(i),this.computeDepths(i)},_r.prototype.create=function(n){this.addReachable(n),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()},_r.prototype.findResultEdges=function(){for(var n=this._dirEdgeList.iterator();n.hasNext();){var i=n.next();i.getDepth(It.RIGHT)>=1&&i.getDepth(It.LEFT)<=0&&!i.isInteriorAreaEdge()&&i.setInResult(!0)}},_r.prototype.computeDepths=function(n){var i=new de,s=new fc,u=n.getNode();for(s.addLast(u),i.add(u),n.setVisited(!0);!s.isEmpty();){var c=s.removeFirst();i.add(c),this.computeNodeDepth(c);for(var m=c.getEdges().iterator();m.hasNext();){var E=m.next().getSym();if(!E.isVisited()){var C=E.getNode();i.contains(C)||(s.addLast(C),i.add(C))}}}},_r.prototype.compareTo=function(n){var i=n;return this._rightMostCoord.x<i._rightMostCoord.x?-1:this._rightMostCoord.x>i._rightMostCoord.x?1:0},_r.prototype.getEnvelope=function(){if(this._env===null){for(var n=new At,i=this._dirEdgeList.iterator();i.hasNext();)for(var s=i.next().getEdge().getCoordinates(),u=0;u<s.length-1;u++)n.expandToInclude(s[u]);this._env=n}return this._env},_r.prototype.addReachable=function(n){var i=new _;for(i.add(n);!i.empty();){var s=i.pop();this.add(s,i)}},_r.prototype.copySymDepths=function(n){var i=n.getSym();i.setDepth(It.LEFT,n.getDepth(It.RIGHT)),i.setDepth(It.RIGHT,n.getDepth(It.LEFT))},_r.prototype.add=function(n,i){n.setVisited(!0),this._nodes.add(n);for(var s=n.getEdges().iterator();s.hasNext();){var u=s.next();this._dirEdgeList.add(u);var c=u.getSym().getNode();c.isVisited()||i.push(c)}},_r.prototype.getNodes=function(){return this._nodes},_r.prototype.getDirectedEdges=function(){return this._dirEdgeList},_r.prototype.interfaces_=function(){return[G]},_r.prototype.getClass=function(){return _r};var gn=function n(){if(this.location=null,arguments.length===1){if(arguments[0]instanceof Array){var i=arguments[0];this.init(i.length)}else if(Number.isInteger(arguments[0])){var s=arguments[0];this.init(1),this.location[It.ON]=s}else if(arguments[0]instanceof n){var u=arguments[0];if(this.init(u.location.length),u!==null)for(var c=0;c<this.location.length;c++)this.location[c]=u.location[c]}}else if(arguments.length===3){var m=arguments[0],E=arguments[1],C=arguments[2];this.init(3),this.location[It.ON]=m,this.location[It.LEFT]=E,this.location[It.RIGHT]=C}};gn.prototype.setAllLocations=function(n){for(var i=0;i<this.location.length;i++)this.location[i]=n},gn.prototype.isNull=function(){for(var n=0;n<this.location.length;n++)if(this.location[n]!==V.NONE)return!1;return!0},gn.prototype.setAllLocationsIfNull=function(n){for(var i=0;i<this.location.length;i++)this.location[i]===V.NONE&&(this.location[i]=n)},gn.prototype.isLine=function(){return this.location.length===1},gn.prototype.merge=function(n){if(n.location.length>this.location.length){var i=new Array(3).fill(null);i[It.ON]=this.location[It.ON],i[It.LEFT]=V.NONE,i[It.RIGHT]=V.NONE,this.location=i}for(var s=0;s<this.location.length;s++)this.location[s]===V.NONE&&s<n.location.length&&(this.location[s]=n.location[s])},gn.prototype.getLocations=function(){return this.location},gn.prototype.flip=function(){if(this.location.length<=1)return null;var n=this.location[It.LEFT];this.location[It.LEFT]=this.location[It.RIGHT],this.location[It.RIGHT]=n},gn.prototype.toString=function(){var n=new _t;return this.location.length>1&&n.append(V.toLocationSymbol(this.location[It.LEFT])),n.append(V.toLocationSymbol(this.location[It.ON])),this.location.length>1&&n.append(V.toLocationSymbol(this.location[It.RIGHT])),n.toString()},gn.prototype.setLocations=function(n,i,s){this.location[It.ON]=n,this.location[It.LEFT]=i,this.location[It.RIGHT]=s},gn.prototype.get=function(n){return n<this.location.length?this.location[n]:V.NONE},gn.prototype.isArea=function(){return this.location.length>1},gn.prototype.isAnyNull=function(){for(var n=0;n<this.location.length;n++)if(this.location[n]===V.NONE)return!0;return!1},gn.prototype.setLocation=function(){if(arguments.length===1){var n=arguments[0];this.setLocation(It.ON,n)}else if(arguments.length===2){var i=arguments[0],s=arguments[1];this.location[i]=s}},gn.prototype.init=function(n){this.location=new Array(n).fill(null),this.setAllLocations(V.NONE)},gn.prototype.isEqualOnSide=function(n,i){return this.location[i]===n.location[i]},gn.prototype.allPositionsEqual=function(n){for(var i=0;i<this.location.length;i++)if(this.location[i]!==n)return!1;return!0},gn.prototype.interfaces_=function(){return[]},gn.prototype.getClass=function(){return gn};var fn=function n(){if(this.elt=new Array(2).fill(null),arguments.length===1){if(Number.isInteger(arguments[0])){var i=arguments[0];this.elt[0]=new gn(i),this.elt[1]=new gn(i)}else if(arguments[0]instanceof n){var s=arguments[0];this.elt[0]=new gn(s.elt[0]),this.elt[1]=new gn(s.elt[1])}}else if(arguments.length===2){var u=arguments[0],c=arguments[1];this.elt[0]=new gn(V.NONE),this.elt[1]=new gn(V.NONE),this.elt[u].setLocation(c)}else if(arguments.length===3){var m=arguments[0],E=arguments[1],C=arguments[2];this.elt[0]=new gn(m,E,C),this.elt[1]=new gn(m,E,C)}else if(arguments.length===4){var U=arguments[0],Z=arguments[1],pt=arguments[2],gt=arguments[3];this.elt[0]=new gn(V.NONE,V.NONE,V.NONE),this.elt[1]=new gn(V.NONE,V.NONE,V.NONE),this.elt[U].setLocations(Z,pt,gt)}};fn.prototype.getGeometryCount=function(){var n=0;return this.elt[0].isNull()||n++,this.elt[1].isNull()||n++,n},fn.prototype.setAllLocations=function(n,i){this.elt[n].setAllLocations(i)},fn.prototype.isNull=function(n){return this.elt[n].isNull()},fn.prototype.setAllLocationsIfNull=function(){if(arguments.length===1){var n=arguments[0];this.setAllLocationsIfNull(0,n),this.setAllLocationsIfNull(1,n)}else if(arguments.length===2){var i=arguments[0],s=arguments[1];this.elt[i].setAllLocationsIfNull(s)}},fn.prototype.isLine=function(n){return this.elt[n].isLine()},fn.prototype.merge=function(n){for(var i=0;i<2;i++)this.elt[i]===null&&n.elt[i]!==null?this.elt[i]=new gn(n.elt[i]):this.elt[i].merge(n.elt[i])},fn.prototype.flip=function(){this.elt[0].flip(),this.elt[1].flip()},fn.prototype.getLocation=function(){if(arguments.length===1){var n=arguments[0];return this.elt[n].get(It.ON)}if(arguments.length===2){var i=arguments[0],s=arguments[1];return this.elt[i].get(s)}},fn.prototype.toString=function(){var n=new _t;return this.elt[0]!==null&&(n.append("A:"),n.append(this.elt[0].toString())),this.elt[1]!==null&&(n.append(" B:"),n.append(this.elt[1].toString())),n.toString()},fn.prototype.isArea=function(){if(arguments.length===0)return this.elt[0].isArea()||this.elt[1].isArea();if(arguments.length===1){var n=arguments[0];return this.elt[n].isArea()}},fn.prototype.isAnyNull=function(n){return this.elt[n].isAnyNull()},fn.prototype.setLocation=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];this.elt[n].setLocation(It.ON,i)}else if(arguments.length===3){var s=arguments[0],u=arguments[1],c=arguments[2];this.elt[s].setLocation(u,c)}},fn.prototype.isEqualOnSide=function(n,i){return this.elt[0].isEqualOnSide(n.elt[0],i)&&this.elt[1].isEqualOnSide(n.elt[1],i)},fn.prototype.allPositionsEqual=function(n,i){return this.elt[n].allPositionsEqual(i)},fn.prototype.toLine=function(n){this.elt[n].isArea()&&(this.elt[n]=new gn(this.elt[n].location[0]))},fn.prototype.interfaces_=function(){return[]},fn.prototype.getClass=function(){return fn},fn.toLineLabel=function(n){for(var i=new fn(V.NONE),s=0;s<2;s++)i.setLocation(s,n.getLocation(s));return i};var zn=function(){this._startDe=null,this._maxNodeDegree=-1,this._edges=new O,this._pts=new O,this._label=new fn(V.NONE),this._ring=null,this._isHole=null,this._shell=null,this._holes=new O,this._geometryFactory=null;var n=arguments[0],i=arguments[1];this._geometryFactory=i,this.computePoints(n),this.computeRing()};zn.prototype.computeRing=function(){if(this._ring!==null)return null;for(var n=new Array(this._pts.size()).fill(null),i=0;i<this._pts.size();i++)n[i]=this._pts.get(i);this._ring=this._geometryFactory.createLinearRing(n),this._isHole=ot.isCCW(this._ring.getCoordinates())},zn.prototype.isIsolated=function(){return this._label.getGeometryCount()===1},zn.prototype.computePoints=function(n){this._startDe=n;var i=n,s=!0;do{if(i===null)throw new xo("Found null DirectedEdge");if(i.getEdgeRing()===this)throw new xo("Directed Edge visited twice during ring-building at "+i.getCoordinate());this._edges.add(i);var u=i.getLabel();Lt.isTrue(u.isArea()),this.mergeLabel(u),this.addPoints(i.getEdge(),i.isForward(),s),s=!1,this.setEdgeRing(i,this),i=this.getNext(i)}while(i!==this._startDe)},zn.prototype.getLinearRing=function(){return this._ring},zn.prototype.getCoordinate=function(n){return this._pts.get(n)},zn.prototype.computeMaxNodeDegree=function(){this._maxNodeDegree=0;var n=this._startDe;do{var i=n.getNode().getEdges().getOutgoingDegree(this);i>this._maxNodeDegree&&(this._maxNodeDegree=i),n=this.getNext(n)}while(n!==this._startDe);this._maxNodeDegree*=2},zn.prototype.addPoints=function(n,i,s){var u=n.getCoordinates();if(i){var c=1;s&&(c=0);for(var m=c;m<u.length;m++)this._pts.add(u[m])}else{var E=u.length-2;s&&(E=u.length-1);for(var C=E;C>=0;C--)this._pts.add(u[C])}},zn.prototype.isHole=function(){return this._isHole},zn.prototype.setInResult=function(){var n=this._startDe;do n.getEdge().setInResult(!0),n=n.getNext();while(n!==this._startDe)},zn.prototype.containsPoint=function(n){var i=this.getLinearRing();if(!i.getEnvelopeInternal().contains(n)||!ot.isPointInRing(n,i.getCoordinates()))return!1;for(var s=this._holes.iterator();s.hasNext();)if(s.next().containsPoint(n))return!1;return!0},zn.prototype.addHole=function(n){this._holes.add(n)},zn.prototype.isShell=function(){return this._shell===null},zn.prototype.getLabel=function(){return this._label},zn.prototype.getEdges=function(){return this._edges},zn.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree},zn.prototype.getShell=function(){return this._shell},zn.prototype.mergeLabel=function(){if(arguments.length===1){var n=arguments[0];this.mergeLabel(n,0),this.mergeLabel(n,1)}else if(arguments.length===2){var i=arguments[0],s=arguments[1],u=i.getLocation(s,It.RIGHT);if(u===V.NONE)return null;if(this._label.getLocation(s)===V.NONE)return this._label.setLocation(s,u),null}},zn.prototype.setShell=function(n){this._shell=n,n!==null&&n.addHole(this)},zn.prototype.toPolygon=function(n){for(var i=new Array(this._holes.size()).fill(null),s=0;s<this._holes.size();s++)i[s]=this._holes.get(s).getLinearRing();return n.createPolygon(this.getLinearRing(),i)},zn.prototype.interfaces_=function(){return[]},zn.prototype.getClass=function(){return zn};var JA=function(n){function i(){var s=arguments[0],u=arguments[1];n.call(this,s,u)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.setEdgeRing=function(s,u){s.setMinEdgeRing(u)},i.prototype.getNext=function(s){return s.getNextMin()},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(zn),KA=function(n){function i(){var s=arguments[0],u=arguments[1];n.call(this,s,u)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.buildMinimalRings=function(){var s=new O,u=this._startDe;do{if(u.getMinEdgeRing()===null){var c=new JA(u,this._geometryFactory);s.add(c)}u=u.getNext()}while(u!==this._startDe);return s},i.prototype.setEdgeRing=function(s,u){s.setEdgeRing(u)},i.prototype.linkDirectedEdgesForMinimalEdgeRings=function(){var s=this._startDe;do s.getNode().getEdges().linkMinimalDirectedEdges(this),s=s.getNext();while(s!==this._startDe)},i.prototype.getNext=function(s){return s.getNext()},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(zn),ri=function(){if(this._label=null,this._isInResult=!1,this._isCovered=!1,this._isCoveredSet=!1,this._isVisited=!1,arguments.length!==0){if(arguments.length===1){var n=arguments[0];this._label=n}}};ri.prototype.setVisited=function(n){this._isVisited=n},ri.prototype.setInResult=function(n){this._isInResult=n},ri.prototype.isCovered=function(){return this._isCovered},ri.prototype.isCoveredSet=function(){return this._isCoveredSet},ri.prototype.setLabel=function(n){this._label=n},ri.prototype.getLabel=function(){return this._label},ri.prototype.setCovered=function(n){this._isCovered=n,this._isCoveredSet=!0},ri.prototype.updateIM=function(n){Lt.isTrue(this._label.getGeometryCount()>=2,"found partial label"),this.computeIM(n)},ri.prototype.isInResult=function(){return this._isInResult},ri.prototype.isVisited=function(){return this._isVisited},ri.prototype.interfaces_=function(){return[]},ri.prototype.getClass=function(){return ri};var hc=function(n){function i(){n.call(this),this._coord=null,this._edges=null;var s=arguments[0],u=arguments[1];this._coord=s,this._edges=u,this._label=new fn(0,V.NONE)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.isIncidentEdgeInResult=function(){for(var s=this.getEdges().getEdges().iterator();s.hasNext();)if(s.next().getEdge().isInResult())return!0;return!1},i.prototype.isIsolated=function(){return this._label.getGeometryCount()===1},i.prototype.getCoordinate=function(){return this._coord},i.prototype.print=function(s){s.println("node "+this._coord+" lbl: "+this._label)},i.prototype.computeIM=function(s){},i.prototype.computeMergedLocation=function(s,u){var c=V.NONE;if(c=this._label.getLocation(u),!s.isNull(u)){var m=s.getLocation(u);c!==V.BOUNDARY&&(c=m)}return c},i.prototype.setLabel=function(){if(arguments.length!==2)return n.prototype.setLabel.apply(this,arguments);var s=arguments[0],u=arguments[1];this._label===null?this._label=new fn(s,u):this._label.setLocation(s,u)},i.prototype.getEdges=function(){return this._edges},i.prototype.mergeLabel=function(){if(arguments[0]instanceof i){var s=arguments[0];this.mergeLabel(s._label)}else if(arguments[0]instanceof fn)for(var u=arguments[0],c=0;c<2;c++){var m=this.computeMergedLocation(u,c);this._label.getLocation(c)===V.NONE&&this._label.setLocation(c,m)}},i.prototype.add=function(s){this._edges.insert(s),s.setNode(this)},i.prototype.setLabelBoundary=function(s){if(this._label===null)return null;var u=V.NONE;this._label!==null&&(u=this._label.getLocation(s));var c=null;switch(u){case V.BOUNDARY:c=V.INTERIOR;break;case V.INTERIOR:default:c=V.BOUNDARY}this._label.setLocation(s,c)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(ri),Fi=function(){this.nodeMap=new x,this.nodeFact=null;var n=arguments[0];this.nodeFact=n};Fi.prototype.find=function(n){return this.nodeMap.get(n)},Fi.prototype.addNode=function(){if(arguments[0]instanceof I){var n=arguments[0],i=this.nodeMap.get(n);return i===null&&(i=this.nodeFact.createNode(n),this.nodeMap.put(n,i)),i}if(arguments[0]instanceof hc){var s=arguments[0],u=this.nodeMap.get(s.getCoordinate());return u===null?(this.nodeMap.put(s.getCoordinate(),s),s):(u.mergeLabel(s),u)}},Fi.prototype.print=function(n){for(var i=this.iterator();i.hasNext();)i.next().print(n)},Fi.prototype.iterator=function(){return this.nodeMap.values().iterator()},Fi.prototype.values=function(){return this.nodeMap.values()},Fi.prototype.getBoundaryNodes=function(n){for(var i=new O,s=this.iterator();s.hasNext();){var u=s.next();u.getLabel().getLocation(n)===V.BOUNDARY&&i.add(u)}return i},Fi.prototype.add=function(n){var i=n.getCoordinate();this.addNode(i).add(n)},Fi.prototype.interfaces_=function(){return[]},Fi.prototype.getClass=function(){return Fi};var dn=function(){},el={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}};dn.prototype.interfaces_=function(){return[]},dn.prototype.getClass=function(){return dn},dn.isNorthern=function(n){return n===dn.NE||n===dn.NW},dn.isOpposite=function(n,i){return n===i?!1:(n-i+4)%4===2},dn.commonHalfPlane=function(n,i){if(n===i)return n;if((n-i+4)%4===2)return-1;var s=n<i?n:i;return s===0&&(n>i?n:i)===3?3:s},dn.isInHalfPlane=function(n,i){return i===dn.SE?n===dn.SE||n===dn.SW:n===i||n===i+1},dn.quadrant=function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var n=arguments[0],i=arguments[1];if(n===0&&i===0)throw new A("Cannot compute the quadrant for point ( "+n+", "+i+" )");return n>=0?i>=0?dn.NE:dn.SE:i>=0?dn.NW:dn.SW}if(arguments[0]instanceof I&&arguments[1]instanceof I){var s=arguments[0],u=arguments[1];if(u.x===s.x&&u.y===s.y)throw new A("Cannot compute the quadrant for two identical points "+s);return u.x>=s.x?u.y>=s.y?dn.NE:dn.SE:u.y>=s.y?dn.NW:dn.SW}},el.NE.get=function(){return 0},el.NW.get=function(){return 1},el.SW.get=function(){return 2},el.SE.get=function(){return 3},Object.defineProperties(dn,el);var ar=function(){if(this._edge=null,this._label=null,this._node=null,this._p0=null,this._p1=null,this._dx=null,this._dy=null,this._quadrant=null,arguments.length===1){var n=arguments[0];this._edge=n}else if(arguments.length===3){var i=arguments[0],s=arguments[1],u=arguments[2];this._edge=i,this.init(s,u),this._label=null}else if(arguments.length===4){var c=arguments[0],m=arguments[1],E=arguments[2],C=arguments[3];this._edge=c,this.init(m,E),this._label=C}};ar.prototype.compareDirection=function(n){return this._dx===n._dx&&this._dy===n._dy?0:this._quadrant>n._quadrant?1:this._quadrant<n._quadrant?-1:ot.computeOrientation(n._p0,n._p1,this._p1)},ar.prototype.getDy=function(){return this._dy},ar.prototype.getCoordinate=function(){return this._p0},ar.prototype.setNode=function(n){this._node=n},ar.prototype.print=function(n){var i=Math.atan2(this._dy,this._dx),s=this.getClass().getName(),u=s.lastIndexOf("."),c=s.substring(u+1);n.print(" "+c+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+i+" "+this._label)},ar.prototype.compareTo=function(n){var i=n;return this.compareDirection(i)},ar.prototype.getDirectedCoordinate=function(){return this._p1},ar.prototype.getDx=function(){return this._dx},ar.prototype.getLabel=function(){return this._label},ar.prototype.getEdge=function(){return this._edge},ar.prototype.getQuadrant=function(){return this._quadrant},ar.prototype.getNode=function(){return this._node},ar.prototype.toString=function(){var n=Math.atan2(this._dy,this._dx),i=this.getClass().getName(),s=i.lastIndexOf(".");return" "+i.substring(s+1)+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+n+" "+this._label},ar.prototype.computeLabel=function(n){},ar.prototype.init=function(n,i){this._p0=n,this._p1=i,this._dx=i.x-n.x,this._dy=i.y-n.y,this._quadrant=dn.quadrant(this._dx,this._dy),Lt.isTrue(!(this._dx===0&&this._dy===0),"EdgeEnd with identical endpoints found")},ar.prototype.interfaces_=function(){return[G]},ar.prototype.getClass=function(){return ar};var np=function(n){function i(){var s=arguments[0],u=arguments[1];if(n.call(this,s),this._isForward=null,this._isInResult=!1,this._isVisited=!1,this._sym=null,this._next=null,this._nextMin=null,this._edgeRing=null,this._minEdgeRing=null,this._depth=[0,-999,-999],this._isForward=u,u)this.init(s.getCoordinate(0),s.getCoordinate(1));else{var c=s.getNumPoints()-1;this.init(s.getCoordinate(c),s.getCoordinate(c-1))}this.computeDirectedLabel()}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.getNextMin=function(){return this._nextMin},i.prototype.getDepth=function(s){return this._depth[s]},i.prototype.setVisited=function(s){this._isVisited=s},i.prototype.computeDirectedLabel=function(){this._label=new fn(this._edge.getLabel()),this._isForward||this._label.flip()},i.prototype.getNext=function(){return this._next},i.prototype.setDepth=function(s,u){if(this._depth[s]!==-999&&this._depth[s]!==u)throw new xo("assigned depths do not match",this.getCoordinate());this._depth[s]=u},i.prototype.isInteriorAreaEdge=function(){for(var s=!0,u=0;u<2;u++)this._label.isArea(u)&&this._label.getLocation(u,It.LEFT)===V.INTERIOR&&this._label.getLocation(u,It.RIGHT)===V.INTERIOR||(s=!1);return s},i.prototype.setNextMin=function(s){this._nextMin=s},i.prototype.print=function(s){n.prototype.print.call(this,s),s.print(" "+this._depth[It.LEFT]+"/"+this._depth[It.RIGHT]),s.print(" ("+this.getDepthDelta()+")"),this._isInResult&&s.print(" inResult")},i.prototype.setMinEdgeRing=function(s){this._minEdgeRing=s},i.prototype.isLineEdge=function(){var s=this._label.isLine(0)||this._label.isLine(1),u=!this._label.isArea(0)||this._label.allPositionsEqual(0,V.EXTERIOR),c=!this._label.isArea(1)||this._label.allPositionsEqual(1,V.EXTERIOR);return s&&u&&c},i.prototype.setEdgeRing=function(s){this._edgeRing=s},i.prototype.getMinEdgeRing=function(){return this._minEdgeRing},i.prototype.getDepthDelta=function(){var s=this._edge.getDepthDelta();return this._isForward||(s=-s),s},i.prototype.setInResult=function(s){this._isInResult=s},i.prototype.getSym=function(){return this._sym},i.prototype.isForward=function(){return this._isForward},i.prototype.getEdge=function(){return this._edge},i.prototype.printEdge=function(s){this.print(s),s.print(" "),this._isForward?this._edge.print(s):this._edge.printReverse(s)},i.prototype.setSym=function(s){this._sym=s},i.prototype.setVisitedEdge=function(s){this.setVisited(s),this._sym.setVisited(s)},i.prototype.setEdgeDepths=function(s,u){var c=this.getEdge().getDepthDelta();this._isForward||(c=-c);var m=1;s===It.LEFT&&(m=-1);var E=It.opposite(s),C=u+c*m;this.setDepth(s,u),this.setDepth(E,C)},i.prototype.getEdgeRing=function(){return this._edgeRing},i.prototype.isInResult=function(){return this._isInResult},i.prototype.setNext=function(s){this._next=s},i.prototype.isVisited=function(){return this._isVisited},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i.depthFactor=function(s,u){return s===V.EXTERIOR&&u===V.INTERIOR?1:s===V.INTERIOR&&u===V.EXTERIOR?-1:0},i}(ar),Da=function(){};Da.prototype.createNode=function(n){return new hc(n,null)},Da.prototype.interfaces_=function(){return[]},Da.prototype.getClass=function(){return Da};var Rn=function(){if(this._edges=new O,this._nodes=null,this._edgeEndList=new O,arguments.length===0)this._nodes=new Fi(new Da);else if(arguments.length===1){var n=arguments[0];this._nodes=new Fi(n)}};Rn.prototype.printEdges=function(n){n.println("Edges:");for(var i=0;i<this._edges.size();i++){n.println("edge "+i+":");var s=this._edges.get(i);s.print(n),s.eiList.print(n)}},Rn.prototype.find=function(n){return this._nodes.find(n)},Rn.prototype.addNode=function(){if(arguments[0]instanceof hc){var n=arguments[0];return this._nodes.addNode(n)}if(arguments[0]instanceof I){var i=arguments[0];return this._nodes.addNode(i)}},Rn.prototype.getNodeIterator=function(){return this._nodes.iterator()},Rn.prototype.linkResultDirectedEdges=function(){for(var n=this._nodes.iterator();n.hasNext();)n.next().getEdges().linkResultDirectedEdges()},Rn.prototype.debugPrintln=function(n){Ut.out.println(n)},Rn.prototype.isBoundaryNode=function(n,i){var s=this._nodes.find(i);if(s===null)return!1;var u=s.getLabel();return u!==null&&u.getLocation(n)===V.BOUNDARY},Rn.prototype.linkAllDirectedEdges=function(){for(var n=this._nodes.iterator();n.hasNext();)n.next().getEdges().linkAllDirectedEdges()},Rn.prototype.matchInSameDirection=function(n,i,s,u){return!!n.equals(s)&&ot.computeOrientation(n,i,u)===ot.COLLINEAR&&dn.quadrant(n,i)===dn.quadrant(s,u)},Rn.prototype.getEdgeEnds=function(){return this._edgeEndList},Rn.prototype.debugPrint=function(n){Ut.out.print(n)},Rn.prototype.getEdgeIterator=function(){return this._edges.iterator()},Rn.prototype.findEdgeInSameDirection=function(n,i){for(var s=0;s<this._edges.size();s++){var u=this._edges.get(s),c=u.getCoordinates();if(this.matchInSameDirection(n,i,c[0],c[1])||this.matchInSameDirection(n,i,c[c.length-1],c[c.length-2]))return u}return null},Rn.prototype.insertEdge=function(n){this._edges.add(n)},Rn.prototype.findEdgeEnd=function(n){for(var i=this.getEdgeEnds().iterator();i.hasNext();){var s=i.next();if(s.getEdge()===n)return s}return null},Rn.prototype.addEdges=function(n){for(var i=n.iterator();i.hasNext();){var s=i.next();this._edges.add(s);var u=new np(s,!0),c=new np(s,!1);u.setSym(c),c.setSym(u),this.add(u),this.add(c)}},Rn.prototype.add=function(n){this._nodes.add(n),this._edgeEndList.add(n)},Rn.prototype.getNodes=function(){return this._nodes.values()},Rn.prototype.findEdge=function(n,i){for(var s=0;s<this._edges.size();s++){var u=this._edges.get(s),c=u.getCoordinates();if(n.equals(c[0])&&i.equals(c[1]))return u}return null},Rn.prototype.interfaces_=function(){return[]},Rn.prototype.getClass=function(){return Rn},Rn.linkResultDirectedEdges=function(n){for(var i=n.iterator();i.hasNext();)i.next().getEdges().linkResultDirectedEdges()};var Wr=function(){this._geometryFactory=null,this._shellList=new O;var n=arguments[0];this._geometryFactory=n};Wr.prototype.sortShellsAndHoles=function(n,i,s){for(var u=n.iterator();u.hasNext();){var c=u.next();c.isHole()?s.add(c):i.add(c)}},Wr.prototype.computePolygons=function(n){for(var i=new O,s=n.iterator();s.hasNext();){var u=s.next().toPolygon(this._geometryFactory);i.add(u)}return i},Wr.prototype.placeFreeHoles=function(n,i){for(var s=i.iterator();s.hasNext();){var u=s.next();if(u.getShell()===null){var c=this.findEdgeRingContaining(u,n);if(c===null)throw new xo("unable to assign hole to a shell",u.getCoordinate(0));u.setShell(c)}}},Wr.prototype.buildMinimalEdgeRings=function(n,i,s){for(var u=new O,c=n.iterator();c.hasNext();){var m=c.next();if(m.getMaxNodeDegree()>2){m.linkDirectedEdgesForMinimalEdgeRings();var E=m.buildMinimalRings(),C=this.findShell(E);C!==null?(this.placePolygonHoles(C,E),i.add(C)):s.addAll(E)}else u.add(m)}return u},Wr.prototype.containsPoint=function(n){for(var i=this._shellList.iterator();i.hasNext();)if(i.next().containsPoint(n))return!0;return!1},Wr.prototype.buildMaximalEdgeRings=function(n){for(var i=new O,s=n.iterator();s.hasNext();){var u=s.next();if(u.isInResult()&&u.getLabel().isArea()&&u.getEdgeRing()===null){var c=new KA(u,this._geometryFactory);i.add(c),c.setInResult()}}return i},Wr.prototype.placePolygonHoles=function(n,i){for(var s=i.iterator();s.hasNext();){var u=s.next();u.isHole()&&u.setShell(n)}},Wr.prototype.getPolygons=function(){return this.computePolygons(this._shellList)},Wr.prototype.findEdgeRingContaining=function(n,i){for(var s=n.getLinearRing(),u=s.getEnvelopeInternal(),c=s.getCoordinateN(0),m=null,E=null,C=i.iterator();C.hasNext();){var U=C.next(),Z=U.getLinearRing(),pt=Z.getEnvelopeInternal();m!==null&&(E=m.getLinearRing().getEnvelopeInternal());var gt=!1;pt.contains(u)&&ot.isPointInRing(c,Z.getCoordinates())&&(gt=!0),gt&&(m===null||E.contains(pt))&&(m=U)}return m},Wr.prototype.findShell=function(n){for(var i=0,s=null,u=n.iterator();u.hasNext();){var c=u.next();c.isHole()||(s=c,i++)}return Lt.isTrue(i<=1,"found two shells in MinimalEdgeRing list"),s},Wr.prototype.add=function(){if(arguments.length===1){var n=arguments[0];this.add(n.getEdgeEnds(),n.getNodes())}else if(arguments.length===2){var i=arguments[0],s=arguments[1];Rn.linkResultDirectedEdges(s);var u=this.buildMaximalEdgeRings(i),c=new O,m=this.buildMinimalEdgeRings(u,this._shellList,c);this.sortShellsAndHoles(m,this._shellList,c),this.placeFreeHoles(this._shellList,c)}},Wr.prototype.interfaces_=function(){return[]},Wr.prototype.getClass=function(){return Wr};var Fa=function(){};Fa.prototype.getBounds=function(){},Fa.prototype.interfaces_=function(){return[]},Fa.prototype.getClass=function(){return Fa};var bi=function(){this._bounds=null,this._item=null;var n=arguments[0],i=arguments[1];this._bounds=n,this._item=i};bi.prototype.getItem=function(){return this._item},bi.prototype.getBounds=function(){return this._bounds},bi.prototype.interfaces_=function(){return[Fa,t]},bi.prototype.getClass=function(){return bi};var Eo=function(){this._size=null,this._items=null,this._size=0,this._items=new O,this._items.add(null)};Eo.prototype.poll=function(){if(this.isEmpty())return null;var n=this._items.get(1);return this._items.set(1,this._items.get(this._size)),this._size-=1,this.reorder(1),n},Eo.prototype.size=function(){return this._size},Eo.prototype.reorder=function(n){for(var i=null,s=this._items.get(n);2*n<=this._size&&((i=2*n)!==this._size&&this._items.get(i+1).compareTo(this._items.get(i))<0&&i++,this._items.get(i).compareTo(s)<0);n=i)this._items.set(n,this._items.get(i));this._items.set(n,s)},Eo.prototype.clear=function(){this._size=0,this._items.clear()},Eo.prototype.isEmpty=function(){return this._size===0},Eo.prototype.add=function(n){this._items.add(null),this._size+=1;var i=this._size;for(this._items.set(0,n);n.compareTo(this._items.get(Math.trunc(i/2)))<0;i/=2)this._items.set(i,this._items.get(Math.trunc(i/2)));this._items.set(i,n)},Eo.prototype.interfaces_=function(){return[]},Eo.prototype.getClass=function(){return Eo};var Bo=function(){};Bo.prototype.visitItem=function(n){},Bo.prototype.interfaces_=function(){return[]},Bo.prototype.getClass=function(){return Bo};var $s=function(){};$s.prototype.insert=function(n,i){},$s.prototype.remove=function(n,i){},$s.prototype.query=function(){},$s.prototype.interfaces_=function(){return[]},$s.prototype.getClass=function(){return $s};var Wn=function(){if(this._childBoundables=new O,this._bounds=null,this._level=null,arguments.length!==0){if(arguments.length===1){var n=arguments[0];this._level=n}}},ny={serialVersionUID:{configurable:!0}};Wn.prototype.getLevel=function(){return this._level},Wn.prototype.size=function(){return this._childBoundables.size()},Wn.prototype.getChildBoundables=function(){return this._childBoundables},Wn.prototype.addChildBoundable=function(n){Lt.isTrue(this._bounds===null),this._childBoundables.add(n)},Wn.prototype.isEmpty=function(){return this._childBoundables.isEmpty()},Wn.prototype.getBounds=function(){return this._bounds===null&&(this._bounds=this.computeBounds()),this._bounds},Wn.prototype.interfaces_=function(){return[Fa,t]},Wn.prototype.getClass=function(){return Wn},ny.serialVersionUID.get=function(){return 6493722185909574e3},Object.defineProperties(Wn,ny);var Ti=function(){};Ti.reverseOrder=function(){return{compare:function(n,i){return i.compareTo(n)}}},Ti.min=function(n){return Ti.sort(n),n.get(0)},Ti.sort=function(n,i){var s=n.toArray();i?_n.sort(s,i):_n.sort(s);for(var u=n.iterator(),c=0,m=s.length;c<m;c++)u.next(),u.set(s[c])},Ti.singletonList=function(n){var i=new O;return i.add(n),i};var Gn=function(){this._boundable1=null,this._boundable2=null,this._distance=null,this._itemDistance=null;var n=arguments[0],i=arguments[1],s=arguments[2];this._boundable1=n,this._boundable2=i,this._itemDistance=s,this._distance=this.distance()};Gn.prototype.expandToQueue=function(n,i){var s=Gn.isComposite(this._boundable1),u=Gn.isComposite(this._boundable2);if(s&&u)return Gn.area(this._boundable1)>Gn.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,n,i),null):(this.expand(this._boundable2,this._boundable1,n,i),null);if(s)return this.expand(this._boundable1,this._boundable2,n,i),null;if(u)return this.expand(this._boundable2,this._boundable1,n,i),null;throw new A("neither boundable is composite")},Gn.prototype.isLeaves=function(){return!(Gn.isComposite(this._boundable1)||Gn.isComposite(this._boundable2))},Gn.prototype.compareTo=function(n){var i=n;return this._distance<i._distance?-1:this._distance>i._distance?1:0},Gn.prototype.expand=function(n,i,s,u){for(var c=n.getChildBoundables().iterator();c.hasNext();){var m=c.next(),E=new Gn(m,i,this._itemDistance);E.getDistance()<u&&s.add(E)}},Gn.prototype.getBoundable=function(n){return n===0?this._boundable1:this._boundable2},Gn.prototype.getDistance=function(){return this._distance},Gn.prototype.distance=function(){return this.isLeaves()?this._itemDistance.distance(this._boundable1,this._boundable2):this._boundable1.getBounds().distance(this._boundable2.getBounds())},Gn.prototype.interfaces_=function(){return[G]},Gn.prototype.getClass=function(){return Gn},Gn.area=function(n){return n.getBounds().getArea()},Gn.isComposite=function(n){return n instanceof Wn};var Jn=function n(){if(this._root=null,this._built=!1,this._itemBoundables=new O,this._nodeCapacity=null,arguments.length===0){var i=n.DEFAULT_NODE_CAPACITY;this._nodeCapacity=i}else if(arguments.length===1){var s=arguments[0];Lt.isTrue(s>1,"Node capacity must be greater than 1"),this._nodeCapacity=s}},pc={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};Jn.prototype.getNodeCapacity=function(){return this._nodeCapacity},Jn.prototype.lastNode=function(n){return n.get(n.size()-1)},Jn.prototype.size=function(){if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.size(this._root));if(arguments.length===1){for(var n=0,i=arguments[0].getChildBoundables().iterator();i.hasNext();){var s=i.next();s instanceof Wn?n+=this.size(s):s instanceof bi&&(n+=1)}return n}},Jn.prototype.removeItem=function(n,i){for(var s=null,u=n.getChildBoundables().iterator();u.hasNext();){var c=u.next();c instanceof bi&&c.getItem()===i&&(s=c)}return s!==null&&(n.getChildBoundables().remove(s),!0)},Jn.prototype.itemsTree=function(){if(arguments.length===0){this.build();var n=this.itemsTree(this._root);return n===null?new O:n}if(arguments.length===1){for(var i=arguments[0],s=new O,u=i.getChildBoundables().iterator();u.hasNext();){var c=u.next();if(c instanceof Wn){var m=this.itemsTree(c);m!==null&&s.add(m)}else c instanceof bi?s.add(c.getItem()):Lt.shouldNeverReachHere()}return s.size()<=0?null:s}},Jn.prototype.insert=function(n,i){Lt.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new bi(n,i))},Jn.prototype.boundablesAtLevel=function(){if(arguments.length===1){var n=arguments[0],i=new O;return this.boundablesAtLevel(n,this._root,i),i}if(arguments.length===3){var s=arguments[0],u=arguments[1],c=arguments[2];if(Lt.isTrue(s>-2),u.getLevel()===s)return c.add(u),null;for(var m=u.getChildBoundables().iterator();m.hasNext();){var E=m.next();E instanceof Wn?this.boundablesAtLevel(s,E,c):(Lt.isTrue(E instanceof bi),s===-1&&c.add(E))}return null}},Jn.prototype.query=function(){if(arguments.length===1){var n=arguments[0];this.build();var i=new O;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),n)&&this.query(n,this._root,i),i}if(arguments.length===2){var s=arguments[0],u=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),s)&&this.query(s,this._root,u)}else if(arguments.length===3){if(X(arguments[2],Bo)&&arguments[0]instanceof Object&&arguments[1]instanceof Wn)for(var c=arguments[0],m=arguments[1],E=arguments[2],C=m.getChildBoundables(),U=0;U<C.size();U++){var Z=C.get(U);this.getIntersectsOp().intersects(Z.getBounds(),c)&&(Z instanceof Wn?this.query(c,Z,E):Z instanceof bi?E.visitItem(Z.getItem()):Lt.shouldNeverReachHere())}else if(X(arguments[2],ct)&&arguments[0]instanceof Object&&arguments[1]instanceof Wn)for(var pt=arguments[0],gt=arguments[1],Rt=arguments[2],Ft=gt.getChildBoundables(),Vt=0;Vt<Ft.size();Vt++){var ee=Ft.get(Vt);this.getIntersectsOp().intersects(ee.getBounds(),pt)&&(ee instanceof Wn?this.query(pt,ee,Rt):ee instanceof bi?Rt.add(ee.getItem()):Lt.shouldNeverReachHere())}}},Jn.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},Jn.prototype.getRoot=function(){return this.build(),this._root},Jn.prototype.remove=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];return this.build(),!!this.getIntersectsOp().intersects(this._root.getBounds(),n)&&this.remove(n,this._root,i)}if(arguments.length===3){var s=arguments[0],u=arguments[1],c=arguments[2],m=this.removeItem(u,c);if(m)return!0;for(var E=null,C=u.getChildBoundables().iterator();C.hasNext();){var U=C.next();if(this.getIntersectsOp().intersects(U.getBounds(),s)&&U instanceof Wn&&(m=this.remove(s,U,c))){E=U;break}}return E!==null&&E.getChildBoundables().isEmpty()&&u.getChildBoundables().remove(E),m}},Jn.prototype.createHigherLevels=function(n,i){Lt.isTrue(!n.isEmpty());var s=this.createParentBoundables(n,i+1);return s.size()===1?s.get(0):this.createHigherLevels(s,i+1)},Jn.prototype.depth=function(){if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.depth(this._root));if(arguments.length===1){for(var n=0,i=arguments[0].getChildBoundables().iterator();i.hasNext();){var s=i.next();if(s instanceof Wn){var u=this.depth(s);u>n&&(n=u)}}return n+1}},Jn.prototype.createParentBoundables=function(n,i){Lt.isTrue(!n.isEmpty());var s=new O;s.add(this.createNode(i));var u=new O(n);Ti.sort(u,this.getComparator());for(var c=u.iterator();c.hasNext();){var m=c.next();this.lastNode(s).getChildBoundables().size()===this.getNodeCapacity()&&s.add(this.createNode(i)),this.lastNode(s).addChildBoundable(m)}return s},Jn.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()},Jn.prototype.interfaces_=function(){return[t]},Jn.prototype.getClass=function(){return Jn},Jn.compareDoubles=function(n,i){return n>i?1:n<i?-1:0},pc.IntersectsOp.get=function(){return jA},pc.serialVersionUID.get=function(){return-3886435814360241e3},pc.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(Jn,pc);var jA=function(){},Ua=function(){};Ua.prototype.distance=function(n,i){},Ua.prototype.interfaces_=function(){return[]},Ua.prototype.getClass=function(){return Ua};var ry=function(n){function i(u){u=u||i.DEFAULT_NODE_CAPACITY,n.call(this,u)}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={STRtreeNode:{configurable:!0},serialVersionUID:{configurable:!0},xComparator:{configurable:!0},yComparator:{configurable:!0},intersectsOp:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};return i.prototype.createParentBoundablesFromVerticalSlices=function(u,c){Lt.isTrue(u.length>0);for(var m=new O,E=0;E<u.length;E++)m.addAll(this.createParentBoundablesFromVerticalSlice(u[E],c));return m},i.prototype.createNode=function(u){return new iy(u)},i.prototype.size=function(){return arguments.length===0?n.prototype.size.call(this):n.prototype.size.apply(this,arguments)},i.prototype.insert=function(){if(arguments.length!==2)return n.prototype.insert.apply(this,arguments);var u=arguments[0],c=arguments[1];if(u.isNull())return null;n.prototype.insert.call(this,u,c)},i.prototype.getIntersectsOp=function(){return i.intersectsOp},i.prototype.verticalSlices=function(u,c){for(var m=Math.trunc(Math.ceil(u.size()/c)),E=new Array(c).fill(null),C=u.iterator(),U=0;U<c;U++){E[U]=new O;for(var Z=0;C.hasNext()&&Z<m;){var pt=C.next();E[U].add(pt),Z++}}return E},i.prototype.query=function(){if(arguments.length===1){var u=arguments[0];return n.prototype.query.call(this,u)}if(arguments.length===2){var c=arguments[0],m=arguments[1];n.prototype.query.call(this,c,m)}else if(arguments.length===3){if(X(arguments[2],Bo)&&arguments[0]instanceof Object&&arguments[1]instanceof Wn){var E=arguments[0],C=arguments[1],U=arguments[2];n.prototype.query.call(this,E,C,U)}else if(X(arguments[2],ct)&&arguments[0]instanceof Object&&arguments[1]instanceof Wn){var Z=arguments[0],pt=arguments[1],gt=arguments[2];n.prototype.query.call(this,Z,pt,gt)}}},i.prototype.getComparator=function(){return i.yComparator},i.prototype.createParentBoundablesFromVerticalSlice=function(u,c){return n.prototype.createParentBoundables.call(this,u,c)},i.prototype.remove=function(){if(arguments.length===2){var u=arguments[0],c=arguments[1];return n.prototype.remove.call(this,u,c)}return n.prototype.remove.apply(this,arguments)},i.prototype.depth=function(){return arguments.length===0?n.prototype.depth.call(this):n.prototype.depth.apply(this,arguments)},i.prototype.createParentBoundables=function(u,c){Lt.isTrue(!u.isEmpty());var m=Math.trunc(Math.ceil(u.size()/this.getNodeCapacity())),E=new O(u);Ti.sort(E,i.xComparator);var C=this.verticalSlices(E,Math.trunc(Math.ceil(Math.sqrt(m))));return this.createParentBoundablesFromVerticalSlices(C,c)},i.prototype.nearestNeighbour=function(){if(arguments.length===1){if(X(arguments[0],Ua)){var u=arguments[0],c=new Gn(this.getRoot(),this.getRoot(),u);return this.nearestNeighbour(c)}if(arguments[0]instanceof Gn){var m=arguments[0];return this.nearestNeighbour(m,S.POSITIVE_INFINITY)}}else if(arguments.length===2){if(arguments[0]instanceof i&&X(arguments[1],Ua)){var E=arguments[0],C=arguments[1],U=new Gn(this.getRoot(),E.getRoot(),C);return this.nearestNeighbour(U)}if(arguments[0]instanceof Gn&&typeof arguments[1]=="number"){var Z=arguments[0],pt=arguments[1],gt=null,Rt=new Eo;for(Rt.add(Z);!Rt.isEmpty()&&pt>0;){var Ft=Rt.poll(),Vt=Ft.getDistance();if(Vt>=pt)break;Ft.isLeaves()?(pt=Vt,gt=Ft):Ft.expandToQueue(Rt,pt)}return[gt.getBoundable(0).getItem(),gt.getBoundable(1).getItem()]}}else if(arguments.length===3){var ee=arguments[0],hn=arguments[1],qn=arguments[2],Tr=new bi(ee,hn),no=new Gn(this.getRoot(),Tr,qn);return this.nearestNeighbour(no)[0]}},i.prototype.interfaces_=function(){return[$s,t]},i.prototype.getClass=function(){return i},i.centreX=function(u){return i.avg(u.getMinX(),u.getMaxX())},i.avg=function(u,c){return(u+c)/2},i.centreY=function(u){return i.avg(u.getMinY(),u.getMaxY())},s.STRtreeNode.get=function(){return iy},s.serialVersionUID.get=function(){return 0x39920f7d5f261e0},s.xComparator.get=function(){return{interfaces_:function(){return[F]},compare:function(u,c){return n.compareDoubles(i.centreX(u.getBounds()),i.centreX(c.getBounds()))}}},s.yComparator.get=function(){return{interfaces_:function(){return[F]},compare:function(u,c){return n.compareDoubles(i.centreY(u.getBounds()),i.centreY(c.getBounds()))}}},s.intersectsOp.get=function(){return{interfaces_:function(){return[n.IntersectsOp]},intersects:function(u,c){return u.intersects(c)}}},s.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(i,s),i}(Jn),iy=function(n){function i(){var s=arguments[0];n.call(this,s)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.computeBounds=function(){for(var s=null,u=this.getChildBoundables().iterator();u.hasNext();){var c=u.next();s===null?s=new At(c.getBounds()):s.expandToInclude(c.getBounds())}return s},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(Wn),Nr=function(){};Nr.prototype.interfaces_=function(){return[]},Nr.prototype.getClass=function(){return Nr},Nr.relativeSign=function(n,i){return n<i?-1:n>i?1:0},Nr.compare=function(n,i,s){if(i.equals2D(s))return 0;var u=Nr.relativeSign(i.x,s.x),c=Nr.relativeSign(i.y,s.y);switch(n){case 0:return Nr.compareValue(u,c);case 1:return Nr.compareValue(c,u);case 2:return Nr.compareValue(c,-u);case 3:return Nr.compareValue(-u,c);case 4:return Nr.compareValue(-u,-c);case 5:return Nr.compareValue(-c,-u);case 6:return Nr.compareValue(-c,u);case 7:return Nr.compareValue(u,-c)}return Lt.shouldNeverReachHere("invalid octant value"),0},Nr.compareValue=function(n,i){return n<0?-1:n>0?1:i<0?-1:i>0?1:0};var zo=function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var n=arguments[0],i=arguments[1],s=arguments[2],u=arguments[3];this._segString=n,this.coord=new I(i),this.segmentIndex=s,this._segmentOctant=u,this._isInterior=!i.equals2D(n.getCoordinate(s))};zo.prototype.getCoordinate=function(){return this.coord},zo.prototype.print=function(n){n.print(this.coord),n.print(" seg # = "+this.segmentIndex)},zo.prototype.compareTo=function(n){var i=n;return this.segmentIndex<i.segmentIndex?-1:this.segmentIndex>i.segmentIndex?1:this.coord.equals2D(i.coord)?0:Nr.compare(this._segmentOctant,this.coord,i.coord)},zo.prototype.isEndPoint=function(n){return this.segmentIndex===0&&!this._isInterior||this.segmentIndex===n},zo.prototype.isInterior=function(){return this._isInterior},zo.prototype.interfaces_=function(){return[G]},zo.prototype.getClass=function(){return zo};var xr=function(){this._nodeMap=new x,this._edge=null;var n=arguments[0];this._edge=n};xr.prototype.getSplitCoordinates=function(){var n=new $;this.addEndpoints();for(var i=this.iterator(),s=i.next();i.hasNext();){var u=i.next();this.addEdgeCoordinates(s,u,n),s=u}return n.toCoordinateArray()},xr.prototype.addCollapsedNodes=function(){var n=new O;this.findCollapsesFromInsertedNodes(n),this.findCollapsesFromExistingVertices(n);for(var i=n.iterator();i.hasNext();){var s=i.next().intValue();this.add(this._edge.getCoordinate(s),s)}},xr.prototype.print=function(n){n.println("Intersections:");for(var i=this.iterator();i.hasNext();)i.next().print(n)},xr.prototype.findCollapsesFromExistingVertices=function(n){for(var i=0;i<this._edge.size()-2;i++){var s=this._edge.getCoordinate(i),u=this._edge.getCoordinate(i+2);s.equals2D(u)&&n.add(new it(i+1))}},xr.prototype.addEdgeCoordinates=function(n,i,s){var u=this._edge.getCoordinate(i.segmentIndex),c=i.isInterior()||!i.coord.equals2D(u);s.add(new I(n.coord),!1);for(var m=n.segmentIndex+1;m<=i.segmentIndex;m++)s.add(this._edge.getCoordinate(m));c&&s.add(new I(i.coord))},xr.prototype.iterator=function(){return this._nodeMap.values().iterator()},xr.prototype.addSplitEdges=function(n){this.addEndpoints(),this.addCollapsedNodes();for(var i=this.iterator(),s=i.next();i.hasNext();){var u=i.next(),c=this.createSplitEdge(s,u);n.add(c),s=u}},xr.prototype.findCollapseIndex=function(n,i,s){if(!n.coord.equals2D(i.coord))return!1;var u=i.segmentIndex-n.segmentIndex;return i.isInterior()||u--,u===1&&(s[0]=n.segmentIndex+1,!0)},xr.prototype.findCollapsesFromInsertedNodes=function(n){for(var i=new Array(1).fill(null),s=this.iterator(),u=s.next();s.hasNext();){var c=s.next();this.findCollapseIndex(u,c,i)&&n.add(new it(i[0])),u=c}},xr.prototype.getEdge=function(){return this._edge},xr.prototype.addEndpoints=function(){var n=this._edge.size()-1;this.add(this._edge.getCoordinate(0),0),this.add(this._edge.getCoordinate(n),n)},xr.prototype.createSplitEdge=function(n,i){var s=i.segmentIndex-n.segmentIndex+2,u=this._edge.getCoordinate(i.segmentIndex),c=i.isInterior()||!i.coord.equals2D(u);c||s--;var m=new Array(s).fill(null),E=0;m[E++]=new I(n.coord);for(var C=n.segmentIndex+1;C<=i.segmentIndex;C++)m[E++]=this._edge.getCoordinate(C);return c&&(m[E]=new I(i.coord)),new Dn(m,this._edge.getData())},xr.prototype.add=function(n,i){var s=new zo(this._edge,n,i,this._edge.getSegmentOctant(i)),u=this._nodeMap.get(s);return u!==null?(Lt.isTrue(u.coord.equals2D(n),"Found equal nodes with different coordinates"),u):(this._nodeMap.put(s,s),s)},xr.prototype.checkSplitEdgesCorrectness=function(n){var i=this._edge.getCoordinates(),s=n.get(0).getCoordinate(0);if(!s.equals2D(i[0]))throw new ie("bad split edge start point at "+s);var u=n.get(n.size()-1).getCoordinates(),c=u[u.length-1];if(!c.equals2D(i[i.length-1]))throw new ie("bad split edge end point at "+c)},xr.prototype.interfaces_=function(){return[]},xr.prototype.getClass=function(){return xr};var Zs=function(){};Zs.prototype.interfaces_=function(){return[]},Zs.prototype.getClass=function(){return Zs},Zs.octant=function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var n=arguments[0],i=arguments[1];if(n===0&&i===0)throw new A("Cannot compute the octant for point ( "+n+", "+i+" )");var s=Math.abs(n),u=Math.abs(i);return n>=0?i>=0?s>=u?0:1:s>=u?7:6:i>=0?s>=u?3:2:s>=u?4:5}if(arguments[0]instanceof I&&arguments[1]instanceof I){var c=arguments[0],m=arguments[1],E=m.x-c.x,C=m.y-c.y;if(E===0&&C===0)throw new A("Cannot compute the octant for two identical points "+c);return Zs.octant(E,C)}};var $i=function(){};$i.prototype.getCoordinates=function(){},$i.prototype.size=function(){},$i.prototype.getCoordinate=function(n){},$i.prototype.isClosed=function(){},$i.prototype.setData=function(n){},$i.prototype.getData=function(){},$i.prototype.interfaces_=function(){return[]},$i.prototype.getClass=function(){return $i};var nl=function(){};nl.prototype.addIntersection=function(n,i){},nl.prototype.interfaces_=function(){return[$i]},nl.prototype.getClass=function(){return nl};var Dn=function(){this._nodeList=new xr(this),this._pts=null,this._data=null;var n=arguments[0],i=arguments[1];this._pts=n,this._data=i};Dn.prototype.getCoordinates=function(){return this._pts},Dn.prototype.size=function(){return this._pts.length},Dn.prototype.getCoordinate=function(n){return this._pts[n]},Dn.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},Dn.prototype.getSegmentOctant=function(n){return n===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(n),this.getCoordinate(n+1))},Dn.prototype.setData=function(n){this._data=n},Dn.prototype.safeOctant=function(n,i){return n.equals2D(i)?0:Zs.octant(n,i)},Dn.prototype.getData=function(){return this._data},Dn.prototype.addIntersection=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];this.addIntersectionNode(n,i)}else if(arguments.length===4){var s=arguments[0],u=arguments[1],c=arguments[3],m=new I(s.getIntersection(c));this.addIntersection(m,u)}},Dn.prototype.toString=function(){return Wt.toLineString(new jt(this._pts))},Dn.prototype.getNodeList=function(){return this._nodeList},Dn.prototype.addIntersectionNode=function(n,i){var s=i,u=s+1;if(u<this._pts.length){var c=this._pts[u];n.equals2D(c)&&(s=u)}return this._nodeList.add(n,s)},Dn.prototype.addIntersections=function(n,i,s){for(var u=0;u<n.getIntersectionNum();u++)this.addIntersection(n,i,s,u)},Dn.prototype.interfaces_=function(){return[nl]},Dn.prototype.getClass=function(){return Dn},Dn.getNodedSubstrings=function(){if(arguments.length===1){var n=arguments[0],i=new O;return Dn.getNodedSubstrings(n,i),i}if(arguments.length===2)for(var s=arguments[0],u=arguments[1],c=s.iterator();c.hasNext();)c.next().getNodeList().addSplitEdges(u)};var Qt=function(){if(this.p0=null,this.p1=null,arguments.length===0)this.p0=new I,this.p1=new I;else if(arguments.length===1){var n=arguments[0];this.p0=new I(n.p0),this.p1=new I(n.p1)}else if(arguments.length===2)this.p0=arguments[0],this.p1=arguments[1];else if(arguments.length===4){var i=arguments[0],s=arguments[1],u=arguments[2],c=arguments[3];this.p0=new I(i,s),this.p1=new I(u,c)}},oy={serialVersionUID:{configurable:!0}};Qt.prototype.minX=function(){return Math.min(this.p0.x,this.p1.x)},Qt.prototype.orientationIndex=function(){if(arguments[0]instanceof Qt){var n=arguments[0],i=ot.orientationIndex(this.p0,this.p1,n.p0),s=ot.orientationIndex(this.p0,this.p1,n.p1);return i>=0&&s>=0||i<=0&&s<=0?Math.max(i,s):0}if(arguments[0]instanceof I){var u=arguments[0];return ot.orientationIndex(this.p0,this.p1,u)}},Qt.prototype.toGeometry=function(n){return n.createLineString([this.p0,this.p1])},Qt.prototype.isVertical=function(){return this.p0.x===this.p1.x},Qt.prototype.equals=function(n){if(!(n instanceof Qt))return!1;var i=n;return this.p0.equals(i.p0)&&this.p1.equals(i.p1)},Qt.prototype.intersection=function(n){var i=new N;return i.computeIntersection(this.p0,this.p1,n.p0,n.p1),i.hasIntersection()?i.getIntersection(0):null},Qt.prototype.project=function(){if(arguments[0]instanceof I){var n=arguments[0];if(n.equals(this.p0)||n.equals(this.p1))return new I(n);var i=this.projectionFactor(n),s=new I;return s.x=this.p0.x+i*(this.p1.x-this.p0.x),s.y=this.p0.y+i*(this.p1.y-this.p0.y),s}if(arguments[0]instanceof Qt){var u=arguments[0],c=this.projectionFactor(u.p0),m=this.projectionFactor(u.p1);if(c>=1&&m>=1||c<=0&&m<=0)return null;var E=this.project(u.p0);c<0&&(E=this.p0),c>1&&(E=this.p1);var C=this.project(u.p1);return m<0&&(C=this.p0),m>1&&(C=this.p1),new Qt(E,C)}},Qt.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()},Qt.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)},Qt.prototype.getCoordinate=function(n){return n===0?this.p0:this.p1},Qt.prototype.distancePerpendicular=function(n){return ot.distancePointLinePerpendicular(n,this.p0,this.p1)},Qt.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)},Qt.prototype.midPoint=function(){return Qt.midPoint(this.p0,this.p1)},Qt.prototype.projectionFactor=function(n){if(n.equals(this.p0))return 0;if(n.equals(this.p1))return 1;var i=this.p1.x-this.p0.x,s=this.p1.y-this.p0.y,u=i*i+s*s;return u<=0?S.NaN:((n.x-this.p0.x)*i+(n.y-this.p0.y)*s)/u},Qt.prototype.closestPoints=function(n){var i=this.intersection(n);if(i!==null)return[i,i];var s=new Array(2).fill(null),u=S.MAX_VALUE,c=null,m=this.closestPoint(n.p0);u=m.distance(n.p0),s[0]=m,s[1]=n.p0;var E=this.closestPoint(n.p1);(c=E.distance(n.p1))<u&&(u=c,s[0]=E,s[1]=n.p1);var C=n.closestPoint(this.p0);(c=C.distance(this.p0))<u&&(u=c,s[0]=this.p0,s[1]=C);var U=n.closestPoint(this.p1);return(c=U.distance(this.p1))<u&&(u=c,s[0]=this.p1,s[1]=U),s},Qt.prototype.closestPoint=function(n){var i=this.projectionFactor(n);return i>0&&i<1?this.project(n):this.p0.distance(n)<this.p1.distance(n)?this.p0:this.p1},Qt.prototype.maxX=function(){return Math.max(this.p0.x,this.p1.x)},Qt.prototype.getLength=function(){return this.p0.distance(this.p1)},Qt.prototype.compareTo=function(n){var i=n,s=this.p0.compareTo(i.p0);return s!==0?s:this.p1.compareTo(i.p1)},Qt.prototype.reverse=function(){var n=this.p0;this.p0=this.p1,this.p1=n},Qt.prototype.equalsTopo=function(n){return this.p0.equals(n.p0)&&(this.p1.equals(n.p1)||this.p0.equals(n.p1))&&this.p1.equals(n.p0)},Qt.prototype.lineIntersection=function(n){try{return Dt.intersection(this.p0,this.p1,n.p0,n.p1)}catch(i){if(!(i instanceof $t))throw i}return null},Qt.prototype.maxY=function(){return Math.max(this.p0.y,this.p1.y)},Qt.prototype.pointAlongOffset=function(n,i){var s=this.p0.x+n*(this.p1.x-this.p0.x),u=this.p0.y+n*(this.p1.y-this.p0.y),c=this.p1.x-this.p0.x,m=this.p1.y-this.p0.y,E=Math.sqrt(c*c+m*m),C=0,U=0;if(i!==0){if(E<=0)throw new Error("Cannot compute offset from zero-length line segment");C=i*c/E,U=i*m/E}return new I(s-U,u+C)},Qt.prototype.setCoordinates=function(){if(arguments.length===1){var n=arguments[0];this.setCoordinates(n.p0,n.p1)}else if(arguments.length===2){var i=arguments[0],s=arguments[1];this.p0.x=i.x,this.p0.y=i.y,this.p1.x=s.x,this.p1.y=s.y}},Qt.prototype.segmentFraction=function(n){var i=this.projectionFactor(n);return i<0?i=0:(i>1||S.isNaN(i))&&(i=1),i},Qt.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"},Qt.prototype.isHorizontal=function(){return this.p0.y===this.p1.y},Qt.prototype.distance=function(){if(arguments[0]instanceof Qt){var n=arguments[0];return ot.distanceLineLine(this.p0,this.p1,n.p0,n.p1)}if(arguments[0]instanceof I){var i=arguments[0];return ot.distancePointLine(i,this.p0,this.p1)}},Qt.prototype.pointAlong=function(n){var i=new I;return i.x=this.p0.x+n*(this.p1.x-this.p0.x),i.y=this.p0.y+n*(this.p1.y-this.p0.y),i},Qt.prototype.hashCode=function(){var n=S.doubleToLongBits(this.p0.x);n^=31*S.doubleToLongBits(this.p0.y);var i=Math.trunc(n)^Math.trunc(n>>32),s=S.doubleToLongBits(this.p1.x);return s^=31*S.doubleToLongBits(this.p1.y),i^(Math.trunc(s)^Math.trunc(s>>32))},Qt.prototype.interfaces_=function(){return[G,t]},Qt.prototype.getClass=function(){return Qt},Qt.midPoint=function(n,i){return new I((n.x+i.x)/2,(n.y+i.y)/2)},oy.serialVersionUID.get=function(){return 0x2d2172135f411c00},Object.defineProperties(Qt,oy);var rl=function(){this.tempEnv1=new At,this.tempEnv2=new At,this._overlapSeg1=new Qt,this._overlapSeg2=new Qt};rl.prototype.overlap=function(){if(arguments.length!==2){if(arguments.length===4){var n=arguments[0],i=arguments[1],s=arguments[2],u=arguments[3];n.getLineSegment(i,this._overlapSeg1),s.getLineSegment(u,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}}},rl.prototype.interfaces_=function(){return[]},rl.prototype.getClass=function(){return rl};var Xr=function(){this._pts=null,this._start=null,this._end=null,this._env=null,this._context=null,this._id=null;var n=arguments[0],i=arguments[1],s=arguments[2],u=arguments[3];this._pts=n,this._start=i,this._end=s,this._context=u};Xr.prototype.getLineSegment=function(n,i){i.p0=this._pts[n],i.p1=this._pts[n+1]},Xr.prototype.computeSelect=function(n,i,s,u){var c=this._pts[i],m=this._pts[s];if(u.tempEnv1.init(c,m),s-i==1)return u.select(this,i),null;if(!n.intersects(u.tempEnv1))return null;var E=Math.trunc((i+s)/2);i<E&&this.computeSelect(n,i,E,u),E<s&&this.computeSelect(n,E,s,u)},Xr.prototype.getCoordinates=function(){for(var n=new Array(this._end-this._start+1).fill(null),i=0,s=this._start;s<=this._end;s++)n[i++]=this._pts[s];return n},Xr.prototype.computeOverlaps=function(n,i){this.computeOverlapsInternal(this._start,this._end,n,n._start,n._end,i)},Xr.prototype.setId=function(n){this._id=n},Xr.prototype.select=function(n,i){this.computeSelect(n,this._start,this._end,i)},Xr.prototype.getEnvelope=function(){if(this._env===null){var n=this._pts[this._start],i=this._pts[this._end];this._env=new At(n,i)}return this._env},Xr.prototype.getEndIndex=function(){return this._end},Xr.prototype.getStartIndex=function(){return this._start},Xr.prototype.getContext=function(){return this._context},Xr.prototype.getId=function(){return this._id},Xr.prototype.computeOverlapsInternal=function(n,i,s,u,c,m){var E=this._pts[n],C=this._pts[i],U=s._pts[u],Z=s._pts[c];if(i-n==1&&c-u==1)return m.overlap(this,n,s,u),null;if(m.tempEnv1.init(E,C),m.tempEnv2.init(U,Z),!m.tempEnv1.intersects(m.tempEnv2))return null;var pt=Math.trunc((n+i)/2),gt=Math.trunc((u+c)/2);n<pt&&(u<gt&&this.computeOverlapsInternal(n,pt,s,u,gt,m),gt<c&&this.computeOverlapsInternal(n,pt,s,gt,c,m)),pt<i&&(u<gt&&this.computeOverlapsInternal(pt,i,s,u,gt,m),gt<c&&this.computeOverlapsInternal(pt,i,s,gt,c,m))},Xr.prototype.interfaces_=function(){return[]},Xr.prototype.getClass=function(){return Xr};var Ui=function(){};Ui.prototype.interfaces_=function(){return[]},Ui.prototype.getClass=function(){return Ui},Ui.getChainStartIndices=function(n){var i=0,s=new O;s.add(new it(i));do{var u=Ui.findChainEnd(n,i);s.add(new it(u)),i=u}while(i<n.length-1);return Ui.toIntArray(s)},Ui.findChainEnd=function(n,i){for(var s=i;s<n.length-1&&n[s].equals2D(n[s+1]);)s++;if(s>=n.length-1)return n.length-1;for(var u=dn.quadrant(n[s],n[s+1]),c=i+1;c<n.length&&!(!n[c-1].equals2D(n[c])&&dn.quadrant(n[c-1],n[c])!==u);)c++;return c-1},Ui.getChains=function(){if(arguments.length===1){var n=arguments[0];return Ui.getChains(n,null)}if(arguments.length===2){for(var i=arguments[0],s=arguments[1],u=new O,c=Ui.getChainStartIndices(i),m=0;m<c.length-1;m++){var E=new Xr(i,c[m],c[m+1],s);u.add(E)}return u}},Ui.toIntArray=function(n){for(var i=new Array(n.size()).fill(null),s=0;s<i.length;s++)i[s]=n.get(s).intValue();return i};var cs=function(){};cs.prototype.computeNodes=function(n){},cs.prototype.getNodedSubstrings=function(){},cs.prototype.interfaces_=function(){return[]},cs.prototype.getClass=function(){return cs};var il=function(){if(this._segInt=null,arguments.length!==0){if(arguments.length===1){var n=arguments[0];this.setSegmentIntersector(n)}}};il.prototype.setSegmentIntersector=function(n){this._segInt=n},il.prototype.interfaces_=function(){return[cs]},il.prototype.getClass=function(){return il};var rp=function(n){function i(u){u?n.call(this,u):n.call(this),this._monoChains=new O,this._index=new ry,this._idCounter=0,this._nodedSegStrings=null,this._nOverlaps=0}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={SegmentOverlapAction:{configurable:!0}};return i.prototype.getMonotoneChains=function(){return this._monoChains},i.prototype.getNodedSubstrings=function(){return Dn.getNodedSubstrings(this._nodedSegStrings)},i.prototype.getIndex=function(){return this._index},i.prototype.add=function(u){for(var c=Ui.getChains(u.getCoordinates(),u).iterator();c.hasNext();){var m=c.next();m.setId(this._idCounter++),this._index.insert(m.getEnvelope(),m),this._monoChains.add(m)}},i.prototype.computeNodes=function(u){this._nodedSegStrings=u;for(var c=u.iterator();c.hasNext();)this.add(c.next());this.intersectChains()},i.prototype.intersectChains=function(){for(var u=new sy(this._segInt),c=this._monoChains.iterator();c.hasNext();)for(var m=c.next(),E=this._index.query(m.getEnvelope()).iterator();E.hasNext();){var C=E.next();if(C.getId()>m.getId()&&(m.computeOverlaps(C,u),this._nOverlaps++),this._segInt.isDone())return null}},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},s.SegmentOverlapAction.get=function(){return sy},Object.defineProperties(i,s),i}(il),sy=function(n){function i(){n.call(this),this._si=null;var s=arguments[0];this._si=s}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.overlap=function(){if(arguments.length!==4)return n.prototype.overlap.apply(this,arguments);var s=arguments[0],u=arguments[1],c=arguments[2],m=arguments[3],E=s.getContext(),C=c.getContext();this._si.processIntersections(E,u,C,m)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(rl),Ze=function n(){if(this._quadrantSegments=n.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=n.CAP_ROUND,this._joinStyle=n.JOIN_ROUND,this._mitreLimit=n.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=n.DEFAULT_SIMPLIFY_FACTOR,arguments.length!==0){if(arguments.length===1){var i=arguments[0];this.setQuadrantSegments(i)}else if(arguments.length===2){var s=arguments[0],u=arguments[1];this.setQuadrantSegments(s),this.setEndCapStyle(u)}else if(arguments.length===4){var c=arguments[0],m=arguments[1],E=arguments[2],C=arguments[3];this.setQuadrantSegments(c),this.setEndCapStyle(m),this.setJoinStyle(E),this.setMitreLimit(C)}}},Mo={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}};Ze.prototype.getEndCapStyle=function(){return this._endCapStyle},Ze.prototype.isSingleSided=function(){return this._isSingleSided},Ze.prototype.setQuadrantSegments=function(n){this._quadrantSegments=n,this._quadrantSegments===0&&(this._joinStyle=Ze.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=Ze.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),n<=0&&(this._quadrantSegments=1),this._joinStyle!==Ze.JOIN_ROUND&&(this._quadrantSegments=Ze.DEFAULT_QUADRANT_SEGMENTS)},Ze.prototype.getJoinStyle=function(){return this._joinStyle},Ze.prototype.setJoinStyle=function(n){this._joinStyle=n},Ze.prototype.setSimplifyFactor=function(n){this._simplifyFactor=n<0?0:n},Ze.prototype.getSimplifyFactor=function(){return this._simplifyFactor},Ze.prototype.getQuadrantSegments=function(){return this._quadrantSegments},Ze.prototype.setEndCapStyle=function(n){this._endCapStyle=n},Ze.prototype.getMitreLimit=function(){return this._mitreLimit},Ze.prototype.setMitreLimit=function(n){this._mitreLimit=n},Ze.prototype.setSingleSided=function(n){this._isSingleSided=n},Ze.prototype.interfaces_=function(){return[]},Ze.prototype.getClass=function(){return Ze},Ze.bufferDistanceError=function(n){var i=Math.PI/2/n;return 1-Math.cos(i/2)},Mo.CAP_ROUND.get=function(){return 1},Mo.CAP_FLAT.get=function(){return 2},Mo.CAP_SQUARE.get=function(){return 3},Mo.JOIN_ROUND.get=function(){return 1},Mo.JOIN_MITRE.get=function(){return 2},Mo.JOIN_BEVEL.get=function(){return 3},Mo.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8},Mo.DEFAULT_MITRE_LIMIT.get=function(){return 5},Mo.DEFAULT_SIMPLIFY_FACTOR.get=function(){return .01},Object.defineProperties(Ze,Mo);var Ln=function(n){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=ot.COUNTERCLOCKWISE,this._inputLine=n||null},ol={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};Ln.prototype.isDeletable=function(n,i,s,u){var c=this._inputLine[n],m=this._inputLine[i],E=this._inputLine[s];return!!this.isConcave(c,m,E)&&!!this.isShallow(c,m,E,u)&&this.isShallowSampled(c,m,n,s,u)},Ln.prototype.deleteShallowConcavities=function(){for(var n=1,i=this.findNextNonDeletedIndex(n),s=this.findNextNonDeletedIndex(i),u=!1;s<this._inputLine.length;){var c=!1;this.isDeletable(n,i,s,this._distanceTol)&&(this._isDeleted[i]=Ln.DELETE,c=!0,u=!0),n=c?s:i,i=this.findNextNonDeletedIndex(n),s=this.findNextNonDeletedIndex(i)}return u},Ln.prototype.isShallowConcavity=function(n,i,s,u){return ot.computeOrientation(n,i,s)!==this._angleOrientation?!1:ot.distancePointLine(i,n,s)<u},Ln.prototype.isShallowSampled=function(n,i,s,u,c){var m=Math.trunc((u-s)/Ln.NUM_PTS_TO_CHECK);m<=0&&(m=1);for(var E=s;E<u;E+=m)if(!this.isShallow(n,i,this._inputLine[E],c))return!1;return!0},Ln.prototype.isConcave=function(n,i,s){var u=ot.computeOrientation(n,i,s)===this._angleOrientation;return u},Ln.prototype.simplify=function(n){this._distanceTol=Math.abs(n),n<0&&(this._angleOrientation=ot.CLOCKWISE),this._isDeleted=new Array(this._inputLine.length).fill(null);var i=!1;do i=this.deleteShallowConcavities();while(i);return this.collapseLine()},Ln.prototype.findNextNonDeletedIndex=function(n){for(var i=n+1;i<this._inputLine.length&&this._isDeleted[i]===Ln.DELETE;)i++;return i},Ln.prototype.isShallow=function(n,i,s,u){return ot.distancePointLine(i,n,s)<u},Ln.prototype.collapseLine=function(){for(var n=new $,i=0;i<this._inputLine.length;i++)this._isDeleted[i]!==Ln.DELETE&&n.add(this._inputLine[i]);return n.toCoordinateArray()},Ln.prototype.interfaces_=function(){return[]},Ln.prototype.getClass=function(){return Ln},Ln.simplify=function(n,i){return new Ln(n).simplify(i)},ol.INIT.get=function(){return 0},ol.DELETE.get=function(){return 1},ol.KEEP.get=function(){return 1},ol.NUM_PTS_TO_CHECK.get=function(){return 10},Object.defineProperties(Ln,ol);var ii=function(){this._ptList=null,this._precisionModel=null,this._minimimVertexDistance=0,this._ptList=new O},ay={COORDINATE_ARRAY_TYPE:{configurable:!0}};ii.prototype.getCoordinates=function(){return this._ptList.toArray(ii.COORDINATE_ARRAY_TYPE)},ii.prototype.setPrecisionModel=function(n){this._precisionModel=n},ii.prototype.addPt=function(n){var i=new I(n);if(this._precisionModel.makePrecise(i),this.isRedundant(i))return null;this._ptList.add(i)},ii.prototype.revere=function(){},ii.prototype.addPts=function(n,i){if(i)for(var s=0;s<n.length;s++)this.addPt(n[s]);else for(var u=n.length-1;u>=0;u--)this.addPt(n[u])},ii.prototype.isRedundant=function(n){if(this._ptList.size()<1)return!1;var i=this._ptList.get(this._ptList.size()-1);return n.distance(i)<this._minimimVertexDistance},ii.prototype.toString=function(){return new pe().createLineString(this.getCoordinates()).toString()},ii.prototype.closeRing=function(){if(this._ptList.size()<1)return null;var n=new I(this._ptList.get(0)),i=this._ptList.get(this._ptList.size()-1);if(n.equals(i))return null;this._ptList.add(n)},ii.prototype.setMinimumVertexDistance=function(n){this._minimimVertexDistance=n},ii.prototype.interfaces_=function(){return[]},ii.prototype.getClass=function(){return ii},ay.COORDINATE_ARRAY_TYPE.get=function(){return new Array(0).fill(null)},Object.defineProperties(ii,ay);var ve=function(){},Js={PI_TIMES_2:{configurable:!0},PI_OVER_2:{configurable:!0},PI_OVER_4:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},CLOCKWISE:{configurable:!0},NONE:{configurable:!0}};ve.prototype.interfaces_=function(){return[]},ve.prototype.getClass=function(){return ve},ve.toDegrees=function(n){return 180*n/Math.PI},ve.normalize=function(n){for(;n>Math.PI;)n-=ve.PI_TIMES_2;for(;n<=-Math.PI;)n+=ve.PI_TIMES_2;return n},ve.angle=function(){if(arguments.length===1){var n=arguments[0];return Math.atan2(n.y,n.x)}if(arguments.length===2){var i=arguments[0],s=arguments[1],u=s.x-i.x,c=s.y-i.y;return Math.atan2(c,u)}},ve.isAcute=function(n,i,s){var u=n.x-i.x,c=n.y-i.y;return u*(s.x-i.x)+c*(s.y-i.y)>0},ve.isObtuse=function(n,i,s){var u=n.x-i.x,c=n.y-i.y;return u*(s.x-i.x)+c*(s.y-i.y)<0},ve.interiorAngle=function(n,i,s){var u=ve.angle(i,n),c=ve.angle(i,s);return Math.abs(c-u)},ve.normalizePositive=function(n){if(n<0){for(;n<0;)n+=ve.PI_TIMES_2;n>=ve.PI_TIMES_2&&(n=0)}else{for(;n>=ve.PI_TIMES_2;)n-=ve.PI_TIMES_2;n<0&&(n=0)}return n},ve.angleBetween=function(n,i,s){var u=ve.angle(i,n),c=ve.angle(i,s);return ve.diff(u,c)},ve.diff=function(n,i){var s=null;return(s=n<i?i-n:n-i)>Math.PI&&(s=2*Math.PI-s),s},ve.toRadians=function(n){return n*Math.PI/180},ve.getTurn=function(n,i){var s=Math.sin(i-n);return s>0?ve.COUNTERCLOCKWISE:s<0?ve.CLOCKWISE:ve.NONE},ve.angleBetweenOriented=function(n,i,s){var u=ve.angle(i,n),c=ve.angle(i,s)-u;return c<=-Math.PI?c+ve.PI_TIMES_2:c>Math.PI?c-ve.PI_TIMES_2:c},Js.PI_TIMES_2.get=function(){return 2*Math.PI},Js.PI_OVER_2.get=function(){return Math.PI/2},Js.PI_OVER_4.get=function(){return Math.PI/4},Js.COUNTERCLOCKWISE.get=function(){return ot.COUNTERCLOCKWISE},Js.CLOCKWISE.get=function(){return ot.CLOCKWISE},Js.NONE.get=function(){return ot.COLLINEAR},Object.defineProperties(ve,Js);var wn=function n(){this._maxCurveSegmentError=0,this._filletAngleQuantum=null,this._closingSegLengthFactor=1,this._segList=null,this._distance=0,this._precisionModel=null,this._bufParams=null,this._li=null,this._s0=null,this._s1=null,this._s2=null,this._seg0=new Qt,this._seg1=new Qt,this._offset0=new Qt,this._offset1=new Qt,this._side=0,this._hasNarrowConcaveAngle=!1;var i=arguments[0],s=arguments[1],u=arguments[2];this._precisionModel=i,this._bufParams=s,this._li=new N,this._filletAngleQuantum=Math.PI/2/s.getQuadrantSegments(),s.getQuadrantSegments()>=8&&s.getJoinStyle()===Ze.JOIN_ROUND&&(this._closingSegLengthFactor=n.MAX_CLOSING_SEG_LEN_FACTOR),this.init(u)},sl={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}};wn.prototype.addNextSegment=function(n,i){if(this._s0=this._s1,this._s1=this._s2,this._s2=n,this._seg0.setCoordinates(this._s0,this._s1),this.computeOffsetSegment(this._seg0,this._side,this._distance,this._offset0),this._seg1.setCoordinates(this._s1,this._s2),this.computeOffsetSegment(this._seg1,this._side,this._distance,this._offset1),this._s1.equals(this._s2))return null;var s=ot.computeOrientation(this._s0,this._s1,this._s2),u=s===ot.CLOCKWISE&&this._side===It.LEFT||s===ot.COUNTERCLOCKWISE&&this._side===It.RIGHT;s===0?this.addCollinear(i):u?this.addOutsideTurn(s,i):this.addInsideTurn(s,i)},wn.prototype.addLineEndCap=function(n,i){var s=new Qt(n,i),u=new Qt;this.computeOffsetSegment(s,It.LEFT,this._distance,u);var c=new Qt;this.computeOffsetSegment(s,It.RIGHT,this._distance,c);var m=i.x-n.x,E=i.y-n.y,C=Math.atan2(E,m);switch(this._bufParams.getEndCapStyle()){case Ze.CAP_ROUND:this._segList.addPt(u.p1),this.addFilletArc(i,C+Math.PI/2,C-Math.PI/2,ot.CLOCKWISE,this._distance),this._segList.addPt(c.p1);break;case Ze.CAP_FLAT:this._segList.addPt(u.p1),this._segList.addPt(c.p1);break;case Ze.CAP_SQUARE:var U=new I;U.x=Math.abs(this._distance)*Math.cos(C),U.y=Math.abs(this._distance)*Math.sin(C);var Z=new I(u.p1.x+U.x,u.p1.y+U.y),pt=new I(c.p1.x+U.x,c.p1.y+U.y);this._segList.addPt(Z),this._segList.addPt(pt)}},wn.prototype.getCoordinates=function(){return this._segList.getCoordinates()},wn.prototype.addMitreJoin=function(n,i,s,u){var c=!0,m=null;try{m=Dt.intersection(i.p0,i.p1,s.p0,s.p1),(u<=0?1:m.distance(n)/Math.abs(u))>this._bufParams.getMitreLimit()&&(c=!1)}catch(E){if(!(E instanceof $t))throw E;m=new I(0,0),c=!1}c?this._segList.addPt(m):this.addLimitedMitreJoin(i,s,u,this._bufParams.getMitreLimit())},wn.prototype.addFilletCorner=function(n,i,s,u,c){var m=i.x-n.x,E=i.y-n.y,C=Math.atan2(E,m),U=s.x-n.x,Z=s.y-n.y,pt=Math.atan2(Z,U);u===ot.CLOCKWISE?C<=pt&&(C+=2*Math.PI):C>=pt&&(C-=2*Math.PI),this._segList.addPt(i),this.addFilletArc(n,C,pt,u,c),this._segList.addPt(s)},wn.prototype.addOutsideTurn=function(n,i){if(this._offset0.p1.distance(this._offset1.p0)<this._distance*wn.OFFSET_SEGMENT_SEPARATION_FACTOR)return this._segList.addPt(this._offset0.p1),null;this._bufParams.getJoinStyle()===Ze.JOIN_MITRE?this.addMitreJoin(this._s1,this._offset0,this._offset1,this._distance):this._bufParams.getJoinStyle()===Ze.JOIN_BEVEL?this.addBevelJoin(this._offset0,this._offset1):(i&&this._segList.addPt(this._offset0.p1),this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,n,this._distance),this._segList.addPt(this._offset1.p0))},wn.prototype.createSquare=function(n){this._segList.addPt(new I(n.x+this._distance,n.y+this._distance)),this._segList.addPt(new I(n.x+this._distance,n.y-this._distance)),this._segList.addPt(new I(n.x-this._distance,n.y-this._distance)),this._segList.addPt(new I(n.x-this._distance,n.y+this._distance)),this._segList.closeRing()},wn.prototype.addSegments=function(n,i){this._segList.addPts(n,i)},wn.prototype.addFirstSegment=function(){this._segList.addPt(this._offset1.p0)},wn.prototype.addLastSegment=function(){this._segList.addPt(this._offset1.p1)},wn.prototype.initSideSegments=function(n,i,s){this._s1=n,this._s2=i,this._side=s,this._seg1.setCoordinates(n,i),this.computeOffsetSegment(this._seg1,s,this._distance,this._offset1)},wn.prototype.addLimitedMitreJoin=function(n,i,s,u){var c=this._seg0.p1,m=ve.angle(c,this._seg0.p0),E=ve.angleBetweenOriented(this._seg0.p0,c,this._seg1.p1)/2,C=ve.normalize(m+E),U=ve.normalize(C+Math.PI),Z=u*s,pt=s-Z*Math.abs(Math.sin(E)),gt=c.x+Z*Math.cos(U),Rt=c.y+Z*Math.sin(U),Ft=new I(gt,Rt),Vt=new Qt(c,Ft),ee=Vt.pointAlongOffset(1,pt),hn=Vt.pointAlongOffset(1,-pt);this._side===It.LEFT?(this._segList.addPt(ee),this._segList.addPt(hn)):(this._segList.addPt(hn),this._segList.addPt(ee))},wn.prototype.computeOffsetSegment=function(n,i,s,u){var c=i===It.LEFT?1:-1,m=n.p1.x-n.p0.x,E=n.p1.y-n.p0.y,C=Math.sqrt(m*m+E*E),U=c*s*m/C,Z=c*s*E/C;u.p0.x=n.p0.x-Z,u.p0.y=n.p0.y+U,u.p1.x=n.p1.x-Z,u.p1.y=n.p1.y+U},wn.prototype.addFilletArc=function(n,i,s,u,c){var m=u===ot.CLOCKWISE?-1:1,E=Math.abs(i-s),C=Math.trunc(E/this._filletAngleQuantum+.5);if(C<1)return null;for(var U=E/C,Z=0,pt=new I;Z<E;){var gt=i+m*Z;pt.x=n.x+c*Math.cos(gt),pt.y=n.y+c*Math.sin(gt),this._segList.addPt(pt),Z+=U}},wn.prototype.addInsideTurn=function(n,i){if(this._li.computeIntersection(this._offset0.p0,this._offset0.p1,this._offset1.p0,this._offset1.p1),this._li.hasIntersection())this._segList.addPt(this._li.getIntersection(0));else if(this._hasNarrowConcaveAngle=!0,this._offset0.p1.distance(this._offset1.p0)<this._distance*wn.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR)this._segList.addPt(this._offset0.p1);else{if(this._segList.addPt(this._offset0.p1),this._closingSegLengthFactor>0){var s=new I((this._closingSegLengthFactor*this._offset0.p1.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset0.p1.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(s);var u=new I((this._closingSegLengthFactor*this._offset1.p0.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset1.p0.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(u)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}},wn.prototype.createCircle=function(n){var i=new I(n.x+this._distance,n.y);this._segList.addPt(i),this.addFilletArc(n,0,2*Math.PI,-1,this._distance),this._segList.closeRing()},wn.prototype.addBevelJoin=function(n,i){this._segList.addPt(n.p1),this._segList.addPt(i.p0)},wn.prototype.init=function(n){this._distance=n,this._maxCurveSegmentError=n*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new ii,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(n*wn.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)},wn.prototype.addCollinear=function(n){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2),this._li.getIntersectionNum()>=2&&(this._bufParams.getJoinStyle()===Ze.JOIN_BEVEL||this._bufParams.getJoinStyle()===Ze.JOIN_MITRE?(n&&this._segList.addPt(this._offset0.p1),this._segList.addPt(this._offset1.p0)):this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,ot.CLOCKWISE,this._distance))},wn.prototype.closeRing=function(){this._segList.closeRing()},wn.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle},wn.prototype.interfaces_=function(){return[]},wn.prototype.getClass=function(){return wn},sl.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return .001},sl.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return .001},sl.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6},sl.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80},Object.defineProperties(wn,sl);var Or=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var n=arguments[0],i=arguments[1];this._precisionModel=n,this._bufParams=i};Or.prototype.getOffsetCurve=function(n,i){if(this._distance=i,i===0)return null;var s=i<0,u=Math.abs(i),c=this.getSegGen(u);n.length<=1?this.computePointCurve(n[0],c):this.computeOffsetCurve(n,s,c);var m=c.getCoordinates();return s&&Q.reverse(m),m},Or.prototype.computeSingleSidedBufferCurve=function(n,i,s){var u=this.simplifyTolerance(this._distance);if(i){s.addSegments(n,!0);var c=Ln.simplify(n,-u),m=c.length-1;s.initSideSegments(c[m],c[m-1],It.LEFT),s.addFirstSegment();for(var E=m-2;E>=0;E--)s.addNextSegment(c[E],!0)}else{s.addSegments(n,!1);var C=Ln.simplify(n,u),U=C.length-1;s.initSideSegments(C[0],C[1],It.LEFT),s.addFirstSegment();for(var Z=2;Z<=U;Z++)s.addNextSegment(C[Z],!0)}s.addLastSegment(),s.closeRing()},Or.prototype.computeRingBufferCurve=function(n,i,s){var u=this.simplifyTolerance(this._distance);i===It.RIGHT&&(u=-u);var c=Ln.simplify(n,u),m=c.length-1;s.initSideSegments(c[m-1],c[0],i);for(var E=1;E<=m;E++){var C=E!==1;s.addNextSegment(c[E],C)}s.closeRing()},Or.prototype.computeLineBufferCurve=function(n,i){var s=this.simplifyTolerance(this._distance),u=Ln.simplify(n,s),c=u.length-1;i.initSideSegments(u[0],u[1],It.LEFT);for(var m=2;m<=c;m++)i.addNextSegment(u[m],!0);i.addLastSegment(),i.addLineEndCap(u[c-1],u[c]);var E=Ln.simplify(n,-s),C=E.length-1;i.initSideSegments(E[C],E[C-1],It.LEFT);for(var U=C-2;U>=0;U--)i.addNextSegment(E[U],!0);i.addLastSegment(),i.addLineEndCap(E[1],E[0]),i.closeRing()},Or.prototype.computePointCurve=function(n,i){switch(this._bufParams.getEndCapStyle()){case Ze.CAP_ROUND:i.createCircle(n);break;case Ze.CAP_SQUARE:i.createSquare(n)}},Or.prototype.getLineCurve=function(n,i){if(this._distance=i,i<0&&!this._bufParams.isSingleSided()||i===0)return null;var s=Math.abs(i),u=this.getSegGen(s);if(n.length<=1)this.computePointCurve(n[0],u);else if(this._bufParams.isSingleSided()){var c=i<0;this.computeSingleSidedBufferCurve(n,c,u)}else this.computeLineBufferCurve(n,u);return u.getCoordinates()},Or.prototype.getBufferParameters=function(){return this._bufParams},Or.prototype.simplifyTolerance=function(n){return n*this._bufParams.getSimplifyFactor()},Or.prototype.getRingCurve=function(n,i,s){if(this._distance=s,n.length<=2)return this.getLineCurve(n,s);if(s===0)return Or.copyCoordinates(n);var u=this.getSegGen(s);return this.computeRingBufferCurve(n,i,u),u.getCoordinates()},Or.prototype.computeOffsetCurve=function(n,i,s){var u=this.simplifyTolerance(this._distance);if(i){var c=Ln.simplify(n,-u),m=c.length-1;s.initSideSegments(c[m],c[m-1],It.LEFT),s.addFirstSegment();for(var E=m-2;E>=0;E--)s.addNextSegment(c[E],!0)}else{var C=Ln.simplify(n,u),U=C.length-1;s.initSideSegments(C[0],C[1],It.LEFT),s.addFirstSegment();for(var Z=2;Z<=U;Z++)s.addNextSegment(C[Z],!0)}s.addLastSegment()},Or.prototype.getSegGen=function(n){return new wn(this._precisionModel,this._bufParams,n)},Or.prototype.interfaces_=function(){return[]},Or.prototype.getClass=function(){return Or},Or.copyCoordinates=function(n){for(var i=new Array(n.length).fill(null),s=0;s<i.length;s++)i[s]=new I(n[s]);return i};var Ks=function(){this._subgraphs=null,this._seg=new Qt,this._cga=new ot;var n=arguments[0];this._subgraphs=n},uy={DepthSegment:{configurable:!0}};Ks.prototype.findStabbedSegments=function(){if(arguments.length===1){for(var n=arguments[0],i=new O,s=this._subgraphs.iterator();s.hasNext();){var u=s.next(),c=u.getEnvelope();n.y<c.getMinY()||n.y>c.getMaxY()||this.findStabbedSegments(n,u.getDirectedEdges(),i)}return i}if(arguments.length===3){if(X(arguments[2],ct)&&arguments[0]instanceof I&&arguments[1]instanceof np){for(var m=arguments[0],E=arguments[1],C=arguments[2],U=E.getEdge().getCoordinates(),Z=0;Z<U.length-1;Z++)if(this._seg.p0=U[Z],this._seg.p1=U[Z+1],this._seg.p0.y>this._seg.p1.y&&this._seg.reverse(),!(Math.max(this._seg.p0.x,this._seg.p1.x)<m.x)&&!(this._seg.isHorizontal()||m.y<this._seg.p0.y||m.y>this._seg.p1.y||ot.computeOrientation(this._seg.p0,this._seg.p1,m)===ot.RIGHT)){var pt=E.getDepth(It.LEFT);this._seg.p0.equals(U[Z])||(pt=E.getDepth(It.RIGHT));var gt=new fs(this._seg,pt);C.add(gt)}}else if(X(arguments[2],ct)&&arguments[0]instanceof I&&X(arguments[1],ct))for(var Rt=arguments[0],Ft=arguments[1],Vt=arguments[2],ee=Ft.iterator();ee.hasNext();){var hn=ee.next();hn.isForward()&&this.findStabbedSegments(Rt,hn,Vt)}}},Ks.prototype.getDepth=function(n){var i=this.findStabbedSegments(n);return i.size()===0?0:Ti.min(i)._leftDepth},Ks.prototype.interfaces_=function(){return[]},Ks.prototype.getClass=function(){return Ks},uy.DepthSegment.get=function(){return fs},Object.defineProperties(Ks,uy);var fs=function(){this._upwardSeg=null,this._leftDepth=null;var n=arguments[0],i=arguments[1];this._upwardSeg=new Qt(n),this._leftDepth=i};fs.prototype.compareTo=function(n){var i=n;if(this._upwardSeg.minX()>=i._upwardSeg.maxX())return 1;if(this._upwardSeg.maxX()<=i._upwardSeg.minX())return-1;var s=this._upwardSeg.orientationIndex(i._upwardSeg);return s!==0||(s=-1*i._upwardSeg.orientationIndex(this._upwardSeg))!=0?s:this._upwardSeg.compareTo(i._upwardSeg)},fs.prototype.compareX=function(n,i){var s=n.p0.compareTo(i.p0);return s!==0?s:n.p1.compareTo(i.p1)},fs.prototype.toString=function(){return this._upwardSeg.toString()},fs.prototype.interfaces_=function(){return[G]},fs.prototype.getClass=function(){return fs};var Je=function(n,i,s){this.p0=n||null,this.p1=i||null,this.p2=s||null};Je.prototype.area=function(){return Je.area(this.p0,this.p1,this.p2)},Je.prototype.signedArea=function(){return Je.signedArea(this.p0,this.p1,this.p2)},Je.prototype.interpolateZ=function(n){if(n===null)throw new A("Supplied point is null.");return Je.interpolateZ(n,this.p0,this.p1,this.p2)},Je.prototype.longestSideLength=function(){return Je.longestSideLength(this.p0,this.p1,this.p2)},Je.prototype.isAcute=function(){return Je.isAcute(this.p0,this.p1,this.p2)},Je.prototype.circumcentre=function(){return Je.circumcentre(this.p0,this.p1,this.p2)},Je.prototype.area3D=function(){return Je.area3D(this.p0,this.p1,this.p2)},Je.prototype.centroid=function(){return Je.centroid(this.p0,this.p1,this.p2)},Je.prototype.inCentre=function(){return Je.inCentre(this.p0,this.p1,this.p2)},Je.prototype.interfaces_=function(){return[]},Je.prototype.getClass=function(){return Je},Je.area=function(n,i,s){return Math.abs(((s.x-n.x)*(i.y-n.y)-(i.x-n.x)*(s.y-n.y))/2)},Je.signedArea=function(n,i,s){return((s.x-n.x)*(i.y-n.y)-(i.x-n.x)*(s.y-n.y))/2},Je.det=function(n,i,s,u){return n*u-i*s},Je.interpolateZ=function(n,i,s,u){var c=i.x,m=i.y,E=s.x-c,C=u.x-c,U=s.y-m,Z=u.y-m,pt=E*Z-C*U,gt=n.x-c,Rt=n.y-m,Ft=(Z*gt-C*Rt)/pt,Vt=(-U*gt+E*Rt)/pt;return i.z+Ft*(s.z-i.z)+Vt*(u.z-i.z)},Je.longestSideLength=function(n,i,s){var u=n.distance(i),c=i.distance(s),m=s.distance(n),E=u;return c>E&&(E=c),m>E&&(E=m),E},Je.isAcute=function(n,i,s){return!!ve.isAcute(n,i,s)&&!!ve.isAcute(i,s,n)&&!!ve.isAcute(s,n,i)},Je.circumcentre=function(n,i,s){var u=s.x,c=s.y,m=n.x-u,E=n.y-c,C=i.x-u,U=i.y-c,Z=2*Je.det(m,E,C,U),pt=Je.det(E,m*m+E*E,U,C*C+U*U),gt=Je.det(m,m*m+E*E,C,C*C+U*U);return new I(u-pt/Z,c+gt/Z)},Je.perpendicularBisector=function(n,i){var s=i.x-n.x,u=i.y-n.y,c=new Dt(n.x+s/2,n.y+u/2,1),m=new Dt(n.x-u+s/2,n.y+s+u/2,1);return new Dt(c,m)},Je.angleBisector=function(n,i,s){var u=i.distance(n),c=u/(u+i.distance(s)),m=s.x-n.x,E=s.y-n.y;return new I(n.x+c*m,n.y+c*E)},Je.area3D=function(n,i,s){var u=i.x-n.x,c=i.y-n.y,m=i.z-n.z,E=s.x-n.x,C=s.y-n.y,U=s.z-n.z,Z=c*U-m*C,pt=m*E-u*U,gt=u*C-c*E,Rt=Z*Z+pt*pt+gt*gt,Ft=Math.sqrt(Rt)/2;return Ft},Je.centroid=function(n,i,s){var u=(n.x+i.x+s.x)/3,c=(n.y+i.y+s.y)/3;return new I(u,c)},Je.inCentre=function(n,i,s){var u=i.distance(s),c=n.distance(s),m=n.distance(i),E=u+c+m,C=(u*n.x+c*i.x+m*s.x)/E,U=(u*n.y+c*i.y+m*s.y)/E;return new I(C,U)};var yi=function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new O;var n=arguments[0],i=arguments[1],s=arguments[2];this._inputGeom=n,this._distance=i,this._curveBuilder=s};yi.prototype.addPoint=function(n){if(this._distance<=0)return null;var i=n.getCoordinates(),s=this._curveBuilder.getLineCurve(i,this._distance);this.addCurve(s,V.EXTERIOR,V.INTERIOR)},yi.prototype.addPolygon=function(n){var i=this._distance,s=It.LEFT;this._distance<0&&(i=-this._distance,s=It.RIGHT);var u=n.getExteriorRing(),c=Q.removeRepeatedPoints(u.getCoordinates());if(this._distance<0&&this.isErodedCompletely(u,this._distance)||this._distance<=0&&c.length<3)return null;this.addPolygonRing(c,i,s,V.EXTERIOR,V.INTERIOR);for(var m=0;m<n.getNumInteriorRing();m++){var E=n.getInteriorRingN(m),C=Q.removeRepeatedPoints(E.getCoordinates());this._distance>0&&this.isErodedCompletely(E,-this._distance)||this.addPolygonRing(C,i,It.opposite(s),V.INTERIOR,V.EXTERIOR)}},yi.prototype.isTriangleErodedCompletely=function(n,i){var s=new Je(n[0],n[1],n[2]),u=s.inCentre();return ot.distancePointLine(u,s.p0,s.p1)<Math.abs(i)},yi.prototype.addLineString=function(n){if(this._distance<=0&&!this._curveBuilder.getBufferParameters().isSingleSided())return null;var i=Q.removeRepeatedPoints(n.getCoordinates()),s=this._curveBuilder.getLineCurve(i,this._distance);this.addCurve(s,V.EXTERIOR,V.INTERIOR)},yi.prototype.addCurve=function(n,i,s){if(n===null||n.length<2)return null;var u=new Dn(n,new fn(0,V.BOUNDARY,i,s));this._curveList.add(u)},yi.prototype.getCurves=function(){return this.add(this._inputGeom),this._curveList},yi.prototype.addPolygonRing=function(n,i,s,u,c){if(i===0&&n.length<oe.MINIMUM_VALID_SIZE)return null;var m=u,E=c;n.length>=oe.MINIMUM_VALID_SIZE&&ot.isCCW(n)&&(m=c,E=u,s=It.opposite(s));var C=this._curveBuilder.getRingCurve(n,s,i);this.addCurve(C,m,E)},yi.prototype.add=function(n){if(n.isEmpty())return null;n instanceof Zt?this.addPolygon(n):n instanceof at?this.addLineString(n):n instanceof Xt?this.addPoint(n):n instanceof me?this.addCollection(n):n instanceof Hr?this.addCollection(n):n instanceof ae?this.addCollection(n):n instanceof En&&this.addCollection(n)},yi.prototype.isErodedCompletely=function(n,i){var s=n.getCoordinates();if(s.length<4)return i<0;if(s.length===4)return this.isTriangleErodedCompletely(s,i);var u=n.getEnvelopeInternal(),c=Math.min(u.getHeight(),u.getWidth());return i<0&&2*Math.abs(i)>c},yi.prototype.addCollection=function(n){for(var i=0;i<n.getNumGeometries();i++){var s=n.getGeometryN(i);this.add(s)}},yi.prototype.interfaces_=function(){return[]},yi.prototype.getClass=function(){return yi};var Ba=function(){};Ba.prototype.locate=function(n){},Ba.prototype.interfaces_=function(){return[]},Ba.prototype.getClass=function(){return Ba};var Zi=function(){this._parent=null,this._atStart=null,this._max=null,this._index=null,this._subcollectionIterator=null;var n=arguments[0];this._parent=n,this._atStart=!0,this._index=0,this._max=n.getNumGeometries()};Zi.prototype.next=function(){if(this._atStart)return this._atStart=!1,Zi.isAtomic(this._parent)&&this._index++,this._parent;if(this._subcollectionIterator!==null){if(this._subcollectionIterator.hasNext())return this._subcollectionIterator.next();this._subcollectionIterator=null}if(this._index>=this._max)throw new o;var n=this._parent.getGeometryN(this._index++);return n instanceof En?(this._subcollectionIterator=new Zi(n),this._subcollectionIterator.next()):n},Zi.prototype.remove=function(){throw new Error(this.getClass().getName())},Zi.prototype.hasNext=function(){if(this._atStart)return!0;if(this._subcollectionIterator!==null){if(this._subcollectionIterator.hasNext())return!0;this._subcollectionIterator=null}return!(this._index>=this._max)},Zi.prototype.interfaces_=function(){return[ft]},Zi.prototype.getClass=function(){return Zi},Zi.isAtomic=function(n){return!(n instanceof En)};var oi=function(){this._geom=null;var n=arguments[0];this._geom=n};oi.prototype.locate=function(n){return oi.locate(n,this._geom)},oi.prototype.interfaces_=function(){return[Ba]},oi.prototype.getClass=function(){return oi},oi.isPointInRing=function(n,i){return!!i.getEnvelopeInternal().intersects(n)&&ot.isPointInRing(n,i.getCoordinates())},oi.containsPointInPolygon=function(n,i){if(i.isEmpty())return!1;var s=i.getExteriorRing();if(!oi.isPointInRing(n,s))return!1;for(var u=0;u<i.getNumInteriorRing();u++){var c=i.getInteriorRingN(u);if(oi.isPointInRing(n,c))return!1}return!0},oi.containsPoint=function(n,i){if(i instanceof Zt)return oi.containsPointInPolygon(n,i);if(i instanceof En)for(var s=new Zi(i);s.hasNext();){var u=s.next();if(u!==i&&oi.containsPoint(n,u))return!0}return!1},oi.locate=function(n,i){return i.isEmpty()?V.EXTERIOR:oi.containsPoint(n,i)?V.INTERIOR:V.EXTERIOR};var ur=function(){this._edgeMap=new x,this._edgeList=null,this._ptInAreaLocation=[V.NONE,V.NONE]};ur.prototype.getNextCW=function(n){this.getEdges();var i=this._edgeList.indexOf(n),s=i-1;return i===0&&(s=this._edgeList.size()-1),this._edgeList.get(s)},ur.prototype.propagateSideLabels=function(n){for(var i=V.NONE,s=this.iterator();s.hasNext();){var u=s.next().getLabel();u.isArea(n)&&u.getLocation(n,It.LEFT)!==V.NONE&&(i=u.getLocation(n,It.LEFT))}if(i===V.NONE)return null;for(var c=i,m=this.iterator();m.hasNext();){var E=m.next(),C=E.getLabel();if(C.getLocation(n,It.ON)===V.NONE&&C.setLocation(n,It.ON,c),C.isArea(n)){var U=C.getLocation(n,It.LEFT),Z=C.getLocation(n,It.RIGHT);if(Z!==V.NONE){if(Z!==c)throw new xo("side location conflict",E.getCoordinate());U===V.NONE&&Lt.shouldNeverReachHere("found single null side (at "+E.getCoordinate()+")"),c=U}else Lt.isTrue(C.getLocation(n,It.LEFT)===V.NONE,"found single null side"),C.setLocation(n,It.RIGHT,c),C.setLocation(n,It.LEFT,c)}}},ur.prototype.getCoordinate=function(){var n=this.iterator();return n.hasNext()?n.next().getCoordinate():null},ur.prototype.print=function(n){Ut.out.println("EdgeEndStar: "+this.getCoordinate());for(var i=this.iterator();i.hasNext();)i.next().print(n)},ur.prototype.isAreaLabelsConsistent=function(n){return this.computeEdgeEndLabels(n.getBoundaryNodeRule()),this.checkAreaLabelsConsistent(0)},ur.prototype.checkAreaLabelsConsistent=function(n){var i=this.getEdges();if(i.size()<=0)return!0;var s=i.size()-1,u=i.get(s).getLabel().getLocation(n,It.LEFT);Lt.isTrue(u!==V.NONE,"Found unlabelled area edge");for(var c=u,m=this.iterator();m.hasNext();){var E=m.next().getLabel();Lt.isTrue(E.isArea(n),"Found non-area edge");var C=E.getLocation(n,It.LEFT),U=E.getLocation(n,It.RIGHT);if(C===U||U!==c)return!1;c=C}return!0},ur.prototype.findIndex=function(n){this.iterator();for(var i=0;i<this._edgeList.size();i++)if(this._edgeList.get(i)===n)return i;return-1},ur.prototype.iterator=function(){return this.getEdges().iterator()},ur.prototype.getEdges=function(){return this._edgeList===null&&(this._edgeList=new O(this._edgeMap.values())),this._edgeList},ur.prototype.getLocation=function(n,i,s){return this._ptInAreaLocation[n]===V.NONE&&(this._ptInAreaLocation[n]=oi.locate(i,s[n].getGeometry())),this._ptInAreaLocation[n]},ur.prototype.toString=function(){var n=new _t;n.append("EdgeEndStar: "+this.getCoordinate()),n.append(`
|
|
1
|
+
var rC=Object.create;var Ey=Object.defineProperty;var iC=Object.getOwnPropertyDescriptor;var oC=Object.getOwnPropertyNames;var sC=Object.getPrototypeOf,aC=Object.prototype.hasOwnProperty;var nt=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports);var uC=(r,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of oC(t))!aC.call(r,a)&&a!==e&&Ey(r,a,{get:()=>t[a],enumerable:!(o=iC(t,a))||o.enumerable});return r};var gn=(r,t,e)=>(e=r!=null?rC(sC(r)):{},uC(t||!r||!r.__esModule?Ey(e,"default",{value:r,enumerable:!0}):e,r));var gc=(r,t,e)=>new Promise((o,a)=>{var l=p=>{try{f(e.next(p))}catch(d){a(d)}},h=p=>{try{f(e.throw(p))}catch(d){a(d)}},f=p=>p.done?o(p.value):Promise.resolve(p.value).then(l,h);f((e=e.apply(r,t)).next())});var Zr=nt((pp,My)=>{"use strict";var hl=function(r){return r&&r.Math===Math&&r};My.exports=hl(typeof globalThis=="object"&&globalThis)||hl(typeof window=="object"&&window)||hl(typeof self=="object"&&self)||hl(typeof global=="object"&&global)||hl(typeof pp=="object"&&pp)||function(){return this}()||Function("return this")()});var Ur=nt((Sq,Sy)=>{"use strict";Sy.exports=function(r){try{return!!r()}catch(t){return!0}}});var ro=nt((wq,wy)=>{"use strict";var lC=Ur();wy.exports=!lC(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7})});var yc=nt((bq,by)=>{"use strict";var cC=Ur();by.exports=!cC(function(){var r=function(){}.bind();return typeof r!="function"||r.hasOwnProperty("prototype")})});var Zo=nt((Tq,Ty)=>{"use strict";var fC=yc(),vc=Function.prototype.call;Ty.exports=fC?vc.bind(vc):function(){return vc.apply(vc,arguments)}});var Iy=nt(Py=>{"use strict";var Ay={}.propertyIsEnumerable,Cy=Object.getOwnPropertyDescriptor,hC=Cy&&!Ay.call({1:2},1);Py.f=hC?function(t){var e=Cy(this,t);return!!e&&e.enumerable}:Ay});var _c=nt((Cq,Ry)=>{"use strict";Ry.exports=function(r,t){return{enumerable:!(r&1),configurable:!(r&2),writable:!(r&4),value:t}}});var li=nt((Pq,Oy)=>{"use strict";var Ly=yc(),Ny=Function.prototype,dp=Ny.call,pC=Ly&&Ny.bind.bind(dp,dp);Oy.exports=Ly?pC:function(r){return function(){return dp.apply(r,arguments)}}});var pl=nt((Iq,Fy)=>{"use strict";var Dy=li(),dC=Dy({}.toString),mC=Dy("".slice);Fy.exports=function(r){return mC(dC(r),8,-1)}});var By=nt((Rq,Uy)=>{"use strict";var gC=li(),yC=Ur(),vC=pl(),mp=Object,_C=gC("".split);Uy.exports=yC(function(){return!mp("z").propertyIsEnumerable(0)})?function(r){return vC(r)==="String"?_C(r,""):mp(r)}:mp});var gp=nt((Lq,zy)=>{"use strict";zy.exports=function(r){return r==null}});var Ya=nt((Nq,Gy)=>{"use strict";var xC=gp(),EC=TypeError;Gy.exports=function(r){if(xC(r))throw new EC("Can't call method on "+r);return r}});var $a=nt((Oq,ky)=>{"use strict";var MC=By(),SC=Ya();ky.exports=function(r){return MC(SC(r))}});var Br=nt((Dq,qy)=>{"use strict";var yp=typeof document=="object"&&document.all;qy.exports=typeof yp=="undefined"&&yp!==void 0?function(r){return typeof r=="function"||r===yp}:function(r){return typeof r=="function"}});var bo=nt((Fq,Vy)=>{"use strict";var wC=Br();Vy.exports=function(r){return typeof r=="object"?r!==null:wC(r)}});var xc=nt((Uq,Hy)=>{"use strict";var vp=Zr(),bC=Br(),TC=function(r){return bC(r)?r:void 0};Hy.exports=function(r,t){return arguments.length<2?TC(vp[r]):vp[r]&&vp[r][t]}});var Xy=nt((Bq,Wy)=>{"use strict";var AC=li();Wy.exports=AC({}.isPrototypeOf)});var Jy=nt((zq,Zy)=>{"use strict";var CC=Zr(),Yy=CC.navigator,$y=Yy&&Yy.userAgent;Zy.exports=$y?String($y):""});var rv=nt((Gq,nv)=>{"use strict";var ev=Zr(),_p=Jy(),Ky=ev.process,jy=ev.Deno,Qy=Ky&&Ky.versions||jy&&jy.version,tv=Qy&&Qy.v8,io,Ec;tv&&(io=tv.split("."),Ec=io[0]>0&&io[0]<4?1:+(io[0]+io[1]));!Ec&&_p&&(io=_p.match(/Edge\/(\d+)/),(!io||io[1]>=74)&&(io=_p.match(/Chrome\/(\d+)/),io&&(Ec=+io[1])));nv.exports=Ec});var xp=nt((kq,ov)=>{"use strict";var iv=rv(),PC=Ur(),IC=Zr(),RC=IC.String;ov.exports=!!Object.getOwnPropertySymbols&&!PC(function(){var r=Symbol("symbol detection");return!RC(r)||!(Object(r)instanceof Symbol)||!Symbol.sham&&iv&&iv<41})});var Ep=nt((qq,sv)=>{"use strict";var LC=xp();sv.exports=LC&&!Symbol.sham&&typeof Symbol.iterator=="symbol"});var Mp=nt((Vq,av)=>{"use strict";var NC=xc(),OC=Br(),DC=Xy(),FC=Ep(),UC=Object;av.exports=FC?function(r){return typeof r=="symbol"}:function(r){var t=NC("Symbol");return OC(t)&&DC(t.prototype,UC(r))}});var lv=nt((Hq,uv)=>{"use strict";var BC=String;uv.exports=function(r){try{return BC(r)}catch(t){return"Object"}}});var Sp=nt((Wq,cv)=>{"use strict";var zC=Br(),GC=lv(),kC=TypeError;cv.exports=function(r){if(zC(r))return r;throw new kC(GC(r)+" is not a function")}});var wp=nt((Xq,fv)=>{"use strict";var qC=Sp(),VC=gp();fv.exports=function(r,t){var e=r[t];return VC(e)?void 0:qC(e)}});var pv=nt((Yq,hv)=>{"use strict";var bp=Zo(),Tp=Br(),Ap=bo(),HC=TypeError;hv.exports=function(r,t){var e,o;if(t==="string"&&Tp(e=r.toString)&&!Ap(o=bp(e,r))||Tp(e=r.valueOf)&&!Ap(o=bp(e,r))||t!=="string"&&Tp(e=r.toString)&&!Ap(o=bp(e,r)))return o;throw new HC("Can't convert object to primitive value")}});var dl=nt(($q,dv)=>{"use strict";dv.exports=!1});var Mc=nt((Zq,gv)=>{"use strict";var mv=Zr(),WC=Object.defineProperty;gv.exports=function(r,t){try{WC(mv,r,{value:t,configurable:!0,writable:!0})}catch(e){mv[r]=t}return t}});var Sc=nt((Jq,_v)=>{"use strict";var XC=dl(),YC=Zr(),$C=Mc(),yv="__core-js_shared__",vv=_v.exports=YC[yv]||$C(yv,{});(vv.versions||(vv.versions=[])).push({version:"3.42.0",mode:XC?"pure":"global",copyright:"\xA9 2014-2025 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.42.0/LICENSE",source:"https://github.com/zloirock/core-js"})});var wc=nt((Kq,Ev)=>{"use strict";var xv=Sc();Ev.exports=function(r,t){return xv[r]||(xv[r]=t||{})}});var ml=nt((jq,Mv)=>{"use strict";var ZC=Ya(),JC=Object;Mv.exports=function(r){return JC(ZC(r))}});var To=nt((Qq,Sv)=>{"use strict";var KC=li(),jC=ml(),QC=KC({}.hasOwnProperty);Sv.exports=Object.hasOwn||function(t,e){return QC(jC(t),e)}});var Cp=nt((tV,wv)=>{"use strict";var tP=li(),eP=0,nP=Math.random(),rP=tP(1 .toString);wv.exports=function(r){return"Symbol("+(r===void 0?"":r)+")_"+rP(++eP+nP,36)}});var oo=nt((eV,Tv)=>{"use strict";var iP=Zr(),oP=wc(),bv=To(),sP=Cp(),aP=xp(),uP=Ep(),Za=iP.Symbol,Pp=oP("wks"),lP=uP?Za.for||Za:Za&&Za.withoutSetter||sP;Tv.exports=function(r){return bv(Pp,r)||(Pp[r]=aP&&bv(Za,r)?Za[r]:lP("Symbol."+r)),Pp[r]}});var Iv=nt((nV,Pv)=>{"use strict";var cP=Zo(),Av=bo(),Cv=Mp(),fP=wp(),hP=pv(),pP=oo(),dP=TypeError,mP=pP("toPrimitive");Pv.exports=function(r,t){if(!Av(r)||Cv(r))return r;var e=fP(r,mP),o;if(e){if(t===void 0&&(t="default"),o=cP(e,r,t),!Av(o)||Cv(o))return o;throw new dP("Can't convert object to primitive value")}return t===void 0&&(t="number"),hP(r,t)}});var Ip=nt((rV,Rv)=>{"use strict";var gP=Iv(),yP=Mp();Rv.exports=function(r){var t=gP(r,"string");return yP(t)?t:t+""}});var bc=nt((iV,Nv)=>{"use strict";var vP=Zr(),Lv=bo(),Rp=vP.document,_P=Lv(Rp)&&Lv(Rp.createElement);Nv.exports=function(r){return _P?Rp.createElement(r):{}}});var Lp=nt((oV,Ov)=>{"use strict";var xP=ro(),EP=Ur(),MP=bc();Ov.exports=!xP&&!EP(function(){return Object.defineProperty(MP("div"),"a",{get:function(){return 7}}).a!==7})});var Np=nt(Fv=>{"use strict";var SP=ro(),wP=Zo(),bP=Iy(),TP=_c(),AP=$a(),CP=Ip(),PP=To(),IP=Lp(),Dv=Object.getOwnPropertyDescriptor;Fv.f=SP?Dv:function(t,e){if(t=AP(t),e=CP(e),IP)try{return Dv(t,e)}catch(o){}if(PP(t,e))return TP(!wP(bP.f,t,e),t[e])}});var Op=nt((aV,Uv)=>{"use strict";var RP=ro(),LP=Ur();Uv.exports=RP&&LP(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42})});var _s=nt((uV,Bv)=>{"use strict";var NP=bo(),OP=String,DP=TypeError;Bv.exports=function(r){if(NP(r))return r;throw new DP(OP(r)+" is not an object")}});var xs=nt(Gv=>{"use strict";var FP=ro(),UP=Lp(),BP=Op(),Tc=_s(),zv=Ip(),zP=TypeError,Dp=Object.defineProperty,GP=Object.getOwnPropertyDescriptor,Fp="enumerable",Up="configurable",Bp="writable";Gv.f=FP?BP?function(t,e,o){if(Tc(t),e=zv(e),Tc(o),typeof t=="function"&&e==="prototype"&&"value"in o&&Bp in o&&!o[Bp]){var a=GP(t,e);a&&a[Bp]&&(t[e]=o.value,o={configurable:Up in o?o[Up]:a[Up],enumerable:Fp in o?o[Fp]:a[Fp],writable:!1})}return Dp(t,e,o)}:Dp:function(t,e,o){if(Tc(t),e=zv(e),Tc(o),UP)try{return Dp(t,e,o)}catch(a){}if("get"in o||"set"in o)throw new zP("Accessors not supported");return"value"in o&&(t[e]=o.value),t}});var Ja=nt((cV,kv)=>{"use strict";var kP=ro(),qP=xs(),VP=_c();kv.exports=kP?function(r,t,e){return qP.f(r,t,VP(1,e))}:function(r,t,e){return r[t]=e,r}});var kp=nt((fV,Vv)=>{"use strict";var zp=ro(),HP=To(),qv=Function.prototype,WP=zp&&Object.getOwnPropertyDescriptor,Gp=HP(qv,"name"),XP=Gp&&function(){}.name==="something",YP=Gp&&(!zp||zp&&WP(qv,"name").configurable);Vv.exports={EXISTS:Gp,PROPER:XP,CONFIGURABLE:YP}});var Wv=nt((hV,Hv)=>{"use strict";var $P=li(),ZP=Br(),qp=Sc(),JP=$P(Function.toString);ZP(qp.inspectSource)||(qp.inspectSource=function(r){return JP(r)});Hv.exports=qp.inspectSource});var $v=nt((pV,Yv)=>{"use strict";var KP=Zr(),jP=Br(),Xv=KP.WeakMap;Yv.exports=jP(Xv)&&/native code/.test(String(Xv))});var Ac=nt((dV,Jv)=>{"use strict";var QP=wc(),tI=Cp(),Zv=QP("keys");Jv.exports=function(r){return Zv[r]||(Zv[r]=tI(r))}});var Cc=nt((mV,Kv)=>{"use strict";Kv.exports={}});var Rc=nt((gV,t_)=>{"use strict";var eI=$v(),Qv=Zr(),nI=bo(),rI=Ja(),Vp=To(),Hp=Sc(),iI=Ac(),oI=Cc(),jv="Object already initialized",Wp=Qv.TypeError,sI=Qv.WeakMap,Pc,gl,Ic,aI=function(r){return Ic(r)?gl(r):Pc(r,{})},uI=function(r){return function(t){var e;if(!nI(t)||(e=gl(t)).type!==r)throw new Wp("Incompatible receiver, "+r+" required");return e}};eI||Hp.state?(so=Hp.state||(Hp.state=new sI),so.get=so.get,so.has=so.has,so.set=so.set,Pc=function(r,t){if(so.has(r))throw new Wp(jv);return t.facade=r,so.set(r,t),t},gl=function(r){return so.get(r)||{}},Ic=function(r){return so.has(r)}):(oa=iI("state"),oI[oa]=!0,Pc=function(r,t){if(Vp(r,oa))throw new Wp(jv);return t.facade=r,rI(r,oa,t),t},gl=function(r){return Vp(r,oa)?r[oa]:{}},Ic=function(r){return Vp(r,oa)});var so,oa;t_.exports={set:Pc,get:gl,has:Ic,enforce:aI,getterFor:uI}});var i_=nt((yV,r_)=>{"use strict";var Yp=li(),lI=Ur(),cI=Br(),Lc=To(),Xp=ro(),fI=kp().CONFIGURABLE,hI=Wv(),n_=Rc(),pI=n_.enforce,dI=n_.get,e_=String,Nc=Object.defineProperty,mI=Yp("".slice),gI=Yp("".replace),yI=Yp([].join),vI=Xp&&!lI(function(){return Nc(function(){},"length",{value:8}).length!==8}),_I=String(String).split("String"),xI=r_.exports=function(r,t,e){mI(e_(t),0,7)==="Symbol("&&(t="["+gI(e_(t),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),e&&e.getter&&(t="get "+t),e&&e.setter&&(t="set "+t),(!Lc(r,"name")||fI&&r.name!==t)&&(Xp?Nc(r,"name",{value:t,configurable:!0}):r.name=t),vI&&e&&Lc(e,"arity")&&r.length!==e.arity&&Nc(r,"length",{value:e.arity});try{e&&Lc(e,"constructor")&&e.constructor?Xp&&Nc(r,"prototype",{writable:!1}):r.prototype&&(r.prototype=void 0)}catch(a){}var o=pI(r);return Lc(o,"source")||(o.source=yI(_I,typeof t=="string"?t:"")),r};Function.prototype.toString=xI(function(){return cI(this)&&dI(this).source||hI(this)},"toString")});var yl=nt((vV,o_)=>{"use strict";var EI=Br(),MI=xs(),SI=i_(),wI=Mc();o_.exports=function(r,t,e,o){o||(o={});var a=o.enumerable,l=o.name!==void 0?o.name:t;if(EI(e)&&SI(e,l,o),o.global)a?r[t]=e:wI(t,e);else{try{o.unsafe?r[t]&&(a=!0):delete r[t]}catch(h){}a?r[t]=e:MI.f(r,t,{value:e,enumerable:!1,configurable:!o.nonConfigurable,writable:!o.nonWritable})}return r}});var a_=nt((_V,s_)=>{"use strict";var bI=Math.ceil,TI=Math.floor;s_.exports=Math.trunc||function(t){var e=+t;return(e>0?TI:bI)(e)}});var vl=nt((xV,u_)=>{"use strict";var AI=a_();u_.exports=function(r){var t=+r;return t!==t||t===0?0:AI(t)}});var c_=nt((EV,l_)=>{"use strict";var CI=vl(),PI=Math.max,II=Math.min;l_.exports=function(r,t){var e=CI(r);return e<0?PI(e+t,0):II(e,t)}});var $p=nt((MV,f_)=>{"use strict";var RI=vl(),LI=Math.min;f_.exports=function(r){var t=RI(r);return t>0?LI(t,9007199254740991):0}});var Zp=nt((SV,h_)=>{"use strict";var NI=$p();h_.exports=function(r){return NI(r.length)}});var m_=nt((wV,d_)=>{"use strict";var OI=$a(),DI=c_(),FI=Zp(),p_=function(r){return function(t,e,o){var a=OI(t),l=FI(a);if(l===0)return!r&&-1;var h=DI(o,l),f;if(r&&e!==e){for(;l>h;)if(f=a[h++],f!==f)return!0}else for(;l>h;h++)if((r||h in a)&&a[h]===e)return r||h||0;return!r&&-1}};d_.exports={includes:p_(!0),indexOf:p_(!1)}});var Kp=nt((bV,y_)=>{"use strict";var UI=li(),Jp=To(),BI=$a(),zI=m_().indexOf,GI=Cc(),g_=UI([].push);y_.exports=function(r,t){var e=BI(r),o=0,a=[],l;for(l in e)!Jp(GI,l)&&Jp(e,l)&&g_(a,l);for(;t.length>o;)Jp(e,l=t[o++])&&(~zI(a,l)||g_(a,l));return a}});var Oc=nt((TV,v_)=>{"use strict";v_.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]});var x_=nt(__=>{"use strict";var kI=Kp(),qI=Oc(),VI=qI.concat("length","prototype");__.f=Object.getOwnPropertyNames||function(t){return kI(t,VI)}});var M_=nt(E_=>{"use strict";E_.f=Object.getOwnPropertySymbols});var w_=nt((PV,S_)=>{"use strict";var HI=xc(),WI=li(),XI=x_(),YI=M_(),$I=_s(),ZI=WI([].concat);S_.exports=HI("Reflect","ownKeys")||function(t){var e=XI.f($I(t)),o=YI.f;return o?ZI(e,o(t)):e}});var A_=nt((IV,T_)=>{"use strict";var b_=To(),JI=w_(),KI=Np(),jI=xs();T_.exports=function(r,t,e){for(var o=JI(t),a=jI.f,l=KI.f,h=0;h<o.length;h++){var f=o[h];!b_(r,f)&&!(e&&b_(e,f))&&a(r,f,l(t,f))}}});var P_=nt((RV,C_)=>{"use strict";var QI=Ur(),tR=Br(),eR=/#|\.prototype\./,_l=function(r,t){var e=rR[nR(r)];return e===oR?!0:e===iR?!1:tR(t)?QI(t):!!t},nR=_l.normalize=function(r){return String(r).replace(eR,".").toLowerCase()},rR=_l.data={},iR=_l.NATIVE="N",oR=_l.POLYFILL="P";C_.exports=_l});var Fc=nt((LV,I_)=>{"use strict";var Dc=Zr(),sR=Np().f,aR=Ja(),uR=yl(),lR=Mc(),cR=A_(),fR=P_();I_.exports=function(r,t){var e=r.target,o=r.global,a=r.stat,l,h,f,p,d,g;if(o?h=Dc:a?h=Dc[e]||lR(e,{}):h=Dc[e]&&Dc[e].prototype,h)for(f in t){if(d=t[f],r.dontCallGetSet?(g=sR(h,f),p=g&&g.value):p=h[f],l=fR(o?f:e+(a?".":"#")+f,r.forced),!l&&p!==void 0){if(typeof d==typeof p)continue;cR(d,p)}(r.sham||p&&p.sham)&&aR(d,"sham",!0),uR(h,f,d,r)}}});var L_=nt((NV,R_)=>{"use strict";var hR=pl();R_.exports=Array.isArray||function(t){return hR(t)==="Array"}});var O_=nt((OV,N_)=>{"use strict";var pR=ro(),dR=L_(),mR=TypeError,gR=Object.getOwnPropertyDescriptor,yR=pR&&!function(){if(this!==void 0)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(r){return r instanceof TypeError}}();N_.exports=yR?function(r,t){if(dR(r)&&!gR(r,"length").writable)throw new mR("Cannot set read only .length");return r.length=t}:function(r,t){return r.length=t}});var F_=nt((DV,D_)=>{"use strict";var vR=TypeError,_R=9007199254740991;D_.exports=function(r){if(r>_R)throw vR("Maximum allowed index exceeded");return r}});var Uc=nt(()=>{"use strict";var xR=Fc(),ER=ml(),MR=Zp(),SR=O_(),wR=F_(),bR=Ur(),TR=bR(function(){return[].push.call({length:4294967296},1)!==4294967297}),AR=function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(r){return r instanceof TypeError}},CR=TR||!AR();xR({target:"Array",proto:!0,arity:1,forced:CR},{push:function(t){var e=ER(this),o=MR(e),a=arguments.length;wR(o+a);for(var l=0;l<a;l++)e[o]=arguments[l],o++;return SR(e,o),o}})});var B_=nt((BV,U_)=>{"use strict";U_.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}});var k_=nt((zV,G_)=>{"use strict";var PR=bc(),jp=PR("span").classList,z_=jp&&jp.constructor&&jp.constructor.prototype;G_.exports=z_===Object.prototype?void 0:z_});var V_=nt((GV,q_)=>{"use strict";var IR=Kp(),RR=Oc();q_.exports=Object.keys||function(t){return IR(t,RR)}});var W_=nt(H_=>{"use strict";var LR=ro(),NR=Op(),OR=xs(),DR=_s(),FR=$a(),UR=V_();H_.f=LR&&!NR?Object.defineProperties:function(t,e){DR(t);for(var o=FR(e),a=UR(e),l=a.length,h=0,f;l>h;)OR.f(t,f=a[h++],o[f]);return t}});var Y_=nt((qV,X_)=>{"use strict";var BR=xc();X_.exports=BR("document","documentElement")});var xl=nt((VV,tx)=>{"use strict";var zR=_s(),GR=W_(),$_=Oc(),kR=Cc(),qR=Y_(),VR=bc(),HR=Ac(),Z_=">",J_="<",td="prototype",ed="script",j_=HR("IE_PROTO"),Qp=function(){},Q_=function(r){return J_+ed+Z_+r+J_+"/"+ed+Z_},K_=function(r){r.write(Q_("")),r.close();var t=r.parentWindow.Object;return r=null,t},WR=function(){var r=VR("iframe"),t="java"+ed+":",e;return r.style.display="none",qR.appendChild(r),r.src=String(t),e=r.contentWindow.document,e.open(),e.write(Q_("document.F=Object")),e.close(),e.F},Bc,zc=function(){try{Bc=new ActiveXObject("htmlfile")}catch(t){}zc=typeof document!="undefined"?document.domain&&Bc?K_(Bc):WR():K_(Bc);for(var r=$_.length;r--;)delete zc[td][$_[r]];return zc()};kR[j_]=!0;tx.exports=Object.create||function(t,e){var o;return t!==null?(Qp[td]=zR(t),o=new Qp,Qp[td]=null,o[j_]=t):o=zc(),e===void 0?o:GR.f(o,e)}});var nx=nt((HV,ex)=>{"use strict";var XR=oo(),YR=xl(),$R=xs().f,nd=XR("unscopables"),rd=Array.prototype;rd[nd]===void 0&&$R(rd,nd,{configurable:!0,value:YR(null)});ex.exports=function(r){rd[nd][r]=!0}});var Gc=nt((WV,rx)=>{"use strict";rx.exports={}});var ox=nt((XV,ix)=>{"use strict";var ZR=Ur();ix.exports=!ZR(function(){function r(){}return r.prototype.constructor=null,Object.getPrototypeOf(new r)!==r.prototype})});var od=nt((YV,ax)=>{"use strict";var JR=To(),KR=Br(),jR=ml(),QR=Ac(),tL=ox(),sx=QR("IE_PROTO"),id=Object,eL=id.prototype;ax.exports=tL?id.getPrototypeOf:function(r){var t=jR(r);if(JR(t,sx))return t[sx];var e=t.constructor;return KR(e)&&t instanceof e?e.prototype:t instanceof id?eL:null}});var ld=nt(($V,cx)=>{"use strict";var nL=Ur(),rL=Br(),iL=bo(),oL=xl(),ux=od(),sL=yl(),aL=oo(),uL=dl(),ud=aL("iterator"),lx=!1,Jo,sd,ad;[].keys&&(ad=[].keys(),"next"in ad?(sd=ux(ux(ad)),sd!==Object.prototype&&(Jo=sd)):lx=!0);var lL=!iL(Jo)||nL(function(){var r={};return Jo[ud].call(r)!==r});lL?Jo={}:uL&&(Jo=oL(Jo));rL(Jo[ud])||sL(Jo,ud,function(){return this});cx.exports={IteratorPrototype:Jo,BUGGY_SAFARI_ITERATORS:lx}});var kc=nt((ZV,hx)=>{"use strict";var cL=xs().f,fL=To(),hL=oo(),fx=hL("toStringTag");hx.exports=function(r,t,e){r&&!e&&(r=r.prototype),r&&!fL(r,fx)&&cL(r,fx,{configurable:!0,value:t})}});var dx=nt((JV,px)=>{"use strict";var pL=ld().IteratorPrototype,dL=xl(),mL=_c(),gL=kc(),yL=Gc(),vL=function(){return this};px.exports=function(r,t,e,o){var a=t+" Iterator";return r.prototype=dL(pL,{next:mL(+!o,e)}),gL(r,a,!1,!0),yL[a]=vL,r}});var gx=nt((KV,mx)=>{"use strict";var _L=li(),xL=Sp();mx.exports=function(r,t,e){try{return _L(xL(Object.getOwnPropertyDescriptor(r,t)[e]))}catch(o){}}});var vx=nt((jV,yx)=>{"use strict";var EL=bo();yx.exports=function(r){return EL(r)||r===null}});var xx=nt((QV,_x)=>{"use strict";var ML=vx(),SL=String,wL=TypeError;_x.exports=function(r){if(ML(r))return r;throw new wL("Can't set "+SL(r)+" as a prototype")}});var Mx=nt((tH,Ex)=>{"use strict";var bL=gx(),TL=bo(),AL=Ya(),CL=xx();Ex.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var r=!1,t={},e;try{e=bL(Object.prototype,"__proto__","set"),e(t,[]),r=t instanceof Array}catch(o){}return function(a,l){return AL(a),CL(l),TL(a)&&(r?e(a,l):a.__proto__=l),a}}():void 0)});var Nx=nt((eH,Lx)=>{"use strict";var PL=Fc(),IL=Zo(),qc=dl(),Ix=kp(),RL=Br(),LL=dx(),Sx=od(),wx=Mx(),NL=kc(),OL=Ja(),cd=yl(),DL=oo(),bx=Gc(),Rx=ld(),FL=Ix.PROPER,UL=Ix.CONFIGURABLE,Tx=Rx.IteratorPrototype,Vc=Rx.BUGGY_SAFARI_ITERATORS,El=DL("iterator"),Ax="keys",Ml="values",Cx="entries",Px=function(){return this};Lx.exports=function(r,t,e,o,a,l,h){LL(e,t,o);var f=function(y){if(y===a&&v)return v;if(!Vc&&y&&y in g)return g[y];switch(y){case Ax:return function(){return new e(this,y)};case Ml:return function(){return new e(this,y)};case Cx:return function(){return new e(this,y)}}return function(){return new e(this)}},p=t+" Iterator",d=!1,g=r.prototype,x=g[El]||g["@@iterator"]||a&&g[a],v=!Vc&&x||f(a),M=t==="Array"&&g.entries||x,b,T,_;if(M&&(b=Sx(M.call(new r)),b!==Object.prototype&&b.next&&(!qc&&Sx(b)!==Tx&&(wx?wx(b,Tx):RL(b[El])||cd(b,El,Px)),NL(b,p,!0,!0),qc&&(bx[p]=Px))),FL&&a===Ml&&x&&x.name!==Ml&&(!qc&&UL?OL(g,"name",Ml):(d=!0,v=function(){return IL(x,this)})),a)if(T={values:f(Ml),keys:l?v:f(Ax),entries:f(Cx)},h)for(_ in T)(Vc||d||!(_ in g))&&cd(g,_,T[_]);else PL({target:t,proto:!0,forced:Vc||d},T);return(!qc||h)&&g[El]!==v&&cd(g,El,v,{name:a}),bx[t]=v,T}});var Dx=nt((nH,Ox)=>{"use strict";Ox.exports=function(r,t){return{value:r,done:t}}});var kx=nt((rH,Gx)=>{"use strict";var BL=$a(),fd=nx(),Fx=Gc(),Bx=Rc(),zL=xs().f,GL=Nx(),Hc=Dx(),kL=dl(),qL=ro(),zx="Array Iterator",VL=Bx.set,HL=Bx.getterFor(zx);Gx.exports=GL(Array,"Array",function(r,t){VL(this,{type:zx,target:BL(r),index:0,kind:t})},function(){var r=HL(this),t=r.target,e=r.index++;if(!t||e>=t.length)return r.target=null,Hc(void 0,!0);switch(r.kind){case"keys":return Hc(e,!1);case"values":return Hc(t[e],!1)}return Hc([e,t[e]],!1)},"values");var Ux=Fx.Arguments=Fx.Array;fd("keys");fd("values");fd("entries");if(!kL&&qL&&Ux.name!=="values")try{zL(Ux,"name",{value:"values"})}catch(r){}});var Xc=nt(()=>{"use strict";var qx=Zr(),Hx=B_(),WL=k_(),Sl=kx(),Vx=Ja(),XL=kc(),YL=oo(),hd=YL("iterator"),pd=Sl.values,Wx=function(r,t){if(r){if(r[hd]!==pd)try{Vx(r,hd,pd)}catch(o){r[hd]=pd}if(XL(r,t,!0),Hx[t]){for(var e in Sl)if(r[e]!==Sl[e])try{Vx(r,e,Sl[e])}catch(o){r[e]=Sl[e]}}}};for(Wc in Hx)Wx(qx[Wc]&&qx[Wc].prototype,Wc);var Wc;Wx(WL,"DOMTokenList")});var $x=nt((sH,Yx)=>{"use strict";var $L=oo(),ZL=$L("toStringTag"),Xx={};Xx[ZL]="z";Yx.exports=String(Xx)==="[object z]"});var Jx=nt((aH,Zx)=>{"use strict";var JL=$x(),KL=Br(),Yc=pl(),jL=oo(),QL=jL("toStringTag"),tN=Object,eN=Yc(function(){return arguments}())==="Arguments",nN=function(r,t){try{return r[t]}catch(e){}};Zx.exports=JL?Yc:function(r){var t,e,o;return r===void 0?"Undefined":r===null?"Null":typeof(e=nN(t=tN(r),QL))=="string"?e:eN?Yc(t):(o=Yc(t))==="Object"&&KL(t.callee)?"Arguments":o}});var $c=nt((uH,Kx)=>{"use strict";var rN=Jx(),iN=String;Kx.exports=function(r){if(rN(r)==="Symbol")throw new TypeError("Cannot convert a Symbol value to a string");return iN(r)}});var Qx=nt((lH,jx)=>{"use strict";var oN=_s();jx.exports=function(){var r=oN(this),t="";return r.hasIndices&&(t+="d"),r.global&&(t+="g"),r.ignoreCase&&(t+="i"),r.multiline&&(t+="m"),r.dotAll&&(t+="s"),r.unicode&&(t+="u"),r.unicodeSets&&(t+="v"),r.sticky&&(t+="y"),t}});var e1=nt((cH,t1)=>{"use strict";var dd=Ur(),sN=Zr(),md=sN.RegExp,gd=dd(function(){var r=md("a","y");return r.lastIndex=2,r.exec("abcd")!==null}),aN=gd||dd(function(){return!md("a","y").sticky}),uN=gd||dd(function(){var r=md("^r","gy");return r.lastIndex=2,r.exec("str")!==null});t1.exports={BROKEN_CARET:uN,MISSED_STICKY:aN,UNSUPPORTED_Y:gd}});var r1=nt((fH,n1)=>{"use strict";var lN=Ur(),cN=Zr(),fN=cN.RegExp;n1.exports=lN(function(){var r=fN(".","s");return!(r.dotAll&&r.test(`
|
|
2
|
+
`)&&r.flags==="s")})});var o1=nt((hH,i1)=>{"use strict";var hN=Ur(),pN=Zr(),dN=pN.RegExp;i1.exports=hN(function(){var r=dN("(?<a>b)","g");return r.exec("b").groups.a!=="b"||"b".replace(r,"$<a>c")!=="bc"})});var Kc=nt((pH,a1)=>{"use strict";var Ka=Zo(),Jc=li(),mN=$c(),gN=Qx(),yN=e1(),vN=wc(),_N=xl(),xN=Rc().get,EN=r1(),MN=o1(),SN=vN("native-string-replace",String.prototype.replace),Zc=RegExp.prototype.exec,vd=Zc,wN=Jc("".charAt),bN=Jc("".indexOf),TN=Jc("".replace),yd=Jc("".slice),_d=function(){var r=/a/,t=/b*/g;return Ka(Zc,r,"a"),Ka(Zc,t,"a"),r.lastIndex!==0||t.lastIndex!==0}(),s1=yN.BROKEN_CARET,xd=/()??/.exec("")[1]!==void 0,AN=_d||xd||s1||EN||MN;AN&&(vd=function(t){var e=this,o=xN(e),a=mN(t),l=o.raw,h,f,p,d,g,x,v;if(l)return l.lastIndex=e.lastIndex,h=Ka(vd,l,a),e.lastIndex=l.lastIndex,h;var M=o.groups,b=s1&&e.sticky,T=Ka(gN,e),_=e.source,y=0,A=a;if(b&&(T=TN(T,"y",""),bN(T,"g")===-1&&(T+="g"),A=yd(a,e.lastIndex),e.lastIndex>0&&(!e.multiline||e.multiline&&wN(a,e.lastIndex-1)!==`
|
|
3
|
+
`)&&(_="(?: "+_+")",A=" "+A,y++),f=new RegExp("^(?:"+_+")",T)),xd&&(f=new RegExp("^"+_+"$(?!\\s)",T)),_d&&(p=e.lastIndex),d=Ka(Zc,b?f:e,A),b?d?(d.input=yd(d.input,y),d[0]=yd(d[0],y),d.index=e.lastIndex,e.lastIndex+=d[0].length):e.lastIndex=0:_d&&d&&(e.lastIndex=e.global?d.index+d[0].length:p),xd&&d&&d.length>1&&Ka(SN,d[0],f,function(){for(g=1;g<arguments.length-2;g++)arguments[g]===void 0&&(d[g]=void 0)}),d&&M)for(d.groups=x=_N(null),g=0;g<M.length;g++)v=M[g],x[v[0]]=d[v[1]];return d});a1.exports=vd});var jc=nt(()=>{"use strict";var CN=Fc(),u1=Kc();CN({target:"RegExp",proto:!0,forced:/./.exec!==u1},{exec:u1})});var c1=nt((gH,l1)=>{var Ed=class{constructor(){this.keys=new Set,this.queue=[]}sort(){this.queue.sort((t,e)=>t.priority-e.priority)}set(t,e){let o=Number(e);if(isNaN(o))throw new TypeError('"priority" must be a number');return this.keys.has(t)?this.queue.map(a=>(a.key===t&&Object.assign(a,{priority:o}),a)):(this.keys.add(t),this.queue.push({key:t,priority:o})),this.sort(),this.queue.length}next(){let t=this.queue.shift();return this.keys.delete(t.key),t}isEmpty(){return this.queue.length===0}has(t){return this.keys.has(t)}get(t){return this.queue.find(e=>e.key===t)}};l1.exports=Ed});var p1=nt((yH,h1)=>{function f1(r,t){let e=new Map;for(let[o,a]of r)o!==t&&a instanceof Map?e.set(o,f1(a,t)):o!==t&&e.set(o,a);return e}h1.exports=f1});var g1=nt((vH,m1)=>{function PN(r){let t=Number(r);return!(isNaN(t)||t<=0)}function d1(r){let t=new Map;return Object.keys(r).forEach(o=>{let a=r[o];if(a!==null&&typeof a=="object"&&!Array.isArray(a))return t.set(o,d1(a));if(!PN(a))throw new Error(`Could not add node at key "${o}", make sure it's a valid node`,a);return t.set(o,Number(a))}),t}m1.exports=d1});var _1=nt((_H,v1)=>{function y1(r){if(!(r instanceof Map))throw new Error(`Invalid graph: Expected Map instead found ${typeof r}`);r.forEach((t,e)=>{if(typeof t=="object"&&t instanceof Map){y1(t);return}if(typeof t!="number"||t<=0)throw new Error(`Values must be numbers greater than 0. Found value ${t} at ${e}`)})}v1.exports=y1});var S1=nt((xH,M1)=>{var IN=c1(),RN=p1(),x1=g1(),E1=_1(),Md=class{constructor(t){t instanceof Map?(E1(t),this.graph=t):t?this.graph=x1(t):this.graph=new Map}addNode(t,e){let o;return e instanceof Map?(E1(e),o=e):o=x1(e),this.graph.set(t,o),this}addVertex(t,e){return this.addNode(t,e)}removeNode(t){return this.graph=RN(this.graph,t),this}path(t,e,o={}){if(!this.graph.size)return o.cost?{path:null,cost:0}:null;let a=new Set,l=new IN,h=new Map,f=[],p=0,d=[];if(o.avoid&&(d=[].concat(o.avoid)),d.includes(t))throw new Error(`Starting node (${t}) cannot be avoided`);if(d.includes(e))throw new Error(`Ending node (${e}) cannot be avoided`);for(l.set(t,0);!l.isEmpty();){let g=l.next();if(g.key===e){p=g.priority;let v=g.key;for(;h.has(v);)f.push(v),v=h.get(v);break}a.add(g.key),(this.graph.get(g.key)||new Map).forEach((v,M)=>{if(a.has(M)||d.includes(M))return null;if(!l.has(M))return h.set(M,g.key),l.set(M,g.priority+v);let b=l.get(M).priority,T=g.priority+v;return T<b?(h.set(M,g.key),l.set(M,T)):null})}return f.length?(o.trim?f.shift():f=f.concat([t]),o.reverse||(f=f.reverse()),o.cost?{path:f,cost:p}:f):o.cost?{path:null,cost:0}:null}shortestPath(...t){return this.path(...t)}};M1.exports=Md});var Jf=nt((LH,_M)=>{"use strict";var vM=Object.getOwnPropertySymbols,VU=Object.prototype.hasOwnProperty,HU=Object.prototype.propertyIsEnumerable;function WU(r){if(r==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(r)}function XU(){try{if(!Object.assign)return!1;var r=new String("abc");if(r[5]="de",Object.getOwnPropertyNames(r)[0]==="5")return!1;for(var t={},e=0;e<10;e++)t["_"+String.fromCharCode(e)]=e;var o=Object.getOwnPropertyNames(t).map(function(l){return t[l]});if(o.join("")!=="0123456789")return!1;var a={};return"abcdefghijklmnopqrst".split("").forEach(function(l){a[l]=l}),Object.keys(Object.assign({},a)).join("")==="abcdefghijklmnopqrst"}catch(l){return!1}}_M.exports=XU()?Object.assign:function(r,t){for(var e,o=WU(r),a,l=1;l<arguments.length;l++){e=Object(arguments[l]);for(var h in e)VU.call(e,h)&&(o[h]=e[h]);if(vM){a=vM(e);for(var f=0;f<a.length;f++)HU.call(e,a[f])&&(o[a[f]]=e[a[f]])}}return o}});var ng=nt((tg,eg)=>{(function(r,t){typeof tg=="object"&&typeof eg!="undefined"?eg.exports=t():typeof define=="function"&&define.amd?define(t):(r=r||self).RBush=t()})(tg,function(){"use strict";function r(_,y,A,S,L){(function G(z,F,I,ut,R){for(;ut>I;){if(ut-I>600){var W=ut-I+1,V=F-I+1,Mt=Math.log(W),X=.5*Math.exp(2*Mt/3),mt=.5*Math.sqrt(Mt*X*(W-X)/W)*(V-W/2<0?-1:1),dt=Math.max(I,Math.floor(F-V*X/W+mt)),_t=Math.min(ut,Math.floor(F+(W-V)*X/W+mt));G(z,F,dt,_t,R)}var it=z[F],lt=I,H=ut;for(t(z,I,F),R(z[ut],it)>0&&t(z,I,ut);lt<H;){for(t(z,lt,H),lt++,H--;R(z[lt],it)<0;)lt++;for(;R(z[H],it)>0;)H--}R(z[I],it)===0?t(z,I,H):t(z,++H,ut),H<=F&&(I=H+1),F<=H&&(ut=H-1)}})(_,y,A||0,S||_.length-1,L||e)}function t(_,y,A){var S=_[y];_[y]=_[A],_[A]=S}function e(_,y){return _<y?-1:_>y?1:0}var o=function(_){_===void 0&&(_=9),this._maxEntries=Math.max(4,_),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function a(_,y,A){if(!A)return y.indexOf(_);for(var S=0;S<y.length;S++)if(A(_,y[S]))return S;return-1}function l(_,y){h(_,0,_.children.length,y,_)}function h(_,y,A,S,L){L||(L=b(null)),L.minX=1/0,L.minY=1/0,L.maxX=-1/0,L.maxY=-1/0;for(var G=y;G<A;G++){var z=_.children[G];f(L,_.leaf?S(z):z)}return L}function f(_,y){return _.minX=Math.min(_.minX,y.minX),_.minY=Math.min(_.minY,y.minY),_.maxX=Math.max(_.maxX,y.maxX),_.maxY=Math.max(_.maxY,y.maxY),_}function p(_,y){return _.minX-y.minX}function d(_,y){return _.minY-y.minY}function g(_){return(_.maxX-_.minX)*(_.maxY-_.minY)}function x(_){return _.maxX-_.minX+(_.maxY-_.minY)}function v(_,y){return _.minX<=y.minX&&_.minY<=y.minY&&y.maxX<=_.maxX&&y.maxY<=_.maxY}function M(_,y){return y.minX<=_.maxX&&y.minY<=_.maxY&&y.maxX>=_.minX&&y.maxY>=_.minY}function b(_){return{children:_,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function T(_,y,A,S,L){for(var G=[y,A];G.length;)if(!((A=G.pop())-(y=G.pop())<=S)){var z=y+Math.ceil((A-y)/S/2)*S;r(_,z,y,A,L),G.push(y,z,z,A)}}return o.prototype.all=function(){return this._all(this.data,[])},o.prototype.search=function(_){var y=this.data,A=[];if(!M(_,y))return A;for(var S=this.toBBox,L=[];y;){for(var G=0;G<y.children.length;G++){var z=y.children[G],F=y.leaf?S(z):z;M(_,F)&&(y.leaf?A.push(z):v(_,F)?this._all(z,A):L.push(z))}y=L.pop()}return A},o.prototype.collides=function(_){var y=this.data;if(!M(_,y))return!1;for(var A=[];y;){for(var S=0;S<y.children.length;S++){var L=y.children[S],G=y.leaf?this.toBBox(L):L;if(M(_,G)){if(y.leaf||v(_,G))return!0;A.push(L)}}y=A.pop()}return!1},o.prototype.load=function(_){if(!_||!_.length)return this;if(_.length<this._minEntries){for(var y=0;y<_.length;y++)this.insert(_[y]);return this}var A=this._build(_.slice(),0,_.length-1,0);if(this.data.children.length)if(this.data.height===A.height)this._splitRoot(this.data,A);else{if(this.data.height<A.height){var S=this.data;this.data=A,A=S}this._insert(A,this.data.height-A.height-1,!0)}else this.data=A;return this},o.prototype.insert=function(_){return _&&this._insert(_,this.data.height-1),this},o.prototype.clear=function(){return this.data=b([]),this},o.prototype.remove=function(_,y){if(!_)return this;for(var A,S,L,G=this.data,z=this.toBBox(_),F=[],I=[];G||F.length;){if(G||(G=F.pop(),S=F[F.length-1],A=I.pop(),L=!0),G.leaf){var ut=a(_,G.children,y);if(ut!==-1)return G.children.splice(ut,1),F.push(G),this._condense(F),this}L||G.leaf||!v(G,z)?S?(A++,G=S.children[A],L=!1):G=null:(F.push(G),I.push(A),A=0,S=G,G=G.children[0])}return this},o.prototype.toBBox=function(_){return _},o.prototype.compareMinX=function(_,y){return _.minX-y.minX},o.prototype.compareMinY=function(_,y){return _.minY-y.minY},o.prototype.toJSON=function(){return this.data},o.prototype.fromJSON=function(_){return this.data=_,this},o.prototype._all=function(_,y){for(var A=[];_;)_.leaf?y.push.apply(y,_.children):A.push.apply(A,_.children),_=A.pop();return y},o.prototype._build=function(_,y,A,S){var L,G=A-y+1,z=this._maxEntries;if(G<=z)return l(L=b(_.slice(y,A+1)),this.toBBox),L;S||(S=Math.ceil(Math.log(G)/Math.log(z)),z=Math.ceil(G/Math.pow(z,S-1))),(L=b([])).leaf=!1,L.height=S;var F=Math.ceil(G/z),I=F*Math.ceil(Math.sqrt(z));T(_,y,A,I,this.compareMinX);for(var ut=y;ut<=A;ut+=I){var R=Math.min(ut+I-1,A);T(_,ut,R,F,this.compareMinY);for(var W=ut;W<=R;W+=F){var V=Math.min(W+F-1,R);L.children.push(this._build(_,W,V,S-1))}}return l(L,this.toBBox),L},o.prototype._chooseSubtree=function(_,y,A,S){for(;S.push(y),!y.leaf&&S.length-1!==A;){for(var L=1/0,G=1/0,z=void 0,F=0;F<y.children.length;F++){var I=y.children[F],ut=g(I),R=(W=_,V=I,(Math.max(V.maxX,W.maxX)-Math.min(V.minX,W.minX))*(Math.max(V.maxY,W.maxY)-Math.min(V.minY,W.minY))-ut);R<G?(G=R,L=ut<L?ut:L,z=I):R===G&&ut<L&&(L=ut,z=I)}y=z||y.children[0]}var W,V;return y},o.prototype._insert=function(_,y,A){var S=A?_:this.toBBox(_),L=[],G=this._chooseSubtree(S,this.data,y,L);for(G.children.push(_),f(G,S);y>=0&&L[y].children.length>this._maxEntries;)this._split(L,y),y--;this._adjustParentBBoxes(S,L,y)},o.prototype._split=function(_,y){var A=_[y],S=A.children.length,L=this._minEntries;this._chooseSplitAxis(A,L,S);var G=this._chooseSplitIndex(A,L,S),z=b(A.children.splice(G,A.children.length-G));z.height=A.height,z.leaf=A.leaf,l(A,this.toBBox),l(z,this.toBBox),y?_[y-1].children.push(z):this._splitRoot(A,z)},o.prototype._splitRoot=function(_,y){this.data=b([_,y]),this.data.height=_.height+1,this.data.leaf=!1,l(this.data,this.toBBox)},o.prototype._chooseSplitIndex=function(_,y,A){for(var S,L,G,z,F,I,ut,R=1/0,W=1/0,V=y;V<=A-y;V++){var Mt=h(_,0,V,this.toBBox),X=h(_,V,A,this.toBBox),mt=(L=Mt,G=X,z=void 0,F=void 0,I=void 0,ut=void 0,z=Math.max(L.minX,G.minX),F=Math.max(L.minY,G.minY),I=Math.min(L.maxX,G.maxX),ut=Math.min(L.maxY,G.maxY),Math.max(0,I-z)*Math.max(0,ut-F)),dt=g(Mt)+g(X);mt<R?(R=mt,S=V,W=dt<W?dt:W):mt===R&&dt<W&&(W=dt,S=V)}return S||A-y},o.prototype._chooseSplitAxis=function(_,y,A){var S=_.leaf?this.compareMinX:p,L=_.leaf?this.compareMinY:d;this._allDistMargin(_,y,A,S)<this._allDistMargin(_,y,A,L)&&_.children.sort(S)},o.prototype._allDistMargin=function(_,y,A,S){_.children.sort(S);for(var L=this.toBBox,G=h(_,0,y,L),z=h(_,A-y,A,L),F=x(G)+x(z),I=y;I<A-y;I++){var ut=_.children[I];f(G,_.leaf?L(ut):ut),F+=x(G)}for(var R=A-y-1;R>=y;R--){var W=_.children[R];f(z,_.leaf?L(W):W),F+=x(z)}return F},o.prototype._adjustParentBBoxes=function(_,y,A){for(var S=A;S>=0;S--)f(y[S],_)},o.prototype._condense=function(_){for(var y=_.length-1,A=void 0;y>=0;y--)_[y].children.length===0?y>0?(A=_[y-1].children).splice(A.indexOf(_[y]),1):this.clear():l(_[y],this.toBBox)},o})});var xM=nt((rg,ig)=>{(function(r,t){typeof rg=="object"&&typeof ig!="undefined"?ig.exports=t():typeof define=="function"&&define.amd?define(t):(r=r||self,r.TinyQueue=t())})(rg,function(){"use strict";var r=function(o,a){if(o===void 0&&(o=[]),a===void 0&&(a=t),this.data=o,this.length=this.data.length,this.compare=a,this.length>0)for(var l=(this.length>>1)-1;l>=0;l--)this._down(l)};r.prototype.push=function(o){this.data.push(o),this.length++,this._up(this.length-1)},r.prototype.pop=function(){if(this.length!==0){var o=this.data[0],a=this.data.pop();return this.length--,this.length>0&&(this.data[0]=a,this._down(0)),o}},r.prototype.peek=function(){return this.data[0]},r.prototype._up=function(o){for(var a=this,l=a.data,h=a.compare,f=l[o];o>0;){var p=o-1>>1,d=l[p];if(h(f,d)>=0)break;l[o]=d,o=p}l[o]=f},r.prototype._down=function(o){for(var a=this,l=a.data,h=a.compare,f=this.length>>1,p=l[o];o<f;){var d=(o<<1)+1,g=l[d],x=d+1;if(x<this.length&&h(l[x],g)<0&&(d=x,g=l[x]),h(g,p)>=0)break;l[o]=g,o=d}l[o]=p};function t(e,o){return e<o?-1:e>o?1:0}return r})});var MM=nt((BH,EM)=>{EM.exports=function(t,e,o,a){var l=t[0],h=t[1],f=!1;o===void 0&&(o=0),a===void 0&&(a=e.length);for(var p=(a-o)/2,d=0,g=p-1;d<p;g=d++){var x=e[o+d*2+0],v=e[o+d*2+1],M=e[o+g*2+0],b=e[o+g*2+1],T=v>h!=b>h&&l<(M-x)*(h-v)/(b-v)+x;T&&(f=!f)}return f}});var wM=nt((zH,SM)=>{SM.exports=function(t,e,o,a){var l=t[0],h=t[1],f=!1;o===void 0&&(o=0),a===void 0&&(a=e.length);for(var p=a-o,d=0,g=p-1;d<p;g=d++){var x=e[d+o][0],v=e[d+o][1],M=e[g+o][0],b=e[g+o][1],T=v>h!=b>h&&l<(M-x)*(h-v)/(b-v)+x;T&&(f=!f)}return f}});var AM=nt((GH,Qf)=>{var bM=MM(),TM=wM();Qf.exports=function(t,e,o,a){return e.length>0&&Array.isArray(e[0])?TM(t,e,o,a):bM(t,e,o,a)};Qf.exports.nested=TM;Qf.exports.flat=bM});var PM=nt((th,CM)=>{(function(r,t){typeof th=="object"&&typeof CM!="undefined"?t(th):typeof define=="function"&&define.amd?define(["exports"],t):t((r=r||self).predicates={})})(th,function(r){"use strict";let e=33306690738754706e-32;function o(M,b,T,_,y){let A,S,L,G,z=b[0],F=_[0],I=0,ut=0;F>z==F>-z?(A=z,z=b[++I]):(A=F,F=_[++ut]);let R=0;if(I<M&&ut<T)for(F>z==F>-z?(L=A-((S=z+A)-z),z=b[++I]):(L=A-((S=F+A)-F),F=_[++ut]),A=S,L!==0&&(y[R++]=L);I<M&&ut<T;)F>z==F>-z?(L=A-((S=A+z)-(G=S-A))+(z-G),z=b[++I]):(L=A-((S=A+F)-(G=S-A))+(F-G),F=_[++ut]),A=S,L!==0&&(y[R++]=L);for(;I<M;)L=A-((S=A+z)-(G=S-A))+(z-G),z=b[++I],A=S,L!==0&&(y[R++]=L);for(;ut<T;)L=A-((S=A+F)-(G=S-A))+(F-G),F=_[++ut],A=S,L!==0&&(y[R++]=L);return A===0&&R!==0||(y[R++]=A),R}function a(M){return new Float64Array(M)}let l=33306690738754716e-32,h=22204460492503146e-32,f=11093356479670487e-47,p=a(4),d=a(8),g=a(12),x=a(16),v=a(4);r.orient2d=function(M,b,T,_,y,A){let S=(b-A)*(T-y),L=(M-y)*(_-A),G=S-L;if(S===0||L===0||S>0!=L>0)return G;let z=Math.abs(S+L);return Math.abs(G)>=l*z?G:-function(F,I,ut,R,W,V,Mt){let X,mt,dt,_t,it,lt,H,bt,Tt,Yt,tt,wt,Bt,$t,Ut,Dt,At,te,rt=F-W,an=ut-W,zt=I-V,ne=R-V;it=(Ut=(bt=rt-(H=(lt=134217729*rt)-(lt-rt)))*(Yt=ne-(Tt=(lt=134217729*ne)-(lt-ne)))-(($t=rt*ne)-H*Tt-bt*Tt-H*Yt))-(tt=Ut-(At=(bt=zt-(H=(lt=134217729*zt)-(lt-zt)))*(Yt=an-(Tt=(lt=134217729*an)-(lt-an)))-((Dt=zt*an)-H*Tt-bt*Tt-H*Yt))),p[0]=Ut-(tt+it)+(it-At),it=(Bt=$t-((wt=$t+tt)-(it=wt-$t))+(tt-it))-(tt=Bt-Dt),p[1]=Bt-(tt+it)+(it-Dt),it=(te=wt+tt)-wt,p[2]=wt-(te-it)+(tt-it),p[3]=te;let Wt=function(Y,N){let xt=N[0];for(let Et=1;Et<Y;Et++)xt+=N[Et];return xt}(4,p),ie=h*Mt;if(Wt>=ie||-Wt>=ie||(X=F-(rt+(it=F-rt))+(it-W),dt=ut-(an+(it=ut-an))+(it-W),mt=I-(zt+(it=I-zt))+(it-V),_t=R-(ne+(it=R-ne))+(it-V),X===0&&mt===0&&dt===0&&_t===0)||(ie=f*Mt+e*Math.abs(Wt),(Wt+=rt*_t+ne*X-(zt*dt+an*mt))>=ie||-Wt>=ie))return Wt;it=(Ut=(bt=X-(H=(lt=134217729*X)-(lt-X)))*(Yt=ne-(Tt=(lt=134217729*ne)-(lt-ne)))-(($t=X*ne)-H*Tt-bt*Tt-H*Yt))-(tt=Ut-(At=(bt=mt-(H=(lt=134217729*mt)-(lt-mt)))*(Yt=an-(Tt=(lt=134217729*an)-(lt-an)))-((Dt=mt*an)-H*Tt-bt*Tt-H*Yt))),v[0]=Ut-(tt+it)+(it-At),it=(Bt=$t-((wt=$t+tt)-(it=wt-$t))+(tt-it))-(tt=Bt-Dt),v[1]=Bt-(tt+it)+(it-Dt),it=(te=wt+tt)-wt,v[2]=wt-(te-it)+(tt-it),v[3]=te;let ce=o(4,p,4,v,d);it=(Ut=(bt=rt-(H=(lt=134217729*rt)-(lt-rt)))*(Yt=_t-(Tt=(lt=134217729*_t)-(lt-_t)))-(($t=rt*_t)-H*Tt-bt*Tt-H*Yt))-(tt=Ut-(At=(bt=zt-(H=(lt=134217729*zt)-(lt-zt)))*(Yt=dt-(Tt=(lt=134217729*dt)-(lt-dt)))-((Dt=zt*dt)-H*Tt-bt*Tt-H*Yt))),v[0]=Ut-(tt+it)+(it-At),it=(Bt=$t-((wt=$t+tt)-(it=wt-$t))+(tt-it))-(tt=Bt-Dt),v[1]=Bt-(tt+it)+(it-Dt),it=(te=wt+tt)-wt,v[2]=wt-(te-it)+(tt-it),v[3]=te;let Lt=o(ce,d,4,v,g);it=(Ut=(bt=X-(H=(lt=134217729*X)-(lt-X)))*(Yt=_t-(Tt=(lt=134217729*_t)-(lt-_t)))-(($t=X*_t)-H*Tt-bt*Tt-H*Yt))-(tt=Ut-(At=(bt=mt-(H=(lt=134217729*mt)-(lt-mt)))*(Yt=dt-(Tt=(lt=134217729*dt)-(lt-dt)))-((Dt=mt*dt)-H*Tt-bt*Tt-H*Yt))),v[0]=Ut-(tt+it)+(it-At),it=(Bt=$t-((wt=$t+tt)-(it=wt-$t))+(tt-it))-(tt=Bt-Dt),v[1]=Bt-(tt+it)+(it-Dt),it=(te=wt+tt)-wt,v[2]=wt-(te-it)+(tt-it),v[3]=te;let se=o(Lt,g,4,v,x);return x[se-1]}(M,b,T,_,y,A,z)},r.orient2dfast=function(M,b,T,_,y,A){return(b-A)*(T-y)-(M-y)*(_-A)},Object.defineProperty(r,"__esModule",{value:!0})})});var DM=nt((kH,ug)=>{"use strict";var IM=ng(),nh=xM(),$U=AM(),ZU=PM().orient2d;nh.default&&(nh=nh.default);ug.exports=OM;ug.exports.default=OM;function OM(r,t,e){t=Math.max(0,t===void 0?2:t),e=e||0;var o=tB(r),a=new IM(16);a.toBBox=function(A){return{minX:A[0],minY:A[1],maxX:A[0],maxY:A[1]}},a.compareMinX=function(A,S){return A[0]-S[0]},a.compareMinY=function(A,S){return A[1]-S[1]},a.load(r);for(var l=[],h=0,f;h<o.length;h++){var p=o[h];a.remove(p),f=NM(p,f),l.push(f)}var d=new IM(16);for(h=0;h<l.length;h++)d.insert(og(l[h]));for(var g=t*t,x=e*e;l.length;){var v=l.shift(),M=v.p,b=v.next.p,T=sg(M,b);if(!(T<x)){var _=T/g;p=JU(a,v.prev.p,M,b,v.next.next.p,_,d),p&&Math.min(sg(p,M),sg(p,b))<=_&&(l.push(v),l.push(NM(p,v)),a.remove(p),d.remove(v),d.insert(og(v)),d.insert(og(v.next)))}}v=f;var y=[];do y.push(v.p),v=v.next;while(v!==f);return y.push(v.p),y}function JU(r,t,e,o,a,l,h){for(var f=new nh([],KU),p=r.data;p;){for(var d=0;d<p.children.length;d++){var g=p.children[d],x=p.leaf?ag(g,e,o):jU(e,o,g);x>l||f.push({node:g,dist:x})}for(;f.length&&!f.peek().node.children;){var v=f.pop(),M=v.node,b=ag(M,t,e),T=ag(M,o,a);if(v.dist<b&&v.dist<T&&LM(e,M,h)&&LM(o,M,h))return M}p=f.pop(),p&&(p=p.node)}return null}function KU(r,t){return r.dist-t.dist}function jU(r,t,e){if(RM(r,e)||RM(t,e))return 0;var o=eh(r[0],r[1],t[0],t[1],e.minX,e.minY,e.maxX,e.minY);if(o===0)return 0;var a=eh(r[0],r[1],t[0],t[1],e.minX,e.minY,e.minX,e.maxY);if(a===0)return 0;var l=eh(r[0],r[1],t[0],t[1],e.maxX,e.minY,e.maxX,e.maxY);if(l===0)return 0;var h=eh(r[0],r[1],t[0],t[1],e.minX,e.maxY,e.maxX,e.maxY);return h===0?0:Math.min(o,a,l,h)}function RM(r,t){return r[0]>=t.minX&&r[0]<=t.maxX&&r[1]>=t.minY&&r[1]<=t.maxY}function LM(r,t,e){for(var o=Math.min(r[0],t[0]),a=Math.min(r[1],t[1]),l=Math.max(r[0],t[0]),h=Math.max(r[1],t[1]),f=e.search({minX:o,minY:a,maxX:l,maxY:h}),p=0;p<f.length;p++)if(QU(f[p].p,f[p].next.p,r,t))return!1;return!0}function Pu(r,t,e){return ZU(r[0],r[1],t[0],t[1],e[0],e[1])}function QU(r,t,e,o){return r!==o&&t!==e&&Pu(r,t,e)>0!=Pu(r,t,o)>0&&Pu(e,o,r)>0!=Pu(e,o,t)>0}function og(r){var t=r.p,e=r.next.p;return r.minX=Math.min(t[0],e[0]),r.minY=Math.min(t[1],e[1]),r.maxX=Math.max(t[0],e[0]),r.maxY=Math.max(t[1],e[1]),r}function tB(r){for(var t=r[0],e=r[0],o=r[0],a=r[0],l=0;l<r.length;l++){var h=r[l];h[0]<t[0]&&(t=h),h[0]>o[0]&&(o=h),h[1]<e[1]&&(e=h),h[1]>a[1]&&(a=h)}var f=[t,e,o,a],p=f.slice();for(l=0;l<r.length;l++)$U(r[l],f)||p.push(r[l]);return nB(p)}function NM(r,t){var e={p:r,prev:null,next:null,minX:0,minY:0,maxX:0,maxY:0};return t?(e.next=t.next,e.prev=t,t.next.prev=e,t.next=e):(e.prev=e,e.next=e),e}function sg(r,t){var e=r[0]-t[0],o=r[1]-t[1];return e*e+o*o}function ag(r,t,e){var o=t[0],a=t[1],l=e[0]-o,h=e[1]-a;if(l!==0||h!==0){var f=((r[0]-o)*l+(r[1]-a)*h)/(l*l+h*h);f>1?(o=e[0],a=e[1]):f>0&&(o+=l*f,a+=h*f)}return l=r[0]-o,h=r[1]-a,l*l+h*h}function eh(r,t,e,o,a,l,h,f){var p=e-r,d=o-t,g=h-a,x=f-l,v=r-a,M=t-l,b=p*p+d*d,T=p*g+d*x,_=g*g+x*x,y=p*v+d*M,A=g*v+x*M,S=b*_-T*T,L,G,z,F,I=S,ut=S;S===0?(G=0,I=1,F=A,ut=_):(G=T*A-_*y,F=b*A-T*y,G<0?(G=0,F=A,ut=_):G>I&&(G=I,F=A+T,ut=_)),F<0?(F=0,-y<0?G=0:-y>b?G=I:(G=-y,I=b)):F>ut&&(F=ut,-y+T<0?G=0:-y+T>b?G=I:(G=-y+T,I=b)),L=G===0?0:G/I,z=F===0?0:F/ut;var R=(1-L)*r+L*e,W=(1-L)*t+L*o,V=(1-z)*a+z*h,Mt=(1-z)*l+z*f,X=V-R,mt=Mt-W;return X*X+mt*mt}function eB(r,t){return r[0]===t[0]?r[1]-t[1]:r[0]-t[0]}function nB(r){r.sort(eB);for(var t=[],e=0;e<r.length;e++){for(;t.length>=2&&Pu(t[t.length-2],t[t.length-1],r[e])<=0;)t.pop();t.push(r[e])}for(var o=[],a=r.length-1;a>=0;a--){for(;o.length>=2&&Pu(o[o.length-2],o[o.length-1],r[a])<=0;)o.pop();o.push(r[a])}return o.pop(),t.pop(),t.concat(o)}});var kM=nt((cg,fg)=>{(function(r,t){typeof cg=="object"&&typeof fg!="undefined"?fg.exports=t():typeof define=="function"&&define.amd?define(t):r.quickselect=t()})(cg,function(){"use strict";function r(a,l,h,f,p){t(a,l,h||0,f||a.length-1,p||o)}function t(a,l,h,f,p){for(;f>h;){if(f-h>600){var d=f-h+1,g=l-h+1,x=Math.log(d),v=.5*Math.exp(2*x/3),M=.5*Math.sqrt(x*v*(d-v)/d)*(g-d/2<0?-1:1),b=Math.max(h,Math.floor(l-g*v/d+M)),T=Math.min(f,Math.floor(l+(d-g)*v/d+M));t(a,l,b,T,p)}var _=a[l],y=h,A=f;for(e(a,h,l),p(a[f],_)>0&&e(a,h,f);y<A;){for(e(a,y,A),y++,A--;p(a[y],_)<0;)y++;for(;p(a[A],_)>0;)A--}p(a[h],_)===0?e(a,h,A):(A++,e(a,A,f)),A<=l&&(h=A+1),l<=A&&(f=A-1)}}function e(a,l,h){var f=a[l];a[l]=a[h],a[h]=f}function o(a,l){return a<l?-1:a>l?1:0}return r})});var mg=nt((pW,dg)=>{"use strict";dg.exports=zl;dg.exports.default=zl;var mB=kM();function zl(r,t){if(!(this instanceof zl))return new zl(r,t);this._maxEntries=Math.max(4,r||9),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),t&&this._initFormat(t),this.clear()}zl.prototype={all:function(){return this._all(this.data,[])},search:function(r){var t=this.data,e=[],o=this.toBBox;if(!ih(r,t))return e;for(var a=[],l,h,f,p;t;){for(l=0,h=t.children.length;l<h;l++)f=t.children[l],p=t.leaf?o(f):f,ih(r,p)&&(t.leaf?e.push(f):pg(r,p)?this._all(f,e):a.push(f));t=a.pop()}return e},collides:function(r){var t=this.data,e=this.toBBox;if(!ih(r,t))return!1;for(var o=[],a,l,h,f;t;){for(a=0,l=t.children.length;a<l;a++)if(h=t.children[a],f=t.leaf?e(h):h,ih(r,f)){if(t.leaf||pg(r,f))return!0;o.push(h)}t=o.pop()}return!1},load:function(r){if(!(r&&r.length))return this;if(r.length<this._minEntries){for(var t=0,e=r.length;t<e;t++)this.insert(r[t]);return this}var o=this._build(r.slice(),0,r.length-1,0);if(!this.data.children.length)this.data=o;else if(this.data.height===o.height)this._splitRoot(this.data,o);else{if(this.data.height<o.height){var a=this.data;this.data=o,o=a}this._insert(o,this.data.height-o.height-1,!0)}return this},insert:function(r){return r&&this._insert(r,this.data.height-1),this},clear:function(){return this.data=Lu([]),this},remove:function(r,t){if(!r)return this;for(var e=this.data,o=this.toBBox(r),a=[],l=[],h,f,p,d;e||a.length;){if(e||(e=a.pop(),f=a[a.length-1],h=l.pop(),d=!0),e.leaf&&(p=gB(r,e.children,t),p!==-1))return e.children.splice(p,1),a.push(e),this._condense(a),this;!d&&!e.leaf&&pg(e,o)?(a.push(e),l.push(h),h=0,f=e,e=e.children[0]):f?(h++,e=f.children[h],d=!1):e=null}return this},toBBox:function(r){return r},compareMinX:qM,compareMinY:VM,toJSON:function(){return this.data},fromJSON:function(r){return this.data=r,this},_all:function(r,t){for(var e=[];r;)r.leaf?t.push.apply(t,r.children):e.push.apply(e,r.children),r=e.pop();return t},_build:function(r,t,e,o){var a=e-t+1,l=this._maxEntries,h;if(a<=l)return h=Lu(r.slice(t,e+1)),Ru(h,this.toBBox),h;o||(o=Math.ceil(Math.log(a)/Math.log(l)),l=Math.ceil(a/Math.pow(l,o-1))),h=Lu([]),h.leaf=!1,h.height=o;var f=Math.ceil(a/l),p=f*Math.ceil(Math.sqrt(l)),d,g,x,v;for(HM(r,t,e,p,this.compareMinX),d=t;d<=e;d+=p)for(x=Math.min(d+p-1,e),HM(r,d,x,f,this.compareMinY),g=d;g<=x;g+=f)v=Math.min(g+f-1,x),h.children.push(this._build(r,g,v,o-1));return Ru(h,this.toBBox),h},_chooseSubtree:function(r,t,e,o){for(var a,l,h,f,p,d,g,x;o.push(t),!(t.leaf||o.length-1===e);){for(g=x=1/0,a=0,l=t.children.length;a<l;a++)h=t.children[a],p=hg(h),d=yB(r,h)-p,d<x?(x=d,g=p<g?p:g,f=h):d===x&&p<g&&(g=p,f=h);t=f||t.children[0]}return t},_insert:function(r,t,e){var o=this.toBBox,a=e?r:o(r),l=[],h=this._chooseSubtree(a,this.data,t,l);for(h.children.push(r),Bl(h,a);t>=0&&l[t].children.length>this._maxEntries;)this._split(l,t),t--;this._adjustParentBBoxes(a,l,t)},_split:function(r,t){var e=r[t],o=e.children.length,a=this._minEntries;this._chooseSplitAxis(e,a,o);var l=this._chooseSplitIndex(e,a,o),h=Lu(e.children.splice(l,e.children.length-l));h.height=e.height,h.leaf=e.leaf,Ru(e,this.toBBox),Ru(h,this.toBBox),t?r[t-1].children.push(h):this._splitRoot(e,h)},_splitRoot:function(r,t){this.data=Lu([r,t]),this.data.height=r.height+1,this.data.leaf=!1,Ru(this.data,this.toBBox)},_chooseSplitIndex:function(r,t,e){var o,a,l,h,f,p,d,g;for(p=d=1/0,o=t;o<=e-t;o++)a=Ul(r,0,o,this.toBBox),l=Ul(r,o,e,this.toBBox),h=vB(a,l),f=hg(a)+hg(l),h<p?(p=h,g=o,d=f<d?f:d):h===p&&f<d&&(d=f,g=o);return g},_chooseSplitAxis:function(r,t,e){var o=r.leaf?this.compareMinX:qM,a=r.leaf?this.compareMinY:VM,l=this._allDistMargin(r,t,e,o),h=this._allDistMargin(r,t,e,a);l<h&&r.children.sort(o)},_allDistMargin:function(r,t,e,o){r.children.sort(o);var a=this.toBBox,l=Ul(r,0,t,a),h=Ul(r,e-t,e,a),f=rh(l)+rh(h),p,d;for(p=t;p<e-t;p++)d=r.children[p],Bl(l,r.leaf?a(d):d),f+=rh(l);for(p=e-t-1;p>=t;p--)d=r.children[p],Bl(h,r.leaf?a(d):d),f+=rh(h);return f},_adjustParentBBoxes:function(r,t,e){for(var o=e;o>=0;o--)Bl(t[o],r)},_condense:function(r){for(var t=r.length-1,e;t>=0;t--)r[t].children.length===0?t>0?(e=r[t-1].children,e.splice(e.indexOf(r[t]),1)):this.clear():Ru(r[t],this.toBBox)},_initFormat:function(r){var t=["return a"," - b",";"];this.compareMinX=new Function("a","b",t.join(r[0])),this.compareMinY=new Function("a","b",t.join(r[1])),this.toBBox=new Function("a","return {minX: a"+r[0]+", minY: a"+r[1]+", maxX: a"+r[2]+", maxY: a"+r[3]+"};")}};function gB(r,t,e){if(!e)return t.indexOf(r);for(var o=0;o<t.length;o++)if(e(r,t[o]))return o;return-1}function Ru(r,t){Ul(r,0,r.children.length,t,r)}function Ul(r,t,e,o,a){a||(a=Lu(null)),a.minX=1/0,a.minY=1/0,a.maxX=-1/0,a.maxY=-1/0;for(var l=t,h;l<e;l++)h=r.children[l],Bl(a,r.leaf?o(h):h);return a}function Bl(r,t){return r.minX=Math.min(r.minX,t.minX),r.minY=Math.min(r.minY,t.minY),r.maxX=Math.max(r.maxX,t.maxX),r.maxY=Math.max(r.maxY,t.maxY),r}function qM(r,t){return r.minX-t.minX}function VM(r,t){return r.minY-t.minY}function hg(r){return(r.maxX-r.minX)*(r.maxY-r.minY)}function rh(r){return r.maxX-r.minX+(r.maxY-r.minY)}function yB(r,t){return(Math.max(t.maxX,r.maxX)-Math.min(t.minX,r.minX))*(Math.max(t.maxY,r.maxY)-Math.min(t.minY,r.minY))}function vB(r,t){var e=Math.max(r.minX,t.minX),o=Math.max(r.minY,t.minY),a=Math.min(r.maxX,t.maxX),l=Math.min(r.maxY,t.maxY);return Math.max(0,a-e)*Math.max(0,l-o)}function pg(r,t){return r.minX<=t.minX&&r.minY<=t.minY&&t.maxX<=r.maxX&&t.maxY<=r.maxY}function ih(r,t){return t.minX<=r.maxX&&t.minY<=r.maxY&&t.maxX>=r.minX&&t.maxY>=r.minY}function Lu(r){return{children:r,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function HM(r,t,e,o,a){for(var l=[t,e],h;l.length;)e=l.pop(),t=l.pop(),!(e-t<=o)&&(h=t+Math.ceil((e-t)/o/2)*o,mB(r,h,t,e,a),l.push(t,h,h,e))}});var JM=nt((TX,Eg)=>{"use strict";Eg.exports=uh;Eg.exports.default=uh;function uh(r,t,e){e=e||2;var o=t&&t.length,a=o?t[0]*e:r.length,l=YM(r,0,a,e,!0),h=[];if(!l||l.next===l.prev)return h;var f,p,d,g,x,v,M;if(o&&(l=CB(r,t,l,e)),r.length>80*e){f=d=r[0],p=g=r[1];for(var b=e;b<a;b+=e)x=r[b],v=r[b+1],x<f&&(f=x),v<p&&(p=v),x>d&&(d=x),v>g&&(g=v);M=Math.max(d-f,g-p),M=M!==0?32767/M:0}return ql(l,h,e,f,p,M,0),h}function YM(r,t,e,o,a){var l,h;if(a===xg(r,t,e,o)>0)for(l=t;l<e;l+=o)h=XM(l,r[l],r[l+1],h);else for(l=e-o;l>=t;l-=o)h=XM(l,r[l],r[l+1],h);return h&&lh(h,h.next)&&(Hl(h),h=h.next),h}function wa(r,t){if(!r)return r;t||(t=r);var e=r,o;do if(o=!1,!e.steiner&&(lh(e,e.next)||$n(e.prev,e,e.next)===0)){if(Hl(e),e=t=e.prev,e===e.next)break;o=!0}else e=e.next;while(o||e!==t);return t}function ql(r,t,e,o,a,l,h){if(r){!h&&l&&NB(r,o,a,l);for(var f=r,p,d;r.prev!==r.next;){if(p=r.prev,d=r.next,l?bB(r,o,a,l):wB(r)){t.push(p.i/e|0),t.push(r.i/e|0),t.push(d.i/e|0),Hl(r),r=d.next,f=d.next;continue}if(r=d,r===f){h?h===1?(r=TB(wa(r),t,e),ql(r,t,e,o,a,l,2)):h===2&&AB(r,t,e,o,a,l):ql(wa(r),t,e,o,a,l,1);break}}}}function wB(r){var t=r.prev,e=r,o=r.next;if($n(t,e,o)>=0)return!1;for(var a=t.x,l=e.x,h=o.x,f=t.y,p=e.y,d=o.y,g=a<l?a<h?a:h:l<h?l:h,x=f<p?f<d?f:d:p<d?p:d,v=a>l?a>h?a:h:l>h?l:h,M=f>p?f>d?f:d:p>d?p:d,b=o.next;b!==t;){if(b.x>=g&&b.x<=v&&b.y>=x&&b.y<=M&&Du(a,f,l,p,h,d,b.x,b.y)&&$n(b.prev,b,b.next)>=0)return!1;b=b.next}return!0}function bB(r,t,e,o){var a=r.prev,l=r,h=r.next;if($n(a,l,h)>=0)return!1;for(var f=a.x,p=l.x,d=h.x,g=a.y,x=l.y,v=h.y,M=f<p?f<d?f:d:p<d?p:d,b=g<x?g<v?g:v:x<v?x:v,T=f>p?f>d?f:d:p>d?p:d,_=g>x?g>v?g:v:x>v?x:v,y=vg(M,b,t,e,o),A=vg(T,_,t,e,o),S=r.prevZ,L=r.nextZ;S&&S.z>=y&&L&&L.z<=A;){if(S.x>=M&&S.x<=T&&S.y>=b&&S.y<=_&&S!==a&&S!==h&&Du(f,g,p,x,d,v,S.x,S.y)&&$n(S.prev,S,S.next)>=0||(S=S.prevZ,L.x>=M&&L.x<=T&&L.y>=b&&L.y<=_&&L!==a&&L!==h&&Du(f,g,p,x,d,v,L.x,L.y)&&$n(L.prev,L,L.next)>=0))return!1;L=L.nextZ}for(;S&&S.z>=y;){if(S.x>=M&&S.x<=T&&S.y>=b&&S.y<=_&&S!==a&&S!==h&&Du(f,g,p,x,d,v,S.x,S.y)&&$n(S.prev,S,S.next)>=0)return!1;S=S.prevZ}for(;L&&L.z<=A;){if(L.x>=M&&L.x<=T&&L.y>=b&&L.y<=_&&L!==a&&L!==h&&Du(f,g,p,x,d,v,L.x,L.y)&&$n(L.prev,L,L.next)>=0)return!1;L=L.nextZ}return!0}function TB(r,t,e){var o=r;do{var a=o.prev,l=o.next.next;!lh(a,l)&&$M(a,o,o.next,l)&&Vl(a,l)&&Vl(l,a)&&(t.push(a.i/e|0),t.push(o.i/e|0),t.push(l.i/e|0),Hl(o),Hl(o.next),o=r=l),o=o.next}while(o!==r);return wa(o)}function AB(r,t,e,o,a,l){var h=r;do{for(var f=h.next.next;f!==h.prev;){if(h.i!==f.i&&FB(h,f)){var p=ZM(h,f);h=wa(h,h.next),p=wa(p,p.next),ql(h,t,e,o,a,l,0),ql(p,t,e,o,a,l,0);return}f=f.next}h=h.next}while(h!==r)}function CB(r,t,e,o){var a=[],l,h,f,p,d;for(l=0,h=t.length;l<h;l++)f=t[l]*o,p=l<h-1?t[l+1]*o:r.length,d=YM(r,f,p,o,!1),d===d.next&&(d.steiner=!0),a.push(DB(d));for(a.sort(PB),l=0;l<a.length;l++)e=IB(a[l],e);return e}function PB(r,t){return r.x-t.x}function IB(r,t){var e=RB(r,t);if(!e)return t;var o=ZM(e,r);return wa(o,o.next),wa(e,e.next)}function RB(r,t){var e=t,o=r.x,a=r.y,l=-1/0,h;do{if(a<=e.y&&a>=e.next.y&&e.next.y!==e.y){var f=e.x+(a-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(f<=o&&f>l&&(l=f,h=e.x<e.next.x?e:e.next,f===o))return h}e=e.next}while(e!==t);if(!h)return null;var p=h,d=h.x,g=h.y,x=1/0,v;e=h;do o>=e.x&&e.x>=d&&o!==e.x&&Du(a<g?o:l,a,d,g,a<g?l:o,a,e.x,e.y)&&(v=Math.abs(a-e.y)/(o-e.x),Vl(e,r)&&(v<x||v===x&&(e.x>h.x||e.x===h.x&&LB(h,e)))&&(h=e,x=v)),e=e.next;while(e!==p);return h}function LB(r,t){return $n(r.prev,r,t.prev)<0&&$n(t.next,r,r.next)<0}function NB(r,t,e,o){var a=r;do a.z===0&&(a.z=vg(a.x,a.y,t,e,o)),a.prevZ=a.prev,a.nextZ=a.next,a=a.next;while(a!==r);a.prevZ.nextZ=null,a.prevZ=null,OB(a)}function OB(r){var t,e,o,a,l,h,f,p,d=1;do{for(e=r,r=null,l=null,h=0;e;){for(h++,o=e,f=0,t=0;t<d&&(f++,o=o.nextZ,!!o);t++);for(p=d;f>0||p>0&&o;)f!==0&&(p===0||!o||e.z<=o.z)?(a=e,e=e.nextZ,f--):(a=o,o=o.nextZ,p--),l?l.nextZ=a:r=a,a.prevZ=l,l=a;e=o}l.nextZ=null,d*=2}while(h>1);return r}function vg(r,t,e,o,a){return r=(r-e)*a|0,t=(t-o)*a|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,r|t<<1}function DB(r){var t=r,e=r;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==r);return e}function Du(r,t,e,o,a,l,h,f){return(a-h)*(t-f)>=(r-h)*(l-f)&&(r-h)*(o-f)>=(e-h)*(t-f)&&(e-h)*(l-f)>=(a-h)*(o-f)}function FB(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!UB(r,t)&&(Vl(r,t)&&Vl(t,r)&&BB(r,t)&&($n(r.prev,r,t.prev)||$n(r,t.prev,t))||lh(r,t)&&$n(r.prev,r,r.next)>0&&$n(t.prev,t,t.next)>0)}function $n(r,t,e){return(t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y)}function lh(r,t){return r.x===t.x&&r.y===t.y}function $M(r,t,e,o){var a=ah($n(r,t,e)),l=ah($n(r,t,o)),h=ah($n(e,o,r)),f=ah($n(e,o,t));return!!(a!==l&&h!==f||a===0&&sh(r,e,t)||l===0&&sh(r,o,t)||h===0&&sh(e,r,o)||f===0&&sh(e,t,o))}function sh(r,t,e){return t.x<=Math.max(r.x,e.x)&&t.x>=Math.min(r.x,e.x)&&t.y<=Math.max(r.y,e.y)&&t.y>=Math.min(r.y,e.y)}function ah(r){return r>0?1:r<0?-1:0}function UB(r,t){var e=r;do{if(e.i!==r.i&&e.next.i!==r.i&&e.i!==t.i&&e.next.i!==t.i&&$M(e,e.next,r,t))return!0;e=e.next}while(e!==r);return!1}function Vl(r,t){return $n(r.prev,r,r.next)<0?$n(r,t,r.next)>=0&&$n(r,r.prev,t)>=0:$n(r,t,r.prev)<0||$n(r,r.next,t)<0}function BB(r,t){var e=r,o=!1,a=(r.x+t.x)/2,l=(r.y+t.y)/2;do e.y>l!=e.next.y>l&&e.next.y!==e.y&&a<(e.next.x-e.x)*(l-e.y)/(e.next.y-e.y)+e.x&&(o=!o),e=e.next;while(e!==r);return o}function ZM(r,t){var e=new _g(r.i,r.x,r.y),o=new _g(t.i,t.x,t.y),a=r.next,l=t.prev;return r.next=t,t.prev=r,e.next=a,a.prev=e,o.next=e,e.prev=o,l.next=o,o.prev=l,o}function XM(r,t,e,o){var a=new _g(r,t,e);return o?(a.next=o.next,a.prev=o,o.next.prev=a,o.next=a):(a.prev=a,a.next=a),a}function Hl(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function _g(r,t,e){this.i=r,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}uh.deviation=function(r,t,e,o){var a=t&&t.length,l=a?t[0]*e:r.length,h=Math.abs(xg(r,0,l,e));if(a)for(var f=0,p=t.length;f<p;f++){var d=t[f]*e,g=f<p-1?t[f+1]*e:r.length;h-=Math.abs(xg(r,d,g,e))}var x=0;for(f=0;f<o.length;f+=3){var v=o[f]*e,M=o[f+1]*e,b=o[f+2]*e;x+=Math.abs((r[v]-r[b])*(r[M+1]-r[v+1])-(r[v]-r[M])*(r[b+1]-r[v+1]))}return h===0&&x===0?0:Math.abs((x-h)/h)};function xg(r,t,e,o){for(var a=0,l=t,h=e-o;l<e;l+=o)a+=(r[h]-r[l])*(r[l+1]+r[h+1]),h=l;return a}uh.flatten=function(r){for(var t=r[0][0].length,e={vertices:[],holes:[],dimensions:t},o=0,a=0;a<r.length;a++){for(var l=0;l<r[a].length;l++)for(var h=0;h<t;h++)e.vertices.push(r[a][l][h]);a>0&&(o+=r[a-1].length,e.holes.push(o))}return e}});var Tg=nt(he=>{"use strict";Object.defineProperty(he,"__esModule",{value:!0});he.earthRadius=63710088e-1;he.factors={centimeters:he.earthRadius*100,centimetres:he.earthRadius*100,degrees:he.earthRadius/111325,feet:he.earthRadius*3.28084,inches:he.earthRadius*39.37,kilometers:he.earthRadius/1e3,kilometres:he.earthRadius/1e3,meters:he.earthRadius,metres:he.earthRadius,miles:he.earthRadius/1609.344,millimeters:he.earthRadius*1e3,millimetres:he.earthRadius*1e3,nauticalmiles:he.earthRadius/1852,radians:1,yards:he.earthRadius*1.0936};he.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/he.earthRadius,yards:1.0936133};he.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 Gs(r,t,e){e===void 0&&(e={});var o={type:"Feature"};return(e.id===0||e.id)&&(o.id=e.id),e.bbox&&(o.bbox=e.bbox),o.properties=t||{},o.geometry=r,o}he.feature=Gs;function GB(r,t,e){switch(e===void 0&&(e={}),r){case"Point":return Mg(t).geometry;case"LineString":return wg(t).geometry;case"Polygon":return Sg(t).geometry;case"MultiPoint":return jM(t).geometry;case"MultiLineString":return KM(t).geometry;case"MultiPolygon":return QM(t).geometry;default:throw new Error(r+" is invalid")}}he.geometry=GB;function Mg(r,t,e){if(e===void 0&&(e={}),!r)throw new Error("coordinates is required");if(!Array.isArray(r))throw new Error("coordinates must be an Array");if(r.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!ch(r[0])||!ch(r[1]))throw new Error("coordinates must contain numbers");var o={type:"Point",coordinates:r};return Gs(o,t,e)}he.point=Mg;function kB(r,t,e){return e===void 0&&(e={}),fh(r.map(function(o){return Mg(o,t)}),e)}he.points=kB;function Sg(r,t,e){e===void 0&&(e={});for(var o=0,a=r;o<a.length;o++){var l=a[o];if(l.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var h=0;h<l[l.length-1].length;h++)if(l[l.length-1][h]!==l[0][h])throw new Error("First and last Position are not equivalent.")}var f={type:"Polygon",coordinates:r};return Gs(f,t,e)}he.polygon=Sg;function qB(r,t,e){return e===void 0&&(e={}),fh(r.map(function(o){return Sg(o,t)}),e)}he.polygons=qB;function wg(r,t,e){if(e===void 0&&(e={}),r.length<2)throw new Error("coordinates must be an array of two or more positions");var o={type:"LineString",coordinates:r};return Gs(o,t,e)}he.lineString=wg;function VB(r,t,e){return e===void 0&&(e={}),fh(r.map(function(o){return wg(o,t)}),e)}he.lineStrings=VB;function fh(r,t){t===void 0&&(t={});var e={type:"FeatureCollection"};return t.id&&(e.id=t.id),t.bbox&&(e.bbox=t.bbox),e.features=r,e}he.featureCollection=fh;function KM(r,t,e){e===void 0&&(e={});var o={type:"MultiLineString",coordinates:r};return Gs(o,t,e)}he.multiLineString=KM;function jM(r,t,e){e===void 0&&(e={});var o={type:"MultiPoint",coordinates:r};return Gs(o,t,e)}he.multiPoint=jM;function QM(r,t,e){e===void 0&&(e={});var o={type:"MultiPolygon",coordinates:r};return Gs(o,t,e)}he.multiPolygon=QM;function HB(r,t,e){e===void 0&&(e={});var o={type:"GeometryCollection",geometries:r};return Gs(o,t,e)}he.geometryCollection=HB;function WB(r,t){if(t===void 0&&(t=0),t&&!(t>=0))throw new Error("precision must be a positive number");var e=Math.pow(10,t||0);return Math.round(r*e)/e}he.round=WB;function tS(r,t){t===void 0&&(t="kilometers");var e=he.factors[t];if(!e)throw new Error(t+" units is invalid");return r*e}he.radiansToLength=tS;function bg(r,t){t===void 0&&(t="kilometers");var e=he.factors[t];if(!e)throw new Error(t+" units is invalid");return r/e}he.lengthToRadians=bg;function XB(r,t){return eS(bg(r,t))}he.lengthToDegrees=XB;function YB(r){var t=r%360;return t<0&&(t+=360),t}he.bearingToAzimuth=YB;function eS(r){var t=r%(2*Math.PI);return t*180/Math.PI}he.radiansToDegrees=eS;function $B(r){var t=r%360;return t*Math.PI/180}he.degreesToRadians=$B;function ZB(r,t,e){if(t===void 0&&(t="kilometers"),e===void 0&&(e="kilometers"),!(r>=0))throw new Error("length must be a positive number");return tS(bg(r,t),e)}he.convertLength=ZB;function JB(r,t,e){if(t===void 0&&(t="meters"),e===void 0&&(e="kilometers"),!(r>=0))throw new Error("area must be a positive number");var o=he.areaFactors[t];if(!o)throw new Error("invalid original units");var a=he.areaFactors[e];if(!a)throw new Error("invalid final units");return r/o*a}he.convertArea=JB;function ch(r){return!isNaN(r)&&r!==null&&!Array.isArray(r)}he.isNumber=ch;function KB(r){return!!r&&r.constructor===Object}he.isObject=KB;function jB(r){if(!r)throw new Error("bbox is required");if(!Array.isArray(r))throw new Error("bbox must be an Array");if(r.length!==4&&r.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");r.forEach(function(t){if(!ch(t))throw new Error("bbox must only contain numbers")})}he.validateBBox=jB;function QB(r){if(!r)throw new Error("id is required");if(["string","number"].indexOf(typeof r)===-1)throw new Error("id must be a number or a string")}he.validateId=QB});var Cg=nt(mr=>{"use strict";Object.defineProperty(mr,"__esModule",{value:!0});var Qr=Tg();function Wl(r,t,e){if(r!==null)for(var o,a,l,h,f,p,d,g=0,x=0,v,M=r.type,b=M==="FeatureCollection",T=M==="Feature",_=b?r.features.length:1,y=0;y<_;y++){d=b?r.features[y].geometry:T?r.geometry:r,v=d?d.type==="GeometryCollection":!1,f=v?d.geometries.length:1;for(var A=0;A<f;A++){var S=0,L=0;if(h=v?d.geometries[A]:d,h!==null){p=h.coordinates;var G=h.type;switch(g=e&&(G==="Polygon"||G==="MultiPolygon")?1:0,G){case null:break;case"Point":if(t(p,x,y,S,L)===!1)return!1;x++,S++;break;case"LineString":case"MultiPoint":for(o=0;o<p.length;o++){if(t(p[o],x,y,S,L)===!1)return!1;x++,G==="MultiPoint"&&S++}G==="LineString"&&S++;break;case"Polygon":case"MultiLineString":for(o=0;o<p.length;o++){for(a=0;a<p[o].length-g;a++){if(t(p[o][a],x,y,S,L)===!1)return!1;x++}G==="MultiLineString"&&S++,G==="Polygon"&&L++}G==="Polygon"&&S++;break;case"MultiPolygon":for(o=0;o<p.length;o++){for(L=0,a=0;a<p[o].length;a++){for(l=0;l<p[o][a].length-g;l++){if(t(p[o][a][l],x,y,S,L)===!1)return!1;x++}L++}S++}break;case"GeometryCollection":for(o=0;o<h.geometries.length;o++)if(Wl(h.geometries[o],t,e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function tz(r,t,e,o){var a=e;return Wl(r,function(l,h,f,p,d){h===0&&e===void 0?a=l:a=t(a,l,h,f,p,d)},o),a}function nS(r,t){var e;switch(r.type){case"FeatureCollection":for(e=0;e<r.features.length&&t(r.features[e].properties,e)!==!1;e++);break;case"Feature":t(r.properties,0);break}}function ez(r,t,e){var o=e;return nS(r,function(a,l){l===0&&e===void 0?o=a:o=t(o,a,l)}),o}function rS(r,t){if(r.type==="Feature")t(r,0);else if(r.type==="FeatureCollection")for(var e=0;e<r.features.length&&t(r.features[e],e)!==!1;e++);}function nz(r,t,e){var o=e;return rS(r,function(a,l){l===0&&e===void 0?o=a:o=t(o,a,l)}),o}function rz(r){var t=[];return Wl(r,function(e){t.push(e)}),t}function Ag(r,t){var e,o,a,l,h,f,p,d,g,x,v=0,M=r.type==="FeatureCollection",b=r.type==="Feature",T=M?r.features.length:1;for(e=0;e<T;e++){for(f=M?r.features[e].geometry:b?r.geometry:r,d=M?r.features[e].properties:b?r.properties:{},g=M?r.features[e].bbox:b?r.bbox:void 0,x=M?r.features[e].id:b?r.id:void 0,p=f?f.type==="GeometryCollection":!1,h=p?f.geometries.length:1,a=0;a<h;a++){if(l=p?f.geometries[a]:f,l===null){if(t(null,v,d,g,x)===!1)return!1;continue}switch(l.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(t(l,v,d,g,x)===!1)return!1;break}case"GeometryCollection":{for(o=0;o<l.geometries.length;o++)if(t(l.geometries[o],v,d,g,x)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}v++}}function iz(r,t,e){var o=e;return Ag(r,function(a,l,h,f,p){l===0&&e===void 0?o=a:o=t(o,a,l,h,f,p)}),o}function hh(r,t){Ag(r,function(e,o,a,l,h){var f=e===null?null:e.type;switch(f){case null:case"Point":case"LineString":case"Polygon":return t(Qr.feature(e,a,{bbox:l,id:h}),o,0)===!1?!1:void 0}var p;switch(f){case"MultiPoint":p="Point";break;case"MultiLineString":p="LineString";break;case"MultiPolygon":p="Polygon";break}for(var d=0;d<e.coordinates.length;d++){var g=e.coordinates[d],x={type:p,coordinates:g};if(t(Qr.feature(x,a),o,d)===!1)return!1}})}function oz(r,t,e){var o=e;return hh(r,function(a,l,h){l===0&&h===0&&e===void 0?o=a:o=t(o,a,l,h)}),o}function iS(r,t){hh(r,function(e,o,a){var l=0;if(e.geometry){var h=e.geometry.type;if(!(h==="Point"||h==="MultiPoint")){var f,p=0,d=0,g=0;if(Wl(e,function(x,v,M,b,T){if(f===void 0||o>p||b>d||T>g){f=x,p=o,d=b,g=T,l=0;return}var _=Qr.lineString([f,x],e.properties);if(t(_,o,a,T,l)===!1)return!1;l++,f=x})===!1)return!1}}})}function sz(r,t,e){var o=e,a=!1;return iS(r,function(l,h,f,p,d){a===!1&&e===void 0?o=l:o=t(o,l,h,f,p,d),a=!0}),o}function oS(r,t){if(!r)throw new Error("geojson is required");hh(r,function(e,o,a){if(e.geometry!==null){var l=e.geometry.type,h=e.geometry.coordinates;switch(l){case"LineString":if(t(e,o,a,0,0)===!1)return!1;break;case"Polygon":for(var f=0;f<h.length;f++)if(t(Qr.lineString(h[f],e.properties),o,a,f)===!1)return!1;break}}})}function az(r,t,e){var o=e;return oS(r,function(a,l,h,f){l===0&&e===void 0?o=a:o=t(o,a,l,h,f)}),o}function uz(r,t){if(t=t||{},!Qr.isObject(t))throw new Error("options is invalid");var e=t.featureIndex||0,o=t.multiFeatureIndex||0,a=t.geometryIndex||0,l=t.segmentIndex||0,h=t.properties,f;switch(r.type){case"FeatureCollection":e<0&&(e=r.features.length+e),h=h||r.features[e].properties,f=r.features[e].geometry;break;case"Feature":h=h||r.properties,f=r.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":f=r;break;default:throw new Error("geojson is invalid")}if(f===null)return null;var p=f.coordinates;switch(f.type){case"Point":case"MultiPoint":return null;case"LineString":return l<0&&(l=p.length+l-1),Qr.lineString([p[l],p[l+1]],h,t);case"Polygon":return a<0&&(a=p.length+a),l<0&&(l=p[a].length+l-1),Qr.lineString([p[a][l],p[a][l+1]],h,t);case"MultiLineString":return o<0&&(o=p.length+o),l<0&&(l=p[o].length+l-1),Qr.lineString([p[o][l],p[o][l+1]],h,t);case"MultiPolygon":return o<0&&(o=p.length+o),a<0&&(a=p[o].length+a),l<0&&(l=p[o][a].length-l-1),Qr.lineString([p[o][a][l],p[o][a][l+1]],h,t)}throw new Error("geojson is invalid")}function lz(r,t){if(t=t||{},!Qr.isObject(t))throw new Error("options is invalid");var e=t.featureIndex||0,o=t.multiFeatureIndex||0,a=t.geometryIndex||0,l=t.coordIndex||0,h=t.properties,f;switch(r.type){case"FeatureCollection":e<0&&(e=r.features.length+e),h=h||r.features[e].properties,f=r.features[e].geometry;break;case"Feature":h=h||r.properties,f=r.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":f=r;break;default:throw new Error("geojson is invalid")}if(f===null)return null;var p=f.coordinates;switch(f.type){case"Point":return Qr.point(p,h,t);case"MultiPoint":return o<0&&(o=p.length+o),Qr.point(p[o],h,t);case"LineString":return l<0&&(l=p.length+l),Qr.point(p[l],h,t);case"Polygon":return a<0&&(a=p.length+a),l<0&&(l=p[a].length+l),Qr.point(p[a][l],h,t);case"MultiLineString":return o<0&&(o=p.length+o),l<0&&(l=p[o].length+l),Qr.point(p[o][l],h,t);case"MultiPolygon":return o<0&&(o=p.length+o),a<0&&(a=p[o].length+a),l<0&&(l=p[o][a].length-l),Qr.point(p[o][a][l],h,t)}throw new Error("geojson is invalid")}mr.coordAll=rz;mr.coordEach=Wl;mr.coordReduce=tz;mr.featureEach=rS;mr.featureReduce=nz;mr.findPoint=lz;mr.findSegment=uz;mr.flattenEach=hh;mr.flattenReduce=oz;mr.geomEach=Ag;mr.geomReduce=iz;mr.lineEach=oS;mr.lineReduce=az;mr.propEach=nS;mr.propReduce=ez;mr.segmentEach=iS;mr.segmentReduce=sz});var sS=nt(Ig=>{"use strict";Object.defineProperty(Ig,"__esModule",{value:!0});var cz=Cg();function Pg(r){var t=[1/0,1/0,-1/0,-1/0];return cz.coordEach(r,function(e){t[0]>e[0]&&(t[0]=e[0]),t[1]>e[1]&&(t[1]=e[1]),t[2]<e[0]&&(t[2]=e[0]),t[3]<e[1]&&(t[3]=e[1])}),t}Pg.default=Pg;Ig.default=Pg});var ph=nt((qX,Rg)=>{var Lo=ng(),uS=Tg(),lS=Cg(),Fu=sS().default,fz=lS.featureEach,GX=lS.coordEach,kX=uS.polygon,aS=uS.featureCollection;function cS(r){var t=new Lo(r);return t.insert=function(e){if(e.type!=="Feature")throw new Error("invalid feature");return e.bbox=e.bbox?e.bbox:Fu(e),Lo.prototype.insert.call(this,e)},t.load=function(e){var o=[];return Array.isArray(e)?e.forEach(function(a){if(a.type!=="Feature")throw new Error("invalid features");a.bbox=a.bbox?a.bbox:Fu(a),o.push(a)}):fz(e,function(a){if(a.type!=="Feature")throw new Error("invalid features");a.bbox=a.bbox?a.bbox:Fu(a),o.push(a)}),Lo.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:Fu(e),Lo.prototype.remove.call(this,e,o)},t.clear=function(){return Lo.prototype.clear.call(this)},t.search=function(e){var o=Lo.prototype.search.call(this,this.toBBox(e));return aS(o)},t.collides=function(e){return Lo.prototype.collides.call(this,this.toBBox(e))},t.all=function(){var e=Lo.prototype.all.call(this);return aS(e)},t.toJSON=function(){return Lo.prototype.toJSON.call(this)},t.fromJSON=function(e){return Lo.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=Fu(e);else if(e.type==="FeatureCollection")o=Fu(e);else throw new Error("invalid geojson");return{minX:o[0],minY:o[1],maxX:o[2],maxY:o[3]}},t}Rg.exports=cS;Rg.exports.default=cS});var Ug=nt((K7,xS)=>{"use strict";var _S=Object.prototype.toString;xS.exports=function(t){var e=_S.call(t),o=e==="[object Arguments]";return o||(o=e!=="[object Array]"&&t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&_S.call(t.callee)==="[object Function]"),o}});var PS=nt((j7,CS)=>{"use strict";var AS;Object.keys||($l=Object.prototype.hasOwnProperty,Bg=Object.prototype.toString,ES=Ug(),zg=Object.prototype.propertyIsEnumerable,MS=!zg.call({toString:null},"toString"),SS=zg.call(function(){},"prototype"),Zl=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],vh=function(r){var t=r.constructor;return t&&t.prototype===r},wS={$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},bS=function(){if(typeof window=="undefined")return!1;for(var r in window)try{if(!wS["$"+r]&&$l.call(window,r)&&window[r]!==null&&typeof window[r]=="object")try{vh(window[r])}catch(t){return!0}}catch(t){return!0}return!1}(),TS=function(r){if(typeof window=="undefined"||!bS)return vh(r);try{return vh(r)}catch(t){return!1}},AS=function(t){var e=t!==null&&typeof t=="object",o=Bg.call(t)==="[object Function]",a=ES(t),l=e&&Bg.call(t)==="[object String]",h=[];if(!e&&!o&&!a)throw new TypeError("Object.keys called on a non-object");var f=SS&&o;if(l&&t.length>0&&!$l.call(t,0))for(var p=0;p<t.length;++p)h.push(String(p));if(a&&t.length>0)for(var d=0;d<t.length;++d)h.push(String(d));else for(var g in t)!(f&&g==="prototype")&&$l.call(t,g)&&h.push(String(g));if(MS)for(var x=TS(t),v=0;v<Zl.length;++v)!(x&&Zl[v]==="constructor")&&$l.call(t,Zl[v])&&h.push(Zl[v]);return h});var $l,Bg,ES,zg,MS,SS,Zl,vh,wS,bS,TS;CS.exports=AS});var Gg=nt((Q7,LS)=>{"use strict";var Ez=Array.prototype.slice,Mz=Ug(),IS=Object.keys,_h=IS?function(t){return IS(t)}:PS(),RS=Object.keys;_h.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 Mz(o)?RS(Ez.call(o)):RS(o)})}else Object.keys=_h;return Object.keys||_h};LS.exports=_h});var kg=nt((tY,NS)=>{"use strict";NS.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},e=Symbol("test"),o=Object(e);if(typeof e=="string"||Object.prototype.toString.call(e)!=="[object Symbol]"||Object.prototype.toString.call(o)!=="[object Symbol]")return!1;var a=42;t[e]=a;for(var l 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 h=Object.getOwnPropertySymbols(t);if(h.length!==1||h[0]!==e||!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var f=Object.getOwnPropertyDescriptor(t,e);if(f.value!==a||f.enumerable!==!0)return!1}return!0}});var xh=nt((eY,OS)=>{"use strict";var Sz=kg();OS.exports=function(){return Sz()&&!!Symbol.toStringTag}});var qg=nt((nY,DS)=>{"use strict";DS.exports=Object});var Vg=nt((rY,FS)=>{"use strict";FS.exports=Error});var BS=nt((iY,US)=>{"use strict";US.exports=EvalError});var GS=nt((oY,zS)=>{"use strict";zS.exports=RangeError});var qS=nt((sY,kS)=>{"use strict";kS.exports=ReferenceError});var Hg=nt((aY,VS)=>{"use strict";VS.exports=SyntaxError});var ba=nt((uY,HS)=>{"use strict";HS.exports=TypeError});var XS=nt((lY,WS)=>{"use strict";WS.exports=URIError});var $S=nt((cY,YS)=>{"use strict";YS.exports=Math.abs});var JS=nt((fY,ZS)=>{"use strict";ZS.exports=Math.floor});var jS=nt((hY,KS)=>{"use strict";KS.exports=Math.max});var tw=nt((pY,QS)=>{"use strict";QS.exports=Math.min});var nw=nt((dY,ew)=>{"use strict";ew.exports=Math.pow});var iw=nt((mY,rw)=>{"use strict";rw.exports=Math.round});var sw=nt((gY,ow)=>{"use strict";ow.exports=Number.isNaN||function(t){return t!==t}});var uw=nt((yY,aw)=>{"use strict";var wz=sw();aw.exports=function(t){return wz(t)||t===0?t:t<0?-1:1}});var cw=nt((vY,lw)=>{"use strict";lw.exports=Object.getOwnPropertyDescriptor});var Ta=nt((_Y,fw)=>{"use strict";var Eh=cw();if(Eh)try{Eh([],"length")}catch(r){Eh=null}fw.exports=Eh});var Jl=nt((xY,hw)=>{"use strict";var Mh=Object.defineProperty||!1;if(Mh)try{Mh({},"a",{value:1})}catch(r){Mh=!1}hw.exports=Mh});var mw=nt((EY,dw)=>{"use strict";var pw=typeof Symbol!="undefined"&&Symbol,bz=kg();dw.exports=function(){return typeof pw!="function"||typeof Symbol!="function"||typeof pw("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:bz()}});var Wg=nt((MY,gw)=>{"use strict";gw.exports=typeof Reflect!="undefined"&&Reflect.getPrototypeOf||null});var Xg=nt((SY,yw)=>{"use strict";var Tz=qg();yw.exports=Tz.getPrototypeOf||null});var xw=nt((wY,_w)=>{"use strict";var Az="Function.prototype.bind called on incompatible ",Cz=Object.prototype.toString,Pz=Math.max,Iz="[object Function]",vw=function(t,e){for(var o=[],a=0;a<t.length;a+=1)o[a]=t[a];for(var l=0;l<e.length;l+=1)o[l+t.length]=e[l];return o},Rz=function(t,e){for(var o=[],a=e||0,l=0;a<t.length;a+=1,l+=1)o[l]=t[a];return o},Lz=function(r,t){for(var e="",o=0;o<r.length;o+=1)e+=r[o],o+1<r.length&&(e+=t);return e};_w.exports=function(t){var e=this;if(typeof e!="function"||Cz.apply(e)!==Iz)throw new TypeError(Az+e);for(var o=Rz(arguments,1),a,l=function(){if(this instanceof a){var g=e.apply(this,vw(o,arguments));return Object(g)===g?g:this}return e.apply(t,vw(o,arguments))},h=Pz(0,e.length-o.length),f=[],p=0;p<h;p++)f[p]="$"+p;if(a=Function("binder","return function ("+Lz(f,",")+"){ return binder.apply(this,arguments); }")(l),e.prototype){var d=function(){};d.prototype=e.prototype,a.prototype=new d,d.prototype=null}return a}});var Uu=nt((bY,Ew)=>{"use strict";var Nz=xw();Ew.exports=Function.prototype.bind||Nz});var Sh=nt((TY,Mw)=>{"use strict";Mw.exports=Function.prototype.call});var wh=nt((AY,Sw)=>{"use strict";Sw.exports=Function.prototype.apply});var bw=nt((CY,ww)=>{"use strict";ww.exports=typeof Reflect!="undefined"&&Reflect&&Reflect.apply});var Yg=nt((PY,Tw)=>{"use strict";var Oz=Uu(),Dz=wh(),Fz=Sh(),Uz=bw();Tw.exports=Uz||Oz.call(Fz,Dz)});var bh=nt((IY,Aw)=>{"use strict";var Bz=Uu(),zz=ba(),Gz=Sh(),kz=Yg();Aw.exports=function(t){if(t.length<1||typeof t[0]!="function")throw new zz("a function is required");return kz(Bz,Gz,t)}});var Nw=nt((RY,Lw)=>{"use strict";var qz=bh(),Cw=Ta(),Iw;try{Iw=[].__proto__===Array.prototype}catch(r){if(!r||typeof r!="object"||!("code"in r)||r.code!=="ERR_PROTO_ACCESS")throw r}var $g=!!Iw&&Cw&&Cw(Object.prototype,"__proto__"),Rw=Object,Pw=Rw.getPrototypeOf;Lw.exports=$g&&typeof $g.get=="function"?qz([$g.get]):typeof Pw=="function"?function(t){return Pw(t==null?t:Rw(t))}:!1});var Zg=nt((LY,Uw)=>{"use strict";var Ow=Wg(),Dw=Xg(),Fw=Nw();Uw.exports=Ow?function(t){return Ow(t)}:Dw?function(t){if(!t||typeof t!="object"&&typeof t!="function")throw new TypeError("getProto: not an object");return Dw(t)}:Fw?function(t){return Fw(t)}:null});var Jg=nt((NY,Bw)=>{"use strict";var Vz=Function.prototype.call,Hz=Object.prototype.hasOwnProperty,Wz=Uu();Bw.exports=Wz.call(Vz,Hz)});var Qg=nt((OY,Hw)=>{"use strict";var Ke,Xz=qg(),Yz=Vg(),$z=BS(),Zz=GS(),Jz=qS(),ku=Hg(),Gu=ba(),Kz=XS(),jz=$S(),Qz=JS(),tG=jS(),eG=tw(),nG=nw(),rG=iw(),iG=uw(),qw=Function,Kg=function(r){try{return qw('"use strict"; return ('+r+").constructor;")()}catch(t){}},Kl=Ta(),oG=Jl(),jg=function(){throw new Gu},sG=Kl?function(){try{return arguments.callee,jg}catch(r){try{return Kl(arguments,"callee").get}catch(t){return jg}}}():jg,Bu=mw()(),Rr=Zg(),aG=Xg(),uG=Wg(),Vw=wh(),jl=Sh(),zu={},lG=typeof Uint8Array=="undefined"||!Rr?Ke:Rr(Uint8Array),Aa={__proto__:null,"%AggregateError%":typeof AggregateError=="undefined"?Ke:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer=="undefined"?Ke:ArrayBuffer,"%ArrayIteratorPrototype%":Bu&&Rr?Rr([][Symbol.iterator]()):Ke,"%AsyncFromSyncIteratorPrototype%":Ke,"%AsyncFunction%":zu,"%AsyncGenerator%":zu,"%AsyncGeneratorFunction%":zu,"%AsyncIteratorPrototype%":zu,"%Atomics%":typeof Atomics=="undefined"?Ke:Atomics,"%BigInt%":typeof BigInt=="undefined"?Ke:BigInt,"%BigInt64Array%":typeof BigInt64Array=="undefined"?Ke:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array=="undefined"?Ke:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView=="undefined"?Ke:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Yz,"%eval%":eval,"%EvalError%":$z,"%Float16Array%":typeof Float16Array=="undefined"?Ke:Float16Array,"%Float32Array%":typeof Float32Array=="undefined"?Ke:Float32Array,"%Float64Array%":typeof Float64Array=="undefined"?Ke:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry=="undefined"?Ke:FinalizationRegistry,"%Function%":qw,"%GeneratorFunction%":zu,"%Int8Array%":typeof Int8Array=="undefined"?Ke:Int8Array,"%Int16Array%":typeof Int16Array=="undefined"?Ke:Int16Array,"%Int32Array%":typeof Int32Array=="undefined"?Ke:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Bu&&Rr?Rr(Rr([][Symbol.iterator]())):Ke,"%JSON%":typeof JSON=="object"?JSON:Ke,"%Map%":typeof Map=="undefined"?Ke:Map,"%MapIteratorPrototype%":typeof Map=="undefined"||!Bu||!Rr?Ke:Rr(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Xz,"%Object.getOwnPropertyDescriptor%":Kl,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise=="undefined"?Ke:Promise,"%Proxy%":typeof Proxy=="undefined"?Ke:Proxy,"%RangeError%":Zz,"%ReferenceError%":Jz,"%Reflect%":typeof Reflect=="undefined"?Ke:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set=="undefined"?Ke:Set,"%SetIteratorPrototype%":typeof Set=="undefined"||!Bu||!Rr?Ke:Rr(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer=="undefined"?Ke:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Bu&&Rr?Rr(""[Symbol.iterator]()):Ke,"%Symbol%":Bu?Symbol:Ke,"%SyntaxError%":ku,"%ThrowTypeError%":sG,"%TypedArray%":lG,"%TypeError%":Gu,"%Uint8Array%":typeof Uint8Array=="undefined"?Ke:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray=="undefined"?Ke:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array=="undefined"?Ke:Uint16Array,"%Uint32Array%":typeof Uint32Array=="undefined"?Ke:Uint32Array,"%URIError%":Kz,"%WeakMap%":typeof WeakMap=="undefined"?Ke:WeakMap,"%WeakRef%":typeof WeakRef=="undefined"?Ke:WeakRef,"%WeakSet%":typeof WeakSet=="undefined"?Ke:WeakSet,"%Function.prototype.call%":jl,"%Function.prototype.apply%":Vw,"%Object.defineProperty%":oG,"%Object.getPrototypeOf%":aG,"%Math.abs%":jz,"%Math.floor%":Qz,"%Math.max%":tG,"%Math.min%":eG,"%Math.pow%":nG,"%Math.round%":rG,"%Math.sign%":iG,"%Reflect.getPrototypeOf%":uG};if(Rr)try{null.error}catch(r){zw=Rr(Rr(r)),Aa["%Error.prototype%"]=zw}var zw,cG=function r(t){var e;if(t==="%AsyncFunction%")e=Kg("async function () {}");else if(t==="%GeneratorFunction%")e=Kg("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=Kg("async function* () {}");else if(t==="%AsyncGenerator%"){var o=r("%AsyncGeneratorFunction%");o&&(e=o.prototype)}else if(t==="%AsyncIteratorPrototype%"){var a=r("%AsyncGenerator%");a&&Rr&&(e=Rr(a.prototype))}return Aa[t]=e,e},Gw={__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"]},Ql=Uu(),Th=Jg(),fG=Ql.call(jl,Array.prototype.concat),hG=Ql.call(Vw,Array.prototype.splice),kw=Ql.call(jl,String.prototype.replace),Ah=Ql.call(jl,String.prototype.slice),pG=Ql.call(jl,RegExp.prototype.exec),dG=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,mG=/\\(\\)?/g,gG=function(t){var e=Ah(t,0,1),o=Ah(t,-1);if(e==="%"&&o!=="%")throw new ku("invalid intrinsic syntax, expected closing `%`");if(o==="%"&&e!=="%")throw new ku("invalid intrinsic syntax, expected opening `%`");var a=[];return kw(t,dG,function(l,h,f,p){a[a.length]=f?kw(p,mG,"$1"):h||l}),a},yG=function(t,e){var o=t,a;if(Th(Gw,o)&&(a=Gw[o],o="%"+a[0]+"%"),Th(Aa,o)){var l=Aa[o];if(l===zu&&(l=cG(o)),typeof l=="undefined"&&!e)throw new Gu("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:a,name:o,value:l}}throw new ku("intrinsic "+t+" does not exist!")};Hw.exports=function(t,e){if(typeof t!="string"||t.length===0)throw new Gu("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new Gu('"allowMissing" argument must be a boolean');if(pG(/^%?[^%]*%?$/,t)===null)throw new ku("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var o=gG(t),a=o.length>0?o[0]:"",l=yG("%"+a+"%",e),h=l.name,f=l.value,p=!1,d=l.alias;d&&(a=d[0],hG(o,fG([0,1],d)));for(var g=1,x=!0;g<o.length;g+=1){var v=o[g],M=Ah(v,0,1),b=Ah(v,-1);if((M==='"'||M==="'"||M==="`"||b==='"'||b==="'"||b==="`")&&M!==b)throw new ku("property names with quotes must have matching quotes");if((v==="constructor"||!x)&&(p=!0),a+="."+v,h="%"+a+"%",Th(Aa,h))f=Aa[h];else if(f!=null){if(!(v in f)){if(!e)throw new Gu("base intrinsic for "+t+" exists, but the property is not available.");return}if(Kl&&g+1>=o.length){var T=Kl(f,v);x=!!T,x&&"get"in T&&!("originalValue"in T.get)?f=T.get:f=f[v]}else x=Th(f,v),f=f[v];x&&!p&&(Aa[h]=f)}}return f}});var Ch=nt((DY,Yw)=>{"use strict";var Ww=Qg(),Xw=bh(),vG=Xw([Ww("%String.prototype.indexOf%")]);Yw.exports=function(t,e){var o=Ww(t,!!e);return typeof o=="function"&&vG(t,".prototype.")>-1?Xw([o]):o}});var Jw=nt((FY,Zw)=>{"use strict";var _G=xh()(),xG=Ch(),t0=xG("Object.prototype.toString"),Ph=function(t){return _G&&t&&typeof t=="object"&&Symbol.toStringTag in t?!1:t0(t)==="[object Arguments]"},$w=function(t){return Ph(t)?!0:t!==null&&typeof t=="object"&&"length"in t&&typeof t.length=="number"&&t.length>=0&&t0(t)!=="[object Array]"&&"callee"in t&&t0(t.callee)==="[object Function]"},EG=function(){return Ph(arguments)}();Ph.isLegacyArguments=$w;Zw.exports=EG?Ph:$w});var Ih=nt((UY,Qw)=>{"use strict";var Kw=Jl(),MG=Hg(),qu=ba(),jw=Ta();Qw.exports=function(t,e,o){if(!t||typeof t!="object"&&typeof t!="function")throw new qu("`obj` must be an object or a function`");if(typeof e!="string"&&typeof e!="symbol")throw new qu("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new qu("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new qu("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new qu("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new qu("`loose`, if provided, must be a boolean");var a=arguments.length>3?arguments[3]:null,l=arguments.length>4?arguments[4]:null,h=arguments.length>5?arguments[5]:null,f=arguments.length>6?arguments[6]:!1,p=!!jw&&jw(t,e);if(Kw)Kw(t,e,{configurable:h===null&&p?p.configurable:!h,enumerable:a===null&&p?p.enumerable:!a,value:o,writable:l===null&&p?p.writable:!l});else if(f||!a&&!l&&!h)t[e]=o;else throw new MG("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var Rh=nt((BY,eb)=>{"use strict";var e0=Jl(),tb=function(){return!!e0};tb.hasArrayLengthDefineBug=function(){if(!e0)return null;try{return e0([],"length",{value:1}).length!==1}catch(t){return!0}};eb.exports=tb});var Vu=nt((zY,ob)=>{"use strict";var SG=Gg(),wG=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",bG=Object.prototype.toString,TG=Array.prototype.concat,nb=Ih(),AG=function(r){return typeof r=="function"&&bG.call(r)==="[object Function]"},rb=Rh()(),CG=function(r,t,e,o){if(t in r){if(o===!0){if(r[t]===e)return}else if(!AG(o)||!o())return}rb?nb(r,t,e,!0):nb(r,t,e)},ib=function(r,t){var e=arguments.length>2?arguments[2]:{},o=SG(t);wG&&(o=TG.call(o,Object.getOwnPropertySymbols(t)));for(var a=0;a<o.length;a+=1)CG(r,o[a],t[o[a]],e[o[a]])};ib.supportsDescriptors=!!rb;ob.exports=ib});var cb=nt((GY,lb)=>{"use strict";var PG=Qg(),sb=Ih(),IG=Rh()(),ab=Ta(),ub=ba(),RG=PG("%Math.floor%");lb.exports=function(t,e){if(typeof t!="function")throw new ub("`fn` is not a function");if(typeof e!="number"||e<0||e>4294967295||RG(e)!==e)throw new ub("`length` must be a positive 32-bit integer");var o=arguments.length>2&&!!arguments[2],a=!0,l=!0;if("length"in t&&ab){var h=ab(t,"length");h&&!h.configurable&&(a=!1),h&&!h.writable&&(l=!1)}return(a||l||!o)&&(IG?sb(t,"length",e,!0,!0):sb(t,"length",e)),t}});var hb=nt((kY,fb)=>{"use strict";var LG=Uu(),NG=wh(),OG=Yg();fb.exports=function(){return OG(LG,NG,arguments)}});var n0=nt((qY,Lh)=>{"use strict";var DG=cb(),pb=Jl(),FG=bh(),db=hb();Lh.exports=function(t){var e=FG(arguments),o=t.length-(arguments.length-1);return DG(e,1+(o>0?o:0),!0)};pb?pb(Lh.exports,"apply",{value:db}):Lh.exports.apply=db});var r0=nt((VY,gb)=>{"use strict";var mb=function(r){return r!==r};gb.exports=function(t,e){return t===0&&e===0?1/t===1/e:!!(t===e||mb(t)&&mb(e))}});var i0=nt((HY,yb)=>{"use strict";var UG=r0();yb.exports=function(){return typeof Object.is=="function"?Object.is:UG}});var _b=nt((WY,vb)=>{"use strict";var BG=i0(),zG=Vu();vb.exports=function(){var t=BG();return zG(Object,{is:t},{is:function(){return Object.is!==t}}),t}});var Sb=nt((XY,Mb)=>{"use strict";var GG=Vu(),kG=n0(),qG=r0(),xb=i0(),VG=_b(),Eb=kG(xb(),Object);GG(Eb,{getPolyfill:xb,implementation:qG,shim:VG});Mb.exports=Eb});var Pb=nt((YY,Cb)=>{"use strict";var wb=Ch(),HG=xh()(),WG=Jg(),XG=Ta(),a0;HG?(bb=wb("RegExp.prototype.exec"),o0={},Nh=function(){throw o0},s0={toString:Nh,valueOf:Nh},typeof Symbol.toPrimitive=="symbol"&&(s0[Symbol.toPrimitive]=Nh),a0=function(t){if(!t||typeof t!="object")return!1;var e=XG(t,"lastIndex"),o=e&&WG(e,"value");if(!o)return!1;try{bb(t,s0)}catch(a){return a===o0}}):(Tb=wb("Object.prototype.toString"),Ab="[object RegExp]",a0=function(t){return!t||typeof t!="object"&&typeof t!="function"?!1:Tb(t)===Ab});var bb,o0,Nh,s0,Tb,Ab;Cb.exports=a0});var Rb=nt(($Y,Ib)=>{"use strict";var ec=function(){return typeof function(){}.name=="string"},tc=Object.getOwnPropertyDescriptor;if(tc)try{tc([],"length")}catch(r){tc=null}ec.functionsHaveConfigurableNames=function(){if(!ec()||!tc)return!1;var t=tc(function(){},"name");return!!t&&!!t.configurable};var YG=Function.prototype.bind;ec.boundFunctionsHaveNames=function(){return ec()&&typeof YG=="function"&&function(){}.bind().name!==""};Ib.exports=ec});var Ob=nt((ZY,Nb)=>{"use strict";var Lb=Ih(),$G=Rh()(),ZG=Rb().functionsHaveConfigurableNames(),JG=ba();Nb.exports=function(t,e){if(typeof t!="function")throw new JG("`fn` is not a function");var o=arguments.length>2&&!!arguments[2];return(!o||ZG)&&($G?Lb(t,"name",e,!0,!0):Lb(t,"name",e)),t}});var u0=nt((JY,Db)=>{"use strict";var KG=Ob(),jG=ba(),QG=Object;Db.exports=KG(function(){if(this==null||this!==QG(this))throw new jG("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 l0=nt((KY,Fb)=>{"use strict";var tk=u0(),ek=Vu().supportsDescriptors,nk=Object.getOwnPropertyDescriptor;Fb.exports=function(){if(ek&&/a/mig.flags==="gim"){var t=nk(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 tk}});var zb=nt((jY,Bb)=>{"use strict";var rk=Vu().supportsDescriptors,ik=l0(),ok=Ta(),sk=Object.defineProperty,ak=Vg(),Ub=Zg(),uk=/a/;Bb.exports=function(){if(!rk||!Ub)throw new ak("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var t=ik(),e=Ub(uk),o=ok(e,"flags");return(!o||o.get!==t)&&sk(e,"flags",{configurable:!0,enumerable:!1,get:t}),t}});var Vb=nt((QY,qb)=>{"use strict";var lk=Vu(),ck=n0(),fk=u0(),Gb=l0(),hk=zb(),kb=ck(Gb());lk(kb,{getPolyfill:Gb,implementation:fk,shim:hk});qb.exports=kb});var Xb=nt((t$,Wb)=>{"use strict";var Hb=Ch(),pk=Hb("Date.prototype.getDay"),dk=function(t){try{return pk(t),!0}catch(e){return!1}},mk=Hb("Object.prototype.toString"),gk="[object Date]",yk=xh()();Wb.exports=function(t){return typeof t!="object"||t===null?!1:yk?dk(t):mk(t)===gk}});var c0=nt((e$,rT)=>{var Yb=Gg(),$b=Jw(),Zb=Sb(),Jb=Pb(),Kb=Vb(),jb=Xb(),Qb=Date.prototype.getTime;function nT(r,t,e){var o=e||{};return(o.strict?Zb(r,t):r===t)?!0:!r||!t||typeof r!="object"&&typeof t!="object"?o.strict?Zb(r,t):r==t:vk(r,t,o)}function tT(r){return r==null}function eT(r){return!(!r||typeof r!="object"||typeof r.length!="number"||typeof r.copy!="function"||typeof r.slice!="function"||r.length>0&&typeof r[0]!="number")}function vk(r,t,e){var o,a;if(typeof r!=typeof t||tT(r)||tT(t)||r.prototype!==t.prototype||$b(r)!==$b(t))return!1;var l=Jb(r),h=Jb(t);if(l!==h)return!1;if(l||h)return r.source===t.source&&Kb(r)===Kb(t);if(jb(r)&&jb(t))return Qb.call(r)===Qb.call(t);var f=eT(r),p=eT(t);if(f!==p)return!1;if(f||p){if(r.length!==t.length)return!1;for(o=0;o<r.length;o++)if(r[o]!==t[o])return!1;return!0}if(typeof r!=typeof t)return!1;try{var d=Yb(r),g=Yb(t)}catch(x){return!1}if(d.length!==g.length)return!1;for(d.sort(),g.sort(),o=d.length-1;o>=0;o--)if(d[o]!=g[o])return!1;for(o=d.length-1;o>=0;o--)if(a=d[o],!nT(r[a],t[a],e))return!1;return!0}rT.exports=nT});var M0=nt((aJ,cT)=>{var u4=c0(),No=function(r){this.precision=r&&r.precision?r.precision:17,this.direction=r&&r.direction?r.direction:!1,this.pseudoNode=r&&r.pseudoNode?r.pseudoNode:!1,this.objectComparator=r&&r.objectComparator?r.objectComparator:l4};No.prototype.compare=function(r,t){if(r.type!==t.type||!lT(r,t))return!1;switch(r.type){case"Point":return this.compareCoord(r.coordinates,t.coordinates);case"LineString":return this.compareLine(r.coordinates,t.coordinates,0,!1);case"Polygon":return this.comparePolygon(r,t);case"Feature":return this.compareFeature(r,t);default:if(r.type.indexOf("Multi")===0){var e=this,o=uT(r),a=uT(t);return o.every(function(l){return this.some(function(h){return e.compare(l,h)})},a)}}return!1};function uT(r){return r.coordinates.map(function(t){return{type:r.type.replace("Multi",""),coordinates:t}})}function lT(r,t){return r.hasOwnProperty("coordinates")?r.coordinates.length===t.coordinates.length:r.length===t.length}No.prototype.compareCoord=function(r,t){if(r.length!==t.length)return!1;for(var e=0;e<r.length;e++)if(r[e].toFixed(this.precision)!==t[e].toFixed(this.precision))return!1;return!0};No.prototype.compareLine=function(r,t,e,o){if(!lT(r,t))return!1;var a=this.pseudoNode?r:this.removePseudo(r),l=this.pseudoNode?t:this.removePseudo(t);if(!(o&&!this.compareCoord(a[0],l[0])&&(l=this.fixStartIndex(l,a),!l))){var h=this.compareCoord(a[e],l[e]);return this.direction||h?this.comparePath(a,l):this.compareCoord(a[e],l[l.length-(1+e)])?this.comparePath(a.slice().reverse(),l):!1}};No.prototype.fixStartIndex=function(r,t){for(var e,o=-1,a=0;a<r.length;a++)if(this.compareCoord(r[a],t[0])){o=a;break}return o>=0&&(e=[].concat(r.slice(o,r.length),r.slice(1,o+1))),e};No.prototype.comparePath=function(r,t){var e=this;return r.every(function(o,a){return e.compareCoord(o,this[a])},t)};No.prototype.comparePolygon=function(r,t){if(this.compareLine(r.coordinates[0],t.coordinates[0],1,!0)){var e=r.coordinates.slice(1,r.coordinates.length),o=t.coordinates.slice(1,t.coordinates.length),a=this;return e.every(function(l){return this.some(function(h){return a.compareLine(l,h,1,!0)})},o)}else return!1};No.prototype.compareFeature=function(r,t){return r.id!==t.id||!this.objectComparator(r.properties,t.properties)||!this.compareBBox(r,t)?!1:this.compare(r.geometry,t.geometry)};No.prototype.compareBBox=function(r,t){return!!(!r.bbox&&!t.bbox||r.bbox&&t.bbox&&this.compareCoord(r.bbox,t.bbox))};No.prototype.removePseudo=function(r){return r};function l4(r,t){return u4(r,t,{strict:!0})}cT.exports=No});var fT=nt((_J,Fh)=>{function qs(r,t,e,o){this.dataset=[],this.epsilon=1,this.minPts=2,this.distance=this._euclideanDistance,this.clusters=[],this.noise=[],this._visited=[],this._assigned=[],this._datasetLength=0,this._init(r,t,e,o)}qs.prototype.run=function(r,t,e,o){this._init(r,t,e,o);for(var a=0;a<this._datasetLength;a++)if(this._visited[a]!==1){this._visited[a]=1;var l=this._regionQuery(a);if(l.length<this.minPts)this.noise.push(a);else{var h=this.clusters.length;this.clusters.push([]),this._addToCluster(a,h),this._expandCluster(h,l)}}return this.clusters};qs.prototype._init=function(r,t,e,o){if(r){if(!(r instanceof Array))throw Error("Dataset must be of type array, "+typeof r+" given");this.dataset=r,this.clusters=[],this.noise=[],this._datasetLength=r.length,this._visited=new Array(this._datasetLength),this._assigned=new Array(this._datasetLength)}t&&(this.epsilon=t),e&&(this.minPts=e),o&&(this.distance=o)};qs.prototype._expandCluster=function(r,t){for(var e=0;e<t.length;e++){var o=t[e];if(this._visited[o]!==1){this._visited[o]=1;var a=this._regionQuery(o);a.length>=this.minPts&&(t=this._mergeArrays(t,a))}this._assigned[o]!==1&&this._addToCluster(o,r)}};qs.prototype._addToCluster=function(r,t){this.clusters[t].push(r),this._assigned[r]=1};qs.prototype._regionQuery=function(r){for(var t=[],e=0;e<this._datasetLength;e++){var o=this.distance(this.dataset[r],this.dataset[e]);o<this.epsilon&&t.push(e)}return t};qs.prototype._mergeArrays=function(r,t){for(var e=t.length,o=0;o<e;o++){var a=t[o];r.indexOf(a)<0&&r.push(a)}return r};qs.prototype._euclideanDistance=function(r,t){for(var e=0,o=Math.min(r.length,t.length);o--;)e+=(r[o]-t[o])*(r[o]-t[o]);return Math.sqrt(e)};typeof Fh!="undefined"&&Fh.exports&&(Fh.exports=qs)});var hT=nt((xJ,Uh)=>{function Vs(r,t,e){this.k=3,this.dataset=[],this.assignments=[],this.centroids=[],this.init(r,t,e)}Vs.prototype.init=function(r,t,e){this.assignments=[],this.centroids=[],typeof r!="undefined"&&(this.dataset=r),typeof t!="undefined"&&(this.k=t),typeof e!="undefined"&&(this.distance=e)};Vs.prototype.run=function(r,t){this.init(r,t);for(var e=this.dataset.length,o=0;o<this.k;o++)this.centroids[o]=this.randomCentroid();for(var a=!0;a;){a=this.assign();for(var l=0;l<this.k;l++){for(var h=new Array(g),f=0,p=0;p<g;p++)h[p]=0;for(var d=0;d<e;d++){var g=this.dataset[d].length;if(l===this.assignments[d]){for(var p=0;p<g;p++)h[p]+=this.dataset[d][p];f++}}if(f>0){for(var p=0;p<g;p++)h[p]/=f;this.centroids[l]=h}else this.centroids[l]=this.randomCentroid(),a=!0}}return this.getClusters()};Vs.prototype.randomCentroid=function(){var r=this.dataset.length-1,t,e;do e=Math.round(Math.random()*r),t=this.dataset[e];while(this.centroids.indexOf(t)>=0);return t};Vs.prototype.assign=function(){for(var r=!1,t=this.dataset.length,e,o=0;o<t;o++)e=this.argmin(this.dataset[o],this.centroids,this.distance),e!=this.assignments[o]&&(this.assignments[o]=e,r=!0);return r};Vs.prototype.getClusters=function(){for(var r=new Array(this.k),t,e=0;e<this.assignments.length;e++)t=this.assignments[e],typeof r[t]=="undefined"&&(r[t]=[]),r[t].push(e);return r};Vs.prototype.argmin=function(r,t,e){for(var o=Number.MAX_VALUE,a=0,l=t.length,h,f=0;f<l;f++)h=e(r,t[f]),h<o&&(o=h,a=f);return a};Vs.prototype.distance=function(r,t){for(var e=0,o=Math.min(r.length,t.length);o--;){var a=r[o]-t[o];e+=a*a}return Math.sqrt(e)};typeof Uh!="undefined"&&Uh.exports&&(Uh.exports=Vs)});var S0=nt((EJ,Bh)=>{function Oo(r,t,e){this._queue=[],this._priorities=[],this._sorting="desc",this._init(r,t,e)}Oo.prototype.insert=function(r,t){for(var e=this._queue.length,o=e;o--;){var a=this._priorities[o];this._sorting==="desc"?t>a&&(e=o):t<a&&(e=o)}this._insertAt(r,t,e)};Oo.prototype.remove=function(r){for(var t=this._queue.length;t--;){var e=this._queue[t];if(r===e){this._queue.splice(t,1),this._priorities.splice(t,1);break}}};Oo.prototype.forEach=function(r){this._queue.forEach(r)};Oo.prototype.getElements=function(){return this._queue};Oo.prototype.getElementPriority=function(r){return this._priorities[r]};Oo.prototype.getPriorities=function(){return this._priorities};Oo.prototype.getElementsWithPriorities=function(){for(var r=[],t=0,e=this._queue.length;t<e;t++)r.push([this._queue[t],this._priorities[t]]);return r};Oo.prototype._init=function(r,t,e){if(r&&t){if(this._queue=[],this._priorities=[],r.length!==t.length)throw new Error("Arrays must have the same length");for(var o=0;o<r.length;o++)this.insert(r[o],t[o])}e&&(this._sorting=e)};Oo.prototype._insertAt=function(r,t,e){this._queue.length===e?(this._queue.push(r),this._priorities.push(t)):(this._queue.splice(e,0,r),this._priorities.splice(e,0,t))};typeof Bh!="undefined"&&Bh.exports&&(Bh.exports=Oo)});var dT=nt((MJ,Wu)=>{typeof Wu!="undefined"&&Wu.exports&&(pT=S0());var pT;function ls(r,t,e,o){this.epsilon=1,this.minPts=1,this.distance=this._euclideanDistance,this._reachability=[],this._processed=[],this._coreDistance=0,this._orderedList=[],this._init(r,t,e,o)}ls.prototype.run=function(r,t,e,o){this._init(r,t,e,o);for(var a=0,l=this.dataset.length;a<l;a++)if(this._processed[a]!==1){this._processed[a]=1,this.clusters.push([a]);var h=this.clusters.length-1;this._orderedList.push(a);var f=new pT(null,null,"asc"),p=this._regionQuery(a);this._distanceToCore(a)!==void 0&&(this._updateQueue(a,p,f),this._expandCluster(h,f))}return this.clusters};ls.prototype.getReachabilityPlot=function(){for(var r=[],t=0,e=this._orderedList.length;t<e;t++){var o=this._orderedList[t],a=this._reachability[o];r.push([o,a])}return r};ls.prototype._init=function(r,t,e,o){if(r){if(!(r instanceof Array))throw Error("Dataset must be of type array, "+typeof r+" given");this.dataset=r,this.clusters=[],this._reachability=new Array(this.dataset.length),this._processed=new Array(this.dataset.length),this._coreDistance=0,this._orderedList=[]}t&&(this.epsilon=t),e&&(this.minPts=e),o&&(this.distance=o)};ls.prototype._updateQueue=function(r,t,e){var o=this;this._coreDistance=this._distanceToCore(r),t.forEach(function(a){if(o._processed[a]===void 0){var l=o.distance(o.dataset[r],o.dataset[a]),h=Math.max(o._coreDistance,l);o._reachability[a]===void 0?(o._reachability[a]=h,e.insert(a,h)):h<o._reachability[a]&&(o._reachability[a]=h,e.remove(a),e.insert(a,h))}})};ls.prototype._expandCluster=function(r,t){for(var e=t.getElements(),o=0,a=e.length;o<a;o++){var l=e[o];if(this._processed[l]===void 0){var h=this._regionQuery(l);this._processed[l]=1,this.clusters[r].push(l),this._orderedList.push(l),this._distanceToCore(l)!==void 0&&(this._updateQueue(l,h,t),this._expandCluster(r,t))}}};ls.prototype._distanceToCore=function(r){for(var t=this.epsilon,e=0;e<t;e++){var o=this._regionQuery(r,e);if(o.length>=this.minPts)return e}};ls.prototype._regionQuery=function(r,t){t=t||this.epsilon;for(var e=[],o=0,a=this.dataset.length;o<a;o++)this.distance(this.dataset[r],this.dataset[o])<t&&e.push(o);return e};ls.prototype._euclideanDistance=function(r,t){for(var e=0,o=Math.min(r.length,t.length);o--;)e+=(r[o]-t[o])*(r[o]-t[o]);return Math.sqrt(e)};typeof Wu!="undefined"&&Wu.exports&&(Wu.exports=ls)});var mT=nt((SJ,zh)=>{typeof zh!="undefined"&&zh.exports&&(zh.exports={DBSCAN:fT(),KMEANS:hT(),OPTICS:dT(),PriorityQueue:S0()})});var w0=nt((PJ,yT)=>{"use strict";yT.exports={eudist:function(t,e,o){for(var a=t.length,l=0,h=0;h<a;h++){var f=(t[h]||0)-(e[h]||0);l+=f*f}return o?Math.sqrt(l):l},mandist:function(t,e,o){for(var a=t.length,l=0,h=0;h<a;h++)l+=Math.abs((t[h]||0)-(e[h]||0));return o?Math.sqrt(l):l},dist:function(t,e,o){var a=Math.abs(t-e);return o?a:a*a}}});var xT=nt((IJ,_T)=>{"use strict";var vT=w0(),m4=vT.eudist,g4=vT.dist;_T.exports={kmrand:function(t,e){for(var o={},a=[],l=e<<2,h=t.length,f=t[0].length>0;a.length<e&&l-- >0;){var p=t[Math.floor(Math.random()*h)],d=f?p.join("_"):""+p;o[d]||(o[d]=!0,a.push(p))}if(a.length<e)throw new Error("Error initializating clusters");return a},kmpp:function(t,e){var o=t[0].length?m4:g4,a=[],l=t.length,h=t[0].length>0,f={},p=t[Math.floor(Math.random()*l)],d=h?p.join("_"):""+p;for(a.push(p),f[d]=!0;a.length<e;){for(var g=[],x=a.length,v=0,M=[],b=0;b<l;b++){for(var T=1/0,_=0;_<x;_++){var y=o(t[b],a[_]);y<=T&&(T=y)}g[b]=T}for(var A=0;A<l;A++)v+=g[A];for(var S=0;S<l;S++)M[S]={i:S,v:t[S],pr:g[S]/v,cs:0};M.sort(function(F,I){return F.pr-I.pr}),M[0].cs=M[0].pr;for(var L=1;L<l;L++)M[L].cs=M[L-1].cs+M[L].pr;for(var G=Math.random(),z=0;z<l-1&&M[z++].cs<G;);a.push(M[z-1].v)}return a}}});var bT=nt((NJ,wT)=>{"use strict";var b0=w0(),ST=xT(),y4=b0.eudist,RJ=b0.mandist,LJ=b0.dist,v4=ST.kmrand,_4=ST.kmpp,ET=1e4;function MT(r,t,e){e=e||[];for(var o=0;o<r;o++)e[o]=t;return e}function x4(r,t,e,o){var a=[],l=[],h=[],f=[],p=!1,d=o||ET,g=r.length,x=r[0].length,v=x>0,M=[];if(e)e=="kmrand"?a=v4(r,t):e=="kmpp"?a=_4(r,t):a=e;else for(var b={};a.length<t;){var T=Math.floor(Math.random()*g);b[T]||(b[T]=!0,a.push(r[T]))}do{MT(t,0,M);for(var _=0;_<g;_++){for(var y=1/0,A=0,S=0;S<t;S++){var f=v?y4(r[_],a[S]):Math.abs(r[_]-a[S]);f<=y&&(y=f,A=S)}h[_]=A,M[A]++}for(var L=[],l=[],G=0,z=0;z<t;z++)L[z]=v?MT(x,0,L[z]):0,l[z]=a[z];if(v){for(var F=0;F<t;F++)a[F]=[];for(var I=0;I<g;I++)for(var ut=h[I],R=L[ut],W=r[I],V=0;V<x;V++)R[V]+=W[V];p=!0;for(var Mt=0;Mt<t;Mt++){for(var X=a[Mt],mt=L[Mt],dt=l[Mt],_t=M[Mt],it=0;it<x;it++)X[it]=mt[it]/_t||0;if(p){for(var lt=0;lt<x;lt++)if(dt[lt]!=X[lt]){p=!1;break}}}}else{for(var H=0;H<g;H++){var bt=h[H];L[bt]+=r[H]}for(var Tt=0;Tt<t;Tt++)a[Tt]=L[Tt]/M[Tt]||0;p=!0;for(var Yt=0;Yt<t;Yt++)if(l[Yt]!=a[Yt]){p=!1;break}}p=p||--d<=0}while(!p);return{it:ET-d,k:t,idxs:h,centroids:a}}wT.exports=x4});var Ju=nt((R0,L0)=>{(function(r,t){typeof R0=="object"&&typeof L0!="undefined"?L0.exports=t():typeof define=="function"&&define.amd?define(t):(r=typeof globalThis!="undefined"?globalThis:r||self,r.polygonClipping=t())})(R0,function(){"use strict";function r(J,w){var P={label:0,sent:function(){if(B[0]&1)throw B[1];return B[1]},trys:[],ops:[]},D,k,B,et;return et={next:j(0),throw:j(1),return:j(2)},typeof Symbol=="function"&&(et[Symbol.iterator]=function(){return this}),et;function j(ct){return function(O){return ft([ct,O])}}function ft(ct){if(D)throw new TypeError("Generator is already executing.");for(;P;)try{if(D=1,k&&(B=ct[0]&2?k.return:ct[0]?k.throw||((B=k.return)&&B.call(k),0):k.next)&&!(B=B.call(k,ct[1])).done)return B;switch(k=0,B&&(ct=[ct[0]&2,B.value]),ct[0]){case 0:case 1:B=ct;break;case 4:return P.label++,{value:ct[1],done:!1};case 5:P.label++,k=ct[1],ct=[0];continue;case 7:ct=P.ops.pop(),P.trys.pop();continue;default:if(B=P.trys,!(B=B.length>0&&B[B.length-1])&&(ct[0]===6||ct[0]===2)){P=0;continue}if(ct[0]===3&&(!B||ct[1]>B[0]&&ct[1]<B[3])){P.label=ct[1];break}if(ct[0]===6&&P.label<B[1]){P.label=B[1],B=ct;break}if(B&&P.label<B[2]){P.label=B[2],P.ops.push(ct);break}B[2]&&P.ops.pop(),P.trys.pop();continue}ct=w.call(J,P)}catch(O){ct=[6,O],k=0}finally{D=B=0}if(ct[0]&5)throw ct[1];return{value:ct[0]?ct[1]:void 0,done:!0}}}var t=function(){function J(w,P){this.next=null,this.key=w,this.data=P,this.left=null,this.right=null}return J}();function e(J,w){return J>w?1:J<w?-1:0}function o(J,w,P){for(var D=new t(null,null),k=D,B=D;;){var et=P(J,w.key);if(et<0){if(w.left===null)break;if(P(J,w.left.key)<0){var j=w.left;if(w.left=j.right,j.right=w,w=j,w.left===null)break}B.left=w,B=w,w=w.left}else if(et>0){if(w.right===null)break;if(P(J,w.right.key)>0){var j=w.right;if(w.right=j.left,j.left=w,w=j,w.right===null)break}k.right=w,k=w,w=w.right}else break}return k.right=w.left,B.left=w.right,w.left=D.right,w.right=D.left,w}function a(J,w,P,D){var k=new t(J,w);if(P===null)return k.left=k.right=null,k;P=o(J,P,D);var B=D(J,P.key);return B<0?(k.left=P.left,k.right=P,P.left=null):B>=0&&(k.right=P.right,k.left=P,P.right=null),k}function l(J,w,P){var D=null,k=null;if(w){w=o(J,w,P);var B=P(w.key,J);B===0?(D=w.left,k=w.right):B<0?(k=w.right,w.right=null,D=w):(D=w.left,w.left=null,k=w)}return{left:D,right:k}}function h(J,w,P){return w===null?J:(J===null||(w=o(J.key,w,P),w.left=J),w)}function f(J,w,P,D,k){if(J){D(""+w+(P?"\u2514\u2500\u2500 ":"\u251C\u2500\u2500 ")+k(J)+`
|
|
4
|
+
`);var B=w+(P?" ":"\u2502 ");J.left&&f(J.left,B,!1,D,k),J.right&&f(J.right,B,!0,D,k)}}var p=function(){function J(w){w===void 0&&(w=e),this._root=null,this._size=0,this._comparator=w}return J.prototype.insert=function(w,P){return this._size++,this._root=a(w,P,this._root,this._comparator)},J.prototype.add=function(w,P){var D=new t(w,P);this._root===null&&(D.left=D.right=null,this._size++,this._root=D);var k=this._comparator,B=o(w,this._root,k),et=k(w,B.key);return et===0?this._root=B:(et<0?(D.left=B.left,D.right=B,B.left=null):et>0&&(D.right=B.right,D.left=B,B.right=null),this._size++,this._root=D),this._root},J.prototype.remove=function(w){this._root=this._remove(w,this._root,this._comparator)},J.prototype._remove=function(w,P,D){var k;if(P===null)return null;P=o(w,P,D);var B=D(w,P.key);return B===0?(P.left===null?k=P.right:(k=o(w,P.left,D),k.right=P.right),this._size--,k):P},J.prototype.pop=function(){var w=this._root;if(w){for(;w.left;)w=w.left;return this._root=o(w.key,this._root,this._comparator),this._root=this._remove(w.key,this._root,this._comparator),{key:w.key,data:w.data}}return null},J.prototype.findStatic=function(w){for(var P=this._root,D=this._comparator;P;){var k=D(w,P.key);if(k===0)return P;k<0?P=P.left:P=P.right}return null},J.prototype.find=function(w){return this._root&&(this._root=o(w,this._root,this._comparator),this._comparator(w,this._root.key)!==0)?null:this._root},J.prototype.contains=function(w){for(var P=this._root,D=this._comparator;P;){var k=D(w,P.key);if(k===0)return!0;k<0?P=P.left:P=P.right}return!1},J.prototype.forEach=function(w,P){for(var D=this._root,k=[],B=!1;!B;)D!==null?(k.push(D),D=D.left):k.length!==0?(D=k.pop(),w.call(P,D),D=D.right):B=!0;return this},J.prototype.range=function(w,P,D,k){for(var B=[],et=this._comparator,j=this._root,ft;B.length!==0||j;)if(j)B.push(j),j=j.left;else{if(j=B.pop(),ft=et(j.key,P),ft>0)break;if(et(j.key,w)>=0&&D.call(k,j))return this;j=j.right}return this},J.prototype.keys=function(){var w=[];return this.forEach(function(P){var D=P.key;return w.push(D)}),w},J.prototype.values=function(){var w=[];return this.forEach(function(P){var D=P.data;return w.push(D)}),w},J.prototype.min=function(){return this._root?this.minNode(this._root).key:null},J.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},J.prototype.minNode=function(w){if(w===void 0&&(w=this._root),w)for(;w.left;)w=w.left;return w},J.prototype.maxNode=function(w){if(w===void 0&&(w=this._root),w)for(;w.right;)w=w.right;return w},J.prototype.at=function(w){for(var P=this._root,D=!1,k=0,B=[];!D;)if(P)B.push(P),P=P.left;else if(B.length>0){if(P=B.pop(),k===w)return P;k++,P=P.right}else D=!0;return null},J.prototype.next=function(w){var P=this._root,D=null;if(w.right){for(D=w.right;D.left;)D=D.left;return D}for(var k=this._comparator;P;){var B=k(w.key,P.key);if(B===0)break;B<0?(D=P,P=P.left):P=P.right}return D},J.prototype.prev=function(w){var P=this._root,D=null;if(w.left!==null){for(D=w.left;D.right;)D=D.right;return D}for(var k=this._comparator;P;){var B=k(w.key,P.key);if(B===0)break;B<0?P=P.left:(D=P,P=P.right)}return D},J.prototype.clear=function(){return this._root=null,this._size=0,this},J.prototype.toList=function(){return x(this._root)},J.prototype.load=function(w,P,D){P===void 0&&(P=[]),D===void 0&&(D=!1);var k=w.length,B=this._comparator;if(D&&b(w,P,0,k-1,B),this._root===null)this._root=d(w,P,0,k),this._size=k;else{var et=M(this.toList(),g(w,P),B);k=this._size+k,this._root=v({head:et},0,k)}return this},J.prototype.isEmpty=function(){return this._root===null},Object.defineProperty(J.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(J.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),J.prototype.toString=function(w){w===void 0&&(w=function(D){return String(D.key)});var P=[];return f(this._root,"",!0,function(D){return P.push(D)},w),P.join("")},J.prototype.update=function(w,P,D){var k=this._comparator,B=l(w,this._root,k),et=B.left,j=B.right;k(w,P)<0?j=a(P,D,j,k):et=a(P,D,et,k),this._root=h(et,j,k)},J.prototype.split=function(w){return l(w,this._root,this._comparator)},J.prototype[Symbol.iterator]=function(){var w,P,D;return r(this,function(k){switch(k.label){case 0:w=this._root,P=[],D=!1,k.label=1;case 1:return D?[3,6]:w===null?[3,2]:(P.push(w),w=w.left,[3,5]);case 2:return P.length===0?[3,4]:(w=P.pop(),[4,w]);case 3:return k.sent(),w=w.right,[3,5];case 4:D=!0,k.label=5;case 5:return[3,1];case 6:return[2]}})},J}();function d(J,w,P,D){var k=D-P;if(k>0){var B=P+Math.floor(k/2),et=J[B],j=w[B],ft=new t(et,j);return ft.left=d(J,w,P,B),ft.right=d(J,w,B+1,D),ft}return null}function g(J,w){for(var P=new t(null,null),D=P,k=0;k<J.length;k++)D=D.next=new t(J[k],w[k]);return D.next=null,P.next}function x(J){for(var w=J,P=[],D=!1,k=new t(null,null),B=k;!D;)w?(P.push(w),w=w.left):P.length>0?(w=B=B.next=P.pop(),w=w.right):D=!0;return B.next=null,k.next}function v(J,w,P){var D=P-w;if(D>0){var k=w+Math.floor(D/2),B=v(J,w,k),et=J.head;return et.left=B,J.head=J.head.next,et.right=v(J,k+1,P),et}return null}function M(J,w,P){for(var D=new t(null,null),k=D,B=J,et=w;B!==null&&et!==null;)P(B.key,et.key)<0?(k.next=B,B=B.next):(k.next=et,et=et.next),k=k.next;return B!==null?k.next=B:et!==null&&(k.next=et),D.next}function b(J,w,P,D,k){if(!(P>=D)){for(var B=J[P+D>>1],et=P-1,j=D+1;;){do et++;while(k(J[et],B)<0);do j--;while(k(J[j],B)>0);if(et>=j)break;var ft=J[et];J[et]=J[j],J[j]=ft,ft=w[et],w[et]=w[j],w[j]=ft}b(J,w,P,j,k),b(J,w,j+1,D,k)}}let T=(J,w)=>J.ll.x<=w.x&&w.x<=J.ur.x&&J.ll.y<=w.y&&w.y<=J.ur.y,_=(J,w)=>{if(w.ur.x<J.ll.x||J.ur.x<w.ll.x||w.ur.y<J.ll.y||J.ur.y<w.ll.y)return null;let P=J.ll.x<w.ll.x?w.ll.x:J.ll.x,D=J.ur.x<w.ur.x?J.ur.x:w.ur.x,k=J.ll.y<w.ll.y?w.ll.y:J.ll.y,B=J.ur.y<w.ur.y?J.ur.y:w.ur.y;return{ll:{x:P,y:k},ur:{x:D,y:B}}},y=Number.EPSILON;y===void 0&&(y=Math.pow(2,-52));let A=y*y,S=(J,w)=>{if(-y<J&&J<y&&-y<w&&w<y)return 0;let P=J-w;return P*P<A*J*w?0:J<w?-1:1};class L{constructor(){this.reset()}reset(){this.xRounder=new G,this.yRounder=new G}round(w,P){return{x:this.xRounder.round(w),y:this.yRounder.round(P)}}}class G{constructor(){this.tree=new p,this.round(0)}round(w){let P=this.tree.add(w),D=this.tree.prev(P);if(D!==null&&S(P.key,D.key)===0)return this.tree.remove(w),D.key;let k=this.tree.next(P);return k!==null&&S(P.key,k.key)===0?(this.tree.remove(w),k.key):w}}let z=new L,F=11102230246251565e-32,I=134217729,ut=(3+8*F)*F;function R(J,w,P,D,k){let B,et,j,ft,ct=w[0],O=D[0],K=0,$=0;O>ct==O>-ct?(B=ct,ct=w[++K]):(B=O,O=D[++$]);let Q=0;if(K<J&&$<P)for(O>ct==O>-ct?(et=ct+B,j=B-(et-ct),ct=w[++K]):(et=O+B,j=B-(et-O),O=D[++$]),B=et,j!==0&&(k[Q++]=j);K<J&&$<P;)O>ct==O>-ct?(et=B+ct,ft=et-B,j=B-(et-ft)+(ct-ft),ct=w[++K]):(et=B+O,ft=et-B,j=B-(et-ft)+(O-ft),O=D[++$]),B=et,j!==0&&(k[Q++]=j);for(;K<J;)et=B+ct,ft=et-B,j=B-(et-ft)+(ct-ft),ct=w[++K],B=et,j!==0&&(k[Q++]=j);for(;$<P;)et=B+O,ft=et-B,j=B-(et-ft)+(O-ft),O=D[++$],B=et,j!==0&&(k[Q++]=j);return(B!==0||Q===0)&&(k[Q++]=B),Q}function W(J,w){let P=w[0];for(let D=1;D<J;D++)P+=w[D];return P}function V(J){return new Float64Array(J)}let Mt=(3+16*F)*F,X=(2+12*F)*F,mt=(9+64*F)*F*F,dt=V(4),_t=V(8),it=V(12),lt=V(16),H=V(4);function bt(J,w,P,D,k,B,et){let j,ft,ct,O,K,$,Q,St,Nt,Jt,Kt,Ee,de,Se,we,On,sr,_n,le=J-k,xn=P-k,In=w-B,Tn=D-B;Se=le*Tn,$=I*le,Q=$-($-le),St=le-Q,$=I*Tn,Nt=$-($-Tn),Jt=Tn-Nt,we=St*Jt-(Se-Q*Nt-St*Nt-Q*Jt),On=In*xn,$=I*In,Q=$-($-In),St=In-Q,$=I*xn,Nt=$-($-xn),Jt=xn-Nt,sr=St*Jt-(On-Q*Nt-St*Nt-Q*Jt),Kt=we-sr,K=we-Kt,dt[0]=we-(Kt+K)+(K-sr),Ee=Se+Kt,K=Ee-Se,de=Se-(Ee-K)+(Kt-K),Kt=de-On,K=de-Kt,dt[1]=de-(Kt+K)+(K-On),_n=Ee+Kt,K=_n-Ee,dt[2]=Ee-(_n-K)+(Kt-K),dt[3]=_n;let En=W(4,dt),Hr=X*et;if(En>=Hr||-En>=Hr||(K=J-le,j=J-(le+K)+(K-k),K=P-xn,ct=P-(xn+K)+(K-k),K=w-In,ft=w-(In+K)+(K-B),K=D-Tn,O=D-(Tn+K)+(K-B),j===0&&ft===0&&ct===0&&O===0)||(Hr=mt*et+ut*Math.abs(En),En+=le*O+Tn*j-(In*ct+xn*ft),En>=Hr||-En>=Hr))return En;Se=j*Tn,$=I*j,Q=$-($-j),St=j-Q,$=I*Tn,Nt=$-($-Tn),Jt=Tn-Nt,we=St*Jt-(Se-Q*Nt-St*Nt-Q*Jt),On=ft*xn,$=I*ft,Q=$-($-ft),St=ft-Q,$=I*xn,Nt=$-($-xn),Jt=xn-Nt,sr=St*Jt-(On-Q*Nt-St*Nt-Q*Jt),Kt=we-sr,K=we-Kt,H[0]=we-(Kt+K)+(K-sr),Ee=Se+Kt,K=Ee-Se,de=Se-(Ee-K)+(Kt-K),Kt=de-On,K=de-Kt,H[1]=de-(Kt+K)+(K-On),_n=Ee+Kt,K=_n-Ee,H[2]=Ee-(_n-K)+(Kt-K),H[3]=_n;let yr=R(4,dt,4,H,_t);Se=le*O,$=I*le,Q=$-($-le),St=le-Q,$=I*O,Nt=$-($-O),Jt=O-Nt,we=St*Jt-(Se-Q*Nt-St*Nt-Q*Jt),On=In*ct,$=I*In,Q=$-($-In),St=In-Q,$=I*ct,Nt=$-($-ct),Jt=ct-Nt,sr=St*Jt-(On-Q*Nt-St*Nt-Q*Jt),Kt=we-sr,K=we-Kt,H[0]=we-(Kt+K)+(K-sr),Ee=Se+Kt,K=Ee-Se,de=Se-(Ee-K)+(Kt-K),Kt=de-On,K=de-Kt,H[1]=de-(Kt+K)+(K-On),_n=Ee+Kt,K=_n-Ee,H[2]=Ee-(_n-K)+(Kt-K),H[3]=_n;let q=R(yr,_t,4,H,it);Se=j*O,$=I*j,Q=$-($-j),St=j-Q,$=I*O,Nt=$-($-O),Jt=O-Nt,we=St*Jt-(Se-Q*Nt-St*Nt-Q*Jt),On=ft*ct,$=I*ft,Q=$-($-ft),St=ft-Q,$=I*ct,Nt=$-($-ct),Jt=ct-Nt,sr=St*Jt-(On-Q*Nt-St*Nt-Q*Jt),Kt=we-sr,K=we-Kt,H[0]=we-(Kt+K)+(K-sr),Ee=Se+Kt,K=Ee-Se,de=Se-(Ee-K)+(Kt-K),Kt=de-On,K=de-Kt,H[1]=de-(Kt+K)+(K-On),_n=Ee+Kt,K=_n-Ee,H[2]=Ee-(_n-K)+(Kt-K),H[3]=_n;let st=R(q,it,4,H,lt);return lt[st-1]}function Tt(J,w,P,D,k,B){let et=(w-B)*(P-k),j=(J-k)*(D-B),ft=et-j,ct=Math.abs(et+j);return Math.abs(ft)>=Mt*ct?ft:-bt(J,w,P,D,k,B,ct)}let Yt=(J,w)=>J.x*w.y-J.y*w.x,tt=(J,w)=>J.x*w.x+J.y*w.y,wt=(J,w,P)=>{let D=Tt(J.x,J.y,w.x,w.y,P.x,P.y);return D>0?-1:D<0?1:0},Bt=J=>Math.sqrt(tt(J,J)),$t=(J,w,P)=>{let D={x:w.x-J.x,y:w.y-J.y},k={x:P.x-J.x,y:P.y-J.y};return Yt(k,D)/Bt(k)/Bt(D)},Ut=(J,w,P)=>{let D={x:w.x-J.x,y:w.y-J.y},k={x:P.x-J.x,y:P.y-J.y};return tt(k,D)/Bt(k)/Bt(D)},Dt=(J,w,P)=>w.y===0?null:{x:J.x+w.x/w.y*(P-J.y),y:P},At=(J,w,P)=>w.x===0?null:{x:P,y:J.y+w.y/w.x*(P-J.x)},te=(J,w,P,D)=>{if(w.x===0)return At(P,D,J.x);if(D.x===0)return At(J,w,P.x);if(w.y===0)return Dt(P,D,J.y);if(D.y===0)return Dt(J,w,P.y);let k=Yt(w,D);if(k==0)return null;let B={x:P.x-J.x,y:P.y-J.y},et=Yt(B,w)/k,j=Yt(B,D)/k,ft=J.x+j*w.x,ct=P.x+et*D.x,O=J.y+j*w.y,K=P.y+et*D.y,$=(ft+ct)/2,Q=(O+K)/2;return{x:$,y:Q}};class rt{static compare(w,P){let D=rt.comparePoints(w.point,P.point);return D!==0?D:(w.point!==P.point&&w.link(P),w.isLeft!==P.isLeft?w.isLeft?1:-1:zt.compare(w.segment,P.segment))}static comparePoints(w,P){return w.x<P.x?-1:w.x>P.x?1:w.y<P.y?-1:w.y>P.y?1:0}constructor(w,P){w.events===void 0?w.events=[this]:w.events.push(this),this.point=w,this.isLeft=P}link(w){if(w.point===this.point)throw new Error("Tried to link already linked events");let P=w.point.events;for(let D=0,k=P.length;D<k;D++){let B=P[D];this.point.events.push(B),B.point=this.point}this.checkForConsuming()}checkForConsuming(){let w=this.point.events.length;for(let P=0;P<w;P++){let D=this.point.events[P];if(D.segment.consumedBy===void 0)for(let k=P+1;k<w;k++){let B=this.point.events[k];B.consumedBy===void 0&&D.otherSE.point.events===B.otherSE.point.events&&D.segment.consume(B.segment)}}}getAvailableLinkedEvents(){let w=[];for(let P=0,D=this.point.events.length;P<D;P++){let k=this.point.events[P];k!==this&&!k.segment.ringOut&&k.segment.isInResult()&&w.push(k)}return w}getLeftmostComparator(w){let P=new Map,D=k=>{let B=k.otherSE;P.set(k,{sine:$t(this.point,w.point,B.point),cosine:Ut(this.point,w.point,B.point)})};return(k,B)=>{P.has(k)||D(k),P.has(B)||D(B);let{sine:et,cosine:j}=P.get(k),{sine:ft,cosine:ct}=P.get(B);return et>=0&&ft>=0?j<ct?1:j>ct?-1:0:et<0&&ft<0?j<ct?-1:j>ct?1:0:ft<et?-1:ft>et?1:0}}}let an=0;class zt{static compare(w,P){let D=w.leftSE.point.x,k=P.leftSE.point.x,B=w.rightSE.point.x,et=P.rightSE.point.x;if(et<D)return 1;if(B<k)return-1;let j=w.leftSE.point.y,ft=P.leftSE.point.y,ct=w.rightSE.point.y,O=P.rightSE.point.y;if(D<k){if(ft<j&&ft<ct)return 1;if(ft>j&&ft>ct)return-1;let K=w.comparePoint(P.leftSE.point);if(K<0)return 1;if(K>0)return-1;let $=P.comparePoint(w.rightSE.point);return $!==0?$:-1}if(D>k){if(j<ft&&j<O)return-1;if(j>ft&&j>O)return 1;let K=P.comparePoint(w.leftSE.point);if(K!==0)return K;let $=w.comparePoint(P.rightSE.point);return $<0?1:$>0?-1:1}if(j<ft)return-1;if(j>ft)return 1;if(B<et){let K=P.comparePoint(w.rightSE.point);if(K!==0)return K}if(B>et){let K=w.comparePoint(P.rightSE.point);if(K<0)return 1;if(K>0)return-1}if(B!==et){let K=ct-j,$=B-D,Q=O-ft,St=et-k;if(K>$&&Q<St)return 1;if(K<$&&Q>St)return-1}return B>et?1:B<et||ct<O?-1:ct>O?1:w.id<P.id?-1:w.id>P.id?1:0}constructor(w,P,D,k){this.id=++an,this.leftSE=w,w.segment=this,w.otherSE=P,this.rightSE=P,P.segment=this,P.otherSE=w,this.rings=D,this.windings=k}static fromRing(w,P,D){let k,B,et,j=rt.comparePoints(w,P);if(j<0)k=w,B=P,et=1;else if(j>0)k=P,B=w,et=-1;else throw new Error(`Tried to create degenerate segment at [${w.x}, ${w.y}]`);let ft=new rt(k,!0),ct=new rt(B,!1);return new zt(ft,ct,[D],[et])}replaceRightSE(w){this.rightSE=w,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}bbox(){let w=this.leftSE.point.y,P=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:w<P?w:P},ur:{x:this.rightSE.point.x,y:w>P?w:P}}}vector(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}isAnEndpoint(w){return w.x===this.leftSE.point.x&&w.y===this.leftSE.point.y||w.x===this.rightSE.point.x&&w.y===this.rightSE.point.y}comparePoint(w){if(this.isAnEndpoint(w))return 0;let P=this.leftSE.point,D=this.rightSE.point,k=this.vector();if(P.x===D.x)return w.x===P.x?0:w.x<P.x?1:-1;let B=(w.y-P.y)/k.y,et=P.x+B*k.x;if(w.x===et)return 0;let j=(w.x-P.x)/k.x,ft=P.y+j*k.y;return w.y===ft?0:w.y<ft?-1:1}getIntersection(w){let P=this.bbox(),D=w.bbox(),k=_(P,D);if(k===null)return null;let B=this.leftSE.point,et=this.rightSE.point,j=w.leftSE.point,ft=w.rightSE.point,ct=T(P,j)&&this.comparePoint(j)===0,O=T(D,B)&&w.comparePoint(B)===0,K=T(P,ft)&&this.comparePoint(ft)===0,$=T(D,et)&&w.comparePoint(et)===0;if(O&&ct)return $&&!K?et:!$&&K?ft:null;if(O)return K&&B.x===ft.x&&B.y===ft.y?null:B;if(ct)return $&&et.x===j.x&&et.y===j.y?null:j;if($&&K)return null;if($)return et;if(K)return ft;let Q=te(B,this.vector(),j,w.vector());return Q===null||!T(k,Q)?null:z.round(Q.x,Q.y)}split(w){let P=[],D=w.events!==void 0,k=new rt(w,!0),B=new rt(w,!1),et=this.rightSE;this.replaceRightSE(B),P.push(B),P.push(k);let j=new zt(k,et,this.rings.slice(),this.windings.slice());return rt.comparePoints(j.leftSE.point,j.rightSE.point)>0&&j.swapEvents(),rt.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),D&&(k.checkForConsuming(),B.checkForConsuming()),P}swapEvents(){let w=this.rightSE;this.rightSE=this.leftSE,this.leftSE=w,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(let P=0,D=this.windings.length;P<D;P++)this.windings[P]*=-1}consume(w){let P=this,D=w;for(;P.consumedBy;)P=P.consumedBy;for(;D.consumedBy;)D=D.consumedBy;let k=zt.compare(P,D);if(k!==0){if(k>0){let B=P;P=D,D=B}if(P.prev===D){let B=P;P=D,D=B}for(let B=0,et=D.rings.length;B<et;B++){let j=D.rings[B],ft=D.windings[B],ct=P.rings.indexOf(j);ct===-1?(P.rings.push(j),P.windings.push(ft)):P.windings[ct]+=ft}D.rings=null,D.windings=null,D.consumedBy=P,D.leftSE.consumedBy=P.leftSE,D.rightSE.consumedBy=P.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 w=this.prev.consumedBy||this.prev;this._beforeState=w.afterState()}return this._beforeState}afterState(){if(this._afterState!==void 0)return this._afterState;let w=this.beforeState();this._afterState={rings:w.rings.slice(0),windings:w.windings.slice(0),multiPolys:[]};let P=this._afterState.rings,D=this._afterState.windings,k=this._afterState.multiPolys;for(let j=0,ft=this.rings.length;j<ft;j++){let ct=this.rings[j],O=this.windings[j],K=P.indexOf(ct);K===-1?(P.push(ct),D.push(O)):D[K]+=O}let B=[],et=[];for(let j=0,ft=P.length;j<ft;j++){if(D[j]===0)continue;let ct=P[j],O=ct.poly;if(et.indexOf(O)===-1)if(ct.isExterior)B.push(O);else{et.indexOf(O)===-1&&et.push(O);let K=B.indexOf(ct.poly);K!==-1&&B.splice(K,1)}}for(let j=0,ft=B.length;j<ft;j++){let ct=B[j].multiPoly;k.indexOf(ct)===-1&&k.push(ct)}return this._afterState}isInResult(){if(this.consumedBy)return!1;if(this._isInResult!==void 0)return this._isInResult;let w=this.beforeState().multiPolys,P=this.afterState().multiPolys;switch(ot.type){case"union":{let D=w.length===0,k=P.length===0;this._isInResult=D!==k;break}case"intersection":{let D,k;w.length<P.length?(D=w.length,k=P.length):(D=P.length,k=w.length),this._isInResult=k===ot.numMultiPolys&&D<k;break}case"xor":{let D=Math.abs(w.length-P.length);this._isInResult=D%2===1;break}case"difference":{let D=k=>k.length===1&&k[0].isSubject;this._isInResult=D(w)!==D(P);break}default:throw new Error(`Unrecognized operation type found ${ot.type}`)}return this._isInResult}}class ne{constructor(w,P,D){if(!Array.isArray(w)||w.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=P,this.isExterior=D,this.segments=[],typeof w[0][0]!="number"||typeof w[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");let k=z.round(w[0][0],w[0][1]);this.bbox={ll:{x:k.x,y:k.y},ur:{x:k.x,y:k.y}};let B=k;for(let et=1,j=w.length;et<j;et++){if(typeof w[et][0]!="number"||typeof w[et][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");let ft=z.round(w[et][0],w[et][1]);ft.x===B.x&&ft.y===B.y||(this.segments.push(zt.fromRing(B,ft,this)),ft.x<this.bbox.ll.x&&(this.bbox.ll.x=ft.x),ft.y<this.bbox.ll.y&&(this.bbox.ll.y=ft.y),ft.x>this.bbox.ur.x&&(this.bbox.ur.x=ft.x),ft.y>this.bbox.ur.y&&(this.bbox.ur.y=ft.y),B=ft)}(k.x!==B.x||k.y!==B.y)&&this.segments.push(zt.fromRing(B,k,this))}getSweepEvents(){let w=[];for(let P=0,D=this.segments.length;P<D;P++){let k=this.segments[P];w.push(k.leftSE),w.push(k.rightSE)}return w}}class Wt{constructor(w,P){if(!Array.isArray(w))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new ne(w[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 D=1,k=w.length;D<k;D++){let B=new ne(w[D],this,!1);B.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=B.bbox.ll.x),B.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=B.bbox.ll.y),B.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=B.bbox.ur.x),B.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=B.bbox.ur.y),this.interiorRings.push(B)}this.multiPoly=P}getSweepEvents(){let w=this.exteriorRing.getSweepEvents();for(let P=0,D=this.interiorRings.length;P<D;P++){let k=this.interiorRings[P].getSweepEvents();for(let B=0,et=k.length;B<et;B++)w.push(k[B])}return w}}class ie{constructor(w,P){if(!Array.isArray(w))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{typeof w[0][0][0]=="number"&&(w=[w])}catch(D){}this.polys=[],this.bbox={ll:{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY},ur:{x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY}};for(let D=0,k=w.length;D<k;D++){let B=new Wt(w[D],this);B.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=B.bbox.ll.x),B.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=B.bbox.ll.y),B.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=B.bbox.ur.x),B.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=B.bbox.ur.y),this.polys.push(B)}this.isSubject=P}getSweepEvents(){let w=[];for(let P=0,D=this.polys.length;P<D;P++){let k=this.polys[P].getSweepEvents();for(let B=0,et=k.length;B<et;B++)w.push(k[B])}return w}}class ce{static factory(w){let P=[];for(let D=0,k=w.length;D<k;D++){let B=w[D];if(!B.isInResult()||B.ringOut)continue;let et=null,j=B.leftSE,ft=B.rightSE,ct=[j],O=j.point,K=[];for(;et=j,j=ft,ct.push(j),j.point!==O;)for(;;){let $=j.getAvailableLinkedEvents();if($.length===0){let Nt=ct[0].point,Jt=ct[ct.length-1].point;throw new Error(`Unable to complete output ring starting at [${Nt.x}, ${Nt.y}]. Last matching segment found ends at [${Jt.x}, ${Jt.y}].`)}if($.length===1){ft=$[0].otherSE;break}let Q=null;for(let Nt=0,Jt=K.length;Nt<Jt;Nt++)if(K[Nt].point===j.point){Q=Nt;break}if(Q!==null){let Nt=K.splice(Q)[0],Jt=ct.splice(Nt.index);Jt.unshift(Jt[0].otherSE),P.push(new ce(Jt.reverse()));continue}K.push({index:ct.length,point:j.point});let St=j.getLeftmostComparator(et);ft=$.sort(St)[0].otherSE;break}P.push(new ce(ct))}return P}constructor(w){this.events=w;for(let P=0,D=w.length;P<D;P++)w[P].segment.ringOut=this;this.poly=null}getGeom(){let w=this.events[0].point,P=[w];for(let ct=1,O=this.events.length-1;ct<O;ct++){let K=this.events[ct].point,$=this.events[ct+1].point;wt(K,w,$)!==0&&(P.push(K),w=K)}if(P.length===1)return null;let D=P[0],k=P[1];wt(D,w,k)===0&&P.shift(),P.push(P[0]);let B=this.isExteriorRing()?1:-1,et=this.isExteriorRing()?0:P.length-1,j=this.isExteriorRing()?P.length:-1,ft=[];for(let ct=et;ct!=j;ct+=B)ft.push([P[ct].x,P[ct].y]);return ft}isExteriorRing(){if(this._isExteriorRing===void 0){let w=this.enclosingRing();this._isExteriorRing=w?!w.isExteriorRing():!0}return this._isExteriorRing}enclosingRing(){return this._enclosingRing===void 0&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}_calcEnclosingRing(){let w=this.events[0];for(let k=1,B=this.events.length;k<B;k++){let et=this.events[k];rt.compare(w,et)>0&&(w=et)}let P=w.segment.prevInResult(),D=P?P.prevInResult():null;for(;;){if(!P)return null;if(!D)return P.ringOut;if(D.ringOut!==P.ringOut)return D.ringOut.enclosingRing()!==P.ringOut?P.ringOut:P.ringOut.enclosingRing();P=D.prevInResult(),D=P?P.prevInResult():null}}}class Lt{constructor(w){this.exteriorRing=w,w.poly=this,this.interiorRings=[]}addInterior(w){this.interiorRings.push(w),w.poly=this}getGeom(){let w=[this.exteriorRing.getGeom()];if(w[0]===null)return null;for(let P=0,D=this.interiorRings.length;P<D;P++){let k=this.interiorRings[P].getGeom();k!==null&&w.push(k)}return w}}class se{constructor(w){this.rings=w,this.polys=this._composePolys(w)}getGeom(){let w=[];for(let P=0,D=this.polys.length;P<D;P++){let k=this.polys[P].getGeom();k!==null&&w.push(k)}return w}_composePolys(w){let P=[];for(let D=0,k=w.length;D<k;D++){let B=w[D];if(!B.poly)if(B.isExteriorRing())P.push(new Lt(B));else{let et=B.enclosingRing();et.poly||P.push(new Lt(et)),et.poly.addInterior(B)}}return P}}class Y{constructor(w){let P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:zt.compare;this.queue=w,this.tree=new p(P),this.segments=[]}process(w){let P=w.segment,D=[];if(w.consumedBy)return w.isLeft?this.queue.remove(w.otherSE):this.tree.remove(P),D;let k=w.isLeft?this.tree.add(P):this.tree.find(P);if(!k)throw new Error(`Unable to find segment #${P.id} [${P.leftSE.point.x}, ${P.leftSE.point.y}] -> [${P.rightSE.point.x}, ${P.rightSE.point.y}] in SweepLine tree.`);let B=k,et=k,j,ft;for(;j===void 0;)B=this.tree.prev(B),B===null?j=null:B.key.consumedBy===void 0&&(j=B.key);for(;ft===void 0;)et=this.tree.next(et),et===null?ft=null:et.key.consumedBy===void 0&&(ft=et.key);if(w.isLeft){let ct=null;if(j){let K=j.getIntersection(P);if(K!==null&&(P.isAnEndpoint(K)||(ct=K),!j.isAnEndpoint(K))){let $=this._splitSafely(j,K);for(let Q=0,St=$.length;Q<St;Q++)D.push($[Q])}}let O=null;if(ft){let K=ft.getIntersection(P);if(K!==null&&(P.isAnEndpoint(K)||(O=K),!ft.isAnEndpoint(K))){let $=this._splitSafely(ft,K);for(let Q=0,St=$.length;Q<St;Q++)D.push($[Q])}}if(ct!==null||O!==null){let K=null;ct===null?K=O:O===null?K=ct:K=rt.comparePoints(ct,O)<=0?ct:O,this.queue.remove(P.rightSE),D.push(P.rightSE);let $=P.split(K);for(let Q=0,St=$.length;Q<St;Q++)D.push($[Q])}D.length>0?(this.tree.remove(P),D.push(w)):(this.segments.push(P),P.prev=j)}else{if(j&&ft){let ct=j.getIntersection(ft);if(ct!==null){if(!j.isAnEndpoint(ct)){let O=this._splitSafely(j,ct);for(let K=0,$=O.length;K<$;K++)D.push(O[K])}if(!ft.isAnEndpoint(ct)){let O=this._splitSafely(ft,ct);for(let K=0,$=O.length;K<$;K++)D.push(O[K])}}}this.tree.remove(P)}return D}_splitSafely(w,P){this.tree.remove(w);let D=w.rightSE;this.queue.remove(D);let k=w.split(P);return k.push(D),w.consumedBy===void 0&&this.tree.add(w),k}}let N=typeof process!="undefined"&&process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,xt=typeof process!="undefined"&&process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6;class Et{run(w,P,D){ot.type=w,z.reset();let k=[new ie(P,!0)];for(let K=0,$=D.length;K<$;K++)k.push(new ie(D[K],!1));if(ot.numMultiPolys=k.length,ot.type==="difference"){let K=k[0],$=1;for(;$<k.length;)_(k[$].bbox,K.bbox)!==null?$++:k.splice($,1)}if(ot.type==="intersection")for(let K=0,$=k.length;K<$;K++){let Q=k[K];for(let St=K+1,Nt=k.length;St<Nt;St++)if(_(Q.bbox,k[St].bbox)===null)return[]}let B=new p(rt.compare);for(let K=0,$=k.length;K<$;K++){let Q=k[K].getSweepEvents();for(let St=0,Nt=Q.length;St<Nt;St++)if(B.insert(Q[St]),B.size>N)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big).")}let et=new Y(B),j=B.size,ft=B.pop();for(;ft;){let K=ft.key;if(B.size===j){let Q=K.segment;throw new Error(`Unable to pop() ${K.isLeft?"left":"right"} SweepEvent [${K.point.x}, ${K.point.y}] from segment #${Q.id} [${Q.leftSE.point.x}, ${Q.leftSE.point.y}] -> [${Q.rightSE.point.x}, ${Q.rightSE.point.y}] from queue.`)}if(B.size>N)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big).");if(et.segments.length>xt)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments).");let $=et.process(K);for(let Q=0,St=$.length;Q<St;Q++){let Nt=$[Q];Nt.consumedBy===void 0&&B.insert(Nt)}j=B.size,ft=B.pop()}z.reset();let ct=ce.factory(et.segments);return new se(ct).getGeom()}}let ot=new Et;var kt={union:function(J){for(var w=arguments.length,P=new Array(w>1?w-1:0),D=1;D<w;D++)P[D-1]=arguments[D];return ot.run("union",J,P)},intersection:function(J){for(var w=arguments.length,P=new Array(w>1?w-1:0),D=1;D<w;D++)P[D-1]=arguments[D];return ot.run("intersection",J,P)},xor:function(J){for(var w=arguments.length,P=new Array(w>1?w-1:0),D=1;D<w;D++)P[D-1]=arguments[D];return ot.run("xor",J,P)},difference:function(J){for(var w=arguments.length,P=new Array(w>1?w-1:0),D=1;D<w;D++)P[D-1]=arguments[D];return ot.run("difference",J,P)}};return kt})});var HT=nt((Vh,VT)=>{(function(r,t){typeof Vh=="object"&&typeof VT!="undefined"?t(Vh):typeof define=="function"&&define.amd?define(["exports"],t):t(r.jsts={})})(Vh,function(r){"use strict";function t(){}function e(n){this.message=n||""}function o(n){this.message=n||""}function a(n){this.message=n||""}function l(){}function h(n){return n===null?we:n.color}function f(n){return n===null?null:n.parent}function p(n,i){n!==null&&(n.color=i)}function d(n){return n===null?null:n.left}function g(n){return n===null?null:n.right}function x(){this.root_=null,this.size_=0}function v(){}function M(){this.array_=[],arguments[0]instanceof j&&this.addAll(arguments[0])}function b(){}function T(n){this.message=n||""}function _(){this.array_=[]}"fill"in Array.prototype||Object.defineProperty(Array.prototype,"fill",{configurable:!0,value:function(n){if(this===void 0||this===null)throw new TypeError(this+" is not an object");var i=Object(this),s=Math.max(Math.min(i.length,9007199254740991),0)||0,u=1 in arguments&&parseInt(Number(arguments[1]),10)||0;u=u<0?Math.max(s+u,0):Math.min(u,s);var c=2 in arguments&&arguments[2]!==void 0?parseInt(Number(arguments[2]),10)||0:s;for(c=c<0?Math.max(s+arguments[2],0):Math.min(c,s);u<c;)i[u]=n,++u;return i},writable:!0}),Number.isFinite=Number.isFinite||function(n){return typeof n=="number"&&isFinite(n)},Number.isInteger=Number.isInteger||function(n){return typeof n=="number"&&isFinite(n)&&Math.floor(n)===n},Number.parseFloat=Number.parseFloat||parseFloat,Number.isNaN=Number.isNaN||function(n){return n!=n},Math.trunc=Math.trunc||function(n){return n<0?Math.ceil(n):Math.floor(n)};var y=function(){};y.prototype.interfaces_=function(){return[]},y.prototype.getClass=function(){return y},y.prototype.equalsWithTolerance=function(n,i,s){return Math.abs(n-i)<=s};var A=function(n){function i(s){n.call(this,s),this.name="IllegalArgumentException",this.message=s,this.stack=new n().stack}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i}(Error),S=function(){},L={MAX_VALUE:{configurable:!0}};S.isNaN=function(n){return Number.isNaN(n)},S.doubleToLongBits=function(n){return n},S.longBitsToDouble=function(n){return n},S.isInfinite=function(n){return!Number.isFinite(n)},L.MAX_VALUE.get=function(){return Number.MAX_VALUE},Object.defineProperties(S,L);var G=function(){},z=function(){},F=function(){},I=function n(){if(this.x=null,this.y=null,this.z=null,arguments.length===0)this.x=0,this.y=0,this.z=n.NULL_ORDINATE;else if(arguments.length===1){var i=arguments[0];this.x=i.x,this.y=i.y,this.z=i.z}else arguments.length===2?(this.x=arguments[0],this.y=arguments[1],this.z=n.NULL_ORDINATE):arguments.length===3&&(this.x=arguments[0],this.y=arguments[1],this.z=arguments[2])},ut={DimensionalComparator:{configurable:!0},serialVersionUID:{configurable:!0},NULL_ORDINATE:{configurable:!0},X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0}};I.prototype.setOrdinate=function(n,i){switch(n){case I.X:this.x=i;break;case I.Y:this.y=i;break;case I.Z:this.z=i;break;default:throw new A("Invalid ordinate index: "+n)}},I.prototype.equals2D=function(){if(arguments.length===1){var n=arguments[0];return this.x===n.x&&this.y===n.y}if(arguments.length===2){var i=arguments[0],s=arguments[1];return!!y.equalsWithTolerance(this.x,i.x,s)&&!!y.equalsWithTolerance(this.y,i.y,s)}},I.prototype.getOrdinate=function(n){switch(n){case I.X:return this.x;case I.Y:return this.y;case I.Z:return this.z}throw new A("Invalid ordinate index: "+n)},I.prototype.equals3D=function(n){return this.x===n.x&&this.y===n.y&&(this.z===n.z||S.isNaN(this.z))&&S.isNaN(n.z)},I.prototype.equals=function(n){return n instanceof I&&this.equals2D(n)},I.prototype.equalInZ=function(n,i){return y.equalsWithTolerance(this.z,n.z,i)},I.prototype.compareTo=function(n){var i=n;return this.x<i.x?-1:this.x>i.x?1:this.y<i.y?-1:this.y>i.y?1:0},I.prototype.clone=function(){},I.prototype.copy=function(){return new I(this)},I.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},I.prototype.distance3D=function(n){var i=this.x-n.x,s=this.y-n.y,u=this.z-n.z;return Math.sqrt(i*i+s*s+u*u)},I.prototype.distance=function(n){var i=this.x-n.x,s=this.y-n.y;return Math.sqrt(i*i+s*s)},I.prototype.hashCode=function(){var n=17;return n=37*n+I.hashCode(this.x),n=37*n+I.hashCode(this.y)},I.prototype.setCoordinate=function(n){this.x=n.x,this.y=n.y,this.z=n.z},I.prototype.interfaces_=function(){return[G,z,t]},I.prototype.getClass=function(){return I},I.hashCode=function(){if(arguments.length===1){var n=arguments[0],i=S.doubleToLongBits(n);return Math.trunc((i^i)>>>32)}},ut.DimensionalComparator.get=function(){return R},ut.serialVersionUID.get=function(){return 6683108902428367e3},ut.NULL_ORDINATE.get=function(){return S.NaN},ut.X.get=function(){return 0},ut.Y.get=function(){return 1},ut.Z.get=function(){return 2},Object.defineProperties(I,ut);var R=function(n){if(this._dimensionsToTest=2,arguments.length!==0){if(arguments.length===1){var i=arguments[0];if(i!==2&&i!==3)throw new A("only 2 or 3 dimensions may be specified");this._dimensionsToTest=i}}};R.prototype.compare=function(n,i){var s=n,u=i,c=R.compare(s.x,u.x);if(c!==0)return c;var m=R.compare(s.y,u.y);return m!==0?m:this._dimensionsToTest<=2?0:R.compare(s.z,u.z)},R.prototype.interfaces_=function(){return[F]},R.prototype.getClass=function(){return R},R.compare=function(n,i){return n<i?-1:n>i?1:S.isNaN(n)?S.isNaN(i)?0:-1:S.isNaN(i)?1:0};var W=function(){};W.prototype.create=function(){},W.prototype.interfaces_=function(){return[]},W.prototype.getClass=function(){return W};var V=function(){},Mt={INTERIOR:{configurable:!0},BOUNDARY:{configurable:!0},EXTERIOR:{configurable:!0},NONE:{configurable:!0}};V.prototype.interfaces_=function(){return[]},V.prototype.getClass=function(){return V},V.toLocationSymbol=function(n){switch(n){case V.EXTERIOR:return"e";case V.BOUNDARY:return"b";case V.INTERIOR:return"i";case V.NONE:return"-"}throw new A("Unknown location value: "+n)},Mt.INTERIOR.get=function(){return 0},Mt.BOUNDARY.get=function(){return 1},Mt.EXTERIOR.get=function(){return 2},Mt.NONE.get=function(){return-1},Object.defineProperties(V,Mt);var X=function(n,i){return n.interfaces_&&n.interfaces_().indexOf(i)>-1},mt=function(){},dt={LOG_10:{configurable:!0}};mt.prototype.interfaces_=function(){return[]},mt.prototype.getClass=function(){return mt},mt.log10=function(n){var i=Math.log(n);return S.isInfinite(i)||S.isNaN(i)?i:i/mt.LOG_10},mt.min=function(n,i,s,u){var c=n;return i<c&&(c=i),s<c&&(c=s),u<c&&(c=u),c},mt.clamp=function(){if(typeof arguments[2]=="number"&&typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var n=arguments[0],i=arguments[1],s=arguments[2];return n<i?i:n>s?s:n}if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var u=arguments[0],c=arguments[1],m=arguments[2];return u<c?c:u>m?m:u}},mt.wrap=function(n,i){return n<0?i- -n%i:n%i},mt.max=function(){if(arguments.length===3){var n=arguments[0],i=arguments[1],s=arguments[2],u=n;return i>u&&(u=i),s>u&&(u=s),u}if(arguments.length===4){var c=arguments[0],m=arguments[1],E=arguments[2],C=arguments[3],U=c;return m>U&&(U=m),E>U&&(U=E),C>U&&(U=C),U}},mt.average=function(n,i){return(n+i)/2},dt.LOG_10.get=function(){return Math.log(10)},Object.defineProperties(mt,dt);var _t=function(n){this.str=n};_t.prototype.append=function(n){this.str+=n},_t.prototype.setCharAt=function(n,i){this.str=this.str.substr(0,n)+i+this.str.substr(n+1)},_t.prototype.toString=function(n){return this.str};var it=function(n){this.value=n};it.prototype.intValue=function(){return this.value},it.prototype.compareTo=function(n){return this.value<n?-1:this.value>n?1:0},it.isNaN=function(n){return Number.isNaN(n)};var lt=function(){};lt.isWhitespace=function(n){return n<=32&&n>=0||n===127},lt.toUpperCase=function(n){return n.toUpperCase()};var H=function n(){if(this._hi=0,this._lo=0,arguments.length===0)this.init(0);else if(arguments.length===1){if(typeof arguments[0]=="number"){var i=arguments[0];this.init(i)}else if(arguments[0]instanceof n){var s=arguments[0];this.init(s)}else if(typeof arguments[0]=="string"){var u=arguments[0];n.call(this,n.parse(u))}}else if(arguments.length===2){var c=arguments[0],m=arguments[1];this.init(c,m)}},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}};H.prototype.le=function(n){return(this._hi<n._hi||this._hi===n._hi)&&this._lo<=n._lo},H.prototype.extractSignificantDigits=function(n,i){var s=this.abs(),u=H.magnitude(s._hi),c=H.TEN.pow(u);(s=s.divide(c)).gt(H.TEN)?(s=s.divide(H.TEN),u+=1):s.lt(H.ONE)&&(s=s.multiply(H.TEN),u-=1);for(var m=u+1,E=new _t,C=H.MAX_PRINT_DIGITS-1,U=0;U<=C;U++){n&&U===m&&E.append(".");var Z=Math.trunc(s._hi);if(Z<0)break;var pt=!1,gt=0;Z>9?(pt=!0,gt="9"):gt="0"+Z,E.append(gt),s=s.subtract(H.valueOf(Z)).multiply(H.TEN),pt&&s.selfAdd(H.TEN);var Rt=!0,Ft=H.magnitude(s._hi);if(Ft<0&&Math.abs(Ft)>=C-U&&(Rt=!1),!Rt)break}return i[0]=u,E.toString()},H.prototype.sqr=function(){return this.multiply(this)},H.prototype.doubleValue=function(){return this._hi+this._lo},H.prototype.subtract=function(){if(arguments[0]instanceof H){var n=arguments[0];return this.add(n.negate())}if(typeof arguments[0]=="number"){var i=arguments[0];return this.add(-i)}},H.prototype.equals=function(){if(arguments.length===1){var n=arguments[0];return this._hi===n._hi&&this._lo===n._lo}},H.prototype.isZero=function(){return this._hi===0&&this._lo===0},H.prototype.selfSubtract=function(){if(arguments[0]instanceof H){var n=arguments[0];return this.isNaN()?this:this.selfAdd(-n._hi,-n._lo)}if(typeof arguments[0]=="number"){var i=arguments[0];return this.isNaN()?this:this.selfAdd(-i,0)}},H.prototype.getSpecialNumberString=function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null},H.prototype.min=function(n){return this.le(n)?this:n},H.prototype.selfDivide=function(){if(arguments.length===1){if(arguments[0]instanceof H){var n=arguments[0];return this.selfDivide(n._hi,n._lo)}if(typeof arguments[0]=="number"){var i=arguments[0];return this.selfDivide(i,0)}}else if(arguments.length===2){var s=arguments[0],u=arguments[1],c=null,m=null,E=null,C=null,U=null,Z=null,pt=null,gt=null;return U=this._hi/s,Z=H.SPLIT*U,c=Z-U,gt=H.SPLIT*s,c=Z-c,m=U-c,E=gt-s,pt=U*s,E=gt-E,C=s-E,gt=c*E-pt+c*C+m*E+m*C,Z=(this._hi-pt-gt+this._lo-U*u)/s,gt=U+Z,this._hi=gt,this._lo=U-gt+Z,this}},H.prototype.dump=function(){return"DD<"+this._hi+", "+this._lo+">"},H.prototype.divide=function(){if(arguments[0]instanceof H){var n=arguments[0],i=null,s=null,u=null,c=null,m=null,E=null,C=null,U=null;return s=(m=this._hi/n._hi)-(i=(E=H.SPLIT*m)-(i=E-m)),U=i*(u=(U=H.SPLIT*n._hi)-(u=U-n._hi))-(C=m*n._hi)+i*(c=n._hi-u)+s*u+s*c,E=(this._hi-C-U+this._lo-m*n._lo)/n._hi,new H(U=m+E,m-U+E)}if(typeof arguments[0]=="number"){var Z=arguments[0];return S.isNaN(Z)?H.createNaN():H.copy(this).selfDivide(Z,0)}},H.prototype.ge=function(n){return(this._hi>n._hi||this._hi===n._hi)&&this._lo>=n._lo},H.prototype.pow=function(n){if(n===0)return H.valueOf(1);var i=new H(this),s=H.valueOf(1),u=Math.abs(n);if(u>1)for(;u>0;)u%2==1&&s.selfMultiply(i),(u/=2)>0&&(i=i.sqr());else s=i;return n<0?s.reciprocal():s},H.prototype.ceil=function(){if(this.isNaN())return H.NaN;var n=Math.ceil(this._hi),i=0;return n===this._hi&&(i=Math.ceil(this._lo)),new H(n,i)},H.prototype.compareTo=function(n){var i=n;return this._hi<i._hi?-1:this._hi>i._hi?1:this._lo<i._lo?-1:this._lo>i._lo?1:0},H.prototype.rint=function(){return this.isNaN()?this:this.add(.5).floor()},H.prototype.setValue=function(){if(arguments[0]instanceof H){var n=arguments[0];return this.init(n),this}if(typeof arguments[0]=="number"){var i=arguments[0];return this.init(i),this}},H.prototype.max=function(n){return this.ge(n)?this:n},H.prototype.sqrt=function(){if(this.isZero())return H.valueOf(0);if(this.isNegative())return H.NaN;var n=1/Math.sqrt(this._hi),i=this._hi*n,s=H.valueOf(i),u=this.subtract(s.sqr())._hi*(.5*n);return s.add(u)},H.prototype.selfAdd=function(){if(arguments.length===1){if(arguments[0]instanceof H){var n=arguments[0];return this.selfAdd(n._hi,n._lo)}if(typeof arguments[0]=="number"){var i=arguments[0],s=null,u=null,c=null,m=null,E=null,C=null;return c=this._hi+i,E=c-this._hi,m=c-E,m=i-E+(this._hi-m),C=m+this._lo,s=c+C,u=C+(c-s),this._hi=s+u,this._lo=u+(s-this._hi),this}}else if(arguments.length===2){var U=arguments[0],Z=arguments[1],pt=null,gt=null,Rt=null,Ft=null,Vt=null,ee=null,hn=null;Ft=this._hi+U,gt=this._lo+Z,Vt=Ft-(ee=Ft-this._hi),Rt=gt-(hn=gt-this._lo);var qn=(pt=Ft+(ee=(Vt=U-ee+(this._hi-Vt))+gt))+(ee=(Rt=Z-hn+(this._lo-Rt))+(ee+(Ft-pt))),Tr=ee+(pt-qn);return this._hi=qn,this._lo=Tr,this}},H.prototype.selfMultiply=function(){if(arguments.length===1){if(arguments[0]instanceof H){var n=arguments[0];return this.selfMultiply(n._hi,n._lo)}if(typeof arguments[0]=="number"){var i=arguments[0];return this.selfMultiply(i,0)}}else if(arguments.length===2){var s=arguments[0],u=arguments[1],c=null,m=null,E=null,C=null,U=null,Z=null;c=(U=H.SPLIT*this._hi)-this._hi,Z=H.SPLIT*s,c=U-c,m=this._hi-c,E=Z-s;var pt=(U=this._hi*s)+(Z=c*(E=Z-E)-U+c*(C=s-E)+m*E+m*C+(this._hi*u+this._lo*s)),gt=Z+(c=U-pt);return this._hi=pt,this._lo=gt,this}},H.prototype.selfSqr=function(){return this.selfMultiply(this)},H.prototype.floor=function(){if(this.isNaN())return H.NaN;var n=Math.floor(this._hi),i=0;return n===this._hi&&(i=Math.floor(this._lo)),new H(n,i)},H.prototype.negate=function(){return this.isNaN()?this:new H(-this._hi,-this._lo)},H.prototype.clone=function(){},H.prototype.multiply=function(){if(arguments[0]instanceof H){var n=arguments[0];return n.isNaN()?H.createNaN():H.copy(this).selfMultiply(n)}if(typeof arguments[0]=="number"){var i=arguments[0];return S.isNaN(i)?H.createNaN():H.copy(this).selfMultiply(i,0)}},H.prototype.isNaN=function(){return S.isNaN(this._hi)},H.prototype.intValue=function(){return Math.trunc(this._hi)},H.prototype.toString=function(){var n=H.magnitude(this._hi);return n>=-3&&n<=20?this.toStandardNotation():this.toSciNotation()},H.prototype.toStandardNotation=function(){var n=this.getSpecialNumberString();if(n!==null)return n;var i=new Array(1).fill(null),s=this.extractSignificantDigits(!0,i),u=i[0]+1,c=s;if(s.charAt(0)===".")c="0"+s;else if(u<0)c="0."+H.stringOfChar("0",-u)+s;else if(s.indexOf(".")===-1){var m=u-s.length;c=s+H.stringOfChar("0",m)+".0"}return this.isNegative()?"-"+c:c},H.prototype.reciprocal=function(){var n=null,i=null,s=null,u=null,c=null,m=null,E=null,C=null;i=(c=1/this._hi)-(n=(m=H.SPLIT*c)-(n=m-c)),s=(C=H.SPLIT*this._hi)-this._hi;var U=c+(m=(1-(E=c*this._hi)-(C=n*(s=C-s)-E+n*(u=this._hi-s)+i*s+i*u)-c*this._lo)/this._hi);return new H(U,c-U+m)},H.prototype.toSciNotation=function(){if(this.isZero())return H.SCI_NOT_ZERO;var n=this.getSpecialNumberString();if(n!==null)return n;var i=new Array(1).fill(null),s=this.extractSignificantDigits(!1,i),u=H.SCI_NOT_EXPONENT_CHAR+i[0];if(s.charAt(0)==="0")throw new Error("Found leading zero: "+s);var c="";s.length>1&&(c=s.substring(1));var m=s.charAt(0)+"."+c;return this.isNegative()?"-"+m+u:m+u},H.prototype.abs=function(){return this.isNaN()?H.NaN:this.isNegative()?this.negate():new H(this)},H.prototype.isPositive=function(){return(this._hi>0||this._hi===0)&&this._lo>0},H.prototype.lt=function(n){return(this._hi<n._hi||this._hi===n._hi)&&this._lo<n._lo},H.prototype.add=function(){if(arguments[0]instanceof H){var n=arguments[0];return H.copy(this).selfAdd(n)}if(typeof arguments[0]=="number"){var i=arguments[0];return H.copy(this).selfAdd(i)}},H.prototype.init=function(){if(arguments.length===1){if(typeof arguments[0]=="number"){var n=arguments[0];this._hi=n,this._lo=0}else if(arguments[0]instanceof H){var i=arguments[0];this._hi=i._hi,this._lo=i._lo}}else if(arguments.length===2){var s=arguments[0],u=arguments[1];this._hi=s,this._lo=u}},H.prototype.gt=function(n){return(this._hi>n._hi||this._hi===n._hi)&&this._lo>n._lo},H.prototype.isNegative=function(){return(this._hi<0||this._hi===0)&&this._lo<0},H.prototype.trunc=function(){return this.isNaN()?H.NaN:this.isPositive()?this.floor():this.ceil()},H.prototype.signum=function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0},H.prototype.interfaces_=function(){return[t,G,z]},H.prototype.getClass=function(){return H},H.sqr=function(n){return H.valueOf(n).selfMultiply(n)},H.valueOf=function(){if(typeof arguments[0]=="string"){var n=arguments[0];return H.parse(n)}if(typeof arguments[0]=="number"){var i=arguments[0];return new H(i)}},H.sqrt=function(n){return H.valueOf(n).sqrt()},H.parse=function(n){for(var i=0,s=n.length;lt.isWhitespace(n.charAt(i));)i++;var u=!1;if(i<s){var c=n.charAt(i);c!=="-"&&c!=="+"||(i++,c==="-"&&(u=!0))}for(var m=new H,E=0,C=0,U=0;!(i>=s);){var Z=n.charAt(i);if(i++,lt.isDigit(Z)){var pt=Z-"0";m.selfMultiply(H.TEN),m.selfAdd(pt),E++}else{if(Z!=="."){if(Z==="e"||Z==="E"){var gt=n.substring(i);try{U=it.parseInt(gt)}catch(hn){throw hn instanceof Error?new Error("Invalid exponent "+gt+" in string "+n):hn}break}throw new Error("Unexpected character '"+Z+"' at position "+i+" in string "+n)}C=E}}var Rt=m,Ft=E-C-U;if(Ft===0)Rt=m;else if(Ft>0){var Vt=H.TEN.pow(Ft);Rt=m.divide(Vt)}else if(Ft<0){var ee=H.TEN.pow(-Ft);Rt=m.multiply(ee)}return u?Rt.negate():Rt},H.createNaN=function(){return new H(S.NaN,S.NaN)},H.copy=function(n){return new H(n)},H.magnitude=function(n){var i=Math.abs(n),s=Math.log(i)/Math.log(10),u=Math.trunc(Math.floor(s));return 10*Math.pow(10,u)<=i&&(u+=1),u},H.stringOfChar=function(n,i){for(var s=new _t,u=0;u<i;u++)s.append(n);return s.toString()},bt.PI.get=function(){return new H(3.141592653589793,12246467991473532e-32)},bt.TWO_PI.get=function(){return new H(6.283185307179586,24492935982947064e-32)},bt.PI_2.get=function(){return new H(1.5707963267948966,6123233995736766e-32)},bt.E.get=function(){return new H(2.718281828459045,14456468917292502e-32)},bt.NaN.get=function(){return new H(S.NaN,S.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 H.valueOf(10)},bt.ONE.get=function(){return H.valueOf(1)},bt.SCI_NOT_EXPONENT_CHAR.get=function(){return"E"},bt.SCI_NOT_ZERO.get=function(){return"0.0E0"},Object.defineProperties(H,bt);var Tt=function(){},Yt={DP_SAFE_EPSILON:{configurable:!0}};Tt.prototype.interfaces_=function(){return[]},Tt.prototype.getClass=function(){return Tt},Tt.orientationIndex=function(n,i,s){var u=Tt.orientationIndexFilter(n,i,s);if(u<=1)return u;var c=H.valueOf(i.x).selfAdd(-n.x),m=H.valueOf(i.y).selfAdd(-n.y),E=H.valueOf(s.x).selfAdd(-i.x),C=H.valueOf(s.y).selfAdd(-i.y);return c.selfMultiply(C).selfSubtract(m.selfMultiply(E)).signum()},Tt.signOfDet2x2=function(n,i,s,u){return n.multiply(u).selfSubtract(i.multiply(s)).signum()},Tt.intersection=function(n,i,s,u){var c=H.valueOf(u.y).selfSubtract(s.y).selfMultiply(H.valueOf(i.x).selfSubtract(n.x)),m=H.valueOf(u.x).selfSubtract(s.x).selfMultiply(H.valueOf(i.y).selfSubtract(n.y)),E=c.subtract(m),C=H.valueOf(u.x).selfSubtract(s.x).selfMultiply(H.valueOf(n.y).selfSubtract(s.y)),U=H.valueOf(u.y).selfSubtract(s.y).selfMultiply(H.valueOf(n.x).selfSubtract(s.x)),Z=C.subtract(U).selfDivide(E).doubleValue(),pt=H.valueOf(n.x).selfAdd(H.valueOf(i.x).selfSubtract(n.x).selfMultiply(Z)).doubleValue(),gt=H.valueOf(i.x).selfSubtract(n.x).selfMultiply(H.valueOf(n.y).selfSubtract(s.y)),Rt=H.valueOf(i.y).selfSubtract(n.y).selfMultiply(H.valueOf(n.x).selfSubtract(s.x)),Ft=gt.subtract(Rt).selfDivide(E).doubleValue(),Vt=H.valueOf(s.y).selfAdd(H.valueOf(u.y).selfSubtract(s.y).selfMultiply(Ft)).doubleValue();return new I(pt,Vt)},Tt.orientationIndexFilter=function(n,i,s){var u=null,c=(n.x-s.x)*(i.y-s.y),m=(n.y-s.y)*(i.x-s.x),E=c-m;if(c>0){if(m<=0)return Tt.signum(E);u=c+m}else{if(!(c<0)||m>=0)return Tt.signum(E);u=-c-m}var C=Tt.DP_SAFE_EPSILON*u;return E>=C||-E>=C?Tt.signum(E):2},Tt.signum=function(n){return n>0?1:n<0?-1:0},Yt.DP_SAFE_EPSILON.get=function(){return 1e-15},Object.defineProperties(Tt,Yt);var tt=function(){},wt={X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0},M:{configurable:!0}};wt.X.get=function(){return 0},wt.Y.get=function(){return 1},wt.Z.get=function(){return 2},wt.M.get=function(){return 3},tt.prototype.setOrdinate=function(n,i,s){},tt.prototype.size=function(){},tt.prototype.getOrdinate=function(n,i){},tt.prototype.getCoordinate=function(){},tt.prototype.getCoordinateCopy=function(n){},tt.prototype.getDimension=function(){},tt.prototype.getX=function(n){},tt.prototype.clone=function(){},tt.prototype.expandEnvelope=function(n){},tt.prototype.copy=function(){},tt.prototype.getY=function(n){},tt.prototype.toCoordinateArray=function(){},tt.prototype.interfaces_=function(){return[z]},tt.prototype.getClass=function(){return tt},Object.defineProperties(tt,wt);var Bt=function(){},$t=function(n){function i(){n.call(this,"Projective point not representable on the Cartesian plane.")}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(Bt),Ut=function(){};Ut.arraycopy=function(n,i,s,u,c){for(var m=0,E=i;E<i+c;E++)s[u+m]=n[E],m++},Ut.getProperty=function(n){return{"line.separator":`
|
|
5
|
+
`}[n]};var Dt=function n(){if(this.x=null,this.y=null,this.w=null,arguments.length===0)this.x=0,this.y=0,this.w=1;else if(arguments.length===1){var i=arguments[0];this.x=i.x,this.y=i.y,this.w=1}else if(arguments.length===2){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var s=arguments[0],u=arguments[1];this.x=s,this.y=u,this.w=1}else if(arguments[0]instanceof n&&arguments[1]instanceof n){var c=arguments[0],m=arguments[1];this.x=c.y*m.w-m.y*c.w,this.y=m.x*c.w-c.x*m.w,this.w=c.x*m.y-m.x*c.y}else if(arguments[0]instanceof I&&arguments[1]instanceof I){var E=arguments[0],C=arguments[1];this.x=E.y-C.y,this.y=C.x-E.x,this.w=E.x*C.y-C.x*E.y}}else if(arguments.length===3){var U=arguments[0],Z=arguments[1],pt=arguments[2];this.x=U,this.y=Z,this.w=pt}else if(arguments.length===4){var gt=arguments[0],Rt=arguments[1],Ft=arguments[2],Vt=arguments[3],ee=gt.y-Rt.y,hn=Rt.x-gt.x,qn=gt.x*Rt.y-Rt.x*gt.y,Tr=Ft.y-Vt.y,no=Vt.x-Ft.x,$o=Ft.x*Vt.y-Vt.x*Ft.y;this.x=hn*$o-no*qn,this.y=Tr*qn-ee*$o,this.w=ee*no-Tr*hn}};Dt.prototype.getY=function(){var n=this.y/this.w;if(S.isNaN(n)||S.isInfinite(n))throw new $t;return n},Dt.prototype.getX=function(){var n=this.x/this.w;if(S.isNaN(n)||S.isInfinite(n))throw new $t;return n},Dt.prototype.getCoordinate=function(){var n=new I;return n.x=this.getX(),n.y=this.getY(),n},Dt.prototype.interfaces_=function(){return[]},Dt.prototype.getClass=function(){return Dt},Dt.intersection=function(n,i,s,u){var c=n.y-i.y,m=i.x-n.x,E=n.x*i.y-i.x*n.y,C=s.y-u.y,U=u.x-s.x,Z=s.x*u.y-u.x*s.y,pt=c*U-C*m,gt=(m*Z-U*E)/pt,Rt=(C*E-c*Z)/pt;if(S.isNaN(gt)||S.isInfinite(gt)||S.isNaN(Rt)||S.isInfinite(Rt))throw new $t;return new I(gt,Rt)};var At=function n(){if(this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,arguments.length===0)this.init();else if(arguments.length===1){if(arguments[0]instanceof I){var i=arguments[0];this.init(i.x,i.x,i.y,i.y)}else if(arguments[0]instanceof n){var s=arguments[0];this.init(s)}}else if(arguments.length===2){var u=arguments[0],c=arguments[1];this.init(u.x,c.x,u.y,c.y)}else if(arguments.length===4){var m=arguments[0],E=arguments[1],C=arguments[2],U=arguments[3];this.init(m,E,C,U)}},te={serialVersionUID:{configurable:!0}};At.prototype.getArea=function(){return this.getWidth()*this.getHeight()},At.prototype.equals=function(n){if(!(n instanceof At))return!1;var i=n;return this.isNull()?i.isNull():this._maxx===i.getMaxX()&&this._maxy===i.getMaxY()&&this._minx===i.getMinX()&&this._miny===i.getMinY()},At.prototype.intersection=function(n){if(this.isNull()||n.isNull()||!this.intersects(n))return new At;var i=this._minx>n._minx?this._minx:n._minx,s=this._miny>n._miny?this._miny:n._miny,u=this._maxx<n._maxx?this._maxx:n._maxx,c=this._maxy<n._maxy?this._maxy:n._maxy;return new At(i,u,s,c)},At.prototype.isNull=function(){return this._maxx<this._minx},At.prototype.getMaxX=function(){return this._maxx},At.prototype.covers=function(){if(arguments.length===1){if(arguments[0]instanceof I){var n=arguments[0];return this.covers(n.x,n.y)}if(arguments[0]instanceof At){var i=arguments[0];return!this.isNull()&&!i.isNull()&&i.getMinX()>=this._minx&&i.getMaxX()<=this._maxx&&i.getMinY()>=this._miny&&i.getMaxY()<=this._maxy}}else if(arguments.length===2){var s=arguments[0],u=arguments[1];return!this.isNull()&&s>=this._minx&&s<=this._maxx&&u>=this._miny&&u<=this._maxy}},At.prototype.intersects=function(){if(arguments.length===1){if(arguments[0]instanceof At){var n=arguments[0];return!this.isNull()&&!n.isNull()&&!(n._minx>this._maxx||n._maxx<this._minx||n._miny>this._maxy||n._maxy<this._miny)}if(arguments[0]instanceof I){var i=arguments[0];return this.intersects(i.x,i.y)}}else if(arguments.length===2){var s=arguments[0],u=arguments[1];return!this.isNull()&&!(s>this._maxx||s<this._minx||u>this._maxy||u<this._miny)}},At.prototype.getMinY=function(){return this._miny},At.prototype.getMinX=function(){return this._minx},At.prototype.expandToInclude=function(){if(arguments.length===1){if(arguments[0]instanceof I){var n=arguments[0];this.expandToInclude(n.x,n.y)}else if(arguments[0]instanceof At){var i=arguments[0];if(i.isNull())return null;this.isNull()?(this._minx=i.getMinX(),this._maxx=i.getMaxX(),this._miny=i.getMinY(),this._maxy=i.getMaxY()):(i._minx<this._minx&&(this._minx=i._minx),i._maxx>this._maxx&&(this._maxx=i._maxx),i._miny<this._miny&&(this._miny=i._miny),i._maxy>this._maxy&&(this._maxy=i._maxy))}}else if(arguments.length===2){var s=arguments[0],u=arguments[1];this.isNull()?(this._minx=s,this._maxx=s,this._miny=u,this._maxy=u):(s<this._minx&&(this._minx=s),s>this._maxx&&(this._maxx=s),u<this._miny&&(this._miny=u),u>this._maxy&&(this._maxy=u))}},At.prototype.minExtent=function(){if(this.isNull())return 0;var n=this.getWidth(),i=this.getHeight();return n<i?n:i},At.prototype.getWidth=function(){return this.isNull()?0:this._maxx-this._minx},At.prototype.compareTo=function(n){var i=n;return this.isNull()?i.isNull()?0:-1:i.isNull()?1:this._minx<i._minx?-1:this._minx>i._minx?1:this._miny<i._miny?-1:this._miny>i._miny?1:this._maxx<i._maxx?-1:this._maxx>i._maxx?1:this._maxy<i._maxy?-1:this._maxy>i._maxy?1:0},At.prototype.translate=function(n,i){if(this.isNull())return null;this.init(this.getMinX()+n,this.getMaxX()+n,this.getMinY()+i,this.getMaxY()+i)},At.prototype.toString=function(){return"Env["+this._minx+" : "+this._maxx+", "+this._miny+" : "+this._maxy+"]"},At.prototype.setToNull=function(){this._minx=0,this._maxx=-1,this._miny=0,this._maxy=-1},At.prototype.getHeight=function(){return this.isNull()?0:this._maxy-this._miny},At.prototype.maxExtent=function(){if(this.isNull())return 0;var n=this.getWidth(),i=this.getHeight();return n>i?n:i},At.prototype.expandBy=function(){if(arguments.length===1){var n=arguments[0];this.expandBy(n,n)}else if(arguments.length===2){var i=arguments[0],s=arguments[1];if(this.isNull())return null;this._minx-=i,this._maxx+=i,this._miny-=s,this._maxy+=s,(this._minx>this._maxx||this._miny>this._maxy)&&this.setToNull()}},At.prototype.contains=function(){if(arguments.length===1){if(arguments[0]instanceof At){var n=arguments[0];return this.covers(n)}if(arguments[0]instanceof I){var i=arguments[0];return this.covers(i)}}else if(arguments.length===2){var s=arguments[0],u=arguments[1];return this.covers(s,u)}},At.prototype.centre=function(){return this.isNull()?null:new I((this.getMinX()+this.getMaxX())/2,(this.getMinY()+this.getMaxY())/2)},At.prototype.init=function(){if(arguments.length===0)this.setToNull();else if(arguments.length===1){if(arguments[0]instanceof I){var n=arguments[0];this.init(n.x,n.x,n.y,n.y)}else if(arguments[0]instanceof At){var i=arguments[0];this._minx=i._minx,this._maxx=i._maxx,this._miny=i._miny,this._maxy=i._maxy}}else if(arguments.length===2){var s=arguments[0],u=arguments[1];this.init(s.x,u.x,s.y,u.y)}else if(arguments.length===4){var c=arguments[0],m=arguments[1],E=arguments[2],C=arguments[3];c<m?(this._minx=c,this._maxx=m):(this._minx=m,this._maxx=c),E<C?(this._miny=E,this._maxy=C):(this._miny=C,this._maxy=E)}},At.prototype.getMaxY=function(){return this._maxy},At.prototype.distance=function(n){if(this.intersects(n))return 0;var i=0;this._maxx<n._minx?i=n._minx-this._maxx:this._minx>n._maxx&&(i=this._minx-n._maxx);var s=0;return this._maxy<n._miny?s=n._miny-this._maxy:this._miny>n._maxy&&(s=this._miny-n._maxy),i===0?s:s===0?i:Math.sqrt(i*i+s*s)},At.prototype.hashCode=function(){var n=17;return n=37*n+I.hashCode(this._minx),n=37*n+I.hashCode(this._maxx),n=37*n+I.hashCode(this._miny),n=37*n+I.hashCode(this._maxy)},At.prototype.interfaces_=function(){return[G,t]},At.prototype.getClass=function(){return At},At.intersects=function(){if(arguments.length===3){var n=arguments[0],i=arguments[1],s=arguments[2];return s.x>=(n.x<i.x?n.x:i.x)&&s.x<=(n.x>i.x?n.x:i.x)&&s.y>=(n.y<i.y?n.y:i.y)&&s.y<=(n.y>i.y?n.y:i.y)}if(arguments.length===4){var u=arguments[0],c=arguments[1],m=arguments[2],E=arguments[3],C=Math.min(m.x,E.x),U=Math.max(m.x,E.x),Z=Math.min(u.x,c.x),pt=Math.max(u.x,c.x);return!(Z>U)&&!(pt<C)&&(C=Math.min(m.y,E.y),U=Math.max(m.y,E.y),Z=Math.min(u.y,c.y),pt=Math.max(u.y,c.y),!(Z>U)&&!(pt<C))}},te.serialVersionUID.get=function(){return 5873921885273102e3},Object.defineProperties(At,te);var rt={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*$/},an=function(n){this.geometryFactory=n||new pe};an.prototype.read=function(n){var i,s,u;n=n.replace(/[\n\r]/g," ");var c=rt.typeStr.exec(n);if(n.search("EMPTY")!==-1&&((c=rt.emptyTypeStr.exec(n))[2]=void 0),c&&(s=c[1].toLowerCase(),u=c[2],ne[s]&&(i=ne[s].apply(this,[u]))),i===void 0)throw new Error("Could not parse WKT "+n);return i},an.prototype.write=function(n){return this.extractGeometry(n)},an.prototype.extractGeometry=function(n){var i=n.getGeometryType().toLowerCase();if(!zt[i])return null;var s=i.toUpperCase();return n.isEmpty()?s+" EMPTY":s+"("+zt[i].apply(this,[n])+")"};var zt={coordinate:function(n){return n.x+" "+n.y},point:function(n){return zt.coordinate.call(this,n._coordinates._coordinates[0])},multipoint:function(n){for(var i=[],s=0,u=n._geometries.length;s<u;++s)i.push("("+zt.point.apply(this,[n._geometries[s]])+")");return i.join(",")},linestring:function(n){for(var i=[],s=0,u=n._points._coordinates.length;s<u;++s)i.push(zt.coordinate.apply(this,[n._points._coordinates[s]]));return i.join(",")},linearring:function(n){for(var i=[],s=0,u=n._points._coordinates.length;s<u;++s)i.push(zt.coordinate.apply(this,[n._points._coordinates[s]]));return i.join(",")},multilinestring:function(n){for(var i=[],s=0,u=n._geometries.length;s<u;++s)i.push("("+zt.linestring.apply(this,[n._geometries[s]])+")");return i.join(",")},polygon:function(n){var i=[];i.push("("+zt.linestring.apply(this,[n._shell])+")");for(var s=0,u=n._holes.length;s<u;++s)i.push("("+zt.linestring.apply(this,[n._holes[s]])+")");return i.join(",")},multipolygon:function(n){for(var i=[],s=0,u=n._geometries.length;s<u;++s)i.push("("+zt.polygon.apply(this,[n._geometries[s]])+")");return i.join(",")},geometrycollection:function(n){for(var i=[],s=0,u=n._geometries.length;s<u;++s)i.push(this.extractGeometry(n._geometries[s]));return i.join(",")}},ne={point:function(n){if(n===void 0)return this.geometryFactory.createPoint();var i=n.trim().split(rt.spaces);return this.geometryFactory.createPoint(new I(Number.parseFloat(i[0]),Number.parseFloat(i[1])))},multipoint:function(n){if(n===void 0)return this.geometryFactory.createMultiPoint();for(var i,s=n.trim().split(","),u=[],c=0,m=s.length;c<m;++c)i=s[c].replace(rt.trimParens,"$1"),u.push(ne.point.apply(this,[i]));return this.geometryFactory.createMultiPoint(u)},linestring:function(n){if(n===void 0)return this.geometryFactory.createLineString();for(var i,s=n.trim().split(","),u=[],c=0,m=s.length;c<m;++c)i=s[c].trim().split(rt.spaces),u.push(new I(Number.parseFloat(i[0]),Number.parseFloat(i[1])));return this.geometryFactory.createLineString(u)},linearring:function(n){if(n===void 0)return this.geometryFactory.createLinearRing();for(var i,s=n.trim().split(","),u=[],c=0,m=s.length;c<m;++c)i=s[c].trim().split(rt.spaces),u.push(new I(Number.parseFloat(i[0]),Number.parseFloat(i[1])));return this.geometryFactory.createLinearRing(u)},multilinestring:function(n){if(n===void 0)return this.geometryFactory.createMultiLineString();for(var i,s=n.trim().split(rt.parenComma),u=[],c=0,m=s.length;c<m;++c)i=s[c].replace(rt.trimParens,"$1"),u.push(ne.linestring.apply(this,[i]));return this.geometryFactory.createMultiLineString(u)},polygon:function(n){if(n===void 0)return this.geometryFactory.createPolygon();for(var i,s,u,c,m=n.trim().split(rt.parenComma),E=[],C=0,U=m.length;C<U;++C)i=m[C].replace(rt.trimParens,"$1"),s=ne.linestring.apply(this,[i]),u=this.geometryFactory.createLinearRing(s._points),C===0?c=u:E.push(u);return this.geometryFactory.createPolygon(c,E)},multipolygon:function(n){if(n===void 0)return this.geometryFactory.createMultiPolygon();for(var i,s=n.trim().split(rt.doubleParenComma),u=[],c=0,m=s.length;c<m;++c)i=s[c].replace(rt.trimParens,"$1"),u.push(ne.polygon.apply(this,[i]));return this.geometryFactory.createMultiPolygon(u)},geometrycollection:function(n){if(n===void 0)return this.geometryFactory.createGeometryCollection();for(var i=(n=n.replace(/,\s*([A-Za-z])/g,"|$1")).trim().split("|"),s=[],u=0,c=i.length;u<c;++u)s.push(this.read(i[u]));return this.geometryFactory.createGeometryCollection(s)}},Wt=function(n){this.parser=new an(n)};Wt.prototype.write=function(n){return this.parser.write(n)},Wt.toLineString=function(n,i){if(arguments.length!==2)throw new Error("Not implemented");return"LINESTRING ( "+n.x+" "+n.y+", "+i.x+" "+i.y+" )"};var ie=function(n){function i(s){n.call(this,s),this.name="RuntimeException",this.message=s,this.stack=new n().stack}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i}(Error),ce=function(n){function i(){if(n.call(this),arguments.length===0)n.call(this);else if(arguments.length===1){var s=arguments[0];n.call(this,s)}}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(ie),Lt=function(){};Lt.prototype.interfaces_=function(){return[]},Lt.prototype.getClass=function(){return Lt},Lt.shouldNeverReachHere=function(){if(arguments.length===0)Lt.shouldNeverReachHere(null);else if(arguments.length===1){var n=arguments[0];throw new ce("Should never reach here"+(n!==null?": "+n:""))}},Lt.isTrue=function(){var n,i;if(arguments.length===1)n=arguments[0],Lt.isTrue(n,null);else if(arguments.length===2&&(n=arguments[0],i=arguments[1],!n))throw i===null?new ce:new ce(i)},Lt.equals=function(){var n,i,s;if(arguments.length===2)n=arguments[0],i=arguments[1],Lt.equals(n,i,null);else if(arguments.length===3&&(n=arguments[0],i=arguments[1],s=arguments[2],!i.equals(n)))throw new ce("Expected "+n+" but encountered "+i+(s!==null?": "+s:""))};var se=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 I,this._intPt[1]=new I,this._pa=this._intPt[0],this._pb=this._intPt[1],this._result=0},Y={DONT_INTERSECT:{configurable:!0},DO_INTERSECT:{configurable:!0},COLLINEAR:{configurable:!0},NO_INTERSECTION:{configurable:!0},POINT_INTERSECTION:{configurable:!0},COLLINEAR_INTERSECTION:{configurable:!0}};se.prototype.getIndexAlongSegment=function(n,i){return this.computeIntLineIndex(),this._intLineIndex[n][i]},se.prototype.getTopologySummary=function(){var n=new _t;return this.isEndPoint()&&n.append(" endpoint"),this._isProper&&n.append(" proper"),this.isCollinear()&&n.append(" collinear"),n.toString()},se.prototype.computeIntersection=function(n,i,s,u){this._inputLines[0][0]=n,this._inputLines[0][1]=i,this._inputLines[1][0]=s,this._inputLines[1][1]=u,this._result=this.computeIntersect(n,i,s,u)},se.prototype.getIntersectionNum=function(){return this._result},se.prototype.computeIntLineIndex=function(){if(arguments.length===0)this._intLineIndex===null&&(this._intLineIndex=Array(2).fill().map(function(){return Array(2)}),this.computeIntLineIndex(0),this.computeIntLineIndex(1));else if(arguments.length===1){var n=arguments[0];this.getEdgeDistance(n,0)>this.getEdgeDistance(n,1)?(this._intLineIndex[n][0]=0,this._intLineIndex[n][1]=1):(this._intLineIndex[n][0]=1,this._intLineIndex[n][1]=0)}},se.prototype.isProper=function(){return this.hasIntersection()&&this._isProper},se.prototype.setPrecisionModel=function(n){this._precisionModel=n},se.prototype.isInteriorIntersection=function(){if(arguments.length===0)return!!this.isInteriorIntersection(0)||!!this.isInteriorIntersection(1);if(arguments.length===1){for(var n=arguments[0],i=0;i<this._result;i++)if(!this._intPt[i].equals2D(this._inputLines[n][0])&&!this._intPt[i].equals2D(this._inputLines[n][1]))return!0;return!1}},se.prototype.getIntersection=function(n){return this._intPt[n]},se.prototype.isEndPoint=function(){return this.hasIntersection()&&!this._isProper},se.prototype.hasIntersection=function(){return this._result!==se.NO_INTERSECTION},se.prototype.getEdgeDistance=function(n,i){return se.computeEdgeDistance(this._intPt[i],this._inputLines[n][0],this._inputLines[n][1])},se.prototype.isCollinear=function(){return this._result===se.COLLINEAR_INTERSECTION},se.prototype.toString=function(){return Wt.toLineString(this._inputLines[0][0],this._inputLines[0][1])+" - "+Wt.toLineString(this._inputLines[1][0],this._inputLines[1][1])+this.getTopologySummary()},se.prototype.getEndpoint=function(n,i){return this._inputLines[n][i]},se.prototype.isIntersection=function(n){for(var i=0;i<this._result;i++)if(this._intPt[i].equals2D(n))return!0;return!1},se.prototype.getIntersectionAlongSegment=function(n,i){return this.computeIntLineIndex(),this._intPt[this._intLineIndex[n][i]]},se.prototype.interfaces_=function(){return[]},se.prototype.getClass=function(){return se},se.computeEdgeDistance=function(n,i,s){var u=Math.abs(s.x-i.x),c=Math.abs(s.y-i.y),m=-1;if(n.equals(i))m=0;else if(n.equals(s))m=u>c?u:c;else{var E=Math.abs(n.x-i.x),C=Math.abs(n.y-i.y);(m=u>c?E:C)!==0||n.equals(i)||(m=Math.max(E,C))}return Lt.isTrue(!(m===0&&!n.equals(i)),"Bad distance calculation"),m},se.nonRobustComputeEdgeDistance=function(n,i,s){var u=n.x-i.x,c=n.y-i.y,m=Math.sqrt(u*u+c*c);return Lt.isTrue(!(m===0&&!n.equals(i)),"Invalid distance calculation"),m},Y.DONT_INTERSECT.get=function(){return 0},Y.DO_INTERSECT.get=function(){return 1},Y.COLLINEAR.get=function(){return 2},Y.NO_INTERSECTION.get=function(){return 0},Y.POINT_INTERSECTION.get=function(){return 1},Y.COLLINEAR_INTERSECTION.get=function(){return 2},Object.defineProperties(se,Y);var N=function(n){function i(){n.apply(this,arguments)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.isInSegmentEnvelopes=function(s){var u=new At(this._inputLines[0][0],this._inputLines[0][1]),c=new At(this._inputLines[1][0],this._inputLines[1][1]);return u.contains(s)&&c.contains(s)},i.prototype.computeIntersection=function(){if(arguments.length!==3)return n.prototype.computeIntersection.apply(this,arguments);var s=arguments[0],u=arguments[1],c=arguments[2];if(this._isProper=!1,At.intersects(u,c,s)&&ot.orientationIndex(u,c,s)===0&&ot.orientationIndex(c,u,s)===0)return this._isProper=!0,(s.equals(u)||s.equals(c))&&(this._isProper=!1),this._result=n.POINT_INTERSECTION,null;this._result=n.NO_INTERSECTION},i.prototype.normalizeToMinimum=function(s,u,c,m,E){E.x=this.smallestInAbsValue(s.x,u.x,c.x,m.x),E.y=this.smallestInAbsValue(s.y,u.y,c.y,m.y),s.x-=E.x,s.y-=E.y,u.x-=E.x,u.y-=E.y,c.x-=E.x,c.y-=E.y,m.x-=E.x,m.y-=E.y},i.prototype.safeHCoordinateIntersection=function(s,u,c,m){var E=null;try{E=Dt.intersection(s,u,c,m)}catch(C){if(!(C instanceof $t))throw C;E=i.nearestEndpoint(s,u,c,m)}return E},i.prototype.intersection=function(s,u,c,m){var E=this.intersectionWithNormalization(s,u,c,m);return this.isInSegmentEnvelopes(E)||(E=new I(i.nearestEndpoint(s,u,c,m))),this._precisionModel!==null&&this._precisionModel.makePrecise(E),E},i.prototype.smallestInAbsValue=function(s,u,c,m){var E=s,C=Math.abs(E);return Math.abs(u)<C&&(E=u,C=Math.abs(u)),Math.abs(c)<C&&(E=c,C=Math.abs(c)),Math.abs(m)<C&&(E=m),E},i.prototype.checkDD=function(s,u,c,m,E){var C=Tt.intersection(s,u,c,m),U=this.isInSegmentEnvelopes(C);Ut.out.println("DD in env = "+U+" --------------------- "+C),E.distance(C)>1e-4&&Ut.out.println("Distance = "+E.distance(C))},i.prototype.intersectionWithNormalization=function(s,u,c,m){var E=new I(s),C=new I(u),U=new I(c),Z=new I(m),pt=new I;this.normalizeToEnvCentre(E,C,U,Z,pt);var gt=this.safeHCoordinateIntersection(E,C,U,Z);return gt.x+=pt.x,gt.y+=pt.y,gt},i.prototype.computeCollinearIntersection=function(s,u,c,m){var E=At.intersects(s,u,c),C=At.intersects(s,u,m),U=At.intersects(c,m,s),Z=At.intersects(c,m,u);return E&&C?(this._intPt[0]=c,this._intPt[1]=m,n.COLLINEAR_INTERSECTION):U&&Z?(this._intPt[0]=s,this._intPt[1]=u,n.COLLINEAR_INTERSECTION):E&&U?(this._intPt[0]=c,this._intPt[1]=s,!c.equals(s)||C||Z?n.COLLINEAR_INTERSECTION:n.POINT_INTERSECTION):E&&Z?(this._intPt[0]=c,this._intPt[1]=u,!c.equals(u)||C||U?n.COLLINEAR_INTERSECTION:n.POINT_INTERSECTION):C&&U?(this._intPt[0]=m,this._intPt[1]=s,!m.equals(s)||E||Z?n.COLLINEAR_INTERSECTION:n.POINT_INTERSECTION):C&&Z?(this._intPt[0]=m,this._intPt[1]=u,!m.equals(u)||E||U?n.COLLINEAR_INTERSECTION:n.POINT_INTERSECTION):n.NO_INTERSECTION},i.prototype.normalizeToEnvCentre=function(s,u,c,m,E){var C=s.x<u.x?s.x:u.x,U=s.y<u.y?s.y:u.y,Z=s.x>u.x?s.x:u.x,pt=s.y>u.y?s.y:u.y,gt=c.x<m.x?c.x:m.x,Rt=c.y<m.y?c.y:m.y,Ft=c.x>m.x?c.x:m.x,Vt=c.y>m.y?c.y:m.y,ee=((C>gt?C:gt)+(Z<Ft?Z:Ft))/2,hn=((U>Rt?U:Rt)+(pt<Vt?pt:Vt))/2;E.x=ee,E.y=hn,s.x-=E.x,s.y-=E.y,u.x-=E.x,u.y-=E.y,c.x-=E.x,c.y-=E.y,m.x-=E.x,m.y-=E.y},i.prototype.computeIntersect=function(s,u,c,m){if(this._isProper=!1,!At.intersects(s,u,c,m))return n.NO_INTERSECTION;var E=ot.orientationIndex(s,u,c),C=ot.orientationIndex(s,u,m);if(E>0&&C>0||E<0&&C<0)return n.NO_INTERSECTION;var U=ot.orientationIndex(c,m,s),Z=ot.orientationIndex(c,m,u);return U>0&&Z>0||U<0&&Z<0?n.NO_INTERSECTION:E===0&&C===0&&U===0&&Z===0?this.computeCollinearIntersection(s,u,c,m):(E===0||C===0||U===0||Z===0?(this._isProper=!1,s.equals2D(c)||s.equals2D(m)?this._intPt[0]=s:u.equals2D(c)||u.equals2D(m)?this._intPt[0]=u:E===0?this._intPt[0]=new I(c):C===0?this._intPt[0]=new I(m):U===0?this._intPt[0]=new I(s):Z===0&&(this._intPt[0]=new I(u))):(this._isProper=!0,this._intPt[0]=this.intersection(s,u,c,m)),n.POINT_INTERSECTION)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i.nearestEndpoint=function(s,u,c,m){var E=s,C=ot.distancePointLine(s,c,m),U=ot.distancePointLine(u,c,m);return U<C&&(C=U,E=u),(U=ot.distancePointLine(c,s,u))<C&&(C=U,E=c),(U=ot.distancePointLine(m,s,u))<C&&(C=U,E=m),E},i}(se),xt=function(){};xt.prototype.interfaces_=function(){return[]},xt.prototype.getClass=function(){return xt},xt.orientationIndex=function(n,i,s){var u=i.x-n.x,c=i.y-n.y,m=s.x-i.x,E=s.y-i.y;return xt.signOfDet2x2(u,c,m,E)},xt.signOfDet2x2=function(n,i,s,u){var c=null,m=null,E=null;if(c=1,n===0||u===0)return i===0||s===0?0:i>0?s>0?-c:c:s>0?c:-c;if(i===0||s===0)return u>0?n>0?c:-c:n>0?-c:c;if(i>0?u>0?i<=u||(c=-c,m=n,n=s,s=m,m=i,i=u,u=m):i<=-u?(c=-c,s=-s,u=-u):(m=n,n=-s,s=m,m=i,i=-u,u=m):u>0?-i<=u?(c=-c,n=-n,i=-i):(m=-n,n=s,s=m,m=-i,i=u,u=m):i>=u?(n=-n,i=-i,s=-s,u=-u):(c=-c,m=-n,n=-s,s=m,m=-i,i=-u,u=m),n>0){if(!(s>0)||!(n<=s))return c}else{if(s>0||!(n>=s))return-c;c=-c,n=-n,s=-s}for(;;){if(E=Math.floor(s/n),s-=E*n,(u-=E*i)<0)return-c;if(u>i)return c;if(n>s+s){if(i<u+u)return c}else{if(i>u+u)return-c;s=n-s,u=i-u,c=-c}if(u===0)return s===0?0:-c;if(s===0||(E=Math.floor(n/s),n-=E*s,(i-=E*u)<0))return c;if(i>u)return-c;if(s>n+n){if(u<i+i)return-c}else{if(u>i+i)return c;n=s-n,i=u-i,c=-c}if(i===0)return n===0?0:c;if(n===0)return-c}};var Et=function(){this._p=null,this._crossingCount=0,this._isPointOnSegment=!1;var n=arguments[0];this._p=n};Et.prototype.countSegment=function(n,i){if(n.x<this._p.x&&i.x<this._p.x)return null;if(this._p.x===i.x&&this._p.y===i.y)return this._isPointOnSegment=!0,null;if(n.y===this._p.y&&i.y===this._p.y){var s=n.x,u=i.x;return s>u&&(s=i.x,u=n.x),this._p.x>=s&&this._p.x<=u&&(this._isPointOnSegment=!0),null}if(n.y>this._p.y&&i.y<=this._p.y||i.y>this._p.y&&n.y<=this._p.y){var c=n.x-this._p.x,m=n.y-this._p.y,E=i.x-this._p.x,C=i.y-this._p.y,U=xt.signOfDet2x2(c,m,E,C);if(U===0)return this._isPointOnSegment=!0,null;C<m&&(U=-U),U>0&&this._crossingCount++}},Et.prototype.isPointInPolygon=function(){return this.getLocation()!==V.EXTERIOR},Et.prototype.getLocation=function(){return this._isPointOnSegment?V.BOUNDARY:this._crossingCount%2==1?V.INTERIOR:V.EXTERIOR},Et.prototype.isOnSegment=function(){return this._isPointOnSegment},Et.prototype.interfaces_=function(){return[]},Et.prototype.getClass=function(){return Et},Et.locatePointInRing=function(){if(arguments[0]instanceof I&&X(arguments[1],tt)){for(var n=arguments[0],i=arguments[1],s=new Et(n),u=new I,c=new I,m=1;m<i.size();m++)if(i.getCoordinate(m,u),i.getCoordinate(m-1,c),s.countSegment(u,c),s.isOnSegment())return s.getLocation();return s.getLocation()}if(arguments[0]instanceof I&&arguments[1]instanceof Array){for(var E=arguments[0],C=arguments[1],U=new Et(E),Z=1;Z<C.length;Z++){var pt=C[Z],gt=C[Z-1];if(U.countSegment(pt,gt),U.isOnSegment())return U.getLocation()}return U.getLocation()}};var ot=function(){},Pt={CLOCKWISE:{configurable:!0},RIGHT:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},LEFT:{configurable:!0},COLLINEAR:{configurable:!0},STRAIGHT:{configurable:!0}};ot.prototype.interfaces_=function(){return[]},ot.prototype.getClass=function(){return ot},ot.orientationIndex=function(n,i,s){return Tt.orientationIndex(n,i,s)},ot.signedArea=function(){if(arguments[0]instanceof Array){var n=arguments[0];if(n.length<3)return 0;for(var i=0,s=n[0].x,u=1;u<n.length-1;u++){var c=n[u].x-s,m=n[u+1].y;i+=c*(n[u-1].y-m)}return i/2}if(X(arguments[0],tt)){var E=arguments[0],C=E.size();if(C<3)return 0;var U=new I,Z=new I,pt=new I;E.getCoordinate(0,Z),E.getCoordinate(1,pt);var gt=Z.x;pt.x-=gt;for(var Rt=0,Ft=1;Ft<C-1;Ft++)U.y=Z.y,Z.x=pt.x,Z.y=pt.y,E.getCoordinate(Ft+1,pt),pt.x-=gt,Rt+=Z.x*(U.y-pt.y);return Rt/2}},ot.distanceLineLine=function(n,i,s,u){if(n.equals(i))return ot.distancePointLine(n,s,u);if(s.equals(u))return ot.distancePointLine(u,n,i);var c=!1;if(At.intersects(n,i,s,u)){var m=(i.x-n.x)*(u.y-s.y)-(i.y-n.y)*(u.x-s.x);if(m===0)c=!0;else{var E=(n.y-s.y)*(u.x-s.x)-(n.x-s.x)*(u.y-s.y),C=((n.y-s.y)*(i.x-n.x)-(n.x-s.x)*(i.y-n.y))/m,U=E/m;(U<0||U>1||C<0||C>1)&&(c=!0)}}else c=!0;return c?mt.min(ot.distancePointLine(n,s,u),ot.distancePointLine(i,s,u),ot.distancePointLine(s,n,i),ot.distancePointLine(u,n,i)):0},ot.isPointInRing=function(n,i){return ot.locatePointInRing(n,i)!==V.EXTERIOR},ot.computeLength=function(n){var i=n.size();if(i<=1)return 0;var s=0,u=new I;n.getCoordinate(0,u);for(var c=u.x,m=u.y,E=1;E<i;E++){n.getCoordinate(E,u);var C=u.x,U=u.y,Z=C-c,pt=U-m;s+=Math.sqrt(Z*Z+pt*pt),c=C,m=U}return s},ot.isCCW=function(n){var i=n.length-1;if(i<3)throw new A("Ring has fewer than 4 points, so orientation cannot be determined");for(var s=n[0],u=0,c=1;c<=i;c++){var m=n[c];m.y>s.y&&(s=m,u=c)}var E=u;do(E-=1)<0&&(E=i);while(n[E].equals2D(s)&&E!==u);var C=u;do C=(C+1)%i;while(n[C].equals2D(s)&&C!==u);var U=n[E],Z=n[C];if(U.equals2D(s)||Z.equals2D(s)||U.equals2D(Z))return!1;var pt=ot.computeOrientation(U,s,Z),gt=!1;return gt=pt===0?U.x>Z.x:pt>0,gt},ot.locatePointInRing=function(n,i){return Et.locatePointInRing(n,i)},ot.distancePointLinePerpendicular=function(n,i,s){var u=(s.x-i.x)*(s.x-i.x)+(s.y-i.y)*(s.y-i.y),c=((i.y-n.y)*(s.x-i.x)-(i.x-n.x)*(s.y-i.y))/u;return Math.abs(c)*Math.sqrt(u)},ot.computeOrientation=function(n,i,s){return ot.orientationIndex(n,i,s)},ot.distancePointLine=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];if(i.length===0)throw new A("Line array must contain at least one vertex");for(var s=n.distance(i[0]),u=0;u<i.length-1;u++){var c=ot.distancePointLine(n,i[u],i[u+1]);c<s&&(s=c)}return s}if(arguments.length===3){var m=arguments[0],E=arguments[1],C=arguments[2];if(E.x===C.x&&E.y===C.y)return m.distance(E);var U=(C.x-E.x)*(C.x-E.x)+(C.y-E.y)*(C.y-E.y),Z=((m.x-E.x)*(C.x-E.x)+(m.y-E.y)*(C.y-E.y))/U;if(Z<=0)return m.distance(E);if(Z>=1)return m.distance(C);var pt=((E.y-m.y)*(C.x-E.x)-(E.x-m.x)*(C.y-E.y))/U;return Math.abs(pt)*Math.sqrt(U)}},ot.isOnLine=function(n,i){for(var s=new N,u=1;u<i.length;u++){var c=i[u-1],m=i[u];if(s.computeIntersection(n,c,m),s.hasIntersection())return!0}return!1},Pt.CLOCKWISE.get=function(){return-1},Pt.RIGHT.get=function(){return ot.CLOCKWISE},Pt.COUNTERCLOCKWISE.get=function(){return 1},Pt.LEFT.get=function(){return ot.COUNTERCLOCKWISE},Pt.COLLINEAR.get=function(){return 0},Pt.STRAIGHT.get=function(){return ot.COLLINEAR},Object.defineProperties(ot,Pt);var ue=function(){};ue.prototype.filter=function(n){},ue.prototype.interfaces_=function(){return[]},ue.prototype.getClass=function(){return ue};var Ct=function(){var n=arguments[0];this._envelope=null,this._factory=null,this._SRID=null,this._userData=null,this._factory=n,this._SRID=n.getSRID()},Ot={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}};Ct.prototype.isGeometryCollection=function(){return this.getSortIndex()===Ct.SORTINDEX_GEOMETRYCOLLECTION},Ct.prototype.getFactory=function(){return this._factory},Ct.prototype.getGeometryN=function(n){return this},Ct.prototype.getArea=function(){return 0},Ct.prototype.isRectangle=function(){return!1},Ct.prototype.equals=function(){if(arguments[0]instanceof Ct){var n=arguments[0];return n!==null&&this.equalsTopo(n)}if(arguments[0]instanceof Object){var i=arguments[0];if(!(i instanceof Ct))return!1;var s=i;return this.equalsExact(s)}},Ct.prototype.equalsExact=function(n){return this===n||this.equalsExact(n,0)},Ct.prototype.geometryChanged=function(){this.apply(Ct.geometryChangedFilter)},Ct.prototype.geometryChangedAction=function(){this._envelope=null},Ct.prototype.equalsNorm=function(n){return n!==null&&this.norm().equalsExact(n.norm())},Ct.prototype.getLength=function(){return 0},Ct.prototype.getNumGeometries=function(){return 1},Ct.prototype.compareTo=function(){if(arguments.length===1){var n=arguments[0],i=n;return this.getSortIndex()!==i.getSortIndex()?this.getSortIndex()-i.getSortIndex():this.isEmpty()&&i.isEmpty()?0:this.isEmpty()?-1:i.isEmpty()?1:this.compareToSameClass(n)}if(arguments.length===2){var s=arguments[0],u=arguments[1];return this.getSortIndex()!==s.getSortIndex()?this.getSortIndex()-s.getSortIndex():this.isEmpty()&&s.isEmpty()?0:this.isEmpty()?-1:s.isEmpty()?1:this.compareToSameClass(s,u)}},Ct.prototype.getUserData=function(){return this._userData},Ct.prototype.getSRID=function(){return this._SRID},Ct.prototype.getEnvelope=function(){return this.getFactory().toGeometry(this.getEnvelopeInternal())},Ct.prototype.checkNotGeometryCollection=function(n){if(n.getSortIndex()===Ct.SORTINDEX_GEOMETRYCOLLECTION)throw new A("This method does not support GeometryCollection arguments")},Ct.prototype.equal=function(n,i,s){return s===0?n.equals(i):n.distance(i)<=s},Ct.prototype.norm=function(){var n=this.copy();return n.normalize(),n},Ct.prototype.getPrecisionModel=function(){return this._factory.getPrecisionModel()},Ct.prototype.getEnvelopeInternal=function(){return this._envelope===null&&(this._envelope=this.computeEnvelopeInternal()),new At(this._envelope)},Ct.prototype.setSRID=function(n){this._SRID=n},Ct.prototype.setUserData=function(n){this._userData=n},Ct.prototype.compare=function(n,i){for(var s=n.iterator(),u=i.iterator();s.hasNext()&&u.hasNext();){var c=s.next(),m=u.next(),E=c.compareTo(m);if(E!==0)return E}return s.hasNext()?1:u.hasNext()?-1:0},Ct.prototype.hashCode=function(){return this.getEnvelopeInternal().hashCode()},Ct.prototype.isGeometryCollectionOrDerived=function(){return this.getSortIndex()===Ct.SORTINDEX_GEOMETRYCOLLECTION||this.getSortIndex()===Ct.SORTINDEX_MULTIPOINT||this.getSortIndex()===Ct.SORTINDEX_MULTILINESTRING||this.getSortIndex()===Ct.SORTINDEX_MULTIPOLYGON},Ct.prototype.interfaces_=function(){return[z,G,t]},Ct.prototype.getClass=function(){return Ct},Ct.hasNonEmptyElements=function(n){for(var i=0;i<n.length;i++)if(!n[i].isEmpty())return!0;return!1},Ct.hasNullElements=function(n){for(var i=0;i<n.length;i++)if(n[i]===null)return!0;return!1},Ot.serialVersionUID.get=function(){return 8763622679187377e3},Ot.SORTINDEX_POINT.get=function(){return 0},Ot.SORTINDEX_MULTIPOINT.get=function(){return 1},Ot.SORTINDEX_LINESTRING.get=function(){return 2},Ot.SORTINDEX_LINEARRING.get=function(){return 3},Ot.SORTINDEX_MULTILINESTRING.get=function(){return 4},Ot.SORTINDEX_POLYGON.get=function(){return 5},Ot.SORTINDEX_MULTIPOLYGON.get=function(){return 6},Ot.SORTINDEX_GEOMETRYCOLLECTION.get=function(){return 7},Ot.geometryChangedFilter.get=function(){return kt},Object.defineProperties(Ct,Ot);var kt=function(){};kt.interfaces_=function(){return[ue]},kt.filter=function(n){n.geometryChangedAction()};var J=function(){};J.prototype.filter=function(n){},J.prototype.interfaces_=function(){return[]},J.prototype.getClass=function(){return J};var w=function(){},P={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}};w.prototype.isInBoundary=function(n){},w.prototype.interfaces_=function(){return[]},w.prototype.getClass=function(){return w},P.Mod2BoundaryNodeRule.get=function(){return D},P.EndPointBoundaryNodeRule.get=function(){return k},P.MultiValentEndPointBoundaryNodeRule.get=function(){return B},P.MonoValentEndPointBoundaryNodeRule.get=function(){return et},P.MOD2_BOUNDARY_RULE.get=function(){return new D},P.ENDPOINT_BOUNDARY_RULE.get=function(){return new k},P.MULTIVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new B},P.MONOVALENT_ENDPOINT_BOUNDARY_RULE.get=function(){return new et},P.OGC_SFS_BOUNDARY_RULE.get=function(){return w.MOD2_BOUNDARY_RULE},Object.defineProperties(w,P);var D=function(){};D.prototype.isInBoundary=function(n){return n%2==1},D.prototype.interfaces_=function(){return[w]},D.prototype.getClass=function(){return D};var k=function(){};k.prototype.isInBoundary=function(n){return n>0},k.prototype.interfaces_=function(){return[w]},k.prototype.getClass=function(){return k};var B=function(){};B.prototype.isInBoundary=function(n){return n>1},B.prototype.interfaces_=function(){return[w]},B.prototype.getClass=function(){return B};var et=function(){};et.prototype.isInBoundary=function(n){return n===1},et.prototype.interfaces_=function(){return[w]},et.prototype.getClass=function(){return et};var j=function(){};j.prototype.add=function(){},j.prototype.addAll=function(){},j.prototype.isEmpty=function(){},j.prototype.iterator=function(){},j.prototype.size=function(){},j.prototype.toArray=function(){},j.prototype.remove=function(){},(e.prototype=new Error).name="IndexOutOfBoundsException";var ft=function(){};ft.prototype.hasNext=function(){},ft.prototype.next=function(){},ft.prototype.remove=function(){};var ct=function(n){function i(){n.apply(this,arguments)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.get=function(){},i.prototype.set=function(){},i.prototype.isEmpty=function(){},i}(j);(o.prototype=new Error).name="NoSuchElementException";var O=function(n){function i(){n.call(this),this.array_=[],arguments[0]instanceof j&&this.addAll(arguments[0])}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.ensureCapacity=function(){},i.prototype.interfaces_=function(){return[n,j]},i.prototype.add=function(s){return arguments.length===1?this.array_.push(s):this.array_.splice(arguments[0],arguments[1]),!0},i.prototype.clear=function(){this.array_=[]},i.prototype.addAll=function(s){for(var u=s.iterator();u.hasNext();)this.add(u.next());return!0},i.prototype.set=function(s,u){var c=this.array_[s];return this.array_[s]=u,c},i.prototype.iterator=function(){return new K(this)},i.prototype.get=function(s){if(s<0||s>=this.size())throw new e;return this.array_[s]},i.prototype.isEmpty=function(){return this.array_.length===0},i.prototype.size=function(){return this.array_.length},i.prototype.toArray=function(){for(var s=[],u=0,c=this.array_.length;u<c;u++)s.push(this.array_[u]);return s},i.prototype.remove=function(s){for(var u=!1,c=0,m=this.array_.length;c<m;c++)if(this.array_[c]===s){this.array_.splice(c,1),u=!0;break}return u},i}(ct),K=function(n){function i(s){n.call(this),this.arrayList_=s,this.position_=0}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.next=function(){if(this.position_===this.arrayList_.size())throw new o;return this.arrayList_.get(this.position_++)},i.prototype.hasNext=function(){return this.position_<this.arrayList_.size()},i.prototype.set=function(s){return this.arrayList_.set(this.position_-1,s)},i.prototype.remove=function(){this.arrayList_.remove(this.arrayList_.get(this.position_))},i}(ft),$=function(n){function i(){if(n.call(this),arguments.length!==0){if(arguments.length===1){var u=arguments[0];this.ensureCapacity(u.length),this.add(u,!0)}else if(arguments.length===2){var c=arguments[0],m=arguments[1];this.ensureCapacity(c.length),this.add(c,m)}}}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={coordArrayType:{configurable:!0}};return s.coordArrayType.get=function(){return new Array(0).fill(null)},i.prototype.getCoordinate=function(u){return this.get(u)},i.prototype.addAll=function(){if(arguments.length===2){for(var u=arguments[0],c=arguments[1],m=!1,E=u.iterator();E.hasNext();)this.add(E.next(),c),m=!0;return m}return n.prototype.addAll.apply(this,arguments)},i.prototype.clone=function(){for(var u=n.prototype.clone.call(this),c=0;c<this.size();c++)u.add(c,this.get(c).copy());return u},i.prototype.toCoordinateArray=function(){return this.toArray(i.coordArrayType)},i.prototype.add=function(){if(arguments.length===1){var u=arguments[0];n.prototype.add.call(this,u)}else if(arguments.length===2){if(arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var c=arguments[0],m=arguments[1];return this.add(c,m,!0),!0}if(arguments[0]instanceof I&&typeof arguments[1]=="boolean"){var E=arguments[0];if(!arguments[1]&&this.size()>=1&&this.get(this.size()-1).equals2D(E))return null;n.prototype.add.call(this,E)}else if(arguments[0]instanceof Object&&typeof arguments[1]=="boolean"){var C=arguments[0],U=arguments[1];return this.add(C,U),!0}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var Z=arguments[0],pt=arguments[1];if(arguments[2])for(var gt=0;gt<Z.length;gt++)this.add(Z[gt],pt);else for(var Rt=Z.length-1;Rt>=0;Rt--)this.add(Z[Rt],pt);return!0}if(typeof arguments[2]=="boolean"&&Number.isInteger(arguments[0])&&arguments[1]instanceof I){var Ft=arguments[0],Vt=arguments[1];if(!arguments[2]){var ee=this.size();if(ee>0&&(Ft>0&&this.get(Ft-1).equals2D(Vt)||Ft<ee&&this.get(Ft).equals2D(Vt)))return null}n.prototype.add.call(this,Ft,Vt)}}else if(arguments.length===4){var hn=arguments[0],qn=arguments[1],Tr=arguments[2],no=arguments[3],$o=1;Tr>no&&($o=-1);for(var hp=Tr;hp!==no;hp+=$o)this.add(hn[hp],qn);return!0}},i.prototype.closeRing=function(){this.size()>0&&this.add(new I(this.get(0)),!1)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},Object.defineProperties(i,s),i}(O),Q=function(){},St={ForwardComparator:{configurable:!0},BidirectionalComparator:{configurable:!0},coordArrayType:{configurable:!0}};St.ForwardComparator.get=function(){return Nt},St.BidirectionalComparator.get=function(){return Jt},St.coordArrayType.get=function(){return new Array(0).fill(null)},Q.prototype.interfaces_=function(){return[]},Q.prototype.getClass=function(){return Q},Q.isRing=function(n){return!(n.length<4)&&!!n[0].equals2D(n[n.length-1])},Q.ptNotInList=function(n,i){for(var s=0;s<n.length;s++){var u=n[s];if(Q.indexOf(u,i)<0)return u}return null},Q.scroll=function(n,i){var s=Q.indexOf(i,n);if(s<0)return null;var u=new Array(n.length).fill(null);Ut.arraycopy(n,s,u,0,n.length-s),Ut.arraycopy(n,0,u,n.length-s,s),Ut.arraycopy(u,0,n,0,n.length)},Q.equals=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];if(n===i)return!0;if(n===null||i===null||n.length!==i.length)return!1;for(var s=0;s<n.length;s++)if(!n[s].equals(i[s]))return!1;return!0}if(arguments.length===3){var u=arguments[0],c=arguments[1],m=arguments[2];if(u===c)return!0;if(u===null||c===null||u.length!==c.length)return!1;for(var E=0;E<u.length;E++)if(m.compare(u[E],c[E])!==0)return!1;return!0}},Q.intersection=function(n,i){for(var s=new $,u=0;u<n.length;u++)i.intersects(n[u])&&s.add(n[u],!0);return s.toCoordinateArray()},Q.hasRepeatedPoints=function(n){for(var i=1;i<n.length;i++)if(n[i-1].equals(n[i]))return!0;return!1},Q.removeRepeatedPoints=function(n){return Q.hasRepeatedPoints(n)?new $(n,!1).toCoordinateArray():n},Q.reverse=function(n){for(var i=n.length-1,s=Math.trunc(i/2),u=0;u<=s;u++){var c=n[u];n[u]=n[i-u],n[i-u]=c}},Q.removeNull=function(n){for(var i=0,s=0;s<n.length;s++)n[s]!==null&&i++;var u=new Array(i).fill(null);if(i===0)return u;for(var c=0,m=0;m<n.length;m++)n[m]!==null&&(u[c++]=n[m]);return u},Q.copyDeep=function(){if(arguments.length===1){for(var n=arguments[0],i=new Array(n.length).fill(null),s=0;s<n.length;s++)i[s]=new I(n[s]);return i}if(arguments.length===5)for(var u=arguments[0],c=arguments[1],m=arguments[2],E=arguments[3],C=arguments[4],U=0;U<C;U++)m[E+U]=new I(u[c+U])},Q.isEqualReversed=function(n,i){for(var s=0;s<n.length;s++){var u=n[s],c=i[n.length-s-1];if(u.compareTo(c)!==0)return!1}return!0},Q.envelope=function(n){for(var i=new At,s=0;s<n.length;s++)i.expandToInclude(n[s]);return i},Q.toCoordinateArray=function(n){return n.toArray(Q.coordArrayType)},Q.atLeastNCoordinatesOrNothing=function(n,i){return i.length>=n?i:[]},Q.indexOf=function(n,i){for(var s=0;s<i.length;s++)if(n.equals(i[s]))return s;return-1},Q.increasingDirection=function(n){for(var i=0;i<Math.trunc(n.length/2);i++){var s=n.length-1-i,u=n[i].compareTo(n[s]);if(u!==0)return u}return 1},Q.compare=function(n,i){for(var s=0;s<n.length&&s<i.length;){var u=n[s].compareTo(i[s]);if(u!==0)return u;s++}return s<i.length?-1:s<n.length?1:0},Q.minCoordinate=function(n){for(var i=null,s=0;s<n.length;s++)(i===null||i.compareTo(n[s])>0)&&(i=n[s]);return i},Q.extract=function(n,i,s){i=mt.clamp(i,0,n.length);var u=(s=mt.clamp(s,-1,n.length))-i+1;s<0&&(u=0),i>=n.length&&(u=0),s<i&&(u=0);var c=new Array(u).fill(null);if(u===0)return c;for(var m=0,E=i;E<=s;E++)c[m++]=n[E];return c},Object.defineProperties(Q,St);var Nt=function(){};Nt.prototype.compare=function(n,i){return Q.compare(n,i)},Nt.prototype.interfaces_=function(){return[F]},Nt.prototype.getClass=function(){return Nt};var Jt=function(){};Jt.prototype.compare=function(n,i){var s=n,u=i;if(s.length<u.length)return-1;if(s.length>u.length)return 1;if(s.length===0)return 0;var c=Q.compare(s,u);return Q.isEqualReversed(s,u)?0:c},Jt.prototype.OLDcompare=function(n,i){var s=n,u=i;if(s.length<u.length)return-1;if(s.length>u.length)return 1;if(s.length===0)return 0;for(var c=Q.increasingDirection(s),m=Q.increasingDirection(u),E=c>0?0:s.length-1,C=m>0?0:s.length-1,U=0;U<s.length;U++){var Z=s[E].compareTo(u[C]);if(Z!==0)return Z;E+=c,C+=m}return 0},Jt.prototype.interfaces_=function(){return[F]},Jt.prototype.getClass=function(){return Jt};var Kt=function(){};Kt.prototype.get=function(){},Kt.prototype.put=function(){},Kt.prototype.size=function(){},Kt.prototype.values=function(){},Kt.prototype.entrySet=function(){};var Ee=function(n){function i(){n.apply(this,arguments)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i}(Kt);(a.prototype=new Error).name="OperationNotSupported",(l.prototype=new j).contains=function(){};var de=function(n){function i(){n.call(this),this.array_=[],arguments[0]instanceof j&&this.addAll(arguments[0])}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.contains=function(s){for(var u=0,c=this.array_.length;u<c;u++)if(this.array_[u]===s)return!0;return!1},i.prototype.add=function(s){return!this.contains(s)&&(this.array_.push(s),!0)},i.prototype.addAll=function(s){for(var u=s.iterator();u.hasNext();)this.add(u.next());return!0},i.prototype.remove=function(s){throw new Error},i.prototype.size=function(){return this.array_.length},i.prototype.isEmpty=function(){return this.array_.length===0},i.prototype.toArray=function(){for(var s=[],u=0,c=this.array_.length;u<c;u++)s.push(this.array_[u]);return s},i.prototype.iterator=function(){return new Se(this)},i}(l),Se=function(n){function i(s){n.call(this),this.hashSet_=s,this.position_=0}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.next=function(){if(this.position_===this.hashSet_.size())throw new o;return this.hashSet_.array_[this.position_++]},i.prototype.hasNext=function(){return this.position_<this.hashSet_.size()},i.prototype.remove=function(){throw new a},i}(ft),we=0;(x.prototype=new Ee).get=function(n){for(var i=this.root_;i!==null;){var s=n.compareTo(i.key);if(s<0)i=i.left;else{if(!(s>0))return i.value;i=i.right}}return null},x.prototype.put=function(n,i){if(this.root_===null)return this.root_={key:n,value:i,left:null,right:null,parent:null,color:we,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var s,u,c=this.root_;do if(s=c,(u=n.compareTo(c.key))<0)c=c.left;else{if(!(u>0)){var m=c.value;return c.value=i,m}c=c.right}while(c!==null);var E={key:n,left:null,right:null,value:i,parent:s,color:we,getValue:function(){return this.value},getKey:function(){return this.key}};return u<0?s.left=E:s.right=E,this.fixAfterInsertion(E),this.size_++,null},x.prototype.fixAfterInsertion=function(n){for(n.color=1;n!=null&&n!==this.root_&&n.parent.color===1;)if(f(n)===d(f(f(n)))){var i=g(f(f(n)));h(i)===1?(p(f(n),we),p(i,we),p(f(f(n)),1),n=f(f(n))):(n===g(f(n))&&(n=f(n),this.rotateLeft(n)),p(f(n),we),p(f(f(n)),1),this.rotateRight(f(f(n))))}else{var s=d(f(f(n)));h(s)===1?(p(f(n),we),p(s,we),p(f(f(n)),1),n=f(f(n))):(n===d(f(n))&&(n=f(n),this.rotateRight(n)),p(f(n),we),p(f(f(n)),1),this.rotateLeft(f(f(n))))}this.root_.color=we},x.prototype.values=function(){var n=new O,i=this.getFirstEntry();if(i!==null)for(n.add(i.value);(i=x.successor(i))!==null;)n.add(i.value);return n},x.prototype.entrySet=function(){var n=new de,i=this.getFirstEntry();if(i!==null)for(n.add(i);(i=x.successor(i))!==null;)n.add(i);return n},x.prototype.rotateLeft=function(n){if(n!=null){var i=n.right;n.right=i.left,i.left!=null&&(i.left.parent=n),i.parent=n.parent,n.parent===null?this.root_=i:n.parent.left===n?n.parent.left=i:n.parent.right=i,i.left=n,n.parent=i}},x.prototype.rotateRight=function(n){if(n!=null){var i=n.left;n.left=i.right,i.right!=null&&(i.right.parent=n),i.parent=n.parent,n.parent===null?this.root_=i:n.parent.right===n?n.parent.right=i:n.parent.left=i,i.right=n,n.parent=i}},x.prototype.getFirstEntry=function(){var n=this.root_;if(n!=null)for(;n.left!=null;)n=n.left;return n},x.successor=function(n){if(n===null)return null;if(n.right!==null){for(var i=n.right;i.left!==null;)i=i.left;return i}for(var s=n.parent,u=n;s!==null&&u===s.right;)u=s,s=s.parent;return s},x.prototype.size=function(){return this.size_};var On=function(){};On.prototype.interfaces_=function(){return[]},On.prototype.getClass=function(){return On},v.prototype=new l,(M.prototype=new v).contains=function(n){for(var i=0,s=this.array_.length;i<s;i++)if(this.array_[i].compareTo(n)===0)return!0;return!1},M.prototype.add=function(n){if(this.contains(n))return!1;for(var i=0,s=this.array_.length;i<s;i++)if(this.array_[i].compareTo(n)===1)return this.array_.splice(i,0,n),!0;return this.array_.push(n),!0},M.prototype.addAll=function(n){for(var i=n.iterator();i.hasNext();)this.add(i.next());return!0},M.prototype.remove=function(n){throw new a},M.prototype.size=function(){return this.array_.length},M.prototype.isEmpty=function(){return this.array_.length===0},M.prototype.toArray=function(){for(var n=[],i=0,s=this.array_.length;i<s;i++)n.push(this.array_[i]);return n},M.prototype.iterator=function(){return new sr(this)};var sr=function(n){this.treeSet_=n,this.position_=0};sr.prototype.next=function(){if(this.position_===this.treeSet_.size())throw new o;return this.treeSet_.array_[this.position_++]},sr.prototype.hasNext=function(){return this.position_<this.treeSet_.size()},sr.prototype.remove=function(){throw new a};var _n=function(){};_n.sort=function(){var n,i,s,u,c=arguments[0];if(arguments.length===1)u=function(E,C){return E.compareTo(C)},c.sort(u);else if(arguments.length===2)s=arguments[1],u=function(E,C){return s.compare(E,C)},c.sort(u);else if(arguments.length===3){(i=c.slice(arguments[1],arguments[2])).sort();var m=c.slice(0,arguments[1]).concat(i,c.slice(arguments[2],c.length));for(c.splice(0,c.length),n=0;n<m.length;n++)c.push(m[n])}else if(arguments.length===4)for(i=c.slice(arguments[1],arguments[2]),s=arguments[3],u=function(E,C){return s.compare(E,C)},i.sort(u),m=c.slice(0,arguments[1]).concat(i,c.slice(arguments[2],c.length)),c.splice(0,c.length),n=0;n<m.length;n++)c.push(m[n])},_n.asList=function(n){for(var i=new O,s=0,u=n.length;s<u;s++)i.add(n[s]);return i};var le=function(){},xn={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}};xn.P.get=function(){return 0},xn.L.get=function(){return 1},xn.A.get=function(){return 2},xn.FALSE.get=function(){return-1},xn.TRUE.get=function(){return-2},xn.DONTCARE.get=function(){return-3},xn.SYM_FALSE.get=function(){return"F"},xn.SYM_TRUE.get=function(){return"T"},xn.SYM_DONTCARE.get=function(){return"*"},xn.SYM_P.get=function(){return"0"},xn.SYM_L.get=function(){return"1"},xn.SYM_A.get=function(){return"2"},le.prototype.interfaces_=function(){return[]},le.prototype.getClass=function(){return le},le.toDimensionSymbol=function(n){switch(n){case le.FALSE:return le.SYM_FALSE;case le.TRUE:return le.SYM_TRUE;case le.DONTCARE:return le.SYM_DONTCARE;case le.P:return le.SYM_P;case le.L:return le.SYM_L;case le.A:return le.SYM_A}throw new A("Unknown dimension value: "+n)},le.toDimensionValue=function(n){switch(lt.toUpperCase(n)){case le.SYM_FALSE:return le.FALSE;case le.SYM_TRUE:return le.TRUE;case le.SYM_DONTCARE:return le.DONTCARE;case le.SYM_P:return le.P;case le.SYM_L:return le.L;case le.SYM_A:return le.A}throw new A("Unknown dimension symbol: "+n)},Object.defineProperties(le,xn);var In=function(){};In.prototype.filter=function(n){},In.prototype.interfaces_=function(){return[]},In.prototype.getClass=function(){return In};var Tn=function(){};Tn.prototype.filter=function(n,i){},Tn.prototype.isDone=function(){},Tn.prototype.isGeometryChanged=function(){},Tn.prototype.interfaces_=function(){return[]},Tn.prototype.getClass=function(){return Tn};var En=function(n){function i(u,c){if(n.call(this,c),this._geometries=u||[],n.hasNullElements(this._geometries))throw new A("geometries must not contain null elements")}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.computeEnvelopeInternal=function(){for(var u=new At,c=0;c<this._geometries.length;c++)u.expandToInclude(this._geometries[c].getEnvelopeInternal());return u},i.prototype.getGeometryN=function(u){return this._geometries[u]},i.prototype.getSortIndex=function(){return n.SORTINDEX_GEOMETRYCOLLECTION},i.prototype.getCoordinates=function(){for(var u=new Array(this.getNumPoints()).fill(null),c=-1,m=0;m<this._geometries.length;m++)for(var E=this._geometries[m].getCoordinates(),C=0;C<E.length;C++)u[++c]=E[C];return u},i.prototype.getArea=function(){for(var u=0,c=0;c<this._geometries.length;c++)u+=this._geometries[c].getArea();return u},i.prototype.equalsExact=function(){if(arguments.length===2){var u=arguments[0],c=arguments[1];if(!this.isEquivalentClass(u))return!1;var m=u;if(this._geometries.length!==m._geometries.length)return!1;for(var E=0;E<this._geometries.length;E++)if(!this._geometries[E].equalsExact(m._geometries[E],c))return!1;return!0}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.normalize=function(){for(var u=0;u<this._geometries.length;u++)this._geometries[u].normalize();_n.sort(this._geometries)},i.prototype.getCoordinate=function(){return this.isEmpty()?null:this._geometries[0].getCoordinate()},i.prototype.getBoundaryDimension=function(){for(var u=le.FALSE,c=0;c<this._geometries.length;c++)u=Math.max(u,this._geometries[c].getBoundaryDimension());return u},i.prototype.getDimension=function(){for(var u=le.FALSE,c=0;c<this._geometries.length;c++)u=Math.max(u,this._geometries[c].getDimension());return u},i.prototype.getLength=function(){for(var u=0,c=0;c<this._geometries.length;c++)u+=this._geometries[c].getLength();return u},i.prototype.getNumPoints=function(){for(var u=0,c=0;c<this._geometries.length;c++)u+=this._geometries[c].getNumPoints();return u},i.prototype.getNumGeometries=function(){return this._geometries.length},i.prototype.reverse=function(){for(var u=this._geometries.length,c=new Array(u).fill(null),m=0;m<this._geometries.length;m++)c[m]=this._geometries[m].reverse();return this.getFactory().createGeometryCollection(c)},i.prototype.compareToSameClass=function(){if(arguments.length===1){var u=arguments[0],c=new M(_n.asList(this._geometries)),m=new M(_n.asList(u._geometries));return this.compare(c,m)}if(arguments.length===2){for(var E=arguments[0],C=arguments[1],U=E,Z=this.getNumGeometries(),pt=U.getNumGeometries(),gt=0;gt<Z&><pt;){var Rt=this.getGeometryN(gt),Ft=U.getGeometryN(gt),Vt=Rt.compareToSameClass(Ft,C);if(Vt!==0)return Vt;gt++}return gt<Z?1:gt<pt?-1:0}},i.prototype.apply=function(){if(X(arguments[0],J))for(var u=arguments[0],c=0;c<this._geometries.length;c++)this._geometries[c].apply(u);else if(X(arguments[0],Tn)){var m=arguments[0];if(this._geometries.length===0)return null;for(var E=0;E<this._geometries.length&&(this._geometries[E].apply(m),!m.isDone());E++);m.isGeometryChanged()&&this.geometryChanged()}else if(X(arguments[0],In)){var C=arguments[0];C.filter(this);for(var U=0;U<this._geometries.length;U++)this._geometries[U].apply(C)}else if(X(arguments[0],ue)){var Z=arguments[0];Z.filter(this);for(var pt=0;pt<this._geometries.length;pt++)this._geometries[pt].apply(Z)}},i.prototype.getBoundary=function(){return this.checkNotGeometryCollection(this),Lt.shouldNeverReachHere(),null},i.prototype.clone=function(){var u=n.prototype.clone.call(this);u._geometries=new Array(this._geometries.length).fill(null);for(var c=0;c<this._geometries.length;c++)u._geometries[c]=this._geometries[c].clone();return u},i.prototype.getGeometryType=function(){return"GeometryCollection"},i.prototype.copy=function(){for(var u=new Array(this._geometries.length).fill(null),c=0;c<u.length;c++)u[c]=this._geometries[c].copy();return new i(u,this._factory)},i.prototype.isEmpty=function(){for(var u=0;u<this._geometries.length;u++)if(!this._geometries[u].isEmpty())return!1;return!0},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return-5694727726395021e3},Object.defineProperties(i,s),i}(Ct),Hr=function(n){function i(){n.apply(this,arguments)}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.getSortIndex=function(){return Ct.SORTINDEX_MULTILINESTRING},i.prototype.equalsExact=function(){if(arguments.length===2){var u=arguments[0],c=arguments[1];return!!this.isEquivalentClass(u)&&n.prototype.equalsExact.call(this,u,c)}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.getBoundaryDimension=function(){return this.isClosed()?le.FALSE:0},i.prototype.isClosed=function(){if(this.isEmpty())return!1;for(var u=0;u<this._geometries.length;u++)if(!this._geometries[u].isClosed())return!1;return!0},i.prototype.getDimension=function(){return 1},i.prototype.reverse=function(){for(var u=this._geometries.length,c=new Array(u).fill(null),m=0;m<this._geometries.length;m++)c[u-1-m]=this._geometries[m].reverse();return this.getFactory().createMultiLineString(c)},i.prototype.getBoundary=function(){return new yr(this).getBoundary()},i.prototype.getGeometryType=function(){return"MultiLineString"},i.prototype.copy=function(){for(var u=new Array(this._geometries.length).fill(null),c=0;c<u.length;c++)u[c]=this._geometries[c].copy();return new i(u,this._factory)},i.prototype.interfaces_=function(){return[On]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return 8166665132445434e3},Object.defineProperties(i,s),i}(En),yr=function(){if(this._geom=null,this._geomFact=null,this._bnRule=null,this._endpointMap=null,arguments.length===1){var n=arguments[0],i=w.MOD2_BOUNDARY_RULE;this._geom=n,this._geomFact=n.getFactory(),this._bnRule=i}else if(arguments.length===2){var s=arguments[0],u=arguments[1];this._geom=s,this._geomFact=s.getFactory(),this._bnRule=u}};yr.prototype.boundaryMultiLineString=function(n){if(this._geom.isEmpty())return this.getEmptyMultiPoint();var i=this.computeBoundaryCoordinates(n);return i.length===1?this._geomFact.createPoint(i[0]):this._geomFact.createMultiPointFromCoords(i)},yr.prototype.getBoundary=function(){return this._geom instanceof at?this.boundaryLineString(this._geom):this._geom instanceof Hr?this.boundaryMultiLineString(this._geom):this._geom.getBoundary()},yr.prototype.boundaryLineString=function(n){return this._geom.isEmpty()?this.getEmptyMultiPoint():n.isClosed()?this._bnRule.isInBoundary(2)?n.getStartPoint():this._geomFact.createMultiPoint():this._geomFact.createMultiPoint([n.getStartPoint(),n.getEndPoint()])},yr.prototype.getEmptyMultiPoint=function(){return this._geomFact.createMultiPoint()},yr.prototype.computeBoundaryCoordinates=function(n){var i=new O;this._endpointMap=new x;for(var s=0;s<n.getNumGeometries();s++){var u=n.getGeometryN(s);u.getNumPoints()!==0&&(this.addEndpoint(u.getCoordinateN(0)),this.addEndpoint(u.getCoordinateN(u.getNumPoints()-1)))}for(var c=this._endpointMap.entrySet().iterator();c.hasNext();){var m=c.next(),E=m.getValue().count;this._bnRule.isInBoundary(E)&&i.add(m.getKey())}return Q.toCoordinateArray(i)},yr.prototype.addEndpoint=function(n){var i=this._endpointMap.get(n);i===null&&(i=new q,this._endpointMap.put(n,i)),i.count++},yr.prototype.interfaces_=function(){return[]},yr.prototype.getClass=function(){return yr},yr.getBoundary=function(){if(arguments.length===1){var n=arguments[0];return new yr(n).getBoundary()}if(arguments.length===2){var i=arguments[0],s=arguments[1];return new yr(i,s).getBoundary()}};var q=function(){this.count=null};q.prototype.interfaces_=function(){return[]},q.prototype.getClass=function(){return q};var st=function(){},vt={NEWLINE:{configurable:!0},SIMPLE_ORDINATE_FORMAT:{configurable:!0}};st.prototype.interfaces_=function(){return[]},st.prototype.getClass=function(){return st},st.chars=function(n,i){for(var s=new Array(i).fill(null),u=0;u<i;u++)s[u]=n;return String(s)},st.getStackTrace=function(){if(arguments.length===1){var n=arguments[0],i=new function(){},s=new function(){}(i);return n.printStackTrace(s),i.toString()}if(arguments.length===2){for(var u=arguments[0],c=arguments[1],m="",E=new function(){}(new function(){}(st.getStackTrace(u))),C=0;C<c;C++)try{m+=E.readLine()+st.NEWLINE}catch(U){if(!(U instanceof b))throw U;Lt.shouldNeverReachHere()}return m}},st.split=function(n,i){for(var s=i.length,u=new O,c=""+n,m=c.indexOf(i);m>=0;){var E=c.substring(0,m);u.add(E),m=(c=c.substring(m+s)).indexOf(i)}c.length>0&&u.add(c);for(var C=new Array(u.size()).fill(null),U=0;U<C.length;U++)C[U]=u.get(U);return C},st.toString=function(){if(arguments.length===1){var n=arguments[0];return st.SIMPLE_ORDINATE_FORMAT.format(n)}},st.spaces=function(n){return st.chars(" ",n)},vt.NEWLINE.get=function(){return Ut.getProperty("line.separator")},vt.SIMPLE_ORDINATE_FORMAT.get=function(){return new function(){}("0.#")},Object.defineProperties(st,vt);var ht=function(){};ht.prototype.interfaces_=function(){return[]},ht.prototype.getClass=function(){return ht},ht.copyCoord=function(n,i,s,u){for(var c=Math.min(n.getDimension(),s.getDimension()),m=0;m<c;m++)s.setOrdinate(u,m,n.getOrdinate(i,m))},ht.isRing=function(n){var i=n.size();return i===0||!(i<=3)&&n.getOrdinate(0,tt.X)===n.getOrdinate(i-1,tt.X)&&n.getOrdinate(0,tt.Y)===n.getOrdinate(i-1,tt.Y)},ht.isEqual=function(n,i){var s=n.size();if(s!==i.size())return!1;for(var u=Math.min(n.getDimension(),i.getDimension()),c=0;c<s;c++)for(var m=0;m<u;m++){var E=n.getOrdinate(c,m),C=i.getOrdinate(c,m);if(n.getOrdinate(c,m)!==i.getOrdinate(c,m)&&(!S.isNaN(E)||!S.isNaN(C)))return!1}return!0},ht.extend=function(n,i,s){var u=n.create(s,i.getDimension()),c=i.size();if(ht.copy(i,0,u,0,c),c>0)for(var m=c;m<s;m++)ht.copy(i,c-1,u,m,1);return u},ht.reverse=function(n){for(var i=n.size()-1,s=Math.trunc(i/2),u=0;u<=s;u++)ht.swap(n,u,i-u)},ht.swap=function(n,i,s){if(i===s)return null;for(var u=0;u<n.getDimension();u++){var c=n.getOrdinate(i,u);n.setOrdinate(i,u,n.getOrdinate(s,u)),n.setOrdinate(s,u,c)}},ht.copy=function(n,i,s,u,c){for(var m=0;m<c;m++)ht.copyCoord(n,i+m,s,u+m)},ht.toString=function(){if(arguments.length===1){var n=arguments[0],i=n.size();if(i===0)return"()";var s=n.getDimension(),u=new _t;u.append("(");for(var c=0;c<i;c++){c>0&&u.append(" ");for(var m=0;m<s;m++)m>0&&u.append(","),u.append(st.toString(n.getOrdinate(c,m)))}return u.append(")"),u.toString()}},ht.ensureValidRing=function(n,i){var s=i.size();return s===0?i:s<=3?ht.createClosedRing(n,i,4):i.getOrdinate(0,tt.X)===i.getOrdinate(s-1,tt.X)&&i.getOrdinate(0,tt.Y)===i.getOrdinate(s-1,tt.Y)?i:ht.createClosedRing(n,i,s+1)},ht.createClosedRing=function(n,i,s){var u=n.create(s,i.getDimension()),c=i.size();ht.copy(i,0,u,0,c);for(var m=c;m<s;m++)ht.copy(i,0,u,m,1);return u};var at=function(n){function i(u,c){n.call(this,c),this._points=null,this.init(u)}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.computeEnvelopeInternal=function(){return this.isEmpty()?new At:this._points.expandEnvelope(new At)},i.prototype.isRing=function(){return this.isClosed()&&this.isSimple()},i.prototype.getSortIndex=function(){return n.SORTINDEX_LINESTRING},i.prototype.getCoordinates=function(){return this._points.toCoordinateArray()},i.prototype.equalsExact=function(){if(arguments.length===2){var u=arguments[0],c=arguments[1];if(!this.isEquivalentClass(u))return!1;var m=u;if(this._points.size()!==m._points.size())return!1;for(var E=0;E<this._points.size();E++)if(!this.equal(this._points.getCoordinate(E),m._points.getCoordinate(E),c))return!1;return!0}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.normalize=function(){for(var u=0;u<Math.trunc(this._points.size()/2);u++){var c=this._points.size()-1-u;if(!this._points.getCoordinate(u).equals(this._points.getCoordinate(c)))return this._points.getCoordinate(u).compareTo(this._points.getCoordinate(c))>0&&ht.reverse(this._points),null}},i.prototype.getCoordinate=function(){return this.isEmpty()?null:this._points.getCoordinate(0)},i.prototype.getBoundaryDimension=function(){return this.isClosed()?le.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 ot.computeLength(this._points)},i.prototype.getNumPoints=function(){return this._points.size()},i.prototype.reverse=function(){var u=this._points.copy();return ht.reverse(u),this.getFactory().createLineString(u)},i.prototype.compareToSameClass=function(){if(arguments.length===1){for(var u=arguments[0],c=0,m=0;c<this._points.size()&&m<u._points.size();){var E=this._points.getCoordinate(c).compareTo(u._points.getCoordinate(m));if(E!==0)return E;c++,m++}return c<this._points.size()?1:m<u._points.size()?-1:0}if(arguments.length===2){var C=arguments[0];return arguments[1].compare(this._points,C._points)}},i.prototype.apply=function(){if(X(arguments[0],J))for(var u=arguments[0],c=0;c<this._points.size();c++)u.filter(this._points.getCoordinate(c));else if(X(arguments[0],Tn)){var m=arguments[0];if(this._points.size()===0)return null;for(var E=0;E<this._points.size()&&(m.filter(this._points,E),!m.isDone());E++);m.isGeometryChanged()&&this.geometryChanged()}else X(arguments[0],In)?arguments[0].filter(this):X(arguments[0],ue)&&arguments[0].filter(this)},i.prototype.getBoundary=function(){return new yr(this).getBoundary()},i.prototype.isEquivalentClass=function(u){return u instanceof i},i.prototype.clone=function(){var u=n.prototype.clone.call(this);return u._points=this._points.clone(),u},i.prototype.getCoordinateN=function(u){return this._points.getCoordinate(u)},i.prototype.getGeometryType=function(){return"LineString"},i.prototype.copy=function(){return new i(this._points.copy(),this._factory)},i.prototype.getCoordinateSequence=function(){return this._points},i.prototype.isEmpty=function(){return this._points.size()===0},i.prototype.init=function(u){if(u===null&&(u=this.getFactory().getCoordinateSequenceFactory().create([])),u.size()===1)throw new A("Invalid number of points in LineString (found "+u.size()+" - must be 0 or >= 2)");this._points=u},i.prototype.isCoordinate=function(u){for(var c=0;c<this._points.size();c++)if(this._points.getCoordinate(c).equals(u))return!0;return!1},i.prototype.getStartPoint=function(){return this.isEmpty()?null:this.getPointN(0)},i.prototype.getPointN=function(u){return this.getFactory().createPoint(this._points.getCoordinate(u))},i.prototype.interfaces_=function(){return[On]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return 0x2b2b51ba435c8e00},Object.defineProperties(i,s),i}(Ct),Ht=function(){};Ht.prototype.interfaces_=function(){return[]},Ht.prototype.getClass=function(){return Ht};var Xt=function(n){function i(u,c){n.call(this,c),this._coordinates=u||null,this.init(this._coordinates)}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.computeEnvelopeInternal=function(){if(this.isEmpty())return new At;var u=new At;return u.expandToInclude(this._coordinates.getX(0),this._coordinates.getY(0)),u},i.prototype.getSortIndex=function(){return n.SORTINDEX_POINT},i.prototype.getCoordinates=function(){return this.isEmpty()?[]:[this.getCoordinate()]},i.prototype.equalsExact=function(){if(arguments.length===2){var u=arguments[0],c=arguments[1];return!!this.isEquivalentClass(u)&&(!(!this.isEmpty()||!u.isEmpty())||this.isEmpty()===u.isEmpty()&&this.equal(u.getCoordinate(),this.getCoordinate(),c))}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.normalize=function(){},i.prototype.getCoordinate=function(){return this._coordinates.size()!==0?this._coordinates.getCoordinate(0):null},i.prototype.getBoundaryDimension=function(){return le.FALSE},i.prototype.getDimension=function(){return 0},i.prototype.getNumPoints=function(){return this.isEmpty()?0:1},i.prototype.reverse=function(){return this.copy()},i.prototype.getX=function(){if(this.getCoordinate()===null)throw new Error("getX called on empty Point");return this.getCoordinate().x},i.prototype.compareToSameClass=function(){if(arguments.length===1){var u=arguments[0];return this.getCoordinate().compareTo(u.getCoordinate())}if(arguments.length===2){var c=arguments[0];return arguments[1].compare(this._coordinates,c._coordinates)}},i.prototype.apply=function(){if(X(arguments[0],J)){var u=arguments[0];if(this.isEmpty())return null;u.filter(this.getCoordinate())}else if(X(arguments[0],Tn)){var c=arguments[0];if(this.isEmpty())return null;c.filter(this._coordinates,0),c.isGeometryChanged()&&this.geometryChanged()}else X(arguments[0],In)?arguments[0].filter(this):X(arguments[0],ue)&&arguments[0].filter(this)},i.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},i.prototype.clone=function(){var u=n.prototype.clone.call(this);return u._coordinates=this._coordinates.clone(),u},i.prototype.getGeometryType=function(){return"Point"},i.prototype.copy=function(){return new i(this._coordinates.copy(),this._factory)},i.prototype.getCoordinateSequence=function(){return this._coordinates},i.prototype.getY=function(){if(this.getCoordinate()===null)throw new Error("getY called on empty Point");return this.getCoordinate().y},i.prototype.isEmpty=function(){return this._coordinates.size()===0},i.prototype.init=function(u){u===null&&(u=this.getFactory().getCoordinateSequenceFactory().create([])),Lt.isTrue(u.size()<=1),this._coordinates=u},i.prototype.isSimple=function(){return!0},i.prototype.interfaces_=function(){return[Ht]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return 4902022702746615e3},Object.defineProperties(i,s),i}(Ct),re=function(){};re.prototype.interfaces_=function(){return[]},re.prototype.getClass=function(){return re};var Zt=function(n){function i(u,c,m){if(n.call(this,m),this._shell=null,this._holes=null,u===null&&(u=this.getFactory().createLinearRing()),c===null&&(c=[]),n.hasNullElements(c))throw new A("holes must not contain null elements");if(u.isEmpty()&&n.hasNonEmptyElements(c))throw new A("shell is empty but holes are not");this._shell=u,this._holes=c}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.computeEnvelopeInternal=function(){return this._shell.getEnvelopeInternal()},i.prototype.getSortIndex=function(){return n.SORTINDEX_POLYGON},i.prototype.getCoordinates=function(){if(this.isEmpty())return[];for(var u=new Array(this.getNumPoints()).fill(null),c=-1,m=this._shell.getCoordinates(),E=0;E<m.length;E++)u[++c]=m[E];for(var C=0;C<this._holes.length;C++)for(var U=this._holes[C].getCoordinates(),Z=0;Z<U.length;Z++)u[++c]=U[Z];return u},i.prototype.getArea=function(){var u=0;u+=Math.abs(ot.signedArea(this._shell.getCoordinateSequence()));for(var c=0;c<this._holes.length;c++)u-=Math.abs(ot.signedArea(this._holes[c].getCoordinateSequence()));return u},i.prototype.isRectangle=function(){if(this.getNumInteriorRing()!==0||this._shell===null||this._shell.getNumPoints()!==5)return!1;for(var u=this._shell.getCoordinateSequence(),c=this.getEnvelopeInternal(),m=0;m<5;m++){var E=u.getX(m);if(E!==c.getMinX()&&E!==c.getMaxX())return!1;var C=u.getY(m);if(C!==c.getMinY()&&C!==c.getMaxY())return!1}for(var U=u.getX(0),Z=u.getY(0),pt=1;pt<=4;pt++){var gt=u.getX(pt),Rt=u.getY(pt);if(gt!==U==(Rt!==Z))return!1;U=gt,Z=Rt}return!0},i.prototype.equalsExact=function(){if(arguments.length===2){var u=arguments[0],c=arguments[1];if(!this.isEquivalentClass(u))return!1;var m=u,E=this._shell,C=m._shell;if(!E.equalsExact(C,c)||this._holes.length!==m._holes.length)return!1;for(var U=0;U<this._holes.length;U++)if(!this._holes[U].equalsExact(m._holes[U],c))return!1;return!0}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.normalize=function(){if(arguments.length===0){this.normalize(this._shell,!0);for(var u=0;u<this._holes.length;u++)this.normalize(this._holes[u],!1);_n.sort(this._holes)}else if(arguments.length===2){var c=arguments[0],m=arguments[1];if(c.isEmpty())return null;var E=new Array(c.getCoordinates().length-1).fill(null);Ut.arraycopy(c.getCoordinates(),0,E,0,E.length);var C=Q.minCoordinate(c.getCoordinates());Q.scroll(E,C),Ut.arraycopy(E,0,c.getCoordinates(),0,E.length),c.getCoordinates()[E.length]=E[0],ot.isCCW(c.getCoordinates())===m&&Q.reverse(c.getCoordinates())}},i.prototype.getCoordinate=function(){return this._shell.getCoordinate()},i.prototype.getNumInteriorRing=function(){return this._holes.length},i.prototype.getBoundaryDimension=function(){return 1},i.prototype.getDimension=function(){return 2},i.prototype.getLength=function(){var u=0;u+=this._shell.getLength();for(var c=0;c<this._holes.length;c++)u+=this._holes[c].getLength();return u},i.prototype.getNumPoints=function(){for(var u=this._shell.getNumPoints(),c=0;c<this._holes.length;c++)u+=this._holes[c].getNumPoints();return u},i.prototype.reverse=function(){var u=this.copy();u._shell=this._shell.copy().reverse(),u._holes=new Array(this._holes.length).fill(null);for(var c=0;c<this._holes.length;c++)u._holes[c]=this._holes[c].copy().reverse();return u},i.prototype.convexHull=function(){return this.getExteriorRing().convexHull()},i.prototype.compareToSameClass=function(){if(arguments.length===1){var u=arguments[0],c=this._shell,m=u._shell;return c.compareToSameClass(m)}if(arguments.length===2){var E=arguments[0],C=arguments[1],U=E,Z=this._shell,pt=U._shell,gt=Z.compareToSameClass(pt,C);if(gt!==0)return gt;for(var Rt=this.getNumInteriorRing(),Ft=U.getNumInteriorRing(),Vt=0;Vt<Rt&&Vt<Ft;){var ee=this.getInteriorRingN(Vt),hn=U.getInteriorRingN(Vt),qn=ee.compareToSameClass(hn,C);if(qn!==0)return qn;Vt++}return Vt<Rt?1:Vt<Ft?-1:0}},i.prototype.apply=function(u){if(X(u,J)){this._shell.apply(u);for(var c=0;c<this._holes.length;c++)this._holes[c].apply(u)}else if(X(u,Tn)){if(this._shell.apply(u),!u.isDone())for(var m=0;m<this._holes.length&&(this._holes[m].apply(u),!u.isDone());m++);u.isGeometryChanged()&&this.geometryChanged()}else if(X(u,In))u.filter(this);else if(X(u,ue)){u.filter(this),this._shell.apply(u);for(var E=0;E<this._holes.length;E++)this._holes[E].apply(u)}},i.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();var u=new Array(this._holes.length+1).fill(null);u[0]=this._shell;for(var c=0;c<this._holes.length;c++)u[c+1]=this._holes[c];return u.length<=1?this.getFactory().createLinearRing(u[0].getCoordinateSequence()):this.getFactory().createMultiLineString(u)},i.prototype.clone=function(){var u=n.prototype.clone.call(this);u._shell=this._shell.clone(),u._holes=new Array(this._holes.length).fill(null);for(var c=0;c<this._holes.length;c++)u._holes[c]=this._holes[c].clone();return u},i.prototype.getGeometryType=function(){return"Polygon"},i.prototype.copy=function(){for(var u=this._shell.copy(),c=new Array(this._holes.length).fill(null),m=0;m<c.length;m++)c[m]=this._holes[m].copy();return new i(u,c,this._factory)},i.prototype.getExteriorRing=function(){return this._shell},i.prototype.isEmpty=function(){return this._shell.isEmpty()},i.prototype.getInteriorRingN=function(u){return this._holes[u]},i.prototype.interfaces_=function(){return[re]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return-0x307ffefd8dc97200},Object.defineProperties(i,s),i}(Ct),me=function(n){function i(){n.apply(this,arguments)}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.getSortIndex=function(){return Ct.SORTINDEX_MULTIPOINT},i.prototype.isValid=function(){return!0},i.prototype.equalsExact=function(){if(arguments.length===2){var u=arguments[0],c=arguments[1];return!!this.isEquivalentClass(u)&&n.prototype.equalsExact.call(this,u,c)}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.getCoordinate=function(){if(arguments.length===1){var u=arguments[0];return this._geometries[u].getCoordinate()}return n.prototype.getCoordinate.apply(this,arguments)},i.prototype.getBoundaryDimension=function(){return le.FALSE},i.prototype.getDimension=function(){return 0},i.prototype.getBoundary=function(){return this.getFactory().createGeometryCollection(null)},i.prototype.getGeometryType=function(){return"MultiPoint"},i.prototype.copy=function(){for(var u=new Array(this._geometries.length).fill(null),c=0;c<u.length;c++)u[c]=this._geometries[c].copy();return new i(u,this._factory)},i.prototype.interfaces_=function(){return[Ht]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return-8048474874175356e3},Object.defineProperties(i,s),i}(En),oe=function(n){function i(u,c){u instanceof I&&c instanceof pe&&(u=c.getCoordinateSequenceFactory().create(u)),n.call(this,u,c),this.validateConstruction()}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={MINIMUM_VALID_SIZE:{configurable:!0},serialVersionUID:{configurable:!0}};return i.prototype.getSortIndex=function(){return Ct.SORTINDEX_LINEARRING},i.prototype.getBoundaryDimension=function(){return le.FALSE},i.prototype.isClosed=function(){return!!this.isEmpty()||n.prototype.isClosed.call(this)},i.prototype.reverse=function(){var u=this._points.copy();return ht.reverse(u),this.getFactory().createLinearRing(u)},i.prototype.validateConstruction=function(){if(!this.isEmpty()&&!n.prototype.isClosed.call(this))throw new A("Points of LinearRing do not form a closed linestring");if(this.getCoordinateSequence().size()>=1&&this.getCoordinateSequence().size()<i.MINIMUM_VALID_SIZE)throw new A("Invalid number of points in LinearRing (found "+this.getCoordinateSequence().size()+" - must be 0 or >= 4)")},i.prototype.getGeometryType=function(){return"LinearRing"},i.prototype.copy=function(){return new i(this._points.copy(),this._factory)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},s.MINIMUM_VALID_SIZE.get=function(){return 4},s.serialVersionUID.get=function(){return-0x3b229e262367a600},Object.defineProperties(i,s),i}(at),ae=function(n){function i(){n.apply(this,arguments)}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={serialVersionUID:{configurable:!0}};return i.prototype.getSortIndex=function(){return Ct.SORTINDEX_MULTIPOLYGON},i.prototype.equalsExact=function(){if(arguments.length===2){var u=arguments[0],c=arguments[1];return!!this.isEquivalentClass(u)&&n.prototype.equalsExact.call(this,u,c)}return n.prototype.equalsExact.apply(this,arguments)},i.prototype.getBoundaryDimension=function(){return 1},i.prototype.getDimension=function(){return 2},i.prototype.reverse=function(){for(var u=this._geometries.length,c=new Array(u).fill(null),m=0;m<this._geometries.length;m++)c[m]=this._geometries[m].reverse();return this.getFactory().createMultiPolygon(c)},i.prototype.getBoundary=function(){if(this.isEmpty())return this.getFactory().createMultiLineString();for(var u=new O,c=0;c<this._geometries.length;c++)for(var m=this._geometries[c].getBoundary(),E=0;E<m.getNumGeometries();E++)u.add(m.getGeometryN(E));var C=new Array(u.size()).fill(null);return this.getFactory().createMultiLineString(u.toArray(C))},i.prototype.getGeometryType=function(){return"MultiPolygon"},i.prototype.copy=function(){for(var u=new Array(this._geometries.length).fill(null),c=0;c<u.length;c++)u[c]=this._geometries[c].copy();return new i(u,this._factory)},i.prototype.interfaces_=function(){return[re]},i.prototype.getClass=function(){return i},s.serialVersionUID.get=function(){return-0x7a5aa1369171980},Object.defineProperties(i,s),i}(En),un=function(n){this._factory=n||null,this._isUserDataCopied=!1},vr={NoOpGeometryOperation:{configurable:!0},CoordinateOperation:{configurable:!0},CoordinateSequenceOperation:{configurable:!0}};un.prototype.setCopyUserData=function(n){this._isUserDataCopied=n},un.prototype.edit=function(n,i){if(n===null)return null;var s=this.editInternal(n,i);return this._isUserDataCopied&&s.setUserData(n.getUserData()),s},un.prototype.editInternal=function(n,i){return this._factory===null&&(this._factory=n.getFactory()),n instanceof En?this.editGeometryCollection(n,i):n instanceof Zt?this.editPolygon(n,i):n instanceof Xt?i.edit(n,this._factory):n instanceof at?i.edit(n,this._factory):(Lt.shouldNeverReachHere("Unsupported Geometry class: "+n.getClass().getName()),null)},un.prototype.editGeometryCollection=function(n,i){for(var s=i.edit(n,this._factory),u=new O,c=0;c<s.getNumGeometries();c++){var m=this.edit(s.getGeometryN(c),i);m===null||m.isEmpty()||u.add(m)}return s.getClass()===me?this._factory.createMultiPoint(u.toArray([])):s.getClass()===Hr?this._factory.createMultiLineString(u.toArray([])):s.getClass()===ae?this._factory.createMultiPolygon(u.toArray([])):this._factory.createGeometryCollection(u.toArray([]))},un.prototype.editPolygon=function(n,i){var s=i.edit(n,this._factory);if(s===null&&(s=this._factory.createPolygon(null)),s.isEmpty())return s;var u=this.edit(s.getExteriorRing(),i);if(u===null||u.isEmpty())return this._factory.createPolygon();for(var c=new O,m=0;m<s.getNumInteriorRing();m++){var E=this.edit(s.getInteriorRingN(m),i);E===null||E.isEmpty()||c.add(E)}return this._factory.createPolygon(u,c.toArray([]))},un.prototype.interfaces_=function(){return[]},un.prototype.getClass=function(){return un},un.GeometryEditorOperation=function(){},vr.NoOpGeometryOperation.get=function(){return Bn},vr.CoordinateOperation.get=function(){return ti},vr.CoordinateSequenceOperation.get=function(){return Mn},Object.defineProperties(un,vr);var Bn=function(){};Bn.prototype.edit=function(n,i){return n},Bn.prototype.interfaces_=function(){return[un.GeometryEditorOperation]},Bn.prototype.getClass=function(){return Bn};var ti=function(){};ti.prototype.edit=function(n,i){var s=this.editCoordinates(n.getCoordinates(),n);return s===null?n:n instanceof oe?i.createLinearRing(s):n instanceof at?i.createLineString(s):n instanceof Xt?s.length>0?i.createPoint(s[0]):i.createPoint():n},ti.prototype.interfaces_=function(){return[un.GeometryEditorOperation]},ti.prototype.getClass=function(){return ti};var Mn=function(){};Mn.prototype.edit=function(n,i){return n instanceof oe?i.createLinearRing(this.edit(n.getCoordinateSequence(),n)):n instanceof at?i.createLineString(this.edit(n.getCoordinateSequence(),n)):n instanceof Xt?i.createPoint(this.edit(n.getCoordinateSequence(),n)):n},Mn.prototype.interfaces_=function(){return[un.GeometryEditorOperation]},Mn.prototype.getClass=function(){return Mn};var jt=function(){if(this._dimension=3,this._coordinates=null,arguments.length===1){if(arguments[0]instanceof Array)this._coordinates=arguments[0],this._dimension=3;else if(Number.isInteger(arguments[0])){var n=arguments[0];this._coordinates=new Array(n).fill(null);for(var i=0;i<n;i++)this._coordinates[i]=new I}else if(X(arguments[0],tt)){var s=arguments[0];if(s===null)return this._coordinates=new Array(0).fill(null),null;this._dimension=s.getDimension(),this._coordinates=new Array(s.size()).fill(null);for(var u=0;u<this._coordinates.length;u++)this._coordinates[u]=s.getCoordinateCopy(u)}}else if(arguments.length===2){if(arguments[0]instanceof Array&&Number.isInteger(arguments[1])){var c=arguments[0],m=arguments[1];this._coordinates=c,this._dimension=m,c===null&&(this._coordinates=new Array(0).fill(null))}else if(Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var E=arguments[0],C=arguments[1];this._coordinates=new Array(E).fill(null),this._dimension=C;for(var U=0;U<E;U++)this._coordinates[U]=new I}}},Na={serialVersionUID:{configurable:!0}};jt.prototype.setOrdinate=function(n,i,s){switch(i){case tt.X:this._coordinates[n].x=s;break;case tt.Y:this._coordinates[n].y=s;break;case tt.Z:this._coordinates[n].z=s;break;default:throw new A("invalid ordinateIndex")}},jt.prototype.size=function(){return this._coordinates.length},jt.prototype.getOrdinate=function(n,i){switch(i){case tt.X:return this._coordinates[n].x;case tt.Y:return this._coordinates[n].y;case tt.Z:return this._coordinates[n].z}return S.NaN},jt.prototype.getCoordinate=function(){if(arguments.length===1){var n=arguments[0];return this._coordinates[n]}if(arguments.length===2){var i=arguments[0],s=arguments[1];s.x=this._coordinates[i].x,s.y=this._coordinates[i].y,s.z=this._coordinates[i].z}},jt.prototype.getCoordinateCopy=function(n){return new I(this._coordinates[n])},jt.prototype.getDimension=function(){return this._dimension},jt.prototype.getX=function(n){return this._coordinates[n].x},jt.prototype.clone=function(){for(var n=new Array(this.size()).fill(null),i=0;i<this._coordinates.length;i++)n[i]=this._coordinates[i].clone();return new jt(n,this._dimension)},jt.prototype.expandEnvelope=function(n){for(var i=0;i<this._coordinates.length;i++)n.expandToInclude(this._coordinates[i]);return n},jt.prototype.copy=function(){for(var n=new Array(this.size()).fill(null),i=0;i<this._coordinates.length;i++)n[i]=this._coordinates[i].copy();return new jt(n,this._dimension)},jt.prototype.toString=function(){if(this._coordinates.length>0){var n=new _t(17*this._coordinates.length);n.append("("),n.append(this._coordinates[0]);for(var i=1;i<this._coordinates.length;i++)n.append(", "),n.append(this._coordinates[i]);return n.append(")"),n.toString()}return"()"},jt.prototype.getY=function(n){return this._coordinates[n].y},jt.prototype.toCoordinateArray=function(){return this._coordinates},jt.prototype.interfaces_=function(){return[tt,t]},jt.prototype.getClass=function(){return jt},Na.serialVersionUID.get=function(){return-0xcb44a778db18e00},Object.defineProperties(jt,Na);var ln=function(){},Xi={serialVersionUID:{configurable:!0},instanceObject:{configurable:!0}};ln.prototype.readResolve=function(){return ln.instance()},ln.prototype.create=function(){if(arguments.length===1){if(arguments[0]instanceof Array){var n=arguments[0];return new jt(n)}if(X(arguments[0],tt)){var i=arguments[0];return new jt(i)}}else if(arguments.length===2){var s=arguments[0],u=arguments[1];return u>3&&(u=3),u<2?new jt(s):new jt(s,u)}},ln.prototype.interfaces_=function(){return[W,t]},ln.prototype.getClass=function(){return ln},ln.instance=function(){return ln.instanceObject},Xi.serialVersionUID.get=function(){return-0x38e49fa6cf6f2e00},Xi.instanceObject.get=function(){return new ln},Object.defineProperties(ln,Xi);var Qu=function(n){function i(){n.call(this),this.map_=new Map}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.get=function(s){return this.map_.get(s)||null},i.prototype.put=function(s,u){return this.map_.set(s,u),u},i.prototype.values=function(){for(var s=new O,u=this.map_.values(),c=u.next();!c.done;)s.add(c.value),c=u.next();return s},i.prototype.entrySet=function(){var s=new de;return this.map_.entries().forEach(function(u){return s.add(u)}),s},i.prototype.size=function(){return this.map_.size()},i}(Kt),ge=function n(){if(this._modelType=null,this._scale=null,arguments.length===0)this._modelType=n.FLOATING;else if(arguments.length===1){if(arguments[0]instanceof Sn){var i=arguments[0];this._modelType=i,i===n.FIXED&&this.setScale(1)}else if(typeof arguments[0]=="number"){var s=arguments[0];this._modelType=n.FIXED,this.setScale(s)}else if(arguments[0]instanceof n){var u=arguments[0];this._modelType=u._modelType,this._scale=u._scale}}},Ys={serialVersionUID:{configurable:!0},maximumPreciseValue:{configurable:!0}};ge.prototype.equals=function(n){if(!(n instanceof ge))return!1;var i=n;return this._modelType===i._modelType&&this._scale===i._scale},ge.prototype.compareTo=function(n){var i=n,s=this.getMaximumSignificantDigits(),u=i.getMaximumSignificantDigits();return new it(s).compareTo(new it(u))},ge.prototype.getScale=function(){return this._scale},ge.prototype.isFloating=function(){return this._modelType===ge.FLOATING||this._modelType===ge.FLOATING_SINGLE},ge.prototype.getType=function(){return this._modelType},ge.prototype.toString=function(){var n="UNKNOWN";return this._modelType===ge.FLOATING?n="Floating":this._modelType===ge.FLOATING_SINGLE?n="Floating-Single":this._modelType===ge.FIXED&&(n="Fixed (Scale="+this.getScale()+")"),n},ge.prototype.makePrecise=function(){if(typeof arguments[0]=="number"){var n=arguments[0];return S.isNaN(n)||this._modelType===ge.FLOATING_SINGLE?n:this._modelType===ge.FIXED?Math.round(n*this._scale)/this._scale:n}if(arguments[0]instanceof I){var i=arguments[0];if(this._modelType===ge.FLOATING)return null;i.x=this.makePrecise(i.x),i.y=this.makePrecise(i.y)}},ge.prototype.getMaximumSignificantDigits=function(){var n=16;return this._modelType===ge.FLOATING?n=16:this._modelType===ge.FLOATING_SINGLE?n=6:this._modelType===ge.FIXED&&(n=1+Math.trunc(Math.ceil(Math.log(this.getScale())/Math.log(10)))),n},ge.prototype.setScale=function(n){this._scale=Math.abs(n)},ge.prototype.interfaces_=function(){return[t,G]},ge.prototype.getClass=function(){return ge},ge.mostPrecise=function(n,i){return n.compareTo(i)>=0?n:i},Ys.serialVersionUID.get=function(){return 7777263578777804e3},Ys.maximumPreciseValue.get=function(){return 9007199254740992},Object.defineProperties(ge,Ys);var Sn=function n(i){this._name=i||null,n.nameToTypeMap.put(i,this)},Yi={serialVersionUID:{configurable:!0},nameToTypeMap:{configurable:!0}};Sn.prototype.readResolve=function(){return Sn.nameToTypeMap.get(this._name)},Sn.prototype.toString=function(){return this._name},Sn.prototype.interfaces_=function(){return[t]},Sn.prototype.getClass=function(){return Sn},Yi.serialVersionUID.get=function(){return-552860263173159e4},Yi.nameToTypeMap.get=function(){return new Qu},Object.defineProperties(Sn,Yi),ge.Type=Sn,ge.FIXED=new Sn("FIXED"),ge.FLOATING=new Sn("FLOATING"),ge.FLOATING_SINGLE=new Sn("FLOATING SINGLE");var pe=function n(){this._precisionModel=new ge,this._SRID=0,this._coordinateSequenceFactory=n.getDefaultCoordinateSequenceFactory(),arguments.length===0||(arguments.length===1?X(arguments[0],W)?this._coordinateSequenceFactory=arguments[0]:arguments[0]instanceof ge&&(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]))},ei={serialVersionUID:{configurable:!0}};pe.prototype.toGeometry=function(n){return n.isNull()?this.createPoint(null):n.getMinX()===n.getMaxX()&&n.getMinY()===n.getMaxY()?this.createPoint(new I(n.getMinX(),n.getMinY())):n.getMinX()===n.getMaxX()||n.getMinY()===n.getMaxY()?this.createLineString([new I(n.getMinX(),n.getMinY()),new I(n.getMaxX(),n.getMaxY())]):this.createPolygon(this.createLinearRing([new I(n.getMinX(),n.getMinY()),new I(n.getMinX(),n.getMaxY()),new I(n.getMaxX(),n.getMaxY()),new I(n.getMaxX(),n.getMinY()),new I(n.getMinX(),n.getMinY())]),null)},pe.prototype.createLineString=function(n){return n?n instanceof Array?new at(this.getCoordinateSequenceFactory().create(n),this):X(n,tt)?new at(n,this):void 0:new at(this.getCoordinateSequenceFactory().create([]),this)},pe.prototype.createMultiLineString=function(){if(arguments.length===0)return new Hr(null,this);if(arguments.length===1){var n=arguments[0];return new Hr(n,this)}},pe.prototype.buildGeometry=function(n){for(var i=null,s=!1,u=!1,c=n.iterator();c.hasNext();){var m=c.next(),E=m.getClass();i===null&&(i=E),E!==i&&(s=!0),m.isGeometryCollectionOrDerived()&&(u=!0)}if(i===null)return this.createGeometryCollection();if(s||u)return this.createGeometryCollection(pe.toGeometryArray(n));var C=n.iterator().next();if(n.size()>1){if(C instanceof Zt)return this.createMultiPolygon(pe.toPolygonArray(n));if(C instanceof at)return this.createMultiLineString(pe.toLineStringArray(n));if(C instanceof Xt)return this.createMultiPoint(pe.toPointArray(n));Lt.shouldNeverReachHere("Unhandled class: "+C.getClass().getName())}return C},pe.prototype.createMultiPointFromCoords=function(n){return this.createMultiPoint(n!==null?this.getCoordinateSequenceFactory().create(n):null)},pe.prototype.createPoint=function(){if(arguments.length===0)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof I){var n=arguments[0];return this.createPoint(n!==null?this.getCoordinateSequenceFactory().create([n]):null)}if(X(arguments[0],tt)){var i=arguments[0];return new Xt(i,this)}}},pe.prototype.getCoordinateSequenceFactory=function(){return this._coordinateSequenceFactory},pe.prototype.createPolygon=function(){if(arguments.length===0)return new Zt(null,null,this);if(arguments.length===1){if(X(arguments[0],tt)){var n=arguments[0];return this.createPolygon(this.createLinearRing(n))}if(arguments[0]instanceof Array){var i=arguments[0];return this.createPolygon(this.createLinearRing(i))}if(arguments[0]instanceof oe){var s=arguments[0];return this.createPolygon(s,null)}}else if(arguments.length===2){var u=arguments[0],c=arguments[1];return new Zt(u,c,this)}},pe.prototype.getSRID=function(){return this._SRID},pe.prototype.createGeometryCollection=function(){if(arguments.length===0)return new En(null,this);if(arguments.length===1){var n=arguments[0];return new En(n,this)}},pe.prototype.createGeometry=function(n){return new un(this).edit(n,{edit:function(){if(arguments.length===2){var i=arguments[0];return this._coordinateSequenceFactory.create(i)}}})},pe.prototype.getPrecisionModel=function(){return this._precisionModel},pe.prototype.createLinearRing=function(){if(arguments.length===0)return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Array){var n=arguments[0];return this.createLinearRing(n!==null?this.getCoordinateSequenceFactory().create(n):null)}if(X(arguments[0],tt)){var i=arguments[0];return new oe(i,this)}}},pe.prototype.createMultiPolygon=function(){if(arguments.length===0)return new ae(null,this);if(arguments.length===1){var n=arguments[0];return new ae(n,this)}},pe.prototype.createMultiPoint=function(){if(arguments.length===0)return new me(null,this);if(arguments.length===1){if(arguments[0]instanceof Array){var n=arguments[0];return new me(n,this)}if(arguments[0]instanceof Array){var i=arguments[0];return this.createMultiPoint(i!==null?this.getCoordinateSequenceFactory().create(i):null)}if(X(arguments[0],tt)){var s=arguments[0];if(s===null)return this.createMultiPoint(new Array(0).fill(null));for(var u=new Array(s.size()).fill(null),c=0;c<s.size();c++){var m=this.getCoordinateSequenceFactory().create(1,s.getDimension());ht.copy(s,c,m,0,1),u[c]=this.createPoint(m)}return this.createMultiPoint(u)}}},pe.prototype.interfaces_=function(){return[t]},pe.prototype.getClass=function(){return pe},pe.toMultiPolygonArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},pe.toGeometryArray=function(n){if(n===null)return null;var i=new Array(n.size()).fill(null);return n.toArray(i)},pe.getDefaultCoordinateSequenceFactory=function(){return ln.instance()},pe.toMultiLineStringArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},pe.toLineStringArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},pe.toMultiPointArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},pe.toLinearRingArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},pe.toPointArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},pe.toPolygonArray=function(n){var i=new Array(n.size()).fill(null);return n.toArray(i)},pe.createPointFromInternalCoord=function(n,i){return i.getPrecisionModel().makePrecise(n),i.getFactory().createPoint(n)},ei.serialVersionUID.get=function(){return-6820524753094096e3},Object.defineProperties(pe,ei);var tl=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],Oa=function(n){this.geometryFactory=n||new pe};Oa.prototype.read=function(n){var i,s=(i=typeof n=="string"?JSON.parse(n):n).type;if(!ni[s])throw new Error("Unknown GeoJSON type: "+i.type);return tl.indexOf(s)!==-1?ni[s].apply(this,[i.coordinates]):s==="GeometryCollection"?ni[s].apply(this,[i.geometries]):ni[s].apply(this,[i])},Oa.prototype.write=function(n){var i=n.getGeometryType();if(!_o[i])throw new Error("Geometry is not supported");return _o[i].apply(this,[n])};var ni={Feature:function(n){var i={};for(var s in n)i[s]=n[s];if(n.geometry){var u=n.geometry.type;if(!ni[u])throw new Error("Unknown GeoJSON type: "+n.type);i.geometry=this.read(n.geometry)}return n.bbox&&(i.bbox=ni.bbox.apply(this,[n.bbox])),i},FeatureCollection:function(n){var i={};if(n.features){i.features=[];for(var s=0;s<n.features.length;++s)i.features.push(this.read(n.features[s]))}return n.bbox&&(i.bbox=this.parse.bbox.apply(this,[n.bbox])),i},coordinates:function(n){for(var i=[],s=0;s<n.length;++s){var u=n[s];i.push(new I(u[0],u[1]))}return i},bbox:function(n){return this.geometryFactory.createLinearRing([new I(n[0],n[1]),new I(n[2],n[1]),new I(n[2],n[3]),new I(n[0],n[3]),new I(n[0],n[1])])},Point:function(n){var i=new I(n[0],n[1]);return this.geometryFactory.createPoint(i)},MultiPoint:function(n){for(var i=[],s=0;s<n.length;++s)i.push(ni.Point.apply(this,[n[s]]));return this.geometryFactory.createMultiPoint(i)},LineString:function(n){var i=ni.coordinates.apply(this,[n]);return this.geometryFactory.createLineString(i)},MultiLineString:function(n){for(var i=[],s=0;s<n.length;++s)i.push(ni.LineString.apply(this,[n[s]]));return this.geometryFactory.createMultiLineString(i)},Polygon:function(n){for(var i=ni.coordinates.apply(this,[n[0]]),s=this.geometryFactory.createLinearRing(i),u=[],c=1;c<n.length;++c){var m=n[c],E=ni.coordinates.apply(this,[m]),C=this.geometryFactory.createLinearRing(E);u.push(C)}return this.geometryFactory.createPolygon(s,u)},MultiPolygon:function(n){for(var i=[],s=0;s<n.length;++s){var u=n[s];i.push(ni.Polygon.apply(this,[u]))}return this.geometryFactory.createMultiPolygon(i)},GeometryCollection:function(n){for(var i=[],s=0;s<n.length;++s){var u=n[s];i.push(this.read(u))}return this.geometryFactory.createGeometryCollection(i)}},_o={coordinate:function(n){return[n.x,n.y]},Point:function(n){return{type:"Point",coordinates:_o.coordinate.apply(this,[n.getCoordinate()])}},MultiPoint:function(n){for(var i=[],s=0;s<n._geometries.length;++s){var u=n._geometries[s],c=_o.Point.apply(this,[u]);i.push(c.coordinates)}return{type:"MultiPoint",coordinates:i}},LineString:function(n){for(var i=[],s=n.getCoordinates(),u=0;u<s.length;++u){var c=s[u];i.push(_o.coordinate.apply(this,[c]))}return{type:"LineString",coordinates:i}},MultiLineString:function(n){for(var i=[],s=0;s<n._geometries.length;++s){var u=n._geometries[s],c=_o.LineString.apply(this,[u]);i.push(c.coordinates)}return{type:"MultiLineString",coordinates:i}},Polygon:function(n){var i=[],s=_o.LineString.apply(this,[n._shell]);i.push(s.coordinates);for(var u=0;u<n._holes.length;++u){var c=n._holes[u],m=_o.LineString.apply(this,[c]);i.push(m.coordinates)}return{type:"Polygon",coordinates:i}},MultiPolygon:function(n){for(var i=[],s=0;s<n._geometries.length;++s){var u=n._geometries[s],c=_o.Polygon.apply(this,[u]);i.push(c.coordinates)}return{type:"MultiPolygon",coordinates:i}},GeometryCollection:function(n){for(var i=[],s=0;s<n._geometries.length;++s){var u=n._geometries[s],c=u.getGeometryType();i.push(_o[c].apply(this,[u]))}return{type:"GeometryCollection",geometries:i}}},np=function(n){this.geometryFactory=n||new pe,this.precisionModel=this.geometryFactory.getPrecisionModel(),this.parser=new Oa(this.geometryFactory)};np.prototype.read=function(n){var i=this.parser.read(n);return this.precisionModel.getType()===ge.FIXED&&this.reducePrecision(i),i},np.prototype.reducePrecision=function(n){var i,s;if(n.coordinate)this.precisionModel.makePrecise(n.coordinate);else if(n.points)for(i=0,s=n.points.length;i<s;i++)this.precisionModel.makePrecise(n.points[i]);else if(n.geometries)for(i=0,s=n.geometries.length;i<s;i++)this.reducePrecision(n.geometries[i])};var ey=function(){this.parser=new Oa(this.geometryFactory)};ey.prototype.write=function(n){return this.parser.write(n)};var It=function(){},cc={ON:{configurable:!0},LEFT:{configurable:!0},RIGHT:{configurable:!0}};It.prototype.interfaces_=function(){return[]},It.prototype.getClass=function(){return It},It.opposite=function(n){return n===It.LEFT?It.RIGHT:n===It.RIGHT?It.LEFT:n},cc.ON.get=function(){return 0},cc.LEFT.get=function(){return 1},cc.RIGHT.get=function(){return 2},Object.defineProperties(It,cc),(T.prototype=new Error).name="EmptyStackException",(_.prototype=new ct).add=function(n){return this.array_.push(n),!0},_.prototype.get=function(n){if(n<0||n>=this.size())throw new Error;return this.array_[n]},_.prototype.push=function(n){return this.array_.push(n),n},_.prototype.pop=function(n){if(this.array_.length===0)throw new T;return this.array_.pop()},_.prototype.peek=function(){if(this.array_.length===0)throw new T;return this.array_[this.array_.length-1]},_.prototype.empty=function(){return this.array_.length===0},_.prototype.isEmpty=function(){return this.empty()},_.prototype.search=function(n){return this.array_.indexOf(n)},_.prototype.size=function(){return this.array_.length},_.prototype.toArray=function(){for(var n=[],i=0,s=this.array_.length;i<s;i++)n.push(this.array_[i]);return n};var Di=function(){this._minIndex=-1,this._minCoord=null,this._minDe=null,this._orientedDe=null};Di.prototype.getCoordinate=function(){return this._minCoord},Di.prototype.getRightmostSide=function(n,i){var s=this.getRightmostSideOfSegment(n,i);return s<0&&(s=this.getRightmostSideOfSegment(n,i-1)),s<0&&(this._minCoord=null,this.checkForRightmostCoordinate(n)),s},Di.prototype.findRightmostEdgeAtVertex=function(){var n=this._minDe.getEdge().getCoordinates();Lt.isTrue(this._minIndex>0&&this._minIndex<n.length,"rightmost point expected to be interior vertex of edge");var i=n[this._minIndex-1],s=n[this._minIndex+1],u=ot.computeOrientation(this._minCoord,s,i),c=!1;(i.y<this._minCoord.y&&s.y<this._minCoord.y&&u===ot.COUNTERCLOCKWISE||i.y>this._minCoord.y&&s.y>this._minCoord.y&&u===ot.CLOCKWISE)&&(c=!0),c&&(this._minIndex=this._minIndex-1)},Di.prototype.getRightmostSideOfSegment=function(n,i){var s=n.getEdge().getCoordinates();if(i<0||i+1>=s.length||s[i].y===s[i+1].y)return-1;var u=It.LEFT;return s[i].y<s[i+1].y&&(u=It.RIGHT),u},Di.prototype.getEdge=function(){return this._orientedDe},Di.prototype.checkForRightmostCoordinate=function(n){for(var i=n.getEdge().getCoordinates(),s=0;s<i.length-1;s++)(this._minCoord===null||i[s].x>this._minCoord.x)&&(this._minDe=n,this._minIndex=s,this._minCoord=i[s])},Di.prototype.findRightmostEdgeAtNode=function(){var n=this._minDe.getNode().getEdges();this._minDe=n.getRightmostEdge(),this._minDe.isForward()||(this._minDe=this._minDe.getSym(),this._minIndex=this._minDe.getEdge().getCoordinates().length-1)},Di.prototype.findEdge=function(n){for(var i=n.iterator();i.hasNext();){var s=i.next();s.isForward()&&this.checkForRightmostCoordinate(s)}Lt.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)===It.LEFT&&(this._orientedDe=this._minDe.getSym())},Di.prototype.interfaces_=function(){return[]},Di.prototype.getClass=function(){return Di};var xo=function(n){function i(s,u){n.call(this,i.msgWithCoord(s,u)),this.pt=u?new I(u):null,this.name="TopologyException"}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.getCoordinate=function(){return this.pt},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i.msgWithCoord=function(s,u){return u?s:s+" [ "+u+" ]"},i}(ie),fc=function(){this.array_=[]};fc.prototype.addLast=function(n){this.array_.push(n)},fc.prototype.removeFirst=function(){return this.array_.shift()},fc.prototype.isEmpty=function(){return this.array_.length===0};var _r=function(){this._finder=null,this._dirEdgeList=new O,this._nodes=new O,this._rightMostCoord=null,this._env=null,this._finder=new Di};_r.prototype.clearVisitedEdges=function(){for(var n=this._dirEdgeList.iterator();n.hasNext();)n.next().setVisited(!1)},_r.prototype.getRightmostCoordinate=function(){return this._rightMostCoord},_r.prototype.computeNodeDepth=function(n){for(var i=null,s=n.getEdges().iterator();s.hasNext();){var u=s.next();if(u.isVisited()||u.getSym().isVisited()){i=u;break}}if(i===null)throw new xo("unable to find edge to compute depths at "+n.getCoordinate());n.getEdges().computeDepths(i);for(var c=n.getEdges().iterator();c.hasNext();){var m=c.next();m.setVisited(!0),this.copySymDepths(m)}},_r.prototype.computeDepth=function(n){this.clearVisitedEdges();var i=this._finder.getEdge();i.setEdgeDepths(It.RIGHT,n),this.copySymDepths(i),this.computeDepths(i)},_r.prototype.create=function(n){this.addReachable(n),this._finder.findEdge(this._dirEdgeList),this._rightMostCoord=this._finder.getCoordinate()},_r.prototype.findResultEdges=function(){for(var n=this._dirEdgeList.iterator();n.hasNext();){var i=n.next();i.getDepth(It.RIGHT)>=1&&i.getDepth(It.LEFT)<=0&&!i.isInteriorAreaEdge()&&i.setInResult(!0)}},_r.prototype.computeDepths=function(n){var i=new de,s=new fc,u=n.getNode();for(s.addLast(u),i.add(u),n.setVisited(!0);!s.isEmpty();){var c=s.removeFirst();i.add(c),this.computeNodeDepth(c);for(var m=c.getEdges().iterator();m.hasNext();){var E=m.next().getSym();if(!E.isVisited()){var C=E.getNode();i.contains(C)||(s.addLast(C),i.add(C))}}}},_r.prototype.compareTo=function(n){var i=n;return this._rightMostCoord.x<i._rightMostCoord.x?-1:this._rightMostCoord.x>i._rightMostCoord.x?1:0},_r.prototype.getEnvelope=function(){if(this._env===null){for(var n=new At,i=this._dirEdgeList.iterator();i.hasNext();)for(var s=i.next().getEdge().getCoordinates(),u=0;u<s.length-1;u++)n.expandToInclude(s[u]);this._env=n}return this._env},_r.prototype.addReachable=function(n){var i=new _;for(i.add(n);!i.empty();){var s=i.pop();this.add(s,i)}},_r.prototype.copySymDepths=function(n){var i=n.getSym();i.setDepth(It.LEFT,n.getDepth(It.RIGHT)),i.setDepth(It.RIGHT,n.getDepth(It.LEFT))},_r.prototype.add=function(n,i){n.setVisited(!0),this._nodes.add(n);for(var s=n.getEdges().iterator();s.hasNext();){var u=s.next();this._dirEdgeList.add(u);var c=u.getSym().getNode();c.isVisited()||i.push(c)}},_r.prototype.getNodes=function(){return this._nodes},_r.prototype.getDirectedEdges=function(){return this._dirEdgeList},_r.prototype.interfaces_=function(){return[G]},_r.prototype.getClass=function(){return _r};var yn=function n(){if(this.location=null,arguments.length===1){if(arguments[0]instanceof Array){var i=arguments[0];this.init(i.length)}else if(Number.isInteger(arguments[0])){var s=arguments[0];this.init(1),this.location[It.ON]=s}else if(arguments[0]instanceof n){var u=arguments[0];if(this.init(u.location.length),u!==null)for(var c=0;c<this.location.length;c++)this.location[c]=u.location[c]}}else if(arguments.length===3){var m=arguments[0],E=arguments[1],C=arguments[2];this.init(3),this.location[It.ON]=m,this.location[It.LEFT]=E,this.location[It.RIGHT]=C}};yn.prototype.setAllLocations=function(n){for(var i=0;i<this.location.length;i++)this.location[i]=n},yn.prototype.isNull=function(){for(var n=0;n<this.location.length;n++)if(this.location[n]!==V.NONE)return!1;return!0},yn.prototype.setAllLocationsIfNull=function(n){for(var i=0;i<this.location.length;i++)this.location[i]===V.NONE&&(this.location[i]=n)},yn.prototype.isLine=function(){return this.location.length===1},yn.prototype.merge=function(n){if(n.location.length>this.location.length){var i=new Array(3).fill(null);i[It.ON]=this.location[It.ON],i[It.LEFT]=V.NONE,i[It.RIGHT]=V.NONE,this.location=i}for(var s=0;s<this.location.length;s++)this.location[s]===V.NONE&&s<n.location.length&&(this.location[s]=n.location[s])},yn.prototype.getLocations=function(){return this.location},yn.prototype.flip=function(){if(this.location.length<=1)return null;var n=this.location[It.LEFT];this.location[It.LEFT]=this.location[It.RIGHT],this.location[It.RIGHT]=n},yn.prototype.toString=function(){var n=new _t;return this.location.length>1&&n.append(V.toLocationSymbol(this.location[It.LEFT])),n.append(V.toLocationSymbol(this.location[It.ON])),this.location.length>1&&n.append(V.toLocationSymbol(this.location[It.RIGHT])),n.toString()},yn.prototype.setLocations=function(n,i,s){this.location[It.ON]=n,this.location[It.LEFT]=i,this.location[It.RIGHT]=s},yn.prototype.get=function(n){return n<this.location.length?this.location[n]:V.NONE},yn.prototype.isArea=function(){return this.location.length>1},yn.prototype.isAnyNull=function(){for(var n=0;n<this.location.length;n++)if(this.location[n]===V.NONE)return!0;return!1},yn.prototype.setLocation=function(){if(arguments.length===1){var n=arguments[0];this.setLocation(It.ON,n)}else if(arguments.length===2){var i=arguments[0],s=arguments[1];this.location[i]=s}},yn.prototype.init=function(n){this.location=new Array(n).fill(null),this.setAllLocations(V.NONE)},yn.prototype.isEqualOnSide=function(n,i){return this.location[i]===n.location[i]},yn.prototype.allPositionsEqual=function(n){for(var i=0;i<this.location.length;i++)if(this.location[i]!==n)return!1;return!0},yn.prototype.interfaces_=function(){return[]},yn.prototype.getClass=function(){return yn};var fn=function n(){if(this.elt=new Array(2).fill(null),arguments.length===1){if(Number.isInteger(arguments[0])){var i=arguments[0];this.elt[0]=new yn(i),this.elt[1]=new yn(i)}else if(arguments[0]instanceof n){var s=arguments[0];this.elt[0]=new yn(s.elt[0]),this.elt[1]=new yn(s.elt[1])}}else if(arguments.length===2){var u=arguments[0],c=arguments[1];this.elt[0]=new yn(V.NONE),this.elt[1]=new yn(V.NONE),this.elt[u].setLocation(c)}else if(arguments.length===3){var m=arguments[0],E=arguments[1],C=arguments[2];this.elt[0]=new yn(m,E,C),this.elt[1]=new yn(m,E,C)}else if(arguments.length===4){var U=arguments[0],Z=arguments[1],pt=arguments[2],gt=arguments[3];this.elt[0]=new yn(V.NONE,V.NONE,V.NONE),this.elt[1]=new yn(V.NONE,V.NONE,V.NONE),this.elt[U].setLocations(Z,pt,gt)}};fn.prototype.getGeometryCount=function(){var n=0;return this.elt[0].isNull()||n++,this.elt[1].isNull()||n++,n},fn.prototype.setAllLocations=function(n,i){this.elt[n].setAllLocations(i)},fn.prototype.isNull=function(n){return this.elt[n].isNull()},fn.prototype.setAllLocationsIfNull=function(){if(arguments.length===1){var n=arguments[0];this.setAllLocationsIfNull(0,n),this.setAllLocationsIfNull(1,n)}else if(arguments.length===2){var i=arguments[0],s=arguments[1];this.elt[i].setAllLocationsIfNull(s)}},fn.prototype.isLine=function(n){return this.elt[n].isLine()},fn.prototype.merge=function(n){for(var i=0;i<2;i++)this.elt[i]===null&&n.elt[i]!==null?this.elt[i]=new yn(n.elt[i]):this.elt[i].merge(n.elt[i])},fn.prototype.flip=function(){this.elt[0].flip(),this.elt[1].flip()},fn.prototype.getLocation=function(){if(arguments.length===1){var n=arguments[0];return this.elt[n].get(It.ON)}if(arguments.length===2){var i=arguments[0],s=arguments[1];return this.elt[i].get(s)}},fn.prototype.toString=function(){var n=new _t;return this.elt[0]!==null&&(n.append("A:"),n.append(this.elt[0].toString())),this.elt[1]!==null&&(n.append(" B:"),n.append(this.elt[1].toString())),n.toString()},fn.prototype.isArea=function(){if(arguments.length===0)return this.elt[0].isArea()||this.elt[1].isArea();if(arguments.length===1){var n=arguments[0];return this.elt[n].isArea()}},fn.prototype.isAnyNull=function(n){return this.elt[n].isAnyNull()},fn.prototype.setLocation=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];this.elt[n].setLocation(It.ON,i)}else if(arguments.length===3){var s=arguments[0],u=arguments[1],c=arguments[2];this.elt[s].setLocation(u,c)}},fn.prototype.isEqualOnSide=function(n,i){return this.elt[0].isEqualOnSide(n.elt[0],i)&&this.elt[1].isEqualOnSide(n.elt[1],i)},fn.prototype.allPositionsEqual=function(n,i){return this.elt[n].allPositionsEqual(i)},fn.prototype.toLine=function(n){this.elt[n].isArea()&&(this.elt[n]=new yn(this.elt[n].location[0]))},fn.prototype.interfaces_=function(){return[]},fn.prototype.getClass=function(){return fn},fn.toLineLabel=function(n){for(var i=new fn(V.NONE),s=0;s<2;s++)i.setLocation(s,n.getLocation(s));return i};var zn=function(){this._startDe=null,this._maxNodeDegree=-1,this._edges=new O,this._pts=new O,this._label=new fn(V.NONE),this._ring=null,this._isHole=null,this._shell=null,this._holes=new O,this._geometryFactory=null;var n=arguments[0],i=arguments[1];this._geometryFactory=i,this.computePoints(n),this.computeRing()};zn.prototype.computeRing=function(){if(this._ring!==null)return null;for(var n=new Array(this._pts.size()).fill(null),i=0;i<this._pts.size();i++)n[i]=this._pts.get(i);this._ring=this._geometryFactory.createLinearRing(n),this._isHole=ot.isCCW(this._ring.getCoordinates())},zn.prototype.isIsolated=function(){return this._label.getGeometryCount()===1},zn.prototype.computePoints=function(n){this._startDe=n;var i=n,s=!0;do{if(i===null)throw new xo("Found null DirectedEdge");if(i.getEdgeRing()===this)throw new xo("Directed Edge visited twice during ring-building at "+i.getCoordinate());this._edges.add(i);var u=i.getLabel();Lt.isTrue(u.isArea()),this.mergeLabel(u),this.addPoints(i.getEdge(),i.isForward(),s),s=!1,this.setEdgeRing(i,this),i=this.getNext(i)}while(i!==this._startDe)},zn.prototype.getLinearRing=function(){return this._ring},zn.prototype.getCoordinate=function(n){return this._pts.get(n)},zn.prototype.computeMaxNodeDegree=function(){this._maxNodeDegree=0;var n=this._startDe;do{var i=n.getNode().getEdges().getOutgoingDegree(this);i>this._maxNodeDegree&&(this._maxNodeDegree=i),n=this.getNext(n)}while(n!==this._startDe);this._maxNodeDegree*=2},zn.prototype.addPoints=function(n,i,s){var u=n.getCoordinates();if(i){var c=1;s&&(c=0);for(var m=c;m<u.length;m++)this._pts.add(u[m])}else{var E=u.length-2;s&&(E=u.length-1);for(var C=E;C>=0;C--)this._pts.add(u[C])}},zn.prototype.isHole=function(){return this._isHole},zn.prototype.setInResult=function(){var n=this._startDe;do n.getEdge().setInResult(!0),n=n.getNext();while(n!==this._startDe)},zn.prototype.containsPoint=function(n){var i=this.getLinearRing();if(!i.getEnvelopeInternal().contains(n)||!ot.isPointInRing(n,i.getCoordinates()))return!1;for(var s=this._holes.iterator();s.hasNext();)if(s.next().containsPoint(n))return!1;return!0},zn.prototype.addHole=function(n){this._holes.add(n)},zn.prototype.isShell=function(){return this._shell===null},zn.prototype.getLabel=function(){return this._label},zn.prototype.getEdges=function(){return this._edges},zn.prototype.getMaxNodeDegree=function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree},zn.prototype.getShell=function(){return this._shell},zn.prototype.mergeLabel=function(){if(arguments.length===1){var n=arguments[0];this.mergeLabel(n,0),this.mergeLabel(n,1)}else if(arguments.length===2){var i=arguments[0],s=arguments[1],u=i.getLocation(s,It.RIGHT);if(u===V.NONE)return null;if(this._label.getLocation(s)===V.NONE)return this._label.setLocation(s,u),null}},zn.prototype.setShell=function(n){this._shell=n,n!==null&&n.addHole(this)},zn.prototype.toPolygon=function(n){for(var i=new Array(this._holes.size()).fill(null),s=0;s<this._holes.size();s++)i[s]=this._holes.get(s).getLinearRing();return n.createPolygon(this.getLinearRing(),i)},zn.prototype.interfaces_=function(){return[]},zn.prototype.getClass=function(){return zn};var JA=function(n){function i(){var s=arguments[0],u=arguments[1];n.call(this,s,u)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.setEdgeRing=function(s,u){s.setMinEdgeRing(u)},i.prototype.getNext=function(s){return s.getNextMin()},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(zn),KA=function(n){function i(){var s=arguments[0],u=arguments[1];n.call(this,s,u)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.buildMinimalRings=function(){var s=new O,u=this._startDe;do{if(u.getMinEdgeRing()===null){var c=new JA(u,this._geometryFactory);s.add(c)}u=u.getNext()}while(u!==this._startDe);return s},i.prototype.setEdgeRing=function(s,u){s.setEdgeRing(u)},i.prototype.linkDirectedEdgesForMinimalEdgeRings=function(){var s=this._startDe;do s.getNode().getEdges().linkMinimalDirectedEdges(this),s=s.getNext();while(s!==this._startDe)},i.prototype.getNext=function(s){return s.getNext()},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(zn),ri=function(){if(this._label=null,this._isInResult=!1,this._isCovered=!1,this._isCoveredSet=!1,this._isVisited=!1,arguments.length!==0){if(arguments.length===1){var n=arguments[0];this._label=n}}};ri.prototype.setVisited=function(n){this._isVisited=n},ri.prototype.setInResult=function(n){this._isInResult=n},ri.prototype.isCovered=function(){return this._isCovered},ri.prototype.isCoveredSet=function(){return this._isCoveredSet},ri.prototype.setLabel=function(n){this._label=n},ri.prototype.getLabel=function(){return this._label},ri.prototype.setCovered=function(n){this._isCovered=n,this._isCoveredSet=!0},ri.prototype.updateIM=function(n){Lt.isTrue(this._label.getGeometryCount()>=2,"found partial label"),this.computeIM(n)},ri.prototype.isInResult=function(){return this._isInResult},ri.prototype.isVisited=function(){return this._isVisited},ri.prototype.interfaces_=function(){return[]},ri.prototype.getClass=function(){return ri};var hc=function(n){function i(){n.call(this),this._coord=null,this._edges=null;var s=arguments[0],u=arguments[1];this._coord=s,this._edges=u,this._label=new fn(0,V.NONE)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.isIncidentEdgeInResult=function(){for(var s=this.getEdges().getEdges().iterator();s.hasNext();)if(s.next().getEdge().isInResult())return!0;return!1},i.prototype.isIsolated=function(){return this._label.getGeometryCount()===1},i.prototype.getCoordinate=function(){return this._coord},i.prototype.print=function(s){s.println("node "+this._coord+" lbl: "+this._label)},i.prototype.computeIM=function(s){},i.prototype.computeMergedLocation=function(s,u){var c=V.NONE;if(c=this._label.getLocation(u),!s.isNull(u)){var m=s.getLocation(u);c!==V.BOUNDARY&&(c=m)}return c},i.prototype.setLabel=function(){if(arguments.length!==2)return n.prototype.setLabel.apply(this,arguments);var s=arguments[0],u=arguments[1];this._label===null?this._label=new fn(s,u):this._label.setLocation(s,u)},i.prototype.getEdges=function(){return this._edges},i.prototype.mergeLabel=function(){if(arguments[0]instanceof i){var s=arguments[0];this.mergeLabel(s._label)}else if(arguments[0]instanceof fn)for(var u=arguments[0],c=0;c<2;c++){var m=this.computeMergedLocation(u,c);this._label.getLocation(c)===V.NONE&&this._label.setLocation(c,m)}},i.prototype.add=function(s){this._edges.insert(s),s.setNode(this)},i.prototype.setLabelBoundary=function(s){if(this._label===null)return null;var u=V.NONE;this._label!==null&&(u=this._label.getLocation(s));var c=null;switch(u){case V.BOUNDARY:c=V.INTERIOR;break;case V.INTERIOR:default:c=V.BOUNDARY}this._label.setLocation(s,c)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(ri),Fi=function(){this.nodeMap=new x,this.nodeFact=null;var n=arguments[0];this.nodeFact=n};Fi.prototype.find=function(n){return this.nodeMap.get(n)},Fi.prototype.addNode=function(){if(arguments[0]instanceof I){var n=arguments[0],i=this.nodeMap.get(n);return i===null&&(i=this.nodeFact.createNode(n),this.nodeMap.put(n,i)),i}if(arguments[0]instanceof hc){var s=arguments[0],u=this.nodeMap.get(s.getCoordinate());return u===null?(this.nodeMap.put(s.getCoordinate(),s),s):(u.mergeLabel(s),u)}},Fi.prototype.print=function(n){for(var i=this.iterator();i.hasNext();)i.next().print(n)},Fi.prototype.iterator=function(){return this.nodeMap.values().iterator()},Fi.prototype.values=function(){return this.nodeMap.values()},Fi.prototype.getBoundaryNodes=function(n){for(var i=new O,s=this.iterator();s.hasNext();){var u=s.next();u.getLabel().getLocation(n)===V.BOUNDARY&&i.add(u)}return i},Fi.prototype.add=function(n){var i=n.getCoordinate();this.addNode(i).add(n)},Fi.prototype.interfaces_=function(){return[]},Fi.prototype.getClass=function(){return Fi};var dn=function(){},el={NE:{configurable:!0},NW:{configurable:!0},SW:{configurable:!0},SE:{configurable:!0}};dn.prototype.interfaces_=function(){return[]},dn.prototype.getClass=function(){return dn},dn.isNorthern=function(n){return n===dn.NE||n===dn.NW},dn.isOpposite=function(n,i){return n===i?!1:(n-i+4)%4===2},dn.commonHalfPlane=function(n,i){if(n===i)return n;if((n-i+4)%4===2)return-1;var s=n<i?n:i;return s===0&&(n>i?n:i)===3?3:s},dn.isInHalfPlane=function(n,i){return i===dn.SE?n===dn.SE||n===dn.SW:n===i||n===i+1},dn.quadrant=function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var n=arguments[0],i=arguments[1];if(n===0&&i===0)throw new A("Cannot compute the quadrant for point ( "+n+", "+i+" )");return n>=0?i>=0?dn.NE:dn.SE:i>=0?dn.NW:dn.SW}if(arguments[0]instanceof I&&arguments[1]instanceof I){var s=arguments[0],u=arguments[1];if(u.x===s.x&&u.y===s.y)throw new A("Cannot compute the quadrant for two identical points "+s);return u.x>=s.x?u.y>=s.y?dn.NE:dn.SE:u.y>=s.y?dn.NW:dn.SW}},el.NE.get=function(){return 0},el.NW.get=function(){return 1},el.SW.get=function(){return 2},el.SE.get=function(){return 3},Object.defineProperties(dn,el);var ar=function(){if(this._edge=null,this._label=null,this._node=null,this._p0=null,this._p1=null,this._dx=null,this._dy=null,this._quadrant=null,arguments.length===1){var n=arguments[0];this._edge=n}else if(arguments.length===3){var i=arguments[0],s=arguments[1],u=arguments[2];this._edge=i,this.init(s,u),this._label=null}else if(arguments.length===4){var c=arguments[0],m=arguments[1],E=arguments[2],C=arguments[3];this._edge=c,this.init(m,E),this._label=C}};ar.prototype.compareDirection=function(n){return this._dx===n._dx&&this._dy===n._dy?0:this._quadrant>n._quadrant?1:this._quadrant<n._quadrant?-1:ot.computeOrientation(n._p0,n._p1,this._p1)},ar.prototype.getDy=function(){return this._dy},ar.prototype.getCoordinate=function(){return this._p0},ar.prototype.setNode=function(n){this._node=n},ar.prototype.print=function(n){var i=Math.atan2(this._dy,this._dx),s=this.getClass().getName(),u=s.lastIndexOf("."),c=s.substring(u+1);n.print(" "+c+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+i+" "+this._label)},ar.prototype.compareTo=function(n){var i=n;return this.compareDirection(i)},ar.prototype.getDirectedCoordinate=function(){return this._p1},ar.prototype.getDx=function(){return this._dx},ar.prototype.getLabel=function(){return this._label},ar.prototype.getEdge=function(){return this._edge},ar.prototype.getQuadrant=function(){return this._quadrant},ar.prototype.getNode=function(){return this._node},ar.prototype.toString=function(){var n=Math.atan2(this._dy,this._dx),i=this.getClass().getName(),s=i.lastIndexOf(".");return" "+i.substring(s+1)+": "+this._p0+" - "+this._p1+" "+this._quadrant+":"+n+" "+this._label},ar.prototype.computeLabel=function(n){},ar.prototype.init=function(n,i){this._p0=n,this._p1=i,this._dx=i.x-n.x,this._dy=i.y-n.y,this._quadrant=dn.quadrant(this._dx,this._dy),Lt.isTrue(!(this._dx===0&&this._dy===0),"EdgeEnd with identical endpoints found")},ar.prototype.interfaces_=function(){return[G]},ar.prototype.getClass=function(){return ar};var rp=function(n){function i(){var s=arguments[0],u=arguments[1];if(n.call(this,s),this._isForward=null,this._isInResult=!1,this._isVisited=!1,this._sym=null,this._next=null,this._nextMin=null,this._edgeRing=null,this._minEdgeRing=null,this._depth=[0,-999,-999],this._isForward=u,u)this.init(s.getCoordinate(0),s.getCoordinate(1));else{var c=s.getNumPoints()-1;this.init(s.getCoordinate(c),s.getCoordinate(c-1))}this.computeDirectedLabel()}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.getNextMin=function(){return this._nextMin},i.prototype.getDepth=function(s){return this._depth[s]},i.prototype.setVisited=function(s){this._isVisited=s},i.prototype.computeDirectedLabel=function(){this._label=new fn(this._edge.getLabel()),this._isForward||this._label.flip()},i.prototype.getNext=function(){return this._next},i.prototype.setDepth=function(s,u){if(this._depth[s]!==-999&&this._depth[s]!==u)throw new xo("assigned depths do not match",this.getCoordinate());this._depth[s]=u},i.prototype.isInteriorAreaEdge=function(){for(var s=!0,u=0;u<2;u++)this._label.isArea(u)&&this._label.getLocation(u,It.LEFT)===V.INTERIOR&&this._label.getLocation(u,It.RIGHT)===V.INTERIOR||(s=!1);return s},i.prototype.setNextMin=function(s){this._nextMin=s},i.prototype.print=function(s){n.prototype.print.call(this,s),s.print(" "+this._depth[It.LEFT]+"/"+this._depth[It.RIGHT]),s.print(" ("+this.getDepthDelta()+")"),this._isInResult&&s.print(" inResult")},i.prototype.setMinEdgeRing=function(s){this._minEdgeRing=s},i.prototype.isLineEdge=function(){var s=this._label.isLine(0)||this._label.isLine(1),u=!this._label.isArea(0)||this._label.allPositionsEqual(0,V.EXTERIOR),c=!this._label.isArea(1)||this._label.allPositionsEqual(1,V.EXTERIOR);return s&&u&&c},i.prototype.setEdgeRing=function(s){this._edgeRing=s},i.prototype.getMinEdgeRing=function(){return this._minEdgeRing},i.prototype.getDepthDelta=function(){var s=this._edge.getDepthDelta();return this._isForward||(s=-s),s},i.prototype.setInResult=function(s){this._isInResult=s},i.prototype.getSym=function(){return this._sym},i.prototype.isForward=function(){return this._isForward},i.prototype.getEdge=function(){return this._edge},i.prototype.printEdge=function(s){this.print(s),s.print(" "),this._isForward?this._edge.print(s):this._edge.printReverse(s)},i.prototype.setSym=function(s){this._sym=s},i.prototype.setVisitedEdge=function(s){this.setVisited(s),this._sym.setVisited(s)},i.prototype.setEdgeDepths=function(s,u){var c=this.getEdge().getDepthDelta();this._isForward||(c=-c);var m=1;s===It.LEFT&&(m=-1);var E=It.opposite(s),C=u+c*m;this.setDepth(s,u),this.setDepth(E,C)},i.prototype.getEdgeRing=function(){return this._edgeRing},i.prototype.isInResult=function(){return this._isInResult},i.prototype.setNext=function(s){this._next=s},i.prototype.isVisited=function(){return this._isVisited},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i.depthFactor=function(s,u){return s===V.EXTERIOR&&u===V.INTERIOR?1:s===V.INTERIOR&&u===V.EXTERIOR?-1:0},i}(ar),Da=function(){};Da.prototype.createNode=function(n){return new hc(n,null)},Da.prototype.interfaces_=function(){return[]},Da.prototype.getClass=function(){return Da};var Rn=function(){if(this._edges=new O,this._nodes=null,this._edgeEndList=new O,arguments.length===0)this._nodes=new Fi(new Da);else if(arguments.length===1){var n=arguments[0];this._nodes=new Fi(n)}};Rn.prototype.printEdges=function(n){n.println("Edges:");for(var i=0;i<this._edges.size();i++){n.println("edge "+i+":");var s=this._edges.get(i);s.print(n),s.eiList.print(n)}},Rn.prototype.find=function(n){return this._nodes.find(n)},Rn.prototype.addNode=function(){if(arguments[0]instanceof hc){var n=arguments[0];return this._nodes.addNode(n)}if(arguments[0]instanceof I){var i=arguments[0];return this._nodes.addNode(i)}},Rn.prototype.getNodeIterator=function(){return this._nodes.iterator()},Rn.prototype.linkResultDirectedEdges=function(){for(var n=this._nodes.iterator();n.hasNext();)n.next().getEdges().linkResultDirectedEdges()},Rn.prototype.debugPrintln=function(n){Ut.out.println(n)},Rn.prototype.isBoundaryNode=function(n,i){var s=this._nodes.find(i);if(s===null)return!1;var u=s.getLabel();return u!==null&&u.getLocation(n)===V.BOUNDARY},Rn.prototype.linkAllDirectedEdges=function(){for(var n=this._nodes.iterator();n.hasNext();)n.next().getEdges().linkAllDirectedEdges()},Rn.prototype.matchInSameDirection=function(n,i,s,u){return!!n.equals(s)&&ot.computeOrientation(n,i,u)===ot.COLLINEAR&&dn.quadrant(n,i)===dn.quadrant(s,u)},Rn.prototype.getEdgeEnds=function(){return this._edgeEndList},Rn.prototype.debugPrint=function(n){Ut.out.print(n)},Rn.prototype.getEdgeIterator=function(){return this._edges.iterator()},Rn.prototype.findEdgeInSameDirection=function(n,i){for(var s=0;s<this._edges.size();s++){var u=this._edges.get(s),c=u.getCoordinates();if(this.matchInSameDirection(n,i,c[0],c[1])||this.matchInSameDirection(n,i,c[c.length-1],c[c.length-2]))return u}return null},Rn.prototype.insertEdge=function(n){this._edges.add(n)},Rn.prototype.findEdgeEnd=function(n){for(var i=this.getEdgeEnds().iterator();i.hasNext();){var s=i.next();if(s.getEdge()===n)return s}return null},Rn.prototype.addEdges=function(n){for(var i=n.iterator();i.hasNext();){var s=i.next();this._edges.add(s);var u=new rp(s,!0),c=new rp(s,!1);u.setSym(c),c.setSym(u),this.add(u),this.add(c)}},Rn.prototype.add=function(n){this._nodes.add(n),this._edgeEndList.add(n)},Rn.prototype.getNodes=function(){return this._nodes.values()},Rn.prototype.findEdge=function(n,i){for(var s=0;s<this._edges.size();s++){var u=this._edges.get(s),c=u.getCoordinates();if(n.equals(c[0])&&i.equals(c[1]))return u}return null},Rn.prototype.interfaces_=function(){return[]},Rn.prototype.getClass=function(){return Rn},Rn.linkResultDirectedEdges=function(n){for(var i=n.iterator();i.hasNext();)i.next().getEdges().linkResultDirectedEdges()};var Wr=function(){this._geometryFactory=null,this._shellList=new O;var n=arguments[0];this._geometryFactory=n};Wr.prototype.sortShellsAndHoles=function(n,i,s){for(var u=n.iterator();u.hasNext();){var c=u.next();c.isHole()?s.add(c):i.add(c)}},Wr.prototype.computePolygons=function(n){for(var i=new O,s=n.iterator();s.hasNext();){var u=s.next().toPolygon(this._geometryFactory);i.add(u)}return i},Wr.prototype.placeFreeHoles=function(n,i){for(var s=i.iterator();s.hasNext();){var u=s.next();if(u.getShell()===null){var c=this.findEdgeRingContaining(u,n);if(c===null)throw new xo("unable to assign hole to a shell",u.getCoordinate(0));u.setShell(c)}}},Wr.prototype.buildMinimalEdgeRings=function(n,i,s){for(var u=new O,c=n.iterator();c.hasNext();){var m=c.next();if(m.getMaxNodeDegree()>2){m.linkDirectedEdgesForMinimalEdgeRings();var E=m.buildMinimalRings(),C=this.findShell(E);C!==null?(this.placePolygonHoles(C,E),i.add(C)):s.addAll(E)}else u.add(m)}return u},Wr.prototype.containsPoint=function(n){for(var i=this._shellList.iterator();i.hasNext();)if(i.next().containsPoint(n))return!0;return!1},Wr.prototype.buildMaximalEdgeRings=function(n){for(var i=new O,s=n.iterator();s.hasNext();){var u=s.next();if(u.isInResult()&&u.getLabel().isArea()&&u.getEdgeRing()===null){var c=new KA(u,this._geometryFactory);i.add(c),c.setInResult()}}return i},Wr.prototype.placePolygonHoles=function(n,i){for(var s=i.iterator();s.hasNext();){var u=s.next();u.isHole()&&u.setShell(n)}},Wr.prototype.getPolygons=function(){return this.computePolygons(this._shellList)},Wr.prototype.findEdgeRingContaining=function(n,i){for(var s=n.getLinearRing(),u=s.getEnvelopeInternal(),c=s.getCoordinateN(0),m=null,E=null,C=i.iterator();C.hasNext();){var U=C.next(),Z=U.getLinearRing(),pt=Z.getEnvelopeInternal();m!==null&&(E=m.getLinearRing().getEnvelopeInternal());var gt=!1;pt.contains(u)&&ot.isPointInRing(c,Z.getCoordinates())&&(gt=!0),gt&&(m===null||E.contains(pt))&&(m=U)}return m},Wr.prototype.findShell=function(n){for(var i=0,s=null,u=n.iterator();u.hasNext();){var c=u.next();c.isHole()||(s=c,i++)}return Lt.isTrue(i<=1,"found two shells in MinimalEdgeRing list"),s},Wr.prototype.add=function(){if(arguments.length===1){var n=arguments[0];this.add(n.getEdgeEnds(),n.getNodes())}else if(arguments.length===2){var i=arguments[0],s=arguments[1];Rn.linkResultDirectedEdges(s);var u=this.buildMaximalEdgeRings(i),c=new O,m=this.buildMinimalEdgeRings(u,this._shellList,c);this.sortShellsAndHoles(m,this._shellList,c),this.placeFreeHoles(this._shellList,c)}},Wr.prototype.interfaces_=function(){return[]},Wr.prototype.getClass=function(){return Wr};var Fa=function(){};Fa.prototype.getBounds=function(){},Fa.prototype.interfaces_=function(){return[]},Fa.prototype.getClass=function(){return Fa};var bi=function(){this._bounds=null,this._item=null;var n=arguments[0],i=arguments[1];this._bounds=n,this._item=i};bi.prototype.getItem=function(){return this._item},bi.prototype.getBounds=function(){return this._bounds},bi.prototype.interfaces_=function(){return[Fa,t]},bi.prototype.getClass=function(){return bi};var Eo=function(){this._size=null,this._items=null,this._size=0,this._items=new O,this._items.add(null)};Eo.prototype.poll=function(){if(this.isEmpty())return null;var n=this._items.get(1);return this._items.set(1,this._items.get(this._size)),this._size-=1,this.reorder(1),n},Eo.prototype.size=function(){return this._size},Eo.prototype.reorder=function(n){for(var i=null,s=this._items.get(n);2*n<=this._size&&((i=2*n)!==this._size&&this._items.get(i+1).compareTo(this._items.get(i))<0&&i++,this._items.get(i).compareTo(s)<0);n=i)this._items.set(n,this._items.get(i));this._items.set(n,s)},Eo.prototype.clear=function(){this._size=0,this._items.clear()},Eo.prototype.isEmpty=function(){return this._size===0},Eo.prototype.add=function(n){this._items.add(null),this._size+=1;var i=this._size;for(this._items.set(0,n);n.compareTo(this._items.get(Math.trunc(i/2)))<0;i/=2)this._items.set(i,this._items.get(Math.trunc(i/2)));this._items.set(i,n)},Eo.prototype.interfaces_=function(){return[]},Eo.prototype.getClass=function(){return Eo};var Bo=function(){};Bo.prototype.visitItem=function(n){},Bo.prototype.interfaces_=function(){return[]},Bo.prototype.getClass=function(){return Bo};var $s=function(){};$s.prototype.insert=function(n,i){},$s.prototype.remove=function(n,i){},$s.prototype.query=function(){},$s.prototype.interfaces_=function(){return[]},$s.prototype.getClass=function(){return $s};var Wn=function(){if(this._childBoundables=new O,this._bounds=null,this._level=null,arguments.length!==0){if(arguments.length===1){var n=arguments[0];this._level=n}}},ny={serialVersionUID:{configurable:!0}};Wn.prototype.getLevel=function(){return this._level},Wn.prototype.size=function(){return this._childBoundables.size()},Wn.prototype.getChildBoundables=function(){return this._childBoundables},Wn.prototype.addChildBoundable=function(n){Lt.isTrue(this._bounds===null),this._childBoundables.add(n)},Wn.prototype.isEmpty=function(){return this._childBoundables.isEmpty()},Wn.prototype.getBounds=function(){return this._bounds===null&&(this._bounds=this.computeBounds()),this._bounds},Wn.prototype.interfaces_=function(){return[Fa,t]},Wn.prototype.getClass=function(){return Wn},ny.serialVersionUID.get=function(){return 6493722185909574e3},Object.defineProperties(Wn,ny);var Ti=function(){};Ti.reverseOrder=function(){return{compare:function(n,i){return i.compareTo(n)}}},Ti.min=function(n){return Ti.sort(n),n.get(0)},Ti.sort=function(n,i){var s=n.toArray();i?_n.sort(s,i):_n.sort(s);for(var u=n.iterator(),c=0,m=s.length;c<m;c++)u.next(),u.set(s[c])},Ti.singletonList=function(n){var i=new O;return i.add(n),i};var Gn=function(){this._boundable1=null,this._boundable2=null,this._distance=null,this._itemDistance=null;var n=arguments[0],i=arguments[1],s=arguments[2];this._boundable1=n,this._boundable2=i,this._itemDistance=s,this._distance=this.distance()};Gn.prototype.expandToQueue=function(n,i){var s=Gn.isComposite(this._boundable1),u=Gn.isComposite(this._boundable2);if(s&&u)return Gn.area(this._boundable1)>Gn.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,n,i),null):(this.expand(this._boundable2,this._boundable1,n,i),null);if(s)return this.expand(this._boundable1,this._boundable2,n,i),null;if(u)return this.expand(this._boundable2,this._boundable1,n,i),null;throw new A("neither boundable is composite")},Gn.prototype.isLeaves=function(){return!(Gn.isComposite(this._boundable1)||Gn.isComposite(this._boundable2))},Gn.prototype.compareTo=function(n){var i=n;return this._distance<i._distance?-1:this._distance>i._distance?1:0},Gn.prototype.expand=function(n,i,s,u){for(var c=n.getChildBoundables().iterator();c.hasNext();){var m=c.next(),E=new Gn(m,i,this._itemDistance);E.getDistance()<u&&s.add(E)}},Gn.prototype.getBoundable=function(n){return n===0?this._boundable1:this._boundable2},Gn.prototype.getDistance=function(){return this._distance},Gn.prototype.distance=function(){return this.isLeaves()?this._itemDistance.distance(this._boundable1,this._boundable2):this._boundable1.getBounds().distance(this._boundable2.getBounds())},Gn.prototype.interfaces_=function(){return[G]},Gn.prototype.getClass=function(){return Gn},Gn.area=function(n){return n.getBounds().getArea()},Gn.isComposite=function(n){return n instanceof Wn};var Jn=function n(){if(this._root=null,this._built=!1,this._itemBoundables=new O,this._nodeCapacity=null,arguments.length===0){var i=n.DEFAULT_NODE_CAPACITY;this._nodeCapacity=i}else if(arguments.length===1){var s=arguments[0];Lt.isTrue(s>1,"Node capacity must be greater than 1"),this._nodeCapacity=s}},pc={IntersectsOp:{configurable:!0},serialVersionUID:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};Jn.prototype.getNodeCapacity=function(){return this._nodeCapacity},Jn.prototype.lastNode=function(n){return n.get(n.size()-1)},Jn.prototype.size=function(){if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.size(this._root));if(arguments.length===1){for(var n=0,i=arguments[0].getChildBoundables().iterator();i.hasNext();){var s=i.next();s instanceof Wn?n+=this.size(s):s instanceof bi&&(n+=1)}return n}},Jn.prototype.removeItem=function(n,i){for(var s=null,u=n.getChildBoundables().iterator();u.hasNext();){var c=u.next();c instanceof bi&&c.getItem()===i&&(s=c)}return s!==null&&(n.getChildBoundables().remove(s),!0)},Jn.prototype.itemsTree=function(){if(arguments.length===0){this.build();var n=this.itemsTree(this._root);return n===null?new O:n}if(arguments.length===1){for(var i=arguments[0],s=new O,u=i.getChildBoundables().iterator();u.hasNext();){var c=u.next();if(c instanceof Wn){var m=this.itemsTree(c);m!==null&&s.add(m)}else c instanceof bi?s.add(c.getItem()):Lt.shouldNeverReachHere()}return s.size()<=0?null:s}},Jn.prototype.insert=function(n,i){Lt.isTrue(!this._built,"Cannot insert items into an STR packed R-tree after it has been built."),this._itemBoundables.add(new bi(n,i))},Jn.prototype.boundablesAtLevel=function(){if(arguments.length===1){var n=arguments[0],i=new O;return this.boundablesAtLevel(n,this._root,i),i}if(arguments.length===3){var s=arguments[0],u=arguments[1],c=arguments[2];if(Lt.isTrue(s>-2),u.getLevel()===s)return c.add(u),null;for(var m=u.getChildBoundables().iterator();m.hasNext();){var E=m.next();E instanceof Wn?this.boundablesAtLevel(s,E,c):(Lt.isTrue(E instanceof bi),s===-1&&c.add(E))}return null}},Jn.prototype.query=function(){if(arguments.length===1){var n=arguments[0];this.build();var i=new O;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),n)&&this.query(n,this._root,i),i}if(arguments.length===2){var s=arguments[0],u=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),s)&&this.query(s,this._root,u)}else if(arguments.length===3){if(X(arguments[2],Bo)&&arguments[0]instanceof Object&&arguments[1]instanceof Wn)for(var c=arguments[0],m=arguments[1],E=arguments[2],C=m.getChildBoundables(),U=0;U<C.size();U++){var Z=C.get(U);this.getIntersectsOp().intersects(Z.getBounds(),c)&&(Z instanceof Wn?this.query(c,Z,E):Z instanceof bi?E.visitItem(Z.getItem()):Lt.shouldNeverReachHere())}else if(X(arguments[2],ct)&&arguments[0]instanceof Object&&arguments[1]instanceof Wn)for(var pt=arguments[0],gt=arguments[1],Rt=arguments[2],Ft=gt.getChildBoundables(),Vt=0;Vt<Ft.size();Vt++){var ee=Ft.get(Vt);this.getIntersectsOp().intersects(ee.getBounds(),pt)&&(ee instanceof Wn?this.query(pt,ee,Rt):ee instanceof bi?Rt.add(ee.getItem()):Lt.shouldNeverReachHere())}}},Jn.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},Jn.prototype.getRoot=function(){return this.build(),this._root},Jn.prototype.remove=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];return this.build(),!!this.getIntersectsOp().intersects(this._root.getBounds(),n)&&this.remove(n,this._root,i)}if(arguments.length===3){var s=arguments[0],u=arguments[1],c=arguments[2],m=this.removeItem(u,c);if(m)return!0;for(var E=null,C=u.getChildBoundables().iterator();C.hasNext();){var U=C.next();if(this.getIntersectsOp().intersects(U.getBounds(),s)&&U instanceof Wn&&(m=this.remove(s,U,c))){E=U;break}}return E!==null&&E.getChildBoundables().isEmpty()&&u.getChildBoundables().remove(E),m}},Jn.prototype.createHigherLevels=function(n,i){Lt.isTrue(!n.isEmpty());var s=this.createParentBoundables(n,i+1);return s.size()===1?s.get(0):this.createHigherLevels(s,i+1)},Jn.prototype.depth=function(){if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.depth(this._root));if(arguments.length===1){for(var n=0,i=arguments[0].getChildBoundables().iterator();i.hasNext();){var s=i.next();if(s instanceof Wn){var u=this.depth(s);u>n&&(n=u)}}return n+1}},Jn.prototype.createParentBoundables=function(n,i){Lt.isTrue(!n.isEmpty());var s=new O;s.add(this.createNode(i));var u=new O(n);Ti.sort(u,this.getComparator());for(var c=u.iterator();c.hasNext();){var m=c.next();this.lastNode(s).getChildBoundables().size()===this.getNodeCapacity()&&s.add(this.createNode(i)),this.lastNode(s).addChildBoundable(m)}return s},Jn.prototype.isEmpty=function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()},Jn.prototype.interfaces_=function(){return[t]},Jn.prototype.getClass=function(){return Jn},Jn.compareDoubles=function(n,i){return n>i?1:n<i?-1:0},pc.IntersectsOp.get=function(){return jA},pc.serialVersionUID.get=function(){return-3886435814360241e3},pc.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(Jn,pc);var jA=function(){},Ua=function(){};Ua.prototype.distance=function(n,i){},Ua.prototype.interfaces_=function(){return[]},Ua.prototype.getClass=function(){return Ua};var ry=function(n){function i(u){u=u||i.DEFAULT_NODE_CAPACITY,n.call(this,u)}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={STRtreeNode:{configurable:!0},serialVersionUID:{configurable:!0},xComparator:{configurable:!0},yComparator:{configurable:!0},intersectsOp:{configurable:!0},DEFAULT_NODE_CAPACITY:{configurable:!0}};return i.prototype.createParentBoundablesFromVerticalSlices=function(u,c){Lt.isTrue(u.length>0);for(var m=new O,E=0;E<u.length;E++)m.addAll(this.createParentBoundablesFromVerticalSlice(u[E],c));return m},i.prototype.createNode=function(u){return new iy(u)},i.prototype.size=function(){return arguments.length===0?n.prototype.size.call(this):n.prototype.size.apply(this,arguments)},i.prototype.insert=function(){if(arguments.length!==2)return n.prototype.insert.apply(this,arguments);var u=arguments[0],c=arguments[1];if(u.isNull())return null;n.prototype.insert.call(this,u,c)},i.prototype.getIntersectsOp=function(){return i.intersectsOp},i.prototype.verticalSlices=function(u,c){for(var m=Math.trunc(Math.ceil(u.size()/c)),E=new Array(c).fill(null),C=u.iterator(),U=0;U<c;U++){E[U]=new O;for(var Z=0;C.hasNext()&&Z<m;){var pt=C.next();E[U].add(pt),Z++}}return E},i.prototype.query=function(){if(arguments.length===1){var u=arguments[0];return n.prototype.query.call(this,u)}if(arguments.length===2){var c=arguments[0],m=arguments[1];n.prototype.query.call(this,c,m)}else if(arguments.length===3){if(X(arguments[2],Bo)&&arguments[0]instanceof Object&&arguments[1]instanceof Wn){var E=arguments[0],C=arguments[1],U=arguments[2];n.prototype.query.call(this,E,C,U)}else if(X(arguments[2],ct)&&arguments[0]instanceof Object&&arguments[1]instanceof Wn){var Z=arguments[0],pt=arguments[1],gt=arguments[2];n.prototype.query.call(this,Z,pt,gt)}}},i.prototype.getComparator=function(){return i.yComparator},i.prototype.createParentBoundablesFromVerticalSlice=function(u,c){return n.prototype.createParentBoundables.call(this,u,c)},i.prototype.remove=function(){if(arguments.length===2){var u=arguments[0],c=arguments[1];return n.prototype.remove.call(this,u,c)}return n.prototype.remove.apply(this,arguments)},i.prototype.depth=function(){return arguments.length===0?n.prototype.depth.call(this):n.prototype.depth.apply(this,arguments)},i.prototype.createParentBoundables=function(u,c){Lt.isTrue(!u.isEmpty());var m=Math.trunc(Math.ceil(u.size()/this.getNodeCapacity())),E=new O(u);Ti.sort(E,i.xComparator);var C=this.verticalSlices(E,Math.trunc(Math.ceil(Math.sqrt(m))));return this.createParentBoundablesFromVerticalSlices(C,c)},i.prototype.nearestNeighbour=function(){if(arguments.length===1){if(X(arguments[0],Ua)){var u=arguments[0],c=new Gn(this.getRoot(),this.getRoot(),u);return this.nearestNeighbour(c)}if(arguments[0]instanceof Gn){var m=arguments[0];return this.nearestNeighbour(m,S.POSITIVE_INFINITY)}}else if(arguments.length===2){if(arguments[0]instanceof i&&X(arguments[1],Ua)){var E=arguments[0],C=arguments[1],U=new Gn(this.getRoot(),E.getRoot(),C);return this.nearestNeighbour(U)}if(arguments[0]instanceof Gn&&typeof arguments[1]=="number"){var Z=arguments[0],pt=arguments[1],gt=null,Rt=new Eo;for(Rt.add(Z);!Rt.isEmpty()&&pt>0;){var Ft=Rt.poll(),Vt=Ft.getDistance();if(Vt>=pt)break;Ft.isLeaves()?(pt=Vt,gt=Ft):Ft.expandToQueue(Rt,pt)}return[gt.getBoundable(0).getItem(),gt.getBoundable(1).getItem()]}}else if(arguments.length===3){var ee=arguments[0],hn=arguments[1],qn=arguments[2],Tr=new bi(ee,hn),no=new Gn(this.getRoot(),Tr,qn);return this.nearestNeighbour(no)[0]}},i.prototype.interfaces_=function(){return[$s,t]},i.prototype.getClass=function(){return i},i.centreX=function(u){return i.avg(u.getMinX(),u.getMaxX())},i.avg=function(u,c){return(u+c)/2},i.centreY=function(u){return i.avg(u.getMinY(),u.getMaxY())},s.STRtreeNode.get=function(){return iy},s.serialVersionUID.get=function(){return 0x39920f7d5f261e0},s.xComparator.get=function(){return{interfaces_:function(){return[F]},compare:function(u,c){return n.compareDoubles(i.centreX(u.getBounds()),i.centreX(c.getBounds()))}}},s.yComparator.get=function(){return{interfaces_:function(){return[F]},compare:function(u,c){return n.compareDoubles(i.centreY(u.getBounds()),i.centreY(c.getBounds()))}}},s.intersectsOp.get=function(){return{interfaces_:function(){return[n.IntersectsOp]},intersects:function(u,c){return u.intersects(c)}}},s.DEFAULT_NODE_CAPACITY.get=function(){return 10},Object.defineProperties(i,s),i}(Jn),iy=function(n){function i(){var s=arguments[0];n.call(this,s)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.computeBounds=function(){for(var s=null,u=this.getChildBoundables().iterator();u.hasNext();){var c=u.next();s===null?s=new At(c.getBounds()):s.expandToInclude(c.getBounds())}return s},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(Wn),Nr=function(){};Nr.prototype.interfaces_=function(){return[]},Nr.prototype.getClass=function(){return Nr},Nr.relativeSign=function(n,i){return n<i?-1:n>i?1:0},Nr.compare=function(n,i,s){if(i.equals2D(s))return 0;var u=Nr.relativeSign(i.x,s.x),c=Nr.relativeSign(i.y,s.y);switch(n){case 0:return Nr.compareValue(u,c);case 1:return Nr.compareValue(c,u);case 2:return Nr.compareValue(c,-u);case 3:return Nr.compareValue(-u,c);case 4:return Nr.compareValue(-u,-c);case 5:return Nr.compareValue(-c,-u);case 6:return Nr.compareValue(-c,u);case 7:return Nr.compareValue(u,-c)}return Lt.shouldNeverReachHere("invalid octant value"),0},Nr.compareValue=function(n,i){return n<0?-1:n>0?1:i<0?-1:i>0?1:0};var zo=function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var n=arguments[0],i=arguments[1],s=arguments[2],u=arguments[3];this._segString=n,this.coord=new I(i),this.segmentIndex=s,this._segmentOctant=u,this._isInterior=!i.equals2D(n.getCoordinate(s))};zo.prototype.getCoordinate=function(){return this.coord},zo.prototype.print=function(n){n.print(this.coord),n.print(" seg # = "+this.segmentIndex)},zo.prototype.compareTo=function(n){var i=n;return this.segmentIndex<i.segmentIndex?-1:this.segmentIndex>i.segmentIndex?1:this.coord.equals2D(i.coord)?0:Nr.compare(this._segmentOctant,this.coord,i.coord)},zo.prototype.isEndPoint=function(n){return this.segmentIndex===0&&!this._isInterior||this.segmentIndex===n},zo.prototype.isInterior=function(){return this._isInterior},zo.prototype.interfaces_=function(){return[G]},zo.prototype.getClass=function(){return zo};var xr=function(){this._nodeMap=new x,this._edge=null;var n=arguments[0];this._edge=n};xr.prototype.getSplitCoordinates=function(){var n=new $;this.addEndpoints();for(var i=this.iterator(),s=i.next();i.hasNext();){var u=i.next();this.addEdgeCoordinates(s,u,n),s=u}return n.toCoordinateArray()},xr.prototype.addCollapsedNodes=function(){var n=new O;this.findCollapsesFromInsertedNodes(n),this.findCollapsesFromExistingVertices(n);for(var i=n.iterator();i.hasNext();){var s=i.next().intValue();this.add(this._edge.getCoordinate(s),s)}},xr.prototype.print=function(n){n.println("Intersections:");for(var i=this.iterator();i.hasNext();)i.next().print(n)},xr.prototype.findCollapsesFromExistingVertices=function(n){for(var i=0;i<this._edge.size()-2;i++){var s=this._edge.getCoordinate(i),u=this._edge.getCoordinate(i+2);s.equals2D(u)&&n.add(new it(i+1))}},xr.prototype.addEdgeCoordinates=function(n,i,s){var u=this._edge.getCoordinate(i.segmentIndex),c=i.isInterior()||!i.coord.equals2D(u);s.add(new I(n.coord),!1);for(var m=n.segmentIndex+1;m<=i.segmentIndex;m++)s.add(this._edge.getCoordinate(m));c&&s.add(new I(i.coord))},xr.prototype.iterator=function(){return this._nodeMap.values().iterator()},xr.prototype.addSplitEdges=function(n){this.addEndpoints(),this.addCollapsedNodes();for(var i=this.iterator(),s=i.next();i.hasNext();){var u=i.next(),c=this.createSplitEdge(s,u);n.add(c),s=u}},xr.prototype.findCollapseIndex=function(n,i,s){if(!n.coord.equals2D(i.coord))return!1;var u=i.segmentIndex-n.segmentIndex;return i.isInterior()||u--,u===1&&(s[0]=n.segmentIndex+1,!0)},xr.prototype.findCollapsesFromInsertedNodes=function(n){for(var i=new Array(1).fill(null),s=this.iterator(),u=s.next();s.hasNext();){var c=s.next();this.findCollapseIndex(u,c,i)&&n.add(new it(i[0])),u=c}},xr.prototype.getEdge=function(){return this._edge},xr.prototype.addEndpoints=function(){var n=this._edge.size()-1;this.add(this._edge.getCoordinate(0),0),this.add(this._edge.getCoordinate(n),n)},xr.prototype.createSplitEdge=function(n,i){var s=i.segmentIndex-n.segmentIndex+2,u=this._edge.getCoordinate(i.segmentIndex),c=i.isInterior()||!i.coord.equals2D(u);c||s--;var m=new Array(s).fill(null),E=0;m[E++]=new I(n.coord);for(var C=n.segmentIndex+1;C<=i.segmentIndex;C++)m[E++]=this._edge.getCoordinate(C);return c&&(m[E]=new I(i.coord)),new Dn(m,this._edge.getData())},xr.prototype.add=function(n,i){var s=new zo(this._edge,n,i,this._edge.getSegmentOctant(i)),u=this._nodeMap.get(s);return u!==null?(Lt.isTrue(u.coord.equals2D(n),"Found equal nodes with different coordinates"),u):(this._nodeMap.put(s,s),s)},xr.prototype.checkSplitEdgesCorrectness=function(n){var i=this._edge.getCoordinates(),s=n.get(0).getCoordinate(0);if(!s.equals2D(i[0]))throw new ie("bad split edge start point at "+s);var u=n.get(n.size()-1).getCoordinates(),c=u[u.length-1];if(!c.equals2D(i[i.length-1]))throw new ie("bad split edge end point at "+c)},xr.prototype.interfaces_=function(){return[]},xr.prototype.getClass=function(){return xr};var Zs=function(){};Zs.prototype.interfaces_=function(){return[]},Zs.prototype.getClass=function(){return Zs},Zs.octant=function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var n=arguments[0],i=arguments[1];if(n===0&&i===0)throw new A("Cannot compute the octant for point ( "+n+", "+i+" )");var s=Math.abs(n),u=Math.abs(i);return n>=0?i>=0?s>=u?0:1:s>=u?7:6:i>=0?s>=u?3:2:s>=u?4:5}if(arguments[0]instanceof I&&arguments[1]instanceof I){var c=arguments[0],m=arguments[1],E=m.x-c.x,C=m.y-c.y;if(E===0&&C===0)throw new A("Cannot compute the octant for two identical points "+c);return Zs.octant(E,C)}};var $i=function(){};$i.prototype.getCoordinates=function(){},$i.prototype.size=function(){},$i.prototype.getCoordinate=function(n){},$i.prototype.isClosed=function(){},$i.prototype.setData=function(n){},$i.prototype.getData=function(){},$i.prototype.interfaces_=function(){return[]},$i.prototype.getClass=function(){return $i};var nl=function(){};nl.prototype.addIntersection=function(n,i){},nl.prototype.interfaces_=function(){return[$i]},nl.prototype.getClass=function(){return nl};var Dn=function(){this._nodeList=new xr(this),this._pts=null,this._data=null;var n=arguments[0],i=arguments[1];this._pts=n,this._data=i};Dn.prototype.getCoordinates=function(){return this._pts},Dn.prototype.size=function(){return this._pts.length},Dn.prototype.getCoordinate=function(n){return this._pts[n]},Dn.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},Dn.prototype.getSegmentOctant=function(n){return n===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(n),this.getCoordinate(n+1))},Dn.prototype.setData=function(n){this._data=n},Dn.prototype.safeOctant=function(n,i){return n.equals2D(i)?0:Zs.octant(n,i)},Dn.prototype.getData=function(){return this._data},Dn.prototype.addIntersection=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];this.addIntersectionNode(n,i)}else if(arguments.length===4){var s=arguments[0],u=arguments[1],c=arguments[3],m=new I(s.getIntersection(c));this.addIntersection(m,u)}},Dn.prototype.toString=function(){return Wt.toLineString(new jt(this._pts))},Dn.prototype.getNodeList=function(){return this._nodeList},Dn.prototype.addIntersectionNode=function(n,i){var s=i,u=s+1;if(u<this._pts.length){var c=this._pts[u];n.equals2D(c)&&(s=u)}return this._nodeList.add(n,s)},Dn.prototype.addIntersections=function(n,i,s){for(var u=0;u<n.getIntersectionNum();u++)this.addIntersection(n,i,s,u)},Dn.prototype.interfaces_=function(){return[nl]},Dn.prototype.getClass=function(){return Dn},Dn.getNodedSubstrings=function(){if(arguments.length===1){var n=arguments[0],i=new O;return Dn.getNodedSubstrings(n,i),i}if(arguments.length===2)for(var s=arguments[0],u=arguments[1],c=s.iterator();c.hasNext();)c.next().getNodeList().addSplitEdges(u)};var Qt=function(){if(this.p0=null,this.p1=null,arguments.length===0)this.p0=new I,this.p1=new I;else if(arguments.length===1){var n=arguments[0];this.p0=new I(n.p0),this.p1=new I(n.p1)}else if(arguments.length===2)this.p0=arguments[0],this.p1=arguments[1];else if(arguments.length===4){var i=arguments[0],s=arguments[1],u=arguments[2],c=arguments[3];this.p0=new I(i,s),this.p1=new I(u,c)}},oy={serialVersionUID:{configurable:!0}};Qt.prototype.minX=function(){return Math.min(this.p0.x,this.p1.x)},Qt.prototype.orientationIndex=function(){if(arguments[0]instanceof Qt){var n=arguments[0],i=ot.orientationIndex(this.p0,this.p1,n.p0),s=ot.orientationIndex(this.p0,this.p1,n.p1);return i>=0&&s>=0||i<=0&&s<=0?Math.max(i,s):0}if(arguments[0]instanceof I){var u=arguments[0];return ot.orientationIndex(this.p0,this.p1,u)}},Qt.prototype.toGeometry=function(n){return n.createLineString([this.p0,this.p1])},Qt.prototype.isVertical=function(){return this.p0.x===this.p1.x},Qt.prototype.equals=function(n){if(!(n instanceof Qt))return!1;var i=n;return this.p0.equals(i.p0)&&this.p1.equals(i.p1)},Qt.prototype.intersection=function(n){var i=new N;return i.computeIntersection(this.p0,this.p1,n.p0,n.p1),i.hasIntersection()?i.getIntersection(0):null},Qt.prototype.project=function(){if(arguments[0]instanceof I){var n=arguments[0];if(n.equals(this.p0)||n.equals(this.p1))return new I(n);var i=this.projectionFactor(n),s=new I;return s.x=this.p0.x+i*(this.p1.x-this.p0.x),s.y=this.p0.y+i*(this.p1.y-this.p0.y),s}if(arguments[0]instanceof Qt){var u=arguments[0],c=this.projectionFactor(u.p0),m=this.projectionFactor(u.p1);if(c>=1&&m>=1||c<=0&&m<=0)return null;var E=this.project(u.p0);c<0&&(E=this.p0),c>1&&(E=this.p1);var C=this.project(u.p1);return m<0&&(C=this.p0),m>1&&(C=this.p1),new Qt(E,C)}},Qt.prototype.normalize=function(){this.p1.compareTo(this.p0)<0&&this.reverse()},Qt.prototype.angle=function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)},Qt.prototype.getCoordinate=function(n){return n===0?this.p0:this.p1},Qt.prototype.distancePerpendicular=function(n){return ot.distancePointLinePerpendicular(n,this.p0,this.p1)},Qt.prototype.minY=function(){return Math.min(this.p0.y,this.p1.y)},Qt.prototype.midPoint=function(){return Qt.midPoint(this.p0,this.p1)},Qt.prototype.projectionFactor=function(n){if(n.equals(this.p0))return 0;if(n.equals(this.p1))return 1;var i=this.p1.x-this.p0.x,s=this.p1.y-this.p0.y,u=i*i+s*s;return u<=0?S.NaN:((n.x-this.p0.x)*i+(n.y-this.p0.y)*s)/u},Qt.prototype.closestPoints=function(n){var i=this.intersection(n);if(i!==null)return[i,i];var s=new Array(2).fill(null),u=S.MAX_VALUE,c=null,m=this.closestPoint(n.p0);u=m.distance(n.p0),s[0]=m,s[1]=n.p0;var E=this.closestPoint(n.p1);(c=E.distance(n.p1))<u&&(u=c,s[0]=E,s[1]=n.p1);var C=n.closestPoint(this.p0);(c=C.distance(this.p0))<u&&(u=c,s[0]=this.p0,s[1]=C);var U=n.closestPoint(this.p1);return(c=U.distance(this.p1))<u&&(u=c,s[0]=this.p1,s[1]=U),s},Qt.prototype.closestPoint=function(n){var i=this.projectionFactor(n);return i>0&&i<1?this.project(n):this.p0.distance(n)<this.p1.distance(n)?this.p0:this.p1},Qt.prototype.maxX=function(){return Math.max(this.p0.x,this.p1.x)},Qt.prototype.getLength=function(){return this.p0.distance(this.p1)},Qt.prototype.compareTo=function(n){var i=n,s=this.p0.compareTo(i.p0);return s!==0?s:this.p1.compareTo(i.p1)},Qt.prototype.reverse=function(){var n=this.p0;this.p0=this.p1,this.p1=n},Qt.prototype.equalsTopo=function(n){return this.p0.equals(n.p0)&&(this.p1.equals(n.p1)||this.p0.equals(n.p1))&&this.p1.equals(n.p0)},Qt.prototype.lineIntersection=function(n){try{return Dt.intersection(this.p0,this.p1,n.p0,n.p1)}catch(i){if(!(i instanceof $t))throw i}return null},Qt.prototype.maxY=function(){return Math.max(this.p0.y,this.p1.y)},Qt.prototype.pointAlongOffset=function(n,i){var s=this.p0.x+n*(this.p1.x-this.p0.x),u=this.p0.y+n*(this.p1.y-this.p0.y),c=this.p1.x-this.p0.x,m=this.p1.y-this.p0.y,E=Math.sqrt(c*c+m*m),C=0,U=0;if(i!==0){if(E<=0)throw new Error("Cannot compute offset from zero-length line segment");C=i*c/E,U=i*m/E}return new I(s-U,u+C)},Qt.prototype.setCoordinates=function(){if(arguments.length===1){var n=arguments[0];this.setCoordinates(n.p0,n.p1)}else if(arguments.length===2){var i=arguments[0],s=arguments[1];this.p0.x=i.x,this.p0.y=i.y,this.p1.x=s.x,this.p1.y=s.y}},Qt.prototype.segmentFraction=function(n){var i=this.projectionFactor(n);return i<0?i=0:(i>1||S.isNaN(i))&&(i=1),i},Qt.prototype.toString=function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"},Qt.prototype.isHorizontal=function(){return this.p0.y===this.p1.y},Qt.prototype.distance=function(){if(arguments[0]instanceof Qt){var n=arguments[0];return ot.distanceLineLine(this.p0,this.p1,n.p0,n.p1)}if(arguments[0]instanceof I){var i=arguments[0];return ot.distancePointLine(i,this.p0,this.p1)}},Qt.prototype.pointAlong=function(n){var i=new I;return i.x=this.p0.x+n*(this.p1.x-this.p0.x),i.y=this.p0.y+n*(this.p1.y-this.p0.y),i},Qt.prototype.hashCode=function(){var n=S.doubleToLongBits(this.p0.x);n^=31*S.doubleToLongBits(this.p0.y);var i=Math.trunc(n)^Math.trunc(n>>32),s=S.doubleToLongBits(this.p1.x);return s^=31*S.doubleToLongBits(this.p1.y),i^(Math.trunc(s)^Math.trunc(s>>32))},Qt.prototype.interfaces_=function(){return[G,t]},Qt.prototype.getClass=function(){return Qt},Qt.midPoint=function(n,i){return new I((n.x+i.x)/2,(n.y+i.y)/2)},oy.serialVersionUID.get=function(){return 0x2d2172135f411c00},Object.defineProperties(Qt,oy);var rl=function(){this.tempEnv1=new At,this.tempEnv2=new At,this._overlapSeg1=new Qt,this._overlapSeg2=new Qt};rl.prototype.overlap=function(){if(arguments.length!==2){if(arguments.length===4){var n=arguments[0],i=arguments[1],s=arguments[2],u=arguments[3];n.getLineSegment(i,this._overlapSeg1),s.getLineSegment(u,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}}},rl.prototype.interfaces_=function(){return[]},rl.prototype.getClass=function(){return rl};var Xr=function(){this._pts=null,this._start=null,this._end=null,this._env=null,this._context=null,this._id=null;var n=arguments[0],i=arguments[1],s=arguments[2],u=arguments[3];this._pts=n,this._start=i,this._end=s,this._context=u};Xr.prototype.getLineSegment=function(n,i){i.p0=this._pts[n],i.p1=this._pts[n+1]},Xr.prototype.computeSelect=function(n,i,s,u){var c=this._pts[i],m=this._pts[s];if(u.tempEnv1.init(c,m),s-i==1)return u.select(this,i),null;if(!n.intersects(u.tempEnv1))return null;var E=Math.trunc((i+s)/2);i<E&&this.computeSelect(n,i,E,u),E<s&&this.computeSelect(n,E,s,u)},Xr.prototype.getCoordinates=function(){for(var n=new Array(this._end-this._start+1).fill(null),i=0,s=this._start;s<=this._end;s++)n[i++]=this._pts[s];return n},Xr.prototype.computeOverlaps=function(n,i){this.computeOverlapsInternal(this._start,this._end,n,n._start,n._end,i)},Xr.prototype.setId=function(n){this._id=n},Xr.prototype.select=function(n,i){this.computeSelect(n,this._start,this._end,i)},Xr.prototype.getEnvelope=function(){if(this._env===null){var n=this._pts[this._start],i=this._pts[this._end];this._env=new At(n,i)}return this._env},Xr.prototype.getEndIndex=function(){return this._end},Xr.prototype.getStartIndex=function(){return this._start},Xr.prototype.getContext=function(){return this._context},Xr.prototype.getId=function(){return this._id},Xr.prototype.computeOverlapsInternal=function(n,i,s,u,c,m){var E=this._pts[n],C=this._pts[i],U=s._pts[u],Z=s._pts[c];if(i-n==1&&c-u==1)return m.overlap(this,n,s,u),null;if(m.tempEnv1.init(E,C),m.tempEnv2.init(U,Z),!m.tempEnv1.intersects(m.tempEnv2))return null;var pt=Math.trunc((n+i)/2),gt=Math.trunc((u+c)/2);n<pt&&(u<gt&&this.computeOverlapsInternal(n,pt,s,u,gt,m),gt<c&&this.computeOverlapsInternal(n,pt,s,gt,c,m)),pt<i&&(u<gt&&this.computeOverlapsInternal(pt,i,s,u,gt,m),gt<c&&this.computeOverlapsInternal(pt,i,s,gt,c,m))},Xr.prototype.interfaces_=function(){return[]},Xr.prototype.getClass=function(){return Xr};var Ui=function(){};Ui.prototype.interfaces_=function(){return[]},Ui.prototype.getClass=function(){return Ui},Ui.getChainStartIndices=function(n){var i=0,s=new O;s.add(new it(i));do{var u=Ui.findChainEnd(n,i);s.add(new it(u)),i=u}while(i<n.length-1);return Ui.toIntArray(s)},Ui.findChainEnd=function(n,i){for(var s=i;s<n.length-1&&n[s].equals2D(n[s+1]);)s++;if(s>=n.length-1)return n.length-1;for(var u=dn.quadrant(n[s],n[s+1]),c=i+1;c<n.length&&!(!n[c-1].equals2D(n[c])&&dn.quadrant(n[c-1],n[c])!==u);)c++;return c-1},Ui.getChains=function(){if(arguments.length===1){var n=arguments[0];return Ui.getChains(n,null)}if(arguments.length===2){for(var i=arguments[0],s=arguments[1],u=new O,c=Ui.getChainStartIndices(i),m=0;m<c.length-1;m++){var E=new Xr(i,c[m],c[m+1],s);u.add(E)}return u}},Ui.toIntArray=function(n){for(var i=new Array(n.size()).fill(null),s=0;s<i.length;s++)i[s]=n.get(s).intValue();return i};var cs=function(){};cs.prototype.computeNodes=function(n){},cs.prototype.getNodedSubstrings=function(){},cs.prototype.interfaces_=function(){return[]},cs.prototype.getClass=function(){return cs};var il=function(){if(this._segInt=null,arguments.length!==0){if(arguments.length===1){var n=arguments[0];this.setSegmentIntersector(n)}}};il.prototype.setSegmentIntersector=function(n){this._segInt=n},il.prototype.interfaces_=function(){return[cs]},il.prototype.getClass=function(){return il};var ip=function(n){function i(u){u?n.call(this,u):n.call(this),this._monoChains=new O,this._index=new ry,this._idCounter=0,this._nodedSegStrings=null,this._nOverlaps=0}n&&(i.__proto__=n),(i.prototype=Object.create(n&&n.prototype)).constructor=i;var s={SegmentOverlapAction:{configurable:!0}};return i.prototype.getMonotoneChains=function(){return this._monoChains},i.prototype.getNodedSubstrings=function(){return Dn.getNodedSubstrings(this._nodedSegStrings)},i.prototype.getIndex=function(){return this._index},i.prototype.add=function(u){for(var c=Ui.getChains(u.getCoordinates(),u).iterator();c.hasNext();){var m=c.next();m.setId(this._idCounter++),this._index.insert(m.getEnvelope(),m),this._monoChains.add(m)}},i.prototype.computeNodes=function(u){this._nodedSegStrings=u;for(var c=u.iterator();c.hasNext();)this.add(c.next());this.intersectChains()},i.prototype.intersectChains=function(){for(var u=new sy(this._segInt),c=this._monoChains.iterator();c.hasNext();)for(var m=c.next(),E=this._index.query(m.getEnvelope()).iterator();E.hasNext();){var C=E.next();if(C.getId()>m.getId()&&(m.computeOverlaps(C,u),this._nOverlaps++),this._segInt.isDone())return null}},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},s.SegmentOverlapAction.get=function(){return sy},Object.defineProperties(i,s),i}(il),sy=function(n){function i(){n.call(this),this._si=null;var s=arguments[0];this._si=s}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.overlap=function(){if(arguments.length!==4)return n.prototype.overlap.apply(this,arguments);var s=arguments[0],u=arguments[1],c=arguments[2],m=arguments[3],E=s.getContext(),C=c.getContext();this._si.processIntersections(E,u,C,m)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(rl),Ze=function n(){if(this._quadrantSegments=n.DEFAULT_QUADRANT_SEGMENTS,this._endCapStyle=n.CAP_ROUND,this._joinStyle=n.JOIN_ROUND,this._mitreLimit=n.DEFAULT_MITRE_LIMIT,this._isSingleSided=!1,this._simplifyFactor=n.DEFAULT_SIMPLIFY_FACTOR,arguments.length!==0){if(arguments.length===1){var i=arguments[0];this.setQuadrantSegments(i)}else if(arguments.length===2){var s=arguments[0],u=arguments[1];this.setQuadrantSegments(s),this.setEndCapStyle(u)}else if(arguments.length===4){var c=arguments[0],m=arguments[1],E=arguments[2],C=arguments[3];this.setQuadrantSegments(c),this.setEndCapStyle(m),this.setJoinStyle(E),this.setMitreLimit(C)}}},Mo={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}};Ze.prototype.getEndCapStyle=function(){return this._endCapStyle},Ze.prototype.isSingleSided=function(){return this._isSingleSided},Ze.prototype.setQuadrantSegments=function(n){this._quadrantSegments=n,this._quadrantSegments===0&&(this._joinStyle=Ze.JOIN_BEVEL),this._quadrantSegments<0&&(this._joinStyle=Ze.JOIN_MITRE,this._mitreLimit=Math.abs(this._quadrantSegments)),n<=0&&(this._quadrantSegments=1),this._joinStyle!==Ze.JOIN_ROUND&&(this._quadrantSegments=Ze.DEFAULT_QUADRANT_SEGMENTS)},Ze.prototype.getJoinStyle=function(){return this._joinStyle},Ze.prototype.setJoinStyle=function(n){this._joinStyle=n},Ze.prototype.setSimplifyFactor=function(n){this._simplifyFactor=n<0?0:n},Ze.prototype.getSimplifyFactor=function(){return this._simplifyFactor},Ze.prototype.getQuadrantSegments=function(){return this._quadrantSegments},Ze.prototype.setEndCapStyle=function(n){this._endCapStyle=n},Ze.prototype.getMitreLimit=function(){return this._mitreLimit},Ze.prototype.setMitreLimit=function(n){this._mitreLimit=n},Ze.prototype.setSingleSided=function(n){this._isSingleSided=n},Ze.prototype.interfaces_=function(){return[]},Ze.prototype.getClass=function(){return Ze},Ze.bufferDistanceError=function(n){var i=Math.PI/2/n;return 1-Math.cos(i/2)},Mo.CAP_ROUND.get=function(){return 1},Mo.CAP_FLAT.get=function(){return 2},Mo.CAP_SQUARE.get=function(){return 3},Mo.JOIN_ROUND.get=function(){return 1},Mo.JOIN_MITRE.get=function(){return 2},Mo.JOIN_BEVEL.get=function(){return 3},Mo.DEFAULT_QUADRANT_SEGMENTS.get=function(){return 8},Mo.DEFAULT_MITRE_LIMIT.get=function(){return 5},Mo.DEFAULT_SIMPLIFY_FACTOR.get=function(){return .01},Object.defineProperties(Ze,Mo);var Ln=function(n){this._distanceTol=null,this._isDeleted=null,this._angleOrientation=ot.COUNTERCLOCKWISE,this._inputLine=n||null},ol={INIT:{configurable:!0},DELETE:{configurable:!0},KEEP:{configurable:!0},NUM_PTS_TO_CHECK:{configurable:!0}};Ln.prototype.isDeletable=function(n,i,s,u){var c=this._inputLine[n],m=this._inputLine[i],E=this._inputLine[s];return!!this.isConcave(c,m,E)&&!!this.isShallow(c,m,E,u)&&this.isShallowSampled(c,m,n,s,u)},Ln.prototype.deleteShallowConcavities=function(){for(var n=1,i=this.findNextNonDeletedIndex(n),s=this.findNextNonDeletedIndex(i),u=!1;s<this._inputLine.length;){var c=!1;this.isDeletable(n,i,s,this._distanceTol)&&(this._isDeleted[i]=Ln.DELETE,c=!0,u=!0),n=c?s:i,i=this.findNextNonDeletedIndex(n),s=this.findNextNonDeletedIndex(i)}return u},Ln.prototype.isShallowConcavity=function(n,i,s,u){return ot.computeOrientation(n,i,s)!==this._angleOrientation?!1:ot.distancePointLine(i,n,s)<u},Ln.prototype.isShallowSampled=function(n,i,s,u,c){var m=Math.trunc((u-s)/Ln.NUM_PTS_TO_CHECK);m<=0&&(m=1);for(var E=s;E<u;E+=m)if(!this.isShallow(n,i,this._inputLine[E],c))return!1;return!0},Ln.prototype.isConcave=function(n,i,s){var u=ot.computeOrientation(n,i,s)===this._angleOrientation;return u},Ln.prototype.simplify=function(n){this._distanceTol=Math.abs(n),n<0&&(this._angleOrientation=ot.CLOCKWISE),this._isDeleted=new Array(this._inputLine.length).fill(null);var i=!1;do i=this.deleteShallowConcavities();while(i);return this.collapseLine()},Ln.prototype.findNextNonDeletedIndex=function(n){for(var i=n+1;i<this._inputLine.length&&this._isDeleted[i]===Ln.DELETE;)i++;return i},Ln.prototype.isShallow=function(n,i,s,u){return ot.distancePointLine(i,n,s)<u},Ln.prototype.collapseLine=function(){for(var n=new $,i=0;i<this._inputLine.length;i++)this._isDeleted[i]!==Ln.DELETE&&n.add(this._inputLine[i]);return n.toCoordinateArray()},Ln.prototype.interfaces_=function(){return[]},Ln.prototype.getClass=function(){return Ln},Ln.simplify=function(n,i){return new Ln(n).simplify(i)},ol.INIT.get=function(){return 0},ol.DELETE.get=function(){return 1},ol.KEEP.get=function(){return 1},ol.NUM_PTS_TO_CHECK.get=function(){return 10},Object.defineProperties(Ln,ol);var ii=function(){this._ptList=null,this._precisionModel=null,this._minimimVertexDistance=0,this._ptList=new O},ay={COORDINATE_ARRAY_TYPE:{configurable:!0}};ii.prototype.getCoordinates=function(){return this._ptList.toArray(ii.COORDINATE_ARRAY_TYPE)},ii.prototype.setPrecisionModel=function(n){this._precisionModel=n},ii.prototype.addPt=function(n){var i=new I(n);if(this._precisionModel.makePrecise(i),this.isRedundant(i))return null;this._ptList.add(i)},ii.prototype.revere=function(){},ii.prototype.addPts=function(n,i){if(i)for(var s=0;s<n.length;s++)this.addPt(n[s]);else for(var u=n.length-1;u>=0;u--)this.addPt(n[u])},ii.prototype.isRedundant=function(n){if(this._ptList.size()<1)return!1;var i=this._ptList.get(this._ptList.size()-1);return n.distance(i)<this._minimimVertexDistance},ii.prototype.toString=function(){return new pe().createLineString(this.getCoordinates()).toString()},ii.prototype.closeRing=function(){if(this._ptList.size()<1)return null;var n=new I(this._ptList.get(0)),i=this._ptList.get(this._ptList.size()-1);if(n.equals(i))return null;this._ptList.add(n)},ii.prototype.setMinimumVertexDistance=function(n){this._minimimVertexDistance=n},ii.prototype.interfaces_=function(){return[]},ii.prototype.getClass=function(){return ii},ay.COORDINATE_ARRAY_TYPE.get=function(){return new Array(0).fill(null)},Object.defineProperties(ii,ay);var ve=function(){},Js={PI_TIMES_2:{configurable:!0},PI_OVER_2:{configurable:!0},PI_OVER_4:{configurable:!0},COUNTERCLOCKWISE:{configurable:!0},CLOCKWISE:{configurable:!0},NONE:{configurable:!0}};ve.prototype.interfaces_=function(){return[]},ve.prototype.getClass=function(){return ve},ve.toDegrees=function(n){return 180*n/Math.PI},ve.normalize=function(n){for(;n>Math.PI;)n-=ve.PI_TIMES_2;for(;n<=-Math.PI;)n+=ve.PI_TIMES_2;return n},ve.angle=function(){if(arguments.length===1){var n=arguments[0];return Math.atan2(n.y,n.x)}if(arguments.length===2){var i=arguments[0],s=arguments[1],u=s.x-i.x,c=s.y-i.y;return Math.atan2(c,u)}},ve.isAcute=function(n,i,s){var u=n.x-i.x,c=n.y-i.y;return u*(s.x-i.x)+c*(s.y-i.y)>0},ve.isObtuse=function(n,i,s){var u=n.x-i.x,c=n.y-i.y;return u*(s.x-i.x)+c*(s.y-i.y)<0},ve.interiorAngle=function(n,i,s){var u=ve.angle(i,n),c=ve.angle(i,s);return Math.abs(c-u)},ve.normalizePositive=function(n){if(n<0){for(;n<0;)n+=ve.PI_TIMES_2;n>=ve.PI_TIMES_2&&(n=0)}else{for(;n>=ve.PI_TIMES_2;)n-=ve.PI_TIMES_2;n<0&&(n=0)}return n},ve.angleBetween=function(n,i,s){var u=ve.angle(i,n),c=ve.angle(i,s);return ve.diff(u,c)},ve.diff=function(n,i){var s=null;return(s=n<i?i-n:n-i)>Math.PI&&(s=2*Math.PI-s),s},ve.toRadians=function(n){return n*Math.PI/180},ve.getTurn=function(n,i){var s=Math.sin(i-n);return s>0?ve.COUNTERCLOCKWISE:s<0?ve.CLOCKWISE:ve.NONE},ve.angleBetweenOriented=function(n,i,s){var u=ve.angle(i,n),c=ve.angle(i,s)-u;return c<=-Math.PI?c+ve.PI_TIMES_2:c>Math.PI?c-ve.PI_TIMES_2:c},Js.PI_TIMES_2.get=function(){return 2*Math.PI},Js.PI_OVER_2.get=function(){return Math.PI/2},Js.PI_OVER_4.get=function(){return Math.PI/4},Js.COUNTERCLOCKWISE.get=function(){return ot.COUNTERCLOCKWISE},Js.CLOCKWISE.get=function(){return ot.CLOCKWISE},Js.NONE.get=function(){return ot.COLLINEAR},Object.defineProperties(ve,Js);var wn=function n(){this._maxCurveSegmentError=0,this._filletAngleQuantum=null,this._closingSegLengthFactor=1,this._segList=null,this._distance=0,this._precisionModel=null,this._bufParams=null,this._li=null,this._s0=null,this._s1=null,this._s2=null,this._seg0=new Qt,this._seg1=new Qt,this._offset0=new Qt,this._offset1=new Qt,this._side=0,this._hasNarrowConcaveAngle=!1;var i=arguments[0],s=arguments[1],u=arguments[2];this._precisionModel=i,this._bufParams=s,this._li=new N,this._filletAngleQuantum=Math.PI/2/s.getQuadrantSegments(),s.getQuadrantSegments()>=8&&s.getJoinStyle()===Ze.JOIN_ROUND&&(this._closingSegLengthFactor=n.MAX_CLOSING_SEG_LEN_FACTOR),this.init(u)},sl={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}};wn.prototype.addNextSegment=function(n,i){if(this._s0=this._s1,this._s1=this._s2,this._s2=n,this._seg0.setCoordinates(this._s0,this._s1),this.computeOffsetSegment(this._seg0,this._side,this._distance,this._offset0),this._seg1.setCoordinates(this._s1,this._s2),this.computeOffsetSegment(this._seg1,this._side,this._distance,this._offset1),this._s1.equals(this._s2))return null;var s=ot.computeOrientation(this._s0,this._s1,this._s2),u=s===ot.CLOCKWISE&&this._side===It.LEFT||s===ot.COUNTERCLOCKWISE&&this._side===It.RIGHT;s===0?this.addCollinear(i):u?this.addOutsideTurn(s,i):this.addInsideTurn(s,i)},wn.prototype.addLineEndCap=function(n,i){var s=new Qt(n,i),u=new Qt;this.computeOffsetSegment(s,It.LEFT,this._distance,u);var c=new Qt;this.computeOffsetSegment(s,It.RIGHT,this._distance,c);var m=i.x-n.x,E=i.y-n.y,C=Math.atan2(E,m);switch(this._bufParams.getEndCapStyle()){case Ze.CAP_ROUND:this._segList.addPt(u.p1),this.addFilletArc(i,C+Math.PI/2,C-Math.PI/2,ot.CLOCKWISE,this._distance),this._segList.addPt(c.p1);break;case Ze.CAP_FLAT:this._segList.addPt(u.p1),this._segList.addPt(c.p1);break;case Ze.CAP_SQUARE:var U=new I;U.x=Math.abs(this._distance)*Math.cos(C),U.y=Math.abs(this._distance)*Math.sin(C);var Z=new I(u.p1.x+U.x,u.p1.y+U.y),pt=new I(c.p1.x+U.x,c.p1.y+U.y);this._segList.addPt(Z),this._segList.addPt(pt)}},wn.prototype.getCoordinates=function(){return this._segList.getCoordinates()},wn.prototype.addMitreJoin=function(n,i,s,u){var c=!0,m=null;try{m=Dt.intersection(i.p0,i.p1,s.p0,s.p1),(u<=0?1:m.distance(n)/Math.abs(u))>this._bufParams.getMitreLimit()&&(c=!1)}catch(E){if(!(E instanceof $t))throw E;m=new I(0,0),c=!1}c?this._segList.addPt(m):this.addLimitedMitreJoin(i,s,u,this._bufParams.getMitreLimit())},wn.prototype.addFilletCorner=function(n,i,s,u,c){var m=i.x-n.x,E=i.y-n.y,C=Math.atan2(E,m),U=s.x-n.x,Z=s.y-n.y,pt=Math.atan2(Z,U);u===ot.CLOCKWISE?C<=pt&&(C+=2*Math.PI):C>=pt&&(C-=2*Math.PI),this._segList.addPt(i),this.addFilletArc(n,C,pt,u,c),this._segList.addPt(s)},wn.prototype.addOutsideTurn=function(n,i){if(this._offset0.p1.distance(this._offset1.p0)<this._distance*wn.OFFSET_SEGMENT_SEPARATION_FACTOR)return this._segList.addPt(this._offset0.p1),null;this._bufParams.getJoinStyle()===Ze.JOIN_MITRE?this.addMitreJoin(this._s1,this._offset0,this._offset1,this._distance):this._bufParams.getJoinStyle()===Ze.JOIN_BEVEL?this.addBevelJoin(this._offset0,this._offset1):(i&&this._segList.addPt(this._offset0.p1),this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,n,this._distance),this._segList.addPt(this._offset1.p0))},wn.prototype.createSquare=function(n){this._segList.addPt(new I(n.x+this._distance,n.y+this._distance)),this._segList.addPt(new I(n.x+this._distance,n.y-this._distance)),this._segList.addPt(new I(n.x-this._distance,n.y-this._distance)),this._segList.addPt(new I(n.x-this._distance,n.y+this._distance)),this._segList.closeRing()},wn.prototype.addSegments=function(n,i){this._segList.addPts(n,i)},wn.prototype.addFirstSegment=function(){this._segList.addPt(this._offset1.p0)},wn.prototype.addLastSegment=function(){this._segList.addPt(this._offset1.p1)},wn.prototype.initSideSegments=function(n,i,s){this._s1=n,this._s2=i,this._side=s,this._seg1.setCoordinates(n,i),this.computeOffsetSegment(this._seg1,s,this._distance,this._offset1)},wn.prototype.addLimitedMitreJoin=function(n,i,s,u){var c=this._seg0.p1,m=ve.angle(c,this._seg0.p0),E=ve.angleBetweenOriented(this._seg0.p0,c,this._seg1.p1)/2,C=ve.normalize(m+E),U=ve.normalize(C+Math.PI),Z=u*s,pt=s-Z*Math.abs(Math.sin(E)),gt=c.x+Z*Math.cos(U),Rt=c.y+Z*Math.sin(U),Ft=new I(gt,Rt),Vt=new Qt(c,Ft),ee=Vt.pointAlongOffset(1,pt),hn=Vt.pointAlongOffset(1,-pt);this._side===It.LEFT?(this._segList.addPt(ee),this._segList.addPt(hn)):(this._segList.addPt(hn),this._segList.addPt(ee))},wn.prototype.computeOffsetSegment=function(n,i,s,u){var c=i===It.LEFT?1:-1,m=n.p1.x-n.p0.x,E=n.p1.y-n.p0.y,C=Math.sqrt(m*m+E*E),U=c*s*m/C,Z=c*s*E/C;u.p0.x=n.p0.x-Z,u.p0.y=n.p0.y+U,u.p1.x=n.p1.x-Z,u.p1.y=n.p1.y+U},wn.prototype.addFilletArc=function(n,i,s,u,c){var m=u===ot.CLOCKWISE?-1:1,E=Math.abs(i-s),C=Math.trunc(E/this._filletAngleQuantum+.5);if(C<1)return null;for(var U=E/C,Z=0,pt=new I;Z<E;){var gt=i+m*Z;pt.x=n.x+c*Math.cos(gt),pt.y=n.y+c*Math.sin(gt),this._segList.addPt(pt),Z+=U}},wn.prototype.addInsideTurn=function(n,i){if(this._li.computeIntersection(this._offset0.p0,this._offset0.p1,this._offset1.p0,this._offset1.p1),this._li.hasIntersection())this._segList.addPt(this._li.getIntersection(0));else if(this._hasNarrowConcaveAngle=!0,this._offset0.p1.distance(this._offset1.p0)<this._distance*wn.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR)this._segList.addPt(this._offset0.p1);else{if(this._segList.addPt(this._offset0.p1),this._closingSegLengthFactor>0){var s=new I((this._closingSegLengthFactor*this._offset0.p1.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset0.p1.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(s);var u=new I((this._closingSegLengthFactor*this._offset1.p0.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset1.p0.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(u)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}},wn.prototype.createCircle=function(n){var i=new I(n.x+this._distance,n.y);this._segList.addPt(i),this.addFilletArc(n,0,2*Math.PI,-1,this._distance),this._segList.closeRing()},wn.prototype.addBevelJoin=function(n,i){this._segList.addPt(n.p1),this._segList.addPt(i.p0)},wn.prototype.init=function(n){this._distance=n,this._maxCurveSegmentError=n*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new ii,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(n*wn.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)},wn.prototype.addCollinear=function(n){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2),this._li.getIntersectionNum()>=2&&(this._bufParams.getJoinStyle()===Ze.JOIN_BEVEL||this._bufParams.getJoinStyle()===Ze.JOIN_MITRE?(n&&this._segList.addPt(this._offset0.p1),this._segList.addPt(this._offset1.p0)):this.addFilletCorner(this._s1,this._offset0.p1,this._offset1.p0,ot.CLOCKWISE,this._distance))},wn.prototype.closeRing=function(){this._segList.closeRing()},wn.prototype.hasNarrowConcaveAngle=function(){return this._hasNarrowConcaveAngle},wn.prototype.interfaces_=function(){return[]},wn.prototype.getClass=function(){return wn},sl.OFFSET_SEGMENT_SEPARATION_FACTOR.get=function(){return .001},sl.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return .001},sl.CURVE_VERTEX_SNAP_DISTANCE_FACTOR.get=function(){return 1e-6},sl.MAX_CLOSING_SEG_LEN_FACTOR.get=function(){return 80},Object.defineProperties(wn,sl);var Or=function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var n=arguments[0],i=arguments[1];this._precisionModel=n,this._bufParams=i};Or.prototype.getOffsetCurve=function(n,i){if(this._distance=i,i===0)return null;var s=i<0,u=Math.abs(i),c=this.getSegGen(u);n.length<=1?this.computePointCurve(n[0],c):this.computeOffsetCurve(n,s,c);var m=c.getCoordinates();return s&&Q.reverse(m),m},Or.prototype.computeSingleSidedBufferCurve=function(n,i,s){var u=this.simplifyTolerance(this._distance);if(i){s.addSegments(n,!0);var c=Ln.simplify(n,-u),m=c.length-1;s.initSideSegments(c[m],c[m-1],It.LEFT),s.addFirstSegment();for(var E=m-2;E>=0;E--)s.addNextSegment(c[E],!0)}else{s.addSegments(n,!1);var C=Ln.simplify(n,u),U=C.length-1;s.initSideSegments(C[0],C[1],It.LEFT),s.addFirstSegment();for(var Z=2;Z<=U;Z++)s.addNextSegment(C[Z],!0)}s.addLastSegment(),s.closeRing()},Or.prototype.computeRingBufferCurve=function(n,i,s){var u=this.simplifyTolerance(this._distance);i===It.RIGHT&&(u=-u);var c=Ln.simplify(n,u),m=c.length-1;s.initSideSegments(c[m-1],c[0],i);for(var E=1;E<=m;E++){var C=E!==1;s.addNextSegment(c[E],C)}s.closeRing()},Or.prototype.computeLineBufferCurve=function(n,i){var s=this.simplifyTolerance(this._distance),u=Ln.simplify(n,s),c=u.length-1;i.initSideSegments(u[0],u[1],It.LEFT);for(var m=2;m<=c;m++)i.addNextSegment(u[m],!0);i.addLastSegment(),i.addLineEndCap(u[c-1],u[c]);var E=Ln.simplify(n,-s),C=E.length-1;i.initSideSegments(E[C],E[C-1],It.LEFT);for(var U=C-2;U>=0;U--)i.addNextSegment(E[U],!0);i.addLastSegment(),i.addLineEndCap(E[1],E[0]),i.closeRing()},Or.prototype.computePointCurve=function(n,i){switch(this._bufParams.getEndCapStyle()){case Ze.CAP_ROUND:i.createCircle(n);break;case Ze.CAP_SQUARE:i.createSquare(n)}},Or.prototype.getLineCurve=function(n,i){if(this._distance=i,i<0&&!this._bufParams.isSingleSided()||i===0)return null;var s=Math.abs(i),u=this.getSegGen(s);if(n.length<=1)this.computePointCurve(n[0],u);else if(this._bufParams.isSingleSided()){var c=i<0;this.computeSingleSidedBufferCurve(n,c,u)}else this.computeLineBufferCurve(n,u);return u.getCoordinates()},Or.prototype.getBufferParameters=function(){return this._bufParams},Or.prototype.simplifyTolerance=function(n){return n*this._bufParams.getSimplifyFactor()},Or.prototype.getRingCurve=function(n,i,s){if(this._distance=s,n.length<=2)return this.getLineCurve(n,s);if(s===0)return Or.copyCoordinates(n);var u=this.getSegGen(s);return this.computeRingBufferCurve(n,i,u),u.getCoordinates()},Or.prototype.computeOffsetCurve=function(n,i,s){var u=this.simplifyTolerance(this._distance);if(i){var c=Ln.simplify(n,-u),m=c.length-1;s.initSideSegments(c[m],c[m-1],It.LEFT),s.addFirstSegment();for(var E=m-2;E>=0;E--)s.addNextSegment(c[E],!0)}else{var C=Ln.simplify(n,u),U=C.length-1;s.initSideSegments(C[0],C[1],It.LEFT),s.addFirstSegment();for(var Z=2;Z<=U;Z++)s.addNextSegment(C[Z],!0)}s.addLastSegment()},Or.prototype.getSegGen=function(n){return new wn(this._precisionModel,this._bufParams,n)},Or.prototype.interfaces_=function(){return[]},Or.prototype.getClass=function(){return Or},Or.copyCoordinates=function(n){for(var i=new Array(n.length).fill(null),s=0;s<i.length;s++)i[s]=new I(n[s]);return i};var Ks=function(){this._subgraphs=null,this._seg=new Qt,this._cga=new ot;var n=arguments[0];this._subgraphs=n},uy={DepthSegment:{configurable:!0}};Ks.prototype.findStabbedSegments=function(){if(arguments.length===1){for(var n=arguments[0],i=new O,s=this._subgraphs.iterator();s.hasNext();){var u=s.next(),c=u.getEnvelope();n.y<c.getMinY()||n.y>c.getMaxY()||this.findStabbedSegments(n,u.getDirectedEdges(),i)}return i}if(arguments.length===3){if(X(arguments[2],ct)&&arguments[0]instanceof I&&arguments[1]instanceof rp){for(var m=arguments[0],E=arguments[1],C=arguments[2],U=E.getEdge().getCoordinates(),Z=0;Z<U.length-1;Z++)if(this._seg.p0=U[Z],this._seg.p1=U[Z+1],this._seg.p0.y>this._seg.p1.y&&this._seg.reverse(),!(Math.max(this._seg.p0.x,this._seg.p1.x)<m.x)&&!(this._seg.isHorizontal()||m.y<this._seg.p0.y||m.y>this._seg.p1.y||ot.computeOrientation(this._seg.p0,this._seg.p1,m)===ot.RIGHT)){var pt=E.getDepth(It.LEFT);this._seg.p0.equals(U[Z])||(pt=E.getDepth(It.RIGHT));var gt=new fs(this._seg,pt);C.add(gt)}}else if(X(arguments[2],ct)&&arguments[0]instanceof I&&X(arguments[1],ct))for(var Rt=arguments[0],Ft=arguments[1],Vt=arguments[2],ee=Ft.iterator();ee.hasNext();){var hn=ee.next();hn.isForward()&&this.findStabbedSegments(Rt,hn,Vt)}}},Ks.prototype.getDepth=function(n){var i=this.findStabbedSegments(n);return i.size()===0?0:Ti.min(i)._leftDepth},Ks.prototype.interfaces_=function(){return[]},Ks.prototype.getClass=function(){return Ks},uy.DepthSegment.get=function(){return fs},Object.defineProperties(Ks,uy);var fs=function(){this._upwardSeg=null,this._leftDepth=null;var n=arguments[0],i=arguments[1];this._upwardSeg=new Qt(n),this._leftDepth=i};fs.prototype.compareTo=function(n){var i=n;if(this._upwardSeg.minX()>=i._upwardSeg.maxX())return 1;if(this._upwardSeg.maxX()<=i._upwardSeg.minX())return-1;var s=this._upwardSeg.orientationIndex(i._upwardSeg);return s!==0||(s=-1*i._upwardSeg.orientationIndex(this._upwardSeg))!=0?s:this._upwardSeg.compareTo(i._upwardSeg)},fs.prototype.compareX=function(n,i){var s=n.p0.compareTo(i.p0);return s!==0?s:n.p1.compareTo(i.p1)},fs.prototype.toString=function(){return this._upwardSeg.toString()},fs.prototype.interfaces_=function(){return[G]},fs.prototype.getClass=function(){return fs};var Je=function(n,i,s){this.p0=n||null,this.p1=i||null,this.p2=s||null};Je.prototype.area=function(){return Je.area(this.p0,this.p1,this.p2)},Je.prototype.signedArea=function(){return Je.signedArea(this.p0,this.p1,this.p2)},Je.prototype.interpolateZ=function(n){if(n===null)throw new A("Supplied point is null.");return Je.interpolateZ(n,this.p0,this.p1,this.p2)},Je.prototype.longestSideLength=function(){return Je.longestSideLength(this.p0,this.p1,this.p2)},Je.prototype.isAcute=function(){return Je.isAcute(this.p0,this.p1,this.p2)},Je.prototype.circumcentre=function(){return Je.circumcentre(this.p0,this.p1,this.p2)},Je.prototype.area3D=function(){return Je.area3D(this.p0,this.p1,this.p2)},Je.prototype.centroid=function(){return Je.centroid(this.p0,this.p1,this.p2)},Je.prototype.inCentre=function(){return Je.inCentre(this.p0,this.p1,this.p2)},Je.prototype.interfaces_=function(){return[]},Je.prototype.getClass=function(){return Je},Je.area=function(n,i,s){return Math.abs(((s.x-n.x)*(i.y-n.y)-(i.x-n.x)*(s.y-n.y))/2)},Je.signedArea=function(n,i,s){return((s.x-n.x)*(i.y-n.y)-(i.x-n.x)*(s.y-n.y))/2},Je.det=function(n,i,s,u){return n*u-i*s},Je.interpolateZ=function(n,i,s,u){var c=i.x,m=i.y,E=s.x-c,C=u.x-c,U=s.y-m,Z=u.y-m,pt=E*Z-C*U,gt=n.x-c,Rt=n.y-m,Ft=(Z*gt-C*Rt)/pt,Vt=(-U*gt+E*Rt)/pt;return i.z+Ft*(s.z-i.z)+Vt*(u.z-i.z)},Je.longestSideLength=function(n,i,s){var u=n.distance(i),c=i.distance(s),m=s.distance(n),E=u;return c>E&&(E=c),m>E&&(E=m),E},Je.isAcute=function(n,i,s){return!!ve.isAcute(n,i,s)&&!!ve.isAcute(i,s,n)&&!!ve.isAcute(s,n,i)},Je.circumcentre=function(n,i,s){var u=s.x,c=s.y,m=n.x-u,E=n.y-c,C=i.x-u,U=i.y-c,Z=2*Je.det(m,E,C,U),pt=Je.det(E,m*m+E*E,U,C*C+U*U),gt=Je.det(m,m*m+E*E,C,C*C+U*U);return new I(u-pt/Z,c+gt/Z)},Je.perpendicularBisector=function(n,i){var s=i.x-n.x,u=i.y-n.y,c=new Dt(n.x+s/2,n.y+u/2,1),m=new Dt(n.x-u+s/2,n.y+s+u/2,1);return new Dt(c,m)},Je.angleBisector=function(n,i,s){var u=i.distance(n),c=u/(u+i.distance(s)),m=s.x-n.x,E=s.y-n.y;return new I(n.x+c*m,n.y+c*E)},Je.area3D=function(n,i,s){var u=i.x-n.x,c=i.y-n.y,m=i.z-n.z,E=s.x-n.x,C=s.y-n.y,U=s.z-n.z,Z=c*U-m*C,pt=m*E-u*U,gt=u*C-c*E,Rt=Z*Z+pt*pt+gt*gt,Ft=Math.sqrt(Rt)/2;return Ft},Je.centroid=function(n,i,s){var u=(n.x+i.x+s.x)/3,c=(n.y+i.y+s.y)/3;return new I(u,c)},Je.inCentre=function(n,i,s){var u=i.distance(s),c=n.distance(s),m=n.distance(i),E=u+c+m,C=(u*n.x+c*i.x+m*s.x)/E,U=(u*n.y+c*i.y+m*s.y)/E;return new I(C,U)};var yi=function(){this._inputGeom=null,this._distance=null,this._curveBuilder=null,this._curveList=new O;var n=arguments[0],i=arguments[1],s=arguments[2];this._inputGeom=n,this._distance=i,this._curveBuilder=s};yi.prototype.addPoint=function(n){if(this._distance<=0)return null;var i=n.getCoordinates(),s=this._curveBuilder.getLineCurve(i,this._distance);this.addCurve(s,V.EXTERIOR,V.INTERIOR)},yi.prototype.addPolygon=function(n){var i=this._distance,s=It.LEFT;this._distance<0&&(i=-this._distance,s=It.RIGHT);var u=n.getExteriorRing(),c=Q.removeRepeatedPoints(u.getCoordinates());if(this._distance<0&&this.isErodedCompletely(u,this._distance)||this._distance<=0&&c.length<3)return null;this.addPolygonRing(c,i,s,V.EXTERIOR,V.INTERIOR);for(var m=0;m<n.getNumInteriorRing();m++){var E=n.getInteriorRingN(m),C=Q.removeRepeatedPoints(E.getCoordinates());this._distance>0&&this.isErodedCompletely(E,-this._distance)||this.addPolygonRing(C,i,It.opposite(s),V.INTERIOR,V.EXTERIOR)}},yi.prototype.isTriangleErodedCompletely=function(n,i){var s=new Je(n[0],n[1],n[2]),u=s.inCentre();return ot.distancePointLine(u,s.p0,s.p1)<Math.abs(i)},yi.prototype.addLineString=function(n){if(this._distance<=0&&!this._curveBuilder.getBufferParameters().isSingleSided())return null;var i=Q.removeRepeatedPoints(n.getCoordinates()),s=this._curveBuilder.getLineCurve(i,this._distance);this.addCurve(s,V.EXTERIOR,V.INTERIOR)},yi.prototype.addCurve=function(n,i,s){if(n===null||n.length<2)return null;var u=new Dn(n,new fn(0,V.BOUNDARY,i,s));this._curveList.add(u)},yi.prototype.getCurves=function(){return this.add(this._inputGeom),this._curveList},yi.prototype.addPolygonRing=function(n,i,s,u,c){if(i===0&&n.length<oe.MINIMUM_VALID_SIZE)return null;var m=u,E=c;n.length>=oe.MINIMUM_VALID_SIZE&&ot.isCCW(n)&&(m=c,E=u,s=It.opposite(s));var C=this._curveBuilder.getRingCurve(n,s,i);this.addCurve(C,m,E)},yi.prototype.add=function(n){if(n.isEmpty())return null;n instanceof Zt?this.addPolygon(n):n instanceof at?this.addLineString(n):n instanceof Xt?this.addPoint(n):n instanceof me?this.addCollection(n):n instanceof Hr?this.addCollection(n):n instanceof ae?this.addCollection(n):n instanceof En&&this.addCollection(n)},yi.prototype.isErodedCompletely=function(n,i){var s=n.getCoordinates();if(s.length<4)return i<0;if(s.length===4)return this.isTriangleErodedCompletely(s,i);var u=n.getEnvelopeInternal(),c=Math.min(u.getHeight(),u.getWidth());return i<0&&2*Math.abs(i)>c},yi.prototype.addCollection=function(n){for(var i=0;i<n.getNumGeometries();i++){var s=n.getGeometryN(i);this.add(s)}},yi.prototype.interfaces_=function(){return[]},yi.prototype.getClass=function(){return yi};var Ba=function(){};Ba.prototype.locate=function(n){},Ba.prototype.interfaces_=function(){return[]},Ba.prototype.getClass=function(){return Ba};var Zi=function(){this._parent=null,this._atStart=null,this._max=null,this._index=null,this._subcollectionIterator=null;var n=arguments[0];this._parent=n,this._atStart=!0,this._index=0,this._max=n.getNumGeometries()};Zi.prototype.next=function(){if(this._atStart)return this._atStart=!1,Zi.isAtomic(this._parent)&&this._index++,this._parent;if(this._subcollectionIterator!==null){if(this._subcollectionIterator.hasNext())return this._subcollectionIterator.next();this._subcollectionIterator=null}if(this._index>=this._max)throw new o;var n=this._parent.getGeometryN(this._index++);return n instanceof En?(this._subcollectionIterator=new Zi(n),this._subcollectionIterator.next()):n},Zi.prototype.remove=function(){throw new Error(this.getClass().getName())},Zi.prototype.hasNext=function(){if(this._atStart)return!0;if(this._subcollectionIterator!==null){if(this._subcollectionIterator.hasNext())return!0;this._subcollectionIterator=null}return!(this._index>=this._max)},Zi.prototype.interfaces_=function(){return[ft]},Zi.prototype.getClass=function(){return Zi},Zi.isAtomic=function(n){return!(n instanceof En)};var oi=function(){this._geom=null;var n=arguments[0];this._geom=n};oi.prototype.locate=function(n){return oi.locate(n,this._geom)},oi.prototype.interfaces_=function(){return[Ba]},oi.prototype.getClass=function(){return oi},oi.isPointInRing=function(n,i){return!!i.getEnvelopeInternal().intersects(n)&&ot.isPointInRing(n,i.getCoordinates())},oi.containsPointInPolygon=function(n,i){if(i.isEmpty())return!1;var s=i.getExteriorRing();if(!oi.isPointInRing(n,s))return!1;for(var u=0;u<i.getNumInteriorRing();u++){var c=i.getInteriorRingN(u);if(oi.isPointInRing(n,c))return!1}return!0},oi.containsPoint=function(n,i){if(i instanceof Zt)return oi.containsPointInPolygon(n,i);if(i instanceof En)for(var s=new Zi(i);s.hasNext();){var u=s.next();if(u!==i&&oi.containsPoint(n,u))return!0}return!1},oi.locate=function(n,i){return i.isEmpty()?V.EXTERIOR:oi.containsPoint(n,i)?V.INTERIOR:V.EXTERIOR};var ur=function(){this._edgeMap=new x,this._edgeList=null,this._ptInAreaLocation=[V.NONE,V.NONE]};ur.prototype.getNextCW=function(n){this.getEdges();var i=this._edgeList.indexOf(n),s=i-1;return i===0&&(s=this._edgeList.size()-1),this._edgeList.get(s)},ur.prototype.propagateSideLabels=function(n){for(var i=V.NONE,s=this.iterator();s.hasNext();){var u=s.next().getLabel();u.isArea(n)&&u.getLocation(n,It.LEFT)!==V.NONE&&(i=u.getLocation(n,It.LEFT))}if(i===V.NONE)return null;for(var c=i,m=this.iterator();m.hasNext();){var E=m.next(),C=E.getLabel();if(C.getLocation(n,It.ON)===V.NONE&&C.setLocation(n,It.ON,c),C.isArea(n)){var U=C.getLocation(n,It.LEFT),Z=C.getLocation(n,It.RIGHT);if(Z!==V.NONE){if(Z!==c)throw new xo("side location conflict",E.getCoordinate());U===V.NONE&&Lt.shouldNeverReachHere("found single null side (at "+E.getCoordinate()+")"),c=U}else Lt.isTrue(C.getLocation(n,It.LEFT)===V.NONE,"found single null side"),C.setLocation(n,It.RIGHT,c),C.setLocation(n,It.LEFT,c)}}},ur.prototype.getCoordinate=function(){var n=this.iterator();return n.hasNext()?n.next().getCoordinate():null},ur.prototype.print=function(n){Ut.out.println("EdgeEndStar: "+this.getCoordinate());for(var i=this.iterator();i.hasNext();)i.next().print(n)},ur.prototype.isAreaLabelsConsistent=function(n){return this.computeEdgeEndLabels(n.getBoundaryNodeRule()),this.checkAreaLabelsConsistent(0)},ur.prototype.checkAreaLabelsConsistent=function(n){var i=this.getEdges();if(i.size()<=0)return!0;var s=i.size()-1,u=i.get(s).getLabel().getLocation(n,It.LEFT);Lt.isTrue(u!==V.NONE,"Found unlabelled area edge");for(var c=u,m=this.iterator();m.hasNext();){var E=m.next().getLabel();Lt.isTrue(E.isArea(n),"Found non-area edge");var C=E.getLocation(n,It.LEFT),U=E.getLocation(n,It.RIGHT);if(C===U||U!==c)return!1;c=C}return!0},ur.prototype.findIndex=function(n){this.iterator();for(var i=0;i<this._edgeList.size();i++)if(this._edgeList.get(i)===n)return i;return-1},ur.prototype.iterator=function(){return this.getEdges().iterator()},ur.prototype.getEdges=function(){return this._edgeList===null&&(this._edgeList=new O(this._edgeMap.values())),this._edgeList},ur.prototype.getLocation=function(n,i,s){return this._ptInAreaLocation[n]===V.NONE&&(this._ptInAreaLocation[n]=oi.locate(i,s[n].getGeometry())),this._ptInAreaLocation[n]},ur.prototype.toString=function(){var n=new _t;n.append("EdgeEndStar: "+this.getCoordinate()),n.append(`
|
|
6
6
|
`);for(var i=this.iterator();i.hasNext();){var s=i.next();n.append(s),n.append(`
|
|
7
|
-
`)}return n.toString()},ur.prototype.computeEdgeEndLabels=function(n){for(var i=this.iterator();i.hasNext();)i.next().computeLabel(n)},ur.prototype.computeLabelling=function(n){this.computeEdgeEndLabels(n[0].getBoundaryNodeRule()),this.propagateSideLabels(0),this.propagateSideLabels(1);for(var i=[!1,!1],s=this.iterator();s.hasNext();)for(var u=s.next().getLabel(),c=0;c<2;c++)u.isLine(c)&&u.getLocation(c)===V.BOUNDARY&&(i[c]=!0);for(var m=this.iterator();m.hasNext();)for(var E=m.next(),C=E.getLabel(),U=0;U<2;U++)if(C.isAnyNull(U)){var Z=V.NONE;if(i[U])Z=V.EXTERIOR;else{var pt=E.getCoordinate();Z=this.getLocation(U,pt,n)}C.setAllLocationsIfNull(U,Z)}},ur.prototype.getDegree=function(){return this._edgeMap.size()},ur.prototype.insertEdgeEnd=function(n,i){this._edgeMap.put(n,i),this._edgeList=null},ur.prototype.interfaces_=function(){return[]},ur.prototype.getClass=function(){return ur};var QA=function(n){function i(){n.call(this),this._resultAreaEdgeList=null,this._label=null,this._SCANNING_FOR_INCOMING=1,this._LINKING_TO_OUTGOING=2}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.linkResultDirectedEdges=function(){this.getResultAreaEdges();for(var s=null,u=null,c=this._SCANNING_FOR_INCOMING,m=0;m<this._resultAreaEdgeList.size();m++){var E=this._resultAreaEdgeList.get(m),C=E.getSym();if(E.getLabel().isArea())switch(s===null&&E.isInResult()&&(s=E),c){case this._SCANNING_FOR_INCOMING:if(!C.isInResult())continue;u=C,c=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(!E.isInResult())continue;u.setNext(E),c=this._SCANNING_FOR_INCOMING}}if(c===this._LINKING_TO_OUTGOING){if(s===null)throw new xo("no outgoing dirEdge found",this.getCoordinate());Lt.isTrue(s.isInResult(),"unable to link last incoming dirEdge"),u.setNext(s)}},i.prototype.insert=function(s){var u=s;this.insertEdgeEnd(u,u)},i.prototype.getRightmostEdge=function(){var s=this.getEdges(),u=s.size();if(u<1)return null;var c=s.get(0);if(u===1)return c;var m=s.get(u-1),E=c.getQuadrant(),C=m.getQuadrant();return dn.isNorthern(E)&&dn.isNorthern(C)?c:dn.isNorthern(E)||dn.isNorthern(C)?c.getDy()!==0?c:m.getDy()!==0?m:(Lt.shouldNeverReachHere("found two horizontal edges incident on node"),null):m},i.prototype.print=function(s){Ut.out.println("DirectedEdgeStar: "+this.getCoordinate());for(var u=this.iterator();u.hasNext();){var c=u.next();s.print("out "),c.print(s),s.println(),s.print("in "),c.getSym().print(s),s.println()}},i.prototype.getResultAreaEdges=function(){if(this._resultAreaEdgeList!==null)return this._resultAreaEdgeList;this._resultAreaEdgeList=new O;for(var s=this.iterator();s.hasNext();){var u=s.next();(u.isInResult()||u.getSym().isInResult())&&this._resultAreaEdgeList.add(u)}return this._resultAreaEdgeList},i.prototype.updateLabelling=function(s){for(var u=this.iterator();u.hasNext();){var c=u.next().getLabel();c.setAllLocationsIfNull(0,s.getLocation(0)),c.setAllLocationsIfNull(1,s.getLocation(1))}},i.prototype.linkAllDirectedEdges=function(){this.getEdges();for(var s=null,u=null,c=this._edgeList.size()-1;c>=0;c--){var m=this._edgeList.get(c),E=m.getSym();u===null&&(u=E),s!==null&&E.setNext(s),s=m}u.setNext(s)},i.prototype.computeDepths=function(){if(arguments.length===1){var s=arguments[0],u=this.findIndex(s),c=s.getDepth(It.LEFT),m=s.getDepth(It.RIGHT),E=this.computeDepths(u+1,this._edgeList.size(),c);if(this.computeDepths(0,u,E)!==m)throw new xo("depth mismatch at "+s.getCoordinate())}else if(arguments.length===3){for(var C=arguments[0],U=arguments[1],Z=arguments[2],pt=C;pt<U;pt++){var gt=this._edgeList.get(pt);gt.setEdgeDepths(It.RIGHT,Z),Z=gt.getDepth(It.LEFT)}return Z}},i.prototype.mergeSymLabels=function(){for(var s=this.iterator();s.hasNext();){var u=s.next();u.getLabel().merge(u.getSym().getLabel())}},i.prototype.linkMinimalDirectedEdges=function(s){for(var u=null,c=null,m=this._SCANNING_FOR_INCOMING,E=this._resultAreaEdgeList.size()-1;E>=0;E--){var C=this._resultAreaEdgeList.get(E),U=C.getSym();switch(u===null&&C.getEdgeRing()===s&&(u=C),m){case this._SCANNING_FOR_INCOMING:if(U.getEdgeRing()!==s)continue;c=U,m=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(C.getEdgeRing()!==s)continue;c.setNextMin(C),m=this._SCANNING_FOR_INCOMING}}m===this._LINKING_TO_OUTGOING&&(Lt.isTrue(u!==null,"found null for first outgoing dirEdge"),Lt.isTrue(u.getEdgeRing()===s,"unable to link last incoming dirEdge"),c.setNextMin(u))},i.prototype.getOutgoingDegree=function(){if(arguments.length===0){for(var s=0,u=this.iterator();u.hasNext();)u.next().isInResult()&&s++;return s}if(arguments.length===1){for(var c=arguments[0],m=0,E=this.iterator();E.hasNext();)E.next().getEdgeRing()===c&&m++;return m}},i.prototype.getLabel=function(){return this._label},i.prototype.findCoveredLineEdges=function(){for(var s=V.NONE,u=this.iterator();u.hasNext();){var c=u.next(),m=c.getSym();if(!c.isLineEdge()){if(c.isInResult()){s=V.INTERIOR;break}if(m.isInResult()){s=V.EXTERIOR;break}}}if(s===V.NONE)return null;for(var E=s,C=this.iterator();C.hasNext();){var U=C.next(),Z=U.getSym();U.isLineEdge()?U.getEdge().setCovered(E===V.INTERIOR):(U.isInResult()&&(E=V.EXTERIOR),Z.isInResult()&&(E=V.INTERIOR))}},i.prototype.computeLabelling=function(s){n.prototype.computeLabelling.call(this,s),this._label=new fn(V.NONE);for(var u=this.iterator();u.hasNext();)for(var c=u.next().getEdge().getLabel(),m=0;m<2;m++){var E=c.getLocation(m);E!==V.INTERIOR&&E!==V.BOUNDARY||this._label.setLocation(m,V.INTERIOR)}},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(ur),ly=function(n){function i(){n.apply(this,arguments)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.createNode=function(s){return new hc(s,new QA)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(Da),Go=function n(){this._pts=null,this._orientation=null;var i=arguments[0];this._pts=i,this._orientation=n.orientation(i)};Go.prototype.compareTo=function(n){var i=n;return Go.compareOriented(this._pts,this._orientation,i._pts,i._orientation)},Go.prototype.interfaces_=function(){return[G]},Go.prototype.getClass=function(){return Go},Go.orientation=function(n){return Q.increasingDirection(n)===1},Go.compareOriented=function(n,i,s,u){for(var c=i?1:-1,m=u?1:-1,E=i?n.length:-1,C=u?s.length:-1,U=i?0:n.length-1,Z=u?0:s.length-1;;){var pt=n[U].compareTo(s[Z]);if(pt!==0)return pt;var gt=(U+=c)===E,Rt=(Z+=m)===C;if(gt&&!Rt)return-1;if(!gt&&Rt)return 1;if(gt&&Rt)return 0}};var Ai=function(){this._edges=new O,this._ocaMap=new x};Ai.prototype.print=function(n){n.print("MULTILINESTRING ( ");for(var i=0;i<this._edges.size();i++){var s=this._edges.get(i);i>0&&n.print(","),n.print("(");for(var u=s.getCoordinates(),c=0;c<u.length;c++)c>0&&n.print(","),n.print(u[c].x+" "+u[c].y);n.println(")")}n.print(") ")},Ai.prototype.addAll=function(n){for(var i=n.iterator();i.hasNext();)this.add(i.next())},Ai.prototype.findEdgeIndex=function(n){for(var i=0;i<this._edges.size();i++)if(this._edges.get(i).equals(n))return i;return-1},Ai.prototype.iterator=function(){return this._edges.iterator()},Ai.prototype.getEdges=function(){return this._edges},Ai.prototype.get=function(n){return this._edges.get(n)},Ai.prototype.findEqualEdge=function(n){var i=new Go(n.getCoordinates());return this._ocaMap.get(i)},Ai.prototype.add=function(n){this._edges.add(n);var i=new Go(n.getCoordinates());this._ocaMap.put(i,n)},Ai.prototype.interfaces_=function(){return[]},Ai.prototype.getClass=function(){return Ai};var hs=function(){};hs.prototype.processIntersections=function(n,i,s,u){},hs.prototype.isDone=function(){},hs.prototype.interfaces_=function(){return[]},hs.prototype.getClass=function(){return hs};var si=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 n=arguments[0];this._li=n};si.prototype.isTrivialIntersection=function(n,i,s,u){if(n===s&&this._li.getIntersectionNum()===1){if(si.isAdjacentSegments(i,u))return!0;if(n.isClosed()){var c=n.size()-1;if(i===0&&u===c||u===0&&i===c)return!0}}return!1},si.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},si.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},si.prototype.getLineIntersector=function(){return this._li},si.prototype.hasProperIntersection=function(){return this._hasProper},si.prototype.processIntersections=function(n,i,s,u){if(n===s&&i===u)return null;this.numTests++;var c=n.getCoordinates()[i],m=n.getCoordinates()[i+1],E=s.getCoordinates()[u],C=s.getCoordinates()[u+1];this._li.computeIntersection(c,m,E,C),this._li.hasIntersection()&&(this.numIntersections++,this._li.isInteriorIntersection()&&(this.numInteriorIntersections++,this._hasInterior=!0),this.isTrivialIntersection(n,i,s,u)||(this._hasIntersection=!0,n.addIntersections(this._li,i,0),s.addIntersections(this._li,u,1),this._li.isProper()&&(this.numProperIntersections++,this._hasProper=!0,this._hasProperInterior=!0)))},si.prototype.hasIntersection=function(){return this._hasIntersection},si.prototype.isDone=function(){return!1},si.prototype.hasInteriorIntersection=function(){return this._hasInterior},si.prototype.interfaces_=function(){return[hs]},si.prototype.getClass=function(){return si},si.isAdjacentSegments=function(n,i){return Math.abs(n-i)===1};var Bi=function(){this.coord=null,this.segmentIndex=null,this.dist=null;var n=arguments[0],i=arguments[1],s=arguments[2];this.coord=new I(n),this.segmentIndex=i,this.dist=s};Bi.prototype.getSegmentIndex=function(){return this.segmentIndex},Bi.prototype.getCoordinate=function(){return this.coord},Bi.prototype.print=function(n){n.print(this.coord),n.print(" seg # = "+this.segmentIndex),n.println(" dist = "+this.dist)},Bi.prototype.compareTo=function(n){var i=n;return this.compare(i.segmentIndex,i.dist)},Bi.prototype.isEndPoint=function(n){return this.segmentIndex===0&&this.dist===0||this.segmentIndex===n},Bi.prototype.toString=function(){return this.coord+" seg # = "+this.segmentIndex+" dist = "+this.dist},Bi.prototype.getDistance=function(){return this.dist},Bi.prototype.compare=function(n,i){return this.segmentIndex<n?-1:this.segmentIndex>n?1:this.dist<i?-1:this.dist>i?1:0},Bi.prototype.interfaces_=function(){return[G]},Bi.prototype.getClass=function(){return Bi};var Ji=function(){this._nodeMap=new x,this.edge=null;var n=arguments[0];this.edge=n};Ji.prototype.print=function(n){n.println("Intersections:");for(var i=this.iterator();i.hasNext();)i.next().print(n)},Ji.prototype.iterator=function(){return this._nodeMap.values().iterator()},Ji.prototype.addSplitEdges=function(n){this.addEndpoints();for(var i=this.iterator(),s=i.next();i.hasNext();){var u=i.next(),c=this.createSplitEdge(s,u);n.add(c),s=u}},Ji.prototype.addEndpoints=function(){var n=this.edge.pts.length-1;this.add(this.edge.pts[0],0,0),this.add(this.edge.pts[n],n,0)},Ji.prototype.createSplitEdge=function(n,i){var s=i.segmentIndex-n.segmentIndex+2,u=this.edge.pts[i.segmentIndex],c=i.dist>0||!i.coord.equals2D(u);c||s--;var m=new Array(s).fill(null),E=0;m[E++]=new I(n.coord);for(var C=n.segmentIndex+1;C<=i.segmentIndex;C++)m[E++]=this.edge.pts[C];return c&&(m[E]=i.coord),new dc(m,new fn(this.edge._label))},Ji.prototype.add=function(n,i,s){var u=new Bi(n,i,s),c=this._nodeMap.get(u);return c!==null?c:(this._nodeMap.put(u,u),u)},Ji.prototype.isIntersection=function(n){for(var i=this.iterator();i.hasNext();)if(i.next().coord.equals(n))return!0;return!1},Ji.prototype.interfaces_=function(){return[]},Ji.prototype.getClass=function(){return Ji};var ps=function(){};ps.prototype.getChainStartIndices=function(n){var i=0,s=new O;s.add(new it(i));do{var u=this.findChainEnd(n,i);s.add(new it(u)),i=u}while(i<n.length-1);return ps.toIntArray(s)},ps.prototype.findChainEnd=function(n,i){for(var s=dn.quadrant(n[i],n[i+1]),u=i+1;u<n.length&&dn.quadrant(n[u-1],n[u])===s;)u++;return u-1},ps.prototype.interfaces_=function(){return[]},ps.prototype.getClass=function(){return ps},ps.toIntArray=function(n){for(var i=new Array(n.size()).fill(null),s=0;s<i.length;s++)i[s]=n.get(s).intValue();return i};var So=function(){this.e=null,this.pts=null,this.startIndex=null,this.env1=new At,this.env2=new At;var n=arguments[0];this.e=n,this.pts=n.getCoordinates();var i=new ps;this.startIndex=i.getChainStartIndices(this.pts)};So.prototype.getCoordinates=function(){return this.pts},So.prototype.getMaxX=function(n){var i=this.pts[this.startIndex[n]].x,s=this.pts[this.startIndex[n+1]].x;return i>s?i:s},So.prototype.getMinX=function(n){var i=this.pts[this.startIndex[n]].x,s=this.pts[this.startIndex[n+1]].x;return i<s?i:s},So.prototype.computeIntersectsForChain=function(){if(arguments.length===4){var n=arguments[0],i=arguments[1],s=arguments[2],u=arguments[3];this.computeIntersectsForChain(this.startIndex[n],this.startIndex[n+1],i,i.startIndex[s],i.startIndex[s+1],u)}else if(arguments.length===6){var c=arguments[0],m=arguments[1],E=arguments[2],C=arguments[3],U=arguments[4],Z=arguments[5],pt=this.pts[c],gt=this.pts[m],Rt=E.pts[C],Ft=E.pts[U];if(m-c==1&&U-C==1)return Z.addIntersections(this.e,c,E.e,C),null;if(this.env1.init(pt,gt),this.env2.init(Rt,Ft),!this.env1.intersects(this.env2))return null;var Vt=Math.trunc((c+m)/2),ee=Math.trunc((C+U)/2);c<Vt&&(C<ee&&this.computeIntersectsForChain(c,Vt,E,C,ee,Z),ee<U&&this.computeIntersectsForChain(c,Vt,E,ee,U,Z)),Vt<m&&(C<ee&&this.computeIntersectsForChain(Vt,m,E,C,ee,Z),ee<U&&this.computeIntersectsForChain(Vt,m,E,ee,U,Z))}},So.prototype.getStartIndexes=function(){return this.startIndex},So.prototype.computeIntersects=function(n,i){for(var s=0;s<this.startIndex.length-1;s++)for(var u=0;u<n.startIndex.length-1;u++)this.computeIntersectsForChain(s,n,u,i)},So.prototype.interfaces_=function(){return[]},So.prototype.getClass=function(){return So};var Qn=function n(){this._depth=Array(2).fill().map(function(){return Array(3)});for(var i=0;i<2;i++)for(var s=0;s<3;s++)this._depth[i][s]=n.NULL_VALUE},cy={NULL_VALUE:{configurable:!0}};Qn.prototype.getDepth=function(n,i){return this._depth[n][i]},Qn.prototype.setDepth=function(n,i,s){this._depth[n][i]=s},Qn.prototype.isNull=function(){if(arguments.length===0){for(var n=0;n<2;n++)for(var i=0;i<3;i++)if(this._depth[n][i]!==Qn.NULL_VALUE)return!1;return!0}if(arguments.length===1){var s=arguments[0];return this._depth[s][1]===Qn.NULL_VALUE}if(arguments.length===2){var u=arguments[0],c=arguments[1];return this._depth[u][c]===Qn.NULL_VALUE}},Qn.prototype.normalize=function(){for(var n=0;n<2;n++)if(!this.isNull(n)){var i=this._depth[n][1];this._depth[n][2]<i&&(i=this._depth[n][2]),i<0&&(i=0);for(var s=1;s<3;s++){var u=0;this._depth[n][s]>i&&(u=1),this._depth[n][s]=u}}},Qn.prototype.getDelta=function(n){return this._depth[n][It.RIGHT]-this._depth[n][It.LEFT]},Qn.prototype.getLocation=function(n,i){return this._depth[n][i]<=0?V.EXTERIOR:V.INTERIOR},Qn.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]},Qn.prototype.add=function(){if(arguments.length===1)for(var n=arguments[0],i=0;i<2;i++)for(var s=1;s<3;s++){var u=n.getLocation(i,s);u!==V.EXTERIOR&&u!==V.INTERIOR||(this.isNull(i,s)?this._depth[i][s]=Qn.depthAtLocation(u):this._depth[i][s]+=Qn.depthAtLocation(u))}else if(arguments.length===3){var c=arguments[0],m=arguments[1];arguments[2]===V.INTERIOR&&this._depth[c][m]++}},Qn.prototype.interfaces_=function(){return[]},Qn.prototype.getClass=function(){return Qn},Qn.depthAtLocation=function(n){return n===V.EXTERIOR?0:n===V.INTERIOR?1:Qn.NULL_VALUE},cy.NULL_VALUE.get=function(){return-1},Object.defineProperties(Qn,cy);var dc=function(n){function i(){if(n.call(this),this.pts=null,this._env=null,this.eiList=new Ji(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new Qn,this._depthDelta=0,arguments.length===1){var s=arguments[0];i.call(this,s,null)}else if(arguments.length===2){var u=arguments[0],c=arguments[1];this.pts=u,this._label=c}}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.getDepth=function(){return this._depth},i.prototype.getCollapsedEdge=function(){var s=new Array(2).fill(null);return s[0]=this.pts[0],s[1]=this.pts[1],new i(s,fn.toLineLabel(this._label))},i.prototype.isIsolated=function(){return this._isIsolated},i.prototype.getCoordinates=function(){return this.pts},i.prototype.setIsolated=function(s){this._isIsolated=s},i.prototype.setName=function(s){this._name=s},i.prototype.equals=function(s){if(!(s instanceof i))return!1;var u=s;if(this.pts.length!==u.pts.length)return!1;for(var c=!0,m=!0,E=this.pts.length,C=0;C<this.pts.length;C++)if(this.pts[C].equals2D(u.pts[C])||(c=!1),this.pts[C].equals2D(u.pts[--E])||(m=!1),!c&&!m)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 s=arguments[0];return this.pts[s]}},i.prototype.print=function(s){s.print("edge "+this._name+": "),s.print("LINESTRING (");for(var u=0;u<this.pts.length;u++)u>0&&s.print(","),s.print(this.pts[u].x+" "+this.pts[u].y);s.print(") "+this._label+" "+this._depthDelta)},i.prototype.computeIM=function(s){i.updateIM(this._label,s)},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(s){s.print("edge "+this._name+": ");for(var u=this.pts.length-1;u>=0;u--)s.print(this.pts[u]+" ");s.println("")},i.prototype.getMonotoneChainEdge=function(){return this._mce===null&&(this._mce=new So(this)),this._mce},i.prototype.getEnvelope=function(){if(this._env===null){this._env=new At;for(var s=0;s<this.pts.length;s++)this._env.expandToInclude(this.pts[s])}return this._env},i.prototype.addIntersection=function(s,u,c,m){var E=new I(s.getIntersection(m)),C=u,U=s.getEdgeDistance(c,m),Z=C+1;if(Z<this.pts.length){var pt=this.pts[Z];E.equals2D(pt)&&(C=Z,U=0)}this.eiList.add(E,C,U)},i.prototype.toString=function(){var s=new _t;s.append("edge "+this._name+": "),s.append("LINESTRING (");for(var u=0;u<this.pts.length;u++)u>0&&s.append(","),s.append(this.pts[u].x+" "+this.pts[u].y);return s.append(") "+this._label+" "+this._depthDelta),s.toString()},i.prototype.isPointwiseEqual=function(s){if(this.pts.length!==s.pts.length)return!1;for(var u=0;u<this.pts.length;u++)if(!this.pts[u].equals2D(s.pts[u]))return!1;return!0},i.prototype.setDepthDelta=function(s){this._depthDelta=s},i.prototype.getEdgeIntersectionList=function(){return this.eiList},i.prototype.addIntersections=function(s,u,c){for(var m=0;m<s.getIntersectionNum();m++)this.addIntersection(s,u,c,m)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i.updateIM=function(){if(arguments.length!==2)return n.prototype.updateIM.apply(this,arguments);var s=arguments[0],u=arguments[1];u.setAtLeastIfValid(s.getLocation(0,It.ON),s.getLocation(1,It.ON),1),s.isArea()&&(u.setAtLeastIfValid(s.getLocation(0,It.LEFT),s.getLocation(1,It.LEFT),2),u.setAtLeastIfValid(s.getLocation(0,It.RIGHT),s.getLocation(1,It.RIGHT),2))},i}(ri),Er=function(n){this._workingPrecisionModel=null,this._workingNoder=null,this._geomFact=null,this._graph=null,this._edgeList=new Ai,this._bufParams=n||null};Er.prototype.setWorkingPrecisionModel=function(n){this._workingPrecisionModel=n},Er.prototype.insertUniqueEdge=function(n){var i=this._edgeList.findEqualEdge(n);if(i!==null){var s=i.getLabel(),u=n.getLabel();i.isPointwiseEqual(n)||(u=new fn(n.getLabel())).flip(),s.merge(u);var c=Er.depthDelta(u),m=i.getDepthDelta()+c;i.setDepthDelta(m)}else this._edgeList.add(n),n.setDepthDelta(Er.depthDelta(n.getLabel()))},Er.prototype.buildSubgraphs=function(n,i){for(var s=new O,u=n.iterator();u.hasNext();){var c=u.next(),m=c.getRightmostCoordinate(),E=new Ks(s).getDepth(m);c.computeDepth(E),c.findResultEdges(),s.add(c),i.add(c.getDirectedEdges(),c.getNodes())}},Er.prototype.createSubgraphs=function(n){for(var i=new O,s=n.getNodes().iterator();s.hasNext();){var u=s.next();if(!u.isVisited()){var c=new _r;c.create(u),i.add(c)}}return Ti.sort(i,Ti.reverseOrder()),i},Er.prototype.createEmptyResultGeometry=function(){return this._geomFact.createPolygon()},Er.prototype.getNoder=function(n){if(this._workingNoder!==null)return this._workingNoder;var i=new rp,s=new N;return s.setPrecisionModel(n),i.setSegmentIntersector(new si(s)),i},Er.prototype.buffer=function(n,i){var s=this._workingPrecisionModel;s===null&&(s=n.getPrecisionModel()),this._geomFact=n.getFactory();var u=new Or(s,this._bufParams),c=new yi(n,i,u).getCurves();if(c.size()<=0)return this.createEmptyResultGeometry();this.computeNodedEdges(c,s),this._graph=new Rn(new ly),this._graph.addEdges(this._edgeList.getEdges());var m=this.createSubgraphs(this._graph),E=new Wr(this._geomFact);this.buildSubgraphs(m,E);var C=E.getPolygons();return C.size()<=0?this.createEmptyResultGeometry():this._geomFact.buildGeometry(C)},Er.prototype.computeNodedEdges=function(n,i){var s=this.getNoder(i);s.computeNodes(n);for(var u=s.getNodedSubstrings().iterator();u.hasNext();){var c=u.next(),m=c.getCoordinates();if(m.length!==2||!m[0].equals2D(m[1])){var E=c.getData(),C=new dc(c.getCoordinates(),new fn(E));this.insertUniqueEdge(C)}}},Er.prototype.setNoder=function(n){this._workingNoder=n},Er.prototype.interfaces_=function(){return[]},Er.prototype.getClass=function(){return Er},Er.depthDelta=function(n){var i=n.getLocation(0,It.LEFT),s=n.getLocation(0,It.RIGHT);return i===V.INTERIOR&&s===V.EXTERIOR?1:i===V.EXTERIOR&&s===V.INTERIOR?-1:0},Er.convertSegStrings=function(n){for(var i=new pe,s=new O;n.hasNext();){var u=n.next(),c=i.createLineString(u.getCoordinates());s.add(c)}return i.buildGeometry(s)};var ko=function(){if(this._noder=null,this._scaleFactor=null,this._offsetX=null,this._offsetY=null,this._isScaled=!1,arguments.length===2){var n=arguments[0],i=arguments[1];this._noder=n,this._scaleFactor=i,this._offsetX=0,this._offsetY=0,this._isScaled=!this.isIntegerPrecision()}else if(arguments.length===4){var s=arguments[0],u=arguments[1],c=arguments[2],m=arguments[3];this._noder=s,this._scaleFactor=u,this._offsetX=c,this._offsetY=m,this._isScaled=!this.isIntegerPrecision()}};ko.prototype.rescale=function(){if(X(arguments[0],j))for(var n=arguments[0].iterator();n.hasNext();){var i=n.next();this.rescale(i.getCoordinates())}else if(arguments[0]instanceof Array){for(var s=arguments[0],u=0;u<s.length;u++)s[u].x=s[u].x/this._scaleFactor+this._offsetX,s[u].y=s[u].y/this._scaleFactor+this._offsetY;s.length===2&&s[0].equals2D(s[1])&&Ut.out.println(s)}},ko.prototype.scale=function(){if(X(arguments[0],j)){for(var n=arguments[0],i=new O,s=n.iterator();s.hasNext();){var u=s.next();i.add(new Dn(this.scale(u.getCoordinates()),u.getData()))}return i}if(arguments[0]instanceof Array){for(var c=arguments[0],m=new Array(c.length).fill(null),E=0;E<c.length;E++)m[E]=new I(Math.round((c[E].x-this._offsetX)*this._scaleFactor),Math.round((c[E].y-this._offsetY)*this._scaleFactor),c[E].z);return Q.removeRepeatedPoints(m)}},ko.prototype.isIntegerPrecision=function(){return this._scaleFactor===1},ko.prototype.getNodedSubstrings=function(){var n=this._noder.getNodedSubstrings();return this._isScaled&&this.rescale(n),n},ko.prototype.computeNodes=function(n){var i=n;this._isScaled&&(i=this.scale(n)),this._noder.computeNodes(i)},ko.prototype.interfaces_=function(){return[cs]},ko.prototype.getClass=function(){return ko};var zi=function(){this._li=new N,this._segStrings=null;var n=arguments[0];this._segStrings=n},fy={fact:{configurable:!0}};zi.prototype.checkEndPtVertexIntersections=function(){if(arguments.length===0)for(var n=this._segStrings.iterator();n.hasNext();){var i=n.next().getCoordinates();this.checkEndPtVertexIntersections(i[0],this._segStrings),this.checkEndPtVertexIntersections(i[i.length-1],this._segStrings)}else if(arguments.length===2){for(var s=arguments[0],u=arguments[1].iterator();u.hasNext();)for(var c=u.next().getCoordinates(),m=1;m<c.length-1;m++)if(c[m].equals(s))throw new ie("found endpt/interior pt intersection at index "+m+" :pt "+s)}},zi.prototype.checkInteriorIntersections=function(){if(arguments.length===0)for(var n=this._segStrings.iterator();n.hasNext();)for(var i=n.next(),s=this._segStrings.iterator();s.hasNext();){var u=s.next();this.checkInteriorIntersections(i,u)}else if(arguments.length===2)for(var c=arguments[0],m=arguments[1],E=c.getCoordinates(),C=m.getCoordinates(),U=0;U<E.length-1;U++)for(var Z=0;Z<C.length-1;Z++)this.checkInteriorIntersections(c,U,m,Z);else if(arguments.length===4){var pt=arguments[0],gt=arguments[1],Rt=arguments[2],Ft=arguments[3];if(pt===Rt&>===Ft)return null;var Vt=pt.getCoordinates()[gt],ee=pt.getCoordinates()[gt+1],hn=Rt.getCoordinates()[Ft],qn=Rt.getCoordinates()[Ft+1];if(this._li.computeIntersection(Vt,ee,hn,qn),this._li.hasIntersection()&&(this._li.isProper()||this.hasInteriorIntersection(this._li,Vt,ee)||this.hasInteriorIntersection(this._li,hn,qn)))throw new ie("found non-noded intersection at "+Vt+"-"+ee+" and "+hn+"-"+qn)}},zi.prototype.checkValid=function(){this.checkEndPtVertexIntersections(),this.checkInteriorIntersections(),this.checkCollapses()},zi.prototype.checkCollapses=function(){if(arguments.length===0)for(var n=this._segStrings.iterator();n.hasNext();){var i=n.next();this.checkCollapses(i)}else if(arguments.length===1)for(var s=arguments[0].getCoordinates(),u=0;u<s.length-2;u++)this.checkCollapse(s[u],s[u+1],s[u+2])},zi.prototype.hasInteriorIntersection=function(n,i,s){for(var u=0;u<n.getIntersectionNum();u++){var c=n.getIntersection(u);if(!c.equals(i)&&!c.equals(s))return!0}return!1},zi.prototype.checkCollapse=function(n,i,s){if(n.equals(s))throw new ie("found non-noded collapse at "+zi.fact.createLineString([n,i,s]))},zi.prototype.interfaces_=function(){return[]},zi.prototype.getClass=function(){return zi},fy.fact.get=function(){return new pe},Object.defineProperties(zi,fy);var Dr=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 n=arguments[0],i=arguments[1],s=arguments[2];if(this._originalPt=n,this._pt=n,this._scaleFactor=i,this._li=s,i<=0)throw new A("Scale factor must be non-zero");i!==1&&(this._pt=new I(this.scale(n.x),this.scale(n.y)),this._p0Scaled=new I,this._p1Scaled=new I),this.initCorners(this._pt)},hy={SAFE_ENV_EXPANSION_FACTOR:{configurable:!0}};Dr.prototype.intersectsScaled=function(n,i){var s=Math.min(n.x,i.x),u=Math.max(n.x,i.x),c=Math.min(n.y,i.y),m=Math.max(n.y,i.y),E=this._maxx<s||this._minx>u||this._maxy<c||this._miny>m;if(E)return!1;var C=this.intersectsToleranceSquare(n,i);return Lt.isTrue(!(E&&C),"Found bad envelope test"),C},Dr.prototype.initCorners=function(n){this._minx=n.x-.5,this._maxx=n.x+.5,this._miny=n.y-.5,this._maxy=n.y+.5,this._corner[0]=new I(this._maxx,this._maxy),this._corner[1]=new I(this._minx,this._maxy),this._corner[2]=new I(this._minx,this._miny),this._corner[3]=new I(this._maxx,this._miny)},Dr.prototype.intersects=function(n,i){return this._scaleFactor===1?this.intersectsScaled(n,i):(this.copyScaled(n,this._p0Scaled),this.copyScaled(i,this._p1Scaled),this.intersectsScaled(this._p0Scaled,this._p1Scaled))},Dr.prototype.scale=function(n){return Math.round(n*this._scaleFactor)},Dr.prototype.getCoordinate=function(){return this._originalPt},Dr.prototype.copyScaled=function(n,i){i.x=this.scale(n.x),i.y=this.scale(n.y)},Dr.prototype.getSafeEnvelope=function(){if(this._safeEnv===null){var n=Dr.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new At(this._originalPt.x-n,this._originalPt.x+n,this._originalPt.y-n,this._originalPt.y+n)}return this._safeEnv},Dr.prototype.intersectsPixelClosure=function(n,i){return this._li.computeIntersection(n,i,this._corner[0],this._corner[1]),!!this._li.hasIntersection()||(this._li.computeIntersection(n,i,this._corner[1],this._corner[2]),!!this._li.hasIntersection()||(this._li.computeIntersection(n,i,this._corner[2],this._corner[3]),!!this._li.hasIntersection()||(this._li.computeIntersection(n,i,this._corner[3],this._corner[0]),!!this._li.hasIntersection())))},Dr.prototype.intersectsToleranceSquare=function(n,i){var s=!1,u=!1;return this._li.computeIntersection(n,i,this._corner[0],this._corner[1]),!!this._li.isProper()||(this._li.computeIntersection(n,i,this._corner[1],this._corner[2]),!!this._li.isProper()||(this._li.hasIntersection()&&(s=!0),this._li.computeIntersection(n,i,this._corner[2],this._corner[3]),!!this._li.isProper()||(this._li.hasIntersection()&&(u=!0),this._li.computeIntersection(n,i,this._corner[3],this._corner[0]),!!this._li.isProper()||!(!s||!u)||!!n.equals(this._pt)||!!i.equals(this._pt))))},Dr.prototype.addSnappedNode=function(n,i){var s=n.getCoordinate(i),u=n.getCoordinate(i+1);return!!this.intersects(s,u)&&(n.addIntersection(this.getCoordinate(),i),!0)},Dr.prototype.interfaces_=function(){return[]},Dr.prototype.getClass=function(){return Dr},hy.SAFE_ENV_EXPANSION_FACTOR.get=function(){return .75},Object.defineProperties(Dr,hy);var al=function(){this.tempEnv1=new At,this.selectedSegment=new Qt};al.prototype.select=function(){if(arguments.length!==1){if(arguments.length===2){var n=arguments[0],i=arguments[1];n.getLineSegment(i,this.selectedSegment),this.select(this.selectedSegment)}}},al.prototype.interfaces_=function(){return[]},al.prototype.getClass=function(){return al};var za=function(){this._index=null;var n=arguments[0];this._index=n},py={HotPixelSnapAction:{configurable:!0}};za.prototype.snap=function(){if(arguments.length===1){var n=arguments[0];return this.snap(n,null,-1)}if(arguments.length===3){var i=arguments[0],s=arguments[1],u=arguments[2],c=i.getSafeEnvelope(),m=new dy(i,s,u);return this._index.query(c,{interfaces_:function(){return[Bo]},visitItem:function(E){E.select(c,m)}}),m.isNodeAdded()}},za.prototype.interfaces_=function(){return[]},za.prototype.getClass=function(){return za},py.HotPixelSnapAction.get=function(){return dy},Object.defineProperties(za,py);var dy=function(n){function i(){n.call(this),this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var s=arguments[0],u=arguments[1],c=arguments[2];this._hotPixel=s,this._parentEdge=u,this._hotPixelVertexIndex=c}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.isNodeAdded=function(){return this._isNodeAdded},i.prototype.select=function(){if(arguments.length!==2)return n.prototype.select.apply(this,arguments);var s=arguments[0],u=arguments[1],c=s.getContext();if(this._parentEdge!==null&&c===this._parentEdge&&u===this._hotPixelVertexIndex)return null;this._isNodeAdded=this._hotPixel.addSnappedNode(c,u)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(al),js=function(){this._li=null,this._interiorIntersections=null;var n=arguments[0];this._li=n,this._interiorIntersections=new O};js.prototype.processIntersections=function(n,i,s,u){if(n===s&&i===u)return null;var c=n.getCoordinates()[i],m=n.getCoordinates()[i+1],E=s.getCoordinates()[u],C=s.getCoordinates()[u+1];if(this._li.computeIntersection(c,m,E,C),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var U=0;U<this._li.getIntersectionNum();U++)this._interiorIntersections.add(this._li.getIntersection(U));n.addIntersections(this._li,i,0),s.addIntersections(this._li,u,1)}},js.prototype.isDone=function(){return!1},js.prototype.getInteriorIntersections=function(){return this._interiorIntersections},js.prototype.interfaces_=function(){return[hs]},js.prototype.getClass=function(){return js};var Ki=function(){this._pm=null,this._li=null,this._scaleFactor=null,this._noder=null,this._pointSnapper=null,this._nodedSegStrings=null;var n=arguments[0];this._pm=n,this._li=new N,this._li.setPrecisionModel(n),this._scaleFactor=n.getScale()};Ki.prototype.checkCorrectness=function(n){var i=Dn.getNodedSubstrings(n),s=new zi(i);try{s.checkValid()}catch(u){if(!(u instanceof Bt))throw u;u.printStackTrace()}},Ki.prototype.getNodedSubstrings=function(){return Dn.getNodedSubstrings(this._nodedSegStrings)},Ki.prototype.snapRound=function(n,i){var s=this.findInteriorIntersections(n,i);this.computeIntersectionSnaps(s),this.computeVertexSnaps(n)},Ki.prototype.findInteriorIntersections=function(n,i){var s=new js(i);return this._noder.setSegmentIntersector(s),this._noder.computeNodes(n),s.getInteriorIntersections()},Ki.prototype.computeVertexSnaps=function(){if(X(arguments[0],j))for(var n=arguments[0].iterator();n.hasNext();){var i=n.next();this.computeVertexSnaps(i)}else if(arguments[0]instanceof Dn)for(var s=arguments[0],u=s.getCoordinates(),c=0;c<u.length;c++){var m=new Dr(u[c],this._scaleFactor,this._li);this._pointSnapper.snap(m,s,c)&&s.addIntersection(u[c],c)}},Ki.prototype.computeNodes=function(n){this._nodedSegStrings=n,this._noder=new rp,this._pointSnapper=new za(this._noder.getIndex()),this.snapRound(n,this._li)},Ki.prototype.computeIntersectionSnaps=function(n){for(var i=n.iterator();i.hasNext();){var s=i.next(),u=new Dr(s,this._scaleFactor,this._li);this._pointSnapper.snap(u)}},Ki.prototype.interfaces_=function(){return[cs]},Ki.prototype.getClass=function(){return Ki};var tr=function(){if(this._argGeom=null,this._distance=null,this._bufParams=new Ze,this._resultGeometry=null,this._saveException=null,arguments.length===1){var n=arguments[0];this._argGeom=n}else if(arguments.length===2){var i=arguments[0],s=arguments[1];this._argGeom=i,this._bufParams=s}},Ga={CAP_ROUND:{configurable:!0},CAP_BUTT:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},MAX_PRECISION_DIGITS:{configurable:!0}};tr.prototype.bufferFixedPrecision=function(n){var i=new ko(new Ki(new ge(1)),n.getScale()),s=new Er(this._bufParams);s.setWorkingPrecisionModel(n),s.setNoder(i),this._resultGeometry=s.buffer(this._argGeom,this._distance)},tr.prototype.bufferReducedPrecision=function(){var n=this;if(arguments.length===0){for(var i=tr.MAX_PRECISION_DIGITS;i>=0;i--){try{n.bufferReducedPrecision(i)}catch(m){if(!(m instanceof xo))throw m;n._saveException=m}if(n._resultGeometry!==null)return null}throw this._saveException}if(arguments.length===1){var s=arguments[0],u=tr.precisionScaleFactor(this._argGeom,this._distance,s),c=new ge(u);this.bufferFixedPrecision(c)}},tr.prototype.computeGeometry=function(){if(this.bufferOriginalPrecision(),this._resultGeometry!==null)return null;var n=this._argGeom.getFactory().getPrecisionModel();n.getType()===ge.FIXED?this.bufferFixedPrecision(n):this.bufferReducedPrecision()},tr.prototype.setQuadrantSegments=function(n){this._bufParams.setQuadrantSegments(n)},tr.prototype.bufferOriginalPrecision=function(){try{var n=new Er(this._bufParams);this._resultGeometry=n.buffer(this._argGeom,this._distance)}catch(i){if(!(i instanceof ie))throw i;this._saveException=i}},tr.prototype.getResultGeometry=function(n){return this._distance=n,this.computeGeometry(),this._resultGeometry},tr.prototype.setEndCapStyle=function(n){this._bufParams.setEndCapStyle(n)},tr.prototype.interfaces_=function(){return[]},tr.prototype.getClass=function(){return tr},tr.bufferOp=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];return new tr(n).getResultGeometry(i)}if(arguments.length===3){if(Number.isInteger(arguments[2])&&arguments[0]instanceof Ct&&typeof arguments[1]=="number"){var s=arguments[0],u=arguments[1],c=arguments[2],m=new tr(s);return m.setQuadrantSegments(c),m.getResultGeometry(u)}if(arguments[2]instanceof Ze&&arguments[0]instanceof Ct&&typeof arguments[1]=="number"){var E=arguments[0],C=arguments[1],U=arguments[2];return new tr(E,U).getResultGeometry(C)}}else if(arguments.length===4){var Z=arguments[0],pt=arguments[1],gt=arguments[2],Rt=arguments[3],Ft=new tr(Z);return Ft.setQuadrantSegments(gt),Ft.setEndCapStyle(Rt),Ft.getResultGeometry(pt)}},tr.precisionScaleFactor=function(n,i,s){var u=n.getEnvelopeInternal(),c=mt.max(Math.abs(u.getMaxX()),Math.abs(u.getMaxY()),Math.abs(u.getMinX()),Math.abs(u.getMinY()))+2*(i>0?i:0),m=s-Math.trunc(Math.log(c)/Math.log(10)+1);return Math.pow(10,m)},Ga.CAP_ROUND.get=function(){return Ze.CAP_ROUND},Ga.CAP_BUTT.get=function(){return Ze.CAP_FLAT},Ga.CAP_FLAT.get=function(){return Ze.CAP_FLAT},Ga.CAP_SQUARE.get=function(){return Ze.CAP_SQUARE},Ga.MAX_PRECISION_DIGITS.get=function(){return 12},Object.defineProperties(tr,Ga);var Mr=function(){this._pt=[new I,new I],this._distance=S.NaN,this._isNull=!0};Mr.prototype.getCoordinates=function(){return this._pt},Mr.prototype.getCoordinate=function(n){return this._pt[n]},Mr.prototype.setMinimum=function(){if(arguments.length===1){var n=arguments[0];this.setMinimum(n._pt[0],n._pt[1])}else if(arguments.length===2){var i=arguments[0],s=arguments[1];if(this._isNull)return this.initialize(i,s),null;var u=i.distance(s);u<this._distance&&this.initialize(i,s,u)}},Mr.prototype.initialize=function(){if(arguments.length===0)this._isNull=!0;else if(arguments.length===2){var n=arguments[0],i=arguments[1];this._pt[0].setCoordinate(n),this._pt[1].setCoordinate(i),this._distance=n.distance(i),this._isNull=!1}else if(arguments.length===3){var s=arguments[0],u=arguments[1],c=arguments[2];this._pt[0].setCoordinate(s),this._pt[1].setCoordinate(u),this._distance=c,this._isNull=!1}},Mr.prototype.getDistance=function(){return this._distance},Mr.prototype.setMaximum=function(){if(arguments.length===1){var n=arguments[0];this.setMaximum(n._pt[0],n._pt[1])}else if(arguments.length===2){var i=arguments[0],s=arguments[1];if(this._isNull)return this.initialize(i,s),null;var u=i.distance(s);u>this._distance&&this.initialize(i,s,u)}},Mr.prototype.interfaces_=function(){return[]},Mr.prototype.getClass=function(){return Mr};var ji=function(){};ji.prototype.interfaces_=function(){return[]},ji.prototype.getClass=function(){return ji},ji.computeDistance=function(){if(arguments[2]instanceof Mr&&arguments[0]instanceof at&&arguments[1]instanceof I)for(var n=arguments[0],i=arguments[1],s=arguments[2],u=n.getCoordinates(),c=new Qt,m=0;m<u.length-1;m++){c.setCoordinates(u[m],u[m+1]);var E=c.closestPoint(i);s.setMinimum(E,i)}else if(arguments[2]instanceof Mr&&arguments[0]instanceof Zt&&arguments[1]instanceof I){var C=arguments[0],U=arguments[1],Z=arguments[2];ji.computeDistance(C.getExteriorRing(),U,Z);for(var pt=0;pt<C.getNumInteriorRing();pt++)ji.computeDistance(C.getInteriorRingN(pt),U,Z)}else if(arguments[2]instanceof Mr&&arguments[0]instanceof Ct&&arguments[1]instanceof I){var gt=arguments[0],Rt=arguments[1],Ft=arguments[2];if(gt instanceof at)ji.computeDistance(gt,Rt,Ft);else if(gt instanceof Zt)ji.computeDistance(gt,Rt,Ft);else if(gt instanceof En)for(var Vt=gt,ee=0;ee<Vt.getNumGeometries();ee++){var hn=Vt.getGeometryN(ee);ji.computeDistance(hn,Rt,Ft)}else Ft.setMinimum(gt.getCoordinate(),Rt)}else if(arguments[2]instanceof Mr&&arguments[0]instanceof Qt&&arguments[1]instanceof I){var qn=arguments[0],Tr=arguments[1],no=arguments[2],$o=qn.closestPoint(Tr);no.setMinimum($o,Tr)}};var ds=function(n){this._maxPtDist=new Mr,this._inputGeom=n||null},ip={MaxPointDistanceFilter:{configurable:!0},MaxMidpointDistanceFilter:{configurable:!0}};ds.prototype.computeMaxMidpointDistance=function(n){var i=new qo(this._inputGeom);n.apply(i),this._maxPtDist.setMaximum(i.getMaxPointDistance())},ds.prototype.computeMaxVertexDistance=function(n){var i=new Qs(this._inputGeom);n.apply(i),this._maxPtDist.setMaximum(i.getMaxPointDistance())},ds.prototype.findDistance=function(n){return this.computeMaxVertexDistance(n),this.computeMaxMidpointDistance(n),this._maxPtDist.getDistance()},ds.prototype.getDistancePoints=function(){return this._maxPtDist},ds.prototype.interfaces_=function(){return[]},ds.prototype.getClass=function(){return ds},ip.MaxPointDistanceFilter.get=function(){return Qs},ip.MaxMidpointDistanceFilter.get=function(){return qo},Object.defineProperties(ds,ip);var Qs=function(n){this._maxPtDist=new Mr,this._minPtDist=new Mr,this._geom=n||null};Qs.prototype.filter=function(n){this._minPtDist.initialize(),ji.computeDistance(this._geom,n,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},Qs.prototype.getMaxPointDistance=function(){return this._maxPtDist},Qs.prototype.interfaces_=function(){return[J]},Qs.prototype.getClass=function(){return Qs};var qo=function(n){this._maxPtDist=new Mr,this._minPtDist=new Mr,this._geom=n||null};qo.prototype.filter=function(n,i){if(i===0)return null;var s=n.getCoordinate(i-1),u=n.getCoordinate(i),c=new I((s.x+u.x)/2,(s.y+u.y)/2);this._minPtDist.initialize(),ji.computeDistance(this._geom,c,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},qo.prototype.isDone=function(){return!1},qo.prototype.isGeometryChanged=function(){return!1},qo.prototype.getMaxPointDistance=function(){return this._maxPtDist},qo.prototype.interfaces_=function(){return[Tn]},qo.prototype.getClass=function(){return qo};var wo=function(n){this._comps=n||null};wo.prototype.filter=function(n){n instanceof Zt&&this._comps.add(n)},wo.prototype.interfaces_=function(){return[In]},wo.prototype.getClass=function(){return wo},wo.getPolygons=function(){if(arguments.length===1){var n=arguments[0];return wo.getPolygons(n,new O)}if(arguments.length===2){var i=arguments[0],s=arguments[1];return i instanceof Zt?s.add(i):i instanceof En&&i.apply(new wo(s)),s}};var er=function(){if(this._lines=null,this._isForcedToLineString=!1,arguments.length===1){var n=arguments[0];this._lines=n}else if(arguments.length===2){var i=arguments[0],s=arguments[1];this._lines=i,this._isForcedToLineString=s}};er.prototype.filter=function(n){if(this._isForcedToLineString&&n instanceof oe){var i=n.getFactory().createLineString(n.getCoordinateSequence());return this._lines.add(i),null}n instanceof at&&this._lines.add(n)},er.prototype.setForceToLineString=function(n){this._isForcedToLineString=n},er.prototype.interfaces_=function(){return[ue]},er.prototype.getClass=function(){return er},er.getGeometry=function(){if(arguments.length===1){var n=arguments[0];return n.getFactory().buildGeometry(er.getLines(n))}if(arguments.length===2){var i=arguments[0],s=arguments[1];return i.getFactory().buildGeometry(er.getLines(i,s))}},er.getLines=function(){if(arguments.length===1){var n=arguments[0];return er.getLines(n,!1)}if(arguments.length===2){if(X(arguments[0],j)&&X(arguments[1],j)){for(var i=arguments[0],s=arguments[1],u=i.iterator();u.hasNext();){var c=u.next();er.getLines(c,s)}return s}if(arguments[0]instanceof Ct&&typeof arguments[1]=="boolean"){var m=arguments[0],E=arguments[1],C=new O;return m.apply(new er(C,E)),C}if(arguments[0]instanceof Ct&&X(arguments[1],j)){var U=arguments[0],Z=arguments[1];return U instanceof at?Z.add(U):U.apply(new er(Z)),Z}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&X(arguments[0],j)&&X(arguments[1],j)){for(var pt=arguments[0],gt=arguments[1],Rt=arguments[2],Ft=pt.iterator();Ft.hasNext();){var Vt=Ft.next();er.getLines(Vt,gt,Rt)}return gt}if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Ct&&X(arguments[1],j)){var ee=arguments[0],hn=arguments[1],qn=arguments[2];return ee.apply(new er(hn,qn)),hn}}};var Ci=function(){if(this._boundaryRule=w.OGC_SFS_BOUNDARY_RULE,this._isIn=null,this._numBoundaries=null,arguments.length!==0){if(arguments.length===1){var n=arguments[0];if(n===null)throw new A("Rule must be non-null");this._boundaryRule=n}}};Ci.prototype.locateInternal=function(){if(arguments[0]instanceof I&&arguments[1]instanceof Zt){var n=arguments[0],i=arguments[1];if(i.isEmpty())return V.EXTERIOR;var s=i.getExteriorRing(),u=this.locateInPolygonRing(n,s);if(u===V.EXTERIOR)return V.EXTERIOR;if(u===V.BOUNDARY)return V.BOUNDARY;for(var c=0;c<i.getNumInteriorRing();c++){var m=i.getInteriorRingN(c),E=this.locateInPolygonRing(n,m);if(E===V.INTERIOR)return V.EXTERIOR;if(E===V.BOUNDARY)return V.BOUNDARY}return V.INTERIOR}if(arguments[0]instanceof I&&arguments[1]instanceof at){var C=arguments[0],U=arguments[1];if(!U.getEnvelopeInternal().intersects(C))return V.EXTERIOR;var Z=U.getCoordinates();return U.isClosed()||!C.equals(Z[0])&&!C.equals(Z[Z.length-1])?ot.isOnLine(C,Z)?V.INTERIOR:V.EXTERIOR:V.BOUNDARY}if(arguments[0]instanceof I&&arguments[1]instanceof Xt){var pt=arguments[0];return arguments[1].getCoordinate().equals2D(pt)?V.INTERIOR:V.EXTERIOR}},Ci.prototype.locateInPolygonRing=function(n,i){return i.getEnvelopeInternal().intersects(n)?ot.locatePointInRing(n,i.getCoordinates()):V.EXTERIOR},Ci.prototype.intersects=function(n,i){return this.locate(n,i)!==V.EXTERIOR},Ci.prototype.updateLocationInfo=function(n){n===V.INTERIOR&&(this._isIn=!0),n===V.BOUNDARY&&this._numBoundaries++},Ci.prototype.computeLocation=function(n,i){if(i instanceof Xt&&this.updateLocationInfo(this.locateInternal(n,i)),i instanceof at)this.updateLocationInfo(this.locateInternal(n,i));else if(i instanceof Zt)this.updateLocationInfo(this.locateInternal(n,i));else if(i instanceof Hr)for(var s=i,u=0;u<s.getNumGeometries();u++){var c=s.getGeometryN(u);this.updateLocationInfo(this.locateInternal(n,c))}else if(i instanceof ae)for(var m=i,E=0;E<m.getNumGeometries();E++){var C=m.getGeometryN(E);this.updateLocationInfo(this.locateInternal(n,C))}else if(i instanceof En)for(var U=new Zi(i);U.hasNext();){var Z=U.next();Z!==i&&this.computeLocation(n,Z)}},Ci.prototype.locate=function(n,i){return i.isEmpty()?V.EXTERIOR:i instanceof at?this.locateInternal(n,i):i instanceof Zt?this.locateInternal(n,i):(this._isIn=!1,this._numBoundaries=0,this.computeLocation(n,i),this._boundaryRule.isInBoundary(this._numBoundaries)?V.BOUNDARY:this._numBoundaries>0||this._isIn?V.INTERIOR:V.EXTERIOR)},Ci.prototype.interfaces_=function(){return[]},Ci.prototype.getClass=function(){return Ci};var Sr=function n(){if(this._component=null,this._segIndex=null,this._pt=null,arguments.length===2){var i=arguments[0],s=arguments[1];n.call(this,i,n.INSIDE_AREA,s)}else if(arguments.length===3){var u=arguments[0],c=arguments[1],m=arguments[2];this._component=u,this._segIndex=c,this._pt=m}},my={INSIDE_AREA:{configurable:!0}};Sr.prototype.isInsideArea=function(){return this._segIndex===Sr.INSIDE_AREA},Sr.prototype.getCoordinate=function(){return this._pt},Sr.prototype.getGeometryComponent=function(){return this._component},Sr.prototype.getSegmentIndex=function(){return this._segIndex},Sr.prototype.interfaces_=function(){return[]},Sr.prototype.getClass=function(){return Sr},my.INSIDE_AREA.get=function(){return-1},Object.defineProperties(Sr,my);var Vo=function(n){this._pts=n||null};Vo.prototype.filter=function(n){n instanceof Xt&&this._pts.add(n)},Vo.prototype.interfaces_=function(){return[In]},Vo.prototype.getClass=function(){return Vo},Vo.getPoints=function(){if(arguments.length===1){var n=arguments[0];return n instanceof Xt?Ti.singletonList(n):Vo.getPoints(n,new O)}if(arguments.length===2){var i=arguments[0],s=arguments[1];return i instanceof Xt?s.add(i):i instanceof En&&i.apply(new Vo(s)),s}};var ta=function(){this._locations=null;var n=arguments[0];this._locations=n};ta.prototype.filter=function(n){(n instanceof Xt||n instanceof at||n instanceof Zt)&&this._locations.add(new Sr(n,0,n.getCoordinate()))},ta.prototype.interfaces_=function(){return[In]},ta.prototype.getClass=function(){return ta},ta.getLocations=function(n){var i=new O;return n.apply(new ta(i)),i};var nr=function(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new Ci,this._minDistanceLocation=null,this._minDistance=S.MAX_VALUE,arguments.length===2){var n=arguments[0],i=arguments[1];this._geom=[n,i],this._terminateDistance=0}else if(arguments.length===3){var s=arguments[0],u=arguments[1],c=arguments[2];this._geom=new Array(2).fill(null),this._geom[0]=s,this._geom[1]=u,this._terminateDistance=c}};nr.prototype.computeContainmentDistance=function(){if(arguments.length===0){var n=new Array(2).fill(null);if(this.computeContainmentDistance(0,n),this._minDistance<=this._terminateDistance)return null;this.computeContainmentDistance(1,n)}else if(arguments.length===2){var i=arguments[0],s=arguments[1],u=1-i,c=wo.getPolygons(this._geom[i]);if(c.size()>0){var m=ta.getLocations(this._geom[u]);if(this.computeContainmentDistance(m,c,s),this._minDistance<=this._terminateDistance)return this._minDistanceLocation[u]=s[0],this._minDistanceLocation[i]=s[1],null}}else if(arguments.length===3){if(arguments[2]instanceof Array&&X(arguments[0],ct)&&X(arguments[1],ct)){for(var E=arguments[0],C=arguments[1],U=arguments[2],Z=0;Z<E.size();Z++)for(var pt=E.get(Z),gt=0;gt<C.size();gt++)if(this.computeContainmentDistance(pt,C.get(gt),U),this._minDistance<=this._terminateDistance)return null}else if(arguments[2]instanceof Array&&arguments[0]instanceof Sr&&arguments[1]instanceof Zt){var Rt=arguments[0],Ft=arguments[1],Vt=arguments[2],ee=Rt.getCoordinate();if(V.EXTERIOR!==this._ptLocator.locate(ee,Ft))return this._minDistance=0,Vt[0]=Rt,Vt[1]=new Sr(Ft,ee),null}}},nr.prototype.computeMinDistanceLinesPoints=function(n,i,s){for(var u=0;u<n.size();u++)for(var c=n.get(u),m=0;m<i.size();m++){var E=i.get(m);if(this.computeMinDistance(c,E,s),this._minDistance<=this._terminateDistance)return null}},nr.prototype.computeFacetDistance=function(){var n=new Array(2).fill(null),i=er.getLines(this._geom[0]),s=er.getLines(this._geom[1]),u=Vo.getPoints(this._geom[0]),c=Vo.getPoints(this._geom[1]);return this.computeMinDistanceLines(i,s,n),this.updateMinDistance(n,!1),this._minDistance<=this._terminateDistance?null:(n[0]=null,n[1]=null,this.computeMinDistanceLinesPoints(i,c,n),this.updateMinDistance(n,!1),this._minDistance<=this._terminateDistance?null:(n[0]=null,n[1]=null,this.computeMinDistanceLinesPoints(s,u,n),this.updateMinDistance(n,!0),this._minDistance<=this._terminateDistance?null:(n[0]=null,n[1]=null,this.computeMinDistancePoints(u,c,n),void this.updateMinDistance(n,!1))))},nr.prototype.nearestLocations=function(){return this.computeMinDistance(),this._minDistanceLocation},nr.prototype.updateMinDistance=function(n,i){if(n[0]===null)return null;i?(this._minDistanceLocation[0]=n[1],this._minDistanceLocation[1]=n[0]):(this._minDistanceLocation[0]=n[0],this._minDistanceLocation[1]=n[1])},nr.prototype.nearestPoints=function(){return this.computeMinDistance(),[this._minDistanceLocation[0].getCoordinate(),this._minDistanceLocation[1].getCoordinate()]},nr.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 at&&arguments[1]instanceof Xt){var n=arguments[0],i=arguments[1],s=arguments[2];if(n.getEnvelopeInternal().distance(i.getEnvelopeInternal())>this._minDistance)return null;for(var u=n.getCoordinates(),c=i.getCoordinate(),m=0;m<u.length-1;m++){var E=ot.distancePointLine(c,u[m],u[m+1]);if(E<this._minDistance){this._minDistance=E;var C=new Qt(u[m],u[m+1]).closestPoint(c);s[0]=new Sr(n,m,C),s[1]=new Sr(i,0,c)}if(this._minDistance<=this._terminateDistance)return null}}else if(arguments[2]instanceof Array&&arguments[0]instanceof at&&arguments[1]instanceof at){var U=arguments[0],Z=arguments[1],pt=arguments[2];if(U.getEnvelopeInternal().distance(Z.getEnvelopeInternal())>this._minDistance)return null;for(var gt=U.getCoordinates(),Rt=Z.getCoordinates(),Ft=0;Ft<gt.length-1;Ft++)for(var Vt=0;Vt<Rt.length-1;Vt++){var ee=ot.distanceLineLine(gt[Ft],gt[Ft+1],Rt[Vt],Rt[Vt+1]);if(ee<this._minDistance){this._minDistance=ee;var hn=new Qt(gt[Ft],gt[Ft+1]),qn=new Qt(Rt[Vt],Rt[Vt+1]),Tr=hn.closestPoints(qn);pt[0]=new Sr(U,Ft,Tr[0]),pt[1]=new Sr(Z,Vt,Tr[1])}if(this._minDistance<=this._terminateDistance)return null}}}},nr.prototype.computeMinDistancePoints=function(n,i,s){for(var u=0;u<n.size();u++)for(var c=n.get(u),m=0;m<i.size();m++){var E=i.get(m),C=c.getCoordinate().distance(E.getCoordinate());if(C<this._minDistance&&(this._minDistance=C,s[0]=new Sr(c,0,c.getCoordinate()),s[1]=new Sr(E,0,E.getCoordinate())),this._minDistance<=this._terminateDistance)return null}},nr.prototype.distance=function(){if(this._geom[0]===null||this._geom[1]===null)throw new A("null geometries are not supported");return this._geom[0].isEmpty()||this._geom[1].isEmpty()?0:(this.computeMinDistance(),this._minDistance)},nr.prototype.computeMinDistanceLines=function(n,i,s){for(var u=0;u<n.size();u++)for(var c=n.get(u),m=0;m<i.size();m++){var E=i.get(m);if(this.computeMinDistance(c,E,s),this._minDistance<=this._terminateDistance)return null}},nr.prototype.interfaces_=function(){return[]},nr.prototype.getClass=function(){return nr},nr.distance=function(n,i){return new nr(n,i).distance()},nr.isWithinDistance=function(n,i,s){return new nr(n,i,s).distance()<=s},nr.nearestPoints=function(n,i){return new nr(n,i).nearestPoints()};var lr=function(){this._pt=[new I,new I],this._distance=S.NaN,this._isNull=!0};lr.prototype.getCoordinates=function(){return this._pt},lr.prototype.getCoordinate=function(n){return this._pt[n]},lr.prototype.setMinimum=function(){if(arguments.length===1){var n=arguments[0];this.setMinimum(n._pt[0],n._pt[1])}else if(arguments.length===2){var i=arguments[0],s=arguments[1];if(this._isNull)return this.initialize(i,s),null;var u=i.distance(s);u<this._distance&&this.initialize(i,s,u)}},lr.prototype.initialize=function(){if(arguments.length===0)this._isNull=!0;else if(arguments.length===2){var n=arguments[0],i=arguments[1];this._pt[0].setCoordinate(n),this._pt[1].setCoordinate(i),this._distance=n.distance(i),this._isNull=!1}else if(arguments.length===3){var s=arguments[0],u=arguments[1],c=arguments[2];this._pt[0].setCoordinate(s),this._pt[1].setCoordinate(u),this._distance=c,this._isNull=!1}},lr.prototype.toString=function(){return Wt.toLineString(this._pt[0],this._pt[1])},lr.prototype.getDistance=function(){return this._distance},lr.prototype.setMaximum=function(){if(arguments.length===1){var n=arguments[0];this.setMaximum(n._pt[0],n._pt[1])}else if(arguments.length===2){var i=arguments[0],s=arguments[1];if(this._isNull)return this.initialize(i,s),null;var u=i.distance(s);u>this._distance&&this.initialize(i,s,u)}},lr.prototype.interfaces_=function(){return[]},lr.prototype.getClass=function(){return lr};var Gi=function(){};Gi.prototype.interfaces_=function(){return[]},Gi.prototype.getClass=function(){return Gi},Gi.computeDistance=function(){if(arguments[2]instanceof lr&&arguments[0]instanceof at&&arguments[1]instanceof I)for(var n=arguments[0],i=arguments[1],s=arguments[2],u=new Qt,c=n.getCoordinates(),m=0;m<c.length-1;m++){u.setCoordinates(c[m],c[m+1]);var E=u.closestPoint(i);s.setMinimum(E,i)}else if(arguments[2]instanceof lr&&arguments[0]instanceof Zt&&arguments[1]instanceof I){var C=arguments[0],U=arguments[1],Z=arguments[2];Gi.computeDistance(C.getExteriorRing(),U,Z);for(var pt=0;pt<C.getNumInteriorRing();pt++)Gi.computeDistance(C.getInteriorRingN(pt),U,Z)}else if(arguments[2]instanceof lr&&arguments[0]instanceof Ct&&arguments[1]instanceof I){var gt=arguments[0],Rt=arguments[1],Ft=arguments[2];if(gt instanceof at)Gi.computeDistance(gt,Rt,Ft);else if(gt instanceof Zt)Gi.computeDistance(gt,Rt,Ft);else if(gt instanceof En)for(var Vt=gt,ee=0;ee<Vt.getNumGeometries();ee++){var hn=Vt.getGeometryN(ee);Gi.computeDistance(hn,Rt,Ft)}else Ft.setMinimum(gt.getCoordinate(),Rt)}else if(arguments[2]instanceof lr&&arguments[0]instanceof Qt&&arguments[1]instanceof I){var qn=arguments[0],Tr=arguments[1],no=arguments[2],$o=qn.closestPoint(Tr);no.setMinimum($o,Tr)}};var vi=function(){this._g0=null,this._g1=null,this._ptDist=new lr,this._densifyFrac=0;var n=arguments[0],i=arguments[1];this._g0=n,this._g1=i},op={MaxPointDistanceFilter:{configurable:!0},MaxDensifiedByFractionDistanceFilter:{configurable:!0}};vi.prototype.getCoordinates=function(){return this._ptDist.getCoordinates()},vi.prototype.setDensifyFraction=function(n){if(n>1||n<=0)throw new A("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=n},vi.prototype.compute=function(n,i){this.computeOrientedDistance(n,i,this._ptDist),this.computeOrientedDistance(i,n,this._ptDist)},vi.prototype.distance=function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()},vi.prototype.computeOrientedDistance=function(n,i,s){var u=new ea(i);if(n.apply(u),s.setMaximum(u.getMaxPointDistance()),this._densifyFrac>0){var c=new Ho(i,this._densifyFrac);n.apply(c),s.setMaximum(c.getMaxPointDistance())}},vi.prototype.orientedDistance=function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()},vi.prototype.interfaces_=function(){return[]},vi.prototype.getClass=function(){return vi},vi.distance=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];return new vi(n,i).distance()}if(arguments.length===3){var s=arguments[0],u=arguments[1],c=arguments[2],m=new vi(s,u);return m.setDensifyFraction(c),m.distance()}},op.MaxPointDistanceFilter.get=function(){return ea},op.MaxDensifiedByFractionDistanceFilter.get=function(){return Ho},Object.defineProperties(vi,op);var ea=function(){this._maxPtDist=new lr,this._minPtDist=new lr,this._euclideanDist=new Gi,this._geom=null;var n=arguments[0];this._geom=n};ea.prototype.filter=function(n){this._minPtDist.initialize(),Gi.computeDistance(this._geom,n,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},ea.prototype.getMaxPointDistance=function(){return this._maxPtDist},ea.prototype.interfaces_=function(){return[J]},ea.prototype.getClass=function(){return ea};var Ho=function(){this._maxPtDist=new lr,this._minPtDist=new lr,this._geom=null,this._numSubSegs=0;var n=arguments[0],i=arguments[1];this._geom=n,this._numSubSegs=Math.trunc(Math.round(1/i))};Ho.prototype.filter=function(n,i){if(i===0)return null;for(var s=n.getCoordinate(i-1),u=n.getCoordinate(i),c=(u.x-s.x)/this._numSubSegs,m=(u.y-s.y)/this._numSubSegs,E=0;E<this._numSubSegs;E++){var C=s.x+E*c,U=s.y+E*m,Z=new I(C,U);this._minPtDist.initialize(),Gi.computeDistance(this._geom,Z,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)}},Ho.prototype.isDone=function(){return!1},Ho.prototype.isGeometryChanged=function(){return!1},Ho.prototype.getMaxPointDistance=function(){return this._maxPtDist},Ho.prototype.interfaces_=function(){return[Tn]},Ho.prototype.getClass=function(){return Ho};var Yr=function(n,i,s){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=n||null,this._bufDistance=i||null,this._result=s||null},sp={VERBOSE:{configurable:!0},MAX_DISTANCE_DIFF_FRAC:{configurable:!0}};Yr.prototype.checkMaximumDistance=function(n,i,s){var u=new vi(i,n);if(u.setDensifyFraction(.25),this._maxDistanceFound=u.orientedDistance(),this._maxDistanceFound>s){this._isValid=!1;var c=u.getCoordinates();this._errorLocation=c[1],this._errorIndicator=n.getFactory().createLineString(c),this._errMsg="Distance between buffer curve and input is too large ("+this._maxDistanceFound+" at "+Wt.toLineString(c[0],c[1])+")"}},Yr.prototype.isValid=function(){var n=Math.abs(this._bufDistance),i=Yr.MAX_DISTANCE_DIFF_FRAC*n;return this._minValidDistance=n-i,this._maxValidDistance=n+i,!(!this._input.isEmpty()&&!this._result.isEmpty())||(this._bufDistance>0?this.checkPositiveValid():this.checkNegativeValid(),Yr.VERBOSE&&Ut.out.println("Min Dist= "+this._minDistanceFound+" err= "+(1-this._minDistanceFound/this._bufDistance)+" Max Dist= "+this._maxDistanceFound+" err= "+(this._maxDistanceFound/this._bufDistance-1)),this._isValid)},Yr.prototype.checkNegativeValid=function(){if(!(this._input instanceof Zt||this._input instanceof ae||this._input instanceof En))return null;var n=this.getPolygonLines(this._input);if(this.checkMinimumDistance(n,this._result,this._minValidDistance),!this._isValid)return null;this.checkMaximumDistance(n,this._result,this._maxValidDistance)},Yr.prototype.getErrorIndicator=function(){return this._errorIndicator},Yr.prototype.checkMinimumDistance=function(n,i,s){var u=new nr(n,i,s);if(this._minDistanceFound=u.distance(),this._minDistanceFound<s){this._isValid=!1;var c=u.nearestPoints();this._errorLocation=u.nearestPoints()[1],this._errorIndicator=n.getFactory().createLineString(c),this._errMsg="Distance between buffer curve and input is too small ("+this._minDistanceFound+" at "+Wt.toLineString(c[0],c[1])+" )"}},Yr.prototype.checkPositiveValid=function(){var n=this._result.getBoundary();if(this.checkMinimumDistance(this._input,n,this._minValidDistance),!this._isValid)return null;this.checkMaximumDistance(this._input,n,this._maxValidDistance)},Yr.prototype.getErrorLocation=function(){return this._errorLocation},Yr.prototype.getPolygonLines=function(n){for(var i=new O,s=new er(i),u=wo.getPolygons(n).iterator();u.hasNext();)u.next().apply(s);return n.getFactory().buildGeometry(i)},Yr.prototype.getErrorMessage=function(){return this._errMsg},Yr.prototype.interfaces_=function(){return[]},Yr.prototype.getClass=function(){return Yr},sp.VERBOSE.get=function(){return!1},sp.MAX_DISTANCE_DIFF_FRAC.get=function(){return .012},Object.defineProperties(Yr,sp);var rr=function(n,i,s){this._isValid=!0,this._errorMsg=null,this._errorLocation=null,this._errorIndicator=null,this._input=n||null,this._distance=i||null,this._result=s||null},ap={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 n=this._distance*rr.MAX_ENV_DIFF_FRAC;n===0&&(n=.001);var i=new At(this._input.getEnvelopeInternal());i.expandBy(this._distance);var s=new At(this._result.getEnvelopeInternal());s.expandBy(n),s.contains(i)||(this._isValid=!1,this._errorMsg="Buffer envelope is incorrect",this._errorIndicator=this._input.getFactory().toGeometry(s)),this.report("Envelope")},rr.prototype.checkDistance=function(){var n=new Yr(this._input,this._distance,this._result);n.isValid()||(this._isValid=!1,this._errorMsg=n.getErrorMessage(),this._errorLocation=n.getErrorLocation(),this._errorIndicator=n.getErrorIndicator()),this.report("Distance")},rr.prototype.checkArea=function(){var n=this._input.getArea(),i=this._result.getArea();this._distance>0&&n>i&&(this._isValid=!1,this._errorMsg="Area of positive buffer is smaller than input",this._errorIndicator=this._result),this._distance<0&&n<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 Zt||this._result instanceof ae||(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(n){if(!rr.VERBOSE)return null;Ut.out.println("Check "+n+": "+(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(n,i,s){var u=new rr(n,i,s);return u.isValid()?null:u.getErrorMessage()},rr.isValid=function(n,i,s){return!!new rr(n,i,s).isValid()},ap.VERBOSE.get=function(){return!1},ap.MAX_ENV_DIFF_FRAC.get=function(){return .012},Object.defineProperties(rr,ap);var ki=function(){this._pts=null,this._data=null;var n=arguments[0],i=arguments[1];this._pts=n,this._data=i};ki.prototype.getCoordinates=function(){return this._pts},ki.prototype.size=function(){return this._pts.length},ki.prototype.getCoordinate=function(n){return this._pts[n]},ki.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},ki.prototype.getSegmentOctant=function(n){return n===this._pts.length-1?-1:Zs.octant(this.getCoordinate(n),this.getCoordinate(n+1))},ki.prototype.setData=function(n){this._data=n},ki.prototype.getData=function(){return this._data},ki.prototype.toString=function(){return Wt.toLineString(new jt(this._pts))},ki.prototype.interfaces_=function(){return[$i]},ki.prototype.getClass=function(){return ki};var Kn=function(){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new O,this._intersectionCount=0,this._keepIntersections=!0;var n=arguments[0];this._li=n,this._interiorIntersection=null};Kn.prototype.getInteriorIntersection=function(){return this._interiorIntersection},Kn.prototype.setCheckEndSegmentsOnly=function(n){this._isCheckEndSegmentsOnly=n},Kn.prototype.getIntersectionSegments=function(){return this._intSegments},Kn.prototype.count=function(){return this._intersectionCount},Kn.prototype.getIntersections=function(){return this._intersections},Kn.prototype.setFindAllIntersections=function(n){this._findAllIntersections=n},Kn.prototype.setKeepIntersections=function(n){this._keepIntersections=n},Kn.prototype.processIntersections=function(n,i,s,u){if(!this._findAllIntersections&&this.hasIntersection()||n===s&&i===u||this._isCheckEndSegmentsOnly&&!(this.isEndSegment(n,i)||this.isEndSegment(s,u)))return null;var c=n.getCoordinates()[i],m=n.getCoordinates()[i+1],E=s.getCoordinates()[u],C=s.getCoordinates()[u+1];this._li.computeIntersection(c,m,E,C),this._li.hasIntersection()&&this._li.isInteriorIntersection()&&(this._intSegments=new Array(4).fill(null),this._intSegments[0]=c,this._intSegments[1]=m,this._intSegments[2]=E,this._intSegments[3]=C,this._interiorIntersection=this._li.getIntersection(0),this._keepIntersections&&this._intersections.add(this._interiorIntersection),this._intersectionCount++)},Kn.prototype.isEndSegment=function(n,i){return i===0||i>=n.size()-2},Kn.prototype.hasIntersection=function(){return this._interiorIntersection!==null},Kn.prototype.isDone=function(){return!this._findAllIntersections&&this._interiorIntersection!==null},Kn.prototype.interfaces_=function(){return[hs]},Kn.prototype.getClass=function(){return Kn},Kn.createAllIntersectionsFinder=function(n){var i=new Kn(n);return i.setFindAllIntersections(!0),i},Kn.createAnyIntersectionFinder=function(n){return new Kn(n)},Kn.createIntersectionCounter=function(n){var i=new Kn(n);return i.setFindAllIntersections(!0),i.setKeepIntersections(!1),i};var Pi=function(){this._li=new N,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;var n=arguments[0];this._segStrings=n};Pi.prototype.execute=function(){if(this._segInt!==null)return null;this.checkInteriorIntersections()},Pi.prototype.getIntersections=function(){return this._segInt.getIntersections()},Pi.prototype.isValid=function(){return this.execute(),this._isValid},Pi.prototype.setFindAllIntersections=function(n){this._findAllIntersections=n},Pi.prototype.checkInteriorIntersections=function(){this._isValid=!0,this._segInt=new Kn(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var n=new rp;if(n.setSegmentIntersector(this._segInt),n.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null},Pi.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new xo(this.getErrorMessage(),this._segInt.getInteriorIntersection())},Pi.prototype.getErrorMessage=function(){if(this._isValid)return"no intersections found";var n=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+Wt.toLineString(n[0],n[1])+" and "+Wt.toLineString(n[2],n[3])},Pi.prototype.interfaces_=function(){return[]},Pi.prototype.getClass=function(){return Pi},Pi.computeIntersections=function(n){var i=new Pi(n);return i.setFindAllIntersections(!0),i.isValid(),i.getIntersections()};var ms=function n(){this._nv=null;var i=arguments[0];this._nv=new Pi(n.toSegmentStrings(i))};ms.prototype.checkValid=function(){this._nv.checkValid()},ms.prototype.interfaces_=function(){return[]},ms.prototype.getClass=function(){return ms},ms.toSegmentStrings=function(n){for(var i=new O,s=n.iterator();s.hasNext();){var u=s.next();i.add(new ki(u.getCoordinates(),u))}return i},ms.checkValid=function(n){new ms(n).checkValid()};var na=function(n){this._mapOp=n};na.prototype.map=function(n){for(var i=new O,s=0;s<n.getNumGeometries();s++){var u=this._mapOp.map(n.getGeometryN(s));u.isEmpty()||i.add(u)}return n.getFactory().createGeometryCollection(pe.toGeometryArray(i))},na.prototype.interfaces_=function(){return[]},na.prototype.getClass=function(){return na},na.map=function(n,i){return new na(i).map(n)};var qi=function(){this._op=null,this._geometryFactory=null,this._ptLocator=null,this._lineEdgesList=new O,this._resultLineList=new O;var n=arguments[0],i=arguments[1],s=arguments[2];this._op=n,this._geometryFactory=i,this._ptLocator=s};qi.prototype.collectLines=function(n){for(var i=this._op.getGraph().getEdgeEnds().iterator();i.hasNext();){var s=i.next();this.collectLineEdge(s,n,this._lineEdgesList),this.collectBoundaryTouchEdge(s,n,this._lineEdgesList)}},qi.prototype.labelIsolatedLine=function(n,i){var s=this._ptLocator.locate(n.getCoordinate(),this._op.getArgGeometry(i));n.getLabel().setLocation(i,s)},qi.prototype.build=function(n){return this.findCoveredLineEdges(),this.collectLines(n),this.buildLines(n),this._resultLineList},qi.prototype.collectLineEdge=function(n,i,s){var u=n.getLabel(),c=n.getEdge();n.isLineEdge()&&(n.isVisited()||!fe.isResultOfOp(u,i)||c.isCovered()||(s.add(c),n.setVisitedEdge(!0)))},qi.prototype.findCoveredLineEdges=function(){for(var n=this._op.getGraph().getNodes().iterator();n.hasNext();)n.next().getEdges().findCoveredLineEdges();for(var i=this._op.getGraph().getEdgeEnds().iterator();i.hasNext();){var s=i.next(),u=s.getEdge();if(s.isLineEdge()&&!u.isCoveredSet()){var c=this._op.isCoveredByA(s.getCoordinate());u.setCovered(c)}}},qi.prototype.labelIsolatedLines=function(n){for(var i=n.iterator();i.hasNext();){var s=i.next(),u=s.getLabel();s.isIsolated()&&(u.isNull(0)?this.labelIsolatedLine(s,0):this.labelIsolatedLine(s,1))}},qi.prototype.buildLines=function(n){for(var i=this._lineEdgesList.iterator();i.hasNext();){var s=i.next(),u=this._geometryFactory.createLineString(s.getCoordinates());this._resultLineList.add(u),s.setInResult(!0)}},qi.prototype.collectBoundaryTouchEdge=function(n,i,s){var u=n.getLabel();return n.isLineEdge()||n.isVisited()||n.isInteriorAreaEdge()||n.getEdge().isInResult()?null:(Lt.isTrue(!(n.isInResult()||n.getSym().isInResult())||!n.getEdge().isInResult()),void(fe.isResultOfOp(u,i)&&i===fe.INTERSECTION&&(s.add(n.getEdge()),n.setVisitedEdge(!0))))},qi.prototype.interfaces_=function(){return[]},qi.prototype.getClass=function(){return qi};var ra=function(){this._op=null,this._geometryFactory=null,this._resultPointList=new O;var n=arguments[0],i=arguments[1];this._op=n,this._geometryFactory=i};ra.prototype.filterCoveredNodeToPoint=function(n){var i=n.getCoordinate();if(!this._op.isCoveredByLA(i)){var s=this._geometryFactory.createPoint(i);this._resultPointList.add(s)}},ra.prototype.extractNonCoveredResultNodes=function(n){for(var i=this._op.getGraph().getNodes().iterator();i.hasNext();){var s=i.next();if(!s.isInResult()&&!s.isIncidentEdgeInResult()&&(s.getEdges().getDegree()===0||n===fe.INTERSECTION)){var u=s.getLabel();fe.isResultOfOp(u,n)&&this.filterCoveredNodeToPoint(s)}}},ra.prototype.build=function(n){return this.extractNonCoveredResultNodes(n),this._resultPointList},ra.prototype.interfaces_=function(){return[]},ra.prototype.getClass=function(){return ra};var Fr=function(){this._inputGeom=null,this._factory=null,this._pruneEmptyGeometry=!0,this._preserveGeometryCollectionType=!0,this._preserveCollections=!1,this._preserveType=!1};Fr.prototype.transformPoint=function(n,i){return this._factory.createPoint(this.transformCoordinates(n.getCoordinateSequence(),n))},Fr.prototype.transformPolygon=function(n,i){var s=!0,u=this.transformLinearRing(n.getExteriorRing(),n);u!==null&&u instanceof oe&&!u.isEmpty()||(s=!1);for(var c=new O,m=0;m<n.getNumInteriorRing();m++){var E=this.transformLinearRing(n.getInteriorRingN(m),n);E===null||E.isEmpty()||(E instanceof oe||(s=!1),c.add(E))}if(s)return this._factory.createPolygon(u,c.toArray([]));var C=new O;return u!==null&&C.add(u),C.addAll(c),this._factory.buildGeometry(C)},Fr.prototype.createCoordinateSequence=function(n){return this._factory.getCoordinateSequenceFactory().create(n)},Fr.prototype.getInputGeometry=function(){return this._inputGeom},Fr.prototype.transformMultiLineString=function(n,i){for(var s=new O,u=0;u<n.getNumGeometries();u++){var c=this.transformLineString(n.getGeometryN(u),n);c!==null&&(c.isEmpty()||s.add(c))}return this._factory.buildGeometry(s)},Fr.prototype.transformCoordinates=function(n,i){return this.copy(n)},Fr.prototype.transformLineString=function(n,i){return this._factory.createLineString(this.transformCoordinates(n.getCoordinateSequence(),n))},Fr.prototype.transformMultiPoint=function(n,i){for(var s=new O,u=0;u<n.getNumGeometries();u++){var c=this.transformPoint(n.getGeometryN(u),n);c!==null&&(c.isEmpty()||s.add(c))}return this._factory.buildGeometry(s)},Fr.prototype.transformMultiPolygon=function(n,i){for(var s=new O,u=0;u<n.getNumGeometries();u++){var c=this.transformPolygon(n.getGeometryN(u),n);c!==null&&(c.isEmpty()||s.add(c))}return this._factory.buildGeometry(s)},Fr.prototype.copy=function(n){return n.copy()},Fr.prototype.transformGeometryCollection=function(n,i){for(var s=new O,u=0;u<n.getNumGeometries();u++){var c=this.transform(n.getGeometryN(u));c!==null&&(this._pruneEmptyGeometry&&c.isEmpty()||s.add(c))}return this._preserveGeometryCollectionType?this._factory.createGeometryCollection(pe.toGeometryArray(s)):this._factory.buildGeometry(s)},Fr.prototype.transform=function(n){if(this._inputGeom=n,this._factory=n.getFactory(),n instanceof Xt)return this.transformPoint(n,null);if(n instanceof me)return this.transformMultiPoint(n,null);if(n instanceof oe)return this.transformLinearRing(n,null);if(n instanceof at)return this.transformLineString(n,null);if(n instanceof Hr)return this.transformMultiLineString(n,null);if(n instanceof Zt)return this.transformPolygon(n,null);if(n instanceof ae)return this.transformMultiPolygon(n,null);if(n instanceof En)return this.transformGeometryCollection(n,null);throw new A("Unknown Geometry subtype: "+n.getClass().getName())},Fr.prototype.transformLinearRing=function(n,i){var s=this.transformCoordinates(n.getCoordinateSequence(),n);if(s===null)return this._factory.createLinearRing(null);var u=s.size();return u>0&&u<4&&!this._preserveType?this._factory.createLineString(s):this._factory.createLinearRing(s)},Fr.prototype.interfaces_=function(){return[]},Fr.prototype.getClass=function(){return Fr};var Qi=function n(){if(this._snapTolerance=0,this._srcPts=null,this._seg=new Qt,this._allowSnappingToSourceVertices=!1,this._isClosed=!1,arguments[0]instanceof at&&typeof arguments[1]=="number"){var i=arguments[0],s=arguments[1];n.call(this,i.getCoordinates(),s)}else if(arguments[0]instanceof Array&&typeof arguments[1]=="number"){var u=arguments[0],c=arguments[1];this._srcPts=u,this._isClosed=n.isClosed(u),this._snapTolerance=c}};Qi.prototype.snapVertices=function(n,i){for(var s=this._isClosed?n.size()-1:n.size(),u=0;u<s;u++){var c=n.get(u),m=this.findSnapForVertex(c,i);m!==null&&(n.set(u,new I(m)),u===0&&this._isClosed&&n.set(n.size()-1,new I(m)))}},Qi.prototype.findSnapForVertex=function(n,i){for(var s=0;s<i.length;s++){if(n.equals2D(i[s]))return null;if(n.distance(i[s])<this._snapTolerance)return i[s]}return null},Qi.prototype.snapTo=function(n){var i=new $(this._srcPts);return this.snapVertices(i,n),this.snapSegments(i,n),i.toCoordinateArray()},Qi.prototype.snapSegments=function(n,i){if(i.length===0)return null;var s=i.length;i[0].equals2D(i[i.length-1])&&(s=i.length-1);for(var u=0;u<s;u++){var c=i[u],m=this.findSegmentIndexToSnap(c,n);m>=0&&n.add(m+1,new I(c),!1)}},Qi.prototype.findSegmentIndexToSnap=function(n,i){for(var s=S.MAX_VALUE,u=-1,c=0;c<i.size()-1;c++){if(this._seg.p0=i.get(c),this._seg.p1=i.get(c+1),this._seg.p0.equals2D(n)||this._seg.p1.equals2D(n)){if(this._allowSnappingToSourceVertices)continue;return-1}var m=this._seg.distance(n);m<this._snapTolerance&&m<s&&(s=m,u=c)}return u},Qi.prototype.setAllowSnappingToSourceVertices=function(n){this._allowSnappingToSourceVertices=n},Qi.prototype.interfaces_=function(){return[]},Qi.prototype.getClass=function(){return Qi},Qi.isClosed=function(n){return!(n.length<=1)&&n[0].equals2D(n[n.length-1])};var Fn=function(n){this._srcGeom=n||null},gy={SNAP_PRECISION_FACTOR:{configurable:!0}};Fn.prototype.snapTo=function(n,i){var s=this.extractTargetCoordinates(n);return new yy(i,s).transform(this._srcGeom)},Fn.prototype.snapToSelf=function(n,i){var s=this.extractTargetCoordinates(this._srcGeom),u=new yy(n,s,!0).transform(this._srcGeom),c=u;return i&&X(c,re)&&(c=u.buffer(0)),c},Fn.prototype.computeSnapTolerance=function(n){return this.computeMinimumSegmentLength(n)/10},Fn.prototype.extractTargetCoordinates=function(n){for(var i=new M,s=n.getCoordinates(),u=0;u<s.length;u++)i.add(s[u]);return i.toArray(new Array(0).fill(null))},Fn.prototype.computeMinimumSegmentLength=function(n){for(var i=S.MAX_VALUE,s=0;s<n.length-1;s++){var u=n[s].distance(n[s+1]);u<i&&(i=u)}return i},Fn.prototype.interfaces_=function(){return[]},Fn.prototype.getClass=function(){return Fn},Fn.snap=function(n,i,s){var u=new Array(2).fill(null),c=new Fn(n);u[0]=c.snapTo(i,s);var m=new Fn(i);return u[1]=m.snapTo(u[0],s),u},Fn.computeOverlaySnapTolerance=function(){if(arguments.length===1){var n=arguments[0],i=Fn.computeSizeBasedSnapTolerance(n),s=n.getPrecisionModel();if(s.getType()===ge.FIXED){var u=1/s.getScale()*2/1.415;u>i&&(i=u)}return i}if(arguments.length===2){var c=arguments[0],m=arguments[1];return Math.min(Fn.computeOverlaySnapTolerance(c),Fn.computeOverlaySnapTolerance(m))}},Fn.computeSizeBasedSnapTolerance=function(n){var i=n.getEnvelopeInternal();return Math.min(i.getHeight(),i.getWidth())*Fn.SNAP_PRECISION_FACTOR},Fn.snapToSelf=function(n,i,s){return new Fn(n).snapToSelf(i,s)},gy.SNAP_PRECISION_FACTOR.get=function(){return 1e-9},Object.defineProperties(Fn,gy);var yy=function(n){function i(s,u,c){n.call(this),this._snapTolerance=s||null,this._snapPts=u||null,this._isSelfSnap=c!==void 0&&c}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.snapLine=function(s,u){var c=new Qi(s,this._snapTolerance);return c.setAllowSnappingToSourceVertices(this._isSelfSnap),c.snapTo(u)},i.prototype.transformCoordinates=function(s,u){var c=s.toCoordinateArray(),m=this.snapLine(c,this._snapPts);return this._factory.getCoordinateSequenceFactory().create(m)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(Fr),wr=function(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=0,this._commonSignExp=null};wr.prototype.getCommon=function(){return S.longBitsToDouble(this._commonBits)},wr.prototype.add=function(n){var i=S.doubleToLongBits(n);if(this._isFirst)return this._commonBits=i,this._commonSignExp=wr.signExpBits(this._commonBits),this._isFirst=!1,null;if(wr.signExpBits(i)!==this._commonSignExp)return this._commonBits=0,null;this._commonMantissaBitsCount=wr.numCommonMostSigMantissaBits(this._commonBits,i),this._commonBits=wr.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))},wr.prototype.toString=function(){if(arguments.length===1){var n=arguments[0],i=S.longBitsToDouble(n),s="0000000000000000000000000000000000000000000000000000000000000000"+S.toBinaryString(n),u=s.substring(s.length-64);return u.substring(0,1)+" "+u.substring(1,12)+"(exp) "+u.substring(12)+" [ "+i+" ]"}},wr.prototype.interfaces_=function(){return[]},wr.prototype.getClass=function(){return wr},wr.getBit=function(n,i){return n&1<<i?1:0},wr.signExpBits=function(n){return n>>52},wr.zeroLowerBits=function(n,i){return n&~((1<<i)-1)},wr.numCommonMostSigMantissaBits=function(n,i){for(var s=0,u=52;u>=0;u--){if(wr.getBit(n,u)!==wr.getBit(i,u))return s;s++}return 52};var Wo=function(){this._commonCoord=null,this._ccFilter=new ia},up={CommonCoordinateFilter:{configurable:!0},Translater:{configurable:!0}};Wo.prototype.addCommonBits=function(n){var i=new Xo(this._commonCoord);n.apply(i),n.geometryChanged()},Wo.prototype.removeCommonBits=function(n){if(this._commonCoord.x===0&&this._commonCoord.y===0)return n;var i=new I(this._commonCoord);i.x=-i.x,i.y=-i.y;var s=new Xo(i);return n.apply(s),n.geometryChanged(),n},Wo.prototype.getCommonCoordinate=function(){return this._commonCoord},Wo.prototype.add=function(n){n.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()},Wo.prototype.interfaces_=function(){return[]},Wo.prototype.getClass=function(){return Wo},up.CommonCoordinateFilter.get=function(){return ia},up.Translater.get=function(){return Xo},Object.defineProperties(Wo,up);var ia=function(){this._commonBitsX=new wr,this._commonBitsY=new wr};ia.prototype.filter=function(n){this._commonBitsX.add(n.x),this._commonBitsY.add(n.y)},ia.prototype.getCommonCoordinate=function(){return new I(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())},ia.prototype.interfaces_=function(){return[J]},ia.prototype.getClass=function(){return ia};var Xo=function(){this.trans=null;var n=arguments[0];this.trans=n};Xo.prototype.filter=function(n,i){var s=n.getOrdinate(i,0)+this.trans.x,u=n.getOrdinate(i,1)+this.trans.y;n.setOrdinate(i,0,s),n.setOrdinate(i,1,u)},Xo.prototype.isDone=function(){return!1},Xo.prototype.isGeometryChanged=function(){return!0},Xo.prototype.interfaces_=function(){return[Tn]},Xo.prototype.getClass=function(){return Xo};var jn=function(n,i){this._geom=new Array(2).fill(null),this._snapTolerance=null,this._cbr=null,this._geom[0]=n,this._geom[1]=i,this.computeSnapTolerance()};jn.prototype.selfSnap=function(n){return new Fn(n).snapTo(n,this._snapTolerance)},jn.prototype.removeCommonBits=function(n){this._cbr=new Wo,this._cbr.add(n[0]),this._cbr.add(n[1]);var i=new Array(2).fill(null);return i[0]=this._cbr.removeCommonBits(n[0].copy()),i[1]=this._cbr.removeCommonBits(n[1].copy()),i},jn.prototype.prepareResult=function(n){return this._cbr.addCommonBits(n),n},jn.prototype.getResultGeometry=function(n){var i=this.snap(this._geom),s=fe.overlayOp(i[0],i[1],n);return this.prepareResult(s)},jn.prototype.checkValid=function(n){n.isValid()||Ut.out.println("Snapped geometry is invalid")},jn.prototype.computeSnapTolerance=function(){this._snapTolerance=Fn.computeOverlaySnapTolerance(this._geom[0],this._geom[1])},jn.prototype.snap=function(n){var i=this.removeCommonBits(n);return Fn.snap(i[0],i[1],this._snapTolerance)},jn.prototype.interfaces_=function(){return[]},jn.prototype.getClass=function(){return jn},jn.overlayOp=function(n,i,s){return new jn(n,i).getResultGeometry(s)},jn.union=function(n,i){return jn.overlayOp(n,i,fe.UNION)},jn.intersection=function(n,i){return jn.overlayOp(n,i,fe.INTERSECTION)},jn.symDifference=function(n,i){return jn.overlayOp(n,i,fe.SYMDIFFERENCE)},jn.difference=function(n,i){return jn.overlayOp(n,i,fe.DIFFERENCE)};var br=function(n,i){this._geom=new Array(2).fill(null),this._geom[0]=n,this._geom[1]=i};br.prototype.getResultGeometry=function(n){var i=null,s=!1,u=null;try{i=fe.overlayOp(this._geom[0],this._geom[1],n),s=!0}catch(c){if(!(c instanceof ie))throw c;u=c}if(!s)try{i=jn.overlayOp(this._geom[0],this._geom[1],n)}catch(c){throw c instanceof ie?u:c}return i},br.prototype.interfaces_=function(){return[]},br.prototype.getClass=function(){return br},br.overlayOp=function(n,i,s){return new br(n,i).getResultGeometry(s)},br.union=function(n,i){return br.overlayOp(n,i,fe.UNION)},br.intersection=function(n,i){return br.overlayOp(n,i,fe.INTERSECTION)},br.symDifference=function(n,i){return br.overlayOp(n,i,fe.SYMDIFFERENCE)},br.difference=function(n,i){return br.overlayOp(n,i,fe.DIFFERENCE)};var ul=function(){this.mce=null,this.chainIndex=null;var n=arguments[0],i=arguments[1];this.mce=n,this.chainIndex=i};ul.prototype.computeIntersections=function(n,i){this.mce.computeIntersectsForChain(this.chainIndex,n.mce,n.chainIndex,i)},ul.prototype.interfaces_=function(){return[]},ul.prototype.getClass=function(){return ul};var $r=function n(){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],s=arguments[1];this._eventType=n.DELETE,this._xValue=i,this._insertEvent=s}else if(arguments.length===3){var u=arguments[0],c=arguments[1],m=arguments[2];this._eventType=n.INSERT,this._label=u,this._xValue=c,this._obj=m}},lp={INSERT:{configurable:!0},DELETE:{configurable:!0}};$r.prototype.isDelete=function(){return this._eventType===$r.DELETE},$r.prototype.setDeleteEventIndex=function(n){this._deleteEventIndex=n},$r.prototype.getObject=function(){return this._obj},$r.prototype.compareTo=function(n){var i=n;return this._xValue<i._xValue?-1:this._xValue>i._xValue?1:this._eventType<i._eventType?-1:this._eventType>i._eventType?1:0},$r.prototype.getInsertEvent=function(){return this._insertEvent},$r.prototype.isInsert=function(){return this._eventType===$r.INSERT},$r.prototype.isSameLabel=function(n){return this._label!==null&&this._label===n._label},$r.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex},$r.prototype.interfaces_=function(){return[G]},$r.prototype.getClass=function(){return $r},lp.INSERT.get=function(){return 1},lp.DELETE.get=function(){return 2},Object.defineProperties($r,lp);var mc=function(){};mc.prototype.interfaces_=function(){return[]},mc.prototype.getClass=function(){return mc};var ir=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 n=arguments[0],i=arguments[1],s=arguments[2];this._li=n,this._includeProper=i,this._recordIsolated=s};ir.prototype.isTrivialIntersection=function(n,i,s,u){if(n===s&&this._li.getIntersectionNum()===1){if(ir.isAdjacentSegments(i,u))return!0;if(n.isClosed()){var c=n.getNumPoints()-1;if(i===0&&u===c||u===0&&i===c)return!0}}return!1},ir.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},ir.prototype.setIsDoneIfProperInt=function(n){this._isDoneWhenProperInt=n},ir.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},ir.prototype.isBoundaryPointInternal=function(n,i){for(var s=i.iterator();s.hasNext();){var u=s.next().getCoordinate();if(n.isIntersection(u))return!0}return!1},ir.prototype.hasProperIntersection=function(){return this._hasProper},ir.prototype.hasIntersection=function(){return this._hasIntersection},ir.prototype.isDone=function(){return this._isDone},ir.prototype.isBoundaryPoint=function(n,i){return i!==null&&(!!this.isBoundaryPointInternal(n,i[0])||!!this.isBoundaryPointInternal(n,i[1]))},ir.prototype.setBoundaryNodes=function(n,i){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=n,this._bdyNodes[1]=i},ir.prototype.addIntersections=function(n,i,s,u){if(n===s&&i===u)return null;this.numTests++;var c=n.getCoordinates()[i],m=n.getCoordinates()[i+1],E=s.getCoordinates()[u],C=s.getCoordinates()[u+1];this._li.computeIntersection(c,m,E,C),this._li.hasIntersection()&&(this._recordIsolated&&(n.setIsolated(!1),s.setIsolated(!1)),this._numIntersections++,this.isTrivialIntersection(n,i,s,u)||(this._hasIntersection=!0,!this._includeProper&&this._li.isProper()||(n.addIntersections(this._li,i,0),s.addIntersections(this._li,u,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))))},ir.prototype.interfaces_=function(){return[]},ir.prototype.getClass=function(){return ir},ir.isAdjacentSegments=function(n,i){return Math.abs(n-i)===1};var tC=function(n){function i(){n.call(this),this.events=new O,this.nOverlaps=null}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.prepareEvents=function(){Ti.sort(this.events);for(var s=0;s<this.events.size();s++){var u=this.events.get(s);u.isDelete()&&u.getInsertEvent().setDeleteEventIndex(s)}},i.prototype.computeIntersections=function(){if(arguments.length===1){var s=arguments[0];this.nOverlaps=0,this.prepareEvents();for(var u=0;u<this.events.size();u++){var c=this.events.get(u);if(c.isInsert()&&this.processOverlaps(u,c.getDeleteEventIndex(),c,s),s.isDone())break}}else if(arguments.length===3){if(arguments[2]instanceof ir&&X(arguments[0],ct)&&X(arguments[1],ct)){var m=arguments[0],E=arguments[1],C=arguments[2];this.addEdges(m,m),this.addEdges(E,E),this.computeIntersections(C)}else if(typeof arguments[2]=="boolean"&&X(arguments[0],ct)&&arguments[1]instanceof ir){var U=arguments[0],Z=arguments[1];arguments[2]?this.addEdges(U,null):this.addEdges(U),this.computeIntersections(Z)}}},i.prototype.addEdge=function(s,u){for(var c=s.getMonotoneChainEdge(),m=c.getStartIndexes(),E=0;E<m.length-1;E++){var C=new ul(c,E),U=new $r(u,c.getMinX(E),C);this.events.add(U),this.events.add(new $r(c.getMaxX(E),U))}},i.prototype.processOverlaps=function(s,u,c,m){for(var E=c.getObject(),C=s;C<u;C++){var U=this.events.get(C);if(U.isInsert()){var Z=U.getObject();c.isSameLabel(U)||(E.computeIntersections(Z,m),this.nOverlaps++)}}},i.prototype.addEdges=function(){if(arguments.length===1)for(var s=arguments[0].iterator();s.hasNext();){var u=s.next();this.addEdge(u,u)}else if(arguments.length===2)for(var c=arguments[0],m=arguments[1],E=c.iterator();E.hasNext();){var C=E.next();this.addEdge(C,m)}},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(mc),to=function(){this._min=S.POSITIVE_INFINITY,this._max=S.NEGATIVE_INFINITY},vy={NodeComparator:{configurable:!0}};to.prototype.getMin=function(){return this._min},to.prototype.intersects=function(n,i){return!(this._min>i||this._max<n)},to.prototype.getMax=function(){return this._max},to.prototype.toString=function(){return Wt.toLineString(new I(this._min,0),new I(this._max,0))},to.prototype.interfaces_=function(){return[]},to.prototype.getClass=function(){return to},vy.NodeComparator.get=function(){return ll},Object.defineProperties(to,vy);var ll=function(){};ll.prototype.compare=function(n,i){var s=n,u=i,c=(s._min+s._max)/2,m=(u._min+u._max)/2;return c<m?-1:c>m?1:0},ll.prototype.interfaces_=function(){return[F]},ll.prototype.getClass=function(){return ll};var eC=function(n){function i(){n.call(this),this._item=null;var s=arguments[0],u=arguments[1],c=arguments[2];this._min=s,this._max=u,this._item=c}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.query=function(s,u,c){if(!this.intersects(s,u))return null;c.visitItem(this._item)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(to),nC=function(n){function i(){n.call(this),this._node1=null,this._node2=null;var s=arguments[0],u=arguments[1];this._node1=s,this._node2=u,this.buildExtent(this._node1,this._node2)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.buildExtent=function(s,u){this._min=Math.min(s._min,u._min),this._max=Math.max(s._max,u._max)},i.prototype.query=function(s,u,c){if(!this.intersects(s,u))return null;this._node1!==null&&this._node1.query(s,u,c),this._node2!==null&&this._node2.query(s,u,c)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(to),eo=function(){this._leaves=new O,this._root=null,this._level=0};eo.prototype.buildTree=function(){Ti.sort(this._leaves,new to.NodeComparator);for(var n=this._leaves,i=null,s=new O;;){if(this.buildLevel(n,s),s.size()===1)return s.get(0);i=n,n=s,s=i}},eo.prototype.insert=function(n,i,s){if(this._root!==null)throw new Error("Index cannot be added to once it has been queried");this._leaves.add(new eC(n,i,s))},eo.prototype.query=function(n,i,s){this.init(),this._root.query(n,i,s)},eo.prototype.buildRoot=function(){if(this._root!==null)return null;this._root=this.buildTree()},eo.prototype.printNode=function(n){Ut.out.println(Wt.toLineString(new I(n._min,this._level),new I(n._max,this._level)))},eo.prototype.init=function(){if(this._root!==null)return null;this.buildRoot()},eo.prototype.buildLevel=function(n,i){this._level++,i.clear();for(var s=0;s<n.size();s+=2){var u=n.get(s);if((s+1<n.size()?n.get(s):null)===null)i.add(u);else{var c=new nC(n.get(s),n.get(s+1));i.add(c)}}},eo.prototype.interfaces_=function(){return[]},eo.prototype.getClass=function(){return eo};var ka=function(){this._items=new O};ka.prototype.visitItem=function(n){this._items.add(n)},ka.prototype.getItems=function(){return this._items},ka.prototype.interfaces_=function(){return[Bo]},ka.prototype.getClass=function(){return ka};var qa=function(){this._index=null;var n=arguments[0];if(!X(n,re))throw new A("Argument must be Polygonal");this._index=new gs(n)},cp={SegmentVisitor:{configurable:!0},IntervalIndexedGeometry:{configurable:!0}};qa.prototype.locate=function(n){var i=new Et(n),s=new Va(i);return this._index.query(n.y,n.y,s),i.getLocation()},qa.prototype.interfaces_=function(){return[Ba]},qa.prototype.getClass=function(){return qa},cp.SegmentVisitor.get=function(){return Va},cp.IntervalIndexedGeometry.get=function(){return gs},Object.defineProperties(qa,cp);var Va=function(){this._counter=null;var n=arguments[0];this._counter=n};Va.prototype.visitItem=function(n){var i=n;this._counter.countSegment(i.getCoordinate(0),i.getCoordinate(1))},Va.prototype.interfaces_=function(){return[Bo]},Va.prototype.getClass=function(){return Va};var gs=function(){this._index=new eo;var n=arguments[0];this.init(n)};gs.prototype.init=function(n){for(var i=er.getLines(n).iterator();i.hasNext();){var s=i.next().getCoordinates();this.addLine(s)}},gs.prototype.addLine=function(n){for(var i=1;i<n.length;i++){var s=new Qt(n[i-1],n[i]),u=Math.min(s.p0.y,s.p1.y),c=Math.max(s.p0.y,s.p1.y);this._index.insert(u,c,s)}},gs.prototype.query=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1],s=new ka;return this._index.query(n,i,s),s.getItems()}if(arguments.length===3){var u=arguments[0],c=arguments[1],m=arguments[2];this._index.query(u,c,m)}},gs.prototype.interfaces_=function(){return[]},gs.prototype.getClass=function(){return gs};var cl=function(n){function i(){if(n.call(this),this._parentGeom=null,this._lineEdgeMap=new Qu,this._boundaryNodeRule=null,this._useBoundaryDeterminationRule=!0,this._argIndex=null,this._boundaryNodes=null,this._hasTooFewPoints=!1,this._invalidPoint=null,this._areaPtLocator=null,this._ptLocator=new Ci,arguments.length===2){var s=arguments[0],u=arguments[1],c=w.OGC_SFS_BOUNDARY_RULE;this._argIndex=s,this._parentGeom=u,this._boundaryNodeRule=c,u!==null&&this.add(u)}else if(arguments.length===3){var m=arguments[0],E=arguments[1],C=arguments[2];this._argIndex=m,this._parentGeom=E,this._boundaryNodeRule=C,E!==null&&this.add(E)}}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.insertBoundaryPoint=function(s,u){var c=this._nodes.addNode(u).getLabel(),m=1;V.NONE,c.getLocation(s,It.ON)===V.BOUNDARY&&m++;var E=i.determineBoundary(this._boundaryNodeRule,m);c.setLocation(s,E)},i.prototype.computeSelfNodes=function(){if(arguments.length===2){var s=arguments[0],u=arguments[1];return this.computeSelfNodes(s,u,!1)}if(arguments.length===3){var c=arguments[0],m=arguments[1],E=arguments[2],C=new ir(c,!0,!1);C.setIsDoneIfProperInt(E);var U=this.createEdgeSetIntersector(),Z=this._parentGeom instanceof oe||this._parentGeom instanceof Zt||this._parentGeom instanceof ae,pt=m||!Z;return U.computeIntersections(this._edges,C,pt),this.addSelfIntersectionNodes(this._argIndex),C}},i.prototype.computeSplitEdges=function(s){for(var u=this._edges.iterator();u.hasNext();)u.next().eiList.addSplitEdges(s)},i.prototype.computeEdgeIntersections=function(s,u,c){var m=new ir(u,c,!0);return m.setBoundaryNodes(this.getBoundaryNodes(),s.getBoundaryNodes()),this.createEdgeSetIntersector().computeIntersections(this._edges,s._edges,m),m},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 Xt){var s=arguments[0].getCoordinate();this.insertPoint(this._argIndex,s,V.INTERIOR)}else if(arguments[0]instanceof I){var u=arguments[0];this.insertPoint(this._argIndex,u,V.INTERIOR)}},i.prototype.addPolygon=function(s){this.addPolygonRing(s.getExteriorRing(),V.EXTERIOR,V.INTERIOR);for(var u=0;u<s.getNumInteriorRing();u++){var c=s.getInteriorRingN(u);this.addPolygonRing(c,V.INTERIOR,V.EXTERIOR)}},i.prototype.addEdge=function(s){this.insertEdge(s);var u=s.getCoordinates();this.insertPoint(this._argIndex,u[0],V.BOUNDARY),this.insertPoint(this._argIndex,u[u.length-1],V.BOUNDARY)},i.prototype.addLineString=function(s){var u=Q.removeRepeatedPoints(s.getCoordinates());if(u.length<2)return this._hasTooFewPoints=!0,this._invalidPoint=u[0],null;var c=new dc(u,new fn(this._argIndex,V.INTERIOR));this._lineEdgeMap.put(s,c),this.insertEdge(c),Lt.isTrue(u.length>=2,"found LineString with single point"),this.insertBoundaryPoint(this._argIndex,u[0]),this.insertBoundaryPoint(this._argIndex,u[u.length-1])},i.prototype.getInvalidPoint=function(){return this._invalidPoint},i.prototype.getBoundaryPoints=function(){for(var s=this.getBoundaryNodes(),u=new Array(s.size()).fill(null),c=0,m=s.iterator();m.hasNext();){var E=m.next();u[c++]=E.getCoordinate().copy()}return u},i.prototype.getBoundaryNodes=function(){return this._boundaryNodes===null&&(this._boundaryNodes=this._nodes.getBoundaryNodes(this._argIndex)),this._boundaryNodes},i.prototype.addSelfIntersectionNode=function(s,u,c){if(this.isBoundaryNode(s,u))return null;c===V.BOUNDARY&&this._useBoundaryDeterminationRule?this.insertBoundaryPoint(s,u):this.insertPoint(s,u,c)},i.prototype.addPolygonRing=function(s,u,c){if(s.isEmpty())return null;var m=Q.removeRepeatedPoints(s.getCoordinates());if(m.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=m[0],null;var E=u,C=c;ot.isCCW(m)&&(E=c,C=u);var U=new dc(m,new fn(this._argIndex,V.BOUNDARY,E,C));this._lineEdgeMap.put(s,U),this.insertEdge(U),this.insertPoint(this._argIndex,m[0],V.BOUNDARY)},i.prototype.insertPoint=function(s,u,c){var m=this._nodes.addNode(u),E=m.getLabel();E===null?m._label=new fn(s,c):E.setLocation(s,c)},i.prototype.createEdgeSetIntersector=function(){return new tC},i.prototype.addSelfIntersectionNodes=function(s){for(var u=this._edges.iterator();u.hasNext();)for(var c=u.next(),m=c.getLabel().getLocation(s),E=c.eiList.iterator();E.hasNext();){var C=E.next();this.addSelfIntersectionNode(s,C.coord,m)}},i.prototype.add=function(){if(arguments.length!==1)return n.prototype.add.apply(this,arguments);var s=arguments[0];if(s.isEmpty())return null;if(s instanceof ae&&(this._useBoundaryDeterminationRule=!1),s instanceof Zt)this.addPolygon(s);else if(s instanceof at)this.addLineString(s);else if(s instanceof Xt)this.addPoint(s);else if(s instanceof me)this.addCollection(s);else if(s instanceof Hr)this.addCollection(s);else if(s instanceof ae)this.addCollection(s);else{if(!(s instanceof En))throw new Error(s.getClass().getName());this.addCollection(s)}},i.prototype.addCollection=function(s){for(var u=0;u<s.getNumGeometries();u++){var c=s.getGeometryN(u);this.add(c)}},i.prototype.locate=function(s){return X(this._parentGeom,re)&&this._parentGeom.getNumGeometries()>50?(this._areaPtLocator===null&&(this._areaPtLocator=new qa(this._parentGeom)),this._areaPtLocator.locate(s)):this._ptLocator.locate(s,this._parentGeom)},i.prototype.findEdge=function(){if(arguments.length===1){var s=arguments[0];return this._lineEdgeMap.get(s)}return n.prototype.findEdge.apply(this,arguments)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i.determineBoundary=function(s,u){return s.isInBoundary(u)?V.BOUNDARY:V.INTERIOR},i}(Rn),Ha=function(){if(this._li=new N,this._resultPrecisionModel=null,this._arg=null,arguments.length===1){var n=arguments[0];this.setComputationPrecision(n.getPrecisionModel()),this._arg=new Array(1).fill(null),this._arg[0]=new cl(0,n)}else if(arguments.length===2){var i=arguments[0],s=arguments[1],u=w.OGC_SFS_BOUNDARY_RULE;i.getPrecisionModel().compareTo(s.getPrecisionModel())>=0?this.setComputationPrecision(i.getPrecisionModel()):this.setComputationPrecision(s.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new cl(0,i,u),this._arg[1]=new cl(1,s,u)}else if(arguments.length===3){var c=arguments[0],m=arguments[1],E=arguments[2];c.getPrecisionModel().compareTo(m.getPrecisionModel())>=0?this.setComputationPrecision(c.getPrecisionModel()):this.setComputationPrecision(m.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new cl(0,c,E),this._arg[1]=new cl(1,m,E)}};Ha.prototype.getArgGeometry=function(n){return this._arg[n].getGeometry()},Ha.prototype.setComputationPrecision=function(n){this._resultPrecisionModel=n,this._li.setPrecisionModel(this._resultPrecisionModel)},Ha.prototype.interfaces_=function(){return[]},Ha.prototype.getClass=function(){return Ha};var ys=function(){};ys.prototype.interfaces_=function(){return[]},ys.prototype.getClass=function(){return ys},ys.map=function(){if(arguments[0]instanceof Ct&&X(arguments[1],ys.MapOp)){for(var n=arguments[0],i=arguments[1],s=new O,u=0;u<n.getNumGeometries();u++){var c=i.map(n.getGeometryN(u));c!==null&&s.add(c)}return n.getFactory().buildGeometry(s)}if(X(arguments[0],j)&&X(arguments[1],ys.MapOp)){for(var m=arguments[0],E=arguments[1],C=new O,U=m.iterator();U.hasNext();){var Z=U.next(),pt=E.map(Z);pt!==null&&C.add(pt)}return C}},ys.MapOp=function(){};var fe=function(n){function i(){var s=arguments[0],u=arguments[1];n.call(this,s,u),this._ptLocator=new Ci,this._geomFact=null,this._resultGeom=null,this._graph=null,this._edgeList=new Ai,this._resultPolyList=new O,this._resultLineList=new O,this._resultPointList=new O,this._graph=new Rn(new ly),this._geomFact=s.getFactory()}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.insertUniqueEdge=function(s){var u=this._edgeList.findEqualEdge(s);if(u!==null){var c=u.getLabel(),m=s.getLabel();u.isPointwiseEqual(s)||(m=new fn(s.getLabel())).flip();var E=u.getDepth();E.isNull()&&E.add(c),E.add(m),c.merge(m)}else this._edgeList.add(s)},i.prototype.getGraph=function(){return this._graph},i.prototype.cancelDuplicateResultEdges=function(){for(var s=this._graph.getEdgeEnds().iterator();s.hasNext();){var u=s.next(),c=u.getSym();u.isInResult()&&c.isInResult()&&(u.setInResult(!1),c.setInResult(!1))}},i.prototype.isCoveredByLA=function(s){return!!this.isCovered(s,this._resultLineList)||!!this.isCovered(s,this._resultPolyList)},i.prototype.computeGeometry=function(s,u,c,m){var E=new O;return E.addAll(s),E.addAll(u),E.addAll(c),E.isEmpty()?i.createEmptyResult(m,this._arg[0].getGeometry(),this._arg[1].getGeometry(),this._geomFact):this._geomFact.buildGeometry(E)},i.prototype.mergeSymLabels=function(){for(var s=this._graph.getNodes().iterator();s.hasNext();)s.next().getEdges().mergeSymLabels()},i.prototype.isCovered=function(s,u){for(var c=u.iterator();c.hasNext();){var m=c.next();if(this._ptLocator.locate(s,m)!==V.EXTERIOR)return!0}return!1},i.prototype.replaceCollapsedEdges=function(){for(var s=new O,u=this._edgeList.iterator();u.hasNext();){var c=u.next();c.isCollapsed()&&(u.remove(),s.add(c.getCollapsedEdge()))}this._edgeList.addAll(s)},i.prototype.updateNodeLabelling=function(){for(var s=this._graph.getNodes().iterator();s.hasNext();){var u=s.next(),c=u.getEdges().getLabel();u.getLabel().merge(c)}},i.prototype.getResultGeometry=function(s){return this.computeOverlay(s),this._resultGeom},i.prototype.insertUniqueEdges=function(s){for(var u=s.iterator();u.hasNext();){var c=u.next();this.insertUniqueEdge(c)}},i.prototype.computeOverlay=function(s){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 u=new O;this._arg[0].computeSplitEdges(u),this._arg[1].computeSplitEdges(u),this.insertUniqueEdges(u),this.computeLabelsFromDepths(),this.replaceCollapsedEdges(),ms.checkValid(this._edgeList.getEdges()),this._graph.addEdges(this._edgeList.getEdges()),this.computeLabelling(),this.labelIncompleteNodes(),this.findResultAreaEdges(s),this.cancelDuplicateResultEdges();var c=new Wr(this._geomFact);c.add(this._graph),this._resultPolyList=c.getPolygons();var m=new qi(this,this._geomFact,this._ptLocator);this._resultLineList=m.build(s);var E=new ra(this,this._geomFact,this._ptLocator);this._resultPointList=E.build(s),this._resultGeom=this.computeGeometry(this._resultPointList,this._resultLineList,this._resultPolyList,s)},i.prototype.labelIncompleteNode=function(s,u){var c=this._ptLocator.locate(s.getCoordinate(),this._arg[u].getGeometry());s.getLabel().setLocation(u,c)},i.prototype.copyPoints=function(s){for(var u=this._arg[s].getNodeIterator();u.hasNext();){var c=u.next();this._graph.addNode(c.getCoordinate()).setLabel(s,c.getLabel().getLocation(s))}},i.prototype.findResultAreaEdges=function(s){for(var u=this._graph.getEdgeEnds().iterator();u.hasNext();){var c=u.next(),m=c.getLabel();m.isArea()&&!c.isInteriorAreaEdge()&&i.isResultOfOp(m.getLocation(0,It.RIGHT),m.getLocation(1,It.RIGHT),s)&&c.setInResult(!0)}},i.prototype.computeLabelsFromDepths=function(){for(var s=this._edgeList.iterator();s.hasNext();){var u=s.next(),c=u.getLabel(),m=u.getDepth();if(!m.isNull()){m.normalize();for(var E=0;E<2;E++)c.isNull(E)||!c.isArea()||m.isNull(E)||(m.getDelta(E)===0?c.toLine(E):(Lt.isTrue(!m.isNull(E,It.LEFT),"depth of LEFT side has not been initialized"),c.setLocation(E,It.LEFT,m.getLocation(E,It.LEFT)),Lt.isTrue(!m.isNull(E,It.RIGHT),"depth of RIGHT side has not been initialized"),c.setLocation(E,It.RIGHT,m.getLocation(E,It.RIGHT))))}}},i.prototype.computeLabelling=function(){for(var s=this._graph.getNodes().iterator();s.hasNext();)s.next().getEdges().computeLabelling(this._arg);this.mergeSymLabels(),this.updateNodeLabelling()},i.prototype.labelIncompleteNodes=function(){for(var s=this._graph.getNodes().iterator();s.hasNext();){var u=s.next(),c=u.getLabel();u.isIsolated()&&(c.isNull(0)?this.labelIncompleteNode(u,0):this.labelIncompleteNode(u,1)),u.getEdges().updateLabelling(c)}},i.prototype.isCoveredByA=function(s){return!!this.isCovered(s,this._resultPolyList)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(Ha);fe.overlayOp=function(n,i,s){return new fe(n,i).getResultGeometry(s)},fe.intersection=function(n,i){if(n.isEmpty()||i.isEmpty())return fe.createEmptyResult(fe.INTERSECTION,n,i,n.getFactory());if(n.isGeometryCollection()){var s=i;return na.map(n,{interfaces_:function(){return[ys.MapOp]},map:function(u){return u.intersection(s)}})}return n.checkNotGeometryCollection(n),n.checkNotGeometryCollection(i),br.overlayOp(n,i,fe.INTERSECTION)},fe.symDifference=function(n,i){if(n.isEmpty()||i.isEmpty()){if(n.isEmpty()&&i.isEmpty())return fe.createEmptyResult(fe.SYMDIFFERENCE,n,i,n.getFactory());if(n.isEmpty())return i.copy();if(i.isEmpty())return n.copy()}return n.checkNotGeometryCollection(n),n.checkNotGeometryCollection(i),br.overlayOp(n,i,fe.SYMDIFFERENCE)},fe.resultDimension=function(n,i,s){var u=i.getDimension(),c=s.getDimension(),m=-1;switch(n){case fe.INTERSECTION:m=Math.min(u,c);break;case fe.UNION:m=Math.max(u,c);break;case fe.DIFFERENCE:m=u;break;case fe.SYMDIFFERENCE:m=Math.max(u,c)}return m},fe.createEmptyResult=function(n,i,s,u){var c=null;switch(fe.resultDimension(n,i,s)){case-1:c=u.createGeometryCollection(new Array(0).fill(null));break;case 0:c=u.createPoint();break;case 1:c=u.createLineString();break;case 2:c=u.createPolygon()}return c},fe.difference=function(n,i){return n.isEmpty()?fe.createEmptyResult(fe.DIFFERENCE,n,i,n.getFactory()):i.isEmpty()?n.copy():(n.checkNotGeometryCollection(n),n.checkNotGeometryCollection(i),br.overlayOp(n,i,fe.DIFFERENCE))},fe.isResultOfOp=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1],s=n.getLocation(0),u=n.getLocation(1);return fe.isResultOfOp(s,u,i)}if(arguments.length===3){var c=arguments[0],m=arguments[1],E=arguments[2];switch(c===V.BOUNDARY&&(c=V.INTERIOR),m===V.BOUNDARY&&(m=V.INTERIOR),E){case fe.INTERSECTION:return c===V.INTERIOR&&m===V.INTERIOR;case fe.UNION:return c===V.INTERIOR||m===V.INTERIOR;case fe.DIFFERENCE:return c===V.INTERIOR&&m!==V.INTERIOR;case fe.SYMDIFFERENCE:return c===V.INTERIOR&&m!==V.INTERIOR||c!==V.INTERIOR&&m===V.INTERIOR}return!1}},fe.INTERSECTION=1,fe.UNION=2,fe.DIFFERENCE=3,fe.SYMDIFFERENCE=4;var Yo=function(){this._g=null,this._boundaryDistanceTolerance=null,this._linework=null,this._ptLocator=new Ci,this._seg=new Qt;var n=arguments[0],i=arguments[1];this._g=n,this._boundaryDistanceTolerance=i,this._linework=this.extractLinework(n)};Yo.prototype.isWithinToleranceOfBoundary=function(n){for(var i=0;i<this._linework.getNumGeometries();i++)for(var s=this._linework.getGeometryN(i).getCoordinateSequence(),u=0;u<s.size()-1;u++)if(s.getCoordinate(u,this._seg.p0),s.getCoordinate(u+1,this._seg.p1),this._seg.distance(n)<=this._boundaryDistanceTolerance)return!0;return!1},Yo.prototype.getLocation=function(n){return this.isWithinToleranceOfBoundary(n)?V.BOUNDARY:this._ptLocator.locate(n,this._g)},Yo.prototype.extractLinework=function(n){var i=new Wa;n.apply(i);var s=i.getLinework(),u=pe.toLineStringArray(s);return n.getFactory().createMultiLineString(u)},Yo.prototype.interfaces_=function(){return[]},Yo.prototype.getClass=function(){return Yo};var Wa=function(){this._linework=null,this._linework=new O};Wa.prototype.getLinework=function(){return this._linework},Wa.prototype.filter=function(n){if(n instanceof Zt){var i=n;this._linework.add(i.getExteriorRing());for(var s=0;s<i.getNumInteriorRing();s++)this._linework.add(i.getInteriorRingN(s))}},Wa.prototype.interfaces_=function(){return[In]},Wa.prototype.getClass=function(){return Wa};var vs=function(){this._g=null,this._doLeft=!0,this._doRight=!0;var n=arguments[0];this._g=n};vs.prototype.extractPoints=function(n,i,s){for(var u=n.getCoordinates(),c=0;c<u.length-1;c++)this.computeOffsetPoints(u[c],u[c+1],i,s)},vs.prototype.setSidesToGenerate=function(n,i){this._doLeft=n,this._doRight=i},vs.prototype.getPoints=function(n){for(var i=new O,s=er.getLines(this._g).iterator();s.hasNext();){var u=s.next();this.extractPoints(u,n,i)}return i},vs.prototype.computeOffsetPoints=function(n,i,s,u){var c=i.x-n.x,m=i.y-n.y,E=Math.sqrt(c*c+m*m),C=s*c/E,U=s*m/E,Z=(i.x+n.x)/2,pt=(i.y+n.y)/2;if(this._doLeft){var gt=new I(Z-U,pt+C);u.add(gt)}if(this._doRight){var Rt=new I(Z+U,pt-C);u.add(Rt)}},vs.prototype.interfaces_=function(){return[]},vs.prototype.getClass=function(){return vs};var ai=function n(){this._geom=null,this._locFinder=null,this._location=new Array(3).fill(null),this._invalidLocation=null,this._boundaryDistanceTolerance=n.TOLERANCE,this._testCoords=new O;var i=arguments[0],s=arguments[1],u=arguments[2];this._boundaryDistanceTolerance=n.computeBoundaryDistanceTolerance(i,s),this._geom=[i,s,u],this._locFinder=[new Yo(this._geom[0],this._boundaryDistanceTolerance),new Yo(this._geom[1],this._boundaryDistanceTolerance),new Yo(this._geom[2],this._boundaryDistanceTolerance)]},_y={TOLERANCE:{configurable:!0}};ai.prototype.reportResult=function(n,i,s){Ut.out.println("Overlay result invalid - A:"+V.toLocationSymbol(i[0])+" B:"+V.toLocationSymbol(i[1])+" expected:"+(s?"i":"e")+" actual:"+V.toLocationSymbol(i[2]))},ai.prototype.isValid=function(n){this.addTestPts(this._geom[0]),this.addTestPts(this._geom[1]);var i=this.checkValid(n);return i},ai.prototype.checkValid=function(){if(arguments.length===1){for(var n=arguments[0],i=0;i<this._testCoords.size();i++){var s=this._testCoords.get(i);if(!this.checkValid(n,s))return this._invalidLocation=s,!1}return!0}if(arguments.length===2){var u=arguments[0],c=arguments[1];return this._location[0]=this._locFinder[0].getLocation(c),this._location[1]=this._locFinder[1].getLocation(c),this._location[2]=this._locFinder[2].getLocation(c),!!ai.hasLocation(this._location,V.BOUNDARY)||this.isValidResult(u,this._location)}},ai.prototype.addTestPts=function(n){var i=new vs(n);this._testCoords.addAll(i.getPoints(5*this._boundaryDistanceTolerance))},ai.prototype.isValidResult=function(n,i){var s=fe.isResultOfOp(i[0],i[1],n),u=!(s^i[2]===V.INTERIOR);return u||this.reportResult(n,i,s),u},ai.prototype.getInvalidLocation=function(){return this._invalidLocation},ai.prototype.interfaces_=function(){return[]},ai.prototype.getClass=function(){return ai},ai.hasLocation=function(n,i){for(var s=0;s<3;s++)if(n[s]===i)return!0;return!1},ai.computeBoundaryDistanceTolerance=function(n,i){return Math.min(Fn.computeSizeBasedSnapTolerance(n),Fn.computeSizeBasedSnapTolerance(i))},ai.isValid=function(n,i,s,u){return new ai(n,i,u).isValid(s)},_y.TOLERANCE.get=function(){return 1e-6},Object.defineProperties(ai,_y);var ui=function n(i){this._geomFactory=null,this._skipEmpty=!1,this._inputGeoms=null,this._geomFactory=n.extractFactory(i),this._inputGeoms=i};ui.prototype.extractElements=function(n,i){if(n===null)return null;for(var s=0;s<n.getNumGeometries();s++){var u=n.getGeometryN(s);this._skipEmpty&&u.isEmpty()||i.add(u)}},ui.prototype.combine=function(){for(var n=new O,i=this._inputGeoms.iterator();i.hasNext();){var s=i.next();this.extractElements(s,n)}return n.size()===0?this._geomFactory!==null?this._geomFactory.createGeometryCollection(null):null:this._geomFactory.buildGeometry(n)},ui.prototype.interfaces_=function(){return[]},ui.prototype.getClass=function(){return ui},ui.combine=function(){if(arguments.length===1){var n=arguments[0];return new ui(n).combine()}if(arguments.length===2){var i=arguments[0],s=arguments[1];return new ui(ui.createList(i,s)).combine()}if(arguments.length===3){var u=arguments[0],c=arguments[1],m=arguments[2];return new ui(ui.createList(u,c,m)).combine()}},ui.extractFactory=function(n){return n.isEmpty()?null:n.iterator().next().getFactory()},ui.createList=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1],s=new O;return s.add(n),s.add(i),s}if(arguments.length===3){var u=arguments[0],c=arguments[1],m=arguments[2],E=new O;return E.add(u),E.add(c),E.add(m),E}};var kn=function(){this._inputPolys=null,this._geomFactory=null;var n=arguments[0];this._inputPolys=n,this._inputPolys===null&&(this._inputPolys=new O)},xy={STRTREE_NODE_CAPACITY:{configurable:!0}};kn.prototype.reduceToGeometries=function(n){for(var i=new O,s=n.iterator();s.hasNext();){var u=s.next(),c=null;X(u,ct)?c=this.unionTree(u):u instanceof Ct&&(c=u),i.add(c)}return i},kn.prototype.extractByEnvelope=function(n,i,s){for(var u=new O,c=0;c<i.getNumGeometries();c++){var m=i.getGeometryN(c);m.getEnvelopeInternal().intersects(n)?u.add(m):s.add(m)}return this._geomFactory.buildGeometry(u)},kn.prototype.unionOptimized=function(n,i){var s=n.getEnvelopeInternal(),u=i.getEnvelopeInternal();if(!s.intersects(u))return ui.combine(n,i);if(n.getNumGeometries()<=1&&i.getNumGeometries()<=1)return this.unionActual(n,i);var c=s.intersection(u);return this.unionUsingEnvelopeIntersection(n,i,c)},kn.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 n=new ry(kn.STRTREE_NODE_CAPACITY),i=this._inputPolys.iterator();i.hasNext();){var s=i.next();n.insert(s.getEnvelopeInternal(),s)}this._inputPolys=null;var u=n.itemsTree();return this.unionTree(u)},kn.prototype.binaryUnion=function(){if(arguments.length===1){var n=arguments[0];return this.binaryUnion(n,0,n.size())}if(arguments.length===3){var i=arguments[0],s=arguments[1],u=arguments[2];if(u-s<=1){var c=kn.getGeometry(i,s);return this.unionSafe(c,null)}if(u-s==2)return this.unionSafe(kn.getGeometry(i,s),kn.getGeometry(i,s+1));var m=Math.trunc((u+s)/2),E=this.binaryUnion(i,s,m),C=this.binaryUnion(i,m,u);return this.unionSafe(E,C)}},kn.prototype.repeatedUnion=function(n){for(var i=null,s=n.iterator();s.hasNext();){var u=s.next();i=i===null?u.copy():i.union(u)}return i},kn.prototype.unionSafe=function(n,i){return n===null&&i===null?null:n===null?i.copy():i===null?n.copy():this.unionOptimized(n,i)},kn.prototype.unionActual=function(n,i){return kn.restrictToPolygons(n.union(i))},kn.prototype.unionTree=function(n){var i=this.reduceToGeometries(n);return this.binaryUnion(i)},kn.prototype.unionUsingEnvelopeIntersection=function(n,i,s){var u=new O,c=this.extractByEnvelope(s,n,u),m=this.extractByEnvelope(s,i,u),E=this.unionActual(c,m);return u.add(E),ui.combine(u)},kn.prototype.bufferUnion=function(){if(arguments.length===1){var n=arguments[0];return n.get(0).getFactory().buildGeometry(n).buffer(0)}if(arguments.length===2){var i=arguments[0],s=arguments[1];return i.getFactory().createGeometryCollection([i,s]).buffer(0)}},kn.prototype.interfaces_=function(){return[]},kn.prototype.getClass=function(){return kn},kn.restrictToPolygons=function(n){if(X(n,re))return n;var i=wo.getPolygons(n);return i.size()===1?i.get(0):n.getFactory().createMultiPolygon(pe.toPolygonArray(i))},kn.getGeometry=function(n,i){return i>=n.size()?null:n.get(i)},kn.union=function(n){return new kn(n).union()},xy.STRTREE_NODE_CAPACITY.get=function(){return 4},Object.defineProperties(kn,xy);var fl=function(){};fl.prototype.interfaces_=function(){return[]},fl.prototype.getClass=function(){return fl},fl.union=function(n,i){if(n.isEmpty()||i.isEmpty()){if(n.isEmpty()&&i.isEmpty())return fe.createEmptyResult(fe.UNION,n,i,n.getFactory());if(n.isEmpty())return i.copy();if(i.isEmpty())return n.copy()}return n.checkNotGeometryCollection(n),n.checkNotGeometryCollection(i),br.overlayOp(n,i,fe.UNION)},r.GeoJSONReader=ep,r.GeoJSONWriter=ey,r.OverlayOp=fe,r.UnionOp=fl,r.BufferOp=tr,Object.defineProperty(r,"__esModule",{value:!0})})});var gA=nt((Elt,mA)=>{mA.exports=function(t,e){return t[0]=e[0],t[1]=e[1],t}});var _A=nt((Mlt,vA)=>{var yA=gA();vA.exports=function(r,t){Array.isArray(t)||(t=[]),r.length>0&&t.push(yA([0,0],r[0]));for(var e=0;e<r.length-1;e++){var o=r[e],a=r[e+1],l=o[0],h=o[1],f=a[0],p=a[1],d=[.75*l+.25*f,.75*h+.25*p],g=[.25*l+.75*f,.25*h+.75*p];t.push(d),t.push(g)}return r.length>1&&t.push(yA([0,0],r[r.length-1])),t}});var bA=nt((Alt,wA)=>{"use strict";var D5=yc(),SA=Function.prototype,EA=SA.apply,MA=SA.call;wA.exports=typeof Reflect=="object"&&Reflect.apply||(D5?MA.bind(EA):function(){return MA.apply(EA,arguments)})});var RA=nt((Clt,IA)=>{"use strict";Kc();var TA=Zo(),AA=yl(),F5=Jc(),CA=Ur(),PA=oo(),U5=Ja(),B5=PA("species"),Y0=RegExp.prototype;IA.exports=function(r,t,e,o){var a=PA(r),l=!CA(function(){var d={};return d[a]=function(){return 7},""[r](d)!==7}),h=l&&!CA(function(){var d=!1,g=/a/;return r==="split"&&(g={},g.constructor={},g.constructor[B5]=function(){return g},g.flags="",g[a]=/./[a]),g.exec=function(){return d=!0,null},g[a](""),!d});if(!l||!h||e){var f=/./[a],p=t(a,""[r],function(d,g,x,v,M){var b=g.exec;return b===F5||b===Y0.exec?l&&!M?{done:!0,value:TA(f,g,x,v)}:{done:!0,value:TA(d,x,g,v)}:{done:!1}});AA(String.prototype,r,p[0]),AA(Y0,a,p[1])}o&&U5(Y0[a],"sham",!0)}});var DA=nt((Plt,OA)=>{"use strict";var $0=li(),z5=vl(),G5=Yc(),k5=Ya(),q5=$0("".charAt),LA=$0("".charCodeAt),V5=$0("".slice),NA=function(r){return function(t,e){var o=G5(k5(t)),a=z5(e),l=o.length,h,f;return a<0||a>=l?r?"":void 0:(h=LA(o,a),h<55296||h>56319||a+1===l||(f=LA(o,a+1))<56320||f>57343?r?q5(o,a):h:r?V5(o,a,a+2):(h-55296<<10)+(f-56320)+65536)}};OA.exports={codeAt:NA(!1),charAt:NA(!0)}});var UA=nt((Ilt,FA)=>{"use strict";var H5=DA().charAt;FA.exports=function(r,t,e){return t+(e?H5(r,t).length:1)}});var zA=nt((Rlt,BA)=>{"use strict";var K0=li(),W5=ml(),X5=Math.floor,Z0=K0("".charAt),Y5=K0("".replace),J0=K0("".slice),$5=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,Z5=/\$([$&'`]|\d{1,2})/g;BA.exports=function(r,t,e,o,a,l){var h=e+r.length,f=o.length,p=Z5;return a!==void 0&&(a=W5(a),p=$5),Y5(l,p,function(d,g){var x;switch(Z0(g,0)){case"$":return"$";case"&":return r;case"`":return J0(t,0,e);case"'":return J0(t,h);case"<":x=a[J0(g,1,-1)];break;default:var v=+g;if(v===0)return d;if(v>f){var M=X5(v/10);return M===0?d:M<=f?o[M-1]===void 0?Z0(g,1):o[M-1]+Z0(g,1):d}x=o[v-1]}return x===void 0?"":x})}});var qA=nt((Llt,kA)=>{"use strict";var GA=Zo(),J5=_s(),K5=Br(),j5=pl(),Q5=Jc(),tq=TypeError;kA.exports=function(r,t){var e=r.exec;if(K5(e)){var o=GA(e,r,t);return o!==null&&J5(o),o}if(j5(r)==="RegExp")return GA(Q5,r,t);throw new tq("RegExp#exec called on incompatible receiver")}});var YA=nt(()=>{"use strict";var eq=bA(),VA=Zo(),tp=li(),nq=RA(),rq=Ur(),iq=_s(),oq=Br(),sq=bo(),aq=vl(),uq=Yp(),ju=Yc(),lq=Ya(),cq=UA(),fq=Sp(),hq=zA(),pq=qA(),dq=oo(),Q0=dq("replace"),mq=Math.max,gq=Math.min,yq=tp([].concat),j0=tp([].push),HA=tp("".indexOf),WA=tp("".slice),vq=function(r){return r===void 0?r:String(r)},_q=function(){return"a".replace(/./,"$0")==="$0"}(),XA=function(){return/./[Q0]?/./[Q0]("a","$0")==="":!1}(),xq=!rq(function(){var r=/./;return r.exec=function(){var t=[];return t.groups={a:"7"},t},"".replace(r,"$<a>")!=="7"});nq("replace",function(r,t,e){var o=XA?"$":"$0";return[function(l,h){var f=lq(this),p=sq(l)?fq(l,Q0):void 0;return p?VA(p,l,f,h):VA(t,ju(f),l,h)},function(a,l){var h=iq(this),f=ju(a);if(typeof l=="string"&&HA(l,o)===-1&&HA(l,"$<")===-1){var p=e(t,h,f,l);if(p.done)return p.value}var d=oq(l);d||(l=ju(l));var g=h.global,x;g&&(x=h.unicode,h.lastIndex=0);for(var v=[],M;M=pq(h,f),!(M===null||(j0(v,M),!g));){var b=ju(M[0]);b===""&&(h.lastIndex=cq(f,uq(h.lastIndex),x))}for(var T="",_=0,y=0;y<v.length;y++){M=v[y];for(var A=ju(M[0]),S=mq(gq(aq(M.index),f.length),0),L=[],G,z=1;z<M.length;z++)j0(L,vq(M[z]));var F=M.groups;if(d){var I=yq([A],L,S,f);F!==void 0&&j0(I,F),G=ju(eq(l,void 0,I))}else G=hq(A,f,S,L,F,l);S>=_&&(T+=WA(f,_,S)+G,_=S+A.length)}return T+WA(f,_)}]},!xq||!_q||XA)});function Xa(){return Xa=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var o=arguments[e];for(var a in o)Object.prototype.hasOwnProperty.call(o,a)&&(t[a]=o[a])}return t},Xa.apply(this,arguments)}var glt=yn(Kp(),1),ylt=yn(Wc(),1),vlt=yn(Kc(),1),Uo=yn(S1(),1);var flt=yn(Wc(),1);var Wm="162";var LN=0,w1=1,NN=2;var ZE=1,ON=2,ns=3,Os=0,Ei=1,is=2,Is=0,xu=1,b1=2,T1=3,A1=4,DN=5,pa=100,FN=101,UN=102,C1=103,P1=104,BN=200,zN=201,GN=202,kN=203,rm=204,im=205,qN=206,VN=207,HN=208,WN=209,XN=210,YN=211,$N=212,ZN=213,JN=214,KN=0,jN=1,QN=2,wf=3,t2=4,e2=5,n2=6,r2=7,JE=0,i2=1,o2=2,Rs=0,s2=1,a2=2,u2=3,l2=4,c2=5,f2=6,h2=7;var KE=300,Su=301,wu=302,om=303,sm=304,Xf=306,am=1e3,co=1001,um=1002,hi=1003,I1=1004;var wl=1005;var _i=1006,Sd=1007;var ma=1008;var Ls=1009,p2=1010,d2=1011,Xm=1012,jE=1013,Ps=1014,os=1015,Nl=1016,QE=1017,tM=1018,ya=1020,m2=1021,fo=1023,g2=1024,y2=1025,va=1026,bu=1027,v2=1028,eM=1029,_2=1030,nM=1031,rM=1033,wd=33776,bd=33777,Td=33778,Ad=33779,R1=35840,L1=35841,N1=35842,O1=35843,iM=36196,D1=37492,F1=37496,U1=37808,B1=37809,z1=37810,G1=37811,k1=37812,q1=37813,V1=37814,H1=37815,W1=37816,X1=37817,Y1=37818,$1=37819,Z1=37820,J1=37821,Cd=36492,K1=36494,j1=36495,x2=36283,Q1=36284,tE=36285,eE=36286;var bf=2300,Tf=2301,Pd=2302,nE=2400,rE=2401,iE=2402;var E2=3200,M2=3201,S2=0,w2=1,Cs="",Ao="srgb",Bs="srgb-linear",Ym="display-p3",Yf="display-p3-linear",Af="linear",Un="srgb",Cf="rec709",Pf="p3";var ja=7680;var oE=519,b2=512,T2=513,A2=514,oM=515,C2=516,P2=517,I2=518,R2=519,lm=35044;var sE="300 es",cm=1035,ss=2e3,If=2001,Ds=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 a=this._listeners[t];if(a!==void 0){let l=a.indexOf(e);l!==-1&&a.splice(l,1)}}dispatchEvent(t){if(this._listeners===void 0)return;let o=this._listeners[t.type];if(o!==void 0){t.target=this;let a=o.slice(0);for(let l=0,h=a.length;l<h;l++)a[l].call(this,t);t.target=null}}},Jr=["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 Id=Math.PI/180,fm=180/Math.PI;function Ns(){let r=Math.random()*4294967295|0,t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,o=Math.random()*4294967295|0;return(Jr[r&255]+Jr[r>>8&255]+Jr[r>>16&255]+Jr[r>>24&255]+"-"+Jr[t&255]+Jr[t>>8&255]+"-"+Jr[t>>16&15|64]+Jr[t>>24&255]+"-"+Jr[e&63|128]+Jr[e>>8&255]+"-"+Jr[e>>16&255]+Jr[e>>24&255]+Jr[o&255]+Jr[o>>8&255]+Jr[o>>16&255]+Jr[o>>24&255]).toLowerCase()}function xi(r,t,e){return Math.max(t,Math.min(e,r))}function L2(r,t){return(r%t+t)%t}function Rd(r,t,e){return(1-e)*r+e*t}function aE(r){return(r&r-1)===0&&r!==0}function hm(r){return Math.pow(2,Math.floor(Math.log(r)/Math.LN2))}function Po(r,t){switch(t.constructor){case Float32Array:return r;case Uint32Array:return r/4294967295;case Uint16Array:return r/65535;case Uint8Array:return r/255;case Int32Array:return Math.max(r/2147483647,-1);case Int16Array:return Math.max(r/32767,-1);case Int8Array:return Math.max(r/127,-1);default:throw new Error("Invalid component type.")}}function An(r,t){switch(t.constructor){case Float32Array:return r;case Uint32Array:return Math.round(r*4294967295);case Uint16Array:return Math.round(r*65535);case Uint8Array:return Math.round(r*255);case Int32Array:return Math.round(r*2147483647);case Int16Array:return Math.round(r*32767);case Int8Array:return Math.round(r*127);default:throw new Error("Invalid component type.")}}var ye=class r{constructor(t=0,e=0){r.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,a=t.elements;return this.x=a[0]*e+a[3]*o+a[6],this.y=a[1]*e+a[4]*o+a[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(xi(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),a=Math.sin(e),l=this.x-t.x,h=this.y-t.y;return this.x=l*o-h*a+t.x,this.y=l*a+h*o+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},_e=class r{constructor(t,e,o,a,l,h,f,p,d){r.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],t!==void 0&&this.set(t,e,o,a,l,h,f,p,d)}set(t,e,o,a,l,h,f,p,d){let g=this.elements;return g[0]=t,g[1]=a,g[2]=f,g[3]=e,g[4]=l,g[5]=p,g[6]=o,g[7]=h,g[8]=d,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,a=e.elements,l=this.elements,h=o[0],f=o[3],p=o[6],d=o[1],g=o[4],x=o[7],v=o[2],M=o[5],b=o[8],T=a[0],_=a[3],y=a[6],A=a[1],S=a[4],L=a[7],G=a[2],z=a[5],F=a[8];return l[0]=h*T+f*A+p*G,l[3]=h*_+f*S+p*z,l[6]=h*y+f*L+p*F,l[1]=d*T+g*A+x*G,l[4]=d*_+g*S+x*z,l[7]=d*y+g*L+x*F,l[2]=v*T+M*A+b*G,l[5]=v*_+M*S+b*z,l[8]=v*y+M*L+b*F,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],a=t[2],l=t[3],h=t[4],f=t[5],p=t[6],d=t[7],g=t[8];return e*h*g-e*f*d-o*l*g+o*f*p+a*l*d-a*h*p}invert(){let t=this.elements,e=t[0],o=t[1],a=t[2],l=t[3],h=t[4],f=t[5],p=t[6],d=t[7],g=t[8],x=g*h-f*d,v=f*p-g*l,M=d*l-h*p,b=e*x+o*v+a*M;if(b===0)return this.set(0,0,0,0,0,0,0,0,0);let T=1/b;return t[0]=x*T,t[1]=(a*d-g*o)*T,t[2]=(f*o-a*h)*T,t[3]=v*T,t[4]=(g*e-a*p)*T,t[5]=(a*l-f*e)*T,t[6]=M*T,t[7]=(o*p-d*e)*T,t[8]=(h*e-o*l)*T,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,a,l,h,f){let p=Math.cos(l),d=Math.sin(l);return this.set(o*p,o*d,-o*(p*h+d*f)+h+t,-a*d,a*p,-a*(-d*h+p*f)+f+e,0,0,1),this}scale(t,e){return this.premultiply(Ld.makeScale(t,e)),this}rotate(t){return this.premultiply(Ld.makeRotation(-t)),this}translate(t,e){return this.premultiply(Ld.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 a=0;a<9;a++)if(e[a]!==o[a])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)}},Ld=new _e;function sM(r){for(let t=r.length-1;t>=0;--t)if(r[t]>=65535)return!0;return!1}function Rf(r){return document.createElementNS("http://www.w3.org/1999/xhtml",r)}function N2(){let r=Rf("canvas");return r.style.display="block",r}var uE={};function aM(r){r in uE||(uE[r]=!0,console.warn(r))}var lE=new _e().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),cE=new _e().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),jc={[Bs]:{transfer:Af,primaries:Cf,toReference:r=>r,fromReference:r=>r},[Ao]:{transfer:Un,primaries:Cf,toReference:r=>r.convertSRGBToLinear(),fromReference:r=>r.convertLinearToSRGB()},[Yf]:{transfer:Af,primaries:Pf,toReference:r=>r.applyMatrix3(cE),fromReference:r=>r.applyMatrix3(lE)},[Ym]:{transfer:Un,primaries:Pf,toReference:r=>r.convertSRGBToLinear().applyMatrix3(cE),fromReference:r=>r.applyMatrix3(lE).convertLinearToSRGB()}},O2=new Set([Bs,Yf]),Cn={enabled:!0,_workingColorSpace:Bs,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(r){if(!O2.has(r))throw new Error(`Unsupported working color space, "${r}".`);this._workingColorSpace=r},convert:function(r,t,e){if(this.enabled===!1||t===e||!t||!e)return r;let o=jc[t].toReference,a=jc[e].fromReference;return a(o(r))},fromWorkingColorSpace:function(r,t){return this.convert(r,this._workingColorSpace,t)},toWorkingColorSpace:function(r,t){return this.convert(r,t,this._workingColorSpace)},getPrimaries:function(r){return jc[r].primaries},getTransfer:function(r){return r===Cs?Af:jc[r].transfer}};function Eu(r){return r<.04045?r*.0773993808:Math.pow(r*.9478672986+.0521327014,2.4)}function Nd(r){return r<.0031308?r*12.92:1.055*Math.pow(r,.41666)-.055}var Qa,Lf=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{Qa===void 0&&(Qa=Rf("canvas")),Qa.width=t.width,Qa.height=t.height;let o=Qa.getContext("2d");t instanceof ImageData?o.putImageData(t,0,0):o.drawImage(t,0,0,t.width,t.height),e=Qa}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=Rf("canvas");e.width=t.width,e.height=t.height;let o=e.getContext("2d");o.drawImage(t,0,0,t.width,t.height);let a=o.getImageData(0,0,t.width,t.height),l=a.data;for(let h=0;h<l.length;h++)l[h]=Eu(l[h]/255)*255;return o.putImageData(a,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(Eu(e[o]/255)*255):e[o]=Eu(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}},D2=0,Nf=class{constructor(t=null){this.isSource=!0,Object.defineProperty(this,"id",{value:D2++}),this.uuid=Ns(),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:""},a=this.data;if(a!==null){let l;if(Array.isArray(a)){l=[];for(let h=0,f=a.length;h<f;h++)a[h].isDataTexture?l.push(Od(a[h].image)):l.push(Od(a[h]))}else l=Od(a);o.url=l}return e||(t.images[this.uuid]=o),o}};function Od(r){return typeof HTMLImageElement!="undefined"&&r instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&r instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&r instanceof ImageBitmap?Lf.getDataURL(r):r.data?{data:Array.from(r.data),width:r.width,height:r.height,type:r.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}var F2=0,Hi=class r extends Ds{constructor(t=r.DEFAULT_IMAGE,e=r.DEFAULT_MAPPING,o=co,a=co,l=_i,h=ma,f=fo,p=Ls,d=r.DEFAULT_ANISOTROPY,g=Cs){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:F2++}),this.uuid=Ns(),this.name="",this.source=new Nf(t),this.mipmaps=[],this.mapping=e,this.channel=0,this.wrapS=o,this.wrapT=a,this.magFilter=l,this.minFilter=h,this.anisotropy=d,this.format=f,this.internalFormat=null,this.type=p,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 _e,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=g,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!==KE)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case am:t.x=t.x-Math.floor(t.x);break;case co:t.x=t.x<0?0:1;break;case um: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 am:t.y=t.y-Math.floor(t.y);break;case co:t.y=t.y<0?0:1;break;case um: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)}};Hi.DEFAULT_IMAGE=null;Hi.DEFAULT_MAPPING=KE;Hi.DEFAULT_ANISOTROPY=1;var zr=class r{constructor(t=0,e=0,o=0,a=1){r.prototype.isVector4=!0,this.x=t,this.y=e,this.z=o,this.w=a}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,a){return this.x=t,this.y=e,this.z=o,this.w=a,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,a=this.z,l=this.w,h=t.elements;return this.x=h[0]*e+h[4]*o+h[8]*a+h[12]*l,this.y=h[1]*e+h[5]*o+h[9]*a+h[13]*l,this.z=h[2]*e+h[6]*o+h[10]*a+h[14]*l,this.w=h[3]*e+h[7]*o+h[11]*a+h[15]*l,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,a,l,p=t.elements,d=p[0],g=p[4],x=p[8],v=p[1],M=p[5],b=p[9],T=p[2],_=p[6],y=p[10];if(Math.abs(g-v)<.01&&Math.abs(x-T)<.01&&Math.abs(b-_)<.01){if(Math.abs(g+v)<.1&&Math.abs(x+T)<.1&&Math.abs(b+_)<.1&&Math.abs(d+M+y-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;let S=(d+1)/2,L=(M+1)/2,G=(y+1)/2,z=(g+v)/4,F=(x+T)/4,I=(b+_)/4;return S>L&&S>G?S<.01?(o=0,a=.707106781,l=.707106781):(o=Math.sqrt(S),a=z/o,l=F/o):L>G?L<.01?(o=.707106781,a=0,l=.707106781):(a=Math.sqrt(L),o=z/a,l=I/a):G<.01?(o=.707106781,a=.707106781,l=0):(l=Math.sqrt(G),o=F/l,a=I/l),this.set(o,a,l,e),this}let A=Math.sqrt((_-b)*(_-b)+(x-T)*(x-T)+(v-g)*(v-g));return Math.abs(A)<.001&&(A=1),this.x=(_-b)/A,this.y=(x-T)/A,this.z=(v-g)/A,this.w=Math.acos((d+M+y-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}},pm=class extends Ds{constructor(t=1,e=1,o={}){super(),this.isRenderTarget=!0,this.width=t,this.height=e,this.depth=1,this.scissor=new zr(0,0,t,e),this.scissorTest=!1,this.viewport=new zr(0,0,t,e);let a={width:t,height:e,depth:1};o=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:_i,depthBuffer:!0,stencilBuffer:!1,depthTexture:null,samples:0,count:1},o);let l=new Hi(a,o.mapping,o.wrapS,o.wrapT,o.magFilter,o.minFilter,o.format,o.type,o.anisotropy,o.colorSpace);l.flipY=!1,l.generateMipmaps=o.generateMipmaps,l.internalFormat=o.internalFormat,this.textures=[];let h=o.count;for(let f=0;f<h;f++)this.textures[f]=l.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 a=0,l=this.textures.length;a<l;a++)this.textures[a].image.width=t,this.textures[a].image.height=e,this.textures[a].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,a=t.textures.length;o<a;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 Nf(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"})}},us=class extends pm{constructor(t=1,e=1,o={}){super(t,e,o),this.isWebGLRenderTarget=!0}},Of=class extends Hi{constructor(t=null,e=1,o=1,a=1){super(null),this.isDataArrayTexture=!0,this.image={data:t,width:e,height:o,depth:a},this.magFilter=hi,this.minFilter=hi,this.wrapR=co,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var dm=class extends Hi{constructor(t=null,e=1,o=1,a=1){super(null),this.isData3DTexture=!0,this.image={data:t,width:e,height:o,depth:a},this.magFilter=hi,this.minFilter=hi,this.wrapR=co,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var Fs=class{constructor(t=0,e=0,o=0,a=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=o,this._w=a}static slerpFlat(t,e,o,a,l,h,f){let p=o[a+0],d=o[a+1],g=o[a+2],x=o[a+3],v=l[h+0],M=l[h+1],b=l[h+2],T=l[h+3];if(f===0){t[e+0]=p,t[e+1]=d,t[e+2]=g,t[e+3]=x;return}if(f===1){t[e+0]=v,t[e+1]=M,t[e+2]=b,t[e+3]=T;return}if(x!==T||p!==v||d!==M||g!==b){let _=1-f,y=p*v+d*M+g*b+x*T,A=y>=0?1:-1,S=1-y*y;if(S>Number.EPSILON){let G=Math.sqrt(S),z=Math.atan2(G,y*A);_=Math.sin(_*z)/G,f=Math.sin(f*z)/G}let L=f*A;if(p=p*_+v*L,d=d*_+M*L,g=g*_+b*L,x=x*_+T*L,_===1-f){let G=1/Math.sqrt(p*p+d*d+g*g+x*x);p*=G,d*=G,g*=G,x*=G}}t[e]=p,t[e+1]=d,t[e+2]=g,t[e+3]=x}static multiplyQuaternionsFlat(t,e,o,a,l,h){let f=o[a],p=o[a+1],d=o[a+2],g=o[a+3],x=l[h],v=l[h+1],M=l[h+2],b=l[h+3];return t[e]=f*b+g*x+p*M-d*v,t[e+1]=p*b+g*v+d*x-f*M,t[e+2]=d*b+g*M+f*v-p*x,t[e+3]=g*b-f*x-p*v-d*M,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,a){return this._x=t,this._y=e,this._z=o,this._w=a,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,a=t._y,l=t._z,h=t._order,f=Math.cos,p=Math.sin,d=f(o/2),g=f(a/2),x=f(l/2),v=p(o/2),M=p(a/2),b=p(l/2);switch(h){case"XYZ":this._x=v*g*x+d*M*b,this._y=d*M*x-v*g*b,this._z=d*g*b+v*M*x,this._w=d*g*x-v*M*b;break;case"YXZ":this._x=v*g*x+d*M*b,this._y=d*M*x-v*g*b,this._z=d*g*b-v*M*x,this._w=d*g*x+v*M*b;break;case"ZXY":this._x=v*g*x-d*M*b,this._y=d*M*x+v*g*b,this._z=d*g*b+v*M*x,this._w=d*g*x-v*M*b;break;case"ZYX":this._x=v*g*x-d*M*b,this._y=d*M*x+v*g*b,this._z=d*g*b-v*M*x,this._w=d*g*x+v*M*b;break;case"YZX":this._x=v*g*x+d*M*b,this._y=d*M*x+v*g*b,this._z=d*g*b-v*M*x,this._w=d*g*x-v*M*b;break;case"XZY":this._x=v*g*x-d*M*b,this._y=d*M*x-v*g*b,this._z=d*g*b+v*M*x,this._w=d*g*x+v*M*b;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+h)}return e===!0&&this._onChangeCallback(),this}setFromAxisAngle(t,e){let o=e/2,a=Math.sin(o);return this._x=t.x*a,this._y=t.y*a,this._z=t.z*a,this._w=Math.cos(o),this._onChangeCallback(),this}setFromRotationMatrix(t){let e=t.elements,o=e[0],a=e[4],l=e[8],h=e[1],f=e[5],p=e[9],d=e[2],g=e[6],x=e[10],v=o+f+x;if(v>0){let M=.5/Math.sqrt(v+1);this._w=.25/M,this._x=(g-p)*M,this._y=(l-d)*M,this._z=(h-a)*M}else if(o>f&&o>x){let M=2*Math.sqrt(1+o-f-x);this._w=(g-p)/M,this._x=.25*M,this._y=(a+h)/M,this._z=(l+d)/M}else if(f>x){let M=2*Math.sqrt(1+f-o-x);this._w=(l-d)/M,this._x=(a+h)/M,this._y=.25*M,this._z=(p+g)/M}else{let M=2*Math.sqrt(1+x-o-f);this._w=(h-a)/M,this._x=(l+d)/M,this._y=(p+g)/M,this._z=.25*M}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(xi(this.dot(t),-1,1)))}rotateTowards(t,e){let o=this.angleTo(t);if(o===0)return this;let a=Math.min(1,e/o);return this.slerp(t,a),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,a=t._y,l=t._z,h=t._w,f=e._x,p=e._y,d=e._z,g=e._w;return this._x=o*g+h*f+a*d-l*p,this._y=a*g+h*p+l*f-o*d,this._z=l*g+h*d+o*p-a*f,this._w=h*g-o*f-a*p-l*d,this._onChangeCallback(),this}slerp(t,e){if(e===0)return this;if(e===1)return this.copy(t);let o=this._x,a=this._y,l=this._z,h=this._w,f=h*t._w+o*t._x+a*t._y+l*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=h,this._x=o,this._y=a,this._z=l,this;let p=1-f*f;if(p<=Number.EPSILON){let M=1-e;return this._w=M*h+e*this._w,this._x=M*o+e*this._x,this._y=M*a+e*this._y,this._z=M*l+e*this._z,this.normalize(),this}let d=Math.sqrt(p),g=Math.atan2(d,f),x=Math.sin((1-e)*g)/d,v=Math.sin(e*g)/d;return this._w=h*x+this._w*v,this._x=o*x+this._x*v,this._y=a*x+this._y*v,this._z=l*x+this._z*v,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(),a=Math.sqrt(1-o),l=Math.sqrt(o);return this.set(a*Math.sin(t),a*Math.cos(t),l*Math.sin(e),l*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}},yt=class r{constructor(t=0,e=0,o=0){r.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(fE.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(fE.setFromAxisAngle(t,e))}applyMatrix3(t){let e=this.x,o=this.y,a=this.z,l=t.elements;return this.x=l[0]*e+l[3]*o+l[6]*a,this.y=l[1]*e+l[4]*o+l[7]*a,this.z=l[2]*e+l[5]*o+l[8]*a,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){let e=this.x,o=this.y,a=this.z,l=t.elements,h=1/(l[3]*e+l[7]*o+l[11]*a+l[15]);return this.x=(l[0]*e+l[4]*o+l[8]*a+l[12])*h,this.y=(l[1]*e+l[5]*o+l[9]*a+l[13])*h,this.z=(l[2]*e+l[6]*o+l[10]*a+l[14])*h,this}applyQuaternion(t){let e=this.x,o=this.y,a=this.z,l=t.x,h=t.y,f=t.z,p=t.w,d=2*(h*a-f*o),g=2*(f*e-l*a),x=2*(l*o-h*e);return this.x=e+p*d+h*x-f*g,this.y=o+p*g+f*d-l*x,this.z=a+p*x+l*g-h*d,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,a=this.z,l=t.elements;return this.x=l[0]*e+l[4]*o+l[8]*a,this.y=l[1]*e+l[5]*o+l[9]*a,this.z=l[2]*e+l[6]*o+l[10]*a,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,a=t.y,l=t.z,h=e.x,f=e.y,p=e.z;return this.x=a*p-l*f,this.y=l*h-o*p,this.z=o*f-a*h,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 Dd.copy(this).projectOnVector(t),this.sub(Dd)}reflect(t){return this.sub(Dd.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(xi(o,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let e=this.x-t.x,o=this.y-t.y,a=this.z-t.z;return e*e+o*o+a*a}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 a=Math.sin(e)*t;return this.x=a*Math.sin(o),this.y=Math.cos(e)*t,this.z=a*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(),a=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=o,this.z=a,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}},Dd=new yt,fE=new Fs,_a=class{constructor(t=new yt(1/0,1/0,1/0),e=new yt(-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(ao.fromArray(t,e));return this}setFromBufferAttribute(t){this.makeEmpty();for(let e=0,o=t.count;e<o;e++)this.expandByPoint(ao.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=ao.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 l=o.getAttribute("position");if(e===!0&&l!==void 0&&t.isInstancedMesh!==!0)for(let h=0,f=l.count;h<f;h++)t.isMesh===!0?t.getVertexPosition(h,ao):ao.fromBufferAttribute(l,h),ao.applyMatrix4(t.matrixWorld),this.expandByPoint(ao);else t.boundingBox!==void 0?(t.boundingBox===null&&t.computeBoundingBox(),Qc.copy(t.boundingBox)):(o.boundingBox===null&&o.computeBoundingBox(),Qc.copy(o.boundingBox)),Qc.applyMatrix4(t.matrixWorld),this.union(Qc)}let a=t.children;for(let l=0,h=a.length;l<h;l++)this.expandByObject(a[l],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,ao),ao.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(bl),tf.subVectors(this.max,bl),tu.subVectors(t.a,bl),eu.subVectors(t.b,bl),nu.subVectors(t.c,bl),Es.subVectors(eu,tu),Ms.subVectors(nu,eu),sa.subVectors(tu,nu);let e=[0,-Es.z,Es.y,0,-Ms.z,Ms.y,0,-sa.z,sa.y,Es.z,0,-Es.x,Ms.z,0,-Ms.x,sa.z,0,-sa.x,-Es.y,Es.x,0,-Ms.y,Ms.x,0,-sa.y,sa.x,0];return!Fd(e,tu,eu,nu,tf)||(e=[1,0,0,0,1,0,0,0,1],!Fd(e,tu,eu,nu,tf))?!1:(ef.crossVectors(Es,Ms),e=[ef.x,ef.y,ef.z],Fd(e,tu,eu,nu,tf))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,ao).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=this.getSize(ao).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:(Ko[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Ko[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Ko[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Ko[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Ko[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Ko[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Ko[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Ko[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Ko),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)}},Ko=[new yt,new yt,new yt,new yt,new yt,new yt,new yt,new yt],ao=new yt,Qc=new _a,tu=new yt,eu=new yt,nu=new yt,Es=new yt,Ms=new yt,sa=new yt,bl=new yt,tf=new yt,ef=new yt,aa=new yt;function Fd(r,t,e,o,a){for(let l=0,h=r.length-3;l<=h;l+=3){aa.fromArray(r,l);let f=a.x*Math.abs(aa.x)+a.y*Math.abs(aa.y)+a.z*Math.abs(aa.z),p=t.dot(aa),d=e.dot(aa),g=o.dot(aa);if(Math.max(-Math.max(p,d,g),Math.min(p,d,g))>f)return!1}return!0}var U2=new _a,Tl=new yt,Ud=new yt,Ol=class{constructor(t=new yt,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):U2.setFromPoints(t).getCenter(o);let a=0;for(let l=0,h=t.length;l<h;l++)a=Math.max(a,o.distanceToSquared(t[l]));return this.radius=Math.sqrt(a),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;Tl.subVectors(t,this.center);let e=Tl.lengthSq();if(e>this.radius*this.radius){let o=Math.sqrt(e),a=(o-this.radius)*.5;this.center.addScaledVector(Tl,a/o),this.radius+=a}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):(Ud.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(Tl.copy(t.center).add(Ud)),this.expandByPoint(Tl.copy(t.center).sub(Ud))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return new this.constructor().copy(this)}},jo=new yt,Bd=new yt,nf=new yt,Ss=new yt,zd=new yt,rf=new yt,Gd=new yt,mm=class{constructor(t=new yt,e=new yt(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,jo)),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=jo.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(jo.copy(this.origin).addScaledVector(this.direction,e),jo.distanceToSquared(t))}distanceSqToSegment(t,e,o,a){Bd.copy(t).add(e).multiplyScalar(.5),nf.copy(e).sub(t).normalize(),Ss.copy(this.origin).sub(Bd);let l=t.distanceTo(e)*.5,h=-this.direction.dot(nf),f=Ss.dot(this.direction),p=-Ss.dot(nf),d=Ss.lengthSq(),g=Math.abs(1-h*h),x,v,M,b;if(g>0)if(x=h*p-f,v=h*f-p,b=l*g,x>=0)if(v>=-b)if(v<=b){let T=1/g;x*=T,v*=T,M=x*(x+h*v+2*f)+v*(h*x+v+2*p)+d}else v=l,x=Math.max(0,-(h*v+f)),M=-x*x+v*(v+2*p)+d;else v=-l,x=Math.max(0,-(h*v+f)),M=-x*x+v*(v+2*p)+d;else v<=-b?(x=Math.max(0,-(-h*l+f)),v=x>0?-l:Math.min(Math.max(-l,-p),l),M=-x*x+v*(v+2*p)+d):v<=b?(x=0,v=Math.min(Math.max(-l,-p),l),M=v*(v+2*p)+d):(x=Math.max(0,-(h*l+f)),v=x>0?l:Math.min(Math.max(-l,-p),l),M=-x*x+v*(v+2*p)+d);else v=h>0?-l:l,x=Math.max(0,-(h*v+f)),M=-x*x+v*(v+2*p)+d;return o&&o.copy(this.origin).addScaledVector(this.direction,x),a&&a.copy(Bd).addScaledVector(nf,v),M}intersectSphere(t,e){jo.subVectors(t.center,this.origin);let o=jo.dot(this.direction),a=jo.dot(jo)-o*o,l=t.radius*t.radius;if(a>l)return null;let h=Math.sqrt(l-a),f=o-h,p=o+h;return p<0?null:f<0?this.at(p,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,a,l,h,f,p,d=1/this.direction.x,g=1/this.direction.y,x=1/this.direction.z,v=this.origin;return d>=0?(o=(t.min.x-v.x)*d,a=(t.max.x-v.x)*d):(o=(t.max.x-v.x)*d,a=(t.min.x-v.x)*d),g>=0?(l=(t.min.y-v.y)*g,h=(t.max.y-v.y)*g):(l=(t.max.y-v.y)*g,h=(t.min.y-v.y)*g),o>h||l>a||((l>o||isNaN(o))&&(o=l),(h<a||isNaN(a))&&(a=h),x>=0?(f=(t.min.z-v.z)*x,p=(t.max.z-v.z)*x):(f=(t.max.z-v.z)*x,p=(t.min.z-v.z)*x),o>p||f>a)||((f>o||o!==o)&&(o=f),(p<a||a!==a)&&(a=p),a<0)?null:this.at(o>=0?o:a,e)}intersectsBox(t){return this.intersectBox(t,jo)!==null}intersectTriangle(t,e,o,a,l){zd.subVectors(e,t),rf.subVectors(o,t),Gd.crossVectors(zd,rf);let h=this.direction.dot(Gd),f;if(h>0){if(a)return null;f=1}else if(h<0)f=-1,h=-h;else return null;Ss.subVectors(this.origin,t);let p=f*this.direction.dot(rf.crossVectors(Ss,rf));if(p<0)return null;let d=f*this.direction.dot(zd.cross(Ss));if(d<0||p+d>h)return null;let g=-f*Ss.dot(Gd);return g<0?null:this.at(g/h,l)}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)}},cr=class r{constructor(t,e,o,a,l,h,f,p,d,g,x,v,M,b,T,_){r.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,a,l,h,f,p,d,g,x,v,M,b,T,_)}set(t,e,o,a,l,h,f,p,d,g,x,v,M,b,T,_){let y=this.elements;return y[0]=t,y[4]=e,y[8]=o,y[12]=a,y[1]=l,y[5]=h,y[9]=f,y[13]=p,y[2]=d,y[6]=g,y[10]=x,y[14]=v,y[3]=M,y[7]=b,y[11]=T,y[15]=_,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 r().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,a=1/ru.setFromMatrixColumn(t,0).length(),l=1/ru.setFromMatrixColumn(t,1).length(),h=1/ru.setFromMatrixColumn(t,2).length();return e[0]=o[0]*a,e[1]=o[1]*a,e[2]=o[2]*a,e[3]=0,e[4]=o[4]*l,e[5]=o[5]*l,e[6]=o[6]*l,e[7]=0,e[8]=o[8]*h,e[9]=o[9]*h,e[10]=o[10]*h,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,a=t.y,l=t.z,h=Math.cos(o),f=Math.sin(o),p=Math.cos(a),d=Math.sin(a),g=Math.cos(l),x=Math.sin(l);if(t.order==="XYZ"){let v=h*g,M=h*x,b=f*g,T=f*x;e[0]=p*g,e[4]=-p*x,e[8]=d,e[1]=M+b*d,e[5]=v-T*d,e[9]=-f*p,e[2]=T-v*d,e[6]=b+M*d,e[10]=h*p}else if(t.order==="YXZ"){let v=p*g,M=p*x,b=d*g,T=d*x;e[0]=v+T*f,e[4]=b*f-M,e[8]=h*d,e[1]=h*x,e[5]=h*g,e[9]=-f,e[2]=M*f-b,e[6]=T+v*f,e[10]=h*p}else if(t.order==="ZXY"){let v=p*g,M=p*x,b=d*g,T=d*x;e[0]=v-T*f,e[4]=-h*x,e[8]=b+M*f,e[1]=M+b*f,e[5]=h*g,e[9]=T-v*f,e[2]=-h*d,e[6]=f,e[10]=h*p}else if(t.order==="ZYX"){let v=h*g,M=h*x,b=f*g,T=f*x;e[0]=p*g,e[4]=b*d-M,e[8]=v*d+T,e[1]=p*x,e[5]=T*d+v,e[9]=M*d-b,e[2]=-d,e[6]=f*p,e[10]=h*p}else if(t.order==="YZX"){let v=h*p,M=h*d,b=f*p,T=f*d;e[0]=p*g,e[4]=T-v*x,e[8]=b*x+M,e[1]=x,e[5]=h*g,e[9]=-f*g,e[2]=-d*g,e[6]=M*x+b,e[10]=v-T*x}else if(t.order==="XZY"){let v=h*p,M=h*d,b=f*p,T=f*d;e[0]=p*g,e[4]=-x,e[8]=d*g,e[1]=v*x+T,e[5]=h*g,e[9]=M*x-b,e[2]=b*x-M,e[6]=f*g,e[10]=T*x+v}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(B2,t,z2)}lookAt(t,e,o){let a=this.elements;return Ii.subVectors(t,e),Ii.lengthSq()===0&&(Ii.z=1),Ii.normalize(),ws.crossVectors(o,Ii),ws.lengthSq()===0&&(Math.abs(o.z)===1?Ii.x+=1e-4:Ii.z+=1e-4,Ii.normalize(),ws.crossVectors(o,Ii)),ws.normalize(),of.crossVectors(Ii,ws),a[0]=ws.x,a[4]=of.x,a[8]=Ii.x,a[1]=ws.y,a[5]=of.y,a[9]=Ii.y,a[2]=ws.z,a[6]=of.z,a[10]=Ii.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){let o=t.elements,a=e.elements,l=this.elements,h=o[0],f=o[4],p=o[8],d=o[12],g=o[1],x=o[5],v=o[9],M=o[13],b=o[2],T=o[6],_=o[10],y=o[14],A=o[3],S=o[7],L=o[11],G=o[15],z=a[0],F=a[4],I=a[8],ut=a[12],R=a[1],W=a[5],V=a[9],Mt=a[13],X=a[2],mt=a[6],dt=a[10],_t=a[14],it=a[3],lt=a[7],H=a[11],bt=a[15];return l[0]=h*z+f*R+p*X+d*it,l[4]=h*F+f*W+p*mt+d*lt,l[8]=h*I+f*V+p*dt+d*H,l[12]=h*ut+f*Mt+p*_t+d*bt,l[1]=g*z+x*R+v*X+M*it,l[5]=g*F+x*W+v*mt+M*lt,l[9]=g*I+x*V+v*dt+M*H,l[13]=g*ut+x*Mt+v*_t+M*bt,l[2]=b*z+T*R+_*X+y*it,l[6]=b*F+T*W+_*mt+y*lt,l[10]=b*I+T*V+_*dt+y*H,l[14]=b*ut+T*Mt+_*_t+y*bt,l[3]=A*z+S*R+L*X+G*it,l[7]=A*F+S*W+L*mt+G*lt,l[11]=A*I+S*V+L*dt+G*H,l[15]=A*ut+S*Mt+L*_t+G*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],a=t[8],l=t[12],h=t[1],f=t[5],p=t[9],d=t[13],g=t[2],x=t[6],v=t[10],M=t[14],b=t[3],T=t[7],_=t[11],y=t[15];return b*(+l*p*x-a*d*x-l*f*v+o*d*v+a*f*M-o*p*M)+T*(+e*p*M-e*d*v+l*h*v-a*h*M+a*d*g-l*p*g)+_*(+e*d*x-e*f*M-l*h*x+o*h*M+l*f*g-o*d*g)+y*(-a*f*g-e*p*x+e*f*v+a*h*x-o*h*v+o*p*g)}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 a=this.elements;return t.isVector3?(a[12]=t.x,a[13]=t.y,a[14]=t.z):(a[12]=t,a[13]=e,a[14]=o),this}invert(){let t=this.elements,e=t[0],o=t[1],a=t[2],l=t[3],h=t[4],f=t[5],p=t[6],d=t[7],g=t[8],x=t[9],v=t[10],M=t[11],b=t[12],T=t[13],_=t[14],y=t[15],A=x*_*d-T*v*d+T*p*M-f*_*M-x*p*y+f*v*y,S=b*v*d-g*_*d-b*p*M+h*_*M+g*p*y-h*v*y,L=g*T*d-b*x*d+b*f*M-h*T*M-g*f*y+h*x*y,G=b*x*p-g*T*p-b*f*v+h*T*v+g*f*_-h*x*_,z=e*A+o*S+a*L+l*G;if(z===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let F=1/z;return t[0]=A*F,t[1]=(T*v*l-x*_*l-T*a*M+o*_*M+x*a*y-o*v*y)*F,t[2]=(f*_*l-T*p*l+T*a*d-o*_*d-f*a*y+o*p*y)*F,t[3]=(x*p*l-f*v*l-x*a*d+o*v*d+f*a*M-o*p*M)*F,t[4]=S*F,t[5]=(g*_*l-b*v*l+b*a*M-e*_*M-g*a*y+e*v*y)*F,t[6]=(b*p*l-h*_*l-b*a*d+e*_*d+h*a*y-e*p*y)*F,t[7]=(h*v*l-g*p*l+g*a*d-e*v*d-h*a*M+e*p*M)*F,t[8]=L*F,t[9]=(b*x*l-g*T*l-b*o*M+e*T*M+g*o*y-e*x*y)*F,t[10]=(h*T*l-b*f*l+b*o*d-e*T*d-h*o*y+e*f*y)*F,t[11]=(g*f*l-h*x*l-g*o*d+e*x*d+h*o*M-e*f*M)*F,t[12]=G*F,t[13]=(g*T*a-b*x*a+b*o*v-e*T*v-g*o*_+e*x*_)*F,t[14]=(b*f*a-h*T*a-b*o*p+e*T*p+h*o*_-e*f*_)*F,t[15]=(h*x*a-g*f*a+g*o*p-e*x*p-h*o*v+e*f*v)*F,this}scale(t){let e=this.elements,o=t.x,a=t.y,l=t.z;return e[0]*=o,e[4]*=a,e[8]*=l,e[1]*=o,e[5]*=a,e[9]*=l,e[2]*=o,e[6]*=a,e[10]*=l,e[3]*=o,e[7]*=a,e[11]*=l,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],a=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,o,a))}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),a=Math.sin(e),l=1-o,h=t.x,f=t.y,p=t.z,d=l*h,g=l*f;return this.set(d*h+o,d*f-a*p,d*p+a*f,0,d*f+a*p,g*f+o,g*p-a*h,0,d*p-a*f,g*p+a*h,l*p*p+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,a,l,h){return this.set(1,o,l,0,t,1,h,0,e,a,1,0,0,0,0,1),this}compose(t,e,o){let a=this.elements,l=e._x,h=e._y,f=e._z,p=e._w,d=l+l,g=h+h,x=f+f,v=l*d,M=l*g,b=l*x,T=h*g,_=h*x,y=f*x,A=p*d,S=p*g,L=p*x,G=o.x,z=o.y,F=o.z;return a[0]=(1-(T+y))*G,a[1]=(M+L)*G,a[2]=(b-S)*G,a[3]=0,a[4]=(M-L)*z,a[5]=(1-(v+y))*z,a[6]=(_+A)*z,a[7]=0,a[8]=(b+S)*F,a[9]=(_-A)*F,a[10]=(1-(v+T))*F,a[11]=0,a[12]=t.x,a[13]=t.y,a[14]=t.z,a[15]=1,this}decompose(t,e,o){let a=this.elements,l=ru.set(a[0],a[1],a[2]).length(),h=ru.set(a[4],a[5],a[6]).length(),f=ru.set(a[8],a[9],a[10]).length();this.determinant()<0&&(l=-l),t.x=a[12],t.y=a[13],t.z=a[14],uo.copy(this);let d=1/l,g=1/h,x=1/f;return uo.elements[0]*=d,uo.elements[1]*=d,uo.elements[2]*=d,uo.elements[4]*=g,uo.elements[5]*=g,uo.elements[6]*=g,uo.elements[8]*=x,uo.elements[9]*=x,uo.elements[10]*=x,e.setFromRotationMatrix(uo),o.x=l,o.y=h,o.z=f,this}makePerspective(t,e,o,a,l,h,f=ss){let p=this.elements,d=2*l/(e-t),g=2*l/(o-a),x=(e+t)/(e-t),v=(o+a)/(o-a),M,b;if(f===ss)M=-(h+l)/(h-l),b=-2*h*l/(h-l);else if(f===If)M=-h/(h-l),b=-h*l/(h-l);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+f);return p[0]=d,p[4]=0,p[8]=x,p[12]=0,p[1]=0,p[5]=g,p[9]=v,p[13]=0,p[2]=0,p[6]=0,p[10]=M,p[14]=b,p[3]=0,p[7]=0,p[11]=-1,p[15]=0,this}makeOrthographic(t,e,o,a,l,h,f=ss){let p=this.elements,d=1/(e-t),g=1/(o-a),x=1/(h-l),v=(e+t)*d,M=(o+a)*g,b,T;if(f===ss)b=(h+l)*x,T=-2*x;else if(f===If)b=l*x,T=-1*x;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+f);return p[0]=2*d,p[4]=0,p[8]=0,p[12]=-v,p[1]=0,p[5]=2*g,p[9]=0,p[13]=-M,p[2]=0,p[6]=0,p[10]=T,p[14]=-b,p[3]=0,p[7]=0,p[11]=0,p[15]=1,this}equals(t){let e=this.elements,o=t.elements;for(let a=0;a<16;a++)if(e[a]!==o[a])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}},ru=new yt,uo=new cr,B2=new yt(0,0,0),z2=new yt(1,1,1),ws=new yt,of=new yt,Ii=new yt,hE=new cr,pE=new Fs,xa=class r{constructor(t=0,e=0,o=0,a=r.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=e,this._z=o,this._order=a}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,a=this._order){return this._x=t,this._y=e,this._z=o,this._order=a,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 a=t.elements,l=a[0],h=a[4],f=a[8],p=a[1],d=a[5],g=a[9],x=a[2],v=a[6],M=a[10];switch(e){case"XYZ":this._y=Math.asin(xi(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(-g,M),this._z=Math.atan2(-h,l)):(this._x=Math.atan2(v,d),this._z=0);break;case"YXZ":this._x=Math.asin(-xi(g,-1,1)),Math.abs(g)<.9999999?(this._y=Math.atan2(f,M),this._z=Math.atan2(p,d)):(this._y=Math.atan2(-x,l),this._z=0);break;case"ZXY":this._x=Math.asin(xi(v,-1,1)),Math.abs(v)<.9999999?(this._y=Math.atan2(-x,M),this._z=Math.atan2(-h,d)):(this._y=0,this._z=Math.atan2(p,l));break;case"ZYX":this._y=Math.asin(-xi(x,-1,1)),Math.abs(x)<.9999999?(this._x=Math.atan2(v,M),this._z=Math.atan2(p,l)):(this._x=0,this._z=Math.atan2(-h,d));break;case"YZX":this._z=Math.asin(xi(p,-1,1)),Math.abs(p)<.9999999?(this._x=Math.atan2(-g,d),this._y=Math.atan2(-x,l)):(this._x=0,this._y=Math.atan2(f,M));break;case"XZY":this._z=Math.asin(-xi(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(v,d),this._y=Math.atan2(f,l)):(this._x=Math.atan2(-g,M),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 hE.makeRotationFromQuaternion(t),this.setFromRotationMatrix(hE,e,o)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return pE.setFromEuler(this),this.setFromQuaternion(pE,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}};xa.DEFAULT_ORDER="XYZ";var Df=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}},G2=0,dE=new yt,iu=new Fs,Qo=new cr,sf=new yt,Al=new yt,k2=new yt,q2=new Fs,mE=new yt(1,0,0),gE=new yt(0,1,0),yE=new yt(0,0,1),V2={type:"added"},H2={type:"removed"},kd={type:"childadded",child:null},qd={type:"childremoved",child:null},po=class r extends Ds{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:G2++}),this.uuid=Ns(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=r.DEFAULT_UP.clone();let t=new yt,e=new xa,o=new Fs,a=new yt(1,1,1);function l(){o.setFromEuler(e,!1)}function h(){e.setFromQuaternion(o,void 0,!1)}e._onChange(l),o._onChange(h),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:a},modelViewMatrix:{value:new cr},normalMatrix:{value:new _e}}),this.matrix=new cr,this.matrixWorld=new cr,this.matrixAutoUpdate=r.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=r.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Df,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 iu.setFromAxisAngle(t,e),this.quaternion.multiply(iu),this}rotateOnWorldAxis(t,e){return iu.setFromAxisAngle(t,e),this.quaternion.premultiply(iu),this}rotateX(t){return this.rotateOnAxis(mE,t)}rotateY(t){return this.rotateOnAxis(gE,t)}rotateZ(t){return this.rotateOnAxis(yE,t)}translateOnAxis(t,e){return dE.copy(t).applyQuaternion(this.quaternion),this.position.add(dE.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(mE,t)}translateY(t){return this.translateOnAxis(gE,t)}translateZ(t){return this.translateOnAxis(yE,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(Qo.copy(this.matrixWorld).invert())}lookAt(t,e,o){t.isVector3?sf.copy(t):sf.set(t,e,o);let a=this.parent;this.updateWorldMatrix(!0,!1),Al.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Qo.lookAt(Al,sf,this.up):Qo.lookAt(sf,Al,this.up),this.quaternion.setFromRotationMatrix(Qo),a&&(Qo.extractRotation(a.matrixWorld),iu.setFromRotationMatrix(Qo),this.quaternion.premultiply(iu.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(V2),kd.child=t,this.dispatchEvent(kd),kd.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(H2),qd.child=t,this.dispatchEvent(qd),qd.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),Qo.copy(this.matrixWorld).invert(),t.parent!==null&&(t.parent.updateWorldMatrix(!0,!1),Qo.multiply(t.parent.matrixWorld)),t.applyMatrix4(Qo),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,a=this.children.length;o<a;o++){let h=this.children[o].getObjectByProperty(t,e);if(h!==void 0)return h}}getObjectsByProperty(t,e,o=[]){this[t]===e&&o.push(this);let a=this.children;for(let l=0,h=a.length;l<h;l++)a[l].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(Al,t,k2),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Al,q2,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,a=e.length;o<a;o++)e[o].traverse(t)}traverseVisible(t){if(this.visible===!1)return;t(this);let e=this.children;for(let o=0,a=e.length;o<a;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,a=e.length;o<a;o++){let l=e[o];(l.matrixWorldAutoUpdate===!0||t===!0)&&l.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 a=this.children;for(let l=0,h=a.length;l<h;l++){let f=a[l];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 a={};a.uuid=this.uuid,a.type=this.type,this.name!==""&&(a.name=this.name),this.castShadow===!0&&(a.castShadow=!0),this.receiveShadow===!0&&(a.receiveShadow=!0),this.visible===!1&&(a.visible=!1),this.frustumCulled===!1&&(a.frustumCulled=!1),this.renderOrder!==0&&(a.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(a.userData=this.userData),a.layers=this.layers.mask,a.matrix=this.matrix.toArray(),a.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(a.matrixAutoUpdate=!1),this.isInstancedMesh&&(a.type="InstancedMesh",a.count=this.count,a.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(a.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(a.type="BatchedMesh",a.perObjectFrustumCulled=this.perObjectFrustumCulled,a.sortObjects=this.sortObjects,a.drawRanges=this._drawRanges,a.reservedRanges=this._reservedRanges,a.visibility=this._visibility,a.active=this._active,a.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()})),a.maxGeometryCount=this._maxGeometryCount,a.maxVertexCount=this._maxVertexCount,a.maxIndexCount=this._maxIndexCount,a.geometryInitialized=this._geometryInitialized,a.geometryCount=this._geometryCount,a.matricesTexture=this._matricesTexture.toJSON(t),this.boundingSphere!==null&&(a.boundingSphere={center:a.boundingSphere.center.toArray(),radius:a.boundingSphere.radius}),this.boundingBox!==null&&(a.boundingBox={min:a.boundingBox.min.toArray(),max:a.boundingBox.max.toArray()}));function l(f,p){return f[p.uuid]===void 0&&(f[p.uuid]=p.toJSON(t)),p.uuid}if(this.isScene)this.background&&(this.background.isColor?a.background=this.background.toJSON():this.background.isTexture&&(a.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(a.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){a.geometry=l(t.geometries,this.geometry);let f=this.geometry.parameters;if(f!==void 0&&f.shapes!==void 0){let p=f.shapes;if(Array.isArray(p))for(let d=0,g=p.length;d<g;d++){let x=p[d];l(t.shapes,x)}else l(t.shapes,p)}}if(this.isSkinnedMesh&&(a.bindMode=this.bindMode,a.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(l(t.skeletons,this.skeleton),a.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let f=[];for(let p=0,d=this.material.length;p<d;p++)f.push(l(t.materials,this.material[p]));a.material=f}else a.material=l(t.materials,this.material);if(this.children.length>0){a.children=[];for(let f=0;f<this.children.length;f++)a.children.push(this.children[f].toJSON(t).object)}if(this.animations.length>0){a.animations=[];for(let f=0;f<this.animations.length;f++){let p=this.animations[f];a.animations.push(l(t.animations,p))}}if(e){let f=h(t.geometries),p=h(t.materials),d=h(t.textures),g=h(t.images),x=h(t.shapes),v=h(t.skeletons),M=h(t.animations),b=h(t.nodes);f.length>0&&(o.geometries=f),p.length>0&&(o.materials=p),d.length>0&&(o.textures=d),g.length>0&&(o.images=g),x.length>0&&(o.shapes=x),v.length>0&&(o.skeletons=v),M.length>0&&(o.animations=M),b.length>0&&(o.nodes=b)}return o.object=a,o;function h(f){let p=[];for(let d in f){let g=f[d];delete g.metadata,p.push(g)}return p}}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 a=t.children[o];this.add(a.clone())}return this}};po.DEFAULT_UP=new yt(0,1,0);po.DEFAULT_MATRIX_AUTO_UPDATE=!0;po.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var lo=new yt,ts=new yt,Vd=new yt,es=new yt,ou=new yt,su=new yt,vE=new yt,Hd=new yt,Wd=new yt,Xd=new yt,ga=class r{constructor(t=new yt,e=new yt,o=new yt){this.a=t,this.b=e,this.c=o}static getNormal(t,e,o,a){a.subVectors(o,e),lo.subVectors(t,e),a.cross(lo);let l=a.lengthSq();return l>0?a.multiplyScalar(1/Math.sqrt(l)):a.set(0,0,0)}static getBarycoord(t,e,o,a,l){lo.subVectors(a,e),ts.subVectors(o,e),Vd.subVectors(t,e);let h=lo.dot(lo),f=lo.dot(ts),p=lo.dot(Vd),d=ts.dot(ts),g=ts.dot(Vd),x=h*d-f*f;if(x===0)return l.set(0,0,0),null;let v=1/x,M=(d*p-f*g)*v,b=(h*g-f*p)*v;return l.set(1-M-b,b,M)}static containsPoint(t,e,o,a){return this.getBarycoord(t,e,o,a,es)===null?!1:es.x>=0&&es.y>=0&&es.x+es.y<=1}static getInterpolation(t,e,o,a,l,h,f,p){return this.getBarycoord(t,e,o,a,es)===null?(p.x=0,p.y=0,"z"in p&&(p.z=0),"w"in p&&(p.w=0),null):(p.setScalar(0),p.addScaledVector(l,es.x),p.addScaledVector(h,es.y),p.addScaledVector(f,es.z),p)}static isFrontFacing(t,e,o,a){return lo.subVectors(o,e),ts.subVectors(t,e),lo.cross(ts).dot(a)<0}set(t,e,o){return this.a.copy(t),this.b.copy(e),this.c.copy(o),this}setFromPointsAndIndices(t,e,o,a){return this.a.copy(t[e]),this.b.copy(t[o]),this.c.copy(t[a]),this}setFromAttributeAndIndices(t,e,o,a){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,o),this.c.fromBufferAttribute(t,a),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 lo.subVectors(this.c,this.b),ts.subVectors(this.a,this.b),lo.cross(ts).length()*.5}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return r.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return r.getBarycoord(t,this.a,this.b,this.c,e)}getInterpolation(t,e,o,a,l){return r.getInterpolation(t,this.a,this.b,this.c,e,o,a,l)}containsPoint(t){return r.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return r.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){let o=this.a,a=this.b,l=this.c,h,f;ou.subVectors(a,o),su.subVectors(l,o),Hd.subVectors(t,o);let p=ou.dot(Hd),d=su.dot(Hd);if(p<=0&&d<=0)return e.copy(o);Wd.subVectors(t,a);let g=ou.dot(Wd),x=su.dot(Wd);if(g>=0&&x<=g)return e.copy(a);let v=p*x-g*d;if(v<=0&&p>=0&&g<=0)return h=p/(p-g),e.copy(o).addScaledVector(ou,h);Xd.subVectors(t,l);let M=ou.dot(Xd),b=su.dot(Xd);if(b>=0&&M<=b)return e.copy(l);let T=M*d-p*b;if(T<=0&&d>=0&&b<=0)return f=d/(d-b),e.copy(o).addScaledVector(su,f);let _=g*b-M*x;if(_<=0&&x-g>=0&&M-b>=0)return vE.subVectors(l,a),f=(x-g)/(x-g+(M-b)),e.copy(a).addScaledVector(vE,f);let y=1/(_+T+v);return h=T*y,f=v*y,e.copy(o).addScaledVector(ou,h).addScaledVector(su,f)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}},uM={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},bs={h:0,s:0,l:0},af={h:0,s:0,l:0};function Yd(r,t,e){return e<0&&(e+=1),e>1&&(e-=1),e<1/6?r+(t-r)*6*e:e<1/2?t:e<2/3?r+(t-r)*6*(2/3-e):r}var vn=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 a=t;a&&a.isColor?this.copy(a):typeof a=="number"?this.setHex(a):typeof a=="string"&&this.setStyle(a)}else this.setRGB(t,e,o);return this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=Ao){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(t&255)/255,Cn.toWorkingColorSpace(this,e),this}setRGB(t,e,o,a=Cn.workingColorSpace){return this.r=t,this.g=e,this.b=o,Cn.toWorkingColorSpace(this,a),this}setHSL(t,e,o,a=Cn.workingColorSpace){if(t=L2(t,1),e=xi(e,0,1),o=xi(o,0,1),e===0)this.r=this.g=this.b=o;else{let l=o<=.5?o*(1+e):o+e-o*e,h=2*o-l;this.r=Yd(h,l,t+1/3),this.g=Yd(h,l,t),this.b=Yd(h,l,t-1/3)}return Cn.toWorkingColorSpace(this,a),this}setStyle(t,e=Ao){function o(l){l!==void 0&&parseFloat(l)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}let a;if(a=/^(\w+)\(([^\)]*)\)/.exec(t)){let l,h=a[1],f=a[2];switch(h){case"rgb":case"rgba":if(l=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(f))return o(l[4]),this.setRGB(Math.min(255,parseInt(l[1],10))/255,Math.min(255,parseInt(l[2],10))/255,Math.min(255,parseInt(l[3],10))/255,e);if(l=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(f))return o(l[4]),this.setRGB(Math.min(100,parseInt(l[1],10))/100,Math.min(100,parseInt(l[2],10))/100,Math.min(100,parseInt(l[3],10))/100,e);break;case"hsl":case"hsla":if(l=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(f))return o(l[4]),this.setHSL(parseFloat(l[1])/360,parseFloat(l[2])/100,parseFloat(l[3])/100,e);break;default:console.warn("THREE.Color: Unknown color model "+t)}}else if(a=/^\#([A-Fa-f\d]+)$/.exec(t)){let l=a[1],h=l.length;if(h===3)return this.setRGB(parseInt(l.charAt(0),16)/15,parseInt(l.charAt(1),16)/15,parseInt(l.charAt(2),16)/15,e);if(h===6)return this.setHex(parseInt(l,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=Ao){let o=uM[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=Eu(t.r),this.g=Eu(t.g),this.b=Eu(t.b),this}copyLinearToSRGB(t){return this.r=Nd(t.r),this.g=Nd(t.g),this.b=Nd(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=Ao){return Cn.fromWorkingColorSpace(Kr.copy(this),t),Math.round(xi(Kr.r*255,0,255))*65536+Math.round(xi(Kr.g*255,0,255))*256+Math.round(xi(Kr.b*255,0,255))}getHexString(t=Ao){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=Cn.workingColorSpace){Cn.fromWorkingColorSpace(Kr.copy(this),e);let o=Kr.r,a=Kr.g,l=Kr.b,h=Math.max(o,a,l),f=Math.min(o,a,l),p,d,g=(f+h)/2;if(f===h)p=0,d=0;else{let x=h-f;switch(d=g<=.5?x/(h+f):x/(2-h-f),h){case o:p=(a-l)/x+(a<l?6:0);break;case a:p=(l-o)/x+2;break;case l:p=(o-a)/x+4;break}p/=6}return t.h=p,t.s=d,t.l=g,t}getRGB(t,e=Cn.workingColorSpace){return Cn.fromWorkingColorSpace(Kr.copy(this),e),t.r=Kr.r,t.g=Kr.g,t.b=Kr.b,t}getStyle(t=Ao){Cn.fromWorkingColorSpace(Kr.copy(this),t);let e=Kr.r,o=Kr.g,a=Kr.b;return t!==Ao?`color(${t} ${e.toFixed(3)} ${o.toFixed(3)} ${a.toFixed(3)})`:`rgb(${Math.round(e*255)},${Math.round(o*255)},${Math.round(a*255)})`}offsetHSL(t,e,o){return this.getHSL(bs),this.setHSL(bs.h+t,bs.s+e,bs.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(bs),t.getHSL(af);let o=Rd(bs.h,af.h,e),a=Rd(bs.s,af.s,e),l=Rd(bs.l,af.l,e);return this.setHSL(o,a,l),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,a=this.b,l=t.elements;return this.r=l[0]*e+l[3]*o+l[6]*a,this.g=l[1]*e+l[4]*o+l[7]*a,this.b=l[2]*e+l[5]*o+l[8]*a,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}},Kr=new vn;vn.NAMES=uM;var W2=0,Ea=class extends Ds{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:W2++}),this.uuid=Ns(),this.name="",this.type="Material",this.blending=xu,this.side=Os,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=rm,this.blendDst=im,this.blendEquation=pa,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new vn(0,0,0),this.blendAlpha=0,this.depthFunc=wf,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=oE,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=ja,this.stencilZFail=ja,this.stencilZPass=ja,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 a=this[e];if(a===void 0){console.warn(`THREE.Material: '${e}' is not a property of THREE.${this.type}.`);continue}a&&a.isColor?a.set(o):a&&a.isVector3&&o&&o.isVector3?a.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!==xu&&(o.blending=this.blending),this.side!==Os&&(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!==rm&&(o.blendSrc=this.blendSrc),this.blendDst!==im&&(o.blendDst=this.blendDst),this.blendEquation!==pa&&(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!==wf&&(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!==oE&&(o.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(o.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(o.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==ja&&(o.stencilFail=this.stencilFail),this.stencilZFail!==ja&&(o.stencilZFail=this.stencilZFail),this.stencilZPass!==ja&&(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 a(l){let h=[];for(let f in l){let p=l[f];delete p.metadata,h.push(p)}return h}if(e){let l=a(t.textures),h=a(t.images);l.length>0&&(o.textures=l),h.length>0&&(o.images=h)}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 a=e.length;o=new Array(a);for(let l=0;l!==a;++l)o[l]=e[l].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++}},Ff=class extends Ea{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new vn(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 xa,this.combine=JE,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 or=new yt,uf=new ye,Ni=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=lm,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=os,this.version=0}onUploadCallback(){}set needsUpdate(t){t===!0&&this.version++}get updateRange(){return aM("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 a=0,l=this.itemSize;a<l;a++)this.array[t+a]=e.array[o+a];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++)uf.fromBufferAttribute(this,e),uf.applyMatrix3(t),this.setXY(e,uf.x,uf.y);else if(this.itemSize===3)for(let e=0,o=this.count;e<o;e++)or.fromBufferAttribute(this,e),or.applyMatrix3(t),this.setXYZ(e,or.x,or.y,or.z);return this}applyMatrix4(t){for(let e=0,o=this.count;e<o;e++)or.fromBufferAttribute(this,e),or.applyMatrix4(t),this.setXYZ(e,or.x,or.y,or.z);return this}applyNormalMatrix(t){for(let e=0,o=this.count;e<o;e++)or.fromBufferAttribute(this,e),or.applyNormalMatrix(t),this.setXYZ(e,or.x,or.y,or.z);return this}transformDirection(t){for(let e=0,o=this.count;e<o;e++)or.fromBufferAttribute(this,e),or.transformDirection(t),this.setXYZ(e,or.x,or.y,or.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=Po(o,this.array)),o}setComponent(t,e,o){return this.normalized&&(o=An(o,this.array)),this.array[t*this.itemSize+e]=o,this}getX(t){let e=this.array[t*this.itemSize];return this.normalized&&(e=Po(e,this.array)),e}setX(t,e){return this.normalized&&(e=An(e,this.array)),this.array[t*this.itemSize]=e,this}getY(t){let e=this.array[t*this.itemSize+1];return this.normalized&&(e=Po(e,this.array)),e}setY(t,e){return this.normalized&&(e=An(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=Po(e,this.array)),e}setZ(t,e){return this.normalized&&(e=An(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=Po(e,this.array)),e}setW(t,e){return this.normalized&&(e=An(e,this.array)),this.array[t*this.itemSize+3]=e,this}setXY(t,e,o){return t*=this.itemSize,this.normalized&&(e=An(e,this.array),o=An(o,this.array)),this.array[t+0]=e,this.array[t+1]=o,this}setXYZ(t,e,o,a){return t*=this.itemSize,this.normalized&&(e=An(e,this.array),o=An(o,this.array),a=An(a,this.array)),this.array[t+0]=e,this.array[t+1]=o,this.array[t+2]=a,this}setXYZW(t,e,o,a,l){return t*=this.itemSize,this.normalized&&(e=An(e,this.array),o=An(o,this.array),a=An(a,this.array),l=An(l,this.array)),this.array[t+0]=e,this.array[t+1]=o,this.array[t+2]=a,this.array[t+3]=l,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!==lm&&(t.usage=this.usage),t}};var Uf=class extends Ni{constructor(t,e,o){super(new Uint16Array(t),e,o)}};var Bf=class extends Ni{constructor(t,e,o){super(new Uint32Array(t),e,o)}};var as=class extends Ni{constructor(t,e,o){super(new Float32Array(t),e,o)}},X2=0,Vi=new cr,$d=new po,au=new yt,Ri=new _a,Cl=new _a,Ar=new yt,Us=class r extends Ds{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:X2++}),this.uuid=Ns(),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(sM(t)?Bf:Uf)(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 l=new _e().getNormalMatrix(t);o.applyNormalMatrix(l),o.needsUpdate=!0}let a=this.attributes.tangent;return a!==void 0&&(a.transformDirection(t),a.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(t){return Vi.makeRotationFromQuaternion(t),this.applyMatrix4(Vi),this}rotateX(t){return Vi.makeRotationX(t),this.applyMatrix4(Vi),this}rotateY(t){return Vi.makeRotationY(t),this.applyMatrix4(Vi),this}rotateZ(t){return Vi.makeRotationZ(t),this.applyMatrix4(Vi),this}translate(t,e,o){return Vi.makeTranslation(t,e,o),this.applyMatrix4(Vi),this}scale(t,e,o){return Vi.makeScale(t,e,o),this.applyMatrix4(Vi),this}lookAt(t){return $d.lookAt(t),$d.updateMatrix(),this.applyMatrix4($d.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(au).negate(),this.translate(au.x,au.y,au.z),this}setFromPoints(t){let e=[];for(let o=0,a=t.length;o<a;o++){let l=t[o];e.push(l.x,l.y,l.z||0)}return this.setAttribute("position",new as(e,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new _a);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 yt(-1/0,-1/0,-1/0),new yt(1/0,1/0,1/0));return}if(t!==void 0){if(this.boundingBox.setFromBufferAttribute(t),e)for(let o=0,a=e.length;o<a;o++){let l=e[o];Ri.setFromBufferAttribute(l),this.morphTargetsRelative?(Ar.addVectors(this.boundingBox.min,Ri.min),this.boundingBox.expandByPoint(Ar),Ar.addVectors(this.boundingBox.max,Ri.max),this.boundingBox.expandByPoint(Ar)):(this.boundingBox.expandByPoint(Ri.min),this.boundingBox.expandByPoint(Ri.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 Ol);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 yt,1/0);return}if(t){let o=this.boundingSphere.center;if(Ri.setFromBufferAttribute(t),e)for(let l=0,h=e.length;l<h;l++){let f=e[l];Cl.setFromBufferAttribute(f),this.morphTargetsRelative?(Ar.addVectors(Ri.min,Cl.min),Ri.expandByPoint(Ar),Ar.addVectors(Ri.max,Cl.max),Ri.expandByPoint(Ar)):(Ri.expandByPoint(Cl.min),Ri.expandByPoint(Cl.max))}Ri.getCenter(o);let a=0;for(let l=0,h=t.count;l<h;l++)Ar.fromBufferAttribute(t,l),a=Math.max(a,o.distanceToSquared(Ar));if(e)for(let l=0,h=e.length;l<h;l++){let f=e[l],p=this.morphTargetsRelative;for(let d=0,g=f.count;d<g;d++)Ar.fromBufferAttribute(f,d),p&&(au.fromBufferAttribute(t,d),Ar.add(au)),a=Math.max(a,o.distanceToSquared(Ar))}this.boundingSphere.radius=Math.sqrt(a),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,a=e.normal,l=e.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new Ni(new Float32Array(4*o.count),4));let h=this.getAttribute("tangent"),f=[],p=[];for(let I=0;I<o.count;I++)f[I]=new yt,p[I]=new yt;let d=new yt,g=new yt,x=new yt,v=new ye,M=new ye,b=new ye,T=new yt,_=new yt;function y(I,ut,R){d.fromBufferAttribute(o,I),g.fromBufferAttribute(o,ut),x.fromBufferAttribute(o,R),v.fromBufferAttribute(l,I),M.fromBufferAttribute(l,ut),b.fromBufferAttribute(l,R),g.sub(d),x.sub(d),M.sub(v),b.sub(v);let W=1/(M.x*b.y-b.x*M.y);isFinite(W)&&(T.copy(g).multiplyScalar(b.y).addScaledVector(x,-M.y).multiplyScalar(W),_.copy(x).multiplyScalar(M.x).addScaledVector(g,-b.x).multiplyScalar(W),f[I].add(T),f[ut].add(T),f[R].add(T),p[I].add(_),p[ut].add(_),p[R].add(_))}let A=this.groups;A.length===0&&(A=[{start:0,count:t.count}]);for(let I=0,ut=A.length;I<ut;++I){let R=A[I],W=R.start,V=R.count;for(let Mt=W,X=W+V;Mt<X;Mt+=3)y(t.getX(Mt+0),t.getX(Mt+1),t.getX(Mt+2))}let S=new yt,L=new yt,G=new yt,z=new yt;function F(I){G.fromBufferAttribute(a,I),z.copy(G);let ut=f[I];S.copy(ut),S.sub(G.multiplyScalar(G.dot(ut))).normalize(),L.crossVectors(z,ut);let W=L.dot(p[I])<0?-1:1;h.setXYZW(I,S.x,S.y,S.z,W)}for(let I=0,ut=A.length;I<ut;++I){let R=A[I],W=R.start,V=R.count;for(let Mt=W,X=W+V;Mt<X;Mt+=3)F(t.getX(Mt+0)),F(t.getX(Mt+1)),F(t.getX(Mt+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 Ni(new Float32Array(e.count*3),3),this.setAttribute("normal",o);else for(let v=0,M=o.count;v<M;v++)o.setXYZ(v,0,0,0);let a=new yt,l=new yt,h=new yt,f=new yt,p=new yt,d=new yt,g=new yt,x=new yt;if(t)for(let v=0,M=t.count;v<M;v+=3){let b=t.getX(v+0),T=t.getX(v+1),_=t.getX(v+2);a.fromBufferAttribute(e,b),l.fromBufferAttribute(e,T),h.fromBufferAttribute(e,_),g.subVectors(h,l),x.subVectors(a,l),g.cross(x),f.fromBufferAttribute(o,b),p.fromBufferAttribute(o,T),d.fromBufferAttribute(o,_),f.add(g),p.add(g),d.add(g),o.setXYZ(b,f.x,f.y,f.z),o.setXYZ(T,p.x,p.y,p.z),o.setXYZ(_,d.x,d.y,d.z)}else for(let v=0,M=e.count;v<M;v+=3)a.fromBufferAttribute(e,v+0),l.fromBufferAttribute(e,v+1),h.fromBufferAttribute(e,v+2),g.subVectors(h,l),x.subVectors(a,l),g.cross(x),o.setXYZ(v+0,g.x,g.y,g.z),o.setXYZ(v+1,g.x,g.y,g.z),o.setXYZ(v+2,g.x,g.y,g.z);this.normalizeNormals(),o.needsUpdate=!0}}normalizeNormals(){let t=this.attributes.normal;for(let e=0,o=t.count;e<o;e++)Ar.fromBufferAttribute(t,e),Ar.normalize(),t.setXYZ(e,Ar.x,Ar.y,Ar.z)}toNonIndexed(){function t(f,p){let d=f.array,g=f.itemSize,x=f.normalized,v=new d.constructor(p.length*g),M=0,b=0;for(let T=0,_=p.length;T<_;T++){f.isInterleavedBufferAttribute?M=p[T]*f.data.stride+f.offset:M=p[T]*g;for(let y=0;y<g;y++)v[b++]=d[M++]}return new Ni(v,g,x)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let e=new r,o=this.index.array,a=this.attributes;for(let f in a){let p=a[f],d=t(p,o);e.setAttribute(f,d)}let l=this.morphAttributes;for(let f in l){let p=[],d=l[f];for(let g=0,x=d.length;g<x;g++){let v=d[g],M=t(v,o);p.push(M)}e.morphAttributes[f]=p}e.morphTargetsRelative=this.morphTargetsRelative;let h=this.groups;for(let f=0,p=h.length;f<p;f++){let d=h[f];e.addGroup(d.start,d.count,d.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 p=this.parameters;for(let d in p)p[d]!==void 0&&(t[d]=p[d]);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 p in o){let d=o[p];t.data.attributes[p]=d.toJSON(t.data)}let a={},l=!1;for(let p in this.morphAttributes){let d=this.morphAttributes[p],g=[];for(let x=0,v=d.length;x<v;x++){let M=d[x];g.push(M.toJSON(t.data))}g.length>0&&(a[p]=g,l=!0)}l&&(t.data.morphAttributes=a,t.data.morphTargetsRelative=this.morphTargetsRelative);let h=this.groups;h.length>0&&(t.data.groups=JSON.parse(JSON.stringify(h)));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 a=t.attributes;for(let d in a){let g=a[d];this.setAttribute(d,g.clone(e))}let l=t.morphAttributes;for(let d in l){let g=[],x=l[d];for(let v=0,M=x.length;v<M;v++)g.push(x[v].clone(e));this.morphAttributes[d]=g}this.morphTargetsRelative=t.morphTargetsRelative;let h=t.groups;for(let d=0,g=h.length;d<g;d++){let x=h[d];this.addGroup(x.start,x.count,x.materialIndex)}let f=t.boundingBox;f!==null&&(this.boundingBox=f.clone());let p=t.boundingSphere;return p!==null&&(this.boundingSphere=p.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}},_E=new cr,ua=new mm,lf=new Ol,xE=new yt,uu=new yt,lu=new yt,cu=new yt,Zd=new yt,cf=new yt,ff=new ye,hf=new ye,pf=new ye,EE=new yt,ME=new yt,SE=new yt,df=new yt,mf=new yt,ho=class extends po{constructor(t=new Us,e=new Ff){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 a=e[o[0]];if(a!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let l=0,h=a.length;l<h;l++){let f=a[l].name||String(l);this.morphTargetInfluences.push(0),this.morphTargetDictionary[f]=l}}}}getVertexPosition(t,e){let o=this.geometry,a=o.attributes.position,l=o.morphAttributes.position,h=o.morphTargetsRelative;e.fromBufferAttribute(a,t);let f=this.morphTargetInfluences;if(l&&f){cf.set(0,0,0);for(let p=0,d=l.length;p<d;p++){let g=f[p],x=l[p];g!==0&&(Zd.fromBufferAttribute(x,t),h?cf.addScaledVector(Zd,g):cf.addScaledVector(Zd.sub(e),g))}e.add(cf)}return e}raycast(t,e){let o=this.geometry,a=this.material,l=this.matrixWorld;a!==void 0&&(o.boundingSphere===null&&o.computeBoundingSphere(),lf.copy(o.boundingSphere),lf.applyMatrix4(l),ua.copy(t.ray).recast(t.near),!(lf.containsPoint(ua.origin)===!1&&(ua.intersectSphere(lf,xE)===null||ua.origin.distanceToSquared(xE)>(t.far-t.near)**2))&&(_E.copy(l).invert(),ua.copy(t.ray).applyMatrix4(_E),!(o.boundingBox!==null&&ua.intersectsBox(o.boundingBox)===!1)&&this._computeIntersections(t,e,ua)))}_computeIntersections(t,e,o){let a,l=this.geometry,h=this.material,f=l.index,p=l.attributes.position,d=l.attributes.uv,g=l.attributes.uv1,x=l.attributes.normal,v=l.groups,M=l.drawRange;if(f!==null)if(Array.isArray(h))for(let b=0,T=v.length;b<T;b++){let _=v[b],y=h[_.materialIndex],A=Math.max(_.start,M.start),S=Math.min(f.count,Math.min(_.start+_.count,M.start+M.count));for(let L=A,G=S;L<G;L+=3){let z=f.getX(L),F=f.getX(L+1),I=f.getX(L+2);a=gf(this,y,t,o,d,g,x,z,F,I),a&&(a.faceIndex=Math.floor(L/3),a.face.materialIndex=_.materialIndex,e.push(a))}}else{let b=Math.max(0,M.start),T=Math.min(f.count,M.start+M.count);for(let _=b,y=T;_<y;_+=3){let A=f.getX(_),S=f.getX(_+1),L=f.getX(_+2);a=gf(this,h,t,o,d,g,x,A,S,L),a&&(a.faceIndex=Math.floor(_/3),e.push(a))}}else if(p!==void 0)if(Array.isArray(h))for(let b=0,T=v.length;b<T;b++){let _=v[b],y=h[_.materialIndex],A=Math.max(_.start,M.start),S=Math.min(p.count,Math.min(_.start+_.count,M.start+M.count));for(let L=A,G=S;L<G;L+=3){let z=L,F=L+1,I=L+2;a=gf(this,y,t,o,d,g,x,z,F,I),a&&(a.faceIndex=Math.floor(L/3),a.face.materialIndex=_.materialIndex,e.push(a))}}else{let b=Math.max(0,M.start),T=Math.min(p.count,M.start+M.count);for(let _=b,y=T;_<y;_+=3){let A=_,S=_+1,L=_+2;a=gf(this,h,t,o,d,g,x,A,S,L),a&&(a.faceIndex=Math.floor(_/3),e.push(a))}}}};function Y2(r,t,e,o,a,l,h,f){let p;if(t.side===Ei?p=o.intersectTriangle(h,l,a,!0,f):p=o.intersectTriangle(a,l,h,t.side===Os,f),p===null)return null;mf.copy(f),mf.applyMatrix4(r.matrixWorld);let d=e.ray.origin.distanceTo(mf);return d<e.near||d>e.far?null:{distance:d,point:mf.clone(),object:r}}function gf(r,t,e,o,a,l,h,f,p,d){r.getVertexPosition(f,uu),r.getVertexPosition(p,lu),r.getVertexPosition(d,cu);let g=Y2(r,t,e,o,uu,lu,cu,df);if(g){a&&(ff.fromBufferAttribute(a,f),hf.fromBufferAttribute(a,p),pf.fromBufferAttribute(a,d),g.uv=ga.getInterpolation(df,uu,lu,cu,ff,hf,pf,new ye)),l&&(ff.fromBufferAttribute(l,f),hf.fromBufferAttribute(l,p),pf.fromBufferAttribute(l,d),g.uv1=ga.getInterpolation(df,uu,lu,cu,ff,hf,pf,new ye)),h&&(EE.fromBufferAttribute(h,f),ME.fromBufferAttribute(h,p),SE.fromBufferAttribute(h,d),g.normal=ga.getInterpolation(df,uu,lu,cu,EE,ME,SE,new yt),g.normal.dot(o.direction)>0&&g.normal.multiplyScalar(-1));let x={a:f,b:p,c:d,normal:new yt,materialIndex:0};ga.getNormal(uu,lu,cu,x.normal),g.face=x}return g}var Dl=class r extends Us{constructor(t=1,e=1,o=1,a=1,l=1,h=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:o,widthSegments:a,heightSegments:l,depthSegments:h};let f=this;a=Math.floor(a),l=Math.floor(l),h=Math.floor(h);let p=[],d=[],g=[],x=[],v=0,M=0;b("z","y","x",-1,-1,o,e,t,h,l,0),b("z","y","x",1,-1,o,e,-t,h,l,1),b("x","z","y",1,1,t,o,e,a,h,2),b("x","z","y",1,-1,t,o,-e,a,h,3),b("x","y","z",1,-1,t,e,o,a,l,4),b("x","y","z",-1,-1,t,e,-o,a,l,5),this.setIndex(p),this.setAttribute("position",new as(d,3)),this.setAttribute("normal",new as(g,3)),this.setAttribute("uv",new as(x,2));function b(T,_,y,A,S,L,G,z,F,I,ut){let R=L/F,W=G/I,V=L/2,Mt=G/2,X=z/2,mt=F+1,dt=I+1,_t=0,it=0,lt=new yt;for(let H=0;H<dt;H++){let bt=H*W-Mt;for(let Tt=0;Tt<mt;Tt++){let Yt=Tt*R-V;lt[T]=Yt*A,lt[_]=bt*S,lt[y]=X,d.push(lt.x,lt.y,lt.z),lt[T]=0,lt[_]=0,lt[y]=z>0?1:-1,g.push(lt.x,lt.y,lt.z),x.push(Tt/F),x.push(1-H/I),_t+=1}}for(let H=0;H<I;H++)for(let bt=0;bt<F;bt++){let Tt=v+bt+mt*H,Yt=v+bt+mt*(H+1),tt=v+(bt+1)+mt*(H+1),wt=v+(bt+1)+mt*H;p.push(Tt,Yt,wt),p.push(Yt,tt,wt),it+=6}f.addGroup(M,it,ut),M+=it,v+=_t}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new r(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}};function Tu(r){let t={};for(let e in r){t[e]={};for(let o in r[e]){let a=r[e][o];a&&(a.isColor||a.isMatrix3||a.isMatrix4||a.isVector2||a.isVector3||a.isVector4||a.isTexture||a.isQuaternion)?a.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),t[e][o]=null):t[e][o]=a.clone():Array.isArray(a)?t[e][o]=a.slice():t[e][o]=a}}return t}function fi(r){let t={};for(let e=0;e<r.length;e++){let o=Tu(r[e]);for(let a in o)t[a]=o[a]}return t}function $2(r){let t=[];for(let e=0;e<r.length;e++)t.push(r[e].clone());return t}function lM(r){return r.getRenderTarget()===null?r.outputColorSpace:Cn.workingColorSpace}var Z2={clone:Tu,merge:fi},J2=`void main() {
|
|
7
|
+
`)}return n.toString()},ur.prototype.computeEdgeEndLabels=function(n){for(var i=this.iterator();i.hasNext();)i.next().computeLabel(n)},ur.prototype.computeLabelling=function(n){this.computeEdgeEndLabels(n[0].getBoundaryNodeRule()),this.propagateSideLabels(0),this.propagateSideLabels(1);for(var i=[!1,!1],s=this.iterator();s.hasNext();)for(var u=s.next().getLabel(),c=0;c<2;c++)u.isLine(c)&&u.getLocation(c)===V.BOUNDARY&&(i[c]=!0);for(var m=this.iterator();m.hasNext();)for(var E=m.next(),C=E.getLabel(),U=0;U<2;U++)if(C.isAnyNull(U)){var Z=V.NONE;if(i[U])Z=V.EXTERIOR;else{var pt=E.getCoordinate();Z=this.getLocation(U,pt,n)}C.setAllLocationsIfNull(U,Z)}},ur.prototype.getDegree=function(){return this._edgeMap.size()},ur.prototype.insertEdgeEnd=function(n,i){this._edgeMap.put(n,i),this._edgeList=null},ur.prototype.interfaces_=function(){return[]},ur.prototype.getClass=function(){return ur};var QA=function(n){function i(){n.call(this),this._resultAreaEdgeList=null,this._label=null,this._SCANNING_FOR_INCOMING=1,this._LINKING_TO_OUTGOING=2}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.linkResultDirectedEdges=function(){this.getResultAreaEdges();for(var s=null,u=null,c=this._SCANNING_FOR_INCOMING,m=0;m<this._resultAreaEdgeList.size();m++){var E=this._resultAreaEdgeList.get(m),C=E.getSym();if(E.getLabel().isArea())switch(s===null&&E.isInResult()&&(s=E),c){case this._SCANNING_FOR_INCOMING:if(!C.isInResult())continue;u=C,c=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(!E.isInResult())continue;u.setNext(E),c=this._SCANNING_FOR_INCOMING}}if(c===this._LINKING_TO_OUTGOING){if(s===null)throw new xo("no outgoing dirEdge found",this.getCoordinate());Lt.isTrue(s.isInResult(),"unable to link last incoming dirEdge"),u.setNext(s)}},i.prototype.insert=function(s){var u=s;this.insertEdgeEnd(u,u)},i.prototype.getRightmostEdge=function(){var s=this.getEdges(),u=s.size();if(u<1)return null;var c=s.get(0);if(u===1)return c;var m=s.get(u-1),E=c.getQuadrant(),C=m.getQuadrant();return dn.isNorthern(E)&&dn.isNorthern(C)?c:dn.isNorthern(E)||dn.isNorthern(C)?c.getDy()!==0?c:m.getDy()!==0?m:(Lt.shouldNeverReachHere("found two horizontal edges incident on node"),null):m},i.prototype.print=function(s){Ut.out.println("DirectedEdgeStar: "+this.getCoordinate());for(var u=this.iterator();u.hasNext();){var c=u.next();s.print("out "),c.print(s),s.println(),s.print("in "),c.getSym().print(s),s.println()}},i.prototype.getResultAreaEdges=function(){if(this._resultAreaEdgeList!==null)return this._resultAreaEdgeList;this._resultAreaEdgeList=new O;for(var s=this.iterator();s.hasNext();){var u=s.next();(u.isInResult()||u.getSym().isInResult())&&this._resultAreaEdgeList.add(u)}return this._resultAreaEdgeList},i.prototype.updateLabelling=function(s){for(var u=this.iterator();u.hasNext();){var c=u.next().getLabel();c.setAllLocationsIfNull(0,s.getLocation(0)),c.setAllLocationsIfNull(1,s.getLocation(1))}},i.prototype.linkAllDirectedEdges=function(){this.getEdges();for(var s=null,u=null,c=this._edgeList.size()-1;c>=0;c--){var m=this._edgeList.get(c),E=m.getSym();u===null&&(u=E),s!==null&&E.setNext(s),s=m}u.setNext(s)},i.prototype.computeDepths=function(){if(arguments.length===1){var s=arguments[0],u=this.findIndex(s),c=s.getDepth(It.LEFT),m=s.getDepth(It.RIGHT),E=this.computeDepths(u+1,this._edgeList.size(),c);if(this.computeDepths(0,u,E)!==m)throw new xo("depth mismatch at "+s.getCoordinate())}else if(arguments.length===3){for(var C=arguments[0],U=arguments[1],Z=arguments[2],pt=C;pt<U;pt++){var gt=this._edgeList.get(pt);gt.setEdgeDepths(It.RIGHT,Z),Z=gt.getDepth(It.LEFT)}return Z}},i.prototype.mergeSymLabels=function(){for(var s=this.iterator();s.hasNext();){var u=s.next();u.getLabel().merge(u.getSym().getLabel())}},i.prototype.linkMinimalDirectedEdges=function(s){for(var u=null,c=null,m=this._SCANNING_FOR_INCOMING,E=this._resultAreaEdgeList.size()-1;E>=0;E--){var C=this._resultAreaEdgeList.get(E),U=C.getSym();switch(u===null&&C.getEdgeRing()===s&&(u=C),m){case this._SCANNING_FOR_INCOMING:if(U.getEdgeRing()!==s)continue;c=U,m=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(C.getEdgeRing()!==s)continue;c.setNextMin(C),m=this._SCANNING_FOR_INCOMING}}m===this._LINKING_TO_OUTGOING&&(Lt.isTrue(u!==null,"found null for first outgoing dirEdge"),Lt.isTrue(u.getEdgeRing()===s,"unable to link last incoming dirEdge"),c.setNextMin(u))},i.prototype.getOutgoingDegree=function(){if(arguments.length===0){for(var s=0,u=this.iterator();u.hasNext();)u.next().isInResult()&&s++;return s}if(arguments.length===1){for(var c=arguments[0],m=0,E=this.iterator();E.hasNext();)E.next().getEdgeRing()===c&&m++;return m}},i.prototype.getLabel=function(){return this._label},i.prototype.findCoveredLineEdges=function(){for(var s=V.NONE,u=this.iterator();u.hasNext();){var c=u.next(),m=c.getSym();if(!c.isLineEdge()){if(c.isInResult()){s=V.INTERIOR;break}if(m.isInResult()){s=V.EXTERIOR;break}}}if(s===V.NONE)return null;for(var E=s,C=this.iterator();C.hasNext();){var U=C.next(),Z=U.getSym();U.isLineEdge()?U.getEdge().setCovered(E===V.INTERIOR):(U.isInResult()&&(E=V.EXTERIOR),Z.isInResult()&&(E=V.INTERIOR))}},i.prototype.computeLabelling=function(s){n.prototype.computeLabelling.call(this,s),this._label=new fn(V.NONE);for(var u=this.iterator();u.hasNext();)for(var c=u.next().getEdge().getLabel(),m=0;m<2;m++){var E=c.getLocation(m);E!==V.INTERIOR&&E!==V.BOUNDARY||this._label.setLocation(m,V.INTERIOR)}},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(ur),ly=function(n){function i(){n.apply(this,arguments)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.createNode=function(s){return new hc(s,new QA)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(Da),Go=function n(){this._pts=null,this._orientation=null;var i=arguments[0];this._pts=i,this._orientation=n.orientation(i)};Go.prototype.compareTo=function(n){var i=n;return Go.compareOriented(this._pts,this._orientation,i._pts,i._orientation)},Go.prototype.interfaces_=function(){return[G]},Go.prototype.getClass=function(){return Go},Go.orientation=function(n){return Q.increasingDirection(n)===1},Go.compareOriented=function(n,i,s,u){for(var c=i?1:-1,m=u?1:-1,E=i?n.length:-1,C=u?s.length:-1,U=i?0:n.length-1,Z=u?0:s.length-1;;){var pt=n[U].compareTo(s[Z]);if(pt!==0)return pt;var gt=(U+=c)===E,Rt=(Z+=m)===C;if(gt&&!Rt)return-1;if(!gt&&Rt)return 1;if(gt&&Rt)return 0}};var Ai=function(){this._edges=new O,this._ocaMap=new x};Ai.prototype.print=function(n){n.print("MULTILINESTRING ( ");for(var i=0;i<this._edges.size();i++){var s=this._edges.get(i);i>0&&n.print(","),n.print("(");for(var u=s.getCoordinates(),c=0;c<u.length;c++)c>0&&n.print(","),n.print(u[c].x+" "+u[c].y);n.println(")")}n.print(") ")},Ai.prototype.addAll=function(n){for(var i=n.iterator();i.hasNext();)this.add(i.next())},Ai.prototype.findEdgeIndex=function(n){for(var i=0;i<this._edges.size();i++)if(this._edges.get(i).equals(n))return i;return-1},Ai.prototype.iterator=function(){return this._edges.iterator()},Ai.prototype.getEdges=function(){return this._edges},Ai.prototype.get=function(n){return this._edges.get(n)},Ai.prototype.findEqualEdge=function(n){var i=new Go(n.getCoordinates());return this._ocaMap.get(i)},Ai.prototype.add=function(n){this._edges.add(n);var i=new Go(n.getCoordinates());this._ocaMap.put(i,n)},Ai.prototype.interfaces_=function(){return[]},Ai.prototype.getClass=function(){return Ai};var hs=function(){};hs.prototype.processIntersections=function(n,i,s,u){},hs.prototype.isDone=function(){},hs.prototype.interfaces_=function(){return[]},hs.prototype.getClass=function(){return hs};var si=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 n=arguments[0];this._li=n};si.prototype.isTrivialIntersection=function(n,i,s,u){if(n===s&&this._li.getIntersectionNum()===1){if(si.isAdjacentSegments(i,u))return!0;if(n.isClosed()){var c=n.size()-1;if(i===0&&u===c||u===0&&i===c)return!0}}return!1},si.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},si.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},si.prototype.getLineIntersector=function(){return this._li},si.prototype.hasProperIntersection=function(){return this._hasProper},si.prototype.processIntersections=function(n,i,s,u){if(n===s&&i===u)return null;this.numTests++;var c=n.getCoordinates()[i],m=n.getCoordinates()[i+1],E=s.getCoordinates()[u],C=s.getCoordinates()[u+1];this._li.computeIntersection(c,m,E,C),this._li.hasIntersection()&&(this.numIntersections++,this._li.isInteriorIntersection()&&(this.numInteriorIntersections++,this._hasInterior=!0),this.isTrivialIntersection(n,i,s,u)||(this._hasIntersection=!0,n.addIntersections(this._li,i,0),s.addIntersections(this._li,u,1),this._li.isProper()&&(this.numProperIntersections++,this._hasProper=!0,this._hasProperInterior=!0)))},si.prototype.hasIntersection=function(){return this._hasIntersection},si.prototype.isDone=function(){return!1},si.prototype.hasInteriorIntersection=function(){return this._hasInterior},si.prototype.interfaces_=function(){return[hs]},si.prototype.getClass=function(){return si},si.isAdjacentSegments=function(n,i){return Math.abs(n-i)===1};var Bi=function(){this.coord=null,this.segmentIndex=null,this.dist=null;var n=arguments[0],i=arguments[1],s=arguments[2];this.coord=new I(n),this.segmentIndex=i,this.dist=s};Bi.prototype.getSegmentIndex=function(){return this.segmentIndex},Bi.prototype.getCoordinate=function(){return this.coord},Bi.prototype.print=function(n){n.print(this.coord),n.print(" seg # = "+this.segmentIndex),n.println(" dist = "+this.dist)},Bi.prototype.compareTo=function(n){var i=n;return this.compare(i.segmentIndex,i.dist)},Bi.prototype.isEndPoint=function(n){return this.segmentIndex===0&&this.dist===0||this.segmentIndex===n},Bi.prototype.toString=function(){return this.coord+" seg # = "+this.segmentIndex+" dist = "+this.dist},Bi.prototype.getDistance=function(){return this.dist},Bi.prototype.compare=function(n,i){return this.segmentIndex<n?-1:this.segmentIndex>n?1:this.dist<i?-1:this.dist>i?1:0},Bi.prototype.interfaces_=function(){return[G]},Bi.prototype.getClass=function(){return Bi};var Ji=function(){this._nodeMap=new x,this.edge=null;var n=arguments[0];this.edge=n};Ji.prototype.print=function(n){n.println("Intersections:");for(var i=this.iterator();i.hasNext();)i.next().print(n)},Ji.prototype.iterator=function(){return this._nodeMap.values().iterator()},Ji.prototype.addSplitEdges=function(n){this.addEndpoints();for(var i=this.iterator(),s=i.next();i.hasNext();){var u=i.next(),c=this.createSplitEdge(s,u);n.add(c),s=u}},Ji.prototype.addEndpoints=function(){var n=this.edge.pts.length-1;this.add(this.edge.pts[0],0,0),this.add(this.edge.pts[n],n,0)},Ji.prototype.createSplitEdge=function(n,i){var s=i.segmentIndex-n.segmentIndex+2,u=this.edge.pts[i.segmentIndex],c=i.dist>0||!i.coord.equals2D(u);c||s--;var m=new Array(s).fill(null),E=0;m[E++]=new I(n.coord);for(var C=n.segmentIndex+1;C<=i.segmentIndex;C++)m[E++]=this.edge.pts[C];return c&&(m[E]=i.coord),new dc(m,new fn(this.edge._label))},Ji.prototype.add=function(n,i,s){var u=new Bi(n,i,s),c=this._nodeMap.get(u);return c!==null?c:(this._nodeMap.put(u,u),u)},Ji.prototype.isIntersection=function(n){for(var i=this.iterator();i.hasNext();)if(i.next().coord.equals(n))return!0;return!1},Ji.prototype.interfaces_=function(){return[]},Ji.prototype.getClass=function(){return Ji};var ps=function(){};ps.prototype.getChainStartIndices=function(n){var i=0,s=new O;s.add(new it(i));do{var u=this.findChainEnd(n,i);s.add(new it(u)),i=u}while(i<n.length-1);return ps.toIntArray(s)},ps.prototype.findChainEnd=function(n,i){for(var s=dn.quadrant(n[i],n[i+1]),u=i+1;u<n.length&&dn.quadrant(n[u-1],n[u])===s;)u++;return u-1},ps.prototype.interfaces_=function(){return[]},ps.prototype.getClass=function(){return ps},ps.toIntArray=function(n){for(var i=new Array(n.size()).fill(null),s=0;s<i.length;s++)i[s]=n.get(s).intValue();return i};var So=function(){this.e=null,this.pts=null,this.startIndex=null,this.env1=new At,this.env2=new At;var n=arguments[0];this.e=n,this.pts=n.getCoordinates();var i=new ps;this.startIndex=i.getChainStartIndices(this.pts)};So.prototype.getCoordinates=function(){return this.pts},So.prototype.getMaxX=function(n){var i=this.pts[this.startIndex[n]].x,s=this.pts[this.startIndex[n+1]].x;return i>s?i:s},So.prototype.getMinX=function(n){var i=this.pts[this.startIndex[n]].x,s=this.pts[this.startIndex[n+1]].x;return i<s?i:s},So.prototype.computeIntersectsForChain=function(){if(arguments.length===4){var n=arguments[0],i=arguments[1],s=arguments[2],u=arguments[3];this.computeIntersectsForChain(this.startIndex[n],this.startIndex[n+1],i,i.startIndex[s],i.startIndex[s+1],u)}else if(arguments.length===6){var c=arguments[0],m=arguments[1],E=arguments[2],C=arguments[3],U=arguments[4],Z=arguments[5],pt=this.pts[c],gt=this.pts[m],Rt=E.pts[C],Ft=E.pts[U];if(m-c==1&&U-C==1)return Z.addIntersections(this.e,c,E.e,C),null;if(this.env1.init(pt,gt),this.env2.init(Rt,Ft),!this.env1.intersects(this.env2))return null;var Vt=Math.trunc((c+m)/2),ee=Math.trunc((C+U)/2);c<Vt&&(C<ee&&this.computeIntersectsForChain(c,Vt,E,C,ee,Z),ee<U&&this.computeIntersectsForChain(c,Vt,E,ee,U,Z)),Vt<m&&(C<ee&&this.computeIntersectsForChain(Vt,m,E,C,ee,Z),ee<U&&this.computeIntersectsForChain(Vt,m,E,ee,U,Z))}},So.prototype.getStartIndexes=function(){return this.startIndex},So.prototype.computeIntersects=function(n,i){for(var s=0;s<this.startIndex.length-1;s++)for(var u=0;u<n.startIndex.length-1;u++)this.computeIntersectsForChain(s,n,u,i)},So.prototype.interfaces_=function(){return[]},So.prototype.getClass=function(){return So};var Qn=function n(){this._depth=Array(2).fill().map(function(){return Array(3)});for(var i=0;i<2;i++)for(var s=0;s<3;s++)this._depth[i][s]=n.NULL_VALUE},cy={NULL_VALUE:{configurable:!0}};Qn.prototype.getDepth=function(n,i){return this._depth[n][i]},Qn.prototype.setDepth=function(n,i,s){this._depth[n][i]=s},Qn.prototype.isNull=function(){if(arguments.length===0){for(var n=0;n<2;n++)for(var i=0;i<3;i++)if(this._depth[n][i]!==Qn.NULL_VALUE)return!1;return!0}if(arguments.length===1){var s=arguments[0];return this._depth[s][1]===Qn.NULL_VALUE}if(arguments.length===2){var u=arguments[0],c=arguments[1];return this._depth[u][c]===Qn.NULL_VALUE}},Qn.prototype.normalize=function(){for(var n=0;n<2;n++)if(!this.isNull(n)){var i=this._depth[n][1];this._depth[n][2]<i&&(i=this._depth[n][2]),i<0&&(i=0);for(var s=1;s<3;s++){var u=0;this._depth[n][s]>i&&(u=1),this._depth[n][s]=u}}},Qn.prototype.getDelta=function(n){return this._depth[n][It.RIGHT]-this._depth[n][It.LEFT]},Qn.prototype.getLocation=function(n,i){return this._depth[n][i]<=0?V.EXTERIOR:V.INTERIOR},Qn.prototype.toString=function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]},Qn.prototype.add=function(){if(arguments.length===1)for(var n=arguments[0],i=0;i<2;i++)for(var s=1;s<3;s++){var u=n.getLocation(i,s);u!==V.EXTERIOR&&u!==V.INTERIOR||(this.isNull(i,s)?this._depth[i][s]=Qn.depthAtLocation(u):this._depth[i][s]+=Qn.depthAtLocation(u))}else if(arguments.length===3){var c=arguments[0],m=arguments[1];arguments[2]===V.INTERIOR&&this._depth[c][m]++}},Qn.prototype.interfaces_=function(){return[]},Qn.prototype.getClass=function(){return Qn},Qn.depthAtLocation=function(n){return n===V.EXTERIOR?0:n===V.INTERIOR?1:Qn.NULL_VALUE},cy.NULL_VALUE.get=function(){return-1},Object.defineProperties(Qn,cy);var dc=function(n){function i(){if(n.call(this),this.pts=null,this._env=null,this.eiList=new Ji(this),this._name=null,this._mce=null,this._isIsolated=!0,this._depth=new Qn,this._depthDelta=0,arguments.length===1){var s=arguments[0];i.call(this,s,null)}else if(arguments.length===2){var u=arguments[0],c=arguments[1];this.pts=u,this._label=c}}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.getDepth=function(){return this._depth},i.prototype.getCollapsedEdge=function(){var s=new Array(2).fill(null);return s[0]=this.pts[0],s[1]=this.pts[1],new i(s,fn.toLineLabel(this._label))},i.prototype.isIsolated=function(){return this._isIsolated},i.prototype.getCoordinates=function(){return this.pts},i.prototype.setIsolated=function(s){this._isIsolated=s},i.prototype.setName=function(s){this._name=s},i.prototype.equals=function(s){if(!(s instanceof i))return!1;var u=s;if(this.pts.length!==u.pts.length)return!1;for(var c=!0,m=!0,E=this.pts.length,C=0;C<this.pts.length;C++)if(this.pts[C].equals2D(u.pts[C])||(c=!1),this.pts[C].equals2D(u.pts[--E])||(m=!1),!c&&!m)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 s=arguments[0];return this.pts[s]}},i.prototype.print=function(s){s.print("edge "+this._name+": "),s.print("LINESTRING (");for(var u=0;u<this.pts.length;u++)u>0&&s.print(","),s.print(this.pts[u].x+" "+this.pts[u].y);s.print(") "+this._label+" "+this._depthDelta)},i.prototype.computeIM=function(s){i.updateIM(this._label,s)},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(s){s.print("edge "+this._name+": ");for(var u=this.pts.length-1;u>=0;u--)s.print(this.pts[u]+" ");s.println("")},i.prototype.getMonotoneChainEdge=function(){return this._mce===null&&(this._mce=new So(this)),this._mce},i.prototype.getEnvelope=function(){if(this._env===null){this._env=new At;for(var s=0;s<this.pts.length;s++)this._env.expandToInclude(this.pts[s])}return this._env},i.prototype.addIntersection=function(s,u,c,m){var E=new I(s.getIntersection(m)),C=u,U=s.getEdgeDistance(c,m),Z=C+1;if(Z<this.pts.length){var pt=this.pts[Z];E.equals2D(pt)&&(C=Z,U=0)}this.eiList.add(E,C,U)},i.prototype.toString=function(){var s=new _t;s.append("edge "+this._name+": "),s.append("LINESTRING (");for(var u=0;u<this.pts.length;u++)u>0&&s.append(","),s.append(this.pts[u].x+" "+this.pts[u].y);return s.append(") "+this._label+" "+this._depthDelta),s.toString()},i.prototype.isPointwiseEqual=function(s){if(this.pts.length!==s.pts.length)return!1;for(var u=0;u<this.pts.length;u++)if(!this.pts[u].equals2D(s.pts[u]))return!1;return!0},i.prototype.setDepthDelta=function(s){this._depthDelta=s},i.prototype.getEdgeIntersectionList=function(){return this.eiList},i.prototype.addIntersections=function(s,u,c){for(var m=0;m<s.getIntersectionNum();m++)this.addIntersection(s,u,c,m)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i.updateIM=function(){if(arguments.length!==2)return n.prototype.updateIM.apply(this,arguments);var s=arguments[0],u=arguments[1];u.setAtLeastIfValid(s.getLocation(0,It.ON),s.getLocation(1,It.ON),1),s.isArea()&&(u.setAtLeastIfValid(s.getLocation(0,It.LEFT),s.getLocation(1,It.LEFT),2),u.setAtLeastIfValid(s.getLocation(0,It.RIGHT),s.getLocation(1,It.RIGHT),2))},i}(ri),Er=function(n){this._workingPrecisionModel=null,this._workingNoder=null,this._geomFact=null,this._graph=null,this._edgeList=new Ai,this._bufParams=n||null};Er.prototype.setWorkingPrecisionModel=function(n){this._workingPrecisionModel=n},Er.prototype.insertUniqueEdge=function(n){var i=this._edgeList.findEqualEdge(n);if(i!==null){var s=i.getLabel(),u=n.getLabel();i.isPointwiseEqual(n)||(u=new fn(n.getLabel())).flip(),s.merge(u);var c=Er.depthDelta(u),m=i.getDepthDelta()+c;i.setDepthDelta(m)}else this._edgeList.add(n),n.setDepthDelta(Er.depthDelta(n.getLabel()))},Er.prototype.buildSubgraphs=function(n,i){for(var s=new O,u=n.iterator();u.hasNext();){var c=u.next(),m=c.getRightmostCoordinate(),E=new Ks(s).getDepth(m);c.computeDepth(E),c.findResultEdges(),s.add(c),i.add(c.getDirectedEdges(),c.getNodes())}},Er.prototype.createSubgraphs=function(n){for(var i=new O,s=n.getNodes().iterator();s.hasNext();){var u=s.next();if(!u.isVisited()){var c=new _r;c.create(u),i.add(c)}}return Ti.sort(i,Ti.reverseOrder()),i},Er.prototype.createEmptyResultGeometry=function(){return this._geomFact.createPolygon()},Er.prototype.getNoder=function(n){if(this._workingNoder!==null)return this._workingNoder;var i=new ip,s=new N;return s.setPrecisionModel(n),i.setSegmentIntersector(new si(s)),i},Er.prototype.buffer=function(n,i){var s=this._workingPrecisionModel;s===null&&(s=n.getPrecisionModel()),this._geomFact=n.getFactory();var u=new Or(s,this._bufParams),c=new yi(n,i,u).getCurves();if(c.size()<=0)return this.createEmptyResultGeometry();this.computeNodedEdges(c,s),this._graph=new Rn(new ly),this._graph.addEdges(this._edgeList.getEdges());var m=this.createSubgraphs(this._graph),E=new Wr(this._geomFact);this.buildSubgraphs(m,E);var C=E.getPolygons();return C.size()<=0?this.createEmptyResultGeometry():this._geomFact.buildGeometry(C)},Er.prototype.computeNodedEdges=function(n,i){var s=this.getNoder(i);s.computeNodes(n);for(var u=s.getNodedSubstrings().iterator();u.hasNext();){var c=u.next(),m=c.getCoordinates();if(m.length!==2||!m[0].equals2D(m[1])){var E=c.getData(),C=new dc(c.getCoordinates(),new fn(E));this.insertUniqueEdge(C)}}},Er.prototype.setNoder=function(n){this._workingNoder=n},Er.prototype.interfaces_=function(){return[]},Er.prototype.getClass=function(){return Er},Er.depthDelta=function(n){var i=n.getLocation(0,It.LEFT),s=n.getLocation(0,It.RIGHT);return i===V.INTERIOR&&s===V.EXTERIOR?1:i===V.EXTERIOR&&s===V.INTERIOR?-1:0},Er.convertSegStrings=function(n){for(var i=new pe,s=new O;n.hasNext();){var u=n.next(),c=i.createLineString(u.getCoordinates());s.add(c)}return i.buildGeometry(s)};var ko=function(){if(this._noder=null,this._scaleFactor=null,this._offsetX=null,this._offsetY=null,this._isScaled=!1,arguments.length===2){var n=arguments[0],i=arguments[1];this._noder=n,this._scaleFactor=i,this._offsetX=0,this._offsetY=0,this._isScaled=!this.isIntegerPrecision()}else if(arguments.length===4){var s=arguments[0],u=arguments[1],c=arguments[2],m=arguments[3];this._noder=s,this._scaleFactor=u,this._offsetX=c,this._offsetY=m,this._isScaled=!this.isIntegerPrecision()}};ko.prototype.rescale=function(){if(X(arguments[0],j))for(var n=arguments[0].iterator();n.hasNext();){var i=n.next();this.rescale(i.getCoordinates())}else if(arguments[0]instanceof Array){for(var s=arguments[0],u=0;u<s.length;u++)s[u].x=s[u].x/this._scaleFactor+this._offsetX,s[u].y=s[u].y/this._scaleFactor+this._offsetY;s.length===2&&s[0].equals2D(s[1])&&Ut.out.println(s)}},ko.prototype.scale=function(){if(X(arguments[0],j)){for(var n=arguments[0],i=new O,s=n.iterator();s.hasNext();){var u=s.next();i.add(new Dn(this.scale(u.getCoordinates()),u.getData()))}return i}if(arguments[0]instanceof Array){for(var c=arguments[0],m=new Array(c.length).fill(null),E=0;E<c.length;E++)m[E]=new I(Math.round((c[E].x-this._offsetX)*this._scaleFactor),Math.round((c[E].y-this._offsetY)*this._scaleFactor),c[E].z);return Q.removeRepeatedPoints(m)}},ko.prototype.isIntegerPrecision=function(){return this._scaleFactor===1},ko.prototype.getNodedSubstrings=function(){var n=this._noder.getNodedSubstrings();return this._isScaled&&this.rescale(n),n},ko.prototype.computeNodes=function(n){var i=n;this._isScaled&&(i=this.scale(n)),this._noder.computeNodes(i)},ko.prototype.interfaces_=function(){return[cs]},ko.prototype.getClass=function(){return ko};var zi=function(){this._li=new N,this._segStrings=null;var n=arguments[0];this._segStrings=n},fy={fact:{configurable:!0}};zi.prototype.checkEndPtVertexIntersections=function(){if(arguments.length===0)for(var n=this._segStrings.iterator();n.hasNext();){var i=n.next().getCoordinates();this.checkEndPtVertexIntersections(i[0],this._segStrings),this.checkEndPtVertexIntersections(i[i.length-1],this._segStrings)}else if(arguments.length===2){for(var s=arguments[0],u=arguments[1].iterator();u.hasNext();)for(var c=u.next().getCoordinates(),m=1;m<c.length-1;m++)if(c[m].equals(s))throw new ie("found endpt/interior pt intersection at index "+m+" :pt "+s)}},zi.prototype.checkInteriorIntersections=function(){if(arguments.length===0)for(var n=this._segStrings.iterator();n.hasNext();)for(var i=n.next(),s=this._segStrings.iterator();s.hasNext();){var u=s.next();this.checkInteriorIntersections(i,u)}else if(arguments.length===2)for(var c=arguments[0],m=arguments[1],E=c.getCoordinates(),C=m.getCoordinates(),U=0;U<E.length-1;U++)for(var Z=0;Z<C.length-1;Z++)this.checkInteriorIntersections(c,U,m,Z);else if(arguments.length===4){var pt=arguments[0],gt=arguments[1],Rt=arguments[2],Ft=arguments[3];if(pt===Rt&>===Ft)return null;var Vt=pt.getCoordinates()[gt],ee=pt.getCoordinates()[gt+1],hn=Rt.getCoordinates()[Ft],qn=Rt.getCoordinates()[Ft+1];if(this._li.computeIntersection(Vt,ee,hn,qn),this._li.hasIntersection()&&(this._li.isProper()||this.hasInteriorIntersection(this._li,Vt,ee)||this.hasInteriorIntersection(this._li,hn,qn)))throw new ie("found non-noded intersection at "+Vt+"-"+ee+" and "+hn+"-"+qn)}},zi.prototype.checkValid=function(){this.checkEndPtVertexIntersections(),this.checkInteriorIntersections(),this.checkCollapses()},zi.prototype.checkCollapses=function(){if(arguments.length===0)for(var n=this._segStrings.iterator();n.hasNext();){var i=n.next();this.checkCollapses(i)}else if(arguments.length===1)for(var s=arguments[0].getCoordinates(),u=0;u<s.length-2;u++)this.checkCollapse(s[u],s[u+1],s[u+2])},zi.prototype.hasInteriorIntersection=function(n,i,s){for(var u=0;u<n.getIntersectionNum();u++){var c=n.getIntersection(u);if(!c.equals(i)&&!c.equals(s))return!0}return!1},zi.prototype.checkCollapse=function(n,i,s){if(n.equals(s))throw new ie("found non-noded collapse at "+zi.fact.createLineString([n,i,s]))},zi.prototype.interfaces_=function(){return[]},zi.prototype.getClass=function(){return zi},fy.fact.get=function(){return new pe},Object.defineProperties(zi,fy);var Dr=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 n=arguments[0],i=arguments[1],s=arguments[2];if(this._originalPt=n,this._pt=n,this._scaleFactor=i,this._li=s,i<=0)throw new A("Scale factor must be non-zero");i!==1&&(this._pt=new I(this.scale(n.x),this.scale(n.y)),this._p0Scaled=new I,this._p1Scaled=new I),this.initCorners(this._pt)},hy={SAFE_ENV_EXPANSION_FACTOR:{configurable:!0}};Dr.prototype.intersectsScaled=function(n,i){var s=Math.min(n.x,i.x),u=Math.max(n.x,i.x),c=Math.min(n.y,i.y),m=Math.max(n.y,i.y),E=this._maxx<s||this._minx>u||this._maxy<c||this._miny>m;if(E)return!1;var C=this.intersectsToleranceSquare(n,i);return Lt.isTrue(!(E&&C),"Found bad envelope test"),C},Dr.prototype.initCorners=function(n){this._minx=n.x-.5,this._maxx=n.x+.5,this._miny=n.y-.5,this._maxy=n.y+.5,this._corner[0]=new I(this._maxx,this._maxy),this._corner[1]=new I(this._minx,this._maxy),this._corner[2]=new I(this._minx,this._miny),this._corner[3]=new I(this._maxx,this._miny)},Dr.prototype.intersects=function(n,i){return this._scaleFactor===1?this.intersectsScaled(n,i):(this.copyScaled(n,this._p0Scaled),this.copyScaled(i,this._p1Scaled),this.intersectsScaled(this._p0Scaled,this._p1Scaled))},Dr.prototype.scale=function(n){return Math.round(n*this._scaleFactor)},Dr.prototype.getCoordinate=function(){return this._originalPt},Dr.prototype.copyScaled=function(n,i){i.x=this.scale(n.x),i.y=this.scale(n.y)},Dr.prototype.getSafeEnvelope=function(){if(this._safeEnv===null){var n=Dr.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new At(this._originalPt.x-n,this._originalPt.x+n,this._originalPt.y-n,this._originalPt.y+n)}return this._safeEnv},Dr.prototype.intersectsPixelClosure=function(n,i){return this._li.computeIntersection(n,i,this._corner[0],this._corner[1]),!!this._li.hasIntersection()||(this._li.computeIntersection(n,i,this._corner[1],this._corner[2]),!!this._li.hasIntersection()||(this._li.computeIntersection(n,i,this._corner[2],this._corner[3]),!!this._li.hasIntersection()||(this._li.computeIntersection(n,i,this._corner[3],this._corner[0]),!!this._li.hasIntersection())))},Dr.prototype.intersectsToleranceSquare=function(n,i){var s=!1,u=!1;return this._li.computeIntersection(n,i,this._corner[0],this._corner[1]),!!this._li.isProper()||(this._li.computeIntersection(n,i,this._corner[1],this._corner[2]),!!this._li.isProper()||(this._li.hasIntersection()&&(s=!0),this._li.computeIntersection(n,i,this._corner[2],this._corner[3]),!!this._li.isProper()||(this._li.hasIntersection()&&(u=!0),this._li.computeIntersection(n,i,this._corner[3],this._corner[0]),!!this._li.isProper()||!(!s||!u)||!!n.equals(this._pt)||!!i.equals(this._pt))))},Dr.prototype.addSnappedNode=function(n,i){var s=n.getCoordinate(i),u=n.getCoordinate(i+1);return!!this.intersects(s,u)&&(n.addIntersection(this.getCoordinate(),i),!0)},Dr.prototype.interfaces_=function(){return[]},Dr.prototype.getClass=function(){return Dr},hy.SAFE_ENV_EXPANSION_FACTOR.get=function(){return .75},Object.defineProperties(Dr,hy);var al=function(){this.tempEnv1=new At,this.selectedSegment=new Qt};al.prototype.select=function(){if(arguments.length!==1){if(arguments.length===2){var n=arguments[0],i=arguments[1];n.getLineSegment(i,this.selectedSegment),this.select(this.selectedSegment)}}},al.prototype.interfaces_=function(){return[]},al.prototype.getClass=function(){return al};var za=function(){this._index=null;var n=arguments[0];this._index=n},py={HotPixelSnapAction:{configurable:!0}};za.prototype.snap=function(){if(arguments.length===1){var n=arguments[0];return this.snap(n,null,-1)}if(arguments.length===3){var i=arguments[0],s=arguments[1],u=arguments[2],c=i.getSafeEnvelope(),m=new dy(i,s,u);return this._index.query(c,{interfaces_:function(){return[Bo]},visitItem:function(E){E.select(c,m)}}),m.isNodeAdded()}},za.prototype.interfaces_=function(){return[]},za.prototype.getClass=function(){return za},py.HotPixelSnapAction.get=function(){return dy},Object.defineProperties(za,py);var dy=function(n){function i(){n.call(this),this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var s=arguments[0],u=arguments[1],c=arguments[2];this._hotPixel=s,this._parentEdge=u,this._hotPixelVertexIndex=c}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.isNodeAdded=function(){return this._isNodeAdded},i.prototype.select=function(){if(arguments.length!==2)return n.prototype.select.apply(this,arguments);var s=arguments[0],u=arguments[1],c=s.getContext();if(this._parentEdge!==null&&c===this._parentEdge&&u===this._hotPixelVertexIndex)return null;this._isNodeAdded=this._hotPixel.addSnappedNode(c,u)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(al),js=function(){this._li=null,this._interiorIntersections=null;var n=arguments[0];this._li=n,this._interiorIntersections=new O};js.prototype.processIntersections=function(n,i,s,u){if(n===s&&i===u)return null;var c=n.getCoordinates()[i],m=n.getCoordinates()[i+1],E=s.getCoordinates()[u],C=s.getCoordinates()[u+1];if(this._li.computeIntersection(c,m,E,C),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var U=0;U<this._li.getIntersectionNum();U++)this._interiorIntersections.add(this._li.getIntersection(U));n.addIntersections(this._li,i,0),s.addIntersections(this._li,u,1)}},js.prototype.isDone=function(){return!1},js.prototype.getInteriorIntersections=function(){return this._interiorIntersections},js.prototype.interfaces_=function(){return[hs]},js.prototype.getClass=function(){return js};var Ki=function(){this._pm=null,this._li=null,this._scaleFactor=null,this._noder=null,this._pointSnapper=null,this._nodedSegStrings=null;var n=arguments[0];this._pm=n,this._li=new N,this._li.setPrecisionModel(n),this._scaleFactor=n.getScale()};Ki.prototype.checkCorrectness=function(n){var i=Dn.getNodedSubstrings(n),s=new zi(i);try{s.checkValid()}catch(u){if(!(u instanceof Bt))throw u;u.printStackTrace()}},Ki.prototype.getNodedSubstrings=function(){return Dn.getNodedSubstrings(this._nodedSegStrings)},Ki.prototype.snapRound=function(n,i){var s=this.findInteriorIntersections(n,i);this.computeIntersectionSnaps(s),this.computeVertexSnaps(n)},Ki.prototype.findInteriorIntersections=function(n,i){var s=new js(i);return this._noder.setSegmentIntersector(s),this._noder.computeNodes(n),s.getInteriorIntersections()},Ki.prototype.computeVertexSnaps=function(){if(X(arguments[0],j))for(var n=arguments[0].iterator();n.hasNext();){var i=n.next();this.computeVertexSnaps(i)}else if(arguments[0]instanceof Dn)for(var s=arguments[0],u=s.getCoordinates(),c=0;c<u.length;c++){var m=new Dr(u[c],this._scaleFactor,this._li);this._pointSnapper.snap(m,s,c)&&s.addIntersection(u[c],c)}},Ki.prototype.computeNodes=function(n){this._nodedSegStrings=n,this._noder=new ip,this._pointSnapper=new za(this._noder.getIndex()),this.snapRound(n,this._li)},Ki.prototype.computeIntersectionSnaps=function(n){for(var i=n.iterator();i.hasNext();){var s=i.next(),u=new Dr(s,this._scaleFactor,this._li);this._pointSnapper.snap(u)}},Ki.prototype.interfaces_=function(){return[cs]},Ki.prototype.getClass=function(){return Ki};var tr=function(){if(this._argGeom=null,this._distance=null,this._bufParams=new Ze,this._resultGeometry=null,this._saveException=null,arguments.length===1){var n=arguments[0];this._argGeom=n}else if(arguments.length===2){var i=arguments[0],s=arguments[1];this._argGeom=i,this._bufParams=s}},Ga={CAP_ROUND:{configurable:!0},CAP_BUTT:{configurable:!0},CAP_FLAT:{configurable:!0},CAP_SQUARE:{configurable:!0},MAX_PRECISION_DIGITS:{configurable:!0}};tr.prototype.bufferFixedPrecision=function(n){var i=new ko(new Ki(new ge(1)),n.getScale()),s=new Er(this._bufParams);s.setWorkingPrecisionModel(n),s.setNoder(i),this._resultGeometry=s.buffer(this._argGeom,this._distance)},tr.prototype.bufferReducedPrecision=function(){var n=this;if(arguments.length===0){for(var i=tr.MAX_PRECISION_DIGITS;i>=0;i--){try{n.bufferReducedPrecision(i)}catch(m){if(!(m instanceof xo))throw m;n._saveException=m}if(n._resultGeometry!==null)return null}throw this._saveException}if(arguments.length===1){var s=arguments[0],u=tr.precisionScaleFactor(this._argGeom,this._distance,s),c=new ge(u);this.bufferFixedPrecision(c)}},tr.prototype.computeGeometry=function(){if(this.bufferOriginalPrecision(),this._resultGeometry!==null)return null;var n=this._argGeom.getFactory().getPrecisionModel();n.getType()===ge.FIXED?this.bufferFixedPrecision(n):this.bufferReducedPrecision()},tr.prototype.setQuadrantSegments=function(n){this._bufParams.setQuadrantSegments(n)},tr.prototype.bufferOriginalPrecision=function(){try{var n=new Er(this._bufParams);this._resultGeometry=n.buffer(this._argGeom,this._distance)}catch(i){if(!(i instanceof ie))throw i;this._saveException=i}},tr.prototype.getResultGeometry=function(n){return this._distance=n,this.computeGeometry(),this._resultGeometry},tr.prototype.setEndCapStyle=function(n){this._bufParams.setEndCapStyle(n)},tr.prototype.interfaces_=function(){return[]},tr.prototype.getClass=function(){return tr},tr.bufferOp=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];return new tr(n).getResultGeometry(i)}if(arguments.length===3){if(Number.isInteger(arguments[2])&&arguments[0]instanceof Ct&&typeof arguments[1]=="number"){var s=arguments[0],u=arguments[1],c=arguments[2],m=new tr(s);return m.setQuadrantSegments(c),m.getResultGeometry(u)}if(arguments[2]instanceof Ze&&arguments[0]instanceof Ct&&typeof arguments[1]=="number"){var E=arguments[0],C=arguments[1],U=arguments[2];return new tr(E,U).getResultGeometry(C)}}else if(arguments.length===4){var Z=arguments[0],pt=arguments[1],gt=arguments[2],Rt=arguments[3],Ft=new tr(Z);return Ft.setQuadrantSegments(gt),Ft.setEndCapStyle(Rt),Ft.getResultGeometry(pt)}},tr.precisionScaleFactor=function(n,i,s){var u=n.getEnvelopeInternal(),c=mt.max(Math.abs(u.getMaxX()),Math.abs(u.getMaxY()),Math.abs(u.getMinX()),Math.abs(u.getMinY()))+2*(i>0?i:0),m=s-Math.trunc(Math.log(c)/Math.log(10)+1);return Math.pow(10,m)},Ga.CAP_ROUND.get=function(){return Ze.CAP_ROUND},Ga.CAP_BUTT.get=function(){return Ze.CAP_FLAT},Ga.CAP_FLAT.get=function(){return Ze.CAP_FLAT},Ga.CAP_SQUARE.get=function(){return Ze.CAP_SQUARE},Ga.MAX_PRECISION_DIGITS.get=function(){return 12},Object.defineProperties(tr,Ga);var Mr=function(){this._pt=[new I,new I],this._distance=S.NaN,this._isNull=!0};Mr.prototype.getCoordinates=function(){return this._pt},Mr.prototype.getCoordinate=function(n){return this._pt[n]},Mr.prototype.setMinimum=function(){if(arguments.length===1){var n=arguments[0];this.setMinimum(n._pt[0],n._pt[1])}else if(arguments.length===2){var i=arguments[0],s=arguments[1];if(this._isNull)return this.initialize(i,s),null;var u=i.distance(s);u<this._distance&&this.initialize(i,s,u)}},Mr.prototype.initialize=function(){if(arguments.length===0)this._isNull=!0;else if(arguments.length===2){var n=arguments[0],i=arguments[1];this._pt[0].setCoordinate(n),this._pt[1].setCoordinate(i),this._distance=n.distance(i),this._isNull=!1}else if(arguments.length===3){var s=arguments[0],u=arguments[1],c=arguments[2];this._pt[0].setCoordinate(s),this._pt[1].setCoordinate(u),this._distance=c,this._isNull=!1}},Mr.prototype.getDistance=function(){return this._distance},Mr.prototype.setMaximum=function(){if(arguments.length===1){var n=arguments[0];this.setMaximum(n._pt[0],n._pt[1])}else if(arguments.length===2){var i=arguments[0],s=arguments[1];if(this._isNull)return this.initialize(i,s),null;var u=i.distance(s);u>this._distance&&this.initialize(i,s,u)}},Mr.prototype.interfaces_=function(){return[]},Mr.prototype.getClass=function(){return Mr};var ji=function(){};ji.prototype.interfaces_=function(){return[]},ji.prototype.getClass=function(){return ji},ji.computeDistance=function(){if(arguments[2]instanceof Mr&&arguments[0]instanceof at&&arguments[1]instanceof I)for(var n=arguments[0],i=arguments[1],s=arguments[2],u=n.getCoordinates(),c=new Qt,m=0;m<u.length-1;m++){c.setCoordinates(u[m],u[m+1]);var E=c.closestPoint(i);s.setMinimum(E,i)}else if(arguments[2]instanceof Mr&&arguments[0]instanceof Zt&&arguments[1]instanceof I){var C=arguments[0],U=arguments[1],Z=arguments[2];ji.computeDistance(C.getExteriorRing(),U,Z);for(var pt=0;pt<C.getNumInteriorRing();pt++)ji.computeDistance(C.getInteriorRingN(pt),U,Z)}else if(arguments[2]instanceof Mr&&arguments[0]instanceof Ct&&arguments[1]instanceof I){var gt=arguments[0],Rt=arguments[1],Ft=arguments[2];if(gt instanceof at)ji.computeDistance(gt,Rt,Ft);else if(gt instanceof Zt)ji.computeDistance(gt,Rt,Ft);else if(gt instanceof En)for(var Vt=gt,ee=0;ee<Vt.getNumGeometries();ee++){var hn=Vt.getGeometryN(ee);ji.computeDistance(hn,Rt,Ft)}else Ft.setMinimum(gt.getCoordinate(),Rt)}else if(arguments[2]instanceof Mr&&arguments[0]instanceof Qt&&arguments[1]instanceof I){var qn=arguments[0],Tr=arguments[1],no=arguments[2],$o=qn.closestPoint(Tr);no.setMinimum($o,Tr)}};var ds=function(n){this._maxPtDist=new Mr,this._inputGeom=n||null},op={MaxPointDistanceFilter:{configurable:!0},MaxMidpointDistanceFilter:{configurable:!0}};ds.prototype.computeMaxMidpointDistance=function(n){var i=new qo(this._inputGeom);n.apply(i),this._maxPtDist.setMaximum(i.getMaxPointDistance())},ds.prototype.computeMaxVertexDistance=function(n){var i=new Qs(this._inputGeom);n.apply(i),this._maxPtDist.setMaximum(i.getMaxPointDistance())},ds.prototype.findDistance=function(n){return this.computeMaxVertexDistance(n),this.computeMaxMidpointDistance(n),this._maxPtDist.getDistance()},ds.prototype.getDistancePoints=function(){return this._maxPtDist},ds.prototype.interfaces_=function(){return[]},ds.prototype.getClass=function(){return ds},op.MaxPointDistanceFilter.get=function(){return Qs},op.MaxMidpointDistanceFilter.get=function(){return qo},Object.defineProperties(ds,op);var Qs=function(n){this._maxPtDist=new Mr,this._minPtDist=new Mr,this._geom=n||null};Qs.prototype.filter=function(n){this._minPtDist.initialize(),ji.computeDistance(this._geom,n,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},Qs.prototype.getMaxPointDistance=function(){return this._maxPtDist},Qs.prototype.interfaces_=function(){return[J]},Qs.prototype.getClass=function(){return Qs};var qo=function(n){this._maxPtDist=new Mr,this._minPtDist=new Mr,this._geom=n||null};qo.prototype.filter=function(n,i){if(i===0)return null;var s=n.getCoordinate(i-1),u=n.getCoordinate(i),c=new I((s.x+u.x)/2,(s.y+u.y)/2);this._minPtDist.initialize(),ji.computeDistance(this._geom,c,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},qo.prototype.isDone=function(){return!1},qo.prototype.isGeometryChanged=function(){return!1},qo.prototype.getMaxPointDistance=function(){return this._maxPtDist},qo.prototype.interfaces_=function(){return[Tn]},qo.prototype.getClass=function(){return qo};var wo=function(n){this._comps=n||null};wo.prototype.filter=function(n){n instanceof Zt&&this._comps.add(n)},wo.prototype.interfaces_=function(){return[In]},wo.prototype.getClass=function(){return wo},wo.getPolygons=function(){if(arguments.length===1){var n=arguments[0];return wo.getPolygons(n,new O)}if(arguments.length===2){var i=arguments[0],s=arguments[1];return i instanceof Zt?s.add(i):i instanceof En&&i.apply(new wo(s)),s}};var er=function(){if(this._lines=null,this._isForcedToLineString=!1,arguments.length===1){var n=arguments[0];this._lines=n}else if(arguments.length===2){var i=arguments[0],s=arguments[1];this._lines=i,this._isForcedToLineString=s}};er.prototype.filter=function(n){if(this._isForcedToLineString&&n instanceof oe){var i=n.getFactory().createLineString(n.getCoordinateSequence());return this._lines.add(i),null}n instanceof at&&this._lines.add(n)},er.prototype.setForceToLineString=function(n){this._isForcedToLineString=n},er.prototype.interfaces_=function(){return[ue]},er.prototype.getClass=function(){return er},er.getGeometry=function(){if(arguments.length===1){var n=arguments[0];return n.getFactory().buildGeometry(er.getLines(n))}if(arguments.length===2){var i=arguments[0],s=arguments[1];return i.getFactory().buildGeometry(er.getLines(i,s))}},er.getLines=function(){if(arguments.length===1){var n=arguments[0];return er.getLines(n,!1)}if(arguments.length===2){if(X(arguments[0],j)&&X(arguments[1],j)){for(var i=arguments[0],s=arguments[1],u=i.iterator();u.hasNext();){var c=u.next();er.getLines(c,s)}return s}if(arguments[0]instanceof Ct&&typeof arguments[1]=="boolean"){var m=arguments[0],E=arguments[1],C=new O;return m.apply(new er(C,E)),C}if(arguments[0]instanceof Ct&&X(arguments[1],j)){var U=arguments[0],Z=arguments[1];return U instanceof at?Z.add(U):U.apply(new er(Z)),Z}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&X(arguments[0],j)&&X(arguments[1],j)){for(var pt=arguments[0],gt=arguments[1],Rt=arguments[2],Ft=pt.iterator();Ft.hasNext();){var Vt=Ft.next();er.getLines(Vt,gt,Rt)}return gt}if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Ct&&X(arguments[1],j)){var ee=arguments[0],hn=arguments[1],qn=arguments[2];return ee.apply(new er(hn,qn)),hn}}};var Ci=function(){if(this._boundaryRule=w.OGC_SFS_BOUNDARY_RULE,this._isIn=null,this._numBoundaries=null,arguments.length!==0){if(arguments.length===1){var n=arguments[0];if(n===null)throw new A("Rule must be non-null");this._boundaryRule=n}}};Ci.prototype.locateInternal=function(){if(arguments[0]instanceof I&&arguments[1]instanceof Zt){var n=arguments[0],i=arguments[1];if(i.isEmpty())return V.EXTERIOR;var s=i.getExteriorRing(),u=this.locateInPolygonRing(n,s);if(u===V.EXTERIOR)return V.EXTERIOR;if(u===V.BOUNDARY)return V.BOUNDARY;for(var c=0;c<i.getNumInteriorRing();c++){var m=i.getInteriorRingN(c),E=this.locateInPolygonRing(n,m);if(E===V.INTERIOR)return V.EXTERIOR;if(E===V.BOUNDARY)return V.BOUNDARY}return V.INTERIOR}if(arguments[0]instanceof I&&arguments[1]instanceof at){var C=arguments[0],U=arguments[1];if(!U.getEnvelopeInternal().intersects(C))return V.EXTERIOR;var Z=U.getCoordinates();return U.isClosed()||!C.equals(Z[0])&&!C.equals(Z[Z.length-1])?ot.isOnLine(C,Z)?V.INTERIOR:V.EXTERIOR:V.BOUNDARY}if(arguments[0]instanceof I&&arguments[1]instanceof Xt){var pt=arguments[0];return arguments[1].getCoordinate().equals2D(pt)?V.INTERIOR:V.EXTERIOR}},Ci.prototype.locateInPolygonRing=function(n,i){return i.getEnvelopeInternal().intersects(n)?ot.locatePointInRing(n,i.getCoordinates()):V.EXTERIOR},Ci.prototype.intersects=function(n,i){return this.locate(n,i)!==V.EXTERIOR},Ci.prototype.updateLocationInfo=function(n){n===V.INTERIOR&&(this._isIn=!0),n===V.BOUNDARY&&this._numBoundaries++},Ci.prototype.computeLocation=function(n,i){if(i instanceof Xt&&this.updateLocationInfo(this.locateInternal(n,i)),i instanceof at)this.updateLocationInfo(this.locateInternal(n,i));else if(i instanceof Zt)this.updateLocationInfo(this.locateInternal(n,i));else if(i instanceof Hr)for(var s=i,u=0;u<s.getNumGeometries();u++){var c=s.getGeometryN(u);this.updateLocationInfo(this.locateInternal(n,c))}else if(i instanceof ae)for(var m=i,E=0;E<m.getNumGeometries();E++){var C=m.getGeometryN(E);this.updateLocationInfo(this.locateInternal(n,C))}else if(i instanceof En)for(var U=new Zi(i);U.hasNext();){var Z=U.next();Z!==i&&this.computeLocation(n,Z)}},Ci.prototype.locate=function(n,i){return i.isEmpty()?V.EXTERIOR:i instanceof at?this.locateInternal(n,i):i instanceof Zt?this.locateInternal(n,i):(this._isIn=!1,this._numBoundaries=0,this.computeLocation(n,i),this._boundaryRule.isInBoundary(this._numBoundaries)?V.BOUNDARY:this._numBoundaries>0||this._isIn?V.INTERIOR:V.EXTERIOR)},Ci.prototype.interfaces_=function(){return[]},Ci.prototype.getClass=function(){return Ci};var Sr=function n(){if(this._component=null,this._segIndex=null,this._pt=null,arguments.length===2){var i=arguments[0],s=arguments[1];n.call(this,i,n.INSIDE_AREA,s)}else if(arguments.length===3){var u=arguments[0],c=arguments[1],m=arguments[2];this._component=u,this._segIndex=c,this._pt=m}},my={INSIDE_AREA:{configurable:!0}};Sr.prototype.isInsideArea=function(){return this._segIndex===Sr.INSIDE_AREA},Sr.prototype.getCoordinate=function(){return this._pt},Sr.prototype.getGeometryComponent=function(){return this._component},Sr.prototype.getSegmentIndex=function(){return this._segIndex},Sr.prototype.interfaces_=function(){return[]},Sr.prototype.getClass=function(){return Sr},my.INSIDE_AREA.get=function(){return-1},Object.defineProperties(Sr,my);var Vo=function(n){this._pts=n||null};Vo.prototype.filter=function(n){n instanceof Xt&&this._pts.add(n)},Vo.prototype.interfaces_=function(){return[In]},Vo.prototype.getClass=function(){return Vo},Vo.getPoints=function(){if(arguments.length===1){var n=arguments[0];return n instanceof Xt?Ti.singletonList(n):Vo.getPoints(n,new O)}if(arguments.length===2){var i=arguments[0],s=arguments[1];return i instanceof Xt?s.add(i):i instanceof En&&i.apply(new Vo(s)),s}};var ta=function(){this._locations=null;var n=arguments[0];this._locations=n};ta.prototype.filter=function(n){(n instanceof Xt||n instanceof at||n instanceof Zt)&&this._locations.add(new Sr(n,0,n.getCoordinate()))},ta.prototype.interfaces_=function(){return[In]},ta.prototype.getClass=function(){return ta},ta.getLocations=function(n){var i=new O;return n.apply(new ta(i)),i};var nr=function(){if(this._geom=null,this._terminateDistance=0,this._ptLocator=new Ci,this._minDistanceLocation=null,this._minDistance=S.MAX_VALUE,arguments.length===2){var n=arguments[0],i=arguments[1];this._geom=[n,i],this._terminateDistance=0}else if(arguments.length===3){var s=arguments[0],u=arguments[1],c=arguments[2];this._geom=new Array(2).fill(null),this._geom[0]=s,this._geom[1]=u,this._terminateDistance=c}};nr.prototype.computeContainmentDistance=function(){if(arguments.length===0){var n=new Array(2).fill(null);if(this.computeContainmentDistance(0,n),this._minDistance<=this._terminateDistance)return null;this.computeContainmentDistance(1,n)}else if(arguments.length===2){var i=arguments[0],s=arguments[1],u=1-i,c=wo.getPolygons(this._geom[i]);if(c.size()>0){var m=ta.getLocations(this._geom[u]);if(this.computeContainmentDistance(m,c,s),this._minDistance<=this._terminateDistance)return this._minDistanceLocation[u]=s[0],this._minDistanceLocation[i]=s[1],null}}else if(arguments.length===3){if(arguments[2]instanceof Array&&X(arguments[0],ct)&&X(arguments[1],ct)){for(var E=arguments[0],C=arguments[1],U=arguments[2],Z=0;Z<E.size();Z++)for(var pt=E.get(Z),gt=0;gt<C.size();gt++)if(this.computeContainmentDistance(pt,C.get(gt),U),this._minDistance<=this._terminateDistance)return null}else if(arguments[2]instanceof Array&&arguments[0]instanceof Sr&&arguments[1]instanceof Zt){var Rt=arguments[0],Ft=arguments[1],Vt=arguments[2],ee=Rt.getCoordinate();if(V.EXTERIOR!==this._ptLocator.locate(ee,Ft))return this._minDistance=0,Vt[0]=Rt,Vt[1]=new Sr(Ft,ee),null}}},nr.prototype.computeMinDistanceLinesPoints=function(n,i,s){for(var u=0;u<n.size();u++)for(var c=n.get(u),m=0;m<i.size();m++){var E=i.get(m);if(this.computeMinDistance(c,E,s),this._minDistance<=this._terminateDistance)return null}},nr.prototype.computeFacetDistance=function(){var n=new Array(2).fill(null),i=er.getLines(this._geom[0]),s=er.getLines(this._geom[1]),u=Vo.getPoints(this._geom[0]),c=Vo.getPoints(this._geom[1]);return this.computeMinDistanceLines(i,s,n),this.updateMinDistance(n,!1),this._minDistance<=this._terminateDistance?null:(n[0]=null,n[1]=null,this.computeMinDistanceLinesPoints(i,c,n),this.updateMinDistance(n,!1),this._minDistance<=this._terminateDistance?null:(n[0]=null,n[1]=null,this.computeMinDistanceLinesPoints(s,u,n),this.updateMinDistance(n,!0),this._minDistance<=this._terminateDistance?null:(n[0]=null,n[1]=null,this.computeMinDistancePoints(u,c,n),void this.updateMinDistance(n,!1))))},nr.prototype.nearestLocations=function(){return this.computeMinDistance(),this._minDistanceLocation},nr.prototype.updateMinDistance=function(n,i){if(n[0]===null)return null;i?(this._minDistanceLocation[0]=n[1],this._minDistanceLocation[1]=n[0]):(this._minDistanceLocation[0]=n[0],this._minDistanceLocation[1]=n[1])},nr.prototype.nearestPoints=function(){return this.computeMinDistance(),[this._minDistanceLocation[0].getCoordinate(),this._minDistanceLocation[1].getCoordinate()]},nr.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 at&&arguments[1]instanceof Xt){var n=arguments[0],i=arguments[1],s=arguments[2];if(n.getEnvelopeInternal().distance(i.getEnvelopeInternal())>this._minDistance)return null;for(var u=n.getCoordinates(),c=i.getCoordinate(),m=0;m<u.length-1;m++){var E=ot.distancePointLine(c,u[m],u[m+1]);if(E<this._minDistance){this._minDistance=E;var C=new Qt(u[m],u[m+1]).closestPoint(c);s[0]=new Sr(n,m,C),s[1]=new Sr(i,0,c)}if(this._minDistance<=this._terminateDistance)return null}}else if(arguments[2]instanceof Array&&arguments[0]instanceof at&&arguments[1]instanceof at){var U=arguments[0],Z=arguments[1],pt=arguments[2];if(U.getEnvelopeInternal().distance(Z.getEnvelopeInternal())>this._minDistance)return null;for(var gt=U.getCoordinates(),Rt=Z.getCoordinates(),Ft=0;Ft<gt.length-1;Ft++)for(var Vt=0;Vt<Rt.length-1;Vt++){var ee=ot.distanceLineLine(gt[Ft],gt[Ft+1],Rt[Vt],Rt[Vt+1]);if(ee<this._minDistance){this._minDistance=ee;var hn=new Qt(gt[Ft],gt[Ft+1]),qn=new Qt(Rt[Vt],Rt[Vt+1]),Tr=hn.closestPoints(qn);pt[0]=new Sr(U,Ft,Tr[0]),pt[1]=new Sr(Z,Vt,Tr[1])}if(this._minDistance<=this._terminateDistance)return null}}}},nr.prototype.computeMinDistancePoints=function(n,i,s){for(var u=0;u<n.size();u++)for(var c=n.get(u),m=0;m<i.size();m++){var E=i.get(m),C=c.getCoordinate().distance(E.getCoordinate());if(C<this._minDistance&&(this._minDistance=C,s[0]=new Sr(c,0,c.getCoordinate()),s[1]=new Sr(E,0,E.getCoordinate())),this._minDistance<=this._terminateDistance)return null}},nr.prototype.distance=function(){if(this._geom[0]===null||this._geom[1]===null)throw new A("null geometries are not supported");return this._geom[0].isEmpty()||this._geom[1].isEmpty()?0:(this.computeMinDistance(),this._minDistance)},nr.prototype.computeMinDistanceLines=function(n,i,s){for(var u=0;u<n.size();u++)for(var c=n.get(u),m=0;m<i.size();m++){var E=i.get(m);if(this.computeMinDistance(c,E,s),this._minDistance<=this._terminateDistance)return null}},nr.prototype.interfaces_=function(){return[]},nr.prototype.getClass=function(){return nr},nr.distance=function(n,i){return new nr(n,i).distance()},nr.isWithinDistance=function(n,i,s){return new nr(n,i,s).distance()<=s},nr.nearestPoints=function(n,i){return new nr(n,i).nearestPoints()};var lr=function(){this._pt=[new I,new I],this._distance=S.NaN,this._isNull=!0};lr.prototype.getCoordinates=function(){return this._pt},lr.prototype.getCoordinate=function(n){return this._pt[n]},lr.prototype.setMinimum=function(){if(arguments.length===1){var n=arguments[0];this.setMinimum(n._pt[0],n._pt[1])}else if(arguments.length===2){var i=arguments[0],s=arguments[1];if(this._isNull)return this.initialize(i,s),null;var u=i.distance(s);u<this._distance&&this.initialize(i,s,u)}},lr.prototype.initialize=function(){if(arguments.length===0)this._isNull=!0;else if(arguments.length===2){var n=arguments[0],i=arguments[1];this._pt[0].setCoordinate(n),this._pt[1].setCoordinate(i),this._distance=n.distance(i),this._isNull=!1}else if(arguments.length===3){var s=arguments[0],u=arguments[1],c=arguments[2];this._pt[0].setCoordinate(s),this._pt[1].setCoordinate(u),this._distance=c,this._isNull=!1}},lr.prototype.toString=function(){return Wt.toLineString(this._pt[0],this._pt[1])},lr.prototype.getDistance=function(){return this._distance},lr.prototype.setMaximum=function(){if(arguments.length===1){var n=arguments[0];this.setMaximum(n._pt[0],n._pt[1])}else if(arguments.length===2){var i=arguments[0],s=arguments[1];if(this._isNull)return this.initialize(i,s),null;var u=i.distance(s);u>this._distance&&this.initialize(i,s,u)}},lr.prototype.interfaces_=function(){return[]},lr.prototype.getClass=function(){return lr};var Gi=function(){};Gi.prototype.interfaces_=function(){return[]},Gi.prototype.getClass=function(){return Gi},Gi.computeDistance=function(){if(arguments[2]instanceof lr&&arguments[0]instanceof at&&arguments[1]instanceof I)for(var n=arguments[0],i=arguments[1],s=arguments[2],u=new Qt,c=n.getCoordinates(),m=0;m<c.length-1;m++){u.setCoordinates(c[m],c[m+1]);var E=u.closestPoint(i);s.setMinimum(E,i)}else if(arguments[2]instanceof lr&&arguments[0]instanceof Zt&&arguments[1]instanceof I){var C=arguments[0],U=arguments[1],Z=arguments[2];Gi.computeDistance(C.getExteriorRing(),U,Z);for(var pt=0;pt<C.getNumInteriorRing();pt++)Gi.computeDistance(C.getInteriorRingN(pt),U,Z)}else if(arguments[2]instanceof lr&&arguments[0]instanceof Ct&&arguments[1]instanceof I){var gt=arguments[0],Rt=arguments[1],Ft=arguments[2];if(gt instanceof at)Gi.computeDistance(gt,Rt,Ft);else if(gt instanceof Zt)Gi.computeDistance(gt,Rt,Ft);else if(gt instanceof En)for(var Vt=gt,ee=0;ee<Vt.getNumGeometries();ee++){var hn=Vt.getGeometryN(ee);Gi.computeDistance(hn,Rt,Ft)}else Ft.setMinimum(gt.getCoordinate(),Rt)}else if(arguments[2]instanceof lr&&arguments[0]instanceof Qt&&arguments[1]instanceof I){var qn=arguments[0],Tr=arguments[1],no=arguments[2],$o=qn.closestPoint(Tr);no.setMinimum($o,Tr)}};var vi=function(){this._g0=null,this._g1=null,this._ptDist=new lr,this._densifyFrac=0;var n=arguments[0],i=arguments[1];this._g0=n,this._g1=i},sp={MaxPointDistanceFilter:{configurable:!0},MaxDensifiedByFractionDistanceFilter:{configurable:!0}};vi.prototype.getCoordinates=function(){return this._ptDist.getCoordinates()},vi.prototype.setDensifyFraction=function(n){if(n>1||n<=0)throw new A("Fraction is not in range (0.0 - 1.0]");this._densifyFrac=n},vi.prototype.compute=function(n,i){this.computeOrientedDistance(n,i,this._ptDist),this.computeOrientedDistance(i,n,this._ptDist)},vi.prototype.distance=function(){return this.compute(this._g0,this._g1),this._ptDist.getDistance()},vi.prototype.computeOrientedDistance=function(n,i,s){var u=new ea(i);if(n.apply(u),s.setMaximum(u.getMaxPointDistance()),this._densifyFrac>0){var c=new Ho(i,this._densifyFrac);n.apply(c),s.setMaximum(c.getMaxPointDistance())}},vi.prototype.orientedDistance=function(){return this.computeOrientedDistance(this._g0,this._g1,this._ptDist),this._ptDist.getDistance()},vi.prototype.interfaces_=function(){return[]},vi.prototype.getClass=function(){return vi},vi.distance=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1];return new vi(n,i).distance()}if(arguments.length===3){var s=arguments[0],u=arguments[1],c=arguments[2],m=new vi(s,u);return m.setDensifyFraction(c),m.distance()}},sp.MaxPointDistanceFilter.get=function(){return ea},sp.MaxDensifiedByFractionDistanceFilter.get=function(){return Ho},Object.defineProperties(vi,sp);var ea=function(){this._maxPtDist=new lr,this._minPtDist=new lr,this._euclideanDist=new Gi,this._geom=null;var n=arguments[0];this._geom=n};ea.prototype.filter=function(n){this._minPtDist.initialize(),Gi.computeDistance(this._geom,n,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)},ea.prototype.getMaxPointDistance=function(){return this._maxPtDist},ea.prototype.interfaces_=function(){return[J]},ea.prototype.getClass=function(){return ea};var Ho=function(){this._maxPtDist=new lr,this._minPtDist=new lr,this._geom=null,this._numSubSegs=0;var n=arguments[0],i=arguments[1];this._geom=n,this._numSubSegs=Math.trunc(Math.round(1/i))};Ho.prototype.filter=function(n,i){if(i===0)return null;for(var s=n.getCoordinate(i-1),u=n.getCoordinate(i),c=(u.x-s.x)/this._numSubSegs,m=(u.y-s.y)/this._numSubSegs,E=0;E<this._numSubSegs;E++){var C=s.x+E*c,U=s.y+E*m,Z=new I(C,U);this._minPtDist.initialize(),Gi.computeDistance(this._geom,Z,this._minPtDist),this._maxPtDist.setMaximum(this._minPtDist)}},Ho.prototype.isDone=function(){return!1},Ho.prototype.isGeometryChanged=function(){return!1},Ho.prototype.getMaxPointDistance=function(){return this._maxPtDist},Ho.prototype.interfaces_=function(){return[Tn]},Ho.prototype.getClass=function(){return Ho};var Yr=function(n,i,s){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=n||null,this._bufDistance=i||null,this._result=s||null},ap={VERBOSE:{configurable:!0},MAX_DISTANCE_DIFF_FRAC:{configurable:!0}};Yr.prototype.checkMaximumDistance=function(n,i,s){var u=new vi(i,n);if(u.setDensifyFraction(.25),this._maxDistanceFound=u.orientedDistance(),this._maxDistanceFound>s){this._isValid=!1;var c=u.getCoordinates();this._errorLocation=c[1],this._errorIndicator=n.getFactory().createLineString(c),this._errMsg="Distance between buffer curve and input is too large ("+this._maxDistanceFound+" at "+Wt.toLineString(c[0],c[1])+")"}},Yr.prototype.isValid=function(){var n=Math.abs(this._bufDistance),i=Yr.MAX_DISTANCE_DIFF_FRAC*n;return this._minValidDistance=n-i,this._maxValidDistance=n+i,!(!this._input.isEmpty()&&!this._result.isEmpty())||(this._bufDistance>0?this.checkPositiveValid():this.checkNegativeValid(),Yr.VERBOSE&&Ut.out.println("Min Dist= "+this._minDistanceFound+" err= "+(1-this._minDistanceFound/this._bufDistance)+" Max Dist= "+this._maxDistanceFound+" err= "+(this._maxDistanceFound/this._bufDistance-1)),this._isValid)},Yr.prototype.checkNegativeValid=function(){if(!(this._input instanceof Zt||this._input instanceof ae||this._input instanceof En))return null;var n=this.getPolygonLines(this._input);if(this.checkMinimumDistance(n,this._result,this._minValidDistance),!this._isValid)return null;this.checkMaximumDistance(n,this._result,this._maxValidDistance)},Yr.prototype.getErrorIndicator=function(){return this._errorIndicator},Yr.prototype.checkMinimumDistance=function(n,i,s){var u=new nr(n,i,s);if(this._minDistanceFound=u.distance(),this._minDistanceFound<s){this._isValid=!1;var c=u.nearestPoints();this._errorLocation=u.nearestPoints()[1],this._errorIndicator=n.getFactory().createLineString(c),this._errMsg="Distance between buffer curve and input is too small ("+this._minDistanceFound+" at "+Wt.toLineString(c[0],c[1])+" )"}},Yr.prototype.checkPositiveValid=function(){var n=this._result.getBoundary();if(this.checkMinimumDistance(this._input,n,this._minValidDistance),!this._isValid)return null;this.checkMaximumDistance(this._input,n,this._maxValidDistance)},Yr.prototype.getErrorLocation=function(){return this._errorLocation},Yr.prototype.getPolygonLines=function(n){for(var i=new O,s=new er(i),u=wo.getPolygons(n).iterator();u.hasNext();)u.next().apply(s);return n.getFactory().buildGeometry(i)},Yr.prototype.getErrorMessage=function(){return this._errMsg},Yr.prototype.interfaces_=function(){return[]},Yr.prototype.getClass=function(){return Yr},ap.VERBOSE.get=function(){return!1},ap.MAX_DISTANCE_DIFF_FRAC.get=function(){return .012},Object.defineProperties(Yr,ap);var rr=function(n,i,s){this._isValid=!0,this._errorMsg=null,this._errorLocation=null,this._errorIndicator=null,this._input=n||null,this._distance=i||null,this._result=s||null},up={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 n=this._distance*rr.MAX_ENV_DIFF_FRAC;n===0&&(n=.001);var i=new At(this._input.getEnvelopeInternal());i.expandBy(this._distance);var s=new At(this._result.getEnvelopeInternal());s.expandBy(n),s.contains(i)||(this._isValid=!1,this._errorMsg="Buffer envelope is incorrect",this._errorIndicator=this._input.getFactory().toGeometry(s)),this.report("Envelope")},rr.prototype.checkDistance=function(){var n=new Yr(this._input,this._distance,this._result);n.isValid()||(this._isValid=!1,this._errorMsg=n.getErrorMessage(),this._errorLocation=n.getErrorLocation(),this._errorIndicator=n.getErrorIndicator()),this.report("Distance")},rr.prototype.checkArea=function(){var n=this._input.getArea(),i=this._result.getArea();this._distance>0&&n>i&&(this._isValid=!1,this._errorMsg="Area of positive buffer is smaller than input",this._errorIndicator=this._result),this._distance<0&&n<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 Zt||this._result instanceof ae||(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(n){if(!rr.VERBOSE)return null;Ut.out.println("Check "+n+": "+(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(n,i,s){var u=new rr(n,i,s);return u.isValid()?null:u.getErrorMessage()},rr.isValid=function(n,i,s){return!!new rr(n,i,s).isValid()},up.VERBOSE.get=function(){return!1},up.MAX_ENV_DIFF_FRAC.get=function(){return .012},Object.defineProperties(rr,up);var ki=function(){this._pts=null,this._data=null;var n=arguments[0],i=arguments[1];this._pts=n,this._data=i};ki.prototype.getCoordinates=function(){return this._pts},ki.prototype.size=function(){return this._pts.length},ki.prototype.getCoordinate=function(n){return this._pts[n]},ki.prototype.isClosed=function(){return this._pts[0].equals(this._pts[this._pts.length-1])},ki.prototype.getSegmentOctant=function(n){return n===this._pts.length-1?-1:Zs.octant(this.getCoordinate(n),this.getCoordinate(n+1))},ki.prototype.setData=function(n){this._data=n},ki.prototype.getData=function(){return this._data},ki.prototype.toString=function(){return Wt.toLineString(new jt(this._pts))},ki.prototype.interfaces_=function(){return[$i]},ki.prototype.getClass=function(){return ki};var Kn=function(){this._findAllIntersections=!1,this._isCheckEndSegmentsOnly=!1,this._li=null,this._interiorIntersection=null,this._intSegments=null,this._intersections=new O,this._intersectionCount=0,this._keepIntersections=!0;var n=arguments[0];this._li=n,this._interiorIntersection=null};Kn.prototype.getInteriorIntersection=function(){return this._interiorIntersection},Kn.prototype.setCheckEndSegmentsOnly=function(n){this._isCheckEndSegmentsOnly=n},Kn.prototype.getIntersectionSegments=function(){return this._intSegments},Kn.prototype.count=function(){return this._intersectionCount},Kn.prototype.getIntersections=function(){return this._intersections},Kn.prototype.setFindAllIntersections=function(n){this._findAllIntersections=n},Kn.prototype.setKeepIntersections=function(n){this._keepIntersections=n},Kn.prototype.processIntersections=function(n,i,s,u){if(!this._findAllIntersections&&this.hasIntersection()||n===s&&i===u||this._isCheckEndSegmentsOnly&&!(this.isEndSegment(n,i)||this.isEndSegment(s,u)))return null;var c=n.getCoordinates()[i],m=n.getCoordinates()[i+1],E=s.getCoordinates()[u],C=s.getCoordinates()[u+1];this._li.computeIntersection(c,m,E,C),this._li.hasIntersection()&&this._li.isInteriorIntersection()&&(this._intSegments=new Array(4).fill(null),this._intSegments[0]=c,this._intSegments[1]=m,this._intSegments[2]=E,this._intSegments[3]=C,this._interiorIntersection=this._li.getIntersection(0),this._keepIntersections&&this._intersections.add(this._interiorIntersection),this._intersectionCount++)},Kn.prototype.isEndSegment=function(n,i){return i===0||i>=n.size()-2},Kn.prototype.hasIntersection=function(){return this._interiorIntersection!==null},Kn.prototype.isDone=function(){return!this._findAllIntersections&&this._interiorIntersection!==null},Kn.prototype.interfaces_=function(){return[hs]},Kn.prototype.getClass=function(){return Kn},Kn.createAllIntersectionsFinder=function(n){var i=new Kn(n);return i.setFindAllIntersections(!0),i},Kn.createAnyIntersectionFinder=function(n){return new Kn(n)},Kn.createIntersectionCounter=function(n){var i=new Kn(n);return i.setFindAllIntersections(!0),i.setKeepIntersections(!1),i};var Pi=function(){this._li=new N,this._segStrings=null,this._findAllIntersections=!1,this._segInt=null,this._isValid=!0;var n=arguments[0];this._segStrings=n};Pi.prototype.execute=function(){if(this._segInt!==null)return null;this.checkInteriorIntersections()},Pi.prototype.getIntersections=function(){return this._segInt.getIntersections()},Pi.prototype.isValid=function(){return this.execute(),this._isValid},Pi.prototype.setFindAllIntersections=function(n){this._findAllIntersections=n},Pi.prototype.checkInteriorIntersections=function(){this._isValid=!0,this._segInt=new Kn(this._li),this._segInt.setFindAllIntersections(this._findAllIntersections);var n=new ip;if(n.setSegmentIntersector(this._segInt),n.computeNodes(this._segStrings),this._segInt.hasIntersection())return this._isValid=!1,null},Pi.prototype.checkValid=function(){if(this.execute(),!this._isValid)throw new xo(this.getErrorMessage(),this._segInt.getInteriorIntersection())},Pi.prototype.getErrorMessage=function(){if(this._isValid)return"no intersections found";var n=this._segInt.getIntersectionSegments();return"found non-noded intersection between "+Wt.toLineString(n[0],n[1])+" and "+Wt.toLineString(n[2],n[3])},Pi.prototype.interfaces_=function(){return[]},Pi.prototype.getClass=function(){return Pi},Pi.computeIntersections=function(n){var i=new Pi(n);return i.setFindAllIntersections(!0),i.isValid(),i.getIntersections()};var ms=function n(){this._nv=null;var i=arguments[0];this._nv=new Pi(n.toSegmentStrings(i))};ms.prototype.checkValid=function(){this._nv.checkValid()},ms.prototype.interfaces_=function(){return[]},ms.prototype.getClass=function(){return ms},ms.toSegmentStrings=function(n){for(var i=new O,s=n.iterator();s.hasNext();){var u=s.next();i.add(new ki(u.getCoordinates(),u))}return i},ms.checkValid=function(n){new ms(n).checkValid()};var na=function(n){this._mapOp=n};na.prototype.map=function(n){for(var i=new O,s=0;s<n.getNumGeometries();s++){var u=this._mapOp.map(n.getGeometryN(s));u.isEmpty()||i.add(u)}return n.getFactory().createGeometryCollection(pe.toGeometryArray(i))},na.prototype.interfaces_=function(){return[]},na.prototype.getClass=function(){return na},na.map=function(n,i){return new na(i).map(n)};var qi=function(){this._op=null,this._geometryFactory=null,this._ptLocator=null,this._lineEdgesList=new O,this._resultLineList=new O;var n=arguments[0],i=arguments[1],s=arguments[2];this._op=n,this._geometryFactory=i,this._ptLocator=s};qi.prototype.collectLines=function(n){for(var i=this._op.getGraph().getEdgeEnds().iterator();i.hasNext();){var s=i.next();this.collectLineEdge(s,n,this._lineEdgesList),this.collectBoundaryTouchEdge(s,n,this._lineEdgesList)}},qi.prototype.labelIsolatedLine=function(n,i){var s=this._ptLocator.locate(n.getCoordinate(),this._op.getArgGeometry(i));n.getLabel().setLocation(i,s)},qi.prototype.build=function(n){return this.findCoveredLineEdges(),this.collectLines(n),this.buildLines(n),this._resultLineList},qi.prototype.collectLineEdge=function(n,i,s){var u=n.getLabel(),c=n.getEdge();n.isLineEdge()&&(n.isVisited()||!fe.isResultOfOp(u,i)||c.isCovered()||(s.add(c),n.setVisitedEdge(!0)))},qi.prototype.findCoveredLineEdges=function(){for(var n=this._op.getGraph().getNodes().iterator();n.hasNext();)n.next().getEdges().findCoveredLineEdges();for(var i=this._op.getGraph().getEdgeEnds().iterator();i.hasNext();){var s=i.next(),u=s.getEdge();if(s.isLineEdge()&&!u.isCoveredSet()){var c=this._op.isCoveredByA(s.getCoordinate());u.setCovered(c)}}},qi.prototype.labelIsolatedLines=function(n){for(var i=n.iterator();i.hasNext();){var s=i.next(),u=s.getLabel();s.isIsolated()&&(u.isNull(0)?this.labelIsolatedLine(s,0):this.labelIsolatedLine(s,1))}},qi.prototype.buildLines=function(n){for(var i=this._lineEdgesList.iterator();i.hasNext();){var s=i.next(),u=this._geometryFactory.createLineString(s.getCoordinates());this._resultLineList.add(u),s.setInResult(!0)}},qi.prototype.collectBoundaryTouchEdge=function(n,i,s){var u=n.getLabel();return n.isLineEdge()||n.isVisited()||n.isInteriorAreaEdge()||n.getEdge().isInResult()?null:(Lt.isTrue(!(n.isInResult()||n.getSym().isInResult())||!n.getEdge().isInResult()),void(fe.isResultOfOp(u,i)&&i===fe.INTERSECTION&&(s.add(n.getEdge()),n.setVisitedEdge(!0))))},qi.prototype.interfaces_=function(){return[]},qi.prototype.getClass=function(){return qi};var ra=function(){this._op=null,this._geometryFactory=null,this._resultPointList=new O;var n=arguments[0],i=arguments[1];this._op=n,this._geometryFactory=i};ra.prototype.filterCoveredNodeToPoint=function(n){var i=n.getCoordinate();if(!this._op.isCoveredByLA(i)){var s=this._geometryFactory.createPoint(i);this._resultPointList.add(s)}},ra.prototype.extractNonCoveredResultNodes=function(n){for(var i=this._op.getGraph().getNodes().iterator();i.hasNext();){var s=i.next();if(!s.isInResult()&&!s.isIncidentEdgeInResult()&&(s.getEdges().getDegree()===0||n===fe.INTERSECTION)){var u=s.getLabel();fe.isResultOfOp(u,n)&&this.filterCoveredNodeToPoint(s)}}},ra.prototype.build=function(n){return this.extractNonCoveredResultNodes(n),this._resultPointList},ra.prototype.interfaces_=function(){return[]},ra.prototype.getClass=function(){return ra};var Fr=function(){this._inputGeom=null,this._factory=null,this._pruneEmptyGeometry=!0,this._preserveGeometryCollectionType=!0,this._preserveCollections=!1,this._preserveType=!1};Fr.prototype.transformPoint=function(n,i){return this._factory.createPoint(this.transformCoordinates(n.getCoordinateSequence(),n))},Fr.prototype.transformPolygon=function(n,i){var s=!0,u=this.transformLinearRing(n.getExteriorRing(),n);u!==null&&u instanceof oe&&!u.isEmpty()||(s=!1);for(var c=new O,m=0;m<n.getNumInteriorRing();m++){var E=this.transformLinearRing(n.getInteriorRingN(m),n);E===null||E.isEmpty()||(E instanceof oe||(s=!1),c.add(E))}if(s)return this._factory.createPolygon(u,c.toArray([]));var C=new O;return u!==null&&C.add(u),C.addAll(c),this._factory.buildGeometry(C)},Fr.prototype.createCoordinateSequence=function(n){return this._factory.getCoordinateSequenceFactory().create(n)},Fr.prototype.getInputGeometry=function(){return this._inputGeom},Fr.prototype.transformMultiLineString=function(n,i){for(var s=new O,u=0;u<n.getNumGeometries();u++){var c=this.transformLineString(n.getGeometryN(u),n);c!==null&&(c.isEmpty()||s.add(c))}return this._factory.buildGeometry(s)},Fr.prototype.transformCoordinates=function(n,i){return this.copy(n)},Fr.prototype.transformLineString=function(n,i){return this._factory.createLineString(this.transformCoordinates(n.getCoordinateSequence(),n))},Fr.prototype.transformMultiPoint=function(n,i){for(var s=new O,u=0;u<n.getNumGeometries();u++){var c=this.transformPoint(n.getGeometryN(u),n);c!==null&&(c.isEmpty()||s.add(c))}return this._factory.buildGeometry(s)},Fr.prototype.transformMultiPolygon=function(n,i){for(var s=new O,u=0;u<n.getNumGeometries();u++){var c=this.transformPolygon(n.getGeometryN(u),n);c!==null&&(c.isEmpty()||s.add(c))}return this._factory.buildGeometry(s)},Fr.prototype.copy=function(n){return n.copy()},Fr.prototype.transformGeometryCollection=function(n,i){for(var s=new O,u=0;u<n.getNumGeometries();u++){var c=this.transform(n.getGeometryN(u));c!==null&&(this._pruneEmptyGeometry&&c.isEmpty()||s.add(c))}return this._preserveGeometryCollectionType?this._factory.createGeometryCollection(pe.toGeometryArray(s)):this._factory.buildGeometry(s)},Fr.prototype.transform=function(n){if(this._inputGeom=n,this._factory=n.getFactory(),n instanceof Xt)return this.transformPoint(n,null);if(n instanceof me)return this.transformMultiPoint(n,null);if(n instanceof oe)return this.transformLinearRing(n,null);if(n instanceof at)return this.transformLineString(n,null);if(n instanceof Hr)return this.transformMultiLineString(n,null);if(n instanceof Zt)return this.transformPolygon(n,null);if(n instanceof ae)return this.transformMultiPolygon(n,null);if(n instanceof En)return this.transformGeometryCollection(n,null);throw new A("Unknown Geometry subtype: "+n.getClass().getName())},Fr.prototype.transformLinearRing=function(n,i){var s=this.transformCoordinates(n.getCoordinateSequence(),n);if(s===null)return this._factory.createLinearRing(null);var u=s.size();return u>0&&u<4&&!this._preserveType?this._factory.createLineString(s):this._factory.createLinearRing(s)},Fr.prototype.interfaces_=function(){return[]},Fr.prototype.getClass=function(){return Fr};var Qi=function n(){if(this._snapTolerance=0,this._srcPts=null,this._seg=new Qt,this._allowSnappingToSourceVertices=!1,this._isClosed=!1,arguments[0]instanceof at&&typeof arguments[1]=="number"){var i=arguments[0],s=arguments[1];n.call(this,i.getCoordinates(),s)}else if(arguments[0]instanceof Array&&typeof arguments[1]=="number"){var u=arguments[0],c=arguments[1];this._srcPts=u,this._isClosed=n.isClosed(u),this._snapTolerance=c}};Qi.prototype.snapVertices=function(n,i){for(var s=this._isClosed?n.size()-1:n.size(),u=0;u<s;u++){var c=n.get(u),m=this.findSnapForVertex(c,i);m!==null&&(n.set(u,new I(m)),u===0&&this._isClosed&&n.set(n.size()-1,new I(m)))}},Qi.prototype.findSnapForVertex=function(n,i){for(var s=0;s<i.length;s++){if(n.equals2D(i[s]))return null;if(n.distance(i[s])<this._snapTolerance)return i[s]}return null},Qi.prototype.snapTo=function(n){var i=new $(this._srcPts);return this.snapVertices(i,n),this.snapSegments(i,n),i.toCoordinateArray()},Qi.prototype.snapSegments=function(n,i){if(i.length===0)return null;var s=i.length;i[0].equals2D(i[i.length-1])&&(s=i.length-1);for(var u=0;u<s;u++){var c=i[u],m=this.findSegmentIndexToSnap(c,n);m>=0&&n.add(m+1,new I(c),!1)}},Qi.prototype.findSegmentIndexToSnap=function(n,i){for(var s=S.MAX_VALUE,u=-1,c=0;c<i.size()-1;c++){if(this._seg.p0=i.get(c),this._seg.p1=i.get(c+1),this._seg.p0.equals2D(n)||this._seg.p1.equals2D(n)){if(this._allowSnappingToSourceVertices)continue;return-1}var m=this._seg.distance(n);m<this._snapTolerance&&m<s&&(s=m,u=c)}return u},Qi.prototype.setAllowSnappingToSourceVertices=function(n){this._allowSnappingToSourceVertices=n},Qi.prototype.interfaces_=function(){return[]},Qi.prototype.getClass=function(){return Qi},Qi.isClosed=function(n){return!(n.length<=1)&&n[0].equals2D(n[n.length-1])};var Fn=function(n){this._srcGeom=n||null},gy={SNAP_PRECISION_FACTOR:{configurable:!0}};Fn.prototype.snapTo=function(n,i){var s=this.extractTargetCoordinates(n);return new yy(i,s).transform(this._srcGeom)},Fn.prototype.snapToSelf=function(n,i){var s=this.extractTargetCoordinates(this._srcGeom),u=new yy(n,s,!0).transform(this._srcGeom),c=u;return i&&X(c,re)&&(c=u.buffer(0)),c},Fn.prototype.computeSnapTolerance=function(n){return this.computeMinimumSegmentLength(n)/10},Fn.prototype.extractTargetCoordinates=function(n){for(var i=new M,s=n.getCoordinates(),u=0;u<s.length;u++)i.add(s[u]);return i.toArray(new Array(0).fill(null))},Fn.prototype.computeMinimumSegmentLength=function(n){for(var i=S.MAX_VALUE,s=0;s<n.length-1;s++){var u=n[s].distance(n[s+1]);u<i&&(i=u)}return i},Fn.prototype.interfaces_=function(){return[]},Fn.prototype.getClass=function(){return Fn},Fn.snap=function(n,i,s){var u=new Array(2).fill(null),c=new Fn(n);u[0]=c.snapTo(i,s);var m=new Fn(i);return u[1]=m.snapTo(u[0],s),u},Fn.computeOverlaySnapTolerance=function(){if(arguments.length===1){var n=arguments[0],i=Fn.computeSizeBasedSnapTolerance(n),s=n.getPrecisionModel();if(s.getType()===ge.FIXED){var u=1/s.getScale()*2/1.415;u>i&&(i=u)}return i}if(arguments.length===2){var c=arguments[0],m=arguments[1];return Math.min(Fn.computeOverlaySnapTolerance(c),Fn.computeOverlaySnapTolerance(m))}},Fn.computeSizeBasedSnapTolerance=function(n){var i=n.getEnvelopeInternal();return Math.min(i.getHeight(),i.getWidth())*Fn.SNAP_PRECISION_FACTOR},Fn.snapToSelf=function(n,i,s){return new Fn(n).snapToSelf(i,s)},gy.SNAP_PRECISION_FACTOR.get=function(){return 1e-9},Object.defineProperties(Fn,gy);var yy=function(n){function i(s,u,c){n.call(this),this._snapTolerance=s||null,this._snapPts=u||null,this._isSelfSnap=c!==void 0&&c}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.snapLine=function(s,u){var c=new Qi(s,this._snapTolerance);return c.setAllowSnappingToSourceVertices(this._isSelfSnap),c.snapTo(u)},i.prototype.transformCoordinates=function(s,u){var c=s.toCoordinateArray(),m=this.snapLine(c,this._snapPts);return this._factory.getCoordinateSequenceFactory().create(m)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(Fr),wr=function(){this._isFirst=!0,this._commonMantissaBitsCount=53,this._commonBits=0,this._commonSignExp=null};wr.prototype.getCommon=function(){return S.longBitsToDouble(this._commonBits)},wr.prototype.add=function(n){var i=S.doubleToLongBits(n);if(this._isFirst)return this._commonBits=i,this._commonSignExp=wr.signExpBits(this._commonBits),this._isFirst=!1,null;if(wr.signExpBits(i)!==this._commonSignExp)return this._commonBits=0,null;this._commonMantissaBitsCount=wr.numCommonMostSigMantissaBits(this._commonBits,i),this._commonBits=wr.zeroLowerBits(this._commonBits,64-(12+this._commonMantissaBitsCount))},wr.prototype.toString=function(){if(arguments.length===1){var n=arguments[0],i=S.longBitsToDouble(n),s="0000000000000000000000000000000000000000000000000000000000000000"+S.toBinaryString(n),u=s.substring(s.length-64);return u.substring(0,1)+" "+u.substring(1,12)+"(exp) "+u.substring(12)+" [ "+i+" ]"}},wr.prototype.interfaces_=function(){return[]},wr.prototype.getClass=function(){return wr},wr.getBit=function(n,i){return n&1<<i?1:0},wr.signExpBits=function(n){return n>>52},wr.zeroLowerBits=function(n,i){return n&~((1<<i)-1)},wr.numCommonMostSigMantissaBits=function(n,i){for(var s=0,u=52;u>=0;u--){if(wr.getBit(n,u)!==wr.getBit(i,u))return s;s++}return 52};var Wo=function(){this._commonCoord=null,this._ccFilter=new ia},lp={CommonCoordinateFilter:{configurable:!0},Translater:{configurable:!0}};Wo.prototype.addCommonBits=function(n){var i=new Xo(this._commonCoord);n.apply(i),n.geometryChanged()},Wo.prototype.removeCommonBits=function(n){if(this._commonCoord.x===0&&this._commonCoord.y===0)return n;var i=new I(this._commonCoord);i.x=-i.x,i.y=-i.y;var s=new Xo(i);return n.apply(s),n.geometryChanged(),n},Wo.prototype.getCommonCoordinate=function(){return this._commonCoord},Wo.prototype.add=function(n){n.apply(this._ccFilter),this._commonCoord=this._ccFilter.getCommonCoordinate()},Wo.prototype.interfaces_=function(){return[]},Wo.prototype.getClass=function(){return Wo},lp.CommonCoordinateFilter.get=function(){return ia},lp.Translater.get=function(){return Xo},Object.defineProperties(Wo,lp);var ia=function(){this._commonBitsX=new wr,this._commonBitsY=new wr};ia.prototype.filter=function(n){this._commonBitsX.add(n.x),this._commonBitsY.add(n.y)},ia.prototype.getCommonCoordinate=function(){return new I(this._commonBitsX.getCommon(),this._commonBitsY.getCommon())},ia.prototype.interfaces_=function(){return[J]},ia.prototype.getClass=function(){return ia};var Xo=function(){this.trans=null;var n=arguments[0];this.trans=n};Xo.prototype.filter=function(n,i){var s=n.getOrdinate(i,0)+this.trans.x,u=n.getOrdinate(i,1)+this.trans.y;n.setOrdinate(i,0,s),n.setOrdinate(i,1,u)},Xo.prototype.isDone=function(){return!1},Xo.prototype.isGeometryChanged=function(){return!0},Xo.prototype.interfaces_=function(){return[Tn]},Xo.prototype.getClass=function(){return Xo};var jn=function(n,i){this._geom=new Array(2).fill(null),this._snapTolerance=null,this._cbr=null,this._geom[0]=n,this._geom[1]=i,this.computeSnapTolerance()};jn.prototype.selfSnap=function(n){return new Fn(n).snapTo(n,this._snapTolerance)},jn.prototype.removeCommonBits=function(n){this._cbr=new Wo,this._cbr.add(n[0]),this._cbr.add(n[1]);var i=new Array(2).fill(null);return i[0]=this._cbr.removeCommonBits(n[0].copy()),i[1]=this._cbr.removeCommonBits(n[1].copy()),i},jn.prototype.prepareResult=function(n){return this._cbr.addCommonBits(n),n},jn.prototype.getResultGeometry=function(n){var i=this.snap(this._geom),s=fe.overlayOp(i[0],i[1],n);return this.prepareResult(s)},jn.prototype.checkValid=function(n){n.isValid()||Ut.out.println("Snapped geometry is invalid")},jn.prototype.computeSnapTolerance=function(){this._snapTolerance=Fn.computeOverlaySnapTolerance(this._geom[0],this._geom[1])},jn.prototype.snap=function(n){var i=this.removeCommonBits(n);return Fn.snap(i[0],i[1],this._snapTolerance)},jn.prototype.interfaces_=function(){return[]},jn.prototype.getClass=function(){return jn},jn.overlayOp=function(n,i,s){return new jn(n,i).getResultGeometry(s)},jn.union=function(n,i){return jn.overlayOp(n,i,fe.UNION)},jn.intersection=function(n,i){return jn.overlayOp(n,i,fe.INTERSECTION)},jn.symDifference=function(n,i){return jn.overlayOp(n,i,fe.SYMDIFFERENCE)},jn.difference=function(n,i){return jn.overlayOp(n,i,fe.DIFFERENCE)};var br=function(n,i){this._geom=new Array(2).fill(null),this._geom[0]=n,this._geom[1]=i};br.prototype.getResultGeometry=function(n){var i=null,s=!1,u=null;try{i=fe.overlayOp(this._geom[0],this._geom[1],n),s=!0}catch(c){if(!(c instanceof ie))throw c;u=c}if(!s)try{i=jn.overlayOp(this._geom[0],this._geom[1],n)}catch(c){throw c instanceof ie?u:c}return i},br.prototype.interfaces_=function(){return[]},br.prototype.getClass=function(){return br},br.overlayOp=function(n,i,s){return new br(n,i).getResultGeometry(s)},br.union=function(n,i){return br.overlayOp(n,i,fe.UNION)},br.intersection=function(n,i){return br.overlayOp(n,i,fe.INTERSECTION)},br.symDifference=function(n,i){return br.overlayOp(n,i,fe.SYMDIFFERENCE)},br.difference=function(n,i){return br.overlayOp(n,i,fe.DIFFERENCE)};var ul=function(){this.mce=null,this.chainIndex=null;var n=arguments[0],i=arguments[1];this.mce=n,this.chainIndex=i};ul.prototype.computeIntersections=function(n,i){this.mce.computeIntersectsForChain(this.chainIndex,n.mce,n.chainIndex,i)},ul.prototype.interfaces_=function(){return[]},ul.prototype.getClass=function(){return ul};var $r=function n(){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],s=arguments[1];this._eventType=n.DELETE,this._xValue=i,this._insertEvent=s}else if(arguments.length===3){var u=arguments[0],c=arguments[1],m=arguments[2];this._eventType=n.INSERT,this._label=u,this._xValue=c,this._obj=m}},cp={INSERT:{configurable:!0},DELETE:{configurable:!0}};$r.prototype.isDelete=function(){return this._eventType===$r.DELETE},$r.prototype.setDeleteEventIndex=function(n){this._deleteEventIndex=n},$r.prototype.getObject=function(){return this._obj},$r.prototype.compareTo=function(n){var i=n;return this._xValue<i._xValue?-1:this._xValue>i._xValue?1:this._eventType<i._eventType?-1:this._eventType>i._eventType?1:0},$r.prototype.getInsertEvent=function(){return this._insertEvent},$r.prototype.isInsert=function(){return this._eventType===$r.INSERT},$r.prototype.isSameLabel=function(n){return this._label!==null&&this._label===n._label},$r.prototype.getDeleteEventIndex=function(){return this._deleteEventIndex},$r.prototype.interfaces_=function(){return[G]},$r.prototype.getClass=function(){return $r},cp.INSERT.get=function(){return 1},cp.DELETE.get=function(){return 2},Object.defineProperties($r,cp);var mc=function(){};mc.prototype.interfaces_=function(){return[]},mc.prototype.getClass=function(){return mc};var ir=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 n=arguments[0],i=arguments[1],s=arguments[2];this._li=n,this._includeProper=i,this._recordIsolated=s};ir.prototype.isTrivialIntersection=function(n,i,s,u){if(n===s&&this._li.getIntersectionNum()===1){if(ir.isAdjacentSegments(i,u))return!0;if(n.isClosed()){var c=n.getNumPoints()-1;if(i===0&&u===c||u===0&&i===c)return!0}}return!1},ir.prototype.getProperIntersectionPoint=function(){return this._properIntersectionPoint},ir.prototype.setIsDoneIfProperInt=function(n){this._isDoneWhenProperInt=n},ir.prototype.hasProperInteriorIntersection=function(){return this._hasProperInterior},ir.prototype.isBoundaryPointInternal=function(n,i){for(var s=i.iterator();s.hasNext();){var u=s.next().getCoordinate();if(n.isIntersection(u))return!0}return!1},ir.prototype.hasProperIntersection=function(){return this._hasProper},ir.prototype.hasIntersection=function(){return this._hasIntersection},ir.prototype.isDone=function(){return this._isDone},ir.prototype.isBoundaryPoint=function(n,i){return i!==null&&(!!this.isBoundaryPointInternal(n,i[0])||!!this.isBoundaryPointInternal(n,i[1]))},ir.prototype.setBoundaryNodes=function(n,i){this._bdyNodes=new Array(2).fill(null),this._bdyNodes[0]=n,this._bdyNodes[1]=i},ir.prototype.addIntersections=function(n,i,s,u){if(n===s&&i===u)return null;this.numTests++;var c=n.getCoordinates()[i],m=n.getCoordinates()[i+1],E=s.getCoordinates()[u],C=s.getCoordinates()[u+1];this._li.computeIntersection(c,m,E,C),this._li.hasIntersection()&&(this._recordIsolated&&(n.setIsolated(!1),s.setIsolated(!1)),this._numIntersections++,this.isTrivialIntersection(n,i,s,u)||(this._hasIntersection=!0,!this._includeProper&&this._li.isProper()||(n.addIntersections(this._li,i,0),s.addIntersections(this._li,u,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))))},ir.prototype.interfaces_=function(){return[]},ir.prototype.getClass=function(){return ir},ir.isAdjacentSegments=function(n,i){return Math.abs(n-i)===1};var tC=function(n){function i(){n.call(this),this.events=new O,this.nOverlaps=null}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.prepareEvents=function(){Ti.sort(this.events);for(var s=0;s<this.events.size();s++){var u=this.events.get(s);u.isDelete()&&u.getInsertEvent().setDeleteEventIndex(s)}},i.prototype.computeIntersections=function(){if(arguments.length===1){var s=arguments[0];this.nOverlaps=0,this.prepareEvents();for(var u=0;u<this.events.size();u++){var c=this.events.get(u);if(c.isInsert()&&this.processOverlaps(u,c.getDeleteEventIndex(),c,s),s.isDone())break}}else if(arguments.length===3){if(arguments[2]instanceof ir&&X(arguments[0],ct)&&X(arguments[1],ct)){var m=arguments[0],E=arguments[1],C=arguments[2];this.addEdges(m,m),this.addEdges(E,E),this.computeIntersections(C)}else if(typeof arguments[2]=="boolean"&&X(arguments[0],ct)&&arguments[1]instanceof ir){var U=arguments[0],Z=arguments[1];arguments[2]?this.addEdges(U,null):this.addEdges(U),this.computeIntersections(Z)}}},i.prototype.addEdge=function(s,u){for(var c=s.getMonotoneChainEdge(),m=c.getStartIndexes(),E=0;E<m.length-1;E++){var C=new ul(c,E),U=new $r(u,c.getMinX(E),C);this.events.add(U),this.events.add(new $r(c.getMaxX(E),U))}},i.prototype.processOverlaps=function(s,u,c,m){for(var E=c.getObject(),C=s;C<u;C++){var U=this.events.get(C);if(U.isInsert()){var Z=U.getObject();c.isSameLabel(U)||(E.computeIntersections(Z,m),this.nOverlaps++)}}},i.prototype.addEdges=function(){if(arguments.length===1)for(var s=arguments[0].iterator();s.hasNext();){var u=s.next();this.addEdge(u,u)}else if(arguments.length===2)for(var c=arguments[0],m=arguments[1],E=c.iterator();E.hasNext();){var C=E.next();this.addEdge(C,m)}},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(mc),to=function(){this._min=S.POSITIVE_INFINITY,this._max=S.NEGATIVE_INFINITY},vy={NodeComparator:{configurable:!0}};to.prototype.getMin=function(){return this._min},to.prototype.intersects=function(n,i){return!(this._min>i||this._max<n)},to.prototype.getMax=function(){return this._max},to.prototype.toString=function(){return Wt.toLineString(new I(this._min,0),new I(this._max,0))},to.prototype.interfaces_=function(){return[]},to.prototype.getClass=function(){return to},vy.NodeComparator.get=function(){return ll},Object.defineProperties(to,vy);var ll=function(){};ll.prototype.compare=function(n,i){var s=n,u=i,c=(s._min+s._max)/2,m=(u._min+u._max)/2;return c<m?-1:c>m?1:0},ll.prototype.interfaces_=function(){return[F]},ll.prototype.getClass=function(){return ll};var eC=function(n){function i(){n.call(this),this._item=null;var s=arguments[0],u=arguments[1],c=arguments[2];this._min=s,this._max=u,this._item=c}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.query=function(s,u,c){if(!this.intersects(s,u))return null;c.visitItem(this._item)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(to),nC=function(n){function i(){n.call(this),this._node1=null,this._node2=null;var s=arguments[0],u=arguments[1];this._node1=s,this._node2=u,this.buildExtent(this._node1,this._node2)}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.buildExtent=function(s,u){this._min=Math.min(s._min,u._min),this._max=Math.max(s._max,u._max)},i.prototype.query=function(s,u,c){if(!this.intersects(s,u))return null;this._node1!==null&&this._node1.query(s,u,c),this._node2!==null&&this._node2.query(s,u,c)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(to),eo=function(){this._leaves=new O,this._root=null,this._level=0};eo.prototype.buildTree=function(){Ti.sort(this._leaves,new to.NodeComparator);for(var n=this._leaves,i=null,s=new O;;){if(this.buildLevel(n,s),s.size()===1)return s.get(0);i=n,n=s,s=i}},eo.prototype.insert=function(n,i,s){if(this._root!==null)throw new Error("Index cannot be added to once it has been queried");this._leaves.add(new eC(n,i,s))},eo.prototype.query=function(n,i,s){this.init(),this._root.query(n,i,s)},eo.prototype.buildRoot=function(){if(this._root!==null)return null;this._root=this.buildTree()},eo.prototype.printNode=function(n){Ut.out.println(Wt.toLineString(new I(n._min,this._level),new I(n._max,this._level)))},eo.prototype.init=function(){if(this._root!==null)return null;this.buildRoot()},eo.prototype.buildLevel=function(n,i){this._level++,i.clear();for(var s=0;s<n.size();s+=2){var u=n.get(s);if((s+1<n.size()?n.get(s):null)===null)i.add(u);else{var c=new nC(n.get(s),n.get(s+1));i.add(c)}}},eo.prototype.interfaces_=function(){return[]},eo.prototype.getClass=function(){return eo};var ka=function(){this._items=new O};ka.prototype.visitItem=function(n){this._items.add(n)},ka.prototype.getItems=function(){return this._items},ka.prototype.interfaces_=function(){return[Bo]},ka.prototype.getClass=function(){return ka};var qa=function(){this._index=null;var n=arguments[0];if(!X(n,re))throw new A("Argument must be Polygonal");this._index=new gs(n)},fp={SegmentVisitor:{configurable:!0},IntervalIndexedGeometry:{configurable:!0}};qa.prototype.locate=function(n){var i=new Et(n),s=new Va(i);return this._index.query(n.y,n.y,s),i.getLocation()},qa.prototype.interfaces_=function(){return[Ba]},qa.prototype.getClass=function(){return qa},fp.SegmentVisitor.get=function(){return Va},fp.IntervalIndexedGeometry.get=function(){return gs},Object.defineProperties(qa,fp);var Va=function(){this._counter=null;var n=arguments[0];this._counter=n};Va.prototype.visitItem=function(n){var i=n;this._counter.countSegment(i.getCoordinate(0),i.getCoordinate(1))},Va.prototype.interfaces_=function(){return[Bo]},Va.prototype.getClass=function(){return Va};var gs=function(){this._index=new eo;var n=arguments[0];this.init(n)};gs.prototype.init=function(n){for(var i=er.getLines(n).iterator();i.hasNext();){var s=i.next().getCoordinates();this.addLine(s)}},gs.prototype.addLine=function(n){for(var i=1;i<n.length;i++){var s=new Qt(n[i-1],n[i]),u=Math.min(s.p0.y,s.p1.y),c=Math.max(s.p0.y,s.p1.y);this._index.insert(u,c,s)}},gs.prototype.query=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1],s=new ka;return this._index.query(n,i,s),s.getItems()}if(arguments.length===3){var u=arguments[0],c=arguments[1],m=arguments[2];this._index.query(u,c,m)}},gs.prototype.interfaces_=function(){return[]},gs.prototype.getClass=function(){return gs};var cl=function(n){function i(){if(n.call(this),this._parentGeom=null,this._lineEdgeMap=new Qu,this._boundaryNodeRule=null,this._useBoundaryDeterminationRule=!0,this._argIndex=null,this._boundaryNodes=null,this._hasTooFewPoints=!1,this._invalidPoint=null,this._areaPtLocator=null,this._ptLocator=new Ci,arguments.length===2){var s=arguments[0],u=arguments[1],c=w.OGC_SFS_BOUNDARY_RULE;this._argIndex=s,this._parentGeom=u,this._boundaryNodeRule=c,u!==null&&this.add(u)}else if(arguments.length===3){var m=arguments[0],E=arguments[1],C=arguments[2];this._argIndex=m,this._parentGeom=E,this._boundaryNodeRule=C,E!==null&&this.add(E)}}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.insertBoundaryPoint=function(s,u){var c=this._nodes.addNode(u).getLabel(),m=1;V.NONE,c.getLocation(s,It.ON)===V.BOUNDARY&&m++;var E=i.determineBoundary(this._boundaryNodeRule,m);c.setLocation(s,E)},i.prototype.computeSelfNodes=function(){if(arguments.length===2){var s=arguments[0],u=arguments[1];return this.computeSelfNodes(s,u,!1)}if(arguments.length===3){var c=arguments[0],m=arguments[1],E=arguments[2],C=new ir(c,!0,!1);C.setIsDoneIfProperInt(E);var U=this.createEdgeSetIntersector(),Z=this._parentGeom instanceof oe||this._parentGeom instanceof Zt||this._parentGeom instanceof ae,pt=m||!Z;return U.computeIntersections(this._edges,C,pt),this.addSelfIntersectionNodes(this._argIndex),C}},i.prototype.computeSplitEdges=function(s){for(var u=this._edges.iterator();u.hasNext();)u.next().eiList.addSplitEdges(s)},i.prototype.computeEdgeIntersections=function(s,u,c){var m=new ir(u,c,!0);return m.setBoundaryNodes(this.getBoundaryNodes(),s.getBoundaryNodes()),this.createEdgeSetIntersector().computeIntersections(this._edges,s._edges,m),m},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 Xt){var s=arguments[0].getCoordinate();this.insertPoint(this._argIndex,s,V.INTERIOR)}else if(arguments[0]instanceof I){var u=arguments[0];this.insertPoint(this._argIndex,u,V.INTERIOR)}},i.prototype.addPolygon=function(s){this.addPolygonRing(s.getExteriorRing(),V.EXTERIOR,V.INTERIOR);for(var u=0;u<s.getNumInteriorRing();u++){var c=s.getInteriorRingN(u);this.addPolygonRing(c,V.INTERIOR,V.EXTERIOR)}},i.prototype.addEdge=function(s){this.insertEdge(s);var u=s.getCoordinates();this.insertPoint(this._argIndex,u[0],V.BOUNDARY),this.insertPoint(this._argIndex,u[u.length-1],V.BOUNDARY)},i.prototype.addLineString=function(s){var u=Q.removeRepeatedPoints(s.getCoordinates());if(u.length<2)return this._hasTooFewPoints=!0,this._invalidPoint=u[0],null;var c=new dc(u,new fn(this._argIndex,V.INTERIOR));this._lineEdgeMap.put(s,c),this.insertEdge(c),Lt.isTrue(u.length>=2,"found LineString with single point"),this.insertBoundaryPoint(this._argIndex,u[0]),this.insertBoundaryPoint(this._argIndex,u[u.length-1])},i.prototype.getInvalidPoint=function(){return this._invalidPoint},i.prototype.getBoundaryPoints=function(){for(var s=this.getBoundaryNodes(),u=new Array(s.size()).fill(null),c=0,m=s.iterator();m.hasNext();){var E=m.next();u[c++]=E.getCoordinate().copy()}return u},i.prototype.getBoundaryNodes=function(){return this._boundaryNodes===null&&(this._boundaryNodes=this._nodes.getBoundaryNodes(this._argIndex)),this._boundaryNodes},i.prototype.addSelfIntersectionNode=function(s,u,c){if(this.isBoundaryNode(s,u))return null;c===V.BOUNDARY&&this._useBoundaryDeterminationRule?this.insertBoundaryPoint(s,u):this.insertPoint(s,u,c)},i.prototype.addPolygonRing=function(s,u,c){if(s.isEmpty())return null;var m=Q.removeRepeatedPoints(s.getCoordinates());if(m.length<4)return this._hasTooFewPoints=!0,this._invalidPoint=m[0],null;var E=u,C=c;ot.isCCW(m)&&(E=c,C=u);var U=new dc(m,new fn(this._argIndex,V.BOUNDARY,E,C));this._lineEdgeMap.put(s,U),this.insertEdge(U),this.insertPoint(this._argIndex,m[0],V.BOUNDARY)},i.prototype.insertPoint=function(s,u,c){var m=this._nodes.addNode(u),E=m.getLabel();E===null?m._label=new fn(s,c):E.setLocation(s,c)},i.prototype.createEdgeSetIntersector=function(){return new tC},i.prototype.addSelfIntersectionNodes=function(s){for(var u=this._edges.iterator();u.hasNext();)for(var c=u.next(),m=c.getLabel().getLocation(s),E=c.eiList.iterator();E.hasNext();){var C=E.next();this.addSelfIntersectionNode(s,C.coord,m)}},i.prototype.add=function(){if(arguments.length!==1)return n.prototype.add.apply(this,arguments);var s=arguments[0];if(s.isEmpty())return null;if(s instanceof ae&&(this._useBoundaryDeterminationRule=!1),s instanceof Zt)this.addPolygon(s);else if(s instanceof at)this.addLineString(s);else if(s instanceof Xt)this.addPoint(s);else if(s instanceof me)this.addCollection(s);else if(s instanceof Hr)this.addCollection(s);else if(s instanceof ae)this.addCollection(s);else{if(!(s instanceof En))throw new Error(s.getClass().getName());this.addCollection(s)}},i.prototype.addCollection=function(s){for(var u=0;u<s.getNumGeometries();u++){var c=s.getGeometryN(u);this.add(c)}},i.prototype.locate=function(s){return X(this._parentGeom,re)&&this._parentGeom.getNumGeometries()>50?(this._areaPtLocator===null&&(this._areaPtLocator=new qa(this._parentGeom)),this._areaPtLocator.locate(s)):this._ptLocator.locate(s,this._parentGeom)},i.prototype.findEdge=function(){if(arguments.length===1){var s=arguments[0];return this._lineEdgeMap.get(s)}return n.prototype.findEdge.apply(this,arguments)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i.determineBoundary=function(s,u){return s.isInBoundary(u)?V.BOUNDARY:V.INTERIOR},i}(Rn),Ha=function(){if(this._li=new N,this._resultPrecisionModel=null,this._arg=null,arguments.length===1){var n=arguments[0];this.setComputationPrecision(n.getPrecisionModel()),this._arg=new Array(1).fill(null),this._arg[0]=new cl(0,n)}else if(arguments.length===2){var i=arguments[0],s=arguments[1],u=w.OGC_SFS_BOUNDARY_RULE;i.getPrecisionModel().compareTo(s.getPrecisionModel())>=0?this.setComputationPrecision(i.getPrecisionModel()):this.setComputationPrecision(s.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new cl(0,i,u),this._arg[1]=new cl(1,s,u)}else if(arguments.length===3){var c=arguments[0],m=arguments[1],E=arguments[2];c.getPrecisionModel().compareTo(m.getPrecisionModel())>=0?this.setComputationPrecision(c.getPrecisionModel()):this.setComputationPrecision(m.getPrecisionModel()),this._arg=new Array(2).fill(null),this._arg[0]=new cl(0,c,E),this._arg[1]=new cl(1,m,E)}};Ha.prototype.getArgGeometry=function(n){return this._arg[n].getGeometry()},Ha.prototype.setComputationPrecision=function(n){this._resultPrecisionModel=n,this._li.setPrecisionModel(this._resultPrecisionModel)},Ha.prototype.interfaces_=function(){return[]},Ha.prototype.getClass=function(){return Ha};var ys=function(){};ys.prototype.interfaces_=function(){return[]},ys.prototype.getClass=function(){return ys},ys.map=function(){if(arguments[0]instanceof Ct&&X(arguments[1],ys.MapOp)){for(var n=arguments[0],i=arguments[1],s=new O,u=0;u<n.getNumGeometries();u++){var c=i.map(n.getGeometryN(u));c!==null&&s.add(c)}return n.getFactory().buildGeometry(s)}if(X(arguments[0],j)&&X(arguments[1],ys.MapOp)){for(var m=arguments[0],E=arguments[1],C=new O,U=m.iterator();U.hasNext();){var Z=U.next(),pt=E.map(Z);pt!==null&&C.add(pt)}return C}},ys.MapOp=function(){};var fe=function(n){function i(){var s=arguments[0],u=arguments[1];n.call(this,s,u),this._ptLocator=new Ci,this._geomFact=null,this._resultGeom=null,this._graph=null,this._edgeList=new Ai,this._resultPolyList=new O,this._resultLineList=new O,this._resultPointList=new O,this._graph=new Rn(new ly),this._geomFact=s.getFactory()}return n&&(i.__proto__=n),i.prototype=Object.create(n&&n.prototype),i.prototype.constructor=i,i.prototype.insertUniqueEdge=function(s){var u=this._edgeList.findEqualEdge(s);if(u!==null){var c=u.getLabel(),m=s.getLabel();u.isPointwiseEqual(s)||(m=new fn(s.getLabel())).flip();var E=u.getDepth();E.isNull()&&E.add(c),E.add(m),c.merge(m)}else this._edgeList.add(s)},i.prototype.getGraph=function(){return this._graph},i.prototype.cancelDuplicateResultEdges=function(){for(var s=this._graph.getEdgeEnds().iterator();s.hasNext();){var u=s.next(),c=u.getSym();u.isInResult()&&c.isInResult()&&(u.setInResult(!1),c.setInResult(!1))}},i.prototype.isCoveredByLA=function(s){return!!this.isCovered(s,this._resultLineList)||!!this.isCovered(s,this._resultPolyList)},i.prototype.computeGeometry=function(s,u,c,m){var E=new O;return E.addAll(s),E.addAll(u),E.addAll(c),E.isEmpty()?i.createEmptyResult(m,this._arg[0].getGeometry(),this._arg[1].getGeometry(),this._geomFact):this._geomFact.buildGeometry(E)},i.prototype.mergeSymLabels=function(){for(var s=this._graph.getNodes().iterator();s.hasNext();)s.next().getEdges().mergeSymLabels()},i.prototype.isCovered=function(s,u){for(var c=u.iterator();c.hasNext();){var m=c.next();if(this._ptLocator.locate(s,m)!==V.EXTERIOR)return!0}return!1},i.prototype.replaceCollapsedEdges=function(){for(var s=new O,u=this._edgeList.iterator();u.hasNext();){var c=u.next();c.isCollapsed()&&(u.remove(),s.add(c.getCollapsedEdge()))}this._edgeList.addAll(s)},i.prototype.updateNodeLabelling=function(){for(var s=this._graph.getNodes().iterator();s.hasNext();){var u=s.next(),c=u.getEdges().getLabel();u.getLabel().merge(c)}},i.prototype.getResultGeometry=function(s){return this.computeOverlay(s),this._resultGeom},i.prototype.insertUniqueEdges=function(s){for(var u=s.iterator();u.hasNext();){var c=u.next();this.insertUniqueEdge(c)}},i.prototype.computeOverlay=function(s){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 u=new O;this._arg[0].computeSplitEdges(u),this._arg[1].computeSplitEdges(u),this.insertUniqueEdges(u),this.computeLabelsFromDepths(),this.replaceCollapsedEdges(),ms.checkValid(this._edgeList.getEdges()),this._graph.addEdges(this._edgeList.getEdges()),this.computeLabelling(),this.labelIncompleteNodes(),this.findResultAreaEdges(s),this.cancelDuplicateResultEdges();var c=new Wr(this._geomFact);c.add(this._graph),this._resultPolyList=c.getPolygons();var m=new qi(this,this._geomFact,this._ptLocator);this._resultLineList=m.build(s);var E=new ra(this,this._geomFact,this._ptLocator);this._resultPointList=E.build(s),this._resultGeom=this.computeGeometry(this._resultPointList,this._resultLineList,this._resultPolyList,s)},i.prototype.labelIncompleteNode=function(s,u){var c=this._ptLocator.locate(s.getCoordinate(),this._arg[u].getGeometry());s.getLabel().setLocation(u,c)},i.prototype.copyPoints=function(s){for(var u=this._arg[s].getNodeIterator();u.hasNext();){var c=u.next();this._graph.addNode(c.getCoordinate()).setLabel(s,c.getLabel().getLocation(s))}},i.prototype.findResultAreaEdges=function(s){for(var u=this._graph.getEdgeEnds().iterator();u.hasNext();){var c=u.next(),m=c.getLabel();m.isArea()&&!c.isInteriorAreaEdge()&&i.isResultOfOp(m.getLocation(0,It.RIGHT),m.getLocation(1,It.RIGHT),s)&&c.setInResult(!0)}},i.prototype.computeLabelsFromDepths=function(){for(var s=this._edgeList.iterator();s.hasNext();){var u=s.next(),c=u.getLabel(),m=u.getDepth();if(!m.isNull()){m.normalize();for(var E=0;E<2;E++)c.isNull(E)||!c.isArea()||m.isNull(E)||(m.getDelta(E)===0?c.toLine(E):(Lt.isTrue(!m.isNull(E,It.LEFT),"depth of LEFT side has not been initialized"),c.setLocation(E,It.LEFT,m.getLocation(E,It.LEFT)),Lt.isTrue(!m.isNull(E,It.RIGHT),"depth of RIGHT side has not been initialized"),c.setLocation(E,It.RIGHT,m.getLocation(E,It.RIGHT))))}}},i.prototype.computeLabelling=function(){for(var s=this._graph.getNodes().iterator();s.hasNext();)s.next().getEdges().computeLabelling(this._arg);this.mergeSymLabels(),this.updateNodeLabelling()},i.prototype.labelIncompleteNodes=function(){for(var s=this._graph.getNodes().iterator();s.hasNext();){var u=s.next(),c=u.getLabel();u.isIsolated()&&(c.isNull(0)?this.labelIncompleteNode(u,0):this.labelIncompleteNode(u,1)),u.getEdges().updateLabelling(c)}},i.prototype.isCoveredByA=function(s){return!!this.isCovered(s,this._resultPolyList)},i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(Ha);fe.overlayOp=function(n,i,s){return new fe(n,i).getResultGeometry(s)},fe.intersection=function(n,i){if(n.isEmpty()||i.isEmpty())return fe.createEmptyResult(fe.INTERSECTION,n,i,n.getFactory());if(n.isGeometryCollection()){var s=i;return na.map(n,{interfaces_:function(){return[ys.MapOp]},map:function(u){return u.intersection(s)}})}return n.checkNotGeometryCollection(n),n.checkNotGeometryCollection(i),br.overlayOp(n,i,fe.INTERSECTION)},fe.symDifference=function(n,i){if(n.isEmpty()||i.isEmpty()){if(n.isEmpty()&&i.isEmpty())return fe.createEmptyResult(fe.SYMDIFFERENCE,n,i,n.getFactory());if(n.isEmpty())return i.copy();if(i.isEmpty())return n.copy()}return n.checkNotGeometryCollection(n),n.checkNotGeometryCollection(i),br.overlayOp(n,i,fe.SYMDIFFERENCE)},fe.resultDimension=function(n,i,s){var u=i.getDimension(),c=s.getDimension(),m=-1;switch(n){case fe.INTERSECTION:m=Math.min(u,c);break;case fe.UNION:m=Math.max(u,c);break;case fe.DIFFERENCE:m=u;break;case fe.SYMDIFFERENCE:m=Math.max(u,c)}return m},fe.createEmptyResult=function(n,i,s,u){var c=null;switch(fe.resultDimension(n,i,s)){case-1:c=u.createGeometryCollection(new Array(0).fill(null));break;case 0:c=u.createPoint();break;case 1:c=u.createLineString();break;case 2:c=u.createPolygon()}return c},fe.difference=function(n,i){return n.isEmpty()?fe.createEmptyResult(fe.DIFFERENCE,n,i,n.getFactory()):i.isEmpty()?n.copy():(n.checkNotGeometryCollection(n),n.checkNotGeometryCollection(i),br.overlayOp(n,i,fe.DIFFERENCE))},fe.isResultOfOp=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1],s=n.getLocation(0),u=n.getLocation(1);return fe.isResultOfOp(s,u,i)}if(arguments.length===3){var c=arguments[0],m=arguments[1],E=arguments[2];switch(c===V.BOUNDARY&&(c=V.INTERIOR),m===V.BOUNDARY&&(m=V.INTERIOR),E){case fe.INTERSECTION:return c===V.INTERIOR&&m===V.INTERIOR;case fe.UNION:return c===V.INTERIOR||m===V.INTERIOR;case fe.DIFFERENCE:return c===V.INTERIOR&&m!==V.INTERIOR;case fe.SYMDIFFERENCE:return c===V.INTERIOR&&m!==V.INTERIOR||c!==V.INTERIOR&&m===V.INTERIOR}return!1}},fe.INTERSECTION=1,fe.UNION=2,fe.DIFFERENCE=3,fe.SYMDIFFERENCE=4;var Yo=function(){this._g=null,this._boundaryDistanceTolerance=null,this._linework=null,this._ptLocator=new Ci,this._seg=new Qt;var n=arguments[0],i=arguments[1];this._g=n,this._boundaryDistanceTolerance=i,this._linework=this.extractLinework(n)};Yo.prototype.isWithinToleranceOfBoundary=function(n){for(var i=0;i<this._linework.getNumGeometries();i++)for(var s=this._linework.getGeometryN(i).getCoordinateSequence(),u=0;u<s.size()-1;u++)if(s.getCoordinate(u,this._seg.p0),s.getCoordinate(u+1,this._seg.p1),this._seg.distance(n)<=this._boundaryDistanceTolerance)return!0;return!1},Yo.prototype.getLocation=function(n){return this.isWithinToleranceOfBoundary(n)?V.BOUNDARY:this._ptLocator.locate(n,this._g)},Yo.prototype.extractLinework=function(n){var i=new Wa;n.apply(i);var s=i.getLinework(),u=pe.toLineStringArray(s);return n.getFactory().createMultiLineString(u)},Yo.prototype.interfaces_=function(){return[]},Yo.prototype.getClass=function(){return Yo};var Wa=function(){this._linework=null,this._linework=new O};Wa.prototype.getLinework=function(){return this._linework},Wa.prototype.filter=function(n){if(n instanceof Zt){var i=n;this._linework.add(i.getExteriorRing());for(var s=0;s<i.getNumInteriorRing();s++)this._linework.add(i.getInteriorRingN(s))}},Wa.prototype.interfaces_=function(){return[In]},Wa.prototype.getClass=function(){return Wa};var vs=function(){this._g=null,this._doLeft=!0,this._doRight=!0;var n=arguments[0];this._g=n};vs.prototype.extractPoints=function(n,i,s){for(var u=n.getCoordinates(),c=0;c<u.length-1;c++)this.computeOffsetPoints(u[c],u[c+1],i,s)},vs.prototype.setSidesToGenerate=function(n,i){this._doLeft=n,this._doRight=i},vs.prototype.getPoints=function(n){for(var i=new O,s=er.getLines(this._g).iterator();s.hasNext();){var u=s.next();this.extractPoints(u,n,i)}return i},vs.prototype.computeOffsetPoints=function(n,i,s,u){var c=i.x-n.x,m=i.y-n.y,E=Math.sqrt(c*c+m*m),C=s*c/E,U=s*m/E,Z=(i.x+n.x)/2,pt=(i.y+n.y)/2;if(this._doLeft){var gt=new I(Z-U,pt+C);u.add(gt)}if(this._doRight){var Rt=new I(Z+U,pt-C);u.add(Rt)}},vs.prototype.interfaces_=function(){return[]},vs.prototype.getClass=function(){return vs};var ai=function n(){this._geom=null,this._locFinder=null,this._location=new Array(3).fill(null),this._invalidLocation=null,this._boundaryDistanceTolerance=n.TOLERANCE,this._testCoords=new O;var i=arguments[0],s=arguments[1],u=arguments[2];this._boundaryDistanceTolerance=n.computeBoundaryDistanceTolerance(i,s),this._geom=[i,s,u],this._locFinder=[new Yo(this._geom[0],this._boundaryDistanceTolerance),new Yo(this._geom[1],this._boundaryDistanceTolerance),new Yo(this._geom[2],this._boundaryDistanceTolerance)]},_y={TOLERANCE:{configurable:!0}};ai.prototype.reportResult=function(n,i,s){Ut.out.println("Overlay result invalid - A:"+V.toLocationSymbol(i[0])+" B:"+V.toLocationSymbol(i[1])+" expected:"+(s?"i":"e")+" actual:"+V.toLocationSymbol(i[2]))},ai.prototype.isValid=function(n){this.addTestPts(this._geom[0]),this.addTestPts(this._geom[1]);var i=this.checkValid(n);return i},ai.prototype.checkValid=function(){if(arguments.length===1){for(var n=arguments[0],i=0;i<this._testCoords.size();i++){var s=this._testCoords.get(i);if(!this.checkValid(n,s))return this._invalidLocation=s,!1}return!0}if(arguments.length===2){var u=arguments[0],c=arguments[1];return this._location[0]=this._locFinder[0].getLocation(c),this._location[1]=this._locFinder[1].getLocation(c),this._location[2]=this._locFinder[2].getLocation(c),!!ai.hasLocation(this._location,V.BOUNDARY)||this.isValidResult(u,this._location)}},ai.prototype.addTestPts=function(n){var i=new vs(n);this._testCoords.addAll(i.getPoints(5*this._boundaryDistanceTolerance))},ai.prototype.isValidResult=function(n,i){var s=fe.isResultOfOp(i[0],i[1],n),u=!(s^i[2]===V.INTERIOR);return u||this.reportResult(n,i,s),u},ai.prototype.getInvalidLocation=function(){return this._invalidLocation},ai.prototype.interfaces_=function(){return[]},ai.prototype.getClass=function(){return ai},ai.hasLocation=function(n,i){for(var s=0;s<3;s++)if(n[s]===i)return!0;return!1},ai.computeBoundaryDistanceTolerance=function(n,i){return Math.min(Fn.computeSizeBasedSnapTolerance(n),Fn.computeSizeBasedSnapTolerance(i))},ai.isValid=function(n,i,s,u){return new ai(n,i,u).isValid(s)},_y.TOLERANCE.get=function(){return 1e-6},Object.defineProperties(ai,_y);var ui=function n(i){this._geomFactory=null,this._skipEmpty=!1,this._inputGeoms=null,this._geomFactory=n.extractFactory(i),this._inputGeoms=i};ui.prototype.extractElements=function(n,i){if(n===null)return null;for(var s=0;s<n.getNumGeometries();s++){var u=n.getGeometryN(s);this._skipEmpty&&u.isEmpty()||i.add(u)}},ui.prototype.combine=function(){for(var n=new O,i=this._inputGeoms.iterator();i.hasNext();){var s=i.next();this.extractElements(s,n)}return n.size()===0?this._geomFactory!==null?this._geomFactory.createGeometryCollection(null):null:this._geomFactory.buildGeometry(n)},ui.prototype.interfaces_=function(){return[]},ui.prototype.getClass=function(){return ui},ui.combine=function(){if(arguments.length===1){var n=arguments[0];return new ui(n).combine()}if(arguments.length===2){var i=arguments[0],s=arguments[1];return new ui(ui.createList(i,s)).combine()}if(arguments.length===3){var u=arguments[0],c=arguments[1],m=arguments[2];return new ui(ui.createList(u,c,m)).combine()}},ui.extractFactory=function(n){return n.isEmpty()?null:n.iterator().next().getFactory()},ui.createList=function(){if(arguments.length===2){var n=arguments[0],i=arguments[1],s=new O;return s.add(n),s.add(i),s}if(arguments.length===3){var u=arguments[0],c=arguments[1],m=arguments[2],E=new O;return E.add(u),E.add(c),E.add(m),E}};var kn=function(){this._inputPolys=null,this._geomFactory=null;var n=arguments[0];this._inputPolys=n,this._inputPolys===null&&(this._inputPolys=new O)},xy={STRTREE_NODE_CAPACITY:{configurable:!0}};kn.prototype.reduceToGeometries=function(n){for(var i=new O,s=n.iterator();s.hasNext();){var u=s.next(),c=null;X(u,ct)?c=this.unionTree(u):u instanceof Ct&&(c=u),i.add(c)}return i},kn.prototype.extractByEnvelope=function(n,i,s){for(var u=new O,c=0;c<i.getNumGeometries();c++){var m=i.getGeometryN(c);m.getEnvelopeInternal().intersects(n)?u.add(m):s.add(m)}return this._geomFactory.buildGeometry(u)},kn.prototype.unionOptimized=function(n,i){var s=n.getEnvelopeInternal(),u=i.getEnvelopeInternal();if(!s.intersects(u))return ui.combine(n,i);if(n.getNumGeometries()<=1&&i.getNumGeometries()<=1)return this.unionActual(n,i);var c=s.intersection(u);return this.unionUsingEnvelopeIntersection(n,i,c)},kn.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 n=new ry(kn.STRTREE_NODE_CAPACITY),i=this._inputPolys.iterator();i.hasNext();){var s=i.next();n.insert(s.getEnvelopeInternal(),s)}this._inputPolys=null;var u=n.itemsTree();return this.unionTree(u)},kn.prototype.binaryUnion=function(){if(arguments.length===1){var n=arguments[0];return this.binaryUnion(n,0,n.size())}if(arguments.length===3){var i=arguments[0],s=arguments[1],u=arguments[2];if(u-s<=1){var c=kn.getGeometry(i,s);return this.unionSafe(c,null)}if(u-s==2)return this.unionSafe(kn.getGeometry(i,s),kn.getGeometry(i,s+1));var m=Math.trunc((u+s)/2),E=this.binaryUnion(i,s,m),C=this.binaryUnion(i,m,u);return this.unionSafe(E,C)}},kn.prototype.repeatedUnion=function(n){for(var i=null,s=n.iterator();s.hasNext();){var u=s.next();i=i===null?u.copy():i.union(u)}return i},kn.prototype.unionSafe=function(n,i){return n===null&&i===null?null:n===null?i.copy():i===null?n.copy():this.unionOptimized(n,i)},kn.prototype.unionActual=function(n,i){return kn.restrictToPolygons(n.union(i))},kn.prototype.unionTree=function(n){var i=this.reduceToGeometries(n);return this.binaryUnion(i)},kn.prototype.unionUsingEnvelopeIntersection=function(n,i,s){var u=new O,c=this.extractByEnvelope(s,n,u),m=this.extractByEnvelope(s,i,u),E=this.unionActual(c,m);return u.add(E),ui.combine(u)},kn.prototype.bufferUnion=function(){if(arguments.length===1){var n=arguments[0];return n.get(0).getFactory().buildGeometry(n).buffer(0)}if(arguments.length===2){var i=arguments[0],s=arguments[1];return i.getFactory().createGeometryCollection([i,s]).buffer(0)}},kn.prototype.interfaces_=function(){return[]},kn.prototype.getClass=function(){return kn},kn.restrictToPolygons=function(n){if(X(n,re))return n;var i=wo.getPolygons(n);return i.size()===1?i.get(0):n.getFactory().createMultiPolygon(pe.toPolygonArray(i))},kn.getGeometry=function(n,i){return i>=n.size()?null:n.get(i)},kn.union=function(n){return new kn(n).union()},xy.STRTREE_NODE_CAPACITY.get=function(){return 4},Object.defineProperties(kn,xy);var fl=function(){};fl.prototype.interfaces_=function(){return[]},fl.prototype.getClass=function(){return fl},fl.union=function(n,i){if(n.isEmpty()||i.isEmpty()){if(n.isEmpty()&&i.isEmpty())return fe.createEmptyResult(fe.UNION,n,i,n.getFactory());if(n.isEmpty())return i.copy();if(i.isEmpty())return n.copy()}return n.checkNotGeometryCollection(n),n.checkNotGeometryCollection(i),br.overlayOp(n,i,fe.UNION)},r.GeoJSONReader=np,r.GeoJSONWriter=ey,r.OverlayOp=fe,r.UnionOp=fl,r.BufferOp=tr,Object.defineProperty(r,"__esModule",{value:!0})})});var gA=nt((Elt,mA)=>{mA.exports=function(t,e){return t[0]=e[0],t[1]=e[1],t}});var _A=nt((Mlt,vA)=>{var yA=gA();vA.exports=function(r,t){Array.isArray(t)||(t=[]),r.length>0&&t.push(yA([0,0],r[0]));for(var e=0;e<r.length-1;e++){var o=r[e],a=r[e+1],l=o[0],h=o[1],f=a[0],p=a[1],d=[.75*l+.25*f,.75*h+.25*p],g=[.25*l+.75*f,.25*h+.75*p];t.push(d),t.push(g)}return r.length>1&&t.push(yA([0,0],r[r.length-1])),t}});var bA=nt((Alt,wA)=>{"use strict";var D5=yc(),SA=Function.prototype,EA=SA.apply,MA=SA.call;wA.exports=typeof Reflect=="object"&&Reflect.apply||(D5?MA.bind(EA):function(){return MA.apply(EA,arguments)})});var RA=nt((Clt,IA)=>{"use strict";jc();var TA=Zo(),AA=yl(),F5=Kc(),CA=Ur(),PA=oo(),U5=Ja(),B5=PA("species"),Y0=RegExp.prototype;IA.exports=function(r,t,e,o){var a=PA(r),l=!CA(function(){var d={};return d[a]=function(){return 7},""[r](d)!==7}),h=l&&!CA(function(){var d=!1,g=/a/;return r==="split"&&(g={},g.constructor={},g.constructor[B5]=function(){return g},g.flags="",g[a]=/./[a]),g.exec=function(){return d=!0,null},g[a](""),!d});if(!l||!h||e){var f=/./[a],p=t(a,""[r],function(d,g,x,v,M){var b=g.exec;return b===F5||b===Y0.exec?l&&!M?{done:!0,value:TA(f,g,x,v)}:{done:!0,value:TA(d,x,g,v)}:{done:!1}});AA(String.prototype,r,p[0]),AA(Y0,a,p[1])}o&&U5(Y0[a],"sham",!0)}});var DA=nt((Plt,OA)=>{"use strict";var $0=li(),z5=vl(),G5=$c(),k5=Ya(),q5=$0("".charAt),LA=$0("".charCodeAt),V5=$0("".slice),NA=function(r){return function(t,e){var o=G5(k5(t)),a=z5(e),l=o.length,h,f;return a<0||a>=l?r?"":void 0:(h=LA(o,a),h<55296||h>56319||a+1===l||(f=LA(o,a+1))<56320||f>57343?r?q5(o,a):h:r?V5(o,a,a+2):(h-55296<<10)+(f-56320)+65536)}};OA.exports={codeAt:NA(!1),charAt:NA(!0)}});var UA=nt((Ilt,FA)=>{"use strict";var H5=DA().charAt;FA.exports=function(r,t,e){return t+(e?H5(r,t).length:1)}});var zA=nt((Rlt,BA)=>{"use strict";var K0=li(),W5=ml(),X5=Math.floor,Z0=K0("".charAt),Y5=K0("".replace),J0=K0("".slice),$5=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,Z5=/\$([$&'`]|\d{1,2})/g;BA.exports=function(r,t,e,o,a,l){var h=e+r.length,f=o.length,p=Z5;return a!==void 0&&(a=W5(a),p=$5),Y5(l,p,function(d,g){var x;switch(Z0(g,0)){case"$":return"$";case"&":return r;case"`":return J0(t,0,e);case"'":return J0(t,h);case"<":x=a[J0(g,1,-1)];break;default:var v=+g;if(v===0)return d;if(v>f){var M=X5(v/10);return M===0?d:M<=f?o[M-1]===void 0?Z0(g,1):o[M-1]+Z0(g,1):d}x=o[v-1]}return x===void 0?"":x})}});var qA=nt((Llt,kA)=>{"use strict";var GA=Zo(),J5=_s(),K5=Br(),j5=pl(),Q5=Kc(),tq=TypeError;kA.exports=function(r,t){var e=r.exec;if(K5(e)){var o=GA(e,r,t);return o!==null&&J5(o),o}if(j5(r)==="RegExp")return GA(Q5,r,t);throw new tq("RegExp#exec called on incompatible receiver")}});var YA=nt(()=>{"use strict";var eq=bA(),VA=Zo(),ep=li(),nq=RA(),rq=Ur(),iq=_s(),oq=Br(),sq=bo(),aq=vl(),uq=$p(),ju=$c(),lq=Ya(),cq=UA(),fq=wp(),hq=zA(),pq=qA(),dq=oo(),Q0=dq("replace"),mq=Math.max,gq=Math.min,yq=ep([].concat),j0=ep([].push),HA=ep("".indexOf),WA=ep("".slice),vq=function(r){return r===void 0?r:String(r)},_q=function(){return"a".replace(/./,"$0")==="$0"}(),XA=function(){return/./[Q0]?/./[Q0]("a","$0")==="":!1}(),xq=!rq(function(){var r=/./;return r.exec=function(){var t=[];return t.groups={a:"7"},t},"".replace(r,"$<a>")!=="7"});nq("replace",function(r,t,e){var o=XA?"$":"$0";return[function(l,h){var f=lq(this),p=sq(l)?fq(l,Q0):void 0;return p?VA(p,l,f,h):VA(t,ju(f),l,h)},function(a,l){var h=iq(this),f=ju(a);if(typeof l=="string"&&HA(l,o)===-1&&HA(l,"$<")===-1){var p=e(t,h,f,l);if(p.done)return p.value}var d=oq(l);d||(l=ju(l));var g=h.global,x;g&&(x=h.unicode,h.lastIndex=0);for(var v=[],M;M=pq(h,f),!(M===null||(j0(v,M),!g));){var b=ju(M[0]);b===""&&(h.lastIndex=cq(f,uq(h.lastIndex),x))}for(var T="",_=0,y=0;y<v.length;y++){M=v[y];for(var A=ju(M[0]),S=mq(gq(aq(M.index),f.length),0),L=[],G,z=1;z<M.length;z++)j0(L,vq(M[z]));var F=M.groups;if(d){var I=yq([A],L,S,f);F!==void 0&&j0(I,F),G=ju(eq(l,void 0,I))}else G=hq(A,f,S,L,F,l);S>=_&&(T+=WA(f,_,S)+G,_=S+A.length)}return T+WA(f,_)}]},!xq||!_q||XA)});function Xa(){return Xa=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var o=arguments[e];for(var a in o)Object.prototype.hasOwnProperty.call(o,a)&&(t[a]=o[a])}return t},Xa.apply(this,arguments)}var glt=gn(Uc(),1),ylt=gn(Xc(),1),vlt=gn(jc(),1),Uo=gn(S1(),1);var flt=gn(Xc(),1);var Wm="162";var LN=0,w1=1,NN=2;var ZE=1,ON=2,ns=3,Os=0,Ei=1,is=2,Is=0,xu=1,b1=2,T1=3,A1=4,DN=5,pa=100,FN=101,UN=102,C1=103,P1=104,BN=200,zN=201,GN=202,kN=203,rm=204,im=205,qN=206,VN=207,HN=208,WN=209,XN=210,YN=211,$N=212,ZN=213,JN=214,KN=0,jN=1,QN=2,bf=3,t2=4,e2=5,n2=6,r2=7,JE=0,i2=1,o2=2,Rs=0,s2=1,a2=2,u2=3,l2=4,c2=5,f2=6,h2=7;var KE=300,Su=301,wu=302,om=303,sm=304,Yf=306,am=1e3,co=1001,um=1002,hi=1003,I1=1004;var wl=1005;var _i=1006,Sd=1007;var ma=1008;var Ls=1009,p2=1010,d2=1011,Xm=1012,jE=1013,Ps=1014,os=1015,Nl=1016,QE=1017,tM=1018,ya=1020,m2=1021,fo=1023,g2=1024,y2=1025,va=1026,bu=1027,v2=1028,eM=1029,_2=1030,nM=1031,rM=1033,wd=33776,bd=33777,Td=33778,Ad=33779,R1=35840,L1=35841,N1=35842,O1=35843,iM=36196,D1=37492,F1=37496,U1=37808,B1=37809,z1=37810,G1=37811,k1=37812,q1=37813,V1=37814,H1=37815,W1=37816,X1=37817,Y1=37818,$1=37819,Z1=37820,J1=37821,Cd=36492,K1=36494,j1=36495,x2=36283,Q1=36284,tE=36285,eE=36286;var Tf=2300,Af=2301,Pd=2302,nE=2400,rE=2401,iE=2402;var E2=3200,M2=3201,S2=0,w2=1,Cs="",Ao="srgb",Bs="srgb-linear",Ym="display-p3",$f="display-p3-linear",Cf="linear",Un="srgb",Pf="rec709",If="p3";var ja=7680;var oE=519,b2=512,T2=513,A2=514,oM=515,C2=516,P2=517,I2=518,R2=519,lm=35044;var sE="300 es",cm=1035,ss=2e3,Rf=2001,Ds=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 a=this._listeners[t];if(a!==void 0){let l=a.indexOf(e);l!==-1&&a.splice(l,1)}}dispatchEvent(t){if(this._listeners===void 0)return;let o=this._listeners[t.type];if(o!==void 0){t.target=this;let a=o.slice(0);for(let l=0,h=a.length;l<h;l++)a[l].call(this,t);t.target=null}}},Jr=["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 Id=Math.PI/180,fm=180/Math.PI;function Ns(){let r=Math.random()*4294967295|0,t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,o=Math.random()*4294967295|0;return(Jr[r&255]+Jr[r>>8&255]+Jr[r>>16&255]+Jr[r>>24&255]+"-"+Jr[t&255]+Jr[t>>8&255]+"-"+Jr[t>>16&15|64]+Jr[t>>24&255]+"-"+Jr[e&63|128]+Jr[e>>8&255]+"-"+Jr[e>>16&255]+Jr[e>>24&255]+Jr[o&255]+Jr[o>>8&255]+Jr[o>>16&255]+Jr[o>>24&255]).toLowerCase()}function xi(r,t,e){return Math.max(t,Math.min(e,r))}function L2(r,t){return(r%t+t)%t}function Rd(r,t,e){return(1-e)*r+e*t}function aE(r){return(r&r-1)===0&&r!==0}function hm(r){return Math.pow(2,Math.floor(Math.log(r)/Math.LN2))}function Po(r,t){switch(t.constructor){case Float32Array:return r;case Uint32Array:return r/4294967295;case Uint16Array:return r/65535;case Uint8Array:return r/255;case Int32Array:return Math.max(r/2147483647,-1);case Int16Array:return Math.max(r/32767,-1);case Int8Array:return Math.max(r/127,-1);default:throw new Error("Invalid component type.")}}function An(r,t){switch(t.constructor){case Float32Array:return r;case Uint32Array:return Math.round(r*4294967295);case Uint16Array:return Math.round(r*65535);case Uint8Array:return Math.round(r*255);case Int32Array:return Math.round(r*2147483647);case Int16Array:return Math.round(r*32767);case Int8Array:return Math.round(r*127);default:throw new Error("Invalid component type.")}}var ye=class r{constructor(t=0,e=0){r.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,a=t.elements;return this.x=a[0]*e+a[3]*o+a[6],this.y=a[1]*e+a[4]*o+a[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(xi(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),a=Math.sin(e),l=this.x-t.x,h=this.y-t.y;return this.x=l*o-h*a+t.x,this.y=l*a+h*o+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},_e=class r{constructor(t,e,o,a,l,h,f,p,d){r.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],t!==void 0&&this.set(t,e,o,a,l,h,f,p,d)}set(t,e,o,a,l,h,f,p,d){let g=this.elements;return g[0]=t,g[1]=a,g[2]=f,g[3]=e,g[4]=l,g[5]=p,g[6]=o,g[7]=h,g[8]=d,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,a=e.elements,l=this.elements,h=o[0],f=o[3],p=o[6],d=o[1],g=o[4],x=o[7],v=o[2],M=o[5],b=o[8],T=a[0],_=a[3],y=a[6],A=a[1],S=a[4],L=a[7],G=a[2],z=a[5],F=a[8];return l[0]=h*T+f*A+p*G,l[3]=h*_+f*S+p*z,l[6]=h*y+f*L+p*F,l[1]=d*T+g*A+x*G,l[4]=d*_+g*S+x*z,l[7]=d*y+g*L+x*F,l[2]=v*T+M*A+b*G,l[5]=v*_+M*S+b*z,l[8]=v*y+M*L+b*F,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],a=t[2],l=t[3],h=t[4],f=t[5],p=t[6],d=t[7],g=t[8];return e*h*g-e*f*d-o*l*g+o*f*p+a*l*d-a*h*p}invert(){let t=this.elements,e=t[0],o=t[1],a=t[2],l=t[3],h=t[4],f=t[5],p=t[6],d=t[7],g=t[8],x=g*h-f*d,v=f*p-g*l,M=d*l-h*p,b=e*x+o*v+a*M;if(b===0)return this.set(0,0,0,0,0,0,0,0,0);let T=1/b;return t[0]=x*T,t[1]=(a*d-g*o)*T,t[2]=(f*o-a*h)*T,t[3]=v*T,t[4]=(g*e-a*p)*T,t[5]=(a*l-f*e)*T,t[6]=M*T,t[7]=(o*p-d*e)*T,t[8]=(h*e-o*l)*T,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,a,l,h,f){let p=Math.cos(l),d=Math.sin(l);return this.set(o*p,o*d,-o*(p*h+d*f)+h+t,-a*d,a*p,-a*(-d*h+p*f)+f+e,0,0,1),this}scale(t,e){return this.premultiply(Ld.makeScale(t,e)),this}rotate(t){return this.premultiply(Ld.makeRotation(-t)),this}translate(t,e){return this.premultiply(Ld.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 a=0;a<9;a++)if(e[a]!==o[a])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)}},Ld=new _e;function sM(r){for(let t=r.length-1;t>=0;--t)if(r[t]>=65535)return!0;return!1}function Lf(r){return document.createElementNS("http://www.w3.org/1999/xhtml",r)}function N2(){let r=Lf("canvas");return r.style.display="block",r}var uE={};function aM(r){r in uE||(uE[r]=!0,console.warn(r))}var lE=new _e().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),cE=new _e().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),Qc={[Bs]:{transfer:Cf,primaries:Pf,toReference:r=>r,fromReference:r=>r},[Ao]:{transfer:Un,primaries:Pf,toReference:r=>r.convertSRGBToLinear(),fromReference:r=>r.convertLinearToSRGB()},[$f]:{transfer:Cf,primaries:If,toReference:r=>r.applyMatrix3(cE),fromReference:r=>r.applyMatrix3(lE)},[Ym]:{transfer:Un,primaries:If,toReference:r=>r.convertSRGBToLinear().applyMatrix3(cE),fromReference:r=>r.applyMatrix3(lE).convertLinearToSRGB()}},O2=new Set([Bs,$f]),Cn={enabled:!0,_workingColorSpace:Bs,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(r){if(!O2.has(r))throw new Error(`Unsupported working color space, "${r}".`);this._workingColorSpace=r},convert:function(r,t,e){if(this.enabled===!1||t===e||!t||!e)return r;let o=Qc[t].toReference,a=Qc[e].fromReference;return a(o(r))},fromWorkingColorSpace:function(r,t){return this.convert(r,this._workingColorSpace,t)},toWorkingColorSpace:function(r,t){return this.convert(r,t,this._workingColorSpace)},getPrimaries:function(r){return Qc[r].primaries},getTransfer:function(r){return r===Cs?Cf:Qc[r].transfer}};function Eu(r){return r<.04045?r*.0773993808:Math.pow(r*.9478672986+.0521327014,2.4)}function Nd(r){return r<.0031308?r*12.92:1.055*Math.pow(r,.41666)-.055}var Qa,Nf=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{Qa===void 0&&(Qa=Lf("canvas")),Qa.width=t.width,Qa.height=t.height;let o=Qa.getContext("2d");t instanceof ImageData?o.putImageData(t,0,0):o.drawImage(t,0,0,t.width,t.height),e=Qa}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=Lf("canvas");e.width=t.width,e.height=t.height;let o=e.getContext("2d");o.drawImage(t,0,0,t.width,t.height);let a=o.getImageData(0,0,t.width,t.height),l=a.data;for(let h=0;h<l.length;h++)l[h]=Eu(l[h]/255)*255;return o.putImageData(a,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(Eu(e[o]/255)*255):e[o]=Eu(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}},D2=0,Of=class{constructor(t=null){this.isSource=!0,Object.defineProperty(this,"id",{value:D2++}),this.uuid=Ns(),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:""},a=this.data;if(a!==null){let l;if(Array.isArray(a)){l=[];for(let h=0,f=a.length;h<f;h++)a[h].isDataTexture?l.push(Od(a[h].image)):l.push(Od(a[h]))}else l=Od(a);o.url=l}return e||(t.images[this.uuid]=o),o}};function Od(r){return typeof HTMLImageElement!="undefined"&&r instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&r instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&r instanceof ImageBitmap?Nf.getDataURL(r):r.data?{data:Array.from(r.data),width:r.width,height:r.height,type:r.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}var F2=0,Hi=class r extends Ds{constructor(t=r.DEFAULT_IMAGE,e=r.DEFAULT_MAPPING,o=co,a=co,l=_i,h=ma,f=fo,p=Ls,d=r.DEFAULT_ANISOTROPY,g=Cs){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:F2++}),this.uuid=Ns(),this.name="",this.source=new Of(t),this.mipmaps=[],this.mapping=e,this.channel=0,this.wrapS=o,this.wrapT=a,this.magFilter=l,this.minFilter=h,this.anisotropy=d,this.format=f,this.internalFormat=null,this.type=p,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 _e,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=g,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!==KE)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case am:t.x=t.x-Math.floor(t.x);break;case co:t.x=t.x<0?0:1;break;case um: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 am:t.y=t.y-Math.floor(t.y);break;case co:t.y=t.y<0?0:1;break;case um: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)}};Hi.DEFAULT_IMAGE=null;Hi.DEFAULT_MAPPING=KE;Hi.DEFAULT_ANISOTROPY=1;var zr=class r{constructor(t=0,e=0,o=0,a=1){r.prototype.isVector4=!0,this.x=t,this.y=e,this.z=o,this.w=a}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,a){return this.x=t,this.y=e,this.z=o,this.w=a,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,a=this.z,l=this.w,h=t.elements;return this.x=h[0]*e+h[4]*o+h[8]*a+h[12]*l,this.y=h[1]*e+h[5]*o+h[9]*a+h[13]*l,this.z=h[2]*e+h[6]*o+h[10]*a+h[14]*l,this.w=h[3]*e+h[7]*o+h[11]*a+h[15]*l,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,a,l,p=t.elements,d=p[0],g=p[4],x=p[8],v=p[1],M=p[5],b=p[9],T=p[2],_=p[6],y=p[10];if(Math.abs(g-v)<.01&&Math.abs(x-T)<.01&&Math.abs(b-_)<.01){if(Math.abs(g+v)<.1&&Math.abs(x+T)<.1&&Math.abs(b+_)<.1&&Math.abs(d+M+y-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;let S=(d+1)/2,L=(M+1)/2,G=(y+1)/2,z=(g+v)/4,F=(x+T)/4,I=(b+_)/4;return S>L&&S>G?S<.01?(o=0,a=.707106781,l=.707106781):(o=Math.sqrt(S),a=z/o,l=F/o):L>G?L<.01?(o=.707106781,a=0,l=.707106781):(a=Math.sqrt(L),o=z/a,l=I/a):G<.01?(o=.707106781,a=.707106781,l=0):(l=Math.sqrt(G),o=F/l,a=I/l),this.set(o,a,l,e),this}let A=Math.sqrt((_-b)*(_-b)+(x-T)*(x-T)+(v-g)*(v-g));return Math.abs(A)<.001&&(A=1),this.x=(_-b)/A,this.y=(x-T)/A,this.z=(v-g)/A,this.w=Math.acos((d+M+y-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}},pm=class extends Ds{constructor(t=1,e=1,o={}){super(),this.isRenderTarget=!0,this.width=t,this.height=e,this.depth=1,this.scissor=new zr(0,0,t,e),this.scissorTest=!1,this.viewport=new zr(0,0,t,e);let a={width:t,height:e,depth:1};o=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:_i,depthBuffer:!0,stencilBuffer:!1,depthTexture:null,samples:0,count:1},o);let l=new Hi(a,o.mapping,o.wrapS,o.wrapT,o.magFilter,o.minFilter,o.format,o.type,o.anisotropy,o.colorSpace);l.flipY=!1,l.generateMipmaps=o.generateMipmaps,l.internalFormat=o.internalFormat,this.textures=[];let h=o.count;for(let f=0;f<h;f++)this.textures[f]=l.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 a=0,l=this.textures.length;a<l;a++)this.textures[a].image.width=t,this.textures[a].image.height=e,this.textures[a].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,a=t.textures.length;o<a;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 Of(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"})}},us=class extends pm{constructor(t=1,e=1,o={}){super(t,e,o),this.isWebGLRenderTarget=!0}},Df=class extends Hi{constructor(t=null,e=1,o=1,a=1){super(null),this.isDataArrayTexture=!0,this.image={data:t,width:e,height:o,depth:a},this.magFilter=hi,this.minFilter=hi,this.wrapR=co,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var dm=class extends Hi{constructor(t=null,e=1,o=1,a=1){super(null),this.isData3DTexture=!0,this.image={data:t,width:e,height:o,depth:a},this.magFilter=hi,this.minFilter=hi,this.wrapR=co,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var Fs=class{constructor(t=0,e=0,o=0,a=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=o,this._w=a}static slerpFlat(t,e,o,a,l,h,f){let p=o[a+0],d=o[a+1],g=o[a+2],x=o[a+3],v=l[h+0],M=l[h+1],b=l[h+2],T=l[h+3];if(f===0){t[e+0]=p,t[e+1]=d,t[e+2]=g,t[e+3]=x;return}if(f===1){t[e+0]=v,t[e+1]=M,t[e+2]=b,t[e+3]=T;return}if(x!==T||p!==v||d!==M||g!==b){let _=1-f,y=p*v+d*M+g*b+x*T,A=y>=0?1:-1,S=1-y*y;if(S>Number.EPSILON){let G=Math.sqrt(S),z=Math.atan2(G,y*A);_=Math.sin(_*z)/G,f=Math.sin(f*z)/G}let L=f*A;if(p=p*_+v*L,d=d*_+M*L,g=g*_+b*L,x=x*_+T*L,_===1-f){let G=1/Math.sqrt(p*p+d*d+g*g+x*x);p*=G,d*=G,g*=G,x*=G}}t[e]=p,t[e+1]=d,t[e+2]=g,t[e+3]=x}static multiplyQuaternionsFlat(t,e,o,a,l,h){let f=o[a],p=o[a+1],d=o[a+2],g=o[a+3],x=l[h],v=l[h+1],M=l[h+2],b=l[h+3];return t[e]=f*b+g*x+p*M-d*v,t[e+1]=p*b+g*v+d*x-f*M,t[e+2]=d*b+g*M+f*v-p*x,t[e+3]=g*b-f*x-p*v-d*M,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,a){return this._x=t,this._y=e,this._z=o,this._w=a,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,a=t._y,l=t._z,h=t._order,f=Math.cos,p=Math.sin,d=f(o/2),g=f(a/2),x=f(l/2),v=p(o/2),M=p(a/2),b=p(l/2);switch(h){case"XYZ":this._x=v*g*x+d*M*b,this._y=d*M*x-v*g*b,this._z=d*g*b+v*M*x,this._w=d*g*x-v*M*b;break;case"YXZ":this._x=v*g*x+d*M*b,this._y=d*M*x-v*g*b,this._z=d*g*b-v*M*x,this._w=d*g*x+v*M*b;break;case"ZXY":this._x=v*g*x-d*M*b,this._y=d*M*x+v*g*b,this._z=d*g*b+v*M*x,this._w=d*g*x-v*M*b;break;case"ZYX":this._x=v*g*x-d*M*b,this._y=d*M*x+v*g*b,this._z=d*g*b-v*M*x,this._w=d*g*x+v*M*b;break;case"YZX":this._x=v*g*x+d*M*b,this._y=d*M*x+v*g*b,this._z=d*g*b-v*M*x,this._w=d*g*x-v*M*b;break;case"XZY":this._x=v*g*x-d*M*b,this._y=d*M*x-v*g*b,this._z=d*g*b+v*M*x,this._w=d*g*x+v*M*b;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+h)}return e===!0&&this._onChangeCallback(),this}setFromAxisAngle(t,e){let o=e/2,a=Math.sin(o);return this._x=t.x*a,this._y=t.y*a,this._z=t.z*a,this._w=Math.cos(o),this._onChangeCallback(),this}setFromRotationMatrix(t){let e=t.elements,o=e[0],a=e[4],l=e[8],h=e[1],f=e[5],p=e[9],d=e[2],g=e[6],x=e[10],v=o+f+x;if(v>0){let M=.5/Math.sqrt(v+1);this._w=.25/M,this._x=(g-p)*M,this._y=(l-d)*M,this._z=(h-a)*M}else if(o>f&&o>x){let M=2*Math.sqrt(1+o-f-x);this._w=(g-p)/M,this._x=.25*M,this._y=(a+h)/M,this._z=(l+d)/M}else if(f>x){let M=2*Math.sqrt(1+f-o-x);this._w=(l-d)/M,this._x=(a+h)/M,this._y=.25*M,this._z=(p+g)/M}else{let M=2*Math.sqrt(1+x-o-f);this._w=(h-a)/M,this._x=(l+d)/M,this._y=(p+g)/M,this._z=.25*M}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(xi(this.dot(t),-1,1)))}rotateTowards(t,e){let o=this.angleTo(t);if(o===0)return this;let a=Math.min(1,e/o);return this.slerp(t,a),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,a=t._y,l=t._z,h=t._w,f=e._x,p=e._y,d=e._z,g=e._w;return this._x=o*g+h*f+a*d-l*p,this._y=a*g+h*p+l*f-o*d,this._z=l*g+h*d+o*p-a*f,this._w=h*g-o*f-a*p-l*d,this._onChangeCallback(),this}slerp(t,e){if(e===0)return this;if(e===1)return this.copy(t);let o=this._x,a=this._y,l=this._z,h=this._w,f=h*t._w+o*t._x+a*t._y+l*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=h,this._x=o,this._y=a,this._z=l,this;let p=1-f*f;if(p<=Number.EPSILON){let M=1-e;return this._w=M*h+e*this._w,this._x=M*o+e*this._x,this._y=M*a+e*this._y,this._z=M*l+e*this._z,this.normalize(),this}let d=Math.sqrt(p),g=Math.atan2(d,f),x=Math.sin((1-e)*g)/d,v=Math.sin(e*g)/d;return this._w=h*x+this._w*v,this._x=o*x+this._x*v,this._y=a*x+this._y*v,this._z=l*x+this._z*v,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(),a=Math.sqrt(1-o),l=Math.sqrt(o);return this.set(a*Math.sin(t),a*Math.cos(t),l*Math.sin(e),l*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}},yt=class r{constructor(t=0,e=0,o=0){r.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(fE.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(fE.setFromAxisAngle(t,e))}applyMatrix3(t){let e=this.x,o=this.y,a=this.z,l=t.elements;return this.x=l[0]*e+l[3]*o+l[6]*a,this.y=l[1]*e+l[4]*o+l[7]*a,this.z=l[2]*e+l[5]*o+l[8]*a,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){let e=this.x,o=this.y,a=this.z,l=t.elements,h=1/(l[3]*e+l[7]*o+l[11]*a+l[15]);return this.x=(l[0]*e+l[4]*o+l[8]*a+l[12])*h,this.y=(l[1]*e+l[5]*o+l[9]*a+l[13])*h,this.z=(l[2]*e+l[6]*o+l[10]*a+l[14])*h,this}applyQuaternion(t){let e=this.x,o=this.y,a=this.z,l=t.x,h=t.y,f=t.z,p=t.w,d=2*(h*a-f*o),g=2*(f*e-l*a),x=2*(l*o-h*e);return this.x=e+p*d+h*x-f*g,this.y=o+p*g+f*d-l*x,this.z=a+p*x+l*g-h*d,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,a=this.z,l=t.elements;return this.x=l[0]*e+l[4]*o+l[8]*a,this.y=l[1]*e+l[5]*o+l[9]*a,this.z=l[2]*e+l[6]*o+l[10]*a,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,a=t.y,l=t.z,h=e.x,f=e.y,p=e.z;return this.x=a*p-l*f,this.y=l*h-o*p,this.z=o*f-a*h,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 Dd.copy(this).projectOnVector(t),this.sub(Dd)}reflect(t){return this.sub(Dd.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(xi(o,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){let e=this.x-t.x,o=this.y-t.y,a=this.z-t.z;return e*e+o*o+a*a}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 a=Math.sin(e)*t;return this.x=a*Math.sin(o),this.y=Math.cos(e)*t,this.z=a*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(),a=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=o,this.z=a,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}},Dd=new yt,fE=new Fs,_a=class{constructor(t=new yt(1/0,1/0,1/0),e=new yt(-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(ao.fromArray(t,e));return this}setFromBufferAttribute(t){this.makeEmpty();for(let e=0,o=t.count;e<o;e++)this.expandByPoint(ao.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=ao.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 l=o.getAttribute("position");if(e===!0&&l!==void 0&&t.isInstancedMesh!==!0)for(let h=0,f=l.count;h<f;h++)t.isMesh===!0?t.getVertexPosition(h,ao):ao.fromBufferAttribute(l,h),ao.applyMatrix4(t.matrixWorld),this.expandByPoint(ao);else t.boundingBox!==void 0?(t.boundingBox===null&&t.computeBoundingBox(),tf.copy(t.boundingBox)):(o.boundingBox===null&&o.computeBoundingBox(),tf.copy(o.boundingBox)),tf.applyMatrix4(t.matrixWorld),this.union(tf)}let a=t.children;for(let l=0,h=a.length;l<h;l++)this.expandByObject(a[l],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,ao),ao.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(bl),ef.subVectors(this.max,bl),tu.subVectors(t.a,bl),eu.subVectors(t.b,bl),nu.subVectors(t.c,bl),Es.subVectors(eu,tu),Ms.subVectors(nu,eu),sa.subVectors(tu,nu);let e=[0,-Es.z,Es.y,0,-Ms.z,Ms.y,0,-sa.z,sa.y,Es.z,0,-Es.x,Ms.z,0,-Ms.x,sa.z,0,-sa.x,-Es.y,Es.x,0,-Ms.y,Ms.x,0,-sa.y,sa.x,0];return!Fd(e,tu,eu,nu,ef)||(e=[1,0,0,0,1,0,0,0,1],!Fd(e,tu,eu,nu,ef))?!1:(nf.crossVectors(Es,Ms),e=[nf.x,nf.y,nf.z],Fd(e,tu,eu,nu,ef))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,ao).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=this.getSize(ao).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:(Ko[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Ko[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Ko[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Ko[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Ko[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Ko[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Ko[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Ko[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Ko),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)}},Ko=[new yt,new yt,new yt,new yt,new yt,new yt,new yt,new yt],ao=new yt,tf=new _a,tu=new yt,eu=new yt,nu=new yt,Es=new yt,Ms=new yt,sa=new yt,bl=new yt,ef=new yt,nf=new yt,aa=new yt;function Fd(r,t,e,o,a){for(let l=0,h=r.length-3;l<=h;l+=3){aa.fromArray(r,l);let f=a.x*Math.abs(aa.x)+a.y*Math.abs(aa.y)+a.z*Math.abs(aa.z),p=t.dot(aa),d=e.dot(aa),g=o.dot(aa);if(Math.max(-Math.max(p,d,g),Math.min(p,d,g))>f)return!1}return!0}var U2=new _a,Tl=new yt,Ud=new yt,Ol=class{constructor(t=new yt,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):U2.setFromPoints(t).getCenter(o);let a=0;for(let l=0,h=t.length;l<h;l++)a=Math.max(a,o.distanceToSquared(t[l]));return this.radius=Math.sqrt(a),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;Tl.subVectors(t,this.center);let e=Tl.lengthSq();if(e>this.radius*this.radius){let o=Math.sqrt(e),a=(o-this.radius)*.5;this.center.addScaledVector(Tl,a/o),this.radius+=a}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):(Ud.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(Tl.copy(t.center).add(Ud)),this.expandByPoint(Tl.copy(t.center).sub(Ud))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return new this.constructor().copy(this)}},jo=new yt,Bd=new yt,rf=new yt,Ss=new yt,zd=new yt,of=new yt,Gd=new yt,mm=class{constructor(t=new yt,e=new yt(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,jo)),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=jo.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(jo.copy(this.origin).addScaledVector(this.direction,e),jo.distanceToSquared(t))}distanceSqToSegment(t,e,o,a){Bd.copy(t).add(e).multiplyScalar(.5),rf.copy(e).sub(t).normalize(),Ss.copy(this.origin).sub(Bd);let l=t.distanceTo(e)*.5,h=-this.direction.dot(rf),f=Ss.dot(this.direction),p=-Ss.dot(rf),d=Ss.lengthSq(),g=Math.abs(1-h*h),x,v,M,b;if(g>0)if(x=h*p-f,v=h*f-p,b=l*g,x>=0)if(v>=-b)if(v<=b){let T=1/g;x*=T,v*=T,M=x*(x+h*v+2*f)+v*(h*x+v+2*p)+d}else v=l,x=Math.max(0,-(h*v+f)),M=-x*x+v*(v+2*p)+d;else v=-l,x=Math.max(0,-(h*v+f)),M=-x*x+v*(v+2*p)+d;else v<=-b?(x=Math.max(0,-(-h*l+f)),v=x>0?-l:Math.min(Math.max(-l,-p),l),M=-x*x+v*(v+2*p)+d):v<=b?(x=0,v=Math.min(Math.max(-l,-p),l),M=v*(v+2*p)+d):(x=Math.max(0,-(h*l+f)),v=x>0?l:Math.min(Math.max(-l,-p),l),M=-x*x+v*(v+2*p)+d);else v=h>0?-l:l,x=Math.max(0,-(h*v+f)),M=-x*x+v*(v+2*p)+d;return o&&o.copy(this.origin).addScaledVector(this.direction,x),a&&a.copy(Bd).addScaledVector(rf,v),M}intersectSphere(t,e){jo.subVectors(t.center,this.origin);let o=jo.dot(this.direction),a=jo.dot(jo)-o*o,l=t.radius*t.radius;if(a>l)return null;let h=Math.sqrt(l-a),f=o-h,p=o+h;return p<0?null:f<0?this.at(p,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,a,l,h,f,p,d=1/this.direction.x,g=1/this.direction.y,x=1/this.direction.z,v=this.origin;return d>=0?(o=(t.min.x-v.x)*d,a=(t.max.x-v.x)*d):(o=(t.max.x-v.x)*d,a=(t.min.x-v.x)*d),g>=0?(l=(t.min.y-v.y)*g,h=(t.max.y-v.y)*g):(l=(t.max.y-v.y)*g,h=(t.min.y-v.y)*g),o>h||l>a||((l>o||isNaN(o))&&(o=l),(h<a||isNaN(a))&&(a=h),x>=0?(f=(t.min.z-v.z)*x,p=(t.max.z-v.z)*x):(f=(t.max.z-v.z)*x,p=(t.min.z-v.z)*x),o>p||f>a)||((f>o||o!==o)&&(o=f),(p<a||a!==a)&&(a=p),a<0)?null:this.at(o>=0?o:a,e)}intersectsBox(t){return this.intersectBox(t,jo)!==null}intersectTriangle(t,e,o,a,l){zd.subVectors(e,t),of.subVectors(o,t),Gd.crossVectors(zd,of);let h=this.direction.dot(Gd),f;if(h>0){if(a)return null;f=1}else if(h<0)f=-1,h=-h;else return null;Ss.subVectors(this.origin,t);let p=f*this.direction.dot(of.crossVectors(Ss,of));if(p<0)return null;let d=f*this.direction.dot(zd.cross(Ss));if(d<0||p+d>h)return null;let g=-f*Ss.dot(Gd);return g<0?null:this.at(g/h,l)}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)}},cr=class r{constructor(t,e,o,a,l,h,f,p,d,g,x,v,M,b,T,_){r.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,a,l,h,f,p,d,g,x,v,M,b,T,_)}set(t,e,o,a,l,h,f,p,d,g,x,v,M,b,T,_){let y=this.elements;return y[0]=t,y[4]=e,y[8]=o,y[12]=a,y[1]=l,y[5]=h,y[9]=f,y[13]=p,y[2]=d,y[6]=g,y[10]=x,y[14]=v,y[3]=M,y[7]=b,y[11]=T,y[15]=_,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 r().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,a=1/ru.setFromMatrixColumn(t,0).length(),l=1/ru.setFromMatrixColumn(t,1).length(),h=1/ru.setFromMatrixColumn(t,2).length();return e[0]=o[0]*a,e[1]=o[1]*a,e[2]=o[2]*a,e[3]=0,e[4]=o[4]*l,e[5]=o[5]*l,e[6]=o[6]*l,e[7]=0,e[8]=o[8]*h,e[9]=o[9]*h,e[10]=o[10]*h,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,a=t.y,l=t.z,h=Math.cos(o),f=Math.sin(o),p=Math.cos(a),d=Math.sin(a),g=Math.cos(l),x=Math.sin(l);if(t.order==="XYZ"){let v=h*g,M=h*x,b=f*g,T=f*x;e[0]=p*g,e[4]=-p*x,e[8]=d,e[1]=M+b*d,e[5]=v-T*d,e[9]=-f*p,e[2]=T-v*d,e[6]=b+M*d,e[10]=h*p}else if(t.order==="YXZ"){let v=p*g,M=p*x,b=d*g,T=d*x;e[0]=v+T*f,e[4]=b*f-M,e[8]=h*d,e[1]=h*x,e[5]=h*g,e[9]=-f,e[2]=M*f-b,e[6]=T+v*f,e[10]=h*p}else if(t.order==="ZXY"){let v=p*g,M=p*x,b=d*g,T=d*x;e[0]=v-T*f,e[4]=-h*x,e[8]=b+M*f,e[1]=M+b*f,e[5]=h*g,e[9]=T-v*f,e[2]=-h*d,e[6]=f,e[10]=h*p}else if(t.order==="ZYX"){let v=h*g,M=h*x,b=f*g,T=f*x;e[0]=p*g,e[4]=b*d-M,e[8]=v*d+T,e[1]=p*x,e[5]=T*d+v,e[9]=M*d-b,e[2]=-d,e[6]=f*p,e[10]=h*p}else if(t.order==="YZX"){let v=h*p,M=h*d,b=f*p,T=f*d;e[0]=p*g,e[4]=T-v*x,e[8]=b*x+M,e[1]=x,e[5]=h*g,e[9]=-f*g,e[2]=-d*g,e[6]=M*x+b,e[10]=v-T*x}else if(t.order==="XZY"){let v=h*p,M=h*d,b=f*p,T=f*d;e[0]=p*g,e[4]=-x,e[8]=d*g,e[1]=v*x+T,e[5]=h*g,e[9]=M*x-b,e[2]=b*x-M,e[6]=f*g,e[10]=T*x+v}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(B2,t,z2)}lookAt(t,e,o){let a=this.elements;return Ii.subVectors(t,e),Ii.lengthSq()===0&&(Ii.z=1),Ii.normalize(),ws.crossVectors(o,Ii),ws.lengthSq()===0&&(Math.abs(o.z)===1?Ii.x+=1e-4:Ii.z+=1e-4,Ii.normalize(),ws.crossVectors(o,Ii)),ws.normalize(),sf.crossVectors(Ii,ws),a[0]=ws.x,a[4]=sf.x,a[8]=Ii.x,a[1]=ws.y,a[5]=sf.y,a[9]=Ii.y,a[2]=ws.z,a[6]=sf.z,a[10]=Ii.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){let o=t.elements,a=e.elements,l=this.elements,h=o[0],f=o[4],p=o[8],d=o[12],g=o[1],x=o[5],v=o[9],M=o[13],b=o[2],T=o[6],_=o[10],y=o[14],A=o[3],S=o[7],L=o[11],G=o[15],z=a[0],F=a[4],I=a[8],ut=a[12],R=a[1],W=a[5],V=a[9],Mt=a[13],X=a[2],mt=a[6],dt=a[10],_t=a[14],it=a[3],lt=a[7],H=a[11],bt=a[15];return l[0]=h*z+f*R+p*X+d*it,l[4]=h*F+f*W+p*mt+d*lt,l[8]=h*I+f*V+p*dt+d*H,l[12]=h*ut+f*Mt+p*_t+d*bt,l[1]=g*z+x*R+v*X+M*it,l[5]=g*F+x*W+v*mt+M*lt,l[9]=g*I+x*V+v*dt+M*H,l[13]=g*ut+x*Mt+v*_t+M*bt,l[2]=b*z+T*R+_*X+y*it,l[6]=b*F+T*W+_*mt+y*lt,l[10]=b*I+T*V+_*dt+y*H,l[14]=b*ut+T*Mt+_*_t+y*bt,l[3]=A*z+S*R+L*X+G*it,l[7]=A*F+S*W+L*mt+G*lt,l[11]=A*I+S*V+L*dt+G*H,l[15]=A*ut+S*Mt+L*_t+G*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],a=t[8],l=t[12],h=t[1],f=t[5],p=t[9],d=t[13],g=t[2],x=t[6],v=t[10],M=t[14],b=t[3],T=t[7],_=t[11],y=t[15];return b*(+l*p*x-a*d*x-l*f*v+o*d*v+a*f*M-o*p*M)+T*(+e*p*M-e*d*v+l*h*v-a*h*M+a*d*g-l*p*g)+_*(+e*d*x-e*f*M-l*h*x+o*h*M+l*f*g-o*d*g)+y*(-a*f*g-e*p*x+e*f*v+a*h*x-o*h*v+o*p*g)}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 a=this.elements;return t.isVector3?(a[12]=t.x,a[13]=t.y,a[14]=t.z):(a[12]=t,a[13]=e,a[14]=o),this}invert(){let t=this.elements,e=t[0],o=t[1],a=t[2],l=t[3],h=t[4],f=t[5],p=t[6],d=t[7],g=t[8],x=t[9],v=t[10],M=t[11],b=t[12],T=t[13],_=t[14],y=t[15],A=x*_*d-T*v*d+T*p*M-f*_*M-x*p*y+f*v*y,S=b*v*d-g*_*d-b*p*M+h*_*M+g*p*y-h*v*y,L=g*T*d-b*x*d+b*f*M-h*T*M-g*f*y+h*x*y,G=b*x*p-g*T*p-b*f*v+h*T*v+g*f*_-h*x*_,z=e*A+o*S+a*L+l*G;if(z===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let F=1/z;return t[0]=A*F,t[1]=(T*v*l-x*_*l-T*a*M+o*_*M+x*a*y-o*v*y)*F,t[2]=(f*_*l-T*p*l+T*a*d-o*_*d-f*a*y+o*p*y)*F,t[3]=(x*p*l-f*v*l-x*a*d+o*v*d+f*a*M-o*p*M)*F,t[4]=S*F,t[5]=(g*_*l-b*v*l+b*a*M-e*_*M-g*a*y+e*v*y)*F,t[6]=(b*p*l-h*_*l-b*a*d+e*_*d+h*a*y-e*p*y)*F,t[7]=(h*v*l-g*p*l+g*a*d-e*v*d-h*a*M+e*p*M)*F,t[8]=L*F,t[9]=(b*x*l-g*T*l-b*o*M+e*T*M+g*o*y-e*x*y)*F,t[10]=(h*T*l-b*f*l+b*o*d-e*T*d-h*o*y+e*f*y)*F,t[11]=(g*f*l-h*x*l-g*o*d+e*x*d+h*o*M-e*f*M)*F,t[12]=G*F,t[13]=(g*T*a-b*x*a+b*o*v-e*T*v-g*o*_+e*x*_)*F,t[14]=(b*f*a-h*T*a-b*o*p+e*T*p+h*o*_-e*f*_)*F,t[15]=(h*x*a-g*f*a+g*o*p-e*x*p-h*o*v+e*f*v)*F,this}scale(t){let e=this.elements,o=t.x,a=t.y,l=t.z;return e[0]*=o,e[4]*=a,e[8]*=l,e[1]*=o,e[5]*=a,e[9]*=l,e[2]*=o,e[6]*=a,e[10]*=l,e[3]*=o,e[7]*=a,e[11]*=l,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],a=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,o,a))}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),a=Math.sin(e),l=1-o,h=t.x,f=t.y,p=t.z,d=l*h,g=l*f;return this.set(d*h+o,d*f-a*p,d*p+a*f,0,d*f+a*p,g*f+o,g*p-a*h,0,d*p-a*f,g*p+a*h,l*p*p+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,a,l,h){return this.set(1,o,l,0,t,1,h,0,e,a,1,0,0,0,0,1),this}compose(t,e,o){let a=this.elements,l=e._x,h=e._y,f=e._z,p=e._w,d=l+l,g=h+h,x=f+f,v=l*d,M=l*g,b=l*x,T=h*g,_=h*x,y=f*x,A=p*d,S=p*g,L=p*x,G=o.x,z=o.y,F=o.z;return a[0]=(1-(T+y))*G,a[1]=(M+L)*G,a[2]=(b-S)*G,a[3]=0,a[4]=(M-L)*z,a[5]=(1-(v+y))*z,a[6]=(_+A)*z,a[7]=0,a[8]=(b+S)*F,a[9]=(_-A)*F,a[10]=(1-(v+T))*F,a[11]=0,a[12]=t.x,a[13]=t.y,a[14]=t.z,a[15]=1,this}decompose(t,e,o){let a=this.elements,l=ru.set(a[0],a[1],a[2]).length(),h=ru.set(a[4],a[5],a[6]).length(),f=ru.set(a[8],a[9],a[10]).length();this.determinant()<0&&(l=-l),t.x=a[12],t.y=a[13],t.z=a[14],uo.copy(this);let d=1/l,g=1/h,x=1/f;return uo.elements[0]*=d,uo.elements[1]*=d,uo.elements[2]*=d,uo.elements[4]*=g,uo.elements[5]*=g,uo.elements[6]*=g,uo.elements[8]*=x,uo.elements[9]*=x,uo.elements[10]*=x,e.setFromRotationMatrix(uo),o.x=l,o.y=h,o.z=f,this}makePerspective(t,e,o,a,l,h,f=ss){let p=this.elements,d=2*l/(e-t),g=2*l/(o-a),x=(e+t)/(e-t),v=(o+a)/(o-a),M,b;if(f===ss)M=-(h+l)/(h-l),b=-2*h*l/(h-l);else if(f===Rf)M=-h/(h-l),b=-h*l/(h-l);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+f);return p[0]=d,p[4]=0,p[8]=x,p[12]=0,p[1]=0,p[5]=g,p[9]=v,p[13]=0,p[2]=0,p[6]=0,p[10]=M,p[14]=b,p[3]=0,p[7]=0,p[11]=-1,p[15]=0,this}makeOrthographic(t,e,o,a,l,h,f=ss){let p=this.elements,d=1/(e-t),g=1/(o-a),x=1/(h-l),v=(e+t)*d,M=(o+a)*g,b,T;if(f===ss)b=(h+l)*x,T=-2*x;else if(f===Rf)b=l*x,T=-1*x;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+f);return p[0]=2*d,p[4]=0,p[8]=0,p[12]=-v,p[1]=0,p[5]=2*g,p[9]=0,p[13]=-M,p[2]=0,p[6]=0,p[10]=T,p[14]=-b,p[3]=0,p[7]=0,p[11]=0,p[15]=1,this}equals(t){let e=this.elements,o=t.elements;for(let a=0;a<16;a++)if(e[a]!==o[a])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}},ru=new yt,uo=new cr,B2=new yt(0,0,0),z2=new yt(1,1,1),ws=new yt,sf=new yt,Ii=new yt,hE=new cr,pE=new Fs,xa=class r{constructor(t=0,e=0,o=0,a=r.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=e,this._z=o,this._order=a}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,a=this._order){return this._x=t,this._y=e,this._z=o,this._order=a,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 a=t.elements,l=a[0],h=a[4],f=a[8],p=a[1],d=a[5],g=a[9],x=a[2],v=a[6],M=a[10];switch(e){case"XYZ":this._y=Math.asin(xi(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(-g,M),this._z=Math.atan2(-h,l)):(this._x=Math.atan2(v,d),this._z=0);break;case"YXZ":this._x=Math.asin(-xi(g,-1,1)),Math.abs(g)<.9999999?(this._y=Math.atan2(f,M),this._z=Math.atan2(p,d)):(this._y=Math.atan2(-x,l),this._z=0);break;case"ZXY":this._x=Math.asin(xi(v,-1,1)),Math.abs(v)<.9999999?(this._y=Math.atan2(-x,M),this._z=Math.atan2(-h,d)):(this._y=0,this._z=Math.atan2(p,l));break;case"ZYX":this._y=Math.asin(-xi(x,-1,1)),Math.abs(x)<.9999999?(this._x=Math.atan2(v,M),this._z=Math.atan2(p,l)):(this._x=0,this._z=Math.atan2(-h,d));break;case"YZX":this._z=Math.asin(xi(p,-1,1)),Math.abs(p)<.9999999?(this._x=Math.atan2(-g,d),this._y=Math.atan2(-x,l)):(this._x=0,this._y=Math.atan2(f,M));break;case"XZY":this._z=Math.asin(-xi(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(v,d),this._y=Math.atan2(f,l)):(this._x=Math.atan2(-g,M),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 hE.makeRotationFromQuaternion(t),this.setFromRotationMatrix(hE,e,o)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return pE.setFromEuler(this),this.setFromQuaternion(pE,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}};xa.DEFAULT_ORDER="XYZ";var Ff=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}},G2=0,dE=new yt,iu=new Fs,Qo=new cr,af=new yt,Al=new yt,k2=new yt,q2=new Fs,mE=new yt(1,0,0),gE=new yt(0,1,0),yE=new yt(0,0,1),V2={type:"added"},H2={type:"removed"},kd={type:"childadded",child:null},qd={type:"childremoved",child:null},po=class r extends Ds{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:G2++}),this.uuid=Ns(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=r.DEFAULT_UP.clone();let t=new yt,e=new xa,o=new Fs,a=new yt(1,1,1);function l(){o.setFromEuler(e,!1)}function h(){e.setFromQuaternion(o,void 0,!1)}e._onChange(l),o._onChange(h),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:a},modelViewMatrix:{value:new cr},normalMatrix:{value:new _e}}),this.matrix=new cr,this.matrixWorld=new cr,this.matrixAutoUpdate=r.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=r.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Ff,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 iu.setFromAxisAngle(t,e),this.quaternion.multiply(iu),this}rotateOnWorldAxis(t,e){return iu.setFromAxisAngle(t,e),this.quaternion.premultiply(iu),this}rotateX(t){return this.rotateOnAxis(mE,t)}rotateY(t){return this.rotateOnAxis(gE,t)}rotateZ(t){return this.rotateOnAxis(yE,t)}translateOnAxis(t,e){return dE.copy(t).applyQuaternion(this.quaternion),this.position.add(dE.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(mE,t)}translateY(t){return this.translateOnAxis(gE,t)}translateZ(t){return this.translateOnAxis(yE,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(Qo.copy(this.matrixWorld).invert())}lookAt(t,e,o){t.isVector3?af.copy(t):af.set(t,e,o);let a=this.parent;this.updateWorldMatrix(!0,!1),Al.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Qo.lookAt(Al,af,this.up):Qo.lookAt(af,Al,this.up),this.quaternion.setFromRotationMatrix(Qo),a&&(Qo.extractRotation(a.matrixWorld),iu.setFromRotationMatrix(Qo),this.quaternion.premultiply(iu.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(V2),kd.child=t,this.dispatchEvent(kd),kd.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(H2),qd.child=t,this.dispatchEvent(qd),qd.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),Qo.copy(this.matrixWorld).invert(),t.parent!==null&&(t.parent.updateWorldMatrix(!0,!1),Qo.multiply(t.parent.matrixWorld)),t.applyMatrix4(Qo),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,a=this.children.length;o<a;o++){let h=this.children[o].getObjectByProperty(t,e);if(h!==void 0)return h}}getObjectsByProperty(t,e,o=[]){this[t]===e&&o.push(this);let a=this.children;for(let l=0,h=a.length;l<h;l++)a[l].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(Al,t,k2),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Al,q2,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,a=e.length;o<a;o++)e[o].traverse(t)}traverseVisible(t){if(this.visible===!1)return;t(this);let e=this.children;for(let o=0,a=e.length;o<a;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,a=e.length;o<a;o++){let l=e[o];(l.matrixWorldAutoUpdate===!0||t===!0)&&l.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 a=this.children;for(let l=0,h=a.length;l<h;l++){let f=a[l];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 a={};a.uuid=this.uuid,a.type=this.type,this.name!==""&&(a.name=this.name),this.castShadow===!0&&(a.castShadow=!0),this.receiveShadow===!0&&(a.receiveShadow=!0),this.visible===!1&&(a.visible=!1),this.frustumCulled===!1&&(a.frustumCulled=!1),this.renderOrder!==0&&(a.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(a.userData=this.userData),a.layers=this.layers.mask,a.matrix=this.matrix.toArray(),a.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(a.matrixAutoUpdate=!1),this.isInstancedMesh&&(a.type="InstancedMesh",a.count=this.count,a.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(a.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(a.type="BatchedMesh",a.perObjectFrustumCulled=this.perObjectFrustumCulled,a.sortObjects=this.sortObjects,a.drawRanges=this._drawRanges,a.reservedRanges=this._reservedRanges,a.visibility=this._visibility,a.active=this._active,a.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()})),a.maxGeometryCount=this._maxGeometryCount,a.maxVertexCount=this._maxVertexCount,a.maxIndexCount=this._maxIndexCount,a.geometryInitialized=this._geometryInitialized,a.geometryCount=this._geometryCount,a.matricesTexture=this._matricesTexture.toJSON(t),this.boundingSphere!==null&&(a.boundingSphere={center:a.boundingSphere.center.toArray(),radius:a.boundingSphere.radius}),this.boundingBox!==null&&(a.boundingBox={min:a.boundingBox.min.toArray(),max:a.boundingBox.max.toArray()}));function l(f,p){return f[p.uuid]===void 0&&(f[p.uuid]=p.toJSON(t)),p.uuid}if(this.isScene)this.background&&(this.background.isColor?a.background=this.background.toJSON():this.background.isTexture&&(a.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(a.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){a.geometry=l(t.geometries,this.geometry);let f=this.geometry.parameters;if(f!==void 0&&f.shapes!==void 0){let p=f.shapes;if(Array.isArray(p))for(let d=0,g=p.length;d<g;d++){let x=p[d];l(t.shapes,x)}else l(t.shapes,p)}}if(this.isSkinnedMesh&&(a.bindMode=this.bindMode,a.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(l(t.skeletons,this.skeleton),a.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let f=[];for(let p=0,d=this.material.length;p<d;p++)f.push(l(t.materials,this.material[p]));a.material=f}else a.material=l(t.materials,this.material);if(this.children.length>0){a.children=[];for(let f=0;f<this.children.length;f++)a.children.push(this.children[f].toJSON(t).object)}if(this.animations.length>0){a.animations=[];for(let f=0;f<this.animations.length;f++){let p=this.animations[f];a.animations.push(l(t.animations,p))}}if(e){let f=h(t.geometries),p=h(t.materials),d=h(t.textures),g=h(t.images),x=h(t.shapes),v=h(t.skeletons),M=h(t.animations),b=h(t.nodes);f.length>0&&(o.geometries=f),p.length>0&&(o.materials=p),d.length>0&&(o.textures=d),g.length>0&&(o.images=g),x.length>0&&(o.shapes=x),v.length>0&&(o.skeletons=v),M.length>0&&(o.animations=M),b.length>0&&(o.nodes=b)}return o.object=a,o;function h(f){let p=[];for(let d in f){let g=f[d];delete g.metadata,p.push(g)}return p}}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 a=t.children[o];this.add(a.clone())}return this}};po.DEFAULT_UP=new yt(0,1,0);po.DEFAULT_MATRIX_AUTO_UPDATE=!0;po.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var lo=new yt,ts=new yt,Vd=new yt,es=new yt,ou=new yt,su=new yt,vE=new yt,Hd=new yt,Wd=new yt,Xd=new yt,ga=class r{constructor(t=new yt,e=new yt,o=new yt){this.a=t,this.b=e,this.c=o}static getNormal(t,e,o,a){a.subVectors(o,e),lo.subVectors(t,e),a.cross(lo);let l=a.lengthSq();return l>0?a.multiplyScalar(1/Math.sqrt(l)):a.set(0,0,0)}static getBarycoord(t,e,o,a,l){lo.subVectors(a,e),ts.subVectors(o,e),Vd.subVectors(t,e);let h=lo.dot(lo),f=lo.dot(ts),p=lo.dot(Vd),d=ts.dot(ts),g=ts.dot(Vd),x=h*d-f*f;if(x===0)return l.set(0,0,0),null;let v=1/x,M=(d*p-f*g)*v,b=(h*g-f*p)*v;return l.set(1-M-b,b,M)}static containsPoint(t,e,o,a){return this.getBarycoord(t,e,o,a,es)===null?!1:es.x>=0&&es.y>=0&&es.x+es.y<=1}static getInterpolation(t,e,o,a,l,h,f,p){return this.getBarycoord(t,e,o,a,es)===null?(p.x=0,p.y=0,"z"in p&&(p.z=0),"w"in p&&(p.w=0),null):(p.setScalar(0),p.addScaledVector(l,es.x),p.addScaledVector(h,es.y),p.addScaledVector(f,es.z),p)}static isFrontFacing(t,e,o,a){return lo.subVectors(o,e),ts.subVectors(t,e),lo.cross(ts).dot(a)<0}set(t,e,o){return this.a.copy(t),this.b.copy(e),this.c.copy(o),this}setFromPointsAndIndices(t,e,o,a){return this.a.copy(t[e]),this.b.copy(t[o]),this.c.copy(t[a]),this}setFromAttributeAndIndices(t,e,o,a){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,o),this.c.fromBufferAttribute(t,a),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 lo.subVectors(this.c,this.b),ts.subVectors(this.a,this.b),lo.cross(ts).length()*.5}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return r.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return r.getBarycoord(t,this.a,this.b,this.c,e)}getInterpolation(t,e,o,a,l){return r.getInterpolation(t,this.a,this.b,this.c,e,o,a,l)}containsPoint(t){return r.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return r.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){let o=this.a,a=this.b,l=this.c,h,f;ou.subVectors(a,o),su.subVectors(l,o),Hd.subVectors(t,o);let p=ou.dot(Hd),d=su.dot(Hd);if(p<=0&&d<=0)return e.copy(o);Wd.subVectors(t,a);let g=ou.dot(Wd),x=su.dot(Wd);if(g>=0&&x<=g)return e.copy(a);let v=p*x-g*d;if(v<=0&&p>=0&&g<=0)return h=p/(p-g),e.copy(o).addScaledVector(ou,h);Xd.subVectors(t,l);let M=ou.dot(Xd),b=su.dot(Xd);if(b>=0&&M<=b)return e.copy(l);let T=M*d-p*b;if(T<=0&&d>=0&&b<=0)return f=d/(d-b),e.copy(o).addScaledVector(su,f);let _=g*b-M*x;if(_<=0&&x-g>=0&&M-b>=0)return vE.subVectors(l,a),f=(x-g)/(x-g+(M-b)),e.copy(a).addScaledVector(vE,f);let y=1/(_+T+v);return h=T*y,f=v*y,e.copy(o).addScaledVector(ou,h).addScaledVector(su,f)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}},uM={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},bs={h:0,s:0,l:0},uf={h:0,s:0,l:0};function Yd(r,t,e){return e<0&&(e+=1),e>1&&(e-=1),e<1/6?r+(t-r)*6*e:e<1/2?t:e<2/3?r+(t-r)*6*(2/3-e):r}var vn=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 a=t;a&&a.isColor?this.copy(a):typeof a=="number"?this.setHex(a):typeof a=="string"&&this.setStyle(a)}else this.setRGB(t,e,o);return this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=Ao){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(t&255)/255,Cn.toWorkingColorSpace(this,e),this}setRGB(t,e,o,a=Cn.workingColorSpace){return this.r=t,this.g=e,this.b=o,Cn.toWorkingColorSpace(this,a),this}setHSL(t,e,o,a=Cn.workingColorSpace){if(t=L2(t,1),e=xi(e,0,1),o=xi(o,0,1),e===0)this.r=this.g=this.b=o;else{let l=o<=.5?o*(1+e):o+e-o*e,h=2*o-l;this.r=Yd(h,l,t+1/3),this.g=Yd(h,l,t),this.b=Yd(h,l,t-1/3)}return Cn.toWorkingColorSpace(this,a),this}setStyle(t,e=Ao){function o(l){l!==void 0&&parseFloat(l)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}let a;if(a=/^(\w+)\(([^\)]*)\)/.exec(t)){let l,h=a[1],f=a[2];switch(h){case"rgb":case"rgba":if(l=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(f))return o(l[4]),this.setRGB(Math.min(255,parseInt(l[1],10))/255,Math.min(255,parseInt(l[2],10))/255,Math.min(255,parseInt(l[3],10))/255,e);if(l=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(f))return o(l[4]),this.setRGB(Math.min(100,parseInt(l[1],10))/100,Math.min(100,parseInt(l[2],10))/100,Math.min(100,parseInt(l[3],10))/100,e);break;case"hsl":case"hsla":if(l=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(f))return o(l[4]),this.setHSL(parseFloat(l[1])/360,parseFloat(l[2])/100,parseFloat(l[3])/100,e);break;default:console.warn("THREE.Color: Unknown color model "+t)}}else if(a=/^\#([A-Fa-f\d]+)$/.exec(t)){let l=a[1],h=l.length;if(h===3)return this.setRGB(parseInt(l.charAt(0),16)/15,parseInt(l.charAt(1),16)/15,parseInt(l.charAt(2),16)/15,e);if(h===6)return this.setHex(parseInt(l,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=Ao){let o=uM[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=Eu(t.r),this.g=Eu(t.g),this.b=Eu(t.b),this}copyLinearToSRGB(t){return this.r=Nd(t.r),this.g=Nd(t.g),this.b=Nd(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=Ao){return Cn.fromWorkingColorSpace(Kr.copy(this),t),Math.round(xi(Kr.r*255,0,255))*65536+Math.round(xi(Kr.g*255,0,255))*256+Math.round(xi(Kr.b*255,0,255))}getHexString(t=Ao){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=Cn.workingColorSpace){Cn.fromWorkingColorSpace(Kr.copy(this),e);let o=Kr.r,a=Kr.g,l=Kr.b,h=Math.max(o,a,l),f=Math.min(o,a,l),p,d,g=(f+h)/2;if(f===h)p=0,d=0;else{let x=h-f;switch(d=g<=.5?x/(h+f):x/(2-h-f),h){case o:p=(a-l)/x+(a<l?6:0);break;case a:p=(l-o)/x+2;break;case l:p=(o-a)/x+4;break}p/=6}return t.h=p,t.s=d,t.l=g,t}getRGB(t,e=Cn.workingColorSpace){return Cn.fromWorkingColorSpace(Kr.copy(this),e),t.r=Kr.r,t.g=Kr.g,t.b=Kr.b,t}getStyle(t=Ao){Cn.fromWorkingColorSpace(Kr.copy(this),t);let e=Kr.r,o=Kr.g,a=Kr.b;return t!==Ao?`color(${t} ${e.toFixed(3)} ${o.toFixed(3)} ${a.toFixed(3)})`:`rgb(${Math.round(e*255)},${Math.round(o*255)},${Math.round(a*255)})`}offsetHSL(t,e,o){return this.getHSL(bs),this.setHSL(bs.h+t,bs.s+e,bs.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(bs),t.getHSL(uf);let o=Rd(bs.h,uf.h,e),a=Rd(bs.s,uf.s,e),l=Rd(bs.l,uf.l,e);return this.setHSL(o,a,l),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,a=this.b,l=t.elements;return this.r=l[0]*e+l[3]*o+l[6]*a,this.g=l[1]*e+l[4]*o+l[7]*a,this.b=l[2]*e+l[5]*o+l[8]*a,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}},Kr=new vn;vn.NAMES=uM;var W2=0,Ea=class extends Ds{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:W2++}),this.uuid=Ns(),this.name="",this.type="Material",this.blending=xu,this.side=Os,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=rm,this.blendDst=im,this.blendEquation=pa,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new vn(0,0,0),this.blendAlpha=0,this.depthFunc=bf,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=oE,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=ja,this.stencilZFail=ja,this.stencilZPass=ja,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 a=this[e];if(a===void 0){console.warn(`THREE.Material: '${e}' is not a property of THREE.${this.type}.`);continue}a&&a.isColor?a.set(o):a&&a.isVector3&&o&&o.isVector3?a.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!==xu&&(o.blending=this.blending),this.side!==Os&&(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!==rm&&(o.blendSrc=this.blendSrc),this.blendDst!==im&&(o.blendDst=this.blendDst),this.blendEquation!==pa&&(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!==bf&&(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!==oE&&(o.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(o.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(o.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==ja&&(o.stencilFail=this.stencilFail),this.stencilZFail!==ja&&(o.stencilZFail=this.stencilZFail),this.stencilZPass!==ja&&(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 a(l){let h=[];for(let f in l){let p=l[f];delete p.metadata,h.push(p)}return h}if(e){let l=a(t.textures),h=a(t.images);l.length>0&&(o.textures=l),h.length>0&&(o.images=h)}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 a=e.length;o=new Array(a);for(let l=0;l!==a;++l)o[l]=e[l].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++}},Uf=class extends Ea{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new vn(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 xa,this.combine=JE,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 or=new yt,lf=new ye,Ni=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=lm,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=os,this.version=0}onUploadCallback(){}set needsUpdate(t){t===!0&&this.version++}get updateRange(){return aM("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 a=0,l=this.itemSize;a<l;a++)this.array[t+a]=e.array[o+a];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++)lf.fromBufferAttribute(this,e),lf.applyMatrix3(t),this.setXY(e,lf.x,lf.y);else if(this.itemSize===3)for(let e=0,o=this.count;e<o;e++)or.fromBufferAttribute(this,e),or.applyMatrix3(t),this.setXYZ(e,or.x,or.y,or.z);return this}applyMatrix4(t){for(let e=0,o=this.count;e<o;e++)or.fromBufferAttribute(this,e),or.applyMatrix4(t),this.setXYZ(e,or.x,or.y,or.z);return this}applyNormalMatrix(t){for(let e=0,o=this.count;e<o;e++)or.fromBufferAttribute(this,e),or.applyNormalMatrix(t),this.setXYZ(e,or.x,or.y,or.z);return this}transformDirection(t){for(let e=0,o=this.count;e<o;e++)or.fromBufferAttribute(this,e),or.transformDirection(t),this.setXYZ(e,or.x,or.y,or.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=Po(o,this.array)),o}setComponent(t,e,o){return this.normalized&&(o=An(o,this.array)),this.array[t*this.itemSize+e]=o,this}getX(t){let e=this.array[t*this.itemSize];return this.normalized&&(e=Po(e,this.array)),e}setX(t,e){return this.normalized&&(e=An(e,this.array)),this.array[t*this.itemSize]=e,this}getY(t){let e=this.array[t*this.itemSize+1];return this.normalized&&(e=Po(e,this.array)),e}setY(t,e){return this.normalized&&(e=An(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=Po(e,this.array)),e}setZ(t,e){return this.normalized&&(e=An(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=Po(e,this.array)),e}setW(t,e){return this.normalized&&(e=An(e,this.array)),this.array[t*this.itemSize+3]=e,this}setXY(t,e,o){return t*=this.itemSize,this.normalized&&(e=An(e,this.array),o=An(o,this.array)),this.array[t+0]=e,this.array[t+1]=o,this}setXYZ(t,e,o,a){return t*=this.itemSize,this.normalized&&(e=An(e,this.array),o=An(o,this.array),a=An(a,this.array)),this.array[t+0]=e,this.array[t+1]=o,this.array[t+2]=a,this}setXYZW(t,e,o,a,l){return t*=this.itemSize,this.normalized&&(e=An(e,this.array),o=An(o,this.array),a=An(a,this.array),l=An(l,this.array)),this.array[t+0]=e,this.array[t+1]=o,this.array[t+2]=a,this.array[t+3]=l,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!==lm&&(t.usage=this.usage),t}};var Bf=class extends Ni{constructor(t,e,o){super(new Uint16Array(t),e,o)}};var zf=class extends Ni{constructor(t,e,o){super(new Uint32Array(t),e,o)}};var as=class extends Ni{constructor(t,e,o){super(new Float32Array(t),e,o)}},X2=0,Vi=new cr,$d=new po,au=new yt,Ri=new _a,Cl=new _a,Ar=new yt,Us=class r extends Ds{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:X2++}),this.uuid=Ns(),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(sM(t)?zf:Bf)(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 l=new _e().getNormalMatrix(t);o.applyNormalMatrix(l),o.needsUpdate=!0}let a=this.attributes.tangent;return a!==void 0&&(a.transformDirection(t),a.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(t){return Vi.makeRotationFromQuaternion(t),this.applyMatrix4(Vi),this}rotateX(t){return Vi.makeRotationX(t),this.applyMatrix4(Vi),this}rotateY(t){return Vi.makeRotationY(t),this.applyMatrix4(Vi),this}rotateZ(t){return Vi.makeRotationZ(t),this.applyMatrix4(Vi),this}translate(t,e,o){return Vi.makeTranslation(t,e,o),this.applyMatrix4(Vi),this}scale(t,e,o){return Vi.makeScale(t,e,o),this.applyMatrix4(Vi),this}lookAt(t){return $d.lookAt(t),$d.updateMatrix(),this.applyMatrix4($d.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(au).negate(),this.translate(au.x,au.y,au.z),this}setFromPoints(t){let e=[];for(let o=0,a=t.length;o<a;o++){let l=t[o];e.push(l.x,l.y,l.z||0)}return this.setAttribute("position",new as(e,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new _a);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 yt(-1/0,-1/0,-1/0),new yt(1/0,1/0,1/0));return}if(t!==void 0){if(this.boundingBox.setFromBufferAttribute(t),e)for(let o=0,a=e.length;o<a;o++){let l=e[o];Ri.setFromBufferAttribute(l),this.morphTargetsRelative?(Ar.addVectors(this.boundingBox.min,Ri.min),this.boundingBox.expandByPoint(Ar),Ar.addVectors(this.boundingBox.max,Ri.max),this.boundingBox.expandByPoint(Ar)):(this.boundingBox.expandByPoint(Ri.min),this.boundingBox.expandByPoint(Ri.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 Ol);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 yt,1/0);return}if(t){let o=this.boundingSphere.center;if(Ri.setFromBufferAttribute(t),e)for(let l=0,h=e.length;l<h;l++){let f=e[l];Cl.setFromBufferAttribute(f),this.morphTargetsRelative?(Ar.addVectors(Ri.min,Cl.min),Ri.expandByPoint(Ar),Ar.addVectors(Ri.max,Cl.max),Ri.expandByPoint(Ar)):(Ri.expandByPoint(Cl.min),Ri.expandByPoint(Cl.max))}Ri.getCenter(o);let a=0;for(let l=0,h=t.count;l<h;l++)Ar.fromBufferAttribute(t,l),a=Math.max(a,o.distanceToSquared(Ar));if(e)for(let l=0,h=e.length;l<h;l++){let f=e[l],p=this.morphTargetsRelative;for(let d=0,g=f.count;d<g;d++)Ar.fromBufferAttribute(f,d),p&&(au.fromBufferAttribute(t,d),Ar.add(au)),a=Math.max(a,o.distanceToSquared(Ar))}this.boundingSphere.radius=Math.sqrt(a),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,a=e.normal,l=e.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new Ni(new Float32Array(4*o.count),4));let h=this.getAttribute("tangent"),f=[],p=[];for(let I=0;I<o.count;I++)f[I]=new yt,p[I]=new yt;let d=new yt,g=new yt,x=new yt,v=new ye,M=new ye,b=new ye,T=new yt,_=new yt;function y(I,ut,R){d.fromBufferAttribute(o,I),g.fromBufferAttribute(o,ut),x.fromBufferAttribute(o,R),v.fromBufferAttribute(l,I),M.fromBufferAttribute(l,ut),b.fromBufferAttribute(l,R),g.sub(d),x.sub(d),M.sub(v),b.sub(v);let W=1/(M.x*b.y-b.x*M.y);isFinite(W)&&(T.copy(g).multiplyScalar(b.y).addScaledVector(x,-M.y).multiplyScalar(W),_.copy(x).multiplyScalar(M.x).addScaledVector(g,-b.x).multiplyScalar(W),f[I].add(T),f[ut].add(T),f[R].add(T),p[I].add(_),p[ut].add(_),p[R].add(_))}let A=this.groups;A.length===0&&(A=[{start:0,count:t.count}]);for(let I=0,ut=A.length;I<ut;++I){let R=A[I],W=R.start,V=R.count;for(let Mt=W,X=W+V;Mt<X;Mt+=3)y(t.getX(Mt+0),t.getX(Mt+1),t.getX(Mt+2))}let S=new yt,L=new yt,G=new yt,z=new yt;function F(I){G.fromBufferAttribute(a,I),z.copy(G);let ut=f[I];S.copy(ut),S.sub(G.multiplyScalar(G.dot(ut))).normalize(),L.crossVectors(z,ut);let W=L.dot(p[I])<0?-1:1;h.setXYZW(I,S.x,S.y,S.z,W)}for(let I=0,ut=A.length;I<ut;++I){let R=A[I],W=R.start,V=R.count;for(let Mt=W,X=W+V;Mt<X;Mt+=3)F(t.getX(Mt+0)),F(t.getX(Mt+1)),F(t.getX(Mt+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 Ni(new Float32Array(e.count*3),3),this.setAttribute("normal",o);else for(let v=0,M=o.count;v<M;v++)o.setXYZ(v,0,0,0);let a=new yt,l=new yt,h=new yt,f=new yt,p=new yt,d=new yt,g=new yt,x=new yt;if(t)for(let v=0,M=t.count;v<M;v+=3){let b=t.getX(v+0),T=t.getX(v+1),_=t.getX(v+2);a.fromBufferAttribute(e,b),l.fromBufferAttribute(e,T),h.fromBufferAttribute(e,_),g.subVectors(h,l),x.subVectors(a,l),g.cross(x),f.fromBufferAttribute(o,b),p.fromBufferAttribute(o,T),d.fromBufferAttribute(o,_),f.add(g),p.add(g),d.add(g),o.setXYZ(b,f.x,f.y,f.z),o.setXYZ(T,p.x,p.y,p.z),o.setXYZ(_,d.x,d.y,d.z)}else for(let v=0,M=e.count;v<M;v+=3)a.fromBufferAttribute(e,v+0),l.fromBufferAttribute(e,v+1),h.fromBufferAttribute(e,v+2),g.subVectors(h,l),x.subVectors(a,l),g.cross(x),o.setXYZ(v+0,g.x,g.y,g.z),o.setXYZ(v+1,g.x,g.y,g.z),o.setXYZ(v+2,g.x,g.y,g.z);this.normalizeNormals(),o.needsUpdate=!0}}normalizeNormals(){let t=this.attributes.normal;for(let e=0,o=t.count;e<o;e++)Ar.fromBufferAttribute(t,e),Ar.normalize(),t.setXYZ(e,Ar.x,Ar.y,Ar.z)}toNonIndexed(){function t(f,p){let d=f.array,g=f.itemSize,x=f.normalized,v=new d.constructor(p.length*g),M=0,b=0;for(let T=0,_=p.length;T<_;T++){f.isInterleavedBufferAttribute?M=p[T]*f.data.stride+f.offset:M=p[T]*g;for(let y=0;y<g;y++)v[b++]=d[M++]}return new Ni(v,g,x)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let e=new r,o=this.index.array,a=this.attributes;for(let f in a){let p=a[f],d=t(p,o);e.setAttribute(f,d)}let l=this.morphAttributes;for(let f in l){let p=[],d=l[f];for(let g=0,x=d.length;g<x;g++){let v=d[g],M=t(v,o);p.push(M)}e.morphAttributes[f]=p}e.morphTargetsRelative=this.morphTargetsRelative;let h=this.groups;for(let f=0,p=h.length;f<p;f++){let d=h[f];e.addGroup(d.start,d.count,d.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 p=this.parameters;for(let d in p)p[d]!==void 0&&(t[d]=p[d]);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 p in o){let d=o[p];t.data.attributes[p]=d.toJSON(t.data)}let a={},l=!1;for(let p in this.morphAttributes){let d=this.morphAttributes[p],g=[];for(let x=0,v=d.length;x<v;x++){let M=d[x];g.push(M.toJSON(t.data))}g.length>0&&(a[p]=g,l=!0)}l&&(t.data.morphAttributes=a,t.data.morphTargetsRelative=this.morphTargetsRelative);let h=this.groups;h.length>0&&(t.data.groups=JSON.parse(JSON.stringify(h)));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 a=t.attributes;for(let d in a){let g=a[d];this.setAttribute(d,g.clone(e))}let l=t.morphAttributes;for(let d in l){let g=[],x=l[d];for(let v=0,M=x.length;v<M;v++)g.push(x[v].clone(e));this.morphAttributes[d]=g}this.morphTargetsRelative=t.morphTargetsRelative;let h=t.groups;for(let d=0,g=h.length;d<g;d++){let x=h[d];this.addGroup(x.start,x.count,x.materialIndex)}let f=t.boundingBox;f!==null&&(this.boundingBox=f.clone());let p=t.boundingSphere;return p!==null&&(this.boundingSphere=p.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}},_E=new cr,ua=new mm,cf=new Ol,xE=new yt,uu=new yt,lu=new yt,cu=new yt,Zd=new yt,ff=new yt,hf=new ye,pf=new ye,df=new ye,EE=new yt,ME=new yt,SE=new yt,mf=new yt,gf=new yt,ho=class extends po{constructor(t=new Us,e=new Uf){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 a=e[o[0]];if(a!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let l=0,h=a.length;l<h;l++){let f=a[l].name||String(l);this.morphTargetInfluences.push(0),this.morphTargetDictionary[f]=l}}}}getVertexPosition(t,e){let o=this.geometry,a=o.attributes.position,l=o.morphAttributes.position,h=o.morphTargetsRelative;e.fromBufferAttribute(a,t);let f=this.morphTargetInfluences;if(l&&f){ff.set(0,0,0);for(let p=0,d=l.length;p<d;p++){let g=f[p],x=l[p];g!==0&&(Zd.fromBufferAttribute(x,t),h?ff.addScaledVector(Zd,g):ff.addScaledVector(Zd.sub(e),g))}e.add(ff)}return e}raycast(t,e){let o=this.geometry,a=this.material,l=this.matrixWorld;a!==void 0&&(o.boundingSphere===null&&o.computeBoundingSphere(),cf.copy(o.boundingSphere),cf.applyMatrix4(l),ua.copy(t.ray).recast(t.near),!(cf.containsPoint(ua.origin)===!1&&(ua.intersectSphere(cf,xE)===null||ua.origin.distanceToSquared(xE)>(t.far-t.near)**2))&&(_E.copy(l).invert(),ua.copy(t.ray).applyMatrix4(_E),!(o.boundingBox!==null&&ua.intersectsBox(o.boundingBox)===!1)&&this._computeIntersections(t,e,ua)))}_computeIntersections(t,e,o){let a,l=this.geometry,h=this.material,f=l.index,p=l.attributes.position,d=l.attributes.uv,g=l.attributes.uv1,x=l.attributes.normal,v=l.groups,M=l.drawRange;if(f!==null)if(Array.isArray(h))for(let b=0,T=v.length;b<T;b++){let _=v[b],y=h[_.materialIndex],A=Math.max(_.start,M.start),S=Math.min(f.count,Math.min(_.start+_.count,M.start+M.count));for(let L=A,G=S;L<G;L+=3){let z=f.getX(L),F=f.getX(L+1),I=f.getX(L+2);a=yf(this,y,t,o,d,g,x,z,F,I),a&&(a.faceIndex=Math.floor(L/3),a.face.materialIndex=_.materialIndex,e.push(a))}}else{let b=Math.max(0,M.start),T=Math.min(f.count,M.start+M.count);for(let _=b,y=T;_<y;_+=3){let A=f.getX(_),S=f.getX(_+1),L=f.getX(_+2);a=yf(this,h,t,o,d,g,x,A,S,L),a&&(a.faceIndex=Math.floor(_/3),e.push(a))}}else if(p!==void 0)if(Array.isArray(h))for(let b=0,T=v.length;b<T;b++){let _=v[b],y=h[_.materialIndex],A=Math.max(_.start,M.start),S=Math.min(p.count,Math.min(_.start+_.count,M.start+M.count));for(let L=A,G=S;L<G;L+=3){let z=L,F=L+1,I=L+2;a=yf(this,y,t,o,d,g,x,z,F,I),a&&(a.faceIndex=Math.floor(L/3),a.face.materialIndex=_.materialIndex,e.push(a))}}else{let b=Math.max(0,M.start),T=Math.min(p.count,M.start+M.count);for(let _=b,y=T;_<y;_+=3){let A=_,S=_+1,L=_+2;a=yf(this,h,t,o,d,g,x,A,S,L),a&&(a.faceIndex=Math.floor(_/3),e.push(a))}}}};function Y2(r,t,e,o,a,l,h,f){let p;if(t.side===Ei?p=o.intersectTriangle(h,l,a,!0,f):p=o.intersectTriangle(a,l,h,t.side===Os,f),p===null)return null;gf.copy(f),gf.applyMatrix4(r.matrixWorld);let d=e.ray.origin.distanceTo(gf);return d<e.near||d>e.far?null:{distance:d,point:gf.clone(),object:r}}function yf(r,t,e,o,a,l,h,f,p,d){r.getVertexPosition(f,uu),r.getVertexPosition(p,lu),r.getVertexPosition(d,cu);let g=Y2(r,t,e,o,uu,lu,cu,mf);if(g){a&&(hf.fromBufferAttribute(a,f),pf.fromBufferAttribute(a,p),df.fromBufferAttribute(a,d),g.uv=ga.getInterpolation(mf,uu,lu,cu,hf,pf,df,new ye)),l&&(hf.fromBufferAttribute(l,f),pf.fromBufferAttribute(l,p),df.fromBufferAttribute(l,d),g.uv1=ga.getInterpolation(mf,uu,lu,cu,hf,pf,df,new ye)),h&&(EE.fromBufferAttribute(h,f),ME.fromBufferAttribute(h,p),SE.fromBufferAttribute(h,d),g.normal=ga.getInterpolation(mf,uu,lu,cu,EE,ME,SE,new yt),g.normal.dot(o.direction)>0&&g.normal.multiplyScalar(-1));let x={a:f,b:p,c:d,normal:new yt,materialIndex:0};ga.getNormal(uu,lu,cu,x.normal),g.face=x}return g}var Dl=class r extends Us{constructor(t=1,e=1,o=1,a=1,l=1,h=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:o,widthSegments:a,heightSegments:l,depthSegments:h};let f=this;a=Math.floor(a),l=Math.floor(l),h=Math.floor(h);let p=[],d=[],g=[],x=[],v=0,M=0;b("z","y","x",-1,-1,o,e,t,h,l,0),b("z","y","x",1,-1,o,e,-t,h,l,1),b("x","z","y",1,1,t,o,e,a,h,2),b("x","z","y",1,-1,t,o,-e,a,h,3),b("x","y","z",1,-1,t,e,o,a,l,4),b("x","y","z",-1,-1,t,e,-o,a,l,5),this.setIndex(p),this.setAttribute("position",new as(d,3)),this.setAttribute("normal",new as(g,3)),this.setAttribute("uv",new as(x,2));function b(T,_,y,A,S,L,G,z,F,I,ut){let R=L/F,W=G/I,V=L/2,Mt=G/2,X=z/2,mt=F+1,dt=I+1,_t=0,it=0,lt=new yt;for(let H=0;H<dt;H++){let bt=H*W-Mt;for(let Tt=0;Tt<mt;Tt++){let Yt=Tt*R-V;lt[T]=Yt*A,lt[_]=bt*S,lt[y]=X,d.push(lt.x,lt.y,lt.z),lt[T]=0,lt[_]=0,lt[y]=z>0?1:-1,g.push(lt.x,lt.y,lt.z),x.push(Tt/F),x.push(1-H/I),_t+=1}}for(let H=0;H<I;H++)for(let bt=0;bt<F;bt++){let Tt=v+bt+mt*H,Yt=v+bt+mt*(H+1),tt=v+(bt+1)+mt*(H+1),wt=v+(bt+1)+mt*H;p.push(Tt,Yt,wt),p.push(Yt,tt,wt),it+=6}f.addGroup(M,it,ut),M+=it,v+=_t}}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new r(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}};function Tu(r){let t={};for(let e in r){t[e]={};for(let o in r[e]){let a=r[e][o];a&&(a.isColor||a.isMatrix3||a.isMatrix4||a.isVector2||a.isVector3||a.isVector4||a.isTexture||a.isQuaternion)?a.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),t[e][o]=null):t[e][o]=a.clone():Array.isArray(a)?t[e][o]=a.slice():t[e][o]=a}}return t}function fi(r){let t={};for(let e=0;e<r.length;e++){let o=Tu(r[e]);for(let a in o)t[a]=o[a]}return t}function $2(r){let t=[];for(let e=0;e<r.length;e++)t.push(r[e].clone());return t}function lM(r){return r.getRenderTarget()===null?r.outputColorSpace:Cn.workingColorSpace}var Z2={clone:Tu,merge:fi},J2=`void main() {
|
|
8
8
|
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
9
9
|
}`,K2=`void main() {
|
|
10
10
|
gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
|
|
11
|
-
}`,Io=class extends Ea{constructor(t){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=J2,this.fragmentShader=K2,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1,clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,t!==void 0&&this.setValues(t)}copy(t){return super.copy(t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=Tu(t.uniforms),this.uniformsGroups=$2(t.uniformsGroups),this.defines=Object.assign({},t.defines),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.fog=t.fog,this.lights=t.lights,this.clipping=t.clipping,this.extensions=Object.assign({},t.extensions),this.glslVersion=t.glslVersion,this}toJSON(t){let e=super.toJSON(t);e.glslVersion=this.glslVersion,e.uniforms={};for(let a in this.uniforms){let h=this.uniforms[a].value;h&&h.isTexture?e.uniforms[a]={type:"t",value:h.toJSON(t).uuid}:h&&h.isColor?e.uniforms[a]={type:"c",value:h.getHex()}:h&&h.isVector2?e.uniforms[a]={type:"v2",value:h.toArray()}:h&&h.isVector3?e.uniforms[a]={type:"v3",value:h.toArray()}:h&&h.isVector4?e.uniforms[a]={type:"v4",value:h.toArray()}:h&&h.isMatrix3?e.uniforms[a]={type:"m3",value:h.toArray()}:h&&h.isMatrix4?e.uniforms[a]={type:"m4",value:h.toArray()}:e.uniforms[a]={value:h}}Object.keys(this.defines).length>0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e.lights=this.lights,e.clipping=this.clipping;let o={};for(let a in this.extensions)this.extensions[a]===!0&&(o[a]=!0);return Object.keys(o).length>0&&(e.extensions=o),e}},
|
|
11
|
+
}`,Io=class extends Ea{constructor(t){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=J2,this.fragmentShader=K2,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1,clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,t!==void 0&&this.setValues(t)}copy(t){return super.copy(t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=Tu(t.uniforms),this.uniformsGroups=$2(t.uniformsGroups),this.defines=Object.assign({},t.defines),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.fog=t.fog,this.lights=t.lights,this.clipping=t.clipping,this.extensions=Object.assign({},t.extensions),this.glslVersion=t.glslVersion,this}toJSON(t){let e=super.toJSON(t);e.glslVersion=this.glslVersion,e.uniforms={};for(let a in this.uniforms){let h=this.uniforms[a].value;h&&h.isTexture?e.uniforms[a]={type:"t",value:h.toJSON(t).uuid}:h&&h.isColor?e.uniforms[a]={type:"c",value:h.getHex()}:h&&h.isVector2?e.uniforms[a]={type:"v2",value:h.toArray()}:h&&h.isVector3?e.uniforms[a]={type:"v3",value:h.toArray()}:h&&h.isVector4?e.uniforms[a]={type:"v4",value:h.toArray()}:h&&h.isMatrix3?e.uniforms[a]={type:"m3",value:h.toArray()}:h&&h.isMatrix4?e.uniforms[a]={type:"m4",value:h.toArray()}:e.uniforms[a]={value:h}}Object.keys(this.defines).length>0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e.lights=this.lights,e.clipping=this.clipping;let o={};for(let a in this.extensions)this.extensions[a]===!0&&(o[a]=!0);return Object.keys(o).length>0&&(e.extensions=o),e}},Gf=class extends po{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new cr,this.projectionMatrix=new cr,this.projectionMatrixInverse=new cr,this.coordinateSystem=ss}copy(t,e){return super.copy(t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this.coordinateSystem=t.coordinateSystem,this}getWorldDirection(t){return super.getWorldDirection(t).negate()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}},Ts=new yt,wE=new ye,bE=new ye,Li=class extends Gf{constructor(t=50,e=1,o=.1,a=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=o,this.far=a,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=t.view===null?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this}setFocalLength(t){let e=.5*this.getFilmHeight()/t;this.fov=fm*2*Math.atan(e),this.updateProjectionMatrix()}getFocalLength(){let t=Math.tan(Id*.5*this.fov);return .5*this.getFilmHeight()/t}getEffectiveFOV(){return fm*2*Math.atan(Math.tan(Id*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(t,e,o){Ts.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),e.set(Ts.x,Ts.y).multiplyScalar(-t/Ts.z),Ts.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),o.set(Ts.x,Ts.y).multiplyScalar(-t/Ts.z)}getViewSize(t,e){return this.getViewBounds(t,wE,bE),e.subVectors(bE,wE)}setViewOffset(t,e,o,a,l,h){this.aspect=t/e,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=o,this.view.offsetY=a,this.view.width=l,this.view.height=h,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let t=this.near,e=t*Math.tan(Id*.5*this.fov)/this.zoom,o=2*e,a=this.aspect*o,l=-.5*a,h=this.view;if(this.view!==null&&this.view.enabled){let p=h.fullWidth,d=h.fullHeight;l+=h.offsetX*a/p,e-=h.offsetY*o/d,a*=h.width/p,o*=h.height/d}let f=this.filmOffset;f!==0&&(l+=t*f/this.getFilmWidth()),this.projectionMatrix.makePerspective(l,l+a,e,e-o,t,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){let e=super.toJSON(t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,this.view!==null&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}},fu=-90,hu=1,gm=class extends po{constructor(t,e,o){super(),this.type="CubeCamera",this.renderTarget=o,this.coordinateSystem=null,this.activeMipmapLevel=0;let a=new Li(fu,hu,t,e);a.layers=this.layers,this.add(a);let l=new Li(fu,hu,t,e);l.layers=this.layers,this.add(l);let h=new Li(fu,hu,t,e);h.layers=this.layers,this.add(h);let f=new Li(fu,hu,t,e);f.layers=this.layers,this.add(f);let p=new Li(fu,hu,t,e);p.layers=this.layers,this.add(p);let d=new Li(fu,hu,t,e);d.layers=this.layers,this.add(d)}updateCoordinateSystem(){let t=this.coordinateSystem,e=this.children.concat(),[o,a,l,h,f,p]=e;for(let d of e)this.remove(d);if(t===ss)o.up.set(0,1,0),o.lookAt(1,0,0),a.up.set(0,1,0),a.lookAt(-1,0,0),l.up.set(0,0,-1),l.lookAt(0,1,0),h.up.set(0,0,1),h.lookAt(0,-1,0),f.up.set(0,1,0),f.lookAt(0,0,1),p.up.set(0,1,0),p.lookAt(0,0,-1);else if(t===Rf)o.up.set(0,-1,0),o.lookAt(-1,0,0),a.up.set(0,-1,0),a.lookAt(1,0,0),l.up.set(0,0,1),l.lookAt(0,1,0),h.up.set(0,0,-1),h.lookAt(0,-1,0),f.up.set(0,-1,0),f.lookAt(0,0,1),p.up.set(0,-1,0),p.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+t);for(let d of e)this.add(d),d.updateMatrixWorld()}update(t,e){this.parent===null&&this.updateMatrixWorld();let{renderTarget:o,activeMipmapLevel:a}=this;this.coordinateSystem!==t.coordinateSystem&&(this.coordinateSystem=t.coordinateSystem,this.updateCoordinateSystem());let[l,h,f,p,d,g]=this.children,x=t.getRenderTarget(),v=t.getActiveCubeFace(),M=t.getActiveMipmapLevel(),b=t.xr.enabled;t.xr.enabled=!1;let T=o.texture.generateMipmaps;o.texture.generateMipmaps=!1,t.setRenderTarget(o,0,a),t.render(e,l),t.setRenderTarget(o,1,a),t.render(e,h),t.setRenderTarget(o,2,a),t.render(e,f),t.setRenderTarget(o,3,a),t.render(e,p),t.setRenderTarget(o,4,a),t.render(e,d),o.texture.generateMipmaps=T,t.setRenderTarget(o,5,a),t.render(e,g),t.setRenderTarget(x,v,M),t.xr.enabled=b,o.texture.needsPMREMUpdate=!0}},kf=class extends Hi{constructor(t,e,o,a,l,h,f,p,d,g){t=t!==void 0?t:[],e=e!==void 0?e:Su,super(t,e,o,a,l,h,f,p,d,g),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(t){this.image=t}},ym=class extends us{constructor(t=1,e={}){super(t,t,e),this.isWebGLCubeRenderTarget=!0;let o={width:t,height:t,depth:1},a=[o,o,o,o,o,o];this.texture=new kf(a,e.mapping,e.wrapS,e.wrapT,e.magFilter,e.minFilter,e.format,e.type,e.anisotropy,e.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=e.generateMipmaps!==void 0?e.generateMipmaps:!1,this.texture.minFilter=e.minFilter!==void 0?e.minFilter:_i}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.colorSpace=e.colorSpace,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;let o={uniforms:{tEquirect:{value:null}},vertexShader:`
|
|
12
12
|
|
|
13
13
|
varying vec3 vWorldDirection;
|
|
14
14
|
|
|
@@ -43,7 +43,7 @@ var rC=Object.create;var Ey=Object.defineProperty;var iC=Object.getOwnPropertyDe
|
|
|
43
43
|
gl_FragColor = texture2D( tEquirect, sampleUV );
|
|
44
44
|
|
|
45
45
|
}
|
|
46
|
-
`},a=new Dl(5,5,5),l=new Io({name:"CubemapFromEquirect",uniforms:Tu(o.uniforms),vertexShader:o.vertexShader,fragmentShader:o.fragmentShader,side:Ei,blending:Is});l.uniforms.tEquirect.value=e;let h=new ho(a,l),f=e.minFilter;return e.minFilter===ma&&(e.minFilter=_i),new gm(1,10,this).update(t,h),e.minFilter=f,h.geometry.dispose(),h.material.dispose(),this}clear(t,e,o,a){let l=t.getRenderTarget();for(let h=0;h<6;h++)t.setRenderTarget(this,h),t.clear(e,o,a);t.setRenderTarget(l)}},Jd=new yt,j2=new yt,Q2=new _e,rs=class{constructor(t=new yt(1,0,0),e=0){this.isPlane=!0,this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,o,a){return this.normal.set(t,e,o),this.constant=a,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,o){let a=Jd.subVectors(o,e).cross(j2.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(a,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){let t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return e.copy(t).addScaledVector(this.normal,-this.distanceToPoint(t))}intersectLine(t,e){let o=t.delta(Jd),a=this.normal.dot(o);if(a===0)return this.distanceToPoint(t.start)===0?e.copy(t.start):null;let l=-(t.start.dot(this.normal)+this.constant)/a;return l<0||l>1?null:e.copy(t.start).addScaledVector(o,l)}intersectsLine(t){let e=this.distanceToPoint(t.start),o=this.distanceToPoint(t.end);return e<0&&o>0||o<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){let o=e||Q2.getNormalMatrix(t),a=this.coplanarPoint(Jd).applyMatrix4(t),l=this.normal.applyMatrix3(o).normalize();return this.constant=-a.dot(l),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return new this.constructor().copy(this)}},la=new Ol,
|
|
46
|
+
`},a=new Dl(5,5,5),l=new Io({name:"CubemapFromEquirect",uniforms:Tu(o.uniforms),vertexShader:o.vertexShader,fragmentShader:o.fragmentShader,side:Ei,blending:Is});l.uniforms.tEquirect.value=e;let h=new ho(a,l),f=e.minFilter;return e.minFilter===ma&&(e.minFilter=_i),new gm(1,10,this).update(t,h),e.minFilter=f,h.geometry.dispose(),h.material.dispose(),this}clear(t,e,o,a){let l=t.getRenderTarget();for(let h=0;h<6;h++)t.setRenderTarget(this,h),t.clear(e,o,a);t.setRenderTarget(l)}},Jd=new yt,j2=new yt,Q2=new _e,rs=class{constructor(t=new yt(1,0,0),e=0){this.isPlane=!0,this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,o,a){return this.normal.set(t,e,o),this.constant=a,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,o){let a=Jd.subVectors(o,e).cross(j2.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(a,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){let t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return e.copy(t).addScaledVector(this.normal,-this.distanceToPoint(t))}intersectLine(t,e){let o=t.delta(Jd),a=this.normal.dot(o);if(a===0)return this.distanceToPoint(t.start)===0?e.copy(t.start):null;let l=-(t.start.dot(this.normal)+this.constant)/a;return l<0||l>1?null:e.copy(t.start).addScaledVector(o,l)}intersectsLine(t){let e=this.distanceToPoint(t.start),o=this.distanceToPoint(t.end);return e<0&&o>0||o<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){let o=e||Q2.getNormalMatrix(t),a=this.coplanarPoint(Jd).applyMatrix4(t),l=this.normal.applyMatrix3(o).normalize();return this.constant=-a.dot(l),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return new this.constructor().copy(this)}},la=new Ol,vf=new yt,qf=class{constructor(t=new rs,e=new rs,o=new rs,a=new rs,l=new rs,h=new rs){this.planes=[t,e,o,a,l,h]}set(t,e,o,a,l,h){let f=this.planes;return f[0].copy(t),f[1].copy(e),f[2].copy(o),f[3].copy(a),f[4].copy(l),f[5].copy(h),this}copy(t){let e=this.planes;for(let o=0;o<6;o++)e[o].copy(t.planes[o]);return this}setFromProjectionMatrix(t,e=ss){let o=this.planes,a=t.elements,l=a[0],h=a[1],f=a[2],p=a[3],d=a[4],g=a[5],x=a[6],v=a[7],M=a[8],b=a[9],T=a[10],_=a[11],y=a[12],A=a[13],S=a[14],L=a[15];if(o[0].setComponents(p-l,v-d,_-M,L-y).normalize(),o[1].setComponents(p+l,v+d,_+M,L+y).normalize(),o[2].setComponents(p+h,v+g,_+b,L+A).normalize(),o[3].setComponents(p-h,v-g,_-b,L-A).normalize(),o[4].setComponents(p-f,v-x,_-T,L-S).normalize(),e===ss)o[5].setComponents(p+f,v+x,_+T,L+S).normalize();else if(e===Rf)o[5].setComponents(f,x,T,S).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+e);return this}intersectsObject(t){if(t.boundingSphere!==void 0)t.boundingSphere===null&&t.computeBoundingSphere(),la.copy(t.boundingSphere).applyMatrix4(t.matrixWorld);else{let e=t.geometry;e.boundingSphere===null&&e.computeBoundingSphere(),la.copy(e.boundingSphere).applyMatrix4(t.matrixWorld)}return this.intersectsSphere(la)}intersectsSprite(t){return la.center.set(0,0,0),la.radius=.7071067811865476,la.applyMatrix4(t.matrixWorld),this.intersectsSphere(la)}intersectsSphere(t){let e=this.planes,o=t.center,a=-t.radius;for(let l=0;l<6;l++)if(e[l].distanceToPoint(o)<a)return!1;return!0}intersectsBox(t){let e=this.planes;for(let o=0;o<6;o++){let a=e[o];if(vf.x=a.normal.x>0?t.max.x:t.min.x,vf.y=a.normal.y>0?t.max.y:t.min.y,vf.z=a.normal.z>0?t.max.z:t.min.z,a.distanceToPoint(vf)<0)return!1}return!0}containsPoint(t){let e=this.planes;for(let o=0;o<6;o++)if(e[o].distanceToPoint(t)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}};function cM(){let r=null,t=!1,e=null,o=null;function a(l,h){e(l,h),o=r.requestAnimationFrame(a)}return{start:function(){t!==!0&&e!==null&&(o=r.requestAnimationFrame(a),t=!0)},stop:function(){r.cancelAnimationFrame(o),t=!1},setAnimationLoop:function(l){e=l},setContext:function(l){r=l}}}function tO(r,t){let e=t.isWebGL2,o=new WeakMap;function a(d,g){let x=d.array,v=d.usage,M=x.byteLength,b=r.createBuffer();r.bindBuffer(g,b),r.bufferData(g,x,v),d.onUploadCallback();let T;if(x instanceof Float32Array)T=r.FLOAT;else if(x instanceof Uint16Array)if(d.isFloat16BufferAttribute)if(e)T=r.HALF_FLOAT;else throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");else T=r.UNSIGNED_SHORT;else if(x instanceof Int16Array)T=r.SHORT;else if(x instanceof Uint32Array)T=r.UNSIGNED_INT;else if(x instanceof Int32Array)T=r.INT;else if(x instanceof Int8Array)T=r.BYTE;else if(x instanceof Uint8Array)T=r.UNSIGNED_BYTE;else if(x instanceof Uint8ClampedArray)T=r.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+x);return{buffer:b,type:T,bytesPerElement:x.BYTES_PER_ELEMENT,version:d.version,size:M}}function l(d,g,x){let v=g.array,M=g._updateRange,b=g.updateRanges;if(r.bindBuffer(x,d),M.count===-1&&b.length===0&&r.bufferSubData(x,0,v),b.length!==0){for(let T=0,_=b.length;T<_;T++){let y=b[T];e?r.bufferSubData(x,y.start*v.BYTES_PER_ELEMENT,v,y.start,y.count):r.bufferSubData(x,y.start*v.BYTES_PER_ELEMENT,v.subarray(y.start,y.start+y.count))}g.clearUpdateRanges()}M.count!==-1&&(e?r.bufferSubData(x,M.offset*v.BYTES_PER_ELEMENT,v,M.offset,M.count):r.bufferSubData(x,M.offset*v.BYTES_PER_ELEMENT,v.subarray(M.offset,M.offset+M.count)),M.count=-1),g.onUploadCallback()}function h(d){return d.isInterleavedBufferAttribute&&(d=d.data),o.get(d)}function f(d){d.isInterleavedBufferAttribute&&(d=d.data);let g=o.get(d);g&&(r.deleteBuffer(g.buffer),o.delete(d))}function p(d,g){if(d.isGLBufferAttribute){let v=o.get(d);(!v||v.version<d.version)&&o.set(d,{buffer:d.buffer,type:d.type,bytesPerElement:d.elementSize,version:d.version});return}d.isInterleavedBufferAttribute&&(d=d.data);let x=o.get(d);if(x===void 0)o.set(d,a(d,g));else if(x.version<d.version){if(x.size!==d.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");l(x.buffer,d,g),x.version=d.version}}return{get:h,remove:f,update:p}}var Vf=class r extends Us{constructor(t=1,e=1,o=1,a=1){super(),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:o,heightSegments:a};let l=t/2,h=e/2,f=Math.floor(o),p=Math.floor(a),d=f+1,g=p+1,x=t/f,v=e/p,M=[],b=[],T=[],_=[];for(let y=0;y<g;y++){let A=y*v-h;for(let S=0;S<d;S++){let L=S*x-l;b.push(L,-A,0),T.push(0,0,1),_.push(S/f),_.push(1-y/p)}}for(let y=0;y<p;y++)for(let A=0;A<f;A++){let S=A+d*y,L=A+d*(y+1),G=A+1+d*(y+1),z=A+1+d*y;M.push(S,L,z),M.push(L,G,z)}this.setIndex(M),this.setAttribute("position",new as(b,3)),this.setAttribute("normal",new as(T,3)),this.setAttribute("uv",new as(_,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new r(t.width,t.height,t.widthSegments,t.heightSegments)}},eO=`#ifdef USE_ALPHAHASH
|
|
47
47
|
if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
|
|
48
48
|
#endif`,nO=`#ifdef USE_ALPHAHASH
|
|
49
49
|
const float ALPHA_HASH_SCALE = 0.05;
|
|
@@ -3550,7 +3550,7 @@ void main() {
|
|
|
3550
3550
|
#include <tonemapping_fragment>
|
|
3551
3551
|
#include <colorspace_fragment>
|
|
3552
3552
|
#include <fog_fragment>
|
|
3553
|
-
}`,xe={alphahash_fragment:eO,alphahash_pars_fragment:nO,alphamap_fragment:rO,alphamap_pars_fragment:iO,alphatest_fragment:oO,alphatest_pars_fragment:sO,aomap_fragment:aO,aomap_pars_fragment:uO,batching_pars_vertex:lO,batching_vertex:cO,begin_vertex:fO,beginnormal_vertex:hO,bsdfs:pO,iridescence_fragment:dO,bumpmap_pars_fragment:mO,clipping_planes_fragment:gO,clipping_planes_pars_fragment:yO,clipping_planes_pars_vertex:vO,clipping_planes_vertex:_O,color_fragment:xO,color_pars_fragment:EO,color_pars_vertex:MO,color_vertex:SO,common:wO,cube_uv_reflection_fragment:bO,defaultnormal_vertex:TO,displacementmap_pars_vertex:AO,displacementmap_vertex:CO,emissivemap_fragment:PO,emissivemap_pars_fragment:IO,colorspace_fragment:RO,colorspace_pars_fragment:LO,envmap_fragment:NO,envmap_common_pars_fragment:OO,envmap_pars_fragment:DO,envmap_pars_vertex:FO,envmap_physical_pars_fragment:$O,envmap_vertex:UO,fog_vertex:BO,fog_pars_vertex:zO,fog_fragment:GO,fog_pars_fragment:kO,gradientmap_pars_fragment:qO,lightmap_fragment:VO,lightmap_pars_fragment:HO,lights_lambert_fragment:WO,lights_lambert_pars_fragment:XO,lights_pars_begin:YO,lights_toon_fragment:ZO,lights_toon_pars_fragment:JO,lights_phong_fragment:KO,lights_phong_pars_fragment:jO,lights_physical_fragment:QO,lights_physical_pars_fragment:tD,lights_fragment_begin:eD,lights_fragment_maps:nD,lights_fragment_end:rD,logdepthbuf_fragment:iD,logdepthbuf_pars_fragment:oD,logdepthbuf_pars_vertex:sD,logdepthbuf_vertex:aD,map_fragment:uD,map_pars_fragment:lD,map_particle_fragment:cD,map_particle_pars_fragment:fD,metalnessmap_fragment:hD,metalnessmap_pars_fragment:pD,morphinstance_vertex:dD,morphcolor_vertex:mD,morphnormal_vertex:gD,morphtarget_pars_vertex:yD,morphtarget_vertex:vD,normal_fragment_begin:_D,normal_fragment_maps:xD,normal_pars_fragment:ED,normal_pars_vertex:MD,normal_vertex:SD,normalmap_pars_fragment:wD,clearcoat_normal_fragment_begin:bD,clearcoat_normal_fragment_maps:TD,clearcoat_pars_fragment:AD,iridescence_pars_fragment:CD,opaque_fragment:PD,packing:ID,premultiplied_alpha_fragment:RD,project_vertex:LD,dithering_fragment:ND,dithering_pars_fragment:OD,roughnessmap_fragment:DD,roughnessmap_pars_fragment:FD,shadowmap_pars_fragment:UD,shadowmap_pars_vertex:BD,shadowmap_vertex:zD,shadowmask_pars_fragment:GD,skinbase_vertex:kD,skinning_pars_vertex:qD,skinning_vertex:VD,skinnormal_vertex:HD,specularmap_fragment:WD,specularmap_pars_fragment:XD,tonemapping_fragment:YD,tonemapping_pars_fragment:$D,transmission_fragment:ZD,transmission_pars_fragment:JD,uv_pars_fragment:KD,uv_pars_vertex:jD,uv_vertex:QD,worldpos_vertex:t3,background_vert:e3,background_frag:n3,backgroundCube_vert:r3,backgroundCube_frag:i3,cube_vert:o3,cube_frag:s3,depth_vert:a3,depth_frag:u3,distanceRGBA_vert:l3,distanceRGBA_frag:c3,equirect_vert:f3,equirect_frag:h3,linedashed_vert:p3,linedashed_frag:d3,meshbasic_vert:m3,meshbasic_frag:g3,meshlambert_vert:y3,meshlambert_frag:v3,meshmatcap_vert:_3,meshmatcap_frag:x3,meshnormal_vert:E3,meshnormal_frag:M3,meshphong_vert:S3,meshphong_frag:w3,meshphysical_vert:b3,meshphysical_frag:T3,meshtoon_vert:A3,meshtoon_frag:C3,points_vert:P3,points_frag:I3,shadow_vert:R3,shadow_frag:L3,sprite_vert:N3,sprite_frag:O3},qt={common:{diffuse:{value:new vn(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new _e},alphaMap:{value:null},alphaMapTransform:{value:new _e},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new _e}},envmap:{envMap:{value:null},envMapRotation:{value:new _e},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new _e}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new _e}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new _e},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new _e},normalScale:{value:new ye(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new _e},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new _e}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new _e}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new _e}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new vn(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new vn(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new _e},alphaTest:{value:0},uvTransform:{value:new _e}},sprite:{diffuse:{value:new vn(16777215)},opacity:{value:1},center:{value:new ye(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new _e},alphaMap:{value:null},alphaMapTransform:{value:new _e},alphaTest:{value:0}}},Co={basic:{uniforms:fi([qt.common,qt.specularmap,qt.envmap,qt.aomap,qt.lightmap,qt.fog]),vertexShader:xe.meshbasic_vert,fragmentShader:xe.meshbasic_frag},lambert:{uniforms:fi([qt.common,qt.specularmap,qt.envmap,qt.aomap,qt.lightmap,qt.emissivemap,qt.bumpmap,qt.normalmap,qt.displacementmap,qt.fog,qt.lights,{emissive:{value:new vn(0)}}]),vertexShader:xe.meshlambert_vert,fragmentShader:xe.meshlambert_frag},phong:{uniforms:fi([qt.common,qt.specularmap,qt.envmap,qt.aomap,qt.lightmap,qt.emissivemap,qt.bumpmap,qt.normalmap,qt.displacementmap,qt.fog,qt.lights,{emissive:{value:new vn(0)},specular:{value:new vn(1118481)},shininess:{value:30}}]),vertexShader:xe.meshphong_vert,fragmentShader:xe.meshphong_frag},standard:{uniforms:fi([qt.common,qt.envmap,qt.aomap,qt.lightmap,qt.emissivemap,qt.bumpmap,qt.normalmap,qt.displacementmap,qt.roughnessmap,qt.metalnessmap,qt.fog,qt.lights,{emissive:{value:new vn(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:xe.meshphysical_vert,fragmentShader:xe.meshphysical_frag},toon:{uniforms:fi([qt.common,qt.aomap,qt.lightmap,qt.emissivemap,qt.bumpmap,qt.normalmap,qt.displacementmap,qt.gradientmap,qt.fog,qt.lights,{emissive:{value:new vn(0)}}]),vertexShader:xe.meshtoon_vert,fragmentShader:xe.meshtoon_frag},matcap:{uniforms:fi([qt.common,qt.bumpmap,qt.normalmap,qt.displacementmap,qt.fog,{matcap:{value:null}}]),vertexShader:xe.meshmatcap_vert,fragmentShader:xe.meshmatcap_frag},points:{uniforms:fi([qt.points,qt.fog]),vertexShader:xe.points_vert,fragmentShader:xe.points_frag},dashed:{uniforms:fi([qt.common,qt.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:xe.linedashed_vert,fragmentShader:xe.linedashed_frag},depth:{uniforms:fi([qt.common,qt.displacementmap]),vertexShader:xe.depth_vert,fragmentShader:xe.depth_frag},normal:{uniforms:fi([qt.common,qt.bumpmap,qt.normalmap,qt.displacementmap,{opacity:{value:1}}]),vertexShader:xe.meshnormal_vert,fragmentShader:xe.meshnormal_frag},sprite:{uniforms:fi([qt.sprite,qt.fog]),vertexShader:xe.sprite_vert,fragmentShader:xe.sprite_frag},background:{uniforms:{uvTransform:{value:new _e},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:xe.background_vert,fragmentShader:xe.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new _e}},vertexShader:xe.backgroundCube_vert,fragmentShader:xe.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:xe.cube_vert,fragmentShader:xe.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:xe.equirect_vert,fragmentShader:xe.equirect_frag},distanceRGBA:{uniforms:fi([qt.common,qt.displacementmap,{referencePosition:{value:new yt},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:xe.distanceRGBA_vert,fragmentShader:xe.distanceRGBA_frag},shadow:{uniforms:fi([qt.lights,qt.fog,{color:{value:new vn(0)},opacity:{value:1}}]),vertexShader:xe.shadow_vert,fragmentShader:xe.shadow_frag}};Co.physical={uniforms:fi([Co.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new _e},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new _e},clearcoatNormalScale:{value:new ye(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new _e},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new _e},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new _e},sheen:{value:0},sheenColor:{value:new vn(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new _e},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new _e},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new _e},transmissionSamplerSize:{value:new ye},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new _e},attenuationDistance:{value:0},attenuationColor:{value:new vn(0)},specularColor:{value:new vn(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new _e},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new _e},anisotropyVector:{value:new ye},anisotropyMap:{value:null},anisotropyMapTransform:{value:new _e}}]),vertexShader:xe.meshphysical_vert,fragmentShader:xe.meshphysical_frag};var vf={r:0,b:0,g:0},ca=new xa,D3=new cr;function F3(r,t,e,o,a,l,h){let f=new vn(0),p=l===!0?0:1,d,g,x=null,v=0,M=null;function b(_,y){let A=!1,S=y.isScene===!0?y.background:null;S&&S.isTexture&&(S=(y.backgroundBlurriness>0?e:t).get(S)),S===null?T(f,p):S&&S.isColor&&(T(S,1),A=!0);let L=r.xr.getEnvironmentBlendMode();L==="additive"?o.buffers.color.setClear(0,0,0,1,h):L==="alpha-blend"&&o.buffers.color.setClear(0,0,0,0,h),(r.autoClear||A)&&r.clear(r.autoClearColor,r.autoClearDepth,r.autoClearStencil),S&&(S.isCubeTexture||S.mapping===Xf)?(g===void 0&&(g=new ho(new Dl(1,1,1),new Io({name:"BackgroundCubeMaterial",uniforms:Tu(Co.backgroundCube.uniforms),vertexShader:Co.backgroundCube.vertexShader,fragmentShader:Co.backgroundCube.fragmentShader,side:Ei,depthTest:!1,depthWrite:!1,fog:!1})),g.geometry.deleteAttribute("normal"),g.geometry.deleteAttribute("uv"),g.onBeforeRender=function(G,z,F){this.matrixWorld.copyPosition(F.matrixWorld)},Object.defineProperty(g.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),a.update(g)),ca.copy(y.backgroundRotation),ca.x*=-1,ca.y*=-1,ca.z*=-1,S.isCubeTexture&&S.isRenderTargetTexture===!1&&(ca.y*=-1,ca.z*=-1),g.material.uniforms.envMap.value=S,g.material.uniforms.flipEnvMap.value=S.isCubeTexture&&S.isRenderTargetTexture===!1?-1:1,g.material.uniforms.backgroundBlurriness.value=y.backgroundBlurriness,g.material.uniforms.backgroundIntensity.value=y.backgroundIntensity,g.material.uniforms.backgroundRotation.value.setFromMatrix4(D3.makeRotationFromEuler(ca)),g.material.toneMapped=Cn.getTransfer(S.colorSpace)!==Un,(x!==S||v!==S.version||M!==r.toneMapping)&&(g.material.needsUpdate=!0,x=S,v=S.version,M=r.toneMapping),g.layers.enableAll(),_.unshift(g,g.geometry,g.material,0,0,null)):S&&S.isTexture&&(d===void 0&&(d=new ho(new qf(2,2),new Io({name:"BackgroundMaterial",uniforms:Tu(Co.background.uniforms),vertexShader:Co.background.vertexShader,fragmentShader:Co.background.fragmentShader,side:Os,depthTest:!1,depthWrite:!1,fog:!1})),d.geometry.deleteAttribute("normal"),Object.defineProperty(d.material,"map",{get:function(){return this.uniforms.t2D.value}}),a.update(d)),d.material.uniforms.t2D.value=S,d.material.uniforms.backgroundIntensity.value=y.backgroundIntensity,d.material.toneMapped=Cn.getTransfer(S.colorSpace)!==Un,S.matrixAutoUpdate===!0&&S.updateMatrix(),d.material.uniforms.uvTransform.value.copy(S.matrix),(x!==S||v!==S.version||M!==r.toneMapping)&&(d.material.needsUpdate=!0,x=S,v=S.version,M=r.toneMapping),d.layers.enableAll(),_.unshift(d,d.geometry,d.material,0,0,null))}function T(_,y){_.getRGB(vf,lM(r)),o.buffers.color.setClear(vf.r,vf.g,vf.b,y,h)}return{getClearColor:function(){return f},setClearColor:function(_,y=1){f.set(_),p=y,T(f,p)},getClearAlpha:function(){return p},setClearAlpha:function(_){p=_,T(f,p)},render:b}}function U3(r,t,e,o){let a=r.getParameter(r.MAX_VERTEX_ATTRIBS),l=o.isWebGL2?null:t.get("OES_vertex_array_object"),h=o.isWebGL2||l!==null,f={},p=_(null),d=p,g=!1;function x(X,mt,dt,_t,it){let lt=!1;if(h){let H=T(_t,dt,mt);d!==H&&(d=H,M(d.object)),lt=y(X,_t,dt,it),lt&&A(X,_t,dt,it)}else{let H=mt.wireframe===!0;(d.geometry!==_t.id||d.program!==dt.id||d.wireframe!==H)&&(d.geometry=_t.id,d.program=dt.id,d.wireframe=H,lt=!0)}it!==null&&e.update(it,r.ELEMENT_ARRAY_BUFFER),(lt||g)&&(g=!1,I(X,mt,dt,_t),it!==null&&r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,e.get(it).buffer))}function v(){return o.isWebGL2?r.createVertexArray():l.createVertexArrayOES()}function M(X){return o.isWebGL2?r.bindVertexArray(X):l.bindVertexArrayOES(X)}function b(X){return o.isWebGL2?r.deleteVertexArray(X):l.deleteVertexArrayOES(X)}function T(X,mt,dt){let _t=dt.wireframe===!0,it=f[X.id];it===void 0&&(it={},f[X.id]=it);let lt=it[mt.id];lt===void 0&&(lt={},it[mt.id]=lt);let H=lt[_t];return H===void 0&&(H=_(v()),lt[_t]=H),H}function _(X){let mt=[],dt=[],_t=[];for(let it=0;it<a;it++)mt[it]=0,dt[it]=0,_t[it]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:mt,enabledAttributes:dt,attributeDivisors:_t,object:X,attributes:{},index:null}}function y(X,mt,dt,_t){let it=d.attributes,lt=mt.attributes,H=0,bt=dt.getAttributes();for(let Tt in bt)if(bt[Tt].location>=0){let tt=it[Tt],wt=lt[Tt];if(wt===void 0&&(Tt==="instanceMatrix"&&X.instanceMatrix&&(wt=X.instanceMatrix),Tt==="instanceColor"&&X.instanceColor&&(wt=X.instanceColor)),tt===void 0||tt.attribute!==wt||wt&&tt.data!==wt.data)return!0;H++}return d.attributesNum!==H||d.index!==_t}function A(X,mt,dt,_t){let it={},lt=mt.attributes,H=0,bt=dt.getAttributes();for(let Tt in bt)if(bt[Tt].location>=0){let tt=lt[Tt];tt===void 0&&(Tt==="instanceMatrix"&&X.instanceMatrix&&(tt=X.instanceMatrix),Tt==="instanceColor"&&X.instanceColor&&(tt=X.instanceColor));let wt={};wt.attribute=tt,tt&&tt.data&&(wt.data=tt.data),it[Tt]=wt,H++}d.attributes=it,d.attributesNum=H,d.index=_t}function S(){let X=d.newAttributes;for(let mt=0,dt=X.length;mt<dt;mt++)X[mt]=0}function L(X){G(X,0)}function G(X,mt){let dt=d.newAttributes,_t=d.enabledAttributes,it=d.attributeDivisors;dt[X]=1,_t[X]===0&&(r.enableVertexAttribArray(X),_t[X]=1),it[X]!==mt&&((o.isWebGL2?r:t.get("ANGLE_instanced_arrays"))[o.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](X,mt),it[X]=mt)}function z(){let X=d.newAttributes,mt=d.enabledAttributes;for(let dt=0,_t=mt.length;dt<_t;dt++)mt[dt]!==X[dt]&&(r.disableVertexAttribArray(dt),mt[dt]=0)}function F(X,mt,dt,_t,it,lt,H){H===!0?r.vertexAttribIPointer(X,mt,dt,it,lt):r.vertexAttribPointer(X,mt,dt,_t,it,lt)}function I(X,mt,dt,_t){if(o.isWebGL2===!1&&(X.isInstancedMesh||_t.isInstancedBufferGeometry)&&t.get("ANGLE_instanced_arrays")===null)return;S();let it=_t.attributes,lt=dt.getAttributes(),H=mt.defaultAttributeValues;for(let bt in lt){let Tt=lt[bt];if(Tt.location>=0){let Yt=it[bt];if(Yt===void 0&&(bt==="instanceMatrix"&&X.instanceMatrix&&(Yt=X.instanceMatrix),bt==="instanceColor"&&X.instanceColor&&(Yt=X.instanceColor)),Yt!==void 0){let tt=Yt.normalized,wt=Yt.itemSize,Bt=e.get(Yt);if(Bt===void 0)continue;let $t=Bt.buffer,Ut=Bt.type,Dt=Bt.bytesPerElement,At=o.isWebGL2===!0&&(Ut===r.INT||Ut===r.UNSIGNED_INT||Yt.gpuType===jE);if(Yt.isInterleavedBufferAttribute){let te=Yt.data,rt=te.stride,an=Yt.offset;if(te.isInstancedInterleavedBuffer){for(let zt=0;zt<Tt.locationSize;zt++)G(Tt.location+zt,te.meshPerAttribute);X.isInstancedMesh!==!0&&_t._maxInstanceCount===void 0&&(_t._maxInstanceCount=te.meshPerAttribute*te.count)}else for(let zt=0;zt<Tt.locationSize;zt++)L(Tt.location+zt);r.bindBuffer(r.ARRAY_BUFFER,$t);for(let zt=0;zt<Tt.locationSize;zt++)F(Tt.location+zt,wt/Tt.locationSize,Ut,tt,rt*Dt,(an+wt/Tt.locationSize*zt)*Dt,At)}else{if(Yt.isInstancedBufferAttribute){for(let te=0;te<Tt.locationSize;te++)G(Tt.location+te,Yt.meshPerAttribute);X.isInstancedMesh!==!0&&_t._maxInstanceCount===void 0&&(_t._maxInstanceCount=Yt.meshPerAttribute*Yt.count)}else for(let te=0;te<Tt.locationSize;te++)L(Tt.location+te);r.bindBuffer(r.ARRAY_BUFFER,$t);for(let te=0;te<Tt.locationSize;te++)F(Tt.location+te,wt/Tt.locationSize,Ut,tt,wt*Dt,wt/Tt.locationSize*te*Dt,At)}}else if(H!==void 0){let tt=H[bt];if(tt!==void 0)switch(tt.length){case 2:r.vertexAttrib2fv(Tt.location,tt);break;case 3:r.vertexAttrib3fv(Tt.location,tt);break;case 4:r.vertexAttrib4fv(Tt.location,tt);break;default:r.vertexAttrib1fv(Tt.location,tt)}}}}z()}function ut(){V();for(let X in f){let mt=f[X];for(let dt in mt){let _t=mt[dt];for(let it in _t)b(_t[it].object),delete _t[it];delete mt[dt]}delete f[X]}}function R(X){if(f[X.id]===void 0)return;let mt=f[X.id];for(let dt in mt){let _t=mt[dt];for(let it in _t)b(_t[it].object),delete _t[it];delete mt[dt]}delete f[X.id]}function W(X){for(let mt in f){let dt=f[mt];if(dt[X.id]===void 0)continue;let _t=dt[X.id];for(let it in _t)b(_t[it].object),delete _t[it];delete dt[X.id]}}function V(){Mt(),g=!0,d!==p&&(d=p,M(d.object))}function Mt(){p.geometry=null,p.program=null,p.wireframe=!1}return{setup:x,reset:V,resetDefaultState:Mt,dispose:ut,releaseStatesOfGeometry:R,releaseStatesOfProgram:W,initAttributes:S,enableAttribute:L,disableUnusedAttributes:z}}function B3(r,t,e,o){let a=o.isWebGL2,l;function h(g){l=g}function f(g,x){r.drawArrays(l,g,x),e.update(x,l,1)}function p(g,x,v){if(v===0)return;let M,b;if(a)M=r,b="drawArraysInstanced";else if(M=t.get("ANGLE_instanced_arrays"),b="drawArraysInstancedANGLE",M===null){console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}M[b](l,g,x,v),e.update(x,l,v)}function d(g,x,v){if(v===0)return;let M=t.get("WEBGL_multi_draw");if(M===null)for(let b=0;b<v;b++)this.render(g[b],x[b]);else{M.multiDrawArraysWEBGL(l,g,0,x,0,v);let b=0;for(let T=0;T<v;T++)b+=x[T];e.update(b,l,1)}}this.setMode=h,this.render=f,this.renderInstances=p,this.renderMultiDraw=d}function z3(r,t,e){let o;function a(){if(o!==void 0)return o;if(t.has("EXT_texture_filter_anisotropic")===!0){let F=t.get("EXT_texture_filter_anisotropic");o=r.getParameter(F.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else o=0;return o}function l(F){if(F==="highp"){if(r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.HIGH_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).precision>0)return"highp";F="mediump"}return F==="mediump"&&r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.MEDIUM_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let h=typeof WebGL2RenderingContext!="undefined"&&r.constructor.name==="WebGL2RenderingContext",f=e.precision!==void 0?e.precision:"highp",p=l(f);p!==f&&(console.warn("THREE.WebGLRenderer:",f,"not supported, using",p,"instead."),f=p);let d=h||t.has("WEBGL_draw_buffers"),g=e.logarithmicDepthBuffer===!0,x=r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS),v=r.getParameter(r.MAX_VERTEX_TEXTURE_IMAGE_UNITS),M=r.getParameter(r.MAX_TEXTURE_SIZE),b=r.getParameter(r.MAX_CUBE_MAP_TEXTURE_SIZE),T=r.getParameter(r.MAX_VERTEX_ATTRIBS),_=r.getParameter(r.MAX_VERTEX_UNIFORM_VECTORS),y=r.getParameter(r.MAX_VARYING_VECTORS),A=r.getParameter(r.MAX_FRAGMENT_UNIFORM_VECTORS),S=v>0,L=h||t.has("OES_texture_float"),G=S&&L,z=h?r.getParameter(r.MAX_SAMPLES):0;return{isWebGL2:h,drawBuffers:d,getMaxAnisotropy:a,getMaxPrecision:l,precision:f,logarithmicDepthBuffer:g,maxTextures:x,maxVertexTextures:v,maxTextureSize:M,maxCubemapSize:b,maxAttributes:T,maxVertexUniforms:_,maxVaryings:y,maxFragmentUniforms:A,vertexTextures:S,floatFragmentTextures:L,floatVertexTextures:G,maxSamples:z}}function G3(r){let t=this,e=null,o=0,a=!1,l=!1,h=new rs,f=new _e,p={value:null,needsUpdate:!1};this.uniform=p,this.numPlanes=0,this.numIntersection=0,this.init=function(x,v){let M=x.length!==0||v||o!==0||a;return a=v,o=x.length,M},this.beginShadows=function(){l=!0,g(null)},this.endShadows=function(){l=!1},this.setGlobalState=function(x,v){e=g(x,v,0)},this.setState=function(x,v,M){let b=x.clippingPlanes,T=x.clipIntersection,_=x.clipShadows,y=r.get(x);if(!a||b===null||b.length===0||l&&!_)l?g(null):d();else{let A=l?0:o,S=A*4,L=y.clippingState||null;p.value=L,L=g(b,v,S,M);for(let G=0;G!==S;++G)L[G]=e[G];y.clippingState=L,this.numIntersection=T?this.numPlanes:0,this.numPlanes+=A}};function d(){p.value!==e&&(p.value=e,p.needsUpdate=o>0),t.numPlanes=o,t.numIntersection=0}function g(x,v,M,b){let T=x!==null?x.length:0,_=null;if(T!==0){if(_=p.value,b!==!0||_===null){let y=M+T*4,A=v.matrixWorldInverse;f.getNormalMatrix(A),(_===null||_.length<y)&&(_=new Float32Array(y));for(let S=0,L=M;S!==T;++S,L+=4)h.copy(x[S]).applyMatrix4(A,f),h.normal.toArray(_,L),_[L+3]=h.constant}p.value=_,p.needsUpdate=!0}return t.numPlanes=T,t.numIntersection=0,_}}function k3(r){let t=new WeakMap;function e(h,f){return f===om?h.mapping=Su:f===sm&&(h.mapping=wu),h}function o(h){if(h&&h.isTexture){let f=h.mapping;if(f===om||f===sm)if(t.has(h)){let p=t.get(h).texture;return e(p,h.mapping)}else{let p=h.image;if(p&&p.height>0){let d=new ym(p.height);return d.fromEquirectangularTexture(r,h),t.set(h,d),h.addEventListener("dispose",a),e(d.texture,h.mapping)}else return null}}return h}function a(h){let f=h.target;f.removeEventListener("dispose",a);let p=t.get(f);p!==void 0&&(t.delete(f),p.dispose())}function l(){t=new WeakMap}return{get:o,dispose:l}}var vm=class extends zf{constructor(t=-1,e=1,o=1,a=-1,l=.1,h=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=o,this.bottom=a,this.near=l,this.far=h,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=t.view===null?null:Object.assign({},t.view),this}setViewOffset(t,e,o,a,l,h){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=o,this.view.offsetY=a,this.view.width=l,this.view.height=h,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),o=(this.right+this.left)/2,a=(this.top+this.bottom)/2,l=o-t,h=o+t,f=a+e,p=a-e;if(this.view!==null&&this.view.enabled){let d=(this.right-this.left)/this.view.fullWidth/this.zoom,g=(this.top-this.bottom)/this.view.fullHeight/this.zoom;l+=d*this.view.offsetX,h=l+d*this.view.width,f-=g*this.view.offsetY,p=f-g*this.view.height}this.projectionMatrix.makeOrthographic(l,h,f,p,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){let e=super.toJSON(t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,this.view!==null&&(e.object.view=Object.assign({},this.view)),e}},yu=4,TE=[.125,.215,.35,.446,.526,.582],da=20,Kd=new vm,AE=new vn,jd=null,Qd=0,tm=0,ha=(1+Math.sqrt(5))/2,pu=1/ha,CE=[new yt(1,1,1),new yt(-1,1,1),new yt(1,1,-1),new yt(-1,1,-1),new yt(0,ha,pu),new yt(0,ha,-pu),new yt(pu,0,ha),new yt(-pu,0,ha),new yt(ha,pu,0),new yt(-ha,pu,0)],Vf=class{constructor(t){this._renderer=t,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(t,e=0,o=.1,a=100){jd=this._renderer.getRenderTarget(),Qd=this._renderer.getActiveCubeFace(),tm=this._renderer.getActiveMipmapLevel(),this._setSize(256);let l=this._allocateTargets();return l.depthBuffer=!0,this._sceneToCubeUV(t,o,a,l),e>0&&this._blur(l,0,0,e),this._applyPMREM(l),this._cleanup(l),l}fromEquirectangular(t,e=null){return this._fromTexture(t,e)}fromCubemap(t,e=null){return this._fromTexture(t,e)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=RE(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=IE(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(t){this._lodMax=Math.floor(Math.log2(t)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let t=0;t<this._lodPlanes.length;t++)this._lodPlanes[t].dispose()}_cleanup(t){this._renderer.setRenderTarget(jd,Qd,tm),t.scissorTest=!1,_f(t,0,0,t.width,t.height)}_fromTexture(t,e){t.mapping===Su||t.mapping===wu?this._setSize(t.image.length===0?16:t.image[0].width||t.image[0].image.width):this._setSize(t.image.width/4),jd=this._renderer.getRenderTarget(),Qd=this._renderer.getActiveCubeFace(),tm=this._renderer.getActiveMipmapLevel();let o=e||this._allocateTargets();return this._textureToCubeUV(t,o),this._applyPMREM(o),this._cleanup(o),o}_allocateTargets(){let t=3*Math.max(this._cubeSize,112),e=4*this._cubeSize,o={magFilter:_i,minFilter:_i,generateMipmaps:!1,type:Nl,format:fo,colorSpace:Bs,depthBuffer:!1},a=PE(t,e,o);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==t||this._pingPongRenderTarget.height!==e){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=PE(t,e,o);let{_lodMax:l}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=q3(l)),this._blurMaterial=V3(l,t,e)}return a}_compileMaterial(t){let e=new ho(this._lodPlanes[0],t);this._renderer.compile(e,Kd)}_sceneToCubeUV(t,e,o,a){let f=new Li(90,1,e,o),p=[1,-1,1,1,1,1],d=[1,1,1,-1,-1,-1],g=this._renderer,x=g.autoClear,v=g.toneMapping;g.getClearColor(AE),g.toneMapping=Rs,g.autoClear=!1;let M=new Ff({name:"PMREM.Background",side:Ei,depthWrite:!1,depthTest:!1}),b=new ho(new Dl,M),T=!1,_=t.background;_?_.isColor&&(M.color.copy(_),t.background=null,T=!0):(M.color.copy(AE),T=!0);for(let y=0;y<6;y++){let A=y%3;A===0?(f.up.set(0,p[y],0),f.lookAt(d[y],0,0)):A===1?(f.up.set(0,0,p[y]),f.lookAt(0,d[y],0)):(f.up.set(0,p[y],0),f.lookAt(0,0,d[y]));let S=this._cubeSize;_f(a,A*S,y>2?S:0,S,S),g.setRenderTarget(a),T&&g.render(b,f),g.render(t,f)}b.geometry.dispose(),b.material.dispose(),g.toneMapping=v,g.autoClear=x,t.background=_}_textureToCubeUV(t,e){let o=this._renderer,a=t.mapping===Su||t.mapping===wu;a?(this._cubemapMaterial===null&&(this._cubemapMaterial=RE()),this._cubemapMaterial.uniforms.flipEnvMap.value=t.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=IE());let l=a?this._cubemapMaterial:this._equirectMaterial,h=new ho(this._lodPlanes[0],l),f=l.uniforms;f.envMap.value=t;let p=this._cubeSize;_f(e,0,0,3*p,2*p),o.setRenderTarget(e),o.render(h,Kd)}_applyPMREM(t){let e=this._renderer,o=e.autoClear;e.autoClear=!1;for(let a=1;a<this._lodPlanes.length;a++){let l=Math.sqrt(this._sigmas[a]*this._sigmas[a]-this._sigmas[a-1]*this._sigmas[a-1]),h=CE[(a-1)%CE.length];this._blur(t,a-1,a,l,h)}e.autoClear=o}_blur(t,e,o,a,l){let h=this._pingPongRenderTarget;this._halfBlur(t,h,e,o,a,"latitudinal",l),this._halfBlur(h,t,o,o,a,"longitudinal",l)}_halfBlur(t,e,o,a,l,h,f){let p=this._renderer,d=this._blurMaterial;h!=="latitudinal"&&h!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");let g=3,x=new ho(this._lodPlanes[a],d),v=d.uniforms,M=this._sizeLods[o]-1,b=isFinite(l)?Math.PI/(2*M):2*Math.PI/(2*da-1),T=l/b,_=isFinite(l)?1+Math.floor(g*T):da;_>da&&console.warn(`sigmaRadians, ${l}, is too large and will clip, as it requested ${_} samples when the maximum is set to ${da}`);let y=[],A=0;for(let F=0;F<da;++F){let I=F/T,ut=Math.exp(-I*I/2);y.push(ut),F===0?A+=ut:F<_&&(A+=2*ut)}for(let F=0;F<y.length;F++)y[F]=y[F]/A;v.envMap.value=t.texture,v.samples.value=_,v.weights.value=y,v.latitudinal.value=h==="latitudinal",f&&(v.poleAxis.value=f);let{_lodMax:S}=this;v.dTheta.value=b,v.mipInt.value=S-o;let L=this._sizeLods[a],G=3*L*(a>S-yu?a-S+yu:0),z=4*(this._cubeSize-L);_f(e,G,z,3*L,2*L),p.setRenderTarget(e),p.render(x,Kd)}};function q3(r){let t=[],e=[],o=[],a=r,l=r-yu+1+TE.length;for(let h=0;h<l;h++){let f=Math.pow(2,a);e.push(f);let p=1/f;h>r-yu?p=TE[h-r+yu-1]:h===0&&(p=0),o.push(p);let d=1/(f-2),g=-d,x=1+d,v=[g,g,x,g,x,x,g,g,x,x,g,x],M=6,b=6,T=3,_=2,y=1,A=new Float32Array(T*b*M),S=new Float32Array(_*b*M),L=new Float32Array(y*b*M);for(let z=0;z<M;z++){let F=z%3*2/3-1,I=z>2?0:-1,ut=[F,I,0,F+2/3,I,0,F+2/3,I+1,0,F,I,0,F+2/3,I+1,0,F,I+1,0];A.set(ut,T*b*z),S.set(v,_*b*z);let R=[z,z,z,z,z,z];L.set(R,y*b*z)}let G=new Us;G.setAttribute("position",new Ni(A,T)),G.setAttribute("uv",new Ni(S,_)),G.setAttribute("faceIndex",new Ni(L,y)),t.push(G),a>yu&&a--}return{lodPlanes:t,sizeLods:e,sigmas:o}}function PE(r,t,e){let o=new us(r,t,e);return o.texture.mapping=Xf,o.texture.name="PMREM.cubeUv",o.scissorTest=!0,o}function _f(r,t,e,o,a){r.viewport.set(t,e,o,a),r.scissor.set(t,e,o,a)}function V3(r,t,e){let o=new Float32Array(da),a=new yt(0,1,0);return new Io({name:"SphericalGaussianBlur",defines:{n:da,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/e,CUBEUV_MAX_MIP:`${r}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:o},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:a}},vertexShader:$m(),fragmentShader:`
|
|
3553
|
+
}`,xe={alphahash_fragment:eO,alphahash_pars_fragment:nO,alphamap_fragment:rO,alphamap_pars_fragment:iO,alphatest_fragment:oO,alphatest_pars_fragment:sO,aomap_fragment:aO,aomap_pars_fragment:uO,batching_pars_vertex:lO,batching_vertex:cO,begin_vertex:fO,beginnormal_vertex:hO,bsdfs:pO,iridescence_fragment:dO,bumpmap_pars_fragment:mO,clipping_planes_fragment:gO,clipping_planes_pars_fragment:yO,clipping_planes_pars_vertex:vO,clipping_planes_vertex:_O,color_fragment:xO,color_pars_fragment:EO,color_pars_vertex:MO,color_vertex:SO,common:wO,cube_uv_reflection_fragment:bO,defaultnormal_vertex:TO,displacementmap_pars_vertex:AO,displacementmap_vertex:CO,emissivemap_fragment:PO,emissivemap_pars_fragment:IO,colorspace_fragment:RO,colorspace_pars_fragment:LO,envmap_fragment:NO,envmap_common_pars_fragment:OO,envmap_pars_fragment:DO,envmap_pars_vertex:FO,envmap_physical_pars_fragment:$O,envmap_vertex:UO,fog_vertex:BO,fog_pars_vertex:zO,fog_fragment:GO,fog_pars_fragment:kO,gradientmap_pars_fragment:qO,lightmap_fragment:VO,lightmap_pars_fragment:HO,lights_lambert_fragment:WO,lights_lambert_pars_fragment:XO,lights_pars_begin:YO,lights_toon_fragment:ZO,lights_toon_pars_fragment:JO,lights_phong_fragment:KO,lights_phong_pars_fragment:jO,lights_physical_fragment:QO,lights_physical_pars_fragment:tD,lights_fragment_begin:eD,lights_fragment_maps:nD,lights_fragment_end:rD,logdepthbuf_fragment:iD,logdepthbuf_pars_fragment:oD,logdepthbuf_pars_vertex:sD,logdepthbuf_vertex:aD,map_fragment:uD,map_pars_fragment:lD,map_particle_fragment:cD,map_particle_pars_fragment:fD,metalnessmap_fragment:hD,metalnessmap_pars_fragment:pD,morphinstance_vertex:dD,morphcolor_vertex:mD,morphnormal_vertex:gD,morphtarget_pars_vertex:yD,morphtarget_vertex:vD,normal_fragment_begin:_D,normal_fragment_maps:xD,normal_pars_fragment:ED,normal_pars_vertex:MD,normal_vertex:SD,normalmap_pars_fragment:wD,clearcoat_normal_fragment_begin:bD,clearcoat_normal_fragment_maps:TD,clearcoat_pars_fragment:AD,iridescence_pars_fragment:CD,opaque_fragment:PD,packing:ID,premultiplied_alpha_fragment:RD,project_vertex:LD,dithering_fragment:ND,dithering_pars_fragment:OD,roughnessmap_fragment:DD,roughnessmap_pars_fragment:FD,shadowmap_pars_fragment:UD,shadowmap_pars_vertex:BD,shadowmap_vertex:zD,shadowmask_pars_fragment:GD,skinbase_vertex:kD,skinning_pars_vertex:qD,skinning_vertex:VD,skinnormal_vertex:HD,specularmap_fragment:WD,specularmap_pars_fragment:XD,tonemapping_fragment:YD,tonemapping_pars_fragment:$D,transmission_fragment:ZD,transmission_pars_fragment:JD,uv_pars_fragment:KD,uv_pars_vertex:jD,uv_vertex:QD,worldpos_vertex:t3,background_vert:e3,background_frag:n3,backgroundCube_vert:r3,backgroundCube_frag:i3,cube_vert:o3,cube_frag:s3,depth_vert:a3,depth_frag:u3,distanceRGBA_vert:l3,distanceRGBA_frag:c3,equirect_vert:f3,equirect_frag:h3,linedashed_vert:p3,linedashed_frag:d3,meshbasic_vert:m3,meshbasic_frag:g3,meshlambert_vert:y3,meshlambert_frag:v3,meshmatcap_vert:_3,meshmatcap_frag:x3,meshnormal_vert:E3,meshnormal_frag:M3,meshphong_vert:S3,meshphong_frag:w3,meshphysical_vert:b3,meshphysical_frag:T3,meshtoon_vert:A3,meshtoon_frag:C3,points_vert:P3,points_frag:I3,shadow_vert:R3,shadow_frag:L3,sprite_vert:N3,sprite_frag:O3},qt={common:{diffuse:{value:new vn(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new _e},alphaMap:{value:null},alphaMapTransform:{value:new _e},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new _e}},envmap:{envMap:{value:null},envMapRotation:{value:new _e},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new _e}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new _e}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new _e},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new _e},normalScale:{value:new ye(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new _e},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new _e}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new _e}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new _e}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new vn(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new vn(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new _e},alphaTest:{value:0},uvTransform:{value:new _e}},sprite:{diffuse:{value:new vn(16777215)},opacity:{value:1},center:{value:new ye(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new _e},alphaMap:{value:null},alphaMapTransform:{value:new _e},alphaTest:{value:0}}},Co={basic:{uniforms:fi([qt.common,qt.specularmap,qt.envmap,qt.aomap,qt.lightmap,qt.fog]),vertexShader:xe.meshbasic_vert,fragmentShader:xe.meshbasic_frag},lambert:{uniforms:fi([qt.common,qt.specularmap,qt.envmap,qt.aomap,qt.lightmap,qt.emissivemap,qt.bumpmap,qt.normalmap,qt.displacementmap,qt.fog,qt.lights,{emissive:{value:new vn(0)}}]),vertexShader:xe.meshlambert_vert,fragmentShader:xe.meshlambert_frag},phong:{uniforms:fi([qt.common,qt.specularmap,qt.envmap,qt.aomap,qt.lightmap,qt.emissivemap,qt.bumpmap,qt.normalmap,qt.displacementmap,qt.fog,qt.lights,{emissive:{value:new vn(0)},specular:{value:new vn(1118481)},shininess:{value:30}}]),vertexShader:xe.meshphong_vert,fragmentShader:xe.meshphong_frag},standard:{uniforms:fi([qt.common,qt.envmap,qt.aomap,qt.lightmap,qt.emissivemap,qt.bumpmap,qt.normalmap,qt.displacementmap,qt.roughnessmap,qt.metalnessmap,qt.fog,qt.lights,{emissive:{value:new vn(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:xe.meshphysical_vert,fragmentShader:xe.meshphysical_frag},toon:{uniforms:fi([qt.common,qt.aomap,qt.lightmap,qt.emissivemap,qt.bumpmap,qt.normalmap,qt.displacementmap,qt.gradientmap,qt.fog,qt.lights,{emissive:{value:new vn(0)}}]),vertexShader:xe.meshtoon_vert,fragmentShader:xe.meshtoon_frag},matcap:{uniforms:fi([qt.common,qt.bumpmap,qt.normalmap,qt.displacementmap,qt.fog,{matcap:{value:null}}]),vertexShader:xe.meshmatcap_vert,fragmentShader:xe.meshmatcap_frag},points:{uniforms:fi([qt.points,qt.fog]),vertexShader:xe.points_vert,fragmentShader:xe.points_frag},dashed:{uniforms:fi([qt.common,qt.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:xe.linedashed_vert,fragmentShader:xe.linedashed_frag},depth:{uniforms:fi([qt.common,qt.displacementmap]),vertexShader:xe.depth_vert,fragmentShader:xe.depth_frag},normal:{uniforms:fi([qt.common,qt.bumpmap,qt.normalmap,qt.displacementmap,{opacity:{value:1}}]),vertexShader:xe.meshnormal_vert,fragmentShader:xe.meshnormal_frag},sprite:{uniforms:fi([qt.sprite,qt.fog]),vertexShader:xe.sprite_vert,fragmentShader:xe.sprite_frag},background:{uniforms:{uvTransform:{value:new _e},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:xe.background_vert,fragmentShader:xe.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new _e}},vertexShader:xe.backgroundCube_vert,fragmentShader:xe.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:xe.cube_vert,fragmentShader:xe.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:xe.equirect_vert,fragmentShader:xe.equirect_frag},distanceRGBA:{uniforms:fi([qt.common,qt.displacementmap,{referencePosition:{value:new yt},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:xe.distanceRGBA_vert,fragmentShader:xe.distanceRGBA_frag},shadow:{uniforms:fi([qt.lights,qt.fog,{color:{value:new vn(0)},opacity:{value:1}}]),vertexShader:xe.shadow_vert,fragmentShader:xe.shadow_frag}};Co.physical={uniforms:fi([Co.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new _e},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new _e},clearcoatNormalScale:{value:new ye(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new _e},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new _e},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new _e},sheen:{value:0},sheenColor:{value:new vn(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new _e},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new _e},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new _e},transmissionSamplerSize:{value:new ye},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new _e},attenuationDistance:{value:0},attenuationColor:{value:new vn(0)},specularColor:{value:new vn(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new _e},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new _e},anisotropyVector:{value:new ye},anisotropyMap:{value:null},anisotropyMapTransform:{value:new _e}}]),vertexShader:xe.meshphysical_vert,fragmentShader:xe.meshphysical_frag};var _f={r:0,b:0,g:0},ca=new xa,D3=new cr;function F3(r,t,e,o,a,l,h){let f=new vn(0),p=l===!0?0:1,d,g,x=null,v=0,M=null;function b(_,y){let A=!1,S=y.isScene===!0?y.background:null;S&&S.isTexture&&(S=(y.backgroundBlurriness>0?e:t).get(S)),S===null?T(f,p):S&&S.isColor&&(T(S,1),A=!0);let L=r.xr.getEnvironmentBlendMode();L==="additive"?o.buffers.color.setClear(0,0,0,1,h):L==="alpha-blend"&&o.buffers.color.setClear(0,0,0,0,h),(r.autoClear||A)&&r.clear(r.autoClearColor,r.autoClearDepth,r.autoClearStencil),S&&(S.isCubeTexture||S.mapping===Yf)?(g===void 0&&(g=new ho(new Dl(1,1,1),new Io({name:"BackgroundCubeMaterial",uniforms:Tu(Co.backgroundCube.uniforms),vertexShader:Co.backgroundCube.vertexShader,fragmentShader:Co.backgroundCube.fragmentShader,side:Ei,depthTest:!1,depthWrite:!1,fog:!1})),g.geometry.deleteAttribute("normal"),g.geometry.deleteAttribute("uv"),g.onBeforeRender=function(G,z,F){this.matrixWorld.copyPosition(F.matrixWorld)},Object.defineProperty(g.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),a.update(g)),ca.copy(y.backgroundRotation),ca.x*=-1,ca.y*=-1,ca.z*=-1,S.isCubeTexture&&S.isRenderTargetTexture===!1&&(ca.y*=-1,ca.z*=-1),g.material.uniforms.envMap.value=S,g.material.uniforms.flipEnvMap.value=S.isCubeTexture&&S.isRenderTargetTexture===!1?-1:1,g.material.uniforms.backgroundBlurriness.value=y.backgroundBlurriness,g.material.uniforms.backgroundIntensity.value=y.backgroundIntensity,g.material.uniforms.backgroundRotation.value.setFromMatrix4(D3.makeRotationFromEuler(ca)),g.material.toneMapped=Cn.getTransfer(S.colorSpace)!==Un,(x!==S||v!==S.version||M!==r.toneMapping)&&(g.material.needsUpdate=!0,x=S,v=S.version,M=r.toneMapping),g.layers.enableAll(),_.unshift(g,g.geometry,g.material,0,0,null)):S&&S.isTexture&&(d===void 0&&(d=new ho(new Vf(2,2),new Io({name:"BackgroundMaterial",uniforms:Tu(Co.background.uniforms),vertexShader:Co.background.vertexShader,fragmentShader:Co.background.fragmentShader,side:Os,depthTest:!1,depthWrite:!1,fog:!1})),d.geometry.deleteAttribute("normal"),Object.defineProperty(d.material,"map",{get:function(){return this.uniforms.t2D.value}}),a.update(d)),d.material.uniforms.t2D.value=S,d.material.uniforms.backgroundIntensity.value=y.backgroundIntensity,d.material.toneMapped=Cn.getTransfer(S.colorSpace)!==Un,S.matrixAutoUpdate===!0&&S.updateMatrix(),d.material.uniforms.uvTransform.value.copy(S.matrix),(x!==S||v!==S.version||M!==r.toneMapping)&&(d.material.needsUpdate=!0,x=S,v=S.version,M=r.toneMapping),d.layers.enableAll(),_.unshift(d,d.geometry,d.material,0,0,null))}function T(_,y){_.getRGB(_f,lM(r)),o.buffers.color.setClear(_f.r,_f.g,_f.b,y,h)}return{getClearColor:function(){return f},setClearColor:function(_,y=1){f.set(_),p=y,T(f,p)},getClearAlpha:function(){return p},setClearAlpha:function(_){p=_,T(f,p)},render:b}}function U3(r,t,e,o){let a=r.getParameter(r.MAX_VERTEX_ATTRIBS),l=o.isWebGL2?null:t.get("OES_vertex_array_object"),h=o.isWebGL2||l!==null,f={},p=_(null),d=p,g=!1;function x(X,mt,dt,_t,it){let lt=!1;if(h){let H=T(_t,dt,mt);d!==H&&(d=H,M(d.object)),lt=y(X,_t,dt,it),lt&&A(X,_t,dt,it)}else{let H=mt.wireframe===!0;(d.geometry!==_t.id||d.program!==dt.id||d.wireframe!==H)&&(d.geometry=_t.id,d.program=dt.id,d.wireframe=H,lt=!0)}it!==null&&e.update(it,r.ELEMENT_ARRAY_BUFFER),(lt||g)&&(g=!1,I(X,mt,dt,_t),it!==null&&r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,e.get(it).buffer))}function v(){return o.isWebGL2?r.createVertexArray():l.createVertexArrayOES()}function M(X){return o.isWebGL2?r.bindVertexArray(X):l.bindVertexArrayOES(X)}function b(X){return o.isWebGL2?r.deleteVertexArray(X):l.deleteVertexArrayOES(X)}function T(X,mt,dt){let _t=dt.wireframe===!0,it=f[X.id];it===void 0&&(it={},f[X.id]=it);let lt=it[mt.id];lt===void 0&&(lt={},it[mt.id]=lt);let H=lt[_t];return H===void 0&&(H=_(v()),lt[_t]=H),H}function _(X){let mt=[],dt=[],_t=[];for(let it=0;it<a;it++)mt[it]=0,dt[it]=0,_t[it]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:mt,enabledAttributes:dt,attributeDivisors:_t,object:X,attributes:{},index:null}}function y(X,mt,dt,_t){let it=d.attributes,lt=mt.attributes,H=0,bt=dt.getAttributes();for(let Tt in bt)if(bt[Tt].location>=0){let tt=it[Tt],wt=lt[Tt];if(wt===void 0&&(Tt==="instanceMatrix"&&X.instanceMatrix&&(wt=X.instanceMatrix),Tt==="instanceColor"&&X.instanceColor&&(wt=X.instanceColor)),tt===void 0||tt.attribute!==wt||wt&&tt.data!==wt.data)return!0;H++}return d.attributesNum!==H||d.index!==_t}function A(X,mt,dt,_t){let it={},lt=mt.attributes,H=0,bt=dt.getAttributes();for(let Tt in bt)if(bt[Tt].location>=0){let tt=lt[Tt];tt===void 0&&(Tt==="instanceMatrix"&&X.instanceMatrix&&(tt=X.instanceMatrix),Tt==="instanceColor"&&X.instanceColor&&(tt=X.instanceColor));let wt={};wt.attribute=tt,tt&&tt.data&&(wt.data=tt.data),it[Tt]=wt,H++}d.attributes=it,d.attributesNum=H,d.index=_t}function S(){let X=d.newAttributes;for(let mt=0,dt=X.length;mt<dt;mt++)X[mt]=0}function L(X){G(X,0)}function G(X,mt){let dt=d.newAttributes,_t=d.enabledAttributes,it=d.attributeDivisors;dt[X]=1,_t[X]===0&&(r.enableVertexAttribArray(X),_t[X]=1),it[X]!==mt&&((o.isWebGL2?r:t.get("ANGLE_instanced_arrays"))[o.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](X,mt),it[X]=mt)}function z(){let X=d.newAttributes,mt=d.enabledAttributes;for(let dt=0,_t=mt.length;dt<_t;dt++)mt[dt]!==X[dt]&&(r.disableVertexAttribArray(dt),mt[dt]=0)}function F(X,mt,dt,_t,it,lt,H){H===!0?r.vertexAttribIPointer(X,mt,dt,it,lt):r.vertexAttribPointer(X,mt,dt,_t,it,lt)}function I(X,mt,dt,_t){if(o.isWebGL2===!1&&(X.isInstancedMesh||_t.isInstancedBufferGeometry)&&t.get("ANGLE_instanced_arrays")===null)return;S();let it=_t.attributes,lt=dt.getAttributes(),H=mt.defaultAttributeValues;for(let bt in lt){let Tt=lt[bt];if(Tt.location>=0){let Yt=it[bt];if(Yt===void 0&&(bt==="instanceMatrix"&&X.instanceMatrix&&(Yt=X.instanceMatrix),bt==="instanceColor"&&X.instanceColor&&(Yt=X.instanceColor)),Yt!==void 0){let tt=Yt.normalized,wt=Yt.itemSize,Bt=e.get(Yt);if(Bt===void 0)continue;let $t=Bt.buffer,Ut=Bt.type,Dt=Bt.bytesPerElement,At=o.isWebGL2===!0&&(Ut===r.INT||Ut===r.UNSIGNED_INT||Yt.gpuType===jE);if(Yt.isInterleavedBufferAttribute){let te=Yt.data,rt=te.stride,an=Yt.offset;if(te.isInstancedInterleavedBuffer){for(let zt=0;zt<Tt.locationSize;zt++)G(Tt.location+zt,te.meshPerAttribute);X.isInstancedMesh!==!0&&_t._maxInstanceCount===void 0&&(_t._maxInstanceCount=te.meshPerAttribute*te.count)}else for(let zt=0;zt<Tt.locationSize;zt++)L(Tt.location+zt);r.bindBuffer(r.ARRAY_BUFFER,$t);for(let zt=0;zt<Tt.locationSize;zt++)F(Tt.location+zt,wt/Tt.locationSize,Ut,tt,rt*Dt,(an+wt/Tt.locationSize*zt)*Dt,At)}else{if(Yt.isInstancedBufferAttribute){for(let te=0;te<Tt.locationSize;te++)G(Tt.location+te,Yt.meshPerAttribute);X.isInstancedMesh!==!0&&_t._maxInstanceCount===void 0&&(_t._maxInstanceCount=Yt.meshPerAttribute*Yt.count)}else for(let te=0;te<Tt.locationSize;te++)L(Tt.location+te);r.bindBuffer(r.ARRAY_BUFFER,$t);for(let te=0;te<Tt.locationSize;te++)F(Tt.location+te,wt/Tt.locationSize,Ut,tt,wt*Dt,wt/Tt.locationSize*te*Dt,At)}}else if(H!==void 0){let tt=H[bt];if(tt!==void 0)switch(tt.length){case 2:r.vertexAttrib2fv(Tt.location,tt);break;case 3:r.vertexAttrib3fv(Tt.location,tt);break;case 4:r.vertexAttrib4fv(Tt.location,tt);break;default:r.vertexAttrib1fv(Tt.location,tt)}}}}z()}function ut(){V();for(let X in f){let mt=f[X];for(let dt in mt){let _t=mt[dt];for(let it in _t)b(_t[it].object),delete _t[it];delete mt[dt]}delete f[X]}}function R(X){if(f[X.id]===void 0)return;let mt=f[X.id];for(let dt in mt){let _t=mt[dt];for(let it in _t)b(_t[it].object),delete _t[it];delete mt[dt]}delete f[X.id]}function W(X){for(let mt in f){let dt=f[mt];if(dt[X.id]===void 0)continue;let _t=dt[X.id];for(let it in _t)b(_t[it].object),delete _t[it];delete dt[X.id]}}function V(){Mt(),g=!0,d!==p&&(d=p,M(d.object))}function Mt(){p.geometry=null,p.program=null,p.wireframe=!1}return{setup:x,reset:V,resetDefaultState:Mt,dispose:ut,releaseStatesOfGeometry:R,releaseStatesOfProgram:W,initAttributes:S,enableAttribute:L,disableUnusedAttributes:z}}function B3(r,t,e,o){let a=o.isWebGL2,l;function h(g){l=g}function f(g,x){r.drawArrays(l,g,x),e.update(x,l,1)}function p(g,x,v){if(v===0)return;let M,b;if(a)M=r,b="drawArraysInstanced";else if(M=t.get("ANGLE_instanced_arrays"),b="drawArraysInstancedANGLE",M===null){console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}M[b](l,g,x,v),e.update(x,l,v)}function d(g,x,v){if(v===0)return;let M=t.get("WEBGL_multi_draw");if(M===null)for(let b=0;b<v;b++)this.render(g[b],x[b]);else{M.multiDrawArraysWEBGL(l,g,0,x,0,v);let b=0;for(let T=0;T<v;T++)b+=x[T];e.update(b,l,1)}}this.setMode=h,this.render=f,this.renderInstances=p,this.renderMultiDraw=d}function z3(r,t,e){let o;function a(){if(o!==void 0)return o;if(t.has("EXT_texture_filter_anisotropic")===!0){let F=t.get("EXT_texture_filter_anisotropic");o=r.getParameter(F.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else o=0;return o}function l(F){if(F==="highp"){if(r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.HIGH_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).precision>0)return"highp";F="mediump"}return F==="mediump"&&r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.MEDIUM_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let h=typeof WebGL2RenderingContext!="undefined"&&r.constructor.name==="WebGL2RenderingContext",f=e.precision!==void 0?e.precision:"highp",p=l(f);p!==f&&(console.warn("THREE.WebGLRenderer:",f,"not supported, using",p,"instead."),f=p);let d=h||t.has("WEBGL_draw_buffers"),g=e.logarithmicDepthBuffer===!0,x=r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS),v=r.getParameter(r.MAX_VERTEX_TEXTURE_IMAGE_UNITS),M=r.getParameter(r.MAX_TEXTURE_SIZE),b=r.getParameter(r.MAX_CUBE_MAP_TEXTURE_SIZE),T=r.getParameter(r.MAX_VERTEX_ATTRIBS),_=r.getParameter(r.MAX_VERTEX_UNIFORM_VECTORS),y=r.getParameter(r.MAX_VARYING_VECTORS),A=r.getParameter(r.MAX_FRAGMENT_UNIFORM_VECTORS),S=v>0,L=h||t.has("OES_texture_float"),G=S&&L,z=h?r.getParameter(r.MAX_SAMPLES):0;return{isWebGL2:h,drawBuffers:d,getMaxAnisotropy:a,getMaxPrecision:l,precision:f,logarithmicDepthBuffer:g,maxTextures:x,maxVertexTextures:v,maxTextureSize:M,maxCubemapSize:b,maxAttributes:T,maxVertexUniforms:_,maxVaryings:y,maxFragmentUniforms:A,vertexTextures:S,floatFragmentTextures:L,floatVertexTextures:G,maxSamples:z}}function G3(r){let t=this,e=null,o=0,a=!1,l=!1,h=new rs,f=new _e,p={value:null,needsUpdate:!1};this.uniform=p,this.numPlanes=0,this.numIntersection=0,this.init=function(x,v){let M=x.length!==0||v||o!==0||a;return a=v,o=x.length,M},this.beginShadows=function(){l=!0,g(null)},this.endShadows=function(){l=!1},this.setGlobalState=function(x,v){e=g(x,v,0)},this.setState=function(x,v,M){let b=x.clippingPlanes,T=x.clipIntersection,_=x.clipShadows,y=r.get(x);if(!a||b===null||b.length===0||l&&!_)l?g(null):d();else{let A=l?0:o,S=A*4,L=y.clippingState||null;p.value=L,L=g(b,v,S,M);for(let G=0;G!==S;++G)L[G]=e[G];y.clippingState=L,this.numIntersection=T?this.numPlanes:0,this.numPlanes+=A}};function d(){p.value!==e&&(p.value=e,p.needsUpdate=o>0),t.numPlanes=o,t.numIntersection=0}function g(x,v,M,b){let T=x!==null?x.length:0,_=null;if(T!==0){if(_=p.value,b!==!0||_===null){let y=M+T*4,A=v.matrixWorldInverse;f.getNormalMatrix(A),(_===null||_.length<y)&&(_=new Float32Array(y));for(let S=0,L=M;S!==T;++S,L+=4)h.copy(x[S]).applyMatrix4(A,f),h.normal.toArray(_,L),_[L+3]=h.constant}p.value=_,p.needsUpdate=!0}return t.numPlanes=T,t.numIntersection=0,_}}function k3(r){let t=new WeakMap;function e(h,f){return f===om?h.mapping=Su:f===sm&&(h.mapping=wu),h}function o(h){if(h&&h.isTexture){let f=h.mapping;if(f===om||f===sm)if(t.has(h)){let p=t.get(h).texture;return e(p,h.mapping)}else{let p=h.image;if(p&&p.height>0){let d=new ym(p.height);return d.fromEquirectangularTexture(r,h),t.set(h,d),h.addEventListener("dispose",a),e(d.texture,h.mapping)}else return null}}return h}function a(h){let f=h.target;f.removeEventListener("dispose",a);let p=t.get(f);p!==void 0&&(t.delete(f),p.dispose())}function l(){t=new WeakMap}return{get:o,dispose:l}}var vm=class extends Gf{constructor(t=-1,e=1,o=1,a=-1,l=.1,h=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=o,this.bottom=a,this.near=l,this.far=h,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=t.view===null?null:Object.assign({},t.view),this}setViewOffset(t,e,o,a,l,h){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=o,this.view.offsetY=a,this.view.width=l,this.view.height=h,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),o=(this.right+this.left)/2,a=(this.top+this.bottom)/2,l=o-t,h=o+t,f=a+e,p=a-e;if(this.view!==null&&this.view.enabled){let d=(this.right-this.left)/this.view.fullWidth/this.zoom,g=(this.top-this.bottom)/this.view.fullHeight/this.zoom;l+=d*this.view.offsetX,h=l+d*this.view.width,f-=g*this.view.offsetY,p=f-g*this.view.height}this.projectionMatrix.makeOrthographic(l,h,f,p,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){let e=super.toJSON(t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,this.view!==null&&(e.object.view=Object.assign({},this.view)),e}},yu=4,TE=[.125,.215,.35,.446,.526,.582],da=20,Kd=new vm,AE=new vn,jd=null,Qd=0,tm=0,ha=(1+Math.sqrt(5))/2,pu=1/ha,CE=[new yt(1,1,1),new yt(-1,1,1),new yt(1,1,-1),new yt(-1,1,-1),new yt(0,ha,pu),new yt(0,ha,-pu),new yt(pu,0,ha),new yt(-pu,0,ha),new yt(ha,pu,0),new yt(-ha,pu,0)],Hf=class{constructor(t){this._renderer=t,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(t,e=0,o=.1,a=100){jd=this._renderer.getRenderTarget(),Qd=this._renderer.getActiveCubeFace(),tm=this._renderer.getActiveMipmapLevel(),this._setSize(256);let l=this._allocateTargets();return l.depthBuffer=!0,this._sceneToCubeUV(t,o,a,l),e>0&&this._blur(l,0,0,e),this._applyPMREM(l),this._cleanup(l),l}fromEquirectangular(t,e=null){return this._fromTexture(t,e)}fromCubemap(t,e=null){return this._fromTexture(t,e)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=RE(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=IE(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(t){this._lodMax=Math.floor(Math.log2(t)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let t=0;t<this._lodPlanes.length;t++)this._lodPlanes[t].dispose()}_cleanup(t){this._renderer.setRenderTarget(jd,Qd,tm),t.scissorTest=!1,xf(t,0,0,t.width,t.height)}_fromTexture(t,e){t.mapping===Su||t.mapping===wu?this._setSize(t.image.length===0?16:t.image[0].width||t.image[0].image.width):this._setSize(t.image.width/4),jd=this._renderer.getRenderTarget(),Qd=this._renderer.getActiveCubeFace(),tm=this._renderer.getActiveMipmapLevel();let o=e||this._allocateTargets();return this._textureToCubeUV(t,o),this._applyPMREM(o),this._cleanup(o),o}_allocateTargets(){let t=3*Math.max(this._cubeSize,112),e=4*this._cubeSize,o={magFilter:_i,minFilter:_i,generateMipmaps:!1,type:Nl,format:fo,colorSpace:Bs,depthBuffer:!1},a=PE(t,e,o);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==t||this._pingPongRenderTarget.height!==e){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=PE(t,e,o);let{_lodMax:l}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=q3(l)),this._blurMaterial=V3(l,t,e)}return a}_compileMaterial(t){let e=new ho(this._lodPlanes[0],t);this._renderer.compile(e,Kd)}_sceneToCubeUV(t,e,o,a){let f=new Li(90,1,e,o),p=[1,-1,1,1,1,1],d=[1,1,1,-1,-1,-1],g=this._renderer,x=g.autoClear,v=g.toneMapping;g.getClearColor(AE),g.toneMapping=Rs,g.autoClear=!1;let M=new Uf({name:"PMREM.Background",side:Ei,depthWrite:!1,depthTest:!1}),b=new ho(new Dl,M),T=!1,_=t.background;_?_.isColor&&(M.color.copy(_),t.background=null,T=!0):(M.color.copy(AE),T=!0);for(let y=0;y<6;y++){let A=y%3;A===0?(f.up.set(0,p[y],0),f.lookAt(d[y],0,0)):A===1?(f.up.set(0,0,p[y]),f.lookAt(0,d[y],0)):(f.up.set(0,p[y],0),f.lookAt(0,0,d[y]));let S=this._cubeSize;xf(a,A*S,y>2?S:0,S,S),g.setRenderTarget(a),T&&g.render(b,f),g.render(t,f)}b.geometry.dispose(),b.material.dispose(),g.toneMapping=v,g.autoClear=x,t.background=_}_textureToCubeUV(t,e){let o=this._renderer,a=t.mapping===Su||t.mapping===wu;a?(this._cubemapMaterial===null&&(this._cubemapMaterial=RE()),this._cubemapMaterial.uniforms.flipEnvMap.value=t.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=IE());let l=a?this._cubemapMaterial:this._equirectMaterial,h=new ho(this._lodPlanes[0],l),f=l.uniforms;f.envMap.value=t;let p=this._cubeSize;xf(e,0,0,3*p,2*p),o.setRenderTarget(e),o.render(h,Kd)}_applyPMREM(t){let e=this._renderer,o=e.autoClear;e.autoClear=!1;for(let a=1;a<this._lodPlanes.length;a++){let l=Math.sqrt(this._sigmas[a]*this._sigmas[a]-this._sigmas[a-1]*this._sigmas[a-1]),h=CE[(a-1)%CE.length];this._blur(t,a-1,a,l,h)}e.autoClear=o}_blur(t,e,o,a,l){let h=this._pingPongRenderTarget;this._halfBlur(t,h,e,o,a,"latitudinal",l),this._halfBlur(h,t,o,o,a,"longitudinal",l)}_halfBlur(t,e,o,a,l,h,f){let p=this._renderer,d=this._blurMaterial;h!=="latitudinal"&&h!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");let g=3,x=new ho(this._lodPlanes[a],d),v=d.uniforms,M=this._sizeLods[o]-1,b=isFinite(l)?Math.PI/(2*M):2*Math.PI/(2*da-1),T=l/b,_=isFinite(l)?1+Math.floor(g*T):da;_>da&&console.warn(`sigmaRadians, ${l}, is too large and will clip, as it requested ${_} samples when the maximum is set to ${da}`);let y=[],A=0;for(let F=0;F<da;++F){let I=F/T,ut=Math.exp(-I*I/2);y.push(ut),F===0?A+=ut:F<_&&(A+=2*ut)}for(let F=0;F<y.length;F++)y[F]=y[F]/A;v.envMap.value=t.texture,v.samples.value=_,v.weights.value=y,v.latitudinal.value=h==="latitudinal",f&&(v.poleAxis.value=f);let{_lodMax:S}=this;v.dTheta.value=b,v.mipInt.value=S-o;let L=this._sizeLods[a],G=3*L*(a>S-yu?a-S+yu:0),z=4*(this._cubeSize-L);xf(e,G,z,3*L,2*L),p.setRenderTarget(e),p.render(x,Kd)}};function q3(r){let t=[],e=[],o=[],a=r,l=r-yu+1+TE.length;for(let h=0;h<l;h++){let f=Math.pow(2,a);e.push(f);let p=1/f;h>r-yu?p=TE[h-r+yu-1]:h===0&&(p=0),o.push(p);let d=1/(f-2),g=-d,x=1+d,v=[g,g,x,g,x,x,g,g,x,x,g,x],M=6,b=6,T=3,_=2,y=1,A=new Float32Array(T*b*M),S=new Float32Array(_*b*M),L=new Float32Array(y*b*M);for(let z=0;z<M;z++){let F=z%3*2/3-1,I=z>2?0:-1,ut=[F,I,0,F+2/3,I,0,F+2/3,I+1,0,F,I,0,F+2/3,I+1,0,F,I+1,0];A.set(ut,T*b*z),S.set(v,_*b*z);let R=[z,z,z,z,z,z];L.set(R,y*b*z)}let G=new Us;G.setAttribute("position",new Ni(A,T)),G.setAttribute("uv",new Ni(S,_)),G.setAttribute("faceIndex",new Ni(L,y)),t.push(G),a>yu&&a--}return{lodPlanes:t,sizeLods:e,sigmas:o}}function PE(r,t,e){let o=new us(r,t,e);return o.texture.mapping=Yf,o.texture.name="PMREM.cubeUv",o.scissorTest=!0,o}function xf(r,t,e,o,a){r.viewport.set(t,e,o,a),r.scissor.set(t,e,o,a)}function V3(r,t,e){let o=new Float32Array(da),a=new yt(0,1,0);return new Io({name:"SphericalGaussianBlur",defines:{n:da,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/e,CUBEUV_MAX_MIP:`${r}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:o},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:a}},vertexShader:$m(),fragmentShader:`
|
|
3554
3554
|
|
|
3555
3555
|
precision mediump float;
|
|
3556
3556
|
precision mediump int;
|
|
@@ -3700,9 +3700,9 @@ void main() {
|
|
|
3700
3700
|
gl_Position = vec4( position, 1.0 );
|
|
3701
3701
|
|
|
3702
3702
|
}
|
|
3703
|
-
`}function H3(r){let t=new WeakMap,e=null;function o(f){if(f&&f.isTexture){let p=f.mapping,d=p===om||p===sm,g=p===Su||p===wu;if(d||g)if(f.isRenderTargetTexture&&f.needsPMREMUpdate===!0){f.needsPMREMUpdate=!1;let x=t.get(f);return e===null&&(e=new Vf(r)),x=d?e.fromEquirectangular(f,x):e.fromCubemap(f,x),t.set(f,x),x.texture}else{if(t.has(f))return t.get(f).texture;{let x=f.image;if(d&&x&&x.height>0||g&&x&&a(x)){e===null&&(e=new Vf(r));let v=d?e.fromEquirectangular(f):e.fromCubemap(f);return t.set(f,v),f.addEventListener("dispose",l),v.texture}else return null}}}return f}function a(f){let p=0,d=6;for(let g=0;g<d;g++)f[g]!==void 0&&p++;return p===d}function l(f){let p=f.target;p.removeEventListener("dispose",l);let d=t.get(p);d!==void 0&&(t.delete(p),d.dispose())}function h(){t=new WeakMap,e!==null&&(e.dispose(),e=null)}return{get:o,dispose:h}}function W3(r){let t={};function e(o){if(t[o]!==void 0)return t[o];let a;switch(o){case"WEBGL_depth_texture":a=r.getExtension("WEBGL_depth_texture")||r.getExtension("MOZ_WEBGL_depth_texture")||r.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":a=r.getExtension("EXT_texture_filter_anisotropic")||r.getExtension("MOZ_EXT_texture_filter_anisotropic")||r.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":a=r.getExtension("WEBGL_compressed_texture_s3tc")||r.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||r.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":a=r.getExtension("WEBGL_compressed_texture_pvrtc")||r.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:a=r.getExtension(o)}return t[o]=a,a}return{has:function(o){return e(o)!==null},init:function(o){o.isWebGL2?(e("EXT_color_buffer_float"),e("WEBGL_clip_cull_distance")):(e("WEBGL_depth_texture"),e("OES_texture_float"),e("OES_texture_half_float"),e("OES_texture_half_float_linear"),e("OES_standard_derivatives"),e("OES_element_index_uint"),e("OES_vertex_array_object"),e("ANGLE_instanced_arrays")),e("OES_texture_float_linear"),e("EXT_color_buffer_half_float"),e("WEBGL_multisampled_render_to_texture")},get:function(o){let a=e(o);return a===null&&console.warn("THREE.WebGLRenderer: "+o+" extension not supported."),a}}}function X3(r,t,e,o){let a={},l=new WeakMap;function h(x){let v=x.target;v.index!==null&&t.remove(v.index);for(let b in v.attributes)t.remove(v.attributes[b]);for(let b in v.morphAttributes){let T=v.morphAttributes[b];for(let _=0,y=T.length;_<y;_++)t.remove(T[_])}v.removeEventListener("dispose",h),delete a[v.id];let M=l.get(v);M&&(t.remove(M),l.delete(v)),o.releaseStatesOfGeometry(v),v.isInstancedBufferGeometry===!0&&delete v._maxInstanceCount,e.memory.geometries--}function f(x,v){return a[v.id]===!0||(v.addEventListener("dispose",h),a[v.id]=!0,e.memory.geometries++),v}function p(x){let v=x.attributes;for(let b in v)t.update(v[b],r.ARRAY_BUFFER);let M=x.morphAttributes;for(let b in M){let T=M[b];for(let _=0,y=T.length;_<y;_++)t.update(T[_],r.ARRAY_BUFFER)}}function d(x){let v=[],M=x.index,b=x.attributes.position,T=0;if(M!==null){let A=M.array;T=M.version;for(let S=0,L=A.length;S<L;S+=3){let G=A[S+0],z=A[S+1],F=A[S+2];v.push(G,z,z,F,F,G)}}else if(b!==void 0){let A=b.array;T=b.version;for(let S=0,L=A.length/3-1;S<L;S+=3){let G=S+0,z=S+1,F=S+2;v.push(G,z,z,F,F,G)}}else return;let _=new(sM(v)?Bf:Uf)(v,1);_.version=T;let y=l.get(x);y&&t.remove(y),l.set(x,_)}function g(x){let v=l.get(x);if(v){let M=x.index;M!==null&&v.version<M.version&&d(x)}else d(x);return l.get(x)}return{get:f,update:p,getWireframeAttribute:g}}function Y3(r,t,e,o){let a=o.isWebGL2,l;function h(M){l=M}let f,p;function d(M){f=M.type,p=M.bytesPerElement}function g(M,b){r.drawElements(l,b,f,M*p),e.update(b,l,1)}function x(M,b,T){if(T===0)return;let _,y;if(a)_=r,y="drawElementsInstanced";else if(_=t.get("ANGLE_instanced_arrays"),y="drawElementsInstancedANGLE",_===null){console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}_[y](l,b,f,M*p,T),e.update(b,l,T)}function v(M,b,T){if(T===0)return;let _=t.get("WEBGL_multi_draw");if(_===null)for(let y=0;y<T;y++)this.render(M[y]/p,b[y]);else{_.multiDrawElementsWEBGL(l,b,0,f,M,0,T);let y=0;for(let A=0;A<T;A++)y+=b[A];e.update(y,l,1)}}this.setMode=h,this.setIndex=d,this.render=g,this.renderInstances=x,this.renderMultiDraw=v}function $3(r){let t={geometries:0,textures:0},e={frame:0,calls:0,triangles:0,points:0,lines:0};function o(l,h,f){switch(e.calls++,h){case r.TRIANGLES:e.triangles+=f*(l/3);break;case r.LINES:e.lines+=f*(l/2);break;case r.LINE_STRIP:e.lines+=f*(l-1);break;case r.LINE_LOOP:e.lines+=f*l;break;case r.POINTS:e.points+=f*l;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",h);break}}function a(){e.calls=0,e.triangles=0,e.points=0,e.lines=0}return{memory:t,render:e,programs:null,autoReset:!0,reset:a,update:o}}function Z3(r,t){return r[0]-t[0]}function J3(r,t){return Math.abs(t[1])-Math.abs(r[1])}function K3(r,t,e){let o={},a=new Float32Array(8),l=new WeakMap,h=new zr,f=[];for(let d=0;d<8;d++)f[d]=[d,0];function p(d,g,x){let v=d.morphTargetInfluences;if(t.isWebGL2===!0){let M=g.morphAttributes.position||g.morphAttributes.normal||g.morphAttributes.color,b=M!==void 0?M.length:0,T=l.get(g);if(T===void 0||T.count!==b){let V=function(){R.dispose(),l.delete(g),g.removeEventListener("dispose",V)};T!==void 0&&T.texture.dispose();let _=g.morphAttributes.position!==void 0,y=g.morphAttributes.normal!==void 0,A=g.morphAttributes.color!==void 0,S=g.morphAttributes.position||[],L=g.morphAttributes.normal||[],G=g.morphAttributes.color||[],z=0;_===!0&&(z=1),y===!0&&(z=2),A===!0&&(z=3);let F=g.attributes.position.count*z,I=1;F>t.maxTextureSize&&(I=Math.ceil(F/t.maxTextureSize),F=t.maxTextureSize);let ut=new Float32Array(F*I*4*b),R=new Of(ut,F,I,b);R.type=os,R.needsUpdate=!0;let W=z*4;for(let Mt=0;Mt<b;Mt++){let X=S[Mt],mt=L[Mt],dt=G[Mt],_t=F*I*4*Mt;for(let it=0;it<X.count;it++){let lt=it*W;_===!0&&(h.fromBufferAttribute(X,it),ut[_t+lt+0]=h.x,ut[_t+lt+1]=h.y,ut[_t+lt+2]=h.z,ut[_t+lt+3]=0),y===!0&&(h.fromBufferAttribute(mt,it),ut[_t+lt+4]=h.x,ut[_t+lt+5]=h.y,ut[_t+lt+6]=h.z,ut[_t+lt+7]=0),A===!0&&(h.fromBufferAttribute(dt,it),ut[_t+lt+8]=h.x,ut[_t+lt+9]=h.y,ut[_t+lt+10]=h.z,ut[_t+lt+11]=dt.itemSize===4?h.w:1)}}T={count:b,texture:R,size:new ye(F,I)},l.set(g,T),g.addEventListener("dispose",V)}if(d.isInstancedMesh===!0&&d.morphTexture!==null)x.getUniforms().setValue(r,"morphTexture",d.morphTexture,e);else{let _=0;for(let A=0;A<v.length;A++)_+=v[A];let y=g.morphTargetsRelative?1:1-_;x.getUniforms().setValue(r,"morphTargetBaseInfluence",y),x.getUniforms().setValue(r,"morphTargetInfluences",v)}x.getUniforms().setValue(r,"morphTargetsTexture",T.texture,e),x.getUniforms().setValue(r,"morphTargetsTextureSize",T.size)}else{let M=v===void 0?0:v.length,b=o[g.id];if(b===void 0||b.length!==M){b=[];for(let S=0;S<M;S++)b[S]=[S,0];o[g.id]=b}for(let S=0;S<M;S++){let L=b[S];L[0]=S,L[1]=v[S]}b.sort(J3);for(let S=0;S<8;S++)S<M&&b[S][1]?(f[S][0]=b[S][0],f[S][1]=b[S][1]):(f[S][0]=Number.MAX_SAFE_INTEGER,f[S][1]=0);f.sort(Z3);let T=g.morphAttributes.position,_=g.morphAttributes.normal,y=0;for(let S=0;S<8;S++){let L=f[S],G=L[0],z=L[1];G!==Number.MAX_SAFE_INTEGER&&z?(T&&g.getAttribute("morphTarget"+S)!==T[G]&&g.setAttribute("morphTarget"+S,T[G]),_&&g.getAttribute("morphNormal"+S)!==_[G]&&g.setAttribute("morphNormal"+S,_[G]),a[S]=z,y+=z):(T&&g.hasAttribute("morphTarget"+S)===!0&&g.deleteAttribute("morphTarget"+S),_&&g.hasAttribute("morphNormal"+S)===!0&&g.deleteAttribute("morphNormal"+S),a[S]=0)}let A=g.morphTargetsRelative?1:1-y;x.getUniforms().setValue(r,"morphTargetBaseInfluence",A),x.getUniforms().setValue(r,"morphTargetInfluences",a)}}return{update:p}}function j3(r,t,e,o){let a=new WeakMap;function l(p){let d=o.render.frame,g=p.geometry,x=t.get(p,g);if(a.get(x)!==d&&(t.update(x),a.set(x,d)),p.isInstancedMesh&&(p.hasEventListener("dispose",f)===!1&&p.addEventListener("dispose",f),a.get(p)!==d&&(e.update(p.instanceMatrix,r.ARRAY_BUFFER),p.instanceColor!==null&&e.update(p.instanceColor,r.ARRAY_BUFFER),a.set(p,d))),p.isSkinnedMesh){let v=p.skeleton;a.get(v)!==d&&(v.update(),a.set(v,d))}return x}function h(){a=new WeakMap}function f(p){let d=p.target;d.removeEventListener("dispose",f),e.remove(d.instanceMatrix),d.instanceColor!==null&&e.remove(d.instanceColor)}return{update:l,dispose:h}}var Hf=class extends Hi{constructor(t,e,o,a,l,h,f,p,d,g){if(g=g!==void 0?g:va,g!==va&&g!==bu)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");o===void 0&&g===va&&(o=Ps),o===void 0&&g===bu&&(o=ya),super(null,a,l,h,f,p,g,o,d),this.isDepthTexture=!0,this.image={width:t,height:e},this.magFilter=f!==void 0?f:hi,this.minFilter=p!==void 0?p:hi,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(t){return super.copy(t),this.compareFunction=t.compareFunction,this}toJSON(t){let e=super.toJSON(t);return this.compareFunction!==null&&(e.compareFunction=this.compareFunction),e}},fM=new Hi,hM=new Hf(1,1);hM.compareFunction=oM;var pM=new Of,dM=new dm,mM=new Gf,LE=[],NE=[],OE=new Float32Array(16),DE=new Float32Array(9),FE=new Float32Array(4);function Cu(r,t,e){let o=r[0];if(o<=0||o>0)return r;let a=t*e,l=LE[a];if(l===void 0&&(l=new Float32Array(a),LE[a]=l),t!==0){o.toArray(l,0);for(let h=1,f=0;h!==t;++h)f+=e,r[h].toArray(l,f)}return l}function fr(r,t){if(r.length!==t.length)return!1;for(let e=0,o=r.length;e<o;e++)if(r[e]!==t[e])return!1;return!0}function hr(r,t){for(let e=0,o=t.length;e<o;e++)r[e]=t[e]}function $f(r,t){let e=NE[t];e===void 0&&(e=new Int32Array(t),NE[t]=e);for(let o=0;o!==t;++o)e[o]=r.allocateTextureUnit();return e}function Q3(r,t){let e=this.cache;e[0]!==t&&(r.uniform1f(this.addr,t),e[0]=t)}function tF(r,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y)&&(r.uniform2f(this.addr,t.x,t.y),e[0]=t.x,e[1]=t.y);else{if(fr(e,t))return;r.uniform2fv(this.addr,t),hr(e,t)}}function eF(r,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z)&&(r.uniform3f(this.addr,t.x,t.y,t.z),e[0]=t.x,e[1]=t.y,e[2]=t.z);else if(t.r!==void 0)(e[0]!==t.r||e[1]!==t.g||e[2]!==t.b)&&(r.uniform3f(this.addr,t.r,t.g,t.b),e[0]=t.r,e[1]=t.g,e[2]=t.b);else{if(fr(e,t))return;r.uniform3fv(this.addr,t),hr(e,t)}}function nF(r,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z||e[3]!==t.w)&&(r.uniform4f(this.addr,t.x,t.y,t.z,t.w),e[0]=t.x,e[1]=t.y,e[2]=t.z,e[3]=t.w);else{if(fr(e,t))return;r.uniform4fv(this.addr,t),hr(e,t)}}function rF(r,t){let e=this.cache,o=t.elements;if(o===void 0){if(fr(e,t))return;r.uniformMatrix2fv(this.addr,!1,t),hr(e,t)}else{if(fr(e,o))return;FE.set(o),r.uniformMatrix2fv(this.addr,!1,FE),hr(e,o)}}function iF(r,t){let e=this.cache,o=t.elements;if(o===void 0){if(fr(e,t))return;r.uniformMatrix3fv(this.addr,!1,t),hr(e,t)}else{if(fr(e,o))return;DE.set(o),r.uniformMatrix3fv(this.addr,!1,DE),hr(e,o)}}function oF(r,t){let e=this.cache,o=t.elements;if(o===void 0){if(fr(e,t))return;r.uniformMatrix4fv(this.addr,!1,t),hr(e,t)}else{if(fr(e,o))return;OE.set(o),r.uniformMatrix4fv(this.addr,!1,OE),hr(e,o)}}function sF(r,t){let e=this.cache;e[0]!==t&&(r.uniform1i(this.addr,t),e[0]=t)}function aF(r,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y)&&(r.uniform2i(this.addr,t.x,t.y),e[0]=t.x,e[1]=t.y);else{if(fr(e,t))return;r.uniform2iv(this.addr,t),hr(e,t)}}function uF(r,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z)&&(r.uniform3i(this.addr,t.x,t.y,t.z),e[0]=t.x,e[1]=t.y,e[2]=t.z);else{if(fr(e,t))return;r.uniform3iv(this.addr,t),hr(e,t)}}function lF(r,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z||e[3]!==t.w)&&(r.uniform4i(this.addr,t.x,t.y,t.z,t.w),e[0]=t.x,e[1]=t.y,e[2]=t.z,e[3]=t.w);else{if(fr(e,t))return;r.uniform4iv(this.addr,t),hr(e,t)}}function cF(r,t){let e=this.cache;e[0]!==t&&(r.uniform1ui(this.addr,t),e[0]=t)}function fF(r,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y)&&(r.uniform2ui(this.addr,t.x,t.y),e[0]=t.x,e[1]=t.y);else{if(fr(e,t))return;r.uniform2uiv(this.addr,t),hr(e,t)}}function hF(r,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z)&&(r.uniform3ui(this.addr,t.x,t.y,t.z),e[0]=t.x,e[1]=t.y,e[2]=t.z);else{if(fr(e,t))return;r.uniform3uiv(this.addr,t),hr(e,t)}}function pF(r,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z||e[3]!==t.w)&&(r.uniform4ui(this.addr,t.x,t.y,t.z,t.w),e[0]=t.x,e[1]=t.y,e[2]=t.z,e[3]=t.w);else{if(fr(e,t))return;r.uniform4uiv(this.addr,t),hr(e,t)}}function dF(r,t,e){let o=this.cache,a=e.allocateTextureUnit();o[0]!==a&&(r.uniform1i(this.addr,a),o[0]=a);let l=this.type===r.SAMPLER_2D_SHADOW?hM:fM;e.setTexture2D(t||l,a)}function mF(r,t,e){let o=this.cache,a=e.allocateTextureUnit();o[0]!==a&&(r.uniform1i(this.addr,a),o[0]=a),e.setTexture3D(t||dM,a)}function gF(r,t,e){let o=this.cache,a=e.allocateTextureUnit();o[0]!==a&&(r.uniform1i(this.addr,a),o[0]=a),e.setTextureCube(t||mM,a)}function yF(r,t,e){let o=this.cache,a=e.allocateTextureUnit();o[0]!==a&&(r.uniform1i(this.addr,a),o[0]=a),e.setTexture2DArray(t||pM,a)}function vF(r){switch(r){case 5126:return Q3;case 35664:return tF;case 35665:return eF;case 35666:return nF;case 35674:return rF;case 35675:return iF;case 35676:return oF;case 5124:case 35670:return sF;case 35667:case 35671:return aF;case 35668:case 35672:return uF;case 35669:case 35673:return lF;case 5125:return cF;case 36294:return fF;case 36295:return hF;case 36296:return pF;case 35678:case 36198:case 36298:case 36306:case 35682:return dF;case 35679:case 36299:case 36307:return mF;case 35680:case 36300:case 36308:case 36293:return gF;case 36289:case 36303:case 36311:case 36292:return yF}}function _F(r,t){r.uniform1fv(this.addr,t)}function xF(r,t){let e=Cu(t,this.size,2);r.uniform2fv(this.addr,e)}function EF(r,t){let e=Cu(t,this.size,3);r.uniform3fv(this.addr,e)}function MF(r,t){let e=Cu(t,this.size,4);r.uniform4fv(this.addr,e)}function SF(r,t){let e=Cu(t,this.size,4);r.uniformMatrix2fv(this.addr,!1,e)}function wF(r,t){let e=Cu(t,this.size,9);r.uniformMatrix3fv(this.addr,!1,e)}function bF(r,t){let e=Cu(t,this.size,16);r.uniformMatrix4fv(this.addr,!1,e)}function TF(r,t){r.uniform1iv(this.addr,t)}function AF(r,t){r.uniform2iv(this.addr,t)}function CF(r,t){r.uniform3iv(this.addr,t)}function PF(r,t){r.uniform4iv(this.addr,t)}function IF(r,t){r.uniform1uiv(this.addr,t)}function RF(r,t){r.uniform2uiv(this.addr,t)}function LF(r,t){r.uniform3uiv(this.addr,t)}function NF(r,t){r.uniform4uiv(this.addr,t)}function OF(r,t,e){let o=this.cache,a=t.length,l=$f(e,a);fr(o,l)||(r.uniform1iv(this.addr,l),hr(o,l));for(let h=0;h!==a;++h)e.setTexture2D(t[h]||fM,l[h])}function DF(r,t,e){let o=this.cache,a=t.length,l=$f(e,a);fr(o,l)||(r.uniform1iv(this.addr,l),hr(o,l));for(let h=0;h!==a;++h)e.setTexture3D(t[h]||dM,l[h])}function FF(r,t,e){let o=this.cache,a=t.length,l=$f(e,a);fr(o,l)||(r.uniform1iv(this.addr,l),hr(o,l));for(let h=0;h!==a;++h)e.setTextureCube(t[h]||mM,l[h])}function UF(r,t,e){let o=this.cache,a=t.length,l=$f(e,a);fr(o,l)||(r.uniform1iv(this.addr,l),hr(o,l));for(let h=0;h!==a;++h)e.setTexture2DArray(t[h]||pM,l[h])}function BF(r){switch(r){case 5126:return _F;case 35664:return xF;case 35665:return EF;case 35666:return MF;case 35674:return SF;case 35675:return wF;case 35676:return bF;case 5124:case 35670:return TF;case 35667:case 35671:return AF;case 35668:case 35672:return CF;case 35669:case 35673:return PF;case 5125:return IF;case 36294:return RF;case 36295:return LF;case 36296:return NF;case 35678:case 36198:case 36298:case 36306:case 35682:return OF;case 35679:case 36299:case 36307:return DF;case 35680:case 36300:case 36308:case 36293:return FF;case 36289:case 36303:case 36311:case 36292:return UF}}var _m=class{constructor(t,e,o){this.id=t,this.addr=o,this.cache=[],this.type=e.type,this.setValue=vF(e.type)}},xm=class{constructor(t,e,o){this.id=t,this.addr=o,this.cache=[],this.type=e.type,this.size=e.size,this.setValue=BF(e.type)}},Em=class{constructor(t){this.id=t,this.seq=[],this.map={}}setValue(t,e,o){let a=this.seq;for(let l=0,h=a.length;l!==h;++l){let f=a[l];f.setValue(t,e[f.id],o)}}},em=/(\w+)(\])?(\[|\.)?/g;function UE(r,t){r.seq.push(t),r.map[t.id]=t}function zF(r,t,e){let o=r.name,a=o.length;for(em.lastIndex=0;;){let l=em.exec(o),h=em.lastIndex,f=l[1],p=l[2]==="]",d=l[3];if(p&&(f=f|0),d===void 0||d==="["&&h+2===a){UE(e,d===void 0?new _m(f,r,t):new xm(f,r,t));break}else{let x=e.map[f];x===void 0&&(x=new Em(f),UE(e,x)),e=x}}}var Mu=class{constructor(t,e){this.seq=[],this.map={};let o=t.getProgramParameter(e,t.ACTIVE_UNIFORMS);for(let a=0;a<o;++a){let l=t.getActiveUniform(e,a),h=t.getUniformLocation(e,l.name);zF(l,h,this)}}setValue(t,e,o,a){let l=this.map[e];l!==void 0&&l.setValue(t,o,a)}setOptional(t,e,o){let a=e[o];a!==void 0&&this.setValue(t,o,a)}static upload(t,e,o,a){for(let l=0,h=e.length;l!==h;++l){let f=e[l],p=o[f.id];p.needsUpdate!==!1&&f.setValue(t,p.value,a)}}static seqWithValue(t,e){let o=[];for(let a=0,l=t.length;a!==l;++a){let h=t[a];h.id in e&&o.push(h)}return o}};function BE(r,t,e){let o=r.createShader(t);return r.shaderSource(o,e),r.compileShader(o),o}var GF=37297,kF=0;function qF(r,t){let e=r.split(`
|
|
3703
|
+
`}function H3(r){let t=new WeakMap,e=null;function o(f){if(f&&f.isTexture){let p=f.mapping,d=p===om||p===sm,g=p===Su||p===wu;if(d||g)if(f.isRenderTargetTexture&&f.needsPMREMUpdate===!0){f.needsPMREMUpdate=!1;let x=t.get(f);return e===null&&(e=new Hf(r)),x=d?e.fromEquirectangular(f,x):e.fromCubemap(f,x),t.set(f,x),x.texture}else{if(t.has(f))return t.get(f).texture;{let x=f.image;if(d&&x&&x.height>0||g&&x&&a(x)){e===null&&(e=new Hf(r));let v=d?e.fromEquirectangular(f):e.fromCubemap(f);return t.set(f,v),f.addEventListener("dispose",l),v.texture}else return null}}}return f}function a(f){let p=0,d=6;for(let g=0;g<d;g++)f[g]!==void 0&&p++;return p===d}function l(f){let p=f.target;p.removeEventListener("dispose",l);let d=t.get(p);d!==void 0&&(t.delete(p),d.dispose())}function h(){t=new WeakMap,e!==null&&(e.dispose(),e=null)}return{get:o,dispose:h}}function W3(r){let t={};function e(o){if(t[o]!==void 0)return t[o];let a;switch(o){case"WEBGL_depth_texture":a=r.getExtension("WEBGL_depth_texture")||r.getExtension("MOZ_WEBGL_depth_texture")||r.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":a=r.getExtension("EXT_texture_filter_anisotropic")||r.getExtension("MOZ_EXT_texture_filter_anisotropic")||r.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":a=r.getExtension("WEBGL_compressed_texture_s3tc")||r.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||r.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":a=r.getExtension("WEBGL_compressed_texture_pvrtc")||r.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:a=r.getExtension(o)}return t[o]=a,a}return{has:function(o){return e(o)!==null},init:function(o){o.isWebGL2?(e("EXT_color_buffer_float"),e("WEBGL_clip_cull_distance")):(e("WEBGL_depth_texture"),e("OES_texture_float"),e("OES_texture_half_float"),e("OES_texture_half_float_linear"),e("OES_standard_derivatives"),e("OES_element_index_uint"),e("OES_vertex_array_object"),e("ANGLE_instanced_arrays")),e("OES_texture_float_linear"),e("EXT_color_buffer_half_float"),e("WEBGL_multisampled_render_to_texture")},get:function(o){let a=e(o);return a===null&&console.warn("THREE.WebGLRenderer: "+o+" extension not supported."),a}}}function X3(r,t,e,o){let a={},l=new WeakMap;function h(x){let v=x.target;v.index!==null&&t.remove(v.index);for(let b in v.attributes)t.remove(v.attributes[b]);for(let b in v.morphAttributes){let T=v.morphAttributes[b];for(let _=0,y=T.length;_<y;_++)t.remove(T[_])}v.removeEventListener("dispose",h),delete a[v.id];let M=l.get(v);M&&(t.remove(M),l.delete(v)),o.releaseStatesOfGeometry(v),v.isInstancedBufferGeometry===!0&&delete v._maxInstanceCount,e.memory.geometries--}function f(x,v){return a[v.id]===!0||(v.addEventListener("dispose",h),a[v.id]=!0,e.memory.geometries++),v}function p(x){let v=x.attributes;for(let b in v)t.update(v[b],r.ARRAY_BUFFER);let M=x.morphAttributes;for(let b in M){let T=M[b];for(let _=0,y=T.length;_<y;_++)t.update(T[_],r.ARRAY_BUFFER)}}function d(x){let v=[],M=x.index,b=x.attributes.position,T=0;if(M!==null){let A=M.array;T=M.version;for(let S=0,L=A.length;S<L;S+=3){let G=A[S+0],z=A[S+1],F=A[S+2];v.push(G,z,z,F,F,G)}}else if(b!==void 0){let A=b.array;T=b.version;for(let S=0,L=A.length/3-1;S<L;S+=3){let G=S+0,z=S+1,F=S+2;v.push(G,z,z,F,F,G)}}else return;let _=new(sM(v)?zf:Bf)(v,1);_.version=T;let y=l.get(x);y&&t.remove(y),l.set(x,_)}function g(x){let v=l.get(x);if(v){let M=x.index;M!==null&&v.version<M.version&&d(x)}else d(x);return l.get(x)}return{get:f,update:p,getWireframeAttribute:g}}function Y3(r,t,e,o){let a=o.isWebGL2,l;function h(M){l=M}let f,p;function d(M){f=M.type,p=M.bytesPerElement}function g(M,b){r.drawElements(l,b,f,M*p),e.update(b,l,1)}function x(M,b,T){if(T===0)return;let _,y;if(a)_=r,y="drawElementsInstanced";else if(_=t.get("ANGLE_instanced_arrays"),y="drawElementsInstancedANGLE",_===null){console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}_[y](l,b,f,M*p,T),e.update(b,l,T)}function v(M,b,T){if(T===0)return;let _=t.get("WEBGL_multi_draw");if(_===null)for(let y=0;y<T;y++)this.render(M[y]/p,b[y]);else{_.multiDrawElementsWEBGL(l,b,0,f,M,0,T);let y=0;for(let A=0;A<T;A++)y+=b[A];e.update(y,l,1)}}this.setMode=h,this.setIndex=d,this.render=g,this.renderInstances=x,this.renderMultiDraw=v}function $3(r){let t={geometries:0,textures:0},e={frame:0,calls:0,triangles:0,points:0,lines:0};function o(l,h,f){switch(e.calls++,h){case r.TRIANGLES:e.triangles+=f*(l/3);break;case r.LINES:e.lines+=f*(l/2);break;case r.LINE_STRIP:e.lines+=f*(l-1);break;case r.LINE_LOOP:e.lines+=f*l;break;case r.POINTS:e.points+=f*l;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",h);break}}function a(){e.calls=0,e.triangles=0,e.points=0,e.lines=0}return{memory:t,render:e,programs:null,autoReset:!0,reset:a,update:o}}function Z3(r,t){return r[0]-t[0]}function J3(r,t){return Math.abs(t[1])-Math.abs(r[1])}function K3(r,t,e){let o={},a=new Float32Array(8),l=new WeakMap,h=new zr,f=[];for(let d=0;d<8;d++)f[d]=[d,0];function p(d,g,x){let v=d.morphTargetInfluences;if(t.isWebGL2===!0){let M=g.morphAttributes.position||g.morphAttributes.normal||g.morphAttributes.color,b=M!==void 0?M.length:0,T=l.get(g);if(T===void 0||T.count!==b){let V=function(){R.dispose(),l.delete(g),g.removeEventListener("dispose",V)};T!==void 0&&T.texture.dispose();let _=g.morphAttributes.position!==void 0,y=g.morphAttributes.normal!==void 0,A=g.morphAttributes.color!==void 0,S=g.morphAttributes.position||[],L=g.morphAttributes.normal||[],G=g.morphAttributes.color||[],z=0;_===!0&&(z=1),y===!0&&(z=2),A===!0&&(z=3);let F=g.attributes.position.count*z,I=1;F>t.maxTextureSize&&(I=Math.ceil(F/t.maxTextureSize),F=t.maxTextureSize);let ut=new Float32Array(F*I*4*b),R=new Df(ut,F,I,b);R.type=os,R.needsUpdate=!0;let W=z*4;for(let Mt=0;Mt<b;Mt++){let X=S[Mt],mt=L[Mt],dt=G[Mt],_t=F*I*4*Mt;for(let it=0;it<X.count;it++){let lt=it*W;_===!0&&(h.fromBufferAttribute(X,it),ut[_t+lt+0]=h.x,ut[_t+lt+1]=h.y,ut[_t+lt+2]=h.z,ut[_t+lt+3]=0),y===!0&&(h.fromBufferAttribute(mt,it),ut[_t+lt+4]=h.x,ut[_t+lt+5]=h.y,ut[_t+lt+6]=h.z,ut[_t+lt+7]=0),A===!0&&(h.fromBufferAttribute(dt,it),ut[_t+lt+8]=h.x,ut[_t+lt+9]=h.y,ut[_t+lt+10]=h.z,ut[_t+lt+11]=dt.itemSize===4?h.w:1)}}T={count:b,texture:R,size:new ye(F,I)},l.set(g,T),g.addEventListener("dispose",V)}if(d.isInstancedMesh===!0&&d.morphTexture!==null)x.getUniforms().setValue(r,"morphTexture",d.morphTexture,e);else{let _=0;for(let A=0;A<v.length;A++)_+=v[A];let y=g.morphTargetsRelative?1:1-_;x.getUniforms().setValue(r,"morphTargetBaseInfluence",y),x.getUniforms().setValue(r,"morphTargetInfluences",v)}x.getUniforms().setValue(r,"morphTargetsTexture",T.texture,e),x.getUniforms().setValue(r,"morphTargetsTextureSize",T.size)}else{let M=v===void 0?0:v.length,b=o[g.id];if(b===void 0||b.length!==M){b=[];for(let S=0;S<M;S++)b[S]=[S,0];o[g.id]=b}for(let S=0;S<M;S++){let L=b[S];L[0]=S,L[1]=v[S]}b.sort(J3);for(let S=0;S<8;S++)S<M&&b[S][1]?(f[S][0]=b[S][0],f[S][1]=b[S][1]):(f[S][0]=Number.MAX_SAFE_INTEGER,f[S][1]=0);f.sort(Z3);let T=g.morphAttributes.position,_=g.morphAttributes.normal,y=0;for(let S=0;S<8;S++){let L=f[S],G=L[0],z=L[1];G!==Number.MAX_SAFE_INTEGER&&z?(T&&g.getAttribute("morphTarget"+S)!==T[G]&&g.setAttribute("morphTarget"+S,T[G]),_&&g.getAttribute("morphNormal"+S)!==_[G]&&g.setAttribute("morphNormal"+S,_[G]),a[S]=z,y+=z):(T&&g.hasAttribute("morphTarget"+S)===!0&&g.deleteAttribute("morphTarget"+S),_&&g.hasAttribute("morphNormal"+S)===!0&&g.deleteAttribute("morphNormal"+S),a[S]=0)}let A=g.morphTargetsRelative?1:1-y;x.getUniforms().setValue(r,"morphTargetBaseInfluence",A),x.getUniforms().setValue(r,"morphTargetInfluences",a)}}return{update:p}}function j3(r,t,e,o){let a=new WeakMap;function l(p){let d=o.render.frame,g=p.geometry,x=t.get(p,g);if(a.get(x)!==d&&(t.update(x),a.set(x,d)),p.isInstancedMesh&&(p.hasEventListener("dispose",f)===!1&&p.addEventListener("dispose",f),a.get(p)!==d&&(e.update(p.instanceMatrix,r.ARRAY_BUFFER),p.instanceColor!==null&&e.update(p.instanceColor,r.ARRAY_BUFFER),a.set(p,d))),p.isSkinnedMesh){let v=p.skeleton;a.get(v)!==d&&(v.update(),a.set(v,d))}return x}function h(){a=new WeakMap}function f(p){let d=p.target;d.removeEventListener("dispose",f),e.remove(d.instanceMatrix),d.instanceColor!==null&&e.remove(d.instanceColor)}return{update:l,dispose:h}}var Wf=class extends Hi{constructor(t,e,o,a,l,h,f,p,d,g){if(g=g!==void 0?g:va,g!==va&&g!==bu)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");o===void 0&&g===va&&(o=Ps),o===void 0&&g===bu&&(o=ya),super(null,a,l,h,f,p,g,o,d),this.isDepthTexture=!0,this.image={width:t,height:e},this.magFilter=f!==void 0?f:hi,this.minFilter=p!==void 0?p:hi,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(t){return super.copy(t),this.compareFunction=t.compareFunction,this}toJSON(t){let e=super.toJSON(t);return this.compareFunction!==null&&(e.compareFunction=this.compareFunction),e}},fM=new Hi,hM=new Wf(1,1);hM.compareFunction=oM;var pM=new Df,dM=new dm,mM=new kf,LE=[],NE=[],OE=new Float32Array(16),DE=new Float32Array(9),FE=new Float32Array(4);function Cu(r,t,e){let o=r[0];if(o<=0||o>0)return r;let a=t*e,l=LE[a];if(l===void 0&&(l=new Float32Array(a),LE[a]=l),t!==0){o.toArray(l,0);for(let h=1,f=0;h!==t;++h)f+=e,r[h].toArray(l,f)}return l}function fr(r,t){if(r.length!==t.length)return!1;for(let e=0,o=r.length;e<o;e++)if(r[e]!==t[e])return!1;return!0}function hr(r,t){for(let e=0,o=t.length;e<o;e++)r[e]=t[e]}function Zf(r,t){let e=NE[t];e===void 0&&(e=new Int32Array(t),NE[t]=e);for(let o=0;o!==t;++o)e[o]=r.allocateTextureUnit();return e}function Q3(r,t){let e=this.cache;e[0]!==t&&(r.uniform1f(this.addr,t),e[0]=t)}function tF(r,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y)&&(r.uniform2f(this.addr,t.x,t.y),e[0]=t.x,e[1]=t.y);else{if(fr(e,t))return;r.uniform2fv(this.addr,t),hr(e,t)}}function eF(r,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z)&&(r.uniform3f(this.addr,t.x,t.y,t.z),e[0]=t.x,e[1]=t.y,e[2]=t.z);else if(t.r!==void 0)(e[0]!==t.r||e[1]!==t.g||e[2]!==t.b)&&(r.uniform3f(this.addr,t.r,t.g,t.b),e[0]=t.r,e[1]=t.g,e[2]=t.b);else{if(fr(e,t))return;r.uniform3fv(this.addr,t),hr(e,t)}}function nF(r,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z||e[3]!==t.w)&&(r.uniform4f(this.addr,t.x,t.y,t.z,t.w),e[0]=t.x,e[1]=t.y,e[2]=t.z,e[3]=t.w);else{if(fr(e,t))return;r.uniform4fv(this.addr,t),hr(e,t)}}function rF(r,t){let e=this.cache,o=t.elements;if(o===void 0){if(fr(e,t))return;r.uniformMatrix2fv(this.addr,!1,t),hr(e,t)}else{if(fr(e,o))return;FE.set(o),r.uniformMatrix2fv(this.addr,!1,FE),hr(e,o)}}function iF(r,t){let e=this.cache,o=t.elements;if(o===void 0){if(fr(e,t))return;r.uniformMatrix3fv(this.addr,!1,t),hr(e,t)}else{if(fr(e,o))return;DE.set(o),r.uniformMatrix3fv(this.addr,!1,DE),hr(e,o)}}function oF(r,t){let e=this.cache,o=t.elements;if(o===void 0){if(fr(e,t))return;r.uniformMatrix4fv(this.addr,!1,t),hr(e,t)}else{if(fr(e,o))return;OE.set(o),r.uniformMatrix4fv(this.addr,!1,OE),hr(e,o)}}function sF(r,t){let e=this.cache;e[0]!==t&&(r.uniform1i(this.addr,t),e[0]=t)}function aF(r,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y)&&(r.uniform2i(this.addr,t.x,t.y),e[0]=t.x,e[1]=t.y);else{if(fr(e,t))return;r.uniform2iv(this.addr,t),hr(e,t)}}function uF(r,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z)&&(r.uniform3i(this.addr,t.x,t.y,t.z),e[0]=t.x,e[1]=t.y,e[2]=t.z);else{if(fr(e,t))return;r.uniform3iv(this.addr,t),hr(e,t)}}function lF(r,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z||e[3]!==t.w)&&(r.uniform4i(this.addr,t.x,t.y,t.z,t.w),e[0]=t.x,e[1]=t.y,e[2]=t.z,e[3]=t.w);else{if(fr(e,t))return;r.uniform4iv(this.addr,t),hr(e,t)}}function cF(r,t){let e=this.cache;e[0]!==t&&(r.uniform1ui(this.addr,t),e[0]=t)}function fF(r,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y)&&(r.uniform2ui(this.addr,t.x,t.y),e[0]=t.x,e[1]=t.y);else{if(fr(e,t))return;r.uniform2uiv(this.addr,t),hr(e,t)}}function hF(r,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z)&&(r.uniform3ui(this.addr,t.x,t.y,t.z),e[0]=t.x,e[1]=t.y,e[2]=t.z);else{if(fr(e,t))return;r.uniform3uiv(this.addr,t),hr(e,t)}}function pF(r,t){let e=this.cache;if(t.x!==void 0)(e[0]!==t.x||e[1]!==t.y||e[2]!==t.z||e[3]!==t.w)&&(r.uniform4ui(this.addr,t.x,t.y,t.z,t.w),e[0]=t.x,e[1]=t.y,e[2]=t.z,e[3]=t.w);else{if(fr(e,t))return;r.uniform4uiv(this.addr,t),hr(e,t)}}function dF(r,t,e){let o=this.cache,a=e.allocateTextureUnit();o[0]!==a&&(r.uniform1i(this.addr,a),o[0]=a);let l=this.type===r.SAMPLER_2D_SHADOW?hM:fM;e.setTexture2D(t||l,a)}function mF(r,t,e){let o=this.cache,a=e.allocateTextureUnit();o[0]!==a&&(r.uniform1i(this.addr,a),o[0]=a),e.setTexture3D(t||dM,a)}function gF(r,t,e){let o=this.cache,a=e.allocateTextureUnit();o[0]!==a&&(r.uniform1i(this.addr,a),o[0]=a),e.setTextureCube(t||mM,a)}function yF(r,t,e){let o=this.cache,a=e.allocateTextureUnit();o[0]!==a&&(r.uniform1i(this.addr,a),o[0]=a),e.setTexture2DArray(t||pM,a)}function vF(r){switch(r){case 5126:return Q3;case 35664:return tF;case 35665:return eF;case 35666:return nF;case 35674:return rF;case 35675:return iF;case 35676:return oF;case 5124:case 35670:return sF;case 35667:case 35671:return aF;case 35668:case 35672:return uF;case 35669:case 35673:return lF;case 5125:return cF;case 36294:return fF;case 36295:return hF;case 36296:return pF;case 35678:case 36198:case 36298:case 36306:case 35682:return dF;case 35679:case 36299:case 36307:return mF;case 35680:case 36300:case 36308:case 36293:return gF;case 36289:case 36303:case 36311:case 36292:return yF}}function _F(r,t){r.uniform1fv(this.addr,t)}function xF(r,t){let e=Cu(t,this.size,2);r.uniform2fv(this.addr,e)}function EF(r,t){let e=Cu(t,this.size,3);r.uniform3fv(this.addr,e)}function MF(r,t){let e=Cu(t,this.size,4);r.uniform4fv(this.addr,e)}function SF(r,t){let e=Cu(t,this.size,4);r.uniformMatrix2fv(this.addr,!1,e)}function wF(r,t){let e=Cu(t,this.size,9);r.uniformMatrix3fv(this.addr,!1,e)}function bF(r,t){let e=Cu(t,this.size,16);r.uniformMatrix4fv(this.addr,!1,e)}function TF(r,t){r.uniform1iv(this.addr,t)}function AF(r,t){r.uniform2iv(this.addr,t)}function CF(r,t){r.uniform3iv(this.addr,t)}function PF(r,t){r.uniform4iv(this.addr,t)}function IF(r,t){r.uniform1uiv(this.addr,t)}function RF(r,t){r.uniform2uiv(this.addr,t)}function LF(r,t){r.uniform3uiv(this.addr,t)}function NF(r,t){r.uniform4uiv(this.addr,t)}function OF(r,t,e){let o=this.cache,a=t.length,l=Zf(e,a);fr(o,l)||(r.uniform1iv(this.addr,l),hr(o,l));for(let h=0;h!==a;++h)e.setTexture2D(t[h]||fM,l[h])}function DF(r,t,e){let o=this.cache,a=t.length,l=Zf(e,a);fr(o,l)||(r.uniform1iv(this.addr,l),hr(o,l));for(let h=0;h!==a;++h)e.setTexture3D(t[h]||dM,l[h])}function FF(r,t,e){let o=this.cache,a=t.length,l=Zf(e,a);fr(o,l)||(r.uniform1iv(this.addr,l),hr(o,l));for(let h=0;h!==a;++h)e.setTextureCube(t[h]||mM,l[h])}function UF(r,t,e){let o=this.cache,a=t.length,l=Zf(e,a);fr(o,l)||(r.uniform1iv(this.addr,l),hr(o,l));for(let h=0;h!==a;++h)e.setTexture2DArray(t[h]||pM,l[h])}function BF(r){switch(r){case 5126:return _F;case 35664:return xF;case 35665:return EF;case 35666:return MF;case 35674:return SF;case 35675:return wF;case 35676:return bF;case 5124:case 35670:return TF;case 35667:case 35671:return AF;case 35668:case 35672:return CF;case 35669:case 35673:return PF;case 5125:return IF;case 36294:return RF;case 36295:return LF;case 36296:return NF;case 35678:case 36198:case 36298:case 36306:case 35682:return OF;case 35679:case 36299:case 36307:return DF;case 35680:case 36300:case 36308:case 36293:return FF;case 36289:case 36303:case 36311:case 36292:return UF}}var _m=class{constructor(t,e,o){this.id=t,this.addr=o,this.cache=[],this.type=e.type,this.setValue=vF(e.type)}},xm=class{constructor(t,e,o){this.id=t,this.addr=o,this.cache=[],this.type=e.type,this.size=e.size,this.setValue=BF(e.type)}},Em=class{constructor(t){this.id=t,this.seq=[],this.map={}}setValue(t,e,o){let a=this.seq;for(let l=0,h=a.length;l!==h;++l){let f=a[l];f.setValue(t,e[f.id],o)}}},em=/(\w+)(\])?(\[|\.)?/g;function UE(r,t){r.seq.push(t),r.map[t.id]=t}function zF(r,t,e){let o=r.name,a=o.length;for(em.lastIndex=0;;){let l=em.exec(o),h=em.lastIndex,f=l[1],p=l[2]==="]",d=l[3];if(p&&(f=f|0),d===void 0||d==="["&&h+2===a){UE(e,d===void 0?new _m(f,r,t):new xm(f,r,t));break}else{let x=e.map[f];x===void 0&&(x=new Em(f),UE(e,x)),e=x}}}var Mu=class{constructor(t,e){this.seq=[],this.map={};let o=t.getProgramParameter(e,t.ACTIVE_UNIFORMS);for(let a=0;a<o;++a){let l=t.getActiveUniform(e,a),h=t.getUniformLocation(e,l.name);zF(l,h,this)}}setValue(t,e,o,a){let l=this.map[e];l!==void 0&&l.setValue(t,o,a)}setOptional(t,e,o){let a=e[o];a!==void 0&&this.setValue(t,o,a)}static upload(t,e,o,a){for(let l=0,h=e.length;l!==h;++l){let f=e[l],p=o[f.id];p.needsUpdate!==!1&&f.setValue(t,p.value,a)}}static seqWithValue(t,e){let o=[];for(let a=0,l=t.length;a!==l;++a){let h=t[a];h.id in e&&o.push(h)}return o}};function BE(r,t,e){let o=r.createShader(t);return r.shaderSource(o,e),r.compileShader(o),o}var GF=37297,kF=0;function qF(r,t){let e=r.split(`
|
|
3704
3704
|
`),o=[],a=Math.max(t-6,0),l=Math.min(t+6,e.length);for(let h=a;h<l;h++){let f=h+1;o.push(`${f===t?">":" "} ${f}: ${e[h]}`)}return o.join(`
|
|
3705
|
-
`)}function VF(r){let t=Cn.getPrimaries(Cn.workingColorSpace),e=Cn.getPrimaries(r),o;switch(t===e?o="":t===
|
|
3705
|
+
`)}function VF(r){let t=Cn.getPrimaries(Cn.workingColorSpace),e=Cn.getPrimaries(r),o;switch(t===e?o="":t===If&&e===Pf?o="LinearDisplayP3ToLinearSRGB":t===Pf&&e===If&&(o="LinearSRGBToLinearDisplayP3"),r){case Bs:case $f:return[o,"LinearTransferOETF"];case Ao:case Ym:return[o,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",r),[o,"LinearTransferOETF"]}}function zE(r,t,e){let o=r.getShaderParameter(t,r.COMPILE_STATUS),a=r.getShaderInfoLog(t).trim();if(o&&a==="")return"";let l=/ERROR: 0:(\d+)/.exec(a);if(l){let h=parseInt(l[1]);return e.toUpperCase()+`
|
|
3706
3706
|
|
|
3707
3707
|
`+a+`
|
|
3708
3708
|
|
|
@@ -3729,7 +3729,7 @@ void main() {
|
|
|
3729
3729
|
`),r.precision==="highp"?t+=`
|
|
3730
3730
|
#define HIGH_PRECISION`:r.precision==="mediump"?t+=`
|
|
3731
3731
|
#define MEDIUM_PRECISION`:r.precision==="lowp"&&(t+=`
|
|
3732
|
-
#define LOW_PRECISION`),t}function eU(r){let t="SHADOWMAP_TYPE_BASIC";return r.shadowMapType===ZE?t="SHADOWMAP_TYPE_PCF":r.shadowMapType===ON?t="SHADOWMAP_TYPE_PCF_SOFT":r.shadowMapType===ns&&(t="SHADOWMAP_TYPE_VSM"),t}function nU(r){let t="ENVMAP_TYPE_CUBE";if(r.envMap)switch(r.envMapMode){case Su:case wu:t="ENVMAP_TYPE_CUBE";break;case
|
|
3732
|
+
#define LOW_PRECISION`),t}function eU(r){let t="SHADOWMAP_TYPE_BASIC";return r.shadowMapType===ZE?t="SHADOWMAP_TYPE_PCF":r.shadowMapType===ON?t="SHADOWMAP_TYPE_PCF_SOFT":r.shadowMapType===ns&&(t="SHADOWMAP_TYPE_VSM"),t}function nU(r){let t="ENVMAP_TYPE_CUBE";if(r.envMap)switch(r.envMapMode){case Su:case wu:t="ENVMAP_TYPE_CUBE";break;case Yf:t="ENVMAP_TYPE_CUBE_UV";break}return t}function rU(r){let t="ENVMAP_MODE_REFLECTION";if(r.envMap)switch(r.envMapMode){case wu:t="ENVMAP_MODE_REFRACTION";break}return t}function iU(r){let t="ENVMAP_BLENDING_NONE";if(r.envMap)switch(r.combine){case JE:t="ENVMAP_BLENDING_MULTIPLY";break;case i2:t="ENVMAP_BLENDING_MIX";break;case o2:t="ENVMAP_BLENDING_ADD";break}return t}function oU(r){let t=r.envMapCubeUVHeight;if(t===null)return null;let e=Math.log2(t)-2,o=1/t;return{texelWidth:1/(3*Math.max(Math.pow(2,e),7*16)),texelHeight:o,maxMip:e}}function sU(r,t,e,o){let a=r.getContext(),l=e.defines,h=e.vertexShader,f=e.fragmentShader,p=eU(e),d=nU(e),g=rU(e),x=iU(e),v=oU(e),M=e.isWebGL2?"":XF(e),b=YF(e),T=$F(l),_=a.createProgram(),y,A,S=e.glslVersion?"#version "+e.glslVersion+`
|
|
3733
3733
|
`:"";e.isRawShaderMaterial?(y=["#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,T].filter(vu).join(`
|
|
3734
3734
|
`),y.length>0&&(y+=`
|
|
3735
3735
|
`),A=[M,"#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,T].filter(vu).join(`
|
|
@@ -3750,7 +3750,7 @@ Material Type: `+V.type+`
|
|
|
3750
3750
|
|
|
3751
3751
|
Program Info Log: `+Mt+`
|
|
3752
3752
|
`+it+`
|
|
3753
|
-
`+lt)}else Mt!==""?console.warn("THREE.WebGLProgram: Program Info Log:",Mt):(X===""||mt==="")&&(_t=!1);_t&&(V.diagnostics={runnable:dt,programLog:Mt,vertexShader:{log:X,prefix:y},fragmentShader:{log:mt,prefix:A}})}a.deleteShader(z),a.deleteShader(F),ut=new Mu(a,_),R=ZF(a,_)}let ut;this.getUniforms=function(){return ut===void 0&&I(this),ut};let R;this.getAttributes=function(){return R===void 0&&I(this),R};let W=e.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return W===!1&&(W=a.getProgramParameter(_,GF)),W},this.destroy=function(){o.releaseStatesOfProgram(this),a.deleteProgram(_),this.program=void 0},this.type=e.shaderType,this.name=e.shaderName,this.id=kF++,this.cacheKey=t,this.usedTimes=1,this.program=_,this.vertexShader=z,this.fragmentShader=F,this}var aU=0,Sm=class{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(t){let e=t.vertexShader,o=t.fragmentShader,a=this._getShaderStage(e),l=this._getShaderStage(o),h=this._getShaderCacheForMaterial(t);return h.has(a)===!1&&(h.add(a),a.usedTimes++),h.has(l)===!1&&(h.add(l),l.usedTimes++),this}remove(t){let e=this.materialCache.get(t);for(let o of e)o.usedTimes--,o.usedTimes===0&&this.shaderCache.delete(o.code);return this.materialCache.delete(t),this}getVertexShaderID(t){return this._getShaderStage(t.vertexShader).id}getFragmentShaderID(t){return this._getShaderStage(t.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(t){let e=this.materialCache,o=e.get(t);return o===void 0&&(o=new Set,e.set(t,o)),o}_getShaderStage(t){let e=this.shaderCache,o=e.get(t);return o===void 0&&(o=new wm(t),e.set(t,o)),o}},wm=class{constructor(t){this.id=aU++,this.code=t,this.usedTimes=0}};function uU(r,t,e,o,a,l,h){let f=new Df,p=new Sm,d=new Set,g=[],x=a.isWebGL2,v=a.logarithmicDepthBuffer,M=a.vertexTextures,b=a.precision,T={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function _(R){return d.add(R),R===0?"uv":`uv${R}`}function y(R,W,V,Mt,X){let mt=Mt.fog,dt=X.geometry,_t=R.isMeshStandardMaterial?Mt.environment:null,it=(R.isMeshStandardMaterial?e:t).get(R.envMap||_t),lt=it&&it.mapping===Xf?it.image.height:null,H=T[R.type];R.precision!==null&&(b=a.getMaxPrecision(R.precision),b!==R.precision&&console.warn("THREE.WebGLProgram.getParameters:",R.precision,"not supported, using",b,"instead."));let bt=dt.morphAttributes.position||dt.morphAttributes.normal||dt.morphAttributes.color,Tt=bt!==void 0?bt.length:0,Yt=0;dt.morphAttributes.position!==void 0&&(Yt=1),dt.morphAttributes.normal!==void 0&&(Yt=2),dt.morphAttributes.color!==void 0&&(Yt=3);let tt,wt,Bt,$t;if(H){let Jt=Co[H];tt=Jt.vertexShader,wt=Jt.fragmentShader}else tt=R.vertexShader,wt=R.fragmentShader,p.update(R),Bt=p.getVertexShaderID(R),$t=p.getFragmentShaderID(R);let Ut=r.getRenderTarget(),Dt=X.isInstancedMesh===!0,At=X.isBatchedMesh===!0,te=!!R.map,rt=!!R.matcap,an=!!it,zt=!!R.aoMap,ne=!!R.lightMap,Wt=!!R.bumpMap,ie=!!R.normalMap,ce=!!R.displacementMap,Lt=!!R.emissiveMap,se=!!R.metalnessMap,Y=!!R.roughnessMap,N=R.anisotropy>0,xt=R.clearcoat>0,Et=R.iridescence>0,ot=R.sheen>0,Pt=R.transmission>0,ue=N&&!!R.anisotropyMap,Ct=xt&&!!R.clearcoatMap,Ot=xt&&!!R.clearcoatNormalMap,kt=xt&&!!R.clearcoatRoughnessMap,J=Et&&!!R.iridescenceMap,w=Et&&!!R.iridescenceThicknessMap,P=ot&&!!R.sheenColorMap,D=ot&&!!R.sheenRoughnessMap,k=!!R.specularMap,B=!!R.specularColorMap,et=!!R.specularIntensityMap,j=Pt&&!!R.transmissionMap,ft=Pt&&!!R.thicknessMap,ct=!!R.gradientMap,O=!!R.alphaMap,K=R.alphaTest>0,$=!!R.alphaHash,Q=!!R.extensions,St=Rs;R.toneMapped&&(Ut===null||Ut.isXRRenderTarget===!0)&&(St=r.toneMapping);let Nt={isWebGL2:x,shaderID:H,shaderType:R.type,shaderName:R.name,vertexShader:tt,fragmentShader:wt,defines:R.defines,customVertexShaderID:Bt,customFragmentShaderID:$t,isRawShaderMaterial:R.isRawShaderMaterial===!0,glslVersion:R.glslVersion,precision:b,batching:At,instancing:Dt,instancingColor:Dt&&X.instanceColor!==null,instancingMorph:Dt&&X.morphTexture!==null,supportsVertexTextures:M,outputColorSpace:Ut===null?r.outputColorSpace:Ut.isXRRenderTarget===!0?Ut.texture.colorSpace:Bs,alphaToCoverage:!!R.alphaToCoverage,map:te,matcap:rt,envMap:an,envMapMode:an&&it.mapping,envMapCubeUVHeight:lt,aoMap:zt,lightMap:ne,bumpMap:Wt,normalMap:ie,displacementMap:M&&ce,emissiveMap:Lt,normalMapObjectSpace:ie&&R.normalMapType===w2,normalMapTangentSpace:ie&&R.normalMapType===S2,metalnessMap:se,roughnessMap:Y,anisotropy:N,anisotropyMap:ue,clearcoat:xt,clearcoatMap:Ct,clearcoatNormalMap:Ot,clearcoatRoughnessMap:kt,iridescence:Et,iridescenceMap:J,iridescenceThicknessMap:w,sheen:ot,sheenColorMap:P,sheenRoughnessMap:D,specularMap:k,specularColorMap:B,specularIntensityMap:et,transmission:Pt,transmissionMap:j,thicknessMap:ft,gradientMap:ct,opaque:R.transparent===!1&&R.blending===xu&&R.alphaToCoverage===!1,alphaMap:O,alphaTest:K,alphaHash:$,combine:R.combine,mapUv:te&&_(R.map.channel),aoMapUv:zt&&_(R.aoMap.channel),lightMapUv:ne&&_(R.lightMap.channel),bumpMapUv:Wt&&_(R.bumpMap.channel),normalMapUv:ie&&_(R.normalMap.channel),displacementMapUv:ce&&_(R.displacementMap.channel),emissiveMapUv:Lt&&_(R.emissiveMap.channel),metalnessMapUv:se&&_(R.metalnessMap.channel),roughnessMapUv:Y&&_(R.roughnessMap.channel),anisotropyMapUv:ue&&_(R.anisotropyMap.channel),clearcoatMapUv:Ct&&_(R.clearcoatMap.channel),clearcoatNormalMapUv:Ot&&_(R.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:kt&&_(R.clearcoatRoughnessMap.channel),iridescenceMapUv:J&&_(R.iridescenceMap.channel),iridescenceThicknessMapUv:w&&_(R.iridescenceThicknessMap.channel),sheenColorMapUv:P&&_(R.sheenColorMap.channel),sheenRoughnessMapUv:D&&_(R.sheenRoughnessMap.channel),specularMapUv:k&&_(R.specularMap.channel),specularColorMapUv:B&&_(R.specularColorMap.channel),specularIntensityMapUv:et&&_(R.specularIntensityMap.channel),transmissionMapUv:j&&_(R.transmissionMap.channel),thicknessMapUv:ft&&_(R.thicknessMap.channel),alphaMapUv:O&&_(R.alphaMap.channel),vertexTangents:!!dt.attributes.tangent&&(ie||N),vertexColors:R.vertexColors,vertexAlphas:R.vertexColors===!0&&!!dt.attributes.color&&dt.attributes.color.itemSize===4,pointsUvs:X.isPoints===!0&&!!dt.attributes.uv&&(te||O),fog:!!mt,useFog:R.fog===!0,fogExp2:!!mt&&mt.isFogExp2,flatShading:R.flatShading===!0,sizeAttenuation:R.sizeAttenuation===!0,logarithmicDepthBuffer:v,skinning:X.isSkinnedMesh===!0,morphTargets:dt.morphAttributes.position!==void 0,morphNormals:dt.morphAttributes.normal!==void 0,morphColors:dt.morphAttributes.color!==void 0,morphTargetsCount:Tt,morphTextureStride:Yt,numDirLights:W.directional.length,numPointLights:W.point.length,numSpotLights:W.spot.length,numSpotLightMaps:W.spotLightMap.length,numRectAreaLights:W.rectArea.length,numHemiLights:W.hemi.length,numDirLightShadows:W.directionalShadowMap.length,numPointLightShadows:W.pointShadowMap.length,numSpotLightShadows:W.spotShadowMap.length,numSpotLightShadowsWithMaps:W.numSpotLightShadowsWithMaps,numLightProbes:W.numLightProbes,numClippingPlanes:h.numPlanes,numClipIntersection:h.numIntersection,dithering:R.dithering,shadowMapEnabled:r.shadowMap.enabled&&V.length>0,shadowMapType:r.shadowMap.type,toneMapping:St,useLegacyLights:r._useLegacyLights,decodeVideoTexture:te&&R.map.isVideoTexture===!0&&Cn.getTransfer(R.map.colorSpace)===Un,premultipliedAlpha:R.premultipliedAlpha,doubleSided:R.side===is,flipSided:R.side===Ei,useDepthPacking:R.depthPacking>=0,depthPacking:R.depthPacking||0,index0AttributeName:R.index0AttributeName,extensionDerivatives:Q&&R.extensions.derivatives===!0,extensionFragDepth:Q&&R.extensions.fragDepth===!0,extensionDrawBuffers:Q&&R.extensions.drawBuffers===!0,extensionShaderTextureLOD:Q&&R.extensions.shaderTextureLOD===!0,extensionClipCullDistance:Q&&R.extensions.clipCullDistance===!0&&o.has("WEBGL_clip_cull_distance"),extensionMultiDraw:Q&&R.extensions.multiDraw===!0&&o.has("WEBGL_multi_draw"),rendererExtensionFragDepth:x||o.has("EXT_frag_depth"),rendererExtensionDrawBuffers:x||o.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:x||o.has("EXT_shader_texture_lod"),rendererExtensionParallelShaderCompile:o.has("KHR_parallel_shader_compile"),customProgramCacheKey:R.customProgramCacheKey()};return Nt.vertexUv1s=d.has(1),Nt.vertexUv2s=d.has(2),Nt.vertexUv3s=d.has(3),d.clear(),Nt}function A(R){let W=[];if(R.shaderID?W.push(R.shaderID):(W.push(R.customVertexShaderID),W.push(R.customFragmentShaderID)),R.defines!==void 0)for(let V in R.defines)W.push(V),W.push(R.defines[V]);return R.isRawShaderMaterial===!1&&(S(W,R),L(W,R),W.push(r.outputColorSpace)),W.push(R.customProgramCacheKey),W.join()}function S(R,W){R.push(W.precision),R.push(W.outputColorSpace),R.push(W.envMapMode),R.push(W.envMapCubeUVHeight),R.push(W.mapUv),R.push(W.alphaMapUv),R.push(W.lightMapUv),R.push(W.aoMapUv),R.push(W.bumpMapUv),R.push(W.normalMapUv),R.push(W.displacementMapUv),R.push(W.emissiveMapUv),R.push(W.metalnessMapUv),R.push(W.roughnessMapUv),R.push(W.anisotropyMapUv),R.push(W.clearcoatMapUv),R.push(W.clearcoatNormalMapUv),R.push(W.clearcoatRoughnessMapUv),R.push(W.iridescenceMapUv),R.push(W.iridescenceThicknessMapUv),R.push(W.sheenColorMapUv),R.push(W.sheenRoughnessMapUv),R.push(W.specularMapUv),R.push(W.specularColorMapUv),R.push(W.specularIntensityMapUv),R.push(W.transmissionMapUv),R.push(W.thicknessMapUv),R.push(W.combine),R.push(W.fogExp2),R.push(W.sizeAttenuation),R.push(W.morphTargetsCount),R.push(W.morphAttributeCount),R.push(W.numDirLights),R.push(W.numPointLights),R.push(W.numSpotLights),R.push(W.numSpotLightMaps),R.push(W.numHemiLights),R.push(W.numRectAreaLights),R.push(W.numDirLightShadows),R.push(W.numPointLightShadows),R.push(W.numSpotLightShadows),R.push(W.numSpotLightShadowsWithMaps),R.push(W.numLightProbes),R.push(W.shadowMapType),R.push(W.toneMapping),R.push(W.numClippingPlanes),R.push(W.numClipIntersection),R.push(W.depthPacking)}function L(R,W){f.disableAll(),W.isWebGL2&&f.enable(0),W.supportsVertexTextures&&f.enable(1),W.instancing&&f.enable(2),W.instancingColor&&f.enable(3),W.instancingMorph&&f.enable(4),W.matcap&&f.enable(5),W.envMap&&f.enable(6),W.normalMapObjectSpace&&f.enable(7),W.normalMapTangentSpace&&f.enable(8),W.clearcoat&&f.enable(9),W.iridescence&&f.enable(10),W.alphaTest&&f.enable(11),W.vertexColors&&f.enable(12),W.vertexAlphas&&f.enable(13),W.vertexUv1s&&f.enable(14),W.vertexUv2s&&f.enable(15),W.vertexUv3s&&f.enable(16),W.vertexTangents&&f.enable(17),W.anisotropy&&f.enable(18),W.alphaHash&&f.enable(19),W.batching&&f.enable(20),R.push(f.mask),f.disableAll(),W.fog&&f.enable(0),W.useFog&&f.enable(1),W.flatShading&&f.enable(2),W.logarithmicDepthBuffer&&f.enable(3),W.skinning&&f.enable(4),W.morphTargets&&f.enable(5),W.morphNormals&&f.enable(6),W.morphColors&&f.enable(7),W.premultipliedAlpha&&f.enable(8),W.shadowMapEnabled&&f.enable(9),W.useLegacyLights&&f.enable(10),W.doubleSided&&f.enable(11),W.flipSided&&f.enable(12),W.useDepthPacking&&f.enable(13),W.dithering&&f.enable(14),W.transmission&&f.enable(15),W.sheen&&f.enable(16),W.opaque&&f.enable(17),W.pointsUvs&&f.enable(18),W.decodeVideoTexture&&f.enable(19),W.alphaToCoverage&&f.enable(20),R.push(f.mask)}function G(R){let W=T[R.type],V;if(W){let Mt=Co[W];V=Z2.clone(Mt.uniforms)}else V=R.uniforms;return V}function z(R,W){let V;for(let Mt=0,X=g.length;Mt<X;Mt++){let mt=g[Mt];if(mt.cacheKey===W){V=mt,++V.usedTimes;break}}return V===void 0&&(V=new sU(r,W,R,l),g.push(V)),V}function F(R){if(--R.usedTimes===0){let W=g.indexOf(R);g[W]=g[g.length-1],g.pop(),R.destroy()}}function I(R){p.remove(R)}function ut(){p.dispose()}return{getParameters:y,getProgramCacheKey:A,getUniforms:G,acquireProgram:z,releaseProgram:F,releaseShaderCache:I,programs:g,dispose:ut}}function lU(){let r=new WeakMap;function t(l){let h=r.get(l);return h===void 0&&(h={},r.set(l,h)),h}function e(l){r.delete(l)}function o(l,h,f){r.get(l)[h]=f}function a(){r=new WeakMap}return{get:t,remove:e,update:o,dispose:a}}function cU(r,t){return r.groupOrder!==t.groupOrder?r.groupOrder-t.groupOrder:r.renderOrder!==t.renderOrder?r.renderOrder-t.renderOrder:r.material.id!==t.material.id?r.material.id-t.material.id:r.z!==t.z?r.z-t.z:r.id-t.id}function HE(r,t){return r.groupOrder!==t.groupOrder?r.groupOrder-t.groupOrder:r.renderOrder!==t.renderOrder?r.renderOrder-t.renderOrder:r.z!==t.z?t.z-r.z:r.id-t.id}function WE(){let r=[],t=0,e=[],o=[],a=[];function l(){t=0,e.length=0,o.length=0,a.length=0}function h(x,v,M,b,T,_){let y=r[t];return y===void 0?(y={id:x.id,object:x,geometry:v,material:M,groupOrder:b,renderOrder:x.renderOrder,z:T,group:_},r[t]=y):(y.id=x.id,y.object=x,y.geometry=v,y.material=M,y.groupOrder=b,y.renderOrder=x.renderOrder,y.z=T,y.group=_),t++,y}function f(x,v,M,b,T,_){let y=h(x,v,M,b,T,_);M.transmission>0?o.push(y):M.transparent===!0?a.push(y):e.push(y)}function p(x,v,M,b,T,_){let y=h(x,v,M,b,T,_);M.transmission>0?o.unshift(y):M.transparent===!0?a.unshift(y):e.unshift(y)}function d(x,v){e.length>1&&e.sort(x||cU),o.length>1&&o.sort(v||HE),a.length>1&&a.sort(v||HE)}function g(){for(let x=t,v=r.length;x<v;x++){let M=r[x];if(M.id===null)break;M.id=null,M.object=null,M.geometry=null,M.material=null,M.group=null}}return{opaque:e,transmissive:o,transparent:a,init:l,push:f,unshift:p,finish:g,sort:d}}function fU(){let r=new WeakMap;function t(o,a){let l=r.get(o),h;return l===void 0?(h=new WE,r.set(o,[h])):a>=l.length?(h=new WE,l.push(h)):h=l[a],h}function e(){r=new WeakMap}return{get:t,dispose:e}}function hU(){let r={};return{get:function(t){if(r[t.id]!==void 0)return r[t.id];let e;switch(t.type){case"DirectionalLight":e={direction:new yt,color:new vn};break;case"SpotLight":e={position:new yt,direction:new yt,color:new vn,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":e={position:new yt,color:new vn,distance:0,decay:0};break;case"HemisphereLight":e={direction:new yt,skyColor:new vn,groundColor:new vn};break;case"RectAreaLight":e={color:new vn,position:new yt,halfWidth:new yt,halfHeight:new yt};break}return r[t.id]=e,e}}}function pU(){let r={};return{get:function(t){if(r[t.id]!==void 0)return r[t.id];let e;switch(t.type){case"DirectionalLight":e={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ye};break;case"SpotLight":e={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ye};break;case"PointLight":e={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ye,shadowCameraNear:1,shadowCameraFar:1e3};break}return r[t.id]=e,e}}}var dU=0;function mU(r,t){return(t.castShadow?2:0)-(r.castShadow?2:0)+(t.map?1:0)-(r.map?1:0)}function gU(r,t){let e=new hU,o=pU(),a={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let g=0;g<9;g++)a.probe.push(new yt);let l=new yt,h=new cr,f=new cr;function p(g,x){let v=0,M=0,b=0;for(let V=0;V<9;V++)a.probe[V].set(0,0,0);let T=0,_=0,y=0,A=0,S=0,L=0,G=0,z=0,F=0,I=0,ut=0;g.sort(mU);let R=x===!0?Math.PI:1;for(let V=0,Mt=g.length;V<Mt;V++){let X=g[V],mt=X.color,dt=X.intensity,_t=X.distance,it=X.shadow&&X.shadow.map?X.shadow.map.texture:null;if(X.isAmbientLight)v+=mt.r*dt*R,M+=mt.g*dt*R,b+=mt.b*dt*R;else if(X.isLightProbe){for(let lt=0;lt<9;lt++)a.probe[lt].addScaledVector(X.sh.coefficients[lt],dt);ut++}else if(X.isDirectionalLight){let lt=e.get(X);if(lt.color.copy(X.color).multiplyScalar(X.intensity*R),X.castShadow){let H=X.shadow,bt=o.get(X);bt.shadowBias=H.bias,bt.shadowNormalBias=H.normalBias,bt.shadowRadius=H.radius,bt.shadowMapSize=H.mapSize,a.directionalShadow[T]=bt,a.directionalShadowMap[T]=it,a.directionalShadowMatrix[T]=X.shadow.matrix,L++}a.directional[T]=lt,T++}else if(X.isSpotLight){let lt=e.get(X);lt.position.setFromMatrixPosition(X.matrixWorld),lt.color.copy(mt).multiplyScalar(dt*R),lt.distance=_t,lt.coneCos=Math.cos(X.angle),lt.penumbraCos=Math.cos(X.angle*(1-X.penumbra)),lt.decay=X.decay,a.spot[y]=lt;let H=X.shadow;if(X.map&&(a.spotLightMap[F]=X.map,F++,H.updateMatrices(X),X.castShadow&&I++),a.spotLightMatrix[y]=H.matrix,X.castShadow){let bt=o.get(X);bt.shadowBias=H.bias,bt.shadowNormalBias=H.normalBias,bt.shadowRadius=H.radius,bt.shadowMapSize=H.mapSize,a.spotShadow[y]=bt,a.spotShadowMap[y]=it,z++}y++}else if(X.isRectAreaLight){let lt=e.get(X);lt.color.copy(mt).multiplyScalar(dt),lt.halfWidth.set(X.width*.5,0,0),lt.halfHeight.set(0,X.height*.5,0),a.rectArea[A]=lt,A++}else if(X.isPointLight){let lt=e.get(X);if(lt.color.copy(X.color).multiplyScalar(X.intensity*R),lt.distance=X.distance,lt.decay=X.decay,X.castShadow){let H=X.shadow,bt=o.get(X);bt.shadowBias=H.bias,bt.shadowNormalBias=H.normalBias,bt.shadowRadius=H.radius,bt.shadowMapSize=H.mapSize,bt.shadowCameraNear=H.camera.near,bt.shadowCameraFar=H.camera.far,a.pointShadow[_]=bt,a.pointShadowMap[_]=it,a.pointShadowMatrix[_]=X.shadow.matrix,G++}a.point[_]=lt,_++}else if(X.isHemisphereLight){let lt=e.get(X);lt.skyColor.copy(X.color).multiplyScalar(dt*R),lt.groundColor.copy(X.groundColor).multiplyScalar(dt*R),a.hemi[S]=lt,S++}}A>0&&(t.isWebGL2?r.has("OES_texture_float_linear")===!0?(a.rectAreaLTC1=qt.LTC_FLOAT_1,a.rectAreaLTC2=qt.LTC_FLOAT_2):(a.rectAreaLTC1=qt.LTC_HALF_1,a.rectAreaLTC2=qt.LTC_HALF_2):r.has("OES_texture_float_linear")===!0?(a.rectAreaLTC1=qt.LTC_FLOAT_1,a.rectAreaLTC2=qt.LTC_FLOAT_2):r.has("OES_texture_half_float_linear")===!0?(a.rectAreaLTC1=qt.LTC_HALF_1,a.rectAreaLTC2=qt.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),a.ambient[0]=v,a.ambient[1]=M,a.ambient[2]=b;let W=a.hash;(W.directionalLength!==T||W.pointLength!==_||W.spotLength!==y||W.rectAreaLength!==A||W.hemiLength!==S||W.numDirectionalShadows!==L||W.numPointShadows!==G||W.numSpotShadows!==z||W.numSpotMaps!==F||W.numLightProbes!==ut)&&(a.directional.length=T,a.spot.length=y,a.rectArea.length=A,a.point.length=_,a.hemi.length=S,a.directionalShadow.length=L,a.directionalShadowMap.length=L,a.pointShadow.length=G,a.pointShadowMap.length=G,a.spotShadow.length=z,a.spotShadowMap.length=z,a.directionalShadowMatrix.length=L,a.pointShadowMatrix.length=G,a.spotLightMatrix.length=z+F-I,a.spotLightMap.length=F,a.numSpotLightShadowsWithMaps=I,a.numLightProbes=ut,W.directionalLength=T,W.pointLength=_,W.spotLength=y,W.rectAreaLength=A,W.hemiLength=S,W.numDirectionalShadows=L,W.numPointShadows=G,W.numSpotShadows=z,W.numSpotMaps=F,W.numLightProbes=ut,a.version=dU++)}function d(g,x){let v=0,M=0,b=0,T=0,_=0,y=x.matrixWorldInverse;for(let A=0,S=g.length;A<S;A++){let L=g[A];if(L.isDirectionalLight){let G=a.directional[v];G.direction.setFromMatrixPosition(L.matrixWorld),l.setFromMatrixPosition(L.target.matrixWorld),G.direction.sub(l),G.direction.transformDirection(y),v++}else if(L.isSpotLight){let G=a.spot[b];G.position.setFromMatrixPosition(L.matrixWorld),G.position.applyMatrix4(y),G.direction.setFromMatrixPosition(L.matrixWorld),l.setFromMatrixPosition(L.target.matrixWorld),G.direction.sub(l),G.direction.transformDirection(y),b++}else if(L.isRectAreaLight){let G=a.rectArea[T];G.position.setFromMatrixPosition(L.matrixWorld),G.position.applyMatrix4(y),f.identity(),h.copy(L.matrixWorld),h.premultiply(y),f.extractRotation(h),G.halfWidth.set(L.width*.5,0,0),G.halfHeight.set(0,L.height*.5,0),G.halfWidth.applyMatrix4(f),G.halfHeight.applyMatrix4(f),T++}else if(L.isPointLight){let G=a.point[M];G.position.setFromMatrixPosition(L.matrixWorld),G.position.applyMatrix4(y),M++}else if(L.isHemisphereLight){let G=a.hemi[_];G.direction.setFromMatrixPosition(L.matrixWorld),G.direction.transformDirection(y),_++}}}return{setup:p,setupView:d,state:a}}function XE(r,t){let e=new gU(r,t),o=[],a=[];function l(){o.length=0,a.length=0}function h(x){o.push(x)}function f(x){a.push(x)}function p(x){e.setup(o,x)}function d(x){e.setupView(o,x)}return{init:l,state:{lightsArray:o,shadowsArray:a,lights:e},setupLights:p,setupLightsView:d,pushLight:h,pushShadow:f}}function yU(r,t){let e=new WeakMap;function o(l,h=0){let f=e.get(l),p;return f===void 0?(p=new XE(r,t),e.set(l,[p])):h>=f.length?(p=new XE(r,t),f.push(p)):p=f[h],p}function a(){e=new WeakMap}return{get:o,dispose:a}}var bm=class extends Ea{constructor(t){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=E2,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}},Tm=class extends Ea{constructor(t){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(t)}copy(t){return super.copy(t),this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}},vU=`void main() {
|
|
3753
|
+
`+lt)}else Mt!==""?console.warn("THREE.WebGLProgram: Program Info Log:",Mt):(X===""||mt==="")&&(_t=!1);_t&&(V.diagnostics={runnable:dt,programLog:Mt,vertexShader:{log:X,prefix:y},fragmentShader:{log:mt,prefix:A}})}a.deleteShader(z),a.deleteShader(F),ut=new Mu(a,_),R=ZF(a,_)}let ut;this.getUniforms=function(){return ut===void 0&&I(this),ut};let R;this.getAttributes=function(){return R===void 0&&I(this),R};let W=e.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return W===!1&&(W=a.getProgramParameter(_,GF)),W},this.destroy=function(){o.releaseStatesOfProgram(this),a.deleteProgram(_),this.program=void 0},this.type=e.shaderType,this.name=e.shaderName,this.id=kF++,this.cacheKey=t,this.usedTimes=1,this.program=_,this.vertexShader=z,this.fragmentShader=F,this}var aU=0,Sm=class{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(t){let e=t.vertexShader,o=t.fragmentShader,a=this._getShaderStage(e),l=this._getShaderStage(o),h=this._getShaderCacheForMaterial(t);return h.has(a)===!1&&(h.add(a),a.usedTimes++),h.has(l)===!1&&(h.add(l),l.usedTimes++),this}remove(t){let e=this.materialCache.get(t);for(let o of e)o.usedTimes--,o.usedTimes===0&&this.shaderCache.delete(o.code);return this.materialCache.delete(t),this}getVertexShaderID(t){return this._getShaderStage(t.vertexShader).id}getFragmentShaderID(t){return this._getShaderStage(t.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(t){let e=this.materialCache,o=e.get(t);return o===void 0&&(o=new Set,e.set(t,o)),o}_getShaderStage(t){let e=this.shaderCache,o=e.get(t);return o===void 0&&(o=new wm(t),e.set(t,o)),o}},wm=class{constructor(t){this.id=aU++,this.code=t,this.usedTimes=0}};function uU(r,t,e,o,a,l,h){let f=new Ff,p=new Sm,d=new Set,g=[],x=a.isWebGL2,v=a.logarithmicDepthBuffer,M=a.vertexTextures,b=a.precision,T={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function _(R){return d.add(R),R===0?"uv":`uv${R}`}function y(R,W,V,Mt,X){let mt=Mt.fog,dt=X.geometry,_t=R.isMeshStandardMaterial?Mt.environment:null,it=(R.isMeshStandardMaterial?e:t).get(R.envMap||_t),lt=it&&it.mapping===Yf?it.image.height:null,H=T[R.type];R.precision!==null&&(b=a.getMaxPrecision(R.precision),b!==R.precision&&console.warn("THREE.WebGLProgram.getParameters:",R.precision,"not supported, using",b,"instead."));let bt=dt.morphAttributes.position||dt.morphAttributes.normal||dt.morphAttributes.color,Tt=bt!==void 0?bt.length:0,Yt=0;dt.morphAttributes.position!==void 0&&(Yt=1),dt.morphAttributes.normal!==void 0&&(Yt=2),dt.morphAttributes.color!==void 0&&(Yt=3);let tt,wt,Bt,$t;if(H){let Jt=Co[H];tt=Jt.vertexShader,wt=Jt.fragmentShader}else tt=R.vertexShader,wt=R.fragmentShader,p.update(R),Bt=p.getVertexShaderID(R),$t=p.getFragmentShaderID(R);let Ut=r.getRenderTarget(),Dt=X.isInstancedMesh===!0,At=X.isBatchedMesh===!0,te=!!R.map,rt=!!R.matcap,an=!!it,zt=!!R.aoMap,ne=!!R.lightMap,Wt=!!R.bumpMap,ie=!!R.normalMap,ce=!!R.displacementMap,Lt=!!R.emissiveMap,se=!!R.metalnessMap,Y=!!R.roughnessMap,N=R.anisotropy>0,xt=R.clearcoat>0,Et=R.iridescence>0,ot=R.sheen>0,Pt=R.transmission>0,ue=N&&!!R.anisotropyMap,Ct=xt&&!!R.clearcoatMap,Ot=xt&&!!R.clearcoatNormalMap,kt=xt&&!!R.clearcoatRoughnessMap,J=Et&&!!R.iridescenceMap,w=Et&&!!R.iridescenceThicknessMap,P=ot&&!!R.sheenColorMap,D=ot&&!!R.sheenRoughnessMap,k=!!R.specularMap,B=!!R.specularColorMap,et=!!R.specularIntensityMap,j=Pt&&!!R.transmissionMap,ft=Pt&&!!R.thicknessMap,ct=!!R.gradientMap,O=!!R.alphaMap,K=R.alphaTest>0,$=!!R.alphaHash,Q=!!R.extensions,St=Rs;R.toneMapped&&(Ut===null||Ut.isXRRenderTarget===!0)&&(St=r.toneMapping);let Nt={isWebGL2:x,shaderID:H,shaderType:R.type,shaderName:R.name,vertexShader:tt,fragmentShader:wt,defines:R.defines,customVertexShaderID:Bt,customFragmentShaderID:$t,isRawShaderMaterial:R.isRawShaderMaterial===!0,glslVersion:R.glslVersion,precision:b,batching:At,instancing:Dt,instancingColor:Dt&&X.instanceColor!==null,instancingMorph:Dt&&X.morphTexture!==null,supportsVertexTextures:M,outputColorSpace:Ut===null?r.outputColorSpace:Ut.isXRRenderTarget===!0?Ut.texture.colorSpace:Bs,alphaToCoverage:!!R.alphaToCoverage,map:te,matcap:rt,envMap:an,envMapMode:an&&it.mapping,envMapCubeUVHeight:lt,aoMap:zt,lightMap:ne,bumpMap:Wt,normalMap:ie,displacementMap:M&&ce,emissiveMap:Lt,normalMapObjectSpace:ie&&R.normalMapType===w2,normalMapTangentSpace:ie&&R.normalMapType===S2,metalnessMap:se,roughnessMap:Y,anisotropy:N,anisotropyMap:ue,clearcoat:xt,clearcoatMap:Ct,clearcoatNormalMap:Ot,clearcoatRoughnessMap:kt,iridescence:Et,iridescenceMap:J,iridescenceThicknessMap:w,sheen:ot,sheenColorMap:P,sheenRoughnessMap:D,specularMap:k,specularColorMap:B,specularIntensityMap:et,transmission:Pt,transmissionMap:j,thicknessMap:ft,gradientMap:ct,opaque:R.transparent===!1&&R.blending===xu&&R.alphaToCoverage===!1,alphaMap:O,alphaTest:K,alphaHash:$,combine:R.combine,mapUv:te&&_(R.map.channel),aoMapUv:zt&&_(R.aoMap.channel),lightMapUv:ne&&_(R.lightMap.channel),bumpMapUv:Wt&&_(R.bumpMap.channel),normalMapUv:ie&&_(R.normalMap.channel),displacementMapUv:ce&&_(R.displacementMap.channel),emissiveMapUv:Lt&&_(R.emissiveMap.channel),metalnessMapUv:se&&_(R.metalnessMap.channel),roughnessMapUv:Y&&_(R.roughnessMap.channel),anisotropyMapUv:ue&&_(R.anisotropyMap.channel),clearcoatMapUv:Ct&&_(R.clearcoatMap.channel),clearcoatNormalMapUv:Ot&&_(R.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:kt&&_(R.clearcoatRoughnessMap.channel),iridescenceMapUv:J&&_(R.iridescenceMap.channel),iridescenceThicknessMapUv:w&&_(R.iridescenceThicknessMap.channel),sheenColorMapUv:P&&_(R.sheenColorMap.channel),sheenRoughnessMapUv:D&&_(R.sheenRoughnessMap.channel),specularMapUv:k&&_(R.specularMap.channel),specularColorMapUv:B&&_(R.specularColorMap.channel),specularIntensityMapUv:et&&_(R.specularIntensityMap.channel),transmissionMapUv:j&&_(R.transmissionMap.channel),thicknessMapUv:ft&&_(R.thicknessMap.channel),alphaMapUv:O&&_(R.alphaMap.channel),vertexTangents:!!dt.attributes.tangent&&(ie||N),vertexColors:R.vertexColors,vertexAlphas:R.vertexColors===!0&&!!dt.attributes.color&&dt.attributes.color.itemSize===4,pointsUvs:X.isPoints===!0&&!!dt.attributes.uv&&(te||O),fog:!!mt,useFog:R.fog===!0,fogExp2:!!mt&&mt.isFogExp2,flatShading:R.flatShading===!0,sizeAttenuation:R.sizeAttenuation===!0,logarithmicDepthBuffer:v,skinning:X.isSkinnedMesh===!0,morphTargets:dt.morphAttributes.position!==void 0,morphNormals:dt.morphAttributes.normal!==void 0,morphColors:dt.morphAttributes.color!==void 0,morphTargetsCount:Tt,morphTextureStride:Yt,numDirLights:W.directional.length,numPointLights:W.point.length,numSpotLights:W.spot.length,numSpotLightMaps:W.spotLightMap.length,numRectAreaLights:W.rectArea.length,numHemiLights:W.hemi.length,numDirLightShadows:W.directionalShadowMap.length,numPointLightShadows:W.pointShadowMap.length,numSpotLightShadows:W.spotShadowMap.length,numSpotLightShadowsWithMaps:W.numSpotLightShadowsWithMaps,numLightProbes:W.numLightProbes,numClippingPlanes:h.numPlanes,numClipIntersection:h.numIntersection,dithering:R.dithering,shadowMapEnabled:r.shadowMap.enabled&&V.length>0,shadowMapType:r.shadowMap.type,toneMapping:St,useLegacyLights:r._useLegacyLights,decodeVideoTexture:te&&R.map.isVideoTexture===!0&&Cn.getTransfer(R.map.colorSpace)===Un,premultipliedAlpha:R.premultipliedAlpha,doubleSided:R.side===is,flipSided:R.side===Ei,useDepthPacking:R.depthPacking>=0,depthPacking:R.depthPacking||0,index0AttributeName:R.index0AttributeName,extensionDerivatives:Q&&R.extensions.derivatives===!0,extensionFragDepth:Q&&R.extensions.fragDepth===!0,extensionDrawBuffers:Q&&R.extensions.drawBuffers===!0,extensionShaderTextureLOD:Q&&R.extensions.shaderTextureLOD===!0,extensionClipCullDistance:Q&&R.extensions.clipCullDistance===!0&&o.has("WEBGL_clip_cull_distance"),extensionMultiDraw:Q&&R.extensions.multiDraw===!0&&o.has("WEBGL_multi_draw"),rendererExtensionFragDepth:x||o.has("EXT_frag_depth"),rendererExtensionDrawBuffers:x||o.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:x||o.has("EXT_shader_texture_lod"),rendererExtensionParallelShaderCompile:o.has("KHR_parallel_shader_compile"),customProgramCacheKey:R.customProgramCacheKey()};return Nt.vertexUv1s=d.has(1),Nt.vertexUv2s=d.has(2),Nt.vertexUv3s=d.has(3),d.clear(),Nt}function A(R){let W=[];if(R.shaderID?W.push(R.shaderID):(W.push(R.customVertexShaderID),W.push(R.customFragmentShaderID)),R.defines!==void 0)for(let V in R.defines)W.push(V),W.push(R.defines[V]);return R.isRawShaderMaterial===!1&&(S(W,R),L(W,R),W.push(r.outputColorSpace)),W.push(R.customProgramCacheKey),W.join()}function S(R,W){R.push(W.precision),R.push(W.outputColorSpace),R.push(W.envMapMode),R.push(W.envMapCubeUVHeight),R.push(W.mapUv),R.push(W.alphaMapUv),R.push(W.lightMapUv),R.push(W.aoMapUv),R.push(W.bumpMapUv),R.push(W.normalMapUv),R.push(W.displacementMapUv),R.push(W.emissiveMapUv),R.push(W.metalnessMapUv),R.push(W.roughnessMapUv),R.push(W.anisotropyMapUv),R.push(W.clearcoatMapUv),R.push(W.clearcoatNormalMapUv),R.push(W.clearcoatRoughnessMapUv),R.push(W.iridescenceMapUv),R.push(W.iridescenceThicknessMapUv),R.push(W.sheenColorMapUv),R.push(W.sheenRoughnessMapUv),R.push(W.specularMapUv),R.push(W.specularColorMapUv),R.push(W.specularIntensityMapUv),R.push(W.transmissionMapUv),R.push(W.thicknessMapUv),R.push(W.combine),R.push(W.fogExp2),R.push(W.sizeAttenuation),R.push(W.morphTargetsCount),R.push(W.morphAttributeCount),R.push(W.numDirLights),R.push(W.numPointLights),R.push(W.numSpotLights),R.push(W.numSpotLightMaps),R.push(W.numHemiLights),R.push(W.numRectAreaLights),R.push(W.numDirLightShadows),R.push(W.numPointLightShadows),R.push(W.numSpotLightShadows),R.push(W.numSpotLightShadowsWithMaps),R.push(W.numLightProbes),R.push(W.shadowMapType),R.push(W.toneMapping),R.push(W.numClippingPlanes),R.push(W.numClipIntersection),R.push(W.depthPacking)}function L(R,W){f.disableAll(),W.isWebGL2&&f.enable(0),W.supportsVertexTextures&&f.enable(1),W.instancing&&f.enable(2),W.instancingColor&&f.enable(3),W.instancingMorph&&f.enable(4),W.matcap&&f.enable(5),W.envMap&&f.enable(6),W.normalMapObjectSpace&&f.enable(7),W.normalMapTangentSpace&&f.enable(8),W.clearcoat&&f.enable(9),W.iridescence&&f.enable(10),W.alphaTest&&f.enable(11),W.vertexColors&&f.enable(12),W.vertexAlphas&&f.enable(13),W.vertexUv1s&&f.enable(14),W.vertexUv2s&&f.enable(15),W.vertexUv3s&&f.enable(16),W.vertexTangents&&f.enable(17),W.anisotropy&&f.enable(18),W.alphaHash&&f.enable(19),W.batching&&f.enable(20),R.push(f.mask),f.disableAll(),W.fog&&f.enable(0),W.useFog&&f.enable(1),W.flatShading&&f.enable(2),W.logarithmicDepthBuffer&&f.enable(3),W.skinning&&f.enable(4),W.morphTargets&&f.enable(5),W.morphNormals&&f.enable(6),W.morphColors&&f.enable(7),W.premultipliedAlpha&&f.enable(8),W.shadowMapEnabled&&f.enable(9),W.useLegacyLights&&f.enable(10),W.doubleSided&&f.enable(11),W.flipSided&&f.enable(12),W.useDepthPacking&&f.enable(13),W.dithering&&f.enable(14),W.transmission&&f.enable(15),W.sheen&&f.enable(16),W.opaque&&f.enable(17),W.pointsUvs&&f.enable(18),W.decodeVideoTexture&&f.enable(19),W.alphaToCoverage&&f.enable(20),R.push(f.mask)}function G(R){let W=T[R.type],V;if(W){let Mt=Co[W];V=Z2.clone(Mt.uniforms)}else V=R.uniforms;return V}function z(R,W){let V;for(let Mt=0,X=g.length;Mt<X;Mt++){let mt=g[Mt];if(mt.cacheKey===W){V=mt,++V.usedTimes;break}}return V===void 0&&(V=new sU(r,W,R,l),g.push(V)),V}function F(R){if(--R.usedTimes===0){let W=g.indexOf(R);g[W]=g[g.length-1],g.pop(),R.destroy()}}function I(R){p.remove(R)}function ut(){p.dispose()}return{getParameters:y,getProgramCacheKey:A,getUniforms:G,acquireProgram:z,releaseProgram:F,releaseShaderCache:I,programs:g,dispose:ut}}function lU(){let r=new WeakMap;function t(l){let h=r.get(l);return h===void 0&&(h={},r.set(l,h)),h}function e(l){r.delete(l)}function o(l,h,f){r.get(l)[h]=f}function a(){r=new WeakMap}return{get:t,remove:e,update:o,dispose:a}}function cU(r,t){return r.groupOrder!==t.groupOrder?r.groupOrder-t.groupOrder:r.renderOrder!==t.renderOrder?r.renderOrder-t.renderOrder:r.material.id!==t.material.id?r.material.id-t.material.id:r.z!==t.z?r.z-t.z:r.id-t.id}function HE(r,t){return r.groupOrder!==t.groupOrder?r.groupOrder-t.groupOrder:r.renderOrder!==t.renderOrder?r.renderOrder-t.renderOrder:r.z!==t.z?t.z-r.z:r.id-t.id}function WE(){let r=[],t=0,e=[],o=[],a=[];function l(){t=0,e.length=0,o.length=0,a.length=0}function h(x,v,M,b,T,_){let y=r[t];return y===void 0?(y={id:x.id,object:x,geometry:v,material:M,groupOrder:b,renderOrder:x.renderOrder,z:T,group:_},r[t]=y):(y.id=x.id,y.object=x,y.geometry=v,y.material=M,y.groupOrder=b,y.renderOrder=x.renderOrder,y.z=T,y.group=_),t++,y}function f(x,v,M,b,T,_){let y=h(x,v,M,b,T,_);M.transmission>0?o.push(y):M.transparent===!0?a.push(y):e.push(y)}function p(x,v,M,b,T,_){let y=h(x,v,M,b,T,_);M.transmission>0?o.unshift(y):M.transparent===!0?a.unshift(y):e.unshift(y)}function d(x,v){e.length>1&&e.sort(x||cU),o.length>1&&o.sort(v||HE),a.length>1&&a.sort(v||HE)}function g(){for(let x=t,v=r.length;x<v;x++){let M=r[x];if(M.id===null)break;M.id=null,M.object=null,M.geometry=null,M.material=null,M.group=null}}return{opaque:e,transmissive:o,transparent:a,init:l,push:f,unshift:p,finish:g,sort:d}}function fU(){let r=new WeakMap;function t(o,a){let l=r.get(o),h;return l===void 0?(h=new WE,r.set(o,[h])):a>=l.length?(h=new WE,l.push(h)):h=l[a],h}function e(){r=new WeakMap}return{get:t,dispose:e}}function hU(){let r={};return{get:function(t){if(r[t.id]!==void 0)return r[t.id];let e;switch(t.type){case"DirectionalLight":e={direction:new yt,color:new vn};break;case"SpotLight":e={position:new yt,direction:new yt,color:new vn,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":e={position:new yt,color:new vn,distance:0,decay:0};break;case"HemisphereLight":e={direction:new yt,skyColor:new vn,groundColor:new vn};break;case"RectAreaLight":e={color:new vn,position:new yt,halfWidth:new yt,halfHeight:new yt};break}return r[t.id]=e,e}}}function pU(){let r={};return{get:function(t){if(r[t.id]!==void 0)return r[t.id];let e;switch(t.type){case"DirectionalLight":e={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ye};break;case"SpotLight":e={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ye};break;case"PointLight":e={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ye,shadowCameraNear:1,shadowCameraFar:1e3};break}return r[t.id]=e,e}}}var dU=0;function mU(r,t){return(t.castShadow?2:0)-(r.castShadow?2:0)+(t.map?1:0)-(r.map?1:0)}function gU(r,t){let e=new hU,o=pU(),a={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let g=0;g<9;g++)a.probe.push(new yt);let l=new yt,h=new cr,f=new cr;function p(g,x){let v=0,M=0,b=0;for(let V=0;V<9;V++)a.probe[V].set(0,0,0);let T=0,_=0,y=0,A=0,S=0,L=0,G=0,z=0,F=0,I=0,ut=0;g.sort(mU);let R=x===!0?Math.PI:1;for(let V=0,Mt=g.length;V<Mt;V++){let X=g[V],mt=X.color,dt=X.intensity,_t=X.distance,it=X.shadow&&X.shadow.map?X.shadow.map.texture:null;if(X.isAmbientLight)v+=mt.r*dt*R,M+=mt.g*dt*R,b+=mt.b*dt*R;else if(X.isLightProbe){for(let lt=0;lt<9;lt++)a.probe[lt].addScaledVector(X.sh.coefficients[lt],dt);ut++}else if(X.isDirectionalLight){let lt=e.get(X);if(lt.color.copy(X.color).multiplyScalar(X.intensity*R),X.castShadow){let H=X.shadow,bt=o.get(X);bt.shadowBias=H.bias,bt.shadowNormalBias=H.normalBias,bt.shadowRadius=H.radius,bt.shadowMapSize=H.mapSize,a.directionalShadow[T]=bt,a.directionalShadowMap[T]=it,a.directionalShadowMatrix[T]=X.shadow.matrix,L++}a.directional[T]=lt,T++}else if(X.isSpotLight){let lt=e.get(X);lt.position.setFromMatrixPosition(X.matrixWorld),lt.color.copy(mt).multiplyScalar(dt*R),lt.distance=_t,lt.coneCos=Math.cos(X.angle),lt.penumbraCos=Math.cos(X.angle*(1-X.penumbra)),lt.decay=X.decay,a.spot[y]=lt;let H=X.shadow;if(X.map&&(a.spotLightMap[F]=X.map,F++,H.updateMatrices(X),X.castShadow&&I++),a.spotLightMatrix[y]=H.matrix,X.castShadow){let bt=o.get(X);bt.shadowBias=H.bias,bt.shadowNormalBias=H.normalBias,bt.shadowRadius=H.radius,bt.shadowMapSize=H.mapSize,a.spotShadow[y]=bt,a.spotShadowMap[y]=it,z++}y++}else if(X.isRectAreaLight){let lt=e.get(X);lt.color.copy(mt).multiplyScalar(dt),lt.halfWidth.set(X.width*.5,0,0),lt.halfHeight.set(0,X.height*.5,0),a.rectArea[A]=lt,A++}else if(X.isPointLight){let lt=e.get(X);if(lt.color.copy(X.color).multiplyScalar(X.intensity*R),lt.distance=X.distance,lt.decay=X.decay,X.castShadow){let H=X.shadow,bt=o.get(X);bt.shadowBias=H.bias,bt.shadowNormalBias=H.normalBias,bt.shadowRadius=H.radius,bt.shadowMapSize=H.mapSize,bt.shadowCameraNear=H.camera.near,bt.shadowCameraFar=H.camera.far,a.pointShadow[_]=bt,a.pointShadowMap[_]=it,a.pointShadowMatrix[_]=X.shadow.matrix,G++}a.point[_]=lt,_++}else if(X.isHemisphereLight){let lt=e.get(X);lt.skyColor.copy(X.color).multiplyScalar(dt*R),lt.groundColor.copy(X.groundColor).multiplyScalar(dt*R),a.hemi[S]=lt,S++}}A>0&&(t.isWebGL2?r.has("OES_texture_float_linear")===!0?(a.rectAreaLTC1=qt.LTC_FLOAT_1,a.rectAreaLTC2=qt.LTC_FLOAT_2):(a.rectAreaLTC1=qt.LTC_HALF_1,a.rectAreaLTC2=qt.LTC_HALF_2):r.has("OES_texture_float_linear")===!0?(a.rectAreaLTC1=qt.LTC_FLOAT_1,a.rectAreaLTC2=qt.LTC_FLOAT_2):r.has("OES_texture_half_float_linear")===!0?(a.rectAreaLTC1=qt.LTC_HALF_1,a.rectAreaLTC2=qt.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),a.ambient[0]=v,a.ambient[1]=M,a.ambient[2]=b;let W=a.hash;(W.directionalLength!==T||W.pointLength!==_||W.spotLength!==y||W.rectAreaLength!==A||W.hemiLength!==S||W.numDirectionalShadows!==L||W.numPointShadows!==G||W.numSpotShadows!==z||W.numSpotMaps!==F||W.numLightProbes!==ut)&&(a.directional.length=T,a.spot.length=y,a.rectArea.length=A,a.point.length=_,a.hemi.length=S,a.directionalShadow.length=L,a.directionalShadowMap.length=L,a.pointShadow.length=G,a.pointShadowMap.length=G,a.spotShadow.length=z,a.spotShadowMap.length=z,a.directionalShadowMatrix.length=L,a.pointShadowMatrix.length=G,a.spotLightMatrix.length=z+F-I,a.spotLightMap.length=F,a.numSpotLightShadowsWithMaps=I,a.numLightProbes=ut,W.directionalLength=T,W.pointLength=_,W.spotLength=y,W.rectAreaLength=A,W.hemiLength=S,W.numDirectionalShadows=L,W.numPointShadows=G,W.numSpotShadows=z,W.numSpotMaps=F,W.numLightProbes=ut,a.version=dU++)}function d(g,x){let v=0,M=0,b=0,T=0,_=0,y=x.matrixWorldInverse;for(let A=0,S=g.length;A<S;A++){let L=g[A];if(L.isDirectionalLight){let G=a.directional[v];G.direction.setFromMatrixPosition(L.matrixWorld),l.setFromMatrixPosition(L.target.matrixWorld),G.direction.sub(l),G.direction.transformDirection(y),v++}else if(L.isSpotLight){let G=a.spot[b];G.position.setFromMatrixPosition(L.matrixWorld),G.position.applyMatrix4(y),G.direction.setFromMatrixPosition(L.matrixWorld),l.setFromMatrixPosition(L.target.matrixWorld),G.direction.sub(l),G.direction.transformDirection(y),b++}else if(L.isRectAreaLight){let G=a.rectArea[T];G.position.setFromMatrixPosition(L.matrixWorld),G.position.applyMatrix4(y),f.identity(),h.copy(L.matrixWorld),h.premultiply(y),f.extractRotation(h),G.halfWidth.set(L.width*.5,0,0),G.halfHeight.set(0,L.height*.5,0),G.halfWidth.applyMatrix4(f),G.halfHeight.applyMatrix4(f),T++}else if(L.isPointLight){let G=a.point[M];G.position.setFromMatrixPosition(L.matrixWorld),G.position.applyMatrix4(y),M++}else if(L.isHemisphereLight){let G=a.hemi[_];G.direction.setFromMatrixPosition(L.matrixWorld),G.direction.transformDirection(y),_++}}}return{setup:p,setupView:d,state:a}}function XE(r,t){let e=new gU(r,t),o=[],a=[];function l(){o.length=0,a.length=0}function h(x){o.push(x)}function f(x){a.push(x)}function p(x){e.setup(o,x)}function d(x){e.setupView(o,x)}return{init:l,state:{lightsArray:o,shadowsArray:a,lights:e},setupLights:p,setupLightsView:d,pushLight:h,pushShadow:f}}function yU(r,t){let e=new WeakMap;function o(l,h=0){let f=e.get(l),p;return f===void 0?(p=new XE(r,t),e.set(l,[p])):h>=f.length?(p=new XE(r,t),f.push(p)):p=f[h],p}function a(){e=new WeakMap}return{get:o,dispose:a}}var bm=class extends Ea{constructor(t){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=E2,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}},Tm=class extends Ea{constructor(t){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(t)}copy(t){return super.copy(t),this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}},vU=`void main() {
|
|
3754
3754
|
gl_Position = vec4( position, 1.0 );
|
|
3755
3755
|
}`,_U=`uniform sampler2D shadow_pass;
|
|
3756
3756
|
uniform vec2 resolution;
|
|
@@ -3778,7 +3778,7 @@ void main() {
|
|
|
3778
3778
|
squared_mean = squared_mean / samples;
|
|
3779
3779
|
float std_dev = sqrt( squared_mean - mean * mean );
|
|
3780
3780
|
gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
|
|
3781
|
-
}`;function xU(r,t,e){let o=new kf,a=new ye,l=new ye,h=new zr,f=new bm({depthPacking:M2}),p=new Tm,d={},g=e.maxTextureSize,x={[Os]:Ei,[Ei]:Os,[is]:is},v=new Io({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new ye},radius:{value:4}},vertexShader:vU,fragmentShader:_U}),M=v.clone();M.defines.HORIZONTAL_PASS=1;let b=new Us;b.setAttribute("position",new Ni(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let T=new ho(b,v),_=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=ZE;let y=this.type;this.render=function(z,F,I){if(_.enabled===!1||_.autoUpdate===!1&&_.needsUpdate===!1||z.length===0)return;let ut=r.getRenderTarget(),R=r.getActiveCubeFace(),W=r.getActiveMipmapLevel(),V=r.state;V.setBlending(Is),V.buffers.color.setClear(1,1,1,1),V.buffers.depth.setTest(!0),V.setScissorTest(!1);let Mt=y!==ns&&this.type===ns,X=y===ns&&this.type!==ns;for(let mt=0,dt=z.length;mt<dt;mt++){let _t=z[mt],it=_t.shadow;if(it===void 0){console.warn("THREE.WebGLShadowMap:",_t,"has no shadow.");continue}if(it.autoUpdate===!1&&it.needsUpdate===!1)continue;a.copy(it.mapSize);let lt=it.getFrameExtents();if(a.multiply(lt),l.copy(it.mapSize),(a.x>g||a.y>g)&&(a.x>g&&(l.x=Math.floor(g/lt.x),a.x=l.x*lt.x,it.mapSize.x=l.x),a.y>g&&(l.y=Math.floor(g/lt.y),a.y=l.y*lt.y,it.mapSize.y=l.y)),it.map===null||Mt===!0||X===!0){let bt=this.type!==ns?{minFilter:hi,magFilter:hi}:{};it.map!==null&&it.map.dispose(),it.map=new us(a.x,a.y,bt),it.map.texture.name=_t.name+".shadowMap",it.camera.updateProjectionMatrix()}r.setRenderTarget(it.map),r.clear();let H=it.getViewportCount();for(let bt=0;bt<H;bt++){let Tt=it.getViewport(bt);h.set(l.x*Tt.x,l.y*Tt.y,l.x*Tt.z,l.y*Tt.w),V.viewport(h),it.updateMatrices(_t,bt),o=it.getFrustum(),L(F,I,it.camera,_t,this.type)}it.isPointLightShadow!==!0&&this.type===ns&&A(it,I),it.needsUpdate=!1}y=this.type,_.needsUpdate=!1,r.setRenderTarget(ut,R,W)},this.dispose=function(){b.dispose(),b=null,v.dispose(),v=null,M.dispose(),M=null,T.clear()};function A(z,F){let I=t.update(T);v.defines.VSM_SAMPLES!==z.blurSamples&&(v.defines.VSM_SAMPLES=z.blurSamples,M.defines.VSM_SAMPLES=z.blurSamples,v.needsUpdate=!0,M.needsUpdate=!0),z.mapPass===null&&(z.mapPass=new us(a.x,a.y)),v.uniforms.shadow_pass.value=z.map.texture,v.uniforms.resolution.value=z.mapSize,v.uniforms.radius.value=z.radius,r.setRenderTarget(z.mapPass),r.clear(),r.renderBufferDirect(F,null,I,v,T,null),M.uniforms.shadow_pass.value=z.mapPass.texture,M.uniforms.resolution.value=z.mapSize,M.uniforms.radius.value=z.radius,r.setRenderTarget(z.map),r.clear(),r.renderBufferDirect(F,null,I,M,T,null)}function S(z,F,I,ut){let R=null,W=I.isPointLight===!0?z.customDistanceMaterial:z.customDepthMaterial;if(W!==void 0)R=W;else if(R=I.isPointLight===!0?p:f,r.localClippingEnabled&&F.clipShadows===!0&&Array.isArray(F.clippingPlanes)&&F.clippingPlanes.length!==0||F.displacementMap&&F.displacementScale!==0||F.alphaMap&&F.alphaTest>0||F.map&&F.alphaTest>0){let V=R.uuid,Mt=F.uuid,X=d[V];X===void 0&&(X={},d[V]=X);let mt=X[Mt];mt===void 0&&(mt=R.clone(),X[Mt]=mt,F.addEventListener("dispose",G)),R=mt}if(R.visible=F.visible,R.wireframe=F.wireframe,ut===ns?R.side=F.shadowSide!==null?F.shadowSide:F.side:R.side=F.shadowSide!==null?F.shadowSide:x[F.side],R.alphaMap=F.alphaMap,R.alphaTest=F.alphaTest,R.map=F.map,R.clipShadows=F.clipShadows,R.clippingPlanes=F.clippingPlanes,R.clipIntersection=F.clipIntersection,R.displacementMap=F.displacementMap,R.displacementScale=F.displacementScale,R.displacementBias=F.displacementBias,R.wireframeLinewidth=F.wireframeLinewidth,R.linewidth=F.linewidth,I.isPointLight===!0&&R.isMeshDistanceMaterial===!0){let V=r.properties.get(R);V.light=I}return R}function L(z,F,I,ut,R){if(z.visible===!1)return;if(z.layers.test(F.layers)&&(z.isMesh||z.isLine||z.isPoints)&&(z.castShadow||z.receiveShadow&&R===ns)&&(!z.frustumCulled||o.intersectsObject(z))){z.modelViewMatrix.multiplyMatrices(I.matrixWorldInverse,z.matrixWorld);let Mt=t.update(z),X=z.material;if(Array.isArray(X)){let mt=Mt.groups;for(let dt=0,_t=mt.length;dt<_t;dt++){let it=mt[dt],lt=X[it.materialIndex];if(lt&<.visible){let H=S(z,lt,ut,R);z.onBeforeShadow(r,z,F,I,Mt,H,it),r.renderBufferDirect(I,null,Mt,H,z,it),z.onAfterShadow(r,z,F,I,Mt,H,it)}}}else if(X.visible){let mt=S(z,X,ut,R);z.onBeforeShadow(r,z,F,I,Mt,mt,null),r.renderBufferDirect(I,null,Mt,mt,z,null),z.onAfterShadow(r,z,F,I,Mt,mt,null)}}let V=z.children;for(let Mt=0,X=V.length;Mt<X;Mt++)L(V[Mt],F,I,ut,R)}function G(z){z.target.removeEventListener("dispose",G);for(let I in d){let ut=d[I],R=z.target.uuid;R in ut&&(ut[R].dispose(),delete ut[R])}}}function EU(r,t,e){let o=e.isWebGL2;function a(){let O=!1,K=new zr,$=null,Q=new zr(0,0,0,0);return{setMask:function(St){$!==St&&!O&&(r.colorMask(St,St,St,St),$=St)},setLocked:function(St){O=St},setClear:function(St,Nt,Jt,Kt,Ee){Ee===!0&&(St*=Kt,Nt*=Kt,Jt*=Kt),K.set(St,Nt,Jt,Kt),Q.equals(K)===!1&&(r.clearColor(St,Nt,Jt,Kt),Q.copy(K))},reset:function(){O=!1,$=null,Q.set(-1,0,0,0)}}}function l(){let O=!1,K=null,$=null,Q=null;return{setTest:function(St){St?Dt(r.DEPTH_TEST):At(r.DEPTH_TEST)},setMask:function(St){K!==St&&!O&&(r.depthMask(St),K=St)},setFunc:function(St){if($!==St){switch(St){case KN:r.depthFunc(r.NEVER);break;case jN:r.depthFunc(r.ALWAYS);break;case QN:r.depthFunc(r.LESS);break;case wf:r.depthFunc(r.LEQUAL);break;case t2:r.depthFunc(r.EQUAL);break;case e2:r.depthFunc(r.GEQUAL);break;case n2:r.depthFunc(r.GREATER);break;case r2:r.depthFunc(r.NOTEQUAL);break;default:r.depthFunc(r.LEQUAL)}$=St}},setLocked:function(St){O=St},setClear:function(St){Q!==St&&(r.clearDepth(St),Q=St)},reset:function(){O=!1,K=null,$=null,Q=null}}}function h(){let O=!1,K=null,$=null,Q=null,St=null,Nt=null,Jt=null,Kt=null,Ee=null;return{setTest:function(de){O||(de?Dt(r.STENCIL_TEST):At(r.STENCIL_TEST))},setMask:function(de){K!==de&&!O&&(r.stencilMask(de),K=de)},setFunc:function(de,Se,we){($!==de||Q!==Se||St!==we)&&(r.stencilFunc(de,Se,we),$=de,Q=Se,St=we)},setOp:function(de,Se,we){(Nt!==de||Jt!==Se||Kt!==we)&&(r.stencilOp(de,Se,we),Nt=de,Jt=Se,Kt=we)},setLocked:function(de){O=de},setClear:function(de){Ee!==de&&(r.clearStencil(de),Ee=de)},reset:function(){O=!1,K=null,$=null,Q=null,St=null,Nt=null,Jt=null,Kt=null,Ee=null}}}let f=new a,p=new l,d=new h,g=new WeakMap,x=new WeakMap,v={},M={},b=new WeakMap,T=[],_=null,y=!1,A=null,S=null,L=null,G=null,z=null,F=null,I=null,ut=new vn(0,0,0),R=0,W=!1,V=null,Mt=null,X=null,mt=null,dt=null,_t=r.getParameter(r.MAX_COMBINED_TEXTURE_IMAGE_UNITS),it=!1,lt=0,H=r.getParameter(r.VERSION);H.indexOf("WebGL")!==-1?(lt=parseFloat(/^WebGL (\d)/.exec(H)[1]),it=lt>=1):H.indexOf("OpenGL ES")!==-1&&(lt=parseFloat(/^OpenGL ES (\d)/.exec(H)[1]),it=lt>=2);let bt=null,Tt={},Yt=r.getParameter(r.SCISSOR_BOX),tt=r.getParameter(r.VIEWPORT),wt=new zr().fromArray(Yt),Bt=new zr().fromArray(tt);function $t(O,K,$,Q){let St=new Uint8Array(4),Nt=r.createTexture();r.bindTexture(O,Nt),r.texParameteri(O,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(O,r.TEXTURE_MAG_FILTER,r.NEAREST);for(let Jt=0;Jt<$;Jt++)o&&(O===r.TEXTURE_3D||O===r.TEXTURE_2D_ARRAY)?r.texImage3D(K,0,r.RGBA,1,1,Q,0,r.RGBA,r.UNSIGNED_BYTE,St):r.texImage2D(K+Jt,0,r.RGBA,1,1,0,r.RGBA,r.UNSIGNED_BYTE,St);return Nt}let Ut={};Ut[r.TEXTURE_2D]=$t(r.TEXTURE_2D,r.TEXTURE_2D,1),Ut[r.TEXTURE_CUBE_MAP]=$t(r.TEXTURE_CUBE_MAP,r.TEXTURE_CUBE_MAP_POSITIVE_X,6),o&&(Ut[r.TEXTURE_2D_ARRAY]=$t(r.TEXTURE_2D_ARRAY,r.TEXTURE_2D_ARRAY,1,1),Ut[r.TEXTURE_3D]=$t(r.TEXTURE_3D,r.TEXTURE_3D,1,1)),f.setClear(0,0,0,1),p.setClear(1),d.setClear(0),Dt(r.DEPTH_TEST),p.setFunc(wf),ce(!1),Lt(w1),Dt(r.CULL_FACE),Wt(Is);function Dt(O){v[O]!==!0&&(r.enable(O),v[O]=!0)}function At(O){v[O]!==!1&&(r.disable(O),v[O]=!1)}function te(O,K){return M[O]!==K?(r.bindFramebuffer(O,K),M[O]=K,o&&(O===r.DRAW_FRAMEBUFFER&&(M[r.FRAMEBUFFER]=K),O===r.FRAMEBUFFER&&(M[r.DRAW_FRAMEBUFFER]=K)),!0):!1}function rt(O,K){let $=T,Q=!1;if(O){$=b.get(K),$===void 0&&($=[],b.set(K,$));let St=O.textures;if($.length!==St.length||$[0]!==r.COLOR_ATTACHMENT0){for(let Nt=0,Jt=St.length;Nt<Jt;Nt++)$[Nt]=r.COLOR_ATTACHMENT0+Nt;$.length=St.length,Q=!0}}else $[0]!==r.BACK&&($[0]=r.BACK,Q=!0);if(Q)if(e.isWebGL2)r.drawBuffers($);else if(t.has("WEBGL_draw_buffers")===!0)t.get("WEBGL_draw_buffers").drawBuffersWEBGL($);else throw new Error("THREE.WebGLState: Usage of gl.drawBuffers() require WebGL2 or WEBGL_draw_buffers extension")}function an(O){return _!==O?(r.useProgram(O),_=O,!0):!1}let zt={[pa]:r.FUNC_ADD,[FN]:r.FUNC_SUBTRACT,[UN]:r.FUNC_REVERSE_SUBTRACT};if(o)zt[C1]=r.MIN,zt[P1]=r.MAX;else{let O=t.get("EXT_blend_minmax");O!==null&&(zt[C1]=O.MIN_EXT,zt[P1]=O.MAX_EXT)}let ne={[BN]:r.ZERO,[zN]:r.ONE,[GN]:r.SRC_COLOR,[rm]:r.SRC_ALPHA,[XN]:r.SRC_ALPHA_SATURATE,[HN]:r.DST_COLOR,[qN]:r.DST_ALPHA,[kN]:r.ONE_MINUS_SRC_COLOR,[im]:r.ONE_MINUS_SRC_ALPHA,[WN]:r.ONE_MINUS_DST_COLOR,[VN]:r.ONE_MINUS_DST_ALPHA,[YN]:r.CONSTANT_COLOR,[$N]:r.ONE_MINUS_CONSTANT_COLOR,[ZN]:r.CONSTANT_ALPHA,[JN]:r.ONE_MINUS_CONSTANT_ALPHA};function Wt(O,K,$,Q,St,Nt,Jt,Kt,Ee,de){if(O===Is){y===!0&&(At(r.BLEND),y=!1);return}if(y===!1&&(Dt(r.BLEND),y=!0),O!==DN){if(O!==A||de!==W){if((S!==pa||z!==pa)&&(r.blendEquation(r.FUNC_ADD),S=pa,z=pa),de)switch(O){case xu:r.blendFuncSeparate(r.ONE,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case b1:r.blendFunc(r.ONE,r.ONE);break;case T1:r.blendFuncSeparate(r.ZERO,r.ONE_MINUS_SRC_COLOR,r.ZERO,r.ONE);break;case A1:r.blendFuncSeparate(r.ZERO,r.SRC_COLOR,r.ZERO,r.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",O);break}else switch(O){case xu:r.blendFuncSeparate(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case b1:r.blendFunc(r.SRC_ALPHA,r.ONE);break;case T1:r.blendFuncSeparate(r.ZERO,r.ONE_MINUS_SRC_COLOR,r.ZERO,r.ONE);break;case A1:r.blendFunc(r.ZERO,r.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",O);break}L=null,G=null,F=null,I=null,ut.set(0,0,0),R=0,A=O,W=de}return}St=St||K,Nt=Nt||$,Jt=Jt||Q,(K!==S||St!==z)&&(r.blendEquationSeparate(zt[K],zt[St]),S=K,z=St),($!==L||Q!==G||Nt!==F||Jt!==I)&&(r.blendFuncSeparate(ne[$],ne[Q],ne[Nt],ne[Jt]),L=$,G=Q,F=Nt,I=Jt),(Kt.equals(ut)===!1||Ee!==R)&&(r.blendColor(Kt.r,Kt.g,Kt.b,Ee),ut.copy(Kt),R=Ee),A=O,W=!1}function ie(O,K){O.side===is?At(r.CULL_FACE):Dt(r.CULL_FACE);let $=O.side===Ei;K&&($=!$),ce($),O.blending===xu&&O.transparent===!1?Wt(Is):Wt(O.blending,O.blendEquation,O.blendSrc,O.blendDst,O.blendEquationAlpha,O.blendSrcAlpha,O.blendDstAlpha,O.blendColor,O.blendAlpha,O.premultipliedAlpha),p.setFunc(O.depthFunc),p.setTest(O.depthTest),p.setMask(O.depthWrite),f.setMask(O.colorWrite);let Q=O.stencilWrite;d.setTest(Q),Q&&(d.setMask(O.stencilWriteMask),d.setFunc(O.stencilFunc,O.stencilRef,O.stencilFuncMask),d.setOp(O.stencilFail,O.stencilZFail,O.stencilZPass)),Y(O.polygonOffset,O.polygonOffsetFactor,O.polygonOffsetUnits),O.alphaToCoverage===!0?Dt(r.SAMPLE_ALPHA_TO_COVERAGE):At(r.SAMPLE_ALPHA_TO_COVERAGE)}function ce(O){V!==O&&(O?r.frontFace(r.CW):r.frontFace(r.CCW),V=O)}function Lt(O){O!==LN?(Dt(r.CULL_FACE),O!==Mt&&(O===w1?r.cullFace(r.BACK):O===NN?r.cullFace(r.FRONT):r.cullFace(r.FRONT_AND_BACK))):At(r.CULL_FACE),Mt=O}function se(O){O!==X&&(it&&r.lineWidth(O),X=O)}function Y(O,K,$){O?(Dt(r.POLYGON_OFFSET_FILL),(mt!==K||dt!==$)&&(r.polygonOffset(K,$),mt=K,dt=$)):At(r.POLYGON_OFFSET_FILL)}function N(O){O?Dt(r.SCISSOR_TEST):At(r.SCISSOR_TEST)}function xt(O){O===void 0&&(O=r.TEXTURE0+_t-1),bt!==O&&(r.activeTexture(O),bt=O)}function Et(O,K,$){$===void 0&&(bt===null?$=r.TEXTURE0+_t-1:$=bt);let Q=Tt[$];Q===void 0&&(Q={type:void 0,texture:void 0},Tt[$]=Q),(Q.type!==O||Q.texture!==K)&&(bt!==$&&(r.activeTexture($),bt=$),r.bindTexture(O,K||Ut[O]),Q.type=O,Q.texture=K)}function ot(){let O=Tt[bt];O!==void 0&&O.type!==void 0&&(r.bindTexture(O.type,null),O.type=void 0,O.texture=void 0)}function Pt(){try{r.compressedTexImage2D.apply(r,arguments)}catch(O){console.error("THREE.WebGLState:",O)}}function ue(){try{r.compressedTexImage3D.apply(r,arguments)}catch(O){console.error("THREE.WebGLState:",O)}}function Ct(){try{r.texSubImage2D.apply(r,arguments)}catch(O){console.error("THREE.WebGLState:",O)}}function Ot(){try{r.texSubImage3D.apply(r,arguments)}catch(O){console.error("THREE.WebGLState:",O)}}function kt(){try{r.compressedTexSubImage2D.apply(r,arguments)}catch(O){console.error("THREE.WebGLState:",O)}}function J(){try{r.compressedTexSubImage3D.apply(r,arguments)}catch(O){console.error("THREE.WebGLState:",O)}}function w(){try{r.texStorage2D.apply(r,arguments)}catch(O){console.error("THREE.WebGLState:",O)}}function P(){try{r.texStorage3D.apply(r,arguments)}catch(O){console.error("THREE.WebGLState:",O)}}function D(){try{r.texImage2D.apply(r,arguments)}catch(O){console.error("THREE.WebGLState:",O)}}function k(){try{r.texImage3D.apply(r,arguments)}catch(O){console.error("THREE.WebGLState:",O)}}function B(O){wt.equals(O)===!1&&(r.scissor(O.x,O.y,O.z,O.w),wt.copy(O))}function et(O){Bt.equals(O)===!1&&(r.viewport(O.x,O.y,O.z,O.w),Bt.copy(O))}function j(O,K){let $=x.get(K);$===void 0&&($=new WeakMap,x.set(K,$));let Q=$.get(O);Q===void 0&&(Q=r.getUniformBlockIndex(K,O.name),$.set(O,Q))}function ft(O,K){let Q=x.get(K).get(O);g.get(K)!==Q&&(r.uniformBlockBinding(K,Q,O.__bindingPointIndex),g.set(K,Q))}function ct(){r.disable(r.BLEND),r.disable(r.CULL_FACE),r.disable(r.DEPTH_TEST),r.disable(r.POLYGON_OFFSET_FILL),r.disable(r.SCISSOR_TEST),r.disable(r.STENCIL_TEST),r.disable(r.SAMPLE_ALPHA_TO_COVERAGE),r.blendEquation(r.FUNC_ADD),r.blendFunc(r.ONE,r.ZERO),r.blendFuncSeparate(r.ONE,r.ZERO,r.ONE,r.ZERO),r.blendColor(0,0,0,0),r.colorMask(!0,!0,!0,!0),r.clearColor(0,0,0,0),r.depthMask(!0),r.depthFunc(r.LESS),r.clearDepth(1),r.stencilMask(4294967295),r.stencilFunc(r.ALWAYS,0,4294967295),r.stencilOp(r.KEEP,r.KEEP,r.KEEP),r.clearStencil(0),r.cullFace(r.BACK),r.frontFace(r.CCW),r.polygonOffset(0,0),r.activeTexture(r.TEXTURE0),r.bindFramebuffer(r.FRAMEBUFFER,null),o===!0&&(r.bindFramebuffer(r.DRAW_FRAMEBUFFER,null),r.bindFramebuffer(r.READ_FRAMEBUFFER,null)),r.useProgram(null),r.lineWidth(1),r.scissor(0,0,r.canvas.width,r.canvas.height),r.viewport(0,0,r.canvas.width,r.canvas.height),v={},bt=null,Tt={},M={},b=new WeakMap,T=[],_=null,y=!1,A=null,S=null,L=null,G=null,z=null,F=null,I=null,ut=new vn(0,0,0),R=0,W=!1,V=null,Mt=null,X=null,mt=null,dt=null,wt.set(0,0,r.canvas.width,r.canvas.height),Bt.set(0,0,r.canvas.width,r.canvas.height),f.reset(),p.reset(),d.reset()}return{buffers:{color:f,depth:p,stencil:d},enable:Dt,disable:At,bindFramebuffer:te,drawBuffers:rt,useProgram:an,setBlending:Wt,setMaterial:ie,setFlipSided:ce,setCullFace:Lt,setLineWidth:se,setPolygonOffset:Y,setScissorTest:N,activeTexture:xt,bindTexture:Et,unbindTexture:ot,compressedTexImage2D:Pt,compressedTexImage3D:ue,texImage2D:D,texImage3D:k,updateUBOMapping:j,uniformBlockBinding:ft,texStorage2D:w,texStorage3D:P,texSubImage2D:Ct,texSubImage3D:Ot,compressedTexSubImage2D:kt,compressedTexSubImage3D:J,scissor:B,viewport:et,reset:ct}}function MU(r,t,e,o,a,l,h){let f=a.isWebGL2,p=t.has("WEBGL_multisampled_render_to_texture")?t.get("WEBGL_multisampled_render_to_texture"):null,d=typeof navigator=="undefined"?!1:/OculusBrowser/g.test(navigator.userAgent),g=new ye,x=new WeakMap,v,M=new WeakMap,b=!1;try{b=typeof OffscreenCanvas!="undefined"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch(Y){}function T(Y,N){return b?new OffscreenCanvas(Y,N):Rf("canvas")}function _(Y,N,xt,Et){let ot=1,Pt=se(Y);if((Pt.width>Et||Pt.height>Et)&&(ot=Et/Math.max(Pt.width,Pt.height)),ot<1||N===!0)if(typeof HTMLImageElement!="undefined"&&Y instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&Y instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&Y instanceof ImageBitmap||typeof VideoFrame!="undefined"&&Y instanceof VideoFrame){let ue=N?hm:Math.floor,Ct=ue(ot*Pt.width),Ot=ue(ot*Pt.height);v===void 0&&(v=T(Ct,Ot));let kt=xt?T(Ct,Ot):v;return kt.width=Ct,kt.height=Ot,kt.getContext("2d").drawImage(Y,0,0,Ct,Ot),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+Pt.width+"x"+Pt.height+") to ("+Ct+"x"+Ot+")."),kt}else return"data"in Y&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+Pt.width+"x"+Pt.height+")."),Y;return Y}function y(Y){let N=se(Y);return aE(N.width)&&aE(N.height)}function A(Y){return f?!1:Y.wrapS!==co||Y.wrapT!==co||Y.minFilter!==hi&&Y.minFilter!==_i}function S(Y,N){return Y.generateMipmaps&&N&&Y.minFilter!==hi&&Y.minFilter!==_i}function L(Y){r.generateMipmap(Y)}function G(Y,N,xt,Et,ot=!1){if(f===!1)return N;if(Y!==null){if(r[Y]!==void 0)return r[Y];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+Y+"'")}let Pt=N;if(N===r.RED&&(xt===r.FLOAT&&(Pt=r.R32F),xt===r.HALF_FLOAT&&(Pt=r.R16F),xt===r.UNSIGNED_BYTE&&(Pt=r.R8)),N===r.RED_INTEGER&&(xt===r.UNSIGNED_BYTE&&(Pt=r.R8UI),xt===r.UNSIGNED_SHORT&&(Pt=r.R16UI),xt===r.UNSIGNED_INT&&(Pt=r.R32UI),xt===r.BYTE&&(Pt=r.R8I),xt===r.SHORT&&(Pt=r.R16I),xt===r.INT&&(Pt=r.R32I)),N===r.RG&&(xt===r.FLOAT&&(Pt=r.RG32F),xt===r.HALF_FLOAT&&(Pt=r.RG16F),xt===r.UNSIGNED_BYTE&&(Pt=r.RG8)),N===r.RG_INTEGER&&(xt===r.UNSIGNED_BYTE&&(Pt=r.RG8UI),xt===r.UNSIGNED_SHORT&&(Pt=r.RG16UI),xt===r.UNSIGNED_INT&&(Pt=r.RG32UI),xt===r.BYTE&&(Pt=r.RG8I),xt===r.SHORT&&(Pt=r.RG16I),xt===r.INT&&(Pt=r.RG32I)),N===r.RGBA){let ue=ot?Af:Cn.getTransfer(Et);xt===r.FLOAT&&(Pt=r.RGBA32F),xt===r.HALF_FLOAT&&(Pt=r.RGBA16F),xt===r.UNSIGNED_BYTE&&(Pt=ue===Un?r.SRGB8_ALPHA8:r.RGBA8),xt===r.UNSIGNED_SHORT_4_4_4_4&&(Pt=r.RGBA4),xt===r.UNSIGNED_SHORT_5_5_5_1&&(Pt=r.RGB5_A1)}return(Pt===r.R16F||Pt===r.R32F||Pt===r.RG16F||Pt===r.RG32F||Pt===r.RGBA16F||Pt===r.RGBA32F)&&t.get("EXT_color_buffer_float"),Pt}function z(Y,N,xt){return S(Y,xt)===!0||Y.isFramebufferTexture&&Y.minFilter!==hi&&Y.minFilter!==_i?Math.log2(Math.max(N.width,N.height))+1:Y.mipmaps!==void 0&&Y.mipmaps.length>0?Y.mipmaps.length:Y.isCompressedTexture&&Array.isArray(Y.image)?N.mipmaps.length:1}function F(Y){return Y===hi||Y===I1||Y===wl?r.NEAREST:r.LINEAR}function I(Y){let N=Y.target;N.removeEventListener("dispose",I),R(N),N.isVideoTexture&&x.delete(N)}function ut(Y){let N=Y.target;N.removeEventListener("dispose",ut),V(N)}function R(Y){let N=o.get(Y);if(N.__webglInit===void 0)return;let xt=Y.source,Et=M.get(xt);if(Et){let ot=Et[N.__cacheKey];ot.usedTimes--,ot.usedTimes===0&&W(Y),Object.keys(Et).length===0&&M.delete(xt)}o.remove(Y)}function W(Y){let N=o.get(Y);r.deleteTexture(N.__webglTexture);let xt=Y.source,Et=M.get(xt);delete Et[N.__cacheKey],h.memory.textures--}function V(Y){let N=o.get(Y);if(Y.depthTexture&&Y.depthTexture.dispose(),Y.isWebGLCubeRenderTarget)for(let Et=0;Et<6;Et++){if(Array.isArray(N.__webglFramebuffer[Et]))for(let ot=0;ot<N.__webglFramebuffer[Et].length;ot++)r.deleteFramebuffer(N.__webglFramebuffer[Et][ot]);else r.deleteFramebuffer(N.__webglFramebuffer[Et]);N.__webglDepthbuffer&&r.deleteRenderbuffer(N.__webglDepthbuffer[Et])}else{if(Array.isArray(N.__webglFramebuffer))for(let Et=0;Et<N.__webglFramebuffer.length;Et++)r.deleteFramebuffer(N.__webglFramebuffer[Et]);else r.deleteFramebuffer(N.__webglFramebuffer);if(N.__webglDepthbuffer&&r.deleteRenderbuffer(N.__webglDepthbuffer),N.__webglMultisampledFramebuffer&&r.deleteFramebuffer(N.__webglMultisampledFramebuffer),N.__webglColorRenderbuffer)for(let Et=0;Et<N.__webglColorRenderbuffer.length;Et++)N.__webglColorRenderbuffer[Et]&&r.deleteRenderbuffer(N.__webglColorRenderbuffer[Et]);N.__webglDepthRenderbuffer&&r.deleteRenderbuffer(N.__webglDepthRenderbuffer)}let xt=Y.textures;for(let Et=0,ot=xt.length;Et<ot;Et++){let Pt=o.get(xt[Et]);Pt.__webglTexture&&(r.deleteTexture(Pt.__webglTexture),h.memory.textures--),o.remove(xt[Et])}o.remove(Y)}let Mt=0;function X(){Mt=0}function mt(){let Y=Mt;return Y>=a.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+Y+" texture units while this GPU supports only "+a.maxTextures),Mt+=1,Y}function dt(Y){let N=[];return N.push(Y.wrapS),N.push(Y.wrapT),N.push(Y.wrapR||0),N.push(Y.magFilter),N.push(Y.minFilter),N.push(Y.anisotropy),N.push(Y.internalFormat),N.push(Y.format),N.push(Y.type),N.push(Y.generateMipmaps),N.push(Y.premultiplyAlpha),N.push(Y.flipY),N.push(Y.unpackAlignment),N.push(Y.colorSpace),N.join()}function _t(Y,N){let xt=o.get(Y);if(Y.isVideoTexture&&ce(Y),Y.isRenderTargetTexture===!1&&Y.version>0&&xt.__version!==Y.version){let Et=Y.image;if(Et===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(Et.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{Bt(xt,Y,N);return}}e.bindTexture(r.TEXTURE_2D,xt.__webglTexture,r.TEXTURE0+N)}function it(Y,N){let xt=o.get(Y);if(Y.version>0&&xt.__version!==Y.version){Bt(xt,Y,N);return}e.bindTexture(r.TEXTURE_2D_ARRAY,xt.__webglTexture,r.TEXTURE0+N)}function lt(Y,N){let xt=o.get(Y);if(Y.version>0&&xt.__version!==Y.version){Bt(xt,Y,N);return}e.bindTexture(r.TEXTURE_3D,xt.__webglTexture,r.TEXTURE0+N)}function H(Y,N){let xt=o.get(Y);if(Y.version>0&&xt.__version!==Y.version){$t(xt,Y,N);return}e.bindTexture(r.TEXTURE_CUBE_MAP,xt.__webglTexture,r.TEXTURE0+N)}let bt={[am]:r.REPEAT,[co]:r.CLAMP_TO_EDGE,[um]:r.MIRRORED_REPEAT},Tt={[hi]:r.NEAREST,[I1]:r.NEAREST_MIPMAP_NEAREST,[wl]:r.NEAREST_MIPMAP_LINEAR,[_i]:r.LINEAR,[Sd]:r.LINEAR_MIPMAP_NEAREST,[ma]:r.LINEAR_MIPMAP_LINEAR},Yt={[b2]:r.NEVER,[R2]:r.ALWAYS,[T2]:r.LESS,[oM]:r.LEQUAL,[A2]:r.EQUAL,[I2]:r.GEQUAL,[C2]:r.GREATER,[P2]:r.NOTEQUAL};function tt(Y,N,xt){if(N.type===os&&t.has("OES_texture_float_linear")===!1&&(N.magFilter===_i||N.magFilter===Sd||N.magFilter===wl||N.magFilter===ma||N.minFilter===_i||N.minFilter===Sd||N.minFilter===wl||N.minFilter===ma)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),xt?(r.texParameteri(Y,r.TEXTURE_WRAP_S,bt[N.wrapS]),r.texParameteri(Y,r.TEXTURE_WRAP_T,bt[N.wrapT]),(Y===r.TEXTURE_3D||Y===r.TEXTURE_2D_ARRAY)&&r.texParameteri(Y,r.TEXTURE_WRAP_R,bt[N.wrapR]),r.texParameteri(Y,r.TEXTURE_MAG_FILTER,Tt[N.magFilter]),r.texParameteri(Y,r.TEXTURE_MIN_FILTER,Tt[N.minFilter])):(r.texParameteri(Y,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(Y,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),(Y===r.TEXTURE_3D||Y===r.TEXTURE_2D_ARRAY)&&r.texParameteri(Y,r.TEXTURE_WRAP_R,r.CLAMP_TO_EDGE),(N.wrapS!==co||N.wrapT!==co)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),r.texParameteri(Y,r.TEXTURE_MAG_FILTER,F(N.magFilter)),r.texParameteri(Y,r.TEXTURE_MIN_FILTER,F(N.minFilter)),N.minFilter!==hi&&N.minFilter!==_i&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),N.compareFunction&&(r.texParameteri(Y,r.TEXTURE_COMPARE_MODE,r.COMPARE_REF_TO_TEXTURE),r.texParameteri(Y,r.TEXTURE_COMPARE_FUNC,Yt[N.compareFunction])),t.has("EXT_texture_filter_anisotropic")===!0){if(N.magFilter===hi||N.minFilter!==wl&&N.minFilter!==ma||N.type===os&&t.has("OES_texture_float_linear")===!1||f===!1&&N.type===Nl&&t.has("OES_texture_half_float_linear")===!1)return;if(N.anisotropy>1||o.get(N).__currentAnisotropy){let Et=t.get("EXT_texture_filter_anisotropic");r.texParameterf(Y,Et.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(N.anisotropy,a.getMaxAnisotropy())),o.get(N).__currentAnisotropy=N.anisotropy}}}function wt(Y,N){let xt=!1;Y.__webglInit===void 0&&(Y.__webglInit=!0,N.addEventListener("dispose",I));let Et=N.source,ot=M.get(Et);ot===void 0&&(ot={},M.set(Et,ot));let Pt=dt(N);if(Pt!==Y.__cacheKey){ot[Pt]===void 0&&(ot[Pt]={texture:r.createTexture(),usedTimes:0},h.memory.textures++,xt=!0),ot[Pt].usedTimes++;let ue=ot[Y.__cacheKey];ue!==void 0&&(ot[Y.__cacheKey].usedTimes--,ue.usedTimes===0&&W(N)),Y.__cacheKey=Pt,Y.__webglTexture=ot[Pt].texture}return xt}function Bt(Y,N,xt){let Et=r.TEXTURE_2D;(N.isDataArrayTexture||N.isCompressedArrayTexture)&&(Et=r.TEXTURE_2D_ARRAY),N.isData3DTexture&&(Et=r.TEXTURE_3D);let ot=wt(Y,N),Pt=N.source;e.bindTexture(Et,Y.__webglTexture,r.TEXTURE0+xt);let ue=o.get(Pt);if(Pt.version!==ue.__version||ot===!0){e.activeTexture(r.TEXTURE0+xt);let Ct=Cn.getPrimaries(Cn.workingColorSpace),Ot=N.colorSpace===Cs?null:Cn.getPrimaries(N.colorSpace),kt=N.colorSpace===Cs||Ct===Ot?r.NONE:r.BROWSER_DEFAULT_WEBGL;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,N.flipY),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,N.premultiplyAlpha),r.pixelStorei(r.UNPACK_ALIGNMENT,N.unpackAlignment),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,kt);let J=A(N)&&y(N.image)===!1,w=_(N.image,J,!1,a.maxTextureSize);w=Lt(N,w);let P=y(w)||f,D=l.convert(N.format,N.colorSpace),k=l.convert(N.type),B=G(N.internalFormat,D,k,N.colorSpace,N.isVideoTexture);tt(Et,N,P);let et,j=N.mipmaps,ft=f&&N.isVideoTexture!==!0&&B!==iM,ct=ue.__version===void 0||ot===!0,O=Pt.dataReady,K=z(N,w,P);if(N.isDepthTexture)B=r.DEPTH_COMPONENT,f?N.type===os?B=r.DEPTH_COMPONENT32F:N.type===Ps?B=r.DEPTH_COMPONENT24:N.type===ya?B=r.DEPTH24_STENCIL8:B=r.DEPTH_COMPONENT16:N.type===os&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),N.format===va&&B===r.DEPTH_COMPONENT&&N.type!==Xm&&N.type!==Ps&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),N.type=Ps,k=l.convert(N.type)),N.format===bu&&B===r.DEPTH_COMPONENT&&(B=r.DEPTH_STENCIL,N.type!==ya&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),N.type=ya,k=l.convert(N.type))),ct&&(ft?e.texStorage2D(r.TEXTURE_2D,1,B,w.width,w.height):e.texImage2D(r.TEXTURE_2D,0,B,w.width,w.height,0,D,k,null));else if(N.isDataTexture)if(j.length>0&&P){ft&&ct&&e.texStorage2D(r.TEXTURE_2D,K,B,j[0].width,j[0].height);for(let $=0,Q=j.length;$<Q;$++)et=j[$],ft?O&&e.texSubImage2D(r.TEXTURE_2D,$,0,0,et.width,et.height,D,k,et.data):e.texImage2D(r.TEXTURE_2D,$,B,et.width,et.height,0,D,k,et.data);N.generateMipmaps=!1}else ft?(ct&&e.texStorage2D(r.TEXTURE_2D,K,B,w.width,w.height),O&&e.texSubImage2D(r.TEXTURE_2D,0,0,0,w.width,w.height,D,k,w.data)):e.texImage2D(r.TEXTURE_2D,0,B,w.width,w.height,0,D,k,w.data);else if(N.isCompressedTexture)if(N.isCompressedArrayTexture){ft&&ct&&e.texStorage3D(r.TEXTURE_2D_ARRAY,K,B,j[0].width,j[0].height,w.depth);for(let $=0,Q=j.length;$<Q;$++)et=j[$],N.format!==fo?D!==null?ft?O&&e.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,$,0,0,0,et.width,et.height,w.depth,D,et.data,0,0):e.compressedTexImage3D(r.TEXTURE_2D_ARRAY,$,B,et.width,et.height,w.depth,0,et.data,0,0):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):ft?O&&e.texSubImage3D(r.TEXTURE_2D_ARRAY,$,0,0,0,et.width,et.height,w.depth,D,k,et.data):e.texImage3D(r.TEXTURE_2D_ARRAY,$,B,et.width,et.height,w.depth,0,D,k,et.data)}else{ft&&ct&&e.texStorage2D(r.TEXTURE_2D,K,B,j[0].width,j[0].height);for(let $=0,Q=j.length;$<Q;$++)et=j[$],N.format!==fo?D!==null?ft?O&&e.compressedTexSubImage2D(r.TEXTURE_2D,$,0,0,et.width,et.height,D,et.data):e.compressedTexImage2D(r.TEXTURE_2D,$,B,et.width,et.height,0,et.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):ft?O&&e.texSubImage2D(r.TEXTURE_2D,$,0,0,et.width,et.height,D,k,et.data):e.texImage2D(r.TEXTURE_2D,$,B,et.width,et.height,0,D,k,et.data)}else if(N.isDataArrayTexture)ft?(ct&&e.texStorage3D(r.TEXTURE_2D_ARRAY,K,B,w.width,w.height,w.depth),O&&e.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,0,w.width,w.height,w.depth,D,k,w.data)):e.texImage3D(r.TEXTURE_2D_ARRAY,0,B,w.width,w.height,w.depth,0,D,k,w.data);else if(N.isData3DTexture)ft?(ct&&e.texStorage3D(r.TEXTURE_3D,K,B,w.width,w.height,w.depth),O&&e.texSubImage3D(r.TEXTURE_3D,0,0,0,0,w.width,w.height,w.depth,D,k,w.data)):e.texImage3D(r.TEXTURE_3D,0,B,w.width,w.height,w.depth,0,D,k,w.data);else if(N.isFramebufferTexture){if(ct)if(ft)e.texStorage2D(r.TEXTURE_2D,K,B,w.width,w.height);else{let $=w.width,Q=w.height;for(let St=0;St<K;St++)e.texImage2D(r.TEXTURE_2D,St,B,$,Q,0,D,k,null),$>>=1,Q>>=1}}else if(j.length>0&&P){if(ft&&ct){let $=se(j[0]);e.texStorage2D(r.TEXTURE_2D,K,B,$.width,$.height)}for(let $=0,Q=j.length;$<Q;$++)et=j[$],ft?O&&e.texSubImage2D(r.TEXTURE_2D,$,0,0,D,k,et):e.texImage2D(r.TEXTURE_2D,$,B,D,k,et);N.generateMipmaps=!1}else if(ft){if(ct){let $=se(w);e.texStorage2D(r.TEXTURE_2D,K,B,$.width,$.height)}O&&e.texSubImage2D(r.TEXTURE_2D,0,0,0,D,k,w)}else e.texImage2D(r.TEXTURE_2D,0,B,D,k,w);S(N,P)&&L(Et),ue.__version=Pt.version,N.onUpdate&&N.onUpdate(N)}Y.__version=N.version}function $t(Y,N,xt){if(N.image.length!==6)return;let Et=wt(Y,N),ot=N.source;e.bindTexture(r.TEXTURE_CUBE_MAP,Y.__webglTexture,r.TEXTURE0+xt);let Pt=o.get(ot);if(ot.version!==Pt.__version||Et===!0){e.activeTexture(r.TEXTURE0+xt);let ue=Cn.getPrimaries(Cn.workingColorSpace),Ct=N.colorSpace===Cs?null:Cn.getPrimaries(N.colorSpace),Ot=N.colorSpace===Cs||ue===Ct?r.NONE:r.BROWSER_DEFAULT_WEBGL;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,N.flipY),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,N.premultiplyAlpha),r.pixelStorei(r.UNPACK_ALIGNMENT,N.unpackAlignment),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,Ot);let kt=N.isCompressedTexture||N.image[0].isCompressedTexture,J=N.image[0]&&N.image[0].isDataTexture,w=[];for(let $=0;$<6;$++)!kt&&!J?w[$]=_(N.image[$],!1,!0,a.maxCubemapSize):w[$]=J?N.image[$].image:N.image[$],w[$]=Lt(N,w[$]);let P=w[0],D=y(P)||f,k=l.convert(N.format,N.colorSpace),B=l.convert(N.type),et=G(N.internalFormat,k,B,N.colorSpace),j=f&&N.isVideoTexture!==!0,ft=Pt.__version===void 0||Et===!0,ct=ot.dataReady,O=z(N,P,D);tt(r.TEXTURE_CUBE_MAP,N,D);let K;if(kt){j&&ft&&e.texStorage2D(r.TEXTURE_CUBE_MAP,O,et,P.width,P.height);for(let $=0;$<6;$++){K=w[$].mipmaps;for(let Q=0;Q<K.length;Q++){let St=K[Q];N.format!==fo?k!==null?j?ct&&e.compressedTexSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+$,Q,0,0,St.width,St.height,k,St.data):e.compressedTexImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+$,Q,et,St.width,St.height,0,St.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):j?ct&&e.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+$,Q,0,0,St.width,St.height,k,B,St.data):e.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+$,Q,et,St.width,St.height,0,k,B,St.data)}}}else{if(K=N.mipmaps,j&&ft){K.length>0&&O++;let $=se(w[0]);e.texStorage2D(r.TEXTURE_CUBE_MAP,O,et,$.width,$.height)}for(let $=0;$<6;$++)if(J){j?ct&&e.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+$,0,0,0,w[$].width,w[$].height,k,B,w[$].data):e.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+$,0,et,w[$].width,w[$].height,0,k,B,w[$].data);for(let Q=0;Q<K.length;Q++){let Nt=K[Q].image[$].image;j?ct&&e.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+$,Q+1,0,0,Nt.width,Nt.height,k,B,Nt.data):e.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+$,Q+1,et,Nt.width,Nt.height,0,k,B,Nt.data)}}else{j?ct&&e.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+$,0,0,0,k,B,w[$]):e.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+$,0,et,k,B,w[$]);for(let Q=0;Q<K.length;Q++){let St=K[Q];j?ct&&e.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+$,Q+1,0,0,k,B,St.image[$]):e.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+$,Q+1,et,k,B,St.image[$])}}}S(N,D)&&L(r.TEXTURE_CUBE_MAP),Pt.__version=ot.version,N.onUpdate&&N.onUpdate(N)}Y.__version=N.version}function Ut(Y,N,xt,Et,ot,Pt){let ue=l.convert(xt.format,xt.colorSpace),Ct=l.convert(xt.type),Ot=G(xt.internalFormat,ue,Ct,xt.colorSpace);if(!o.get(N).__hasExternalTextures){let J=Math.max(1,N.width>>Pt),w=Math.max(1,N.height>>Pt);ot===r.TEXTURE_3D||ot===r.TEXTURE_2D_ARRAY?e.texImage3D(ot,Pt,Ot,J,w,N.depth,0,ue,Ct,null):e.texImage2D(ot,Pt,Ot,J,w,0,ue,Ct,null)}e.bindFramebuffer(r.FRAMEBUFFER,Y),ie(N)?p.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,Et,ot,o.get(xt).__webglTexture,0,Wt(N)):(ot===r.TEXTURE_2D||ot>=r.TEXTURE_CUBE_MAP_POSITIVE_X&&ot<=r.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&r.framebufferTexture2D(r.FRAMEBUFFER,Et,ot,o.get(xt).__webglTexture,Pt),e.bindFramebuffer(r.FRAMEBUFFER,null)}function Dt(Y,N,xt){if(r.bindRenderbuffer(r.RENDERBUFFER,Y),N.depthBuffer&&!N.stencilBuffer){let Et=f===!0?r.DEPTH_COMPONENT24:r.DEPTH_COMPONENT16;if(xt||ie(N)){let ot=N.depthTexture;ot&&ot.isDepthTexture&&(ot.type===os?Et=r.DEPTH_COMPONENT32F:ot.type===Ps&&(Et=r.DEPTH_COMPONENT24));let Pt=Wt(N);ie(N)?p.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,Pt,Et,N.width,N.height):r.renderbufferStorageMultisample(r.RENDERBUFFER,Pt,Et,N.width,N.height)}else r.renderbufferStorage(r.RENDERBUFFER,Et,N.width,N.height);r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.RENDERBUFFER,Y)}else if(N.depthBuffer&&N.stencilBuffer){let Et=Wt(N);xt&&ie(N)===!1?r.renderbufferStorageMultisample(r.RENDERBUFFER,Et,r.DEPTH24_STENCIL8,N.width,N.height):ie(N)?p.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,Et,r.DEPTH24_STENCIL8,N.width,N.height):r.renderbufferStorage(r.RENDERBUFFER,r.DEPTH_STENCIL,N.width,N.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.RENDERBUFFER,Y)}else{let Et=N.textures;for(let ot=0;ot<Et.length;ot++){let Pt=Et[ot],ue=l.convert(Pt.format,Pt.colorSpace),Ct=l.convert(Pt.type),Ot=G(Pt.internalFormat,ue,Ct,Pt.colorSpace),kt=Wt(N);xt&&ie(N)===!1?r.renderbufferStorageMultisample(r.RENDERBUFFER,kt,Ot,N.width,N.height):ie(N)?p.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,kt,Ot,N.width,N.height):r.renderbufferStorage(r.RENDERBUFFER,Ot,N.width,N.height)}}r.bindRenderbuffer(r.RENDERBUFFER,null)}function At(Y,N){if(N&&N.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(e.bindFramebuffer(r.FRAMEBUFFER,Y),!(N.depthTexture&&N.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!o.get(N.depthTexture).__webglTexture||N.depthTexture.image.width!==N.width||N.depthTexture.image.height!==N.height)&&(N.depthTexture.image.width=N.width,N.depthTexture.image.height=N.height,N.depthTexture.needsUpdate=!0),_t(N.depthTexture,0);let Et=o.get(N.depthTexture).__webglTexture,ot=Wt(N);if(N.depthTexture.format===va)ie(N)?p.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.TEXTURE_2D,Et,0,ot):r.framebufferTexture2D(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.TEXTURE_2D,Et,0);else if(N.depthTexture.format===bu)ie(N)?p.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.TEXTURE_2D,Et,0,ot):r.framebufferTexture2D(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.TEXTURE_2D,Et,0);else throw new Error("Unknown depthTexture format")}function te(Y){let N=o.get(Y),xt=Y.isWebGLCubeRenderTarget===!0;if(Y.depthTexture&&!N.__autoAllocateDepthBuffer){if(xt)throw new Error("target.depthTexture not supported in Cube render targets");At(N.__webglFramebuffer,Y)}else if(xt){N.__webglDepthbuffer=[];for(let Et=0;Et<6;Et++)e.bindFramebuffer(r.FRAMEBUFFER,N.__webglFramebuffer[Et]),N.__webglDepthbuffer[Et]=r.createRenderbuffer(),Dt(N.__webglDepthbuffer[Et],Y,!1)}else e.bindFramebuffer(r.FRAMEBUFFER,N.__webglFramebuffer),N.__webglDepthbuffer=r.createRenderbuffer(),Dt(N.__webglDepthbuffer,Y,!1);e.bindFramebuffer(r.FRAMEBUFFER,null)}function rt(Y,N,xt){let Et=o.get(Y);N!==void 0&&Ut(Et.__webglFramebuffer,Y,Y.texture,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,0),xt!==void 0&&te(Y)}function an(Y){let N=Y.texture,xt=o.get(Y),Et=o.get(N);Y.addEventListener("dispose",ut);let ot=Y.textures,Pt=Y.isWebGLCubeRenderTarget===!0,ue=ot.length>1,Ct=y(Y)||f;if(ue||(Et.__webglTexture===void 0&&(Et.__webglTexture=r.createTexture()),Et.__version=N.version,h.memory.textures++),Pt){xt.__webglFramebuffer=[];for(let Ot=0;Ot<6;Ot++)if(f&&N.mipmaps&&N.mipmaps.length>0){xt.__webglFramebuffer[Ot]=[];for(let kt=0;kt<N.mipmaps.length;kt++)xt.__webglFramebuffer[Ot][kt]=r.createFramebuffer()}else xt.__webglFramebuffer[Ot]=r.createFramebuffer()}else{if(f&&N.mipmaps&&N.mipmaps.length>0){xt.__webglFramebuffer=[];for(let Ot=0;Ot<N.mipmaps.length;Ot++)xt.__webglFramebuffer[Ot]=r.createFramebuffer()}else xt.__webglFramebuffer=r.createFramebuffer();if(ue)if(a.drawBuffers)for(let Ot=0,kt=ot.length;Ot<kt;Ot++){let J=o.get(ot[Ot]);J.__webglTexture===void 0&&(J.__webglTexture=r.createTexture(),h.memory.textures++)}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");if(f&&Y.samples>0&&ie(Y)===!1){xt.__webglMultisampledFramebuffer=r.createFramebuffer(),xt.__webglColorRenderbuffer=[],e.bindFramebuffer(r.FRAMEBUFFER,xt.__webglMultisampledFramebuffer);for(let Ot=0;Ot<ot.length;Ot++){let kt=ot[Ot];xt.__webglColorRenderbuffer[Ot]=r.createRenderbuffer(),r.bindRenderbuffer(r.RENDERBUFFER,xt.__webglColorRenderbuffer[Ot]);let J=l.convert(kt.format,kt.colorSpace),w=l.convert(kt.type),P=G(kt.internalFormat,J,w,kt.colorSpace,Y.isXRRenderTarget===!0),D=Wt(Y);r.renderbufferStorageMultisample(r.RENDERBUFFER,D,P,Y.width,Y.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+Ot,r.RENDERBUFFER,xt.__webglColorRenderbuffer[Ot])}r.bindRenderbuffer(r.RENDERBUFFER,null),Y.depthBuffer&&(xt.__webglDepthRenderbuffer=r.createRenderbuffer(),Dt(xt.__webglDepthRenderbuffer,Y,!0)),e.bindFramebuffer(r.FRAMEBUFFER,null)}}if(Pt){e.bindTexture(r.TEXTURE_CUBE_MAP,Et.__webglTexture),tt(r.TEXTURE_CUBE_MAP,N,Ct);for(let Ot=0;Ot<6;Ot++)if(f&&N.mipmaps&&N.mipmaps.length>0)for(let kt=0;kt<N.mipmaps.length;kt++)Ut(xt.__webglFramebuffer[Ot][kt],Y,N,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+Ot,kt);else Ut(xt.__webglFramebuffer[Ot],Y,N,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+Ot,0);S(N,Ct)&&L(r.TEXTURE_CUBE_MAP),e.unbindTexture()}else if(ue){for(let Ot=0,kt=ot.length;Ot<kt;Ot++){let J=ot[Ot],w=o.get(J);e.bindTexture(r.TEXTURE_2D,w.__webglTexture),tt(r.TEXTURE_2D,J,Ct),Ut(xt.__webglFramebuffer,Y,J,r.COLOR_ATTACHMENT0+Ot,r.TEXTURE_2D,0),S(J,Ct)&&L(r.TEXTURE_2D)}e.unbindTexture()}else{let Ot=r.TEXTURE_2D;if((Y.isWebGL3DRenderTarget||Y.isWebGLArrayRenderTarget)&&(f?Ot=Y.isWebGL3DRenderTarget?r.TEXTURE_3D:r.TEXTURE_2D_ARRAY:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),e.bindTexture(Ot,Et.__webglTexture),tt(Ot,N,Ct),f&&N.mipmaps&&N.mipmaps.length>0)for(let kt=0;kt<N.mipmaps.length;kt++)Ut(xt.__webglFramebuffer[kt],Y,N,r.COLOR_ATTACHMENT0,Ot,kt);else Ut(xt.__webglFramebuffer,Y,N,r.COLOR_ATTACHMENT0,Ot,0);S(N,Ct)&&L(Ot),e.unbindTexture()}Y.depthBuffer&&te(Y)}function zt(Y){let N=y(Y)||f,xt=Y.textures;for(let Et=0,ot=xt.length;Et<ot;Et++){let Pt=xt[Et];if(S(Pt,N)){let ue=Y.isWebGLCubeRenderTarget?r.TEXTURE_CUBE_MAP:r.TEXTURE_2D,Ct=o.get(Pt).__webglTexture;e.bindTexture(ue,Ct),L(ue),e.unbindTexture()}}}function ne(Y){if(f&&Y.samples>0&&ie(Y)===!1){let N=Y.textures,xt=Y.width,Et=Y.height,ot=r.COLOR_BUFFER_BIT,Pt=[],ue=Y.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,Ct=o.get(Y),Ot=N.length>1;if(Ot)for(let kt=0;kt<N.length;kt++)e.bindFramebuffer(r.FRAMEBUFFER,Ct.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+kt,r.RENDERBUFFER,null),e.bindFramebuffer(r.FRAMEBUFFER,Ct.__webglFramebuffer),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0+kt,r.TEXTURE_2D,null,0);e.bindFramebuffer(r.READ_FRAMEBUFFER,Ct.__webglMultisampledFramebuffer),e.bindFramebuffer(r.DRAW_FRAMEBUFFER,Ct.__webglFramebuffer);for(let kt=0;kt<N.length;kt++){Pt.push(r.COLOR_ATTACHMENT0+kt),Y.depthBuffer&&Pt.push(ue);let J=Ct.__ignoreDepthValues!==void 0?Ct.__ignoreDepthValues:!1;if(J===!1&&(Y.depthBuffer&&(ot|=r.DEPTH_BUFFER_BIT),Y.stencilBuffer&&(ot|=r.STENCIL_BUFFER_BIT)),Ot&&r.framebufferRenderbuffer(r.READ_FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.RENDERBUFFER,Ct.__webglColorRenderbuffer[kt]),J===!0&&(r.invalidateFramebuffer(r.READ_FRAMEBUFFER,[ue]),r.invalidateFramebuffer(r.DRAW_FRAMEBUFFER,[ue])),Ot){let w=o.get(N[kt]).__webglTexture;r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,w,0)}r.blitFramebuffer(0,0,xt,Et,0,0,xt,Et,ot,r.NEAREST),d&&r.invalidateFramebuffer(r.READ_FRAMEBUFFER,Pt)}if(e.bindFramebuffer(r.READ_FRAMEBUFFER,null),e.bindFramebuffer(r.DRAW_FRAMEBUFFER,null),Ot)for(let kt=0;kt<N.length;kt++){e.bindFramebuffer(r.FRAMEBUFFER,Ct.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+kt,r.RENDERBUFFER,Ct.__webglColorRenderbuffer[kt]);let J=o.get(N[kt]).__webglTexture;e.bindFramebuffer(r.FRAMEBUFFER,Ct.__webglFramebuffer),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0+kt,r.TEXTURE_2D,J,0)}e.bindFramebuffer(r.DRAW_FRAMEBUFFER,Ct.__webglMultisampledFramebuffer)}}function Wt(Y){return Math.min(a.maxSamples,Y.samples)}function ie(Y){let N=o.get(Y);return f&&Y.samples>0&&t.has("WEBGL_multisampled_render_to_texture")===!0&&N.__useRenderToTexture!==!1}function ce(Y){let N=h.render.frame;x.get(Y)!==N&&(x.set(Y,N),Y.update())}function Lt(Y,N){let xt=Y.colorSpace,Et=Y.format,ot=Y.type;return Y.isCompressedTexture===!0||Y.isVideoTexture===!0||Y.format===cm||xt!==Bs&&xt!==Cs&&(Cn.getTransfer(xt)===Un?f===!1?t.has("EXT_sRGB")===!0&&Et===fo?(Y.format=cm,Y.minFilter=_i,Y.generateMipmaps=!1):N=Lf.sRGBToLinear(N):(Et!==fo||ot!==Ls)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",xt)),N}function se(Y){return typeof HTMLImageElement!="undefined"&&Y instanceof HTMLImageElement?(g.width=Y.naturalWidth||Y.width,g.height=Y.naturalHeight||Y.height):typeof VideoFrame!="undefined"&&Y instanceof VideoFrame?(g.width=Y.displayWidth,g.height=Y.displayHeight):(g.width=Y.width,g.height=Y.height),g}this.allocateTextureUnit=mt,this.resetTextureUnits=X,this.setTexture2D=_t,this.setTexture2DArray=it,this.setTexture3D=lt,this.setTextureCube=H,this.rebindTextures=rt,this.setupRenderTarget=an,this.updateRenderTargetMipmap=zt,this.updateMultisampleRenderTarget=ne,this.setupDepthRenderbuffer=te,this.setupFrameBufferTexture=Ut,this.useMultisampledRTT=ie}function SU(r,t,e){let o=e.isWebGL2;function a(l,h=Cs){let f,p=Cn.getTransfer(h);if(l===Ls)return r.UNSIGNED_BYTE;if(l===QE)return r.UNSIGNED_SHORT_4_4_4_4;if(l===tM)return r.UNSIGNED_SHORT_5_5_5_1;if(l===p2)return r.BYTE;if(l===d2)return r.SHORT;if(l===Xm)return r.UNSIGNED_SHORT;if(l===jE)return r.INT;if(l===Ps)return r.UNSIGNED_INT;if(l===os)return r.FLOAT;if(l===Nl)return o?r.HALF_FLOAT:(f=t.get("OES_texture_half_float"),f!==null?f.HALF_FLOAT_OES:null);if(l===m2)return r.ALPHA;if(l===fo)return r.RGBA;if(l===g2)return r.LUMINANCE;if(l===y2)return r.LUMINANCE_ALPHA;if(l===va)return r.DEPTH_COMPONENT;if(l===bu)return r.DEPTH_STENCIL;if(l===cm)return f=t.get("EXT_sRGB"),f!==null?f.SRGB_ALPHA_EXT:null;if(l===v2)return r.RED;if(l===eM)return r.RED_INTEGER;if(l===_2)return r.RG;if(l===nM)return r.RG_INTEGER;if(l===rM)return r.RGBA_INTEGER;if(l===wd||l===bd||l===Td||l===Ad)if(p===Un)if(f=t.get("WEBGL_compressed_texture_s3tc_srgb"),f!==null){if(l===wd)return f.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(l===bd)return f.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(l===Td)return f.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(l===Ad)return f.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(f=t.get("WEBGL_compressed_texture_s3tc"),f!==null){if(l===wd)return f.COMPRESSED_RGB_S3TC_DXT1_EXT;if(l===bd)return f.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(l===Td)return f.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(l===Ad)return f.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(l===R1||l===L1||l===N1||l===O1)if(f=t.get("WEBGL_compressed_texture_pvrtc"),f!==null){if(l===R1)return f.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(l===L1)return f.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(l===N1)return f.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(l===O1)return f.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(l===iM)return f=t.get("WEBGL_compressed_texture_etc1"),f!==null?f.COMPRESSED_RGB_ETC1_WEBGL:null;if(l===D1||l===F1)if(f=t.get("WEBGL_compressed_texture_etc"),f!==null){if(l===D1)return p===Un?f.COMPRESSED_SRGB8_ETC2:f.COMPRESSED_RGB8_ETC2;if(l===F1)return p===Un?f.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:f.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(l===U1||l===B1||l===z1||l===G1||l===k1||l===q1||l===V1||l===H1||l===W1||l===X1||l===Y1||l===$1||l===Z1||l===J1)if(f=t.get("WEBGL_compressed_texture_astc"),f!==null){if(l===U1)return p===Un?f.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:f.COMPRESSED_RGBA_ASTC_4x4_KHR;if(l===B1)return p===Un?f.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:f.COMPRESSED_RGBA_ASTC_5x4_KHR;if(l===z1)return p===Un?f.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:f.COMPRESSED_RGBA_ASTC_5x5_KHR;if(l===G1)return p===Un?f.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:f.COMPRESSED_RGBA_ASTC_6x5_KHR;if(l===k1)return p===Un?f.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:f.COMPRESSED_RGBA_ASTC_6x6_KHR;if(l===q1)return p===Un?f.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:f.COMPRESSED_RGBA_ASTC_8x5_KHR;if(l===V1)return p===Un?f.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:f.COMPRESSED_RGBA_ASTC_8x6_KHR;if(l===H1)return p===Un?f.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:f.COMPRESSED_RGBA_ASTC_8x8_KHR;if(l===W1)return p===Un?f.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:f.COMPRESSED_RGBA_ASTC_10x5_KHR;if(l===X1)return p===Un?f.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:f.COMPRESSED_RGBA_ASTC_10x6_KHR;if(l===Y1)return p===Un?f.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:f.COMPRESSED_RGBA_ASTC_10x8_KHR;if(l===$1)return p===Un?f.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:f.COMPRESSED_RGBA_ASTC_10x10_KHR;if(l===Z1)return p===Un?f.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:f.COMPRESSED_RGBA_ASTC_12x10_KHR;if(l===J1)return p===Un?f.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:f.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(l===Cd||l===K1||l===j1)if(f=t.get("EXT_texture_compression_bptc"),f!==null){if(l===Cd)return p===Un?f.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:f.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(l===K1)return f.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(l===j1)return f.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(l===x2||l===Q1||l===tE||l===eE)if(f=t.get("EXT_texture_compression_rgtc"),f!==null){if(l===Cd)return f.COMPRESSED_RED_RGTC1_EXT;if(l===Q1)return f.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(l===tE)return f.COMPRESSED_RED_GREEN_RGTC2_EXT;if(l===eE)return f.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return l===ya?o?r.UNSIGNED_INT_24_8:(f=t.get("WEBGL_depth_texture"),f!==null?f.UNSIGNED_INT_24_8_WEBGL:null):r[l]!==void 0?r[l]:null}return{convert:a}}var Am=class extends Li{constructor(t=[]){super(),this.isArrayCamera=!0,this.cameras=t}},_u=class extends po{constructor(){super(),this.isGroup=!0,this.type="Group"}},wU={type:"move"},Ll=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new _u,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new _u,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new yt,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new yt),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new _u,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new yt,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new yt),this._grip}dispatchEvent(t){return this._targetRay!==null&&this._targetRay.dispatchEvent(t),this._grip!==null&&this._grip.dispatchEvent(t),this._hand!==null&&this._hand.dispatchEvent(t),this}connect(t){if(t&&t.hand){let e=this._hand;if(e)for(let o of t.hand.values())this._getHandJoint(e,o)}return this.dispatchEvent({type:"connected",data:t}),this}disconnect(t){return this.dispatchEvent({type:"disconnected",data:t}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(t,e,o){let a=null,l=null,h=null,f=this._targetRay,p=this._grip,d=this._hand;if(t&&e.session.visibilityState!=="visible-blurred"){if(d&&t.hand){h=!0;for(let T of t.hand.values()){let _=e.getJointPose(T,o),y=this._getHandJoint(d,T);_!==null&&(y.matrix.fromArray(_.transform.matrix),y.matrix.decompose(y.position,y.rotation,y.scale),y.matrixWorldNeedsUpdate=!0,y.jointRadius=_.radius),y.visible=_!==null}let g=d.joints["index-finger-tip"],x=d.joints["thumb-tip"],v=g.position.distanceTo(x.position),M=.02,b=.005;d.inputState.pinching&&v>M+b?(d.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!d.inputState.pinching&&v<=M-b&&(d.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else p!==null&&t.gripSpace&&(l=e.getPose(t.gripSpace,o),l!==null&&(p.matrix.fromArray(l.transform.matrix),p.matrix.decompose(p.position,p.rotation,p.scale),p.matrixWorldNeedsUpdate=!0,l.linearVelocity?(p.hasLinearVelocity=!0,p.linearVelocity.copy(l.linearVelocity)):p.hasLinearVelocity=!1,l.angularVelocity?(p.hasAngularVelocity=!0,p.angularVelocity.copy(l.angularVelocity)):p.hasAngularVelocity=!1));f!==null&&(a=e.getPose(t.targetRaySpace,o),a===null&&l!==null&&(a=l),a!==null&&(f.matrix.fromArray(a.transform.matrix),f.matrix.decompose(f.position,f.rotation,f.scale),f.matrixWorldNeedsUpdate=!0,a.linearVelocity?(f.hasLinearVelocity=!0,f.linearVelocity.copy(a.linearVelocity)):f.hasLinearVelocity=!1,a.angularVelocity?(f.hasAngularVelocity=!0,f.angularVelocity.copy(a.angularVelocity)):f.hasAngularVelocity=!1,this.dispatchEvent(wU)))}return f!==null&&(f.visible=a!==null),p!==null&&(p.visible=l!==null),d!==null&&(d.visible=h!==null),this}_getHandJoint(t,e){if(t.joints[e.jointName]===void 0){let o=new _u;o.matrixAutoUpdate=!1,o.visible=!1,t.joints[e.jointName]=o,t.add(o)}return t.joints[e.jointName]}},bU=`
|
|
3781
|
+
}`;function xU(r,t,e){let o=new qf,a=new ye,l=new ye,h=new zr,f=new bm({depthPacking:M2}),p=new Tm,d={},g=e.maxTextureSize,x={[Os]:Ei,[Ei]:Os,[is]:is},v=new Io({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new ye},radius:{value:4}},vertexShader:vU,fragmentShader:_U}),M=v.clone();M.defines.HORIZONTAL_PASS=1;let b=new Us;b.setAttribute("position",new Ni(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let T=new ho(b,v),_=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=ZE;let y=this.type;this.render=function(z,F,I){if(_.enabled===!1||_.autoUpdate===!1&&_.needsUpdate===!1||z.length===0)return;let ut=r.getRenderTarget(),R=r.getActiveCubeFace(),W=r.getActiveMipmapLevel(),V=r.state;V.setBlending(Is),V.buffers.color.setClear(1,1,1,1),V.buffers.depth.setTest(!0),V.setScissorTest(!1);let Mt=y!==ns&&this.type===ns,X=y===ns&&this.type!==ns;for(let mt=0,dt=z.length;mt<dt;mt++){let _t=z[mt],it=_t.shadow;if(it===void 0){console.warn("THREE.WebGLShadowMap:",_t,"has no shadow.");continue}if(it.autoUpdate===!1&&it.needsUpdate===!1)continue;a.copy(it.mapSize);let lt=it.getFrameExtents();if(a.multiply(lt),l.copy(it.mapSize),(a.x>g||a.y>g)&&(a.x>g&&(l.x=Math.floor(g/lt.x),a.x=l.x*lt.x,it.mapSize.x=l.x),a.y>g&&(l.y=Math.floor(g/lt.y),a.y=l.y*lt.y,it.mapSize.y=l.y)),it.map===null||Mt===!0||X===!0){let bt=this.type!==ns?{minFilter:hi,magFilter:hi}:{};it.map!==null&&it.map.dispose(),it.map=new us(a.x,a.y,bt),it.map.texture.name=_t.name+".shadowMap",it.camera.updateProjectionMatrix()}r.setRenderTarget(it.map),r.clear();let H=it.getViewportCount();for(let bt=0;bt<H;bt++){let Tt=it.getViewport(bt);h.set(l.x*Tt.x,l.y*Tt.y,l.x*Tt.z,l.y*Tt.w),V.viewport(h),it.updateMatrices(_t,bt),o=it.getFrustum(),L(F,I,it.camera,_t,this.type)}it.isPointLightShadow!==!0&&this.type===ns&&A(it,I),it.needsUpdate=!1}y=this.type,_.needsUpdate=!1,r.setRenderTarget(ut,R,W)},this.dispose=function(){b.dispose(),b=null,v.dispose(),v=null,M.dispose(),M=null,T.clear()};function A(z,F){let I=t.update(T);v.defines.VSM_SAMPLES!==z.blurSamples&&(v.defines.VSM_SAMPLES=z.blurSamples,M.defines.VSM_SAMPLES=z.blurSamples,v.needsUpdate=!0,M.needsUpdate=!0),z.mapPass===null&&(z.mapPass=new us(a.x,a.y)),v.uniforms.shadow_pass.value=z.map.texture,v.uniforms.resolution.value=z.mapSize,v.uniforms.radius.value=z.radius,r.setRenderTarget(z.mapPass),r.clear(),r.renderBufferDirect(F,null,I,v,T,null),M.uniforms.shadow_pass.value=z.mapPass.texture,M.uniforms.resolution.value=z.mapSize,M.uniforms.radius.value=z.radius,r.setRenderTarget(z.map),r.clear(),r.renderBufferDirect(F,null,I,M,T,null)}function S(z,F,I,ut){let R=null,W=I.isPointLight===!0?z.customDistanceMaterial:z.customDepthMaterial;if(W!==void 0)R=W;else if(R=I.isPointLight===!0?p:f,r.localClippingEnabled&&F.clipShadows===!0&&Array.isArray(F.clippingPlanes)&&F.clippingPlanes.length!==0||F.displacementMap&&F.displacementScale!==0||F.alphaMap&&F.alphaTest>0||F.map&&F.alphaTest>0){let V=R.uuid,Mt=F.uuid,X=d[V];X===void 0&&(X={},d[V]=X);let mt=X[Mt];mt===void 0&&(mt=R.clone(),X[Mt]=mt,F.addEventListener("dispose",G)),R=mt}if(R.visible=F.visible,R.wireframe=F.wireframe,ut===ns?R.side=F.shadowSide!==null?F.shadowSide:F.side:R.side=F.shadowSide!==null?F.shadowSide:x[F.side],R.alphaMap=F.alphaMap,R.alphaTest=F.alphaTest,R.map=F.map,R.clipShadows=F.clipShadows,R.clippingPlanes=F.clippingPlanes,R.clipIntersection=F.clipIntersection,R.displacementMap=F.displacementMap,R.displacementScale=F.displacementScale,R.displacementBias=F.displacementBias,R.wireframeLinewidth=F.wireframeLinewidth,R.linewidth=F.linewidth,I.isPointLight===!0&&R.isMeshDistanceMaterial===!0){let V=r.properties.get(R);V.light=I}return R}function L(z,F,I,ut,R){if(z.visible===!1)return;if(z.layers.test(F.layers)&&(z.isMesh||z.isLine||z.isPoints)&&(z.castShadow||z.receiveShadow&&R===ns)&&(!z.frustumCulled||o.intersectsObject(z))){z.modelViewMatrix.multiplyMatrices(I.matrixWorldInverse,z.matrixWorld);let Mt=t.update(z),X=z.material;if(Array.isArray(X)){let mt=Mt.groups;for(let dt=0,_t=mt.length;dt<_t;dt++){let it=mt[dt],lt=X[it.materialIndex];if(lt&<.visible){let H=S(z,lt,ut,R);z.onBeforeShadow(r,z,F,I,Mt,H,it),r.renderBufferDirect(I,null,Mt,H,z,it),z.onAfterShadow(r,z,F,I,Mt,H,it)}}}else if(X.visible){let mt=S(z,X,ut,R);z.onBeforeShadow(r,z,F,I,Mt,mt,null),r.renderBufferDirect(I,null,Mt,mt,z,null),z.onAfterShadow(r,z,F,I,Mt,mt,null)}}let V=z.children;for(let Mt=0,X=V.length;Mt<X;Mt++)L(V[Mt],F,I,ut,R)}function G(z){z.target.removeEventListener("dispose",G);for(let I in d){let ut=d[I],R=z.target.uuid;R in ut&&(ut[R].dispose(),delete ut[R])}}}function EU(r,t,e){let o=e.isWebGL2;function a(){let O=!1,K=new zr,$=null,Q=new zr(0,0,0,0);return{setMask:function(St){$!==St&&!O&&(r.colorMask(St,St,St,St),$=St)},setLocked:function(St){O=St},setClear:function(St,Nt,Jt,Kt,Ee){Ee===!0&&(St*=Kt,Nt*=Kt,Jt*=Kt),K.set(St,Nt,Jt,Kt),Q.equals(K)===!1&&(r.clearColor(St,Nt,Jt,Kt),Q.copy(K))},reset:function(){O=!1,$=null,Q.set(-1,0,0,0)}}}function l(){let O=!1,K=null,$=null,Q=null;return{setTest:function(St){St?Dt(r.DEPTH_TEST):At(r.DEPTH_TEST)},setMask:function(St){K!==St&&!O&&(r.depthMask(St),K=St)},setFunc:function(St){if($!==St){switch(St){case KN:r.depthFunc(r.NEVER);break;case jN:r.depthFunc(r.ALWAYS);break;case QN:r.depthFunc(r.LESS);break;case bf:r.depthFunc(r.LEQUAL);break;case t2:r.depthFunc(r.EQUAL);break;case e2:r.depthFunc(r.GEQUAL);break;case n2:r.depthFunc(r.GREATER);break;case r2:r.depthFunc(r.NOTEQUAL);break;default:r.depthFunc(r.LEQUAL)}$=St}},setLocked:function(St){O=St},setClear:function(St){Q!==St&&(r.clearDepth(St),Q=St)},reset:function(){O=!1,K=null,$=null,Q=null}}}function h(){let O=!1,K=null,$=null,Q=null,St=null,Nt=null,Jt=null,Kt=null,Ee=null;return{setTest:function(de){O||(de?Dt(r.STENCIL_TEST):At(r.STENCIL_TEST))},setMask:function(de){K!==de&&!O&&(r.stencilMask(de),K=de)},setFunc:function(de,Se,we){($!==de||Q!==Se||St!==we)&&(r.stencilFunc(de,Se,we),$=de,Q=Se,St=we)},setOp:function(de,Se,we){(Nt!==de||Jt!==Se||Kt!==we)&&(r.stencilOp(de,Se,we),Nt=de,Jt=Se,Kt=we)},setLocked:function(de){O=de},setClear:function(de){Ee!==de&&(r.clearStencil(de),Ee=de)},reset:function(){O=!1,K=null,$=null,Q=null,St=null,Nt=null,Jt=null,Kt=null,Ee=null}}}let f=new a,p=new l,d=new h,g=new WeakMap,x=new WeakMap,v={},M={},b=new WeakMap,T=[],_=null,y=!1,A=null,S=null,L=null,G=null,z=null,F=null,I=null,ut=new vn(0,0,0),R=0,W=!1,V=null,Mt=null,X=null,mt=null,dt=null,_t=r.getParameter(r.MAX_COMBINED_TEXTURE_IMAGE_UNITS),it=!1,lt=0,H=r.getParameter(r.VERSION);H.indexOf("WebGL")!==-1?(lt=parseFloat(/^WebGL (\d)/.exec(H)[1]),it=lt>=1):H.indexOf("OpenGL ES")!==-1&&(lt=parseFloat(/^OpenGL ES (\d)/.exec(H)[1]),it=lt>=2);let bt=null,Tt={},Yt=r.getParameter(r.SCISSOR_BOX),tt=r.getParameter(r.VIEWPORT),wt=new zr().fromArray(Yt),Bt=new zr().fromArray(tt);function $t(O,K,$,Q){let St=new Uint8Array(4),Nt=r.createTexture();r.bindTexture(O,Nt),r.texParameteri(O,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(O,r.TEXTURE_MAG_FILTER,r.NEAREST);for(let Jt=0;Jt<$;Jt++)o&&(O===r.TEXTURE_3D||O===r.TEXTURE_2D_ARRAY)?r.texImage3D(K,0,r.RGBA,1,1,Q,0,r.RGBA,r.UNSIGNED_BYTE,St):r.texImage2D(K+Jt,0,r.RGBA,1,1,0,r.RGBA,r.UNSIGNED_BYTE,St);return Nt}let Ut={};Ut[r.TEXTURE_2D]=$t(r.TEXTURE_2D,r.TEXTURE_2D,1),Ut[r.TEXTURE_CUBE_MAP]=$t(r.TEXTURE_CUBE_MAP,r.TEXTURE_CUBE_MAP_POSITIVE_X,6),o&&(Ut[r.TEXTURE_2D_ARRAY]=$t(r.TEXTURE_2D_ARRAY,r.TEXTURE_2D_ARRAY,1,1),Ut[r.TEXTURE_3D]=$t(r.TEXTURE_3D,r.TEXTURE_3D,1,1)),f.setClear(0,0,0,1),p.setClear(1),d.setClear(0),Dt(r.DEPTH_TEST),p.setFunc(bf),ce(!1),Lt(w1),Dt(r.CULL_FACE),Wt(Is);function Dt(O){v[O]!==!0&&(r.enable(O),v[O]=!0)}function At(O){v[O]!==!1&&(r.disable(O),v[O]=!1)}function te(O,K){return M[O]!==K?(r.bindFramebuffer(O,K),M[O]=K,o&&(O===r.DRAW_FRAMEBUFFER&&(M[r.FRAMEBUFFER]=K),O===r.FRAMEBUFFER&&(M[r.DRAW_FRAMEBUFFER]=K)),!0):!1}function rt(O,K){let $=T,Q=!1;if(O){$=b.get(K),$===void 0&&($=[],b.set(K,$));let St=O.textures;if($.length!==St.length||$[0]!==r.COLOR_ATTACHMENT0){for(let Nt=0,Jt=St.length;Nt<Jt;Nt++)$[Nt]=r.COLOR_ATTACHMENT0+Nt;$.length=St.length,Q=!0}}else $[0]!==r.BACK&&($[0]=r.BACK,Q=!0);if(Q)if(e.isWebGL2)r.drawBuffers($);else if(t.has("WEBGL_draw_buffers")===!0)t.get("WEBGL_draw_buffers").drawBuffersWEBGL($);else throw new Error("THREE.WebGLState: Usage of gl.drawBuffers() require WebGL2 or WEBGL_draw_buffers extension")}function an(O){return _!==O?(r.useProgram(O),_=O,!0):!1}let zt={[pa]:r.FUNC_ADD,[FN]:r.FUNC_SUBTRACT,[UN]:r.FUNC_REVERSE_SUBTRACT};if(o)zt[C1]=r.MIN,zt[P1]=r.MAX;else{let O=t.get("EXT_blend_minmax");O!==null&&(zt[C1]=O.MIN_EXT,zt[P1]=O.MAX_EXT)}let ne={[BN]:r.ZERO,[zN]:r.ONE,[GN]:r.SRC_COLOR,[rm]:r.SRC_ALPHA,[XN]:r.SRC_ALPHA_SATURATE,[HN]:r.DST_COLOR,[qN]:r.DST_ALPHA,[kN]:r.ONE_MINUS_SRC_COLOR,[im]:r.ONE_MINUS_SRC_ALPHA,[WN]:r.ONE_MINUS_DST_COLOR,[VN]:r.ONE_MINUS_DST_ALPHA,[YN]:r.CONSTANT_COLOR,[$N]:r.ONE_MINUS_CONSTANT_COLOR,[ZN]:r.CONSTANT_ALPHA,[JN]:r.ONE_MINUS_CONSTANT_ALPHA};function Wt(O,K,$,Q,St,Nt,Jt,Kt,Ee,de){if(O===Is){y===!0&&(At(r.BLEND),y=!1);return}if(y===!1&&(Dt(r.BLEND),y=!0),O!==DN){if(O!==A||de!==W){if((S!==pa||z!==pa)&&(r.blendEquation(r.FUNC_ADD),S=pa,z=pa),de)switch(O){case xu:r.blendFuncSeparate(r.ONE,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case b1:r.blendFunc(r.ONE,r.ONE);break;case T1:r.blendFuncSeparate(r.ZERO,r.ONE_MINUS_SRC_COLOR,r.ZERO,r.ONE);break;case A1:r.blendFuncSeparate(r.ZERO,r.SRC_COLOR,r.ZERO,r.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",O);break}else switch(O){case xu:r.blendFuncSeparate(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case b1:r.blendFunc(r.SRC_ALPHA,r.ONE);break;case T1:r.blendFuncSeparate(r.ZERO,r.ONE_MINUS_SRC_COLOR,r.ZERO,r.ONE);break;case A1:r.blendFunc(r.ZERO,r.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",O);break}L=null,G=null,F=null,I=null,ut.set(0,0,0),R=0,A=O,W=de}return}St=St||K,Nt=Nt||$,Jt=Jt||Q,(K!==S||St!==z)&&(r.blendEquationSeparate(zt[K],zt[St]),S=K,z=St),($!==L||Q!==G||Nt!==F||Jt!==I)&&(r.blendFuncSeparate(ne[$],ne[Q],ne[Nt],ne[Jt]),L=$,G=Q,F=Nt,I=Jt),(Kt.equals(ut)===!1||Ee!==R)&&(r.blendColor(Kt.r,Kt.g,Kt.b,Ee),ut.copy(Kt),R=Ee),A=O,W=!1}function ie(O,K){O.side===is?At(r.CULL_FACE):Dt(r.CULL_FACE);let $=O.side===Ei;K&&($=!$),ce($),O.blending===xu&&O.transparent===!1?Wt(Is):Wt(O.blending,O.blendEquation,O.blendSrc,O.blendDst,O.blendEquationAlpha,O.blendSrcAlpha,O.blendDstAlpha,O.blendColor,O.blendAlpha,O.premultipliedAlpha),p.setFunc(O.depthFunc),p.setTest(O.depthTest),p.setMask(O.depthWrite),f.setMask(O.colorWrite);let Q=O.stencilWrite;d.setTest(Q),Q&&(d.setMask(O.stencilWriteMask),d.setFunc(O.stencilFunc,O.stencilRef,O.stencilFuncMask),d.setOp(O.stencilFail,O.stencilZFail,O.stencilZPass)),Y(O.polygonOffset,O.polygonOffsetFactor,O.polygonOffsetUnits),O.alphaToCoverage===!0?Dt(r.SAMPLE_ALPHA_TO_COVERAGE):At(r.SAMPLE_ALPHA_TO_COVERAGE)}function ce(O){V!==O&&(O?r.frontFace(r.CW):r.frontFace(r.CCW),V=O)}function Lt(O){O!==LN?(Dt(r.CULL_FACE),O!==Mt&&(O===w1?r.cullFace(r.BACK):O===NN?r.cullFace(r.FRONT):r.cullFace(r.FRONT_AND_BACK))):At(r.CULL_FACE),Mt=O}function se(O){O!==X&&(it&&r.lineWidth(O),X=O)}function Y(O,K,$){O?(Dt(r.POLYGON_OFFSET_FILL),(mt!==K||dt!==$)&&(r.polygonOffset(K,$),mt=K,dt=$)):At(r.POLYGON_OFFSET_FILL)}function N(O){O?Dt(r.SCISSOR_TEST):At(r.SCISSOR_TEST)}function xt(O){O===void 0&&(O=r.TEXTURE0+_t-1),bt!==O&&(r.activeTexture(O),bt=O)}function Et(O,K,$){$===void 0&&(bt===null?$=r.TEXTURE0+_t-1:$=bt);let Q=Tt[$];Q===void 0&&(Q={type:void 0,texture:void 0},Tt[$]=Q),(Q.type!==O||Q.texture!==K)&&(bt!==$&&(r.activeTexture($),bt=$),r.bindTexture(O,K||Ut[O]),Q.type=O,Q.texture=K)}function ot(){let O=Tt[bt];O!==void 0&&O.type!==void 0&&(r.bindTexture(O.type,null),O.type=void 0,O.texture=void 0)}function Pt(){try{r.compressedTexImage2D.apply(r,arguments)}catch(O){console.error("THREE.WebGLState:",O)}}function ue(){try{r.compressedTexImage3D.apply(r,arguments)}catch(O){console.error("THREE.WebGLState:",O)}}function Ct(){try{r.texSubImage2D.apply(r,arguments)}catch(O){console.error("THREE.WebGLState:",O)}}function Ot(){try{r.texSubImage3D.apply(r,arguments)}catch(O){console.error("THREE.WebGLState:",O)}}function kt(){try{r.compressedTexSubImage2D.apply(r,arguments)}catch(O){console.error("THREE.WebGLState:",O)}}function J(){try{r.compressedTexSubImage3D.apply(r,arguments)}catch(O){console.error("THREE.WebGLState:",O)}}function w(){try{r.texStorage2D.apply(r,arguments)}catch(O){console.error("THREE.WebGLState:",O)}}function P(){try{r.texStorage3D.apply(r,arguments)}catch(O){console.error("THREE.WebGLState:",O)}}function D(){try{r.texImage2D.apply(r,arguments)}catch(O){console.error("THREE.WebGLState:",O)}}function k(){try{r.texImage3D.apply(r,arguments)}catch(O){console.error("THREE.WebGLState:",O)}}function B(O){wt.equals(O)===!1&&(r.scissor(O.x,O.y,O.z,O.w),wt.copy(O))}function et(O){Bt.equals(O)===!1&&(r.viewport(O.x,O.y,O.z,O.w),Bt.copy(O))}function j(O,K){let $=x.get(K);$===void 0&&($=new WeakMap,x.set(K,$));let Q=$.get(O);Q===void 0&&(Q=r.getUniformBlockIndex(K,O.name),$.set(O,Q))}function ft(O,K){let Q=x.get(K).get(O);g.get(K)!==Q&&(r.uniformBlockBinding(K,Q,O.__bindingPointIndex),g.set(K,Q))}function ct(){r.disable(r.BLEND),r.disable(r.CULL_FACE),r.disable(r.DEPTH_TEST),r.disable(r.POLYGON_OFFSET_FILL),r.disable(r.SCISSOR_TEST),r.disable(r.STENCIL_TEST),r.disable(r.SAMPLE_ALPHA_TO_COVERAGE),r.blendEquation(r.FUNC_ADD),r.blendFunc(r.ONE,r.ZERO),r.blendFuncSeparate(r.ONE,r.ZERO,r.ONE,r.ZERO),r.blendColor(0,0,0,0),r.colorMask(!0,!0,!0,!0),r.clearColor(0,0,0,0),r.depthMask(!0),r.depthFunc(r.LESS),r.clearDepth(1),r.stencilMask(4294967295),r.stencilFunc(r.ALWAYS,0,4294967295),r.stencilOp(r.KEEP,r.KEEP,r.KEEP),r.clearStencil(0),r.cullFace(r.BACK),r.frontFace(r.CCW),r.polygonOffset(0,0),r.activeTexture(r.TEXTURE0),r.bindFramebuffer(r.FRAMEBUFFER,null),o===!0&&(r.bindFramebuffer(r.DRAW_FRAMEBUFFER,null),r.bindFramebuffer(r.READ_FRAMEBUFFER,null)),r.useProgram(null),r.lineWidth(1),r.scissor(0,0,r.canvas.width,r.canvas.height),r.viewport(0,0,r.canvas.width,r.canvas.height),v={},bt=null,Tt={},M={},b=new WeakMap,T=[],_=null,y=!1,A=null,S=null,L=null,G=null,z=null,F=null,I=null,ut=new vn(0,0,0),R=0,W=!1,V=null,Mt=null,X=null,mt=null,dt=null,wt.set(0,0,r.canvas.width,r.canvas.height),Bt.set(0,0,r.canvas.width,r.canvas.height),f.reset(),p.reset(),d.reset()}return{buffers:{color:f,depth:p,stencil:d},enable:Dt,disable:At,bindFramebuffer:te,drawBuffers:rt,useProgram:an,setBlending:Wt,setMaterial:ie,setFlipSided:ce,setCullFace:Lt,setLineWidth:se,setPolygonOffset:Y,setScissorTest:N,activeTexture:xt,bindTexture:Et,unbindTexture:ot,compressedTexImage2D:Pt,compressedTexImage3D:ue,texImage2D:D,texImage3D:k,updateUBOMapping:j,uniformBlockBinding:ft,texStorage2D:w,texStorage3D:P,texSubImage2D:Ct,texSubImage3D:Ot,compressedTexSubImage2D:kt,compressedTexSubImage3D:J,scissor:B,viewport:et,reset:ct}}function MU(r,t,e,o,a,l,h){let f=a.isWebGL2,p=t.has("WEBGL_multisampled_render_to_texture")?t.get("WEBGL_multisampled_render_to_texture"):null,d=typeof navigator=="undefined"?!1:/OculusBrowser/g.test(navigator.userAgent),g=new ye,x=new WeakMap,v,M=new WeakMap,b=!1;try{b=typeof OffscreenCanvas!="undefined"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch(Y){}function T(Y,N){return b?new OffscreenCanvas(Y,N):Lf("canvas")}function _(Y,N,xt,Et){let ot=1,Pt=se(Y);if((Pt.width>Et||Pt.height>Et)&&(ot=Et/Math.max(Pt.width,Pt.height)),ot<1||N===!0)if(typeof HTMLImageElement!="undefined"&&Y instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&Y instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&Y instanceof ImageBitmap||typeof VideoFrame!="undefined"&&Y instanceof VideoFrame){let ue=N?hm:Math.floor,Ct=ue(ot*Pt.width),Ot=ue(ot*Pt.height);v===void 0&&(v=T(Ct,Ot));let kt=xt?T(Ct,Ot):v;return kt.width=Ct,kt.height=Ot,kt.getContext("2d").drawImage(Y,0,0,Ct,Ot),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+Pt.width+"x"+Pt.height+") to ("+Ct+"x"+Ot+")."),kt}else return"data"in Y&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+Pt.width+"x"+Pt.height+")."),Y;return Y}function y(Y){let N=se(Y);return aE(N.width)&&aE(N.height)}function A(Y){return f?!1:Y.wrapS!==co||Y.wrapT!==co||Y.minFilter!==hi&&Y.minFilter!==_i}function S(Y,N){return Y.generateMipmaps&&N&&Y.minFilter!==hi&&Y.minFilter!==_i}function L(Y){r.generateMipmap(Y)}function G(Y,N,xt,Et,ot=!1){if(f===!1)return N;if(Y!==null){if(r[Y]!==void 0)return r[Y];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+Y+"'")}let Pt=N;if(N===r.RED&&(xt===r.FLOAT&&(Pt=r.R32F),xt===r.HALF_FLOAT&&(Pt=r.R16F),xt===r.UNSIGNED_BYTE&&(Pt=r.R8)),N===r.RED_INTEGER&&(xt===r.UNSIGNED_BYTE&&(Pt=r.R8UI),xt===r.UNSIGNED_SHORT&&(Pt=r.R16UI),xt===r.UNSIGNED_INT&&(Pt=r.R32UI),xt===r.BYTE&&(Pt=r.R8I),xt===r.SHORT&&(Pt=r.R16I),xt===r.INT&&(Pt=r.R32I)),N===r.RG&&(xt===r.FLOAT&&(Pt=r.RG32F),xt===r.HALF_FLOAT&&(Pt=r.RG16F),xt===r.UNSIGNED_BYTE&&(Pt=r.RG8)),N===r.RG_INTEGER&&(xt===r.UNSIGNED_BYTE&&(Pt=r.RG8UI),xt===r.UNSIGNED_SHORT&&(Pt=r.RG16UI),xt===r.UNSIGNED_INT&&(Pt=r.RG32UI),xt===r.BYTE&&(Pt=r.RG8I),xt===r.SHORT&&(Pt=r.RG16I),xt===r.INT&&(Pt=r.RG32I)),N===r.RGBA){let ue=ot?Cf:Cn.getTransfer(Et);xt===r.FLOAT&&(Pt=r.RGBA32F),xt===r.HALF_FLOAT&&(Pt=r.RGBA16F),xt===r.UNSIGNED_BYTE&&(Pt=ue===Un?r.SRGB8_ALPHA8:r.RGBA8),xt===r.UNSIGNED_SHORT_4_4_4_4&&(Pt=r.RGBA4),xt===r.UNSIGNED_SHORT_5_5_5_1&&(Pt=r.RGB5_A1)}return(Pt===r.R16F||Pt===r.R32F||Pt===r.RG16F||Pt===r.RG32F||Pt===r.RGBA16F||Pt===r.RGBA32F)&&t.get("EXT_color_buffer_float"),Pt}function z(Y,N,xt){return S(Y,xt)===!0||Y.isFramebufferTexture&&Y.minFilter!==hi&&Y.minFilter!==_i?Math.log2(Math.max(N.width,N.height))+1:Y.mipmaps!==void 0&&Y.mipmaps.length>0?Y.mipmaps.length:Y.isCompressedTexture&&Array.isArray(Y.image)?N.mipmaps.length:1}function F(Y){return Y===hi||Y===I1||Y===wl?r.NEAREST:r.LINEAR}function I(Y){let N=Y.target;N.removeEventListener("dispose",I),R(N),N.isVideoTexture&&x.delete(N)}function ut(Y){let N=Y.target;N.removeEventListener("dispose",ut),V(N)}function R(Y){let N=o.get(Y);if(N.__webglInit===void 0)return;let xt=Y.source,Et=M.get(xt);if(Et){let ot=Et[N.__cacheKey];ot.usedTimes--,ot.usedTimes===0&&W(Y),Object.keys(Et).length===0&&M.delete(xt)}o.remove(Y)}function W(Y){let N=o.get(Y);r.deleteTexture(N.__webglTexture);let xt=Y.source,Et=M.get(xt);delete Et[N.__cacheKey],h.memory.textures--}function V(Y){let N=o.get(Y);if(Y.depthTexture&&Y.depthTexture.dispose(),Y.isWebGLCubeRenderTarget)for(let Et=0;Et<6;Et++){if(Array.isArray(N.__webglFramebuffer[Et]))for(let ot=0;ot<N.__webglFramebuffer[Et].length;ot++)r.deleteFramebuffer(N.__webglFramebuffer[Et][ot]);else r.deleteFramebuffer(N.__webglFramebuffer[Et]);N.__webglDepthbuffer&&r.deleteRenderbuffer(N.__webglDepthbuffer[Et])}else{if(Array.isArray(N.__webglFramebuffer))for(let Et=0;Et<N.__webglFramebuffer.length;Et++)r.deleteFramebuffer(N.__webglFramebuffer[Et]);else r.deleteFramebuffer(N.__webglFramebuffer);if(N.__webglDepthbuffer&&r.deleteRenderbuffer(N.__webglDepthbuffer),N.__webglMultisampledFramebuffer&&r.deleteFramebuffer(N.__webglMultisampledFramebuffer),N.__webglColorRenderbuffer)for(let Et=0;Et<N.__webglColorRenderbuffer.length;Et++)N.__webglColorRenderbuffer[Et]&&r.deleteRenderbuffer(N.__webglColorRenderbuffer[Et]);N.__webglDepthRenderbuffer&&r.deleteRenderbuffer(N.__webglDepthRenderbuffer)}let xt=Y.textures;for(let Et=0,ot=xt.length;Et<ot;Et++){let Pt=o.get(xt[Et]);Pt.__webglTexture&&(r.deleteTexture(Pt.__webglTexture),h.memory.textures--),o.remove(xt[Et])}o.remove(Y)}let Mt=0;function X(){Mt=0}function mt(){let Y=Mt;return Y>=a.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+Y+" texture units while this GPU supports only "+a.maxTextures),Mt+=1,Y}function dt(Y){let N=[];return N.push(Y.wrapS),N.push(Y.wrapT),N.push(Y.wrapR||0),N.push(Y.magFilter),N.push(Y.minFilter),N.push(Y.anisotropy),N.push(Y.internalFormat),N.push(Y.format),N.push(Y.type),N.push(Y.generateMipmaps),N.push(Y.premultiplyAlpha),N.push(Y.flipY),N.push(Y.unpackAlignment),N.push(Y.colorSpace),N.join()}function _t(Y,N){let xt=o.get(Y);if(Y.isVideoTexture&&ce(Y),Y.isRenderTargetTexture===!1&&Y.version>0&&xt.__version!==Y.version){let Et=Y.image;if(Et===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(Et.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{Bt(xt,Y,N);return}}e.bindTexture(r.TEXTURE_2D,xt.__webglTexture,r.TEXTURE0+N)}function it(Y,N){let xt=o.get(Y);if(Y.version>0&&xt.__version!==Y.version){Bt(xt,Y,N);return}e.bindTexture(r.TEXTURE_2D_ARRAY,xt.__webglTexture,r.TEXTURE0+N)}function lt(Y,N){let xt=o.get(Y);if(Y.version>0&&xt.__version!==Y.version){Bt(xt,Y,N);return}e.bindTexture(r.TEXTURE_3D,xt.__webglTexture,r.TEXTURE0+N)}function H(Y,N){let xt=o.get(Y);if(Y.version>0&&xt.__version!==Y.version){$t(xt,Y,N);return}e.bindTexture(r.TEXTURE_CUBE_MAP,xt.__webglTexture,r.TEXTURE0+N)}let bt={[am]:r.REPEAT,[co]:r.CLAMP_TO_EDGE,[um]:r.MIRRORED_REPEAT},Tt={[hi]:r.NEAREST,[I1]:r.NEAREST_MIPMAP_NEAREST,[wl]:r.NEAREST_MIPMAP_LINEAR,[_i]:r.LINEAR,[Sd]:r.LINEAR_MIPMAP_NEAREST,[ma]:r.LINEAR_MIPMAP_LINEAR},Yt={[b2]:r.NEVER,[R2]:r.ALWAYS,[T2]:r.LESS,[oM]:r.LEQUAL,[A2]:r.EQUAL,[I2]:r.GEQUAL,[C2]:r.GREATER,[P2]:r.NOTEQUAL};function tt(Y,N,xt){if(N.type===os&&t.has("OES_texture_float_linear")===!1&&(N.magFilter===_i||N.magFilter===Sd||N.magFilter===wl||N.magFilter===ma||N.minFilter===_i||N.minFilter===Sd||N.minFilter===wl||N.minFilter===ma)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),xt?(r.texParameteri(Y,r.TEXTURE_WRAP_S,bt[N.wrapS]),r.texParameteri(Y,r.TEXTURE_WRAP_T,bt[N.wrapT]),(Y===r.TEXTURE_3D||Y===r.TEXTURE_2D_ARRAY)&&r.texParameteri(Y,r.TEXTURE_WRAP_R,bt[N.wrapR]),r.texParameteri(Y,r.TEXTURE_MAG_FILTER,Tt[N.magFilter]),r.texParameteri(Y,r.TEXTURE_MIN_FILTER,Tt[N.minFilter])):(r.texParameteri(Y,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(Y,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),(Y===r.TEXTURE_3D||Y===r.TEXTURE_2D_ARRAY)&&r.texParameteri(Y,r.TEXTURE_WRAP_R,r.CLAMP_TO_EDGE),(N.wrapS!==co||N.wrapT!==co)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),r.texParameteri(Y,r.TEXTURE_MAG_FILTER,F(N.magFilter)),r.texParameteri(Y,r.TEXTURE_MIN_FILTER,F(N.minFilter)),N.minFilter!==hi&&N.minFilter!==_i&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),N.compareFunction&&(r.texParameteri(Y,r.TEXTURE_COMPARE_MODE,r.COMPARE_REF_TO_TEXTURE),r.texParameteri(Y,r.TEXTURE_COMPARE_FUNC,Yt[N.compareFunction])),t.has("EXT_texture_filter_anisotropic")===!0){if(N.magFilter===hi||N.minFilter!==wl&&N.minFilter!==ma||N.type===os&&t.has("OES_texture_float_linear")===!1||f===!1&&N.type===Nl&&t.has("OES_texture_half_float_linear")===!1)return;if(N.anisotropy>1||o.get(N).__currentAnisotropy){let Et=t.get("EXT_texture_filter_anisotropic");r.texParameterf(Y,Et.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(N.anisotropy,a.getMaxAnisotropy())),o.get(N).__currentAnisotropy=N.anisotropy}}}function wt(Y,N){let xt=!1;Y.__webglInit===void 0&&(Y.__webglInit=!0,N.addEventListener("dispose",I));let Et=N.source,ot=M.get(Et);ot===void 0&&(ot={},M.set(Et,ot));let Pt=dt(N);if(Pt!==Y.__cacheKey){ot[Pt]===void 0&&(ot[Pt]={texture:r.createTexture(),usedTimes:0},h.memory.textures++,xt=!0),ot[Pt].usedTimes++;let ue=ot[Y.__cacheKey];ue!==void 0&&(ot[Y.__cacheKey].usedTimes--,ue.usedTimes===0&&W(N)),Y.__cacheKey=Pt,Y.__webglTexture=ot[Pt].texture}return xt}function Bt(Y,N,xt){let Et=r.TEXTURE_2D;(N.isDataArrayTexture||N.isCompressedArrayTexture)&&(Et=r.TEXTURE_2D_ARRAY),N.isData3DTexture&&(Et=r.TEXTURE_3D);let ot=wt(Y,N),Pt=N.source;e.bindTexture(Et,Y.__webglTexture,r.TEXTURE0+xt);let ue=o.get(Pt);if(Pt.version!==ue.__version||ot===!0){e.activeTexture(r.TEXTURE0+xt);let Ct=Cn.getPrimaries(Cn.workingColorSpace),Ot=N.colorSpace===Cs?null:Cn.getPrimaries(N.colorSpace),kt=N.colorSpace===Cs||Ct===Ot?r.NONE:r.BROWSER_DEFAULT_WEBGL;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,N.flipY),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,N.premultiplyAlpha),r.pixelStorei(r.UNPACK_ALIGNMENT,N.unpackAlignment),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,kt);let J=A(N)&&y(N.image)===!1,w=_(N.image,J,!1,a.maxTextureSize);w=Lt(N,w);let P=y(w)||f,D=l.convert(N.format,N.colorSpace),k=l.convert(N.type),B=G(N.internalFormat,D,k,N.colorSpace,N.isVideoTexture);tt(Et,N,P);let et,j=N.mipmaps,ft=f&&N.isVideoTexture!==!0&&B!==iM,ct=ue.__version===void 0||ot===!0,O=Pt.dataReady,K=z(N,w,P);if(N.isDepthTexture)B=r.DEPTH_COMPONENT,f?N.type===os?B=r.DEPTH_COMPONENT32F:N.type===Ps?B=r.DEPTH_COMPONENT24:N.type===ya?B=r.DEPTH24_STENCIL8:B=r.DEPTH_COMPONENT16:N.type===os&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),N.format===va&&B===r.DEPTH_COMPONENT&&N.type!==Xm&&N.type!==Ps&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),N.type=Ps,k=l.convert(N.type)),N.format===bu&&B===r.DEPTH_COMPONENT&&(B=r.DEPTH_STENCIL,N.type!==ya&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),N.type=ya,k=l.convert(N.type))),ct&&(ft?e.texStorage2D(r.TEXTURE_2D,1,B,w.width,w.height):e.texImage2D(r.TEXTURE_2D,0,B,w.width,w.height,0,D,k,null));else if(N.isDataTexture)if(j.length>0&&P){ft&&ct&&e.texStorage2D(r.TEXTURE_2D,K,B,j[0].width,j[0].height);for(let $=0,Q=j.length;$<Q;$++)et=j[$],ft?O&&e.texSubImage2D(r.TEXTURE_2D,$,0,0,et.width,et.height,D,k,et.data):e.texImage2D(r.TEXTURE_2D,$,B,et.width,et.height,0,D,k,et.data);N.generateMipmaps=!1}else ft?(ct&&e.texStorage2D(r.TEXTURE_2D,K,B,w.width,w.height),O&&e.texSubImage2D(r.TEXTURE_2D,0,0,0,w.width,w.height,D,k,w.data)):e.texImage2D(r.TEXTURE_2D,0,B,w.width,w.height,0,D,k,w.data);else if(N.isCompressedTexture)if(N.isCompressedArrayTexture){ft&&ct&&e.texStorage3D(r.TEXTURE_2D_ARRAY,K,B,j[0].width,j[0].height,w.depth);for(let $=0,Q=j.length;$<Q;$++)et=j[$],N.format!==fo?D!==null?ft?O&&e.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,$,0,0,0,et.width,et.height,w.depth,D,et.data,0,0):e.compressedTexImage3D(r.TEXTURE_2D_ARRAY,$,B,et.width,et.height,w.depth,0,et.data,0,0):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):ft?O&&e.texSubImage3D(r.TEXTURE_2D_ARRAY,$,0,0,0,et.width,et.height,w.depth,D,k,et.data):e.texImage3D(r.TEXTURE_2D_ARRAY,$,B,et.width,et.height,w.depth,0,D,k,et.data)}else{ft&&ct&&e.texStorage2D(r.TEXTURE_2D,K,B,j[0].width,j[0].height);for(let $=0,Q=j.length;$<Q;$++)et=j[$],N.format!==fo?D!==null?ft?O&&e.compressedTexSubImage2D(r.TEXTURE_2D,$,0,0,et.width,et.height,D,et.data):e.compressedTexImage2D(r.TEXTURE_2D,$,B,et.width,et.height,0,et.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):ft?O&&e.texSubImage2D(r.TEXTURE_2D,$,0,0,et.width,et.height,D,k,et.data):e.texImage2D(r.TEXTURE_2D,$,B,et.width,et.height,0,D,k,et.data)}else if(N.isDataArrayTexture)ft?(ct&&e.texStorage3D(r.TEXTURE_2D_ARRAY,K,B,w.width,w.height,w.depth),O&&e.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,0,w.width,w.height,w.depth,D,k,w.data)):e.texImage3D(r.TEXTURE_2D_ARRAY,0,B,w.width,w.height,w.depth,0,D,k,w.data);else if(N.isData3DTexture)ft?(ct&&e.texStorage3D(r.TEXTURE_3D,K,B,w.width,w.height,w.depth),O&&e.texSubImage3D(r.TEXTURE_3D,0,0,0,0,w.width,w.height,w.depth,D,k,w.data)):e.texImage3D(r.TEXTURE_3D,0,B,w.width,w.height,w.depth,0,D,k,w.data);else if(N.isFramebufferTexture){if(ct)if(ft)e.texStorage2D(r.TEXTURE_2D,K,B,w.width,w.height);else{let $=w.width,Q=w.height;for(let St=0;St<K;St++)e.texImage2D(r.TEXTURE_2D,St,B,$,Q,0,D,k,null),$>>=1,Q>>=1}}else if(j.length>0&&P){if(ft&&ct){let $=se(j[0]);e.texStorage2D(r.TEXTURE_2D,K,B,$.width,$.height)}for(let $=0,Q=j.length;$<Q;$++)et=j[$],ft?O&&e.texSubImage2D(r.TEXTURE_2D,$,0,0,D,k,et):e.texImage2D(r.TEXTURE_2D,$,B,D,k,et);N.generateMipmaps=!1}else if(ft){if(ct){let $=se(w);e.texStorage2D(r.TEXTURE_2D,K,B,$.width,$.height)}O&&e.texSubImage2D(r.TEXTURE_2D,0,0,0,D,k,w)}else e.texImage2D(r.TEXTURE_2D,0,B,D,k,w);S(N,P)&&L(Et),ue.__version=Pt.version,N.onUpdate&&N.onUpdate(N)}Y.__version=N.version}function $t(Y,N,xt){if(N.image.length!==6)return;let Et=wt(Y,N),ot=N.source;e.bindTexture(r.TEXTURE_CUBE_MAP,Y.__webglTexture,r.TEXTURE0+xt);let Pt=o.get(ot);if(ot.version!==Pt.__version||Et===!0){e.activeTexture(r.TEXTURE0+xt);let ue=Cn.getPrimaries(Cn.workingColorSpace),Ct=N.colorSpace===Cs?null:Cn.getPrimaries(N.colorSpace),Ot=N.colorSpace===Cs||ue===Ct?r.NONE:r.BROWSER_DEFAULT_WEBGL;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,N.flipY),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,N.premultiplyAlpha),r.pixelStorei(r.UNPACK_ALIGNMENT,N.unpackAlignment),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,Ot);let kt=N.isCompressedTexture||N.image[0].isCompressedTexture,J=N.image[0]&&N.image[0].isDataTexture,w=[];for(let $=0;$<6;$++)!kt&&!J?w[$]=_(N.image[$],!1,!0,a.maxCubemapSize):w[$]=J?N.image[$].image:N.image[$],w[$]=Lt(N,w[$]);let P=w[0],D=y(P)||f,k=l.convert(N.format,N.colorSpace),B=l.convert(N.type),et=G(N.internalFormat,k,B,N.colorSpace),j=f&&N.isVideoTexture!==!0,ft=Pt.__version===void 0||Et===!0,ct=ot.dataReady,O=z(N,P,D);tt(r.TEXTURE_CUBE_MAP,N,D);let K;if(kt){j&&ft&&e.texStorage2D(r.TEXTURE_CUBE_MAP,O,et,P.width,P.height);for(let $=0;$<6;$++){K=w[$].mipmaps;for(let Q=0;Q<K.length;Q++){let St=K[Q];N.format!==fo?k!==null?j?ct&&e.compressedTexSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+$,Q,0,0,St.width,St.height,k,St.data):e.compressedTexImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+$,Q,et,St.width,St.height,0,St.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):j?ct&&e.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+$,Q,0,0,St.width,St.height,k,B,St.data):e.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+$,Q,et,St.width,St.height,0,k,B,St.data)}}}else{if(K=N.mipmaps,j&&ft){K.length>0&&O++;let $=se(w[0]);e.texStorage2D(r.TEXTURE_CUBE_MAP,O,et,$.width,$.height)}for(let $=0;$<6;$++)if(J){j?ct&&e.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+$,0,0,0,w[$].width,w[$].height,k,B,w[$].data):e.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+$,0,et,w[$].width,w[$].height,0,k,B,w[$].data);for(let Q=0;Q<K.length;Q++){let Nt=K[Q].image[$].image;j?ct&&e.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+$,Q+1,0,0,Nt.width,Nt.height,k,B,Nt.data):e.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+$,Q+1,et,Nt.width,Nt.height,0,k,B,Nt.data)}}else{j?ct&&e.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+$,0,0,0,k,B,w[$]):e.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+$,0,et,k,B,w[$]);for(let Q=0;Q<K.length;Q++){let St=K[Q];j?ct&&e.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+$,Q+1,0,0,k,B,St.image[$]):e.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+$,Q+1,et,k,B,St.image[$])}}}S(N,D)&&L(r.TEXTURE_CUBE_MAP),Pt.__version=ot.version,N.onUpdate&&N.onUpdate(N)}Y.__version=N.version}function Ut(Y,N,xt,Et,ot,Pt){let ue=l.convert(xt.format,xt.colorSpace),Ct=l.convert(xt.type),Ot=G(xt.internalFormat,ue,Ct,xt.colorSpace);if(!o.get(N).__hasExternalTextures){let J=Math.max(1,N.width>>Pt),w=Math.max(1,N.height>>Pt);ot===r.TEXTURE_3D||ot===r.TEXTURE_2D_ARRAY?e.texImage3D(ot,Pt,Ot,J,w,N.depth,0,ue,Ct,null):e.texImage2D(ot,Pt,Ot,J,w,0,ue,Ct,null)}e.bindFramebuffer(r.FRAMEBUFFER,Y),ie(N)?p.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,Et,ot,o.get(xt).__webglTexture,0,Wt(N)):(ot===r.TEXTURE_2D||ot>=r.TEXTURE_CUBE_MAP_POSITIVE_X&&ot<=r.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&r.framebufferTexture2D(r.FRAMEBUFFER,Et,ot,o.get(xt).__webglTexture,Pt),e.bindFramebuffer(r.FRAMEBUFFER,null)}function Dt(Y,N,xt){if(r.bindRenderbuffer(r.RENDERBUFFER,Y),N.depthBuffer&&!N.stencilBuffer){let Et=f===!0?r.DEPTH_COMPONENT24:r.DEPTH_COMPONENT16;if(xt||ie(N)){let ot=N.depthTexture;ot&&ot.isDepthTexture&&(ot.type===os?Et=r.DEPTH_COMPONENT32F:ot.type===Ps&&(Et=r.DEPTH_COMPONENT24));let Pt=Wt(N);ie(N)?p.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,Pt,Et,N.width,N.height):r.renderbufferStorageMultisample(r.RENDERBUFFER,Pt,Et,N.width,N.height)}else r.renderbufferStorage(r.RENDERBUFFER,Et,N.width,N.height);r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.RENDERBUFFER,Y)}else if(N.depthBuffer&&N.stencilBuffer){let Et=Wt(N);xt&&ie(N)===!1?r.renderbufferStorageMultisample(r.RENDERBUFFER,Et,r.DEPTH24_STENCIL8,N.width,N.height):ie(N)?p.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,Et,r.DEPTH24_STENCIL8,N.width,N.height):r.renderbufferStorage(r.RENDERBUFFER,r.DEPTH_STENCIL,N.width,N.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.RENDERBUFFER,Y)}else{let Et=N.textures;for(let ot=0;ot<Et.length;ot++){let Pt=Et[ot],ue=l.convert(Pt.format,Pt.colorSpace),Ct=l.convert(Pt.type),Ot=G(Pt.internalFormat,ue,Ct,Pt.colorSpace),kt=Wt(N);xt&&ie(N)===!1?r.renderbufferStorageMultisample(r.RENDERBUFFER,kt,Ot,N.width,N.height):ie(N)?p.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,kt,Ot,N.width,N.height):r.renderbufferStorage(r.RENDERBUFFER,Ot,N.width,N.height)}}r.bindRenderbuffer(r.RENDERBUFFER,null)}function At(Y,N){if(N&&N.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(e.bindFramebuffer(r.FRAMEBUFFER,Y),!(N.depthTexture&&N.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!o.get(N.depthTexture).__webglTexture||N.depthTexture.image.width!==N.width||N.depthTexture.image.height!==N.height)&&(N.depthTexture.image.width=N.width,N.depthTexture.image.height=N.height,N.depthTexture.needsUpdate=!0),_t(N.depthTexture,0);let Et=o.get(N.depthTexture).__webglTexture,ot=Wt(N);if(N.depthTexture.format===va)ie(N)?p.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.TEXTURE_2D,Et,0,ot):r.framebufferTexture2D(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.TEXTURE_2D,Et,0);else if(N.depthTexture.format===bu)ie(N)?p.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.TEXTURE_2D,Et,0,ot):r.framebufferTexture2D(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.TEXTURE_2D,Et,0);else throw new Error("Unknown depthTexture format")}function te(Y){let N=o.get(Y),xt=Y.isWebGLCubeRenderTarget===!0;if(Y.depthTexture&&!N.__autoAllocateDepthBuffer){if(xt)throw new Error("target.depthTexture not supported in Cube render targets");At(N.__webglFramebuffer,Y)}else if(xt){N.__webglDepthbuffer=[];for(let Et=0;Et<6;Et++)e.bindFramebuffer(r.FRAMEBUFFER,N.__webglFramebuffer[Et]),N.__webglDepthbuffer[Et]=r.createRenderbuffer(),Dt(N.__webglDepthbuffer[Et],Y,!1)}else e.bindFramebuffer(r.FRAMEBUFFER,N.__webglFramebuffer),N.__webglDepthbuffer=r.createRenderbuffer(),Dt(N.__webglDepthbuffer,Y,!1);e.bindFramebuffer(r.FRAMEBUFFER,null)}function rt(Y,N,xt){let Et=o.get(Y);N!==void 0&&Ut(Et.__webglFramebuffer,Y,Y.texture,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,0),xt!==void 0&&te(Y)}function an(Y){let N=Y.texture,xt=o.get(Y),Et=o.get(N);Y.addEventListener("dispose",ut);let ot=Y.textures,Pt=Y.isWebGLCubeRenderTarget===!0,ue=ot.length>1,Ct=y(Y)||f;if(ue||(Et.__webglTexture===void 0&&(Et.__webglTexture=r.createTexture()),Et.__version=N.version,h.memory.textures++),Pt){xt.__webglFramebuffer=[];for(let Ot=0;Ot<6;Ot++)if(f&&N.mipmaps&&N.mipmaps.length>0){xt.__webglFramebuffer[Ot]=[];for(let kt=0;kt<N.mipmaps.length;kt++)xt.__webglFramebuffer[Ot][kt]=r.createFramebuffer()}else xt.__webglFramebuffer[Ot]=r.createFramebuffer()}else{if(f&&N.mipmaps&&N.mipmaps.length>0){xt.__webglFramebuffer=[];for(let Ot=0;Ot<N.mipmaps.length;Ot++)xt.__webglFramebuffer[Ot]=r.createFramebuffer()}else xt.__webglFramebuffer=r.createFramebuffer();if(ue)if(a.drawBuffers)for(let Ot=0,kt=ot.length;Ot<kt;Ot++){let J=o.get(ot[Ot]);J.__webglTexture===void 0&&(J.__webglTexture=r.createTexture(),h.memory.textures++)}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");if(f&&Y.samples>0&&ie(Y)===!1){xt.__webglMultisampledFramebuffer=r.createFramebuffer(),xt.__webglColorRenderbuffer=[],e.bindFramebuffer(r.FRAMEBUFFER,xt.__webglMultisampledFramebuffer);for(let Ot=0;Ot<ot.length;Ot++){let kt=ot[Ot];xt.__webglColorRenderbuffer[Ot]=r.createRenderbuffer(),r.bindRenderbuffer(r.RENDERBUFFER,xt.__webglColorRenderbuffer[Ot]);let J=l.convert(kt.format,kt.colorSpace),w=l.convert(kt.type),P=G(kt.internalFormat,J,w,kt.colorSpace,Y.isXRRenderTarget===!0),D=Wt(Y);r.renderbufferStorageMultisample(r.RENDERBUFFER,D,P,Y.width,Y.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+Ot,r.RENDERBUFFER,xt.__webglColorRenderbuffer[Ot])}r.bindRenderbuffer(r.RENDERBUFFER,null),Y.depthBuffer&&(xt.__webglDepthRenderbuffer=r.createRenderbuffer(),Dt(xt.__webglDepthRenderbuffer,Y,!0)),e.bindFramebuffer(r.FRAMEBUFFER,null)}}if(Pt){e.bindTexture(r.TEXTURE_CUBE_MAP,Et.__webglTexture),tt(r.TEXTURE_CUBE_MAP,N,Ct);for(let Ot=0;Ot<6;Ot++)if(f&&N.mipmaps&&N.mipmaps.length>0)for(let kt=0;kt<N.mipmaps.length;kt++)Ut(xt.__webglFramebuffer[Ot][kt],Y,N,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+Ot,kt);else Ut(xt.__webglFramebuffer[Ot],Y,N,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+Ot,0);S(N,Ct)&&L(r.TEXTURE_CUBE_MAP),e.unbindTexture()}else if(ue){for(let Ot=0,kt=ot.length;Ot<kt;Ot++){let J=ot[Ot],w=o.get(J);e.bindTexture(r.TEXTURE_2D,w.__webglTexture),tt(r.TEXTURE_2D,J,Ct),Ut(xt.__webglFramebuffer,Y,J,r.COLOR_ATTACHMENT0+Ot,r.TEXTURE_2D,0),S(J,Ct)&&L(r.TEXTURE_2D)}e.unbindTexture()}else{let Ot=r.TEXTURE_2D;if((Y.isWebGL3DRenderTarget||Y.isWebGLArrayRenderTarget)&&(f?Ot=Y.isWebGL3DRenderTarget?r.TEXTURE_3D:r.TEXTURE_2D_ARRAY:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),e.bindTexture(Ot,Et.__webglTexture),tt(Ot,N,Ct),f&&N.mipmaps&&N.mipmaps.length>0)for(let kt=0;kt<N.mipmaps.length;kt++)Ut(xt.__webglFramebuffer[kt],Y,N,r.COLOR_ATTACHMENT0,Ot,kt);else Ut(xt.__webglFramebuffer,Y,N,r.COLOR_ATTACHMENT0,Ot,0);S(N,Ct)&&L(Ot),e.unbindTexture()}Y.depthBuffer&&te(Y)}function zt(Y){let N=y(Y)||f,xt=Y.textures;for(let Et=0,ot=xt.length;Et<ot;Et++){let Pt=xt[Et];if(S(Pt,N)){let ue=Y.isWebGLCubeRenderTarget?r.TEXTURE_CUBE_MAP:r.TEXTURE_2D,Ct=o.get(Pt).__webglTexture;e.bindTexture(ue,Ct),L(ue),e.unbindTexture()}}}function ne(Y){if(f&&Y.samples>0&&ie(Y)===!1){let N=Y.textures,xt=Y.width,Et=Y.height,ot=r.COLOR_BUFFER_BIT,Pt=[],ue=Y.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,Ct=o.get(Y),Ot=N.length>1;if(Ot)for(let kt=0;kt<N.length;kt++)e.bindFramebuffer(r.FRAMEBUFFER,Ct.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+kt,r.RENDERBUFFER,null),e.bindFramebuffer(r.FRAMEBUFFER,Ct.__webglFramebuffer),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0+kt,r.TEXTURE_2D,null,0);e.bindFramebuffer(r.READ_FRAMEBUFFER,Ct.__webglMultisampledFramebuffer),e.bindFramebuffer(r.DRAW_FRAMEBUFFER,Ct.__webglFramebuffer);for(let kt=0;kt<N.length;kt++){Pt.push(r.COLOR_ATTACHMENT0+kt),Y.depthBuffer&&Pt.push(ue);let J=Ct.__ignoreDepthValues!==void 0?Ct.__ignoreDepthValues:!1;if(J===!1&&(Y.depthBuffer&&(ot|=r.DEPTH_BUFFER_BIT),Y.stencilBuffer&&(ot|=r.STENCIL_BUFFER_BIT)),Ot&&r.framebufferRenderbuffer(r.READ_FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.RENDERBUFFER,Ct.__webglColorRenderbuffer[kt]),J===!0&&(r.invalidateFramebuffer(r.READ_FRAMEBUFFER,[ue]),r.invalidateFramebuffer(r.DRAW_FRAMEBUFFER,[ue])),Ot){let w=o.get(N[kt]).__webglTexture;r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,w,0)}r.blitFramebuffer(0,0,xt,Et,0,0,xt,Et,ot,r.NEAREST),d&&r.invalidateFramebuffer(r.READ_FRAMEBUFFER,Pt)}if(e.bindFramebuffer(r.READ_FRAMEBUFFER,null),e.bindFramebuffer(r.DRAW_FRAMEBUFFER,null),Ot)for(let kt=0;kt<N.length;kt++){e.bindFramebuffer(r.FRAMEBUFFER,Ct.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+kt,r.RENDERBUFFER,Ct.__webglColorRenderbuffer[kt]);let J=o.get(N[kt]).__webglTexture;e.bindFramebuffer(r.FRAMEBUFFER,Ct.__webglFramebuffer),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0+kt,r.TEXTURE_2D,J,0)}e.bindFramebuffer(r.DRAW_FRAMEBUFFER,Ct.__webglMultisampledFramebuffer)}}function Wt(Y){return Math.min(a.maxSamples,Y.samples)}function ie(Y){let N=o.get(Y);return f&&Y.samples>0&&t.has("WEBGL_multisampled_render_to_texture")===!0&&N.__useRenderToTexture!==!1}function ce(Y){let N=h.render.frame;x.get(Y)!==N&&(x.set(Y,N),Y.update())}function Lt(Y,N){let xt=Y.colorSpace,Et=Y.format,ot=Y.type;return Y.isCompressedTexture===!0||Y.isVideoTexture===!0||Y.format===cm||xt!==Bs&&xt!==Cs&&(Cn.getTransfer(xt)===Un?f===!1?t.has("EXT_sRGB")===!0&&Et===fo?(Y.format=cm,Y.minFilter=_i,Y.generateMipmaps=!1):N=Nf.sRGBToLinear(N):(Et!==fo||ot!==Ls)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",xt)),N}function se(Y){return typeof HTMLImageElement!="undefined"&&Y instanceof HTMLImageElement?(g.width=Y.naturalWidth||Y.width,g.height=Y.naturalHeight||Y.height):typeof VideoFrame!="undefined"&&Y instanceof VideoFrame?(g.width=Y.displayWidth,g.height=Y.displayHeight):(g.width=Y.width,g.height=Y.height),g}this.allocateTextureUnit=mt,this.resetTextureUnits=X,this.setTexture2D=_t,this.setTexture2DArray=it,this.setTexture3D=lt,this.setTextureCube=H,this.rebindTextures=rt,this.setupRenderTarget=an,this.updateRenderTargetMipmap=zt,this.updateMultisampleRenderTarget=ne,this.setupDepthRenderbuffer=te,this.setupFrameBufferTexture=Ut,this.useMultisampledRTT=ie}function SU(r,t,e){let o=e.isWebGL2;function a(l,h=Cs){let f,p=Cn.getTransfer(h);if(l===Ls)return r.UNSIGNED_BYTE;if(l===QE)return r.UNSIGNED_SHORT_4_4_4_4;if(l===tM)return r.UNSIGNED_SHORT_5_5_5_1;if(l===p2)return r.BYTE;if(l===d2)return r.SHORT;if(l===Xm)return r.UNSIGNED_SHORT;if(l===jE)return r.INT;if(l===Ps)return r.UNSIGNED_INT;if(l===os)return r.FLOAT;if(l===Nl)return o?r.HALF_FLOAT:(f=t.get("OES_texture_half_float"),f!==null?f.HALF_FLOAT_OES:null);if(l===m2)return r.ALPHA;if(l===fo)return r.RGBA;if(l===g2)return r.LUMINANCE;if(l===y2)return r.LUMINANCE_ALPHA;if(l===va)return r.DEPTH_COMPONENT;if(l===bu)return r.DEPTH_STENCIL;if(l===cm)return f=t.get("EXT_sRGB"),f!==null?f.SRGB_ALPHA_EXT:null;if(l===v2)return r.RED;if(l===eM)return r.RED_INTEGER;if(l===_2)return r.RG;if(l===nM)return r.RG_INTEGER;if(l===rM)return r.RGBA_INTEGER;if(l===wd||l===bd||l===Td||l===Ad)if(p===Un)if(f=t.get("WEBGL_compressed_texture_s3tc_srgb"),f!==null){if(l===wd)return f.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(l===bd)return f.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(l===Td)return f.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(l===Ad)return f.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(f=t.get("WEBGL_compressed_texture_s3tc"),f!==null){if(l===wd)return f.COMPRESSED_RGB_S3TC_DXT1_EXT;if(l===bd)return f.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(l===Td)return f.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(l===Ad)return f.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(l===R1||l===L1||l===N1||l===O1)if(f=t.get("WEBGL_compressed_texture_pvrtc"),f!==null){if(l===R1)return f.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(l===L1)return f.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(l===N1)return f.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(l===O1)return f.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(l===iM)return f=t.get("WEBGL_compressed_texture_etc1"),f!==null?f.COMPRESSED_RGB_ETC1_WEBGL:null;if(l===D1||l===F1)if(f=t.get("WEBGL_compressed_texture_etc"),f!==null){if(l===D1)return p===Un?f.COMPRESSED_SRGB8_ETC2:f.COMPRESSED_RGB8_ETC2;if(l===F1)return p===Un?f.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:f.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(l===U1||l===B1||l===z1||l===G1||l===k1||l===q1||l===V1||l===H1||l===W1||l===X1||l===Y1||l===$1||l===Z1||l===J1)if(f=t.get("WEBGL_compressed_texture_astc"),f!==null){if(l===U1)return p===Un?f.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:f.COMPRESSED_RGBA_ASTC_4x4_KHR;if(l===B1)return p===Un?f.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:f.COMPRESSED_RGBA_ASTC_5x4_KHR;if(l===z1)return p===Un?f.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:f.COMPRESSED_RGBA_ASTC_5x5_KHR;if(l===G1)return p===Un?f.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:f.COMPRESSED_RGBA_ASTC_6x5_KHR;if(l===k1)return p===Un?f.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:f.COMPRESSED_RGBA_ASTC_6x6_KHR;if(l===q1)return p===Un?f.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:f.COMPRESSED_RGBA_ASTC_8x5_KHR;if(l===V1)return p===Un?f.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:f.COMPRESSED_RGBA_ASTC_8x6_KHR;if(l===H1)return p===Un?f.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:f.COMPRESSED_RGBA_ASTC_8x8_KHR;if(l===W1)return p===Un?f.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:f.COMPRESSED_RGBA_ASTC_10x5_KHR;if(l===X1)return p===Un?f.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:f.COMPRESSED_RGBA_ASTC_10x6_KHR;if(l===Y1)return p===Un?f.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:f.COMPRESSED_RGBA_ASTC_10x8_KHR;if(l===$1)return p===Un?f.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:f.COMPRESSED_RGBA_ASTC_10x10_KHR;if(l===Z1)return p===Un?f.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:f.COMPRESSED_RGBA_ASTC_12x10_KHR;if(l===J1)return p===Un?f.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:f.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(l===Cd||l===K1||l===j1)if(f=t.get("EXT_texture_compression_bptc"),f!==null){if(l===Cd)return p===Un?f.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:f.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(l===K1)return f.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(l===j1)return f.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(l===x2||l===Q1||l===tE||l===eE)if(f=t.get("EXT_texture_compression_rgtc"),f!==null){if(l===Cd)return f.COMPRESSED_RED_RGTC1_EXT;if(l===Q1)return f.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(l===tE)return f.COMPRESSED_RED_GREEN_RGTC2_EXT;if(l===eE)return f.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return l===ya?o?r.UNSIGNED_INT_24_8:(f=t.get("WEBGL_depth_texture"),f!==null?f.UNSIGNED_INT_24_8_WEBGL:null):r[l]!==void 0?r[l]:null}return{convert:a}}var Am=class extends Li{constructor(t=[]){super(),this.isArrayCamera=!0,this.cameras=t}},_u=class extends po{constructor(){super(),this.isGroup=!0,this.type="Group"}},wU={type:"move"},Ll=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new _u,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new _u,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new yt,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new yt),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new _u,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new yt,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new yt),this._grip}dispatchEvent(t){return this._targetRay!==null&&this._targetRay.dispatchEvent(t),this._grip!==null&&this._grip.dispatchEvent(t),this._hand!==null&&this._hand.dispatchEvent(t),this}connect(t){if(t&&t.hand){let e=this._hand;if(e)for(let o of t.hand.values())this._getHandJoint(e,o)}return this.dispatchEvent({type:"connected",data:t}),this}disconnect(t){return this.dispatchEvent({type:"disconnected",data:t}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(t,e,o){let a=null,l=null,h=null,f=this._targetRay,p=this._grip,d=this._hand;if(t&&e.session.visibilityState!=="visible-blurred"){if(d&&t.hand){h=!0;for(let T of t.hand.values()){let _=e.getJointPose(T,o),y=this._getHandJoint(d,T);_!==null&&(y.matrix.fromArray(_.transform.matrix),y.matrix.decompose(y.position,y.rotation,y.scale),y.matrixWorldNeedsUpdate=!0,y.jointRadius=_.radius),y.visible=_!==null}let g=d.joints["index-finger-tip"],x=d.joints["thumb-tip"],v=g.position.distanceTo(x.position),M=.02,b=.005;d.inputState.pinching&&v>M+b?(d.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!d.inputState.pinching&&v<=M-b&&(d.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else p!==null&&t.gripSpace&&(l=e.getPose(t.gripSpace,o),l!==null&&(p.matrix.fromArray(l.transform.matrix),p.matrix.decompose(p.position,p.rotation,p.scale),p.matrixWorldNeedsUpdate=!0,l.linearVelocity?(p.hasLinearVelocity=!0,p.linearVelocity.copy(l.linearVelocity)):p.hasLinearVelocity=!1,l.angularVelocity?(p.hasAngularVelocity=!0,p.angularVelocity.copy(l.angularVelocity)):p.hasAngularVelocity=!1));f!==null&&(a=e.getPose(t.targetRaySpace,o),a===null&&l!==null&&(a=l),a!==null&&(f.matrix.fromArray(a.transform.matrix),f.matrix.decompose(f.position,f.rotation,f.scale),f.matrixWorldNeedsUpdate=!0,a.linearVelocity?(f.hasLinearVelocity=!0,f.linearVelocity.copy(a.linearVelocity)):f.hasLinearVelocity=!1,a.angularVelocity?(f.hasAngularVelocity=!0,f.angularVelocity.copy(a.angularVelocity)):f.hasAngularVelocity=!1,this.dispatchEvent(wU)))}return f!==null&&(f.visible=a!==null),p!==null&&(p.visible=l!==null),d!==null&&(d.visible=h!==null),this}_getHandJoint(t,e){if(t.joints[e.jointName]===void 0){let o=new _u;o.matrixAutoUpdate=!1,o.visible=!1,t.joints[e.jointName]=o,t.add(o)}return t.joints[e.jointName]}},bU=`
|
|
3782
3782
|
void main() {
|
|
3783
3783
|
|
|
3784
3784
|
gl_Position = vec4( position, 1.0 );
|
|
@@ -3802,5 +3802,5 @@ void main() {
|
|
|
3802
3802
|
|
|
3803
3803
|
}
|
|
3804
3804
|
|
|
3805
|
-
}`,Cm=class{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(t,e,o){if(this.texture===null){let a=new Hi,l=t.properties.get(a);l.__webglTexture=e.texture,(e.depthNear!=o.depthNear||e.depthFar!=o.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=a}}render(t,e){if(this.texture!==null){if(this.mesh===null){let o=e.cameras[0].viewport,a=new Io({extensions:{fragDepth:!0},vertexShader:bU,fragmentShader:TU,uniforms:{depthColor:{value:this.texture},depthWidth:{value:o.z},depthHeight:{value:o.w}}});this.mesh=new ho(new qf(20,20),a)}t.render(this.mesh,e)}}reset(){this.texture=null,this.mesh=null}},Pm=class extends Ds{constructor(t,e){super();let o=this,a=null,l=1,h=null,f="local-floor",p=1,d=null,g=null,x=null,v=null,M=null,b=null,T=new Cm,_=e.getContextAttributes(),y=null,A=null,S=[],L=[],G=new ye,z=null,F=new Li;F.layers.enable(1),F.viewport=new zr;let I=new Li;I.layers.enable(2),I.viewport=new zr;let ut=[F,I],R=new Am;R.layers.enable(1),R.layers.enable(2);let W=null,V=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(tt){let wt=S[tt];return wt===void 0&&(wt=new Ll,S[tt]=wt),wt.getTargetRaySpace()},this.getControllerGrip=function(tt){let wt=S[tt];return wt===void 0&&(wt=new Ll,S[tt]=wt),wt.getGripSpace()},this.getHand=function(tt){let wt=S[tt];return wt===void 0&&(wt=new Ll,S[tt]=wt),wt.getHandSpace()};function Mt(tt){let wt=L.indexOf(tt.inputSource);if(wt===-1)return;let Bt=S[wt];Bt!==void 0&&(Bt.update(tt.inputSource,tt.frame,d||h),Bt.dispatchEvent({type:tt.type,data:tt.inputSource}))}function X(){a.removeEventListener("select",Mt),a.removeEventListener("selectstart",Mt),a.removeEventListener("selectend",Mt),a.removeEventListener("squeeze",Mt),a.removeEventListener("squeezestart",Mt),a.removeEventListener("squeezeend",Mt),a.removeEventListener("end",X),a.removeEventListener("inputsourceschange",mt);for(let tt=0;tt<S.length;tt++){let wt=L[tt];wt!==null&&(L[tt]=null,S[tt].disconnect(wt))}W=null,V=null,T.reset(),t.setRenderTarget(y),M=null,v=null,x=null,a=null,A=null,Yt.stop(),o.isPresenting=!1,t.setPixelRatio(z),t.setSize(G.width,G.height,!1),o.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(tt){l=tt,o.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(tt){f=tt,o.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return d||h},this.setReferenceSpace=function(tt){d=tt},this.getBaseLayer=function(){return v!==null?v:M},this.getBinding=function(){return x},this.getFrame=function(){return b},this.getSession=function(){return a},this.setSession=function(tt){return gc(this,null,function*(){if(a=tt,a!==null){if(y=t.getRenderTarget(),a.addEventListener("select",Mt),a.addEventListener("selectstart",Mt),a.addEventListener("selectend",Mt),a.addEventListener("squeeze",Mt),a.addEventListener("squeezestart",Mt),a.addEventListener("squeezeend",Mt),a.addEventListener("end",X),a.addEventListener("inputsourceschange",mt),_.xrCompatible!==!0&&(yield e.makeXRCompatible()),z=t.getPixelRatio(),t.getSize(G),a.renderState.layers===void 0||t.capabilities.isWebGL2===!1){let wt={antialias:a.renderState.layers===void 0?_.antialias:!0,alpha:!0,depth:_.depth,stencil:_.stencil,framebufferScaleFactor:l};M=new XRWebGLLayer(a,e,wt),a.updateRenderState({baseLayer:M}),t.setPixelRatio(1),t.setSize(M.framebufferWidth,M.framebufferHeight,!1),A=new us(M.framebufferWidth,M.framebufferHeight,{format:fo,type:Ls,colorSpace:t.outputColorSpace,stencilBuffer:_.stencil})}else{let wt=null,Bt=null,$t=null;_.depth&&($t=_.stencil?e.DEPTH24_STENCIL8:e.DEPTH_COMPONENT24,wt=_.stencil?bu:va,Bt=_.stencil?ya:Ps);let Ut={colorFormat:e.RGBA8,depthFormat:$t,scaleFactor:l};x=new XRWebGLBinding(a,e),v=x.createProjectionLayer(Ut),a.updateRenderState({layers:[v]}),t.setPixelRatio(1),t.setSize(v.textureWidth,v.textureHeight,!1),A=new us(v.textureWidth,v.textureHeight,{format:fo,type:Ls,depthTexture:new Hf(v.textureWidth,v.textureHeight,Bt,void 0,void 0,void 0,void 0,void 0,void 0,wt),stencilBuffer:_.stencil,colorSpace:t.outputColorSpace,samples:_.antialias?4:0});let Dt=t.properties.get(A);Dt.__ignoreDepthValues=v.ignoreDepthValues}A.isXRRenderTarget=!0,this.setFoveation(p),d=null,h=yield a.requestReferenceSpace(f),Yt.setContext(a),Yt.start(),o.isPresenting=!0,o.dispatchEvent({type:"sessionstart"})}})},this.getEnvironmentBlendMode=function(){if(a!==null)return a.environmentBlendMode};function mt(tt){for(let wt=0;wt<tt.removed.length;wt++){let Bt=tt.removed[wt],$t=L.indexOf(Bt);$t>=0&&(L[$t]=null,S[$t].disconnect(Bt))}for(let wt=0;wt<tt.added.length;wt++){let Bt=tt.added[wt],$t=L.indexOf(Bt);if($t===-1){for(let Dt=0;Dt<S.length;Dt++)if(Dt>=L.length){L.push(Bt),$t=Dt;break}else if(L[Dt]===null){L[Dt]=Bt,$t=Dt;break}if($t===-1)break}let Ut=S[$t];Ut&&Ut.connect(Bt)}}let dt=new yt,_t=new yt;function it(tt,wt,Bt){dt.setFromMatrixPosition(wt.matrixWorld),_t.setFromMatrixPosition(Bt.matrixWorld);let $t=dt.distanceTo(_t),Ut=wt.projectionMatrix.elements,Dt=Bt.projectionMatrix.elements,At=Ut[14]/(Ut[10]-1),te=Ut[14]/(Ut[10]+1),rt=(Ut[9]+1)/Ut[5],an=(Ut[9]-1)/Ut[5],zt=(Ut[8]-1)/Ut[0],ne=(Dt[8]+1)/Dt[0],Wt=At*zt,ie=At*ne,ce=$t/(-zt+ne),Lt=ce*-zt;wt.matrixWorld.decompose(tt.position,tt.quaternion,tt.scale),tt.translateX(Lt),tt.translateZ(ce),tt.matrixWorld.compose(tt.position,tt.quaternion,tt.scale),tt.matrixWorldInverse.copy(tt.matrixWorld).invert();let se=At+ce,Y=te+ce,N=Wt-Lt,xt=ie+($t-Lt),Et=rt*te/Y*se,ot=an*te/Y*se;tt.projectionMatrix.makePerspective(N,xt,Et,ot,se,Y),tt.projectionMatrixInverse.copy(tt.projectionMatrix).invert()}function lt(tt,wt){wt===null?tt.matrixWorld.copy(tt.matrix):tt.matrixWorld.multiplyMatrices(wt.matrixWorld,tt.matrix),tt.matrixWorldInverse.copy(tt.matrixWorld).invert()}this.updateCamera=function(tt){if(a===null)return;T.texture!==null&&(tt.near=T.depthNear,tt.far=T.depthFar),R.near=I.near=F.near=tt.near,R.far=I.far=F.far=tt.far,(W!==R.near||V!==R.far)&&(a.updateRenderState({depthNear:R.near,depthFar:R.far}),W=R.near,V=R.far,F.near=W,F.far=V,I.near=W,I.far=V,F.updateProjectionMatrix(),I.updateProjectionMatrix(),tt.updateProjectionMatrix());let wt=tt.parent,Bt=R.cameras;lt(R,wt);for(let $t=0;$t<Bt.length;$t++)lt(Bt[$t],wt);Bt.length===2?it(R,F,I):R.projectionMatrix.copy(F.projectionMatrix),H(tt,R,wt)};function H(tt,wt,Bt){Bt===null?tt.matrix.copy(wt.matrixWorld):(tt.matrix.copy(Bt.matrixWorld),tt.matrix.invert(),tt.matrix.multiply(wt.matrixWorld)),tt.matrix.decompose(tt.position,tt.quaternion,tt.scale),tt.updateMatrixWorld(!0),tt.projectionMatrix.copy(wt.projectionMatrix),tt.projectionMatrixInverse.copy(wt.projectionMatrixInverse),tt.isPerspectiveCamera&&(tt.fov=fm*2*Math.atan(1/tt.projectionMatrix.elements[5]),tt.zoom=1)}this.getCamera=function(){return R},this.getFoveation=function(){if(!(v===null&&M===null))return p},this.setFoveation=function(tt){p=tt,v!==null&&(v.fixedFoveation=tt),M!==null&&M.fixedFoveation!==void 0&&(M.fixedFoveation=tt)},this.hasDepthSensing=function(){return T.texture!==null};let bt=null;function Tt(tt,wt){if(g=wt.getViewerPose(d||h),b=wt,g!==null){let Bt=g.views;M!==null&&(t.setRenderTargetFramebuffer(A,M.framebuffer),t.setRenderTarget(A));let $t=!1;Bt.length!==R.cameras.length&&(R.cameras.length=0,$t=!0);for(let Dt=0;Dt<Bt.length;Dt++){let At=Bt[Dt],te=null;if(M!==null)te=M.getViewport(At);else{let an=x.getViewSubImage(v,At);te=an.viewport,Dt===0&&(t.setRenderTargetTextures(A,an.colorTexture,v.ignoreDepthValues?void 0:an.depthStencilTexture),t.setRenderTarget(A))}let rt=ut[Dt];rt===void 0&&(rt=new Li,rt.layers.enable(Dt),rt.viewport=new zr,ut[Dt]=rt),rt.matrix.fromArray(At.transform.matrix),rt.matrix.decompose(rt.position,rt.quaternion,rt.scale),rt.projectionMatrix.fromArray(At.projectionMatrix),rt.projectionMatrixInverse.copy(rt.projectionMatrix).invert(),rt.viewport.set(te.x,te.y,te.width,te.height),Dt===0&&(R.matrix.copy(rt.matrix),R.matrix.decompose(R.position,R.quaternion,R.scale)),$t===!0&&R.cameras.push(rt)}let Ut=a.enabledFeatures;if(Ut&&Ut.includes("depth-sensing")){let Dt=x.getDepthInformation(Bt[0]);Dt&&Dt.isValid&&Dt.texture&&T.init(t,Dt,a.renderState)}}for(let Bt=0;Bt<S.length;Bt++){let $t=L[Bt],Ut=S[Bt];$t!==null&&Ut!==void 0&&Ut.update($t,wt,d||h)}T.render(t,R),bt&&bt(tt,wt),wt.detectedPlanes&&o.dispatchEvent({type:"planesdetected",data:wt}),b=null}let Yt=new cM;Yt.setAnimationLoop(Tt),this.setAnimationLoop=function(tt){bt=tt},this.dispose=function(){}}},fa=new xa,AU=new cr;function CU(r,t){function e(_,y){_.matrixAutoUpdate===!0&&_.updateMatrix(),y.value.copy(_.matrix)}function o(_,y){y.color.getRGB(_.fogColor.value,lM(r)),y.isFog?(_.fogNear.value=y.near,_.fogFar.value=y.far):y.isFogExp2&&(_.fogDensity.value=y.density)}function a(_,y,A,S,L){y.isMeshBasicMaterial||y.isMeshLambertMaterial?l(_,y):y.isMeshToonMaterial?(l(_,y),x(_,y)):y.isMeshPhongMaterial?(l(_,y),g(_,y)):y.isMeshStandardMaterial?(l(_,y),v(_,y),y.isMeshPhysicalMaterial&&M(_,y,L)):y.isMeshMatcapMaterial?(l(_,y),b(_,y)):y.isMeshDepthMaterial?l(_,y):y.isMeshDistanceMaterial?(l(_,y),T(_,y)):y.isMeshNormalMaterial?l(_,y):y.isLineBasicMaterial?(h(_,y),y.isLineDashedMaterial&&f(_,y)):y.isPointsMaterial?p(_,y,A,S):y.isSpriteMaterial?d(_,y):y.isShadowMaterial?(_.color.value.copy(y.color),_.opacity.value=y.opacity):y.isShaderMaterial&&(y.uniformsNeedUpdate=!1)}function l(_,y){_.opacity.value=y.opacity,y.color&&_.diffuse.value.copy(y.color),y.emissive&&_.emissive.value.copy(y.emissive).multiplyScalar(y.emissiveIntensity),y.map&&(_.map.value=y.map,e(y.map,_.mapTransform)),y.alphaMap&&(_.alphaMap.value=y.alphaMap,e(y.alphaMap,_.alphaMapTransform)),y.bumpMap&&(_.bumpMap.value=y.bumpMap,e(y.bumpMap,_.bumpMapTransform),_.bumpScale.value=y.bumpScale,y.side===Ei&&(_.bumpScale.value*=-1)),y.normalMap&&(_.normalMap.value=y.normalMap,e(y.normalMap,_.normalMapTransform),_.normalScale.value.copy(y.normalScale),y.side===Ei&&_.normalScale.value.negate()),y.displacementMap&&(_.displacementMap.value=y.displacementMap,e(y.displacementMap,_.displacementMapTransform),_.displacementScale.value=y.displacementScale,_.displacementBias.value=y.displacementBias),y.emissiveMap&&(_.emissiveMap.value=y.emissiveMap,e(y.emissiveMap,_.emissiveMapTransform)),y.specularMap&&(_.specularMap.value=y.specularMap,e(y.specularMap,_.specularMapTransform)),y.alphaTest>0&&(_.alphaTest.value=y.alphaTest);let A=t.get(y),S=A.envMap,L=A.envMapRotation;if(S&&(_.envMap.value=S,fa.copy(L),fa.x*=-1,fa.y*=-1,fa.z*=-1,S.isCubeTexture&&S.isRenderTargetTexture===!1&&(fa.y*=-1,fa.z*=-1),_.envMapRotation.value.setFromMatrix4(AU.makeRotationFromEuler(fa)),_.flipEnvMap.value=S.isCubeTexture&&S.isRenderTargetTexture===!1?-1:1,_.reflectivity.value=y.reflectivity,_.ior.value=y.ior,_.refractionRatio.value=y.refractionRatio),y.lightMap){_.lightMap.value=y.lightMap;let G=r._useLegacyLights===!0?Math.PI:1;_.lightMapIntensity.value=y.lightMapIntensity*G,e(y.lightMap,_.lightMapTransform)}y.aoMap&&(_.aoMap.value=y.aoMap,_.aoMapIntensity.value=y.aoMapIntensity,e(y.aoMap,_.aoMapTransform))}function h(_,y){_.diffuse.value.copy(y.color),_.opacity.value=y.opacity,y.map&&(_.map.value=y.map,e(y.map,_.mapTransform))}function f(_,y){_.dashSize.value=y.dashSize,_.totalSize.value=y.dashSize+y.gapSize,_.scale.value=y.scale}function p(_,y,A,S){_.diffuse.value.copy(y.color),_.opacity.value=y.opacity,_.size.value=y.size*A,_.scale.value=S*.5,y.map&&(_.map.value=y.map,e(y.map,_.uvTransform)),y.alphaMap&&(_.alphaMap.value=y.alphaMap,e(y.alphaMap,_.alphaMapTransform)),y.alphaTest>0&&(_.alphaTest.value=y.alphaTest)}function d(_,y){_.diffuse.value.copy(y.color),_.opacity.value=y.opacity,_.rotation.value=y.rotation,y.map&&(_.map.value=y.map,e(y.map,_.mapTransform)),y.alphaMap&&(_.alphaMap.value=y.alphaMap,e(y.alphaMap,_.alphaMapTransform)),y.alphaTest>0&&(_.alphaTest.value=y.alphaTest)}function g(_,y){_.specular.value.copy(y.specular),_.shininess.value=Math.max(y.shininess,1e-4)}function x(_,y){y.gradientMap&&(_.gradientMap.value=y.gradientMap)}function v(_,y){_.metalness.value=y.metalness,y.metalnessMap&&(_.metalnessMap.value=y.metalnessMap,e(y.metalnessMap,_.metalnessMapTransform)),_.roughness.value=y.roughness,y.roughnessMap&&(_.roughnessMap.value=y.roughnessMap,e(y.roughnessMap,_.roughnessMapTransform)),t.get(y).envMap&&(_.envMapIntensity.value=y.envMapIntensity)}function M(_,y,A){_.ior.value=y.ior,y.sheen>0&&(_.sheenColor.value.copy(y.sheenColor).multiplyScalar(y.sheen),_.sheenRoughness.value=y.sheenRoughness,y.sheenColorMap&&(_.sheenColorMap.value=y.sheenColorMap,e(y.sheenColorMap,_.sheenColorMapTransform)),y.sheenRoughnessMap&&(_.sheenRoughnessMap.value=y.sheenRoughnessMap,e(y.sheenRoughnessMap,_.sheenRoughnessMapTransform))),y.clearcoat>0&&(_.clearcoat.value=y.clearcoat,_.clearcoatRoughness.value=y.clearcoatRoughness,y.clearcoatMap&&(_.clearcoatMap.value=y.clearcoatMap,e(y.clearcoatMap,_.clearcoatMapTransform)),y.clearcoatRoughnessMap&&(_.clearcoatRoughnessMap.value=y.clearcoatRoughnessMap,e(y.clearcoatRoughnessMap,_.clearcoatRoughnessMapTransform)),y.clearcoatNormalMap&&(_.clearcoatNormalMap.value=y.clearcoatNormalMap,e(y.clearcoatNormalMap,_.clearcoatNormalMapTransform),_.clearcoatNormalScale.value.copy(y.clearcoatNormalScale),y.side===Ei&&_.clearcoatNormalScale.value.negate())),y.iridescence>0&&(_.iridescence.value=y.iridescence,_.iridescenceIOR.value=y.iridescenceIOR,_.iridescenceThicknessMinimum.value=y.iridescenceThicknessRange[0],_.iridescenceThicknessMaximum.value=y.iridescenceThicknessRange[1],y.iridescenceMap&&(_.iridescenceMap.value=y.iridescenceMap,e(y.iridescenceMap,_.iridescenceMapTransform)),y.iridescenceThicknessMap&&(_.iridescenceThicknessMap.value=y.iridescenceThicknessMap,e(y.iridescenceThicknessMap,_.iridescenceThicknessMapTransform))),y.transmission>0&&(_.transmission.value=y.transmission,_.transmissionSamplerMap.value=A.texture,_.transmissionSamplerSize.value.set(A.width,A.height),y.transmissionMap&&(_.transmissionMap.value=y.transmissionMap,e(y.transmissionMap,_.transmissionMapTransform)),_.thickness.value=y.thickness,y.thicknessMap&&(_.thicknessMap.value=y.thicknessMap,e(y.thicknessMap,_.thicknessMapTransform)),_.attenuationDistance.value=y.attenuationDistance,_.attenuationColor.value.copy(y.attenuationColor)),y.anisotropy>0&&(_.anisotropyVector.value.set(y.anisotropy*Math.cos(y.anisotropyRotation),y.anisotropy*Math.sin(y.anisotropyRotation)),y.anisotropyMap&&(_.anisotropyMap.value=y.anisotropyMap,e(y.anisotropyMap,_.anisotropyMapTransform))),_.specularIntensity.value=y.specularIntensity,_.specularColor.value.copy(y.specularColor),y.specularColorMap&&(_.specularColorMap.value=y.specularColorMap,e(y.specularColorMap,_.specularColorMapTransform)),y.specularIntensityMap&&(_.specularIntensityMap.value=y.specularIntensityMap,e(y.specularIntensityMap,_.specularIntensityMapTransform))}function b(_,y){y.matcap&&(_.matcap.value=y.matcap)}function T(_,y){let A=t.get(y).light;_.referencePosition.value.setFromMatrixPosition(A.matrixWorld),_.nearDistance.value=A.shadow.camera.near,_.farDistance.value=A.shadow.camera.far}return{refreshFogUniforms:o,refreshMaterialUniforms:a}}function PU(r,t,e,o){let a={},l={},h=[],f=e.isWebGL2?r.getParameter(r.MAX_UNIFORM_BUFFER_BINDINGS):0;function p(A,S){let L=S.program;o.uniformBlockBinding(A,L)}function d(A,S){let L=a[A.id];L===void 0&&(b(A),L=g(A),a[A.id]=L,A.addEventListener("dispose",_));let G=S.program;o.updateUBOMapping(A,G);let z=t.render.frame;l[A.id]!==z&&(v(A),l[A.id]=z)}function g(A){let S=x();A.__bindingPointIndex=S;let L=r.createBuffer(),G=A.__size,z=A.usage;return r.bindBuffer(r.UNIFORM_BUFFER,L),r.bufferData(r.UNIFORM_BUFFER,G,z),r.bindBuffer(r.UNIFORM_BUFFER,null),r.bindBufferBase(r.UNIFORM_BUFFER,S,L),L}function x(){for(let A=0;A<f;A++)if(h.indexOf(A)===-1)return h.push(A),A;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function v(A){let S=a[A.id],L=A.uniforms,G=A.__cache;r.bindBuffer(r.UNIFORM_BUFFER,S);for(let z=0,F=L.length;z<F;z++){let I=Array.isArray(L[z])?L[z]:[L[z]];for(let ut=0,R=I.length;ut<R;ut++){let W=I[ut];if(M(W,z,ut,G)===!0){let V=W.__offset,Mt=Array.isArray(W.value)?W.value:[W.value],X=0;for(let mt=0;mt<Mt.length;mt++){let dt=Mt[mt],_t=T(dt);typeof dt=="number"||typeof dt=="boolean"?(W.__data[0]=dt,r.bufferSubData(r.UNIFORM_BUFFER,V+X,W.__data)):dt.isMatrix3?(W.__data[0]=dt.elements[0],W.__data[1]=dt.elements[1],W.__data[2]=dt.elements[2],W.__data[3]=0,W.__data[4]=dt.elements[3],W.__data[5]=dt.elements[4],W.__data[6]=dt.elements[5],W.__data[7]=0,W.__data[8]=dt.elements[6],W.__data[9]=dt.elements[7],W.__data[10]=dt.elements[8],W.__data[11]=0):(dt.toArray(W.__data,X),X+=_t.storage/Float32Array.BYTES_PER_ELEMENT)}r.bufferSubData(r.UNIFORM_BUFFER,V,W.__data)}}}r.bindBuffer(r.UNIFORM_BUFFER,null)}function M(A,S,L,G){let z=A.value,F=S+"_"+L;if(G[F]===void 0)return typeof z=="number"||typeof z=="boolean"?G[F]=z:G[F]=z.clone(),!0;{let I=G[F];if(typeof z=="number"||typeof z=="boolean"){if(I!==z)return G[F]=z,!0}else if(I.equals(z)===!1)return I.copy(z),!0}return!1}function b(A){let S=A.uniforms,L=0,G=16;for(let F=0,I=S.length;F<I;F++){let ut=Array.isArray(S[F])?S[F]:[S[F]];for(let R=0,W=ut.length;R<W;R++){let V=ut[R],Mt=Array.isArray(V.value)?V.value:[V.value];for(let X=0,mt=Mt.length;X<mt;X++){let dt=Mt[X],_t=T(dt),it=L%G;it!==0&&G-it<_t.boundary&&(L+=G-it),V.__data=new Float32Array(_t.storage/Float32Array.BYTES_PER_ELEMENT),V.__offset=L,L+=_t.storage}}}let z=L%G;return z>0&&(L+=G-z),A.__size=L,A.__cache={},this}function T(A){let S={boundary:0,storage:0};return typeof A=="number"||typeof A=="boolean"?(S.boundary=4,S.storage=4):A.isVector2?(S.boundary=8,S.storage=8):A.isVector3||A.isColor?(S.boundary=16,S.storage=12):A.isVector4?(S.boundary=16,S.storage=16):A.isMatrix3?(S.boundary=48,S.storage=48):A.isMatrix4?(S.boundary=64,S.storage=64):A.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",A),S}function _(A){let S=A.target;S.removeEventListener("dispose",_);let L=h.indexOf(S.__bindingPointIndex);h.splice(L,1),r.deleteBuffer(a[S.id]),delete a[S.id],delete l[S.id]}function y(){for(let A in a)r.deleteBuffer(a[A]);h=[],a={},l={}}return{bind:p,update:d,dispose:y}}var Im=class{constructor(t={}){let{canvas:e=N2(),context:o=null,depth:a=!0,stencil:l=!0,alpha:h=!1,antialias:f=!1,premultipliedAlpha:p=!0,preserveDrawingBuffer:d=!1,powerPreference:g="default",failIfMajorPerformanceCaveat:x=!1}=t;this.isWebGLRenderer=!0;let v;o!==null?v=o.getContextAttributes().alpha:v=h;let M=new Uint32Array(4),b=new Int32Array(4),T=null,_=null,y=[],A=[];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=Ao,this._useLegacyLights=!1,this.toneMapping=Rs,this.toneMappingExposure=1;let S=this,L=!1,G=0,z=0,F=null,I=-1,ut=null,R=new zr,W=new zr,V=null,Mt=new vn(0),X=0,mt=e.width,dt=e.height,_t=1,it=null,lt=null,H=new zr(0,0,mt,dt),bt=new zr(0,0,mt,dt),Tt=!1,Yt=new kf,tt=!1,wt=!1,Bt=null,$t=new cr,Ut=new ye,Dt=new yt,At={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function te(){return F===null?_t:1}let rt=o;function an(q,st){for(let vt=0;vt<q.length;vt++){let ht=q[vt],at=e.getContext(ht,st);if(at!==null)return at}return null}try{let q={alpha:!0,depth:a,stencil:l,antialias:f,premultipliedAlpha:p,preserveDrawingBuffer:d,powerPreference:g,failIfMajorPerformanceCaveat:x};if("setAttribute"in e&&e.setAttribute("data-engine",`three.js r${Wm}`),e.addEventListener("webglcontextlost",ct,!1),e.addEventListener("webglcontextrestored",O,!1),e.addEventListener("webglcontextcreationerror",K,!1),rt===null){let st=["webgl2","webgl","experimental-webgl"];if(S.isWebGL1Renderer===!0&&st.shift(),rt=an(st,q),rt===null)throw an(st)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}typeof WebGLRenderingContext!="undefined"&&rt instanceof WebGLRenderingContext&&console.warn("THREE.WebGLRenderer: WebGL 1 support was deprecated in r153 and will be removed in r163."),rt.getShaderPrecisionFormat===void 0&&(rt.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(q){throw console.error("THREE.WebGLRenderer: "+q.message),q}let zt,ne,Wt,ie,ce,Lt,se,Y,N,xt,Et,ot,Pt,ue,Ct,Ot,kt,J,w,P,D,k,B,et;function j(){zt=new W3(rt),ne=new z3(rt,zt,t),zt.init(ne),k=new SU(rt,zt,ne),Wt=new EU(rt,zt,ne),ie=new $3(rt),ce=new lU,Lt=new MU(rt,zt,Wt,ce,ne,k,ie),se=new k3(S),Y=new H3(S),N=new tO(rt,ne),B=new U3(rt,zt,N,ne),xt=new X3(rt,N,ie,B),Et=new j3(rt,xt,N,ie),w=new K3(rt,ne,Lt),Ot=new G3(ce),ot=new uU(S,se,Y,zt,ne,B,Ot),Pt=new CU(S,ce),ue=new fU,Ct=new yU(zt,ne),J=new F3(S,se,Y,Wt,Et,v,p),kt=new xU(S,Et,ne),et=new PU(rt,ie,ne,Wt),P=new B3(rt,zt,ie,ne),D=new Y3(rt,zt,ie,ne),ie.programs=ot.programs,S.capabilities=ne,S.extensions=zt,S.properties=ce,S.renderLists=ue,S.shadowMap=kt,S.state=Wt,S.info=ie}j();let ft=new Pm(S,rt);this.xr=ft,this.getContext=function(){return rt},this.getContextAttributes=function(){return rt.getContextAttributes()},this.forceContextLoss=function(){let q=zt.get("WEBGL_lose_context");q&&q.loseContext()},this.forceContextRestore=function(){let q=zt.get("WEBGL_lose_context");q&&q.restoreContext()},this.getPixelRatio=function(){return _t},this.setPixelRatio=function(q){q!==void 0&&(_t=q,this.setSize(mt,dt,!1))},this.getSize=function(q){return q.set(mt,dt)},this.setSize=function(q,st,vt=!0){if(ft.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}mt=q,dt=st,e.width=Math.floor(q*_t),e.height=Math.floor(st*_t),vt===!0&&(e.style.width=q+"px",e.style.height=st+"px"),this.setViewport(0,0,q,st)},this.getDrawingBufferSize=function(q){return q.set(mt*_t,dt*_t).floor()},this.setDrawingBufferSize=function(q,st,vt){mt=q,dt=st,_t=vt,e.width=Math.floor(q*vt),e.height=Math.floor(st*vt),this.setViewport(0,0,q,st)},this.getCurrentViewport=function(q){return q.copy(R)},this.getViewport=function(q){return q.copy(H)},this.setViewport=function(q,st,vt,ht){q.isVector4?H.set(q.x,q.y,q.z,q.w):H.set(q,st,vt,ht),Wt.viewport(R.copy(H).multiplyScalar(_t).round())},this.getScissor=function(q){return q.copy(bt)},this.setScissor=function(q,st,vt,ht){q.isVector4?bt.set(q.x,q.y,q.z,q.w):bt.set(q,st,vt,ht),Wt.scissor(W.copy(bt).multiplyScalar(_t).round())},this.getScissorTest=function(){return Tt},this.setScissorTest=function(q){Wt.setScissorTest(Tt=q)},this.setOpaqueSort=function(q){it=q},this.setTransparentSort=function(q){lt=q},this.getClearColor=function(q){return q.copy(J.getClearColor())},this.setClearColor=function(){J.setClearColor.apply(J,arguments)},this.getClearAlpha=function(){return J.getClearAlpha()},this.setClearAlpha=function(){J.setClearAlpha.apply(J,arguments)},this.clear=function(q=!0,st=!0,vt=!0){let ht=0;if(q){let at=!1;if(F!==null){let Ht=F.texture.format;at=Ht===rM||Ht===nM||Ht===eM}if(at){let Ht=F.texture.type,Xt=Ht===Ls||Ht===Ps||Ht===Xm||Ht===ya||Ht===QE||Ht===tM,re=J.getClearColor(),Zt=J.getClearAlpha(),me=re.r,oe=re.g,ae=re.b;Xt?(M[0]=me,M[1]=oe,M[2]=ae,M[3]=Zt,rt.clearBufferuiv(rt.COLOR,0,M)):(b[0]=me,b[1]=oe,b[2]=ae,b[3]=Zt,rt.clearBufferiv(rt.COLOR,0,b))}else ht|=rt.COLOR_BUFFER_BIT}st&&(ht|=rt.DEPTH_BUFFER_BIT),vt&&(ht|=rt.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),rt.clear(ht)},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",ct,!1),e.removeEventListener("webglcontextrestored",O,!1),e.removeEventListener("webglcontextcreationerror",K,!1),ue.dispose(),Ct.dispose(),ce.dispose(),se.dispose(),Y.dispose(),Et.dispose(),B.dispose(),et.dispose(),ot.dispose(),kt.dispose(),ft.dispose(),ft.removeEventListener("sessionstart",Ee),ft.removeEventListener("sessionend",de),Bt&&(Bt.dispose(),Bt=null),Se.stop()};function ct(q){q.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),L=!0}function O(){console.log("THREE.WebGLRenderer: Context Restored."),L=!1;let q=ie.autoReset,st=kt.enabled,vt=kt.autoUpdate,ht=kt.needsUpdate,at=kt.type;j(),ie.autoReset=q,kt.enabled=st,kt.autoUpdate=vt,kt.needsUpdate=ht,kt.type=at}function K(q){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",q.statusMessage)}function $(q){let st=q.target;st.removeEventListener("dispose",$),Q(st)}function Q(q){St(q),ce.remove(q)}function St(q){let st=ce.get(q).programs;st!==void 0&&(st.forEach(function(vt){ot.releaseProgram(vt)}),q.isShaderMaterial&&ot.releaseShaderCache(q))}this.renderBufferDirect=function(q,st,vt,ht,at,Ht){st===null&&(st=At);let Xt=at.isMesh&&at.matrixWorld.determinant()<0,re=En(q,st,vt,ht,at);Wt.setMaterial(ht,Xt);let Zt=vt.index,me=1;if(ht.wireframe===!0){if(Zt=xt.getWireframeAttribute(vt),Zt===void 0)return;me=2}let oe=vt.drawRange,ae=vt.attributes.position,un=oe.start*me,vr=(oe.start+oe.count)*me;Ht!==null&&(un=Math.max(un,Ht.start*me),vr=Math.min(vr,(Ht.start+Ht.count)*me)),Zt!==null?(un=Math.max(un,0),vr=Math.min(vr,Zt.count)):ae!=null&&(un=Math.max(un,0),vr=Math.min(vr,ae.count));let Bn=vr-un;if(Bn<0||Bn===1/0)return;B.setup(at,ht,re,vt,Zt);let ti,Mn=P;if(Zt!==null&&(ti=N.get(Zt),Mn=D,Mn.setIndex(ti)),at.isMesh)ht.wireframe===!0?(Wt.setLineWidth(ht.wireframeLinewidth*te()),Mn.setMode(rt.LINES)):Mn.setMode(rt.TRIANGLES);else if(at.isLine){let jt=ht.linewidth;jt===void 0&&(jt=1),Wt.setLineWidth(jt*te()),at.isLineSegments?Mn.setMode(rt.LINES):at.isLineLoop?Mn.setMode(rt.LINE_LOOP):Mn.setMode(rt.LINE_STRIP)}else at.isPoints?Mn.setMode(rt.POINTS):at.isSprite&&Mn.setMode(rt.TRIANGLES);if(at.isBatchedMesh)Mn.renderMultiDraw(at._multiDrawStarts,at._multiDrawCounts,at._multiDrawCount);else if(at.isInstancedMesh)Mn.renderInstances(un,Bn,at.count);else if(vt.isInstancedBufferGeometry){let jt=vt._maxInstanceCount!==void 0?vt._maxInstanceCount:1/0,Na=Math.min(vt.instanceCount,jt);Mn.renderInstances(un,Bn,Na)}else Mn.render(un,Bn)};function Nt(q,st,vt){q.transparent===!0&&q.side===is&&q.forceSinglePass===!1?(q.side=Ei,q.needsUpdate=!0,xn(q,st,vt),q.side=Os,q.needsUpdate=!0,xn(q,st,vt),q.side=is):xn(q,st,vt)}this.compile=function(q,st,vt=null){vt===null&&(vt=q),_=Ct.get(vt),_.init(),A.push(_),vt.traverseVisible(function(at){at.isLight&&at.layers.test(st.layers)&&(_.pushLight(at),at.castShadow&&_.pushShadow(at))}),q!==vt&&q.traverseVisible(function(at){at.isLight&&at.layers.test(st.layers)&&(_.pushLight(at),at.castShadow&&_.pushShadow(at))}),_.setupLights(S._useLegacyLights);let ht=new Set;return q.traverse(function(at){let Ht=at.material;if(Ht)if(Array.isArray(Ht))for(let Xt=0;Xt<Ht.length;Xt++){let re=Ht[Xt];Nt(re,vt,at),ht.add(re)}else Nt(Ht,vt,at),ht.add(Ht)}),A.pop(),_=null,ht},this.compileAsync=function(q,st,vt=null){let ht=this.compile(q,st,vt);return new Promise(at=>{function Ht(){if(ht.forEach(function(Xt){ce.get(Xt).currentProgram.isReady()&&ht.delete(Xt)}),ht.size===0){at(q);return}setTimeout(Ht,10)}zt.get("KHR_parallel_shader_compile")!==null?Ht():setTimeout(Ht,10)})};let Jt=null;function Kt(q){Jt&&Jt(q)}function Ee(){Se.stop()}function de(){Se.start()}let Se=new cM;Se.setAnimationLoop(Kt),typeof self!="undefined"&&Se.setContext(self),this.setAnimationLoop=function(q){Jt=q,ft.setAnimationLoop(q),q===null?Se.stop():Se.start()},ft.addEventListener("sessionstart",Ee),ft.addEventListener("sessionend",de),this.render=function(q,st){if(st!==void 0&&st.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(L===!0)return;q.matrixWorldAutoUpdate===!0&&q.updateMatrixWorld(),st.parent===null&&st.matrixWorldAutoUpdate===!0&&st.updateMatrixWorld(),ft.enabled===!0&&ft.isPresenting===!0&&(ft.cameraAutoUpdate===!0&&ft.updateCamera(st),st=ft.getCamera()),q.isScene===!0&&q.onBeforeRender(S,q,st,F),_=Ct.get(q,A.length),_.init(),A.push(_),$t.multiplyMatrices(st.projectionMatrix,st.matrixWorldInverse),Yt.setFromProjectionMatrix($t),wt=this.localClippingEnabled,tt=Ot.init(this.clippingPlanes,wt),T=ue.get(q,y.length),T.init(),y.push(T),we(q,st,0,S.sortObjects),T.finish(),S.sortObjects===!0&&T.sort(it,lt),this.info.render.frame++,tt===!0&&Ot.beginShadows();let vt=_.state.shadowsArray;if(kt.render(vt,q,st),tt===!0&&Ot.endShadows(),this.info.autoReset===!0&&this.info.reset(),(ft.enabled===!1||ft.isPresenting===!1||ft.hasDepthSensing()===!1)&&J.render(T,q),_.setupLights(S._useLegacyLights),st.isArrayCamera){let ht=st.cameras;for(let at=0,Ht=ht.length;at<Ht;at++){let Xt=ht[at];On(T,q,Xt,Xt.viewport)}}else On(T,q,st);F!==null&&(Lt.updateMultisampleRenderTarget(F),Lt.updateRenderTargetMipmap(F)),q.isScene===!0&&q.onAfterRender(S,q,st),B.resetDefaultState(),I=-1,ut=null,A.pop(),A.length>0?_=A[A.length-1]:_=null,y.pop(),y.length>0?T=y[y.length-1]:T=null};function we(q,st,vt,ht){if(q.visible===!1)return;if(q.layers.test(st.layers)){if(q.isGroup)vt=q.renderOrder;else if(q.isLOD)q.autoUpdate===!0&&q.update(st);else if(q.isLight)_.pushLight(q),q.castShadow&&_.pushShadow(q);else if(q.isSprite){if(!q.frustumCulled||Yt.intersectsSprite(q)){ht&&Dt.setFromMatrixPosition(q.matrixWorld).applyMatrix4($t);let Xt=Et.update(q),re=q.material;re.visible&&T.push(q,Xt,re,vt,Dt.z,null)}}else if((q.isMesh||q.isLine||q.isPoints)&&(!q.frustumCulled||Yt.intersectsObject(q))){let Xt=Et.update(q),re=q.material;if(ht&&(q.boundingSphere!==void 0?(q.boundingSphere===null&&q.computeBoundingSphere(),Dt.copy(q.boundingSphere.center)):(Xt.boundingSphere===null&&Xt.computeBoundingSphere(),Dt.copy(Xt.boundingSphere.center)),Dt.applyMatrix4(q.matrixWorld).applyMatrix4($t)),Array.isArray(re)){let Zt=Xt.groups;for(let me=0,oe=Zt.length;me<oe;me++){let ae=Zt[me],un=re[ae.materialIndex];un&&un.visible&&T.push(q,Xt,un,vt,Dt.z,ae)}}else re.visible&&T.push(q,Xt,re,vt,Dt.z,null)}}let Ht=q.children;for(let Xt=0,re=Ht.length;Xt<re;Xt++)we(Ht[Xt],st,vt,ht)}function On(q,st,vt,ht){let at=q.opaque,Ht=q.transmissive,Xt=q.transparent;_.setupLightsView(vt),tt===!0&&Ot.setGlobalState(S.clippingPlanes,vt),Ht.length>0&&sr(at,Ht,st,vt),ht&&Wt.viewport(R.copy(ht)),at.length>0&&_n(at,st,vt),Ht.length>0&&_n(Ht,st,vt),Xt.length>0&&_n(Xt,st,vt),Wt.buffers.depth.setTest(!0),Wt.buffers.depth.setMask(!0),Wt.buffers.color.setMask(!0),Wt.setPolygonOffset(!1)}function sr(q,st,vt,ht){if((vt.isScene===!0?vt.overrideMaterial:null)!==null)return;let Ht=ne.isWebGL2;Bt===null&&(Bt=new us(1,1,{generateMipmaps:!0,type:zt.has("EXT_color_buffer_half_float")?Nl:Ls,minFilter:ma,samples:Ht?4:0})),S.getDrawingBufferSize(Ut),Ht?Bt.setSize(Ut.x,Ut.y):Bt.setSize(hm(Ut.x),hm(Ut.y));let Xt=S.getRenderTarget();S.setRenderTarget(Bt),S.getClearColor(Mt),X=S.getClearAlpha(),X<1&&S.setClearColor(16777215,.5),S.clear();let re=S.toneMapping;S.toneMapping=Rs,_n(q,vt,ht),Lt.updateMultisampleRenderTarget(Bt),Lt.updateRenderTargetMipmap(Bt);let Zt=!1;for(let me=0,oe=st.length;me<oe;me++){let ae=st[me],un=ae.object,vr=ae.geometry,Bn=ae.material,ti=ae.group;if(Bn.side===is&&un.layers.test(ht.layers)){let Mn=Bn.side;Bn.side=Ei,Bn.needsUpdate=!0,le(un,vt,ht,vr,Bn,ti),Bn.side=Mn,Bn.needsUpdate=!0,Zt=!0}}Zt===!0&&(Lt.updateMultisampleRenderTarget(Bt),Lt.updateRenderTargetMipmap(Bt)),S.setRenderTarget(Xt),S.setClearColor(Mt,X),S.toneMapping=re}function _n(q,st,vt){let ht=st.isScene===!0?st.overrideMaterial:null;for(let at=0,Ht=q.length;at<Ht;at++){let Xt=q[at],re=Xt.object,Zt=Xt.geometry,me=ht===null?Xt.material:ht,oe=Xt.group;re.layers.test(vt.layers)&&le(re,st,vt,Zt,me,oe)}}function le(q,st,vt,ht,at,Ht){q.onBeforeRender(S,st,vt,ht,at,Ht),q.modelViewMatrix.multiplyMatrices(vt.matrixWorldInverse,q.matrixWorld),q.normalMatrix.getNormalMatrix(q.modelViewMatrix),at.onBeforeRender(S,st,vt,ht,q,Ht),at.transparent===!0&&at.side===is&&at.forceSinglePass===!1?(at.side=Ei,at.needsUpdate=!0,S.renderBufferDirect(vt,st,ht,at,q,Ht),at.side=Os,at.needsUpdate=!0,S.renderBufferDirect(vt,st,ht,at,q,Ht),at.side=is):S.renderBufferDirect(vt,st,ht,at,q,Ht),q.onAfterRender(S,st,vt,ht,at,Ht)}function xn(q,st,vt){st.isScene!==!0&&(st=At);let ht=ce.get(q),at=_.state.lights,Ht=_.state.shadowsArray,Xt=at.state.version,re=ot.getParameters(q,at.state,Ht,st,vt),Zt=ot.getProgramCacheKey(re),me=ht.programs;ht.environment=q.isMeshStandardMaterial?st.environment:null,ht.fog=st.fog,ht.envMap=(q.isMeshStandardMaterial?Y:se).get(q.envMap||ht.environment),ht.envMapRotation=ht.environment!==null&&q.envMap===null?st.environmentRotation:q.envMapRotation,me===void 0&&(q.addEventListener("dispose",$),me=new Map,ht.programs=me);let oe=me.get(Zt);if(oe!==void 0){if(ht.currentProgram===oe&&ht.lightsStateVersion===Xt)return Tn(q,re),oe}else re.uniforms=ot.getUniforms(q),q.onBuild(vt,re,S),q.onBeforeCompile(re,S),oe=ot.acquireProgram(re,Zt),me.set(Zt,oe),ht.uniforms=re.uniforms;let ae=ht.uniforms;return(!q.isShaderMaterial&&!q.isRawShaderMaterial||q.clipping===!0)&&(ae.clippingPlanes=Ot.uniform),Tn(q,re),ht.needsLights=yr(q),ht.lightsStateVersion=Xt,ht.needsLights&&(ae.ambientLightColor.value=at.state.ambient,ae.lightProbe.value=at.state.probe,ae.directionalLights.value=at.state.directional,ae.directionalLightShadows.value=at.state.directionalShadow,ae.spotLights.value=at.state.spot,ae.spotLightShadows.value=at.state.spotShadow,ae.rectAreaLights.value=at.state.rectArea,ae.ltc_1.value=at.state.rectAreaLTC1,ae.ltc_2.value=at.state.rectAreaLTC2,ae.pointLights.value=at.state.point,ae.pointLightShadows.value=at.state.pointShadow,ae.hemisphereLights.value=at.state.hemi,ae.directionalShadowMap.value=at.state.directionalShadowMap,ae.directionalShadowMatrix.value=at.state.directionalShadowMatrix,ae.spotShadowMap.value=at.state.spotShadowMap,ae.spotLightMatrix.value=at.state.spotLightMatrix,ae.spotLightMap.value=at.state.spotLightMap,ae.pointShadowMap.value=at.state.pointShadowMap,ae.pointShadowMatrix.value=at.state.pointShadowMatrix),ht.currentProgram=oe,ht.uniformsList=null,oe}function In(q){if(q.uniformsList===null){let st=q.currentProgram.getUniforms();q.uniformsList=Mu.seqWithValue(st.seq,q.uniforms)}return q.uniformsList}function Tn(q,st){let vt=ce.get(q);vt.outputColorSpace=st.outputColorSpace,vt.batching=st.batching,vt.instancing=st.instancing,vt.instancingColor=st.instancingColor,vt.instancingMorph=st.instancingMorph,vt.skinning=st.skinning,vt.morphTargets=st.morphTargets,vt.morphNormals=st.morphNormals,vt.morphColors=st.morphColors,vt.morphTargetsCount=st.morphTargetsCount,vt.numClippingPlanes=st.numClippingPlanes,vt.numIntersection=st.numClipIntersection,vt.vertexAlphas=st.vertexAlphas,vt.vertexTangents=st.vertexTangents,vt.toneMapping=st.toneMapping}function En(q,st,vt,ht,at){st.isScene!==!0&&(st=At),Lt.resetTextureUnits();let Ht=st.fog,Xt=ht.isMeshStandardMaterial?st.environment:null,re=F===null?S.outputColorSpace:F.isXRRenderTarget===!0?F.texture.colorSpace:Bs,Zt=(ht.isMeshStandardMaterial?Y:se).get(ht.envMap||Xt),me=ht.vertexColors===!0&&!!vt.attributes.color&&vt.attributes.color.itemSize===4,oe=!!vt.attributes.tangent&&(!!ht.normalMap||ht.anisotropy>0),ae=!!vt.morphAttributes.position,un=!!vt.morphAttributes.normal,vr=!!vt.morphAttributes.color,Bn=Rs;ht.toneMapped&&(F===null||F.isXRRenderTarget===!0)&&(Bn=S.toneMapping);let ti=vt.morphAttributes.position||vt.morphAttributes.normal||vt.morphAttributes.color,Mn=ti!==void 0?ti.length:0,jt=ce.get(ht),Na=_.state.lights;if(tt===!0&&(wt===!0||q!==ut)){let ei=q===ut&&ht.id===I;Ot.setState(ht,q,ei)}let ln=!1;ht.version===jt.__version?(jt.needsLights&&jt.lightsStateVersion!==Na.state.version||jt.outputColorSpace!==re||at.isBatchedMesh&&jt.batching===!1||!at.isBatchedMesh&&jt.batching===!0||at.isInstancedMesh&&jt.instancing===!1||!at.isInstancedMesh&&jt.instancing===!0||at.isSkinnedMesh&&jt.skinning===!1||!at.isSkinnedMesh&&jt.skinning===!0||at.isInstancedMesh&&jt.instancingColor===!0&&at.instanceColor===null||at.isInstancedMesh&&jt.instancingColor===!1&&at.instanceColor!==null||at.isInstancedMesh&&jt.instancingMorph===!0&&at.morphTexture===null||at.isInstancedMesh&&jt.instancingMorph===!1&&at.morphTexture!==null||jt.envMap!==Zt||ht.fog===!0&&jt.fog!==Ht||jt.numClippingPlanes!==void 0&&(jt.numClippingPlanes!==Ot.numPlanes||jt.numIntersection!==Ot.numIntersection)||jt.vertexAlphas!==me||jt.vertexTangents!==oe||jt.morphTargets!==ae||jt.morphNormals!==un||jt.morphColors!==vr||jt.toneMapping!==Bn||ne.isWebGL2===!0&&jt.morphTargetsCount!==Mn)&&(ln=!0):(ln=!0,jt.__version=ht.version);let Xi=jt.currentProgram;ln===!0&&(Xi=xn(ht,st,at));let Qu=!1,ge=!1,Ys=!1,Sn=Xi.getUniforms(),Yi=jt.uniforms;if(Wt.useProgram(Xi.program)&&(Qu=!0,ge=!0,Ys=!0),ht.id!==I&&(I=ht.id,ge=!0),Qu||ut!==q){Sn.setValue(rt,"projectionMatrix",q.projectionMatrix),Sn.setValue(rt,"viewMatrix",q.matrixWorldInverse);let ei=Sn.map.cameraPosition;ei!==void 0&&ei.setValue(rt,Dt.setFromMatrixPosition(q.matrixWorld)),ne.logarithmicDepthBuffer&&Sn.setValue(rt,"logDepthBufFC",2/(Math.log(q.far+1)/Math.LN2)),(ht.isMeshPhongMaterial||ht.isMeshToonMaterial||ht.isMeshLambertMaterial||ht.isMeshBasicMaterial||ht.isMeshStandardMaterial||ht.isShaderMaterial)&&Sn.setValue(rt,"isOrthographic",q.isOrthographicCamera===!0),ut!==q&&(ut=q,ge=!0,Ys=!0)}if(at.isSkinnedMesh){Sn.setOptional(rt,at,"bindMatrix"),Sn.setOptional(rt,at,"bindMatrixInverse");let ei=at.skeleton;ei&&(ne.floatVertexTextures?(ei.boneTexture===null&&ei.computeBoneTexture(),Sn.setValue(rt,"boneTexture",ei.boneTexture,Lt)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}at.isBatchedMesh&&(Sn.setOptional(rt,at,"batchingTexture"),Sn.setValue(rt,"batchingTexture",at._matricesTexture,Lt));let pe=vt.morphAttributes;if((pe.position!==void 0||pe.normal!==void 0||pe.color!==void 0&&ne.isWebGL2===!0)&&w.update(at,vt,Xi),(ge||jt.receiveShadow!==at.receiveShadow)&&(jt.receiveShadow=at.receiveShadow,Sn.setValue(rt,"receiveShadow",at.receiveShadow)),ht.isMeshGouraudMaterial&&ht.envMap!==null&&(Yi.envMap.value=Zt,Yi.flipEnvMap.value=Zt.isCubeTexture&&Zt.isRenderTargetTexture===!1?-1:1),ge&&(Sn.setValue(rt,"toneMappingExposure",S.toneMappingExposure),jt.needsLights&&Hr(Yi,Ys),Ht&&ht.fog===!0&&Pt.refreshFogUniforms(Yi,Ht),Pt.refreshMaterialUniforms(Yi,ht,_t,dt,Bt),Mu.upload(rt,In(jt),Yi,Lt)),ht.isShaderMaterial&&ht.uniformsNeedUpdate===!0&&(Mu.upload(rt,In(jt),Yi,Lt),ht.uniformsNeedUpdate=!1),ht.isSpriteMaterial&&Sn.setValue(rt,"center",at.center),Sn.setValue(rt,"modelViewMatrix",at.modelViewMatrix),Sn.setValue(rt,"normalMatrix",at.normalMatrix),Sn.setValue(rt,"modelMatrix",at.matrixWorld),ht.isShaderMaterial||ht.isRawShaderMaterial){let ei=ht.uniformsGroups;for(let tl=0,Oa=ei.length;tl<Oa;tl++)if(ne.isWebGL2){let ni=ei[tl];et.update(ni,Xi),et.bind(ni,Xi)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return Xi}function Hr(q,st){q.ambientLightColor.needsUpdate=st,q.lightProbe.needsUpdate=st,q.directionalLights.needsUpdate=st,q.directionalLightShadows.needsUpdate=st,q.pointLights.needsUpdate=st,q.pointLightShadows.needsUpdate=st,q.spotLights.needsUpdate=st,q.spotLightShadows.needsUpdate=st,q.rectAreaLights.needsUpdate=st,q.hemisphereLights.needsUpdate=st}function yr(q){return q.isMeshLambertMaterial||q.isMeshToonMaterial||q.isMeshPhongMaterial||q.isMeshStandardMaterial||q.isShadowMaterial||q.isShaderMaterial&&q.lights===!0}this.getActiveCubeFace=function(){return G},this.getActiveMipmapLevel=function(){return z},this.getRenderTarget=function(){return F},this.setRenderTargetTextures=function(q,st,vt){ce.get(q.texture).__webglTexture=st,ce.get(q.depthTexture).__webglTexture=vt;let ht=ce.get(q);ht.__hasExternalTextures=!0,ht.__autoAllocateDepthBuffer=vt===void 0,ht.__autoAllocateDepthBuffer||zt.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),ht.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(q,st){let vt=ce.get(q);vt.__webglFramebuffer=st,vt.__useDefaultFramebuffer=st===void 0},this.setRenderTarget=function(q,st=0,vt=0){F=q,G=st,z=vt;let ht=!0,at=null,Ht=!1,Xt=!1;if(q){let Zt=ce.get(q);Zt.__useDefaultFramebuffer!==void 0?(Wt.bindFramebuffer(rt.FRAMEBUFFER,null),ht=!1):Zt.__webglFramebuffer===void 0?Lt.setupRenderTarget(q):Zt.__hasExternalTextures&&Lt.rebindTextures(q,ce.get(q.texture).__webglTexture,ce.get(q.depthTexture).__webglTexture);let me=q.texture;(me.isData3DTexture||me.isDataArrayTexture||me.isCompressedArrayTexture)&&(Xt=!0);let oe=ce.get(q).__webglFramebuffer;q.isWebGLCubeRenderTarget?(Array.isArray(oe[st])?at=oe[st][vt]:at=oe[st],Ht=!0):ne.isWebGL2&&q.samples>0&&Lt.useMultisampledRTT(q)===!1?at=ce.get(q).__webglMultisampledFramebuffer:Array.isArray(oe)?at=oe[vt]:at=oe,R.copy(q.viewport),W.copy(q.scissor),V=q.scissorTest}else R.copy(H).multiplyScalar(_t).floor(),W.copy(bt).multiplyScalar(_t).floor(),V=Tt;if(Wt.bindFramebuffer(rt.FRAMEBUFFER,at)&&ne.drawBuffers&&ht&&Wt.drawBuffers(q,at),Wt.viewport(R),Wt.scissor(W),Wt.setScissorTest(V),Ht){let Zt=ce.get(q.texture);rt.framebufferTexture2D(rt.FRAMEBUFFER,rt.COLOR_ATTACHMENT0,rt.TEXTURE_CUBE_MAP_POSITIVE_X+st,Zt.__webglTexture,vt)}else if(Xt){let Zt=ce.get(q.texture),me=st||0;rt.framebufferTextureLayer(rt.FRAMEBUFFER,rt.COLOR_ATTACHMENT0,Zt.__webglTexture,vt||0,me)}I=-1},this.readRenderTargetPixels=function(q,st,vt,ht,at,Ht,Xt){if(!(q&&q.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let re=ce.get(q).__webglFramebuffer;if(q.isWebGLCubeRenderTarget&&Xt!==void 0&&(re=re[Xt]),re){Wt.bindFramebuffer(rt.FRAMEBUFFER,re);try{let Zt=q.texture,me=Zt.format,oe=Zt.type;if(me!==fo&&k.convert(me)!==rt.getParameter(rt.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}let ae=oe===Nl&&(zt.has("EXT_color_buffer_half_float")||ne.isWebGL2&&zt.has("EXT_color_buffer_float"));if(oe!==Ls&&k.convert(oe)!==rt.getParameter(rt.IMPLEMENTATION_COLOR_READ_TYPE)&&!(oe===os&&(ne.isWebGL2||zt.has("OES_texture_float")||zt.has("WEBGL_color_buffer_float")))&&!ae){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}st>=0&&st<=q.width-ht&&vt>=0&&vt<=q.height-at&&rt.readPixels(st,vt,ht,at,k.convert(me),k.convert(oe),Ht)}finally{let Zt=F!==null?ce.get(F).__webglFramebuffer:null;Wt.bindFramebuffer(rt.FRAMEBUFFER,Zt)}}},this.copyFramebufferToTexture=function(q,st,vt=0){let ht=Math.pow(2,-vt),at=Math.floor(st.image.width*ht),Ht=Math.floor(st.image.height*ht);Lt.setTexture2D(st,0),rt.copyTexSubImage2D(rt.TEXTURE_2D,vt,0,0,q.x,q.y,at,Ht),Wt.unbindTexture()},this.copyTextureToTexture=function(q,st,vt,ht=0){let at=st.image.width,Ht=st.image.height,Xt=k.convert(vt.format),re=k.convert(vt.type);Lt.setTexture2D(vt,0),rt.pixelStorei(rt.UNPACK_FLIP_Y_WEBGL,vt.flipY),rt.pixelStorei(rt.UNPACK_PREMULTIPLY_ALPHA_WEBGL,vt.premultiplyAlpha),rt.pixelStorei(rt.UNPACK_ALIGNMENT,vt.unpackAlignment),st.isDataTexture?rt.texSubImage2D(rt.TEXTURE_2D,ht,q.x,q.y,at,Ht,Xt,re,st.image.data):st.isCompressedTexture?rt.compressedTexSubImage2D(rt.TEXTURE_2D,ht,q.x,q.y,st.mipmaps[0].width,st.mipmaps[0].height,Xt,st.mipmaps[0].data):rt.texSubImage2D(rt.TEXTURE_2D,ht,q.x,q.y,Xt,re,st.image),ht===0&&vt.generateMipmaps&&rt.generateMipmap(rt.TEXTURE_2D),Wt.unbindTexture()},this.copyTextureToTexture3D=function(q,st,vt,ht,at=0){if(S.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}let Ht=Math.round(q.max.x-q.min.x),Xt=Math.round(q.max.y-q.min.y),re=q.max.z-q.min.z+1,Zt=k.convert(ht.format),me=k.convert(ht.type),oe;if(ht.isData3DTexture)Lt.setTexture3D(ht,0),oe=rt.TEXTURE_3D;else if(ht.isDataArrayTexture||ht.isCompressedArrayTexture)Lt.setTexture2DArray(ht,0),oe=rt.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}rt.pixelStorei(rt.UNPACK_FLIP_Y_WEBGL,ht.flipY),rt.pixelStorei(rt.UNPACK_PREMULTIPLY_ALPHA_WEBGL,ht.premultiplyAlpha),rt.pixelStorei(rt.UNPACK_ALIGNMENT,ht.unpackAlignment);let ae=rt.getParameter(rt.UNPACK_ROW_LENGTH),un=rt.getParameter(rt.UNPACK_IMAGE_HEIGHT),vr=rt.getParameter(rt.UNPACK_SKIP_PIXELS),Bn=rt.getParameter(rt.UNPACK_SKIP_ROWS),ti=rt.getParameter(rt.UNPACK_SKIP_IMAGES),Mn=vt.isCompressedTexture?vt.mipmaps[at]:vt.image;rt.pixelStorei(rt.UNPACK_ROW_LENGTH,Mn.width),rt.pixelStorei(rt.UNPACK_IMAGE_HEIGHT,Mn.height),rt.pixelStorei(rt.UNPACK_SKIP_PIXELS,q.min.x),rt.pixelStorei(rt.UNPACK_SKIP_ROWS,q.min.y),rt.pixelStorei(rt.UNPACK_SKIP_IMAGES,q.min.z),vt.isDataTexture||vt.isData3DTexture?rt.texSubImage3D(oe,at,st.x,st.y,st.z,Ht,Xt,re,Zt,me,Mn.data):ht.isCompressedArrayTexture?rt.compressedTexSubImage3D(oe,at,st.x,st.y,st.z,Ht,Xt,re,Zt,Mn.data):rt.texSubImage3D(oe,at,st.x,st.y,st.z,Ht,Xt,re,Zt,me,Mn),rt.pixelStorei(rt.UNPACK_ROW_LENGTH,ae),rt.pixelStorei(rt.UNPACK_IMAGE_HEIGHT,un),rt.pixelStorei(rt.UNPACK_SKIP_PIXELS,vr),rt.pixelStorei(rt.UNPACK_SKIP_ROWS,Bn),rt.pixelStorei(rt.UNPACK_SKIP_IMAGES,ti),at===0&&ht.generateMipmaps&&rt.generateMipmap(oe),Wt.unbindTexture()},this.initTexture=function(q){q.isCubeTexture?Lt.setTextureCube(q,0):q.isData3DTexture?Lt.setTexture3D(q,0):q.isDataArrayTexture||q.isCompressedArrayTexture?Lt.setTexture2DArray(q,0):Lt.setTexture2D(q,0),Wt.unbindTexture()},this.resetState=function(){G=0,z=0,F=null,Wt.reset(),B.reset()},typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return ss}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(t){this._outputColorSpace=t;let e=this.getContext();e.drawingBufferColorSpace=t===Ym?"display-p3":"srgb",e.unpackColorSpace=Cn.workingColorSpace===Yf?"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}},Rm=class extends Im{};Rm.prototype.isWebGL1Renderer=!0;var Lm=class{constructor(t,e){this.isInterleavedBuffer=!0,this.array=t,this.stride=e,this.count=t!==void 0?t.length/e:0,this.usage=lm,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.version=0,this.uuid=Ns()}onUploadCallback(){}set needsUpdate(t){t===!0&&this.version++}get updateRange(){return aM("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 a=0,l=this.stride;a<l;a++)this.array[t+a]=e.array[o+a];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=Ns()),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=Ns()),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}}},ci=new yt,Wf=class r{constructor(t,e,o,a=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=t,this.itemSize=e,this.offset=o,this.normalized=a}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++)ci.fromBufferAttribute(this,e),ci.applyMatrix4(t),this.setXYZ(e,ci.x,ci.y,ci.z);return this}applyNormalMatrix(t){for(let e=0,o=this.count;e<o;e++)ci.fromBufferAttribute(this,e),ci.applyNormalMatrix(t),this.setXYZ(e,ci.x,ci.y,ci.z);return this}transformDirection(t){for(let e=0,o=this.count;e<o;e++)ci.fromBufferAttribute(this,e),ci.transformDirection(t),this.setXYZ(e,ci.x,ci.y,ci.z);return this}getComponent(t,e){let o=this.array[t*this.data.stride+this.offset+e];return this.normalized&&(o=Po(o,this.array)),o}setComponent(t,e,o){return this.normalized&&(o=An(o,this.array)),this.data.array[t*this.data.stride+this.offset+e]=o,this}setX(t,e){return this.normalized&&(e=An(e,this.array)),this.data.array[t*this.data.stride+this.offset]=e,this}setY(t,e){return this.normalized&&(e=An(e,this.array)),this.data.array[t*this.data.stride+this.offset+1]=e,this}setZ(t,e){return this.normalized&&(e=An(e,this.array)),this.data.array[t*this.data.stride+this.offset+2]=e,this}setW(t,e){return this.normalized&&(e=An(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=Po(e,this.array)),e}getY(t){let e=this.data.array[t*this.data.stride+this.offset+1];return this.normalized&&(e=Po(e,this.array)),e}getZ(t){let e=this.data.array[t*this.data.stride+this.offset+2];return this.normalized&&(e=Po(e,this.array)),e}getW(t){let e=this.data.array[t*this.data.stride+this.offset+3];return this.normalized&&(e=Po(e,this.array)),e}setXY(t,e,o){return t=t*this.data.stride+this.offset,this.normalized&&(e=An(e,this.array),o=An(o,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=o,this}setXYZ(t,e,o,a){return t=t*this.data.stride+this.offset,this.normalized&&(e=An(e,this.array),o=An(o,this.array),a=An(a,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=o,this.data.array[t+2]=a,this}setXYZW(t,e,o,a,l){return t=t*this.data.stride+this.offset,this.normalized&&(e=An(e,this.array),o=An(o,this.array),a=An(a,this.array),l=An(l,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=o,this.data.array[t+2]=a,this.data.array[t+3]=l,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 a=o*this.data.stride+this.offset;for(let l=0;l<this.itemSize;l++)e.push(this.data.array[a+l])}return new Ni(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 r(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 a=o*this.data.stride+this.offset;for(let l=0;l<this.itemSize;l++)e.push(this.data.array[a+l])}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}}},Nm=class extends Ea{constructor(t){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new vn(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}},As,Pl=new yt,du=new yt,mu=new yt,gu=new ye,Il=new ye,gM=new cr,xf=new yt,Rl=new yt,Ef=new yt,YE=new ye,nm=new ye,$E=new ye,Om=class extends po{constructor(t=new Nm){if(super(),this.isSprite=!0,this.type="Sprite",As===void 0){As=new Us;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 Lm(e,5);As.setIndex([0,1,2,0,2,3]),As.setAttribute("position",new Wf(o,3,0,!1)),As.setAttribute("uv",new Wf(o,2,3,!1))}this.geometry=As,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.'),du.setFromMatrixScale(this.matrixWorld),gM.copy(t.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(t.camera.matrixWorldInverse,this.matrixWorld),mu.setFromMatrixPosition(this.modelViewMatrix),t.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&du.multiplyScalar(-mu.z);let o=this.material.rotation,a,l;o!==0&&(l=Math.cos(o),a=Math.sin(o));let h=this.center;Mf(xf.set(-.5,-.5,0),mu,h,du,a,l),Mf(Rl.set(.5,-.5,0),mu,h,du,a,l),Mf(Ef.set(.5,.5,0),mu,h,du,a,l),YE.set(0,0),nm.set(1,0),$E.set(1,1);let f=t.ray.intersectTriangle(xf,Rl,Ef,!1,Pl);if(f===null&&(Mf(Rl.set(-.5,.5,0),mu,h,du,a,l),nm.set(0,1),f=t.ray.intersectTriangle(xf,Ef,Rl,!1,Pl),f===null))return;let p=t.ray.origin.distanceTo(Pl);p<t.near||p>t.far||e.push({distance:p,point:Pl.clone(),uv:ga.getInterpolation(Pl,xf,Rl,Ef,YE,nm,$E,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}};Om.Dispose=function(){As.dispose(),As=void 0};function Mf(r,t,e,o,a,l){gu.subVectors(r,e).addScalar(.5).multiply(o),a!==void 0?(Il.x=l*gu.x-a*gu.y,Il.y=a*gu.x+l*gu.y):Il.copy(gu),r.copy(t),r.x+=Il.x,r.y+=Il.y,r.applyMatrix4(gM)}function Sf(r,t,e){return!r||!e&&r.constructor===t?r:typeof t.BYTES_PER_ELEMENT=="number"?new t(r):Array.prototype.slice.call(r)}function IU(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}var Au=class{constructor(t,e,o,a){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=a!==void 0?a:new e.constructor(o),this.sampleValues=e,this.valueSize=o,this.settings=null,this.DefaultSettings_={}}evaluate(t){let e=this.parameterPositions,o=this._cachedIndex,a=e[o],l=e[o-1];n:{t:{let h;e:{r:if(!(t<a)){for(let f=o+2;;){if(a===void 0){if(t<l)break r;return o=e.length,this._cachedIndex=o,this.copySampleValue_(o-1)}if(o===f)break;if(l=a,a=e[++o],t<a)break t}h=e.length;break e}if(!(t>=l)){let f=e[1];t<f&&(o=2,l=f);for(let p=o-2;;){if(l===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(o===p)break;if(a=l,l=e[--o-1],t>=l)break t}h=o,o=0;break e}break n}for(;o<h;){let f=o+h>>>1;t<e[f]?h=f:o=f+1}if(a=e[o],l=e[o-1],l===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(a===void 0)return o=e.length,this._cachedIndex=o,this.copySampleValue_(o-1)}this._cachedIndex=o,this.intervalChanged_(o,l,a)}return this.interpolate_(o,l,t,a)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){let e=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=t*a;for(let h=0;h!==a;++h)e[h]=o[l+h];return e}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}},Dm=class extends Au{constructor(t,e,o,a){super(t,e,o,a),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:nE,endingEnd:nE}}intervalChanged_(t,e,o){let a=this.parameterPositions,l=t-2,h=t+1,f=a[l],p=a[h];if(f===void 0)switch(this.getSettings_().endingStart){case rE:l=t,f=2*e-o;break;case iE:l=a.length-2,f=e+a[l]-a[l+1];break;default:l=t,f=o}if(p===void 0)switch(this.getSettings_().endingEnd){case rE:h=t,p=2*o-e;break;case iE:h=1,p=o+a[1]-a[0];break;default:h=t-1,p=e}let d=(o-e)*.5,g=this.valueSize;this._weightPrev=d/(e-f),this._weightNext=d/(p-o),this._offsetPrev=l*g,this._offsetNext=h*g}interpolate_(t,e,o,a){let l=this.resultBuffer,h=this.sampleValues,f=this.valueSize,p=t*f,d=p-f,g=this._offsetPrev,x=this._offsetNext,v=this._weightPrev,M=this._weightNext,b=(o-e)/(a-e),T=b*b,_=T*b,y=-v*_+2*v*T-v*b,A=(1+v)*_+(-1.5-2*v)*T+(-.5+v)*b+1,S=(-1-M)*_+(1.5+M)*T+.5*b,L=M*_-M*T;for(let G=0;G!==f;++G)l[G]=y*h[g+G]+A*h[d+G]+S*h[p+G]+L*h[x+G];return l}},Fm=class extends Au{constructor(t,e,o,a){super(t,e,o,a)}interpolate_(t,e,o,a){let l=this.resultBuffer,h=this.sampleValues,f=this.valueSize,p=t*f,d=p-f,g=(o-e)/(a-e),x=1-g;for(let v=0;v!==f;++v)l[v]=h[d+v]*x+h[p+v]*g;return l}},Um=class extends Au{constructor(t,e,o,a){super(t,e,o,a)}interpolate_(t){return this.copySampleValue_(t-1)}},mo=class{constructor(t,e,o,a){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=Sf(e,this.TimeBufferType),this.values=Sf(o,this.ValueBufferType),this.setInterpolation(a||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:Sf(t.times,Array),values:Sf(t.values,Array)};let a=t.getInterpolation();a!==t.DefaultInterpolation&&(o.interpolation=a)}return o.type=t.ValueTypeName,o}InterpolantFactoryMethodDiscrete(t){return new Um(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new Fm(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new Dm(this.times,this.values,this.getValueSize(),t)}setInterpolation(t){let e;switch(t){case bf:e=this.InterpolantFactoryMethodDiscrete;break;case Tf:e=this.InterpolantFactoryMethodLinear;break;case Pd: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 bf;case this.InterpolantFactoryMethodLinear:return Tf;case this.InterpolantFactoryMethodSmooth:return Pd}}getValueSize(){return this.values.length/this.times.length}shift(t){if(t!==0){let e=this.times;for(let o=0,a=e.length;o!==a;++o)e[o]+=t}return this}scale(t){if(t!==1){let e=this.times;for(let o=0,a=e.length;o!==a;++o)e[o]*=t}return this}trim(t,e){let o=this.times,a=o.length,l=0,h=a-1;for(;l!==a&&o[l]<t;)++l;for(;h!==-1&&o[h]>e;)--h;if(++h,l!==0||h!==a){l>=h&&(h=Math.max(h,1),l=h-1);let f=this.getValueSize();this.times=o.slice(l,h),this.values=this.values.slice(l*f,h*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,a=this.values,l=o.length;l===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let h=null;for(let f=0;f!==l;f++){let p=o[f];if(typeof p=="number"&&isNaN(p)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,f,p),t=!1;break}if(h!==null&&h>p){console.error("THREE.KeyframeTrack: Out of order keys.",this,f,p,h),t=!1;break}h=p}if(a!==void 0&&IU(a))for(let f=0,p=a.length;f!==p;++f){let d=a[f];if(isNaN(d)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,f,d),t=!1;break}}return t}optimize(){let t=this.times.slice(),e=this.values.slice(),o=this.getValueSize(),a=this.getInterpolation()===Pd,l=t.length-1,h=1;for(let f=1;f<l;++f){let p=!1,d=t[f],g=t[f+1];if(d!==g&&(f!==1||d!==t[0]))if(a)p=!0;else{let x=f*o,v=x-o,M=x+o;for(let b=0;b!==o;++b){let T=e[x+b];if(T!==e[v+b]||T!==e[M+b]){p=!0;break}}}if(p){if(f!==h){t[h]=t[f];let x=f*o,v=h*o;for(let M=0;M!==o;++M)e[v+M]=e[x+M]}++h}}if(l>0){t[h]=t[l];for(let f=l*o,p=h*o,d=0;d!==o;++d)e[p+d]=e[f+d];++h}return h!==t.length?(this.times=t.slice(0,h),this.values=e.slice(0,h*o)):(this.times=t,this.values=e),this}clone(){let t=this.times.slice(),e=this.values.slice(),o=this.constructor,a=new o(this.name,t,e);return a.createInterpolant=this.createInterpolant,a}};mo.prototype.TimeBufferType=Float32Array;mo.prototype.ValueBufferType=Float32Array;mo.prototype.DefaultInterpolation=Tf;var Ma=class extends mo{};Ma.prototype.ValueTypeName="bool";Ma.prototype.ValueBufferType=Array;Ma.prototype.DefaultInterpolation=bf;Ma.prototype.InterpolantFactoryMethodLinear=void 0;Ma.prototype.InterpolantFactoryMethodSmooth=void 0;var Bm=class extends mo{};Bm.prototype.ValueTypeName="color";var zm=class extends mo{};zm.prototype.ValueTypeName="number";var Gm=class extends Au{constructor(t,e,o,a){super(t,e,o,a)}interpolate_(t,e,o,a){let l=this.resultBuffer,h=this.sampleValues,f=this.valueSize,p=(o-e)/(a-e),d=t*f;for(let g=d+f;d!==g;d+=4)Fs.slerpFlat(l,0,h,d-f,h,d,p);return l}},Fl=class extends mo{InterpolantFactoryMethodLinear(t){return new Gm(this.times,this.values,this.getValueSize(),t)}};Fl.prototype.ValueTypeName="quaternion";Fl.prototype.DefaultInterpolation=Tf;Fl.prototype.InterpolantFactoryMethodSmooth=void 0;var Sa=class extends mo{};Sa.prototype.ValueTypeName="string";Sa.prototype.ValueBufferType=Array;Sa.prototype.DefaultInterpolation=bf;Sa.prototype.InterpolantFactoryMethodLinear=void 0;Sa.prototype.InterpolantFactoryMethodSmooth=void 0;var km=class extends mo{};km.prototype.ValueTypeName="vector";var qm=class{constructor(t,e,o){let a=this,l=!1,h=0,f=0,p,d=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=o,this.itemStart=function(g){f++,l===!1&&a.onStart!==void 0&&a.onStart(g,h,f),l=!0},this.itemEnd=function(g){h++,a.onProgress!==void 0&&a.onProgress(g,h,f),h===f&&(l=!1,a.onLoad!==void 0&&a.onLoad())},this.itemError=function(g){a.onError!==void 0&&a.onError(g)},this.resolveURL=function(g){return p?p(g):g},this.setURLModifier=function(g){return p=g,this},this.addHandler=function(g,x){return d.push(g,x),this},this.removeHandler=function(g){let x=d.indexOf(g);return x!==-1&&d.splice(x,2),this},this.getHandler=function(g){for(let x=0,v=d.length;x<v;x+=2){let M=d[x],b=d[x+1];if(M.global&&(M.lastIndex=0),M.test(g))return b}return null}}},RU=new qm,Vm=class{constructor(t){this.manager=t!==void 0?t:RU,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(t,e){let o=this;return new Promise(function(a,l){o.load(t,a,e,l)})}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}};Vm.DEFAULT_MATERIAL_NAME="__DEFAULT";var Zm="\\[\\]\\.:\\/",LU=new RegExp("["+Zm+"]","g"),Jm="[^"+Zm+"]",NU="[^"+Zm.replace("\\.","")+"]",OU=/((?:WC+[\/:])*)/.source.replace("WC",Jm),DU=/(WCOD+)?/.source.replace("WCOD",NU),FU=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Jm),UU=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Jm),BU=new RegExp("^"+OU+DU+FU+UU+"$"),zU=["material","materials","bones","map"],Hm=class{constructor(t,e,o){let a=o||Vn.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,a)}getValue(t,e){this.bind();let o=this._targetGroup.nCachedObjects_,a=this._bindings[o];a!==void 0&&a.getValue(t,e)}setValue(t,e){let o=this._bindings;for(let a=this._targetGroup.nCachedObjects_,l=o.length;a!==l;++a)o[a].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()}},Vn=class r{constructor(t,e,o){this.path=e,this.parsedPath=o||r.parseTrackName(e),this.node=r.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 r.Composite(t,e,o):new r(t,e,o)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(LU,"")}static parseTrackName(t){let e=BU.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]},a=o.nodeName&&o.nodeName.lastIndexOf(".");if(a!==void 0&&a!==-1){let l=o.nodeName.substring(a+1);zU.indexOf(l)!==-1&&(o.nodeName=o.nodeName.substring(0,a),o.objectName=l)}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(l){for(let h=0;h<l.length;h++){let f=l[h];if(f.name===e||f.uuid===e)return f;let p=o(f.children);if(p)return p}return null},a=o(t.children);if(a)return a}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 a=0,l=o.length;a!==l;++a)t[e++]=o[a]}_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 a=0,l=o.length;a!==l;++a)o[a]=t[e++]}_setValue_array_setNeedsUpdate(t,e){let o=this.resolvedProperty;for(let a=0,l=o.length;a!==l;++a)o[a]=t[e++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,e){let o=this.resolvedProperty;for(let a=0,l=o.length;a!==l;++a)o[a]=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,a=e.propertyName,l=e.propertyIndex;if(t||(t=r.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 d=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 g=0;g<t.length;g++)if(t[g].name===d){d=g;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(d!==void 0){if(t[d]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);return}t=t[d]}}let h=t[a];if(h===void 0){let d=e.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+d+"."+a+" 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 p=this.BindingType.Direct;if(l!==void 0){if(a==="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[l]!==void 0&&(l=t.morphTargetDictionary[l])}p=this.BindingType.ArrayElement,this.resolvedProperty=h,this.propertyIndex=l}else h.fromArray!==void 0&&h.toArray!==void 0?(p=this.BindingType.HasFromToArray,this.resolvedProperty=h):Array.isArray(h)?(p=this.BindingType.EntireArray,this.resolvedProperty=h):this.propertyName=a;this.getValue=this.GetterByBindingType[p],this.setValue=this.SetterByBindingTypeAndVersioning[p][f]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};Vn.Composite=Hm;Vn.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};Vn.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};Vn.prototype.GetterByBindingType=[Vn.prototype._getValue_direct,Vn.prototype._getValue_array,Vn.prototype._getValue_arrayElement,Vn.prototype._getValue_toArray];Vn.prototype.SetterByBindingTypeAndVersioning=[[Vn.prototype._setValue_direct,Vn.prototype._setValue_direct_setNeedsUpdate,Vn.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Vn.prototype._setValue_array,Vn.prototype._setValue_array_setNeedsUpdate,Vn.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Vn.prototype._setValue_arrayElement,Vn.prototype._setValue_arrayElement_setNeedsUpdate,Vn.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Vn.prototype._setValue_fromArray,Vn.prototype._setValue_fromArray_setNeedsUpdate,Vn.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var SH=new Float32Array(1);typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Wm}}));typeof window!="undefined"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Wm);var Cr=63710088e-1,TH={centimeters:Cr*100,centimetres:Cr*100,degrees:Cr/111325,feet:Cr*3.28084,inches:Cr*39.37,kilometers:Cr/1e3,kilometres:Cr/1e3,meters:Cr,metres:Cr,miles:Cr/1609.344,millimeters:Cr*1e3,millimetres:Cr*1e3,nauticalmiles:Cr/1852,radians:1,yards:Cr*1.0936},AH={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/Cr,yards:1.0936133};function pi(r,t,e){e===void 0&&(e={});var o={type:"Feature"};return(e.id===0||e.id)&&(o.id=e.id),e.bbox&&(o.bbox=e.bbox),o.properties=t||{},o.geometry=r,o}function Nn(r,t,e){if(e===void 0&&(e={}),!r)throw new Error("coordinates is required");if(!Array.isArray(r))throw new Error("coordinates must be an Array");if(r.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Ro(r[0])||!Ro(r[1]))throw new Error("coordinates must contain numbers");var o={type:"Point",coordinates:r};return pi(o,t,e)}function Hn(r,t,e){e===void 0&&(e={});for(var o=0,a=r;o<a.length;o++){var l=a[o];if(l.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var h=0;h<l[l.length-1].length;h++)if(l[l.length-1][h]!==l[0][h])throw new Error("First and last Position are not equivalent.")}var f={type:"Polygon",coordinates:r};return pi(f,t,e)}function Pr(r,t,e){if(e===void 0&&(e={}),r.length<2)throw new Error("coordinates must be an array of two or more positions");var o={type:"LineString",coordinates:r};return pi(o,t,e)}function Km(r,t,e){e===void 0&&(e={});var o={type:"MultiPoint",coordinates:r};return pi(o,t,e)}function Ro(r){return!isNaN(r)&&r!==null&&!Array.isArray(r)}function pr(r,t,e){if(r!==null)for(var o,a,l,h,f,p,d,g=0,x=0,v,M=r.type,b=M==="FeatureCollection",T=M==="Feature",_=b?r.features.length:1,y=0;y<_;y++){d=b?r.features[y].geometry:T?r.geometry:r,v=d?d.type==="GeometryCollection":!1,f=v?d.geometries.length:1;for(var A=0;A<f;A++){var S=0,L=0;if(h=v?d.geometries[A]:d,h!==null){p=h.coordinates;var G=h.type;switch(g=e&&(G==="Polygon"||G==="MultiPolygon")?1:0,G){case null:break;case"Point":if(t(p,x,y,S,L)===!1)return!1;x++,S++;break;case"LineString":case"MultiPoint":for(o=0;o<p.length;o++){if(t(p[o],x,y,S,L)===!1)return!1;x++,G==="MultiPoint"&&S++}G==="LineString"&&S++;break;case"Polygon":case"MultiLineString":for(o=0;o<p.length;o++){for(a=0;a<p[o].length-g;a++){if(t(p[o][a],x,y,S,L)===!1)return!1;x++}G==="MultiLineString"&&S++,G==="Polygon"&&L++}G==="Polygon"&&S++;break;case"MultiPolygon":for(o=0;o<p.length;o++){for(L=0,a=0;a<p[o].length;a++){for(l=0;l<p[o][a].length-g;l++){if(t(p[o][a][l],x,y,S,L)===!1)return!1;x++}L++}S++}break;case"GeometryCollection":for(o=0;o<h.geometries.length;o++)if(pr(h.geometries[o],t,e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function yM(r,t,e,o){var a=e;return pr(r,function(l,h,f,p,d){h===0&&e===void 0?a=l:a=t(a,l,h,f,p,d)},o),a}function zs(r,t){var e,o,a,l,h,f,p,d,g,x,v=0,M=r.type==="FeatureCollection",b=r.type==="Feature",T=M?r.features.length:1;for(e=0;e<T;e++){for(f=M?r.features[e].geometry:b?r.geometry:r,d=M?r.features[e].properties:b?r.properties:{},g=M?r.features[e].bbox:b?r.bbox:void 0,x=M?r.features[e].id:b?r.id:void 0,p=f?f.type==="GeometryCollection":!1,h=p?f.geometries.length:1,a=0;a<h;a++){if(l=p?f.geometries[a]:f,l===null){if(t(null,v,d,g,x)===!1)return!1;continue}switch(l.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(t(l,v,d,g,x)===!1)return!1;break}case"GeometryCollection":{for(o=0;o<l.geometries.length;o++)if(t(l.geometries[o],v,d,g,x)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}v++}}function Oi(r,t){zs(r,function(e,o,a,l,h){var f=e===null?null:e.type;switch(f){case null:case"Point":case"LineString":case"Polygon":return t(pi(e,a,{bbox:l,id:h}),o,0)===!1?!1:void 0}var p;switch(f){case"MultiPoint":p="Point";break;case"MultiLineString":p="LineString";break;case"MultiPolygon":p="Polygon";break}for(var d=0;d<e.coordinates.length;d++){var g=e.coordinates[d],x={type:p,coordinates:g};if(t(pi(x,a),o,d)===!1)return!1}})}function jm(r){var t=[1/0,1/0,-1/0,-1/0];return pr(r,function(e){t[0]>e[0]&&(t[0]=e[0]),t[1]>e[1]&&(t[1]=e[1]),t[2]<e[0]&&(t[2]=e[0]),t[3]<e[1]&&(t[3]=e[1])}),t}jm.default=jm;var di=jm;function Gr(r){if(!r)throw new Error("coord is required");if(!Array.isArray(r)){if(r.type==="Feature"&&r.geometry!==null&&r.geometry.type==="Point")return r.geometry.coordinates;if(r.type==="Point")return r.coordinates}if(Array.isArray(r)&&r.length>=2&&!Array.isArray(r[0])&&!Array.isArray(r[1]))return r;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function Qm(r,t,e){if(!r)throw new Error("No feature passed");if(!e)throw new Error(".featureOf() requires a name");if(!r||r.type!=="Feature"||!r.geometry)throw new Error("Invalid input to "+e+", Feature with geometry required");if(!r.geometry||r.geometry.type!==t)throw new Error("Invalid input to "+e+": must be a "+t+", given "+r.geometry.type)}function kr(r){return r.type==="Feature"?r.geometry:r}var YU=yn(Zf(),1);var rB=yn(DM(),1);function Ir(r,t,e){if(e===void 0&&(e={}),!r)throw new Error("point is required");if(!t)throw new Error("polygon is required");var o=Gr(r),a=kr(t),l=a.type,h=t.bbox,f=a.coordinates;if(h&&iB(o,h)===!1)return!1;l==="Polygon"&&(f=[f]);for(var p=!1,d=0;d<f.length&&!p;d++)if(FM(o,f[d][0],e.ignoreBoundary)){for(var g=!1,x=1;x<f[d].length&&!g;)FM(o,f[d][x],!e.ignoreBoundary)&&(g=!0),x++;g||(p=!0)}return p}function FM(r,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 a=0,l=t.length-1;a<t.length;l=a++){var h=t[a][0],f=t[a][1],p=t[l][0],d=t[l][1],g=r[1]*(h-p)+f*(p-r[0])+d*(r[0]-h)===0&&(h-r[0])*(p-r[0])<=0&&(f-r[1])*(d-r[1])<=0;if(g)return!e;var x=f>r[1]!=d>r[1]&&r[0]<(p-h)*(r[1]-f)/(d-f)+h;x&&(o=!o)}return o}function iB(r,t){return t[0]<=r[0]&&t[1]<=r[1]&&t[2]>=r[0]&&t[3]>=r[1]}var zM=new ArrayBuffer(16),n8=new Float64Array(zM),r8=new Uint32Array(zM);var _B=yn(mg(),1);var PW=function(){function r(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],a=this.points[e+1];this.centers.push({x:(o.x+a.x)/2,y:(o.y+a.y)/2,z:(o.z+a.z)/2})}this.controls.push([this.points[0],this.points[0]]);for(var e=0;e<this.centers.length-1;e++){var l=this.points[e+1].x-(this.centers[e].x+this.centers[e+1].x)/2,h=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+l),y:(1-this.sharpness)*this.points[e+1].y+this.sharpness*(this.centers[e].y+h),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+l),y:(1-this.sharpness)*this.points[e+1].y+this.sharpness*(this.centers[e+1].y+h),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 r.prototype.cacheSteps=function(t){var e=[],o=this.pos(0);e.push(0);for(var a=0;a<this.duration;a+=10){var l=this.pos(a),h=Math.sqrt((l.x-o.x)*(l.x-o.x)+(l.y-o.y)*(l.y-o.y)+(l.z-o.z)*(l.z-o.z));h>t&&(e.push(a),o=l)}return e},r.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))}},r.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 a=Math.floor((this.points.length-1)*o),l=(this.length-1)*o-a;return xB(l,this.points[a],this.controls[a][1],this.controls[a+1][0],this.points[a+1])},r}();function xB(r,t,e,o,a){var l=EB(r),h={x:a.x*l[0]+o.x*l[1]+e.x*l[2]+t.x*l[3],y:a.y*l[0]+o.y*l[1]+e.y*l[2]+t.y*l[3],z:a.z*l[0]+o.z*l[1]+e.z*l[2]+t.z*l[3]};return h}function EB(r){var t=r*r,e=t*r;return[e,3*t*(1-r),3*r*(1-r)*(1-r),(1-r)*(1-r)*(1-r)]}function Gl(r,t){t===void 0&&(t={});var e=Number(r[0]),o=Number(r[1]),a=Number(r[2]),l=Number(r[3]);if(r.length===6)throw new Error("@turf/bbox-polygon does not support BBox with 6 positions");var h=[e,o],f=[e,l],p=[a,l],d=[a,o];return Hn([[h,d,p,f,h]],t.properties,{bbox:r,id:t.id})}function MB(r){return Gl(di(r))}var gg=MB;var zB=yn(JM(),1);var hz=yn(hh(),1);var dz=yn(Zf(),1);var yz=yn(mg(),1);var dS=Math.PI/180,mS=180/Math.PI,Yl=function(r,t){this.lon=r,this.lat=t,this.x=dS*r,this.y=dS*t};Yl.prototype.view=function(){return String(this.lon).slice(0,4)+","+String(this.lat).slice(0,4)};Yl.prototype.antipode=function(){var r=-1*this.lat,t=this.lon<0?180+this.lon:(180-this.lon)*-1;return new Yl(t,r)};var gS=function(){this.coords=[],this.length=0};gS.prototype.move_to=function(r){this.length++,this.coords.push(r)};var Fg=function(r){this.properties=r||{},this.geometries=[]};Fg.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 r=[],t=0;t<this.geometries.length;t++)r.push(this.geometries[t].coords);return{geometry:{type:"MultiLineString",coordinates:r},type:"Feature",properties:this.properties}};Fg.prototype.wkt=function(){for(var r="",t="LINESTRING(",e=function(l){t+=l[0]+" "+l[1]+","},o=0;o<this.geometries.length;o++){if(this.geometries[o].coords.length===0)return"LINESTRING(empty)";var a=this.geometries[o].coords;a.forEach(e),r+=t.substring(0,t.length-1)+")"}return r};var yS=function(r,t,e){if(!r||r.x===void 0||r.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 Yl(r.x,r.y),this.end=new Yl(t.x,t.y),this.properties=e||{};var o=this.start.x-this.end.x,a=this.start.y-this.end.y,l=Math.pow(Math.sin(a/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(l)),this.g===Math.PI)throw new Error("it appears "+r.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 "+r+" and "+t)};yS.prototype.interpolate=function(r){var t=Math.sin((1-r)*this.g)/Math.sin(this.g),e=Math.sin(r*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),a=t*Math.cos(this.start.y)*Math.sin(this.start.x)+e*Math.cos(this.end.y)*Math.sin(this.end.x),l=t*Math.sin(this.start.y)+e*Math.sin(this.end.y),h=mS*Math.atan2(l,Math.sqrt(Math.pow(o,2)+Math.pow(a,2))),f=mS*Math.atan2(a,o);return[f,h]};yS.prototype.Arc=function(r,t){var e=[];if(!r||r<=2)e.push([this.start.lon,this.start.lat]),e.push([this.end.lon,this.end.lat]);else for(var o=1/(r-1),a=0;a<r;++a){var l=o*a,h=this.interpolate(l);e.push(h)}for(var f=!1,p=0,d=t&&t.offset?t.offset:10,g=180-d,x=-180+d,v=360-d,M=1;M<e.length;++M){var b=e[M-1][0],T=e[M][0],_=Math.abs(T-b);_>v&&(T>g&&b<x||b>g&&T<x)?f=!0:_>p&&(p=_)}var y=[];if(f&&p<d){var A=[];y.push(A);for(var S=0;S<e.length;++S){var L=parseFloat(e[S][0]);if(S>0&&Math.abs(L-e[S-1][0])>v){var G=parseFloat(e[S-1][0]),z=parseFloat(e[S-1][1]),F=parseFloat(e[S][0]),I=parseFloat(e[S][1]);if(G>-180&&G<x&&F===180&&S+1<e.length&&e[S-1][0]>-180&&e[S-1][0]<x){A.push([-180,e[S][1]]),S++,A.push([e[S][0],e[S][1]]);continue}else if(G>g&&G<180&&F===-180&&S+1<e.length&&e[S-1][0]>g&&e[S-1][0]<180){A.push([180,e[S][1]]),S++,A.push([e[S][0],e[S][1]]);continue}if(G<x&&F>g){var ut=G;G=F,F=ut;var R=z;z=I,I=R}if(G>g&&F<x&&(F+=360),G<=180&&F>=180&&G<F){var W=(180-G)/(F-G),V=W*I+(1-W)*z;A.push([e[S-1][0]>g?180:-180,V]),A=[],A.push([e[S-1][0]>g?-180:180,V]),y.push(A)}else A=[],y.push(A);A.push([L,e[S][1]])}else A.push([e[S][0],e[S][1]])}}else{var Mt=[];y.push(Mt);for(var X=0;X<e.length;++X)Mt.push([e[X][0],e[X][1]])}for(var mt=new Fg(this.properties),dt=0;dt<y.length;++dt){var _t=new gS;mt.geometries.push(_t);for(var it=y[dt],lt=0;lt<it.length;++lt)_t.move_to(it[lt])}return mt};var xz=yn(hh(),1);var _k=yn(hh(),1);var xk=yn(c0(),1);var Sk=yn(Zf(),1);var be=[],Te=[],Ae=[],Ce=[],Pe=[],Ie=[],Re=[],Le=[],Ne=[],Oe=[],De=[],Fe=[],Ue=[],Be=[],ze=[],Ge=[],ke=[],qe=[],Ve=[],He=[],We=[],Xe=[],Ye=[],$e=[];Re[85]=Oe[85]=-1;Le[85]=De[85]=0;Ne[85]=Fe[85]=1;Ve[85]=Xe[85]=1;He[85]=Ye[85]=0;We[85]=$e[85]=1;be[85]=Ce[85]=0;Te[85]=Pe[85]=-1;Ae[85]=ze[85]=0;Ge[85]=Ue[85]=0;ke[85]=Be[85]=1;Ie[85]=qe[85]=1;Xe[1]=Xe[169]=0;Ye[1]=Ye[169]=-1;$e[1]=$e[169]=0;Ue[1]=Ue[169]=-1;Be[1]=Be[169]=0;ze[1]=ze[169]=0;Oe[4]=Oe[166]=0;De[4]=De[166]=-1;Fe[4]=Fe[166]=1;Ge[4]=Ge[166]=1;ke[4]=ke[166]=0;qe[4]=qe[166]=0;Re[16]=Re[154]=0;Le[16]=Le[154]=1;Ne[16]=Ne[154]=1;Ce[16]=Ce[154]=1;Pe[16]=Pe[154]=0;Ie[16]=Ie[154]=1;Ve[64]=Ve[106]=0;He[64]=He[106]=1;We[64]=We[106]=0;be[64]=be[106]=-1;Te[64]=Te[106]=0;Ae[64]=Ae[106]=1;Ve[2]=Ve[168]=0;He[2]=He[168]=-1;We[2]=We[168]=1;Xe[2]=Xe[168]=0;Ye[2]=Ye[168]=-1;$e[2]=$e[168]=0;Ue[2]=Ue[168]=-1;Be[2]=Be[168]=0;ze[2]=ze[168]=0;Ge[2]=Ge[168]=-1;ke[2]=ke[168]=0;qe[2]=qe[168]=1;Re[8]=Re[162]=0;Le[8]=Le[162]=-1;Ne[8]=Ne[162]=0;Oe[8]=Oe[162]=0;De[8]=De[162]=-1;Fe[8]=Fe[162]=1;Ue[8]=Ue[162]=1;Be[8]=Be[162]=0;ze[8]=ze[162]=1;Ge[8]=Ge[162]=1;ke[8]=ke[162]=0;qe[8]=qe[162]=0;Re[32]=Re[138]=0;Le[32]=Le[138]=1;Ne[32]=Ne[138]=1;Oe[32]=Oe[138]=0;De[32]=De[138]=1;Fe[32]=Fe[138]=0;be[32]=be[138]=1;Te[32]=Te[138]=0;Ae[32]=Ae[138]=0;Ce[32]=Ce[138]=1;Pe[32]=Pe[138]=0;Ie[32]=Ie[138]=1;Xe[128]=Xe[42]=0;Ye[128]=Ye[42]=1;$e[128]=$e[42]=1;Ve[128]=Ve[42]=0;He[128]=He[42]=1;We[128]=We[42]=0;be[128]=be[42]=-1;Te[128]=Te[42]=0;Ae[128]=Ae[42]=1;Ce[128]=Ce[42]=-1;Pe[128]=Pe[42]=0;Ie[128]=Ie[42]=0;Oe[5]=Oe[165]=-1;De[5]=De[165]=0;Fe[5]=Fe[165]=0;Xe[5]=Xe[165]=1;Ye[5]=Ye[165]=0;$e[5]=$e[165]=0;Ge[20]=Ge[150]=0;ke[20]=ke[150]=1;qe[20]=qe[150]=1;Ce[20]=Ce[150]=0;Pe[20]=Pe[150]=-1;Ie[20]=Ie[150]=1;Re[80]=Re[90]=-1;Le[80]=Le[90]=0;Ne[80]=Ne[90]=1;Ve[80]=Ve[90]=1;He[80]=He[90]=0;We[80]=We[90]=1;Ue[65]=Ue[105]=0;Be[65]=Be[105]=1;ze[65]=ze[105]=0;be[65]=be[105]=0;Te[65]=Te[105]=-1;Ae[65]=Ae[105]=0;Re[160]=Re[10]=-1;Le[160]=Le[10]=0;Ne[160]=Ne[10]=1;Oe[160]=Oe[10]=-1;De[160]=De[10]=0;Fe[160]=Fe[10]=0;Xe[160]=Xe[10]=1;Ye[160]=Ye[10]=0;$e[160]=$e[10]=0;Ve[160]=Ve[10]=1;He[160]=He[10]=0;We[160]=We[10]=1;Ge[130]=Ge[40]=0;ke[130]=ke[40]=1;qe[130]=qe[40]=1;Ue[130]=Ue[40]=0;Be[130]=Be[40]=1;ze[130]=ze[40]=0;be[130]=be[40]=0;Te[130]=Te[40]=-1;Ae[130]=Ae[40]=0;Ce[130]=Ce[40]=0;Pe[130]=Pe[40]=-1;Ie[130]=Ie[40]=1;Oe[37]=Oe[133]=0;De[37]=De[133]=1;Fe[37]=Fe[133]=1;Xe[37]=Xe[133]=0;Ye[37]=Ye[133]=1;$e[37]=$e[133]=0;be[37]=be[133]=-1;Te[37]=Te[133]=0;Ae[37]=Ae[133]=0;Ce[37]=Ce[133]=1;Pe[37]=Pe[133]=0;Ie[37]=Ie[133]=0;Ge[148]=Ge[22]=-1;ke[148]=ke[22]=0;qe[148]=qe[22]=0;Xe[148]=Xe[22]=0;Ye[148]=Ye[22]=-1;$e[148]=$e[22]=1;Ve[148]=Ve[22]=0;He[148]=He[22]=1;We[148]=We[22]=1;Ce[148]=Ce[22]=-1;Pe[148]=Pe[22]=0;Ie[148]=Ie[22]=1;Re[82]=Re[88]=0;Le[82]=Le[88]=-1;Ne[82]=Ne[88]=1;Ge[82]=Ge[88]=1;ke[82]=ke[88]=0;qe[82]=qe[88]=1;Ue[82]=Ue[88]=-1;Be[82]=Be[88]=0;ze[82]=ze[88]=1;Ve[82]=Ve[88]=0;He[82]=He[88]=-1;We[82]=We[88]=0;Re[73]=Re[97]=0;Le[73]=Le[97]=1;Ne[73]=Ne[97]=0;Oe[73]=Oe[97]=0;De[73]=De[97]=-1;Fe[73]=Fe[97]=0;Ue[73]=Ue[97]=1;Be[73]=Be[97]=0;ze[73]=ze[97]=0;be[73]=be[97]=1;Te[73]=Te[97]=0;Ae[73]=Ae[97]=1;Re[145]=Re[25]=0;Le[145]=Le[25]=-1;Ne[145]=Ne[25]=0;Ue[145]=Ue[25]=1;Be[145]=Be[25]=0;ze[145]=ze[25]=1;Xe[145]=Xe[25]=0;Ye[145]=Ye[25]=1;$e[145]=$e[25]=1;Ce[145]=Ce[25]=-1;Pe[145]=Pe[25]=0;Ie[145]=Ie[25]=0;Oe[70]=Oe[100]=0;De[70]=De[100]=1;Fe[70]=Fe[100]=0;Ge[70]=Ge[100]=-1;ke[70]=ke[100]=0;qe[70]=qe[100]=1;Ve[70]=Ve[100]=0;He[70]=He[100]=-1;We[70]=We[100]=1;be[70]=be[100]=1;Te[70]=Te[100]=0;Ae[70]=Ae[100]=0;Oe[101]=Oe[69]=0;De[101]=De[69]=1;Fe[101]=Fe[69]=0;be[101]=be[69]=1;Te[101]=Te[69]=0;Ae[101]=Ae[69]=0;Xe[149]=Xe[21]=0;Ye[149]=Ye[21]=1;$e[149]=$e[21]=1;Ce[149]=Ce[21]=-1;Pe[149]=Pe[21]=0;Ie[149]=Ie[21]=0;Ge[86]=Ge[84]=-1;ke[86]=ke[84]=0;qe[86]=qe[84]=1;Ve[86]=Ve[84]=0;He[86]=He[84]=-1;We[86]=We[84]=1;Re[89]=Re[81]=0;Le[89]=Le[81]=-1;Ne[89]=Ne[81]=0;Ue[89]=Ue[81]=1;Be[89]=Be[81]=0;ze[89]=ze[81]=1;Re[96]=Re[74]=0;Le[96]=Le[74]=1;Ne[96]=Ne[74]=0;Oe[96]=Oe[74]=-1;De[96]=De[74]=0;Fe[96]=Fe[74]=1;Ve[96]=Ve[74]=1;He[96]=He[74]=0;We[96]=We[74]=0;be[96]=be[74]=1;Te[96]=Te[74]=0;Ae[96]=Ae[74]=1;Re[24]=Re[146]=0;Le[24]=Le[146]=-1;Ne[24]=Ne[146]=1;Ge[24]=Ge[146]=1;ke[24]=ke[146]=0;qe[24]=qe[146]=1;Ue[24]=Ue[146]=0;Be[24]=Be[146]=1;ze[24]=ze[146]=1;Ce[24]=Ce[146]=0;Pe[24]=Pe[146]=-1;Ie[24]=Ie[146]=0;Oe[6]=Oe[164]=-1;De[6]=De[164]=0;Fe[6]=Fe[164]=1;Ge[6]=Ge[164]=-1;ke[6]=ke[164]=0;qe[6]=qe[164]=0;Xe[6]=Xe[164]=0;Ye[6]=Ye[164]=-1;$e[6]=$e[164]=1;Ve[6]=Ve[164]=1;He[6]=He[164]=0;We[6]=We[164]=0;Ue[129]=Ue[41]=0;Be[129]=Be[41]=1;ze[129]=ze[41]=1;Xe[129]=Xe[41]=0;Ye[129]=Ye[41]=1;$e[129]=$e[41]=0;be[129]=be[41]=-1;Te[129]=Te[41]=0;Ae[129]=Ae[41]=0;Ce[129]=Ce[41]=0;Pe[129]=Pe[41]=-1;Ie[129]=Ie[41]=0;Ge[66]=Ge[104]=0;ke[66]=ke[104]=1;qe[66]=qe[104]=0;Ue[66]=Ue[104]=-1;Be[66]=Be[104]=0;ze[66]=ze[104]=1;Ve[66]=Ve[104]=0;He[66]=He[104]=-1;We[66]=We[104]=0;be[66]=be[104]=0;Te[66]=Te[104]=-1;Ae[66]=Ae[104]=1;Re[144]=Re[26]=-1;Le[144]=Le[26]=0;Ne[144]=Ne[26]=0;Xe[144]=Xe[26]=1;Ye[144]=Ye[26]=0;$e[144]=$e[26]=1;Ve[144]=Ve[26]=0;He[144]=He[26]=1;We[144]=We[26]=1;Ce[144]=Ce[26]=-1;Pe[144]=Pe[26]=0;Ie[144]=Ie[26]=1;Oe[36]=Oe[134]=0;De[36]=De[134]=1;Fe[36]=Fe[134]=1;Ge[36]=Ge[134]=0;ke[36]=ke[134]=1;qe[36]=qe[134]=0;be[36]=be[134]=0;Te[36]=Te[134]=-1;Ae[36]=Ae[134]=1;Ce[36]=Ce[134]=1;Pe[36]=Pe[134]=0;Ie[36]=Ie[134]=0;Re[9]=Re[161]=-1;Le[9]=Le[161]=0;Ne[9]=Ne[161]=0;Oe[9]=Oe[161]=0;De[9]=De[161]=-1;Fe[9]=Fe[161]=0;Ue[9]=Ue[161]=1;Be[9]=Be[161]=0;ze[9]=ze[161]=0;Xe[9]=Xe[161]=1;Ye[9]=Ye[161]=0;$e[9]=$e[161]=1;Re[136]=0;Le[136]=1;Ne[136]=1;Oe[136]=0;De[136]=1;Fe[136]=0;Ge[136]=-1;ke[136]=0;qe[136]=1;Ue[136]=-1;Be[136]=0;ze[136]=0;Xe[136]=0;Ye[136]=-1;$e[136]=0;Ve[136]=0;He[136]=-1;We[136]=1;be[136]=1;Te[136]=0;Ae[136]=0;Ce[136]=1;Pe[136]=0;Ie[136]=1;Re[34]=0;Le[34]=-1;Ne[34]=0;Oe[34]=0;De[34]=-1;Fe[34]=1;Ge[34]=1;ke[34]=0;qe[34]=0;Ue[34]=1;Be[34]=0;ze[34]=1;Xe[34]=0;Ye[34]=1;$e[34]=1;Ve[34]=0;He[34]=1;We[34]=0;be[34]=-1;Te[34]=0;Ae[34]=1;Ce[34]=-1;Pe[34]=0;Ie[34]=0;Re[35]=0;Le[35]=1;Ne[35]=1;Oe[35]=0;De[35]=-1;Fe[35]=1;Ge[35]=1;ke[35]=0;qe[35]=0;Ue[35]=-1;Be[35]=0;ze[35]=0;Xe[35]=0;Ye[35]=-1;$e[35]=0;Ve[35]=0;He[35]=1;We[35]=0;be[35]=-1;Te[35]=0;Ae[35]=1;Ce[35]=1;Pe[35]=0;Ie[35]=1;Re[153]=0;Le[153]=1;Ne[153]=1;Ue[153]=-1;Be[153]=0;ze[153]=0;Xe[153]=0;Ye[153]=-1;$e[153]=0;Ce[153]=1;Pe[153]=0;Ie[153]=1;Oe[102]=0;De[102]=-1;Fe[102]=1;Ge[102]=1;ke[102]=0;qe[102]=0;Ve[102]=0;He[102]=1;We[102]=0;be[102]=-1;Te[102]=0;Ae[102]=1;Re[155]=0;Le[155]=-1;Ne[155]=0;Ue[155]=1;Be[155]=0;ze[155]=1;Xe[155]=0;Ye[155]=1;$e[155]=1;Ce[155]=-1;Pe[155]=0;Ie[155]=0;Oe[103]=0;De[103]=1;Fe[103]=0;Ge[103]=-1;ke[103]=0;qe[103]=1;Ve[103]=0;He[103]=-1;We[103]=1;be[103]=1;Te[103]=0;Ae[103]=0;Re[152]=0;Le[152]=1;Ne[152]=1;Ge[152]=-1;ke[152]=0;qe[152]=1;Ue[152]=-1;Be[152]=0;ze[152]=0;Xe[152]=0;Ye[152]=-1;$e[152]=0;Ve[152]=0;He[152]=-1;We[152]=1;Ce[152]=1;Pe[152]=0;Ie[152]=1;Re[156]=0;Le[156]=-1;Ne[156]=1;Ge[156]=1;ke[156]=0;qe[156]=1;Ue[156]=-1;Be[156]=0;ze[156]=0;Xe[156]=0;Ye[156]=-1;$e[156]=0;Ve[156]=0;He[156]=1;We[156]=1;Ce[156]=-1;Pe[156]=0;Ie[156]=1;Re[137]=0;Le[137]=1;Ne[137]=1;Oe[137]=0;De[137]=1;Fe[137]=0;Ue[137]=-1;Be[137]=0;ze[137]=0;Xe[137]=0;Ye[137]=-1;$e[137]=0;be[137]=1;Te[137]=0;Ae[137]=0;Ce[137]=1;Pe[137]=0;Ie[137]=1;Re[139]=0;Le[139]=1;Ne[139]=1;Oe[139]=0;De[139]=-1;Fe[139]=0;Ue[139]=1;Be[139]=0;ze[139]=0;Xe[139]=0;Ye[139]=1;$e[139]=0;be[139]=-1;Te[139]=0;Ae[139]=0;Ce[139]=1;Pe[139]=0;Ie[139]=1;Re[98]=0;Le[98]=-1;Ne[98]=0;Oe[98]=0;De[98]=-1;Fe[98]=1;Ge[98]=1;ke[98]=0;qe[98]=0;Ue[98]=1;Be[98]=0;ze[98]=1;Ve[98]=0;He[98]=1;We[98]=0;be[98]=-1;Te[98]=0;Ae[98]=1;Re[99]=0;Le[99]=1;Ne[99]=0;Oe[99]=0;De[99]=-1;Fe[99]=1;Ge[99]=1;ke[99]=0;qe[99]=0;Ue[99]=-1;Be[99]=0;ze[99]=1;Ve[99]=0;He[99]=-1;We[99]=0;be[99]=1;Te[99]=0;Ae[99]=1;Oe[38]=0;De[38]=-1;Fe[38]=1;Ge[38]=1;ke[38]=0;qe[38]=0;Xe[38]=0;Ye[38]=1;$e[38]=1;Ve[38]=0;He[38]=1;We[38]=0;be[38]=-1;Te[38]=0;Ae[38]=1;Ce[38]=-1;Pe[38]=0;Ie[38]=0;Oe[39]=0;De[39]=1;Fe[39]=1;Ge[39]=-1;ke[39]=0;qe[39]=0;Xe[39]=0;Ye[39]=-1;$e[39]=1;Ve[39]=0;He[39]=1;We[39]=0;be[39]=-1;Te[39]=0;Ae[39]=1;Ce[39]=1;Pe[39]=0;Ie[39]=0;var f0=function(r){return[[r.bottomleft,0],[0,0],[0,r.leftbottom]]},h0=function(r){return[[1,r.rightbottom],[1,0],[r.bottomright,0]]},p0=function(r){return[[r.topright,1],[1,1],[1,r.righttop]]},d0=function(r){return[[0,r.lefttop],[0,1],[r.topleft,1]]},m0=function(r){return[[r.bottomright,0],[r.bottomleft,0],[0,r.leftbottom],[0,r.lefttop]]},g0=function(r){return[[r.bottomright,0],[r.bottomleft,0],[1,r.righttop],[1,r.rightbottom]]},y0=function(r){return[[1,r.righttop],[1,r.rightbottom],[r.topleft,1],[r.topright,1]]},v0=function(r){return[[0,r.leftbottom],[0,r.lefttop],[r.topleft,1],[r.topright,1]]},wk=function(r){return[[0,0],[0,r.leftbottom],[1,r.rightbottom],[1,0]]},bk=function(r){return[[1,0],[r.bottomright,0],[r.topright,1],[1,1]]},Tk=function(r){return[[1,1],[1,r.righttop],[0,r.lefttop],[0,1]]},Ak=function(r){return[[r.bottomleft,0],[0,0],[0,1],[r.topleft,1]]},Ck=function(r){return[[1,r.righttop],[1,r.rightbottom],[0,r.leftbottom],[0,r.lefttop]]},Pk=function(r){return[[r.topleft,1],[r.topright,1],[r.bottomright,0],[r.bottomleft,0]]},Ik=function(){return[[0,0],[0,1],[1,1],[1,0]]},Rk=function(r){return[[1,r.rightbottom],[1,0],[0,0],[0,1],[r.topleft,1]]},Lk=function(r){return[[r.topright,1],[1,1],[1,0],[0,0],[0,r.leftbottom]]},Nk=function(r){return[[1,0],[r.bottomright,0],[0,r.lefttop],[0,1],[1,1]]},Ok=function(r){return[[1,1],[1,r.righttop],[r.bottomleft,0],[0,0],[0,1]]},Dk=function(r){return[[1,r.righttop],[1,r.rightbottom],[0,r.lefttop],[0,1],[r.topleft,1]]},Fk=function(r){return[[1,1],[1,r.righttop],[r.bottomright,0],[r.bottomleft,0],[r.topright,1]]},Uk=function(r){return[[1,r.rightbottom],[1,0],[r.bottomright,0],[0,r.leftbottom],[0,r.lefttop]]},Bk=function(r){return[[r.topright,1],[r.bottomleft,0],[0,0],[0,r.leftbottom],[r.topleft,1]]},zk=function(r){return[[r.bottomright,0],[r.bottomleft,0],[0,r.lefttop],[0,1],[r.topleft,1]]},Gk=function(r){return[[1,1],[1,r.righttop],[0,r.leftbottom],[0,r.lefttop],[r.topright,1]]},kk=function(r){return[[1,r.rightbottom],[1,0],[r.bottomright,0],[r.topleft,1],[r.topright,1]]},qk=function(r){return[[1,r.righttop],[1,r.rightbottom],[r.bottomleft,0],[0,0],[0,r.leftbottom]]},Vk=function(r){return[[1,r.rightbottom],[1,0],[0,0],[0,r.leftbottom],[r.topleft,1],[r.topright,1]]},Hk=function(r){return[[1,1],[1,0],[r.bottomright,0],[0,r.leftbottom],[0,r.lefttop],[r.topright,1]]},Wk=function(r){return[[1,1],[1,r.righttop],[r.bottomright,0],[r.bottomleft,0],[0,r.lefttop],[0,1]]},Xk=function(r){return[[1,r.righttop],[1,r.rightbottom],[r.bottomleft,0],[0,0],[0,1],[r.topleft,1]]},Yk=function(r){return[[1,1],[1,r.righttop],[r.bottomleft,0],[0,0],[0,r.leftbottom],[r.topright,1]]},$k=function(r){return[[1,r.rightbottom],[1,0],[r.bottomright,0],[0,r.lefttop],[0,1],[r.topleft,1]]},Zk=function(r){return[[1,r.righttop],[1,r.rightbottom],[r.bottomright,0],[r.bottomleft,0],[0,r.leftbottom],[0,r.lefttop],[r.topleft,1],[r.topright,1]]},Jk=function(r){return[[1,1],[1,r.righttop],[r.bottomleft,0],[0,0],[0,r.leftbottom],[r.topright,1]]},Kk=function(r){return[[1,r.rightbottom],[1,0],[r.bottomright,0],[0,r.lefttop],[0,1],[r.topleft,1]]},jk=function(r){return[[1,1],[1,r.righttop],[r.bottomright,0],[r.bottomleft,0],[0,r.leftbottom],[0,r.lefttop],[r.topright,1]]},Qk=function(r){return[[1,r.righttop],[1,r.rightbottom],[r.bottomleft,0],[0,0],[0,r.leftbottom],[r.topleft,1],[r.topright,1]]},t4=function(r){return[[1,r.righttop],[1,r.rightbottom],[r.bottomright,0],[r.bottomleft,0],[0,r.lefttop],[0,1],[r.topleft,1]]},e4=function(r){return[[1,r.rightbottom],[1,0],[r.bottomright,0],[0,r.leftbottom],[0,r.lefttop],[r.topleft,1],[r.topright,1]]},je=[],Qe=[],tn=[],en=[],nn=[],rn=[],on=[],sn=[];en[1]=nn[1]=18;en[169]=nn[169]=18;tn[4]=Qe[4]=12;tn[166]=Qe[166]=12;je[16]=sn[16]=4;je[154]=sn[154]=4;rn[64]=on[64]=22;rn[106]=on[106]=22;tn[2]=rn[2]=17;en[2]=nn[2]=18;tn[168]=rn[168]=17;en[168]=nn[168]=18;je[8]=en[8]=9;Qe[8]=tn[8]=12;je[162]=en[162]=9;Qe[162]=tn[162]=12;je[32]=sn[32]=4;Qe[32]=on[32]=1;je[138]=sn[138]=4;Qe[138]=on[138]=1;nn[128]=sn[128]=21;rn[128]=on[128]=22;nn[42]=sn[42]=21;rn[42]=on[42]=22;Qe[5]=nn[5]=14;Qe[165]=nn[165]=14;tn[20]=sn[20]=6;tn[150]=sn[150]=6;je[80]=rn[80]=11;je[90]=rn[90]=11;en[65]=on[65]=3;en[105]=on[105]=3;je[160]=rn[160]=11;Qe[160]=nn[160]=14;je[10]=rn[10]=11;Qe[10]=nn[10]=14;tn[130]=sn[130]=6;en[130]=on[130]=3;tn[40]=sn[40]=6;en[40]=on[40]=3;Qe[101]=on[101]=1;Qe[69]=on[69]=1;nn[149]=sn[149]=21;nn[21]=sn[21]=21;tn[86]=rn[86]=17;tn[84]=rn[84]=17;je[89]=en[89]=9;je[81]=en[81]=9;je[96]=on[96]=0;Qe[96]=rn[96]=15;je[74]=on[74]=0;Qe[74]=rn[74]=15;je[24]=tn[24]=8;en[24]=sn[24]=7;je[146]=tn[146]=8;en[146]=sn[146]=7;Qe[6]=rn[6]=15;tn[6]=nn[6]=16;Qe[164]=rn[164]=15;tn[164]=nn[164]=16;en[129]=sn[129]=7;nn[129]=on[129]=20;en[41]=sn[41]=7;nn[41]=on[41]=20;tn[66]=on[66]=2;en[66]=rn[66]=19;tn[104]=on[104]=2;en[104]=rn[104]=19;je[144]=nn[144]=10;rn[144]=sn[144]=23;je[26]=nn[26]=10;rn[26]=sn[26]=23;Qe[36]=sn[36]=5;tn[36]=on[36]=2;Qe[134]=sn[134]=5;tn[134]=on[134]=2;je[9]=nn[9]=10;Qe[9]=en[9]=13;je[161]=nn[161]=10;Qe[161]=en[161]=13;Qe[37]=sn[37]=5;nn[37]=on[37]=20;Qe[133]=sn[133]=5;nn[133]=on[133]=20;tn[148]=nn[148]=16;rn[148]=sn[148]=23;tn[22]=nn[22]=16;rn[22]=sn[22]=23;je[82]=tn[82]=8;en[82]=rn[82]=19;je[88]=tn[88]=8;en[88]=rn[88]=19;je[73]=on[73]=0;Qe[73]=en[73]=13;je[97]=on[97]=0;Qe[97]=en[97]=13;je[145]=en[145]=9;nn[145]=sn[145]=21;je[25]=en[25]=9;nn[25]=sn[25]=21;Qe[70]=on[70]=1;tn[70]=rn[70]=17;Qe[100]=on[100]=1;tn[100]=rn[100]=17;je[34]=en[34]=9;Qe[34]=tn[34]=12;nn[34]=sn[34]=21;rn[34]=on[34]=22;je[136]=sn[136]=4;Qe[136]=on[136]=1;tn[136]=rn[136]=17;en[136]=nn[136]=18;je[35]=sn[35]=4;Qe[35]=tn[35]=12;en[35]=nn[35]=18;rn[35]=on[35]=22;je[153]=sn[153]=4;en[153]=nn[153]=18;Qe[102]=tn[102]=12;rn[102]=on[102]=22;je[155]=en[155]=9;nn[155]=sn[155]=23;Qe[103]=on[103]=1;tn[103]=rn[103]=17;je[152]=sn[152]=4;tn[152]=rn[152]=17;en[152]=nn[152]=18;je[156]=tn[156]=8;en[156]=nn[156]=18;rn[156]=sn[156]=23;je[137]=sn[137]=4;Qe[137]=on[137]=1;en[137]=nn[137]=18;je[139]=sn[139]=4;Qe[139]=en[139]=13;nn[139]=on[139]=20;je[98]=en[98]=9;Qe[98]=tn[98]=12;rn[98]=on[98]=22;je[99]=on[99]=0;Qe[99]=tn[99]=12;en[99]=rn[99]=19;Qe[38]=tn[38]=12;nn[38]=sn[38]=21;rn[38]=on[38]=22;Qe[39]=sn[39]=5;tn[39]=nn[39]=16;rn[39]=on[39]=22;var Gt=[];Gt[1]=Gt[169]=f0;Gt[4]=Gt[166]=h0;Gt[16]=Gt[154]=p0;Gt[64]=Gt[106]=d0;Gt[168]=Gt[2]=m0;Gt[162]=Gt[8]=g0;Gt[138]=Gt[32]=y0;Gt[42]=Gt[128]=v0;Gt[5]=Gt[165]=wk;Gt[20]=Gt[150]=bk;Gt[80]=Gt[90]=Tk;Gt[65]=Gt[105]=Ak;Gt[160]=Gt[10]=Ck;Gt[130]=Gt[40]=Pk;Gt[85]=Ik;Gt[101]=Gt[69]=Rk;Gt[149]=Gt[21]=Lk;Gt[86]=Gt[84]=Nk;Gt[89]=Gt[81]=Ok;Gt[96]=Gt[74]=Dk;Gt[24]=Gt[146]=Fk;Gt[6]=Gt[164]=Uk;Gt[129]=Gt[41]=Bk;Gt[66]=Gt[104]=zk;Gt[144]=Gt[26]=Gk;Gt[36]=Gt[134]=kk;Gt[9]=Gt[161]=qk;Gt[37]=Gt[133]=Vk;Gt[148]=Gt[22]=Hk;Gt[82]=Gt[88]=Wk;Gt[73]=Gt[97]=Xk;Gt[145]=Gt[25]=Yk;Gt[70]=Gt[100]=$k;Gt[34]=function(r){return[v0(r),g0(r)]};Gt[35]=Zk;Gt[136]=function(r){return[y0(r),m0(r)]};Gt[153]=function(r){return[p0(r),f0(r)]};Gt[102]=function(r){return[h0(r),d0(r)]};Gt[155]=Jk;Gt[103]=Kk;Gt[152]=function(r){return[p0(r),m0(r)]};Gt[156]=jk;Gt[137]=function(r){return[y0(r),f0(r)]};Gt[139]=Qk;Gt[98]=function(r){return[g0(r),d0(r)]};Gt[99]=t4;Gt[38]=function(r){return[h0(r),v0(r)]};Gt[39]=e4;function r4(r){return(r>0)-(r<0)||+r}function Hu(r,t,e){var o=t[0]-r[0],a=t[1]-r[1],l=e[0]-t[0],h=e[1]-t[1];return r4(o*h-l*a)}function iT(r,t){var e=r.geometry.coordinates[0].map(function(h){return h[0]}),o=r.geometry.coordinates[0].map(function(h){return h[1]}),a=t.geometry.coordinates[0].map(function(h){return h[0]}),l=t.geometry.coordinates[0].map(function(h){return h[1]});return Math.max.apply(null,e)===Math.max.apply(null,a)&&Math.max.apply(null,o)===Math.max.apply(null,l)&&Math.min.apply(null,e)===Math.min.apply(null,a)&&Math.min.apply(null,o)===Math.min.apply(null,l)}function _0(r,t){return t.geometry.coordinates[0].every(function(e){return Ir(Nn(e),r)})}function oT(r,t){return r[0]===t[0]&&r[1]===t[1]}var i4=function(){function r(t){this.id=r.buildId(t),this.coordinates=t,this.innerEdges=[],this.outerEdges=[],this.outerEdgesSorted=!1}return r.buildId=function(t){return t.join(",")},r.prototype.removeInnerEdge=function(t){this.innerEdges=this.innerEdges.filter(function(e){return e.from.id!==t.from.id})},r.prototype.removeOuterEdge=function(t){this.outerEdges=this.outerEdges.filter(function(e){return e.to.id!==t.to.id})},r.prototype.addOuterEdge=function(t){this.outerEdges.push(t),this.outerEdgesSorted=!1},r.prototype.sortOuterEdges=function(){var t=this;this.outerEdgesSorted||(this.outerEdges.sort(function(e,o){var a=e.to,l=o.to;if(a.coordinates[0]-t.coordinates[0]>=0&&l.coordinates[0]-t.coordinates[0]<0)return 1;if(a.coordinates[0]-t.coordinates[0]<0&&l.coordinates[0]-t.coordinates[0]>=0)return-1;if(a.coordinates[0]-t.coordinates[0]===0&&l.coordinates[0]-t.coordinates[0]===0)return a.coordinates[1]-t.coordinates[1]>=0||l.coordinates[1]-t.coordinates[1]>=0?a.coordinates[1]-l.coordinates[1]:l.coordinates[1]-a.coordinates[1];var h=Hu(t.coordinates,a.coordinates,l.coordinates);if(h<0)return 1;if(h>0)return-1;var f=Math.pow(a.coordinates[0]-t.coordinates[0],2)+Math.pow(a.coordinates[1]-t.coordinates[1],2),p=Math.pow(l.coordinates[0]-t.coordinates[0],2)+Math.pow(l.coordinates[1]-t.coordinates[1],2);return f-p}),this.outerEdgesSorted=!0)},r.prototype.getOuterEdges=function(){return this.sortOuterEdges(),this.outerEdges},r.prototype.getOuterEdge=function(t){return this.sortOuterEdges(),this.outerEdges[t]},r.prototype.addInnerEdge=function(t){this.innerEdges.push(t)},r}(),x0=i4;var o4=function(){function r(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 r.prototype.getSymetric=function(){return this.symetric||(this.symetric=new r(this.to,this.from),this.symetric.symetric=this),this.symetric},r.prototype.deleteEdge=function(){this.from.removeOuterEdge(this),this.to.removeInnerEdge(this)},r.prototype.isEqual=function(t){return this.from.id===t.from.id&&this.to.id===t.to.id},r.prototype.toString=function(){return"Edge { "+this.from.id+" -> "+this.to.id+" }"},r.prototype.toLineString=function(){return Pr([this.from.coordinates,this.to.coordinates])},r.prototype.compareTo=function(t){return Hu(t.from.coordinates,t.to.coordinates,this.to.coordinates)},r}(),sT=o4;var s4=function(){function r(){this.edges=[],this.polygon=void 0,this.envelope=void 0}return r.prototype.push=function(t){this.edges.push(t),this.polygon=this.envelope=void 0},r.prototype.get=function(t){return this.edges[t]},Object.defineProperty(r.prototype,"length",{get:function(){return this.edges.length},enumerable:!0,configurable:!0}),r.prototype.forEach=function(t){this.edges.forEach(t)},r.prototype.map=function(t){return this.edges.map(t)},r.prototype.some=function(t){return this.edges.some(t)},r.prototype.isValid=function(){return!0},r.prototype.isHole=function(){var t=this,e=this.edges.reduce(function(h,f,p){return f.from.coordinates[1]>t.edges[h].from.coordinates[1]&&(h=p),h},0),o=(e===0?this.length:e)-1,a=(e+1)%this.length,l=Hu(this.edges[o].from.coordinates,this.edges[e].from.coordinates,this.edges[a].from.coordinates);return l===0?this.edges[o].from.coordinates[0]>this.edges[a].from.coordinates[0]:l>0},r.prototype.toMultiPoint=function(){return Km(this.edges.map(function(t){return t.from.coordinates}))},r.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=Hn([t])},r.prototype.getEnvelope=function(){return this.envelope?this.envelope:this.envelope=gg(this.toPolygon())},r.findEdgeRingContaining=function(t,e){var o=t.getEnvelope(),a,l;return e.forEach(function(h){var f=h.getEnvelope();if(l&&(a=l.getEnvelope()),!iT(f,o)&&_0(f,o)){for(var p=t.map(function(b){return b.from.coordinates}),d=void 0,g=function(b){h.some(function(T){return oT(b,T.from.coordinates)})||(d=b)},x=0,v=p;x<v.length;x++){var M=v[x];g(M)}d&&h.inside(Nn(d))&&(!l||_0(a,f))&&(l=h)}}),l},r.prototype.inside=function(t){return Ir(t,this.toPolygon())},r}(),E0=s4;function a4(r){if(!r)throw new Error("No geojson passed");if(r.type!=="FeatureCollection"&&r.type!=="GeometryCollection"&&r.type!=="MultiLineString"&&r.type!=="LineString"&&r.type!=="Feature")throw new Error("Invalid input type '"+r.type+"'. Geojson must be FeatureCollection, GeometryCollection, LineString, MultiLineString or Feature")}var UZ=function(){function r(){this.edges=[],this.nodes={}}return r.fromGeoJson=function(t){a4(t);var e=new r;return Oi(t,function(o){Qm(o,"LineString","Graph::fromGeoJson"),yM(o,function(a,l){if(a){var h=e.getNode(a),f=e.getNode(l);e.addEdge(h,f)}return l})}),e},r.prototype.getNode=function(t){var e=x0.buildId(t),o=this.nodes[e];return o||(o=this.nodes[e]=new x0(t)),o},r.prototype.addEdge=function(t,e){var o=new sT(t,e),a=o.getSymetric();this.edges.push(o),this.edges.push(a)},r.prototype.deleteDangles=function(){var t=this;Object.keys(this.nodes).map(function(e){return t.nodes[e]}).forEach(function(e){return t._removeIfDangle(e)})},r.prototype._removeIfDangle=function(t){var e=this;if(t.innerEdges.length<=1){var o=t.getOuterEdges().map(function(a){return a.to});this.removeNode(t),o.forEach(function(a){return e._removeIfDangle(a)})}},r.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))})},r.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,a){t.getOuterEdge((a===0?t.getOuterEdges().length:a)-1).symetric.next=o})},r.prototype._computeNextCCWEdges=function(t,e){for(var o=t.getOuterEdges(),a,l,h=o.length-1;h>=0;--h){var f=o[h],p=f.symetric,d=void 0,g=void 0;f.label===e&&(d=f),p.label===e&&(g=p),!(!d||!g)&&(g&&(l=g),d&&(l&&(l.next=d,l=void 0),a||(a=d)))}l&&(l.next=a)},r.prototype._findLabeledEdgeRings=function(){var t=[],e=0;return this.edges.forEach(function(o){if(!(o.label>=0)){t.push(o);var a=o;do a.label=e,a=a.next;while(!o.isEqual(a));e++}}),t},r.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(a){t._computeNextCCWEdges(a,o.label)})});var e=[];return this.edges.forEach(function(o){o.ring||e.push(t._findEdgeRing(o))}),e},r.prototype._findIntersectionNodes=function(t){var e=[],o=t,a=function(){var l=0;o.from.getOuterEdges().forEach(function(h){h.label===t.label&&++l}),l>1&&e.push(o.from),o=o.next};do a();while(!t.isEqual(o));return e},r.prototype._findEdgeRing=function(t){var e=t,o=new E0;do o.push(e),e.ring=o,e=e.next;while(!t.isEqual(e));return o},r.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]},r.prototype.removeEdge=function(t){this.edges=this.edges.filter(function(e){return!e.isEqual(t)}),t.deleteEdge()},r}();var f4=yn(M0(),1);var h4=yn(M0(),1);var d4=yn(mT(),1);var E4=yn(bT(),1);function AT(r){for(var t=r,e=[];t.parent;)e.unshift(t),t=t.parent;return e}function S4(){return new CT(function(r){return r.f})}var T0={search:function(r,t,e,o){r.cleanDirty(),o=o||{};var a=o.heuristic||T0.heuristics.manhattan,l=o.closest||!1,h=S4(),f=t;for(t.h=a(t,e),h.push(t);h.size()>0;){var p=h.pop();if(p===e)return AT(p);p.closed=!0;for(var d=r.neighbors(p),g=0,x=d.length;g<x;++g){var v=d[g];if(!(v.closed||v.isWall())){var M=p.g+v.getCost(p),b=v.visited;(!b||M<v.g)&&(v.visited=!0,v.parent=p,v.h=v.h||a(v,e),v.g=M,v.f=v.g+v.h,r.markDirty(v),l&&(v.h<f.h||v.h===f.h&&v.g<f.g)&&(f=v),b?h.rescoreElement(v):h.push(v))}}}return l?AT(f):[]},heuristics:{manhattan:function(r,t){var e=Math.abs(t.x-r.x),o=Math.abs(t.y-r.y);return e+o},diagonal:function(r,t){var e=1,o=Math.sqrt(2),a=Math.abs(t.x-r.x),l=Math.abs(t.y-r.y);return e*(a+l)+(o-2*e)*Math.min(a,l)}},cleanNode:function(r){r.f=0,r.g=0,r.h=0,r.visited=!1,r.closed=!1,r.parent=null}};function nc(r,t){t=t||{},this.nodes=[],this.diagonal=!!t.diagonal,this.grid=[];for(var e=0;e<r.length;e++){this.grid[e]=[];for(var o=0,a=r[e];o<a.length;o++){var l=new zh(e,o,a[o]);this.grid[e][o]=l,this.nodes.push(l)}}this.init()}nc.prototype.init=function(){this.dirtyNodes=[];for(var r=0;r<this.nodes.length;r++)T0.cleanNode(this.nodes[r])};nc.prototype.cleanDirty=function(){for(var r=0;r<this.dirtyNodes.length;r++)T0.cleanNode(this.dirtyNodes[r]);this.dirtyNodes=[]};nc.prototype.markDirty=function(r){this.dirtyNodes.push(r)};nc.prototype.neighbors=function(r){var t=[],e=r.x,o=r.y,a=this.grid;return a[e-1]&&a[e-1][o]&&t.push(a[e-1][o]),a[e+1]&&a[e+1][o]&&t.push(a[e+1][o]),a[e]&&a[e][o-1]&&t.push(a[e][o-1]),a[e]&&a[e][o+1]&&t.push(a[e][o+1]),this.diagonal&&(a[e-1]&&a[e-1][o-1]&&t.push(a[e-1][o-1]),a[e+1]&&a[e+1][o-1]&&t.push(a[e+1][o-1]),a[e-1]&&a[e-1][o+1]&&t.push(a[e-1][o+1]),a[e+1]&&a[e+1][o+1]&&t.push(a[e+1][o+1])),t};nc.prototype.toString=function(){for(var r=[],t=this.grid,e,o,a,l,h=0,f=t.length;h<f;h++){for(e=[],o=t[h],a=0,l=o.length;a<l;a++)e.push(o[a].weight);r.push(e.join(" "))}return r.join(`
|
|
3806
|
-
`)};function zh(r,t,e){this.x=r,this.y=t,this.weight=e}zh.prototype.toString=function(){return"["+this.x+" "+this.y+"]"};zh.prototype.getCost=function(r){return r&&r.x!==this.x&&r.y!==this.y?this.weight*1.41421:this.weight};zh.prototype.isWall=function(){return this.weight===0};function CT(r){this.content=[],this.scoreFunction=r}CT.prototype={push:function(r){this.content.push(r),this.sinkDown(this.content.length-1)},pop:function(){var r=this.content[0],t=this.content.pop();return this.content.length>0&&(this.content[0]=t,this.bubbleUp(0)),r},remove:function(r){var t=this.content.indexOf(r),e=this.content.pop();t!==this.content.length-1&&(this.content[t]=e,this.scoreFunction(e)<this.scoreFunction(r)?this.sinkDown(t):this.bubbleUp(t))},size:function(){return this.content.length},rescoreElement:function(r){this.sinkDown(this.content.indexOf(r))},sinkDown:function(r){for(var t=this.content[r];r>0;){var e=(r+1>>1)-1,o=this.content[e];if(this.scoreFunction(t)<this.scoreFunction(o))this.content[e]=t,this.content[r]=o,r=e;else break}},bubbleUp:function(r){for(var t=this.content.length,e=this.content[r],o=this.scoreFunction(e);;){var a=r+1<<1,l=a-1,h=null,f;if(l<t){var p=this.content[l];f=this.scoreFunction(p),f<o&&(h=l)}if(a<t){var d=this.content[a],g=this.scoreFunction(d);g<(h===null?o:f)&&(h=a)}if(h!==null)this.content[r]=this.content[h],this.content[h]=e,r=h;else break}}};function A0(){this._=null}function Xu(r){r.U=r.C=r.L=r.R=r.P=r.N=null}A0.prototype={constructor:A0,insert:function(r,t){var e,o,a;if(r){if(t.P=r,t.N=r.N,r.N&&(r.N.P=t),r.N=t,r.R){for(r=r.R;r.L;)r=r.L;r.L=t}else r.R=t;e=r}else this._?(r=PT(this._),t.P=null,t.N=r,r.P=r.L=t,e=r):(t.P=t.N=null,this._=t,e=null);for(t.L=t.R=null,t.U=e,t.C=!0,r=t;e&&e.C;)o=e.U,e===o.L?(a=o.R,a&&a.C?(e.C=a.C=!1,o.C=!0,r=o):(r===e.R&&(rc(this,e),r=e,e=r.U),e.C=!1,o.C=!0,ic(this,o))):(a=o.L,a&&a.C?(e.C=a.C=!1,o.C=!0,r=o):(r===e.L&&(ic(this,e),r=e,e=r.U),e.C=!1,o.C=!0,rc(this,o))),e=r.U;this._.C=!1},remove:function(r){r.N&&(r.N.P=r.P),r.P&&(r.P.N=r.N),r.N=r.P=null;var t=r.U,e,o=r.L,a=r.R,l,h;if(o?a?l=PT(a):l=o:l=a,t?t.L===r?t.L=l:t.R=l:this._=l,o&&a?(h=l.C,l.C=r.C,l.L=o,o.U=l,l!==a?(t=l.U,l.U=r.U,r=l.R,t.L=r,l.R=a,a.U=l):(l.U=t,t=l,r=l.R)):(h=r.C,r=l),r&&(r.U=t),!h){if(r&&r.C){r.C=!1;return}do{if(r===this._)break;if(r===t.L){if(e=t.R,e.C&&(e.C=!1,t.C=!0,rc(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,ic(this,e),e=t.R),e.C=t.C,t.C=e.R.C=!1,rc(this,t),r=this._;break}}else if(e=t.L,e.C&&(e.C=!1,t.C=!0,ic(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,rc(this,e),e=t.L),e.C=t.C,t.C=e.L.C=!1,ic(this,t),r=this._;break}e.C=!0,r=t,t=t.U}while(!r.C);r&&(r.C=!1)}}};function rc(r,t){var e=t,o=t.R,a=e.U;a?a.L===e?a.L=o:a.R=o:r._=o,o.U=a,e.U=o,e.R=o.L,e.R&&(e.R.U=e),o.L=e}function ic(r,t){var e=t,o=t.L,a=e.U;a?a.L===e?a.L=o:a.R=o:r._=o,o.U=a,e.U=o,e.L=o.R,e.L&&(e.L.U=e),o.R=e}function PT(r){for(;r.L;)r=r.L;return r}var C0=A0;function Yu(r,t,e,o){var a=[null,null],l=Lr.push(a)-1;return a.left=r,a.right=t,e&&oc(a,r,t,e),o&&oc(a,t,r,o),mi[r.index].halfedges.push(l),mi[t.index].halfedges.push(l),a}function $u(r,t,e){var o=[t,e];return o.left=r,o}function oc(r,t,e,o){!r[0]&&!r[1]?(r[0]=o,r.left=t,r.right=e):r.left===e?r[1]=o:r[0]=o}function w4(r,t,e,o,a){var l=r[0],h=r[1],f=l[0],p=l[1],d=h[0],g=h[1],x=0,v=1,M=d-f,b=g-p,T;if(T=t-f,!(!M&&T>0)){if(T/=M,M<0){if(T<x)return;T<v&&(v=T)}else if(M>0){if(T>v)return;T>x&&(x=T)}if(T=o-f,!(!M&&T<0)){if(T/=M,M<0){if(T>v)return;T>x&&(x=T)}else if(M>0){if(T<x)return;T<v&&(v=T)}if(T=e-p,!(!b&&T>0)){if(T/=b,b<0){if(T<x)return;T<v&&(v=T)}else if(b>0){if(T>v)return;T>x&&(x=T)}if(T=a-p,!(!b&&T<0)){if(T/=b,b<0){if(T>v)return;T>x&&(x=T)}else if(b>0){if(T<x)return;T<v&&(v=T)}return!(x>0)&&!(v<1)||(x>0&&(r[0]=[f+x*M,p+x*b]),v<1&&(r[1]=[f+v*M,p+v*b])),!0}}}}}function b4(r,t,e,o,a){var l=r[1];if(l)return!0;var h=r[0],f=r.left,p=r.right,d=f[0],g=f[1],x=p[0],v=p[1],M=(d+x)/2,b=(g+v)/2,T,_;if(v===g){if(M<t||M>=o)return;if(d>x){if(!h)h=[M,e];else if(h[1]>=a)return;l=[M,a]}else{if(!h)h=[M,a];else if(h[1]<e)return;l=[M,e]}}else if(T=(d-x)/(v-g),_=b-T*M,T<-1||T>1)if(d>x){if(!h)h=[(e-_)/T,e];else if(h[1]>=a)return;l=[(a-_)/T,a]}else{if(!h)h=[(a-_)/T,a];else if(h[1]<e)return;l=[(e-_)/T,e]}else if(g<v){if(!h)h=[t,T*t+_];else if(h[0]>=o)return;l=[o,T*o+_]}else{if(!h)h=[o,T*o+_];else if(h[0]<t)return;l=[t,T*t+_]}return r[0]=h,r[1]=l,!0}function IT(r,t,e,o){for(var a=Lr.length,l;a--;)(!b4(l=Lr[a],r,t,e,o)||!w4(l,r,t,e,o)||!(Math.abs(l[0][0]-l[1][0])>Pn||Math.abs(l[0][1]-l[1][1])>Pn))&&delete Lr[a]}function RT(r){return mi[r.index]={site:r,halfedges:[]}}function T4(r,t){var e=r.site,o=t.left,a=t.right;return e===a&&(a=o,o=e),a?Math.atan2(a[1]-o[1],a[0]-o[0]):(e===o?(o=t[1],a=t[0]):(o=t[0],a=t[1]),Math.atan2(o[0]-a[0],a[1]-o[1]))}function P0(r,t){return t[+(t.left!==r.site)]}function A4(r,t){return t[+(t.left===r.site)]}function LT(){for(var r=0,t=mi.length,e,o,a,l;r<t;++r)if((e=mi[r])&&(l=(o=e.halfedges).length)){var h=new Array(l),f=new Array(l);for(a=0;a<l;++a)h[a]=a,f[a]=T4(e,Lr[o[a]]);for(h.sort(function(p,d){return f[d]-f[p]}),a=0;a<l;++a)f[a]=o[h[a]];for(a=0;a<l;++a)o[a]=f[a]}}function NT(r,t,e,o){var a=mi.length,l,h,f,p,d,g,x,v,M,b,T,_,y=!0;for(l=0;l<a;++l)if(h=mi[l]){for(f=h.site,d=h.halfedges,p=d.length;p--;)Lr[d[p]]||d.splice(p,1);for(p=0,g=d.length;p<g;)b=A4(h,Lr[d[p]]),T=b[0],_=b[1],x=P0(h,Lr[d[++p%g]]),v=x[0],M=x[1],(Math.abs(T-v)>Pn||Math.abs(_-M)>Pn)&&(d.splice(p,0,Lr.push($u(f,b,Math.abs(T-r)<Pn&&o-_>Pn?[r,Math.abs(v-r)<Pn?M:o]:Math.abs(_-o)<Pn&&e-T>Pn?[Math.abs(M-o)<Pn?v:e,o]:Math.abs(T-e)<Pn&&_-t>Pn?[e,Math.abs(v-e)<Pn?M:t]:Math.abs(_-t)<Pn&&T-r>Pn?[Math.abs(M-t)<Pn?v:r,t]:null))-1),++g);g&&(y=!1)}if(y){var A,S,L,G=1/0;for(l=0,y=null;l<a;++l)(h=mi[l])&&(f=h.site,A=f[0]-r,S=f[1]-t,L=A*A+S*S,L<G&&(G=L,y=h));if(y){var z=[r,t],F=[r,o],I=[e,o],ut=[e,t];y.halfedges.push(Lr.push($u(f=y.site,z,F))-1,Lr.push($u(f,F,I))-1,Lr.push($u(f,I,ut))-1,Lr.push($u(f,ut,z))-1)}}for(l=0;l<a;++l)(h=mi[l])&&(h.halfedges.length||delete mi[l])}var OT=[],Gh;function C4(){Xu(this),this.x=this.y=this.arc=this.site=this.cy=null}function Ca(r){var t=r.P,e=r.N;if(!(!t||!e)){var o=t.site,a=r.site,l=e.site;if(o!==l){var h=a[0],f=a[1],p=o[0]-h,d=o[1]-f,g=l[0]-h,x=l[1]-f,v=2*(p*x-d*g);if(!(v>=-DT)){var M=p*p+d*d,b=g*g+x*x,T=(x*M-d*b)/v,_=(p*b-g*M)/v,y=OT.pop()||new C4;y.arc=r,y.site=a,y.x=T+h,y.y=(y.cy=_+f)+Math.sqrt(T*T+_*_),r.circle=y;for(var A=null,S=Zu._;S;)if(y.y<S.y||y.y===S.y&&y.x<=S.x)if(S.L)S=S.L;else{A=S.P;break}else if(S.R)S=S.R;else{A=S;break}Zu.insert(A,y),A||(Gh=y)}}}}function Pa(r){var t=r.circle;t&&(t.P||(Gh=t.N),Zu.remove(t),OT.push(t),Xu(t),r.circle=null)}var UT=[];function P4(){Xu(this),this.edge=this.site=this.circle=null}function FT(r){var t=UT.pop()||new P4;return t.site=r,t}function I0(r){Pa(r),Ia.remove(r),UT.push(r),Xu(r)}function BT(r){var t=r.circle,e=t.x,o=t.cy,a=[e,o],l=r.P,h=r.N,f=[r];I0(r);for(var p=l;p.circle&&Math.abs(e-p.circle.x)<Pn&&Math.abs(o-p.circle.cy)<Pn;)l=p.P,f.unshift(p),I0(p),p=l;f.unshift(p),Pa(p);for(var d=h;d.circle&&Math.abs(e-d.circle.x)<Pn&&Math.abs(o-d.circle.cy)<Pn;)h=d.N,f.push(d),I0(d),d=h;f.push(d),Pa(d);var g=f.length,x;for(x=1;x<g;++x)d=f[x],p=f[x-1],oc(d.edge,p.site,d.site,a);p=f[0],d=f[g-1],d.edge=Yu(p.site,d.site,null,a),Ca(p),Ca(d)}function zT(r){for(var t=r[0],e=r[1],o,a,l,h,f=Ia._;f;)if(l=GT(f,e)-t,l>Pn)f=f.L;else if(h=t-I4(f,e),h>Pn){if(!f.R){o=f;break}f=f.R}else{l>-Pn?(o=f.P,a=f):h>-Pn?(o=f,a=f.N):o=a=f;break}RT(r);var p=FT(r);if(Ia.insert(o,p),!(!o&&!a)){if(o===a){Pa(o),a=FT(o.site),Ia.insert(p,a),p.edge=a.edge=Yu(o.site,p.site),Ca(o),Ca(a);return}if(!a){p.edge=Yu(o.site,p.site);return}Pa(o),Pa(a);var d=o.site,g=d[0],x=d[1],v=r[0]-g,M=r[1]-x,b=a.site,T=b[0]-g,_=b[1]-x,y=2*(v*_-M*T),A=v*v+M*M,S=T*T+_*_,L=[(_*A-M*S)/y+g,(v*S-T*A)/y+x];oc(a.edge,d,b,L),p.edge=Yu(d,r,null,L),a.edge=Yu(r,b,null,L),Ca(o),Ca(a)}}function GT(r,t){var e=r.site,o=e[0],a=e[1],l=a-t;if(!l)return o;var h=r.P;if(!h)return-1/0;e=h.site;var f=e[0],p=e[1],d=p-t;if(!d)return f;var g=f-o,x=1/l-1/d,v=g/d;return x?(-v+Math.sqrt(v*v-2*x*(g*g/(-2*d)-p+d/2+a-l/2)))/x+o:(o+f)/2}function I4(r,t){var e=r.N;if(e)return GT(e,t);var o=r.site;return o[1]===t?o[0]:1/0}var Pn=1e-6,DT=1e-12,Ia,mi,Zu,Lr;function R4(r,t,e){return(r[0]-e[0])*(t[1]-r[1])-(r[0]-t[0])*(e[1]-r[1])}function L4(r,t){return t[1]-r[1]||t[0]-r[0]}function kh(r,t){var e=r.sort(L4).pop(),o,a,l;for(Lr=[],mi=new Array(r.length),Ia=new C0,Zu=new C0;;)if(l=Gh,e&&(!l||e[1]<l.y||e[1]===l.y&&e[0]<l.x))(e[0]!==o||e[1]!==a)&&(zT(e),o=e[0],a=e[1]),e=r.pop();else if(l)BT(l.arc);else break;if(LT(),t){var h=+t[0][0],f=+t[0][1],p=+t[1][0],d=+t[1][1];IT(h,f,p,d),NT(h,f,p,d)}this.edges=Lr,this.cells=mi,Ia=Zu=Lr=mi=null}kh.prototype={constructor:kh,polygons:function(){var r=this.edges;return this.cells.map(function(t){var e=t.halfedges.map(function(o){return P0(t,r[o])});return e.data=t.site.data,e})},triangles:function(){var r=[],t=this.edges;return this.cells.forEach(function(e,o){if(f=(l=e.halfedges).length)for(var a=e.site,l,h=-1,f,p,d=t[l[f-1]],g=d.left===a?d.right:d.left;++h<f;)p=g,d=t[l[h]],g=d.left===a?d.right:d.left,p&&g&&o<p.index&&o<g.index&&R4(a,p,g)<0&&r.push([a.data,p.data,g.data])}),r},links:function(){return this.edges.filter(function(r){return r.right}).map(function(r){return{source:r.left.data,target:r.right.data}})},find:function(r,t,e){for(var o=this,a,l=o._found||0,h=o.cells.length,f;!(f=o.cells[l]);)if(++l>=h)return null;var p=r-f.site[0],d=t-f.site[1],g=p*p+d*d;do f=o.cells[a=l],l=null,f.halfedges.forEach(function(x){var v=o.edges[x],M=v.left;if(!((M===f.site||!M)&&!(M=v.right))){var b=r-M[0],T=t-M[1],_=b*b+T*T;_<g&&(g=_,l=M.index)}});while(l!==null);return o._found=a,e==null||g<=e*e?f.site:null}};var G4=yn(Ju(),1);var W0=yn(HT(),1);function Mi(){return new Hh}function Hh(){this.reset()}Hh.prototype={constructor:Hh,reset:function(){this.s=this.t=0},add:function(r){WT(Vh,r,this.t),WT(this,Vh.s,this.s),this.s?this.t+=Vh.t:this.s=Vh.t},valueOf:function(){return this.s}};var Vh=new Hh;function WT(r,t,e){var o=r.s=t+e,a=o-t,l=o-a;r.t=t-l+(e-a)}var mn=1e-6;var bn=Math.PI,gr=bn/2,Wh=bn/4,Do=bn*2,Ra=180/bn,Si=bn/180,Zn=Math.abs,yo=Math.atan,wi=Math.atan2,cn=Math.cos;var Xh=Math.exp;var sc=Math.log;var Me=Math.sin;var Vr=Math.sqrt,ac=Math.tan;function N0(r){return r>1?0:r<-1?bn:Math.acos(r)}function gi(r){return r>1?gr:r<-1?-gr:Math.asin(r)}function vo(){}var k4=Mi(),Rj=Mi();function La(r){var t=r[0],e=r[1],o=cn(e);return[o*cn(t),o*Me(t),Me(e)]}function uc(r,t){return[r[1]*t[2]-r[2]*t[1],r[2]*t[0]-r[0]*t[2],r[0]*t[1]-r[1]*t[0]]}function lc(r){var t=Vr(r[0]*r[0]+r[1]*r[1]+r[2]*r[2]);r[0]/=t,r[1]/=t,r[2]/=t}var kj=Mi();function YT(r,t){return[r>bn?r-Do:r<-bn?r+Do:r,t]}YT.invert=YT;function O0(){var r=[],t;return{point:function(e,o){t.push([e,o])},lineStart:function(){r.push(t=[])},lineEnd:vo,rejoin:function(){r.length>1&&r.push(r.pop().concat(r.shift()))},result:function(){var e=r;return r=[],t=null,e}}}function D0(r,t){return Zn(r[0]-t[0])<mn&&Zn(r[1]-t[1])<mn}function Yh(r,t,e,o){this.x=r,this.z=t,this.o=e,this.e=o,this.v=!1,this.n=this.p=null}function F0(r,t,e,o,a){var l=[],h=[],f,p;if(r.forEach(function(b){if(!((T=b.length-1)<=0)){var T,_=b[0],y=b[T],A;if(D0(_,y)){for(a.lineStart(),f=0;f<T;++f)a.point((_=b[f])[0],_[1]);a.lineEnd();return}l.push(A=new Yh(_,b,null,!0)),h.push(A.o=new Yh(_,null,A,!1)),l.push(A=new Yh(y,b,null,!1)),h.push(A.o=new Yh(y,null,A,!0))}}),!!l.length){for(h.sort(t),$T(l),$T(h),f=0,p=h.length;f<p;++f)h[f].e=e=!e;for(var d=l[0],g,x;;){for(var v=d,M=!0;v.v;)if((v=v.n)===d)return;g=v.z,a.lineStart();do{if(v.v=v.o.v=!0,v.e){if(M)for(f=0,p=g.length;f<p;++f)a.point((x=g[f])[0],x[1]);else o(v.x,v.n.x,1,a);v=v.n}else{if(M)for(g=v.p.z,f=g.length-1;f>=0;--f)a.point((x=g[f])[0],x[1]);else o(v.x,v.p.x,-1,a);v=v.p}v=v.o,g=v.z,M=!M}while(!v.v);a.lineEnd()}}}function $T(r){if(t=r.length){for(var t,e=0,o=r[0],a;++e<t;)o.n=a=r[e],a.p=o,o=a;o.n=a=r[0],a.p=o}}function Hs(r,t){return r<t?-1:r>t?1:r>=t?0:NaN}function U0(r){return r.length===1&&(r=H4(r)),{left:function(t,e,o,a){for(o==null&&(o=0),a==null&&(a=t.length);o<a;){var l=o+a>>>1;r(t[l],e)<0?o=l+1:a=l}return o},right:function(t,e,o,a){for(o==null&&(o=0),a==null&&(a=t.length);o<a;){var l=o+a>>>1;r(t[l],e)>0?a=l:o=l+1}return o}}}function H4(r){return function(t,e){return Hs(r(t),e)}}var ZT=U0(Hs),W4=ZT.right,X4=ZT.left;var JT=Array.prototype,$4=JT.slice,Z4=JT.map;var NQ=Math.sqrt(50),OQ=Math.sqrt(10),DQ=Math.sqrt(2);function Zh(r){for(var t=r.length,e,o=-1,a=0,l,h;++o<t;)a+=r[o].length;for(l=new Array(a);--t>=0;)for(h=r[t],e=h.length;--e>=0;)l[--a]=h[e];return l}var r5=1e9,_et=-r5;var B0=Mi();function z0(r,t){var e=t[0],o=t[1],a=[Me(e),-cn(e),0],l=0,h=0;B0.reset();for(var f=0,p=r.length;f<p;++f)if(g=(d=r[f]).length)for(var d,g,x=d[g-1],v=x[0],M=x[1]/2+Wh,b=Me(M),T=cn(M),_=0;_<g;++_,v=A,b=L,T=G,x=y){var y=d[_],A=y[0],S=y[1]/2+Wh,L=Me(S),G=cn(S),z=A-v,F=z>=0?1:-1,I=F*z,ut=I>bn,R=b*L;if(B0.add(wi(R*F*Me(I),T*G+R*cn(I))),l+=ut?z+F*Do:z,ut^v>=e^A>=e){var W=uc(La(x),La(y));lc(W);var V=uc(a,W);lc(V);var Mt=(ut^z>=0?-1:1)*gi(V[2]);(o>Mt||o===Mt&&(W[0]||W[1]))&&(h+=ut^z>=0?1:-1)}}return(l<-mn||l<mn&&B0<-mn)^h&1}var Iet=Mi();var Zet=Mi(),Jet=Mi();var s5=1/0;var Qet=-s5;function G0(r){this._context=r}G0.prototype={_radius:4.5,pointRadius:function(r){return this._radius=r,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(r,t){switch(this._point){case 0:{this._context.moveTo(r,t),this._point=1;break}case 1:{this._context.lineTo(r,t);break}default:{this._context.moveTo(r+this._radius,t),this._context.arc(r,t,this._radius,0,Do);break}}},result:vo};var lnt=Mi();function k0(){this._string=[]}k0.prototype={_radius:4.5,_circle:QT(4.5),pointRadius:function(r){return(r=+r)!==this._radius&&(this._radius=r,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(r,t){switch(this._point){case 0:{this._string.push("M",r,",",t),this._point=1;break}case 1:{this._string.push("L",r,",",t);break}default:{this._circle==null&&(this._circle=QT(this._radius)),this._string.push("M",r,",",t,this._circle);break}}},result:function(){if(this._string.length){var r=this._string.join("");return this._string=[],r}else return null}};function QT(r){return"m0,"+r+"a"+r+","+r+" 0 1,1 0,"+-2*r+"a"+r+","+r+" 0 1,1 0,"+2*r+"z"}function q0(r,t,e,o){return function(a,l){var h=t(l),f=a.invert(o[0],o[1]),p=O0(),d=t(p),g=!1,x,v,M,b={point:T,lineStart:y,lineEnd:A,polygonStart:function(){b.point=S,b.lineStart=L,b.lineEnd=G,v=[],x=[]},polygonEnd:function(){b.point=T,b.lineStart=y,b.lineEnd=A,v=Zh(v);var z=z0(x,f);v.length?(g||(l.polygonStart(),g=!0),F0(v,l5,z,e,l)):z&&(g||(l.polygonStart(),g=!0),l.lineStart(),e(null,null,1,l),l.lineEnd()),g&&(l.polygonEnd(),g=!1),v=x=null},sphere:function(){l.polygonStart(),l.lineStart(),e(null,null,1,l),l.lineEnd(),l.polygonEnd()}};function T(z,F){var I=a(z,F);r(z=I[0],F=I[1])&&l.point(z,F)}function _(z,F){var I=a(z,F);h.point(I[0],I[1])}function y(){b.point=_,h.lineStart()}function A(){b.point=T,h.lineEnd()}function S(z,F){M.push([z,F]);var I=a(z,F);d.point(I[0],I[1])}function L(){d.lineStart(),M=[]}function G(){S(M[0][0],M[0][1]),d.lineEnd();var z=d.clean(),F=p.result(),I,ut=F.length,R,W,V;if(M.pop(),x.push(M),M=null,!!ut){if(z&1){if(W=F[0],(R=W.length-1)>0){for(g||(l.polygonStart(),g=!0),l.lineStart(),I=0;I<R;++I)l.point((V=W[I])[0],V[1]);l.lineEnd()}return}ut>1&&z&2&&F.push(F.pop().concat(F.shift())),v.push(F.filter(u5))}}return b}}function u5(r){return r.length>1}function l5(r,t){return((r=r.x)[0]<0?r[1]-gr-mn:gr-r[1])-((t=t.x)[0]<0?t[1]-gr-mn:gr-t[1])}var c5=q0(function(){return!0},f5,p5,[-bn,-gr]);function f5(r){var t=NaN,e=NaN,o=NaN,a;return{lineStart:function(){r.lineStart(),a=1},point:function(l,h){var f=l>0?bn:-bn,p=Zn(l-t);Zn(p-bn)<mn?(r.point(t,e=(e+h)/2>0?gr:-gr),r.point(o,e),r.lineEnd(),r.lineStart(),r.point(f,e),r.point(l,e),a=0):o!==f&&p>=bn&&(Zn(t-o)<mn&&(t-=o*mn),Zn(l-f)<mn&&(l-=f*mn),e=h5(t,e,l,h),r.point(o,e),r.lineEnd(),r.lineStart(),r.point(f,e),a=0),r.point(t=l,e=h),o=f},lineEnd:function(){r.lineEnd(),t=e=NaN},clean:function(){return 2-a}}}function h5(r,t,e,o){var a,l,h=Me(r-e);return Zn(h)>mn?yo((Me(t)*(l=cn(o))*Me(e)-Me(o)*(a=cn(t))*Me(r))/(a*l*h)):(t+o)/2}function p5(r,t,e,o){var a;if(r==null)a=e*gr,o.point(-bn,a),o.point(0,a),o.point(bn,a),o.point(bn,0),o.point(bn,-a),o.point(0,-a),o.point(-bn,-a),o.point(-bn,0),o.point(-bn,a);else if(Zn(r[0]-t[0])>mn){var l=r[0]<t[0]?bn:-bn;a=e*l/2,o.point(-l,a),o.point(0,a),o.point(l,a)}else o.point(t[0],t[1])}function Jh(r){return function(t){var e=new V0;for(var o in r)e[o]=r[o];return e.stream=t,e}}function V0(){}V0.prototype={constructor:V0,point:function(r,t){this.stream.point(r,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 Jnt=cn(30*Si);var crt=Jh({point:function(r,t){this.stream.point(r*Si,t*Si)}});function Kh(r){return function(t,e){var o=cn(t),a=cn(e),l=r(o*a);return[l*a*Me(t),l*Me(e)]}}function Fo(r){return function(t,e){var o=Vr(t*t+e*e),a=r(o),l=Me(a),h=cn(a);return[wi(t*l,o*h),gi(o&&e*l/o)]}}var sA=Kh(function(r){return Vr(2/(1+r))});sA.invert=Fo(function(r){return 2*gi(r/2)});var aA=Kh(function(r){return(r=N0(r))&&r/Me(r)});aA.invert=Fo(function(r){return r});function H0(r,t){return[r,sc(ac((gr+t)/2))]}H0.invert=function(r,t){return[r,2*yo(Xh(t))-gr]};function jh(r,t){return[r,t]}jh.invert=jh;function uA(r,t){var e=cn(t),o=cn(r)*e;return[e*Me(r)/o,Me(t)/o]}uA.invert=Fo(yo);function lA(r,t){var e=t*t,o=e*e;return[r*(.8707-.131979*e+o*(-.013791+o*(.003971*e-.001529*o))),t*(1.007226+e*(.015085+o*(-.044475+.028874*e-.005916*o)))]}lA.invert=function(r,t){var e=t,o=25,a;do{var l=e*e,h=l*l;e-=a=(e*(1.007226+l*(.015085+h*(-.044475+.028874*l-.005916*h)))-t)/(1.007226+l*(.015085*3+h*(-.044475*7+.028874*9*l-.005916*11*h)))}while(Zn(a)>mn&&--o>0);return[r/(.8707+(l=e*e)*(-.131979+l*(-.013791+l*l*l*(.003971-.001529*l)))),e]};function cA(r,t){return[cn(t)*Me(r),Me(t)]}cA.invert=Fo(gi);function fA(r,t){var e=cn(t),o=1+cn(r)*e;return[e*Me(r)/o,Me(t)/o]}fA.invert=Fo(function(r){return 2*yo(r)});function hA(r,t){return[sc(ac((gr+t)/2)),-r]}hA.invert=function(r,t){return[-t,2*yo(Xh(r))-gr]};var _5=yn(Ju(),1);var x5=yn(Ju(),1);var M5=yn(Ju(),1);var S5=yn(Ju(),1);function Xs(r,t){return Math.sqrt((t[0]-r[0])**2+(t[1]-r[1])**2)}function X0(r){let t=0;for(let e=0;e<r.length-1;e++)t+=Xs(r[e],r[e+1]);return t}function dA(r,t,e){let o=new ye(t[0]-r[0],t[1]-r[1]),a=new ye(t[0]-e[0],t[1]-e[1]),h=o.angleTo(a)*180/Math.PI,f=new ye(t[0]-r[0],t[1]-r[1]);return new ye(e[0]-r[0],e[1]-r[1]).cross(f)>0?h:-h}var Wi="___",Qh=class{initRoute(t){this.clear(),this.roadInfo=t,t.length&&(t.forEach(e=>{e.points.forEach(o=>{let a=""+e.floor+Wi+o.id;if(this.pointMap.set(a,o),this.nodeMap.set(""+o.floor+Wi+o.nodeId,a),o.type==="straightLadder"){let l=this.straightLadderMap.get(o.name)||[];l.push(Xa({},o)),this.straightLadderMap.set(o.name,l)}if(o.type==="staircase"){let l=this.staircaseMap.get(o.name)||[];l.push(Xa({},o)),this.staircaseMap.set(o.name,l)}if(o.type==="escalator"){let l=this.escalatorMap.get(o.name)||{};o.escalatorDirection==="exit"?l.end={floor:o.floor,id:o.id}:l.start={floor:o.floor,id:o.id},this.escalatorMap.set(o.name,l)}if(o.type==="facility"){let l=this.facilityMap.get(o.targetId)||[];l.push(Xa({},o)),this.facilityMap.set(o.targetId,l)}}),e.lines.filter(o=>o.direction!=="no").forEach(o=>{var a,l;let h=""+e.floor+Wi+o.from,f=""+e.floor+Wi+o.to,p=(a=this.pointMap.get(h))==null?void 0:a.cds,d=(l=this.pointMap.get(f))==null?void 0:l.cds;if(p!=null&&p.length&&(d!=null&&d.length)){let g=Xs(p,d);this.addLineItem(h,f,g),o.direction==="double"&&this.addLineItem(f,h,g)}})}),this.initBaseRoute(),this.initEscalatorRoute(),this.initStraightLadderRoute())}addLineItem(t,e,o,a){a===void 0&&(a=this.lineMap);let l=a.get(t)||new Map;l.set(e,o),a.set(t,l)}addFacilityToLineMap(t,e,o,a){[...this.straightLadderMap,...this.staircaseMap].forEach(l=>{let[h,f]=l;if(!(f.length<2))for(let g=0;g<f.length;g++){let x=""+f[g].floor+Wi+f[g].id;for(let v=0;v<f.length;v++)if(g!==v){var p,d;let M=""+f[v].floor+Wi+f[v].id,b=(p=this.pointMap.get(x))==null?void 0:p.cds,T=(d=this.pointMap.get(M))==null?void 0:d.cds;if(b!=null&&b.length&&(T!=null&&T.length))if(f[g].type==="straightLadder"){let _=e;this.addLineItem(x,M,_,a)}else{let _=o;this.addLineItem(x,M,_,a)}}}}),this.escalatorMap.forEach((l,h)=>{if(l.start&&l.end){var f,p;let d=""+l.start.floor+Wi+l.start.id,g=""+l.end.floor+Wi+l.end.id,x=(f=this.pointMap.get(d))==null?void 0:f.cds,v=(p=this.pointMap.get(g))==null?void 0:p.cds;if(x!=null&&x.length&&(v!=null&&v.length)){let M=t;this.addLineItem(d,g,M,a)}}})}initBaseRoute(){let t=new Map([...this.lineMap]);this.addFacilityToLineMap(1,this.lift_priority,3e4,t),this.baseRoute=new Uo.default(t)}initEscalatorRoute(){let t=new Map([...this.lineMap]),e=1e4;this.addFacilityToLineMap(1*e,this.lift_priority*e,3e4*e,t),this.escalatorRoute=new Uo.default(t)}initStraightLadderRoute(){let t=new Map([...this.lineMap]),e=1e4;this.addFacilityToLineMap(3*e,1*e,3e4*e,t),this.straightLadderRoute=new Uo.default(t)}checkStart(t){return!(!t.floor||!t.nodeId&&(!t.coord||t.coord.length<2))}checkEnd(t){return t.facility?!0:this.checkStart(t)}transformStart(t){var e;if(t.nodeId){let o=this.nodeMap.get(""+t.floor+Wi+t.nodeId);if(o){let[a,l]=o.split(Wi);return{floor:a,id:l}}}if((e=t.coord)!=null&&e.length){let o=this.roadInfo.find(l=>l.floor===t.floor);if(!o)return null;let a=o.points.reduce((l,h)=>{let f=Xs(t.coord,h.cds);return f<l.min&&(l.min=f,l.point=h),l},{min:1/0,point:o.points[0]});return{floor:a.point.floor,id:a.point.id}}return null}transformEnd(t){if(t.floor){let e=this.transformStart(t);if(e)return e}if(t.facility){let e=this.facilityMap.get(t.facility);if(e!=null&&e.length)return{floor:t.floor,facility:t.facility}}return null}getPath(t,e,o){if(o===void 0&&(o=""),!this.checkStart(t))return"start-error";if(!this.checkEnd(e))return"end-error";let a=this.transformStart(t);if(!a)return"no-start";let l=this.transformEnd(e);if(!l)return"no-end";let h=this.getBasePath.bind(this);switch(o){case"escalator":h=this.getEscalatorPath.bind(this);break;case"straightLadder":h=this.getStraightLadderPath.bind(this);break;default:h=this.getBasePath.bind(this);break}if(l.id)return h(a,l);if(l.facility){let f=this.facilityMap.get(l.facility).filter(d=>l.floor?d.floor===l.floor:!0);if(!f.length)return null;let p=f.map(d=>h(a,{floor:d.floor,id:d.id})).filter(d=>!!d);return p.reduce((d,g)=>{let x=g.reduce((v,M)=>v+X0(M.points),0);return x<d.distance&&(d.distance=x,d.path=g),d},{distance:1/0,path:p[0]}).path}}getRoutePath(t,e,o){let a=""+t.floor+Wi+t.id,l=""+e.floor+Wi+e.id,h=o.path(a,l);if(!h)return null;let f=[];return h.map(p=>{let d=this.pointMap.get(p);if(d){var g;let{floor:x}=d;if(((g=f[f.length-1])==null?void 0:g.floor)===x){let v=f[f.length-1];v.points.push(d.cds),v.endType=d.type,v.destId=d.nodeId,v.distance=X0(v.points)}else f.push({floor:x,points:[d.cds],endType:d.type,destId:d.nodeId,distance:0})}}),f}getBasePath(t,e){return this.getRoutePath(t,e,this.baseRoute)}getEscalatorPath(t,e){return this.getRoutePath(t,e,this.escalatorRoute)}getStraightLadderPath(t,e){return this.getRoutePath(t,e,this.straightLadderRoute)}clear(){this.roadInfo=[],this.pointMap.clear(),this.nodeMap.clear(),this.facilityMap.clear(),this.straightLadderMap.clear(),this.escalatorMap.clear(),this.staircaseMap.clear(),this.lineMap.clear(),this.baseRoute=new Uo.default,this.escalatorRoute=new Uo.default,this.straightLadderRoute=new Uo.default}constructor(t=3){this.lift_priority=t,this.roadInfo=[],this.pointMap=new Map,this.nodeMap=new Map,this.facilityMap=new Map,this.straightLadderMap=new Map,this.escalatorMap=new Map,this.staircaseMap=new Map,this.lineMap=new Map,this.baseRoute=new Uo.default,this.escalatorRoute=new Uo.default,this.straightLadderRoute=new Uo.default}};var Slt=yn(Wc(),1),wlt=yn(Kp(),1);var L5=yn(_A(),1);function N5(r,t,e){let o=dA(r,t,e);return O5(o)}function O5(r){return 180-Math.abs(r)<15?"front":r>135?"right_front":r<-135?"left_front":r<=135&&r>=60?"right":r>=-135&&r<=-60?"left":r<60&&r>0?"right_back":r>-60&&r<0?"left_back":"front"}function xA(r){if(!r.length)return[];if(r.length===1)return[{direction:"start",distance:0,points:r}];let t=[{direction:"start",distance:Xs(r[0],r[1]),points:[r[0],r[1]]}];for(let e=2;e<r.length;e++){let o=N5(r[e-2],r[e-1],r[e]);if(o==="front"){let a=t[t.length-1],l=Xs(r[e-1],r[e]);a.distance+=l,e!==2&&a.points.push(r[e-1])}else t.push({direction:o,distance:Xs(r[e-1],r[e]),points:[r[e-1],r[e]]})}return t.push({direction:"end",distance:0,points:[r[r.length-1]]}),t}var Dlt=yn(YA(),1),Flt=yn(Kc(),1);function $A(r){return r.replace(/[A-Z]/g,t=>"_"+t.toLowerCase()).replace(/^_/,"")}function ZA(r){let t={};for(let o in r)o.startsWith("on")&&(t[$A(o.slice(2))]=r[o],t[o]=r[o]);let e=o=>gc(this,null,function*(){let{data:a}=o;if(t[a.type])try{let l=yield t[a.type](a.data);if(l!=null&&l.$transfer&&Array.isArray(l.$transfer)){let h=l.$transfer;delete l.$transfer,self.postMessage({type:""+a.type+"_result",key:a.key,data:l},h)}else self.postMessage({type:""+a.type+"_result",key:a.key,data:l})}catch(l){self.postMessage({type:""+a.type+"_result",key:a.key,error:l})}else self.postMessage({type:""+a.type+"_result",key:a.key,error:"no_event"})});return self.addEventListener("message",e),()=>{self.removeEventListener("message",e)}}var ty=new Qh;ZA({onSetRoadInfo(r){let{roadData:t}=r;ty.initRoute(t)},onGetPath(r){let{start:t,end:e,type:o}=r;return ty.getPath(t,e,o)},onGetDirectionPath(r){return xA(r)},onClear(){ty.clear()}});
|
|
3805
|
+
}`,Cm=class{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(t,e,o){if(this.texture===null){let a=new Hi,l=t.properties.get(a);l.__webglTexture=e.texture,(e.depthNear!=o.depthNear||e.depthFar!=o.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=a}}render(t,e){if(this.texture!==null){if(this.mesh===null){let o=e.cameras[0].viewport,a=new Io({extensions:{fragDepth:!0},vertexShader:bU,fragmentShader:TU,uniforms:{depthColor:{value:this.texture},depthWidth:{value:o.z},depthHeight:{value:o.w}}});this.mesh=new ho(new Vf(20,20),a)}t.render(this.mesh,e)}}reset(){this.texture=null,this.mesh=null}},Pm=class extends Ds{constructor(t,e){super();let o=this,a=null,l=1,h=null,f="local-floor",p=1,d=null,g=null,x=null,v=null,M=null,b=null,T=new Cm,_=e.getContextAttributes(),y=null,A=null,S=[],L=[],G=new ye,z=null,F=new Li;F.layers.enable(1),F.viewport=new zr;let I=new Li;I.layers.enable(2),I.viewport=new zr;let ut=[F,I],R=new Am;R.layers.enable(1),R.layers.enable(2);let W=null,V=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(tt){let wt=S[tt];return wt===void 0&&(wt=new Ll,S[tt]=wt),wt.getTargetRaySpace()},this.getControllerGrip=function(tt){let wt=S[tt];return wt===void 0&&(wt=new Ll,S[tt]=wt),wt.getGripSpace()},this.getHand=function(tt){let wt=S[tt];return wt===void 0&&(wt=new Ll,S[tt]=wt),wt.getHandSpace()};function Mt(tt){let wt=L.indexOf(tt.inputSource);if(wt===-1)return;let Bt=S[wt];Bt!==void 0&&(Bt.update(tt.inputSource,tt.frame,d||h),Bt.dispatchEvent({type:tt.type,data:tt.inputSource}))}function X(){a.removeEventListener("select",Mt),a.removeEventListener("selectstart",Mt),a.removeEventListener("selectend",Mt),a.removeEventListener("squeeze",Mt),a.removeEventListener("squeezestart",Mt),a.removeEventListener("squeezeend",Mt),a.removeEventListener("end",X),a.removeEventListener("inputsourceschange",mt);for(let tt=0;tt<S.length;tt++){let wt=L[tt];wt!==null&&(L[tt]=null,S[tt].disconnect(wt))}W=null,V=null,T.reset(),t.setRenderTarget(y),M=null,v=null,x=null,a=null,A=null,Yt.stop(),o.isPresenting=!1,t.setPixelRatio(z),t.setSize(G.width,G.height,!1),o.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(tt){l=tt,o.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(tt){f=tt,o.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return d||h},this.setReferenceSpace=function(tt){d=tt},this.getBaseLayer=function(){return v!==null?v:M},this.getBinding=function(){return x},this.getFrame=function(){return b},this.getSession=function(){return a},this.setSession=function(tt){return gc(this,null,function*(){if(a=tt,a!==null){if(y=t.getRenderTarget(),a.addEventListener("select",Mt),a.addEventListener("selectstart",Mt),a.addEventListener("selectend",Mt),a.addEventListener("squeeze",Mt),a.addEventListener("squeezestart",Mt),a.addEventListener("squeezeend",Mt),a.addEventListener("end",X),a.addEventListener("inputsourceschange",mt),_.xrCompatible!==!0&&(yield e.makeXRCompatible()),z=t.getPixelRatio(),t.getSize(G),a.renderState.layers===void 0||t.capabilities.isWebGL2===!1){let wt={antialias:a.renderState.layers===void 0?_.antialias:!0,alpha:!0,depth:_.depth,stencil:_.stencil,framebufferScaleFactor:l};M=new XRWebGLLayer(a,e,wt),a.updateRenderState({baseLayer:M}),t.setPixelRatio(1),t.setSize(M.framebufferWidth,M.framebufferHeight,!1),A=new us(M.framebufferWidth,M.framebufferHeight,{format:fo,type:Ls,colorSpace:t.outputColorSpace,stencilBuffer:_.stencil})}else{let wt=null,Bt=null,$t=null;_.depth&&($t=_.stencil?e.DEPTH24_STENCIL8:e.DEPTH_COMPONENT24,wt=_.stencil?bu:va,Bt=_.stencil?ya:Ps);let Ut={colorFormat:e.RGBA8,depthFormat:$t,scaleFactor:l};x=new XRWebGLBinding(a,e),v=x.createProjectionLayer(Ut),a.updateRenderState({layers:[v]}),t.setPixelRatio(1),t.setSize(v.textureWidth,v.textureHeight,!1),A=new us(v.textureWidth,v.textureHeight,{format:fo,type:Ls,depthTexture:new Wf(v.textureWidth,v.textureHeight,Bt,void 0,void 0,void 0,void 0,void 0,void 0,wt),stencilBuffer:_.stencil,colorSpace:t.outputColorSpace,samples:_.antialias?4:0});let Dt=t.properties.get(A);Dt.__ignoreDepthValues=v.ignoreDepthValues}A.isXRRenderTarget=!0,this.setFoveation(p),d=null,h=yield a.requestReferenceSpace(f),Yt.setContext(a),Yt.start(),o.isPresenting=!0,o.dispatchEvent({type:"sessionstart"})}})},this.getEnvironmentBlendMode=function(){if(a!==null)return a.environmentBlendMode};function mt(tt){for(let wt=0;wt<tt.removed.length;wt++){let Bt=tt.removed[wt],$t=L.indexOf(Bt);$t>=0&&(L[$t]=null,S[$t].disconnect(Bt))}for(let wt=0;wt<tt.added.length;wt++){let Bt=tt.added[wt],$t=L.indexOf(Bt);if($t===-1){for(let Dt=0;Dt<S.length;Dt++)if(Dt>=L.length){L.push(Bt),$t=Dt;break}else if(L[Dt]===null){L[Dt]=Bt,$t=Dt;break}if($t===-1)break}let Ut=S[$t];Ut&&Ut.connect(Bt)}}let dt=new yt,_t=new yt;function it(tt,wt,Bt){dt.setFromMatrixPosition(wt.matrixWorld),_t.setFromMatrixPosition(Bt.matrixWorld);let $t=dt.distanceTo(_t),Ut=wt.projectionMatrix.elements,Dt=Bt.projectionMatrix.elements,At=Ut[14]/(Ut[10]-1),te=Ut[14]/(Ut[10]+1),rt=(Ut[9]+1)/Ut[5],an=(Ut[9]-1)/Ut[5],zt=(Ut[8]-1)/Ut[0],ne=(Dt[8]+1)/Dt[0],Wt=At*zt,ie=At*ne,ce=$t/(-zt+ne),Lt=ce*-zt;wt.matrixWorld.decompose(tt.position,tt.quaternion,tt.scale),tt.translateX(Lt),tt.translateZ(ce),tt.matrixWorld.compose(tt.position,tt.quaternion,tt.scale),tt.matrixWorldInverse.copy(tt.matrixWorld).invert();let se=At+ce,Y=te+ce,N=Wt-Lt,xt=ie+($t-Lt),Et=rt*te/Y*se,ot=an*te/Y*se;tt.projectionMatrix.makePerspective(N,xt,Et,ot,se,Y),tt.projectionMatrixInverse.copy(tt.projectionMatrix).invert()}function lt(tt,wt){wt===null?tt.matrixWorld.copy(tt.matrix):tt.matrixWorld.multiplyMatrices(wt.matrixWorld,tt.matrix),tt.matrixWorldInverse.copy(tt.matrixWorld).invert()}this.updateCamera=function(tt){if(a===null)return;T.texture!==null&&(tt.near=T.depthNear,tt.far=T.depthFar),R.near=I.near=F.near=tt.near,R.far=I.far=F.far=tt.far,(W!==R.near||V!==R.far)&&(a.updateRenderState({depthNear:R.near,depthFar:R.far}),W=R.near,V=R.far,F.near=W,F.far=V,I.near=W,I.far=V,F.updateProjectionMatrix(),I.updateProjectionMatrix(),tt.updateProjectionMatrix());let wt=tt.parent,Bt=R.cameras;lt(R,wt);for(let $t=0;$t<Bt.length;$t++)lt(Bt[$t],wt);Bt.length===2?it(R,F,I):R.projectionMatrix.copy(F.projectionMatrix),H(tt,R,wt)};function H(tt,wt,Bt){Bt===null?tt.matrix.copy(wt.matrixWorld):(tt.matrix.copy(Bt.matrixWorld),tt.matrix.invert(),tt.matrix.multiply(wt.matrixWorld)),tt.matrix.decompose(tt.position,tt.quaternion,tt.scale),tt.updateMatrixWorld(!0),tt.projectionMatrix.copy(wt.projectionMatrix),tt.projectionMatrixInverse.copy(wt.projectionMatrixInverse),tt.isPerspectiveCamera&&(tt.fov=fm*2*Math.atan(1/tt.projectionMatrix.elements[5]),tt.zoom=1)}this.getCamera=function(){return R},this.getFoveation=function(){if(!(v===null&&M===null))return p},this.setFoveation=function(tt){p=tt,v!==null&&(v.fixedFoveation=tt),M!==null&&M.fixedFoveation!==void 0&&(M.fixedFoveation=tt)},this.hasDepthSensing=function(){return T.texture!==null};let bt=null;function Tt(tt,wt){if(g=wt.getViewerPose(d||h),b=wt,g!==null){let Bt=g.views;M!==null&&(t.setRenderTargetFramebuffer(A,M.framebuffer),t.setRenderTarget(A));let $t=!1;Bt.length!==R.cameras.length&&(R.cameras.length=0,$t=!0);for(let Dt=0;Dt<Bt.length;Dt++){let At=Bt[Dt],te=null;if(M!==null)te=M.getViewport(At);else{let an=x.getViewSubImage(v,At);te=an.viewport,Dt===0&&(t.setRenderTargetTextures(A,an.colorTexture,v.ignoreDepthValues?void 0:an.depthStencilTexture),t.setRenderTarget(A))}let rt=ut[Dt];rt===void 0&&(rt=new Li,rt.layers.enable(Dt),rt.viewport=new zr,ut[Dt]=rt),rt.matrix.fromArray(At.transform.matrix),rt.matrix.decompose(rt.position,rt.quaternion,rt.scale),rt.projectionMatrix.fromArray(At.projectionMatrix),rt.projectionMatrixInverse.copy(rt.projectionMatrix).invert(),rt.viewport.set(te.x,te.y,te.width,te.height),Dt===0&&(R.matrix.copy(rt.matrix),R.matrix.decompose(R.position,R.quaternion,R.scale)),$t===!0&&R.cameras.push(rt)}let Ut=a.enabledFeatures;if(Ut&&Ut.includes("depth-sensing")){let Dt=x.getDepthInformation(Bt[0]);Dt&&Dt.isValid&&Dt.texture&&T.init(t,Dt,a.renderState)}}for(let Bt=0;Bt<S.length;Bt++){let $t=L[Bt],Ut=S[Bt];$t!==null&&Ut!==void 0&&Ut.update($t,wt,d||h)}T.render(t,R),bt&&bt(tt,wt),wt.detectedPlanes&&o.dispatchEvent({type:"planesdetected",data:wt}),b=null}let Yt=new cM;Yt.setAnimationLoop(Tt),this.setAnimationLoop=function(tt){bt=tt},this.dispose=function(){}}},fa=new xa,AU=new cr;function CU(r,t){function e(_,y){_.matrixAutoUpdate===!0&&_.updateMatrix(),y.value.copy(_.matrix)}function o(_,y){y.color.getRGB(_.fogColor.value,lM(r)),y.isFog?(_.fogNear.value=y.near,_.fogFar.value=y.far):y.isFogExp2&&(_.fogDensity.value=y.density)}function a(_,y,A,S,L){y.isMeshBasicMaterial||y.isMeshLambertMaterial?l(_,y):y.isMeshToonMaterial?(l(_,y),x(_,y)):y.isMeshPhongMaterial?(l(_,y),g(_,y)):y.isMeshStandardMaterial?(l(_,y),v(_,y),y.isMeshPhysicalMaterial&&M(_,y,L)):y.isMeshMatcapMaterial?(l(_,y),b(_,y)):y.isMeshDepthMaterial?l(_,y):y.isMeshDistanceMaterial?(l(_,y),T(_,y)):y.isMeshNormalMaterial?l(_,y):y.isLineBasicMaterial?(h(_,y),y.isLineDashedMaterial&&f(_,y)):y.isPointsMaterial?p(_,y,A,S):y.isSpriteMaterial?d(_,y):y.isShadowMaterial?(_.color.value.copy(y.color),_.opacity.value=y.opacity):y.isShaderMaterial&&(y.uniformsNeedUpdate=!1)}function l(_,y){_.opacity.value=y.opacity,y.color&&_.diffuse.value.copy(y.color),y.emissive&&_.emissive.value.copy(y.emissive).multiplyScalar(y.emissiveIntensity),y.map&&(_.map.value=y.map,e(y.map,_.mapTransform)),y.alphaMap&&(_.alphaMap.value=y.alphaMap,e(y.alphaMap,_.alphaMapTransform)),y.bumpMap&&(_.bumpMap.value=y.bumpMap,e(y.bumpMap,_.bumpMapTransform),_.bumpScale.value=y.bumpScale,y.side===Ei&&(_.bumpScale.value*=-1)),y.normalMap&&(_.normalMap.value=y.normalMap,e(y.normalMap,_.normalMapTransform),_.normalScale.value.copy(y.normalScale),y.side===Ei&&_.normalScale.value.negate()),y.displacementMap&&(_.displacementMap.value=y.displacementMap,e(y.displacementMap,_.displacementMapTransform),_.displacementScale.value=y.displacementScale,_.displacementBias.value=y.displacementBias),y.emissiveMap&&(_.emissiveMap.value=y.emissiveMap,e(y.emissiveMap,_.emissiveMapTransform)),y.specularMap&&(_.specularMap.value=y.specularMap,e(y.specularMap,_.specularMapTransform)),y.alphaTest>0&&(_.alphaTest.value=y.alphaTest);let A=t.get(y),S=A.envMap,L=A.envMapRotation;if(S&&(_.envMap.value=S,fa.copy(L),fa.x*=-1,fa.y*=-1,fa.z*=-1,S.isCubeTexture&&S.isRenderTargetTexture===!1&&(fa.y*=-1,fa.z*=-1),_.envMapRotation.value.setFromMatrix4(AU.makeRotationFromEuler(fa)),_.flipEnvMap.value=S.isCubeTexture&&S.isRenderTargetTexture===!1?-1:1,_.reflectivity.value=y.reflectivity,_.ior.value=y.ior,_.refractionRatio.value=y.refractionRatio),y.lightMap){_.lightMap.value=y.lightMap;let G=r._useLegacyLights===!0?Math.PI:1;_.lightMapIntensity.value=y.lightMapIntensity*G,e(y.lightMap,_.lightMapTransform)}y.aoMap&&(_.aoMap.value=y.aoMap,_.aoMapIntensity.value=y.aoMapIntensity,e(y.aoMap,_.aoMapTransform))}function h(_,y){_.diffuse.value.copy(y.color),_.opacity.value=y.opacity,y.map&&(_.map.value=y.map,e(y.map,_.mapTransform))}function f(_,y){_.dashSize.value=y.dashSize,_.totalSize.value=y.dashSize+y.gapSize,_.scale.value=y.scale}function p(_,y,A,S){_.diffuse.value.copy(y.color),_.opacity.value=y.opacity,_.size.value=y.size*A,_.scale.value=S*.5,y.map&&(_.map.value=y.map,e(y.map,_.uvTransform)),y.alphaMap&&(_.alphaMap.value=y.alphaMap,e(y.alphaMap,_.alphaMapTransform)),y.alphaTest>0&&(_.alphaTest.value=y.alphaTest)}function d(_,y){_.diffuse.value.copy(y.color),_.opacity.value=y.opacity,_.rotation.value=y.rotation,y.map&&(_.map.value=y.map,e(y.map,_.mapTransform)),y.alphaMap&&(_.alphaMap.value=y.alphaMap,e(y.alphaMap,_.alphaMapTransform)),y.alphaTest>0&&(_.alphaTest.value=y.alphaTest)}function g(_,y){_.specular.value.copy(y.specular),_.shininess.value=Math.max(y.shininess,1e-4)}function x(_,y){y.gradientMap&&(_.gradientMap.value=y.gradientMap)}function v(_,y){_.metalness.value=y.metalness,y.metalnessMap&&(_.metalnessMap.value=y.metalnessMap,e(y.metalnessMap,_.metalnessMapTransform)),_.roughness.value=y.roughness,y.roughnessMap&&(_.roughnessMap.value=y.roughnessMap,e(y.roughnessMap,_.roughnessMapTransform)),t.get(y).envMap&&(_.envMapIntensity.value=y.envMapIntensity)}function M(_,y,A){_.ior.value=y.ior,y.sheen>0&&(_.sheenColor.value.copy(y.sheenColor).multiplyScalar(y.sheen),_.sheenRoughness.value=y.sheenRoughness,y.sheenColorMap&&(_.sheenColorMap.value=y.sheenColorMap,e(y.sheenColorMap,_.sheenColorMapTransform)),y.sheenRoughnessMap&&(_.sheenRoughnessMap.value=y.sheenRoughnessMap,e(y.sheenRoughnessMap,_.sheenRoughnessMapTransform))),y.clearcoat>0&&(_.clearcoat.value=y.clearcoat,_.clearcoatRoughness.value=y.clearcoatRoughness,y.clearcoatMap&&(_.clearcoatMap.value=y.clearcoatMap,e(y.clearcoatMap,_.clearcoatMapTransform)),y.clearcoatRoughnessMap&&(_.clearcoatRoughnessMap.value=y.clearcoatRoughnessMap,e(y.clearcoatRoughnessMap,_.clearcoatRoughnessMapTransform)),y.clearcoatNormalMap&&(_.clearcoatNormalMap.value=y.clearcoatNormalMap,e(y.clearcoatNormalMap,_.clearcoatNormalMapTransform),_.clearcoatNormalScale.value.copy(y.clearcoatNormalScale),y.side===Ei&&_.clearcoatNormalScale.value.negate())),y.iridescence>0&&(_.iridescence.value=y.iridescence,_.iridescenceIOR.value=y.iridescenceIOR,_.iridescenceThicknessMinimum.value=y.iridescenceThicknessRange[0],_.iridescenceThicknessMaximum.value=y.iridescenceThicknessRange[1],y.iridescenceMap&&(_.iridescenceMap.value=y.iridescenceMap,e(y.iridescenceMap,_.iridescenceMapTransform)),y.iridescenceThicknessMap&&(_.iridescenceThicknessMap.value=y.iridescenceThicknessMap,e(y.iridescenceThicknessMap,_.iridescenceThicknessMapTransform))),y.transmission>0&&(_.transmission.value=y.transmission,_.transmissionSamplerMap.value=A.texture,_.transmissionSamplerSize.value.set(A.width,A.height),y.transmissionMap&&(_.transmissionMap.value=y.transmissionMap,e(y.transmissionMap,_.transmissionMapTransform)),_.thickness.value=y.thickness,y.thicknessMap&&(_.thicknessMap.value=y.thicknessMap,e(y.thicknessMap,_.thicknessMapTransform)),_.attenuationDistance.value=y.attenuationDistance,_.attenuationColor.value.copy(y.attenuationColor)),y.anisotropy>0&&(_.anisotropyVector.value.set(y.anisotropy*Math.cos(y.anisotropyRotation),y.anisotropy*Math.sin(y.anisotropyRotation)),y.anisotropyMap&&(_.anisotropyMap.value=y.anisotropyMap,e(y.anisotropyMap,_.anisotropyMapTransform))),_.specularIntensity.value=y.specularIntensity,_.specularColor.value.copy(y.specularColor),y.specularColorMap&&(_.specularColorMap.value=y.specularColorMap,e(y.specularColorMap,_.specularColorMapTransform)),y.specularIntensityMap&&(_.specularIntensityMap.value=y.specularIntensityMap,e(y.specularIntensityMap,_.specularIntensityMapTransform))}function b(_,y){y.matcap&&(_.matcap.value=y.matcap)}function T(_,y){let A=t.get(y).light;_.referencePosition.value.setFromMatrixPosition(A.matrixWorld),_.nearDistance.value=A.shadow.camera.near,_.farDistance.value=A.shadow.camera.far}return{refreshFogUniforms:o,refreshMaterialUniforms:a}}function PU(r,t,e,o){let a={},l={},h=[],f=e.isWebGL2?r.getParameter(r.MAX_UNIFORM_BUFFER_BINDINGS):0;function p(A,S){let L=S.program;o.uniformBlockBinding(A,L)}function d(A,S){let L=a[A.id];L===void 0&&(b(A),L=g(A),a[A.id]=L,A.addEventListener("dispose",_));let G=S.program;o.updateUBOMapping(A,G);let z=t.render.frame;l[A.id]!==z&&(v(A),l[A.id]=z)}function g(A){let S=x();A.__bindingPointIndex=S;let L=r.createBuffer(),G=A.__size,z=A.usage;return r.bindBuffer(r.UNIFORM_BUFFER,L),r.bufferData(r.UNIFORM_BUFFER,G,z),r.bindBuffer(r.UNIFORM_BUFFER,null),r.bindBufferBase(r.UNIFORM_BUFFER,S,L),L}function x(){for(let A=0;A<f;A++)if(h.indexOf(A)===-1)return h.push(A),A;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function v(A){let S=a[A.id],L=A.uniforms,G=A.__cache;r.bindBuffer(r.UNIFORM_BUFFER,S);for(let z=0,F=L.length;z<F;z++){let I=Array.isArray(L[z])?L[z]:[L[z]];for(let ut=0,R=I.length;ut<R;ut++){let W=I[ut];if(M(W,z,ut,G)===!0){let V=W.__offset,Mt=Array.isArray(W.value)?W.value:[W.value],X=0;for(let mt=0;mt<Mt.length;mt++){let dt=Mt[mt],_t=T(dt);typeof dt=="number"||typeof dt=="boolean"?(W.__data[0]=dt,r.bufferSubData(r.UNIFORM_BUFFER,V+X,W.__data)):dt.isMatrix3?(W.__data[0]=dt.elements[0],W.__data[1]=dt.elements[1],W.__data[2]=dt.elements[2],W.__data[3]=0,W.__data[4]=dt.elements[3],W.__data[5]=dt.elements[4],W.__data[6]=dt.elements[5],W.__data[7]=0,W.__data[8]=dt.elements[6],W.__data[9]=dt.elements[7],W.__data[10]=dt.elements[8],W.__data[11]=0):(dt.toArray(W.__data,X),X+=_t.storage/Float32Array.BYTES_PER_ELEMENT)}r.bufferSubData(r.UNIFORM_BUFFER,V,W.__data)}}}r.bindBuffer(r.UNIFORM_BUFFER,null)}function M(A,S,L,G){let z=A.value,F=S+"_"+L;if(G[F]===void 0)return typeof z=="number"||typeof z=="boolean"?G[F]=z:G[F]=z.clone(),!0;{let I=G[F];if(typeof z=="number"||typeof z=="boolean"){if(I!==z)return G[F]=z,!0}else if(I.equals(z)===!1)return I.copy(z),!0}return!1}function b(A){let S=A.uniforms,L=0,G=16;for(let F=0,I=S.length;F<I;F++){let ut=Array.isArray(S[F])?S[F]:[S[F]];for(let R=0,W=ut.length;R<W;R++){let V=ut[R],Mt=Array.isArray(V.value)?V.value:[V.value];for(let X=0,mt=Mt.length;X<mt;X++){let dt=Mt[X],_t=T(dt),it=L%G;it!==0&&G-it<_t.boundary&&(L+=G-it),V.__data=new Float32Array(_t.storage/Float32Array.BYTES_PER_ELEMENT),V.__offset=L,L+=_t.storage}}}let z=L%G;return z>0&&(L+=G-z),A.__size=L,A.__cache={},this}function T(A){let S={boundary:0,storage:0};return typeof A=="number"||typeof A=="boolean"?(S.boundary=4,S.storage=4):A.isVector2?(S.boundary=8,S.storage=8):A.isVector3||A.isColor?(S.boundary=16,S.storage=12):A.isVector4?(S.boundary=16,S.storage=16):A.isMatrix3?(S.boundary=48,S.storage=48):A.isMatrix4?(S.boundary=64,S.storage=64):A.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",A),S}function _(A){let S=A.target;S.removeEventListener("dispose",_);let L=h.indexOf(S.__bindingPointIndex);h.splice(L,1),r.deleteBuffer(a[S.id]),delete a[S.id],delete l[S.id]}function y(){for(let A in a)r.deleteBuffer(a[A]);h=[],a={},l={}}return{bind:p,update:d,dispose:y}}var Im=class{constructor(t={}){let{canvas:e=N2(),context:o=null,depth:a=!0,stencil:l=!0,alpha:h=!1,antialias:f=!1,premultipliedAlpha:p=!0,preserveDrawingBuffer:d=!1,powerPreference:g="default",failIfMajorPerformanceCaveat:x=!1}=t;this.isWebGLRenderer=!0;let v;o!==null?v=o.getContextAttributes().alpha:v=h;let M=new Uint32Array(4),b=new Int32Array(4),T=null,_=null,y=[],A=[];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=Ao,this._useLegacyLights=!1,this.toneMapping=Rs,this.toneMappingExposure=1;let S=this,L=!1,G=0,z=0,F=null,I=-1,ut=null,R=new zr,W=new zr,V=null,Mt=new vn(0),X=0,mt=e.width,dt=e.height,_t=1,it=null,lt=null,H=new zr(0,0,mt,dt),bt=new zr(0,0,mt,dt),Tt=!1,Yt=new qf,tt=!1,wt=!1,Bt=null,$t=new cr,Ut=new ye,Dt=new yt,At={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function te(){return F===null?_t:1}let rt=o;function an(q,st){for(let vt=0;vt<q.length;vt++){let ht=q[vt],at=e.getContext(ht,st);if(at!==null)return at}return null}try{let q={alpha:!0,depth:a,stencil:l,antialias:f,premultipliedAlpha:p,preserveDrawingBuffer:d,powerPreference:g,failIfMajorPerformanceCaveat:x};if("setAttribute"in e&&e.setAttribute("data-engine",`three.js r${Wm}`),e.addEventListener("webglcontextlost",ct,!1),e.addEventListener("webglcontextrestored",O,!1),e.addEventListener("webglcontextcreationerror",K,!1),rt===null){let st=["webgl2","webgl","experimental-webgl"];if(S.isWebGL1Renderer===!0&&st.shift(),rt=an(st,q),rt===null)throw an(st)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}typeof WebGLRenderingContext!="undefined"&&rt instanceof WebGLRenderingContext&&console.warn("THREE.WebGLRenderer: WebGL 1 support was deprecated in r153 and will be removed in r163."),rt.getShaderPrecisionFormat===void 0&&(rt.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(q){throw console.error("THREE.WebGLRenderer: "+q.message),q}let zt,ne,Wt,ie,ce,Lt,se,Y,N,xt,Et,ot,Pt,ue,Ct,Ot,kt,J,w,P,D,k,B,et;function j(){zt=new W3(rt),ne=new z3(rt,zt,t),zt.init(ne),k=new SU(rt,zt,ne),Wt=new EU(rt,zt,ne),ie=new $3(rt),ce=new lU,Lt=new MU(rt,zt,Wt,ce,ne,k,ie),se=new k3(S),Y=new H3(S),N=new tO(rt,ne),B=new U3(rt,zt,N,ne),xt=new X3(rt,N,ie,B),Et=new j3(rt,xt,N,ie),w=new K3(rt,ne,Lt),Ot=new G3(ce),ot=new uU(S,se,Y,zt,ne,B,Ot),Pt=new CU(S,ce),ue=new fU,Ct=new yU(zt,ne),J=new F3(S,se,Y,Wt,Et,v,p),kt=new xU(S,Et,ne),et=new PU(rt,ie,ne,Wt),P=new B3(rt,zt,ie,ne),D=new Y3(rt,zt,ie,ne),ie.programs=ot.programs,S.capabilities=ne,S.extensions=zt,S.properties=ce,S.renderLists=ue,S.shadowMap=kt,S.state=Wt,S.info=ie}j();let ft=new Pm(S,rt);this.xr=ft,this.getContext=function(){return rt},this.getContextAttributes=function(){return rt.getContextAttributes()},this.forceContextLoss=function(){let q=zt.get("WEBGL_lose_context");q&&q.loseContext()},this.forceContextRestore=function(){let q=zt.get("WEBGL_lose_context");q&&q.restoreContext()},this.getPixelRatio=function(){return _t},this.setPixelRatio=function(q){q!==void 0&&(_t=q,this.setSize(mt,dt,!1))},this.getSize=function(q){return q.set(mt,dt)},this.setSize=function(q,st,vt=!0){if(ft.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}mt=q,dt=st,e.width=Math.floor(q*_t),e.height=Math.floor(st*_t),vt===!0&&(e.style.width=q+"px",e.style.height=st+"px"),this.setViewport(0,0,q,st)},this.getDrawingBufferSize=function(q){return q.set(mt*_t,dt*_t).floor()},this.setDrawingBufferSize=function(q,st,vt){mt=q,dt=st,_t=vt,e.width=Math.floor(q*vt),e.height=Math.floor(st*vt),this.setViewport(0,0,q,st)},this.getCurrentViewport=function(q){return q.copy(R)},this.getViewport=function(q){return q.copy(H)},this.setViewport=function(q,st,vt,ht){q.isVector4?H.set(q.x,q.y,q.z,q.w):H.set(q,st,vt,ht),Wt.viewport(R.copy(H).multiplyScalar(_t).round())},this.getScissor=function(q){return q.copy(bt)},this.setScissor=function(q,st,vt,ht){q.isVector4?bt.set(q.x,q.y,q.z,q.w):bt.set(q,st,vt,ht),Wt.scissor(W.copy(bt).multiplyScalar(_t).round())},this.getScissorTest=function(){return Tt},this.setScissorTest=function(q){Wt.setScissorTest(Tt=q)},this.setOpaqueSort=function(q){it=q},this.setTransparentSort=function(q){lt=q},this.getClearColor=function(q){return q.copy(J.getClearColor())},this.setClearColor=function(){J.setClearColor.apply(J,arguments)},this.getClearAlpha=function(){return J.getClearAlpha()},this.setClearAlpha=function(){J.setClearAlpha.apply(J,arguments)},this.clear=function(q=!0,st=!0,vt=!0){let ht=0;if(q){let at=!1;if(F!==null){let Ht=F.texture.format;at=Ht===rM||Ht===nM||Ht===eM}if(at){let Ht=F.texture.type,Xt=Ht===Ls||Ht===Ps||Ht===Xm||Ht===ya||Ht===QE||Ht===tM,re=J.getClearColor(),Zt=J.getClearAlpha(),me=re.r,oe=re.g,ae=re.b;Xt?(M[0]=me,M[1]=oe,M[2]=ae,M[3]=Zt,rt.clearBufferuiv(rt.COLOR,0,M)):(b[0]=me,b[1]=oe,b[2]=ae,b[3]=Zt,rt.clearBufferiv(rt.COLOR,0,b))}else ht|=rt.COLOR_BUFFER_BIT}st&&(ht|=rt.DEPTH_BUFFER_BIT),vt&&(ht|=rt.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),rt.clear(ht)},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",ct,!1),e.removeEventListener("webglcontextrestored",O,!1),e.removeEventListener("webglcontextcreationerror",K,!1),ue.dispose(),Ct.dispose(),ce.dispose(),se.dispose(),Y.dispose(),Et.dispose(),B.dispose(),et.dispose(),ot.dispose(),kt.dispose(),ft.dispose(),ft.removeEventListener("sessionstart",Ee),ft.removeEventListener("sessionend",de),Bt&&(Bt.dispose(),Bt=null),Se.stop()};function ct(q){q.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),L=!0}function O(){console.log("THREE.WebGLRenderer: Context Restored."),L=!1;let q=ie.autoReset,st=kt.enabled,vt=kt.autoUpdate,ht=kt.needsUpdate,at=kt.type;j(),ie.autoReset=q,kt.enabled=st,kt.autoUpdate=vt,kt.needsUpdate=ht,kt.type=at}function K(q){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",q.statusMessage)}function $(q){let st=q.target;st.removeEventListener("dispose",$),Q(st)}function Q(q){St(q),ce.remove(q)}function St(q){let st=ce.get(q).programs;st!==void 0&&(st.forEach(function(vt){ot.releaseProgram(vt)}),q.isShaderMaterial&&ot.releaseShaderCache(q))}this.renderBufferDirect=function(q,st,vt,ht,at,Ht){st===null&&(st=At);let Xt=at.isMesh&&at.matrixWorld.determinant()<0,re=En(q,st,vt,ht,at);Wt.setMaterial(ht,Xt);let Zt=vt.index,me=1;if(ht.wireframe===!0){if(Zt=xt.getWireframeAttribute(vt),Zt===void 0)return;me=2}let oe=vt.drawRange,ae=vt.attributes.position,un=oe.start*me,vr=(oe.start+oe.count)*me;Ht!==null&&(un=Math.max(un,Ht.start*me),vr=Math.min(vr,(Ht.start+Ht.count)*me)),Zt!==null?(un=Math.max(un,0),vr=Math.min(vr,Zt.count)):ae!=null&&(un=Math.max(un,0),vr=Math.min(vr,ae.count));let Bn=vr-un;if(Bn<0||Bn===1/0)return;B.setup(at,ht,re,vt,Zt);let ti,Mn=P;if(Zt!==null&&(ti=N.get(Zt),Mn=D,Mn.setIndex(ti)),at.isMesh)ht.wireframe===!0?(Wt.setLineWidth(ht.wireframeLinewidth*te()),Mn.setMode(rt.LINES)):Mn.setMode(rt.TRIANGLES);else if(at.isLine){let jt=ht.linewidth;jt===void 0&&(jt=1),Wt.setLineWidth(jt*te()),at.isLineSegments?Mn.setMode(rt.LINES):at.isLineLoop?Mn.setMode(rt.LINE_LOOP):Mn.setMode(rt.LINE_STRIP)}else at.isPoints?Mn.setMode(rt.POINTS):at.isSprite&&Mn.setMode(rt.TRIANGLES);if(at.isBatchedMesh)Mn.renderMultiDraw(at._multiDrawStarts,at._multiDrawCounts,at._multiDrawCount);else if(at.isInstancedMesh)Mn.renderInstances(un,Bn,at.count);else if(vt.isInstancedBufferGeometry){let jt=vt._maxInstanceCount!==void 0?vt._maxInstanceCount:1/0,Na=Math.min(vt.instanceCount,jt);Mn.renderInstances(un,Bn,Na)}else Mn.render(un,Bn)};function Nt(q,st,vt){q.transparent===!0&&q.side===is&&q.forceSinglePass===!1?(q.side=Ei,q.needsUpdate=!0,xn(q,st,vt),q.side=Os,q.needsUpdate=!0,xn(q,st,vt),q.side=is):xn(q,st,vt)}this.compile=function(q,st,vt=null){vt===null&&(vt=q),_=Ct.get(vt),_.init(),A.push(_),vt.traverseVisible(function(at){at.isLight&&at.layers.test(st.layers)&&(_.pushLight(at),at.castShadow&&_.pushShadow(at))}),q!==vt&&q.traverseVisible(function(at){at.isLight&&at.layers.test(st.layers)&&(_.pushLight(at),at.castShadow&&_.pushShadow(at))}),_.setupLights(S._useLegacyLights);let ht=new Set;return q.traverse(function(at){let Ht=at.material;if(Ht)if(Array.isArray(Ht))for(let Xt=0;Xt<Ht.length;Xt++){let re=Ht[Xt];Nt(re,vt,at),ht.add(re)}else Nt(Ht,vt,at),ht.add(Ht)}),A.pop(),_=null,ht},this.compileAsync=function(q,st,vt=null){let ht=this.compile(q,st,vt);return new Promise(at=>{function Ht(){if(ht.forEach(function(Xt){ce.get(Xt).currentProgram.isReady()&&ht.delete(Xt)}),ht.size===0){at(q);return}setTimeout(Ht,10)}zt.get("KHR_parallel_shader_compile")!==null?Ht():setTimeout(Ht,10)})};let Jt=null;function Kt(q){Jt&&Jt(q)}function Ee(){Se.stop()}function de(){Se.start()}let Se=new cM;Se.setAnimationLoop(Kt),typeof self!="undefined"&&Se.setContext(self),this.setAnimationLoop=function(q){Jt=q,ft.setAnimationLoop(q),q===null?Se.stop():Se.start()},ft.addEventListener("sessionstart",Ee),ft.addEventListener("sessionend",de),this.render=function(q,st){if(st!==void 0&&st.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(L===!0)return;q.matrixWorldAutoUpdate===!0&&q.updateMatrixWorld(),st.parent===null&&st.matrixWorldAutoUpdate===!0&&st.updateMatrixWorld(),ft.enabled===!0&&ft.isPresenting===!0&&(ft.cameraAutoUpdate===!0&&ft.updateCamera(st),st=ft.getCamera()),q.isScene===!0&&q.onBeforeRender(S,q,st,F),_=Ct.get(q,A.length),_.init(),A.push(_),$t.multiplyMatrices(st.projectionMatrix,st.matrixWorldInverse),Yt.setFromProjectionMatrix($t),wt=this.localClippingEnabled,tt=Ot.init(this.clippingPlanes,wt),T=ue.get(q,y.length),T.init(),y.push(T),we(q,st,0,S.sortObjects),T.finish(),S.sortObjects===!0&&T.sort(it,lt),this.info.render.frame++,tt===!0&&Ot.beginShadows();let vt=_.state.shadowsArray;if(kt.render(vt,q,st),tt===!0&&Ot.endShadows(),this.info.autoReset===!0&&this.info.reset(),(ft.enabled===!1||ft.isPresenting===!1||ft.hasDepthSensing()===!1)&&J.render(T,q),_.setupLights(S._useLegacyLights),st.isArrayCamera){let ht=st.cameras;for(let at=0,Ht=ht.length;at<Ht;at++){let Xt=ht[at];On(T,q,Xt,Xt.viewport)}}else On(T,q,st);F!==null&&(Lt.updateMultisampleRenderTarget(F),Lt.updateRenderTargetMipmap(F)),q.isScene===!0&&q.onAfterRender(S,q,st),B.resetDefaultState(),I=-1,ut=null,A.pop(),A.length>0?_=A[A.length-1]:_=null,y.pop(),y.length>0?T=y[y.length-1]:T=null};function we(q,st,vt,ht){if(q.visible===!1)return;if(q.layers.test(st.layers)){if(q.isGroup)vt=q.renderOrder;else if(q.isLOD)q.autoUpdate===!0&&q.update(st);else if(q.isLight)_.pushLight(q),q.castShadow&&_.pushShadow(q);else if(q.isSprite){if(!q.frustumCulled||Yt.intersectsSprite(q)){ht&&Dt.setFromMatrixPosition(q.matrixWorld).applyMatrix4($t);let Xt=Et.update(q),re=q.material;re.visible&&T.push(q,Xt,re,vt,Dt.z,null)}}else if((q.isMesh||q.isLine||q.isPoints)&&(!q.frustumCulled||Yt.intersectsObject(q))){let Xt=Et.update(q),re=q.material;if(ht&&(q.boundingSphere!==void 0?(q.boundingSphere===null&&q.computeBoundingSphere(),Dt.copy(q.boundingSphere.center)):(Xt.boundingSphere===null&&Xt.computeBoundingSphere(),Dt.copy(Xt.boundingSphere.center)),Dt.applyMatrix4(q.matrixWorld).applyMatrix4($t)),Array.isArray(re)){let Zt=Xt.groups;for(let me=0,oe=Zt.length;me<oe;me++){let ae=Zt[me],un=re[ae.materialIndex];un&&un.visible&&T.push(q,Xt,un,vt,Dt.z,ae)}}else re.visible&&T.push(q,Xt,re,vt,Dt.z,null)}}let Ht=q.children;for(let Xt=0,re=Ht.length;Xt<re;Xt++)we(Ht[Xt],st,vt,ht)}function On(q,st,vt,ht){let at=q.opaque,Ht=q.transmissive,Xt=q.transparent;_.setupLightsView(vt),tt===!0&&Ot.setGlobalState(S.clippingPlanes,vt),Ht.length>0&&sr(at,Ht,st,vt),ht&&Wt.viewport(R.copy(ht)),at.length>0&&_n(at,st,vt),Ht.length>0&&_n(Ht,st,vt),Xt.length>0&&_n(Xt,st,vt),Wt.buffers.depth.setTest(!0),Wt.buffers.depth.setMask(!0),Wt.buffers.color.setMask(!0),Wt.setPolygonOffset(!1)}function sr(q,st,vt,ht){if((vt.isScene===!0?vt.overrideMaterial:null)!==null)return;let Ht=ne.isWebGL2;Bt===null&&(Bt=new us(1,1,{generateMipmaps:!0,type:zt.has("EXT_color_buffer_half_float")?Nl:Ls,minFilter:ma,samples:Ht?4:0})),S.getDrawingBufferSize(Ut),Ht?Bt.setSize(Ut.x,Ut.y):Bt.setSize(hm(Ut.x),hm(Ut.y));let Xt=S.getRenderTarget();S.setRenderTarget(Bt),S.getClearColor(Mt),X=S.getClearAlpha(),X<1&&S.setClearColor(16777215,.5),S.clear();let re=S.toneMapping;S.toneMapping=Rs,_n(q,vt,ht),Lt.updateMultisampleRenderTarget(Bt),Lt.updateRenderTargetMipmap(Bt);let Zt=!1;for(let me=0,oe=st.length;me<oe;me++){let ae=st[me],un=ae.object,vr=ae.geometry,Bn=ae.material,ti=ae.group;if(Bn.side===is&&un.layers.test(ht.layers)){let Mn=Bn.side;Bn.side=Ei,Bn.needsUpdate=!0,le(un,vt,ht,vr,Bn,ti),Bn.side=Mn,Bn.needsUpdate=!0,Zt=!0}}Zt===!0&&(Lt.updateMultisampleRenderTarget(Bt),Lt.updateRenderTargetMipmap(Bt)),S.setRenderTarget(Xt),S.setClearColor(Mt,X),S.toneMapping=re}function _n(q,st,vt){let ht=st.isScene===!0?st.overrideMaterial:null;for(let at=0,Ht=q.length;at<Ht;at++){let Xt=q[at],re=Xt.object,Zt=Xt.geometry,me=ht===null?Xt.material:ht,oe=Xt.group;re.layers.test(vt.layers)&&le(re,st,vt,Zt,me,oe)}}function le(q,st,vt,ht,at,Ht){q.onBeforeRender(S,st,vt,ht,at,Ht),q.modelViewMatrix.multiplyMatrices(vt.matrixWorldInverse,q.matrixWorld),q.normalMatrix.getNormalMatrix(q.modelViewMatrix),at.onBeforeRender(S,st,vt,ht,q,Ht),at.transparent===!0&&at.side===is&&at.forceSinglePass===!1?(at.side=Ei,at.needsUpdate=!0,S.renderBufferDirect(vt,st,ht,at,q,Ht),at.side=Os,at.needsUpdate=!0,S.renderBufferDirect(vt,st,ht,at,q,Ht),at.side=is):S.renderBufferDirect(vt,st,ht,at,q,Ht),q.onAfterRender(S,st,vt,ht,at,Ht)}function xn(q,st,vt){st.isScene!==!0&&(st=At);let ht=ce.get(q),at=_.state.lights,Ht=_.state.shadowsArray,Xt=at.state.version,re=ot.getParameters(q,at.state,Ht,st,vt),Zt=ot.getProgramCacheKey(re),me=ht.programs;ht.environment=q.isMeshStandardMaterial?st.environment:null,ht.fog=st.fog,ht.envMap=(q.isMeshStandardMaterial?Y:se).get(q.envMap||ht.environment),ht.envMapRotation=ht.environment!==null&&q.envMap===null?st.environmentRotation:q.envMapRotation,me===void 0&&(q.addEventListener("dispose",$),me=new Map,ht.programs=me);let oe=me.get(Zt);if(oe!==void 0){if(ht.currentProgram===oe&&ht.lightsStateVersion===Xt)return Tn(q,re),oe}else re.uniforms=ot.getUniforms(q),q.onBuild(vt,re,S),q.onBeforeCompile(re,S),oe=ot.acquireProgram(re,Zt),me.set(Zt,oe),ht.uniforms=re.uniforms;let ae=ht.uniforms;return(!q.isShaderMaterial&&!q.isRawShaderMaterial||q.clipping===!0)&&(ae.clippingPlanes=Ot.uniform),Tn(q,re),ht.needsLights=yr(q),ht.lightsStateVersion=Xt,ht.needsLights&&(ae.ambientLightColor.value=at.state.ambient,ae.lightProbe.value=at.state.probe,ae.directionalLights.value=at.state.directional,ae.directionalLightShadows.value=at.state.directionalShadow,ae.spotLights.value=at.state.spot,ae.spotLightShadows.value=at.state.spotShadow,ae.rectAreaLights.value=at.state.rectArea,ae.ltc_1.value=at.state.rectAreaLTC1,ae.ltc_2.value=at.state.rectAreaLTC2,ae.pointLights.value=at.state.point,ae.pointLightShadows.value=at.state.pointShadow,ae.hemisphereLights.value=at.state.hemi,ae.directionalShadowMap.value=at.state.directionalShadowMap,ae.directionalShadowMatrix.value=at.state.directionalShadowMatrix,ae.spotShadowMap.value=at.state.spotShadowMap,ae.spotLightMatrix.value=at.state.spotLightMatrix,ae.spotLightMap.value=at.state.spotLightMap,ae.pointShadowMap.value=at.state.pointShadowMap,ae.pointShadowMatrix.value=at.state.pointShadowMatrix),ht.currentProgram=oe,ht.uniformsList=null,oe}function In(q){if(q.uniformsList===null){let st=q.currentProgram.getUniforms();q.uniformsList=Mu.seqWithValue(st.seq,q.uniforms)}return q.uniformsList}function Tn(q,st){let vt=ce.get(q);vt.outputColorSpace=st.outputColorSpace,vt.batching=st.batching,vt.instancing=st.instancing,vt.instancingColor=st.instancingColor,vt.instancingMorph=st.instancingMorph,vt.skinning=st.skinning,vt.morphTargets=st.morphTargets,vt.morphNormals=st.morphNormals,vt.morphColors=st.morphColors,vt.morphTargetsCount=st.morphTargetsCount,vt.numClippingPlanes=st.numClippingPlanes,vt.numIntersection=st.numClipIntersection,vt.vertexAlphas=st.vertexAlphas,vt.vertexTangents=st.vertexTangents,vt.toneMapping=st.toneMapping}function En(q,st,vt,ht,at){st.isScene!==!0&&(st=At),Lt.resetTextureUnits();let Ht=st.fog,Xt=ht.isMeshStandardMaterial?st.environment:null,re=F===null?S.outputColorSpace:F.isXRRenderTarget===!0?F.texture.colorSpace:Bs,Zt=(ht.isMeshStandardMaterial?Y:se).get(ht.envMap||Xt),me=ht.vertexColors===!0&&!!vt.attributes.color&&vt.attributes.color.itemSize===4,oe=!!vt.attributes.tangent&&(!!ht.normalMap||ht.anisotropy>0),ae=!!vt.morphAttributes.position,un=!!vt.morphAttributes.normal,vr=!!vt.morphAttributes.color,Bn=Rs;ht.toneMapped&&(F===null||F.isXRRenderTarget===!0)&&(Bn=S.toneMapping);let ti=vt.morphAttributes.position||vt.morphAttributes.normal||vt.morphAttributes.color,Mn=ti!==void 0?ti.length:0,jt=ce.get(ht),Na=_.state.lights;if(tt===!0&&(wt===!0||q!==ut)){let ei=q===ut&&ht.id===I;Ot.setState(ht,q,ei)}let ln=!1;ht.version===jt.__version?(jt.needsLights&&jt.lightsStateVersion!==Na.state.version||jt.outputColorSpace!==re||at.isBatchedMesh&&jt.batching===!1||!at.isBatchedMesh&&jt.batching===!0||at.isInstancedMesh&&jt.instancing===!1||!at.isInstancedMesh&&jt.instancing===!0||at.isSkinnedMesh&&jt.skinning===!1||!at.isSkinnedMesh&&jt.skinning===!0||at.isInstancedMesh&&jt.instancingColor===!0&&at.instanceColor===null||at.isInstancedMesh&&jt.instancingColor===!1&&at.instanceColor!==null||at.isInstancedMesh&&jt.instancingMorph===!0&&at.morphTexture===null||at.isInstancedMesh&&jt.instancingMorph===!1&&at.morphTexture!==null||jt.envMap!==Zt||ht.fog===!0&&jt.fog!==Ht||jt.numClippingPlanes!==void 0&&(jt.numClippingPlanes!==Ot.numPlanes||jt.numIntersection!==Ot.numIntersection)||jt.vertexAlphas!==me||jt.vertexTangents!==oe||jt.morphTargets!==ae||jt.morphNormals!==un||jt.morphColors!==vr||jt.toneMapping!==Bn||ne.isWebGL2===!0&&jt.morphTargetsCount!==Mn)&&(ln=!0):(ln=!0,jt.__version=ht.version);let Xi=jt.currentProgram;ln===!0&&(Xi=xn(ht,st,at));let Qu=!1,ge=!1,Ys=!1,Sn=Xi.getUniforms(),Yi=jt.uniforms;if(Wt.useProgram(Xi.program)&&(Qu=!0,ge=!0,Ys=!0),ht.id!==I&&(I=ht.id,ge=!0),Qu||ut!==q){Sn.setValue(rt,"projectionMatrix",q.projectionMatrix),Sn.setValue(rt,"viewMatrix",q.matrixWorldInverse);let ei=Sn.map.cameraPosition;ei!==void 0&&ei.setValue(rt,Dt.setFromMatrixPosition(q.matrixWorld)),ne.logarithmicDepthBuffer&&Sn.setValue(rt,"logDepthBufFC",2/(Math.log(q.far+1)/Math.LN2)),(ht.isMeshPhongMaterial||ht.isMeshToonMaterial||ht.isMeshLambertMaterial||ht.isMeshBasicMaterial||ht.isMeshStandardMaterial||ht.isShaderMaterial)&&Sn.setValue(rt,"isOrthographic",q.isOrthographicCamera===!0),ut!==q&&(ut=q,ge=!0,Ys=!0)}if(at.isSkinnedMesh){Sn.setOptional(rt,at,"bindMatrix"),Sn.setOptional(rt,at,"bindMatrixInverse");let ei=at.skeleton;ei&&(ne.floatVertexTextures?(ei.boneTexture===null&&ei.computeBoneTexture(),Sn.setValue(rt,"boneTexture",ei.boneTexture,Lt)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}at.isBatchedMesh&&(Sn.setOptional(rt,at,"batchingTexture"),Sn.setValue(rt,"batchingTexture",at._matricesTexture,Lt));let pe=vt.morphAttributes;if((pe.position!==void 0||pe.normal!==void 0||pe.color!==void 0&&ne.isWebGL2===!0)&&w.update(at,vt,Xi),(ge||jt.receiveShadow!==at.receiveShadow)&&(jt.receiveShadow=at.receiveShadow,Sn.setValue(rt,"receiveShadow",at.receiveShadow)),ht.isMeshGouraudMaterial&&ht.envMap!==null&&(Yi.envMap.value=Zt,Yi.flipEnvMap.value=Zt.isCubeTexture&&Zt.isRenderTargetTexture===!1?-1:1),ge&&(Sn.setValue(rt,"toneMappingExposure",S.toneMappingExposure),jt.needsLights&&Hr(Yi,Ys),Ht&&ht.fog===!0&&Pt.refreshFogUniforms(Yi,Ht),Pt.refreshMaterialUniforms(Yi,ht,_t,dt,Bt),Mu.upload(rt,In(jt),Yi,Lt)),ht.isShaderMaterial&&ht.uniformsNeedUpdate===!0&&(Mu.upload(rt,In(jt),Yi,Lt),ht.uniformsNeedUpdate=!1),ht.isSpriteMaterial&&Sn.setValue(rt,"center",at.center),Sn.setValue(rt,"modelViewMatrix",at.modelViewMatrix),Sn.setValue(rt,"normalMatrix",at.normalMatrix),Sn.setValue(rt,"modelMatrix",at.matrixWorld),ht.isShaderMaterial||ht.isRawShaderMaterial){let ei=ht.uniformsGroups;for(let tl=0,Oa=ei.length;tl<Oa;tl++)if(ne.isWebGL2){let ni=ei[tl];et.update(ni,Xi),et.bind(ni,Xi)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return Xi}function Hr(q,st){q.ambientLightColor.needsUpdate=st,q.lightProbe.needsUpdate=st,q.directionalLights.needsUpdate=st,q.directionalLightShadows.needsUpdate=st,q.pointLights.needsUpdate=st,q.pointLightShadows.needsUpdate=st,q.spotLights.needsUpdate=st,q.spotLightShadows.needsUpdate=st,q.rectAreaLights.needsUpdate=st,q.hemisphereLights.needsUpdate=st}function yr(q){return q.isMeshLambertMaterial||q.isMeshToonMaterial||q.isMeshPhongMaterial||q.isMeshStandardMaterial||q.isShadowMaterial||q.isShaderMaterial&&q.lights===!0}this.getActiveCubeFace=function(){return G},this.getActiveMipmapLevel=function(){return z},this.getRenderTarget=function(){return F},this.setRenderTargetTextures=function(q,st,vt){ce.get(q.texture).__webglTexture=st,ce.get(q.depthTexture).__webglTexture=vt;let ht=ce.get(q);ht.__hasExternalTextures=!0,ht.__autoAllocateDepthBuffer=vt===void 0,ht.__autoAllocateDepthBuffer||zt.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),ht.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(q,st){let vt=ce.get(q);vt.__webglFramebuffer=st,vt.__useDefaultFramebuffer=st===void 0},this.setRenderTarget=function(q,st=0,vt=0){F=q,G=st,z=vt;let ht=!0,at=null,Ht=!1,Xt=!1;if(q){let Zt=ce.get(q);Zt.__useDefaultFramebuffer!==void 0?(Wt.bindFramebuffer(rt.FRAMEBUFFER,null),ht=!1):Zt.__webglFramebuffer===void 0?Lt.setupRenderTarget(q):Zt.__hasExternalTextures&&Lt.rebindTextures(q,ce.get(q.texture).__webglTexture,ce.get(q.depthTexture).__webglTexture);let me=q.texture;(me.isData3DTexture||me.isDataArrayTexture||me.isCompressedArrayTexture)&&(Xt=!0);let oe=ce.get(q).__webglFramebuffer;q.isWebGLCubeRenderTarget?(Array.isArray(oe[st])?at=oe[st][vt]:at=oe[st],Ht=!0):ne.isWebGL2&&q.samples>0&&Lt.useMultisampledRTT(q)===!1?at=ce.get(q).__webglMultisampledFramebuffer:Array.isArray(oe)?at=oe[vt]:at=oe,R.copy(q.viewport),W.copy(q.scissor),V=q.scissorTest}else R.copy(H).multiplyScalar(_t).floor(),W.copy(bt).multiplyScalar(_t).floor(),V=Tt;if(Wt.bindFramebuffer(rt.FRAMEBUFFER,at)&&ne.drawBuffers&&ht&&Wt.drawBuffers(q,at),Wt.viewport(R),Wt.scissor(W),Wt.setScissorTest(V),Ht){let Zt=ce.get(q.texture);rt.framebufferTexture2D(rt.FRAMEBUFFER,rt.COLOR_ATTACHMENT0,rt.TEXTURE_CUBE_MAP_POSITIVE_X+st,Zt.__webglTexture,vt)}else if(Xt){let Zt=ce.get(q.texture),me=st||0;rt.framebufferTextureLayer(rt.FRAMEBUFFER,rt.COLOR_ATTACHMENT0,Zt.__webglTexture,vt||0,me)}I=-1},this.readRenderTargetPixels=function(q,st,vt,ht,at,Ht,Xt){if(!(q&&q.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let re=ce.get(q).__webglFramebuffer;if(q.isWebGLCubeRenderTarget&&Xt!==void 0&&(re=re[Xt]),re){Wt.bindFramebuffer(rt.FRAMEBUFFER,re);try{let Zt=q.texture,me=Zt.format,oe=Zt.type;if(me!==fo&&k.convert(me)!==rt.getParameter(rt.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}let ae=oe===Nl&&(zt.has("EXT_color_buffer_half_float")||ne.isWebGL2&&zt.has("EXT_color_buffer_float"));if(oe!==Ls&&k.convert(oe)!==rt.getParameter(rt.IMPLEMENTATION_COLOR_READ_TYPE)&&!(oe===os&&(ne.isWebGL2||zt.has("OES_texture_float")||zt.has("WEBGL_color_buffer_float")))&&!ae){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}st>=0&&st<=q.width-ht&&vt>=0&&vt<=q.height-at&&rt.readPixels(st,vt,ht,at,k.convert(me),k.convert(oe),Ht)}finally{let Zt=F!==null?ce.get(F).__webglFramebuffer:null;Wt.bindFramebuffer(rt.FRAMEBUFFER,Zt)}}},this.copyFramebufferToTexture=function(q,st,vt=0){let ht=Math.pow(2,-vt),at=Math.floor(st.image.width*ht),Ht=Math.floor(st.image.height*ht);Lt.setTexture2D(st,0),rt.copyTexSubImage2D(rt.TEXTURE_2D,vt,0,0,q.x,q.y,at,Ht),Wt.unbindTexture()},this.copyTextureToTexture=function(q,st,vt,ht=0){let at=st.image.width,Ht=st.image.height,Xt=k.convert(vt.format),re=k.convert(vt.type);Lt.setTexture2D(vt,0),rt.pixelStorei(rt.UNPACK_FLIP_Y_WEBGL,vt.flipY),rt.pixelStorei(rt.UNPACK_PREMULTIPLY_ALPHA_WEBGL,vt.premultiplyAlpha),rt.pixelStorei(rt.UNPACK_ALIGNMENT,vt.unpackAlignment),st.isDataTexture?rt.texSubImage2D(rt.TEXTURE_2D,ht,q.x,q.y,at,Ht,Xt,re,st.image.data):st.isCompressedTexture?rt.compressedTexSubImage2D(rt.TEXTURE_2D,ht,q.x,q.y,st.mipmaps[0].width,st.mipmaps[0].height,Xt,st.mipmaps[0].data):rt.texSubImage2D(rt.TEXTURE_2D,ht,q.x,q.y,Xt,re,st.image),ht===0&&vt.generateMipmaps&&rt.generateMipmap(rt.TEXTURE_2D),Wt.unbindTexture()},this.copyTextureToTexture3D=function(q,st,vt,ht,at=0){if(S.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}let Ht=Math.round(q.max.x-q.min.x),Xt=Math.round(q.max.y-q.min.y),re=q.max.z-q.min.z+1,Zt=k.convert(ht.format),me=k.convert(ht.type),oe;if(ht.isData3DTexture)Lt.setTexture3D(ht,0),oe=rt.TEXTURE_3D;else if(ht.isDataArrayTexture||ht.isCompressedArrayTexture)Lt.setTexture2DArray(ht,0),oe=rt.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}rt.pixelStorei(rt.UNPACK_FLIP_Y_WEBGL,ht.flipY),rt.pixelStorei(rt.UNPACK_PREMULTIPLY_ALPHA_WEBGL,ht.premultiplyAlpha),rt.pixelStorei(rt.UNPACK_ALIGNMENT,ht.unpackAlignment);let ae=rt.getParameter(rt.UNPACK_ROW_LENGTH),un=rt.getParameter(rt.UNPACK_IMAGE_HEIGHT),vr=rt.getParameter(rt.UNPACK_SKIP_PIXELS),Bn=rt.getParameter(rt.UNPACK_SKIP_ROWS),ti=rt.getParameter(rt.UNPACK_SKIP_IMAGES),Mn=vt.isCompressedTexture?vt.mipmaps[at]:vt.image;rt.pixelStorei(rt.UNPACK_ROW_LENGTH,Mn.width),rt.pixelStorei(rt.UNPACK_IMAGE_HEIGHT,Mn.height),rt.pixelStorei(rt.UNPACK_SKIP_PIXELS,q.min.x),rt.pixelStorei(rt.UNPACK_SKIP_ROWS,q.min.y),rt.pixelStorei(rt.UNPACK_SKIP_IMAGES,q.min.z),vt.isDataTexture||vt.isData3DTexture?rt.texSubImage3D(oe,at,st.x,st.y,st.z,Ht,Xt,re,Zt,me,Mn.data):ht.isCompressedArrayTexture?rt.compressedTexSubImage3D(oe,at,st.x,st.y,st.z,Ht,Xt,re,Zt,Mn.data):rt.texSubImage3D(oe,at,st.x,st.y,st.z,Ht,Xt,re,Zt,me,Mn),rt.pixelStorei(rt.UNPACK_ROW_LENGTH,ae),rt.pixelStorei(rt.UNPACK_IMAGE_HEIGHT,un),rt.pixelStorei(rt.UNPACK_SKIP_PIXELS,vr),rt.pixelStorei(rt.UNPACK_SKIP_ROWS,Bn),rt.pixelStorei(rt.UNPACK_SKIP_IMAGES,ti),at===0&&ht.generateMipmaps&&rt.generateMipmap(oe),Wt.unbindTexture()},this.initTexture=function(q){q.isCubeTexture?Lt.setTextureCube(q,0):q.isData3DTexture?Lt.setTexture3D(q,0):q.isDataArrayTexture||q.isCompressedArrayTexture?Lt.setTexture2DArray(q,0):Lt.setTexture2D(q,0),Wt.unbindTexture()},this.resetState=function(){G=0,z=0,F=null,Wt.reset(),B.reset()},typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return ss}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(t){this._outputColorSpace=t;let e=this.getContext();e.drawingBufferColorSpace=t===Ym?"display-p3":"srgb",e.unpackColorSpace=Cn.workingColorSpace===$f?"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}},Rm=class extends Im{};Rm.prototype.isWebGL1Renderer=!0;var Lm=class{constructor(t,e){this.isInterleavedBuffer=!0,this.array=t,this.stride=e,this.count=t!==void 0?t.length/e:0,this.usage=lm,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.version=0,this.uuid=Ns()}onUploadCallback(){}set needsUpdate(t){t===!0&&this.version++}get updateRange(){return aM("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 a=0,l=this.stride;a<l;a++)this.array[t+a]=e.array[o+a];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=Ns()),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=Ns()),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}}},ci=new yt,Xf=class r{constructor(t,e,o,a=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=t,this.itemSize=e,this.offset=o,this.normalized=a}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++)ci.fromBufferAttribute(this,e),ci.applyMatrix4(t),this.setXYZ(e,ci.x,ci.y,ci.z);return this}applyNormalMatrix(t){for(let e=0,o=this.count;e<o;e++)ci.fromBufferAttribute(this,e),ci.applyNormalMatrix(t),this.setXYZ(e,ci.x,ci.y,ci.z);return this}transformDirection(t){for(let e=0,o=this.count;e<o;e++)ci.fromBufferAttribute(this,e),ci.transformDirection(t),this.setXYZ(e,ci.x,ci.y,ci.z);return this}getComponent(t,e){let o=this.array[t*this.data.stride+this.offset+e];return this.normalized&&(o=Po(o,this.array)),o}setComponent(t,e,o){return this.normalized&&(o=An(o,this.array)),this.data.array[t*this.data.stride+this.offset+e]=o,this}setX(t,e){return this.normalized&&(e=An(e,this.array)),this.data.array[t*this.data.stride+this.offset]=e,this}setY(t,e){return this.normalized&&(e=An(e,this.array)),this.data.array[t*this.data.stride+this.offset+1]=e,this}setZ(t,e){return this.normalized&&(e=An(e,this.array)),this.data.array[t*this.data.stride+this.offset+2]=e,this}setW(t,e){return this.normalized&&(e=An(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=Po(e,this.array)),e}getY(t){let e=this.data.array[t*this.data.stride+this.offset+1];return this.normalized&&(e=Po(e,this.array)),e}getZ(t){let e=this.data.array[t*this.data.stride+this.offset+2];return this.normalized&&(e=Po(e,this.array)),e}getW(t){let e=this.data.array[t*this.data.stride+this.offset+3];return this.normalized&&(e=Po(e,this.array)),e}setXY(t,e,o){return t=t*this.data.stride+this.offset,this.normalized&&(e=An(e,this.array),o=An(o,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=o,this}setXYZ(t,e,o,a){return t=t*this.data.stride+this.offset,this.normalized&&(e=An(e,this.array),o=An(o,this.array),a=An(a,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=o,this.data.array[t+2]=a,this}setXYZW(t,e,o,a,l){return t=t*this.data.stride+this.offset,this.normalized&&(e=An(e,this.array),o=An(o,this.array),a=An(a,this.array),l=An(l,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=o,this.data.array[t+2]=a,this.data.array[t+3]=l,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 a=o*this.data.stride+this.offset;for(let l=0;l<this.itemSize;l++)e.push(this.data.array[a+l])}return new Ni(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 r(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 a=o*this.data.stride+this.offset;for(let l=0;l<this.itemSize;l++)e.push(this.data.array[a+l])}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}}},Nm=class extends Ea{constructor(t){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new vn(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}},As,Pl=new yt,du=new yt,mu=new yt,gu=new ye,Il=new ye,gM=new cr,Ef=new yt,Rl=new yt,Mf=new yt,YE=new ye,nm=new ye,$E=new ye,Om=class extends po{constructor(t=new Nm){if(super(),this.isSprite=!0,this.type="Sprite",As===void 0){As=new Us;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 Lm(e,5);As.setIndex([0,1,2,0,2,3]),As.setAttribute("position",new Xf(o,3,0,!1)),As.setAttribute("uv",new Xf(o,2,3,!1))}this.geometry=As,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.'),du.setFromMatrixScale(this.matrixWorld),gM.copy(t.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(t.camera.matrixWorldInverse,this.matrixWorld),mu.setFromMatrixPosition(this.modelViewMatrix),t.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&du.multiplyScalar(-mu.z);let o=this.material.rotation,a,l;o!==0&&(l=Math.cos(o),a=Math.sin(o));let h=this.center;Sf(Ef.set(-.5,-.5,0),mu,h,du,a,l),Sf(Rl.set(.5,-.5,0),mu,h,du,a,l),Sf(Mf.set(.5,.5,0),mu,h,du,a,l),YE.set(0,0),nm.set(1,0),$E.set(1,1);let f=t.ray.intersectTriangle(Ef,Rl,Mf,!1,Pl);if(f===null&&(Sf(Rl.set(-.5,.5,0),mu,h,du,a,l),nm.set(0,1),f=t.ray.intersectTriangle(Ef,Mf,Rl,!1,Pl),f===null))return;let p=t.ray.origin.distanceTo(Pl);p<t.near||p>t.far||e.push({distance:p,point:Pl.clone(),uv:ga.getInterpolation(Pl,Ef,Rl,Mf,YE,nm,$E,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}};Om.Dispose=function(){As.dispose(),As=void 0};function Sf(r,t,e,o,a,l){gu.subVectors(r,e).addScalar(.5).multiply(o),a!==void 0?(Il.x=l*gu.x-a*gu.y,Il.y=a*gu.x+l*gu.y):Il.copy(gu),r.copy(t),r.x+=Il.x,r.y+=Il.y,r.applyMatrix4(gM)}function wf(r,t,e){return!r||!e&&r.constructor===t?r:typeof t.BYTES_PER_ELEMENT=="number"?new t(r):Array.prototype.slice.call(r)}function IU(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}var Au=class{constructor(t,e,o,a){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=a!==void 0?a:new e.constructor(o),this.sampleValues=e,this.valueSize=o,this.settings=null,this.DefaultSettings_={}}evaluate(t){let e=this.parameterPositions,o=this._cachedIndex,a=e[o],l=e[o-1];n:{t:{let h;e:{r:if(!(t<a)){for(let f=o+2;;){if(a===void 0){if(t<l)break r;return o=e.length,this._cachedIndex=o,this.copySampleValue_(o-1)}if(o===f)break;if(l=a,a=e[++o],t<a)break t}h=e.length;break e}if(!(t>=l)){let f=e[1];t<f&&(o=2,l=f);for(let p=o-2;;){if(l===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(o===p)break;if(a=l,l=e[--o-1],t>=l)break t}h=o,o=0;break e}break n}for(;o<h;){let f=o+h>>>1;t<e[f]?h=f:o=f+1}if(a=e[o],l=e[o-1],l===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(a===void 0)return o=e.length,this._cachedIndex=o,this.copySampleValue_(o-1)}this._cachedIndex=o,this.intervalChanged_(o,l,a)}return this.interpolate_(o,l,t,a)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){let e=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=t*a;for(let h=0;h!==a;++h)e[h]=o[l+h];return e}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}},Dm=class extends Au{constructor(t,e,o,a){super(t,e,o,a),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:nE,endingEnd:nE}}intervalChanged_(t,e,o){let a=this.parameterPositions,l=t-2,h=t+1,f=a[l],p=a[h];if(f===void 0)switch(this.getSettings_().endingStart){case rE:l=t,f=2*e-o;break;case iE:l=a.length-2,f=e+a[l]-a[l+1];break;default:l=t,f=o}if(p===void 0)switch(this.getSettings_().endingEnd){case rE:h=t,p=2*o-e;break;case iE:h=1,p=o+a[1]-a[0];break;default:h=t-1,p=e}let d=(o-e)*.5,g=this.valueSize;this._weightPrev=d/(e-f),this._weightNext=d/(p-o),this._offsetPrev=l*g,this._offsetNext=h*g}interpolate_(t,e,o,a){let l=this.resultBuffer,h=this.sampleValues,f=this.valueSize,p=t*f,d=p-f,g=this._offsetPrev,x=this._offsetNext,v=this._weightPrev,M=this._weightNext,b=(o-e)/(a-e),T=b*b,_=T*b,y=-v*_+2*v*T-v*b,A=(1+v)*_+(-1.5-2*v)*T+(-.5+v)*b+1,S=(-1-M)*_+(1.5+M)*T+.5*b,L=M*_-M*T;for(let G=0;G!==f;++G)l[G]=y*h[g+G]+A*h[d+G]+S*h[p+G]+L*h[x+G];return l}},Fm=class extends Au{constructor(t,e,o,a){super(t,e,o,a)}interpolate_(t,e,o,a){let l=this.resultBuffer,h=this.sampleValues,f=this.valueSize,p=t*f,d=p-f,g=(o-e)/(a-e),x=1-g;for(let v=0;v!==f;++v)l[v]=h[d+v]*x+h[p+v]*g;return l}},Um=class extends Au{constructor(t,e,o,a){super(t,e,o,a)}interpolate_(t){return this.copySampleValue_(t-1)}},mo=class{constructor(t,e,o,a){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=wf(e,this.TimeBufferType),this.values=wf(o,this.ValueBufferType),this.setInterpolation(a||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:wf(t.times,Array),values:wf(t.values,Array)};let a=t.getInterpolation();a!==t.DefaultInterpolation&&(o.interpolation=a)}return o.type=t.ValueTypeName,o}InterpolantFactoryMethodDiscrete(t){return new Um(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new Fm(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new Dm(this.times,this.values,this.getValueSize(),t)}setInterpolation(t){let e;switch(t){case Tf:e=this.InterpolantFactoryMethodDiscrete;break;case Af:e=this.InterpolantFactoryMethodLinear;break;case Pd: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 Tf;case this.InterpolantFactoryMethodLinear:return Af;case this.InterpolantFactoryMethodSmooth:return Pd}}getValueSize(){return this.values.length/this.times.length}shift(t){if(t!==0){let e=this.times;for(let o=0,a=e.length;o!==a;++o)e[o]+=t}return this}scale(t){if(t!==1){let e=this.times;for(let o=0,a=e.length;o!==a;++o)e[o]*=t}return this}trim(t,e){let o=this.times,a=o.length,l=0,h=a-1;for(;l!==a&&o[l]<t;)++l;for(;h!==-1&&o[h]>e;)--h;if(++h,l!==0||h!==a){l>=h&&(h=Math.max(h,1),l=h-1);let f=this.getValueSize();this.times=o.slice(l,h),this.values=this.values.slice(l*f,h*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,a=this.values,l=o.length;l===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let h=null;for(let f=0;f!==l;f++){let p=o[f];if(typeof p=="number"&&isNaN(p)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,f,p),t=!1;break}if(h!==null&&h>p){console.error("THREE.KeyframeTrack: Out of order keys.",this,f,p,h),t=!1;break}h=p}if(a!==void 0&&IU(a))for(let f=0,p=a.length;f!==p;++f){let d=a[f];if(isNaN(d)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,f,d),t=!1;break}}return t}optimize(){let t=this.times.slice(),e=this.values.slice(),o=this.getValueSize(),a=this.getInterpolation()===Pd,l=t.length-1,h=1;for(let f=1;f<l;++f){let p=!1,d=t[f],g=t[f+1];if(d!==g&&(f!==1||d!==t[0]))if(a)p=!0;else{let x=f*o,v=x-o,M=x+o;for(let b=0;b!==o;++b){let T=e[x+b];if(T!==e[v+b]||T!==e[M+b]){p=!0;break}}}if(p){if(f!==h){t[h]=t[f];let x=f*o,v=h*o;for(let M=0;M!==o;++M)e[v+M]=e[x+M]}++h}}if(l>0){t[h]=t[l];for(let f=l*o,p=h*o,d=0;d!==o;++d)e[p+d]=e[f+d];++h}return h!==t.length?(this.times=t.slice(0,h),this.values=e.slice(0,h*o)):(this.times=t,this.values=e),this}clone(){let t=this.times.slice(),e=this.values.slice(),o=this.constructor,a=new o(this.name,t,e);return a.createInterpolant=this.createInterpolant,a}};mo.prototype.TimeBufferType=Float32Array;mo.prototype.ValueBufferType=Float32Array;mo.prototype.DefaultInterpolation=Af;var Ma=class extends mo{};Ma.prototype.ValueTypeName="bool";Ma.prototype.ValueBufferType=Array;Ma.prototype.DefaultInterpolation=Tf;Ma.prototype.InterpolantFactoryMethodLinear=void 0;Ma.prototype.InterpolantFactoryMethodSmooth=void 0;var Bm=class extends mo{};Bm.prototype.ValueTypeName="color";var zm=class extends mo{};zm.prototype.ValueTypeName="number";var Gm=class extends Au{constructor(t,e,o,a){super(t,e,o,a)}interpolate_(t,e,o,a){let l=this.resultBuffer,h=this.sampleValues,f=this.valueSize,p=(o-e)/(a-e),d=t*f;for(let g=d+f;d!==g;d+=4)Fs.slerpFlat(l,0,h,d-f,h,d,p);return l}},Fl=class extends mo{InterpolantFactoryMethodLinear(t){return new Gm(this.times,this.values,this.getValueSize(),t)}};Fl.prototype.ValueTypeName="quaternion";Fl.prototype.DefaultInterpolation=Af;Fl.prototype.InterpolantFactoryMethodSmooth=void 0;var Sa=class extends mo{};Sa.prototype.ValueTypeName="string";Sa.prototype.ValueBufferType=Array;Sa.prototype.DefaultInterpolation=Tf;Sa.prototype.InterpolantFactoryMethodLinear=void 0;Sa.prototype.InterpolantFactoryMethodSmooth=void 0;var km=class extends mo{};km.prototype.ValueTypeName="vector";var qm=class{constructor(t,e,o){let a=this,l=!1,h=0,f=0,p,d=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=o,this.itemStart=function(g){f++,l===!1&&a.onStart!==void 0&&a.onStart(g,h,f),l=!0},this.itemEnd=function(g){h++,a.onProgress!==void 0&&a.onProgress(g,h,f),h===f&&(l=!1,a.onLoad!==void 0&&a.onLoad())},this.itemError=function(g){a.onError!==void 0&&a.onError(g)},this.resolveURL=function(g){return p?p(g):g},this.setURLModifier=function(g){return p=g,this},this.addHandler=function(g,x){return d.push(g,x),this},this.removeHandler=function(g){let x=d.indexOf(g);return x!==-1&&d.splice(x,2),this},this.getHandler=function(g){for(let x=0,v=d.length;x<v;x+=2){let M=d[x],b=d[x+1];if(M.global&&(M.lastIndex=0),M.test(g))return b}return null}}},RU=new qm,Vm=class{constructor(t){this.manager=t!==void 0?t:RU,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(t,e){let o=this;return new Promise(function(a,l){o.load(t,a,e,l)})}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}};Vm.DEFAULT_MATERIAL_NAME="__DEFAULT";var Zm="\\[\\]\\.:\\/",LU=new RegExp("["+Zm+"]","g"),Jm="[^"+Zm+"]",NU="[^"+Zm.replace("\\.","")+"]",OU=/((?:WC+[\/:])*)/.source.replace("WC",Jm),DU=/(WCOD+)?/.source.replace("WCOD",NU),FU=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Jm),UU=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Jm),BU=new RegExp("^"+OU+DU+FU+UU+"$"),zU=["material","materials","bones","map"],Hm=class{constructor(t,e,o){let a=o||Vn.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,a)}getValue(t,e){this.bind();let o=this._targetGroup.nCachedObjects_,a=this._bindings[o];a!==void 0&&a.getValue(t,e)}setValue(t,e){let o=this._bindings;for(let a=this._targetGroup.nCachedObjects_,l=o.length;a!==l;++a)o[a].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()}},Vn=class r{constructor(t,e,o){this.path=e,this.parsedPath=o||r.parseTrackName(e),this.node=r.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 r.Composite(t,e,o):new r(t,e,o)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(LU,"")}static parseTrackName(t){let e=BU.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]},a=o.nodeName&&o.nodeName.lastIndexOf(".");if(a!==void 0&&a!==-1){let l=o.nodeName.substring(a+1);zU.indexOf(l)!==-1&&(o.nodeName=o.nodeName.substring(0,a),o.objectName=l)}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(l){for(let h=0;h<l.length;h++){let f=l[h];if(f.name===e||f.uuid===e)return f;let p=o(f.children);if(p)return p}return null},a=o(t.children);if(a)return a}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 a=0,l=o.length;a!==l;++a)t[e++]=o[a]}_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 a=0,l=o.length;a!==l;++a)o[a]=t[e++]}_setValue_array_setNeedsUpdate(t,e){let o=this.resolvedProperty;for(let a=0,l=o.length;a!==l;++a)o[a]=t[e++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,e){let o=this.resolvedProperty;for(let a=0,l=o.length;a!==l;++a)o[a]=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,a=e.propertyName,l=e.propertyIndex;if(t||(t=r.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 d=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 g=0;g<t.length;g++)if(t[g].name===d){d=g;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(d!==void 0){if(t[d]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);return}t=t[d]}}let h=t[a];if(h===void 0){let d=e.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+d+"."+a+" 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 p=this.BindingType.Direct;if(l!==void 0){if(a==="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[l]!==void 0&&(l=t.morphTargetDictionary[l])}p=this.BindingType.ArrayElement,this.resolvedProperty=h,this.propertyIndex=l}else h.fromArray!==void 0&&h.toArray!==void 0?(p=this.BindingType.HasFromToArray,this.resolvedProperty=h):Array.isArray(h)?(p=this.BindingType.EntireArray,this.resolvedProperty=h):this.propertyName=a;this.getValue=this.GetterByBindingType[p],this.setValue=this.SetterByBindingTypeAndVersioning[p][f]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};Vn.Composite=Hm;Vn.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};Vn.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};Vn.prototype.GetterByBindingType=[Vn.prototype._getValue_direct,Vn.prototype._getValue_array,Vn.prototype._getValue_arrayElement,Vn.prototype._getValue_toArray];Vn.prototype.SetterByBindingTypeAndVersioning=[[Vn.prototype._setValue_direct,Vn.prototype._setValue_direct_setNeedsUpdate,Vn.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Vn.prototype._setValue_array,Vn.prototype._setValue_array_setNeedsUpdate,Vn.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Vn.prototype._setValue_arrayElement,Vn.prototype._setValue_arrayElement_setNeedsUpdate,Vn.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Vn.prototype._setValue_fromArray,Vn.prototype._setValue_fromArray_setNeedsUpdate,Vn.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var SH=new Float32Array(1);typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Wm}}));typeof window!="undefined"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Wm);var Cr=63710088e-1,TH={centimeters:Cr*100,centimetres:Cr*100,degrees:Cr/111325,feet:Cr*3.28084,inches:Cr*39.37,kilometers:Cr/1e3,kilometres:Cr/1e3,meters:Cr,metres:Cr,miles:Cr/1609.344,millimeters:Cr*1e3,millimetres:Cr*1e3,nauticalmiles:Cr/1852,radians:1,yards:Cr*1.0936},AH={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/Cr,yards:1.0936133};function pi(r,t,e){e===void 0&&(e={});var o={type:"Feature"};return(e.id===0||e.id)&&(o.id=e.id),e.bbox&&(o.bbox=e.bbox),o.properties=t||{},o.geometry=r,o}function Nn(r,t,e){if(e===void 0&&(e={}),!r)throw new Error("coordinates is required");if(!Array.isArray(r))throw new Error("coordinates must be an Array");if(r.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Ro(r[0])||!Ro(r[1]))throw new Error("coordinates must contain numbers");var o={type:"Point",coordinates:r};return pi(o,t,e)}function Hn(r,t,e){e===void 0&&(e={});for(var o=0,a=r;o<a.length;o++){var l=a[o];if(l.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var h=0;h<l[l.length-1].length;h++)if(l[l.length-1][h]!==l[0][h])throw new Error("First and last Position are not equivalent.")}var f={type:"Polygon",coordinates:r};return pi(f,t,e)}function Pr(r,t,e){if(e===void 0&&(e={}),r.length<2)throw new Error("coordinates must be an array of two or more positions");var o={type:"LineString",coordinates:r};return pi(o,t,e)}function Km(r,t,e){e===void 0&&(e={});var o={type:"MultiPoint",coordinates:r};return pi(o,t,e)}function Ro(r){return!isNaN(r)&&r!==null&&!Array.isArray(r)}function pr(r,t,e){if(r!==null)for(var o,a,l,h,f,p,d,g=0,x=0,v,M=r.type,b=M==="FeatureCollection",T=M==="Feature",_=b?r.features.length:1,y=0;y<_;y++){d=b?r.features[y].geometry:T?r.geometry:r,v=d?d.type==="GeometryCollection":!1,f=v?d.geometries.length:1;for(var A=0;A<f;A++){var S=0,L=0;if(h=v?d.geometries[A]:d,h!==null){p=h.coordinates;var G=h.type;switch(g=e&&(G==="Polygon"||G==="MultiPolygon")?1:0,G){case null:break;case"Point":if(t(p,x,y,S,L)===!1)return!1;x++,S++;break;case"LineString":case"MultiPoint":for(o=0;o<p.length;o++){if(t(p[o],x,y,S,L)===!1)return!1;x++,G==="MultiPoint"&&S++}G==="LineString"&&S++;break;case"Polygon":case"MultiLineString":for(o=0;o<p.length;o++){for(a=0;a<p[o].length-g;a++){if(t(p[o][a],x,y,S,L)===!1)return!1;x++}G==="MultiLineString"&&S++,G==="Polygon"&&L++}G==="Polygon"&&S++;break;case"MultiPolygon":for(o=0;o<p.length;o++){for(L=0,a=0;a<p[o].length;a++){for(l=0;l<p[o][a].length-g;l++){if(t(p[o][a][l],x,y,S,L)===!1)return!1;x++}L++}S++}break;case"GeometryCollection":for(o=0;o<h.geometries.length;o++)if(pr(h.geometries[o],t,e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function yM(r,t,e,o){var a=e;return pr(r,function(l,h,f,p,d){h===0&&e===void 0?a=l:a=t(a,l,h,f,p,d)},o),a}function zs(r,t){var e,o,a,l,h,f,p,d,g,x,v=0,M=r.type==="FeatureCollection",b=r.type==="Feature",T=M?r.features.length:1;for(e=0;e<T;e++){for(f=M?r.features[e].geometry:b?r.geometry:r,d=M?r.features[e].properties:b?r.properties:{},g=M?r.features[e].bbox:b?r.bbox:void 0,x=M?r.features[e].id:b?r.id:void 0,p=f?f.type==="GeometryCollection":!1,h=p?f.geometries.length:1,a=0;a<h;a++){if(l=p?f.geometries[a]:f,l===null){if(t(null,v,d,g,x)===!1)return!1;continue}switch(l.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(t(l,v,d,g,x)===!1)return!1;break}case"GeometryCollection":{for(o=0;o<l.geometries.length;o++)if(t(l.geometries[o],v,d,g,x)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}v++}}function Oi(r,t){zs(r,function(e,o,a,l,h){var f=e===null?null:e.type;switch(f){case null:case"Point":case"LineString":case"Polygon":return t(pi(e,a,{bbox:l,id:h}),o,0)===!1?!1:void 0}var p;switch(f){case"MultiPoint":p="Point";break;case"MultiLineString":p="LineString";break;case"MultiPolygon":p="Polygon";break}for(var d=0;d<e.coordinates.length;d++){var g=e.coordinates[d],x={type:p,coordinates:g};if(t(pi(x,a),o,d)===!1)return!1}})}function jm(r){var t=[1/0,1/0,-1/0,-1/0];return pr(r,function(e){t[0]>e[0]&&(t[0]=e[0]),t[1]>e[1]&&(t[1]=e[1]),t[2]<e[0]&&(t[2]=e[0]),t[3]<e[1]&&(t[3]=e[1])}),t}jm.default=jm;var di=jm;function Gr(r){if(!r)throw new Error("coord is required");if(!Array.isArray(r)){if(r.type==="Feature"&&r.geometry!==null&&r.geometry.type==="Point")return r.geometry.coordinates;if(r.type==="Point")return r.coordinates}if(Array.isArray(r)&&r.length>=2&&!Array.isArray(r[0])&&!Array.isArray(r[1]))return r;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function Qm(r,t,e){if(!r)throw new Error("No feature passed");if(!e)throw new Error(".featureOf() requires a name");if(!r||r.type!=="Feature"||!r.geometry)throw new Error("Invalid input to "+e+", Feature with geometry required");if(!r.geometry||r.geometry.type!==t)throw new Error("Invalid input to "+e+": must be a "+t+", given "+r.geometry.type)}function kr(r){return r.type==="Feature"?r.geometry:r}var YU=gn(Jf(),1);var rB=gn(DM(),1);function Ir(r,t,e){if(e===void 0&&(e={}),!r)throw new Error("point is required");if(!t)throw new Error("polygon is required");var o=Gr(r),a=kr(t),l=a.type,h=t.bbox,f=a.coordinates;if(h&&iB(o,h)===!1)return!1;l==="Polygon"&&(f=[f]);for(var p=!1,d=0;d<f.length&&!p;d++)if(FM(o,f[d][0],e.ignoreBoundary)){for(var g=!1,x=1;x<f[d].length&&!g;)FM(o,f[d][x],!e.ignoreBoundary)&&(g=!0),x++;g||(p=!0)}return p}function FM(r,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 a=0,l=t.length-1;a<t.length;l=a++){var h=t[a][0],f=t[a][1],p=t[l][0],d=t[l][1],g=r[1]*(h-p)+f*(p-r[0])+d*(r[0]-h)===0&&(h-r[0])*(p-r[0])<=0&&(f-r[1])*(d-r[1])<=0;if(g)return!e;var x=f>r[1]!=d>r[1]&&r[0]<(p-h)*(r[1]-f)/(d-f)+h;x&&(o=!o)}return o}function iB(r,t){return t[0]<=r[0]&&t[1]<=r[1]&&t[2]>=r[0]&&t[3]>=r[1]}var zM=new ArrayBuffer(16),n8=new Float64Array(zM),r8=new Uint32Array(zM);var _B=gn(mg(),1);var PW=function(){function r(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],a=this.points[e+1];this.centers.push({x:(o.x+a.x)/2,y:(o.y+a.y)/2,z:(o.z+a.z)/2})}this.controls.push([this.points[0],this.points[0]]);for(var e=0;e<this.centers.length-1;e++){var l=this.points[e+1].x-(this.centers[e].x+this.centers[e+1].x)/2,h=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+l),y:(1-this.sharpness)*this.points[e+1].y+this.sharpness*(this.centers[e].y+h),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+l),y:(1-this.sharpness)*this.points[e+1].y+this.sharpness*(this.centers[e+1].y+h),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 r.prototype.cacheSteps=function(t){var e=[],o=this.pos(0);e.push(0);for(var a=0;a<this.duration;a+=10){var l=this.pos(a),h=Math.sqrt((l.x-o.x)*(l.x-o.x)+(l.y-o.y)*(l.y-o.y)+(l.z-o.z)*(l.z-o.z));h>t&&(e.push(a),o=l)}return e},r.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))}},r.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 a=Math.floor((this.points.length-1)*o),l=(this.length-1)*o-a;return xB(l,this.points[a],this.controls[a][1],this.controls[a+1][0],this.points[a+1])},r}();function xB(r,t,e,o,a){var l=EB(r),h={x:a.x*l[0]+o.x*l[1]+e.x*l[2]+t.x*l[3],y:a.y*l[0]+o.y*l[1]+e.y*l[2]+t.y*l[3],z:a.z*l[0]+o.z*l[1]+e.z*l[2]+t.z*l[3]};return h}function EB(r){var t=r*r,e=t*r;return[e,3*t*(1-r),3*r*(1-r)*(1-r),(1-r)*(1-r)*(1-r)]}function Gl(r,t){t===void 0&&(t={});var e=Number(r[0]),o=Number(r[1]),a=Number(r[2]),l=Number(r[3]);if(r.length===6)throw new Error("@turf/bbox-polygon does not support BBox with 6 positions");var h=[e,o],f=[e,l],p=[a,l],d=[a,o];return Hn([[h,d,p,f,h]],t.properties,{bbox:r,id:t.id})}function MB(r){return Gl(di(r))}var gg=MB;var zB=gn(JM(),1);var hz=gn(ph(),1);var dz=gn(Jf(),1);var yz=gn(mg(),1);var dS=Math.PI/180,mS=180/Math.PI,Yl=function(r,t){this.lon=r,this.lat=t,this.x=dS*r,this.y=dS*t};Yl.prototype.view=function(){return String(this.lon).slice(0,4)+","+String(this.lat).slice(0,4)};Yl.prototype.antipode=function(){var r=-1*this.lat,t=this.lon<0?180+this.lon:(180-this.lon)*-1;return new Yl(t,r)};var gS=function(){this.coords=[],this.length=0};gS.prototype.move_to=function(r){this.length++,this.coords.push(r)};var Fg=function(r){this.properties=r||{},this.geometries=[]};Fg.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 r=[],t=0;t<this.geometries.length;t++)r.push(this.geometries[t].coords);return{geometry:{type:"MultiLineString",coordinates:r},type:"Feature",properties:this.properties}};Fg.prototype.wkt=function(){for(var r="",t="LINESTRING(",e=function(l){t+=l[0]+" "+l[1]+","},o=0;o<this.geometries.length;o++){if(this.geometries[o].coords.length===0)return"LINESTRING(empty)";var a=this.geometries[o].coords;a.forEach(e),r+=t.substring(0,t.length-1)+")"}return r};var yS=function(r,t,e){if(!r||r.x===void 0||r.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 Yl(r.x,r.y),this.end=new Yl(t.x,t.y),this.properties=e||{};var o=this.start.x-this.end.x,a=this.start.y-this.end.y,l=Math.pow(Math.sin(a/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(l)),this.g===Math.PI)throw new Error("it appears "+r.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 "+r+" and "+t)};yS.prototype.interpolate=function(r){var t=Math.sin((1-r)*this.g)/Math.sin(this.g),e=Math.sin(r*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),a=t*Math.cos(this.start.y)*Math.sin(this.start.x)+e*Math.cos(this.end.y)*Math.sin(this.end.x),l=t*Math.sin(this.start.y)+e*Math.sin(this.end.y),h=mS*Math.atan2(l,Math.sqrt(Math.pow(o,2)+Math.pow(a,2))),f=mS*Math.atan2(a,o);return[f,h]};yS.prototype.Arc=function(r,t){var e=[];if(!r||r<=2)e.push([this.start.lon,this.start.lat]),e.push([this.end.lon,this.end.lat]);else for(var o=1/(r-1),a=0;a<r;++a){var l=o*a,h=this.interpolate(l);e.push(h)}for(var f=!1,p=0,d=t&&t.offset?t.offset:10,g=180-d,x=-180+d,v=360-d,M=1;M<e.length;++M){var b=e[M-1][0],T=e[M][0],_=Math.abs(T-b);_>v&&(T>g&&b<x||b>g&&T<x)?f=!0:_>p&&(p=_)}var y=[];if(f&&p<d){var A=[];y.push(A);for(var S=0;S<e.length;++S){var L=parseFloat(e[S][0]);if(S>0&&Math.abs(L-e[S-1][0])>v){var G=parseFloat(e[S-1][0]),z=parseFloat(e[S-1][1]),F=parseFloat(e[S][0]),I=parseFloat(e[S][1]);if(G>-180&&G<x&&F===180&&S+1<e.length&&e[S-1][0]>-180&&e[S-1][0]<x){A.push([-180,e[S][1]]),S++,A.push([e[S][0],e[S][1]]);continue}else if(G>g&&G<180&&F===-180&&S+1<e.length&&e[S-1][0]>g&&e[S-1][0]<180){A.push([180,e[S][1]]),S++,A.push([e[S][0],e[S][1]]);continue}if(G<x&&F>g){var ut=G;G=F,F=ut;var R=z;z=I,I=R}if(G>g&&F<x&&(F+=360),G<=180&&F>=180&&G<F){var W=(180-G)/(F-G),V=W*I+(1-W)*z;A.push([e[S-1][0]>g?180:-180,V]),A=[],A.push([e[S-1][0]>g?-180:180,V]),y.push(A)}else A=[],y.push(A);A.push([L,e[S][1]])}else A.push([e[S][0],e[S][1]])}}else{var Mt=[];y.push(Mt);for(var X=0;X<e.length;++X)Mt.push([e[X][0],e[X][1]])}for(var mt=new Fg(this.properties),dt=0;dt<y.length;++dt){var _t=new gS;mt.geometries.push(_t);for(var it=y[dt],lt=0;lt<it.length;++lt)_t.move_to(it[lt])}return mt};var xz=gn(ph(),1);var _k=gn(ph(),1);var xk=gn(c0(),1);var Sk=gn(Jf(),1);var be=[],Te=[],Ae=[],Ce=[],Pe=[],Ie=[],Re=[],Le=[],Ne=[],Oe=[],De=[],Fe=[],Ue=[],Be=[],ze=[],Ge=[],ke=[],qe=[],Ve=[],He=[],We=[],Xe=[],Ye=[],$e=[];Re[85]=Oe[85]=-1;Le[85]=De[85]=0;Ne[85]=Fe[85]=1;Ve[85]=Xe[85]=1;He[85]=Ye[85]=0;We[85]=$e[85]=1;be[85]=Ce[85]=0;Te[85]=Pe[85]=-1;Ae[85]=ze[85]=0;Ge[85]=Ue[85]=0;ke[85]=Be[85]=1;Ie[85]=qe[85]=1;Xe[1]=Xe[169]=0;Ye[1]=Ye[169]=-1;$e[1]=$e[169]=0;Ue[1]=Ue[169]=-1;Be[1]=Be[169]=0;ze[1]=ze[169]=0;Oe[4]=Oe[166]=0;De[4]=De[166]=-1;Fe[4]=Fe[166]=1;Ge[4]=Ge[166]=1;ke[4]=ke[166]=0;qe[4]=qe[166]=0;Re[16]=Re[154]=0;Le[16]=Le[154]=1;Ne[16]=Ne[154]=1;Ce[16]=Ce[154]=1;Pe[16]=Pe[154]=0;Ie[16]=Ie[154]=1;Ve[64]=Ve[106]=0;He[64]=He[106]=1;We[64]=We[106]=0;be[64]=be[106]=-1;Te[64]=Te[106]=0;Ae[64]=Ae[106]=1;Ve[2]=Ve[168]=0;He[2]=He[168]=-1;We[2]=We[168]=1;Xe[2]=Xe[168]=0;Ye[2]=Ye[168]=-1;$e[2]=$e[168]=0;Ue[2]=Ue[168]=-1;Be[2]=Be[168]=0;ze[2]=ze[168]=0;Ge[2]=Ge[168]=-1;ke[2]=ke[168]=0;qe[2]=qe[168]=1;Re[8]=Re[162]=0;Le[8]=Le[162]=-1;Ne[8]=Ne[162]=0;Oe[8]=Oe[162]=0;De[8]=De[162]=-1;Fe[8]=Fe[162]=1;Ue[8]=Ue[162]=1;Be[8]=Be[162]=0;ze[8]=ze[162]=1;Ge[8]=Ge[162]=1;ke[8]=ke[162]=0;qe[8]=qe[162]=0;Re[32]=Re[138]=0;Le[32]=Le[138]=1;Ne[32]=Ne[138]=1;Oe[32]=Oe[138]=0;De[32]=De[138]=1;Fe[32]=Fe[138]=0;be[32]=be[138]=1;Te[32]=Te[138]=0;Ae[32]=Ae[138]=0;Ce[32]=Ce[138]=1;Pe[32]=Pe[138]=0;Ie[32]=Ie[138]=1;Xe[128]=Xe[42]=0;Ye[128]=Ye[42]=1;$e[128]=$e[42]=1;Ve[128]=Ve[42]=0;He[128]=He[42]=1;We[128]=We[42]=0;be[128]=be[42]=-1;Te[128]=Te[42]=0;Ae[128]=Ae[42]=1;Ce[128]=Ce[42]=-1;Pe[128]=Pe[42]=0;Ie[128]=Ie[42]=0;Oe[5]=Oe[165]=-1;De[5]=De[165]=0;Fe[5]=Fe[165]=0;Xe[5]=Xe[165]=1;Ye[5]=Ye[165]=0;$e[5]=$e[165]=0;Ge[20]=Ge[150]=0;ke[20]=ke[150]=1;qe[20]=qe[150]=1;Ce[20]=Ce[150]=0;Pe[20]=Pe[150]=-1;Ie[20]=Ie[150]=1;Re[80]=Re[90]=-1;Le[80]=Le[90]=0;Ne[80]=Ne[90]=1;Ve[80]=Ve[90]=1;He[80]=He[90]=0;We[80]=We[90]=1;Ue[65]=Ue[105]=0;Be[65]=Be[105]=1;ze[65]=ze[105]=0;be[65]=be[105]=0;Te[65]=Te[105]=-1;Ae[65]=Ae[105]=0;Re[160]=Re[10]=-1;Le[160]=Le[10]=0;Ne[160]=Ne[10]=1;Oe[160]=Oe[10]=-1;De[160]=De[10]=0;Fe[160]=Fe[10]=0;Xe[160]=Xe[10]=1;Ye[160]=Ye[10]=0;$e[160]=$e[10]=0;Ve[160]=Ve[10]=1;He[160]=He[10]=0;We[160]=We[10]=1;Ge[130]=Ge[40]=0;ke[130]=ke[40]=1;qe[130]=qe[40]=1;Ue[130]=Ue[40]=0;Be[130]=Be[40]=1;ze[130]=ze[40]=0;be[130]=be[40]=0;Te[130]=Te[40]=-1;Ae[130]=Ae[40]=0;Ce[130]=Ce[40]=0;Pe[130]=Pe[40]=-1;Ie[130]=Ie[40]=1;Oe[37]=Oe[133]=0;De[37]=De[133]=1;Fe[37]=Fe[133]=1;Xe[37]=Xe[133]=0;Ye[37]=Ye[133]=1;$e[37]=$e[133]=0;be[37]=be[133]=-1;Te[37]=Te[133]=0;Ae[37]=Ae[133]=0;Ce[37]=Ce[133]=1;Pe[37]=Pe[133]=0;Ie[37]=Ie[133]=0;Ge[148]=Ge[22]=-1;ke[148]=ke[22]=0;qe[148]=qe[22]=0;Xe[148]=Xe[22]=0;Ye[148]=Ye[22]=-1;$e[148]=$e[22]=1;Ve[148]=Ve[22]=0;He[148]=He[22]=1;We[148]=We[22]=1;Ce[148]=Ce[22]=-1;Pe[148]=Pe[22]=0;Ie[148]=Ie[22]=1;Re[82]=Re[88]=0;Le[82]=Le[88]=-1;Ne[82]=Ne[88]=1;Ge[82]=Ge[88]=1;ke[82]=ke[88]=0;qe[82]=qe[88]=1;Ue[82]=Ue[88]=-1;Be[82]=Be[88]=0;ze[82]=ze[88]=1;Ve[82]=Ve[88]=0;He[82]=He[88]=-1;We[82]=We[88]=0;Re[73]=Re[97]=0;Le[73]=Le[97]=1;Ne[73]=Ne[97]=0;Oe[73]=Oe[97]=0;De[73]=De[97]=-1;Fe[73]=Fe[97]=0;Ue[73]=Ue[97]=1;Be[73]=Be[97]=0;ze[73]=ze[97]=0;be[73]=be[97]=1;Te[73]=Te[97]=0;Ae[73]=Ae[97]=1;Re[145]=Re[25]=0;Le[145]=Le[25]=-1;Ne[145]=Ne[25]=0;Ue[145]=Ue[25]=1;Be[145]=Be[25]=0;ze[145]=ze[25]=1;Xe[145]=Xe[25]=0;Ye[145]=Ye[25]=1;$e[145]=$e[25]=1;Ce[145]=Ce[25]=-1;Pe[145]=Pe[25]=0;Ie[145]=Ie[25]=0;Oe[70]=Oe[100]=0;De[70]=De[100]=1;Fe[70]=Fe[100]=0;Ge[70]=Ge[100]=-1;ke[70]=ke[100]=0;qe[70]=qe[100]=1;Ve[70]=Ve[100]=0;He[70]=He[100]=-1;We[70]=We[100]=1;be[70]=be[100]=1;Te[70]=Te[100]=0;Ae[70]=Ae[100]=0;Oe[101]=Oe[69]=0;De[101]=De[69]=1;Fe[101]=Fe[69]=0;be[101]=be[69]=1;Te[101]=Te[69]=0;Ae[101]=Ae[69]=0;Xe[149]=Xe[21]=0;Ye[149]=Ye[21]=1;$e[149]=$e[21]=1;Ce[149]=Ce[21]=-1;Pe[149]=Pe[21]=0;Ie[149]=Ie[21]=0;Ge[86]=Ge[84]=-1;ke[86]=ke[84]=0;qe[86]=qe[84]=1;Ve[86]=Ve[84]=0;He[86]=He[84]=-1;We[86]=We[84]=1;Re[89]=Re[81]=0;Le[89]=Le[81]=-1;Ne[89]=Ne[81]=0;Ue[89]=Ue[81]=1;Be[89]=Be[81]=0;ze[89]=ze[81]=1;Re[96]=Re[74]=0;Le[96]=Le[74]=1;Ne[96]=Ne[74]=0;Oe[96]=Oe[74]=-1;De[96]=De[74]=0;Fe[96]=Fe[74]=1;Ve[96]=Ve[74]=1;He[96]=He[74]=0;We[96]=We[74]=0;be[96]=be[74]=1;Te[96]=Te[74]=0;Ae[96]=Ae[74]=1;Re[24]=Re[146]=0;Le[24]=Le[146]=-1;Ne[24]=Ne[146]=1;Ge[24]=Ge[146]=1;ke[24]=ke[146]=0;qe[24]=qe[146]=1;Ue[24]=Ue[146]=0;Be[24]=Be[146]=1;ze[24]=ze[146]=1;Ce[24]=Ce[146]=0;Pe[24]=Pe[146]=-1;Ie[24]=Ie[146]=0;Oe[6]=Oe[164]=-1;De[6]=De[164]=0;Fe[6]=Fe[164]=1;Ge[6]=Ge[164]=-1;ke[6]=ke[164]=0;qe[6]=qe[164]=0;Xe[6]=Xe[164]=0;Ye[6]=Ye[164]=-1;$e[6]=$e[164]=1;Ve[6]=Ve[164]=1;He[6]=He[164]=0;We[6]=We[164]=0;Ue[129]=Ue[41]=0;Be[129]=Be[41]=1;ze[129]=ze[41]=1;Xe[129]=Xe[41]=0;Ye[129]=Ye[41]=1;$e[129]=$e[41]=0;be[129]=be[41]=-1;Te[129]=Te[41]=0;Ae[129]=Ae[41]=0;Ce[129]=Ce[41]=0;Pe[129]=Pe[41]=-1;Ie[129]=Ie[41]=0;Ge[66]=Ge[104]=0;ke[66]=ke[104]=1;qe[66]=qe[104]=0;Ue[66]=Ue[104]=-1;Be[66]=Be[104]=0;ze[66]=ze[104]=1;Ve[66]=Ve[104]=0;He[66]=He[104]=-1;We[66]=We[104]=0;be[66]=be[104]=0;Te[66]=Te[104]=-1;Ae[66]=Ae[104]=1;Re[144]=Re[26]=-1;Le[144]=Le[26]=0;Ne[144]=Ne[26]=0;Xe[144]=Xe[26]=1;Ye[144]=Ye[26]=0;$e[144]=$e[26]=1;Ve[144]=Ve[26]=0;He[144]=He[26]=1;We[144]=We[26]=1;Ce[144]=Ce[26]=-1;Pe[144]=Pe[26]=0;Ie[144]=Ie[26]=1;Oe[36]=Oe[134]=0;De[36]=De[134]=1;Fe[36]=Fe[134]=1;Ge[36]=Ge[134]=0;ke[36]=ke[134]=1;qe[36]=qe[134]=0;be[36]=be[134]=0;Te[36]=Te[134]=-1;Ae[36]=Ae[134]=1;Ce[36]=Ce[134]=1;Pe[36]=Pe[134]=0;Ie[36]=Ie[134]=0;Re[9]=Re[161]=-1;Le[9]=Le[161]=0;Ne[9]=Ne[161]=0;Oe[9]=Oe[161]=0;De[9]=De[161]=-1;Fe[9]=Fe[161]=0;Ue[9]=Ue[161]=1;Be[9]=Be[161]=0;ze[9]=ze[161]=0;Xe[9]=Xe[161]=1;Ye[9]=Ye[161]=0;$e[9]=$e[161]=1;Re[136]=0;Le[136]=1;Ne[136]=1;Oe[136]=0;De[136]=1;Fe[136]=0;Ge[136]=-1;ke[136]=0;qe[136]=1;Ue[136]=-1;Be[136]=0;ze[136]=0;Xe[136]=0;Ye[136]=-1;$e[136]=0;Ve[136]=0;He[136]=-1;We[136]=1;be[136]=1;Te[136]=0;Ae[136]=0;Ce[136]=1;Pe[136]=0;Ie[136]=1;Re[34]=0;Le[34]=-1;Ne[34]=0;Oe[34]=0;De[34]=-1;Fe[34]=1;Ge[34]=1;ke[34]=0;qe[34]=0;Ue[34]=1;Be[34]=0;ze[34]=1;Xe[34]=0;Ye[34]=1;$e[34]=1;Ve[34]=0;He[34]=1;We[34]=0;be[34]=-1;Te[34]=0;Ae[34]=1;Ce[34]=-1;Pe[34]=0;Ie[34]=0;Re[35]=0;Le[35]=1;Ne[35]=1;Oe[35]=0;De[35]=-1;Fe[35]=1;Ge[35]=1;ke[35]=0;qe[35]=0;Ue[35]=-1;Be[35]=0;ze[35]=0;Xe[35]=0;Ye[35]=-1;$e[35]=0;Ve[35]=0;He[35]=1;We[35]=0;be[35]=-1;Te[35]=0;Ae[35]=1;Ce[35]=1;Pe[35]=0;Ie[35]=1;Re[153]=0;Le[153]=1;Ne[153]=1;Ue[153]=-1;Be[153]=0;ze[153]=0;Xe[153]=0;Ye[153]=-1;$e[153]=0;Ce[153]=1;Pe[153]=0;Ie[153]=1;Oe[102]=0;De[102]=-1;Fe[102]=1;Ge[102]=1;ke[102]=0;qe[102]=0;Ve[102]=0;He[102]=1;We[102]=0;be[102]=-1;Te[102]=0;Ae[102]=1;Re[155]=0;Le[155]=-1;Ne[155]=0;Ue[155]=1;Be[155]=0;ze[155]=1;Xe[155]=0;Ye[155]=1;$e[155]=1;Ce[155]=-1;Pe[155]=0;Ie[155]=0;Oe[103]=0;De[103]=1;Fe[103]=0;Ge[103]=-1;ke[103]=0;qe[103]=1;Ve[103]=0;He[103]=-1;We[103]=1;be[103]=1;Te[103]=0;Ae[103]=0;Re[152]=0;Le[152]=1;Ne[152]=1;Ge[152]=-1;ke[152]=0;qe[152]=1;Ue[152]=-1;Be[152]=0;ze[152]=0;Xe[152]=0;Ye[152]=-1;$e[152]=0;Ve[152]=0;He[152]=-1;We[152]=1;Ce[152]=1;Pe[152]=0;Ie[152]=1;Re[156]=0;Le[156]=-1;Ne[156]=1;Ge[156]=1;ke[156]=0;qe[156]=1;Ue[156]=-1;Be[156]=0;ze[156]=0;Xe[156]=0;Ye[156]=-1;$e[156]=0;Ve[156]=0;He[156]=1;We[156]=1;Ce[156]=-1;Pe[156]=0;Ie[156]=1;Re[137]=0;Le[137]=1;Ne[137]=1;Oe[137]=0;De[137]=1;Fe[137]=0;Ue[137]=-1;Be[137]=0;ze[137]=0;Xe[137]=0;Ye[137]=-1;$e[137]=0;be[137]=1;Te[137]=0;Ae[137]=0;Ce[137]=1;Pe[137]=0;Ie[137]=1;Re[139]=0;Le[139]=1;Ne[139]=1;Oe[139]=0;De[139]=-1;Fe[139]=0;Ue[139]=1;Be[139]=0;ze[139]=0;Xe[139]=0;Ye[139]=1;$e[139]=0;be[139]=-1;Te[139]=0;Ae[139]=0;Ce[139]=1;Pe[139]=0;Ie[139]=1;Re[98]=0;Le[98]=-1;Ne[98]=0;Oe[98]=0;De[98]=-1;Fe[98]=1;Ge[98]=1;ke[98]=0;qe[98]=0;Ue[98]=1;Be[98]=0;ze[98]=1;Ve[98]=0;He[98]=1;We[98]=0;be[98]=-1;Te[98]=0;Ae[98]=1;Re[99]=0;Le[99]=1;Ne[99]=0;Oe[99]=0;De[99]=-1;Fe[99]=1;Ge[99]=1;ke[99]=0;qe[99]=0;Ue[99]=-1;Be[99]=0;ze[99]=1;Ve[99]=0;He[99]=-1;We[99]=0;be[99]=1;Te[99]=0;Ae[99]=1;Oe[38]=0;De[38]=-1;Fe[38]=1;Ge[38]=1;ke[38]=0;qe[38]=0;Xe[38]=0;Ye[38]=1;$e[38]=1;Ve[38]=0;He[38]=1;We[38]=0;be[38]=-1;Te[38]=0;Ae[38]=1;Ce[38]=-1;Pe[38]=0;Ie[38]=0;Oe[39]=0;De[39]=1;Fe[39]=1;Ge[39]=-1;ke[39]=0;qe[39]=0;Xe[39]=0;Ye[39]=-1;$e[39]=1;Ve[39]=0;He[39]=1;We[39]=0;be[39]=-1;Te[39]=0;Ae[39]=1;Ce[39]=1;Pe[39]=0;Ie[39]=0;var f0=function(r){return[[r.bottomleft,0],[0,0],[0,r.leftbottom]]},h0=function(r){return[[1,r.rightbottom],[1,0],[r.bottomright,0]]},p0=function(r){return[[r.topright,1],[1,1],[1,r.righttop]]},d0=function(r){return[[0,r.lefttop],[0,1],[r.topleft,1]]},m0=function(r){return[[r.bottomright,0],[r.bottomleft,0],[0,r.leftbottom],[0,r.lefttop]]},g0=function(r){return[[r.bottomright,0],[r.bottomleft,0],[1,r.righttop],[1,r.rightbottom]]},y0=function(r){return[[1,r.righttop],[1,r.rightbottom],[r.topleft,1],[r.topright,1]]},v0=function(r){return[[0,r.leftbottom],[0,r.lefttop],[r.topleft,1],[r.topright,1]]},wk=function(r){return[[0,0],[0,r.leftbottom],[1,r.rightbottom],[1,0]]},bk=function(r){return[[1,0],[r.bottomright,0],[r.topright,1],[1,1]]},Tk=function(r){return[[1,1],[1,r.righttop],[0,r.lefttop],[0,1]]},Ak=function(r){return[[r.bottomleft,0],[0,0],[0,1],[r.topleft,1]]},Ck=function(r){return[[1,r.righttop],[1,r.rightbottom],[0,r.leftbottom],[0,r.lefttop]]},Pk=function(r){return[[r.topleft,1],[r.topright,1],[r.bottomright,0],[r.bottomleft,0]]},Ik=function(){return[[0,0],[0,1],[1,1],[1,0]]},Rk=function(r){return[[1,r.rightbottom],[1,0],[0,0],[0,1],[r.topleft,1]]},Lk=function(r){return[[r.topright,1],[1,1],[1,0],[0,0],[0,r.leftbottom]]},Nk=function(r){return[[1,0],[r.bottomright,0],[0,r.lefttop],[0,1],[1,1]]},Ok=function(r){return[[1,1],[1,r.righttop],[r.bottomleft,0],[0,0],[0,1]]},Dk=function(r){return[[1,r.righttop],[1,r.rightbottom],[0,r.lefttop],[0,1],[r.topleft,1]]},Fk=function(r){return[[1,1],[1,r.righttop],[r.bottomright,0],[r.bottomleft,0],[r.topright,1]]},Uk=function(r){return[[1,r.rightbottom],[1,0],[r.bottomright,0],[0,r.leftbottom],[0,r.lefttop]]},Bk=function(r){return[[r.topright,1],[r.bottomleft,0],[0,0],[0,r.leftbottom],[r.topleft,1]]},zk=function(r){return[[r.bottomright,0],[r.bottomleft,0],[0,r.lefttop],[0,1],[r.topleft,1]]},Gk=function(r){return[[1,1],[1,r.righttop],[0,r.leftbottom],[0,r.lefttop],[r.topright,1]]},kk=function(r){return[[1,r.rightbottom],[1,0],[r.bottomright,0],[r.topleft,1],[r.topright,1]]},qk=function(r){return[[1,r.righttop],[1,r.rightbottom],[r.bottomleft,0],[0,0],[0,r.leftbottom]]},Vk=function(r){return[[1,r.rightbottom],[1,0],[0,0],[0,r.leftbottom],[r.topleft,1],[r.topright,1]]},Hk=function(r){return[[1,1],[1,0],[r.bottomright,0],[0,r.leftbottom],[0,r.lefttop],[r.topright,1]]},Wk=function(r){return[[1,1],[1,r.righttop],[r.bottomright,0],[r.bottomleft,0],[0,r.lefttop],[0,1]]},Xk=function(r){return[[1,r.righttop],[1,r.rightbottom],[r.bottomleft,0],[0,0],[0,1],[r.topleft,1]]},Yk=function(r){return[[1,1],[1,r.righttop],[r.bottomleft,0],[0,0],[0,r.leftbottom],[r.topright,1]]},$k=function(r){return[[1,r.rightbottom],[1,0],[r.bottomright,0],[0,r.lefttop],[0,1],[r.topleft,1]]},Zk=function(r){return[[1,r.righttop],[1,r.rightbottom],[r.bottomright,0],[r.bottomleft,0],[0,r.leftbottom],[0,r.lefttop],[r.topleft,1],[r.topright,1]]},Jk=function(r){return[[1,1],[1,r.righttop],[r.bottomleft,0],[0,0],[0,r.leftbottom],[r.topright,1]]},Kk=function(r){return[[1,r.rightbottom],[1,0],[r.bottomright,0],[0,r.lefttop],[0,1],[r.topleft,1]]},jk=function(r){return[[1,1],[1,r.righttop],[r.bottomright,0],[r.bottomleft,0],[0,r.leftbottom],[0,r.lefttop],[r.topright,1]]},Qk=function(r){return[[1,r.righttop],[1,r.rightbottom],[r.bottomleft,0],[0,0],[0,r.leftbottom],[r.topleft,1],[r.topright,1]]},t4=function(r){return[[1,r.righttop],[1,r.rightbottom],[r.bottomright,0],[r.bottomleft,0],[0,r.lefttop],[0,1],[r.topleft,1]]},e4=function(r){return[[1,r.rightbottom],[1,0],[r.bottomright,0],[0,r.leftbottom],[0,r.lefttop],[r.topleft,1],[r.topright,1]]},je=[],Qe=[],tn=[],en=[],nn=[],rn=[],on=[],sn=[];en[1]=nn[1]=18;en[169]=nn[169]=18;tn[4]=Qe[4]=12;tn[166]=Qe[166]=12;je[16]=sn[16]=4;je[154]=sn[154]=4;rn[64]=on[64]=22;rn[106]=on[106]=22;tn[2]=rn[2]=17;en[2]=nn[2]=18;tn[168]=rn[168]=17;en[168]=nn[168]=18;je[8]=en[8]=9;Qe[8]=tn[8]=12;je[162]=en[162]=9;Qe[162]=tn[162]=12;je[32]=sn[32]=4;Qe[32]=on[32]=1;je[138]=sn[138]=4;Qe[138]=on[138]=1;nn[128]=sn[128]=21;rn[128]=on[128]=22;nn[42]=sn[42]=21;rn[42]=on[42]=22;Qe[5]=nn[5]=14;Qe[165]=nn[165]=14;tn[20]=sn[20]=6;tn[150]=sn[150]=6;je[80]=rn[80]=11;je[90]=rn[90]=11;en[65]=on[65]=3;en[105]=on[105]=3;je[160]=rn[160]=11;Qe[160]=nn[160]=14;je[10]=rn[10]=11;Qe[10]=nn[10]=14;tn[130]=sn[130]=6;en[130]=on[130]=3;tn[40]=sn[40]=6;en[40]=on[40]=3;Qe[101]=on[101]=1;Qe[69]=on[69]=1;nn[149]=sn[149]=21;nn[21]=sn[21]=21;tn[86]=rn[86]=17;tn[84]=rn[84]=17;je[89]=en[89]=9;je[81]=en[81]=9;je[96]=on[96]=0;Qe[96]=rn[96]=15;je[74]=on[74]=0;Qe[74]=rn[74]=15;je[24]=tn[24]=8;en[24]=sn[24]=7;je[146]=tn[146]=8;en[146]=sn[146]=7;Qe[6]=rn[6]=15;tn[6]=nn[6]=16;Qe[164]=rn[164]=15;tn[164]=nn[164]=16;en[129]=sn[129]=7;nn[129]=on[129]=20;en[41]=sn[41]=7;nn[41]=on[41]=20;tn[66]=on[66]=2;en[66]=rn[66]=19;tn[104]=on[104]=2;en[104]=rn[104]=19;je[144]=nn[144]=10;rn[144]=sn[144]=23;je[26]=nn[26]=10;rn[26]=sn[26]=23;Qe[36]=sn[36]=5;tn[36]=on[36]=2;Qe[134]=sn[134]=5;tn[134]=on[134]=2;je[9]=nn[9]=10;Qe[9]=en[9]=13;je[161]=nn[161]=10;Qe[161]=en[161]=13;Qe[37]=sn[37]=5;nn[37]=on[37]=20;Qe[133]=sn[133]=5;nn[133]=on[133]=20;tn[148]=nn[148]=16;rn[148]=sn[148]=23;tn[22]=nn[22]=16;rn[22]=sn[22]=23;je[82]=tn[82]=8;en[82]=rn[82]=19;je[88]=tn[88]=8;en[88]=rn[88]=19;je[73]=on[73]=0;Qe[73]=en[73]=13;je[97]=on[97]=0;Qe[97]=en[97]=13;je[145]=en[145]=9;nn[145]=sn[145]=21;je[25]=en[25]=9;nn[25]=sn[25]=21;Qe[70]=on[70]=1;tn[70]=rn[70]=17;Qe[100]=on[100]=1;tn[100]=rn[100]=17;je[34]=en[34]=9;Qe[34]=tn[34]=12;nn[34]=sn[34]=21;rn[34]=on[34]=22;je[136]=sn[136]=4;Qe[136]=on[136]=1;tn[136]=rn[136]=17;en[136]=nn[136]=18;je[35]=sn[35]=4;Qe[35]=tn[35]=12;en[35]=nn[35]=18;rn[35]=on[35]=22;je[153]=sn[153]=4;en[153]=nn[153]=18;Qe[102]=tn[102]=12;rn[102]=on[102]=22;je[155]=en[155]=9;nn[155]=sn[155]=23;Qe[103]=on[103]=1;tn[103]=rn[103]=17;je[152]=sn[152]=4;tn[152]=rn[152]=17;en[152]=nn[152]=18;je[156]=tn[156]=8;en[156]=nn[156]=18;rn[156]=sn[156]=23;je[137]=sn[137]=4;Qe[137]=on[137]=1;en[137]=nn[137]=18;je[139]=sn[139]=4;Qe[139]=en[139]=13;nn[139]=on[139]=20;je[98]=en[98]=9;Qe[98]=tn[98]=12;rn[98]=on[98]=22;je[99]=on[99]=0;Qe[99]=tn[99]=12;en[99]=rn[99]=19;Qe[38]=tn[38]=12;nn[38]=sn[38]=21;rn[38]=on[38]=22;Qe[39]=sn[39]=5;tn[39]=nn[39]=16;rn[39]=on[39]=22;var Gt=[];Gt[1]=Gt[169]=f0;Gt[4]=Gt[166]=h0;Gt[16]=Gt[154]=p0;Gt[64]=Gt[106]=d0;Gt[168]=Gt[2]=m0;Gt[162]=Gt[8]=g0;Gt[138]=Gt[32]=y0;Gt[42]=Gt[128]=v0;Gt[5]=Gt[165]=wk;Gt[20]=Gt[150]=bk;Gt[80]=Gt[90]=Tk;Gt[65]=Gt[105]=Ak;Gt[160]=Gt[10]=Ck;Gt[130]=Gt[40]=Pk;Gt[85]=Ik;Gt[101]=Gt[69]=Rk;Gt[149]=Gt[21]=Lk;Gt[86]=Gt[84]=Nk;Gt[89]=Gt[81]=Ok;Gt[96]=Gt[74]=Dk;Gt[24]=Gt[146]=Fk;Gt[6]=Gt[164]=Uk;Gt[129]=Gt[41]=Bk;Gt[66]=Gt[104]=zk;Gt[144]=Gt[26]=Gk;Gt[36]=Gt[134]=kk;Gt[9]=Gt[161]=qk;Gt[37]=Gt[133]=Vk;Gt[148]=Gt[22]=Hk;Gt[82]=Gt[88]=Wk;Gt[73]=Gt[97]=Xk;Gt[145]=Gt[25]=Yk;Gt[70]=Gt[100]=$k;Gt[34]=function(r){return[v0(r),g0(r)]};Gt[35]=Zk;Gt[136]=function(r){return[y0(r),m0(r)]};Gt[153]=function(r){return[p0(r),f0(r)]};Gt[102]=function(r){return[h0(r),d0(r)]};Gt[155]=Jk;Gt[103]=Kk;Gt[152]=function(r){return[p0(r),m0(r)]};Gt[156]=jk;Gt[137]=function(r){return[y0(r),f0(r)]};Gt[139]=Qk;Gt[98]=function(r){return[g0(r),d0(r)]};Gt[99]=t4;Gt[38]=function(r){return[h0(r),v0(r)]};Gt[39]=e4;function r4(r){return(r>0)-(r<0)||+r}function Hu(r,t,e){var o=t[0]-r[0],a=t[1]-r[1],l=e[0]-t[0],h=e[1]-t[1];return r4(o*h-l*a)}function iT(r,t){var e=r.geometry.coordinates[0].map(function(h){return h[0]}),o=r.geometry.coordinates[0].map(function(h){return h[1]}),a=t.geometry.coordinates[0].map(function(h){return h[0]}),l=t.geometry.coordinates[0].map(function(h){return h[1]});return Math.max.apply(null,e)===Math.max.apply(null,a)&&Math.max.apply(null,o)===Math.max.apply(null,l)&&Math.min.apply(null,e)===Math.min.apply(null,a)&&Math.min.apply(null,o)===Math.min.apply(null,l)}function _0(r,t){return t.geometry.coordinates[0].every(function(e){return Ir(Nn(e),r)})}function oT(r,t){return r[0]===t[0]&&r[1]===t[1]}var i4=function(){function r(t){this.id=r.buildId(t),this.coordinates=t,this.innerEdges=[],this.outerEdges=[],this.outerEdgesSorted=!1}return r.buildId=function(t){return t.join(",")},r.prototype.removeInnerEdge=function(t){this.innerEdges=this.innerEdges.filter(function(e){return e.from.id!==t.from.id})},r.prototype.removeOuterEdge=function(t){this.outerEdges=this.outerEdges.filter(function(e){return e.to.id!==t.to.id})},r.prototype.addOuterEdge=function(t){this.outerEdges.push(t),this.outerEdgesSorted=!1},r.prototype.sortOuterEdges=function(){var t=this;this.outerEdgesSorted||(this.outerEdges.sort(function(e,o){var a=e.to,l=o.to;if(a.coordinates[0]-t.coordinates[0]>=0&&l.coordinates[0]-t.coordinates[0]<0)return 1;if(a.coordinates[0]-t.coordinates[0]<0&&l.coordinates[0]-t.coordinates[0]>=0)return-1;if(a.coordinates[0]-t.coordinates[0]===0&&l.coordinates[0]-t.coordinates[0]===0)return a.coordinates[1]-t.coordinates[1]>=0||l.coordinates[1]-t.coordinates[1]>=0?a.coordinates[1]-l.coordinates[1]:l.coordinates[1]-a.coordinates[1];var h=Hu(t.coordinates,a.coordinates,l.coordinates);if(h<0)return 1;if(h>0)return-1;var f=Math.pow(a.coordinates[0]-t.coordinates[0],2)+Math.pow(a.coordinates[1]-t.coordinates[1],2),p=Math.pow(l.coordinates[0]-t.coordinates[0],2)+Math.pow(l.coordinates[1]-t.coordinates[1],2);return f-p}),this.outerEdgesSorted=!0)},r.prototype.getOuterEdges=function(){return this.sortOuterEdges(),this.outerEdges},r.prototype.getOuterEdge=function(t){return this.sortOuterEdges(),this.outerEdges[t]},r.prototype.addInnerEdge=function(t){this.innerEdges.push(t)},r}(),x0=i4;var o4=function(){function r(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 r.prototype.getSymetric=function(){return this.symetric||(this.symetric=new r(this.to,this.from),this.symetric.symetric=this),this.symetric},r.prototype.deleteEdge=function(){this.from.removeOuterEdge(this),this.to.removeInnerEdge(this)},r.prototype.isEqual=function(t){return this.from.id===t.from.id&&this.to.id===t.to.id},r.prototype.toString=function(){return"Edge { "+this.from.id+" -> "+this.to.id+" }"},r.prototype.toLineString=function(){return Pr([this.from.coordinates,this.to.coordinates])},r.prototype.compareTo=function(t){return Hu(t.from.coordinates,t.to.coordinates,this.to.coordinates)},r}(),sT=o4;var s4=function(){function r(){this.edges=[],this.polygon=void 0,this.envelope=void 0}return r.prototype.push=function(t){this.edges.push(t),this.polygon=this.envelope=void 0},r.prototype.get=function(t){return this.edges[t]},Object.defineProperty(r.prototype,"length",{get:function(){return this.edges.length},enumerable:!0,configurable:!0}),r.prototype.forEach=function(t){this.edges.forEach(t)},r.prototype.map=function(t){return this.edges.map(t)},r.prototype.some=function(t){return this.edges.some(t)},r.prototype.isValid=function(){return!0},r.prototype.isHole=function(){var t=this,e=this.edges.reduce(function(h,f,p){return f.from.coordinates[1]>t.edges[h].from.coordinates[1]&&(h=p),h},0),o=(e===0?this.length:e)-1,a=(e+1)%this.length,l=Hu(this.edges[o].from.coordinates,this.edges[e].from.coordinates,this.edges[a].from.coordinates);return l===0?this.edges[o].from.coordinates[0]>this.edges[a].from.coordinates[0]:l>0},r.prototype.toMultiPoint=function(){return Km(this.edges.map(function(t){return t.from.coordinates}))},r.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=Hn([t])},r.prototype.getEnvelope=function(){return this.envelope?this.envelope:this.envelope=gg(this.toPolygon())},r.findEdgeRingContaining=function(t,e){var o=t.getEnvelope(),a,l;return e.forEach(function(h){var f=h.getEnvelope();if(l&&(a=l.getEnvelope()),!iT(f,o)&&_0(f,o)){for(var p=t.map(function(b){return b.from.coordinates}),d=void 0,g=function(b){h.some(function(T){return oT(b,T.from.coordinates)})||(d=b)},x=0,v=p;x<v.length;x++){var M=v[x];g(M)}d&&h.inside(Nn(d))&&(!l||_0(a,f))&&(l=h)}}),l},r.prototype.inside=function(t){return Ir(t,this.toPolygon())},r}(),E0=s4;function a4(r){if(!r)throw new Error("No geojson passed");if(r.type!=="FeatureCollection"&&r.type!=="GeometryCollection"&&r.type!=="MultiLineString"&&r.type!=="LineString"&&r.type!=="Feature")throw new Error("Invalid input type '"+r.type+"'. Geojson must be FeatureCollection, GeometryCollection, LineString, MultiLineString or Feature")}var UZ=function(){function r(){this.edges=[],this.nodes={}}return r.fromGeoJson=function(t){a4(t);var e=new r;return Oi(t,function(o){Qm(o,"LineString","Graph::fromGeoJson"),yM(o,function(a,l){if(a){var h=e.getNode(a),f=e.getNode(l);e.addEdge(h,f)}return l})}),e},r.prototype.getNode=function(t){var e=x0.buildId(t),o=this.nodes[e];return o||(o=this.nodes[e]=new x0(t)),o},r.prototype.addEdge=function(t,e){var o=new sT(t,e),a=o.getSymetric();this.edges.push(o),this.edges.push(a)},r.prototype.deleteDangles=function(){var t=this;Object.keys(this.nodes).map(function(e){return t.nodes[e]}).forEach(function(e){return t._removeIfDangle(e)})},r.prototype._removeIfDangle=function(t){var e=this;if(t.innerEdges.length<=1){var o=t.getOuterEdges().map(function(a){return a.to});this.removeNode(t),o.forEach(function(a){return e._removeIfDangle(a)})}},r.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))})},r.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,a){t.getOuterEdge((a===0?t.getOuterEdges().length:a)-1).symetric.next=o})},r.prototype._computeNextCCWEdges=function(t,e){for(var o=t.getOuterEdges(),a,l,h=o.length-1;h>=0;--h){var f=o[h],p=f.symetric,d=void 0,g=void 0;f.label===e&&(d=f),p.label===e&&(g=p),!(!d||!g)&&(g&&(l=g),d&&(l&&(l.next=d,l=void 0),a||(a=d)))}l&&(l.next=a)},r.prototype._findLabeledEdgeRings=function(){var t=[],e=0;return this.edges.forEach(function(o){if(!(o.label>=0)){t.push(o);var a=o;do a.label=e,a=a.next;while(!o.isEqual(a));e++}}),t},r.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(a){t._computeNextCCWEdges(a,o.label)})});var e=[];return this.edges.forEach(function(o){o.ring||e.push(t._findEdgeRing(o))}),e},r.prototype._findIntersectionNodes=function(t){var e=[],o=t,a=function(){var l=0;o.from.getOuterEdges().forEach(function(h){h.label===t.label&&++l}),l>1&&e.push(o.from),o=o.next};do a();while(!t.isEqual(o));return e},r.prototype._findEdgeRing=function(t){var e=t,o=new E0;do o.push(e),e.ring=o,e=e.next;while(!t.isEqual(e));return o},r.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]},r.prototype.removeEdge=function(t){this.edges=this.edges.filter(function(e){return!e.isEqual(t)}),t.deleteEdge()},r}();var f4=gn(M0(),1);var h4=gn(M0(),1);var d4=gn(mT(),1);var E4=gn(bT(),1);function AT(r){for(var t=r,e=[];t.parent;)e.unshift(t),t=t.parent;return e}function S4(){return new CT(function(r){return r.f})}var T0={search:function(r,t,e,o){r.cleanDirty(),o=o||{};var a=o.heuristic||T0.heuristics.manhattan,l=o.closest||!1,h=S4(),f=t;for(t.h=a(t,e),h.push(t);h.size()>0;){var p=h.pop();if(p===e)return AT(p);p.closed=!0;for(var d=r.neighbors(p),g=0,x=d.length;g<x;++g){var v=d[g];if(!(v.closed||v.isWall())){var M=p.g+v.getCost(p),b=v.visited;(!b||M<v.g)&&(v.visited=!0,v.parent=p,v.h=v.h||a(v,e),v.g=M,v.f=v.g+v.h,r.markDirty(v),l&&(v.h<f.h||v.h===f.h&&v.g<f.g)&&(f=v),b?h.rescoreElement(v):h.push(v))}}}return l?AT(f):[]},heuristics:{manhattan:function(r,t){var e=Math.abs(t.x-r.x),o=Math.abs(t.y-r.y);return e+o},diagonal:function(r,t){var e=1,o=Math.sqrt(2),a=Math.abs(t.x-r.x),l=Math.abs(t.y-r.y);return e*(a+l)+(o-2*e)*Math.min(a,l)}},cleanNode:function(r){r.f=0,r.g=0,r.h=0,r.visited=!1,r.closed=!1,r.parent=null}};function nc(r,t){t=t||{},this.nodes=[],this.diagonal=!!t.diagonal,this.grid=[];for(var e=0;e<r.length;e++){this.grid[e]=[];for(var o=0,a=r[e];o<a.length;o++){var l=new Gh(e,o,a[o]);this.grid[e][o]=l,this.nodes.push(l)}}this.init()}nc.prototype.init=function(){this.dirtyNodes=[];for(var r=0;r<this.nodes.length;r++)T0.cleanNode(this.nodes[r])};nc.prototype.cleanDirty=function(){for(var r=0;r<this.dirtyNodes.length;r++)T0.cleanNode(this.dirtyNodes[r]);this.dirtyNodes=[]};nc.prototype.markDirty=function(r){this.dirtyNodes.push(r)};nc.prototype.neighbors=function(r){var t=[],e=r.x,o=r.y,a=this.grid;return a[e-1]&&a[e-1][o]&&t.push(a[e-1][o]),a[e+1]&&a[e+1][o]&&t.push(a[e+1][o]),a[e]&&a[e][o-1]&&t.push(a[e][o-1]),a[e]&&a[e][o+1]&&t.push(a[e][o+1]),this.diagonal&&(a[e-1]&&a[e-1][o-1]&&t.push(a[e-1][o-1]),a[e+1]&&a[e+1][o-1]&&t.push(a[e+1][o-1]),a[e-1]&&a[e-1][o+1]&&t.push(a[e-1][o+1]),a[e+1]&&a[e+1][o+1]&&t.push(a[e+1][o+1])),t};nc.prototype.toString=function(){for(var r=[],t=this.grid,e,o,a,l,h=0,f=t.length;h<f;h++){for(e=[],o=t[h],a=0,l=o.length;a<l;a++)e.push(o[a].weight);r.push(e.join(" "))}return r.join(`
|
|
3806
|
+
`)};function Gh(r,t,e){this.x=r,this.y=t,this.weight=e}Gh.prototype.toString=function(){return"["+this.x+" "+this.y+"]"};Gh.prototype.getCost=function(r){return r&&r.x!==this.x&&r.y!==this.y?this.weight*1.41421:this.weight};Gh.prototype.isWall=function(){return this.weight===0};function CT(r){this.content=[],this.scoreFunction=r}CT.prototype={push:function(r){this.content.push(r),this.sinkDown(this.content.length-1)},pop:function(){var r=this.content[0],t=this.content.pop();return this.content.length>0&&(this.content[0]=t,this.bubbleUp(0)),r},remove:function(r){var t=this.content.indexOf(r),e=this.content.pop();t!==this.content.length-1&&(this.content[t]=e,this.scoreFunction(e)<this.scoreFunction(r)?this.sinkDown(t):this.bubbleUp(t))},size:function(){return this.content.length},rescoreElement:function(r){this.sinkDown(this.content.indexOf(r))},sinkDown:function(r){for(var t=this.content[r];r>0;){var e=(r+1>>1)-1,o=this.content[e];if(this.scoreFunction(t)<this.scoreFunction(o))this.content[e]=t,this.content[r]=o,r=e;else break}},bubbleUp:function(r){for(var t=this.content.length,e=this.content[r],o=this.scoreFunction(e);;){var a=r+1<<1,l=a-1,h=null,f;if(l<t){var p=this.content[l];f=this.scoreFunction(p),f<o&&(h=l)}if(a<t){var d=this.content[a],g=this.scoreFunction(d);g<(h===null?o:f)&&(h=a)}if(h!==null)this.content[r]=this.content[h],this.content[h]=e,r=h;else break}}};function A0(){this._=null}function Xu(r){r.U=r.C=r.L=r.R=r.P=r.N=null}A0.prototype={constructor:A0,insert:function(r,t){var e,o,a;if(r){if(t.P=r,t.N=r.N,r.N&&(r.N.P=t),r.N=t,r.R){for(r=r.R;r.L;)r=r.L;r.L=t}else r.R=t;e=r}else this._?(r=PT(this._),t.P=null,t.N=r,r.P=r.L=t,e=r):(t.P=t.N=null,this._=t,e=null);for(t.L=t.R=null,t.U=e,t.C=!0,r=t;e&&e.C;)o=e.U,e===o.L?(a=o.R,a&&a.C?(e.C=a.C=!1,o.C=!0,r=o):(r===e.R&&(rc(this,e),r=e,e=r.U),e.C=!1,o.C=!0,ic(this,o))):(a=o.L,a&&a.C?(e.C=a.C=!1,o.C=!0,r=o):(r===e.L&&(ic(this,e),r=e,e=r.U),e.C=!1,o.C=!0,rc(this,o))),e=r.U;this._.C=!1},remove:function(r){r.N&&(r.N.P=r.P),r.P&&(r.P.N=r.N),r.N=r.P=null;var t=r.U,e,o=r.L,a=r.R,l,h;if(o?a?l=PT(a):l=o:l=a,t?t.L===r?t.L=l:t.R=l:this._=l,o&&a?(h=l.C,l.C=r.C,l.L=o,o.U=l,l!==a?(t=l.U,l.U=r.U,r=l.R,t.L=r,l.R=a,a.U=l):(l.U=t,t=l,r=l.R)):(h=r.C,r=l),r&&(r.U=t),!h){if(r&&r.C){r.C=!1;return}do{if(r===this._)break;if(r===t.L){if(e=t.R,e.C&&(e.C=!1,t.C=!0,rc(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,ic(this,e),e=t.R),e.C=t.C,t.C=e.R.C=!1,rc(this,t),r=this._;break}}else if(e=t.L,e.C&&(e.C=!1,t.C=!0,ic(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,rc(this,e),e=t.L),e.C=t.C,t.C=e.L.C=!1,ic(this,t),r=this._;break}e.C=!0,r=t,t=t.U}while(!r.C);r&&(r.C=!1)}}};function rc(r,t){var e=t,o=t.R,a=e.U;a?a.L===e?a.L=o:a.R=o:r._=o,o.U=a,e.U=o,e.R=o.L,e.R&&(e.R.U=e),o.L=e}function ic(r,t){var e=t,o=t.L,a=e.U;a?a.L===e?a.L=o:a.R=o:r._=o,o.U=a,e.U=o,e.L=o.R,e.L&&(e.L.U=e),o.R=e}function PT(r){for(;r.L;)r=r.L;return r}var C0=A0;function Yu(r,t,e,o){var a=[null,null],l=Lr.push(a)-1;return a.left=r,a.right=t,e&&oc(a,r,t,e),o&&oc(a,t,r,o),mi[r.index].halfedges.push(l),mi[t.index].halfedges.push(l),a}function $u(r,t,e){var o=[t,e];return o.left=r,o}function oc(r,t,e,o){!r[0]&&!r[1]?(r[0]=o,r.left=t,r.right=e):r.left===e?r[1]=o:r[0]=o}function w4(r,t,e,o,a){var l=r[0],h=r[1],f=l[0],p=l[1],d=h[0],g=h[1],x=0,v=1,M=d-f,b=g-p,T;if(T=t-f,!(!M&&T>0)){if(T/=M,M<0){if(T<x)return;T<v&&(v=T)}else if(M>0){if(T>v)return;T>x&&(x=T)}if(T=o-f,!(!M&&T<0)){if(T/=M,M<0){if(T>v)return;T>x&&(x=T)}else if(M>0){if(T<x)return;T<v&&(v=T)}if(T=e-p,!(!b&&T>0)){if(T/=b,b<0){if(T<x)return;T<v&&(v=T)}else if(b>0){if(T>v)return;T>x&&(x=T)}if(T=a-p,!(!b&&T<0)){if(T/=b,b<0){if(T>v)return;T>x&&(x=T)}else if(b>0){if(T<x)return;T<v&&(v=T)}return!(x>0)&&!(v<1)||(x>0&&(r[0]=[f+x*M,p+x*b]),v<1&&(r[1]=[f+v*M,p+v*b])),!0}}}}}function b4(r,t,e,o,a){var l=r[1];if(l)return!0;var h=r[0],f=r.left,p=r.right,d=f[0],g=f[1],x=p[0],v=p[1],M=(d+x)/2,b=(g+v)/2,T,_;if(v===g){if(M<t||M>=o)return;if(d>x){if(!h)h=[M,e];else if(h[1]>=a)return;l=[M,a]}else{if(!h)h=[M,a];else if(h[1]<e)return;l=[M,e]}}else if(T=(d-x)/(v-g),_=b-T*M,T<-1||T>1)if(d>x){if(!h)h=[(e-_)/T,e];else if(h[1]>=a)return;l=[(a-_)/T,a]}else{if(!h)h=[(a-_)/T,a];else if(h[1]<e)return;l=[(e-_)/T,e]}else if(g<v){if(!h)h=[t,T*t+_];else if(h[0]>=o)return;l=[o,T*o+_]}else{if(!h)h=[o,T*o+_];else if(h[0]<t)return;l=[t,T*t+_]}return r[0]=h,r[1]=l,!0}function IT(r,t,e,o){for(var a=Lr.length,l;a--;)(!b4(l=Lr[a],r,t,e,o)||!w4(l,r,t,e,o)||!(Math.abs(l[0][0]-l[1][0])>Pn||Math.abs(l[0][1]-l[1][1])>Pn))&&delete Lr[a]}function RT(r){return mi[r.index]={site:r,halfedges:[]}}function T4(r,t){var e=r.site,o=t.left,a=t.right;return e===a&&(a=o,o=e),a?Math.atan2(a[1]-o[1],a[0]-o[0]):(e===o?(o=t[1],a=t[0]):(o=t[0],a=t[1]),Math.atan2(o[0]-a[0],a[1]-o[1]))}function P0(r,t){return t[+(t.left!==r.site)]}function A4(r,t){return t[+(t.left===r.site)]}function LT(){for(var r=0,t=mi.length,e,o,a,l;r<t;++r)if((e=mi[r])&&(l=(o=e.halfedges).length)){var h=new Array(l),f=new Array(l);for(a=0;a<l;++a)h[a]=a,f[a]=T4(e,Lr[o[a]]);for(h.sort(function(p,d){return f[d]-f[p]}),a=0;a<l;++a)f[a]=o[h[a]];for(a=0;a<l;++a)o[a]=f[a]}}function NT(r,t,e,o){var a=mi.length,l,h,f,p,d,g,x,v,M,b,T,_,y=!0;for(l=0;l<a;++l)if(h=mi[l]){for(f=h.site,d=h.halfedges,p=d.length;p--;)Lr[d[p]]||d.splice(p,1);for(p=0,g=d.length;p<g;)b=A4(h,Lr[d[p]]),T=b[0],_=b[1],x=P0(h,Lr[d[++p%g]]),v=x[0],M=x[1],(Math.abs(T-v)>Pn||Math.abs(_-M)>Pn)&&(d.splice(p,0,Lr.push($u(f,b,Math.abs(T-r)<Pn&&o-_>Pn?[r,Math.abs(v-r)<Pn?M:o]:Math.abs(_-o)<Pn&&e-T>Pn?[Math.abs(M-o)<Pn?v:e,o]:Math.abs(T-e)<Pn&&_-t>Pn?[e,Math.abs(v-e)<Pn?M:t]:Math.abs(_-t)<Pn&&T-r>Pn?[Math.abs(M-t)<Pn?v:r,t]:null))-1),++g);g&&(y=!1)}if(y){var A,S,L,G=1/0;for(l=0,y=null;l<a;++l)(h=mi[l])&&(f=h.site,A=f[0]-r,S=f[1]-t,L=A*A+S*S,L<G&&(G=L,y=h));if(y){var z=[r,t],F=[r,o],I=[e,o],ut=[e,t];y.halfedges.push(Lr.push($u(f=y.site,z,F))-1,Lr.push($u(f,F,I))-1,Lr.push($u(f,I,ut))-1,Lr.push($u(f,ut,z))-1)}}for(l=0;l<a;++l)(h=mi[l])&&(h.halfedges.length||delete mi[l])}var OT=[],kh;function C4(){Xu(this),this.x=this.y=this.arc=this.site=this.cy=null}function Ca(r){var t=r.P,e=r.N;if(!(!t||!e)){var o=t.site,a=r.site,l=e.site;if(o!==l){var h=a[0],f=a[1],p=o[0]-h,d=o[1]-f,g=l[0]-h,x=l[1]-f,v=2*(p*x-d*g);if(!(v>=-DT)){var M=p*p+d*d,b=g*g+x*x,T=(x*M-d*b)/v,_=(p*b-g*M)/v,y=OT.pop()||new C4;y.arc=r,y.site=a,y.x=T+h,y.y=(y.cy=_+f)+Math.sqrt(T*T+_*_),r.circle=y;for(var A=null,S=Zu._;S;)if(y.y<S.y||y.y===S.y&&y.x<=S.x)if(S.L)S=S.L;else{A=S.P;break}else if(S.R)S=S.R;else{A=S;break}Zu.insert(A,y),A||(kh=y)}}}}function Pa(r){var t=r.circle;t&&(t.P||(kh=t.N),Zu.remove(t),OT.push(t),Xu(t),r.circle=null)}var UT=[];function P4(){Xu(this),this.edge=this.site=this.circle=null}function FT(r){var t=UT.pop()||new P4;return t.site=r,t}function I0(r){Pa(r),Ia.remove(r),UT.push(r),Xu(r)}function BT(r){var t=r.circle,e=t.x,o=t.cy,a=[e,o],l=r.P,h=r.N,f=[r];I0(r);for(var p=l;p.circle&&Math.abs(e-p.circle.x)<Pn&&Math.abs(o-p.circle.cy)<Pn;)l=p.P,f.unshift(p),I0(p),p=l;f.unshift(p),Pa(p);for(var d=h;d.circle&&Math.abs(e-d.circle.x)<Pn&&Math.abs(o-d.circle.cy)<Pn;)h=d.N,f.push(d),I0(d),d=h;f.push(d),Pa(d);var g=f.length,x;for(x=1;x<g;++x)d=f[x],p=f[x-1],oc(d.edge,p.site,d.site,a);p=f[0],d=f[g-1],d.edge=Yu(p.site,d.site,null,a),Ca(p),Ca(d)}function zT(r){for(var t=r[0],e=r[1],o,a,l,h,f=Ia._;f;)if(l=GT(f,e)-t,l>Pn)f=f.L;else if(h=t-I4(f,e),h>Pn){if(!f.R){o=f;break}f=f.R}else{l>-Pn?(o=f.P,a=f):h>-Pn?(o=f,a=f.N):o=a=f;break}RT(r);var p=FT(r);if(Ia.insert(o,p),!(!o&&!a)){if(o===a){Pa(o),a=FT(o.site),Ia.insert(p,a),p.edge=a.edge=Yu(o.site,p.site),Ca(o),Ca(a);return}if(!a){p.edge=Yu(o.site,p.site);return}Pa(o),Pa(a);var d=o.site,g=d[0],x=d[1],v=r[0]-g,M=r[1]-x,b=a.site,T=b[0]-g,_=b[1]-x,y=2*(v*_-M*T),A=v*v+M*M,S=T*T+_*_,L=[(_*A-M*S)/y+g,(v*S-T*A)/y+x];oc(a.edge,d,b,L),p.edge=Yu(d,r,null,L),a.edge=Yu(r,b,null,L),Ca(o),Ca(a)}}function GT(r,t){var e=r.site,o=e[0],a=e[1],l=a-t;if(!l)return o;var h=r.P;if(!h)return-1/0;e=h.site;var f=e[0],p=e[1],d=p-t;if(!d)return f;var g=f-o,x=1/l-1/d,v=g/d;return x?(-v+Math.sqrt(v*v-2*x*(g*g/(-2*d)-p+d/2+a-l/2)))/x+o:(o+f)/2}function I4(r,t){var e=r.N;if(e)return GT(e,t);var o=r.site;return o[1]===t?o[0]:1/0}var Pn=1e-6,DT=1e-12,Ia,mi,Zu,Lr;function R4(r,t,e){return(r[0]-e[0])*(t[1]-r[1])-(r[0]-t[0])*(e[1]-r[1])}function L4(r,t){return t[1]-r[1]||t[0]-r[0]}function qh(r,t){var e=r.sort(L4).pop(),o,a,l;for(Lr=[],mi=new Array(r.length),Ia=new C0,Zu=new C0;;)if(l=kh,e&&(!l||e[1]<l.y||e[1]===l.y&&e[0]<l.x))(e[0]!==o||e[1]!==a)&&(zT(e),o=e[0],a=e[1]),e=r.pop();else if(l)BT(l.arc);else break;if(LT(),t){var h=+t[0][0],f=+t[0][1],p=+t[1][0],d=+t[1][1];IT(h,f,p,d),NT(h,f,p,d)}this.edges=Lr,this.cells=mi,Ia=Zu=Lr=mi=null}qh.prototype={constructor:qh,polygons:function(){var r=this.edges;return this.cells.map(function(t){var e=t.halfedges.map(function(o){return P0(t,r[o])});return e.data=t.site.data,e})},triangles:function(){var r=[],t=this.edges;return this.cells.forEach(function(e,o){if(f=(l=e.halfedges).length)for(var a=e.site,l,h=-1,f,p,d=t[l[f-1]],g=d.left===a?d.right:d.left;++h<f;)p=g,d=t[l[h]],g=d.left===a?d.right:d.left,p&&g&&o<p.index&&o<g.index&&R4(a,p,g)<0&&r.push([a.data,p.data,g.data])}),r},links:function(){return this.edges.filter(function(r){return r.right}).map(function(r){return{source:r.left.data,target:r.right.data}})},find:function(r,t,e){for(var o=this,a,l=o._found||0,h=o.cells.length,f;!(f=o.cells[l]);)if(++l>=h)return null;var p=r-f.site[0],d=t-f.site[1],g=p*p+d*d;do f=o.cells[a=l],l=null,f.halfedges.forEach(function(x){var v=o.edges[x],M=v.left;if(!((M===f.site||!M)&&!(M=v.right))){var b=r-M[0],T=t-M[1],_=b*b+T*T;_<g&&(g=_,l=M.index)}});while(l!==null);return o._found=a,e==null||g<=e*e?f.site:null}};var G4=gn(Ju(),1);var W0=gn(HT(),1);function Mi(){return new Wh}function Wh(){this.reset()}Wh.prototype={constructor:Wh,reset:function(){this.s=this.t=0},add:function(r){WT(Hh,r,this.t),WT(this,Hh.s,this.s),this.s?this.t+=Hh.t:this.s=Hh.t},valueOf:function(){return this.s}};var Hh=new Wh;function WT(r,t,e){var o=r.s=t+e,a=o-t,l=o-a;r.t=t-l+(e-a)}var mn=1e-6;var bn=Math.PI,gr=bn/2,Xh=bn/4,Do=bn*2,Ra=180/bn,Si=bn/180,Zn=Math.abs,yo=Math.atan,wi=Math.atan2,cn=Math.cos;var Yh=Math.exp;var sc=Math.log;var Me=Math.sin;var Vr=Math.sqrt,ac=Math.tan;function N0(r){return r>1?0:r<-1?bn:Math.acos(r)}function gi(r){return r>1?gr:r<-1?-gr:Math.asin(r)}function vo(){}var k4=Mi(),Rj=Mi();function La(r){var t=r[0],e=r[1],o=cn(e);return[o*cn(t),o*Me(t),Me(e)]}function uc(r,t){return[r[1]*t[2]-r[2]*t[1],r[2]*t[0]-r[0]*t[2],r[0]*t[1]-r[1]*t[0]]}function lc(r){var t=Vr(r[0]*r[0]+r[1]*r[1]+r[2]*r[2]);r[0]/=t,r[1]/=t,r[2]/=t}var kj=Mi();function YT(r,t){return[r>bn?r-Do:r<-bn?r+Do:r,t]}YT.invert=YT;function O0(){var r=[],t;return{point:function(e,o){t.push([e,o])},lineStart:function(){r.push(t=[])},lineEnd:vo,rejoin:function(){r.length>1&&r.push(r.pop().concat(r.shift()))},result:function(){var e=r;return r=[],t=null,e}}}function D0(r,t){return Zn(r[0]-t[0])<mn&&Zn(r[1]-t[1])<mn}function $h(r,t,e,o){this.x=r,this.z=t,this.o=e,this.e=o,this.v=!1,this.n=this.p=null}function F0(r,t,e,o,a){var l=[],h=[],f,p;if(r.forEach(function(b){if(!((T=b.length-1)<=0)){var T,_=b[0],y=b[T],A;if(D0(_,y)){for(a.lineStart(),f=0;f<T;++f)a.point((_=b[f])[0],_[1]);a.lineEnd();return}l.push(A=new $h(_,b,null,!0)),h.push(A.o=new $h(_,null,A,!1)),l.push(A=new $h(y,b,null,!1)),h.push(A.o=new $h(y,null,A,!0))}}),!!l.length){for(h.sort(t),$T(l),$T(h),f=0,p=h.length;f<p;++f)h[f].e=e=!e;for(var d=l[0],g,x;;){for(var v=d,M=!0;v.v;)if((v=v.n)===d)return;g=v.z,a.lineStart();do{if(v.v=v.o.v=!0,v.e){if(M)for(f=0,p=g.length;f<p;++f)a.point((x=g[f])[0],x[1]);else o(v.x,v.n.x,1,a);v=v.n}else{if(M)for(g=v.p.z,f=g.length-1;f>=0;--f)a.point((x=g[f])[0],x[1]);else o(v.x,v.p.x,-1,a);v=v.p}v=v.o,g=v.z,M=!M}while(!v.v);a.lineEnd()}}}function $T(r){if(t=r.length){for(var t,e=0,o=r[0],a;++e<t;)o.n=a=r[e],a.p=o,o=a;o.n=a=r[0],a.p=o}}function Hs(r,t){return r<t?-1:r>t?1:r>=t?0:NaN}function U0(r){return r.length===1&&(r=H4(r)),{left:function(t,e,o,a){for(o==null&&(o=0),a==null&&(a=t.length);o<a;){var l=o+a>>>1;r(t[l],e)<0?o=l+1:a=l}return o},right:function(t,e,o,a){for(o==null&&(o=0),a==null&&(a=t.length);o<a;){var l=o+a>>>1;r(t[l],e)>0?a=l:o=l+1}return o}}}function H4(r){return function(t,e){return Hs(r(t),e)}}var ZT=U0(Hs),W4=ZT.right,X4=ZT.left;var JT=Array.prototype,$4=JT.slice,Z4=JT.map;var NQ=Math.sqrt(50),OQ=Math.sqrt(10),DQ=Math.sqrt(2);function Jh(r){for(var t=r.length,e,o=-1,a=0,l,h;++o<t;)a+=r[o].length;for(l=new Array(a);--t>=0;)for(h=r[t],e=h.length;--e>=0;)l[--a]=h[e];return l}var r5=1e9,_et=-r5;var B0=Mi();function z0(r,t){var e=t[0],o=t[1],a=[Me(e),-cn(e),0],l=0,h=0;B0.reset();for(var f=0,p=r.length;f<p;++f)if(g=(d=r[f]).length)for(var d,g,x=d[g-1],v=x[0],M=x[1]/2+Xh,b=Me(M),T=cn(M),_=0;_<g;++_,v=A,b=L,T=G,x=y){var y=d[_],A=y[0],S=y[1]/2+Xh,L=Me(S),G=cn(S),z=A-v,F=z>=0?1:-1,I=F*z,ut=I>bn,R=b*L;if(B0.add(wi(R*F*Me(I),T*G+R*cn(I))),l+=ut?z+F*Do:z,ut^v>=e^A>=e){var W=uc(La(x),La(y));lc(W);var V=uc(a,W);lc(V);var Mt=(ut^z>=0?-1:1)*gi(V[2]);(o>Mt||o===Mt&&(W[0]||W[1]))&&(h+=ut^z>=0?1:-1)}}return(l<-mn||l<mn&&B0<-mn)^h&1}var Iet=Mi();var Zet=Mi(),Jet=Mi();var s5=1/0;var Qet=-s5;function G0(r){this._context=r}G0.prototype={_radius:4.5,pointRadius:function(r){return this._radius=r,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(r,t){switch(this._point){case 0:{this._context.moveTo(r,t),this._point=1;break}case 1:{this._context.lineTo(r,t);break}default:{this._context.moveTo(r+this._radius,t),this._context.arc(r,t,this._radius,0,Do);break}}},result:vo};var lnt=Mi();function k0(){this._string=[]}k0.prototype={_radius:4.5,_circle:QT(4.5),pointRadius:function(r){return(r=+r)!==this._radius&&(this._radius=r,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(r,t){switch(this._point){case 0:{this._string.push("M",r,",",t),this._point=1;break}case 1:{this._string.push("L",r,",",t);break}default:{this._circle==null&&(this._circle=QT(this._radius)),this._string.push("M",r,",",t,this._circle);break}}},result:function(){if(this._string.length){var r=this._string.join("");return this._string=[],r}else return null}};function QT(r){return"m0,"+r+"a"+r+","+r+" 0 1,1 0,"+-2*r+"a"+r+","+r+" 0 1,1 0,"+2*r+"z"}function q0(r,t,e,o){return function(a,l){var h=t(l),f=a.invert(o[0],o[1]),p=O0(),d=t(p),g=!1,x,v,M,b={point:T,lineStart:y,lineEnd:A,polygonStart:function(){b.point=S,b.lineStart=L,b.lineEnd=G,v=[],x=[]},polygonEnd:function(){b.point=T,b.lineStart=y,b.lineEnd=A,v=Jh(v);var z=z0(x,f);v.length?(g||(l.polygonStart(),g=!0),F0(v,l5,z,e,l)):z&&(g||(l.polygonStart(),g=!0),l.lineStart(),e(null,null,1,l),l.lineEnd()),g&&(l.polygonEnd(),g=!1),v=x=null},sphere:function(){l.polygonStart(),l.lineStart(),e(null,null,1,l),l.lineEnd(),l.polygonEnd()}};function T(z,F){var I=a(z,F);r(z=I[0],F=I[1])&&l.point(z,F)}function _(z,F){var I=a(z,F);h.point(I[0],I[1])}function y(){b.point=_,h.lineStart()}function A(){b.point=T,h.lineEnd()}function S(z,F){M.push([z,F]);var I=a(z,F);d.point(I[0],I[1])}function L(){d.lineStart(),M=[]}function G(){S(M[0][0],M[0][1]),d.lineEnd();var z=d.clean(),F=p.result(),I,ut=F.length,R,W,V;if(M.pop(),x.push(M),M=null,!!ut){if(z&1){if(W=F[0],(R=W.length-1)>0){for(g||(l.polygonStart(),g=!0),l.lineStart(),I=0;I<R;++I)l.point((V=W[I])[0],V[1]);l.lineEnd()}return}ut>1&&z&2&&F.push(F.pop().concat(F.shift())),v.push(F.filter(u5))}}return b}}function u5(r){return r.length>1}function l5(r,t){return((r=r.x)[0]<0?r[1]-gr-mn:gr-r[1])-((t=t.x)[0]<0?t[1]-gr-mn:gr-t[1])}var c5=q0(function(){return!0},f5,p5,[-bn,-gr]);function f5(r){var t=NaN,e=NaN,o=NaN,a;return{lineStart:function(){r.lineStart(),a=1},point:function(l,h){var f=l>0?bn:-bn,p=Zn(l-t);Zn(p-bn)<mn?(r.point(t,e=(e+h)/2>0?gr:-gr),r.point(o,e),r.lineEnd(),r.lineStart(),r.point(f,e),r.point(l,e),a=0):o!==f&&p>=bn&&(Zn(t-o)<mn&&(t-=o*mn),Zn(l-f)<mn&&(l-=f*mn),e=h5(t,e,l,h),r.point(o,e),r.lineEnd(),r.lineStart(),r.point(f,e),a=0),r.point(t=l,e=h),o=f},lineEnd:function(){r.lineEnd(),t=e=NaN},clean:function(){return 2-a}}}function h5(r,t,e,o){var a,l,h=Me(r-e);return Zn(h)>mn?yo((Me(t)*(l=cn(o))*Me(e)-Me(o)*(a=cn(t))*Me(r))/(a*l*h)):(t+o)/2}function p5(r,t,e,o){var a;if(r==null)a=e*gr,o.point(-bn,a),o.point(0,a),o.point(bn,a),o.point(bn,0),o.point(bn,-a),o.point(0,-a),o.point(-bn,-a),o.point(-bn,0),o.point(-bn,a);else if(Zn(r[0]-t[0])>mn){var l=r[0]<t[0]?bn:-bn;a=e*l/2,o.point(-l,a),o.point(0,a),o.point(l,a)}else o.point(t[0],t[1])}function Kh(r){return function(t){var e=new V0;for(var o in r)e[o]=r[o];return e.stream=t,e}}function V0(){}V0.prototype={constructor:V0,point:function(r,t){this.stream.point(r,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 Jnt=cn(30*Si);var crt=Kh({point:function(r,t){this.stream.point(r*Si,t*Si)}});function jh(r){return function(t,e){var o=cn(t),a=cn(e),l=r(o*a);return[l*a*Me(t),l*Me(e)]}}function Fo(r){return function(t,e){var o=Vr(t*t+e*e),a=r(o),l=Me(a),h=cn(a);return[wi(t*l,o*h),gi(o&&e*l/o)]}}var sA=jh(function(r){return Vr(2/(1+r))});sA.invert=Fo(function(r){return 2*gi(r/2)});var aA=jh(function(r){return(r=N0(r))&&r/Me(r)});aA.invert=Fo(function(r){return r});function H0(r,t){return[r,sc(ac((gr+t)/2))]}H0.invert=function(r,t){return[r,2*yo(Yh(t))-gr]};function Qh(r,t){return[r,t]}Qh.invert=Qh;function uA(r,t){var e=cn(t),o=cn(r)*e;return[e*Me(r)/o,Me(t)/o]}uA.invert=Fo(yo);function lA(r,t){var e=t*t,o=e*e;return[r*(.8707-.131979*e+o*(-.013791+o*(.003971*e-.001529*o))),t*(1.007226+e*(.015085+o*(-.044475+.028874*e-.005916*o)))]}lA.invert=function(r,t){var e=t,o=25,a;do{var l=e*e,h=l*l;e-=a=(e*(1.007226+l*(.015085+h*(-.044475+.028874*l-.005916*h)))-t)/(1.007226+l*(.015085*3+h*(-.044475*7+.028874*9*l-.005916*11*h)))}while(Zn(a)>mn&&--o>0);return[r/(.8707+(l=e*e)*(-.131979+l*(-.013791+l*l*l*(.003971-.001529*l)))),e]};function cA(r,t){return[cn(t)*Me(r),Me(t)]}cA.invert=Fo(gi);function fA(r,t){var e=cn(t),o=1+cn(r)*e;return[e*Me(r)/o,Me(t)/o]}fA.invert=Fo(function(r){return 2*yo(r)});function hA(r,t){return[sc(ac((gr+t)/2)),-r]}hA.invert=function(r,t){return[-t,2*yo(Yh(r))-gr]};var _5=gn(Ju(),1);var x5=gn(Ju(),1);var M5=gn(Ju(),1);var S5=gn(Ju(),1);function Xs(r,t){return Math.sqrt((t[0]-r[0])**2+(t[1]-r[1])**2)}function X0(r){let t=0;for(let e=0;e<r.length-1;e++)t+=Xs(r[e],r[e+1]);return t}function dA(r,t,e){let o=new ye(t[0]-r[0],t[1]-r[1]),a=new ye(t[0]-e[0],t[1]-e[1]),h=o.angleTo(a)*180/Math.PI,f=new ye(t[0]-r[0],t[1]-r[1]);return new ye(e[0]-r[0],e[1]-r[1]).cross(f)>0?h:-h}var Wi="___",tp=class{initRoute(t){this.clear(),this.roadInfo=t,t.length&&(t.forEach(e=>{e.points.forEach(o=>{let a=""+e.floor+Wi+o.id;if(this.pointMap.set(a,o),this.nodeMap.set(""+o.floor+Wi+o.nodeId,a),o.type==="straightLadder"){let l=this.straightLadderMap.get(o.name)||[];l.push(Xa({},o)),this.straightLadderMap.set(o.name,l)}if(o.type==="staircase"){let l=this.staircaseMap.get(o.name)||[];l.push(Xa({},o)),this.staircaseMap.set(o.name,l)}if(o.type==="escalator"){let l=this.escalatorMap.get(o.name)||{};o.escalatorDirection==="exit"?l.end={floor:o.floor,id:o.id}:l.start={floor:o.floor,id:o.id},this.escalatorMap.set(o.name,l)}if(o.type==="facility"){let l=this.facilityMap.get(o.targetId)||[];l.push(Xa({},o)),this.facilityMap.set(o.targetId,l)}}),e.lines.filter(o=>o.direction!=="no").forEach(o=>{var a,l;let h=""+e.floor+Wi+o.from,f=""+e.floor+Wi+o.to,p=(a=this.pointMap.get(h))==null?void 0:a.cds,d=(l=this.pointMap.get(f))==null?void 0:l.cds;if(p!=null&&p.length&&(d!=null&&d.length)){let g=Xs(p,d);this.addLineItem(h,f,g),o.direction==="double"&&this.addLineItem(f,h,g)}})}),this.initBaseRoute(),this.initEscalatorRoute(),this.initStraightLadderRoute())}addLineItem(t,e,o,a){a===void 0&&(a=this.lineMap);let l=a.get(t)||new Map;l.set(e,o),a.set(t,l)}addFacilityToLineMap(t,e,o,a){[...this.straightLadderMap,...this.staircaseMap].forEach(l=>{let[h,f]=l;if(!(f.length<2))for(let g=0;g<f.length;g++){let x=""+f[g].floor+Wi+f[g].id;for(let v=0;v<f.length;v++)if(g!==v){var p,d;let M=""+f[v].floor+Wi+f[v].id,b=(p=this.pointMap.get(x))==null?void 0:p.cds,T=(d=this.pointMap.get(M))==null?void 0:d.cds;if(b!=null&&b.length&&(T!=null&&T.length))if(f[g].type==="straightLadder"){let _=e;this.addLineItem(x,M,_,a)}else{let _=o;this.addLineItem(x,M,_,a)}}}}),this.escalatorMap.forEach((l,h)=>{if(l.start&&l.end){var f,p;let d=""+l.start.floor+Wi+l.start.id,g=""+l.end.floor+Wi+l.end.id,x=(f=this.pointMap.get(d))==null?void 0:f.cds,v=(p=this.pointMap.get(g))==null?void 0:p.cds;if(x!=null&&x.length&&(v!=null&&v.length)){let M=t;this.addLineItem(d,g,M,a)}}})}initBaseRoute(){let t=new Map([...this.lineMap]);this.addFacilityToLineMap(1,this.lift_priority,3e4,t),this.baseRoute=new Uo.default(t)}initEscalatorRoute(){let t=new Map([...this.lineMap]),e=1e4;this.addFacilityToLineMap(1*e,this.lift_priority*e,3e4*e,t),this.escalatorRoute=new Uo.default(t)}initStraightLadderRoute(){let t=new Map([...this.lineMap]),e=1e4;this.addFacilityToLineMap(3*e,1*e,3e4*e,t),this.straightLadderRoute=new Uo.default(t)}checkStart(t){return!(!t.floor||!t.nodeId&&(!t.coord||t.coord.length<2))}checkEnd(t){return t.facility?!0:this.checkStart(t)}transformStart(t){var e;if(t.nodeId){let o=this.nodeMap.get(""+t.floor+Wi+t.nodeId);if(o){let[a,l]=o.split(Wi);return{floor:a,id:l}}}if((e=t.coord)!=null&&e.length){let o=this.roadInfo.find(l=>l.floor===t.floor);if(!o)return null;let a=o.points.reduce((l,h)=>{let f=Xs(t.coord,h.cds);return f<l.min&&(l.min=f,l.point=h),l},{min:1/0,point:o.points[0]});return{floor:a.point.floor,id:a.point.id}}return null}transformEnd(t){if(t.floor){let e=this.transformStart(t);if(e)return e}if(t.facility){let e=this.facilityMap.get(t.facility);if(e!=null&&e.length)return{floor:t.floor,facility:t.facility}}return null}getPath(t,e,o){if(o===void 0&&(o=""),!this.checkStart(t))return"start-error";if(!this.checkEnd(e))return"end-error";let a=this.transformStart(t);if(!a)return"no-start";let l=this.transformEnd(e);if(!l)return"no-end";let h=this.getBasePath.bind(this);switch(o){case"escalator":h=this.getEscalatorPath.bind(this);break;case"straightLadder":h=this.getStraightLadderPath.bind(this);break;default:h=this.getBasePath.bind(this);break}if(l.id)return h(a,l);if(l.facility){let f=this.facilityMap.get(l.facility).filter(d=>l.floor?d.floor===l.floor:!0);if(!f.length)return null;let p=f.map(d=>h(a,{floor:d.floor,id:d.id})).filter(d=>!!d);return p.reduce((d,g)=>{let x=g.reduce((v,M)=>v+X0(M.points),0);return x<d.distance&&(d.distance=x,d.path=g),d},{distance:1/0,path:p[0]}).path}}getRoutePath(t,e,o){let a=""+t.floor+Wi+t.id,l=""+e.floor+Wi+e.id,h=o.path(a,l);if(!h)return null;let f=[];return h.map(p=>{let d=this.pointMap.get(p);if(d){var g;let{floor:x}=d;if(((g=f[f.length-1])==null?void 0:g.floor)===x){let v=f[f.length-1];v.points.push(d.cds),v.endType=d.type,v.destId=d.nodeId,v.distance=X0(v.points)}else f.push({floor:x,points:[d.cds],endType:d.type,destId:d.nodeId,distance:0})}}),f}getBasePath(t,e){return this.getRoutePath(t,e,this.baseRoute)}getEscalatorPath(t,e){return this.getRoutePath(t,e,this.escalatorRoute)}getStraightLadderPath(t,e){return this.getRoutePath(t,e,this.straightLadderRoute)}clear(){this.roadInfo=[],this.pointMap.clear(),this.nodeMap.clear(),this.facilityMap.clear(),this.straightLadderMap.clear(),this.escalatorMap.clear(),this.staircaseMap.clear(),this.lineMap.clear(),this.baseRoute=new Uo.default,this.escalatorRoute=new Uo.default,this.straightLadderRoute=new Uo.default}constructor(t=3){this.lift_priority=t,this.roadInfo=[],this.pointMap=new Map,this.nodeMap=new Map,this.facilityMap=new Map,this.straightLadderMap=new Map,this.escalatorMap=new Map,this.staircaseMap=new Map,this.lineMap=new Map,this.baseRoute=new Uo.default,this.escalatorRoute=new Uo.default,this.straightLadderRoute=new Uo.default}};var Slt=gn(Xc(),1),wlt=gn(Uc(),1);var L5=gn(_A(),1);function N5(r,t,e){let o=dA(r,t,e);return O5(o)}function O5(r){return 180-Math.abs(r)<15?"front":r>135?"right_front":r<-135?"left_front":r<=135&&r>=60?"right":r>=-135&&r<=-60?"left":r<60&&r>0?"right_back":r>-60&&r<0?"left_back":"front"}function xA(r){if(!r.length)return[];if(r.length===1)return[{direction:"start",distance:0,points:r}];let t=[{direction:"start",distance:Xs(r[0],r[1]),points:[r[0],r[1]]}];for(let e=2;e<r.length;e++){let o=N5(r[e-2],r[e-1],r[e]);if(o==="front"){let a=t[t.length-1],l=Xs(r[e-1],r[e]);a.distance+=l,e!==2&&a.points.push(r[e-1])}else t.push({direction:o,distance:Xs(r[e-1],r[e]),points:[r[e-1],r[e]]})}return t.push({direction:"end",distance:0,points:[r[r.length-1]]}),t}var Dlt=gn(YA(),1),Flt=gn(jc(),1),Ult=gn(Uc(),1);function $A(r){return r.replace(/[A-Z]/g,t=>"_"+t.toLowerCase()).replace(/^_/,"")}function ZA(r){let t={};for(let o in r)o.startsWith("on")&&(t[$A(o.slice(2))]=r[o],t[o]=r[o]);let e=o=>gc(this,null,function*(){let{data:a}=o;if(t[a.type])try{let l=yield t[a.type](a.data);if(l!=null&&l.$transfer&&Array.isArray(l.$transfer)){let h=l.$transfer;delete l.$transfer,self.postMessage({type:""+a.type+"_result",key:a.key,data:l},h)}else self.postMessage({type:""+a.type+"_result",key:a.key,data:l})}catch(l){self.postMessage({type:""+a.type+"_result",key:a.key,error:l})}else self.postMessage({type:""+a.type+"_result",key:a.key,error:"no_event"})});return self.addEventListener("message",e),()=>{self.removeEventListener("message",e)}}var ty=new tp;ZA({onSetRoadInfo(r){let{roadData:t}=r;ty.initRoute(t)},onGetPath(r){let{start:t,end:e,type:o}=r;return ty.getPath(t,e,o)},onGetDirectionPath(r){return xA(r)},onClear(){ty.clear()}});
|