@aibee/crc-bmap 0.7.1 → 0.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- "use strict";var ff=Object.create;var fi=Object.defineProperty;var pf=Object.getOwnPropertyDescriptor;var df=Object.getOwnPropertyNames;var mf=Object.getPrototypeOf,gf=Object.prototype.hasOwnProperty;var gn=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),yf=(r,e)=>{for(var t in e)fi(r,t,{get:e[t],enumerable:!0})},zs=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of df(e))!gf.call(r,i)&&i!==t&&fi(r,i,{get:()=>e[i],enumerable:!(n=pf(e,i))||n.enumerable});return r};var Ar=(r,e,t)=>(t=r!=null?ff(mf(r)):{},zs(e||!r||!r.__esModule?fi(t,"default",{value:r,enumerable:!0}):t,r)),_f=r=>zs(fi({},"__esModule",{value:!0}),r);var ks=gn((dy,Bs)=>{Bs.exports=function(e,t){return e[0]=t[0],e[1]=t[1],e}});var Fs=gn((my,Vs)=>{var Xs=ks();Vs.exports=function(r,e){Array.isArray(e)||(e=[]),r.length>0&&e.push(Xs([0,0],r[0]));for(var t=0;t<r.length-1;t++){var n=r[t],i=r[t+1],o=n[0],a=n[1],s=i[0],u=i[1],l=[.75*o+.25*s,.75*a+.25*u],c=[.25*o+.75*s,.25*a+.75*u];e.push(l),e.push(c)}return r.length>1&&e.push(Xs([0,0],r[r.length-1])),e}});var Zs=gn((_y,Ys)=>{var Po=class{constructor(){this.keys=new Set,this.queue=[]}sort(){this.queue.sort((e,t)=>e.priority-t.priority)}set(e,t){let n=Number(t);if(isNaN(n))throw new TypeError('"priority" must be a number');return this.keys.has(e)?this.queue.map(i=>(i.key===e&&Object.assign(i,{priority:n}),i)):(this.keys.add(e),this.queue.push({key:e,priority:n})),this.sort(),this.queue.length}next(){let e=this.queue.shift();return this.keys.delete(e.key),e}isEmpty(){return this.queue.length===0}has(e){return this.keys.has(e)}get(e){return this.queue.find(t=>t.key===e)}};Ys.exports=Po});var Hs=gn((vy,Gs)=>{function Qs(r,e){let t=new Map;for(let[n,i]of r)n!==e&&i instanceof Map?t.set(n,Qs(i,e)):n!==e&&t.set(n,i);return t}Gs.exports=Qs});var Js=gn((xy,$s)=>{function Pf(r){let e=Number(r);return!(isNaN(e)||e<=0)}function Ks(r){let e=new Map;return Object.keys(r).forEach(n=>{let i=r[n];if(i!==null&&typeof i=="object"&&!Array.isArray(i))return e.set(n,Ks(i));if(!Pf(i))throw new Error(`Could not add node at key "${n}", make sure it's a valid node`,i);return e.set(n,Number(i))}),e}$s.exports=Ks});var nu=gn((Cy,eu)=>{function tu(r){if(!(r instanceof Map))throw new Error(`Invalid graph: Expected Map instead found ${typeof r}`);r.forEach((e,t)=>{if(typeof e=="object"&&e instanceof Map){tu(e);return}if(typeof e!="number"||e<=0)throw new Error(`Values must be numbers greater than 0. Found value ${e} at ${t}`)})}eu.exports=tu});var Ro=gn((Ay,ou)=>{var If=Zs(),Rf=Hs(),ru=Js(),iu=nu(),Io=class{constructor(e){e instanceof Map?(iu(e),this.graph=e):e?this.graph=ru(e):this.graph=new Map}addNode(e,t){let n;return t instanceof Map?(iu(t),n=t):n=ru(t),this.graph.set(e,n),this}addVertex(e,t){return this.addNode(e,t)}removeNode(e){return this.graph=Rf(this.graph,e),this}path(e,t,n={}){if(!this.graph.size)return n.cost?{path:null,cost:0}:null;let i=new Set,o=new If,a=new Map,s=[],u=0,l=[];if(n.avoid&&(l=[].concat(n.avoid)),l.includes(e))throw new Error(`Starting node (${e}) cannot be avoided`);if(l.includes(t))throw new Error(`Ending node (${t}) cannot be avoided`);for(o.set(e,0);!o.isEmpty();){let c=o.next();if(c.key===t){u=c.priority;let p=c.key;for(;a.has(p);)s.push(p),p=a.get(p);break}i.add(c.key),(this.graph.get(c.key)||new Map).forEach((p,d)=>{if(i.has(d)||l.includes(d))return null;if(!o.has(d))return a.set(d,c.key),o.set(d,c.priority+p);let m=o.get(d).priority,h=c.priority+p;return h<m?(a.set(d,c.key),o.set(d,h)):null})}return s.length?(n.trim?s.shift():s=s.concat([e]),n.reverse||(s=s.reverse()),n.cost?{path:s,cost:u}:s):n.cost?{path:null,cost:0}:null}shortestPath(...e){return this.path(...e)}};ou.exports=Io});var ra=gn((ea,na)=>{(function(r,e){typeof ea=="object"&&typeof na<"u"?na.exports=e():typeof define=="function"&&define.amd?define(e):(r=typeof globalThis<"u"?globalThis:r||self,r["'typed'"]=e())})(ea,function(){"use strict";function r(){return!0}function e(){return!1}function t(){}let n="Argument is not a typed-function.";function i(){function a(b){return typeof b=="object"&&b!==null&&b.constructor===Object}let s=[{name:"number",test:function(b){return typeof b=="number"}},{name:"string",test:function(b){return typeof b=="string"}},{name:"boolean",test:function(b){return typeof b=="boolean"}},{name:"Function",test:function(b){return typeof b=="function"}},{name:"Array",test:Array.isArray},{name:"Date",test:function(b){return b instanceof Date}},{name:"RegExp",test:function(b){return b instanceof RegExp}},{name:"Object",test:a},{name:"null",test:function(b){return b===null}},{name:"undefined",test:function(b){return b===void 0}}],u={name:"any",test:r,isAny:!0},l,c,f=0,p={createCount:0};function d(b){let T=l.get(b);if(T)return T;let I='Unknown type "'+b+'"',v=b.toLowerCase(),P;for(P of c)if(P.toLowerCase()===v){I+='. Did you mean "'+P+'" ?';break}throw new TypeError(I)}function m(b){let T=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"any",I=T?d(T).index:c.length,v=[];for(let U=0;U<b.length;++U){if(!b[U]||typeof b[U].name!="string"||typeof b[U].test!="function")throw new TypeError("Object with properties {name: string, test: function} expected");let V=b[U].name;if(l.has(V))throw new TypeError('Duplicate type name "'+V+'"');v.push(V),l.set(V,{name:V,test:b[U].test,isAny:b[U].isAny,index:I+U,conversionsTo:[]})}let P=c.slice(I);c=c.slice(0,I).concat(v).concat(P);for(let U=I+v.length;U<c.length;++U)l.get(c[U]).index=U}function h(){l=new Map,c=[],f=0,m([u],!1)}h(),m(s);function g(){let b;for(b of c)l.get(b).conversionsTo=[];f=0}function _(b){let T=c.filter(I=>{let v=l.get(I);return!v.isAny&&v.test(b)});return T.length?T:["any"]}function A(b){return b&&typeof b=="function"&&"_typedFunctionData"in b}function y(b,T,I){if(!A(b))throw new TypeError(n);let v=I&&I.exact,P=Array.isArray(T)?T.join(","):T,U=R(P),V=C(U);if(!v||V in b.signatures){let gt=b._typedFunctionData.signatureMap.get(V);if(gt)return gt}let k=U.length,W;if(v){W=[];let gt;for(gt in b.signatures)W.push(b._typedFunctionData.signatureMap.get(gt))}else W=b._typedFunctionData.signatures;for(let gt=0;gt<k;++gt){let _t=U[gt],Ut=[],It;for(It of W){let wt=F(It.params,gt);if(!(!wt||_t.restParam&&!wt.restParam)){if(!wt.hasAny){let oe=M(wt);if(_t.types.some($t=>!oe.has($t.name)))continue}Ut.push(It)}}if(W=Ut,W.length===0)break}let X;for(X of W)if(X.params.length<=k)return X;throw new TypeError("Signature not found (signature: "+(b.name||"unnamed")+"("+C(U,", ")+"))")}function S(b,T,I){return y(b,T,I).implementation}function x(b,T){let I=d(T);if(I.test(b))return b;let v=I.conversionsTo;if(v.length===0)throw new Error("There are no conversions to "+T+" defined.");for(let P=0;P<v.length;P++)if(d(v[P].from).test(b))return v[P].convert(b);throw new Error("Cannot convert "+b+" to "+T)}function C(b){let T=arguments.length>1&&arguments[1]!==void 0?arguments[1]:",";return b.map(I=>I.name).join(T)}function w(b){let T=b.indexOf("...")===0,v=(T?b.length>3?b.slice(3):"any":b).split("|").map(k=>d(k.trim())),P=!1,U=T?"...":"";return{types:v.map(function(k){return P=k.isAny||P,U+=k.name+"|",{name:k.name,typeIndex:k.index,test:k.test,isAny:k.isAny,conversion:null,conversionIndex:-1}}),name:U.slice(0,-1),hasAny:P,hasConversion:!1,restParam:T}}function E(b){let T=b.types.map(V=>V.name),I=dt(T),v=b.hasAny,P=b.name,U=I.map(function(V){let k=d(V.from);return v=k.isAny||v,P+="|"+V.from,{name:V.from,typeIndex:k.index,test:k.test,isAny:k.isAny,conversion:V,conversionIndex:V.index}});return{types:b.types.concat(U),name:P,hasAny:v,hasConversion:U.length>0,restParam:b.restParam}}function M(b){return b.typeSet||(b.typeSet=new Set,b.types.forEach(T=>b.typeSet.add(T.name))),b.typeSet}function R(b){let T=[];if(typeof b!="string")throw new TypeError("Signatures must be strings");let I=b.trim();if(I==="")return T;let v=I.split(",");for(let P=0;P<v.length;++P){let U=w(v[P].trim());if(U.restParam&&P!==v.length-1)throw new SyntaxError('Unexpected rest parameter "'+v[P]+'": only allowed for the last parameter');if(U.types.length===0)return null;T.push(U)}return T}function N(b){let T=kt(b);return T?T.restParam:!1}function D(b){if(!b||b.types.length===0)return r;if(b.types.length===1)return d(b.types[0].name).test;if(b.types.length===2){let T=d(b.types[0].name).test,I=d(b.types[1].name).test;return function(P){return T(P)||I(P)}}else{let T=b.types.map(function(I){return d(I.name).test});return function(v){for(let P=0;P<T.length;P++)if(T[P](v))return!0;return!1}}}function q(b){let T,I,v;if(N(b)){T=zt(b).map(D);let P=T.length,U=D(kt(b)),V=function(k){for(let W=P;W<k.length;W++)if(!U(k[W]))return!1;return!0};return function(W){for(let X=0;X<T.length;X++)if(!T[X](W[X]))return!1;return V(W)&&W.length>=P+1}}else return b.length===0?function(U){return U.length===0}:b.length===1?(I=D(b[0]),function(U){return I(U[0])&&U.length===1}):b.length===2?(I=D(b[0]),v=D(b[1]),function(U){return I(U[0])&&v(U[1])&&U.length===2}):(T=b.map(D),function(U){for(let V=0;V<T.length;V++)if(!T[V](U[V]))return!1;return U.length===T.length})}function F(b,T){return T<b.length?b[T]:N(b)?kt(b):null}function j(b,T){let I=F(b,T);return I?M(I):new Set}function O(b){return b.conversion===null||b.conversion===void 0}function Y(b,T){let I=new Set;return b.forEach(v=>{let P=j(v.params,T),U;for(U of P)I.add(U)}),I.has("any")?["any"]:Array.from(I)}function G(b,T,I){let v,P,U=b||"unnamed",V=I,k;for(k=0;k<T.length;k++){let _t=[];if(V.forEach(Ut=>{let It=F(Ut.params,k),wt=D(It);(k<Ut.params.length||N(Ut.params))&&wt(T[k])&&_t.push(Ut)}),_t.length===0){if(P=Y(V,k),P.length>0){let Ut=_(T[k]);return v=new TypeError("Unexpected type of argument in function "+U+" (expected: "+P.join(" or ")+", actual: "+Ut.join(" | ")+", index: "+k+")"),v.data={category:"wrongType",fn:U,index:k,actual:Ut,expected:P},v}}else V=_t}let W=V.map(function(_t){return N(_t.params)?1/0:_t.params.length});if(T.length<Math.min.apply(null,W))return P=Y(V,k),v=new TypeError("Too few arguments in function "+U+" (expected: "+P.join(" or ")+", index: "+T.length+")"),v.data={category:"tooFewArgs",fn:U,index:T.length,expected:P},v;let X=Math.max.apply(null,W);if(T.length>X)return v=new TypeError("Too many arguments in function "+U+" (expected: "+X+", actual: "+T.length+")"),v.data={category:"tooManyArgs",fn:U,index:T.length,expectedLength:X},v;let gt=[];for(let _t=0;_t<T.length;++_t)gt.push(_(T[_t]).join("|"));return v=new TypeError('Arguments of type "'+gt.join(", ")+'" do not match any of the defined signatures of function '+U+"."),v.data={category:"mismatch",actual:gt},v}function Z(b){let T=c.length+1;for(let I=0;I<b.types.length;I++)O(b.types[I])&&(T=Math.min(T,b.types[I].typeIndex));return T}function tt(b){let T=f+1;for(let I=0;I<b.types.length;I++)O(b.types[I])||(T=Math.min(T,b.types[I].conversionIndex));return T}function pt(b,T){if(b.hasAny){if(!T.hasAny)return 1}else if(T.hasAny)return-1;if(b.restParam){if(!T.restParam)return 1}else if(T.restParam)return-1;if(b.hasConversion){if(!T.hasConversion)return 1}else if(T.hasConversion)return-1;let I=Z(b)-Z(T);if(I<0)return-1;if(I>0)return 1;let v=tt(b)-tt(T);return v<0?-1:v>0?1:0}function lt(b,T){let I=b.params,v=T.params,P=kt(I),U=kt(v),V=N(I),k=N(v);if(V&&P.hasAny){if(!k||!U.hasAny)return 1}else if(k&&U.hasAny)return-1;let W=0,X=0,gt;for(gt of I)gt.hasAny&&++W,gt.hasConversion&&++X;let _t=0,Ut=0;for(gt of v)gt.hasAny&&++_t,gt.hasConversion&&++Ut;if(W!==_t)return W-_t;if(V&&P.hasConversion){if(!k||!U.hasConversion)return 1}else if(k&&U.hasConversion)return-1;if(X!==Ut)return X-Ut;if(V){if(!k)return 1}else if(k)return-1;let It=(I.length-v.length)*(V?-1:1);if(It!==0)return It;let wt=[],oe=0;for(let Ie=0;Ie<I.length;++Ie){let an=pt(I[Ie],v[Ie]);wt.push(an),oe+=an}if(oe!==0)return oe;let $t;for($t of wt)if($t!==0)return $t;return 0}function dt(b){if(b.length===0)return[];let T=b.map(d);b.length>1&&T.sort((P,U)=>P.index-U.index);let I=T[0].conversionsTo;if(b.length===1)return I;I=I.concat([]);let v=new Set(b);for(let P=1;P<T.length;++P){let U;for(U of T[P].conversionsTo)v.has(U.from)||(I.push(U),v.add(U.from))}return I}function Ot(b,T){let I=T;if(b.some(P=>P.hasConversion)){let P=N(b),U=b.map(Lt);I=function(){let k=[],W=P?arguments.length-1:arguments.length;for(let X=0;X<W;X++)k[X]=U[X](arguments[X]);return P&&(k[W]=arguments[W].map(U[W])),T.apply(this,k)}}let v=I;if(N(b)){let P=b.length-1;v=function(){return I.apply(this,Pe(arguments,0,P).concat([Pe(arguments,P)]))}}return v}function Lt(b){let T,I,v,P,U=[],V=[];switch(b.types.forEach(function(k){k.conversion&&(U.push(d(k.conversion.from).test),V.push(k.conversion.convert))}),V.length){case 0:return function(W){return W};case 1:return T=U[0],v=V[0],function(W){return T(W)?v(W):W};case 2:return T=U[0],I=U[1],v=V[0],P=V[1],function(W){return T(W)?v(W):I(W)?P(W):W};default:return function(W){for(let X=0;X<V.length;X++)if(U[X](W))return V[X](W);return W}}}function Pt(b){function T(I,v,P){if(v<I.length){let U=I[v],V=[];if(U.restParam){let k=U.types.filter(O);k.length<U.types.length&&V.push({types:k,name:"..."+k.map(W=>W.name).join("|"),hasAny:k.some(W=>W.isAny),hasConversion:!1,restParam:!0}),V.push(U)}else V=U.types.map(function(k){return{types:[k],name:k.name,hasAny:k.isAny,hasConversion:k.conversion,restParam:!1}});return mn(V,function(k){return T(I,v+1,P.concat([k]))})}else return[P]}return T(b,0,[])}function At(b,T){let I=Math.max(b.length,T.length);for(let k=0;k<I;k++){let W=j(b,k),X=j(T,k),gt=!1,_t;for(_t of X)if(W.has(_t)){gt=!0;break}if(!gt)return!1}let v=b.length,P=T.length,U=N(b),V=N(T);return U?V?v===P:P>=v:V?v>=P:v===P}function Kt(b){return b.map(T=>vr(T)?si(T.referToSelf.callback):ui(T)?$e(T.referTo.references,T.referTo.callback):T)}function St(b,T,I){let v=[],P;for(P of b){let U=I[P];if(typeof U!="number")throw new TypeError('No definition for referenced signature "'+P+'"');if(U=T[U],typeof U!="function")return!1;v.push(U)}return v}function mt(b,T,I){let v=Kt(b),P=new Array(v.length).fill(!1),U=!0;for(;U;){U=!1;let V=!0;for(let k=0;k<v.length;++k){if(P[k])continue;let W=v[k];if(vr(W))v[k]=W.referToSelf.callback(I),v[k].referToSelf=W.referToSelf,P[k]=!0,V=!1;else if(ui(W)){let X=St(W.referTo.references,v,T);X?(v[k]=W.referTo.callback.apply(this,X),v[k].referTo=W.referTo,P[k]=!0,V=!1):U=!0}}if(V&&U)throw new SyntaxError("Circular reference detected in resolving typed.referTo")}return v}function ge(b){let T=/\bthis(\(|\.signatures\b)/;Object.keys(b).forEach(I=>{let v=b[I];if(T.test(v.toString()))throw new SyntaxError("Using `this` to self-reference a function is deprecated since typed-function@3. Use typed.referTo and typed.referToSelf instead.")})}function Bt(b,T){if(p.createCount++,Object.keys(T).length===0)throw new SyntaxError("No signatures provided");p.warnAgainstDeprecatedThis&&ge(T);let I=[],v=[],P={},U=[],V;for(V in T){if(!Object.prototype.hasOwnProperty.call(T,V))continue;let yt=R(V);if(!yt)continue;I.forEach(function(Cr){if(At(Cr,yt))throw new TypeError('Conflicting signatures "'+C(Cr)+'" and "'+C(yt)+'".')}),I.push(yt);let ye=v.length;v.push(T[V]);let cf=yt.map(E),hi;for(hi of Pt(cf)){let Cr=C(hi);U.push({params:hi,name:Cr,fn:ye}),hi.every(hf=>!hf.hasConversion)&&(P[Cr]=ye)}}U.sort(lt);let k=mt(v,P,xr),W;for(W in P)Object.prototype.hasOwnProperty.call(P,W)&&(P[W]=k[P[W]]);let X=[],gt=new Map;for(W of U)gt.has(W.name)||(W.fn=k[W.fn],X.push(W),gt.set(W.name,W));let _t=X[0]&&X[0].params.length<=2&&!N(X[0].params),Ut=X[1]&&X[1].params.length<=2&&!N(X[1].params),It=X[2]&&X[2].params.length<=2&&!N(X[2].params),wt=X[3]&&X[3].params.length<=2&&!N(X[3].params),oe=X[4]&&X[4].params.length<=2&&!N(X[4].params),$t=X[5]&&X[5].params.length<=2&&!N(X[5].params),Ie=_t&&Ut&&It&&wt&&oe&&$t;for(let yt=0;yt<X.length;++yt)X[yt].test=q(X[yt].params);let an=_t?D(X[0].params[0]):e,Dh=Ut?D(X[1].params[0]):e,Oh=It?D(X[2].params[0]):e,zh=wt?D(X[3].params[0]):e,Bh=oe?D(X[4].params[0]):e,kh=$t?D(X[5].params[0]):e,Xh=_t?D(X[0].params[1]):e,Vh=Ut?D(X[1].params[1]):e,Fh=It?D(X[2].params[1]):e,jh=wt?D(X[3].params[1]):e,Wh=oe?D(X[4].params[1]):e,qh=$t?D(X[5].params[1]):e;for(let yt=0;yt<X.length;++yt)X[yt].implementation=Ot(X[yt].params,X[yt].fn);let Yh=_t?X[0].implementation:t,Zh=Ut?X[1].implementation:t,Qh=It?X[2].implementation:t,Gh=wt?X[3].implementation:t,Hh=oe?X[4].implementation:t,Kh=$t?X[5].implementation:t,$h=_t?X[0].params.length:-1,Jh=Ut?X[1].params.length:-1,tf=It?X[2].params.length:-1,ef=wt?X[3].params.length:-1,nf=oe?X[4].params.length:-1,rf=$t?X[5].params.length:-1,of=Ie?6:0,af=X.length,sf=X.map(yt=>yt.test),uf=X.map(yt=>yt.implementation),lf=function(){for(let ye=of;ye<af;ye++)if(sf[ye](arguments))return uf[ye].apply(this,arguments);return p.onMismatch(b,arguments,X)};function xr(yt,ye){return arguments.length===$h&&an(yt)&&Xh(ye)?Yh.apply(this,arguments):arguments.length===Jh&&Dh(yt)&&Vh(ye)?Zh.apply(this,arguments):arguments.length===tf&&Oh(yt)&&Fh(ye)?Qh.apply(this,arguments):arguments.length===ef&&zh(yt)&&jh(ye)?Gh.apply(this,arguments):arguments.length===nf&&Bh(yt)&&Wh(ye)?Hh.apply(this,arguments):arguments.length===rf&&kh(yt)&&qh(ye)?Kh.apply(this,arguments):lf.apply(this,arguments)}try{Object.defineProperty(xr,"name",{value:b})}catch{}return xr.signatures=P,xr._typedFunctionData={signatures:X,signatureMap:gt},xr}function ht(b,T,I){throw G(b,T,I)}function zt(b){return Pe(b,0,b.length-1)}function kt(b){return b[b.length-1]}function Pe(b,T,I){return Array.prototype.slice.call(b,T,I)}function He(b,T){for(let I=0;I<b.length;I++)if(T(b[I]))return b[I]}function mn(b,T){return Array.prototype.concat.apply([],b.map(T))}function Ke(){let b=zt(arguments).map(I=>C(R(I))),T=kt(arguments);if(typeof T!="function")throw new TypeError("Callback function expected as last argument");return $e(b,T)}function $e(b,T){return{referTo:{references:b,callback:T}}}function si(b){if(typeof b!="function")throw new TypeError("Callback function expected as first argument");return{referToSelf:{callback:b}}}function ui(b){return b&&typeof b.referTo=="object"&&Array.isArray(b.referTo.references)&&typeof b.referTo.callback=="function"}function vr(b){return b&&typeof b.referToSelf=="object"&&typeof b.referToSelf.callback=="function"}function Zn(b,T){if(!b)return T;if(T&&T!==b){let I=new Error("Function names do not match (expected: "+b+", actual: "+T+")");throw I.data={actual:T,expected:b},I}return b}function ho(b){let T;for(let I in b)Object.prototype.hasOwnProperty.call(b,I)&&(A(b[I])||typeof b[I].signature=="string")&&(T=Zn(T,b[I].name));return T}function fo(b,T){let I;for(I in T)if(Object.prototype.hasOwnProperty.call(T,I)){if(I in b&&T[I]!==b[I]){let v=new Error('Signature "'+I+'" is defined twice');throw v.data={signature:I,sourceFunction:T[I],destFunction:b[I]},v}b[I]=T[I]}}let li=p;p=function(b){let T=typeof b=="string",I=T?1:0,v=T?b:"",P={};for(let U=I;U<arguments.length;++U){let V=arguments[U],k={},W;if(typeof V=="function"?(W=V.name,typeof V.signature=="string"?k[V.signature]=V:A(V)&&(k=V.signatures)):a(V)&&(k=V,T||(W=ho(V))),Object.keys(k).length===0){let X=new TypeError("Argument to 'typed' at index "+U+" is not a (typed) function, nor an object with signatures as keys and functions as values.");throw X.data={index:U,argument:V},X}T||(v=Zn(v,W)),fo(P,k)}return Bt(v||"",P)},p.create=i,p.createCount=li.createCount,p.onMismatch=ht,p.throwMismatchError=ht,p.createError=G,p.clear=h,p.clearConversions=g,p.addTypes=m,p._findType=d,p.referTo=Ke,p.referToSelf=si,p.convert=x,p.findSignature=y,p.find=S,p.isTypedFunction=A,p.warnAgainstDeprecatedThis=!0,p.addType=function(b,T){let I="any";T!==!1&&l.has("Object")&&(I="Object"),p.addTypes([b],I)};function ci(b){if(!b||typeof b.from!="string"||typeof b.to!="string"||typeof b.convert!="function")throw new TypeError("Object with properties {from: string, to: string, convert: function} expected");if(b.to===b.from)throw new SyntaxError('Illegal to define conversion from "'+b.from+'" to itself.')}return p.addConversion=function(b){let T=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{override:!1};ci(b);let I=d(b.to),v=I.conversionsTo.find(P=>P.from===b.from);if(v)if(T&&T.override)p.removeConversion({from:v.from,to:b.to,convert:v.convert});else throw new Error('There is already a conversion from "'+b.from+'" to "'+I.name+'"');I.conversionsTo.push({from:b.from,convert:b.convert,index:f++})},p.addConversions=function(b,T){b.forEach(I=>p.addConversion(I,T))},p.removeConversion=function(b){ci(b);let T=d(b.to),I=He(T.conversionsTo,P=>P.from===b.from);if(!I)throw new Error("Attempt to remove nonexistent conversion from "+b.from+" to "+b.to);if(I.convert!==b.convert)throw new Error("Conversion to remove does not match existing conversion");let v=T.conversionsTo.indexOf(I);T.conversionsTo.splice(v,1)},p.resolve=function(b,T){if(!A(b))throw new TypeError(n);let I=b._typedFunctionData.signatures;for(let v=0;v<I.length;++v)if(I[v].test(T))return I[v];return null},p}var o=i();return o})});var Zg={};yf(Zg,{AibeeLoader:()=>Ds,BMap:()=>Fo,BMapSelect:()=>Ko,BaseSvg:()=>Ee,Context:()=>Fr,CrLoader:()=>Os,CrNavPath:()=>Ho,Equipment:()=>jo,Events:()=>So,Floor:()=>qe,GlbModel:()=>Or,Graphic:()=>Yt,GraphicLayer:()=>Rr,GroundTexture:()=>Jn,HeatmapElement:()=>Pr,HooksName:()=>Kn,HoverHelper:()=>Vr,Lane:()=>zr,Layer:()=>ne,MapTypePolar:()=>Du,MergeGraphic:()=>Br,Model:()=>Ir,MulFloorNavigation:()=>Es,MulFloors:()=>Yo,NavPath:()=>Qo,Navigation:()=>qo,Overlay:()=>Mr,PathDirection:()=>To,PdrPosition:()=>ws,Poi:()=>Cn,Poi2:()=>ve,PoiLayer:()=>Nr,PoiLayer2:()=>kn,RoadNetwork:()=>No,RoadNetwork2:()=>Lo,SelectBox:()=>Oo,Selection:()=>Xr,Sensor:()=>qr,Shadow:()=>Tr,SvgLine:()=>Lr,SvgPolygon:()=>Ur,TextTexture:()=>kr,Timer:()=>Jt,TweenUtil:()=>cn,UA:()=>Ao,Wall:()=>Dr,addAlphaToHexColor:()=>bf,calc_angle:()=>yo,calc_direction:()=>di,convertToSnakeCase:()=>Uo,createCircle:()=>Gn,createLine:()=>wr,createRect:()=>ln,createSvg:()=>xo,createSvgElement:()=>Sr,createThreeBox:()=>Uf,createThreeLine:()=>Lf,darkenColor:()=>Je,defaultAibeeLoaderOption:()=>Yg,defaultConfig:()=>Lu,defaultGraphicOptions:()=>mi,defaultOptions:()=>yu,defaultTextTextureOptions:()=>bu,dispose:()=>te,distancePointToSegment:()=>Eo,generatorKeyByObj:()=>Un,getAngle:()=>Ws,getCenter:()=>br,getConfig:()=>Vo,getDirectPath:()=>Mf,getDistanceByPathPos:()=>Mo,getLength:()=>Wt,getLongestSideDir:()=>vf,getMinEdgeSquare:()=>_o,getPathLength:()=>Re,getPointEdgeIndex:()=>un,getPosByPathDistance:()=>Dn,hasChinese:()=>go,hexToRgb:()=>pi,initDirectionalLight:()=>mo,initLight:()=>po,initShape:()=>Fe,isAndroid:()=>Sf,isContain:()=>sn,isControl:()=>Ln,isIphone:()=>Hn,isMac:()=>Nn,isPointInPolygon:()=>vo,loadBuildingGround:()=>Ts,loadExternalStreet:()=>Xg,loadGraphics:()=>Ms,moveOnRoute:()=>Tf,proxyOptions:()=>Rn,removeWeightPath:()=>qs,setCirclePosition:()=>yn,setLineStartEnd:()=>Ne,setRectPosition:()=>ae,simplifyPath:()=>Er,sleepOnePromise:()=>Co,sleepOneRf:()=>Cf,smoothPath:()=>wo,strToNumber:()=>Af,timeoutPromise:()=>we,toWebWorker:()=>Nf,transformGraphicData:()=>_e,translatePosToCenter:()=>Ue,triggerWorker:()=>je,vector3ToDevice:()=>nt,xhrGet:()=>wf});module.exports=_f(Zg);var Ni=require("three");var Jt=class{tasks={requestAnimation:new Set,timeout:new Set,interval:new Set};requestAnimationFrame(e){let t=window.requestAnimationFrame(()=>{this.tasks.requestAnimation.delete(t),e()});return this.tasks.requestAnimation.add(t),t}cancelAnimationFrame(e){this.tasks.requestAnimation.delete(e),window.cancelAnimationFrame(e)}setTimeout(e,t){let n=window.setTimeout(()=>{this.tasks.timeout.delete(n),e()},t);return this.tasks.timeout.add(n),n}clearTimeout(e){this.tasks.timeout.delete(e),window.clearTimeout(e)}setInterval(e,t){let n=window.setInterval(()=>{this.tasks.interval.delete(n),e()},t);return this.tasks.interval.add(n),n}clearInterval(e){this.tasks.interval.delete(e),window.clearInterval(e)}dispose(){this.tasks.requestAnimation.forEach(e=>{window.cancelAnimationFrame(e)}),this.tasks.requestAnimation.clear(),this.tasks.timeout.forEach(e=>{window.clearTimeout(e)}),this.tasks.timeout.clear(),this.tasks.interval.forEach(e=>{window.clearInterval(e)}),this.tasks.interval.clear()}};var Se=require("three");function po(){let r=new Se.Group,e=new Se.AmbientLight(16777215,2.6);return r.add(e),r}function Fe(r,e=[]){let t=new Se.Shape(r.map(n=>new Se.Vector2(...n)));return e.length&&e.forEach(n=>{var i=new Se.Path(n.map(o=>new Se.Vector2(...o)));t.holes.push(i)}),t}function mo(r=16777215,e=1){let t=new Se.DirectionalLight(r,e);return t.castShadow=!0,t.shadow.radius=8,t.shadow.bias=-.001,t.shadow.mapSize.set(256,256),t.shadow.camera.left=-200,t.shadow.camera.right=200,t.shadow.camera.top=200,t.shadow.camera.bottom=-200,t}function te(r,e){if(e&&r.children&&r.children.length&&r.children.forEach(t=>{te(t,e)}),r.isMesh){let t=r;t.geometry&&t.geometry.dispose(),t.material&&(Array.isArray(t.material)?t.material.forEach(n=>{n.dispose()}):t.material.dispose())}r.isLight&&r.dispose?.()}function go(r){return/[\u4E00-\u9FA5]+/g.test(r)}var Xt=require("three"),Qn=require("@turf/turf");function nt(r,e,t,n){let i=r.clone().project(e),o=t/2,a=n/2,s=Math.round(i.x*o+o),u=Math.round(-i.y*a+a);return{x:s,y:u}}function br(r){let e=(0,Qn.featureCollection)(r.map(n=>(0,Qn.point)(n)));return(0,Qn.center)(e).geometry.coordinates}function sn(r,e,t){return r.x>=e.x&&r.x<=t.x&&r.y>=e.y&&r.y<=t.y}function vf(r){let e=0,t=new Xt.Vector3;for(let n=1;n<r.length;n++){let i=new Xt.Vector3(r[n-1][0],r[n-1][1],0),o=new Xt.Vector3(r[n][0],r[n][1],0),a=o.distanceTo(i);a>e&&(e=a,t=o.clone().sub(i).normalize())}return t}function Wt(r,e){return Math.sqrt((e[0]-r[0])**2+(e[1]-r[1])**2)}function Re(r){let e=0;for(let t=0;t<r.length-1;t++)e+=Wt(r[t],r[t+1]);return e}function yo(r,e,t){let n=new Xt.Vector2(e[0]-r[0],e[1]-r[1]),i=new Xt.Vector2(e[0]-t[0],e[1]-t[1]),a=n.angleTo(i)*180/Math.PI,s=new Xt.Vector2(e[0]-r[0],e[1]-r[1]);return new Xt.Vector2(t[0]-r[0],t[1]-r[1]).cross(s)>0?a:-a}function _o(r,e){let t=Math.min(Wt(r[0][0],r[0][1]),Wt(r[0][2],r[0][1]))-1;e||(e=br(r[0]));let n=xf(e,t),i=new Xt.Vector2(r[0][0][0],r[0][0][1]),o=new Xt.Vector2(r[0][1][0],r[0][1][1]),a=new Xt.Vector2(r[0][2][0],r[0][2][1]),u=(i.distanceTo(o)>o.distanceTo(a)?o.clone().sub(i):a.clone().sub(o)).angleTo(new Xt.Vector2(0,1)),l=new Xt.Matrix3;return l.multiply(new Xt.Matrix3().translate(e[0],e[1])).multiply(new Xt.Matrix3().rotate(u)).multiply(new Xt.Matrix3().translate(-e[0],-e[1])),[n.map(c=>{let f=new Xt.Vector2(c[0],c[1]).applyMatrix3(l);return[f.x,f.y]})]}function xf(r,e){let t=e/2;return[[r[0]-t,r[1]+t],[r[0]+t,r[1]+t],[r[0]+t,r[1]-t],[r[0]-t,r[1]-t],[r[0]-t,r[1]+t]]}function un(r,e){let t=0,n=1/0,[i,o]=e;for(let a=0;a<r.length-1;a++){let[s,u]=r[a],[l,c]=r[a+1],f=Math.min(s,l)<=i&&i<=Math.max(s,l),p=Math.min(u,c)<=o&&o<=Math.max(u,c);if(f&&p){let d=Math.abs((l-s)*(o-u)-(c-u)*(i-s));d<n&&(n=d,t=a)}}return t}function vo(r,e){let t=r[0],n=r[1],i=!1;for(let o=0,a=e.length-1;o<e.length;a=o++){let s=e[o][0],u=e[o][1],l=e[a][0],c=e[a][1];u>n!=c>n&&t<(l-s)*(n-u)/(c-u)+s&&(i=!i)}return i}function Rn(r,e){return new Proxy(r,{get:(t,n,i)=>Reflect.get(t,n,i),set:(t,n,i,o)=>{let a=Reflect.get(t,n,o),s=Reflect.set(t,n,i,o);return a!==i&&e.dispatchEvent({type:`change-${n}`,value:i}),s}})}function we(r,e){return Promise.race([r,new Promise((t,n)=>{setTimeout(()=>n(new Error("Promise timeout")),e)})])}function Sr(r){return document.createElementNS("http://www.w3.org/2000/svg",r)}function xo(r,e){let t=Sr("svg");return t.setAttribute("width",r),t.setAttribute("height",e),t.style.cssText="position: absolute; left: 0; top: 0; pointer-events: none;",t}function Gn(r="2",e){let t=Sr("circle");return t.setAttribute("r",r),t.setAttribute("fill",e),t}function wr(r){let e=Sr("line");return e.setAttribute("stroke",r),e}function ln(r,e){let t=Sr("rect");return t.setAttribute("stroke",r),t.setAttribute("fill",e),t}function yn(r,e,t){r.setAttribute("cx",`${e}`),r.setAttribute("cy",`${t}`)}function Ne(r,e,t){e&&(r.setAttribute("x1",`${e.x}`),r.setAttribute("y1",`${e.y}`)),t&&(r.setAttribute("x2",`${t.x}`),r.setAttribute("y2",`${t.y}`))}function ae(r,e,t,n,i){r.setAttribute("x",`${e}`),r.setAttribute("y",`${t}`),r.setAttribute("width",`${n}`),r.setAttribute("height",`${i}`)}function Co(){return Promise.resolve()}function Cf(){return new Promise(r=>{requestAnimationFrame(r)})}function Af(r){return parseInt(r.replace("#","0x"),16)}function bf(r,e){let t=parseInt(r.substring(1,3),16),n=parseInt(r.substring(3,5),16),i=parseInt(r.substring(5,7),16),o=Math.round(t*e),a=Math.round(n*e),s=Math.round(i*e);return`#${(1<<24|o<<16|a<<8|s).toString(16).slice(1)}`}function Je(r,e=.85){let t,n,i;if(r.startsWith("#"))t=parseInt(r.substring(1,3),16),n=parseInt(r.substring(3,5),16),i=parseInt(r.substring(5,7),16);else{let a=r.slice(4,-1).split(",");t=parseInt(a[0].trim()),n=parseInt(a[1].trim()),i=parseInt(a[2].trim())}return t=Math.min(Math.floor(t*e),255),n=Math.min(Math.floor(n*e),255),i=Math.min(Math.floor(i*e),255),"#"+((1<<24)+(t<<16)+(n<<8)+i).toString(16).slice(1)}function pi(r,e){r=r.replace(/^#/,"");let t=parseInt(r.substring(0,2),16),n=parseInt(r.substring(2,4),16),i=parseInt(r.substring(4,6),16);return e!==void 0?`rgba(${t}, ${n}, ${i}, ${e})`:`rgb(${t}, ${n}, ${i})`}var Nn=navigator.userAgent.toUpperCase().indexOf("MAC")>=0,Ao=(window.navigator.userAgent||"").toLocaleLowerCase(),Hn=/ios|iphone/i.test(Ao),Sf=/android|adr|linux/gi.test(Ao);function Ln(r){return Nn?r==="Meta":r==="Control"}var bo="__once__",So=class{events=new Map;on(e,t){if(typeof t!="function")return;let n=this.events.get(e);return n?n.add(t):this.events.set(e,new Set([t]))}once(e,t){if(typeof t!="function")return;let n=`${bo}${e}`,i=this.events.get(n);return i?i.add(t):this.events.set(n,new Set([t]))}off(e,t){let n=this.events.get(e),i=this.events.get(`${bo}${e}`);!n&&!i||(t===void 0&&(n?.clear(),i?.clear()),n?.has(t)&&n.delete(t),i?.has(t)&&i.delete(t))}offAll(){this.events.clear()}emit(e,...t){let n=this.events.get(e),i=this.events.get(`${bo}${e}`);!n&&!i||(n?.forEach(o=>{typeof o=="function"&&o(...t)}),i?.forEach(o=>{typeof o=="function"&&o(...t)}),i?.clear())}};var Kn=(t=>(t.SWITCH_FLOOR_BEFORE="switch_floor_before",t.SWITCH_FLOOR_AFTER="switch_floor_after",t))(Kn||{});function Un(r){return Object.keys(r).sort().map(e=>`${e}=${r[e]}`).join("&")}function wf(r,e){return new Promise((t,n)=>{let i=new XMLHttpRequest;i.open("GET",r,!0),Object.keys(e.headers||{}).forEach(o=>{i.setRequestHeader(o,e.headers[o])}),e.responseType&&(i.responseType=e.responseType),i.onload=()=>{if(i.status>=200&&i.status<300)if(e.responseType==="arraybuffer")t(i.response);else try{let o=JSON.parse(i.responseText);t(o)}catch(o){n(o)}else n(i.statusText)},i.onerror=()=>{n(i.statusText)},i.send()})}var $n=require("three"),js=Ar(Fs(),1);function Ws(r,e){let t=r.clone().normalize(),n=e.clone().normalize();return Math.acos(t.dot(n))}function Ef(r){let e=0;return r.reduce(([t,n],[i,o])=>(e+=Math.sqrt((i-t)**2+(o-n)**2),[i,o])),e/r.length}function wo(r,e=.25){if(Ef(r)<e)return r;let t=(0,js.default)(r);return wo(t,e)}function Er(r,e=!1,t=!0,n=5,i=150,o=3){let a=[],s=!e;if(a.push(r[0]),r.length<2)return a;for(let l=0;l<r.length-2;l+=1){let c=r[l],f=r[l+1],p=r[l+2],d=new $n.Vector2(c[0]-f[0],c[1]-f[1]),m=new $n.Vector2(p[0]-f[0],p[1]-f[1]),h=Ws(d,m)/Math.PI*180,g=d.length()+m.length();(!s||h<i&&g>.01||g>n)&&(a.push(r[l+1]),s=!0)}if(a.push(r[r.length-1]),!t)return a;let u=[];u.push(a[0]);for(let l=0;l<a.length-2;l+=1){let c=new $n.Vector2(a[l][0],a[l][1]),f=new $n.Vector2(a[l+1][0],a[l+1][1]),p=new $n.Vector2(a[l+2][0],a[l+2][1]),d=c.distanceTo(f)/2,m=p.distanceTo(f)/2,h=f.clone(),g=f.clone();h.add(c.clone().sub(f).normalize().multiplyScalar(d>o?o/2:d)),g.add(p.clone().sub(f).normalize().multiplyScalar(m>o?o/2:m));let _=[[h.x,h.y],[f.x,f.y],[g.x,g.y]];u.push(...wo(_,o/25))}return u.push(a[a.length-1]),qs(u)}function qs(r){if(r.length<=1)return r;let e=[],t;return r.forEach(([n,i])=>{t?n===t[0]&&i===t[1]||(t=[n,i],e.push([n,i])):(t=[n,i],e.push([n,i]))}),e}function Eo(r,e,t){let n=Math.sqrt((t[0]-e[0])**2+(t[1]-e[1])**2);if(n===0)return{distance:Math.sqrt((r[0]-e[0])**2+(r[1]-e[1])**2),closestPoint:e.slice(0)};let i=Math.max(0,Math.min(1,((r[0]-e[0])*(t[0]-e[0])+(r[1]-e[1])*(t[1]-e[1]))/n**2)),o=[e[0]+i*(t[0]-e[0]),e[1]+i*(t[1]-e[1])];return{distance:Math.sqrt((r[0]-o[0])**2+(r[1]-o[1])**2),closestPoint:o}}function Tf(r,e,t){let[n,i]=r,[o,a]=e,s=Math.sqrt(Math.pow(o-n,2)+Math.pow(a-i,2));if(s===0||s<t)return[...e];let u=t/s,l=n+(o-n)*u,c=i+(a-i)*u;return[l,c]}var To=(l=>(l.START="start",l.END="end",l.FRONT="front",l.RIGHT="right",l.LEFT="left",l.RIGHT_FRONT="right_front",l.LEFT_FRONT="left_front",l.RIGHT_BACK="right_back",l.LEFT_BACK="left_back",l))(To||{});function di(r,e,t){let n=yo(r,e,t);return 180-Math.abs(n)<15?"front":n>135?"right_front":n<-135?"left_front":n<=135&&n>=60?"right":n>=-135&&n<=-60?"left":n<60&&n>0?"right_back":n>-60&&n<0?"left_back":"front"}function Mf(r){if(!r.length)return[];let e=[{direction:"start",distance:Wt(r[0],r[1]),points:[r[0],r[1]]}];for(let t=2;t<r.length;t++){let n=di(r[t-2],r[t-1],r[t]);if(n==="front"){let i=e[e.length-1],o=Wt(r[t-1],r[t]);i.distance+=o,t!==2&&i.points.push(r[t-1])}else e.push({direction:n,distance:Wt(r[t-1],r[t]),points:[r[t-1],r[t]]})}return e.push({direction:"end",distance:0,points:[r[r.length-1]]}),e}function Mo(r,e){if(r.length<2)return-1;let t=0;for(let n=1;n<r.length;n++){let i=r[n-1],o=r[n],a=[e[0]-i[0],e[1]-i[1]],s=[o[0]-i[0],o[1]-i[1]],u=Math.min(o[0],i[0])<=e[0]&&e[0]<=Math.max(o[0],i[0]),l=Math.min(o[1],i[1])<=e[1]&&e[1]<=Math.max(o[1],i[1]);if(u&&l){let c=a[0]*s[1]-a[1]*s[0];if(Math.abs(c)<1e-6){let f=Math.sqrt((e[0]-i[0])**2+(e[1]-i[1])**2);return t+f}}t+=Math.sqrt((o[0]-i[0])**2+(o[1]-i[1])**2)}return-1}function Dn(r,e){if(r.length<2)return r[0]??null;let t=0;for(let n=1;n<r.length;n++){let i=r[n-1],o=r[n],a=Math.sqrt((o[0]-i[0])**2+(o[1]-i[1])**2);if(t+=a,t>=e){let s=(e-(t-a))/a,u=i[0]+(o[0]-i[0])*s,l=i[1]+(o[1]-i[1])*s;return[u,l]}}return null}var tn=Ar(Ro(),1);var Le="___",No=class{constructor(e=3){this.lift_priority=e}roadInfo=[];pointMap=new Map;nodeMap=new Map;facilityMap=new Map;straightLadderMap=new Map;escalatorMap=new Map;staircaseMap=new Map;lineMap=new Map;baseRoute=new tn.default;escalatorRoute=new tn.default;straightLadderRoute=new tn.default;initRoute(e){this.clear(),this.roadInfo=e,e.length&&(e.forEach(t=>{t.points.forEach(n=>{let i=`${t.floor}${Le}${n.id}`;if(this.pointMap.set(i,n),this.nodeMap.set(`${n.floor}${Le}${n.nodeId}`,i),n.type==="straightLadder"){let o=this.straightLadderMap.get(n.name)||[];o.push({...n}),this.straightLadderMap.set(n.name,o)}if(n.type==="staircase"){let o=this.staircaseMap.get(n.name)||[];o.push({...n}),this.staircaseMap.set(n.name,o)}if(n.type==="escalator"){let o=this.escalatorMap.get(n.name)||{};n.escalatorDirection==="exit"?o.end={floor:n.floor,id:n.id}:o.start={floor:n.floor,id:n.id},this.escalatorMap.set(n.name,o)}if(n.type==="facility"){let o=this.facilityMap.get(n.targetId)||[];o.push({...n}),this.facilityMap.set(n.targetId,o)}}),t.lines.filter(n=>n.direction!=="no").forEach(n=>{let i=`${t.floor}${Le}${n.from}`,o=`${t.floor}${Le}${n.to}`,a=this.pointMap.get(i)?.cds,s=this.pointMap.get(o)?.cds;if(a?.length&&s?.length){let u=Wt(a,s);this.addLineItem(i,o,u),n.direction==="double"&&this.addLineItem(o,i,u)}})}),this.initBaseRoute(),this.initEscalatorRoute(),this.initStraightLadderRoute())}addLineItem(e,t,n,i=this.lineMap){let o=i.get(e)||new Map;o.set(t,n),i.set(e,o)}addFacilityToLineMap(e,t,n,i){[...this.straightLadderMap,...this.staircaseMap].forEach(([o,a])=>{if(!(a.length<2))for(let s=0;s<a.length;s++){let u=`${a[s].floor}${Le}${a[s].id}`;for(let l=0;l<a.length;l++)if(s!==l){let c=`${a[l].floor}${Le}${a[l].id}`,f=this.pointMap.get(u)?.cds,p=this.pointMap.get(c)?.cds;if(f?.length&&p?.length)if(a[s].type==="straightLadder"){let d=t;this.addLineItem(u,c,d,i)}else{let d=n;this.addLineItem(u,c,d,i)}}}}),this.escalatorMap.forEach((o,a)=>{if(o.start&&o.end){let s=`${o.start.floor}${Le}${o.start.id}`,u=`${o.end.floor}${Le}${o.end.id}`,l=this.pointMap.get(s)?.cds,c=this.pointMap.get(u)?.cds;if(l?.length&&c?.length){let f=e;this.addLineItem(s,u,f,i)}}})}initBaseRoute(){let e=new Map([...this.lineMap]);this.addFacilityToLineMap(1,this.lift_priority,3e4,e),this.baseRoute=new tn.default(e)}initEscalatorRoute(){let e=new Map([...this.lineMap]),t=1e4;this.addFacilityToLineMap(1*t,this.lift_priority*t,3e4*t,e),this.escalatorRoute=new tn.default(e)}initStraightLadderRoute(){let e=new Map([...this.lineMap]),t=1e4;this.addFacilityToLineMap(3*t,1*t,3e4*t,e),this.straightLadderRoute=new tn.default(e)}checkStart(e){return!(!e.floor||!e.nodeId&&(!e.coord||e.coord.length<2))}checkEnd(e){return e.facility?!0:this.checkStart(e)}transformStart(e){if(e.nodeId){let t=this.nodeMap.get(`${e.floor}${Le}${e.nodeId}`);if(t){let[n,i]=t.split(Le);return{floor:n,id:i}}}if(e.coord?.length){let t=this.roadInfo.find(i=>i.floor===e.floor);if(!t)return null;let n=t.points.reduce((i,o)=>{let a=Wt(e.coord,o.cds);return a<i.min&&(i.min=a,i.point=o),i},{min:1/0,point:t.points[0]});return{floor:n.point.floor,id:n.point.id}}return null}transformEnd(e){if(e.floor){let t=this.transformStart(e);if(t)return t}return e.facility&&this.facilityMap.get(e.facility)?.length?{floor:e.floor,facility:e.facility}:null}getPath(e,t,n=""){if(!this.checkStart(e))return"start-error";if(!this.checkEnd(t))return"end-error";let i=this.transformStart(e);if(!i)return"no-start";let o=this.transformEnd(t);if(!o)return"no-end";let a=this.getBasePath.bind(this);switch(n){case"escalator":a=this.getEscalatorPath.bind(this);break;case"straightLadder":a=this.getStraightLadderPath.bind(this);break;default:a=this.getBasePath.bind(this);break}if(o.id)return a(i,o);if(o.facility){let s=this.facilityMap.get(o.facility).filter(l=>o.floor?l.floor===o.floor:!0);if(!s.length)return null;let u=s.map(l=>a(i,{floor:l.floor,id:l.id})).filter(l=>!!l);return u.reduce((l,c)=>{let f=c.reduce((p,d)=>p+Re(d.points),0);return f<l.distance&&(l.distance=f,l.path=c),l},{distance:1/0,path:u[0]}).path}}getRoutePath(e,t,n){let i=`${e.floor}${Le}${e.id}`,o=`${t.floor}${Le}${t.id}`,a=n.path(i,o);if(!a)return null;let s=[];return a.map(u=>{let l=this.pointMap.get(u);if(l){let{floor:c}=l;if(s[s.length-1]?.floor===c){let f=s[s.length-1];f.points.push(l.cds),f.endType=l.type,f.destId=l.nodeId,f.distance=Re(f.points)}else s.push({floor:c,points:[l.cds],endType:l.type,destId:l.nodeId,distance:0})}}),s}getBasePath(e,t){return this.getRoutePath(e,t,this.baseRoute)}getEscalatorPath(e,t){return this.getRoutePath(e,t,this.escalatorRoute)}getStraightLadderPath(e,t){return this.getRoutePath(e,t,this.straightLadderRoute)}clear(){this.roadInfo=[],this.pointMap.clear(),this.nodeMap.clear(),this.facilityMap.clear(),this.straightLadderMap.clear(),this.escalatorMap.clear(),this.staircaseMap.clear(),this.lineMap.clear(),this.baseRoute=new tn.default,this.escalatorRoute=new tn.default,this.straightLadderRoute=new tn.default}};var se=Ar(Ro(),1);var _n=require("lodash"),Et="___",Lo=class{constructor(e=3){this.lift_priority=e}roadInfo=[];facilities=[];pointMap=new Map;nodeMap=new Map;facilityMap=new Map;straightLadderMap=new Map;escalatorMap=new Map;rampMap=new Map;staircaseMap=new Map;parkingMap=new Map;lineMap=new Map;baseRoute=new se.default;escalatorRoute=new se.default;straightLadderRoute=new se.default;forwardLineMap=new Map;forwardRoute=new se.default;isFacilityByType(e){return["facility","escalator","straightLadder","staircase","ramp"].includes(e)}initFacilities(e){this.facilities=e.map(t=>{let n=[];try{n=JSON.parse(t.entry_end_floor)}catch{n=[]}let i=[];try{i=JSON.parse(t.entry_start_floor)}catch{i=[]}return{...t,entry_start_floor:i,entry_end_floor:n}})}initRoute(e,t){this.clear(),this.roadInfo=e,this.initFacilities(t);let n=new Date,i=n.getHours()*60+n.getMinutes();e.length&&(e.forEach(o=>{(o.points||[]).filter(a=>a.openStatus!==!1).filter(a=>{if(!a.startTime||!a.endTime)return!0;let[s,u]=a.startTime.split(":").map(d=>+d),[l,c]=a.endTime.split(":").map(d=>+d),f=s*60+u,p=l*60+c;return i>=f&&i<=p}).forEach(a=>{a.floor=o.floor;let s=`${o.floor}${Et}${a.id}`;if(this.nodeMap.set(`${o.floor}${Et}${a.nodeId}`,`${o.floor}${Et}${a.relatedId||a.id}`),this.pointMap.set(s,a),this.isFacilityByType(a.type)){let u=this.facilities.find(l=>l.id===+a.targetId);if(u){switch(u.entry_infra_type){case"straightLadder":if(u.entry_end_floor.find(p=>p.floor===o.floor)&&u.entry_start_floor.find(p=>p.floor===o.floor)){let p=this.straightLadderMap.get(a.targetId)||[];p.push({...a}),this.straightLadderMap.set(a.targetId,p)}break;case"staircase":if(u.entry_end_floor.find(p=>p.floor===o.floor)&&u.entry_start_floor.find(p=>p.floor===o.floor)){let p=this.staircaseMap.get(a.targetId)||[];p.push({...a}),this.staircaseMap.set(a.targetId,p)}break;case"escalator":let c=this.escalatorMap.get(a.targetId)||[];if(u.entry_start_floor.find(p=>p.floor===o.floor)){let p=c.find(d=>d.end?.floor!==o.floor&&!d.start);p?p.start=a:c.push({start:a})}if(u.entry_end_floor.find(p=>p.floor===o.floor)){let p=c.find(d=>d.start?.floor!==o.floor&&!d.end);p?p.end=a:c.push({end:a})}this.escalatorMap.set(a.targetId,c);break;case"ramp":let f=this.rampMap.get(a.targetId)||[];if(u.entry_start_floor.find(p=>p.floor===o.floor)){let p=f.find(d=>d.end?.floor!==o.floor&&!d.start);p?p.start=a:f.push({start:a})}if(u.entry_end_floor.find(p=>p.floor===o.floor)){let p=f.find(d=>d.start?.floor!==o.floor&&!d.end);p?p.end=a:f.push({end:a})}this.rampMap.set(a.targetId,f);break}let l=this.facilityMap.get(a.targetId)||[];l.push({...a}),this.facilityMap.set(a.targetId,l)}}a.type==="parkingSpace"&&this.parkingMap.set(`${o.floor}${Et}${a.name}`,a)}),(o.lines||[]).filter(a=>a.direction!=="no").forEach(a=>{let s=`${o.floor}${Et}${a.from}`,u=`${o.floor}${Et}${a.to}`,l=this.pointMap.get(s),c=this.pointMap.get(u);if(!l||!c)return;let f=l.cds,p=c.cds,d=Wt(f,p);if(!l.permission&&!c.permission)switch(this.addLineItem(s,u,d),this.addLineItem(u,s,d),a.direction){case"double":this.addLineItem(s,u,d,this.forwardLineMap),this.addLineItem(u,s,d,this.forwardLineMap);break;case"single":this.addLineItem(s,u,d,this.forwardLineMap);break;case"back":this.addLineItem(u,s,d,this.forwardLineMap);break}else l.permission&&(this.setPermissionLine(s,u,l.permission,d,""),this.setPermissionLine(u,s,l.permission,d,"")),c.permission&&c.permission!==l.permission&&(this.setPermissionLine(s,u,c.permission,d,""),this.setPermissionLine(u,s,c.permission,d,""))})}),this.addPermissionFacility(),this.initBaseRoute(),this.initEscalatorRoute(),this.initStraightLadderRoute(),this.initForwardRoute())}getPermissionMap(e){return this[`permission_${e}`]||(this[`permission_${e}`]=new Set),this[`permission_${e}`]}setPermissionLine(e,t,n,i,o){this.getPermissionMap(n).add({fromKey:e,toKey:t,distance:i,type:o})}addPermissionFacility(){this.straightLadderMap.forEach((e,t)=>{if(e.length<2){this.straightLadderMap.delete(t);return}for(let n=0;n<e.length;n++){let i=`${e[n].floor}${Et}${e[n].id}`,o=this.pointMap.get(i);if(o){for(let a=0;a<e.length;a++)if(n!==a){let s=`${e[a].floor}${Et}${e[a].id}`,u=this.pointMap.get(s);if(!u)continue;o.permission&&this.setPermissionLine(i,s,o.permission,1,"straightLadder"),u.permission&&u.permission!==o.permission&&this.setPermissionLine(i,s,u.permission,1,"straightLadder")}}}}),this.staircaseMap.forEach((e,t)=>{if(e.length<2){this.staircaseMap.delete(t);return}for(let n=0;n<e.length;n++){let i=`${e[n].floor}${Et}${e[n].id}`,o=this.pointMap.get(i);if(o){for(let a=0;a<e.length;a++)if(n!==a){let s=`${e[a].floor}${Et}${e[a].id}`,u=this.pointMap.get(s);if(!u)continue;o.permission&&this.setPermissionLine(i,s,o.permission,1,"staircase"),u.permission&&u.permission!==o.permission&&this.setPermissionLine(i,s,u.permission,1,"straightLadder")}}}}),this.escalatorMap.forEach((e,t)=>{e.forEach(n=>{if(n.start&&n.end){let i=`${n.start.floor}${Et}${n.start.id}`,o=`${n.end.floor}${Et}${n.end.id}`,a=this.pointMap.get(i),s=this.pointMap.get(o);a&&s&&(a.permission&&this.setPermissionLine(i,o,a.permission,1,"escalator"),s.permission&&s.permission!==a.permission&&this.setPermissionLine(i,o,s.permission,1,"escalator"))}})}),this.rampMap.forEach((e,t)=>{e.forEach(n=>{if(n.start&&n.end){let i=`${n.start.floor}${Et}${n.start.id}`,o=`${n.end.floor}${Et}${n.end.id}`,a=this.pointMap.get(i),s=this.pointMap.get(o);a&&s&&(a.permission&&this.setPermissionLine(i,o,a.permission,10,"ramp"),s.permission&&s.permission!==a.permission&&this.setPermissionLine(i,o,s.permission,10,"ramp"))}})})}addPermissionLineToMap(e,t,n,i){let o=this.getPermissionMap(e);console.log(o),o.forEach(a=>{t.includes(a.type)&&(a.type===""?this.addLineItem(a.fromKey,a.toKey,a.distance,n):this.addLineItem(a.fromKey,a.toKey,i.get(a.type),n))})}addLineItem(e,t,n,i=this.lineMap){let o=i.get(e)||new Map;o.set(t,n),i.set(e,o)}addFacilityToLineMap(e,t,n,i){[...this.straightLadderMap,...this.staircaseMap].forEach(([o,a])=>{if(!(a.length<2))for(let s=0;s<a.length;s++){let u=`${a[s].floor}${Et}${a[s].id}`,l=this.pointMap.get(u);if(!(!l||l.permission)){for(let c=0;c<a.length;c++)if(s!==c){let f=`${a[c].floor}${Et}${a[c].id}`,p=this.pointMap.get(f);if(!p||p.permission)continue;if(a[s].type==="straightLadder"){let d=t;this.addLineItem(u,f,d,i)}else{let d=n;this.addLineItem(u,f,d,i)}}}}}),this.escalatorMap.forEach((o,a)=>{o.forEach(s=>{if(s.start&&s.end){let u=`${s.start.floor}${Et}${s.start.id}`,l=`${s.end.floor}${Et}${s.end.id}`,c=this.pointMap.get(u),f=this.pointMap.get(l);if(c&&f&&!c.permission&&!f.permission){let p=e;this.addLineItem(u,l,p,i)}}})})}initBaseRoute(){let e=new Map((0,_n.cloneDeep)([...this.lineMap]));this.addFacilityToLineMap(100,100+this.lift_priority,3e4,e),this.baseRoute=new se.default(e)}initEscalatorRoute(){let e=new Map((0,_n.cloneDeep)([...this.lineMap])),t=1e4;this.addFacilityToLineMap(1*t,this.lift_priority*t,3e4*t,e),this.escalatorRoute=new se.default(e)}initStraightLadderRoute(){let e=new Map((0,_n.cloneDeep)([...this.lineMap])),t=1e4;this.addFacilityToLineMap(3*t,1*t,3e4*t,e),this.straightLadderRoute=new se.default(e)}initForwardRoute(){this.rampMap.forEach((e,t)=>{e.forEach(n=>{if(n.start&&n.end){let i=`${n.start.floor}${Et}${n.start.id}`,o=`${n.end.floor}${Et}${n.end.id}`,a=this.pointMap.get(i),s=this.pointMap.get(o);a&&s&&!a.permission&&!s.permission&&this.addLineItem(i,o,10,this.forwardLineMap)}})}),this.forwardRoute=new se.default(this.forwardLineMap)}checkStart(e){return!(!e.floor||!e.nodeId&&(!e.coord||e.coord.length<2))}checkEnd(e){return e.facility||e.parkingSpace&&e.floor?!0:this.checkStart(e)}transformStart(e){if(e.nodeId){let t=this.nodeMap.get(`${e.floor}${Et}${e.nodeId}`);if(t){let[n,i]=t.split(Et);return{floor:n,id:i}}}if(e.coord?.length){let t=this.roadInfo.find(i=>i.floor===e.floor);if(!t)return null;let n=t.points.reduce((i,o)=>{if(o.relatedId)return i;let a=Wt(e.coord,o.cds);return a<i.min&&(i.min=a,i.point=o),i},{min:1/0,point:t.points[0]});return{floor:t.floor,id:n.point.id}}return null}transformEnd(e){if(e.floor){if(e.parkingSpace){let n=this.parkingMap.get(`${e.floor}${Et}${e.parkingSpace}`);if(n)return{floor:e.floor,id:n.id}}let t=this.transformStart(e);if(t)return t}return e.facility&&this.facilities.filter(i=>+i.type_id==+e.facility).map(i=>i.id).map(i=>this.facilityMap.get(`${i}`)).flat(2)?.length?{floor:e.floor,facility:e.facility}:null}getPath(e,t,n="",i){if(!this.checkStart(e))return"start-error";if(!this.checkEnd(t))return"end-error";let o=this.transformStart(e);if(!o)return"no-start";let a=this.transformEnd(t);if(!a)return"no-end";let s=this.getBasePath.bind(this);switch(n){case"escalator":s=this.getEscalatorPath.bind(this);break;case"straightLadder":s=this.getStraightLadderPath.bind(this);break;case"forward":s=this.getForwardPath.bind(this);break;default:s=this.getBasePath.bind(this);break}if(a.id)return s(o,a,i);if(a.facility){let l=this.facilities.filter(f=>+f.type_id==+t.facility).map(f=>f.id).map(f=>this.facilityMap.get(`${f}`)).flat(2).filter(f=>f).filter(f=>a.floor?f.floor===a.floor:!0);if(!l.length)return null;let c=l.map(f=>s(o,{floor:f.floor,id:f.id},i)).filter(f=>!!f);return c.reduce((f,p)=>{let d=p[0].consume;return d<f.distance&&(f.distance=d,f.path=p),f},{distance:1/0,path:c[0]}).path}}getRoutePath(e,t,n){let i=`${e.floor}${Et}${e.id}`,o=`${t.floor}${Et}${t.id}`,a=n.path(i,o);if(!a)return null;let s=[],u=a.reduce((l,c,f,p)=>{if(f===0)return 0;let d=p[f-1],m=n.graph.get(d).get(c);return l+m},0);return a.map(l=>{let c=this.pointMap.get(l);if(c){let{floor:f}=c,p=c.type;if(this.isFacilityByType(c.type)){let d=this.facilities.find(m=>m.id===+c.targetId);d&&(p=d.entry_infra_type)}if(s[s.length-1]?.floor===f){let d=s[s.length-1];d.points.push(c.cds),d.endType=p,d.destId=c.nodeId,d.distance=Re(d.points)}else s.push({floor:f,points:[c.cds],endType:p,destId:c.nodeId,distance:0,consume:u})}}),s}getBasePath(e,t,n){if(!n)return this.getRoutePath(e,t,this.baseRoute);let i=(0,_n.cloneDeep)(this.baseRoute.graph);this.addPermissionLineToMap(n,["","escalator","staircase","straightLadder"],i,new Map([["escalator",100],["straightLadder",100+this.lift_priority],["staircase",3e4]]));let o=new se.default(i);return this.getRoutePath(e,t,o)}getEscalatorPath(e,t,n){if(!n)return this.getRoutePath(e,t,this.escalatorRoute);let i=(0,_n.cloneDeep)(this.escalatorRoute.graph),o=1e4;this.addPermissionLineToMap(n,["","escalator","staircase","straightLadder"],i,new Map([["escalator",1*o],["straightLadder",this.lift_priority*o],["staircase",3e4*o]]));let a=new se.default(i);return this.getRoutePath(e,t,a)}getStraightLadderPath(e,t,n){if(!n)return this.getRoutePath(e,t,this.straightLadderRoute);let i=(0,_n.cloneDeep)(this.straightLadderRoute.graph),o=1e4;this.addPermissionLineToMap(n,["","escalator","staircase","straightLadder"],i,new Map([["escalator",3*o],["straightLadder",1*o],["staircase",3e4*o]]));let a=new se.default(i);return this.getRoutePath(e,t,a)}getForwardPath(e,t,n){if(!n)return this.getRoutePath(e,t,this.forwardRoute);let i=(0,_n.cloneDeep)(this.forwardRoute.graph);this.addPermissionLineToMap(n,["","ramp"],i,new Map([["ramp",10]]));let o=new se.default(i);return this.getRoutePath(e,t,o)}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 se.default,this.escalatorRoute=new se.default,this.straightLadderRoute=new se.default}};var On=class{static keySet=new Set;static createKey(){return Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)}static genUniqueKey(){let e=this.createKey();for(;this.keySet.has(e);)e=this.createKey();return e}static removeKey(e){this.keySet.delete(e)}static dispose(){this.keySet.clear()}};function Uo(r){return r.replace(/[A-Z]/g,e=>"_"+e.toLowerCase()).replace(/^_/,"")}function je(r,e,t){return new Promise((n,i)=>{let o=On.genUniqueKey(),a=({data:s})=>{s.type===`${e}_result`&&s.key===o&&(On.removeKey(o),self.removeEventListener("message",a),s.error?i(s.error):n(s.data))};r.addEventListener("message",a),r.postMessage({type:e,key:o,data:t})})}function Nf(r){let e={};for(let n in r)n.startsWith("on")&&(e[Uo(n.slice(2))]=r[n]);let t=async({data:n})=>{if(e[n.type])try{let i=await e[n.type](n.data);self.postMessage({type:`${n.type}_result`,key:n.key,data:i})}catch(i){self.postMessage({type:`${n.type}_result`,key:n.key,error:i})}else self.postMessage({type:`${n.type}_result`,key:n.key,error:"no_event"})};return self.addEventListener("message",t),()=>{self.removeEventListener("message",t)}}var We=require("three");function Lf(r,e=16711680){let t=new We.LineBasicMaterial({color:e}),n=new We.BufferGeometry().setFromPoints(r);return new We.Line(n,t)}function Uf(r,e=16711680){let t=new We.LineBasicMaterial({color:e}),n=new We.BoxGeometry(1,1,1),i=new We.Mesh(n,t);return i.position.copy(r),i}function _e(r,e,t=0){r.forEach(n=>{n.geometry.coords=JSON.parse(JSON.stringify(n.geometry.cds)),n.geometry.type==="polygon"?(n.geometry.coords.map(i=>{Array.isArray(i)&&i.forEach(o=>{o[0]-=e[0],o[1]-=e[1]})}),n.geometry.otherCds&&(n.geometry.otherCoords=n.geometry.otherCds.map(i=>i.map(o=>Ue(o,e)))),n.doors?.length&&n.doors.map(i=>{i.coord=Ue(i.coordinate,e)}),n.center&&(n.center=Ue(n.center,e))):n.geometry.coords=Ue(n.geometry.cds,e)});for(let n=0;n<r.length;n++){let i=r[n];i.deltaHeight=1e-5*(t+n+1)}}function Ue(r,e){return[r[0]-e[0],r[1]-e[1]]}var au=require("@tweenjs/tween.js"),cn=class{pauseTween=!1;tweenStore=new Set;group=new au.Group;constructor(){}update(){this.group.update()}pause(){this.pauseTween=!0,this.getAll().forEach(e=>{this.tweenStore.add(e),e.pause()})}continue(){this.pauseTween&&(this.tweenStore.forEach(e=>{e.resume()}),this.tweenStore.clear(),this.pauseTween=!1)}remove(e){this.group.remove(e)}getAll(){return this.group.getAll()}clear(){this.getAll().forEach(e=>e.stop()),this.group.removeAll()}dispose(){this.clear()}};var vt=require("three");var wu=require("three");var it=require("three");var uu=require("three/examples/jsm/lines/LineMaterial"),he=require("three");function su(r){return`${r.x}-${r.y}-${r.z}`}var qt=class{static lineMaterialMap=new Map;static meshStandardMaterialMap=new Map;static meshBasicMaterialMap=new Map;static shaderMaterialMap=new Map;static line2MaterialMap=new Map;static generateLineMaterialKey({color:e,opacity:t}){return`${e}-${t}`}static createLineMaterial({color:e,opacity:t}){let n=this.generateLineMaterialKey({color:e,opacity:t});if(this.lineMaterialMap.has(n))return this.lineMaterialMap.get(n);let i=new he.LineBasicMaterial({color:new he.Color(e).convertLinearToSRGB(),transparent:!0,opacity:t});return this.lineMaterialMap.set(n,i),i}static createMeshStandardMaterial({color:e,opacity:t}){let n=`${e}-${t}`;if(this.meshStandardMaterialMap.has(n))return this.meshStandardMaterialMap.get(n);let i=new he.MeshStandardMaterial({color:new he.Color(e).convertLinearToSRGB(),roughness:1,transparent:!0,opacity:t,depthWrite:!0});return this.meshStandardMaterialMap.set(n,i),i}static createMeshBasicMaterial({color:e,opacity:t}){let n=`${e}-${t}`;if(this.meshBasicMaterialMap.has(n))return this.meshBasicMaterialMap.get(n);let i=new he.MeshBasicMaterial({color:e,transparent:!0,opacity:t,depthWrite:!0});return this.meshBasicMaterialMap.set(n,i),i}static createShaderMaterial({gradualColor:e,center:t,maxValue:n,opacity:i,direction:o,max:a,min:s}){let u=`${e.toString()}-${su(t)}-${n}-${i}-${su(o)}`;if(this.shaderMaterialMap.has(u))return this.shaderMaterialMap.get(u);let l=`
1
+ "use strict";var ff=Object.create;var fi=Object.defineProperty;var pf=Object.getOwnPropertyDescriptor;var df=Object.getOwnPropertyNames;var mf=Object.getPrototypeOf,gf=Object.prototype.hasOwnProperty;var gn=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),yf=(r,e)=>{for(var t in e)fi(r,t,{get:e[t],enumerable:!0})},zs=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of df(e))!gf.call(r,i)&&i!==t&&fi(r,i,{get:()=>e[i],enumerable:!(n=pf(e,i))||n.enumerable});return r};var Ar=(r,e,t)=>(t=r!=null?ff(mf(r)):{},zs(e||!r||!r.__esModule?fi(t,"default",{value:r,enumerable:!0}):t,r)),_f=r=>zs(fi({},"__esModule",{value:!0}),r);var ks=gn((dy,Bs)=>{Bs.exports=function(e,t){return e[0]=t[0],e[1]=t[1],e}});var Fs=gn((my,Vs)=>{var Xs=ks();Vs.exports=function(r,e){Array.isArray(e)||(e=[]),r.length>0&&e.push(Xs([0,0],r[0]));for(var t=0;t<r.length-1;t++){var n=r[t],i=r[t+1],o=n[0],a=n[1],s=i[0],u=i[1],l=[.75*o+.25*s,.75*a+.25*u],c=[.25*o+.75*s,.25*a+.75*u];e.push(l),e.push(c)}return r.length>1&&e.push(Xs([0,0],r[r.length-1])),e}});var Zs=gn((_y,Ys)=>{var Po=class{constructor(){this.keys=new Set,this.queue=[]}sort(){this.queue.sort((e,t)=>e.priority-t.priority)}set(e,t){let n=Number(t);if(isNaN(n))throw new TypeError('"priority" must be a number');return this.keys.has(e)?this.queue.map(i=>(i.key===e&&Object.assign(i,{priority:n}),i)):(this.keys.add(e),this.queue.push({key:e,priority:n})),this.sort(),this.queue.length}next(){let e=this.queue.shift();return this.keys.delete(e.key),e}isEmpty(){return this.queue.length===0}has(e){return this.keys.has(e)}get(e){return this.queue.find(t=>t.key===e)}};Ys.exports=Po});var Hs=gn((vy,Gs)=>{function Qs(r,e){let t=new Map;for(let[n,i]of r)n!==e&&i instanceof Map?t.set(n,Qs(i,e)):n!==e&&t.set(n,i);return t}Gs.exports=Qs});var Js=gn((xy,$s)=>{function Pf(r){let e=Number(r);return!(isNaN(e)||e<=0)}function Ks(r){let e=new Map;return Object.keys(r).forEach(n=>{let i=r[n];if(i!==null&&typeof i=="object"&&!Array.isArray(i))return e.set(n,Ks(i));if(!Pf(i))throw new Error(`Could not add node at key "${n}", make sure it's a valid node`,i);return e.set(n,Number(i))}),e}$s.exports=Ks});var nu=gn((Cy,eu)=>{function tu(r){if(!(r instanceof Map))throw new Error(`Invalid graph: Expected Map instead found ${typeof r}`);r.forEach((e,t)=>{if(typeof e=="object"&&e instanceof Map){tu(e);return}if(typeof e!="number"||e<=0)throw new Error(`Values must be numbers greater than 0. Found value ${e} at ${t}`)})}eu.exports=tu});var Ro=gn((Ay,ou)=>{var If=Zs(),Rf=Hs(),ru=Js(),iu=nu(),Io=class{constructor(e){e instanceof Map?(iu(e),this.graph=e):e?this.graph=ru(e):this.graph=new Map}addNode(e,t){let n;return t instanceof Map?(iu(t),n=t):n=ru(t),this.graph.set(e,n),this}addVertex(e,t){return this.addNode(e,t)}removeNode(e){return this.graph=Rf(this.graph,e),this}path(e,t,n={}){if(!this.graph.size)return n.cost?{path:null,cost:0}:null;let i=new Set,o=new If,a=new Map,s=[],u=0,l=[];if(n.avoid&&(l=[].concat(n.avoid)),l.includes(e))throw new Error(`Starting node (${e}) cannot be avoided`);if(l.includes(t))throw new Error(`Ending node (${t}) cannot be avoided`);for(o.set(e,0);!o.isEmpty();){let c=o.next();if(c.key===t){u=c.priority;let p=c.key;for(;a.has(p);)s.push(p),p=a.get(p);break}i.add(c.key),(this.graph.get(c.key)||new Map).forEach((p,d)=>{if(i.has(d)||l.includes(d))return null;if(!o.has(d))return a.set(d,c.key),o.set(d,c.priority+p);let m=o.get(d).priority,h=c.priority+p;return h<m?(a.set(d,c.key),o.set(d,h)):null})}return s.length?(n.trim?s.shift():s=s.concat([e]),n.reverse||(s=s.reverse()),n.cost?{path:s,cost:u}:s):n.cost?{path:null,cost:0}:null}shortestPath(...e){return this.path(...e)}};ou.exports=Io});var ra=gn((ea,na)=>{(function(r,e){typeof ea=="object"&&typeof na<"u"?na.exports=e():typeof define=="function"&&define.amd?define(e):(r=typeof globalThis<"u"?globalThis:r||self,r["'typed'"]=e())})(ea,function(){"use strict";function r(){return!0}function e(){return!1}function t(){}let n="Argument is not a typed-function.";function i(){function a(b){return typeof b=="object"&&b!==null&&b.constructor===Object}let s=[{name:"number",test:function(b){return typeof b=="number"}},{name:"string",test:function(b){return typeof b=="string"}},{name:"boolean",test:function(b){return typeof b=="boolean"}},{name:"Function",test:function(b){return typeof b=="function"}},{name:"Array",test:Array.isArray},{name:"Date",test:function(b){return b instanceof Date}},{name:"RegExp",test:function(b){return b instanceof RegExp}},{name:"Object",test:a},{name:"null",test:function(b){return b===null}},{name:"undefined",test:function(b){return b===void 0}}],u={name:"any",test:r,isAny:!0},l,c,f=0,p={createCount:0};function d(b){let T=l.get(b);if(T)return T;let I='Unknown type "'+b+'"',v=b.toLowerCase(),P;for(P of c)if(P.toLowerCase()===v){I+='. Did you mean "'+P+'" ?';break}throw new TypeError(I)}function m(b){let T=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"any",I=T?d(T).index:c.length,v=[];for(let U=0;U<b.length;++U){if(!b[U]||typeof b[U].name!="string"||typeof b[U].test!="function")throw new TypeError("Object with properties {name: string, test: function} expected");let V=b[U].name;if(l.has(V))throw new TypeError('Duplicate type name "'+V+'"');v.push(V),l.set(V,{name:V,test:b[U].test,isAny:b[U].isAny,index:I+U,conversionsTo:[]})}let P=c.slice(I);c=c.slice(0,I).concat(v).concat(P);for(let U=I+v.length;U<c.length;++U)l.get(c[U]).index=U}function h(){l=new Map,c=[],f=0,m([u],!1)}h(),m(s);function g(){let b;for(b of c)l.get(b).conversionsTo=[];f=0}function _(b){let T=c.filter(I=>{let v=l.get(I);return!v.isAny&&v.test(b)});return T.length?T:["any"]}function A(b){return b&&typeof b=="function"&&"_typedFunctionData"in b}function y(b,T,I){if(!A(b))throw new TypeError(n);let v=I&&I.exact,P=Array.isArray(T)?T.join(","):T,U=R(P),V=C(U);if(!v||V in b.signatures){let gt=b._typedFunctionData.signatureMap.get(V);if(gt)return gt}let k=U.length,W;if(v){W=[];let gt;for(gt in b.signatures)W.push(b._typedFunctionData.signatureMap.get(gt))}else W=b._typedFunctionData.signatures;for(let gt=0;gt<k;++gt){let _t=U[gt],Ut=[],It;for(It of W){let wt=F(It.params,gt);if(!(!wt||_t.restParam&&!wt.restParam)){if(!wt.hasAny){let oe=M(wt);if(_t.types.some($t=>!oe.has($t.name)))continue}Ut.push(It)}}if(W=Ut,W.length===0)break}let X;for(X of W)if(X.params.length<=k)return X;throw new TypeError("Signature not found (signature: "+(b.name||"unnamed")+"("+C(U,", ")+"))")}function S(b,T,I){return y(b,T,I).implementation}function x(b,T){let I=d(T);if(I.test(b))return b;let v=I.conversionsTo;if(v.length===0)throw new Error("There are no conversions to "+T+" defined.");for(let P=0;P<v.length;P++)if(d(v[P].from).test(b))return v[P].convert(b);throw new Error("Cannot convert "+b+" to "+T)}function C(b){let T=arguments.length>1&&arguments[1]!==void 0?arguments[1]:",";return b.map(I=>I.name).join(T)}function w(b){let T=b.indexOf("...")===0,v=(T?b.length>3?b.slice(3):"any":b).split("|").map(k=>d(k.trim())),P=!1,U=T?"...":"";return{types:v.map(function(k){return P=k.isAny||P,U+=k.name+"|",{name:k.name,typeIndex:k.index,test:k.test,isAny:k.isAny,conversion:null,conversionIndex:-1}}),name:U.slice(0,-1),hasAny:P,hasConversion:!1,restParam:T}}function E(b){let T=b.types.map(V=>V.name),I=dt(T),v=b.hasAny,P=b.name,U=I.map(function(V){let k=d(V.from);return v=k.isAny||v,P+="|"+V.from,{name:V.from,typeIndex:k.index,test:k.test,isAny:k.isAny,conversion:V,conversionIndex:V.index}});return{types:b.types.concat(U),name:P,hasAny:v,hasConversion:U.length>0,restParam:b.restParam}}function M(b){return b.typeSet||(b.typeSet=new Set,b.types.forEach(T=>b.typeSet.add(T.name))),b.typeSet}function R(b){let T=[];if(typeof b!="string")throw new TypeError("Signatures must be strings");let I=b.trim();if(I==="")return T;let v=I.split(",");for(let P=0;P<v.length;++P){let U=w(v[P].trim());if(U.restParam&&P!==v.length-1)throw new SyntaxError('Unexpected rest parameter "'+v[P]+'": only allowed for the last parameter');if(U.types.length===0)return null;T.push(U)}return T}function N(b){let T=kt(b);return T?T.restParam:!1}function D(b){if(!b||b.types.length===0)return r;if(b.types.length===1)return d(b.types[0].name).test;if(b.types.length===2){let T=d(b.types[0].name).test,I=d(b.types[1].name).test;return function(P){return T(P)||I(P)}}else{let T=b.types.map(function(I){return d(I.name).test});return function(v){for(let P=0;P<T.length;P++)if(T[P](v))return!0;return!1}}}function q(b){let T,I,v;if(N(b)){T=zt(b).map(D);let P=T.length,U=D(kt(b)),V=function(k){for(let W=P;W<k.length;W++)if(!U(k[W]))return!1;return!0};return function(W){for(let X=0;X<T.length;X++)if(!T[X](W[X]))return!1;return V(W)&&W.length>=P+1}}else return b.length===0?function(U){return U.length===0}:b.length===1?(I=D(b[0]),function(U){return I(U[0])&&U.length===1}):b.length===2?(I=D(b[0]),v=D(b[1]),function(U){return I(U[0])&&v(U[1])&&U.length===2}):(T=b.map(D),function(U){for(let V=0;V<T.length;V++)if(!T[V](U[V]))return!1;return U.length===T.length})}function F(b,T){return T<b.length?b[T]:N(b)?kt(b):null}function j(b,T){let I=F(b,T);return I?M(I):new Set}function O(b){return b.conversion===null||b.conversion===void 0}function Y(b,T){let I=new Set;return b.forEach(v=>{let P=j(v.params,T),U;for(U of P)I.add(U)}),I.has("any")?["any"]:Array.from(I)}function G(b,T,I){let v,P,U=b||"unnamed",V=I,k;for(k=0;k<T.length;k++){let _t=[];if(V.forEach(Ut=>{let It=F(Ut.params,k),wt=D(It);(k<Ut.params.length||N(Ut.params))&&wt(T[k])&&_t.push(Ut)}),_t.length===0){if(P=Y(V,k),P.length>0){let Ut=_(T[k]);return v=new TypeError("Unexpected type of argument in function "+U+" (expected: "+P.join(" or ")+", actual: "+Ut.join(" | ")+", index: "+k+")"),v.data={category:"wrongType",fn:U,index:k,actual:Ut,expected:P},v}}else V=_t}let W=V.map(function(_t){return N(_t.params)?1/0:_t.params.length});if(T.length<Math.min.apply(null,W))return P=Y(V,k),v=new TypeError("Too few arguments in function "+U+" (expected: "+P.join(" or ")+", index: "+T.length+")"),v.data={category:"tooFewArgs",fn:U,index:T.length,expected:P},v;let X=Math.max.apply(null,W);if(T.length>X)return v=new TypeError("Too many arguments in function "+U+" (expected: "+X+", actual: "+T.length+")"),v.data={category:"tooManyArgs",fn:U,index:T.length,expectedLength:X},v;let gt=[];for(let _t=0;_t<T.length;++_t)gt.push(_(T[_t]).join("|"));return v=new TypeError('Arguments of type "'+gt.join(", ")+'" do not match any of the defined signatures of function '+U+"."),v.data={category:"mismatch",actual:gt},v}function Z(b){let T=c.length+1;for(let I=0;I<b.types.length;I++)O(b.types[I])&&(T=Math.min(T,b.types[I].typeIndex));return T}function tt(b){let T=f+1;for(let I=0;I<b.types.length;I++)O(b.types[I])||(T=Math.min(T,b.types[I].conversionIndex));return T}function pt(b,T){if(b.hasAny){if(!T.hasAny)return 1}else if(T.hasAny)return-1;if(b.restParam){if(!T.restParam)return 1}else if(T.restParam)return-1;if(b.hasConversion){if(!T.hasConversion)return 1}else if(T.hasConversion)return-1;let I=Z(b)-Z(T);if(I<0)return-1;if(I>0)return 1;let v=tt(b)-tt(T);return v<0?-1:v>0?1:0}function lt(b,T){let I=b.params,v=T.params,P=kt(I),U=kt(v),V=N(I),k=N(v);if(V&&P.hasAny){if(!k||!U.hasAny)return 1}else if(k&&U.hasAny)return-1;let W=0,X=0,gt;for(gt of I)gt.hasAny&&++W,gt.hasConversion&&++X;let _t=0,Ut=0;for(gt of v)gt.hasAny&&++_t,gt.hasConversion&&++Ut;if(W!==_t)return W-_t;if(V&&P.hasConversion){if(!k||!U.hasConversion)return 1}else if(k&&U.hasConversion)return-1;if(X!==Ut)return X-Ut;if(V){if(!k)return 1}else if(k)return-1;let It=(I.length-v.length)*(V?-1:1);if(It!==0)return It;let wt=[],oe=0;for(let Ie=0;Ie<I.length;++Ie){let an=pt(I[Ie],v[Ie]);wt.push(an),oe+=an}if(oe!==0)return oe;let $t;for($t of wt)if($t!==0)return $t;return 0}function dt(b){if(b.length===0)return[];let T=b.map(d);b.length>1&&T.sort((P,U)=>P.index-U.index);let I=T[0].conversionsTo;if(b.length===1)return I;I=I.concat([]);let v=new Set(b);for(let P=1;P<T.length;++P){let U;for(U of T[P].conversionsTo)v.has(U.from)||(I.push(U),v.add(U.from))}return I}function Ot(b,T){let I=T;if(b.some(P=>P.hasConversion)){let P=N(b),U=b.map(Lt);I=function(){let k=[],W=P?arguments.length-1:arguments.length;for(let X=0;X<W;X++)k[X]=U[X](arguments[X]);return P&&(k[W]=arguments[W].map(U[W])),T.apply(this,k)}}let v=I;if(N(b)){let P=b.length-1;v=function(){return I.apply(this,Pe(arguments,0,P).concat([Pe(arguments,P)]))}}return v}function Lt(b){let T,I,v,P,U=[],V=[];switch(b.types.forEach(function(k){k.conversion&&(U.push(d(k.conversion.from).test),V.push(k.conversion.convert))}),V.length){case 0:return function(W){return W};case 1:return T=U[0],v=V[0],function(W){return T(W)?v(W):W};case 2:return T=U[0],I=U[1],v=V[0],P=V[1],function(W){return T(W)?v(W):I(W)?P(W):W};default:return function(W){for(let X=0;X<V.length;X++)if(U[X](W))return V[X](W);return W}}}function Pt(b){function T(I,v,P){if(v<I.length){let U=I[v],V=[];if(U.restParam){let k=U.types.filter(O);k.length<U.types.length&&V.push({types:k,name:"..."+k.map(W=>W.name).join("|"),hasAny:k.some(W=>W.isAny),hasConversion:!1,restParam:!0}),V.push(U)}else V=U.types.map(function(k){return{types:[k],name:k.name,hasAny:k.isAny,hasConversion:k.conversion,restParam:!1}});return mn(V,function(k){return T(I,v+1,P.concat([k]))})}else return[P]}return T(b,0,[])}function At(b,T){let I=Math.max(b.length,T.length);for(let k=0;k<I;k++){let W=j(b,k),X=j(T,k),gt=!1,_t;for(_t of X)if(W.has(_t)){gt=!0;break}if(!gt)return!1}let v=b.length,P=T.length,U=N(b),V=N(T);return U?V?v===P:P>=v:V?v>=P:v===P}function Kt(b){return b.map(T=>vr(T)?si(T.referToSelf.callback):ui(T)?$e(T.referTo.references,T.referTo.callback):T)}function St(b,T,I){let v=[],P;for(P of b){let U=I[P];if(typeof U!="number")throw new TypeError('No definition for referenced signature "'+P+'"');if(U=T[U],typeof U!="function")return!1;v.push(U)}return v}function mt(b,T,I){let v=Kt(b),P=new Array(v.length).fill(!1),U=!0;for(;U;){U=!1;let V=!0;for(let k=0;k<v.length;++k){if(P[k])continue;let W=v[k];if(vr(W))v[k]=W.referToSelf.callback(I),v[k].referToSelf=W.referToSelf,P[k]=!0,V=!1;else if(ui(W)){let X=St(W.referTo.references,v,T);X?(v[k]=W.referTo.callback.apply(this,X),v[k].referTo=W.referTo,P[k]=!0,V=!1):U=!0}}if(V&&U)throw new SyntaxError("Circular reference detected in resolving typed.referTo")}return v}function ge(b){let T=/\bthis(\(|\.signatures\b)/;Object.keys(b).forEach(I=>{let v=b[I];if(T.test(v.toString()))throw new SyntaxError("Using `this` to self-reference a function is deprecated since typed-function@3. Use typed.referTo and typed.referToSelf instead.")})}function Bt(b,T){if(p.createCount++,Object.keys(T).length===0)throw new SyntaxError("No signatures provided");p.warnAgainstDeprecatedThis&&ge(T);let I=[],v=[],P={},U=[],V;for(V in T){if(!Object.prototype.hasOwnProperty.call(T,V))continue;let yt=R(V);if(!yt)continue;I.forEach(function(Cr){if(At(Cr,yt))throw new TypeError('Conflicting signatures "'+C(Cr)+'" and "'+C(yt)+'".')}),I.push(yt);let ye=v.length;v.push(T[V]);let cf=yt.map(E),hi;for(hi of Pt(cf)){let Cr=C(hi);U.push({params:hi,name:Cr,fn:ye}),hi.every(hf=>!hf.hasConversion)&&(P[Cr]=ye)}}U.sort(lt);let k=mt(v,P,xr),W;for(W in P)Object.prototype.hasOwnProperty.call(P,W)&&(P[W]=k[P[W]]);let X=[],gt=new Map;for(W of U)gt.has(W.name)||(W.fn=k[W.fn],X.push(W),gt.set(W.name,W));let _t=X[0]&&X[0].params.length<=2&&!N(X[0].params),Ut=X[1]&&X[1].params.length<=2&&!N(X[1].params),It=X[2]&&X[2].params.length<=2&&!N(X[2].params),wt=X[3]&&X[3].params.length<=2&&!N(X[3].params),oe=X[4]&&X[4].params.length<=2&&!N(X[4].params),$t=X[5]&&X[5].params.length<=2&&!N(X[5].params),Ie=_t&&Ut&&It&&wt&&oe&&$t;for(let yt=0;yt<X.length;++yt)X[yt].test=q(X[yt].params);let an=_t?D(X[0].params[0]):e,Dh=Ut?D(X[1].params[0]):e,Oh=It?D(X[2].params[0]):e,zh=wt?D(X[3].params[0]):e,Bh=oe?D(X[4].params[0]):e,kh=$t?D(X[5].params[0]):e,Xh=_t?D(X[0].params[1]):e,Vh=Ut?D(X[1].params[1]):e,Fh=It?D(X[2].params[1]):e,jh=wt?D(X[3].params[1]):e,Wh=oe?D(X[4].params[1]):e,qh=$t?D(X[5].params[1]):e;for(let yt=0;yt<X.length;++yt)X[yt].implementation=Ot(X[yt].params,X[yt].fn);let Yh=_t?X[0].implementation:t,Zh=Ut?X[1].implementation:t,Qh=It?X[2].implementation:t,Gh=wt?X[3].implementation:t,Hh=oe?X[4].implementation:t,Kh=$t?X[5].implementation:t,$h=_t?X[0].params.length:-1,Jh=Ut?X[1].params.length:-1,tf=It?X[2].params.length:-1,ef=wt?X[3].params.length:-1,nf=oe?X[4].params.length:-1,rf=$t?X[5].params.length:-1,of=Ie?6:0,af=X.length,sf=X.map(yt=>yt.test),uf=X.map(yt=>yt.implementation),lf=function(){for(let ye=of;ye<af;ye++)if(sf[ye](arguments))return uf[ye].apply(this,arguments);return p.onMismatch(b,arguments,X)};function xr(yt,ye){return arguments.length===$h&&an(yt)&&Xh(ye)?Yh.apply(this,arguments):arguments.length===Jh&&Dh(yt)&&Vh(ye)?Zh.apply(this,arguments):arguments.length===tf&&Oh(yt)&&Fh(ye)?Qh.apply(this,arguments):arguments.length===ef&&zh(yt)&&jh(ye)?Gh.apply(this,arguments):arguments.length===nf&&Bh(yt)&&Wh(ye)?Hh.apply(this,arguments):arguments.length===rf&&kh(yt)&&qh(ye)?Kh.apply(this,arguments):lf.apply(this,arguments)}try{Object.defineProperty(xr,"name",{value:b})}catch{}return xr.signatures=P,xr._typedFunctionData={signatures:X,signatureMap:gt},xr}function ht(b,T,I){throw G(b,T,I)}function zt(b){return Pe(b,0,b.length-1)}function kt(b){return b[b.length-1]}function Pe(b,T,I){return Array.prototype.slice.call(b,T,I)}function He(b,T){for(let I=0;I<b.length;I++)if(T(b[I]))return b[I]}function mn(b,T){return Array.prototype.concat.apply([],b.map(T))}function Ke(){let b=zt(arguments).map(I=>C(R(I))),T=kt(arguments);if(typeof T!="function")throw new TypeError("Callback function expected as last argument");return $e(b,T)}function $e(b,T){return{referTo:{references:b,callback:T}}}function si(b){if(typeof b!="function")throw new TypeError("Callback function expected as first argument");return{referToSelf:{callback:b}}}function ui(b){return b&&typeof b.referTo=="object"&&Array.isArray(b.referTo.references)&&typeof b.referTo.callback=="function"}function vr(b){return b&&typeof b.referToSelf=="object"&&typeof b.referToSelf.callback=="function"}function Zn(b,T){if(!b)return T;if(T&&T!==b){let I=new Error("Function names do not match (expected: "+b+", actual: "+T+")");throw I.data={actual:T,expected:b},I}return b}function ho(b){let T;for(let I in b)Object.prototype.hasOwnProperty.call(b,I)&&(A(b[I])||typeof b[I].signature=="string")&&(T=Zn(T,b[I].name));return T}function fo(b,T){let I;for(I in T)if(Object.prototype.hasOwnProperty.call(T,I)){if(I in b&&T[I]!==b[I]){let v=new Error('Signature "'+I+'" is defined twice');throw v.data={signature:I,sourceFunction:T[I],destFunction:b[I]},v}b[I]=T[I]}}let li=p;p=function(b){let T=typeof b=="string",I=T?1:0,v=T?b:"",P={};for(let U=I;U<arguments.length;++U){let V=arguments[U],k={},W;if(typeof V=="function"?(W=V.name,typeof V.signature=="string"?k[V.signature]=V:A(V)&&(k=V.signatures)):a(V)&&(k=V,T||(W=ho(V))),Object.keys(k).length===0){let X=new TypeError("Argument to 'typed' at index "+U+" is not a (typed) function, nor an object with signatures as keys and functions as values.");throw X.data={index:U,argument:V},X}T||(v=Zn(v,W)),fo(P,k)}return Bt(v||"",P)},p.create=i,p.createCount=li.createCount,p.onMismatch=ht,p.throwMismatchError=ht,p.createError=G,p.clear=h,p.clearConversions=g,p.addTypes=m,p._findType=d,p.referTo=Ke,p.referToSelf=si,p.convert=x,p.findSignature=y,p.find=S,p.isTypedFunction=A,p.warnAgainstDeprecatedThis=!0,p.addType=function(b,T){let I="any";T!==!1&&l.has("Object")&&(I="Object"),p.addTypes([b],I)};function ci(b){if(!b||typeof b.from!="string"||typeof b.to!="string"||typeof b.convert!="function")throw new TypeError("Object with properties {from: string, to: string, convert: function} expected");if(b.to===b.from)throw new SyntaxError('Illegal to define conversion from "'+b.from+'" to itself.')}return p.addConversion=function(b){let T=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{override:!1};ci(b);let I=d(b.to),v=I.conversionsTo.find(P=>P.from===b.from);if(v)if(T&&T.override)p.removeConversion({from:v.from,to:b.to,convert:v.convert});else throw new Error('There is already a conversion from "'+b.from+'" to "'+I.name+'"');I.conversionsTo.push({from:b.from,convert:b.convert,index:f++})},p.addConversions=function(b,T){b.forEach(I=>p.addConversion(I,T))},p.removeConversion=function(b){ci(b);let T=d(b.to),I=He(T.conversionsTo,P=>P.from===b.from);if(!I)throw new Error("Attempt to remove nonexistent conversion from "+b.from+" to "+b.to);if(I.convert!==b.convert)throw new Error("Conversion to remove does not match existing conversion");let v=T.conversionsTo.indexOf(I);T.conversionsTo.splice(v,1)},p.resolve=function(b,T){if(!A(b))throw new TypeError(n);let I=b._typedFunctionData.signatures;for(let v=0;v<I.length;++v)if(I[v].test(T))return I[v];return null},p}var o=i();return o})});var Zg={};yf(Zg,{AibeeLoader:()=>Ds,BMap:()=>Fo,BMapSelect:()=>Ko,BaseSvg:()=>Ee,Context:()=>Fr,CrLoader:()=>Os,CrNavPath:()=>Ho,Equipment:()=>jo,Events:()=>So,Floor:()=>qe,GlbModel:()=>Or,Graphic:()=>Yt,GraphicLayer:()=>Rr,GroundTexture:()=>Jn,HeatmapElement:()=>Pr,HooksName:()=>Kn,HoverHelper:()=>Vr,Lane:()=>zr,Layer:()=>ne,MapTypePolar:()=>Du,MergeGraphic:()=>Br,Model:()=>Ir,MulFloorNavigation:()=>Es,MulFloors:()=>Yo,NavPath:()=>Qo,Navigation:()=>qo,Overlay:()=>Mr,PathDirection:()=>To,PdrPosition:()=>ws,Poi:()=>Cn,Poi2:()=>ve,PoiLayer:()=>Nr,PoiLayer2:()=>kn,RoadNetwork:()=>No,RoadNetwork2:()=>Lo,SelectBox:()=>Oo,Selection:()=>Xr,Sensor:()=>qr,Shadow:()=>Tr,SvgLine:()=>Lr,SvgPolygon:()=>Ur,TextTexture:()=>kr,Timer:()=>Jt,TweenUtil:()=>cn,UA:()=>Ao,Wall:()=>Dr,addAlphaToHexColor:()=>bf,calc_angle:()=>yo,calc_direction:()=>di,convertToSnakeCase:()=>Uo,createCircle:()=>Gn,createLine:()=>wr,createRect:()=>ln,createSvg:()=>xo,createSvgElement:()=>Sr,createThreeBox:()=>Uf,createThreeLine:()=>Lf,darkenColor:()=>Je,defaultAibeeLoaderOption:()=>Yg,defaultConfig:()=>Lu,defaultGraphicOptions:()=>mi,defaultOptions:()=>yu,defaultTextTextureOptions:()=>bu,dispose:()=>te,distancePointToSegment:()=>Eo,generatorKeyByObj:()=>Un,getAngle:()=>Ws,getCenter:()=>br,getConfig:()=>Vo,getDirectPath:()=>Mf,getDistanceByPathPos:()=>Mo,getLength:()=>Wt,getLongestSideDir:()=>vf,getMinEdgeSquare:()=>_o,getPathLength:()=>Re,getPointEdgeIndex:()=>un,getPosByPathDistance:()=>Dn,hasChinese:()=>go,hexToRgb:()=>pi,initDirectionalLight:()=>mo,initLight:()=>po,initShape:()=>Fe,isAndroid:()=>Sf,isContain:()=>sn,isControl:()=>Ln,isIphone:()=>Hn,isMac:()=>Nn,isPointInPolygon:()=>vo,loadBuildingGround:()=>Ts,loadExternalStreet:()=>Xg,loadGraphics:()=>Ms,moveOnRoute:()=>Tf,proxyOptions:()=>Rn,removeWeightPath:()=>qs,setCirclePosition:()=>yn,setLineStartEnd:()=>Ne,setRectPosition:()=>ae,simplifyPath:()=>Er,sleepOnePromise:()=>Co,sleepOneRf:()=>Cf,smoothPath:()=>wo,strToNumber:()=>Af,timeoutPromise:()=>we,toWebWorker:()=>Nf,transformGraphicData:()=>_e,translatePosToCenter:()=>Ue,triggerWorker:()=>je,vector3ToDevice:()=>nt,xhrGet:()=>wf});module.exports=_f(Zg);var Ni=require("three");var Jt=class{tasks={requestAnimation:new Set,timeout:new Set,interval:new Set};requestAnimationFrame(e){let t=window.requestAnimationFrame(()=>{this.tasks.requestAnimation.delete(t),e()});return this.tasks.requestAnimation.add(t),t}cancelAnimationFrame(e){this.tasks.requestAnimation.delete(e),window.cancelAnimationFrame(e)}setTimeout(e,t){let n=window.setTimeout(()=>{this.tasks.timeout.delete(n),e()},t);return this.tasks.timeout.add(n),n}clearTimeout(e){this.tasks.timeout.delete(e),window.clearTimeout(e)}setInterval(e,t){let n=window.setInterval(()=>{this.tasks.interval.delete(n),e()},t);return this.tasks.interval.add(n),n}clearInterval(e){this.tasks.interval.delete(e),window.clearInterval(e)}dispose(){this.tasks.requestAnimation.forEach(e=>{window.cancelAnimationFrame(e)}),this.tasks.requestAnimation.clear(),this.tasks.timeout.forEach(e=>{window.clearTimeout(e)}),this.tasks.timeout.clear(),this.tasks.interval.forEach(e=>{window.clearInterval(e)}),this.tasks.interval.clear()}};var Se=require("three");function po(){let r=new Se.Group,e=new Se.AmbientLight(16777215,2.6);return r.add(e),r}function Fe(r,e=[]){let t=new Se.Shape(r.map(n=>new Se.Vector2(...n)));return e.length&&e.forEach(n=>{var i=new Se.Path(n.map(o=>new Se.Vector2(...o)));t.holes.push(i)}),t}function mo(r=16777215,e=1){let t=new Se.DirectionalLight(r,e);return t.castShadow=!0,t.shadow.radius=8,t.shadow.bias=-.001,t.shadow.mapSize.set(256,256),t.shadow.camera.left=-200,t.shadow.camera.right=200,t.shadow.camera.top=200,t.shadow.camera.bottom=-200,t}function te(r,e){if(e&&r.children&&r.children.length&&r.children.forEach(t=>{te(t,e)}),r.isMesh){let t=r;t.geometry&&t.geometry.dispose(),t.material&&(Array.isArray(t.material)?t.material.forEach(n=>{n.dispose()}):t.material.dispose())}r.isLight&&r.dispose?.()}function go(r){return/[\u4E00-\u9FA5]+/g.test(r)}var Xt=require("three"),Qn=require("@turf/turf");function nt(r,e,t,n){let i=r.clone().project(e),o=t/2,a=n/2,s=Math.round(i.x*o+o),u=Math.round(-i.y*a+a);return{x:s,y:u}}function br(r){let e=(0,Qn.featureCollection)(r.map(n=>(0,Qn.point)(n)));return(0,Qn.center)(e).geometry.coordinates}function sn(r,e,t){return r.x>=e.x&&r.x<=t.x&&r.y>=e.y&&r.y<=t.y}function vf(r){let e=0,t=new Xt.Vector3;for(let n=1;n<r.length;n++){let i=new Xt.Vector3(r[n-1][0],r[n-1][1],0),o=new Xt.Vector3(r[n][0],r[n][1],0),a=o.distanceTo(i);a>e&&(e=a,t=o.clone().sub(i).normalize())}return t}function Wt(r,e){return Math.sqrt((e[0]-r[0])**2+(e[1]-r[1])**2)}function Re(r){let e=0;for(let t=0;t<r.length-1;t++)e+=Wt(r[t],r[t+1]);return e}function yo(r,e,t){let n=new Xt.Vector2(e[0]-r[0],e[1]-r[1]),i=new Xt.Vector2(e[0]-t[0],e[1]-t[1]),a=n.angleTo(i)*180/Math.PI,s=new Xt.Vector2(e[0]-r[0],e[1]-r[1]);return new Xt.Vector2(t[0]-r[0],t[1]-r[1]).cross(s)>0?a:-a}function _o(r,e){let t=Math.min(Wt(r[0][0],r[0][1]),Wt(r[0][2],r[0][1]))-1;e||(e=br(r[0]));let n=xf(e,t),i=new Xt.Vector2(r[0][0][0],r[0][0][1]),o=new Xt.Vector2(r[0][1][0],r[0][1][1]),a=new Xt.Vector2(r[0][2][0],r[0][2][1]),u=(i.distanceTo(o)>o.distanceTo(a)?o.clone().sub(i):a.clone().sub(o)).angleTo(new Xt.Vector2(0,1)),l=new Xt.Matrix3;return l.multiply(new Xt.Matrix3().translate(e[0],e[1])).multiply(new Xt.Matrix3().rotate(u)).multiply(new Xt.Matrix3().translate(-e[0],-e[1])),[n.map(c=>{let f=new Xt.Vector2(c[0],c[1]).applyMatrix3(l);return[f.x,f.y]})]}function xf(r,e){let t=e/2;return[[r[0]-t,r[1]+t],[r[0]+t,r[1]+t],[r[0]+t,r[1]-t],[r[0]-t,r[1]-t],[r[0]-t,r[1]+t]]}function un(r,e){let t=0,n=1/0,[i,o]=e;for(let a=0;a<r.length-1;a++){let[s,u]=r[a],[l,c]=r[a+1],f=Math.min(s,l)<=i&&i<=Math.max(s,l),p=Math.min(u,c)<=o&&o<=Math.max(u,c);if(f&&p){let d=Math.abs((l-s)*(o-u)-(c-u)*(i-s));d<n&&(n=d,t=a)}}return t}function vo(r,e){let t=r[0],n=r[1],i=!1;for(let o=0,a=e.length-1;o<e.length;a=o++){let s=e[o][0],u=e[o][1],l=e[a][0],c=e[a][1];u>n!=c>n&&t<(l-s)*(n-u)/(c-u)+s&&(i=!i)}return i}function Rn(r,e){return new Proxy(r,{get:(t,n,i)=>Reflect.get(t,n,i),set:(t,n,i,o)=>{let a=Reflect.get(t,n,o),s=Reflect.set(t,n,i,o);return a!==i&&e.dispatchEvent({type:`change-${n}`,value:i}),s}})}function we(r,e){return Promise.race([r,new Promise((t,n)=>{setTimeout(()=>n(new Error("Promise timeout")),e)})])}function Sr(r){return document.createElementNS("http://www.w3.org/2000/svg",r)}function xo(r,e){let t=Sr("svg");return t.setAttribute("width",r),t.setAttribute("height",e),t.style.cssText="position: absolute; left: 0; top: 0; pointer-events: none;",t}function Gn(r="2",e){let t=Sr("circle");return t.setAttribute("r",r),t.setAttribute("fill",e),t}function wr(r){let e=Sr("line");return e.setAttribute("stroke",r),e}function ln(r,e){let t=Sr("rect");return t.setAttribute("stroke",r),t.setAttribute("fill",e),t}function yn(r,e,t){r.setAttribute("cx",`${e}`),r.setAttribute("cy",`${t}`)}function Ne(r,e,t){e&&(r.setAttribute("x1",`${e.x}`),r.setAttribute("y1",`${e.y}`)),t&&(r.setAttribute("x2",`${t.x}`),r.setAttribute("y2",`${t.y}`))}function ae(r,e,t,n,i){r.setAttribute("x",`${e}`),r.setAttribute("y",`${t}`),r.setAttribute("width",`${n}`),r.setAttribute("height",`${i}`)}function Co(){return Promise.resolve()}function Cf(){return new Promise(r=>{requestAnimationFrame(r)})}function Af(r){return parseInt(r.replace("#","0x"),16)}function bf(r,e){let t=parseInt(r.substring(1,3),16),n=parseInt(r.substring(3,5),16),i=parseInt(r.substring(5,7),16),o=Math.round(t*e),a=Math.round(n*e),s=Math.round(i*e);return`#${(1<<24|o<<16|a<<8|s).toString(16).slice(1)}`}function Je(r,e=.85){let t,n,i;if(r.startsWith("#"))t=parseInt(r.substring(1,3),16),n=parseInt(r.substring(3,5),16),i=parseInt(r.substring(5,7),16);else{let a=r.slice(4,-1).split(",");t=parseInt(a[0].trim()),n=parseInt(a[1].trim()),i=parseInt(a[2].trim())}return t=Math.min(Math.floor(t*e),255),n=Math.min(Math.floor(n*e),255),i=Math.min(Math.floor(i*e),255),"#"+((1<<24)+(t<<16)+(n<<8)+i).toString(16).slice(1)}function pi(r,e){r=r.replace(/^#/,"");let t=parseInt(r.substring(0,2),16),n=parseInt(r.substring(2,4),16),i=parseInt(r.substring(4,6),16);return e!==void 0?`rgba(${t}, ${n}, ${i}, ${e})`:`rgb(${t}, ${n}, ${i})`}var Nn=navigator.userAgent.toUpperCase().indexOf("MAC")>=0,Ao=(window.navigator.userAgent||"").toLocaleLowerCase(),Hn=/ios|iphone/i.test(Ao),Sf=/android|adr|linux/gi.test(Ao);function Ln(r){return Nn?r==="Meta":r==="Control"}var bo="__once__",So=class{events=new Map;on(e,t){if(typeof t!="function")return;let n=this.events.get(e);return n?n.add(t):this.events.set(e,new Set([t]))}once(e,t){if(typeof t!="function")return;let n=`${bo}${e}`,i=this.events.get(n);return i?i.add(t):this.events.set(n,new Set([t]))}off(e,t){let n=this.events.get(e),i=this.events.get(`${bo}${e}`);!n&&!i||(t===void 0&&(n?.clear(),i?.clear()),n?.has(t)&&n.delete(t),i?.has(t)&&i.delete(t))}offAll(){this.events.clear()}emit(e,...t){let n=this.events.get(e),i=this.events.get(`${bo}${e}`);!n&&!i||(n?.forEach(o=>{typeof o=="function"&&o(...t)}),i?.forEach(o=>{typeof o=="function"&&o(...t)}),i?.clear())}};var Kn=(t=>(t.SWITCH_FLOOR_BEFORE="switch_floor_before",t.SWITCH_FLOOR_AFTER="switch_floor_after",t))(Kn||{});function Un(r){return Object.keys(r).sort().map(e=>`${e}=${r[e]}`).join("&")}function wf(r,e){return new Promise((t,n)=>{let i=new XMLHttpRequest;i.open("GET",r,!0),Object.keys(e.headers||{}).forEach(o=>{i.setRequestHeader(o,e.headers[o])}),e.responseType&&(i.responseType=e.responseType),i.onload=()=>{if(i.status>=200&&i.status<300)if(e.responseType==="arraybuffer")t(i.response);else try{let o=JSON.parse(i.responseText);t(o)}catch(o){n(o)}else n(i.statusText)},i.onerror=()=>{n(i.statusText)},i.send()})}var $n=require("three"),js=Ar(Fs(),1);function Ws(r,e){let t=r.clone().normalize(),n=e.clone().normalize();return Math.acos(t.dot(n))}function Ef(r){let e=0;return r.reduce(([t,n],[i,o])=>(e+=Math.sqrt((i-t)**2+(o-n)**2),[i,o])),e/r.length}function wo(r,e=.25){if(Ef(r)<e)return r;let t=(0,js.default)(r);return wo(t,e)}function Er(r,e=!1,t=!0,n=5,i=150,o=3){let a=[],s=!e;if(a.push(r[0]),r.length<2)return a;for(let l=0;l<r.length-2;l+=1){let c=r[l],f=r[l+1],p=r[l+2],d=new $n.Vector2(c[0]-f[0],c[1]-f[1]),m=new $n.Vector2(p[0]-f[0],p[1]-f[1]),h=Ws(d,m)/Math.PI*180,g=d.length()+m.length();(!s||h<i&&g>.01||g>n)&&(a.push(r[l+1]),s=!0)}if(a.push(r[r.length-1]),!t)return a;let u=[];u.push(a[0]);for(let l=0;l<a.length-2;l+=1){let c=new $n.Vector2(a[l][0],a[l][1]),f=new $n.Vector2(a[l+1][0],a[l+1][1]),p=new $n.Vector2(a[l+2][0],a[l+2][1]),d=c.distanceTo(f)/2,m=p.distanceTo(f)/2,h=f.clone(),g=f.clone();h.add(c.clone().sub(f).normalize().multiplyScalar(d>o?o/2:d)),g.add(p.clone().sub(f).normalize().multiplyScalar(m>o?o/2:m));let _=[[h.x,h.y],[f.x,f.y],[g.x,g.y]];u.push(...wo(_,o/25))}return u.push(a[a.length-1]),qs(u)}function qs(r){if(r.length<=1)return r;let e=[],t;return r.forEach(([n,i])=>{t?n===t[0]&&i===t[1]||(t=[n,i],e.push([n,i])):(t=[n,i],e.push([n,i]))}),e}function Eo(r,e,t){let n=Math.sqrt((t[0]-e[0])**2+(t[1]-e[1])**2);if(n===0)return{distance:Math.sqrt((r[0]-e[0])**2+(r[1]-e[1])**2),closestPoint:e.slice(0)};let i=Math.max(0,Math.min(1,((r[0]-e[0])*(t[0]-e[0])+(r[1]-e[1])*(t[1]-e[1]))/n**2)),o=[e[0]+i*(t[0]-e[0]),e[1]+i*(t[1]-e[1])];return{distance:Math.sqrt((r[0]-o[0])**2+(r[1]-o[1])**2),closestPoint:o}}function Tf(r,e,t){let[n,i]=r,[o,a]=e,s=Math.sqrt(Math.pow(o-n,2)+Math.pow(a-i,2));if(s===0||s<t)return[...e];let u=t/s,l=n+(o-n)*u,c=i+(a-i)*u;return[l,c]}var To=(l=>(l.START="start",l.END="end",l.FRONT="front",l.RIGHT="right",l.LEFT="left",l.RIGHT_FRONT="right_front",l.LEFT_FRONT="left_front",l.RIGHT_BACK="right_back",l.LEFT_BACK="left_back",l))(To||{});function di(r,e,t){let n=yo(r,e,t);return 180-Math.abs(n)<15?"front":n>135?"right_front":n<-135?"left_front":n<=135&&n>=60?"right":n>=-135&&n<=-60?"left":n<60&&n>0?"right_back":n>-60&&n<0?"left_back":"front"}function Mf(r){if(!r.length)return[];if(r.length===1)return[{direction:"start",distance:0,points:r}];let e=[{direction:"start",distance:Wt(r[0],r[1]),points:[r[0],r[1]]}];for(let t=2;t<r.length;t++){let n=di(r[t-2],r[t-1],r[t]);if(n==="front"){let i=e[e.length-1],o=Wt(r[t-1],r[t]);i.distance+=o,t!==2&&i.points.push(r[t-1])}else e.push({direction:n,distance:Wt(r[t-1],r[t]),points:[r[t-1],r[t]]})}return e.push({direction:"end",distance:0,points:[r[r.length-1]]}),e}function Mo(r,e){if(r.length<2)return-1;let t=0;for(let n=1;n<r.length;n++){let i=r[n-1],o=r[n],a=[e[0]-i[0],e[1]-i[1]],s=[o[0]-i[0],o[1]-i[1]],u=Math.min(o[0],i[0])<=e[0]&&e[0]<=Math.max(o[0],i[0]),l=Math.min(o[1],i[1])<=e[1]&&e[1]<=Math.max(o[1],i[1]);if(u&&l){let c=a[0]*s[1]-a[1]*s[0];if(Math.abs(c)<1e-6){let f=Math.sqrt((e[0]-i[0])**2+(e[1]-i[1])**2);return t+f}}t+=Math.sqrt((o[0]-i[0])**2+(o[1]-i[1])**2)}return-1}function Dn(r,e){if(r.length<2)return r[0]??null;let t=0;for(let n=1;n<r.length;n++){let i=r[n-1],o=r[n],a=Math.sqrt((o[0]-i[0])**2+(o[1]-i[1])**2);if(t+=a,t>=e){let s=(e-(t-a))/a,u=i[0]+(o[0]-i[0])*s,l=i[1]+(o[1]-i[1])*s;return[u,l]}}return null}var tn=Ar(Ro(),1);var Le="___",No=class{constructor(e=3){this.lift_priority=e}roadInfo=[];pointMap=new Map;nodeMap=new Map;facilityMap=new Map;straightLadderMap=new Map;escalatorMap=new Map;staircaseMap=new Map;lineMap=new Map;baseRoute=new tn.default;escalatorRoute=new tn.default;straightLadderRoute=new tn.default;initRoute(e){this.clear(),this.roadInfo=e,e.length&&(e.forEach(t=>{t.points.forEach(n=>{let i=`${t.floor}${Le}${n.id}`;if(this.pointMap.set(i,n),this.nodeMap.set(`${n.floor}${Le}${n.nodeId}`,i),n.type==="straightLadder"){let o=this.straightLadderMap.get(n.name)||[];o.push({...n}),this.straightLadderMap.set(n.name,o)}if(n.type==="staircase"){let o=this.staircaseMap.get(n.name)||[];o.push({...n}),this.staircaseMap.set(n.name,o)}if(n.type==="escalator"){let o=this.escalatorMap.get(n.name)||{};n.escalatorDirection==="exit"?o.end={floor:n.floor,id:n.id}:o.start={floor:n.floor,id:n.id},this.escalatorMap.set(n.name,o)}if(n.type==="facility"){let o=this.facilityMap.get(n.targetId)||[];o.push({...n}),this.facilityMap.set(n.targetId,o)}}),t.lines.filter(n=>n.direction!=="no").forEach(n=>{let i=`${t.floor}${Le}${n.from}`,o=`${t.floor}${Le}${n.to}`,a=this.pointMap.get(i)?.cds,s=this.pointMap.get(o)?.cds;if(a?.length&&s?.length){let u=Wt(a,s);this.addLineItem(i,o,u),n.direction==="double"&&this.addLineItem(o,i,u)}})}),this.initBaseRoute(),this.initEscalatorRoute(),this.initStraightLadderRoute())}addLineItem(e,t,n,i=this.lineMap){let o=i.get(e)||new Map;o.set(t,n),i.set(e,o)}addFacilityToLineMap(e,t,n,i){[...this.straightLadderMap,...this.staircaseMap].forEach(([o,a])=>{if(!(a.length<2))for(let s=0;s<a.length;s++){let u=`${a[s].floor}${Le}${a[s].id}`;for(let l=0;l<a.length;l++)if(s!==l){let c=`${a[l].floor}${Le}${a[l].id}`,f=this.pointMap.get(u)?.cds,p=this.pointMap.get(c)?.cds;if(f?.length&&p?.length)if(a[s].type==="straightLadder"){let d=t;this.addLineItem(u,c,d,i)}else{let d=n;this.addLineItem(u,c,d,i)}}}}),this.escalatorMap.forEach((o,a)=>{if(o.start&&o.end){let s=`${o.start.floor}${Le}${o.start.id}`,u=`${o.end.floor}${Le}${o.end.id}`,l=this.pointMap.get(s)?.cds,c=this.pointMap.get(u)?.cds;if(l?.length&&c?.length){let f=e;this.addLineItem(s,u,f,i)}}})}initBaseRoute(){let e=new Map([...this.lineMap]);this.addFacilityToLineMap(1,this.lift_priority,3e4,e),this.baseRoute=new tn.default(e)}initEscalatorRoute(){let e=new Map([...this.lineMap]),t=1e4;this.addFacilityToLineMap(1*t,this.lift_priority*t,3e4*t,e),this.escalatorRoute=new tn.default(e)}initStraightLadderRoute(){let e=new Map([...this.lineMap]),t=1e4;this.addFacilityToLineMap(3*t,1*t,3e4*t,e),this.straightLadderRoute=new tn.default(e)}checkStart(e){return!(!e.floor||!e.nodeId&&(!e.coord||e.coord.length<2))}checkEnd(e){return e.facility?!0:this.checkStart(e)}transformStart(e){if(e.nodeId){let t=this.nodeMap.get(`${e.floor}${Le}${e.nodeId}`);if(t){let[n,i]=t.split(Le);return{floor:n,id:i}}}if(e.coord?.length){let t=this.roadInfo.find(i=>i.floor===e.floor);if(!t)return null;let n=t.points.reduce((i,o)=>{let a=Wt(e.coord,o.cds);return a<i.min&&(i.min=a,i.point=o),i},{min:1/0,point:t.points[0]});return{floor:n.point.floor,id:n.point.id}}return null}transformEnd(e){if(e.floor){let t=this.transformStart(e);if(t)return t}return e.facility&&this.facilityMap.get(e.facility)?.length?{floor:e.floor,facility:e.facility}:null}getPath(e,t,n=""){if(!this.checkStart(e))return"start-error";if(!this.checkEnd(t))return"end-error";let i=this.transformStart(e);if(!i)return"no-start";let o=this.transformEnd(t);if(!o)return"no-end";let a=this.getBasePath.bind(this);switch(n){case"escalator":a=this.getEscalatorPath.bind(this);break;case"straightLadder":a=this.getStraightLadderPath.bind(this);break;default:a=this.getBasePath.bind(this);break}if(o.id)return a(i,o);if(o.facility){let s=this.facilityMap.get(o.facility).filter(l=>o.floor?l.floor===o.floor:!0);if(!s.length)return null;let u=s.map(l=>a(i,{floor:l.floor,id:l.id})).filter(l=>!!l);return u.reduce((l,c)=>{let f=c.reduce((p,d)=>p+Re(d.points),0);return f<l.distance&&(l.distance=f,l.path=c),l},{distance:1/0,path:u[0]}).path}}getRoutePath(e,t,n){let i=`${e.floor}${Le}${e.id}`,o=`${t.floor}${Le}${t.id}`,a=n.path(i,o);if(!a)return null;let s=[];return a.map(u=>{let l=this.pointMap.get(u);if(l){let{floor:c}=l;if(s[s.length-1]?.floor===c){let f=s[s.length-1];f.points.push(l.cds),f.endType=l.type,f.destId=l.nodeId,f.distance=Re(f.points)}else s.push({floor:c,points:[l.cds],endType:l.type,destId:l.nodeId,distance:0})}}),s}getBasePath(e,t){return this.getRoutePath(e,t,this.baseRoute)}getEscalatorPath(e,t){return this.getRoutePath(e,t,this.escalatorRoute)}getStraightLadderPath(e,t){return this.getRoutePath(e,t,this.straightLadderRoute)}clear(){this.roadInfo=[],this.pointMap.clear(),this.nodeMap.clear(),this.facilityMap.clear(),this.straightLadderMap.clear(),this.escalatorMap.clear(),this.staircaseMap.clear(),this.lineMap.clear(),this.baseRoute=new tn.default,this.escalatorRoute=new tn.default,this.straightLadderRoute=new tn.default}};var se=Ar(Ro(),1);var _n=require("lodash"),Et="___",Lo=class{constructor(e=3){this.lift_priority=e}roadInfo=[];facilities=[];pointMap=new Map;nodeMap=new Map;facilityMap=new Map;straightLadderMap=new Map;escalatorMap=new Map;rampMap=new Map;staircaseMap=new Map;parkingMap=new Map;lineMap=new Map;baseRoute=new se.default;escalatorRoute=new se.default;straightLadderRoute=new se.default;forwardLineMap=new Map;forwardRoute=new se.default;isFacilityByType(e){return["facility","escalator","straightLadder","staircase","ramp"].includes(e)}initFacilities(e){this.facilities=e.map(t=>{let n=[];try{n=JSON.parse(t.entry_end_floor)}catch{n=[]}let i=[];try{i=JSON.parse(t.entry_start_floor)}catch{i=[]}return{...t,entry_start_floor:i,entry_end_floor:n}})}initRoute(e,t){this.clear(),this.roadInfo=e,this.initFacilities(t);let n=new Date,i=n.getHours()*60+n.getMinutes();e.length&&(e.forEach(o=>{(o.points||[]).filter(a=>a.openStatus!==!1).filter(a=>{if(!a.startTime||!a.endTime)return!0;let[s,u]=a.startTime.split(":").map(d=>+d),[l,c]=a.endTime.split(":").map(d=>+d),f=s*60+u,p=l*60+c;return i>=f&&i<=p}).forEach(a=>{a.floor=o.floor;let s=`${o.floor}${Et}${a.id}`;if(this.nodeMap.set(`${o.floor}${Et}${a.nodeId}`,`${o.floor}${Et}${a.relatedId||a.id}`),this.pointMap.set(s,a),this.isFacilityByType(a.type)){let u=this.facilities.find(l=>l.id===+a.targetId);if(u){switch(u.entry_infra_type){case"straightLadder":if(u.entry_end_floor.find(p=>p.floor===o.floor)&&u.entry_start_floor.find(p=>p.floor===o.floor)){let p=this.straightLadderMap.get(a.targetId)||[];p.push({...a}),this.straightLadderMap.set(a.targetId,p)}break;case"staircase":if(u.entry_end_floor.find(p=>p.floor===o.floor)&&u.entry_start_floor.find(p=>p.floor===o.floor)){let p=this.staircaseMap.get(a.targetId)||[];p.push({...a}),this.staircaseMap.set(a.targetId,p)}break;case"escalator":let c=this.escalatorMap.get(a.targetId)||[];if(u.entry_start_floor.find(p=>p.floor===o.floor)){let p=c.find(d=>d.end?.floor!==o.floor&&!d.start);p?p.start=a:c.push({start:a})}if(u.entry_end_floor.find(p=>p.floor===o.floor)){let p=c.find(d=>d.start?.floor!==o.floor&&!d.end);p?p.end=a:c.push({end:a})}this.escalatorMap.set(a.targetId,c);break;case"ramp":let f=this.rampMap.get(a.targetId)||[];if(u.entry_start_floor.find(p=>p.floor===o.floor)){let p=f.find(d=>d.end?.floor!==o.floor&&!d.start);p?p.start=a:f.push({start:a})}if(u.entry_end_floor.find(p=>p.floor===o.floor)){let p=f.find(d=>d.start?.floor!==o.floor&&!d.end);p?p.end=a:f.push({end:a})}this.rampMap.set(a.targetId,f);break}let l=this.facilityMap.get(a.targetId)||[];l.push({...a}),this.facilityMap.set(a.targetId,l)}}a.type==="parkingSpace"&&this.parkingMap.set(`${o.floor}${Et}${a.name}`,a)}),(o.lines||[]).filter(a=>a.direction!=="no").forEach(a=>{let s=`${o.floor}${Et}${a.from}`,u=`${o.floor}${Et}${a.to}`,l=this.pointMap.get(s),c=this.pointMap.get(u);if(!l||!c)return;let f=l.cds,p=c.cds,d=Wt(f,p);if(!l.permission&&!c.permission)switch(this.addLineItem(s,u,d),this.addLineItem(u,s,d),a.direction){case"double":this.addLineItem(s,u,d,this.forwardLineMap),this.addLineItem(u,s,d,this.forwardLineMap);break;case"single":this.addLineItem(s,u,d,this.forwardLineMap);break;case"back":this.addLineItem(u,s,d,this.forwardLineMap);break}else l.permission&&(this.setPermissionLine(s,u,l.permission,d,""),this.setPermissionLine(u,s,l.permission,d,"")),c.permission&&c.permission!==l.permission&&(this.setPermissionLine(s,u,c.permission,d,""),this.setPermissionLine(u,s,c.permission,d,""))})}),this.addPermissionFacility(),this.initBaseRoute(),this.initEscalatorRoute(),this.initStraightLadderRoute(),this.initForwardRoute())}getPermissionMap(e){return this[`permission_${e}`]||(this[`permission_${e}`]=new Set),this[`permission_${e}`]}setPermissionLine(e,t,n,i,o){this.getPermissionMap(n).add({fromKey:e,toKey:t,distance:i,type:o})}addPermissionFacility(){this.straightLadderMap.forEach((e,t)=>{if(e.length<2){this.straightLadderMap.delete(t);return}for(let n=0;n<e.length;n++){let i=`${e[n].floor}${Et}${e[n].id}`,o=this.pointMap.get(i);if(o){for(let a=0;a<e.length;a++)if(n!==a){let s=`${e[a].floor}${Et}${e[a].id}`,u=this.pointMap.get(s);if(!u)continue;o.permission&&this.setPermissionLine(i,s,o.permission,1,"straightLadder"),u.permission&&u.permission!==o.permission&&this.setPermissionLine(i,s,u.permission,1,"straightLadder")}}}}),this.staircaseMap.forEach((e,t)=>{if(e.length<2){this.staircaseMap.delete(t);return}for(let n=0;n<e.length;n++){let i=`${e[n].floor}${Et}${e[n].id}`,o=this.pointMap.get(i);if(o){for(let a=0;a<e.length;a++)if(n!==a){let s=`${e[a].floor}${Et}${e[a].id}`,u=this.pointMap.get(s);if(!u)continue;o.permission&&this.setPermissionLine(i,s,o.permission,1,"staircase"),u.permission&&u.permission!==o.permission&&this.setPermissionLine(i,s,u.permission,1,"straightLadder")}}}}),this.escalatorMap.forEach((e,t)=>{e.forEach(n=>{if(n.start&&n.end){let i=`${n.start.floor}${Et}${n.start.id}`,o=`${n.end.floor}${Et}${n.end.id}`,a=this.pointMap.get(i),s=this.pointMap.get(o);a&&s&&(a.permission&&this.setPermissionLine(i,o,a.permission,1,"escalator"),s.permission&&s.permission!==a.permission&&this.setPermissionLine(i,o,s.permission,1,"escalator"))}})}),this.rampMap.forEach((e,t)=>{e.forEach(n=>{if(n.start&&n.end){let i=`${n.start.floor}${Et}${n.start.id}`,o=`${n.end.floor}${Et}${n.end.id}`,a=this.pointMap.get(i),s=this.pointMap.get(o);a&&s&&(a.permission&&this.setPermissionLine(i,o,a.permission,10,"ramp"),s.permission&&s.permission!==a.permission&&this.setPermissionLine(i,o,s.permission,10,"ramp"))}})})}addPermissionLineToMap(e,t,n,i){let o=this.getPermissionMap(e);console.log(o),o.forEach(a=>{t.includes(a.type)&&(a.type===""?this.addLineItem(a.fromKey,a.toKey,a.distance,n):this.addLineItem(a.fromKey,a.toKey,i.get(a.type),n))})}addLineItem(e,t,n,i=this.lineMap){let o=i.get(e)||new Map;o.set(t,n),i.set(e,o)}addFacilityToLineMap(e,t,n,i){[...this.straightLadderMap,...this.staircaseMap].forEach(([o,a])=>{if(!(a.length<2))for(let s=0;s<a.length;s++){let u=`${a[s].floor}${Et}${a[s].id}`,l=this.pointMap.get(u);if(!(!l||l.permission)){for(let c=0;c<a.length;c++)if(s!==c){let f=`${a[c].floor}${Et}${a[c].id}`,p=this.pointMap.get(f);if(!p||p.permission)continue;if(a[s].type==="straightLadder"){let d=t;this.addLineItem(u,f,d,i)}else{let d=n;this.addLineItem(u,f,d,i)}}}}}),this.escalatorMap.forEach((o,a)=>{o.forEach(s=>{if(s.start&&s.end){let u=`${s.start.floor}${Et}${s.start.id}`,l=`${s.end.floor}${Et}${s.end.id}`,c=this.pointMap.get(u),f=this.pointMap.get(l);if(c&&f&&!c.permission&&!f.permission){let p=e;this.addLineItem(u,l,p,i)}}})})}initBaseRoute(){let e=new Map((0,_n.cloneDeep)([...this.lineMap]));this.addFacilityToLineMap(100,100+this.lift_priority,3e4,e),this.baseRoute=new se.default(e)}initEscalatorRoute(){let e=new Map((0,_n.cloneDeep)([...this.lineMap])),t=1e4;this.addFacilityToLineMap(1*t,this.lift_priority*t,3e4*t,e),this.escalatorRoute=new se.default(e)}initStraightLadderRoute(){let e=new Map((0,_n.cloneDeep)([...this.lineMap])),t=1e4;this.addFacilityToLineMap(3*t,1*t,3e4*t,e),this.straightLadderRoute=new se.default(e)}initForwardRoute(){this.rampMap.forEach((e,t)=>{e.forEach(n=>{if(n.start&&n.end){let i=`${n.start.floor}${Et}${n.start.id}`,o=`${n.end.floor}${Et}${n.end.id}`,a=this.pointMap.get(i),s=this.pointMap.get(o);a&&s&&!a.permission&&!s.permission&&this.addLineItem(i,o,10,this.forwardLineMap)}})}),this.forwardRoute=new se.default(this.forwardLineMap)}checkStart(e){return!(!e.floor||!e.nodeId&&(!e.coord||e.coord.length<2))}checkEnd(e){return e.facility||e.parkingSpace&&e.floor?!0:this.checkStart(e)}transformStart(e){if(e.nodeId){let t=this.nodeMap.get(`${e.floor}${Et}${e.nodeId}`);if(t){let[n,i]=t.split(Et);return{floor:n,id:i}}}if(e.coord?.length){let t=this.roadInfo.find(i=>i.floor===e.floor);if(!t)return null;let n=t.points.reduce((i,o)=>{if(o.relatedId)return i;let a=Wt(e.coord,o.cds);return a<i.min&&(i.min=a,i.point=o),i},{min:1/0,point:t.points[0]});return{floor:t.floor,id:n.point.id}}return null}transformEnd(e){if(e.floor){if(e.parkingSpace){let n=this.parkingMap.get(`${e.floor}${Et}${e.parkingSpace}`);if(n)return{floor:e.floor,id:n.id}}let t=this.transformStart(e);if(t)return t}return e.facility&&this.facilities.filter(i=>+i.type_id==+e.facility).map(i=>i.id).map(i=>this.facilityMap.get(`${i}`)).flat(2)?.length?{floor:e.floor,facility:e.facility}:null}getPath(e,t,n="",i){if(!this.checkStart(e))return"start-error";if(!this.checkEnd(t))return"end-error";let o=this.transformStart(e);if(!o)return"no-start";let a=this.transformEnd(t);if(!a)return"no-end";let s=this.getBasePath.bind(this);switch(n){case"escalator":s=this.getEscalatorPath.bind(this);break;case"straightLadder":s=this.getStraightLadderPath.bind(this);break;case"forward":s=this.getForwardPath.bind(this);break;default:s=this.getBasePath.bind(this);break}if(a.id)return s(o,a,i);if(a.facility){let l=this.facilities.filter(f=>+f.type_id==+t.facility).map(f=>f.id).map(f=>this.facilityMap.get(`${f}`)).flat(2).filter(f=>f).filter(f=>a.floor?f.floor===a.floor:!0);if(!l.length)return null;let c=l.map(f=>s(o,{floor:f.floor,id:f.id},i)).filter(f=>!!f);return c.reduce((f,p)=>{let d=p[0].consume;return d<f.distance&&(f.distance=d,f.path=p),f},{distance:1/0,path:c[0]}).path}}getRoutePath(e,t,n){let i=`${e.floor}${Et}${e.id}`,o=`${t.floor}${Et}${t.id}`,a=n.path(i,o);if(!a)return null;let s=[],u=a.reduce((l,c,f,p)=>{if(f===0)return 0;let d=p[f-1],m=n.graph.get(d).get(c);return l+m},0);return a.map(l=>{let c=this.pointMap.get(l);if(c){let{floor:f}=c,p=c.type;if(this.isFacilityByType(c.type)){let d=this.facilities.find(m=>m.id===+c.targetId);d&&(p=d.entry_infra_type)}if(s[s.length-1]?.floor===f){let d=s[s.length-1];d.points.push(c.cds),d.endType=p,d.destId=c.nodeId,d.distance=Re(d.points)}else s.push({floor:f,points:[c.cds],endType:p,destId:c.nodeId,distance:0,consume:u})}}),s}getBasePath(e,t,n){if(!n)return this.getRoutePath(e,t,this.baseRoute);let i=(0,_n.cloneDeep)(this.baseRoute.graph);this.addPermissionLineToMap(n,["","escalator","staircase","straightLadder"],i,new Map([["escalator",100],["straightLadder",100+this.lift_priority],["staircase",3e4]]));let o=new se.default(i);return this.getRoutePath(e,t,o)}getEscalatorPath(e,t,n){if(!n)return this.getRoutePath(e,t,this.escalatorRoute);let i=(0,_n.cloneDeep)(this.escalatorRoute.graph),o=1e4;this.addPermissionLineToMap(n,["","escalator","staircase","straightLadder"],i,new Map([["escalator",1*o],["straightLadder",this.lift_priority*o],["staircase",3e4*o]]));let a=new se.default(i);return this.getRoutePath(e,t,a)}getStraightLadderPath(e,t,n){if(!n)return this.getRoutePath(e,t,this.straightLadderRoute);let i=(0,_n.cloneDeep)(this.straightLadderRoute.graph),o=1e4;this.addPermissionLineToMap(n,["","escalator","staircase","straightLadder"],i,new Map([["escalator",3*o],["straightLadder",1*o],["staircase",3e4*o]]));let a=new se.default(i);return this.getRoutePath(e,t,a)}getForwardPath(e,t,n){if(!n)return this.getRoutePath(e,t,this.forwardRoute);let i=(0,_n.cloneDeep)(this.forwardRoute.graph);this.addPermissionLineToMap(n,["","ramp"],i,new Map([["ramp",10]]));let o=new se.default(i);return this.getRoutePath(e,t,o)}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 se.default,this.escalatorRoute=new se.default,this.straightLadderRoute=new se.default}};var On=class{static keySet=new Set;static createKey(){return Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)}static genUniqueKey(){let e=this.createKey();for(;this.keySet.has(e);)e=this.createKey();return e}static removeKey(e){this.keySet.delete(e)}static dispose(){this.keySet.clear()}};function Uo(r){return r.replace(/[A-Z]/g,e=>"_"+e.toLowerCase()).replace(/^_/,"")}function je(r,e,t){return new Promise((n,i)=>{let o=On.genUniqueKey(),a=({data:s})=>{s.type===`${e}_result`&&s.key===o&&(On.removeKey(o),self.removeEventListener("message",a),s.error?i(s.error):n(s.data))};r.addEventListener("message",a),r.postMessage({type:e,key:o,data:t})})}function Nf(r){let e={};for(let n in r)n.startsWith("on")&&(e[Uo(n.slice(2))]=r[n]);let t=async({data:n})=>{if(e[n.type])try{let i=await e[n.type](n.data);self.postMessage({type:`${n.type}_result`,key:n.key,data:i})}catch(i){self.postMessage({type:`${n.type}_result`,key:n.key,error:i})}else self.postMessage({type:`${n.type}_result`,key:n.key,error:"no_event"})};return self.addEventListener("message",t),()=>{self.removeEventListener("message",t)}}var We=require("three");function Lf(r,e=16711680){let t=new We.LineBasicMaterial({color:e}),n=new We.BufferGeometry().setFromPoints(r);return new We.Line(n,t)}function Uf(r,e=16711680){let t=new We.LineBasicMaterial({color:e}),n=new We.BoxGeometry(1,1,1),i=new We.Mesh(n,t);return i.position.copy(r),i}function _e(r,e,t=0){r.forEach(n=>{n.geometry.coords=JSON.parse(JSON.stringify(n.geometry.cds)),n.geometry.type==="polygon"?(n.geometry.coords.map(i=>{Array.isArray(i)&&i.forEach(o=>{o[0]-=e[0],o[1]-=e[1]})}),n.geometry.otherCds&&(n.geometry.otherCoords=n.geometry.otherCds.map(i=>i.map(o=>Ue(o,e)))),n.doors?.length&&n.doors.map(i=>{i.coord=Ue(i.coordinate,e)}),n.center&&(n.center=Ue(n.center,e))):n.geometry.coords=Ue(n.geometry.cds,e)});for(let n=0;n<r.length;n++){let i=r[n];i.deltaHeight=1e-5*(t+n+1)}}function Ue(r,e){return[r[0]-e[0],r[1]-e[1]]}var au=require("@tweenjs/tween.js"),cn=class{pauseTween=!1;tweenStore=new Set;group=new au.Group;constructor(){}update(){this.group.update()}pause(){this.pauseTween=!0,this.getAll().forEach(e=>{this.tweenStore.add(e),e.pause()})}continue(){this.pauseTween&&(this.tweenStore.forEach(e=>{e.resume()}),this.tweenStore.clear(),this.pauseTween=!1)}remove(e){this.group.remove(e)}getAll(){return this.group.getAll()}clear(){this.getAll().forEach(e=>e.stop()),this.group.removeAll()}dispose(){this.clear()}};var vt=require("three");var wu=require("three");var it=require("three");var uu=require("three/examples/jsm/lines/LineMaterial"),he=require("three");function su(r){return`${r.x}-${r.y}-${r.z}`}var qt=class{static lineMaterialMap=new Map;static meshStandardMaterialMap=new Map;static meshBasicMaterialMap=new Map;static shaderMaterialMap=new Map;static line2MaterialMap=new Map;static generateLineMaterialKey({color:e,opacity:t}){return`${e}-${t}`}static createLineMaterial({color:e,opacity:t}){let n=this.generateLineMaterialKey({color:e,opacity:t});if(this.lineMaterialMap.has(n))return this.lineMaterialMap.get(n);let i=new he.LineBasicMaterial({color:new he.Color(e).convertLinearToSRGB(),transparent:!0,opacity:t});return this.lineMaterialMap.set(n,i),i}static createMeshStandardMaterial({color:e,opacity:t}){let n=`${e}-${t}`;if(this.meshStandardMaterialMap.has(n))return this.meshStandardMaterialMap.get(n);let i=new he.MeshStandardMaterial({color:new he.Color(e).convertLinearToSRGB(),roughness:1,transparent:!0,opacity:t,depthWrite:!0});return this.meshStandardMaterialMap.set(n,i),i}static createMeshBasicMaterial({color:e,opacity:t}){let n=`${e}-${t}`;if(this.meshBasicMaterialMap.has(n))return this.meshBasicMaterialMap.get(n);let i=new he.MeshBasicMaterial({color:e,transparent:!0,opacity:t,depthWrite:!0});return this.meshBasicMaterialMap.set(n,i),i}static createShaderMaterial({gradualColor:e,center:t,maxValue:n,opacity:i,direction:o,max:a,min:s}){let u=`${e.toString()}-${su(t)}-${n}-${i}-${su(o)}`;if(this.shaderMaterialMap.has(u))return this.shaderMaterialMap.get(u);let l=`
2
2
  uniform vec3 uColor;
3
3
  uniform vec3 uGradualColor;
4
4
  uniform vec3 center;
@@ -3669,7 +3669,7 @@ void main() {
3669
3669
  #include <colorspace_fragment>
3670
3670
  #include <fog_fragment>
3671
3671
  }\`,en={alphahash_fragment:oA,alphahash_pars_fragment:sA,alphamap_fragment:aA,alphamap_pars_fragment:uA,alphatest_fragment:lA,alphatest_pars_fragment:cA,aomap_fragment:fA,aomap_pars_fragment:hA,batching_pars_vertex:pA,batching_vertex:dA,begin_vertex:gA,beginnormal_vertex:mA,bsdfs:yA,iridescence_fragment:vA,bumpmap_pars_fragment:_A,clipping_planes_fragment:xA,clipping_planes_pars_fragment:EA,clipping_planes_pars_vertex:wA,clipping_planes_vertex:MA,color_fragment:SA,color_pars_fragment:bA,color_pars_vertex:AA,color_vertex:TA,common:CA,cube_uv_reflection_fragment:IA,defaultnormal_vertex:PA,displacementmap_pars_vertex:RA,displacementmap_vertex:LA,emissivemap_fragment:NA,emissivemap_pars_fragment:DA,colorspace_fragment:OA,colorspace_pars_fragment:FA,envmap_fragment:UA,envmap_common_pars_fragment:BA,envmap_pars_fragment:zA,envmap_pars_vertex:kA,envmap_physical_pars_fragment:KA,envmap_vertex:GA,fog_vertex:HA,fog_pars_vertex:VA,fog_fragment:WA,fog_pars_fragment:qA,gradientmap_pars_fragment:XA,lightmap_pars_fragment:YA,lights_lambert_fragment:$A,lights_lambert_pars_fragment:ZA,lights_pars_begin:JA,lights_toon_fragment:QA,lights_toon_pars_fragment:jA,lights_phong_fragment:tT,lights_phong_pars_fragment:eT,lights_physical_fragment:nT,lights_physical_pars_fragment:rT,lights_fragment_begin:iT,lights_fragment_maps:oT,lights_fragment_end:sT,logdepthbuf_fragment:aT,logdepthbuf_pars_fragment:uT,logdepthbuf_pars_vertex:lT,logdepthbuf_vertex:cT,map_fragment:fT,map_pars_fragment:hT,map_particle_fragment:pT,map_particle_pars_fragment:dT,metalnessmap_fragment:gT,metalnessmap_pars_fragment:mT,morphinstance_vertex:yT,morphcolor_vertex:vT,morphnormal_vertex:_T,morphtarget_pars_vertex:xT,morphtarget_vertex:ET,normal_fragment_begin:wT,normal_fragment_maps:MT,normal_pars_fragment:ST,normal_pars_vertex:bT,normal_vertex:AT,normalmap_pars_fragment:TT,clearcoat_normal_fragment_begin:CT,clearcoat_normal_fragment_maps:IT,clearcoat_pars_fragment:PT,iridescence_pars_fragment:RT,opaque_fragment:LT,packing:NT,premultiplied_alpha_fragment:DT,project_vertex:OT,dithering_fragment:FT,dithering_pars_fragment:UT,roughnessmap_fragment:BT,roughnessmap_pars_fragment:zT,shadowmap_pars_fragment:kT,shadowmap_pars_vertex:GT,shadowmap_vertex:HT,shadowmask_pars_fragment:VT,skinbase_vertex:WT,skinning_pars_vertex:qT,skinning_vertex:XT,skinnormal_vertex:YT,specularmap_fragment:$T,specularmap_pars_fragment:ZT,tonemapping_fragment:JT,tonemapping_pars_fragment:KT,transmission_fragment:QT,transmission_pars_fragment:jT,uv_pars_fragment:tC,uv_pars_vertex:eC,uv_vertex:nC,worldpos_vertex:rC,background_vert:iC,background_frag:oC,backgroundCube_vert:sC,backgroundCube_frag:aC,cube_vert:uC,cube_frag:lC,depth_vert:cC,depth_frag:fC,distanceRGBA_vert:hC,distanceRGBA_frag:pC,equirect_vert:dC,equirect_frag:gC,linedashed_vert:mC,linedashed_frag:yC,meshbasic_vert:vC,meshbasic_frag:_C,meshlambert_vert:xC,meshlambert_frag:EC,meshmatcap_vert:wC,meshmatcap_frag:MC,meshnormal_vert:SC,meshnormal_frag:bC,meshphong_vert:AC,meshphong_frag:TC,meshphysical_vert:CC,meshphysical_frag:IC,meshtoon_vert:PC,meshtoon_frag:RC,points_vert:LC,points_frag:NC,shadow_vert:DC,shadow_frag:OC,sprite_vert:FC,sprite_frag:UC},Rt={common:{diffuse:{value:new vi(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new me},alphaMap:{value:null},alphaMapTransform:{value:new me},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new me}},envmap:{envMap:{value:null},envMapRotation:{value:new me},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new me}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new me}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new me},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new me},normalScale:{value:new Yi(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new me},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new me}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new me}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new me}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new vi(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,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 vi(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new me},alphaTest:{value:0},uvTransform:{value:new me}},sprite:{diffuse:{value:new vi(16777215)},opacity:{value:1},center:{value:new Yi(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new me},alphaMap:{value:null},alphaMapTransform:{value:new me},alphaTest:{value:0}}},I0={basic:{uniforms:_o([Rt.common,Rt.specularmap,Rt.envmap,Rt.aomap,Rt.lightmap,Rt.fog]),vertexShader:en.meshbasic_vert,fragmentShader:en.meshbasic_frag},lambert:{uniforms:_o([Rt.common,Rt.specularmap,Rt.envmap,Rt.aomap,Rt.lightmap,Rt.emissivemap,Rt.bumpmap,Rt.normalmap,Rt.displacementmap,Rt.fog,Rt.lights,{emissive:{value:new vi(0)}}]),vertexShader:en.meshlambert_vert,fragmentShader:en.meshlambert_frag},phong:{uniforms:_o([Rt.common,Rt.specularmap,Rt.envmap,Rt.aomap,Rt.lightmap,Rt.emissivemap,Rt.bumpmap,Rt.normalmap,Rt.displacementmap,Rt.fog,Rt.lights,{emissive:{value:new vi(0)},specular:{value:new vi(1118481)},shininess:{value:30}}]),vertexShader:en.meshphong_vert,fragmentShader:en.meshphong_frag},standard:{uniforms:_o([Rt.common,Rt.envmap,Rt.aomap,Rt.lightmap,Rt.emissivemap,Rt.bumpmap,Rt.normalmap,Rt.displacementmap,Rt.roughnessmap,Rt.metalnessmap,Rt.fog,Rt.lights,{emissive:{value:new vi(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:en.meshphysical_vert,fragmentShader:en.meshphysical_frag},toon:{uniforms:_o([Rt.common,Rt.aomap,Rt.lightmap,Rt.emissivemap,Rt.bumpmap,Rt.normalmap,Rt.displacementmap,Rt.gradientmap,Rt.fog,Rt.lights,{emissive:{value:new vi(0)}}]),vertexShader:en.meshtoon_vert,fragmentShader:en.meshtoon_frag},matcap:{uniforms:_o([Rt.common,Rt.bumpmap,Rt.normalmap,Rt.displacementmap,Rt.fog,{matcap:{value:null}}]),vertexShader:en.meshmatcap_vert,fragmentShader:en.meshmatcap_frag},points:{uniforms:_o([Rt.points,Rt.fog]),vertexShader:en.points_vert,fragmentShader:en.points_frag},dashed:{uniforms:_o([Rt.common,Rt.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:en.linedashed_vert,fragmentShader:en.linedashed_frag},depth:{uniforms:_o([Rt.common,Rt.displacementmap]),vertexShader:en.depth_vert,fragmentShader:en.depth_frag},normal:{uniforms:_o([Rt.common,Rt.bumpmap,Rt.normalmap,Rt.displacementmap,{opacity:{value:1}}]),vertexShader:en.meshnormal_vert,fragmentShader:en.meshnormal_frag},sprite:{uniforms:_o([Rt.sprite,Rt.fog]),vertexShader:en.sprite_vert,fragmentShader:en.sprite_frag},background:{uniforms:{uvTransform:{value:new me},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:en.background_vert,fragmentShader:en.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new me}},vertexShader:en.backgroundCube_vert,fragmentShader:en.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:en.cube_vert,fragmentShader:en.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:en.equirect_vert,fragmentShader:en.equirect_frag},distanceRGBA:{uniforms:_o([Rt.common,Rt.displacementmap,{referencePosition:{value:new En},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:en.distanceRGBA_vert,fragmentShader:en.distanceRGBA_frag},shadow:{uniforms:_o([Rt.lights,Rt.fog,{color:{value:new vi(0)},opacity:{value:1}}]),vertexShader:en.shadow_vert,fragmentShader:en.shadow_frag}};I0.physical={uniforms:_o([I0.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new me},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new me},clearcoatNormalScale:{value:new Yi(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new me},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new me},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new me},sheen:{value:0},sheenColor:{value:new vi(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new me},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new me},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new me},transmissionSamplerSize:{value:new Yi},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new me},attenuationDistance:{value:0},attenuationColor:{value:new vi(0)},specularColor:{value:new vi(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new me},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new me},anisotropyVector:{value:new Yi},anisotropyMap:{value:null},anisotropyMapTransform:{value:new me}}]),vertexShader:en.meshphysical_vert,fragmentShader:en.meshphysical_frag};var Ja=(1+Math.sqrt(5))/2,Au=1/Ja,PN=[new En(-Ja,Au,0),new En(Ja,Au,0),new En(-Au,0,Ja),new En(Au,0,Ja),new En(0,Ja,-Au),new En(0,Ja,Au),new En(-1,1,-1),new En(1,1,-1),new En(-1,1,1),new En(1,1,1)];var RN=new Float32Array(16),LN=new Float32Array(9),NN=new Float32Array(4);var DN={[e0]:n0,[r0]:a0,[o0]:u0,[i0]:s0,[n0]:e0,[a0]:r0,[u0]:o0,[s0]:i0};function Lc(o,e,r){return!o||!r&&o.constructor===e?o:typeof e.BYTES_PER_ELEMENT=="number"?new e(o):Array.prototype.slice.call(o)}function BC(o){return ArrayBuffer.isView(o)&&!(o instanceof DataView)}var Cu=class{constructor(e,r,u,l){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=l!==void 0?l:new r.constructor(u),this.sampleValues=r,this.valueSize=u,this.settings=null,this.DefaultSettings_={}}evaluate(e){let r=this.parameterPositions,u=this._cachedIndex,l=r[u],h=r[u-1];t:{e:{let p;n:{r:if(!(e<l)){for(let m=u+2;;){if(l===void 0){if(e<h)break r;return u=r.length,this._cachedIndex=u,this.copySampleValue_(u-1)}if(u===m)break;if(h=l,l=r[++u],e<l)break e}p=r.length;break n}if(!(e>=h)){let m=r[1];e<m&&(u=2,h=m);for(let y=u-2;;){if(h===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(u===y)break;if(l=h,h=r[--u-1],e>=h)break e}p=u,u=0;break n}break t}for(;u<p;){let m=u+p>>>1;e<r[m]?p=m:u=m+1}if(l=r[u],h=r[u-1],h===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(l===void 0)return u=r.length,this._cachedIndex=u,this.copySampleValue_(u-1)}this._cachedIndex=u,this.intervalChanged_(u,h,l)}return this.interpolate_(u,h,e,l)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){let r=this.resultBuffer,u=this.sampleValues,l=this.valueSize,h=e*l;for(let p=0;p!==l;++p)r[p]=u[h+p];return r}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}},jh=class extends Cu{constructor(e,r,u,l){super(e,r,u,l),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:f0,endingEnd:f0}}intervalChanged_(e,r,u){let l=this.parameterPositions,h=e-2,p=e+1,m=l[h],y=l[p];if(m===void 0)switch(this.getSettings_().endingStart){case h0:h=e,m=2*r-u;break;case p0:h=l.length-2,m=r+l[h]-l[h+1];break;default:h=e,m=u}if(y===void 0)switch(this.getSettings_().endingEnd){case h0:p=e,y=2*u-r;break;case p0:p=1,y=u+l[1]-l[0];break;default:p=e-1,y=r}let x=(u-r)*.5,E=this.valueSize;this._weightPrev=x/(r-m),this._weightNext=x/(y-u),this._offsetPrev=h*E,this._offsetNext=p*E}interpolate_(e,r,u,l){let h=this.resultBuffer,p=this.sampleValues,m=this.valueSize,y=e*m,x=y-m,E=this._offsetPrev,S=this._offsetNext,b=this._weightPrev,C=this._weightNext,R=(u-r)/(l-r),G=R*R,O=G*R,N=-b*O+2*b*G-b*R,k=(1+b)*O+(-1.5-2*b)*G+(-.5+b)*R+1,F=(-1-C)*O+(1.5+C)*G+.5*R,$=C*O-C*G;for(let Z=0;Z!==m;++Z)h[Z]=N*p[E+Z]+k*p[x+Z]+F*p[y+Z]+$*p[S+Z];return h}},tp=class extends Cu{constructor(e,r,u,l){super(e,r,u,l)}interpolate_(e,r,u,l){let h=this.resultBuffer,p=this.sampleValues,m=this.valueSize,y=e*m,x=y-m,E=(u-r)/(l-r),S=1-E;for(let b=0;b!==m;++b)h[b]=p[x+b]*S+p[y+b]*E;return h}},ep=class extends Cu{constructor(e,r,u,l){super(e,r,u,l)}interpolate_(e){return this.copySampleValue_(e-1)}},fs=class{constructor(e,r,u,l){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(r===void 0||r.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=Lc(r,this.TimeBufferType),this.values=Lc(u,this.ValueBufferType),this.setInterpolation(l||this.DefaultInterpolation)}static toJSON(e){let r=e.constructor,u;if(r.toJSON!==this.toJSON)u=r.toJSON(e);else{u={name:e.name,times:Lc(e.times,Array),values:Lc(e.values,Array)};let l=e.getInterpolation();l!==e.DefaultInterpolation&&(u.interpolation=l)}return u.type=e.ValueTypeName,u}InterpolantFactoryMethodDiscrete(e){return new ep(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new tp(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new jh(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let r;switch(e){case Nc:r=this.InterpolantFactoryMethodDiscrete;break;case $h:r=this.InterpolantFactoryMethodLinear;break;case kh:r=this.InterpolantFactoryMethodSmooth;break}if(r===void 0){let u="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(u);return console.warn("THREE.KeyframeTrack:",u),this}return this.createInterpolant=r,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Nc;case this.InterpolantFactoryMethodLinear:return $h;case this.InterpolantFactoryMethodSmooth:return kh}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){let r=this.times;for(let u=0,l=r.length;u!==l;++u)r[u]+=e}return this}scale(e){if(e!==1){let r=this.times;for(let u=0,l=r.length;u!==l;++u)r[u]*=e}return this}trim(e,r){let u=this.times,l=u.length,h=0,p=l-1;for(;h!==l&&u[h]<e;)++h;for(;p!==-1&&u[p]>r;)--p;if(++p,h!==0||p!==l){h>=p&&(p=Math.max(p,1),h=p-1);let m=this.getValueSize();this.times=u.slice(h,p),this.values=this.values.slice(h*m,p*m)}return this}validate(){let e=!0,r=this.getValueSize();r-Math.floor(r)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);let u=this.times,l=this.values,h=u.length;h===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let p=null;for(let m=0;m!==h;m++){let y=u[m];if(typeof y=="number"&&isNaN(y)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,m,y),e=!1;break}if(p!==null&&p>y){console.error("THREE.KeyframeTrack: Out of order keys.",this,m,y,p),e=!1;break}p=y}if(l!==void 0&&BC(l))for(let m=0,y=l.length;m!==y;++m){let x=l[m];if(isNaN(x)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,m,x),e=!1;break}}return e}optimize(){let e=this.times.slice(),r=this.values.slice(),u=this.getValueSize(),l=this.getInterpolation()===kh,h=e.length-1,p=1;for(let m=1;m<h;++m){let y=!1,x=e[m],E=e[m+1];if(x!==E&&(m!==1||x!==e[0]))if(l)y=!0;else{let S=m*u,b=S-u,C=S+u;for(let R=0;R!==u;++R){let G=r[S+R];if(G!==r[b+R]||G!==r[C+R]){y=!0;break}}}if(y){if(m!==p){e[p]=e[m];let S=m*u,b=p*u;for(let C=0;C!==u;++C)r[b+C]=r[S+C]}++p}}if(h>0){e[p]=e[h];for(let m=h*u,y=p*u,x=0;x!==u;++x)r[y+x]=r[m+x];++p}return p!==e.length?(this.times=e.slice(0,p),this.values=r.slice(0,p*u)):(this.times=e,this.values=r),this}clone(){let e=this.times.slice(),r=this.values.slice(),u=this.constructor,l=new u(this.name,e,r);return l.createInterpolant=this.createInterpolant,l}};fs.prototype.TimeBufferType=Float32Array;fs.prototype.ValueBufferType=Float32Array;fs.prototype.DefaultInterpolation=$h;var Ka=class extends fs{constructor(e,r,u){super(e,r,u)}};Ka.prototype.ValueTypeName="bool";Ka.prototype.ValueBufferType=Array;Ka.prototype.DefaultInterpolation=Nc;Ka.prototype.InterpolantFactoryMethodLinear=void 0;Ka.prototype.InterpolantFactoryMethodSmooth=void 0;var np=class extends fs{};np.prototype.ValueTypeName="color";var rp=class extends fs{};rp.prototype.ValueTypeName="number";var ip=class extends Cu{constructor(e,r,u,l){super(e,r,u,l)}interpolate_(e,r,u,l){let h=this.resultBuffer,p=this.sampleValues,m=this.valueSize,y=(u-r)/(l-r),x=e*m;for(let E=x+m;x!==E;x+=4)Ma.slerpFlat(h,0,p,x-m,p,x,y);return h}},Fc=class extends fs{InterpolantFactoryMethodLinear(e){return new ip(this.times,this.values,this.getValueSize(),e)}};Fc.prototype.ValueTypeName="quaternion";Fc.prototype.InterpolantFactoryMethodSmooth=void 0;var Qa=class extends fs{constructor(e,r,u){super(e,r,u)}};Qa.prototype.ValueTypeName="string";Qa.prototype.ValueBufferType=Array;Qa.prototype.DefaultInterpolation=Nc;Qa.prototype.InterpolantFactoryMethodLinear=void 0;Qa.prototype.InterpolantFactoryMethodSmooth=void 0;var op=class extends fs{};op.prototype.ValueTypeName="vector";var sp=class{constructor(e,r,u){let l=this,h=!1,p=0,m=0,y,x=[];this.onStart=void 0,this.onLoad=e,this.onProgress=r,this.onError=u,this.itemStart=function(E){m++,h===!1&&l.onStart!==void 0&&l.onStart(E,p,m),h=!0},this.itemEnd=function(E){p++,l.onProgress!==void 0&&l.onProgress(E,p,m),p===m&&(h=!1,l.onLoad!==void 0&&l.onLoad())},this.itemError=function(E){l.onError!==void 0&&l.onError(E)},this.resolveURL=function(E){return y?y(E):E},this.setURLModifier=function(E){return y=E,this},this.addHandler=function(E,S){return x.push(E,S),this},this.removeHandler=function(E){let S=x.indexOf(E);return S!==-1&&x.splice(S,2),this},this.getHandler=function(E){for(let S=0,b=x.length;S<b;S+=2){let C=x[S],R=x[S+1];if(C.global&&(C.lastIndex=0),C.test(E))return R}return null}}},zC=new sp,ap=class{constructor(e){this.manager=e!==void 0?e:zC,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,r){let u=this;return new Promise(function(l,h){u.load(e,l,r,h)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}};ap.DEFAULT_MATERIAL_NAME="__DEFAULT";var fp="\\\\[\\\\]\\\\.:\\\\/",kC=new RegExp("["+fp+"]","g"),hp="[^"+fp+"]",GC="[^"+fp.replace("\\\\.","")+"]",HC=/((?:WC+[\\/:])*)/.source.replace("WC",hp),VC=/(WCOD+)?/.source.replace("WCOD",GC),WC=/(?:\\.(WC+)(?:\\[(.+)\\])?)?/.source.replace("WC",hp),qC=/\\.(WC+)(?:\\[(.+)\\])?/.source.replace("WC",hp),XC=new RegExp("^"+HC+VC+WC+qC+"$"),YC=["material","materials","bones","map"],up=class{constructor(e,r,u){let l=u||rr.parseTrackName(r);this._targetGroup=e,this._bindings=e.subscribe_(r,l)}getValue(e,r){this.bind();let u=this._targetGroup.nCachedObjects_,l=this._bindings[u];l!==void 0&&l.getValue(e,r)}setValue(e,r){let u=this._bindings;for(let l=this._targetGroup.nCachedObjects_,h=u.length;l!==h;++l)u[l].setValue(e,r)}bind(){let e=this._bindings;for(let r=this._targetGroup.nCachedObjects_,u=e.length;r!==u;++r)e[r].bind()}unbind(){let e=this._bindings;for(let r=this._targetGroup.nCachedObjects_,u=e.length;r!==u;++r)e[r].unbind()}},rr=class o{constructor(e,r,u){this.path=r,this.parsedPath=u||o.parseTrackName(r),this.node=o.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,r,u){return e&&e.isAnimationObjectGroup?new o.Composite(e,r,u):new o(e,r,u)}static sanitizeNodeName(e){return e.replace(/\\s/g,"_").replace(kC,"")}static parseTrackName(e){let r=XC.exec(e);if(r===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);let u={nodeName:r[2],objectName:r[3],objectIndex:r[4],propertyName:r[5],propertyIndex:r[6]},l=u.nodeName&&u.nodeName.lastIndexOf(".");if(l!==void 0&&l!==-1){let h=u.nodeName.substring(l+1);YC.indexOf(h)!==-1&&(u.nodeName=u.nodeName.substring(0,l),u.objectName=h)}if(u.propertyName===null||u.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return u}static findNode(e,r){if(r===void 0||r===""||r==="."||r===-1||r===e.name||r===e.uuid)return e;if(e.skeleton){let u=e.skeleton.getBoneByName(r);if(u!==void 0)return u}if(e.children){let u=function(h){for(let p=0;p<h.length;p++){let m=h[p];if(m.name===r||m.uuid===r)return m;let y=u(m.children);if(y)return y}return null},l=u(e.children);if(l)return l}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,r){e[r]=this.targetObject[this.propertyName]}_getValue_array(e,r){let u=this.resolvedProperty;for(let l=0,h=u.length;l!==h;++l)e[r++]=u[l]}_getValue_arrayElement(e,r){e[r]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,r){this.resolvedProperty.toArray(e,r)}_setValue_direct(e,r){this.targetObject[this.propertyName]=e[r]}_setValue_direct_setNeedsUpdate(e,r){this.targetObject[this.propertyName]=e[r],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,r){this.targetObject[this.propertyName]=e[r],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,r){let u=this.resolvedProperty;for(let l=0,h=u.length;l!==h;++l)u[l]=e[r++]}_setValue_array_setNeedsUpdate(e,r){let u=this.resolvedProperty;for(let l=0,h=u.length;l!==h;++l)u[l]=e[r++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,r){let u=this.resolvedProperty;for(let l=0,h=u.length;l!==h;++l)u[l]=e[r++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,r){this.resolvedProperty[this.propertyIndex]=e[r]}_setValue_arrayElement_setNeedsUpdate(e,r){this.resolvedProperty[this.propertyIndex]=e[r],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,r){this.resolvedProperty[this.propertyIndex]=e[r],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,r){this.resolvedProperty.fromArray(e,r)}_setValue_fromArray_setNeedsUpdate(e,r){this.resolvedProperty.fromArray(e,r),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,r){this.resolvedProperty.fromArray(e,r),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,r){this.bind(),this.getValue(e,r)}_setValue_unbound(e,r){this.bind(),this.setValue(e,r)}bind(){let e=this.node,r=this.parsedPath,u=r.objectName,l=r.propertyName,h=r.propertyIndex;if(e||(e=o.findNode(this.rootNode,r.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");return}if(u){let x=r.objectIndex;switch(u){case"materials":if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let E=0;E<e.length;E++)if(e[E].name===x){x=E;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[u]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[u]}if(x!==void 0){if(e[x]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[x]}}let p=e[l];if(p===void 0){let x=r.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+x+"."+l+" but it wasn't found.",e);return}let m=this.Versioning.None;this.targetObject=e,e.needsUpdate!==void 0?m=this.Versioning.NeedsUpdate:e.matrixWorldNeedsUpdate!==void 0&&(m=this.Versioning.MatrixWorldNeedsUpdate);let y=this.BindingType.Direct;if(h!==void 0){if(l==="morphTargetInfluences"){if(!e.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[h]!==void 0&&(h=e.morphTargetDictionary[h])}y=this.BindingType.ArrayElement,this.resolvedProperty=p,this.propertyIndex=h}else p.fromArray!==void 0&&p.toArray!==void 0?(y=this.BindingType.HasFromToArray,this.resolvedProperty=p):Array.isArray(p)?(y=this.BindingType.EntireArray,this.resolvedProperty=p):this.propertyName=l;this.getValue=this.GetterByBindingType[y],this.setValue=this.SetterByBindingTypeAndVersioning[y][m]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};rr.Composite=up;rr.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};rr.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};rr.prototype.GetterByBindingType=[rr.prototype._getValue_direct,rr.prototype._getValue_array,rr.prototype._getValue_arrayElement,rr.prototype._getValue_toArray];rr.prototype.SetterByBindingTypeAndVersioning=[[rr.prototype._setValue_direct,rr.prototype._setValue_direct_setNeedsUpdate,rr.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[rr.prototype._setValue_array,rr.prototype._setValue_array_setNeedsUpdate,rr.prototype._setValue_array_setMatrixWorldNeedsUpdate],[rr.prototype._setValue_arrayElement,rr.prototype._setValue_arrayElement_setNeedsUpdate,rr.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[rr.prototype._setValue_fromArray,rr.prototype._setValue_fromArray_setNeedsUpdate,rr.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var ON=new Float32Array(1);typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:P0}}));typeof window!="undefined"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=P0);var ii=63710088e-1,BN={centimeters:ii*100,centimetres:ii*100,degrees:ii/111325,feet:ii*3.28084,inches:ii*39.37,kilometers:ii/1e3,kilometres:ii/1e3,meters:ii,metres:ii,miles:ii/1609.344,millimeters:ii*1e3,millimetres:ii*1e3,nauticalmiles:ii/1852,radians:1,yards:ii*1.0936},zN={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/ii,yards:1.0936133};function $i(o,e,r){r===void 0&&(r={});var u={type:"Feature"};return(r.id===0||r.id)&&(u.id=r.id),r.bbox&&(u.bbox=r.bbox),u.properties=e||{},u.geometry=o,u}function $n(o,e,r){if(r===void 0&&(r={}),!o)throw new Error("coordinates is required");if(!Array.isArray(o))throw new Error("coordinates must be an Array");if(o.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Ps(o[0])||!Ps(o[1]))throw new Error("coordinates must contain numbers");var u={type:"Point",coordinates:o};return $i(u,e,r)}function ir(o,e,r){r===void 0&&(r={});for(var u=0,l=o;u<l.length;u++){var h=l[u];if(h.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var p=0;p<h[h.length-1].length;p++)if(h[h.length-1][p]!==h[0][p])throw new Error("First and last Position are not equivalent.")}var m={type:"Polygon",coordinates:o};return $i(m,e,r)}function oi(o,e,r){if(r===void 0&&(r={}),o.length<2)throw new Error("coordinates must be an array of two or more positions");var u={type:"LineString",coordinates:o};return $i(u,e,r)}function pp(o,e,r){r===void 0&&(r={});var u={type:"MultiPoint",coordinates:o};return $i(u,e,r)}function Ps(o){return!isNaN(o)&&o!==null&&!Array.isArray(o)}function Gr(o,e,r){if(o!==null)for(var u,l,h,p,m,y,x,E=0,S=0,b,C=o.type,R=C==="FeatureCollection",G=C==="Feature",O=R?o.features.length:1,N=0;N<O;N++){x=R?o.features[N].geometry:G?o.geometry:o,b=x?x.type==="GeometryCollection":!1,m=b?x.geometries.length:1;for(var k=0;k<m;k++){var F=0,$=0;if(p=b?x.geometries[k]:x,p!==null){y=p.coordinates;var Z=p.type;switch(E=r&&(Z==="Polygon"||Z==="MultiPolygon")?1:0,Z){case null:break;case"Point":if(e(y,S,N,F,$)===!1)return!1;S++,F++;break;case"LineString":case"MultiPoint":for(u=0;u<y.length;u++){if(e(y[u],S,N,F,$)===!1)return!1;S++,Z==="MultiPoint"&&F++}Z==="LineString"&&F++;break;case"Polygon":case"MultiLineString":for(u=0;u<y.length;u++){for(l=0;l<y[u].length-E;l++){if(e(y[u][l],S,N,F,$)===!1)return!1;S++}Z==="MultiLineString"&&F++,Z==="Polygon"&&$++}Z==="Polygon"&&F++;break;case"MultiPolygon":for(u=0;u<y.length;u++){for($=0,l=0;l<y[u].length;l++){for(h=0;h<y[u][l].length-E;h++){if(e(y[u][l][h],S,N,F,$)===!1)return!1;S++}$++}F++}break;case"GeometryCollection":for(u=0;u<p.geometries.length;u++)if(Gr(p.geometries[u],e,r)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function O0(o,e,r,u){var l=r;return Gr(o,function(h,p,m,y,x){p===0&&r===void 0?l=h:l=e(l,h,p,m,y,x)},u),l}function Sa(o,e){var r,u,l,h,p,m,y,x,E,S,b=0,C=o.type==="FeatureCollection",R=o.type==="Feature",G=C?o.features.length:1;for(r=0;r<G;r++){for(m=C?o.features[r].geometry:R?o.geometry:o,x=C?o.features[r].properties:R?o.properties:{},E=C?o.features[r].bbox:R?o.bbox:void 0,S=C?o.features[r].id:R?o.id:void 0,y=m?m.type==="GeometryCollection":!1,p=y?m.geometries.length:1,l=0;l<p;l++){if(h=y?m.geometries[l]:m,h===null){if(e(null,b,x,E,S)===!1)return!1;continue}switch(h.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(e(h,b,x,E,S)===!1)return!1;break}case"GeometryCollection":{for(u=0;u<h.geometries.length;u++)if(e(h.geometries[u],b,x,E,S)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}b++}}function Bo(o,e){Sa(o,function(r,u,l,h,p){var m=r===null?null:r.type;switch(m){case null:case"Point":case"LineString":case"Polygon":return e($i(r,l,{bbox:h,id:p}),u,0)===!1?!1:void 0}var y;switch(m){case"MultiPoint":y="Point";break;case"MultiLineString":y="LineString";break;case"MultiPolygon":y="Polygon";break}for(var x=0;x<r.coordinates.length;x++){var E=r.coordinates[x],S={type:y,coordinates:E};if(e($i(S,l),u,x)===!1)return!1}})}function dp(o){var e=[1/0,1/0,-1/0,-1/0];return Gr(o,function(r){e[0]>r[0]&&(e[0]=r[0]),e[1]>r[1]&&(e[1]=r[1]),e[2]<r[0]&&(e[2]=r[0]),e[3]<r[1]&&(e[3]=r[1])}),e}dp.default=dp;var Zi=dp;function _i(o){if(!o)throw new Error("coord is required");if(!Array.isArray(o)){if(o.type==="Feature"&&o.geometry!==null&&o.geometry.type==="Point")return o.geometry.coordinates;if(o.type==="Point")return o.coordinates}if(Array.isArray(o)&&o.length>=2&&!Array.isArray(o[0])&&!Array.isArray(o[1]))return o;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function gp(o,e,r){if(!o)throw new Error("No feature passed");if(!r)throw new Error(".featureOf() requires a name");if(!o||o.type!=="Feature"||!o.geometry)throw new Error("Invalid input to "+r+", Feature with geometry required");if(!o.geometry||o.geometry.type!==e)throw new Error("Invalid input to "+r+": must be a "+e+", given "+o.geometry.type)}function xi(o){return o.type==="Feature"?o.geometry:o}var eI=nr(Uc(),1);var fI=nr(j0(),1);function si(o,e,r){if(r===void 0&&(r={}),!o)throw new Error("point is required");if(!e)throw new Error("polygon is required");var u=_i(o),l=xi(e),h=l.type,p=e.bbox,m=l.coordinates;if(p&&hI(u,p)===!1)return!1;h==="Polygon"&&(m=[m]);for(var y=!1,x=0;x<m.length&&!y;x++)if(ty(u,m[x][0],r.ignoreBoundary)){for(var E=!1,S=1;S<m[x].length&&!E;)ty(u,m[x][S],!r.ignoreBoundary)&&(E=!0),S++;E||(y=!0)}return y}function ty(o,e,r){var u=!1;e[0][0]===e[e.length-1][0]&&e[0][1]===e[e.length-1][1]&&(e=e.slice(0,e.length-1));for(var l=0,h=e.length-1;l<e.length;h=l++){var p=e[l][0],m=e[l][1],y=e[h][0],x=e[h][1],E=o[1]*(p-y)+m*(y-o[0])+x*(o[0]-p)===0&&(p-o[0])*(y-o[0])<=0&&(m-o[1])*(x-o[1])<=0;if(E)return!r;var S=m>o[1]!=x>o[1]&&o[0]<(y-p)*(o[1]-m)/(x-m)+p;S&&(u=!u)}return u}function hI(o,e){return e[0]<=o[0]&&e[1]<=o[1]&&e[2]>=o[0]&&e[3]>=o[1]}var ry=new ArrayBuffer(16),dO=new Float64Array(ry),gO=new Uint32Array(ry);var TI=nr(Rp(),1);var G3=function(){function o(e){this.points=e.points||[],this.duration=e.duration||1e4,this.sharpness=e.sharpness||.85,this.centers=[],this.controls=[],this.stepLength=e.stepLength||60,this.length=this.points.length,this.delay=0;for(var r=0;r<this.length;r++)this.points[r].z=this.points[r].z||0;for(var r=0;r<this.length-1;r++){var u=this.points[r],l=this.points[r+1];this.centers.push({x:(u.x+l.x)/2,y:(u.y+l.y)/2,z:(u.z+l.z)/2})}this.controls.push([this.points[0],this.points[0]]);for(var r=0;r<this.centers.length-1;r++){var h=this.points[r+1].x-(this.centers[r].x+this.centers[r+1].x)/2,p=this.points[r+1].y-(this.centers[r].y+this.centers[r+1].y)/2,m=this.points[r+1].z-(this.centers[r].y+this.centers[r+1].z)/2;this.controls.push([{x:(1-this.sharpness)*this.points[r+1].x+this.sharpness*(this.centers[r].x+h),y:(1-this.sharpness)*this.points[r+1].y+this.sharpness*(this.centers[r].y+p),z:(1-this.sharpness)*this.points[r+1].z+this.sharpness*(this.centers[r].z+m)},{x:(1-this.sharpness)*this.points[r+1].x+this.sharpness*(this.centers[r+1].x+h),y:(1-this.sharpness)*this.points[r+1].y+this.sharpness*(this.centers[r+1].y+p),z:(1-this.sharpness)*this.points[r+1].z+this.sharpness*(this.centers[r+1].z+m)}])}return this.controls.push([this.points[this.length-1],this.points[this.length-1]]),this.steps=this.cacheSteps(this.stepLength),this}return o.prototype.cacheSteps=function(e){var r=[],u=this.pos(0);r.push(0);for(var l=0;l<this.duration;l+=10){var h=this.pos(l),p=Math.sqrt((h.x-u.x)*(h.x-u.x)+(h.y-u.y)*(h.y-u.y)+(h.z-u.z)*(h.z-u.z));p>e&&(r.push(l),u=h)}return r},o.prototype.vector=function(e){var r=this.pos(e+10),u=this.pos(e-10);return{angle:180*Math.atan2(r.y-u.y,r.x-u.x)/3.14,speed:Math.sqrt((u.x-r.x)*(u.x-r.x)+(u.y-r.y)*(u.y-r.y)+(u.z-r.z)*(u.z-r.z))}},o.prototype.pos=function(e){var r=e-this.delay;r<0&&(r=0),r>this.duration&&(r=this.duration-1);var u=r/this.duration;if(u>=1)return this.points[this.length-1];var l=Math.floor((this.points.length-1)*u),h=(this.length-1)*u-l;return CI(h,this.points[l],this.controls[l][1],this.controls[l+1][0],this.points[l+1])},o}();function CI(o,e,r,u,l){var h=II(o),p={x:l.x*h[0]+u.x*h[1]+r.x*h[2]+e.x*h[3],y:l.y*h[0]+u.y*h[1]+r.y*h[2]+e.y*h[3],z:l.z*h[0]+u.z*h[1]+r.z*h[2]+e.z*h[3]};return p}function II(o){var e=o*o,r=e*o;return[r,3*e*(1-o),3*o*(1-o)*(1-o),(1-o)*(1-o)*(1-o)]}function Cl(o,e){e===void 0&&(e={});var r=Number(o[0]),u=Number(o[1]),l=Number(o[2]),h=Number(o[3]);if(o.length===6)throw new Error("@turf/bbox-polygon does not support BBox with 6 positions");var p=[r,u],m=[r,h],y=[l,h],x=[l,u];return ir([[p,x,y,m,p]],e.properties,{bbox:o,id:e.id})}function PI(o){return Cl(Zi(o))}var Lp=PI;var YI=nr(dy(),1);var xP=nr(tf(),1);var wP=nr(Uc(),1);var bP=nr(Rp(),1);var Ly=Math.PI/180,Ny=180/Math.PI,Ol=function(o,e){this.lon=o,this.lat=e,this.x=Ly*o,this.y=Ly*e};Ol.prototype.view=function(){return String(this.lon).slice(0,4)+","+String(this.lat).slice(0,4)};Ol.prototype.antipode=function(){var o=-1*this.lat,e=this.lon<0?180+this.lon:(180-this.lon)*-1;return new Ol(e,o)};var Dy=function(){this.coords=[],this.length=0};Dy.prototype.move_to=function(o){this.length++,this.coords.push(o)};var Qp=function(o){this.properties=o||{},this.geometries=[]};Qp.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 o=[],e=0;e<this.geometries.length;e++)o.push(this.geometries[e].coords);return{geometry:{type:"MultiLineString",coordinates:o},type:"Feature",properties:this.properties}};Qp.prototype.wkt=function(){for(var o="",e="LINESTRING(",r=function(h){e+=h[0]+" "+h[1]+","},u=0;u<this.geometries.length;u++){if(this.geometries[u].coords.length===0)return"LINESTRING(empty)";var l=this.geometries[u].coords;l.forEach(r),o+=e.substring(0,e.length-1)+")"}return o};var Oy=function(o,e,r){if(!o||o.x===void 0||o.y===void 0)throw new Error("GreatCircle constructor expects two args: start and end objects with x and y properties");if(!e||e.x===void 0||e.y===void 0)throw new Error("GreatCircle constructor expects two args: start and end objects with x and y properties");this.start=new Ol(o.x,o.y),this.end=new Ol(e.x,e.y),this.properties=r||{};var u=this.start.x-this.end.x,l=this.start.y-this.end.y,h=Math.pow(Math.sin(l/2),2)+Math.cos(this.start.y)*Math.cos(this.end.y)*Math.pow(Math.sin(u/2),2);if(this.g=2*Math.asin(Math.sqrt(h)),this.g===Math.PI)throw new Error("it appears "+o.view()+" and "+e.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 "+o+" and "+e)};Oy.prototype.interpolate=function(o){var e=Math.sin((1-o)*this.g)/Math.sin(this.g),r=Math.sin(o*this.g)/Math.sin(this.g),u=e*Math.cos(this.start.y)*Math.cos(this.start.x)+r*Math.cos(this.end.y)*Math.cos(this.end.x),l=e*Math.cos(this.start.y)*Math.sin(this.start.x)+r*Math.cos(this.end.y)*Math.sin(this.end.x),h=e*Math.sin(this.start.y)+r*Math.sin(this.end.y),p=Ny*Math.atan2(h,Math.sqrt(Math.pow(u,2)+Math.pow(l,2))),m=Ny*Math.atan2(l,u);return[m,p]};Oy.prototype.Arc=function(o,e){var r=[];if(!o||o<=2)r.push([this.start.lon,this.start.lat]),r.push([this.end.lon,this.end.lat]);else for(var u=1/(o-1),l=0;l<o;++l){var h=u*l,p=this.interpolate(h);r.push(p)}for(var m=!1,y=0,x=e&&e.offset?e.offset:10,E=180-x,S=-180+x,b=360-x,C=1;C<r.length;++C){var R=r[C-1][0],G=r[C][0],O=Math.abs(G-R);O>b&&(G>E&&R<S||R>E&&G<S)?m=!0:O>y&&(y=O)}var N=[];if(m&&y<x){var k=[];N.push(k);for(var F=0;F<r.length;++F){var $=parseFloat(r[F][0]);if(F>0&&Math.abs($-r[F-1][0])>b){var Z=parseFloat(r[F-1][0]),it=parseFloat(r[F-1][1]),et=parseFloat(r[F][0]),U=parseFloat(r[F][1]);if(Z>-180&&Z<S&&et===180&&F+1<r.length&&r[F-1][0]>-180&&r[F-1][0]<S){k.push([-180,r[F][1]]),F++,k.push([r[F][0],r[F][1]]);continue}else if(Z>E&&Z<180&&et===-180&&F+1<r.length&&r[F-1][0]>E&&r[F-1][0]<180){k.push([180,r[F][1]]),F++,k.push([r[F][0],r[F][1]]);continue}if(Z<S&&et>E){var wt=Z;Z=et,et=wt;var Lt=it;it=U,U=Lt}if(Z>E&&et<S&&(et+=360),Z<=180&&et>=180&&Z<et){var Ot=(180-Z)/(et-Z),W=Ot*U+(1-Ot)*it;k.push([r[F-1][0]>E?180:-180,W]),k=[],k.push([r[F-1][0]>E?-180:180,W]),N.push(k)}else k=[],N.push(k);k.push([$,r[F][1]])}else k.push([r[F][0],r[F][1]])}}else{var de=[];N.push(de);for(var yt=0;yt<r.length;++yt)de.push([r[yt][0],r[yt][1]])}for(var zt=new Qp(this.properties),Kt=0;Kt<N.length;++Kt){var ie=new Dy;zt.geometries.push(ie);for(var _t=N[Kt],Pt=0;Pt<_t.length;++Pt)ie.move_to(_t[Pt])}return zt};var CP=nr(tf(),1);var aL=nr(tf(),1);var uL=nr(xd(),1);var fL=nr(Uc(),1);var ye=[],ve=[],_e=[],xe=[],Ee=[],we=[],Me=[],Se=[],be=[],Ae=[],Te=[],Ce=[],Ie=[],Pe=[],Re=[],Le=[],Ne=[],De=[],Oe=[],Fe=[],Ue=[],Be=[],ze=[],ke=[];Me[85]=Ae[85]=-1;Se[85]=Te[85]=0;be[85]=Ce[85]=1;Oe[85]=Be[85]=1;Fe[85]=ze[85]=0;Ue[85]=ke[85]=1;ye[85]=xe[85]=0;ve[85]=Ee[85]=-1;_e[85]=Re[85]=0;Le[85]=Ie[85]=0;Ne[85]=Pe[85]=1;we[85]=De[85]=1;Be[1]=Be[169]=0;ze[1]=ze[169]=-1;ke[1]=ke[169]=0;Ie[1]=Ie[169]=-1;Pe[1]=Pe[169]=0;Re[1]=Re[169]=0;Ae[4]=Ae[166]=0;Te[4]=Te[166]=-1;Ce[4]=Ce[166]=1;Le[4]=Le[166]=1;Ne[4]=Ne[166]=0;De[4]=De[166]=0;Me[16]=Me[154]=0;Se[16]=Se[154]=1;be[16]=be[154]=1;xe[16]=xe[154]=1;Ee[16]=Ee[154]=0;we[16]=we[154]=1;Oe[64]=Oe[106]=0;Fe[64]=Fe[106]=1;Ue[64]=Ue[106]=0;ye[64]=ye[106]=-1;ve[64]=ve[106]=0;_e[64]=_e[106]=1;Oe[2]=Oe[168]=0;Fe[2]=Fe[168]=-1;Ue[2]=Ue[168]=1;Be[2]=Be[168]=0;ze[2]=ze[168]=-1;ke[2]=ke[168]=0;Ie[2]=Ie[168]=-1;Pe[2]=Pe[168]=0;Re[2]=Re[168]=0;Le[2]=Le[168]=-1;Ne[2]=Ne[168]=0;De[2]=De[168]=1;Me[8]=Me[162]=0;Se[8]=Se[162]=-1;be[8]=be[162]=0;Ae[8]=Ae[162]=0;Te[8]=Te[162]=-1;Ce[8]=Ce[162]=1;Ie[8]=Ie[162]=1;Pe[8]=Pe[162]=0;Re[8]=Re[162]=1;Le[8]=Le[162]=1;Ne[8]=Ne[162]=0;De[8]=De[162]=0;Me[32]=Me[138]=0;Se[32]=Se[138]=1;be[32]=be[138]=1;Ae[32]=Ae[138]=0;Te[32]=Te[138]=1;Ce[32]=Ce[138]=0;ye[32]=ye[138]=1;ve[32]=ve[138]=0;_e[32]=_e[138]=0;xe[32]=xe[138]=1;Ee[32]=Ee[138]=0;we[32]=we[138]=1;Be[128]=Be[42]=0;ze[128]=ze[42]=1;ke[128]=ke[42]=1;Oe[128]=Oe[42]=0;Fe[128]=Fe[42]=1;Ue[128]=Ue[42]=0;ye[128]=ye[42]=-1;ve[128]=ve[42]=0;_e[128]=_e[42]=1;xe[128]=xe[42]=-1;Ee[128]=Ee[42]=0;we[128]=we[42]=0;Ae[5]=Ae[165]=-1;Te[5]=Te[165]=0;Ce[5]=Ce[165]=0;Be[5]=Be[165]=1;ze[5]=ze[165]=0;ke[5]=ke[165]=0;Le[20]=Le[150]=0;Ne[20]=Ne[150]=1;De[20]=De[150]=1;xe[20]=xe[150]=0;Ee[20]=Ee[150]=-1;we[20]=we[150]=1;Me[80]=Me[90]=-1;Se[80]=Se[90]=0;be[80]=be[90]=1;Oe[80]=Oe[90]=1;Fe[80]=Fe[90]=0;Ue[80]=Ue[90]=1;Ie[65]=Ie[105]=0;Pe[65]=Pe[105]=1;Re[65]=Re[105]=0;ye[65]=ye[105]=0;ve[65]=ve[105]=-1;_e[65]=_e[105]=0;Me[160]=Me[10]=-1;Se[160]=Se[10]=0;be[160]=be[10]=1;Ae[160]=Ae[10]=-1;Te[160]=Te[10]=0;Ce[160]=Ce[10]=0;Be[160]=Be[10]=1;ze[160]=ze[10]=0;ke[160]=ke[10]=0;Oe[160]=Oe[10]=1;Fe[160]=Fe[10]=0;Ue[160]=Ue[10]=1;Le[130]=Le[40]=0;Ne[130]=Ne[40]=1;De[130]=De[40]=1;Ie[130]=Ie[40]=0;Pe[130]=Pe[40]=1;Re[130]=Re[40]=0;ye[130]=ye[40]=0;ve[130]=ve[40]=-1;_e[130]=_e[40]=0;xe[130]=xe[40]=0;Ee[130]=Ee[40]=-1;we[130]=we[40]=1;Ae[37]=Ae[133]=0;Te[37]=Te[133]=1;Ce[37]=Ce[133]=1;Be[37]=Be[133]=0;ze[37]=ze[133]=1;ke[37]=ke[133]=0;ye[37]=ye[133]=-1;ve[37]=ve[133]=0;_e[37]=_e[133]=0;xe[37]=xe[133]=1;Ee[37]=Ee[133]=0;we[37]=we[133]=0;Le[148]=Le[22]=-1;Ne[148]=Ne[22]=0;De[148]=De[22]=0;Be[148]=Be[22]=0;ze[148]=ze[22]=-1;ke[148]=ke[22]=1;Oe[148]=Oe[22]=0;Fe[148]=Fe[22]=1;Ue[148]=Ue[22]=1;xe[148]=xe[22]=-1;Ee[148]=Ee[22]=0;we[148]=we[22]=1;Me[82]=Me[88]=0;Se[82]=Se[88]=-1;be[82]=be[88]=1;Le[82]=Le[88]=1;Ne[82]=Ne[88]=0;De[82]=De[88]=1;Ie[82]=Ie[88]=-1;Pe[82]=Pe[88]=0;Re[82]=Re[88]=1;Oe[82]=Oe[88]=0;Fe[82]=Fe[88]=-1;Ue[82]=Ue[88]=0;Me[73]=Me[97]=0;Se[73]=Se[97]=1;be[73]=be[97]=0;Ae[73]=Ae[97]=0;Te[73]=Te[97]=-1;Ce[73]=Ce[97]=0;Ie[73]=Ie[97]=1;Pe[73]=Pe[97]=0;Re[73]=Re[97]=0;ye[73]=ye[97]=1;ve[73]=ve[97]=0;_e[73]=_e[97]=1;Me[145]=Me[25]=0;Se[145]=Se[25]=-1;be[145]=be[25]=0;Ie[145]=Ie[25]=1;Pe[145]=Pe[25]=0;Re[145]=Re[25]=1;Be[145]=Be[25]=0;ze[145]=ze[25]=1;ke[145]=ke[25]=1;xe[145]=xe[25]=-1;Ee[145]=Ee[25]=0;we[145]=we[25]=0;Ae[70]=Ae[100]=0;Te[70]=Te[100]=1;Ce[70]=Ce[100]=0;Le[70]=Le[100]=-1;Ne[70]=Ne[100]=0;De[70]=De[100]=1;Oe[70]=Oe[100]=0;Fe[70]=Fe[100]=-1;Ue[70]=Ue[100]=1;ye[70]=ye[100]=1;ve[70]=ve[100]=0;_e[70]=_e[100]=0;Ae[101]=Ae[69]=0;Te[101]=Te[69]=1;Ce[101]=Ce[69]=0;ye[101]=ye[69]=1;ve[101]=ve[69]=0;_e[101]=_e[69]=0;Be[149]=Be[21]=0;ze[149]=ze[21]=1;ke[149]=ke[21]=1;xe[149]=xe[21]=-1;Ee[149]=Ee[21]=0;we[149]=we[21]=0;Le[86]=Le[84]=-1;Ne[86]=Ne[84]=0;De[86]=De[84]=1;Oe[86]=Oe[84]=0;Fe[86]=Fe[84]=-1;Ue[86]=Ue[84]=1;Me[89]=Me[81]=0;Se[89]=Se[81]=-1;be[89]=be[81]=0;Ie[89]=Ie[81]=1;Pe[89]=Pe[81]=0;Re[89]=Re[81]=1;Me[96]=Me[74]=0;Se[96]=Se[74]=1;be[96]=be[74]=0;Ae[96]=Ae[74]=-1;Te[96]=Te[74]=0;Ce[96]=Ce[74]=1;Oe[96]=Oe[74]=1;Fe[96]=Fe[74]=0;Ue[96]=Ue[74]=0;ye[96]=ye[74]=1;ve[96]=ve[74]=0;_e[96]=_e[74]=1;Me[24]=Me[146]=0;Se[24]=Se[146]=-1;be[24]=be[146]=1;Le[24]=Le[146]=1;Ne[24]=Ne[146]=0;De[24]=De[146]=1;Ie[24]=Ie[146]=0;Pe[24]=Pe[146]=1;Re[24]=Re[146]=1;xe[24]=xe[146]=0;Ee[24]=Ee[146]=-1;we[24]=we[146]=0;Ae[6]=Ae[164]=-1;Te[6]=Te[164]=0;Ce[6]=Ce[164]=1;Le[6]=Le[164]=-1;Ne[6]=Ne[164]=0;De[6]=De[164]=0;Be[6]=Be[164]=0;ze[6]=ze[164]=-1;ke[6]=ke[164]=1;Oe[6]=Oe[164]=1;Fe[6]=Fe[164]=0;Ue[6]=Ue[164]=0;Ie[129]=Ie[41]=0;Pe[129]=Pe[41]=1;Re[129]=Re[41]=1;Be[129]=Be[41]=0;ze[129]=ze[41]=1;ke[129]=ke[41]=0;ye[129]=ye[41]=-1;ve[129]=ve[41]=0;_e[129]=_e[41]=0;xe[129]=xe[41]=0;Ee[129]=Ee[41]=-1;we[129]=we[41]=0;Le[66]=Le[104]=0;Ne[66]=Ne[104]=1;De[66]=De[104]=0;Ie[66]=Ie[104]=-1;Pe[66]=Pe[104]=0;Re[66]=Re[104]=1;Oe[66]=Oe[104]=0;Fe[66]=Fe[104]=-1;Ue[66]=Ue[104]=0;ye[66]=ye[104]=0;ve[66]=ve[104]=-1;_e[66]=_e[104]=1;Me[144]=Me[26]=-1;Se[144]=Se[26]=0;be[144]=be[26]=0;Be[144]=Be[26]=1;ze[144]=ze[26]=0;ke[144]=ke[26]=1;Oe[144]=Oe[26]=0;Fe[144]=Fe[26]=1;Ue[144]=Ue[26]=1;xe[144]=xe[26]=-1;Ee[144]=Ee[26]=0;we[144]=we[26]=1;Ae[36]=Ae[134]=0;Te[36]=Te[134]=1;Ce[36]=Ce[134]=1;Le[36]=Le[134]=0;Ne[36]=Ne[134]=1;De[36]=De[134]=0;ye[36]=ye[134]=0;ve[36]=ve[134]=-1;_e[36]=_e[134]=1;xe[36]=xe[134]=1;Ee[36]=Ee[134]=0;we[36]=we[134]=0;Me[9]=Me[161]=-1;Se[9]=Se[161]=0;be[9]=be[161]=0;Ae[9]=Ae[161]=0;Te[9]=Te[161]=-1;Ce[9]=Ce[161]=0;Ie[9]=Ie[161]=1;Pe[9]=Pe[161]=0;Re[9]=Re[161]=0;Be[9]=Be[161]=1;ze[9]=ze[161]=0;ke[9]=ke[161]=1;Me[136]=0;Se[136]=1;be[136]=1;Ae[136]=0;Te[136]=1;Ce[136]=0;Le[136]=-1;Ne[136]=0;De[136]=1;Ie[136]=-1;Pe[136]=0;Re[136]=0;Be[136]=0;ze[136]=-1;ke[136]=0;Oe[136]=0;Fe[136]=-1;Ue[136]=1;ye[136]=1;ve[136]=0;_e[136]=0;xe[136]=1;Ee[136]=0;we[136]=1;Me[34]=0;Se[34]=-1;be[34]=0;Ae[34]=0;Te[34]=-1;Ce[34]=1;Le[34]=1;Ne[34]=0;De[34]=0;Ie[34]=1;Pe[34]=0;Re[34]=1;Be[34]=0;ze[34]=1;ke[34]=1;Oe[34]=0;Fe[34]=1;Ue[34]=0;ye[34]=-1;ve[34]=0;_e[34]=1;xe[34]=-1;Ee[34]=0;we[34]=0;Me[35]=0;Se[35]=1;be[35]=1;Ae[35]=0;Te[35]=-1;Ce[35]=1;Le[35]=1;Ne[35]=0;De[35]=0;Ie[35]=-1;Pe[35]=0;Re[35]=0;Be[35]=0;ze[35]=-1;ke[35]=0;Oe[35]=0;Fe[35]=1;Ue[35]=0;ye[35]=-1;ve[35]=0;_e[35]=1;xe[35]=1;Ee[35]=0;we[35]=1;Me[153]=0;Se[153]=1;be[153]=1;Ie[153]=-1;Pe[153]=0;Re[153]=0;Be[153]=0;ze[153]=-1;ke[153]=0;xe[153]=1;Ee[153]=0;we[153]=1;Ae[102]=0;Te[102]=-1;Ce[102]=1;Le[102]=1;Ne[102]=0;De[102]=0;Oe[102]=0;Fe[102]=1;Ue[102]=0;ye[102]=-1;ve[102]=0;_e[102]=1;Me[155]=0;Se[155]=-1;be[155]=0;Ie[155]=1;Pe[155]=0;Re[155]=1;Be[155]=0;ze[155]=1;ke[155]=1;xe[155]=-1;Ee[155]=0;we[155]=0;Ae[103]=0;Te[103]=1;Ce[103]=0;Le[103]=-1;Ne[103]=0;De[103]=1;Oe[103]=0;Fe[103]=-1;Ue[103]=1;ye[103]=1;ve[103]=0;_e[103]=0;Me[152]=0;Se[152]=1;be[152]=1;Le[152]=-1;Ne[152]=0;De[152]=1;Ie[152]=-1;Pe[152]=0;Re[152]=0;Be[152]=0;ze[152]=-1;ke[152]=0;Oe[152]=0;Fe[152]=-1;Ue[152]=1;xe[152]=1;Ee[152]=0;we[152]=1;Me[156]=0;Se[156]=-1;be[156]=1;Le[156]=1;Ne[156]=0;De[156]=1;Ie[156]=-1;Pe[156]=0;Re[156]=0;Be[156]=0;ze[156]=-1;ke[156]=0;Oe[156]=0;Fe[156]=1;Ue[156]=1;xe[156]=-1;Ee[156]=0;we[156]=1;Me[137]=0;Se[137]=1;be[137]=1;Ae[137]=0;Te[137]=1;Ce[137]=0;Ie[137]=-1;Pe[137]=0;Re[137]=0;Be[137]=0;ze[137]=-1;ke[137]=0;ye[137]=1;ve[137]=0;_e[137]=0;xe[137]=1;Ee[137]=0;we[137]=1;Me[139]=0;Se[139]=1;be[139]=1;Ae[139]=0;Te[139]=-1;Ce[139]=0;Ie[139]=1;Pe[139]=0;Re[139]=0;Be[139]=0;ze[139]=1;ke[139]=0;ye[139]=-1;ve[139]=0;_e[139]=0;xe[139]=1;Ee[139]=0;we[139]=1;Me[98]=0;Se[98]=-1;be[98]=0;Ae[98]=0;Te[98]=-1;Ce[98]=1;Le[98]=1;Ne[98]=0;De[98]=0;Ie[98]=1;Pe[98]=0;Re[98]=1;Oe[98]=0;Fe[98]=1;Ue[98]=0;ye[98]=-1;ve[98]=0;_e[98]=1;Me[99]=0;Se[99]=1;be[99]=0;Ae[99]=0;Te[99]=-1;Ce[99]=1;Le[99]=1;Ne[99]=0;De[99]=0;Ie[99]=-1;Pe[99]=0;Re[99]=1;Oe[99]=0;Fe[99]=-1;Ue[99]=0;ye[99]=1;ve[99]=0;_e[99]=1;Ae[38]=0;Te[38]=-1;Ce[38]=1;Le[38]=1;Ne[38]=0;De[38]=0;Be[38]=0;ze[38]=1;ke[38]=1;Oe[38]=0;Fe[38]=1;Ue[38]=0;ye[38]=-1;ve[38]=0;_e[38]=1;xe[38]=-1;Ee[38]=0;we[38]=0;Ae[39]=0;Te[39]=1;Ce[39]=1;Le[39]=-1;Ne[39]=0;De[39]=0;Be[39]=0;ze[39]=-1;ke[39]=1;Oe[39]=0;Fe[39]=1;Ue[39]=0;ye[39]=-1;ve[39]=0;_e[39]=1;xe[39]=1;Ee[39]=0;we[39]=0;var Ed=function(o){return[[o.bottomleft,0],[0,0],[0,o.leftbottom]]},wd=function(o){return[[1,o.rightbottom],[1,0],[o.bottomright,0]]},Md=function(o){return[[o.topright,1],[1,1],[1,o.righttop]]},Sd=function(o){return[[0,o.lefttop],[0,1],[o.topleft,1]]},bd=function(o){return[[o.bottomright,0],[o.bottomleft,0],[0,o.leftbottom],[0,o.lefttop]]},Ad=function(o){return[[o.bottomright,0],[o.bottomleft,0],[1,o.righttop],[1,o.rightbottom]]},Td=function(o){return[[1,o.righttop],[1,o.rightbottom],[o.topleft,1],[o.topright,1]]},Cd=function(o){return[[0,o.leftbottom],[0,o.lefttop],[o.topleft,1],[o.topright,1]]},hL=function(o){return[[0,0],[0,o.leftbottom],[1,o.rightbottom],[1,0]]},pL=function(o){return[[1,0],[o.bottomright,0],[o.topright,1],[1,1]]},dL=function(o){return[[1,1],[1,o.righttop],[0,o.lefttop],[0,1]]},gL=function(o){return[[o.bottomleft,0],[0,0],[0,1],[o.topleft,1]]},mL=function(o){return[[1,o.righttop],[1,o.rightbottom],[0,o.leftbottom],[0,o.lefttop]]},yL=function(o){return[[o.topleft,1],[o.topright,1],[o.bottomright,0],[o.bottomleft,0]]},vL=function(){return[[0,0],[0,1],[1,1],[1,0]]},_L=function(o){return[[1,o.rightbottom],[1,0],[0,0],[0,1],[o.topleft,1]]},xL=function(o){return[[o.topright,1],[1,1],[1,0],[0,0],[0,o.leftbottom]]},EL=function(o){return[[1,0],[o.bottomright,0],[0,o.lefttop],[0,1],[1,1]]},wL=function(o){return[[1,1],[1,o.righttop],[o.bottomleft,0],[0,0],[0,1]]},ML=function(o){return[[1,o.righttop],[1,o.rightbottom],[0,o.lefttop],[0,1],[o.topleft,1]]},SL=function(o){return[[1,1],[1,o.righttop],[o.bottomright,0],[o.bottomleft,0],[o.topright,1]]},bL=function(o){return[[1,o.rightbottom],[1,0],[o.bottomright,0],[0,o.leftbottom],[0,o.lefttop]]},AL=function(o){return[[o.topright,1],[o.bottomleft,0],[0,0],[0,o.leftbottom],[o.topleft,1]]},TL=function(o){return[[o.bottomright,0],[o.bottomleft,0],[0,o.lefttop],[0,1],[o.topleft,1]]},CL=function(o){return[[1,1],[1,o.righttop],[0,o.leftbottom],[0,o.lefttop],[o.topright,1]]},IL=function(o){return[[1,o.rightbottom],[1,0],[o.bottomright,0],[o.topleft,1],[o.topright,1]]},PL=function(o){return[[1,o.righttop],[1,o.rightbottom],[o.bottomleft,0],[0,0],[0,o.leftbottom]]},RL=function(o){return[[1,o.rightbottom],[1,0],[0,0],[0,o.leftbottom],[o.topleft,1],[o.topright,1]]},LL=function(o){return[[1,1],[1,0],[o.bottomright,0],[0,o.leftbottom],[0,o.lefttop],[o.topright,1]]},NL=function(o){return[[1,1],[1,o.righttop],[o.bottomright,0],[o.bottomleft,0],[0,o.lefttop],[0,1]]},DL=function(o){return[[1,o.righttop],[1,o.rightbottom],[o.bottomleft,0],[0,0],[0,1],[o.topleft,1]]},OL=function(o){return[[1,1],[1,o.righttop],[o.bottomleft,0],[0,0],[0,o.leftbottom],[o.topright,1]]},FL=function(o){return[[1,o.rightbottom],[1,0],[o.bottomright,0],[0,o.lefttop],[0,1],[o.topleft,1]]},UL=function(o){return[[1,o.righttop],[1,o.rightbottom],[o.bottomright,0],[o.bottomleft,0],[0,o.leftbottom],[0,o.lefttop],[o.topleft,1],[o.topright,1]]},BL=function(o){return[[1,1],[1,o.righttop],[o.bottomleft,0],[0,0],[0,o.leftbottom],[o.topright,1]]},zL=function(o){return[[1,o.rightbottom],[1,0],[o.bottomright,0],[0,o.lefttop],[0,1],[o.topleft,1]]},kL=function(o){return[[1,1],[1,o.righttop],[o.bottomright,0],[o.bottomleft,0],[0,o.leftbottom],[0,o.lefttop],[o.topright,1]]},GL=function(o){return[[1,o.righttop],[1,o.rightbottom],[o.bottomleft,0],[0,0],[0,o.leftbottom],[o.topleft,1],[o.topright,1]]},HL=function(o){return[[1,o.righttop],[1,o.rightbottom],[o.bottomright,0],[o.bottomleft,0],[0,o.lefttop],[0,1],[o.topleft,1]]},VL=function(o){return[[1,o.rightbottom],[1,0],[o.bottomright,0],[0,o.leftbottom],[0,o.lefttop],[o.topleft,1],[o.topright,1]]},Xe=[],Ye=[],$e=[],Ze=[],Je=[],Ke=[],Qe=[],je=[];Ze[1]=Je[1]=18;Ze[169]=Je[169]=18;$e[4]=Ye[4]=12;$e[166]=Ye[166]=12;Xe[16]=je[16]=4;Xe[154]=je[154]=4;Ke[64]=Qe[64]=22;Ke[106]=Qe[106]=22;$e[2]=Ke[2]=17;Ze[2]=Je[2]=18;$e[168]=Ke[168]=17;Ze[168]=Je[168]=18;Xe[8]=Ze[8]=9;Ye[8]=$e[8]=12;Xe[162]=Ze[162]=9;Ye[162]=$e[162]=12;Xe[32]=je[32]=4;Ye[32]=Qe[32]=1;Xe[138]=je[138]=4;Ye[138]=Qe[138]=1;Je[128]=je[128]=21;Ke[128]=Qe[128]=22;Je[42]=je[42]=21;Ke[42]=Qe[42]=22;Ye[5]=Je[5]=14;Ye[165]=Je[165]=14;$e[20]=je[20]=6;$e[150]=je[150]=6;Xe[80]=Ke[80]=11;Xe[90]=Ke[90]=11;Ze[65]=Qe[65]=3;Ze[105]=Qe[105]=3;Xe[160]=Ke[160]=11;Ye[160]=Je[160]=14;Xe[10]=Ke[10]=11;Ye[10]=Je[10]=14;$e[130]=je[130]=6;Ze[130]=Qe[130]=3;$e[40]=je[40]=6;Ze[40]=Qe[40]=3;Ye[101]=Qe[101]=1;Ye[69]=Qe[69]=1;Je[149]=je[149]=21;Je[21]=je[21]=21;$e[86]=Ke[86]=17;$e[84]=Ke[84]=17;Xe[89]=Ze[89]=9;Xe[81]=Ze[81]=9;Xe[96]=Qe[96]=0;Ye[96]=Ke[96]=15;Xe[74]=Qe[74]=0;Ye[74]=Ke[74]=15;Xe[24]=$e[24]=8;Ze[24]=je[24]=7;Xe[146]=$e[146]=8;Ze[146]=je[146]=7;Ye[6]=Ke[6]=15;$e[6]=Je[6]=16;Ye[164]=Ke[164]=15;$e[164]=Je[164]=16;Ze[129]=je[129]=7;Je[129]=Qe[129]=20;Ze[41]=je[41]=7;Je[41]=Qe[41]=20;$e[66]=Qe[66]=2;Ze[66]=Ke[66]=19;$e[104]=Qe[104]=2;Ze[104]=Ke[104]=19;Xe[144]=Je[144]=10;Ke[144]=je[144]=23;Xe[26]=Je[26]=10;Ke[26]=je[26]=23;Ye[36]=je[36]=5;$e[36]=Qe[36]=2;Ye[134]=je[134]=5;$e[134]=Qe[134]=2;Xe[9]=Je[9]=10;Ye[9]=Ze[9]=13;Xe[161]=Je[161]=10;Ye[161]=Ze[161]=13;Ye[37]=je[37]=5;Je[37]=Qe[37]=20;Ye[133]=je[133]=5;Je[133]=Qe[133]=20;$e[148]=Je[148]=16;Ke[148]=je[148]=23;$e[22]=Je[22]=16;Ke[22]=je[22]=23;Xe[82]=$e[82]=8;Ze[82]=Ke[82]=19;Xe[88]=$e[88]=8;Ze[88]=Ke[88]=19;Xe[73]=Qe[73]=0;Ye[73]=Ze[73]=13;Xe[97]=Qe[97]=0;Ye[97]=Ze[97]=13;Xe[145]=Ze[145]=9;Je[145]=je[145]=21;Xe[25]=Ze[25]=9;Je[25]=je[25]=21;Ye[70]=Qe[70]=1;$e[70]=Ke[70]=17;Ye[100]=Qe[100]=1;$e[100]=Ke[100]=17;Xe[34]=Ze[34]=9;Ye[34]=$e[34]=12;Je[34]=je[34]=21;Ke[34]=Qe[34]=22;Xe[136]=je[136]=4;Ye[136]=Qe[136]=1;$e[136]=Ke[136]=17;Ze[136]=Je[136]=18;Xe[35]=je[35]=4;Ye[35]=$e[35]=12;Ze[35]=Je[35]=18;Ke[35]=Qe[35]=22;Xe[153]=je[153]=4;Ze[153]=Je[153]=18;Ye[102]=$e[102]=12;Ke[102]=Qe[102]=22;Xe[155]=Ze[155]=9;Je[155]=je[155]=23;Ye[103]=Qe[103]=1;$e[103]=Ke[103]=17;Xe[152]=je[152]=4;$e[152]=Ke[152]=17;Ze[152]=Je[152]=18;Xe[156]=$e[156]=8;Ze[156]=Je[156]=18;Ke[156]=je[156]=23;Xe[137]=je[137]=4;Ye[137]=Qe[137]=1;Ze[137]=Je[137]=18;Xe[139]=je[139]=4;Ye[139]=Ze[139]=13;Je[139]=Qe[139]=20;Xe[98]=Ze[98]=9;Ye[98]=$e[98]=12;Ke[98]=Qe[98]=22;Xe[99]=Qe[99]=0;Ye[99]=$e[99]=12;Ze[99]=Ke[99]=19;Ye[38]=$e[38]=12;Je[38]=je[38]=21;Ke[38]=Qe[38]=22;Ye[39]=je[39]=5;$e[39]=Je[39]=16;Ke[39]=Qe[39]=22;var St=[];St[1]=St[169]=Ed;St[4]=St[166]=wd;St[16]=St[154]=Md;St[64]=St[106]=Sd;St[168]=St[2]=bd;St[162]=St[8]=Ad;St[138]=St[32]=Td;St[42]=St[128]=Cd;St[5]=St[165]=hL;St[20]=St[150]=pL;St[80]=St[90]=dL;St[65]=St[105]=gL;St[160]=St[10]=mL;St[130]=St[40]=yL;St[85]=vL;St[101]=St[69]=_L;St[149]=St[21]=xL;St[86]=St[84]=EL;St[89]=St[81]=wL;St[96]=St[74]=ML;St[24]=St[146]=SL;St[6]=St[164]=bL;St[129]=St[41]=AL;St[66]=St[104]=TL;St[144]=St[26]=CL;St[36]=St[134]=IL;St[9]=St[161]=PL;St[37]=St[133]=RL;St[148]=St[22]=LL;St[82]=St[88]=NL;St[73]=St[97]=DL;St[145]=St[25]=OL;St[70]=St[100]=FL;St[34]=function(o){return[Cd(o),Ad(o)]};St[35]=UL;St[136]=function(o){return[Td(o),bd(o)]};St[153]=function(o){return[Md(o),Ed(o)]};St[102]=function(o){return[wd(o),Sd(o)]};St[155]=BL;St[103]=zL;St[152]=function(o){return[Md(o),bd(o)]};St[156]=kL;St[137]=function(o){return[Td(o),Ed(o)]};St[139]=GL;St[98]=function(o){return[Ad(o),Sd(o)]};St[99]=HL;St[38]=function(o){return[wd(o),Cd(o)]};St[39]=VL;function qL(o){return(o>0)-(o<0)||+o}function Wu(o,e,r){var u=e[0]-o[0],l=e[1]-o[1],h=r[0]-e[0],p=r[1]-e[1];return qL(u*p-h*l)}function G_(o,e){var r=o.geometry.coordinates[0].map(function(p){return p[0]}),u=o.geometry.coordinates[0].map(function(p){return p[1]}),l=e.geometry.coordinates[0].map(function(p){return p[0]}),h=e.geometry.coordinates[0].map(function(p){return p[1]});return Math.max.apply(null,r)===Math.max.apply(null,l)&&Math.max.apply(null,u)===Math.max.apply(null,h)&&Math.min.apply(null,r)===Math.min.apply(null,l)&&Math.min.apply(null,u)===Math.min.apply(null,h)}function Id(o,e){return e.geometry.coordinates[0].every(function(r){return si($n(r),o)})}function H_(o,e){return o[0]===e[0]&&o[1]===e[1]}var XL=function(){function o(e){this.id=o.buildId(e),this.coordinates=e,this.innerEdges=[],this.outerEdges=[],this.outerEdgesSorted=!1}return o.buildId=function(e){return e.join(",")},o.prototype.removeInnerEdge=function(e){this.innerEdges=this.innerEdges.filter(function(r){return r.from.id!==e.from.id})},o.prototype.removeOuterEdge=function(e){this.outerEdges=this.outerEdges.filter(function(r){return r.to.id!==e.to.id})},o.prototype.addOuterEdge=function(e){this.outerEdges.push(e),this.outerEdgesSorted=!1},o.prototype.sortOuterEdges=function(){var e=this;this.outerEdgesSorted||(this.outerEdges.sort(function(r,u){var l=r.to,h=u.to;if(l.coordinates[0]-e.coordinates[0]>=0&&h.coordinates[0]-e.coordinates[0]<0)return 1;if(l.coordinates[0]-e.coordinates[0]<0&&h.coordinates[0]-e.coordinates[0]>=0)return-1;if(l.coordinates[0]-e.coordinates[0]===0&&h.coordinates[0]-e.coordinates[0]===0)return l.coordinates[1]-e.coordinates[1]>=0||h.coordinates[1]-e.coordinates[1]>=0?l.coordinates[1]-h.coordinates[1]:h.coordinates[1]-l.coordinates[1];var p=Wu(e.coordinates,l.coordinates,h.coordinates);if(p<0)return 1;if(p>0)return-1;var m=Math.pow(l.coordinates[0]-e.coordinates[0],2)+Math.pow(l.coordinates[1]-e.coordinates[1],2),y=Math.pow(h.coordinates[0]-e.coordinates[0],2)+Math.pow(h.coordinates[1]-e.coordinates[1],2);return m-y}),this.outerEdgesSorted=!0)},o.prototype.getOuterEdges=function(){return this.sortOuterEdges(),this.outerEdges},o.prototype.getOuterEdge=function(e){return this.sortOuterEdges(),this.outerEdges[e]},o.prototype.addInnerEdge=function(e){this.innerEdges.push(e)},o}(),Pd=XL;var YL=function(){function o(e,r){this.from=e,this.to=r,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 o.prototype.getSymetric=function(){return this.symetric||(this.symetric=new o(this.to,this.from),this.symetric.symetric=this),this.symetric},o.prototype.deleteEdge=function(){this.from.removeOuterEdge(this),this.to.removeInnerEdge(this)},o.prototype.isEqual=function(e){return this.from.id===e.from.id&&this.to.id===e.to.id},o.prototype.toString=function(){return"Edge { "+this.from.id+" -> "+this.to.id+" }"},o.prototype.toLineString=function(){return oi([this.from.coordinates,this.to.coordinates])},o.prototype.compareTo=function(e){return Wu(e.from.coordinates,e.to.coordinates,this.to.coordinates)},o}(),V_=YL;var $L=function(){function o(){this.edges=[],this.polygon=void 0,this.envelope=void 0}return o.prototype.push=function(e){this.edges.push(e),this.polygon=this.envelope=void 0},o.prototype.get=function(e){return this.edges[e]},Object.defineProperty(o.prototype,"length",{get:function(){return this.edges.length},enumerable:!0,configurable:!0}),o.prototype.forEach=function(e){this.edges.forEach(e)},o.prototype.map=function(e){return this.edges.map(e)},o.prototype.some=function(e){return this.edges.some(e)},o.prototype.isValid=function(){return!0},o.prototype.isHole=function(){var e=this,r=this.edges.reduce(function(p,m,y){return m.from.coordinates[1]>e.edges[p].from.coordinates[1]&&(p=y),p},0),u=(r===0?this.length:r)-1,l=(r+1)%this.length,h=Wu(this.edges[u].from.coordinates,this.edges[r].from.coordinates,this.edges[l].from.coordinates);return h===0?this.edges[u].from.coordinates[0]>this.edges[l].from.coordinates[0]:h>0},o.prototype.toMultiPoint=function(){return pp(this.edges.map(function(e){return e.from.coordinates}))},o.prototype.toPolygon=function(){if(this.polygon)return this.polygon;var e=this.edges.map(function(r){return r.from.coordinates});return e.push(this.edges[0].from.coordinates),this.polygon=ir([e])},o.prototype.getEnvelope=function(){return this.envelope?this.envelope:this.envelope=Lp(this.toPolygon())},o.findEdgeRingContaining=function(e,r){var u=e.getEnvelope(),l,h;return r.forEach(function(p){var m=p.getEnvelope();if(h&&(l=h.getEnvelope()),!G_(m,u)&&Id(m,u)){for(var y=e.map(function(R){return R.from.coordinates}),x=void 0,E=function(R){p.some(function(G){return H_(R,G.from.coordinates)})||(x=R)},S=0,b=y;S<b.length;S++){var C=b[S];E(C)}x&&p.inside($n(x))&&(!h||Id(l,m))&&(h=p)}}),h},o.prototype.inside=function(e){return si(e,this.toPolygon())},o}(),Rd=$L;function ZL(o){if(!o)throw new Error("No geojson passed");if(o.type!=="FeatureCollection"&&o.type!=="GeometryCollection"&&o.type!=="MultiLineString"&&o.type!=="LineString"&&o.type!=="Feature")throw new Error("Invalid input type '"+o.type+"'. Geojson must be FeatureCollection, GeometryCollection, LineString, MultiLineString or Feature")}var Pk=function(){function o(){this.edges=[],this.nodes={}}return o.fromGeoJson=function(e){ZL(e);var r=new o;return Bo(e,function(u){gp(u,"LineString","Graph::fromGeoJson"),O0(u,function(l,h){if(l){var p=r.getNode(l),m=r.getNode(h);r.addEdge(p,m)}return h})}),r},o.prototype.getNode=function(e){var r=Pd.buildId(e),u=this.nodes[r];return u||(u=this.nodes[r]=new Pd(e)),u},o.prototype.addEdge=function(e,r){var u=new V_(e,r),l=u.getSymetric();this.edges.push(u),this.edges.push(l)},o.prototype.deleteDangles=function(){var e=this;Object.keys(this.nodes).map(function(r){return e.nodes[r]}).forEach(function(r){return e._removeIfDangle(r)})},o.prototype._removeIfDangle=function(e){var r=this;if(e.innerEdges.length<=1){var u=e.getOuterEdges().map(function(l){return l.to});this.removeNode(e),u.forEach(function(l){return r._removeIfDangle(l)})}},o.prototype.deleteCutEdges=function(){var e=this;this._computeNextCWEdges(),this._findLabeledEdgeRings(),this.edges.forEach(function(r){r.label===r.symetric.label&&(e.removeEdge(r.symetric),e.removeEdge(r))})},o.prototype._computeNextCWEdges=function(e){var r=this;typeof e=="undefined"?Object.keys(this.nodes).forEach(function(u){return r._computeNextCWEdges(r.nodes[u])}):e.getOuterEdges().forEach(function(u,l){e.getOuterEdge((l===0?e.getOuterEdges().length:l)-1).symetric.next=u})},o.prototype._computeNextCCWEdges=function(e,r){for(var u=e.getOuterEdges(),l,h,p=u.length-1;p>=0;--p){var m=u[p],y=m.symetric,x=void 0,E=void 0;m.label===r&&(x=m),y.label===r&&(E=y),!(!x||!E)&&(E&&(h=E),x&&(h&&(h.next=x,h=void 0),l||(l=x)))}h&&(h.next=l)},o.prototype._findLabeledEdgeRings=function(){var e=[],r=0;return this.edges.forEach(function(u){if(!(u.label>=0)){e.push(u);var l=u;do l.label=r,l=l.next;while(!u.isEqual(l));r++}}),e},o.prototype.getEdgeRings=function(){var e=this;this._computeNextCWEdges(),this.edges.forEach(function(u){u.label=void 0}),this._findLabeledEdgeRings().forEach(function(u){e._findIntersectionNodes(u).forEach(function(l){e._computeNextCCWEdges(l,u.label)})});var r=[];return this.edges.forEach(function(u){u.ring||r.push(e._findEdgeRing(u))}),r},o.prototype._findIntersectionNodes=function(e){var r=[],u=e,l=function(){var h=0;u.from.getOuterEdges().forEach(function(p){p.label===e.label&&++h}),h>1&&r.push(u.from),u=u.next};do l();while(!e.isEqual(u));return r},o.prototype._findEdgeRing=function(e){var r=e,u=new Rd;do u.push(r),r.ring=u,r=r.next;while(!e.isEqual(r));return u},o.prototype.removeNode=function(e){var r=this;e.getOuterEdges().forEach(function(u){return r.removeEdge(u)}),e.innerEdges.forEach(function(u){return r.removeEdge(u)}),delete this.nodes[e.id]},o.prototype.removeEdge=function(e){this.edges=this.edges.filter(function(r){return!r.isEqual(e)}),e.deleteEdge()},o}();var jL=nr(Ld(),1);var t2=nr(Ld(),1);var n2=nr(Q_(),1);var l2=nr(u1(),1);function c1(o){for(var e=o,r=[];e.parent;)r.unshift(e),e=e.parent;return r}function f2(){return new f1(function(o){return o.f})}var Fd={search:function(o,e,r,u){o.cleanDirty(),u=u||{};var l=u.heuristic||Fd.heuristics.manhattan,h=u.closest||!1,p=f2(),m=e;for(e.h=l(e,r),p.push(e);p.size()>0;){var y=p.pop();if(y===r)return c1(y);y.closed=!0;for(var x=o.neighbors(y),E=0,S=x.length;E<S;++E){var b=x[E];if(!(b.closed||b.isWall())){var C=y.g+b.getCost(y),R=b.visited;(!R||C<b.g)&&(b.visited=!0,b.parent=y,b.h=b.h||l(b,r),b.g=C,b.f=b.g+b.h,o.markDirty(b),h&&(b.h<m.h||b.h===m.h&&b.g<m.g)&&(m=b),R?p.rescoreElement(b):p.push(b))}}}return h?c1(m):[]},heuristics:{manhattan:function(o,e){var r=Math.abs(e.x-o.x),u=Math.abs(e.y-o.y);return r+u},diagonal:function(o,e){var r=1,u=Math.sqrt(2),l=Math.abs(e.x-o.x),h=Math.abs(e.y-o.y);return r*(l+h)+(u-2*r)*Math.min(l,h)}},cleanNode:function(o){o.f=0,o.g=0,o.h=0,o.visited=!1,o.closed=!1,o.parent=null}};function Gl(o,e){e=e||{},this.nodes=[],this.diagonal=!!e.diagonal,this.grid=[];for(var r=0;r<o.length;r++){this.grid[r]=[];for(var u=0,l=o[r];u<l.length;u++){var h=new Cf(r,u,l[u]);this.grid[r][u]=h,this.nodes.push(h)}}this.init()}Gl.prototype.init=function(){this.dirtyNodes=[];for(var o=0;o<this.nodes.length;o++)Fd.cleanNode(this.nodes[o])};Gl.prototype.cleanDirty=function(){for(var o=0;o<this.dirtyNodes.length;o++)Fd.cleanNode(this.dirtyNodes[o]);this.dirtyNodes=[]};Gl.prototype.markDirty=function(o){this.dirtyNodes.push(o)};Gl.prototype.neighbors=function(o){var e=[],r=o.x,u=o.y,l=this.grid;return l[r-1]&&l[r-1][u]&&e.push(l[r-1][u]),l[r+1]&&l[r+1][u]&&e.push(l[r+1][u]),l[r]&&l[r][u-1]&&e.push(l[r][u-1]),l[r]&&l[r][u+1]&&e.push(l[r][u+1]),this.diagonal&&(l[r-1]&&l[r-1][u-1]&&e.push(l[r-1][u-1]),l[r+1]&&l[r+1][u-1]&&e.push(l[r+1][u-1]),l[r-1]&&l[r-1][u+1]&&e.push(l[r-1][u+1]),l[r+1]&&l[r+1][u+1]&&e.push(l[r+1][u+1])),e};Gl.prototype.toString=function(){for(var o=[],e=this.grid,r,u,l,h,p=0,m=e.length;p<m;p++){for(r=[],u=e[p],l=0,h=u.length;l<h;l++)r.push(u[l].weight);o.push(r.join(" "))}return o.join(\`
3672
- \`)};function Cf(o,e,r){this.x=o,this.y=e,this.weight=r}Cf.prototype.toString=function(){return"["+this.x+" "+this.y+"]"};Cf.prototype.getCost=function(o){return o&&o.x!==this.x&&o.y!==this.y?this.weight*1.41421:this.weight};Cf.prototype.isWall=function(){return this.weight===0};function f1(o){this.content=[],this.scoreFunction=o}f1.prototype={push:function(o){this.content.push(o),this.sinkDown(this.content.length-1)},pop:function(){var o=this.content[0],e=this.content.pop();return this.content.length>0&&(this.content[0]=e,this.bubbleUp(0)),o},remove:function(o){var e=this.content.indexOf(o),r=this.content.pop();e!==this.content.length-1&&(this.content[e]=r,this.scoreFunction(r)<this.scoreFunction(o)?this.sinkDown(e):this.bubbleUp(e))},size:function(){return this.content.length},rescoreElement:function(o){this.sinkDown(this.content.indexOf(o))},sinkDown:function(o){for(var e=this.content[o];o>0;){var r=(o+1>>1)-1,u=this.content[r];if(this.scoreFunction(e)<this.scoreFunction(u))this.content[r]=e,this.content[o]=u,o=r;else break}},bubbleUp:function(o){for(var e=this.content.length,r=this.content[o],u=this.scoreFunction(r);;){var l=o+1<<1,h=l-1,p=null,m;if(h<e){var y=this.content[h];m=this.scoreFunction(y),m<u&&(p=h)}if(l<e){var x=this.content[l],E=this.scoreFunction(x);E<(p===null?u:m)&&(p=l)}if(p!==null)this.content[o]=this.content[p],this.content[p]=r,o=p;else break}}};function Ud(){this._=null}function Xu(o){o.U=o.C=o.L=o.R=o.P=o.N=null}Ud.prototype={constructor:Ud,insert:function(o,e){var r,u,l;if(o){if(e.P=o,e.N=o.N,o.N&&(o.N.P=e),o.N=e,o.R){for(o=o.R;o.L;)o=o.L;o.L=e}else o.R=e;r=o}else this._?(o=h1(this._),e.P=null,e.N=o,o.P=o.L=e,r=o):(e.P=e.N=null,this._=e,r=null);for(e.L=e.R=null,e.U=r,e.C=!0,o=e;r&&r.C;)u=r.U,r===u.L?(l=u.R,l&&l.C?(r.C=l.C=!1,u.C=!0,o=u):(o===r.R&&(Hl(this,r),o=r,r=o.U),r.C=!1,u.C=!0,Vl(this,u))):(l=u.L,l&&l.C?(r.C=l.C=!1,u.C=!0,o=u):(o===r.L&&(Vl(this,r),o=r,r=o.U),r.C=!1,u.C=!0,Hl(this,u))),r=o.U;this._.C=!1},remove:function(o){o.N&&(o.N.P=o.P),o.P&&(o.P.N=o.N),o.N=o.P=null;var e=o.U,r,u=o.L,l=o.R,h,p;if(u?l?h=h1(l):h=u:h=l,e?e.L===o?e.L=h:e.R=h:this._=h,u&&l?(p=h.C,h.C=o.C,h.L=u,u.U=h,h!==l?(e=h.U,h.U=o.U,o=h.R,e.L=o,h.R=l,l.U=h):(h.U=e,e=h,o=h.R)):(p=o.C,o=h),o&&(o.U=e),!p){if(o&&o.C){o.C=!1;return}do{if(o===this._)break;if(o===e.L){if(r=e.R,r.C&&(r.C=!1,e.C=!0,Hl(this,e),r=e.R),r.L&&r.L.C||r.R&&r.R.C){(!r.R||!r.R.C)&&(r.L.C=!1,r.C=!0,Vl(this,r),r=e.R),r.C=e.C,e.C=r.R.C=!1,Hl(this,e),o=this._;break}}else if(r=e.L,r.C&&(r.C=!1,e.C=!0,Vl(this,e),r=e.L),r.L&&r.L.C||r.R&&r.R.C){(!r.L||!r.L.C)&&(r.R.C=!1,r.C=!0,Hl(this,r),r=e.L),r.C=e.C,e.C=r.L.C=!1,Vl(this,e),o=this._;break}r.C=!0,o=e,e=e.U}while(!o.C);o&&(o.C=!1)}}};function Hl(o,e){var r=e,u=e.R,l=r.U;l?l.L===r?l.L=u:l.R=u:o._=u,u.U=l,r.U=u,r.R=u.L,r.R&&(r.R.U=r),u.L=r}function Vl(o,e){var r=e,u=e.L,l=r.U;l?l.L===r?l.L=u:l.R=u:o._=u,u.U=l,r.U=u,r.L=u.R,r.L&&(r.L.U=r),u.R=r}function h1(o){for(;o.L;)o=o.L;return o}var Bd=Ud;function Yu(o,e,r,u){var l=[null,null],h=ui.push(l)-1;return l.left=o,l.right=e,r&&Wl(l,o,e,r),u&&Wl(l,e,o,u),Ji[o.index].halfedges.push(h),Ji[e.index].halfedges.push(h),l}function $u(o,e,r){var u=[e,r];return u.left=o,u}function Wl(o,e,r,u){!o[0]&&!o[1]?(o[0]=u,o.left=e,o.right=r):o.left===r?o[1]=u:o[0]=u}function h2(o,e,r,u,l){var h=o[0],p=o[1],m=h[0],y=h[1],x=p[0],E=p[1],S=0,b=1,C=x-m,R=E-y,G;if(G=e-m,!(!C&&G>0)){if(G/=C,C<0){if(G<S)return;G<b&&(b=G)}else if(C>0){if(G>b)return;G>S&&(S=G)}if(G=u-m,!(!C&&G<0)){if(G/=C,C<0){if(G>b)return;G>S&&(S=G)}else if(C>0){if(G<S)return;G<b&&(b=G)}if(G=r-y,!(!R&&G>0)){if(G/=R,R<0){if(G<S)return;G<b&&(b=G)}else if(R>0){if(G>b)return;G>S&&(S=G)}if(G=l-y,!(!R&&G<0)){if(G/=R,R<0){if(G>b)return;G>S&&(S=G)}else if(R>0){if(G<S)return;G<b&&(b=G)}return!(S>0)&&!(b<1)||(S>0&&(o[0]=[m+S*C,y+S*R]),b<1&&(o[1]=[m+b*C,y+b*R])),!0}}}}}function p2(o,e,r,u,l){var h=o[1];if(h)return!0;var p=o[0],m=o.left,y=o.right,x=m[0],E=m[1],S=y[0],b=y[1],C=(x+S)/2,R=(E+b)/2,G,O;if(b===E){if(C<e||C>=u)return;if(x>S){if(!p)p=[C,r];else if(p[1]>=l)return;h=[C,l]}else{if(!p)p=[C,l];else if(p[1]<r)return;h=[C,r]}}else if(G=(x-S)/(b-E),O=R-G*C,G<-1||G>1)if(x>S){if(!p)p=[(r-O)/G,r];else if(p[1]>=l)return;h=[(l-O)/G,l]}else{if(!p)p=[(l-O)/G,l];else if(p[1]<r)return;h=[(r-O)/G,r]}else if(E<b){if(!p)p=[e,G*e+O];else if(p[0]>=u)return;h=[u,G*u+O]}else{if(!p)p=[u,G*u+O];else if(p[0]<e)return;h=[e,G*e+O]}return o[0]=p,o[1]=h,!0}function p1(o,e,r,u){for(var l=ui.length,h;l--;)(!p2(h=ui[l],o,e,r,u)||!h2(h,o,e,r,u)||!(Math.abs(h[0][0]-h[1][0])>Dn||Math.abs(h[0][1]-h[1][1])>Dn))&&delete ui[l]}function d1(o){return Ji[o.index]={site:o,halfedges:[]}}function d2(o,e){var r=o.site,u=e.left,l=e.right;return r===l&&(l=u,u=r),l?Math.atan2(l[1]-u[1],l[0]-u[0]):(r===u?(u=e[1],l=e[0]):(u=e[0],l=e[1]),Math.atan2(u[0]-l[0],l[1]-u[1]))}function zd(o,e){return e[+(e.left!==o.site)]}function g2(o,e){return e[+(e.left===o.site)]}function g1(){for(var o=0,e=Ji.length,r,u,l,h;o<e;++o)if((r=Ji[o])&&(h=(u=r.halfedges).length)){var p=new Array(h),m=new Array(h);for(l=0;l<h;++l)p[l]=l,m[l]=d2(r,ui[u[l]]);for(p.sort(function(y,x){return m[x]-m[y]}),l=0;l<h;++l)m[l]=u[p[l]];for(l=0;l<h;++l)u[l]=m[l]}}function m1(o,e,r,u){var l=Ji.length,h,p,m,y,x,E,S,b,C,R,G,O,N=!0;for(h=0;h<l;++h)if(p=Ji[h]){for(m=p.site,x=p.halfedges,y=x.length;y--;)ui[x[y]]||x.splice(y,1);for(y=0,E=x.length;y<E;)R=g2(p,ui[x[y]]),G=R[0],O=R[1],S=zd(p,ui[x[++y%E]]),b=S[0],C=S[1],(Math.abs(G-b)>Dn||Math.abs(O-C)>Dn)&&(x.splice(y,0,ui.push($u(m,R,Math.abs(G-o)<Dn&&u-O>Dn?[o,Math.abs(b-o)<Dn?C:u]:Math.abs(O-u)<Dn&&r-G>Dn?[Math.abs(C-u)<Dn?b:r,u]:Math.abs(G-r)<Dn&&O-e>Dn?[r,Math.abs(b-r)<Dn?C:e]:Math.abs(O-e)<Dn&&G-o>Dn?[Math.abs(C-e)<Dn?b:o,e]:null))-1),++E);E&&(N=!1)}if(N){var k,F,$,Z=1/0;for(h=0,N=null;h<l;++h)(p=Ji[h])&&(m=p.site,k=m[0]-o,F=m[1]-e,$=k*k+F*F,$<Z&&(Z=$,N=p));if(N){var it=[o,e],et=[o,u],U=[r,u],wt=[r,e];N.halfedges.push(ui.push($u(m=N.site,it,et))-1,ui.push($u(m,et,U))-1,ui.push($u(m,U,wt))-1,ui.push($u(m,wt,it))-1)}}for(h=0;h<l;++h)(p=Ji[h])&&(p.halfedges.length||delete Ji[h])}var y1=[],If;function m2(){Xu(this),this.x=this.y=this.arc=this.site=this.cy=null}function ru(o){var e=o.P,r=o.N;if(!(!e||!r)){var u=e.site,l=o.site,h=r.site;if(u!==h){var p=l[0],m=l[1],y=u[0]-p,x=u[1]-m,E=h[0]-p,S=h[1]-m,b=2*(y*S-x*E);if(!(b>=-v1)){var C=y*y+x*x,R=E*E+S*S,G=(S*C-x*R)/b,O=(y*R-E*C)/b,N=y1.pop()||new m2;N.arc=o,N.site=l,N.x=G+p,N.y=(N.cy=O+m)+Math.sqrt(G*G+O*O),o.circle=N;for(var k=null,F=Zu._;F;)if(N.y<F.y||N.y===F.y&&N.x<=F.x)if(F.L)F=F.L;else{k=F.P;break}else if(F.R)F=F.R;else{k=F;break}Zu.insert(k,N),k||(If=N)}}}}function iu(o){var e=o.circle;e&&(e.P||(If=e.N),Zu.remove(e),y1.push(e),Xu(e),o.circle=null)}var x1=[];function y2(){Xu(this),this.edge=this.site=this.circle=null}function _1(o){var e=x1.pop()||new y2;return e.site=o,e}function kd(o){iu(o),ou.remove(o),x1.push(o),Xu(o)}function E1(o){var e=o.circle,r=e.x,u=e.cy,l=[r,u],h=o.P,p=o.N,m=[o];kd(o);for(var y=h;y.circle&&Math.abs(r-y.circle.x)<Dn&&Math.abs(u-y.circle.cy)<Dn;)h=y.P,m.unshift(y),kd(y),y=h;m.unshift(y),iu(y);for(var x=p;x.circle&&Math.abs(r-x.circle.x)<Dn&&Math.abs(u-x.circle.cy)<Dn;)p=x.N,m.push(x),kd(x),x=p;m.push(x),iu(x);var E=m.length,S;for(S=1;S<E;++S)x=m[S],y=m[S-1],Wl(x.edge,y.site,x.site,l);y=m[0],x=m[E-1],x.edge=Yu(y.site,x.site,null,l),ru(y),ru(x)}function w1(o){for(var e=o[0],r=o[1],u,l,h,p,m=ou._;m;)if(h=M1(m,r)-e,h>Dn)m=m.L;else if(p=e-v2(m,r),p>Dn){if(!m.R){u=m;break}m=m.R}else{h>-Dn?(u=m.P,l=m):p>-Dn?(u=m,l=m.N):u=l=m;break}d1(o);var y=_1(o);if(ou.insert(u,y),!(!u&&!l)){if(u===l){iu(u),l=_1(u.site),ou.insert(y,l),y.edge=l.edge=Yu(u.site,y.site),ru(u),ru(l);return}if(!l){y.edge=Yu(u.site,y.site);return}iu(u),iu(l);var x=u.site,E=x[0],S=x[1],b=o[0]-E,C=o[1]-S,R=l.site,G=R[0]-E,O=R[1]-S,N=2*(b*O-C*G),k=b*b+C*C,F=G*G+O*O,$=[(O*k-C*F)/N+E,(b*F-G*k)/N+S];Wl(l.edge,x,R,$),y.edge=Yu(x,o,null,$),l.edge=Yu(o,R,null,$),ru(u),ru(l)}}function M1(o,e){var r=o.site,u=r[0],l=r[1],h=l-e;if(!h)return u;var p=o.P;if(!p)return-1/0;r=p.site;var m=r[0],y=r[1],x=y-e;if(!x)return m;var E=m-u,S=1/h-1/x,b=E/x;return S?(-b+Math.sqrt(b*b-2*S*(E*E/(-2*x)-y+x/2+l-h/2)))/S+u:(u+m)/2}function v2(o,e){var r=o.N;if(r)return M1(r,e);var u=o.site;return u[1]===e?u[0]:1/0}var Dn=1e-6,v1=1e-12,ou,Ji,Zu,ui;function _2(o,e,r){return(o[0]-r[0])*(e[1]-o[1])-(o[0]-e[0])*(r[1]-o[1])}function x2(o,e){return e[1]-o[1]||e[0]-o[0]}function Pf(o,e){var r=o.sort(x2).pop(),u,l,h;for(ui=[],Ji=new Array(o.length),ou=new Bd,Zu=new Bd;;)if(h=If,r&&(!h||r[1]<h.y||r[1]===h.y&&r[0]<h.x))(r[0]!==u||r[1]!==l)&&(w1(r),u=r[0],l=r[1]),r=o.pop();else if(h)E1(h.arc);else break;if(g1(),e){var p=+e[0][0],m=+e[0][1],y=+e[1][0],x=+e[1][1];p1(p,m,y,x),m1(p,m,y,x)}this.edges=ui,this.cells=Ji,ou=Zu=ui=Ji=null}Pf.prototype={constructor:Pf,polygons:function(){var o=this.edges;return this.cells.map(function(e){var r=e.halfedges.map(function(u){return zd(e,o[u])});return r.data=e.site.data,r})},triangles:function(){var o=[],e=this.edges;return this.cells.forEach(function(r,u){if(m=(h=r.halfedges).length)for(var l=r.site,h,p=-1,m,y,x=e[h[m-1]],E=x.left===l?x.right:x.left;++p<m;)y=E,x=e[h[p]],E=x.left===l?x.right:x.left,y&&E&&u<y.index&&u<E.index&&_2(l,y,E)<0&&o.push([l.data,y.data,E.data])}),o},links:function(){return this.edges.filter(function(o){return o.right}).map(function(o){return{source:o.left.data,target:o.right.data}})},find:function(o,e,r){for(var u=this,l,h=u._found||0,p=u.cells.length,m;!(m=u.cells[h]);)if(++h>=p)return null;var y=o-m.site[0],x=e-m.site[1],E=y*y+x*x;do m=u.cells[l=h],h=null,m.halfedges.forEach(function(S){var b=u.edges[S],C=b.left;if(!((C===m.site||!C)&&!(C=b.right))){var R=o-C[0],G=e-C[1],O=R*R+G*G;O<E&&(E=O,h=C.index)}});while(h!==null);return u._found=l,r==null||E<=r*r?m.site:null}};var C2=nr(Ju(),1);var eg=nr(T1(),1);function Eo(){return new Nf}function Nf(){this.reset()}Nf.prototype={constructor:Nf,reset:function(){this.s=this.t=0},add:function(o){C1(Lf,o,this.t),C1(this,Lf.s,this.s),this.s?this.t+=Lf.t:this.s=Lf.t},valueOf:function(){return this.s}};var Lf=new Nf;function C1(o,e,r){var u=o.s=e+r,l=u-e,h=u-l;o.t=e-h+(r-l)}var dn=1e-6;var In=Math.PI,Wr=In/2,Df=In/4,Ds=In*2,su=180/In,wo=In/180,_r=Math.abs,ps=Math.atan,Mo=Math.atan2,rn=Math.cos;var Of=Math.exp;var ql=Math.log;var pe=Math.sin;var wi=Math.sqrt,Xl=Math.tan;function Vd(o){return o>1?0:o<-1?In:Math.acos(o)}function Ki(o){return o>1?Wr:o<-1?-Wr:Math.asin(o)}function ds(){}var I2=Eo(),S6=Eo();function au(o){var e=o[0],r=o[1],u=rn(r);return[u*rn(e),u*pe(e),pe(r)]}function Yl(o,e){return[o[1]*e[2]-o[2]*e[1],o[2]*e[0]-o[0]*e[2],o[0]*e[1]-o[1]*e[0]]}function $l(o){var e=wi(o[0]*o[0]+o[1]*o[1]+o[2]*o[2]);o[0]/=e,o[1]/=e,o[2]/=e}var D6=Eo();function P1(o,e){return[o>In?o-Ds:o<-In?o+Ds:o,e]}P1.invert=P1;function Wd(){var o=[],e;return{point:function(r,u){e.push([r,u])},lineStart:function(){o.push(e=[])},lineEnd:ds,rejoin:function(){o.length>1&&o.push(o.pop().concat(o.shift()))},result:function(){var r=o;return o=[],e=null,r}}}function qd(o,e){return _r(o[0]-e[0])<dn&&_r(o[1]-e[1])<dn}function Ff(o,e,r,u){this.x=o,this.z=e,this.o=r,this.e=u,this.v=!1,this.n=this.p=null}function Xd(o,e,r,u,l){var h=[],p=[],m,y;if(o.forEach(function(R){if(!((G=R.length-1)<=0)){var G,O=R[0],N=R[G],k;if(qd(O,N)){for(l.lineStart(),m=0;m<G;++m)l.point((O=R[m])[0],O[1]);l.lineEnd();return}h.push(k=new Ff(O,R,null,!0)),p.push(k.o=new Ff(O,null,k,!1)),h.push(k=new Ff(N,R,null,!1)),p.push(k.o=new Ff(N,null,k,!0))}}),!!h.length){for(p.sort(e),R1(h),R1(p),m=0,y=p.length;m<y;++m)p[m].e=r=!r;for(var x=h[0],E,S;;){for(var b=x,C=!0;b.v;)if((b=b.n)===x)return;E=b.z,l.lineStart();do{if(b.v=b.o.v=!0,b.e){if(C)for(m=0,y=E.length;m<y;++m)l.point((S=E[m])[0],S[1]);else u(b.x,b.n.x,1,l);b=b.n}else{if(C)for(E=b.p.z,m=E.length-1;m>=0;--m)l.point((S=E[m])[0],S[1]);else u(b.x,b.p.x,-1,l);b=b.p}b=b.o,E=b.z,C=!C}while(!b.v);l.lineEnd()}}}function R1(o){if(e=o.length){for(var e,r=0,u=o[0],l;++r<e;)u.n=l=o[r],l.p=u,u=l;u.n=l=o[0],l.p=u}}function Ia(o,e){return o<e?-1:o>e?1:o>=e?0:NaN}function Yd(o){return o.length===1&&(o=L2(o)),{left:function(e,r,u,l){for(u==null&&(u=0),l==null&&(l=e.length);u<l;){var h=u+l>>>1;o(e[h],r)<0?u=h+1:l=h}return u},right:function(e,r,u,l){for(u==null&&(u=0),l==null&&(l=e.length);u<l;){var h=u+l>>>1;o(e[h],r)>0?l=h:u=h+1}return u}}}function L2(o){return function(e,r){return Ia(o(e),r)}}var L1=Yd(Ia),N2=L1.right,D2=L1.left;var N1=Array.prototype,F2=N1.slice,U2=N1.map;var AH=Math.sqrt(50),TH=Math.sqrt(10),CH=Math.sqrt(2);function Bf(o){for(var e=o.length,r,u=-1,l=0,h,p;++u<e;)l+=o[u].length;for(h=new Array(l);--e>=0;)for(p=o[e],r=p.length;--r>=0;)h[--l]=p[r];return h}var q2=1e9,f8=-q2;var $d=Eo();function Zd(o,e){var r=e[0],u=e[1],l=[pe(r),-rn(r),0],h=0,p=0;$d.reset();for(var m=0,y=o.length;m<y;++m)if(E=(x=o[m]).length)for(var x,E,S=x[E-1],b=S[0],C=S[1]/2+Df,R=pe(C),G=rn(C),O=0;O<E;++O,b=k,R=$,G=Z,S=N){var N=x[O],k=N[0],F=N[1]/2+Df,$=pe(F),Z=rn(F),it=k-b,et=it>=0?1:-1,U=et*it,wt=U>In,Lt=R*$;if($d.add(Mo(Lt*et*pe(U),G*Z+Lt*rn(U))),h+=wt?it+et*Ds:it,wt^b>=r^k>=r){var Ot=Yl(au(S),au(N));$l(Ot);var W=Yl(l,Ot);$l(W);var de=(wt^it>=0?-1:1)*Ki(W[2]);(u>de||u===de&&(Ot[0]||Ot[1]))&&(p+=wt^it>=0?1:-1)}}return(h<-dn||h<dn&&$d<-dn)^p&1}var E8=Eo();var k8=Eo(),G8=Eo();var $2=1/0;var W8=-$2;function Jd(o){this._context=o}Jd.prototype={_radius:4.5,pointRadius:function(o){return this._radius=o,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(o,e){switch(this._point){case 0:{this._context.moveTo(o,e),this._point=1;break}case 1:{this._context.lineTo(o,e);break}default:{this._context.moveTo(o+this._radius,e),this._context.arc(o,e,this._radius,0,Ds);break}}},result:ds};var tW=Eo();function Kd(){this._string=[]}Kd.prototype={_radius:4.5,_circle:F1(4.5),pointRadius:function(o){return(o=+o)!==this._radius&&(this._radius=o,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(o,e){switch(this._point){case 0:{this._string.push("M",o,",",e),this._point=1;break}case 1:{this._string.push("L",o,",",e);break}default:{this._circle==null&&(this._circle=F1(this._radius)),this._string.push("M",o,",",e,this._circle);break}}},result:function(){if(this._string.length){var o=this._string.join("");return this._string=[],o}else return null}};function F1(o){return"m0,"+o+"a"+o+","+o+" 0 1,1 0,"+-2*o+"a"+o+","+o+" 0 1,1 0,"+2*o+"z"}function Qd(o,e,r,u){return function(l,h){var p=e(h),m=l.invert(u[0],u[1]),y=Wd(),x=e(y),E=!1,S,b,C,R={point:G,lineStart:N,lineEnd:k,polygonStart:function(){R.point=F,R.lineStart=$,R.lineEnd=Z,b=[],S=[]},polygonEnd:function(){R.point=G,R.lineStart=N,R.lineEnd=k,b=Bf(b);var it=Zd(S,m);b.length?(E||(h.polygonStart(),E=!0),Xd(b,K2,it,r,h)):it&&(E||(h.polygonStart(),E=!0),h.lineStart(),r(null,null,1,h),h.lineEnd()),E&&(h.polygonEnd(),E=!1),b=S=null},sphere:function(){h.polygonStart(),h.lineStart(),r(null,null,1,h),h.lineEnd(),h.polygonEnd()}};function G(it,et){var U=l(it,et);o(it=U[0],et=U[1])&&h.point(it,et)}function O(it,et){var U=l(it,et);p.point(U[0],U[1])}function N(){R.point=O,p.lineStart()}function k(){R.point=G,p.lineEnd()}function F(it,et){C.push([it,et]);var U=l(it,et);x.point(U[0],U[1])}function $(){x.lineStart(),C=[]}function Z(){F(C[0][0],C[0][1]),x.lineEnd();var it=x.clean(),et=y.result(),U,wt=et.length,Lt,Ot,W;if(C.pop(),S.push(C),C=null,!!wt){if(it&1){if(Ot=et[0],(Lt=Ot.length-1)>0){for(E||(h.polygonStart(),E=!0),h.lineStart(),U=0;U<Lt;++U)h.point((W=Ot[U])[0],W[1]);h.lineEnd()}return}wt>1&&it&2&&et.push(et.pop().concat(et.shift())),b.push(et.filter(J2))}}return R}}function J2(o){return o.length>1}function K2(o,e){return((o=o.x)[0]<0?o[1]-Wr-dn:Wr-o[1])-((e=e.x)[0]<0?e[1]-Wr-dn:Wr-e[1])}var Q2=Qd(function(){return!0},j2,eN,[-In,-Wr]);function j2(o){var e=NaN,r=NaN,u=NaN,l;return{lineStart:function(){o.lineStart(),l=1},point:function(h,p){var m=h>0?In:-In,y=_r(h-e);_r(y-In)<dn?(o.point(e,r=(r+p)/2>0?Wr:-Wr),o.point(u,r),o.lineEnd(),o.lineStart(),o.point(m,r),o.point(h,r),l=0):u!==m&&y>=In&&(_r(e-u)<dn&&(e-=u*dn),_r(h-m)<dn&&(h-=m*dn),r=tN(e,r,h,p),o.point(u,r),o.lineEnd(),o.lineStart(),o.point(m,r),l=0),o.point(e=h,r=p),u=m},lineEnd:function(){o.lineEnd(),e=r=NaN},clean:function(){return 2-l}}}function tN(o,e,r,u){var l,h,p=pe(o-r);return _r(p)>dn?ps((pe(e)*(h=rn(u))*pe(r)-pe(u)*(l=rn(e))*pe(o))/(l*h*p)):(e+u)/2}function eN(o,e,r,u){var l;if(o==null)l=r*Wr,u.point(-In,l),u.point(0,l),u.point(In,l),u.point(In,0),u.point(In,-l),u.point(0,-l),u.point(-In,-l),u.point(-In,0),u.point(-In,l);else if(_r(o[0]-e[0])>dn){var h=o[0]<e[0]?In:-In;l=r*h/2,u.point(-h,l),u.point(0,l),u.point(h,l)}else u.point(e[0],e[1])}function zf(o){return function(e){var r=new jd;for(var u in o)r[u]=o[u];return r.stream=e,r}}function jd(){}jd.prototype={constructor:jd,point:function(o,e){this.stream.point(o,e)},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 GW=rn(30*wo);var eq=zf({point:function(o,e){this.stream.point(o*wo,e*wo)}});function kf(o){return function(e,r){var u=rn(e),l=rn(r),h=o(u*l);return[h*l*pe(e),h*pe(r)]}}function Os(o){return function(e,r){var u=wi(e*e+r*r),l=o(u),h=pe(l),p=rn(l);return[Mo(e*h,u*p),Ki(u&&r*h/u)]}}var V1=kf(function(o){return wi(2/(1+o))});V1.invert=Os(function(o){return 2*Ki(o/2)});var W1=kf(function(o){return(o=Vd(o))&&o/pe(o)});W1.invert=Os(function(o){return o});function tg(o,e){return[o,ql(Xl((Wr+e)/2))]}tg.invert=function(o,e){return[o,2*ps(Of(e))-Wr]};function Gf(o,e){return[o,e]}Gf.invert=Gf;function q1(o,e){var r=rn(e),u=rn(o)*r;return[r*pe(o)/u,pe(e)/u]}q1.invert=Os(ps);function X1(o,e){var r=e*e,u=r*r;return[o*(.8707-.131979*r+u*(-.013791+u*(.003971*r-.001529*u))),e*(1.007226+r*(.015085+u*(-.044475+.028874*r-.005916*u)))]}X1.invert=function(o,e){var r=e,u=25,l;do{var h=r*r,p=h*h;r-=l=(r*(1.007226+h*(.015085+p*(-.044475+.028874*h-.005916*p)))-e)/(1.007226+h*(.015085*3+p*(-.044475*7+.028874*9*h-.005916*11*p)))}while(_r(l)>dn&&--u>0);return[o/(.8707+(h=r*r)*(-.131979+h*(-.013791+h*h*h*(.003971-.001529*h)))),r]};function Y1(o,e){return[rn(e)*pe(o),pe(e)]}Y1.invert=Os(Ki);function $1(o,e){var r=rn(e),u=1+rn(o)*r;return[r*pe(o)/u,pe(e)/u]}$1.invert=Os(function(o){return 2*ps(o)});function Z1(o,e){return[ql(Xl((Wr+e)/2)),-o]}Z1.invert=function(o,e){return[-e,2*ps(Of(o))-Wr]};var aN=nr(Ju(),1);var uN=nr(Ju(),1);var cN=nr(Ju(),1);var fN=nr(Ju(),1);function Ra(o,e){return Math.sqrt((e[0]-o[0])**2+(e[1]-o[1])**2)}function K1(o){let e=0;for(let r=0;r<o.length-1;r++)e+=Ra(o[r],o[r+1]);return e}function Q1(o,e,r){let u=new Yi(e[0]-o[0],e[1]-o[1]),l=new Yi(e[0]-r[0],e[1]-r[1]),p=u.angleTo(l)*180/Math.PI,m=new Yi(e[0]-o[0],e[1]-o[1]);return new Yi(r[0]-o[0],r[1]-o[1]).cross(m)>0?p:-p}var La=nr(j1(),1);var Qn="___",Hf=class{constructor(e=3){this.lift_priority=e;ri(this,"roadInfo",[]);ri(this,"facilities",[]);ri(this,"pointMap",new Map);ri(this,"nodeMap",new Map);ri(this,"facilityMap",new Map);ri(this,"straightLadderMap",new Map);ri(this,"escalatorMap",new Map);ri(this,"rampMap",new Map);ri(this,"staircaseMap",new Map);ri(this,"parkingMap",new Map);ri(this,"lineMap",new Map);ri(this,"baseRoute",new Ni.default);ri(this,"escalatorRoute",new Ni.default);ri(this,"straightLadderRoute",new Ni.default);ri(this,"forwardLineMap",new Map);ri(this,"forwardRoute",new Ni.default)}isFacilityByType(e){return["facility","escalator","straightLadder","staircase","ramp"].includes(e)}initFacilities(e){this.facilities=e.map(r=>{let u=[];try{u=JSON.parse(r.entry_end_floor)}catch(h){u=[]}let l=[];try{l=JSON.parse(r.entry_start_floor)}catch(h){l=[]}return Uh(Eu({},r),{entry_start_floor:l,entry_end_floor:u})})}initRoute(e,r){this.clear(),this.roadInfo=e,this.initFacilities(r);let u=new Date,l=u.getHours()*60+u.getMinutes();e.length&&(e.forEach(h=>{(h.points||[]).filter(p=>p.openStatus!==!1).filter(p=>{if(!p.startTime||!p.endTime)return!0;let[m,y]=p.startTime.split(":").map(C=>+C),[x,E]=p.endTime.split(":").map(C=>+C),S=m*60+y,b=x*60+E;return l>=S&&l<=b}).forEach(p=>{p.floor=h.floor;let m=\`\${h.floor}\${Qn}\${p.id}\`;if(this.nodeMap.set(\`\${h.floor}\${Qn}\${p.nodeId}\`,\`\${h.floor}\${Qn}\${p.relatedId||p.id}\`),this.pointMap.set(m,p),this.isFacilityByType(p.type)){let y=this.facilities.find(x=>x.id===+p.targetId);if(y){switch(y.entry_infra_type){case"straightLadder":if(y.entry_end_floor.find(b=>b.floor===h.floor)&&y.entry_start_floor.find(b=>b.floor===h.floor)){let b=this.straightLadderMap.get(p.targetId)||[];b.push(Eu({},p)),this.straightLadderMap.set(p.targetId,b)}break;case"staircase":if(y.entry_end_floor.find(b=>b.floor===h.floor)&&y.entry_start_floor.find(b=>b.floor===h.floor)){let b=this.staircaseMap.get(p.targetId)||[];b.push(Eu({},p)),this.staircaseMap.set(p.targetId,b)}break;case"escalator":let E=this.escalatorMap.get(p.targetId)||[];if(y.entry_start_floor.find(b=>b.floor===h.floor)){let b=E.find(C=>{var R;return((R=C.end)==null?void 0:R.floor)!==h.floor&&!C.start});b?b.start=p:E.push({start:p})}if(y.entry_end_floor.find(b=>b.floor===h.floor)){let b=E.find(C=>{var R;return((R=C.start)==null?void 0:R.floor)!==h.floor&&!C.end});b?b.end=p:E.push({end:p})}this.escalatorMap.set(p.targetId,E);break;case"ramp":let S=this.rampMap.get(p.targetId)||[];if(y.entry_start_floor.find(b=>b.floor===h.floor)){let b=S.find(C=>{var R;return((R=C.end)==null?void 0:R.floor)!==h.floor&&!C.start});b?b.start=p:S.push({start:p})}if(y.entry_end_floor.find(b=>b.floor===h.floor)){let b=S.find(C=>{var R;return((R=C.start)==null?void 0:R.floor)!==h.floor&&!C.end});b?b.end=p:S.push({end:p})}this.rampMap.set(p.targetId,S);break}let x=this.facilityMap.get(p.targetId)||[];x.push(Eu({},p)),this.facilityMap.set(p.targetId,x)}}p.type==="parkingSpace"&&this.parkingMap.set(\`\${h.floor}\${Qn}\${p.name}\`,p)}),(h.lines||[]).filter(p=>p.direction!=="no").forEach(p=>{let m=\`\${h.floor}\${Qn}\${p.from}\`,y=\`\${h.floor}\${Qn}\${p.to}\`,x=this.pointMap.get(m),E=this.pointMap.get(y);if(!x||!E)return;let S=x.cds,b=E.cds,C=Ra(S,b);if(!x.permission&&!E.permission)switch(this.addLineItem(m,y,C),this.addLineItem(y,m,C),p.direction){case"double":this.addLineItem(m,y,C,this.forwardLineMap),this.addLineItem(y,m,C,this.forwardLineMap);break;case"single":this.addLineItem(m,y,C,this.forwardLineMap);break;case"back":this.addLineItem(y,m,C,this.forwardLineMap);break}else x.permission&&(this.setPermissionLine(m,y,x.permission,C,""),this.setPermissionLine(y,m,x.permission,C,"")),E.permission&&E.permission!==x.permission&&(this.setPermissionLine(m,y,E.permission,C,""),this.setPermissionLine(y,m,E.permission,C,""))})}),this.addPermissionFacility(),this.initBaseRoute(),this.initEscalatorRoute(),this.initStraightLadderRoute(),this.initForwardRoute())}getPermissionMap(e){return this[\`permission_\${e}\`]||(this[\`permission_\${e}\`]=new Set),this[\`permission_\${e}\`]}setPermissionLine(e,r,u,l,h){this.getPermissionMap(u).add({fromKey:e,toKey:r,distance:l,type:h})}addPermissionFacility(){this.straightLadderMap.forEach((e,r)=>{if(e.length<2){this.straightLadderMap.delete(r);return}for(let u=0;u<e.length;u++){let l=\`\${e[u].floor}\${Qn}\${e[u].id}\`,h=this.pointMap.get(l);if(h){for(let p=0;p<e.length;p++)if(u!==p){let m=\`\${e[p].floor}\${Qn}\${e[p].id}\`,y=this.pointMap.get(m);if(!y)continue;h.permission&&this.setPermissionLine(l,m,h.permission,1,"straightLadder"),y.permission&&y.permission!==h.permission&&this.setPermissionLine(l,m,y.permission,1,"straightLadder")}}}}),this.staircaseMap.forEach((e,r)=>{if(e.length<2){this.staircaseMap.delete(r);return}for(let u=0;u<e.length;u++){let l=\`\${e[u].floor}\${Qn}\${e[u].id}\`,h=this.pointMap.get(l);if(h){for(let p=0;p<e.length;p++)if(u!==p){let m=\`\${e[p].floor}\${Qn}\${e[p].id}\`,y=this.pointMap.get(m);if(!y)continue;h.permission&&this.setPermissionLine(l,m,h.permission,1,"staircase"),y.permission&&y.permission!==h.permission&&this.setPermissionLine(l,m,y.permission,1,"straightLadder")}}}}),this.escalatorMap.forEach((e,r)=>{e.forEach(u=>{if(u.start&&u.end){let l=\`\${u.start.floor}\${Qn}\${u.start.id}\`,h=\`\${u.end.floor}\${Qn}\${u.end.id}\`,p=this.pointMap.get(l),m=this.pointMap.get(h);p&&m&&(p.permission&&this.setPermissionLine(l,h,p.permission,1,"escalator"),m.permission&&m.permission!==p.permission&&this.setPermissionLine(l,h,m.permission,1,"escalator"))}})}),this.rampMap.forEach((e,r)=>{e.forEach(u=>{if(u.start&&u.end){let l=\`\${u.start.floor}\${Qn}\${u.start.id}\`,h=\`\${u.end.floor}\${Qn}\${u.end.id}\`,p=this.pointMap.get(l),m=this.pointMap.get(h);p&&m&&(p.permission&&this.setPermissionLine(l,h,p.permission,10,"ramp"),m.permission&&m.permission!==p.permission&&this.setPermissionLine(l,h,m.permission,10,"ramp"))}})})}addPermissionLineToMap(e,r,u,l){let h=this.getPermissionMap(e);console.log(h),h.forEach(p=>{r.includes(p.type)&&(p.type===""?this.addLineItem(p.fromKey,p.toKey,p.distance,u):this.addLineItem(p.fromKey,p.toKey,l.get(p.type),u))})}addLineItem(e,r,u,l=this.lineMap){let h=l.get(e)||new Map;h.set(r,u),l.set(e,h)}addFacilityToLineMap(e,r,u,l){[...this.straightLadderMap,...this.staircaseMap].forEach(([h,p])=>{if(!(p.length<2))for(let m=0;m<p.length;m++){let y=\`\${p[m].floor}\${Qn}\${p[m].id}\`,x=this.pointMap.get(y);if(!(!x||x.permission)){for(let E=0;E<p.length;E++)if(m!==E){let S=\`\${p[E].floor}\${Qn}\${p[E].id}\`,b=this.pointMap.get(S);if(!b||b.permission)continue;if(p[m].type==="straightLadder"){let C=r;this.addLineItem(y,S,C,l)}else{let C=u;this.addLineItem(y,S,C,l)}}}}}),this.escalatorMap.forEach((h,p)=>{h.forEach(m=>{if(m.start&&m.end){let y=\`\${m.start.floor}\${Qn}\${m.start.id}\`,x=\`\${m.end.floor}\${Qn}\${m.end.id}\`,E=this.pointMap.get(y),S=this.pointMap.get(x);if(E&&S&&!E.permission&&!S.permission){let b=e;this.addLineItem(y,x,b,l)}}})})}initBaseRoute(){let e=new Map((0,La.cloneDeep)([...this.lineMap]));this.addFacilityToLineMap(100,100+this.lift_priority,3e4,e),this.baseRoute=new Ni.default(e)}initEscalatorRoute(){let e=new Map((0,La.cloneDeep)([...this.lineMap])),r=1e4;this.addFacilityToLineMap(1*r,this.lift_priority*r,3e4*r,e),this.escalatorRoute=new Ni.default(e)}initStraightLadderRoute(){let e=new Map((0,La.cloneDeep)([...this.lineMap])),r=1e4;this.addFacilityToLineMap(3*r,1*r,3e4*r,e),this.straightLadderRoute=new Ni.default(e)}initForwardRoute(){this.rampMap.forEach((e,r)=>{e.forEach(u=>{if(u.start&&u.end){let l=\`\${u.start.floor}\${Qn}\${u.start.id}\`,h=\`\${u.end.floor}\${Qn}\${u.end.id}\`,p=this.pointMap.get(l),m=this.pointMap.get(h);p&&m&&!p.permission&&!m.permission&&this.addLineItem(l,h,10,this.forwardLineMap)}})}),this.forwardRoute=new Ni.default(this.forwardLineMap)}checkStart(e){return!(!e.floor||!e.nodeId&&(!e.coord||e.coord.length<2))}checkEnd(e){return e.facility||e.parkingSpace&&e.floor?!0:this.checkStart(e)}transformStart(e){var r;if(e.nodeId){let u=this.nodeMap.get(\`\${e.floor}\${Qn}\${e.nodeId}\`);if(u){let[l,h]=u.split(Qn);return{floor:l,id:h}}}if((r=e.coord)!=null&&r.length){let u=this.roadInfo.find(h=>h.floor===e.floor);if(!u)return null;let l=u.points.reduce((h,p)=>{if(p.relatedId)return h;let m=Ra(e.coord,p.cds);return m<h.min&&(h.min=m,h.point=p),h},{min:1/0,point:u.points[0]});return{floor:u.floor,id:l.point.id}}return null}transformEnd(e){if(e.floor){if(e.parkingSpace){let u=this.parkingMap.get(\`\${e.floor}\${Qn}\${e.parkingSpace}\`);if(u)return{floor:e.floor,id:u.id}}let r=this.transformStart(e);if(r)return r}if(e.facility){let u=this.facilities.filter(l=>+l.type_id==+e.facility).map(l=>l.id).map(l=>this.facilityMap.get(\`\${l}\`)).flat(2);if(u!=null&&u.length)return{floor:e.floor,facility:e.facility}}return null}getPath(e,r,u="",l){if(!this.checkStart(e))return"start-error";if(!this.checkEnd(r))return"end-error";let h=this.transformStart(e);if(!h)return"no-start";let p=this.transformEnd(r);if(!p)return"no-end";let m=this.getBasePath.bind(this);switch(u){case"escalator":m=this.getEscalatorPath.bind(this);break;case"straightLadder":m=this.getStraightLadderPath.bind(this);break;case"forward":m=this.getForwardPath.bind(this);break;default:m=this.getBasePath.bind(this);break}if(p.id)return m(h,p,l);if(p.facility){let x=this.facilities.filter(S=>+S.type_id==+r.facility).map(S=>S.id).map(S=>this.facilityMap.get(\`\${S}\`)).flat(2).filter(S=>S).filter(S=>p.floor?S.floor===p.floor:!0);if(!x.length)return null;let E=x.map(S=>m(h,{floor:S.floor,id:S.id},l)).filter(S=>!!S);return E.reduce((S,b)=>{let C=b[0].consume;return C<S.distance&&(S.distance=C,S.path=b),S},{distance:1/0,path:E[0]}).path}}getRoutePath(e,r,u){let l=\`\${e.floor}\${Qn}\${e.id}\`,h=\`\${r.floor}\${Qn}\${r.id}\`,p=u.path(l,h);if(!p)return null;let m=[],y=p.reduce((x,E,S,b)=>{if(S===0)return 0;let C=b[S-1],R=u.graph.get(C).get(E);return x+R},0);return p.map(x=>{var S;let E=this.pointMap.get(x);if(E){let{floor:b}=E,C=E.type;if(this.isFacilityByType(E.type)){let R=this.facilities.find(G=>G.id===+E.targetId);R&&(C=R.entry_infra_type)}if(((S=m[m.length-1])==null?void 0:S.floor)===b){let R=m[m.length-1];R.points.push(E.cds),R.endType=C,R.destId=E.nodeId,R.distance=K1(R.points)}else m.push({floor:b,points:[E.cds],endType:C,destId:E.nodeId,distance:0,consume:y})}}),m}getBasePath(e,r,u){if(!u)return this.getRoutePath(e,r,this.baseRoute);let l=(0,La.cloneDeep)(this.baseRoute.graph);this.addPermissionLineToMap(u,["","escalator","staircase","straightLadder"],l,new Map([["escalator",100],["straightLadder",100+this.lift_priority],["staircase",3e4]]));let h=new Ni.default(l);return this.getRoutePath(e,r,h)}getEscalatorPath(e,r,u){if(!u)return this.getRoutePath(e,r,this.escalatorRoute);let l=(0,La.cloneDeep)(this.escalatorRoute.graph),h=1e4;this.addPermissionLineToMap(u,["","escalator","staircase","straightLadder"],l,new Map([["escalator",1*h],["straightLadder",this.lift_priority*h],["staircase",3e4*h]]));let p=new Ni.default(l);return this.getRoutePath(e,r,p)}getStraightLadderPath(e,r,u){if(!u)return this.getRoutePath(e,r,this.straightLadderRoute);let l=(0,La.cloneDeep)(this.straightLadderRoute.graph),h=1e4;this.addPermissionLineToMap(u,["","escalator","staircase","straightLadder"],l,new Map([["escalator",3*h],["straightLadder",1*h],["staircase",3e4*h]]));let p=new Ni.default(l);return this.getRoutePath(e,r,p)}getForwardPath(e,r,u){if(!u)return this.getRoutePath(e,r,this.forwardRoute);let l=(0,La.cloneDeep)(this.forwardRoute.graph);this.addPermissionLineToMap(u,["","ramp"],l,new Map([["ramp",10]]));let h=new Ni.default(l);return this.getRoutePath(e,r,h)}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 Ni.default,this.escalatorRoute=new Ni.default,this.straightLadderRoute=new Ni.default}};var xN=nr(ix(),1);function EN(o,e,r){let u=Q1(o,e,r);return 180-Math.abs(u)<15?"front":u>135?"right_front":u<-135?"left_front":u<=135&&u>=60?"right":u>=-135&&u<=-60?"left":u<60&&u>0?"right_back":u>-60&&u<0?"left_back":"front"}function ox(o){if(!o.length)return[];let e=[{direction:"start",distance:Ra(o[0],o[1]),points:[o[0],o[1]]}];for(let r=2;r<o.length;r++){let u=EN(o[r-2],o[r-1],o[r]);if(u==="front"){let l=e[e.length-1],h=Ra(o[r-1],o[r]);l.distance+=h,r!==2&&l.points.push(o[r-1])}else e.push({direction:u,distance:Ra(o[r-1],o[r]),points:[o[r-1],o[r]]})}return e.push({direction:"end",distance:0,points:[o[o.length-1]]}),e}function sx(o){return o.replace(/[A-Z]/g,e=>"_"+e.toLowerCase()).replace(/^_/,"")}function ax(o){let e={};for(let u in o)u.startsWith("on")&&(e[sx(u.slice(2))]=o[u]);let r=async({data:u})=>{if(e[u.type])try{let l=await e[u.type](u.data);self.postMessage({type:\`\${u.type}_result\`,key:u.key,data:l})}catch(l){self.postMessage({type:\`\${u.type}_result\`,key:u.key,error:l})}else self.postMessage({type:\`\${u.type}_result\`,key:u.key,error:"no_event"})};return self.addEventListener("message",r),()=>{self.removeEventListener("message",r)}}var ng=new Hf;ax({onSetRoadInfo({roadData:o,facilities:e}){ng.initRoute(o,e)},onGetPath({start:o,end:e,type:r,permission:u}){return ng.getPath(o,e,r,u)},onGetDirectionPath(o){return ox(o)},onClear(){ng.clear()}});
3672
+ \`)};function Cf(o,e,r){this.x=o,this.y=e,this.weight=r}Cf.prototype.toString=function(){return"["+this.x+" "+this.y+"]"};Cf.prototype.getCost=function(o){return o&&o.x!==this.x&&o.y!==this.y?this.weight*1.41421:this.weight};Cf.prototype.isWall=function(){return this.weight===0};function f1(o){this.content=[],this.scoreFunction=o}f1.prototype={push:function(o){this.content.push(o),this.sinkDown(this.content.length-1)},pop:function(){var o=this.content[0],e=this.content.pop();return this.content.length>0&&(this.content[0]=e,this.bubbleUp(0)),o},remove:function(o){var e=this.content.indexOf(o),r=this.content.pop();e!==this.content.length-1&&(this.content[e]=r,this.scoreFunction(r)<this.scoreFunction(o)?this.sinkDown(e):this.bubbleUp(e))},size:function(){return this.content.length},rescoreElement:function(o){this.sinkDown(this.content.indexOf(o))},sinkDown:function(o){for(var e=this.content[o];o>0;){var r=(o+1>>1)-1,u=this.content[r];if(this.scoreFunction(e)<this.scoreFunction(u))this.content[r]=e,this.content[o]=u,o=r;else break}},bubbleUp:function(o){for(var e=this.content.length,r=this.content[o],u=this.scoreFunction(r);;){var l=o+1<<1,h=l-1,p=null,m;if(h<e){var y=this.content[h];m=this.scoreFunction(y),m<u&&(p=h)}if(l<e){var x=this.content[l],E=this.scoreFunction(x);E<(p===null?u:m)&&(p=l)}if(p!==null)this.content[o]=this.content[p],this.content[p]=r,o=p;else break}}};function Ud(){this._=null}function Xu(o){o.U=o.C=o.L=o.R=o.P=o.N=null}Ud.prototype={constructor:Ud,insert:function(o,e){var r,u,l;if(o){if(e.P=o,e.N=o.N,o.N&&(o.N.P=e),o.N=e,o.R){for(o=o.R;o.L;)o=o.L;o.L=e}else o.R=e;r=o}else this._?(o=h1(this._),e.P=null,e.N=o,o.P=o.L=e,r=o):(e.P=e.N=null,this._=e,r=null);for(e.L=e.R=null,e.U=r,e.C=!0,o=e;r&&r.C;)u=r.U,r===u.L?(l=u.R,l&&l.C?(r.C=l.C=!1,u.C=!0,o=u):(o===r.R&&(Hl(this,r),o=r,r=o.U),r.C=!1,u.C=!0,Vl(this,u))):(l=u.L,l&&l.C?(r.C=l.C=!1,u.C=!0,o=u):(o===r.L&&(Vl(this,r),o=r,r=o.U),r.C=!1,u.C=!0,Hl(this,u))),r=o.U;this._.C=!1},remove:function(o){o.N&&(o.N.P=o.P),o.P&&(o.P.N=o.N),o.N=o.P=null;var e=o.U,r,u=o.L,l=o.R,h,p;if(u?l?h=h1(l):h=u:h=l,e?e.L===o?e.L=h:e.R=h:this._=h,u&&l?(p=h.C,h.C=o.C,h.L=u,u.U=h,h!==l?(e=h.U,h.U=o.U,o=h.R,e.L=o,h.R=l,l.U=h):(h.U=e,e=h,o=h.R)):(p=o.C,o=h),o&&(o.U=e),!p){if(o&&o.C){o.C=!1;return}do{if(o===this._)break;if(o===e.L){if(r=e.R,r.C&&(r.C=!1,e.C=!0,Hl(this,e),r=e.R),r.L&&r.L.C||r.R&&r.R.C){(!r.R||!r.R.C)&&(r.L.C=!1,r.C=!0,Vl(this,r),r=e.R),r.C=e.C,e.C=r.R.C=!1,Hl(this,e),o=this._;break}}else if(r=e.L,r.C&&(r.C=!1,e.C=!0,Vl(this,e),r=e.L),r.L&&r.L.C||r.R&&r.R.C){(!r.L||!r.L.C)&&(r.R.C=!1,r.C=!0,Hl(this,r),r=e.L),r.C=e.C,e.C=r.L.C=!1,Vl(this,e),o=this._;break}r.C=!0,o=e,e=e.U}while(!o.C);o&&(o.C=!1)}}};function Hl(o,e){var r=e,u=e.R,l=r.U;l?l.L===r?l.L=u:l.R=u:o._=u,u.U=l,r.U=u,r.R=u.L,r.R&&(r.R.U=r),u.L=r}function Vl(o,e){var r=e,u=e.L,l=r.U;l?l.L===r?l.L=u:l.R=u:o._=u,u.U=l,r.U=u,r.L=u.R,r.L&&(r.L.U=r),u.R=r}function h1(o){for(;o.L;)o=o.L;return o}var Bd=Ud;function Yu(o,e,r,u){var l=[null,null],h=ui.push(l)-1;return l.left=o,l.right=e,r&&Wl(l,o,e,r),u&&Wl(l,e,o,u),Ji[o.index].halfedges.push(h),Ji[e.index].halfedges.push(h),l}function $u(o,e,r){var u=[e,r];return u.left=o,u}function Wl(o,e,r,u){!o[0]&&!o[1]?(o[0]=u,o.left=e,o.right=r):o.left===r?o[1]=u:o[0]=u}function h2(o,e,r,u,l){var h=o[0],p=o[1],m=h[0],y=h[1],x=p[0],E=p[1],S=0,b=1,C=x-m,R=E-y,G;if(G=e-m,!(!C&&G>0)){if(G/=C,C<0){if(G<S)return;G<b&&(b=G)}else if(C>0){if(G>b)return;G>S&&(S=G)}if(G=u-m,!(!C&&G<0)){if(G/=C,C<0){if(G>b)return;G>S&&(S=G)}else if(C>0){if(G<S)return;G<b&&(b=G)}if(G=r-y,!(!R&&G>0)){if(G/=R,R<0){if(G<S)return;G<b&&(b=G)}else if(R>0){if(G>b)return;G>S&&(S=G)}if(G=l-y,!(!R&&G<0)){if(G/=R,R<0){if(G>b)return;G>S&&(S=G)}else if(R>0){if(G<S)return;G<b&&(b=G)}return!(S>0)&&!(b<1)||(S>0&&(o[0]=[m+S*C,y+S*R]),b<1&&(o[1]=[m+b*C,y+b*R])),!0}}}}}function p2(o,e,r,u,l){var h=o[1];if(h)return!0;var p=o[0],m=o.left,y=o.right,x=m[0],E=m[1],S=y[0],b=y[1],C=(x+S)/2,R=(E+b)/2,G,O;if(b===E){if(C<e||C>=u)return;if(x>S){if(!p)p=[C,r];else if(p[1]>=l)return;h=[C,l]}else{if(!p)p=[C,l];else if(p[1]<r)return;h=[C,r]}}else if(G=(x-S)/(b-E),O=R-G*C,G<-1||G>1)if(x>S){if(!p)p=[(r-O)/G,r];else if(p[1]>=l)return;h=[(l-O)/G,l]}else{if(!p)p=[(l-O)/G,l];else if(p[1]<r)return;h=[(r-O)/G,r]}else if(E<b){if(!p)p=[e,G*e+O];else if(p[0]>=u)return;h=[u,G*u+O]}else{if(!p)p=[u,G*u+O];else if(p[0]<e)return;h=[e,G*e+O]}return o[0]=p,o[1]=h,!0}function p1(o,e,r,u){for(var l=ui.length,h;l--;)(!p2(h=ui[l],o,e,r,u)||!h2(h,o,e,r,u)||!(Math.abs(h[0][0]-h[1][0])>Dn||Math.abs(h[0][1]-h[1][1])>Dn))&&delete ui[l]}function d1(o){return Ji[o.index]={site:o,halfedges:[]}}function d2(o,e){var r=o.site,u=e.left,l=e.right;return r===l&&(l=u,u=r),l?Math.atan2(l[1]-u[1],l[0]-u[0]):(r===u?(u=e[1],l=e[0]):(u=e[0],l=e[1]),Math.atan2(u[0]-l[0],l[1]-u[1]))}function zd(o,e){return e[+(e.left!==o.site)]}function g2(o,e){return e[+(e.left===o.site)]}function g1(){for(var o=0,e=Ji.length,r,u,l,h;o<e;++o)if((r=Ji[o])&&(h=(u=r.halfedges).length)){var p=new Array(h),m=new Array(h);for(l=0;l<h;++l)p[l]=l,m[l]=d2(r,ui[u[l]]);for(p.sort(function(y,x){return m[x]-m[y]}),l=0;l<h;++l)m[l]=u[p[l]];for(l=0;l<h;++l)u[l]=m[l]}}function m1(o,e,r,u){var l=Ji.length,h,p,m,y,x,E,S,b,C,R,G,O,N=!0;for(h=0;h<l;++h)if(p=Ji[h]){for(m=p.site,x=p.halfedges,y=x.length;y--;)ui[x[y]]||x.splice(y,1);for(y=0,E=x.length;y<E;)R=g2(p,ui[x[y]]),G=R[0],O=R[1],S=zd(p,ui[x[++y%E]]),b=S[0],C=S[1],(Math.abs(G-b)>Dn||Math.abs(O-C)>Dn)&&(x.splice(y,0,ui.push($u(m,R,Math.abs(G-o)<Dn&&u-O>Dn?[o,Math.abs(b-o)<Dn?C:u]:Math.abs(O-u)<Dn&&r-G>Dn?[Math.abs(C-u)<Dn?b:r,u]:Math.abs(G-r)<Dn&&O-e>Dn?[r,Math.abs(b-r)<Dn?C:e]:Math.abs(O-e)<Dn&&G-o>Dn?[Math.abs(C-e)<Dn?b:o,e]:null))-1),++E);E&&(N=!1)}if(N){var k,F,$,Z=1/0;for(h=0,N=null;h<l;++h)(p=Ji[h])&&(m=p.site,k=m[0]-o,F=m[1]-e,$=k*k+F*F,$<Z&&(Z=$,N=p));if(N){var it=[o,e],et=[o,u],U=[r,u],wt=[r,e];N.halfedges.push(ui.push($u(m=N.site,it,et))-1,ui.push($u(m,et,U))-1,ui.push($u(m,U,wt))-1,ui.push($u(m,wt,it))-1)}}for(h=0;h<l;++h)(p=Ji[h])&&(p.halfedges.length||delete Ji[h])}var y1=[],If;function m2(){Xu(this),this.x=this.y=this.arc=this.site=this.cy=null}function ru(o){var e=o.P,r=o.N;if(!(!e||!r)){var u=e.site,l=o.site,h=r.site;if(u!==h){var p=l[0],m=l[1],y=u[0]-p,x=u[1]-m,E=h[0]-p,S=h[1]-m,b=2*(y*S-x*E);if(!(b>=-v1)){var C=y*y+x*x,R=E*E+S*S,G=(S*C-x*R)/b,O=(y*R-E*C)/b,N=y1.pop()||new m2;N.arc=o,N.site=l,N.x=G+p,N.y=(N.cy=O+m)+Math.sqrt(G*G+O*O),o.circle=N;for(var k=null,F=Zu._;F;)if(N.y<F.y||N.y===F.y&&N.x<=F.x)if(F.L)F=F.L;else{k=F.P;break}else if(F.R)F=F.R;else{k=F;break}Zu.insert(k,N),k||(If=N)}}}}function iu(o){var e=o.circle;e&&(e.P||(If=e.N),Zu.remove(e),y1.push(e),Xu(e),o.circle=null)}var x1=[];function y2(){Xu(this),this.edge=this.site=this.circle=null}function _1(o){var e=x1.pop()||new y2;return e.site=o,e}function kd(o){iu(o),ou.remove(o),x1.push(o),Xu(o)}function E1(o){var e=o.circle,r=e.x,u=e.cy,l=[r,u],h=o.P,p=o.N,m=[o];kd(o);for(var y=h;y.circle&&Math.abs(r-y.circle.x)<Dn&&Math.abs(u-y.circle.cy)<Dn;)h=y.P,m.unshift(y),kd(y),y=h;m.unshift(y),iu(y);for(var x=p;x.circle&&Math.abs(r-x.circle.x)<Dn&&Math.abs(u-x.circle.cy)<Dn;)p=x.N,m.push(x),kd(x),x=p;m.push(x),iu(x);var E=m.length,S;for(S=1;S<E;++S)x=m[S],y=m[S-1],Wl(x.edge,y.site,x.site,l);y=m[0],x=m[E-1],x.edge=Yu(y.site,x.site,null,l),ru(y),ru(x)}function w1(o){for(var e=o[0],r=o[1],u,l,h,p,m=ou._;m;)if(h=M1(m,r)-e,h>Dn)m=m.L;else if(p=e-v2(m,r),p>Dn){if(!m.R){u=m;break}m=m.R}else{h>-Dn?(u=m.P,l=m):p>-Dn?(u=m,l=m.N):u=l=m;break}d1(o);var y=_1(o);if(ou.insert(u,y),!(!u&&!l)){if(u===l){iu(u),l=_1(u.site),ou.insert(y,l),y.edge=l.edge=Yu(u.site,y.site),ru(u),ru(l);return}if(!l){y.edge=Yu(u.site,y.site);return}iu(u),iu(l);var x=u.site,E=x[0],S=x[1],b=o[0]-E,C=o[1]-S,R=l.site,G=R[0]-E,O=R[1]-S,N=2*(b*O-C*G),k=b*b+C*C,F=G*G+O*O,$=[(O*k-C*F)/N+E,(b*F-G*k)/N+S];Wl(l.edge,x,R,$),y.edge=Yu(x,o,null,$),l.edge=Yu(o,R,null,$),ru(u),ru(l)}}function M1(o,e){var r=o.site,u=r[0],l=r[1],h=l-e;if(!h)return u;var p=o.P;if(!p)return-1/0;r=p.site;var m=r[0],y=r[1],x=y-e;if(!x)return m;var E=m-u,S=1/h-1/x,b=E/x;return S?(-b+Math.sqrt(b*b-2*S*(E*E/(-2*x)-y+x/2+l-h/2)))/S+u:(u+m)/2}function v2(o,e){var r=o.N;if(r)return M1(r,e);var u=o.site;return u[1]===e?u[0]:1/0}var Dn=1e-6,v1=1e-12,ou,Ji,Zu,ui;function _2(o,e,r){return(o[0]-r[0])*(e[1]-o[1])-(o[0]-e[0])*(r[1]-o[1])}function x2(o,e){return e[1]-o[1]||e[0]-o[0]}function Pf(o,e){var r=o.sort(x2).pop(),u,l,h;for(ui=[],Ji=new Array(o.length),ou=new Bd,Zu=new Bd;;)if(h=If,r&&(!h||r[1]<h.y||r[1]===h.y&&r[0]<h.x))(r[0]!==u||r[1]!==l)&&(w1(r),u=r[0],l=r[1]),r=o.pop();else if(h)E1(h.arc);else break;if(g1(),e){var p=+e[0][0],m=+e[0][1],y=+e[1][0],x=+e[1][1];p1(p,m,y,x),m1(p,m,y,x)}this.edges=ui,this.cells=Ji,ou=Zu=ui=Ji=null}Pf.prototype={constructor:Pf,polygons:function(){var o=this.edges;return this.cells.map(function(e){var r=e.halfedges.map(function(u){return zd(e,o[u])});return r.data=e.site.data,r})},triangles:function(){var o=[],e=this.edges;return this.cells.forEach(function(r,u){if(m=(h=r.halfedges).length)for(var l=r.site,h,p=-1,m,y,x=e[h[m-1]],E=x.left===l?x.right:x.left;++p<m;)y=E,x=e[h[p]],E=x.left===l?x.right:x.left,y&&E&&u<y.index&&u<E.index&&_2(l,y,E)<0&&o.push([l.data,y.data,E.data])}),o},links:function(){return this.edges.filter(function(o){return o.right}).map(function(o){return{source:o.left.data,target:o.right.data}})},find:function(o,e,r){for(var u=this,l,h=u._found||0,p=u.cells.length,m;!(m=u.cells[h]);)if(++h>=p)return null;var y=o-m.site[0],x=e-m.site[1],E=y*y+x*x;do m=u.cells[l=h],h=null,m.halfedges.forEach(function(S){var b=u.edges[S],C=b.left;if(!((C===m.site||!C)&&!(C=b.right))){var R=o-C[0],G=e-C[1],O=R*R+G*G;O<E&&(E=O,h=C.index)}});while(h!==null);return u._found=l,r==null||E<=r*r?m.site:null}};var C2=nr(Ju(),1);var eg=nr(T1(),1);function Eo(){return new Nf}function Nf(){this.reset()}Nf.prototype={constructor:Nf,reset:function(){this.s=this.t=0},add:function(o){C1(Lf,o,this.t),C1(this,Lf.s,this.s),this.s?this.t+=Lf.t:this.s=Lf.t},valueOf:function(){return this.s}};var Lf=new Nf;function C1(o,e,r){var u=o.s=e+r,l=u-e,h=u-l;o.t=e-h+(r-l)}var dn=1e-6;var In=Math.PI,Wr=In/2,Df=In/4,Ds=In*2,su=180/In,wo=In/180,_r=Math.abs,ps=Math.atan,Mo=Math.atan2,rn=Math.cos;var Of=Math.exp;var ql=Math.log;var pe=Math.sin;var wi=Math.sqrt,Xl=Math.tan;function Vd(o){return o>1?0:o<-1?In:Math.acos(o)}function Ki(o){return o>1?Wr:o<-1?-Wr:Math.asin(o)}function ds(){}var I2=Eo(),S6=Eo();function au(o){var e=o[0],r=o[1],u=rn(r);return[u*rn(e),u*pe(e),pe(r)]}function Yl(o,e){return[o[1]*e[2]-o[2]*e[1],o[2]*e[0]-o[0]*e[2],o[0]*e[1]-o[1]*e[0]]}function $l(o){var e=wi(o[0]*o[0]+o[1]*o[1]+o[2]*o[2]);o[0]/=e,o[1]/=e,o[2]/=e}var D6=Eo();function P1(o,e){return[o>In?o-Ds:o<-In?o+Ds:o,e]}P1.invert=P1;function Wd(){var o=[],e;return{point:function(r,u){e.push([r,u])},lineStart:function(){o.push(e=[])},lineEnd:ds,rejoin:function(){o.length>1&&o.push(o.pop().concat(o.shift()))},result:function(){var r=o;return o=[],e=null,r}}}function qd(o,e){return _r(o[0]-e[0])<dn&&_r(o[1]-e[1])<dn}function Ff(o,e,r,u){this.x=o,this.z=e,this.o=r,this.e=u,this.v=!1,this.n=this.p=null}function Xd(o,e,r,u,l){var h=[],p=[],m,y;if(o.forEach(function(R){if(!((G=R.length-1)<=0)){var G,O=R[0],N=R[G],k;if(qd(O,N)){for(l.lineStart(),m=0;m<G;++m)l.point((O=R[m])[0],O[1]);l.lineEnd();return}h.push(k=new Ff(O,R,null,!0)),p.push(k.o=new Ff(O,null,k,!1)),h.push(k=new Ff(N,R,null,!1)),p.push(k.o=new Ff(N,null,k,!0))}}),!!h.length){for(p.sort(e),R1(h),R1(p),m=0,y=p.length;m<y;++m)p[m].e=r=!r;for(var x=h[0],E,S;;){for(var b=x,C=!0;b.v;)if((b=b.n)===x)return;E=b.z,l.lineStart();do{if(b.v=b.o.v=!0,b.e){if(C)for(m=0,y=E.length;m<y;++m)l.point((S=E[m])[0],S[1]);else u(b.x,b.n.x,1,l);b=b.n}else{if(C)for(E=b.p.z,m=E.length-1;m>=0;--m)l.point((S=E[m])[0],S[1]);else u(b.x,b.p.x,-1,l);b=b.p}b=b.o,E=b.z,C=!C}while(!b.v);l.lineEnd()}}}function R1(o){if(e=o.length){for(var e,r=0,u=o[0],l;++r<e;)u.n=l=o[r],l.p=u,u=l;u.n=l=o[0],l.p=u}}function Ia(o,e){return o<e?-1:o>e?1:o>=e?0:NaN}function Yd(o){return o.length===1&&(o=L2(o)),{left:function(e,r,u,l){for(u==null&&(u=0),l==null&&(l=e.length);u<l;){var h=u+l>>>1;o(e[h],r)<0?u=h+1:l=h}return u},right:function(e,r,u,l){for(u==null&&(u=0),l==null&&(l=e.length);u<l;){var h=u+l>>>1;o(e[h],r)>0?l=h:u=h+1}return u}}}function L2(o){return function(e,r){return Ia(o(e),r)}}var L1=Yd(Ia),N2=L1.right,D2=L1.left;var N1=Array.prototype,F2=N1.slice,U2=N1.map;var AH=Math.sqrt(50),TH=Math.sqrt(10),CH=Math.sqrt(2);function Bf(o){for(var e=o.length,r,u=-1,l=0,h,p;++u<e;)l+=o[u].length;for(h=new Array(l);--e>=0;)for(p=o[e],r=p.length;--r>=0;)h[--l]=p[r];return h}var q2=1e9,f8=-q2;var $d=Eo();function Zd(o,e){var r=e[0],u=e[1],l=[pe(r),-rn(r),0],h=0,p=0;$d.reset();for(var m=0,y=o.length;m<y;++m)if(E=(x=o[m]).length)for(var x,E,S=x[E-1],b=S[0],C=S[1]/2+Df,R=pe(C),G=rn(C),O=0;O<E;++O,b=k,R=$,G=Z,S=N){var N=x[O],k=N[0],F=N[1]/2+Df,$=pe(F),Z=rn(F),it=k-b,et=it>=0?1:-1,U=et*it,wt=U>In,Lt=R*$;if($d.add(Mo(Lt*et*pe(U),G*Z+Lt*rn(U))),h+=wt?it+et*Ds:it,wt^b>=r^k>=r){var Ot=Yl(au(S),au(N));$l(Ot);var W=Yl(l,Ot);$l(W);var de=(wt^it>=0?-1:1)*Ki(W[2]);(u>de||u===de&&(Ot[0]||Ot[1]))&&(p+=wt^it>=0?1:-1)}}return(h<-dn||h<dn&&$d<-dn)^p&1}var E8=Eo();var k8=Eo(),G8=Eo();var $2=1/0;var W8=-$2;function Jd(o){this._context=o}Jd.prototype={_radius:4.5,pointRadius:function(o){return this._radius=o,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(o,e){switch(this._point){case 0:{this._context.moveTo(o,e),this._point=1;break}case 1:{this._context.lineTo(o,e);break}default:{this._context.moveTo(o+this._radius,e),this._context.arc(o,e,this._radius,0,Ds);break}}},result:ds};var tW=Eo();function Kd(){this._string=[]}Kd.prototype={_radius:4.5,_circle:F1(4.5),pointRadius:function(o){return(o=+o)!==this._radius&&(this._radius=o,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(o,e){switch(this._point){case 0:{this._string.push("M",o,",",e),this._point=1;break}case 1:{this._string.push("L",o,",",e);break}default:{this._circle==null&&(this._circle=F1(this._radius)),this._string.push("M",o,",",e,this._circle);break}}},result:function(){if(this._string.length){var o=this._string.join("");return this._string=[],o}else return null}};function F1(o){return"m0,"+o+"a"+o+","+o+" 0 1,1 0,"+-2*o+"a"+o+","+o+" 0 1,1 0,"+2*o+"z"}function Qd(o,e,r,u){return function(l,h){var p=e(h),m=l.invert(u[0],u[1]),y=Wd(),x=e(y),E=!1,S,b,C,R={point:G,lineStart:N,lineEnd:k,polygonStart:function(){R.point=F,R.lineStart=$,R.lineEnd=Z,b=[],S=[]},polygonEnd:function(){R.point=G,R.lineStart=N,R.lineEnd=k,b=Bf(b);var it=Zd(S,m);b.length?(E||(h.polygonStart(),E=!0),Xd(b,K2,it,r,h)):it&&(E||(h.polygonStart(),E=!0),h.lineStart(),r(null,null,1,h),h.lineEnd()),E&&(h.polygonEnd(),E=!1),b=S=null},sphere:function(){h.polygonStart(),h.lineStart(),r(null,null,1,h),h.lineEnd(),h.polygonEnd()}};function G(it,et){var U=l(it,et);o(it=U[0],et=U[1])&&h.point(it,et)}function O(it,et){var U=l(it,et);p.point(U[0],U[1])}function N(){R.point=O,p.lineStart()}function k(){R.point=G,p.lineEnd()}function F(it,et){C.push([it,et]);var U=l(it,et);x.point(U[0],U[1])}function $(){x.lineStart(),C=[]}function Z(){F(C[0][0],C[0][1]),x.lineEnd();var it=x.clean(),et=y.result(),U,wt=et.length,Lt,Ot,W;if(C.pop(),S.push(C),C=null,!!wt){if(it&1){if(Ot=et[0],(Lt=Ot.length-1)>0){for(E||(h.polygonStart(),E=!0),h.lineStart(),U=0;U<Lt;++U)h.point((W=Ot[U])[0],W[1]);h.lineEnd()}return}wt>1&&it&2&&et.push(et.pop().concat(et.shift())),b.push(et.filter(J2))}}return R}}function J2(o){return o.length>1}function K2(o,e){return((o=o.x)[0]<0?o[1]-Wr-dn:Wr-o[1])-((e=e.x)[0]<0?e[1]-Wr-dn:Wr-e[1])}var Q2=Qd(function(){return!0},j2,eN,[-In,-Wr]);function j2(o){var e=NaN,r=NaN,u=NaN,l;return{lineStart:function(){o.lineStart(),l=1},point:function(h,p){var m=h>0?In:-In,y=_r(h-e);_r(y-In)<dn?(o.point(e,r=(r+p)/2>0?Wr:-Wr),o.point(u,r),o.lineEnd(),o.lineStart(),o.point(m,r),o.point(h,r),l=0):u!==m&&y>=In&&(_r(e-u)<dn&&(e-=u*dn),_r(h-m)<dn&&(h-=m*dn),r=tN(e,r,h,p),o.point(u,r),o.lineEnd(),o.lineStart(),o.point(m,r),l=0),o.point(e=h,r=p),u=m},lineEnd:function(){o.lineEnd(),e=r=NaN},clean:function(){return 2-l}}}function tN(o,e,r,u){var l,h,p=pe(o-r);return _r(p)>dn?ps((pe(e)*(h=rn(u))*pe(r)-pe(u)*(l=rn(e))*pe(o))/(l*h*p)):(e+u)/2}function eN(o,e,r,u){var l;if(o==null)l=r*Wr,u.point(-In,l),u.point(0,l),u.point(In,l),u.point(In,0),u.point(In,-l),u.point(0,-l),u.point(-In,-l),u.point(-In,0),u.point(-In,l);else if(_r(o[0]-e[0])>dn){var h=o[0]<e[0]?In:-In;l=r*h/2,u.point(-h,l),u.point(0,l),u.point(h,l)}else u.point(e[0],e[1])}function zf(o){return function(e){var r=new jd;for(var u in o)r[u]=o[u];return r.stream=e,r}}function jd(){}jd.prototype={constructor:jd,point:function(o,e){this.stream.point(o,e)},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 GW=rn(30*wo);var eq=zf({point:function(o,e){this.stream.point(o*wo,e*wo)}});function kf(o){return function(e,r){var u=rn(e),l=rn(r),h=o(u*l);return[h*l*pe(e),h*pe(r)]}}function Os(o){return function(e,r){var u=wi(e*e+r*r),l=o(u),h=pe(l),p=rn(l);return[Mo(e*h,u*p),Ki(u&&r*h/u)]}}var V1=kf(function(o){return wi(2/(1+o))});V1.invert=Os(function(o){return 2*Ki(o/2)});var W1=kf(function(o){return(o=Vd(o))&&o/pe(o)});W1.invert=Os(function(o){return o});function tg(o,e){return[o,ql(Xl((Wr+e)/2))]}tg.invert=function(o,e){return[o,2*ps(Of(e))-Wr]};function Gf(o,e){return[o,e]}Gf.invert=Gf;function q1(o,e){var r=rn(e),u=rn(o)*r;return[r*pe(o)/u,pe(e)/u]}q1.invert=Os(ps);function X1(o,e){var r=e*e,u=r*r;return[o*(.8707-.131979*r+u*(-.013791+u*(.003971*r-.001529*u))),e*(1.007226+r*(.015085+u*(-.044475+.028874*r-.005916*u)))]}X1.invert=function(o,e){var r=e,u=25,l;do{var h=r*r,p=h*h;r-=l=(r*(1.007226+h*(.015085+p*(-.044475+.028874*h-.005916*p)))-e)/(1.007226+h*(.015085*3+p*(-.044475*7+.028874*9*h-.005916*11*p)))}while(_r(l)>dn&&--u>0);return[o/(.8707+(h=r*r)*(-.131979+h*(-.013791+h*h*h*(.003971-.001529*h)))),r]};function Y1(o,e){return[rn(e)*pe(o),pe(e)]}Y1.invert=Os(Ki);function $1(o,e){var r=rn(e),u=1+rn(o)*r;return[r*pe(o)/u,pe(e)/u]}$1.invert=Os(function(o){return 2*ps(o)});function Z1(o,e){return[ql(Xl((Wr+e)/2)),-o]}Z1.invert=function(o,e){return[-e,2*ps(Of(o))-Wr]};var aN=nr(Ju(),1);var uN=nr(Ju(),1);var cN=nr(Ju(),1);var fN=nr(Ju(),1);function Ra(o,e){return Math.sqrt((e[0]-o[0])**2+(e[1]-o[1])**2)}function K1(o){let e=0;for(let r=0;r<o.length-1;r++)e+=Ra(o[r],o[r+1]);return e}function Q1(o,e,r){let u=new Yi(e[0]-o[0],e[1]-o[1]),l=new Yi(e[0]-r[0],e[1]-r[1]),p=u.angleTo(l)*180/Math.PI,m=new Yi(e[0]-o[0],e[1]-o[1]);return new Yi(r[0]-o[0],r[1]-o[1]).cross(m)>0?p:-p}var La=nr(j1(),1);var Qn="___",Hf=class{constructor(e=3){this.lift_priority=e;ri(this,"roadInfo",[]);ri(this,"facilities",[]);ri(this,"pointMap",new Map);ri(this,"nodeMap",new Map);ri(this,"facilityMap",new Map);ri(this,"straightLadderMap",new Map);ri(this,"escalatorMap",new Map);ri(this,"rampMap",new Map);ri(this,"staircaseMap",new Map);ri(this,"parkingMap",new Map);ri(this,"lineMap",new Map);ri(this,"baseRoute",new Ni.default);ri(this,"escalatorRoute",new Ni.default);ri(this,"straightLadderRoute",new Ni.default);ri(this,"forwardLineMap",new Map);ri(this,"forwardRoute",new Ni.default)}isFacilityByType(e){return["facility","escalator","straightLadder","staircase","ramp"].includes(e)}initFacilities(e){this.facilities=e.map(r=>{let u=[];try{u=JSON.parse(r.entry_end_floor)}catch(h){u=[]}let l=[];try{l=JSON.parse(r.entry_start_floor)}catch(h){l=[]}return Uh(Eu({},r),{entry_start_floor:l,entry_end_floor:u})})}initRoute(e,r){this.clear(),this.roadInfo=e,this.initFacilities(r);let u=new Date,l=u.getHours()*60+u.getMinutes();e.length&&(e.forEach(h=>{(h.points||[]).filter(p=>p.openStatus!==!1).filter(p=>{if(!p.startTime||!p.endTime)return!0;let[m,y]=p.startTime.split(":").map(C=>+C),[x,E]=p.endTime.split(":").map(C=>+C),S=m*60+y,b=x*60+E;return l>=S&&l<=b}).forEach(p=>{p.floor=h.floor;let m=\`\${h.floor}\${Qn}\${p.id}\`;if(this.nodeMap.set(\`\${h.floor}\${Qn}\${p.nodeId}\`,\`\${h.floor}\${Qn}\${p.relatedId||p.id}\`),this.pointMap.set(m,p),this.isFacilityByType(p.type)){let y=this.facilities.find(x=>x.id===+p.targetId);if(y){switch(y.entry_infra_type){case"straightLadder":if(y.entry_end_floor.find(b=>b.floor===h.floor)&&y.entry_start_floor.find(b=>b.floor===h.floor)){let b=this.straightLadderMap.get(p.targetId)||[];b.push(Eu({},p)),this.straightLadderMap.set(p.targetId,b)}break;case"staircase":if(y.entry_end_floor.find(b=>b.floor===h.floor)&&y.entry_start_floor.find(b=>b.floor===h.floor)){let b=this.staircaseMap.get(p.targetId)||[];b.push(Eu({},p)),this.staircaseMap.set(p.targetId,b)}break;case"escalator":let E=this.escalatorMap.get(p.targetId)||[];if(y.entry_start_floor.find(b=>b.floor===h.floor)){let b=E.find(C=>{var R;return((R=C.end)==null?void 0:R.floor)!==h.floor&&!C.start});b?b.start=p:E.push({start:p})}if(y.entry_end_floor.find(b=>b.floor===h.floor)){let b=E.find(C=>{var R;return((R=C.start)==null?void 0:R.floor)!==h.floor&&!C.end});b?b.end=p:E.push({end:p})}this.escalatorMap.set(p.targetId,E);break;case"ramp":let S=this.rampMap.get(p.targetId)||[];if(y.entry_start_floor.find(b=>b.floor===h.floor)){let b=S.find(C=>{var R;return((R=C.end)==null?void 0:R.floor)!==h.floor&&!C.start});b?b.start=p:S.push({start:p})}if(y.entry_end_floor.find(b=>b.floor===h.floor)){let b=S.find(C=>{var R;return((R=C.start)==null?void 0:R.floor)!==h.floor&&!C.end});b?b.end=p:S.push({end:p})}this.rampMap.set(p.targetId,S);break}let x=this.facilityMap.get(p.targetId)||[];x.push(Eu({},p)),this.facilityMap.set(p.targetId,x)}}p.type==="parkingSpace"&&this.parkingMap.set(\`\${h.floor}\${Qn}\${p.name}\`,p)}),(h.lines||[]).filter(p=>p.direction!=="no").forEach(p=>{let m=\`\${h.floor}\${Qn}\${p.from}\`,y=\`\${h.floor}\${Qn}\${p.to}\`,x=this.pointMap.get(m),E=this.pointMap.get(y);if(!x||!E)return;let S=x.cds,b=E.cds,C=Ra(S,b);if(!x.permission&&!E.permission)switch(this.addLineItem(m,y,C),this.addLineItem(y,m,C),p.direction){case"double":this.addLineItem(m,y,C,this.forwardLineMap),this.addLineItem(y,m,C,this.forwardLineMap);break;case"single":this.addLineItem(m,y,C,this.forwardLineMap);break;case"back":this.addLineItem(y,m,C,this.forwardLineMap);break}else x.permission&&(this.setPermissionLine(m,y,x.permission,C,""),this.setPermissionLine(y,m,x.permission,C,"")),E.permission&&E.permission!==x.permission&&(this.setPermissionLine(m,y,E.permission,C,""),this.setPermissionLine(y,m,E.permission,C,""))})}),this.addPermissionFacility(),this.initBaseRoute(),this.initEscalatorRoute(),this.initStraightLadderRoute(),this.initForwardRoute())}getPermissionMap(e){return this[\`permission_\${e}\`]||(this[\`permission_\${e}\`]=new Set),this[\`permission_\${e}\`]}setPermissionLine(e,r,u,l,h){this.getPermissionMap(u).add({fromKey:e,toKey:r,distance:l,type:h})}addPermissionFacility(){this.straightLadderMap.forEach((e,r)=>{if(e.length<2){this.straightLadderMap.delete(r);return}for(let u=0;u<e.length;u++){let l=\`\${e[u].floor}\${Qn}\${e[u].id}\`,h=this.pointMap.get(l);if(h){for(let p=0;p<e.length;p++)if(u!==p){let m=\`\${e[p].floor}\${Qn}\${e[p].id}\`,y=this.pointMap.get(m);if(!y)continue;h.permission&&this.setPermissionLine(l,m,h.permission,1,"straightLadder"),y.permission&&y.permission!==h.permission&&this.setPermissionLine(l,m,y.permission,1,"straightLadder")}}}}),this.staircaseMap.forEach((e,r)=>{if(e.length<2){this.staircaseMap.delete(r);return}for(let u=0;u<e.length;u++){let l=\`\${e[u].floor}\${Qn}\${e[u].id}\`,h=this.pointMap.get(l);if(h){for(let p=0;p<e.length;p++)if(u!==p){let m=\`\${e[p].floor}\${Qn}\${e[p].id}\`,y=this.pointMap.get(m);if(!y)continue;h.permission&&this.setPermissionLine(l,m,h.permission,1,"staircase"),y.permission&&y.permission!==h.permission&&this.setPermissionLine(l,m,y.permission,1,"straightLadder")}}}}),this.escalatorMap.forEach((e,r)=>{e.forEach(u=>{if(u.start&&u.end){let l=\`\${u.start.floor}\${Qn}\${u.start.id}\`,h=\`\${u.end.floor}\${Qn}\${u.end.id}\`,p=this.pointMap.get(l),m=this.pointMap.get(h);p&&m&&(p.permission&&this.setPermissionLine(l,h,p.permission,1,"escalator"),m.permission&&m.permission!==p.permission&&this.setPermissionLine(l,h,m.permission,1,"escalator"))}})}),this.rampMap.forEach((e,r)=>{e.forEach(u=>{if(u.start&&u.end){let l=\`\${u.start.floor}\${Qn}\${u.start.id}\`,h=\`\${u.end.floor}\${Qn}\${u.end.id}\`,p=this.pointMap.get(l),m=this.pointMap.get(h);p&&m&&(p.permission&&this.setPermissionLine(l,h,p.permission,10,"ramp"),m.permission&&m.permission!==p.permission&&this.setPermissionLine(l,h,m.permission,10,"ramp"))}})})}addPermissionLineToMap(e,r,u,l){let h=this.getPermissionMap(e);console.log(h),h.forEach(p=>{r.includes(p.type)&&(p.type===""?this.addLineItem(p.fromKey,p.toKey,p.distance,u):this.addLineItem(p.fromKey,p.toKey,l.get(p.type),u))})}addLineItem(e,r,u,l=this.lineMap){let h=l.get(e)||new Map;h.set(r,u),l.set(e,h)}addFacilityToLineMap(e,r,u,l){[...this.straightLadderMap,...this.staircaseMap].forEach(([h,p])=>{if(!(p.length<2))for(let m=0;m<p.length;m++){let y=\`\${p[m].floor}\${Qn}\${p[m].id}\`,x=this.pointMap.get(y);if(!(!x||x.permission)){for(let E=0;E<p.length;E++)if(m!==E){let S=\`\${p[E].floor}\${Qn}\${p[E].id}\`,b=this.pointMap.get(S);if(!b||b.permission)continue;if(p[m].type==="straightLadder"){let C=r;this.addLineItem(y,S,C,l)}else{let C=u;this.addLineItem(y,S,C,l)}}}}}),this.escalatorMap.forEach((h,p)=>{h.forEach(m=>{if(m.start&&m.end){let y=\`\${m.start.floor}\${Qn}\${m.start.id}\`,x=\`\${m.end.floor}\${Qn}\${m.end.id}\`,E=this.pointMap.get(y),S=this.pointMap.get(x);if(E&&S&&!E.permission&&!S.permission){let b=e;this.addLineItem(y,x,b,l)}}})})}initBaseRoute(){let e=new Map((0,La.cloneDeep)([...this.lineMap]));this.addFacilityToLineMap(100,100+this.lift_priority,3e4,e),this.baseRoute=new Ni.default(e)}initEscalatorRoute(){let e=new Map((0,La.cloneDeep)([...this.lineMap])),r=1e4;this.addFacilityToLineMap(1*r,this.lift_priority*r,3e4*r,e),this.escalatorRoute=new Ni.default(e)}initStraightLadderRoute(){let e=new Map((0,La.cloneDeep)([...this.lineMap])),r=1e4;this.addFacilityToLineMap(3*r,1*r,3e4*r,e),this.straightLadderRoute=new Ni.default(e)}initForwardRoute(){this.rampMap.forEach((e,r)=>{e.forEach(u=>{if(u.start&&u.end){let l=\`\${u.start.floor}\${Qn}\${u.start.id}\`,h=\`\${u.end.floor}\${Qn}\${u.end.id}\`,p=this.pointMap.get(l),m=this.pointMap.get(h);p&&m&&!p.permission&&!m.permission&&this.addLineItem(l,h,10,this.forwardLineMap)}})}),this.forwardRoute=new Ni.default(this.forwardLineMap)}checkStart(e){return!(!e.floor||!e.nodeId&&(!e.coord||e.coord.length<2))}checkEnd(e){return e.facility||e.parkingSpace&&e.floor?!0:this.checkStart(e)}transformStart(e){var r;if(e.nodeId){let u=this.nodeMap.get(\`\${e.floor}\${Qn}\${e.nodeId}\`);if(u){let[l,h]=u.split(Qn);return{floor:l,id:h}}}if((r=e.coord)!=null&&r.length){let u=this.roadInfo.find(h=>h.floor===e.floor);if(!u)return null;let l=u.points.reduce((h,p)=>{if(p.relatedId)return h;let m=Ra(e.coord,p.cds);return m<h.min&&(h.min=m,h.point=p),h},{min:1/0,point:u.points[0]});return{floor:u.floor,id:l.point.id}}return null}transformEnd(e){if(e.floor){if(e.parkingSpace){let u=this.parkingMap.get(\`\${e.floor}\${Qn}\${e.parkingSpace}\`);if(u)return{floor:e.floor,id:u.id}}let r=this.transformStart(e);if(r)return r}if(e.facility){let u=this.facilities.filter(l=>+l.type_id==+e.facility).map(l=>l.id).map(l=>this.facilityMap.get(\`\${l}\`)).flat(2);if(u!=null&&u.length)return{floor:e.floor,facility:e.facility}}return null}getPath(e,r,u="",l){if(!this.checkStart(e))return"start-error";if(!this.checkEnd(r))return"end-error";let h=this.transformStart(e);if(!h)return"no-start";let p=this.transformEnd(r);if(!p)return"no-end";let m=this.getBasePath.bind(this);switch(u){case"escalator":m=this.getEscalatorPath.bind(this);break;case"straightLadder":m=this.getStraightLadderPath.bind(this);break;case"forward":m=this.getForwardPath.bind(this);break;default:m=this.getBasePath.bind(this);break}if(p.id)return m(h,p,l);if(p.facility){let x=this.facilities.filter(S=>+S.type_id==+r.facility).map(S=>S.id).map(S=>this.facilityMap.get(\`\${S}\`)).flat(2).filter(S=>S).filter(S=>p.floor?S.floor===p.floor:!0);if(!x.length)return null;let E=x.map(S=>m(h,{floor:S.floor,id:S.id},l)).filter(S=>!!S);return E.reduce((S,b)=>{let C=b[0].consume;return C<S.distance&&(S.distance=C,S.path=b),S},{distance:1/0,path:E[0]}).path}}getRoutePath(e,r,u){let l=\`\${e.floor}\${Qn}\${e.id}\`,h=\`\${r.floor}\${Qn}\${r.id}\`,p=u.path(l,h);if(!p)return null;let m=[],y=p.reduce((x,E,S,b)=>{if(S===0)return 0;let C=b[S-1],R=u.graph.get(C).get(E);return x+R},0);return p.map(x=>{var S;let E=this.pointMap.get(x);if(E){let{floor:b}=E,C=E.type;if(this.isFacilityByType(E.type)){let R=this.facilities.find(G=>G.id===+E.targetId);R&&(C=R.entry_infra_type)}if(((S=m[m.length-1])==null?void 0:S.floor)===b){let R=m[m.length-1];R.points.push(E.cds),R.endType=C,R.destId=E.nodeId,R.distance=K1(R.points)}else m.push({floor:b,points:[E.cds],endType:C,destId:E.nodeId,distance:0,consume:y})}}),m}getBasePath(e,r,u){if(!u)return this.getRoutePath(e,r,this.baseRoute);let l=(0,La.cloneDeep)(this.baseRoute.graph);this.addPermissionLineToMap(u,["","escalator","staircase","straightLadder"],l,new Map([["escalator",100],["straightLadder",100+this.lift_priority],["staircase",3e4]]));let h=new Ni.default(l);return this.getRoutePath(e,r,h)}getEscalatorPath(e,r,u){if(!u)return this.getRoutePath(e,r,this.escalatorRoute);let l=(0,La.cloneDeep)(this.escalatorRoute.graph),h=1e4;this.addPermissionLineToMap(u,["","escalator","staircase","straightLadder"],l,new Map([["escalator",1*h],["straightLadder",this.lift_priority*h],["staircase",3e4*h]]));let p=new Ni.default(l);return this.getRoutePath(e,r,p)}getStraightLadderPath(e,r,u){if(!u)return this.getRoutePath(e,r,this.straightLadderRoute);let l=(0,La.cloneDeep)(this.straightLadderRoute.graph),h=1e4;this.addPermissionLineToMap(u,["","escalator","staircase","straightLadder"],l,new Map([["escalator",3*h],["straightLadder",1*h],["staircase",3e4*h]]));let p=new Ni.default(l);return this.getRoutePath(e,r,p)}getForwardPath(e,r,u){if(!u)return this.getRoutePath(e,r,this.forwardRoute);let l=(0,La.cloneDeep)(this.forwardRoute.graph);this.addPermissionLineToMap(u,["","ramp"],l,new Map([["ramp",10]]));let h=new Ni.default(l);return this.getRoutePath(e,r,h)}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 Ni.default,this.escalatorRoute=new Ni.default,this.straightLadderRoute=new Ni.default}};var xN=nr(ix(),1);function EN(o,e,r){let u=Q1(o,e,r);return 180-Math.abs(u)<15?"front":u>135?"right_front":u<-135?"left_front":u<=135&&u>=60?"right":u>=-135&&u<=-60?"left":u<60&&u>0?"right_back":u>-60&&u<0?"left_back":"front"}function ox(o){if(!o.length)return[];if(o.length===1)return[{direction:"start",distance:0,points:o}];let e=[{direction:"start",distance:Ra(o[0],o[1]),points:[o[0],o[1]]}];for(let r=2;r<o.length;r++){let u=EN(o[r-2],o[r-1],o[r]);if(u==="front"){let l=e[e.length-1],h=Ra(o[r-1],o[r]);l.distance+=h,r!==2&&l.points.push(o[r-1])}else e.push({direction:u,distance:Ra(o[r-1],o[r]),points:[o[r-1],o[r]]})}return e.push({direction:"end",distance:0,points:[o[o.length-1]]}),e}function sx(o){return o.replace(/[A-Z]/g,e=>"_"+e.toLowerCase()).replace(/^_/,"")}function ax(o){let e={};for(let u in o)u.startsWith("on")&&(e[sx(u.slice(2))]=o[u]);let r=async({data:u})=>{if(e[u.type])try{let l=await e[u.type](u.data);self.postMessage({type:\`\${u.type}_result\`,key:u.key,data:l})}catch(l){self.postMessage({type:\`\${u.type}_result\`,key:u.key,error:l})}else self.postMessage({type:\`\${u.type}_result\`,key:u.key,error:"no_event"})};return self.addEventListener("message",r),()=>{self.removeEventListener("message",r)}}var ng=new Hf;ax({onSetRoadInfo({roadData:o,facilities:e}){ng.initRoute(o,e)},onGetPath({start:o,end:e,type:r,permission:u}){return ng.getPath(o,e,r,u)},onGetDirectionPath(o){return ox(o)},onClear(){ng.clear()}});
3673
3673
  /*! Bundled license information:
3674
3674
 
3675
3675
  object-assign/index.js:
@@ -7346,7 +7346,7 @@ void main() {
7346
7346
  #include <colorspace_fragment>
7347
7347
  #include <fog_fragment>
7348
7348
  }\`,ve={alphahash_fragment:oy,alphahash_pars_fragment:sy,alphamap_fragment:ay,alphamap_pars_fragment:uy,alphatest_fragment:ly,alphatest_pars_fragment:cy,aomap_fragment:hy,aomap_pars_fragment:fy,batching_pars_vertex:py,batching_vertex:dy,begin_vertex:my,beginnormal_vertex:gy,bsdfs:yy,iridescence_fragment:vy,bumpmap_pars_fragment:_y,clipping_planes_fragment:xy,clipping_planes_pars_fragment:Ey,clipping_planes_pars_vertex:My,clipping_planes_vertex:wy,color_fragment:Sy,color_pars_fragment:by,color_pars_vertex:Ay,color_vertex:Ty,common:Cy,cube_uv_reflection_fragment:Iy,defaultnormal_vertex:Py,displacementmap_pars_vertex:Ry,displacementmap_vertex:Ny,emissivemap_fragment:Ly,emissivemap_pars_fragment:Dy,colorspace_fragment:Oy,colorspace_pars_fragment:Fy,envmap_fragment:Uy,envmap_common_pars_fragment:By,envmap_pars_fragment:zy,envmap_pars_vertex:ky,envmap_physical_pars_fragment:Ky,envmap_vertex:Gy,fog_vertex:Vy,fog_pars_vertex:Hy,fog_fragment:qy,fog_pars_fragment:Wy,gradientmap_pars_fragment:Xy,lightmap_pars_fragment:Yy,lights_lambert_fragment:$y,lights_lambert_pars_fragment:Zy,lights_pars_begin:Jy,lights_toon_fragment:Qy,lights_toon_pars_fragment:jy,lights_phong_fragment:tv,lights_phong_pars_fragment:ev,lights_physical_fragment:nv,lights_physical_pars_fragment:rv,lights_fragment_begin:iv,lights_fragment_maps:ov,lights_fragment_end:sv,logdepthbuf_fragment:av,logdepthbuf_pars_fragment:uv,logdepthbuf_pars_vertex:lv,logdepthbuf_vertex:cv,map_fragment:hv,map_pars_fragment:fv,map_particle_fragment:pv,map_particle_pars_fragment:dv,metalnessmap_fragment:mv,metalnessmap_pars_fragment:gv,morphinstance_vertex:yv,morphcolor_vertex:vv,morphnormal_vertex:_v,morphtarget_pars_vertex:xv,morphtarget_vertex:Ev,normal_fragment_begin:Mv,normal_fragment_maps:wv,normal_pars_fragment:Sv,normal_pars_vertex:bv,normal_vertex:Av,normalmap_pars_fragment:Tv,clearcoat_normal_fragment_begin:Cv,clearcoat_normal_fragment_maps:Iv,clearcoat_pars_fragment:Pv,iridescence_pars_fragment:Rv,opaque_fragment:Nv,packing:Lv,premultiplied_alpha_fragment:Dv,project_vertex:Ov,dithering_fragment:Fv,dithering_pars_fragment:Uv,roughnessmap_fragment:Bv,roughnessmap_pars_fragment:zv,shadowmap_pars_fragment:kv,shadowmap_pars_vertex:Gv,shadowmap_vertex:Vv,shadowmask_pars_fragment:Hv,skinbase_vertex:qv,skinning_pars_vertex:Wv,skinning_vertex:Xv,skinnormal_vertex:Yv,specularmap_fragment:$v,specularmap_pars_fragment:Zv,tonemapping_fragment:Jv,tonemapping_pars_fragment:Kv,transmission_fragment:Qv,transmission_pars_fragment:jv,uv_pars_fragment:t_,uv_pars_vertex:e_,uv_vertex:n_,worldpos_vertex:r_,background_vert:i_,background_frag:o_,backgroundCube_vert:s_,backgroundCube_frag:a_,cube_vert:u_,cube_frag:l_,depth_vert:c_,depth_frag:h_,distanceRGBA_vert:f_,distanceRGBA_frag:p_,equirect_vert:d_,equirect_frag:m_,linedashed_vert:g_,linedashed_frag:y_,meshbasic_vert:v_,meshbasic_frag:__,meshlambert_vert:x_,meshlambert_frag:E_,meshmatcap_vert:M_,meshmatcap_frag:w_,meshnormal_vert:S_,meshnormal_frag:b_,meshphong_vert:A_,meshphong_frag:T_,meshphysical_vert:C_,meshphysical_frag:I_,meshtoon_vert:P_,meshtoon_frag:R_,points_vert:N_,points_frag:L_,shadow_vert:D_,shadow_frag:O_,sprite_vert:F_,sprite_frag:U_},ht={common:{diffuse:{value:new rr(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Dt},alphaMap:{value:null},alphaMapTransform:{value:new Dt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Dt}},envmap:{envMap:{value:null},envMapRotation:{value:new Dt},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Dt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Dt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Dt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Dt},normalScale:{value:new br(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Dt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Dt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Dt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Dt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new rr(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,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 rr(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Dt},alphaTest:{value:0},uvTransform:{value:new Dt}},sprite:{diffuse:{value:new rr(16777215)},opacity:{value:1},center:{value:new br(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Dt},alphaMap:{value:null},alphaMapTransform:{value:new Dt},alphaTest:{value:0}}},Zf={basic:{uniforms:Or([ht.common,ht.specularmap,ht.envmap,ht.aomap,ht.lightmap,ht.fog]),vertexShader:ve.meshbasic_vert,fragmentShader:ve.meshbasic_frag},lambert:{uniforms:Or([ht.common,ht.specularmap,ht.envmap,ht.aomap,ht.lightmap,ht.emissivemap,ht.bumpmap,ht.normalmap,ht.displacementmap,ht.fog,ht.lights,{emissive:{value:new rr(0)}}]),vertexShader:ve.meshlambert_vert,fragmentShader:ve.meshlambert_frag},phong:{uniforms:Or([ht.common,ht.specularmap,ht.envmap,ht.aomap,ht.lightmap,ht.emissivemap,ht.bumpmap,ht.normalmap,ht.displacementmap,ht.fog,ht.lights,{emissive:{value:new rr(0)},specular:{value:new rr(1118481)},shininess:{value:30}}]),vertexShader:ve.meshphong_vert,fragmentShader:ve.meshphong_frag},standard:{uniforms:Or([ht.common,ht.envmap,ht.aomap,ht.lightmap,ht.emissivemap,ht.bumpmap,ht.normalmap,ht.displacementmap,ht.roughnessmap,ht.metalnessmap,ht.fog,ht.lights,{emissive:{value:new rr(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:ve.meshphysical_vert,fragmentShader:ve.meshphysical_frag},toon:{uniforms:Or([ht.common,ht.aomap,ht.lightmap,ht.emissivemap,ht.bumpmap,ht.normalmap,ht.displacementmap,ht.gradientmap,ht.fog,ht.lights,{emissive:{value:new rr(0)}}]),vertexShader:ve.meshtoon_vert,fragmentShader:ve.meshtoon_frag},matcap:{uniforms:Or([ht.common,ht.bumpmap,ht.normalmap,ht.displacementmap,ht.fog,{matcap:{value:null}}]),vertexShader:ve.meshmatcap_vert,fragmentShader:ve.meshmatcap_frag},points:{uniforms:Or([ht.points,ht.fog]),vertexShader:ve.points_vert,fragmentShader:ve.points_frag},dashed:{uniforms:Or([ht.common,ht.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:ve.linedashed_vert,fragmentShader:ve.linedashed_frag},depth:{uniforms:Or([ht.common,ht.displacementmap]),vertexShader:ve.depth_vert,fragmentShader:ve.depth_frag},normal:{uniforms:Or([ht.common,ht.bumpmap,ht.normalmap,ht.displacementmap,{opacity:{value:1}}]),vertexShader:ve.meshnormal_vert,fragmentShader:ve.meshnormal_frag},sprite:{uniforms:Or([ht.sprite,ht.fog]),vertexShader:ve.sprite_vert,fragmentShader:ve.sprite_frag},background:{uniforms:{uvTransform:{value:new Dt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:ve.background_vert,fragmentShader:ve.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Dt}},vertexShader:ve.backgroundCube_vert,fragmentShader:ve.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:ve.cube_vert,fragmentShader:ve.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:ve.equirect_vert,fragmentShader:ve.equirect_frag},distanceRGBA:{uniforms:Or([ht.common,ht.displacementmap,{referencePosition:{value:new Pe},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:ve.distanceRGBA_vert,fragmentShader:ve.distanceRGBA_frag},shadow:{uniforms:Or([ht.lights,ht.fog,{color:{value:new rr(0)},opacity:{value:1}}]),vertexShader:ve.shadow_vert,fragmentShader:ve.shadow_frag}};Zf.physical={uniforms:Or([Zf.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Dt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Dt},clearcoatNormalScale:{value:new br(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Dt},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Dt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Dt},sheen:{value:0},sheenColor:{value:new rr(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Dt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Dt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Dt},transmissionSamplerSize:{value:new br},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Dt},attenuationDistance:{value:0},attenuationColor:{value:new rr(0)},specularColor:{value:new rr(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Dt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Dt},anisotropyVector:{value:new br},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Dt}}]),vertexShader:ve.meshphysical_vert,fragmentShader:ve.meshphysical_frag};var Fo=(1+Math.sqrt(5))/2,hs=1/Fo,RS=[new Pe(-Fo,hs,0),new Pe(Fo,hs,0),new Pe(-hs,0,Fo),new Pe(hs,0,Fo),new Pe(0,Fo,-hs),new Pe(0,Fo,hs),new Pe(-1,1,-1),new Pe(1,1,-1),new Pe(-1,1,1),new Pe(1,1,1)];var NS=new Float32Array(16),LS=new Float32Array(9),DS=new Float32Array(4);var OS={[Ef]:Mf,[wf]:Tf,[bf]:Cf,[Sf]:Af,[Mf]:Ef,[Tf]:wf,[Cf]:bf,[Af]:Sf};function Ga(o,e,r){return!o||!r&&o.constructor===e?o:typeof e.BYTES_PER_ELEMENT=="number"?new e(o):Array.prototype.slice.call(o)}function B_(o){return ArrayBuffer.isView(o)&&!(o instanceof DataView)}var ps=class{constructor(e,r,a,u){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=u!==void 0?u:new r.constructor(a),this.sampleValues=r,this.valueSize=a,this.settings=null,this.DefaultSettings_={}}evaluate(e){let r=this.parameterPositions,a=this._cachedIndex,u=r[a],c=r[a-1];n:{t:{let h;e:{r:if(!(e<u)){for(let p=a+2;;){if(u===void 0){if(e<c)break r;return a=r.length,this._cachedIndex=a,this.copySampleValue_(a-1)}if(a===p)break;if(c=u,u=r[++a],e<u)break t}h=r.length;break e}if(!(e>=c)){let p=r[1];e<p&&(a=2,c=p);for(let d=a-2;;){if(c===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(a===d)break;if(u=c,c=r[--a-1],e>=c)break t}h=a,a=0;break e}break n}for(;a<h;){let p=a+h>>>1;e<r[p]?h=p:a=p+1}if(u=r[a],c=r[a-1],c===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(u===void 0)return a=r.length,this._cachedIndex=a,this.copySampleValue_(a-1)}this._cachedIndex=a,this.intervalChanged_(a,c,u)}return this.interpolate_(a,c,e,u)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){let r=this.resultBuffer,a=this.sampleValues,u=this.valueSize,c=e*u;for(let h=0;h!==u;++h)r[h]=a[c+h];return r}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}},Il=class extends ps{constructor(e,r,a,u){super(e,r,a,u),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Rf,endingEnd:Rf}}intervalChanged_(e,r,a){let u=this.parameterPositions,c=e-2,h=e+1,p=u[c],d=u[h];if(p===void 0)switch(this.getSettings_().endingStart){case Nf:c=e,p=2*r-a;break;case Lf:c=u.length-2,p=r+u[c]-u[c+1];break;default:c=e,p=a}if(d===void 0)switch(this.getSettings_().endingEnd){case Nf:h=e,d=2*a-r;break;case Lf:h=1,d=a+u[1]-u[0];break;default:h=e-1,d=r}let g=(a-r)*.5,v=this.valueSize;this._weightPrev=g/(r-p),this._weightNext=g/(d-a),this._offsetPrev=c*v,this._offsetNext=h*v}interpolate_(e,r,a,u){let c=this.resultBuffer,h=this.sampleValues,p=this.valueSize,d=e*p,g=d-p,v=this._offsetPrev,x=this._offsetNext,M=this._weightPrev,w=this._weightNext,I=(a-r)/(u-r),D=I*I,b=D*I,T=-M*b+2*M*D-M*I,L=(1+M)*b+(-1.5-2*M)*D+(-.5+M)*I+1,P=(-1-w)*b+(1.5+w)*D+.5*I,z=w*b-w*D;for(let k=0;k!==p;++k)c[k]=T*h[v+k]+L*h[g+k]+P*h[d+k]+z*h[x+k];return c}},Pl=class extends ps{constructor(e,r,a,u){super(e,r,a,u)}interpolate_(e,r,a,u){let c=this.resultBuffer,h=this.sampleValues,p=this.valueSize,d=e*p,g=d-p,v=(a-r)/(u-r),x=1-v;for(let M=0;M!==p;++M)c[M]=h[g+M]*x+h[d+M]*v;return c}},Rl=class extends ps{constructor(e,r,a,u){super(e,r,a,u)}interpolate_(e){return this.copySampleValue_(e-1)}},Si=class{constructor(e,r,a,u){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(r===void 0||r.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=Ga(r,this.TimeBufferType),this.values=Ga(a,this.ValueBufferType),this.setInterpolation(u||this.DefaultInterpolation)}static toJSON(e){let r=e.constructor,a;if(r.toJSON!==this.toJSON)a=r.toJSON(e);else{a={name:e.name,times:Ga(e.times,Array),values:Ga(e.values,Array)};let u=e.getInterpolation();u!==e.DefaultInterpolation&&(a.interpolation=u)}return a.type=e.ValueTypeName,a}InterpolantFactoryMethodDiscrete(e){return new Rl(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new Pl(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new Il(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let r;switch(e){case Va:r=this.InterpolantFactoryMethodDiscrete;break;case Sl:r=this.InterpolantFactoryMethodLinear;break;case gl:r=this.InterpolantFactoryMethodSmooth;break}if(r===void 0){let a="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(a);return console.warn("THREE.KeyframeTrack:",a),this}return this.createInterpolant=r,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Va;case this.InterpolantFactoryMethodLinear:return Sl;case this.InterpolantFactoryMethodSmooth:return gl}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){let r=this.times;for(let a=0,u=r.length;a!==u;++a)r[a]+=e}return this}scale(e){if(e!==1){let r=this.times;for(let a=0,u=r.length;a!==u;++a)r[a]*=e}return this}trim(e,r){let a=this.times,u=a.length,c=0,h=u-1;for(;c!==u&&a[c]<e;)++c;for(;h!==-1&&a[h]>r;)--h;if(++h,c!==0||h!==u){c>=h&&(h=Math.max(h,1),c=h-1);let p=this.getValueSize();this.times=a.slice(c,h),this.values=this.values.slice(c*p,h*p)}return this}validate(){let e=!0,r=this.getValueSize();r-Math.floor(r)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);let a=this.times,u=this.values,c=a.length;c===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let h=null;for(let p=0;p!==c;p++){let d=a[p];if(typeof d=="number"&&isNaN(d)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,p,d),e=!1;break}if(h!==null&&h>d){console.error("THREE.KeyframeTrack: Out of order keys.",this,p,d,h),e=!1;break}h=d}if(u!==void 0&&B_(u))for(let p=0,d=u.length;p!==d;++p){let g=u[p];if(isNaN(g)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,p,g),e=!1;break}}return e}optimize(){let e=this.times.slice(),r=this.values.slice(),a=this.getValueSize(),u=this.getInterpolation()===gl,c=e.length-1,h=1;for(let p=1;p<c;++p){let d=!1,g=e[p],v=e[p+1];if(g!==v&&(p!==1||g!==e[0]))if(u)d=!0;else{let x=p*a,M=x-a,w=x+a;for(let I=0;I!==a;++I){let D=r[x+I];if(D!==r[M+I]||D!==r[w+I]){d=!0;break}}}if(d){if(p!==h){e[h]=e[p];let x=p*a,M=h*a;for(let w=0;w!==a;++w)r[M+w]=r[x+w]}++h}}if(c>0){e[h]=e[c];for(let p=c*a,d=h*a,g=0;g!==a;++g)r[d+g]=r[p+g];++h}return h!==e.length?(this.times=e.slice(0,h),this.values=r.slice(0,h*a)):(this.times=e,this.values=r),this}clone(){let e=this.times.slice(),r=this.values.slice(),a=this.constructor,u=new a(this.name,e,r);return u.createInterpolant=this.createInterpolant,u}};Si.prototype.TimeBufferType=Float32Array;Si.prototype.ValueBufferType=Float32Array;Si.prototype.DefaultInterpolation=Sl;var Uo=class extends Si{constructor(e,r,a){super(e,r,a)}};Uo.prototype.ValueTypeName="bool";Uo.prototype.ValueBufferType=Array;Uo.prototype.DefaultInterpolation=Va;Uo.prototype.InterpolantFactoryMethodLinear=void 0;Uo.prototype.InterpolantFactoryMethodSmooth=void 0;var Nl=class extends Si{};Nl.prototype.ValueTypeName="color";var Ll=class extends Si{};Ll.prototype.ValueTypeName="number";var Dl=class extends ps{constructor(e,r,a,u){super(e,r,a,u)}interpolate_(e,r,a,u){let c=this.resultBuffer,h=this.sampleValues,p=this.valueSize,d=(a-r)/(u-r),g=e*p;for(let v=g+p;g!==v;g+=4)go.slerpFlat(c,0,h,g-p,h,g,d);return c}},Wa=class extends Si{InterpolantFactoryMethodLinear(e){return new Dl(this.times,this.values,this.getValueSize(),e)}};Wa.prototype.ValueTypeName="quaternion";Wa.prototype.InterpolantFactoryMethodSmooth=void 0;var Bo=class extends Si{constructor(e,r,a){super(e,r,a)}};Bo.prototype.ValueTypeName="string";Bo.prototype.ValueBufferType=Array;Bo.prototype.DefaultInterpolation=Va;Bo.prototype.InterpolantFactoryMethodLinear=void 0;Bo.prototype.InterpolantFactoryMethodSmooth=void 0;var Ol=class extends Si{};Ol.prototype.ValueTypeName="vector";var Fl=class{constructor(e,r,a){let u=this,c=!1,h=0,p=0,d,g=[];this.onStart=void 0,this.onLoad=e,this.onProgress=r,this.onError=a,this.itemStart=function(v){p++,c===!1&&u.onStart!==void 0&&u.onStart(v,h,p),c=!0},this.itemEnd=function(v){h++,u.onProgress!==void 0&&u.onProgress(v,h,p),h===p&&(c=!1,u.onLoad!==void 0&&u.onLoad())},this.itemError=function(v){u.onError!==void 0&&u.onError(v)},this.resolveURL=function(v){return d?d(v):v},this.setURLModifier=function(v){return d=v,this},this.addHandler=function(v,x){return g.push(v,x),this},this.removeHandler=function(v){let x=g.indexOf(v);return x!==-1&&g.splice(x,2),this},this.getHandler=function(v){for(let x=0,M=g.length;x<M;x+=2){let w=g[x],I=g[x+1];if(w.global&&(w.lastIndex=0),w.test(v))return I}return null}}},z_=new Fl,Ul=class{constructor(e){this.manager=e!==void 0?e:z_,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,r){let a=this;return new Promise(function(u,c){a.load(e,u,r,c)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}};Ul.DEFAULT_MATERIAL_NAME="__DEFAULT";var Gl="\\\\[\\\\]\\\\.:\\\\/",k_=new RegExp("["+Gl+"]","g"),Vl="[^"+Gl+"]",G_="[^"+Gl.replace("\\\\.","")+"]",V_=/((?:WC+[\\/:])*)/.source.replace("WC",Vl),H_=/(WCOD+)?/.source.replace("WCOD",G_),q_=/(?:\\.(WC+)(?:\\[(.+)\\])?)?/.source.replace("WC",Vl),W_=/\\.(WC+)(?:\\[(.+)\\])?/.source.replace("WC",Vl),X_=new RegExp("^"+V_+H_+q_+W_+"$"),Y_=["material","materials","bones","map"],Bl=class{constructor(e,r,a){let u=a||on.parseTrackName(r);this._targetGroup=e,this._bindings=e.subscribe_(r,u)}getValue(e,r){this.bind();let a=this._targetGroup.nCachedObjects_,u=this._bindings[a];u!==void 0&&u.getValue(e,r)}setValue(e,r){let a=this._bindings;for(let u=this._targetGroup.nCachedObjects_,c=a.length;u!==c;++u)a[u].setValue(e,r)}bind(){let e=this._bindings;for(let r=this._targetGroup.nCachedObjects_,a=e.length;r!==a;++r)e[r].bind()}unbind(){let e=this._bindings;for(let r=this._targetGroup.nCachedObjects_,a=e.length;r!==a;++r)e[r].unbind()}},on=class o{constructor(e,r,a){this.path=r,this.parsedPath=a||o.parseTrackName(r),this.node=o.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,r,a){return e&&e.isAnimationObjectGroup?new o.Composite(e,r,a):new o(e,r,a)}static sanitizeNodeName(e){return e.replace(/\\s/g,"_").replace(k_,"")}static parseTrackName(e){let r=X_.exec(e);if(r===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);let a={nodeName:r[2],objectName:r[3],objectIndex:r[4],propertyName:r[5],propertyIndex:r[6]},u=a.nodeName&&a.nodeName.lastIndexOf(".");if(u!==void 0&&u!==-1){let c=a.nodeName.substring(u+1);Y_.indexOf(c)!==-1&&(a.nodeName=a.nodeName.substring(0,u),a.objectName=c)}if(a.propertyName===null||a.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return a}static findNode(e,r){if(r===void 0||r===""||r==="."||r===-1||r===e.name||r===e.uuid)return e;if(e.skeleton){let a=e.skeleton.getBoneByName(r);if(a!==void 0)return a}if(e.children){let a=function(c){for(let h=0;h<c.length;h++){let p=c[h];if(p.name===r||p.uuid===r)return p;let d=a(p.children);if(d)return d}return null},u=a(e.children);if(u)return u}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,r){e[r]=this.targetObject[this.propertyName]}_getValue_array(e,r){let a=this.resolvedProperty;for(let u=0,c=a.length;u!==c;++u)e[r++]=a[u]}_getValue_arrayElement(e,r){e[r]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,r){this.resolvedProperty.toArray(e,r)}_setValue_direct(e,r){this.targetObject[this.propertyName]=e[r]}_setValue_direct_setNeedsUpdate(e,r){this.targetObject[this.propertyName]=e[r],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,r){this.targetObject[this.propertyName]=e[r],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,r){let a=this.resolvedProperty;for(let u=0,c=a.length;u!==c;++u)a[u]=e[r++]}_setValue_array_setNeedsUpdate(e,r){let a=this.resolvedProperty;for(let u=0,c=a.length;u!==c;++u)a[u]=e[r++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,r){let a=this.resolvedProperty;for(let u=0,c=a.length;u!==c;++u)a[u]=e[r++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,r){this.resolvedProperty[this.propertyIndex]=e[r]}_setValue_arrayElement_setNeedsUpdate(e,r){this.resolvedProperty[this.propertyIndex]=e[r],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,r){this.resolvedProperty[this.propertyIndex]=e[r],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,r){this.resolvedProperty.fromArray(e,r)}_setValue_fromArray_setNeedsUpdate(e,r){this.resolvedProperty.fromArray(e,r),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,r){this.resolvedProperty.fromArray(e,r),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,r){this.bind(),this.getValue(e,r)}_setValue_unbound(e,r){this.bind(),this.setValue(e,r)}bind(){let e=this.node,r=this.parsedPath,a=r.objectName,u=r.propertyName,c=r.propertyIndex;if(e||(e=o.findNode(this.rootNode,r.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");return}if(a){let g=r.objectIndex;switch(a){case"materials":if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let v=0;v<e.length;v++)if(e[v].name===g){g=v;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[a]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[a]}if(g!==void 0){if(e[g]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[g]}}let h=e[u];if(h===void 0){let g=r.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+g+"."+u+" but it wasn't found.",e);return}let p=this.Versioning.None;this.targetObject=e,e.needsUpdate!==void 0?p=this.Versioning.NeedsUpdate:e.matrixWorldNeedsUpdate!==void 0&&(p=this.Versioning.MatrixWorldNeedsUpdate);let d=this.BindingType.Direct;if(c!==void 0){if(u==="morphTargetInfluences"){if(!e.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[c]!==void 0&&(c=e.morphTargetDictionary[c])}d=this.BindingType.ArrayElement,this.resolvedProperty=h,this.propertyIndex=c}else h.fromArray!==void 0&&h.toArray!==void 0?(d=this.BindingType.HasFromToArray,this.resolvedProperty=h):Array.isArray(h)?(d=this.BindingType.EntireArray,this.resolvedProperty=h):this.propertyName=u;this.getValue=this.GetterByBindingType[d],this.setValue=this.SetterByBindingTypeAndVersioning[d][p]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};on.Composite=Bl;on.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};on.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};on.prototype.GetterByBindingType=[on.prototype._getValue_direct,on.prototype._getValue_array,on.prototype._getValue_arrayElement,on.prototype._getValue_toArray];on.prototype.SetterByBindingTypeAndVersioning=[[on.prototype._setValue_direct,on.prototype._setValue_direct_setNeedsUpdate,on.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[on.prototype._setValue_array,on.prototype._setValue_array_setNeedsUpdate,on.prototype._setValue_array_setMatrixWorldNeedsUpdate],[on.prototype._setValue_arrayElement,on.prototype._setValue_arrayElement_setNeedsUpdate,on.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[on.prototype._setValue_fromArray,on.prototype._setValue_fromArray_setNeedsUpdate,on.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var FS=new Float32Array(1);typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Jf}}));typeof window!="undefined"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Jf);var Xn=63710088e-1,zS={centimeters:Xn*100,centimetres:Xn*100,degrees:Xn/111325,feet:Xn*3.28084,inches:Xn*39.37,kilometers:Xn/1e3,kilometres:Xn/1e3,meters:Xn,metres:Xn,miles:Xn/1609.344,millimeters:Xn*1e3,millimetres:Xn*1e3,nauticalmiles:Xn/1852,radians:1,yards:Xn*1.0936},kS={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/Xn,yards:1.0936133};function Ar(o,e,r){r===void 0&&(r={});var a={type:"Feature"};return(r.id===0||r.id)&&(a.id=r.id),r.bbox&&(a.bbox=r.bbox),a.properties=e||{},a.geometry=o,a}function He(o,e,r){if(r===void 0&&(r={}),!o)throw new Error("coordinates is required");if(!Array.isArray(o))throw new Error("coordinates must be an Array");if(o.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Di(o[0])||!Di(o[1]))throw new Error("coordinates must contain numbers");var a={type:"Point",coordinates:o};return Ar(a,e,r)}function sn(o,e,r){r===void 0&&(r={});for(var a=0,u=o;a<u.length;a++){var c=u[a];if(c.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var h=0;h<c[c.length-1].length;h++)if(c[c.length-1][h]!==c[0][h])throw new Error("First and last Position are not equivalent.")}var p={type:"Polygon",coordinates:o};return Ar(p,e,r)}function Yn(o,e,r){if(r===void 0&&(r={}),o.length<2)throw new Error("coordinates must be an array of two or more positions");var a={type:"LineString",coordinates:o};return Ar(a,e,r)}function Hl(o,e,r){r===void 0&&(r={});var a={type:"MultiPoint",coordinates:o};return Ar(a,e,r)}function Di(o){return!isNaN(o)&&o!==null&&!Array.isArray(o)}function Nn(o,e,r){if(o!==null)for(var a,u,c,h,p,d,g,v=0,x=0,M,w=o.type,I=w==="FeatureCollection",D=w==="Feature",b=I?o.features.length:1,T=0;T<b;T++){g=I?o.features[T].geometry:D?o.geometry:o,M=g?g.type==="GeometryCollection":!1,p=M?g.geometries.length:1;for(var L=0;L<p;L++){var P=0,z=0;if(h=M?g.geometries[L]:g,h!==null){d=h.coordinates;var k=h.type;switch(v=r&&(k==="Polygon"||k==="MultiPolygon")?1:0,k){case null:break;case"Point":if(e(d,x,T,P,z)===!1)return!1;x++,P++;break;case"LineString":case"MultiPoint":for(a=0;a<d.length;a++){if(e(d[a],x,T,P,z)===!1)return!1;x++,k==="MultiPoint"&&P++}k==="LineString"&&P++;break;case"Polygon":case"MultiLineString":for(a=0;a<d.length;a++){for(u=0;u<d[a].length-v;u++){if(e(d[a][u],x,T,P,z)===!1)return!1;x++}k==="MultiLineString"&&P++,k==="Polygon"&&z++}k==="Polygon"&&P++;break;case"MultiPolygon":for(a=0;a<d.length;a++){for(z=0,u=0;u<d[a].length;u++){for(c=0;c<d[a][u].length-v;c++){if(e(d[a][u][c],x,T,P,z)===!1)return!1;x++}z++}P++}break;case"GeometryCollection":for(a=0;a<h.geometries.length;a++)if(Nn(h.geometries[a],e,r)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function ep(o,e,r,a){var u=r;return Nn(o,function(c,h,p,d,g){h===0&&r===void 0?u=c:u=e(u,c,h,p,d,g)},a),u}function yo(o,e){var r,a,u,c,h,p,d,g,v,x,M=0,w=o.type==="FeatureCollection",I=o.type==="Feature",D=w?o.features.length:1;for(r=0;r<D;r++){for(p=w?o.features[r].geometry:I?o.geometry:o,g=w?o.features[r].properties:I?o.properties:{},v=w?o.features[r].bbox:I?o.bbox:void 0,x=w?o.features[r].id:I?o.id:void 0,d=p?p.type==="GeometryCollection":!1,h=d?p.geometries.length:1,u=0;u<h;u++){if(c=d?p.geometries[u]:p,c===null){if(e(null,M,g,v,x)===!1)return!1;continue}switch(c.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(e(c,M,g,v,x)===!1)return!1;break}case"GeometryCollection":{for(a=0;a<c.geometries.length;a++)if(e(c.geometries[a],M,g,v,x)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}M++}}function Yr(o,e){yo(o,function(r,a,u,c,h){var p=r===null?null:r.type;switch(p){case null:case"Point":case"LineString":case"Polygon":return e(Ar(r,u,{bbox:c,id:h}),a,0)===!1?!1:void 0}var d;switch(p){case"MultiPoint":d="Point";break;case"MultiLineString":d="LineString";break;case"MultiPolygon":d="Polygon";break}for(var g=0;g<r.coordinates.length;g++){var v=r.coordinates[g],x={type:d,coordinates:v};if(e(Ar(x,u),a,g)===!1)return!1}})}function ql(o){var e=[1/0,1/0,-1/0,-1/0];return Nn(o,function(r){e[0]>r[0]&&(e[0]=r[0]),e[1]>r[1]&&(e[1]=r[1]),e[2]<r[0]&&(e[2]=r[0]),e[3]<r[1]&&(e[3]=r[1])}),e}ql.default=ql;var Tr=ql;function ir(o){if(!o)throw new Error("coord is required");if(!Array.isArray(o)){if(o.type==="Feature"&&o.geometry!==null&&o.geometry.type==="Point")return o.geometry.coordinates;if(o.type==="Point")return o.coordinates}if(Array.isArray(o)&&o.length>=2&&!Array.isArray(o[0])&&!Array.isArray(o[1]))return o;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function Wl(o,e,r){if(!o)throw new Error("No feature passed");if(!r)throw new Error(".featureOf() requires a name");if(!o||o.type!=="Feature"||!o.geometry)throw new Error("Invalid input to "+r+", Feature with geometry required");if(!o.geometry||o.geometry.type!==e)throw new Error("Invalid input to "+r+": must be a "+e+", given "+o.geometry.type)}function or(o){return o.type==="Feature"?o.geometry:o}var e1=ln(Xa(),1);var h1=ln(_p(),1);function $n(o,e,r){if(r===void 0&&(r={}),!o)throw new Error("point is required");if(!e)throw new Error("polygon is required");var a=ir(o),u=or(e),c=u.type,h=e.bbox,p=u.coordinates;if(h&&f1(a,h)===!1)return!1;c==="Polygon"&&(p=[p]);for(var d=!1,g=0;g<p.length&&!d;g++)if(xp(a,p[g][0],r.ignoreBoundary)){for(var v=!1,x=1;x<p[g].length&&!v;)xp(a,p[g][x],!r.ignoreBoundary)&&(v=!0),x++;v||(d=!0)}return d}function xp(o,e,r){var a=!1;e[0][0]===e[e.length-1][0]&&e[0][1]===e[e.length-1][1]&&(e=e.slice(0,e.length-1));for(var u=0,c=e.length-1;u<e.length;c=u++){var h=e[u][0],p=e[u][1],d=e[c][0],g=e[c][1],v=o[1]*(h-d)+p*(d-o[0])+g*(o[0]-h)===0&&(h-o[0])*(d-o[0])<=0&&(p-o[1])*(g-o[1])<=0;if(v)return!r;var x=p>o[1]!=g>o[1]&&o[0]<(d-h)*(o[1]-p)/(g-p)+h;x&&(a=!a)}return a}function f1(o,e){return e[0]<=o[0]&&e[1]<=o[1]&&e[2]>=o[0]&&e[3]>=o[1]}var wp=new ArrayBuffer(16),mA=new Float64Array(wp),gA=new Uint32Array(wp);var T1=ln(ac(),1);var VT=function(){function o(e){this.points=e.points||[],this.duration=e.duration||1e4,this.sharpness=e.sharpness||.85,this.centers=[],this.controls=[],this.stepLength=e.stepLength||60,this.length=this.points.length,this.delay=0;for(var r=0;r<this.length;r++)this.points[r].z=this.points[r].z||0;for(var r=0;r<this.length-1;r++){var a=this.points[r],u=this.points[r+1];this.centers.push({x:(a.x+u.x)/2,y:(a.y+u.y)/2,z:(a.z+u.z)/2})}this.controls.push([this.points[0],this.points[0]]);for(var r=0;r<this.centers.length-1;r++){var c=this.points[r+1].x-(this.centers[r].x+this.centers[r+1].x)/2,h=this.points[r+1].y-(this.centers[r].y+this.centers[r+1].y)/2,p=this.points[r+1].z-(this.centers[r].y+this.centers[r+1].z)/2;this.controls.push([{x:(1-this.sharpness)*this.points[r+1].x+this.sharpness*(this.centers[r].x+c),y:(1-this.sharpness)*this.points[r+1].y+this.sharpness*(this.centers[r].y+h),z:(1-this.sharpness)*this.points[r+1].z+this.sharpness*(this.centers[r].z+p)},{x:(1-this.sharpness)*this.points[r+1].x+this.sharpness*(this.centers[r+1].x+c),y:(1-this.sharpness)*this.points[r+1].y+this.sharpness*(this.centers[r+1].y+h),z:(1-this.sharpness)*this.points[r+1].z+this.sharpness*(this.centers[r+1].z+p)}])}return this.controls.push([this.points[this.length-1],this.points[this.length-1]]),this.steps=this.cacheSteps(this.stepLength),this}return o.prototype.cacheSteps=function(e){var r=[],a=this.pos(0);r.push(0);for(var u=0;u<this.duration;u+=10){var c=this.pos(u),h=Math.sqrt((c.x-a.x)*(c.x-a.x)+(c.y-a.y)*(c.y-a.y)+(c.z-a.z)*(c.z-a.z));h>e&&(r.push(u),a=c)}return r},o.prototype.vector=function(e){var r=this.pos(e+10),a=this.pos(e-10);return{angle:180*Math.atan2(r.y-a.y,r.x-a.x)/3.14,speed:Math.sqrt((a.x-r.x)*(a.x-r.x)+(a.y-r.y)*(a.y-r.y)+(a.z-r.z)*(a.z-r.z))}},o.prototype.pos=function(e){var r=e-this.delay;r<0&&(r=0),r>this.duration&&(r=this.duration-1);var a=r/this.duration;if(a>=1)return this.points[this.length-1];var u=Math.floor((this.points.length-1)*a),c=(this.length-1)*a-u;return C1(c,this.points[u],this.controls[u][1],this.controls[u+1][0],this.points[u+1])},o}();function C1(o,e,r,a,u){var c=I1(o),h={x:u.x*c[0]+a.x*c[1]+r.x*c[2]+e.x*c[3],y:u.y*c[0]+a.y*c[1]+r.y*c[2]+e.y*c[3],z:u.z*c[0]+a.z*c[1]+r.z*c[2]+e.z*c[3]};return h}function I1(o){var e=o*o,r=e*o;return[r,3*e*(1-o),3*o*(1-o)*(1-o),(1-o)*(1-o)*(1-o)]}function aa(o,e){e===void 0&&(e={});var r=Number(o[0]),a=Number(o[1]),u=Number(o[2]),c=Number(o[3]);if(o.length===6)throw new Error("@turf/bbox-polygon does not support BBox with 6 positions");var h=[r,a],p=[r,c],d=[u,c],g=[u,a];return sn([[h,g,d,p,h]],e.properties,{bbox:o,id:e.id})}function P1(o){return aa(Tr(o))}var uc=P1;var Y1=ln(Dp(),1);var xx=ln(lu(),1);var Mx=ln(Xa(),1);var bx=ln(ac(),1);var Qp=Math.PI/180,jp=180/Math.PI,da=function(o,e){this.lon=o,this.lat=e,this.x=Qp*o,this.y=Qp*e};da.prototype.view=function(){return String(this.lon).slice(0,4)+","+String(this.lat).slice(0,4)};da.prototype.antipode=function(){var o=-1*this.lat,e=this.lon<0?180+this.lon:(180-this.lon)*-1;return new da(e,o)};var td=function(){this.coords=[],this.length=0};td.prototype.move_to=function(o){this.length++,this.coords.push(o)};var Cc=function(o){this.properties=o||{},this.geometries=[]};Cc.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 o=[],e=0;e<this.geometries.length;e++)o.push(this.geometries[e].coords);return{geometry:{type:"MultiLineString",coordinates:o},type:"Feature",properties:this.properties}};Cc.prototype.wkt=function(){for(var o="",e="LINESTRING(",r=function(c){e+=c[0]+" "+c[1]+","},a=0;a<this.geometries.length;a++){if(this.geometries[a].coords.length===0)return"LINESTRING(empty)";var u=this.geometries[a].coords;u.forEach(r),o+=e.substring(0,e.length-1)+")"}return o};var ed=function(o,e,r){if(!o||o.x===void 0||o.y===void 0)throw new Error("GreatCircle constructor expects two args: start and end objects with x and y properties");if(!e||e.x===void 0||e.y===void 0)throw new Error("GreatCircle constructor expects two args: start and end objects with x and y properties");this.start=new da(o.x,o.y),this.end=new da(e.x,e.y),this.properties=r||{};var a=this.start.x-this.end.x,u=this.start.y-this.end.y,c=Math.pow(Math.sin(u/2),2)+Math.cos(this.start.y)*Math.cos(this.end.y)*Math.pow(Math.sin(a/2),2);if(this.g=2*Math.asin(Math.sqrt(c)),this.g===Math.PI)throw new Error("it appears "+o.view()+" and "+e.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 "+o+" and "+e)};ed.prototype.interpolate=function(o){var e=Math.sin((1-o)*this.g)/Math.sin(this.g),r=Math.sin(o*this.g)/Math.sin(this.g),a=e*Math.cos(this.start.y)*Math.cos(this.start.x)+r*Math.cos(this.end.y)*Math.cos(this.end.x),u=e*Math.cos(this.start.y)*Math.sin(this.start.x)+r*Math.cos(this.end.y)*Math.sin(this.end.x),c=e*Math.sin(this.start.y)+r*Math.sin(this.end.y),h=jp*Math.atan2(c,Math.sqrt(Math.pow(a,2)+Math.pow(u,2))),p=jp*Math.atan2(u,a);return[p,h]};ed.prototype.Arc=function(o,e){var r=[];if(!o||o<=2)r.push([this.start.lon,this.start.lat]),r.push([this.end.lon,this.end.lat]);else for(var a=1/(o-1),u=0;u<o;++u){var c=a*u,h=this.interpolate(c);r.push(h)}for(var p=!1,d=0,g=e&&e.offset?e.offset:10,v=180-g,x=-180+g,M=360-g,w=1;w<r.length;++w){var I=r[w-1][0],D=r[w][0],b=Math.abs(D-I);b>M&&(D>v&&I<x||I>v&&D<x)?p=!0:b>d&&(d=b)}var T=[];if(p&&d<g){var L=[];T.push(L);for(var P=0;P<r.length;++P){var z=parseFloat(r[P][0]);if(P>0&&Math.abs(z-r[P-1][0])>M){var k=parseFloat(r[P-1][0]),Y=parseFloat(r[P-1][1]),q=parseFloat(r[P][0]),C=parseFloat(r[P][1]);if(k>-180&&k<x&&q===180&&P+1<r.length&&r[P-1][0]>-180&&r[P-1][0]<x){L.push([-180,r[P][1]]),P++,L.push([r[P][0],r[P][1]]);continue}else if(k>v&&k<180&&q===-180&&P+1<r.length&&r[P-1][0]>v&&r[P-1][0]<180){L.push([180,r[P][1]]),P++,L.push([r[P][0],r[P][1]]);continue}if(k<x&&q>v){var ot=k;k=q,q=ot;var pt=Y;Y=C,C=pt}if(k>v&&q<x&&(q+=360),k<=180&&q>=180&&k<q){var dt=(180-k)/(q-k),F=dt*C+(1-dt)*Y;L.push([r[P-1][0]>v?180:-180,F]),L=[],L.push([r[P-1][0]>v?-180:180,F]),T.push(L)}else L=[],T.push(L);L.push([z,r[P][1]])}else L.push([r[P][0],r[P][1]])}}else{var ye=[];T.push(ye);for(var et=0;et<r.length;++et)ye.push([r[et][0],r[et][1]])}for(var St=new Cc(this.properties),Pt=0;Pt<T.length;++Pt){var Rt=new td;St.geometries.push(Rt);for(var it=T[Pt],mt=0;mt<it.length;++mt)Rt.move_to(it[mt])}return St};var Cx=ln(lu(),1);var aM=ln(lu(),1);var uM=ln(Jc(),1);var hM=ln(Xa(),1);var Ot=[],Ft=[],Ut=[],Bt=[],zt=[],kt=[],Gt=[],Vt=[],Ht=[],qt=[],Wt=[],Xt=[],Yt=[],$t=[],Zt=[],Jt=[],Kt=[],Qt=[],jt=[],te=[],ee=[],ne=[],re=[],ie=[];Gt[85]=qt[85]=-1;Vt[85]=Wt[85]=0;Ht[85]=Xt[85]=1;jt[85]=ne[85]=1;te[85]=re[85]=0;ee[85]=ie[85]=1;Ot[85]=Bt[85]=0;Ft[85]=zt[85]=-1;Ut[85]=Zt[85]=0;Jt[85]=Yt[85]=0;Kt[85]=$t[85]=1;kt[85]=Qt[85]=1;ne[1]=ne[169]=0;re[1]=re[169]=-1;ie[1]=ie[169]=0;Yt[1]=Yt[169]=-1;$t[1]=$t[169]=0;Zt[1]=Zt[169]=0;qt[4]=qt[166]=0;Wt[4]=Wt[166]=-1;Xt[4]=Xt[166]=1;Jt[4]=Jt[166]=1;Kt[4]=Kt[166]=0;Qt[4]=Qt[166]=0;Gt[16]=Gt[154]=0;Vt[16]=Vt[154]=1;Ht[16]=Ht[154]=1;Bt[16]=Bt[154]=1;zt[16]=zt[154]=0;kt[16]=kt[154]=1;jt[64]=jt[106]=0;te[64]=te[106]=1;ee[64]=ee[106]=0;Ot[64]=Ot[106]=-1;Ft[64]=Ft[106]=0;Ut[64]=Ut[106]=1;jt[2]=jt[168]=0;te[2]=te[168]=-1;ee[2]=ee[168]=1;ne[2]=ne[168]=0;re[2]=re[168]=-1;ie[2]=ie[168]=0;Yt[2]=Yt[168]=-1;$t[2]=$t[168]=0;Zt[2]=Zt[168]=0;Jt[2]=Jt[168]=-1;Kt[2]=Kt[168]=0;Qt[2]=Qt[168]=1;Gt[8]=Gt[162]=0;Vt[8]=Vt[162]=-1;Ht[8]=Ht[162]=0;qt[8]=qt[162]=0;Wt[8]=Wt[162]=-1;Xt[8]=Xt[162]=1;Yt[8]=Yt[162]=1;$t[8]=$t[162]=0;Zt[8]=Zt[162]=1;Jt[8]=Jt[162]=1;Kt[8]=Kt[162]=0;Qt[8]=Qt[162]=0;Gt[32]=Gt[138]=0;Vt[32]=Vt[138]=1;Ht[32]=Ht[138]=1;qt[32]=qt[138]=0;Wt[32]=Wt[138]=1;Xt[32]=Xt[138]=0;Ot[32]=Ot[138]=1;Ft[32]=Ft[138]=0;Ut[32]=Ut[138]=0;Bt[32]=Bt[138]=1;zt[32]=zt[138]=0;kt[32]=kt[138]=1;ne[128]=ne[42]=0;re[128]=re[42]=1;ie[128]=ie[42]=1;jt[128]=jt[42]=0;te[128]=te[42]=1;ee[128]=ee[42]=0;Ot[128]=Ot[42]=-1;Ft[128]=Ft[42]=0;Ut[128]=Ut[42]=1;Bt[128]=Bt[42]=-1;zt[128]=zt[42]=0;kt[128]=kt[42]=0;qt[5]=qt[165]=-1;Wt[5]=Wt[165]=0;Xt[5]=Xt[165]=0;ne[5]=ne[165]=1;re[5]=re[165]=0;ie[5]=ie[165]=0;Jt[20]=Jt[150]=0;Kt[20]=Kt[150]=1;Qt[20]=Qt[150]=1;Bt[20]=Bt[150]=0;zt[20]=zt[150]=-1;kt[20]=kt[150]=1;Gt[80]=Gt[90]=-1;Vt[80]=Vt[90]=0;Ht[80]=Ht[90]=1;jt[80]=jt[90]=1;te[80]=te[90]=0;ee[80]=ee[90]=1;Yt[65]=Yt[105]=0;$t[65]=$t[105]=1;Zt[65]=Zt[105]=0;Ot[65]=Ot[105]=0;Ft[65]=Ft[105]=-1;Ut[65]=Ut[105]=0;Gt[160]=Gt[10]=-1;Vt[160]=Vt[10]=0;Ht[160]=Ht[10]=1;qt[160]=qt[10]=-1;Wt[160]=Wt[10]=0;Xt[160]=Xt[10]=0;ne[160]=ne[10]=1;re[160]=re[10]=0;ie[160]=ie[10]=0;jt[160]=jt[10]=1;te[160]=te[10]=0;ee[160]=ee[10]=1;Jt[130]=Jt[40]=0;Kt[130]=Kt[40]=1;Qt[130]=Qt[40]=1;Yt[130]=Yt[40]=0;$t[130]=$t[40]=1;Zt[130]=Zt[40]=0;Ot[130]=Ot[40]=0;Ft[130]=Ft[40]=-1;Ut[130]=Ut[40]=0;Bt[130]=Bt[40]=0;zt[130]=zt[40]=-1;kt[130]=kt[40]=1;qt[37]=qt[133]=0;Wt[37]=Wt[133]=1;Xt[37]=Xt[133]=1;ne[37]=ne[133]=0;re[37]=re[133]=1;ie[37]=ie[133]=0;Ot[37]=Ot[133]=-1;Ft[37]=Ft[133]=0;Ut[37]=Ut[133]=0;Bt[37]=Bt[133]=1;zt[37]=zt[133]=0;kt[37]=kt[133]=0;Jt[148]=Jt[22]=-1;Kt[148]=Kt[22]=0;Qt[148]=Qt[22]=0;ne[148]=ne[22]=0;re[148]=re[22]=-1;ie[148]=ie[22]=1;jt[148]=jt[22]=0;te[148]=te[22]=1;ee[148]=ee[22]=1;Bt[148]=Bt[22]=-1;zt[148]=zt[22]=0;kt[148]=kt[22]=1;Gt[82]=Gt[88]=0;Vt[82]=Vt[88]=-1;Ht[82]=Ht[88]=1;Jt[82]=Jt[88]=1;Kt[82]=Kt[88]=0;Qt[82]=Qt[88]=1;Yt[82]=Yt[88]=-1;$t[82]=$t[88]=0;Zt[82]=Zt[88]=1;jt[82]=jt[88]=0;te[82]=te[88]=-1;ee[82]=ee[88]=0;Gt[73]=Gt[97]=0;Vt[73]=Vt[97]=1;Ht[73]=Ht[97]=0;qt[73]=qt[97]=0;Wt[73]=Wt[97]=-1;Xt[73]=Xt[97]=0;Yt[73]=Yt[97]=1;$t[73]=$t[97]=0;Zt[73]=Zt[97]=0;Ot[73]=Ot[97]=1;Ft[73]=Ft[97]=0;Ut[73]=Ut[97]=1;Gt[145]=Gt[25]=0;Vt[145]=Vt[25]=-1;Ht[145]=Ht[25]=0;Yt[145]=Yt[25]=1;$t[145]=$t[25]=0;Zt[145]=Zt[25]=1;ne[145]=ne[25]=0;re[145]=re[25]=1;ie[145]=ie[25]=1;Bt[145]=Bt[25]=-1;zt[145]=zt[25]=0;kt[145]=kt[25]=0;qt[70]=qt[100]=0;Wt[70]=Wt[100]=1;Xt[70]=Xt[100]=0;Jt[70]=Jt[100]=-1;Kt[70]=Kt[100]=0;Qt[70]=Qt[100]=1;jt[70]=jt[100]=0;te[70]=te[100]=-1;ee[70]=ee[100]=1;Ot[70]=Ot[100]=1;Ft[70]=Ft[100]=0;Ut[70]=Ut[100]=0;qt[101]=qt[69]=0;Wt[101]=Wt[69]=1;Xt[101]=Xt[69]=0;Ot[101]=Ot[69]=1;Ft[101]=Ft[69]=0;Ut[101]=Ut[69]=0;ne[149]=ne[21]=0;re[149]=re[21]=1;ie[149]=ie[21]=1;Bt[149]=Bt[21]=-1;zt[149]=zt[21]=0;kt[149]=kt[21]=0;Jt[86]=Jt[84]=-1;Kt[86]=Kt[84]=0;Qt[86]=Qt[84]=1;jt[86]=jt[84]=0;te[86]=te[84]=-1;ee[86]=ee[84]=1;Gt[89]=Gt[81]=0;Vt[89]=Vt[81]=-1;Ht[89]=Ht[81]=0;Yt[89]=Yt[81]=1;$t[89]=$t[81]=0;Zt[89]=Zt[81]=1;Gt[96]=Gt[74]=0;Vt[96]=Vt[74]=1;Ht[96]=Ht[74]=0;qt[96]=qt[74]=-1;Wt[96]=Wt[74]=0;Xt[96]=Xt[74]=1;jt[96]=jt[74]=1;te[96]=te[74]=0;ee[96]=ee[74]=0;Ot[96]=Ot[74]=1;Ft[96]=Ft[74]=0;Ut[96]=Ut[74]=1;Gt[24]=Gt[146]=0;Vt[24]=Vt[146]=-1;Ht[24]=Ht[146]=1;Jt[24]=Jt[146]=1;Kt[24]=Kt[146]=0;Qt[24]=Qt[146]=1;Yt[24]=Yt[146]=0;$t[24]=$t[146]=1;Zt[24]=Zt[146]=1;Bt[24]=Bt[146]=0;zt[24]=zt[146]=-1;kt[24]=kt[146]=0;qt[6]=qt[164]=-1;Wt[6]=Wt[164]=0;Xt[6]=Xt[164]=1;Jt[6]=Jt[164]=-1;Kt[6]=Kt[164]=0;Qt[6]=Qt[164]=0;ne[6]=ne[164]=0;re[6]=re[164]=-1;ie[6]=ie[164]=1;jt[6]=jt[164]=1;te[6]=te[164]=0;ee[6]=ee[164]=0;Yt[129]=Yt[41]=0;$t[129]=$t[41]=1;Zt[129]=Zt[41]=1;ne[129]=ne[41]=0;re[129]=re[41]=1;ie[129]=ie[41]=0;Ot[129]=Ot[41]=-1;Ft[129]=Ft[41]=0;Ut[129]=Ut[41]=0;Bt[129]=Bt[41]=0;zt[129]=zt[41]=-1;kt[129]=kt[41]=0;Jt[66]=Jt[104]=0;Kt[66]=Kt[104]=1;Qt[66]=Qt[104]=0;Yt[66]=Yt[104]=-1;$t[66]=$t[104]=0;Zt[66]=Zt[104]=1;jt[66]=jt[104]=0;te[66]=te[104]=-1;ee[66]=ee[104]=0;Ot[66]=Ot[104]=0;Ft[66]=Ft[104]=-1;Ut[66]=Ut[104]=1;Gt[144]=Gt[26]=-1;Vt[144]=Vt[26]=0;Ht[144]=Ht[26]=0;ne[144]=ne[26]=1;re[144]=re[26]=0;ie[144]=ie[26]=1;jt[144]=jt[26]=0;te[144]=te[26]=1;ee[144]=ee[26]=1;Bt[144]=Bt[26]=-1;zt[144]=zt[26]=0;kt[144]=kt[26]=1;qt[36]=qt[134]=0;Wt[36]=Wt[134]=1;Xt[36]=Xt[134]=1;Jt[36]=Jt[134]=0;Kt[36]=Kt[134]=1;Qt[36]=Qt[134]=0;Ot[36]=Ot[134]=0;Ft[36]=Ft[134]=-1;Ut[36]=Ut[134]=1;Bt[36]=Bt[134]=1;zt[36]=zt[134]=0;kt[36]=kt[134]=0;Gt[9]=Gt[161]=-1;Vt[9]=Vt[161]=0;Ht[9]=Ht[161]=0;qt[9]=qt[161]=0;Wt[9]=Wt[161]=-1;Xt[9]=Xt[161]=0;Yt[9]=Yt[161]=1;$t[9]=$t[161]=0;Zt[9]=Zt[161]=0;ne[9]=ne[161]=1;re[9]=re[161]=0;ie[9]=ie[161]=1;Gt[136]=0;Vt[136]=1;Ht[136]=1;qt[136]=0;Wt[136]=1;Xt[136]=0;Jt[136]=-1;Kt[136]=0;Qt[136]=1;Yt[136]=-1;$t[136]=0;Zt[136]=0;ne[136]=0;re[136]=-1;ie[136]=0;jt[136]=0;te[136]=-1;ee[136]=1;Ot[136]=1;Ft[136]=0;Ut[136]=0;Bt[136]=1;zt[136]=0;kt[136]=1;Gt[34]=0;Vt[34]=-1;Ht[34]=0;qt[34]=0;Wt[34]=-1;Xt[34]=1;Jt[34]=1;Kt[34]=0;Qt[34]=0;Yt[34]=1;$t[34]=0;Zt[34]=1;ne[34]=0;re[34]=1;ie[34]=1;jt[34]=0;te[34]=1;ee[34]=0;Ot[34]=-1;Ft[34]=0;Ut[34]=1;Bt[34]=-1;zt[34]=0;kt[34]=0;Gt[35]=0;Vt[35]=1;Ht[35]=1;qt[35]=0;Wt[35]=-1;Xt[35]=1;Jt[35]=1;Kt[35]=0;Qt[35]=0;Yt[35]=-1;$t[35]=0;Zt[35]=0;ne[35]=0;re[35]=-1;ie[35]=0;jt[35]=0;te[35]=1;ee[35]=0;Ot[35]=-1;Ft[35]=0;Ut[35]=1;Bt[35]=1;zt[35]=0;kt[35]=1;Gt[153]=0;Vt[153]=1;Ht[153]=1;Yt[153]=-1;$t[153]=0;Zt[153]=0;ne[153]=0;re[153]=-1;ie[153]=0;Bt[153]=1;zt[153]=0;kt[153]=1;qt[102]=0;Wt[102]=-1;Xt[102]=1;Jt[102]=1;Kt[102]=0;Qt[102]=0;jt[102]=0;te[102]=1;ee[102]=0;Ot[102]=-1;Ft[102]=0;Ut[102]=1;Gt[155]=0;Vt[155]=-1;Ht[155]=0;Yt[155]=1;$t[155]=0;Zt[155]=1;ne[155]=0;re[155]=1;ie[155]=1;Bt[155]=-1;zt[155]=0;kt[155]=0;qt[103]=0;Wt[103]=1;Xt[103]=0;Jt[103]=-1;Kt[103]=0;Qt[103]=1;jt[103]=0;te[103]=-1;ee[103]=1;Ot[103]=1;Ft[103]=0;Ut[103]=0;Gt[152]=0;Vt[152]=1;Ht[152]=1;Jt[152]=-1;Kt[152]=0;Qt[152]=1;Yt[152]=-1;$t[152]=0;Zt[152]=0;ne[152]=0;re[152]=-1;ie[152]=0;jt[152]=0;te[152]=-1;ee[152]=1;Bt[152]=1;zt[152]=0;kt[152]=1;Gt[156]=0;Vt[156]=-1;Ht[156]=1;Jt[156]=1;Kt[156]=0;Qt[156]=1;Yt[156]=-1;$t[156]=0;Zt[156]=0;ne[156]=0;re[156]=-1;ie[156]=0;jt[156]=0;te[156]=1;ee[156]=1;Bt[156]=-1;zt[156]=0;kt[156]=1;Gt[137]=0;Vt[137]=1;Ht[137]=1;qt[137]=0;Wt[137]=1;Xt[137]=0;Yt[137]=-1;$t[137]=0;Zt[137]=0;ne[137]=0;re[137]=-1;ie[137]=0;Ot[137]=1;Ft[137]=0;Ut[137]=0;Bt[137]=1;zt[137]=0;kt[137]=1;Gt[139]=0;Vt[139]=1;Ht[139]=1;qt[139]=0;Wt[139]=-1;Xt[139]=0;Yt[139]=1;$t[139]=0;Zt[139]=0;ne[139]=0;re[139]=1;ie[139]=0;Ot[139]=-1;Ft[139]=0;Ut[139]=0;Bt[139]=1;zt[139]=0;kt[139]=1;Gt[98]=0;Vt[98]=-1;Ht[98]=0;qt[98]=0;Wt[98]=-1;Xt[98]=1;Jt[98]=1;Kt[98]=0;Qt[98]=0;Yt[98]=1;$t[98]=0;Zt[98]=1;jt[98]=0;te[98]=1;ee[98]=0;Ot[98]=-1;Ft[98]=0;Ut[98]=1;Gt[99]=0;Vt[99]=1;Ht[99]=0;qt[99]=0;Wt[99]=-1;Xt[99]=1;Jt[99]=1;Kt[99]=0;Qt[99]=0;Yt[99]=-1;$t[99]=0;Zt[99]=1;jt[99]=0;te[99]=-1;ee[99]=0;Ot[99]=1;Ft[99]=0;Ut[99]=1;qt[38]=0;Wt[38]=-1;Xt[38]=1;Jt[38]=1;Kt[38]=0;Qt[38]=0;ne[38]=0;re[38]=1;ie[38]=1;jt[38]=0;te[38]=1;ee[38]=0;Ot[38]=-1;Ft[38]=0;Ut[38]=1;Bt[38]=-1;zt[38]=0;kt[38]=0;qt[39]=0;Wt[39]=1;Xt[39]=1;Jt[39]=-1;Kt[39]=0;Qt[39]=0;ne[39]=0;re[39]=-1;ie[39]=1;jt[39]=0;te[39]=1;ee[39]=0;Ot[39]=-1;Ft[39]=0;Ut[39]=1;Bt[39]=1;zt[39]=0;kt[39]=0;var Kc=function(o){return[[o.bottomleft,0],[0,0],[0,o.leftbottom]]},Qc=function(o){return[[1,o.rightbottom],[1,0],[o.bottomright,0]]},jc=function(o){return[[o.topright,1],[1,1],[1,o.righttop]]},th=function(o){return[[0,o.lefttop],[0,1],[o.topleft,1]]},eh=function(o){return[[o.bottomright,0],[o.bottomleft,0],[0,o.leftbottom],[0,o.lefttop]]},nh=function(o){return[[o.bottomright,0],[o.bottomleft,0],[1,o.righttop],[1,o.rightbottom]]},rh=function(o){return[[1,o.righttop],[1,o.rightbottom],[o.topleft,1],[o.topright,1]]},ih=function(o){return[[0,o.leftbottom],[0,o.lefttop],[o.topleft,1],[o.topright,1]]},fM=function(o){return[[0,0],[0,o.leftbottom],[1,o.rightbottom],[1,0]]},pM=function(o){return[[1,0],[o.bottomright,0],[o.topright,1],[1,1]]},dM=function(o){return[[1,1],[1,o.righttop],[0,o.lefttop],[0,1]]},mM=function(o){return[[o.bottomleft,0],[0,0],[0,1],[o.topleft,1]]},gM=function(o){return[[1,o.righttop],[1,o.rightbottom],[0,o.leftbottom],[0,o.lefttop]]},yM=function(o){return[[o.topleft,1],[o.topright,1],[o.bottomright,0],[o.bottomleft,0]]},vM=function(){return[[0,0],[0,1],[1,1],[1,0]]},_M=function(o){return[[1,o.rightbottom],[1,0],[0,0],[0,1],[o.topleft,1]]},xM=function(o){return[[o.topright,1],[1,1],[1,0],[0,0],[0,o.leftbottom]]},EM=function(o){return[[1,0],[o.bottomright,0],[0,o.lefttop],[0,1],[1,1]]},MM=function(o){return[[1,1],[1,o.righttop],[o.bottomleft,0],[0,0],[0,1]]},wM=function(o){return[[1,o.righttop],[1,o.rightbottom],[0,o.lefttop],[0,1],[o.topleft,1]]},SM=function(o){return[[1,1],[1,o.righttop],[o.bottomright,0],[o.bottomleft,0],[o.topright,1]]},bM=function(o){return[[1,o.rightbottom],[1,0],[o.bottomright,0],[0,o.leftbottom],[0,o.lefttop]]},AM=function(o){return[[o.topright,1],[o.bottomleft,0],[0,0],[0,o.leftbottom],[o.topleft,1]]},TM=function(o){return[[o.bottomright,0],[o.bottomleft,0],[0,o.lefttop],[0,1],[o.topleft,1]]},CM=function(o){return[[1,1],[1,o.righttop],[0,o.leftbottom],[0,o.lefttop],[o.topright,1]]},IM=function(o){return[[1,o.rightbottom],[1,0],[o.bottomright,0],[o.topleft,1],[o.topright,1]]},PM=function(o){return[[1,o.righttop],[1,o.rightbottom],[o.bottomleft,0],[0,0],[0,o.leftbottom]]},RM=function(o){return[[1,o.rightbottom],[1,0],[0,0],[0,o.leftbottom],[o.topleft,1],[o.topright,1]]},NM=function(o){return[[1,1],[1,0],[o.bottomright,0],[0,o.leftbottom],[0,o.lefttop],[o.topright,1]]},LM=function(o){return[[1,1],[1,o.righttop],[o.bottomright,0],[o.bottomleft,0],[0,o.lefttop],[0,1]]},DM=function(o){return[[1,o.righttop],[1,o.rightbottom],[o.bottomleft,0],[0,0],[0,1],[o.topleft,1]]},OM=function(o){return[[1,1],[1,o.righttop],[o.bottomleft,0],[0,0],[0,o.leftbottom],[o.topright,1]]},FM=function(o){return[[1,o.rightbottom],[1,0],[o.bottomright,0],[0,o.lefttop],[0,1],[o.topleft,1]]},UM=function(o){return[[1,o.righttop],[1,o.rightbottom],[o.bottomright,0],[o.bottomleft,0],[0,o.leftbottom],[0,o.lefttop],[o.topleft,1],[o.topright,1]]},BM=function(o){return[[1,1],[1,o.righttop],[o.bottomleft,0],[0,0],[0,o.leftbottom],[o.topright,1]]},zM=function(o){return[[1,o.rightbottom],[1,0],[o.bottomright,0],[0,o.lefttop],[0,1],[o.topleft,1]]},kM=function(o){return[[1,1],[1,o.righttop],[o.bottomright,0],[o.bottomleft,0],[0,o.leftbottom],[0,o.lefttop],[o.topright,1]]},GM=function(o){return[[1,o.righttop],[1,o.rightbottom],[o.bottomleft,0],[0,0],[0,o.leftbottom],[o.topleft,1],[o.topright,1]]},VM=function(o){return[[1,o.righttop],[1,o.rightbottom],[o.bottomright,0],[o.bottomleft,0],[0,o.lefttop],[0,1],[o.topleft,1]]},HM=function(o){return[[1,o.rightbottom],[1,0],[o.bottomright,0],[0,o.leftbottom],[0,o.lefttop],[o.topleft,1],[o.topright,1]]},le=[],ce=[],he=[],fe=[],pe=[],de=[],me=[],ge=[];fe[1]=pe[1]=18;fe[169]=pe[169]=18;he[4]=ce[4]=12;he[166]=ce[166]=12;le[16]=ge[16]=4;le[154]=ge[154]=4;de[64]=me[64]=22;de[106]=me[106]=22;he[2]=de[2]=17;fe[2]=pe[2]=18;he[168]=de[168]=17;fe[168]=pe[168]=18;le[8]=fe[8]=9;ce[8]=he[8]=12;le[162]=fe[162]=9;ce[162]=he[162]=12;le[32]=ge[32]=4;ce[32]=me[32]=1;le[138]=ge[138]=4;ce[138]=me[138]=1;pe[128]=ge[128]=21;de[128]=me[128]=22;pe[42]=ge[42]=21;de[42]=me[42]=22;ce[5]=pe[5]=14;ce[165]=pe[165]=14;he[20]=ge[20]=6;he[150]=ge[150]=6;le[80]=de[80]=11;le[90]=de[90]=11;fe[65]=me[65]=3;fe[105]=me[105]=3;le[160]=de[160]=11;ce[160]=pe[160]=14;le[10]=de[10]=11;ce[10]=pe[10]=14;he[130]=ge[130]=6;fe[130]=me[130]=3;he[40]=ge[40]=6;fe[40]=me[40]=3;ce[101]=me[101]=1;ce[69]=me[69]=1;pe[149]=ge[149]=21;pe[21]=ge[21]=21;he[86]=de[86]=17;he[84]=de[84]=17;le[89]=fe[89]=9;le[81]=fe[81]=9;le[96]=me[96]=0;ce[96]=de[96]=15;le[74]=me[74]=0;ce[74]=de[74]=15;le[24]=he[24]=8;fe[24]=ge[24]=7;le[146]=he[146]=8;fe[146]=ge[146]=7;ce[6]=de[6]=15;he[6]=pe[6]=16;ce[164]=de[164]=15;he[164]=pe[164]=16;fe[129]=ge[129]=7;pe[129]=me[129]=20;fe[41]=ge[41]=7;pe[41]=me[41]=20;he[66]=me[66]=2;fe[66]=de[66]=19;he[104]=me[104]=2;fe[104]=de[104]=19;le[144]=pe[144]=10;de[144]=ge[144]=23;le[26]=pe[26]=10;de[26]=ge[26]=23;ce[36]=ge[36]=5;he[36]=me[36]=2;ce[134]=ge[134]=5;he[134]=me[134]=2;le[9]=pe[9]=10;ce[9]=fe[9]=13;le[161]=pe[161]=10;ce[161]=fe[161]=13;ce[37]=ge[37]=5;pe[37]=me[37]=20;ce[133]=ge[133]=5;pe[133]=me[133]=20;he[148]=pe[148]=16;de[148]=ge[148]=23;he[22]=pe[22]=16;de[22]=ge[22]=23;le[82]=he[82]=8;fe[82]=de[82]=19;le[88]=he[88]=8;fe[88]=de[88]=19;le[73]=me[73]=0;ce[73]=fe[73]=13;le[97]=me[97]=0;ce[97]=fe[97]=13;le[145]=fe[145]=9;pe[145]=ge[145]=21;le[25]=fe[25]=9;pe[25]=ge[25]=21;ce[70]=me[70]=1;he[70]=de[70]=17;ce[100]=me[100]=1;he[100]=de[100]=17;le[34]=fe[34]=9;ce[34]=he[34]=12;pe[34]=ge[34]=21;de[34]=me[34]=22;le[136]=ge[136]=4;ce[136]=me[136]=1;he[136]=de[136]=17;fe[136]=pe[136]=18;le[35]=ge[35]=4;ce[35]=he[35]=12;fe[35]=pe[35]=18;de[35]=me[35]=22;le[153]=ge[153]=4;fe[153]=pe[153]=18;ce[102]=he[102]=12;de[102]=me[102]=22;le[155]=fe[155]=9;pe[155]=ge[155]=23;ce[103]=me[103]=1;he[103]=de[103]=17;le[152]=ge[152]=4;he[152]=de[152]=17;fe[152]=pe[152]=18;le[156]=he[156]=8;fe[156]=pe[156]=18;de[156]=ge[156]=23;le[137]=ge[137]=4;ce[137]=me[137]=1;fe[137]=pe[137]=18;le[139]=ge[139]=4;ce[139]=fe[139]=13;pe[139]=me[139]=20;le[98]=fe[98]=9;ce[98]=he[98]=12;de[98]=me[98]=22;le[99]=me[99]=0;ce[99]=he[99]=12;fe[99]=de[99]=19;ce[38]=he[38]=12;pe[38]=ge[38]=21;de[38]=me[38]=22;ce[39]=ge[39]=5;he[39]=pe[39]=16;de[39]=me[39]=22;var st=[];st[1]=st[169]=Kc;st[4]=st[166]=Qc;st[16]=st[154]=jc;st[64]=st[106]=th;st[168]=st[2]=eh;st[162]=st[8]=nh;st[138]=st[32]=rh;st[42]=st[128]=ih;st[5]=st[165]=fM;st[20]=st[150]=pM;st[80]=st[90]=dM;st[65]=st[105]=mM;st[160]=st[10]=gM;st[130]=st[40]=yM;st[85]=vM;st[101]=st[69]=_M;st[149]=st[21]=xM;st[86]=st[84]=EM;st[89]=st[81]=MM;st[96]=st[74]=wM;st[24]=st[146]=SM;st[6]=st[164]=bM;st[129]=st[41]=AM;st[66]=st[104]=TM;st[144]=st[26]=CM;st[36]=st[134]=IM;st[9]=st[161]=PM;st[37]=st[133]=RM;st[148]=st[22]=NM;st[82]=st[88]=LM;st[73]=st[97]=DM;st[145]=st[25]=OM;st[70]=st[100]=FM;st[34]=function(o){return[ih(o),nh(o)]};st[35]=UM;st[136]=function(o){return[rh(o),eh(o)]};st[153]=function(o){return[jc(o),Kc(o)]};st[102]=function(o){return[Qc(o),th(o)]};st[155]=BM;st[103]=zM;st[152]=function(o){return[jc(o),eh(o)]};st[156]=kM;st[137]=function(o){return[rh(o),Kc(o)]};st[139]=GM;st[98]=function(o){return[nh(o),th(o)]};st[99]=VM;st[38]=function(o){return[Qc(o),ih(o)]};st[39]=HM;function WM(o){return(o>0)-(o<0)||+o}function Is(o,e,r){var a=e[0]-o[0],u=e[1]-o[1],c=r[0]-e[0],h=r[1]-e[1];return WM(a*h-c*u)}function ag(o,e){var r=o.geometry.coordinates[0].map(function(h){return h[0]}),a=o.geometry.coordinates[0].map(function(h){return h[1]}),u=e.geometry.coordinates[0].map(function(h){return h[0]}),c=e.geometry.coordinates[0].map(function(h){return h[1]});return Math.max.apply(null,r)===Math.max.apply(null,u)&&Math.max.apply(null,a)===Math.max.apply(null,c)&&Math.min.apply(null,r)===Math.min.apply(null,u)&&Math.min.apply(null,a)===Math.min.apply(null,c)}function oh(o,e){return e.geometry.coordinates[0].every(function(r){return $n(He(r),o)})}function ug(o,e){return o[0]===e[0]&&o[1]===e[1]}var XM=function(){function o(e){this.id=o.buildId(e),this.coordinates=e,this.innerEdges=[],this.outerEdges=[],this.outerEdgesSorted=!1}return o.buildId=function(e){return e.join(",")},o.prototype.removeInnerEdge=function(e){this.innerEdges=this.innerEdges.filter(function(r){return r.from.id!==e.from.id})},o.prototype.removeOuterEdge=function(e){this.outerEdges=this.outerEdges.filter(function(r){return r.to.id!==e.to.id})},o.prototype.addOuterEdge=function(e){this.outerEdges.push(e),this.outerEdgesSorted=!1},o.prototype.sortOuterEdges=function(){var e=this;this.outerEdgesSorted||(this.outerEdges.sort(function(r,a){var u=r.to,c=a.to;if(u.coordinates[0]-e.coordinates[0]>=0&&c.coordinates[0]-e.coordinates[0]<0)return 1;if(u.coordinates[0]-e.coordinates[0]<0&&c.coordinates[0]-e.coordinates[0]>=0)return-1;if(u.coordinates[0]-e.coordinates[0]===0&&c.coordinates[0]-e.coordinates[0]===0)return u.coordinates[1]-e.coordinates[1]>=0||c.coordinates[1]-e.coordinates[1]>=0?u.coordinates[1]-c.coordinates[1]:c.coordinates[1]-u.coordinates[1];var h=Is(e.coordinates,u.coordinates,c.coordinates);if(h<0)return 1;if(h>0)return-1;var p=Math.pow(u.coordinates[0]-e.coordinates[0],2)+Math.pow(u.coordinates[1]-e.coordinates[1],2),d=Math.pow(c.coordinates[0]-e.coordinates[0],2)+Math.pow(c.coordinates[1]-e.coordinates[1],2);return p-d}),this.outerEdgesSorted=!0)},o.prototype.getOuterEdges=function(){return this.sortOuterEdges(),this.outerEdges},o.prototype.getOuterEdge=function(e){return this.sortOuterEdges(),this.outerEdges[e]},o.prototype.addInnerEdge=function(e){this.innerEdges.push(e)},o}(),sh=XM;var YM=function(){function o(e,r){this.from=e,this.to=r,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 o.prototype.getSymetric=function(){return this.symetric||(this.symetric=new o(this.to,this.from),this.symetric.symetric=this),this.symetric},o.prototype.deleteEdge=function(){this.from.removeOuterEdge(this),this.to.removeInnerEdge(this)},o.prototype.isEqual=function(e){return this.from.id===e.from.id&&this.to.id===e.to.id},o.prototype.toString=function(){return"Edge { "+this.from.id+" -> "+this.to.id+" }"},o.prototype.toLineString=function(){return Yn([this.from.coordinates,this.to.coordinates])},o.prototype.compareTo=function(e){return Is(e.from.coordinates,e.to.coordinates,this.to.coordinates)},o}(),lg=YM;var $M=function(){function o(){this.edges=[],this.polygon=void 0,this.envelope=void 0}return o.prototype.push=function(e){this.edges.push(e),this.polygon=this.envelope=void 0},o.prototype.get=function(e){return this.edges[e]},Object.defineProperty(o.prototype,"length",{get:function(){return this.edges.length},enumerable:!0,configurable:!0}),o.prototype.forEach=function(e){this.edges.forEach(e)},o.prototype.map=function(e){return this.edges.map(e)},o.prototype.some=function(e){return this.edges.some(e)},o.prototype.isValid=function(){return!0},o.prototype.isHole=function(){var e=this,r=this.edges.reduce(function(h,p,d){return p.from.coordinates[1]>e.edges[h].from.coordinates[1]&&(h=d),h},0),a=(r===0?this.length:r)-1,u=(r+1)%this.length,c=Is(this.edges[a].from.coordinates,this.edges[r].from.coordinates,this.edges[u].from.coordinates);return c===0?this.edges[a].from.coordinates[0]>this.edges[u].from.coordinates[0]:c>0},o.prototype.toMultiPoint=function(){return Hl(this.edges.map(function(e){return e.from.coordinates}))},o.prototype.toPolygon=function(){if(this.polygon)return this.polygon;var e=this.edges.map(function(r){return r.from.coordinates});return e.push(this.edges[0].from.coordinates),this.polygon=sn([e])},o.prototype.getEnvelope=function(){return this.envelope?this.envelope:this.envelope=uc(this.toPolygon())},o.findEdgeRingContaining=function(e,r){var a=e.getEnvelope(),u,c;return r.forEach(function(h){var p=h.getEnvelope();if(c&&(u=c.getEnvelope()),!ag(p,a)&&oh(p,a)){for(var d=e.map(function(I){return I.from.coordinates}),g=void 0,v=function(I){h.some(function(D){return ug(I,D.from.coordinates)})||(g=I)},x=0,M=d;x<M.length;x++){var w=M[x];v(w)}g&&h.inside(He(g))&&(!c||oh(u,p))&&(c=h)}}),c},o.prototype.inside=function(e){return $n(e,this.toPolygon())},o}(),ah=$M;function ZM(o){if(!o)throw new Error("No geojson passed");if(o.type!=="FeatureCollection"&&o.type!=="GeometryCollection"&&o.type!=="MultiLineString"&&o.type!=="LineString"&&o.type!=="Feature")throw new Error("Invalid input type '"+o.type+"'. Geojson must be FeatureCollection, GeometryCollection, LineString, MultiLineString or Feature")}var RL=function(){function o(){this.edges=[],this.nodes={}}return o.fromGeoJson=function(e){ZM(e);var r=new o;return Yr(e,function(a){Wl(a,"LineString","Graph::fromGeoJson"),ep(a,function(u,c){if(u){var h=r.getNode(u),p=r.getNode(c);r.addEdge(h,p)}return c})}),r},o.prototype.getNode=function(e){var r=sh.buildId(e),a=this.nodes[r];return a||(a=this.nodes[r]=new sh(e)),a},o.prototype.addEdge=function(e,r){var a=new lg(e,r),u=a.getSymetric();this.edges.push(a),this.edges.push(u)},o.prototype.deleteDangles=function(){var e=this;Object.keys(this.nodes).map(function(r){return e.nodes[r]}).forEach(function(r){return e._removeIfDangle(r)})},o.prototype._removeIfDangle=function(e){var r=this;if(e.innerEdges.length<=1){var a=e.getOuterEdges().map(function(u){return u.to});this.removeNode(e),a.forEach(function(u){return r._removeIfDangle(u)})}},o.prototype.deleteCutEdges=function(){var e=this;this._computeNextCWEdges(),this._findLabeledEdgeRings(),this.edges.forEach(function(r){r.label===r.symetric.label&&(e.removeEdge(r.symetric),e.removeEdge(r))})},o.prototype._computeNextCWEdges=function(e){var r=this;typeof e=="undefined"?Object.keys(this.nodes).forEach(function(a){return r._computeNextCWEdges(r.nodes[a])}):e.getOuterEdges().forEach(function(a,u){e.getOuterEdge((u===0?e.getOuterEdges().length:u)-1).symetric.next=a})},o.prototype._computeNextCCWEdges=function(e,r){for(var a=e.getOuterEdges(),u,c,h=a.length-1;h>=0;--h){var p=a[h],d=p.symetric,g=void 0,v=void 0;p.label===r&&(g=p),d.label===r&&(v=d),!(!g||!v)&&(v&&(c=v),g&&(c&&(c.next=g,c=void 0),u||(u=g)))}c&&(c.next=u)},o.prototype._findLabeledEdgeRings=function(){var e=[],r=0;return this.edges.forEach(function(a){if(!(a.label>=0)){e.push(a);var u=a;do u.label=r,u=u.next;while(!a.isEqual(u));r++}}),e},o.prototype.getEdgeRings=function(){var e=this;this._computeNextCWEdges(),this.edges.forEach(function(a){a.label=void 0}),this._findLabeledEdgeRings().forEach(function(a){e._findIntersectionNodes(a).forEach(function(u){e._computeNextCCWEdges(u,a.label)})});var r=[];return this.edges.forEach(function(a){a.ring||r.push(e._findEdgeRing(a))}),r},o.prototype._findIntersectionNodes=function(e){var r=[],a=e,u=function(){var c=0;a.from.getOuterEdges().forEach(function(h){h.label===e.label&&++c}),c>1&&r.push(a.from),a=a.next};do u();while(!e.isEqual(a));return r},o.prototype._findEdgeRing=function(e){var r=e,a=new ah;do a.push(r),r.ring=a,r=r.next;while(!e.isEqual(r));return a},o.prototype.removeNode=function(e){var r=this;e.getOuterEdges().forEach(function(a){return r.removeEdge(a)}),e.innerEdges.forEach(function(a){return r.removeEdge(a)}),delete this.nodes[e.id]},o.prototype.removeEdge=function(e){this.edges=this.edges.filter(function(r){return!r.isEqual(e)}),e.deleteEdge()},o}();var jM=ln(uh(),1);var tw=ln(uh(),1);var nw=ln(vg(),1);var lw=ln(Cg(),1);function Pg(o){for(var e=o,r=[];e.parent;)r.unshift(e),e=e.parent;return r}function hw(){return new Rg(function(o){return o.f})}var fh={search:function(o,e,r,a){o.cleanDirty(),a=a||{};var u=a.heuristic||fh.heuristics.manhattan,c=a.closest||!1,h=hw(),p=e;for(e.h=u(e,r),h.push(e);h.size()>0;){var d=h.pop();if(d===r)return Pg(d);d.closed=!0;for(var g=o.neighbors(d),v=0,x=g.length;v<x;++v){var M=g[v];if(!(M.closed||M.isWall())){var w=d.g+M.getCost(d),I=M.visited;(!I||w<M.g)&&(M.visited=!0,M.parent=d,M.h=M.h||u(M,r),M.g=w,M.f=M.g+M.h,o.markDirty(M),c&&(M.h<p.h||M.h===p.h&&M.g<p.g)&&(p=M),I?h.rescoreElement(M):h.push(M))}}}return c?Pg(p):[]},heuristics:{manhattan:function(o,e){var r=Math.abs(e.x-o.x),a=Math.abs(e.y-o.y);return r+a},diagonal:function(o,e){var r=1,a=Math.sqrt(2),u=Math.abs(e.x-o.x),c=Math.abs(e.y-o.y);return r*(u+c)+(a-2*r)*Math.min(u,c)}},cleanNode:function(o){o.f=0,o.g=0,o.h=0,o.visited=!1,o.closed=!1,o.parent=null}};function xa(o,e){e=e||{},this.nodes=[],this.diagonal=!!e.diagonal,this.grid=[];for(var r=0;r<o.length;r++){this.grid[r]=[];for(var a=0,u=o[r];a<u.length;a++){var c=new Fu(r,a,u[a]);this.grid[r][a]=c,this.nodes.push(c)}}this.init()}xa.prototype.init=function(){this.dirtyNodes=[];for(var o=0;o<this.nodes.length;o++)fh.cleanNode(this.nodes[o])};xa.prototype.cleanDirty=function(){for(var o=0;o<this.dirtyNodes.length;o++)fh.cleanNode(this.dirtyNodes[o]);this.dirtyNodes=[]};xa.prototype.markDirty=function(o){this.dirtyNodes.push(o)};xa.prototype.neighbors=function(o){var e=[],r=o.x,a=o.y,u=this.grid;return u[r-1]&&u[r-1][a]&&e.push(u[r-1][a]),u[r+1]&&u[r+1][a]&&e.push(u[r+1][a]),u[r]&&u[r][a-1]&&e.push(u[r][a-1]),u[r]&&u[r][a+1]&&e.push(u[r][a+1]),this.diagonal&&(u[r-1]&&u[r-1][a-1]&&e.push(u[r-1][a-1]),u[r+1]&&u[r+1][a-1]&&e.push(u[r+1][a-1]),u[r-1]&&u[r-1][a+1]&&e.push(u[r-1][a+1]),u[r+1]&&u[r+1][a+1]&&e.push(u[r+1][a+1])),e};xa.prototype.toString=function(){for(var o=[],e=this.grid,r,a,u,c,h=0,p=e.length;h<p;h++){for(r=[],a=e[h],u=0,c=a.length;u<c;u++)r.push(a[u].weight);o.push(r.join(" "))}return o.join(\`
7349
- \`)};function Fu(o,e,r){this.x=o,this.y=e,this.weight=r}Fu.prototype.toString=function(){return"["+this.x+" "+this.y+"]"};Fu.prototype.getCost=function(o){return o&&o.x!==this.x&&o.y!==this.y?this.weight*1.41421:this.weight};Fu.prototype.isWall=function(){return this.weight===0};function Rg(o){this.content=[],this.scoreFunction=o}Rg.prototype={push:function(o){this.content.push(o),this.sinkDown(this.content.length-1)},pop:function(){var o=this.content[0],e=this.content.pop();return this.content.length>0&&(this.content[0]=e,this.bubbleUp(0)),o},remove:function(o){var e=this.content.indexOf(o),r=this.content.pop();e!==this.content.length-1&&(this.content[e]=r,this.scoreFunction(r)<this.scoreFunction(o)?this.sinkDown(e):this.bubbleUp(e))},size:function(){return this.content.length},rescoreElement:function(o){this.sinkDown(this.content.indexOf(o))},sinkDown:function(o){for(var e=this.content[o];o>0;){var r=(o+1>>1)-1,a=this.content[r];if(this.scoreFunction(e)<this.scoreFunction(a))this.content[r]=e,this.content[o]=a,o=r;else break}},bubbleUp:function(o){for(var e=this.content.length,r=this.content[o],a=this.scoreFunction(r);;){var u=o+1<<1,c=u-1,h=null,p;if(c<e){var d=this.content[c];p=this.scoreFunction(d),p<a&&(h=c)}if(u<e){var g=this.content[u],v=this.scoreFunction(g);v<(h===null?a:p)&&(h=u)}if(h!==null)this.content[o]=this.content[h],this.content[h]=r,o=h;else break}}};function ph(){this._=null}function Rs(o){o.U=o.C=o.L=o.R=o.P=o.N=null}ph.prototype={constructor:ph,insert:function(o,e){var r,a,u;if(o){if(e.P=o,e.N=o.N,o.N&&(o.N.P=e),o.N=e,o.R){for(o=o.R;o.L;)o=o.L;o.L=e}else o.R=e;r=o}else this._?(o=Ng(this._),e.P=null,e.N=o,o.P=o.L=e,r=o):(e.P=e.N=null,this._=e,r=null);for(e.L=e.R=null,e.U=r,e.C=!0,o=e;r&&r.C;)a=r.U,r===a.L?(u=a.R,u&&u.C?(r.C=u.C=!1,a.C=!0,o=a):(o===r.R&&(Ea(this,r),o=r,r=o.U),r.C=!1,a.C=!0,Ma(this,a))):(u=a.L,u&&u.C?(r.C=u.C=!1,a.C=!0,o=a):(o===r.L&&(Ma(this,r),o=r,r=o.U),r.C=!1,a.C=!0,Ea(this,a))),r=o.U;this._.C=!1},remove:function(o){o.N&&(o.N.P=o.P),o.P&&(o.P.N=o.N),o.N=o.P=null;var e=o.U,r,a=o.L,u=o.R,c,h;if(a?u?c=Ng(u):c=a:c=u,e?e.L===o?e.L=c:e.R=c:this._=c,a&&u?(h=c.C,c.C=o.C,c.L=a,a.U=c,c!==u?(e=c.U,c.U=o.U,o=c.R,e.L=o,c.R=u,u.U=c):(c.U=e,e=c,o=c.R)):(h=o.C,o=c),o&&(o.U=e),!h){if(o&&o.C){o.C=!1;return}do{if(o===this._)break;if(o===e.L){if(r=e.R,r.C&&(r.C=!1,e.C=!0,Ea(this,e),r=e.R),r.L&&r.L.C||r.R&&r.R.C){(!r.R||!r.R.C)&&(r.L.C=!1,r.C=!0,Ma(this,r),r=e.R),r.C=e.C,e.C=r.R.C=!1,Ea(this,e),o=this._;break}}else if(r=e.L,r.C&&(r.C=!1,e.C=!0,Ma(this,e),r=e.L),r.L&&r.L.C||r.R&&r.R.C){(!r.L||!r.L.C)&&(r.R.C=!1,r.C=!0,Ea(this,r),r=e.L),r.C=e.C,e.C=r.L.C=!1,Ma(this,e),o=this._;break}r.C=!0,o=e,e=e.U}while(!o.C);o&&(o.C=!1)}}};function Ea(o,e){var r=e,a=e.R,u=r.U;u?u.L===r?u.L=a:u.R=a:o._=a,a.U=u,r.U=a,r.R=a.L,r.R&&(r.R.U=r),a.L=r}function Ma(o,e){var r=e,a=e.L,u=r.U;u?u.L===r?u.L=a:u.R=a:o._=a,a.U=u,r.U=a,r.L=a.R,r.L&&(r.L.U=r),a.R=r}function Ng(o){for(;o.L;)o=o.L;return o}var dh=ph;function Ns(o,e,r,a){var u=[null,null],c=Jn.push(u)-1;return u.left=o,u.right=e,r&&wa(u,o,e,r),a&&wa(u,e,o,a),Cr[o.index].halfedges.push(c),Cr[e.index].halfedges.push(c),u}function Ls(o,e,r){var a=[e,r];return a.left=o,a}function wa(o,e,r,a){!o[0]&&!o[1]?(o[0]=a,o.left=e,o.right=r):o.left===r?o[1]=a:o[0]=a}function fw(o,e,r,a,u){var c=o[0],h=o[1],p=c[0],d=c[1],g=h[0],v=h[1],x=0,M=1,w=g-p,I=v-d,D;if(D=e-p,!(!w&&D>0)){if(D/=w,w<0){if(D<x)return;D<M&&(M=D)}else if(w>0){if(D>M)return;D>x&&(x=D)}if(D=a-p,!(!w&&D<0)){if(D/=w,w<0){if(D>M)return;D>x&&(x=D)}else if(w>0){if(D<x)return;D<M&&(M=D)}if(D=r-d,!(!I&&D>0)){if(D/=I,I<0){if(D<x)return;D<M&&(M=D)}else if(I>0){if(D>M)return;D>x&&(x=D)}if(D=u-d,!(!I&&D<0)){if(D/=I,I<0){if(D>M)return;D>x&&(x=D)}else if(I>0){if(D<x)return;D<M&&(M=D)}return!(x>0)&&!(M<1)||(x>0&&(o[0]=[p+x*w,d+x*I]),M<1&&(o[1]=[p+M*w,d+M*I])),!0}}}}}function pw(o,e,r,a,u){var c=o[1];if(c)return!0;var h=o[0],p=o.left,d=o.right,g=p[0],v=p[1],x=d[0],M=d[1],w=(g+x)/2,I=(v+M)/2,D,b;if(M===v){if(w<e||w>=a)return;if(g>x){if(!h)h=[w,r];else if(h[1]>=u)return;c=[w,u]}else{if(!h)h=[w,u];else if(h[1]<r)return;c=[w,r]}}else if(D=(g-x)/(M-v),b=I-D*w,D<-1||D>1)if(g>x){if(!h)h=[(r-b)/D,r];else if(h[1]>=u)return;c=[(u-b)/D,u]}else{if(!h)h=[(u-b)/D,u];else if(h[1]<r)return;c=[(r-b)/D,r]}else if(v<M){if(!h)h=[e,D*e+b];else if(h[0]>=a)return;c=[a,D*a+b]}else{if(!h)h=[a,D*a+b];else if(h[0]<e)return;c=[e,D*e+b]}return o[0]=h,o[1]=c,!0}function Lg(o,e,r,a){for(var u=Jn.length,c;u--;)(!pw(c=Jn[u],o,e,r,a)||!fw(c,o,e,r,a)||!(Math.abs(c[0][0]-c[1][0])>Ue||Math.abs(c[0][1]-c[1][1])>Ue))&&delete Jn[u]}function Dg(o){return Cr[o.index]={site:o,halfedges:[]}}function dw(o,e){var r=o.site,a=e.left,u=e.right;return r===u&&(u=a,a=r),u?Math.atan2(u[1]-a[1],u[0]-a[0]):(r===a?(a=e[1],u=e[0]):(a=e[0],u=e[1]),Math.atan2(a[0]-u[0],u[1]-a[1]))}function mh(o,e){return e[+(e.left!==o.site)]}function mw(o,e){return e[+(e.left===o.site)]}function Og(){for(var o=0,e=Cr.length,r,a,u,c;o<e;++o)if((r=Cr[o])&&(c=(a=r.halfedges).length)){var h=new Array(c),p=new Array(c);for(u=0;u<c;++u)h[u]=u,p[u]=dw(r,Jn[a[u]]);for(h.sort(function(d,g){return p[g]-p[d]}),u=0;u<c;++u)p[u]=a[h[u]];for(u=0;u<c;++u)a[u]=p[u]}}function Fg(o,e,r,a){var u=Cr.length,c,h,p,d,g,v,x,M,w,I,D,b,T=!0;for(c=0;c<u;++c)if(h=Cr[c]){for(p=h.site,g=h.halfedges,d=g.length;d--;)Jn[g[d]]||g.splice(d,1);for(d=0,v=g.length;d<v;)I=mw(h,Jn[g[d]]),D=I[0],b=I[1],x=mh(h,Jn[g[++d%v]]),M=x[0],w=x[1],(Math.abs(D-M)>Ue||Math.abs(b-w)>Ue)&&(g.splice(d,0,Jn.push(Ls(p,I,Math.abs(D-o)<Ue&&a-b>Ue?[o,Math.abs(M-o)<Ue?w:a]:Math.abs(b-a)<Ue&&r-D>Ue?[Math.abs(w-a)<Ue?M:r,a]:Math.abs(D-r)<Ue&&b-e>Ue?[r,Math.abs(M-r)<Ue?w:e]:Math.abs(b-e)<Ue&&D-o>Ue?[Math.abs(w-e)<Ue?M:o,e]:null))-1),++v);v&&(T=!1)}if(T){var L,P,z,k=1/0;for(c=0,T=null;c<u;++c)(h=Cr[c])&&(p=h.site,L=p[0]-o,P=p[1]-e,z=L*L+P*P,z<k&&(k=z,T=h));if(T){var Y=[o,e],q=[o,a],C=[r,a],ot=[r,e];T.halfedges.push(Jn.push(Ls(p=T.site,Y,q))-1,Jn.push(Ls(p,q,C))-1,Jn.push(Ls(p,C,ot))-1,Jn.push(Ls(p,ot,Y))-1)}}for(c=0;c<u;++c)(h=Cr[c])&&(h.halfedges.length||delete Cr[c])}var Ug=[],Uu;function gw(){Rs(this),this.x=this.y=this.arc=this.site=this.cy=null}function Ho(o){var e=o.P,r=o.N;if(!(!e||!r)){var a=e.site,u=o.site,c=r.site;if(a!==c){var h=u[0],p=u[1],d=a[0]-h,g=a[1]-p,v=c[0]-h,x=c[1]-p,M=2*(d*x-g*v);if(!(M>=-Bg)){var w=d*d+g*g,I=v*v+x*x,D=(x*w-g*I)/M,b=(d*I-v*w)/M,T=Ug.pop()||new gw;T.arc=o,T.site=u,T.x=D+h,T.y=(T.cy=b+p)+Math.sqrt(D*D+b*b),o.circle=T;for(var L=null,P=Ds._;P;)if(T.y<P.y||T.y===P.y&&T.x<=P.x)if(P.L)P=P.L;else{L=P.P;break}else if(P.R)P=P.R;else{L=P;break}Ds.insert(L,T),L||(Uu=T)}}}}function qo(o){var e=o.circle;e&&(e.P||(Uu=e.N),Ds.remove(e),Ug.push(e),Rs(e),o.circle=null)}var kg=[];function yw(){Rs(this),this.edge=this.site=this.circle=null}function zg(o){var e=kg.pop()||new yw;return e.site=o,e}function gh(o){qo(o),Wo.remove(o),kg.push(o),Rs(o)}function Gg(o){var e=o.circle,r=e.x,a=e.cy,u=[r,a],c=o.P,h=o.N,p=[o];gh(o);for(var d=c;d.circle&&Math.abs(r-d.circle.x)<Ue&&Math.abs(a-d.circle.cy)<Ue;)c=d.P,p.unshift(d),gh(d),d=c;p.unshift(d),qo(d);for(var g=h;g.circle&&Math.abs(r-g.circle.x)<Ue&&Math.abs(a-g.circle.cy)<Ue;)h=g.N,p.push(g),gh(g),g=h;p.push(g),qo(g);var v=p.length,x;for(x=1;x<v;++x)g=p[x],d=p[x-1],wa(g.edge,d.site,g.site,u);d=p[0],g=p[v-1],g.edge=Ns(d.site,g.site,null,u),Ho(d),Ho(g)}function Vg(o){for(var e=o[0],r=o[1],a,u,c,h,p=Wo._;p;)if(c=Hg(p,r)-e,c>Ue)p=p.L;else if(h=e-vw(p,r),h>Ue){if(!p.R){a=p;break}p=p.R}else{c>-Ue?(a=p.P,u=p):h>-Ue?(a=p,u=p.N):a=u=p;break}Dg(o);var d=zg(o);if(Wo.insert(a,d),!(!a&&!u)){if(a===u){qo(a),u=zg(a.site),Wo.insert(d,u),d.edge=u.edge=Ns(a.site,d.site),Ho(a),Ho(u);return}if(!u){d.edge=Ns(a.site,d.site);return}qo(a),qo(u);var g=a.site,v=g[0],x=g[1],M=o[0]-v,w=o[1]-x,I=u.site,D=I[0]-v,b=I[1]-x,T=2*(M*b-w*D),L=M*M+w*w,P=D*D+b*b,z=[(b*L-w*P)/T+v,(M*P-D*L)/T+x];wa(u.edge,g,I,z),d.edge=Ns(g,o,null,z),u.edge=Ns(o,I,null,z),Ho(a),Ho(u)}}function Hg(o,e){var r=o.site,a=r[0],u=r[1],c=u-e;if(!c)return a;var h=o.P;if(!h)return-1/0;r=h.site;var p=r[0],d=r[1],g=d-e;if(!g)return p;var v=p-a,x=1/c-1/g,M=v/g;return x?(-M+Math.sqrt(M*M-2*x*(v*v/(-2*g)-d+g/2+u-c/2)))/x+a:(a+p)/2}function vw(o,e){var r=o.N;if(r)return Hg(r,e);var a=o.site;return a[1]===e?a[0]:1/0}var Ue=1e-6,Bg=1e-12,Wo,Cr,Ds,Jn;function _w(o,e,r){return(o[0]-r[0])*(e[1]-o[1])-(o[0]-e[0])*(r[1]-o[1])}function xw(o,e){return e[1]-o[1]||e[0]-o[0]}function Bu(o,e){var r=o.sort(xw).pop(),a,u,c;for(Jn=[],Cr=new Array(o.length),Wo=new dh,Ds=new dh;;)if(c=Uu,r&&(!c||r[1]<c.y||r[1]===c.y&&r[0]<c.x))(r[0]!==a||r[1]!==u)&&(Vg(r),a=r[0],u=r[1]),r=o.pop();else if(c)Gg(c.arc);else break;if(Og(),e){var h=+e[0][0],p=+e[0][1],d=+e[1][0],g=+e[1][1];Lg(h,p,d,g),Fg(h,p,d,g)}this.edges=Jn,this.cells=Cr,Wo=Ds=Jn=Cr=null}Bu.prototype={constructor:Bu,polygons:function(){var o=this.edges;return this.cells.map(function(e){var r=e.halfedges.map(function(a){return mh(e,o[a])});return r.data=e.site.data,r})},triangles:function(){var o=[],e=this.edges;return this.cells.forEach(function(r,a){if(p=(c=r.halfedges).length)for(var u=r.site,c,h=-1,p,d,g=e[c[p-1]],v=g.left===u?g.right:g.left;++h<p;)d=v,g=e[c[h]],v=g.left===u?g.right:g.left,d&&v&&a<d.index&&a<v.index&&_w(u,d,v)<0&&o.push([u.data,d.data,v.data])}),o},links:function(){return this.edges.filter(function(o){return o.right}).map(function(o){return{source:o.left.data,target:o.right.data}})},find:function(o,e,r){for(var a=this,u,c=a._found||0,h=a.cells.length,p;!(p=a.cells[c]);)if(++c>=h)return null;var d=o-p.site[0],g=e-p.site[1],v=d*d+g*g;do p=a.cells[u=c],c=null,p.halfedges.forEach(function(x){var M=a.edges[x],w=M.left;if(!((w===p.site||!w)&&!(w=M.right))){var I=o-w[0],D=e-w[1],b=I*I+D*D;b<v&&(v=b,c=w.index)}});while(c!==null);return a._found=u,r==null||v<=r*r?p.site:null}};var Cw=ln(Os(),1);var Rh=ln(Yg(),1);function Ur(){return new Gu}function Gu(){this.reset()}Gu.prototype={constructor:Gu,reset:function(){this.s=this.t=0},add:function(o){$g(ku,o,this.t),$g(this,ku.s,this.s),this.s?this.t+=ku.t:this.s=ku.t},valueOf:function(){return this.s}};var ku=new Gu;function $g(o,e,r){var a=o.s=e+r,u=a-e,c=a-u;o.t=e-c+(r-u)}var Ae=1e-6;var Oe=Math.PI,On=Oe/2,Vu=Oe/4,Bi=Oe*2,Xo=180/Oe,Br=Oe/180,mn=Math.abs,Ai=Math.atan,zr=Math.atan2,xe=Math.cos;var Hu=Math.exp;var Sa=Math.log;var Lt=Math.sin;var ar=Math.sqrt,ba=Math.tan;function _h(o){return o>1?0:o<-1?Oe:Math.acos(o)}function Ir(o){return o>1?On:o<-1?-On:Math.asin(o)}function Ti(){}var Iw=Ur(),bO=Ur();function Yo(o){var e=o[0],r=o[1],a=xe(r);return[a*xe(e),a*Lt(e),Lt(r)]}function Aa(o,e){return[o[1]*e[2]-o[2]*e[1],o[2]*e[0]-o[0]*e[2],o[0]*e[1]-o[1]*e[0]]}function Ta(o){var e=ar(o[0]*o[0]+o[1]*o[1]+o[2]*o[2]);o[0]/=e,o[1]/=e,o[2]/=e}var OO=Ur();function Jg(o,e){return[o>Oe?o-Bi:o<-Oe?o+Bi:o,e]}Jg.invert=Jg;function xh(){var o=[],e;return{point:function(r,a){e.push([r,a])},lineStart:function(){o.push(e=[])},lineEnd:Ti,rejoin:function(){o.length>1&&o.push(o.pop().concat(o.shift()))},result:function(){var r=o;return o=[],e=null,r}}}function Eh(o,e){return mn(o[0]-e[0])<Ae&&mn(o[1]-e[1])<Ae}function qu(o,e,r,a){this.x=o,this.z=e,this.o=r,this.e=a,this.v=!1,this.n=this.p=null}function Mh(o,e,r,a,u){var c=[],h=[],p,d;if(o.forEach(function(I){if(!((D=I.length-1)<=0)){var D,b=I[0],T=I[D],L;if(Eh(b,T)){for(u.lineStart(),p=0;p<D;++p)u.point((b=I[p])[0],b[1]);u.lineEnd();return}c.push(L=new qu(b,I,null,!0)),h.push(L.o=new qu(b,null,L,!1)),c.push(L=new qu(T,I,null,!1)),h.push(L.o=new qu(T,null,L,!0))}}),!!c.length){for(h.sort(e),Kg(c),Kg(h),p=0,d=h.length;p<d;++p)h[p].e=r=!r;for(var g=c[0],v,x;;){for(var M=g,w=!0;M.v;)if((M=M.n)===g)return;v=M.z,u.lineStart();do{if(M.v=M.o.v=!0,M.e){if(w)for(p=0,d=v.length;p<d;++p)u.point((x=v[p])[0],x[1]);else a(M.x,M.n.x,1,u);M=M.n}else{if(w)for(v=M.p.z,p=v.length-1;p>=0;--p)u.point((x=v[p])[0],x[1]);else a(M.x,M.p.x,-1,u);M=M.p}M=M.o,v=M.z,w=!w}while(!M.v);u.lineEnd()}}}function Kg(o){if(e=o.length){for(var e,r=0,a=o[0],u;++r<e;)a.n=u=o[r],u.p=a,a=u;a.n=u=o[0],u.p=a}}function Mo(o,e){return o<e?-1:o>e?1:o>=e?0:NaN}function wh(o){return o.length===1&&(o=Nw(o)),{left:function(e,r,a,u){for(a==null&&(a=0),u==null&&(u=e.length);a<u;){var c=a+u>>>1;o(e[c],r)<0?a=c+1:u=c}return a},right:function(e,r,a,u){for(a==null&&(a=0),u==null&&(u=e.length);a<u;){var c=a+u>>>1;o(e[c],r)>0?u=c:a=c+1}return a}}}function Nw(o){return function(e,r){return Mo(o(e),r)}}var Qg=wh(Mo),Lw=Qg.right,Dw=Qg.left;var jg=Array.prototype,Fw=jg.slice,Uw=jg.map;var T3=Math.sqrt(50),C3=Math.sqrt(10),I3=Math.sqrt(2);function Xu(o){for(var e=o.length,r,a=-1,u=0,c,h;++a<e;)u+=o[a].length;for(c=new Array(u);--e>=0;)for(h=o[e],r=h.length;--r>=0;)c[--u]=h[r];return c}var Ww=1e9,fU=-Ww;var Sh=Ur();function bh(o,e){var r=e[0],a=e[1],u=[Lt(r),-xe(r),0],c=0,h=0;Sh.reset();for(var p=0,d=o.length;p<d;++p)if(v=(g=o[p]).length)for(var g,v,x=g[v-1],M=x[0],w=x[1]/2+Vu,I=Lt(w),D=xe(w),b=0;b<v;++b,M=L,I=z,D=k,x=T){var T=g[b],L=T[0],P=T[1]/2+Vu,z=Lt(P),k=xe(P),Y=L-M,q=Y>=0?1:-1,C=q*Y,ot=C>Oe,pt=I*z;if(Sh.add(zr(pt*q*Lt(C),D*k+pt*xe(C))),c+=ot?Y+q*Bi:Y,ot^M>=r^L>=r){var dt=Aa(Yo(x),Yo(T));Ta(dt);var F=Aa(u,dt);Ta(F);var ye=(ot^Y>=0?-1:1)*Ir(F[2]);(a>ye||a===ye&&(dt[0]||dt[1]))&&(h+=ot^Y>=0?1:-1)}}return(c<-Ae||c<Ae&&Sh<-Ae)^h&1}var MU=Ur();var GU=Ur(),VU=Ur();var $w=1/0;var WU=-$w;function Ah(o){this._context=o}Ah.prototype={_radius:4.5,pointRadius:function(o){return this._radius=o,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(o,e){switch(this._point){case 0:{this._context.moveTo(o,e),this._point=1;break}case 1:{this._context.lineTo(o,e);break}default:{this._context.moveTo(o+this._radius,e),this._context.arc(o,e,this._radius,0,Bi);break}}},result:Ti};var eB=Ur();function Th(){this._string=[]}Th.prototype={_radius:4.5,_circle:n0(4.5),pointRadius:function(o){return(o=+o)!==this._radius&&(this._radius=o,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(o,e){switch(this._point){case 0:{this._string.push("M",o,",",e),this._point=1;break}case 1:{this._string.push("L",o,",",e);break}default:{this._circle==null&&(this._circle=n0(this._radius)),this._string.push("M",o,",",e,this._circle);break}}},result:function(){if(this._string.length){var o=this._string.join("");return this._string=[],o}else return null}};function n0(o){return"m0,"+o+"a"+o+","+o+" 0 1,1 0,"+-2*o+"a"+o+","+o+" 0 1,1 0,"+2*o+"z"}function Ch(o,e,r,a){return function(u,c){var h=e(c),p=u.invert(a[0],a[1]),d=xh(),g=e(d),v=!1,x,M,w,I={point:D,lineStart:T,lineEnd:L,polygonStart:function(){I.point=P,I.lineStart=z,I.lineEnd=k,M=[],x=[]},polygonEnd:function(){I.point=D,I.lineStart=T,I.lineEnd=L,M=Xu(M);var Y=bh(x,p);M.length?(v||(c.polygonStart(),v=!0),Mh(M,Kw,Y,r,c)):Y&&(v||(c.polygonStart(),v=!0),c.lineStart(),r(null,null,1,c),c.lineEnd()),v&&(c.polygonEnd(),v=!1),M=x=null},sphere:function(){c.polygonStart(),c.lineStart(),r(null,null,1,c),c.lineEnd(),c.polygonEnd()}};function D(Y,q){var C=u(Y,q);o(Y=C[0],q=C[1])&&c.point(Y,q)}function b(Y,q){var C=u(Y,q);h.point(C[0],C[1])}function T(){I.point=b,h.lineStart()}function L(){I.point=D,h.lineEnd()}function P(Y,q){w.push([Y,q]);var C=u(Y,q);g.point(C[0],C[1])}function z(){g.lineStart(),w=[]}function k(){P(w[0][0],w[0][1]),g.lineEnd();var Y=g.clean(),q=d.result(),C,ot=q.length,pt,dt,F;if(w.pop(),x.push(w),w=null,!!ot){if(Y&1){if(dt=q[0],(pt=dt.length-1)>0){for(v||(c.polygonStart(),v=!0),c.lineStart(),C=0;C<pt;++C)c.point((F=dt[C])[0],F[1]);c.lineEnd()}return}ot>1&&Y&2&&q.push(q.pop().concat(q.shift())),M.push(q.filter(Jw))}}return I}}function Jw(o){return o.length>1}function Kw(o,e){return((o=o.x)[0]<0?o[1]-On-Ae:On-o[1])-((e=e.x)[0]<0?e[1]-On-Ae:On-e[1])}var Qw=Ch(function(){return!0},jw,eS,[-Oe,-On]);function jw(o){var e=NaN,r=NaN,a=NaN,u;return{lineStart:function(){o.lineStart(),u=1},point:function(c,h){var p=c>0?Oe:-Oe,d=mn(c-e);mn(d-Oe)<Ae?(o.point(e,r=(r+h)/2>0?On:-On),o.point(a,r),o.lineEnd(),o.lineStart(),o.point(p,r),o.point(c,r),u=0):a!==p&&d>=Oe&&(mn(e-a)<Ae&&(e-=a*Ae),mn(c-p)<Ae&&(c-=p*Ae),r=tS(e,r,c,h),o.point(a,r),o.lineEnd(),o.lineStart(),o.point(p,r),u=0),o.point(e=c,r=h),a=p},lineEnd:function(){o.lineEnd(),e=r=NaN},clean:function(){return 2-u}}}function tS(o,e,r,a){var u,c,h=Lt(o-r);return mn(h)>Ae?Ai((Lt(e)*(c=xe(a))*Lt(r)-Lt(a)*(u=xe(e))*Lt(o))/(u*c*h)):(e+a)/2}function eS(o,e,r,a){var u;if(o==null)u=r*On,a.point(-Oe,u),a.point(0,u),a.point(Oe,u),a.point(Oe,0),a.point(Oe,-u),a.point(0,-u),a.point(-Oe,-u),a.point(-Oe,0),a.point(-Oe,u);else if(mn(o[0]-e[0])>Ae){var c=o[0]<e[0]?Oe:-Oe;u=r*c/2,a.point(-c,u),a.point(0,u),a.point(c,u)}else a.point(e[0],e[1])}function Yu(o){return function(e){var r=new Ih;for(var a in o)r[a]=o[a];return r.stream=e,r}}function Ih(){}Ih.prototype={constructor:Ih,point:function(o,e){this.stream.point(o,e)},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 VB=xe(30*Br);var nz=Yu({point:function(o,e){this.stream.point(o*Br,e*Br)}});function $u(o){return function(e,r){var a=xe(e),u=xe(r),c=o(a*u);return[c*u*Lt(e),c*Lt(r)]}}function zi(o){return function(e,r){var a=ar(e*e+r*r),u=o(a),c=Lt(u),h=xe(u);return[zr(e*c,a*h),Ir(a&&r*c/a)]}}var l0=$u(function(o){return ar(2/(1+o))});l0.invert=zi(function(o){return 2*Ir(o/2)});var c0=$u(function(o){return(o=_h(o))&&o/Lt(o)});c0.invert=zi(function(o){return o});function Ph(o,e){return[o,Sa(ba((On+e)/2))]}Ph.invert=function(o,e){return[o,2*Ai(Hu(e))-On]};function Zu(o,e){return[o,e]}Zu.invert=Zu;function h0(o,e){var r=xe(e),a=xe(o)*r;return[r*Lt(o)/a,Lt(e)/a]}h0.invert=zi(Ai);function f0(o,e){var r=e*e,a=r*r;return[o*(.8707-.131979*r+a*(-.013791+a*(.003971*r-.001529*a))),e*(1.007226+r*(.015085+a*(-.044475+.028874*r-.005916*a)))]}f0.invert=function(o,e){var r=e,a=25,u;do{var c=r*r,h=c*c;r-=u=(r*(1.007226+c*(.015085+h*(-.044475+.028874*c-.005916*h)))-e)/(1.007226+c*(.015085*3+h*(-.044475*7+.028874*9*c-.005916*11*h)))}while(mn(u)>Ae&&--a>0);return[o/(.8707+(c=r*r)*(-.131979+c*(-.013791+c*c*c*(.003971-.001529*c)))),r]};function p0(o,e){return[xe(e)*Lt(o),Lt(e)]}p0.invert=zi(Ir);function d0(o,e){var r=xe(e),a=1+xe(o)*r;return[r*Lt(o)/a,Lt(e)/a]}d0.invert=zi(function(o){return 2*Ai(o)});function m0(o,e){return[Sa(ba((On+e)/2)),-o]}m0.invert=function(o,e){return[-e,2*Ai(Hu(o))-On]};var aS=ln(Os(),1);var uS=ln(Os(),1);var cS=ln(Os(),1);var hS=ln(Os(),1);function So(o,e){return Math.sqrt((e[0]-o[0])**2+(e[1]-o[1])**2)}function Nh(o){let e=0;for(let r=0;r<o.length-1;r++)e+=So(o[r],o[r+1]);return e}function y0(o,e,r){let a=new br(e[0]-o[0],e[1]-o[1]),u=new br(e[0]-r[0],e[1]-r[1]),h=a.angleTo(u)*180/Math.PI,p=new br(e[0]-o[0],e[1]-o[1]);return new br(r[0]-o[0],r[1]-o[1]).cross(p)>0?h:-h}var si="___",Ju=class{constructor(e=3){this.lift_priority=e;Wr(this,"roadInfo",[]);Wr(this,"pointMap",new Map);Wr(this,"nodeMap",new Map);Wr(this,"facilityMap",new Map);Wr(this,"straightLadderMap",new Map);Wr(this,"escalatorMap",new Map);Wr(this,"staircaseMap",new Map);Wr(this,"lineMap",new Map);Wr(this,"baseRoute",new ki.default);Wr(this,"escalatorRoute",new ki.default);Wr(this,"straightLadderRoute",new ki.default)}initRoute(e){this.clear(),this.roadInfo=e,e.length&&(e.forEach(r=>{r.points.forEach(a=>{let u=\`\${r.floor}\${si}\${a.id}\`;if(this.pointMap.set(u,a),this.nodeMap.set(\`\${a.floor}\${si}\${a.nodeId}\`,u),a.type==="straightLadder"){let c=this.straightLadderMap.get(a.name)||[];c.push(js({},a)),this.straightLadderMap.set(a.name,c)}if(a.type==="staircase"){let c=this.staircaseMap.get(a.name)||[];c.push(js({},a)),this.staircaseMap.set(a.name,c)}if(a.type==="escalator"){let c=this.escalatorMap.get(a.name)||{};a.escalatorDirection==="exit"?c.end={floor:a.floor,id:a.id}:c.start={floor:a.floor,id:a.id},this.escalatorMap.set(a.name,c)}if(a.type==="facility"){let c=this.facilityMap.get(a.targetId)||[];c.push(js({},a)),this.facilityMap.set(a.targetId,c)}}),r.lines.filter(a=>a.direction!=="no").forEach(a=>{var d,g;let u=\`\${r.floor}\${si}\${a.from}\`,c=\`\${r.floor}\${si}\${a.to}\`,h=(d=this.pointMap.get(u))==null?void 0:d.cds,p=(g=this.pointMap.get(c))==null?void 0:g.cds;if(h!=null&&h.length&&(p!=null&&p.length)){let v=So(h,p);this.addLineItem(u,c,v),a.direction==="double"&&this.addLineItem(c,u,v)}})}),this.initBaseRoute(),this.initEscalatorRoute(),this.initStraightLadderRoute())}addLineItem(e,r,a,u=this.lineMap){let c=u.get(e)||new Map;c.set(r,a),u.set(e,c)}addFacilityToLineMap(e,r,a,u){[...this.straightLadderMap,...this.staircaseMap].forEach(([c,h])=>{var p,d;if(!(h.length<2))for(let g=0;g<h.length;g++){let v=\`\${h[g].floor}\${si}\${h[g].id}\`;for(let x=0;x<h.length;x++)if(g!==x){let M=\`\${h[x].floor}\${si}\${h[x].id}\`,w=(p=this.pointMap.get(v))==null?void 0:p.cds,I=(d=this.pointMap.get(M))==null?void 0:d.cds;if(w!=null&&w.length&&(I!=null&&I.length))if(h[g].type==="straightLadder"){let D=r;this.addLineItem(v,M,D,u)}else{let D=a;this.addLineItem(v,M,D,u)}}}}),this.escalatorMap.forEach((c,h)=>{var p,d;if(c.start&&c.end){let g=\`\${c.start.floor}\${si}\${c.start.id}\`,v=\`\${c.end.floor}\${si}\${c.end.id}\`,x=(p=this.pointMap.get(g))==null?void 0:p.cds,M=(d=this.pointMap.get(v))==null?void 0:d.cds;if(x!=null&&x.length&&(M!=null&&M.length)){let w=e;this.addLineItem(g,v,w,u)}}})}initBaseRoute(){let e=new Map([...this.lineMap]);this.addFacilityToLineMap(1,this.lift_priority,3e4,e),this.baseRoute=new ki.default(e)}initEscalatorRoute(){let e=new Map([...this.lineMap]),r=1e4;this.addFacilityToLineMap(1*r,this.lift_priority*r,3e4*r,e),this.escalatorRoute=new ki.default(e)}initStraightLadderRoute(){let e=new Map([...this.lineMap]),r=1e4;this.addFacilityToLineMap(3*r,1*r,3e4*r,e),this.straightLadderRoute=new ki.default(e)}checkStart(e){return!(!e.floor||!e.nodeId&&(!e.coord||e.coord.length<2))}checkEnd(e){return e.facility?!0:this.checkStart(e)}transformStart(e){var r;if(e.nodeId){let a=this.nodeMap.get(\`\${e.floor}\${si}\${e.nodeId}\`);if(a){let[u,c]=a.split(si);return{floor:u,id:c}}}if((r=e.coord)!=null&&r.length){let a=this.roadInfo.find(c=>c.floor===e.floor);if(!a)return null;let u=a.points.reduce((c,h)=>{let p=So(e.coord,h.cds);return p<c.min&&(c.min=p,c.point=h),c},{min:1/0,point:a.points[0]});return{floor:u.point.floor,id:u.point.id}}return null}transformEnd(e){if(e.floor){let r=this.transformStart(e);if(r)return r}if(e.facility){let r=this.facilityMap.get(e.facility);if(r!=null&&r.length)return{floor:e.floor,facility:e.facility}}return null}getPath(e,r,a=""){if(!this.checkStart(e))return"start-error";if(!this.checkEnd(r))return"end-error";let u=this.transformStart(e);if(!u)return"no-start";let c=this.transformEnd(r);if(!c)return"no-end";let h=this.getBasePath.bind(this);switch(a){case"escalator":h=this.getEscalatorPath.bind(this);break;case"straightLadder":h=this.getStraightLadderPath.bind(this);break;default:h=this.getBasePath.bind(this);break}if(c.id)return h(u,c);if(c.facility){let p=this.facilityMap.get(c.facility).filter(g=>c.floor?g.floor===c.floor:!0);if(!p.length)return null;let d=p.map(g=>h(u,{floor:g.floor,id:g.id})).filter(g=>!!g);return d.reduce((g,v)=>{let x=v.reduce((M,w)=>M+Nh(w.points),0);return x<g.distance&&(g.distance=x,g.path=v),g},{distance:1/0,path:d[0]}).path}}getRoutePath(e,r,a){let u=\`\${e.floor}\${si}\${e.id}\`,c=\`\${r.floor}\${si}\${r.id}\`,h=a.path(u,c);if(!h)return null;let p=[];return h.map(d=>{var v;let g=this.pointMap.get(d);if(g){let{floor:x}=g;if(((v=p[p.length-1])==null?void 0:v.floor)===x){let M=p[p.length-1];M.points.push(g.cds),M.endType=g.type,M.destId=g.nodeId,M.distance=Nh(M.points)}else p.push({floor:x,points:[g.cds],endType:g.type,destId:g.nodeId,distance:0})}}),p}getBasePath(e,r){return this.getRoutePath(e,r,this.baseRoute)}getEscalatorPath(e,r){return this.getRoutePath(e,r,this.escalatorRoute)}getStraightLadderPath(e,r){return this.getRoutePath(e,r,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 ki.default,this.escalatorRoute=new ki.default,this.straightLadderRoute=new ki.default}};var xS=ln(M0(),1);function ES(o,e,r){let a=y0(o,e,r);return 180-Math.abs(a)<15?"front":a>135?"right_front":a<-135?"left_front":a<=135&&a>=60?"right":a>=-135&&a<=-60?"left":a<60&&a>0?"right_back":a>-60&&a<0?"left_back":"front"}function w0(o){if(!o.length)return[];let e=[{direction:"start",distance:So(o[0],o[1]),points:[o[0],o[1]]}];for(let r=2;r<o.length;r++){let a=ES(o[r-2],o[r-1],o[r]);if(a==="front"){let u=e[e.length-1],c=So(o[r-1],o[r]);u.distance+=c,r!==2&&u.points.push(o[r-1])}else e.push({direction:a,distance:So(o[r-1],o[r]),points:[o[r-1],o[r]]})}return e.push({direction:"end",distance:0,points:[o[o.length-1]]}),e}function S0(o){return o.replace(/[A-Z]/g,e=>"_"+e.toLowerCase()).replace(/^_/,"")}function b0(o){let e={};for(let a in o)a.startsWith("on")&&(e[S0(a.slice(2))]=o[a]);let r=async({data:a})=>{if(e[a.type])try{let u=await e[a.type](a.data);self.postMessage({type:\`\${a.type}_result\`,key:a.key,data:u})}catch(u){self.postMessage({type:\`\${a.type}_result\`,key:a.key,error:u})}else self.postMessage({type:\`\${a.type}_result\`,key:a.key,error:"no_event"})};return self.addEventListener("message",r),()=>{self.removeEventListener("message",r)}}var Lh=new Ju;b0({onSetRoadInfo({roadData:o}){Lh.initRoute(o)},onGetPath({start:o,end:e,type:r}){return Lh.getPath(o,e,r)},onGetDirectionPath(o){return w0(o)},onClear(){Lh.clear()}});
7349
+ \`)};function Fu(o,e,r){this.x=o,this.y=e,this.weight=r}Fu.prototype.toString=function(){return"["+this.x+" "+this.y+"]"};Fu.prototype.getCost=function(o){return o&&o.x!==this.x&&o.y!==this.y?this.weight*1.41421:this.weight};Fu.prototype.isWall=function(){return this.weight===0};function Rg(o){this.content=[],this.scoreFunction=o}Rg.prototype={push:function(o){this.content.push(o),this.sinkDown(this.content.length-1)},pop:function(){var o=this.content[0],e=this.content.pop();return this.content.length>0&&(this.content[0]=e,this.bubbleUp(0)),o},remove:function(o){var e=this.content.indexOf(o),r=this.content.pop();e!==this.content.length-1&&(this.content[e]=r,this.scoreFunction(r)<this.scoreFunction(o)?this.sinkDown(e):this.bubbleUp(e))},size:function(){return this.content.length},rescoreElement:function(o){this.sinkDown(this.content.indexOf(o))},sinkDown:function(o){for(var e=this.content[o];o>0;){var r=(o+1>>1)-1,a=this.content[r];if(this.scoreFunction(e)<this.scoreFunction(a))this.content[r]=e,this.content[o]=a,o=r;else break}},bubbleUp:function(o){for(var e=this.content.length,r=this.content[o],a=this.scoreFunction(r);;){var u=o+1<<1,c=u-1,h=null,p;if(c<e){var d=this.content[c];p=this.scoreFunction(d),p<a&&(h=c)}if(u<e){var g=this.content[u],v=this.scoreFunction(g);v<(h===null?a:p)&&(h=u)}if(h!==null)this.content[o]=this.content[h],this.content[h]=r,o=h;else break}}};function ph(){this._=null}function Rs(o){o.U=o.C=o.L=o.R=o.P=o.N=null}ph.prototype={constructor:ph,insert:function(o,e){var r,a,u;if(o){if(e.P=o,e.N=o.N,o.N&&(o.N.P=e),o.N=e,o.R){for(o=o.R;o.L;)o=o.L;o.L=e}else o.R=e;r=o}else this._?(o=Ng(this._),e.P=null,e.N=o,o.P=o.L=e,r=o):(e.P=e.N=null,this._=e,r=null);for(e.L=e.R=null,e.U=r,e.C=!0,o=e;r&&r.C;)a=r.U,r===a.L?(u=a.R,u&&u.C?(r.C=u.C=!1,a.C=!0,o=a):(o===r.R&&(Ea(this,r),o=r,r=o.U),r.C=!1,a.C=!0,Ma(this,a))):(u=a.L,u&&u.C?(r.C=u.C=!1,a.C=!0,o=a):(o===r.L&&(Ma(this,r),o=r,r=o.U),r.C=!1,a.C=!0,Ea(this,a))),r=o.U;this._.C=!1},remove:function(o){o.N&&(o.N.P=o.P),o.P&&(o.P.N=o.N),o.N=o.P=null;var e=o.U,r,a=o.L,u=o.R,c,h;if(a?u?c=Ng(u):c=a:c=u,e?e.L===o?e.L=c:e.R=c:this._=c,a&&u?(h=c.C,c.C=o.C,c.L=a,a.U=c,c!==u?(e=c.U,c.U=o.U,o=c.R,e.L=o,c.R=u,u.U=c):(c.U=e,e=c,o=c.R)):(h=o.C,o=c),o&&(o.U=e),!h){if(o&&o.C){o.C=!1;return}do{if(o===this._)break;if(o===e.L){if(r=e.R,r.C&&(r.C=!1,e.C=!0,Ea(this,e),r=e.R),r.L&&r.L.C||r.R&&r.R.C){(!r.R||!r.R.C)&&(r.L.C=!1,r.C=!0,Ma(this,r),r=e.R),r.C=e.C,e.C=r.R.C=!1,Ea(this,e),o=this._;break}}else if(r=e.L,r.C&&(r.C=!1,e.C=!0,Ma(this,e),r=e.L),r.L&&r.L.C||r.R&&r.R.C){(!r.L||!r.L.C)&&(r.R.C=!1,r.C=!0,Ea(this,r),r=e.L),r.C=e.C,e.C=r.L.C=!1,Ma(this,e),o=this._;break}r.C=!0,o=e,e=e.U}while(!o.C);o&&(o.C=!1)}}};function Ea(o,e){var r=e,a=e.R,u=r.U;u?u.L===r?u.L=a:u.R=a:o._=a,a.U=u,r.U=a,r.R=a.L,r.R&&(r.R.U=r),a.L=r}function Ma(o,e){var r=e,a=e.L,u=r.U;u?u.L===r?u.L=a:u.R=a:o._=a,a.U=u,r.U=a,r.L=a.R,r.L&&(r.L.U=r),a.R=r}function Ng(o){for(;o.L;)o=o.L;return o}var dh=ph;function Ns(o,e,r,a){var u=[null,null],c=Jn.push(u)-1;return u.left=o,u.right=e,r&&wa(u,o,e,r),a&&wa(u,e,o,a),Cr[o.index].halfedges.push(c),Cr[e.index].halfedges.push(c),u}function Ls(o,e,r){var a=[e,r];return a.left=o,a}function wa(o,e,r,a){!o[0]&&!o[1]?(o[0]=a,o.left=e,o.right=r):o.left===r?o[1]=a:o[0]=a}function fw(o,e,r,a,u){var c=o[0],h=o[1],p=c[0],d=c[1],g=h[0],v=h[1],x=0,M=1,w=g-p,I=v-d,D;if(D=e-p,!(!w&&D>0)){if(D/=w,w<0){if(D<x)return;D<M&&(M=D)}else if(w>0){if(D>M)return;D>x&&(x=D)}if(D=a-p,!(!w&&D<0)){if(D/=w,w<0){if(D>M)return;D>x&&(x=D)}else if(w>0){if(D<x)return;D<M&&(M=D)}if(D=r-d,!(!I&&D>0)){if(D/=I,I<0){if(D<x)return;D<M&&(M=D)}else if(I>0){if(D>M)return;D>x&&(x=D)}if(D=u-d,!(!I&&D<0)){if(D/=I,I<0){if(D>M)return;D>x&&(x=D)}else if(I>0){if(D<x)return;D<M&&(M=D)}return!(x>0)&&!(M<1)||(x>0&&(o[0]=[p+x*w,d+x*I]),M<1&&(o[1]=[p+M*w,d+M*I])),!0}}}}}function pw(o,e,r,a,u){var c=o[1];if(c)return!0;var h=o[0],p=o.left,d=o.right,g=p[0],v=p[1],x=d[0],M=d[1],w=(g+x)/2,I=(v+M)/2,D,b;if(M===v){if(w<e||w>=a)return;if(g>x){if(!h)h=[w,r];else if(h[1]>=u)return;c=[w,u]}else{if(!h)h=[w,u];else if(h[1]<r)return;c=[w,r]}}else if(D=(g-x)/(M-v),b=I-D*w,D<-1||D>1)if(g>x){if(!h)h=[(r-b)/D,r];else if(h[1]>=u)return;c=[(u-b)/D,u]}else{if(!h)h=[(u-b)/D,u];else if(h[1]<r)return;c=[(r-b)/D,r]}else if(v<M){if(!h)h=[e,D*e+b];else if(h[0]>=a)return;c=[a,D*a+b]}else{if(!h)h=[a,D*a+b];else if(h[0]<e)return;c=[e,D*e+b]}return o[0]=h,o[1]=c,!0}function Lg(o,e,r,a){for(var u=Jn.length,c;u--;)(!pw(c=Jn[u],o,e,r,a)||!fw(c,o,e,r,a)||!(Math.abs(c[0][0]-c[1][0])>Ue||Math.abs(c[0][1]-c[1][1])>Ue))&&delete Jn[u]}function Dg(o){return Cr[o.index]={site:o,halfedges:[]}}function dw(o,e){var r=o.site,a=e.left,u=e.right;return r===u&&(u=a,a=r),u?Math.atan2(u[1]-a[1],u[0]-a[0]):(r===a?(a=e[1],u=e[0]):(a=e[0],u=e[1]),Math.atan2(a[0]-u[0],u[1]-a[1]))}function mh(o,e){return e[+(e.left!==o.site)]}function mw(o,e){return e[+(e.left===o.site)]}function Og(){for(var o=0,e=Cr.length,r,a,u,c;o<e;++o)if((r=Cr[o])&&(c=(a=r.halfedges).length)){var h=new Array(c),p=new Array(c);for(u=0;u<c;++u)h[u]=u,p[u]=dw(r,Jn[a[u]]);for(h.sort(function(d,g){return p[g]-p[d]}),u=0;u<c;++u)p[u]=a[h[u]];for(u=0;u<c;++u)a[u]=p[u]}}function Fg(o,e,r,a){var u=Cr.length,c,h,p,d,g,v,x,M,w,I,D,b,T=!0;for(c=0;c<u;++c)if(h=Cr[c]){for(p=h.site,g=h.halfedges,d=g.length;d--;)Jn[g[d]]||g.splice(d,1);for(d=0,v=g.length;d<v;)I=mw(h,Jn[g[d]]),D=I[0],b=I[1],x=mh(h,Jn[g[++d%v]]),M=x[0],w=x[1],(Math.abs(D-M)>Ue||Math.abs(b-w)>Ue)&&(g.splice(d,0,Jn.push(Ls(p,I,Math.abs(D-o)<Ue&&a-b>Ue?[o,Math.abs(M-o)<Ue?w:a]:Math.abs(b-a)<Ue&&r-D>Ue?[Math.abs(w-a)<Ue?M:r,a]:Math.abs(D-r)<Ue&&b-e>Ue?[r,Math.abs(M-r)<Ue?w:e]:Math.abs(b-e)<Ue&&D-o>Ue?[Math.abs(w-e)<Ue?M:o,e]:null))-1),++v);v&&(T=!1)}if(T){var L,P,z,k=1/0;for(c=0,T=null;c<u;++c)(h=Cr[c])&&(p=h.site,L=p[0]-o,P=p[1]-e,z=L*L+P*P,z<k&&(k=z,T=h));if(T){var Y=[o,e],q=[o,a],C=[r,a],ot=[r,e];T.halfedges.push(Jn.push(Ls(p=T.site,Y,q))-1,Jn.push(Ls(p,q,C))-1,Jn.push(Ls(p,C,ot))-1,Jn.push(Ls(p,ot,Y))-1)}}for(c=0;c<u;++c)(h=Cr[c])&&(h.halfedges.length||delete Cr[c])}var Ug=[],Uu;function gw(){Rs(this),this.x=this.y=this.arc=this.site=this.cy=null}function Ho(o){var e=o.P,r=o.N;if(!(!e||!r)){var a=e.site,u=o.site,c=r.site;if(a!==c){var h=u[0],p=u[1],d=a[0]-h,g=a[1]-p,v=c[0]-h,x=c[1]-p,M=2*(d*x-g*v);if(!(M>=-Bg)){var w=d*d+g*g,I=v*v+x*x,D=(x*w-g*I)/M,b=(d*I-v*w)/M,T=Ug.pop()||new gw;T.arc=o,T.site=u,T.x=D+h,T.y=(T.cy=b+p)+Math.sqrt(D*D+b*b),o.circle=T;for(var L=null,P=Ds._;P;)if(T.y<P.y||T.y===P.y&&T.x<=P.x)if(P.L)P=P.L;else{L=P.P;break}else if(P.R)P=P.R;else{L=P;break}Ds.insert(L,T),L||(Uu=T)}}}}function qo(o){var e=o.circle;e&&(e.P||(Uu=e.N),Ds.remove(e),Ug.push(e),Rs(e),o.circle=null)}var kg=[];function yw(){Rs(this),this.edge=this.site=this.circle=null}function zg(o){var e=kg.pop()||new yw;return e.site=o,e}function gh(o){qo(o),Wo.remove(o),kg.push(o),Rs(o)}function Gg(o){var e=o.circle,r=e.x,a=e.cy,u=[r,a],c=o.P,h=o.N,p=[o];gh(o);for(var d=c;d.circle&&Math.abs(r-d.circle.x)<Ue&&Math.abs(a-d.circle.cy)<Ue;)c=d.P,p.unshift(d),gh(d),d=c;p.unshift(d),qo(d);for(var g=h;g.circle&&Math.abs(r-g.circle.x)<Ue&&Math.abs(a-g.circle.cy)<Ue;)h=g.N,p.push(g),gh(g),g=h;p.push(g),qo(g);var v=p.length,x;for(x=1;x<v;++x)g=p[x],d=p[x-1],wa(g.edge,d.site,g.site,u);d=p[0],g=p[v-1],g.edge=Ns(d.site,g.site,null,u),Ho(d),Ho(g)}function Vg(o){for(var e=o[0],r=o[1],a,u,c,h,p=Wo._;p;)if(c=Hg(p,r)-e,c>Ue)p=p.L;else if(h=e-vw(p,r),h>Ue){if(!p.R){a=p;break}p=p.R}else{c>-Ue?(a=p.P,u=p):h>-Ue?(a=p,u=p.N):a=u=p;break}Dg(o);var d=zg(o);if(Wo.insert(a,d),!(!a&&!u)){if(a===u){qo(a),u=zg(a.site),Wo.insert(d,u),d.edge=u.edge=Ns(a.site,d.site),Ho(a),Ho(u);return}if(!u){d.edge=Ns(a.site,d.site);return}qo(a),qo(u);var g=a.site,v=g[0],x=g[1],M=o[0]-v,w=o[1]-x,I=u.site,D=I[0]-v,b=I[1]-x,T=2*(M*b-w*D),L=M*M+w*w,P=D*D+b*b,z=[(b*L-w*P)/T+v,(M*P-D*L)/T+x];wa(u.edge,g,I,z),d.edge=Ns(g,o,null,z),u.edge=Ns(o,I,null,z),Ho(a),Ho(u)}}function Hg(o,e){var r=o.site,a=r[0],u=r[1],c=u-e;if(!c)return a;var h=o.P;if(!h)return-1/0;r=h.site;var p=r[0],d=r[1],g=d-e;if(!g)return p;var v=p-a,x=1/c-1/g,M=v/g;return x?(-M+Math.sqrt(M*M-2*x*(v*v/(-2*g)-d+g/2+u-c/2)))/x+a:(a+p)/2}function vw(o,e){var r=o.N;if(r)return Hg(r,e);var a=o.site;return a[1]===e?a[0]:1/0}var Ue=1e-6,Bg=1e-12,Wo,Cr,Ds,Jn;function _w(o,e,r){return(o[0]-r[0])*(e[1]-o[1])-(o[0]-e[0])*(r[1]-o[1])}function xw(o,e){return e[1]-o[1]||e[0]-o[0]}function Bu(o,e){var r=o.sort(xw).pop(),a,u,c;for(Jn=[],Cr=new Array(o.length),Wo=new dh,Ds=new dh;;)if(c=Uu,r&&(!c||r[1]<c.y||r[1]===c.y&&r[0]<c.x))(r[0]!==a||r[1]!==u)&&(Vg(r),a=r[0],u=r[1]),r=o.pop();else if(c)Gg(c.arc);else break;if(Og(),e){var h=+e[0][0],p=+e[0][1],d=+e[1][0],g=+e[1][1];Lg(h,p,d,g),Fg(h,p,d,g)}this.edges=Jn,this.cells=Cr,Wo=Ds=Jn=Cr=null}Bu.prototype={constructor:Bu,polygons:function(){var o=this.edges;return this.cells.map(function(e){var r=e.halfedges.map(function(a){return mh(e,o[a])});return r.data=e.site.data,r})},triangles:function(){var o=[],e=this.edges;return this.cells.forEach(function(r,a){if(p=(c=r.halfedges).length)for(var u=r.site,c,h=-1,p,d,g=e[c[p-1]],v=g.left===u?g.right:g.left;++h<p;)d=v,g=e[c[h]],v=g.left===u?g.right:g.left,d&&v&&a<d.index&&a<v.index&&_w(u,d,v)<0&&o.push([u.data,d.data,v.data])}),o},links:function(){return this.edges.filter(function(o){return o.right}).map(function(o){return{source:o.left.data,target:o.right.data}})},find:function(o,e,r){for(var a=this,u,c=a._found||0,h=a.cells.length,p;!(p=a.cells[c]);)if(++c>=h)return null;var d=o-p.site[0],g=e-p.site[1],v=d*d+g*g;do p=a.cells[u=c],c=null,p.halfedges.forEach(function(x){var M=a.edges[x],w=M.left;if(!((w===p.site||!w)&&!(w=M.right))){var I=o-w[0],D=e-w[1],b=I*I+D*D;b<v&&(v=b,c=w.index)}});while(c!==null);return a._found=u,r==null||v<=r*r?p.site:null}};var Cw=ln(Os(),1);var Rh=ln(Yg(),1);function Ur(){return new Gu}function Gu(){this.reset()}Gu.prototype={constructor:Gu,reset:function(){this.s=this.t=0},add:function(o){$g(ku,o,this.t),$g(this,ku.s,this.s),this.s?this.t+=ku.t:this.s=ku.t},valueOf:function(){return this.s}};var ku=new Gu;function $g(o,e,r){var a=o.s=e+r,u=a-e,c=a-u;o.t=e-c+(r-u)}var Ae=1e-6;var Oe=Math.PI,On=Oe/2,Vu=Oe/4,Bi=Oe*2,Xo=180/Oe,Br=Oe/180,mn=Math.abs,Ai=Math.atan,zr=Math.atan2,xe=Math.cos;var Hu=Math.exp;var Sa=Math.log;var Lt=Math.sin;var ar=Math.sqrt,ba=Math.tan;function _h(o){return o>1?0:o<-1?Oe:Math.acos(o)}function Ir(o){return o>1?On:o<-1?-On:Math.asin(o)}function Ti(){}var Iw=Ur(),bO=Ur();function Yo(o){var e=o[0],r=o[1],a=xe(r);return[a*xe(e),a*Lt(e),Lt(r)]}function Aa(o,e){return[o[1]*e[2]-o[2]*e[1],o[2]*e[0]-o[0]*e[2],o[0]*e[1]-o[1]*e[0]]}function Ta(o){var e=ar(o[0]*o[0]+o[1]*o[1]+o[2]*o[2]);o[0]/=e,o[1]/=e,o[2]/=e}var OO=Ur();function Jg(o,e){return[o>Oe?o-Bi:o<-Oe?o+Bi:o,e]}Jg.invert=Jg;function xh(){var o=[],e;return{point:function(r,a){e.push([r,a])},lineStart:function(){o.push(e=[])},lineEnd:Ti,rejoin:function(){o.length>1&&o.push(o.pop().concat(o.shift()))},result:function(){var r=o;return o=[],e=null,r}}}function Eh(o,e){return mn(o[0]-e[0])<Ae&&mn(o[1]-e[1])<Ae}function qu(o,e,r,a){this.x=o,this.z=e,this.o=r,this.e=a,this.v=!1,this.n=this.p=null}function Mh(o,e,r,a,u){var c=[],h=[],p,d;if(o.forEach(function(I){if(!((D=I.length-1)<=0)){var D,b=I[0],T=I[D],L;if(Eh(b,T)){for(u.lineStart(),p=0;p<D;++p)u.point((b=I[p])[0],b[1]);u.lineEnd();return}c.push(L=new qu(b,I,null,!0)),h.push(L.o=new qu(b,null,L,!1)),c.push(L=new qu(T,I,null,!1)),h.push(L.o=new qu(T,null,L,!0))}}),!!c.length){for(h.sort(e),Kg(c),Kg(h),p=0,d=h.length;p<d;++p)h[p].e=r=!r;for(var g=c[0],v,x;;){for(var M=g,w=!0;M.v;)if((M=M.n)===g)return;v=M.z,u.lineStart();do{if(M.v=M.o.v=!0,M.e){if(w)for(p=0,d=v.length;p<d;++p)u.point((x=v[p])[0],x[1]);else a(M.x,M.n.x,1,u);M=M.n}else{if(w)for(v=M.p.z,p=v.length-1;p>=0;--p)u.point((x=v[p])[0],x[1]);else a(M.x,M.p.x,-1,u);M=M.p}M=M.o,v=M.z,w=!w}while(!M.v);u.lineEnd()}}}function Kg(o){if(e=o.length){for(var e,r=0,a=o[0],u;++r<e;)a.n=u=o[r],u.p=a,a=u;a.n=u=o[0],u.p=a}}function Mo(o,e){return o<e?-1:o>e?1:o>=e?0:NaN}function wh(o){return o.length===1&&(o=Nw(o)),{left:function(e,r,a,u){for(a==null&&(a=0),u==null&&(u=e.length);a<u;){var c=a+u>>>1;o(e[c],r)<0?a=c+1:u=c}return a},right:function(e,r,a,u){for(a==null&&(a=0),u==null&&(u=e.length);a<u;){var c=a+u>>>1;o(e[c],r)>0?u=c:a=c+1}return a}}}function Nw(o){return function(e,r){return Mo(o(e),r)}}var Qg=wh(Mo),Lw=Qg.right,Dw=Qg.left;var jg=Array.prototype,Fw=jg.slice,Uw=jg.map;var T3=Math.sqrt(50),C3=Math.sqrt(10),I3=Math.sqrt(2);function Xu(o){for(var e=o.length,r,a=-1,u=0,c,h;++a<e;)u+=o[a].length;for(c=new Array(u);--e>=0;)for(h=o[e],r=h.length;--r>=0;)c[--u]=h[r];return c}var Ww=1e9,fU=-Ww;var Sh=Ur();function bh(o,e){var r=e[0],a=e[1],u=[Lt(r),-xe(r),0],c=0,h=0;Sh.reset();for(var p=0,d=o.length;p<d;++p)if(v=(g=o[p]).length)for(var g,v,x=g[v-1],M=x[0],w=x[1]/2+Vu,I=Lt(w),D=xe(w),b=0;b<v;++b,M=L,I=z,D=k,x=T){var T=g[b],L=T[0],P=T[1]/2+Vu,z=Lt(P),k=xe(P),Y=L-M,q=Y>=0?1:-1,C=q*Y,ot=C>Oe,pt=I*z;if(Sh.add(zr(pt*q*Lt(C),D*k+pt*xe(C))),c+=ot?Y+q*Bi:Y,ot^M>=r^L>=r){var dt=Aa(Yo(x),Yo(T));Ta(dt);var F=Aa(u,dt);Ta(F);var ye=(ot^Y>=0?-1:1)*Ir(F[2]);(a>ye||a===ye&&(dt[0]||dt[1]))&&(h+=ot^Y>=0?1:-1)}}return(c<-Ae||c<Ae&&Sh<-Ae)^h&1}var MU=Ur();var GU=Ur(),VU=Ur();var $w=1/0;var WU=-$w;function Ah(o){this._context=o}Ah.prototype={_radius:4.5,pointRadius:function(o){return this._radius=o,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(o,e){switch(this._point){case 0:{this._context.moveTo(o,e),this._point=1;break}case 1:{this._context.lineTo(o,e);break}default:{this._context.moveTo(o+this._radius,e),this._context.arc(o,e,this._radius,0,Bi);break}}},result:Ti};var eB=Ur();function Th(){this._string=[]}Th.prototype={_radius:4.5,_circle:n0(4.5),pointRadius:function(o){return(o=+o)!==this._radius&&(this._radius=o,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(o,e){switch(this._point){case 0:{this._string.push("M",o,",",e),this._point=1;break}case 1:{this._string.push("L",o,",",e);break}default:{this._circle==null&&(this._circle=n0(this._radius)),this._string.push("M",o,",",e,this._circle);break}}},result:function(){if(this._string.length){var o=this._string.join("");return this._string=[],o}else return null}};function n0(o){return"m0,"+o+"a"+o+","+o+" 0 1,1 0,"+-2*o+"a"+o+","+o+" 0 1,1 0,"+2*o+"z"}function Ch(o,e,r,a){return function(u,c){var h=e(c),p=u.invert(a[0],a[1]),d=xh(),g=e(d),v=!1,x,M,w,I={point:D,lineStart:T,lineEnd:L,polygonStart:function(){I.point=P,I.lineStart=z,I.lineEnd=k,M=[],x=[]},polygonEnd:function(){I.point=D,I.lineStart=T,I.lineEnd=L,M=Xu(M);var Y=bh(x,p);M.length?(v||(c.polygonStart(),v=!0),Mh(M,Kw,Y,r,c)):Y&&(v||(c.polygonStart(),v=!0),c.lineStart(),r(null,null,1,c),c.lineEnd()),v&&(c.polygonEnd(),v=!1),M=x=null},sphere:function(){c.polygonStart(),c.lineStart(),r(null,null,1,c),c.lineEnd(),c.polygonEnd()}};function D(Y,q){var C=u(Y,q);o(Y=C[0],q=C[1])&&c.point(Y,q)}function b(Y,q){var C=u(Y,q);h.point(C[0],C[1])}function T(){I.point=b,h.lineStart()}function L(){I.point=D,h.lineEnd()}function P(Y,q){w.push([Y,q]);var C=u(Y,q);g.point(C[0],C[1])}function z(){g.lineStart(),w=[]}function k(){P(w[0][0],w[0][1]),g.lineEnd();var Y=g.clean(),q=d.result(),C,ot=q.length,pt,dt,F;if(w.pop(),x.push(w),w=null,!!ot){if(Y&1){if(dt=q[0],(pt=dt.length-1)>0){for(v||(c.polygonStart(),v=!0),c.lineStart(),C=0;C<pt;++C)c.point((F=dt[C])[0],F[1]);c.lineEnd()}return}ot>1&&Y&2&&q.push(q.pop().concat(q.shift())),M.push(q.filter(Jw))}}return I}}function Jw(o){return o.length>1}function Kw(o,e){return((o=o.x)[0]<0?o[1]-On-Ae:On-o[1])-((e=e.x)[0]<0?e[1]-On-Ae:On-e[1])}var Qw=Ch(function(){return!0},jw,eS,[-Oe,-On]);function jw(o){var e=NaN,r=NaN,a=NaN,u;return{lineStart:function(){o.lineStart(),u=1},point:function(c,h){var p=c>0?Oe:-Oe,d=mn(c-e);mn(d-Oe)<Ae?(o.point(e,r=(r+h)/2>0?On:-On),o.point(a,r),o.lineEnd(),o.lineStart(),o.point(p,r),o.point(c,r),u=0):a!==p&&d>=Oe&&(mn(e-a)<Ae&&(e-=a*Ae),mn(c-p)<Ae&&(c-=p*Ae),r=tS(e,r,c,h),o.point(a,r),o.lineEnd(),o.lineStart(),o.point(p,r),u=0),o.point(e=c,r=h),a=p},lineEnd:function(){o.lineEnd(),e=r=NaN},clean:function(){return 2-u}}}function tS(o,e,r,a){var u,c,h=Lt(o-r);return mn(h)>Ae?Ai((Lt(e)*(c=xe(a))*Lt(r)-Lt(a)*(u=xe(e))*Lt(o))/(u*c*h)):(e+a)/2}function eS(o,e,r,a){var u;if(o==null)u=r*On,a.point(-Oe,u),a.point(0,u),a.point(Oe,u),a.point(Oe,0),a.point(Oe,-u),a.point(0,-u),a.point(-Oe,-u),a.point(-Oe,0),a.point(-Oe,u);else if(mn(o[0]-e[0])>Ae){var c=o[0]<e[0]?Oe:-Oe;u=r*c/2,a.point(-c,u),a.point(0,u),a.point(c,u)}else a.point(e[0],e[1])}function Yu(o){return function(e){var r=new Ih;for(var a in o)r[a]=o[a];return r.stream=e,r}}function Ih(){}Ih.prototype={constructor:Ih,point:function(o,e){this.stream.point(o,e)},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 VB=xe(30*Br);var nz=Yu({point:function(o,e){this.stream.point(o*Br,e*Br)}});function $u(o){return function(e,r){var a=xe(e),u=xe(r),c=o(a*u);return[c*u*Lt(e),c*Lt(r)]}}function zi(o){return function(e,r){var a=ar(e*e+r*r),u=o(a),c=Lt(u),h=xe(u);return[zr(e*c,a*h),Ir(a&&r*c/a)]}}var l0=$u(function(o){return ar(2/(1+o))});l0.invert=zi(function(o){return 2*Ir(o/2)});var c0=$u(function(o){return(o=_h(o))&&o/Lt(o)});c0.invert=zi(function(o){return o});function Ph(o,e){return[o,Sa(ba((On+e)/2))]}Ph.invert=function(o,e){return[o,2*Ai(Hu(e))-On]};function Zu(o,e){return[o,e]}Zu.invert=Zu;function h0(o,e){var r=xe(e),a=xe(o)*r;return[r*Lt(o)/a,Lt(e)/a]}h0.invert=zi(Ai);function f0(o,e){var r=e*e,a=r*r;return[o*(.8707-.131979*r+a*(-.013791+a*(.003971*r-.001529*a))),e*(1.007226+r*(.015085+a*(-.044475+.028874*r-.005916*a)))]}f0.invert=function(o,e){var r=e,a=25,u;do{var c=r*r,h=c*c;r-=u=(r*(1.007226+c*(.015085+h*(-.044475+.028874*c-.005916*h)))-e)/(1.007226+c*(.015085*3+h*(-.044475*7+.028874*9*c-.005916*11*h)))}while(mn(u)>Ae&&--a>0);return[o/(.8707+(c=r*r)*(-.131979+c*(-.013791+c*c*c*(.003971-.001529*c)))),r]};function p0(o,e){return[xe(e)*Lt(o),Lt(e)]}p0.invert=zi(Ir);function d0(o,e){var r=xe(e),a=1+xe(o)*r;return[r*Lt(o)/a,Lt(e)/a]}d0.invert=zi(function(o){return 2*Ai(o)});function m0(o,e){return[Sa(ba((On+e)/2)),-o]}m0.invert=function(o,e){return[-e,2*Ai(Hu(o))-On]};var aS=ln(Os(),1);var uS=ln(Os(),1);var cS=ln(Os(),1);var hS=ln(Os(),1);function So(o,e){return Math.sqrt((e[0]-o[0])**2+(e[1]-o[1])**2)}function Nh(o){let e=0;for(let r=0;r<o.length-1;r++)e+=So(o[r],o[r+1]);return e}function y0(o,e,r){let a=new br(e[0]-o[0],e[1]-o[1]),u=new br(e[0]-r[0],e[1]-r[1]),h=a.angleTo(u)*180/Math.PI,p=new br(e[0]-o[0],e[1]-o[1]);return new br(r[0]-o[0],r[1]-o[1]).cross(p)>0?h:-h}var si="___",Ju=class{constructor(e=3){this.lift_priority=e;Wr(this,"roadInfo",[]);Wr(this,"pointMap",new Map);Wr(this,"nodeMap",new Map);Wr(this,"facilityMap",new Map);Wr(this,"straightLadderMap",new Map);Wr(this,"escalatorMap",new Map);Wr(this,"staircaseMap",new Map);Wr(this,"lineMap",new Map);Wr(this,"baseRoute",new ki.default);Wr(this,"escalatorRoute",new ki.default);Wr(this,"straightLadderRoute",new ki.default)}initRoute(e){this.clear(),this.roadInfo=e,e.length&&(e.forEach(r=>{r.points.forEach(a=>{let u=\`\${r.floor}\${si}\${a.id}\`;if(this.pointMap.set(u,a),this.nodeMap.set(\`\${a.floor}\${si}\${a.nodeId}\`,u),a.type==="straightLadder"){let c=this.straightLadderMap.get(a.name)||[];c.push(js({},a)),this.straightLadderMap.set(a.name,c)}if(a.type==="staircase"){let c=this.staircaseMap.get(a.name)||[];c.push(js({},a)),this.staircaseMap.set(a.name,c)}if(a.type==="escalator"){let c=this.escalatorMap.get(a.name)||{};a.escalatorDirection==="exit"?c.end={floor:a.floor,id:a.id}:c.start={floor:a.floor,id:a.id},this.escalatorMap.set(a.name,c)}if(a.type==="facility"){let c=this.facilityMap.get(a.targetId)||[];c.push(js({},a)),this.facilityMap.set(a.targetId,c)}}),r.lines.filter(a=>a.direction!=="no").forEach(a=>{var d,g;let u=\`\${r.floor}\${si}\${a.from}\`,c=\`\${r.floor}\${si}\${a.to}\`,h=(d=this.pointMap.get(u))==null?void 0:d.cds,p=(g=this.pointMap.get(c))==null?void 0:g.cds;if(h!=null&&h.length&&(p!=null&&p.length)){let v=So(h,p);this.addLineItem(u,c,v),a.direction==="double"&&this.addLineItem(c,u,v)}})}),this.initBaseRoute(),this.initEscalatorRoute(),this.initStraightLadderRoute())}addLineItem(e,r,a,u=this.lineMap){let c=u.get(e)||new Map;c.set(r,a),u.set(e,c)}addFacilityToLineMap(e,r,a,u){[...this.straightLadderMap,...this.staircaseMap].forEach(([c,h])=>{var p,d;if(!(h.length<2))for(let g=0;g<h.length;g++){let v=\`\${h[g].floor}\${si}\${h[g].id}\`;for(let x=0;x<h.length;x++)if(g!==x){let M=\`\${h[x].floor}\${si}\${h[x].id}\`,w=(p=this.pointMap.get(v))==null?void 0:p.cds,I=(d=this.pointMap.get(M))==null?void 0:d.cds;if(w!=null&&w.length&&(I!=null&&I.length))if(h[g].type==="straightLadder"){let D=r;this.addLineItem(v,M,D,u)}else{let D=a;this.addLineItem(v,M,D,u)}}}}),this.escalatorMap.forEach((c,h)=>{var p,d;if(c.start&&c.end){let g=\`\${c.start.floor}\${si}\${c.start.id}\`,v=\`\${c.end.floor}\${si}\${c.end.id}\`,x=(p=this.pointMap.get(g))==null?void 0:p.cds,M=(d=this.pointMap.get(v))==null?void 0:d.cds;if(x!=null&&x.length&&(M!=null&&M.length)){let w=e;this.addLineItem(g,v,w,u)}}})}initBaseRoute(){let e=new Map([...this.lineMap]);this.addFacilityToLineMap(1,this.lift_priority,3e4,e),this.baseRoute=new ki.default(e)}initEscalatorRoute(){let e=new Map([...this.lineMap]),r=1e4;this.addFacilityToLineMap(1*r,this.lift_priority*r,3e4*r,e),this.escalatorRoute=new ki.default(e)}initStraightLadderRoute(){let e=new Map([...this.lineMap]),r=1e4;this.addFacilityToLineMap(3*r,1*r,3e4*r,e),this.straightLadderRoute=new ki.default(e)}checkStart(e){return!(!e.floor||!e.nodeId&&(!e.coord||e.coord.length<2))}checkEnd(e){return e.facility?!0:this.checkStart(e)}transformStart(e){var r;if(e.nodeId){let a=this.nodeMap.get(\`\${e.floor}\${si}\${e.nodeId}\`);if(a){let[u,c]=a.split(si);return{floor:u,id:c}}}if((r=e.coord)!=null&&r.length){let a=this.roadInfo.find(c=>c.floor===e.floor);if(!a)return null;let u=a.points.reduce((c,h)=>{let p=So(e.coord,h.cds);return p<c.min&&(c.min=p,c.point=h),c},{min:1/0,point:a.points[0]});return{floor:u.point.floor,id:u.point.id}}return null}transformEnd(e){if(e.floor){let r=this.transformStart(e);if(r)return r}if(e.facility){let r=this.facilityMap.get(e.facility);if(r!=null&&r.length)return{floor:e.floor,facility:e.facility}}return null}getPath(e,r,a=""){if(!this.checkStart(e))return"start-error";if(!this.checkEnd(r))return"end-error";let u=this.transformStart(e);if(!u)return"no-start";let c=this.transformEnd(r);if(!c)return"no-end";let h=this.getBasePath.bind(this);switch(a){case"escalator":h=this.getEscalatorPath.bind(this);break;case"straightLadder":h=this.getStraightLadderPath.bind(this);break;default:h=this.getBasePath.bind(this);break}if(c.id)return h(u,c);if(c.facility){let p=this.facilityMap.get(c.facility).filter(g=>c.floor?g.floor===c.floor:!0);if(!p.length)return null;let d=p.map(g=>h(u,{floor:g.floor,id:g.id})).filter(g=>!!g);return d.reduce((g,v)=>{let x=v.reduce((M,w)=>M+Nh(w.points),0);return x<g.distance&&(g.distance=x,g.path=v),g},{distance:1/0,path:d[0]}).path}}getRoutePath(e,r,a){let u=\`\${e.floor}\${si}\${e.id}\`,c=\`\${r.floor}\${si}\${r.id}\`,h=a.path(u,c);if(!h)return null;let p=[];return h.map(d=>{var v;let g=this.pointMap.get(d);if(g){let{floor:x}=g;if(((v=p[p.length-1])==null?void 0:v.floor)===x){let M=p[p.length-1];M.points.push(g.cds),M.endType=g.type,M.destId=g.nodeId,M.distance=Nh(M.points)}else p.push({floor:x,points:[g.cds],endType:g.type,destId:g.nodeId,distance:0})}}),p}getBasePath(e,r){return this.getRoutePath(e,r,this.baseRoute)}getEscalatorPath(e,r){return this.getRoutePath(e,r,this.escalatorRoute)}getStraightLadderPath(e,r){return this.getRoutePath(e,r,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 ki.default,this.escalatorRoute=new ki.default,this.straightLadderRoute=new ki.default}};var xS=ln(M0(),1);function ES(o,e,r){let a=y0(o,e,r);return 180-Math.abs(a)<15?"front":a>135?"right_front":a<-135?"left_front":a<=135&&a>=60?"right":a>=-135&&a<=-60?"left":a<60&&a>0?"right_back":a>-60&&a<0?"left_back":"front"}function w0(o){if(!o.length)return[];if(o.length===1)return[{direction:"start",distance:0,points:o}];let e=[{direction:"start",distance:So(o[0],o[1]),points:[o[0],o[1]]}];for(let r=2;r<o.length;r++){let a=ES(o[r-2],o[r-1],o[r]);if(a==="front"){let u=e[e.length-1],c=So(o[r-1],o[r]);u.distance+=c,r!==2&&u.points.push(o[r-1])}else e.push({direction:a,distance:So(o[r-1],o[r]),points:[o[r-1],o[r]]})}return e.push({direction:"end",distance:0,points:[o[o.length-1]]}),e}function S0(o){return o.replace(/[A-Z]/g,e=>"_"+e.toLowerCase()).replace(/^_/,"")}function b0(o){let e={};for(let a in o)a.startsWith("on")&&(e[S0(a.slice(2))]=o[a]);let r=async({data:a})=>{if(e[a.type])try{let u=await e[a.type](a.data);self.postMessage({type:\`\${a.type}_result\`,key:a.key,data:u})}catch(u){self.postMessage({type:\`\${a.type}_result\`,key:a.key,error:u})}else self.postMessage({type:\`\${a.type}_result\`,key:a.key,error:"no_event"})};return self.addEventListener("message",r),()=>{self.removeEventListener("message",r)}}var Lh=new Ju;b0({onSetRoadInfo({roadData:o}){Lh.initRoute(o)},onGetPath({start:o,end:e,type:r}){return Lh.getPath(o,e,r)},onGetDirectionPath(o){return w0(o)},onClear(){Lh.clear()}});
7350
7350
  /*! Bundled license information:
7351
7351
 
7352
7352
  object-assign/index.js: