@mappedin/mappedin-js 6.0.1-alpha.35 → 6.0.1-alpha.36

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,7 +1,7 @@
1
- import{h as Dc,i as p1,j as zs}from"./chunk-46QN2SP2.js";import{a as je}from"./chunk-EIKEXEHK.js";import{A as Um,B as zm,C as qm,D as j,E as Te,F as $m,G as pr,Ga as gn,H as fn,I as we,J as wt,Ja as Us,Ka as u1,L as kr,M as Io,Na as c1,O as Ut,P as Jm,Q as Eo,Qa as Rr,R as Km,S as Qm,T as t1,U as mn,X as e1,Y as r1,Z as js,a as Ys,c as wo,ca as i1,d as He,fa as Ws,ga as Zs,ha as n1,ja as yi,m as Wm,n as Zm,pa as o1,qa as Nr,ra as _c,sa as a1,ta as Xe,u as mi,ua as Ye,va as s1,w as it,wa as l1,x as Z,ya as yn}from"./chunk-S7G7ETEN.js";import{a as l,b as k,d as Ar,e as v,f as c,g as P,h as E,i as W,j as d,k as b}from"./chunk-CMHVARHO.js";var S1=k((Yc,jc)=>{d();(function(r,t){typeof Yc=="object"&&typeof jc<"u"?jc.exports=t():typeof define=="function"&&define.amd?define(t):(r=r||self).RBush=t()})(Yc,function(){"use strict";function r(g,C,I,w,T){l(function L(D,R,F,N,H){for(;N>F;){if(N-F>600){var X=N-F+1,$=R-F+1,ct=Math.log(X),yt=.5*Math.exp(2*ct/3),bt=.5*Math.sqrt(ct*yt*(X-yt)/X)*($-X/2<0?-1:1),kt=Math.max(F,Math.floor(R-$*yt/X+bt)),Me=Math.min(N,Math.floor(R+(X-$)*yt/X+bt));L(D,R,kt,Me,H)}var Ft=D[R],ht=F,xt=N;for(t(D,F,R),H(D[N],Ft)>0&&t(D,F,N);ht<xt;){for(t(D,ht,xt),ht++,xt--;H(D[ht],Ft)<0;)ht++;for(;H(D[xt],Ft)>0;)xt--}H(D[F],Ft)===0?t(D,F,xt):t(D,++xt,N),xt<=R&&(F=xt+1),R<=xt&&(N=xt-1)}},"t")(g,C,I||0,w||g.length-1,T||e)}l(r,"t");function t(g,C,I){var w=g[C];g[C]=g[I],g[I]=w}l(t,"i");function e(g,C){return g<C?-1:g>C?1:0}l(e,"n");var i=l(function(g){g===void 0&&(g=9),this._maxEntries=Math.max(4,g),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()},"r");function n(g,C,I){if(!I)return C.indexOf(g);for(var w=0;w<C.length;w++)if(I(g,C[w]))return w;return-1}l(n,"e");function o(g,C){a(g,0,g.children.length,C,g)}l(o,"a");function a(g,C,I,w,T){T||(T=S(null)),T.minX=1/0,T.minY=1/0,T.maxX=-1/0,T.maxY=-1/0;for(var L=C;L<I;L++){var D=g.children[L];u(T,g.leaf?w(D):D)}return T}l(a,"h");function u(g,C){return g.minX=Math.min(g.minX,C.minX),g.minY=Math.min(g.minY,C.minY),g.maxX=Math.max(g.maxX,C.maxX),g.maxY=Math.max(g.maxY,C.maxY),g}l(u,"o");function s(g,C){return g.minX-C.minX}l(s,"s");function p(g,C){return g.minY-C.minY}l(p,"l");function f(g){return(g.maxX-g.minX)*(g.maxY-g.minY)}l(f,"f");function m(g){return g.maxX-g.minX+(g.maxY-g.minY)}l(m,"u");function y(g,C){return g.minX<=C.minX&&g.minY<=C.minY&&C.maxX<=g.maxX&&C.maxY<=g.maxY}l(y,"m");function x(g,C){return C.minX<=g.maxX&&C.minY<=g.maxY&&C.maxX>=g.minX&&C.maxY>=g.minY}l(x,"c");function S(g){return{children:g,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}l(S,"p");function M(g,C,I,w,T){for(var L=[C,I];L.length;)if(!((I=L.pop())-(C=L.pop())<=w)){var D=C+Math.ceil((I-C)/w/2)*w;r(g,D,C,I,T),L.push(C,D,D,I)}}return l(M,"d"),i.prototype.all=function(){return this._all(this.data,[])},i.prototype.search=function(g){var C=this.data,I=[];if(!x(g,C))return I;for(var w=this.toBBox,T=[];C;){for(var L=0;L<C.children.length;L++){var D=C.children[L],R=C.leaf?w(D):D;x(g,R)&&(C.leaf?I.push(D):y(g,R)?this._all(D,I):T.push(D))}C=T.pop()}return I},i.prototype.collides=function(g){var C=this.data;if(!x(g,C))return!1;for(var I=[];C;){for(var w=0;w<C.children.length;w++){var T=C.children[w],L=C.leaf?this.toBBox(T):T;if(x(g,L)){if(C.leaf||y(g,L))return!0;I.push(T)}}C=I.pop()}return!1},i.prototype.load=function(g){if(!g||!g.length)return this;if(g.length<this._minEntries){for(var C=0;C<g.length;C++)this.insert(g[C]);return this}var I=this._build(g.slice(),0,g.length-1,0);if(this.data.children.length)if(this.data.height===I.height)this._splitRoot(this.data,I);else{if(this.data.height<I.height){var w=this.data;this.data=I,I=w}this._insert(I,this.data.height-I.height-1,!0)}else this.data=I;return this},i.prototype.insert=function(g){return g&&this._insert(g,this.data.height-1),this},i.prototype.clear=function(){return this.data=S([]),this},i.prototype.remove=function(g,C){if(!g)return this;for(var I,w,T,L=this.data,D=this.toBBox(g),R=[],F=[];L||R.length;){if(L||(L=R.pop(),w=R[R.length-1],I=F.pop(),T=!0),L.leaf){var N=n(g,L.children,C);if(N!==-1)return L.children.splice(N,1),R.push(L),this._condense(R),this}T||L.leaf||!y(L,D)?w?(I++,L=w.children[I],T=!1):L=null:(R.push(L),F.push(I),I=0,w=L,L=L.children[0])}return this},i.prototype.toBBox=function(g){return g},i.prototype.compareMinX=function(g,C){return g.minX-C.minX},i.prototype.compareMinY=function(g,C){return g.minY-C.minY},i.prototype.toJSON=function(){return this.data},i.prototype.fromJSON=function(g){return this.data=g,this},i.prototype._all=function(g,C){for(var I=[];g;)g.leaf?C.push.apply(C,g.children):I.push.apply(I,g.children),g=I.pop();return C},i.prototype._build=function(g,C,I,w){var T,L=I-C+1,D=this._maxEntries;if(L<=D)return o(T=S(g.slice(C,I+1)),this.toBBox),T;w||(w=Math.ceil(Math.log(L)/Math.log(D)),D=Math.ceil(L/Math.pow(D,w-1))),(T=S([])).leaf=!1,T.height=w;var R=Math.ceil(L/D),F=R*Math.ceil(Math.sqrt(D));M(g,C,I,F,this.compareMinX);for(var N=C;N<=I;N+=F){var H=Math.min(N+F-1,I);M(g,N,H,R,this.compareMinY);for(var X=N;X<=H;X+=R){var $=Math.min(X+R-1,H);T.children.push(this._build(g,X,$,w-1))}}return o(T,this.toBBox),T},i.prototype._chooseSubtree=function(g,C,I,w){for(;w.push(C),!C.leaf&&w.length-1!==I;){for(var T=1/0,L=1/0,D=void 0,R=0;R<C.children.length;R++){var F=C.children[R],N=f(F),H=(X=g,$=F,(Math.max($.maxX,X.maxX)-Math.min($.minX,X.minX))*(Math.max($.maxY,X.maxY)-Math.min($.minY,X.minY))-N);H<L?(L=H,T=N<T?N:T,D=F):H===L&&N<T&&(T=N,D=F)}C=D||C.children[0]}var X,$;return C},i.prototype._insert=function(g,C,I){var w=I?g:this.toBBox(g),T=[],L=this._chooseSubtree(w,this.data,C,T);for(L.children.push(g),u(L,w);C>=0&&T[C].children.length>this._maxEntries;)this._split(T,C),C--;this._adjustParentBBoxes(w,T,C)},i.prototype._split=function(g,C){var I=g[C],w=I.children.length,T=this._minEntries;this._chooseSplitAxis(I,T,w);var L=this._chooseSplitIndex(I,T,w),D=S(I.children.splice(L,I.children.length-L));D.height=I.height,D.leaf=I.leaf,o(I,this.toBBox),o(D,this.toBBox),C?g[C-1].children.push(D):this._splitRoot(I,D)},i.prototype._splitRoot=function(g,C){this.data=S([g,C]),this.data.height=g.height+1,this.data.leaf=!1,o(this.data,this.toBBox)},i.prototype._chooseSplitIndex=function(g,C,I){for(var w,T,L,D,R,F,N,H=1/0,X=1/0,$=C;$<=I-C;$++){var ct=a(g,0,$,this.toBBox),yt=a(g,$,I,this.toBBox),bt=(T=ct,L=yt,D=void 0,R=void 0,F=void 0,N=void 0,D=Math.max(T.minX,L.minX),R=Math.max(T.minY,L.minY),F=Math.min(T.maxX,L.maxX),N=Math.min(T.maxY,L.maxY),Math.max(0,F-D)*Math.max(0,N-R)),kt=f(ct)+f(yt);bt<H?(H=bt,w=$,X=kt<X?kt:X):bt===H&&kt<X&&(X=kt,w=$)}return w||I-C},i.prototype._chooseSplitAxis=function(g,C,I){var w=g.leaf?this.compareMinX:s,T=g.leaf?this.compareMinY:p;this._allDistMargin(g,C,I,w)<this._allDistMargin(g,C,I,T)&&g.children.sort(w)},i.prototype._allDistMargin=function(g,C,I,w){g.children.sort(w);for(var T=this.toBBox,L=a(g,0,C,T),D=a(g,I-C,I,T),R=m(L)+m(D),F=C;F<I-C;F++){var N=g.children[F];u(L,g.leaf?T(N):N),R+=m(L)}for(var H=I-C-1;H>=C;H--){var X=g.children[H];u(D,g.leaf?T(X):X),R+=m(D)}return R},i.prototype._adjustParentBBoxes=function(g,C,I){for(var w=I;w>=0;w--)u(C[w],g)},i.prototype._condense=function(g){for(var C=g.length-1,I=void 0;C>=0;C--)g[C].children.length===0?C>0?(I=g[C-1].children).splice(I.indexOf(g[C]),1):this.clear():o(g[C],this.toBBox)},i})});var qc=k(Y=>{"use strict";d();Object.defineProperty(Y,"__esModule",{value:!0});Y.earthRadius=63710088e-1;Y.factors={centimeters:Y.earthRadius*100,centimetres:Y.earthRadius*100,degrees:Y.earthRadius/111325,feet:Y.earthRadius*3.28084,inches:Y.earthRadius*39.37,kilometers:Y.earthRadius/1e3,kilometres:Y.earthRadius/1e3,meters:Y.earthRadius,metres:Y.earthRadius,miles:Y.earthRadius/1609.344,millimeters:Y.earthRadius*1e3,millimetres:Y.earthRadius*1e3,nauticalmiles:Y.earthRadius/1852,radians:1,yards:Y.earthRadius*1.0936};Y.unitsFactors={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:1/1e3,kilometres:1/1e3,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/Y.earthRadius,yards:1.0936133};Y.areaFactors={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,millimeters:1e6,millimetres:1e6,yards:1.195990046};function Gr(r,t,e){e===void 0&&(e={});var i={type:"Feature"};return(e.id===0||e.id)&&(i.id=e.id),e.bbox&&(i.bbox=e.bbox),i.properties=t||{},i.geometry=r,i}l(Gr,"feature");Y.feature=Gr;function t5(r,t,e){switch(e===void 0&&(e={}),r){case"Point":return Wc(t).geometry;case"LineString":return Uc(t).geometry;case"Polygon":return Zc(t).geometry;case"MultiPoint":return P1(t).geometry;case"MultiLineString":return M1(t).geometry;case"MultiPolygon":return T1(t).geometry;default:throw new Error(r+" is invalid")}}l(t5,"geometry");Y.geometry=t5;function Wc(r,t,e){if(e===void 0&&(e={}),!r)throw new Error("coordinates is required");if(!Array.isArray(r))throw new Error("coordinates must be an Array");if(r.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!el(r[0])||!el(r[1]))throw new Error("coordinates must contain numbers");var i={type:"Point",coordinates:r};return Gr(i,t,e)}l(Wc,"point");Y.point=Wc;function e5(r,t,e){return e===void 0&&(e={}),rl(r.map(function(i){return Wc(i,t)}),e)}l(e5,"points");Y.points=e5;function Zc(r,t,e){e===void 0&&(e={});for(var i=0,n=r;i<n.length;i++){var o=n[i];if(o.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var a=0;a<o[o.length-1].length;a++)if(o[o.length-1][a]!==o[0][a])throw new Error("First and last Position are not equivalent.")}var u={type:"Polygon",coordinates:r};return Gr(u,t,e)}l(Zc,"polygon");Y.polygon=Zc;function r5(r,t,e){return e===void 0&&(e={}),rl(r.map(function(i){return Zc(i,t)}),e)}l(r5,"polygons");Y.polygons=r5;function Uc(r,t,e){if(e===void 0&&(e={}),r.length<2)throw new Error("coordinates must be an array of two or more positions");var i={type:"LineString",coordinates:r};return Gr(i,t,e)}l(Uc,"lineString");Y.lineString=Uc;function i5(r,t,e){return e===void 0&&(e={}),rl(r.map(function(i){return Uc(i,t)}),e)}l(i5,"lineStrings");Y.lineStrings=i5;function rl(r,t){t===void 0&&(t={});var e={type:"FeatureCollection"};return t.id&&(e.id=t.id),t.bbox&&(e.bbox=t.bbox),e.features=r,e}l(rl,"featureCollection");Y.featureCollection=rl;function M1(r,t,e){e===void 0&&(e={});var i={type:"MultiLineString",coordinates:r};return Gr(i,t,e)}l(M1,"multiLineString");Y.multiLineString=M1;function P1(r,t,e){e===void 0&&(e={});var i={type:"MultiPoint",coordinates:r};return Gr(i,t,e)}l(P1,"multiPoint");Y.multiPoint=P1;function T1(r,t,e){e===void 0&&(e={});var i={type:"MultiPolygon",coordinates:r};return Gr(i,t,e)}l(T1,"multiPolygon");Y.multiPolygon=T1;function n5(r,t,e){e===void 0&&(e={});var i={type:"GeometryCollection",geometries:r};return Gr(i,t,e)}l(n5,"geometryCollection");Y.geometryCollection=n5;function o5(r,t){if(t===void 0&&(t=0),t&&!(t>=0))throw new Error("precision must be a positive number");var e=Math.pow(10,t||0);return Math.round(r*e)/e}l(o5,"round");Y.round=o5;function w1(r,t){t===void 0&&(t="kilometers");var e=Y.factors[t];if(!e)throw new Error(t+" units is invalid");return r*e}l(w1,"radiansToLength");Y.radiansToLength=w1;function zc(r,t){t===void 0&&(t="kilometers");var e=Y.factors[t];if(!e)throw new Error(t+" units is invalid");return r/e}l(zc,"lengthToRadians");Y.lengthToRadians=zc;function a5(r,t){return I1(zc(r,t))}l(a5,"lengthToDegrees");Y.lengthToDegrees=a5;function s5(r){var t=r%360;return t<0&&(t+=360),t}l(s5,"bearingToAzimuth");Y.bearingToAzimuth=s5;function I1(r){var t=r%(2*Math.PI);return t*180/Math.PI}l(I1,"radiansToDegrees");Y.radiansToDegrees=I1;function l5(r){var t=r%360;return t*Math.PI/180}l(l5,"degreesToRadians");Y.degreesToRadians=l5;function u5(r,t,e){if(t===void 0&&(t="kilometers"),e===void 0&&(e="kilometers"),!(r>=0))throw new Error("length must be a positive number");return w1(zc(r,t),e)}l(u5,"convertLength");Y.convertLength=u5;function c5(r,t,e){if(t===void 0&&(t="meters"),e===void 0&&(e="kilometers"),!(r>=0))throw new Error("area must be a positive number");var i=Y.areaFactors[t];if(!i)throw new Error("invalid original units");var n=Y.areaFactors[e];if(!n)throw new Error("invalid final units");return r/i*n}l(c5,"convertArea");Y.convertArea=c5;function el(r){return!isNaN(r)&&r!==null&&!Array.isArray(r)}l(el,"isNumber");Y.isNumber=el;function p5(r){return!!r&&r.constructor===Object}l(p5,"isObject");Y.isObject=p5;function h5(r){if(!r)throw new Error("bbox is required");if(!Array.isArray(r))throw new Error("bbox must be an Array");if(r.length!==4&&r.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");r.forEach(function(t){if(!el(t))throw new Error("bbox must only contain numbers")})}l(h5,"validateBBox");Y.validateBBox=h5;function d5(r){if(!r)throw new Error("id is required");if(["string","number"].indexOf(typeof r)===-1)throw new Error("id must be a number or a string")}l(d5,"validateId");Y.validateId=d5});var O1=k(It=>{"use strict";d();Object.defineProperty(It,"__esModule",{value:!0});var Ht=qc();function Oo(r,t,e){if(r!==null)for(var i,n,o,a,u,s,p,f=0,m=0,y,x=r.type,S=x==="FeatureCollection",M=x==="Feature",g=S?r.features.length:1,C=0;C<g;C++){p=S?r.features[C].geometry:M?r.geometry:r,y=p?p.type==="GeometryCollection":!1,u=y?p.geometries.length:1;for(var I=0;I<u;I++){var w=0,T=0;if(a=y?p.geometries[I]:p,a!==null){s=a.coordinates;var L=a.type;switch(f=e&&(L==="Polygon"||L==="MultiPolygon")?1:0,L){case null:break;case"Point":if(t(s,m,C,w,T)===!1)return!1;m++,w++;break;case"LineString":case"MultiPoint":for(i=0;i<s.length;i++){if(t(s[i],m,C,w,T)===!1)return!1;m++,L==="MultiPoint"&&w++}L==="LineString"&&w++;break;case"Polygon":case"MultiLineString":for(i=0;i<s.length;i++){for(n=0;n<s[i].length-f;n++){if(t(s[i][n],m,C,w,T)===!1)return!1;m++}L==="MultiLineString"&&w++,L==="Polygon"&&T++}L==="Polygon"&&w++;break;case"MultiPolygon":for(i=0;i<s.length;i++){for(T=0,n=0;n<s[i].length;n++){for(o=0;o<s[i][n].length-f;o++){if(t(s[i][n][o],m,C,w,T)===!1)return!1;m++}T++}w++}break;case"GeometryCollection":for(i=0;i<a.geometries.length;i++)if(Oo(a.geometries[i],t,e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}l(Oo,"coordEach");function f5(r,t,e,i){var n=e;return Oo(r,function(o,a,u,s,p){a===0&&e===void 0?n=o:n=t(n,o,a,u,s,p)},i),n}l(f5,"coordReduce");function E1(r,t){var e;switch(r.type){case"FeatureCollection":for(e=0;e<r.features.length&&t(r.features[e].properties,e)!==!1;e++);break;case"Feature":t(r.properties,0);break}}l(E1,"propEach");function m5(r,t,e){var i=e;return E1(r,function(n,o){o===0&&e===void 0?i=n:i=t(i,n,o)}),i}l(m5,"propReduce");function L1(r,t){if(r.type==="Feature")t(r,0);else if(r.type==="FeatureCollection")for(var e=0;e<r.features.length&&t(r.features[e],e)!==!1;e++);}l(L1,"featureEach");function y5(r,t,e){var i=e;return L1(r,function(n,o){o===0&&e===void 0?i=n:i=t(i,n,o)}),i}l(y5,"featureReduce");function g5(r){var t=[];return Oo(r,function(e){t.push(e)}),t}l(g5,"coordAll");function $c(r,t){var e,i,n,o,a,u,s,p,f,m,y=0,x=r.type==="FeatureCollection",S=r.type==="Feature",M=x?r.features.length:1;for(e=0;e<M;e++){for(u=x?r.features[e].geometry:S?r.geometry:r,p=x?r.features[e].properties:S?r.properties:{},f=x?r.features[e].bbox:S?r.bbox:void 0,m=x?r.features[e].id:S?r.id:void 0,s=u?u.type==="GeometryCollection":!1,a=s?u.geometries.length:1,n=0;n<a;n++){if(o=s?u.geometries[n]:u,o===null){if(t(null,y,p,f,m)===!1)return!1;continue}switch(o.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(t(o,y,p,f,m)===!1)return!1;break}case"GeometryCollection":{for(i=0;i<o.geometries.length;i++)if(t(o.geometries[i],y,p,f,m)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}y++}}l($c,"geomEach");function v5(r,t,e){var i=e;return $c(r,function(n,o,a,u,s){o===0&&e===void 0?i=n:i=t(i,n,o,a,u,s)}),i}l(v5,"geomReduce");function il(r,t){$c(r,function(e,i,n,o,a){var u=e===null?null:e.type;switch(u){case null:case"Point":case"LineString":case"Polygon":return t(Ht.feature(e,n,{bbox:o,id:a}),i,0)===!1?!1:void 0}var s;switch(u){case"MultiPoint":s="Point";break;case"MultiLineString":s="LineString";break;case"MultiPolygon":s="Polygon";break}for(var p=0;p<e.coordinates.length;p++){var f=e.coordinates[p],m={type:s,coordinates:f};if(t(Ht.feature(m,n),i,p)===!1)return!1}})}l(il,"flattenEach");function b5(r,t,e){var i=e;return il(r,function(n,o,a){o===0&&a===0&&e===void 0?i=n:i=t(i,n,o,a)}),i}l(b5,"flattenReduce");function _1(r,t){il(r,function(e,i,n){var o=0;if(e.geometry){var a=e.geometry.type;if(!(a==="Point"||a==="MultiPoint")){var u,s=0,p=0,f=0;if(Oo(e,function(m,y,x,S,M){if(u===void 0||i>s||S>p||M>f){u=m,s=i,p=S,f=M,o=0;return}var g=Ht.lineString([u,m],e.properties);if(t(g,i,n,M,o)===!1)return!1;o++,u=m})===!1)return!1}}})}l(_1,"segmentEach");function C5(r,t,e){var i=e,n=!1;return _1(r,function(o,a,u,s,p){n===!1&&e===void 0?i=o:i=t(i,o,a,u,s,p),n=!0}),i}l(C5,"segmentReduce");function D1(r,t){if(!r)throw new Error("geojson is required");il(r,function(e,i,n){if(e.geometry!==null){var o=e.geometry.type,a=e.geometry.coordinates;switch(o){case"LineString":if(t(e,i,n,0,0)===!1)return!1;break;case"Polygon":for(var u=0;u<a.length;u++)if(t(Ht.lineString(a[u],e.properties),i,n,u)===!1)return!1;break}}})}l(D1,"lineEach");function x5(r,t,e){var i=e;return D1(r,function(n,o,a,u){o===0&&e===void 0?i=n:i=t(i,n,o,a,u)}),i}l(x5,"lineReduce");function S5(r,t){if(t=t||{},!Ht.isObject(t))throw new Error("options is invalid");var e=t.featureIndex||0,i=t.multiFeatureIndex||0,n=t.geometryIndex||0,o=t.segmentIndex||0,a=t.properties,u;switch(r.type){case"FeatureCollection":e<0&&(e=r.features.length+e),a=a||r.features[e].properties,u=r.features[e].geometry;break;case"Feature":a=a||r.properties,u=r.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":u=r;break;default:throw new Error("geojson is invalid")}if(u===null)return null;var s=u.coordinates;switch(u.type){case"Point":case"MultiPoint":return null;case"LineString":return o<0&&(o=s.length+o-1),Ht.lineString([s[o],s[o+1]],a,t);case"Polygon":return n<0&&(n=s.length+n),o<0&&(o=s[n].length+o-1),Ht.lineString([s[n][o],s[n][o+1]],a,t);case"MultiLineString":return i<0&&(i=s.length+i),o<0&&(o=s[i].length+o-1),Ht.lineString([s[i][o],s[i][o+1]],a,t);case"MultiPolygon":return i<0&&(i=s.length+i),n<0&&(n=s[i].length+n),o<0&&(o=s[i][n].length-o-1),Ht.lineString([s[i][n][o],s[i][n][o+1]],a,t)}throw new Error("geojson is invalid")}l(S5,"findSegment");function M5(r,t){if(t=t||{},!Ht.isObject(t))throw new Error("options is invalid");var e=t.featureIndex||0,i=t.multiFeatureIndex||0,n=t.geometryIndex||0,o=t.coordIndex||0,a=t.properties,u;switch(r.type){case"FeatureCollection":e<0&&(e=r.features.length+e),a=a||r.features[e].properties,u=r.features[e].geometry;break;case"Feature":a=a||r.properties,u=r.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":u=r;break;default:throw new Error("geojson is invalid")}if(u===null)return null;var s=u.coordinates;switch(u.type){case"Point":return Ht.point(s,a,t);case"MultiPoint":return i<0&&(i=s.length+i),Ht.point(s[i],a,t);case"LineString":return o<0&&(o=s.length+o),Ht.point(s[o],a,t);case"Polygon":return n<0&&(n=s.length+n),o<0&&(o=s[n].length+o),Ht.point(s[n][o],a,t);case"MultiLineString":return i<0&&(i=s.length+i),o<0&&(o=s[i].length+o),Ht.point(s[i][o],a,t);case"MultiPolygon":return i<0&&(i=s.length+i),n<0&&(n=s[i].length+n),o<0&&(o=s[i][n].length-o),Ht.point(s[i][n][o],a,t)}throw new Error("geojson is invalid")}l(M5,"findPoint");It.coordAll=g5;It.coordEach=Oo;It.coordReduce=f5;It.featureEach=L1;It.featureReduce=y5;It.findPoint=M5;It.findSegment=S5;It.flattenEach=il;It.flattenReduce=b5;It.geomEach=$c;It.geomReduce=v5;It.lineEach=D1;It.lineReduce=x5;It.propEach=E1;It.propReduce=m5;It.segmentEach=_1;It.segmentReduce=C5});var Jc=k((Gw,k1)=>{"use strict";d();var A1=Object.prototype.toString;k1.exports=l(function(t){var e=A1.call(t),i=e==="[object Arguments]";return i||(i=e!=="[object Array]"&&t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&A1.call(t.callee)==="[object Function]"),i},"isArguments")});var Y1=k((Xw,X1)=>{"use strict";d();var H1;Object.keys||(Ao=Object.prototype.hasOwnProperty,Kc=Object.prototype.toString,N1=Jc(),Qc=Object.prototype.propertyIsEnumerable,R1=!Qc.call({toString:null},"toString"),B1=Qc.call(function(){},"prototype"),ko=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],nl=l(function(r){var t=r.constructor;return t&&t.prototype===r},"equalsConstructorPrototype"),F1={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},G1=function(){if(typeof window>"u")return!1;for(var r in window)try{if(!F1["$"+r]&&Ao.call(window,r)&&window[r]!==null&&typeof window[r]=="object")try{nl(window[r])}catch{return!0}}catch{return!0}return!1}(),V1=l(function(r){if(typeof window>"u"||!G1)return nl(r);try{return nl(r)}catch{return!1}},"equalsConstructorPrototypeIfNotBuggy"),H1=l(function(t){var e=t!==null&&typeof t=="object",i=Kc.call(t)==="[object Function]",n=N1(t),o=e&&Kc.call(t)==="[object String]",a=[];if(!e&&!i&&!n)throw new TypeError("Object.keys called on a non-object");var u=B1&&i;if(o&&t.length>0&&!Ao.call(t,0))for(var s=0;s<t.length;++s)a.push(String(s));if(n&&t.length>0)for(var p=0;p<t.length;++p)a.push(String(p));else for(var f in t)!(u&&f==="prototype")&&Ao.call(t,f)&&a.push(String(f));if(R1)for(var m=V1(t),y=0;y<ko.length;++y)!(m&&ko[y]==="constructor")&&Ao.call(t,ko[y])&&a.push(ko[y]);return a},"keys"));var Ao,Kc,N1,Qc,R1,B1,ko,nl,F1,G1,V1;X1.exports=H1});var al=k((Ww,Z1)=>{"use strict";d();var P5=Array.prototype.slice,T5=Jc(),j1=Object.keys,ol=j1?l(function(t){return j1(t)},"keys"):Y1(),W1=Object.keys;ol.shim=l(function(){if(Object.keys){var t=function(){var e=Object.keys(arguments);return e&&e.length===arguments.length}(1,2);t||(Object.keys=l(function(i){return T5(i)?W1(P5.call(i)):W1(i)},"keys"))}else Object.keys=ol;return Object.keys||ol},"shimObjectKeys");Z1.exports=ol});var z1=k((zw,U1)=>{"use strict";d();U1.exports=Error});var $1=k(($w,q1)=>{"use strict";d();q1.exports=EvalError});var K1=k((Kw,J1)=>{"use strict";d();J1.exports=RangeError});var ty=k((tI,Q1)=>{"use strict";d();Q1.exports=ReferenceError});var tp=k((rI,ey)=>{"use strict";d();ey.exports=SyntaxError});var dr=k((nI,ry)=>{"use strict";d();ry.exports=TypeError});var ny=k((aI,iy)=>{"use strict";d();iy.exports=URIError});var No=k((lI,oy)=>{"use strict";d();oy.exports=l(function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},e=Symbol("test"),i=Object(e);if(typeof e=="string"||Object.prototype.toString.call(e)!=="[object Symbol]"||Object.prototype.toString.call(i)!=="[object Symbol]")return!1;var n=42;t[e]=n;for(e in t)return!1;if(typeof Object.keys=="function"&&Object.keys(t).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var o=Object.getOwnPropertySymbols(t);if(o.length!==1||o[0]!==e||!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var a=Object.getOwnPropertyDescriptor(t,e);if(a.value!==n||a.enumerable!==!0)return!1}return!0},"hasSymbols")});var sl=k((pI,sy)=>{"use strict";d();var ay=typeof Symbol<"u"&&Symbol,w5=No();sy.exports=l(function(){return typeof ay!="function"||typeof Symbol!="function"||typeof ay("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:w5()},"hasNativeSymbols")});var uy=k((fI,ly)=>{"use strict";d();var ep={__proto__:null,foo:{}},I5=Object;ly.exports=l(function(){return{__proto__:ep}.foo===ep.foo&&!(ep instanceof I5)},"hasProto")});var hy=k((gI,py)=>{"use strict";d();var E5="Function.prototype.bind called on incompatible ",L5=Object.prototype.toString,_5=Math.max,D5="[object Function]",cy=l(function(t,e){for(var i=[],n=0;n<t.length;n+=1)i[n]=t[n];for(var o=0;o<e.length;o+=1)i[o+t.length]=e[o];return i},"concatty"),O5=l(function(t,e){for(var i=[],n=e||0,o=0;n<t.length;n+=1,o+=1)i[o]=t[n];return i},"slicy"),A5=l(function(r,t){for(var e="",i=0;i<r.length;i+=1)e+=r[i],i+1<r.length&&(e+=t);return e},"joiny");py.exports=l(function(t){var e=this;if(typeof e!="function"||L5.apply(e)!==D5)throw new TypeError(E5+e);for(var i=O5(arguments,1),n,o=l(function(){if(this instanceof n){var f=e.apply(this,cy(i,arguments));return Object(f)===f?f:this}return e.apply(t,cy(i,arguments))},"binder"),a=_5(0,e.length-i.length),u=[],s=0;s<a;s++)u[s]="$"+s;if(n=Function("binder","return function ("+A5(u,",")+"){ return binder.apply(this,arguments); }")(o),e.prototype){var p=l(function(){},"Empty");p.prototype=e.prototype,n.prototype=new p,p.prototype=null}return n},"bind")});var ll=k((CI,dy)=>{"use strict";d();var k5=hy();dy.exports=Function.prototype.bind||k5});var rp=k((SI,fy)=>{"use strict";d();var N5=Function.prototype.call,R5=Object.prototype.hasOwnProperty,B5=ll();fy.exports=B5.call(N5,R5)});var Ee=k((PI,by)=>{"use strict";d();var q,F5=z1(),G5=$1(),V5=K1(),H5=ty(),xn=tp(),Cn=dr(),X5=ny(),vy=Function,ip=l(function(r){try{return vy('"use strict"; return ('+r+").constructor;")()}catch{}},"getEvalledConstructor"),vi=Object.getOwnPropertyDescriptor;if(vi)try{vi({},"")}catch{vi=null}var np=l(function(){throw new Cn},"throwTypeError"),Y5=vi?function(){try{return arguments.callee,np}catch{try{return vi(arguments,"callee").get}catch{return np}}}():np,vn=sl()(),j5=uy()(),At=Object.getPrototypeOf||(j5?function(r){return r.__proto__}:null),bn={},W5=typeof Uint8Array>"u"||!At?q:At(Uint8Array),bi={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?q:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?q:ArrayBuffer,"%ArrayIteratorPrototype%":vn&&At?At([][Symbol.iterator]()):q,"%AsyncFromSyncIteratorPrototype%":q,"%AsyncFunction%":bn,"%AsyncGenerator%":bn,"%AsyncGeneratorFunction%":bn,"%AsyncIteratorPrototype%":bn,"%Atomics%":typeof Atomics>"u"?q:Atomics,"%BigInt%":typeof BigInt>"u"?q:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?q:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?q:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?q:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":F5,"%eval%":eval,"%EvalError%":G5,"%Float32Array%":typeof Float32Array>"u"?q:Float32Array,"%Float64Array%":typeof Float64Array>"u"?q:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?q:FinalizationRegistry,"%Function%":vy,"%GeneratorFunction%":bn,"%Int8Array%":typeof Int8Array>"u"?q:Int8Array,"%Int16Array%":typeof Int16Array>"u"?q:Int16Array,"%Int32Array%":typeof Int32Array>"u"?q:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":vn&&At?At(At([][Symbol.iterator]())):q,"%JSON%":typeof JSON=="object"?JSON:q,"%Map%":typeof Map>"u"?q:Map,"%MapIteratorPrototype%":typeof Map>"u"||!vn||!At?q:At(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?q:Promise,"%Proxy%":typeof Proxy>"u"?q:Proxy,"%RangeError%":V5,"%ReferenceError%":H5,"%Reflect%":typeof Reflect>"u"?q:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?q:Set,"%SetIteratorPrototype%":typeof Set>"u"||!vn||!At?q:At(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?q:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":vn&&At?At(""[Symbol.iterator]()):q,"%Symbol%":vn?Symbol:q,"%SyntaxError%":xn,"%ThrowTypeError%":Y5,"%TypedArray%":W5,"%TypeError%":Cn,"%Uint8Array%":typeof Uint8Array>"u"?q:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?q:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?q:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?q:Uint32Array,"%URIError%":X5,"%WeakMap%":typeof WeakMap>"u"?q:WeakMap,"%WeakRef%":typeof WeakRef>"u"?q:WeakRef,"%WeakSet%":typeof WeakSet>"u"?q:WeakSet};if(At)try{null.error}catch(r){my=At(At(r)),bi["%Error.prototype%"]=my}var my,Z5=l(function r(t){var e;if(t==="%AsyncFunction%")e=ip("async function () {}");else if(t==="%GeneratorFunction%")e=ip("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=ip("async function* () {}");else if(t==="%AsyncGenerator%"){var i=r("%AsyncGeneratorFunction%");i&&(e=i.prototype)}else if(t==="%AsyncIteratorPrototype%"){var n=r("%AsyncGenerator%");n&&At&&(e=At(n.prototype))}return bi[t]=e,e},"doEval"),yy={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},Ro=ll(),ul=rp(),U5=Ro.call(Function.call,Array.prototype.concat),z5=Ro.call(Function.apply,Array.prototype.splice),gy=Ro.call(Function.call,String.prototype.replace),cl=Ro.call(Function.call,String.prototype.slice),q5=Ro.call(Function.call,RegExp.prototype.exec),$5=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,J5=/\\(\\)?/g,K5=l(function(t){var e=cl(t,0,1),i=cl(t,-1);if(e==="%"&&i!=="%")throw new xn("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&e!=="%")throw new xn("invalid intrinsic syntax, expected opening `%`");var n=[];return gy(t,$5,function(o,a,u,s){n[n.length]=u?gy(s,J5,"$1"):a||o}),n},"stringToPath"),Q5=l(function(t,e){var i=t,n;if(ul(yy,i)&&(n=yy[i],i="%"+n[0]+"%"),ul(bi,i)){var o=bi[i];if(o===bn&&(o=Z5(i)),typeof o>"u"&&!e)throw new Cn("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:n,name:i,value:o}}throw new xn("intrinsic "+t+" does not exist!")},"getBaseIntrinsic");by.exports=l(function(t,e){if(typeof t!="string"||t.length===0)throw new Cn("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new Cn('"allowMissing" argument must be a boolean');if(q5(/^%?[^%]*%?$/,t)===null)throw new xn("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=K5(t),n=i.length>0?i[0]:"",o=Q5("%"+n+"%",e),a=o.name,u=o.value,s=!1,p=o.alias;p&&(n=p[0],z5(i,U5([0,1],p)));for(var f=1,m=!0;f<i.length;f+=1){var y=i[f],x=cl(y,0,1),S=cl(y,-1);if((x==='"'||x==="'"||x==="`"||S==='"'||S==="'"||S==="`")&&x!==S)throw new xn("property names with quotes must have matching quotes");if((y==="constructor"||!m)&&(s=!0),n+="."+y,a="%"+n+"%",ul(bi,a))u=bi[a];else if(u!=null){if(!(y in u)){if(!e)throw new Cn("base intrinsic for "+t+" exists, but the property is not available.");return}if(vi&&f+1>=i.length){var M=vi(u,y);m=!!M,m&&"get"in M&&!("originalValue"in M.get)?u=M.get:u=u[y]}else m=ul(u,y),u=u[y];m&&!s&&(bi[a]=u)}}return u},"GetIntrinsic")});var hl=k((II,Cy)=>{"use strict";d();var t7=Ee(),pl=t7("%Object.defineProperty%",!0)||!1;if(pl)try{pl({},"a",{value:1})}catch{pl=!1}Cy.exports=pl});var fl=k((LI,xy)=>{"use strict";d();var e7=Ee(),dl=e7("%Object.getOwnPropertyDescriptor%",!0);if(dl)try{dl([],"length")}catch{dl=null}xy.exports=dl});var ml=k((DI,Py)=>{"use strict";d();var Sy=hl(),r7=tp(),Sn=dr(),My=fl();Py.exports=l(function(t,e,i){if(!t||typeof t!="object"&&typeof t!="function")throw new Sn("`obj` must be an object or a function`");if(typeof e!="string"&&typeof e!="symbol")throw new Sn("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new Sn("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new Sn("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new Sn("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new Sn("`loose`, if provided, must be a boolean");var n=arguments.length>3?arguments[3]:null,o=arguments.length>4?arguments[4]:null,a=arguments.length>5?arguments[5]:null,u=arguments.length>6?arguments[6]:!1,s=!!My&&My(t,e);if(Sy)Sy(t,e,{configurable:a===null&&s?s.configurable:!a,enumerable:n===null&&s?s.enumerable:!n,value:i,writable:o===null&&s?s.writable:!o});else if(u||!n&&!o&&!a)t[e]=i;else throw new r7("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},"defineDataProperty")});var yl=k((kI,wy)=>{"use strict";d();var op=hl(),Ty=l(function(){return!!op},"hasPropertyDescriptors");Ty.hasArrayLengthDefineBug=l(function(){if(!op)return null;try{return op([],"length",{value:1}).length!==1}catch{return!0}},"hasArrayLengthDefineBug");wy.exports=Ty});var Vr=k((BI,_y)=>{"use strict";d();var i7=al(),n7=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",o7=Object.prototype.toString,a7=Array.prototype.concat,Iy=ml(),s7=l(function(r){return typeof r=="function"&&o7.call(r)==="[object Function]"},"isFunction"),Ey=yl()(),l7=l(function(r,t,e,i){if(t in r){if(i===!0){if(r[t]===e)return}else if(!s7(i)||!i())return}Ey?Iy(r,t,e,!0):Iy(r,t,e)},"defineProperty"),Ly=l(function(r,t){var e=arguments.length>2?arguments[2]:{},i=i7(t);n7&&(i=a7.call(i,Object.getOwnPropertySymbols(t)));for(var n=0;n<i.length;n+=1)l7(r,i[n],t[i[n]],e[i[n]])},"defineProperties");Ly.supportsDescriptors=!!Ey;_y.exports=Ly});var Ny=k((VI,ky)=>{"use strict";d();var u7=Ee(),Dy=ml(),c7=yl()(),Oy=fl(),Ay=dr(),p7=u7("%Math.floor%");ky.exports=l(function(t,e){if(typeof t!="function")throw new Ay("`fn` is not a function");if(typeof e!="number"||e<0||e>4294967295||p7(e)!==e)throw new Ay("`length` must be a positive 32-bit integer");var i=arguments.length>2&&!!arguments[2],n=!0,o=!0;if("length"in t&&Oy){var a=Oy(t,"length");a&&!a.configurable&&(n=!1),a&&!a.writable&&(o=!1)}return(n||o||!i)&&(c7?Dy(t,"length",e,!0,!0):Dy(t,"length",e)),t},"setFunctionLength")});var Ci=k((YI,gl)=>{"use strict";d();var ap=ll(),vl=Ee(),h7=Ny(),d7=dr(),Fy=vl("%Function.prototype.apply%"),Gy=vl("%Function.prototype.call%"),Vy=vl("%Reflect.apply%",!0)||ap.call(Gy,Fy),Ry=hl(),f7=vl("%Math.max%");gl.exports=l(function(t){if(typeof t!="function")throw new d7("a function is required");var e=Vy(ap,Gy,arguments);return h7(e,1+f7(0,t.length-(arguments.length-1)),!0)},"callBind");var By=l(function(){return Vy(ap,Fy,arguments)},"applyBind");Ry?Ry(gl.exports,"apply",{value:By}):gl.exports.apply=By});var ce=k((ZI,Yy)=>{"use strict";d();var Hy=Ee(),Xy=Ci(),m7=Xy(Hy("String.prototype.indexOf"));Yy.exports=l(function(t,e){var i=Hy(t,!!e);return typeof i=="function"&&m7(t,".prototype.")>-1?Xy(i):i},"callBoundIntrinsic")});var sp=k((qI,zy)=>{"use strict";d();var y7=al(),Zy=No()(),Uy=ce(),jy=Object,g7=Uy("Array.prototype.push"),Wy=Uy("Object.prototype.propertyIsEnumerable"),v7=Zy?Object.getOwnPropertySymbols:null;zy.exports=l(function(t,e){if(t==null)throw new TypeError("target must be an object");var i=jy(t);if(arguments.length===1)return i;for(var n=1;n<arguments.length;++n){var o=jy(arguments[n]),a=y7(o),u=Zy&&(Object.getOwnPropertySymbols||v7);if(u)for(var s=u(o),p=0;p<s.length;++p){var f=s[p];Wy(o,f)&&g7(a,f)}for(var m=0;m<a.length;++m){var y=a[m];if(Wy(o,y)){var x=o[y];i[y]=x}}}return i},"assign")});var up=k((KI,qy)=>{"use strict";d();var lp=sp(),b7=l(function(){if(!Object.assign)return!1;for(var r="abcdefghijklmnopqrst",t=r.split(""),e={},i=0;i<t.length;++i)e[t[i]]=t[i];var n=Object.assign({},e),o="";for(var a in n)o+=a;return r!==o},"lacksProperEnumerationOrder"),C7=l(function(){if(!Object.assign||!Object.preventExtensions)return!1;var r=Object.preventExtensions({1:2});try{Object.assign(r,"xy")}catch{return r[1]==="y"}return!1},"assignHasPendingExceptions");qy.exports=l(function(){return!Object.assign||b7()||C7()?lp:Object.assign},"getPolyfill")});var Jy=k((eE,$y)=>{"use strict";d();var x7=Vr(),S7=up();$y.exports=l(function(){var t=S7();return x7(Object,{assign:t},{assign:function(){return Object.assign!==t}}),t},"shimAssign")});var e0=k((nE,t0)=>{"use strict";d();var M7=Vr(),P7=Ci(),T7=sp(),Ky=up(),w7=Jy(),I7=P7.apply(Ky()),Qy=l(function(t,e){return I7(Object,arguments)},"assign");M7(Qy,{getPolyfill:Ky,implementation:T7,shim:w7});t0.exports=Qy});var i0=k((sE,r0)=>{"use strict";d();var Fo=l(function(){return typeof l(function(){},"f").name=="string"},"functionsHaveNames"),Bo=Object.getOwnPropertyDescriptor;if(Bo)try{Bo([],"length")}catch{Bo=null}Fo.functionsHaveConfigurableNames=l(function(){if(!Fo()||!Bo)return!1;var t=Bo(function(){},"name");return!!t&&!!t.configurable},"functionsHaveConfigurableNames");var E7=Function.prototype.bind;Fo.boundFunctionsHaveNames=l(function(){return Fo()&&typeof E7=="function"&&l(function(){},"f").bind().name!==""},"boundFunctionsHaveNames");r0.exports=Fo});var a0=k((cE,o0)=>{"use strict";d();var n0=ml(),L7=yl()(),_7=i0().functionsHaveConfigurableNames(),D7=dr();o0.exports=l(function(t,e){if(typeof t!="function")throw new D7("`fn` is not a function");var i=arguments.length>2&&!!arguments[2];return(!i||_7)&&(L7?n0(t,"name",e,!0,!0):n0(t,"name",e)),t},"setFunctionName")});var cp=k((dE,s0)=>{"use strict";d();var O7=a0(),A7=dr(),k7=Object;s0.exports=O7(l(function(){if(this==null||this!==k7(this))throw new A7("RegExp.prototype.flags getter called on non-object");var t="";return this.hasIndices&&(t+="d"),this.global&&(t+="g"),this.ignoreCase&&(t+="i"),this.multiline&&(t+="m"),this.dotAll&&(t+="s"),this.unicode&&(t+="u"),this.unicodeSets&&(t+="v"),this.sticky&&(t+="y"),t},"flags"),"get flags",!0)});var pp=k((yE,l0)=>{"use strict";d();var N7=cp(),R7=Vr().supportsDescriptors,B7=Object.getOwnPropertyDescriptor;l0.exports=l(function(){if(R7&&/a/mig.flags==="gim"){var t=B7(RegExp.prototype,"flags");if(t&&typeof t.get=="function"&&typeof RegExp.prototype.dotAll=="boolean"&&typeof RegExp.prototype.hasIndices=="boolean"){var e="",i={};if(Object.defineProperty(i,"hasIndices",{get:function(){e+="d"}}),Object.defineProperty(i,"sticky",{get:function(){e+="y"}}),e==="dy")return t.get}}return N7},"getPolyfill")});var p0=k((bE,c0)=>{"use strict";d();var F7=Vr().supportsDescriptors,G7=pp(),V7=Object.getOwnPropertyDescriptor,H7=Object.defineProperty,X7=TypeError,u0=Object.getPrototypeOf,Y7=/a/;c0.exports=l(function(){if(!F7||!u0)throw new X7("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var t=G7(),e=u0(Y7),i=V7(e,"flags");return(!i||i.get!==t)&&H7(e,"flags",{configurable:!0,enumerable:!1,get:t}),t},"shimFlags")});var m0=k((SE,f0)=>{"use strict";d();var j7=Vr(),W7=Ci(),Z7=cp(),h0=pp(),U7=p0(),d0=W7(h0());j7(d0,{getPolyfill:h0,implementation:Z7,shim:U7});f0.exports=d0});var Hr=k((PE,y0)=>{"use strict";d();var z7=No();y0.exports=l(function(){return z7()&&!!Symbol.toStringTag},"hasToStringTagShams")});var dp=k((IE,v0)=>{"use strict";d();var q7=Hr()(),$7=ce(),hp=$7("Object.prototype.toString"),bl=l(function(t){return q7&&t&&typeof t=="object"&&Symbol.toStringTag in t?!1:hp(t)==="[object Arguments]"},"isArguments"),g0=l(function(t){return bl(t)?!0:t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&hp(t)!=="[object Array]"&&hp(t.callee)==="[object Function]"},"isArguments"),J7=function(){return bl(arguments)}();bl.isLegacyArguments=g0;v0.exports=J7?bl:g0});var b0=k(()=>{d()});var G0=k((AE,F0)=>{d();var Mp=typeof Map=="function"&&Map.prototype,fp=Object.getOwnPropertyDescriptor&&Mp?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,xl=Mp&&fp&&typeof fp.get=="function"?fp.get:null,C0=Mp&&Map.prototype.forEach,Pp=typeof Set=="function"&&Set.prototype,mp=Object.getOwnPropertyDescriptor&&Pp?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Sl=Pp&&mp&&typeof mp.get=="function"?mp.get:null,x0=Pp&&Set.prototype.forEach,K7=typeof WeakMap=="function"&&WeakMap.prototype,Vo=K7?WeakMap.prototype.has:null,Q7=typeof WeakSet=="function"&&WeakSet.prototype,Ho=Q7?WeakSet.prototype.has:null,t6=typeof WeakRef=="function"&&WeakRef.prototype,S0=t6?WeakRef.prototype.deref:null,e6=Boolean.prototype.valueOf,r6=Object.prototype.toString,i6=Function.prototype.toString,n6=String.prototype.match,Tp=String.prototype.slice,Yr=String.prototype.replace,o6=String.prototype.toUpperCase,M0=String.prototype.toLowerCase,O0=RegExp.prototype.test,P0=Array.prototype.concat,Ze=Array.prototype.join,a6=Array.prototype.slice,T0=Math.floor,vp=typeof BigInt=="function"?BigInt.prototype.valueOf:null,yp=Object.getOwnPropertySymbols,bp=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Mn=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Xt=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Mn||!0)?Symbol.toStringTag:null,A0=Object.prototype.propertyIsEnumerable,w0=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(r){return r.__proto__}:null);function I0(r,t){if(r===1/0||r===-1/0||r!==r||r&&r>-1e3&&r<1e3||O0.call(/e/,t))return t;var e=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof r=="number"){var i=r<0?-T0(-r):T0(r);if(i!==r){var n=String(i),o=Tp.call(t,n.length+1);return Yr.call(n,e,"$&_")+"."+Yr.call(Yr.call(o,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Yr.call(t,e,"$&_")}l(I0,"addNumericSeparator");var Cp=b0(),E0=Cp.custom,L0=N0(E0)?E0:null;F0.exports=l(function r(t,e,i,n){var o=e||{};if(Xr(o,"quoteStyle")&&o.quoteStyle!=="single"&&o.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Xr(o,"maxStringLength")&&(typeof o.maxStringLength=="number"?o.maxStringLength<0&&o.maxStringLength!==1/0:o.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var a=Xr(o,"customInspect")?o.customInspect:!0;if(typeof a!="boolean"&&a!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(Xr(o,"indent")&&o.indent!==null&&o.indent!==" "&&!(parseInt(o.indent,10)===o.indent&&o.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(Xr(o,"numericSeparator")&&typeof o.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var u=o.numericSeparator;if(typeof t>"u")return"undefined";if(t===null)return"null";if(typeof t=="boolean")return t?"true":"false";if(typeof t=="string")return B0(t,o);if(typeof t=="number"){if(t===0)return 1/0/t>0?"0":"-0";var s=String(t);return u?I0(t,s):s}if(typeof t=="bigint"){var p=String(t)+"n";return u?I0(t,p):p}var f=typeof o.depth>"u"?5:o.depth;if(typeof i>"u"&&(i=0),i>=f&&f>0&&typeof t=="object")return xp(t)?"[Array]":"[Object]";var m=P6(o,i);if(typeof n>"u")n=[];else if(R0(n,t)>=0)return"[Circular]";function y(ct,yt,bt){if(yt&&(n=a6.call(n),n.push(yt)),bt){var kt={depth:o.depth};return Xr(o,"quoteStyle")&&(kt.quoteStyle=o.quoteStyle),r(ct,kt,i+1,n)}return r(ct,o,i+1,n)}if(l(y,"inspect"),typeof t=="function"&&!_0(t)){var x=m6(t),S=Cl(t,y);return"[Function"+(x?": "+x:" (anonymous)")+"]"+(S.length>0?" { "+Ze.call(S,", ")+" }":"")}if(N0(t)){var M=Mn?Yr.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):bp.call(t);return typeof t=="object"&&!Mn?Go(M):M}if(x6(t)){for(var g="<"+M0.call(String(t.nodeName)),C=t.attributes||[],I=0;I<C.length;I++)g+=" "+C[I].name+"="+k0(s6(C[I].value),"double",o);return g+=">",t.childNodes&&t.childNodes.length&&(g+="..."),g+="</"+M0.call(String(t.nodeName))+">",g}if(xp(t)){if(t.length===0)return"[]";var w=Cl(t,y);return m&&!M6(w)?"["+Sp(w,m)+"]":"[ "+Ze.call(w,", ")+" ]"}if(u6(t)){var T=Cl(t,y);return!("cause"in Error.prototype)&&"cause"in t&&!A0.call(t,"cause")?"{ ["+String(t)+"] "+Ze.call(P0.call("[cause]: "+y(t.cause),T),", ")+" }":T.length===0?"["+String(t)+"]":"{ ["+String(t)+"] "+Ze.call(T,", ")+" }"}if(typeof t=="object"&&a){if(L0&&typeof t[L0]=="function"&&Cp)return Cp(t,{depth:f-i});if(a!=="symbol"&&typeof t.inspect=="function")return t.inspect()}if(y6(t)){var L=[];return C0&&C0.call(t,function(ct,yt){L.push(y(yt,t,!0)+" => "+y(ct,t))}),D0("Map",xl.call(t),L,m)}if(b6(t)){var D=[];return x0&&x0.call(t,function(ct){D.push(y(ct,t))}),D0("Set",Sl.call(t),D,m)}if(g6(t))return gp("WeakMap");if(C6(t))return gp("WeakSet");if(v6(t))return gp("WeakRef");if(p6(t))return Go(y(Number(t)));if(d6(t))return Go(y(vp.call(t)));if(h6(t))return Go(e6.call(t));if(c6(t))return Go(y(String(t)));if(typeof window<"u"&&t===window)return"{ [object Window] }";if(t===global)return"{ [object globalThis] }";if(!l6(t)&&!_0(t)){var R=Cl(t,y),F=w0?w0(t)===Object.prototype:t instanceof Object||t.constructor===Object,N=t instanceof Object?"":"null prototype",H=!F&&Xt&&Object(t)===t&&Xt in t?Tp.call(jr(t),8,-1):N?"Object":"",X=F||typeof t.constructor!="function"?"":t.constructor.name?t.constructor.name+" ":"",$=X+(H||N?"["+Ze.call(P0.call([],H||[],N||[]),": ")+"] ":"");return R.length===0?$+"{}":m?$+"{"+Sp(R,m)+"}":$+"{ "+Ze.call(R,", ")+" }"}return String(t)},"inspect_");function k0(r,t,e){var i=(e.quoteStyle||t)==="double"?'"':"'";return i+r+i}l(k0,"wrapQuotes");function s6(r){return Yr.call(String(r),/"/g,"&quot;")}l(s6,"quote");function xp(r){return jr(r)==="[object Array]"&&(!Xt||!(typeof r=="object"&&Xt in r))}l(xp,"isArray");function l6(r){return jr(r)==="[object Date]"&&(!Xt||!(typeof r=="object"&&Xt in r))}l(l6,"isDate");function _0(r){return jr(r)==="[object RegExp]"&&(!Xt||!(typeof r=="object"&&Xt in r))}l(_0,"isRegExp");function u6(r){return jr(r)==="[object Error]"&&(!Xt||!(typeof r=="object"&&Xt in r))}l(u6,"isError");function c6(r){return jr(r)==="[object String]"&&(!Xt||!(typeof r=="object"&&Xt in r))}l(c6,"isString");function p6(r){return jr(r)==="[object Number]"&&(!Xt||!(typeof r=="object"&&Xt in r))}l(p6,"isNumber");function h6(r){return jr(r)==="[object Boolean]"&&(!Xt||!(typeof r=="object"&&Xt in r))}l(h6,"isBoolean");function N0(r){if(Mn)return r&&typeof r=="object"&&r instanceof Symbol;if(typeof r=="symbol")return!0;if(!r||typeof r!="object"||!bp)return!1;try{return bp.call(r),!0}catch{}return!1}l(N0,"isSymbol");function d6(r){if(!r||typeof r!="object"||!vp)return!1;try{return vp.call(r),!0}catch{}return!1}l(d6,"isBigInt");var f6=Object.prototype.hasOwnProperty||function(r){return r in this};function Xr(r,t){return f6.call(r,t)}l(Xr,"has");function jr(r){return r6.call(r)}l(jr,"toStr");function m6(r){if(r.name)return r.name;var t=n6.call(i6.call(r),/^function\s*([\w$]+)/);return t?t[1]:null}l(m6,"nameOf");function R0(r,t){if(r.indexOf)return r.indexOf(t);for(var e=0,i=r.length;e<i;e++)if(r[e]===t)return e;return-1}l(R0,"indexOf");function y6(r){if(!xl||!r||typeof r!="object")return!1;try{xl.call(r);try{Sl.call(r)}catch{return!0}return r instanceof Map}catch{}return!1}l(y6,"isMap");function g6(r){if(!Vo||!r||typeof r!="object")return!1;try{Vo.call(r,Vo);try{Ho.call(r,Ho)}catch{return!0}return r instanceof WeakMap}catch{}return!1}l(g6,"isWeakMap");function v6(r){if(!S0||!r||typeof r!="object")return!1;try{return S0.call(r),!0}catch{}return!1}l(v6,"isWeakRef");function b6(r){if(!Sl||!r||typeof r!="object")return!1;try{Sl.call(r);try{xl.call(r)}catch{return!0}return r instanceof Set}catch{}return!1}l(b6,"isSet");function C6(r){if(!Ho||!r||typeof r!="object")return!1;try{Ho.call(r,Ho);try{Vo.call(r,Vo)}catch{return!0}return r instanceof WeakSet}catch{}return!1}l(C6,"isWeakSet");function x6(r){return!r||typeof r!="object"?!1:typeof HTMLElement<"u"&&r instanceof HTMLElement?!0:typeof r.nodeName=="string"&&typeof r.getAttribute=="function"}l(x6,"isElement");function B0(r,t){if(r.length>t.maxStringLength){var e=r.length-t.maxStringLength,i="... "+e+" more character"+(e>1?"s":"");return B0(Tp.call(r,0,t.maxStringLength),t)+i}var n=Yr.call(Yr.call(r,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,S6);return k0(n,"single",t)}l(B0,"inspectString");function S6(r){var t=r.charCodeAt(0),e={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return e?"\\"+e:"\\x"+(t<16?"0":"")+o6.call(t.toString(16))}l(S6,"lowbyte");function Go(r){return"Object("+r+")"}l(Go,"markBoxed");function gp(r){return r+" { ? }"}l(gp,"weakCollectionOf");function D0(r,t,e,i){var n=i?Sp(e,i):Ze.call(e,", ");return r+" ("+t+") {"+n+"}"}l(D0,"collectionOf");function M6(r){for(var t=0;t<r.length;t++)if(R0(r[t],`
2
- `)>=0)return!1;return!0}l(M6,"singleLineValues");function P6(r,t){var e;if(r.indent===" ")e=" ";else if(typeof r.indent=="number"&&r.indent>0)e=Ze.call(Array(r.indent+1)," ");else return null;return{base:e,prev:Ze.call(Array(t+1),e)}}l(P6,"getIndent");function Sp(r,t){if(r.length===0)return"";var e=`
3
- `+t.prev+t.base;return e+Ze.call(r,","+e)+`
4
- `+t.prev}l(Sp,"indentedJoin");function Cl(r,t){var e=xp(r),i=[];if(e){i.length=r.length;for(var n=0;n<r.length;n++)i[n]=Xr(r,n)?t(r[n],r):""}var o=typeof yp=="function"?yp(r):[],a;if(Mn){a={};for(var u=0;u<o.length;u++)a["$"+o[u]]=o[u]}for(var s in r)Xr(r,s)&&(e&&String(Number(s))===s&&s<r.length||Mn&&a["$"+s]instanceof Symbol||(O0.call(/[^\w$]/,s)?i.push(t(s,r)+": "+t(r[s],r)):i.push(s+": "+t(r[s],r))));if(typeof yp=="function")for(var p=0;p<o.length;p++)A0.call(r,o[p])&&i.push("["+t(o[p])+"]: "+t(r[o[p]],r));return i}l(Cl,"arrObjKeys")});var Ip=k((RE,H0)=>{"use strict";d();var V0=Ee(),Pn=ce(),T6=G0(),w6=dr(),Ml=V0("%WeakMap%",!0),Pl=V0("%Map%",!0),I6=Pn("WeakMap.prototype.get",!0),E6=Pn("WeakMap.prototype.set",!0),L6=Pn("WeakMap.prototype.has",!0),_6=Pn("Map.prototype.get",!0),D6=Pn("Map.prototype.set",!0),O6=Pn("Map.prototype.has",!0),wp=l(function(r,t){for(var e=r,i;(i=e.next)!==null;e=i)if(i.key===t)return e.next=i.next,i.next=r.next,r.next=i,i},"listGetNode"),A6=l(function(r,t){var e=wp(r,t);return e&&e.value},"listGet"),k6=l(function(r,t,e){var i=wp(r,t);i?i.value=e:r.next={key:t,next:r.next,value:e}},"listSet"),N6=l(function(r,t){return!!wp(r,t)},"listHas");H0.exports=l(function(){var t,e,i,n={assert:function(o){if(!n.has(o))throw new w6("Side channel does not contain "+T6(o))},get:function(o){if(Ml&&o&&(typeof o=="object"||typeof o=="function")){if(t)return I6(t,o)}else if(Pl){if(e)return _6(e,o)}else if(i)return A6(i,o)},has:function(o){if(Ml&&o&&(typeof o=="object"||typeof o=="function")){if(t)return L6(t,o)}else if(Pl){if(e)return O6(e,o)}else if(i)return N6(i,o);return!1},set:function(o,a){Ml&&o&&(typeof o=="object"||typeof o=="function")?(t||(t=new Ml),E6(t,o,a)):Pl?(e||(e=new Pl),D6(e,o,a)):(i||(i={key:{},next:null}),k6(i,o,a))}};return n},"getSideChannel")});var Y0=k((GE,X0)=>{"use strict";d();var R6=rp(),Xo=Ip()(),fr=dr(),Ep={assert:function(r,t){if(!r||typeof r!="object"&&typeof r!="function")throw new fr("`O` is not an object");if(typeof t!="string")throw new fr("`slot` must be a string");if(Xo.assert(r),!Ep.has(r,t))throw new fr("`"+t+"` is not present on `O`")},get:function(r,t){if(!r||typeof r!="object"&&typeof r!="function")throw new fr("`O` is not an object");if(typeof t!="string")throw new fr("`slot` must be a string");var e=Xo.get(r);return e&&e["$"+t]},has:function(r,t){if(!r||typeof r!="object"&&typeof r!="function")throw new fr("`O` is not an object");if(typeof t!="string")throw new fr("`slot` must be a string");var e=Xo.get(r);return!!e&&R6(e,"$"+t)},set:function(r,t,e){if(!r||typeof r!="object"&&typeof r!="function")throw new fr("`O` is not an object");if(typeof t!="string")throw new fr("`slot` must be a string");var i=Xo.get(r);i||(i={},Xo.set(r,i)),i["$"+t]=e}};Object.freeze&&Object.freeze(Ep);X0.exports=Ep});var Z0=k((HE,W0)=>{"use strict";d();var Yo=Y0(),B6=SyntaxError,j0=typeof StopIteration=="object"?StopIteration:null;W0.exports=l(function(t){if(!j0)throw new B6("this environment lacks StopIteration");Yo.set(t,"[[Done]]",!1);var e={next:l(function(){var n=Yo.get(this,"[[Iterator]]"),o=Yo.get(n,"[[Done]]");try{return{done:o,value:o?void 0:n.next()}}catch(a){if(Yo.set(n,"[[Done]]",!0),a!==j0)throw a;return{done:!0,value:void 0}}},"next")};return Yo.set(e,"[[Iterator]]",t),e},"getStopIterationIterator")});var Lp=k((jE,U0)=>{d();var F6={}.toString;U0.exports=Array.isArray||function(r){return F6.call(r)=="[object Array]"}});var _p=k((ZE,z0)=>{"use strict";d();var G6=String.prototype.valueOf,V6=l(function(t){try{return G6.call(t),!0}catch{return!1}},"tryStringObject"),H6=Object.prototype.toString,X6="[object String]",Y6=Hr()();z0.exports=l(function(t){return typeof t=="string"?!0:typeof t!="object"?!1:Y6?V6(t):H6.call(t)===X6},"isString")});var Op=k((qE,J0)=>{"use strict";d();var Dp=typeof Map=="function"&&Map.prototype?Map:null,j6=typeof Set=="function"&&Set.prototype?Set:null,Tl;Dp||(Tl=l(function(t){return!1},"isMap"));var $0=Dp?Map.prototype.has:null,q0=j6?Set.prototype.has:null;!Tl&&!$0&&(Tl=l(function(t){return!1},"isMap"));J0.exports=Tl||l(function(t){if(!t||typeof t!="object")return!1;try{if($0.call(t),q0)try{q0.call(t)}catch{return!0}return t instanceof Dp}catch{}return!1},"isMap")});var kp=k((KE,tg)=>{"use strict";d();var W6=typeof Map=="function"&&Map.prototype?Map:null,Ap=typeof Set=="function"&&Set.prototype?Set:null,wl;Ap||(wl=l(function(t){return!1},"isSet"));var K0=W6?Map.prototype.has:null,Q0=Ap?Set.prototype.has:null;!wl&&!Q0&&(wl=l(function(t){return!1},"isSet"));tg.exports=wl||l(function(t){if(!t||typeof t!="object")return!1;try{if(Q0.call(t),K0)try{K0.call(t)}catch{return!0}return t instanceof Ap}catch{}return!1},"isSet")});var hg=k((eL,Ll)=>{"use strict";d();var eg=dp(),rg=Z0();sl()()||No()()?(Il=Symbol.iterator,Ll.exports=l(function(t){if(t!=null&&typeof t[Il]<"u")return t[Il]();if(eg(t))return Array.prototype[Il].call(t)},"getIterator")):(ig=Lp(),ng=_p(),Np=Ee(),og=Np("%Map%",!0),ag=Np("%Set%",!0),me=ce(),Rp=me("Array.prototype.push"),Bp=me("String.prototype.charCodeAt"),sg=me("String.prototype.slice"),lg=l(function(t,e){var i=t.length;if(e+1>=i)return e+1;var n=Bp(t,e);if(n<55296||n>56319)return e+1;var o=Bp(t,e+1);return o<56320||o>57343?e+1:e+2},"advanceStringIndex"),El=l(function(t){var e=0;return{next:l(function(){var n=e>=t.length,o;return n||(o=t[e],e+=1),{done:n,value:o}},"next")}},"getArrayIterator"),Fp=l(function(t,e){if(ig(t)||eg(t))return El(t);if(ng(t)){var i=0;return{next:l(function(){var o=lg(t,i),a=sg(t,i,o);return i=o,{done:o>t.length,value:a}},"next")}}if(e&&typeof t["_es6-shim iterator_"]<"u")return t["_es6-shim iterator_"]()},"getNonCollectionIterator"),!og&&!ag?Ll.exports=l(function(t){if(t!=null)return Fp(t,!0)},"getIterator"):(ug=Op(),cg=kp(),Gp=me("Map.prototype.forEach",!0),Vp=me("Set.prototype.forEach",!0),(typeof b>"u"||!b.versions||!b.versions.node)&&(Hp=me("Map.prototype.iterator",!0),Xp=me("Set.prototype.iterator",!0)),Yp=me("Map.prototype.@@iterator",!0)||me("Map.prototype._es6-shim iterator_",!0),jp=me("Set.prototype.@@iterator",!0)||me("Set.prototype._es6-shim iterator_",!0),pg=l(function(t){if(ug(t)){if(Hp)return rg(Hp(t));if(Yp)return Yp(t);if(Gp){var e=[];return Gp(t,function(n,o){Rp(e,[o,n])}),El(e)}}if(cg(t)){if(Xp)return rg(Xp(t));if(jp)return jp(t);if(Vp){var i=[];return Vp(t,function(n){Rp(i,n)}),El(i)}}},"getCollectionIterator"),Ll.exports=l(function(t){return pg(t)||Fp(t)},"getIterator")));var Il,ig,ng,Np,og,ag,me,Rp,Bp,sg,lg,El,Fp,ug,cg,Gp,Vp,Hp,Xp,Yp,jp,pg});var Wp=k((nL,fg)=>{"use strict";d();var dg=l(function(r){return r!==r},"numberIsNaN");fg.exports=l(function(t,e){return t===0&&e===0?1/t===1/e:!!(t===e||dg(t)&&dg(e))},"is")});var Zp=k((sL,mg)=>{"use strict";d();var Z6=Wp();mg.exports=l(function(){return typeof Object.is=="function"?Object.is:Z6},"getPolyfill")});var gg=k((cL,yg)=>{"use strict";d();var U6=Zp(),z6=Vr();yg.exports=l(function(){var t=U6();return z6(Object,{is:t},{is:l(function(){return Object.is!==t},"testObjectIs")}),t},"shimObjectIs")});var xg=k((dL,Cg)=>{"use strict";d();var q6=Vr(),$6=Ci(),J6=Wp(),vg=Zp(),K6=gg(),bg=$6(vg(),Object);q6(bg,{getPolyfill:vg,implementation:J6,shim:K6});Cg.exports=bg});var zp=k((mL,Tg)=>{"use strict";d();var Q6=Ci(),Pg=ce(),tC=Ee(),Up=tC("%ArrayBuffer%",!0),_l=Pg("ArrayBuffer.prototype.byteLength",!0),eC=Pg("Object.prototype.toString"),Sg=!!Up&&!_l&&new Up(0).slice,Mg=!!Sg&&Q6(Sg);Tg.exports=l(_l||Mg?function(t){if(!t||typeof t!="object")return!1;try{return _l?_l(t):Mg(t,0),!0}catch{return!1}}:Up?function(t){return eC(t)==="[object ArrayBuffer]"}:function(t){return!1},"isArrayBuffer")});var Ig=k((vL,wg)=>{"use strict";d();var rC=Date.prototype.getDay,iC=l(function(t){try{return rC.call(t),!0}catch{return!1}},"tryDateGetDayCall"),nC=Object.prototype.toString,oC="[object Date]",aC=Hr()();wg.exports=l(function(t){return typeof t!="object"||t===null?!1:aC?iC(t):nC.call(t)===oC},"isDateObject")});var Og=k((xL,Dg)=>{"use strict";d();var qp=ce(),Eg=Hr()(),Lg,_g,$p,Jp;Eg&&(Lg=qp("Object.prototype.hasOwnProperty"),_g=qp("RegExp.prototype.exec"),$p={},Dl=l(function(){throw $p},"throwRegexMarker"),Jp={toString:Dl,valueOf:Dl},typeof Symbol.toPrimitive=="symbol"&&(Jp[Symbol.toPrimitive]=Dl));var Dl,sC=qp("Object.prototype.toString"),lC=Object.getOwnPropertyDescriptor,uC="[object RegExp]";Dg.exports=l(Eg?function(t){if(!t||typeof t!="object")return!1;var e=lC(t,"lastIndex"),i=e&&Lg(e,"value");if(!i)return!1;try{_g(t,Jp)}catch(n){return n===$p}}:function(t){return!t||typeof t!="object"&&typeof t!="function"?!1:sC(t)===uC},"isRegex")});var Ng=k((PL,kg)=>{"use strict";d();var cC=ce(),Ag=cC("SharedArrayBuffer.prototype.byteLength",!0);kg.exports=l(Ag?function(t){if(!t||typeof t!="object")return!1;try{return Ag(t),!0}catch{return!1}}:function(t){return!1},"isSharedArrayBuffer")});var Bg=k((IL,Rg)=>{"use strict";d();var pC=Number.prototype.toString,hC=l(function(t){try{return pC.call(t),!0}catch{return!1}},"tryNumberObject"),dC=Object.prototype.toString,fC="[object Number]",mC=Hr()();Rg.exports=l(function(t){return typeof t=="number"?!0:typeof t!="object"?!1:mC?hC(t):dC.call(t)===fC},"isNumberObject")});var Vg=k((_L,Gg)=>{"use strict";d();var Fg=ce(),yC=Fg("Boolean.prototype.toString"),gC=Fg("Object.prototype.toString"),vC=l(function(t){try{return yC(t),!0}catch{return!1}},"booleanBrandCheck"),bC="[object Boolean]",CC=Hr()();Gg.exports=l(function(t){return typeof t=="boolean"?!0:t===null||typeof t!="object"?!1:CC&&Symbol.toStringTag in t?vC(t):gC(t)===bC},"isBoolean")});var jg=k((AL,Kp)=>{"use strict";d();var xC=Object.prototype.toString,SC=sl()();SC?(Hg=Symbol.prototype.toString,Xg=/^Symbol\(.*\)$/,Yg=l(function(t){return typeof t.valueOf()!="symbol"?!1:Xg.test(Hg.call(t))},"isRealSymbolObject"),Kp.exports=l(function(t){if(typeof t=="symbol")return!0;if(xC.call(t)!=="[object Symbol]")return!1;try{return Yg(t)}catch{return!1}},"isSymbol")):Kp.exports=l(function(t){return!1},"isSymbol");var Hg,Xg,Yg});var Ug=k((RL,Zg)=>{"use strict";d();var Wg=typeof BigInt<"u"&&BigInt;Zg.exports=l(function(){return typeof Wg=="function"&&typeof BigInt=="function"&&typeof Wg(42)=="bigint"&&typeof BigInt(42)=="bigint"},"hasNativeBigInts")});var $g=k((GL,Qp)=>{"use strict";d();var MC=Ug()();MC?(zg=BigInt.prototype.valueOf,qg=l(function(t){try{return zg.call(t),!0}catch{}return!1},"tryBigIntObject"),Qp.exports=l(function(t){return t===null||typeof t>"u"||typeof t=="boolean"||typeof t=="string"||typeof t=="number"||typeof t=="symbol"||typeof t=="function"?!1:typeof t=="bigint"?!0:qg(t)},"isBigInt")):Qp.exports=l(function(t){return!1},"isBigInt");var zg,qg});var Kg=k((XL,Jg)=>{"use strict";d();var PC=_p(),TC=Bg(),wC=Vg(),IC=jg(),EC=$g();Jg.exports=l(function(t){if(t==null||typeof t!="object"&&typeof t!="function")return null;if(PC(t))return"String";if(TC(t))return"Number";if(wC(t))return"Boolean";if(IC(t))return"Symbol";if(EC(t))return"BigInt"},"whichBoxedPrimitive")});var e2=k((WL,t2)=>{"use strict";d();var Ol=typeof WeakMap=="function"&&WeakMap.prototype?WeakMap:null,Qg=typeof WeakSet=="function"&&WeakSet.prototype?WeakSet:null,Al;Ol||(Al=l(function(t){return!1},"isWeakMap"));var eh=Ol?Ol.prototype.has:null,th=Qg?Qg.prototype.has:null;!Al&&!eh&&(Al=l(function(t){return!1},"isWeakMap"));t2.exports=Al||l(function(t){if(!t||typeof t!="object")return!1;try{if(eh.call(t,eh),th)try{th.call(t,th)}catch{return!0}return t instanceof Ol}catch{}return!1},"isWeakMap")});var i2=k((zL,ih)=>{"use strict";d();var LC=Ee(),r2=ce(),_C=LC("%WeakSet%",!0),rh=r2("WeakSet.prototype.has",!0);rh?(kl=r2("WeakMap.prototype.has",!0),ih.exports=l(function(t){if(!t||typeof t!="object")return!1;try{if(rh(t,rh),kl)try{kl(t,kl)}catch{return!0}return t instanceof _C}catch{}return!1},"isWeakSet")):ih.exports=l(function(t){return!1},"isWeakSet");var kl});var o2=k((JL,n2)=>{"use strict";d();var DC=Op(),OC=kp(),AC=e2(),kC=i2();n2.exports=l(function(t){if(t&&typeof t=="object"){if(DC(t))return"Map";if(OC(t))return"Set";if(AC(t))return"WeakMap";if(kC(t))return"WeakSet"}return!1},"whichCollection")});var u2=k((t_,l2)=>{"use strict";d();var s2=Function.prototype.toString,Tn=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,oh,Nl;if(typeof Tn=="function"&&typeof Object.defineProperty=="function")try{oh=Object.defineProperty({},"length",{get:function(){throw Nl}}),Nl={},Tn(function(){throw 42},null,oh)}catch(r){r!==Nl&&(Tn=null)}else Tn=null;var NC=/^\s*class\b/,ah=l(function(t){try{var e=s2.call(t);return NC.test(e)}catch{return!1}},"isES6ClassFunction"),nh=l(function(t){try{return ah(t)?!1:(s2.call(t),!0)}catch{return!1}},"tryFunctionToStr"),Rl=Object.prototype.toString,RC="[object Object]",BC="[object Function]",FC="[object GeneratorFunction]",GC="[object HTMLAllCollection]",VC="[object HTML document.all class]",HC="[object HTMLCollection]",XC=typeof Symbol=="function"&&!!Symbol.toStringTag,YC=!(0 in[,]),sh=l(function(){return!1},"isDocumentDotAll");typeof document=="object"&&(a2=document.all,Rl.call(a2)===Rl.call(document.all)&&(sh=l(function(t){if((YC||!t)&&(typeof t>"u"||typeof t=="object"))try{var e=Rl.call(t);return(e===GC||e===VC||e===HC||e===RC)&&t("")==null}catch{}return!1},"isDocumentDotAll")));var a2;l2.exports=l(Tn?function(t){if(sh(t))return!0;if(!t||typeof t!="function"&&typeof t!="object")return!1;try{Tn(t,null,oh)}catch(e){if(e!==Nl)return!1}return!ah(t)&&nh(t)}:function(t){if(sh(t))return!0;if(!t||typeof t!="function"&&typeof t!="object")return!1;if(XC)return nh(t);if(ah(t))return!1;var e=Rl.call(t);return e!==BC&&e!==FC&&!/^\[object HTML/.test(e)?!1:nh(t)},"isCallable")});var h2=k((i_,p2)=>{"use strict";d();var jC=u2(),WC=Object.prototype.toString,c2=Object.prototype.hasOwnProperty,ZC=l(function(t,e,i){for(var n=0,o=t.length;n<o;n++)c2.call(t,n)&&(i==null?e(t[n],n,t):e.call(i,t[n],n,t))},"forEachArray"),UC=l(function(t,e,i){for(var n=0,o=t.length;n<o;n++)i==null?e(t.charAt(n),n,t):e.call(i,t.charAt(n),n,t)},"forEachString"),zC=l(function(t,e,i){for(var n in t)c2.call(t,n)&&(i==null?e(t[n],n,t):e.call(i,t[n],n,t))},"forEachObject"),qC=l(function(t,e,i){if(!jC(e))throw new TypeError("iterator must be a function");var n;arguments.length>=3&&(n=i),WC.call(t)==="[object Array]"?ZC(t,e,n):typeof t=="string"?UC(t,e,n):zC(t,e,n)},"forEach");p2.exports=qC});var f2=k((a_,d2)=>{"use strict";d();d2.exports=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]});var y2=k((l_,m2)=>{"use strict";d();var lh=f2(),$C=typeof globalThis>"u"?global:globalThis;m2.exports=l(function(){for(var t=[],e=0;e<lh.length;e++)typeof $C[lh[e]]=="function"&&(t[t.length]=lh[e]);return t},"availableTypedArrays")});var x2=k((p_,C2)=>{"use strict";d();var Fl=h2(),JC=y2(),g2=Ci(),ph=ce(),Bl=fl(),KC=ph("Object.prototype.toString"),b2=Hr()(),v2=typeof globalThis>"u"?global:globalThis,ch=JC(),hh=ph("String.prototype.slice"),uh=Object.getPrototypeOf,QC=ph("Array.prototype.indexOf",!0)||l(function(t,e){for(var i=0;i<t.length;i+=1)if(t[i]===e)return i;return-1},"indexOf"),Gl={__proto__:null};b2&&Bl&&uh?Fl(ch,function(r){var t=new v2[r];if(Symbol.toStringTag in t){var e=uh(t),i=Bl(e,Symbol.toStringTag);if(!i){var n=uh(e);i=Bl(n,Symbol.toStringTag)}Gl["$"+r]=g2(i.get)}}):Fl(ch,function(r){var t=new v2[r],e=t.slice||t.set;e&&(Gl["$"+r]=g2(e))});var t8=l(function(t){var e=!1;return Fl(Gl,function(i,n){if(!e)try{"$"+i(t)===n&&(e=hh(n,1))}catch{}}),e},"tryAllTypedArrays"),e8=l(function(t){var e=!1;return Fl(Gl,function(i,n){if(!e)try{i(t),e=hh(n,1)}catch{}}),e},"tryAllSlices");C2.exports=l(function(t){if(!t||typeof t!="object")return!1;if(!b2){var e=hh(KC(t),8,-1);return QC(ch,e)>-1?e:e!=="Object"?!1:e8(t)}return Bl?t8(t):null},"whichTypedArray")});var P2=k((f_,M2)=>{"use strict";d();var r8=ce(),S2=r8("ArrayBuffer.prototype.byteLength",!0),i8=zp();M2.exports=l(function(t){return i8(t)?S2?S2(t):t.byteLength:NaN},"byteLength")});var q2=k((g_,z2)=>{"use strict";d();var W2=e0(),Ue=ce(),T2=m0(),n8=Ee(),wn=hg(),o8=Ip(),w2=xg(),I2=dp(),E2=Lp(),L2=zp(),_2=Ig(),D2=Og(),O2=Ng(),A2=al(),k2=Kg(),N2=o2(),R2=x2(),B2=P2(),F2=Ue("SharedArrayBuffer.prototype.byteLength",!0),G2=Ue("Date.prototype.getTime"),dh=Object.getPrototypeOf,V2=Ue("Object.prototype.toString"),Hl=n8("%Set%",!0),fh=Ue("Map.prototype.has",!0),Xl=Ue("Map.prototype.get",!0),H2=Ue("Map.prototype.size",!0),Yl=Ue("Set.prototype.add",!0),Z2=Ue("Set.prototype.delete",!0),jl=Ue("Set.prototype.has",!0),Vl=Ue("Set.prototype.size",!0);function X2(r,t,e,i){for(var n=wn(r),o;(o=n.next())&&!o.done;)if(Le(t,o.value,e,i))return Z2(r,o.value),!0;return!1}l(X2,"setHasEqualElement");function U2(r){if(typeof r>"u")return null;if(typeof r!="object")return typeof r=="symbol"?!1:typeof r=="string"||typeof r=="number"?+r==+r:!0}l(U2,"findLooseMatchingPrimitives");function a8(r,t,e,i,n,o){var a=U2(e);if(a!=null)return a;var u=Xl(t,a),s=W2({},n,{strict:!1});return typeof u>"u"&&!fh(t,a)||!Le(i,u,s,o)?!1:!fh(r,a)&&Le(i,u,s,o)}l(a8,"mapMightHaveLoosePrim");function s8(r,t,e){var i=U2(e);return i!=null?i:jl(t,i)&&!jl(r,i)}l(s8,"setMightHaveLoosePrim");function Y2(r,t,e,i,n,o){for(var a=wn(r),u,s;(u=a.next())&&!u.done;)if(s=u.value,Le(e,s,n,o)&&Le(i,Xl(t,s),n,o))return Z2(r,s),!0;return!1}l(Y2,"mapHasEqualEntry");function Le(r,t,e,i){var n=e||{};if(n.strict?w2(r,t):r===t)return!0;var o=k2(r),a=k2(t);if(o!==a)return!1;if(!r||!t||typeof r!="object"&&typeof t!="object")return n.strict?w2(r,t):r==t;var u=i.has(r),s=i.has(t),p;if(u&&s){if(i.get(r)===i.get(t))return!0}else p={};return u||i.set(r,p),s||i.set(t,p),c8(r,t,n,i)}l(Le,"internalDeepEqual");function j2(r){return!r||typeof r!="object"||typeof r.length!="number"||typeof r.copy!="function"||typeof r.slice!="function"||r.length>0&&typeof r[0]!="number"?!1:!!(r.constructor&&r.constructor.isBuffer&&r.constructor.isBuffer(r))}l(j2,"isBuffer");function l8(r,t,e,i){if(Vl(r)!==Vl(t))return!1;for(var n=wn(r),o=wn(t),a,u,s;(a=n.next())&&!a.done;)if(a.value&&typeof a.value=="object")s||(s=new Hl),Yl(s,a.value);else if(!jl(t,a.value)){if(e.strict||!s8(r,t,a.value))return!1;s||(s=new Hl),Yl(s,a.value)}if(s){for(;(u=o.next())&&!u.done;)if(u.value&&typeof u.value=="object"){if(!X2(s,u.value,e.strict,i))return!1}else if(!e.strict&&!jl(r,u.value)&&!X2(s,u.value,e.strict,i))return!1;return Vl(s)===0}return!0}l(l8,"setEquiv");function u8(r,t,e,i){if(H2(r)!==H2(t))return!1;for(var n=wn(r),o=wn(t),a,u,s,p,f,m;(a=n.next())&&!a.done;)if(p=a.value[0],f=a.value[1],p&&typeof p=="object")s||(s=new Hl),Yl(s,p);else if(m=Xl(t,p),typeof m>"u"&&!fh(t,p)||!Le(f,m,e,i)){if(e.strict||!a8(r,t,p,f,e,i))return!1;s||(s=new Hl),Yl(s,p)}if(s){for(;(u=o.next())&&!u.done;)if(p=u.value[0],m=u.value[1],p&&typeof p=="object"){if(!Y2(s,r,p,m,e,i))return!1}else if(!e.strict&&(!r.has(p)||!Le(Xl(r,p),m,e,i))&&!Y2(s,r,p,m,W2({},e,{strict:!1}),i))return!1;return Vl(s)===0}return!0}l(u8,"mapEquiv");function c8(r,t,e,i){var n,o;if(typeof r!=typeof t||r==null||t==null||V2(r)!==V2(t)||I2(r)!==I2(t))return!1;var a=E2(r),u=E2(t);if(a!==u)return!1;var s=r instanceof Error,p=t instanceof Error;if(s!==p||(s||p)&&(r.name!==t.name||r.message!==t.message))return!1;var f=D2(r),m=D2(t);if(f!==m||(f||m)&&(r.source!==t.source||T2(r)!==T2(t)))return!1;var y=_2(r),x=_2(t);if(y!==x||(y||x)&&G2(r)!==G2(t)||e.strict&&dh&&dh(r)!==dh(t))return!1;var S=R2(r),M=R2(t);if(S!==M)return!1;if(S||M){if(r.length!==t.length)return!1;for(n=0;n<r.length;n++)if(r[n]!==t[n])return!1;return!0}var g=j2(r),C=j2(t);if(g!==C)return!1;if(g||C){if(r.length!==t.length)return!1;for(n=0;n<r.length;n++)if(r[n]!==t[n])return!1;return!0}var I=L2(r),w=L2(t);if(I!==w)return!1;if(I||w)return B2(r)!==B2(t)?!1:typeof Uint8Array=="function"&&Le(new Uint8Array(r),new Uint8Array(t),e,i);var T=O2(r),L=O2(t);if(T!==L)return!1;if(T||L)return F2(r)!==F2(t)?!1:typeof Uint8Array=="function"&&Le(new Uint8Array(r),new Uint8Array(t),e,i);if(typeof r!=typeof t)return!1;var D=A2(r),R=A2(t);if(D.length!==R.length)return!1;for(D.sort(),R.sort(),n=D.length-1;n>=0;n--)if(D[n]!=R[n])return!1;for(n=D.length-1;n>=0;n--)if(o=D[n],!Le(r[o],t[o],e,i))return!1;var F=N2(r),N=N2(t);return F!==N?!1:F==="Set"||N==="Set"?l8(r,t,e,i):F==="Map"?u8(r,t,e,i):!0}l(c8,"objEquiv");z2.exports=l(function(t,e,i){return Le(t,e,i,o8())},"deepEqual")});var p3=k(rt=>{"use strict";d();Object.defineProperty(rt,"__esModule",{value:!0});function p8(r){return r&&r.__esModule?r:{default:r}}l(p8,"_interopRequireDefault");var h8=Object.defineProperty,nt=l((r,t)=>h8(r,"name",{value:t,configurable:!0}),"__name"),d8=q2(),f8=p8(d8),Zo,$2=(Zo=class{constructor(t){this.direction=!1,this.compareProperties=!0;var e,i,n;this.precision=10**-((e=t==null?void 0:t.precision)!=null?e:17),this.direction=(i=t==null?void 0:t.direction)!=null?i:!1,this.compareProperties=(n=t==null?void 0:t.compareProperties)!=null?n:!0}compare(t,e){if(t.type!==e.type||!jo(t,e))return!1;switch(t.type){case"Point":return this.compareCoord(t.coordinates,e.coordinates);case"LineString":return this.compareLine(t.coordinates,e.coordinates);case"Polygon":return this.comparePolygon(t,e);case"GeometryCollection":return this.compareGeometryCollection(t,e);case"Feature":return this.compareFeature(t,e);case"FeatureCollection":return this.compareFeatureCollection(t,e);default:if(t.type.startsWith("Multi")){let i=mh(t),n=mh(e);return i.every(o=>n.some(a=>this.compare(o,a)))}}return!1}compareCoord(t,e){return t.length===e.length&&t.every((i,n)=>Math.abs(i-e[n])<this.precision)}compareLine(t,e,i=0,n=!1){if(!jo(t,e))return!1;let o=t,a=e;if(n&&!this.compareCoord(o[0],a[0])){let s=this.fixStartIndex(a,o);if(s)a=s;else return!1}let u=this.compareCoord(o[i],a[i]);return this.direction||u?this.comparePath(o,a):this.compareCoord(o[i],a[a.length-(1+i)])?this.comparePath(o.slice().reverse(),a):!1}fixStartIndex(t,e){let i,n=-1;for(let o=0;o<t.length;o++)if(this.compareCoord(t[o],e[0])){n=o;break}return n>=0&&(i=[].concat(t.slice(n,t.length),t.slice(1,n+1))),i}comparePath(t,e){return t.every((i,n)=>this.compareCoord(i,e[n]))}comparePolygon(t,e){if(this.compareLine(t.coordinates[0],e.coordinates[0],1,!0)){let i=t.coordinates.slice(1,t.coordinates.length),n=e.coordinates.slice(1,e.coordinates.length);return i.every(o=>n.some(a=>this.compareLine(o,a,1,!0)))}return!1}compareGeometryCollection(t,e){return jo(t.geometries,e.geometries)&&this.compareBBox(t,e)&&t.geometries.every((i,n)=>this.compare(i,e.geometries[n]))}compareFeature(t,e){return t.id===e.id&&(this.compareProperties?f8.default.call(void 0,t.properties,e.properties):!0)&&this.compareBBox(t,e)&&this.compare(t.geometry,e.geometry)}compareFeatureCollection(t,e){return jo(t.features,e.features)&&this.compareBBox(t,e)&&t.features.every((i,n)=>this.compare(i,e.features[n]))}compareBBox(t,e){return!t.bbox&&!e.bbox||(t.bbox&&e.bbox?this.compareCoord(t.bbox,e.bbox):!1)}},l(Zo,"_GeojsonEquality"),Zo);nt($2,"GeojsonEquality");var m8=$2;function jo(r,t){return r.coordinates?r.coordinates.length===t.coordinates.length:r.length===t.length}l(jo,"sameLength");nt(jo,"sameLength");function mh(r){return r.coordinates.map(t=>({type:r.type.replace("Multi",""),coordinates:t}))}l(mh,"explode");nt(mh,"explode");var oe=63710088e-1,gh={centimeters:oe*100,centimetres:oe*100,degrees:360/(2*Math.PI),feet:oe*3.28084,inches:oe*39.37,kilometers:oe/1e3,kilometres:oe/1e3,meters:oe,metres:oe,miles:oe/1609.344,millimeters:oe*1e3,millimetres:oe*1e3,nauticalmiles:oe/1852,radians:1,yards:oe*1.0936},yh={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,nauticalmiles:29155334959812285e-23,millimeters:1e6,millimetres:1e6,yards:1.195990046};function mr(r,t,e={}){let i={type:"Feature"};return(e.id===0||e.id)&&(i.id=e.id),e.bbox&&(i.bbox=e.bbox),i.properties=t||{},i.geometry=r,i}l(mr,"feature");nt(mr,"feature");function J2(r,t,e={}){switch(r){case"Point":return Wl(t).geometry;case"LineString":return Ul(t).geometry;case"Polygon":return Zl(t).geometry;case"MultiPoint":return bh(t).geometry;case"MultiLineString":return vh(t).geometry;case"MultiPolygon":return Ch(t).geometry;default:throw new Error(r+" is invalid")}}l(J2,"geometry");nt(J2,"geometry");function Wl(r,t,e={}){if(!r)throw new Error("coordinates is required");if(!Array.isArray(r))throw new Error("coordinates must be an Array");if(r.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Wo(r[0])||!Wo(r[1]))throw new Error("coordinates must contain numbers");return mr({type:"Point",coordinates:r},t,e)}l(Wl,"point");nt(Wl,"point");function K2(r,t,e={}){return Uo(r.map(i=>Wl(i,t)),e)}l(K2,"points");nt(K2,"points");function Zl(r,t,e={}){for(let n of r){if(n.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(n[n.length-1].length!==n[0].length)throw new Error("First and last Position are not equivalent.");for(let o=0;o<n[n.length-1].length;o++)if(n[n.length-1][o]!==n[0][o])throw new Error("First and last Position are not equivalent.")}return mr({type:"Polygon",coordinates:r},t,e)}l(Zl,"polygon");nt(Zl,"polygon");function Q2(r,t,e={}){return Uo(r.map(i=>Zl(i,t)),e)}l(Q2,"polygons");nt(Q2,"polygons");function Ul(r,t,e={}){if(r.length<2)throw new Error("coordinates must be an array of two or more positions");return mr({type:"LineString",coordinates:r},t,e)}l(Ul,"lineString");nt(Ul,"lineString");function t3(r,t,e={}){return Uo(r.map(i=>Ul(i,t)),e)}l(t3,"lineStrings");nt(t3,"lineStrings");function Uo(r,t={}){let e={type:"FeatureCollection"};return t.id&&(e.id=t.id),t.bbox&&(e.bbox=t.bbox),e.features=r,e}l(Uo,"featureCollection");nt(Uo,"featureCollection");function vh(r,t,e={}){return mr({type:"MultiLineString",coordinates:r},t,e)}l(vh,"multiLineString");nt(vh,"multiLineString");function bh(r,t,e={}){return mr({type:"MultiPoint",coordinates:r},t,e)}l(bh,"multiPoint");nt(bh,"multiPoint");function Ch(r,t,e={}){return mr({type:"MultiPolygon",coordinates:r},t,e)}l(Ch,"multiPolygon");nt(Ch,"multiPolygon");function e3(r,t,e={}){return mr({type:"GeometryCollection",geometries:r},t,e)}l(e3,"geometryCollection");nt(e3,"geometryCollection");function r3(r,t=0){if(t&&!(t>=0))throw new Error("precision must be a positive number");let e=Math.pow(10,t||0);return Math.round(r*e)/e}l(r3,"round");nt(r3,"round");function xh(r,t="kilometers"){let e=gh[t];if(!e)throw new Error(t+" units is invalid");return r*e}l(xh,"radiansToLength");nt(xh,"radiansToLength");function zl(r,t="kilometers"){let e=gh[t];if(!e)throw new Error(t+" units is invalid");return r/e}l(zl,"lengthToRadians");nt(zl,"lengthToRadians");function i3(r,t){return Sh(zl(r,t))}l(i3,"lengthToDegrees");nt(i3,"lengthToDegrees");function n3(r){let t=r%360;return t<0&&(t+=360),t}l(n3,"bearingToAzimuth");nt(n3,"bearingToAzimuth");function Sh(r){return r%(2*Math.PI)*180/Math.PI}l(Sh,"radiansToDegrees");nt(Sh,"radiansToDegrees");function o3(r){return r%360*Math.PI/180}l(o3,"degreesToRadians");nt(o3,"degreesToRadians");function a3(r,t="kilometers",e="kilometers"){if(!(r>=0))throw new Error("length must be a positive number");return xh(zl(r,t),e)}l(a3,"convertLength");nt(a3,"convertLength");function s3(r,t="meters",e="kilometers"){if(!(r>=0))throw new Error("area must be a positive number");let i=yh[t];if(!i)throw new Error("invalid original units");let n=yh[e];if(!n)throw new Error("invalid final units");return r/i*n}l(s3,"convertArea");nt(s3,"convertArea");function Wo(r){return!isNaN(r)&&r!==null&&!Array.isArray(r)}l(Wo,"isNumber");nt(Wo,"isNumber");function l3(r){return r!==null&&typeof r=="object"&&!Array.isArray(r)}l(l3,"isObject");nt(l3,"isObject");function u3(r){if(!r)throw new Error("bbox is required");if(!Array.isArray(r))throw new Error("bbox must be an Array");if(r.length!==4&&r.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");r.forEach(t=>{if(!Wo(t))throw new Error("bbox must only contain numbers")})}l(u3,"validateBBox");nt(u3,"validateBBox");function c3(r){if(!r)throw new Error("id is required");if(["string","number"].indexOf(typeof r)===-1)throw new Error("id must be a number or a string")}l(c3,"validateId");nt(c3,"validateId");rt.GeojsonEquality=m8;rt.areaFactors=yh;rt.bearingToAzimuth=n3;rt.convertArea=s3;rt.convertLength=a3;rt.degreesToRadians=o3;rt.earthRadius=oe;rt.factors=gh;rt.feature=mr;rt.featureCollection=Uo;rt.geometry=J2;rt.geometryCollection=e3;rt.isNumber=Wo;rt.isObject=l3;rt.lengthToDegrees=i3;rt.lengthToRadians=zl;rt.lineString=Ul;rt.lineStrings=t3;rt.multiLineString=vh;rt.multiPoint=bh;rt.multiPolygon=Ch;rt.point=Wl;rt.points=K2;rt.polygon=Zl;rt.polygons=Q2;rt.radiansToDegrees=Sh;rt.radiansToLength=xh;rt.round=r3;rt.validateBBox=u3;rt.validateId=c3});var S3=k(Et=>{"use strict";d();Object.defineProperty(Et,"__esModule",{value:!0});var y8=Object.defineProperty,Rt=l((r,t)=>y8(r,"name",{value:t,configurable:!0}),"__name"),Yt=p3();function In(r,t,e){if(r!==null)for(var i,n,o,a,u,s,p,f=0,m=0,y,x=r.type,S=x==="FeatureCollection",M=x==="Feature",g=S?r.features.length:1,C=0;C<g;C++){p=S?r.features[C].geometry:M?r.geometry:r,y=p?p.type==="GeometryCollection":!1,u=y?p.geometries.length:1;for(var I=0;I<u;I++){var w=0,T=0;if(a=y?p.geometries[I]:p,a!==null){s=a.coordinates;var L=a.type;switch(f=e&&(L==="Polygon"||L==="MultiPolygon")?1:0,L){case null:break;case"Point":if(t(s,m,C,w,T)===!1)return!1;m++,w++;break;case"LineString":case"MultiPoint":for(i=0;i<s.length;i++){if(t(s[i],m,C,w,T)===!1)return!1;m++,L==="MultiPoint"&&w++}L==="LineString"&&w++;break;case"Polygon":case"MultiLineString":for(i=0;i<s.length;i++){for(n=0;n<s[i].length-f;n++){if(t(s[i][n],m,C,w,T)===!1)return!1;m++}L==="MultiLineString"&&w++,L==="Polygon"&&T++}L==="Polygon"&&w++;break;case"MultiPolygon":for(i=0;i<s.length;i++){for(T=0,n=0;n<s[i].length;n++){for(o=0;o<s[i][n].length-f;o++){if(t(s[i][n][o],m,C,w,T)===!1)return!1;m++}T++}w++}break;case"GeometryCollection":for(i=0;i<a.geometries.length;i++)if(In(a.geometries[i],t,e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}l(In,"coordEach");Rt(In,"coordEach");function h3(r,t,e,i){var n=e;return In(r,function(o,a,u,s,p){a===0&&e===void 0?n=o:n=t(n,o,a,u,s,p)},i),n}l(h3,"coordReduce");Rt(h3,"coordReduce");function Mh(r,t){var e;switch(r.type){case"FeatureCollection":for(e=0;e<r.features.length&&t(r.features[e].properties,e)!==!1;e++);break;case"Feature":t(r.properties,0);break}}l(Mh,"propEach");Rt(Mh,"propEach");function d3(r,t,e){var i=e;return Mh(r,function(n,o){o===0&&e===void 0?i=n:i=t(i,n,o)}),i}l(d3,"propReduce");Rt(d3,"propReduce");function Ph(r,t){if(r.type==="Feature")t(r,0);else if(r.type==="FeatureCollection")for(var e=0;e<r.features.length&&t(r.features[e],e)!==!1;e++);}l(Ph,"featureEach");Rt(Ph,"featureEach");function f3(r,t,e){var i=e;return Ph(r,function(n,o){o===0&&e===void 0?i=n:i=t(i,n,o)}),i}l(f3,"featureReduce");Rt(f3,"featureReduce");function m3(r){var t=[];return In(r,function(e){t.push(e)}),t}l(m3,"coordAll");Rt(m3,"coordAll");function ql(r,t){var e,i,n,o,a,u,s,p,f,m,y=0,x=r.type==="FeatureCollection",S=r.type==="Feature",M=x?r.features.length:1;for(e=0;e<M;e++){for(u=x?r.features[e].geometry:S?r.geometry:r,p=x?r.features[e].properties:S?r.properties:{},f=x?r.features[e].bbox:S?r.bbox:void 0,m=x?r.features[e].id:S?r.id:void 0,s=u?u.type==="GeometryCollection":!1,a=s?u.geometries.length:1,n=0;n<a;n++){if(o=s?u.geometries[n]:u,o===null){if(t(null,y,p,f,m)===!1)return!1;continue}switch(o.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(t(o,y,p,f,m)===!1)return!1;break}case"GeometryCollection":{for(i=0;i<o.geometries.length;i++)if(t(o.geometries[i],y,p,f,m)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}y++}}l(ql,"geomEach");Rt(ql,"geomEach");function y3(r,t,e){var i=e;return ql(r,function(n,o,a,u,s){o===0&&e===void 0?i=n:i=t(i,n,o,a,u,s)}),i}l(y3,"geomReduce");Rt(y3,"geomReduce");function zo(r,t){ql(r,function(e,i,n,o,a){var u=e===null?null:e.type;switch(u){case null:case"Point":case"LineString":case"Polygon":return t(Yt.feature.call(void 0,e,n,{bbox:o,id:a}),i,0)===!1?!1:void 0}var s;switch(u){case"MultiPoint":s="Point";break;case"MultiLineString":s="LineString";break;case"MultiPolygon":s="Polygon";break}for(var p=0;p<e.coordinates.length;p++){var f=e.coordinates[p],m={type:s,coordinates:f};if(t(Yt.feature.call(void 0,m,n),i,p)===!1)return!1}})}l(zo,"flattenEach");Rt(zo,"flattenEach");function g3(r,t,e){var i=e;return zo(r,function(n,o,a){o===0&&a===0&&e===void 0?i=n:i=t(i,n,o,a)}),i}l(g3,"flattenReduce");Rt(g3,"flattenReduce");function Th(r,t){zo(r,function(e,i,n){var o=0;if(e.geometry){var a=e.geometry.type;if(!(a==="Point"||a==="MultiPoint")){var u,s=0,p=0,f=0;if(In(e,function(m,y,x,S,M){if(u===void 0||i>s||S>p||M>f){u=m,s=i,p=S,f=M,o=0;return}var g=Yt.lineString.call(void 0,[u,m],e.properties);if(t(g,i,n,M,o)===!1)return!1;o++,u=m})===!1)return!1}}})}l(Th,"segmentEach");Rt(Th,"segmentEach");function v3(r,t,e){var i=e,n=!1;return Th(r,function(o,a,u,s,p){n===!1&&e===void 0?i=o:i=t(i,o,a,u,s,p),n=!0}),i}l(v3,"segmentReduce");Rt(v3,"segmentReduce");function wh(r,t){if(!r)throw new Error("geojson is required");zo(r,function(e,i,n){if(e.geometry!==null){var o=e.geometry.type,a=e.geometry.coordinates;switch(o){case"LineString":if(t(e,i,n,0,0)===!1)return!1;break;case"Polygon":for(var u=0;u<a.length;u++)if(t(Yt.lineString.call(void 0,a[u],e.properties),i,n,u)===!1)return!1;break}}})}l(wh,"lineEach");Rt(wh,"lineEach");function b3(r,t,e){var i=e;return wh(r,function(n,o,a,u){o===0&&e===void 0?i=n:i=t(i,n,o,a,u)}),i}l(b3,"lineReduce");Rt(b3,"lineReduce");function C3(r,t){if(t=t||{},!Yt.isObject.call(void 0,t))throw new Error("options is invalid");var e=t.featureIndex||0,i=t.multiFeatureIndex||0,n=t.geometryIndex||0,o=t.segmentIndex||0,a=t.properties,u;switch(r.type){case"FeatureCollection":e<0&&(e=r.features.length+e),a=a||r.features[e].properties,u=r.features[e].geometry;break;case"Feature":a=a||r.properties,u=r.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":u=r;break;default:throw new Error("geojson is invalid")}if(u===null)return null;var s=u.coordinates;switch(u.type){case"Point":case"MultiPoint":return null;case"LineString":return o<0&&(o=s.length+o-1),Yt.lineString.call(void 0,[s[o],s[o+1]],a,t);case"Polygon":return n<0&&(n=s.length+n),o<0&&(o=s[n].length+o-1),Yt.lineString.call(void 0,[s[n][o],s[n][o+1]],a,t);case"MultiLineString":return i<0&&(i=s.length+i),o<0&&(o=s[i].length+o-1),Yt.lineString.call(void 0,[s[i][o],s[i][o+1]],a,t);case"MultiPolygon":return i<0&&(i=s.length+i),n<0&&(n=s[i].length+n),o<0&&(o=s[i][n].length-o-1),Yt.lineString.call(void 0,[s[i][n][o],s[i][n][o+1]],a,t)}throw new Error("geojson is invalid")}l(C3,"findSegment");Rt(C3,"findSegment");function x3(r,t){if(t=t||{},!Yt.isObject.call(void 0,t))throw new Error("options is invalid");var e=t.featureIndex||0,i=t.multiFeatureIndex||0,n=t.geometryIndex||0,o=t.coordIndex||0,a=t.properties,u;switch(r.type){case"FeatureCollection":e<0&&(e=r.features.length+e),a=a||r.features[e].properties,u=r.features[e].geometry;break;case"Feature":a=a||r.properties,u=r.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":u=r;break;default:throw new Error("geojson is invalid")}if(u===null)return null;var s=u.coordinates;switch(u.type){case"Point":return Yt.point.call(void 0,s,a,t);case"MultiPoint":return i<0&&(i=s.length+i),Yt.point.call(void 0,s[i],a,t);case"LineString":return o<0&&(o=s.length+o),Yt.point.call(void 0,s[o],a,t);case"Polygon":return n<0&&(n=s.length+n),o<0&&(o=s[n].length+o),Yt.point.call(void 0,s[n][o],a,t);case"MultiLineString":return i<0&&(i=s.length+i),o<0&&(o=s[i].length+o),Yt.point.call(void 0,s[i][o],a,t);case"MultiPolygon":return i<0&&(i=s.length+i),n<0&&(n=s[i].length+n),o<0&&(o=s[i][n].length-o),Yt.point.call(void 0,s[i][n][o],a,t)}throw new Error("geojson is invalid")}l(x3,"findPoint");Rt(x3,"findPoint");Et.coordAll=m3;Et.coordEach=In;Et.coordReduce=h3;Et.featureEach=Ph;Et.featureReduce=f3;Et.findPoint=x3;Et.findSegment=C3;Et.flattenEach=zo;Et.flattenReduce=g3;Et.geomEach=ql;Et.geomReduce=y3;Et.lineEach=wh;Et.lineReduce=b3;Et.propEach=Mh;Et.propReduce=d3;Et.segmentEach=Th;Et.segmentReduce=v3});var M3=k($l=>{"use strict";d();Object.defineProperty($l,"__esModule",{value:!0});var g8=Object.defineProperty,v8=l((r,t)=>g8(r,"name",{value:t,configurable:!0}),"__name"),b8=S3();function Ih(r,t={}){if(r.bbox!=null&&t.recompute!==!0)return r.bbox;let e=[1/0,1/0,-1/0,-1/0];return b8.coordEach.call(void 0,r,i=>{e[0]>i[0]&&(e[0]=i[0]),e[1]>i[1]&&(e[1]=i[1]),e[2]<i[0]&&(e[2]=i[0]),e[3]<i[1]&&(e[3]=i[1])}),e}l(Ih,"bbox");v8(Ih,"bbox");var C8=Ih;$l.bbox=Ih;$l.default=C8});var E3=k((D_,Eh)=>{d();var ze=S1(),T3=qc(),w3=O1(),En=M3().default,x8=w3.featureEach,L_=w3.coordEach,__=T3.polygon,P3=T3.featureCollection;function I3(r){var t=new ze(r);return t.insert=function(e){if(e.type!=="Feature")throw new Error("invalid feature");return e.bbox=e.bbox?e.bbox:En(e),ze.prototype.insert.call(this,e)},t.load=function(e){var i=[];return Array.isArray(e)?e.forEach(function(n){if(n.type!=="Feature")throw new Error("invalid features");n.bbox=n.bbox?n.bbox:En(n),i.push(n)}):x8(e,function(n){if(n.type!=="Feature")throw new Error("invalid features");n.bbox=n.bbox?n.bbox:En(n),i.push(n)}),ze.prototype.load.call(this,i)},t.remove=function(e,i){if(e.type!=="Feature")throw new Error("invalid feature");return e.bbox=e.bbox?e.bbox:En(e),ze.prototype.remove.call(this,e,i)},t.clear=function(){return ze.prototype.clear.call(this)},t.search=function(e){var i=ze.prototype.search.call(this,this.toBBox(e));return P3(i)},t.collides=function(e){return ze.prototype.collides.call(this,this.toBBox(e))},t.all=function(){var e=ze.prototype.all.call(this);return P3(e)},t.toJSON=function(){return ze.prototype.toJSON.call(this)},t.fromJSON=function(e){return ze.prototype.fromJSON.call(this,e)},t.toBBox=function(e){var i;if(e.bbox)i=e.bbox;else if(Array.isArray(e)&&e.length===4)i=e;else if(Array.isArray(e)&&e.length===6)i=[e[0],e[1],e[3],e[4]];else if(e.type==="Feature")i=En(e);else if(e.type==="FeatureCollection")i=En(e);else throw new Error("invalid geojson");return{minX:i[0],minY:i[1],maxX:i[2],maxY:i[3]}},t}l(I3,"geojsonRbush");Eh.exports=I3;Eh.exports.default=I3});var Kn=k((Ad,kd)=>{d();var Nd=l(function(){this._tweens={},this._tweensAddedDuringUpdate={}},"_Group");Nd.prototype={getAll:function(){return Object.keys(this._tweens).map(function(r){return this._tweens[r]}.bind(this))},removeAll:function(){this._tweens={}},add:function(r){this._tweens[r.getId()]=r,this._tweensAddedDuringUpdate[r.getId()]=r},remove:function(r){delete this._tweens[r.getId()],delete this._tweensAddedDuringUpdate[r.getId()]},update:function(r,t){var e=Object.keys(this._tweens);if(e.length===0)return!1;for(r=r!==void 0?r:at.now();e.length>0;){this._tweensAddedDuringUpdate={};for(var i=0;i<e.length;i++){var n=this._tweens[e[i]];n&&n.update(r)===!1&&(n._isPlaying=!1,t||delete this._tweens[e[i]])}e=Object.keys(this._tweensAddedDuringUpdate)}return!0}};var at=new Nd;at.Group=Nd;at._nextId=0;at.nextId=function(){return at._nextId++};typeof self>"u"&&typeof b<"u"&&b.hrtime?at.now=function(){var r=b.hrtime();return r[0]*1e3+r[1]/1e6}:typeof self<"u"&&self.performance!==void 0&&self.performance.now!==void 0?at.now=self.performance.now.bind(self.performance):Date.now!==void 0?at.now=Date.now:at.now=function(){return new Date().getTime()};at.Tween=function(r,t){this._object=r,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._repeat=0,this._repeatDelayTime=void 0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=null,this._easingFunction=at.Easing.Linear.None,this._interpolationFunction=at.Interpolation.Linear,this._chainedTweens=[],this._onStartCallback=null,this._onStartCallbackFired=!1,this._onUpdateCallback=null,this._onRepeatCallback=null,this._onCompleteCallback=null,this._onStopCallback=null,this._group=t||at,this._id=at.nextId()};at.Tween.prototype={getId:function(){return this._id},isPlaying:function(){return this._isPlaying},to:function(r,t){return this._valuesEnd=r,t!==void 0&&(this._duration=t),this},duration:l(function(t){return this._duration=t,this},"duration"),start:function(r){this._group.add(this),this._isPlaying=!0,this._onStartCallbackFired=!1,this._startTime=r!==void 0?typeof r=="string"?at.now()+parseFloat(r):r:at.now(),this._startTime+=this._delayTime;for(var t in this._valuesEnd){if(this._valuesEnd[t]instanceof Array){if(this._valuesEnd[t].length===0)continue;this._valuesEnd[t]=[this._object[t]].concat(this._valuesEnd[t])}this._object[t]!==void 0&&(this._valuesStart[t]=this._object[t],this._valuesStart[t]instanceof Array||(this._valuesStart[t]*=1),this._valuesStartRepeat[t]=this._valuesStart[t]||0)}return this},stop:function(){return this._isPlaying?(this._group.remove(this),this._isPlaying=!1,this._onStopCallback!==null&&this._onStopCallback(this._object),this.stopChainedTweens(),this):this},end:function(){return this.update(1/0),this},stopChainedTweens:function(){for(var r=0,t=this._chainedTweens.length;r<t;r++)this._chainedTweens[r].stop()},group:function(r){return this._group=r,this},delay:function(r){return this._delayTime=r,this},repeat:function(r){return this._repeat=r,this},repeatDelay:function(r){return this._repeatDelayTime=r,this},yoyo:function(r){return this._yoyo=r,this},easing:function(r){return this._easingFunction=r,this},interpolation:function(r){return this._interpolationFunction=r,this},chain:function(){return this._chainedTweens=arguments,this},onStart:function(r){return this._onStartCallback=r,this},onUpdate:function(r){return this._onUpdateCallback=r,this},onRepeat:l(function(t){return this._onRepeatCallback=t,this},"onRepeat"),onComplete:function(r){return this._onCompleteCallback=r,this},onStop:function(r){return this._onStopCallback=r,this},update:function(r){var t,e,i;if(r<this._startTime)return!0;this._onStartCallbackFired===!1&&(this._onStartCallback!==null&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),e=(r-this._startTime)/this._duration,e=this._duration===0||e>1?1:e,i=this._easingFunction(e);for(t in this._valuesEnd)if(this._valuesStart[t]!==void 0){var n=this._valuesStart[t]||0,o=this._valuesEnd[t];o instanceof Array?this._object[t]=this._interpolationFunction(o,i):(typeof o=="string"&&(o.charAt(0)==="+"||o.charAt(0)==="-"?o=n+parseFloat(o):o=parseFloat(o)),typeof o=="number"&&(this._object[t]=n+(o-n)*i))}if(this._onUpdateCallback!==null&&this._onUpdateCallback(this._object,e),e===1)if(this._repeat>0){isFinite(this._repeat)&&this._repeat--;for(t in this._valuesStartRepeat){if(typeof this._valuesEnd[t]=="string"&&(this._valuesStartRepeat[t]=this._valuesStartRepeat[t]+parseFloat(this._valuesEnd[t])),this._yoyo){var a=this._valuesStartRepeat[t];this._valuesStartRepeat[t]=this._valuesEnd[t],this._valuesEnd[t]=a}this._valuesStart[t]=this._valuesStartRepeat[t]}return this._yoyo&&(this._reversed=!this._reversed),this._repeatDelayTime!==void 0?this._startTime=r+this._repeatDelayTime:this._startTime=r+this._delayTime,this._onRepeatCallback!==null&&this._onRepeatCallback(this._object),!0}else{this._onCompleteCallback!==null&&this._onCompleteCallback(this._object);for(var u=0,s=this._chainedTweens.length;u<s;u++)this._chainedTweens[u].start(this._startTime+this._duration);return!1}return!0}};at.Easing={Linear:{None:function(r){return r}},Quadratic:{In:function(r){return r*r},Out:function(r){return r*(2-r)},InOut:function(r){return(r*=2)<1?.5*r*r:-.5*(--r*(r-2)-1)}},Cubic:{In:function(r){return r*r*r},Out:function(r){return--r*r*r+1},InOut:function(r){return(r*=2)<1?.5*r*r*r:.5*((r-=2)*r*r+2)}},Quartic:{In:function(r){return r*r*r*r},Out:function(r){return 1- --r*r*r*r},InOut:function(r){return(r*=2)<1?.5*r*r*r*r:-.5*((r-=2)*r*r*r-2)}},Quintic:{In:function(r){return r*r*r*r*r},Out:function(r){return--r*r*r*r*r+1},InOut:function(r){return(r*=2)<1?.5*r*r*r*r*r:.5*((r-=2)*r*r*r*r+2)}},Sinusoidal:{In:function(r){return 1-Math.cos(r*Math.PI/2)},Out:function(r){return Math.sin(r*Math.PI/2)},InOut:function(r){return .5*(1-Math.cos(Math.PI*r))}},Exponential:{In:function(r){return r===0?0:Math.pow(1024,r-1)},Out:function(r){return r===1?1:1-Math.pow(2,-10*r)},InOut:function(r){return r===0?0:r===1?1:(r*=2)<1?.5*Math.pow(1024,r-1):.5*(-Math.pow(2,-10*(r-1))+2)}},Circular:{In:function(r){return 1-Math.sqrt(1-r*r)},Out:function(r){return Math.sqrt(1- --r*r)},InOut:function(r){return(r*=2)<1?-.5*(Math.sqrt(1-r*r)-1):.5*(Math.sqrt(1-(r-=2)*r)+1)}},Elastic:{In:function(r){return r===0?0:r===1?1:-Math.pow(2,10*(r-1))*Math.sin((r-1.1)*5*Math.PI)},Out:function(r){return r===0?0:r===1?1:Math.pow(2,-10*r)*Math.sin((r-.1)*5*Math.PI)+1},InOut:function(r){return r===0?0:r===1?1:(r*=2,r<1?-.5*Math.pow(2,10*(r-1))*Math.sin((r-1.1)*5*Math.PI):.5*Math.pow(2,-10*(r-1))*Math.sin((r-1.1)*5*Math.PI)+1)}},Back:{In:function(r){var t=1.70158;return r*r*((t+1)*r-t)},Out:function(r){var t=1.70158;return--r*r*((t+1)*r+t)+1},InOut:function(r){var t=2.5949095;return(r*=2)<1?.5*(r*r*((t+1)*r-t)):.5*((r-=2)*r*((t+1)*r+t)+2)}},Bounce:{In:function(r){return 1-at.Easing.Bounce.Out(1-r)},Out:function(r){return r<1/2.75?7.5625*r*r:r<2/2.75?7.5625*(r-=1.5/2.75)*r+.75:r<2.5/2.75?7.5625*(r-=2.25/2.75)*r+.9375:7.5625*(r-=2.625/2.75)*r+.984375},InOut:function(r){return r<.5?at.Easing.Bounce.In(r*2)*.5:at.Easing.Bounce.Out(r*2-1)*.5+.5}}};at.Interpolation={Linear:function(r,t){var e=r.length-1,i=e*t,n=Math.floor(i),o=at.Interpolation.Utils.Linear;return t<0?o(r[0],r[1],i):t>1?o(r[e],r[e-1],e-i):o(r[n],r[n+1>e?e:n+1],i-n)},Bezier:function(r,t){for(var e=0,i=r.length-1,n=Math.pow,o=at.Interpolation.Utils.Bernstein,a=0;a<=i;a++)e+=n(1-t,i-a)*n(t,a)*r[a]*o(i,a);return e},CatmullRom:function(r,t){var e=r.length-1,i=e*t,n=Math.floor(i),o=at.Interpolation.Utils.CatmullRom;return r[0]===r[e]?(t<0&&(n=Math.floor(i=e*(1+t))),o(r[(n-1+e)%e],r[n],r[(n+1)%e],r[(n+2)%e],i-n)):t<0?r[0]-(o(r[0],r[0],r[1],r[1],-i)-r[0]):t>1?r[e]-(o(r[e],r[e],r[e-1],r[e-1],i-e)-r[e]):o(r[n?n-1:0],r[n],r[e<n+1?e:n+1],r[e<n+2?e:n+2],i-n)},Utils:{Linear:function(r,t,e){return(t-r)*e+r},Bernstein:function(r,t){var e=at.Interpolation.Utils.Factorial;return e(r)/e(t)/e(r-t)},Factorial:function(){var r=[1];return function(t){var e=1;if(r[t])return r[t];for(var i=t;i>1;i--)e*=i;return r[t]=e,e}}(),CatmullRom:function(r,t,e,i,n){var o=(e-r)*.5,a=(i-t)*.5,u=n*n,s=n*u;return(2*t-2*e+o+a)*s+(-3*t+3*e-2*o-a)*u+o*n+t}}};(function(r){typeof define=="function"&&define.amd?define([],function(){return at}):typeof kd<"u"&&typeof Ad=="object"?kd.exports=at:r!==void 0&&(r.TWEEN=at)})(Ad)});var hb=k((Fa,ro)=>{d();var w9=200,Wv="__lodash_hash_undefined__",I9=800,E9=16,Zv=9007199254740991,Uv="[object Arguments]",L9="[object Array]",_9="[object AsyncFunction]",D9="[object Boolean]",O9="[object Date]",A9="[object Error]",zv="[object Function]",k9="[object GeneratorFunction]",N9="[object Map]",R9="[object Number]",B9="[object Null]",qv="[object Object]",F9="[object Proxy]",G9="[object RegExp]",V9="[object Set]",H9="[object String]",X9="[object Undefined]",Y9="[object WeakMap]",j9="[object ArrayBuffer]",W9="[object DataView]",Z9="[object Float32Array]",U9="[object Float64Array]",z9="[object Int8Array]",q9="[object Int16Array]",$9="[object Int32Array]",J9="[object Uint8Array]",K9="[object Uint8ClampedArray]",Q9="[object Uint16Array]",tx="[object Uint32Array]",ex=/[\\^$.*+?()[\]{}|]/g,rx=/^\[object .+?Constructor\]$/,ix=/^(?:0|[1-9]\d*)$/,pt={};pt[Z9]=pt[U9]=pt[z9]=pt[q9]=pt[$9]=pt[J9]=pt[K9]=pt[Q9]=pt[tx]=!0;pt[Uv]=pt[L9]=pt[j9]=pt[D9]=pt[W9]=pt[O9]=pt[A9]=pt[zv]=pt[N9]=pt[R9]=pt[qv]=pt[G9]=pt[V9]=pt[H9]=pt[Y9]=!1;var $v=typeof global=="object"&&global&&global.Object===Object&&global,nx=typeof self=="object"&&self&&self.Object===Object&&self,Ha=$v||nx||Function("return this")(),Jv=typeof Fa=="object"&&Fa&&!Fa.nodeType&&Fa,Ga=Jv&&typeof ro=="object"&&ro&&!ro.nodeType&&ro,Kv=Ga&&Ga.exports===Jv,lf=Kv&&$v.process,Rv=function(){try{var r=Ga&&Ga.require&&Ga.require("util").types;return r||lf&&lf.binding&&lf.binding("util")}catch{}}(),Bv=Rv&&Rv.isTypedArray;function Qv(r,t,e){switch(e.length){case 0:return r.call(t);case 1:return r.call(t,e[0]);case 2:return r.call(t,e[0],e[1]);case 3:return r.call(t,e[0],e[1],e[2])}return r.apply(t,e)}l(Qv,"apply");function ox(r,t){for(var e=-1,i=Array(r);++e<r;)i[e]=t(e);return i}l(ox,"baseTimes");function ax(r){return function(t){return r(t)}}l(ax,"baseUnary");function sx(r,t){return r==null?void 0:r[t]}l(sx,"getValue");function lx(r,t){return function(e){return r(t(e))}}l(lx,"overArg");var ux=Array.prototype,cx=Function.prototype,Lu=Object.prototype,uf=Ha["__core-js_shared__"],_u=cx.toString,Er=Lu.hasOwnProperty,Fv=function(){var r=/[^.]+$/.exec(uf&&uf.keys&&uf.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""}(),tb=Lu.toString,px=_u.call(Object),hx=RegExp("^"+_u.call(Er).replace(ex,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Iu=Kv?Ha.Buffer:void 0,Gv=Ha.Symbol,Vv=Ha.Uint8Array,Hv=Iu?Iu.allocUnsafe:void 0,eb=lx(Object.getPrototypeOf,Object),Xv=Object.create,dx=Lu.propertyIsEnumerable,fx=ux.splice,Zi=Gv?Gv.toStringTag:void 0,Eu=function(){try{var r=yf(Object,"defineProperty");return r({},"",{}),r}catch{}}(),mx=Iu?Iu.isBuffer:void 0,Yv=Math.max,yx=Date.now,rb=yf(Ha,"Map"),Va=yf(Object,"create"),gx=function(){function r(){}return l(r,"object"),function(t){if(!Ir(t))return{};if(Xv)return Xv(t);r.prototype=t;var e=new r;return r.prototype=void 0,e}}();function Ui(r){var t=-1,e=r==null?0:r.length;for(this.clear();++t<e;){var i=r[t];this.set(i[0],i[1])}}l(Ui,"Hash");function vx(){this.__data__=Va?Va(null):{},this.size=0}l(vx,"hashClear");function bx(r){var t=this.has(r)&&delete this.__data__[r];return this.size-=t?1:0,t}l(bx,"hashDelete");function Cx(r){var t=this.__data__;if(Va){var e=t[r];return e===Wv?void 0:e}return Er.call(t,r)?t[r]:void 0}l(Cx,"hashGet");function xx(r){var t=this.__data__;return Va?t[r]!==void 0:Er.call(t,r)}l(xx,"hashHas");function Sx(r,t){var e=this.__data__;return this.size+=this.has(r)?0:1,e[r]=Va&&t===void 0?Wv:t,this}l(Sx,"hashSet");Ui.prototype.clear=vx;Ui.prototype.delete=bx;Ui.prototype.get=Cx;Ui.prototype.has=xx;Ui.prototype.set=Sx;function Lr(r){var t=-1,e=r==null?0:r.length;for(this.clear();++t<e;){var i=r[t];this.set(i[0],i[1])}}l(Lr,"ListCache");function Mx(){this.__data__=[],this.size=0}l(Mx,"listCacheClear");function Px(r){var t=this.__data__,e=Du(t,r);if(e<0)return!1;var i=t.length-1;return e==i?t.pop():fx.call(t,e,1),--this.size,!0}l(Px,"listCacheDelete");function Tx(r){var t=this.__data__,e=Du(t,r);return e<0?void 0:t[e][1]}l(Tx,"listCacheGet");function wx(r){return Du(this.__data__,r)>-1}l(wx,"listCacheHas");function Ix(r,t){var e=this.__data__,i=Du(e,r);return i<0?(++this.size,e.push([r,t])):e[i][1]=t,this}l(Ix,"listCacheSet");Lr.prototype.clear=Mx;Lr.prototype.delete=Px;Lr.prototype.get=Tx;Lr.prototype.has=wx;Lr.prototype.set=Ix;function io(r){var t=-1,e=r==null?0:r.length;for(this.clear();++t<e;){var i=r[t];this.set(i[0],i[1])}}l(io,"MapCache");function Ex(){this.size=0,this.__data__={hash:new Ui,map:new(rb||Lr),string:new Ui}}l(Ex,"mapCacheClear");function Lx(r){var t=Au(this,r).delete(r);return this.size-=t?1:0,t}l(Lx,"mapCacheDelete");function _x(r){return Au(this,r).get(r)}l(_x,"mapCacheGet");function Dx(r){return Au(this,r).has(r)}l(Dx,"mapCacheHas");function Ox(r,t){var e=Au(this,r),i=e.size;return e.set(r,t),this.size+=e.size==i?0:1,this}l(Ox,"mapCacheSet");io.prototype.clear=Ex;io.prototype.delete=Lx;io.prototype.get=_x;io.prototype.has=Dx;io.prototype.set=Ox;function no(r){var t=this.__data__=new Lr(r);this.size=t.size}l(no,"Stack");function Ax(){this.__data__=new Lr,this.size=0}l(Ax,"stackClear");function kx(r){var t=this.__data__,e=t.delete(r);return this.size=t.size,e}l(kx,"stackDelete");function Nx(r){return this.__data__.get(r)}l(Nx,"stackGet");function Rx(r){return this.__data__.has(r)}l(Rx,"stackHas");function Bx(r,t){var e=this.__data__;if(e instanceof Lr){var i=e.__data__;if(!rb||i.length<w9-1)return i.push([r,t]),this.size=++e.size,this;e=this.__data__=new io(i)}return e.set(r,t),this.size=e.size,this}l(Bx,"stackSet");no.prototype.clear=Ax;no.prototype.delete=kx;no.prototype.get=Nx;no.prototype.has=Rx;no.prototype.set=Bx;function Fx(r,t){var e=df(r),i=!e&&hf(r),n=!e&&!i&&sb(r),o=!e&&!i&&!n&&ub(r),a=e||i||n||o,u=a?ox(r.length,String):[],s=u.length;for(var p in r)(t||Er.call(r,p))&&!(a&&(p=="length"||n&&(p=="offset"||p=="parent")||o&&(p=="buffer"||p=="byteLength"||p=="byteOffset")||ob(p,s)))&&u.push(p);return u}l(Fx,"arrayLikeKeys");function cf(r,t,e){(e!==void 0&&!ku(r[t],e)||e===void 0&&!(t in r))&&ff(r,t,e)}l(cf,"assignMergeValue");function Gx(r,t,e){var i=r[t];(!(Er.call(r,t)&&ku(i,e))||e===void 0&&!(t in r))&&ff(r,t,e)}l(Gx,"assignValue");function Du(r,t){for(var e=r.length;e--;)if(ku(r[e][0],t))return e;return-1}l(Du,"assocIndexOf");function ff(r,t,e){t=="__proto__"&&Eu?Eu(r,t,{configurable:!0,enumerable:!0,value:e,writable:!0}):r[t]=e}l(ff,"baseAssignValue");var Vx=Kx();function Ou(r){return r==null?r===void 0?X9:B9:Zi&&Zi in Object(r)?Qx(r):oS(r)}l(Ou,"baseGetTag");function jv(r){return Xa(r)&&Ou(r)==Uv}l(jv,"baseIsArguments");function Hx(r){if(!Ir(r)||iS(r))return!1;var t=vf(r)?hx:rx;return t.test(uS(r))}l(Hx,"baseIsNative");function Xx(r){return Xa(r)&&lb(r.length)&&!!pt[Ou(r)]}l(Xx,"baseIsTypedArray");function Yx(r){if(!Ir(r))return nS(r);var t=ab(r),e=[];for(var i in r)i=="constructor"&&(t||!Er.call(r,i))||e.push(i);return e}l(Yx,"baseKeysIn");function mf(r,t,e,i,n){r!==t&&Vx(t,function(o,a){if(n||(n=new no),Ir(o))jx(r,t,a,e,mf,i,n);else{var u=i?i(pf(r,a),o,a+"",r,t,n):void 0;u===void 0&&(u=o),cf(r,a,u)}},cb)}l(mf,"baseMerge");function jx(r,t,e,i,n,o,a){var u=pf(r,e),s=pf(t,e),p=a.get(s);if(p){cf(r,e,p);return}var f=o?o(u,s,e+"",r,t,a):void 0,m=f===void 0;if(m){var y=df(s),x=!y&&sb(s),S=!y&&!x&&ub(s);f=s,y||x||S?df(u)?f=u:cS(u)?f=qx(u):x?(m=!1,f=Zx(s,!0)):S?(m=!1,f=zx(s,!0)):f=[]:pS(s)||hf(s)?(f=u,hf(u)?f=hS(u):(!Ir(u)||vf(u))&&(f=tS(s))):m=!1}m&&(a.set(s,f),n(f,s,i,o,a),a.delete(s)),cf(r,e,f)}l(jx,"baseMergeDeep");function ib(r,t){return sS(aS(r,t,pb),r+"")}l(ib,"baseRest");var Wx=Eu?function(r,t){return Eu(r,"toString",{configurable:!0,enumerable:!1,value:mS(t),writable:!0})}:pb;function Zx(r,t){if(t)return r.slice();var e=r.length,i=Hv?Hv(e):new r.constructor(e);return r.copy(i),i}l(Zx,"cloneBuffer");function Ux(r){var t=new r.constructor(r.byteLength);return new Vv(t).set(new Vv(r)),t}l(Ux,"cloneArrayBuffer");function zx(r,t){var e=t?Ux(r.buffer):r.buffer;return new r.constructor(e,r.byteOffset,r.length)}l(zx,"cloneTypedArray");function qx(r,t){var e=-1,i=r.length;for(t||(t=Array(i));++e<i;)t[e]=r[e];return t}l(qx,"copyArray");function $x(r,t,e,i){var n=!e;e||(e={});for(var o=-1,a=t.length;++o<a;){var u=t[o],s=i?i(e[u],r[u],u,e,r):void 0;s===void 0&&(s=r[u]),n?ff(e,u,s):Gx(e,u,s)}return e}l($x,"copyObject");function Jx(r){return ib(function(t,e){var i=-1,n=e.length,o=n>1?e[n-1]:void 0,a=n>2?e[2]:void 0;for(o=r.length>3&&typeof o=="function"?(n--,o):void 0,a&&eS(e[0],e[1],a)&&(o=n<3?void 0:o,n=1),t=Object(t);++i<n;){var u=e[i];u&&r(t,u,i,o)}return t})}l(Jx,"createAssigner");function Kx(r){return function(t,e,i){for(var n=-1,o=Object(t),a=i(t),u=a.length;u--;){var s=a[r?u:++n];if(e(o[s],s,o)===!1)break}return t}}l(Kx,"createBaseFor");function nb(r,t,e,i,n,o){return Ir(r)&&Ir(t)&&(o.set(t,r),mf(r,t,void 0,nb,o),o.delete(t)),r}l(nb,"customDefaultsMerge");function Au(r,t){var e=r.__data__;return rS(t)?e[typeof t=="string"?"string":"hash"]:e.map}l(Au,"getMapData");function yf(r,t){var e=sx(r,t);return Hx(e)?e:void 0}l(yf,"getNative");function Qx(r){var t=Er.call(r,Zi),e=r[Zi];try{r[Zi]=void 0;var i=!0}catch{}var n=tb.call(r);return i&&(t?r[Zi]=e:delete r[Zi]),n}l(Qx,"getRawTag");function tS(r){return typeof r.constructor=="function"&&!ab(r)?gx(eb(r)):{}}l(tS,"initCloneObject");function ob(r,t){var e=typeof r;return t=t==null?Zv:t,!!t&&(e=="number"||e!="symbol"&&ix.test(r))&&r>-1&&r%1==0&&r<t}l(ob,"isIndex");function eS(r,t,e){if(!Ir(e))return!1;var i=typeof t;return(i=="number"?gf(e)&&ob(t,e.length):i=="string"&&t in e)?ku(e[t],r):!1}l(eS,"isIterateeCall");function rS(r){var t=typeof r;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?r!=="__proto__":r===null}l(rS,"isKeyable");function iS(r){return!!Fv&&Fv in r}l(iS,"isMasked");function ab(r){var t=r&&r.constructor,e=typeof t=="function"&&t.prototype||Lu;return r===e}l(ab,"isPrototype");function nS(r){var t=[];if(r!=null)for(var e in Object(r))t.push(e);return t}l(nS,"nativeKeysIn");function oS(r){return tb.call(r)}l(oS,"objectToString");function aS(r,t,e){return t=Yv(t===void 0?r.length-1:t,0),function(){for(var i=arguments,n=-1,o=Yv(i.length-t,0),a=Array(o);++n<o;)a[n]=i[t+n];n=-1;for(var u=Array(t+1);++n<t;)u[n]=i[n];return u[t]=e(a),Qv(r,this,u)}}l(aS,"overRest");function pf(r,t){if(!(t==="constructor"&&typeof r[t]=="function")&&t!="__proto__")return r[t]}l(pf,"safeGet");var sS=lS(Wx);function lS(r){var t=0,e=0;return function(){var i=yx(),n=E9-(i-e);if(e=i,n>0){if(++t>=I9)return arguments[0]}else t=0;return r.apply(void 0,arguments)}}l(lS,"shortOut");function uS(r){if(r!=null){try{return _u.call(r)}catch{}try{return r+""}catch{}}return""}l(uS,"toSource");function ku(r,t){return r===t||r!==r&&t!==t}l(ku,"eq");var hf=jv(function(){return arguments}())?jv:function(r){return Xa(r)&&Er.call(r,"callee")&&!dx.call(r,"callee")},df=Array.isArray;function gf(r){return r!=null&&lb(r.length)&&!vf(r)}l(gf,"isArrayLike");function cS(r){return Xa(r)&&gf(r)}l(cS,"isArrayLikeObject");var sb=mx||yS;function vf(r){if(!Ir(r))return!1;var t=Ou(r);return t==zv||t==k9||t==_9||t==F9}l(vf,"isFunction");function lb(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=Zv}l(lb,"isLength");function Ir(r){var t=typeof r;return r!=null&&(t=="object"||t=="function")}l(Ir,"isObject");function Xa(r){return r!=null&&typeof r=="object"}l(Xa,"isObjectLike");function pS(r){if(!Xa(r)||Ou(r)!=qv)return!1;var t=eb(r);if(t===null)return!0;var e=Er.call(t,"constructor")&&t.constructor;return typeof e=="function"&&e instanceof e&&_u.call(e)==px}l(pS,"isPlainObject");var ub=Bv?ax(Bv):Xx;function hS(r){return $x(r,cb(r))}l(hS,"toPlainObject");var dS=ib(function(r){return r.push(void 0,nb),Qv(fS,void 0,r)});function cb(r){return gf(r)?Fx(r,!0):Yx(r)}l(cb,"keysIn");var fS=Jx(function(r,t,e,i){mf(r,t,e,i)});function mS(r){return function(){return r}}l(mS,"constant");function pb(r){return r}l(pb,"identity");function yS(){return!1}l(yS,"stubFalse");ro.exports=dS});var Zb=k((UH,$a)=>{"use strict";d();var NS=!1,Ki=!1,Gb=!0,Vb=!1,h={},Hb=!1;typeof $a<"u"&&$a.exports?($a.exports=h,Hb=!0):typeof document<"u"?window.ClipperLib=h:self.ClipperLib=h;var Zu;Hb?(Ot="chrome",Zu="Netscape"):(Ot=navigator.userAgent.toString().toLowerCase(),Zu=navigator.appName);var Ot,z={};Ot.indexOf("chrome")!=-1&&Ot.indexOf("chromium")==-1?z.chrome=1:z.chrome=0;Ot.indexOf("chromium")!=-1?z.chromium=1:z.chromium=0;Ot.indexOf("safari")!=-1&&Ot.indexOf("chrome")==-1&&Ot.indexOf("chromium")==-1?z.safari=1:z.safari=0;Ot.indexOf("firefox")!=-1?z.firefox=1:z.firefox=0;Ot.indexOf("firefox/17")!=-1?z.firefox17=1:z.firefox17=0;Ot.indexOf("firefox/15")!=-1?z.firefox15=1:z.firefox15=0;Ot.indexOf("firefox/3")!=-1?z.firefox3=1:z.firefox3=0;Ot.indexOf("opera")!=-1?z.opera=1:z.opera=0;Ot.indexOf("msie 10")!=-1?z.msie10=1:z.msie10=0;Ot.indexOf("msie 9")!=-1?z.msie9=1:z.msie9=0;Ot.indexOf("msie 8")!=-1?z.msie8=1:z.msie8=0;Ot.indexOf("msie 7")!=-1?z.msie7=1:z.msie7=0;Ot.indexOf("msie ")!=-1?z.msie=1:z.msie=0;h.biginteger_used=null;var li,RS=0xdeadbeefcafe,Bb=(RS&16777215)==15715070;function O(r,t,e){h.biginteger_used=1,r!=null&&(typeof r=="number"&&typeof t>"u"?this.fromInt(r):typeof r=="number"?this.fromNumber(r,t,e):t==null&&typeof r!="string"?this.fromString(r,256):this.fromString(r,t))}l(O,"BigInteger");function J(){return new O(null)}l(J,"nbi");function BS(r,t,e,i,n,o){for(;--o>=0;){var a=t*this[r++]+e[i]+n;n=Math.floor(a/67108864),e[i++]=a&67108863}return n}l(BS,"am1");function FS(r,t,e,i,n,o){for(var a=t&32767,u=t>>15;--o>=0;){var s=this[r]&32767,p=this[r++]>>15,f=u*s+p*a;s=a*s+((f&32767)<<15)+e[i]+(n&1073741823),n=(s>>>30)+(f>>>15)+u*p+(n>>>30),e[i++]=s&1073741823}return n}l(FS,"am2");function GS(r,t,e,i,n,o){for(var a=t&16383,u=t>>14;--o>=0;){var s=this[r]&16383,p=this[r++]>>14,f=u*s+p*a;s=a*s+((f&16383)<<14)+e[i]+n,n=(s>>28)+(f>>14)+u*p,e[i++]=s&268435455}return n}l(GS,"am3");Bb&&Zu=="Microsoft Internet Explorer"?(O.prototype.am=FS,li=30):Bb&&Zu!="Netscape"?(O.prototype.am=BS,li=26):(O.prototype.am=GS,li=28);O.prototype.DB=li;O.prototype.DM=(1<<li)-1;O.prototype.DV=1<<li;var Nf=52;O.prototype.FV=Math.pow(2,Nf);O.prototype.F1=Nf-li;O.prototype.F2=2*li-Nf;var VS="0123456789abcdefghijklmnopqrstuvwxyz",zu=new Array,uo,be;uo=48;for(be=0;be<=9;++be)zu[uo++]=be;uo=97;for(be=10;be<36;++be)zu[uo++]=be;uo=65;for(be=10;be<36;++be)zu[uo++]=be;function Fb(r){return VS.charAt(r)}l(Fb,"int2char");function Xb(r,t){var e=zu[r.charCodeAt(t)];return e==null?-1:e}l(Xb,"intAt");function HS(r){for(var t=this.t-1;t>=0;--t)r[t]=this[t];r.t=this.t,r.s=this.s}l(HS,"bnpCopyTo");function XS(r){this.t=1,this.s=r<0?-1:0,r>0?this[0]=r:r<-1?this[0]=r+this.DV:this.t=0}l(XS,"bnpFromInt");function si(r){var t=J();return t.fromInt(r),t}l(si,"nbv");function YS(r,t){var e;if(t==16)e=4;else if(t==8)e=3;else if(t==256)e=8;else if(t==2)e=1;else if(t==32)e=5;else if(t==4)e=2;else{this.fromRadix(r,t);return}this.t=0,this.s=0;for(var i=r.length,n=!1,o=0;--i>=0;){var a=e==8?r[i]&255:Xb(r,i);if(a<0){r.charAt(i)=="-"&&(n=!0);continue}n=!1,o==0?this[this.t++]=a:o+e>this.DB?(this[this.t-1]|=(a&(1<<this.DB-o)-1)<<o,this[this.t++]=a>>this.DB-o):this[this.t-1]|=a<<o,o+=e,o>=this.DB&&(o-=this.DB)}e==8&&r[0]&128&&(this.s=-1,o>0&&(this[this.t-1]|=(1<<this.DB-o)-1<<o)),this.clamp(),n&&O.ZERO.subTo(this,this)}l(YS,"bnpFromString");function jS(){for(var r=this.s&this.DM;this.t>0&&this[this.t-1]==r;)--this.t}l(jS,"bnpClamp");function WS(r){if(this.s<0)return"-"+this.negate().toString(r);var t;if(r==16)t=4;else if(r==8)t=3;else if(r==2)t=1;else if(r==32)t=5;else if(r==4)t=2;else return this.toRadix(r);var e=(1<<t)-1,i,n=!1,o="",a=this.t,u=this.DB-a*this.DB%t;if(a-- >0)for(u<this.DB&&(i=this[a]>>u)>0&&(n=!0,o=Fb(i));a>=0;)u<t?(i=(this[a]&(1<<u)-1)<<t-u,i|=this[--a]>>(u+=this.DB-t)):(i=this[a]>>(u-=t)&e,u<=0&&(u+=this.DB,--a)),i>0&&(n=!0),n&&(o+=Fb(i));return n?o:"0"}l(WS,"bnToString");function ZS(){var r=J();return O.ZERO.subTo(this,r),r}l(ZS,"bnNegate");function US(){return this.s<0?this.negate():this}l(US,"bnAbs");function zS(r){var t=this.s-r.s;if(t!=0)return t;var e=this.t;if(t=e-r.t,t!=0)return this.s<0?-t:t;for(;--e>=0;)if((t=this[e]-r[e])!=0)return t;return 0}l(zS,"bnCompareTo");function qu(r){var t=1,e;return(e=r>>>16)!=0&&(r=e,t+=16),(e=r>>8)!=0&&(r=e,t+=8),(e=r>>4)!=0&&(r=e,t+=4),(e=r>>2)!=0&&(r=e,t+=2),(e=r>>1)!=0&&(r=e,t+=1),t}l(qu,"nbits");function qS(){return this.t<=0?0:this.DB*(this.t-1)+qu(this[this.t-1]^this.s&this.DM)}l(qS,"bnBitLength");function $S(r,t){var e;for(e=this.t-1;e>=0;--e)t[e+r]=this[e];for(e=r-1;e>=0;--e)t[e]=0;t.t=this.t+r,t.s=this.s}l($S,"bnpDLShiftTo");function JS(r,t){for(var e=r;e<this.t;++e)t[e-r]=this[e];t.t=Math.max(this.t-r,0),t.s=this.s}l(JS,"bnpDRShiftTo");function KS(r,t){var e=r%this.DB,i=this.DB-e,n=(1<<i)-1,o=Math.floor(r/this.DB),a=this.s<<e&this.DM,u;for(u=this.t-1;u>=0;--u)t[u+o+1]=this[u]>>i|a,a=(this[u]&n)<<e;for(u=o-1;u>=0;--u)t[u]=0;t[o]=a,t.t=this.t+o+1,t.s=this.s,t.clamp()}l(KS,"bnpLShiftTo");function QS(r,t){t.s=this.s;var e=Math.floor(r/this.DB);if(e>=this.t){t.t=0;return}var i=r%this.DB,n=this.DB-i,o=(1<<i)-1;t[0]=this[e]>>i;for(var a=e+1;a<this.t;++a)t[a-e-1]|=(this[a]&o)<<n,t[a-e]=this[a]>>i;i>0&&(t[this.t-e-1]|=(this.s&o)<<n),t.t=this.t-e,t.clamp()}l(QS,"bnpRShiftTo");function tM(r,t){for(var e=0,i=0,n=Math.min(r.t,this.t);e<n;)i+=this[e]-r[e],t[e++]=i&this.DM,i>>=this.DB;if(r.t<this.t){for(i-=r.s;e<this.t;)i+=this[e],t[e++]=i&this.DM,i>>=this.DB;i+=this.s}else{for(i+=this.s;e<r.t;)i-=r[e],t[e++]=i&this.DM,i>>=this.DB;i-=r.s}t.s=i<0?-1:0,i<-1?t[e++]=this.DV+i:i>0&&(t[e++]=i),t.t=e,t.clamp()}l(tM,"bnpSubTo");function eM(r,t){var e=this.abs(),i=r.abs(),n=e.t;for(t.t=n+i.t;--n>=0;)t[n]=0;for(n=0;n<i.t;++n)t[n+e.t]=e.am(0,i[n],t,n,0,e.t);t.s=0,t.clamp(),this.s!=r.s&&O.ZERO.subTo(t,t)}l(eM,"bnpMultiplyTo");function rM(r){for(var t=this.abs(),e=r.t=2*t.t;--e>=0;)r[e]=0;for(e=0;e<t.t-1;++e){var i=t.am(e,t[e],r,2*e,0,1);(r[e+t.t]+=t.am(e+1,2*t[e],r,2*e+1,i,t.t-e-1))>=t.DV&&(r[e+t.t]-=t.DV,r[e+t.t+1]=1)}r.t>0&&(r[r.t-1]+=t.am(e,t[e],r,2*e,0,1)),r.s=0,r.clamp()}l(rM,"bnpSquareTo");function iM(r,t,e){var i=r.abs();if(!(i.t<=0)){var n=this.abs();if(n.t<i.t){t!=null&&t.fromInt(0),e!=null&&this.copyTo(e);return}e==null&&(e=J());var o=J(),a=this.s,u=r.s,s=this.DB-qu(i[i.t-1]);s>0?(i.lShiftTo(s,o),n.lShiftTo(s,e)):(i.copyTo(o),n.copyTo(e));var p=o.t,f=o[p-1];if(f!=0){var m=f*(1<<this.F1)+(p>1?o[p-2]>>this.F2:0),y=this.FV/m,x=(1<<this.F1)/m,S=1<<this.F2,M=e.t,g=M-p,C=t==null?J():t;for(o.dlShiftTo(g,C),e.compareTo(C)>=0&&(e[e.t++]=1,e.subTo(C,e)),O.ONE.dlShiftTo(p,C),C.subTo(o,o);o.t<p;)o[o.t++]=0;for(;--g>=0;){var I=e[--M]==f?this.DM:Math.floor(e[M]*y+(e[M-1]+S)*x);if((e[M]+=o.am(0,I,e,g,0,p))<I)for(o.dlShiftTo(g,C),e.subTo(C,e);e[M]<--I;)e.subTo(C,e)}t!=null&&(e.drShiftTo(p,t),a!=u&&O.ZERO.subTo(t,t)),e.t=p,e.clamp(),s>0&&e.rShiftTo(s,e),a<0&&O.ZERO.subTo(e,e)}}}l(iM,"bnpDivRemTo");function nM(r){var t=J();return this.abs().divRemTo(r,null,t),this.s<0&&t.compareTo(O.ZERO)>0&&r.subTo(t,t),t}l(nM,"bnMod");function Qi(r){this.m=r}l(Qi,"Classic");function oM(r){return r.s<0||r.compareTo(this.m)>=0?r.mod(this.m):r}l(oM,"cConvert");function aM(r){return r}l(aM,"cRevert");function sM(r){r.divRemTo(this.m,null,r)}l(sM,"cReduce");function lM(r,t,e){r.multiplyTo(t,e),this.reduce(e)}l(lM,"cMulTo");function uM(r,t){r.squareTo(t),this.reduce(t)}l(uM,"cSqrTo");Qi.prototype.convert=oM;Qi.prototype.revert=aM;Qi.prototype.reduce=sM;Qi.prototype.mulTo=lM;Qi.prototype.sqrTo=uM;function cM(){if(this.t<1)return 0;var r=this[0];if(!(r&1))return 0;var t=r&3;return t=t*(2-(r&15)*t)&15,t=t*(2-(r&255)*t)&255,t=t*(2-((r&65535)*t&65535))&65535,t=t*(2-r*t%this.DV)%this.DV,t>0?this.DV-t:-t}l(cM,"bnpInvDigit");function tn(r){this.m=r,this.mp=r.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<r.DB-15)-1,this.mt2=2*r.t}l(tn,"Montgomery");function pM(r){var t=J();return r.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),r.s<0&&t.compareTo(O.ZERO)>0&&this.m.subTo(t,t),t}l(pM,"montConvert");function hM(r){var t=J();return r.copyTo(t),this.reduce(t),t}l(hM,"montRevert");function dM(r){for(;r.t<=this.mt2;)r[r.t++]=0;for(var t=0;t<this.m.t;++t){var e=r[t]&32767,i=e*this.mpl+((e*this.mph+(r[t]>>15)*this.mpl&this.um)<<15)&r.DM;for(e=t+this.m.t,r[e]+=this.m.am(0,i,r,t,0,this.m.t);r[e]>=r.DV;)r[e]-=r.DV,r[++e]++}r.clamp(),r.drShiftTo(this.m.t,r),r.compareTo(this.m)>=0&&r.subTo(this.m,r)}l(dM,"montReduce");function fM(r,t){r.squareTo(t),this.reduce(t)}l(fM,"montSqrTo");function mM(r,t,e){r.multiplyTo(t,e),this.reduce(e)}l(mM,"montMulTo");tn.prototype.convert=pM;tn.prototype.revert=hM;tn.prototype.reduce=dM;tn.prototype.mulTo=mM;tn.prototype.sqrTo=fM;function yM(){return(this.t>0?this[0]&1:this.s)==0}l(yM,"bnpIsEven");function gM(r,t){if(r>4294967295||r<1)return O.ONE;var e=J(),i=J(),n=t.convert(this),o=qu(r)-1;for(n.copyTo(e);--o>=0;)if(t.sqrTo(e,i),(r&1<<o)>0)t.mulTo(i,n,e);else{var a=e;e=i,i=a}return t.revert(e)}l(gM,"bnpExp");function vM(r,t){var e;return r<256||t.isEven()?e=new Qi(t):e=new tn(t),this.exp(r,e)}l(vM,"bnModPowInt");O.prototype.copyTo=HS;O.prototype.fromInt=XS;O.prototype.fromString=YS;O.prototype.clamp=jS;O.prototype.dlShiftTo=$S;O.prototype.drShiftTo=JS;O.prototype.lShiftTo=KS;O.prototype.rShiftTo=QS;O.prototype.subTo=tM;O.prototype.multiplyTo=eM;O.prototype.squareTo=rM;O.prototype.divRemTo=iM;O.prototype.invDigit=cM;O.prototype.isEven=yM;O.prototype.exp=gM;O.prototype.toString=WS;O.prototype.negate=ZS;O.prototype.abs=US;O.prototype.compareTo=zS;O.prototype.bitLength=qS;O.prototype.mod=nM;O.prototype.modPowInt=vM;O.ZERO=si(0);O.ONE=si(1);function bM(){var r=J();return this.copyTo(r),r}l(bM,"bnClone");function CM(){if(this.s<0){if(this.t==1)return this[0]-this.DV;if(this.t==0)return-1}else{if(this.t==1)return this[0];if(this.t==0)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]}l(CM,"bnIntValue");function xM(){return this.t==0?this.s:this[0]<<24>>24}l(xM,"bnByteValue");function SM(){return this.t==0?this.s:this[0]<<16>>16}l(SM,"bnShortValue");function MM(r){return Math.floor(Math.LN2*this.DB/Math.log(r))}l(MM,"bnpChunkSize");function PM(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1}l(PM,"bnSigNum");function TM(r){if(r==null&&(r=10),this.signum()==0||r<2||r>36)return"0";var t=this.chunkSize(r),e=Math.pow(r,t),i=si(e),n=J(),o=J(),a="";for(this.divRemTo(i,n,o);n.signum()>0;)a=(e+o.intValue()).toString(r).substr(1)+a,n.divRemTo(i,n,o);return o.intValue().toString(r)+a}l(TM,"bnpToRadix");function wM(r,t){this.fromInt(0),t==null&&(t=10);for(var e=this.chunkSize(t),i=Math.pow(t,e),n=!1,o=0,a=0,u=0;u<r.length;++u){var s=Xb(r,u);if(s<0){r.charAt(u)=="-"&&this.signum()==0&&(n=!0);continue}a=t*a+s,++o>=e&&(this.dMultiply(i),this.dAddOffset(a,0),o=0,a=0)}o>0&&(this.dMultiply(Math.pow(t,o)),this.dAddOffset(a,0)),n&&O.ZERO.subTo(this,this)}l(wM,"bnpFromRadix");function IM(r,t,e){if(typeof t=="number")if(r<2)this.fromInt(1);else for(this.fromNumber(r,e),this.testBit(r-1)||this.bitwiseTo(O.ONE.shiftLeft(r-1),Rf,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>r&&this.subTo(O.ONE.shiftLeft(r-1),this);else{var i=new Array,n=r&7;i.length=(r>>3)+1,t.nextBytes(i),n>0?i[0]&=(1<<n)-1:i[0]=0,this.fromString(i,256)}}l(IM,"bnpFromNumber");function EM(){var r=this.t,t=new Array;t[0]=this.s;var e=this.DB-r*this.DB%8,i,n=0;if(r-- >0)for(e<this.DB&&(i=this[r]>>e)!=(this.s&this.DM)>>e&&(t[n++]=i|this.s<<this.DB-e);r>=0;)e<8?(i=(this[r]&(1<<e)-1)<<8-e,i|=this[--r]>>(e+=this.DB-8)):(i=this[r]>>(e-=8)&255,e<=0&&(e+=this.DB,--r)),i&128&&(i|=-256),n==0&&(this.s&128)!=(i&128)&&++n,(n>0||i!=this.s)&&(t[n++]=i);return t}l(EM,"bnToByteArray");function LM(r){return this.compareTo(r)==0}l(LM,"bnEquals");function _M(r){return this.compareTo(r)<0?this:r}l(_M,"bnMin");function DM(r){return this.compareTo(r)>0?this:r}l(DM,"bnMax");function OM(r,t,e){var i,n,o=Math.min(r.t,this.t);for(i=0;i<o;++i)e[i]=t(this[i],r[i]);if(r.t<this.t){for(n=r.s&this.DM,i=o;i<this.t;++i)e[i]=t(this[i],n);e.t=this.t}else{for(n=this.s&this.DM,i=o;i<r.t;++i)e[i]=t(n,r[i]);e.t=r.t}e.s=t(this.s,r.s),e.clamp()}l(OM,"bnpBitwiseTo");function AM(r,t){return r&t}l(AM,"op_and");function kM(r){var t=J();return this.bitwiseTo(r,AM,t),t}l(kM,"bnAnd");function Rf(r,t){return r|t}l(Rf,"op_or");function NM(r){var t=J();return this.bitwiseTo(r,Rf,t),t}l(NM,"bnOr");function Yb(r,t){return r^t}l(Yb,"op_xor");function RM(r){var t=J();return this.bitwiseTo(r,Yb,t),t}l(RM,"bnXor");function jb(r,t){return r&~t}l(jb,"op_andnot");function BM(r){var t=J();return this.bitwiseTo(r,jb,t),t}l(BM,"bnAndNot");function FM(){for(var r=J(),t=0;t<this.t;++t)r[t]=this.DM&~this[t];return r.t=this.t,r.s=~this.s,r}l(FM,"bnNot");function GM(r){var t=J();return r<0?this.rShiftTo(-r,t):this.lShiftTo(r,t),t}l(GM,"bnShiftLeft");function VM(r){var t=J();return r<0?this.lShiftTo(-r,t):this.rShiftTo(r,t),t}l(VM,"bnShiftRight");function HM(r){if(r==0)return-1;var t=0;return r&65535||(r>>=16,t+=16),r&255||(r>>=8,t+=8),r&15||(r>>=4,t+=4),r&3||(r>>=2,t+=2),r&1||++t,t}l(HM,"lbit");function XM(){for(var r=0;r<this.t;++r)if(this[r]!=0)return r*this.DB+HM(this[r]);return this.s<0?this.t*this.DB:-1}l(XM,"bnGetLowestSetBit");function YM(r){for(var t=0;r!=0;)r&=r-1,++t;return t}l(YM,"cbit");function jM(){for(var r=0,t=this.s&this.DM,e=0;e<this.t;++e)r+=YM(this[e]^t);return r}l(jM,"bnBitCount");function WM(r){var t=Math.floor(r/this.DB);return t>=this.t?this.s!=0:(this[t]&1<<r%this.DB)!=0}l(WM,"bnTestBit");function ZM(r,t){var e=O.ONE.shiftLeft(r);return this.bitwiseTo(e,t,e),e}l(ZM,"bnpChangeBit");function UM(r){return this.changeBit(r,Rf)}l(UM,"bnSetBit");function zM(r){return this.changeBit(r,jb)}l(zM,"bnClearBit");function qM(r){return this.changeBit(r,Yb)}l(qM,"bnFlipBit");function $M(r,t){for(var e=0,i=0,n=Math.min(r.t,this.t);e<n;)i+=this[e]+r[e],t[e++]=i&this.DM,i>>=this.DB;if(r.t<this.t){for(i+=r.s;e<this.t;)i+=this[e],t[e++]=i&this.DM,i>>=this.DB;i+=this.s}else{for(i+=this.s;e<r.t;)i+=r[e],t[e++]=i&this.DM,i>>=this.DB;i+=r.s}t.s=i<0?-1:0,i>0?t[e++]=i:i<-1&&(t[e++]=this.DV+i),t.t=e,t.clamp()}l($M,"bnpAddTo");function JM(r){var t=J();return this.addTo(r,t),t}l(JM,"bnAdd");function KM(r){var t=J();return this.subTo(r,t),t}l(KM,"bnSubtract");function QM(r){var t=J();return this.multiplyTo(r,t),t}l(QM,"bnMultiply");function tP(){var r=J();return this.squareTo(r),r}l(tP,"bnSquare");function eP(r){var t=J();return this.divRemTo(r,t,null),t}l(eP,"bnDivide");function rP(r){var t=J();return this.divRemTo(r,null,t),t}l(rP,"bnRemainder");function iP(r){var t=J(),e=J();return this.divRemTo(r,t,e),new Array(t,e)}l(iP,"bnDivideAndRemainder");function nP(r){this[this.t]=this.am(0,r-1,this,0,0,this.t),++this.t,this.clamp()}l(nP,"bnpDMultiply");function oP(r,t){if(r!=0){for(;this.t<=t;)this[this.t++]=0;for(this[t]+=r;this[t]>=this.DV;)this[t]-=this.DV,++t>=this.t&&(this[this.t++]=0),++this[t]}}l(oP,"bnpDAddOffset");function Ja(){}l(Ja,"NullExp");function Wb(r){return r}l(Wb,"nNop");function aP(r,t,e){r.multiplyTo(t,e)}l(aP,"nMulTo");function sP(r,t){r.squareTo(t)}l(sP,"nSqrTo");Ja.prototype.convert=Wb;Ja.prototype.revert=Wb;Ja.prototype.mulTo=aP;Ja.prototype.sqrTo=sP;function lP(r){return this.exp(r,new Ja)}l(lP,"bnPow");function uP(r,t,e){var i=Math.min(this.t+r.t,t);for(e.s=0,e.t=i;i>0;)e[--i]=0;var n;for(n=e.t-this.t;i<n;++i)e[i+this.t]=this.am(0,r[i],e,i,0,this.t);for(n=Math.min(r.t,t);i<n;++i)this.am(0,r[i],e,i,0,t-i);e.clamp()}l(uP,"bnpMultiplyLowerTo");function cP(r,t,e){--t;var i=e.t=this.t+r.t-t;for(e.s=0;--i>=0;)e[i]=0;for(i=Math.max(t-this.t,0);i<r.t;++i)e[this.t+i-t]=this.am(t-i,r[i],e,0,0,this.t+i-t);e.clamp(),e.drShiftTo(1,e)}l(cP,"bnpMultiplyUpperTo");function co(r){this.r2=J(),this.q3=J(),O.ONE.dlShiftTo(2*r.t,this.r2),this.mu=this.r2.divide(r),this.m=r}l(co,"Barrett");function pP(r){if(r.s<0||r.t>2*this.m.t)return r.mod(this.m);if(r.compareTo(this.m)<0)return r;var t=J();return r.copyTo(t),this.reduce(t),t}l(pP,"barrettConvert");function hP(r){return r}l(hP,"barrettRevert");function dP(r){for(r.drShiftTo(this.m.t-1,this.r2),r.t>this.m.t+1&&(r.t=this.m.t+1,r.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);r.compareTo(this.r2)<0;)r.dAddOffset(1,this.m.t+1);for(r.subTo(this.r2,r);r.compareTo(this.m)>=0;)r.subTo(this.m,r)}l(dP,"barrettReduce");function fP(r,t){r.squareTo(t),this.reduce(t)}l(fP,"barrettSqrTo");function mP(r,t,e){r.multiplyTo(t,e),this.reduce(e)}l(mP,"barrettMulTo");co.prototype.convert=pP;co.prototype.revert=hP;co.prototype.reduce=dP;co.prototype.mulTo=mP;co.prototype.sqrTo=fP;function yP(r,t){var e=r.bitLength(),i,n=si(1),o;if(e<=0)return n;e<18?i=1:e<48?i=3:e<144?i=4:e<768?i=5:i=6,e<8?o=new Qi(t):t.isEven()?o=new co(t):o=new tn(t);var a=new Array,u=3,s=i-1,p=(1<<i)-1;if(a[1]=o.convert(this),i>1){var f=J();for(o.sqrTo(a[1],f);u<=p;)a[u]=J(),o.mulTo(f,a[u-2],a[u]),u+=2}var m=r.t-1,y,x=!0,S=J(),M;for(e=qu(r[m])-1;m>=0;){for(e>=s?y=r[m]>>e-s&p:(y=(r[m]&(1<<e+1)-1)<<s-e,m>0&&(y|=r[m-1]>>this.DB+e-s)),u=i;!(y&1);)y>>=1,--u;if((e-=u)<0&&(e+=this.DB,--m),x)a[y].copyTo(n),x=!1;else{for(;u>1;)o.sqrTo(n,S),o.sqrTo(S,n),u-=2;u>0?o.sqrTo(n,S):(M=n,n=S,S=M),o.mulTo(S,a[y],n)}for(;m>=0&&!(r[m]&1<<e);)o.sqrTo(n,S),M=n,n=S,S=M,--e<0&&(e=this.DB-1,--m)}return o.revert(n)}l(yP,"bnModPow");function gP(r){var t=this.s<0?this.negate():this.clone(),e=r.s<0?r.negate():r.clone();if(t.compareTo(e)<0){var i=t;t=e,e=i}var n=t.getLowestSetBit(),o=e.getLowestSetBit();if(o<0)return t;for(n<o&&(o=n),o>0&&(t.rShiftTo(o,t),e.rShiftTo(o,e));t.signum()>0;)(n=t.getLowestSetBit())>0&&t.rShiftTo(n,t),(n=e.getLowestSetBit())>0&&e.rShiftTo(n,e),t.compareTo(e)>=0?(t.subTo(e,t),t.rShiftTo(1,t)):(e.subTo(t,e),e.rShiftTo(1,e));return o>0&&e.lShiftTo(o,e),e}l(gP,"bnGCD");function vP(r){if(r<=0)return 0;var t=this.DV%r,e=this.s<0?r-1:0;if(this.t>0)if(t==0)e=this[0]%r;else for(var i=this.t-1;i>=0;--i)e=(t*e+this[i])%r;return e}l(vP,"bnpModInt");function bP(r){var t=r.isEven();if(this.isEven()&&t||r.signum()==0)return O.ZERO;for(var e=r.clone(),i=this.clone(),n=si(1),o=si(0),a=si(0),u=si(1);e.signum()!=0;){for(;e.isEven();)e.rShiftTo(1,e),t?((!n.isEven()||!o.isEven())&&(n.addTo(this,n),o.subTo(r,o)),n.rShiftTo(1,n)):o.isEven()||o.subTo(r,o),o.rShiftTo(1,o);for(;i.isEven();)i.rShiftTo(1,i),t?((!a.isEven()||!u.isEven())&&(a.addTo(this,a),u.subTo(r,u)),a.rShiftTo(1,a)):u.isEven()||u.subTo(r,u),u.rShiftTo(1,u);e.compareTo(i)>=0?(e.subTo(i,e),t&&n.subTo(a,n),o.subTo(u,o)):(i.subTo(e,i),t&&a.subTo(n,a),u.subTo(o,u))}if(i.compareTo(O.ONE)!=0)return O.ZERO;if(u.compareTo(r)>=0)return u.subtract(r);if(u.signum()<0)u.addTo(r,u);else return u;return u.signum()<0?u.add(r):u}l(bP,"bnModInverse");var Kt=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],CP=(1<<26)/Kt[Kt.length-1];function xP(r){var t,e=this.abs();if(e.t==1&&e[0]<=Kt[Kt.length-1]){for(t=0;t<Kt.length;++t)if(e[0]==Kt[t])return!0;return!1}if(e.isEven())return!1;for(t=1;t<Kt.length;){for(var i=Kt[t],n=t+1;n<Kt.length&&i<CP;)i*=Kt[n++];for(i=e.modInt(i);t<n;)if(i%Kt[t++]==0)return!1}return e.millerRabin(r)}l(xP,"bnIsProbablePrime");function SP(r){var t=this.subtract(O.ONE),e=t.getLowestSetBit();if(e<=0)return!1;var i=t.shiftRight(e);r=r+1>>1,r>Kt.length&&(r=Kt.length);for(var n=J(),o=0;o<r;++o){n.fromInt(Kt[Math.floor(Math.random()*Kt.length)]);var a=n.modPow(i,this);if(a.compareTo(O.ONE)!=0&&a.compareTo(t)!=0){for(var u=1;u++<e&&a.compareTo(t)!=0;)if(a=a.modPowInt(2,this),a.compareTo(O.ONE)==0)return!1;if(a.compareTo(t)!=0)return!1}}return!0}l(SP,"bnpMillerRabin");O.prototype.chunkSize=MM;O.prototype.toRadix=TM;O.prototype.fromRadix=wM;O.prototype.fromNumber=IM;O.prototype.bitwiseTo=OM;O.prototype.changeBit=ZM;O.prototype.addTo=$M;O.prototype.dMultiply=nP;O.prototype.dAddOffset=oP;O.prototype.multiplyLowerTo=uP;O.prototype.multiplyUpperTo=cP;O.prototype.modInt=vP;O.prototype.millerRabin=SP;O.prototype.clone=bM;O.prototype.intValue=CM;O.prototype.byteValue=xM;O.prototype.shortValue=SM;O.prototype.signum=PM;O.prototype.toByteArray=EM;O.prototype.equals=LM;O.prototype.min=_M;O.prototype.max=DM;O.prototype.and=kM;O.prototype.or=NM;O.prototype.xor=RM;O.prototype.andNot=BM;O.prototype.not=FM;O.prototype.shiftLeft=GM;O.prototype.shiftRight=VM;O.prototype.getLowestSetBit=XM;O.prototype.bitCount=jM;O.prototype.testBit=WM;O.prototype.setBit=UM;O.prototype.clearBit=zM;O.prototype.flipBit=qM;O.prototype.add=JM;O.prototype.subtract=KM;O.prototype.multiply=QM;O.prototype.divide=eP;O.prototype.remainder=rP;O.prototype.divideAndRemainder=iP;O.prototype.modPow=yP;O.prototype.modInverse=bP;O.prototype.pow=lP;O.prototype.gcd=gP;O.prototype.isProbablePrime=xP;O.prototype.square=tP;var U=O;U.prototype.IsNegative=function(){return this.compareTo(U.ZERO)==-1};U.op_Equality=function(r,t){return r.compareTo(t)==0};U.op_Inequality=function(r,t){return r.compareTo(t)!=0};U.op_GreaterThan=function(r,t){return r.compareTo(t)>0};U.op_LessThan=function(r,t){return r.compareTo(t)<0};U.op_Addition=function(r,t){return new U(r).add(new U(t))};U.op_Subtraction=function(r,t){return new U(r).subtract(new U(t))};U.Int128Mul=function(r,t){return new U(r).multiply(new U(t))};U.op_Division=function(r,t){return r.divide(t)};U.prototype.ToDouble=function(){return parseFloat(this.toString())};typeof Uu>"u"&&(Uu=l(function(r,t){var e;if(typeof Object.getOwnPropertyNames>"u"){for(e in t.prototype)(typeof r.prototype[e]>"u"||r.prototype[e]==Object.prototype[e])&&(r.prototype[e]=t.prototype[e]);for(e in t)typeof r[e]>"u"&&(r[e]=t[e]);r.$baseCtor=t}else{for(var i=Object.getOwnPropertyNames(t.prototype),n=0;n<i.length;n++)typeof Object.getOwnPropertyDescriptor(r.prototype,i[n])>"u"&&Object.defineProperty(r.prototype,i[n],Object.getOwnPropertyDescriptor(t.prototype,i[n]));for(e in t)typeof r[e]>"u"&&(r[e]=t[e]);r.$baseCtor=t}},"Inherit"));var Uu;h.Path=function(){return[]};h.Paths=function(){return[]};h.DoublePoint=function(){var r=arguments;this.X=0,this.Y=0,r.length==1?(this.X=r[0].X,this.Y=r[0].Y):r.length==2&&(this.X=r[0],this.Y=r[1])};h.DoublePoint0=function(){this.X=0,this.Y=0};h.DoublePoint1=function(r){this.X=r.X,this.Y=r.Y};h.DoublePoint2=function(r,t){this.X=r,this.Y=t};h.PolyNode=function(){this.m_Parent=null,this.m_polygon=new h.Path,this.m_Index=0,this.m_jointype=0,this.m_endtype=0,this.m_Childs=[],this.IsOpen=!1};h.PolyNode.prototype.IsHoleNode=function(){for(var r=!0,t=this.m_Parent;t!==null;)r=!r,t=t.m_Parent;return r};h.PolyNode.prototype.ChildCount=function(){return this.m_Childs.length};h.PolyNode.prototype.Contour=function(){return this.m_polygon};h.PolyNode.prototype.AddChild=function(r){var t=this.m_Childs.length;this.m_Childs.push(r),r.m_Parent=this,r.m_Index=t};h.PolyNode.prototype.GetNext=function(){return this.m_Childs.length>0?this.m_Childs[0]:this.GetNextSiblingUp()};h.PolyNode.prototype.GetNextSiblingUp=function(){return this.m_Parent===null?null:this.m_Index==this.m_Parent.m_Childs.length-1?this.m_Parent.GetNextSiblingUp():this.m_Parent.m_Childs[this.m_Index+1]};h.PolyNode.prototype.Childs=function(){return this.m_Childs};h.PolyNode.prototype.Parent=function(){return this.m_Parent};h.PolyNode.prototype.IsHole=function(){return this.IsHoleNode()};h.PolyTree=function(){this.m_AllPolys=[],h.PolyNode.call(this)};h.PolyTree.prototype.Clear=function(){for(var r=0,t=this.m_AllPolys.length;r<t;r++)this.m_AllPolys[r]=null;this.m_AllPolys.length=0,this.m_Childs.length=0};h.PolyTree.prototype.GetFirst=function(){return this.m_Childs.length>0?this.m_Childs[0]:null};h.PolyTree.prototype.Total=function(){return this.m_AllPolys.length};Uu(h.PolyTree,h.PolyNode);h.Math_Abs_Int64=h.Math_Abs_Int32=h.Math_Abs_Double=function(r){return Math.abs(r)};h.Math_Max_Int32_Int32=function(r,t){return Math.max(r,t)};z.msie||z.opera||z.safari?h.Cast_Int32=function(r){return r|0}:h.Cast_Int32=function(r){return~~r};z.chrome?h.Cast_Int64=function(r){return r<-2147483648||r>2147483647?r<0?Math.ceil(r):Math.floor(r):~~r}:z.firefox&&typeof Number.toInteger=="function"?h.Cast_Int64=function(r){return Number.toInteger(r)}:z.msie7||z.msie8?h.Cast_Int64=function(r){return parseInt(r,10)}:z.msie?h.Cast_Int64=function(r){return r<-2147483648||r>2147483647?r<0?Math.ceil(r):Math.floor(r):r|0}:h.Cast_Int64=function(r){return r<0?Math.ceil(r):Math.floor(r)};h.Clear=function(r){r.length=0};h.PI=3.141592653589793;h.PI2=2*3.141592653589793;h.IntPoint=function(){var r=arguments,t=r.length;if(this.X=0,this.Y=0,Ki)if(this.Z=0,t==3)this.X=r[0],this.Y=r[1],this.Z=r[2];else if(t==2)this.X=r[0],this.Y=r[1],this.Z=0;else if(t==1)if(r[0]instanceof h.DoublePoint){var e=r[0];this.X=h.Clipper.Round(e.X),this.Y=h.Clipper.Round(e.Y),this.Z=0}else{var i=r[0];typeof i.Z>"u"&&(i.Z=0),this.X=i.X,this.Y=i.Y,this.Z=i.Z}else this.X=0,this.Y=0,this.Z=0;else if(t==2)this.X=r[0],this.Y=r[1];else if(t==1)if(r[0]instanceof h.DoublePoint){var e=r[0];this.X=h.Clipper.Round(e.X),this.Y=h.Clipper.Round(e.Y)}else{var i=r[0];this.X=i.X,this.Y=i.Y}else this.X=0,this.Y=0};h.IntPoint.op_Equality=function(r,t){return r.X==t.X&&r.Y==t.Y};h.IntPoint.op_Inequality=function(r,t){return r.X!=t.X||r.Y!=t.Y};Ki?(h.IntPoint0=function(){this.X=0,this.Y=0,this.Z=0},h.IntPoint1=function(r){this.X=r.X,this.Y=r.Y,this.Z=r.Z},h.IntPoint1dp=function(r){this.X=h.Clipper.Round(r.X),this.Y=h.Clipper.Round(r.Y),this.Z=0},h.IntPoint2=function(r,t){this.X=r,this.Y=t,this.Z=0},h.IntPoint3=function(r,t,e){this.X=r,this.Y=t,this.Z=e}):(h.IntPoint0=function(){this.X=0,this.Y=0},h.IntPoint1=function(r){this.X=r.X,this.Y=r.Y},h.IntPoint1dp=function(r){this.X=h.Clipper.Round(r.X),this.Y=h.Clipper.Round(r.Y)},h.IntPoint2=function(r,t){this.X=r,this.Y=t});h.IntRect=function(){var r=arguments,t=r.length;t==4?(this.left=r[0],this.top=r[1],this.right=r[2],this.bottom=r[3]):t==1?(this.left=ir.left,this.top=ir.top,this.right=ir.right,this.bottom=ir.bottom):(this.left=0,this.top=0,this.right=0,this.bottom=0)};h.IntRect0=function(){this.left=0,this.top=0,this.right=0,this.bottom=0};h.IntRect1=function(r){this.left=r.left,this.top=r.top,this.right=r.right,this.bottom=r.bottom};h.IntRect4=function(r,t,e,i){this.left=r,this.top=t,this.right=e,this.bottom=i};h.ClipType={ctIntersection:0,ctUnion:1,ctDifference:2,ctXor:3};h.PolyType={ptSubject:0,ptClip:1};h.PolyFillType={pftEvenOdd:0,pftNonZero:1,pftPositive:2,pftNegative:3};h.JoinType={jtSquare:0,jtRound:1,jtMiter:2};h.EndType={etOpenSquare:0,etOpenRound:1,etOpenButt:2,etClosedLine:3,etClosedPolygon:4};Vb&&(h.EndType_={etSquare:0,etRound:1,etButt:2,etClosed:3});h.EdgeSide={esLeft:0,esRight:1};h.Direction={dRightToLeft:0,dLeftToRight:1};h.TEdge=function(){this.Bot=new h.IntPoint,this.Curr=new h.IntPoint,this.Top=new h.IntPoint,this.Delta=new h.IntPoint,this.Dx=0,this.PolyTyp=h.PolyType.ptSubject,this.Side=h.EdgeSide.esLeft,this.WindDelta=0,this.WindCnt=0,this.WindCnt2=0,this.OutIdx=0,this.Next=null,this.Prev=null,this.NextInLML=null,this.NextInAEL=null,this.PrevInAEL=null,this.NextInSEL=null,this.PrevInSEL=null};h.IntersectNode=function(){this.Edge1=null,this.Edge2=null,this.Pt=new h.IntPoint};h.MyIntersectNodeSort=function(){};h.MyIntersectNodeSort.Compare=function(r,t){return t.Pt.Y-r.Pt.Y};h.LocalMinima=function(){this.Y=0,this.LeftBound=null,this.RightBound=null,this.Next=null};h.Scanbeam=function(){this.Y=0,this.Next=null};h.OutRec=function(){this.Idx=0,this.IsHole=!1,this.IsOpen=!1,this.FirstLeft=null,this.Pts=null,this.BottomPt=null,this.PolyNode=null};h.OutPt=function(){this.Idx=0,this.Pt=new h.IntPoint,this.Next=null,this.Prev=null};h.Join=function(){this.OutPt1=null,this.OutPt2=null,this.OffPt=new h.IntPoint};h.ClipperBase=function(){this.m_MinimaList=null,this.m_CurrentLM=null,this.m_edges=new Array,this.m_UseFullRange=!1,this.m_HasOpenPaths=!1,this.PreserveCollinear=!1,this.m_MinimaList=null,this.m_CurrentLM=null,this.m_UseFullRange=!1,this.m_HasOpenPaths=!1};h.ClipperBase.horizontal=-9007199254740992;h.ClipperBase.Skip=-2;h.ClipperBase.Unassigned=-1;h.ClipperBase.tolerance=1e-20;NS?(h.ClipperBase.loRange=46340,h.ClipperBase.hiRange=46340):(h.ClipperBase.loRange=47453132,h.ClipperBase.hiRange=0xfffffffffffff);h.ClipperBase.near_zero=function(r){return r>-h.ClipperBase.tolerance&&r<h.ClipperBase.tolerance};h.ClipperBase.IsHorizontal=function(r){return r.Delta.Y===0};h.ClipperBase.prototype.PointIsVertex=function(r,t){var e=t;do{if(h.IntPoint.op_Equality(e.Pt,r))return!0;e=e.Next}while(e!=t);return!1};h.ClipperBase.prototype.PointOnLineSegment=function(r,t,e,i){return i?r.X==t.X&&r.Y==t.Y||r.X==e.X&&r.Y==e.Y||r.X>t.X==r.X<e.X&&r.Y>t.Y==r.Y<e.Y&&U.op_Equality(U.Int128Mul(r.X-t.X,e.Y-t.Y),U.Int128Mul(e.X-t.X,r.Y-t.Y)):r.X==t.X&&r.Y==t.Y||r.X==e.X&&r.Y==e.Y||r.X>t.X==r.X<e.X&&r.Y>t.Y==r.Y<e.Y&&(r.X-t.X)*(e.Y-t.Y)==(e.X-t.X)*(r.Y-t.Y)};h.ClipperBase.prototype.PointOnPolygon=function(r,t,e){for(var i=t;;){if(this.PointOnLineSegment(r,i.Pt,i.Next.Pt,e))return!0;if(i=i.Next,i==t)break}return!1};h.ClipperBase.prototype.SlopesEqual=h.ClipperBase.SlopesEqual=function(){var r=arguments,t=r.length,e,i,n,o,a,u,s;return t==3?(e=r[0],i=r[1],s=r[2],s?U.op_Equality(U.Int128Mul(e.Delta.Y,i.Delta.X),U.Int128Mul(e.Delta.X,i.Delta.Y)):h.Cast_Int64(e.Delta.Y*i.Delta.X)==h.Cast_Int64(e.Delta.X*i.Delta.Y)):t==4?(n=r[0],o=r[1],a=r[2],s=r[3],s?U.op_Equality(U.Int128Mul(n.Y-o.Y,o.X-a.X),U.Int128Mul(n.X-o.X,o.Y-a.Y)):h.Cast_Int64((n.Y-o.Y)*(o.X-a.X))-h.Cast_Int64((n.X-o.X)*(o.Y-a.Y))===0):(n=r[0],o=r[1],a=r[2],u=r[3],s=r[4],s?U.op_Equality(U.Int128Mul(n.Y-o.Y,a.X-u.X),U.Int128Mul(n.X-o.X,a.Y-u.Y)):h.Cast_Int64((n.Y-o.Y)*(a.X-u.X))-h.Cast_Int64((n.X-o.X)*(a.Y-u.Y))===0)};h.ClipperBase.SlopesEqual3=function(r,t,e){return e?U.op_Equality(U.Int128Mul(r.Delta.Y,t.Delta.X),U.Int128Mul(r.Delta.X,t.Delta.Y)):h.Cast_Int64(r.Delta.Y*t.Delta.X)==h.Cast_Int64(r.Delta.X*t.Delta.Y)};h.ClipperBase.SlopesEqual4=function(r,t,e,i){return i?U.op_Equality(U.Int128Mul(r.Y-t.Y,t.X-e.X),U.Int128Mul(r.X-t.X,t.Y-e.Y)):h.Cast_Int64((r.Y-t.Y)*(t.X-e.X))-h.Cast_Int64((r.X-t.X)*(t.Y-e.Y))===0};h.ClipperBase.SlopesEqual5=function(r,t,e,i,n){return n?U.op_Equality(U.Int128Mul(r.Y-t.Y,e.X-i.X),U.Int128Mul(r.X-t.X,e.Y-i.Y)):h.Cast_Int64((r.Y-t.Y)*(e.X-i.X))-h.Cast_Int64((r.X-t.X)*(e.Y-i.Y))===0};h.ClipperBase.prototype.Clear=function(){this.DisposeLocalMinimaList();for(var r=0,t=this.m_edges.length;r<t;++r){for(var e=0,i=this.m_edges[r].length;e<i;++e)this.m_edges[r][e]=null;h.Clear(this.m_edges[r])}h.Clear(this.m_edges),this.m_UseFullRange=!1,this.m_HasOpenPaths=!1};h.ClipperBase.prototype.DisposeLocalMinimaList=function(){for(;this.m_MinimaList!==null;){var r=this.m_MinimaList.Next;this.m_MinimaList=null,this.m_MinimaList=r}this.m_CurrentLM=null};h.ClipperBase.prototype.RangeTest=function(r,t){t.Value?(r.X>h.ClipperBase.hiRange||r.Y>h.ClipperBase.hiRange||-r.X>h.ClipperBase.hiRange||-r.Y>h.ClipperBase.hiRange)&&h.Error("Coordinate outside allowed range in RangeTest()."):(r.X>h.ClipperBase.loRange||r.Y>h.ClipperBase.loRange||-r.X>h.ClipperBase.loRange||-r.Y>h.ClipperBase.loRange)&&(t.Value=!0,this.RangeTest(r,t))};h.ClipperBase.prototype.InitEdge=function(r,t,e,i){r.Next=t,r.Prev=e,r.Curr.X=i.X,r.Curr.Y=i.Y,r.OutIdx=-1};h.ClipperBase.prototype.InitEdge2=function(r,t){r.Curr.Y>=r.Next.Curr.Y?(r.Bot.X=r.Curr.X,r.Bot.Y=r.Curr.Y,r.Top.X=r.Next.Curr.X,r.Top.Y=r.Next.Curr.Y):(r.Top.X=r.Curr.X,r.Top.Y=r.Curr.Y,r.Bot.X=r.Next.Curr.X,r.Bot.Y=r.Next.Curr.Y),this.SetDx(r),r.PolyTyp=t};h.ClipperBase.prototype.FindNextLocMin=function(r){for(var t;;){for(;h.IntPoint.op_Inequality(r.Bot,r.Prev.Bot)||h.IntPoint.op_Equality(r.Curr,r.Top);)r=r.Next;if(r.Dx!=h.ClipperBase.horizontal&&r.Prev.Dx!=h.ClipperBase.horizontal)break;for(;r.Prev.Dx==h.ClipperBase.horizontal;)r=r.Prev;for(t=r;r.Dx==h.ClipperBase.horizontal;)r=r.Next;if(r.Top.Y!=r.Prev.Bot.Y){t.Prev.Bot.X<r.Bot.X&&(r=t);break}}return r};h.ClipperBase.prototype.ProcessBound=function(r,t){var e=r,i=r,n,o;if(r.Dx==h.ClipperBase.horizontal&&(t?o=r.Prev.Bot.X:o=r.Next.Bot.X,r.Bot.X!=o&&this.ReverseHorizontal(r)),i.OutIdx!=h.ClipperBase.Skip)if(t){for(;i.Top.Y==i.Next.Bot.Y&&i.Next.OutIdx!=h.ClipperBase.Skip;)i=i.Next;if(i.Dx==h.ClipperBase.horizontal&&i.Next.OutIdx!=h.ClipperBase.Skip){for(n=i;n.Prev.Dx==h.ClipperBase.horizontal;)n=n.Prev;n.Prev.Top.X==i.Next.Top.X?t||(i=n.Prev):n.Prev.Top.X>i.Next.Top.X&&(i=n.Prev)}for(;r!=i;)r.NextInLML=r.Next,r.Dx==h.ClipperBase.horizontal&&r!=e&&r.Bot.X!=r.Prev.Top.X&&this.ReverseHorizontal(r),r=r.Next;r.Dx==h.ClipperBase.horizontal&&r!=e&&r.Bot.X!=r.Prev.Top.X&&this.ReverseHorizontal(r),i=i.Next}else{for(;i.Top.Y==i.Prev.Bot.Y&&i.Prev.OutIdx!=h.ClipperBase.Skip;)i=i.Prev;if(i.Dx==h.ClipperBase.horizontal&&i.Prev.OutIdx!=h.ClipperBase.Skip){for(n=i;n.Next.Dx==h.ClipperBase.horizontal;)n=n.Next;n.Next.Top.X==i.Prev.Top.X?t||(i=n.Next):n.Next.Top.X>i.Prev.Top.X&&(i=n.Next)}for(;r!=i;)r.NextInLML=r.Prev,r.Dx==h.ClipperBase.horizontal&&r!=e&&r.Bot.X!=r.Next.Top.X&&this.ReverseHorizontal(r),r=r.Prev;r.Dx==h.ClipperBase.horizontal&&r!=e&&r.Bot.X!=r.Next.Top.X&&this.ReverseHorizontal(r),i=i.Prev}if(i.OutIdx==h.ClipperBase.Skip){if(r=i,t){for(;r.Top.Y==r.Next.Bot.Y;)r=r.Next;for(;r!=i&&r.Dx==h.ClipperBase.horizontal;)r=r.Prev}else{for(;r.Top.Y==r.Prev.Bot.Y;)r=r.Prev;for(;r!=i&&r.Dx==h.ClipperBase.horizontal;)r=r.Next}if(r==i)t?i=r.Next:i=r.Prev;else{t?r=i.Next:r=i.Prev;var a=new h.LocalMinima;a.Next=null,a.Y=r.Bot.Y,a.LeftBound=null,a.RightBound=r,a.RightBound.WindDelta=0,i=this.ProcessBound(a.RightBound,t),this.InsertLocalMinima(a)}}return i};h.ClipperBase.prototype.AddPath=function(r,t,e){Gb?!e&&t==h.PolyType.ptClip&&h.Error("AddPath: Open paths must be subject."):e||h.Error("AddPath: Open paths have been disabled.");var i=r.length-1;if(e)for(;i>0&&h.IntPoint.op_Equality(r[i],r[0]);)--i;for(;i>0&&h.IntPoint.op_Equality(r[i],r[i-1]);)--i;if(e&&i<2||!e&&i<1)return!1;for(var n=new Array,o=0;o<=i;o++)n.push(new h.TEdge);var a=!0;n[1].Curr.X=r[1].X,n[1].Curr.Y=r[1].Y;var u={Value:this.m_UseFullRange};this.RangeTest(r[0],u),this.m_UseFullRange=u.Value,u.Value=this.m_UseFullRange,this.RangeTest(r[i],u),this.m_UseFullRange=u.Value,this.InitEdge(n[0],n[1],n[i],r[0]),this.InitEdge(n[i],n[0],n[i-1],r[i]);for(var o=i-1;o>=1;--o)u.Value=this.m_UseFullRange,this.RangeTest(r[o],u),this.m_UseFullRange=u.Value,this.InitEdge(n[o],n[o+1],n[o-1],r[o]);for(var s=n[0],p=s,f=s;;){if(h.IntPoint.op_Equality(p.Curr,p.Next.Curr)){if(p==p.Next)break;p==s&&(s=p.Next),p=this.RemoveEdge(p),f=p;continue}if(p.Prev==p.Next)break;if(e&&h.ClipperBase.SlopesEqual(p.Prev.Curr,p.Curr,p.Next.Curr,this.m_UseFullRange)&&(!this.PreserveCollinear||!this.Pt2IsBetweenPt1AndPt3(p.Prev.Curr,p.Curr,p.Next.Curr))){p==s&&(s=p.Next),p=this.RemoveEdge(p),p=p.Prev,f=p;continue}if(p=p.Next,p==f)break}if(!e&&p==p.Next||e&&p.Prev==p.Next)return!1;e||(this.m_HasOpenPaths=!0,s.Prev.OutIdx=h.ClipperBase.Skip);var m=s;p=s;do this.InitEdge2(p,t),p=p.Next,a&&p.Curr.Y!=s.Curr.Y&&(a=!1);while(p!=s);if(a){if(e)return!1;p.Prev.OutIdx=h.ClipperBase.Skip,p.Prev.Bot.X<p.Prev.Top.X&&this.ReverseHorizontal(p.Prev);var y=new h.LocalMinima;for(y.Next=null,y.Y=p.Bot.Y,y.LeftBound=null,y.RightBound=p,y.RightBound.Side=h.EdgeSide.esRight,y.RightBound.WindDelta=0;p.Next.OutIdx!=h.ClipperBase.Skip;)p.NextInLML=p.Next,p.Bot.X!=p.Prev.Top.X&&this.ReverseHorizontal(p),p=p.Next;return this.InsertLocalMinima(y),this.m_edges.push(n),!0}this.m_edges.push(n);for(var x,S=null;p=this.FindNextLocMin(p),p!=S;){S==null&&(S=p);var y=new h.LocalMinima;y.Next=null,y.Y=p.Bot.Y,p.Dx<p.Prev.Dx?(y.LeftBound=p.Prev,y.RightBound=p,x=!1):(y.LeftBound=p,y.RightBound=p.Prev,x=!0),y.LeftBound.Side=h.EdgeSide.esLeft,y.RightBound.Side=h.EdgeSide.esRight,e?y.LeftBound.Next==y.RightBound?y.LeftBound.WindDelta=-1:y.LeftBound.WindDelta=1:y.LeftBound.WindDelta=0,y.RightBound.WindDelta=-y.LeftBound.WindDelta,p=this.ProcessBound(y.LeftBound,x);var M=this.ProcessBound(y.RightBound,!x);y.LeftBound.OutIdx==h.ClipperBase.Skip?y.LeftBound=null:y.RightBound.OutIdx==h.ClipperBase.Skip&&(y.RightBound=null),this.InsertLocalMinima(y),x||(p=M)}return!0};h.ClipperBase.prototype.AddPaths=function(r,t,e){for(var i=!1,n=0,o=r.length;n<o;++n)this.AddPath(r[n],t,e)&&(i=!0);return i};h.ClipperBase.prototype.Pt2IsBetweenPt1AndPt3=function(r,t,e){return h.IntPoint.op_Equality(r,e)||h.IntPoint.op_Equality(r,t)||h.IntPoint.op_Equality(e,t)?!1:r.X!=e.X?t.X>r.X==t.X<e.X:t.Y>r.Y==t.Y<e.Y};h.ClipperBase.prototype.RemoveEdge=function(r){r.Prev.Next=r.Next,r.Next.Prev=r.Prev;var t=r.Next;return r.Prev=null,t};h.ClipperBase.prototype.SetDx=function(r){r.Delta.X=r.Top.X-r.Bot.X,r.Delta.Y=r.Top.Y-r.Bot.Y,r.Delta.Y===0?r.Dx=h.ClipperBase.horizontal:r.Dx=r.Delta.X/r.Delta.Y};h.ClipperBase.prototype.InsertLocalMinima=function(r){if(this.m_MinimaList===null)this.m_MinimaList=r;else if(r.Y>=this.m_MinimaList.Y)r.Next=this.m_MinimaList,this.m_MinimaList=r;else{for(var t=this.m_MinimaList;t.Next!==null&&r.Y<t.Next.Y;)t=t.Next;r.Next=t.Next,t.Next=r}};h.ClipperBase.prototype.PopLocalMinima=function(){this.m_CurrentLM!==null&&(this.m_CurrentLM=this.m_CurrentLM.Next)};h.ClipperBase.prototype.ReverseHorizontal=function(r){var t=r.Top.X;r.Top.X=r.Bot.X,r.Bot.X=t,Ki&&(t=r.Top.Z,r.Top.Z=r.Bot.Z,r.Bot.Z=t)};h.ClipperBase.prototype.Reset=function(){if(this.m_CurrentLM=this.m_MinimaList,this.m_CurrentLM!=null)for(var r=this.m_MinimaList;r!=null;){var t=r.LeftBound;t!=null&&(t.Curr.X=t.Bot.X,t.Curr.Y=t.Bot.Y,t.Side=h.EdgeSide.esLeft,t.OutIdx=h.ClipperBase.Unassigned),t=r.RightBound,t!=null&&(t.Curr.X=t.Bot.X,t.Curr.Y=t.Bot.Y,t.Side=h.EdgeSide.esRight,t.OutIdx=h.ClipperBase.Unassigned),r=r.Next}};h.Clipper=function(r){typeof r>"u"&&(r=0),this.m_PolyOuts=null,this.m_ClipType=h.ClipType.ctIntersection,this.m_Scanbeam=null,this.m_ActiveEdges=null,this.m_SortedEdges=null,this.m_IntersectList=null,this.m_IntersectNodeComparer=null,this.m_ExecuteLocked=!1,this.m_ClipFillType=h.PolyFillType.pftEvenOdd,this.m_SubjFillType=h.PolyFillType.pftEvenOdd,this.m_Joins=null,this.m_GhostJoins=null,this.m_UsingPolyTree=!1,this.ReverseSolution=!1,this.StrictlySimple=!1,h.ClipperBase.call(this),this.m_Scanbeam=null,this.m_ActiveEdges=null,this.m_SortedEdges=null,this.m_IntersectList=new Array,this.m_IntersectNodeComparer=h.MyIntersectNodeSort.Compare,this.m_ExecuteLocked=!1,this.m_UsingPolyTree=!1,this.m_PolyOuts=new Array,this.m_Joins=new Array,this.m_GhostJoins=new Array,this.ReverseSolution=(1&r)!==0,this.StrictlySimple=(2&r)!==0,this.PreserveCollinear=(4&r)!==0,Ki&&(this.ZFillFunction=null)};h.Clipper.ioReverseSolution=1;h.Clipper.ioStrictlySimple=2;h.Clipper.ioPreserveCollinear=4;h.Clipper.prototype.Clear=function(){this.m_edges.length!==0&&(this.DisposeAllPolyPts(),h.ClipperBase.prototype.Clear.call(this))};h.Clipper.prototype.DisposeScanbeamList=function(){for(;this.m_Scanbeam!==null;){var r=this.m_Scanbeam.Next;this.m_Scanbeam=null,this.m_Scanbeam=r}};h.Clipper.prototype.Reset=function(){h.ClipperBase.prototype.Reset.call(this),this.m_Scanbeam=null,this.m_ActiveEdges=null,this.m_SortedEdges=null;for(var r=this.m_MinimaList;r!==null;)this.InsertScanbeam(r.Y),r=r.Next};h.Clipper.prototype.InsertScanbeam=function(r){if(this.m_Scanbeam===null)this.m_Scanbeam=new h.Scanbeam,this.m_Scanbeam.Next=null,this.m_Scanbeam.Y=r;else if(r>this.m_Scanbeam.Y){var t=new h.Scanbeam;t.Y=r,t.Next=this.m_Scanbeam,this.m_Scanbeam=t}else{for(var e=this.m_Scanbeam;e.Next!==null&&r<=e.Next.Y;)e=e.Next;if(r==e.Y)return;var t=new h.Scanbeam;t.Y=r,t.Next=e.Next,e.Next=t}};h.Clipper.prototype.Execute=function(){var r=arguments,t=r.length,e=r[1]instanceof h.PolyTree;if(t==4&&!e){var i=r[0],n=r[1],o=r[2],a=r[3];if(this.m_ExecuteLocked)return!1;this.m_HasOpenPaths&&h.Error("Error: PolyTree struct is need for open path clipping."),this.m_ExecuteLocked=!0,h.Clear(n),this.m_SubjFillType=o,this.m_ClipFillType=a,this.m_ClipType=i,this.m_UsingPolyTree=!1;try{var u=this.ExecuteInternal();u&&this.BuildResult(n)}finally{this.DisposeAllPolyPts(),this.m_ExecuteLocked=!1}return u}else if(t==4&&e){var i=r[0],s=r[1],o=r[2],a=r[3];if(this.m_ExecuteLocked)return!1;this.m_ExecuteLocked=!0,this.m_SubjFillType=o,this.m_ClipFillType=a,this.m_ClipType=i,this.m_UsingPolyTree=!0;try{var u=this.ExecuteInternal();u&&this.BuildResult2(s)}finally{this.DisposeAllPolyPts(),this.m_ExecuteLocked=!1}return u}else if(t==2&&!e){var i=r[0],n=r[1];return this.Execute(i,n,h.PolyFillType.pftEvenOdd,h.PolyFillType.pftEvenOdd)}else if(t==2&&e){var i=r[0],s=r[1];return this.Execute(i,s,h.PolyFillType.pftEvenOdd,h.PolyFillType.pftEvenOdd)}};h.Clipper.prototype.FixHoleLinkage=function(r){if(!(r.FirstLeft===null||r.IsHole!=r.FirstLeft.IsHole&&r.FirstLeft.Pts!==null)){for(var t=r.FirstLeft;t!==null&&(t.IsHole==r.IsHole||t.Pts===null);)t=t.FirstLeft;r.FirstLeft=t}};h.Clipper.prototype.ExecuteInternal=function(){try{if(this.Reset(),this.m_CurrentLM===null)return!1;var r=this.PopScanbeam();do{if(this.InsertLocalMinimaIntoAEL(r),h.Clear(this.m_GhostJoins),this.ProcessHorizontals(!1),this.m_Scanbeam===null)break;var t=this.PopScanbeam();if(!this.ProcessIntersections(r,t))return!1;this.ProcessEdgesAtTopOfScanbeam(t),r=t}while(this.m_Scanbeam!==null||this.m_CurrentLM!==null);for(var e=0,i=this.m_PolyOuts.length;e<i;e++){var n=this.m_PolyOuts[e];n.Pts===null||n.IsOpen||(n.IsHole^this.ReverseSolution)==this.Area(n)>0&&this.ReversePolyPtLinks(n.Pts)}this.JoinCommonEdges();for(var e=0,i=this.m_PolyOuts.length;e<i;e++){var n=this.m_PolyOuts[e];n.Pts!==null&&!n.IsOpen&&this.FixupOutPolygon(n)}return this.StrictlySimple&&this.DoSimplePolygons(),!0}finally{h.Clear(this.m_Joins),h.Clear(this.m_GhostJoins)}};h.Clipper.prototype.PopScanbeam=function(){var r=this.m_Scanbeam.Y,t=this.m_Scanbeam;return this.m_Scanbeam=this.m_Scanbeam.Next,t=null,r};h.Clipper.prototype.DisposeAllPolyPts=function(){for(var r=0,t=this.m_PolyOuts.length;r<t;++r)this.DisposeOutRec(r);h.Clear(this.m_PolyOuts)};h.Clipper.prototype.DisposeOutRec=function(r){var t=this.m_PolyOuts[r];t.Pts!==null&&this.DisposeOutPts(t.Pts),t=null,this.m_PolyOuts[r]=null};h.Clipper.prototype.DisposeOutPts=function(r){if(r!==null){var t=null;for(r.Prev.Next=null;r!==null;)t=r,r=r.Next,t=null}};h.Clipper.prototype.AddJoin=function(r,t,e){var i=new h.Join;i.OutPt1=r,i.OutPt2=t,i.OffPt.X=e.X,i.OffPt.Y=e.Y,this.m_Joins.push(i)};h.Clipper.prototype.AddGhostJoin=function(r,t){var e=new h.Join;e.OutPt1=r,e.OffPt.X=t.X,e.OffPt.Y=t.Y,this.m_GhostJoins.push(e)};Ki&&(h.Clipper.prototype.SetZ=function(r,t){r.Z=0,this.ZFillFunction!==null&&(t.OutIdx<0?this.ZFillFunction(t.Bot,t.Top,r):this.ZFillFunction(t.Top,t.Bot,r))});h.Clipper.prototype.InsertLocalMinimaIntoAEL=function(r){for(;this.m_CurrentLM!==null&&this.m_CurrentLM.Y==r;){var t=this.m_CurrentLM.LeftBound,e=this.m_CurrentLM.RightBound;this.PopLocalMinima();var i=null;if(t===null?(this.InsertEdgeIntoAEL(e,null),this.SetWindingCount(e),this.IsContributing(e)&&(i=this.AddOutPt(e,e.Bot))):e==null?(this.InsertEdgeIntoAEL(t,null),this.SetWindingCount(t),this.IsContributing(t)&&(i=this.AddOutPt(t,t.Bot)),this.InsertScanbeam(t.Top.Y)):(this.InsertEdgeIntoAEL(t,null),this.InsertEdgeIntoAEL(e,t),this.SetWindingCount(t),e.WindCnt=t.WindCnt,e.WindCnt2=t.WindCnt2,this.IsContributing(t)&&(i=this.AddLocalMinPoly(t,e,t.Bot)),this.InsertScanbeam(t.Top.Y)),e!=null&&(h.ClipperBase.IsHorizontal(e)?this.AddEdgeToSEL(e):this.InsertScanbeam(e.Top.Y)),!(t==null||e==null)){if(i!==null&&h.ClipperBase.IsHorizontal(e)&&this.m_GhostJoins.length>0&&e.WindDelta!==0)for(var n=0,o=this.m_GhostJoins.length;n<o;n++){var a=this.m_GhostJoins[n];this.HorzSegmentsOverlap(a.OutPt1.Pt,a.OffPt,e.Bot,e.Top)&&this.AddJoin(a.OutPt1,i,a.OffPt)}if(t.OutIdx>=0&&t.PrevInAEL!==null&&t.PrevInAEL.Curr.X==t.Bot.X&&t.PrevInAEL.OutIdx>=0&&h.ClipperBase.SlopesEqual(t.PrevInAEL,t,this.m_UseFullRange)&&t.WindDelta!==0&&t.PrevInAEL.WindDelta!==0){var u=this.AddOutPt(t.PrevInAEL,t.Bot);this.AddJoin(i,u,t.Top)}if(t.NextInAEL!=e){if(e.OutIdx>=0&&e.PrevInAEL.OutIdx>=0&&h.ClipperBase.SlopesEqual(e.PrevInAEL,e,this.m_UseFullRange)&&e.WindDelta!==0&&e.PrevInAEL.WindDelta!==0){var u=this.AddOutPt(e.PrevInAEL,e.Bot);this.AddJoin(i,u,e.Top)}var s=t.NextInAEL;if(s!==null)for(;s!=e;)this.IntersectEdges(e,s,t.Curr,!1),s=s.NextInAEL}}}};h.Clipper.prototype.InsertEdgeIntoAEL=function(r,t){if(this.m_ActiveEdges===null)r.PrevInAEL=null,r.NextInAEL=null,this.m_ActiveEdges=r;else if(t===null&&this.E2InsertsBeforeE1(this.m_ActiveEdges,r))r.PrevInAEL=null,r.NextInAEL=this.m_ActiveEdges,this.m_ActiveEdges.PrevInAEL=r,this.m_ActiveEdges=r;else{for(t===null&&(t=this.m_ActiveEdges);t.NextInAEL!==null&&!this.E2InsertsBeforeE1(t.NextInAEL,r);)t=t.NextInAEL;r.NextInAEL=t.NextInAEL,t.NextInAEL!==null&&(t.NextInAEL.PrevInAEL=r),r.PrevInAEL=t,t.NextInAEL=r}};h.Clipper.prototype.E2InsertsBeforeE1=function(r,t){return t.Curr.X==r.Curr.X?t.Top.Y>r.Top.Y?t.Top.X<h.Clipper.TopX(r,t.Top.Y):r.Top.X>h.Clipper.TopX(t,r.Top.Y):t.Curr.X<r.Curr.X};h.Clipper.prototype.IsEvenOddFillType=function(r){return r.PolyTyp==h.PolyType.ptSubject?this.m_SubjFillType==h.PolyFillType.pftEvenOdd:this.m_ClipFillType==h.PolyFillType.pftEvenOdd};h.Clipper.prototype.IsEvenOddAltFillType=function(r){return r.PolyTyp==h.PolyType.ptSubject?this.m_ClipFillType==h.PolyFillType.pftEvenOdd:this.m_SubjFillType==h.PolyFillType.pftEvenOdd};h.Clipper.prototype.IsContributing=function(r){var t,e;switch(r.PolyTyp==h.PolyType.ptSubject?(t=this.m_SubjFillType,e=this.m_ClipFillType):(t=this.m_ClipFillType,e=this.m_SubjFillType),t){case h.PolyFillType.pftEvenOdd:if(r.WindDelta===0&&r.WindCnt!=1)return!1;break;case h.PolyFillType.pftNonZero:if(Math.abs(r.WindCnt)!=1)return!1;break;case h.PolyFillType.pftPositive:if(r.WindCnt!=1)return!1;break;default:if(r.WindCnt!=-1)return!1;break}switch(this.m_ClipType){case h.ClipType.ctIntersection:switch(e){case h.PolyFillType.pftEvenOdd:case h.PolyFillType.pftNonZero:return r.WindCnt2!==0;case h.PolyFillType.pftPositive:return r.WindCnt2>0;default:return r.WindCnt2<0}case h.ClipType.ctUnion:switch(e){case h.PolyFillType.pftEvenOdd:case h.PolyFillType.pftNonZero:return r.WindCnt2===0;case h.PolyFillType.pftPositive:return r.WindCnt2<=0;default:return r.WindCnt2>=0}case h.ClipType.ctDifference:if(r.PolyTyp==h.PolyType.ptSubject)switch(e){case h.PolyFillType.pftEvenOdd:case h.PolyFillType.pftNonZero:return r.WindCnt2===0;case h.PolyFillType.pftPositive:return r.WindCnt2<=0;default:return r.WindCnt2>=0}else switch(e){case h.PolyFillType.pftEvenOdd:case h.PolyFillType.pftNonZero:return r.WindCnt2!==0;case h.PolyFillType.pftPositive:return r.WindCnt2>0;default:return r.WindCnt2<0}case h.ClipType.ctXor:if(r.WindDelta===0)switch(e){case h.PolyFillType.pftEvenOdd:case h.PolyFillType.pftNonZero:return r.WindCnt2===0;case h.PolyFillType.pftPositive:return r.WindCnt2<=0;default:return r.WindCnt2>=0}else return!0}return!0};h.Clipper.prototype.SetWindingCount=function(r){for(var t=r.PrevInAEL;t!==null&&(t.PolyTyp!=r.PolyTyp||t.WindDelta===0);)t=t.PrevInAEL;if(t===null)r.WindCnt=r.WindDelta===0?1:r.WindDelta,r.WindCnt2=0,t=this.m_ActiveEdges;else if(r.WindDelta===0&&this.m_ClipType!=h.ClipType.ctUnion)r.WindCnt=1,r.WindCnt2=t.WindCnt2,t=t.NextInAEL;else if(this.IsEvenOddFillType(r)){if(r.WindDelta===0){for(var e=!0,i=t.PrevInAEL;i!==null;)i.PolyTyp==t.PolyTyp&&i.WindDelta!==0&&(e=!e),i=i.PrevInAEL;r.WindCnt=e?0:1}else r.WindCnt=r.WindDelta;r.WindCnt2=t.WindCnt2,t=t.NextInAEL}else t.WindCnt*t.WindDelta<0?Math.abs(t.WindCnt)>1?t.WindDelta*r.WindDelta<0?r.WindCnt=t.WindCnt:r.WindCnt=t.WindCnt+r.WindDelta:r.WindCnt=r.WindDelta===0?1:r.WindDelta:r.WindDelta===0?r.WindCnt=t.WindCnt<0?t.WindCnt-1:t.WindCnt+1:t.WindDelta*r.WindDelta<0?r.WindCnt=t.WindCnt:r.WindCnt=t.WindCnt+r.WindDelta,r.WindCnt2=t.WindCnt2,t=t.NextInAEL;if(this.IsEvenOddAltFillType(r))for(;t!=r;)t.WindDelta!==0&&(r.WindCnt2=r.WindCnt2===0?1:0),t=t.NextInAEL;else for(;t!=r;)r.WindCnt2+=t.WindDelta,t=t.NextInAEL};h.Clipper.prototype.AddEdgeToSEL=function(r){this.m_SortedEdges===null?(this.m_SortedEdges=r,r.PrevInSEL=null,r.NextInSEL=null):(r.NextInSEL=this.m_SortedEdges,r.PrevInSEL=null,this.m_SortedEdges.PrevInSEL=r,this.m_SortedEdges=r)};h.Clipper.prototype.CopyAELToSEL=function(){var r=this.m_ActiveEdges;for(this.m_SortedEdges=r;r!==null;)r.PrevInSEL=r.PrevInAEL,r.NextInSEL=r.NextInAEL,r=r.NextInAEL};h.Clipper.prototype.SwapPositionsInAEL=function(r,t){if(!(r.NextInAEL==r.PrevInAEL||t.NextInAEL==t.PrevInAEL)){if(r.NextInAEL==t){var e=t.NextInAEL;e!==null&&(e.PrevInAEL=r);var i=r.PrevInAEL;i!==null&&(i.NextInAEL=t),t.PrevInAEL=i,t.NextInAEL=r,r.PrevInAEL=t,r.NextInAEL=e}else if(t.NextInAEL==r){var e=r.NextInAEL;e!==null&&(e.PrevInAEL=t);var i=t.PrevInAEL;i!==null&&(i.NextInAEL=r),r.PrevInAEL=i,r.NextInAEL=t,t.PrevInAEL=r,t.NextInAEL=e}else{var e=r.NextInAEL,i=r.PrevInAEL;r.NextInAEL=t.NextInAEL,r.NextInAEL!==null&&(r.NextInAEL.PrevInAEL=r),r.PrevInAEL=t.PrevInAEL,r.PrevInAEL!==null&&(r.PrevInAEL.NextInAEL=r),t.NextInAEL=e,t.NextInAEL!==null&&(t.NextInAEL.PrevInAEL=t),t.PrevInAEL=i,t.PrevInAEL!==null&&(t.PrevInAEL.NextInAEL=t)}r.PrevInAEL===null?this.m_ActiveEdges=r:t.PrevInAEL===null&&(this.m_ActiveEdges=t)}};h.Clipper.prototype.SwapPositionsInSEL=function(r,t){if(!(r.NextInSEL===null&&r.PrevInSEL===null)&&!(t.NextInSEL===null&&t.PrevInSEL===null)){if(r.NextInSEL==t){var e=t.NextInSEL;e!==null&&(e.PrevInSEL=r);var i=r.PrevInSEL;i!==null&&(i.NextInSEL=t),t.PrevInSEL=i,t.NextInSEL=r,r.PrevInSEL=t,r.NextInSEL=e}else if(t.NextInSEL==r){var e=r.NextInSEL;e!==null&&(e.PrevInSEL=t);var i=t.PrevInSEL;i!==null&&(i.NextInSEL=r),r.PrevInSEL=i,r.NextInSEL=t,t.PrevInSEL=r,t.NextInSEL=e}else{var e=r.NextInSEL,i=r.PrevInSEL;r.NextInSEL=t.NextInSEL,r.NextInSEL!==null&&(r.NextInSEL.PrevInSEL=r),r.PrevInSEL=t.PrevInSEL,r.PrevInSEL!==null&&(r.PrevInSEL.NextInSEL=r),t.NextInSEL=e,t.NextInSEL!==null&&(t.NextInSEL.PrevInSEL=t),t.PrevInSEL=i,t.PrevInSEL!==null&&(t.PrevInSEL.NextInSEL=t)}r.PrevInSEL===null?this.m_SortedEdges=r:t.PrevInSEL===null&&(this.m_SortedEdges=t)}};h.Clipper.prototype.AddLocalMaxPoly=function(r,t,e){this.AddOutPt(r,e),t.WindDelta==0&&this.AddOutPt(t,e),r.OutIdx==t.OutIdx?(r.OutIdx=-1,t.OutIdx=-1):r.OutIdx<t.OutIdx?this.AppendPolygon(r,t):this.AppendPolygon(t,r)};h.Clipper.prototype.AddLocalMinPoly=function(r,t,e){var i,n,o;if(h.ClipperBase.IsHorizontal(t)||r.Dx>t.Dx?(i=this.AddOutPt(r,e),t.OutIdx=r.OutIdx,r.Side=h.EdgeSide.esLeft,t.Side=h.EdgeSide.esRight,n=r,n.PrevInAEL==t?o=t.PrevInAEL:o=n.PrevInAEL):(i=this.AddOutPt(t,e),r.OutIdx=t.OutIdx,r.Side=h.EdgeSide.esRight,t.Side=h.EdgeSide.esLeft,n=t,n.PrevInAEL==r?o=r.PrevInAEL:o=n.PrevInAEL),o!==null&&o.OutIdx>=0&&h.Clipper.TopX(o,e.Y)==h.Clipper.TopX(n,e.Y)&&h.ClipperBase.SlopesEqual(n,o,this.m_UseFullRange)&&n.WindDelta!==0&&o.WindDelta!==0){var a=this.AddOutPt(o,e);this.AddJoin(i,a,n.Top)}return i};h.Clipper.prototype.CreateOutRec=function(){var r=new h.OutRec;return r.Idx=-1,r.IsHole=!1,r.IsOpen=!1,r.FirstLeft=null,r.Pts=null,r.BottomPt=null,r.PolyNode=null,this.m_PolyOuts.push(r),r.Idx=this.m_PolyOuts.length-1,r};h.Clipper.prototype.AddOutPt=function(r,t){var e=r.Side==h.EdgeSide.esLeft;if(r.OutIdx<0){var i=this.CreateOutRec();i.IsOpen=r.WindDelta===0;var n=new h.OutPt;return i.Pts=n,n.Idx=i.Idx,n.Pt.X=t.X,n.Pt.Y=t.Y,n.Next=n,n.Prev=n,i.IsOpen||this.SetHoleState(r,i),Ki&&(h.IntPoint.op_Equality(t,r.Bot)?(n.Pt.X=r.Bot.X,n.Pt.Y=r.Bot.Y,n.Pt.Z=r.Bot.Z):h.IntPoint.op_Equality(t,r.Top)?(n.Pt.X=r.Top.X,n.Pt.Y=r.Top.Y,n.Pt.Z=r.Top.Z):this.SetZ(n.Pt,r)),r.OutIdx=i.Idx,n}else{var i=this.m_PolyOuts[r.OutIdx],o=i.Pts;if(e&&h.IntPoint.op_Equality(t,o.Pt))return o;if(!e&&h.IntPoint.op_Equality(t,o.Prev.Pt))return o.Prev;var n=new h.OutPt;return n.Idx=i.Idx,n.Pt.X=t.X,n.Pt.Y=t.Y,n.Next=o,n.Prev=o.Prev,n.Prev.Next=n,o.Prev=n,e&&(i.Pts=n),Ki&&(h.IntPoint.op_Equality(t,r.Bot)?(n.Pt.X=r.Bot.X,n.Pt.Y=r.Bot.Y,n.Pt.Z=r.Bot.Z):h.IntPoint.op_Equality(t,r.Top)?(n.Pt.X=r.Top.X,n.Pt.Y=r.Top.Y,n.Pt.Z=r.Top.Z):this.SetZ(n.Pt,r)),n}};h.Clipper.prototype.SwapPoints=function(r,t){var e=new h.IntPoint(r.Value);r.Value.X=t.Value.X,r.Value.Y=t.Value.Y,t.Value.X=e.X,t.Value.Y=e.Y};h.Clipper.prototype.HorzSegmentsOverlap=function(r,t,e,i){return r.X>e.X==r.X<i.X||t.X>e.X==t.X<i.X||e.X>r.X==e.X<t.X||i.X>r.X==i.X<t.X||r.X==e.X&&t.X==i.X?!0:r.X==i.X&&t.X==e.X};h.Clipper.prototype.InsertPolyPtBetween=function(r,t,e){var i=new h.OutPt;return i.Pt.X=e.X,i.Pt.Y=e.Y,t==r.Next?(r.Next=i,t.Prev=i,i.Next=t,i.Prev=r):(t.Next=i,r.Prev=i,i.Next=r,i.Prev=t),i};h.Clipper.prototype.SetHoleState=function(r,t){for(var e=!1,i=r.PrevInAEL;i!==null;)i.OutIdx>=0&&i.WindDelta!=0&&(e=!e,t.FirstLeft===null&&(t.FirstLeft=this.m_PolyOuts[i.OutIdx])),i=i.PrevInAEL;e&&(t.IsHole=!0)};h.Clipper.prototype.GetDx=function(r,t){return r.Y==t.Y?h.ClipperBase.horizontal:(t.X-r.X)/(t.Y-r.Y)};h.Clipper.prototype.FirstIsBottomPt=function(r,t){for(var e=r.Prev;h.IntPoint.op_Equality(e.Pt,r.Pt)&&e!=r;)e=e.Prev;var i=Math.abs(this.GetDx(r.Pt,e.Pt));for(e=r.Next;h.IntPoint.op_Equality(e.Pt,r.Pt)&&e!=r;)e=e.Next;var n=Math.abs(this.GetDx(r.Pt,e.Pt));for(e=t.Prev;h.IntPoint.op_Equality(e.Pt,t.Pt)&&e!=t;)e=e.Prev;var o=Math.abs(this.GetDx(t.Pt,e.Pt));for(e=t.Next;h.IntPoint.op_Equality(e.Pt,t.Pt)&&e!=t;)e=e.Next;var a=Math.abs(this.GetDx(t.Pt,e.Pt));return i>=o&&i>=a||n>=o&&n>=a};h.Clipper.prototype.GetBottomPt=function(r){for(var t=null,e=r.Next;e!=r;)e.Pt.Y>r.Pt.Y?(r=e,t=null):e.Pt.Y==r.Pt.Y&&e.Pt.X<=r.Pt.X&&(e.Pt.X<r.Pt.X?(t=null,r=e):e.Next!=r&&e.Prev!=r&&(t=e)),e=e.Next;if(t!==null)for(;t!=e;)for(this.FirstIsBottomPt(e,t)||(r=t),t=t.Next;h.IntPoint.op_Inequality(t.Pt,r.Pt);)t=t.Next;return r};h.Clipper.prototype.GetLowermostRec=function(r,t){r.BottomPt===null&&(r.BottomPt=this.GetBottomPt(r.Pts)),t.BottomPt===null&&(t.BottomPt=this.GetBottomPt(t.Pts));var e=r.BottomPt,i=t.BottomPt;return e.Pt.Y>i.Pt.Y?r:e.Pt.Y<i.Pt.Y?t:e.Pt.X<i.Pt.X?r:e.Pt.X>i.Pt.X||e.Next==e?t:i.Next==i||this.FirstIsBottomPt(e,i)?r:t};h.Clipper.prototype.Param1RightOfParam2=function(r,t){do if(r=r.FirstLeft,r==t)return!0;while(r!==null);return!1};h.Clipper.prototype.GetOutRec=function(r){for(var t=this.m_PolyOuts[r];t!=this.m_PolyOuts[t.Idx];)t=this.m_PolyOuts[t.Idx];return t};h.Clipper.prototype.AppendPolygon=function(r,t){var e=this.m_PolyOuts[r.OutIdx],i=this.m_PolyOuts[t.OutIdx],n;this.Param1RightOfParam2(e,i)?n=i:this.Param1RightOfParam2(i,e)?n=e:n=this.GetLowermostRec(e,i);var o=e.Pts,a=o.Prev,u=i.Pts,s=u.Prev,p;r.Side==h.EdgeSide.esLeft?(t.Side==h.EdgeSide.esLeft?(this.ReversePolyPtLinks(u),u.Next=o,o.Prev=u,a.Next=s,s.Prev=a,e.Pts=s):(s.Next=o,o.Prev=s,u.Prev=a,a.Next=u,e.Pts=u),p=h.EdgeSide.esLeft):(t.Side==h.EdgeSide.esRight?(this.ReversePolyPtLinks(u),a.Next=s,s.Prev=a,u.Next=o,o.Prev=u):(a.Next=u,u.Prev=a,o.Prev=s,s.Next=o),p=h.EdgeSide.esRight),e.BottomPt=null,n==i&&(i.FirstLeft!=e&&(e.FirstLeft=i.FirstLeft),e.IsHole=i.IsHole),i.Pts=null,i.BottomPt=null,i.FirstLeft=e;var f=r.OutIdx,m=t.OutIdx;r.OutIdx=-1,t.OutIdx=-1;for(var y=this.m_ActiveEdges;y!==null;){if(y.OutIdx==m){y.OutIdx=f,y.Side=p;break}y=y.NextInAEL}i.Idx=e.Idx};h.Clipper.prototype.ReversePolyPtLinks=function(r){if(r!==null){var t,e;t=r;do e=t.Next,t.Next=t.Prev,t.Prev=e,t=e;while(t!=r)}};h.Clipper.SwapSides=function(r,t){var e=r.Side;r.Side=t.Side,t.Side=e};h.Clipper.SwapPolyIndexes=function(r,t){var e=r.OutIdx;r.OutIdx=t.OutIdx,t.OutIdx=e};h.Clipper.prototype.IntersectEdges=function(r,t,e,i){var n=!i&&r.NextInLML===null&&r.Top.X==e.X&&r.Top.Y==e.Y,o=!i&&t.NextInLML===null&&t.Top.X==e.X&&t.Top.Y==e.Y,a=r.OutIdx>=0,u=t.OutIdx>=0;if(Gb&&(r.WindDelta===0||t.WindDelta===0)){r.WindDelta===0&&t.WindDelta===0?(n||o)&&a&&u&&this.AddLocalMaxPoly(r,t,e):r.PolyTyp==t.PolyTyp&&r.WindDelta!=t.WindDelta&&this.m_ClipType==h.ClipType.ctUnion?r.WindDelta===0?u&&(this.AddOutPt(r,e),a&&(r.OutIdx=-1)):a&&(this.AddOutPt(t,e),u&&(t.OutIdx=-1)):r.PolyTyp!=t.PolyTyp&&(r.WindDelta===0&&Math.abs(t.WindCnt)==1&&(this.m_ClipType!=h.ClipType.ctUnion||t.WindCnt2===0)?(this.AddOutPt(r,e),a&&(r.OutIdx=-1)):t.WindDelta===0&&Math.abs(r.WindCnt)==1&&(this.m_ClipType!=h.ClipType.ctUnion||r.WindCnt2===0)&&(this.AddOutPt(t,e),u&&(t.OutIdx=-1))),n&&(r.OutIdx<0?this.DeleteFromAEL(r):h.Error("Error intersecting polylines")),o&&(t.OutIdx<0?this.DeleteFromAEL(t):h.Error("Error intersecting polylines"));return}if(r.PolyTyp==t.PolyTyp)if(this.IsEvenOddFillType(r)){var s=r.WindCnt;r.WindCnt=t.WindCnt,t.WindCnt=s}else r.WindCnt+t.WindDelta===0?r.WindCnt=-r.WindCnt:r.WindCnt+=t.WindDelta,t.WindCnt-r.WindDelta===0?t.WindCnt=-t.WindCnt:t.WindCnt-=r.WindDelta;else this.IsEvenOddFillType(t)?r.WindCnt2=r.WindCnt2===0?1:0:r.WindCnt2+=t.WindDelta,this.IsEvenOddFillType(r)?t.WindCnt2=t.WindCnt2===0?1:0:t.WindCnt2-=r.WindDelta;var p,f,m,y;r.PolyTyp==h.PolyType.ptSubject?(p=this.m_SubjFillType,m=this.m_ClipFillType):(p=this.m_ClipFillType,m=this.m_SubjFillType),t.PolyTyp==h.PolyType.ptSubject?(f=this.m_SubjFillType,y=this.m_ClipFillType):(f=this.m_ClipFillType,y=this.m_SubjFillType);var x,S;switch(p){case h.PolyFillType.pftPositive:x=r.WindCnt;break;case h.PolyFillType.pftNegative:x=-r.WindCnt;break;default:x=Math.abs(r.WindCnt);break}switch(f){case h.PolyFillType.pftPositive:S=t.WindCnt;break;case h.PolyFillType.pftNegative:S=-t.WindCnt;break;default:S=Math.abs(t.WindCnt);break}if(a&&u)n||o||x!==0&&x!=1||S!==0&&S!=1||r.PolyTyp!=t.PolyTyp&&this.m_ClipType!=h.ClipType.ctXor?this.AddLocalMaxPoly(r,t,e):(this.AddOutPt(r,e),this.AddOutPt(t,e),h.Clipper.SwapSides(r,t),h.Clipper.SwapPolyIndexes(r,t));else if(a)(S===0||S==1)&&(this.AddOutPt(r,e),h.Clipper.SwapSides(r,t),h.Clipper.SwapPolyIndexes(r,t));else if(u)(x===0||x==1)&&(this.AddOutPt(t,e),h.Clipper.SwapSides(r,t),h.Clipper.SwapPolyIndexes(r,t));else if((x===0||x==1)&&(S===0||S==1)&&!n&&!o){var M,g;switch(m){case h.PolyFillType.pftPositive:M=r.WindCnt2;break;case h.PolyFillType.pftNegative:M=-r.WindCnt2;break;default:M=Math.abs(r.WindCnt2);break}switch(y){case h.PolyFillType.pftPositive:g=t.WindCnt2;break;case h.PolyFillType.pftNegative:g=-t.WindCnt2;break;default:g=Math.abs(t.WindCnt2);break}if(r.PolyTyp!=t.PolyTyp)this.AddLocalMinPoly(r,t,e);else if(x==1&&S==1)switch(this.m_ClipType){case h.ClipType.ctIntersection:M>0&&g>0&&this.AddLocalMinPoly(r,t,e);break;case h.ClipType.ctUnion:M<=0&&g<=0&&this.AddLocalMinPoly(r,t,e);break;case h.ClipType.ctDifference:(r.PolyTyp==h.PolyType.ptClip&&M>0&&g>0||r.PolyTyp==h.PolyType.ptSubject&&M<=0&&g<=0)&&this.AddLocalMinPoly(r,t,e);break;case h.ClipType.ctXor:this.AddLocalMinPoly(r,t,e);break}else h.Clipper.SwapSides(r,t)}n!=o&&(n&&r.OutIdx>=0||o&&t.OutIdx>=0)&&(h.Clipper.SwapSides(r,t),h.Clipper.SwapPolyIndexes(r,t)),n&&this.DeleteFromAEL(r),o&&this.DeleteFromAEL(t)};h.Clipper.prototype.DeleteFromAEL=function(r){var t=r.PrevInAEL,e=r.NextInAEL;t===null&&e===null&&r!=this.m_ActiveEdges||(t!==null?t.NextInAEL=e:this.m_ActiveEdges=e,e!==null&&(e.PrevInAEL=t),r.NextInAEL=null,r.PrevInAEL=null)};h.Clipper.prototype.DeleteFromSEL=function(r){var t=r.PrevInSEL,e=r.NextInSEL;t===null&&e===null&&r!=this.m_SortedEdges||(t!==null?t.NextInSEL=e:this.m_SortedEdges=e,e!==null&&(e.PrevInSEL=t),r.NextInSEL=null,r.PrevInSEL=null)};h.Clipper.prototype.UpdateEdgeIntoAEL=function(r){r.NextInLML===null&&h.Error("UpdateEdgeIntoAEL: invalid call");var t=r.PrevInAEL,e=r.NextInAEL;return r.NextInLML.OutIdx=r.OutIdx,t!==null?t.NextInAEL=r.NextInLML:this.m_ActiveEdges=r.NextInLML,e!==null&&(e.PrevInAEL=r.NextInLML),r.NextInLML.Side=r.Side,r.NextInLML.WindDelta=r.WindDelta,r.NextInLML.WindCnt=r.WindCnt,r.NextInLML.WindCnt2=r.WindCnt2,r=r.NextInLML,r.Curr.X=r.Bot.X,r.Curr.Y=r.Bot.Y,r.PrevInAEL=t,r.NextInAEL=e,h.ClipperBase.IsHorizontal(r)||this.InsertScanbeam(r.Top.Y),r};h.Clipper.prototype.ProcessHorizontals=function(r){for(var t=this.m_SortedEdges;t!==null;)this.DeleteFromSEL(t),this.ProcessHorizontal(t,r),t=this.m_SortedEdges};h.Clipper.prototype.GetHorzDirection=function(r,t){r.Bot.X<r.Top.X?(t.Left=r.Bot.X,t.Right=r.Top.X,t.Dir=h.Direction.dLeftToRight):(t.Left=r.Top.X,t.Right=r.Bot.X,t.Dir=h.Direction.dRightToLeft)};h.Clipper.prototype.PrepareHorzJoins=function(r,t){var e=this.m_PolyOuts[r.OutIdx].Pts;r.Side!=h.EdgeSide.esLeft&&(e=e.Prev),t&&(h.IntPoint.op_Equality(e.Pt,r.Top)?this.AddGhostJoin(e,r.Bot):this.AddGhostJoin(e,r.Top))};h.Clipper.prototype.ProcessHorizontal=function(r,t){var e={Dir:null,Left:null,Right:null};this.GetHorzDirection(r,e);for(var i=e.Dir,n=e.Left,o=e.Right,a=r,u=null;a.NextInLML!==null&&h.ClipperBase.IsHorizontal(a.NextInLML);)a=a.NextInLML;for(a.NextInLML===null&&(u=this.GetMaximaPair(a));;){for(var s=r==a,p=this.GetNextInAEL(r,i);p!==null&&!(p.Curr.X==r.Top.X&&r.NextInLML!==null&&p.Dx<r.NextInLML.Dx);){var f=this.GetNextInAEL(p,i);if(i==h.Direction.dLeftToRight&&p.Curr.X<=o||i==h.Direction.dRightToLeft&&p.Curr.X>=n){if(r.OutIdx>=0&&r.WindDelta!=0&&this.PrepareHorzJoins(r,t),p==u&&s){i==h.Direction.dLeftToRight?this.IntersectEdges(r,p,p.Top,!1):this.IntersectEdges(p,r,p.Top,!1),u.OutIdx>=0&&h.Error("ProcessHorizontal error");return}else if(i==h.Direction.dLeftToRight){var m=new h.IntPoint(p.Curr.X,r.Curr.Y);this.IntersectEdges(r,p,m,!0)}else{var m=new h.IntPoint(p.Curr.X,r.Curr.Y);this.IntersectEdges(p,r,m,!0)}this.SwapPositionsInAEL(r,p)}else if(i==h.Direction.dLeftToRight&&p.Curr.X>=o||i==h.Direction.dRightToLeft&&p.Curr.X<=n)break;p=f}if(r.OutIdx>=0&&r.WindDelta!==0&&this.PrepareHorzJoins(r,t),r.NextInLML!==null&&h.ClipperBase.IsHorizontal(r.NextInLML)){r=this.UpdateEdgeIntoAEL(r),r.OutIdx>=0&&this.AddOutPt(r,r.Bot);var e={Dir:i,Left:n,Right:o};this.GetHorzDirection(r,e),i=e.Dir,n=e.Left,o=e.Right}else break}if(r.NextInLML!==null)if(r.OutIdx>=0){var y=this.AddOutPt(r,r.Top);if(r=this.UpdateEdgeIntoAEL(r),r.WindDelta===0)return;var x=r.PrevInAEL,f=r.NextInAEL;if(x!==null&&x.Curr.X==r.Bot.X&&x.Curr.Y==r.Bot.Y&&x.WindDelta!==0&&x.OutIdx>=0&&x.Curr.Y>x.Top.Y&&h.ClipperBase.SlopesEqual(r,x,this.m_UseFullRange)){var S=this.AddOutPt(x,r.Bot);this.AddJoin(y,S,r.Top)}else if(f!==null&&f.Curr.X==r.Bot.X&&f.Curr.Y==r.Bot.Y&&f.WindDelta!==0&&f.OutIdx>=0&&f.Curr.Y>f.Top.Y&&h.ClipperBase.SlopesEqual(r,f,this.m_UseFullRange)){var S=this.AddOutPt(f,r.Bot);this.AddJoin(y,S,r.Top)}}else r=this.UpdateEdgeIntoAEL(r);else u!==null?u.OutIdx>=0?(i==h.Direction.dLeftToRight?this.IntersectEdges(r,u,r.Top,!1):this.IntersectEdges(u,r,r.Top,!1),u.OutIdx>=0&&h.Error("ProcessHorizontal error")):(this.DeleteFromAEL(r),this.DeleteFromAEL(u)):(r.OutIdx>=0&&this.AddOutPt(r,r.Top),this.DeleteFromAEL(r))};h.Clipper.prototype.GetNextInAEL=function(r,t){return t==h.Direction.dLeftToRight?r.NextInAEL:r.PrevInAEL};h.Clipper.prototype.IsMinima=function(r){return r!==null&&r.Prev.NextInLML!=r&&r.Next.NextInLML!=r};h.Clipper.prototype.IsMaxima=function(r,t){return r!==null&&r.Top.Y==t&&r.NextInLML===null};h.Clipper.prototype.IsIntermediate=function(r,t){return r.Top.Y==t&&r.NextInLML!==null};h.Clipper.prototype.GetMaximaPair=function(r){var t=null;return h.IntPoint.op_Equality(r.Next.Top,r.Top)&&r.Next.NextInLML===null?t=r.Next:h.IntPoint.op_Equality(r.Prev.Top,r.Top)&&r.Prev.NextInLML===null&&(t=r.Prev),t!==null&&(t.OutIdx==-2||t.NextInAEL==t.PrevInAEL&&!h.ClipperBase.IsHorizontal(t))?null:t};h.Clipper.prototype.ProcessIntersections=function(r,t){if(this.m_ActiveEdges==null)return!0;try{if(this.BuildIntersectList(r,t),this.m_IntersectList.length==0)return!0;if(this.m_IntersectList.length==1||this.FixupIntersectionOrder())this.ProcessIntersectList();else return!1}catch{this.m_SortedEdges=null,this.m_IntersectList.length=0,h.Error("ProcessIntersections error")}return this.m_SortedEdges=null,!0};h.Clipper.prototype.BuildIntersectList=function(r,t){if(this.m_ActiveEdges!==null){var e=this.m_ActiveEdges;for(this.m_SortedEdges=e;e!==null;)e.PrevInSEL=e.PrevInAEL,e.NextInSEL=e.NextInAEL,e.Curr.X=h.Clipper.TopX(e,t),e=e.NextInAEL;for(var i=!0;i&&this.m_SortedEdges!==null;){for(i=!1,e=this.m_SortedEdges;e.NextInSEL!==null;){var n=e.NextInSEL,o=new h.IntPoint;if(e.Curr.X>n.Curr.X){!this.IntersectPoint(e,n,o)&&e.Curr.X>n.Curr.X+1&&h.Error("Intersection error"),o.Y>r&&(o.Y=r,Math.abs(e.Dx)>Math.abs(n.Dx)?o.X=h.Clipper.TopX(n,r):o.X=h.Clipper.TopX(e,r));var a=new h.IntersectNode;a.Edge1=e,a.Edge2=n,a.Pt.X=o.X,a.Pt.Y=o.Y,this.m_IntersectList.push(a),this.SwapPositionsInSEL(e,n),i=!0}else e=n}if(e.PrevInSEL!==null)e.PrevInSEL.NextInSEL=null;else break}this.m_SortedEdges=null}};h.Clipper.prototype.EdgesAdjacent=function(r){return r.Edge1.NextInSEL==r.Edge2||r.Edge1.PrevInSEL==r.Edge2};h.Clipper.IntersectNodeSort=function(r,t){return t.Pt.Y-r.Pt.Y};h.Clipper.prototype.FixupIntersectionOrder=function(){this.m_IntersectList.sort(this.m_IntersectNodeComparer),this.CopyAELToSEL();for(var r=this.m_IntersectList.length,t=0;t<r;t++){if(!this.EdgesAdjacent(this.m_IntersectList[t])){for(var e=t+1;e<r&&!this.EdgesAdjacent(this.m_IntersectList[e]);)e++;if(e==r)return!1;var i=this.m_IntersectList[t];this.m_IntersectList[t]=this.m_IntersectList[e],this.m_IntersectList[e]=i}this.SwapPositionsInSEL(this.m_IntersectList[t].Edge1,this.m_IntersectList[t].Edge2)}return!0};h.Clipper.prototype.ProcessIntersectList=function(){for(var r=0,t=this.m_IntersectList.length;r<t;r++){var e=this.m_IntersectList[r];this.IntersectEdges(e.Edge1,e.Edge2,e.Pt,!0),this.SwapPositionsInAEL(e.Edge1,e.Edge2)}this.m_IntersectList.length=0};var MP=l(function(r){return r<0?Math.ceil(r-.5):Math.round(r)},"R1"),PP=l(function(r){return r<0?Math.ceil(r-.5):Math.floor(r+.5)},"R2"),TP=l(function(r){return r<0?-Math.round(Math.abs(r)):Math.round(r)},"R3"),wP=l(function(r){return r<0?(r-=.5,r<-2147483648?Math.ceil(r):r|0):(r+=.5,r>2147483647?Math.floor(r):r|0)},"R4");z.msie?h.Clipper.Round=MP:z.chromium?h.Clipper.Round=TP:z.safari?h.Clipper.Round=wP:h.Clipper.Round=PP;h.Clipper.TopX=function(r,t){return t==r.Top.Y?r.Top.X:r.Bot.X+h.Clipper.Round(r.Dx*(t-r.Bot.Y))};h.Clipper.prototype.IntersectPoint=function(r,t,e){e.X=0,e.Y=0;var i,n;if(h.ClipperBase.SlopesEqual(r,t,this.m_UseFullRange)||r.Dx==t.Dx)return t.Bot.Y>r.Bot.Y?(e.X=t.Bot.X,e.Y=t.Bot.Y):(e.X=r.Bot.X,e.Y=r.Bot.Y),!1;if(r.Delta.X===0)e.X=r.Bot.X,h.ClipperBase.IsHorizontal(t)?e.Y=t.Bot.Y:(n=t.Bot.Y-t.Bot.X/t.Dx,e.Y=h.Clipper.Round(e.X/t.Dx+n));else if(t.Delta.X===0)e.X=t.Bot.X,h.ClipperBase.IsHorizontal(r)?e.Y=r.Bot.Y:(i=r.Bot.Y-r.Bot.X/r.Dx,e.Y=h.Clipper.Round(e.X/r.Dx+i));else{i=r.Bot.X-r.Bot.Y*r.Dx,n=t.Bot.X-t.Bot.Y*t.Dx;var o=(n-i)/(r.Dx-t.Dx);e.Y=h.Clipper.Round(o),Math.abs(r.Dx)<Math.abs(t.Dx)?e.X=h.Clipper.Round(r.Dx*o+i):e.X=h.Clipper.Round(t.Dx*o+n)}if(e.Y<r.Top.Y||e.Y<t.Top.Y){if(r.Top.Y>t.Top.Y)return e.Y=r.Top.Y,e.X=h.Clipper.TopX(t,r.Top.Y),e.X<r.Top.X;e.Y=t.Top.Y,Math.abs(r.Dx)<Math.abs(t.Dx)?e.X=h.Clipper.TopX(r,e.Y):e.X=h.Clipper.TopX(t,e.Y)}return!0};h.Clipper.prototype.ProcessEdgesAtTopOfScanbeam=function(r){for(var t=this.m_ActiveEdges;t!==null;){var e=this.IsMaxima(t,r);if(e){var i=this.GetMaximaPair(t);e=i===null||!h.ClipperBase.IsHorizontal(i)}if(e){var n=t.PrevInAEL;this.DoMaxima(t),n===null?t=this.m_ActiveEdges:t=n.NextInAEL}else{if(this.IsIntermediate(t,r)&&h.ClipperBase.IsHorizontal(t.NextInLML)?(t=this.UpdateEdgeIntoAEL(t),t.OutIdx>=0&&this.AddOutPt(t,t.Bot),this.AddEdgeToSEL(t)):(t.Curr.X=h.Clipper.TopX(t,r),t.Curr.Y=r),this.StrictlySimple){var n=t.PrevInAEL;if(t.OutIdx>=0&&t.WindDelta!==0&&n!==null&&n.OutIdx>=0&&n.Curr.X==t.Curr.X&&n.WindDelta!==0){var o=this.AddOutPt(n,t.Curr),a=this.AddOutPt(t,t.Curr);this.AddJoin(o,a,t.Curr)}}t=t.NextInAEL}}for(this.ProcessHorizontals(!0),t=this.m_ActiveEdges;t!==null;){if(this.IsIntermediate(t,r)){var o=null;t.OutIdx>=0&&(o=this.AddOutPt(t,t.Top)),t=this.UpdateEdgeIntoAEL(t);var n=t.PrevInAEL,u=t.NextInAEL;if(n!==null&&n.Curr.X==t.Bot.X&&n.Curr.Y==t.Bot.Y&&o!==null&&n.OutIdx>=0&&n.Curr.Y>n.Top.Y&&h.ClipperBase.SlopesEqual(t,n,this.m_UseFullRange)&&t.WindDelta!==0&&n.WindDelta!==0){var a=this.AddOutPt(n,t.Bot);this.AddJoin(o,a,t.Top)}else if(u!==null&&u.Curr.X==t.Bot.X&&u.Curr.Y==t.Bot.Y&&o!==null&&u.OutIdx>=0&&u.Curr.Y>u.Top.Y&&h.ClipperBase.SlopesEqual(t,u,this.m_UseFullRange)&&t.WindDelta!==0&&u.WindDelta!==0){var a=this.AddOutPt(u,t.Bot);this.AddJoin(o,a,t.Top)}}t=t.NextInAEL}};h.Clipper.prototype.DoMaxima=function(r){var t=this.GetMaximaPair(r);if(t===null){r.OutIdx>=0&&this.AddOutPt(r,r.Top),this.DeleteFromAEL(r);return}for(var e=r.NextInAEL,i=!0;e!==null&&e!=t;)this.IntersectEdges(r,e,r.Top,!0),this.SwapPositionsInAEL(r,e),e=r.NextInAEL;r.OutIdx==-1&&t.OutIdx==-1?(this.DeleteFromAEL(r),this.DeleteFromAEL(t)):r.OutIdx>=0&&t.OutIdx>=0?this.IntersectEdges(r,t,r.Top,!1):i&&r.WindDelta===0?(r.OutIdx>=0&&(this.AddOutPt(r,r.Top),r.OutIdx=-1),this.DeleteFromAEL(r),t.OutIdx>=0&&(this.AddOutPt(t,r.Top),t.OutIdx=-1),this.DeleteFromAEL(t)):h.Error("DoMaxima error")};h.Clipper.ReversePaths=function(r){for(var t=0,e=r.length;t<e;t++)r[t].reverse()};h.Clipper.Orientation=function(r){return h.Clipper.Area(r)>=0};h.Clipper.prototype.PointCount=function(r){if(r===null)return 0;var t=0,e=r;do t++,e=e.Next;while(e!=r);return t};h.Clipper.prototype.BuildResult=function(r){h.Clear(r);for(var t=0,e=this.m_PolyOuts.length;t<e;t++){var i=this.m_PolyOuts[t];if(i.Pts!==null){var n=i.Pts.Prev,o=this.PointCount(n);if(!(o<2)){for(var a=new Array(o),u=0;u<o;u++)a[u]=n.Pt,n=n.Prev;r.push(a)}}}};h.Clipper.prototype.BuildResult2=function(r){r.Clear();for(var t=0,e=this.m_PolyOuts.length;t<e;t++){var i=this.m_PolyOuts[t],n=this.PointCount(i.Pts);if(!(i.IsOpen&&n<2||!i.IsOpen&&n<3)){this.FixHoleLinkage(i);var o=new h.PolyNode;r.m_AllPolys.push(o),i.PolyNode=o,o.m_polygon.length=n;for(var a=i.Pts.Prev,u=0;u<n;u++)o.m_polygon[u]=a.Pt,a=a.Prev}}for(var t=0,e=this.m_PolyOuts.length;t<e;t++){var i=this.m_PolyOuts[t];i.PolyNode!==null&&(i.IsOpen?(i.PolyNode.IsOpen=!0,r.AddChild(i.PolyNode)):i.FirstLeft!==null&&i.FirstLeft.PolyNode!=null?i.FirstLeft.PolyNode.AddChild(i.PolyNode):r.AddChild(i.PolyNode))}};h.Clipper.prototype.FixupOutPolygon=function(r){var t=null;r.BottomPt=null;for(var e=r.Pts;;){if(e.Prev==e||e.Prev==e.Next){this.DisposeOutPts(e),r.Pts=null;return}if(h.IntPoint.op_Equality(e.Pt,e.Next.Pt)||h.IntPoint.op_Equality(e.Pt,e.Prev.Pt)||h.ClipperBase.SlopesEqual(e.Prev.Pt,e.Pt,e.Next.Pt,this.m_UseFullRange)&&(!this.PreserveCollinear||!this.Pt2IsBetweenPt1AndPt3(e.Prev.Pt,e.Pt,e.Next.Pt))){t=null;var i=e;e.Prev.Next=e.Next,e.Next.Prev=e.Prev,e=e.Prev,i=null}else{if(e==t)break;t===null&&(t=e),e=e.Next}}r.Pts=e};h.Clipper.prototype.DupOutPt=function(r,t){var e=new h.OutPt;return e.Pt.X=r.Pt.X,e.Pt.Y=r.Pt.Y,e.Idx=r.Idx,t?(e.Next=r.Next,e.Prev=r,r.Next.Prev=e,r.Next=e):(e.Prev=r.Prev,e.Next=r,r.Prev.Next=e,r.Prev=e),e};h.Clipper.prototype.GetOverlap=function(r,t,e,i,n){return r<t?e<i?(n.Left=Math.max(r,e),n.Right=Math.min(t,i)):(n.Left=Math.max(r,i),n.Right=Math.min(t,e)):e<i?(n.Left=Math.max(t,e),n.Right=Math.min(r,i)):(n.Left=Math.max(t,i),n.Right=Math.min(r,e)),n.Left<n.Right};h.Clipper.prototype.JoinHorz=function(r,t,e,i,n,o){var a=r.Pt.X>t.Pt.X?h.Direction.dRightToLeft:h.Direction.dLeftToRight,u=e.Pt.X>i.Pt.X?h.Direction.dRightToLeft:h.Direction.dLeftToRight;if(a==u)return!1;if(a==h.Direction.dLeftToRight){for(;r.Next.Pt.X<=n.X&&r.Next.Pt.X>=r.Pt.X&&r.Next.Pt.Y==n.Y;)r=r.Next;o&&r.Pt.X!=n.X&&(r=r.Next),t=this.DupOutPt(r,!o),h.IntPoint.op_Inequality(t.Pt,n)&&(r=t,r.Pt.X=n.X,r.Pt.Y=n.Y,t=this.DupOutPt(r,!o))}else{for(;r.Next.Pt.X>=n.X&&r.Next.Pt.X<=r.Pt.X&&r.Next.Pt.Y==n.Y;)r=r.Next;!o&&r.Pt.X!=n.X&&(r=r.Next),t=this.DupOutPt(r,o),h.IntPoint.op_Inequality(t.Pt,n)&&(r=t,r.Pt.X=n.X,r.Pt.Y=n.Y,t=this.DupOutPt(r,o))}if(u==h.Direction.dLeftToRight){for(;e.Next.Pt.X<=n.X&&e.Next.Pt.X>=e.Pt.X&&e.Next.Pt.Y==n.Y;)e=e.Next;o&&e.Pt.X!=n.X&&(e=e.Next),i=this.DupOutPt(e,!o),h.IntPoint.op_Inequality(i.Pt,n)&&(e=i,e.Pt.X=n.X,e.Pt.Y=n.Y,i=this.DupOutPt(e,!o))}else{for(;e.Next.Pt.X>=n.X&&e.Next.Pt.X<=e.Pt.X&&e.Next.Pt.Y==n.Y;)e=e.Next;!o&&e.Pt.X!=n.X&&(e=e.Next),i=this.DupOutPt(e,o),h.IntPoint.op_Inequality(i.Pt,n)&&(e=i,e.Pt.X=n.X,e.Pt.Y=n.Y,i=this.DupOutPt(e,o))}return a==h.Direction.dLeftToRight==o?(r.Prev=e,e.Next=r,t.Next=i,i.Prev=t):(r.Next=e,e.Prev=r,t.Prev=i,i.Next=t),!0};h.Clipper.prototype.JoinPoints=function(r,t,e){var i=r.OutPt1,n=new h.OutPt,o=r.OutPt2,a=new h.OutPt,u=r.OutPt1.Pt.Y==r.OffPt.Y;if(u&&h.IntPoint.op_Equality(r.OffPt,r.OutPt1.Pt)&&h.IntPoint.op_Equality(r.OffPt,r.OutPt2.Pt)){for(n=r.OutPt1.Next;n!=i&&h.IntPoint.op_Equality(n.Pt,r.OffPt);)n=n.Next;var s=n.Pt.Y>r.OffPt.Y;for(a=r.OutPt2.Next;a!=o&&h.IntPoint.op_Equality(a.Pt,r.OffPt);)a=a.Next;var p=a.Pt.Y>r.OffPt.Y;return s==p?!1:s?(n=this.DupOutPt(i,!1),a=this.DupOutPt(o,!0),i.Prev=o,o.Next=i,n.Next=a,a.Prev=n,r.OutPt1=i,r.OutPt2=n,!0):(n=this.DupOutPt(i,!0),a=this.DupOutPt(o,!1),i.Next=o,o.Prev=i,n.Prev=a,a.Next=n,r.OutPt1=i,r.OutPt2=n,!0)}else if(u){for(n=i;i.Prev.Pt.Y==i.Pt.Y&&i.Prev!=n&&i.Prev!=o;)i=i.Prev;for(;n.Next.Pt.Y==n.Pt.Y&&n.Next!=i&&n.Next!=o;)n=n.Next;if(n.Next==i||n.Next==o)return!1;for(a=o;o.Prev.Pt.Y==o.Pt.Y&&o.Prev!=a&&o.Prev!=n;)o=o.Prev;for(;a.Next.Pt.Y==a.Pt.Y&&a.Next!=o&&a.Next!=i;)a=a.Next;if(a.Next==o||a.Next==i)return!1;var f={Left:null,Right:null};if(!this.GetOverlap(i.Pt.X,n.Pt.X,o.Pt.X,a.Pt.X,f))return!1;var m=f.Left,y=f.Right,x=new h.IntPoint,S;return i.Pt.X>=m&&i.Pt.X<=y?(x.X=i.Pt.X,x.Y=i.Pt.Y,S=i.Pt.X>n.Pt.X):o.Pt.X>=m&&o.Pt.X<=y?(x.X=o.Pt.X,x.Y=o.Pt.Y,S=o.Pt.X>a.Pt.X):n.Pt.X>=m&&n.Pt.X<=y?(x.X=n.Pt.X,x.Y=n.Pt.Y,S=n.Pt.X>i.Pt.X):(x.X=a.Pt.X,x.Y=a.Pt.Y,S=a.Pt.X>o.Pt.X),r.OutPt1=i,r.OutPt2=o,this.JoinHorz(i,n,o,a,x,S)}else{for(n=i.Next;h.IntPoint.op_Equality(n.Pt,i.Pt)&&n!=i;)n=n.Next;var M=n.Pt.Y>i.Pt.Y||!h.ClipperBase.SlopesEqual(i.Pt,n.Pt,r.OffPt,this.m_UseFullRange);if(M){for(n=i.Prev;h.IntPoint.op_Equality(n.Pt,i.Pt)&&n!=i;)n=n.Prev;if(n.Pt.Y>i.Pt.Y||!h.ClipperBase.SlopesEqual(i.Pt,n.Pt,r.OffPt,this.m_UseFullRange))return!1}for(a=o.Next;h.IntPoint.op_Equality(a.Pt,o.Pt)&&a!=o;)a=a.Next;var g=a.Pt.Y>o.Pt.Y||!h.ClipperBase.SlopesEqual(o.Pt,a.Pt,r.OffPt,this.m_UseFullRange);if(g){for(a=o.Prev;h.IntPoint.op_Equality(a.Pt,o.Pt)&&a!=o;)a=a.Prev;if(a.Pt.Y>o.Pt.Y||!h.ClipperBase.SlopesEqual(o.Pt,a.Pt,r.OffPt,this.m_UseFullRange))return!1}return n==i||a==o||n==a||t==e&&M==g?!1:M?(n=this.DupOutPt(i,!1),a=this.DupOutPt(o,!0),i.Prev=o,o.Next=i,n.Next=a,a.Prev=n,r.OutPt1=i,r.OutPt2=n,!0):(n=this.DupOutPt(i,!0),a=this.DupOutPt(o,!1),i.Next=o,o.Prev=i,n.Prev=a,a.Next=n,r.OutPt1=i,r.OutPt2=n,!0)}};h.Clipper.GetBounds=function(r){for(var t=0,e=r.length;t<e&&r[t].length==0;)t++;if(t==e)return new h.IntRect(0,0,0,0);var i=new h.IntRect;for(i.left=r[t][0].X,i.right=i.left,i.top=r[t][0].Y,i.bottom=i.top;t<e;t++)for(var n=0,o=r[t].length;n<o;n++)r[t][n].X<i.left?i.left=r[t][n].X:r[t][n].X>i.right&&(i.right=r[t][n].X),r[t][n].Y<i.top?i.top=r[t][n].Y:r[t][n].Y>i.bottom&&(i.bottom=r[t][n].Y);return i};h.Clipper.prototype.GetBounds2=function(r){var t=r,e=new h.IntRect;for(e.left=r.Pt.X,e.right=r.Pt.X,e.top=r.Pt.Y,e.bottom=r.Pt.Y,r=r.Next;r!=t;)r.Pt.X<e.left&&(e.left=r.Pt.X),r.Pt.X>e.right&&(e.right=r.Pt.X),r.Pt.Y<e.top&&(e.top=r.Pt.Y),r.Pt.Y>e.bottom&&(e.bottom=r.Pt.Y),r=r.Next;return e};h.Clipper.PointInPolygon=function(r,t){var e=0,i=t.length;if(i<3)return 0;for(var n=t[0],o=1;o<=i;++o){var a=o==i?t[0]:t[o];if(a.Y==r.Y&&(a.X==r.X||n.Y==r.Y&&a.X>r.X==n.X<r.X))return-1;if(n.Y<r.Y!=a.Y<r.Y){if(n.X>=r.X)if(a.X>r.X)e=1-e;else{var u=(n.X-r.X)*(a.Y-r.Y)-(a.X-r.X)*(n.Y-r.Y);if(u==0)return-1;u>0==a.Y>n.Y&&(e=1-e)}else if(a.X>r.X){var u=(n.X-r.X)*(a.Y-r.Y)-(a.X-r.X)*(n.Y-r.Y);if(u==0)return-1;u>0==a.Y>n.Y&&(e=1-e)}}n=a}return e};h.Clipper.prototype.PointInPolygon=function(r,t){for(var e=0,i=t;;){var n=t.Pt.X,o=t.Pt.Y,a=t.Next.Pt.X,u=t.Next.Pt.Y;if(u==r.Y&&(a==r.X||o==r.Y&&a>r.X==n<r.X))return-1;if(o<r.Y!=u<r.Y){if(n>=r.X)if(a>r.X)e=1-e;else{var s=(n-r.X)*(u-r.Y)-(a-r.X)*(o-r.Y);if(s==0)return-1;s>0==u>o&&(e=1-e)}else if(a>r.X){var s=(n-r.X)*(u-r.Y)-(a-r.X)*(o-r.Y);if(s==0)return-1;s>0==u>o&&(e=1-e)}}if(t=t.Next,i==t)break}return e};h.Clipper.prototype.Poly2ContainsPoly1=function(r,t){var e=r;do{var i=this.PointInPolygon(e.Pt,t);if(i>=0)return i!=0;e=e.Next}while(e!=r);return!0};h.Clipper.prototype.FixupFirstLefts1=function(r,t){for(var e=0,i=this.m_PolyOuts.length;e<i;e++){var n=this.m_PolyOuts[e];n.Pts!==null&&n.FirstLeft==r&&this.Poly2ContainsPoly1(n.Pts,t.Pts)&&(n.FirstLeft=t)}};h.Clipper.prototype.FixupFirstLefts2=function(r,t){for(var e=0,i=this.m_PolyOuts,n=i.length,o=i[e];e<n;e++,o=i[e])o.FirstLeft==r&&(o.FirstLeft=t)};h.Clipper.ParseFirstLeft=function(r){for(;r!=null&&r.Pts==null;)r=r.FirstLeft;return r};h.Clipper.prototype.JoinCommonEdges=function(){for(var r=0,t=this.m_Joins.length;r<t;r++){var e=this.m_Joins[r],i=this.GetOutRec(e.OutPt1.Idx),n=this.GetOutRec(e.OutPt2.Idx);if(!(i.Pts==null||n.Pts==null)){var o;if(i==n?o=i:this.Param1RightOfParam2(i,n)?o=n:this.Param1RightOfParam2(n,i)?o=i:o=this.GetLowermostRec(i,n),!!this.JoinPoints(e,i,n))if(i==n){if(i.Pts=e.OutPt1,i.BottomPt=null,n=this.CreateOutRec(),n.Pts=e.OutPt2,this.UpdateOutPtIdxs(n),this.m_UsingPolyTree)for(var a=0,u=this.m_PolyOuts.length;a<u-1;a++){var s=this.m_PolyOuts[a];s.Pts==null||h.Clipper.ParseFirstLeft(s.FirstLeft)!=i||s.IsHole==i.IsHole||this.Poly2ContainsPoly1(s.Pts,e.OutPt2)&&(s.FirstLeft=n)}this.Poly2ContainsPoly1(n.Pts,i.Pts)?(n.IsHole=!i.IsHole,n.FirstLeft=i,this.m_UsingPolyTree&&this.FixupFirstLefts2(n,i),(n.IsHole^this.ReverseSolution)==this.Area(n)>0&&this.ReversePolyPtLinks(n.Pts)):this.Poly2ContainsPoly1(i.Pts,n.Pts)?(n.IsHole=i.IsHole,i.IsHole=!n.IsHole,n.FirstLeft=i.FirstLeft,i.FirstLeft=n,this.m_UsingPolyTree&&this.FixupFirstLefts2(i,n),(i.IsHole^this.ReverseSolution)==this.Area(i)>0&&this.ReversePolyPtLinks(i.Pts)):(n.IsHole=i.IsHole,n.FirstLeft=i.FirstLeft,this.m_UsingPolyTree&&this.FixupFirstLefts1(i,n))}else n.Pts=null,n.BottomPt=null,n.Idx=i.Idx,i.IsHole=o.IsHole,o==n&&(i.FirstLeft=n.FirstLeft),n.FirstLeft=i,this.m_UsingPolyTree&&this.FixupFirstLefts2(n,i)}}};h.Clipper.prototype.UpdateOutPtIdxs=function(r){var t=r.Pts;do t.Idx=r.Idx,t=t.Prev;while(t!=r.Pts)};h.Clipper.prototype.DoSimplePolygons=function(){for(var r=0;r<this.m_PolyOuts.length;){var t=this.m_PolyOuts[r++],e=t.Pts;if(e!==null)do{for(var i=e.Next;i!=t.Pts;){if(h.IntPoint.op_Equality(e.Pt,i.Pt)&&i.Next!=e&&i.Prev!=e){var n=e.Prev,o=i.Prev;e.Prev=o,o.Next=e,i.Prev=n,n.Next=i,t.Pts=e;var a=this.CreateOutRec();a.Pts=i,this.UpdateOutPtIdxs(a),this.Poly2ContainsPoly1(a.Pts,t.Pts)?(a.IsHole=!t.IsHole,a.FirstLeft=t):this.Poly2ContainsPoly1(t.Pts,a.Pts)?(a.IsHole=t.IsHole,t.IsHole=!a.IsHole,a.FirstLeft=t.FirstLeft,t.FirstLeft=a):(a.IsHole=t.IsHole,a.FirstLeft=t.FirstLeft),i=e}i=i.Next}e=e.Next}while(e!=t.Pts)}};h.Clipper.Area=function(r){var t=r.length;if(t<3)return 0;for(var e=0,i=0,n=t-1;i<t;++i)e+=(r[n].X+r[i].X)*(r[n].Y-r[i].Y),n=i;return-e*.5};h.Clipper.prototype.Area=function(r){var t=r.Pts;if(t==null)return 0;var e=0;do e=e+(t.Prev.Pt.X+t.Pt.X)*(t.Prev.Pt.Y-t.Pt.Y),t=t.Next;while(t!=r.Pts);return e*.5};Vb&&(h.Clipper.OffsetPaths=function(r,t,e,i,n){var o=new h.Paths,a=new h.ClipperOffset(n,n);return a.AddPaths(r,e,i),a.Execute(o,t),o});h.Clipper.SimplifyPolygon=function(r,t){var e=new Array,i=new h.Clipper(0);return i.StrictlySimple=!0,i.AddPath(r,h.PolyType.ptSubject,!0),i.Execute(h.ClipType.ctUnion,e,t,t),e};h.Clipper.SimplifyPolygons=function(r,t){typeof t>"u"&&(t=h.PolyFillType.pftEvenOdd);var e=new Array,i=new h.Clipper(0);return i.StrictlySimple=!0,i.AddPaths(r,h.PolyType.ptSubject,!0),i.Execute(h.ClipType.ctUnion,e,t,t),e};h.Clipper.DistanceSqrd=function(r,t){var e=r.X-t.X,i=r.Y-t.Y;return e*e+i*i};h.Clipper.DistanceFromLineSqrd=function(r,t,e){var i=t.Y-e.Y,n=e.X-t.X,o=i*t.X+n*t.Y;return o=i*r.X+n*r.Y-o,o*o/(i*i+n*n)};h.Clipper.SlopesNearCollinear=function(r,t,e,i){return h.Clipper.DistanceFromLineSqrd(t,r,e)<i};h.Clipper.PointsAreClose=function(r,t,e){var i=r.X-t.X,n=r.Y-t.Y;return i*i+n*n<=e};h.Clipper.ExcludeOp=function(r){var t=r.Prev;return t.Next=r.Next,r.Next.Prev=t,t.Idx=0,t};h.Clipper.CleanPolygon=function(r,t){typeof t>"u"&&(t=1.415);var e=r.length;if(e==0)return new Array;for(var i=new Array(e),n=0;n<e;++n)i[n]=new h.OutPt;for(var n=0;n<e;++n)i[n].Pt=r[n],i[n].Next=i[(n+1)%e],i[n].Next.Prev=i[n],i[n].Idx=0;for(var o=t*t,a=i[0];a.Idx==0&&a.Next!=a.Prev;)h.Clipper.PointsAreClose(a.Pt,a.Prev.Pt,o)?(a=h.Clipper.ExcludeOp(a),e--):h.Clipper.PointsAreClose(a.Prev.Pt,a.Next.Pt,o)?(h.Clipper.ExcludeOp(a.Next),a=h.Clipper.ExcludeOp(a),e-=2):h.Clipper.SlopesNearCollinear(a.Prev.Pt,a.Pt,a.Next.Pt,o)?(a=h.Clipper.ExcludeOp(a),e--):(a.Idx=1,a=a.Next);e<3&&(e=0);for(var u=new Array(e),n=0;n<e;++n)u[n]=new h.IntPoint(a.Pt),a=a.Next;return i=null,u};h.Clipper.CleanPolygons=function(r,t){for(var e=new Array(r.length),i=0,n=r.length;i<n;i++)e[i]=h.Clipper.CleanPolygon(r[i],t);return e};h.Clipper.Minkowski=function(r,t,e,i){var n=i?1:0,o=r.length,a=t.length,u=new Array;if(e)for(var s=0;s<a;s++){for(var p=new Array(o),f=0,m=r.length,y=r[f];f<m;f++,y=r[f])p[f]=new h.IntPoint(t[s].X+y.X,t[s].Y+y.Y);u.push(p)}else for(var s=0;s<a;s++){for(var p=new Array(o),f=0,m=r.length,y=r[f];f<m;f++,y=r[f])p[f]=new h.IntPoint(t[s].X-y.X,t[s].Y-y.Y);u.push(p)}for(var x=new Array,s=0;s<a-1+n;s++)for(var f=0;f<o;f++){var S=new Array;S.push(u[s%a][f%o]),S.push(u[(s+1)%a][f%o]),S.push(u[(s+1)%a][(f+1)%o]),S.push(u[s%a][(f+1)%o]),h.Clipper.Orientation(S)||S.reverse(),x.push(S)}var M=new h.Clipper(0);return M.AddPaths(x,h.PolyType.ptSubject,!0),M.Execute(h.ClipType.ctUnion,u,h.PolyFillType.pftNonZero,h.PolyFillType.pftNonZero),u};h.Clipper.MinkowskiSum=function(){var r=arguments,t=r.length;if(t==3){var e=r[0],i=r[1],n=r[2];return h.Clipper.Minkowski(e,i,!0,n)}else if(t==4){for(var e=r[0],o=r[1],a=r[2],n=r[3],u=new h.Clipper,s,p=0,f=o.length;p<f;++p){var s=h.Clipper.Minkowski(e,o[p],!0,n);u.AddPaths(s,h.PolyType.ptSubject,!0)}n&&u.AddPaths(o,h.PolyType.ptClip,!0);var m=new h.Paths;return u.Execute(h.ClipType.ctUnion,m,a,a),m}};h.Clipper.MinkowskiDiff=function(r,t,e){return h.Clipper.Minkowski(r,t,!1,e)};h.Clipper.PolyTreeToPaths=function(r){var t=new Array;return h.Clipper.AddPolyNodeToPaths(r,h.Clipper.NodeType.ntAny,t),t};h.Clipper.AddPolyNodeToPaths=function(r,t,e){var i=!0;switch(t){case h.Clipper.NodeType.ntOpen:return;case h.Clipper.NodeType.ntClosed:i=!r.IsOpen;break;default:break}r.m_polygon.length>0&&i&&e.push(r.m_polygon);for(var n=0,o=r.Childs(),a=o.length,u=o[n];n<a;n++,u=o[n])h.Clipper.AddPolyNodeToPaths(u,t,e)};h.Clipper.OpenPathsFromPolyTree=function(r){for(var t=new h.Paths,e=0,i=r.ChildCount();e<i;e++)r.Childs()[e].IsOpen&&t.push(r.Childs()[e].m_polygon);return t};h.Clipper.ClosedPathsFromPolyTree=function(r){var t=new h.Paths;return h.Clipper.AddPolyNodeToPaths(r,h.Clipper.NodeType.ntClosed,t),t};Uu(h.Clipper,h.ClipperBase);h.Clipper.NodeType={ntAny:0,ntOpen:1,ntClosed:2};h.ClipperOffset=function(r,t){typeof r>"u"&&(r=2),typeof t>"u"&&(t=h.ClipperOffset.def_arc_tolerance),this.m_destPolys=new h.Paths,this.m_srcPoly=new h.Path,this.m_destPoly=new h.Path,this.m_normals=new Array,this.m_delta=0,this.m_sinA=0,this.m_sin=0,this.m_cos=0,this.m_miterLim=0,this.m_StepsPerRad=0,this.m_lowest=new h.IntPoint,this.m_polyNodes=new h.PolyNode,this.MiterLimit=r,this.ArcTolerance=t,this.m_lowest.X=-1};h.ClipperOffset.two_pi=6.28318530717959;h.ClipperOffset.def_arc_tolerance=.25;h.ClipperOffset.prototype.Clear=function(){h.Clear(this.m_polyNodes.Childs()),this.m_lowest.X=-1};h.ClipperOffset.Round=h.Clipper.Round;h.ClipperOffset.prototype.AddPath=function(r,t,e){var i=r.length-1;if(!(i<0)){var n=new h.PolyNode;if(n.m_jointype=t,n.m_endtype=e,e==h.EndType.etClosedLine||e==h.EndType.etClosedPolygon)for(;i>0&&h.IntPoint.op_Equality(r[0],r[i]);)i--;n.m_polygon.push(r[0]);for(var o=0,a=0,u=1;u<=i;u++)h.IntPoint.op_Inequality(n.m_polygon[o],r[u])&&(o++,n.m_polygon.push(r[u]),(r[u].Y>n.m_polygon[a].Y||r[u].Y==n.m_polygon[a].Y&&r[u].X<n.m_polygon[a].X)&&(a=o));if(!(e==h.EndType.etClosedPolygon&&o<2||e!=h.EndType.etClosedPolygon&&o<0)&&(this.m_polyNodes.AddChild(n),e==h.EndType.etClosedPolygon))if(this.m_lowest.X<0)this.m_lowest=new h.IntPoint(0,a);else{var s=this.m_polyNodes.Childs()[this.m_lowest.X].m_polygon[this.m_lowest.Y];(n.m_polygon[a].Y>s.Y||n.m_polygon[a].Y==s.Y&&n.m_polygon[a].X<s.X)&&(this.m_lowest=new h.IntPoint(this.m_polyNodes.ChildCount()-1,a))}}};h.ClipperOffset.prototype.AddPaths=function(r,t,e){for(var i=0,n=r.length;i<n;i++)this.AddPath(r[i],t,e)};h.ClipperOffset.prototype.FixOrientations=function(){if(this.m_lowest.X>=0&&!h.Clipper.Orientation(this.m_polyNodes.Childs()[this.m_lowest.X].m_polygon))for(var r=0;r<this.m_polyNodes.ChildCount();r++){var t=this.m_polyNodes.Childs()[r];(t.m_endtype==h.EndType.etClosedPolygon||t.m_endtype==h.EndType.etClosedLine&&h.Clipper.Orientation(t.m_polygon))&&t.m_polygon.reverse()}else for(var r=0;r<this.m_polyNodes.ChildCount();r++){var t=this.m_polyNodes.Childs()[r];t.m_endtype==h.EndType.etClosedLine&&!h.Clipper.Orientation(t.m_polygon)&&t.m_polygon.reverse()}};h.ClipperOffset.GetUnitNormal=function(r,t){var e=t.X-r.X,i=t.Y-r.Y;if(e==0&&i==0)return new h.DoublePoint(0,0);var n=1/Math.sqrt(e*e+i*i);return e*=n,i*=n,new h.DoublePoint(i,-e)};h.ClipperOffset.prototype.DoOffset=function(r){if(this.m_destPolys=new Array,this.m_delta=r,h.ClipperBase.near_zero(r)){for(var t=0;t<this.m_polyNodes.ChildCount();t++){var e=this.m_polyNodes.Childs()[t];e.m_endtype==h.EndType.etClosedPolygon&&this.m_destPolys.push(e.m_polygon)}return}this.MiterLimit>2?this.m_miterLim=2/(this.MiterLimit*this.MiterLimit):this.m_miterLim=.5;var i;this.ArcTolerance<=0?i=h.ClipperOffset.def_arc_tolerance:this.ArcTolerance>Math.abs(r)*h.ClipperOffset.def_arc_tolerance?i=Math.abs(r)*h.ClipperOffset.def_arc_tolerance:i=this.ArcTolerance;var n=3.14159265358979/Math.acos(1-i/Math.abs(r));this.m_sin=Math.sin(h.ClipperOffset.two_pi/n),this.m_cos=Math.cos(h.ClipperOffset.two_pi/n),this.m_StepsPerRad=n/h.ClipperOffset.two_pi,r<0&&(this.m_sin=-this.m_sin);for(var t=0;t<this.m_polyNodes.ChildCount();t++){var e=this.m_polyNodes.Childs()[t];this.m_srcPoly=e.m_polygon;var o=this.m_srcPoly.length;if(!(o==0||r<=0&&(o<3||e.m_endtype!=h.EndType.etClosedPolygon))){if(this.m_destPoly=new Array,o==1){if(e.m_jointype==h.JoinType.jtRound)for(var a=1,u=0,s=1;s<=n;s++){this.m_destPoly.push(new h.IntPoint(h.ClipperOffset.Round(this.m_srcPoly[0].X+a*r),h.ClipperOffset.Round(this.m_srcPoly[0].Y+u*r)));var p=a;a=a*this.m_cos-this.m_sin*u,u=p*this.m_sin+u*this.m_cos}else for(var a=-1,u=-1,s=0;s<4;++s)this.m_destPoly.push(new h.IntPoint(h.ClipperOffset.Round(this.m_srcPoly[0].X+a*r),h.ClipperOffset.Round(this.m_srcPoly[0].Y+u*r))),a<0?a=1:u<0?u=1:a=-1;this.m_destPolys.push(this.m_destPoly);continue}this.m_normals.length=0;for(var s=0;s<o-1;s++)this.m_normals.push(h.ClipperOffset.GetUnitNormal(this.m_srcPoly[s],this.m_srcPoly[s+1]));if(e.m_endtype==h.EndType.etClosedLine||e.m_endtype==h.EndType.etClosedPolygon?this.m_normals.push(h.ClipperOffset.GetUnitNormal(this.m_srcPoly[o-1],this.m_srcPoly[0])):this.m_normals.push(new h.DoublePoint(this.m_normals[o-2])),e.m_endtype==h.EndType.etClosedPolygon){for(var f=o-1,s=0;s<o;s++)f=this.OffsetPoint(s,f,e.m_jointype);this.m_destPolys.push(this.m_destPoly)}else if(e.m_endtype==h.EndType.etClosedLine){for(var f=o-1,s=0;s<o;s++)f=this.OffsetPoint(s,f,e.m_jointype);this.m_destPolys.push(this.m_destPoly),this.m_destPoly=new Array;for(var m=this.m_normals[o-1],s=o-1;s>0;s--)this.m_normals[s]=new h.DoublePoint(-this.m_normals[s-1].X,-this.m_normals[s-1].Y);this.m_normals[0]=new h.DoublePoint(-m.X,-m.Y),f=0;for(var s=o-1;s>=0;s--)f=this.OffsetPoint(s,f,e.m_jointype);this.m_destPolys.push(this.m_destPoly)}else{for(var f=0,s=1;s<o-1;++s)f=this.OffsetPoint(s,f,e.m_jointype);var y;if(e.m_endtype==h.EndType.etOpenButt){var s=o-1;y=new h.IntPoint(h.ClipperOffset.Round(this.m_srcPoly[s].X+this.m_normals[s].X*r),h.ClipperOffset.Round(this.m_srcPoly[s].Y+this.m_normals[s].Y*r)),this.m_destPoly.push(y),y=new h.IntPoint(h.ClipperOffset.Round(this.m_srcPoly[s].X-this.m_normals[s].X*r),h.ClipperOffset.Round(this.m_srcPoly[s].Y-this.m_normals[s].Y*r)),this.m_destPoly.push(y)}else{var s=o-1;f=o-2,this.m_sinA=0,this.m_normals[s]=new h.DoublePoint(-this.m_normals[s].X,-this.m_normals[s].Y),e.m_endtype==h.EndType.etOpenSquare?this.DoSquare(s,f):this.DoRound(s,f)}for(var s=o-1;s>0;s--)this.m_normals[s]=new h.DoublePoint(-this.m_normals[s-1].X,-this.m_normals[s-1].Y);this.m_normals[0]=new h.DoublePoint(-this.m_normals[1].X,-this.m_normals[1].Y),f=o-1;for(var s=f-1;s>0;--s)f=this.OffsetPoint(s,f,e.m_jointype);e.m_endtype==h.EndType.etOpenButt?(y=new h.IntPoint(h.ClipperOffset.Round(this.m_srcPoly[0].X-this.m_normals[0].X*r),h.ClipperOffset.Round(this.m_srcPoly[0].Y-this.m_normals[0].Y*r)),this.m_destPoly.push(y),y=new h.IntPoint(h.ClipperOffset.Round(this.m_srcPoly[0].X+this.m_normals[0].X*r),h.ClipperOffset.Round(this.m_srcPoly[0].Y+this.m_normals[0].Y*r)),this.m_destPoly.push(y)):(f=1,this.m_sinA=0,e.m_endtype==h.EndType.etOpenSquare?this.DoSquare(0,1):this.DoRound(0,1)),this.m_destPolys.push(this.m_destPoly)}}}};h.ClipperOffset.prototype.Execute=function(){var r=arguments,t=r[0]instanceof h.PolyTree;if(t){var e=r[0],i=r[1];e.Clear(),this.FixOrientations(),this.DoOffset(i);var n=new h.Clipper(0);if(n.AddPaths(this.m_destPolys,h.PolyType.ptSubject,!0),i>0)n.Execute(h.ClipType.ctUnion,e,h.PolyFillType.pftPositive,h.PolyFillType.pftPositive);else{var o=h.Clipper.GetBounds(this.m_destPolys),a=new h.Path;if(a.push(new h.IntPoint(o.left-10,o.bottom+10)),a.push(new h.IntPoint(o.right+10,o.bottom+10)),a.push(new h.IntPoint(o.right+10,o.top-10)),a.push(new h.IntPoint(o.left-10,o.top-10)),n.AddPath(a,h.PolyType.ptSubject,!0),n.ReverseSolution=!0,n.Execute(h.ClipType.ctUnion,e,h.PolyFillType.pftNegative,h.PolyFillType.pftNegative),e.ChildCount()==1&&e.Childs()[0].ChildCount()>0){var u=e.Childs()[0];e.Childs()[0]=u.Childs()[0];for(var s=1;s<u.ChildCount();s++)e.AddChild(u.Childs()[s])}else e.Clear()}}else{var e=r[0],i=r[1];h.Clear(e),this.FixOrientations(),this.DoOffset(i);var n=new h.Clipper(0);if(n.AddPaths(this.m_destPolys,h.PolyType.ptSubject,!0),i>0)n.Execute(h.ClipType.ctUnion,e,h.PolyFillType.pftPositive,h.PolyFillType.pftPositive);else{var o=h.Clipper.GetBounds(this.m_destPolys),a=new h.Path;a.push(new h.IntPoint(o.left-10,o.bottom+10)),a.push(new h.IntPoint(o.right+10,o.bottom+10)),a.push(new h.IntPoint(o.right+10,o.top-10)),a.push(new h.IntPoint(o.left-10,o.top-10)),n.AddPath(a,h.PolyType.ptSubject,!0),n.ReverseSolution=!0,n.Execute(h.ClipType.ctUnion,e,h.PolyFillType.pftNegative,h.PolyFillType.pftNegative),e.length>0&&e.splice(0,1)}}};h.ClipperOffset.prototype.OffsetPoint=function(r,t,e){if(this.m_sinA=this.m_normals[t].X*this.m_normals[r].Y-this.m_normals[r].X*this.m_normals[t].Y,this.m_sinA<5e-5&&this.m_sinA>-5e-5)return t;if(this.m_sinA>1?this.m_sinA=1:this.m_sinA<-1&&(this.m_sinA=-1),this.m_sinA*this.m_delta<0)this.m_destPoly.push(new h.IntPoint(h.ClipperOffset.Round(this.m_srcPoly[r].X+this.m_normals[t].X*this.m_delta),h.ClipperOffset.Round(this.m_srcPoly[r].Y+this.m_normals[t].Y*this.m_delta))),this.m_destPoly.push(new h.IntPoint(this.m_srcPoly[r])),this.m_destPoly.push(new h.IntPoint(h.ClipperOffset.Round(this.m_srcPoly[r].X+this.m_normals[r].X*this.m_delta),h.ClipperOffset.Round(this.m_srcPoly[r].Y+this.m_normals[r].Y*this.m_delta)));else switch(e){case h.JoinType.jtMiter:{var i=1+(this.m_normals[r].X*this.m_normals[t].X+this.m_normals[r].Y*this.m_normals[t].Y);i>=this.m_miterLim?this.DoMiter(r,t,i):this.DoSquare(r,t);break}case h.JoinType.jtSquare:this.DoSquare(r,t);break;case h.JoinType.jtRound:this.DoRound(r,t);break}return t=r,t};h.ClipperOffset.prototype.DoSquare=function(r,t){var e=Math.tan(Math.atan2(this.m_sinA,this.m_normals[t].X*this.m_normals[r].X+this.m_normals[t].Y*this.m_normals[r].Y)/4);this.m_destPoly.push(new h.IntPoint(h.ClipperOffset.Round(this.m_srcPoly[r].X+this.m_delta*(this.m_normals[t].X-this.m_normals[t].Y*e)),h.ClipperOffset.Round(this.m_srcPoly[r].Y+this.m_delta*(this.m_normals[t].Y+this.m_normals[t].X*e)))),this.m_destPoly.push(new h.IntPoint(h.ClipperOffset.Round(this.m_srcPoly[r].X+this.m_delta*(this.m_normals[r].X+this.m_normals[r].Y*e)),h.ClipperOffset.Round(this.m_srcPoly[r].Y+this.m_delta*(this.m_normals[r].Y-this.m_normals[r].X*e))))};h.ClipperOffset.prototype.DoMiter=function(r,t,e){var i=this.m_delta/e;this.m_destPoly.push(new h.IntPoint(h.ClipperOffset.Round(this.m_srcPoly[r].X+(this.m_normals[t].X+this.m_normals[r].X)*i),h.ClipperOffset.Round(this.m_srcPoly[r].Y+(this.m_normals[t].Y+this.m_normals[r].Y)*i)))};h.ClipperOffset.prototype.DoRound=function(r,t){for(var e=Math.atan2(this.m_sinA,this.m_normals[t].X*this.m_normals[r].X+this.m_normals[t].Y*this.m_normals[r].Y),i=h.Cast_Int32(h.ClipperOffset.Round(this.m_StepsPerRad*Math.abs(e))),n=this.m_normals[t].X,o=this.m_normals[t].Y,a,u=0;u<i;++u)this.m_destPoly.push(new h.IntPoint(h.ClipperOffset.Round(this.m_srcPoly[r].X+n*this.m_delta),h.ClipperOffset.Round(this.m_srcPoly[r].Y+o*this.m_delta))),a=n,n=n*this.m_cos-this.m_sin*o,o=a*this.m_sin+o*this.m_cos;this.m_destPoly.push(new h.IntPoint(h.ClipperOffset.Round(this.m_srcPoly[r].X+this.m_normals[r].X*this.m_delta),h.ClipperOffset.Round(this.m_srcPoly[r].Y+this.m_normals[r].Y*this.m_delta)))};h.Error=function(r){try{throw new Error(r)}catch(t){alert(t.message)}};h.JS={};h.JS.AreaOfPolygon=function(r,t){return t||(t=1),h.Clipper.Area(r)/(t*t)};h.JS.AreaOfPolygons=function(r,t){t||(t=1);for(var e=0,i=0;i<r.length;i++)e+=h.Clipper.Area(r[i]);return e/(t*t)};h.JS.BoundsOfPath=function(r,t){return h.JS.BoundsOfPaths([r],t)};h.JS.BoundsOfPaths=function(r,t){t||(t=1);var e=h.Clipper.GetBounds(r);return e.left/=t,e.bottom/=t,e.right/=t,e.top/=t,e};h.JS.Clean=function(i,t){if(!(i instanceof Array))return[];var e=i[0]instanceof Array,i=h.JS.Clone(i);if(typeof t!="number"||t===null)return h.Error("Delta is not a number in Clean()."),i;if(i.length===0||i.length==1&&i[0].length===0||t<0)return i;e||(i=[i]);for(var n=i.length,o,a,u,s,p,f,m,y=[],x=0;x<n;x++)if(a=i[x],o=a.length,o!==0){if(o<3){u=a,y.push(u);continue}for(u=a,s=t*t,p=a[0],f=1,m=1;m<o;m++)(a[m].X-p.X)*(a[m].X-p.X)+(a[m].Y-p.Y)*(a[m].Y-p.Y)<=s||(u[f]=a[m],p=a[m],f++);p=a[f-1],(a[0].X-p.X)*(a[0].X-p.X)+(a[0].Y-p.Y)*(a[0].Y-p.Y)<=s&&f--,f<o&&u.splice(f,o-f),u.length&&y.push(u)}return!e&&y.length?y=y[0]:!e&&y.length===0?y=[]:e&&y.length===0&&(y=[[]]),y};h.JS.Clone=function(r){if(!(r instanceof Array))return[];if(r.length===0)return[];if(r.length==1&&r[0].length===0)return[[]];var t=r[0]instanceof Array;t||(r=[r]);var e=r.length,i,n,o,a,u=new Array(e);for(n=0;n<e;n++){for(i=r[n].length,a=new Array(i),o=0;o<i;o++)a[o]={X:r[n][o].X,Y:r[n][o].Y};u[n]=a}return t||(u=u[0]),u};h.JS.Lighten=function(r,t){if(!(r instanceof Array))return[];if(typeof t!="number"||t===null)return h.Error("Tolerance is not a number in Lighten()."),h.JS.Clone(r);if(r.length===0||r.length==1&&r[0].length===0||t<0)return h.JS.Clone(r);r[0]instanceof Array||(r=[r]);var e,i,n,o,a,u,s,p,f,m,y,x,S,M,g,C,I,w=r.length,T=t*t,L=[];for(e=0;e<w;e++)if(n=r[e],u=n.length,u!=0){for(o=0;o<1e6;o++){for(a=[],u=n.length,n[u-1].X!=n[0].X||n[u-1].Y!=n[0].Y?(x=1,n.push({X:n[0].X,Y:n[0].Y}),u=n.length):x=0,y=[],i=0;i<u-2;i++)s=n[i],f=n[i+1],p=n[i+2],C=s.X,I=s.Y,S=p.X-C,M=p.Y-I,(S!==0||M!==0)&&(g=((f.X-C)*S+(f.Y-I)*M)/(S*S+M*M),g>1?(C=p.X,I=p.Y):g>0&&(C+=S*g,I+=M*g)),S=f.X-C,M=f.Y-I,m=S*S+M*M,m<=T&&(y[i+1]=1,i++);for(a.push({X:n[0].X,Y:n[0].Y}),i=1;i<u-1;i++)y[i]||a.push({X:n[i].X,Y:n[i].Y});if(a.push({X:n[u-1].X,Y:n[u-1].Y}),x&&n.pop(),y.length)n=a;else break}u=a.length,a[u-1].X==a[0].X&&a[u-1].Y==a[0].Y&&a.pop(),a.length>2&&L.push(a)}return!r[0]instanceof Array&&(L=L[0]),typeof L>"u"&&(L=[[]]),L};h.JS.PerimeterOfPath=function(r,t,e){if(typeof r>"u")return 0;var i=Math.sqrt,n=0,o,a,u=0,s=0,p=0,f=0,m=r.length;if(m<2)return 0;for(t&&(r[m]=r[0],m++);--m;)o=r[m],u=o.X,s=o.Y,a=r[m-1],p=a.X,f=a.Y,n+=i((u-p)*(u-p)+(s-f)*(s-f));return t&&r.pop(),n/e};h.JS.PerimeterOfPaths=function(r,t,e){e||(e=1);for(var i=0,n=0;n<r.length;n++)i+=h.JS.PerimeterOfPath(r[n],t,e);return i};h.JS.ScaleDownPath=function(r,t){var e,i;for(t||(t=1),e=r.length;e--;)i=r[e],i.X=i.X/t,i.Y=i.Y/t};h.JS.ScaleDownPaths=function(r,t){var e,i,n,o=Math.round;for(t||(t=1),e=r.length;e--;)for(i=r[e].length;i--;)n=r[e][i],n.X=n.X/t,n.Y=n.Y/t};h.JS.ScaleUpPath=function(r,t){var e,i,n=Math.round;for(t||(t=1),e=r.length;e--;)i=r[e],i.X=n(i.X*t),i.Y=n(i.Y*t)};h.JS.ScaleUpPaths=function(r,t){var e,i,n,o=Math.round;for(t||(t=1),e=r.length;e--;)for(i=r[e].length;i--;)n=r[e][i],n.X=o(n.X*t),n.Y=o(n.Y*t)};h.ExPolygons=function(){return[]};h.ExPolygon=function(){this.outer=null,this.holes=null};h.JS.AddOuterPolyNodeToExPolygons=function(r,t){var e=new h.ExPolygon;e.outer=r.Contour();var i=r.Childs(),n=i.length;e.holes=new Array(n);var o,a,u,s,p,f;for(u=0;u<n;u++)for(o=i[u],e.holes[u]=o.Contour(),s=0,p=o.Childs(),f=p.length;s<f;s++)a=p[s],h.JS.AddOuterPolyNodeToExPolygons(a,t);t.push(e)};h.JS.ExPolygonsToPaths=function(r){var t,e,i,n,o=new h.Paths;for(t=0,i=r.length;t<i;t++)for(o.push(r[t].outer),e=0,n=r[t].holes.length;e<n;e++)o.push(r[t].holes[e]);return o};h.JS.PolyTreeToExPolygons=function(r){var t=new h.ExPolygons,e,i,n,o;for(i=0,n=r.Childs(),o=n.length;i<o;i++)e=n[i],h.JS.AddOuterPolyNodeToExPolygons(e,t);return t};$a.exports=h});d();d();var qs=new WeakMap,Vt,kc=class kc{constructor(t){P(this,Vt,void 0);E(this,Vt,t),qs.set(this,t)}get mapName(){return c(this,Vt).mapName}get mapCenter(){return c(this,Vt).mapCenter}get organizationId(){return c(this,Vt).organizationId}get outdoorViewToken(){return c(this,Vt).outdoorViewToken}getByType(t){switch(t){case"space":return c(this,Vt).spaces;case"door":return c(this,Vt).doors;case"floor":return c(this,Vt).floors;case"connection":return c(this,Vt).connections;case"object":return c(this,Vt).objects;case"point-of-interest":return c(this,Vt).pointsOfInterest;case"annotation":return c(this,Vt).annotations;default:return[]}}getById(t,e){return c(this,Vt).getById(t,e)}};Vt=new WeakMap,l(kc,"MapData");var Oc=kc,Ac=Oc;d();d();d();var V4={logState:b.env.NODE_ENV==="test"?3:0,log(...r){this.logState<=0&&console.log("[MappedInJS]",...r)},warn(...r){this.logState<=1&&console.warn("[MappedInJS]",...r)},error(...r){this.logState<=2&&console.error("[MappedInJS]",...r)},assert(...r){console.assert(...r)},time(r){console.time(r)},timeEnd(r){console.timeEnd(r)}},G=V4;var h1=globalThis.fetch,d1,LT=(d1=b==null?void 0:b.env)==null?void 0:d1.npm_package_version;function Nc(){if(h1==null)throw new Error("fetch is not available in your environment. Pass your own function into `setFetchFn` (node-fetch, etc)");return h1}l(Nc,"isomorphicFetch");async function Rc(r,t){return new Promise(async(e,i)=>{try{let{url:n}=await H4(r,t),o=await Nc()(n).then(u=>u.arrayBuffer()),a=new Uint8Array(o);e(a)}catch(n){i(n)}})}l(Rc,"downloadMVF");function f1(r){return r.endsWith("/")?r:`${r}/`}l(f1,"normalizeUrl");async function H4(r,t){let e=`${r.bundleBaseUri?f1(r.bundleBaseUri):"https://app.mappedin.com/"}api/venue/${r.mapId}/mvf${r.viewId?`?configId=${r.viewId}`:""}`,i=await Nc()(e,{headers:{Authorization:`Bearer ${t}`}});if(!i.ok)throw new Error(`${i.status} ${i.statusText}`);return i.json()}l(H4,"getMakerBundleURL");async function $s(r){let t=`${r.authBaseUri?f1(r.authBaseUri):"https://auth-maker.mappedin.com/"}api-key/token`,e=await Nc()(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:r.key,secret:r.secret})});if(!e.ok)throw new Error(`${e.status} ${e.statusText}`);return e.json()}l($s,"getAccessToken");function Bc(r){let t=new TextDecoder,e=t.decode.bind(t);try{let i={"connection.json":JSON.parse(e(r["connection.json"])),"manifest.geojson":JSON.parse(e(r["manifest.geojson"])),"map.geojson":JSON.parse(e(r["map.geojson"])),"mapstack.geojson":r["mapstack.geojson"]?JSON.parse(e(r["mapstack.geojson"])):void 0,"node.geojson":JSON.parse(e(r["node.geojson"])),obstruction:{},space:{},entrance:{}};if((i["mapstack.geojson"]==null||"mapstack.json"in r)&&(i["mapstack.json"]=JSON.parse(e(r["mapstack.json"]))),"styles.json"in r&&(i["styles.json"]=JSON.parse(e(r["styles.json"]))),"shapes.json"in r&&(i["shapes.json"]=JSON.parse(e(r["shapes.json"]))),r.annotation!=null){i.annotation={};let u=Object.keys(r.annotation);for(let s of u){let p=s.replace(/\.json|\.geojson/g,"");i.annotation[p]=JSON.parse(e(r.annotation[s]))}}let n=Object.keys(r.space);for(let u of n){let s=u.replace(/\.json|\.geojson/g,"");i.space[s]=JSON.parse(e(r.space[u]))}let o=Object.keys(r.obstruction);for(let u of o){let s=u.replace(/\.json|\.geojson/g,"");i.obstruction[s]=JSON.parse(e(r.obstruction[u]))}let a=Object.keys(r.entrance);for(let u of a){let s=u.replace(/\.json|\.geojson/g,"");i.entrance[s]=JSON.parse(e(r.entrance[u]))}return i}catch(i){throw G.error(i),new Error("MVF parsing failed! Probably encountered a bad file.")}}l(Bc,"parseMVF");function X4(r){if(r==null||typeof r!="object")return!1;let t=["connection.json","manifest.geojson","map.geojson","node.geojson","mapstack.json"in r?"mapstack.json":"mapstack.geojson"];"styles.json"in r&&t.push("styles.json"),"shapes.json"in r&&t.push("shapes.json");for(let e of t)if(r[e]==null||r[e][Symbol.toStringTag]!=="Uint8Array")return!1;return!0}l(X4,"validateStaticMVFFiles");async function Fc(r){return new Promise(async(t,e)=>{try{if(r==null||typeof r!="object")throw new Error("Error parsing data! Unzipping failed.");if(r[Symbol.toStringTag]!=="Uint8Array")throw new Error("Unexpected file type! Unzipping failed.");let n=(await import("./browser-GW6IOT3A.js")).unzipSync(r);if(!X4(n))throw new Error("MVF is missing some expect static files. Unzipping failed.");let o={},a=Object.keys(n);for(let u of a){if(n[u].length===0)continue;let s=u.split("/");if(s.length<0)throw new Error("Encounted a file with no name! Unzipping failed.");if(s.length>2)throw new Error("Encountered unexpected nesting in MVF! Unzipping failed.");if(s.length===1){o[s[0]]=n[u];continue}if(s[0]==="image"){G.warn("MVF unzipping encountered an image. Ignoring as this case has not been implemented.");continue}else o[s[0]]==null&&(o[s[0]]={}),o[s[0]][s[1]]=n[u]}t(o)}catch(i){e(i)}})}l(Fc,"unzipMVF");d();d();d();d();var zt=63710088e-1,m1={centimeters:zt*100,centimetres:zt*100,degrees:zt/111325,feet:zt*3.28084,inches:zt*39.37,kilometers:zt/1e3,kilometres:zt/1e3,meters:zt,metres:zt,miles:zt/1609.344,millimeters:zt*1e3,millimetres:zt*1e3,nauticalmiles:zt/1852,radians:1,yards:zt*1.0936},AT={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/zt,yards:1.0936133};function Br(r,t,e){e===void 0&&(e={});var i={type:"Feature"};return(e.id===0||e.id)&&(i.id=e.id),e.bbox&&(i.bbox=e.bbox),i.properties=t||{},i.geometry=r,i}l(Br,"feature");function Ie(r,t,e){if(e===void 0&&(e={}),!r)throw new Error("coordinates is required");if(!Array.isArray(r))throw new Error("coordinates must be an Array");if(r.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Gc(r[0])||!Gc(r[1]))throw new Error("coordinates must contain numbers");var i={type:"Point",coordinates:r};return Br(i,t,e)}l(Ie,"point");function hr(r,t,e){if(e===void 0&&(e={}),r.length<2)throw new Error("coordinates must be an array of two or more positions");var i={type:"LineString",coordinates:r};return Br(i,t,e)}l(hr,"lineString");function Lo(r,t){t===void 0&&(t={});var e={type:"FeatureCollection"};return t.id&&(e.id=t.id),t.bbox&&(e.bbox=t.bbox),e.features=r,e}l(Lo,"featureCollection");function y1(r,t){t===void 0&&(t="kilometers");var e=m1[t];if(!e)throw new Error(t+" units is invalid");return r*e}l(y1,"radiansToLength");function g1(r,t){t===void 0&&(t="kilometers");var e=m1[t];if(!e)throw new Error(t+" units is invalid");return r/e}l(g1,"lengthToRadians");function _o(r){var t=r%(2*Math.PI);return t*180/Math.PI}l(_o,"radiansToDegrees");function ne(r){var t=r%360;return t*Math.PI/180}l(ne,"degreesToRadians");function Gc(r){return!isNaN(r)&&r!==null&&!Array.isArray(r)}l(Gc,"isNumber");function We(r){if(!r)throw new Error("coord is required");if(!Array.isArray(r)){if(r.type==="Feature"&&r.geometry!==null&&r.geometry.type==="Point")return r.geometry.coordinates;if(r.type==="Point")return r.coordinates}if(Array.isArray(r)&&r.length>=2&&!Array.isArray(r[0])&&!Array.isArray(r[1]))return r;throw new Error("coord must be GeoJSON Point or an Array of numbers")}l(We,"getCoord");function ue(r){if(Array.isArray(r))return r;if(r.type==="Feature"){if(r.geometry!==null)return r.geometry.coordinates}else if(r.coordinates)return r.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}l(ue,"getCoords");function v1(r,t){return r.type==="FeatureCollection"?"FeatureCollection":r.type==="GeometryCollection"?"GeometryCollection":r.type==="Feature"&&r.geometry!==null?r.geometry.type:r.type}l(v1,"getType");function Y4(r,t,e){e===void 0&&(e={});for(var i=We(r),n=ue(t),o=0;o<n.length-1;o++){var a=!1;if(e.ignoreEndVertices&&(o===0&&(a="start"),o===n.length-2&&(a="end"),o===0&&o+1===n.length-1&&(a="both")),j4(n[o],n[o+1],i,a,typeof e.epsilon>"u"?null:e.epsilon))return!0}return!1}l(Y4,"booleanPointOnLine");function j4(r,t,e,i,n){var o=e[0],a=e[1],u=r[0],s=r[1],p=t[0],f=t[1],m=e[0]-u,y=e[1]-s,x=p-u,S=f-s,M=m*S-y*x;if(n!==null){if(Math.abs(M)>n)return!1}else if(M!==0)return!1;if(i){if(i==="start")return Math.abs(x)>=Math.abs(S)?x>0?u<o&&o<=p:p<=o&&o<u:S>0?s<a&&a<=f:f<=a&&a<s;if(i==="end")return Math.abs(x)>=Math.abs(S)?x>0?u<=o&&o<p:p<o&&o<=u:S>0?s<=a&&a<f:f<a&&a<=s;if(i==="both")return Math.abs(x)>=Math.abs(S)?x>0?u<o&&o<p:p<o&&o<u:S>0?s<a&&a<f:f<a&&a<s}else return Math.abs(x)>=Math.abs(S)?x>0?u<=o&&o<=p:p<=o&&o<=u:S>0?s<=a&&a<=f:f<=a&&a<=s;return!1}l(j4,"isPointOnLineSegment");var b1=Y4;d();d();d();function Js(r,t,e){if(r!==null)for(var i,n,o,a,u,s,p,f=0,m=0,y,x=r.type,S=x==="FeatureCollection",M=x==="Feature",g=S?r.features.length:1,C=0;C<g;C++){p=S?r.features[C].geometry:M?r.geometry:r,y=p?p.type==="GeometryCollection":!1,u=y?p.geometries.length:1;for(var I=0;I<u;I++){var w=0,T=0;if(a=y?p.geometries[I]:p,a!==null){s=a.coordinates;var L=a.type;switch(f=e&&(L==="Polygon"||L==="MultiPolygon")?1:0,L){case null:break;case"Point":if(t(s,m,C,w,T)===!1)return!1;m++,w++;break;case"LineString":case"MultiPoint":for(i=0;i<s.length;i++){if(t(s[i],m,C,w,T)===!1)return!1;m++,L==="MultiPoint"&&w++}L==="LineString"&&w++;break;case"Polygon":case"MultiLineString":for(i=0;i<s.length;i++){for(n=0;n<s[i].length-f;n++){if(t(s[i][n],m,C,w,T)===!1)return!1;m++}L==="MultiLineString"&&w++,L==="Polygon"&&T++}L==="Polygon"&&w++;break;case"MultiPolygon":for(i=0;i<s.length;i++){for(T=0,n=0;n<s[i].length;n++){for(o=0;o<s[i][n].length-f;o++){if(t(s[i][n][o],m,C,w,T)===!1)return!1;m++}T++}w++}break;case"GeometryCollection":for(i=0;i<a.geometries.length;i++)if(Js(a.geometries[i],t,e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}l(Js,"coordEach");function Vc(r,t){if(r.type==="Feature")t(r,0);else if(r.type==="FeatureCollection")for(var e=0;e<r.features.length&&t(r.features[e],e)!==!1;e++);}l(Vc,"featureEach");function W4(r,t){var e,i,n,o,a,u,s,p,f,m,y=0,x=r.type==="FeatureCollection",S=r.type==="Feature",M=x?r.features.length:1;for(e=0;e<M;e++){for(u=x?r.features[e].geometry:S?r.geometry:r,p=x?r.features[e].properties:S?r.properties:{},f=x?r.features[e].bbox:S?r.bbox:void 0,m=x?r.features[e].id:S?r.id:void 0,s=u?u.type==="GeometryCollection":!1,a=s?u.geometries.length:1,n=0;n<a;n++){if(o=s?u.geometries[n]:u,o===null){if(t(null,y,p,f,m)===!1)return!1;continue}switch(o.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(t(o,y,p,f,m)===!1)return!1;break}case"GeometryCollection":{for(i=0;i<o.geometries.length;i++)if(t(o.geometries[i],y,p,f,m)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}y++}}l(W4,"geomEach");function Do(r,t){W4(r,function(e,i,n,o,a){var u=e===null?null:e.type;switch(u){case null:case"Point":case"LineString":case"Polygon":return t(Br(e,n,{bbox:o,id:a}),i,0)===!1?!1:void 0}var s;switch(u){case"MultiPoint":s="Point";break;case"MultiLineString":s="LineString";break;case"MultiPolygon":s="Polygon";break}for(var p=0;p<e.coordinates.length;p++){var f=e.coordinates[p],m={type:s,coordinates:f};if(t(Br(m,n),i,p)===!1)return!1}})}l(Do,"flattenEach");function Z4(r,t){Do(r,function(e,i,n){var o=0;if(e.geometry){var a=e.geometry.type;if(!(a==="Point"||a==="MultiPoint")){var u,s=0,p=0,f=0;if(Js(e,function(m,y,x,S,M){if(u===void 0||i>s||S>p||M>f){u=m,s=i,p=S,f=M,o=0;return}var g=hr([u,m],e.properties);if(t(g,i,n,M,o)===!1)return!1;o++,u=m})===!1)return!1}}})}l(Z4,"segmentEach");function C1(r,t,e){var i=e,n=!1;return Z4(r,function(o,a,u,s,p){n===!1&&e===void 0?i=o:i=t(i,o,a,u,s,p),n=!0}),i}l(C1,"segmentReduce");function Hc(r){var t=[1/0,1/0,-1/0,-1/0];return Js(r,function(e){t[0]>e[0]&&(t[0]=e[0]),t[1]>e[1]&&(t[1]=e[1]),t[2]<e[0]&&(t[2]=e[0]),t[3]<e[1]&&(t[3]=e[1])}),t}l(Hc,"bbox");Hc.default=Hc;var Ks=Hc;function U4(r,t){t===void 0&&(t={});var e=Ks(r),i=(e[0]+e[2])/2,n=(e[1]+e[3])/2;return Ie([i,n],t.properties,t)}l(U4,"center");var x1=U4;d();d();function z4(r,t,e){e===void 0&&(e={});var i=We(r),n=We(t),o=ne(n[1]-i[1]),a=ne(n[0]-i[0]),u=ne(i[1]),s=ne(n[1]),p=Math.pow(Math.sin(o/2),2)+Math.pow(Math.sin(a/2),2)*Math.cos(u)*Math.cos(s);return y1(2*Math.atan2(Math.sqrt(p),Math.sqrt(1-p)),e.units)}l(z4,"distance");var Fr=z4;function Qs(r,t){return t===void 0&&(t={}),C1(r,function(e,i){var n=i.geometry.coordinates;return e+Fr(n[0],n[1],t)},0)}l(Qs,"length");d();d();d();function tl(r,t,e){if(e===void 0&&(e={}),e.final===!0)return q4(r,t);var i=We(r),n=We(t),o=ne(i[0]),a=ne(n[0]),u=ne(i[1]),s=ne(n[1]),p=Math.sin(a-o)*Math.cos(s),f=Math.cos(u)*Math.sin(s)-Math.sin(u)*Math.cos(s)*Math.cos(a-o);return _o(Math.atan2(p,f))}l(tl,"bearing");function q4(r,t){var e=tl(t,r);return e=(e+180)%360,e}l(q4,"calculateFinalBearing");d();function gi(r,t,e,i){i===void 0&&(i={});var n=We(r),o=ne(n[0]),a=ne(n[1]),u=ne(e),s=g1(t,i.units),p=Math.asin(Math.sin(a)*Math.cos(s)+Math.cos(a)*Math.sin(s)*Math.cos(u)),f=o+Math.atan2(Math.sin(u)*Math.sin(s)*Math.cos(a),Math.cos(s)-Math.sin(a)*Math.sin(p)),m=_o(f),y=_o(p);return Ie([m,y],i.properties)}l(gi,"destination");d();d();function $4(r){if(!r)throw new Error("geojson is required");var t=[];return Do(r,function(e){J4(e,t)}),Lo(t)}l($4,"lineSegment");function J4(r,t){var e=[],i=r.geometry;if(i!==null){switch(i.type){case"Polygon":e=ue(i);break;case"LineString":e=[ue(i)]}e.forEach(function(n){var o=K4(n,r.properties);o.forEach(function(a){a.id=t.length,t.push(a)})})}}l(J4,"lineSegmentFeature");function K4(r,t){var e=[];return r.reduce(function(i,n){var o=hr([i,n],t);return o.bbox=Q4(i,n),e.push(o),n}),e}l(K4,"createSegments");function Q4(r,t){var e=r[0],i=r[1],n=t[0],o=t[1],a=e<n?e:n,u=i<o?i:o,s=e>n?e:n,p=i>o?i:o;return[a,u,s,p]}l(Q4,"bbox");var Xc=$4;var _3=Ar(E3(),1);function S8(r,t){var e={},i=[];if(r.type==="LineString"&&(r=Br(r)),t.type==="LineString"&&(t=Br(t)),r.type==="Feature"&&t.type==="Feature"&&r.geometry!==null&&t.geometry!==null&&r.geometry.type==="LineString"&&t.geometry.type==="LineString"&&r.geometry.coordinates.length===2&&t.geometry.coordinates.length===2){var n=L3(r,t);return n&&i.push(n),Lo(i)}var o=(0,_3.default)();return o.load(Xc(t)),Vc(Xc(r),function(a){Vc(o.search(a),function(u){var s=L3(a,u);if(s){var p=ue(s).join(",");e[p]||(e[p]=!0,i.push(s))}})}),Lo(i)}l(S8,"lineIntersect");function L3(r,t){var e=ue(r),i=ue(t);if(e.length!==2)throw new Error("<intersects> line1 must only contain 2 coordinates");if(i.length!==2)throw new Error("<intersects> line2 must only contain 2 coordinates");var n=e[0][0],o=e[0][1],a=e[1][0],u=e[1][1],s=i[0][0],p=i[0][1],f=i[1][0],m=i[1][1],y=(m-p)*(a-n)-(f-s)*(u-o),x=(f-s)*(o-p)-(m-p)*(n-s),S=(a-n)*(o-p)-(u-o)*(n-s);if(y===0)return null;var M=x/y,g=S/y;if(M>=0&&M<=1&&g>=0&&g<=1){var C=n+M*(a-n),I=o+M*(u-o);return Ie([C,I])}return null}l(L3,"intersects");var D3=S8;function M8(r,t,e){e===void 0&&(e={});var i=Ie([1/0,1/0],{dist:1/0}),n=0;return Do(r,function(o){for(var a=ue(o),u=0;u<a.length-1;u++){var s=Ie(a[u]);s.properties.dist=Fr(t,s,e);var p=Ie(a[u+1]);p.properties.dist=Fr(t,p,e);var f=Fr(s,p,e),m=Math.max(s.properties.dist,p.properties.dist),y=tl(s,p),x=gi(t,m,y+90,e),S=gi(t,m,y-90,e),M=D3(hr([x.geometry.coordinates,S.geometry.coordinates]),hr([s.geometry.coordinates,p.geometry.coordinates])),g=null;M.features.length>0&&(g=M.features[0],g.properties.dist=Fr(t,g,e),g.properties.location=n+Fr(s,g,e)),s.properties.dist<i.properties.dist&&(i=s,i.properties.index=u,i.properties.location=n),p.properties.dist<i.properties.dist&&(i=p,i.properties.index=u+1,i.properties.location=n+f),g&&g.properties.dist<i.properties.dist&&(i=g,i.properties.index=u),n+=f}}),i}l(M8,"nearestPointOnLine");var qo=M8;function P8(r,t,e){var i=ue(e);if(v1(e)!=="LineString")throw new Error("line must be a LineString");var n=qo(e,r),o=qo(e,t),a;n.properties.index<=o.properties.index?a=[n,o]:a=[o,n];for(var u=[a[0].geometry.coordinates],s=a[0].properties.index+1;s<a[1].properties.index+1;s++)u.push(i[s]);return u.push(a[1].geometry.coordinates),hr(u,e.properties)}l(P8,"lineSlice");var Lh=P8;var T8=1e-7;function _h(r){return{type:"Point",coordinates:r}}l(_h,"point");function w8(r,t){let{coordinates:e}=t.geometry,{coordinates:i}=r.geometry,n=e.map(o=>qo(r,_h(o)));return i.reduce((o,a)=>{let u=Lh(_h(a),n[0],r),s=Lh(_h(a),n[1],r),p=Qs(u)<Qs(s)?u:s;return p.properties={...r.properties,entrances:[]},o.concat([p])},[])}l(w8,"splitObstructionByEntrance");function Dh(r,t){return t.reduce((e,i)=>{let n={epsilon:T8},o=e.findIndex(u=>b1(x1(i),u,n)),a=e[o];if(a){let[u,s]=w8(a,i);e.splice(o,1,u,s)}return e},[r])}l(Dh,"splitObstructionByAllEntrances");d();d();d();d();var Oh=[0,4,6,8,10],ut=l(()=>{let r=new Array(16).fill(0),t=Math.random()*4294967296;for(let i=0;i<r.length;i++)i>0&&!(i&3)&&(t=Math.random()*4294967296),r[i]=t>>>((i&3)<<3)&255;let e=r.map(i=>i.toString(16).padStart(2,"0"));return e[6]="4"+e[6][1],e[8]=["8","9","a","b"].includes(e[7][0])?e[7]:"a"+e[7][1],Oh.map((i,n)=>e.slice(i,n===Oh.length-1?void 0:Oh[n+1]).join("")).join("-")},"randomId");var Ln=class Ln{__type=Ln.__type;id=ut();latitude;longitude;floorId;static is(t){return t.__type===Ln.__type}constructor(t,e,i){this.latitude=t,this.longitude=e,this.floorId=i}isEqual(t){return this.latitude===t.latitude&&this.longitude===t.longitude&&this.floorId===t.floorId}toJSON(){return{latitude:this.latitude,longitude:this.longitude,floor:this.floorId}}destroy(){}};l(Ln,"Coordinate"),v(Ln,"__type","coordinate");var Ah=Ln,K=Ah;d();d();d();d();var kh=class kh{id;constructor(t){this.id=t}};l(kh,"BaseMetaData");var xi=kh;var Jo,_n,$o=class $o extends xi{constructor(e){super(String(ut()));P(this,Jo,{});P(this,_n,void 0);E(this,_n,e.mvfData)}static is(e){return e.__type===$o.__type}get url(){return c(this,_n).url}get name(){return c(this,_n).displayName}toJSON(){return{id:this.id,url:this.url,name:this.name}}destroy(){for(let e of globalThis.Object.keys(c(this,Jo)))delete c(this,Jo)[e]}};Jo=new WeakMap,_n=new WeakMap,l($o,"Hyperlink"),v($o,"__type","hyperlink");var Nh=$o,Jl=Nh;var Rh=class Rh{id;constructor(t,e){var n;this.id=t;let i=(n=e==null?void 0:e.links)!=null?n:[];i.length>0&&(this.links=i.map(o=>new Jl({mvfData:o})))}links=[]};l(Rh,"BaseMapData");var Lt=Rh;var Si,yr,Mi,Wr,Dn=class Dn extends Lt{constructor(e,i){super(i.mvfData.properties.id,i.mvfData.properties.details);v(this,"__type",Dn.__type);P(this,Si,void 0);P(this,yr,void 0);P(this,Mi,void 0);P(this,Wr,void 0);E(this,yr,{}),E(this,Wr,i.mvfData),E(this,Si,e),E(this,Mi,i.floorId)}static is(e){return e.__type===Dn.__type}get name(){var e,i;return(i=(e=c(this,Wr).properties.details)==null?void 0:e.name)!=null?i:""}get description(){var e,i;return(i=(e=c(this,Wr).properties.details)==null?void 0:e.description)!=null?i:""}get images(){var e,i;return(i=(e=c(this,Wr).properties.details)==null?void 0:e.images)!=null?i:[]}get floor(){let e=c(this,Si).getById("floor",c(this,Mi));if(e==null)throw new Error(`Floor ${c(this,Mi)} not found!`);return e}get center(){if(c(this,yr).center==null){let[[e,i],[n,o]]=c(this,Wr).geometry.coordinates,a=(e+n)/2,u=(i+o)/2;c(this,yr).center=new K(u,a,c(this,Mi))}return c(this,yr).center}get isExterior(){var n;let e=c(this,Si).obstructionIdByEntranceId[this.id],i=c(this,Si).getMVFFeatureById("obstruction",e);return(n=i==null?void 0:i.properties.footprintComponent)!=null?n:!1}toJSON(){return{id:this.id,name:this.name,floor:this.floor.id,center:this.center.toJSON()}}destroy(){for(let e of Object.keys(c(this,yr)))delete c(this,yr)[e]}};Si=new WeakMap,yr=new WeakMap,Mi=new WeakMap,Wr=new WeakMap,l(Dn,"Door"),v(Dn,"__type","door");var Bh=Dn,Zr=Bh;d();var Ko,Pi,Ur,gr,On=class On extends Lt{constructor(e,i){super(i.mvfData.properties.id,i.mvfData.properties.details);v(this,"__type",On.__type);P(this,Ko,void 0);P(this,Pi,void 0);P(this,Ur,{});P(this,gr,void 0);E(this,Ko,e),E(this,Pi,i.floorId),E(this,gr,i.mvfData)}static is(e){return e.__type===On.__type}get name(){var i,n;let{properties:e}=c(this,gr);return(n=(i=e.details)==null?void 0:i.name)!=null?n:e.externalId}get type(){return E8(c(this,gr).properties.kind)}get description(){var e,i;return(i=(e=c(this,gr).properties.details)==null?void 0:e.description)!=null?i:""}get images(){var e,i;return(i=(e=c(this,gr).properties.details)==null?void 0:e.images)!=null?i:[]}get floor(){let e=c(this,Ko).getById("floor",c(this,Pi));if(e==null)throw new Error(`Floor ${c(this,Pi)} not found!`);return e}get center(){var e;if(c(this,Ur).center==null){let[i,n]=(e=c(this,gr).properties.center)!=null?e:[0,0];c(this,Ur).center=new K(n,i,c(this,Pi))}return c(this,Ur).center}toJSON(){return{id:this.id,name:this.name,type:this.type,floor:this.floor.id,center:this.center.toJSON()}}destroy(){for(let e of Object.keys(c(this,Ur)))delete c(this,Ur)[e]}};Ko=new WeakMap,Pi=new WeakMap,Ur=new WeakMap,gr=new WeakMap,l(On,"Space"),v(On,"__type","space");var Fh=On,I8=["room","hallway","exterior","void","connection.stairs","connection.elevator","poi"];function E8(r){if(r==null||r==="default")return"room";let t=r.toLowerCase();return I8.includes(t)?t:"room"}l(E8,"validateSpaceType");var _e=Fh;d();var qe,gt,kn,An=class An extends Lt{constructor(e,i){super(i.mvfData.id);v(this,"__type",An.__type);P(this,qe,void 0);P(this,gt,{});P(this,kn,void 0);E(this,qe,e),E(this,kn,i.mvfData)}static is(e){return e.__type===An.__type}get name(){return c(this,kn).externalId}get elevation(){return c(this,kn).elevation}get spaces(){if(c(this,gt).spaces==null){let e=c(this,qe).spaces.filter(i=>i.floor.id===this.id);c(this,gt).spaces=e}return c(this,gt).spaces}get objects(){if(c(this,gt).objects==null){let e=c(this,qe).objects.filter(i=>i.floor.id===this.id);c(this,gt).objects=e}return c(this,gt).objects}get connections(){if(c(this,gt).connections==null){let e=c(this,qe).connections.filter(i=>i.floors.includes(this));c(this,gt).connections=e}return c(this,gt).connections}get doors(){if(c(this,gt).doors==null){let e=c(this,qe).doors.filter(i=>i.floor.id===this.id);c(this,gt).doors=e}return c(this,gt).doors}get annotations(){if(c(this,gt).annotations==null){let e=c(this,qe).annotations.filter(i=>i.floor.id===this.id);c(this,gt).annotations=e}return c(this,gt).annotations}get pois(){if(c(this,gt).pois==null){let e=c(this,qe).pointsOfInterest.filter(i=>i.floor.id===this.id);c(this,gt).pois=e}return c(this,gt).pois}toJSON(){return{id:this.id,name:this.name,elevation:this.elevation,spaces:this.spaces.map(e=>e.id),objects:this.objects.map(e=>e.id),connections:this.connections.map(e=>e.id),doors:this.doors.map(e=>e.id),annotations:this.annotations.map(e=>e.id),pois:this.pois.map(e=>e.id)}}destroy(){for(let e of globalThis.Object.keys(c(this,gt)))delete c(this,gt)[e]}};qe=new WeakMap,gt=new WeakMap,kn=new WeakMap,l(An,"Floor"),v(An,"__type","floor");var Gh=An,Nn=Gh;d();d();d();var Vh=l(r=>r!=null,"notNull");d();function $e(r){let t;if(_e.is(r)||Zr.is(r)||De.is(r))t=r.center;else if(zr.is(r)||Rn.is(r))t=r.coordinate;else if(K.is(r))t=r;else return;return t}l($e,"getCoordinateFromStuffs");var Qo,vr,br,Bn=class Bn extends Lt{constructor(e,i){let n=Object.values(i.mvfDataByFloorId)[0];super(n.properties.id,n.properties.details);v(this,"__type",Bn.__type);P(this,Qo,void 0);P(this,vr,void 0);P(this,br,void 0);E(this,vr,{}),E(this,Qo,e),E(this,br,i.mvfDataByFloorId)}static is(e){return e.__type===Bn.__type}get name(){var e,i;return(i=(e=Object.values(c(this,br))[0].properties.details)==null?void 0:e.name)!=null?i:""}get description(){var e,i;return(i=(e=Object.values(c(this,br))[0].properties.details)==null?void 0:e.description)!=null?i:""}get images(){var e,i;return(i=(e=Object.values(c(this,br))[0].properties.details)==null?void 0:e.images)!=null?i:[]}get type(){var e,i;return(i=(e=Object.values(c(this,br))[0].properties.kind)==null?void 0:e.split(".")[1])!=null?i:"unknown"}get coordinates(){return c(this,vr).coordinates==null&&(c(this,vr).coordinates=Object.entries(c(this,br)).map(([e,i])=>new K(i.geometry.coordinates[1],i.geometry.coordinates[0],e))),c(this,vr).coordinates}get floors(){return this.coordinates.map(e=>e.floorId?c(this,Qo).getById("floor",e.floorId):void 0).filter(Vh)}toJSON(){return{id:this.id,name:this.name,type:this.type,coordinates:this.coordinates.map(e=>e.toJSON()),floors:this.floors.map(e=>e.id)}}destroy(){for(let e of Object.keys(c(this,vr)))delete c(this,vr)[e]}};Qo=new WeakMap,vr=new WeakMap,br=new WeakMap,l(Bn,"Connection"),v(Bn,"__type","connection");var Hh=Bn,qr=Hh;d();var ta,Ti,$r,Cr,Fn=class Fn extends Lt{constructor(e,i){super(i.mvfData.properties.id,i.mvfData.properties.details);v(this,"__type",Fn.__type);P(this,ta,void 0);P(this,Ti,void 0);P(this,$r,{});P(this,Cr,void 0);E(this,ta,e),E(this,Ti,i.floorId),E(this,Cr,i.mvfData)}static is(e){return e.__type===Fn.__type}get name(){var e,i;return(i=(e=c(this,Cr).properties.details)==null?void 0:e.name)!=null?i:""}get description(){var e,i;return(i=(e=c(this,Cr).properties.details)==null?void 0:e.description)!=null?i:""}get images(){var e,i;return(i=(e=c(this,Cr).properties.details)==null?void 0:e.images)!=null?i:[]}get type(){let e=c(this,Cr).properties.kind;return e==null&&(e="object"),e==="Desks"&&(e="desk"),e.toLowerCase()}get floor(){let e=c(this,ta).getById("floor",c(this,Ti));if(e==null)throw new Error(`Floor ${c(this,Ti)} not found!`);return e}get center(){var e;if(c(this,$r).center==null){let[i,n]=(e=c(this,Cr).properties.center)!=null?e:[0,0];c(this,$r).center=new K(n,i,c(this,Ti))}return c(this,$r).center}toJSON(){return{id:this.id,name:this.name,type:this.type,floor:this.floor.id,center:this.center.toJSON()}}destroy(){for(let e of globalThis.Object.keys(c(this,$r)))c(this,$r)[e]=null}};ta=new WeakMap,Ti=new WeakMap,$r=new WeakMap,Cr=new WeakMap,l(Fn,"MapObject"),v(Fn,"__type","object");var Xh=Fn,De=Xh;d();d();var ra,Gn,ea=class ea extends xi{constructor(e){super(String(ut()));P(this,ra,{});P(this,Gn,void 0);E(this,Gn,e.mvfData)}static is(e){return e.__type===ea.__type}get url(){return c(this,Gn).url}get name(){return c(this,Gn).altText}toJSON(){return{id:this.id,url:this.url,name:this.name}}destroy(){for(let e of globalThis.Object.keys(c(this,ra)))delete c(this,ra)[e]}};ra=new WeakMap,Gn=new WeakMap,l(ea,"Image"),v(ea,"__type","image");var Yh=ea,Kl=Yh;var ia,wi,Oe,Jr,Vn=class Vn extends Lt{constructor(e,i){super(i.mvfData.properties.id,i.mvfData.properties.details);v(this,"__type",Vn.__type);P(this,ia,void 0);P(this,wi,void 0);P(this,Oe,{});P(this,Jr,void 0);E(this,ia,e),E(this,Jr,i.mvfData),E(this,wi,i.floorId)}static is(e){return e.__type===Vn.__type}get name(){var e,i;return(i=(e=c(this,Jr).properties.details)==null?void 0:e.name)!=null?i:""}get description(){var e,i;return(i=(e=c(this,Jr).properties.details)==null?void 0:e.description)!=null?i:""}get images(){var e,i;if(c(this,Oe).images==null){let n=(i=(e=c(this,Jr).properties.details)==null?void 0:e.images)!=null?i:[];c(this,Oe).images=n.map(o=>new Kl({mvfData:o}))}return c(this,Oe).images}get floor(){let e=c(this,ia).getById("floor",c(this,wi));if(e==null)throw new Error(`Floor ${c(this,wi)} not found!`);return e}get coordinate(){var e;if(c(this,Oe).coordinate==null){let[i,n]=(e=c(this,Jr).geometry.coordinates)!=null?e:[0,0];c(this,Oe).coordinate=new K(n,i,c(this,wi))}return c(this,Oe).coordinate}toJSON(){return{id:this.id,name:this.name,floor:this.floor.id,coordinate:this.coordinate.toJSON()}}destroy(){for(let e in c(this,Oe))c(this,Oe)[e]=null}};ia=new WeakMap,wi=new WeakMap,Oe=new WeakMap,Jr=new WeakMap,l(Vn,"PointOfInterest"),v(Vn,"__type","point-of-interest");var jh=Vn,zr=jh;d();var na,Ii,Kr,Xn,oa,Zh,Hn=class Hn extends Lt{constructor(e,i){super(i.mvfData.properties.id);P(this,oa);v(this,"__type",Hn.__type);P(this,na,void 0);P(this,Ii,void 0);P(this,Kr,{});P(this,Xn,void 0);E(this,na,e),E(this,Ii,i.floorId),E(this,Xn,i.mvfData)}static is(e){return e.__type===Hn.__type}get group(){return W(this,oa,Zh).call(this).group}get type(){return W(this,oa,Zh).call(this).type}get coordinate(){if(c(this,Kr).coordinate==null){let[e,i]=c(this,Xn).geometry.coordinates;c(this,Kr).coordinate=new K(i,e,c(this,Ii))}return c(this,Kr).coordinate}get floor(){let e=c(this,na).getById("floor",c(this,Ii));if(e==null)throw new Error(`Floor ${c(this,Ii)} not found!`);return e}toJSON(){return{id:this.id,group:this.group,type:this.type,coordinate:this.coordinate.toJSON()}}destroy(){for(let e of Object.keys(c(this,Kr)))delete c(this,Kr)[e]}};na=new WeakMap,Ii=new WeakMap,Kr=new WeakMap,Xn=new WeakMap,oa=new WeakSet,Zh=l(function(){let[e,i]=c(this,Xn).properties.symbolId.split("--");return{group:e,type:i}},"#getGroupAndTypeFromSymbolId"),l(Hn,"Annotation"),v(Hn,"__type","annotation");var Wh=Hn,Rn=Wh;d();d();var jn,Ae,Ei,Wn,Yn=class Yn extends Lt{constructor(e,i){super(i.mvfData.properties.id);v(this,"__type",Yn.__type);P(this,jn,void 0);P(this,Ae,{});P(this,Ei,void 0);P(this,Wn,void 0);E(this,jn,e),E(this,Ei,i.floorId),E(this,Wn,i.mvfData)}static is(e){return e.__type===Yn.__type}get floor(){let e=c(this,jn).getById("floor",c(this,Ei));if(e==null)throw new Error(`Floor ${c(this,Ei)} not found!`);return e}get coordinate(){if(c(this,Ae).coordinate==null){let[e,i]=c(this,Wn).geometry.coordinates;c(this,Ae).coordinate=new K(i,e,c(this,Ei))}return c(this,Ae).coordinate}get neighbors(){if(c(this,Ae).neighbours==null){let e=c(this,Wn).properties.neighbors.map(i=>{let n=c(this,jn).getById("node",i.id);if(n==null)throw new Error(`Node ${i.id} not found!`);return n});c(this,Ae).neighbours=e}return c(this,Ae).neighbours}toJSON(){return{id:this.id,floor:this.floor.id,coordinate:this.coordinate.toJSON(),neighbors:this.neighbors.map(e=>e.id)}}destroy(){for(let e of Object.keys(c(this,Ae)))delete c(this,Ae)[e]}};jn=new WeakMap,Ae=new WeakMap,Ei=new WeakMap,Wn=new WeakMap,l(Yn,"Node"),v(Yn,"__type","node");var Uh=Yn,O3=Uh;var L8=l((r,t)=>{var m,y;let e={},i={},n={},o={},a={},u={},s={},p={},f=globalThis.Object.keys(r.space);for(let x of f){let S=r.space[x];if(S!=null)for(let M of S.features){p[M.properties.id]=x,a[M.properties.id]=M;for(let g of M.properties.destinationNodes)n[g]==null&&(n[g]=[]),n[g].push(M.properties.id);if(M.properties.kind==="desk-entrance"&&(o[M.properties.externalId]==null&&(o[M.properties.externalId]=[]),o[M.properties.externalId].push(...M.properties.destinationNodes)),!["void","desk-entrance"].includes((m=M.properties.kind)!=null?m:"")){if((y=M.properties.kind)!=null&&y.includes("connection")){let g=`${M.geometry.coordinates[1]}-${M.geometry.coordinates[0]}`;u[g]==null&&(u[g]=[]),u[g].push(M.properties.id);continue}if(M.properties.kind==="poi"){let g=new zr(t,{floorId:x,mvfData:M});i[M.properties.id]=g}else{let g=new _e(t,{floorId:x,mvfData:M});e[M.properties.id]=g}}}}for(let x in u){let S=u[x],M={};for(let C of S){let I=p[C],w=a[C];M[I]=w}let g=new qr(t,{mvfDataByFloorId:M});s[g.id]=g}return{spacesById:e,poisById:i,connectionsById:s,spaceIdsByDestinationNodeId:n,objectEntranceNodeIdsByObstructionId:o,mvfSpacesById:a,connectionIdsByLatLon:u}},"processMVFSpaces"),_8=l((r,t)=>{let e={},i={};for(let n of r["node.geojson"].features){i[n.properties.id]=n;let o=new O3(t,{mvfData:n,floorId:n.properties.map});e[n.properties.id]=o}return{nodesById:e,mvfNodesById:i}},"processMVFNodes"),D8=l((r,t)=>{let e={},i={},n={},o=globalThis.Object.keys(r.obstruction);for(let a of o){let u=r.obstruction[a];if(u!=null)for(let s of u.features){i[s.properties.id]=s;for(let f of s.properties.entrances)n[f]=s.properties.id;if(s.properties.kind==="Wall")continue;let p=new De(t,{floorId:a,mvfData:s});e[s.properties.id]=p}}return{objectsById:e,mvfObstructionById:i,obstructionIdByEntranceId:n}},"processMVFObstructions"),O8=l((r,t)=>{let e={},i={};for(let n of r["map.geojson"]){i[n.id]=n;let o=new Nn(t,{mvfData:n});e[n.id]=o}return{floorsById:e,mvfMapsById:i}},"processMVFMaps"),A8=l((r,t)=>{let e={},i=r["connection.json"].reduce((n,o)=>(o.nodes.forEach(a=>n[a]=o),e[o.id]=o,n),{});return{mvfConnectionsById:e,mvfConnectionsByNodeId:i}},"processMVFConnections"),k8=l((r,t)=>{let e={},i={},n=globalThis.Object.keys(r.entrance);for(let o of n){let a=r.entrance[o];if(a!=null)for(let u of a.features){i[u.properties.id]=u;let s=new Zr(t,{floorId:o,mvfData:u});e[u.properties.id]=s}}return{doorsById:e,mvfEntrancesById:i}},"processMVFEntrances"),N8=l((r,t)=>{let e={},i={};if(r.annotation==null)return{annotationsById:e,mvfAnnotationsById:i};let n=globalThis.Object.keys(r.annotation);for(let o of n){let a=r.annotation[o];if(a!=null)for(let u of a.features){i[u.properties.id]=u;let s=new Rn(t,{floorId:o,mvfData:u});e[u.properties.id]=s}}return{annotationsById:e,mvfAnnotationsById:i}},"processMVFAnnotations"),A3=l((r,t)=>{let{spacesById:e,spaceIdsByDestinationNodeId:i,poisById:n,mvfSpacesById:o,objectEntranceNodeIdsByObstructionId:a,connectionsById:u,connectionIdsByLatLon:s}=L8(r,t),{nodesById:p,mvfNodesById:f}=_8(r,t),{objectsById:m,mvfObstructionById:y,obstructionIdByEntranceId:x}=D8(r,t),{floorsById:S,mvfMapsById:M}=O8(r,t),{mvfConnectionsById:g,mvfConnectionsByNodeId:C}=A8(r,t),{doorsById:I,mvfEntrancesById:w}=k8(r,t),{annotationsById:T,mvfAnnotationsById:L}=N8(r,t);return{spacesById:e,nodesById:p,objectsById:m,floorsById:S,connectionsById:u,doorsById:I,poisById:n,annotationsById:T,spaceIdsByDestinationNodeId:i,objectEntranceNodeIdsByObstructionId:a,obstructionIdByEntranceId:x,connectionIdsByLatLon:s,mvfSpacesById:o,mvfNodesById:f,mvfObstructionById:y,mvfMapsById:M,mvfConnectionsById:g,mvfConnectionsByNodeId:C,mvfEntrancesById:w,mvfAnnotationsById:L}},"createDataFromMVF");var ot,Li,_i,Di,Oi,Ai,ki,Ni,Ri,sa,la,ua,ca,pa,ha,da,fa,zh=class zh{constructor(t,e){P(this,ot,{});v(this,"mvf");v(this,"outdoorViewToken");v(this,"spaceIdsByDestinationNodeId");v(this,"objectEntranceNodeIdsByObstructionId");v(this,"obstructionIdByEntranceId");P(this,Li,void 0);P(this,_i,void 0);P(this,Di,void 0);P(this,Oi,void 0);P(this,Ai,void 0);P(this,ki,void 0);P(this,Ni,void 0);P(this,Ri,void 0);P(this,sa,void 0);P(this,la,void 0);P(this,ua,void 0);P(this,ca,void 0);P(this,pa,void 0);P(this,ha,void 0);P(this,da,void 0);P(this,fa,void 0);this.mvf=t,this.outdoorViewToken=e;let i=A3(t,this);E(this,Li,i.nodesById),E(this,_i,i.spacesById),E(this,Di,i.floorsById),E(this,Oi,i.connectionsById),E(this,Ai,i.objectsById),E(this,ki,i.doorsById),E(this,Ni,i.poisById),E(this,Ri,i.annotationsById),E(this,sa,i.mvfAnnotationsById),E(this,la,i.mvfConnectionsById),E(this,ua,i.mvfConnectionsByNodeId),E(this,ca,i.mvfEntrancesById),E(this,pa,i.mvfNodesById),E(this,ha,i.mvfObstructionById),E(this,da,i.mvfSpacesById),E(this,fa,i.mvfMapsById),this.spaceIdsByDestinationNodeId=i.spaceIdsByDestinationNodeId,this.objectEntranceNodeIdsByObstructionId=i.objectEntranceNodeIdsByObstructionId,this.obstructionIdByEntranceId=i.obstructionIdByEntranceId}get mapName(){return this.mvf["manifest.geojson"].features[0].properties.name}get organizationId(){var t;return(t=this.mvf["manifest.geojson"].features[0].properties.org_id)!=null?t:""}get mapCenter(){return new K(this.mvf["manifest.geojson"].features[0].geometry.coordinates[1],this.mvf["manifest.geojson"].features[0].geometry.coordinates[0])}get spaces(){return c(this,ot).spaces==null&&(c(this,ot).spaces=globalThis.Object.values(c(this,_i))),c(this,ot).spaces}get objects(){return c(this,ot).objects==null&&(c(this,ot).objects=globalThis.Object.values(c(this,Ai))),c(this,ot).objects}get connections(){return c(this,ot).connections==null&&(c(this,ot).connections=globalThis.Object.values(c(this,Oi))),c(this,ot).connections}get floors(){return c(this,ot).floors==null&&(c(this,ot).floors=globalThis.Object.values(c(this,Di))),c(this,ot).floors}get doors(){return c(this,ot).doors==null&&(c(this,ot).doors=globalThis.Object.values(c(this,ki))),c(this,ot).doors}get pointsOfInterest(){return c(this,ot).pointsOfInterest==null&&(c(this,ot).pointsOfInterest=globalThis.Object.values(c(this,Ni))),c(this,ot).pointsOfInterest}get annotations(){return c(this,ot).annotations==null&&(c(this,ot).annotations=globalThis.Object.values(c(this,Ri))),c(this,ot).annotations}get nodes(){return c(this,ot).nodes==null&&(c(this,ot).nodes=globalThis.Object.values(c(this,Li))),c(this,ot).nodes}getById(t,e){switch(t){case"space":return c(this,_i)[e];case"floor":return c(this,Di)[e];case"node":return c(this,Li)[e];case"door":return c(this,ki)[e];case"connection":return c(this,Oi)[e];case"object":return c(this,Ai)[e];case"point-of-interest":return c(this,Ni)[e];case"annotation":return c(this,Ri)[e];default:throw new Error(`Unknown type: ${t}`)}}getMapDataById(t){var e,i,n,o,a,u,s;return(s=(u=(a=(o=(n=(i=(e=c(this,_i)[t])!=null?e:c(this,Di)[t])!=null?i:c(this,Li)[t])!=null?n:c(this,ki)[t])!=null?o:c(this,Oi)[t])!=null?a:c(this,Ai)[t])!=null?u:c(this,Ni)[t])!=null?s:c(this,Ri)[t]}getMVFFeatureById(t,e){switch(t){case"space":return c(this,da)[e];case"node":return c(this,pa)[e];case"obstruction":return c(this,ha)[e];case"map":return c(this,fa)[e];case"connection":return c(this,la)[e];case"entrance":return c(this,ca)[e];case"annotation":return c(this,sa)[e];default:throw new Error(`Unknown MVF feature type: ${t}`)}}getMVFFeatureByNodeId(t,e){switch(t){case"connection":return c(this,ua)[e];default:throw new Error(`Unsupported MVF feature type: ${t}`)}}destroy(){for(let t of globalThis.Object.keys(c(this,ot)))c(this,ot)[t]=null}};ot=new WeakMap,Li=new WeakMap,_i=new WeakMap,Di=new WeakMap,Oi=new WeakMap,Ai=new WeakMap,ki=new WeakMap,Ni=new WeakMap,Ri=new WeakMap,sa=new WeakMap,la=new WeakMap,ua=new WeakMap,ca=new WeakMap,pa=new WeakMap,ha=new WeakMap,da=new WeakMap,fa=new WeakMap,l(zh,"MapDataInternal");var aa=zh;d();d();d();d();var qh=class qh{_subscribers={};publish(t,e){!this._subscribers||!this._subscribers[t]||this._subscribers[t].forEach(function(i){typeof i=="function"&&i(e)})}on(t,e){this._subscribers||(this._subscribers={}),this._subscribers[t]=this._subscribers[t]||[],this._subscribers[t].push(e)}off(t,e){if(!this._subscribers||this._subscribers[t]==null)return;let i=this._subscribers[t].indexOf(e);i!==-1&&this._subscribers[t].splice(i,1)}destroy(){this._subscribers={}}};l(qh,"PubSub");var et=qh;d();d();d();d();var Zn=class Zn{id;text;__type=Zn.__type;static is(t){return t.__type===Zn.__type}constructor(t,e){this.id=t,this.text=e}};l(Zn,"Label"),v(Zn,"__type","Label");var Qr=Zn;d();var Un=class Un{id;__type=Un.__type;contentEl;update;static is(t){return t.__type===Un.__type}constructor(t,e,i){this.id=t,this.contentEl=e,this.update=i}};l(Un,"Marker"),v(Un,"__type","Marker");var Bi=Un;d();var zn=class zn{id;groupId;__type=zn.__type;static is(t){return t.__type===zn.__type}constructor(t,e){this.id=t,this.groupId=e}};l(zn,"Model"),v(zn,"__type","Model");var ma=zn;d();var $h=class $h{id;__type;constructor(t){this.id=t,this.__type="Path"}};l($h,"Path");var ya=$h;d();var ti,Jh=class Jh{constructor(t){P(this,ti,void 0);E(this,ti,t)}get center(){return c(this,ti).center}get bearing(){return c(this,ti).bearing}get pitch(){return c(this,ti).pitch}get zoomLevel(){return c(this,ti).zoomLevel}};ti=new WeakMap,l(Jh,"CameraTransform");var ga=Jh;d();var qn=class qn{id;__type=qn.__type;static is(t){return t.__type===qn.__type}constructor(t){this.id=t}};l(qn,"CustomGeometry"),v(qn,"__type","CustomGeometry");var va=qn;d();d();d();var R8=new Map([["search-16x16",`<svg viewBox="0 0 16 16">
1
+ import{h as Fc,i as b1,j as qs}from"./chunk-5QDDUDQO.js";import{a as je}from"./chunk-3A3IZSQH.js";import{A as e1,B as r1,C as i1,D as W,E as we,F as n1,G as pr,Ga as gn,H as fn,I as Te,J as Tt,Ja as zs,Ka as g1,L as Nr,M as Io,Na as v1,O as Zt,P as o1,Q as Eo,Qa as Rr,R as a1,S as s1,T as l1,U as mn,X as u1,Y as c1,Z as Ws,a as js,c as To,ca as p1,d as He,fa as Us,ga as Zs,ha as h1,ja as yi,m as Qm,n as t1,pa as d1,qa as kr,ra as Bc,sa as f1,ta as Xe,u as mi,ua as Ye,va as m1,w as it,wa as y1,x as U,ya as yn}from"./chunk-J3F43M4Z.js";import{a as l,b as N,d as Ar,e as v,f as c,g as P,h as E,i as Y,j as d,k as b}from"./chunk-N7QS5LVF.js";var _1=N(($c,Jc)=>{d();(function(r,t){typeof $c=="object"&&typeof Jc<"u"?Jc.exports=t():typeof define=="function"&&define.amd?define(t):(r=r||self).RBush=t()})($c,function(){"use strict";function r(g,C,I,T,w){l(function L(D,R,F,k,H){for(;k>F;){if(k-F>600){var X=k-F+1,$=R-F+1,ct=Math.log(X),yt=.5*Math.exp(2*ct/3),bt=.5*Math.sqrt(ct*yt*(X-yt)/X)*($-X/2<0?-1:1),Nt=Math.max(F,Math.floor(R-$*yt/X+bt)),Me=Math.min(k,Math.floor(R+(X-$)*yt/X+bt));L(D,R,Nt,Me,H)}var Ft=D[R],ht=F,xt=k;for(t(D,F,R),H(D[k],Ft)>0&&t(D,F,k);ht<xt;){for(t(D,ht,xt),ht++,xt--;H(D[ht],Ft)<0;)ht++;for(;H(D[xt],Ft)>0;)xt--}H(D[F],Ft)===0?t(D,F,xt):t(D,++xt,k),xt<=R&&(F=xt+1),R<=xt&&(k=xt-1)}},"t")(g,C,I||0,T||g.length-1,w||e)}l(r,"t");function t(g,C,I){var T=g[C];g[C]=g[I],g[I]=T}l(t,"i");function e(g,C){return g<C?-1:g>C?1:0}l(e,"n");var i=l(function(g){g===void 0&&(g=9),this._maxEntries=Math.max(4,g),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()},"r");function n(g,C,I){if(!I)return C.indexOf(g);for(var T=0;T<C.length;T++)if(I(g,C[T]))return T;return-1}l(n,"e");function o(g,C){a(g,0,g.children.length,C,g)}l(o,"a");function a(g,C,I,T,w){w||(w=S(null)),w.minX=1/0,w.minY=1/0,w.maxX=-1/0,w.maxY=-1/0;for(var L=C;L<I;L++){var D=g.children[L];u(w,g.leaf?T(D):D)}return w}l(a,"h");function u(g,C){return g.minX=Math.min(g.minX,C.minX),g.minY=Math.min(g.minY,C.minY),g.maxX=Math.max(g.maxX,C.maxX),g.maxY=Math.max(g.maxY,C.maxY),g}l(u,"o");function s(g,C){return g.minX-C.minX}l(s,"s");function p(g,C){return g.minY-C.minY}l(p,"l");function f(g){return(g.maxX-g.minX)*(g.maxY-g.minY)}l(f,"f");function m(g){return g.maxX-g.minX+(g.maxY-g.minY)}l(m,"u");function y(g,C){return g.minX<=C.minX&&g.minY<=C.minY&&C.maxX<=g.maxX&&C.maxY<=g.maxY}l(y,"m");function x(g,C){return C.minX<=g.maxX&&C.minY<=g.maxY&&C.maxX>=g.minX&&C.maxY>=g.minY}l(x,"c");function S(g){return{children:g,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}l(S,"p");function M(g,C,I,T,w){for(var L=[C,I];L.length;)if(!((I=L.pop())-(C=L.pop())<=T)){var D=C+Math.ceil((I-C)/T/2)*T;r(g,D,C,I,w),L.push(C,D,D,I)}}return l(M,"d"),i.prototype.all=function(){return this._all(this.data,[])},i.prototype.search=function(g){var C=this.data,I=[];if(!x(g,C))return I;for(var T=this.toBBox,w=[];C;){for(var L=0;L<C.children.length;L++){var D=C.children[L],R=C.leaf?T(D):D;x(g,R)&&(C.leaf?I.push(D):y(g,R)?this._all(D,I):w.push(D))}C=w.pop()}return I},i.prototype.collides=function(g){var C=this.data;if(!x(g,C))return!1;for(var I=[];C;){for(var T=0;T<C.children.length;T++){var w=C.children[T],L=C.leaf?this.toBBox(w):w;if(x(g,L)){if(C.leaf||y(g,L))return!0;I.push(w)}}C=I.pop()}return!1},i.prototype.load=function(g){if(!g||!g.length)return this;if(g.length<this._minEntries){for(var C=0;C<g.length;C++)this.insert(g[C]);return this}var I=this._build(g.slice(),0,g.length-1,0);if(this.data.children.length)if(this.data.height===I.height)this._splitRoot(this.data,I);else{if(this.data.height<I.height){var T=this.data;this.data=I,I=T}this._insert(I,this.data.height-I.height-1,!0)}else this.data=I;return this},i.prototype.insert=function(g){return g&&this._insert(g,this.data.height-1),this},i.prototype.clear=function(){return this.data=S([]),this},i.prototype.remove=function(g,C){if(!g)return this;for(var I,T,w,L=this.data,D=this.toBBox(g),R=[],F=[];L||R.length;){if(L||(L=R.pop(),T=R[R.length-1],I=F.pop(),w=!0),L.leaf){var k=n(g,L.children,C);if(k!==-1)return L.children.splice(k,1),R.push(L),this._condense(R),this}w||L.leaf||!y(L,D)?T?(I++,L=T.children[I],w=!1):L=null:(R.push(L),F.push(I),I=0,T=L,L=L.children[0])}return this},i.prototype.toBBox=function(g){return g},i.prototype.compareMinX=function(g,C){return g.minX-C.minX},i.prototype.compareMinY=function(g,C){return g.minY-C.minY},i.prototype.toJSON=function(){return this.data},i.prototype.fromJSON=function(g){return this.data=g,this},i.prototype._all=function(g,C){for(var I=[];g;)g.leaf?C.push.apply(C,g.children):I.push.apply(I,g.children),g=I.pop();return C},i.prototype._build=function(g,C,I,T){var w,L=I-C+1,D=this._maxEntries;if(L<=D)return o(w=S(g.slice(C,I+1)),this.toBBox),w;T||(T=Math.ceil(Math.log(L)/Math.log(D)),D=Math.ceil(L/Math.pow(D,T-1))),(w=S([])).leaf=!1,w.height=T;var R=Math.ceil(L/D),F=R*Math.ceil(Math.sqrt(D));M(g,C,I,F,this.compareMinX);for(var k=C;k<=I;k+=F){var H=Math.min(k+F-1,I);M(g,k,H,R,this.compareMinY);for(var X=k;X<=H;X+=R){var $=Math.min(X+R-1,H);w.children.push(this._build(g,X,$,T-1))}}return o(w,this.toBBox),w},i.prototype._chooseSubtree=function(g,C,I,T){for(;T.push(C),!C.leaf&&T.length-1!==I;){for(var w=1/0,L=1/0,D=void 0,R=0;R<C.children.length;R++){var F=C.children[R],k=f(F),H=(X=g,$=F,(Math.max($.maxX,X.maxX)-Math.min($.minX,X.minX))*(Math.max($.maxY,X.maxY)-Math.min($.minY,X.minY))-k);H<L?(L=H,w=k<w?k:w,D=F):H===L&&k<w&&(w=k,D=F)}C=D||C.children[0]}var X,$;return C},i.prototype._insert=function(g,C,I){var T=I?g:this.toBBox(g),w=[],L=this._chooseSubtree(T,this.data,C,w);for(L.children.push(g),u(L,T);C>=0&&w[C].children.length>this._maxEntries;)this._split(w,C),C--;this._adjustParentBBoxes(T,w,C)},i.prototype._split=function(g,C){var I=g[C],T=I.children.length,w=this._minEntries;this._chooseSplitAxis(I,w,T);var L=this._chooseSplitIndex(I,w,T),D=S(I.children.splice(L,I.children.length-L));D.height=I.height,D.leaf=I.leaf,o(I,this.toBBox),o(D,this.toBBox),C?g[C-1].children.push(D):this._splitRoot(I,D)},i.prototype._splitRoot=function(g,C){this.data=S([g,C]),this.data.height=g.height+1,this.data.leaf=!1,o(this.data,this.toBBox)},i.prototype._chooseSplitIndex=function(g,C,I){for(var T,w,L,D,R,F,k,H=1/0,X=1/0,$=C;$<=I-C;$++){var ct=a(g,0,$,this.toBBox),yt=a(g,$,I,this.toBBox),bt=(w=ct,L=yt,D=void 0,R=void 0,F=void 0,k=void 0,D=Math.max(w.minX,L.minX),R=Math.max(w.minY,L.minY),F=Math.min(w.maxX,L.maxX),k=Math.min(w.maxY,L.maxY),Math.max(0,F-D)*Math.max(0,k-R)),Nt=f(ct)+f(yt);bt<H?(H=bt,T=$,X=Nt<X?Nt:X):bt===H&&Nt<X&&(X=Nt,T=$)}return T||I-C},i.prototype._chooseSplitAxis=function(g,C,I){var T=g.leaf?this.compareMinX:s,w=g.leaf?this.compareMinY:p;this._allDistMargin(g,C,I,T)<this._allDistMargin(g,C,I,w)&&g.children.sort(T)},i.prototype._allDistMargin=function(g,C,I,T){g.children.sort(T);for(var w=this.toBBox,L=a(g,0,C,w),D=a(g,I-C,I,w),R=m(L)+m(D),F=C;F<I-C;F++){var k=g.children[F];u(L,g.leaf?w(k):k),R+=m(L)}for(var H=I-C-1;H>=C;H--){var X=g.children[H];u(D,g.leaf?w(X):X),R+=m(D)}return R},i.prototype._adjustParentBBoxes=function(g,C,I){for(var T=I;T>=0;T--)u(C[T],g)},i.prototype._condense=function(g){for(var C=g.length-1,I=void 0;C>=0;C--)g[C].children.length===0?C>0?(I=g[C-1].children).splice(I.indexOf(g[C]),1):this.clear():o(g[C],this.toBBox)},i})});var rp=N(j=>{"use strict";d();Object.defineProperty(j,"__esModule",{value:!0});j.earthRadius=63710088e-1;j.factors={centimeters:j.earthRadius*100,centimetres:j.earthRadius*100,degrees:j.earthRadius/111325,feet:j.earthRadius*3.28084,inches:j.earthRadius*39.37,kilometers:j.earthRadius/1e3,kilometres:j.earthRadius/1e3,meters:j.earthRadius,metres:j.earthRadius,miles:j.earthRadius/1609.344,millimeters:j.earthRadius*1e3,millimetres:j.earthRadius*1e3,nauticalmiles:j.earthRadius/1852,radians:1,yards:j.earthRadius*1.0936};j.unitsFactors={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:1/1e3,kilometres:1/1e3,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/j.earthRadius,yards:1.0936133};j.areaFactors={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,millimeters:1e6,millimetres:1e6,yards:1.195990046};function Gr(r,t,e){e===void 0&&(e={});var i={type:"Feature"};return(e.id===0||e.id)&&(i.id=e.id),e.bbox&&(i.bbox=e.bbox),i.properties=t||{},i.geometry=r,i}l(Gr,"feature");j.feature=Gr;function f5(r,t,e){switch(e===void 0&&(e={}),r){case"Point":return Kc(t).geometry;case"LineString":return tp(t).geometry;case"Polygon":return Qc(t).geometry;case"MultiPoint":return O1(t).geometry;case"MultiLineString":return D1(t).geometry;case"MultiPolygon":return A1(t).geometry;default:throw new Error(r+" is invalid")}}l(f5,"geometry");j.geometry=f5;function Kc(r,t,e){if(e===void 0&&(e={}),!r)throw new Error("coordinates is required");if(!Array.isArray(r))throw new Error("coordinates must be an Array");if(r.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!rl(r[0])||!rl(r[1]))throw new Error("coordinates must contain numbers");var i={type:"Point",coordinates:r};return Gr(i,t,e)}l(Kc,"point");j.point=Kc;function m5(r,t,e){return e===void 0&&(e={}),il(r.map(function(i){return Kc(i,t)}),e)}l(m5,"points");j.points=m5;function Qc(r,t,e){e===void 0&&(e={});for(var i=0,n=r;i<n.length;i++){var o=n[i];if(o.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var a=0;a<o[o.length-1].length;a++)if(o[o.length-1][a]!==o[0][a])throw new Error("First and last Position are not equivalent.")}var u={type:"Polygon",coordinates:r};return Gr(u,t,e)}l(Qc,"polygon");j.polygon=Qc;function y5(r,t,e){return e===void 0&&(e={}),il(r.map(function(i){return Qc(i,t)}),e)}l(y5,"polygons");j.polygons=y5;function tp(r,t,e){if(e===void 0&&(e={}),r.length<2)throw new Error("coordinates must be an array of two or more positions");var i={type:"LineString",coordinates:r};return Gr(i,t,e)}l(tp,"lineString");j.lineString=tp;function g5(r,t,e){return e===void 0&&(e={}),il(r.map(function(i){return tp(i,t)}),e)}l(g5,"lineStrings");j.lineStrings=g5;function il(r,t){t===void 0&&(t={});var e={type:"FeatureCollection"};return t.id&&(e.id=t.id),t.bbox&&(e.bbox=t.bbox),e.features=r,e}l(il,"featureCollection");j.featureCollection=il;function D1(r,t,e){e===void 0&&(e={});var i={type:"MultiLineString",coordinates:r};return Gr(i,t,e)}l(D1,"multiLineString");j.multiLineString=D1;function O1(r,t,e){e===void 0&&(e={});var i={type:"MultiPoint",coordinates:r};return Gr(i,t,e)}l(O1,"multiPoint");j.multiPoint=O1;function A1(r,t,e){e===void 0&&(e={});var i={type:"MultiPolygon",coordinates:r};return Gr(i,t,e)}l(A1,"multiPolygon");j.multiPolygon=A1;function v5(r,t,e){e===void 0&&(e={});var i={type:"GeometryCollection",geometries:r};return Gr(i,t,e)}l(v5,"geometryCollection");j.geometryCollection=v5;function b5(r,t){if(t===void 0&&(t=0),t&&!(t>=0))throw new Error("precision must be a positive number");var e=Math.pow(10,t||0);return Math.round(r*e)/e}l(b5,"round");j.round=b5;function N1(r,t){t===void 0&&(t="kilometers");var e=j.factors[t];if(!e)throw new Error(t+" units is invalid");return r*e}l(N1,"radiansToLength");j.radiansToLength=N1;function ep(r,t){t===void 0&&(t="kilometers");var e=j.factors[t];if(!e)throw new Error(t+" units is invalid");return r/e}l(ep,"lengthToRadians");j.lengthToRadians=ep;function C5(r,t){return k1(ep(r,t))}l(C5,"lengthToDegrees");j.lengthToDegrees=C5;function x5(r){var t=r%360;return t<0&&(t+=360),t}l(x5,"bearingToAzimuth");j.bearingToAzimuth=x5;function k1(r){var t=r%(2*Math.PI);return t*180/Math.PI}l(k1,"radiansToDegrees");j.radiansToDegrees=k1;function S5(r){var t=r%360;return t*Math.PI/180}l(S5,"degreesToRadians");j.degreesToRadians=S5;function M5(r,t,e){if(t===void 0&&(t="kilometers"),e===void 0&&(e="kilometers"),!(r>=0))throw new Error("length must be a positive number");return N1(ep(r,t),e)}l(M5,"convertLength");j.convertLength=M5;function P5(r,t,e){if(t===void 0&&(t="meters"),e===void 0&&(e="kilometers"),!(r>=0))throw new Error("area must be a positive number");var i=j.areaFactors[t];if(!i)throw new Error("invalid original units");var n=j.areaFactors[e];if(!n)throw new Error("invalid final units");return r/i*n}l(P5,"convertArea");j.convertArea=P5;function rl(r){return!isNaN(r)&&r!==null&&!Array.isArray(r)}l(rl,"isNumber");j.isNumber=rl;function w5(r){return!!r&&r.constructor===Object}l(w5,"isObject");j.isObject=w5;function T5(r){if(!r)throw new Error("bbox is required");if(!Array.isArray(r))throw new Error("bbox must be an Array");if(r.length!==4&&r.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");r.forEach(function(t){if(!rl(t))throw new Error("bbox must only contain numbers")})}l(T5,"validateBBox");j.validateBBox=T5;function I5(r){if(!r)throw new Error("id is required");if(["string","number"].indexOf(typeof r)===-1)throw new Error("id must be a number or a string")}l(I5,"validateId");j.validateId=I5});var V1=N(It=>{"use strict";d();Object.defineProperty(It,"__esModule",{value:!0});var Ht=rp();function Oo(r,t,e){if(r!==null)for(var i,n,o,a,u,s,p,f=0,m=0,y,x=r.type,S=x==="FeatureCollection",M=x==="Feature",g=S?r.features.length:1,C=0;C<g;C++){p=S?r.features[C].geometry:M?r.geometry:r,y=p?p.type==="GeometryCollection":!1,u=y?p.geometries.length:1;for(var I=0;I<u;I++){var T=0,w=0;if(a=y?p.geometries[I]:p,a!==null){s=a.coordinates;var L=a.type;switch(f=e&&(L==="Polygon"||L==="MultiPolygon")?1:0,L){case null:break;case"Point":if(t(s,m,C,T,w)===!1)return!1;m++,T++;break;case"LineString":case"MultiPoint":for(i=0;i<s.length;i++){if(t(s[i],m,C,T,w)===!1)return!1;m++,L==="MultiPoint"&&T++}L==="LineString"&&T++;break;case"Polygon":case"MultiLineString":for(i=0;i<s.length;i++){for(n=0;n<s[i].length-f;n++){if(t(s[i][n],m,C,T,w)===!1)return!1;m++}L==="MultiLineString"&&T++,L==="Polygon"&&w++}L==="Polygon"&&T++;break;case"MultiPolygon":for(i=0;i<s.length;i++){for(w=0,n=0;n<s[i].length;n++){for(o=0;o<s[i][n].length-f;o++){if(t(s[i][n][o],m,C,T,w)===!1)return!1;m++}w++}T++}break;case"GeometryCollection":for(i=0;i<a.geometries.length;i++)if(Oo(a.geometries[i],t,e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}l(Oo,"coordEach");function E5(r,t,e,i){var n=e;return Oo(r,function(o,a,u,s,p){a===0&&e===void 0?n=o:n=t(n,o,a,u,s,p)},i),n}l(E5,"coordReduce");function R1(r,t){var e;switch(r.type){case"FeatureCollection":for(e=0;e<r.features.length&&t(r.features[e].properties,e)!==!1;e++);break;case"Feature":t(r.properties,0);break}}l(R1,"propEach");function L5(r,t,e){var i=e;return R1(r,function(n,o){o===0&&e===void 0?i=n:i=t(i,n,o)}),i}l(L5,"propReduce");function B1(r,t){if(r.type==="Feature")t(r,0);else if(r.type==="FeatureCollection")for(var e=0;e<r.features.length&&t(r.features[e],e)!==!1;e++);}l(B1,"featureEach");function _5(r,t,e){var i=e;return B1(r,function(n,o){o===0&&e===void 0?i=n:i=t(i,n,o)}),i}l(_5,"featureReduce");function D5(r){var t=[];return Oo(r,function(e){t.push(e)}),t}l(D5,"coordAll");function ip(r,t){var e,i,n,o,a,u,s,p,f,m,y=0,x=r.type==="FeatureCollection",S=r.type==="Feature",M=x?r.features.length:1;for(e=0;e<M;e++){for(u=x?r.features[e].geometry:S?r.geometry:r,p=x?r.features[e].properties:S?r.properties:{},f=x?r.features[e].bbox:S?r.bbox:void 0,m=x?r.features[e].id:S?r.id:void 0,s=u?u.type==="GeometryCollection":!1,a=s?u.geometries.length:1,n=0;n<a;n++){if(o=s?u.geometries[n]:u,o===null){if(t(null,y,p,f,m)===!1)return!1;continue}switch(o.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(t(o,y,p,f,m)===!1)return!1;break}case"GeometryCollection":{for(i=0;i<o.geometries.length;i++)if(t(o.geometries[i],y,p,f,m)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}y++}}l(ip,"geomEach");function O5(r,t,e){var i=e;return ip(r,function(n,o,a,u,s){o===0&&e===void 0?i=n:i=t(i,n,o,a,u,s)}),i}l(O5,"geomReduce");function nl(r,t){ip(r,function(e,i,n,o,a){var u=e===null?null:e.type;switch(u){case null:case"Point":case"LineString":case"Polygon":return t(Ht.feature(e,n,{bbox:o,id:a}),i,0)===!1?!1:void 0}var s;switch(u){case"MultiPoint":s="Point";break;case"MultiLineString":s="LineString";break;case"MultiPolygon":s="Polygon";break}for(var p=0;p<e.coordinates.length;p++){var f=e.coordinates[p],m={type:s,coordinates:f};if(t(Ht.feature(m,n),i,p)===!1)return!1}})}l(nl,"flattenEach");function A5(r,t,e){var i=e;return nl(r,function(n,o,a){o===0&&a===0&&e===void 0?i=n:i=t(i,n,o,a)}),i}l(A5,"flattenReduce");function F1(r,t){nl(r,function(e,i,n){var o=0;if(e.geometry){var a=e.geometry.type;if(!(a==="Point"||a==="MultiPoint")){var u,s=0,p=0,f=0;if(Oo(e,function(m,y,x,S,M){if(u===void 0||i>s||S>p||M>f){u=m,s=i,p=S,f=M,o=0;return}var g=Ht.lineString([u,m],e.properties);if(t(g,i,n,M,o)===!1)return!1;o++,u=m})===!1)return!1}}})}l(F1,"segmentEach");function N5(r,t,e){var i=e,n=!1;return F1(r,function(o,a,u,s,p){n===!1&&e===void 0?i=o:i=t(i,o,a,u,s,p),n=!0}),i}l(N5,"segmentReduce");function G1(r,t){if(!r)throw new Error("geojson is required");nl(r,function(e,i,n){if(e.geometry!==null){var o=e.geometry.type,a=e.geometry.coordinates;switch(o){case"LineString":if(t(e,i,n,0,0)===!1)return!1;break;case"Polygon":for(var u=0;u<a.length;u++)if(t(Ht.lineString(a[u],e.properties),i,n,u)===!1)return!1;break}}})}l(G1,"lineEach");function k5(r,t,e){var i=e;return G1(r,function(n,o,a,u){o===0&&e===void 0?i=n:i=t(i,n,o,a,u)}),i}l(k5,"lineReduce");function R5(r,t){if(t=t||{},!Ht.isObject(t))throw new Error("options is invalid");var e=t.featureIndex||0,i=t.multiFeatureIndex||0,n=t.geometryIndex||0,o=t.segmentIndex||0,a=t.properties,u;switch(r.type){case"FeatureCollection":e<0&&(e=r.features.length+e),a=a||r.features[e].properties,u=r.features[e].geometry;break;case"Feature":a=a||r.properties,u=r.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":u=r;break;default:throw new Error("geojson is invalid")}if(u===null)return null;var s=u.coordinates;switch(u.type){case"Point":case"MultiPoint":return null;case"LineString":return o<0&&(o=s.length+o-1),Ht.lineString([s[o],s[o+1]],a,t);case"Polygon":return n<0&&(n=s.length+n),o<0&&(o=s[n].length+o-1),Ht.lineString([s[n][o],s[n][o+1]],a,t);case"MultiLineString":return i<0&&(i=s.length+i),o<0&&(o=s[i].length+o-1),Ht.lineString([s[i][o],s[i][o+1]],a,t);case"MultiPolygon":return i<0&&(i=s.length+i),n<0&&(n=s[i].length+n),o<0&&(o=s[i][n].length-o-1),Ht.lineString([s[i][n][o],s[i][n][o+1]],a,t)}throw new Error("geojson is invalid")}l(R5,"findSegment");function B5(r,t){if(t=t||{},!Ht.isObject(t))throw new Error("options is invalid");var e=t.featureIndex||0,i=t.multiFeatureIndex||0,n=t.geometryIndex||0,o=t.coordIndex||0,a=t.properties,u;switch(r.type){case"FeatureCollection":e<0&&(e=r.features.length+e),a=a||r.features[e].properties,u=r.features[e].geometry;break;case"Feature":a=a||r.properties,u=r.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":u=r;break;default:throw new Error("geojson is invalid")}if(u===null)return null;var s=u.coordinates;switch(u.type){case"Point":return Ht.point(s,a,t);case"MultiPoint":return i<0&&(i=s.length+i),Ht.point(s[i],a,t);case"LineString":return o<0&&(o=s.length+o),Ht.point(s[o],a,t);case"Polygon":return n<0&&(n=s.length+n),o<0&&(o=s[n].length+o),Ht.point(s[n][o],a,t);case"MultiLineString":return i<0&&(i=s.length+i),o<0&&(o=s[i].length+o),Ht.point(s[i][o],a,t);case"MultiPolygon":return i<0&&(i=s.length+i),n<0&&(n=s[i].length+n),o<0&&(o=s[i][n].length-o),Ht.point(s[i][n][o],a,t)}throw new Error("geojson is invalid")}l(B5,"findPoint");It.coordAll=D5;It.coordEach=Oo;It.coordReduce=E5;It.featureEach=B1;It.featureReduce=_5;It.findPoint=B5;It.findSegment=R5;It.flattenEach=nl;It.flattenReduce=A5;It.geomEach=ip;It.geomReduce=O5;It.lineEach=G1;It.lineReduce=k5;It.propEach=R1;It.propReduce=L5;It.segmentEach=F1;It.segmentReduce=N5});var np=N((QT,X1)=>{"use strict";d();var H1=Object.prototype.toString;X1.exports=l(function(t){var e=H1.call(t),i=e==="[object Arguments]";return i||(i=e!=="[object Array]"&&t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&H1.call(t.callee)==="[object Function]"),i},"isArguments")});var J1=N((rI,$1)=>{"use strict";d();var q1;Object.keys||(Ao=Object.prototype.hasOwnProperty,op=Object.prototype.toString,Y1=np(),ap=Object.prototype.propertyIsEnumerable,j1=!ap.call({toString:null},"toString"),W1=ap.call(function(){},"prototype"),No=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],ol=l(function(r){var t=r.constructor;return t&&t.prototype===r},"equalsConstructorPrototype"),U1={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},Z1=function(){if(typeof window>"u")return!1;for(var r in window)try{if(!U1["$"+r]&&Ao.call(window,r)&&window[r]!==null&&typeof window[r]=="object")try{ol(window[r])}catch{return!0}}catch{return!0}return!1}(),z1=l(function(r){if(typeof window>"u"||!Z1)return ol(r);try{return ol(r)}catch{return!1}},"equalsConstructorPrototypeIfNotBuggy"),q1=l(function(t){var e=t!==null&&typeof t=="object",i=op.call(t)==="[object Function]",n=Y1(t),o=e&&op.call(t)==="[object String]",a=[];if(!e&&!i&&!n)throw new TypeError("Object.keys called on a non-object");var u=W1&&i;if(o&&t.length>0&&!Ao.call(t,0))for(var s=0;s<t.length;++s)a.push(String(s));if(n&&t.length>0)for(var p=0;p<t.length;++p)a.push(String(p));else for(var f in t)!(u&&f==="prototype")&&Ao.call(t,f)&&a.push(String(f));if(j1)for(var m=z1(t),y=0;y<No.length;++y)!(m&&No[y]==="constructor")&&Ao.call(t,No[y])&&a.push(No[y]);return a},"keys"));var Ao,op,Y1,ap,j1,W1,No,ol,U1,Z1,z1;$1.exports=q1});var sl=N((oI,ty)=>{"use strict";d();var F5=Array.prototype.slice,G5=np(),K1=Object.keys,al=K1?l(function(t){return K1(t)},"keys"):J1(),Q1=Object.keys;al.shim=l(function(){if(Object.keys){var t=function(){var e=Object.keys(arguments);return e&&e.length===arguments.length}(1,2);t||(Object.keys=l(function(i){return G5(i)?Q1(F5.call(i)):Q1(i)},"keys"))}else Object.keys=al;return Object.keys||al},"shimObjectKeys");ty.exports=al});var ry=N((lI,ey)=>{"use strict";d();ey.exports=Error});var ny=N((cI,iy)=>{"use strict";d();iy.exports=EvalError});var ay=N((hI,oy)=>{"use strict";d();oy.exports=RangeError});var ly=N((fI,sy)=>{"use strict";d();sy.exports=ReferenceError});var sp=N((yI,uy)=>{"use strict";d();uy.exports=SyntaxError});var dr=N((vI,cy)=>{"use strict";d();cy.exports=TypeError});var hy=N((CI,py)=>{"use strict";d();py.exports=URIError});var ko=N((SI,dy)=>{"use strict";d();dy.exports=l(function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},e=Symbol("test"),i=Object(e);if(typeof e=="string"||Object.prototype.toString.call(e)!=="[object Symbol]"||Object.prototype.toString.call(i)!=="[object Symbol]")return!1;var n=42;t[e]=n;for(e in t)return!1;if(typeof Object.keys=="function"&&Object.keys(t).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var o=Object.getOwnPropertySymbols(t);if(o.length!==1||o[0]!==e||!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var a=Object.getOwnPropertyDescriptor(t,e);if(a.value!==n||a.enumerable!==!0)return!1}return!0},"hasSymbols")});var ll=N((wI,my)=>{"use strict";d();var fy=typeof Symbol<"u"&&Symbol,V5=ko();my.exports=l(function(){return typeof fy!="function"||typeof Symbol!="function"||typeof fy("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:V5()},"hasNativeSymbols")});var gy=N((EI,yy)=>{"use strict";d();var lp={__proto__:null,foo:{}},H5=Object;yy.exports=l(function(){return{__proto__:lp}.foo===lp.foo&&!(lp instanceof H5)},"hasProto")});var Cy=N((DI,by)=>{"use strict";d();var X5="Function.prototype.bind called on incompatible ",Y5=Object.prototype.toString,j5=Math.max,W5="[object Function]",vy=l(function(t,e){for(var i=[],n=0;n<t.length;n+=1)i[n]=t[n];for(var o=0;o<e.length;o+=1)i[o+t.length]=e[o];return i},"concatty"),U5=l(function(t,e){for(var i=[],n=e||0,o=0;n<t.length;n+=1,o+=1)i[o]=t[n];return i},"slicy"),Z5=l(function(r,t){for(var e="",i=0;i<r.length;i+=1)e+=r[i],i+1<r.length&&(e+=t);return e},"joiny");by.exports=l(function(t){var e=this;if(typeof e!="function"||Y5.apply(e)!==W5)throw new TypeError(X5+e);for(var i=U5(arguments,1),n,o=l(function(){if(this instanceof n){var f=e.apply(this,vy(i,arguments));return Object(f)===f?f:this}return e.apply(t,vy(i,arguments))},"binder"),a=j5(0,e.length-i.length),u=[],s=0;s<a;s++)u[s]="$"+s;if(n=Function("binder","return function ("+Z5(u,",")+"){ return binder.apply(this,arguments); }")(o),e.prototype){var p=l(function(){},"Empty");p.prototype=e.prototype,n.prototype=new p,p.prototype=null}return n},"bind")});var ul=N((NI,xy)=>{"use strict";d();var z5=Cy();xy.exports=Function.prototype.bind||z5});var up=N((RI,Sy)=>{"use strict";d();var q5=Function.prototype.call,$5=Object.prototype.hasOwnProperty,J5=ul();Sy.exports=J5.call(q5,$5)});var Ee=N((FI,Iy)=>{"use strict";d();var q,K5=ry(),Q5=ny(),t7=ay(),e7=ly(),xn=sp(),Cn=dr(),r7=hy(),Ty=Function,cp=l(function(r){try{return Ty('"use strict"; return ('+r+").constructor;")()}catch{}},"getEvalledConstructor"),vi=Object.getOwnPropertyDescriptor;if(vi)try{vi({},"")}catch{vi=null}var pp=l(function(){throw new Cn},"throwTypeError"),i7=vi?function(){try{return arguments.callee,pp}catch{try{return vi(arguments,"callee").get}catch{return pp}}}():pp,vn=ll()(),n7=gy()(),At=Object.getPrototypeOf||(n7?function(r){return r.__proto__}:null),bn={},o7=typeof Uint8Array>"u"||!At?q:At(Uint8Array),bi={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?q:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?q:ArrayBuffer,"%ArrayIteratorPrototype%":vn&&At?At([][Symbol.iterator]()):q,"%AsyncFromSyncIteratorPrototype%":q,"%AsyncFunction%":bn,"%AsyncGenerator%":bn,"%AsyncGeneratorFunction%":bn,"%AsyncIteratorPrototype%":bn,"%Atomics%":typeof Atomics>"u"?q:Atomics,"%BigInt%":typeof BigInt>"u"?q:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?q:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?q:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?q:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":K5,"%eval%":eval,"%EvalError%":Q5,"%Float32Array%":typeof Float32Array>"u"?q:Float32Array,"%Float64Array%":typeof Float64Array>"u"?q:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?q:FinalizationRegistry,"%Function%":Ty,"%GeneratorFunction%":bn,"%Int8Array%":typeof Int8Array>"u"?q:Int8Array,"%Int16Array%":typeof Int16Array>"u"?q:Int16Array,"%Int32Array%":typeof Int32Array>"u"?q:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":vn&&At?At(At([][Symbol.iterator]())):q,"%JSON%":typeof JSON=="object"?JSON:q,"%Map%":typeof Map>"u"?q:Map,"%MapIteratorPrototype%":typeof Map>"u"||!vn||!At?q:At(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?q:Promise,"%Proxy%":typeof Proxy>"u"?q:Proxy,"%RangeError%":t7,"%ReferenceError%":e7,"%Reflect%":typeof Reflect>"u"?q:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?q:Set,"%SetIteratorPrototype%":typeof Set>"u"||!vn||!At?q:At(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?q:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":vn&&At?At(""[Symbol.iterator]()):q,"%Symbol%":vn?Symbol:q,"%SyntaxError%":xn,"%ThrowTypeError%":i7,"%TypedArray%":o7,"%TypeError%":Cn,"%Uint8Array%":typeof Uint8Array>"u"?q:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?q:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?q:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?q:Uint32Array,"%URIError%":r7,"%WeakMap%":typeof WeakMap>"u"?q:WeakMap,"%WeakRef%":typeof WeakRef>"u"?q:WeakRef,"%WeakSet%":typeof WeakSet>"u"?q:WeakSet};if(At)try{null.error}catch(r){My=At(At(r)),bi["%Error.prototype%"]=My}var My,a7=l(function r(t){var e;if(t==="%AsyncFunction%")e=cp("async function () {}");else if(t==="%GeneratorFunction%")e=cp("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=cp("async function* () {}");else if(t==="%AsyncGenerator%"){var i=r("%AsyncGeneratorFunction%");i&&(e=i.prototype)}else if(t==="%AsyncIteratorPrototype%"){var n=r("%AsyncGenerator%");n&&At&&(e=At(n.prototype))}return bi[t]=e,e},"doEval"),Py={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},Ro=ul(),cl=up(),s7=Ro.call(Function.call,Array.prototype.concat),l7=Ro.call(Function.apply,Array.prototype.splice),wy=Ro.call(Function.call,String.prototype.replace),pl=Ro.call(Function.call,String.prototype.slice),u7=Ro.call(Function.call,RegExp.prototype.exec),c7=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,p7=/\\(\\)?/g,h7=l(function(t){var e=pl(t,0,1),i=pl(t,-1);if(e==="%"&&i!=="%")throw new xn("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&e!=="%")throw new xn("invalid intrinsic syntax, expected opening `%`");var n=[];return wy(t,c7,function(o,a,u,s){n[n.length]=u?wy(s,p7,"$1"):a||o}),n},"stringToPath"),d7=l(function(t,e){var i=t,n;if(cl(Py,i)&&(n=Py[i],i="%"+n[0]+"%"),cl(bi,i)){var o=bi[i];if(o===bn&&(o=a7(i)),typeof o>"u"&&!e)throw new Cn("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:n,name:i,value:o}}throw new xn("intrinsic "+t+" does not exist!")},"getBaseIntrinsic");Iy.exports=l(function(t,e){if(typeof t!="string"||t.length===0)throw new Cn("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new Cn('"allowMissing" argument must be a boolean');if(u7(/^%?[^%]*%?$/,t)===null)throw new xn("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=h7(t),n=i.length>0?i[0]:"",o=d7("%"+n+"%",e),a=o.name,u=o.value,s=!1,p=o.alias;p&&(n=p[0],l7(i,s7([0,1],p)));for(var f=1,m=!0;f<i.length;f+=1){var y=i[f],x=pl(y,0,1),S=pl(y,-1);if((x==='"'||x==="'"||x==="`"||S==='"'||S==="'"||S==="`")&&x!==S)throw new xn("property names with quotes must have matching quotes");if((y==="constructor"||!m)&&(s=!0),n+="."+y,a="%"+n+"%",cl(bi,a))u=bi[a];else if(u!=null){if(!(y in u)){if(!e)throw new Cn("base intrinsic for "+t+" exists, but the property is not available.");return}if(vi&&f+1>=i.length){var M=vi(u,y);m=!!M,m&&"get"in M&&!("originalValue"in M.get)?u=M.get:u=u[y]}else m=cl(u,y),u=u[y];m&&!s&&(bi[a]=u)}}return u},"GetIntrinsic")});var dl=N((HI,Ey)=>{"use strict";d();var f7=Ee(),hl=f7("%Object.defineProperty%",!0)||!1;if(hl)try{hl({},"a",{value:1})}catch{hl=!1}Ey.exports=hl});var ml=N((YI,Ly)=>{"use strict";d();var m7=Ee(),fl=m7("%Object.getOwnPropertyDescriptor%",!0);if(fl)try{fl([],"length")}catch{fl=null}Ly.exports=fl});var yl=N((WI,Oy)=>{"use strict";d();var _y=dl(),y7=sp(),Sn=dr(),Dy=ml();Oy.exports=l(function(t,e,i){if(!t||typeof t!="object"&&typeof t!="function")throw new Sn("`obj` must be an object or a function`");if(typeof e!="string"&&typeof e!="symbol")throw new Sn("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new Sn("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new Sn("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new Sn("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new Sn("`loose`, if provided, must be a boolean");var n=arguments.length>3?arguments[3]:null,o=arguments.length>4?arguments[4]:null,a=arguments.length>5?arguments[5]:null,u=arguments.length>6?arguments[6]:!1,s=!!Dy&&Dy(t,e);if(_y)_y(t,e,{configurable:a===null&&s?s.configurable:!a,enumerable:n===null&&s?s.enumerable:!n,value:i,writable:o===null&&s?s.writable:!o});else if(u||!n&&!o&&!a)t[e]=i;else throw new y7("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},"defineDataProperty")});var gl=N((zI,Ny)=>{"use strict";d();var hp=dl(),Ay=l(function(){return!!hp},"hasPropertyDescriptors");Ay.hasArrayLengthDefineBug=l(function(){if(!hp)return null;try{return hp([],"length",{value:1}).length!==1}catch{return!0}},"hasArrayLengthDefineBug");Ny.exports=Ay});var Vr=N((JI,Fy)=>{"use strict";d();var g7=sl(),v7=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",b7=Object.prototype.toString,C7=Array.prototype.concat,ky=yl(),x7=l(function(r){return typeof r=="function"&&b7.call(r)==="[object Function]"},"isFunction"),Ry=gl()(),S7=l(function(r,t,e,i){if(t in r){if(i===!0){if(r[t]===e)return}else if(!x7(i)||!i())return}Ry?ky(r,t,e,!0):ky(r,t,e)},"defineProperty"),By=l(function(r,t){var e=arguments.length>2?arguments[2]:{},i=g7(t);v7&&(i=C7.call(i,Object.getOwnPropertySymbols(t)));for(var n=0;n<i.length;n+=1)S7(r,i[n],t[i[n]],e[i[n]])},"defineProperties");By.supportsDescriptors=!!Ry;Fy.exports=By});var Yy=N((tE,Xy)=>{"use strict";d();var M7=Ee(),Gy=yl(),P7=gl()(),Vy=ml(),Hy=dr(),w7=M7("%Math.floor%");Xy.exports=l(function(t,e){if(typeof t!="function")throw new Hy("`fn` is not a function");if(typeof e!="number"||e<0||e>4294967295||w7(e)!==e)throw new Hy("`length` must be a positive 32-bit integer");var i=arguments.length>2&&!!arguments[2],n=!0,o=!0;if("length"in t&&Vy){var a=Vy(t,"length");a&&!a.configurable&&(n=!1),a&&!a.writable&&(o=!1)}return(n||o||!i)&&(P7?Gy(t,"length",e,!0,!0):Gy(t,"length",e)),t},"setFunctionLength")});var Ci=N((iE,vl)=>{"use strict";d();var dp=ul(),bl=Ee(),T7=Yy(),I7=dr(),Uy=bl("%Function.prototype.apply%"),Zy=bl("%Function.prototype.call%"),zy=bl("%Reflect.apply%",!0)||dp.call(Zy,Uy),jy=dl(),E7=bl("%Math.max%");vl.exports=l(function(t){if(typeof t!="function")throw new I7("a function is required");var e=zy(dp,Zy,arguments);return T7(e,1+E7(0,t.length-(arguments.length-1)),!0)},"callBind");var Wy=l(function(){return zy(dp,Uy,arguments)},"applyBind");jy?jy(vl.exports,"apply",{value:Wy}):vl.exports.apply=Wy});var ce=N((aE,Jy)=>{"use strict";d();var qy=Ee(),$y=Ci(),L7=$y(qy("String.prototype.indexOf"));Jy.exports=l(function(t,e){var i=qy(t,!!e);return typeof i=="function"&&L7(t,".prototype.")>-1?$y(i):i},"callBoundIntrinsic")});var fp=N((uE,r0)=>{"use strict";d();var _7=sl(),t0=ko()(),e0=ce(),Ky=Object,D7=e0("Array.prototype.push"),Qy=e0("Object.prototype.propertyIsEnumerable"),O7=t0?Object.getOwnPropertySymbols:null;r0.exports=l(function(t,e){if(t==null)throw new TypeError("target must be an object");var i=Ky(t);if(arguments.length===1)return i;for(var n=1;n<arguments.length;++n){var o=Ky(arguments[n]),a=_7(o),u=t0&&(Object.getOwnPropertySymbols||O7);if(u)for(var s=u(o),p=0;p<s.length;++p){var f=s[p];Qy(o,f)&&D7(a,f)}for(var m=0;m<a.length;++m){var y=a[m];if(Qy(o,y)){var x=o[y];i[y]=x}}}return i},"assign")});var yp=N((hE,i0)=>{"use strict";d();var mp=fp(),A7=l(function(){if(!Object.assign)return!1;for(var r="abcdefghijklmnopqrst",t=r.split(""),e={},i=0;i<t.length;++i)e[t[i]]=t[i];var n=Object.assign({},e),o="";for(var a in n)o+=a;return r!==o},"lacksProperEnumerationOrder"),N7=l(function(){if(!Object.assign||!Object.preventExtensions)return!1;var r=Object.preventExtensions({1:2});try{Object.assign(r,"xy")}catch{return r[1]==="y"}return!1},"assignHasPendingExceptions");i0.exports=l(function(){return!Object.assign||A7()||N7()?mp:Object.assign},"getPolyfill")});var o0=N((mE,n0)=>{"use strict";d();var k7=Vr(),R7=yp();n0.exports=l(function(){var t=R7();return k7(Object,{assign:t},{assign:function(){return Object.assign!==t}}),t},"shimAssign")});var u0=N((vE,l0)=>{"use strict";d();var B7=Vr(),F7=Ci(),G7=fp(),a0=yp(),V7=o0(),H7=F7.apply(a0()),s0=l(function(t,e){return H7(Object,arguments)},"assign");B7(s0,{getPolyfill:a0,implementation:G7,shim:V7});l0.exports=s0});var p0=N((xE,c0)=>{"use strict";d();var Fo=l(function(){return typeof l(function(){},"f").name=="string"},"functionsHaveNames"),Bo=Object.getOwnPropertyDescriptor;if(Bo)try{Bo([],"length")}catch{Bo=null}Fo.functionsHaveConfigurableNames=l(function(){if(!Fo()||!Bo)return!1;var t=Bo(function(){},"name");return!!t&&!!t.configurable},"functionsHaveConfigurableNames");var X7=Function.prototype.bind;Fo.boundFunctionsHaveNames=l(function(){return Fo()&&typeof X7=="function"&&l(function(){},"f").bind().name!==""},"boundFunctionsHaveNames");c0.exports=Fo});var f0=N((PE,d0)=>{"use strict";d();var h0=yl(),Y7=gl()(),j7=p0().functionsHaveConfigurableNames(),W7=dr();d0.exports=l(function(t,e){if(typeof t!="function")throw new W7("`fn` is not a function");var i=arguments.length>2&&!!arguments[2];return(!i||j7)&&(Y7?h0(t,"name",e,!0,!0):h0(t,"name",e)),t},"setFunctionName")});var gp=N((IE,m0)=>{"use strict";d();var U7=f0(),Z7=dr(),z7=Object;m0.exports=U7(l(function(){if(this==null||this!==z7(this))throw new Z7("RegExp.prototype.flags getter called on non-object");var t="";return this.hasIndices&&(t+="d"),this.global&&(t+="g"),this.ignoreCase&&(t+="i"),this.multiline&&(t+="m"),this.dotAll&&(t+="s"),this.unicode&&(t+="u"),this.unicodeSets&&(t+="v"),this.sticky&&(t+="y"),t},"flags"),"get flags",!0)});var vp=N((_E,y0)=>{"use strict";d();var q7=gp(),$7=Vr().supportsDescriptors,J7=Object.getOwnPropertyDescriptor;y0.exports=l(function(){if($7&&/a/mig.flags==="gim"){var t=J7(RegExp.prototype,"flags");if(t&&typeof t.get=="function"&&typeof RegExp.prototype.dotAll=="boolean"&&typeof RegExp.prototype.hasIndices=="boolean"){var e="",i={};if(Object.defineProperty(i,"hasIndices",{get:function(){e+="d"}}),Object.defineProperty(i,"sticky",{get:function(){e+="y"}}),e==="dy")return t.get}}return q7},"getPolyfill")});var b0=N((AE,v0)=>{"use strict";d();var K7=Vr().supportsDescriptors,Q7=vp(),t6=Object.getOwnPropertyDescriptor,e6=Object.defineProperty,r6=TypeError,g0=Object.getPrototypeOf,i6=/a/;v0.exports=l(function(){if(!K7||!g0)throw new r6("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var t=Q7(),e=g0(i6),i=t6(e,"flags");return(!i||i.get!==t)&&e6(e,"flags",{configurable:!0,enumerable:!1,get:t}),t},"shimFlags")});var M0=N((RE,S0)=>{"use strict";d();var n6=Vr(),o6=Ci(),a6=gp(),C0=vp(),s6=b0(),x0=o6(C0());n6(x0,{getPolyfill:C0,implementation:a6,shim:s6});S0.exports=x0});var Hr=N((FE,P0)=>{"use strict";d();var l6=ko();P0.exports=l(function(){return l6()&&!!Symbol.toStringTag},"hasToStringTagShams")});var Cp=N((HE,T0)=>{"use strict";d();var u6=Hr()(),c6=ce(),bp=c6("Object.prototype.toString"),Cl=l(function(t){return u6&&t&&typeof t=="object"&&Symbol.toStringTag in t?!1:bp(t)==="[object Arguments]"},"isArguments"),w0=l(function(t){return Cl(t)?!0:t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&bp(t)!=="[object Array]"&&bp(t.callee)==="[object Function]"},"isArguments"),p6=function(){return Cl(arguments)}();Cl.isLegacyArguments=w0;T0.exports=p6?Cl:w0});var I0=N(()=>{d()});var Z0=N((ZE,U0)=>{d();var _p=typeof Map=="function"&&Map.prototype,xp=Object.getOwnPropertyDescriptor&&_p?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Sl=_p&&xp&&typeof xp.get=="function"?xp.get:null,E0=_p&&Map.prototype.forEach,Dp=typeof Set=="function"&&Set.prototype,Sp=Object.getOwnPropertyDescriptor&&Dp?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Ml=Dp&&Sp&&typeof Sp.get=="function"?Sp.get:null,L0=Dp&&Set.prototype.forEach,h6=typeof WeakMap=="function"&&WeakMap.prototype,Vo=h6?WeakMap.prototype.has:null,d6=typeof WeakSet=="function"&&WeakSet.prototype,Ho=d6?WeakSet.prototype.has:null,f6=typeof WeakRef=="function"&&WeakRef.prototype,_0=f6?WeakRef.prototype.deref:null,m6=Boolean.prototype.valueOf,y6=Object.prototype.toString,g6=Function.prototype.toString,v6=String.prototype.match,Op=String.prototype.slice,Yr=String.prototype.replace,b6=String.prototype.toUpperCase,D0=String.prototype.toLowerCase,V0=RegExp.prototype.test,O0=Array.prototype.concat,Ue=Array.prototype.join,C6=Array.prototype.slice,A0=Math.floor,wp=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Mp=Object.getOwnPropertySymbols,Tp=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Mn=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Xt=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Mn||!0)?Symbol.toStringTag:null,H0=Object.prototype.propertyIsEnumerable,N0=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(r){return r.__proto__}:null);function k0(r,t){if(r===1/0||r===-1/0||r!==r||r&&r>-1e3&&r<1e3||V0.call(/e/,t))return t;var e=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof r=="number"){var i=r<0?-A0(-r):A0(r);if(i!==r){var n=String(i),o=Op.call(t,n.length+1);return Yr.call(n,e,"$&_")+"."+Yr.call(Yr.call(o,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Yr.call(t,e,"$&_")}l(k0,"addNumericSeparator");var Ip=I0(),R0=Ip.custom,B0=Y0(R0)?R0:null;U0.exports=l(function r(t,e,i,n){var o=e||{};if(Xr(o,"quoteStyle")&&o.quoteStyle!=="single"&&o.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Xr(o,"maxStringLength")&&(typeof o.maxStringLength=="number"?o.maxStringLength<0&&o.maxStringLength!==1/0:o.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var a=Xr(o,"customInspect")?o.customInspect:!0;if(typeof a!="boolean"&&a!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(Xr(o,"indent")&&o.indent!==null&&o.indent!==" "&&!(parseInt(o.indent,10)===o.indent&&o.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(Xr(o,"numericSeparator")&&typeof o.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var u=o.numericSeparator;if(typeof t>"u")return"undefined";if(t===null)return"null";if(typeof t=="boolean")return t?"true":"false";if(typeof t=="string")return W0(t,o);if(typeof t=="number"){if(t===0)return 1/0/t>0?"0":"-0";var s=String(t);return u?k0(t,s):s}if(typeof t=="bigint"){var p=String(t)+"n";return u?k0(t,p):p}var f=typeof o.depth>"u"?5:o.depth;if(typeof i>"u"&&(i=0),i>=f&&f>0&&typeof t=="object")return Ep(t)?"[Array]":"[Object]";var m=F6(o,i);if(typeof n>"u")n=[];else if(j0(n,t)>=0)return"[Circular]";function y(ct,yt,bt){if(yt&&(n=C6.call(n),n.push(yt)),bt){var Nt={depth:o.depth};return Xr(o,"quoteStyle")&&(Nt.quoteStyle=o.quoteStyle),r(ct,Nt,i+1,n)}return r(ct,o,i+1,n)}if(l(y,"inspect"),typeof t=="function"&&!F0(t)){var x=L6(t),S=xl(t,y);return"[Function"+(x?": "+x:" (anonymous)")+"]"+(S.length>0?" { "+Ue.call(S,", ")+" }":"")}if(Y0(t)){var M=Mn?Yr.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):Tp.call(t);return typeof t=="object"&&!Mn?Go(M):M}if(k6(t)){for(var g="<"+D0.call(String(t.nodeName)),C=t.attributes||[],I=0;I<C.length;I++)g+=" "+C[I].name+"="+X0(x6(C[I].value),"double",o);return g+=">",t.childNodes&&t.childNodes.length&&(g+="..."),g+="</"+D0.call(String(t.nodeName))+">",g}if(Ep(t)){if(t.length===0)return"[]";var T=xl(t,y);return m&&!B6(T)?"["+Lp(T,m)+"]":"[ "+Ue.call(T,", ")+" ]"}if(M6(t)){var w=xl(t,y);return!("cause"in Error.prototype)&&"cause"in t&&!H0.call(t,"cause")?"{ ["+String(t)+"] "+Ue.call(O0.call("[cause]: "+y(t.cause),w),", ")+" }":w.length===0?"["+String(t)+"]":"{ ["+String(t)+"] "+Ue.call(w,", ")+" }"}if(typeof t=="object"&&a){if(B0&&typeof t[B0]=="function"&&Ip)return Ip(t,{depth:f-i});if(a!=="symbol"&&typeof t.inspect=="function")return t.inspect()}if(_6(t)){var L=[];return E0&&E0.call(t,function(ct,yt){L.push(y(yt,t,!0)+" => "+y(ct,t))}),G0("Map",Sl.call(t),L,m)}if(A6(t)){var D=[];return L0&&L0.call(t,function(ct){D.push(y(ct,t))}),G0("Set",Ml.call(t),D,m)}if(D6(t))return Pp("WeakMap");if(N6(t))return Pp("WeakSet");if(O6(t))return Pp("WeakRef");if(w6(t))return Go(y(Number(t)));if(I6(t))return Go(y(wp.call(t)));if(T6(t))return Go(m6.call(t));if(P6(t))return Go(y(String(t)));if(typeof window<"u"&&t===window)return"{ [object Window] }";if(t===global)return"{ [object globalThis] }";if(!S6(t)&&!F0(t)){var R=xl(t,y),F=N0?N0(t)===Object.prototype:t instanceof Object||t.constructor===Object,k=t instanceof Object?"":"null prototype",H=!F&&Xt&&Object(t)===t&&Xt in t?Op.call(jr(t),8,-1):k?"Object":"",X=F||typeof t.constructor!="function"?"":t.constructor.name?t.constructor.name+" ":"",$=X+(H||k?"["+Ue.call(O0.call([],H||[],k||[]),": ")+"] ":"");return R.length===0?$+"{}":m?$+"{"+Lp(R,m)+"}":$+"{ "+Ue.call(R,", ")+" }"}return String(t)},"inspect_");function X0(r,t,e){var i=(e.quoteStyle||t)==="double"?'"':"'";return i+r+i}l(X0,"wrapQuotes");function x6(r){return Yr.call(String(r),/"/g,"&quot;")}l(x6,"quote");function Ep(r){return jr(r)==="[object Array]"&&(!Xt||!(typeof r=="object"&&Xt in r))}l(Ep,"isArray");function S6(r){return jr(r)==="[object Date]"&&(!Xt||!(typeof r=="object"&&Xt in r))}l(S6,"isDate");function F0(r){return jr(r)==="[object RegExp]"&&(!Xt||!(typeof r=="object"&&Xt in r))}l(F0,"isRegExp");function M6(r){return jr(r)==="[object Error]"&&(!Xt||!(typeof r=="object"&&Xt in r))}l(M6,"isError");function P6(r){return jr(r)==="[object String]"&&(!Xt||!(typeof r=="object"&&Xt in r))}l(P6,"isString");function w6(r){return jr(r)==="[object Number]"&&(!Xt||!(typeof r=="object"&&Xt in r))}l(w6,"isNumber");function T6(r){return jr(r)==="[object Boolean]"&&(!Xt||!(typeof r=="object"&&Xt in r))}l(T6,"isBoolean");function Y0(r){if(Mn)return r&&typeof r=="object"&&r instanceof Symbol;if(typeof r=="symbol")return!0;if(!r||typeof r!="object"||!Tp)return!1;try{return Tp.call(r),!0}catch{}return!1}l(Y0,"isSymbol");function I6(r){if(!r||typeof r!="object"||!wp)return!1;try{return wp.call(r),!0}catch{}return!1}l(I6,"isBigInt");var E6=Object.prototype.hasOwnProperty||function(r){return r in this};function Xr(r,t){return E6.call(r,t)}l(Xr,"has");function jr(r){return y6.call(r)}l(jr,"toStr");function L6(r){if(r.name)return r.name;var t=v6.call(g6.call(r),/^function\s*([\w$]+)/);return t?t[1]:null}l(L6,"nameOf");function j0(r,t){if(r.indexOf)return r.indexOf(t);for(var e=0,i=r.length;e<i;e++)if(r[e]===t)return e;return-1}l(j0,"indexOf");function _6(r){if(!Sl||!r||typeof r!="object")return!1;try{Sl.call(r);try{Ml.call(r)}catch{return!0}return r instanceof Map}catch{}return!1}l(_6,"isMap");function D6(r){if(!Vo||!r||typeof r!="object")return!1;try{Vo.call(r,Vo);try{Ho.call(r,Ho)}catch{return!0}return r instanceof WeakMap}catch{}return!1}l(D6,"isWeakMap");function O6(r){if(!_0||!r||typeof r!="object")return!1;try{return _0.call(r),!0}catch{}return!1}l(O6,"isWeakRef");function A6(r){if(!Ml||!r||typeof r!="object")return!1;try{Ml.call(r);try{Sl.call(r)}catch{return!0}return r instanceof Set}catch{}return!1}l(A6,"isSet");function N6(r){if(!Ho||!r||typeof r!="object")return!1;try{Ho.call(r,Ho);try{Vo.call(r,Vo)}catch{return!0}return r instanceof WeakSet}catch{}return!1}l(N6,"isWeakSet");function k6(r){return!r||typeof r!="object"?!1:typeof HTMLElement<"u"&&r instanceof HTMLElement?!0:typeof r.nodeName=="string"&&typeof r.getAttribute=="function"}l(k6,"isElement");function W0(r,t){if(r.length>t.maxStringLength){var e=r.length-t.maxStringLength,i="... "+e+" more character"+(e>1?"s":"");return W0(Op.call(r,0,t.maxStringLength),t)+i}var n=Yr.call(Yr.call(r,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,R6);return X0(n,"single",t)}l(W0,"inspectString");function R6(r){var t=r.charCodeAt(0),e={8:"b",9:"t",10:"n",12:"f",13:"r"}[t];return e?"\\"+e:"\\x"+(t<16?"0":"")+b6.call(t.toString(16))}l(R6,"lowbyte");function Go(r){return"Object("+r+")"}l(Go,"markBoxed");function Pp(r){return r+" { ? }"}l(Pp,"weakCollectionOf");function G0(r,t,e,i){var n=i?Lp(e,i):Ue.call(e,", ");return r+" ("+t+") {"+n+"}"}l(G0,"collectionOf");function B6(r){for(var t=0;t<r.length;t++)if(j0(r[t],`
2
+ `)>=0)return!1;return!0}l(B6,"singleLineValues");function F6(r,t){var e;if(r.indent===" ")e=" ";else if(typeof r.indent=="number"&&r.indent>0)e=Ue.call(Array(r.indent+1)," ");else return null;return{base:e,prev:Ue.call(Array(t+1),e)}}l(F6,"getIndent");function Lp(r,t){if(r.length===0)return"";var e=`
3
+ `+t.prev+t.base;return e+Ue.call(r,","+e)+`
4
+ `+t.prev}l(Lp,"indentedJoin");function xl(r,t){var e=Ep(r),i=[];if(e){i.length=r.length;for(var n=0;n<r.length;n++)i[n]=Xr(r,n)?t(r[n],r):""}var o=typeof Mp=="function"?Mp(r):[],a;if(Mn){a={};for(var u=0;u<o.length;u++)a["$"+o[u]]=o[u]}for(var s in r)Xr(r,s)&&(e&&String(Number(s))===s&&s<r.length||Mn&&a["$"+s]instanceof Symbol||(V0.call(/[^\w$]/,s)?i.push(t(s,r)+": "+t(r[s],r)):i.push(s+": "+t(r[s],r))));if(typeof Mp=="function")for(var p=0;p<o.length;p++)H0.call(r,o[p])&&i.push("["+t(o[p])+"]: "+t(r[o[p]],r));return i}l(xl,"arrObjKeys")});var Np=N(($E,q0)=>{"use strict";d();var z0=Ee(),Pn=ce(),G6=Z0(),V6=dr(),Pl=z0("%WeakMap%",!0),wl=z0("%Map%",!0),H6=Pn("WeakMap.prototype.get",!0),X6=Pn("WeakMap.prototype.set",!0),Y6=Pn("WeakMap.prototype.has",!0),j6=Pn("Map.prototype.get",!0),W6=Pn("Map.prototype.set",!0),U6=Pn("Map.prototype.has",!0),Ap=l(function(r,t){for(var e=r,i;(i=e.next)!==null;e=i)if(i.key===t)return e.next=i.next,i.next=r.next,r.next=i,i},"listGetNode"),Z6=l(function(r,t){var e=Ap(r,t);return e&&e.value},"listGet"),z6=l(function(r,t,e){var i=Ap(r,t);i?i.value=e:r.next={key:t,next:r.next,value:e}},"listSet"),q6=l(function(r,t){return!!Ap(r,t)},"listHas");q0.exports=l(function(){var t,e,i,n={assert:function(o){if(!n.has(o))throw new V6("Side channel does not contain "+G6(o))},get:function(o){if(Pl&&o&&(typeof o=="object"||typeof o=="function")){if(t)return H6(t,o)}else if(wl){if(e)return j6(e,o)}else if(i)return Z6(i,o)},has:function(o){if(Pl&&o&&(typeof o=="object"||typeof o=="function")){if(t)return Y6(t,o)}else if(wl){if(e)return U6(e,o)}else if(i)return q6(i,o);return!1},set:function(o,a){Pl&&o&&(typeof o=="object"||typeof o=="function")?(t||(t=new Pl),X6(t,o,a)):wl?(e||(e=new wl),W6(e,o,a)):(i||(i={key:{},next:null}),z6(i,o,a))}};return n},"getSideChannel")});var J0=N((QE,$0)=>{"use strict";d();var $6=up(),Xo=Np()(),fr=dr(),kp={assert:function(r,t){if(!r||typeof r!="object"&&typeof r!="function")throw new fr("`O` is not an object");if(typeof t!="string")throw new fr("`slot` must be a string");if(Xo.assert(r),!kp.has(r,t))throw new fr("`"+t+"` is not present on `O`")},get:function(r,t){if(!r||typeof r!="object"&&typeof r!="function")throw new fr("`O` is not an object");if(typeof t!="string")throw new fr("`slot` must be a string");var e=Xo.get(r);return e&&e["$"+t]},has:function(r,t){if(!r||typeof r!="object"&&typeof r!="function")throw new fr("`O` is not an object");if(typeof t!="string")throw new fr("`slot` must be a string");var e=Xo.get(r);return!!e&&$6(e,"$"+t)},set:function(r,t,e){if(!r||typeof r!="object"&&typeof r!="function")throw new fr("`O` is not an object");if(typeof t!="string")throw new fr("`slot` must be a string");var i=Xo.get(r);i||(i={},Xo.set(r,i)),i["$"+t]=e}};Object.freeze&&Object.freeze(kp);$0.exports=kp});var tg=N((eL,Q0)=>{"use strict";d();var Yo=J0(),J6=SyntaxError,K0=typeof StopIteration=="object"?StopIteration:null;Q0.exports=l(function(t){if(!K0)throw new J6("this environment lacks StopIteration");Yo.set(t,"[[Done]]",!1);var e={next:l(function(){var n=Yo.get(this,"[[Iterator]]"),o=Yo.get(n,"[[Done]]");try{return{done:o,value:o?void 0:n.next()}}catch(a){if(Yo.set(n,"[[Done]]",!0),a!==K0)throw a;return{done:!0,value:void 0}}},"next")};return Yo.set(e,"[[Iterator]]",t),e},"getStopIterationIterator")});var Rp=N((nL,eg)=>{d();var K6={}.toString;eg.exports=Array.isArray||function(r){return K6.call(r)=="[object Array]"}});var Bp=N((aL,rg)=>{"use strict";d();var Q6=String.prototype.valueOf,tC=l(function(t){try{return Q6.call(t),!0}catch{return!1}},"tryStringObject"),eC=Object.prototype.toString,rC="[object String]",iC=Hr()();rg.exports=l(function(t){return typeof t=="string"?!0:typeof t!="object"?!1:iC?tC(t):eC.call(t)===rC},"isString")});var Gp=N((uL,og)=>{"use strict";d();var Fp=typeof Map=="function"&&Map.prototype?Map:null,nC=typeof Set=="function"&&Set.prototype?Set:null,Tl;Fp||(Tl=l(function(t){return!1},"isMap"));var ng=Fp?Map.prototype.has:null,ig=nC?Set.prototype.has:null;!Tl&&!ng&&(Tl=l(function(t){return!1},"isMap"));og.exports=Tl||l(function(t){if(!t||typeof t!="object")return!1;try{if(ng.call(t),ig)try{ig.call(t)}catch{return!0}return t instanceof Fp}catch{}return!1},"isMap")});var Hp=N((hL,lg)=>{"use strict";d();var oC=typeof Map=="function"&&Map.prototype?Map:null,Vp=typeof Set=="function"&&Set.prototype?Set:null,Il;Vp||(Il=l(function(t){return!1},"isSet"));var ag=oC?Map.prototype.has:null,sg=Vp?Set.prototype.has:null;!Il&&!sg&&(Il=l(function(t){return!1},"isSet"));lg.exports=Il||l(function(t){if(!t||typeof t!="object")return!1;try{if(sg.call(t),ag)try{ag.call(t)}catch{return!0}return t instanceof Vp}catch{}return!1},"isSet")});var Cg=N((mL,_l)=>{"use strict";d();var ug=Cp(),cg=tg();ll()()||ko()()?(El=Symbol.iterator,_l.exports=l(function(t){if(t!=null&&typeof t[El]<"u")return t[El]();if(ug(t))return Array.prototype[El].call(t)},"getIterator")):(pg=Rp(),hg=Bp(),Xp=Ee(),dg=Xp("%Map%",!0),fg=Xp("%Set%",!0),me=ce(),Yp=me("Array.prototype.push"),jp=me("String.prototype.charCodeAt"),mg=me("String.prototype.slice"),yg=l(function(t,e){var i=t.length;if(e+1>=i)return e+1;var n=jp(t,e);if(n<55296||n>56319)return e+1;var o=jp(t,e+1);return o<56320||o>57343?e+1:e+2},"advanceStringIndex"),Ll=l(function(t){var e=0;return{next:l(function(){var n=e>=t.length,o;return n||(o=t[e],e+=1),{done:n,value:o}},"next")}},"getArrayIterator"),Wp=l(function(t,e){if(pg(t)||ug(t))return Ll(t);if(hg(t)){var i=0;return{next:l(function(){var o=yg(t,i),a=mg(t,i,o);return i=o,{done:o>t.length,value:a}},"next")}}if(e&&typeof t["_es6-shim iterator_"]<"u")return t["_es6-shim iterator_"]()},"getNonCollectionIterator"),!dg&&!fg?_l.exports=l(function(t){if(t!=null)return Wp(t,!0)},"getIterator"):(gg=Gp(),vg=Hp(),Up=me("Map.prototype.forEach",!0),Zp=me("Set.prototype.forEach",!0),(typeof b>"u"||!b.versions||!b.versions.node)&&(zp=me("Map.prototype.iterator",!0),qp=me("Set.prototype.iterator",!0)),$p=me("Map.prototype.@@iterator",!0)||me("Map.prototype._es6-shim iterator_",!0),Jp=me("Set.prototype.@@iterator",!0)||me("Set.prototype._es6-shim iterator_",!0),bg=l(function(t){if(gg(t)){if(zp)return cg(zp(t));if($p)return $p(t);if(Up){var e=[];return Up(t,function(n,o){Yp(e,[o,n])}),Ll(e)}}if(vg(t)){if(qp)return cg(qp(t));if(Jp)return Jp(t);if(Zp){var i=[];return Zp(t,function(n){Yp(i,n)}),Ll(i)}}},"getCollectionIterator"),_l.exports=l(function(t){return bg(t)||Wp(t)},"getIterator")));var El,pg,hg,Xp,dg,fg,me,Yp,jp,mg,yg,Ll,Wp,gg,vg,Up,Zp,zp,qp,$p,Jp,bg});var Kp=N((vL,Sg)=>{"use strict";d();var xg=l(function(r){return r!==r},"numberIsNaN");Sg.exports=l(function(t,e){return t===0&&e===0?1/t===1/e:!!(t===e||xg(t)&&xg(e))},"is")});var Qp=N((xL,Mg)=>{"use strict";d();var aC=Kp();Mg.exports=l(function(){return typeof Object.is=="function"?Object.is:aC},"getPolyfill")});var wg=N((PL,Pg)=>{"use strict";d();var sC=Qp(),lC=Vr();Pg.exports=l(function(){var t=sC();return lC(Object,{is:t},{is:l(function(){return Object.is!==t},"testObjectIs")}),t},"shimObjectIs")});var Lg=N((IL,Eg)=>{"use strict";d();var uC=Vr(),cC=Ci(),pC=Kp(),Tg=Qp(),hC=wg(),Ig=cC(Tg(),Object);uC(Ig,{getPolyfill:Tg,implementation:pC,shim:hC});Eg.exports=Ig});var eh=N((LL,Ag)=>{"use strict";d();var dC=Ci(),Og=ce(),fC=Ee(),th=fC("%ArrayBuffer%",!0),Dl=Og("ArrayBuffer.prototype.byteLength",!0),mC=Og("Object.prototype.toString"),_g=!!th&&!Dl&&new th(0).slice,Dg=!!_g&&dC(_g);Ag.exports=l(Dl||Dg?function(t){if(!t||typeof t!="object")return!1;try{return Dl?Dl(t):Dg(t,0),!0}catch{return!1}}:th?function(t){return mC(t)==="[object ArrayBuffer]"}:function(t){return!1},"isArrayBuffer")});var kg=N((OL,Ng)=>{"use strict";d();var yC=Date.prototype.getDay,gC=l(function(t){try{return yC.call(t),!0}catch{return!1}},"tryDateGetDayCall"),vC=Object.prototype.toString,bC="[object Date]",CC=Hr()();Ng.exports=l(function(t){return typeof t!="object"||t===null?!1:CC?gC(t):vC.call(t)===bC},"isDateObject")});var Vg=N((kL,Gg)=>{"use strict";d();var rh=ce(),Rg=Hr()(),Bg,Fg,ih,nh;Rg&&(Bg=rh("Object.prototype.hasOwnProperty"),Fg=rh("RegExp.prototype.exec"),ih={},Ol=l(function(){throw ih},"throwRegexMarker"),nh={toString:Ol,valueOf:Ol},typeof Symbol.toPrimitive=="symbol"&&(nh[Symbol.toPrimitive]=Ol));var Ol,xC=rh("Object.prototype.toString"),SC=Object.getOwnPropertyDescriptor,MC="[object RegExp]";Gg.exports=l(Rg?function(t){if(!t||typeof t!="object")return!1;var e=SC(t,"lastIndex"),i=e&&Bg(e,"value");if(!i)return!1;try{Fg(t,nh)}catch(n){return n===ih}}:function(t){return!t||typeof t!="object"&&typeof t!="function"?!1:xC(t)===MC},"isRegex")});var Yg=N((FL,Xg)=>{"use strict";d();var PC=ce(),Hg=PC("SharedArrayBuffer.prototype.byteLength",!0);Xg.exports=l(Hg?function(t){if(!t||typeof t!="object")return!1;try{return Hg(t),!0}catch{return!1}}:function(t){return!1},"isSharedArrayBuffer")});var Wg=N((HL,jg)=>{"use strict";d();var wC=Number.prototype.toString,TC=l(function(t){try{return wC.call(t),!0}catch{return!1}},"tryNumberObject"),IC=Object.prototype.toString,EC="[object Number]",LC=Hr()();jg.exports=l(function(t){return typeof t=="number"?!0:typeof t!="object"?!1:LC?TC(t):IC.call(t)===EC},"isNumberObject")});var zg=N((jL,Zg)=>{"use strict";d();var Ug=ce(),_C=Ug("Boolean.prototype.toString"),DC=Ug("Object.prototype.toString"),OC=l(function(t){try{return _C(t),!0}catch{return!1}},"booleanBrandCheck"),AC="[object Boolean]",NC=Hr()();Zg.exports=l(function(t){return typeof t=="boolean"?!0:t===null||typeof t!="object"?!1:NC&&Symbol.toStringTag in t?OC(t):DC(t)===AC},"isBoolean")});var Kg=N((ZL,oh)=>{"use strict";d();var kC=Object.prototype.toString,RC=ll()();RC?(qg=Symbol.prototype.toString,$g=/^Symbol\(.*\)$/,Jg=l(function(t){return typeof t.valueOf()!="symbol"?!1:$g.test(qg.call(t))},"isRealSymbolObject"),oh.exports=l(function(t){if(typeof t=="symbol")return!0;if(kC.call(t)!=="[object Symbol]")return!1;try{return Jg(t)}catch{return!1}},"isSymbol")):oh.exports=l(function(t){return!1},"isSymbol");var qg,$g,Jg});var e2=N(($L,t2)=>{"use strict";d();var Qg=typeof BigInt<"u"&&BigInt;t2.exports=l(function(){return typeof Qg=="function"&&typeof BigInt=="function"&&typeof Qg(42)=="bigint"&&typeof BigInt(42)=="bigint"},"hasNativeBigInts")});var n2=N((QL,ah)=>{"use strict";d();var BC=e2()();BC?(r2=BigInt.prototype.valueOf,i2=l(function(t){try{return r2.call(t),!0}catch{}return!1},"tryBigIntObject"),ah.exports=l(function(t){return t===null||typeof t>"u"||typeof t=="boolean"||typeof t=="string"||typeof t=="number"||typeof t=="symbol"||typeof t=="function"?!1:typeof t=="bigint"?!0:i2(t)},"isBigInt")):ah.exports=l(function(t){return!1},"isBigInt");var r2,i2});var a2=N((r_,o2)=>{"use strict";d();var FC=Bp(),GC=Wg(),VC=zg(),HC=Kg(),XC=n2();o2.exports=l(function(t){if(t==null||typeof t!="object"&&typeof t!="function")return null;if(FC(t))return"String";if(GC(t))return"Number";if(VC(t))return"Boolean";if(HC(t))return"Symbol";if(XC(t))return"BigInt"},"whichBoxedPrimitive")});var u2=N((o_,l2)=>{"use strict";d();var Al=typeof WeakMap=="function"&&WeakMap.prototype?WeakMap:null,s2=typeof WeakSet=="function"&&WeakSet.prototype?WeakSet:null,Nl;Al||(Nl=l(function(t){return!1},"isWeakMap"));var lh=Al?Al.prototype.has:null,sh=s2?s2.prototype.has:null;!Nl&&!lh&&(Nl=l(function(t){return!1},"isWeakMap"));l2.exports=Nl||l(function(t){if(!t||typeof t!="object")return!1;try{if(lh.call(t,lh),sh)try{sh.call(t,sh)}catch{return!0}return t instanceof Al}catch{}return!1},"isWeakMap")});var p2=N((l_,ch)=>{"use strict";d();var YC=Ee(),c2=ce(),jC=YC("%WeakSet%",!0),uh=c2("WeakSet.prototype.has",!0);uh?(kl=c2("WeakMap.prototype.has",!0),ch.exports=l(function(t){if(!t||typeof t!="object")return!1;try{if(uh(t,uh),kl)try{kl(t,kl)}catch{return!0}return t instanceof jC}catch{}return!1},"isWeakSet")):ch.exports=l(function(t){return!1},"isWeakSet");var kl});var d2=N((p_,h2)=>{"use strict";d();var WC=Gp(),UC=Hp(),ZC=u2(),zC=p2();h2.exports=l(function(t){if(t&&typeof t=="object"){if(WC(t))return"Map";if(UC(t))return"Set";if(ZC(t))return"WeakMap";if(zC(t))return"WeakSet"}return!1},"whichCollection")});var g2=N((f_,y2)=>{"use strict";d();var m2=Function.prototype.toString,wn=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,hh,Rl;if(typeof wn=="function"&&typeof Object.defineProperty=="function")try{hh=Object.defineProperty({},"length",{get:function(){throw Rl}}),Rl={},wn(function(){throw 42},null,hh)}catch(r){r!==Rl&&(wn=null)}else wn=null;var qC=/^\s*class\b/,dh=l(function(t){try{var e=m2.call(t);return qC.test(e)}catch{return!1}},"isES6ClassFunction"),ph=l(function(t){try{return dh(t)?!1:(m2.call(t),!0)}catch{return!1}},"tryFunctionToStr"),Bl=Object.prototype.toString,$C="[object Object]",JC="[object Function]",KC="[object GeneratorFunction]",QC="[object HTMLAllCollection]",t8="[object HTML document.all class]",e8="[object HTMLCollection]",r8=typeof Symbol=="function"&&!!Symbol.toStringTag,i8=!(0 in[,]),fh=l(function(){return!1},"isDocumentDotAll");typeof document=="object"&&(f2=document.all,Bl.call(f2)===Bl.call(document.all)&&(fh=l(function(t){if((i8||!t)&&(typeof t>"u"||typeof t=="object"))try{var e=Bl.call(t);return(e===QC||e===t8||e===e8||e===$C)&&t("")==null}catch{}return!1},"isDocumentDotAll")));var f2;y2.exports=l(wn?function(t){if(fh(t))return!0;if(!t||typeof t!="function"&&typeof t!="object")return!1;try{wn(t,null,hh)}catch(e){if(e!==Rl)return!1}return!dh(t)&&ph(t)}:function(t){if(fh(t))return!0;if(!t||typeof t!="function"&&typeof t!="object")return!1;if(r8)return ph(t);if(dh(t))return!1;var e=Bl.call(t);return e!==JC&&e!==KC&&!/^\[object HTML/.test(e)?!1:ph(t)},"isCallable")});var C2=N((g_,b2)=>{"use strict";d();var n8=g2(),o8=Object.prototype.toString,v2=Object.prototype.hasOwnProperty,a8=l(function(t,e,i){for(var n=0,o=t.length;n<o;n++)v2.call(t,n)&&(i==null?e(t[n],n,t):e.call(i,t[n],n,t))},"forEachArray"),s8=l(function(t,e,i){for(var n=0,o=t.length;n<o;n++)i==null?e(t.charAt(n),n,t):e.call(i,t.charAt(n),n,t)},"forEachString"),l8=l(function(t,e,i){for(var n in t)v2.call(t,n)&&(i==null?e(t[n],n,t):e.call(i,t[n],n,t))},"forEachObject"),u8=l(function(t,e,i){if(!n8(e))throw new TypeError("iterator must be a function");var n;arguments.length>=3&&(n=i),o8.call(t)==="[object Array]"?a8(t,e,n):typeof t=="string"?s8(t,e,n):l8(t,e,n)},"forEach");b2.exports=u8});var S2=N((C_,x2)=>{"use strict";d();x2.exports=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]});var P2=N((S_,M2)=>{"use strict";d();var mh=S2(),c8=typeof globalThis>"u"?global:globalThis;M2.exports=l(function(){for(var t=[],e=0;e<mh.length;e++)typeof c8[mh[e]]=="function"&&(t[t.length]=mh[e]);return t},"availableTypedArrays")});var L2=N((w_,E2)=>{"use strict";d();var Gl=C2(),p8=P2(),w2=Ci(),vh=ce(),Fl=ml(),h8=vh("Object.prototype.toString"),I2=Hr()(),T2=typeof globalThis>"u"?global:globalThis,gh=p8(),bh=vh("String.prototype.slice"),yh=Object.getPrototypeOf,d8=vh("Array.prototype.indexOf",!0)||l(function(t,e){for(var i=0;i<t.length;i+=1)if(t[i]===e)return i;return-1},"indexOf"),Vl={__proto__:null};I2&&Fl&&yh?Gl(gh,function(r){var t=new T2[r];if(Symbol.toStringTag in t){var e=yh(t),i=Fl(e,Symbol.toStringTag);if(!i){var n=yh(e);i=Fl(n,Symbol.toStringTag)}Vl["$"+r]=w2(i.get)}}):Gl(gh,function(r){var t=new T2[r],e=t.slice||t.set;e&&(Vl["$"+r]=w2(e))});var f8=l(function(t){var e=!1;return Gl(Vl,function(i,n){if(!e)try{"$"+i(t)===n&&(e=bh(n,1))}catch{}}),e},"tryAllTypedArrays"),m8=l(function(t){var e=!1;return Gl(Vl,function(i,n){if(!e)try{i(t),e=bh(n,1)}catch{}}),e},"tryAllSlices");E2.exports=l(function(t){if(!t||typeof t!="object")return!1;if(!I2){var e=bh(h8(t),8,-1);return d8(gh,e)>-1?e:e!=="Object"?!1:m8(t)}return Fl?f8(t):null},"whichTypedArray")});var O2=N((E_,D2)=>{"use strict";d();var y8=ce(),_2=y8("ArrayBuffer.prototype.byteLength",!0),g8=eh();D2.exports=l(function(t){return g8(t)?_2?_2(t):t.byteLength:NaN},"byteLength")});var i3=N((D_,r3)=>{"use strict";d();var Q2=u0(),Ze=ce(),A2=M0(),v8=Ee(),Tn=Cg(),b8=Np(),N2=Lg(),k2=Cp(),R2=Rp(),B2=eh(),F2=kg(),G2=Vg(),V2=Yg(),H2=sl(),X2=a2(),Y2=d2(),j2=L2(),W2=O2(),U2=Ze("SharedArrayBuffer.prototype.byteLength",!0),Z2=Ze("Date.prototype.getTime"),Ch=Object.getPrototypeOf,z2=Ze("Object.prototype.toString"),Xl=v8("%Set%",!0),xh=Ze("Map.prototype.has",!0),Yl=Ze("Map.prototype.get",!0),q2=Ze("Map.prototype.size",!0),jl=Ze("Set.prototype.add",!0),t3=Ze("Set.prototype.delete",!0),Wl=Ze("Set.prototype.has",!0),Hl=Ze("Set.prototype.size",!0);function $2(r,t,e,i){for(var n=Tn(r),o;(o=n.next())&&!o.done;)if(Le(t,o.value,e,i))return t3(r,o.value),!0;return!1}l($2,"setHasEqualElement");function e3(r){if(typeof r>"u")return null;if(typeof r!="object")return typeof r=="symbol"?!1:typeof r=="string"||typeof r=="number"?+r==+r:!0}l(e3,"findLooseMatchingPrimitives");function C8(r,t,e,i,n,o){var a=e3(e);if(a!=null)return a;var u=Yl(t,a),s=Q2({},n,{strict:!1});return typeof u>"u"&&!xh(t,a)||!Le(i,u,s,o)?!1:!xh(r,a)&&Le(i,u,s,o)}l(C8,"mapMightHaveLoosePrim");function x8(r,t,e){var i=e3(e);return i!=null?i:Wl(t,i)&&!Wl(r,i)}l(x8,"setMightHaveLoosePrim");function J2(r,t,e,i,n,o){for(var a=Tn(r),u,s;(u=a.next())&&!u.done;)if(s=u.value,Le(e,s,n,o)&&Le(i,Yl(t,s),n,o))return t3(r,s),!0;return!1}l(J2,"mapHasEqualEntry");function Le(r,t,e,i){var n=e||{};if(n.strict?N2(r,t):r===t)return!0;var o=X2(r),a=X2(t);if(o!==a)return!1;if(!r||!t||typeof r!="object"&&typeof t!="object")return n.strict?N2(r,t):r==t;var u=i.has(r),s=i.has(t),p;if(u&&s){if(i.get(r)===i.get(t))return!0}else p={};return u||i.set(r,p),s||i.set(t,p),P8(r,t,n,i)}l(Le,"internalDeepEqual");function K2(r){return!r||typeof r!="object"||typeof r.length!="number"||typeof r.copy!="function"||typeof r.slice!="function"||r.length>0&&typeof r[0]!="number"?!1:!!(r.constructor&&r.constructor.isBuffer&&r.constructor.isBuffer(r))}l(K2,"isBuffer");function S8(r,t,e,i){if(Hl(r)!==Hl(t))return!1;for(var n=Tn(r),o=Tn(t),a,u,s;(a=n.next())&&!a.done;)if(a.value&&typeof a.value=="object")s||(s=new Xl),jl(s,a.value);else if(!Wl(t,a.value)){if(e.strict||!x8(r,t,a.value))return!1;s||(s=new Xl),jl(s,a.value)}if(s){for(;(u=o.next())&&!u.done;)if(u.value&&typeof u.value=="object"){if(!$2(s,u.value,e.strict,i))return!1}else if(!e.strict&&!Wl(r,u.value)&&!$2(s,u.value,e.strict,i))return!1;return Hl(s)===0}return!0}l(S8,"setEquiv");function M8(r,t,e,i){if(q2(r)!==q2(t))return!1;for(var n=Tn(r),o=Tn(t),a,u,s,p,f,m;(a=n.next())&&!a.done;)if(p=a.value[0],f=a.value[1],p&&typeof p=="object")s||(s=new Xl),jl(s,p);else if(m=Yl(t,p),typeof m>"u"&&!xh(t,p)||!Le(f,m,e,i)){if(e.strict||!C8(r,t,p,f,e,i))return!1;s||(s=new Xl),jl(s,p)}if(s){for(;(u=o.next())&&!u.done;)if(p=u.value[0],m=u.value[1],p&&typeof p=="object"){if(!J2(s,r,p,m,e,i))return!1}else if(!e.strict&&(!r.has(p)||!Le(Yl(r,p),m,e,i))&&!J2(s,r,p,m,Q2({},e,{strict:!1}),i))return!1;return Hl(s)===0}return!0}l(M8,"mapEquiv");function P8(r,t,e,i){var n,o;if(typeof r!=typeof t||r==null||t==null||z2(r)!==z2(t)||k2(r)!==k2(t))return!1;var a=R2(r),u=R2(t);if(a!==u)return!1;var s=r instanceof Error,p=t instanceof Error;if(s!==p||(s||p)&&(r.name!==t.name||r.message!==t.message))return!1;var f=G2(r),m=G2(t);if(f!==m||(f||m)&&(r.source!==t.source||A2(r)!==A2(t)))return!1;var y=F2(r),x=F2(t);if(y!==x||(y||x)&&Z2(r)!==Z2(t)||e.strict&&Ch&&Ch(r)!==Ch(t))return!1;var S=j2(r),M=j2(t);if(S!==M)return!1;if(S||M){if(r.length!==t.length)return!1;for(n=0;n<r.length;n++)if(r[n]!==t[n])return!1;return!0}var g=K2(r),C=K2(t);if(g!==C)return!1;if(g||C){if(r.length!==t.length)return!1;for(n=0;n<r.length;n++)if(r[n]!==t[n])return!1;return!0}var I=B2(r),T=B2(t);if(I!==T)return!1;if(I||T)return W2(r)!==W2(t)?!1:typeof Uint8Array=="function"&&Le(new Uint8Array(r),new Uint8Array(t),e,i);var w=V2(r),L=V2(t);if(w!==L)return!1;if(w||L)return U2(r)!==U2(t)?!1:typeof Uint8Array=="function"&&Le(new Uint8Array(r),new Uint8Array(t),e,i);if(typeof r!=typeof t)return!1;var D=H2(r),R=H2(t);if(D.length!==R.length)return!1;for(D.sort(),R.sort(),n=D.length-1;n>=0;n--)if(D[n]!=R[n])return!1;for(n=D.length-1;n>=0;n--)if(o=D[n],!Le(r[o],t[o],e,i))return!1;var F=Y2(r),k=Y2(t);return F!==k?!1:F==="Set"||k==="Set"?S8(r,t,e,i):F==="Map"?M8(r,t,e,i):!0}l(P8,"objEquiv");r3.exports=l(function(t,e,i){return Le(t,e,i,b8())},"deepEqual")});var b3=N(rt=>{"use strict";d();Object.defineProperty(rt,"__esModule",{value:!0});function w8(r){return r&&r.__esModule?r:{default:r}}l(w8,"_interopRequireDefault");var T8=Object.defineProperty,nt=l((r,t)=>T8(r,"name",{value:t,configurable:!0}),"__name"),I8=i3(),E8=w8(I8),Uo,n3=(Uo=class{constructor(t){this.direction=!1,this.compareProperties=!0;var e,i,n;this.precision=10**-((e=t==null?void 0:t.precision)!=null?e:17),this.direction=(i=t==null?void 0:t.direction)!=null?i:!1,this.compareProperties=(n=t==null?void 0:t.compareProperties)!=null?n:!0}compare(t,e){if(t.type!==e.type||!jo(t,e))return!1;switch(t.type){case"Point":return this.compareCoord(t.coordinates,e.coordinates);case"LineString":return this.compareLine(t.coordinates,e.coordinates);case"Polygon":return this.comparePolygon(t,e);case"GeometryCollection":return this.compareGeometryCollection(t,e);case"Feature":return this.compareFeature(t,e);case"FeatureCollection":return this.compareFeatureCollection(t,e);default:if(t.type.startsWith("Multi")){let i=Sh(t),n=Sh(e);return i.every(o=>n.some(a=>this.compare(o,a)))}}return!1}compareCoord(t,e){return t.length===e.length&&t.every((i,n)=>Math.abs(i-e[n])<this.precision)}compareLine(t,e,i=0,n=!1){if(!jo(t,e))return!1;let o=t,a=e;if(n&&!this.compareCoord(o[0],a[0])){let s=this.fixStartIndex(a,o);if(s)a=s;else return!1}let u=this.compareCoord(o[i],a[i]);return this.direction||u?this.comparePath(o,a):this.compareCoord(o[i],a[a.length-(1+i)])?this.comparePath(o.slice().reverse(),a):!1}fixStartIndex(t,e){let i,n=-1;for(let o=0;o<t.length;o++)if(this.compareCoord(t[o],e[0])){n=o;break}return n>=0&&(i=[].concat(t.slice(n,t.length),t.slice(1,n+1))),i}comparePath(t,e){return t.every((i,n)=>this.compareCoord(i,e[n]))}comparePolygon(t,e){if(this.compareLine(t.coordinates[0],e.coordinates[0],1,!0)){let i=t.coordinates.slice(1,t.coordinates.length),n=e.coordinates.slice(1,e.coordinates.length);return i.every(o=>n.some(a=>this.compareLine(o,a,1,!0)))}return!1}compareGeometryCollection(t,e){return jo(t.geometries,e.geometries)&&this.compareBBox(t,e)&&t.geometries.every((i,n)=>this.compare(i,e.geometries[n]))}compareFeature(t,e){return t.id===e.id&&(this.compareProperties?E8.default.call(void 0,t.properties,e.properties):!0)&&this.compareBBox(t,e)&&this.compare(t.geometry,e.geometry)}compareFeatureCollection(t,e){return jo(t.features,e.features)&&this.compareBBox(t,e)&&t.features.every((i,n)=>this.compare(i,e.features[n]))}compareBBox(t,e){return!t.bbox&&!e.bbox||(t.bbox&&e.bbox?this.compareCoord(t.bbox,e.bbox):!1)}},l(Uo,"_GeojsonEquality"),Uo);nt(n3,"GeojsonEquality");var L8=n3;function jo(r,t){return r.coordinates?r.coordinates.length===t.coordinates.length:r.length===t.length}l(jo,"sameLength");nt(jo,"sameLength");function Sh(r){return r.coordinates.map(t=>({type:r.type.replace("Multi",""),coordinates:t}))}l(Sh,"explode");nt(Sh,"explode");var oe=63710088e-1,Ph={centimeters:oe*100,centimetres:oe*100,degrees:360/(2*Math.PI),feet:oe*3.28084,inches:oe*39.37,kilometers:oe/1e3,kilometres:oe/1e3,meters:oe,metres:oe,miles:oe/1609.344,millimeters:oe*1e3,millimetres:oe*1e3,nauticalmiles:oe/1852,radians:1,yards:oe*1.0936},Mh={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,nauticalmiles:29155334959812285e-23,millimeters:1e6,millimetres:1e6,yards:1.195990046};function mr(r,t,e={}){let i={type:"Feature"};return(e.id===0||e.id)&&(i.id=e.id),e.bbox&&(i.bbox=e.bbox),i.properties=t||{},i.geometry=r,i}l(mr,"feature");nt(mr,"feature");function o3(r,t,e={}){switch(r){case"Point":return Ul(t).geometry;case"LineString":return zl(t).geometry;case"Polygon":return Zl(t).geometry;case"MultiPoint":return Th(t).geometry;case"MultiLineString":return wh(t).geometry;case"MultiPolygon":return Ih(t).geometry;default:throw new Error(r+" is invalid")}}l(o3,"geometry");nt(o3,"geometry");function Ul(r,t,e={}){if(!r)throw new Error("coordinates is required");if(!Array.isArray(r))throw new Error("coordinates must be an Array");if(r.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Wo(r[0])||!Wo(r[1]))throw new Error("coordinates must contain numbers");return mr({type:"Point",coordinates:r},t,e)}l(Ul,"point");nt(Ul,"point");function a3(r,t,e={}){return Zo(r.map(i=>Ul(i,t)),e)}l(a3,"points");nt(a3,"points");function Zl(r,t,e={}){for(let n of r){if(n.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(n[n.length-1].length!==n[0].length)throw new Error("First and last Position are not equivalent.");for(let o=0;o<n[n.length-1].length;o++)if(n[n.length-1][o]!==n[0][o])throw new Error("First and last Position are not equivalent.")}return mr({type:"Polygon",coordinates:r},t,e)}l(Zl,"polygon");nt(Zl,"polygon");function s3(r,t,e={}){return Zo(r.map(i=>Zl(i,t)),e)}l(s3,"polygons");nt(s3,"polygons");function zl(r,t,e={}){if(r.length<2)throw new Error("coordinates must be an array of two or more positions");return mr({type:"LineString",coordinates:r},t,e)}l(zl,"lineString");nt(zl,"lineString");function l3(r,t,e={}){return Zo(r.map(i=>zl(i,t)),e)}l(l3,"lineStrings");nt(l3,"lineStrings");function Zo(r,t={}){let e={type:"FeatureCollection"};return t.id&&(e.id=t.id),t.bbox&&(e.bbox=t.bbox),e.features=r,e}l(Zo,"featureCollection");nt(Zo,"featureCollection");function wh(r,t,e={}){return mr({type:"MultiLineString",coordinates:r},t,e)}l(wh,"multiLineString");nt(wh,"multiLineString");function Th(r,t,e={}){return mr({type:"MultiPoint",coordinates:r},t,e)}l(Th,"multiPoint");nt(Th,"multiPoint");function Ih(r,t,e={}){return mr({type:"MultiPolygon",coordinates:r},t,e)}l(Ih,"multiPolygon");nt(Ih,"multiPolygon");function u3(r,t,e={}){return mr({type:"GeometryCollection",geometries:r},t,e)}l(u3,"geometryCollection");nt(u3,"geometryCollection");function c3(r,t=0){if(t&&!(t>=0))throw new Error("precision must be a positive number");let e=Math.pow(10,t||0);return Math.round(r*e)/e}l(c3,"round");nt(c3,"round");function Eh(r,t="kilometers"){let e=Ph[t];if(!e)throw new Error(t+" units is invalid");return r*e}l(Eh,"radiansToLength");nt(Eh,"radiansToLength");function ql(r,t="kilometers"){let e=Ph[t];if(!e)throw new Error(t+" units is invalid");return r/e}l(ql,"lengthToRadians");nt(ql,"lengthToRadians");function p3(r,t){return Lh(ql(r,t))}l(p3,"lengthToDegrees");nt(p3,"lengthToDegrees");function h3(r){let t=r%360;return t<0&&(t+=360),t}l(h3,"bearingToAzimuth");nt(h3,"bearingToAzimuth");function Lh(r){return r%(2*Math.PI)*180/Math.PI}l(Lh,"radiansToDegrees");nt(Lh,"radiansToDegrees");function d3(r){return r%360*Math.PI/180}l(d3,"degreesToRadians");nt(d3,"degreesToRadians");function f3(r,t="kilometers",e="kilometers"){if(!(r>=0))throw new Error("length must be a positive number");return Eh(ql(r,t),e)}l(f3,"convertLength");nt(f3,"convertLength");function m3(r,t="meters",e="kilometers"){if(!(r>=0))throw new Error("area must be a positive number");let i=Mh[t];if(!i)throw new Error("invalid original units");let n=Mh[e];if(!n)throw new Error("invalid final units");return r/i*n}l(m3,"convertArea");nt(m3,"convertArea");function Wo(r){return!isNaN(r)&&r!==null&&!Array.isArray(r)}l(Wo,"isNumber");nt(Wo,"isNumber");function y3(r){return r!==null&&typeof r=="object"&&!Array.isArray(r)}l(y3,"isObject");nt(y3,"isObject");function g3(r){if(!r)throw new Error("bbox is required");if(!Array.isArray(r))throw new Error("bbox must be an Array");if(r.length!==4&&r.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");r.forEach(t=>{if(!Wo(t))throw new Error("bbox must only contain numbers")})}l(g3,"validateBBox");nt(g3,"validateBBox");function v3(r){if(!r)throw new Error("id is required");if(["string","number"].indexOf(typeof r)===-1)throw new Error("id must be a number or a string")}l(v3,"validateId");nt(v3,"validateId");rt.GeojsonEquality=L8;rt.areaFactors=Mh;rt.bearingToAzimuth=h3;rt.convertArea=m3;rt.convertLength=f3;rt.degreesToRadians=d3;rt.earthRadius=oe;rt.factors=Ph;rt.feature=mr;rt.featureCollection=Zo;rt.geometry=o3;rt.geometryCollection=u3;rt.isNumber=Wo;rt.isObject=y3;rt.lengthToDegrees=p3;rt.lengthToRadians=ql;rt.lineString=zl;rt.lineStrings=l3;rt.multiLineString=wh;rt.multiPoint=Th;rt.multiPolygon=Ih;rt.point=Ul;rt.points=a3;rt.polygon=Zl;rt.polygons=s3;rt.radiansToDegrees=Lh;rt.radiansToLength=Eh;rt.round=c3;rt.validateBBox=g3;rt.validateId=v3});var _3=N(Et=>{"use strict";d();Object.defineProperty(Et,"__esModule",{value:!0});var _8=Object.defineProperty,Rt=l((r,t)=>_8(r,"name",{value:t,configurable:!0}),"__name"),Yt=b3();function In(r,t,e){if(r!==null)for(var i,n,o,a,u,s,p,f=0,m=0,y,x=r.type,S=x==="FeatureCollection",M=x==="Feature",g=S?r.features.length:1,C=0;C<g;C++){p=S?r.features[C].geometry:M?r.geometry:r,y=p?p.type==="GeometryCollection":!1,u=y?p.geometries.length:1;for(var I=0;I<u;I++){var T=0,w=0;if(a=y?p.geometries[I]:p,a!==null){s=a.coordinates;var L=a.type;switch(f=e&&(L==="Polygon"||L==="MultiPolygon")?1:0,L){case null:break;case"Point":if(t(s,m,C,T,w)===!1)return!1;m++,T++;break;case"LineString":case"MultiPoint":for(i=0;i<s.length;i++){if(t(s[i],m,C,T,w)===!1)return!1;m++,L==="MultiPoint"&&T++}L==="LineString"&&T++;break;case"Polygon":case"MultiLineString":for(i=0;i<s.length;i++){for(n=0;n<s[i].length-f;n++){if(t(s[i][n],m,C,T,w)===!1)return!1;m++}L==="MultiLineString"&&T++,L==="Polygon"&&w++}L==="Polygon"&&T++;break;case"MultiPolygon":for(i=0;i<s.length;i++){for(w=0,n=0;n<s[i].length;n++){for(o=0;o<s[i][n].length-f;o++){if(t(s[i][n][o],m,C,T,w)===!1)return!1;m++}w++}T++}break;case"GeometryCollection":for(i=0;i<a.geometries.length;i++)if(In(a.geometries[i],t,e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}l(In,"coordEach");Rt(In,"coordEach");function C3(r,t,e,i){var n=e;return In(r,function(o,a,u,s,p){a===0&&e===void 0?n=o:n=t(n,o,a,u,s,p)},i),n}l(C3,"coordReduce");Rt(C3,"coordReduce");function _h(r,t){var e;switch(r.type){case"FeatureCollection":for(e=0;e<r.features.length&&t(r.features[e].properties,e)!==!1;e++);break;case"Feature":t(r.properties,0);break}}l(_h,"propEach");Rt(_h,"propEach");function x3(r,t,e){var i=e;return _h(r,function(n,o){o===0&&e===void 0?i=n:i=t(i,n,o)}),i}l(x3,"propReduce");Rt(x3,"propReduce");function Dh(r,t){if(r.type==="Feature")t(r,0);else if(r.type==="FeatureCollection")for(var e=0;e<r.features.length&&t(r.features[e],e)!==!1;e++);}l(Dh,"featureEach");Rt(Dh,"featureEach");function S3(r,t,e){var i=e;return Dh(r,function(n,o){o===0&&e===void 0?i=n:i=t(i,n,o)}),i}l(S3,"featureReduce");Rt(S3,"featureReduce");function M3(r){var t=[];return In(r,function(e){t.push(e)}),t}l(M3,"coordAll");Rt(M3,"coordAll");function $l(r,t){var e,i,n,o,a,u,s,p,f,m,y=0,x=r.type==="FeatureCollection",S=r.type==="Feature",M=x?r.features.length:1;for(e=0;e<M;e++){for(u=x?r.features[e].geometry:S?r.geometry:r,p=x?r.features[e].properties:S?r.properties:{},f=x?r.features[e].bbox:S?r.bbox:void 0,m=x?r.features[e].id:S?r.id:void 0,s=u?u.type==="GeometryCollection":!1,a=s?u.geometries.length:1,n=0;n<a;n++){if(o=s?u.geometries[n]:u,o===null){if(t(null,y,p,f,m)===!1)return!1;continue}switch(o.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(t(o,y,p,f,m)===!1)return!1;break}case"GeometryCollection":{for(i=0;i<o.geometries.length;i++)if(t(o.geometries[i],y,p,f,m)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}y++}}l($l,"geomEach");Rt($l,"geomEach");function P3(r,t,e){var i=e;return $l(r,function(n,o,a,u,s){o===0&&e===void 0?i=n:i=t(i,n,o,a,u,s)}),i}l(P3,"geomReduce");Rt(P3,"geomReduce");function zo(r,t){$l(r,function(e,i,n,o,a){var u=e===null?null:e.type;switch(u){case null:case"Point":case"LineString":case"Polygon":return t(Yt.feature.call(void 0,e,n,{bbox:o,id:a}),i,0)===!1?!1:void 0}var s;switch(u){case"MultiPoint":s="Point";break;case"MultiLineString":s="LineString";break;case"MultiPolygon":s="Polygon";break}for(var p=0;p<e.coordinates.length;p++){var f=e.coordinates[p],m={type:s,coordinates:f};if(t(Yt.feature.call(void 0,m,n),i,p)===!1)return!1}})}l(zo,"flattenEach");Rt(zo,"flattenEach");function w3(r,t,e){var i=e;return zo(r,function(n,o,a){o===0&&a===0&&e===void 0?i=n:i=t(i,n,o,a)}),i}l(w3,"flattenReduce");Rt(w3,"flattenReduce");function Oh(r,t){zo(r,function(e,i,n){var o=0;if(e.geometry){var a=e.geometry.type;if(!(a==="Point"||a==="MultiPoint")){var u,s=0,p=0,f=0;if(In(e,function(m,y,x,S,M){if(u===void 0||i>s||S>p||M>f){u=m,s=i,p=S,f=M,o=0;return}var g=Yt.lineString.call(void 0,[u,m],e.properties);if(t(g,i,n,M,o)===!1)return!1;o++,u=m})===!1)return!1}}})}l(Oh,"segmentEach");Rt(Oh,"segmentEach");function T3(r,t,e){var i=e,n=!1;return Oh(r,function(o,a,u,s,p){n===!1&&e===void 0?i=o:i=t(i,o,a,u,s,p),n=!0}),i}l(T3,"segmentReduce");Rt(T3,"segmentReduce");function Ah(r,t){if(!r)throw new Error("geojson is required");zo(r,function(e,i,n){if(e.geometry!==null){var o=e.geometry.type,a=e.geometry.coordinates;switch(o){case"LineString":if(t(e,i,n,0,0)===!1)return!1;break;case"Polygon":for(var u=0;u<a.length;u++)if(t(Yt.lineString.call(void 0,a[u],e.properties),i,n,u)===!1)return!1;break}}})}l(Ah,"lineEach");Rt(Ah,"lineEach");function I3(r,t,e){var i=e;return Ah(r,function(n,o,a,u){o===0&&e===void 0?i=n:i=t(i,n,o,a,u)}),i}l(I3,"lineReduce");Rt(I3,"lineReduce");function E3(r,t){if(t=t||{},!Yt.isObject.call(void 0,t))throw new Error("options is invalid");var e=t.featureIndex||0,i=t.multiFeatureIndex||0,n=t.geometryIndex||0,o=t.segmentIndex||0,a=t.properties,u;switch(r.type){case"FeatureCollection":e<0&&(e=r.features.length+e),a=a||r.features[e].properties,u=r.features[e].geometry;break;case"Feature":a=a||r.properties,u=r.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":u=r;break;default:throw new Error("geojson is invalid")}if(u===null)return null;var s=u.coordinates;switch(u.type){case"Point":case"MultiPoint":return null;case"LineString":return o<0&&(o=s.length+o-1),Yt.lineString.call(void 0,[s[o],s[o+1]],a,t);case"Polygon":return n<0&&(n=s.length+n),o<0&&(o=s[n].length+o-1),Yt.lineString.call(void 0,[s[n][o],s[n][o+1]],a,t);case"MultiLineString":return i<0&&(i=s.length+i),o<0&&(o=s[i].length+o-1),Yt.lineString.call(void 0,[s[i][o],s[i][o+1]],a,t);case"MultiPolygon":return i<0&&(i=s.length+i),n<0&&(n=s[i].length+n),o<0&&(o=s[i][n].length-o-1),Yt.lineString.call(void 0,[s[i][n][o],s[i][n][o+1]],a,t)}throw new Error("geojson is invalid")}l(E3,"findSegment");Rt(E3,"findSegment");function L3(r,t){if(t=t||{},!Yt.isObject.call(void 0,t))throw new Error("options is invalid");var e=t.featureIndex||0,i=t.multiFeatureIndex||0,n=t.geometryIndex||0,o=t.coordIndex||0,a=t.properties,u;switch(r.type){case"FeatureCollection":e<0&&(e=r.features.length+e),a=a||r.features[e].properties,u=r.features[e].geometry;break;case"Feature":a=a||r.properties,u=r.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":u=r;break;default:throw new Error("geojson is invalid")}if(u===null)return null;var s=u.coordinates;switch(u.type){case"Point":return Yt.point.call(void 0,s,a,t);case"MultiPoint":return i<0&&(i=s.length+i),Yt.point.call(void 0,s[i],a,t);case"LineString":return o<0&&(o=s.length+o),Yt.point.call(void 0,s[o],a,t);case"Polygon":return n<0&&(n=s.length+n),o<0&&(o=s[n].length+o),Yt.point.call(void 0,s[n][o],a,t);case"MultiLineString":return i<0&&(i=s.length+i),o<0&&(o=s[i].length+o),Yt.point.call(void 0,s[i][o],a,t);case"MultiPolygon":return i<0&&(i=s.length+i),n<0&&(n=s[i].length+n),o<0&&(o=s[i][n].length-o),Yt.point.call(void 0,s[i][n][o],a,t)}throw new Error("geojson is invalid")}l(L3,"findPoint");Rt(L3,"findPoint");Et.coordAll=M3;Et.coordEach=In;Et.coordReduce=C3;Et.featureEach=Dh;Et.featureReduce=S3;Et.findPoint=L3;Et.findSegment=E3;Et.flattenEach=zo;Et.flattenReduce=w3;Et.geomEach=$l;Et.geomReduce=P3;Et.lineEach=Ah;Et.lineReduce=I3;Et.propEach=_h;Et.propReduce=x3;Et.segmentEach=Oh;Et.segmentReduce=T3});var D3=N(Jl=>{"use strict";d();Object.defineProperty(Jl,"__esModule",{value:!0});var D8=Object.defineProperty,O8=l((r,t)=>D8(r,"name",{value:t,configurable:!0}),"__name"),A8=_3();function Nh(r,t={}){if(r.bbox!=null&&t.recompute!==!0)return r.bbox;let e=[1/0,1/0,-1/0,-1/0];return A8.coordEach.call(void 0,r,i=>{e[0]>i[0]&&(e[0]=i[0]),e[1]>i[1]&&(e[1]=i[1]),e[2]<i[0]&&(e[2]=i[0]),e[3]<i[1]&&(e[3]=i[1])}),e}l(Nh,"bbox");O8(Nh,"bbox");var N8=Nh;Jl.bbox=Nh;Jl.default=N8});var R3=N((W_,kh)=>{d();var ze=_1(),A3=rp(),N3=V1(),En=D3().default,k8=N3.featureEach,Y_=N3.coordEach,j_=A3.polygon,O3=A3.featureCollection;function k3(r){var t=new ze(r);return t.insert=function(e){if(e.type!=="Feature")throw new Error("invalid feature");return e.bbox=e.bbox?e.bbox:En(e),ze.prototype.insert.call(this,e)},t.load=function(e){var i=[];return Array.isArray(e)?e.forEach(function(n){if(n.type!=="Feature")throw new Error("invalid features");n.bbox=n.bbox?n.bbox:En(n),i.push(n)}):k8(e,function(n){if(n.type!=="Feature")throw new Error("invalid features");n.bbox=n.bbox?n.bbox:En(n),i.push(n)}),ze.prototype.load.call(this,i)},t.remove=function(e,i){if(e.type!=="Feature")throw new Error("invalid feature");return e.bbox=e.bbox?e.bbox:En(e),ze.prototype.remove.call(this,e,i)},t.clear=function(){return ze.prototype.clear.call(this)},t.search=function(e){var i=ze.prototype.search.call(this,this.toBBox(e));return O3(i)},t.collides=function(e){return ze.prototype.collides.call(this,this.toBBox(e))},t.all=function(){var e=ze.prototype.all.call(this);return O3(e)},t.toJSON=function(){return ze.prototype.toJSON.call(this)},t.fromJSON=function(e){return ze.prototype.fromJSON.call(this,e)},t.toBBox=function(e){var i;if(e.bbox)i=e.bbox;else if(Array.isArray(e)&&e.length===4)i=e;else if(Array.isArray(e)&&e.length===6)i=[e[0],e[1],e[3],e[4]];else if(e.type==="Feature")i=En(e);else if(e.type==="FeatureCollection")i=En(e);else throw new Error("invalid geojson");return{minX:i[0],minY:i[1],maxX:i[2],maxY:i[3]}},t}l(k3,"geojsonRbush");kh.exports=k3;kh.exports.default=k3});var Kn=N((Hd,Xd)=>{d();var Yd=l(function(){this._tweens={},this._tweensAddedDuringUpdate={}},"_Group");Yd.prototype={getAll:function(){return Object.keys(this._tweens).map(function(r){return this._tweens[r]}.bind(this))},removeAll:function(){this._tweens={}},add:function(r){this._tweens[r.getId()]=r,this._tweensAddedDuringUpdate[r.getId()]=r},remove:function(r){delete this._tweens[r.getId()],delete this._tweensAddedDuringUpdate[r.getId()]},update:function(r,t){var e=Object.keys(this._tweens);if(e.length===0)return!1;for(r=r!==void 0?r:at.now();e.length>0;){this._tweensAddedDuringUpdate={};for(var i=0;i<e.length;i++){var n=this._tweens[e[i]];n&&n.update(r)===!1&&(n._isPlaying=!1,t||delete this._tweens[e[i]])}e=Object.keys(this._tweensAddedDuringUpdate)}return!0}};var at=new Yd;at.Group=Yd;at._nextId=0;at.nextId=function(){return at._nextId++};typeof self>"u"&&typeof b<"u"&&b.hrtime?at.now=function(){var r=b.hrtime();return r[0]*1e3+r[1]/1e6}:typeof self<"u"&&self.performance!==void 0&&self.performance.now!==void 0?at.now=self.performance.now.bind(self.performance):Date.now!==void 0?at.now=Date.now:at.now=function(){return new Date().getTime()};at.Tween=function(r,t){this._object=r,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._repeat=0,this._repeatDelayTime=void 0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=null,this._easingFunction=at.Easing.Linear.None,this._interpolationFunction=at.Interpolation.Linear,this._chainedTweens=[],this._onStartCallback=null,this._onStartCallbackFired=!1,this._onUpdateCallback=null,this._onRepeatCallback=null,this._onCompleteCallback=null,this._onStopCallback=null,this._group=t||at,this._id=at.nextId()};at.Tween.prototype={getId:function(){return this._id},isPlaying:function(){return this._isPlaying},to:function(r,t){return this._valuesEnd=r,t!==void 0&&(this._duration=t),this},duration:l(function(t){return this._duration=t,this},"duration"),start:function(r){this._group.add(this),this._isPlaying=!0,this._onStartCallbackFired=!1,this._startTime=r!==void 0?typeof r=="string"?at.now()+parseFloat(r):r:at.now(),this._startTime+=this._delayTime;for(var t in this._valuesEnd){if(this._valuesEnd[t]instanceof Array){if(this._valuesEnd[t].length===0)continue;this._valuesEnd[t]=[this._object[t]].concat(this._valuesEnd[t])}this._object[t]!==void 0&&(this._valuesStart[t]=this._object[t],this._valuesStart[t]instanceof Array||(this._valuesStart[t]*=1),this._valuesStartRepeat[t]=this._valuesStart[t]||0)}return this},stop:function(){return this._isPlaying?(this._group.remove(this),this._isPlaying=!1,this._onStopCallback!==null&&this._onStopCallback(this._object),this.stopChainedTweens(),this):this},end:function(){return this.update(1/0),this},stopChainedTweens:function(){for(var r=0,t=this._chainedTweens.length;r<t;r++)this._chainedTweens[r].stop()},group:function(r){return this._group=r,this},delay:function(r){return this._delayTime=r,this},repeat:function(r){return this._repeat=r,this},repeatDelay:function(r){return this._repeatDelayTime=r,this},yoyo:function(r){return this._yoyo=r,this},easing:function(r){return this._easingFunction=r,this},interpolation:function(r){return this._interpolationFunction=r,this},chain:function(){return this._chainedTweens=arguments,this},onStart:function(r){return this._onStartCallback=r,this},onUpdate:function(r){return this._onUpdateCallback=r,this},onRepeat:l(function(t){return this._onRepeatCallback=t,this},"onRepeat"),onComplete:function(r){return this._onCompleteCallback=r,this},onStop:function(r){return this._onStopCallback=r,this},update:function(r){var t,e,i;if(r<this._startTime)return!0;this._onStartCallbackFired===!1&&(this._onStartCallback!==null&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),e=(r-this._startTime)/this._duration,e=this._duration===0||e>1?1:e,i=this._easingFunction(e);for(t in this._valuesEnd)if(this._valuesStart[t]!==void 0){var n=this._valuesStart[t]||0,o=this._valuesEnd[t];o instanceof Array?this._object[t]=this._interpolationFunction(o,i):(typeof o=="string"&&(o.charAt(0)==="+"||o.charAt(0)==="-"?o=n+parseFloat(o):o=parseFloat(o)),typeof o=="number"&&(this._object[t]=n+(o-n)*i))}if(this._onUpdateCallback!==null&&this._onUpdateCallback(this._object,e),e===1)if(this._repeat>0){isFinite(this._repeat)&&this._repeat--;for(t in this._valuesStartRepeat){if(typeof this._valuesEnd[t]=="string"&&(this._valuesStartRepeat[t]=this._valuesStartRepeat[t]+parseFloat(this._valuesEnd[t])),this._yoyo){var a=this._valuesStartRepeat[t];this._valuesStartRepeat[t]=this._valuesEnd[t],this._valuesEnd[t]=a}this._valuesStart[t]=this._valuesStartRepeat[t]}return this._yoyo&&(this._reversed=!this._reversed),this._repeatDelayTime!==void 0?this._startTime=r+this._repeatDelayTime:this._startTime=r+this._delayTime,this._onRepeatCallback!==null&&this._onRepeatCallback(this._object),!0}else{this._onCompleteCallback!==null&&this._onCompleteCallback(this._object);for(var u=0,s=this._chainedTweens.length;u<s;u++)this._chainedTweens[u].start(this._startTime+this._duration);return!1}return!0}};at.Easing={Linear:{None:function(r){return r}},Quadratic:{In:function(r){return r*r},Out:function(r){return r*(2-r)},InOut:function(r){return(r*=2)<1?.5*r*r:-.5*(--r*(r-2)-1)}},Cubic:{In:function(r){return r*r*r},Out:function(r){return--r*r*r+1},InOut:function(r){return(r*=2)<1?.5*r*r*r:.5*((r-=2)*r*r+2)}},Quartic:{In:function(r){return r*r*r*r},Out:function(r){return 1- --r*r*r*r},InOut:function(r){return(r*=2)<1?.5*r*r*r*r:-.5*((r-=2)*r*r*r-2)}},Quintic:{In:function(r){return r*r*r*r*r},Out:function(r){return--r*r*r*r*r+1},InOut:function(r){return(r*=2)<1?.5*r*r*r*r*r:.5*((r-=2)*r*r*r*r+2)}},Sinusoidal:{In:function(r){return 1-Math.cos(r*Math.PI/2)},Out:function(r){return Math.sin(r*Math.PI/2)},InOut:function(r){return .5*(1-Math.cos(Math.PI*r))}},Exponential:{In:function(r){return r===0?0:Math.pow(1024,r-1)},Out:function(r){return r===1?1:1-Math.pow(2,-10*r)},InOut:function(r){return r===0?0:r===1?1:(r*=2)<1?.5*Math.pow(1024,r-1):.5*(-Math.pow(2,-10*(r-1))+2)}},Circular:{In:function(r){return 1-Math.sqrt(1-r*r)},Out:function(r){return Math.sqrt(1- --r*r)},InOut:function(r){return(r*=2)<1?-.5*(Math.sqrt(1-r*r)-1):.5*(Math.sqrt(1-(r-=2)*r)+1)}},Elastic:{In:function(r){return r===0?0:r===1?1:-Math.pow(2,10*(r-1))*Math.sin((r-1.1)*5*Math.PI)},Out:function(r){return r===0?0:r===1?1:Math.pow(2,-10*r)*Math.sin((r-.1)*5*Math.PI)+1},InOut:function(r){return r===0?0:r===1?1:(r*=2,r<1?-.5*Math.pow(2,10*(r-1))*Math.sin((r-1.1)*5*Math.PI):.5*Math.pow(2,-10*(r-1))*Math.sin((r-1.1)*5*Math.PI)+1)}},Back:{In:function(r){var t=1.70158;return r*r*((t+1)*r-t)},Out:function(r){var t=1.70158;return--r*r*((t+1)*r+t)+1},InOut:function(r){var t=2.5949095;return(r*=2)<1?.5*(r*r*((t+1)*r-t)):.5*((r-=2)*r*((t+1)*r+t)+2)}},Bounce:{In:function(r){return 1-at.Easing.Bounce.Out(1-r)},Out:function(r){return r<1/2.75?7.5625*r*r:r<2/2.75?7.5625*(r-=1.5/2.75)*r+.75:r<2.5/2.75?7.5625*(r-=2.25/2.75)*r+.9375:7.5625*(r-=2.625/2.75)*r+.984375},InOut:function(r){return r<.5?at.Easing.Bounce.In(r*2)*.5:at.Easing.Bounce.Out(r*2-1)*.5+.5}}};at.Interpolation={Linear:function(r,t){var e=r.length-1,i=e*t,n=Math.floor(i),o=at.Interpolation.Utils.Linear;return t<0?o(r[0],r[1],i):t>1?o(r[e],r[e-1],e-i):o(r[n],r[n+1>e?e:n+1],i-n)},Bezier:function(r,t){for(var e=0,i=r.length-1,n=Math.pow,o=at.Interpolation.Utils.Bernstein,a=0;a<=i;a++)e+=n(1-t,i-a)*n(t,a)*r[a]*o(i,a);return e},CatmullRom:function(r,t){var e=r.length-1,i=e*t,n=Math.floor(i),o=at.Interpolation.Utils.CatmullRom;return r[0]===r[e]?(t<0&&(n=Math.floor(i=e*(1+t))),o(r[(n-1+e)%e],r[n],r[(n+1)%e],r[(n+2)%e],i-n)):t<0?r[0]-(o(r[0],r[0],r[1],r[1],-i)-r[0]):t>1?r[e]-(o(r[e],r[e],r[e-1],r[e-1],i-e)-r[e]):o(r[n?n-1:0],r[n],r[e<n+1?e:n+1],r[e<n+2?e:n+2],i-n)},Utils:{Linear:function(r,t,e){return(t-r)*e+r},Bernstein:function(r,t){var e=at.Interpolation.Utils.Factorial;return e(r)/e(t)/e(r-t)},Factorial:function(){var r=[1];return function(t){var e=1;if(r[t])return r[t];for(var i=t;i>1;i--)e*=i;return r[t]=e,e}}(),CatmullRom:function(r,t,e,i,n){var o=(e-r)*.5,a=(i-t)*.5,u=n*n,s=n*u;return(2*t-2*e+o+a)*s+(-3*t+3*e-2*o-a)*u+o*n+t}}};(function(r){typeof define=="function"&&define.amd?define([],function(){return at}):typeof Xd<"u"&&typeof Hd=="object"?Xd.exports=at:r!==void 0&&(r.TWEEN=at)})(Hd)});var Tb=N((Ga,ro)=>{d();var V9=200,ob="__lodash_hash_undefined__",H9=800,X9=16,ab=9007199254740991,sb="[object Arguments]",Y9="[object Array]",j9="[object AsyncFunction]",W9="[object Boolean]",U9="[object Date]",Z9="[object Error]",lb="[object Function]",z9="[object GeneratorFunction]",q9="[object Map]",$9="[object Number]",J9="[object Null]",ub="[object Object]",K9="[object Proxy]",Q9="[object RegExp]",tx="[object Set]",ex="[object String]",rx="[object Undefined]",ix="[object WeakMap]",nx="[object ArrayBuffer]",ox="[object DataView]",ax="[object Float32Array]",sx="[object Float64Array]",lx="[object Int8Array]",ux="[object Int16Array]",cx="[object Int32Array]",px="[object Uint8Array]",hx="[object Uint8ClampedArray]",dx="[object Uint16Array]",fx="[object Uint32Array]",mx=/[\\^$.*+?()[\]{}|]/g,yx=/^\[object .+?Constructor\]$/,gx=/^(?:0|[1-9]\d*)$/,pt={};pt[ax]=pt[sx]=pt[lx]=pt[ux]=pt[cx]=pt[px]=pt[hx]=pt[dx]=pt[fx]=!0;pt[sb]=pt[Y9]=pt[nx]=pt[W9]=pt[ox]=pt[U9]=pt[Z9]=pt[lb]=pt[q9]=pt[$9]=pt[ub]=pt[Q9]=pt[tx]=pt[ex]=pt[ix]=!1;var cb=typeof global=="object"&&global&&global.Object===Object&&global,vx=typeof self=="object"&&self&&self.Object===Object&&self,Xa=cb||vx||Function("return this")(),pb=typeof Ga=="object"&&Ga&&!Ga.nodeType&&Ga,Va=pb&&typeof ro=="object"&&ro&&!ro.nodeType&&ro,hb=Va&&Va.exports===pb,yf=hb&&cb.process,$v=function(){try{var r=Va&&Va.require&&Va.require("util").types;return r||yf&&yf.binding&&yf.binding("util")}catch{}}(),Jv=$v&&$v.isTypedArray;function db(r,t,e){switch(e.length){case 0:return r.call(t);case 1:return r.call(t,e[0]);case 2:return r.call(t,e[0],e[1]);case 3:return r.call(t,e[0],e[1],e[2])}return r.apply(t,e)}l(db,"apply");function bx(r,t){for(var e=-1,i=Array(r);++e<r;)i[e]=t(e);return i}l(bx,"baseTimes");function Cx(r){return function(t){return r(t)}}l(Cx,"baseUnary");function xx(r,t){return r==null?void 0:r[t]}l(xx,"getValue");function Sx(r,t){return function(e){return r(t(e))}}l(Sx,"overArg");var Mx=Array.prototype,Px=Function.prototype,Ru=Object.prototype,gf=Xa["__core-js_shared__"],Bu=Px.toString,Er=Ru.hasOwnProperty,Kv=function(){var r=/[^.]+$/.exec(gf&&gf.keys&&gf.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""}(),fb=Ru.toString,wx=Bu.call(Object),Tx=RegExp("^"+Bu.call(Er).replace(mx,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Nu=hb?Xa.Buffer:void 0,Qv=Xa.Symbol,tb=Xa.Uint8Array,eb=Nu?Nu.allocUnsafe:void 0,mb=Sx(Object.getPrototypeOf,Object),rb=Object.create,Ix=Ru.propertyIsEnumerable,Ex=Mx.splice,Ui=Qv?Qv.toStringTag:void 0,ku=function(){try{var r=Pf(Object,"defineProperty");return r({},"",{}),r}catch{}}(),Lx=Nu?Nu.isBuffer:void 0,ib=Math.max,_x=Date.now,yb=Pf(Xa,"Map"),Ha=Pf(Object,"create"),Dx=function(){function r(){}return l(r,"object"),function(t){if(!Ir(t))return{};if(rb)return rb(t);r.prototype=t;var e=new r;return r.prototype=void 0,e}}();function Zi(r){var t=-1,e=r==null?0:r.length;for(this.clear();++t<e;){var i=r[t];this.set(i[0],i[1])}}l(Zi,"Hash");function Ox(){this.__data__=Ha?Ha(null):{},this.size=0}l(Ox,"hashClear");function Ax(r){var t=this.has(r)&&delete this.__data__[r];return this.size-=t?1:0,t}l(Ax,"hashDelete");function Nx(r){var t=this.__data__;if(Ha){var e=t[r];return e===ob?void 0:e}return Er.call(t,r)?t[r]:void 0}l(Nx,"hashGet");function kx(r){var t=this.__data__;return Ha?t[r]!==void 0:Er.call(t,r)}l(kx,"hashHas");function Rx(r,t){var e=this.__data__;return this.size+=this.has(r)?0:1,e[r]=Ha&&t===void 0?ob:t,this}l(Rx,"hashSet");Zi.prototype.clear=Ox;Zi.prototype.delete=Ax;Zi.prototype.get=Nx;Zi.prototype.has=kx;Zi.prototype.set=Rx;function Lr(r){var t=-1,e=r==null?0:r.length;for(this.clear();++t<e;){var i=r[t];this.set(i[0],i[1])}}l(Lr,"ListCache");function Bx(){this.__data__=[],this.size=0}l(Bx,"listCacheClear");function Fx(r){var t=this.__data__,e=Fu(t,r);if(e<0)return!1;var i=t.length-1;return e==i?t.pop():Ex.call(t,e,1),--this.size,!0}l(Fx,"listCacheDelete");function Gx(r){var t=this.__data__,e=Fu(t,r);return e<0?void 0:t[e][1]}l(Gx,"listCacheGet");function Vx(r){return Fu(this.__data__,r)>-1}l(Vx,"listCacheHas");function Hx(r,t){var e=this.__data__,i=Fu(e,r);return i<0?(++this.size,e.push([r,t])):e[i][1]=t,this}l(Hx,"listCacheSet");Lr.prototype.clear=Bx;Lr.prototype.delete=Fx;Lr.prototype.get=Gx;Lr.prototype.has=Vx;Lr.prototype.set=Hx;function io(r){var t=-1,e=r==null?0:r.length;for(this.clear();++t<e;){var i=r[t];this.set(i[0],i[1])}}l(io,"MapCache");function Xx(){this.size=0,this.__data__={hash:new Zi,map:new(yb||Lr),string:new Zi}}l(Xx,"mapCacheClear");function Yx(r){var t=Vu(this,r).delete(r);return this.size-=t?1:0,t}l(Yx,"mapCacheDelete");function jx(r){return Vu(this,r).get(r)}l(jx,"mapCacheGet");function Wx(r){return Vu(this,r).has(r)}l(Wx,"mapCacheHas");function Ux(r,t){var e=Vu(this,r),i=e.size;return e.set(r,t),this.size+=e.size==i?0:1,this}l(Ux,"mapCacheSet");io.prototype.clear=Xx;io.prototype.delete=Yx;io.prototype.get=jx;io.prototype.has=Wx;io.prototype.set=Ux;function no(r){var t=this.__data__=new Lr(r);this.size=t.size}l(no,"Stack");function Zx(){this.__data__=new Lr,this.size=0}l(Zx,"stackClear");function zx(r){var t=this.__data__,e=t.delete(r);return this.size=t.size,e}l(zx,"stackDelete");function qx(r){return this.__data__.get(r)}l(qx,"stackGet");function $x(r){return this.__data__.has(r)}l($x,"stackHas");function Jx(r,t){var e=this.__data__;if(e instanceof Lr){var i=e.__data__;if(!yb||i.length<V9-1)return i.push([r,t]),this.size=++e.size,this;e=this.__data__=new io(i)}return e.set(r,t),this.size=e.size,this}l(Jx,"stackSet");no.prototype.clear=Zx;no.prototype.delete=zx;no.prototype.get=qx;no.prototype.has=$x;no.prototype.set=Jx;function Kx(r,t){var e=xf(r),i=!e&&Cf(r),n=!e&&!i&&xb(r),o=!e&&!i&&!n&&Mb(r),a=e||i||n||o,u=a?bx(r.length,String):[],s=u.length;for(var p in r)(t||Er.call(r,p))&&!(a&&(p=="length"||n&&(p=="offset"||p=="parent")||o&&(p=="buffer"||p=="byteLength"||p=="byteOffset")||bb(p,s)))&&u.push(p);return u}l(Kx,"arrayLikeKeys");function vf(r,t,e){(e!==void 0&&!Hu(r[t],e)||e===void 0&&!(t in r))&&Sf(r,t,e)}l(vf,"assignMergeValue");function Qx(r,t,e){var i=r[t];(!(Er.call(r,t)&&Hu(i,e))||e===void 0&&!(t in r))&&Sf(r,t,e)}l(Qx,"assignValue");function Fu(r,t){for(var e=r.length;e--;)if(Hu(r[e][0],t))return e;return-1}l(Fu,"assocIndexOf");function Sf(r,t,e){t=="__proto__"&&ku?ku(r,t,{configurable:!0,enumerable:!0,value:e,writable:!0}):r[t]=e}l(Sf,"baseAssignValue");var tS=hS();function Gu(r){return r==null?r===void 0?rx:J9:Ui&&Ui in Object(r)?dS(r):bS(r)}l(Gu,"baseGetTag");function nb(r){return Ya(r)&&Gu(r)==sb}l(nb,"baseIsArguments");function eS(r){if(!Ir(r)||gS(r))return!1;var t=Tf(r)?Tx:yx;return t.test(MS(r))}l(eS,"baseIsNative");function rS(r){return Ya(r)&&Sb(r.length)&&!!pt[Gu(r)]}l(rS,"baseIsTypedArray");function iS(r){if(!Ir(r))return vS(r);var t=Cb(r),e=[];for(var i in r)i=="constructor"&&(t||!Er.call(r,i))||e.push(i);return e}l(iS,"baseKeysIn");function Mf(r,t,e,i,n){r!==t&&tS(t,function(o,a){if(n||(n=new no),Ir(o))nS(r,t,a,e,Mf,i,n);else{var u=i?i(bf(r,a),o,a+"",r,t,n):void 0;u===void 0&&(u=o),vf(r,a,u)}},Pb)}l(Mf,"baseMerge");function nS(r,t,e,i,n,o,a){var u=bf(r,e),s=bf(t,e),p=a.get(s);if(p){vf(r,e,p);return}var f=o?o(u,s,e+"",r,t,a):void 0,m=f===void 0;if(m){var y=xf(s),x=!y&&xb(s),S=!y&&!x&&Mb(s);f=s,y||x||S?xf(u)?f=u:PS(u)?f=uS(u):x?(m=!1,f=aS(s,!0)):S?(m=!1,f=lS(s,!0)):f=[]:wS(s)||Cf(s)?(f=u,Cf(u)?f=TS(u):(!Ir(u)||Tf(u))&&(f=fS(s))):m=!1}m&&(a.set(s,f),n(f,s,i,o,a),a.delete(s)),vf(r,e,f)}l(nS,"baseMergeDeep");function gb(r,t){return xS(CS(r,t,wb),r+"")}l(gb,"baseRest");var oS=ku?function(r,t){return ku(r,"toString",{configurable:!0,enumerable:!1,value:LS(t),writable:!0})}:wb;function aS(r,t){if(t)return r.slice();var e=r.length,i=eb?eb(e):new r.constructor(e);return r.copy(i),i}l(aS,"cloneBuffer");function sS(r){var t=new r.constructor(r.byteLength);return new tb(t).set(new tb(r)),t}l(sS,"cloneArrayBuffer");function lS(r,t){var e=t?sS(r.buffer):r.buffer;return new r.constructor(e,r.byteOffset,r.length)}l(lS,"cloneTypedArray");function uS(r,t){var e=-1,i=r.length;for(t||(t=Array(i));++e<i;)t[e]=r[e];return t}l(uS,"copyArray");function cS(r,t,e,i){var n=!e;e||(e={});for(var o=-1,a=t.length;++o<a;){var u=t[o],s=i?i(e[u],r[u],u,e,r):void 0;s===void 0&&(s=r[u]),n?Sf(e,u,s):Qx(e,u,s)}return e}l(cS,"copyObject");function pS(r){return gb(function(t,e){var i=-1,n=e.length,o=n>1?e[n-1]:void 0,a=n>2?e[2]:void 0;for(o=r.length>3&&typeof o=="function"?(n--,o):void 0,a&&mS(e[0],e[1],a)&&(o=n<3?void 0:o,n=1),t=Object(t);++i<n;){var u=e[i];u&&r(t,u,i,o)}return t})}l(pS,"createAssigner");function hS(r){return function(t,e,i){for(var n=-1,o=Object(t),a=i(t),u=a.length;u--;){var s=a[r?u:++n];if(e(o[s],s,o)===!1)break}return t}}l(hS,"createBaseFor");function vb(r,t,e,i,n,o){return Ir(r)&&Ir(t)&&(o.set(t,r),Mf(r,t,void 0,vb,o),o.delete(t)),r}l(vb,"customDefaultsMerge");function Vu(r,t){var e=r.__data__;return yS(t)?e[typeof t=="string"?"string":"hash"]:e.map}l(Vu,"getMapData");function Pf(r,t){var e=xx(r,t);return eS(e)?e:void 0}l(Pf,"getNative");function dS(r){var t=Er.call(r,Ui),e=r[Ui];try{r[Ui]=void 0;var i=!0}catch{}var n=fb.call(r);return i&&(t?r[Ui]=e:delete r[Ui]),n}l(dS,"getRawTag");function fS(r){return typeof r.constructor=="function"&&!Cb(r)?Dx(mb(r)):{}}l(fS,"initCloneObject");function bb(r,t){var e=typeof r;return t=t==null?ab:t,!!t&&(e=="number"||e!="symbol"&&gx.test(r))&&r>-1&&r%1==0&&r<t}l(bb,"isIndex");function mS(r,t,e){if(!Ir(e))return!1;var i=typeof t;return(i=="number"?wf(e)&&bb(t,e.length):i=="string"&&t in e)?Hu(e[t],r):!1}l(mS,"isIterateeCall");function yS(r){var t=typeof r;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?r!=="__proto__":r===null}l(yS,"isKeyable");function gS(r){return!!Kv&&Kv in r}l(gS,"isMasked");function Cb(r){var t=r&&r.constructor,e=typeof t=="function"&&t.prototype||Ru;return r===e}l(Cb,"isPrototype");function vS(r){var t=[];if(r!=null)for(var e in Object(r))t.push(e);return t}l(vS,"nativeKeysIn");function bS(r){return fb.call(r)}l(bS,"objectToString");function CS(r,t,e){return t=ib(t===void 0?r.length-1:t,0),function(){for(var i=arguments,n=-1,o=ib(i.length-t,0),a=Array(o);++n<o;)a[n]=i[t+n];n=-1;for(var u=Array(t+1);++n<t;)u[n]=i[n];return u[t]=e(a),db(r,this,u)}}l(CS,"overRest");function bf(r,t){if(!(t==="constructor"&&typeof r[t]=="function")&&t!="__proto__")return r[t]}l(bf,"safeGet");var xS=SS(oS);function SS(r){var t=0,e=0;return function(){var i=_x(),n=X9-(i-e);if(e=i,n>0){if(++t>=H9)return arguments[0]}else t=0;return r.apply(void 0,arguments)}}l(SS,"shortOut");function MS(r){if(r!=null){try{return Bu.call(r)}catch{}try{return r+""}catch{}}return""}l(MS,"toSource");function Hu(r,t){return r===t||r!==r&&t!==t}l(Hu,"eq");var Cf=nb(function(){return arguments}())?nb:function(r){return Ya(r)&&Er.call(r,"callee")&&!Ix.call(r,"callee")},xf=Array.isArray;function wf(r){return r!=null&&Sb(r.length)&&!Tf(r)}l(wf,"isArrayLike");function PS(r){return Ya(r)&&wf(r)}l(PS,"isArrayLikeObject");var xb=Lx||_S;function Tf(r){if(!Ir(r))return!1;var t=Gu(r);return t==lb||t==z9||t==j9||t==K9}l(Tf,"isFunction");function Sb(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=ab}l(Sb,"isLength");function Ir(r){var t=typeof r;return r!=null&&(t=="object"||t=="function")}l(Ir,"isObject");function Ya(r){return r!=null&&typeof r=="object"}l(Ya,"isObjectLike");function wS(r){if(!Ya(r)||Gu(r)!=ub)return!1;var t=mb(r);if(t===null)return!0;var e=Er.call(t,"constructor")&&t.constructor;return typeof e=="function"&&e instanceof e&&Bu.call(e)==wx}l(wS,"isPlainObject");var Mb=Jv?Cx(Jv):rS;function TS(r){return cS(r,Pb(r))}l(TS,"toPlainObject");var IS=gb(function(r){return r.push(void 0,vb),db(ES,void 0,r)});function Pb(r){return wf(r)?Kx(r,!0):iS(r)}l(Pb,"keysIn");var ES=pS(function(r,t,e,i){Mf(r,t,e,i)});function LS(r){return function(){return r}}l(LS,"constant");function wb(r){return r}l(wb,"identity");function _S(){return!1}l(_S,"stubFalse");ro.exports=IS});var a4=N((sX,Ja)=>{"use strict";d();var qS=!1,Ki=!1,Qb=!0,t4=!1,h={},e4=!1;typeof Ja<"u"&&Ja.exports?(Ja.exports=h,e4=!0):typeof document<"u"?window.ClipperLib=h:self.ClipperLib=h;var Qu;e4?(Ot="chrome",Qu="Netscape"):(Ot=navigator.userAgent.toString().toLowerCase(),Qu=navigator.appName);var Ot,z={};Ot.indexOf("chrome")!=-1&&Ot.indexOf("chromium")==-1?z.chrome=1:z.chrome=0;Ot.indexOf("chromium")!=-1?z.chromium=1:z.chromium=0;Ot.indexOf("safari")!=-1&&Ot.indexOf("chrome")==-1&&Ot.indexOf("chromium")==-1?z.safari=1:z.safari=0;Ot.indexOf("firefox")!=-1?z.firefox=1:z.firefox=0;Ot.indexOf("firefox/17")!=-1?z.firefox17=1:z.firefox17=0;Ot.indexOf("firefox/15")!=-1?z.firefox15=1:z.firefox15=0;Ot.indexOf("firefox/3")!=-1?z.firefox3=1:z.firefox3=0;Ot.indexOf("opera")!=-1?z.opera=1:z.opera=0;Ot.indexOf("msie 10")!=-1?z.msie10=1:z.msie10=0;Ot.indexOf("msie 9")!=-1?z.msie9=1:z.msie9=0;Ot.indexOf("msie 8")!=-1?z.msie8=1:z.msie8=0;Ot.indexOf("msie 7")!=-1?z.msie7=1:z.msie7=0;Ot.indexOf("msie ")!=-1?z.msie=1:z.msie=0;h.biginteger_used=null;var li,$S=0xdeadbeefcafe,Jb=($S&16777215)==15715070;function O(r,t,e){h.biginteger_used=1,r!=null&&(typeof r=="number"&&typeof t>"u"?this.fromInt(r):typeof r=="number"?this.fromNumber(r,t,e):t==null&&typeof r!="string"?this.fromString(r,256):this.fromString(r,t))}l(O,"BigInteger");function K(){return new O(null)}l(K,"nbi");function JS(r,t,e,i,n,o){for(;--o>=0;){var a=t*this[r++]+e[i]+n;n=Math.floor(a/67108864),e[i++]=a&67108863}return n}l(JS,"am1");function KS(r,t,e,i,n,o){for(var a=t&32767,u=t>>15;--o>=0;){var s=this[r]&32767,p=this[r++]>>15,f=u*s+p*a;s=a*s+((f&32767)<<15)+e[i]+(n&1073741823),n=(s>>>30)+(f>>>15)+u*p+(n>>>30),e[i++]=s&1073741823}return n}l(KS,"am2");function QS(r,t,e,i,n,o){for(var a=t&16383,u=t>>14;--o>=0;){var s=this[r]&16383,p=this[r++]>>14,f=u*s+p*a;s=a*s+((f&16383)<<14)+e[i]+n,n=(s>>28)+(f>>14)+u*p,e[i++]=s&268435455}return n}l(QS,"am3");Jb&&Qu=="Microsoft Internet Explorer"?(O.prototype.am=KS,li=30):Jb&&Qu!="Netscape"?(O.prototype.am=JS,li=26):(O.prototype.am=QS,li=28);O.prototype.DB=li;O.prototype.DM=(1<<li)-1;O.prototype.DV=1<<li;var Yf=52;O.prototype.FV=Math.pow(2,Yf);O.prototype.F1=Yf-li;O.prototype.F2=2*li-Yf;var tM="0123456789abcdefghijklmnopqrstuvwxyz",ec=new Array,uo,be;uo=48;for(be=0;be<=9;++be)ec[uo++]=be;uo=97;for(be=10;be<36;++be)ec[uo++]=be;uo=65;for(be=10;be<36;++be)ec[uo++]=be;function Kb(r){return tM.charAt(r)}l(Kb,"int2char");function r4(r,t){var e=ec[r.charCodeAt(t)];return e==null?-1:e}l(r4,"intAt");function eM(r){for(var t=this.t-1;t>=0;--t)r[t]=this[t];r.t=this.t,r.s=this.s}l(eM,"bnpCopyTo");function rM(r){this.t=1,this.s=r<0?-1:0,r>0?this[0]=r:r<-1?this[0]=r+this.DV:this.t=0}l(rM,"bnpFromInt");function si(r){var t=K();return t.fromInt(r),t}l(si,"nbv");function iM(r,t){var e;if(t==16)e=4;else if(t==8)e=3;else if(t==256)e=8;else if(t==2)e=1;else if(t==32)e=5;else if(t==4)e=2;else{this.fromRadix(r,t);return}this.t=0,this.s=0;for(var i=r.length,n=!1,o=0;--i>=0;){var a=e==8?r[i]&255:r4(r,i);if(a<0){r.charAt(i)=="-"&&(n=!0);continue}n=!1,o==0?this[this.t++]=a:o+e>this.DB?(this[this.t-1]|=(a&(1<<this.DB-o)-1)<<o,this[this.t++]=a>>this.DB-o):this[this.t-1]|=a<<o,o+=e,o>=this.DB&&(o-=this.DB)}e==8&&r[0]&128&&(this.s=-1,o>0&&(this[this.t-1]|=(1<<this.DB-o)-1<<o)),this.clamp(),n&&O.ZERO.subTo(this,this)}l(iM,"bnpFromString");function nM(){for(var r=this.s&this.DM;this.t>0&&this[this.t-1]==r;)--this.t}l(nM,"bnpClamp");function oM(r){if(this.s<0)return"-"+this.negate().toString(r);var t;if(r==16)t=4;else if(r==8)t=3;else if(r==2)t=1;else if(r==32)t=5;else if(r==4)t=2;else return this.toRadix(r);var e=(1<<t)-1,i,n=!1,o="",a=this.t,u=this.DB-a*this.DB%t;if(a-- >0)for(u<this.DB&&(i=this[a]>>u)>0&&(n=!0,o=Kb(i));a>=0;)u<t?(i=(this[a]&(1<<u)-1)<<t-u,i|=this[--a]>>(u+=this.DB-t)):(i=this[a]>>(u-=t)&e,u<=0&&(u+=this.DB,--a)),i>0&&(n=!0),n&&(o+=Kb(i));return n?o:"0"}l(oM,"bnToString");function aM(){var r=K();return O.ZERO.subTo(this,r),r}l(aM,"bnNegate");function sM(){return this.s<0?this.negate():this}l(sM,"bnAbs");function lM(r){var t=this.s-r.s;if(t!=0)return t;var e=this.t;if(t=e-r.t,t!=0)return this.s<0?-t:t;for(;--e>=0;)if((t=this[e]-r[e])!=0)return t;return 0}l(lM,"bnCompareTo");function rc(r){var t=1,e;return(e=r>>>16)!=0&&(r=e,t+=16),(e=r>>8)!=0&&(r=e,t+=8),(e=r>>4)!=0&&(r=e,t+=4),(e=r>>2)!=0&&(r=e,t+=2),(e=r>>1)!=0&&(r=e,t+=1),t}l(rc,"nbits");function uM(){return this.t<=0?0:this.DB*(this.t-1)+rc(this[this.t-1]^this.s&this.DM)}l(uM,"bnBitLength");function cM(r,t){var e;for(e=this.t-1;e>=0;--e)t[e+r]=this[e];for(e=r-1;e>=0;--e)t[e]=0;t.t=this.t+r,t.s=this.s}l(cM,"bnpDLShiftTo");function pM(r,t){for(var e=r;e<this.t;++e)t[e-r]=this[e];t.t=Math.max(this.t-r,0),t.s=this.s}l(pM,"bnpDRShiftTo");function hM(r,t){var e=r%this.DB,i=this.DB-e,n=(1<<i)-1,o=Math.floor(r/this.DB),a=this.s<<e&this.DM,u;for(u=this.t-1;u>=0;--u)t[u+o+1]=this[u]>>i|a,a=(this[u]&n)<<e;for(u=o-1;u>=0;--u)t[u]=0;t[o]=a,t.t=this.t+o+1,t.s=this.s,t.clamp()}l(hM,"bnpLShiftTo");function dM(r,t){t.s=this.s;var e=Math.floor(r/this.DB);if(e>=this.t){t.t=0;return}var i=r%this.DB,n=this.DB-i,o=(1<<i)-1;t[0]=this[e]>>i;for(var a=e+1;a<this.t;++a)t[a-e-1]|=(this[a]&o)<<n,t[a-e]=this[a]>>i;i>0&&(t[this.t-e-1]|=(this.s&o)<<n),t.t=this.t-e,t.clamp()}l(dM,"bnpRShiftTo");function fM(r,t){for(var e=0,i=0,n=Math.min(r.t,this.t);e<n;)i+=this[e]-r[e],t[e++]=i&this.DM,i>>=this.DB;if(r.t<this.t){for(i-=r.s;e<this.t;)i+=this[e],t[e++]=i&this.DM,i>>=this.DB;i+=this.s}else{for(i+=this.s;e<r.t;)i-=r[e],t[e++]=i&this.DM,i>>=this.DB;i-=r.s}t.s=i<0?-1:0,i<-1?t[e++]=this.DV+i:i>0&&(t[e++]=i),t.t=e,t.clamp()}l(fM,"bnpSubTo");function mM(r,t){var e=this.abs(),i=r.abs(),n=e.t;for(t.t=n+i.t;--n>=0;)t[n]=0;for(n=0;n<i.t;++n)t[n+e.t]=e.am(0,i[n],t,n,0,e.t);t.s=0,t.clamp(),this.s!=r.s&&O.ZERO.subTo(t,t)}l(mM,"bnpMultiplyTo");function yM(r){for(var t=this.abs(),e=r.t=2*t.t;--e>=0;)r[e]=0;for(e=0;e<t.t-1;++e){var i=t.am(e,t[e],r,2*e,0,1);(r[e+t.t]+=t.am(e+1,2*t[e],r,2*e+1,i,t.t-e-1))>=t.DV&&(r[e+t.t]-=t.DV,r[e+t.t+1]=1)}r.t>0&&(r[r.t-1]+=t.am(e,t[e],r,2*e,0,1)),r.s=0,r.clamp()}l(yM,"bnpSquareTo");function gM(r,t,e){var i=r.abs();if(!(i.t<=0)){var n=this.abs();if(n.t<i.t){t!=null&&t.fromInt(0),e!=null&&this.copyTo(e);return}e==null&&(e=K());var o=K(),a=this.s,u=r.s,s=this.DB-rc(i[i.t-1]);s>0?(i.lShiftTo(s,o),n.lShiftTo(s,e)):(i.copyTo(o),n.copyTo(e));var p=o.t,f=o[p-1];if(f!=0){var m=f*(1<<this.F1)+(p>1?o[p-2]>>this.F2:0),y=this.FV/m,x=(1<<this.F1)/m,S=1<<this.F2,M=e.t,g=M-p,C=t==null?K():t;for(o.dlShiftTo(g,C),e.compareTo(C)>=0&&(e[e.t++]=1,e.subTo(C,e)),O.ONE.dlShiftTo(p,C),C.subTo(o,o);o.t<p;)o[o.t++]=0;for(;--g>=0;){var I=e[--M]==f?this.DM:Math.floor(e[M]*y+(e[M-1]+S)*x);if((e[M]+=o.am(0,I,e,g,0,p))<I)for(o.dlShiftTo(g,C),e.subTo(C,e);e[M]<--I;)e.subTo(C,e)}t!=null&&(e.drShiftTo(p,t),a!=u&&O.ZERO.subTo(t,t)),e.t=p,e.clamp(),s>0&&e.rShiftTo(s,e),a<0&&O.ZERO.subTo(e,e)}}}l(gM,"bnpDivRemTo");function vM(r){var t=K();return this.abs().divRemTo(r,null,t),this.s<0&&t.compareTo(O.ZERO)>0&&r.subTo(t,t),t}l(vM,"bnMod");function Qi(r){this.m=r}l(Qi,"Classic");function bM(r){return r.s<0||r.compareTo(this.m)>=0?r.mod(this.m):r}l(bM,"cConvert");function CM(r){return r}l(CM,"cRevert");function xM(r){r.divRemTo(this.m,null,r)}l(xM,"cReduce");function SM(r,t,e){r.multiplyTo(t,e),this.reduce(e)}l(SM,"cMulTo");function MM(r,t){r.squareTo(t),this.reduce(t)}l(MM,"cSqrTo");Qi.prototype.convert=bM;Qi.prototype.revert=CM;Qi.prototype.reduce=xM;Qi.prototype.mulTo=SM;Qi.prototype.sqrTo=MM;function PM(){if(this.t<1)return 0;var r=this[0];if(!(r&1))return 0;var t=r&3;return t=t*(2-(r&15)*t)&15,t=t*(2-(r&255)*t)&255,t=t*(2-((r&65535)*t&65535))&65535,t=t*(2-r*t%this.DV)%this.DV,t>0?this.DV-t:-t}l(PM,"bnpInvDigit");function tn(r){this.m=r,this.mp=r.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<r.DB-15)-1,this.mt2=2*r.t}l(tn,"Montgomery");function wM(r){var t=K();return r.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),r.s<0&&t.compareTo(O.ZERO)>0&&this.m.subTo(t,t),t}l(wM,"montConvert");function TM(r){var t=K();return r.copyTo(t),this.reduce(t),t}l(TM,"montRevert");function IM(r){for(;r.t<=this.mt2;)r[r.t++]=0;for(var t=0;t<this.m.t;++t){var e=r[t]&32767,i=e*this.mpl+((e*this.mph+(r[t]>>15)*this.mpl&this.um)<<15)&r.DM;for(e=t+this.m.t,r[e]+=this.m.am(0,i,r,t,0,this.m.t);r[e]>=r.DV;)r[e]-=r.DV,r[++e]++}r.clamp(),r.drShiftTo(this.m.t,r),r.compareTo(this.m)>=0&&r.subTo(this.m,r)}l(IM,"montReduce");function EM(r,t){r.squareTo(t),this.reduce(t)}l(EM,"montSqrTo");function LM(r,t,e){r.multiplyTo(t,e),this.reduce(e)}l(LM,"montMulTo");tn.prototype.convert=wM;tn.prototype.revert=TM;tn.prototype.reduce=IM;tn.prototype.mulTo=LM;tn.prototype.sqrTo=EM;function _M(){return(this.t>0?this[0]&1:this.s)==0}l(_M,"bnpIsEven");function DM(r,t){if(r>4294967295||r<1)return O.ONE;var e=K(),i=K(),n=t.convert(this),o=rc(r)-1;for(n.copyTo(e);--o>=0;)if(t.sqrTo(e,i),(r&1<<o)>0)t.mulTo(i,n,e);else{var a=e;e=i,i=a}return t.revert(e)}l(DM,"bnpExp");function OM(r,t){var e;return r<256||t.isEven()?e=new Qi(t):e=new tn(t),this.exp(r,e)}l(OM,"bnModPowInt");O.prototype.copyTo=eM;O.prototype.fromInt=rM;O.prototype.fromString=iM;O.prototype.clamp=nM;O.prototype.dlShiftTo=cM;O.prototype.drShiftTo=pM;O.prototype.lShiftTo=hM;O.prototype.rShiftTo=dM;O.prototype.subTo=fM;O.prototype.multiplyTo=mM;O.prototype.squareTo=yM;O.prototype.divRemTo=gM;O.prototype.invDigit=PM;O.prototype.isEven=_M;O.prototype.exp=DM;O.prototype.toString=oM;O.prototype.negate=aM;O.prototype.abs=sM;O.prototype.compareTo=lM;O.prototype.bitLength=uM;O.prototype.mod=vM;O.prototype.modPowInt=OM;O.ZERO=si(0);O.ONE=si(1);function AM(){var r=K();return this.copyTo(r),r}l(AM,"bnClone");function NM(){if(this.s<0){if(this.t==1)return this[0]-this.DV;if(this.t==0)return-1}else{if(this.t==1)return this[0];if(this.t==0)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]}l(NM,"bnIntValue");function kM(){return this.t==0?this.s:this[0]<<24>>24}l(kM,"bnByteValue");function RM(){return this.t==0?this.s:this[0]<<16>>16}l(RM,"bnShortValue");function BM(r){return Math.floor(Math.LN2*this.DB/Math.log(r))}l(BM,"bnpChunkSize");function FM(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1}l(FM,"bnSigNum");function GM(r){if(r==null&&(r=10),this.signum()==0||r<2||r>36)return"0";var t=this.chunkSize(r),e=Math.pow(r,t),i=si(e),n=K(),o=K(),a="";for(this.divRemTo(i,n,o);n.signum()>0;)a=(e+o.intValue()).toString(r).substr(1)+a,n.divRemTo(i,n,o);return o.intValue().toString(r)+a}l(GM,"bnpToRadix");function VM(r,t){this.fromInt(0),t==null&&(t=10);for(var e=this.chunkSize(t),i=Math.pow(t,e),n=!1,o=0,a=0,u=0;u<r.length;++u){var s=r4(r,u);if(s<0){r.charAt(u)=="-"&&this.signum()==0&&(n=!0);continue}a=t*a+s,++o>=e&&(this.dMultiply(i),this.dAddOffset(a,0),o=0,a=0)}o>0&&(this.dMultiply(Math.pow(t,o)),this.dAddOffset(a,0)),n&&O.ZERO.subTo(this,this)}l(VM,"bnpFromRadix");function HM(r,t,e){if(typeof t=="number")if(r<2)this.fromInt(1);else for(this.fromNumber(r,e),this.testBit(r-1)||this.bitwiseTo(O.ONE.shiftLeft(r-1),jf,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>r&&this.subTo(O.ONE.shiftLeft(r-1),this);else{var i=new Array,n=r&7;i.length=(r>>3)+1,t.nextBytes(i),n>0?i[0]&=(1<<n)-1:i[0]=0,this.fromString(i,256)}}l(HM,"bnpFromNumber");function XM(){var r=this.t,t=new Array;t[0]=this.s;var e=this.DB-r*this.DB%8,i,n=0;if(r-- >0)for(e<this.DB&&(i=this[r]>>e)!=(this.s&this.DM)>>e&&(t[n++]=i|this.s<<this.DB-e);r>=0;)e<8?(i=(this[r]&(1<<e)-1)<<8-e,i|=this[--r]>>(e+=this.DB-8)):(i=this[r]>>(e-=8)&255,e<=0&&(e+=this.DB,--r)),i&128&&(i|=-256),n==0&&(this.s&128)!=(i&128)&&++n,(n>0||i!=this.s)&&(t[n++]=i);return t}l(XM,"bnToByteArray");function YM(r){return this.compareTo(r)==0}l(YM,"bnEquals");function jM(r){return this.compareTo(r)<0?this:r}l(jM,"bnMin");function WM(r){return this.compareTo(r)>0?this:r}l(WM,"bnMax");function UM(r,t,e){var i,n,o=Math.min(r.t,this.t);for(i=0;i<o;++i)e[i]=t(this[i],r[i]);if(r.t<this.t){for(n=r.s&this.DM,i=o;i<this.t;++i)e[i]=t(this[i],n);e.t=this.t}else{for(n=this.s&this.DM,i=o;i<r.t;++i)e[i]=t(n,r[i]);e.t=r.t}e.s=t(this.s,r.s),e.clamp()}l(UM,"bnpBitwiseTo");function ZM(r,t){return r&t}l(ZM,"op_and");function zM(r){var t=K();return this.bitwiseTo(r,ZM,t),t}l(zM,"bnAnd");function jf(r,t){return r|t}l(jf,"op_or");function qM(r){var t=K();return this.bitwiseTo(r,jf,t),t}l(qM,"bnOr");function i4(r,t){return r^t}l(i4,"op_xor");function $M(r){var t=K();return this.bitwiseTo(r,i4,t),t}l($M,"bnXor");function n4(r,t){return r&~t}l(n4,"op_andnot");function JM(r){var t=K();return this.bitwiseTo(r,n4,t),t}l(JM,"bnAndNot");function KM(){for(var r=K(),t=0;t<this.t;++t)r[t]=this.DM&~this[t];return r.t=this.t,r.s=~this.s,r}l(KM,"bnNot");function QM(r){var t=K();return r<0?this.rShiftTo(-r,t):this.lShiftTo(r,t),t}l(QM,"bnShiftLeft");function tP(r){var t=K();return r<0?this.lShiftTo(-r,t):this.rShiftTo(r,t),t}l(tP,"bnShiftRight");function eP(r){if(r==0)return-1;var t=0;return r&65535||(r>>=16,t+=16),r&255||(r>>=8,t+=8),r&15||(r>>=4,t+=4),r&3||(r>>=2,t+=2),r&1||++t,t}l(eP,"lbit");function rP(){for(var r=0;r<this.t;++r)if(this[r]!=0)return r*this.DB+eP(this[r]);return this.s<0?this.t*this.DB:-1}l(rP,"bnGetLowestSetBit");function iP(r){for(var t=0;r!=0;)r&=r-1,++t;return t}l(iP,"cbit");function nP(){for(var r=0,t=this.s&this.DM,e=0;e<this.t;++e)r+=iP(this[e]^t);return r}l(nP,"bnBitCount");function oP(r){var t=Math.floor(r/this.DB);return t>=this.t?this.s!=0:(this[t]&1<<r%this.DB)!=0}l(oP,"bnTestBit");function aP(r,t){var e=O.ONE.shiftLeft(r);return this.bitwiseTo(e,t,e),e}l(aP,"bnpChangeBit");function sP(r){return this.changeBit(r,jf)}l(sP,"bnSetBit");function lP(r){return this.changeBit(r,n4)}l(lP,"bnClearBit");function uP(r){return this.changeBit(r,i4)}l(uP,"bnFlipBit");function cP(r,t){for(var e=0,i=0,n=Math.min(r.t,this.t);e<n;)i+=this[e]+r[e],t[e++]=i&this.DM,i>>=this.DB;if(r.t<this.t){for(i+=r.s;e<this.t;)i+=this[e],t[e++]=i&this.DM,i>>=this.DB;i+=this.s}else{for(i+=this.s;e<r.t;)i+=r[e],t[e++]=i&this.DM,i>>=this.DB;i+=r.s}t.s=i<0?-1:0,i>0?t[e++]=i:i<-1&&(t[e++]=this.DV+i),t.t=e,t.clamp()}l(cP,"bnpAddTo");function pP(r){var t=K();return this.addTo(r,t),t}l(pP,"bnAdd");function hP(r){var t=K();return this.subTo(r,t),t}l(hP,"bnSubtract");function dP(r){var t=K();return this.multiplyTo(r,t),t}l(dP,"bnMultiply");function fP(){var r=K();return this.squareTo(r),r}l(fP,"bnSquare");function mP(r){var t=K();return this.divRemTo(r,t,null),t}l(mP,"bnDivide");function yP(r){var t=K();return this.divRemTo(r,null,t),t}l(yP,"bnRemainder");function gP(r){var t=K(),e=K();return this.divRemTo(r,t,e),new Array(t,e)}l(gP,"bnDivideAndRemainder");function vP(r){this[this.t]=this.am(0,r-1,this,0,0,this.t),++this.t,this.clamp()}l(vP,"bnpDMultiply");function bP(r,t){if(r!=0){for(;this.t<=t;)this[this.t++]=0;for(this[t]+=r;this[t]>=this.DV;)this[t]-=this.DV,++t>=this.t&&(this[this.t++]=0),++this[t]}}l(bP,"bnpDAddOffset");function Ka(){}l(Ka,"NullExp");function o4(r){return r}l(o4,"nNop");function CP(r,t,e){r.multiplyTo(t,e)}l(CP,"nMulTo");function xP(r,t){r.squareTo(t)}l(xP,"nSqrTo");Ka.prototype.convert=o4;Ka.prototype.revert=o4;Ka.prototype.mulTo=CP;Ka.prototype.sqrTo=xP;function SP(r){return this.exp(r,new Ka)}l(SP,"bnPow");function MP(r,t,e){var i=Math.min(this.t+r.t,t);for(e.s=0,e.t=i;i>0;)e[--i]=0;var n;for(n=e.t-this.t;i<n;++i)e[i+this.t]=this.am(0,r[i],e,i,0,this.t);for(n=Math.min(r.t,t);i<n;++i)this.am(0,r[i],e,i,0,t-i);e.clamp()}l(MP,"bnpMultiplyLowerTo");function PP(r,t,e){--t;var i=e.t=this.t+r.t-t;for(e.s=0;--i>=0;)e[i]=0;for(i=Math.max(t-this.t,0);i<r.t;++i)e[this.t+i-t]=this.am(t-i,r[i],e,0,0,this.t+i-t);e.clamp(),e.drShiftTo(1,e)}l(PP,"bnpMultiplyUpperTo");function co(r){this.r2=K(),this.q3=K(),O.ONE.dlShiftTo(2*r.t,this.r2),this.mu=this.r2.divide(r),this.m=r}l(co,"Barrett");function wP(r){if(r.s<0||r.t>2*this.m.t)return r.mod(this.m);if(r.compareTo(this.m)<0)return r;var t=K();return r.copyTo(t),this.reduce(t),t}l(wP,"barrettConvert");function TP(r){return r}l(TP,"barrettRevert");function IP(r){for(r.drShiftTo(this.m.t-1,this.r2),r.t>this.m.t+1&&(r.t=this.m.t+1,r.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);r.compareTo(this.r2)<0;)r.dAddOffset(1,this.m.t+1);for(r.subTo(this.r2,r);r.compareTo(this.m)>=0;)r.subTo(this.m,r)}l(IP,"barrettReduce");function EP(r,t){r.squareTo(t),this.reduce(t)}l(EP,"barrettSqrTo");function LP(r,t,e){r.multiplyTo(t,e),this.reduce(e)}l(LP,"barrettMulTo");co.prototype.convert=wP;co.prototype.revert=TP;co.prototype.reduce=IP;co.prototype.mulTo=LP;co.prototype.sqrTo=EP;function _P(r,t){var e=r.bitLength(),i,n=si(1),o;if(e<=0)return n;e<18?i=1:e<48?i=3:e<144?i=4:e<768?i=5:i=6,e<8?o=new Qi(t):t.isEven()?o=new co(t):o=new tn(t);var a=new Array,u=3,s=i-1,p=(1<<i)-1;if(a[1]=o.convert(this),i>1){var f=K();for(o.sqrTo(a[1],f);u<=p;)a[u]=K(),o.mulTo(f,a[u-2],a[u]),u+=2}var m=r.t-1,y,x=!0,S=K(),M;for(e=rc(r[m])-1;m>=0;){for(e>=s?y=r[m]>>e-s&p:(y=(r[m]&(1<<e+1)-1)<<s-e,m>0&&(y|=r[m-1]>>this.DB+e-s)),u=i;!(y&1);)y>>=1,--u;if((e-=u)<0&&(e+=this.DB,--m),x)a[y].copyTo(n),x=!1;else{for(;u>1;)o.sqrTo(n,S),o.sqrTo(S,n),u-=2;u>0?o.sqrTo(n,S):(M=n,n=S,S=M),o.mulTo(S,a[y],n)}for(;m>=0&&!(r[m]&1<<e);)o.sqrTo(n,S),M=n,n=S,S=M,--e<0&&(e=this.DB-1,--m)}return o.revert(n)}l(_P,"bnModPow");function DP(r){var t=this.s<0?this.negate():this.clone(),e=r.s<0?r.negate():r.clone();if(t.compareTo(e)<0){var i=t;t=e,e=i}var n=t.getLowestSetBit(),o=e.getLowestSetBit();if(o<0)return t;for(n<o&&(o=n),o>0&&(t.rShiftTo(o,t),e.rShiftTo(o,e));t.signum()>0;)(n=t.getLowestSetBit())>0&&t.rShiftTo(n,t),(n=e.getLowestSetBit())>0&&e.rShiftTo(n,e),t.compareTo(e)>=0?(t.subTo(e,t),t.rShiftTo(1,t)):(e.subTo(t,e),e.rShiftTo(1,e));return o>0&&e.lShiftTo(o,e),e}l(DP,"bnGCD");function OP(r){if(r<=0)return 0;var t=this.DV%r,e=this.s<0?r-1:0;if(this.t>0)if(t==0)e=this[0]%r;else for(var i=this.t-1;i>=0;--i)e=(t*e+this[i])%r;return e}l(OP,"bnpModInt");function AP(r){var t=r.isEven();if(this.isEven()&&t||r.signum()==0)return O.ZERO;for(var e=r.clone(),i=this.clone(),n=si(1),o=si(0),a=si(0),u=si(1);e.signum()!=0;){for(;e.isEven();)e.rShiftTo(1,e),t?((!n.isEven()||!o.isEven())&&(n.addTo(this,n),o.subTo(r,o)),n.rShiftTo(1,n)):o.isEven()||o.subTo(r,o),o.rShiftTo(1,o);for(;i.isEven();)i.rShiftTo(1,i),t?((!a.isEven()||!u.isEven())&&(a.addTo(this,a),u.subTo(r,u)),a.rShiftTo(1,a)):u.isEven()||u.subTo(r,u),u.rShiftTo(1,u);e.compareTo(i)>=0?(e.subTo(i,e),t&&n.subTo(a,n),o.subTo(u,o)):(i.subTo(e,i),t&&a.subTo(n,a),u.subTo(o,u))}if(i.compareTo(O.ONE)!=0)return O.ZERO;if(u.compareTo(r)>=0)return u.subtract(r);if(u.signum()<0)u.addTo(r,u);else return u;return u.signum()<0?u.add(r):u}l(AP,"bnModInverse");var Kt=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],NP=(1<<26)/Kt[Kt.length-1];function kP(r){var t,e=this.abs();if(e.t==1&&e[0]<=Kt[Kt.length-1]){for(t=0;t<Kt.length;++t)if(e[0]==Kt[t])return!0;return!1}if(e.isEven())return!1;for(t=1;t<Kt.length;){for(var i=Kt[t],n=t+1;n<Kt.length&&i<NP;)i*=Kt[n++];for(i=e.modInt(i);t<n;)if(i%Kt[t++]==0)return!1}return e.millerRabin(r)}l(kP,"bnIsProbablePrime");function RP(r){var t=this.subtract(O.ONE),e=t.getLowestSetBit();if(e<=0)return!1;var i=t.shiftRight(e);r=r+1>>1,r>Kt.length&&(r=Kt.length);for(var n=K(),o=0;o<r;++o){n.fromInt(Kt[Math.floor(Math.random()*Kt.length)]);var a=n.modPow(i,this);if(a.compareTo(O.ONE)!=0&&a.compareTo(t)!=0){for(var u=1;u++<e&&a.compareTo(t)!=0;)if(a=a.modPowInt(2,this),a.compareTo(O.ONE)==0)return!1;if(a.compareTo(t)!=0)return!1}}return!0}l(RP,"bnpMillerRabin");O.prototype.chunkSize=BM;O.prototype.toRadix=GM;O.prototype.fromRadix=VM;O.prototype.fromNumber=HM;O.prototype.bitwiseTo=UM;O.prototype.changeBit=aP;O.prototype.addTo=cP;O.prototype.dMultiply=vP;O.prototype.dAddOffset=bP;O.prototype.multiplyLowerTo=MP;O.prototype.multiplyUpperTo=PP;O.prototype.modInt=OP;O.prototype.millerRabin=RP;O.prototype.clone=AM;O.prototype.intValue=NM;O.prototype.byteValue=kM;O.prototype.shortValue=RM;O.prototype.signum=FM;O.prototype.toByteArray=XM;O.prototype.equals=YM;O.prototype.min=jM;O.prototype.max=WM;O.prototype.and=zM;O.prototype.or=qM;O.prototype.xor=$M;O.prototype.andNot=JM;O.prototype.not=KM;O.prototype.shiftLeft=QM;O.prototype.shiftRight=tP;O.prototype.getLowestSetBit=rP;O.prototype.bitCount=nP;O.prototype.testBit=oP;O.prototype.setBit=sP;O.prototype.clearBit=lP;O.prototype.flipBit=uP;O.prototype.add=pP;O.prototype.subtract=hP;O.prototype.multiply=dP;O.prototype.divide=mP;O.prototype.remainder=yP;O.prototype.divideAndRemainder=gP;O.prototype.modPow=_P;O.prototype.modInverse=AP;O.prototype.pow=SP;O.prototype.gcd=DP;O.prototype.isProbablePrime=kP;O.prototype.square=fP;var Z=O;Z.prototype.IsNegative=function(){return this.compareTo(Z.ZERO)==-1};Z.op_Equality=function(r,t){return r.compareTo(t)==0};Z.op_Inequality=function(r,t){return r.compareTo(t)!=0};Z.op_GreaterThan=function(r,t){return r.compareTo(t)>0};Z.op_LessThan=function(r,t){return r.compareTo(t)<0};Z.op_Addition=function(r,t){return new Z(r).add(new Z(t))};Z.op_Subtraction=function(r,t){return new Z(r).subtract(new Z(t))};Z.Int128Mul=function(r,t){return new Z(r).multiply(new Z(t))};Z.op_Division=function(r,t){return r.divide(t)};Z.prototype.ToDouble=function(){return parseFloat(this.toString())};typeof tc>"u"&&(tc=l(function(r,t){var e;if(typeof Object.getOwnPropertyNames>"u"){for(e in t.prototype)(typeof r.prototype[e]>"u"||r.prototype[e]==Object.prototype[e])&&(r.prototype[e]=t.prototype[e]);for(e in t)typeof r[e]>"u"&&(r[e]=t[e]);r.$baseCtor=t}else{for(var i=Object.getOwnPropertyNames(t.prototype),n=0;n<i.length;n++)typeof Object.getOwnPropertyDescriptor(r.prototype,i[n])>"u"&&Object.defineProperty(r.prototype,i[n],Object.getOwnPropertyDescriptor(t.prototype,i[n]));for(e in t)typeof r[e]>"u"&&(r[e]=t[e]);r.$baseCtor=t}},"Inherit"));var tc;h.Path=function(){return[]};h.Paths=function(){return[]};h.DoublePoint=function(){var r=arguments;this.X=0,this.Y=0,r.length==1?(this.X=r[0].X,this.Y=r[0].Y):r.length==2&&(this.X=r[0],this.Y=r[1])};h.DoublePoint0=function(){this.X=0,this.Y=0};h.DoublePoint1=function(r){this.X=r.X,this.Y=r.Y};h.DoublePoint2=function(r,t){this.X=r,this.Y=t};h.PolyNode=function(){this.m_Parent=null,this.m_polygon=new h.Path,this.m_Index=0,this.m_jointype=0,this.m_endtype=0,this.m_Childs=[],this.IsOpen=!1};h.PolyNode.prototype.IsHoleNode=function(){for(var r=!0,t=this.m_Parent;t!==null;)r=!r,t=t.m_Parent;return r};h.PolyNode.prototype.ChildCount=function(){return this.m_Childs.length};h.PolyNode.prototype.Contour=function(){return this.m_polygon};h.PolyNode.prototype.AddChild=function(r){var t=this.m_Childs.length;this.m_Childs.push(r),r.m_Parent=this,r.m_Index=t};h.PolyNode.prototype.GetNext=function(){return this.m_Childs.length>0?this.m_Childs[0]:this.GetNextSiblingUp()};h.PolyNode.prototype.GetNextSiblingUp=function(){return this.m_Parent===null?null:this.m_Index==this.m_Parent.m_Childs.length-1?this.m_Parent.GetNextSiblingUp():this.m_Parent.m_Childs[this.m_Index+1]};h.PolyNode.prototype.Childs=function(){return this.m_Childs};h.PolyNode.prototype.Parent=function(){return this.m_Parent};h.PolyNode.prototype.IsHole=function(){return this.IsHoleNode()};h.PolyTree=function(){this.m_AllPolys=[],h.PolyNode.call(this)};h.PolyTree.prototype.Clear=function(){for(var r=0,t=this.m_AllPolys.length;r<t;r++)this.m_AllPolys[r]=null;this.m_AllPolys.length=0,this.m_Childs.length=0};h.PolyTree.prototype.GetFirst=function(){return this.m_Childs.length>0?this.m_Childs[0]:null};h.PolyTree.prototype.Total=function(){return this.m_AllPolys.length};tc(h.PolyTree,h.PolyNode);h.Math_Abs_Int64=h.Math_Abs_Int32=h.Math_Abs_Double=function(r){return Math.abs(r)};h.Math_Max_Int32_Int32=function(r,t){return Math.max(r,t)};z.msie||z.opera||z.safari?h.Cast_Int32=function(r){return r|0}:h.Cast_Int32=function(r){return~~r};z.chrome?h.Cast_Int64=function(r){return r<-2147483648||r>2147483647?r<0?Math.ceil(r):Math.floor(r):~~r}:z.firefox&&typeof Number.toInteger=="function"?h.Cast_Int64=function(r){return Number.toInteger(r)}:z.msie7||z.msie8?h.Cast_Int64=function(r){return parseInt(r,10)}:z.msie?h.Cast_Int64=function(r){return r<-2147483648||r>2147483647?r<0?Math.ceil(r):Math.floor(r):r|0}:h.Cast_Int64=function(r){return r<0?Math.ceil(r):Math.floor(r)};h.Clear=function(r){r.length=0};h.PI=3.141592653589793;h.PI2=2*3.141592653589793;h.IntPoint=function(){var r=arguments,t=r.length;if(this.X=0,this.Y=0,Ki)if(this.Z=0,t==3)this.X=r[0],this.Y=r[1],this.Z=r[2];else if(t==2)this.X=r[0],this.Y=r[1],this.Z=0;else if(t==1)if(r[0]instanceof h.DoublePoint){var e=r[0];this.X=h.Clipper.Round(e.X),this.Y=h.Clipper.Round(e.Y),this.Z=0}else{var i=r[0];typeof i.Z>"u"&&(i.Z=0),this.X=i.X,this.Y=i.Y,this.Z=i.Z}else this.X=0,this.Y=0,this.Z=0;else if(t==2)this.X=r[0],this.Y=r[1];else if(t==1)if(r[0]instanceof h.DoublePoint){var e=r[0];this.X=h.Clipper.Round(e.X),this.Y=h.Clipper.Round(e.Y)}else{var i=r[0];this.X=i.X,this.Y=i.Y}else this.X=0,this.Y=0};h.IntPoint.op_Equality=function(r,t){return r.X==t.X&&r.Y==t.Y};h.IntPoint.op_Inequality=function(r,t){return r.X!=t.X||r.Y!=t.Y};Ki?(h.IntPoint0=function(){this.X=0,this.Y=0,this.Z=0},h.IntPoint1=function(r){this.X=r.X,this.Y=r.Y,this.Z=r.Z},h.IntPoint1dp=function(r){this.X=h.Clipper.Round(r.X),this.Y=h.Clipper.Round(r.Y),this.Z=0},h.IntPoint2=function(r,t){this.X=r,this.Y=t,this.Z=0},h.IntPoint3=function(r,t,e){this.X=r,this.Y=t,this.Z=e}):(h.IntPoint0=function(){this.X=0,this.Y=0},h.IntPoint1=function(r){this.X=r.X,this.Y=r.Y},h.IntPoint1dp=function(r){this.X=h.Clipper.Round(r.X),this.Y=h.Clipper.Round(r.Y)},h.IntPoint2=function(r,t){this.X=r,this.Y=t});h.IntRect=function(){var r=arguments,t=r.length;t==4?(this.left=r[0],this.top=r[1],this.right=r[2],this.bottom=r[3]):t==1?(this.left=ir.left,this.top=ir.top,this.right=ir.right,this.bottom=ir.bottom):(this.left=0,this.top=0,this.right=0,this.bottom=0)};h.IntRect0=function(){this.left=0,this.top=0,this.right=0,this.bottom=0};h.IntRect1=function(r){this.left=r.left,this.top=r.top,this.right=r.right,this.bottom=r.bottom};h.IntRect4=function(r,t,e,i){this.left=r,this.top=t,this.right=e,this.bottom=i};h.ClipType={ctIntersection:0,ctUnion:1,ctDifference:2,ctXor:3};h.PolyType={ptSubject:0,ptClip:1};h.PolyFillType={pftEvenOdd:0,pftNonZero:1,pftPositive:2,pftNegative:3};h.JoinType={jtSquare:0,jtRound:1,jtMiter:2};h.EndType={etOpenSquare:0,etOpenRound:1,etOpenButt:2,etClosedLine:3,etClosedPolygon:4};t4&&(h.EndType_={etSquare:0,etRound:1,etButt:2,etClosed:3});h.EdgeSide={esLeft:0,esRight:1};h.Direction={dRightToLeft:0,dLeftToRight:1};h.TEdge=function(){this.Bot=new h.IntPoint,this.Curr=new h.IntPoint,this.Top=new h.IntPoint,this.Delta=new h.IntPoint,this.Dx=0,this.PolyTyp=h.PolyType.ptSubject,this.Side=h.EdgeSide.esLeft,this.WindDelta=0,this.WindCnt=0,this.WindCnt2=0,this.OutIdx=0,this.Next=null,this.Prev=null,this.NextInLML=null,this.NextInAEL=null,this.PrevInAEL=null,this.NextInSEL=null,this.PrevInSEL=null};h.IntersectNode=function(){this.Edge1=null,this.Edge2=null,this.Pt=new h.IntPoint};h.MyIntersectNodeSort=function(){};h.MyIntersectNodeSort.Compare=function(r,t){return t.Pt.Y-r.Pt.Y};h.LocalMinima=function(){this.Y=0,this.LeftBound=null,this.RightBound=null,this.Next=null};h.Scanbeam=function(){this.Y=0,this.Next=null};h.OutRec=function(){this.Idx=0,this.IsHole=!1,this.IsOpen=!1,this.FirstLeft=null,this.Pts=null,this.BottomPt=null,this.PolyNode=null};h.OutPt=function(){this.Idx=0,this.Pt=new h.IntPoint,this.Next=null,this.Prev=null};h.Join=function(){this.OutPt1=null,this.OutPt2=null,this.OffPt=new h.IntPoint};h.ClipperBase=function(){this.m_MinimaList=null,this.m_CurrentLM=null,this.m_edges=new Array,this.m_UseFullRange=!1,this.m_HasOpenPaths=!1,this.PreserveCollinear=!1,this.m_MinimaList=null,this.m_CurrentLM=null,this.m_UseFullRange=!1,this.m_HasOpenPaths=!1};h.ClipperBase.horizontal=-9007199254740992;h.ClipperBase.Skip=-2;h.ClipperBase.Unassigned=-1;h.ClipperBase.tolerance=1e-20;qS?(h.ClipperBase.loRange=46340,h.ClipperBase.hiRange=46340):(h.ClipperBase.loRange=47453132,h.ClipperBase.hiRange=0xfffffffffffff);h.ClipperBase.near_zero=function(r){return r>-h.ClipperBase.tolerance&&r<h.ClipperBase.tolerance};h.ClipperBase.IsHorizontal=function(r){return r.Delta.Y===0};h.ClipperBase.prototype.PointIsVertex=function(r,t){var e=t;do{if(h.IntPoint.op_Equality(e.Pt,r))return!0;e=e.Next}while(e!=t);return!1};h.ClipperBase.prototype.PointOnLineSegment=function(r,t,e,i){return i?r.X==t.X&&r.Y==t.Y||r.X==e.X&&r.Y==e.Y||r.X>t.X==r.X<e.X&&r.Y>t.Y==r.Y<e.Y&&Z.op_Equality(Z.Int128Mul(r.X-t.X,e.Y-t.Y),Z.Int128Mul(e.X-t.X,r.Y-t.Y)):r.X==t.X&&r.Y==t.Y||r.X==e.X&&r.Y==e.Y||r.X>t.X==r.X<e.X&&r.Y>t.Y==r.Y<e.Y&&(r.X-t.X)*(e.Y-t.Y)==(e.X-t.X)*(r.Y-t.Y)};h.ClipperBase.prototype.PointOnPolygon=function(r,t,e){for(var i=t;;){if(this.PointOnLineSegment(r,i.Pt,i.Next.Pt,e))return!0;if(i=i.Next,i==t)break}return!1};h.ClipperBase.prototype.SlopesEqual=h.ClipperBase.SlopesEqual=function(){var r=arguments,t=r.length,e,i,n,o,a,u,s;return t==3?(e=r[0],i=r[1],s=r[2],s?Z.op_Equality(Z.Int128Mul(e.Delta.Y,i.Delta.X),Z.Int128Mul(e.Delta.X,i.Delta.Y)):h.Cast_Int64(e.Delta.Y*i.Delta.X)==h.Cast_Int64(e.Delta.X*i.Delta.Y)):t==4?(n=r[0],o=r[1],a=r[2],s=r[3],s?Z.op_Equality(Z.Int128Mul(n.Y-o.Y,o.X-a.X),Z.Int128Mul(n.X-o.X,o.Y-a.Y)):h.Cast_Int64((n.Y-o.Y)*(o.X-a.X))-h.Cast_Int64((n.X-o.X)*(o.Y-a.Y))===0):(n=r[0],o=r[1],a=r[2],u=r[3],s=r[4],s?Z.op_Equality(Z.Int128Mul(n.Y-o.Y,a.X-u.X),Z.Int128Mul(n.X-o.X,a.Y-u.Y)):h.Cast_Int64((n.Y-o.Y)*(a.X-u.X))-h.Cast_Int64((n.X-o.X)*(a.Y-u.Y))===0)};h.ClipperBase.SlopesEqual3=function(r,t,e){return e?Z.op_Equality(Z.Int128Mul(r.Delta.Y,t.Delta.X),Z.Int128Mul(r.Delta.X,t.Delta.Y)):h.Cast_Int64(r.Delta.Y*t.Delta.X)==h.Cast_Int64(r.Delta.X*t.Delta.Y)};h.ClipperBase.SlopesEqual4=function(r,t,e,i){return i?Z.op_Equality(Z.Int128Mul(r.Y-t.Y,t.X-e.X),Z.Int128Mul(r.X-t.X,t.Y-e.Y)):h.Cast_Int64((r.Y-t.Y)*(t.X-e.X))-h.Cast_Int64((r.X-t.X)*(t.Y-e.Y))===0};h.ClipperBase.SlopesEqual5=function(r,t,e,i,n){return n?Z.op_Equality(Z.Int128Mul(r.Y-t.Y,e.X-i.X),Z.Int128Mul(r.X-t.X,e.Y-i.Y)):h.Cast_Int64((r.Y-t.Y)*(e.X-i.X))-h.Cast_Int64((r.X-t.X)*(e.Y-i.Y))===0};h.ClipperBase.prototype.Clear=function(){this.DisposeLocalMinimaList();for(var r=0,t=this.m_edges.length;r<t;++r){for(var e=0,i=this.m_edges[r].length;e<i;++e)this.m_edges[r][e]=null;h.Clear(this.m_edges[r])}h.Clear(this.m_edges),this.m_UseFullRange=!1,this.m_HasOpenPaths=!1};h.ClipperBase.prototype.DisposeLocalMinimaList=function(){for(;this.m_MinimaList!==null;){var r=this.m_MinimaList.Next;this.m_MinimaList=null,this.m_MinimaList=r}this.m_CurrentLM=null};h.ClipperBase.prototype.RangeTest=function(r,t){t.Value?(r.X>h.ClipperBase.hiRange||r.Y>h.ClipperBase.hiRange||-r.X>h.ClipperBase.hiRange||-r.Y>h.ClipperBase.hiRange)&&h.Error("Coordinate outside allowed range in RangeTest()."):(r.X>h.ClipperBase.loRange||r.Y>h.ClipperBase.loRange||-r.X>h.ClipperBase.loRange||-r.Y>h.ClipperBase.loRange)&&(t.Value=!0,this.RangeTest(r,t))};h.ClipperBase.prototype.InitEdge=function(r,t,e,i){r.Next=t,r.Prev=e,r.Curr.X=i.X,r.Curr.Y=i.Y,r.OutIdx=-1};h.ClipperBase.prototype.InitEdge2=function(r,t){r.Curr.Y>=r.Next.Curr.Y?(r.Bot.X=r.Curr.X,r.Bot.Y=r.Curr.Y,r.Top.X=r.Next.Curr.X,r.Top.Y=r.Next.Curr.Y):(r.Top.X=r.Curr.X,r.Top.Y=r.Curr.Y,r.Bot.X=r.Next.Curr.X,r.Bot.Y=r.Next.Curr.Y),this.SetDx(r),r.PolyTyp=t};h.ClipperBase.prototype.FindNextLocMin=function(r){for(var t;;){for(;h.IntPoint.op_Inequality(r.Bot,r.Prev.Bot)||h.IntPoint.op_Equality(r.Curr,r.Top);)r=r.Next;if(r.Dx!=h.ClipperBase.horizontal&&r.Prev.Dx!=h.ClipperBase.horizontal)break;for(;r.Prev.Dx==h.ClipperBase.horizontal;)r=r.Prev;for(t=r;r.Dx==h.ClipperBase.horizontal;)r=r.Next;if(r.Top.Y!=r.Prev.Bot.Y){t.Prev.Bot.X<r.Bot.X&&(r=t);break}}return r};h.ClipperBase.prototype.ProcessBound=function(r,t){var e=r,i=r,n,o;if(r.Dx==h.ClipperBase.horizontal&&(t?o=r.Prev.Bot.X:o=r.Next.Bot.X,r.Bot.X!=o&&this.ReverseHorizontal(r)),i.OutIdx!=h.ClipperBase.Skip)if(t){for(;i.Top.Y==i.Next.Bot.Y&&i.Next.OutIdx!=h.ClipperBase.Skip;)i=i.Next;if(i.Dx==h.ClipperBase.horizontal&&i.Next.OutIdx!=h.ClipperBase.Skip){for(n=i;n.Prev.Dx==h.ClipperBase.horizontal;)n=n.Prev;n.Prev.Top.X==i.Next.Top.X?t||(i=n.Prev):n.Prev.Top.X>i.Next.Top.X&&(i=n.Prev)}for(;r!=i;)r.NextInLML=r.Next,r.Dx==h.ClipperBase.horizontal&&r!=e&&r.Bot.X!=r.Prev.Top.X&&this.ReverseHorizontal(r),r=r.Next;r.Dx==h.ClipperBase.horizontal&&r!=e&&r.Bot.X!=r.Prev.Top.X&&this.ReverseHorizontal(r),i=i.Next}else{for(;i.Top.Y==i.Prev.Bot.Y&&i.Prev.OutIdx!=h.ClipperBase.Skip;)i=i.Prev;if(i.Dx==h.ClipperBase.horizontal&&i.Prev.OutIdx!=h.ClipperBase.Skip){for(n=i;n.Next.Dx==h.ClipperBase.horizontal;)n=n.Next;n.Next.Top.X==i.Prev.Top.X?t||(i=n.Next):n.Next.Top.X>i.Prev.Top.X&&(i=n.Next)}for(;r!=i;)r.NextInLML=r.Prev,r.Dx==h.ClipperBase.horizontal&&r!=e&&r.Bot.X!=r.Next.Top.X&&this.ReverseHorizontal(r),r=r.Prev;r.Dx==h.ClipperBase.horizontal&&r!=e&&r.Bot.X!=r.Next.Top.X&&this.ReverseHorizontal(r),i=i.Prev}if(i.OutIdx==h.ClipperBase.Skip){if(r=i,t){for(;r.Top.Y==r.Next.Bot.Y;)r=r.Next;for(;r!=i&&r.Dx==h.ClipperBase.horizontal;)r=r.Prev}else{for(;r.Top.Y==r.Prev.Bot.Y;)r=r.Prev;for(;r!=i&&r.Dx==h.ClipperBase.horizontal;)r=r.Next}if(r==i)t?i=r.Next:i=r.Prev;else{t?r=i.Next:r=i.Prev;var a=new h.LocalMinima;a.Next=null,a.Y=r.Bot.Y,a.LeftBound=null,a.RightBound=r,a.RightBound.WindDelta=0,i=this.ProcessBound(a.RightBound,t),this.InsertLocalMinima(a)}}return i};h.ClipperBase.prototype.AddPath=function(r,t,e){Qb?!e&&t==h.PolyType.ptClip&&h.Error("AddPath: Open paths must be subject."):e||h.Error("AddPath: Open paths have been disabled.");var i=r.length-1;if(e)for(;i>0&&h.IntPoint.op_Equality(r[i],r[0]);)--i;for(;i>0&&h.IntPoint.op_Equality(r[i],r[i-1]);)--i;if(e&&i<2||!e&&i<1)return!1;for(var n=new Array,o=0;o<=i;o++)n.push(new h.TEdge);var a=!0;n[1].Curr.X=r[1].X,n[1].Curr.Y=r[1].Y;var u={Value:this.m_UseFullRange};this.RangeTest(r[0],u),this.m_UseFullRange=u.Value,u.Value=this.m_UseFullRange,this.RangeTest(r[i],u),this.m_UseFullRange=u.Value,this.InitEdge(n[0],n[1],n[i],r[0]),this.InitEdge(n[i],n[0],n[i-1],r[i]);for(var o=i-1;o>=1;--o)u.Value=this.m_UseFullRange,this.RangeTest(r[o],u),this.m_UseFullRange=u.Value,this.InitEdge(n[o],n[o+1],n[o-1],r[o]);for(var s=n[0],p=s,f=s;;){if(h.IntPoint.op_Equality(p.Curr,p.Next.Curr)){if(p==p.Next)break;p==s&&(s=p.Next),p=this.RemoveEdge(p),f=p;continue}if(p.Prev==p.Next)break;if(e&&h.ClipperBase.SlopesEqual(p.Prev.Curr,p.Curr,p.Next.Curr,this.m_UseFullRange)&&(!this.PreserveCollinear||!this.Pt2IsBetweenPt1AndPt3(p.Prev.Curr,p.Curr,p.Next.Curr))){p==s&&(s=p.Next),p=this.RemoveEdge(p),p=p.Prev,f=p;continue}if(p=p.Next,p==f)break}if(!e&&p==p.Next||e&&p.Prev==p.Next)return!1;e||(this.m_HasOpenPaths=!0,s.Prev.OutIdx=h.ClipperBase.Skip);var m=s;p=s;do this.InitEdge2(p,t),p=p.Next,a&&p.Curr.Y!=s.Curr.Y&&(a=!1);while(p!=s);if(a){if(e)return!1;p.Prev.OutIdx=h.ClipperBase.Skip,p.Prev.Bot.X<p.Prev.Top.X&&this.ReverseHorizontal(p.Prev);var y=new h.LocalMinima;for(y.Next=null,y.Y=p.Bot.Y,y.LeftBound=null,y.RightBound=p,y.RightBound.Side=h.EdgeSide.esRight,y.RightBound.WindDelta=0;p.Next.OutIdx!=h.ClipperBase.Skip;)p.NextInLML=p.Next,p.Bot.X!=p.Prev.Top.X&&this.ReverseHorizontal(p),p=p.Next;return this.InsertLocalMinima(y),this.m_edges.push(n),!0}this.m_edges.push(n);for(var x,S=null;p=this.FindNextLocMin(p),p!=S;){S==null&&(S=p);var y=new h.LocalMinima;y.Next=null,y.Y=p.Bot.Y,p.Dx<p.Prev.Dx?(y.LeftBound=p.Prev,y.RightBound=p,x=!1):(y.LeftBound=p,y.RightBound=p.Prev,x=!0),y.LeftBound.Side=h.EdgeSide.esLeft,y.RightBound.Side=h.EdgeSide.esRight,e?y.LeftBound.Next==y.RightBound?y.LeftBound.WindDelta=-1:y.LeftBound.WindDelta=1:y.LeftBound.WindDelta=0,y.RightBound.WindDelta=-y.LeftBound.WindDelta,p=this.ProcessBound(y.LeftBound,x);var M=this.ProcessBound(y.RightBound,!x);y.LeftBound.OutIdx==h.ClipperBase.Skip?y.LeftBound=null:y.RightBound.OutIdx==h.ClipperBase.Skip&&(y.RightBound=null),this.InsertLocalMinima(y),x||(p=M)}return!0};h.ClipperBase.prototype.AddPaths=function(r,t,e){for(var i=!1,n=0,o=r.length;n<o;++n)this.AddPath(r[n],t,e)&&(i=!0);return i};h.ClipperBase.prototype.Pt2IsBetweenPt1AndPt3=function(r,t,e){return h.IntPoint.op_Equality(r,e)||h.IntPoint.op_Equality(r,t)||h.IntPoint.op_Equality(e,t)?!1:r.X!=e.X?t.X>r.X==t.X<e.X:t.Y>r.Y==t.Y<e.Y};h.ClipperBase.prototype.RemoveEdge=function(r){r.Prev.Next=r.Next,r.Next.Prev=r.Prev;var t=r.Next;return r.Prev=null,t};h.ClipperBase.prototype.SetDx=function(r){r.Delta.X=r.Top.X-r.Bot.X,r.Delta.Y=r.Top.Y-r.Bot.Y,r.Delta.Y===0?r.Dx=h.ClipperBase.horizontal:r.Dx=r.Delta.X/r.Delta.Y};h.ClipperBase.prototype.InsertLocalMinima=function(r){if(this.m_MinimaList===null)this.m_MinimaList=r;else if(r.Y>=this.m_MinimaList.Y)r.Next=this.m_MinimaList,this.m_MinimaList=r;else{for(var t=this.m_MinimaList;t.Next!==null&&r.Y<t.Next.Y;)t=t.Next;r.Next=t.Next,t.Next=r}};h.ClipperBase.prototype.PopLocalMinima=function(){this.m_CurrentLM!==null&&(this.m_CurrentLM=this.m_CurrentLM.Next)};h.ClipperBase.prototype.ReverseHorizontal=function(r){var t=r.Top.X;r.Top.X=r.Bot.X,r.Bot.X=t,Ki&&(t=r.Top.Z,r.Top.Z=r.Bot.Z,r.Bot.Z=t)};h.ClipperBase.prototype.Reset=function(){if(this.m_CurrentLM=this.m_MinimaList,this.m_CurrentLM!=null)for(var r=this.m_MinimaList;r!=null;){var t=r.LeftBound;t!=null&&(t.Curr.X=t.Bot.X,t.Curr.Y=t.Bot.Y,t.Side=h.EdgeSide.esLeft,t.OutIdx=h.ClipperBase.Unassigned),t=r.RightBound,t!=null&&(t.Curr.X=t.Bot.X,t.Curr.Y=t.Bot.Y,t.Side=h.EdgeSide.esRight,t.OutIdx=h.ClipperBase.Unassigned),r=r.Next}};h.Clipper=function(r){typeof r>"u"&&(r=0),this.m_PolyOuts=null,this.m_ClipType=h.ClipType.ctIntersection,this.m_Scanbeam=null,this.m_ActiveEdges=null,this.m_SortedEdges=null,this.m_IntersectList=null,this.m_IntersectNodeComparer=null,this.m_ExecuteLocked=!1,this.m_ClipFillType=h.PolyFillType.pftEvenOdd,this.m_SubjFillType=h.PolyFillType.pftEvenOdd,this.m_Joins=null,this.m_GhostJoins=null,this.m_UsingPolyTree=!1,this.ReverseSolution=!1,this.StrictlySimple=!1,h.ClipperBase.call(this),this.m_Scanbeam=null,this.m_ActiveEdges=null,this.m_SortedEdges=null,this.m_IntersectList=new Array,this.m_IntersectNodeComparer=h.MyIntersectNodeSort.Compare,this.m_ExecuteLocked=!1,this.m_UsingPolyTree=!1,this.m_PolyOuts=new Array,this.m_Joins=new Array,this.m_GhostJoins=new Array,this.ReverseSolution=(1&r)!==0,this.StrictlySimple=(2&r)!==0,this.PreserveCollinear=(4&r)!==0,Ki&&(this.ZFillFunction=null)};h.Clipper.ioReverseSolution=1;h.Clipper.ioStrictlySimple=2;h.Clipper.ioPreserveCollinear=4;h.Clipper.prototype.Clear=function(){this.m_edges.length!==0&&(this.DisposeAllPolyPts(),h.ClipperBase.prototype.Clear.call(this))};h.Clipper.prototype.DisposeScanbeamList=function(){for(;this.m_Scanbeam!==null;){var r=this.m_Scanbeam.Next;this.m_Scanbeam=null,this.m_Scanbeam=r}};h.Clipper.prototype.Reset=function(){h.ClipperBase.prototype.Reset.call(this),this.m_Scanbeam=null,this.m_ActiveEdges=null,this.m_SortedEdges=null;for(var r=this.m_MinimaList;r!==null;)this.InsertScanbeam(r.Y),r=r.Next};h.Clipper.prototype.InsertScanbeam=function(r){if(this.m_Scanbeam===null)this.m_Scanbeam=new h.Scanbeam,this.m_Scanbeam.Next=null,this.m_Scanbeam.Y=r;else if(r>this.m_Scanbeam.Y){var t=new h.Scanbeam;t.Y=r,t.Next=this.m_Scanbeam,this.m_Scanbeam=t}else{for(var e=this.m_Scanbeam;e.Next!==null&&r<=e.Next.Y;)e=e.Next;if(r==e.Y)return;var t=new h.Scanbeam;t.Y=r,t.Next=e.Next,e.Next=t}};h.Clipper.prototype.Execute=function(){var r=arguments,t=r.length,e=r[1]instanceof h.PolyTree;if(t==4&&!e){var i=r[0],n=r[1],o=r[2],a=r[3];if(this.m_ExecuteLocked)return!1;this.m_HasOpenPaths&&h.Error("Error: PolyTree struct is need for open path clipping."),this.m_ExecuteLocked=!0,h.Clear(n),this.m_SubjFillType=o,this.m_ClipFillType=a,this.m_ClipType=i,this.m_UsingPolyTree=!1;try{var u=this.ExecuteInternal();u&&this.BuildResult(n)}finally{this.DisposeAllPolyPts(),this.m_ExecuteLocked=!1}return u}else if(t==4&&e){var i=r[0],s=r[1],o=r[2],a=r[3];if(this.m_ExecuteLocked)return!1;this.m_ExecuteLocked=!0,this.m_SubjFillType=o,this.m_ClipFillType=a,this.m_ClipType=i,this.m_UsingPolyTree=!0;try{var u=this.ExecuteInternal();u&&this.BuildResult2(s)}finally{this.DisposeAllPolyPts(),this.m_ExecuteLocked=!1}return u}else if(t==2&&!e){var i=r[0],n=r[1];return this.Execute(i,n,h.PolyFillType.pftEvenOdd,h.PolyFillType.pftEvenOdd)}else if(t==2&&e){var i=r[0],s=r[1];return this.Execute(i,s,h.PolyFillType.pftEvenOdd,h.PolyFillType.pftEvenOdd)}};h.Clipper.prototype.FixHoleLinkage=function(r){if(!(r.FirstLeft===null||r.IsHole!=r.FirstLeft.IsHole&&r.FirstLeft.Pts!==null)){for(var t=r.FirstLeft;t!==null&&(t.IsHole==r.IsHole||t.Pts===null);)t=t.FirstLeft;r.FirstLeft=t}};h.Clipper.prototype.ExecuteInternal=function(){try{if(this.Reset(),this.m_CurrentLM===null)return!1;var r=this.PopScanbeam();do{if(this.InsertLocalMinimaIntoAEL(r),h.Clear(this.m_GhostJoins),this.ProcessHorizontals(!1),this.m_Scanbeam===null)break;var t=this.PopScanbeam();if(!this.ProcessIntersections(r,t))return!1;this.ProcessEdgesAtTopOfScanbeam(t),r=t}while(this.m_Scanbeam!==null||this.m_CurrentLM!==null);for(var e=0,i=this.m_PolyOuts.length;e<i;e++){var n=this.m_PolyOuts[e];n.Pts===null||n.IsOpen||(n.IsHole^this.ReverseSolution)==this.Area(n)>0&&this.ReversePolyPtLinks(n.Pts)}this.JoinCommonEdges();for(var e=0,i=this.m_PolyOuts.length;e<i;e++){var n=this.m_PolyOuts[e];n.Pts!==null&&!n.IsOpen&&this.FixupOutPolygon(n)}return this.StrictlySimple&&this.DoSimplePolygons(),!0}finally{h.Clear(this.m_Joins),h.Clear(this.m_GhostJoins)}};h.Clipper.prototype.PopScanbeam=function(){var r=this.m_Scanbeam.Y,t=this.m_Scanbeam;return this.m_Scanbeam=this.m_Scanbeam.Next,t=null,r};h.Clipper.prototype.DisposeAllPolyPts=function(){for(var r=0,t=this.m_PolyOuts.length;r<t;++r)this.DisposeOutRec(r);h.Clear(this.m_PolyOuts)};h.Clipper.prototype.DisposeOutRec=function(r){var t=this.m_PolyOuts[r];t.Pts!==null&&this.DisposeOutPts(t.Pts),t=null,this.m_PolyOuts[r]=null};h.Clipper.prototype.DisposeOutPts=function(r){if(r!==null){var t=null;for(r.Prev.Next=null;r!==null;)t=r,r=r.Next,t=null}};h.Clipper.prototype.AddJoin=function(r,t,e){var i=new h.Join;i.OutPt1=r,i.OutPt2=t,i.OffPt.X=e.X,i.OffPt.Y=e.Y,this.m_Joins.push(i)};h.Clipper.prototype.AddGhostJoin=function(r,t){var e=new h.Join;e.OutPt1=r,e.OffPt.X=t.X,e.OffPt.Y=t.Y,this.m_GhostJoins.push(e)};Ki&&(h.Clipper.prototype.SetZ=function(r,t){r.Z=0,this.ZFillFunction!==null&&(t.OutIdx<0?this.ZFillFunction(t.Bot,t.Top,r):this.ZFillFunction(t.Top,t.Bot,r))});h.Clipper.prototype.InsertLocalMinimaIntoAEL=function(r){for(;this.m_CurrentLM!==null&&this.m_CurrentLM.Y==r;){var t=this.m_CurrentLM.LeftBound,e=this.m_CurrentLM.RightBound;this.PopLocalMinima();var i=null;if(t===null?(this.InsertEdgeIntoAEL(e,null),this.SetWindingCount(e),this.IsContributing(e)&&(i=this.AddOutPt(e,e.Bot))):e==null?(this.InsertEdgeIntoAEL(t,null),this.SetWindingCount(t),this.IsContributing(t)&&(i=this.AddOutPt(t,t.Bot)),this.InsertScanbeam(t.Top.Y)):(this.InsertEdgeIntoAEL(t,null),this.InsertEdgeIntoAEL(e,t),this.SetWindingCount(t),e.WindCnt=t.WindCnt,e.WindCnt2=t.WindCnt2,this.IsContributing(t)&&(i=this.AddLocalMinPoly(t,e,t.Bot)),this.InsertScanbeam(t.Top.Y)),e!=null&&(h.ClipperBase.IsHorizontal(e)?this.AddEdgeToSEL(e):this.InsertScanbeam(e.Top.Y)),!(t==null||e==null)){if(i!==null&&h.ClipperBase.IsHorizontal(e)&&this.m_GhostJoins.length>0&&e.WindDelta!==0)for(var n=0,o=this.m_GhostJoins.length;n<o;n++){var a=this.m_GhostJoins[n];this.HorzSegmentsOverlap(a.OutPt1.Pt,a.OffPt,e.Bot,e.Top)&&this.AddJoin(a.OutPt1,i,a.OffPt)}if(t.OutIdx>=0&&t.PrevInAEL!==null&&t.PrevInAEL.Curr.X==t.Bot.X&&t.PrevInAEL.OutIdx>=0&&h.ClipperBase.SlopesEqual(t.PrevInAEL,t,this.m_UseFullRange)&&t.WindDelta!==0&&t.PrevInAEL.WindDelta!==0){var u=this.AddOutPt(t.PrevInAEL,t.Bot);this.AddJoin(i,u,t.Top)}if(t.NextInAEL!=e){if(e.OutIdx>=0&&e.PrevInAEL.OutIdx>=0&&h.ClipperBase.SlopesEqual(e.PrevInAEL,e,this.m_UseFullRange)&&e.WindDelta!==0&&e.PrevInAEL.WindDelta!==0){var u=this.AddOutPt(e.PrevInAEL,e.Bot);this.AddJoin(i,u,e.Top)}var s=t.NextInAEL;if(s!==null)for(;s!=e;)this.IntersectEdges(e,s,t.Curr,!1),s=s.NextInAEL}}}};h.Clipper.prototype.InsertEdgeIntoAEL=function(r,t){if(this.m_ActiveEdges===null)r.PrevInAEL=null,r.NextInAEL=null,this.m_ActiveEdges=r;else if(t===null&&this.E2InsertsBeforeE1(this.m_ActiveEdges,r))r.PrevInAEL=null,r.NextInAEL=this.m_ActiveEdges,this.m_ActiveEdges.PrevInAEL=r,this.m_ActiveEdges=r;else{for(t===null&&(t=this.m_ActiveEdges);t.NextInAEL!==null&&!this.E2InsertsBeforeE1(t.NextInAEL,r);)t=t.NextInAEL;r.NextInAEL=t.NextInAEL,t.NextInAEL!==null&&(t.NextInAEL.PrevInAEL=r),r.PrevInAEL=t,t.NextInAEL=r}};h.Clipper.prototype.E2InsertsBeforeE1=function(r,t){return t.Curr.X==r.Curr.X?t.Top.Y>r.Top.Y?t.Top.X<h.Clipper.TopX(r,t.Top.Y):r.Top.X>h.Clipper.TopX(t,r.Top.Y):t.Curr.X<r.Curr.X};h.Clipper.prototype.IsEvenOddFillType=function(r){return r.PolyTyp==h.PolyType.ptSubject?this.m_SubjFillType==h.PolyFillType.pftEvenOdd:this.m_ClipFillType==h.PolyFillType.pftEvenOdd};h.Clipper.prototype.IsEvenOddAltFillType=function(r){return r.PolyTyp==h.PolyType.ptSubject?this.m_ClipFillType==h.PolyFillType.pftEvenOdd:this.m_SubjFillType==h.PolyFillType.pftEvenOdd};h.Clipper.prototype.IsContributing=function(r){var t,e;switch(r.PolyTyp==h.PolyType.ptSubject?(t=this.m_SubjFillType,e=this.m_ClipFillType):(t=this.m_ClipFillType,e=this.m_SubjFillType),t){case h.PolyFillType.pftEvenOdd:if(r.WindDelta===0&&r.WindCnt!=1)return!1;break;case h.PolyFillType.pftNonZero:if(Math.abs(r.WindCnt)!=1)return!1;break;case h.PolyFillType.pftPositive:if(r.WindCnt!=1)return!1;break;default:if(r.WindCnt!=-1)return!1;break}switch(this.m_ClipType){case h.ClipType.ctIntersection:switch(e){case h.PolyFillType.pftEvenOdd:case h.PolyFillType.pftNonZero:return r.WindCnt2!==0;case h.PolyFillType.pftPositive:return r.WindCnt2>0;default:return r.WindCnt2<0}case h.ClipType.ctUnion:switch(e){case h.PolyFillType.pftEvenOdd:case h.PolyFillType.pftNonZero:return r.WindCnt2===0;case h.PolyFillType.pftPositive:return r.WindCnt2<=0;default:return r.WindCnt2>=0}case h.ClipType.ctDifference:if(r.PolyTyp==h.PolyType.ptSubject)switch(e){case h.PolyFillType.pftEvenOdd:case h.PolyFillType.pftNonZero:return r.WindCnt2===0;case h.PolyFillType.pftPositive:return r.WindCnt2<=0;default:return r.WindCnt2>=0}else switch(e){case h.PolyFillType.pftEvenOdd:case h.PolyFillType.pftNonZero:return r.WindCnt2!==0;case h.PolyFillType.pftPositive:return r.WindCnt2>0;default:return r.WindCnt2<0}case h.ClipType.ctXor:if(r.WindDelta===0)switch(e){case h.PolyFillType.pftEvenOdd:case h.PolyFillType.pftNonZero:return r.WindCnt2===0;case h.PolyFillType.pftPositive:return r.WindCnt2<=0;default:return r.WindCnt2>=0}else return!0}return!0};h.Clipper.prototype.SetWindingCount=function(r){for(var t=r.PrevInAEL;t!==null&&(t.PolyTyp!=r.PolyTyp||t.WindDelta===0);)t=t.PrevInAEL;if(t===null)r.WindCnt=r.WindDelta===0?1:r.WindDelta,r.WindCnt2=0,t=this.m_ActiveEdges;else if(r.WindDelta===0&&this.m_ClipType!=h.ClipType.ctUnion)r.WindCnt=1,r.WindCnt2=t.WindCnt2,t=t.NextInAEL;else if(this.IsEvenOddFillType(r)){if(r.WindDelta===0){for(var e=!0,i=t.PrevInAEL;i!==null;)i.PolyTyp==t.PolyTyp&&i.WindDelta!==0&&(e=!e),i=i.PrevInAEL;r.WindCnt=e?0:1}else r.WindCnt=r.WindDelta;r.WindCnt2=t.WindCnt2,t=t.NextInAEL}else t.WindCnt*t.WindDelta<0?Math.abs(t.WindCnt)>1?t.WindDelta*r.WindDelta<0?r.WindCnt=t.WindCnt:r.WindCnt=t.WindCnt+r.WindDelta:r.WindCnt=r.WindDelta===0?1:r.WindDelta:r.WindDelta===0?r.WindCnt=t.WindCnt<0?t.WindCnt-1:t.WindCnt+1:t.WindDelta*r.WindDelta<0?r.WindCnt=t.WindCnt:r.WindCnt=t.WindCnt+r.WindDelta,r.WindCnt2=t.WindCnt2,t=t.NextInAEL;if(this.IsEvenOddAltFillType(r))for(;t!=r;)t.WindDelta!==0&&(r.WindCnt2=r.WindCnt2===0?1:0),t=t.NextInAEL;else for(;t!=r;)r.WindCnt2+=t.WindDelta,t=t.NextInAEL};h.Clipper.prototype.AddEdgeToSEL=function(r){this.m_SortedEdges===null?(this.m_SortedEdges=r,r.PrevInSEL=null,r.NextInSEL=null):(r.NextInSEL=this.m_SortedEdges,r.PrevInSEL=null,this.m_SortedEdges.PrevInSEL=r,this.m_SortedEdges=r)};h.Clipper.prototype.CopyAELToSEL=function(){var r=this.m_ActiveEdges;for(this.m_SortedEdges=r;r!==null;)r.PrevInSEL=r.PrevInAEL,r.NextInSEL=r.NextInAEL,r=r.NextInAEL};h.Clipper.prototype.SwapPositionsInAEL=function(r,t){if(!(r.NextInAEL==r.PrevInAEL||t.NextInAEL==t.PrevInAEL)){if(r.NextInAEL==t){var e=t.NextInAEL;e!==null&&(e.PrevInAEL=r);var i=r.PrevInAEL;i!==null&&(i.NextInAEL=t),t.PrevInAEL=i,t.NextInAEL=r,r.PrevInAEL=t,r.NextInAEL=e}else if(t.NextInAEL==r){var e=r.NextInAEL;e!==null&&(e.PrevInAEL=t);var i=t.PrevInAEL;i!==null&&(i.NextInAEL=r),r.PrevInAEL=i,r.NextInAEL=t,t.PrevInAEL=r,t.NextInAEL=e}else{var e=r.NextInAEL,i=r.PrevInAEL;r.NextInAEL=t.NextInAEL,r.NextInAEL!==null&&(r.NextInAEL.PrevInAEL=r),r.PrevInAEL=t.PrevInAEL,r.PrevInAEL!==null&&(r.PrevInAEL.NextInAEL=r),t.NextInAEL=e,t.NextInAEL!==null&&(t.NextInAEL.PrevInAEL=t),t.PrevInAEL=i,t.PrevInAEL!==null&&(t.PrevInAEL.NextInAEL=t)}r.PrevInAEL===null?this.m_ActiveEdges=r:t.PrevInAEL===null&&(this.m_ActiveEdges=t)}};h.Clipper.prototype.SwapPositionsInSEL=function(r,t){if(!(r.NextInSEL===null&&r.PrevInSEL===null)&&!(t.NextInSEL===null&&t.PrevInSEL===null)){if(r.NextInSEL==t){var e=t.NextInSEL;e!==null&&(e.PrevInSEL=r);var i=r.PrevInSEL;i!==null&&(i.NextInSEL=t),t.PrevInSEL=i,t.NextInSEL=r,r.PrevInSEL=t,r.NextInSEL=e}else if(t.NextInSEL==r){var e=r.NextInSEL;e!==null&&(e.PrevInSEL=t);var i=t.PrevInSEL;i!==null&&(i.NextInSEL=r),r.PrevInSEL=i,r.NextInSEL=t,t.PrevInSEL=r,t.NextInSEL=e}else{var e=r.NextInSEL,i=r.PrevInSEL;r.NextInSEL=t.NextInSEL,r.NextInSEL!==null&&(r.NextInSEL.PrevInSEL=r),r.PrevInSEL=t.PrevInSEL,r.PrevInSEL!==null&&(r.PrevInSEL.NextInSEL=r),t.NextInSEL=e,t.NextInSEL!==null&&(t.NextInSEL.PrevInSEL=t),t.PrevInSEL=i,t.PrevInSEL!==null&&(t.PrevInSEL.NextInSEL=t)}r.PrevInSEL===null?this.m_SortedEdges=r:t.PrevInSEL===null&&(this.m_SortedEdges=t)}};h.Clipper.prototype.AddLocalMaxPoly=function(r,t,e){this.AddOutPt(r,e),t.WindDelta==0&&this.AddOutPt(t,e),r.OutIdx==t.OutIdx?(r.OutIdx=-1,t.OutIdx=-1):r.OutIdx<t.OutIdx?this.AppendPolygon(r,t):this.AppendPolygon(t,r)};h.Clipper.prototype.AddLocalMinPoly=function(r,t,e){var i,n,o;if(h.ClipperBase.IsHorizontal(t)||r.Dx>t.Dx?(i=this.AddOutPt(r,e),t.OutIdx=r.OutIdx,r.Side=h.EdgeSide.esLeft,t.Side=h.EdgeSide.esRight,n=r,n.PrevInAEL==t?o=t.PrevInAEL:o=n.PrevInAEL):(i=this.AddOutPt(t,e),r.OutIdx=t.OutIdx,r.Side=h.EdgeSide.esRight,t.Side=h.EdgeSide.esLeft,n=t,n.PrevInAEL==r?o=r.PrevInAEL:o=n.PrevInAEL),o!==null&&o.OutIdx>=0&&h.Clipper.TopX(o,e.Y)==h.Clipper.TopX(n,e.Y)&&h.ClipperBase.SlopesEqual(n,o,this.m_UseFullRange)&&n.WindDelta!==0&&o.WindDelta!==0){var a=this.AddOutPt(o,e);this.AddJoin(i,a,n.Top)}return i};h.Clipper.prototype.CreateOutRec=function(){var r=new h.OutRec;return r.Idx=-1,r.IsHole=!1,r.IsOpen=!1,r.FirstLeft=null,r.Pts=null,r.BottomPt=null,r.PolyNode=null,this.m_PolyOuts.push(r),r.Idx=this.m_PolyOuts.length-1,r};h.Clipper.prototype.AddOutPt=function(r,t){var e=r.Side==h.EdgeSide.esLeft;if(r.OutIdx<0){var i=this.CreateOutRec();i.IsOpen=r.WindDelta===0;var n=new h.OutPt;return i.Pts=n,n.Idx=i.Idx,n.Pt.X=t.X,n.Pt.Y=t.Y,n.Next=n,n.Prev=n,i.IsOpen||this.SetHoleState(r,i),Ki&&(h.IntPoint.op_Equality(t,r.Bot)?(n.Pt.X=r.Bot.X,n.Pt.Y=r.Bot.Y,n.Pt.Z=r.Bot.Z):h.IntPoint.op_Equality(t,r.Top)?(n.Pt.X=r.Top.X,n.Pt.Y=r.Top.Y,n.Pt.Z=r.Top.Z):this.SetZ(n.Pt,r)),r.OutIdx=i.Idx,n}else{var i=this.m_PolyOuts[r.OutIdx],o=i.Pts;if(e&&h.IntPoint.op_Equality(t,o.Pt))return o;if(!e&&h.IntPoint.op_Equality(t,o.Prev.Pt))return o.Prev;var n=new h.OutPt;return n.Idx=i.Idx,n.Pt.X=t.X,n.Pt.Y=t.Y,n.Next=o,n.Prev=o.Prev,n.Prev.Next=n,o.Prev=n,e&&(i.Pts=n),Ki&&(h.IntPoint.op_Equality(t,r.Bot)?(n.Pt.X=r.Bot.X,n.Pt.Y=r.Bot.Y,n.Pt.Z=r.Bot.Z):h.IntPoint.op_Equality(t,r.Top)?(n.Pt.X=r.Top.X,n.Pt.Y=r.Top.Y,n.Pt.Z=r.Top.Z):this.SetZ(n.Pt,r)),n}};h.Clipper.prototype.SwapPoints=function(r,t){var e=new h.IntPoint(r.Value);r.Value.X=t.Value.X,r.Value.Y=t.Value.Y,t.Value.X=e.X,t.Value.Y=e.Y};h.Clipper.prototype.HorzSegmentsOverlap=function(r,t,e,i){return r.X>e.X==r.X<i.X||t.X>e.X==t.X<i.X||e.X>r.X==e.X<t.X||i.X>r.X==i.X<t.X||r.X==e.X&&t.X==i.X?!0:r.X==i.X&&t.X==e.X};h.Clipper.prototype.InsertPolyPtBetween=function(r,t,e){var i=new h.OutPt;return i.Pt.X=e.X,i.Pt.Y=e.Y,t==r.Next?(r.Next=i,t.Prev=i,i.Next=t,i.Prev=r):(t.Next=i,r.Prev=i,i.Next=r,i.Prev=t),i};h.Clipper.prototype.SetHoleState=function(r,t){for(var e=!1,i=r.PrevInAEL;i!==null;)i.OutIdx>=0&&i.WindDelta!=0&&(e=!e,t.FirstLeft===null&&(t.FirstLeft=this.m_PolyOuts[i.OutIdx])),i=i.PrevInAEL;e&&(t.IsHole=!0)};h.Clipper.prototype.GetDx=function(r,t){return r.Y==t.Y?h.ClipperBase.horizontal:(t.X-r.X)/(t.Y-r.Y)};h.Clipper.prototype.FirstIsBottomPt=function(r,t){for(var e=r.Prev;h.IntPoint.op_Equality(e.Pt,r.Pt)&&e!=r;)e=e.Prev;var i=Math.abs(this.GetDx(r.Pt,e.Pt));for(e=r.Next;h.IntPoint.op_Equality(e.Pt,r.Pt)&&e!=r;)e=e.Next;var n=Math.abs(this.GetDx(r.Pt,e.Pt));for(e=t.Prev;h.IntPoint.op_Equality(e.Pt,t.Pt)&&e!=t;)e=e.Prev;var o=Math.abs(this.GetDx(t.Pt,e.Pt));for(e=t.Next;h.IntPoint.op_Equality(e.Pt,t.Pt)&&e!=t;)e=e.Next;var a=Math.abs(this.GetDx(t.Pt,e.Pt));return i>=o&&i>=a||n>=o&&n>=a};h.Clipper.prototype.GetBottomPt=function(r){for(var t=null,e=r.Next;e!=r;)e.Pt.Y>r.Pt.Y?(r=e,t=null):e.Pt.Y==r.Pt.Y&&e.Pt.X<=r.Pt.X&&(e.Pt.X<r.Pt.X?(t=null,r=e):e.Next!=r&&e.Prev!=r&&(t=e)),e=e.Next;if(t!==null)for(;t!=e;)for(this.FirstIsBottomPt(e,t)||(r=t),t=t.Next;h.IntPoint.op_Inequality(t.Pt,r.Pt);)t=t.Next;return r};h.Clipper.prototype.GetLowermostRec=function(r,t){r.BottomPt===null&&(r.BottomPt=this.GetBottomPt(r.Pts)),t.BottomPt===null&&(t.BottomPt=this.GetBottomPt(t.Pts));var e=r.BottomPt,i=t.BottomPt;return e.Pt.Y>i.Pt.Y?r:e.Pt.Y<i.Pt.Y?t:e.Pt.X<i.Pt.X?r:e.Pt.X>i.Pt.X||e.Next==e?t:i.Next==i||this.FirstIsBottomPt(e,i)?r:t};h.Clipper.prototype.Param1RightOfParam2=function(r,t){do if(r=r.FirstLeft,r==t)return!0;while(r!==null);return!1};h.Clipper.prototype.GetOutRec=function(r){for(var t=this.m_PolyOuts[r];t!=this.m_PolyOuts[t.Idx];)t=this.m_PolyOuts[t.Idx];return t};h.Clipper.prototype.AppendPolygon=function(r,t){var e=this.m_PolyOuts[r.OutIdx],i=this.m_PolyOuts[t.OutIdx],n;this.Param1RightOfParam2(e,i)?n=i:this.Param1RightOfParam2(i,e)?n=e:n=this.GetLowermostRec(e,i);var o=e.Pts,a=o.Prev,u=i.Pts,s=u.Prev,p;r.Side==h.EdgeSide.esLeft?(t.Side==h.EdgeSide.esLeft?(this.ReversePolyPtLinks(u),u.Next=o,o.Prev=u,a.Next=s,s.Prev=a,e.Pts=s):(s.Next=o,o.Prev=s,u.Prev=a,a.Next=u,e.Pts=u),p=h.EdgeSide.esLeft):(t.Side==h.EdgeSide.esRight?(this.ReversePolyPtLinks(u),a.Next=s,s.Prev=a,u.Next=o,o.Prev=u):(a.Next=u,u.Prev=a,o.Prev=s,s.Next=o),p=h.EdgeSide.esRight),e.BottomPt=null,n==i&&(i.FirstLeft!=e&&(e.FirstLeft=i.FirstLeft),e.IsHole=i.IsHole),i.Pts=null,i.BottomPt=null,i.FirstLeft=e;var f=r.OutIdx,m=t.OutIdx;r.OutIdx=-1,t.OutIdx=-1;for(var y=this.m_ActiveEdges;y!==null;){if(y.OutIdx==m){y.OutIdx=f,y.Side=p;break}y=y.NextInAEL}i.Idx=e.Idx};h.Clipper.prototype.ReversePolyPtLinks=function(r){if(r!==null){var t,e;t=r;do e=t.Next,t.Next=t.Prev,t.Prev=e,t=e;while(t!=r)}};h.Clipper.SwapSides=function(r,t){var e=r.Side;r.Side=t.Side,t.Side=e};h.Clipper.SwapPolyIndexes=function(r,t){var e=r.OutIdx;r.OutIdx=t.OutIdx,t.OutIdx=e};h.Clipper.prototype.IntersectEdges=function(r,t,e,i){var n=!i&&r.NextInLML===null&&r.Top.X==e.X&&r.Top.Y==e.Y,o=!i&&t.NextInLML===null&&t.Top.X==e.X&&t.Top.Y==e.Y,a=r.OutIdx>=0,u=t.OutIdx>=0;if(Qb&&(r.WindDelta===0||t.WindDelta===0)){r.WindDelta===0&&t.WindDelta===0?(n||o)&&a&&u&&this.AddLocalMaxPoly(r,t,e):r.PolyTyp==t.PolyTyp&&r.WindDelta!=t.WindDelta&&this.m_ClipType==h.ClipType.ctUnion?r.WindDelta===0?u&&(this.AddOutPt(r,e),a&&(r.OutIdx=-1)):a&&(this.AddOutPt(t,e),u&&(t.OutIdx=-1)):r.PolyTyp!=t.PolyTyp&&(r.WindDelta===0&&Math.abs(t.WindCnt)==1&&(this.m_ClipType!=h.ClipType.ctUnion||t.WindCnt2===0)?(this.AddOutPt(r,e),a&&(r.OutIdx=-1)):t.WindDelta===0&&Math.abs(r.WindCnt)==1&&(this.m_ClipType!=h.ClipType.ctUnion||r.WindCnt2===0)&&(this.AddOutPt(t,e),u&&(t.OutIdx=-1))),n&&(r.OutIdx<0?this.DeleteFromAEL(r):h.Error("Error intersecting polylines")),o&&(t.OutIdx<0?this.DeleteFromAEL(t):h.Error("Error intersecting polylines"));return}if(r.PolyTyp==t.PolyTyp)if(this.IsEvenOddFillType(r)){var s=r.WindCnt;r.WindCnt=t.WindCnt,t.WindCnt=s}else r.WindCnt+t.WindDelta===0?r.WindCnt=-r.WindCnt:r.WindCnt+=t.WindDelta,t.WindCnt-r.WindDelta===0?t.WindCnt=-t.WindCnt:t.WindCnt-=r.WindDelta;else this.IsEvenOddFillType(t)?r.WindCnt2=r.WindCnt2===0?1:0:r.WindCnt2+=t.WindDelta,this.IsEvenOddFillType(r)?t.WindCnt2=t.WindCnt2===0?1:0:t.WindCnt2-=r.WindDelta;var p,f,m,y;r.PolyTyp==h.PolyType.ptSubject?(p=this.m_SubjFillType,m=this.m_ClipFillType):(p=this.m_ClipFillType,m=this.m_SubjFillType),t.PolyTyp==h.PolyType.ptSubject?(f=this.m_SubjFillType,y=this.m_ClipFillType):(f=this.m_ClipFillType,y=this.m_SubjFillType);var x,S;switch(p){case h.PolyFillType.pftPositive:x=r.WindCnt;break;case h.PolyFillType.pftNegative:x=-r.WindCnt;break;default:x=Math.abs(r.WindCnt);break}switch(f){case h.PolyFillType.pftPositive:S=t.WindCnt;break;case h.PolyFillType.pftNegative:S=-t.WindCnt;break;default:S=Math.abs(t.WindCnt);break}if(a&&u)n||o||x!==0&&x!=1||S!==0&&S!=1||r.PolyTyp!=t.PolyTyp&&this.m_ClipType!=h.ClipType.ctXor?this.AddLocalMaxPoly(r,t,e):(this.AddOutPt(r,e),this.AddOutPt(t,e),h.Clipper.SwapSides(r,t),h.Clipper.SwapPolyIndexes(r,t));else if(a)(S===0||S==1)&&(this.AddOutPt(r,e),h.Clipper.SwapSides(r,t),h.Clipper.SwapPolyIndexes(r,t));else if(u)(x===0||x==1)&&(this.AddOutPt(t,e),h.Clipper.SwapSides(r,t),h.Clipper.SwapPolyIndexes(r,t));else if((x===0||x==1)&&(S===0||S==1)&&!n&&!o){var M,g;switch(m){case h.PolyFillType.pftPositive:M=r.WindCnt2;break;case h.PolyFillType.pftNegative:M=-r.WindCnt2;break;default:M=Math.abs(r.WindCnt2);break}switch(y){case h.PolyFillType.pftPositive:g=t.WindCnt2;break;case h.PolyFillType.pftNegative:g=-t.WindCnt2;break;default:g=Math.abs(t.WindCnt2);break}if(r.PolyTyp!=t.PolyTyp)this.AddLocalMinPoly(r,t,e);else if(x==1&&S==1)switch(this.m_ClipType){case h.ClipType.ctIntersection:M>0&&g>0&&this.AddLocalMinPoly(r,t,e);break;case h.ClipType.ctUnion:M<=0&&g<=0&&this.AddLocalMinPoly(r,t,e);break;case h.ClipType.ctDifference:(r.PolyTyp==h.PolyType.ptClip&&M>0&&g>0||r.PolyTyp==h.PolyType.ptSubject&&M<=0&&g<=0)&&this.AddLocalMinPoly(r,t,e);break;case h.ClipType.ctXor:this.AddLocalMinPoly(r,t,e);break}else h.Clipper.SwapSides(r,t)}n!=o&&(n&&r.OutIdx>=0||o&&t.OutIdx>=0)&&(h.Clipper.SwapSides(r,t),h.Clipper.SwapPolyIndexes(r,t)),n&&this.DeleteFromAEL(r),o&&this.DeleteFromAEL(t)};h.Clipper.prototype.DeleteFromAEL=function(r){var t=r.PrevInAEL,e=r.NextInAEL;t===null&&e===null&&r!=this.m_ActiveEdges||(t!==null?t.NextInAEL=e:this.m_ActiveEdges=e,e!==null&&(e.PrevInAEL=t),r.NextInAEL=null,r.PrevInAEL=null)};h.Clipper.prototype.DeleteFromSEL=function(r){var t=r.PrevInSEL,e=r.NextInSEL;t===null&&e===null&&r!=this.m_SortedEdges||(t!==null?t.NextInSEL=e:this.m_SortedEdges=e,e!==null&&(e.PrevInSEL=t),r.NextInSEL=null,r.PrevInSEL=null)};h.Clipper.prototype.UpdateEdgeIntoAEL=function(r){r.NextInLML===null&&h.Error("UpdateEdgeIntoAEL: invalid call");var t=r.PrevInAEL,e=r.NextInAEL;return r.NextInLML.OutIdx=r.OutIdx,t!==null?t.NextInAEL=r.NextInLML:this.m_ActiveEdges=r.NextInLML,e!==null&&(e.PrevInAEL=r.NextInLML),r.NextInLML.Side=r.Side,r.NextInLML.WindDelta=r.WindDelta,r.NextInLML.WindCnt=r.WindCnt,r.NextInLML.WindCnt2=r.WindCnt2,r=r.NextInLML,r.Curr.X=r.Bot.X,r.Curr.Y=r.Bot.Y,r.PrevInAEL=t,r.NextInAEL=e,h.ClipperBase.IsHorizontal(r)||this.InsertScanbeam(r.Top.Y),r};h.Clipper.prototype.ProcessHorizontals=function(r){for(var t=this.m_SortedEdges;t!==null;)this.DeleteFromSEL(t),this.ProcessHorizontal(t,r),t=this.m_SortedEdges};h.Clipper.prototype.GetHorzDirection=function(r,t){r.Bot.X<r.Top.X?(t.Left=r.Bot.X,t.Right=r.Top.X,t.Dir=h.Direction.dLeftToRight):(t.Left=r.Top.X,t.Right=r.Bot.X,t.Dir=h.Direction.dRightToLeft)};h.Clipper.prototype.PrepareHorzJoins=function(r,t){var e=this.m_PolyOuts[r.OutIdx].Pts;r.Side!=h.EdgeSide.esLeft&&(e=e.Prev),t&&(h.IntPoint.op_Equality(e.Pt,r.Top)?this.AddGhostJoin(e,r.Bot):this.AddGhostJoin(e,r.Top))};h.Clipper.prototype.ProcessHorizontal=function(r,t){var e={Dir:null,Left:null,Right:null};this.GetHorzDirection(r,e);for(var i=e.Dir,n=e.Left,o=e.Right,a=r,u=null;a.NextInLML!==null&&h.ClipperBase.IsHorizontal(a.NextInLML);)a=a.NextInLML;for(a.NextInLML===null&&(u=this.GetMaximaPair(a));;){for(var s=r==a,p=this.GetNextInAEL(r,i);p!==null&&!(p.Curr.X==r.Top.X&&r.NextInLML!==null&&p.Dx<r.NextInLML.Dx);){var f=this.GetNextInAEL(p,i);if(i==h.Direction.dLeftToRight&&p.Curr.X<=o||i==h.Direction.dRightToLeft&&p.Curr.X>=n){if(r.OutIdx>=0&&r.WindDelta!=0&&this.PrepareHorzJoins(r,t),p==u&&s){i==h.Direction.dLeftToRight?this.IntersectEdges(r,p,p.Top,!1):this.IntersectEdges(p,r,p.Top,!1),u.OutIdx>=0&&h.Error("ProcessHorizontal error");return}else if(i==h.Direction.dLeftToRight){var m=new h.IntPoint(p.Curr.X,r.Curr.Y);this.IntersectEdges(r,p,m,!0)}else{var m=new h.IntPoint(p.Curr.X,r.Curr.Y);this.IntersectEdges(p,r,m,!0)}this.SwapPositionsInAEL(r,p)}else if(i==h.Direction.dLeftToRight&&p.Curr.X>=o||i==h.Direction.dRightToLeft&&p.Curr.X<=n)break;p=f}if(r.OutIdx>=0&&r.WindDelta!==0&&this.PrepareHorzJoins(r,t),r.NextInLML!==null&&h.ClipperBase.IsHorizontal(r.NextInLML)){r=this.UpdateEdgeIntoAEL(r),r.OutIdx>=0&&this.AddOutPt(r,r.Bot);var e={Dir:i,Left:n,Right:o};this.GetHorzDirection(r,e),i=e.Dir,n=e.Left,o=e.Right}else break}if(r.NextInLML!==null)if(r.OutIdx>=0){var y=this.AddOutPt(r,r.Top);if(r=this.UpdateEdgeIntoAEL(r),r.WindDelta===0)return;var x=r.PrevInAEL,f=r.NextInAEL;if(x!==null&&x.Curr.X==r.Bot.X&&x.Curr.Y==r.Bot.Y&&x.WindDelta!==0&&x.OutIdx>=0&&x.Curr.Y>x.Top.Y&&h.ClipperBase.SlopesEqual(r,x,this.m_UseFullRange)){var S=this.AddOutPt(x,r.Bot);this.AddJoin(y,S,r.Top)}else if(f!==null&&f.Curr.X==r.Bot.X&&f.Curr.Y==r.Bot.Y&&f.WindDelta!==0&&f.OutIdx>=0&&f.Curr.Y>f.Top.Y&&h.ClipperBase.SlopesEqual(r,f,this.m_UseFullRange)){var S=this.AddOutPt(f,r.Bot);this.AddJoin(y,S,r.Top)}}else r=this.UpdateEdgeIntoAEL(r);else u!==null?u.OutIdx>=0?(i==h.Direction.dLeftToRight?this.IntersectEdges(r,u,r.Top,!1):this.IntersectEdges(u,r,r.Top,!1),u.OutIdx>=0&&h.Error("ProcessHorizontal error")):(this.DeleteFromAEL(r),this.DeleteFromAEL(u)):(r.OutIdx>=0&&this.AddOutPt(r,r.Top),this.DeleteFromAEL(r))};h.Clipper.prototype.GetNextInAEL=function(r,t){return t==h.Direction.dLeftToRight?r.NextInAEL:r.PrevInAEL};h.Clipper.prototype.IsMinima=function(r){return r!==null&&r.Prev.NextInLML!=r&&r.Next.NextInLML!=r};h.Clipper.prototype.IsMaxima=function(r,t){return r!==null&&r.Top.Y==t&&r.NextInLML===null};h.Clipper.prototype.IsIntermediate=function(r,t){return r.Top.Y==t&&r.NextInLML!==null};h.Clipper.prototype.GetMaximaPair=function(r){var t=null;return h.IntPoint.op_Equality(r.Next.Top,r.Top)&&r.Next.NextInLML===null?t=r.Next:h.IntPoint.op_Equality(r.Prev.Top,r.Top)&&r.Prev.NextInLML===null&&(t=r.Prev),t!==null&&(t.OutIdx==-2||t.NextInAEL==t.PrevInAEL&&!h.ClipperBase.IsHorizontal(t))?null:t};h.Clipper.prototype.ProcessIntersections=function(r,t){if(this.m_ActiveEdges==null)return!0;try{if(this.BuildIntersectList(r,t),this.m_IntersectList.length==0)return!0;if(this.m_IntersectList.length==1||this.FixupIntersectionOrder())this.ProcessIntersectList();else return!1}catch{this.m_SortedEdges=null,this.m_IntersectList.length=0,h.Error("ProcessIntersections error")}return this.m_SortedEdges=null,!0};h.Clipper.prototype.BuildIntersectList=function(r,t){if(this.m_ActiveEdges!==null){var e=this.m_ActiveEdges;for(this.m_SortedEdges=e;e!==null;)e.PrevInSEL=e.PrevInAEL,e.NextInSEL=e.NextInAEL,e.Curr.X=h.Clipper.TopX(e,t),e=e.NextInAEL;for(var i=!0;i&&this.m_SortedEdges!==null;){for(i=!1,e=this.m_SortedEdges;e.NextInSEL!==null;){var n=e.NextInSEL,o=new h.IntPoint;if(e.Curr.X>n.Curr.X){!this.IntersectPoint(e,n,o)&&e.Curr.X>n.Curr.X+1&&h.Error("Intersection error"),o.Y>r&&(o.Y=r,Math.abs(e.Dx)>Math.abs(n.Dx)?o.X=h.Clipper.TopX(n,r):o.X=h.Clipper.TopX(e,r));var a=new h.IntersectNode;a.Edge1=e,a.Edge2=n,a.Pt.X=o.X,a.Pt.Y=o.Y,this.m_IntersectList.push(a),this.SwapPositionsInSEL(e,n),i=!0}else e=n}if(e.PrevInSEL!==null)e.PrevInSEL.NextInSEL=null;else break}this.m_SortedEdges=null}};h.Clipper.prototype.EdgesAdjacent=function(r){return r.Edge1.NextInSEL==r.Edge2||r.Edge1.PrevInSEL==r.Edge2};h.Clipper.IntersectNodeSort=function(r,t){return t.Pt.Y-r.Pt.Y};h.Clipper.prototype.FixupIntersectionOrder=function(){this.m_IntersectList.sort(this.m_IntersectNodeComparer),this.CopyAELToSEL();for(var r=this.m_IntersectList.length,t=0;t<r;t++){if(!this.EdgesAdjacent(this.m_IntersectList[t])){for(var e=t+1;e<r&&!this.EdgesAdjacent(this.m_IntersectList[e]);)e++;if(e==r)return!1;var i=this.m_IntersectList[t];this.m_IntersectList[t]=this.m_IntersectList[e],this.m_IntersectList[e]=i}this.SwapPositionsInSEL(this.m_IntersectList[t].Edge1,this.m_IntersectList[t].Edge2)}return!0};h.Clipper.prototype.ProcessIntersectList=function(){for(var r=0,t=this.m_IntersectList.length;r<t;r++){var e=this.m_IntersectList[r];this.IntersectEdges(e.Edge1,e.Edge2,e.Pt,!0),this.SwapPositionsInAEL(e.Edge1,e.Edge2)}this.m_IntersectList.length=0};var BP=l(function(r){return r<0?Math.ceil(r-.5):Math.round(r)},"R1"),FP=l(function(r){return r<0?Math.ceil(r-.5):Math.floor(r+.5)},"R2"),GP=l(function(r){return r<0?-Math.round(Math.abs(r)):Math.round(r)},"R3"),VP=l(function(r){return r<0?(r-=.5,r<-2147483648?Math.ceil(r):r|0):(r+=.5,r>2147483647?Math.floor(r):r|0)},"R4");z.msie?h.Clipper.Round=BP:z.chromium?h.Clipper.Round=GP:z.safari?h.Clipper.Round=VP:h.Clipper.Round=FP;h.Clipper.TopX=function(r,t){return t==r.Top.Y?r.Top.X:r.Bot.X+h.Clipper.Round(r.Dx*(t-r.Bot.Y))};h.Clipper.prototype.IntersectPoint=function(r,t,e){e.X=0,e.Y=0;var i,n;if(h.ClipperBase.SlopesEqual(r,t,this.m_UseFullRange)||r.Dx==t.Dx)return t.Bot.Y>r.Bot.Y?(e.X=t.Bot.X,e.Y=t.Bot.Y):(e.X=r.Bot.X,e.Y=r.Bot.Y),!1;if(r.Delta.X===0)e.X=r.Bot.X,h.ClipperBase.IsHorizontal(t)?e.Y=t.Bot.Y:(n=t.Bot.Y-t.Bot.X/t.Dx,e.Y=h.Clipper.Round(e.X/t.Dx+n));else if(t.Delta.X===0)e.X=t.Bot.X,h.ClipperBase.IsHorizontal(r)?e.Y=r.Bot.Y:(i=r.Bot.Y-r.Bot.X/r.Dx,e.Y=h.Clipper.Round(e.X/r.Dx+i));else{i=r.Bot.X-r.Bot.Y*r.Dx,n=t.Bot.X-t.Bot.Y*t.Dx;var o=(n-i)/(r.Dx-t.Dx);e.Y=h.Clipper.Round(o),Math.abs(r.Dx)<Math.abs(t.Dx)?e.X=h.Clipper.Round(r.Dx*o+i):e.X=h.Clipper.Round(t.Dx*o+n)}if(e.Y<r.Top.Y||e.Y<t.Top.Y){if(r.Top.Y>t.Top.Y)return e.Y=r.Top.Y,e.X=h.Clipper.TopX(t,r.Top.Y),e.X<r.Top.X;e.Y=t.Top.Y,Math.abs(r.Dx)<Math.abs(t.Dx)?e.X=h.Clipper.TopX(r,e.Y):e.X=h.Clipper.TopX(t,e.Y)}return!0};h.Clipper.prototype.ProcessEdgesAtTopOfScanbeam=function(r){for(var t=this.m_ActiveEdges;t!==null;){var e=this.IsMaxima(t,r);if(e){var i=this.GetMaximaPair(t);e=i===null||!h.ClipperBase.IsHorizontal(i)}if(e){var n=t.PrevInAEL;this.DoMaxima(t),n===null?t=this.m_ActiveEdges:t=n.NextInAEL}else{if(this.IsIntermediate(t,r)&&h.ClipperBase.IsHorizontal(t.NextInLML)?(t=this.UpdateEdgeIntoAEL(t),t.OutIdx>=0&&this.AddOutPt(t,t.Bot),this.AddEdgeToSEL(t)):(t.Curr.X=h.Clipper.TopX(t,r),t.Curr.Y=r),this.StrictlySimple){var n=t.PrevInAEL;if(t.OutIdx>=0&&t.WindDelta!==0&&n!==null&&n.OutIdx>=0&&n.Curr.X==t.Curr.X&&n.WindDelta!==0){var o=this.AddOutPt(n,t.Curr),a=this.AddOutPt(t,t.Curr);this.AddJoin(o,a,t.Curr)}}t=t.NextInAEL}}for(this.ProcessHorizontals(!0),t=this.m_ActiveEdges;t!==null;){if(this.IsIntermediate(t,r)){var o=null;t.OutIdx>=0&&(o=this.AddOutPt(t,t.Top)),t=this.UpdateEdgeIntoAEL(t);var n=t.PrevInAEL,u=t.NextInAEL;if(n!==null&&n.Curr.X==t.Bot.X&&n.Curr.Y==t.Bot.Y&&o!==null&&n.OutIdx>=0&&n.Curr.Y>n.Top.Y&&h.ClipperBase.SlopesEqual(t,n,this.m_UseFullRange)&&t.WindDelta!==0&&n.WindDelta!==0){var a=this.AddOutPt(n,t.Bot);this.AddJoin(o,a,t.Top)}else if(u!==null&&u.Curr.X==t.Bot.X&&u.Curr.Y==t.Bot.Y&&o!==null&&u.OutIdx>=0&&u.Curr.Y>u.Top.Y&&h.ClipperBase.SlopesEqual(t,u,this.m_UseFullRange)&&t.WindDelta!==0&&u.WindDelta!==0){var a=this.AddOutPt(u,t.Bot);this.AddJoin(o,a,t.Top)}}t=t.NextInAEL}};h.Clipper.prototype.DoMaxima=function(r){var t=this.GetMaximaPair(r);if(t===null){r.OutIdx>=0&&this.AddOutPt(r,r.Top),this.DeleteFromAEL(r);return}for(var e=r.NextInAEL,i=!0;e!==null&&e!=t;)this.IntersectEdges(r,e,r.Top,!0),this.SwapPositionsInAEL(r,e),e=r.NextInAEL;r.OutIdx==-1&&t.OutIdx==-1?(this.DeleteFromAEL(r),this.DeleteFromAEL(t)):r.OutIdx>=0&&t.OutIdx>=0?this.IntersectEdges(r,t,r.Top,!1):i&&r.WindDelta===0?(r.OutIdx>=0&&(this.AddOutPt(r,r.Top),r.OutIdx=-1),this.DeleteFromAEL(r),t.OutIdx>=0&&(this.AddOutPt(t,r.Top),t.OutIdx=-1),this.DeleteFromAEL(t)):h.Error("DoMaxima error")};h.Clipper.ReversePaths=function(r){for(var t=0,e=r.length;t<e;t++)r[t].reverse()};h.Clipper.Orientation=function(r){return h.Clipper.Area(r)>=0};h.Clipper.prototype.PointCount=function(r){if(r===null)return 0;var t=0,e=r;do t++,e=e.Next;while(e!=r);return t};h.Clipper.prototype.BuildResult=function(r){h.Clear(r);for(var t=0,e=this.m_PolyOuts.length;t<e;t++){var i=this.m_PolyOuts[t];if(i.Pts!==null){var n=i.Pts.Prev,o=this.PointCount(n);if(!(o<2)){for(var a=new Array(o),u=0;u<o;u++)a[u]=n.Pt,n=n.Prev;r.push(a)}}}};h.Clipper.prototype.BuildResult2=function(r){r.Clear();for(var t=0,e=this.m_PolyOuts.length;t<e;t++){var i=this.m_PolyOuts[t],n=this.PointCount(i.Pts);if(!(i.IsOpen&&n<2||!i.IsOpen&&n<3)){this.FixHoleLinkage(i);var o=new h.PolyNode;r.m_AllPolys.push(o),i.PolyNode=o,o.m_polygon.length=n;for(var a=i.Pts.Prev,u=0;u<n;u++)o.m_polygon[u]=a.Pt,a=a.Prev}}for(var t=0,e=this.m_PolyOuts.length;t<e;t++){var i=this.m_PolyOuts[t];i.PolyNode!==null&&(i.IsOpen?(i.PolyNode.IsOpen=!0,r.AddChild(i.PolyNode)):i.FirstLeft!==null&&i.FirstLeft.PolyNode!=null?i.FirstLeft.PolyNode.AddChild(i.PolyNode):r.AddChild(i.PolyNode))}};h.Clipper.prototype.FixupOutPolygon=function(r){var t=null;r.BottomPt=null;for(var e=r.Pts;;){if(e.Prev==e||e.Prev==e.Next){this.DisposeOutPts(e),r.Pts=null;return}if(h.IntPoint.op_Equality(e.Pt,e.Next.Pt)||h.IntPoint.op_Equality(e.Pt,e.Prev.Pt)||h.ClipperBase.SlopesEqual(e.Prev.Pt,e.Pt,e.Next.Pt,this.m_UseFullRange)&&(!this.PreserveCollinear||!this.Pt2IsBetweenPt1AndPt3(e.Prev.Pt,e.Pt,e.Next.Pt))){t=null;var i=e;e.Prev.Next=e.Next,e.Next.Prev=e.Prev,e=e.Prev,i=null}else{if(e==t)break;t===null&&(t=e),e=e.Next}}r.Pts=e};h.Clipper.prototype.DupOutPt=function(r,t){var e=new h.OutPt;return e.Pt.X=r.Pt.X,e.Pt.Y=r.Pt.Y,e.Idx=r.Idx,t?(e.Next=r.Next,e.Prev=r,r.Next.Prev=e,r.Next=e):(e.Prev=r.Prev,e.Next=r,r.Prev.Next=e,r.Prev=e),e};h.Clipper.prototype.GetOverlap=function(r,t,e,i,n){return r<t?e<i?(n.Left=Math.max(r,e),n.Right=Math.min(t,i)):(n.Left=Math.max(r,i),n.Right=Math.min(t,e)):e<i?(n.Left=Math.max(t,e),n.Right=Math.min(r,i)):(n.Left=Math.max(t,i),n.Right=Math.min(r,e)),n.Left<n.Right};h.Clipper.prototype.JoinHorz=function(r,t,e,i,n,o){var a=r.Pt.X>t.Pt.X?h.Direction.dRightToLeft:h.Direction.dLeftToRight,u=e.Pt.X>i.Pt.X?h.Direction.dRightToLeft:h.Direction.dLeftToRight;if(a==u)return!1;if(a==h.Direction.dLeftToRight){for(;r.Next.Pt.X<=n.X&&r.Next.Pt.X>=r.Pt.X&&r.Next.Pt.Y==n.Y;)r=r.Next;o&&r.Pt.X!=n.X&&(r=r.Next),t=this.DupOutPt(r,!o),h.IntPoint.op_Inequality(t.Pt,n)&&(r=t,r.Pt.X=n.X,r.Pt.Y=n.Y,t=this.DupOutPt(r,!o))}else{for(;r.Next.Pt.X>=n.X&&r.Next.Pt.X<=r.Pt.X&&r.Next.Pt.Y==n.Y;)r=r.Next;!o&&r.Pt.X!=n.X&&(r=r.Next),t=this.DupOutPt(r,o),h.IntPoint.op_Inequality(t.Pt,n)&&(r=t,r.Pt.X=n.X,r.Pt.Y=n.Y,t=this.DupOutPt(r,o))}if(u==h.Direction.dLeftToRight){for(;e.Next.Pt.X<=n.X&&e.Next.Pt.X>=e.Pt.X&&e.Next.Pt.Y==n.Y;)e=e.Next;o&&e.Pt.X!=n.X&&(e=e.Next),i=this.DupOutPt(e,!o),h.IntPoint.op_Inequality(i.Pt,n)&&(e=i,e.Pt.X=n.X,e.Pt.Y=n.Y,i=this.DupOutPt(e,!o))}else{for(;e.Next.Pt.X>=n.X&&e.Next.Pt.X<=e.Pt.X&&e.Next.Pt.Y==n.Y;)e=e.Next;!o&&e.Pt.X!=n.X&&(e=e.Next),i=this.DupOutPt(e,o),h.IntPoint.op_Inequality(i.Pt,n)&&(e=i,e.Pt.X=n.X,e.Pt.Y=n.Y,i=this.DupOutPt(e,o))}return a==h.Direction.dLeftToRight==o?(r.Prev=e,e.Next=r,t.Next=i,i.Prev=t):(r.Next=e,e.Prev=r,t.Prev=i,i.Next=t),!0};h.Clipper.prototype.JoinPoints=function(r,t,e){var i=r.OutPt1,n=new h.OutPt,o=r.OutPt2,a=new h.OutPt,u=r.OutPt1.Pt.Y==r.OffPt.Y;if(u&&h.IntPoint.op_Equality(r.OffPt,r.OutPt1.Pt)&&h.IntPoint.op_Equality(r.OffPt,r.OutPt2.Pt)){for(n=r.OutPt1.Next;n!=i&&h.IntPoint.op_Equality(n.Pt,r.OffPt);)n=n.Next;var s=n.Pt.Y>r.OffPt.Y;for(a=r.OutPt2.Next;a!=o&&h.IntPoint.op_Equality(a.Pt,r.OffPt);)a=a.Next;var p=a.Pt.Y>r.OffPt.Y;return s==p?!1:s?(n=this.DupOutPt(i,!1),a=this.DupOutPt(o,!0),i.Prev=o,o.Next=i,n.Next=a,a.Prev=n,r.OutPt1=i,r.OutPt2=n,!0):(n=this.DupOutPt(i,!0),a=this.DupOutPt(o,!1),i.Next=o,o.Prev=i,n.Prev=a,a.Next=n,r.OutPt1=i,r.OutPt2=n,!0)}else if(u){for(n=i;i.Prev.Pt.Y==i.Pt.Y&&i.Prev!=n&&i.Prev!=o;)i=i.Prev;for(;n.Next.Pt.Y==n.Pt.Y&&n.Next!=i&&n.Next!=o;)n=n.Next;if(n.Next==i||n.Next==o)return!1;for(a=o;o.Prev.Pt.Y==o.Pt.Y&&o.Prev!=a&&o.Prev!=n;)o=o.Prev;for(;a.Next.Pt.Y==a.Pt.Y&&a.Next!=o&&a.Next!=i;)a=a.Next;if(a.Next==o||a.Next==i)return!1;var f={Left:null,Right:null};if(!this.GetOverlap(i.Pt.X,n.Pt.X,o.Pt.X,a.Pt.X,f))return!1;var m=f.Left,y=f.Right,x=new h.IntPoint,S;return i.Pt.X>=m&&i.Pt.X<=y?(x.X=i.Pt.X,x.Y=i.Pt.Y,S=i.Pt.X>n.Pt.X):o.Pt.X>=m&&o.Pt.X<=y?(x.X=o.Pt.X,x.Y=o.Pt.Y,S=o.Pt.X>a.Pt.X):n.Pt.X>=m&&n.Pt.X<=y?(x.X=n.Pt.X,x.Y=n.Pt.Y,S=n.Pt.X>i.Pt.X):(x.X=a.Pt.X,x.Y=a.Pt.Y,S=a.Pt.X>o.Pt.X),r.OutPt1=i,r.OutPt2=o,this.JoinHorz(i,n,o,a,x,S)}else{for(n=i.Next;h.IntPoint.op_Equality(n.Pt,i.Pt)&&n!=i;)n=n.Next;var M=n.Pt.Y>i.Pt.Y||!h.ClipperBase.SlopesEqual(i.Pt,n.Pt,r.OffPt,this.m_UseFullRange);if(M){for(n=i.Prev;h.IntPoint.op_Equality(n.Pt,i.Pt)&&n!=i;)n=n.Prev;if(n.Pt.Y>i.Pt.Y||!h.ClipperBase.SlopesEqual(i.Pt,n.Pt,r.OffPt,this.m_UseFullRange))return!1}for(a=o.Next;h.IntPoint.op_Equality(a.Pt,o.Pt)&&a!=o;)a=a.Next;var g=a.Pt.Y>o.Pt.Y||!h.ClipperBase.SlopesEqual(o.Pt,a.Pt,r.OffPt,this.m_UseFullRange);if(g){for(a=o.Prev;h.IntPoint.op_Equality(a.Pt,o.Pt)&&a!=o;)a=a.Prev;if(a.Pt.Y>o.Pt.Y||!h.ClipperBase.SlopesEqual(o.Pt,a.Pt,r.OffPt,this.m_UseFullRange))return!1}return n==i||a==o||n==a||t==e&&M==g?!1:M?(n=this.DupOutPt(i,!1),a=this.DupOutPt(o,!0),i.Prev=o,o.Next=i,n.Next=a,a.Prev=n,r.OutPt1=i,r.OutPt2=n,!0):(n=this.DupOutPt(i,!0),a=this.DupOutPt(o,!1),i.Next=o,o.Prev=i,n.Prev=a,a.Next=n,r.OutPt1=i,r.OutPt2=n,!0)}};h.Clipper.GetBounds=function(r){for(var t=0,e=r.length;t<e&&r[t].length==0;)t++;if(t==e)return new h.IntRect(0,0,0,0);var i=new h.IntRect;for(i.left=r[t][0].X,i.right=i.left,i.top=r[t][0].Y,i.bottom=i.top;t<e;t++)for(var n=0,o=r[t].length;n<o;n++)r[t][n].X<i.left?i.left=r[t][n].X:r[t][n].X>i.right&&(i.right=r[t][n].X),r[t][n].Y<i.top?i.top=r[t][n].Y:r[t][n].Y>i.bottom&&(i.bottom=r[t][n].Y);return i};h.Clipper.prototype.GetBounds2=function(r){var t=r,e=new h.IntRect;for(e.left=r.Pt.X,e.right=r.Pt.X,e.top=r.Pt.Y,e.bottom=r.Pt.Y,r=r.Next;r!=t;)r.Pt.X<e.left&&(e.left=r.Pt.X),r.Pt.X>e.right&&(e.right=r.Pt.X),r.Pt.Y<e.top&&(e.top=r.Pt.Y),r.Pt.Y>e.bottom&&(e.bottom=r.Pt.Y),r=r.Next;return e};h.Clipper.PointInPolygon=function(r,t){var e=0,i=t.length;if(i<3)return 0;for(var n=t[0],o=1;o<=i;++o){var a=o==i?t[0]:t[o];if(a.Y==r.Y&&(a.X==r.X||n.Y==r.Y&&a.X>r.X==n.X<r.X))return-1;if(n.Y<r.Y!=a.Y<r.Y){if(n.X>=r.X)if(a.X>r.X)e=1-e;else{var u=(n.X-r.X)*(a.Y-r.Y)-(a.X-r.X)*(n.Y-r.Y);if(u==0)return-1;u>0==a.Y>n.Y&&(e=1-e)}else if(a.X>r.X){var u=(n.X-r.X)*(a.Y-r.Y)-(a.X-r.X)*(n.Y-r.Y);if(u==0)return-1;u>0==a.Y>n.Y&&(e=1-e)}}n=a}return e};h.Clipper.prototype.PointInPolygon=function(r,t){for(var e=0,i=t;;){var n=t.Pt.X,o=t.Pt.Y,a=t.Next.Pt.X,u=t.Next.Pt.Y;if(u==r.Y&&(a==r.X||o==r.Y&&a>r.X==n<r.X))return-1;if(o<r.Y!=u<r.Y){if(n>=r.X)if(a>r.X)e=1-e;else{var s=(n-r.X)*(u-r.Y)-(a-r.X)*(o-r.Y);if(s==0)return-1;s>0==u>o&&(e=1-e)}else if(a>r.X){var s=(n-r.X)*(u-r.Y)-(a-r.X)*(o-r.Y);if(s==0)return-1;s>0==u>o&&(e=1-e)}}if(t=t.Next,i==t)break}return e};h.Clipper.prototype.Poly2ContainsPoly1=function(r,t){var e=r;do{var i=this.PointInPolygon(e.Pt,t);if(i>=0)return i!=0;e=e.Next}while(e!=r);return!0};h.Clipper.prototype.FixupFirstLefts1=function(r,t){for(var e=0,i=this.m_PolyOuts.length;e<i;e++){var n=this.m_PolyOuts[e];n.Pts!==null&&n.FirstLeft==r&&this.Poly2ContainsPoly1(n.Pts,t.Pts)&&(n.FirstLeft=t)}};h.Clipper.prototype.FixupFirstLefts2=function(r,t){for(var e=0,i=this.m_PolyOuts,n=i.length,o=i[e];e<n;e++,o=i[e])o.FirstLeft==r&&(o.FirstLeft=t)};h.Clipper.ParseFirstLeft=function(r){for(;r!=null&&r.Pts==null;)r=r.FirstLeft;return r};h.Clipper.prototype.JoinCommonEdges=function(){for(var r=0,t=this.m_Joins.length;r<t;r++){var e=this.m_Joins[r],i=this.GetOutRec(e.OutPt1.Idx),n=this.GetOutRec(e.OutPt2.Idx);if(!(i.Pts==null||n.Pts==null)){var o;if(i==n?o=i:this.Param1RightOfParam2(i,n)?o=n:this.Param1RightOfParam2(n,i)?o=i:o=this.GetLowermostRec(i,n),!!this.JoinPoints(e,i,n))if(i==n){if(i.Pts=e.OutPt1,i.BottomPt=null,n=this.CreateOutRec(),n.Pts=e.OutPt2,this.UpdateOutPtIdxs(n),this.m_UsingPolyTree)for(var a=0,u=this.m_PolyOuts.length;a<u-1;a++){var s=this.m_PolyOuts[a];s.Pts==null||h.Clipper.ParseFirstLeft(s.FirstLeft)!=i||s.IsHole==i.IsHole||this.Poly2ContainsPoly1(s.Pts,e.OutPt2)&&(s.FirstLeft=n)}this.Poly2ContainsPoly1(n.Pts,i.Pts)?(n.IsHole=!i.IsHole,n.FirstLeft=i,this.m_UsingPolyTree&&this.FixupFirstLefts2(n,i),(n.IsHole^this.ReverseSolution)==this.Area(n)>0&&this.ReversePolyPtLinks(n.Pts)):this.Poly2ContainsPoly1(i.Pts,n.Pts)?(n.IsHole=i.IsHole,i.IsHole=!n.IsHole,n.FirstLeft=i.FirstLeft,i.FirstLeft=n,this.m_UsingPolyTree&&this.FixupFirstLefts2(i,n),(i.IsHole^this.ReverseSolution)==this.Area(i)>0&&this.ReversePolyPtLinks(i.Pts)):(n.IsHole=i.IsHole,n.FirstLeft=i.FirstLeft,this.m_UsingPolyTree&&this.FixupFirstLefts1(i,n))}else n.Pts=null,n.BottomPt=null,n.Idx=i.Idx,i.IsHole=o.IsHole,o==n&&(i.FirstLeft=n.FirstLeft),n.FirstLeft=i,this.m_UsingPolyTree&&this.FixupFirstLefts2(n,i)}}};h.Clipper.prototype.UpdateOutPtIdxs=function(r){var t=r.Pts;do t.Idx=r.Idx,t=t.Prev;while(t!=r.Pts)};h.Clipper.prototype.DoSimplePolygons=function(){for(var r=0;r<this.m_PolyOuts.length;){var t=this.m_PolyOuts[r++],e=t.Pts;if(e!==null)do{for(var i=e.Next;i!=t.Pts;){if(h.IntPoint.op_Equality(e.Pt,i.Pt)&&i.Next!=e&&i.Prev!=e){var n=e.Prev,o=i.Prev;e.Prev=o,o.Next=e,i.Prev=n,n.Next=i,t.Pts=e;var a=this.CreateOutRec();a.Pts=i,this.UpdateOutPtIdxs(a),this.Poly2ContainsPoly1(a.Pts,t.Pts)?(a.IsHole=!t.IsHole,a.FirstLeft=t):this.Poly2ContainsPoly1(t.Pts,a.Pts)?(a.IsHole=t.IsHole,t.IsHole=!a.IsHole,a.FirstLeft=t.FirstLeft,t.FirstLeft=a):(a.IsHole=t.IsHole,a.FirstLeft=t.FirstLeft),i=e}i=i.Next}e=e.Next}while(e!=t.Pts)}};h.Clipper.Area=function(r){var t=r.length;if(t<3)return 0;for(var e=0,i=0,n=t-1;i<t;++i)e+=(r[n].X+r[i].X)*(r[n].Y-r[i].Y),n=i;return-e*.5};h.Clipper.prototype.Area=function(r){var t=r.Pts;if(t==null)return 0;var e=0;do e=e+(t.Prev.Pt.X+t.Pt.X)*(t.Prev.Pt.Y-t.Pt.Y),t=t.Next;while(t!=r.Pts);return e*.5};t4&&(h.Clipper.OffsetPaths=function(r,t,e,i,n){var o=new h.Paths,a=new h.ClipperOffset(n,n);return a.AddPaths(r,e,i),a.Execute(o,t),o});h.Clipper.SimplifyPolygon=function(r,t){var e=new Array,i=new h.Clipper(0);return i.StrictlySimple=!0,i.AddPath(r,h.PolyType.ptSubject,!0),i.Execute(h.ClipType.ctUnion,e,t,t),e};h.Clipper.SimplifyPolygons=function(r,t){typeof t>"u"&&(t=h.PolyFillType.pftEvenOdd);var e=new Array,i=new h.Clipper(0);return i.StrictlySimple=!0,i.AddPaths(r,h.PolyType.ptSubject,!0),i.Execute(h.ClipType.ctUnion,e,t,t),e};h.Clipper.DistanceSqrd=function(r,t){var e=r.X-t.X,i=r.Y-t.Y;return e*e+i*i};h.Clipper.DistanceFromLineSqrd=function(r,t,e){var i=t.Y-e.Y,n=e.X-t.X,o=i*t.X+n*t.Y;return o=i*r.X+n*r.Y-o,o*o/(i*i+n*n)};h.Clipper.SlopesNearCollinear=function(r,t,e,i){return h.Clipper.DistanceFromLineSqrd(t,r,e)<i};h.Clipper.PointsAreClose=function(r,t,e){var i=r.X-t.X,n=r.Y-t.Y;return i*i+n*n<=e};h.Clipper.ExcludeOp=function(r){var t=r.Prev;return t.Next=r.Next,r.Next.Prev=t,t.Idx=0,t};h.Clipper.CleanPolygon=function(r,t){typeof t>"u"&&(t=1.415);var e=r.length;if(e==0)return new Array;for(var i=new Array(e),n=0;n<e;++n)i[n]=new h.OutPt;for(var n=0;n<e;++n)i[n].Pt=r[n],i[n].Next=i[(n+1)%e],i[n].Next.Prev=i[n],i[n].Idx=0;for(var o=t*t,a=i[0];a.Idx==0&&a.Next!=a.Prev;)h.Clipper.PointsAreClose(a.Pt,a.Prev.Pt,o)?(a=h.Clipper.ExcludeOp(a),e--):h.Clipper.PointsAreClose(a.Prev.Pt,a.Next.Pt,o)?(h.Clipper.ExcludeOp(a.Next),a=h.Clipper.ExcludeOp(a),e-=2):h.Clipper.SlopesNearCollinear(a.Prev.Pt,a.Pt,a.Next.Pt,o)?(a=h.Clipper.ExcludeOp(a),e--):(a.Idx=1,a=a.Next);e<3&&(e=0);for(var u=new Array(e),n=0;n<e;++n)u[n]=new h.IntPoint(a.Pt),a=a.Next;return i=null,u};h.Clipper.CleanPolygons=function(r,t){for(var e=new Array(r.length),i=0,n=r.length;i<n;i++)e[i]=h.Clipper.CleanPolygon(r[i],t);return e};h.Clipper.Minkowski=function(r,t,e,i){var n=i?1:0,o=r.length,a=t.length,u=new Array;if(e)for(var s=0;s<a;s++){for(var p=new Array(o),f=0,m=r.length,y=r[f];f<m;f++,y=r[f])p[f]=new h.IntPoint(t[s].X+y.X,t[s].Y+y.Y);u.push(p)}else for(var s=0;s<a;s++){for(var p=new Array(o),f=0,m=r.length,y=r[f];f<m;f++,y=r[f])p[f]=new h.IntPoint(t[s].X-y.X,t[s].Y-y.Y);u.push(p)}for(var x=new Array,s=0;s<a-1+n;s++)for(var f=0;f<o;f++){var S=new Array;S.push(u[s%a][f%o]),S.push(u[(s+1)%a][f%o]),S.push(u[(s+1)%a][(f+1)%o]),S.push(u[s%a][(f+1)%o]),h.Clipper.Orientation(S)||S.reverse(),x.push(S)}var M=new h.Clipper(0);return M.AddPaths(x,h.PolyType.ptSubject,!0),M.Execute(h.ClipType.ctUnion,u,h.PolyFillType.pftNonZero,h.PolyFillType.pftNonZero),u};h.Clipper.MinkowskiSum=function(){var r=arguments,t=r.length;if(t==3){var e=r[0],i=r[1],n=r[2];return h.Clipper.Minkowski(e,i,!0,n)}else if(t==4){for(var e=r[0],o=r[1],a=r[2],n=r[3],u=new h.Clipper,s,p=0,f=o.length;p<f;++p){var s=h.Clipper.Minkowski(e,o[p],!0,n);u.AddPaths(s,h.PolyType.ptSubject,!0)}n&&u.AddPaths(o,h.PolyType.ptClip,!0);var m=new h.Paths;return u.Execute(h.ClipType.ctUnion,m,a,a),m}};h.Clipper.MinkowskiDiff=function(r,t,e){return h.Clipper.Minkowski(r,t,!1,e)};h.Clipper.PolyTreeToPaths=function(r){var t=new Array;return h.Clipper.AddPolyNodeToPaths(r,h.Clipper.NodeType.ntAny,t),t};h.Clipper.AddPolyNodeToPaths=function(r,t,e){var i=!0;switch(t){case h.Clipper.NodeType.ntOpen:return;case h.Clipper.NodeType.ntClosed:i=!r.IsOpen;break;default:break}r.m_polygon.length>0&&i&&e.push(r.m_polygon);for(var n=0,o=r.Childs(),a=o.length,u=o[n];n<a;n++,u=o[n])h.Clipper.AddPolyNodeToPaths(u,t,e)};h.Clipper.OpenPathsFromPolyTree=function(r){for(var t=new h.Paths,e=0,i=r.ChildCount();e<i;e++)r.Childs()[e].IsOpen&&t.push(r.Childs()[e].m_polygon);return t};h.Clipper.ClosedPathsFromPolyTree=function(r){var t=new h.Paths;return h.Clipper.AddPolyNodeToPaths(r,h.Clipper.NodeType.ntClosed,t),t};tc(h.Clipper,h.ClipperBase);h.Clipper.NodeType={ntAny:0,ntOpen:1,ntClosed:2};h.ClipperOffset=function(r,t){typeof r>"u"&&(r=2),typeof t>"u"&&(t=h.ClipperOffset.def_arc_tolerance),this.m_destPolys=new h.Paths,this.m_srcPoly=new h.Path,this.m_destPoly=new h.Path,this.m_normals=new Array,this.m_delta=0,this.m_sinA=0,this.m_sin=0,this.m_cos=0,this.m_miterLim=0,this.m_StepsPerRad=0,this.m_lowest=new h.IntPoint,this.m_polyNodes=new h.PolyNode,this.MiterLimit=r,this.ArcTolerance=t,this.m_lowest.X=-1};h.ClipperOffset.two_pi=6.28318530717959;h.ClipperOffset.def_arc_tolerance=.25;h.ClipperOffset.prototype.Clear=function(){h.Clear(this.m_polyNodes.Childs()),this.m_lowest.X=-1};h.ClipperOffset.Round=h.Clipper.Round;h.ClipperOffset.prototype.AddPath=function(r,t,e){var i=r.length-1;if(!(i<0)){var n=new h.PolyNode;if(n.m_jointype=t,n.m_endtype=e,e==h.EndType.etClosedLine||e==h.EndType.etClosedPolygon)for(;i>0&&h.IntPoint.op_Equality(r[0],r[i]);)i--;n.m_polygon.push(r[0]);for(var o=0,a=0,u=1;u<=i;u++)h.IntPoint.op_Inequality(n.m_polygon[o],r[u])&&(o++,n.m_polygon.push(r[u]),(r[u].Y>n.m_polygon[a].Y||r[u].Y==n.m_polygon[a].Y&&r[u].X<n.m_polygon[a].X)&&(a=o));if(!(e==h.EndType.etClosedPolygon&&o<2||e!=h.EndType.etClosedPolygon&&o<0)&&(this.m_polyNodes.AddChild(n),e==h.EndType.etClosedPolygon))if(this.m_lowest.X<0)this.m_lowest=new h.IntPoint(0,a);else{var s=this.m_polyNodes.Childs()[this.m_lowest.X].m_polygon[this.m_lowest.Y];(n.m_polygon[a].Y>s.Y||n.m_polygon[a].Y==s.Y&&n.m_polygon[a].X<s.X)&&(this.m_lowest=new h.IntPoint(this.m_polyNodes.ChildCount()-1,a))}}};h.ClipperOffset.prototype.AddPaths=function(r,t,e){for(var i=0,n=r.length;i<n;i++)this.AddPath(r[i],t,e)};h.ClipperOffset.prototype.FixOrientations=function(){if(this.m_lowest.X>=0&&!h.Clipper.Orientation(this.m_polyNodes.Childs()[this.m_lowest.X].m_polygon))for(var r=0;r<this.m_polyNodes.ChildCount();r++){var t=this.m_polyNodes.Childs()[r];(t.m_endtype==h.EndType.etClosedPolygon||t.m_endtype==h.EndType.etClosedLine&&h.Clipper.Orientation(t.m_polygon))&&t.m_polygon.reverse()}else for(var r=0;r<this.m_polyNodes.ChildCount();r++){var t=this.m_polyNodes.Childs()[r];t.m_endtype==h.EndType.etClosedLine&&!h.Clipper.Orientation(t.m_polygon)&&t.m_polygon.reverse()}};h.ClipperOffset.GetUnitNormal=function(r,t){var e=t.X-r.X,i=t.Y-r.Y;if(e==0&&i==0)return new h.DoublePoint(0,0);var n=1/Math.sqrt(e*e+i*i);return e*=n,i*=n,new h.DoublePoint(i,-e)};h.ClipperOffset.prototype.DoOffset=function(r){if(this.m_destPolys=new Array,this.m_delta=r,h.ClipperBase.near_zero(r)){for(var t=0;t<this.m_polyNodes.ChildCount();t++){var e=this.m_polyNodes.Childs()[t];e.m_endtype==h.EndType.etClosedPolygon&&this.m_destPolys.push(e.m_polygon)}return}this.MiterLimit>2?this.m_miterLim=2/(this.MiterLimit*this.MiterLimit):this.m_miterLim=.5;var i;this.ArcTolerance<=0?i=h.ClipperOffset.def_arc_tolerance:this.ArcTolerance>Math.abs(r)*h.ClipperOffset.def_arc_tolerance?i=Math.abs(r)*h.ClipperOffset.def_arc_tolerance:i=this.ArcTolerance;var n=3.14159265358979/Math.acos(1-i/Math.abs(r));this.m_sin=Math.sin(h.ClipperOffset.two_pi/n),this.m_cos=Math.cos(h.ClipperOffset.two_pi/n),this.m_StepsPerRad=n/h.ClipperOffset.two_pi,r<0&&(this.m_sin=-this.m_sin);for(var t=0;t<this.m_polyNodes.ChildCount();t++){var e=this.m_polyNodes.Childs()[t];this.m_srcPoly=e.m_polygon;var o=this.m_srcPoly.length;if(!(o==0||r<=0&&(o<3||e.m_endtype!=h.EndType.etClosedPolygon))){if(this.m_destPoly=new Array,o==1){if(e.m_jointype==h.JoinType.jtRound)for(var a=1,u=0,s=1;s<=n;s++){this.m_destPoly.push(new h.IntPoint(h.ClipperOffset.Round(this.m_srcPoly[0].X+a*r),h.ClipperOffset.Round(this.m_srcPoly[0].Y+u*r)));var p=a;a=a*this.m_cos-this.m_sin*u,u=p*this.m_sin+u*this.m_cos}else for(var a=-1,u=-1,s=0;s<4;++s)this.m_destPoly.push(new h.IntPoint(h.ClipperOffset.Round(this.m_srcPoly[0].X+a*r),h.ClipperOffset.Round(this.m_srcPoly[0].Y+u*r))),a<0?a=1:u<0?u=1:a=-1;this.m_destPolys.push(this.m_destPoly);continue}this.m_normals.length=0;for(var s=0;s<o-1;s++)this.m_normals.push(h.ClipperOffset.GetUnitNormal(this.m_srcPoly[s],this.m_srcPoly[s+1]));if(e.m_endtype==h.EndType.etClosedLine||e.m_endtype==h.EndType.etClosedPolygon?this.m_normals.push(h.ClipperOffset.GetUnitNormal(this.m_srcPoly[o-1],this.m_srcPoly[0])):this.m_normals.push(new h.DoublePoint(this.m_normals[o-2])),e.m_endtype==h.EndType.etClosedPolygon){for(var f=o-1,s=0;s<o;s++)f=this.OffsetPoint(s,f,e.m_jointype);this.m_destPolys.push(this.m_destPoly)}else if(e.m_endtype==h.EndType.etClosedLine){for(var f=o-1,s=0;s<o;s++)f=this.OffsetPoint(s,f,e.m_jointype);this.m_destPolys.push(this.m_destPoly),this.m_destPoly=new Array;for(var m=this.m_normals[o-1],s=o-1;s>0;s--)this.m_normals[s]=new h.DoublePoint(-this.m_normals[s-1].X,-this.m_normals[s-1].Y);this.m_normals[0]=new h.DoublePoint(-m.X,-m.Y),f=0;for(var s=o-1;s>=0;s--)f=this.OffsetPoint(s,f,e.m_jointype);this.m_destPolys.push(this.m_destPoly)}else{for(var f=0,s=1;s<o-1;++s)f=this.OffsetPoint(s,f,e.m_jointype);var y;if(e.m_endtype==h.EndType.etOpenButt){var s=o-1;y=new h.IntPoint(h.ClipperOffset.Round(this.m_srcPoly[s].X+this.m_normals[s].X*r),h.ClipperOffset.Round(this.m_srcPoly[s].Y+this.m_normals[s].Y*r)),this.m_destPoly.push(y),y=new h.IntPoint(h.ClipperOffset.Round(this.m_srcPoly[s].X-this.m_normals[s].X*r),h.ClipperOffset.Round(this.m_srcPoly[s].Y-this.m_normals[s].Y*r)),this.m_destPoly.push(y)}else{var s=o-1;f=o-2,this.m_sinA=0,this.m_normals[s]=new h.DoublePoint(-this.m_normals[s].X,-this.m_normals[s].Y),e.m_endtype==h.EndType.etOpenSquare?this.DoSquare(s,f):this.DoRound(s,f)}for(var s=o-1;s>0;s--)this.m_normals[s]=new h.DoublePoint(-this.m_normals[s-1].X,-this.m_normals[s-1].Y);this.m_normals[0]=new h.DoublePoint(-this.m_normals[1].X,-this.m_normals[1].Y),f=o-1;for(var s=f-1;s>0;--s)f=this.OffsetPoint(s,f,e.m_jointype);e.m_endtype==h.EndType.etOpenButt?(y=new h.IntPoint(h.ClipperOffset.Round(this.m_srcPoly[0].X-this.m_normals[0].X*r),h.ClipperOffset.Round(this.m_srcPoly[0].Y-this.m_normals[0].Y*r)),this.m_destPoly.push(y),y=new h.IntPoint(h.ClipperOffset.Round(this.m_srcPoly[0].X+this.m_normals[0].X*r),h.ClipperOffset.Round(this.m_srcPoly[0].Y+this.m_normals[0].Y*r)),this.m_destPoly.push(y)):(f=1,this.m_sinA=0,e.m_endtype==h.EndType.etOpenSquare?this.DoSquare(0,1):this.DoRound(0,1)),this.m_destPolys.push(this.m_destPoly)}}}};h.ClipperOffset.prototype.Execute=function(){var r=arguments,t=r[0]instanceof h.PolyTree;if(t){var e=r[0],i=r[1];e.Clear(),this.FixOrientations(),this.DoOffset(i);var n=new h.Clipper(0);if(n.AddPaths(this.m_destPolys,h.PolyType.ptSubject,!0),i>0)n.Execute(h.ClipType.ctUnion,e,h.PolyFillType.pftPositive,h.PolyFillType.pftPositive);else{var o=h.Clipper.GetBounds(this.m_destPolys),a=new h.Path;if(a.push(new h.IntPoint(o.left-10,o.bottom+10)),a.push(new h.IntPoint(o.right+10,o.bottom+10)),a.push(new h.IntPoint(o.right+10,o.top-10)),a.push(new h.IntPoint(o.left-10,o.top-10)),n.AddPath(a,h.PolyType.ptSubject,!0),n.ReverseSolution=!0,n.Execute(h.ClipType.ctUnion,e,h.PolyFillType.pftNegative,h.PolyFillType.pftNegative),e.ChildCount()==1&&e.Childs()[0].ChildCount()>0){var u=e.Childs()[0];e.Childs()[0]=u.Childs()[0];for(var s=1;s<u.ChildCount();s++)e.AddChild(u.Childs()[s])}else e.Clear()}}else{var e=r[0],i=r[1];h.Clear(e),this.FixOrientations(),this.DoOffset(i);var n=new h.Clipper(0);if(n.AddPaths(this.m_destPolys,h.PolyType.ptSubject,!0),i>0)n.Execute(h.ClipType.ctUnion,e,h.PolyFillType.pftPositive,h.PolyFillType.pftPositive);else{var o=h.Clipper.GetBounds(this.m_destPolys),a=new h.Path;a.push(new h.IntPoint(o.left-10,o.bottom+10)),a.push(new h.IntPoint(o.right+10,o.bottom+10)),a.push(new h.IntPoint(o.right+10,o.top-10)),a.push(new h.IntPoint(o.left-10,o.top-10)),n.AddPath(a,h.PolyType.ptSubject,!0),n.ReverseSolution=!0,n.Execute(h.ClipType.ctUnion,e,h.PolyFillType.pftNegative,h.PolyFillType.pftNegative),e.length>0&&e.splice(0,1)}}};h.ClipperOffset.prototype.OffsetPoint=function(r,t,e){if(this.m_sinA=this.m_normals[t].X*this.m_normals[r].Y-this.m_normals[r].X*this.m_normals[t].Y,this.m_sinA<5e-5&&this.m_sinA>-5e-5)return t;if(this.m_sinA>1?this.m_sinA=1:this.m_sinA<-1&&(this.m_sinA=-1),this.m_sinA*this.m_delta<0)this.m_destPoly.push(new h.IntPoint(h.ClipperOffset.Round(this.m_srcPoly[r].X+this.m_normals[t].X*this.m_delta),h.ClipperOffset.Round(this.m_srcPoly[r].Y+this.m_normals[t].Y*this.m_delta))),this.m_destPoly.push(new h.IntPoint(this.m_srcPoly[r])),this.m_destPoly.push(new h.IntPoint(h.ClipperOffset.Round(this.m_srcPoly[r].X+this.m_normals[r].X*this.m_delta),h.ClipperOffset.Round(this.m_srcPoly[r].Y+this.m_normals[r].Y*this.m_delta)));else switch(e){case h.JoinType.jtMiter:{var i=1+(this.m_normals[r].X*this.m_normals[t].X+this.m_normals[r].Y*this.m_normals[t].Y);i>=this.m_miterLim?this.DoMiter(r,t,i):this.DoSquare(r,t);break}case h.JoinType.jtSquare:this.DoSquare(r,t);break;case h.JoinType.jtRound:this.DoRound(r,t);break}return t=r,t};h.ClipperOffset.prototype.DoSquare=function(r,t){var e=Math.tan(Math.atan2(this.m_sinA,this.m_normals[t].X*this.m_normals[r].X+this.m_normals[t].Y*this.m_normals[r].Y)/4);this.m_destPoly.push(new h.IntPoint(h.ClipperOffset.Round(this.m_srcPoly[r].X+this.m_delta*(this.m_normals[t].X-this.m_normals[t].Y*e)),h.ClipperOffset.Round(this.m_srcPoly[r].Y+this.m_delta*(this.m_normals[t].Y+this.m_normals[t].X*e)))),this.m_destPoly.push(new h.IntPoint(h.ClipperOffset.Round(this.m_srcPoly[r].X+this.m_delta*(this.m_normals[r].X+this.m_normals[r].Y*e)),h.ClipperOffset.Round(this.m_srcPoly[r].Y+this.m_delta*(this.m_normals[r].Y-this.m_normals[r].X*e))))};h.ClipperOffset.prototype.DoMiter=function(r,t,e){var i=this.m_delta/e;this.m_destPoly.push(new h.IntPoint(h.ClipperOffset.Round(this.m_srcPoly[r].X+(this.m_normals[t].X+this.m_normals[r].X)*i),h.ClipperOffset.Round(this.m_srcPoly[r].Y+(this.m_normals[t].Y+this.m_normals[r].Y)*i)))};h.ClipperOffset.prototype.DoRound=function(r,t){for(var e=Math.atan2(this.m_sinA,this.m_normals[t].X*this.m_normals[r].X+this.m_normals[t].Y*this.m_normals[r].Y),i=h.Cast_Int32(h.ClipperOffset.Round(this.m_StepsPerRad*Math.abs(e))),n=this.m_normals[t].X,o=this.m_normals[t].Y,a,u=0;u<i;++u)this.m_destPoly.push(new h.IntPoint(h.ClipperOffset.Round(this.m_srcPoly[r].X+n*this.m_delta),h.ClipperOffset.Round(this.m_srcPoly[r].Y+o*this.m_delta))),a=n,n=n*this.m_cos-this.m_sin*o,o=a*this.m_sin+o*this.m_cos;this.m_destPoly.push(new h.IntPoint(h.ClipperOffset.Round(this.m_srcPoly[r].X+this.m_normals[r].X*this.m_delta),h.ClipperOffset.Round(this.m_srcPoly[r].Y+this.m_normals[r].Y*this.m_delta)))};h.Error=function(r){try{throw new Error(r)}catch(t){alert(t.message)}};h.JS={};h.JS.AreaOfPolygon=function(r,t){return t||(t=1),h.Clipper.Area(r)/(t*t)};h.JS.AreaOfPolygons=function(r,t){t||(t=1);for(var e=0,i=0;i<r.length;i++)e+=h.Clipper.Area(r[i]);return e/(t*t)};h.JS.BoundsOfPath=function(r,t){return h.JS.BoundsOfPaths([r],t)};h.JS.BoundsOfPaths=function(r,t){t||(t=1);var e=h.Clipper.GetBounds(r);return e.left/=t,e.bottom/=t,e.right/=t,e.top/=t,e};h.JS.Clean=function(i,t){if(!(i instanceof Array))return[];var e=i[0]instanceof Array,i=h.JS.Clone(i);if(typeof t!="number"||t===null)return h.Error("Delta is not a number in Clean()."),i;if(i.length===0||i.length==1&&i[0].length===0||t<0)return i;e||(i=[i]);for(var n=i.length,o,a,u,s,p,f,m,y=[],x=0;x<n;x++)if(a=i[x],o=a.length,o!==0){if(o<3){u=a,y.push(u);continue}for(u=a,s=t*t,p=a[0],f=1,m=1;m<o;m++)(a[m].X-p.X)*(a[m].X-p.X)+(a[m].Y-p.Y)*(a[m].Y-p.Y)<=s||(u[f]=a[m],p=a[m],f++);p=a[f-1],(a[0].X-p.X)*(a[0].X-p.X)+(a[0].Y-p.Y)*(a[0].Y-p.Y)<=s&&f--,f<o&&u.splice(f,o-f),u.length&&y.push(u)}return!e&&y.length?y=y[0]:!e&&y.length===0?y=[]:e&&y.length===0&&(y=[[]]),y};h.JS.Clone=function(r){if(!(r instanceof Array))return[];if(r.length===0)return[];if(r.length==1&&r[0].length===0)return[[]];var t=r[0]instanceof Array;t||(r=[r]);var e=r.length,i,n,o,a,u=new Array(e);for(n=0;n<e;n++){for(i=r[n].length,a=new Array(i),o=0;o<i;o++)a[o]={X:r[n][o].X,Y:r[n][o].Y};u[n]=a}return t||(u=u[0]),u};h.JS.Lighten=function(r,t){if(!(r instanceof Array))return[];if(typeof t!="number"||t===null)return h.Error("Tolerance is not a number in Lighten()."),h.JS.Clone(r);if(r.length===0||r.length==1&&r[0].length===0||t<0)return h.JS.Clone(r);r[0]instanceof Array||(r=[r]);var e,i,n,o,a,u,s,p,f,m,y,x,S,M,g,C,I,T=r.length,w=t*t,L=[];for(e=0;e<T;e++)if(n=r[e],u=n.length,u!=0){for(o=0;o<1e6;o++){for(a=[],u=n.length,n[u-1].X!=n[0].X||n[u-1].Y!=n[0].Y?(x=1,n.push({X:n[0].X,Y:n[0].Y}),u=n.length):x=0,y=[],i=0;i<u-2;i++)s=n[i],f=n[i+1],p=n[i+2],C=s.X,I=s.Y,S=p.X-C,M=p.Y-I,(S!==0||M!==0)&&(g=((f.X-C)*S+(f.Y-I)*M)/(S*S+M*M),g>1?(C=p.X,I=p.Y):g>0&&(C+=S*g,I+=M*g)),S=f.X-C,M=f.Y-I,m=S*S+M*M,m<=w&&(y[i+1]=1,i++);for(a.push({X:n[0].X,Y:n[0].Y}),i=1;i<u-1;i++)y[i]||a.push({X:n[i].X,Y:n[i].Y});if(a.push({X:n[u-1].X,Y:n[u-1].Y}),x&&n.pop(),y.length)n=a;else break}u=a.length,a[u-1].X==a[0].X&&a[u-1].Y==a[0].Y&&a.pop(),a.length>2&&L.push(a)}return!r[0]instanceof Array&&(L=L[0]),typeof L>"u"&&(L=[[]]),L};h.JS.PerimeterOfPath=function(r,t,e){if(typeof r>"u")return 0;var i=Math.sqrt,n=0,o,a,u=0,s=0,p=0,f=0,m=r.length;if(m<2)return 0;for(t&&(r[m]=r[0],m++);--m;)o=r[m],u=o.X,s=o.Y,a=r[m-1],p=a.X,f=a.Y,n+=i((u-p)*(u-p)+(s-f)*(s-f));return t&&r.pop(),n/e};h.JS.PerimeterOfPaths=function(r,t,e){e||(e=1);for(var i=0,n=0;n<r.length;n++)i+=h.JS.PerimeterOfPath(r[n],t,e);return i};h.JS.ScaleDownPath=function(r,t){var e,i;for(t||(t=1),e=r.length;e--;)i=r[e],i.X=i.X/t,i.Y=i.Y/t};h.JS.ScaleDownPaths=function(r,t){var e,i,n,o=Math.round;for(t||(t=1),e=r.length;e--;)for(i=r[e].length;i--;)n=r[e][i],n.X=n.X/t,n.Y=n.Y/t};h.JS.ScaleUpPath=function(r,t){var e,i,n=Math.round;for(t||(t=1),e=r.length;e--;)i=r[e],i.X=n(i.X*t),i.Y=n(i.Y*t)};h.JS.ScaleUpPaths=function(r,t){var e,i,n,o=Math.round;for(t||(t=1),e=r.length;e--;)for(i=r[e].length;i--;)n=r[e][i],n.X=o(n.X*t),n.Y=o(n.Y*t)};h.ExPolygons=function(){return[]};h.ExPolygon=function(){this.outer=null,this.holes=null};h.JS.AddOuterPolyNodeToExPolygons=function(r,t){var e=new h.ExPolygon;e.outer=r.Contour();var i=r.Childs(),n=i.length;e.holes=new Array(n);var o,a,u,s,p,f;for(u=0;u<n;u++)for(o=i[u],e.holes[u]=o.Contour(),s=0,p=o.Childs(),f=p.length;s<f;s++)a=p[s],h.JS.AddOuterPolyNodeToExPolygons(a,t);t.push(e)};h.JS.ExPolygonsToPaths=function(r){var t,e,i,n,o=new h.Paths;for(t=0,i=r.length;t<i;t++)for(o.push(r[t].outer),e=0,n=r[t].holes.length;e<n;e++)o.push(r[t].holes[e]);return o};h.JS.PolyTreeToExPolygons=function(r){var t=new h.ExPolygons,e,i,n,o;for(i=0,n=r.Childs(),o=n.length;i<o;i++)e=n[i],h.JS.AddOuterPolyNodeToExPolygons(e,t);return t};Ja.exports=h});d();d();var $s=new WeakMap,Vt,Hc=class Hc{constructor(t){P(this,Vt,void 0);E(this,Vt,t),$s.set(this,t)}get mapName(){return c(this,Vt).mapName}get mapCenter(){return c(this,Vt).mapCenter}get organizationId(){return c(this,Vt).organizationId}get outdoorViewToken(){return c(this,Vt).outdoorViewToken}getByType(t){switch(t){case"space":return c(this,Vt).spaces;case"door":return c(this,Vt).doors;case"floor":return c(this,Vt).floors;case"connection":return c(this,Vt).connections;case"object":return c(this,Vt).objects;case"point-of-interest":return c(this,Vt).pointsOfInterest;case"annotation":return c(this,Vt).annotations;default:return[]}}getById(t,e){return c(this,Vt).getById(t,e)}};Vt=new WeakMap,l(Hc,"MapData");var Gc=Hc,Vc=Gc;d();d();d();var t5={logState:b.env.NODE_ENV==="test"?3:0,log(...r){this.logState<=0&&console.log("[MappedInJS]",...r)},warn(...r){this.logState<=1&&console.warn("[MappedInJS]",...r)},error(...r){this.logState<=2&&console.error("[MappedInJS]",...r)},assert(...r){console.assert(...r)},time(r){console.time(r)},timeEnd(r){console.timeEnd(r)}},G=t5;var C1=globalThis.fetch,x1,Yw=(x1=b==null?void 0:b.env)==null?void 0:x1.npm_package_version;function Xc(){if(C1==null)throw new Error("fetch is not available in your environment. Pass your own function into `setFetchFn` (node-fetch, etc)");return C1}l(Xc,"isomorphicFetch");async function Yc(r,t){return new Promise(async(e,i)=>{try{let{url:n}=await e5(r,t),o=await Xc()(n).then(u=>u.arrayBuffer()),a=new Uint8Array(o);e(a)}catch(n){i(n)}})}l(Yc,"downloadMVF");function S1(r){return r.endsWith("/")?r:`${r}/`}l(S1,"normalizeUrl");async function e5(r,t){let e=`${r.bundleBaseUri?S1(r.bundleBaseUri):"https://app.mappedin.com/"}api/venue/${r.mapId}/mvf${r.viewId?`?configId=${r.viewId}`:""}`,i=await Xc()(e,{headers:{Authorization:`Bearer ${t}`}});if(!i.ok)throw new Error(`${i.status} ${i.statusText}`);return i.json()}l(e5,"getMakerBundleURL");async function Js(r){let t=`${r.authBaseUri?S1(r.authBaseUri):"https://auth-maker.mappedin.com/"}api-key/token`,e=await Xc()(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:r.key,secret:r.secret})});if(!e.ok)throw new Error(`${e.status} ${e.statusText}`);return e.json()}l(Js,"getAccessToken");function jc(r){let t=new TextDecoder,e=t.decode.bind(t);try{let i={"connection.json":JSON.parse(e(r["connection.json"])),"manifest.geojson":JSON.parse(e(r["manifest.geojson"])),"map.geojson":JSON.parse(e(r["map.geojson"])),"mapstack.geojson":r["mapstack.geojson"]?JSON.parse(e(r["mapstack.geojson"])):void 0,"node.geojson":JSON.parse(e(r["node.geojson"])),obstruction:{},space:{},entrance:{}};if((i["mapstack.geojson"]==null||"mapstack.json"in r)&&(i["mapstack.json"]=JSON.parse(e(r["mapstack.json"]))),"styles.json"in r&&(i["styles.json"]=JSON.parse(e(r["styles.json"]))),"shapes.json"in r&&(i["shapes.json"]=JSON.parse(e(r["shapes.json"]))),r.annotation!=null){i.annotation={};let u=Object.keys(r.annotation);for(let s of u){let p=s.replace(/\.json|\.geojson/g,"");i.annotation[p]=JSON.parse(e(r.annotation[s]))}}let n=Object.keys(r.space);for(let u of n){let s=u.replace(/\.json|\.geojson/g,"");i.space[s]=JSON.parse(e(r.space[u]))}let o=Object.keys(r.obstruction);for(let u of o){let s=u.replace(/\.json|\.geojson/g,"");i.obstruction[s]=JSON.parse(e(r.obstruction[u]))}let a=Object.keys(r.entrance);for(let u of a){let s=u.replace(/\.json|\.geojson/g,"");i.entrance[s]=JSON.parse(e(r.entrance[u]))}return i}catch(i){throw G.error(i),new Error("MVF parsing failed! Probably encountered a bad file.")}}l(jc,"parseMVF");function r5(r){if(r==null||typeof r!="object")return!1;let t=["connection.json","manifest.geojson","map.geojson","node.geojson","mapstack.json"in r?"mapstack.json":"mapstack.geojson"];"styles.json"in r&&t.push("styles.json"),"shapes.json"in r&&t.push("shapes.json");for(let e of t)if(r[e]==null||r[e][Symbol.toStringTag]!=="Uint8Array")return!1;return!0}l(r5,"validateStaticMVFFiles");async function Wc(r){return new Promise(async(t,e)=>{try{if(r==null||typeof r!="object")throw new Error("Error parsing data! Unzipping failed.");if(r[Symbol.toStringTag]!=="Uint8Array")throw new Error("Unexpected file type! Unzipping failed.");let n=(await import("./browser-BJ3HKFGZ.js")).unzipSync(r);if(!r5(n))throw new Error("MVF is missing some expect static files. Unzipping failed.");let o={},a=Object.keys(n);for(let u of a){if(n[u].length===0)continue;let s=u.split("/");if(s.length<0)throw new Error("Encounted a file with no name! Unzipping failed.");if(s.length>2)throw new Error("Encountered unexpected nesting in MVF! Unzipping failed.");if(s.length===1){o[s[0]]=n[u];continue}if(s[0]==="image"){G.warn("MVF unzipping encountered an image. Ignoring as this case has not been implemented.");continue}else o[s[0]]==null&&(o[s[0]]={}),o[s[0]][s[1]]=n[u]}t(o)}catch(i){e(i)}})}l(Wc,"unzipMVF");d();d();d();d();var zt=63710088e-1,M1={centimeters:zt*100,centimetres:zt*100,degrees:zt/111325,feet:zt*3.28084,inches:zt*39.37,kilometers:zt/1e3,kilometres:zt/1e3,meters:zt,metres:zt,miles:zt/1609.344,millimeters:zt*1e3,millimetres:zt*1e3,nauticalmiles:zt/1852,radians:1,yards:zt*1.0936},Zw={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/zt,yards:1.0936133};function Br(r,t,e){e===void 0&&(e={});var i={type:"Feature"};return(e.id===0||e.id)&&(i.id=e.id),e.bbox&&(i.bbox=e.bbox),i.properties=t||{},i.geometry=r,i}l(Br,"feature");function Ie(r,t,e){if(e===void 0&&(e={}),!r)throw new Error("coordinates is required");if(!Array.isArray(r))throw new Error("coordinates must be an Array");if(r.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Uc(r[0])||!Uc(r[1]))throw new Error("coordinates must contain numbers");var i={type:"Point",coordinates:r};return Br(i,t,e)}l(Ie,"point");function hr(r,t,e){if(e===void 0&&(e={}),r.length<2)throw new Error("coordinates must be an array of two or more positions");var i={type:"LineString",coordinates:r};return Br(i,t,e)}l(hr,"lineString");function Lo(r,t){t===void 0&&(t={});var e={type:"FeatureCollection"};return t.id&&(e.id=t.id),t.bbox&&(e.bbox=t.bbox),e.features=r,e}l(Lo,"featureCollection");function P1(r,t){t===void 0&&(t="kilometers");var e=M1[t];if(!e)throw new Error(t+" units is invalid");return r*e}l(P1,"radiansToLength");function w1(r,t){t===void 0&&(t="kilometers");var e=M1[t];if(!e)throw new Error(t+" units is invalid");return r/e}l(w1,"lengthToRadians");function _o(r){var t=r%(2*Math.PI);return t*180/Math.PI}l(_o,"radiansToDegrees");function ne(r){var t=r%360;return t*Math.PI/180}l(ne,"degreesToRadians");function Uc(r){return!isNaN(r)&&r!==null&&!Array.isArray(r)}l(Uc,"isNumber");function We(r){if(!r)throw new Error("coord is required");if(!Array.isArray(r)){if(r.type==="Feature"&&r.geometry!==null&&r.geometry.type==="Point")return r.geometry.coordinates;if(r.type==="Point")return r.coordinates}if(Array.isArray(r)&&r.length>=2&&!Array.isArray(r[0])&&!Array.isArray(r[1]))return r;throw new Error("coord must be GeoJSON Point or an Array of numbers")}l(We,"getCoord");function ue(r){if(Array.isArray(r))return r;if(r.type==="Feature"){if(r.geometry!==null)return r.geometry.coordinates}else if(r.coordinates)return r.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}l(ue,"getCoords");function T1(r,t){return r.type==="FeatureCollection"?"FeatureCollection":r.type==="GeometryCollection"?"GeometryCollection":r.type==="Feature"&&r.geometry!==null?r.geometry.type:r.type}l(T1,"getType");function i5(r,t,e){e===void 0&&(e={});for(var i=We(r),n=ue(t),o=0;o<n.length-1;o++){var a=!1;if(e.ignoreEndVertices&&(o===0&&(a="start"),o===n.length-2&&(a="end"),o===0&&o+1===n.length-1&&(a="both")),n5(n[o],n[o+1],i,a,typeof e.epsilon>"u"?null:e.epsilon))return!0}return!1}l(i5,"booleanPointOnLine");function n5(r,t,e,i,n){var o=e[0],a=e[1],u=r[0],s=r[1],p=t[0],f=t[1],m=e[0]-u,y=e[1]-s,x=p-u,S=f-s,M=m*S-y*x;if(n!==null){if(Math.abs(M)>n)return!1}else if(M!==0)return!1;if(i){if(i==="start")return Math.abs(x)>=Math.abs(S)?x>0?u<o&&o<=p:p<=o&&o<u:S>0?s<a&&a<=f:f<=a&&a<s;if(i==="end")return Math.abs(x)>=Math.abs(S)?x>0?u<=o&&o<p:p<o&&o<=u:S>0?s<=a&&a<f:f<a&&a<=s;if(i==="both")return Math.abs(x)>=Math.abs(S)?x>0?u<o&&o<p:p<o&&o<u:S>0?s<a&&a<f:f<a&&a<s}else return Math.abs(x)>=Math.abs(S)?x>0?u<=o&&o<=p:p<=o&&o<=u:S>0?s<=a&&a<=f:f<=a&&a<=s;return!1}l(n5,"isPointOnLineSegment");var I1=i5;d();d();d();function Ks(r,t,e){if(r!==null)for(var i,n,o,a,u,s,p,f=0,m=0,y,x=r.type,S=x==="FeatureCollection",M=x==="Feature",g=S?r.features.length:1,C=0;C<g;C++){p=S?r.features[C].geometry:M?r.geometry:r,y=p?p.type==="GeometryCollection":!1,u=y?p.geometries.length:1;for(var I=0;I<u;I++){var T=0,w=0;if(a=y?p.geometries[I]:p,a!==null){s=a.coordinates;var L=a.type;switch(f=e&&(L==="Polygon"||L==="MultiPolygon")?1:0,L){case null:break;case"Point":if(t(s,m,C,T,w)===!1)return!1;m++,T++;break;case"LineString":case"MultiPoint":for(i=0;i<s.length;i++){if(t(s[i],m,C,T,w)===!1)return!1;m++,L==="MultiPoint"&&T++}L==="LineString"&&T++;break;case"Polygon":case"MultiLineString":for(i=0;i<s.length;i++){for(n=0;n<s[i].length-f;n++){if(t(s[i][n],m,C,T,w)===!1)return!1;m++}L==="MultiLineString"&&T++,L==="Polygon"&&w++}L==="Polygon"&&T++;break;case"MultiPolygon":for(i=0;i<s.length;i++){for(w=0,n=0;n<s[i].length;n++){for(o=0;o<s[i][n].length-f;o++){if(t(s[i][n][o],m,C,T,w)===!1)return!1;m++}w++}T++}break;case"GeometryCollection":for(i=0;i<a.geometries.length;i++)if(Ks(a.geometries[i],t,e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}l(Ks,"coordEach");function Zc(r,t){if(r.type==="Feature")t(r,0);else if(r.type==="FeatureCollection")for(var e=0;e<r.features.length&&t(r.features[e],e)!==!1;e++);}l(Zc,"featureEach");function o5(r,t){var e,i,n,o,a,u,s,p,f,m,y=0,x=r.type==="FeatureCollection",S=r.type==="Feature",M=x?r.features.length:1;for(e=0;e<M;e++){for(u=x?r.features[e].geometry:S?r.geometry:r,p=x?r.features[e].properties:S?r.properties:{},f=x?r.features[e].bbox:S?r.bbox:void 0,m=x?r.features[e].id:S?r.id:void 0,s=u?u.type==="GeometryCollection":!1,a=s?u.geometries.length:1,n=0;n<a;n++){if(o=s?u.geometries[n]:u,o===null){if(t(null,y,p,f,m)===!1)return!1;continue}switch(o.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(t(o,y,p,f,m)===!1)return!1;break}case"GeometryCollection":{for(i=0;i<o.geometries.length;i++)if(t(o.geometries[i],y,p,f,m)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}y++}}l(o5,"geomEach");function Do(r,t){o5(r,function(e,i,n,o,a){var u=e===null?null:e.type;switch(u){case null:case"Point":case"LineString":case"Polygon":return t(Br(e,n,{bbox:o,id:a}),i,0)===!1?!1:void 0}var s;switch(u){case"MultiPoint":s="Point";break;case"MultiLineString":s="LineString";break;case"MultiPolygon":s="Polygon";break}for(var p=0;p<e.coordinates.length;p++){var f=e.coordinates[p],m={type:s,coordinates:f};if(t(Br(m,n),i,p)===!1)return!1}})}l(Do,"flattenEach");function a5(r,t){Do(r,function(e,i,n){var o=0;if(e.geometry){var a=e.geometry.type;if(!(a==="Point"||a==="MultiPoint")){var u,s=0,p=0,f=0;if(Ks(e,function(m,y,x,S,M){if(u===void 0||i>s||S>p||M>f){u=m,s=i,p=S,f=M,o=0;return}var g=hr([u,m],e.properties);if(t(g,i,n,M,o)===!1)return!1;o++,u=m})===!1)return!1}}})}l(a5,"segmentEach");function E1(r,t,e){var i=e,n=!1;return a5(r,function(o,a,u,s,p){n===!1&&e===void 0?i=o:i=t(i,o,a,u,s,p),n=!0}),i}l(E1,"segmentReduce");function zc(r){var t=[1/0,1/0,-1/0,-1/0];return Ks(r,function(e){t[0]>e[0]&&(t[0]=e[0]),t[1]>e[1]&&(t[1]=e[1]),t[2]<e[0]&&(t[2]=e[0]),t[3]<e[1]&&(t[3]=e[1])}),t}l(zc,"bbox");zc.default=zc;var Qs=zc;function s5(r,t){t===void 0&&(t={});var e=Qs(r),i=(e[0]+e[2])/2,n=(e[1]+e[3])/2;return Ie([i,n],t.properties,t)}l(s5,"center");var L1=s5;d();d();function l5(r,t,e){e===void 0&&(e={});var i=We(r),n=We(t),o=ne(n[1]-i[1]),a=ne(n[0]-i[0]),u=ne(i[1]),s=ne(n[1]),p=Math.pow(Math.sin(o/2),2)+Math.pow(Math.sin(a/2),2)*Math.cos(u)*Math.cos(s);return P1(2*Math.atan2(Math.sqrt(p),Math.sqrt(1-p)),e.units)}l(l5,"distance");var Fr=l5;function tl(r,t){return t===void 0&&(t={}),E1(r,function(e,i){var n=i.geometry.coordinates;return e+Fr(n[0],n[1],t)},0)}l(tl,"length");d();d();d();function el(r,t,e){if(e===void 0&&(e={}),e.final===!0)return u5(r,t);var i=We(r),n=We(t),o=ne(i[0]),a=ne(n[0]),u=ne(i[1]),s=ne(n[1]),p=Math.sin(a-o)*Math.cos(s),f=Math.cos(u)*Math.sin(s)-Math.sin(u)*Math.cos(s)*Math.cos(a-o);return _o(Math.atan2(p,f))}l(el,"bearing");function u5(r,t){var e=el(t,r);return e=(e+180)%360,e}l(u5,"calculateFinalBearing");d();function gi(r,t,e,i){i===void 0&&(i={});var n=We(r),o=ne(n[0]),a=ne(n[1]),u=ne(e),s=w1(t,i.units),p=Math.asin(Math.sin(a)*Math.cos(s)+Math.cos(a)*Math.sin(s)*Math.cos(u)),f=o+Math.atan2(Math.sin(u)*Math.sin(s)*Math.cos(a),Math.cos(s)-Math.sin(a)*Math.sin(p)),m=_o(f),y=_o(p);return Ie([m,y],i.properties)}l(gi,"destination");d();d();function c5(r){if(!r)throw new Error("geojson is required");var t=[];return Do(r,function(e){p5(e,t)}),Lo(t)}l(c5,"lineSegment");function p5(r,t){var e=[],i=r.geometry;if(i!==null){switch(i.type){case"Polygon":e=ue(i);break;case"LineString":e=[ue(i)]}e.forEach(function(n){var o=h5(n,r.properties);o.forEach(function(a){a.id=t.length,t.push(a)})})}}l(p5,"lineSegmentFeature");function h5(r,t){var e=[];return r.reduce(function(i,n){var o=hr([i,n],t);return o.bbox=d5(i,n),e.push(o),n}),e}l(h5,"createSegments");function d5(r,t){var e=r[0],i=r[1],n=t[0],o=t[1],a=e<n?e:n,u=i<o?i:o,s=e>n?e:n,p=i>o?i:o;return[a,u,s,p]}l(d5,"bbox");var qc=c5;var F3=Ar(R3(),1);function R8(r,t){var e={},i=[];if(r.type==="LineString"&&(r=Br(r)),t.type==="LineString"&&(t=Br(t)),r.type==="Feature"&&t.type==="Feature"&&r.geometry!==null&&t.geometry!==null&&r.geometry.type==="LineString"&&t.geometry.type==="LineString"&&r.geometry.coordinates.length===2&&t.geometry.coordinates.length===2){var n=B3(r,t);return n&&i.push(n),Lo(i)}var o=(0,F3.default)();return o.load(qc(t)),Zc(qc(r),function(a){Zc(o.search(a),function(u){var s=B3(a,u);if(s){var p=ue(s).join(",");e[p]||(e[p]=!0,i.push(s))}})}),Lo(i)}l(R8,"lineIntersect");function B3(r,t){var e=ue(r),i=ue(t);if(e.length!==2)throw new Error("<intersects> line1 must only contain 2 coordinates");if(i.length!==2)throw new Error("<intersects> line2 must only contain 2 coordinates");var n=e[0][0],o=e[0][1],a=e[1][0],u=e[1][1],s=i[0][0],p=i[0][1],f=i[1][0],m=i[1][1],y=(m-p)*(a-n)-(f-s)*(u-o),x=(f-s)*(o-p)-(m-p)*(n-s),S=(a-n)*(o-p)-(u-o)*(n-s);if(y===0)return null;var M=x/y,g=S/y;if(M>=0&&M<=1&&g>=0&&g<=1){var C=n+M*(a-n),I=o+M*(u-o);return Ie([C,I])}return null}l(B3,"intersects");var G3=R8;function B8(r,t,e){e===void 0&&(e={});var i=Ie([1/0,1/0],{dist:1/0}),n=0;return Do(r,function(o){for(var a=ue(o),u=0;u<a.length-1;u++){var s=Ie(a[u]);s.properties.dist=Fr(t,s,e);var p=Ie(a[u+1]);p.properties.dist=Fr(t,p,e);var f=Fr(s,p,e),m=Math.max(s.properties.dist,p.properties.dist),y=el(s,p),x=gi(t,m,y+90,e),S=gi(t,m,y-90,e),M=G3(hr([x.geometry.coordinates,S.geometry.coordinates]),hr([s.geometry.coordinates,p.geometry.coordinates])),g=null;M.features.length>0&&(g=M.features[0],g.properties.dist=Fr(t,g,e),g.properties.location=n+Fr(s,g,e)),s.properties.dist<i.properties.dist&&(i=s,i.properties.index=u,i.properties.location=n),p.properties.dist<i.properties.dist&&(i=p,i.properties.index=u+1,i.properties.location=n+f),g&&g.properties.dist<i.properties.dist&&(i=g,i.properties.index=u),n+=f}}),i}l(B8,"nearestPointOnLine");var qo=B8;function F8(r,t,e){var i=ue(e);if(T1(e)!=="LineString")throw new Error("line must be a LineString");var n=qo(e,r),o=qo(e,t),a;n.properties.index<=o.properties.index?a=[n,o]:a=[o,n];for(var u=[a[0].geometry.coordinates],s=a[0].properties.index+1;s<a[1].properties.index+1;s++)u.push(i[s]);return u.push(a[1].geometry.coordinates),hr(u,e.properties)}l(F8,"lineSlice");var Rh=F8;var G8=1e-7;function Bh(r){return{type:"Point",coordinates:r}}l(Bh,"point");function V8(r,t){let{coordinates:e}=t.geometry,{coordinates:i}=r.geometry,n=e.map(o=>qo(r,Bh(o)));return i.reduce((o,a)=>{let u=Rh(Bh(a),n[0],r),s=Rh(Bh(a),n[1],r),p=tl(u)<tl(s)?u:s;return p.properties={...r.properties,entrances:[]},o.concat([p])},[])}l(V8,"splitObstructionByEntrance");function Fh(r,t){return t.reduce((e,i)=>{let n={epsilon:G8},o=e.findIndex(u=>I1(L1(i),u,n)),a=e[o];if(a){let[u,s]=V8(a,i);e.splice(o,1,u,s)}return e},[r])}l(Fh,"splitObstructionByAllEntrances");d();d();d();d();var Gh=[0,4,6,8,10],ut=l(()=>{let r=new Array(16).fill(0),t=Math.random()*4294967296;for(let i=0;i<r.length;i++)i>0&&!(i&3)&&(t=Math.random()*4294967296),r[i]=t>>>((i&3)<<3)&255;let e=r.map(i=>i.toString(16).padStart(2,"0"));return e[6]="4"+e[6][1],e[8]=["8","9","a","b"].includes(e[7][0])?e[7]:"a"+e[7][1],Gh.map((i,n)=>e.slice(i,n===Gh.length-1?void 0:Gh[n+1]).join("")).join("-")},"randomId");var Ln=class Ln{__type=Ln.__type;id=ut();latitude;longitude;floorId;static is(t){return t.__type===Ln.__type}constructor(t,e,i){this.latitude=t,this.longitude=e,this.floorId=i}isEqual(t){return this.latitude===t.latitude&&this.longitude===t.longitude&&this.floorId===t.floorId}toJSON(){return{latitude:this.latitude,longitude:this.longitude,floor:this.floorId}}destroy(){}};l(Ln,"Coordinate"),v(Ln,"__type","coordinate");var Vh=Ln,Q=Vh;d();d();d();d();var Hh=class Hh{id;constructor(t){this.id=t}};l(Hh,"BaseMetaData");var xi=Hh;var Jo,_n,$o=class $o extends xi{constructor(e){super(String(ut()));P(this,Jo,{});P(this,_n,void 0);E(this,_n,e.mvfData)}static is(e){return e.__type===$o.__type}get url(){return c(this,_n).url}get name(){return c(this,_n).displayName}toJSON(){return{id:this.id,url:this.url,name:this.name}}destroy(){for(let e of globalThis.Object.keys(c(this,Jo)))delete c(this,Jo)[e]}};Jo=new WeakMap,_n=new WeakMap,l($o,"Hyperlink"),v($o,"__type","hyperlink");var Xh=$o,Kl=Xh;var Yh=class Yh{id;constructor(t,e){var n;this.id=t;let i=(n=e==null?void 0:e.links)!=null?n:[];i.length>0&&(this.links=i.map(o=>new Kl({mvfData:o})))}links=[]};l(Yh,"BaseMapData");var Lt=Yh;var Si,yr,Mi,Wr,Dn=class Dn extends Lt{constructor(e,i){super(i.mvfData.properties.id,i.mvfData.properties.details);v(this,"__type",Dn.__type);P(this,Si,void 0);P(this,yr,void 0);P(this,Mi,void 0);P(this,Wr,void 0);E(this,yr,{}),E(this,Wr,i.mvfData),E(this,Si,e),E(this,Mi,i.floorId)}static is(e){return e.__type===Dn.__type}get name(){var e,i;return(i=(e=c(this,Wr).properties.details)==null?void 0:e.name)!=null?i:""}get description(){var e,i;return(i=(e=c(this,Wr).properties.details)==null?void 0:e.description)!=null?i:""}get images(){var e,i;return(i=(e=c(this,Wr).properties.details)==null?void 0:e.images)!=null?i:[]}get floor(){let e=c(this,Si).getById("floor",c(this,Mi));if(e==null)throw new Error(`Floor ${c(this,Mi)} not found!`);return e}get center(){if(c(this,yr).center==null){let[[e,i],[n,o]]=c(this,Wr).geometry.coordinates,a=(e+n)/2,u=(i+o)/2;c(this,yr).center=new Q(u,a,c(this,Mi))}return c(this,yr).center}get isExterior(){var n;let e=c(this,Si).obstructionIdByEntranceId[this.id],i=c(this,Si).getMVFFeatureById("obstruction",e);return(n=i==null?void 0:i.properties.footprintComponent)!=null?n:!1}toJSON(){return{id:this.id,name:this.name,floor:this.floor.id,center:this.center.toJSON()}}destroy(){for(let e of Object.keys(c(this,yr)))delete c(this,yr)[e]}};Si=new WeakMap,yr=new WeakMap,Mi=new WeakMap,Wr=new WeakMap,l(Dn,"Door"),v(Dn,"__type","door");var jh=Dn,Ur=jh;d();var Ko,Pi,Zr,gr,On=class On extends Lt{constructor(e,i){super(i.mvfData.properties.id,i.mvfData.properties.details);v(this,"__type",On.__type);P(this,Ko,void 0);P(this,Pi,void 0);P(this,Zr,{});P(this,gr,void 0);E(this,Ko,e),E(this,Pi,i.floorId),E(this,gr,i.mvfData)}static is(e){return e.__type===On.__type}get name(){var i,n;let{properties:e}=c(this,gr);return(n=(i=e.details)==null?void 0:i.name)!=null?n:e.externalId}get type(){return X8(c(this,gr).properties.kind)}get description(){var e,i;return(i=(e=c(this,gr).properties.details)==null?void 0:e.description)!=null?i:""}get images(){var e,i;return(i=(e=c(this,gr).properties.details)==null?void 0:e.images)!=null?i:[]}get floor(){let e=c(this,Ko).getById("floor",c(this,Pi));if(e==null)throw new Error(`Floor ${c(this,Pi)} not found!`);return e}get center(){var e;if(c(this,Zr).center==null){let[i,n]=(e=c(this,gr).properties.center)!=null?e:[0,0];c(this,Zr).center=new Q(n,i,c(this,Pi))}return c(this,Zr).center}toJSON(){return{id:this.id,name:this.name,type:this.type,floor:this.floor.id,center:this.center.toJSON()}}destroy(){for(let e of Object.keys(c(this,Zr)))delete c(this,Zr)[e]}};Ko=new WeakMap,Pi=new WeakMap,Zr=new WeakMap,gr=new WeakMap,l(On,"Space"),v(On,"__type","space");var Wh=On,H8=["room","hallway","exterior","void","connection.stairs","connection.elevator","poi"];function X8(r){if(r==null||r==="default")return"room";let t=r.toLowerCase();return H8.includes(t)?t:"room"}l(X8,"validateSpaceType");var _e=Wh;d();var qe,gt,Nn,An=class An extends Lt{constructor(e,i){super(i.mvfData.id);v(this,"__type",An.__type);P(this,qe,void 0);P(this,gt,{});P(this,Nn,void 0);E(this,qe,e),E(this,Nn,i.mvfData)}static is(e){return e.__type===An.__type}get name(){return c(this,Nn).externalId}get elevation(){return c(this,Nn).elevation}get spaces(){if(c(this,gt).spaces==null){let e=c(this,qe).spaces.filter(i=>i.floor.id===this.id);c(this,gt).spaces=e}return c(this,gt).spaces}get objects(){if(c(this,gt).objects==null){let e=c(this,qe).objects.filter(i=>i.floor.id===this.id);c(this,gt).objects=e}return c(this,gt).objects}get connections(){if(c(this,gt).connections==null){let e=c(this,qe).connections.filter(i=>i.floors.includes(this));c(this,gt).connections=e}return c(this,gt).connections}get doors(){if(c(this,gt).doors==null){let e=c(this,qe).doors.filter(i=>i.floor.id===this.id);c(this,gt).doors=e}return c(this,gt).doors}get annotations(){if(c(this,gt).annotations==null){let e=c(this,qe).annotations.filter(i=>i.floor.id===this.id);c(this,gt).annotations=e}return c(this,gt).annotations}get pois(){if(c(this,gt).pois==null){let e=c(this,qe).pointsOfInterest.filter(i=>i.floor.id===this.id);c(this,gt).pois=e}return c(this,gt).pois}toJSON(){return{id:this.id,name:this.name,elevation:this.elevation,spaces:this.spaces.map(e=>e.id),objects:this.objects.map(e=>e.id),connections:this.connections.map(e=>e.id),doors:this.doors.map(e=>e.id),annotations:this.annotations.map(e=>e.id),pois:this.pois.map(e=>e.id)}}destroy(){for(let e of globalThis.Object.keys(c(this,gt)))delete c(this,gt)[e]}};qe=new WeakMap,gt=new WeakMap,Nn=new WeakMap,l(An,"Floor"),v(An,"__type","floor");var Uh=An,kn=Uh;d();d();d();var Zh=l(r=>r!=null,"notNull");d();function $e(r){let t;if(_e.is(r)||Ur.is(r)||De.is(r))t=r.center;else if(zr.is(r)||Rn.is(r))t=r.coordinate;else if(Q.is(r))t=r;else return;return t}l($e,"getCoordinateFromStuffs");var Qo,vr,br,Bn=class Bn extends Lt{constructor(e,i){let n=Object.values(i.mvfDataByFloorId)[0];super(n.properties.id,n.properties.details);v(this,"__type",Bn.__type);P(this,Qo,void 0);P(this,vr,void 0);P(this,br,void 0);E(this,vr,{}),E(this,Qo,e),E(this,br,i.mvfDataByFloorId)}static is(e){return e.__type===Bn.__type}get name(){var e,i;return(i=(e=Object.values(c(this,br))[0].properties.details)==null?void 0:e.name)!=null?i:""}get description(){var e,i;return(i=(e=Object.values(c(this,br))[0].properties.details)==null?void 0:e.description)!=null?i:""}get images(){var e,i;return(i=(e=Object.values(c(this,br))[0].properties.details)==null?void 0:e.images)!=null?i:[]}get type(){var e,i;return(i=(e=Object.values(c(this,br))[0].properties.kind)==null?void 0:e.split(".")[1])!=null?i:"unknown"}get coordinates(){return c(this,vr).coordinates==null&&(c(this,vr).coordinates=Object.entries(c(this,br)).map(([e,i])=>new Q(i.geometry.coordinates[1],i.geometry.coordinates[0],e))),c(this,vr).coordinates}get floors(){return this.coordinates.map(e=>e.floorId?c(this,Qo).getById("floor",e.floorId):void 0).filter(Zh)}toJSON(){return{id:this.id,name:this.name,type:this.type,coordinates:this.coordinates.map(e=>e.toJSON()),floors:this.floors.map(e=>e.id)}}destroy(){for(let e of Object.keys(c(this,vr)))delete c(this,vr)[e]}};Qo=new WeakMap,vr=new WeakMap,br=new WeakMap,l(Bn,"Connection"),v(Bn,"__type","connection");var zh=Bn,qr=zh;d();var ta,wi,$r,Cr,Fn=class Fn extends Lt{constructor(e,i){super(i.mvfData.properties.id,i.mvfData.properties.details);v(this,"__type",Fn.__type);P(this,ta,void 0);P(this,wi,void 0);P(this,$r,{});P(this,Cr,void 0);E(this,ta,e),E(this,wi,i.floorId),E(this,Cr,i.mvfData)}static is(e){return e.__type===Fn.__type}get name(){var e,i;return(i=(e=c(this,Cr).properties.details)==null?void 0:e.name)!=null?i:""}get description(){var e,i;return(i=(e=c(this,Cr).properties.details)==null?void 0:e.description)!=null?i:""}get images(){var e,i;return(i=(e=c(this,Cr).properties.details)==null?void 0:e.images)!=null?i:[]}get type(){let e=c(this,Cr).properties.kind;return e==null&&(e="object"),e==="Desks"&&(e="desk"),e.toLowerCase()}get floor(){let e=c(this,ta).getById("floor",c(this,wi));if(e==null)throw new Error(`Floor ${c(this,wi)} not found!`);return e}get center(){var e;if(c(this,$r).center==null){let[i,n]=(e=c(this,Cr).properties.center)!=null?e:[0,0];c(this,$r).center=new Q(n,i,c(this,wi))}return c(this,$r).center}toJSON(){return{id:this.id,name:this.name,type:this.type,floor:this.floor.id,center:this.center.toJSON()}}destroy(){for(let e of globalThis.Object.keys(c(this,$r)))c(this,$r)[e]=null}};ta=new WeakMap,wi=new WeakMap,$r=new WeakMap,Cr=new WeakMap,l(Fn,"MapObject"),v(Fn,"__type","object");var qh=Fn,De=qh;d();d();var ra,Gn,ea=class ea extends xi{constructor(e){super(String(ut()));P(this,ra,{});P(this,Gn,void 0);E(this,Gn,e.mvfData)}static is(e){return e.__type===ea.__type}get url(){return c(this,Gn).url}get name(){return c(this,Gn).altText}toJSON(){return{id:this.id,url:this.url,name:this.name}}destroy(){for(let e of globalThis.Object.keys(c(this,ra)))delete c(this,ra)[e]}};ra=new WeakMap,Gn=new WeakMap,l(ea,"Image"),v(ea,"__type","image");var $h=ea,Ql=$h;var ia,Ti,Oe,Jr,Vn=class Vn extends Lt{constructor(e,i){super(i.mvfData.properties.id,i.mvfData.properties.details);v(this,"__type",Vn.__type);P(this,ia,void 0);P(this,Ti,void 0);P(this,Oe,{});P(this,Jr,void 0);E(this,ia,e),E(this,Jr,i.mvfData),E(this,Ti,i.floorId)}static is(e){return e.__type===Vn.__type}get name(){var e,i;return(i=(e=c(this,Jr).properties.details)==null?void 0:e.name)!=null?i:""}get description(){var e,i;return(i=(e=c(this,Jr).properties.details)==null?void 0:e.description)!=null?i:""}get images(){var e,i;if(c(this,Oe).images==null){let n=(i=(e=c(this,Jr).properties.details)==null?void 0:e.images)!=null?i:[];c(this,Oe).images=n.map(o=>new Ql({mvfData:o}))}return c(this,Oe).images}get floor(){let e=c(this,ia).getById("floor",c(this,Ti));if(e==null)throw new Error(`Floor ${c(this,Ti)} not found!`);return e}get coordinate(){var e;if(c(this,Oe).coordinate==null){let[i,n]=(e=c(this,Jr).geometry.coordinates)!=null?e:[0,0];c(this,Oe).coordinate=new Q(n,i,c(this,Ti))}return c(this,Oe).coordinate}toJSON(){return{id:this.id,name:this.name,floor:this.floor.id,coordinate:this.coordinate.toJSON()}}destroy(){for(let e in c(this,Oe))c(this,Oe)[e]=null}};ia=new WeakMap,Ti=new WeakMap,Oe=new WeakMap,Jr=new WeakMap,l(Vn,"PointOfInterest"),v(Vn,"__type","point-of-interest");var Jh=Vn,zr=Jh;d();var na,Ii,Kr,Xn,oa,Qh,Hn=class Hn extends Lt{constructor(e,i){super(i.mvfData.properties.id);P(this,oa);v(this,"__type",Hn.__type);P(this,na,void 0);P(this,Ii,void 0);P(this,Kr,{});P(this,Xn,void 0);E(this,na,e),E(this,Ii,i.floorId),E(this,Xn,i.mvfData)}static is(e){return e.__type===Hn.__type}get group(){return Y(this,oa,Qh).call(this).group}get type(){return Y(this,oa,Qh).call(this).type}get coordinate(){if(c(this,Kr).coordinate==null){let[e,i]=c(this,Xn).geometry.coordinates;c(this,Kr).coordinate=new Q(i,e,c(this,Ii))}return c(this,Kr).coordinate}get floor(){let e=c(this,na).getById("floor",c(this,Ii));if(e==null)throw new Error(`Floor ${c(this,Ii)} not found!`);return e}toJSON(){return{id:this.id,group:this.group,type:this.type,coordinate:this.coordinate.toJSON()}}destroy(){for(let e of Object.keys(c(this,Kr)))delete c(this,Kr)[e]}};na=new WeakMap,Ii=new WeakMap,Kr=new WeakMap,Xn=new WeakMap,oa=new WeakSet,Qh=l(function(){let[e,i]=c(this,Xn).properties.symbolId.split("--");return{group:e,type:i}},"#getGroupAndTypeFromSymbolId"),l(Hn,"Annotation"),v(Hn,"__type","annotation");var Kh=Hn,Rn=Kh;d();d();var jn,Ae,Ei,Wn,Yn=class Yn extends Lt{constructor(e,i){super(i.mvfData.properties.id);v(this,"__type",Yn.__type);P(this,jn,void 0);P(this,Ae,{});P(this,Ei,void 0);P(this,Wn,void 0);E(this,jn,e),E(this,Ei,i.floorId),E(this,Wn,i.mvfData)}static is(e){return e.__type===Yn.__type}get floor(){let e=c(this,jn).getById("floor",c(this,Ei));if(e==null)throw new Error(`Floor ${c(this,Ei)} not found!`);return e}get coordinate(){if(c(this,Ae).coordinate==null){let[e,i]=c(this,Wn).geometry.coordinates;c(this,Ae).coordinate=new Q(i,e,c(this,Ei))}return c(this,Ae).coordinate}get neighbors(){if(c(this,Ae).neighbours==null){let e=c(this,Wn).properties.neighbors.map(i=>{let n=c(this,jn).getById("node",i.id);if(n==null)throw new Error(`Node ${i.id} not found!`);return n});c(this,Ae).neighbours=e}return c(this,Ae).neighbours}toJSON(){return{id:this.id,floor:this.floor.id,coordinate:this.coordinate.toJSON(),neighbors:this.neighbors.map(e=>e.id)}}destroy(){for(let e of Object.keys(c(this,Ae)))delete c(this,Ae)[e]}};jn=new WeakMap,Ae=new WeakMap,Ei=new WeakMap,Wn=new WeakMap,l(Yn,"Node"),v(Yn,"__type","node");var td=Yn,V3=td;var Y8=l((r,t)=>{var m,y;let e={},i={},n={},o={},a={},u={},s={},p={},f=globalThis.Object.keys(r.space);for(let x of f){let S=r.space[x];if(S!=null)for(let M of S.features){p[M.properties.id]=x,a[M.properties.id]=M;for(let g of M.properties.destinationNodes)n[g]==null&&(n[g]=[]),n[g].push(M.properties.id);if(M.properties.kind==="desk-entrance"&&(o[M.properties.externalId]==null&&(o[M.properties.externalId]=[]),o[M.properties.externalId].push(...M.properties.destinationNodes)),!["void","desk-entrance"].includes((m=M.properties.kind)!=null?m:"")){if((y=M.properties.kind)!=null&&y.includes("connection")){let g=`${M.geometry.coordinates[1]}-${M.geometry.coordinates[0]}`;u[g]==null&&(u[g]=[]),u[g].push(M.properties.id);continue}if(M.properties.kind==="poi"){let g=new zr(t,{floorId:x,mvfData:M});i[M.properties.id]=g}else{let g=new _e(t,{floorId:x,mvfData:M});e[M.properties.id]=g}}}}for(let x in u){let S=u[x],M={};for(let C of S){let I=p[C],T=a[C];M[I]=T}let g=new qr(t,{mvfDataByFloorId:M});s[g.id]=g}return{spacesById:e,poisById:i,connectionsById:s,spaceIdsByDestinationNodeId:n,objectEntranceNodeIdsByObstructionId:o,mvfSpacesById:a,connectionIdsByLatLon:u}},"processMVFSpaces"),j8=l((r,t)=>{let e={},i={};for(let n of r["node.geojson"].features){i[n.properties.id]=n;let o=new V3(t,{mvfData:n,floorId:n.properties.map});e[n.properties.id]=o}return{nodesById:e,mvfNodesById:i}},"processMVFNodes"),W8=l((r,t)=>{let e={},i={},n={},o=globalThis.Object.keys(r.obstruction);for(let a of o){let u=r.obstruction[a];if(u!=null)for(let s of u.features){i[s.properties.id]=s;for(let f of s.properties.entrances)n[f]=s.properties.id;if(s.properties.kind==="Wall")continue;let p=new De(t,{floorId:a,mvfData:s});e[s.properties.id]=p}}return{objectsById:e,mvfObstructionById:i,obstructionIdByEntranceId:n}},"processMVFObstructions"),U8=l((r,t)=>{let e={},i={};for(let n of r["map.geojson"]){i[n.id]=n;let o=new kn(t,{mvfData:n});e[n.id]=o}return{floorsById:e,mvfMapsById:i}},"processMVFMaps"),Z8=l((r,t)=>{let e={},i=r["connection.json"].reduce((n,o)=>(o.nodes.forEach(a=>n[a]=o),e[o.id]=o,n),{});return{mvfConnectionsById:e,mvfConnectionsByNodeId:i}},"processMVFConnections"),z8=l((r,t)=>{let e={},i={},n=globalThis.Object.keys(r.entrance);for(let o of n){let a=r.entrance[o];if(a!=null)for(let u of a.features){i[u.properties.id]=u;let s=new Ur(t,{floorId:o,mvfData:u});e[u.properties.id]=s}}return{doorsById:e,mvfEntrancesById:i}},"processMVFEntrances"),q8=l((r,t)=>{let e={},i={};if(r.annotation==null)return{annotationsById:e,mvfAnnotationsById:i};let n=globalThis.Object.keys(r.annotation);for(let o of n){let a=r.annotation[o];if(a!=null)for(let u of a.features){i[u.properties.id]=u;let s=new Rn(t,{floorId:o,mvfData:u});e[u.properties.id]=s}}return{annotationsById:e,mvfAnnotationsById:i}},"processMVFAnnotations"),H3=l((r,t)=>{let{spacesById:e,spaceIdsByDestinationNodeId:i,poisById:n,mvfSpacesById:o,objectEntranceNodeIdsByObstructionId:a,connectionsById:u,connectionIdsByLatLon:s}=Y8(r,t),{nodesById:p,mvfNodesById:f}=j8(r,t),{objectsById:m,mvfObstructionById:y,obstructionIdByEntranceId:x}=W8(r,t),{floorsById:S,mvfMapsById:M}=U8(r,t),{mvfConnectionsById:g,mvfConnectionsByNodeId:C}=Z8(r,t),{doorsById:I,mvfEntrancesById:T}=z8(r,t),{annotationsById:w,mvfAnnotationsById:L}=q8(r,t);return{spacesById:e,nodesById:p,objectsById:m,floorsById:S,connectionsById:u,doorsById:I,poisById:n,annotationsById:w,spaceIdsByDestinationNodeId:i,objectEntranceNodeIdsByObstructionId:a,obstructionIdByEntranceId:x,connectionIdsByLatLon:s,mvfSpacesById:o,mvfNodesById:f,mvfObstructionById:y,mvfMapsById:M,mvfConnectionsById:g,mvfConnectionsByNodeId:C,mvfEntrancesById:T,mvfAnnotationsById:L}},"createDataFromMVF");var ot,Li,_i,Di,Oi,Ai,Ni,ki,Ri,sa,la,ua,ca,pa,ha,da,fa,ed=class ed{constructor(t,e){P(this,ot,{});v(this,"mvf");v(this,"outdoorViewToken");v(this,"spaceIdsByDestinationNodeId");v(this,"objectEntranceNodeIdsByObstructionId");v(this,"obstructionIdByEntranceId");P(this,Li,void 0);P(this,_i,void 0);P(this,Di,void 0);P(this,Oi,void 0);P(this,Ai,void 0);P(this,Ni,void 0);P(this,ki,void 0);P(this,Ri,void 0);P(this,sa,void 0);P(this,la,void 0);P(this,ua,void 0);P(this,ca,void 0);P(this,pa,void 0);P(this,ha,void 0);P(this,da,void 0);P(this,fa,void 0);this.mvf=t,this.outdoorViewToken=e;let i=H3(t,this);E(this,Li,i.nodesById),E(this,_i,i.spacesById),E(this,Di,i.floorsById),E(this,Oi,i.connectionsById),E(this,Ai,i.objectsById),E(this,Ni,i.doorsById),E(this,ki,i.poisById),E(this,Ri,i.annotationsById),E(this,sa,i.mvfAnnotationsById),E(this,la,i.mvfConnectionsById),E(this,ua,i.mvfConnectionsByNodeId),E(this,ca,i.mvfEntrancesById),E(this,pa,i.mvfNodesById),E(this,ha,i.mvfObstructionById),E(this,da,i.mvfSpacesById),E(this,fa,i.mvfMapsById),this.spaceIdsByDestinationNodeId=i.spaceIdsByDestinationNodeId,this.objectEntranceNodeIdsByObstructionId=i.objectEntranceNodeIdsByObstructionId,this.obstructionIdByEntranceId=i.obstructionIdByEntranceId}get mapName(){return this.mvf["manifest.geojson"].features[0].properties.name}get organizationId(){var t;return(t=this.mvf["manifest.geojson"].features[0].properties.org_id)!=null?t:""}get mapCenter(){return new Q(this.mvf["manifest.geojson"].features[0].geometry.coordinates[1],this.mvf["manifest.geojson"].features[0].geometry.coordinates[0])}get spaces(){return c(this,ot).spaces==null&&(c(this,ot).spaces=globalThis.Object.values(c(this,_i))),c(this,ot).spaces}get objects(){return c(this,ot).objects==null&&(c(this,ot).objects=globalThis.Object.values(c(this,Ai))),c(this,ot).objects}get connections(){return c(this,ot).connections==null&&(c(this,ot).connections=globalThis.Object.values(c(this,Oi))),c(this,ot).connections}get floors(){return c(this,ot).floors==null&&(c(this,ot).floors=globalThis.Object.values(c(this,Di))),c(this,ot).floors}get doors(){return c(this,ot).doors==null&&(c(this,ot).doors=globalThis.Object.values(c(this,Ni))),c(this,ot).doors}get pointsOfInterest(){return c(this,ot).pointsOfInterest==null&&(c(this,ot).pointsOfInterest=globalThis.Object.values(c(this,ki))),c(this,ot).pointsOfInterest}get annotations(){return c(this,ot).annotations==null&&(c(this,ot).annotations=globalThis.Object.values(c(this,Ri))),c(this,ot).annotations}get nodes(){return c(this,ot).nodes==null&&(c(this,ot).nodes=globalThis.Object.values(c(this,Li))),c(this,ot).nodes}getById(t,e){switch(t){case"space":return c(this,_i)[e];case"floor":return c(this,Di)[e];case"node":return c(this,Li)[e];case"door":return c(this,Ni)[e];case"connection":return c(this,Oi)[e];case"object":return c(this,Ai)[e];case"point-of-interest":return c(this,ki)[e];case"annotation":return c(this,Ri)[e];default:throw new Error(`Unknown type: ${t}`)}}getMapDataById(t){var e,i,n,o,a,u,s;return(s=(u=(a=(o=(n=(i=(e=c(this,_i)[t])!=null?e:c(this,Di)[t])!=null?i:c(this,Li)[t])!=null?n:c(this,Ni)[t])!=null?o:c(this,Oi)[t])!=null?a:c(this,Ai)[t])!=null?u:c(this,ki)[t])!=null?s:c(this,Ri)[t]}getMVFFeatureById(t,e){switch(t){case"space":return c(this,da)[e];case"node":return c(this,pa)[e];case"obstruction":return c(this,ha)[e];case"map":return c(this,fa)[e];case"connection":return c(this,la)[e];case"entrance":return c(this,ca)[e];case"annotation":return c(this,sa)[e];default:throw new Error(`Unknown MVF feature type: ${t}`)}}getMVFFeatureByNodeId(t,e){switch(t){case"connection":return c(this,ua)[e];default:throw new Error(`Unsupported MVF feature type: ${t}`)}}destroy(){for(let t of globalThis.Object.keys(c(this,ot)))c(this,ot)[t]=null}};ot=new WeakMap,Li=new WeakMap,_i=new WeakMap,Di=new WeakMap,Oi=new WeakMap,Ai=new WeakMap,Ni=new WeakMap,ki=new WeakMap,Ri=new WeakMap,sa=new WeakMap,la=new WeakMap,ua=new WeakMap,ca=new WeakMap,pa=new WeakMap,ha=new WeakMap,da=new WeakMap,fa=new WeakMap,l(ed,"MapDataInternal");var aa=ed;d();d();d();d();var rd=class rd{_subscribers={};publish(t,e){!this._subscribers||!this._subscribers[t]||this._subscribers[t].forEach(function(i){typeof i=="function"&&i(e)})}on(t,e){this._subscribers||(this._subscribers={}),this._subscribers[t]=this._subscribers[t]||[],this._subscribers[t].push(e)}off(t,e){if(!this._subscribers||this._subscribers[t]==null)return;let i=this._subscribers[t].indexOf(e);i!==-1&&this._subscribers[t].splice(i,1)}destroy(){this._subscribers={}}};l(rd,"PubSub");var J=rd;d();d();d();d();var Un=class Un{id;text;__type=Un.__type;static is(t){return t.__type===Un.__type}constructor(t,e){this.id=t,this.text=e}};l(Un,"Label"),v(Un,"__type","Label");var Qr=Un;d();var Zn=class Zn{id;__type=Zn.__type;contentEl;update;static is(t){return t.__type===Zn.__type}constructor(t,e,i){this.id=t,this.contentEl=e,this.update=i}};l(Zn,"Marker"),v(Zn,"__type","Marker");var Bi=Zn;d();var zn=class zn{id;groupId;__type=zn.__type;static is(t){return t.__type===zn.__type}constructor(t,e){this.id=t,this.groupId=e}};l(zn,"Model"),v(zn,"__type","Model");var ma=zn;d();var id=class id{id;__type;constructor(t){this.id=t,this.__type="Path"}};l(id,"Path");var ya=id;d();var ti,nd=class nd{constructor(t){P(this,ti,void 0);E(this,ti,t)}get center(){return c(this,ti).center}get bearing(){return c(this,ti).bearing}get pitch(){return c(this,ti).pitch}get zoomLevel(){return c(this,ti).zoomLevel}};ti=new WeakMap,l(nd,"CameraTransform");var ga=nd;d();var qn=class qn{id;__type=qn.__type;static is(t){return t.__type===qn.__type}constructor(t){this.id=t}};l(qn,"CustomGeometry"),v(qn,"__type","CustomGeometry");var va=qn;d();d();d();var $8=new Map([["search-16x16",`<svg viewBox="0 0 16 16">
5
5
  <path
6
6
  fillRule="evenodd"
7
7
  clipRule="evenodd"
@@ -195,7 +195,7 @@ import{h as Dc,i as p1,j as zs}from"./chunk-46QN2SP2.js";import{a as je}from"./c
195
195
  d="M9.10678 11.2433C9.07993 11.2167 9.04367 11.2018 9.00589 11.2018C8.9681 11.2018 8.93184 11.2167 8.90499 11.2433L6.82999 13.3183C5.86928 14.279 4.24785 14.3808 3.18714 13.3183C2.12464 12.2558 2.22642 10.6362 3.18714 9.67546L5.26214 7.60046C5.31749 7.5451 5.31749 7.45403 5.26214 7.39868L4.55142 6.68796C4.52457 6.66138 4.48832 6.64646 4.45053 6.64646C4.41274 6.64646 4.37649 6.66138 4.34964 6.68796L2.27464 8.76296C0.763923 10.2737 0.763923 12.7183 2.27464 14.2272C3.78535 15.7362 6.22999 15.738 7.73892 14.2272L9.81392 12.1522C9.86928 12.0969 9.86928 12.0058 9.81392 11.9505L9.10678 11.2433ZM13.7246 2.77903C12.2139 1.26832 9.76928 1.26832 8.26035 2.77903L6.18357 4.85403C6.15698 4.88088 6.14207 4.91714 6.14207 4.95493C6.14207 4.99271 6.15698 5.02897 6.18357 5.05582L6.89249 5.76475C6.94785 5.8201 7.03892 5.8201 7.09428 5.76475L9.16928 3.68975C10.13 2.72903 11.7514 2.62725 12.8121 3.68975C13.8746 4.75225 13.7729 6.37189 12.8121 7.3326L10.7371 9.4076C10.7106 9.43445 10.6956 9.47071 10.6956 9.5085C10.6956 9.54628 10.7106 9.58254 10.7371 9.60939L11.4479 10.3201C11.5032 10.3755 11.5943 10.3755 11.6496 10.3201L13.7246 8.2451C15.2336 6.73439 15.2336 4.28975 13.7246 2.77903ZM9.75142 6.00939C9.72457 5.9828 9.68832 5.96789 9.65053 5.96789C9.61275 5.96789 9.57649 5.9828 9.54964 6.00939L5.50499 10.0522C5.47841 10.0791 5.46349 10.1154 5.46349 10.1531C5.46349 10.1909 5.47841 10.2272 5.50499 10.254L6.21214 10.9612C6.26749 11.0165 6.35857 11.0165 6.41392 10.9612L10.4568 6.91832C10.5121 6.86296 10.5121 6.77189 10.4568 6.71653L9.75142 6.00939Z"
196
196
  stroke="none"
197
197
  />
198
- </svg>`]]),B8=/<svg([^>]*)>/g;function k3(r,t,e){let i=R8.get(r);return i?i.replace(B8,`<svg$1 style="fill:${t}; width:${e}px; height:${e}px">`):""}l(k3,"getStyledIcon");var F8=l(r=>`
198
+ </svg>`]]),J8=/<svg([^>]*)>/g;function X3(r,t,e){let i=$8.get(r);return i?i.replace(J8,`<svg$1 style="fill:${t}; width:${e}px; height:${e}px">`):""}l(X3,"getStyledIcon");var K8=l(r=>`
199
199
  <div class="pin-shadow" style="background: ${r}"></div>
200
200
  <svg width="${20*.9}px" height="${48*.9}px" viewBox="0 0 20 48">
201
201
  <path
@@ -205,7 +205,7 @@ import{h as Dc,i as p1,j as zs}from"./chunk-46QN2SP2.js";import{a as je}from"./c
205
205
  strokeWidth="2"
206
206
  />
207
207
  </svg>
208
- `,"getDeparturePin"),G8=l(r=>`
208
+ `,"getDeparturePin"),Q8=l(r=>`
209
209
  <div class="pin-shadow" style="background: ${r}"></div>
210
210
  <svg width="36" height="42" viewBox="-2 -2 40 46">
211
211
  <path
@@ -219,9 +219,9 @@ import{h as Dc,i as p1,j as zs}from"./chunk-46QN2SP2.js";import{a as je}from"./c
219
219
  fill={color}
220
220
  />
221
221
  </svg>
222
- `,"getDestinationPin"),Kh="#722ED1",Qh="#1890FF",td=l(({type:r="departure",destinationColor:t=Kh,departureColor:e=Qh})=>`<div class="dropped-pin-wrapper">
223
- ${r==="departure"?F8(e):G8(t)}
224
- </div>`,"DroppedPin"),V8=l(r=>{switch(r){case"default":return 28;case"selection":return 28;case"navigation":return 32}},"getSize"),N3=l(({type:r="stairs",color:t="#722ED1",direction:e="up"})=>{let i=V8("default"),n=i/2+2;return`<div style="position: relative; width: 56px;" class="mappedin-connection-marker">
222
+ `,"getDestinationPin"),od="#722ED1",ad="#1890FF",sd=l(({type:r="departure",destinationColor:t=od,departureColor:e=ad})=>`<div class="dropped-pin-wrapper">
223
+ ${r==="departure"?K8(e):Q8(t)}
224
+ </div>`,"DroppedPin"),t9=l(r=>{switch(r){case"default":return 28;case"selection":return 28;case"navigation":return 32}},"getSize"),Y3=l(({type:r="stairs",color:t="#722ED1",direction:e="up"})=>{let i=t9("default"),n=i/2+2;return`<div style="position: relative; width: 56px;" class="mappedin-connection-marker">
225
225
  ${e!=null?`<div style="position: absolute; top: 0px; left:${i*.9}px; zIndex: -1">
226
226
  <div class="bouncey">
227
227
  <div class="connection-circle"
@@ -244,9 +244,9 @@ import{h as Dc,i as p1,j as zs}from"./chunk-46QN2SP2.js";import{a as je}from"./c
244
244
  role="button"
245
245
  style="background:${t}; width:${i}px; height:${i}px;"
246
246
  >
247
- ${k3("connection-"+r+"-16x16","white",n)||""}
247
+ ${X3("connection-"+r+"-16x16","white",n)||""}
248
248
  </div>
249
- </div>`},"ConnectionMarker");d();var R3=l(async r=>new Promise(t=>setTimeout(t,r)),"ms");var Ql={createMarkers:{departure:!0,destination:!0,connection:!0},pathOptions:{color:"#40A9FF",nearRadius:.25,farRadius:.25*4,displayArrowsOnPath:!1},polygons:{departure:"#40A9FF"}},xr,Sr,Fi,jt,ei,eu,B3,ba,ed=class ed{constructor(t){P(this,eu);P(this,xr,void 0);P(this,Sr,new Map);P(this,Fi,void 0);P(this,jt,void 0);P(this,ei,Ql);v(this,"draw",async(t,e={})=>{var u,s,p;if(t.coordinates.length<2){G.warn("Directions must have at least 2 coordinates");return}c(this,xr)&&this.clear();let i={pathOptions:{...Ql.pathOptions,...e.pathOptions},createMarkers:{...Ql.createMarkers,...e.createMarkers},polygons:{...Ql.polygons,...e.polygons}};E(this,ei,i),E(this,xr,t);let n=t.coordinates[0],o=t.coordinates[t.coordinates.length-1],a=c(this,jt).getMapData()[Object.keys(c(this,jt).getMapData())[0]];if(n.floorId&&c(this,jt).setFloor(a.getById("floor",n.floorId)),(u=c(this,ei).createMarkers)!=null&&u.departure){let f=c(this,jt).Markers.add(n,td({type:"departure"}),{anchor:"top",rank:"always-visible"});c(this,Sr).set(f,void 0)}if(await R3(500),!!c(this,xr)&&(E(this,Fi,await c(this,jt).Paths.add(t.coordinates,c(this,ei).pathOptions)),!!c(this,xr))){if((s=c(this,ei).createMarkers)!=null&&s.destination){let f=c(this,jt).Markers.add(o,td({type:"destination"}),{anchor:"top",rank:"always-visible"});c(this,Sr).set(f,void 0)}(p=c(this,ei).createMarkers)!=null&&p.connection&&(t.instructions.filter(m=>W(this,eu,B3).call(this,m.action)).forEach(m=>{let y=c(this,jt).Markers.add(m.coordinate,N3({type:m.action.connectionType,color:m.action.type==="ExitConnection"?Qh:Kh,direction:m.action.direction}),{interactive:!0,anchor:"top",rank:"always-visible"});c(this,Sr).set(y,m)}),c(this,jt).on("click",c(this,ba)))}});P(this,ba,l(t=>{if(t.markers.length>0){let e=c(this,Sr).get(t.markers[0]);e!=null&&e.action.toFloor&&c(this,jt).setFloor(e.action.toFloor)}},"#handleClick"));v(this,"clear",()=>{c(this,xr)&&(c(this,Sr).forEach((t,e)=>{c(this,jt).Markers.remove(e)}),c(this,Sr).clear(),c(this,Fi)&&(c(this,jt).Paths.remove(c(this,Fi)),E(this,Fi,void 0)),c(this,jt).off("click",c(this,ba)),E(this,xr,void 0))});E(this,jt,t)}};xr=new WeakMap,Sr=new WeakMap,Fi=new WeakMap,jt=new WeakMap,ei=new WeakMap,eu=new WeakSet,B3=l(function(t){return t!=null&&["TakeConnection","ExitConnection"].includes(t.type)},"#isVortexAction"),ba=new WeakMap,l(ed,"Navigation");var tu=ed;d();d();d();var H8=new Map([["search-16x16",`<svg viewBox="0 0 16 16">
249
+ </div>`},"ConnectionMarker");d();var j3=l(async r=>new Promise(t=>setTimeout(t,r)),"ms");var tu={createMarkers:{departure:!0,destination:!0,connection:!0},pathOptions:{color:"#40A9FF",nearRadius:.25,farRadius:.25*4,displayArrowsOnPath:!1},polygons:{departure:"#40A9FF"}},xr,Sr,Fi,jt,ei,ru,W3,ba,ld=class ld{constructor(t){P(this,ru);P(this,xr,void 0);P(this,Sr,new Map);P(this,Fi,void 0);P(this,jt,void 0);P(this,ei,tu);v(this,"draw",async(t,e={})=>{var u,s,p;if(t.coordinates.length<2){G.warn("Directions must have at least 2 coordinates");return}c(this,xr)&&this.clear();let i={pathOptions:{...tu.pathOptions,...e.pathOptions},createMarkers:{...tu.createMarkers,...e.createMarkers},polygons:{...tu.polygons,...e.polygons}};E(this,ei,i),E(this,xr,t);let n=t.coordinates[0],o=t.coordinates[t.coordinates.length-1],a=c(this,jt).getMapData()[Object.keys(c(this,jt).getMapData())[0]];if(n.floorId&&c(this,jt).setFloor(a.getById("floor",n.floorId)),(u=c(this,ei).createMarkers)!=null&&u.departure){let f=c(this,jt).Markers.add(n,sd({type:"departure"}),{anchor:"top",rank:"always-visible"});c(this,Sr).set(f,void 0)}if(await j3(500),!!c(this,xr)&&(E(this,Fi,await c(this,jt).Paths.add(t.coordinates,c(this,ei).pathOptions)),!!c(this,xr))){if((s=c(this,ei).createMarkers)!=null&&s.destination){let f=c(this,jt).Markers.add(o,sd({type:"destination"}),{anchor:"top",rank:"always-visible"});c(this,Sr).set(f,void 0)}(p=c(this,ei).createMarkers)!=null&&p.connection&&(t.instructions.filter(m=>Y(this,ru,W3).call(this,m.action)).forEach(m=>{let y=c(this,jt).Markers.add(m.coordinate,Y3({type:m.action.connectionType,color:m.action.type==="ExitConnection"?ad:od,direction:m.action.direction}),{interactive:!0,anchor:"top",rank:"always-visible"});c(this,Sr).set(y,m)}),c(this,jt).on("click",c(this,ba)))}});P(this,ba,l(t=>{if(t.markers.length>0){let e=c(this,Sr).get(t.markers[0]);e!=null&&e.action.toFloor&&c(this,jt).setFloor(e.action.toFloor)}},"#handleClick"));v(this,"clear",()=>{c(this,xr)&&(c(this,Sr).forEach((t,e)=>{c(this,jt).Markers.remove(e)}),c(this,Sr).clear(),c(this,Fi)&&(c(this,jt).Paths.remove(c(this,Fi)),E(this,Fi,void 0)),c(this,jt).off("click",c(this,ba)),E(this,xr,void 0))});E(this,jt,t)}};xr=new WeakMap,Sr=new WeakMap,Fi=new WeakMap,jt=new WeakMap,ei=new WeakMap,ru=new WeakSet,W3=l(function(t){return t!=null&&["TakeConnection","ExitConnection"].includes(t.type)},"#isVortexAction"),ba=new WeakMap,l(ld,"Navigation");var eu=ld;d();d();d();var e9=new Map([["search-16x16",`<svg viewBox="0 0 16 16">
250
250
  <path
251
251
  fillRule="evenodd"
252
252
  clipRule="evenodd"
@@ -439,14 +439,14 @@ import{h as Dc,i as p1,j as zs}from"./chunk-46QN2SP2.js";import{a as je}from"./c
439
439
  d="M9.10678 11.2433C9.07993 11.2167 9.04367 11.2018 9.00589 11.2018C8.9681 11.2018 8.93184 11.2167 8.90499 11.2433L6.82999 13.3183C5.86928 14.279 4.24785 14.3808 3.18714 13.3183C2.12464 12.2558 2.22642 10.6362 3.18714 9.67546L5.26214 7.60046C5.31749 7.5451 5.31749 7.45403 5.26214 7.39868L4.55142 6.68796C4.52457 6.66138 4.48832 6.64646 4.45053 6.64646C4.41274 6.64646 4.37649 6.66138 4.34964 6.68796L2.27464 8.76296C0.763923 10.2737 0.763923 12.7183 2.27464 14.2272C3.78535 15.7362 6.22999 15.738 7.73892 14.2272L9.81392 12.1522C9.86928 12.0969 9.86928 12.0058 9.81392 11.9505L9.10678 11.2433ZM13.7246 2.77903C12.2139 1.26832 9.76928 1.26832 8.26035 2.77903L6.18357 4.85403C6.15698 4.88088 6.14207 4.91714 6.14207 4.95493C6.14207 4.99271 6.15698 5.02897 6.18357 5.05582L6.89249 5.76475C6.94785 5.8201 7.03892 5.8201 7.09428 5.76475L9.16928 3.68975C10.13 2.72903 11.7514 2.62725 12.8121 3.68975C13.8746 4.75225 13.7729 6.37189 12.8121 7.3326L10.7371 9.4076C10.7106 9.43445 10.6956 9.47071 10.6956 9.5085C10.6956 9.54628 10.7106 9.58254 10.7371 9.60939L11.4479 10.3201C11.5032 10.3755 11.5943 10.3755 11.6496 10.3201L13.7246 8.2451C15.2336 6.73439 15.2336 4.28975 13.7246 2.77903ZM9.75142 6.00939C9.72457 5.9828 9.68832 5.96789 9.65053 5.96789C9.61275 5.96789 9.57649 5.9828 9.54964 6.00939L5.50499 10.0522C5.47841 10.0791 5.46349 10.1154 5.46349 10.1531C5.46349 10.1909 5.47841 10.2272 5.50499 10.254L6.21214 10.9612C6.26749 11.0165 6.35857 11.0165 6.41392 10.9612L10.4568 6.91832C10.5121 6.86296 10.5121 6.77189 10.4568 6.71653L9.75142 6.00939Z"
440
440
  stroke="none"
441
441
  />
442
- </svg>`]]),X8=/<svg([^>]*)>/g;function F3(r,t,e){let i=H8.get(r);return i?i.replace(X8,`<svg$1 xmlns="http://www.w3.org/2000/svg" style="fill:${t}; width:${e}px; height:${e}px">`):""}l(F3,"getStyledIcon");var Gi,$n,Ca,rd,iu,G3,nu,V3,xa,id,ou,H3,nd=class nd{constructor(t,e){P(this,Ca);P(this,iu);P(this,nu);P(this,xa);P(this,ou);P(this,Gi,void 0);P(this,$n,void 0);v(this,"colors",{default:"#3D5676",connection:"#128387",washroom:"#3161B4",point:"#AD468F"});E(this,Gi,t),E(this,$n,e)}auto(){let t=c(this,$n)[Object.keys(c(this,$n))[0]];[...t.getByType("connection"),...t.getByType("point-of-interest"),...t.getByType("space")].forEach(e=>{e.__type==="connection"?e.coordinates.forEach(i=>{c(this,Gi).Labels.add(i,e.name,W(this,Ca,rd).call(this,e))}):(e.__type==="space"&&e.name!==""&&c(this,Gi).updateState(e,{interactive:!0,hoverColor:"#F0F0F0"}),c(this,Gi).Labels.add(e,e.name,W(this,Ca,rd).call(this,e)))})}};Gi=new WeakMap,$n=new WeakMap,Ca=new WeakSet,rd=l(function(t){let e=F3(W(this,iu,G3).call(this,t),"white",12);return{appearance:{text:{foregroundColor:W(this,xa,id).call(this,t)},marker:{foregroundColor:{active:W(this,xa,id).call(this,t)},icon:e,iconSize:12}},interactive:!0,rank:W(this,ou,H3).call(this,t)}},"#generatLabelAppearance"),iu=new WeakSet,G3=l(function(t){return t.__type==="connection"?W(this,nu,V3).call(this,t.type):t.name.includes("Washroom")?"washroom-14x14":t.__type==="point-of-interest"?"point-of-interest-12x12":""},"#getIconName"),nu=new WeakSet,V3=l(function(t){let e="";switch(t){case"elevator":e="connection-elevator-12x12";break;case"escalator":e="connection-escalator-12x12";break;case"stairs":e="connection-stairs-12x12";break}return e},"#attemptIconNameForConnection"),xa=new WeakSet,id=l(function(t){return t.__type==="connection"?this.colors.connection:t.__type==="point-of-interest"?this.colors.point:"name"in t&&t.name.includes("Washroom")?this.colors.washroom:this.colors.default},"#getLabelColor"),ou=new WeakSet,H3=l(function(t){return t.__type==="connection"?"high":(t.__type==="point-of-interest","medium")},"#getDefaultLabelRank"),l(nd,"Labels");var ru=nd;var od=class od{Labels;constructor(t,e){this.Labels=new ru(t,e)}auto=()=>{this.Labels.auto()}};l(od,"DefaultTheme");var au=od;d();var Mt,ad=class ad{constructor(t){P(this,Mt,void 0);v(this,"setMinZoomLevel",t=>{c(this,Mt).camera.setMinZoomLevel(t)});v(this,"setMaxZoomLevel",t=>{c(this,Mt).camera.setMaxZoomLevel(t)});E(this,Mt,t)}setScreenOffsets(t){c(this,Mt).camera.setInsetPadding(t)}focusOn(t,e){var o;let i=[],n=Array.isArray(t)?t:[t];for(let a of n)if(qr.is(a)){let u;for(u of a.coordinates)i.push([u.longitude,u.latitude])}else{let u=$e(a);if(u){let s=0;u.floorId&&(s=((o=c(this,Mt).getState(u.floorId))==null?void 0:o.altitude)||0),i.push([u.longitude,u.latitude,s])}}return c(this,Mt).camera.focusOn(i,{pitch:e==null?void 0:e.pitch,bearing:e==null?void 0:e.bearing,padding:e==null?void 0:e.screenOffsets,maxZoomLevel:e==null?void 0:e.maxZoomLevel,minZoomLevel:e==null?void 0:e.minZoomLevel,duration:e==null?void 0:e.duration,easing:e==null?void 0:e.easing})}animateTo(t,e){var p;let{center:i,zoomLevel:n,bearing:o,pitch:a}=t,u=i!=null?i:this.center,s=[u.longitude,u.latitude];return c(this,Mt).camera.animateTo({center:s,zoomLevel:n!=null?n:this.zoomLevel,bearing:o!=null?o:this.bearing,pitch:a!=null?a:this.pitch,duration:(p=e==null?void 0:e.duration)!=null?p:600,easing:e==null?void 0:e.easing})}set(t){let{center:e=this.center,zoomLevel:i=this.zoomLevel,bearing:n=this.bearing,pitch:o=this.pitch}=t,a=[e.longitude,e.latitude];c(this,Mt).camera.setCenter(a),c(this,Mt).camera.setZoomLevel(i),c(this,Mt).camera.setBearing(n),c(this,Mt).camera.setPitch(o)}get center(){let t=c(this,Mt).camera.center;return new K(t[1],t[0],void 0)}get zoomLevel(){return c(this,Mt).camera.zoomLevel}get pitch(){return c(this,Mt).camera.pitch}get bearing(){let t=c(this,Mt).camera.bearing;return(t<0?t+360:t)%360}get minZoomLevel(){return c(this,Mt).camera.minZoomLevel}get maxZoomLevel(){return c(this,Mt).camera.maxZoomLevel}};Mt=new WeakMap,l(ad,"Camera");var Sa=ad;d();d();d();d();d();d();d();d();function sd(r){let t=+this._x.call(null,r),e=+this._y.call(null,r);return X3(this.cover(t,e),t,e,r)}l(sd,"default");function X3(r,t,e,i){if(isNaN(t)||isNaN(e))return r;var n,o=r._root,a={data:i},u=r._x0,s=r._y0,p=r._x1,f=r._y1,m,y,x,S,M,g,C,I;if(!o)return r._root=a,r;for(;o.length;)if((M=t>=(m=(u+p)/2))?u=m:p=m,(g=e>=(y=(s+f)/2))?s=y:f=y,n=o,!(o=o[C=g<<1|M]))return n[C]=a,r;if(x=+r._x.call(null,o.data),S=+r._y.call(null,o.data),t===x&&e===S)return a.next=o,n?n[C]=a:r._root=a,r;do n=n?n[C]=new Array(4):r._root=new Array(4),(M=t>=(m=(u+p)/2))?u=m:p=m,(g=e>=(y=(s+f)/2))?s=y:f=y;while((C=g<<1|M)===(I=(S>=y)<<1|x>=m));return n[I]=o,n[C]=a,r}l(X3,"add");function Y3(r){var t,e,i=r.length,n,o,a=new Array(i),u=new Array(i),s=1/0,p=1/0,f=-1/0,m=-1/0;for(e=0;e<i;++e)isNaN(n=+this._x.call(null,t=r[e]))||isNaN(o=+this._y.call(null,t))||(a[e]=n,u[e]=o,n<s&&(s=n),n>f&&(f=n),o<p&&(p=o),o>m&&(m=o));if(s>f||p>m)return this;for(this.cover(s,p).cover(f,m),e=0;e<i;++e)X3(this,a[e],u[e],r[e]);return this}l(Y3,"addAll");d();function ld(r,t){if(isNaN(r=+r)||isNaN(t=+t))return this;var e=this._x0,i=this._y0,n=this._x1,o=this._y1;if(isNaN(e))n=(e=Math.floor(r))+1,o=(i=Math.floor(t))+1;else{for(var a=n-e||1,u=this._root,s,p;e>r||r>=n||i>t||t>=o;)switch(p=(t<i)<<1|r<e,s=new Array(4),s[p]=u,u=s,a*=2,p){case 0:n=e+a,o=i+a;break;case 1:e=n-a,o=i+a;break;case 2:n=e+a,i=o-a;break;case 3:e=n-a,i=o-a;break}this._root&&this._root.length&&(this._root=u)}return this._x0=e,this._y0=i,this._x1=n,this._y1=o,this}l(ld,"default");d();function ud(){var r=[];return this.visit(function(t){if(!t.length)do r.push(t.data);while(t=t.next)}),r}l(ud,"default");d();function cd(r){return arguments.length?this.cover(+r[0][0],+r[0][1]).cover(+r[1][0],+r[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}l(cd,"default");d();d();function _t(r,t,e,i,n){this.node=r,this.x0=t,this.y0=e,this.x1=i,this.y1=n}l(_t,"default");function pd(r,t,e){var i,n=this._x0,o=this._y0,a,u,s,p,f=this._x1,m=this._y1,y=[],x=this._root,S,M;for(x&&y.push(new _t(x,n,o,f,m)),e==null?e=1/0:(n=r-e,o=t-e,f=r+e,m=t+e,e*=e);S=y.pop();)if(!(!(x=S.node)||(a=S.x0)>f||(u=S.y0)>m||(s=S.x1)<n||(p=S.y1)<o))if(x.length){var g=(a+s)/2,C=(u+p)/2;y.push(new _t(x[3],g,C,s,p),new _t(x[2],a,C,g,p),new _t(x[1],g,u,s,C),new _t(x[0],a,u,g,C)),(M=(t>=C)<<1|r>=g)&&(S=y[y.length-1],y[y.length-1]=y[y.length-1-M],y[y.length-1-M]=S)}else{var I=r-+this._x.call(null,x.data),w=t-+this._y.call(null,x.data),T=I*I+w*w;if(T<e){var L=Math.sqrt(e=T);n=r-L,o=t-L,f=r+L,m=t+L,i=x.data}}return i}l(pd,"default");d();function hd(r){if(isNaN(f=+this._x.call(null,r))||isNaN(m=+this._y.call(null,r)))return this;var t,e=this._root,i,n,o,a=this._x0,u=this._y0,s=this._x1,p=this._y1,f,m,y,x,S,M,g,C;if(!e)return this;if(e.length)for(;;){if((S=f>=(y=(a+s)/2))?a=y:s=y,(M=m>=(x=(u+p)/2))?u=x:p=x,t=e,!(e=e[g=M<<1|S]))return this;if(!e.length)break;(t[g+1&3]||t[g+2&3]||t[g+3&3])&&(i=t,C=g)}for(;e.data!==r;)if(n=e,!(e=e.next))return this;return(o=e.next)&&delete e.next,n?(o?n.next=o:delete n.next,this):t?(o?t[g]=o:delete t[g],(e=t[0]||t[1]||t[2]||t[3])&&e===(t[3]||t[2]||t[1]||t[0])&&!e.length&&(i?i[C]=e:this._root=e),this):(this._root=o,this)}l(hd,"default");function j3(r){for(var t=0,e=r.length;t<e;++t)this.remove(r[t]);return this}l(j3,"removeAll");d();function dd(){return this._root}l(dd,"default");d();function fd(){var r=0;return this.visit(function(t){if(!t.length)do++r;while(t=t.next)}),r}l(fd,"default");d();function md(r){var t=[],e,i=this._root,n,o,a,u,s;for(i&&t.push(new _t(i,this._x0,this._y0,this._x1,this._y1));e=t.pop();)if(!r(i=e.node,o=e.x0,a=e.y0,u=e.x1,s=e.y1)&&i.length){var p=(o+u)/2,f=(a+s)/2;(n=i[3])&&t.push(new _t(n,p,f,u,s)),(n=i[2])&&t.push(new _t(n,o,f,p,s)),(n=i[1])&&t.push(new _t(n,p,a,u,f)),(n=i[0])&&t.push(new _t(n,o,a,p,f))}return this}l(md,"default");d();function yd(r){var t=[],e=[],i;for(this._root&&t.push(new _t(this._root,this._x0,this._y0,this._x1,this._y1));i=t.pop();){var n=i.node;if(n.length){var o,a=i.x0,u=i.y0,s=i.x1,p=i.y1,f=(a+s)/2,m=(u+p)/2;(o=n[0])&&t.push(new _t(o,a,u,f,m)),(o=n[1])&&t.push(new _t(o,f,u,s,m)),(o=n[2])&&t.push(new _t(o,a,m,f,p)),(o=n[3])&&t.push(new _t(o,f,m,s,p))}e.push(i)}for(;i=e.pop();)r(i.node,i.x0,i.y0,i.x1,i.y1);return this}l(yd,"default");d();function W3(r){return r[0]}l(W3,"defaultX");function gd(r){return arguments.length?(this._x=r,this):this._x}l(gd,"default");d();function Z3(r){return r[1]}l(Z3,"defaultY");function vd(r){return arguments.length?(this._y=r,this):this._y}l(vd,"default");function Ma(r,t,e){var i=new bd(t==null?W3:t,e==null?Z3:e,NaN,NaN,NaN,NaN);return r==null?i:i.addAll(r)}l(Ma,"quadtree");function bd(r,t,e,i,n,o){this._x=r,this._y=t,this._x0=e,this._y0=i,this._x1=n,this._y1=o,this._root=void 0}l(bd,"Quadtree");function U3(r){for(var t={data:r.data},e=t;r=r.next;)e=e.next={data:r.data};return t}l(U3,"leaf_copy");var qt=Ma.prototype=bd.prototype;qt.copy=function(){var r=new bd(this._x,this._y,this._x0,this._y0,this._x1,this._y1),t=this._root,e,i;if(!t)return r;if(!t.length)return r._root=U3(t),r;for(e=[{source:t,target:r._root=new Array(4)}];t=e.pop();)for(var n=0;n<4;++n)(i=t.source[n])&&(i.length?e.push({source:i,target:t.target[n]=new Array(4)}):t.target[n]=U3(i));return r};qt.add=sd;qt.addAll=Y3;qt.cover=ld;qt.data=ud;qt.extent=cd;qt.find=pd;qt.remove=hd;qt.removeAll=j3;qt.root=dd;qt.size=fd;qt.visit=md;qt.visitAfter=yd;qt.x=gd;qt.y=vd;d();d();var Cd=class Cd{origin;destination;distance;angle;weight;constructor({origin:t,destination:e,distance:i=0,angle:n=0,pathWeight:o=0}){this.origin=t,this.destination=e,this.distance=i,this.angle=n;let a=o||0;if(this.weight=a>=0?this.distance+a:0,isNaN(this.angle))throw new Error("nan angle")}};l(Cd,"Edge");var Vi=Cd;d();d();d();d();function Mr([r,t],[e,i]){let n=t-i,o=r-e;return(Math.atan2(o,n)+Math.PI*3)%(Math.PI*2)}l(Mr,"getAngle");d();var Y8=63710088e-1;function Hi(r,t){let[e,i]=r.map(f=>f*Math.PI/180),[n,o]=t.map(f=>f*Math.PI/180),a=o-i,u=n-e,s=Math.sin(a/2)*Math.sin(a/2)+Math.cos(i)*Math.cos(o)*Math.sin(u/2)*Math.sin(u/2),p=2*Math.atan2(Math.sqrt(s),Math.sqrt(1-s));return Y8*p}l(Hi,"getDistance");d();d();function su(r,t,e,i){let[n,o]=r,[a,u]=t,[s,p]=e,[f,m]=i;if(o===u&&n===a||p===m&&s===f)return null;let y=(f-s)*(u-o)-(m-p)*(a-n);if(y===0)return null;let x=((m-p)*(n-s)-(f-s)*(o-p))/y,S=((u-o)*(n-s)-(a-n)*(o-p))/y;if(x<0||x>1||S<0||S>1)return null;let M=o+x*(u-o);return[n+x*(a-n),M]}l(su,"getLineIntersection");d();function xd(r,t,e,i){let n=gi(r,e/1e3,i),o=gi(t,e/1e3,i);return[n.geometry.coordinates,o.geometry.coordinates]}l(xd,"getOffsetLine");d();function Sd(r){let t=r*(180/Math.PI);return t=t%360,t>180?t-=360:t<-180&&(t+=360),Object.is(t,-0)?0:t}l(Sd,"radToDegNormalized");function z3(r,t,e=[],i=0){let n=!0,o=r.geometry.coordinates,a=t.geometry.coordinates,u=Sd(Mr(o,a)-Math.PI/2),s=Sd(Mr(o,a)+Math.PI/2);return e.forEach(p=>{if(i>0){let f=xd(o,a,i,u),m=xd(o,a,i,s);if(su(f[0],f[1],p[0],p[1])||su(m[0],m[1],p[0],p[1])){n=!1;return}}else if(su(o,a,p[0],p[1])){n=!1;return}}),n}l(z3,"hasLineOfSight");var Md=class Md{edges;nodesById;nodesByGroup=new Map;constructor({nodes:t,groupBy:e}){this.edges={};let{features:i}=t;this.nodesById=i.reduce((n,o)=>(n[o.properties.id]=o,n),{});for(let n in this.nodesById)this.nodesById.hasOwnProperty(n)&&(this.nodesById[n].properties.neighbors=this.nodesById[n].properties.neighbors.filter(({id:o})=>!!this.nodesById[o]));i.forEach(n=>{let o=e==="default"?e:n.properties[e];this.nodesByGroup.has(o)||this.nodesByGroup.set(o,[]),this.nodesByGroup.get(o).push(n),this.edges[n.properties.id]=n.properties.neighbors.map(({id:a,weight:u})=>{let s=this.nodesById[a];return new Vi({origin:n,destination:s,distance:Hi(n.geometry.coordinates,s.geometry.coordinates),angle:Mr(n.geometry.coordinates,s.geometry.coordinates),pathWeight:u})})})}aStar({originIds:t,destinationNodeIds:e,excludedNodeIds:i}){let n=t.map(p=>this.nodesById[p]).filter(p=>p),o=e.map(p=>this.nodesById[p]).filter(p=>p);if(n.length===0||o.length===0)return[];let a=[],u={},s={};for(n.forEach(p=>{let f=this.getShortestEuclideanDistance(p,o);a.push({origin:p,priority:f}),u[p.properties.id]=null,s[p.properties.id]=0}),a.sort((p,f)=>p.priority-f.priority);a.length>0;){let p=a[0];if(o.includes(p.origin)){let f=[],m=u[p.origin.properties.id];for(;m!=null;){f.push(m);let y=u[m.origin.properties.id];y!=null?m=y:m=null}return f.reverse()}for(let f of this.edges[p.origin.properties.id]){if(i&&i.has(f.destination.properties.id))continue;let m=s[p.origin.properties.id]+f.weight;if(s[f.destination.properties.id]==null||m<s[f.destination.properties.id]){s[f.destination.properties.id]=m;let y=m+this.getShortestEuclideanDistance(f.destination,o);a.push({origin:f.destination,priority:y}),u[f.destination.properties.id]=f}}a.splice(0,1),a.sort((f,m)=>f.priority-m.priority)}return[]}getShortestEuclideanDistance(t,e){return e.reduce((i,n)=>{let o=Hi(t.geometry.coordinates,n.geometry.coordinates);return Math.min(i,o)},Number.MAX_VALUE)}};l(Md,"NavigationGraph");var lu=Md;var j8=.4,Pd=class Pd{groupBy;graph;geometryEdgesByMapId=new Map;cache={nodeTreesByGroup:new Map};constructor({nodes:t,obstructions:e,groupBy:i="default"}){this.groupBy=i,this.graph=new lu({nodes:t,groupBy:this.groupBy}),e&&e.features.forEach(n=>{let o=n.geometry.coordinates.length===1?n.geometry.coordinates[0]:n.geometry.coordinates,a=this.groupBy==="default"?this.groupBy:n.properties[this.groupBy];this.geometryEdgesByMapId.has(a)||this.geometryEdgesByMapId.set(a,[]),o.forEach((u,s)=>{this.geometryEdgesByMapId.get(a).push([u,o[s+1]||o[0]])})})}findNearestNode=t=>{var n;let e=this.groupBy==="default"?this.groupBy:t.properties[this.groupBy];if(!this.cache.nodeTreesByGroup.has(e)){let o=(n=this.graph.nodesByGroup.get(e))!=null?n:[],a=Ma();a.x(u=>u.geometry.coordinates[1]),a.y(u=>u.geometry.coordinates[0]),a.addAll(o),this.cache.nodeTreesByGroup.set(e,a)}return this.cache.nodeTreesByGroup.get(e).find(t.geometry.coordinates[1],t.geometry.coordinates[0])||null};getDirections({originIds:t,destinationNodeIds:e,excludedNodeIds:i,simplify:n}){var u,s;let o=(u=n==null?void 0:n.enabled)!=null?u:!0,a=this.graph.aStar({originIds:t,destinationNodeIds:e,excludedNodeIds:new Set(i)});return a.length===0?{type:"FeatureCollection",features:[]}:(o&&(a=this.simplifyAllSteps(a,(s=n==null?void 0:n.bufferRadius)!=null?s:j8)),this.generatePath(a))}generatePath=t=>{let{destination:e}=t[t.length-1],i={type:"FeatureCollection",features:[]};for(let o=0;o<t.length;o++){let{origin:a}=t[o],u={id:a.properties.id,angle:t[o].angle,distance:t[o].distance};this.groupBy!=="default"&&(u.groupBy=a.properties[this.groupBy]),i.features.push({type:"Feature",geometry:{type:"Point",coordinates:[a.geometry.coordinates[0],a.geometry.coordinates[1]]},properties:u})}let n={id:e.properties.id};return this.groupBy!=="default"&&(n.groupBy=e.properties[this.groupBy]),i.features.push({type:"Feature",geometry:{type:"Point",coordinates:[e.geometry.coordinates[0],e.geometry.coordinates[1]]},properties:n}),i};simplifyAllSteps(t,e){var s,p;let i=[],n=[t[0]];for(let f=1;f<t.length;f++){if(this.groupBy!=="default"&&t[f].origin.properties[this.groupBy]!==t[f-1].origin.properties[this.groupBy]){let m=t[f-1].origin.properties[this.groupBy],y=(s=this.geometryEdgesByMapId.get(m))!=null?s:[];i.push(...this.simplifySteps(n,y,e)),n=[t[f]]}n.push(t[f])}let o=t[t.length-1],a=this.groupBy==="default"?this.groupBy:o.origin.properties[this.groupBy],u=(p=this.geometryEdgesByMapId.get(a))!=null?p:[];return i.push(...this.simplifySteps(n,u,e)),i}simplifySteps(t,e,i){if(t.length<3)return t;let n=[t[0]],o=1;for(let a=o+2;a<t.length;a++)if(!z3(t[o].origin,t[a].origin,e,i)){let u=a-1;n.push(new Vi({...t[o],destination:t[u].origin,distance:Hi(t[o].origin.geometry.coordinates,t[u].origin.geometry.coordinates),angle:Mr(t[o].origin.geometry.coordinates,t[u].origin.geometry.coordinates)})),o=u}return n.push(new Vi({...t[o],destination:t[t.length-1].origin,distance:Hi(t[o].origin.geometry.coordinates,t[t.length-1].origin.geometry.coordinates),angle:Mr(t[o].origin.geometry.coordinates,t[t.length-1].origin.geometry.coordinates)}),t[t.length-1]),n}getDistance=(t,e)=>Hi(t,e);getAngle=(t,e)=>Mr(t,e)};l(Pd,"Navigator");var Pa=Pd;d();function ri(r){return[r.longitude,r.latitude]}l(ri,"convertCoordinateToPosition");function W8(r){return new Map(r.map(t=>{let{properties:e}=t,{id:i}=e;return[i,t]}))}l(W8,"getEntranceMap");var Td=l((r,t)=>{let e=W8(t),i={type:"Feature",properties:{id:r[0].properties.id},geometry:{type:"MultiLineString",coordinates:[]}};for(let n of r){let o=[n.geometry.coordinates],a=(n.properties.entrances||[]).reduce((u,s)=>(e.has(s)&&u.push(e.get(s)),u),[]);a.length&&(o=Dh(n,a).map(u=>u.geometry.coordinates)),i.geometry.coordinates.push(...o)}return i},"cutEntrancesFromLineStrings");function q3(r,t){let e={options:{}};if(!e.options)throw new Error("options should exist");return r.appearance&&(e.options.appearance=r.appearance),r.rank!=null&&(r.rank==="initial"?e.options.rank=t.initialRank||2:e.options.rank=r.rank),r.enabled!==void 0&&(e.enabled=r.enabled),r.interactive!==null&&(e.options.interactive=r.interactive),e}l(q3,"translateLabelStateToGeojsonCore");function $3(r,t){let e={options:{}};if(!e.options)throw new Error("options should exist");return r.rank!=null&&(r.rank==="initial"?e.options.rank=t.initialRank||2:e.options.rank=r.rank),r.enabled!==void 0&&(e.enabled=r.enabled),r.interactive!==null&&(e.options.interactive=r.interactive),e}l($3,"translateMarkerStateToGeojsonCore");function J3(r,t){let e={};return t==null||(r.color&&(r.color==="initial"?e.color=t.initialColor:e.color=r.color),r.hoverColor&&(e.hoverColor=r.hoverColor),r.interactive!==void 0&&(e.interactive=r.interactive),r.visible!==void 0&&(e.visible=r.visible)),e}l(J3,"translateSpaceStateToGeojsonCore");function K3(r,t){return((t-r+Math.PI)%(Math.PI*2)+Math.PI*2)%(Math.PI*2)-Math.PI}l(K3,"differenceBetweenAngles");function Q3(r,t){let e="Left";return r<=-Math.PI/4?e="Right":r<=-t?e="SlightRight":r<=t?e="Straight":r<=Math.PI/4?e="SlightLeft":e="Left",e}l(Q3,"getRelativeBearing");function tv(r){let t={};for(let e in r){let i=r[e];if(i!=null){if(i.id=e,"polygons"in i)for(let n of i.polygons)t[n]=i;else if("lineStrings"in i)for(let n of i.lineStrings)t[n]=i;else if("points"in i)for(let n of i.points)t[n]=i}}return t}l(tv,"extractStyleMap");function wd(r,t){return r.reduce((e,i)=>{let n=t[i.properties.id];return n==null||(e.has(n)||e.set(n,[]),e.get(n).push(i)),e},new Map)}l(wd,"groupGeometryByStyle");function Ta(r,t={}){var n,o,a,u,s,p;let e={...r},i=(o=(n=t==null?void 0:t.style)==null?void 0:n.shading)!=null?o:t==null?void 0:t.shadingAndOutlines;if(i===!0?e.shading={start:.1,end:.15,intensity:.4}:typeof i=="object"&&(e.shading={start:i.start,end:i.end,intensity:i.intensity}),e.outline=(u=(a=t==null?void 0:t.style)==null?void 0:a.outlines)!=null?u:t==null?void 0:t.shadingAndOutlines,"lineStrings"in r){let f=(p=(s=t==null?void 0:t.style)==null?void 0:s.wallTopColor)!=null?p:t==null?void 0:t.wallTopColor;f!=null&&(e.topColor=f)}return e}l(Ta,"translateToCoreStyle");var ev=Math.PI*.1,$t,Je,ye,pu,rv,wa,Id,hu,iv,Ed=class Ed{constructor(t,e){P(this,pu);P(this,wa);P(this,hu);P(this,$t,{});P(this,Je,void 0);P(this,ye,void 0);E(this,Je,e),E(this,ye,t.features),E(this,Je,e),E(this,ye,t.features)}get coordinates(){return c(this,$t).coordinates?c(this,$t).coordinates:(c(this,$t).coordinates=c(this,ye).map(t=>new K(t.geometry.coordinates[1],t.geometry.coordinates[0],t.properties.groupBy)),c(this,$t).coordinates)}get distance(){return c(this,$t).distance?c(this,$t).distance:(c(this,$t).distance=c(this,ye).reduce((t,e)=>t+(e.properties.distance||0),0),c(this,$t).distance)}get instructions(){if(c(this,ye).length<2)return[];if(c(this,$t).instructions)return c(this,$t).instructions;let t=[],e=0;for(let i=0;i<c(this,ye).length;i++){let n=c(this,ye)[i],o=c(this,ye)[i-1],a=c(this,ye)[i+1],u=new K(n.geometry.coordinates[1],n.geometry.coordinates[0],n.properties.groupBy),s=W(this,pu,rv).call(this,{prevDirection:o,direction:n,nextDirection:a});e+=(o==null?void 0:o.properties.distance)||0;for(let p of s)p&&(t.push({action:p,distance:e,coordinate:u}),e=0)}return c(this,$t).instructions=t,c(this,$t).instructions}};$t=new WeakMap,Je=new WeakMap,ye=new WeakMap,pu=new WeakSet,rv=l(function(t){let{prevDirection:e,direction:i,nextDirection:n}=t,o=e&&c(this,Je).getById("floor",e.properties.groupBy),a=c(this,Je).getById("floor",i.properties.groupBy),u=n&&c(this,Je).getById("floor",n.properties.groupBy),s=[];if(e||s.push({type:"Departure"}),u&&a.id!==u.id){let p=c(this,Je).getMVFFeatureByNodeId("connection",i.properties.id);s.push(W(this,wa,Id).call(this,"TakeConnection",a,u,p==null?void 0:p.type))}else if(o&&o.id!==a.id){let p=c(this,Je).getMVFFeatureByNodeId("connection",i.properties.id);s.push(W(this,wa,Id).call(this,"ExitConnection",a,o,p==null?void 0:p.type))}else s.push(W(this,hu,iv).call(this,e,i));return n||s.push({type:"Arrival"}),s},"#getActions"),wa=new WeakSet,Id=l(function(t,e,i,n){let o=e.elevation-i.elevation,a="none";return o>0?a="down":o<0&&(a="up"),{type:t,fromFloor:e,toFloor:i,direction:a,connectionType:n!=null?n:"stairs"}},"#createConnectionAction"),hu=new WeakSet,iv=l(function(t,e){let i=t?-K3(t.properties.angle,e.properties.angle):0;return Math.abs(i)>=ev?{type:"Turn",bearing:Q3(i,ev),referencePosition:"At"}:null},"#createTurnAction"),l(Ed,"Directions");var uu=Ed,Ld=class Ld{navigator;connections;constructor({nodes:t,obstructions:e,connections:i,groupBy:n}){this.navigator=new Pa({nodes:t,obstructions:this.createObstructionCollection(e),groupBy:n}),this.connections=i}getDirections=(t,e,i,n)=>{let{accessible:o,smoothing:{enabled:a,radius:u}}=i,s=t.flatMap(x=>this.getNodesFromTarget(x,n)),p=e.flatMap(x=>this.getNodesFromTarget(x,n)),f=this.getExcludedNodeIds(o).filter(x=>!s.includes(x)&&!p.includes(x)),m=this.navigator.getDirections({originIds:s,destinationNodeIds:p,excludedNodeIds:f,simplify:{enabled:a,bufferRadius:u}});this.addCoordinateDirections(m,t,e);let y=new uu(m,n);if(!(y.distance===0&&new Set([...s,...p]).size===s.length+p.length))return y};getExcludedNodeIds=t=>t?this.connections.reduce((e,i)=>i.accessible?e:e.concat(i.nodes),[]):[];addCoordinateDirections=(t,[e],[i])=>{if(t.features.length){if(K.is(e)){let n=this.createDirectionFeature(e,this.navigator.getAngle([e.longitude,e.latitude],t.features[0].geometry.coordinates),this.navigator.getDistance([e.longitude,e.latitude],t.features[0].geometry.coordinates));t.features.splice(0,0,n)}if(K.is(i)){let n=this.createDirectionFeature(i,0,0),o=t.features[t.features.length-1];o.properties.distance=this.navigator.getDistance(o.geometry.coordinates,[i.longitude,i.latitude]),o.properties.angle=this.navigator.getAngle(o.geometry.coordinates,[i.longitude,i.latitude]),t.features.push(n)}}};getNodesFromTarget=(t,e)=>{if(K.is(t)){let i=this.navigator.findNearestNode(this.createCoordinateFeature(t));return i?[i.properties.id]:[]}else if(zr.is(t)){let i=this.navigator.findNearestNode(this.createCoordinateFeature(t.coordinate));return i?[i.properties.id]:[]}else if(Zr.is(t)){let i=this.navigator.findNearestNode(this.createCoordinateFeature(t.center));return i?[i.properties.id]:[]}else if(_e.is(t)){let i=e==null?void 0:e.getMVFFeatureById("space",t.id);return i==null?[]:i.properties.destinationNodes}else{if(qr.is(t))return t.coordinates.reduce((i,n)=>{let o=this.navigator.findNearestNode(this.createCoordinateFeature(n));return o&&i.push(o.properties.id),i},[]);if(De.is(t)){let i=e==null?void 0:e.objectEntranceNodeIdsByObstructionId[t.id];return i!=null?i:[]}else return[]}};createObstructionCollection(t){return{type:"FeatureCollection",features:Object.entries(t).reduce((e,[i,n])=>e.concat(n.features.map(o=>(o.properties.map=i,o))),[])}}createCoordinateFeature=t=>({type:"Feature",geometry:{type:"Point",coordinates:[t.longitude,t.latitude]},properties:{map:t.floorId}});createDirectionFeature=(t,e,i)=>({type:"Feature",geometry:{type:"Point",coordinates:[t.longitude,t.latitude]},properties:{groupBy:t.floorId,id:t.id,angle:e,distance:i}})};l(Ld,"DirectionsInternal");var cu=Ld;d();var Jn,_d=class _d{constructor({currentMapGetter:t}){P(this,Jn,void 0);E(this,Jn,t)}get currentMap(){return c(this,Jn).call(this)}async getCurrentSceneGLTF(t){let e=c(this,Jn).call(this);return e?e==null?void 0:e.Exporter.getCurrentSceneGLTF(t):(G.error("There is no map to export. Please load a map first."),new Blob)}};Jn=new WeakMap,l(_d,"Exporter");var Ia=_d;d();var Ke,La,Dd=class Dd{constructor({currentMapGetter:t}){P(this,Ke,new Map);P(this,La,void 0);E(this,La,t)}get currentMap(){return c(this,La).call(this)}getById(t){return c(this,Ke).get(t)}add(t,e,i){let n=$e(t);if(!n)throw new Error("get coordinate failed");let o=this.currentMap;if(!o)throw new Error("currentMap should exist");let a=o.Labels.add(ri(n),e,{...i,floorId:n.floorId,rank:(i==null?void 0:i.rank)||"medium"}),u=new Qr(a.id.toString(),e);return c(this,Ke).set(u.id,{label:u,entityId:u.id}),u}all(){var e;let t=[];return(e=this.currentMap)==null||e.Labels.all({onCreate:(i,n)=>{let o=new Qr(i.toString(),n);c(this,Ke).set(o.id,{label:o,entityId:o.id}),t.push(o)}}),t}remove(t){var i;let e=c(this,Ke).get(t.id);e&&((i=this.currentMap)==null||i.Labels.remove(e.entityId),c(this,Ke).delete(t.id.toString()))}removeAll(){let t=[];return c(this,Ke).forEach(({label:e})=>{this.remove(e),t.push(e),c(this,Ke).delete(e.id.toString())}),t}};Ke=new WeakMap,La=new WeakMap,l(Dd,"Labels");var Ea=Dd;d();d();d();var _a={auto:!0,debug:!1,pitch:45,bearing:0,antialiasing:{enabled:!0},shadingAndOutlines:!0,outdoorView:{layersHiddenByGeometry:["building","building-top"]}},Xi="ExteriorWalls",du="Walls";var nv={altitude:0,height:1,color:"#ffffff",opacity:1,width:.15},Od=class Od{id;name;elevation;containerId;loaded=!1;styleMap={};obstructions;entrances;spaces;renderer;options;layers=new Map;constructor(t,e,i,n,o,a){this.id=e.id,this.options=n;let u=i.addGroupContainer(this.id,{visible:!1,interactive:!0},t);this.containerId=u.id.toString(),this.name=e.externalId,this.elevation=e.elevation,o!=null&&a!=null&&(this.styleMap=a,this.spaces=o.space[this.id],this.entrances=o.entrance[this.id],this.obstructions=o.obstruction[this.id]),this.renderer=i}load=()=>{var t,e;if(this.loaded||this.obstructions==null&&this.spaces==null)return this;if(this.loaded=!0,this.spaces!=null&&this.spaces.features.length>0){let i=this.spaces.features.filter(u=>{var s;return u.geometry.type==="Polygon"&&((s=u.properties.kind)==null?void 0:s.toLowerCase())!=="void"}),n=wd(i,this.styleMap),o=this.renderer.addGroupContainer(`spaces-${this.id}`,{},this.id),a=0;for(let[u,s]of n){let p=this.renderer.addGeometryGroup(`Spaces-${this.id}-${a}`,{features:s},Ta(u,this.options),o);a++;let f=p.id.toString();this.layers.set(u.id||f,p.id.toString())}}if(this.obstructions!=null&&this.obstructions.features.length>0){let i=this.obstructions.features.filter(y=>y.geometry.type==="Polygon"&&y.properties.kind==="object"),n=wd(i,this.styleMap),o=this.renderer.addGroupContainer(`objects-${this.id}`,{},this.id),a=0;for(let[y,x]of n){let S=this.renderer.addGeometryGroup(`Objects-${this.id}-${a}`,{features:x},Ta(y,this.options),o);a++;let M=S.id.toString();this.layers.set(y.id||M,M)}let u=this.obstructions.features.filter(y=>y.geometry.type==="LineString"&&y.properties.kind==="Wall"&&y.properties.footprintComponent===!1),s=this.obstructions.features.filter(y=>y.geometry.type==="LineString"&&y.properties.kind==="Wall"&&y.properties.footprintComponent===!0),p=this.entrances,f=nv,m=nv;if(u!=null&&u.length>0){let y=this.styleMap[(t=u[0].properties)==null?void 0:t.id];y!=null&&(f={...y}),m=f;let x=this.renderer.addGeometryGroup(`Walls-${this.id}`,{features:[Td(u,(p==null?void 0:p.features)||[])]},Ta(f,this.options),this.id),S=x.id.toString();this.layers.set(f.id||S,x.id.toString())}if(s!=null&&s.length>0){let y=this.styleMap[(e=s[0].properties)==null?void 0:e.id];y!=null&&(m={...y,id:Xi});let x=this.renderer.addGeometryGroup(`ExteriorWalls-${this.id}`,{features:[Td(s,(p==null?void 0:p.features)||[])]},Ta(m,this.options),this.id),S=x.id.toString();this.layers.set(m.id||S,x.id.toString())}}return this.renderer.render(),this}};l(Od,"FloorObject");var fu=Od;var cn=Ar(Kn());d();d();d();d();(function(){typeof globalThis!="object"&&(Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__)})();d();d();d();var Z8="#ffffff",ii,Rd=class Rd{constructor(t={}){v(this,"color",Z8);v(this,"topColor");v(this,"opacity",1);P(this,ii,void 0);v(this,"outline",!0);var e,i;this.color=(e=t==null?void 0:t.color)!=null?e:this.color,this.topColor=t==null?void 0:t.topColor,this.opacity=(i=t==null?void 0:t.opacity)!=null?i:this.opacity,this.shading=t==null?void 0:t.shading,this.outline=(t==null?void 0:t.outline)!==void 0?!!t.outline:this.outline}get shading(){return c(this,ii)}set shading(t){var e;if(!t){E(this,ii,void 0);return}E(this,ii,(e=c(this,ii))!=null?e:{start:0,end:0,intensity:0}),Object.assign(c(this,ii),t)}};ii=new WeakMap,l(Rd,"GeometryGroupStyleComponent");var Yi=Rd;var Bd=class Bd extends we{visible=!0;type="geometry-group";components;userData={entityId:"",entities3D:new Set,opacity:1,dirty:!0,outlineDirty:!0,shadingDirty:!0};setVisible(t){this.visible=t,this.dispatchEvent({type:"childremoved",child:this})}getOpacity(){return this.userData.opacity}setOpacity(t){this.userData.opacity=t}removeEntity(){this.dispatchEvent({type:"childremoved",child:this})}constructor(t,e=new Yi){super(),this.components=[e],this.userData.entityId=t}};l(Bd,"GeometryGroupObject3D");var Bt=Bd;d();var Fd=class Fd extends we{};l(Fd,"Geometry2DObject3D");var Qn=Fd,Gd=class Gd{id;get type(){return this.components[0].type}get parent(){return this.object3d.parent}positionDirty=!0;object3d=new Qn;components;disposed=!1;constructor(t,e){this.id=t.id||ut(),this.components=[t],this.object3d=new Qn,this.object3d.position.copy(e),this.object3d.userData.entityId=this.id,this.object3d.userData.type=this.type}worldPosition=new j;get position(){return this.object3d.getWorldPosition(this.worldPosition),this.worldPosition}};l(Gd,"Geometry2D");var ge=Gd;d();var Vd=class Vd extends we{userData={entityId:"",type:"geometry"}};l(Vd,"Geometry3DObject3D");var Qe=Vd,Hd=class Hd{id=ut();components;get object3d(){return this.components[0].mesh}get parent(){var t;return(t=this.components[0].mesh)==null?void 0:t.parent}get type(){return this.components[0].type}constructor(t,e){this.components=[t,e]}};l(Hd,"Geometry3D");var dt=Hd;var Da=class Da extends we{childrenIds=new Set;type="group-container";userData={entityId:"",entities2D:new Set,dirty:!0};components=[];constructor(t){super(),this.userData.entityId=t}addEntity(t){t instanceof Da?(this.childrenIds.add(t.userData.entityId),this.add(t)):t instanceof ge?(this.childrenIds.add(t.id),this.add(t.object3d),this.userData.entities2D.add(t.id)):t instanceof Bt?(this.childrenIds.add(t.userData.entityId),this.add(t)):t instanceof dt&&t.object3d&&(this.childrenIds.add(t.id),this.add(t.object3d)),this.dispatchEvent({type:"childadded",child:this})}removeEntity(t){t instanceof Da?(this.childrenIds.delete(t.userData.entityId),this.remove(t)):t instanceof ge?(this.childrenIds.delete(t.id),this.userData.entities2D.delete(t.id),this.remove(t.object3d)):t instanceof Bt?(this.childrenIds.delete(t.userData.entityId),this.remove(t)):t instanceof dt&&t.object3d&&(this.childrenIds.delete(t.id),this.add(t.object3d)),this.dispatchEvent({type:"childremoved",child:this})}setVisible(t){this.visible=t,this.dispatchEvent({type:"childremoved",child:this})}setAltitude(t){this.position.z=t,this.dispatchEvent({type:"childremoved",child:this})}get altitude(){return this.position.z}};l(Da,"GroupContainerObject3D");var Pt=Da;d();var ov=!1;function av(){ov=!0}l(av,"enableTestMode");var Xd=class Xd{backgroundAlpha=1;backgroundColor=new wt;width=0;height=0;options={};renderer;constructor(t,e=2){try{this.options=t;let i={canvas:t.canvas,alpha:t.alpha||!1,stencil:!1,antialias:typeof t.antialias=="boolean"?t.antialias:!0,outputColorSpace:mi,powerPreference:"high-performance",preserveDrawingBuffer:!0};ov?(this.renderer={setSize:()=>{},state:{reset:()=>{}},properties:{get:()=>{}},getSize:()=>({width:window.innerWidth,height:innerHeight}),getDrawingBufferSize:()=>({width:window.innerWidth,height:innerHeight}),getClearAlpha:()=>1,getClearColor:()=>new wt,autoUpdate:!0,shadowMap:{autoUpdate:!0},getContext:()=>({getContextAttributes(){return{alpha:!0,antialias:!1,depth:!0,stencil:!1}}}),setRenderTarget:()=>{},setClearColor:()=>{},clear:()=>{},render:()=>{},domElement:document.createElement("canvas"),capabilities:{isWebGL2:!0}},this.renderer.domElement.style.width="1920px",Object.defineProperty(this.renderer.domElement,"clientWidth",{value:1920}),this.renderer.domElement.style.height="1080px",Object.defineProperty(this.renderer.domElement,"clientHeight",{value:1080})):this.renderer=e===2?new e1(i):new r1(i),this.backgroundColor=new wt,this.backgroundAlpha=1}catch(i){G.error(i),t.onWebGLRendererError&&t.onWebGLRendererError(i)}}destroy(){var t,e;this.renderer&&((e=(t=this.renderer).dispose)==null||e.call(t))}render(t,e){this.renderer&&(this.renderer.state.reset(),e.layers.enable(0),e.layers.enable(1),this.renderer.autoClear=!1,this.renderer.setRenderTarget(null),this.renderer.render(t,e),this.renderer.state.reset())}clear(){this.renderer&&(this.renderer.setClearColor(this.backgroundColor,this.backgroundAlpha),this.renderer.clear())}setBufferSize(t,e){b.env.NODE_ENV==="test"||!this.renderer||(this.width=t,this.height=e,this.renderer.setSize(t,e,!1))}setBackgroundColor(t,e){this.backgroundColor=t,this.backgroundAlpha=e}domElement(){var t;return(t=this.renderer)==null?void 0:t.domElement}};l(Xd,"Renderer");var mu=Xd;d();d();var ni=63710088e-1,sv=-85.051129,lv=85.051129,yu=1e4,Yd={chain:"chain",cancel:"cancel"},jd=Math.PI*2,Oa=100,uv=1e4,Wd=0,Zd=22;var Ud=["change","pan-start","pan-end","rotate-start","rotate-end","zoom-start","zoom-end","multi-start","multi-end","multi-cancel","pedestal-start","pedestal-change","pedestal-end","user-pan-start","user-pedestal-start","user-rotate-start","user-dolly-start","user-zoom-start","user-tilt-start","user-pan-end","user-pedestal-end","user-rotate-end","user-dolly-end","user-zoom-end","user-tilt-end","position-updated","zoom-updated","tilt-updated","rotation-updated"];d();var Aa="mappedin";d();function oi(){return typeof window>"u"?1:Math.min(window.devicePixelRatio,2)}l(oi,"getPixelRatio");d();var U8=(()=>{let r;return{getDeviceType(){if(r)return r;let{userAgent:t,platform:e,maxTouchPoints:i}=window.navigator,n=/(iphone|ipod|ipad)/i.test(t),o=e==="iPad"||e.indexOf("Mac")===0&&i>0&&!window.MSStream,a=/android/i.test(t);return r={isIpad:o,isMobile:a||n||o,isSafari12:/Version\/12.+Safari/.test(t),isFirefox:/Firefox/.test(t),isWindows:/windows/i.test(t)},r},_reset(){r=void 0}}})(),pv=U8.getDeviceType,hv=(()=>{let r,t,e;function i(){if(t!==void 0)return t;r||(r=document.createElement("canvas"));let o=r.getContext("webgl")||r.getContext("experimental-webgl");if(!o)return t;try{let a=pv().isFirefox?null:o.getExtension("WEBGL_debug_renderer_info");return t=a?o.getParameter(a.UNMASKED_RENDERER_WEBGL):o.getParameter(o.RENDERER),t}catch{let u=new Error("Failed getting device info");throw u.name="FailedGettingDeviceInfo",u}}l(i,"getInfo");function n(){var a,u;if(!pv().isWindows)return!1;if(e!==void 0)return e;let o=(u=(a=z8())==null?void 0:a.toLowerCase())!=null?u:"";return e=o.includes("intel")&&(o.includes("uhd")||o.includes("iris")),e}return l(n,"shouldDisableOffscreenCanvas"),{getInfo:i,shouldDisableOffscreenCanvas:n,_setCanvas(o){r=o,t=void 0,e=void 0}}})(),z8=hv.getInfo,zd=hv.shouldDisableOffscreenCanvas;d();function gu(r,t,e,i){let n=r*(Math.PI/180),o=i/ni,a=r+o*180/Math.PI,u=e/ni/Math.cos(n),s=t+u*180/Math.PI;return{lat:a,lon:s}}l(gu,"cartesianToGeographic");function vu(r,t,e,i){let n=e*(Math.PI/180),o=i*(Math.PI/180),a=r*(Math.PI/180),u=t*(Math.PI/180),s=n-a,p=o-u,f=ni*p*Math.cos(a),m=ni*s;return{x:f,y:m}}l(vu,"geographicToCartesian");var qd=l((r,t=[])=>{var e;if(r.children&&r.visible)for(let i of r.children){if(i.visible)if((e=i.userData)!=null&&e.entities3D&&i.type==="geometry-group"){t.push(i.userData.entityId);for(let n of i.userData.entities3D.values())t.push(n)}else(i.type==="group-container"||i.type==="custom-geometry"||i instanceof Qe)&&t.push(i.userData.entityId);qd(i,t)}return t},"extract3DEntitiesFromTree"),$d=l((r,t)=>{var e;if(r.children&&r.visible&&!((e=r.userData)!=null&&e.hidden))for(let i of r.children)i.visible&&i instanceof Qn&&t.add(i.userData.entityId),$d(i,t);return t},"extractEntitiesFromTree");function Jd(r,t){for(let e in t){if(t[e]==null){r[e]=void 0;continue}typeof t[e]=="object"?Jd(r[e],t[e]):r[e]=t[e]}return r}l(Jd,"mergeObjects");function bu(r,t,e,i){let n={translateX:r.x,translateY:r.y,translateZ:r.z,scale:r.meterInMercatorCoordinateUnits()},o=new pr,a=new j(n.scale,-n.scale,n.scale),u=new pr().makeTranslation(n.translateX,n.translateY,n.translateZ).scale(a);return{id:Aa,type:"custom",renderingMode:"3d",render:(s,p)=>{if(o.fromArray(p),e.elevation>0){let f=zs.fromLngLat(r.toLngLat(),e.elevation);u.makeTranslation(n.translateX,n.translateY,-f.z).scale(a)}t.projectionMatrix=o.multiply(u),i()}}}l(bu,"createCustomLayer");function q8(r){return fetch(r,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({grant_type:"client_credentials"})})}l(q8,"fetchToken");async function dv(r){let t=await q8(r),{access_token:e}=await t.json();return{"x-mappedin-tiles-key":e}}l(dv,"getRequestHeaders");function fv(r,t=0){let e=3735928559^t,i=1103547991^t;for(let n=0,o;n<r.length;n++)o=r.charCodeAt(n),e=Math.imul(e^o,2654435761),i=Math.imul(i^o,1597334677);return e=Math.imul(e^e>>>16,2246822507)^Math.imul(i^i>>>13,3266489909),i=Math.imul(i^i>>>16,2246822507)^Math.imul(e^e>>>13,3266489909),4294967296*(2097151&i)+(e>>>0)}l(fv,"cyrb53");var $8=l(r=>r,"linearEase");function pe(r,t,e,i,n,o=$8){r=Math.max(t,Math.min(r,e));let a=(r-Math.min(t,e))/Math.abs(e-t),u=o(a);return i+u*(n-i)}l(pe,"interpolate");function Kd(r,t,e){let i=r*(Math.PI/180)/2,n=t/2;return e*Math.tan(i)/n}l(Kd,"getProjectionScaleFactor");function ka(r,t){let e;return typeof t=="string"||typeof t=="number"?(e=r.entity2DMap.get(t),e==null&&(e=r.entity3DMap.get(t))):typeof(t==null?void 0:t.id)=="string"||typeof(t==null?void 0:t.id)=="number"?(e=r.entity2DMap.get(t.id),e==null&&(e=r.entity3DMap.get(t.id))):e=t,e}l(ka,"getGeometryByGeometryId");function mv(r){return new p1(new Dc(r[0][0],r[0][1]),new Dc(r[1][0],r[1][1])).getCenter().toArray()}l(mv,"getBoundingBoxCenter");d();d();var yv=`"use strict";(()=>{function _(n,e){return e.x+e.w<n.x+n.w&&e.x>n.x&&e.y>n.y&&e.y+e.h<n.y+n.h}function A(n,e){let[t,o]=e;return t>=n.x&&t<=n.x+n.w&&o>=n.y&&o<=n.y+n.h}function j(n,e){let t=e.x,o=e.y,i=e.x+e.w,l=e.y+e.h,c=n.x,f=n.y,k=n.x+n.w,P=n.y+n.h;return t<k&&c<i&&o<P&&f<l}function a(n,e){for(let t=0;t<e.length;t++)n.push(e[t])}var w=4,s=class{x;y;w;h;userData;constructor(e,t,o,i,l){let c=typeof window>"u"?2:window.devicePixelRatio;this.userData=typeof l>"u"?null:l,this.x=e-w,this.y=t-w,this.w=o+w*Math.min(c,2),this.h=i+w*Math.min(c,2)}contains(e){return e===this?!1:_(this,e)}intersects(e){return j(this,e)}intersectsPoint(e){return A(this,e)}draw(e){e.fillStyle="rgba(123,222,26, 0.5)",e.fillRect(this.x,this.y,this.w,this.h)}};var x=class n{topLeft;topRight;bottomLeft;bottomRight;divided=!1;boundary;capacity=16;objects=[];parent;constructor(e,t){this.parent=t,this.boundary=e}getSize(){return this.divided?this.objects.length+this.topLeft.getSize()+this.topRight.getSize()+this.bottomLeft.getSize()+this.bottomRight.getSize():this.objects.length}subdivide(){let{x:e,y:t,w:o,h:i}=this.boundary;this.topLeft=new n(new s(e,t,o/2,i/2),this),this.topRight=new n(new s(e+o/2,t,o/2,i/2),this),this.bottomLeft=new n(new s(e,t+i/2,o/2,i/2),this),this.bottomRight=new n(new s(e+o/2,t+i/2,o/2,i/2),this),this.divided=!0}queryRect(e){let t=[];if(this.boundary.intersects(e))t.push(...this.objects);else return[];return this.divided&&(a(t,this.topLeft.queryRect(e)),a(t,this.topRight.queryRect(e)),a(t,this.bottomLeft.queryRect(e)),a(t,this.bottomRight.queryRect(e))),t}queryPoint(e){let t=[];if(this.boundary.intersectsPoint(e))t.push(...this.objects);else return[];return this.divided&&(a(t,this.topLeft.queryPoint(e)),a(t,this.topRight.queryPoint(e)),a(t,this.bottomLeft.queryPoint(e)),a(t,this.bottomRight.queryPoint(e))),t}insert(e){return this.boundary.contains(e)?this.objects.length<this.capacity?(this.objects.push(e),!0):(this.divided||this.subdivide(),(this.topLeft.insert(e)||this.topRight.insert(e)||this.bottomLeft.insert(e)||this.bottomRight.insert(e))===!1&&this.objects.push(e),!0):!1}drawObjects(e){this.objects.forEach(t=>t.draw(e)),this.divided&&(this.topLeft.drawObjects(e),this.topRight.drawObjects(e),this.bottomLeft.drawObjects(e),this.bottomRight.drawObjects(e))}draw(e){e.rect(this.boundary.x,this.boundary.y,this.boundary.w,this.boundary.h),this.divided&&(this.topLeft.draw(e),this.topRight.draw(e),this.bottomLeft.draw(e),this.bottomRight.draw(e)),e.strokeStyle="black",e.lineWidth=4,e.stroke()}};var d=200,I=10;function q(n,e,t,o="-1"){let i=1/0,l=1/0,c=-1/0,f=-1/0,k=new s(-I,0,5,t),P=new s(-I,0,e,5),X=new s(e-5,0,e+I,t),O=new s(0,t-5,e,t+I),K=[k,P,X,O],N=new s(-d,-d,e+d*2,t+d*2);for(let r of n)for(let b=0;b<r.bboxes.length;b++){let{boundingBox:R}=r.bboxes[b],[h,T,u,p]=R,[S,m,B,W]=[r.y-h,r.y+T,r.x-u,r.x+p],L=B,v=S,E=W-B,M=m-S;i=Math.min(i,L)-d,l=Math.min(l,v)-d,c=Math.max(c,L+E)+d,f=Math.max(f,v+M)+d,r.bboxes[b].boundingRect=new s(L,v,E,M)}let g={msgId:o,colliders:new Array(n.length),debug:[]},C=new x(new s(i,l,c-i,f-l)),y;for(let r=0;r<n.length;r++)if(y=n[r],g.colliders[r]=[-1,!1],y.enabled){let[b,R,h]=[1/0,-1,void 0];for(let{index:T,boundingRect:u}of y.bboxes){let p=[];if(p=C.queryRect(u).filter(m=>u.intersects(m)),y.shouldCollideWithScreenEdges&&K.forEach(m=>{u.intersects(m)&&p.push(m)}),p.length<=b&&(h=u,R=T,b=p.length),p.length===0){C.insert(u),g.colliders[r]=[T,!N.contains(u),u];break}}y.rank===5&&h!=null&&(C.insert(h),g.colliders[r]=[R,!N.contains(h),h])}else g.colliders[r]=[-1,!1];return g}function z(n){let e=n[0].map(t=>{let o=t[0].map((i,l)=>({index:l,boundingBox:[i[0],i[1],i[2],i[3]]}));return{enabled:t[1]===1,rank:t[2]===1?5:0,x:t[3],y:t[4],bboxes:o}});return{msgId:"-1",totalWidth:n[3],totalHeight:n[2],colliders:e,devicePixelRatio:n[1]}}self.onmessage=n=>{let e=z(n.data);self.postMessage(q(e.colliders,e.totalWidth,e.totalHeight,e.msgId))};})();
443
- `;d();d();d();d();d();function gv(r,t){return t.x+t.w<r.x+r.w&&t.x>r.x&&t.y>r.y&&t.y+t.h<r.y+r.h}l(gv,"contains");d();function vv(r,t){let[e,i]=t;return e>=r.x&&e<=r.x+r.w&&i>=r.y&&i<=r.y+r.h}l(vv,"intersectPoint");d();function bv(r,t){let e=t.x,i=t.y,n=t.x+t.w,o=t.y+t.h,a=r.x,u=r.y,s=r.x+r.w,p=r.y+r.h;return e<s&&a<n&&i<p&&u<o}l(bv,"intersects");d();function Pr(r,t){for(let e=0;e<t.length;e++)r.push(t[e])}l(Pr,"appendItems");d();var Cu=4,Qd=class Qd{x;y;w;h;userData;constructor(t,e,i,n,o){let a=typeof window>"u"?2:window.devicePixelRatio;this.userData=typeof o>"u"?null:o,this.x=t-Cu,this.y=e-Cu,this.w=i+Cu*Math.min(a,2),this.h=n+Cu*Math.min(a,2)}contains(t){return t===this?!1:gv(this,t)}intersects(t){return bv(this,t)}intersectsPoint(t){return vv(this,t)}draw(t){t.fillStyle="rgba(123,222,26, 0.5)",t.fillRect(this.x,this.y,this.w,this.h)}};l(Qd,"Rectangle");var Dt=Qd;var ji=class ji{topLeft;topRight;bottomLeft;bottomRight;divided=!1;boundary;capacity=16;objects=[];parent;constructor(t,e){this.parent=e,this.boundary=t}getSize(){return this.divided?this.objects.length+this.topLeft.getSize()+this.topRight.getSize()+this.bottomLeft.getSize()+this.bottomRight.getSize():this.objects.length}subdivide(){let{x:t,y:e,w:i,h:n}=this.boundary;this.topLeft=new ji(new Dt(t,e,i/2,n/2),this),this.topRight=new ji(new Dt(t+i/2,e,i/2,n/2),this),this.bottomLeft=new ji(new Dt(t,e+n/2,i/2,n/2),this),this.bottomRight=new ji(new Dt(t+i/2,e+n/2,i/2,n/2),this),this.divided=!0}queryRect(t){let e=[];if(this.boundary.intersects(t))e.push(...this.objects);else return[];return this.divided&&(Pr(e,this.topLeft.queryRect(t)),Pr(e,this.topRight.queryRect(t)),Pr(e,this.bottomLeft.queryRect(t)),Pr(e,this.bottomRight.queryRect(t))),e}queryPoint(t){let e=[];if(this.boundary.intersectsPoint(t))e.push(...this.objects);else return[];return this.divided&&(Pr(e,this.topLeft.queryPoint(t)),Pr(e,this.topRight.queryPoint(t)),Pr(e,this.bottomLeft.queryPoint(t)),Pr(e,this.bottomRight.queryPoint(t))),e}insert(t){return this.boundary.contains(t)?this.objects.length<this.capacity?(this.objects.push(t),!0):(this.divided||this.subdivide(),(this.topLeft.insert(t)||this.topRight.insert(t)||this.bottomLeft.insert(t)||this.bottomRight.insert(t))===!1&&this.objects.push(t),!0):!1}drawObjects(t){this.objects.forEach(e=>e.draw(t)),this.divided&&(this.topLeft.drawObjects(t),this.topRight.drawObjects(t),this.bottomLeft.drawObjects(t),this.bottomRight.drawObjects(t))}draw(t){t.rect(this.boundary.x,this.boundary.y,this.boundary.w,this.boundary.h),this.divided&&(this.topLeft.draw(t),this.topRight.draw(t),this.bottomLeft.draw(t),this.bottomRight.draw(t)),t.strokeStyle="black",t.lineWidth=4,t.stroke()}};l(ji,"QuadTree");var tr=ji;d();d();var Cv=["","","low","medium","high","always-visible"];function xv(r){return Math.min(5,Math.max(2,r))}l(xv,"clampTierNumber");function to(r){if(typeof r=="number")return xv(r);let t=Cv.indexOf(r);return t===-1?3:t}l(to,"convertCollisionRankingTierToNumber");function Na(r){let t=xv(r);return Cv[t]}l(Na,"convertNumberToCollisionRankingTier");function Sv(r,t,e){let i,n,o,a=null,u=0;e||(e={});let s=l(function(){u=e.leading===!1?0:Date.now(),a=null,o=r.apply(i,n),a||(i=n=null)},"later");return function(){let p=Date.now();!u&&e.leading===!1&&(u=p);let f=t-(p-u);return i=globalThis,n=arguments,f<=0||f>t?(a&&(clearTimeout(a),a=null),u=p,o=r.apply(i,n),a||(i=n=null)):!a&&e.trailing!==!1&&(a=setTimeout(s,f)),o}}l(Sv,"throttle");function Mv(r){return[r.bboxes.map(e=>[e.boundingBox[0],e.boundingBox[1],e.boundingBox[2],e.boundingBox[3]]),r.enabled?1:0,r.rank===5?1:0,r.x,r.y]}l(Mv,"packCollider");var Wi=!1,J8=150,ef=class ef extends et{worker;debugContext;debugCanvas;dirty=!0;packedMessage=[[],0,0,0];visibleCollidersQTree=new tr(new Dt(0,0,0,0));interactiveCollidersQTree=new tr(new Dt(0,0,0,0));coreState;constructor(t,e,i=new Worker(URL.createObjectURL(new Blob([yv],{type:"text/javascript"})))){super(),this.coreState=e,this.debugCanvas=t,this.debugContext=t.getContext("2d"),this.worker=i,this.worker.onmessage=n=>this.resolve(n),this.postMessage=Sv(this._postMessage,J8,!1),Wi?this.showCollisionBoxes():this.hideCollisionBoxes()}postMessage;showCollisionBoxes=()=>{Wi=!0,this.debugCanvas.style.display="block"};hideCollisionBoxes=()=>{Wi=!1,this.debugContext.clearRect(0,0,this.debugCanvas.width,this.debugCanvas.height),this.debugCanvas.style.display="none"};currentMsgId="";working=!1;_postMessage=()=>{this.worker.postMessage(this.packedMessage)};componentArray=[];update=()=>{if(this.dirty){this.packedMessage=[[],0,0,0],this.componentArray=new Array(this.coreState.entity2DIds.size);let t=0,e;for(let i of this.coreState.entity2DIds){let n=this.coreState.entity2DMap.get(i);n&&(e=n.components[0],this.componentArray[t]=e),t++}this.resize(),this.dirty=!1,this.componentArray.sort((i,n)=>n.rank-i.rank)}else this.componentArray.filter(e=>e.collisionDirty===!0).length>0&&this.componentArray.sort((e,i)=>i.rank-e.rank);for(let t=0;t<this.componentArray.length;t++)this.packedMessage&&(this.componentArray[t].collisionDirty||this.packedMessage[0][t]==null?(this.packedMessage[0][t]=Mv(this.componentArray[t].toJSON()),this.componentArray[t].collisionDirty=!1):(this.packedMessage[0][t][1]=this.componentArray[t].enabled?1:0,this.packedMessage[0][t][2]=this.componentArray[t].rank===5?1:0,this.packedMessage[0][t][3]=this.componentArray[t].projection.x,this.packedMessage[0][t][4]=this.componentArray[t].projection.y));this.working||this.postMessage()};resize(){this.packedMessage[3]=this.debugCanvas.width,this.packedMessage[2]=this.debugCanvas.height}resolve=t=>{if(this.working=!1,this.dirty||!t.data)return;let e=t.data.colliders,i=-1,n=!1,o,a,u;Wi&&(this.visibleCollidersQTree=new tr(new Dt(0,0,this.debugCanvas.width,this.debugCanvas.height))),this.interactiveCollidersQTree=new tr(new Dt(0,0,this.debugCanvas.width,this.debugCanvas.height));for(let s=0;s<this.componentArray.length;s++){let p=this.componentArray[s];e[s]==null||!p.enabled||([i,n,o]=e[s],i!==-1&&!n&&o!=null?(u=new Dt(o.x,o.y,o.w,o.h,{entityId:p.id}),Wi&&this.visibleCollidersQTree.insert(u),a=this.coreState.entity2DMap.get(p.id),(a==null?void 0:a.components[1])!=null&&this.interactiveCollidersQTree.insert(new Dt(o.x,o.y,o.w,o.h,{entityId:p.id})),p.visible===!1&&(p.visible=!0,"visibilityNeedsUpdate"in p&&(p.visibilityNeedsUpdate=!0)),i!==-1&&i!==p.activeStrategyIndex&&(p.activeBoundingBox=u,p.onStrategySelected(i))):(p.visible===!0&&(p.visible=!1,"visibilityNeedsUpdate"in p&&(p.visibilityNeedsUpdate=!0)),i!==-1&&i!==p.activeStrategyIndex&&p.onStrategySelected(i)))}Wi&&this.drawDebug(),this.publish("visibility-changed")};drawDebug=()=>{Wi&&this.visibleCollidersQTree&&(this.debugContext.clearRect(0,0,this.debugCanvas.width,this.debugCanvas.height),this.debugContext.beginPath(),this.visibleCollidersQTree.drawObjects(this.debugContext))};destroy=()=>{this.worker.terminate()}};l(ef,"CollisionSystem");var xu=ef;d();d();d();d();var nf=class nf{type;event;constructor(t){this.type=0,this.event=t}get timestamp(){return this.event.timeStamp}};l(nf,"Tap");var Su=nf,of=class of{taps=[];add(t){this.lastPointerDown&&t.timestamp-this.lastPointerDown.timestamp<50?this.lastPointerDown.type=1:this.taps.push(t)}get lastPointerDown(){return this.taps.length>=1?this.taps[this.taps.length-1]:void 0}get isSingleTapWithTwoFingers(){var t;return this.isSingleTap&&((t=this.lastPointerDown)==null?void 0:t.type)===1}get isSingleTapWithOneFinger(){var t;return this.isSingleTap&&((t=this.lastPointerDown)==null?void 0:t.type)===0}get isDoubleTapWithOneFinger(){var t,e;return this.isDoubleTap&&((t=this.taps[0])==null?void 0:t.type)===0&&((e=this.taps[1])==null?void 0:e.type)===0}get isSingleTap(){return this.taps.length===1}get isDoubleTap(){return this.taps.length===2}discardOutsideOfWaitWindow(t){this.taps=this.taps.filter(e=>t-e.timestamp<300)}flush(){this.taps=[]}get _taps(){return this.taps}destroy(){this.flush()}};l(of,"TapsController");var Mu=of;d();function Pv(r){let t=new Set;for(let e of r){let i=e.object;for(;i.parent&&!t.has(i.parent);)i=i.parent,i instanceof Pt&&i.type==="group-container"&&i.visible&&i.components[1]&&t.add(i)}return Array.from(t)}l(Pv,"getUniqueIntersectedGroupContainers");function Tv(r,t){if(r==null||t==null)return r===t;if(r.length!==t.length)return!1;for(let e=0;e<r.length;e++)if(r[e]!==t[e])return!1;return!0}l(Tv,"arraysEqual");var eo,af=class af extends et{constructor(e,i,n,o){super();v(this,"raycaster",new Rr);v(this,"state",{hovered3DEntity:void 0,hovered2DEntity:void 0,hovered3DContainers:void 0,lastHover:void 0,containerOffset:[0,0],interaction:{mouseDownStart:void 0,distanceFromMouseDown:void 0,isPanning:!1}});v(this,"coreState");v(this,"camera");v(this,"cameraPlane");v(this,"_quadtree",new tr(new Dt(0,0,0,0)));v(this,"_container");v(this,"cursor","grab");v(this,"touchesCount",0);v(this,"hasTouched",!1);P(this,eo,void 0);v(this,"onPointerMoveRaf",e=>{c(this,eo)&&cancelAnimationFrame(c(this,eo)),E(this,eo,requestAnimationFrame(()=>{this.onPointerMove(e)}))});v(this,"onPointerMove",e=>{e.preventDefault(),this.updateInteractionStateIfPanning(e),(e.pointerType!=="touch"||e.pointerType===void 0&&this.hasTouched)&&this.handleHover(e),this.handleCursor()});v(this,"tapsControl",new Mu);v(this,"onPointerDown",e=>{e.target===this._container&&(this._container.addEventListener("pointerup",this.onPointerUp,!1),this._container.addEventListener("pointercancel",this.onPointerUp,!1),this.state.interaction.mouseDownStart={time:Date.now(),timestamp:e.timeStamp,clientX:e.clientX,clientY:e.clientY},this.state.interaction.distanceFromMouseDown=0,this.handleCursor(),e.pointerType==="touch"&&(this.tapsControl.add(new Su(e)),this.touchesCount=Math.max(0,this.touchesCount+1)))});v(this,"clickTimeout");v(this,"onPointerUp",e=>{this.tapsControl.discardOutsideOfWaitWindow(e.timeStamp),this.touchesCount=Math.max(0,this.touchesCount-1),this.touchesCount===0&&(this._container.removeEventListener("pointerup",this.onPointerUp,!1),this._container.removeEventListener("pointercancel",this.onPointerUp,!1)),this.updateInteractionStateIfPanning(e);let{mouseDownStart:i}=this.state.interaction;!i||this.state.interaction.distanceFromMouseDown==null||(Date.now()<i.time+300&&(this.tapsControl.isSingleTapWithTwoFingers||this.state.interaction.distanceFromMouseDown<=15)&&(e.pointerType==="touch"?this.tapsControl.isSingleTapWithTwoFingers?(this.publish("singletap-with-twofinger",e),this.flush()):this.tapsControl.isSingleTapWithOneFinger&&this.touchesCount===0?(this.clickTimeout&&clearTimeout(this.clickTimeout),this.clickTimeout=window.setTimeout(()=>{this.handleClick(e),this.flush()},300)):this.tapsControl.isDoubleTapWithOneFinger&&(this.publish("doubletap-with-onefinger",e),this.flush()):this.handleClick(e)),this.state.interaction.mouseDownStart=void 0,this.state.interaction.distanceFromMouseDown=void 0,this.state.interaction.isPanning=!1,this.handleCursor())});v(this,"dirty3D",!0);v(this,"cachedHitBoxes",{entities:[],groups:[]});v(this,"ndcPoint",new Z);v(this,"debugPanel");this.raycaster.layers.enableAll(),this.raycaster.layers.disable(1);let{top:a,left:u}=e.getBoundingClientRect();this.state.containerOffset=[a,u],this.camera=n,this._container=e,this.coreState=i,this.cameraPlane=o,this._container.addEventListener("pointerdown",this.onPointerDown,!1),this._container.addEventListener("pointermove",this.onPointerMoveRaf,!1),this._container.classList.add("mappedin-interactive")}updateQuadtree(e){this._quadtree=e}setHovered3DEntityInteractionComponentDirty(){if(this.state.hovered3DEntity){let e=this.state.hovered3DEntity.components[2];e&&(e.dirty=!0)}}flush(){this.tapsControl.flush(),this.clickTimeout!=null&&(clearTimeout(this.clickTimeout),this.clickTimeout=void 0)}handleHover(e){if(this.state.interaction.mouseDownStart)return;let{entity3D:i,entity2D:n,position:o,groupContainers:a}=this.intersect(e);(this.handle3DEntityHover(i)||this.handle2DEntityHover(n)||this.handle3DContainerHover(a))&&this.publish("hover",{entity2D:this.state.hovered2DEntity,entity3D:this.state.hovered3DEntity,position:o,groupContainers:a}),this.handleCursor()}handleCursor(){let e=!!(this.state.hovered3DEntity||this.state.hovered2DEntity),i=!!this.state.interaction.mouseDownStart,n=this.state.interaction.isPanning,o=e9(e,n,i);this.cursor!==o&&(this.cursor=o,o==="pointer"?this._container.classList.add("mappedin-interaction-hover"):this._container.classList.remove("mappedin-interaction-hover"))}handle2DEntityHover(e){let i=this.state.hovered2DEntity!==e;return this.state.hovered2DEntity=e,i}handleClick(e){let i=this.intersect(e);this.publish("click",{entity2D:i.entity2D,entity3D:i.entity3D,position:i.position,groupContainers:i.groupContainers,pointerEvent:{button:e.button}})}get _hitBoxes(){if(this.dirty3D){let e;for(let i of this.coreState.threeDEntities)e=this.coreState.entity3DMap.get(i),((e==null?void 0:e.type)==="geometry"||(e==null?void 0:e.type)==="model")&&e.components[2]?e.components[0].mesh&&!this.cachedHitBoxes.entities.includes(e.components[0].mesh)&&this.cachedHitBoxes.entities.push(e.components[0].mesh):(e==null?void 0:e.type)==="group-container"&&e.components[1]&&!this.cachedHitBoxes.groups.includes(e)&&this.cachedHitBoxes.groups.push(e);return this.dirty3D=!1,this.cachedHitBoxes}return this.cachedHitBoxes}intersect(e){var S,M;let i=[e.offsetX,e.offsetY],n=this._quadtree.queryPoint(i),[o]=n.filter(g=>g.intersectsPoint(i)),a=this.state.containerOffset[0],u=this.state.containerOffset[1];this.ndcPoint.x=(e.clientX-u)/this._container.clientWidth*2-1,this.ndcPoint.y=-((e.clientY-a)/this._container.clientHeight)*2+1,this.raycaster.setFromCamera(this.ndcPoint,this.camera),this.raycaster.layers.enable(0);let[s]=this.getMouseRayIntersects(),p=this.raycaster.intersectObjects(this._hitBoxes.entities,!0).filter(g=>g.object.visible),[f]=p,m=(S=f==null?void 0:f.instanceId)!=null?S:f==null?void 0:f.batchId,y=this.raycaster.intersectObjects(this._hitBoxes.groups,!0).filter(g=>g.object.visible),x;return y!=null&&y.length>0&&(x=Pv(y)),{entity2D:((M=o==null?void 0:o.userData)==null?void 0:M.entityId)==="watermark"?{id:"watermark"}:this.coreState.entity2DMap.get(o==null?void 0:o.userData.entityId),entity3D:m!=null?this.coreState.entity3DMap.get(f==null?void 0:f.object.userData.entities[m]):this.coreState.entity3DMap.get(f==null?void 0:f.object.userData.entityId),position:s==null?void 0:s.point,groupContainers:x}}handle3DEntityHover(e){this.state.lastHover!==e&&(this.state.lastHover&&Iv(this.state.lastHover,!1),e&&Iv(e,!0));let i=this.state.hovered3DEntity!==e;return this.state.hovered3DEntity=e,this.state.lastHover=e,i}handle3DContainerHover(e){let i=!Tv(this.state.hovered3DContainers,e);return this.state.hovered3DContainers=e,i}updateInteractionStateIfPanning(e){this.state.interaction.mouseDownStart&&(this.state.interaction.distanceFromMouseDown=Math.sqrt(Math.pow(e.clientX-this.state.interaction.mouseDownStart.clientX,2)+Math.pow(e.clientY-this.state.interaction.mouseDownStart.clientY,2)),!this.state.interaction.isPanning&&this.state.interaction.distanceFromMouseDown>15&&(this.state.interaction.isPanning=!0))}getMouseRayIntersects(){return this.raycaster.intersectObjects([this.cameraPlane],!1)}destroy(){this._container.removeEventListener("pointerdown",this.onPointerDown,!1),this._container.removeEventListener("pointermove",this.onPointerMoveRaf,!1),this._container.removeEventListener("pointerup",this.onPointerUp,!1),this._container.removeEventListener("pointercancel",this.onPointerUp,!1)}enableDebug(){let e=document.createElement("div");e.style.position="absolute",e.style.top="0",e.style.right="0",e.style.zIndex="1",e.style.backgroundColor="white",e.style.padding="10px",document.body.append(e),e.id="interaction-debug-panel",this.debugPanel=e,this.on("doubletap-with-onefinger",()=>{this.queueDebugMessage("doubletap-with-onefinger","#ffadad")}),this.on("singletap-with-twofinger",()=>{this.queueDebugMessage("singletap-with-twofinger","#ffd6a5")}),this.on("click",i=>{var n,o,a;this.queueDebugMessage(`CLICK
442
+ </svg>`]]),r9=/<svg([^>]*)>/g;function U3(r,t,e){let i=e9.get(r);return i?i.replace(r9,`<svg$1 xmlns="http://www.w3.org/2000/svg" style="fill:${t}; width:${e}px; height:${e}px">`):""}l(U3,"getStyledIcon");var Gi,$n,Ca,ud,nu,Z3,ou,z3,xa,cd,au,q3,pd=class pd{constructor(t,e){P(this,Ca);P(this,nu);P(this,ou);P(this,xa);P(this,au);P(this,Gi,void 0);P(this,$n,void 0);v(this,"colors",{default:"#3D5676",connection:"#128387",washroom:"#3161B4",point:"#AD468F"});E(this,Gi,t),E(this,$n,e)}auto(){let t=c(this,$n)[Object.keys(c(this,$n))[0]];[...t.getByType("connection"),...t.getByType("point-of-interest"),...t.getByType("space")].forEach(e=>{e.__type==="connection"?e.coordinates.forEach(i=>{c(this,Gi).Labels.add(i,e.name,Y(this,Ca,ud).call(this,e))}):(e.__type==="space"&&e.name!==""&&c(this,Gi).updateState(e,{interactive:!0,hoverColor:"#F0F0F0"}),c(this,Gi).Labels.add(e,e.name,Y(this,Ca,ud).call(this,e)))})}};Gi=new WeakMap,$n=new WeakMap,Ca=new WeakSet,ud=l(function(t){let e=U3(Y(this,nu,Z3).call(this,t),"white",12);return{appearance:{text:{foregroundColor:Y(this,xa,cd).call(this,t)},marker:{foregroundColor:{active:Y(this,xa,cd).call(this,t)},icon:e,iconSize:12}},interactive:!0,rank:Y(this,au,q3).call(this,t)}},"#generatLabelAppearance"),nu=new WeakSet,Z3=l(function(t){return t.__type==="connection"?Y(this,ou,z3).call(this,t.type):t.name.includes("Washroom")?"washroom-14x14":t.__type==="point-of-interest"?"point-of-interest-12x12":""},"#getIconName"),ou=new WeakSet,z3=l(function(t){let e="";switch(t){case"elevator":e="connection-elevator-12x12";break;case"escalator":e="connection-escalator-12x12";break;case"stairs":e="connection-stairs-12x12";break}return e},"#attemptIconNameForConnection"),xa=new WeakSet,cd=l(function(t){return t.__type==="connection"?this.colors.connection:t.__type==="point-of-interest"?this.colors.point:"name"in t&&t.name.includes("Washroom")?this.colors.washroom:this.colors.default},"#getLabelColor"),au=new WeakSet,q3=l(function(t){return t.__type==="connection"?"high":(t.__type==="point-of-interest","medium")},"#getDefaultLabelRank"),l(pd,"Labels");var iu=pd;var hd=class hd{Labels;constructor(t,e){this.Labels=new iu(t,e)}auto=()=>{this.Labels.auto()}};l(hd,"DefaultTheme");var su=hd;d();var Mt,dd=class dd{constructor(t){P(this,Mt,void 0);v(this,"setMinZoomLevel",t=>{c(this,Mt).camera.setMinZoomLevel(t)});v(this,"setMaxZoomLevel",t=>{c(this,Mt).camera.setMaxZoomLevel(t)});E(this,Mt,t)}setScreenOffsets(t){c(this,Mt).camera.setInsetPadding(t)}focusOn(t,e){var o;let i=[],n=Array.isArray(t)?t:[t];for(let a of n)if(qr.is(a)){let u;for(u of a.coordinates)i.push([u.longitude,u.latitude])}else{let u=$e(a);if(u){let s=0;u.floorId&&(s=((o=c(this,Mt).getState(u.floorId))==null?void 0:o.altitude)||0),i.push([u.longitude,u.latitude,s])}}return c(this,Mt).camera.focusOn(i,{pitch:e==null?void 0:e.pitch,bearing:e==null?void 0:e.bearing,padding:e==null?void 0:e.screenOffsets,maxZoomLevel:e==null?void 0:e.maxZoomLevel,minZoomLevel:e==null?void 0:e.minZoomLevel,duration:e==null?void 0:e.duration,easing:e==null?void 0:e.easing})}animateTo(t,e){var p;let{center:i,zoomLevel:n,bearing:o,pitch:a}=t,u=i!=null?i:this.center,s=[u.longitude,u.latitude];return c(this,Mt).camera.animateTo({center:s,zoomLevel:n!=null?n:this.zoomLevel,bearing:o!=null?o:this.bearing,pitch:a!=null?a:this.pitch,duration:(p=e==null?void 0:e.duration)!=null?p:600,easing:e==null?void 0:e.easing})}set(t){let{center:e=this.center,zoomLevel:i=this.zoomLevel,bearing:n=this.bearing,pitch:o=this.pitch}=t,a=[e.longitude,e.latitude];c(this,Mt).camera.setCenter(a),c(this,Mt).camera.setZoomLevel(i),c(this,Mt).camera.setBearing(n),c(this,Mt).camera.setPitch(o)}get center(){let t=c(this,Mt).camera.center;return new Q(t[1],t[0],void 0)}get zoomLevel(){return c(this,Mt).camera.zoomLevel}get pitch(){return c(this,Mt).camera.pitch}get bearing(){let t=c(this,Mt).camera.bearing;return(t<0?t+360:t)%360}get minZoomLevel(){return c(this,Mt).camera.minZoomLevel}get maxZoomLevel(){return c(this,Mt).camera.maxZoomLevel}};Mt=new WeakMap,l(dd,"Camera");var Sa=dd;d();d();d();d();d();d();d();d();function fd(r){let t=+this._x.call(null,r),e=+this._y.call(null,r);return $3(this.cover(t,e),t,e,r)}l(fd,"default");function $3(r,t,e,i){if(isNaN(t)||isNaN(e))return r;var n,o=r._root,a={data:i},u=r._x0,s=r._y0,p=r._x1,f=r._y1,m,y,x,S,M,g,C,I;if(!o)return r._root=a,r;for(;o.length;)if((M=t>=(m=(u+p)/2))?u=m:p=m,(g=e>=(y=(s+f)/2))?s=y:f=y,n=o,!(o=o[C=g<<1|M]))return n[C]=a,r;if(x=+r._x.call(null,o.data),S=+r._y.call(null,o.data),t===x&&e===S)return a.next=o,n?n[C]=a:r._root=a,r;do n=n?n[C]=new Array(4):r._root=new Array(4),(M=t>=(m=(u+p)/2))?u=m:p=m,(g=e>=(y=(s+f)/2))?s=y:f=y;while((C=g<<1|M)===(I=(S>=y)<<1|x>=m));return n[I]=o,n[C]=a,r}l($3,"add");function J3(r){var t,e,i=r.length,n,o,a=new Array(i),u=new Array(i),s=1/0,p=1/0,f=-1/0,m=-1/0;for(e=0;e<i;++e)isNaN(n=+this._x.call(null,t=r[e]))||isNaN(o=+this._y.call(null,t))||(a[e]=n,u[e]=o,n<s&&(s=n),n>f&&(f=n),o<p&&(p=o),o>m&&(m=o));if(s>f||p>m)return this;for(this.cover(s,p).cover(f,m),e=0;e<i;++e)$3(this,a[e],u[e],r[e]);return this}l(J3,"addAll");d();function md(r,t){if(isNaN(r=+r)||isNaN(t=+t))return this;var e=this._x0,i=this._y0,n=this._x1,o=this._y1;if(isNaN(e))n=(e=Math.floor(r))+1,o=(i=Math.floor(t))+1;else{for(var a=n-e||1,u=this._root,s,p;e>r||r>=n||i>t||t>=o;)switch(p=(t<i)<<1|r<e,s=new Array(4),s[p]=u,u=s,a*=2,p){case 0:n=e+a,o=i+a;break;case 1:e=n-a,o=i+a;break;case 2:n=e+a,i=o-a;break;case 3:e=n-a,i=o-a;break}this._root&&this._root.length&&(this._root=u)}return this._x0=e,this._y0=i,this._x1=n,this._y1=o,this}l(md,"default");d();function yd(){var r=[];return this.visit(function(t){if(!t.length)do r.push(t.data);while(t=t.next)}),r}l(yd,"default");d();function gd(r){return arguments.length?this.cover(+r[0][0],+r[0][1]).cover(+r[1][0],+r[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}l(gd,"default");d();d();function _t(r,t,e,i,n){this.node=r,this.x0=t,this.y0=e,this.x1=i,this.y1=n}l(_t,"default");function vd(r,t,e){var i,n=this._x0,o=this._y0,a,u,s,p,f=this._x1,m=this._y1,y=[],x=this._root,S,M;for(x&&y.push(new _t(x,n,o,f,m)),e==null?e=1/0:(n=r-e,o=t-e,f=r+e,m=t+e,e*=e);S=y.pop();)if(!(!(x=S.node)||(a=S.x0)>f||(u=S.y0)>m||(s=S.x1)<n||(p=S.y1)<o))if(x.length){var g=(a+s)/2,C=(u+p)/2;y.push(new _t(x[3],g,C,s,p),new _t(x[2],a,C,g,p),new _t(x[1],g,u,s,C),new _t(x[0],a,u,g,C)),(M=(t>=C)<<1|r>=g)&&(S=y[y.length-1],y[y.length-1]=y[y.length-1-M],y[y.length-1-M]=S)}else{var I=r-+this._x.call(null,x.data),T=t-+this._y.call(null,x.data),w=I*I+T*T;if(w<e){var L=Math.sqrt(e=w);n=r-L,o=t-L,f=r+L,m=t+L,i=x.data}}return i}l(vd,"default");d();function bd(r){if(isNaN(f=+this._x.call(null,r))||isNaN(m=+this._y.call(null,r)))return this;var t,e=this._root,i,n,o,a=this._x0,u=this._y0,s=this._x1,p=this._y1,f,m,y,x,S,M,g,C;if(!e)return this;if(e.length)for(;;){if((S=f>=(y=(a+s)/2))?a=y:s=y,(M=m>=(x=(u+p)/2))?u=x:p=x,t=e,!(e=e[g=M<<1|S]))return this;if(!e.length)break;(t[g+1&3]||t[g+2&3]||t[g+3&3])&&(i=t,C=g)}for(;e.data!==r;)if(n=e,!(e=e.next))return this;return(o=e.next)&&delete e.next,n?(o?n.next=o:delete n.next,this):t?(o?t[g]=o:delete t[g],(e=t[0]||t[1]||t[2]||t[3])&&e===(t[3]||t[2]||t[1]||t[0])&&!e.length&&(i?i[C]=e:this._root=e),this):(this._root=o,this)}l(bd,"default");function K3(r){for(var t=0,e=r.length;t<e;++t)this.remove(r[t]);return this}l(K3,"removeAll");d();function Cd(){return this._root}l(Cd,"default");d();function xd(){var r=0;return this.visit(function(t){if(!t.length)do++r;while(t=t.next)}),r}l(xd,"default");d();function Sd(r){var t=[],e,i=this._root,n,o,a,u,s;for(i&&t.push(new _t(i,this._x0,this._y0,this._x1,this._y1));e=t.pop();)if(!r(i=e.node,o=e.x0,a=e.y0,u=e.x1,s=e.y1)&&i.length){var p=(o+u)/2,f=(a+s)/2;(n=i[3])&&t.push(new _t(n,p,f,u,s)),(n=i[2])&&t.push(new _t(n,o,f,p,s)),(n=i[1])&&t.push(new _t(n,p,a,u,f)),(n=i[0])&&t.push(new _t(n,o,a,p,f))}return this}l(Sd,"default");d();function Md(r){var t=[],e=[],i;for(this._root&&t.push(new _t(this._root,this._x0,this._y0,this._x1,this._y1));i=t.pop();){var n=i.node;if(n.length){var o,a=i.x0,u=i.y0,s=i.x1,p=i.y1,f=(a+s)/2,m=(u+p)/2;(o=n[0])&&t.push(new _t(o,a,u,f,m)),(o=n[1])&&t.push(new _t(o,f,u,s,m)),(o=n[2])&&t.push(new _t(o,a,m,f,p)),(o=n[3])&&t.push(new _t(o,f,m,s,p))}e.push(i)}for(;i=e.pop();)r(i.node,i.x0,i.y0,i.x1,i.y1);return this}l(Md,"default");d();function Q3(r){return r[0]}l(Q3,"defaultX");function Pd(r){return arguments.length?(this._x=r,this):this._x}l(Pd,"default");d();function tv(r){return r[1]}l(tv,"defaultY");function wd(r){return arguments.length?(this._y=r,this):this._y}l(wd,"default");function Ma(r,t,e){var i=new Td(t==null?Q3:t,e==null?tv:e,NaN,NaN,NaN,NaN);return r==null?i:i.addAll(r)}l(Ma,"quadtree");function Td(r,t,e,i,n,o){this._x=r,this._y=t,this._x0=e,this._y0=i,this._x1=n,this._y1=o,this._root=void 0}l(Td,"Quadtree");function ev(r){for(var t={data:r.data},e=t;r=r.next;)e=e.next={data:r.data};return t}l(ev,"leaf_copy");var qt=Ma.prototype=Td.prototype;qt.copy=function(){var r=new Td(this._x,this._y,this._x0,this._y0,this._x1,this._y1),t=this._root,e,i;if(!t)return r;if(!t.length)return r._root=ev(t),r;for(e=[{source:t,target:r._root=new Array(4)}];t=e.pop();)for(var n=0;n<4;++n)(i=t.source[n])&&(i.length?e.push({source:i,target:t.target[n]=new Array(4)}):t.target[n]=ev(i));return r};qt.add=fd;qt.addAll=J3;qt.cover=md;qt.data=yd;qt.extent=gd;qt.find=vd;qt.remove=bd;qt.removeAll=K3;qt.root=Cd;qt.size=xd;qt.visit=Sd;qt.visitAfter=Md;qt.x=Pd;qt.y=wd;d();d();var Id=class Id{origin;destination;distance;angle;weight;constructor({origin:t,destination:e,distance:i=0,angle:n=0,pathWeight:o=0}){this.origin=t,this.destination=e,this.distance=i,this.angle=n;let a=o||0;if(this.weight=a>=0?this.distance+a:0,isNaN(this.angle))throw new Error("nan angle")}};l(Id,"Edge");var Vi=Id;d();d();d();d();function Mr([r,t],[e,i]){let n=t-i,o=r-e;return(Math.atan2(o,n)+Math.PI*3)%(Math.PI*2)}l(Mr,"getAngle");d();var i9=63710088e-1;function Hi(r,t){let[e,i]=r.map(f=>f*Math.PI/180),[n,o]=t.map(f=>f*Math.PI/180),a=o-i,u=n-e,s=Math.sin(a/2)*Math.sin(a/2)+Math.cos(i)*Math.cos(o)*Math.sin(u/2)*Math.sin(u/2),p=2*Math.atan2(Math.sqrt(s),Math.sqrt(1-s));return i9*p}l(Hi,"getDistance");d();d();function lu(r,t,e,i){let[n,o]=r,[a,u]=t,[s,p]=e,[f,m]=i;if(o===u&&n===a||p===m&&s===f)return null;let y=(f-s)*(u-o)-(m-p)*(a-n);if(y===0)return null;let x=((m-p)*(n-s)-(f-s)*(o-p))/y,S=((u-o)*(n-s)-(a-n)*(o-p))/y;if(x<0||x>1||S<0||S>1)return null;let M=o+x*(u-o);return[n+x*(a-n),M]}l(lu,"getLineIntersection");d();function Ed(r,t,e,i){let n=gi(r,e/1e3,i),o=gi(t,e/1e3,i);return[n.geometry.coordinates,o.geometry.coordinates]}l(Ed,"getOffsetLine");d();function Ld(r){let t=r*(180/Math.PI);return t=t%360,t>180?t-=360:t<-180&&(t+=360),Object.is(t,-0)?0:t}l(Ld,"radToDegNormalized");function rv(r,t,e=[],i=0){let n=!0,o=r.geometry.coordinates,a=t.geometry.coordinates,u=Ld(Mr(o,a)-Math.PI/2),s=Ld(Mr(o,a)+Math.PI/2);return e.forEach(p=>{if(i>0){let f=Ed(o,a,i,u),m=Ed(o,a,i,s);if(lu(f[0],f[1],p[0],p[1])||lu(m[0],m[1],p[0],p[1])){n=!1;return}}else if(lu(o,a,p[0],p[1])){n=!1;return}}),n}l(rv,"hasLineOfSight");var Pa,_d,cu,iv,pu,nv,hu,ov,du,av,fu,sv,mu,lv,Dd=class Dd{constructor({nodes:t,groupBy:e}){P(this,Pa);P(this,cu);P(this,pu);P(this,hu);P(this,du);P(this,fu);P(this,mu);v(this,"edges",{});v(this,"nodesById");v(this,"nodesByGroup",new Map);let{features:i}=t;this.nodesById=Y(this,cu,iv).call(this,i),Y(this,pu,nv).call(this),Y(this,hu,ov).call(this,i,e)}getShortestEuclideanDistance(t,e){return e.reduce((i,n)=>{let o=Hi(t.geometry.coordinates,n.geometry.coordinates);return Math.min(i,o)},Number.MAX_VALUE)}aStar({originIds:t,destinationNodeIds:e,excludedNodeIds:i}){let n=Y(this,Pa,_d).call(this,t),o=Y(this,Pa,_d).call(this,e);if(n.length===0||o.length===0)return[];let{frontier:a,cameFrom:u,costSoFar:s}=Y(this,du,av).call(this,n,o);for(;a.length>0;){let p=a.shift();if(!p)break;if(Y(this,fu,sv).call(this,p.origin,o))return Y(this,mu,lv).call(this,u,p.origin.properties.id);for(let f of this.edges[p.origin.properties.id]){if(i!=null&&i.has(f.destination.properties.id))continue;let m=s[p.origin.properties.id]+f.weight;if(s[f.destination.properties.id]==null||m<s[f.destination.properties.id]){let y=m+this.getShortestEuclideanDistance(f.destination,o);s[f.destination.properties.id]=m,u[f.destination.properties.id]=f,a.push({origin:f.destination,priority:y})}}a.sort((f,m)=>f.priority-m.priority)}return[]}};Pa=new WeakSet,_d=l(function(t){return t.map(e=>this.nodesById[e]).filter(Boolean)},"#filterValidNodes"),cu=new WeakSet,iv=l(function(t){return t.reduce((e,i)=>(e[i.properties.id]=i,e),{})},"#createNodesById"),pu=new WeakSet,nv=l(function(){for(let t in this.nodesById)this.nodesById.hasOwnProperty(t)&&(this.nodesById[t].properties.neighbors=this.nodesById[t].properties.neighbors.filter(({id:e})=>!!this.nodesById[e]))},"#removeInvalidNeighbors"),hu=new WeakSet,ov=l(function(t,e){t.forEach(i=>{let n=e==="default"?e:i.properties[e];this.nodesByGroup.has(n)||this.nodesByGroup.set(n,[]),this.nodesByGroup.get(n).push(i),this.edges[i.properties.id]=i.properties.neighbors.map(({id:o,weight:a})=>{let u=this.nodesById[o],s=Hi(i.geometry.coordinates,u.geometry.coordinates),p=Mr(i.geometry.coordinates,u.geometry.coordinates);return new Vi({origin:i,destination:u,pathWeight:a,distance:s,angle:p})})})},"#initializeEdgesAndGroups"),du=new WeakSet,av=l(function(t,e){let i=[],n={},o={};return t.forEach(a=>{let u=this.getShortestEuclideanDistance(a,e);i.push({origin:a,priority:u}),n[a.properties.id]=null,o[a.properties.id]=0}),i.sort((a,u)=>a.priority-u.priority),{frontier:i,cameFrom:n,costSoFar:o}},"#initializeSearch"),fu=new WeakSet,sv=l(function(t,e){return e.some(i=>i.properties.id===t.properties.id)},"#isDestinationNode"),mu=new WeakSet,lv=l(function(t,e){let i=[],n=t[e];for(;n;)i.push(n),n=t[n.origin.properties.id];return i.reverse()},"#reconstructPath"),l(Dd,"NavigationGraph");var uu=Dd;var n9=.4,Od=class Od{groupBy;graph;geometryEdgesByMapId=new Map;cache={nodeTreesByGroup:new Map};constructor({nodes:t,obstructions:e,groupBy:i="default"}){this.groupBy=i,this.graph=new uu({nodes:t,groupBy:this.groupBy}),e&&e.features.forEach(n=>{let o=n.geometry.coordinates.length===1?n.geometry.coordinates[0]:n.geometry.coordinates,a=this.groupBy==="default"?this.groupBy:n.properties[this.groupBy];this.geometryEdgesByMapId.has(a)||this.geometryEdgesByMapId.set(a,[]),o.forEach((u,s)=>{this.geometryEdgesByMapId.get(a).push([u,o[s+1]||o[0]])})})}findNearestNode=t=>{var n;let e=this.groupBy==="default"?this.groupBy:t.properties[this.groupBy];if(!this.cache.nodeTreesByGroup.has(e)){let o=(n=this.graph.nodesByGroup.get(e))!=null?n:[],a=Ma();a.x(u=>u.geometry.coordinates[1]),a.y(u=>u.geometry.coordinates[0]),a.addAll(o),this.cache.nodeTreesByGroup.set(e,a)}return this.cache.nodeTreesByGroup.get(e).find(t.geometry.coordinates[1],t.geometry.coordinates[0])||null};getDirections({originIds:t,destinationNodeIds:e,excludedNodeIds:i,simplify:n}){var u,s;let o=(u=n==null?void 0:n.enabled)!=null?u:!0,a=this.graph.aStar({originIds:t,destinationNodeIds:e,excludedNodeIds:new Set(i)});return a.length===0?{type:"FeatureCollection",features:[]}:(o&&(a=this.simplifyAllSteps(a,(s=n==null?void 0:n.bufferRadius)!=null?s:n9)),this.generatePath(a))}generatePath=t=>{let{destination:e}=t[t.length-1],i={type:"FeatureCollection",features:[]};for(let o=0;o<t.length;o++){let{origin:a}=t[o],u={id:a.properties.id,angle:t[o].angle,distance:t[o].distance};this.groupBy!=="default"&&(u.groupBy=a.properties[this.groupBy]),i.features.push({type:"Feature",geometry:{type:"Point",coordinates:[a.geometry.coordinates[0],a.geometry.coordinates[1]]},properties:u})}let n={id:e.properties.id};return this.groupBy!=="default"&&(n.groupBy=e.properties[this.groupBy]),i.features.push({type:"Feature",geometry:{type:"Point",coordinates:[e.geometry.coordinates[0],e.geometry.coordinates[1]]},properties:n}),i};simplifyAllSteps(t,e){var s,p;let i=[],n=[t[0]];for(let f=1;f<t.length;f++){if(this.groupBy!=="default"&&t[f].origin.properties[this.groupBy]!==t[f-1].origin.properties[this.groupBy]){let m=t[f-1].origin.properties[this.groupBy],y=(s=this.geometryEdgesByMapId.get(m))!=null?s:[];i.push(...this.simplifySteps(n,y,e)),n=[t[f]]}n.push(t[f])}let o=t[t.length-1],a=this.groupBy==="default"?this.groupBy:o.origin.properties[this.groupBy],u=(p=this.geometryEdgesByMapId.get(a))!=null?p:[];return i.push(...this.simplifySteps(n,u,e)),i}simplifySteps(t,e,i){if(t.length<3)return t;let n=[t[0]],o=1;for(let a=o+2;a<t.length;a++)if(!rv(t[o].origin,t[a].origin,e,i)){let u=a-1;n.push(new Vi({...t[o],destination:t[u].origin,distance:Hi(t[o].origin.geometry.coordinates,t[u].origin.geometry.coordinates),angle:Mr(t[o].origin.geometry.coordinates,t[u].origin.geometry.coordinates)})),o=u}return n.push(new Vi({...t[o],destination:t[t.length-1].origin,distance:Hi(t[o].origin.geometry.coordinates,t[t.length-1].origin.geometry.coordinates),angle:Mr(t[o].origin.geometry.coordinates,t[t.length-1].origin.geometry.coordinates)}),t[t.length-1]),n}getDistance=(t,e)=>Hi(t,e);getAngle=(t,e)=>Mr(t,e)};l(Od,"Navigator");var wa=Od;d();function ri(r){return[r.longitude,r.latitude]}l(ri,"convertCoordinateToPosition");function o9(r){return new Map(r.map(t=>{let{properties:e}=t,{id:i}=e;return[i,t]}))}l(o9,"getEntranceMap");var Ad=l((r,t)=>{let e=o9(t),i={type:"Feature",properties:{id:r[0].properties.id},geometry:{type:"MultiLineString",coordinates:[]}};for(let n of r){let o=[n.geometry.coordinates],a=(n.properties.entrances||[]).reduce((u,s)=>(e.has(s)&&u.push(e.get(s)),u),[]);a.length&&(o=Fh(n,a).map(u=>u.geometry.coordinates)),i.geometry.coordinates.push(...o)}return i},"cutEntrancesFromLineStrings");function uv(r,t){let e={options:{}};if(!e.options)throw new Error("options should exist");return r.appearance&&(e.options.appearance=r.appearance),r.rank!=null&&(r.rank==="initial"?e.options.rank=t.initialRank||2:e.options.rank=r.rank),r.enabled!==void 0&&(e.enabled=r.enabled),r.interactive!==null&&(e.options.interactive=r.interactive),e}l(uv,"translateLabelStateToGeojsonCore");function cv(r,t){let e={options:{}};if(!e.options)throw new Error("options should exist");return r.rank!=null&&(r.rank==="initial"?e.options.rank=t.initialRank||2:e.options.rank=r.rank),r.enabled!==void 0&&(e.enabled=r.enabled),r.interactive!==null&&(e.options.interactive=r.interactive),e}l(cv,"translateMarkerStateToGeojsonCore");function pv(r,t){let e={};return t==null||(r.color&&(r.color==="initial"?e.color=t.initialColor:e.color=r.color),r.hoverColor&&(e.hoverColor=r.hoverColor),r.interactive!==void 0&&(e.interactive=r.interactive),r.visible!==void 0&&(e.visible=r.visible)),e}l(pv,"translateSpaceStateToGeojsonCore");function hv(r,t){return((t-r+Math.PI)%(Math.PI*2)+Math.PI*2)%(Math.PI*2)-Math.PI}l(hv,"differenceBetweenAngles");function dv(r,t){let e="Left";return r<=-Math.PI/4?e="Right":r<=-t?e="SlightRight":r<=t?e="Straight":r<=Math.PI/4?e="SlightLeft":e="Left",e}l(dv,"getRelativeBearing");function fv(r){let t={};for(let e in r){let i=r[e];if(i!=null){if(i.id=e,"polygons"in i)for(let n of i.polygons)t[n]=i;else if("lineStrings"in i)for(let n of i.lineStrings)t[n]=i;else if("points"in i)for(let n of i.points)t[n]=i}}return t}l(fv,"extractStyleMap");function Nd(r,t){return r.reduce((e,i)=>{let n=t[i.properties.id];return n==null||(e.has(n)||e.set(n,[]),e.get(n).push(i)),e},new Map)}l(Nd,"groupGeometryByStyle");function Ta(r,t={}){var n,o,a,u,s,p;let e={...r},i=(o=(n=t==null?void 0:t.style)==null?void 0:n.shading)!=null?o:t==null?void 0:t.shadingAndOutlines;if(i===!0?e.shading={start:.1,end:.15,intensity:.4}:typeof i=="object"&&(e.shading={start:i.start,end:i.end,intensity:i.intensity}),e.outline=(u=(a=t==null?void 0:t.style)==null?void 0:a.outlines)!=null?u:t==null?void 0:t.shadingAndOutlines,"lineStrings"in r){let f=(p=(s=t==null?void 0:t.style)==null?void 0:s.wallTopColor)!=null?p:t==null?void 0:t.wallTopColor;f!=null&&(e.topColor=f)}return e}l(Ta,"translateToCoreStyle");var mv=Math.PI*.1,$t,Je,ye,vu,yv,Ia,kd,bu,gv,Rd=class Rd{constructor(t,e){P(this,vu);P(this,Ia);P(this,bu);P(this,$t,{});P(this,Je,void 0);P(this,ye,void 0);E(this,Je,e),E(this,ye,t.features),E(this,Je,e),E(this,ye,t.features)}get coordinates(){return c(this,$t).coordinates?c(this,$t).coordinates:(c(this,$t).coordinates=c(this,ye).map(t=>new Q(t.geometry.coordinates[1],t.geometry.coordinates[0],t.properties.groupBy)),c(this,$t).coordinates)}get distance(){return c(this,$t).distance?c(this,$t).distance:(c(this,$t).distance=c(this,ye).reduce((t,e)=>t+(e.properties.distance||0),0),c(this,$t).distance)}get instructions(){if(c(this,ye).length<2)return[];if(c(this,$t).instructions)return c(this,$t).instructions;let t=[],e=0;for(let i=0;i<c(this,ye).length;i++){let n=c(this,ye)[i],o=c(this,ye)[i-1],a=c(this,ye)[i+1],u=new Q(n.geometry.coordinates[1],n.geometry.coordinates[0],n.properties.groupBy),s=Y(this,vu,yv).call(this,{prevDirection:o,direction:n,nextDirection:a});e+=(o==null?void 0:o.properties.distance)||0;for(let p of s)p&&(t.push({action:p,distance:e,coordinate:u}),e=0)}return c(this,$t).instructions=t,c(this,$t).instructions}};$t=new WeakMap,Je=new WeakMap,ye=new WeakMap,vu=new WeakSet,yv=l(function(t){let{prevDirection:e,direction:i,nextDirection:n}=t,o=e&&c(this,Je).getById("floor",e.properties.groupBy),a=c(this,Je).getById("floor",i.properties.groupBy),u=n&&c(this,Je).getById("floor",n.properties.groupBy),s=[];if(e||s.push({type:"Departure"}),u&&a.id!==u.id){let p=c(this,Je).getMVFFeatureByNodeId("connection",i.properties.id);s.push(Y(this,Ia,kd).call(this,"TakeConnection",a,u,p==null?void 0:p.type))}else if(o&&o.id!==a.id){let p=c(this,Je).getMVFFeatureByNodeId("connection",i.properties.id);s.push(Y(this,Ia,kd).call(this,"ExitConnection",a,o,p==null?void 0:p.type))}else s.push(Y(this,bu,gv).call(this,e,i));return n||s.push({type:"Arrival"}),s},"#getActions"),Ia=new WeakSet,kd=l(function(t,e,i,n){let o=e.elevation-i.elevation,a="none";return o>0?a="down":o<0&&(a="up"),{type:t,fromFloor:e,toFloor:i,direction:a,connectionType:n!=null?n:"stairs"}},"#createConnectionAction"),bu=new WeakSet,gv=l(function(t,e){let i=t?-hv(t.properties.angle,e.properties.angle):0;return Math.abs(i)>=mv?{type:"Turn",bearing:dv(i,mv),referencePosition:"At"}:null},"#createTurnAction"),l(Rd,"Directions");var yu=Rd,Bd=class Bd{navigator;connections;constructor({nodes:t,obstructions:e,connections:i,groupBy:n}){this.navigator=new wa({nodes:t,obstructions:this.createObstructionCollection(e),groupBy:n}),this.connections=i}getDirections=(t,e,i,n)=>{let{accessible:o,smoothing:{enabled:a,radius:u}}=i,s=t.flatMap(x=>this.getNodesFromTarget(x,n)),p=e.flatMap(x=>this.getNodesFromTarget(x,n)),f=this.getExcludedNodeIds(o).filter(x=>!s.includes(x)&&!p.includes(x)),m=this.navigator.getDirections({originIds:s,destinationNodeIds:p,excludedNodeIds:f,simplify:{enabled:a,bufferRadius:u}});this.addCoordinateDirections(m,t,e);let y=new yu(m,n);if(!(y.distance===0&&new Set([...s,...p]).size===s.length+p.length))return y};getExcludedNodeIds=t=>t?this.connections.reduce((e,i)=>i.accessible?e:e.concat(i.nodes),[]):[];addCoordinateDirections=(t,[e],[i])=>{if(t.features.length){if(Q.is(e)){let n=this.createDirectionFeature(e,this.navigator.getAngle([e.longitude,e.latitude],t.features[0].geometry.coordinates),this.navigator.getDistance([e.longitude,e.latitude],t.features[0].geometry.coordinates));t.features.splice(0,0,n)}if(Q.is(i)){let n=this.createDirectionFeature(i,0,0),o=t.features[t.features.length-1];o.properties.distance=this.navigator.getDistance(o.geometry.coordinates,[i.longitude,i.latitude]),o.properties.angle=this.navigator.getAngle(o.geometry.coordinates,[i.longitude,i.latitude]),t.features.push(n)}}};getNodesFromTarget=(t,e)=>{if(Q.is(t)){let i=this.navigator.findNearestNode(this.createCoordinateFeature(t));return i?[i.properties.id]:[]}else if(zr.is(t)){let i=this.navigator.findNearestNode(this.createCoordinateFeature(t.coordinate));return i?[i.properties.id]:[]}else if(Ur.is(t)){let i=this.navigator.findNearestNode(this.createCoordinateFeature(t.center));return i?[i.properties.id]:[]}else if(_e.is(t)){let i=e==null?void 0:e.getMVFFeatureById("space",t.id);return i==null?[]:i.properties.destinationNodes}else{if(qr.is(t))return t.coordinates.reduce((i,n)=>{let o=this.navigator.findNearestNode(this.createCoordinateFeature(n));return o&&i.push(o.properties.id),i},[]);if(De.is(t)){let i=e==null?void 0:e.objectEntranceNodeIdsByObstructionId[t.id];return i!=null?i:[]}else return[]}};createObstructionCollection(t){return{type:"FeatureCollection",features:Object.entries(t).reduce((e,[i,n])=>e.concat(n.features.map(o=>(o.properties.map=i,o))),[])}}createCoordinateFeature=t=>({type:"Feature",geometry:{type:"Point",coordinates:[t.longitude,t.latitude]},properties:{map:t.floorId}});createDirectionFeature=(t,e,i)=>({type:"Feature",geometry:{type:"Point",coordinates:[t.longitude,t.latitude]},properties:{groupBy:t.floorId,id:t.id,angle:e,distance:i}})};l(Bd,"DirectionsInternal");var gu=Bd;d();var Jn,Fd=class Fd{constructor({currentMapGetter:t}){P(this,Jn,void 0);E(this,Jn,t)}get currentMap(){return c(this,Jn).call(this)}async getCurrentSceneGLTF(t){let e=c(this,Jn).call(this);return e?e==null?void 0:e.Exporter.getCurrentSceneGLTF(t):(G.error("There is no map to export. Please load a map first."),new Blob)}};Jn=new WeakMap,l(Fd,"Exporter");var Ea=Fd;d();var Ke,_a,Gd=class Gd{constructor({currentMapGetter:t}){P(this,Ke,new Map);P(this,_a,void 0);E(this,_a,t)}get currentMap(){return c(this,_a).call(this)}getById(t){return c(this,Ke).get(t)}add(t,e,i){let n=$e(t);if(!n)throw new Error("get coordinate failed");let o=this.currentMap;if(!o)throw new Error("currentMap should exist");let a=o.Labels.add(ri(n),e,{...i,floorId:n.floorId,rank:(i==null?void 0:i.rank)||"medium"}),u=new Qr(a.id.toString(),e);return c(this,Ke).set(u.id,{label:u,entityId:u.id}),u}all(){var e;let t=[];return(e=this.currentMap)==null||e.Labels.all({onCreate:(i,n)=>{let o=new Qr(i.toString(),n);c(this,Ke).set(o.id,{label:o,entityId:o.id}),t.push(o)}}),t}remove(t){var i;let e=c(this,Ke).get(t.id);e&&((i=this.currentMap)==null||i.Labels.remove(e.entityId),c(this,Ke).delete(t.id.toString()))}removeAll(){let t=[];return c(this,Ke).forEach(({label:e})=>{this.remove(e),t.push(e),c(this,Ke).delete(e.id.toString())}),t}};Ke=new WeakMap,_a=new WeakMap,l(Gd,"Labels");var La=Gd;d();d();d();var Da={auto:!0,debug:!1,pitch:45,bearing:0,antialiasing:{enabled:!0},shadingAndOutlines:!0,outdoorView:{layersHiddenByGeometry:["building","building-top"]}},Xi="ExteriorWalls",Cu="Walls";var vv={altitude:0,height:1,color:"#ffffff",opacity:1,width:.15},Vd=class Vd{id;name;elevation;containerId;loaded=!1;styleMap={};obstructions;entrances;spaces;renderer;options;layers=new Map;constructor(t,e,i,n,o,a){this.id=e.id,this.options=n;let u=i.addGroupContainer(this.id,{visible:!1,interactive:!0},t);this.containerId=u.id.toString(),this.name=e.externalId,this.elevation=e.elevation,o!=null&&a!=null&&(this.styleMap=a,this.spaces=o.space[this.id],this.entrances=o.entrance[this.id],this.obstructions=o.obstruction[this.id]),this.renderer=i}load=()=>{var t,e;if(this.loaded||this.obstructions==null&&this.spaces==null)return this;if(this.loaded=!0,this.spaces!=null&&this.spaces.features.length>0){let i=this.spaces.features.filter(u=>{var s;return u.geometry.type==="Polygon"&&((s=u.properties.kind)==null?void 0:s.toLowerCase())!=="void"}),n=Nd(i,this.styleMap),o=this.renderer.addGroupContainer(`spaces-${this.id}`,{},this.id),a=0;for(let[u,s]of n){let p=this.renderer.addGeometryGroup(`Spaces-${this.id}-${a}`,{features:s},Ta(u,this.options),o);a++;let f=p.id.toString();this.layers.set(u.id||f,p.id.toString())}}if(this.obstructions!=null&&this.obstructions.features.length>0){let i=this.obstructions.features.filter(y=>y.geometry.type==="Polygon"&&y.properties.kind==="object"),n=Nd(i,this.styleMap),o=this.renderer.addGroupContainer(`objects-${this.id}`,{},this.id),a=0;for(let[y,x]of n){let S=this.renderer.addGeometryGroup(`Objects-${this.id}-${a}`,{features:x},Ta(y,this.options),o);a++;let M=S.id.toString();this.layers.set(y.id||M,M)}let u=this.obstructions.features.filter(y=>y.geometry.type==="LineString"&&y.properties.kind==="Wall"&&y.properties.footprintComponent===!1),s=this.obstructions.features.filter(y=>y.geometry.type==="LineString"&&y.properties.kind==="Wall"&&y.properties.footprintComponent===!0),p=this.entrances,f=vv,m=vv;if(u!=null&&u.length>0){let y=this.styleMap[(t=u[0].properties)==null?void 0:t.id];y!=null&&(f={...y}),m=f;let x=this.renderer.addGeometryGroup(`Walls-${this.id}`,{features:[Ad(u,(p==null?void 0:p.features)||[])]},Ta(f,this.options),this.id),S=x.id.toString();this.layers.set(f.id||S,x.id.toString())}if(s!=null&&s.length>0){let y=this.styleMap[(e=s[0].properties)==null?void 0:e.id];y!=null&&(m={...y,id:Xi});let x=this.renderer.addGeometryGroup(`ExteriorWalls-${this.id}`,{features:[Ad(s,(p==null?void 0:p.features)||[])]},Ta(m,this.options),this.id),S=x.id.toString();this.layers.set(m.id||S,x.id.toString())}}return this.renderer.render(),this}};l(Vd,"FloorObject");var xu=Vd;var cn=Ar(Kn());d();d();d();d();(function(){typeof globalThis!="object"&&(Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__)})();d();d();d();var a9="#ffffff",ii,jd=class jd{constructor(t={}){v(this,"color",a9);v(this,"topColor");v(this,"opacity",1);P(this,ii,void 0);v(this,"outline",!0);var e,i;this.color=(e=t==null?void 0:t.color)!=null?e:this.color,this.topColor=t==null?void 0:t.topColor,this.opacity=(i=t==null?void 0:t.opacity)!=null?i:this.opacity,this.shading=t==null?void 0:t.shading,this.outline=(t==null?void 0:t.outline)!==void 0?!!t.outline:this.outline}get shading(){return c(this,ii)}set shading(t){var e;if(!t){E(this,ii,void 0);return}E(this,ii,(e=c(this,ii))!=null?e:{start:0,end:0,intensity:0}),Object.assign(c(this,ii),t)}};ii=new WeakMap,l(jd,"GeometryGroupStyleComponent");var Yi=jd;var Wd=class Wd extends Te{visible=!0;type="geometry-group";components;userData={entityId:"",entities3D:new Set,opacity:1,dirty:!0,outlineDirty:!0,shadingDirty:!0};setVisible(t){this.visible=t,this.dispatchEvent({type:"childremoved",child:this})}getOpacity(){return this.userData.opacity}setOpacity(t){this.userData.opacity=t}removeEntity(){this.dispatchEvent({type:"childremoved",child:this})}constructor(t,e=new Yi){super(),this.components=[e],this.userData.entityId=t}};l(Wd,"GeometryGroupObject3D");var Bt=Wd;d();var Ud=class Ud extends Te{};l(Ud,"Geometry2DObject3D");var Qn=Ud,Zd=class Zd{id;get type(){return this.components[0].type}get parent(){return this.object3d.parent}positionDirty=!0;object3d=new Qn;components;disposed=!1;constructor(t,e){this.id=t.id||ut(),this.components=[t],this.object3d=new Qn,this.object3d.position.copy(e),this.object3d.userData.entityId=this.id,this.object3d.userData.type=this.type}worldPosition=new W;get position(){return this.object3d.getWorldPosition(this.worldPosition),this.worldPosition}};l(Zd,"Geometry2D");var ge=Zd;d();var zd=class zd extends Te{userData={entityId:"",type:"geometry"}};l(zd,"Geometry3DObject3D");var Qe=zd,qd=class qd{id=ut();components;get object3d(){return this.components[0].mesh}get parent(){var t;return(t=this.components[0].mesh)==null?void 0:t.parent}get type(){return this.components[0].type}constructor(t,e){this.components=[t,e]}};l(qd,"Geometry3D");var dt=qd;var Oa=class Oa extends Te{childrenIds=new Set;type="group-container";userData={entityId:"",entities2D:new Set,dirty:!0};components=[];constructor(t){super(),this.userData.entityId=t}addEntity(t){t instanceof Oa?(this.childrenIds.add(t.userData.entityId),this.add(t)):t instanceof ge?(this.childrenIds.add(t.id),this.add(t.object3d),this.userData.entities2D.add(t.id)):t instanceof Bt?(this.childrenIds.add(t.userData.entityId),this.add(t)):t instanceof dt&&t.object3d&&(this.childrenIds.add(t.id),this.add(t.object3d)),this.dispatchEvent({type:"childadded",child:this})}removeEntity(t){t instanceof Oa?(this.childrenIds.delete(t.userData.entityId),this.remove(t)):t instanceof ge?(this.childrenIds.delete(t.id),this.userData.entities2D.delete(t.id),this.remove(t.object3d)):t instanceof Bt?(this.childrenIds.delete(t.userData.entityId),this.remove(t)):t instanceof dt&&t.object3d&&(this.childrenIds.delete(t.id),this.add(t.object3d)),this.dispatchEvent({type:"childremoved",child:this})}setVisible(t){this.visible=t,this.dispatchEvent({type:"childremoved",child:this})}setAltitude(t){this.position.z=t,this.dispatchEvent({type:"childremoved",child:this})}get altitude(){return this.position.z}};l(Oa,"GroupContainerObject3D");var Pt=Oa;d();var bv=!1;function Cv(){bv=!0}l(Cv,"enableTestMode");var $d=class $d{backgroundAlpha=1;backgroundColor=new Tt;width=0;height=0;options={};renderer;constructor(t,e=2){try{this.options=t;let i={canvas:t.canvas,alpha:t.alpha||!1,stencil:!1,antialias:typeof t.antialias=="boolean"?t.antialias:!0,outputColorSpace:mi,powerPreference:"high-performance",preserveDrawingBuffer:!0};bv?(this.renderer={setSize:()=>{},state:{reset:()=>{}},properties:{get:()=>{}},getSize:()=>({width:window.innerWidth,height:innerHeight}),getDrawingBufferSize:()=>({width:window.innerWidth,height:innerHeight}),getClearAlpha:()=>1,getClearColor:()=>new Tt,autoUpdate:!0,shadowMap:{autoUpdate:!0},getContext:()=>({getContextAttributes(){return{alpha:!0,antialias:!1,depth:!0,stencil:!1}}}),setRenderTarget:()=>{},setClearColor:()=>{},clear:()=>{},render:()=>{},domElement:document.createElement("canvas"),capabilities:{isWebGL2:!0}},this.renderer.domElement.style.width="1920px",Object.defineProperty(this.renderer.domElement,"clientWidth",{value:1920}),this.renderer.domElement.style.height="1080px",Object.defineProperty(this.renderer.domElement,"clientHeight",{value:1080})):this.renderer=e===2?new u1(i):new c1(i),this.backgroundColor=new Tt,this.backgroundAlpha=1}catch(i){G.error(i),t.onWebGLRendererError&&t.onWebGLRendererError(i)}}destroy(){var t,e;this.renderer&&((e=(t=this.renderer).dispose)==null||e.call(t))}render(t,e){this.renderer&&(this.renderer.state.reset(),e.layers.enable(0),e.layers.enable(1),this.renderer.autoClear=!1,this.renderer.setRenderTarget(null),this.renderer.render(t,e),this.renderer.state.reset())}clear(){this.renderer&&(this.renderer.setClearColor(this.backgroundColor,this.backgroundAlpha),this.renderer.clear())}setBufferSize(t,e){b.env.NODE_ENV==="test"||!this.renderer||(this.width=t,this.height=e,this.renderer.setSize(t,e,!1))}setBackgroundColor(t,e){this.backgroundColor=t,this.backgroundAlpha=e}domElement(){var t;return(t=this.renderer)==null?void 0:t.domElement}};l($d,"Renderer");var Su=$d;d();d();var ni=63710088e-1,xv=-85.051129,Sv=85.051129,Mu=1e4,Jd={chain:"chain",cancel:"cancel"},Kd=Math.PI*2,Aa=100,Mv=1e4,Qd=0,tf=22;var ef=["change","pan-start","pan-end","rotate-start","rotate-end","zoom-start","zoom-end","multi-start","multi-end","multi-cancel","pedestal-start","pedestal-change","pedestal-end","user-pan-start","user-pedestal-start","user-rotate-start","user-dolly-start","user-zoom-start","user-tilt-start","user-pan-end","user-pedestal-end","user-rotate-end","user-dolly-end","user-zoom-end","user-tilt-end","position-updated","zoom-updated","tilt-updated","rotation-updated"];d();var Na="mappedin";d();function oi(){return typeof window>"u"?1:Math.min(window.devicePixelRatio,2)}l(oi,"getPixelRatio");d();var s9=(()=>{let r;return{getDeviceType(){if(r)return r;let{userAgent:t,platform:e,maxTouchPoints:i}=window.navigator,n=/(iphone|ipod|ipad)/i.test(t),o=e==="iPad"||e.indexOf("Mac")===0&&i>0&&!window.MSStream,a=/android/i.test(t);return r={isIpad:o,isMobile:a||n||o,isSafari12:/Version\/12.+Safari/.test(t),isFirefox:/Firefox/.test(t),isWindows:/windows/i.test(t)},r},_reset(){r=void 0}}})(),wv=s9.getDeviceType,Tv=(()=>{let r,t,e;function i(){if(t!==void 0)return t;r||(r=document.createElement("canvas"));let o=r.getContext("webgl")||r.getContext("experimental-webgl");if(!o)return t;try{let a=wv().isFirefox?null:o.getExtension("WEBGL_debug_renderer_info");return t=a?o.getParameter(a.UNMASKED_RENDERER_WEBGL):o.getParameter(o.RENDERER),t}catch{let u=new Error("Failed getting device info");throw u.name="FailedGettingDeviceInfo",u}}l(i,"getInfo");function n(){var a,u;if(!wv().isWindows)return!1;if(e!==void 0)return e;let o=(u=(a=l9())==null?void 0:a.toLowerCase())!=null?u:"";return e=o.includes("intel")&&(o.includes("uhd")||o.includes("iris")),e}return l(n,"shouldDisableOffscreenCanvas"),{getInfo:i,shouldDisableOffscreenCanvas:n,_setCanvas(o){r=o,t=void 0,e=void 0}}})(),l9=Tv.getInfo,rf=Tv.shouldDisableOffscreenCanvas;d();function Pu(r,t,e,i){let n=r*(Math.PI/180),o=i/ni,a=r+o*180/Math.PI,u=e/ni/Math.cos(n),s=t+u*180/Math.PI;return{lat:a,lon:s}}l(Pu,"cartesianToGeographic");function wu(r,t,e,i){let n=e*(Math.PI/180),o=i*(Math.PI/180),a=r*(Math.PI/180),u=t*(Math.PI/180),s=n-a,p=o-u,f=ni*p*Math.cos(a),m=ni*s;return{x:f,y:m}}l(wu,"geographicToCartesian");var nf=l((r,t=[])=>{var e;if(r.children&&r.visible)for(let i of r.children){if(i.visible)if((e=i.userData)!=null&&e.entities3D&&i.type==="geometry-group"){t.push(i.userData.entityId);for(let n of i.userData.entities3D.values())t.push(n)}else(i.type==="group-container"||i.type==="custom-geometry"||i instanceof Qe)&&t.push(i.userData.entityId);nf(i,t)}return t},"extract3DEntitiesFromTree"),of=l((r,t)=>{var e;if(r.children&&r.visible&&!((e=r.userData)!=null&&e.hidden))for(let i of r.children)i.visible&&i instanceof Qn&&t.add(i.userData.entityId),of(i,t);return t},"extractEntitiesFromTree");function af(r,t){for(let e in t){if(t[e]==null){r[e]=void 0;continue}typeof t[e]=="object"?af(r[e],t[e]):r[e]=t[e]}return r}l(af,"mergeObjects");function Tu(r,t,e,i){let n={translateX:r.x,translateY:r.y,translateZ:r.z,scale:r.meterInMercatorCoordinateUnits()},o=new pr,a=new W(n.scale,-n.scale,n.scale),u=new pr().makeTranslation(n.translateX,n.translateY,n.translateZ).scale(a);return{id:Na,type:"custom",renderingMode:"3d",render:(s,p)=>{if(o.fromArray(p),e.elevation>0){let f=qs.fromLngLat(r.toLngLat(),e.elevation);u.makeTranslation(n.translateX,n.translateY,-f.z).scale(a)}t.projectionMatrix=o.multiply(u),i()}}}l(Tu,"createCustomLayer");function u9(r){return fetch(r,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({grant_type:"client_credentials"})})}l(u9,"fetchToken");async function Iv(r){let t=await u9(r),{access_token:e}=await t.json();return{"x-mappedin-tiles-key":e}}l(Iv,"getRequestHeaders");function Ev(r,t=0){let e=3735928559^t,i=1103547991^t;for(let n=0,o;n<r.length;n++)o=r.charCodeAt(n),e=Math.imul(e^o,2654435761),i=Math.imul(i^o,1597334677);return e=Math.imul(e^e>>>16,2246822507)^Math.imul(i^i>>>13,3266489909),i=Math.imul(i^i>>>16,2246822507)^Math.imul(e^e>>>13,3266489909),4294967296*(2097151&i)+(e>>>0)}l(Ev,"cyrb53");var c9=l(r=>r,"linearEase");function pe(r,t,e,i,n,o=c9){r=Math.max(t,Math.min(r,e));let a=(r-Math.min(t,e))/Math.abs(e-t),u=o(a);return i+u*(n-i)}l(pe,"interpolate");function sf(r,t,e){let i=r*(Math.PI/180)/2,n=t/2;return e*Math.tan(i)/n}l(sf,"getProjectionScaleFactor");function ka(r,t){let e;return typeof t=="string"||typeof t=="number"?(e=r.entity2DMap.get(t),e==null&&(e=r.entity3DMap.get(t))):typeof(t==null?void 0:t.id)=="string"||typeof(t==null?void 0:t.id)=="number"?(e=r.entity2DMap.get(t.id),e==null&&(e=r.entity3DMap.get(t.id))):e=t,e}l(ka,"getGeometryByGeometryId");function Lv(r){return new b1(new Fc(r[0][0],r[0][1]),new Fc(r[1][0],r[1][1])).getCenter().toArray()}l(Lv,"getBoundingBoxCenter");d();d();var _v=`"use strict";(()=>{function _(n,e){return e.x+e.w<n.x+n.w&&e.x>n.x&&e.y>n.y&&e.y+e.h<n.y+n.h}function A(n,e){let[t,o]=e;return t>=n.x&&t<=n.x+n.w&&o>=n.y&&o<=n.y+n.h}function j(n,e){let t=e.x,o=e.y,i=e.x+e.w,l=e.y+e.h,c=n.x,f=n.y,k=n.x+n.w,P=n.y+n.h;return t<k&&c<i&&o<P&&f<l}function a(n,e){for(let t=0;t<e.length;t++)n.push(e[t])}var w=4,s=class{x;y;w;h;userData;constructor(e,t,o,i,l){let c=typeof window>"u"?2:window.devicePixelRatio;this.userData=typeof l>"u"?null:l,this.x=e-w,this.y=t-w,this.w=o+w*Math.min(c,2),this.h=i+w*Math.min(c,2)}contains(e){return e===this?!1:_(this,e)}intersects(e){return j(this,e)}intersectsPoint(e){return A(this,e)}draw(e){e.fillStyle="rgba(123,222,26, 0.5)",e.fillRect(this.x,this.y,this.w,this.h)}};var x=class n{topLeft;topRight;bottomLeft;bottomRight;divided=!1;boundary;capacity=16;objects=[];parent;constructor(e,t){this.parent=t,this.boundary=e}getSize(){return this.divided?this.objects.length+this.topLeft.getSize()+this.topRight.getSize()+this.bottomLeft.getSize()+this.bottomRight.getSize():this.objects.length}subdivide(){let{x:e,y:t,w:o,h:i}=this.boundary;this.topLeft=new n(new s(e,t,o/2,i/2),this),this.topRight=new n(new s(e+o/2,t,o/2,i/2),this),this.bottomLeft=new n(new s(e,t+i/2,o/2,i/2),this),this.bottomRight=new n(new s(e+o/2,t+i/2,o/2,i/2),this),this.divided=!0}queryRect(e){let t=[];if(this.boundary.intersects(e))t.push(...this.objects);else return[];return this.divided&&(a(t,this.topLeft.queryRect(e)),a(t,this.topRight.queryRect(e)),a(t,this.bottomLeft.queryRect(e)),a(t,this.bottomRight.queryRect(e))),t}queryPoint(e){let t=[];if(this.boundary.intersectsPoint(e))t.push(...this.objects);else return[];return this.divided&&(a(t,this.topLeft.queryPoint(e)),a(t,this.topRight.queryPoint(e)),a(t,this.bottomLeft.queryPoint(e)),a(t,this.bottomRight.queryPoint(e))),t}insert(e){return this.boundary.contains(e)?this.objects.length<this.capacity?(this.objects.push(e),!0):(this.divided||this.subdivide(),(this.topLeft.insert(e)||this.topRight.insert(e)||this.bottomLeft.insert(e)||this.bottomRight.insert(e))===!1&&this.objects.push(e),!0):!1}drawObjects(e){this.objects.forEach(t=>t.draw(e)),this.divided&&(this.topLeft.drawObjects(e),this.topRight.drawObjects(e),this.bottomLeft.drawObjects(e),this.bottomRight.drawObjects(e))}draw(e){e.rect(this.boundary.x,this.boundary.y,this.boundary.w,this.boundary.h),this.divided&&(this.topLeft.draw(e),this.topRight.draw(e),this.bottomLeft.draw(e),this.bottomRight.draw(e)),e.strokeStyle="black",e.lineWidth=4,e.stroke()}};var d=200,I=10;function q(n,e,t,o="-1"){let i=1/0,l=1/0,c=-1/0,f=-1/0,k=new s(-I,0,5,t),P=new s(-I,0,e,5),X=new s(e-5,0,e+I,t),O=new s(0,t-5,e,t+I),K=[k,P,X,O],N=new s(-d,-d,e+d*2,t+d*2);for(let r of n)for(let b=0;b<r.bboxes.length;b++){let{boundingBox:R}=r.bboxes[b],[h,T,u,p]=R,[S,m,B,W]=[r.y-h,r.y+T,r.x-u,r.x+p],L=B,v=S,E=W-B,M=m-S;i=Math.min(i,L)-d,l=Math.min(l,v)-d,c=Math.max(c,L+E)+d,f=Math.max(f,v+M)+d,r.bboxes[b].boundingRect=new s(L,v,E,M)}let g={msgId:o,colliders:new Array(n.length),debug:[]},C=new x(new s(i,l,c-i,f-l)),y;for(let r=0;r<n.length;r++)if(y=n[r],g.colliders[r]=[-1,!1],y.enabled){let[b,R,h]=[1/0,-1,void 0];for(let{index:T,boundingRect:u}of y.bboxes){let p=[];if(p=C.queryRect(u).filter(m=>u.intersects(m)),y.shouldCollideWithScreenEdges&&K.forEach(m=>{u.intersects(m)&&p.push(m)}),p.length<=b&&(h=u,R=T,b=p.length),p.length===0){C.insert(u),g.colliders[r]=[T,!N.contains(u),u];break}}y.rank===5&&h!=null&&(C.insert(h),g.colliders[r]=[R,!N.contains(h),h])}else g.colliders[r]=[-1,!1];return g}function z(n){let e=n[0].map(t=>{let o=t[0].map((i,l)=>({index:l,boundingBox:[i[0],i[1],i[2],i[3]]}));return{enabled:t[1]===1,rank:t[2]===1?5:0,x:t[3],y:t[4],bboxes:o}});return{msgId:"-1",totalWidth:n[3],totalHeight:n[2],colliders:e,devicePixelRatio:n[1]}}self.onmessage=n=>{let e=z(n.data);self.postMessage(q(e.colliders,e.totalWidth,e.totalHeight,e.msgId))};})();
443
+ `;d();d();d();d();d();function Dv(r,t){return t.x+t.w<r.x+r.w&&t.x>r.x&&t.y>r.y&&t.y+t.h<r.y+r.h}l(Dv,"contains");d();function Ov(r,t){let[e,i]=t;return e>=r.x&&e<=r.x+r.w&&i>=r.y&&i<=r.y+r.h}l(Ov,"intersectPoint");d();function Av(r,t){let e=t.x,i=t.y,n=t.x+t.w,o=t.y+t.h,a=r.x,u=r.y,s=r.x+r.w,p=r.y+r.h;return e<s&&a<n&&i<p&&u<o}l(Av,"intersects");d();function Pr(r,t){for(let e=0;e<t.length;e++)r.push(t[e])}l(Pr,"appendItems");d();var Iu=4,lf=class lf{x;y;w;h;userData;constructor(t,e,i,n,o){let a=typeof window>"u"?2:window.devicePixelRatio;this.userData=typeof o>"u"?null:o,this.x=t-Iu,this.y=e-Iu,this.w=i+Iu*Math.min(a,2),this.h=n+Iu*Math.min(a,2)}contains(t){return t===this?!1:Dv(this,t)}intersects(t){return Av(this,t)}intersectsPoint(t){return Ov(this,t)}draw(t){t.fillStyle="rgba(123,222,26, 0.5)",t.fillRect(this.x,this.y,this.w,this.h)}};l(lf,"Rectangle");var Dt=lf;var ji=class ji{topLeft;topRight;bottomLeft;bottomRight;divided=!1;boundary;capacity=16;objects=[];parent;constructor(t,e){this.parent=e,this.boundary=t}getSize(){return this.divided?this.objects.length+this.topLeft.getSize()+this.topRight.getSize()+this.bottomLeft.getSize()+this.bottomRight.getSize():this.objects.length}subdivide(){let{x:t,y:e,w:i,h:n}=this.boundary;this.topLeft=new ji(new Dt(t,e,i/2,n/2),this),this.topRight=new ji(new Dt(t+i/2,e,i/2,n/2),this),this.bottomLeft=new ji(new Dt(t,e+n/2,i/2,n/2),this),this.bottomRight=new ji(new Dt(t+i/2,e+n/2,i/2,n/2),this),this.divided=!0}queryRect(t){let e=[];if(this.boundary.intersects(t))e.push(...this.objects);else return[];return this.divided&&(Pr(e,this.topLeft.queryRect(t)),Pr(e,this.topRight.queryRect(t)),Pr(e,this.bottomLeft.queryRect(t)),Pr(e,this.bottomRight.queryRect(t))),e}queryPoint(t){let e=[];if(this.boundary.intersectsPoint(t))e.push(...this.objects);else return[];return this.divided&&(Pr(e,this.topLeft.queryPoint(t)),Pr(e,this.topRight.queryPoint(t)),Pr(e,this.bottomLeft.queryPoint(t)),Pr(e,this.bottomRight.queryPoint(t))),e}insert(t){return this.boundary.contains(t)?this.objects.length<this.capacity?(this.objects.push(t),!0):(this.divided||this.subdivide(),(this.topLeft.insert(t)||this.topRight.insert(t)||this.bottomLeft.insert(t)||this.bottomRight.insert(t))===!1&&this.objects.push(t),!0):!1}drawObjects(t){this.objects.forEach(e=>e.draw(t)),this.divided&&(this.topLeft.drawObjects(t),this.topRight.drawObjects(t),this.bottomLeft.drawObjects(t),this.bottomRight.drawObjects(t))}draw(t){t.rect(this.boundary.x,this.boundary.y,this.boundary.w,this.boundary.h),this.divided&&(this.topLeft.draw(t),this.topRight.draw(t),this.bottomLeft.draw(t),this.bottomRight.draw(t)),t.strokeStyle="black",t.lineWidth=4,t.stroke()}};l(ji,"QuadTree");var tr=ji;d();d();var Nv=["","","low","medium","high","always-visible"];function kv(r){return Math.min(5,Math.max(2,r))}l(kv,"clampTierNumber");function to(r){if(typeof r=="number")return kv(r);let t=Nv.indexOf(r);return t===-1?3:t}l(to,"convertCollisionRankingTierToNumber");function Ra(r){let t=kv(r);return Nv[t]}l(Ra,"convertNumberToCollisionRankingTier");function Rv(r,t,e){let i,n,o,a=null,u=0;e||(e={});let s=l(function(){u=e.leading===!1?0:Date.now(),a=null,o=r.apply(i,n),a||(i=n=null)},"later");return function(){let p=Date.now();!u&&e.leading===!1&&(u=p);let f=t-(p-u);return i=globalThis,n=arguments,f<=0||f>t?(a&&(clearTimeout(a),a=null),u=p,o=r.apply(i,n),a||(i=n=null)):!a&&e.trailing!==!1&&(a=setTimeout(s,f)),o}}l(Rv,"throttle");function Bv(r){return[r.bboxes.map(e=>[e.boundingBox[0],e.boundingBox[1],e.boundingBox[2],e.boundingBox[3]]),r.enabled?1:0,r.rank===5?1:0,r.x,r.y]}l(Bv,"packCollider");var Wi=!1,p9=150,cf=class cf extends J{worker;debugContext;debugCanvas;dirty=!0;packedMessage=[[],0,0,0];visibleCollidersQTree=new tr(new Dt(0,0,0,0));interactiveCollidersQTree=new tr(new Dt(0,0,0,0));coreState;constructor(t,e,i=new Worker(URL.createObjectURL(new Blob([_v],{type:"text/javascript"})))){super(),this.coreState=e,this.debugCanvas=t,this.debugContext=t.getContext("2d"),this.worker=i,this.worker.onmessage=n=>this.resolve(n),this.postMessage=Rv(this._postMessage,p9,!1),Wi?this.showCollisionBoxes():this.hideCollisionBoxes()}postMessage;showCollisionBoxes=()=>{Wi=!0,this.debugCanvas.style.display="block"};hideCollisionBoxes=()=>{Wi=!1,this.debugContext.clearRect(0,0,this.debugCanvas.width,this.debugCanvas.height),this.debugCanvas.style.display="none"};currentMsgId="";working=!1;_postMessage=()=>{this.worker.postMessage(this.packedMessage)};componentArray=[];update=()=>{if(this.dirty){this.packedMessage=[[],0,0,0],this.componentArray=new Array(this.coreState.entity2DIds.size);let t=0,e;for(let i of this.coreState.entity2DIds){let n=this.coreState.entity2DMap.get(i);n&&(e=n.components[0],this.componentArray[t]=e),t++}this.resize(),this.dirty=!1,this.componentArray.sort((i,n)=>n.rank-i.rank)}else this.componentArray.filter(e=>e.collisionDirty===!0).length>0&&this.componentArray.sort((e,i)=>i.rank-e.rank);for(let t=0;t<this.componentArray.length;t++)this.packedMessage&&(this.componentArray[t].collisionDirty||this.packedMessage[0][t]==null?(this.packedMessage[0][t]=Bv(this.componentArray[t].toJSON()),this.componentArray[t].collisionDirty=!1):(this.packedMessage[0][t][1]=this.componentArray[t].enabled?1:0,this.packedMessage[0][t][2]=this.componentArray[t].rank===5?1:0,this.packedMessage[0][t][3]=this.componentArray[t].projection.x,this.packedMessage[0][t][4]=this.componentArray[t].projection.y));this.working||this.postMessage()};resize(){this.packedMessage[3]=this.debugCanvas.width,this.packedMessage[2]=this.debugCanvas.height}resolve=t=>{if(this.working=!1,this.dirty||!t.data)return;let e=t.data.colliders,i=-1,n=!1,o,a,u;Wi&&(this.visibleCollidersQTree=new tr(new Dt(0,0,this.debugCanvas.width,this.debugCanvas.height))),this.interactiveCollidersQTree=new tr(new Dt(0,0,this.debugCanvas.width,this.debugCanvas.height));for(let s=0;s<this.componentArray.length;s++){let p=this.componentArray[s];e[s]==null||!p.enabled||([i,n,o]=e[s],i!==-1&&!n&&o!=null?(u=new Dt(o.x,o.y,o.w,o.h,{entityId:p.id}),Wi&&this.visibleCollidersQTree.insert(u),a=this.coreState.entity2DMap.get(p.id),(a==null?void 0:a.components[1])!=null&&this.interactiveCollidersQTree.insert(new Dt(o.x,o.y,o.w,o.h,{entityId:p.id})),p.visible===!1&&(p.visible=!0,"visibilityNeedsUpdate"in p&&(p.visibilityNeedsUpdate=!0)),i!==-1&&i!==p.activeStrategyIndex&&(p.activeBoundingBox=u,p.onStrategySelected(i))):(p.visible===!0&&(p.visible=!1,"visibilityNeedsUpdate"in p&&(p.visibilityNeedsUpdate=!0)),i!==-1&&i!==p.activeStrategyIndex&&p.onStrategySelected(i)))}Wi&&this.drawDebug(),this.publish("visibility-changed")};drawDebug=()=>{Wi&&this.visibleCollidersQTree&&(this.debugContext.clearRect(0,0,this.debugCanvas.width,this.debugCanvas.height),this.debugContext.beginPath(),this.visibleCollidersQTree.drawObjects(this.debugContext))};destroy=()=>{this.worker.terminate()}};l(cf,"CollisionSystem");var Eu=cf;d();d();d();d();var hf=class hf{type;event;constructor(t){this.type=0,this.event=t}get timestamp(){return this.event.timeStamp}};l(hf,"Tap");var Lu=hf,df=class df{taps=[];add(t){this.lastPointerDown&&t.timestamp-this.lastPointerDown.timestamp<50?this.lastPointerDown.type=1:this.taps.push(t)}get lastPointerDown(){return this.taps.length>=1?this.taps[this.taps.length-1]:void 0}get isSingleTapWithTwoFingers(){var t;return this.isSingleTap&&((t=this.lastPointerDown)==null?void 0:t.type)===1}get isSingleTapWithOneFinger(){var t;return this.isSingleTap&&((t=this.lastPointerDown)==null?void 0:t.type)===0}get isDoubleTapWithOneFinger(){var t,e;return this.isDoubleTap&&((t=this.taps[0])==null?void 0:t.type)===0&&((e=this.taps[1])==null?void 0:e.type)===0}get isSingleTap(){return this.taps.length===1}get isDoubleTap(){return this.taps.length===2}discardOutsideOfWaitWindow(t){this.taps=this.taps.filter(e=>t-e.timestamp<300)}flush(){this.taps=[]}get _taps(){return this.taps}destroy(){this.flush()}};l(df,"TapsController");var _u=df;d();function Fv(r){let t=new Set;for(let e of r){let i=e.object;for(;i.parent&&!t.has(i.parent);)i=i.parent,i instanceof Pt&&i.type==="group-container"&&i.visible&&i.components[1]&&t.add(i)}return Array.from(t)}l(Fv,"getUniqueIntersectedGroupContainers");function Gv(r,t){if(r==null||t==null)return r===t;if(r.length!==t.length)return!1;for(let e=0;e<r.length;e++)if(r[e]!==t[e])return!1;return!0}l(Gv,"arraysEqual");var eo,ff=class ff extends J{constructor(e,i,n,o){super();v(this,"raycaster",new Rr);v(this,"state",{hovered3DEntity:void 0,hovered2DEntity:void 0,hovered3DContainers:void 0,lastHover:void 0,containerOffset:[0,0],interaction:{mouseDownStart:void 0,distanceFromMouseDown:void 0,isPanning:!1}});v(this,"coreState");v(this,"camera");v(this,"cameraPlane");v(this,"_quadtree",new tr(new Dt(0,0,0,0)));v(this,"_container");v(this,"cursor","grab");v(this,"touchesCount",0);v(this,"hasTouched",!1);P(this,eo,void 0);v(this,"onPointerMoveRaf",e=>{c(this,eo)&&cancelAnimationFrame(c(this,eo)),E(this,eo,requestAnimationFrame(()=>{this.onPointerMove(e)}))});v(this,"onPointerMove",e=>{e.preventDefault(),this.updateInteractionStateIfPanning(e),(e.pointerType!=="touch"||e.pointerType===void 0&&this.hasTouched)&&this.handleHover(e),this.handleCursor()});v(this,"tapsControl",new _u);v(this,"onPointerDown",e=>{e.target===this._container&&(this._container.addEventListener("pointerup",this.onPointerUp,!1),this._container.addEventListener("pointercancel",this.onPointerUp,!1),this.state.interaction.mouseDownStart={time:Date.now(),timestamp:e.timeStamp,clientX:e.clientX,clientY:e.clientY},this.state.interaction.distanceFromMouseDown=0,this.handleCursor(),e.pointerType==="touch"&&(this.tapsControl.add(new Lu(e)),this.touchesCount=Math.max(0,this.touchesCount+1)))});v(this,"clickTimeout");v(this,"onPointerUp",e=>{this.tapsControl.discardOutsideOfWaitWindow(e.timeStamp),this.touchesCount=Math.max(0,this.touchesCount-1),this.touchesCount===0&&(this._container.removeEventListener("pointerup",this.onPointerUp,!1),this._container.removeEventListener("pointercancel",this.onPointerUp,!1)),this.updateInteractionStateIfPanning(e);let{mouseDownStart:i}=this.state.interaction;!i||this.state.interaction.distanceFromMouseDown==null||(Date.now()<i.time+300&&(this.tapsControl.isSingleTapWithTwoFingers||this.state.interaction.distanceFromMouseDown<=15)&&(e.pointerType==="touch"?this.tapsControl.isSingleTapWithTwoFingers?(this.publish("singletap-with-twofinger",e),this.flush()):this.tapsControl.isSingleTapWithOneFinger&&this.touchesCount===0?(this.clickTimeout&&clearTimeout(this.clickTimeout),this.clickTimeout=window.setTimeout(()=>{this.handleClick(e),this.flush()},300)):this.tapsControl.isDoubleTapWithOneFinger&&(this.publish("doubletap-with-onefinger",e),this.flush()):this.handleClick(e)),this.state.interaction.mouseDownStart=void 0,this.state.interaction.distanceFromMouseDown=void 0,this.state.interaction.isPanning=!1,this.handleCursor())});v(this,"dirty3D",!0);v(this,"cachedHitBoxes",{entities:[],groups:[]});v(this,"ndcPoint",new U);v(this,"debugPanel");this.raycaster.layers.enableAll(),this.raycaster.layers.disable(1);let{top:a,left:u}=e.getBoundingClientRect();this.state.containerOffset=[a,u],this.camera=n,this._container=e,this.coreState=i,this.cameraPlane=o,this._container.addEventListener("pointerdown",this.onPointerDown,!1),this._container.addEventListener("pointermove",this.onPointerMoveRaf,!1),this._container.classList.add("mappedin-interactive")}updateQuadtree(e){this._quadtree=e}setHovered3DEntityInteractionComponentDirty(){if(this.state.hovered3DEntity){let e=this.state.hovered3DEntity.components[2];e&&(e.dirty=!0)}}flush(){this.tapsControl.flush(),this.clickTimeout!=null&&(clearTimeout(this.clickTimeout),this.clickTimeout=void 0)}handleHover(e){if(this.state.interaction.mouseDownStart)return;let{entity3D:i,entity2D:n,position:o,groupContainers:a}=this.intersect(e);(this.handle3DEntityHover(i)||this.handle2DEntityHover(n)||this.handle3DContainerHover(a))&&this.publish("hover",{entity2D:this.state.hovered2DEntity,entity3D:this.state.hovered3DEntity,position:o,groupContainers:a}),this.handleCursor()}handleCursor(){let e=!!(this.state.hovered3DEntity||this.state.hovered2DEntity),i=!!this.state.interaction.mouseDownStart,n=this.state.interaction.isPanning,o=m9(e,n,i);this.cursor!==o&&(this.cursor=o,o==="pointer"?this._container.classList.add("mappedin-interaction-hover"):this._container.classList.remove("mappedin-interaction-hover"))}handle2DEntityHover(e){let i=this.state.hovered2DEntity!==e;return this.state.hovered2DEntity=e,i}handleClick(e){let i=this.intersect(e);this.publish("click",{entity2D:i.entity2D,entity3D:i.entity3D,position:i.position,groupContainers:i.groupContainers,pointerEvent:{button:e.button}})}get _hitBoxes(){if(this.dirty3D){let e;for(let i of this.coreState.threeDEntities)e=this.coreState.entity3DMap.get(i),((e==null?void 0:e.type)==="geometry"||(e==null?void 0:e.type)==="model")&&e.components[2]?e.components[0].mesh&&!this.cachedHitBoxes.entities.includes(e.components[0].mesh)&&this.cachedHitBoxes.entities.push(e.components[0].mesh):(e==null?void 0:e.type)==="group-container"&&e.components[1]&&!this.cachedHitBoxes.groups.includes(e)&&this.cachedHitBoxes.groups.push(e);return this.dirty3D=!1,this.cachedHitBoxes}return this.cachedHitBoxes}intersect(e){var S,M;let i=[e.offsetX,e.offsetY],n=this._quadtree.queryPoint(i),[o]=n.filter(g=>g.intersectsPoint(i)),a=this.state.containerOffset[0],u=this.state.containerOffset[1];this.ndcPoint.x=(e.clientX-u)/this._container.clientWidth*2-1,this.ndcPoint.y=-((e.clientY-a)/this._container.clientHeight)*2+1,this.raycaster.setFromCamera(this.ndcPoint,this.camera),this.raycaster.layers.enable(0);let[s]=this.getMouseRayIntersects(),p=this.raycaster.intersectObjects(this._hitBoxes.entities,!0).filter(g=>g.object.visible),[f]=p,m=(S=f==null?void 0:f.instanceId)!=null?S:f==null?void 0:f.batchId,y=this.raycaster.intersectObjects(this._hitBoxes.groups,!0).filter(g=>g.object.visible),x;return y!=null&&y.length>0&&(x=Fv(y)),{entity2D:((M=o==null?void 0:o.userData)==null?void 0:M.entityId)==="watermark"?{id:"watermark"}:this.coreState.entity2DMap.get(o==null?void 0:o.userData.entityId),entity3D:m!=null?this.coreState.entity3DMap.get(f==null?void 0:f.object.userData.entities[m]):this.coreState.entity3DMap.get(f==null?void 0:f.object.userData.entityId),position:s==null?void 0:s.point,groupContainers:x}}handle3DEntityHover(e){this.state.lastHover!==e&&(this.state.lastHover&&Hv(this.state.lastHover,!1),e&&Hv(e,!0));let i=this.state.hovered3DEntity!==e;return this.state.hovered3DEntity=e,this.state.lastHover=e,i}handle3DContainerHover(e){let i=!Gv(this.state.hovered3DContainers,e);return this.state.hovered3DContainers=e,i}updateInteractionStateIfPanning(e){this.state.interaction.mouseDownStart&&(this.state.interaction.distanceFromMouseDown=Math.sqrt(Math.pow(e.clientX-this.state.interaction.mouseDownStart.clientX,2)+Math.pow(e.clientY-this.state.interaction.mouseDownStart.clientY,2)),!this.state.interaction.isPanning&&this.state.interaction.distanceFromMouseDown>15&&(this.state.interaction.isPanning=!0))}getMouseRayIntersects(){return this.raycaster.intersectObjects([this.cameraPlane],!1)}destroy(){this._container.removeEventListener("pointerdown",this.onPointerDown,!1),this._container.removeEventListener("pointermove",this.onPointerMoveRaf,!1),this._container.removeEventListener("pointerup",this.onPointerUp,!1),this._container.removeEventListener("pointercancel",this.onPointerUp,!1)}enableDebug(){let e=document.createElement("div");e.style.position="absolute",e.style.top="0",e.style.right="0",e.style.zIndex="1",e.style.backgroundColor="white",e.style.padding="10px",document.body.append(e),e.id="interaction-debug-panel",this.debugPanel=e,this.on("doubletap-with-onefinger",()=>{this.queueDebugMessage("doubletap-with-onefinger","#ffadad")}),this.on("singletap-with-twofinger",()=>{this.queueDebugMessage("singletap-with-twofinger","#ffd6a5")}),this.on("click",i=>{var n,o,a;this.queueDebugMessage(`CLICK
444
444
  3D: ${(n=i.entity3D)==null?void 0:n.id}
445
445
  2D: ${(o=i.entity2D)==null?void 0:o.id}
446
446
  Pos: ${(a=i.position)==null?void 0:a.toArray().join(", ")}`,"#fdffb6")}),this.on("hover",i=>{var n,o,a;this.queueDebugMessage(`HOVER
447
447
  3D: ${(n=i.entity3D)==null?void 0:n.id}
448
448
  2D: ${(o=i.entity2D)==null?void 0:o.id}
449
- Pos: ${(a=i.position)==null?void 0:a.toArray().join(", ")}`,"#caffbf")})}get _state(){return this.state}queueDebugMessage(e,i){var o;let n=document.createElement("pre");n.style.maxWidth="300px",n.style.transition="opacity 500ms cubic-bezier(0.4, 0, 0.2, 1)",n.style.backgroundColor=i,n.textContent=e,(o=this.debugPanel)==null||o.prepend(n),setTimeout(()=>{n.style.opacity="0",setTimeout(()=>{n.remove()},500)},2500)}getCursor(){return this.cursor}};eo=new WeakMap,l(af,"InteractionSystem");var Ra=af;function Iv(r,t){let e=r.components[2];e&&(e.hover=t,e.dirty=!0)}l(Iv,"updateHover");function e9(r,t,e){return t?"grabbing":r?"pointer":e?"grabbing":"grab"}l(e9,"processCursor");d();d();d();function Tu(r){"@babel/helpers - typeof";return Tu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Tu(r)}l(Tu,"_typeof");var r9=/^\s+/,i9=/\s+$/;function B(r,t){if(r=r||"",t=t||{},r instanceof B)return r;if(!(this instanceof B))return new B(r,t);var e=n9(r);this._originalInput=r,this._r=e.r,this._g=e.g,this._b=e.b,this._a=e.a,this._roundA=Math.round(100*this._a)/100,this._format=t.format||e.format,this._gradientType=t.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=e.ok}l(B,"tinycolor");B.prototype={isDark:l(function(){return this.getBrightness()<128},"isDark"),isLight:l(function(){return!this.isDark()},"isLight"),isValid:l(function(){return this._ok},"isValid"),getOriginalInput:l(function(){return this._originalInput},"getOriginalInput"),getFormat:l(function(){return this._format},"getFormat"),getAlpha:l(function(){return this._a},"getAlpha"),getBrightness:l(function(){var t=this.toRgb();return(t.r*299+t.g*587+t.b*114)/1e3},"getBrightness"),getLuminance:l(function(){var t=this.toRgb(),e,i,n,o,a,u;return e=t.r/255,i=t.g/255,n=t.b/255,e<=.03928?o=e/12.92:o=Math.pow((e+.055)/1.055,2.4),i<=.03928?a=i/12.92:a=Math.pow((i+.055)/1.055,2.4),n<=.03928?u=n/12.92:u=Math.pow((n+.055)/1.055,2.4),.2126*o+.7152*a+.0722*u},"getLuminance"),setAlpha:l(function(t){return this._a=kv(t),this._roundA=Math.round(100*this._a)/100,this},"setAlpha"),toHsv:l(function(){var t=Lv(this._r,this._g,this._b);return{h:t.h*360,s:t.s,v:t.v,a:this._a}},"toHsv"),toHsvString:l(function(){var t=Lv(this._r,this._g,this._b),e=Math.round(t.h*360),i=Math.round(t.s*100),n=Math.round(t.v*100);return this._a==1?"hsv("+e+", "+i+"%, "+n+"%)":"hsva("+e+", "+i+"%, "+n+"%, "+this._roundA+")"},"toHsvString"),toHsl:l(function(){var t=Ev(this._r,this._g,this._b);return{h:t.h*360,s:t.s,l:t.l,a:this._a}},"toHsl"),toHslString:l(function(){var t=Ev(this._r,this._g,this._b),e=Math.round(t.h*360),i=Math.round(t.s*100),n=Math.round(t.l*100);return this._a==1?"hsl("+e+", "+i+"%, "+n+"%)":"hsla("+e+", "+i+"%, "+n+"%, "+this._roundA+")"},"toHslString"),toHex:l(function(t){return _v(this._r,this._g,this._b,t)},"toHex"),toHexString:l(function(t){return"#"+this.toHex(t)},"toHexString"),toHex8:l(function(t){return l9(this._r,this._g,this._b,this._a,t)},"toHex8"),toHex8String:l(function(t){return"#"+this.toHex8(t)},"toHex8String"),toRgb:l(function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},"toRgb"),toRgbString:l(function(){return this._a==1?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},"toRgbString"),toPercentageRgb:l(function(){return{r:Math.round(ft(this._r,255)*100)+"%",g:Math.round(ft(this._g,255)*100)+"%",b:Math.round(ft(this._b,255)*100)+"%",a:this._a}},"toPercentageRgb"),toPercentageRgbString:l(function(){return this._a==1?"rgb("+Math.round(ft(this._r,255)*100)+"%, "+Math.round(ft(this._g,255)*100)+"%, "+Math.round(ft(this._b,255)*100)+"%)":"rgba("+Math.round(ft(this._r,255)*100)+"%, "+Math.round(ft(this._g,255)*100)+"%, "+Math.round(ft(this._b,255)*100)+"%, "+this._roundA+")"},"toPercentageRgbString"),toName:l(function(){return this._a===0?"transparent":this._a<1?!1:C9[_v(this._r,this._g,this._b,!0)]||!1},"toName"),toFilter:l(function(t){var e="#"+Dv(this._r,this._g,this._b,this._a),i=e,n=this._gradientType?"GradientType = 1, ":"";if(t){var o=B(t);i="#"+Dv(o._r,o._g,o._b,o._a)}return"progid:DXImageTransform.Microsoft.gradient("+n+"startColorstr="+e+",endColorstr="+i+")"},"toFilter"),toString:l(function(t){var e=!!t;t=t||this._format;var i=!1,n=this._a<1&&this._a>=0,o=!e&&n&&(t==="hex"||t==="hex6"||t==="hex3"||t==="hex4"||t==="hex8"||t==="name");return o?t==="name"&&this._a===0?this.toName():this.toRgbString():(t==="rgb"&&(i=this.toRgbString()),t==="prgb"&&(i=this.toPercentageRgbString()),(t==="hex"||t==="hex6")&&(i=this.toHexString()),t==="hex3"&&(i=this.toHexString(!0)),t==="hex4"&&(i=this.toHex8String(!0)),t==="hex8"&&(i=this.toHex8String()),t==="name"&&(i=this.toName()),t==="hsl"&&(i=this.toHslString()),t==="hsv"&&(i=this.toHsvString()),i||this.toHexString())},"toString"),clone:l(function(){return B(this.toString())},"clone"),_applyModification:l(function(t,e){var i=t.apply(null,[this].concat([].slice.call(e)));return this._r=i._r,this._g=i._g,this._b=i._b,this.setAlpha(i._a),this},"_applyModification"),lighten:l(function(){return this._applyModification(h9,arguments)},"lighten"),brighten:l(function(){return this._applyModification(d9,arguments)},"brighten"),darken:l(function(){return this._applyModification(f9,arguments)},"darken"),desaturate:l(function(){return this._applyModification(u9,arguments)},"desaturate"),saturate:l(function(){return this._applyModification(c9,arguments)},"saturate"),greyscale:l(function(){return this._applyModification(p9,arguments)},"greyscale"),spin:l(function(){return this._applyModification(m9,arguments)},"spin"),_applyCombination:l(function(t,e){return t.apply(null,[this].concat([].slice.call(e)))},"_applyCombination"),analogous:l(function(){return this._applyCombination(v9,arguments)},"analogous"),complement:l(function(){return this._applyCombination(y9,arguments)},"complement"),monochromatic:l(function(){return this._applyCombination(b9,arguments)},"monochromatic"),splitcomplement:l(function(){return this._applyCombination(g9,arguments)},"splitcomplement"),triad:l(function(){return this._applyCombination(Ov,[3])},"triad"),tetrad:l(function(){return this._applyCombination(Ov,[4])},"tetrad")};B.fromRatio=function(r,t){if(Tu(r)=="object"){var e={};for(var i in r)r.hasOwnProperty(i)&&(i==="a"?e[i]=r[i]:e[i]=Ba(r[i]));r=e}return B(r,t)};function n9(r){var t={r:0,g:0,b:0},e=1,i=null,n=null,o=null,a=!1,u=!1;return typeof r=="string"&&(r=P9(r)),Tu(r)=="object"&&(wr(r.r)&&wr(r.g)&&wr(r.b)?(t=o9(r.r,r.g,r.b),a=!0,u=String(r.r).substr(-1)==="%"?"prgb":"rgb"):wr(r.h)&&wr(r.s)&&wr(r.v)?(i=Ba(r.s),n=Ba(r.v),t=s9(r.h,i,n),a=!0,u="hsv"):wr(r.h)&&wr(r.s)&&wr(r.l)&&(i=Ba(r.s),o=Ba(r.l),t=a9(r.h,i,o),a=!0,u="hsl"),r.hasOwnProperty("a")&&(e=r.a)),e=kv(e),{ok:a,format:r.format||u,r:Math.min(255,Math.max(t.r,0)),g:Math.min(255,Math.max(t.g,0)),b:Math.min(255,Math.max(t.b,0)),a:e}}l(n9,"inputToRGB");function o9(r,t,e){return{r:ft(r,255)*255,g:ft(t,255)*255,b:ft(e,255)*255}}l(o9,"rgbToRgb");function Ev(r,t,e){r=ft(r,255),t=ft(t,255),e=ft(e,255);var i=Math.max(r,t,e),n=Math.min(r,t,e),o,a,u=(i+n)/2;if(i==n)o=a=0;else{var s=i-n;switch(a=u>.5?s/(2-i-n):s/(i+n),i){case r:o=(t-e)/s+(t<e?6:0);break;case t:o=(e-r)/s+2;break;case e:o=(r-t)/s+4;break}o/=6}return{h:o,s:a,l:u}}l(Ev,"rgbToHsl");function a9(r,t,e){var i,n,o;r=ft(r,360),t=ft(t,100),e=ft(e,100);function a(p,f,m){return m<0&&(m+=1),m>1&&(m-=1),m<1/6?p+(f-p)*6*m:m<1/2?f:m<2/3?p+(f-p)*(2/3-m)*6:p}if(l(a,"hue2rgb"),t===0)i=n=o=e;else{var u=e<.5?e*(1+t):e+t-e*t,s=2*e-u;i=a(s,u,r+1/3),n=a(s,u,r),o=a(s,u,r-1/3)}return{r:i*255,g:n*255,b:o*255}}l(a9,"hslToRgb");function Lv(r,t,e){r=ft(r,255),t=ft(t,255),e=ft(e,255);var i=Math.max(r,t,e),n=Math.min(r,t,e),o,a,u=i,s=i-n;if(a=i===0?0:s/i,i==n)o=0;else{switch(i){case r:o=(t-e)/s+(t<e?6:0);break;case t:o=(e-r)/s+2;break;case e:o=(r-t)/s+4;break}o/=6}return{h:o,s:a,v:u}}l(Lv,"rgbToHsv");function s9(r,t,e){r=ft(r,360)*6,t=ft(t,100),e=ft(e,100);var i=Math.floor(r),n=r-i,o=e*(1-t),a=e*(1-n*t),u=e*(1-(1-n)*t),s=i%6,p=[e,a,o,o,u,e][s],f=[u,e,e,a,o,o][s],m=[o,o,u,e,e,a][s];return{r:p*255,g:f*255,b:m*255}}l(s9,"hsvToRgb");function _v(r,t,e,i){var n=[Ne(Math.round(r).toString(16)),Ne(Math.round(t).toString(16)),Ne(Math.round(e).toString(16))];return i&&n[0].charAt(0)==n[0].charAt(1)&&n[1].charAt(0)==n[1].charAt(1)&&n[2].charAt(0)==n[2].charAt(1)?n[0].charAt(0)+n[1].charAt(0)+n[2].charAt(0):n.join("")}l(_v,"rgbToHex");function l9(r,t,e,i,n){var o=[Ne(Math.round(r).toString(16)),Ne(Math.round(t).toString(16)),Ne(Math.round(e).toString(16)),Ne(Nv(i))];return n&&o[0].charAt(0)==o[0].charAt(1)&&o[1].charAt(0)==o[1].charAt(1)&&o[2].charAt(0)==o[2].charAt(1)&&o[3].charAt(0)==o[3].charAt(1)?o[0].charAt(0)+o[1].charAt(0)+o[2].charAt(0)+o[3].charAt(0):o.join("")}l(l9,"rgbaToHex");function Dv(r,t,e,i){var n=[Ne(Nv(i)),Ne(Math.round(r).toString(16)),Ne(Math.round(t).toString(16)),Ne(Math.round(e).toString(16))];return n.join("")}l(Dv,"rgbaToArgbHex");B.equals=function(r,t){return!r||!t?!1:B(r).toRgbString()==B(t).toRgbString()};B.random=function(){return B.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function u9(r,t){t=t===0?0:t||10;var e=B(r).toHsl();return e.s-=t/100,e.s=wu(e.s),B(e)}l(u9,"_desaturate");function c9(r,t){t=t===0?0:t||10;var e=B(r).toHsl();return e.s+=t/100,e.s=wu(e.s),B(e)}l(c9,"_saturate");function p9(r){return B(r).desaturate(100)}l(p9,"_greyscale");function h9(r,t){t=t===0?0:t||10;var e=B(r).toHsl();return e.l+=t/100,e.l=wu(e.l),B(e)}l(h9,"_lighten");function d9(r,t){t=t===0?0:t||10;var e=B(r).toRgb();return e.r=Math.max(0,Math.min(255,e.r-Math.round(255*-(t/100)))),e.g=Math.max(0,Math.min(255,e.g-Math.round(255*-(t/100)))),e.b=Math.max(0,Math.min(255,e.b-Math.round(255*-(t/100)))),B(e)}l(d9,"_brighten");function f9(r,t){t=t===0?0:t||10;var e=B(r).toHsl();return e.l-=t/100,e.l=wu(e.l),B(e)}l(f9,"_darken");function m9(r,t){var e=B(r).toHsl(),i=(e.h+t)%360;return e.h=i<0?360+i:i,B(e)}l(m9,"_spin");function y9(r){var t=B(r).toHsl();return t.h=(t.h+180)%360,B(t)}l(y9,"_complement");function Ov(r,t){if(isNaN(t)||t<=0)throw new Error("Argument to polyad must be a positive number");for(var e=B(r).toHsl(),i=[B(r)],n=360/t,o=1;o<t;o++)i.push(B({h:(e.h+o*n)%360,s:e.s,l:e.l}));return i}l(Ov,"polyad");function g9(r){var t=B(r).toHsl(),e=t.h;return[B(r),B({h:(e+72)%360,s:t.s,l:t.l}),B({h:(e+216)%360,s:t.s,l:t.l})]}l(g9,"_splitcomplement");function v9(r,t,e){t=t||6,e=e||30;var i=B(r).toHsl(),n=360/e,o=[B(r)];for(i.h=(i.h-(n*t>>1)+720)%360;--t;)i.h=(i.h+n)%360,o.push(B(i));return o}l(v9,"_analogous");function b9(r,t){t=t||6;for(var e=B(r).toHsv(),i=e.h,n=e.s,o=e.v,a=[],u=1/t;t--;)a.push(B({h:i,s:n,v:o})),o=(o+u)%1;return a}l(b9,"_monochromatic");B.mix=function(r,t,e){e=e===0?0:e||50;var i=B(r).toRgb(),n=B(t).toRgb(),o=e/100,a={r:(n.r-i.r)*o+i.r,g:(n.g-i.g)*o+i.g,b:(n.b-i.b)*o+i.b,a:(n.a-i.a)*o+i.a};return B(a)};B.readability=function(r,t){var e=B(r),i=B(t);return(Math.max(e.getLuminance(),i.getLuminance())+.05)/(Math.min(e.getLuminance(),i.getLuminance())+.05)};B.isReadable=function(r,t,e){var i=B.readability(r,t),n,o;switch(o=!1,n=T9(e),n.level+n.size){case"AAsmall":case"AAAlarge":o=i>=4.5;break;case"AAlarge":o=i>=3;break;case"AAAsmall":o=i>=7;break}return o};B.mostReadable=function(r,t,e){var i=null,n=0,o,a,u,s;e=e||{},a=e.includeFallbackColors,u=e.level,s=e.size;for(var p=0;p<t.length;p++)o=B.readability(r,t[p]),o>n&&(n=o,i=B(t[p]));return B.isReadable(r,i,{level:u,size:s})||!a?i:(e.includeFallbackColors=!1,B.mostReadable(r,["#fff","#000"],e))};var sf=B.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},C9=B.hexNames=x9(sf);function x9(r){var t={};for(var e in r)r.hasOwnProperty(e)&&(t[r[e]]=e);return t}l(x9,"flip");function kv(r){return r=parseFloat(r),(isNaN(r)||r<0||r>1)&&(r=1),r}l(kv,"boundAlpha");function ft(r,t){S9(r)&&(r="100%");var e=M9(r);return r=Math.min(t,Math.max(0,parseFloat(r))),e&&(r=parseInt(r*t,10)/100),Math.abs(r-t)<1e-6?1:r%t/parseFloat(t)}l(ft,"bound01");function wu(r){return Math.min(1,Math.max(0,r))}l(wu,"clamp01");function he(r){return parseInt(r,16)}l(he,"parseIntFromHex");function S9(r){return typeof r=="string"&&r.indexOf(".")!=-1&&parseFloat(r)===1}l(S9,"isOnePointZero");function M9(r){return typeof r=="string"&&r.indexOf("%")!=-1}l(M9,"isPercentage");function Ne(r){return r.length==1?"0"+r:""+r}l(Ne,"pad2");function Ba(r){return r<=1&&(r=r*100+"%"),r}l(Ba,"convertToPercentage");function Nv(r){return Math.round(parseFloat(r)*255).toString(16)}l(Nv,"convertDecimalToHex");function Av(r){return he(r)/255}l(Av,"convertHexToDecimal");var ke=function(){var r="[-\\+]?\\d+%?",t="[-\\+]?\\d*\\.\\d+%?",e="(?:"+t+")|(?:"+r+")",i="[\\s|\\(]+("+e+")[,|\\s]+("+e+")[,|\\s]+("+e+")\\s*\\)?",n="[\\s|\\(]+("+e+")[,|\\s]+("+e+")[,|\\s]+("+e+")[,|\\s]+("+e+")\\s*\\)?";return{CSS_UNIT:new RegExp(e),rgb:new RegExp("rgb"+i),rgba:new RegExp("rgba"+n),hsl:new RegExp("hsl"+i),hsla:new RegExp("hsla"+n),hsv:new RegExp("hsv"+i),hsva:new RegExp("hsva"+n),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function wr(r){return!!ke.CSS_UNIT.exec(r)}l(wr,"isValidCSSUnit");function P9(r){r=r.replace(r9,"").replace(i9,"").toLowerCase();var t=!1;if(sf[r])r=sf[r],t=!0;else if(r=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var e;return(e=ke.rgb.exec(r))?{r:e[1],g:e[2],b:e[3]}:(e=ke.rgba.exec(r))?{r:e[1],g:e[2],b:e[3],a:e[4]}:(e=ke.hsl.exec(r))?{h:e[1],s:e[2],l:e[3]}:(e=ke.hsla.exec(r))?{h:e[1],s:e[2],l:e[3],a:e[4]}:(e=ke.hsv.exec(r))?{h:e[1],s:e[2],v:e[3]}:(e=ke.hsva.exec(r))?{h:e[1],s:e[2],v:e[3],a:e[4]}:(e=ke.hex8.exec(r))?{r:he(e[1]),g:he(e[2]),b:he(e[3]),a:Av(e[4]),format:t?"name":"hex8"}:(e=ke.hex6.exec(r))?{r:he(e[1]),g:he(e[2]),b:he(e[3]),format:t?"name":"hex"}:(e=ke.hex4.exec(r))?{r:he(e[1]+""+e[1]),g:he(e[2]+""+e[2]),b:he(e[3]+""+e[3]),a:Av(e[4]+""+e[4]),format:t?"name":"hex8"}:(e=ke.hex3.exec(r))?{r:he(e[1]+""+e[1]),g:he(e[2]+""+e[2]),b:he(e[3]+""+e[3]),format:t?"name":"hex"}:!1}l(P9,"stringInputToObject");function T9(r){var t,e;return r=r||{level:"AA",size:"small"},t=(r.level||"AA").toUpperCase(),e=(r.size||"small").toLowerCase(),t!=="AA"&&t!=="AAA"&&(t="AA"),e!=="small"&&e!=="large"&&(e="small"),{level:t,size:e}}l(T9,"validateWCAG2Parms");var bf=Ar(hb());var oo={margin:6,text:{numLines:2,lineHeight:1.2,size:11.5,maxWidth:150,foregroundColor:"white",backgroundColor:"#333"},marker:{size:5,foregroundColor:{active:"white",inactive:void 0},backgroundColor:{active:"#333",inactive:void 0}}},gS={lightOnDark:{...oo,text:{...oo.text,foregroundColor:"white",backgroundColor:"#333"},marker:{...oo.marker,foregroundColor:{active:"white",inactive:void 0},backgroundColor:{active:"#333",inactive:void 0}}},darkOnLight:{...oo,text:{...oo.text,foregroundColor:"#333",backgroundColor:"white"},marker:{...oo.marker,foregroundColor:{active:"#333",inactive:void 0},backgroundColor:{active:"white",inactive:void 0}}}},vS="LOW_PRIORITY",db=4,bS=6,CS=20,xS=2.5,SS=2,MS="cover",fb=.5,PS=6.5,mb={heightAbovePolygon:0,appearance:gS.darkOnLight};var zi=class zi{lines=0;id;rank;type="label";initialRank;contextConfigured=!1;fillText=void 0;newStyle={};opacity=0;visibilityNeedsUpdate=!0;activeStrategyIndex=-1;text;style={top:0,left:0,textLabelVisible:!0,pinVisibility:1,textAlign:"left"};projection=new Z;_cache={};appearance;options;visible=!1;enabled=!0;activeBoundingBox={x:0,y:0,w:0,h:0};dimensions={width:0,height:0};currentStrategyIndex=-1;totalMarkerSize=0;dirty=!0;collisionDirty=!0;lastTextAlign;imageHash;markerSize=0;iconVisible=!1;zoomProportion=0;dp;setEntity(){}constructor(t,e,i){var o,a;if(this.id=(o=e.id)!=null?o:ut(),this.options=(0,bf.default)({},e,mb),this.text=t,this.dp=(u=1)=>u*i.pixelRatio,typeof e.rank=="string")this.rank=to(e.rank),this.initialRank=this.rank;else if(e.rank!=null&&e.rank>0)this.rank=e.rank,this.initialRank=e.rank;else{let u=Math.trunc(b.env.NODE_ENV==="test"?zi.testId:zi.testId*10)/10;zi.testId+=.001,this.rank=u,this.initialRank=u}let n=(0,bf.default)({},this.options.appearance,mb.appearance);this.appearance={margin:n.margin,text:{lineHeight:n.text.lineHeight,numLines:n.text.numLines,size:n.text.size,maxWidth:n.text.maxWidth,foregroundColor:n.text.foregroundColor,backgroundColor:n.text.backgroundColor},marker:{foregroundColor:{active:n.marker.foregroundColor.active,inactive:n.marker.foregroundColor.inactive||B(n.marker.foregroundColor.active).setAlpha(.5).toRgbString()},backgroundColor:{active:n.marker.backgroundColor.active,inactive:n.marker.backgroundColor.inactive||B(n.marker.backgroundColor.active).setAlpha(.5).toRgbString()},icon:n.marker.icon,iconSize:n.marker.iconSize||CS,iconPadding:(a=n.marker.iconPadding)!=null?a:SS,iconFit:n.marker.iconFit||MS,iconVisibilityThreshold:n.marker.iconVisibilityThreshold==null?fb:n.marker.iconVisibilityThreshold}},this.calculateMarkerSize()}calculateMarkerSize(){let{iconVisibilityThreshold:t=fb}=this.appearance.marker,e=this.dp();this.zoomProportion<=t&&typeof this.appearance.marker.iconSize<"u"&&this.imageHash?(this.markerSize=this.dp(this.appearance.marker.iconSize),this.iconVisible=!0):(this.iconVisible=!1,this.markerSize=this.dp(PS)),this.totalMarkerSize=Math.ceil((this.markerSize+xS)/e)}get strategies(){let{width:t,height:e}=this.dimensions,{margin:i}=this.appearance;this.calculateMarkerSize();let n=Math.max(bS,i),o=this.iconVisible?n/2:0,a=[{name:"RIGHT",getBoundingBox:()=>{let u=Math.max(this.totalMarkerSize,e);return[u/2+n,u/2+n,this.totalMarkerSize/2+n,this.totalMarkerSize/2+t+n]},onStrategySelected:()=>{this.newStyle.textAlign="left",this.newStyle.pinVisibility=1,this.newStyle.top=-e/2,this.newStyle.left=this.totalMarkerSize/2+db,this.newStyle.textLabelVisible=!0}},{name:"LEFT",getBoundingBox:()=>{let u=Math.max(this.totalMarkerSize,e);return[u/2+n,u/2+n,this.totalMarkerSize/2+t+n,this.totalMarkerSize/2+n]},onStrategySelected:()=>{this.newStyle.textAlign="right",this.newStyle.pinVisibility=1,this.newStyle.top=-e/2,this.newStyle.left=-t-this.totalMarkerSize/2-db,this.newStyle.textLabelVisible=!0}},{name:"TOP",getBoundingBox:()=>{let u=this.dp();return[e+this.totalMarkerSize/2/u+n,this.totalMarkerSize/2+n,t/2+n,t/2+n]},onStrategySelected:()=>{this.newStyle.pinVisibility=1,this.newStyle.textAlign="center",this.newStyle.textLabelVisible=!0,this.newStyle.top=-this.totalMarkerSize-e/2,this.newStyle.left=-t/2}},{name:vS,getBoundingBox:()=>[this.totalMarkerSize/2+o,this.totalMarkerSize/2+o,this.totalMarkerSize/2+o,this.totalMarkerSize/2+o],onStrategySelected:()=>{this.newStyle.pinVisibility=.5,this.newStyle.textLabelVisible=!1,this.newStyle.top=0,this.newStyle.left=0}}];return this.text===""?[{name:"ICON_ONLY",getBoundingBox:()=>[this.totalMarkerSize/2+n,this.totalMarkerSize/2+n,this.totalMarkerSize/2+n,this.totalMarkerSize/2+n],onStrategySelected:()=>{this.newStyle.pinVisibility=1,this.newStyle.textLabelVisible=!1,this.newStyle.top=0,this.newStyle.left=0}}]:a}onStrategySelected=t=>{if(this.currentStrategyIndex===t)return;let e=this.strategies[t];e&&e.onStrategySelected(this),this.currentStrategyIndex=t;let i=this.style;this.style=this.newStyle,this.newStyle=i,this.iconVisible||(this.opacity=0,this.visibilityNeedsUpdate=!0)};updatePosition(){}disable(){this.visible=!1}toJSON(){return{x:this.projection.x,y:this.projection.y,enabled:this.enabled,id:this.id,rank:this.rank,bboxes:this.strategies.map((t,e)=>({index:e,boundingBox:t.getBoundingBox()})),shouldCollideWithScreenEdges:!1}}destroy(){}};l(zi,"LabelComponent"),v(zi,"testId",0);var Cf=zi,rr=Cf;d();d();function yb(r){return Ks(r)}l(yb,"getBoundingBoxFromFeature");var xf=class xf extends Zs{userData={entities:{}}};l(xf,"EntityBatchedMesh");var ao=xf,Ya,ja,qi,Sf=class Sf{constructor(t){v(this,"mesh");v(this,"outline");v(this,"type","geometry");v(this,"instanceIndex",-1);v(this,"geometry");v(this,"material");v(this,"feature");v(this,"color",new wt);v(this,"topColor",new wt);v(this,"position",new j);P(this,Ya,0);P(this,ja,1);P(this,qi,void 0);v(this,"texturesVisible",!1);this.feature=t}get visible(){return this.mesh?this.mesh.getVisibleAt(this.instanceIndex):!1}set visible(t){this.mesh&&this.mesh.setVisibleAt(this.instanceIndex,t)}setOpacity(t){this.mesh&&(this.material&&(this.material.opacity=t,this.material.transparent=t<1),this.outline&&(t<.5?this.outline.visible=!1:this.outline.visible=!0),t===0?this.mesh.visible=!1:this.mesh.visible=!0)}setColor(t,e){this.color.set(t),this.topColor.set(e),this.material&&this.material.setColor(this.instanceIndex,this.color,this.topColor)}get altitude(){return c(this,Ya)}set altitude(t){this.mesh&&(this.mesh.position.z=t,E(this,Ya,t))}get opacity(){return c(this,ja)}set opacity(t){this.material&&(this.material.opacity=t,this.material.transparent=t<1,this.outline&&(this.outline.visible=t>.5),this.material.needsUpdate=!0),E(this,ja,t)}get texture(){var t,e;return(e=(t=this.material)==null?void 0:t.texture)==null?void 0:e.image.src}set texture(t){this.material&&(this.material.texture=t)}set topTexture(t){this.material&&(this.material.topTexture=t)}get topTexture(){var t,e;return(e=(t=this.material)==null?void 0:t.topTexture)==null?void 0:e.image.src}get featureBbox(){return c(this,qi)?c(this,qi):(E(this,qi,yb(this.feature)),c(this,qi))}showTextures(){this.material&&(this.material.showTextures(this.instanceIndex),this.texturesVisible=!0)}hideTextures(){this.material&&(this.material.hideTextures(this.instanceIndex),this.texturesVisible=!1)}};Ya=new WeakMap,ja=new WeakMap,qi=new WeakMap,l(Sf,"MeshComponent");var Jt=Sf;var Mf=class Mf extends et{constructor(){super()}interpolators=new Map;addEntity3D(t,e){let[i,n,o,a]=e[1];this.interpolators.set(t,u=>pe(u,i,n,o,a))}addEntity2D(t,e){let[i,n,o]=e[1];this.interpolators.set(t,a=>a<i?n:o)}addAny(t,e){this.interpolators.set(t,e)}update=t=>{for(let[e,i]of this.interpolators)e instanceof Jt?e.setOpacity(i(t)):e instanceof rr?e.enabled=i(t):i(t)};destroy(){this.interpolators.clear()}};l(Mf,"ZoomInterpolationSystem");var Nu=Mf;d();var $i=class $i{id;type="marker";rank=0;initialRank=0;options={};projection=new Z;enabled=!0;activeStrategyIndex=-1;strategyIndex=-1;activeBoundingBox={x:0,y:0,w:0,h:0};dimensions={width:0,height:0};containerEl;contentEl=null;contentHtml="";style={top:"0px",left:"0px"};dirty=!1;collisionDirty=!0;visibilityNeedsUpdate=!0;constructor(t,e={}){if(this.id=(e==null?void 0:e.id)||ut(),this.options=e,typeof e.rank=="string")this.rank=to(e.rank);else if(e.rank!=null&&e.rank>0)this.rank=e.rank;else{let n=Math.trunc(b.env.NODE_ENV==="test"?$i.testId:$i.testId*10)/10;$i.testId+=.001,this.rank=n}this.contentHtml=t,this.initialRank=this.rank;let i=document.createElement("div");i.style.opacity="0",i.innerHTML=`<div class="mappedin-marker">${this.contentHtml}</div>`,this.containerEl=i.querySelector(".mappedin-marker"),this.containerEl.setAttribute("data-marker-id",this.id.toString()),this.contentEl=this.containerEl?this.containerEl.firstElementChild:null}updateDimensions(t,e){if(t!=null&&e!=null)this.dimensions={width:t,height:e};else{let{width:i,height:n}=this.containerEl.getBoundingClientRect();this.dimensions={width:i,height:n}}Object.assign(this.containerEl,{width:this.dimensions.width+"px",height:this.dimensions.height+"px"})}visible=!1;animation=null;currentStrategyIndex=-1;onStrategySelected=(t,e=!1)=>{if(this.currentStrategyIndex===t||e)return;let{width:i,height:n}=this.dimensions,o=-n/2+"px",a=-i/2+"px";switch(this.style.top=o,this.style.left=a,this.options.anchor){case"top":{this.style.top=-n+"px";break}case"bottom":{this.style.top="0px";break}case"left":{this.style.left=-i+"px";break}case"right":{this.style.left="0px";break}default:this.style.top=o,this.style.left=a}this.containerEl.style.top=this.style.top,this.containerEl.style.left=this.style.left};get strategies(){let{width:t,height:e}=this.dimensions;return[{name:"center",getBoundingBox:()=>{let i=e/2,n=e/2,o=t/2,a=t/2;switch(this.options.anchor){case"top":{i=e,n=0;break}case"bottom":{i=0,n=e;break}case"left":{o=t,a=0;break}case"right":{o=0,a=t;break}}return[i,n,o,a]}}]}toJSON(){return{x:this.projection.x,y:this.projection.y,enabled:this.enabled,id:this.id,rank:this.rank,bboxes:this.strategies.map((t,e)=>({index:e,boundingBox:t.getBoundingBox()})),shouldCollideWithScreenEdges:!1}}destroy(){}};l($i,"MarkerComponent"),v($i,"testId",0);var ve=$i;d();d();d();d();d();var Pf=class Pf{hover=!1;dirty=!1};l(Pf,"InteractionComponent");var so=Pf;function de(r,t,e){if(t!==void 0){if(r.type==="model"||r.type==="path"||r.type==="marker"||r.type==="label"||r.type==="geometry"||r.type==="group-container")return t===!0?(r instanceof ge&&r.components[1]===void 0?(r.components[1]=new so,r.components[1].dirty=!0):r instanceof dt&&r.components[2]===void 0?(r.components[2]=new so,r.components[2].dirty=!0):r instanceof Pt&&r.components[1]===void 0&&(r.components[1]=new so,r.components[1].dirty=!0),!0):(r instanceof ge?r.components[1]=void 0:r instanceof dt?r.components[2]=void 0:r instanceof Pt&&(r.components[1]=void 0),!0);if(r.type==="geometry-group"){let i;for(let n of r.userData.entities3D.values())i=e.entity3DMap.get(n),de(i,t,e);return!0}}return!1}l(de,"updateInteractivity");function gb(r,t,e){if(e!==void 0&&r.type==="geometry-group"&&r.components[0]!=null){let i,n,o=r.components[0];for(let a of r.userData.entities3D.values())i=t.entity3DMap.get(a),i&&(n=i.components[1],n.color===o.color&&(n.initialColor=e.color||o.color,n.color=e.color||o.color,n.dirty=!0),n.topColor===o.topColor&&(n.topColor=e.topColor||o.topColor,n.dirty=!0));return e.color!==void 0&&(r.components[0].color=e.color),e.topColor!==void 0&&(r.components[0].topColor=e.topColor),!0}return!1}l(gb,"updateGroupColor");function vb(r,t){if(t!==void 0&&r.type==="geometry-group"&&r.components[0]!=null){let e=r.components[0];return e.shading=e.shading||{},e.shading&&(t.start!==e.shading.start||t.end!==e.shading.end||t.intensity!==e.shading.intensity)&&(Object.assign(e.shading,t),r.userData.shadingDirty=!0),!0}return!1}l(vb,"updateGroupShading");function bb(r,t){t!==void 0&&(r.type==="path"||r.type==="geometry")&&(t.initialColor!==void 0&&(r.components[1].initialColor=t.initialColor),t.color!==void 0&&(r.components[1].color=t.color),t.topColor!==void 0&&(r.components[1].topColor=t.topColor),r.components[1].dirty=!0)}l(bb,"updateColor");function wf(r,t,e){t!==void 0&&(r.type==="label"||r.type==="marker"?(r.object3d.position.copy(e(t[1],t[0],t[2]||0)),r.positionDirty=!0):r.type==="custom-geometry"&&r.components[0].position.copy(e(t[1],t[0],t[2]||0)))}l(wf,"updatePosition");function If(r,t){var e;return t!==void 0&&(r.type==="marker"||r.type==="label"||r.type==="custom-geometry")&&r.parent!==t&&r.parent instanceof Pt?((e=r.parent)==null||e.removeEntity(r),t.addEntity(r),!0):!1}l(If,"updateParent");function Cb(r,t){t!==void 0&&(r.type==="marker"||r.type==="label")&&(r.components[0].enabled=t)}l(Cb,"updateEnabled");function xb(r,t){if(t!==void 0&&r.type==="path"){let e=r.components[0];t.completeFraction!==void 0&&(e.completeFraction=t.completeFraction)}}l(xb,"updatePath");function Sb(r,t){if(t!==void 0&&r.type==="marker"){let e=r.components[0];if(t.contentHTML!==void 0)return e.containerEl.innerHTML=t.contentHTML,!0}return!1}l(Sb,"updateMarker");function Mb(r,t){return t!==void 0&&(r.type==="marker"||r.type==="label")?(r.components[0].rank=to(t),!0):!1}l(Mb,"updateRank");function Pb(r,t){var e,i,n;if(t!==void 0&&r.type==="label"){let o=r.components[0];t.text!==void 0&&(o.text=t.text,o.dirty=!0),((e=t.options)==null?void 0:e.appearance)!==void 0&&Object.keys((i=t.options)==null?void 0:i.appearance).length>0&&(Jd(o.appearance,((n=t.options)==null?void 0:n.appearance)||{}),o.dirty=!0)}}l(Pb,"updateLabel");function Tb(r,t){t!==void 0&&r.type==="geometry"&&(r.components[1].hoverColor=t,r.components[1].dirty=!0)}l(Tb,"updateHoverColor");function lo(r,t){if(t!==void 0){if(r.type==="model"||r.type==="path"||r.type==="geometry"||r.type==="custom-geometry"){r.components[1].visible=t,r.components[1].dirty=!0;let e=r.parent;e instanceof Bt&&(e.userData.outlineDirty=!0)}else(r.type==="group-container"||r.type==="geometry-group")&&r.setVisible(t);return!0}return!1}l(lo,"updateVisibility");function wb(r,t,e){if(e!==void 0&&r.type==="geometry-group"){r.setOpacity(e),r.components[0].opacity=e;for(let i of r.userData.entities3D.values()){let n=t.entity3DMap.get(i);((n==null?void 0:n.type)==="geometry"||(n==null?void 0:n.type)==="model")&&(n.components[1].opacity=e,n.components[1].dirty=!0)}}}l(wb,"updateOpacity");function Ef(r,t){t!==void 0&&(r.type==="model"||r.type==="path"||r.type==="geometry"||r.type==="custom-geometry"?(r.components[1].altitude=t,r.components[1].dirty=!0):r.type==="group-container"&&r.setAltitude(t))}l(Ef,"updateAltitude");function Lf(r,t){if(t!==void 0){if(r.type==="geometry-group"&&r.components[0]!=null)r.components[0].outline=t,r.userData.outlineDirty=!0;else if(r.type==="geometry"){r.components[1].outline=t,r.components[1].dirty=!0;let e=r.parent;e instanceof Bt&&(e.userData.outlineDirty=!0)}return!0}return!1}l(Lf,"updateOutline");var Ji,nr,Ru,Bu,Ib,Za,Fu,Gu,Eb,Vu,Lb,Ua,Hu,za,qa,Xu,Df=class Df{constructor(t){P(this,Bu);P(this,Gu);P(this,Vu);P(this,Ji,null);P(this,nr,void 0);v(this,"getCurrentSceneGLTF",async t=>{let e={onlyVisible:!0,binary:!0,light:!0,scale:1,...t},i=await W(this,Bu,Ib).call(this),n=c(this,Ru).call(this,e),o=await i.parseAsync(n,{trs:!1,maxTextureSize:1/0,onlyVisible:e.onlyVisible,binary:e.binary,scale:e.scale}),a;if(o instanceof ArrayBuffer)a=new Blob([o],{type:"application/octet-stream"});else{let u=JSON.stringify(o,null,2);a=new Blob([u],{type:"text/plain"})}return a});P(this,Ru,l(t=>{let{scale:e,light:i,onlyVisible:n}=t,o=new js,a=new Te().setFromObject(c(this,nr).entityScene);if(c(this,Za).call(this,c(this,nr).entityScene,o,n),i){let u=new Us(16777215,.3*Math.PI);u.position.set(0,Math.max(a.max.x,a.max.y)*e*.5,a.max.y*e*4),u.lookAt(0,0,-1),u.target.position.set(0,0,-1),u.add(u.target),o.add(u)}return o},"#getExportedScene"));P(this,Za,l((t,e,i)=>{t.material&&(t instanceof Zs?W(this,Gu,Eb).call(this,t).forEach(n=>e.add(n)):t instanceof yi&&e.add(W(this,Vu,Lb).call(this,t))),t.children.forEach(n=>{(!i||n.visible)&&c(this,Za).call(this,n,e,i)})},"#processObject3D"));P(this,Fu,l((t,e,i)=>{let n=new l1({color:new wt(t),metalness:0});return n.opacity=e,n.transparent=i,n},"#createStandardMaterial"));P(this,Ua,l(t=>{let{geometry:e,material:i,position:n,rotation:o,quaternion:a,scale:u}=t;if(!(e!=null&&e.isBufferGeometry))return t;let s=e.attributes.position,p=e.attributes.normal,f=e.attributes.uv;return c(this,Hu).call(this,s,p),c(this,qa).call(this,n,u,o,a),f&&c(this,Xu).call(this,f),i!=null&&i.map&&e.type==="PlaneGeometry"&&(t.side=wo),t},"#convertGeometry"));P(this,Hu,l((t,e)=>{let i=new j,n=new j;for(let o=0;o<t.count;o++)i.fromBufferAttribute(t,o),c(this,za).call(this,i),t.setXYZ(o,i.x,i.y,i.z),e&&(n.fromBufferAttribute(e,o),c(this,za).call(this,n),e.setXYZ(o,n.x,n.y,n.z))},"#convertAttributes"));P(this,za,l(t=>{let e=t.y;t.y=t.z,t.z=-e},"#convertVector"));P(this,qa,l((t,e,i,n)=>{let o=t.y;t.y=t.z,t.z=-o;let a=e.y;if(e.y=e.z,e.z=a,i instanceof fn)i.order="YXZ",i.set(i.x,i.y,i.z,i.order);else{let u=n.y;n.set(n.x,n.z,-u,n.w)}},"#convertObjectProperties"));P(this,Xu,l(t=>{for(let e=0;e<t.count;e++){let i=t.getX(e),n=t.getY(e);t.setXY(e,i,n)}},"#convertUVs"));E(this,nr,t),c(this,nr).entityScene=t.entityScene,c(this,nr).entity3DMap=t.entity3DMap}destroy(){E(this,Ji,null)}};Ji=new WeakMap,nr=new WeakMap,Ru=new WeakMap,Bu=new WeakSet,Ib=l(async function(){if(!c(this,Ji)){let{GLTFExporter:t}=await import("./GLTFExporter-QNKFLIQG.js");E(this,Ji,new t)}return c(this,Ji)},"#getGLTFExporter"),Za=new WeakMap,Fu=new WeakMap,Gu=new WeakSet,Eb=l(function(t){var a,u;let e=[],n=((a=t.userData)!=null&&a.entities?Object.values((u=t.userData)==null?void 0:u.entities):[]).map(s=>c(this,nr).entity3DMap.get(s)),o=new Map;return n.forEach(s=>{var x;if(!s||!(s instanceof dt))return;let p=s.components[1],f=s.components[2];if(!p.visible||p.opacity===0)return;let y=`${f!=null&&f.hover?p.hoverColor||c(this,nr).hoverColor:p.color}-${p.opacity}-${Number(p.visible)}`;o.has(y)||o.set(y,[]),(x=o.get(y))==null||x.push(s)}),o.forEach((s,p)=>{let[f,m,y]=p.split("-"),x=s.reduce((C,I)=>{let w=I.components[0];if(w.type==="custom-geometry")return C;let T=w==null?void 0:w.geometry;return T&&C.push(T),C},[]),S=c(this,Fu).call(this,f,Number(m),t.material.transparent),M=je(x,!0),g=new Ut(M,S);g.position.copy(t.position),g.rotation.copy(t.rotation),g.scale.copy(t.scale),g.visible=!!y,c(this,qa).call(this,g.position,g.scale,g.rotation,g.quaternion),e.push(c(this,Ua).call(this,g))}),e},"#processBatchedMesh"),Vu=new WeakSet,Lb=l(function(t){let e=t.geometry.clone(),i=t.material,n=new kr({color:i.color,side:wo});n.opacity=i.opacity,n.transparent=i.transparent;let o=new yi(e,n);return o.position.copy(t.position),o.rotation.copy(t.rotation),o.scale.copy(t.scale),o.visible=t.visible,c(this,Ua).call(this,o)},"#processLineSegments"),Ua=new WeakMap,Hu=new WeakMap,za=new WeakMap,qa=new WeakMap,Xu=new WeakMap,l(Df,"ExporterSystem");var Wa=Df;d();var _b="#ffffff";var Of=class Of{initialColor=_b;color=_b;topColor;topTexture;texture;hoverColor;dirty=!0;visible=!0;opacity=1;width=.1;height=.1;altitude=0;join="round";cap="round";outline=!0;constructor(t={}){this.color=(t==null?void 0:t.color)!==void 0?t.color:this.color,this.initialColor=this.color,this.width=(t==null?void 0:t.width)!==void 0?t.width:this.width,this.opacity=(t==null?void 0:t.opacity)!==void 0?t.opacity:this.opacity,this.visible=(t==null?void 0:t.visible)!==void 0?t.visible:this.visible,this.height=(t==null?void 0:t.height)!==void 0?t.height:this.height,this.altitude=(t==null?void 0:t.altitude)!==void 0?t.altitude:this.altitude,this.join=(t==null?void 0:t.join)!==void 0?t.join:this.join,this.cap=(t==null?void 0:t.cap)!==void 0?t.cap:this.cap,this.topColor=t==null?void 0:t.topColor,this.texture=t==null?void 0:t.texture,this.topTexture=t==null?void 0:t.topTexture,this.outline=(t==null?void 0:t.outline)!==void 0?!!t.outline:this.outline}};l(Of,"StyleComponent");var ai=Of;d();d();d();d();var Yu={top:0,bottom:0,left:0,right:0};d();d();d();d();var Af=class Af extends i1{_width;_height;_propertiesLength;constructor(t){let e=t,i=3,n=i*4;super(new Float32Array(t*n),i,t,Zm,Wm),this._width=n,this._height=e,this._propertiesLength=i}setColor(t,e,i){let n=this.image.data,o=t*this._width;n[o]=e.r,n[o+1]=e.g,n[o+2]=e.b,n[o+3]=0,n[o+4]=i.r,n[o+5]=i.g,n[o+6]=i.b,n[o+7]=0,this.needsUpdate=!0}setTexture(t,e,i){let n=this.image.data,o=t*this._width;n[o+8]=e?1:0,n[o+9]=i?1:0,n[o+10]=0,n[o+11]=0,this.needsUpdate=!0}};l(Af,"BatchedPropertiesTexture");var ju=Af;var Db=`#define LAMBERT
449
+ Pos: ${(a=i.position)==null?void 0:a.toArray().join(", ")}`,"#caffbf")})}get _state(){return this.state}queueDebugMessage(e,i){var o;let n=document.createElement("pre");n.style.maxWidth="300px",n.style.transition="opacity 500ms cubic-bezier(0.4, 0, 0.2, 1)",n.style.backgroundColor=i,n.textContent=e,(o=this.debugPanel)==null||o.prepend(n),setTimeout(()=>{n.style.opacity="0",setTimeout(()=>{n.remove()},500)},2500)}getCursor(){return this.cursor}};eo=new WeakMap,l(ff,"InteractionSystem");var Ba=ff;function Hv(r,t){let e=r.components[2];e&&(e.hover=t,e.dirty=!0)}l(Hv,"updateHover");function m9(r,t,e){return t?"grabbing":r?"pointer":e?"grabbing":"grab"}l(m9,"processCursor");d();d();d();function Ou(r){"@babel/helpers - typeof";return Ou=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ou(r)}l(Ou,"_typeof");var y9=/^\s+/,g9=/\s+$/;function B(r,t){if(r=r||"",t=t||{},r instanceof B)return r;if(!(this instanceof B))return new B(r,t);var e=v9(r);this._originalInput=r,this._r=e.r,this._g=e.g,this._b=e.b,this._a=e.a,this._roundA=Math.round(100*this._a)/100,this._format=t.format||e.format,this._gradientType=t.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=e.ok}l(B,"tinycolor");B.prototype={isDark:l(function(){return this.getBrightness()<128},"isDark"),isLight:l(function(){return!this.isDark()},"isLight"),isValid:l(function(){return this._ok},"isValid"),getOriginalInput:l(function(){return this._originalInput},"getOriginalInput"),getFormat:l(function(){return this._format},"getFormat"),getAlpha:l(function(){return this._a},"getAlpha"),getBrightness:l(function(){var t=this.toRgb();return(t.r*299+t.g*587+t.b*114)/1e3},"getBrightness"),getLuminance:l(function(){var t=this.toRgb(),e,i,n,o,a,u;return e=t.r/255,i=t.g/255,n=t.b/255,e<=.03928?o=e/12.92:o=Math.pow((e+.055)/1.055,2.4),i<=.03928?a=i/12.92:a=Math.pow((i+.055)/1.055,2.4),n<=.03928?u=n/12.92:u=Math.pow((n+.055)/1.055,2.4),.2126*o+.7152*a+.0722*u},"getLuminance"),setAlpha:l(function(t){return this._a=zv(t),this._roundA=Math.round(100*this._a)/100,this},"setAlpha"),toHsv:l(function(){var t=Yv(this._r,this._g,this._b);return{h:t.h*360,s:t.s,v:t.v,a:this._a}},"toHsv"),toHsvString:l(function(){var t=Yv(this._r,this._g,this._b),e=Math.round(t.h*360),i=Math.round(t.s*100),n=Math.round(t.v*100);return this._a==1?"hsv("+e+", "+i+"%, "+n+"%)":"hsva("+e+", "+i+"%, "+n+"%, "+this._roundA+")"},"toHsvString"),toHsl:l(function(){var t=Xv(this._r,this._g,this._b);return{h:t.h*360,s:t.s,l:t.l,a:this._a}},"toHsl"),toHslString:l(function(){var t=Xv(this._r,this._g,this._b),e=Math.round(t.h*360),i=Math.round(t.s*100),n=Math.round(t.l*100);return this._a==1?"hsl("+e+", "+i+"%, "+n+"%)":"hsla("+e+", "+i+"%, "+n+"%, "+this._roundA+")"},"toHslString"),toHex:l(function(t){return jv(this._r,this._g,this._b,t)},"toHex"),toHexString:l(function(t){return"#"+this.toHex(t)},"toHexString"),toHex8:l(function(t){return S9(this._r,this._g,this._b,this._a,t)},"toHex8"),toHex8String:l(function(t){return"#"+this.toHex8(t)},"toHex8String"),toRgb:l(function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},"toRgb"),toRgbString:l(function(){return this._a==1?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},"toRgbString"),toPercentageRgb:l(function(){return{r:Math.round(ft(this._r,255)*100)+"%",g:Math.round(ft(this._g,255)*100)+"%",b:Math.round(ft(this._b,255)*100)+"%",a:this._a}},"toPercentageRgb"),toPercentageRgbString:l(function(){return this._a==1?"rgb("+Math.round(ft(this._r,255)*100)+"%, "+Math.round(ft(this._g,255)*100)+"%, "+Math.round(ft(this._b,255)*100)+"%)":"rgba("+Math.round(ft(this._r,255)*100)+"%, "+Math.round(ft(this._g,255)*100)+"%, "+Math.round(ft(this._b,255)*100)+"%, "+this._roundA+")"},"toPercentageRgbString"),toName:l(function(){return this._a===0?"transparent":this._a<1?!1:N9[jv(this._r,this._g,this._b,!0)]||!1},"toName"),toFilter:l(function(t){var e="#"+Wv(this._r,this._g,this._b,this._a),i=e,n=this._gradientType?"GradientType = 1, ":"";if(t){var o=B(t);i="#"+Wv(o._r,o._g,o._b,o._a)}return"progid:DXImageTransform.Microsoft.gradient("+n+"startColorstr="+e+",endColorstr="+i+")"},"toFilter"),toString:l(function(t){var e=!!t;t=t||this._format;var i=!1,n=this._a<1&&this._a>=0,o=!e&&n&&(t==="hex"||t==="hex6"||t==="hex3"||t==="hex4"||t==="hex8"||t==="name");return o?t==="name"&&this._a===0?this.toName():this.toRgbString():(t==="rgb"&&(i=this.toRgbString()),t==="prgb"&&(i=this.toPercentageRgbString()),(t==="hex"||t==="hex6")&&(i=this.toHexString()),t==="hex3"&&(i=this.toHexString(!0)),t==="hex4"&&(i=this.toHex8String(!0)),t==="hex8"&&(i=this.toHex8String()),t==="name"&&(i=this.toName()),t==="hsl"&&(i=this.toHslString()),t==="hsv"&&(i=this.toHsvString()),i||this.toHexString())},"toString"),clone:l(function(){return B(this.toString())},"clone"),_applyModification:l(function(t,e){var i=t.apply(null,[this].concat([].slice.call(e)));return this._r=i._r,this._g=i._g,this._b=i._b,this.setAlpha(i._a),this},"_applyModification"),lighten:l(function(){return this._applyModification(T9,arguments)},"lighten"),brighten:l(function(){return this._applyModification(I9,arguments)},"brighten"),darken:l(function(){return this._applyModification(E9,arguments)},"darken"),desaturate:l(function(){return this._applyModification(M9,arguments)},"desaturate"),saturate:l(function(){return this._applyModification(P9,arguments)},"saturate"),greyscale:l(function(){return this._applyModification(w9,arguments)},"greyscale"),spin:l(function(){return this._applyModification(L9,arguments)},"spin"),_applyCombination:l(function(t,e){return t.apply(null,[this].concat([].slice.call(e)))},"_applyCombination"),analogous:l(function(){return this._applyCombination(O9,arguments)},"analogous"),complement:l(function(){return this._applyCombination(_9,arguments)},"complement"),monochromatic:l(function(){return this._applyCombination(A9,arguments)},"monochromatic"),splitcomplement:l(function(){return this._applyCombination(D9,arguments)},"splitcomplement"),triad:l(function(){return this._applyCombination(Uv,[3])},"triad"),tetrad:l(function(){return this._applyCombination(Uv,[4])},"tetrad")};B.fromRatio=function(r,t){if(Ou(r)=="object"){var e={};for(var i in r)r.hasOwnProperty(i)&&(i==="a"?e[i]=r[i]:e[i]=Fa(r[i]));r=e}return B(r,t)};function v9(r){var t={r:0,g:0,b:0},e=1,i=null,n=null,o=null,a=!1,u=!1;return typeof r=="string"&&(r=F9(r)),Ou(r)=="object"&&(Tr(r.r)&&Tr(r.g)&&Tr(r.b)?(t=b9(r.r,r.g,r.b),a=!0,u=String(r.r).substr(-1)==="%"?"prgb":"rgb"):Tr(r.h)&&Tr(r.s)&&Tr(r.v)?(i=Fa(r.s),n=Fa(r.v),t=x9(r.h,i,n),a=!0,u="hsv"):Tr(r.h)&&Tr(r.s)&&Tr(r.l)&&(i=Fa(r.s),o=Fa(r.l),t=C9(r.h,i,o),a=!0,u="hsl"),r.hasOwnProperty("a")&&(e=r.a)),e=zv(e),{ok:a,format:r.format||u,r:Math.min(255,Math.max(t.r,0)),g:Math.min(255,Math.max(t.g,0)),b:Math.min(255,Math.max(t.b,0)),a:e}}l(v9,"inputToRGB");function b9(r,t,e){return{r:ft(r,255)*255,g:ft(t,255)*255,b:ft(e,255)*255}}l(b9,"rgbToRgb");function Xv(r,t,e){r=ft(r,255),t=ft(t,255),e=ft(e,255);var i=Math.max(r,t,e),n=Math.min(r,t,e),o,a,u=(i+n)/2;if(i==n)o=a=0;else{var s=i-n;switch(a=u>.5?s/(2-i-n):s/(i+n),i){case r:o=(t-e)/s+(t<e?6:0);break;case t:o=(e-r)/s+2;break;case e:o=(r-t)/s+4;break}o/=6}return{h:o,s:a,l:u}}l(Xv,"rgbToHsl");function C9(r,t,e){var i,n,o;r=ft(r,360),t=ft(t,100),e=ft(e,100);function a(p,f,m){return m<0&&(m+=1),m>1&&(m-=1),m<1/6?p+(f-p)*6*m:m<1/2?f:m<2/3?p+(f-p)*(2/3-m)*6:p}if(l(a,"hue2rgb"),t===0)i=n=o=e;else{var u=e<.5?e*(1+t):e+t-e*t,s=2*e-u;i=a(s,u,r+1/3),n=a(s,u,r),o=a(s,u,r-1/3)}return{r:i*255,g:n*255,b:o*255}}l(C9,"hslToRgb");function Yv(r,t,e){r=ft(r,255),t=ft(t,255),e=ft(e,255);var i=Math.max(r,t,e),n=Math.min(r,t,e),o,a,u=i,s=i-n;if(a=i===0?0:s/i,i==n)o=0;else{switch(i){case r:o=(t-e)/s+(t<e?6:0);break;case t:o=(e-r)/s+2;break;case e:o=(r-t)/s+4;break}o/=6}return{h:o,s:a,v:u}}l(Yv,"rgbToHsv");function x9(r,t,e){r=ft(r,360)*6,t=ft(t,100),e=ft(e,100);var i=Math.floor(r),n=r-i,o=e*(1-t),a=e*(1-n*t),u=e*(1-(1-n)*t),s=i%6,p=[e,a,o,o,u,e][s],f=[u,e,e,a,o,o][s],m=[o,o,u,e,e,a][s];return{r:p*255,g:f*255,b:m*255}}l(x9,"hsvToRgb");function jv(r,t,e,i){var n=[ke(Math.round(r).toString(16)),ke(Math.round(t).toString(16)),ke(Math.round(e).toString(16))];return i&&n[0].charAt(0)==n[0].charAt(1)&&n[1].charAt(0)==n[1].charAt(1)&&n[2].charAt(0)==n[2].charAt(1)?n[0].charAt(0)+n[1].charAt(0)+n[2].charAt(0):n.join("")}l(jv,"rgbToHex");function S9(r,t,e,i,n){var o=[ke(Math.round(r).toString(16)),ke(Math.round(t).toString(16)),ke(Math.round(e).toString(16)),ke(qv(i))];return n&&o[0].charAt(0)==o[0].charAt(1)&&o[1].charAt(0)==o[1].charAt(1)&&o[2].charAt(0)==o[2].charAt(1)&&o[3].charAt(0)==o[3].charAt(1)?o[0].charAt(0)+o[1].charAt(0)+o[2].charAt(0)+o[3].charAt(0):o.join("")}l(S9,"rgbaToHex");function Wv(r,t,e,i){var n=[ke(qv(i)),ke(Math.round(r).toString(16)),ke(Math.round(t).toString(16)),ke(Math.round(e).toString(16))];return n.join("")}l(Wv,"rgbaToArgbHex");B.equals=function(r,t){return!r||!t?!1:B(r).toRgbString()==B(t).toRgbString()};B.random=function(){return B.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function M9(r,t){t=t===0?0:t||10;var e=B(r).toHsl();return e.s-=t/100,e.s=Au(e.s),B(e)}l(M9,"_desaturate");function P9(r,t){t=t===0?0:t||10;var e=B(r).toHsl();return e.s+=t/100,e.s=Au(e.s),B(e)}l(P9,"_saturate");function w9(r){return B(r).desaturate(100)}l(w9,"_greyscale");function T9(r,t){t=t===0?0:t||10;var e=B(r).toHsl();return e.l+=t/100,e.l=Au(e.l),B(e)}l(T9,"_lighten");function I9(r,t){t=t===0?0:t||10;var e=B(r).toRgb();return e.r=Math.max(0,Math.min(255,e.r-Math.round(255*-(t/100)))),e.g=Math.max(0,Math.min(255,e.g-Math.round(255*-(t/100)))),e.b=Math.max(0,Math.min(255,e.b-Math.round(255*-(t/100)))),B(e)}l(I9,"_brighten");function E9(r,t){t=t===0?0:t||10;var e=B(r).toHsl();return e.l-=t/100,e.l=Au(e.l),B(e)}l(E9,"_darken");function L9(r,t){var e=B(r).toHsl(),i=(e.h+t)%360;return e.h=i<0?360+i:i,B(e)}l(L9,"_spin");function _9(r){var t=B(r).toHsl();return t.h=(t.h+180)%360,B(t)}l(_9,"_complement");function Uv(r,t){if(isNaN(t)||t<=0)throw new Error("Argument to polyad must be a positive number");for(var e=B(r).toHsl(),i=[B(r)],n=360/t,o=1;o<t;o++)i.push(B({h:(e.h+o*n)%360,s:e.s,l:e.l}));return i}l(Uv,"polyad");function D9(r){var t=B(r).toHsl(),e=t.h;return[B(r),B({h:(e+72)%360,s:t.s,l:t.l}),B({h:(e+216)%360,s:t.s,l:t.l})]}l(D9,"_splitcomplement");function O9(r,t,e){t=t||6,e=e||30;var i=B(r).toHsl(),n=360/e,o=[B(r)];for(i.h=(i.h-(n*t>>1)+720)%360;--t;)i.h=(i.h+n)%360,o.push(B(i));return o}l(O9,"_analogous");function A9(r,t){t=t||6;for(var e=B(r).toHsv(),i=e.h,n=e.s,o=e.v,a=[],u=1/t;t--;)a.push(B({h:i,s:n,v:o})),o=(o+u)%1;return a}l(A9,"_monochromatic");B.mix=function(r,t,e){e=e===0?0:e||50;var i=B(r).toRgb(),n=B(t).toRgb(),o=e/100,a={r:(n.r-i.r)*o+i.r,g:(n.g-i.g)*o+i.g,b:(n.b-i.b)*o+i.b,a:(n.a-i.a)*o+i.a};return B(a)};B.readability=function(r,t){var e=B(r),i=B(t);return(Math.max(e.getLuminance(),i.getLuminance())+.05)/(Math.min(e.getLuminance(),i.getLuminance())+.05)};B.isReadable=function(r,t,e){var i=B.readability(r,t),n,o;switch(o=!1,n=G9(e),n.level+n.size){case"AAsmall":case"AAAlarge":o=i>=4.5;break;case"AAlarge":o=i>=3;break;case"AAAsmall":o=i>=7;break}return o};B.mostReadable=function(r,t,e){var i=null,n=0,o,a,u,s;e=e||{},a=e.includeFallbackColors,u=e.level,s=e.size;for(var p=0;p<t.length;p++)o=B.readability(r,t[p]),o>n&&(n=o,i=B(t[p]));return B.isReadable(r,i,{level:u,size:s})||!a?i:(e.includeFallbackColors=!1,B.mostReadable(r,["#fff","#000"],e))};var mf=B.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},N9=B.hexNames=k9(mf);function k9(r){var t={};for(var e in r)r.hasOwnProperty(e)&&(t[r[e]]=e);return t}l(k9,"flip");function zv(r){return r=parseFloat(r),(isNaN(r)||r<0||r>1)&&(r=1),r}l(zv,"boundAlpha");function ft(r,t){R9(r)&&(r="100%");var e=B9(r);return r=Math.min(t,Math.max(0,parseFloat(r))),e&&(r=parseInt(r*t,10)/100),Math.abs(r-t)<1e-6?1:r%t/parseFloat(t)}l(ft,"bound01");function Au(r){return Math.min(1,Math.max(0,r))}l(Au,"clamp01");function he(r){return parseInt(r,16)}l(he,"parseIntFromHex");function R9(r){return typeof r=="string"&&r.indexOf(".")!=-1&&parseFloat(r)===1}l(R9,"isOnePointZero");function B9(r){return typeof r=="string"&&r.indexOf("%")!=-1}l(B9,"isPercentage");function ke(r){return r.length==1?"0"+r:""+r}l(ke,"pad2");function Fa(r){return r<=1&&(r=r*100+"%"),r}l(Fa,"convertToPercentage");function qv(r){return Math.round(parseFloat(r)*255).toString(16)}l(qv,"convertDecimalToHex");function Zv(r){return he(r)/255}l(Zv,"convertHexToDecimal");var Ne=function(){var r="[-\\+]?\\d+%?",t="[-\\+]?\\d*\\.\\d+%?",e="(?:"+t+")|(?:"+r+")",i="[\\s|\\(]+("+e+")[,|\\s]+("+e+")[,|\\s]+("+e+")\\s*\\)?",n="[\\s|\\(]+("+e+")[,|\\s]+("+e+")[,|\\s]+("+e+")[,|\\s]+("+e+")\\s*\\)?";return{CSS_UNIT:new RegExp(e),rgb:new RegExp("rgb"+i),rgba:new RegExp("rgba"+n),hsl:new RegExp("hsl"+i),hsla:new RegExp("hsla"+n),hsv:new RegExp("hsv"+i),hsva:new RegExp("hsva"+n),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function Tr(r){return!!Ne.CSS_UNIT.exec(r)}l(Tr,"isValidCSSUnit");function F9(r){r=r.replace(y9,"").replace(g9,"").toLowerCase();var t=!1;if(mf[r])r=mf[r],t=!0;else if(r=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var e;return(e=Ne.rgb.exec(r))?{r:e[1],g:e[2],b:e[3]}:(e=Ne.rgba.exec(r))?{r:e[1],g:e[2],b:e[3],a:e[4]}:(e=Ne.hsl.exec(r))?{h:e[1],s:e[2],l:e[3]}:(e=Ne.hsla.exec(r))?{h:e[1],s:e[2],l:e[3],a:e[4]}:(e=Ne.hsv.exec(r))?{h:e[1],s:e[2],v:e[3]}:(e=Ne.hsva.exec(r))?{h:e[1],s:e[2],v:e[3],a:e[4]}:(e=Ne.hex8.exec(r))?{r:he(e[1]),g:he(e[2]),b:he(e[3]),a:Zv(e[4]),format:t?"name":"hex8"}:(e=Ne.hex6.exec(r))?{r:he(e[1]),g:he(e[2]),b:he(e[3]),format:t?"name":"hex"}:(e=Ne.hex4.exec(r))?{r:he(e[1]+""+e[1]),g:he(e[2]+""+e[2]),b:he(e[3]+""+e[3]),a:Zv(e[4]+""+e[4]),format:t?"name":"hex8"}:(e=Ne.hex3.exec(r))?{r:he(e[1]+""+e[1]),g:he(e[2]+""+e[2]),b:he(e[3]+""+e[3]),format:t?"name":"hex"}:!1}l(F9,"stringInputToObject");function G9(r){var t,e;return r=r||{level:"AA",size:"small"},t=(r.level||"AA").toUpperCase(),e=(r.size||"small").toLowerCase(),t!=="AA"&&t!=="AAA"&&(t="AA"),e!=="small"&&e!=="large"&&(e="small"),{level:t,size:e}}l(G9,"validateWCAG2Parms");var If=Ar(Tb());var oo={margin:6,text:{numLines:2,lineHeight:1.2,size:11.5,maxWidth:150,foregroundColor:"white",backgroundColor:"#333"},marker:{size:5,foregroundColor:{active:"white",inactive:void 0},backgroundColor:{active:"#333",inactive:void 0}}},DS={lightOnDark:{...oo,text:{...oo.text,foregroundColor:"white",backgroundColor:"#333"},marker:{...oo.marker,foregroundColor:{active:"white",inactive:void 0},backgroundColor:{active:"#333",inactive:void 0}}},darkOnLight:{...oo,text:{...oo.text,foregroundColor:"#333",backgroundColor:"white"},marker:{...oo.marker,foregroundColor:{active:"#333",inactive:void 0},backgroundColor:{active:"white",inactive:void 0}}}},OS="LOW_PRIORITY",Ib=4,AS=6,NS=20,kS=2.5,RS=2,BS="cover",Eb=.5,FS=6.5,Lb={heightAbovePolygon:0,appearance:DS.darkOnLight};var zi=class zi{lines=0;id;rank;type="label";initialRank;contextConfigured=!1;fillText=void 0;newStyle={};opacity=0;visibilityNeedsUpdate=!0;activeStrategyIndex=-1;text;style={top:0,left:0,textLabelVisible:!0,pinVisibility:1,textAlign:"left"};projection=new U;_cache={};appearance;options;visible=!1;enabled=!0;activeBoundingBox={x:0,y:0,w:0,h:0};dimensions={width:0,height:0};currentStrategyIndex=-1;totalMarkerSize=0;dirty=!0;collisionDirty=!0;lastTextAlign;imageHash;markerSize=0;iconVisible=!1;zoomProportion=0;dp;setEntity(){}constructor(t,e,i){var o,a;if(this.id=(o=e.id)!=null?o:ut(),this.options=(0,If.default)({},e,Lb),this.text=t,this.dp=(u=1)=>u*i.pixelRatio,typeof e.rank=="string")this.rank=to(e.rank),this.initialRank=this.rank;else if(e.rank!=null&&e.rank>0)this.rank=e.rank,this.initialRank=e.rank;else{let u=Math.trunc(b.env.NODE_ENV==="test"?zi.testId:zi.testId*10)/10;zi.testId+=.001,this.rank=u,this.initialRank=u}let n=(0,If.default)({},this.options.appearance,Lb.appearance);this.appearance={margin:n.margin,text:{lineHeight:n.text.lineHeight,numLines:n.text.numLines,size:n.text.size,maxWidth:n.text.maxWidth,foregroundColor:n.text.foregroundColor,backgroundColor:n.text.backgroundColor},marker:{foregroundColor:{active:n.marker.foregroundColor.active,inactive:n.marker.foregroundColor.inactive||B(n.marker.foregroundColor.active).setAlpha(.5).toRgbString()},backgroundColor:{active:n.marker.backgroundColor.active,inactive:n.marker.backgroundColor.inactive||B(n.marker.backgroundColor.active).setAlpha(.5).toRgbString()},icon:n.marker.icon,iconSize:n.marker.iconSize||NS,iconPadding:(a=n.marker.iconPadding)!=null?a:RS,iconFit:n.marker.iconFit||BS,iconVisibilityThreshold:n.marker.iconVisibilityThreshold==null?Eb:n.marker.iconVisibilityThreshold}},this.calculateMarkerSize()}calculateMarkerSize(){let{iconVisibilityThreshold:t=Eb}=this.appearance.marker,e=this.dp();this.zoomProportion<=t&&typeof this.appearance.marker.iconSize<"u"&&this.imageHash?(this.markerSize=this.dp(this.appearance.marker.iconSize),this.iconVisible=!0):(this.iconVisible=!1,this.markerSize=this.dp(FS)),this.totalMarkerSize=Math.ceil((this.markerSize+kS)/e)}get strategies(){let{width:t,height:e}=this.dimensions,{margin:i}=this.appearance;this.calculateMarkerSize();let n=Math.max(AS,i),o=this.iconVisible?n/2:0,a=[{name:"RIGHT",getBoundingBox:()=>{let u=Math.max(this.totalMarkerSize,e);return[u/2+n,u/2+n,this.totalMarkerSize/2+n,this.totalMarkerSize/2+t+n]},onStrategySelected:()=>{this.newStyle.textAlign="left",this.newStyle.pinVisibility=1,this.newStyle.top=-e/2,this.newStyle.left=this.totalMarkerSize/2+Ib,this.newStyle.textLabelVisible=!0}},{name:"LEFT",getBoundingBox:()=>{let u=Math.max(this.totalMarkerSize,e);return[u/2+n,u/2+n,this.totalMarkerSize/2+t+n,this.totalMarkerSize/2+n]},onStrategySelected:()=>{this.newStyle.textAlign="right",this.newStyle.pinVisibility=1,this.newStyle.top=-e/2,this.newStyle.left=-t-this.totalMarkerSize/2-Ib,this.newStyle.textLabelVisible=!0}},{name:"TOP",getBoundingBox:()=>{let u=this.dp();return[e+this.totalMarkerSize/2/u+n,this.totalMarkerSize/2+n,t/2+n,t/2+n]},onStrategySelected:()=>{this.newStyle.pinVisibility=1,this.newStyle.textAlign="center",this.newStyle.textLabelVisible=!0,this.newStyle.top=-this.totalMarkerSize-e/2,this.newStyle.left=-t/2}},{name:OS,getBoundingBox:()=>[this.totalMarkerSize/2+o,this.totalMarkerSize/2+o,this.totalMarkerSize/2+o,this.totalMarkerSize/2+o],onStrategySelected:()=>{this.newStyle.pinVisibility=.5,this.newStyle.textLabelVisible=!1,this.newStyle.top=0,this.newStyle.left=0}}];return this.text===""?[{name:"ICON_ONLY",getBoundingBox:()=>[this.totalMarkerSize/2+n,this.totalMarkerSize/2+n,this.totalMarkerSize/2+n,this.totalMarkerSize/2+n],onStrategySelected:()=>{this.newStyle.pinVisibility=1,this.newStyle.textLabelVisible=!1,this.newStyle.top=0,this.newStyle.left=0}}]:a}onStrategySelected=t=>{if(this.currentStrategyIndex===t)return;let e=this.strategies[t];e&&e.onStrategySelected(this),this.currentStrategyIndex=t;let i=this.style;this.style=this.newStyle,this.newStyle=i,this.iconVisible||(this.opacity=0,this.visibilityNeedsUpdate=!0)};updatePosition(){}disable(){this.visible=!1}toJSON(){return{x:this.projection.x,y:this.projection.y,enabled:this.enabled,id:this.id,rank:this.rank,bboxes:this.strategies.map((t,e)=>({index:e,boundingBox:t.getBoundingBox()})),shouldCollideWithScreenEdges:!1}}destroy(){}};l(zi,"LabelComponent"),v(zi,"testId",0);var Ef=zi,rr=Ef;d();d();function _b(r){return Qs(r)}l(_b,"getBoundingBoxFromFeature");var Lf=class Lf extends Zs{userData={entities:{}}};l(Lf,"EntityBatchedMesh");var ao=Lf,ja,Wa,qi,_f=class _f{constructor(t){v(this,"mesh");v(this,"outline");v(this,"type","geometry");v(this,"instanceIndex",-1);v(this,"geometry");v(this,"material");v(this,"feature");v(this,"color",new Tt);v(this,"topColor",new Tt);v(this,"position",new W);P(this,ja,0);P(this,Wa,1);P(this,qi,void 0);v(this,"texturesVisible",!1);this.feature=t}get visible(){return this.mesh?this.mesh.getVisibleAt(this.instanceIndex):!1}set visible(t){this.mesh&&this.mesh.setVisibleAt(this.instanceIndex,t)}setOpacity(t){this.mesh&&(this.material&&(this.material.opacity=t,this.material.transparent=t<1),this.outline&&(t<.5?this.outline.visible=!1:this.outline.visible=!0),t===0?this.mesh.visible=!1:this.mesh.visible=!0)}setColor(t,e){this.color.set(t),this.topColor.set(e),this.material&&this.material.setColor(this.instanceIndex,this.color,this.topColor)}get altitude(){return c(this,ja)}set altitude(t){this.mesh&&(this.mesh.position.z=t,E(this,ja,t))}get opacity(){return c(this,Wa)}set opacity(t){this.material&&(this.material.opacity=t,this.material.transparent=t<1,this.outline&&(this.outline.visible=t>.5),this.material.needsUpdate=!0),E(this,Wa,t)}get texture(){var t,e;return(e=(t=this.material)==null?void 0:t.texture)==null?void 0:e.image.src}set texture(t){this.material&&(this.material.texture=t)}set topTexture(t){this.material&&(this.material.topTexture=t)}get topTexture(){var t,e;return(e=(t=this.material)==null?void 0:t.topTexture)==null?void 0:e.image.src}get featureBbox(){return c(this,qi)?c(this,qi):(E(this,qi,_b(this.feature)),c(this,qi))}showTextures(){this.material&&(this.material.showTextures(this.instanceIndex),this.texturesVisible=!0)}hideTextures(){this.material&&(this.material.hideTextures(this.instanceIndex),this.texturesVisible=!1)}};ja=new WeakMap,Wa=new WeakMap,qi=new WeakMap,l(_f,"MeshComponent");var Jt=_f;var Df=class Df extends J{constructor(){super()}interpolators=new Map;addEntity3D(t,e){let[i,n,o,a]=e[1];this.interpolators.set(t,u=>pe(u,i,n,o,a))}addEntity2D(t,e){let[i,n,o]=e[1];this.interpolators.set(t,a=>a<i?n:o)}addAny(t,e){this.interpolators.set(t,e)}update=t=>{for(let[e,i]of this.interpolators)e instanceof Jt?e.setOpacity(i(t)):e instanceof rr?e.enabled=i(t):i(t)};destroy(){this.interpolators.clear()}};l(Df,"ZoomInterpolationSystem");var Xu=Df;d();var $i=class $i{id;type="marker";rank=0;initialRank=0;options={};projection=new U;enabled=!0;activeStrategyIndex=-1;strategyIndex=-1;activeBoundingBox={x:0,y:0,w:0,h:0};dimensions={width:0,height:0};containerEl;contentEl=null;contentHtml="";style={top:"0px",left:"0px"};dirty=!1;collisionDirty=!0;visibilityNeedsUpdate=!0;constructor(t,e={}){if(this.id=(e==null?void 0:e.id)||ut(),this.options=e,typeof e.rank=="string")this.rank=to(e.rank);else if(e.rank!=null&&e.rank>0)this.rank=e.rank;else{let n=Math.trunc(b.env.NODE_ENV==="test"?$i.testId:$i.testId*10)/10;$i.testId+=.001,this.rank=n}this.contentHtml=t,this.initialRank=this.rank;let i=document.createElement("div");i.style.opacity="0",i.innerHTML=`<div class="mappedin-marker">${this.contentHtml}</div>`,this.containerEl=i.querySelector(".mappedin-marker"),this.containerEl.setAttribute("data-marker-id",this.id.toString()),this.contentEl=this.containerEl?this.containerEl.firstElementChild:null}updateDimensions(t,e){if(t!=null&&e!=null)this.dimensions={width:t,height:e};else{let{width:i,height:n}=this.containerEl.getBoundingClientRect();this.dimensions={width:i,height:n}}Object.assign(this.containerEl,{width:this.dimensions.width+"px",height:this.dimensions.height+"px"})}visible=!1;animation=null;currentStrategyIndex=-1;onStrategySelected=(t,e=!1)=>{if(this.currentStrategyIndex===t||e)return;let{width:i,height:n}=this.dimensions,o=-n/2+"px",a=-i/2+"px";switch(this.style.top=o,this.style.left=a,this.options.anchor){case"top":{this.style.top=-n+"px";break}case"bottom":{this.style.top="0px";break}case"left":{this.style.left=-i+"px";break}case"right":{this.style.left="0px";break}default:this.style.top=o,this.style.left=a}this.containerEl.style.top=this.style.top,this.containerEl.style.left=this.style.left};get strategies(){let{width:t,height:e}=this.dimensions;return[{name:"center",getBoundingBox:()=>{let i=e/2,n=e/2,o=t/2,a=t/2;switch(this.options.anchor){case"top":{i=e,n=0;break}case"bottom":{i=0,n=e;break}case"left":{o=t,a=0;break}case"right":{o=0,a=t;break}}return[i,n,o,a]}}]}toJSON(){return{x:this.projection.x,y:this.projection.y,enabled:this.enabled,id:this.id,rank:this.rank,bboxes:this.strategies.map((t,e)=>({index:e,boundingBox:t.getBoundingBox()})),shouldCollideWithScreenEdges:!1}}destroy(){}};l($i,"MarkerComponent"),v($i,"testId",0);var ve=$i;d();d();d();d();d();var Of=class Of{hover=!1;dirty=!1};l(Of,"InteractionComponent");var so=Of;function de(r,t,e){if(t!==void 0){if(r.type==="model"||r.type==="path"||r.type==="marker"||r.type==="label"||r.type==="geometry"||r.type==="group-container")return t===!0?(r instanceof ge&&r.components[1]===void 0?(r.components[1]=new so,r.components[1].dirty=!0):r instanceof dt&&r.components[2]===void 0?(r.components[2]=new so,r.components[2].dirty=!0):r instanceof Pt&&r.components[1]===void 0&&(r.components[1]=new so,r.components[1].dirty=!0),!0):(r instanceof ge?r.components[1]=void 0:r instanceof dt?r.components[2]=void 0:r instanceof Pt&&(r.components[1]=void 0),!0);if(r.type==="geometry-group"){let i;for(let n of r.userData.entities3D.values())i=e.entity3DMap.get(n),de(i,t,e);return!0}}return!1}l(de,"updateInteractivity");function Db(r,t,e){if(e!==void 0&&r.type==="geometry-group"&&r.components[0]!=null){let i,n,o=r.components[0];for(let a of r.userData.entities3D.values())i=t.entity3DMap.get(a),i&&(n=i.components[1],n.color===o.color&&(n.initialColor=e.color||o.color,n.color=e.color||o.color,n.dirty=!0),n.topColor===o.topColor&&(n.topColor=e.topColor||o.topColor,n.dirty=!0));return e.color!==void 0&&(r.components[0].color=e.color),e.topColor!==void 0&&(r.components[0].topColor=e.topColor),!0}return!1}l(Db,"updateGroupColor");function Ob(r,t){if(t!==void 0&&r.type==="geometry-group"&&r.components[0]!=null){let e=r.components[0];return e.shading=e.shading||{},e.shading&&(t.start!==e.shading.start||t.end!==e.shading.end||t.intensity!==e.shading.intensity)&&(Object.assign(e.shading,t),r.userData.shadingDirty=!0),!0}return!1}l(Ob,"updateGroupShading");function Ab(r,t){t!==void 0&&(r.type==="path"||r.type==="geometry")&&(t.initialColor!==void 0&&(r.components[1].initialColor=t.initialColor),t.color!==void 0&&(r.components[1].color=t.color),t.topColor!==void 0&&(r.components[1].topColor=t.topColor),r.components[1].dirty=!0)}l(Ab,"updateColor");function Nf(r,t,e){t!==void 0&&(r.type==="label"||r.type==="marker"?(r.object3d.position.copy(e(t[1],t[0],t[2]||0)),r.positionDirty=!0):r.type==="custom-geometry"&&r.components[0].position.copy(e(t[1],t[0],t[2]||0)))}l(Nf,"updatePosition");function kf(r,t){var e;return t!==void 0&&(r.type==="marker"||r.type==="label"||r.type==="custom-geometry")&&r.parent!==t&&r.parent instanceof Pt?((e=r.parent)==null||e.removeEntity(r),t.addEntity(r),!0):!1}l(kf,"updateParent");function Nb(r,t){t!==void 0&&(r.type==="marker"||r.type==="label")&&(r.components[0].enabled=t)}l(Nb,"updateEnabled");function kb(r,t){if(t!==void 0&&r.type==="path"){let e=r.components[0];t.completeFraction!==void 0&&(e.completeFraction=t.completeFraction)}}l(kb,"updatePath");function Rb(r,t){if(t!==void 0&&r.type==="marker"){let e=r.components[0];if(t.contentHTML!==void 0)return e.containerEl.innerHTML=t.contentHTML,!0}return!1}l(Rb,"updateMarker");function Bb(r,t){return t!==void 0&&(r.type==="marker"||r.type==="label")?(r.components[0].rank=to(t),!0):!1}l(Bb,"updateRank");function Fb(r,t){var e,i,n;if(t!==void 0&&r.type==="label"){let o=r.components[0];t.text!==void 0&&(o.text=t.text,o.dirty=!0),((e=t.options)==null?void 0:e.appearance)!==void 0&&Object.keys((i=t.options)==null?void 0:i.appearance).length>0&&(af(o.appearance,((n=t.options)==null?void 0:n.appearance)||{}),o.dirty=!0)}}l(Fb,"updateLabel");function Gb(r,t){t!==void 0&&r.type==="geometry"&&(r.components[1].hoverColor=t,r.components[1].dirty=!0)}l(Gb,"updateHoverColor");function lo(r,t){if(t!==void 0){if(r.type==="model"||r.type==="path"||r.type==="geometry"||r.type==="custom-geometry"){r.components[1].visible=t,r.components[1].dirty=!0;let e=r.parent;e instanceof Bt&&(e.userData.outlineDirty=!0)}else(r.type==="group-container"||r.type==="geometry-group")&&r.setVisible(t);return!0}return!1}l(lo,"updateVisibility");function Vb(r,t,e){if(e!==void 0&&r.type==="geometry-group"){r.setOpacity(e),r.components[0].opacity=e;for(let i of r.userData.entities3D.values()){let n=t.entity3DMap.get(i);((n==null?void 0:n.type)==="geometry"||(n==null?void 0:n.type)==="model")&&(n.components[1].opacity=e,n.components[1].dirty=!0)}}}l(Vb,"updateOpacity");function Rf(r,t){t!==void 0&&(r.type==="model"||r.type==="path"||r.type==="geometry"||r.type==="custom-geometry"?(r.components[1].altitude=t,r.components[1].dirty=!0):r.type==="group-container"&&r.setAltitude(t))}l(Rf,"updateAltitude");function Bf(r,t){if(t!==void 0){if(r.type==="geometry-group"&&r.components[0]!=null)r.components[0].outline=t,r.userData.outlineDirty=!0;else if(r.type==="geometry"){r.components[1].outline=t,r.components[1].dirty=!0;let e=r.parent;e instanceof Bt&&(e.userData.outlineDirty=!0)}return!0}return!1}l(Bf,"updateOutline");var Ji,nr,Yu,ju,Hb,Za,Wu,Uu,Xb,Zu,Yb,za,zu,qa,$a,qu,Gf=class Gf{constructor(t){P(this,ju);P(this,Uu);P(this,Zu);P(this,Ji,null);P(this,nr,void 0);v(this,"getCurrentSceneGLTF",async t=>{let e={onlyVisible:!0,binary:!0,light:!0,scale:1,...t},i=await Y(this,ju,Hb).call(this),n=c(this,Yu).call(this,e),o=await i.parseAsync(n,{trs:!1,maxTextureSize:1/0,onlyVisible:e.onlyVisible,binary:e.binary,scale:e.scale}),a;if(o instanceof ArrayBuffer)a=new Blob([o],{type:"application/octet-stream"});else{let u=JSON.stringify(o,null,2);a=new Blob([u],{type:"text/plain"})}return a});P(this,Yu,l(t=>{let{scale:e,light:i,onlyVisible:n}=t,o=new Ws,a=new we().setFromObject(c(this,nr).entityScene);if(c(this,Za).call(this,c(this,nr).entityScene,o,n),i){let u=new zs(16777215,.3*Math.PI);u.position.set(0,Math.max(a.max.x,a.max.y)*e*.5,a.max.y*e*4),u.lookAt(0,0,-1),u.target.position.set(0,0,-1),u.add(u.target),o.add(u)}return o},"#getExportedScene"));P(this,Za,l((t,e,i)=>{t.material&&(t instanceof Zs?Y(this,Uu,Xb).call(this,t).forEach(n=>e.add(n)):t instanceof yi&&e.add(Y(this,Zu,Yb).call(this,t))),t.children.forEach(n=>{(!i||n.visible)&&c(this,Za).call(this,n,e,i)})},"#processObject3D"));P(this,Wu,l((t,e,i)=>{let n=new y1({color:new Tt(t),metalness:0});return n.opacity=e,n.transparent=i,n},"#createStandardMaterial"));P(this,za,l(t=>{let{geometry:e,material:i,position:n,rotation:o,quaternion:a,scale:u}=t;if(!(e!=null&&e.isBufferGeometry))return t;let s=e.attributes.position,p=e.attributes.normal,f=e.attributes.uv;return c(this,zu).call(this,s,p),c(this,$a).call(this,n,u,o,a),f&&c(this,qu).call(this,f),i!=null&&i.map&&e.type==="PlaneGeometry"&&(t.side=To),t},"#convertGeometry"));P(this,zu,l((t,e)=>{let i=new W,n=new W;for(let o=0;o<t.count;o++)i.fromBufferAttribute(t,o),c(this,qa).call(this,i),t.setXYZ(o,i.x,i.y,i.z),e&&(n.fromBufferAttribute(e,o),c(this,qa).call(this,n),e.setXYZ(o,n.x,n.y,n.z))},"#convertAttributes"));P(this,qa,l(t=>{let e=t.y;t.y=t.z,t.z=-e},"#convertVector"));P(this,$a,l((t,e,i,n)=>{let o=t.y;t.y=t.z,t.z=-o;let a=e.y;if(e.y=e.z,e.z=a,i instanceof fn)i.order="YXZ",i.set(i.x,i.y,i.z,i.order);else{let u=n.y;n.set(n.x,n.z,-u,n.w)}},"#convertObjectProperties"));P(this,qu,l(t=>{for(let e=0;e<t.count;e++){let i=t.getX(e),n=t.getY(e);t.setXY(e,i,n)}},"#convertUVs"));E(this,nr,t),c(this,nr).entityScene=t.entityScene,c(this,nr).entity3DMap=t.entity3DMap}destroy(){E(this,Ji,null)}};Ji=new WeakMap,nr=new WeakMap,Yu=new WeakMap,ju=new WeakSet,Hb=l(async function(){if(!c(this,Ji)){let{GLTFExporter:t}=await import("./GLTFExporter-R7ENFQC2.js");E(this,Ji,new t)}return c(this,Ji)},"#getGLTFExporter"),Za=new WeakMap,Wu=new WeakMap,Uu=new WeakSet,Xb=l(function(t){var a,u;let e=[],n=((a=t.userData)!=null&&a.entities?Object.values((u=t.userData)==null?void 0:u.entities):[]).map(s=>c(this,nr).entity3DMap.get(s)),o=new Map;return n.forEach(s=>{var x;if(!s||!(s instanceof dt))return;let p=s.components[1],f=s.components[2];if(!p.visible||p.opacity===0)return;let y=`${f!=null&&f.hover?p.hoverColor||c(this,nr).hoverColor:p.color}-${p.opacity}-${Number(p.visible)}`;o.has(y)||o.set(y,[]),(x=o.get(y))==null||x.push(s)}),o.forEach((s,p)=>{let[f,m,y]=p.split("-"),x=s.reduce((C,I)=>{let T=I.components[0];if(T.type==="custom-geometry")return C;let w=T==null?void 0:T.geometry;return w&&C.push(w),C},[]),S=c(this,Wu).call(this,f,Number(m),t.material.transparent),M=je(x,!0),g=new Zt(M,S);g.position.copy(t.position),g.rotation.copy(t.rotation),g.scale.copy(t.scale),g.visible=!!y,c(this,$a).call(this,g.position,g.scale,g.rotation,g.quaternion),e.push(c(this,za).call(this,g))}),e},"#processBatchedMesh"),Zu=new WeakSet,Yb=l(function(t){let e=t.geometry.clone(),i=t.material,n=new Nr({color:i.color,side:To});n.opacity=i.opacity,n.transparent=i.transparent;let o=new yi(e,n);return o.position.copy(t.position),o.rotation.copy(t.rotation),o.scale.copy(t.scale),o.visible=t.visible,c(this,za).call(this,o)},"#processLineSegments"),za=new WeakMap,zu=new WeakMap,qa=new WeakMap,$a=new WeakMap,qu=new WeakMap,l(Gf,"ExporterSystem");var Ua=Gf;d();var jb="#ffffff";var Vf=class Vf{initialColor=jb;color=jb;topColor;topTexture;texture;hoverColor;dirty=!0;visible=!0;opacity=1;width=.1;height=.1;altitude=0;join="round";cap="round";outline=!0;constructor(t={}){this.color=(t==null?void 0:t.color)!==void 0?t.color:this.color,this.initialColor=this.color,this.width=(t==null?void 0:t.width)!==void 0?t.width:this.width,this.opacity=(t==null?void 0:t.opacity)!==void 0?t.opacity:this.opacity,this.visible=(t==null?void 0:t.visible)!==void 0?t.visible:this.visible,this.height=(t==null?void 0:t.height)!==void 0?t.height:this.height,this.altitude=(t==null?void 0:t.altitude)!==void 0?t.altitude:this.altitude,this.join=(t==null?void 0:t.join)!==void 0?t.join:this.join,this.cap=(t==null?void 0:t.cap)!==void 0?t.cap:this.cap,this.topColor=t==null?void 0:t.topColor,this.texture=t==null?void 0:t.texture,this.topTexture=t==null?void 0:t.topTexture,this.outline=(t==null?void 0:t.outline)!==void 0?!!t.outline:this.outline}};l(Vf,"StyleComponent");var ai=Vf;d();d();d();d();var $u={top:0,bottom:0,left:0,right:0};d();d();d();d();var Hf=class Hf extends p1{_width;_height;_propertiesLength;constructor(t){let e=t,i=3,n=i*4;super(new Float32Array(t*n),i,t,t1,Qm),this._width=n,this._height=e,this._propertiesLength=i}setColor(t,e,i){let n=this.image.data,o=t*this._width;n[o]=e.r,n[o+1]=e.g,n[o+2]=e.b,n[o+3]=0,n[o+4]=i.r,n[o+5]=i.g,n[o+6]=i.b,n[o+7]=0,this.needsUpdate=!0}setTexture(t,e,i){let n=this.image.data,o=t*this._width;n[o+8]=e?1:0,n[o+9]=i?1:0,n[o+10]=0,n[o+11]=0,this.needsUpdate=!0}};l(Hf,"BatchedPropertiesTexture");var Ju=Hf;var Wb=`#define LAMBERT
450
450
  varying vec3 vViewPosition;
451
451
  varying vec4 vPosition;
452
452
  varying vec2 vUv;
@@ -497,7 +497,7 @@ void main() {
497
497
  vUv = uv;
498
498
  // world position
499
499
  vWorldPosition = (modelMatrix * vec4(position, 1.0)).xyz;
500
- }`;var Ob=`#define LAMBERT
500
+ }`;var Ub=`#define LAMBERT
501
501
  uniform vec3 diffuse;
502
502
  uniform vec3 emissive;
503
503
  uniform float opacity;
@@ -608,7 +608,7 @@ void main() {
608
608
  #include <premultiplied_alpha_fragment>
609
609
  #include <dithering_fragment>
610
610
  }
611
- `;var IS=-.05,ES=1,kf=class kf extends yn{propertiesTexture;uniforms={uGradientIntensity:{value:0},uGradientEnd:{value:0},uGradientStart:{value:0},uTopTexture:{value:null},uTexture:{value:null}};constructor(t,e){super(t),this.propertiesTexture=new ju(e),this.onBeforeCompile=i=>{let n=this.uniforms.uGradientIntensity,o=this.uniforms.uGradientEnd,a=this.uniforms.uGradientStart,u=this.uniforms.uTopTexture,s=this.uniforms.uTexture;this.uniforms=i.uniforms,i.vertexShader=Db,i.fragmentShader=Ob,Object.assign(this.uniforms,{uGradientIntensity:n,uGradientEnd:o,uGradientStart:a,uMinSideAlpha:{value:IS},uMaxSideAlpha:{value:ES},uPropertiesTexture:{value:this.propertiesTexture},uTopTexture:u,uTexture:s})}}get texture(){return this.uniforms.uTexture.value}set texture(t){t.wrapS=He,t.wrapT=He,t.colorSpace=mi,this.uniforms.uTexture.value=t}get topTexture(){return this.uniforms.uTopTexture.value}set topTexture(t){t.wrapS=He,t.wrapT=He,t.colorSpace=mi,this.uniforms.uTopTexture.value=t}setGradientShading(t,e,i){this.uniforms.uGradientStart.value=t,this.uniforms.uGradientEnd.value=e,this.uniforms.uGradientIntensity.value=i}setColor(t,e,i){this.propertiesTexture.setColor(t,e,i)}showTextures=t=>{let e=!!this.uniforms.uTexture.value,i=!!this.uniforms.uTopTexture.value;(e||i)&&(this.propertiesTexture.setTexture(t,e,i),this.needsUpdate=!0)};hideTextures(t){let e=!!this.uniforms.uTexture.value,i=!!this.uniforms.uTopTexture.value;(e||i)&&(this.propertiesTexture.setTexture(t,!1,!1),this.needsUpdate=!0)}dispose(){super.dispose(),this.propertiesTexture.dispose()}};l(kf,"BatchedStandardMaterial");var Wu=kf;d();var _S=80;function Ab(r,t){var u,s;let e=0;for(let p of r)e+=((s=(u=p.components[0])==null?void 0:u.geometry)==null?void 0:s.attributes.position.count)||0;let i=new wt(t.color),n=new Wu({color:i,side:wo,opacity:t.opacity||1,transparent:t.opacity!==void 0?t.opacity<1:!1},r.length),o=new ao(r.length,e,0,n),a;for(let p of r)a=p.components[0],!(!(a instanceof Jt)||!a.geometry)&&(a.mesh=o,a.material=n,a.instanceIndex=o.addGeometry(a.geometry),o.userData.entities[a.instanceIndex]=p.id,n.setColor(a.instanceIndex,i,t.topColor?new wt(t.topColor):i));return o.perObjectFrustumCulled=!0,o.matrixAutoUpdate=!1,o}l(Ab,"batchGeometries");function kb(r,t){t.polygonOffset=!0,t.polygonOffsetFactor=1,t.polygonOffsetUnits=1;let e=new a1(r,_S),i=B(t.color.getHexString()).darken(30).toRgbString(),n=new n1({linewidth:2,color:i,transparent:!0}),o=new yi(e,n);return o.layers.set(1),o}l(kb,"createOutlines");d();var DS="gray",OS=.1;function Nb(r,t,e){let{color:i=DS,opacity:n=1,altitude:o=0,height:a=OS}=e||{};Array.isArray(n)&&(n=1);let u={min:{x:1/0,y:1/0,z:o},max:{x:-1/0,y:-1/0,z:a+o},center:{x:0,y:0,z:(a+o)/2}},s=new Xe,p=r.geometry.coordinates[0].map(x=>{let S=t(x[1],x[0]);return u.min.x=Math.min(u.min.x,S.x),u.min.y=Math.min(u.min.y,S.y),u.max.x=Math.max(u.max.x,S.x),u.max.y=Math.max(u.max.y,S.y),S});s.moveTo(p[0].x,p[0].y),p.slice(1).forEach(x=>s.lineTo(x.x,x.y)),s.lineTo(p[0].x,p[0].y);let f=r.geometry.coordinates.slice(1);s.holes=f.map(x=>{let S=x.map(g=>t(g[1],g[0])),M=new Nr;return M.moveTo(S[0].x,S[0].y),S.slice(1).forEach(g=>M.lineTo(g.x,g.y)),M.lineTo(S[0].x,S[0].y),M});let m={bevelEnabled:!1,depth:a},y=new Ye(s,m);return y.translate(0,0,o||0),y.userData={style:{color:i,opacity:n}},y}l(Nb,"renderPolygonGeometry");d();var AS="gray",kS=.1;function Rb(r,t,e){let{color:i=AS,opacity:n=1,altitude:o=0,height:a=kS}=e||{};Array.isArray(n)&&(n=1);let u={min:{x:1/0,y:1/0,z:o},max:{x:-1/0,y:-1/0,z:a+o}},s={bevelEnabled:!1,depth:a},p=[];r.geometry.coordinates.forEach(m=>{let y=new Xe,x=m[0].map(g=>{let C=t(g[1],g[0]);return u.min.x=Math.min(u.min.x,C.x),u.min.y=Math.min(u.min.y,C.y),u.max.x=Math.max(u.max.x,C.x),u.max.y=Math.max(u.max.y,C.y),C});y.moveTo(x[0].x,x[0].y),x.slice(1).forEach(g=>y.lineTo(g.x,g.y)),y.lineTo(x[0].x,x[0].y);let S=m.slice(1);y.holes=S.map(g=>{let C=g.map(w=>t(w[1],w[0])),I=new Nr;return I.moveTo(C[0].x,C[0].y),C.slice(1).forEach(w=>I.lineTo(w.x,w.y)),I.lineTo(C[0].x,C[0].y),I});let M=new Ye(y,s);p.push(M)});let f=je(p);return f.translate(0,0,o||0),f.userData={style:{color:i,opacity:n}},f}l(Rb,"renderMultiPolygonGeometry");d();d();var Bf=Ar(Zb());function Ub(r){this.name="JSClipperError",this.message=r,this.stack=new Error().stack}l(Ub,"JSClipperError");Ub.prototype=Error.prototype;Bf.default.Error=function(r){throw new Ub(r)};var ae=Bf.default;var IP="gray",Ff=new ae.ClipperOffset,Qt=100;function zb(r,t,e){let{color:i=IP,opacity:n=1,width:o=1,join:a="round",cap:u="round",height:s=.01,altitude:p=0}=e||{};Array.isArray(n)&&(n=0);let f=[];for(let M=0;M<r.geometry.coordinates.length-1;M++){let g=t(r.geometry.coordinates[M][1],r.geometry.coordinates[M][0]),C=t(r.geometry.coordinates[M+1][1],r.geometry.coordinates[M+1][0]);f.push([g,C])}Ff.AddPaths(f.map(M=>M.map(g=>({X:g.x*Qt,Y:g.y*Qt}))),a==="round"?ae.JoinType.jsRound:a==="miter"?ae.JoinType.jsMiter:ae.JoinType.jsSquare,u==="round"?ae.EndType.etOpenRound:u==="butt"?ae.EndType.etOpenButt:ae.EndType.etOpenSquare);let m=new ae.PolyTree;Ff.Execute(m,o/2*Qt);let y=[],x={bevelEnabled:!1,depth:s};for(let M of m.m_AllPolys){let g=new Xe;if(M.IsHole())continue;let C=M.m_polygon;g.moveTo(C[0].X/Qt,C[0].Y/Qt),C.slice(1).forEach(I=>g.lineTo(I.X/Qt,I.Y/Qt)),g.lineTo(C[0].X/Qt,C[0].Y/Qt),g.holes=M.m_Childs.map(I=>{let w=new Nr,T=I.m_polygon;return w.moveTo(T[0].X/Qt,T[0].Y/Qt),T.slice(1).forEach(L=>w.lineTo(L.X/Qt,L.Y/Qt)),w.lineTo(T[0].X/Qt,T[0].Y/Qt),w}),y.push(new Ye(g,x))}let S=je(y);return S.translate(0,0,p||0),S.userData={style:{color:i,opacity:n}},Ff.Clear(),S}l(zb,"renderLineStringGeometry");d();var te=100,EP=.22,LP=.01;function qb(r,t,e={}){let{width:i=EP,height:n=LP,color:o="gray",opacity:a=1,altitude:u=0}=e,s={min:{x:1/0,y:1/0,z:u},max:{x:-1/0,y:-1/0,z:u+n}},p={bevelEnabled:!1,depth:n},f=new ae.ClipperOffset,m=r.geometry.coordinates.map(M=>M.map(g=>t(g[1],g[0])));f.AddPaths(m.map(M=>M.map(g=>({X:g.x*te,Y:g.y*te}))),ae.JoinType.jsMiter,ae.EndType.etOpenRound);let y=new ae.PolyTree;f.Execute(y,i/2*te);let x=[];for(let M of y.m_AllPolys){let g=new Xe;if(M.IsHole())continue;s.min.x=Math.min(s.min.x,M.m_polygon[0].X),s.min.y=Math.min(s.min.y,M.m_polygon[0].Y),s.max.x=Math.max(s.max.x,M.m_polygon[0].X),s.max.y=Math.max(s.max.y,M.m_polygon[0].Y);let C=M.m_polygon;g.moveTo(C[0].X/te,C[0].Y/te),C.slice(1).forEach(I=>g.lineTo(I.X/te,I.Y/te)),g.lineTo(C[0].X/te,C[0].Y/te),g.holes=M.m_Childs.map(I=>{let w=new Nr,T=I.m_polygon;return w.moveTo(T[0].X/te,T[0].Y/te),T.slice(1).forEach(L=>w.lineTo(L.X/te,L.Y/te)),w.lineTo(T[0].X/te,T[0].Y/te),w}),x.push(new Ye(g,p))}let S=je(x);return S.translate(0,0,u||0),S.userData={style:{color:o,opacity:a}},f.Clear(),S}l(qb,"renderMultiLineStringGeometry");d();var Ka,Qa,Gf=class Gf{constructor(t){v(this,"mesh");v(this,"type","model");v(this,"outline");v(this,"geometry");v(this,"material");v(this,"feature");v(this,"instanceIndex",-1);v(this,"visible",!0);v(this,"color",new wt);v(this,"position",new j);P(this,Ka,0);P(this,Qa,1);this.feature=t}setOpacity(){}setColor(){}get altitude(){return c(this,Ka)}set altitude(t){this.mesh&&(this.mesh.position.z=t,E(this,Ka,t))}get opacity(){return c(this,Qa)}set opacity(t){var e,i;if(this.mesh){for(let n of this.mesh.children)if(n instanceof Ws){((e=n.userData)==null?void 0:e.originalOpacity)===void 0&&(n.userData.originalOpacity=n.material.opacity);let o=pe(t,0,(i=n.userData)==null?void 0:i.originalOpacity,0,1);n.material.opacity=o,n.material.transparent=o<1,n.material.needsUpdate=!0}}E(this,Qa,t)}};Ka=new WeakMap,Qa=new WeakMap,l(Gf,"ModelComponent");var ui=Gf;function _P(r){let{color:t,opacity:e,topColor:i,texture:n,topTexture:o}=r;return`${t}${e}${i||""}${n||""}${o||""}`}l(_P,"generateIndex");var DP=1e4,Vf=class Vf extends et{state;convertTo3DMapPosition;loader;constructor(t,e){super(),this.state=t,this.convertTo3DMapPosition=e}async getGLTFLoader(){if(this.loader)return;let{GLTFLoader:t}=await import("./GLTFLoader-XXHIST4U.js");this.loader=new t}createEntityFromFeature(t,e,i){let n=new Jt(e),o=new dt(n,new ai(i));return o.id=t,o}createModelFromFeature(t,e,i){let n=new ui(e),o=new dt(n,new ai(i));return o.id=t,o}populateEntityMesh(t,e){let i=t.components[0];i.geometry=e}async populateModelGroup(t,e,i){let n=new pr,o=new fn,a=new qm,u=new j,s=new Qe;return this.loader||await this.getGLTFLoader(),this.loader.load(e,p=>{var y,x,S,M,g,C;p.scene.traverse(I=>{let w=I;if("isMesh"in w&&w.isMesh===!0){let T=new Ws(w.geometry,w.material,t.size);T.userData={entities:{}},s.add(T),i.add(s)}});let f=0,m;for(let I of t.values()){m=this.state.entity3DMap.get(I);let w=m.components[0],T=m.components[0].feature;w.mesh=s,w.instanceIndex=f;let{x:L,y:D,z:R}=this.convertTo3DMapPosition(T.geometry.coordinates[1],T.geometry.coordinates[0],0);w.position.set(L,D,R),o.set(((y=T.properties.rotation)==null?void 0:y[0])||0,((x=T.properties.rotation)==null?void 0:x[1])||0,((S=T.properties.rotation)==null?void 0:S[2])||0),u.set(((M=T.properties.scale)==null?void 0:M[0])||1,((g=T.properties.scale)==null?void 0:g[1])||1,((C=T.properties.scale)==null?void 0:C[2])||1),a.setFromEuler(o),n.compose(w.position,a,u),s.children.forEach(F=>{let N=F;N.setMatrixAt(f,n),N.userData.entities[f]=m.id}),f++}this.publish("model-loaded")}),s}populateEntityGroup(t){let e,i,n,o;for(let a of t.values())o=this.state.entity3DMap.get(a),o.components[0]instanceof Jt&&(i=o.components[0].feature,n=o.components[1],i.geometry.type==="Polygon"?(e=Nb(i,this.convertTo3DMapPosition,n),this.populateEntityMesh(o,e)):i.geometry.type==="MultiPolygon"?(e=Rb(i,this.convertTo3DMapPosition,n),this.populateEntityMesh(o,e)):i.geometry.type==="LineString"?(e=zb(i,this.convertTo3DMapPosition,n),this.populateEntityMesh(o,e)):i.geometry.type==="MultiLineString"&&(e=qb(i,this.convertTo3DMapPosition,n),this.populateEntityMesh(o,e)));return t}optimize(t){if(t.visible&&(t instanceof Bt||t instanceof Pt)){for(let n of t.children)this.optimize(n);if(t instanceof Pt||t.userData.dirty===!1)return;let e={};if(!t.userData.modelURL&&t.userData.dirty)try{this.populateEntityGroup(t.userData.entities3D)}catch(n){G.warn(n)}else t.userData.modelURL&&t.userData.dirty&&(this.populateModelGroup(t.userData.entities3D,t.userData.modelURL,t),t.userData.dirty=!1);let i=0;if(t.userData.dirty){let n=0,o;for(let a of t.userData.entities3D.values()){o=this.state.entity3DMap.get(a);let u=o.components[0],s=o.components[1];if(u instanceof Jt){n++,n>=DP&&(n=0,i++);let p=_P(s)+i;e[p]===void 0&&(e[p]={style:s,entities:[]}),e[p].entities.push(o)}else u.mesh&&u.mesh.parent!==t&&t.add(u.mesh)}for(let a in e){let u=Ab(e[a].entities,e[a].style);t.add(u),t.userData.outlineDirty=!0,t.userData.dirty=!1}}}}update(){this.optimize(this.state.entityScene)}};l(Vf,"MeshCreationAndOptimizationSystem");var $u=Vf;d();var Hf=class Hf{state;dirty=!0;domTree;constructor(t,e){this.state=t,this.domTree=e}update(){if(this.dirty){let t;for(let e of Array.from(this.domTree.children))if(t=this.state.entity2DMap.get(e.userData.entityId),t){let i=t.components[0];(!i.enabled||!i.visible||!this.state.entity2DIds.has(e.userData.entityId))&&this.domTree.removeChild(e)}else this.domTree.removeChild(e);for(let e of this.state.entity2DIds)if(t=this.state.entity2DMap.get(e),t){let i=t.components[0];i instanceof ve&&i.enabled&&i.containerEl&&!this.domTree.contains(i.containerEl)&&(i.containerEl.userData={entityId:t.id},this.domTree.appendChild(i.containerEl),i.updateDimensions())}this.dirty=!1}}};l(Hf,"DOMVisibilitySystem");var Ju=Hf;d();var Xf=class Xf{state;project;constructor(t,e){this.state=t,this.project=e}update(){let t;for(let e of this.state.entity2DIds)t=this.state.entity2DMap.get(e),t&&this.project(t.components[0].projection,t.position)}};l(Xf,"TwoDProjectionSystem");var Ku=Xf;d();d();var OP=l(function(){let t,e;return i=>{if((!e||!e)&&(t=document.createElement("canvas"),t.width=500*i,t.height=500*i,t.style.width="500px",t.style.height="500px",e=t.getContext("2d")),!e)throw new Error("Could not get 2D context");return{measureCanvas:t,measureCanvasContext:e}}},"createMeasureCanvasContext")(),$b=l(({text:r,size:t,maxWidth:e,pixelRatio:i,maxLines:n=2,lineHeight:o=1.2,options:a={strokeText:!0}})=>{let u=`bold ${t*i}px 'InterUI-Regular', Helvetica Neue, Arial, sans-serif`,{measureCanvasContext:s}=OP(i);s.font=u;let p=[],f=r.split(" "),m=0,y=0,x=0;for(;y<f.length;){let C=f[y];if(m===n&&m>0){p[m-1]+="...";break}if(p[m]==null&&(p[m]=C,y++),f.length===1){p[m]=C;break}if(f[y]==null)break;let{width:I}=s.measureText(p[m]+" "+f[y]);I<=e*i?(p[m]+=" "+f[y],y++):m++}p.forEach(C=>{let{width:I}=s.measureText(C);x=Math.max(I,x)});let S=t*i*o,M=p.length*S;return{maxWidth:x,maxHeight:M,lines:p.length,draw:(C,I,w)=>{p.length===1?(a.strokeText&&C.strokeText(p[0],I,w),C.fillText(p[0],I,w)):(a.strokeText&&(C.strokeText(p[0],I,w-S/2),C.strokeText(p[1],I,w+S/2)),C.fillText(p[0],I,w-S/2),C.fillText(p[1],I,w+S/2))}}},"shaveText");var AP=4.5,kP=2.5,NP=2,RP=5,ts=2.5;var Yf=class Yf{dirty=!1;state;colliderContext;colliderCanvas;constructor(t,e){this.state=t,this.colliderCanvas=e,this.colliderContext=e.getContext("2d")}pinCache={};imagePromiseCache={};imageDimensionsCache={};textCache={};update=(t,e,i)=>{let n=(t-e)/(i-e),o=this.state.pixelRatio;this.colliderContext.clearRect(0,0,this.colliderCanvas.width,this.colliderCanvas.height);let a,u,s,p,f,m;for(let y of this.state.entity2DIds)if(m=this.state.entity2DMap.get(y),m!=null&&m.components[0]instanceof rr&&!m.disposed){if(f=m.components[0],u=f.appearance.marker.foregroundColor,s=f.appearance.marker.backgroundColor,p=f.markerSize,a=`${u.active}-${u.inactive}-${s.active}-${s.inactive}-${p}`,this.pinCache[a]||this.prepare(f,a,this.colliderContext),f.appearance.marker.icon&&!f.imageHash&&this.cacheImage(f),this.textCache[f.id]==null||f.dirty||this.dirty){f.dirty=!1,f.collisionDirty=!0,this.textCache[f.id]={};let{textDrawFn:x,width:S,height:M}=this.processText(f.text,f.appearance.text.size,f.appearance.text.maxWidth,f.appearance.text.numLines,f.appearance.text.lineHeight);["left","center","right"].forEach(C=>{this.textCache[f.id][C]=this.textToCanvas(x,f.appearance.text.size,C,S,M,f.appearance.text.foregroundColor,f.appearance.text.backgroundColor)}),f.dimensions={width:Math.ceil(S/o),height:Math.ceil(M/o)},f.currentStrategyIndex===-1&&(f.currentStrategyIndex=0);let g=f.strategies[f.currentStrategyIndex];if(g){g.onStrategySelected(f);let C=f.style;f.style=f.newStyle,f.newStyle=C}}f.visible&&f.enabled&&(f.zoomProportion=n,this.draw(f,a,this.colliderContext))}this.dirty=!1};processText=(t,e,i,n,o)=>{let a=this.state.pixelRatio,{draw:u,maxWidth:s,maxHeight:p}=$b({text:t,size:e,pixelRatio:a,maxWidth:i,maxLines:n,lineHeight:o});return{textDrawFn:u,width:s+ts*a*2,height:p+ts*a*2}};textToCanvas=(t,e,i,n,o,a,u)=>{let s=this.state.pixelRatio,p,f=n,m=o;window.OffscreenCanvas!=null&&!zd()?p=new OffscreenCanvas(f,m):(p=document.createElement("canvas"),p.width=f,p.height=m,p.style.width=f+"px",p.style.height=m+"px");let y=p.getContext("2d",{willReadFrequently:!0});if(!y)return;y.textAlign=i,y.font=`bold ${e*s}px 'InterUI-Regular', Helvetica Neue, Arial, sans-serif`,y.textBaseline="middle",y.lineJoin="miter",y.miterLimit=2,y.strokeStyle="white",y.lineWidth=ts*s,y.fillStyle=a,y.strokeStyle=u;let x=i==="left"?0:i==="center"?f/2:f-ts*s/2;return t(y,x,(m+ts*s/2)/2),p};cacheImage=t=>{if(!t.appearance.marker.icon)return;let e=fv(t.appearance.marker.icon);if(t.imageHash=e,!this.imagePromiseCache[e]){let i=["png","jpg","jpeg"],n=t.appearance.marker.icon.split("?")[0],o=i.some(u=>n.toLowerCase().endsWith(u)),a=new Image;o?a.src=t.appearance.marker.icon:a.src=`data:image/svg+xml;base64, ${btoa(t.appearance.marker.icon)}`,a.onload=()=>{this.imagePromiseCache[e]=a}}};createPinCanvas=(t,e,i,n)=>{let o,a=this.state.pixelRatio,u=t.totalMarkerSize*2*a;window.OffscreenCanvas!=null?o=new OffscreenCanvas(u,u):(o=document.createElement("canvas"),o.width=u,o.height=u,o.style.width=u/a+"px",o.style.height=u/a+"px");let s=o.getContext("2d");return s.shadowColor="rgba(0,0,0,0.3)",s.shadowOffsetY=NP*a,s.shadowBlur=RP*a,s.beginPath(),s.arc(u/2,u/2,e/2+kP*a/2,0,2*Math.PI),s.fillStyle=i,s.fill(),s.beginPath(),s.arc(u/2,u/2,e/2,0,2*Math.PI),s.shadowColor="transparent",s.fillStyle=n,s.fill(),o};prepare=(t,e,i)=>{let n=this.state.pixelRatio;i.lineWidth=4*n;let o=this.createPinCanvas(t,t.markerSize,t.appearance.marker.backgroundColor.active,t.appearance.marker.foregroundColor.active),a=this.createPinCanvas(t,t.iconVisible?t.markerSize:AP*n,t.appearance.marker.backgroundColor.inactive,t.appearance.marker.foregroundColor.inactive);this.pinCache[e]=[o,a]};draw(t,e,i){if(!t.visible)return;i.save(),i.globalAlpha=t.opacity;let n=this.state.pixelRatio,o=t.projection.x*n,a=t.projection.y*n,u=t.style.pinVisibility===1?this.pinCache[e][0]:this.pinCache[e][1];if(i.drawImage(u,o-t.totalMarkerSize*n,a-t.totalMarkerSize*n),t.appearance.marker.icon&&t.iconVisible&&t.imageHash&&t.appearance.marker.iconSize&&this.imagePromiseCache[t.imageHash]){let s=this.imagePromiseCache[t.imageHash],p=(t.appearance.marker.iconSize-t.appearance.marker.iconPadding)*n,{iconFit:f}=t.appearance.marker,m=p,y=p,x=`${t.imageHash}_${f}`;if(this.imageDimensionsCache[x])m=this.imageDimensionsCache[x].width,y=this.imageDimensionsCache[x].height;else{let S=s.width*n,M=s.height*n;if(f==="contain"){let g=Math.sqrt(S**2+M**2),C=p/g;m=S*C,y=M*C}if(f==="cover"){let g=p/S,C=p/M,I=Math.max(g,C);m=S*I,y=M*I}}i.save(),i.beginPath(),i.arc(o,a,p/2,0,2*Math.PI),i.closePath(),i.clip(),i.drawImage(s,o-m/2,a-y/2,m,y),i.restore()}t.style.textLabelVisible&&t.style.textAlign!=null&&t.style.left&&t.style.top&&i.drawImage(this.textCache[t.id][t.style.textAlign],o+t.style.left*n,a+t.style.top*n),i.restore()}};l(Yf,"TwoDDrawSystem");var Qu=Yf;d();d();var ci=class ci{loader;constructor(){this.loader=new gn}static getInstance(){return ci.instance||(ci.instance=new ci),ci.instance}getLoader(){return this.loader}};l(ci,"TextureLoaderSingleton"),v(ci,"instance");var jf=ci,tc=jf.getInstance();function BP(r,t){let e=r.components[2],i=r.components[1];return e!=null&&e.hover?[i.hoverColor||t,i.hoverColor||t]:[i.color,i.topColor||i.color]}l(BP,"processColor");var es,Wf,Zf=class Zf extends et{constructor(e){super();P(this,es);v(this,"state");v(this,"textureCache",new Map);this.state=e}setShading(e,i){e.material&&e.material.setGradientShading(i.start,i.end,i.intensity)}update(){var a,u,s;let e,i,n,o;for(let p of this.state.threeDEntities)if(o=this.state.entity3DMap.get(p),o instanceof Bt&&o.type==="geometry-group"){if(o.userData.shadingDirty){i=o.components[0];let f=o.userData.entities3D.values().next().value,m=this.state.entity3DMap.get(f);m instanceof dt&&(m.type==="geometry"||m.type==="custom-geometry")&&(e=m.components[0],o.userData.shadingDirty&&i.shading&&this.setShading(e,i.shading)),o.userData.shadingDirty=!1}}else if(o instanceof dt&&(o.type==="geometry"||o.type==="custom-geometry")&&((a=o.components[1])!=null&&a.dirty||(u=o.components[2])!=null&&u.dirty)){e=o.components[0],i=o.components[1],n=o.components[2];let f=BP(o,this.state.hoverColor);e.setColor(f[0],f[1]),i.visible!==e.visible&&(e.visible=i.visible),i.altitude!==e.altitude&&(e.altitude=i.altitude),i.opacity!==e.opacity&&(e.opacity=i.opacity),i.dirty=!1,i.texture!==e.texture&&W(this,es,Wf).call(this,i.texture,e,"texture"),i.topTexture!==e.topTexture&&W(this,es,Wf).call(this,i.topTexture,e,"topTexture"),(e.texture||e.topTexture)&&(n!=null&&n.hover&&e.texturesVisible?e.hideTextures():e.texturesVisible||e.showTextures()),o.components[2]&&(o.components[2].dirty=!1)}else(o==null?void 0:o.type)==="model"&&((s=o.components[1])!=null&&s.dirty)&&(e=o.components[0],i=o.components[1],i.opacity!==e.opacity&&(e.opacity=i.opacity),i.dirty=!1)}destroy(){this.textureCache.forEach(e=>{e.dispose()}),this.textureCache.clear()}};es=new WeakSet,Wf=l(function(e,i,n){if(!(!e||!i.showTextures)){if(this.textureCache.has(e)){n==="topTexture"?i.topTexture=this.textureCache.get(e):i.texture=this.textureCache.get(e),i.showTextures();return}tc.getLoader().load(e,o=>{n==="topTexture"?i.topTexture=o:i.texture=o,this.textureCache.set(e,o),i.showTextures(),this.publish("texture-loaded")},void 0,()=>{G.error(`Failed to load texture: ${e}`)})}},"#loadTexture"),l(Zf,"DrawSystem");var ec=Zf;d();var Uf=class Uf extends et{state;constructor(t){super(),this.state=t,this.playAnimations=this._playAnimations}animating=new Map;isAnimating=!1;startTime=-1;duration=500;update=()=>{this.animating.clear();let t,e;for(let i of this.state.entity2DIds)t=this.state.entity2DMap.get(i),t&&(e=t.components[0],e instanceof rr&&e.visibilityNeedsUpdate&&(e.visible?this.animating.set(e,e.opacity):(e.opacity=0,e.visibilityNeedsUpdate=!1)));this.startTime=performance.now(),this.publish("animate:2d")};playAnimations;_playAnimations(){let t=performance.now();for(let[e,i]of this.animating.entries()){let n=(t-this.startTime)/this.duration;e.opacity=pe(n,0,1,i,1),t-this.startTime>=this.duration&&(e.visible=!0,e.visibilityNeedsUpdate=!1,this.animating.delete(e))}this.publish("draw:2d"),this.animating.size>0&&this.publish("animate:2d")}};l(Uf,"TwoDVisibilitySystem");var rc=Uf;d();var zf=class zf extends et{state;renderer;mode;scene;cameraObject;viewCamera;systems;constructor(t,e,i,n,o,a,u){super(),this.renderer=t,this.state=e,this.mode=i,this.scene=n,this.cameraObject=o,this.viewCamera=a,this.systems=u,this.systems.collisionSystem.on("visibility-changed",this.updateEntities2D),this.systems.twoDVisiblitySystem.on("draw:2d",this.drawEntities2D),this.systems.twoDVisiblitySystem.on("animate:2d",this.animate2D)}twoDdirty=!0;threeDdirty=!0;frameId=null;twoDFrameId=null;animationFrameId=null;nextFrame=null;update=(t=!1)=>{var e;if(((e=this.renderer)==null?void 0:e.renderer)!=null)if(t)this.commitRenderState(),this.paint();else{if(this.frameId)return;this.frameId=requestAnimationFrame(()=>{var i;((i=this.renderer)==null?void 0:i.renderer)!=null&&this.mode==="standalone"&&(this.commitRenderState(),this.paint())})}};paint(){var t;(t=this.renderer)!=null&&t.renderer&&(this.mode==="standalone"?(this.renderer.clear(),this.renderer.render(this.scene,this.cameraObject)):this.renderer.render(this.scene,this.viewCamera))}animate2D=()=>{this.animationFrameId=requestAnimationFrame(()=>{this.animationFrameId=null,this.systems.twoDVisiblitySystem.playAnimations()})};drawEntities2D=()=>{this.twoDFrameId||(this.twoDFrameId=requestAnimationFrame(()=>{this.twoDFrameId=null,this.systems.twoDDrawSystem.update(this.systems.cameraSystem.getZoomAltitude(),this.systems.cameraSystem.getZoomScaledMin(),this.systems.cameraSystem.getZoomScaledMax())}))};updateEntities2D=()=>{this.animationFrameId&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null),this.twoDFrameId=requestAnimationFrame(()=>{this.twoDFrameId=null,this.systems.watermarkSystem.insertIntoQuadTree(this.systems.collisionSystem.interactiveCollidersQTree),this.systems.interactionSystem.updateQuadtree(this.systems.collisionSystem.interactiveCollidersQTree),this.systems.twoDVisiblitySystem.update(),this.systems.twoDDrawSystem.update(this.systems.cameraSystem.getZoomAltitude(),this.systems.cameraSystem.getZoomScaledMin(),this.systems.cameraSystem.getZoomScaledMax()),this.systems.domDrawSystem.update(this.systems.cameraSystem.isUserInteracting())})};commitRenderState=()=>{this.frameId=null,(this.mode==="outdoors-interleaved"||this.mode==="standalone")&&this.systems.cameraSystem.update(),this.scene.updateMatrixWorld(),this.state.shouldMeasureCanvas&&(this.state.shouldMeasureCanvas=!1,this.publish("measure-canvas")),this.twoDdirty&&(this.state.entity2DIds.clear(),$d(this.state.entityScene,this.state.entity2DIds),this.systems.domVisiblitySystem.dirty=!0,this.systems.collisionSystem.dirty=!0,this.systems.domMutationSystem.dirty=!0,this.systems.panBoundsSystem.dirty=!0,this.twoDdirty=!1),this.threeDdirty&&(this.state.threeDEntities=[],qd(this.state.entityScene,this.state.threeDEntities),this.threeDdirty=!1,this.systems.interactionSystem.dirty3D=!0,this.systems.panBoundsSystem.dirty=!0,this.systems.outlineInterpolationSystem.geometries3DDirty=!0),this.systems.meshOptimizationSystem.update(),this.systems.customGeometrySystem.update(),this.systems.panBoundsSystem.update(),this.systems.stackSystem.update(),this.systems.drawSystem.update(),this.systems.outlineInterpolationSystem.update(this.systems.cameraSystem.getZoomLevel(),this.systems.cameraSystem.zoomDirty),this.systems.pathSystem.update(this.systems.cameraSystem.minZoomAltitude,this.systems.cameraSystem.maxZoomAltitude,this.systems.cameraSystem.getZoomAltitude()),this.systems.cameraSystem.postRender(),this.systems.domVisiblitySystem.update(),this.systems.domMutationSystem.update(),this.systems.twoDProjectionSystem.update(),this.systems.twoDDrawSystem.update(this.systems.cameraSystem.getZoomAltitude(),this.systems.cameraSystem.getZoomScaledMin(),this.systems.cameraSystem.getZoomScaledMax()),this.systems.domDrawSystem.update(this.systems.cameraSystem.isUserInteracting()),this.systems.watermarkSystem.update(),this.nextFrame=requestAnimationFrame(()=>{this.systems.collisionSystem.update()}),this.systems.cameraSystem.dirty=!1,this.systems.cameraSystem.zoomDirty=!1};destroy(){this.frameId&&cancelAnimationFrame(this.frameId),this.twoDFrameId&&cancelAnimationFrame(this.twoDFrameId),this.animationFrameId&&cancelAnimationFrame(this.animationFrameId),this.nextFrame&&cancelAnimationFrame(this.nextFrame),this.state.entity2DIds.clear(),this.state.threeDEntities=[],this.systems.domVisiblitySystem.dirty=!0,this.systems.collisionSystem.dirty=!0,this.update(),this.systems.collisionSystem.off("visibility-changed",this.updateEntities2D),this.systems.twoDVisiblitySystem.off("draw:2d",this.drawEntities2D),this.systems.twoDVisiblitySystem.off("animate:2d",this.animate2D)}};l(zf,"RenderSystem");var ic=zf;d();function po(r,t,e=!1){let i=null,n=0;return function(...o){n++,n===1&&e===!0&&r.apply(this,o);let a=l(()=>{(!e||n>1)&&r.apply(this,o),i=null,n=0},"later");clearTimeout(i),i=setTimeout(a,t)}}l(po,"debounce");d();var ho,rs,qf=class qf{constructor(t,e){v(this,"type","path");v(this,"mesh",new Qe);v(this,"material");v(this,"geometry");v(this,"outline");v(this,"feature");v(this,"options");v(this,"nearRadius",.2);v(this,"farRadius",.4);v(this,"color","#ff834c");v(this,"pulseColor","blue");P(this,ho,1);v(this,"altitudeAdjustment",1);v(this,"dirty",!0);v(this,"position",new j);P(this,rs,0);var i,n,o;this.feature=t,this.options=e||{},this.color=(i=e==null?void 0:e.color)!=null?i:this.color,this.nearRadius=(n=e==null?void 0:e.nearRadius)!=null?n:this.nearRadius,this.farRadius=(o=e==null?void 0:e.farRadius)!=null?o:this.farRadius}setColor(){}setOpacity(){}set completeFraction(t){E(this,ho,t),this.mesh&&this.mesh.children.forEach(e=>{e.material.uniforms.complete.value=c(this,ho),e.material.needsUpdate=!0})}get completeFraction(){return c(this,ho)}set visible(t){this.mesh&&(this.mesh.visible=t)}get visible(){return this.mesh?this.mesh.visible:!1}get altitude(){return c(this,rs)}set altitude(t){this.mesh&&(this.mesh.position.z=t,E(this,rs,t))}set complete(t){this.material&&(this.material.uniforms.complete.value=t,this.material.needsUpdate=!0)}};ho=new WeakMap,rs=new WeakMap,l(qf,"PathComponent");var nc=qf;d();var $f=class $f{rendererState;constructor(t){this.rendererState=t}update(){let t;for(let e of this.rendererState.threeDEntities)if(t=this.rendererState.entity3DMap.get(e),t instanceof Pt&&t.components[0]){let i=t.components[0];if(i.dirty){for(let n of t.children)(n instanceof Bt||n instanceof Pt)&&(n.userData.entityId!==t.components[0].activeId?n.setVisible(!1):n.setVisible(!0));i.dirty=!1}}}};l($f,"StackSystem");var oc=$f;d();d();var os=Ar(Kn());d();d();d();var Jb=l((r,t)=>(t-r+Math.PI)%(Math.PI*2)+Math.PI*2%(Math.PI*2)-Math.PI,"differenceBetweenAngles"),Kb=l((r,t)=>new Z(r.clientX-t.offsetLeft,r.clientY-t.offsetTop),"getTouchPos"),Jf=l((r,t)=>Math.atan2(t.y-r.y,t.x-r.x),"angle"),is=l((r,t)=>Math.sqrt((t.y-r.y)**2+(t.x-r.x)**2),"distance"),Kf=l((r,t)=>new Z((r.x+t.x)/2,(r.y+t.y)/2),"average"),Qf=l(r=>{let t=0,{wheelDelta:e,detail:i}=r;return e!==void 0?t=e:i!==void 0&&(t=-i),t},"getScrollDelta");var tm=class tm{input1;input2;lastAngle;lastDistance;totalDistance;first;second;constructor(t,e){this.input1=t,this.input2=e,this.lastAngle=Jf(t,e),this.lastDistance=is(t,e),this.totalDistance=0,this.first=t,this.second=e}update(t,e){let i=is(t,e);this.input1=t,this.input2=e;let n=Jf(t,e);this.lastAngle=n,this.lastDistance=i,this.totalDistance+=(is(this.first,t)+is(this.second,e))/2,this.first=Kf(this.first,t),this.second=Kf(this.second,e)}};l(tm,"InputSet");var ac=tm;d();var em=class em{touch;camera;cameraPlane;viewCoordinate;snapHolderMatrix;snapCamera;cameraPosition;raycaster;worldCoordinate;snapshotted=!1;constructor(t,e,i){this.touch=t,this.camera=e,this.cameraPlane=i,this.viewCoordinate={x:t.x,y:t.y},this.camera.updateMatrixWorld(),this.camera.updateMatrix(),this.snapHolderMatrix=this.camera.matrixWorld.clone(),this.snapCamera=this.camera.clone(),this.snapshotCameraState()}snapshotCameraState(){this.camera.updateMatrix(),this.camera.updateMatrixWorld(),this.cameraPosition=this.camera.position.clone();let t=new Z(this.viewCoordinate.x,this.viewCoordinate.y);this.raycaster=this.raycaster||new Rr,this.raycaster.setFromCamera(t,this.snapCamera);let e=this.raycaster.intersectObject(this.cameraPlane,!0);this.worldCoordinate=e&&e.length>0?e[0].point:null,this.snapshotted=!0}updateAnchorState(t,e){this.camera=t,this.snapCamera=t.clone(),this.snapHolderMatrix=t.matrixWorld.clone(),this.updateViewCoordinate(e),this.snapshotCameraState()}updateViewCoordinate(t){this.viewCoordinate={x:t.x,y:t.y}}reUnproject(){var i,n;let t=new Z(this.viewCoordinate.x,this.viewCoordinate.y);(i=this.raycaster)==null||i.setFromCamera(t,this.snapCamera);let e=(n=this.raycaster)==null?void 0:n.intersectObject(this.cameraPlane,!0)[0];return e?e.point:void 0}};l(em,"TouchAnchor");var ns=em;var en,sc,rm=class rm extends et{constructor(e,i,n,o,a){super();v(this,"dirty",!1);v(this,"zoomDirty",!1);v(this,"zoomSpeed",5);v(this,"rotateSpeed",100);v(this,"enabled",!0);v(this,"enableZoom",!0);v(this,"enablePan",!0);v(this,"enablePedestal",!1);v(this,"maxPedestal",1/0);v(this,"minPedestal",0);v(this,"enableRotate",!0);v(this,"minZoomAltitude",5);v(this,"maxZoomAltitude",1e4);v(this,"initialMinZoom",5);v(this,"initialMaxZoom",1e4);v(this,"ignoreZoomLimits",!1);v(this,"minExpandedZoom",5);v(this,"maxExpandedZoom",1e5);v(this,"zoomFactor",1);v(this,"panBounds",{min:new j(1/0,1/0),max:new j(-1/0,-1/0),center:new j(0,0,0),radius:1/0});v(this,"minTilt",0);v(this,"maxTilt",1.2);v(this,"MOUSE_BUTTONS",{ORBIT:Ys.RIGHT,ZOOM:Ys.MIDDLE,PAN:Ys.LEFT});v(this,"camera");v(this,"scene");v(this,"renderer");v(this,"elevation");v(this,"orbit");v(this,"cameraPlane");v(this,"raycaster",new Rr);v(this,"rendererState");v(this,"options");v(this,"state",-1);v(this,"intersection");v(this,"viewState",null);v(this,"tweens",new Set);v(this,"clock",new c1(!0));v(this,"coords",{mouse:new Z,rotateStart:new Z,rotateEnd:new Z,rotateDelta:new Z,panStart:new j,panCameraStart:new j,panEnd:new j,panDelta:new j,initialShiftPos:new Z,initialPedestal:0,floorAnchor:new j});v(this,"touch",{origin:{offsetLeft:0,offsetTop:0},touches:[],anchor1:null,anchor2:null,inputs:null});v(this,"scrollTimer",null);v(this,"lastWheelTime",0);v(this,"resetZoom",!1);v(this,"zoomStart");v(this,"pedestalScaleFactor",1);v(this,"isUserZooming",!1);v(this,"stayInsideBounds",!0);v(this,"userInteracting",!1);v(this,"raycastToFloor",e=>{this.raycaster.setFromCamera(e,this.camera);let i=this.raycaster.intersectObject(this.cameraPlane,!1)[0];return i?i.point:new j});v(this,"isUserInteracting",()=>this.userInteracting);v(this,"getPosition",()=>new j(this.orbit.position.x,this.orbit.position.y,this.orbit.position.z));v(this,"getPedestal",()=>this.orbit.position.z);v(this,"pan",(e,i)=>{isNaN(e)||isNaN(i)||(this.setPosition(this.orbit.position.x+e,this.orbit.position.y+i),this.publish("position-updated"))});v(this,"postRender",()=>{(this.state===2||this.state===6)&&(this.raycaster.setFromCamera(this.coords.mouse,this.camera),this.intersection=this.raycaster.intersectObject(this.cameraPlane,!1)[0],this.intersection&&(this.coords.panStart.set(this.intersection.point.x,this.intersection.point.y,0),this.coords.panCameraStart.set(this.orbit.position.x,this.orbit.position.y,0))),this.state===3&&this.resetZoom&&(this.resetZoom=!1,this.zoomStart=this.getZoomAltitude(),this.coords.floorAnchor=this.raycastToFloor(this.coords.mouse),this.coords.panCameraStart.set(this.orbit.position.x,this.orbit.position.y,0)),this.state===7&&this.isAnimating()===!1&&(this.state=-1,this.publish("multi-end"))});v(this,"isAnimating",()=>os.default.getAll().some(e=>e._mMapAnimation));v(this,"isCameraMoving",()=>this.state!==-1);v(this,"setPosition",(e,i)=>{if(isNaN(e)||isNaN(i))return;this.state===-1&&this.publish("pan-start");let n=e-this.panBounds.center.x,o=i-this.panBounds.center.y,a=Math.sqrt(n*n+o*o);if(this.stayInsideBounds&&a>this.panBounds.radius){let u=Math.atan2(o,n),s={x:Math.cos(u)*this.panBounds.radius+this.panBounds.center.x,y:Math.sin(u)*this.panBounds.radius+this.panBounds.center.y};this.orbit.position.x=s.x,this.orbit.position.y=s.y}else this.orbit.position.x=e,this.orbit.position.y=i;this.publish("position-updated"),this.publish("change"),this.state===-1&&this.publish("pan-end"),this.dirty=!0});v(this,"tilt",e=>{if(isNaN(e))return;this.state===-1&&this.publish("rotate-start");let i=this.stayInsideBounds?Math.max(Math.min(e+this.getTilt(),this.maxTilt),this.minTilt):e+this.getTilt();i!==this.elevation.rotation.x&&(this.elevation.rotation.x=i,this.publish("tilt-updated")),this.publish("change"),this.state===-1&&this.publish("rotate-end")});v(this,"zoomIn",(e,i,n)=>{let o=this.getZoomAltitude();this.animateCamera({zoom:o/1.5},e,i,n)});v(this,"zoomOut",(e,i,n)=>{let o=this.getZoomAltitude();this.animateCamera({zoom:o*1.5},e,i,n)});v(this,"getRotation",()=>this.orbit.rotation.z);v(this,"cancelAnimation",()=>{let e=Array.from(this.tweens),i=e[e.length-1];i.state===7&&this.publish("multi-cancel",{zooming:!0,rotating:!0,tilting:!0}),this.completeTween(i)});v(this,"animateCamera",(e,i,n,o,a,u)=>{let s={mode:Yd.cancel,...u},p={},f={},m=this.getPosition();if(e.position!=null&&(e.position.x!==void 0&&(p.x=m.x,f.x=e.position.x),e.position.y!==void 0&&(p.y=m.y,f.y=e.position.y),e.position.z!==void 0&&(p.z=m.z,f.z=e.position.z)),e.zoom!==void 0&&(p.zoom=this.stayInsideBounds?Math.min(Math.max(this.getZoomAltitude(),this.getZoomScaledMin()),this.getZoomScaledMax()):this.getZoomAltitude(),this.viewState==="multi_floor"||!this.stayInsideBounds?f.zoom=e.zoom:f.zoom=Math.min(Math.max(e.zoom,this.getZoomScaledMin()),this.getZoomScaledMax())),e.rotation!==void 0){let w=p.rotation=this.getRotation(),T=e.rotation%(2*Math.PI),L=T-w;if(Math.abs(L)>Math.PI){let D=L<0?1:-1;f.rotation=T+2*Math.PI*D}else f.rotation=T}e.tilt!==void 0&&(p.tilt=this.getTilt(),this.viewState==="multi_floor"||!this.stayInsideBounds?f.tilt=e.tilt:f.tilt=Math.max(Math.min(e.tilt,this.maxTilt),this.minTilt));let y=p.zoom!==f.zoom,x=p.rotation!==f.rotation,S=p.tilt!==f.tilt,M=new os.default.Tween(p).to(f,b.env.TESTING?0:i).onUpdate(w=>{this.setMulti({x:w.x,y:w.y,z:w.z},w.zoom,w.rotation,w.tilt)}).onComplete(()=>{this.completeTween(M),this.publish("multi-end",{zooming:y,rotating:x,tilting:S}),o&&o()}).onStart(()=>{this.state!==7&&(this.state=7,M.state=7,this.publish("multi-start",{zooming:y,rotating:x,tilting:S})),this.publish("change")}),g=Array.from(this.tweens),C=g[g.length-1],I=!1;return C!=null&&(s.mode===Yd.chain?(I=!0,C.chain(M)):(this.completeTween(C),typeof a=="function"&&a(),C=null)),this.tweens.add(M),n?M.easing(n):M.easing(os.default.Easing.Quadratic.In),!e.doNotAutoStart&&!I&&(M.start(),this.publish("change")),M._mMapAnimation=!0,M});v(this,"setMulti",(e,i,n,o,a=!0)=>{this.state===-1&&this.publish("multi-start");let u=!1;e!=null&&(e.x!==void 0&&!isNaN(e.x)&&(this.orbit.position.x=e.x,u=!0),e.y!==void 0&&!isNaN(e.y)&&(this.orbit.position.y=e.y,u=!0),e.z!==void 0&&!isNaN(e.z)&&(this.setPedestal(e.z,!0),u=!0)),u&&this.publish("position-updated");let s={zooming:!1,tilting:!!i,rotating:!1};if(i!==void 0&&!isNaN(i)){let p=this.stayInsideBounds?Math.min(Math.max(i,this.getZoomScaledMin()),this.getZoomScaledMax()):i;p!==this.camera.position.z&&(s.zooming=!0,this.camera.position.z=p,this.publish("zoom-updated"),this.zoomDirty=!0,this.viewState==="multi_floor"?i>yu&&(this.camera.near=i-yu,this.camera.far=i+yu):(this.camera.near=i/Oa,this.camera.far=i*Oa),this.camera.updateProjectionMatrix())}if(n!==void 0&&!isNaN(n)&&n!==this.orbit.rotation.z&&(s.rotating=!0,this.orbit.rotation.z=n,this.publish("rotation-updated")),o!==void 0&&!isNaN(o)){let p=this.stayInsideBounds?Math.max(Math.min(o,this.maxTilt),this.minTilt):o;p!==this.elevation.rotation.x&&(s.tilting=!0,this.elevation.rotation.x=p,this.publish("tilt-updated"))}a&&this.publish("change"),this.state===-1&&this.publish("multi-end",s)});v(this,"getZoomScaledMin",()=>this.minZoomAltitude*this.zoomFactor);v(this,"getZoomScaledMax",()=>{let e=this.minZoomAltitude*this.zoomFactor;return Math.max(this.maxZoomAltitude,e)});v(this,"setRotation",(e,i)=>{if(isNaN(e))return;this.state===-1&&!i&&this.publish("rotate-start");let n=e%jd;n!==this.orbit.rotation.z&&(this.orbit.rotation.z=n,i||this.publish("rotation-updated")),i||this.publish("change"),this.state===-1&&!i&&this.publish("rotate-end"),this.dirty=!0});v(this,"setZoomAltitude",e=>{if(isNaN(e))return;this.state===-1&&this.publish("zoom-start");let i=this.stayInsideBounds?Math.min(Math.max(e,this.getZoomScaledMin()),this.getZoomScaledMax()):e;i!==this.camera.position.z&&(this.camera.position.z=i,this.publish("zoom-updated"),this.zoomDirty=!0),this.camera.near=i/Oa,this.camera.far=i*Oa,this.camera.updateProjectionMatrix(),this.publish("change"),this.state===-1&&this.publish("zoom-end"),this.dirty=!0});v(this,"setZoomLevel",e=>{this.setZoomAltitude(this.convertZoomLevelToAltitude(e))});v(this,"getZoomAltitude",()=>this.camera.position.z);v(this,"getZoomLevel",()=>this.convertAltitudeToZoomLevel(this.getZoomAltitude()));v(this,"rotate",e=>{if(isNaN(e))return;this.state===-1&&this.publish("rotate-start");let i=(this.orbit.rotation.z+e)%jd;i!==this.orbit.rotation.z&&(this.orbit.rotation.z=i,this.publish("rotation-updated")),this.publish("change"),this.state===-1&&this.publish("rotate-end")});v(this,"setTilt",(e,i)=>{if(isNaN(e))return;this.state===-1&&!i&&this.publish("rotate-start");let n=this.stayInsideBounds?Math.max(Math.min(e,this.maxTilt),this.minTilt):e;n!==this.elevation.rotation.x&&(this.elevation.rotation.x=n,i||this.publish("tilt-updated")),i||this.publish("change"),this.state===-1&&!i&&this.publish("rotate-end"),this.dirty=!0});v(this,"getTilt",()=>this.elevation.rotation.x);v(this,"setCameraPlaneElevation",e=>{this.cameraPlane.position.z=e});v(this,"zoom",e=>{if(isNaN(e))return;this.state===-1&&this.publish("zoom-start");let i=this.getZoomAltitude()-e;this.camera.position.z=this.stayInsideBounds?Math.min(Math.max(i,this.minZoomAltitude*this.zoomFactor),this.maxZoomAltitude*this.zoomFactor):i,this.publish("zoom-updated"),this.zoomDirty=!0,this.publish("change"),this.state===-1&&this.publish("zoom-end")});v(this,"expandZoomLimits",(e,i)=>{i||(i=1.2),e*i>this.maxZoomAltitude&&(this.maxZoomAltitude=Math.min(e*i,this.maxExpandedZoom)),e/i<this.minZoomAltitude&&(this.minZoomAltitude=Math.max(e/i,this.minExpandedZoom))});v(this,"restrictZoomLimits",(e,i)=>{i||(i=1.2),e*i>this.initialMaxZoom&&e*i<this.maxZoomAltitude&&(this.maxZoomAltitude=Math.max(this.getZoomAltitude(),e*i)),e/i<this.initialMinZoom&&e/i>this.minZoomAltitude&&(this.minZoomAltitude=Math.min(this.getZoomAltitude(),e/i))});v(this,"getProjectionScaleFactor",(e,i,n)=>Kd(e,i,n));v(this,"update",()=>{os.default.update(),this.lastWheelTime>0&&this.state===3&&this.clock.getElapsedTime()-this.lastWheelTime>.2&&(this.lastWheelTime=0,this.state=-1,this.publish("zoom-end"),this.removeMouseMoveEventListeners())});v(this,"setPedestal",(e,i=!1)=>{typeof e=="number"&&!isNaN(e)&&(this.orbit.position.z=e,i&&(this.publishPedestalChangeEvent(e),this.publish("change")),this.dirty=!0)});v(this,"dispose",()=>{for(let e of Ud)e.endsWith("start")?this.off(e,this.setUserInteracting):e.endsWith("end")&&this.off(e,this.unsetUserInteracting);this.removeEventListeners(),this.scene.remove(this.cameraPlane)});v(this,"createCameraPlane",()=>{let e=new mn(1e10,1e10),i=new kr({color:0,visible:!1}),n=new Ut(e,i);return this.scene.add(n),n});v(this,"addEventListeners",()=>{let{domElement:e}=this.renderer;for(let i of Ud)i.endsWith("start")?this.on(i,this.setUserInteracting):i.endsWith("end")&&this.on(i,this.unsetUserInteracting);e.addEventListener("contextmenu",this.onContextMenu,!1),e.addEventListener("mousedown",this.onMouseDown,!1),e.addEventListener("wheel",this.onMouseWheel,{passive:!1}),e.addEventListener("touchstart",this.onTouchStart,!1),e.addEventListener("touchend",this.onTouchEnd,!1),e.addEventListener("touchmove",this.onTouchMove,!1)});v(this,"addMouseEventListeners",()=>{this.addMouseMoveEventListeners(),window.addEventListener("mouseup",this.onMouseUp,!1),window.addEventListener("mouseout",this.onMouseUp,!1)});v(this,"addMouseMoveEventListeners",()=>{this.renderer.domElement.addEventListener("mousemove",this.onMouseMove,!1)});v(this,"removeMouseMoveEventListeners",()=>{this.renderer.domElement.removeEventListener("mousemove",this.onMouseMove,!1)});v(this,"removeEventListeners",()=>{let{domElement:e}=this.renderer;e.removeEventListener("contextmenu",this.onContextMenu,!1),e.removeEventListener("mousedown",this.onMouseDown,!1),e.removeEventListener("wheel",this.onMouseWheel,!1),e.removeEventListener("touchstart",this.onTouchStart,!1),e.removeEventListener("touchend",this.onTouchEnd,!1),e.removeEventListener("touchmove",this.onTouchMove,!1),e.removeEventListener("mousemove",this.onMouseMove,!1),window.removeEventListener("mouseup",this.onMouseUp,!1),window.removeEventListener("mouseout",this.onMouseUp,!1)});v(this,"removeMouseUpEventListeners",()=>{this.renderer.domElement.removeEventListener("mousemove",this.onMouseMove,!1),window.removeEventListener("mouseup",this.onMouseUp,!1),window.removeEventListener("mouseout",this.onMouseUp,!1)});v(this,"onContextMenu",e=>{e.preventDefault()});v(this,"onMouseUp",()=>{if(this.enabled!==!1){switch(this.removeMouseUpEventListeners(),this.state){case 2:this.publish("pan-end"),this.publish("user-pan-end");break;case 1:this.publish("zoom-end"),this.publish("user-dolly-end");break;case 0:this.publish("rotate-end"),this.publish("user-rotate-end");break;case 8:this.publish("pedestal-end"),this.publish("user-pedestal-end");break}this.state=-1}});v(this,"onMouseMove",e=>{if(this.enabled!==!1)if(e.preventDefault(),this.mouseToScene(e),this.state===0){if(this.enableRotate===!1)return;this.handleMouseMoveRotate(e)}else if(this.state===2){if(this.enablePan===!1)return;this.handleMouseMovePan()}else this.state===3?(this.resetZoom=!0,this.state=-1):this.state===8&&this.handleMouseMovePedestal(e)});v(this,"onTouchStart",e=>{if(this.enabled!==!1){switch(this.updateTouchOrigin(),this.touchToScene(e),e.touches.length){case 1:this.enablePedestal?(this.handleTouchStartPedestal(e),this.state=9):this.enablePan&&(this.handleTouchStartPan(e),this.state=6);break;case 2:this.touch.inputs=new ac(this.touch.touches[0],this.touch.touches[1]);break;default:this.state=-1}this.state}});v(this,"onTouchMove",e=>{if(this.enabled!==!1)switch(this.touchToScene(e),e.touches.length){case 2:e.preventDefault(),e.stopPropagation();let i={...this.touch.inputs.first},n={...this.touch.inputs.second},o=new Z(this.touch.touches[0].x,this.touch.touches[0].y),a=new Z(this.touch.touches[1].x,this.touch.touches[1].y);if(this.touch.inputs.update(this.touch.touches[0],this.touch.touches[1]),this.enableRotate&&this.state===4)this.handleTouchMoveTilt(e);else if(this.state===5)this.handleTouchMoveDolly();else if(this.state!==5&&this.touch.inputs.totalDistance>.05){let u=i.y<o.y&&n.y<a.y,s=i.y>o.y&&n.y>a.y;this.enableRotate&&this.state!==4&&(s||u)?(this.handleTouchStartTilt(e),this.state=4):(this.handleTouchStartDolly(),this.state=5)}break;case 1:(this.enablePedestal||this.enablePan)&&(e.preventDefault(),e.stopPropagation()),this.enablePedestal&&this.state===9?this.handleTouchMovePedestal(e):this.enablePan&&this.state===6&&this.handleTouchMovePan(e);break;default:this.state=-1}});v(this,"onTouchEnd",e=>{if(this.enabled!==!1){switch(this.handleTouchEnd(),this.state){case 2:case 6:this.publish("user-pan-end");break;case 4:this.publish("pan-end"),this.publish("user-tilt-end");break;case 1:case 5:this.publish("zoom-end"),this.publish("user-dolly-end");break;case 0:this.publish("rotate-end"),this.publish("user-rotate-end");break;case 8:case 9:this.publish("pedestal-end"),this.publish("user-pedestal-end");break}e.touches.length?this.onTouchStart(e):this.state=-1}});v(this,"handleTouchMovePan",e=>{let i=Object.hasOwn(e,"x")?new Z(e.x,e.y):this.touch.touches[0],n=this.raycastToFloor(i);this.coords.panEnd.set(n.x,n.y,0),this.coords.panDelta.subVectors(this.coords.panEnd,this.coords.panStart),this.setPosition(this.coords.panCameraStart.x-this.coords.panDelta.x,this.coords.panCameraStart.y-this.coords.panDelta.y),this.publish("change")});v(this,"handleTouchStartDolly",()=>{let e=this.touch.touches[0].x-this.touch.touches[1].x,i=this.touch.touches[0].y-this.touch.touches[1].y;this.zoomStart=this.getZoomAltitude();let n=new Z(this.touch.touches[0].x-e/2,this.touch.touches[0].y-i/2);this.coords.floorAnchor=this.raycastToFloor(n),this.orbit.updateMatrixWorld(),this.touch.anchor1=new ns(this.touch.touches[0],this.camera,this.cameraPlane),this.touch.anchor2=new ns(this.touch.touches[1],this.camera,this.cameraPlane),this.coords.panCameraStart.set(this.orbit.position.x,this.orbit.position.y,0),this.publish("user-dolly-start"),this.publish("multi-start")});v(this,"handleMouseMovePan",()=>{let e=this.raycastToFloor(this.coords.mouse);this.coords.panEnd.set(e.x,e.y,0),this.coords.panDelta.subVectors(this.coords.panEnd,this.coords.panStart),this.setPosition(this.coords.panCameraStart.x-this.coords.panDelta.x,this.coords.panCameraStart.y-this.coords.panDelta.y),this.publish("change")});v(this,"handleTouchStartTilt",e=>{this.coords.rotateStart.set(e.touches[1].clientX,e.touches[1].clientY),this.publish("user-tilt-start"),this.publish("rotate-start")});v(this,"handleTouchMovePedestal",e=>{this.handleMouseMovePedestal(e.touches[0])});v(this,"handleTouchMoveTilt",e=>{this.coords.rotateEnd.set(e.touches[1].clientX,e.touches[1].clientY),this.coords.rotateDelta.subVectors(this.coords.rotateEnd,this.coords.rotateStart),this.setTilt(this.getTilt()-this.coords.rotateDelta.y/this.rotateSpeed),this.coords.rotateStart.copy(this.coords.rotateEnd)});v(this,"handleTouchMoveDolly",()=>{let e=this.touch.inputs.first,i=this.touch.inputs.second;this.touch.anchor1.viewCoordinate={x:e.x,y:e.y},this.touch.anchor2.viewCoordinate={x:i.x,y:i.y};let n=this.makeTransformFromTouchAnchors(this.touch.anchor1,this.touch.anchor2);n&&this.setCameraFromTransformMatrix(n),this.orbit.updateMatrixWorld(),this.touch.anchor1.updateAnchorState(this.camera,e),this.touch.anchor2.updateAnchorState(this.camera,i)});v(this,"handleTouchEnd",()=>{this.state===4||this.state===5?this.publish("multi-end"):this.state===6&&this.publish("pan-end")});v(this,"handleTouchStartPan",e=>{let i=Object.hasOwn(e,"x")?new Z(e.x,e.y):this.touch.touches[0],n=this.raycastToFloor(i);this.coords.panStart.set(n.x,n.y,0),this.coords.panCameraStart.set(this.orbit.position.x,this.orbit.position.y,0),this.publish("user-pan-start"),this.publish("pan-start")});v(this,"handleTouchStartPedestal",e=>{this.handleMouseDownPedestal(e.touches[0])});v(this,"onMouseDown",e=>{if(this.enabled!==!1){if(this.mouseToScene(e),e.preventDefault(),this.state===3&&this.publish("zoom-end"),e.button===this.MOUSE_BUTTONS.ORBIT){if(this.enableRotate===!1)return;this.handleMouseDownRotate(e),this.state=0}else e.button===this.MOUSE_BUTTONS.PAN&&(this.enablePan?(this.handleMouseDownPan(),this.state=2):this.enablePedestal&&(this.handleMouseDownPedestal(e),this.state=8));this.state!==-1&&this.addMouseEventListeners()}});v(this,"onMouseWheel",e=>{this.enabled===!1||this.enableZoom===!1||this.state!==-1&&this.state!==3||(e.preventDefault(),e.stopPropagation(),this.mouseToScene(e),this.canScrollZoom(e)&&(this.lastWheelTime=this.clock.getElapsedTime(),this.publishUserZoomEvent()),this.state!==3&&this.canScrollZoom(e)&&(this.addMouseMoveEventListeners(),this.state=3,this.zoomStart=this.getZoomAltitude(),this.coords.floorAnchor=this.raycastToFloor(this.coords.mouse),this.coords.panCameraStart.set(this.orbit.position.x,this.orbit.position.y,0),this.publish("zoom-start")),this.scrollTimer!=null&&clearTimeout(this.scrollTimer),this.scrollTimer=setTimeout(()=>{this.publish("zoom-end")},50),this.handleMouseWheel(e))});v(this,"handleMouseWheel",e=>{if(this.publish("zoom-start"),!this.canScrollZoom(e)){this.lastWheelTime>0&&this.publish("zoom-end"),this.lastWheelTime=0,this.state=-1;return}let i=this.getZoomAltitude(),n=i-Qf(e)*i/uv*this.zoomSpeed;this.setZoomAltitude(n);let o=n/this.zoomStart;this.coords.panDelta.subVectors(this.coords.floorAnchor,this.coords.panCameraStart).multiplyScalar(1-o),this.setPosition(this.coords.panCameraStart.x+this.coords.panDelta.x,this.coords.panCameraStart.y+this.coords.panDelta.y),this.publish("change")});v(this,"setCameraFromTransformMatrix",e=>{this.orbit.updateMatrixWorld();let i=new fn;i.setFromRotationMatrix(e,"ZYX");let n=(e.elements[14]-this.cameraPlane.position.z)/Math.cos(i.x),o=i.z,a=new j(0,0,1);a.applyEuler(i),a.setLength(n);let u=new j;u.setFromMatrixPosition(e),u.sub(a),this.enablePan&&this.setPosition(u.x,u.y),this.enableZoom&&this.setZoomAltitude(n),this.enableRotate&&this.setRotation(o)});v(this,"makeTransformFromTouchAnchors",(e,i)=>{this.orbit.updateMatrixWorld(),this.camera.updateProjectionMatrix();let n=this.camera.projectionMatrix.clone(),o=e.worldCoordinate,a=i.worldCoordinate,u=e.reUnproject(),s=i.reUnproject();if(!u||!s||!o||!a)return null;let p=e.viewCoordinate,f=i.viewCoordinate,m=a.x-o.x,y=a.y-o.y,x=Math.atan2(y,m),S=s.x-u.x,M=s.y-u.y,g=Math.atan2(M,S),C=Jb(x,g),I=new pr;I.makeRotationZ(-C);let w=I.clone();w.multiply(e.snapHolderMatrix);let T=l((B4,F4,G4)=>B4.elements[(F4-1)*4+G4-1],"m"),L=T(n,1,1)*T(w,1,1)-p.x*T(n,3,4)*T(w,3,1),D=T(n,1,1)*T(w,1,2)-p.x*T(n,3,4)*T(w,3,2),R=T(n,1,1)*T(w,1,3)-p.x*T(n,3,4)*T(w,3,3),F=o.x*L+o.y*D+o.z*R,N=T(n,2,2)*T(w,2,1)-p.y*T(n,3,4)*T(w,3,1),H=T(n,2,2)*T(w,2,2)-p.y*T(n,3,4)*T(w,3,2),X=T(n,2,2)*T(w,2,3)-p.y*T(n,3,4)*T(w,3,3),$=o.x*N+o.y*H+o.z*X,ct=T(n,1,1)*T(w,1,1)-f.x*T(n,3,4)*T(w,3,1),yt=T(n,1,1)*T(w,1,2)-f.x*T(n,3,4)*T(w,3,2),bt=T(n,1,1)*T(w,1,3)-f.x*T(n,3,4)*T(w,3,3),kt=a.x*ct+a.y*yt+a.z*bt,Me=T(n,2,2)*T(w,2,1)-f.y*T(n,3,4)*T(w,3,1),Ft=T(n,2,2)*T(w,2,2)-f.y*T(n,3,4)*T(w,3,2),ht=T(n,2,2)*T(w,2,3)-f.y*T(n,3,4)*T(w,3,3),xt=a.x*Me+a.y*Ft+a.z*ht,ur=Math.abs(ct-L),Pe=Math.abs(yt-D),le=Math.abs(bt-R),Zt=Math.abs(ct-N),hi=Math.abs(yt-H),hn=Math.abs(bt-X),tt=Math.abs(Me-L),St=Math.abs(Ft-D),Gt=Math.abs(ht-R),ie=Math.abs(Me-N),cr=Math.abs(Ft-H),dn=Math.abs(ht-X),di=Math.min(ur+Pe+le,Zt+hi+hn),Lc=Math.min(tt+St+Gt,ie+cr+dn);di<Lc&&(ct=Me,yt=Ft,bt=ht,kt=xt);let Nt=N*R-L*X,fi=H*R-D*X,Vs=$*R-F*X,Po=ct*X-N*bt,To=yt*X-H*bt,Hs=kt*X-$*bt,O4=(Hs*fi-Vs*To)/(Po*fi-Nt*To),A4=(Hs*Nt-Vs*Po)/(To*Nt-fi*Po),Xm=H*L-D*N,k4=X*L-R*N,N4=$*L-F*N,Ym=yt*N-H*ct,R4=bt*N-X*ct,jm=((kt*N-$*ct)*Xm-N4*Ym)/(R4*Xm-k4*Ym),Xs=w.clone();return Xs.elements[12]=O4,Xs.elements[13]=A4,Xs.elements[14]=jm,jm>0?Xs:null});v(this,"updateTouchOrigin",()=>{let e=this.renderer.domElement;this.touch.origin.offsetLeft=e.getBoundingClientRect().left,this.touch.origin.offsetTop=e.getBoundingClientRect().top});v(this,"touchToScene",e=>{this.touch.touches=[];for(let i=0,n=e.touches.length;i<n;i++){let o=e.touches[i],a=Kb(o,this.touch.origin);this.touch.touches.push(new Z(a.x/this.renderer.domElement.width*this.rendererState.pixelRatio*2-1,-(a.y/this.renderer.domElement.height*this.rendererState.pixelRatio)*2+1))}this.coords.mouse=this.touch.touches[0]});v(this,"canScrollZoom",e=>{let i=Qf(e),n=this.getZoomAltitude();return!(i<0&&n===this.getZoomScaledMax()||i>0&&n===this.getZoomScaledMin())});v(this,"mouseToScene",e=>{let i=this.getMousePos(e);return this.coords.mouse.x=i.x/this.renderer.domElement.width*this.rendererState.pixelRatio*2-1,this.coords.mouse.y=-(i.y/this.renderer.domElement.height*this.rendererState.pixelRatio)*2+1,this.coords.mouse});v(this,"getMousePos",e=>({x:e.offsetX,y:e.offsetY}));v(this,"handleMouseDownRotate",e=>{this.coords.rotateStart.set(e.clientX,e.clientY),this.publish("rotate-start"),this.publish("user-rotate-start")});v(this,"handleMouseDownPan",()=>{let e=this.raycastToFloor(this.coords.mouse);this.coords.panStart.set(e.x,e.y,0),this.coords.panCameraStart.set(this.orbit.position.x,this.orbit.position.y,0),this.publish("pan-start"),this.publish("user-pan-start")});v(this,"handleMouseDownPedestal",e=>{let i=new Z(e.clientX,e.clientY);this.coords.initialShiftPos=i,this.coords.initialPedestal=this.getPedestal(),this.pedestalScaleFactor=Kd(this.camera.fov,this.renderer.domElement.clientHeight,this.getZoomAltitude()),this.publish("pedestal-start"),this.publish("user-pedestal-start")});v(this,"handleMouseMovePedestal",e=>{let i={x:e.clientX,y:e.clientY},n=this.coords.initialPedestal+this.pedestalScaleFactor*(i.y-this.coords.initialShiftPos.y);this.stayInsideBounds&&(n<this.minPedestal?n=Math.max(n,this.minPedestal):n>this.maxPedestal&&(n=Math.min(n,this.maxPedestal))),n!==this.getPedestal()&&this.setPedestal(n,!0)});v(this,"handleMouseMoveRotate",e=>{this.coords.rotateEnd.set(e.clientX,e.clientY),this.coords.rotateDelta.subVectors(this.coords.rotateEnd,this.coords.rotateStart),this.rotate(-this.coords.rotateDelta.x/this.rotateSpeed),this.setTilt(this.getTilt()-this.coords.rotateDelta.y/this.rotateSpeed),this.coords.rotateStart.copy(this.coords.rotateEnd),this.publish("change")});v(this,"publishUserZoomDebounced",po(()=>{this.isUserZooming=!1,this.publish("user-zoom-end")},250));v(this,"publishUserZoomEvent",()=>{this.isUserZooming?this.publishUserZoomDebounced():(this.publish("user-zoom-start"),this.isUserZooming=!0,this.publishUserZoomDebounced())});v(this,"setUserInteracting",()=>{this.userInteracting=!0});v(this,"unsetUserInteracting",()=>{this.userInteracting=!1});v(this,"publishPedestalChangeEvent",e=>{this.publish("pedestal-change",{pedestal:e,scrolledToTop:this.scrolledToTop,scrolledToBottom:this.scrolledToBottom,scrollPercent:this.scrollPercent})});v(this,"convertAltitudeToZoomLevel",e=>{let[,i]=this.center,o=e*2*Math.tan(it.degToRad(this.camera.fov)/2)/this.options.canvasHeight,a=Math.cos(it.degToRad(i))*2*Math.PI*ni/o;return it.clamp(Math.log2(a/512),Wd,Zd)});v(this,"convertZoomLevelToAltitude",e=>{let[,i]=this.center,n=it.clamp(e,Wd,Zd),o=Math.pow(2,n),a=it.clamp(i,sv,lv),u=o*512;return Math.cos(it.degToRad(a))*Math.PI*2*ni/u*this.options.canvasHeight/2/Math.tan(it.degToRad(this.camera.fov)/2)});v(this,"completeTween",e=>{e.isPlaying?e.stop():e.end(),this.tweens.delete(e)});P(this,en,{PIXELS:"pixels",PORTIONS:"portions"});P(this,sc,["top","bottom","left","right"]);v(this,"getCameraFrameForPoints",(e,i,n,o,a=!0,{canvasWidth:u,canvasHeight:s},p=this.minZoomAltitude,f=this.maxZoomAltitude)=>{Number.isFinite(n)&&(n=1),Number.isFinite(i)&&(i=1),p=Math.max(this.cameraPlane.position.z,p);let m={position:this.getPosition(),zoom:p};if(e==null||e.length===0)return m;o||(o={top:0,bottom:0,left:0,right:0,type:c(this,en).PIXELS});for(let Nt of c(this,sc))typeof o[Nt]!="number"&&(o[Nt]=0);if(o.type||(o.type=c(this,en).PIXELS),o.type===c(this,en).PORTIONS&&(o={top:o.top*s,bottom:o.bottom*s,left:o.left*u,right:o.right*u,type:c(this,en).PIXELS}),o.left+o.right>=u||o.top+o.bottom>=s)return m;this.orbit.updateMatrixWorld();let y=this.camera.matrixWorldInverse,x=this.camera.fov*(Math.PI/180)/2,S=x*n,g=Math.atan(Math.tan(x)*(u/s))*i;if(e.length===1){let Nt=e[0].clone();Nt.applyMatrix4(y);let fi=p*Math.tan(g)*2,Vs=p*Math.tan(S)*2,Po=(o.left-o.right)/2/u,To=(o.top-o.bottom)/2/s,Hs=new j(-Po*fi,To*Vs,0);return Nt.add(Hs),Nt.applyMatrix4(this.camera.matrixWorld),m.position.x=Nt.x,m.position.y=Nt.y,m.position.z=Nt.z,m.zoom=Math.max(m.zoom,m.position.z),m}let C=new j(1/0,1/0,1/0),I=new j(-1/0,-1/0,-1/0),w=new Te().setFromPoints(e),T;for(let Nt=0,fi=e.length;Nt<fi;Nt++)T=e[Nt].clone(),T.applyMatrix4(y),C.min(T),I.max(T);let L=I.x-C.x,D=I.y-C.y,R=u-o.left-o.right,F=s-o.top-o.bottom,N=(I.x+C.x)/2,H=(I.y+C.y)/2,X=L/R,$=D/F,ct=p,yt=f,bt=ct*Math.tan(g)*2,kt=yt*Math.tan(g)*2,Me=bt/u,Ft=kt/u,ht=Math.max(X,$);a&&(ht=Math.min(Math.max(ht,Me),Ft));let xt=R*ht,ur=F*ht,Pe={min:{x:N-xt/2-o.left*ht,y:H-ur/2-o.bottom*ht},max:{x:N+xt/2+o.right*ht,y:H+ur/2+o.top*ht}},le=(Pe.min.x+Pe.max.x)/2,Zt=(Pe.min.y+Pe.max.y)/2,hi=w.getCenter(new j),hn=Math.abs(le-Pe.min.x),tt=Math.abs(Zt-Pe.min.y),St=hn/Math.tan(g),Gt=tt/Math.tan(S),ie=new j;ie.set(le,Zt,I.z+Math.max(St,Gt)),ie.applyMatrix4(this.camera.matrixWorld);let cr=new j;cr.set(le,Zt,I.z),cr.applyMatrix4(this.camera.matrixWorld);let dn=new j().subVectors(cr,ie),di=(hi.z-ie.z)/dn.z,Lc=new j().copy(ie).add(dn.clone().multiplyScalar(di));return m.position=Lc,cr.set(m.position.x,m.position.y,m.position.z),ie.sub(cr),m.zoom=ie.length(),m});this.camera=e,this.renderer=n,this.rendererState=o,this.scene=i,this.options=a,this.elevation=e.parent,this.orbit=this.elevation.parent,this.cameraPlane=this.createCameraPlane(),this.zoomStart=e.position.z,a.mode!=="outdoors-overlay"&&this.addEventListeners()}get maxZoomLevel(){return this.convertAltitudeToZoomLevel(this.minZoomAltitude)}setMaxZoomLevel(e){this.minZoomAltitude=this.convertZoomLevelToAltitude(e)}get minZoomLevel(){return this.convertAltitudeToZoomLevel(this.maxZoomAltitude)}setMinZoomLevel(e){this.maxZoomAltitude=this.convertZoomLevelToAltitude(e)}get scrollPercent(){let e=this.minPedestal,i=this.maxPedestal,n=this.getPedestal();return n=Math.min(n,i),n=Math.max(n,e),(n-e)/(i-e)*100}get scrolledToBottom(){return this.minPedestal===0||Math.floor(this.getPedestal())<=this.minPedestal}get scrolledToTop(){return this.maxPedestal===0||Math.ceil(this.getPedestal())>=this.maxPedestal}get center(){var o,a,u,s;let e=this.getPosition(),{lat:i,lon:n}=gu((a=(o=this.rendererState.center)==null?void 0:o[1])!=null?a:0,(s=(u=this.rendererState.center)==null?void 0:u[0])!=null?s:0,e.x,e.y);return[n,i]}setCenter(e,i){var a,u,s,p;let{x:n,y:o}=vu((u=(a=this.rendererState.center)==null?void 0:a[1])!=null?u:0,(p=(s=this.rendererState.center)==null?void 0:s[0])!=null?p:0,i,e);this.setPosition(n,o)}focusOn(e,{insetsPadding:i},n={}){var g;let o=(g=n.changeZoom)!=null?g:!0,a=n.curve,u=1,s=1,p=n.callback,f=n.cancelledCallback,m=n.minZoom!==void 0?n.minZoom:this.minZoomAltitude,y=n.maxZoom!==void 0?n.maxZoom:this.maxZoomAltitude,x=this.options.canvasWidth,S=this.options.canvasHeight,M;if(n.duration!==void 0?M=n.duration:b.env.TESTING==="true"?M=0:M=200,i.top!==0||i.bottom!==0||i.left!==0||i.right!==0)if(n.tilt!==void 0&&n.tilt!==this.getTilt()||n.rotation!==void 0&&n.rotation!==this.getRotation())this.animateCamera({position:this.getPosition(),tilt:n.tilt,rotation:n.rotation},M,a,()=>{let C=n.padding||i,I=this.getCameraFrameForPoints(e,u,s,C,o,{canvasWidth:x,canvasHeight:S},m,y);this.animateCamera({position:I.position,tilt:this.getTilt(),rotation:this.getRotation(),zoom:I.zoom},M,a,p,f)});else{let C=n.padding||i,I=this.getCameraFrameForPoints(e,u,s,C,o,{canvasWidth:x,canvasHeight:S},m,y);this.animateCamera({position:I.position,tilt:this.getTilt(),rotation:this.getRotation(),zoom:I.zoom},M,a,p,f)}else{let C=n.padding||i,I=this.getCameraFrameForPoints(e,u,s,C,o,{canvasHeight:S,canvasWidth:x},m,y);this.animateCamera({position:I.position,tilt:n.tilt,rotation:n.rotation,zoom:I.zoom},M,a,p,f)}}resize(e,i){this.options.canvasWidth=e,this.options.canvasHeight=i}};en=new WeakMap,sc=new WeakMap,l(rm,"CameraSystem");var as=rm;d();var FP=300,im=class im{state;constructor(t){this.state=t}update(t){var o;let e,i,n;for(let a of this.state.entity2DIds)e=this.state.entity2DMap.get(a),e&&(i=e.components[0],n=e.components[1],i instanceof ve&&i.containerEl!=null&&((i.visible===!0||((o=i.animation)==null?void 0:o.pending)===!0)&&(i.containerEl.style.transform=`translate3D(${i.projection.x}px, ${i.projection.y}px, ${i.projection.y}px)`),i.visible===!0?i.containerEl.style.pointerEvents=t||n!=null?"none":"auto":i.containerEl.style.pointerEvents="none",i.visibilityNeedsUpdate&&(i.animation&&i.animation.cancel(),i.animation=i.containerEl.animate([{opacity:i.visible?"1":"0"}],{duration:FP,easing:"ease-in-out",fill:"forwards"}),i.visibilityNeedsUpdate=!1)))}};l(im,"DOMDrawSystem");var lc=im;d();var nm=class nm{percentExpanded=0;activeId="";gap=20;dirty=!0};l(nm,"StackComponent");var uc=nm;d();var om=class om extends et{state;dirty=!0;domTree;observers=new Map;constructor(t,e){super(),this.state=t,this.domTree=e}setupObserver(){var e;if(this.observers){for(let i of this.observers.values())i.disconnect();this.observers.clear()}let t;for(let i of this.domTree.children){let n=i.getAttribute("data-marker-id");if(n!=null&&(t=this.state.entity2DMap.get(n),(e=t.components[0].options)!=null&&e.dynamicResize)){let o=new ResizeObserver(this.updateDimensions);o.observe(i),this.observers.set(i.userData.entityId,o)}}}updateDimensions=t=>{t.forEach(e=>{let i=e.target,n=i.getAttribute("data-marker-id");if(n){let o=this.state.entity2DMap.get(n);if(o&&o.components[0]instanceof ve&&i.firstElementChild){let{width:a,height:u}=i.firstElementChild.getBoundingClientRect();o.components[0].updateDimensions(a,u)}}}),this.publish("dimensions-update")};update(){this.dirty&&(this.setupObserver(),this.dirty=!1)}destroy(){for(let t of this.observers.values())t.disconnect();this.observers.clear()}};l(om,"DOMResizeSystem");var cc=om;d();var ss=Ar(Kn());var GP=0,VP=22,HP=0,XP=90;function t4(r,t,e,i){return(r<t||r>e)&&G.warn(i),Math.min(e,Math.max(t,r))}l(t4,"clampWithWarning");var e4={linear:ss.default.Easing.Linear.None,"ease-in":ss.default.Easing.Quadratic.In,"ease-out":ss.default.Easing.Quadratic.Out,"ease-in-out":ss.default.Easing.Quadratic.InOut},V,st,rn,ls,am=class am{constructor(t,e,i,n){P(this,V,void 0);P(this,st,void 0);P(this,rn,void 0);P(this,ls,void 0);E(this,V,t),E(this,st,e),E(this,rn,i),E(this,ls,n),c(this,st).cameraSystem.on("pedestal-change",({pedestal:o})=>{c(this,V).map&&(c(this,V).map.transform.elevation=o,c(this,V).map.transform.minElevationForCurrentTile=o,c(this,V).map.triggerRepaint()),c(this,st).cameraSystem.setCameraPlaneElevation(o),c(this,ls).position.z=o})}get center(){return c(this,V).mode==="outdoors-overlay"&&c(this,V).map?c(this,V).map.getCenter().toArray():c(this,st).cameraSystem.center}setCenter(t){var e;if(c(this,V).mode==="outdoors-overlay"&&c(this,V).map){(e=c(this,V).map)==null||e.setCenter(t);return}c(this,st).cameraSystem.setCenter(t[0],t[1])}get zoomLevel(){var t;return c(this,V).mode==="outdoors-overlay"&&c(this,V).map?(t=c(this,V).map)==null?void 0:t.getZoom():c(this,st).cameraSystem.getZoomLevel()}setZoomLevel(t){var e;c(this,V).mode==="outdoors-overlay"&&c(this,V).map&&((e=c(this,V).map)==null||e.setZoom(t)),c(this,st).cameraSystem.setZoomLevel(t)}get maxZoomLevel(){return c(this,st).cameraSystem.maxZoomLevel}get minZoomLevel(){return c(this,st).cameraSystem.minZoomLevel}setMinZoomLevel(t){var i;let e=Math.max(GP,t);c(this,st).cameraSystem.setMinZoomLevel(e),(i=c(this,V).map)==null||i.setMinZoom(e)}setMaxZoomLevel(t){var i;let e=Math.min(VP,t);(i=c(this,V).map)==null||i.setMaxZoom(e),c(this,st).cameraSystem.setMaxZoomLevel(e)}get maxPitch(){var t;return c(this,V).mode==="outdoors-overlay"&&c(this,V).map?(t=c(this,V).map)==null?void 0:t.getMaxPitch():it.radToDeg(c(this,st).cameraSystem.maxTilt)}get minPitch(){var t;return c(this,V).mode==="outdoors-overlay"&&c(this,V).map?(t=c(this,V).map)==null?void 0:t.getMinPitch():it.radToDeg(c(this,st).cameraSystem.minTilt)}setMinPitch(t){var i;let e=Math.max(HP,t);(i=c(this,V).map)==null||i.setMinPitch(e),c(this,st).cameraSystem.minTilt=it.degToRad(e)}setMaxPitch(t){var i;let e=Math.min(XP,t);(i=c(this,V).map)==null||i.setMaxPitch(e),c(this,st).cameraSystem.maxTilt=it.degToRad(e)}get bearing(){var t;return c(this,V).mode==="outdoors-overlay"&&c(this,V).map?(t=c(this,V).map)==null?void 0:t.getBearing():it.radToDeg(c(this,st).cameraSystem.getRotation())}setBearing(t){var e;if(c(this,V).mode==="outdoors-overlay"&&c(this,V).map){(e=c(this,V).map)==null||e.setBearing(t);return}c(this,st).cameraSystem.setRotation(it.degToRad(t))}get pitch(){var t;return c(this,V).mode==="outdoors-overlay"&&c(this,V).map?(t=c(this,V).map)==null?void 0:t.getPitch():it.radToDeg(c(this,st).cameraSystem.getTilt())}setPitch(t){var e;if(c(this,V).mode==="outdoors-overlay"&&c(this,V).map){(e=c(this,V).map)==null||e.setPitch(t);return}c(this,st).cameraSystem.setTilt(it.degToRad(t))}get elevation(){return c(this,st).cameraSystem.getPedestal()}setElevation(t){c(this,st).cameraSystem.setPedestal(t,!0)}get insetsPadding(){return c(this,rn).insetsPadding}setInsetPadding(t){c(this,rn).center&&(c(this,rn).insetsPadding=t?{...t}:Yu)}animateTo(t){var a;if(c(this,V).mode==="outdoors-overlay"&&c(this,V).map)return(a=c(this,V).map)==null||a.flyTo({center:t.center,zoom:t.zoomLevel,bearing:t.bearing,pitch:t.pitch,duration:t.duration}),Promise.resolve();let e=t.center?c(this,V).convertTo3DMapPosition(t.center[1],t.center[0],0):void 0,i=t.zoomLevel!==void 0?c(this,st).cameraSystem.convertZoomLevelToAltitude(t.zoomLevel):void 0,n=t.bearing!==void 0?it.degToRad(t.bearing):void 0,o=t.pitch!==void 0?it.degToRad(t.pitch):void 0;return new Promise(u=>{c(this,st).cameraSystem.animateCamera({position:e,zoom:i,rotation:n,tilt:o},t.duration||0,e4[t.easing||"ease-in-out"],u,u)})}focusOn(t,e){var i,n;return c(this,V).mode==="outdoors-overlay"&&c(this,V).map?(t.length===1?(i=c(this,V).map)==null||i.flyTo({center:t[0],duration:(e==null?void 0:e.duration)||c(this,V).map.getBearing(),animate:!0,bearing:(e==null?void 0:e.bearing)||c(this,V).map.getBearing(),pitch:(e==null?void 0:e.pitch)||c(this,V).map.getPitch(),zoom:(e==null?void 0:e.maxZoomLevel)||c(this,V).map.getMaxZoom()}):(n=c(this,V).map)==null||n.fitBounds(t,{duration:e==null?void 0:e.duration,animate:!0,bearing:(e==null?void 0:e.bearing)||c(this,V).map.getBearing(),pitch:(e==null?void 0:e.pitch)||c(this,V).map.getPitch(),zoom:(e==null?void 0:e.maxZoomLevel)||c(this,V).map.getMaxZoom()}),Promise.resolve()):new Promise(o=>{c(this,st).cameraSystem.focusOn(t.map(a=>c(this,V).convertTo3DMapPosition(a[1],a[0],a[2]||0)),{insetsPadding:(e==null?void 0:e.padding)||this.insetsPadding},{changeZoom:!0,minZoom:(e==null?void 0:e.maxZoomLevel)===void 0?void 0:c(this,st).cameraSystem.convertZoomLevelToAltitude(t4(e.maxZoomLevel,this.minZoomLevel,this.maxZoomLevel,"maxZoomLevel is outside of minZoomLevel/maxZoomLevel bounds, clamping.")),maxZoom:(e==null?void 0:e.minZoomLevel)===void 0?void 0:c(this,st).cameraSystem.convertZoomLevelToAltitude(t4(e.minZoomLevel,this.minZoomLevel,this.maxZoomLevel,"minZoomLevel is outside of minZoomLevel/maxZoomLevel bounds, clamping.")),padding:(e==null?void 0:e.padding)||{top:0,left:0,bottom:0,right:0},curve:e4[(e==null?void 0:e.easing)||"ease-in-out"],rotation:e!=null&&e.bearing?it.degToRad(e.bearing):void 0,tilt:e!=null&&e.pitch?it.degToRad(e.pitch):void 0,duration:e==null?void 0:e.duration,callback:o,cancelledCallback:o})})}};V=new WeakMap,st=new WeakMap,rn=new WeakMap,ls=new WeakMap,l(am,"Camera");var pc=am;d();function r4(r){r&&(r.map&&(r.map.dispose(),r.map=void 0),r.dispose())}l(r4,"scrubMaterial");function Re(r){for(let t=r.children.length-1;t>=0;t--)Re(r.children[t]);"geometry"in r&&r.geometry&&r.geometry.dispose(),r.parent&&r.parent.remove(r),"material"in r&&Array.isArray(r.material)?r.material.forEach(function(t){r4(t)}):"material"in r&&typeof r.material<"u"&&r4(r.material)}l(Re,"destroyObject3D");d();var i4=`uniform vec4 uSize;
611
+ `;var HS=-.05,XS=1,Xf=class Xf extends yn{propertiesTexture;uniforms={uGradientIntensity:{value:0},uGradientEnd:{value:0},uGradientStart:{value:0},uTopTexture:{value:null},uTexture:{value:null}};constructor(t,e){super(t),this.propertiesTexture=new Ju(e),this.onBeforeCompile=i=>{let n=this.uniforms.uGradientIntensity,o=this.uniforms.uGradientEnd,a=this.uniforms.uGradientStart,u=this.uniforms.uTopTexture,s=this.uniforms.uTexture;this.uniforms=i.uniforms,i.vertexShader=Wb,i.fragmentShader=Ub,Object.assign(this.uniforms,{uGradientIntensity:n,uGradientEnd:o,uGradientStart:a,uMinSideAlpha:{value:HS},uMaxSideAlpha:{value:XS},uPropertiesTexture:{value:this.propertiesTexture},uTopTexture:u,uTexture:s})}}get texture(){return this.uniforms.uTexture.value}set texture(t){t.wrapS=He,t.wrapT=He,t.colorSpace=mi,this.uniforms.uTexture.value=t}get topTexture(){return this.uniforms.uTopTexture.value}set topTexture(t){t.wrapS=He,t.wrapT=He,t.colorSpace=mi,this.uniforms.uTopTexture.value=t}setGradientShading(t,e,i){this.uniforms.uGradientStart.value=t,this.uniforms.uGradientEnd.value=e,this.uniforms.uGradientIntensity.value=i}setColor(t,e,i){this.propertiesTexture.setColor(t,e,i)}showTextures=t=>{let e=!!this.uniforms.uTexture.value,i=!!this.uniforms.uTopTexture.value;(e||i)&&(this.propertiesTexture.setTexture(t,e,i),this.needsUpdate=!0)};hideTextures(t){let e=!!this.uniforms.uTexture.value,i=!!this.uniforms.uTopTexture.value;(e||i)&&(this.propertiesTexture.setTexture(t,!1,!1),this.needsUpdate=!0)}dispose(){super.dispose(),this.propertiesTexture.dispose()}};l(Xf,"BatchedStandardMaterial");var Ku=Xf;d();var jS=80;function Zb(r,t){var u,s;let e=0;for(let p of r)e+=((s=(u=p.components[0])==null?void 0:u.geometry)==null?void 0:s.attributes.position.count)||0;let i=new Tt(t.color),n=new Ku({color:i,side:To,opacity:t.opacity||1,transparent:t.opacity!==void 0?t.opacity<1:!1},r.length),o=new ao(r.length,e,0,n),a;for(let p of r)a=p.components[0],!(!(a instanceof Jt)||!a.geometry)&&(a.mesh=o,a.material=n,a.instanceIndex=o.addGeometry(a.geometry),o.userData.entities[a.instanceIndex]=p.id,n.setColor(a.instanceIndex,i,t.topColor?new Tt(t.topColor):i));return o.perObjectFrustumCulled=!0,o.matrixAutoUpdate=!1,o}l(Zb,"batchGeometries");function zb(r,t){t.polygonOffset=!0,t.polygonOffsetFactor=1,t.polygonOffsetUnits=1;let e=new f1(r,jS),i=B(t.color.getHexString()).darken(30).toRgbString(),n=new h1({linewidth:2,color:i,transparent:!0}),o=new yi(e,n);return o.layers.set(1),o}l(zb,"createOutlines");d();var WS="gray",US=.1;function qb(r,t,e){let{color:i=WS,opacity:n=1,altitude:o=0,height:a=US}=e||{};Array.isArray(n)&&(n=1);let u={min:{x:1/0,y:1/0,z:o},max:{x:-1/0,y:-1/0,z:a+o},center:{x:0,y:0,z:(a+o)/2}},s=new Xe,p=r.geometry.coordinates[0].map(x=>{let S=t(x[1],x[0]);return u.min.x=Math.min(u.min.x,S.x),u.min.y=Math.min(u.min.y,S.y),u.max.x=Math.max(u.max.x,S.x),u.max.y=Math.max(u.max.y,S.y),S});s.moveTo(p[0].x,p[0].y),p.slice(1).forEach(x=>s.lineTo(x.x,x.y)),s.lineTo(p[0].x,p[0].y);let f=r.geometry.coordinates.slice(1);s.holes=f.map(x=>{let S=x.map(g=>t(g[1],g[0])),M=new kr;return M.moveTo(S[0].x,S[0].y),S.slice(1).forEach(g=>M.lineTo(g.x,g.y)),M.lineTo(S[0].x,S[0].y),M});let m={bevelEnabled:!1,depth:a},y=new Ye(s,m);return y.translate(0,0,o||0),y.userData={style:{color:i,opacity:n}},y}l(qb,"renderPolygonGeometry");d();var ZS="gray",zS=.1;function $b(r,t,e){let{color:i=ZS,opacity:n=1,altitude:o=0,height:a=zS}=e||{};Array.isArray(n)&&(n=1);let u={min:{x:1/0,y:1/0,z:o},max:{x:-1/0,y:-1/0,z:a+o}},s={bevelEnabled:!1,depth:a},p=[];r.geometry.coordinates.forEach(m=>{let y=new Xe,x=m[0].map(g=>{let C=t(g[1],g[0]);return u.min.x=Math.min(u.min.x,C.x),u.min.y=Math.min(u.min.y,C.y),u.max.x=Math.max(u.max.x,C.x),u.max.y=Math.max(u.max.y,C.y),C});y.moveTo(x[0].x,x[0].y),x.slice(1).forEach(g=>y.lineTo(g.x,g.y)),y.lineTo(x[0].x,x[0].y);let S=m.slice(1);y.holes=S.map(g=>{let C=g.map(T=>t(T[1],T[0])),I=new kr;return I.moveTo(C[0].x,C[0].y),C.slice(1).forEach(T=>I.lineTo(T.x,T.y)),I.lineTo(C[0].x,C[0].y),I});let M=new Ye(y,s);p.push(M)});let f=je(p);return f.translate(0,0,o||0),f.userData={style:{color:i,opacity:n}},f}l($b,"renderMultiPolygonGeometry");d();d();var Wf=Ar(a4());function s4(r){this.name="JSClipperError",this.message=r,this.stack=new Error().stack}l(s4,"JSClipperError");s4.prototype=Error.prototype;Wf.default.Error=function(r){throw new s4(r)};var ae=Wf.default;var HP="gray",Uf=new ae.ClipperOffset,Qt=100;function l4(r,t,e){let{color:i=HP,opacity:n=1,width:o=1,join:a="round",cap:u="round",height:s=.01,altitude:p=0}=e||{};Array.isArray(n)&&(n=0);let f=[];for(let M=0;M<r.geometry.coordinates.length-1;M++){let g=t(r.geometry.coordinates[M][1],r.geometry.coordinates[M][0]),C=t(r.geometry.coordinates[M+1][1],r.geometry.coordinates[M+1][0]);f.push([g,C])}Uf.AddPaths(f.map(M=>M.map(g=>({X:g.x*Qt,Y:g.y*Qt}))),a==="round"?ae.JoinType.jsRound:a==="miter"?ae.JoinType.jsMiter:ae.JoinType.jsSquare,u==="round"?ae.EndType.etOpenRound:u==="butt"?ae.EndType.etOpenButt:ae.EndType.etOpenSquare);let m=new ae.PolyTree;Uf.Execute(m,o/2*Qt);let y=[],x={bevelEnabled:!1,depth:s};for(let M of m.m_AllPolys){let g=new Xe;if(M.IsHole())continue;let C=M.m_polygon;g.moveTo(C[0].X/Qt,C[0].Y/Qt),C.slice(1).forEach(I=>g.lineTo(I.X/Qt,I.Y/Qt)),g.lineTo(C[0].X/Qt,C[0].Y/Qt),g.holes=M.m_Childs.map(I=>{let T=new kr,w=I.m_polygon;return T.moveTo(w[0].X/Qt,w[0].Y/Qt),w.slice(1).forEach(L=>T.lineTo(L.X/Qt,L.Y/Qt)),T.lineTo(w[0].X/Qt,w[0].Y/Qt),T}),y.push(new Ye(g,x))}let S=je(y);return S.translate(0,0,p||0),S.userData={style:{color:i,opacity:n}},Uf.Clear(),S}l(l4,"renderLineStringGeometry");d();var te=100,XP=.22,YP=.01;function u4(r,t,e={}){let{width:i=XP,height:n=YP,color:o="gray",opacity:a=1,altitude:u=0}=e,s={min:{x:1/0,y:1/0,z:u},max:{x:-1/0,y:-1/0,z:u+n}},p={bevelEnabled:!1,depth:n},f=new ae.ClipperOffset,m=r.geometry.coordinates.map(M=>M.map(g=>t(g[1],g[0])));f.AddPaths(m.map(M=>M.map(g=>({X:g.x*te,Y:g.y*te}))),ae.JoinType.jsMiter,ae.EndType.etOpenRound);let y=new ae.PolyTree;f.Execute(y,i/2*te);let x=[];for(let M of y.m_AllPolys){let g=new Xe;if(M.IsHole())continue;s.min.x=Math.min(s.min.x,M.m_polygon[0].X),s.min.y=Math.min(s.min.y,M.m_polygon[0].Y),s.max.x=Math.max(s.max.x,M.m_polygon[0].X),s.max.y=Math.max(s.max.y,M.m_polygon[0].Y);let C=M.m_polygon;g.moveTo(C[0].X/te,C[0].Y/te),C.slice(1).forEach(I=>g.lineTo(I.X/te,I.Y/te)),g.lineTo(C[0].X/te,C[0].Y/te),g.holes=M.m_Childs.map(I=>{let T=new kr,w=I.m_polygon;return T.moveTo(w[0].X/te,w[0].Y/te),w.slice(1).forEach(L=>T.lineTo(L.X/te,L.Y/te)),T.lineTo(w[0].X/te,w[0].Y/te),T}),x.push(new Ye(g,p))}let S=je(x);return S.translate(0,0,u||0),S.userData={style:{color:o,opacity:a}},f.Clear(),S}l(u4,"renderMultiLineStringGeometry");d();var Qa,ts,Zf=class Zf{constructor(t){v(this,"mesh");v(this,"type","model");v(this,"outline");v(this,"geometry");v(this,"material");v(this,"feature");v(this,"instanceIndex",-1);v(this,"visible",!0);v(this,"color",new Tt);v(this,"position",new W);P(this,Qa,0);P(this,ts,1);this.feature=t}setOpacity(){}setColor(){}get altitude(){return c(this,Qa)}set altitude(t){this.mesh&&(this.mesh.position.z=t,E(this,Qa,t))}get opacity(){return c(this,ts)}set opacity(t){var e,i;if(this.mesh){for(let n of this.mesh.children)if(n instanceof Us){((e=n.userData)==null?void 0:e.originalOpacity)===void 0&&(n.userData.originalOpacity=n.material.opacity);let o=pe(t,0,(i=n.userData)==null?void 0:i.originalOpacity,0,1);n.material.opacity=o,n.material.transparent=o<1,n.material.needsUpdate=!0}}E(this,ts,t)}};Qa=new WeakMap,ts=new WeakMap,l(Zf,"ModelComponent");var ui=Zf;function jP(r){let{color:t,opacity:e,topColor:i,texture:n,topTexture:o}=r;return`${t}${e}${i||""}${n||""}${o||""}`}l(jP,"generateIndex");var WP=1e4,zf=class zf extends J{state;convertTo3DMapPosition;loader;constructor(t,e){super(),this.state=t,this.convertTo3DMapPosition=e}async getGLTFLoader(){if(this.loader)return;let{GLTFLoader:t}=await import("./GLTFLoader-MV5BOOKA.js");this.loader=new t}createEntityFromFeature(t,e,i){let n=new Jt(e),o=new dt(n,new ai(i));return o.id=t,o}createModelFromFeature(t,e,i){let n=new ui(e),o=new dt(n,new ai(i));return o.id=t,o}populateEntityMesh(t,e){let i=t.components[0];i.geometry=e}async populateModelGroup(t,e,i){let n=new pr,o=new fn,a=new i1,u=new W,s=new Qe;return this.loader||await this.getGLTFLoader(),this.loader.load(e,p=>{var y,x,S,M,g,C;p.scene.traverse(I=>{let T=I;if("isMesh"in T&&T.isMesh===!0){let w=new Us(T.geometry,T.material,t.size);w.userData={entities:{}},s.add(w),i.add(s)}});let f=0,m;for(let I of t.values()){m=this.state.entity3DMap.get(I);let T=m.components[0],w=m.components[0].feature;T.mesh=s,T.instanceIndex=f;let{x:L,y:D,z:R}=this.convertTo3DMapPosition(w.geometry.coordinates[1],w.geometry.coordinates[0],0);T.position.set(L,D,R),o.set(((y=w.properties.rotation)==null?void 0:y[0])||0,((x=w.properties.rotation)==null?void 0:x[1])||0,((S=w.properties.rotation)==null?void 0:S[2])||0),u.set(((M=w.properties.scale)==null?void 0:M[0])||1,((g=w.properties.scale)==null?void 0:g[1])||1,((C=w.properties.scale)==null?void 0:C[2])||1),a.setFromEuler(o),n.compose(T.position,a,u),s.children.forEach(F=>{let k=F;k.setMatrixAt(f,n),k.userData.entities[f]=m.id}),f++}this.publish("model-loaded")}),s}populateEntityGroup(t){let e,i,n,o;for(let a of t.values())o=this.state.entity3DMap.get(a),o.components[0]instanceof Jt&&(i=o.components[0].feature,n=o.components[1],i.geometry.type==="Polygon"?(e=qb(i,this.convertTo3DMapPosition,n),this.populateEntityMesh(o,e)):i.geometry.type==="MultiPolygon"?(e=$b(i,this.convertTo3DMapPosition,n),this.populateEntityMesh(o,e)):i.geometry.type==="LineString"?(e=l4(i,this.convertTo3DMapPosition,n),this.populateEntityMesh(o,e)):i.geometry.type==="MultiLineString"&&(e=u4(i,this.convertTo3DMapPosition,n),this.populateEntityMesh(o,e)));return t}optimize(t){if(t.visible&&(t instanceof Bt||t instanceof Pt)){for(let n of t.children)this.optimize(n);if(t instanceof Pt||t.userData.dirty===!1)return;let e={};if(!t.userData.modelURL&&t.userData.dirty)try{this.populateEntityGroup(t.userData.entities3D)}catch(n){G.warn(n)}else t.userData.modelURL&&t.userData.dirty&&(this.populateModelGroup(t.userData.entities3D,t.userData.modelURL,t),t.userData.dirty=!1);let i=0;if(t.userData.dirty){let n=0,o;for(let a of t.userData.entities3D.values()){o=this.state.entity3DMap.get(a);let u=o.components[0],s=o.components[1];if(u instanceof Jt){n++,n>=WP&&(n=0,i++);let p=jP(s)+i;e[p]===void 0&&(e[p]={style:s,entities:[]}),e[p].entities.push(o)}else u.mesh&&u.mesh.parent!==t&&t.add(u.mesh)}for(let a in e){let u=Zb(e[a].entities,e[a].style);t.add(u),t.userData.outlineDirty=!0,t.userData.dirty=!1}}}}update(){this.optimize(this.state.entityScene)}};l(zf,"MeshCreationAndOptimizationSystem");var ic=zf;d();var qf=class qf{state;dirty=!0;domTree;constructor(t,e){this.state=t,this.domTree=e}update(){if(this.dirty){let t;for(let e of Array.from(this.domTree.children))if(t=this.state.entity2DMap.get(e.userData.entityId),t){let i=t.components[0];(!i.enabled||!i.visible||!this.state.entity2DIds.has(e.userData.entityId))&&this.domTree.removeChild(e)}else this.domTree.removeChild(e);for(let e of this.state.entity2DIds)if(t=this.state.entity2DMap.get(e),t){let i=t.components[0];i instanceof ve&&i.enabled&&i.containerEl&&!this.domTree.contains(i.containerEl)&&(i.containerEl.userData={entityId:t.id},this.domTree.appendChild(i.containerEl),i.updateDimensions())}this.dirty=!1}}};l(qf,"DOMVisibilitySystem");var nc=qf;d();var $f=class $f{state;project;constructor(t,e){this.state=t,this.project=e}update(){let t;for(let e of this.state.entity2DIds)t=this.state.entity2DMap.get(e),t&&this.project(t.components[0].projection,t.position)}};l($f,"TwoDProjectionSystem");var oc=$f;d();d();var UP=l(function(){let t,e;return i=>{if((!e||!e)&&(t=document.createElement("canvas"),t.width=500*i,t.height=500*i,t.style.width="500px",t.style.height="500px",e=t.getContext("2d")),!e)throw new Error("Could not get 2D context");return{measureCanvas:t,measureCanvasContext:e}}},"createMeasureCanvasContext")(),c4=l(({text:r,size:t,maxWidth:e,pixelRatio:i,maxLines:n=2,lineHeight:o=1.2,options:a={strokeText:!0}})=>{let u=`bold ${t*i}px 'InterUI-Regular', Helvetica Neue, Arial, sans-serif`,{measureCanvasContext:s}=UP(i);s.font=u;let p=[],f=r.split(" "),m=0,y=0,x=0;for(;y<f.length;){let C=f[y];if(m===n&&m>0){p[m-1]+="...";break}if(p[m]==null&&(p[m]=C,y++),f.length===1){p[m]=C;break}if(f[y]==null)break;let{width:I}=s.measureText(p[m]+" "+f[y]);I<=e*i?(p[m]+=" "+f[y],y++):m++}p.forEach(C=>{let{width:I}=s.measureText(C);x=Math.max(I,x)});let S=t*i*o,M=p.length*S;return{maxWidth:x,maxHeight:M,lines:p.length,draw:(C,I,T)=>{p.length===1?(a.strokeText&&C.strokeText(p[0],I,T),C.fillText(p[0],I,T)):(a.strokeText&&(C.strokeText(p[0],I,T-S/2),C.strokeText(p[1],I,T+S/2)),C.fillText(p[0],I,T-S/2),C.fillText(p[1],I,T+S/2))}}},"shaveText");var ZP=4.5,zP=2.5,qP=2,$P=5,es=2.5;var Jf=class Jf{dirty=!1;state;colliderContext;colliderCanvas;constructor(t,e){this.state=t,this.colliderCanvas=e,this.colliderContext=e.getContext("2d")}pinCache={};imagePromiseCache={};imageDimensionsCache={};textCache={};update=(t,e,i)=>{let n=(t-e)/(i-e),o=this.state.pixelRatio;this.colliderContext.clearRect(0,0,this.colliderCanvas.width,this.colliderCanvas.height);let a,u,s,p,f,m;for(let y of this.state.entity2DIds)if(m=this.state.entity2DMap.get(y),m!=null&&m.components[0]instanceof rr&&!m.disposed){if(f=m.components[0],u=f.appearance.marker.foregroundColor,s=f.appearance.marker.backgroundColor,p=f.markerSize,a=`${u.active}-${u.inactive}-${s.active}-${s.inactive}-${p}`,this.pinCache[a]||this.prepare(f,a,this.colliderContext),f.appearance.marker.icon&&!f.imageHash&&this.cacheImage(f),this.textCache[f.id]==null||f.dirty||this.dirty){f.dirty=!1,f.collisionDirty=!0,this.textCache[f.id]={};let{textDrawFn:x,width:S,height:M}=this.processText(f.text,f.appearance.text.size,f.appearance.text.maxWidth,f.appearance.text.numLines,f.appearance.text.lineHeight);["left","center","right"].forEach(C=>{this.textCache[f.id][C]=this.textToCanvas(x,f.appearance.text.size,C,S,M,f.appearance.text.foregroundColor,f.appearance.text.backgroundColor)}),f.dimensions={width:Math.ceil(S/o),height:Math.ceil(M/o)},f.currentStrategyIndex===-1&&(f.currentStrategyIndex=0);let g=f.strategies[f.currentStrategyIndex];if(g){g.onStrategySelected(f);let C=f.style;f.style=f.newStyle,f.newStyle=C}}f.visible&&f.enabled&&(f.zoomProportion=n,this.draw(f,a,this.colliderContext))}this.dirty=!1};processText=(t,e,i,n,o)=>{let a=this.state.pixelRatio,{draw:u,maxWidth:s,maxHeight:p}=c4({text:t,size:e,pixelRatio:a,maxWidth:i,maxLines:n,lineHeight:o});return{textDrawFn:u,width:s+es*a*2,height:p+es*a*2}};textToCanvas=(t,e,i,n,o,a,u)=>{let s=this.state.pixelRatio,p,f=n,m=o;window.OffscreenCanvas!=null&&!rf()?p=new OffscreenCanvas(f,m):(p=document.createElement("canvas"),p.width=f,p.height=m,p.style.width=f+"px",p.style.height=m+"px");let y=p.getContext("2d",{willReadFrequently:!0});if(!y)return;y.textAlign=i,y.font=`bold ${e*s}px 'InterUI-Regular', Helvetica Neue, Arial, sans-serif`,y.textBaseline="middle",y.lineJoin="miter",y.miterLimit=2,y.strokeStyle="white",y.lineWidth=es*s,y.fillStyle=a,y.strokeStyle=u;let x=i==="left"?0:i==="center"?f/2:f-es*s/2;return t(y,x,(m+es*s/2)/2),p};cacheImage=t=>{if(!t.appearance.marker.icon)return;let e=Ev(t.appearance.marker.icon);if(t.imageHash=e,!this.imagePromiseCache[e]){let i=["png","jpg","jpeg"],n=t.appearance.marker.icon.split("?")[0],o=i.some(u=>n.toLowerCase().endsWith(u)),a=new Image;o?a.src=t.appearance.marker.icon:a.src=`data:image/svg+xml;base64, ${btoa(t.appearance.marker.icon)}`,a.onload=()=>{this.imagePromiseCache[e]=a}}};createPinCanvas=(t,e,i,n)=>{let o,a=this.state.pixelRatio,u=t.totalMarkerSize*2*a;window.OffscreenCanvas!=null?o=new OffscreenCanvas(u,u):(o=document.createElement("canvas"),o.width=u,o.height=u,o.style.width=u/a+"px",o.style.height=u/a+"px");let s=o.getContext("2d");return s.shadowColor="rgba(0,0,0,0.3)",s.shadowOffsetY=qP*a,s.shadowBlur=$P*a,s.beginPath(),s.arc(u/2,u/2,e/2+zP*a/2,0,2*Math.PI),s.fillStyle=i,s.fill(),s.beginPath(),s.arc(u/2,u/2,e/2,0,2*Math.PI),s.shadowColor="transparent",s.fillStyle=n,s.fill(),o};prepare=(t,e,i)=>{let n=this.state.pixelRatio;i.lineWidth=4*n;let o=this.createPinCanvas(t,t.markerSize,t.appearance.marker.backgroundColor.active,t.appearance.marker.foregroundColor.active),a=this.createPinCanvas(t,t.iconVisible?t.markerSize:ZP*n,t.appearance.marker.backgroundColor.inactive,t.appearance.marker.foregroundColor.inactive);this.pinCache[e]=[o,a]};draw(t,e,i){if(!t.visible)return;i.save(),i.globalAlpha=t.opacity;let n=this.state.pixelRatio,o=t.projection.x*n,a=t.projection.y*n,u=t.style.pinVisibility===1?this.pinCache[e][0]:this.pinCache[e][1];if(i.drawImage(u,o-t.totalMarkerSize*n,a-t.totalMarkerSize*n),t.appearance.marker.icon&&t.iconVisible&&t.imageHash&&t.appearance.marker.iconSize&&this.imagePromiseCache[t.imageHash]){let s=this.imagePromiseCache[t.imageHash],p=(t.appearance.marker.iconSize-t.appearance.marker.iconPadding)*n,{iconFit:f}=t.appearance.marker,m=p,y=p,x=`${t.imageHash}_${f}`;if(this.imageDimensionsCache[x])m=this.imageDimensionsCache[x].width,y=this.imageDimensionsCache[x].height;else{let S=s.width*n,M=s.height*n;if(f==="contain"){let g=Math.sqrt(S**2+M**2),C=p/g;m=S*C,y=M*C}if(f==="cover"){let g=p/S,C=p/M,I=Math.max(g,C);m=S*I,y=M*I}}i.save(),i.beginPath(),i.arc(o,a,p/2,0,2*Math.PI),i.closePath(),i.clip(),i.drawImage(s,o-m/2,a-y/2,m,y),i.restore()}t.style.textLabelVisible&&t.style.textAlign!=null&&t.style.left&&t.style.top&&i.drawImage(this.textCache[t.id][t.style.textAlign],o+t.style.left*n,a+t.style.top*n),i.restore()}};l(Jf,"TwoDDrawSystem");var ac=Jf;d();d();var ci=class ci{loader;constructor(){this.loader=new gn}static getInstance(){return ci.instance||(ci.instance=new ci),ci.instance}getLoader(){return this.loader}};l(ci,"TextureLoaderSingleton"),v(ci,"instance");var Kf=ci,sc=Kf.getInstance();function JP(r,t){let e=r.components[2],i=r.components[1];return e!=null&&e.hover?[i.hoverColor||t,i.hoverColor||t]:[i.color,i.topColor||i.color]}l(JP,"processColor");var rs,Qf,tm=class tm extends J{constructor(e){super();P(this,rs);v(this,"state");v(this,"textureCache",new Map);this.state=e}setShading(e,i){e.material&&e.material.setGradientShading(i.start,i.end,i.intensity)}update(){var a,u,s;let e,i,n,o;for(let p of this.state.threeDEntities)if(o=this.state.entity3DMap.get(p),o instanceof Bt&&o.type==="geometry-group"){if(o.userData.shadingDirty){i=o.components[0];let f=o.userData.entities3D.values().next().value,m=this.state.entity3DMap.get(f);m instanceof dt&&(m.type==="geometry"||m.type==="custom-geometry")&&(e=m.components[0],o.userData.shadingDirty&&i.shading&&this.setShading(e,i.shading)),o.userData.shadingDirty=!1}}else if(o instanceof dt&&(o.type==="geometry"||o.type==="custom-geometry")&&((a=o.components[1])!=null&&a.dirty||(u=o.components[2])!=null&&u.dirty)){e=o.components[0],i=o.components[1],n=o.components[2];let f=JP(o,this.state.hoverColor);e.setColor(f[0],f[1]),i.visible!==e.visible&&(e.visible=i.visible),i.altitude!==e.altitude&&(e.altitude=i.altitude),i.opacity!==e.opacity&&(e.opacity=i.opacity),i.dirty=!1,i.texture!==e.texture&&Y(this,rs,Qf).call(this,i.texture,e,"texture"),i.topTexture!==e.topTexture&&Y(this,rs,Qf).call(this,i.topTexture,e,"topTexture"),(e.texture||e.topTexture)&&(n!=null&&n.hover&&e.texturesVisible?e.hideTextures():e.texturesVisible||e.showTextures()),o.components[2]&&(o.components[2].dirty=!1)}else(o==null?void 0:o.type)==="model"&&((s=o.components[1])!=null&&s.dirty)&&(e=o.components[0],i=o.components[1],i.opacity!==e.opacity&&(e.opacity=i.opacity),i.dirty=!1)}destroy(){this.textureCache.forEach(e=>{e.dispose()}),this.textureCache.clear()}};rs=new WeakSet,Qf=l(function(e,i,n){if(!(!e||!i.showTextures)){if(this.textureCache.has(e)){n==="topTexture"?i.topTexture=this.textureCache.get(e):i.texture=this.textureCache.get(e),i.showTextures();return}sc.getLoader().load(e,o=>{n==="topTexture"?i.topTexture=o:i.texture=o,this.textureCache.set(e,o),i.showTextures(),this.publish("texture-loaded")},void 0,()=>{G.error(`Failed to load texture: ${e}`)})}},"#loadTexture"),l(tm,"DrawSystem");var lc=tm;d();var em=class em extends J{state;constructor(t){super(),this.state=t,this.playAnimations=this._playAnimations}animating=new Map;isAnimating=!1;startTime=-1;duration=500;update=()=>{this.animating.clear();let t,e;for(let i of this.state.entity2DIds)t=this.state.entity2DMap.get(i),t&&(e=t.components[0],e instanceof rr&&e.visibilityNeedsUpdate&&(e.visible?this.animating.set(e,e.opacity):(e.opacity=0,e.visibilityNeedsUpdate=!1)));this.startTime=performance.now(),this.publish("animate:2d")};playAnimations;_playAnimations(){let t=performance.now();for(let[e,i]of this.animating.entries()){let n=(t-this.startTime)/this.duration;e.opacity=pe(n,0,1,i,1),t-this.startTime>=this.duration&&(e.visible=!0,e.visibilityNeedsUpdate=!1,this.animating.delete(e))}this.publish("draw:2d"),this.animating.size>0&&this.publish("animate:2d")}};l(em,"TwoDVisibilitySystem");var uc=em;d();var rm=class rm extends J{state;renderer;mode;scene;cameraObject;viewCamera;systems;constructor(t,e,i,n,o,a,u){super(),this.renderer=t,this.state=e,this.mode=i,this.scene=n,this.cameraObject=o,this.viewCamera=a,this.systems=u,this.systems.collisionSystem.on("visibility-changed",this.updateEntities2D),this.systems.twoDVisiblitySystem.on("draw:2d",this.drawEntities2D),this.systems.twoDVisiblitySystem.on("animate:2d",this.animate2D)}twoDdirty=!0;threeDdirty=!0;frameId=null;twoDFrameId=null;animationFrameId=null;nextFrame=null;update=(t=!1)=>{var e;if(((e=this.renderer)==null?void 0:e.renderer)!=null)if(t)this.commitRenderState(),this.paint();else{if(this.frameId)return;this.frameId=requestAnimationFrame(()=>{var i;((i=this.renderer)==null?void 0:i.renderer)!=null&&this.mode==="standalone"&&(this.commitRenderState(),this.paint())})}};paint(){var t;(t=this.renderer)!=null&&t.renderer&&(this.mode==="standalone"?(this.renderer.clear(),this.renderer.render(this.scene,this.cameraObject)):this.renderer.render(this.scene,this.viewCamera))}animate2D=()=>{this.animationFrameId=requestAnimationFrame(()=>{this.animationFrameId=null,this.systems.twoDVisiblitySystem.playAnimations()})};drawEntities2D=()=>{this.twoDFrameId||(this.twoDFrameId=requestAnimationFrame(()=>{this.twoDFrameId=null,this.systems.twoDDrawSystem.update(this.systems.cameraSystem.getZoomAltitude(),this.systems.cameraSystem.getZoomScaledMin(),this.systems.cameraSystem.getZoomScaledMax())}))};updateEntities2D=()=>{this.animationFrameId&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null),this.twoDFrameId=requestAnimationFrame(()=>{this.twoDFrameId=null,this.systems.watermarkSystem.insertIntoQuadTree(this.systems.collisionSystem.interactiveCollidersQTree),this.systems.interactionSystem.updateQuadtree(this.systems.collisionSystem.interactiveCollidersQTree),this.systems.twoDVisiblitySystem.update(),this.systems.twoDDrawSystem.update(this.systems.cameraSystem.getZoomAltitude(),this.systems.cameraSystem.getZoomScaledMin(),this.systems.cameraSystem.getZoomScaledMax()),this.systems.domDrawSystem.update(this.systems.cameraSystem.isUserInteracting())})};commitRenderState=()=>{this.frameId=null,(this.mode==="outdoors-interleaved"||this.mode==="standalone")&&this.systems.cameraSystem.update(),this.scene.updateMatrixWorld(),this.state.shouldMeasureCanvas&&(this.state.shouldMeasureCanvas=!1,this.publish("measure-canvas")),this.twoDdirty&&(this.state.entity2DIds.clear(),of(this.state.entityScene,this.state.entity2DIds),this.systems.domVisiblitySystem.dirty=!0,this.systems.collisionSystem.dirty=!0,this.systems.domMutationSystem.dirty=!0,this.systems.panBoundsSystem.dirty=!0,this.twoDdirty=!1),this.threeDdirty&&(this.state.threeDEntities=[],nf(this.state.entityScene,this.state.threeDEntities),this.threeDdirty=!1,this.systems.interactionSystem.dirty3D=!0,this.systems.panBoundsSystem.dirty=!0,this.systems.outlineInterpolationSystem.geometries3DDirty=!0),this.systems.meshOptimizationSystem.update(),this.systems.customGeometrySystem.update(),this.systems.panBoundsSystem.update(),this.systems.stackSystem.update(),this.systems.drawSystem.update(),this.systems.outlineInterpolationSystem.update(this.systems.cameraSystem.getZoomLevel(),this.systems.cameraSystem.zoomDirty),this.systems.pathSystem.update(this.systems.cameraSystem.minZoomAltitude,this.systems.cameraSystem.maxZoomAltitude,this.systems.cameraSystem.getZoomAltitude()),this.systems.cameraSystem.postRender(),this.systems.domVisiblitySystem.update(),this.systems.domMutationSystem.update(),this.systems.twoDProjectionSystem.update(),this.systems.twoDDrawSystem.update(this.systems.cameraSystem.getZoomAltitude(),this.systems.cameraSystem.getZoomScaledMin(),this.systems.cameraSystem.getZoomScaledMax()),this.systems.domDrawSystem.update(this.systems.cameraSystem.isUserInteracting()),this.systems.watermarkSystem.update(),this.nextFrame=requestAnimationFrame(()=>{this.systems.collisionSystem.update()}),this.systems.cameraSystem.dirty=!1,this.systems.cameraSystem.zoomDirty=!1};destroy(){this.frameId&&cancelAnimationFrame(this.frameId),this.twoDFrameId&&cancelAnimationFrame(this.twoDFrameId),this.animationFrameId&&cancelAnimationFrame(this.animationFrameId),this.nextFrame&&cancelAnimationFrame(this.nextFrame),this.state.entity2DIds.clear(),this.state.threeDEntities=[],this.systems.domVisiblitySystem.dirty=!0,this.systems.collisionSystem.dirty=!0,this.update(),this.systems.collisionSystem.off("visibility-changed",this.updateEntities2D),this.systems.twoDVisiblitySystem.off("draw:2d",this.drawEntities2D),this.systems.twoDVisiblitySystem.off("animate:2d",this.animate2D)}};l(rm,"RenderSystem");var cc=rm;d();function po(r,t,e=!1){let i=null,n=0;return function(...o){n++,n===1&&e===!0&&r.apply(this,o);let a=l(()=>{(!e||n>1)&&r.apply(this,o),i=null,n=0},"later");clearTimeout(i),i=setTimeout(a,t)}}l(po,"debounce");d();var ho,is,im=class im{constructor(t,e){v(this,"type","path");v(this,"mesh",new Qe);v(this,"material");v(this,"geometry");v(this,"outline");v(this,"feature");v(this,"options");v(this,"nearRadius",.2);v(this,"farRadius",.4);v(this,"color","#ff834c");v(this,"accentColor","blue");P(this,ho,1);v(this,"altitudeAdjustment",1);v(this,"displayArrowsOnPath",!1);v(this,"animateArrowsOnPath",!1);v(this,"dirty",!0);v(this,"position",new W);P(this,is,0);var i,n,o,a,u,s;this.feature=t,this.options=e||{},this.color=(i=e==null?void 0:e.color)!=null?i:this.color,this.accentColor=(n=e==null?void 0:e.accentColor)!=null?n:this.accentColor,this.nearRadius=(o=e==null?void 0:e.nearRadius)!=null?o:this.nearRadius,this.farRadius=(a=e==null?void 0:e.farRadius)!=null?a:this.farRadius,this.displayArrowsOnPath=(u=e==null?void 0:e.displayArrowsOnPath)!=null?u:this.displayArrowsOnPath,this.animateArrowsOnPath=(s=e==null?void 0:e.animateArrowsOnPath)!=null?s:this.animateArrowsOnPath}setColor(){}setOpacity(){}set completeFraction(t){E(this,ho,t),this.mesh&&this.mesh.children.forEach(e=>{e.material.uniforms.complete.value=c(this,ho),e.material.needsUpdate=!0})}get completeFraction(){return c(this,ho)}set visible(t){this.mesh&&(this.mesh.visible=t)}get visible(){return this.mesh?this.mesh.visible:!1}get altitude(){return c(this,is)}set altitude(t){this.mesh&&(this.mesh.position.z=t,E(this,is,t))}set complete(t){this.material&&(this.material.uniforms.complete.value=t,this.material.needsUpdate=!0)}};ho=new WeakMap,is=new WeakMap,l(im,"PathComponent");var pc=im;d();var nm=class nm{rendererState;constructor(t){this.rendererState=t}update(){let t;for(let e of this.rendererState.threeDEntities)if(t=this.rendererState.entity3DMap.get(e),t instanceof Pt&&t.components[0]){let i=t.components[0];if(i.dirty){for(let n of t.children)(n instanceof Bt||n instanceof Pt)&&(n.userData.entityId!==t.components[0].activeId?n.setVisible(!1):n.setVisible(!0));i.dirty=!1}}}};l(nm,"StackSystem");var hc=nm;d();d();var as=Ar(Kn());d();d();d();var p4=l((r,t)=>(t-r+Math.PI)%(Math.PI*2)+Math.PI*2%(Math.PI*2)-Math.PI,"differenceBetweenAngles"),h4=l((r,t)=>new U(r.clientX-t.offsetLeft,r.clientY-t.offsetTop),"getTouchPos"),om=l((r,t)=>Math.atan2(t.y-r.y,t.x-r.x),"angle"),ns=l((r,t)=>Math.sqrt((t.y-r.y)**2+(t.x-r.x)**2),"distance"),am=l((r,t)=>new U((r.x+t.x)/2,(r.y+t.y)/2),"average"),sm=l(r=>{let t=0,{wheelDelta:e,detail:i}=r;return e!==void 0?t=e:i!==void 0&&(t=-i),t},"getScrollDelta");var lm=class lm{input1;input2;lastAngle;lastDistance;totalDistance;first;second;constructor(t,e){this.input1=t,this.input2=e,this.lastAngle=om(t,e),this.lastDistance=ns(t,e),this.totalDistance=0,this.first=t,this.second=e}update(t,e){let i=ns(t,e);this.input1=t,this.input2=e;let n=om(t,e);this.lastAngle=n,this.lastDistance=i,this.totalDistance+=(ns(this.first,t)+ns(this.second,e))/2,this.first=am(this.first,t),this.second=am(this.second,e)}};l(lm,"InputSet");var dc=lm;d();var um=class um{touch;camera;cameraPlane;viewCoordinate;snapHolderMatrix;snapCamera;cameraPosition;raycaster;worldCoordinate;snapshotted=!1;constructor(t,e,i){this.touch=t,this.camera=e,this.cameraPlane=i,this.viewCoordinate={x:t.x,y:t.y},this.camera.updateMatrixWorld(),this.camera.updateMatrix(),this.snapHolderMatrix=this.camera.matrixWorld.clone(),this.snapCamera=this.camera.clone(),this.snapshotCameraState()}snapshotCameraState(){this.camera.updateMatrix(),this.camera.updateMatrixWorld(),this.cameraPosition=this.camera.position.clone();let t=new U(this.viewCoordinate.x,this.viewCoordinate.y);this.raycaster=this.raycaster||new Rr,this.raycaster.setFromCamera(t,this.snapCamera);let e=this.raycaster.intersectObject(this.cameraPlane,!0);this.worldCoordinate=e&&e.length>0?e[0].point:null,this.snapshotted=!0}updateAnchorState(t,e){this.camera=t,this.snapCamera=t.clone(),this.snapHolderMatrix=t.matrixWorld.clone(),this.updateViewCoordinate(e),this.snapshotCameraState()}updateViewCoordinate(t){this.viewCoordinate={x:t.x,y:t.y}}reUnproject(){var i,n;let t=new U(this.viewCoordinate.x,this.viewCoordinate.y);(i=this.raycaster)==null||i.setFromCamera(t,this.snapCamera);let e=(n=this.raycaster)==null?void 0:n.intersectObject(this.cameraPlane,!0)[0];return e?e.point:void 0}};l(um,"TouchAnchor");var os=um;var en,fc,cm=class cm extends J{constructor(e,i,n,o,a){super();v(this,"dirty",!1);v(this,"zoomDirty",!1);v(this,"zoomSpeed",5);v(this,"rotateSpeed",100);v(this,"enabled",!0);v(this,"enableZoom",!0);v(this,"enablePan",!0);v(this,"enablePedestal",!1);v(this,"maxPedestal",1/0);v(this,"minPedestal",0);v(this,"enableRotate",!0);v(this,"minZoomAltitude",5);v(this,"maxZoomAltitude",1e4);v(this,"initialMinZoom",5);v(this,"initialMaxZoom",1e4);v(this,"ignoreZoomLimits",!1);v(this,"minExpandedZoom",5);v(this,"maxExpandedZoom",1e5);v(this,"zoomFactor",1);v(this,"panBounds",{min:new W(1/0,1/0),max:new W(-1/0,-1/0),center:new W(0,0,0),radius:1/0});v(this,"minTilt",0);v(this,"maxTilt",1.2);v(this,"MOUSE_BUTTONS",{ORBIT:js.RIGHT,ZOOM:js.MIDDLE,PAN:js.LEFT});v(this,"camera");v(this,"scene");v(this,"renderer");v(this,"elevation");v(this,"orbit");v(this,"cameraPlane");v(this,"raycaster",new Rr);v(this,"rendererState");v(this,"options");v(this,"state",-1);v(this,"intersection");v(this,"viewState",null);v(this,"tweens",new Set);v(this,"clock",new v1(!0));v(this,"coords",{mouse:new U,rotateStart:new U,rotateEnd:new U,rotateDelta:new U,panStart:new W,panCameraStart:new W,panEnd:new W,panDelta:new W,initialShiftPos:new U,initialPedestal:0,floorAnchor:new W});v(this,"touch",{origin:{offsetLeft:0,offsetTop:0},touches:[],anchor1:null,anchor2:null,inputs:null});v(this,"scrollTimer",null);v(this,"lastWheelTime",0);v(this,"resetZoom",!1);v(this,"zoomStart");v(this,"pedestalScaleFactor",1);v(this,"isUserZooming",!1);v(this,"stayInsideBounds",!0);v(this,"userInteracting",!1);v(this,"raycastToFloor",e=>{this.raycaster.setFromCamera(e,this.camera);let i=this.raycaster.intersectObject(this.cameraPlane,!1)[0];return i?i.point:new W});v(this,"isUserInteracting",()=>this.userInteracting);v(this,"getPosition",()=>new W(this.orbit.position.x,this.orbit.position.y,this.orbit.position.z));v(this,"getPedestal",()=>this.orbit.position.z);v(this,"pan",(e,i)=>{isNaN(e)||isNaN(i)||(this.setPosition(this.orbit.position.x+e,this.orbit.position.y+i),this.publish("position-updated"))});v(this,"postRender",()=>{(this.state===2||this.state===6)&&(this.raycaster.setFromCamera(this.coords.mouse,this.camera),this.intersection=this.raycaster.intersectObject(this.cameraPlane,!1)[0],this.intersection&&(this.coords.panStart.set(this.intersection.point.x,this.intersection.point.y,0),this.coords.panCameraStart.set(this.orbit.position.x,this.orbit.position.y,0))),this.state===3&&this.resetZoom&&(this.resetZoom=!1,this.zoomStart=this.getZoomAltitude(),this.coords.floorAnchor=this.raycastToFloor(this.coords.mouse),this.coords.panCameraStart.set(this.orbit.position.x,this.orbit.position.y,0)),this.state===7&&this.isAnimating()===!1&&(this.state=-1,this.publish("multi-end"))});v(this,"isAnimating",()=>as.default.getAll().some(e=>e._mMapAnimation));v(this,"isCameraMoving",()=>this.state!==-1);v(this,"setPosition",(e,i)=>{if(isNaN(e)||isNaN(i))return;this.state===-1&&this.publish("pan-start");let n=e-this.panBounds.center.x,o=i-this.panBounds.center.y,a=Math.sqrt(n*n+o*o);if(this.stayInsideBounds&&a>this.panBounds.radius){let u=Math.atan2(o,n),s={x:Math.cos(u)*this.panBounds.radius+this.panBounds.center.x,y:Math.sin(u)*this.panBounds.radius+this.panBounds.center.y};this.orbit.position.x=s.x,this.orbit.position.y=s.y}else this.orbit.position.x=e,this.orbit.position.y=i;this.publish("position-updated"),this.publish("change"),this.state===-1&&this.publish("pan-end"),this.dirty=!0});v(this,"tilt",e=>{if(isNaN(e))return;this.state===-1&&this.publish("rotate-start");let i=this.stayInsideBounds?Math.max(Math.min(e+this.getTilt(),this.maxTilt),this.minTilt):e+this.getTilt();i!==this.elevation.rotation.x&&(this.elevation.rotation.x=i,this.publish("tilt-updated")),this.publish("change"),this.state===-1&&this.publish("rotate-end")});v(this,"zoomIn",(e,i,n)=>{let o=this.getZoomAltitude();this.animateCamera({zoom:o/1.5},e,i,n)});v(this,"zoomOut",(e,i,n)=>{let o=this.getZoomAltitude();this.animateCamera({zoom:o*1.5},e,i,n)});v(this,"getRotation",()=>this.orbit.rotation.z);v(this,"cancelAnimation",()=>{let e=Array.from(this.tweens),i=e[e.length-1];i.state===7&&this.publish("multi-cancel",{zooming:!0,rotating:!0,tilting:!0}),this.completeTween(i)});v(this,"animateCamera",(e,i,n,o,a,u)=>{let s={mode:Jd.cancel,...u},p={},f={},m=this.getPosition();if(e.position!=null&&(e.position.x!==void 0&&(p.x=m.x,f.x=e.position.x),e.position.y!==void 0&&(p.y=m.y,f.y=e.position.y),e.position.z!==void 0&&(p.z=m.z,f.z=e.position.z)),e.zoom!==void 0&&(p.zoom=this.stayInsideBounds?Math.min(Math.max(this.getZoomAltitude(),this.getZoomScaledMin()),this.getZoomScaledMax()):this.getZoomAltitude(),this.viewState==="multi_floor"||!this.stayInsideBounds?f.zoom=e.zoom:f.zoom=Math.min(Math.max(e.zoom,this.getZoomScaledMin()),this.getZoomScaledMax())),e.rotation!==void 0){let T=p.rotation=this.getRotation(),w=e.rotation%(2*Math.PI),L=w-T;if(Math.abs(L)>Math.PI){let D=L<0?1:-1;f.rotation=w+2*Math.PI*D}else f.rotation=w}e.tilt!==void 0&&(p.tilt=this.getTilt(),this.viewState==="multi_floor"||!this.stayInsideBounds?f.tilt=e.tilt:f.tilt=Math.max(Math.min(e.tilt,this.maxTilt),this.minTilt));let y=p.zoom!==f.zoom,x=p.rotation!==f.rotation,S=p.tilt!==f.tilt,M=new as.default.Tween(p).to(f,b.env.TESTING?0:i).onUpdate(T=>{this.setMulti({x:T.x,y:T.y,z:T.z},T.zoom,T.rotation,T.tilt)}).onComplete(()=>{this.completeTween(M),this.publish("multi-end",{zooming:y,rotating:x,tilting:S}),o&&o()}).onStart(()=>{this.state!==7&&(this.state=7,M.state=7,this.publish("multi-start",{zooming:y,rotating:x,tilting:S})),this.publish("change")}),g=Array.from(this.tweens),C=g[g.length-1],I=!1;return C!=null&&(s.mode===Jd.chain?(I=!0,C.chain(M)):(this.completeTween(C),typeof a=="function"&&a(),C=null)),this.tweens.add(M),n?M.easing(n):M.easing(as.default.Easing.Quadratic.In),!e.doNotAutoStart&&!I&&(M.start(),this.publish("change")),M._mMapAnimation=!0,M});v(this,"setMulti",(e,i,n,o,a=!0)=>{this.state===-1&&this.publish("multi-start");let u=!1;e!=null&&(e.x!==void 0&&!isNaN(e.x)&&(this.orbit.position.x=e.x,u=!0),e.y!==void 0&&!isNaN(e.y)&&(this.orbit.position.y=e.y,u=!0),e.z!==void 0&&!isNaN(e.z)&&(this.setPedestal(e.z,!0),u=!0)),u&&this.publish("position-updated");let s={zooming:!1,tilting:!!i,rotating:!1};if(i!==void 0&&!isNaN(i)){let p=this.stayInsideBounds?Math.min(Math.max(i,this.getZoomScaledMin()),this.getZoomScaledMax()):i;p!==this.camera.position.z&&(s.zooming=!0,this.camera.position.z=p,this.publish("zoom-updated"),this.zoomDirty=!0,this.viewState==="multi_floor"?i>Mu&&(this.camera.near=i-Mu,this.camera.far=i+Mu):(this.camera.near=i/Aa,this.camera.far=i*Aa),this.camera.updateProjectionMatrix())}if(n!==void 0&&!isNaN(n)&&n!==this.orbit.rotation.z&&(s.rotating=!0,this.orbit.rotation.z=n,this.publish("rotation-updated")),o!==void 0&&!isNaN(o)){let p=this.stayInsideBounds?Math.max(Math.min(o,this.maxTilt),this.minTilt):o;p!==this.elevation.rotation.x&&(s.tilting=!0,this.elevation.rotation.x=p,this.publish("tilt-updated"))}a&&this.publish("change"),this.state===-1&&this.publish("multi-end",s)});v(this,"getZoomScaledMin",()=>this.minZoomAltitude*this.zoomFactor);v(this,"getZoomScaledMax",()=>{let e=this.minZoomAltitude*this.zoomFactor;return Math.max(this.maxZoomAltitude,e)});v(this,"setRotation",(e,i)=>{if(isNaN(e))return;this.state===-1&&!i&&this.publish("rotate-start");let n=e%Kd;n!==this.orbit.rotation.z&&(this.orbit.rotation.z=n,i||this.publish("rotation-updated")),i||this.publish("change"),this.state===-1&&!i&&this.publish("rotate-end"),this.dirty=!0});v(this,"setZoomAltitude",e=>{if(isNaN(e))return;this.state===-1&&this.publish("zoom-start");let i=this.stayInsideBounds?Math.min(Math.max(e,this.getZoomScaledMin()),this.getZoomScaledMax()):e;i!==this.camera.position.z&&(this.camera.position.z=i,this.publish("zoom-updated"),this.zoomDirty=!0),this.camera.near=i/Aa,this.camera.far=i*Aa,this.camera.updateProjectionMatrix(),this.publish("change"),this.state===-1&&this.publish("zoom-end"),this.dirty=!0});v(this,"setZoomLevel",e=>{this.setZoomAltitude(this.convertZoomLevelToAltitude(e))});v(this,"getZoomAltitude",()=>this.camera.position.z);v(this,"getZoomLevel",()=>this.convertAltitudeToZoomLevel(this.getZoomAltitude()));v(this,"rotate",e=>{if(isNaN(e))return;this.state===-1&&this.publish("rotate-start");let i=(this.orbit.rotation.z+e)%Kd;i!==this.orbit.rotation.z&&(this.orbit.rotation.z=i,this.publish("rotation-updated")),this.publish("change"),this.state===-1&&this.publish("rotate-end")});v(this,"setTilt",(e,i)=>{if(isNaN(e))return;this.state===-1&&!i&&this.publish("rotate-start");let n=this.stayInsideBounds?Math.max(Math.min(e,this.maxTilt),this.minTilt):e;n!==this.elevation.rotation.x&&(this.elevation.rotation.x=n,i||this.publish("tilt-updated")),i||this.publish("change"),this.state===-1&&!i&&this.publish("rotate-end"),this.dirty=!0});v(this,"getTilt",()=>this.elevation.rotation.x);v(this,"setCameraPlaneElevation",e=>{this.cameraPlane.position.z=e});v(this,"zoom",e=>{if(isNaN(e))return;this.state===-1&&this.publish("zoom-start");let i=this.getZoomAltitude()-e;this.camera.position.z=this.stayInsideBounds?Math.min(Math.max(i,this.minZoomAltitude*this.zoomFactor),this.maxZoomAltitude*this.zoomFactor):i,this.publish("zoom-updated"),this.zoomDirty=!0,this.publish("change"),this.state===-1&&this.publish("zoom-end")});v(this,"expandZoomLimits",(e,i)=>{i||(i=1.2),e*i>this.maxZoomAltitude&&(this.maxZoomAltitude=Math.min(e*i,this.maxExpandedZoom)),e/i<this.minZoomAltitude&&(this.minZoomAltitude=Math.max(e/i,this.minExpandedZoom))});v(this,"restrictZoomLimits",(e,i)=>{i||(i=1.2),e*i>this.initialMaxZoom&&e*i<this.maxZoomAltitude&&(this.maxZoomAltitude=Math.max(this.getZoomAltitude(),e*i)),e/i<this.initialMinZoom&&e/i>this.minZoomAltitude&&(this.minZoomAltitude=Math.min(this.getZoomAltitude(),e/i))});v(this,"getProjectionScaleFactor",(e,i,n)=>sf(e,i,n));v(this,"update",()=>{as.default.update(),this.lastWheelTime>0&&this.state===3&&this.clock.getElapsedTime()-this.lastWheelTime>.2&&(this.lastWheelTime=0,this.state=-1,this.publish("zoom-end"),this.removeMouseMoveEventListeners())});v(this,"setPedestal",(e,i=!1)=>{typeof e=="number"&&!isNaN(e)&&(this.orbit.position.z=e,i&&(this.publishPedestalChangeEvent(e),this.publish("change")),this.dirty=!0)});v(this,"dispose",()=>{for(let e of ef)e.endsWith("start")?this.off(e,this.setUserInteracting):e.endsWith("end")&&this.off(e,this.unsetUserInteracting);this.removeEventListeners(),this.scene.remove(this.cameraPlane)});v(this,"createCameraPlane",()=>{let e=new mn(1e10,1e10),i=new Nr({color:0,visible:!1}),n=new Zt(e,i);return this.scene.add(n),n});v(this,"addEventListeners",()=>{let{domElement:e}=this.renderer;for(let i of ef)i.endsWith("start")?this.on(i,this.setUserInteracting):i.endsWith("end")&&this.on(i,this.unsetUserInteracting);e.addEventListener("contextmenu",this.onContextMenu,!1),e.addEventListener("mousedown",this.onMouseDown,!1),e.addEventListener("wheel",this.onMouseWheel,{passive:!1}),e.addEventListener("touchstart",this.onTouchStart,!1),e.addEventListener("touchend",this.onTouchEnd,!1),e.addEventListener("touchmove",this.onTouchMove,!1)});v(this,"addMouseEventListeners",()=>{this.addMouseMoveEventListeners(),window.addEventListener("mouseup",this.onMouseUp,!1),window.addEventListener("mouseout",this.onMouseUp,!1)});v(this,"addMouseMoveEventListeners",()=>{this.renderer.domElement.addEventListener("mousemove",this.onMouseMove,!1)});v(this,"removeMouseMoveEventListeners",()=>{this.renderer.domElement.removeEventListener("mousemove",this.onMouseMove,!1)});v(this,"removeEventListeners",()=>{let{domElement:e}=this.renderer;e.removeEventListener("contextmenu",this.onContextMenu,!1),e.removeEventListener("mousedown",this.onMouseDown,!1),e.removeEventListener("wheel",this.onMouseWheel,!1),e.removeEventListener("touchstart",this.onTouchStart,!1),e.removeEventListener("touchend",this.onTouchEnd,!1),e.removeEventListener("touchmove",this.onTouchMove,!1),e.removeEventListener("mousemove",this.onMouseMove,!1),window.removeEventListener("mouseup",this.onMouseUp,!1),window.removeEventListener("mouseout",this.onMouseUp,!1)});v(this,"removeMouseUpEventListeners",()=>{this.renderer.domElement.removeEventListener("mousemove",this.onMouseMove,!1),window.removeEventListener("mouseup",this.onMouseUp,!1),window.removeEventListener("mouseout",this.onMouseUp,!1)});v(this,"onContextMenu",e=>{e.preventDefault()});v(this,"onMouseUp",()=>{if(this.enabled!==!1){switch(this.removeMouseUpEventListeners(),this.state){case 2:this.publish("pan-end"),this.publish("user-pan-end");break;case 1:this.publish("zoom-end"),this.publish("user-dolly-end");break;case 0:this.publish("rotate-end"),this.publish("user-rotate-end");break;case 8:this.publish("pedestal-end"),this.publish("user-pedestal-end");break}this.state=-1}});v(this,"onMouseMove",e=>{if(this.enabled!==!1)if(e.preventDefault(),this.mouseToScene(e),this.state===0){if(this.enableRotate===!1)return;this.handleMouseMoveRotate(e)}else if(this.state===2){if(this.enablePan===!1)return;this.handleMouseMovePan()}else this.state===3?(this.resetZoom=!0,this.state=-1):this.state===8&&this.handleMouseMovePedestal(e)});v(this,"onTouchStart",e=>{if(this.enabled!==!1){switch(this.updateTouchOrigin(),this.touchToScene(e),e.touches.length){case 1:this.enablePedestal?(this.handleTouchStartPedestal(e),this.state=9):this.enablePan&&(this.handleTouchStartPan(e),this.state=6);break;case 2:this.touch.inputs=new dc(this.touch.touches[0],this.touch.touches[1]);break;default:this.state=-1}this.state}});v(this,"onTouchMove",e=>{if(this.enabled!==!1)switch(this.touchToScene(e),e.touches.length){case 2:e.preventDefault(),e.stopPropagation();let i={...this.touch.inputs.first},n={...this.touch.inputs.second},o=new U(this.touch.touches[0].x,this.touch.touches[0].y),a=new U(this.touch.touches[1].x,this.touch.touches[1].y);if(this.touch.inputs.update(this.touch.touches[0],this.touch.touches[1]),this.enableRotate&&this.state===4)this.handleTouchMoveTilt(e);else if(this.state===5)this.handleTouchMoveDolly();else if(this.state!==5&&this.touch.inputs.totalDistance>.05){let u=i.y<o.y&&n.y<a.y,s=i.y>o.y&&n.y>a.y;this.enableRotate&&this.state!==4&&(s||u)?(this.handleTouchStartTilt(e),this.state=4):(this.handleTouchStartDolly(),this.state=5)}break;case 1:(this.enablePedestal||this.enablePan)&&(e.preventDefault(),e.stopPropagation()),this.enablePedestal&&this.state===9?this.handleTouchMovePedestal(e):this.enablePan&&this.state===6&&this.handleTouchMovePan(e);break;default:this.state=-1}});v(this,"onTouchEnd",e=>{if(this.enabled!==!1){switch(this.handleTouchEnd(),this.state){case 2:case 6:this.publish("user-pan-end");break;case 4:this.publish("pan-end"),this.publish("user-tilt-end");break;case 1:case 5:this.publish("zoom-end"),this.publish("user-dolly-end");break;case 0:this.publish("rotate-end"),this.publish("user-rotate-end");break;case 8:case 9:this.publish("pedestal-end"),this.publish("user-pedestal-end");break}e.touches.length?this.onTouchStart(e):this.state=-1}});v(this,"handleTouchMovePan",e=>{let i=Object.hasOwn(e,"x")?new U(e.x,e.y):this.touch.touches[0],n=this.raycastToFloor(i);this.coords.panEnd.set(n.x,n.y,0),this.coords.panDelta.subVectors(this.coords.panEnd,this.coords.panStart),this.setPosition(this.coords.panCameraStart.x-this.coords.panDelta.x,this.coords.panCameraStart.y-this.coords.panDelta.y),this.publish("change")});v(this,"handleTouchStartDolly",()=>{let e=this.touch.touches[0].x-this.touch.touches[1].x,i=this.touch.touches[0].y-this.touch.touches[1].y;this.zoomStart=this.getZoomAltitude();let n=new U(this.touch.touches[0].x-e/2,this.touch.touches[0].y-i/2);this.coords.floorAnchor=this.raycastToFloor(n),this.orbit.updateMatrixWorld(),this.touch.anchor1=new os(this.touch.touches[0],this.camera,this.cameraPlane),this.touch.anchor2=new os(this.touch.touches[1],this.camera,this.cameraPlane),this.coords.panCameraStart.set(this.orbit.position.x,this.orbit.position.y,0),this.publish("user-dolly-start"),this.publish("multi-start")});v(this,"handleMouseMovePan",()=>{let e=this.raycastToFloor(this.coords.mouse);this.coords.panEnd.set(e.x,e.y,0),this.coords.panDelta.subVectors(this.coords.panEnd,this.coords.panStart),this.setPosition(this.coords.panCameraStart.x-this.coords.panDelta.x,this.coords.panCameraStart.y-this.coords.panDelta.y),this.publish("change")});v(this,"handleTouchStartTilt",e=>{this.coords.rotateStart.set(e.touches[1].clientX,e.touches[1].clientY),this.publish("user-tilt-start"),this.publish("rotate-start")});v(this,"handleTouchMovePedestal",e=>{this.handleMouseMovePedestal(e.touches[0])});v(this,"handleTouchMoveTilt",e=>{this.coords.rotateEnd.set(e.touches[1].clientX,e.touches[1].clientY),this.coords.rotateDelta.subVectors(this.coords.rotateEnd,this.coords.rotateStart),this.setTilt(this.getTilt()-this.coords.rotateDelta.y/this.rotateSpeed),this.coords.rotateStart.copy(this.coords.rotateEnd)});v(this,"handleTouchMoveDolly",()=>{let e=this.touch.inputs.first,i=this.touch.inputs.second;this.touch.anchor1.viewCoordinate={x:e.x,y:e.y},this.touch.anchor2.viewCoordinate={x:i.x,y:i.y};let n=this.makeTransformFromTouchAnchors(this.touch.anchor1,this.touch.anchor2);n&&this.setCameraFromTransformMatrix(n),this.orbit.updateMatrixWorld(),this.touch.anchor1.updateAnchorState(this.camera,e),this.touch.anchor2.updateAnchorState(this.camera,i)});v(this,"handleTouchEnd",()=>{this.state===4||this.state===5?this.publish("multi-end"):this.state===6&&this.publish("pan-end")});v(this,"handleTouchStartPan",e=>{let i=Object.hasOwn(e,"x")?new U(e.x,e.y):this.touch.touches[0],n=this.raycastToFloor(i);this.coords.panStart.set(n.x,n.y,0),this.coords.panCameraStart.set(this.orbit.position.x,this.orbit.position.y,0),this.publish("user-pan-start"),this.publish("pan-start")});v(this,"handleTouchStartPedestal",e=>{this.handleMouseDownPedestal(e.touches[0])});v(this,"onMouseDown",e=>{if(this.enabled!==!1){if(this.mouseToScene(e),e.preventDefault(),this.state===3&&this.publish("zoom-end"),e.button===this.MOUSE_BUTTONS.ORBIT){if(this.enableRotate===!1)return;this.handleMouseDownRotate(e),this.state=0}else e.button===this.MOUSE_BUTTONS.PAN&&(this.enablePan?(this.handleMouseDownPan(),this.state=2):this.enablePedestal&&(this.handleMouseDownPedestal(e),this.state=8));this.state!==-1&&this.addMouseEventListeners()}});v(this,"onMouseWheel",e=>{this.enabled===!1||this.enableZoom===!1||this.state!==-1&&this.state!==3||(e.preventDefault(),e.stopPropagation(),this.mouseToScene(e),this.canScrollZoom(e)&&(this.lastWheelTime=this.clock.getElapsedTime(),this.publishUserZoomEvent()),this.state!==3&&this.canScrollZoom(e)&&(this.addMouseMoveEventListeners(),this.state=3,this.zoomStart=this.getZoomAltitude(),this.coords.floorAnchor=this.raycastToFloor(this.coords.mouse),this.coords.panCameraStart.set(this.orbit.position.x,this.orbit.position.y,0),this.publish("zoom-start")),this.scrollTimer!=null&&clearTimeout(this.scrollTimer),this.scrollTimer=setTimeout(()=>{this.publish("zoom-end")},50),this.handleMouseWheel(e))});v(this,"handleMouseWheel",e=>{if(this.publish("zoom-start"),!this.canScrollZoom(e)){this.lastWheelTime>0&&this.publish("zoom-end"),this.lastWheelTime=0,this.state=-1;return}let i=this.getZoomAltitude(),n=i-sm(e)*i/Mv*this.zoomSpeed;this.setZoomAltitude(n);let o=n/this.zoomStart;this.coords.panDelta.subVectors(this.coords.floorAnchor,this.coords.panCameraStart).multiplyScalar(1-o),this.setPosition(this.coords.panCameraStart.x+this.coords.panDelta.x,this.coords.panCameraStart.y+this.coords.panDelta.y),this.publish("change")});v(this,"setCameraFromTransformMatrix",e=>{this.orbit.updateMatrixWorld();let i=new fn;i.setFromRotationMatrix(e,"ZYX");let n=(e.elements[14]-this.cameraPlane.position.z)/Math.cos(i.x),o=i.z,a=new W(0,0,1);a.applyEuler(i),a.setLength(n);let u=new W;u.setFromMatrixPosition(e),u.sub(a),this.enablePan&&this.setPosition(u.x,u.y),this.enableZoom&&this.setZoomAltitude(n),this.enableRotate&&this.setRotation(o)});v(this,"makeTransformFromTouchAnchors",(e,i)=>{this.orbit.updateMatrixWorld(),this.camera.updateProjectionMatrix();let n=this.camera.projectionMatrix.clone(),o=e.worldCoordinate,a=i.worldCoordinate,u=e.reUnproject(),s=i.reUnproject();if(!u||!s||!o||!a)return null;let p=e.viewCoordinate,f=i.viewCoordinate,m=a.x-o.x,y=a.y-o.y,x=Math.atan2(y,m),S=s.x-u.x,M=s.y-u.y,g=Math.atan2(M,S),C=p4(x,g),I=new pr;I.makeRotationZ(-C);let T=I.clone();T.multiply(e.snapHolderMatrix);let w=l((J4,K4,Q4)=>J4.elements[(K4-1)*4+Q4-1],"m"),L=w(n,1,1)*w(T,1,1)-p.x*w(n,3,4)*w(T,3,1),D=w(n,1,1)*w(T,1,2)-p.x*w(n,3,4)*w(T,3,2),R=w(n,1,1)*w(T,1,3)-p.x*w(n,3,4)*w(T,3,3),F=o.x*L+o.y*D+o.z*R,k=w(n,2,2)*w(T,2,1)-p.y*w(n,3,4)*w(T,3,1),H=w(n,2,2)*w(T,2,2)-p.y*w(n,3,4)*w(T,3,2),X=w(n,2,2)*w(T,2,3)-p.y*w(n,3,4)*w(T,3,3),$=o.x*k+o.y*H+o.z*X,ct=w(n,1,1)*w(T,1,1)-f.x*w(n,3,4)*w(T,3,1),yt=w(n,1,1)*w(T,1,2)-f.x*w(n,3,4)*w(T,3,2),bt=w(n,1,1)*w(T,1,3)-f.x*w(n,3,4)*w(T,3,3),Nt=a.x*ct+a.y*yt+a.z*bt,Me=w(n,2,2)*w(T,2,1)-f.y*w(n,3,4)*w(T,3,1),Ft=w(n,2,2)*w(T,2,2)-f.y*w(n,3,4)*w(T,3,2),ht=w(n,2,2)*w(T,2,3)-f.y*w(n,3,4)*w(T,3,3),xt=a.x*Me+a.y*Ft+a.z*ht,ur=Math.abs(ct-L),Pe=Math.abs(yt-D),le=Math.abs(bt-R),Ut=Math.abs(ct-k),hi=Math.abs(yt-H),hn=Math.abs(bt-X),et=Math.abs(Me-L),St=Math.abs(Ft-D),Gt=Math.abs(ht-R),ie=Math.abs(Me-k),cr=Math.abs(Ft-H),dn=Math.abs(ht-X),di=Math.min(ur+Pe+le,Ut+hi+hn),Rc=Math.min(et+St+Gt,ie+cr+dn);di<Rc&&(ct=Me,yt=Ft,bt=ht,Nt=xt);let kt=k*R-L*X,fi=H*R-D*X,Hs=$*R-F*X,Po=ct*X-k*bt,wo=yt*X-H*bt,Xs=Nt*X-$*bt,U4=(Xs*fi-Hs*wo)/(Po*fi-kt*wo),Z4=(Xs*kt-Hs*Po)/(wo*kt-fi*Po),$m=H*L-D*k,z4=X*L-R*k,q4=$*L-F*k,Jm=yt*k-H*ct,$4=bt*k-X*ct,Km=((Nt*k-$*ct)*$m-q4*Jm)/($4*$m-z4*Jm),Ys=T.clone();return Ys.elements[12]=U4,Ys.elements[13]=Z4,Ys.elements[14]=Km,Km>0?Ys:null});v(this,"updateTouchOrigin",()=>{let e=this.renderer.domElement;this.touch.origin.offsetLeft=e.getBoundingClientRect().left,this.touch.origin.offsetTop=e.getBoundingClientRect().top});v(this,"touchToScene",e=>{this.touch.touches=[];for(let i=0,n=e.touches.length;i<n;i++){let o=e.touches[i],a=h4(o,this.touch.origin);this.touch.touches.push(new U(a.x/this.renderer.domElement.width*this.rendererState.pixelRatio*2-1,-(a.y/this.renderer.domElement.height*this.rendererState.pixelRatio)*2+1))}this.coords.mouse=this.touch.touches[0]});v(this,"canScrollZoom",e=>{let i=sm(e),n=this.getZoomAltitude();return!(i<0&&n===this.getZoomScaledMax()||i>0&&n===this.getZoomScaledMin())});v(this,"mouseToScene",e=>{let i=this.getMousePos(e);return this.coords.mouse.x=i.x/this.renderer.domElement.width*this.rendererState.pixelRatio*2-1,this.coords.mouse.y=-(i.y/this.renderer.domElement.height*this.rendererState.pixelRatio)*2+1,this.coords.mouse});v(this,"getMousePos",e=>({x:e.offsetX,y:e.offsetY}));v(this,"handleMouseDownRotate",e=>{this.coords.rotateStart.set(e.clientX,e.clientY),this.publish("rotate-start"),this.publish("user-rotate-start")});v(this,"handleMouseDownPan",()=>{let e=this.raycastToFloor(this.coords.mouse);this.coords.panStart.set(e.x,e.y,0),this.coords.panCameraStart.set(this.orbit.position.x,this.orbit.position.y,0),this.publish("pan-start"),this.publish("user-pan-start")});v(this,"handleMouseDownPedestal",e=>{let i=new U(e.clientX,e.clientY);this.coords.initialShiftPos=i,this.coords.initialPedestal=this.getPedestal(),this.pedestalScaleFactor=sf(this.camera.fov,this.renderer.domElement.clientHeight,this.getZoomAltitude()),this.publish("pedestal-start"),this.publish("user-pedestal-start")});v(this,"handleMouseMovePedestal",e=>{let i={x:e.clientX,y:e.clientY},n=this.coords.initialPedestal+this.pedestalScaleFactor*(i.y-this.coords.initialShiftPos.y);this.stayInsideBounds&&(n<this.minPedestal?n=Math.max(n,this.minPedestal):n>this.maxPedestal&&(n=Math.min(n,this.maxPedestal))),n!==this.getPedestal()&&this.setPedestal(n,!0)});v(this,"handleMouseMoveRotate",e=>{this.coords.rotateEnd.set(e.clientX,e.clientY),this.coords.rotateDelta.subVectors(this.coords.rotateEnd,this.coords.rotateStart),this.rotate(-this.coords.rotateDelta.x/this.rotateSpeed),this.setTilt(this.getTilt()-this.coords.rotateDelta.y/this.rotateSpeed),this.coords.rotateStart.copy(this.coords.rotateEnd),this.publish("change")});v(this,"publishUserZoomDebounced",po(()=>{this.isUserZooming=!1,this.publish("user-zoom-end")},250));v(this,"publishUserZoomEvent",()=>{this.isUserZooming?this.publishUserZoomDebounced():(this.publish("user-zoom-start"),this.isUserZooming=!0,this.publishUserZoomDebounced())});v(this,"setUserInteracting",()=>{this.userInteracting=!0});v(this,"unsetUserInteracting",()=>{this.userInteracting=!1});v(this,"publishPedestalChangeEvent",e=>{this.publish("pedestal-change",{pedestal:e,scrolledToTop:this.scrolledToTop,scrolledToBottom:this.scrolledToBottom,scrollPercent:this.scrollPercent})});v(this,"convertAltitudeToZoomLevel",e=>{let[,i]=this.center,o=e*2*Math.tan(it.degToRad(this.camera.fov)/2)/this.options.canvasHeight,a=Math.cos(it.degToRad(i))*2*Math.PI*ni/o;return it.clamp(Math.log2(a/512),Qd,tf)});v(this,"convertZoomLevelToAltitude",e=>{let[,i]=this.center,n=it.clamp(e,Qd,tf),o=Math.pow(2,n),a=it.clamp(i,xv,Sv),u=o*512;return Math.cos(it.degToRad(a))*Math.PI*2*ni/u*this.options.canvasHeight/2/Math.tan(it.degToRad(this.camera.fov)/2)});v(this,"completeTween",e=>{e.isPlaying?e.stop():e.end(),this.tweens.delete(e)});P(this,en,{PIXELS:"pixels",PORTIONS:"portions"});P(this,fc,["top","bottom","left","right"]);v(this,"getCameraFrameForPoints",(e,i,n,o,a=!0,{canvasWidth:u,canvasHeight:s},p=this.minZoomAltitude,f=this.maxZoomAltitude)=>{Number.isFinite(n)&&(n=1),Number.isFinite(i)&&(i=1),p=Math.max(this.cameraPlane.position.z,p);let m={position:this.getPosition(),zoom:p};if(e==null||e.length===0)return m;o||(o={top:0,bottom:0,left:0,right:0,type:c(this,en).PIXELS});for(let kt of c(this,fc))typeof o[kt]!="number"&&(o[kt]=0);if(o.type||(o.type=c(this,en).PIXELS),o.type===c(this,en).PORTIONS&&(o={top:o.top*s,bottom:o.bottom*s,left:o.left*u,right:o.right*u,type:c(this,en).PIXELS}),o.left+o.right>=u||o.top+o.bottom>=s)return m;this.orbit.updateMatrixWorld();let y=this.camera.matrixWorldInverse,x=this.camera.fov*(Math.PI/180)/2,S=x*n,g=Math.atan(Math.tan(x)*(u/s))*i;if(e.length===1){let kt=e[0].clone();kt.applyMatrix4(y);let fi=p*Math.tan(g)*2,Hs=p*Math.tan(S)*2,Po=(o.left-o.right)/2/u,wo=(o.top-o.bottom)/2/s,Xs=new W(-Po*fi,wo*Hs,0);return kt.add(Xs),kt.applyMatrix4(this.camera.matrixWorld),m.position.x=kt.x,m.position.y=kt.y,m.position.z=kt.z,m.zoom=Math.max(m.zoom,m.position.z),m}let C=new W(1/0,1/0,1/0),I=new W(-1/0,-1/0,-1/0),T=new we().setFromPoints(e),w;for(let kt=0,fi=e.length;kt<fi;kt++)w=e[kt].clone(),w.applyMatrix4(y),C.min(w),I.max(w);let L=I.x-C.x,D=I.y-C.y,R=u-o.left-o.right,F=s-o.top-o.bottom,k=(I.x+C.x)/2,H=(I.y+C.y)/2,X=L/R,$=D/F,ct=p,yt=f,bt=ct*Math.tan(g)*2,Nt=yt*Math.tan(g)*2,Me=bt/u,Ft=Nt/u,ht=Math.max(X,$);a&&(ht=Math.min(Math.max(ht,Me),Ft));let xt=R*ht,ur=F*ht,Pe={min:{x:k-xt/2-o.left*ht,y:H-ur/2-o.bottom*ht},max:{x:k+xt/2+o.right*ht,y:H+ur/2+o.top*ht}},le=(Pe.min.x+Pe.max.x)/2,Ut=(Pe.min.y+Pe.max.y)/2,hi=T.getCenter(new W),hn=Math.abs(le-Pe.min.x),et=Math.abs(Ut-Pe.min.y),St=hn/Math.tan(g),Gt=et/Math.tan(S),ie=new W;ie.set(le,Ut,I.z+Math.max(St,Gt)),ie.applyMatrix4(this.camera.matrixWorld);let cr=new W;cr.set(le,Ut,I.z),cr.applyMatrix4(this.camera.matrixWorld);let dn=new W().subVectors(cr,ie),di=(hi.z-ie.z)/dn.z,Rc=new W().copy(ie).add(dn.clone().multiplyScalar(di));return m.position=Rc,cr.set(m.position.x,m.position.y,m.position.z),ie.sub(cr),m.zoom=ie.length(),m});this.camera=e,this.renderer=n,this.rendererState=o,this.scene=i,this.options=a,this.elevation=e.parent,this.orbit=this.elevation.parent,this.cameraPlane=this.createCameraPlane(),this.zoomStart=e.position.z,a.mode!=="outdoors-overlay"&&this.addEventListeners()}get maxZoomLevel(){return this.convertAltitudeToZoomLevel(this.minZoomAltitude)}setMaxZoomLevel(e){this.minZoomAltitude=this.convertZoomLevelToAltitude(e)}get minZoomLevel(){return this.convertAltitudeToZoomLevel(this.maxZoomAltitude)}setMinZoomLevel(e){this.maxZoomAltitude=this.convertZoomLevelToAltitude(e)}get scrollPercent(){let e=this.minPedestal,i=this.maxPedestal,n=this.getPedestal();return n=Math.min(n,i),n=Math.max(n,e),(n-e)/(i-e)*100}get scrolledToBottom(){return this.minPedestal===0||Math.floor(this.getPedestal())<=this.minPedestal}get scrolledToTop(){return this.maxPedestal===0||Math.ceil(this.getPedestal())>=this.maxPedestal}get center(){var o,a,u,s;let e=this.getPosition(),{lat:i,lon:n}=Pu((a=(o=this.rendererState.center)==null?void 0:o[1])!=null?a:0,(s=(u=this.rendererState.center)==null?void 0:u[0])!=null?s:0,e.x,e.y);return[n,i]}setCenter(e,i){var a,u,s,p;let{x:n,y:o}=wu((u=(a=this.rendererState.center)==null?void 0:a[1])!=null?u:0,(p=(s=this.rendererState.center)==null?void 0:s[0])!=null?p:0,i,e);this.setPosition(n,o)}focusOn(e,{insetsPadding:i},n={}){var g;let o=(g=n.changeZoom)!=null?g:!0,a=n.curve,u=1,s=1,p=n.callback,f=n.cancelledCallback,m=n.minZoom!==void 0?n.minZoom:this.minZoomAltitude,y=n.maxZoom!==void 0?n.maxZoom:this.maxZoomAltitude,x=this.options.canvasWidth,S=this.options.canvasHeight,M;if(n.duration!==void 0?M=n.duration:b.env.TESTING==="true"?M=0:M=200,i.top!==0||i.bottom!==0||i.left!==0||i.right!==0)if(n.tilt!==void 0&&n.tilt!==this.getTilt()||n.rotation!==void 0&&n.rotation!==this.getRotation())this.animateCamera({position:this.getPosition(),tilt:n.tilt,rotation:n.rotation},M,a,()=>{let C=n.padding||i,I=this.getCameraFrameForPoints(e,u,s,C,o,{canvasWidth:x,canvasHeight:S},m,y);this.animateCamera({position:I.position,tilt:this.getTilt(),rotation:this.getRotation(),zoom:I.zoom},M,a,p,f)});else{let C=n.padding||i,I=this.getCameraFrameForPoints(e,u,s,C,o,{canvasWidth:x,canvasHeight:S},m,y);this.animateCamera({position:I.position,tilt:this.getTilt(),rotation:this.getRotation(),zoom:I.zoom},M,a,p,f)}else{let C=n.padding||i,I=this.getCameraFrameForPoints(e,u,s,C,o,{canvasHeight:S,canvasWidth:x},m,y);this.animateCamera({position:I.position,tilt:n.tilt,rotation:n.rotation,zoom:I.zoom},M,a,p,f)}}resize(e,i){this.options.canvasWidth=e,this.options.canvasHeight=i}};en=new WeakMap,fc=new WeakMap,l(cm,"CameraSystem");var ss=cm;d();var KP=300,pm=class pm{state;constructor(t){this.state=t}update(t){var o;let e,i,n;for(let a of this.state.entity2DIds)e=this.state.entity2DMap.get(a),e&&(i=e.components[0],n=e.components[1],i instanceof ve&&i.containerEl!=null&&((i.visible===!0||((o=i.animation)==null?void 0:o.pending)===!0)&&(i.containerEl.style.transform=`translate3D(${i.projection.x}px, ${i.projection.y}px, ${i.projection.y}px)`),i.visible===!0?i.containerEl.style.pointerEvents=t||n!=null?"none":"auto":i.containerEl.style.pointerEvents="none",i.visibilityNeedsUpdate&&(i.animation&&i.animation.cancel(),i.animation=i.containerEl.animate([{opacity:i.visible?"1":"0"}],{duration:KP,easing:"ease-in-out",fill:"forwards"}),i.visibilityNeedsUpdate=!1)))}};l(pm,"DOMDrawSystem");var mc=pm;d();var hm=class hm{percentExpanded=0;activeId="";gap=20;dirty=!0};l(hm,"StackComponent");var yc=hm;d();var dm=class dm extends J{state;dirty=!0;domTree;observers=new Map;constructor(t,e){super(),this.state=t,this.domTree=e}setupObserver(){var e;if(this.observers){for(let i of this.observers.values())i.disconnect();this.observers.clear()}let t;for(let i of this.domTree.children){let n=i.getAttribute("data-marker-id");if(n!=null&&(t=this.state.entity2DMap.get(n),(e=t.components[0].options)!=null&&e.dynamicResize)){let o=new ResizeObserver(this.updateDimensions);o.observe(i),this.observers.set(i.userData.entityId,o)}}}updateDimensions=t=>{t.forEach(e=>{let i=e.target,n=i.getAttribute("data-marker-id");if(n){let o=this.state.entity2DMap.get(n);if(o&&o.components[0]instanceof ve&&i.firstElementChild){let{width:a,height:u}=i.firstElementChild.getBoundingClientRect();o.components[0].updateDimensions(a,u)}}}),this.publish("dimensions-update")};update(){this.dirty&&(this.setupObserver(),this.dirty=!1)}destroy(){for(let t of this.observers.values())t.disconnect();this.observers.clear()}};l(dm,"DOMResizeSystem");var gc=dm;d();var ls=Ar(Kn());var QP=0,tw=22,ew=0,rw=90;function f4(r,t,e,i){return(r<t||r>e)&&G.warn(i),Math.min(e,Math.max(t,r))}l(f4,"clampWithWarning");var m4={linear:ls.default.Easing.Linear.None,"ease-in":ls.default.Easing.Quadratic.In,"ease-out":ls.default.Easing.Quadratic.Out,"ease-in-out":ls.default.Easing.Quadratic.InOut},V,st,rn,us,fm=class fm{constructor(t,e,i,n){P(this,V,void 0);P(this,st,void 0);P(this,rn,void 0);P(this,us,void 0);E(this,V,t),E(this,st,e),E(this,rn,i),E(this,us,n),c(this,st).cameraSystem.on("pedestal-change",({pedestal:o})=>{c(this,V).map&&(c(this,V).map.transform.elevation=o,c(this,V).map.transform.minElevationForCurrentTile=o,c(this,V).map.triggerRepaint()),c(this,st).cameraSystem.setCameraPlaneElevation(o),c(this,us).position.z=o})}get center(){return c(this,V).mode==="outdoors-overlay"&&c(this,V).map?c(this,V).map.getCenter().toArray():c(this,st).cameraSystem.center}setCenter(t){var e;if(c(this,V).mode==="outdoors-overlay"&&c(this,V).map){(e=c(this,V).map)==null||e.setCenter(t);return}c(this,st).cameraSystem.setCenter(t[0],t[1])}get zoomLevel(){var t;return c(this,V).mode==="outdoors-overlay"&&c(this,V).map?(t=c(this,V).map)==null?void 0:t.getZoom():c(this,st).cameraSystem.getZoomLevel()}setZoomLevel(t){var e;c(this,V).mode==="outdoors-overlay"&&c(this,V).map&&((e=c(this,V).map)==null||e.setZoom(t)),c(this,st).cameraSystem.setZoomLevel(t)}get maxZoomLevel(){return c(this,st).cameraSystem.maxZoomLevel}get minZoomLevel(){return c(this,st).cameraSystem.minZoomLevel}setMinZoomLevel(t){var i;let e=Math.max(QP,t);c(this,st).cameraSystem.setMinZoomLevel(e),(i=c(this,V).map)==null||i.setMinZoom(e)}setMaxZoomLevel(t){var i;let e=Math.min(tw,t);(i=c(this,V).map)==null||i.setMaxZoom(e),c(this,st).cameraSystem.setMaxZoomLevel(e)}get maxPitch(){var t;return c(this,V).mode==="outdoors-overlay"&&c(this,V).map?(t=c(this,V).map)==null?void 0:t.getMaxPitch():it.radToDeg(c(this,st).cameraSystem.maxTilt)}get minPitch(){var t;return c(this,V).mode==="outdoors-overlay"&&c(this,V).map?(t=c(this,V).map)==null?void 0:t.getMinPitch():it.radToDeg(c(this,st).cameraSystem.minTilt)}setMinPitch(t){var i;let e=Math.max(ew,t);(i=c(this,V).map)==null||i.setMinPitch(e),c(this,st).cameraSystem.minTilt=it.degToRad(e)}setMaxPitch(t){var i;let e=Math.min(rw,t);(i=c(this,V).map)==null||i.setMaxPitch(e),c(this,st).cameraSystem.maxTilt=it.degToRad(e)}get bearing(){var t;return c(this,V).mode==="outdoors-overlay"&&c(this,V).map?(t=c(this,V).map)==null?void 0:t.getBearing():it.radToDeg(c(this,st).cameraSystem.getRotation())}setBearing(t){var e;if(c(this,V).mode==="outdoors-overlay"&&c(this,V).map){(e=c(this,V).map)==null||e.setBearing(t);return}c(this,st).cameraSystem.setRotation(it.degToRad(t))}get pitch(){var t;return c(this,V).mode==="outdoors-overlay"&&c(this,V).map?(t=c(this,V).map)==null?void 0:t.getPitch():it.radToDeg(c(this,st).cameraSystem.getTilt())}setPitch(t){var e;if(c(this,V).mode==="outdoors-overlay"&&c(this,V).map){(e=c(this,V).map)==null||e.setPitch(t);return}c(this,st).cameraSystem.setTilt(it.degToRad(t))}get elevation(){return c(this,st).cameraSystem.getPedestal()}setElevation(t){c(this,st).cameraSystem.setPedestal(t,!0)}get insetsPadding(){return c(this,rn).insetsPadding}setInsetPadding(t){c(this,rn).center&&(c(this,rn).insetsPadding=t?{...t}:$u)}animateTo(t){var a;if(c(this,V).mode==="outdoors-overlay"&&c(this,V).map)return(a=c(this,V).map)==null||a.flyTo({center:t.center,zoom:t.zoomLevel,bearing:t.bearing,pitch:t.pitch,duration:t.duration}),Promise.resolve();let e=t.center?c(this,V).convertTo3DMapPosition(t.center[1],t.center[0],0):void 0,i=t.zoomLevel!==void 0?c(this,st).cameraSystem.convertZoomLevelToAltitude(t.zoomLevel):void 0,n=t.bearing!==void 0?it.degToRad(t.bearing):void 0,o=t.pitch!==void 0?it.degToRad(t.pitch):void 0;return new Promise(u=>{c(this,st).cameraSystem.animateCamera({position:e,zoom:i,rotation:n,tilt:o},t.duration||0,m4[t.easing||"ease-in-out"],u,u)})}focusOn(t,e){var i,n;return c(this,V).mode==="outdoors-overlay"&&c(this,V).map?(t.length===1?(i=c(this,V).map)==null||i.flyTo({center:t[0],duration:(e==null?void 0:e.duration)||c(this,V).map.getBearing(),animate:!0,bearing:(e==null?void 0:e.bearing)||c(this,V).map.getBearing(),pitch:(e==null?void 0:e.pitch)||c(this,V).map.getPitch(),zoom:(e==null?void 0:e.maxZoomLevel)||c(this,V).map.getMaxZoom()}):(n=c(this,V).map)==null||n.fitBounds(t,{duration:e==null?void 0:e.duration,animate:!0,bearing:(e==null?void 0:e.bearing)||c(this,V).map.getBearing(),pitch:(e==null?void 0:e.pitch)||c(this,V).map.getPitch(),zoom:(e==null?void 0:e.maxZoomLevel)||c(this,V).map.getMaxZoom()}),Promise.resolve()):new Promise(o=>{c(this,st).cameraSystem.focusOn(t.map(a=>c(this,V).convertTo3DMapPosition(a[1],a[0],a[2]||0)),{insetsPadding:(e==null?void 0:e.padding)||this.insetsPadding},{changeZoom:!0,minZoom:(e==null?void 0:e.maxZoomLevel)===void 0?void 0:c(this,st).cameraSystem.convertZoomLevelToAltitude(f4(e.maxZoomLevel,this.minZoomLevel,this.maxZoomLevel,"maxZoomLevel is outside of minZoomLevel/maxZoomLevel bounds, clamping.")),maxZoom:(e==null?void 0:e.minZoomLevel)===void 0?void 0:c(this,st).cameraSystem.convertZoomLevelToAltitude(f4(e.minZoomLevel,this.minZoomLevel,this.maxZoomLevel,"minZoomLevel is outside of minZoomLevel/maxZoomLevel bounds, clamping.")),padding:(e==null?void 0:e.padding)||{top:0,left:0,bottom:0,right:0},curve:m4[(e==null?void 0:e.easing)||"ease-in-out"],rotation:e!=null&&e.bearing?it.degToRad(e.bearing):void 0,tilt:e!=null&&e.pitch?it.degToRad(e.pitch):void 0,duration:e==null?void 0:e.duration,callback:o,cancelledCallback:o})})}};V=new WeakMap,st=new WeakMap,rn=new WeakMap,us=new WeakMap,l(fm,"Camera");var vc=fm;d();function y4(r){r&&(r.map&&(r.map.dispose(),r.map=void 0),r.dispose())}l(y4,"scrubMaterial");function Re(r){for(let t=r.children.length-1;t>=0;t--)Re(r.children[t]);"geometry"in r&&r.geometry&&r.geometry.dispose(),r.parent&&r.parent.remove(r),"material"in r&&Array.isArray(r.material)?r.material.forEach(function(t){y4(t)}):"material"in r&&typeof r.material<"u"&&y4(r.material)}l(Re,"destroyObject3D");d();var g4=`uniform vec4 uSize;
612
612
  varying vec2 vUv;
613
613
  void main() {
614
614
  vUv = uv;
@@ -620,7 +620,7 @@ void main() {
620
620
  // Apply left .w and top .z offset
621
621
  transformed += vec2(uSize.w, -uSize.z) * 2.0;
622
622
  gl_Position = vec4(transformed, 1.0, 1.0);
623
- }`;var n4=`varying vec2 vUv;
623
+ }`;var v4=`varying vec2 vUv;
624
624
  uniform sampler2D uTexture;
625
625
  uniform float uOpacity;
626
626
  void main() {
@@ -630,19 +630,19 @@ void main() {
630
630
  #else
631
631
  gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
632
632
  #endif
633
- }`;d();var o4=4.291666666666667,a4=15,s4=25,l4=43/60;d();var u4=["horizontal","icon"],WP=new Map([[u4[0],`<svg viewBox="0 0 206 48">
633
+ }`;d();var b4=4.291666666666667,C4=15,x4=25,S4=43/60;d();var M4=["horizontal","icon"],ow=new Map([[M4[0],`<svg viewBox="0 0 206 48">
634
634
  <path d="M27.2678 14.2261H22.3187C21.0695 14.2261 20.4695 14.7801 20.4695 15.9852V31.142L10.3966 15.5591C9.69665 14.4784 9.2475 14.2773 7.8475 14.2261H2.97462C1.67462 14.2261 1.07631 14.7801 1.07631 15.9852V44.7665C1.07631 45.9716 1.67462 46.5256 2.97462 46.5256H7.92377C9.22207 46.5256 9.82207 45.9716 9.82207 44.7665V29.6847L19.9441 45.1926C20.695 46.3244 21.095 46.5256 22.4933 46.5256H27.2933C28.5916 46.5256 29.1916 45.9716 29.1916 44.7665V15.9852C29.1407 14.7801 28.5424 14.2261 27.2678 14.2261Z"/>
635
635
  <path d="M5.44915 10.9602C8.45863 10.9602 10.8983 8.50669 10.8983 5.48011C10.8983 2.45353 8.45863 0 5.44915 0C2.43967 0 0 2.45353 0 5.48011C0 8.50669 2.43967 10.9602 5.44915 10.9602Z"/>
636
636
  <path d="M61.7899 25.0449C63.2306 23.1903 65.078 22.2051 67.556 22.2051C72.0526 22.2051 74.7611 25.3347 74.7611 29.4511V39.2489C74.8187 39.7125 74.5306 39.9443 74.0695 39.9443H72.5136C72.0526 39.9443 71.7645 39.7125 71.8221 39.2489V29.5091C71.8221 27.1909 69.9187 25.2187 67.4984 25.2187C65.1339 25.2187 63.2323 27.1329 63.2323 29.2773V39.2489C63.2899 39.7125 63.0018 39.9443 62.5407 39.9443H60.9831C60.5221 39.9443 60.2916 39.7125 60.2916 39.2489V29.4511C60.2916 27.1329 58.3899 25.2187 56.0255 25.2187C53.7204 25.2187 51.7594 27.075 51.7594 29.2773V39.3068C51.817 39.7705 51.5289 40.0023 51.0102 40.0023H49.5119C49.0509 40.0023 48.7628 39.7705 48.7628 39.3068V23.25C48.7051 22.7864 48.9933 22.4966 49.5119 22.4966H50.9526C51.356 22.4966 51.5289 22.6704 51.5289 23.0182V24.2352C52.7407 22.9602 54.239 22.2648 56.0255 22.2648C58.4475 22.2068 60.3492 23.192 61.7899 25.0466V25.0449ZM77.1255 31.2477C77.1255 26.3216 81.1018 22.2051 86.1187 22.2051C88.539 22.2051 90.6136 23.1903 92.3441 25.1608V23.1903C92.3441 22.7267 92.5746 22.5528 93.0357 22.5528H94.4187C94.8797 22.5528 95.1102 22.7847 95.1102 23.3062V39.3648C95.1102 39.8284 94.8797 40.0602 94.4187 40.0602H93.0357C92.5746 40.0602 92.3441 39.8284 92.3441 39.4227V37.4523C90.6712 39.3648 88.5967 40.35 86.1746 40.35C81.1018 40.2341 77.1238 36.1773 77.1238 31.2477H77.1255ZM92.1136 31.2477C92.1136 27.8284 89.4611 25.2187 86.0594 25.2187C82.7746 25.2187 80.1221 27.8864 80.1221 31.2477C80.1221 34.6687 82.7746 37.2784 86.1187 37.2784C86.9062 37.2789 87.6861 37.1232 88.4138 36.8202C89.1414 36.5173 89.8026 36.0731 90.3593 35.513C90.9161 34.9528 91.3577 34.2878 91.6587 33.556C91.9597 32.8241 92.1143 32.0397 92.1136 31.2477ZM100.992 37.3943V46.3807C101.049 46.8443 100.761 47.1341 100.298 47.1341H98.7424C98.2814 47.1341 97.9933 46.9023 97.9933 46.3807V23.1903C97.9933 22.7267 98.2238 22.4369 98.7424 22.4369H100.183C100.646 22.379 100.934 22.6687 100.934 23.0744V24.9869C102.605 23.0744 104.68 22.1472 107.044 22.1472C112.002 22.1472 116.037 26.2619 116.037 31.1898C116.037 36.1176 112.059 40.2341 107.044 40.2341C104.622 40.2341 102.603 39.3068 100.992 37.3943ZM106.987 25.2187C103.7 25.2187 101.049 27.8864 101.049 31.2477C101.049 34.6687 103.7 37.2784 107.044 37.2784C110.446 37.2784 113.039 34.6108 113.039 31.2477C113.039 27.8864 110.388 25.2187 106.987 25.2187ZM121.11 37.3943V46.3807C121.168 46.8443 120.88 47.1341 120.419 47.1341H118.861C118.4 47.1341 118.112 46.9023 118.112 46.3807V23.1903C118.112 22.7267 118.342 22.4369 118.861 22.4369H120.302C120.764 22.379 121.053 22.6687 121.053 23.0744V24.9869C122.724 23.0744 124.798 22.1472 127.163 22.1472C132.12 22.1472 136.156 26.2619 136.156 31.1898C136.156 36.1176 132.178 40.2341 127.163 40.2341C124.742 40.2341 122.781 39.3068 121.11 37.3943ZM127.105 25.2187C123.819 25.2187 121.168 27.8864 121.168 31.2477C121.168 34.6687 123.819 37.2784 127.163 37.2784C130.564 37.2784 133.158 34.6108 133.158 31.2477C133.158 27.8864 130.507 25.2187 127.107 25.2187H127.105ZM153.97 32.3506H141.054C141.342 35.2483 143.995 37.4523 147.164 37.4523C148.893 37.4523 150.393 37.0466 151.719 36.0597C152.007 35.8858 152.295 35.7699 152.353 35.7699C152.583 35.7699 152.756 35.8858 152.929 36.1773L153.505 37.1625C153.622 37.3364 153.68 37.4523 153.68 37.5682C153.68 37.8 153.507 38.0318 153.103 38.3216C151.258 39.5966 149.183 40.292 146.992 40.292C141.688 40.292 137.883 36.3511 137.883 31.2477C137.883 26.204 141.803 22.2051 146.703 22.2051C151.546 22.2051 154.717 25.7983 154.717 31.0176C154.717 31.5972 154.717 32.3506 153.968 32.3506H153.97ZM141.056 30.0324H151.72C151.432 26.8432 149.473 24.929 146.648 24.929C145.241 24.8904 143.875 25.3995 142.833 26.3501C141.791 27.3007 141.154 28.6194 141.056 30.0307V30.0324ZM156.332 31.2477C156.332 26.3216 160.31 22.2051 165.326 22.2051C167.748 22.2051 169.707 23.1324 171.32 25.0449V16.2324C171.263 15.7687 171.551 15.479 172.012 15.479H173.57C174.031 15.479 174.319 15.7108 174.319 16.2324V39.3068C174.319 39.7705 174.088 40.0023 173.57 40.0023H172.129C171.666 40.0602 171.378 39.7705 171.378 39.3648V37.3943C169.649 39.3068 167.632 40.292 165.268 40.292C160.31 40.2341 156.332 36.1773 156.332 31.2477ZM171.264 31.2477C171.264 27.8284 168.612 25.2187 165.21 25.2187C161.924 25.2187 159.273 27.8864 159.273 31.2477C159.273 34.6687 161.924 37.2784 165.268 37.2784C166.057 37.2838 166.839 37.1316 167.569 36.8304C168.299 36.5292 168.962 36.0852 169.52 35.5241C170.077 34.963 170.519 34.296 170.818 33.5619C171.117 32.8277 171.268 32.0411 171.263 31.2477H171.264ZM177.72 19.0739C177.715 18.8594 177.754 18.646 177.833 18.4468C177.912 18.2476 178.031 18.0667 178.182 17.915C178.333 17.7633 178.512 17.6439 178.71 17.5642C178.909 17.4845 179.121 17.446 179.334 17.4511C179.546 17.4507 179.756 17.4923 179.952 17.5737C180.148 17.6551 180.326 17.7746 180.476 17.9254C180.626 18.0762 180.745 18.2553 180.826 18.4523C180.907 18.6494 180.948 18.8606 180.948 19.0739C180.953 19.2884 180.914 19.5017 180.835 19.7009C180.756 19.9001 180.637 20.081 180.486 20.2327C180.335 20.3845 180.156 20.5038 179.957 20.5835C179.759 20.6633 179.547 20.7017 179.334 20.6966C178.412 20.7545 177.72 20.0591 177.72 19.0739ZM177.836 39.2489V23.1903C177.836 22.7267 178.066 22.4369 178.527 22.4369H180.083C180.544 22.4369 180.832 22.6687 180.775 23.1903V39.2489C180.832 39.7125 180.544 39.9443 180.083 39.9443H178.527C178.066 39.9443 177.836 39.7125 177.836 39.2489ZM186.944 23.0165V24.1756C188.212 22.8426 189.71 22.2051 191.497 22.2051C195.937 22.2051 198.646 25.2767 198.646 29.3932V39.2489C198.703 39.7125 198.415 39.9443 197.954 39.9443H196.398C195.936 39.9443 195.705 39.7125 195.705 39.2489V29.4511C195.705 27.1329 193.803 25.2187 191.439 25.2187C189.134 25.2187 187.175 27.075 187.175 29.2773V39.3068C187.232 39.7705 186.944 40.0023 186.424 40.0023H184.868C184.407 40.0023 184.119 39.7705 184.119 39.3068V23.1903C184.061 22.7267 184.349 22.4949 184.868 22.4949H186.309C186.712 22.4949 186.944 22.6687 186.944 23.0165Z"/>
637
637
  <path d="M204 40C205.115 40 206 39.0857 206 38V37.9886C206 36.9029 205.126 36 204 36C202.885 36 202 36.9143 202 38V38.0114C202 39.0971 202.874 40 204 40ZM204 39.7829C202.989 39.7829 202.23 38.9829 202.23 38.0114V38C202.23 37.0286 203 36.2171 204 36.2171C205.011 36.2171 205.77 37.0171 205.77 37.9886V38C205.77 38.9714 205 39.7829 204 39.7829ZM203.218 38.9714H203.609V38.2743H204.034L204.517 38.9714H204.989L204.448 38.2057C204.724 38.1257 204.92 37.92 204.92 37.5886C204.92 37.1657 204.586 36.9486 204.138 36.9486H203.218V38.9714ZM203.609 37.9543V37.2914H204.103C204.368 37.2914 204.517 37.4057 204.517 37.6229C204.517 37.8171 204.368 37.9543 204.103 37.9543H203.609Z"/>
638
- </svg>`],[u4[1],`<svg viewBox="0 0 43 60">
638
+ </svg>`],[M4[1],`<svg viewBox="0 0 43 60">
639
639
  <path d="M14.0291 7.06645C14.0291 10.9691 10.8885 14.1329 7.01453 14.1329C3.14051 14.1329 0 10.9691 0 7.06645C0 3.16376 3.14051 0 7.01453 0C10.8885 0 14.0291 3.16376 14.0291 7.06645Z"/>
640
640
  <path d="M28.7335 18.3468H35.1045C36.7455 18.3468 37.5178 19.0599 37.5821 20.6158V57.7309C37.5821 59.2868 36.8099 60 35.1367 60H28.9588C27.1569 60 26.642 59.7406 25.6767 58.282L12.6452 38.282V57.7309C12.6452 59.2868 11.8729 60 10.1997 60H3.82873C2.15554 60 1.3833 59.2868 1.3833 57.7309V20.6158C1.3833 19.0599 2.15554 18.3468 3.82873 18.3468H10.1032C11.9051 18.4116 12.4843 18.671 13.3852 20.0648L26.3524 40.162V20.6158C26.3524 19.0599 27.1247 18.3468 28.7335 18.3468Z"/>
641
641
  <path d="M41.5 60C42.3362 60 43 59.3143 43 58.5V58.4914C43 57.6771 42.3448 57 41.5 57C40.6638 57 40 57.6857 40 58.5V58.5086C40 59.3229 40.6552 60 41.5 60ZM41.5 59.8371C40.7414 59.8371 40.1724 59.2371 40.1724 58.5086V58.5C40.1724 57.7714 40.75 57.1629 41.5 57.1629C42.2586 57.1629 42.8276 57.7629 42.8276 58.4914V58.5C42.8276 59.2286 42.25 59.8371 41.5 59.8371ZM40.9138 59.2286H41.2069V58.7057H41.5259L41.8879 59.2286H42.2414L41.8362 58.6543C42.0431 58.5943 42.1897 58.44 42.1897 58.1914C42.1897 57.8743 41.9397 57.7114 41.6034 57.7114H40.9138V59.2286ZM41.2069 58.4657V57.9686H41.5776C41.7759 57.9686 41.8879 58.0543 41.8879 58.2171C41.8879 58.3629 41.7759 58.4657 41.5776 58.4657H41.2069Z"/>
642
- </svg>`]]),ZP=/<svg([^>]*)>/g;function c4(r,t,e,i){let n=WP.get(r);return n?n.replace(ZP,`<svg$1 width="${e}" height="${i}" xmlns="http://www.w3.org/2000/svg" style="fill: ${t};">`):""}l(c4,"getLogoIcon");var p4=!1,fo={padding:16,scale:1,iconOnly:!1,position:"bottom-left",color:"dark",onClick:()=>{window!=null&&window.open("https://www.mappedin.com")}},mo,us,Ce,Wt,nn,or,_r,xe,Be,sm=class sm{constructor(t,e,i,n,o){v(this,"options");P(this,mo,void 0);P(this,us,void 0);P(this,Ce,void 0);P(this,Wt,void 0);P(this,nn,void 0);P(this,or,0);P(this,_r,0);P(this,xe,0);P(this,Be,0);v(this,"dirty",!0);v(this,"getPositionAlignedCanvasCoordinates",(t,e)=>({"top-left":{x:0,y:0},"top-right":{x:t,y:0},"bottom-left":{x:0,y:e},"bottom-right":{x:t,y:e},center:{x:t/2,y:e/2},top:{x:t/2,y:0},bottom:{x:t/2,y:e},left:{x:0,y:e/2},right:{x:t,y:e/2}})[this.options.position]);v(this,"getPositionAlignedPadding",()=>{var i,n,o,a;let t=this.options.padding;if(typeof t=="number")return{"top-left":{x:t,y:t},"top-right":{x:-t,y:t},"bottom-left":{x:t,y:-t},"bottom-right":{x:-t,y:-t},center:{x:0,y:0},top:{x:0,y:t},bottom:{x:0,y:-t},left:{x:t,y:0},right:{x:-t,y:0}}[this.options.position];let e={top:(i=t.top)!=null?i:0,right:(n=t.right)!=null?n:0,bottom:(o=t.bottom)!=null?o:0,left:(a=t.left)!=null?a:0};return{x:e.left-e.right,y:e.top-e.bottom}});var a,u,s,p,f,m;this.options={position:(a=o==null?void 0:o.position)!=null?a:fo.position,padding:(u=o==null?void 0:o.padding)!=null?u:fo.padding,scale:(s=o==null?void 0:o.scale)!=null?s:fo.scale,iconOnly:(p=o==null?void 0:o.iconOnly)!=null?p:fo.iconOnly,color:(f=o==null?void 0:o.color)!=null?f:fo.color,onClick:(m=o==null?void 0:o.onClick)!=null?m:fo.onClick},E(this,us,t),E(this,mo,n),E(this,xe,e),E(this,Be,i)}get color(){return this.options.color==="light"?"white":"#293136"}get iconName(){return this.options.iconOnly?"icon":"horizontal"}get minWidth(){return this.options.iconOnly?a4:75}get defaultWidth(){return this.options.iconOnly?s4:150}get aspectRatio(){return this.options.iconOnly?l4:o4}get icon(){return c4(this.iconName,this.color,c(this,or)*c(this,mo).pixelRatio,c(this,_r)*c(this,mo).pixelRatio)}setSize(t,e){c(this,Wt)&&(c(this,Wt).uniforms.uSize.value.x=t,c(this,Wt).uniforms.uSize.value.y=e)}setXY(t,e){c(this,Wt)&&(c(this,Wt).uniforms.uSize.value.w=t,c(this,Wt).uniforms.uSize.value.z=e)}getPositionAlignedOffset(t,e){return{"top-left":{x:0,y:0},"top-right":{x:-t,y:0},"bottom-left":{x:0,y:-e},"bottom-right":{x:-t,y:-e},center:{x:-(t/2),y:-(e/2)},top:{x:-(t/2),y:0},bottom:{x:-(t/2),y:-e},left:{x:0,y:-(e/2)},right:{x:-t,y:-(e/2)}}[this.options.position]}clampWithWarning(t,e,i,n){return e>=i?(G.warn(`Watermark ${n} does not fit within given space.`),e):t<e||t>i?(G.warn(`Watermark ${n} must be between ${e} and ${i}.`),it.clamp(t,e,i)):t}show(){if(!c(this,Wt)){G.warn("Watermark material is not initialized.");return}c(this,Wt).visible=!0,this.resize(c(this,xe),c(this,Be))}hide(){if(!c(this,Wt)){G.warn("Watermark material is not initialized.");return}c(this,Wt).visible=!1,E(this,nn,void 0)}insertIntoQuadTree(t){c(this,nn)!=null&&typeof this.options.onClick=="function"&&t.insert(c(this,nn))}render(){let t=this.clampWithWarning(this.defaultWidth*this.options.scale,this.minWidth,c(this,xe),"width");E(this,or,t),E(this,_r,c(this,or)/this.aspectRatio),tc.getLoader().load(`data:image/svg+xml;base64,${btoa(this.icon)}`,e=>{if(E(this,Wt,new Eo({uniforms:{uTexture:{value:e},uSize:{value:new zm(0,0,0,0)},uOpacity:{value:.7}},vertexShader:i4,fragmentShader:n4,depthWrite:!1,depthTest:!1,defines:{debug:p4},wireframe:p4,transparent:!0,visible:!0})),c(this,Ce))c(this,Ce).material=c(this,Wt),c(this,Ce).material.needsUpdate=!0;else{let i=new mn(2,2,1,1);E(this,Ce,new Ut(i,c(this,Wt))),c(this,Ce).position.set(0,0,-1),c(this,Ce).frustumCulled=!1,c(this,Ce).renderOrder=999;let n=new Jm(1,1,1),o=new Ut(n,new kr({transparent:!0,opacity:0,depthTest:!1,depthWrite:!1}));o.layers.set(1),c(this,Ce).add(o),c(this,us).add(c(this,Ce))}this.resize(c(this,xe),c(this,Be))})}resize(t,e){E(this,xe,t),E(this,Be,e);let i=this.getPositionAlignedCanvasCoordinates(c(this,xe),c(this,Be)),n=this.getPositionAlignedPadding(),o=this.getPositionAlignedOffset(c(this,or),c(this,_r)),a=this.clampWithWarning(i.x+n.x+o.x,0,c(this,xe)-c(this,or),"x"),u=this.clampWithWarning(i.y+n.y+o.y,0,c(this,Be)-c(this,_r),"y");this.setSize(c(this,or)/c(this,xe),c(this,_r)/c(this,Be)),this.setXY(a/c(this,xe),u/c(this,Be)),E(this,nn,new Dt(a,u,c(this,or),c(this,_r),{entityId:"watermark"}))}update(){this.dirty&&(this.render(),this.dirty=!1)}};mo=new WeakMap,us=new WeakMap,Ce=new WeakMap,Wt=new WeakMap,nn=new WeakMap,or=new WeakMap,_r=new WeakMap,xe=new WeakMap,Be=new WeakMap,l(sm,"WatermarkSystem");var hc=sm;d();var lm=100,um=class um{currentTotalBoundingBox;state;cameraSystem;dirty=!1;constructor(t,e){this.state=t,this.cameraSystem=e}update(){if(this.dirty){this.currentTotalBoundingBox==null&&(this.currentTotalBoundingBox=new Te,this.state.entityScene.children.length===0?this.currentTotalBoundingBox.setFromCenterAndSize(new j(0,0,0),new j(lm*2,lm*2,0)):(this.currentTotalBoundingBox.setFromObject(this.state.entityScene),this.currentTotalBoundingBox.expandByScalar(lm))),this.currentTotalBoundingBox.expandByObject(this.state.entityScene);for(let t of this.state.entity2DMap.values())t.positionDirty===!0&&(this.currentTotalBoundingBox.expandByPoint(t.position),t.positionDirty=!1);this.cameraSystem.panBounds={center:this.currentTotalBoundingBox.getCenter(new j),min:this.currentTotalBoundingBox.min,max:this.currentTotalBoundingBox.max,radius:this.currentTotalBoundingBox.getBoundingSphere(new $m).radius},this.cameraSystem.dirty=!0,this.dirty=!1}}};l(um,"PanBoundsSystem");var dc=um;d();var cm="\xA9 Mappedin",qP="https://info.mappedin.com/feedback",pm=["top-left","top-right","bottom-left","bottom-right"],$P=640,JP=l(()=>`<svg xmlns='http://www.w3.org/2000/svg' width='15' height='15' fill-rule='evenodd' viewBox='0 0 20 20'>
642
+ </svg>`]]),aw=/<svg([^>]*)>/g;function P4(r,t,e,i){let n=ow.get(r);return n?n.replace(aw,`<svg$1 width="${e}" height="${i}" xmlns="http://www.w3.org/2000/svg" style="fill: ${t};">`):""}l(P4,"getLogoIcon");var w4=!1,fo={padding:16,scale:1,iconOnly:!1,position:"bottom-left",color:"dark",onClick:()=>{window!=null&&window.open("https://www.mappedin.com")}},mo,cs,Ce,Wt,nn,or,_r,xe,Be,mm=class mm{constructor(t,e,i,n,o){v(this,"options");P(this,mo,void 0);P(this,cs,void 0);P(this,Ce,void 0);P(this,Wt,void 0);P(this,nn,void 0);P(this,or,0);P(this,_r,0);P(this,xe,0);P(this,Be,0);v(this,"dirty",!0);v(this,"getPositionAlignedCanvasCoordinates",(t,e)=>({"top-left":{x:0,y:0},"top-right":{x:t,y:0},"bottom-left":{x:0,y:e},"bottom-right":{x:t,y:e},center:{x:t/2,y:e/2},top:{x:t/2,y:0},bottom:{x:t/2,y:e},left:{x:0,y:e/2},right:{x:t,y:e/2}})[this.options.position]);v(this,"getPositionAlignedPadding",()=>{var i,n,o,a;let t=this.options.padding;if(typeof t=="number")return{"top-left":{x:t,y:t},"top-right":{x:-t,y:t},"bottom-left":{x:t,y:-t},"bottom-right":{x:-t,y:-t},center:{x:0,y:0},top:{x:0,y:t},bottom:{x:0,y:-t},left:{x:t,y:0},right:{x:-t,y:0}}[this.options.position];let e={top:(i=t.top)!=null?i:0,right:(n=t.right)!=null?n:0,bottom:(o=t.bottom)!=null?o:0,left:(a=t.left)!=null?a:0};return{x:e.left-e.right,y:e.top-e.bottom}});var a,u,s,p,f,m;this.options={position:(a=o==null?void 0:o.position)!=null?a:fo.position,padding:(u=o==null?void 0:o.padding)!=null?u:fo.padding,scale:(s=o==null?void 0:o.scale)!=null?s:fo.scale,iconOnly:(p=o==null?void 0:o.iconOnly)!=null?p:fo.iconOnly,color:(f=o==null?void 0:o.color)!=null?f:fo.color,onClick:(m=o==null?void 0:o.onClick)!=null?m:fo.onClick},E(this,cs,t),E(this,mo,n),E(this,xe,e),E(this,Be,i)}get color(){return this.options.color==="light"?"white":"#293136"}get iconName(){return this.options.iconOnly?"icon":"horizontal"}get minWidth(){return this.options.iconOnly?C4:75}get defaultWidth(){return this.options.iconOnly?x4:150}get aspectRatio(){return this.options.iconOnly?S4:b4}get icon(){return P4(this.iconName,this.color,c(this,or)*c(this,mo).pixelRatio,c(this,_r)*c(this,mo).pixelRatio)}setSize(t,e){c(this,Wt)&&(c(this,Wt).uniforms.uSize.value.x=t,c(this,Wt).uniforms.uSize.value.y=e)}setXY(t,e){c(this,Wt)&&(c(this,Wt).uniforms.uSize.value.w=t,c(this,Wt).uniforms.uSize.value.z=e)}getPositionAlignedOffset(t,e){return{"top-left":{x:0,y:0},"top-right":{x:-t,y:0},"bottom-left":{x:0,y:-e},"bottom-right":{x:-t,y:-e},center:{x:-(t/2),y:-(e/2)},top:{x:-(t/2),y:0},bottom:{x:-(t/2),y:-e},left:{x:0,y:-(e/2)},right:{x:-t,y:-(e/2)}}[this.options.position]}clampWithWarning(t,e,i,n){return e>=i?(G.warn(`Watermark ${n} does not fit within given space.`),e):t<e||t>i?(G.warn(`Watermark ${n} must be between ${e} and ${i}.`),it.clamp(t,e,i)):t}show(){if(!c(this,Wt)){G.warn("Watermark material is not initialized.");return}c(this,Wt).visible=!0,this.resize(c(this,xe),c(this,Be))}hide(){if(!c(this,Wt)){G.warn("Watermark material is not initialized.");return}c(this,Wt).visible=!1,E(this,nn,void 0)}insertIntoQuadTree(t){c(this,nn)!=null&&typeof this.options.onClick=="function"&&t.insert(c(this,nn))}render(){let t=this.clampWithWarning(this.defaultWidth*this.options.scale,this.minWidth,c(this,xe),"width");E(this,or,t),E(this,_r,c(this,or)/this.aspectRatio),sc.getLoader().load(`data:image/svg+xml;base64,${btoa(this.icon)}`,e=>{if(E(this,Wt,new Eo({uniforms:{uTexture:{value:e},uSize:{value:new r1(0,0,0,0)},uOpacity:{value:.7}},vertexShader:g4,fragmentShader:v4,depthWrite:!1,depthTest:!1,defines:{debug:w4},wireframe:w4,transparent:!0,visible:!0})),c(this,Ce))c(this,Ce).material=c(this,Wt),c(this,Ce).material.needsUpdate=!0;else{let i=new mn(2,2,1,1);E(this,Ce,new Zt(i,c(this,Wt))),c(this,Ce).position.set(0,0,-1),c(this,Ce).frustumCulled=!1,c(this,Ce).renderOrder=999;let n=new o1(1,1,1),o=new Zt(n,new Nr({transparent:!0,opacity:0,depthTest:!1,depthWrite:!1}));o.layers.set(1),c(this,Ce).add(o),c(this,cs).add(c(this,Ce))}this.resize(c(this,xe),c(this,Be))})}resize(t,e){E(this,xe,t),E(this,Be,e);let i=this.getPositionAlignedCanvasCoordinates(c(this,xe),c(this,Be)),n=this.getPositionAlignedPadding(),o=this.getPositionAlignedOffset(c(this,or),c(this,_r)),a=this.clampWithWarning(i.x+n.x+o.x,0,c(this,xe)-c(this,or),"x"),u=this.clampWithWarning(i.y+n.y+o.y,0,c(this,Be)-c(this,_r),"y");this.setSize(c(this,or)/c(this,xe),c(this,_r)/c(this,Be)),this.setXY(a/c(this,xe),u/c(this,Be)),E(this,nn,new Dt(a,u,c(this,or),c(this,_r),{entityId:"watermark"}))}update(){this.dirty&&(this.render(),this.dirty=!1)}};mo=new WeakMap,cs=new WeakMap,Ce=new WeakMap,Wt=new WeakMap,nn=new WeakMap,or=new WeakMap,_r=new WeakMap,xe=new WeakMap,Be=new WeakMap,l(mm,"WatermarkSystem");var bc=mm;d();var ym=100,gm=class gm{currentTotalBoundingBox;state;cameraSystem;dirty=!1;constructor(t,e){this.state=t,this.cameraSystem=e}update(){if(this.dirty){this.currentTotalBoundingBox==null&&(this.currentTotalBoundingBox=new we,this.state.entityScene.children.length===0?this.currentTotalBoundingBox.setFromCenterAndSize(new W(0,0,0),new W(ym*2,ym*2,0)):(this.currentTotalBoundingBox.setFromObject(this.state.entityScene),this.currentTotalBoundingBox.expandByScalar(ym))),this.currentTotalBoundingBox.expandByObject(this.state.entityScene);for(let t of this.state.entity2DMap.values())t.positionDirty===!0&&(this.currentTotalBoundingBox.expandByPoint(t.position),t.positionDirty=!1);this.cameraSystem.panBounds={center:this.currentTotalBoundingBox.getCenter(new W),min:this.currentTotalBoundingBox.min,max:this.currentTotalBoundingBox.max,radius:this.currentTotalBoundingBox.getBoundingSphere(new n1).radius},this.cameraSystem.dirty=!0,this.dirty=!1}}};l(gm,"PanBoundsSystem");var Cc=gm;d();var vm="\xA9 Mappedin",uw="https://info.mappedin.com/feedback",bm=["top-left","top-right","bottom-left","bottom-right"],cw=640,pw=l(()=>`<svg xmlns='http://www.w3.org/2000/svg' width='15' height='15' fill-rule='evenodd' viewBox='0 0 20 20'>
643
643
  <circle cx='10' cy='10' r='5.9' style='fill:rgba(255,255,255,1);'/>
644
644
  <path style='fill:rgba(0,0,0,0.7);' d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/>
645
- </svg>`,"getAttributionButtonIcon"),h4={position:"bottom-right"},hm=class hm{controlContainerEl;controlPositions;compact=void 0;attribContainerEl;attribInnerEl;attribButtonEl;feedbackLinkEl;attribHTML=cm;constructor(t){this.controlContainerEl=document.createElement("div"),this.controlContainerEl.classList.add("mappedin-control-container"),t.appendChild(this.controlContainerEl),this.controlPositions=pm.reduce((e,i)=>{let n=document.createElement("div");return n.classList.add(`mappedin-ctrl-${i}`),this.controlContainerEl.appendChild(n),e[i]=n,e},{})}addAttributionControl(t=h4){let e=pm.includes(t.position)?t.position:h4.position;this.attribContainerEl=document.createElement("details"),this.attribContainerEl.classList.add("mappedin-ctrl-attrib",`mappedin-ctrl-attrib-${e}`),this.attribContainerEl.open=!0,this.attribContainerEl.tabIndex=0,this.attribContainerEl.ariaLabel="Attribution",this.controlPositions[e].appendChild(this.attribContainerEl),this.attribButtonEl=document.createElement("summary"),this.attribButtonEl.addEventListener("click",this.toggleAttribution),this.attribButtonEl.classList.add("mappedin-ctrl-attrib-button"),this.attribButtonEl.title="Toggle attribution",this.attribButtonEl.ariaLabel="Toggle attribution",this.attribButtonEl.tabIndex=0,this.attribButtonEl.innerHTML=JP(),this.attribContainerEl.appendChild(this.attribButtonEl),this.attribInnerEl=document.createElement("div"),this.attribInnerEl.classList.add("mappedin-ctrl-attrib-inner"),this.attribInnerEl.innerHTML=cm,this.attribContainerEl.appendChild(this.attribInnerEl),this.feedbackLinkEl=document.createElement("a"),this.feedbackLinkEl.href=qP,this.feedbackLinkEl.target="_blank",this.feedbackLinkEl.rel="nofollow noopener noreferrer",this.feedbackLinkEl.textContent="Provide Feedback",this.feedbackLinkEl.classList.add("mappedin-ctrl-attrib-inner"),this.feedbackLinkEl.classList.add("mappedin-ctrl-attrib-inner-bold"),this.attribContainerEl.appendChild(this.feedbackLinkEl)}toggleAttribution=t=>{this.attribContainerEl!=null&&(t.preventDefault(),this.attribContainerEl.classList.contains("mappedin-compact")&&(this.attribContainerEl.classList.contains("mappedin-compact-show")?(this.attribContainerEl.removeAttribute("open"),this.attribContainerEl.classList.remove("mappedin-compact-show")):(this.attribContainerEl.classList.add("mappedin-compact-show"),this.attribContainerEl.setAttribute("open",""))))};updateAttribution(t){if(!t.style||!this.attribInnerEl||!this.attribContainerEl)return;let e=[cm],i=t.style.sourceCaches;for(let o in i){let a=i[o];if(a.used||a.usedForTerrain){let u=a.getSource();u.attribution&&e.indexOf(u.attribution)<0&&e.push(u.attribution)}}e=e.filter(o=>String(o).trim()),e.sort((o,a)=>o.length-a.length),e=e.filter((o,a)=>{for(let u=a+1;u<e.length;u++)if(e[u].indexOf(o)>=0)return!1;return!0});let n=e.join(" ");n!==this.attribHTML&&(this.attribHTML=n,e.length?(this.attribInnerEl.innerHTML=this.attribHTML,this.attribContainerEl.classList.remove("outdoor-attrib-empty")):this.attribContainerEl.classList.add("mappedin-attrib-empty"),this.resizeAttribution(t.getCanvasContainer().offsetWidth))}resizeAttribution(t){this.attribContainerEl&&(t<=$P||this.compact?this.compact===!1?this.attribContainerEl.setAttribute("open",""):!this.attribContainerEl.classList.contains("mappedin-compact")&&!this.attribContainerEl.classList.contains("mappedin-attrib-empty")&&(this.attribContainerEl.setAttribute("open",""),this.attribContainerEl.classList.add("mappedin-compact","mappedin-compact-show")):(this.attribContainerEl.setAttribute("open",""),this.attribContainerEl.classList.contains("mappedin-compact")&&this.attribContainerEl.classList.remove("mappedin-compact","mappedin-compact-show")))}destroyAttributionControl(){this.attribButtonEl&&this.attribButtonEl.removeEventListener("click",this.toggleAttribution),this.attribContainerEl&&(this.attribContainerEl.remove(),this.attribContainerEl=void 0,this.attribInnerEl=void 0,this.attribButtonEl=void 0)}resize(t){this.resizeAttribution(t)}updateData(t){this.updateAttribution(t)}destroy(){this.destroyAttributionControl(),this.controlContainerEl.remove(),this.compact=void 0}};l(hm,"HTMLControlsSystem");var fc=hm;d();var cs,dm=class dm{constructor(t,e){v(this,"mesh");v(this,"type","custom-geometry");v(this,"dirty",!0);v(this,"feature");v(this,"builder");v(this,"outline");v(this,"color",new wt);P(this,cs,0);this.mesh=new Qe,this.feature=t,this.builder=e}get visible(){return this.mesh.visible}set visible(t){this.mesh.visible=t}setOpacity(){}setColor(){}get position(){var t;return(t=this.mesh)==null?void 0:t.position}get altitude(){return c(this,cs)}set altitude(t){this.mesh&&(this.mesh.position.z=t,E(this,cs,t))}};cs=new WeakMap,l(dm,"CustomGeometryComponent");var yo=dm;d();var fm=class fm{state;constructor(t){this.state=t}update(){let t,e;for(let i of this.state.threeDEntities){let n=this.state.entity3DMap.get(i);(n==null?void 0:n.type)==="custom-geometry"&&(t=n.components[0],e=n.components[1],t.dirty&&e.visible!==!1&&(t.builder.setup(t.mesh),t.mesh.traverse(o=>{o.userData={entityId:i,type:"custom-geometry"}}),t.dirty=!1),e.visible!==!1&&t.builder.update(t.mesh))}}};l(fm,"CustomGeometrySystem");var mc=fm;d();var mm=class mm{rendererState;dirty=!0;geometries3DDirty=!0;constructor(t){this.rendererState=t}update(t,e=!1){var o,a;let i=e&&t>=16&&t<=19,n;if(this.geometries3DDirty){for(let u of this.rendererState.threeDEntities)if(n=this.rendererState.entity3DMap.get(u),n&&n.type==="geometry-group"&&n.userData.modelURL===void 0&&n.userData.dirty===!1&&n.userData.outlineDirty===!0){let s=n.children[0];n.userData.outlineDirty=!1;let p=m4(n);if(p&&((o=n.parent)==null||o.remove(p),p.geometry.dispose()),!n.components[0].outline||!n.visible)continue;if(n.children.length>0){let f;if(s instanceof ao){let y=[],x,S,M,g;for(let C of n.userData.entities3D)g=this.rendererState.entity3DMap.get(C),g instanceof dt&&(S=g.components[0],M=g.components[1],S instanceof Jt&&M.visible&&M.outline&&(x=S==null?void 0:S.geometry,x&&y.push(x)));if(y.length===0||(f=je(y),!f))continue}else f=s.geometry;let m=kb(f,s.material);m.userData.outlineOfEntityId=n.userData.entityId;for(let y of n.userData.entities3D.values()){let x=this.rendererState.entity3DMap.get(y);(x==null?void 0:x.type)==="geometry"&&(x.components[0].outline=m)}(a=n.parent)==null||a.add(m)}this.dirty=!0}this.geometries3DDirty=!1}if((i||this.dirty)&&this.rendererState.threeDEntities.length>0){let u=pe(t,16,19,0,1),s;for(let p of this.rendererState.threeDEntities)if(s=this.rendererState.entity3DMap.get(p),(s==null?void 0:s.type)==="geometry-group"&&s.components[0]!=null&&s.components[0].outline&&s.visible){let f=m4(s);if(f&&f.visible){let m=Array.isArray(f.material)?f.material:[f.material];for(let y of m)y.opacity=u}}}this.dirty=!1}};l(mm,"OutlineInterpolationSystem");var yc=mm;function m4(r){var e;let t=(e=r.parent)==null?void 0:e.children.find(i=>i.userData.outlineOfEntityId===r.userData.entityId);return t instanceof yi?t:void 0}l(m4,"findOutline");d();var ym=class ym{dirty=!0;map;stylesheetId="";userHiddenLayers=new Set;hiddenLayersInStyle=new Set;centerPoint;hideLayersUnderPoint(t,e){this.centerPoint=t;for(let i of e)this.userHiddenLayers.add(i);this.dirty=!0,this.filterStylesInMap(),this.handleRender()}constructor(t){t&&(this.map=t,this.map.on("styledata",this.handleStyleChange),this.map.on("render",this.handleRender))}filterStylesInMap(){if(this.hiddenLayersInStyle=new Set,this.map)for(let t of this.userHiddenLayers)this.map.getLayer(t)&&this.hiddenLayersInStyle.add(t)}handleRender=async()=>{if(!this.map||!this.dirty||!this.hiddenLayersInStyle||this.hiddenLayersInStyle.size===0)return;let t=[],e=this.map.project(this.centerPoint),i=this.map.queryRenderedFeatures(e,{layers:Array.from(this.hiddenLayersInStyle)});for(var n of i)t.push(["!=",["id"],n.id]);t.length>0&&(this.hiddenLayersInStyle.forEach(o=>{this.map.setFilter(o,["all",...t])}),this.dirty=!1)};handleStyleChange=t=>{var e,i;if(this.map&&t&&t.dataType==="style"&&t.type==="styledata"&&this.userHiddenLayers.size>0){let n=(i=(e=t==null?void 0:t.style)==null?void 0:e.stylesheet)==null?void 0:i.id;(!n||n!==this.stylesheetId)&&(this.stylesheetId=n,this.filterStylesInMap(),this.dirty=!0)}};destroy(){this.map&&(this.map.off("styledata",this.handleStyleChange),this.map.off("render",this.handleRender))}};l(ym,"OutdoorLayers");var gc=ym;d();d();d();var gm=`attribute float pathDistance;
645
+ </svg>`,"getAttributionButtonIcon"),T4={position:"bottom-right"},Cm=class Cm{controlContainerEl;controlPositions;compact=void 0;attribContainerEl;attribInnerEl;attribButtonEl;feedbackLinkEl;attribHTML=vm;constructor(t){this.controlContainerEl=document.createElement("div"),this.controlContainerEl.classList.add("mappedin-control-container"),t.appendChild(this.controlContainerEl),this.controlPositions=bm.reduce((e,i)=>{let n=document.createElement("div");return n.classList.add(`mappedin-ctrl-${i}`),this.controlContainerEl.appendChild(n),e[i]=n,e},{})}addAttributionControl(t=T4){let e=bm.includes(t.position)?t.position:T4.position;this.attribContainerEl=document.createElement("details"),this.attribContainerEl.classList.add("mappedin-ctrl-attrib",`mappedin-ctrl-attrib-${e}`),this.attribContainerEl.open=!0,this.attribContainerEl.tabIndex=0,this.attribContainerEl.ariaLabel="Attribution",this.controlPositions[e].appendChild(this.attribContainerEl),this.attribButtonEl=document.createElement("summary"),this.attribButtonEl.addEventListener("click",this.toggleAttribution),this.attribButtonEl.classList.add("mappedin-ctrl-attrib-button"),this.attribButtonEl.title="Toggle attribution",this.attribButtonEl.ariaLabel="Toggle attribution",this.attribButtonEl.tabIndex=0,this.attribButtonEl.innerHTML=pw(),this.attribContainerEl.appendChild(this.attribButtonEl),this.attribInnerEl=document.createElement("div"),this.attribInnerEl.classList.add("mappedin-ctrl-attrib-inner"),this.attribInnerEl.innerHTML=vm,this.attribContainerEl.appendChild(this.attribInnerEl),this.feedbackLinkEl=document.createElement("a"),this.feedbackLinkEl.href=uw,this.feedbackLinkEl.target="_blank",this.feedbackLinkEl.rel="nofollow noopener noreferrer",this.feedbackLinkEl.textContent="Provide Feedback",this.feedbackLinkEl.classList.add("mappedin-ctrl-attrib-inner"),this.feedbackLinkEl.classList.add("mappedin-ctrl-attrib-inner-bold"),this.attribContainerEl.appendChild(this.feedbackLinkEl)}toggleAttribution=t=>{this.attribContainerEl!=null&&(t.preventDefault(),this.attribContainerEl.classList.contains("mappedin-compact")&&(this.attribContainerEl.classList.contains("mappedin-compact-show")?(this.attribContainerEl.removeAttribute("open"),this.attribContainerEl.classList.remove("mappedin-compact-show")):(this.attribContainerEl.classList.add("mappedin-compact-show"),this.attribContainerEl.setAttribute("open",""))))};updateAttribution(t){if(!t.style||!this.attribInnerEl||!this.attribContainerEl)return;let e=[vm],i=t.style.sourceCaches;for(let o in i){let a=i[o];if(a.used||a.usedForTerrain){let u=a.getSource();u.attribution&&e.indexOf(u.attribution)<0&&e.push(u.attribution)}}e=e.filter(o=>String(o).trim()),e.sort((o,a)=>o.length-a.length),e=e.filter((o,a)=>{for(let u=a+1;u<e.length;u++)if(e[u].indexOf(o)>=0)return!1;return!0});let n=e.join(" ");n!==this.attribHTML&&(this.attribHTML=n,e.length?(this.attribInnerEl.innerHTML=this.attribHTML,this.attribContainerEl.classList.remove("outdoor-attrib-empty")):this.attribContainerEl.classList.add("mappedin-attrib-empty"),this.resizeAttribution(t.getCanvasContainer().offsetWidth))}resizeAttribution(t){this.attribContainerEl&&(t<=cw||this.compact?this.compact===!1?this.attribContainerEl.setAttribute("open",""):!this.attribContainerEl.classList.contains("mappedin-compact")&&!this.attribContainerEl.classList.contains("mappedin-attrib-empty")&&(this.attribContainerEl.setAttribute("open",""),this.attribContainerEl.classList.add("mappedin-compact","mappedin-compact-show")):(this.attribContainerEl.setAttribute("open",""),this.attribContainerEl.classList.contains("mappedin-compact")&&this.attribContainerEl.classList.remove("mappedin-compact","mappedin-compact-show")))}destroyAttributionControl(){this.attribButtonEl&&this.attribButtonEl.removeEventListener("click",this.toggleAttribution),this.attribContainerEl&&(this.attribContainerEl.remove(),this.attribContainerEl=void 0,this.attribInnerEl=void 0,this.attribButtonEl=void 0)}resize(t){this.resizeAttribution(t)}updateData(t){this.updateAttribution(t)}destroy(){this.destroyAttributionControl(),this.controlContainerEl.remove(),this.compact=void 0}};l(Cm,"HTMLControlsSystem");var xc=Cm;d();var ps,xm=class xm{constructor(t,e){v(this,"mesh");v(this,"type","custom-geometry");v(this,"dirty",!0);v(this,"feature");v(this,"builder");v(this,"outline");v(this,"color",new Tt);P(this,ps,0);this.mesh=new Qe,this.feature=t,this.builder=e}get visible(){return this.mesh.visible}set visible(t){this.mesh.visible=t}setOpacity(){}setColor(){}get position(){var t;return(t=this.mesh)==null?void 0:t.position}get altitude(){return c(this,ps)}set altitude(t){this.mesh&&(this.mesh.position.z=t,E(this,ps,t))}};ps=new WeakMap,l(xm,"CustomGeometryComponent");var yo=xm;d();var Sm=class Sm{state;constructor(t){this.state=t}update(){let t,e;for(let i of this.state.threeDEntities){let n=this.state.entity3DMap.get(i);(n==null?void 0:n.type)==="custom-geometry"&&(t=n.components[0],e=n.components[1],t.dirty&&e.visible!==!1&&(t.builder.setup(t.mesh),t.mesh.traverse(o=>{o.userData={entityId:i,type:"custom-geometry"}}),t.dirty=!1),e.visible!==!1&&t.builder.update(t.mesh))}}};l(Sm,"CustomGeometrySystem");var Sc=Sm;d();var Mm=class Mm{rendererState;dirty=!0;geometries3DDirty=!0;constructor(t){this.rendererState=t}update(t,e=!1){var o,a;let i=e&&t>=16&&t<=19,n;if(this.geometries3DDirty){for(let u of this.rendererState.threeDEntities)if(n=this.rendererState.entity3DMap.get(u),n&&n.type==="geometry-group"&&n.userData.modelURL===void 0&&n.userData.dirty===!1&&n.userData.outlineDirty===!0){let s=n.children[0];n.userData.outlineDirty=!1;let p=L4(n);if(p&&((o=n.parent)==null||o.remove(p),p.geometry.dispose()),!n.components[0].outline||!n.visible)continue;if(n.children.length>0){let f;if(s instanceof ao){let y=[],x,S,M,g;for(let C of n.userData.entities3D)g=this.rendererState.entity3DMap.get(C),g instanceof dt&&(S=g.components[0],M=g.components[1],S instanceof Jt&&M.visible&&M.outline&&(x=S==null?void 0:S.geometry,x&&y.push(x)));if(y.length===0||(f=je(y),!f))continue}else f=s.geometry;let m=zb(f,s.material);m.userData.outlineOfEntityId=n.userData.entityId;for(let y of n.userData.entities3D.values()){let x=this.rendererState.entity3DMap.get(y);(x==null?void 0:x.type)==="geometry"&&(x.components[0].outline=m)}(a=n.parent)==null||a.add(m)}this.dirty=!0}this.geometries3DDirty=!1}if((i||this.dirty)&&this.rendererState.threeDEntities.length>0){let u=pe(t,16,19,0,1),s;for(let p of this.rendererState.threeDEntities)if(s=this.rendererState.entity3DMap.get(p),(s==null?void 0:s.type)==="geometry-group"&&s.components[0]!=null&&s.components[0].outline&&s.visible){let f=L4(s);if(f&&f.visible){let m=Array.isArray(f.material)?f.material:[f.material];for(let y of m)y.opacity=u}}}this.dirty=!1}};l(Mm,"OutlineInterpolationSystem");var Mc=Mm;function L4(r){var e;let t=(e=r.parent)==null?void 0:e.children.find(i=>i.userData.outlineOfEntityId===r.userData.entityId);return t instanceof yi?t:void 0}l(L4,"findOutline");d();var Pm=class Pm{dirty=!0;map;stylesheetId="";userHiddenLayers=new Set;hiddenLayersInStyle=new Set;centerPoint;hideLayersUnderPoint(t,e){this.centerPoint=t;for(let i of e)this.userHiddenLayers.add(i);this.dirty=!0,this.filterStylesInMap(),this.handleRender()}constructor(t){t&&(this.map=t,this.map.on("styledata",this.handleStyleChange),this.map.on("render",this.handleRender))}filterStylesInMap(){if(this.hiddenLayersInStyle=new Set,this.map)for(let t of this.userHiddenLayers)this.map.getLayer(t)&&this.hiddenLayersInStyle.add(t)}handleRender=async()=>{if(!this.map||!this.dirty||!this.hiddenLayersInStyle||this.hiddenLayersInStyle.size===0)return;let t=[],e=this.map.project(this.centerPoint),i=this.map.queryRenderedFeatures(e,{layers:Array.from(this.hiddenLayersInStyle)});for(var n of i)t.push(["!=",["id"],n.id]);t.length>0&&(this.hiddenLayersInStyle.forEach(o=>{this.map.setFilter(o,["all",...t])}),this.dirty=!1)};handleStyleChange=t=>{var e,i;if(this.map&&t&&t.dataType==="style"&&t.type==="styledata"&&this.userHiddenLayers.size>0){let n=(i=(e=t==null?void 0:t.style)==null?void 0:e.stylesheet)==null?void 0:i.id;(!n||n!==this.stylesheetId)&&(this.stylesheetId=n,this.filterStylesInMap(),this.dirty=!0)}};destroy(){this.map&&(this.map.off("styledata",this.handleStyleChange),this.map.off("render",this.handleRender))}};l(Pm,"OutdoorLayers");var Pc=Pm;d();d();d();var wm=`attribute float pathDistance;
646
646
  attribute vec3 pathNormal;
647
647
  attribute vec3 pathTangent;
648
648
 
@@ -726,7 +726,7 @@ void main() {
726
726
 
727
727
  radius = mix(nearRadius, farRadius, zoomLevel);
728
728
  }
729
- `;var vm=`#define ARROW_FADING_POINT 0.15
729
+ `;var Tm=`#define ARROW_FADING_POINT 0.15
730
730
 
731
731
  uniform float complete;
732
732
  uniform float nearRadius;
@@ -947,4 +947,4 @@ void main(void) {
947
947
  gl_FragColor = vec4(color, opacity * opacityMultiplier);
948
948
  }
949
949
  #include <colorspace_fragment>
950
- }`;var y4="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAAAAAB5Gfe6AAAQkHpUWHRSYXcgcHJvZmlsZSB0eXBlIGV4aWYAAHjarZpZciQ7rkT/uYpeAicQ5HI4mr0dvOX3ATOl0li3q3SVJkUqFMEBcHc4IuX2///fcf/hK7cSXRatpZXi+cott9h5U/3j63EMPt+fL1/h+fPdeff6NnJMHNPjD2U/7+qcl183aH6eH+/PO52PN7E+B3qZ+Tlgspkjb57X1edAKT7Oh+fvrj3v6/nNdp7ftd057abHnz78npVgLGG8FF3cKSTPz2oXJFaQWuocCz9D0mhnEu8Tx54k6dexc98F77vY+f48n96HwvnyvKB8iNHzfJCvY3cj9HZF4dfM7/6QZ4j+7deb2J2z6jn7sbueC5Eq7rmpl63cd1w4GCrd2wov5Vt4r/fVeFW2OMnYIpuD13ShhUi0T8hhhR5O2Pc4w2SJOe5IuGOMM6Z7rhL+FudNSrZXOFFJz3KpkqtJ1hKn4+tawp233flmqMy8AlfGwGCBOz693Fcn/+b1OtA5Bt0QfH2NFeuKFnCWYZmzn1xFQsJ5xlRufO/LvcGNf5PYRAblhrmywe7HY4gh4Re20s1z4jrx2fkHNYKu5wCEiLmFxYREBnwJSUIJXmPUEIhjJT+dlceU4yADQSSu4A65SamQnBptbu7RcK+NEh+nkRYSIZBGSQ0EIlk5C/jRXMFQlyTZiUgRlSpNekklFymlaDGN6po0q2hR1apNe001V6mlaq211d5iS0iYtNLUtdpa651JO0N37u5c0fuII408ZJSho442+gQ+M0+ZZeqss82+4koL+q+y1K262uo7bKC085Zdtu662+4HrJ108pFTjp562umvWXtm9X3WwofM/T5r4Zk1y1i+1+mvrHFa9WWIYHIiljMyFnMg42oZANDRcuZryDla5ixnvkVIIZGsBbHkrGAZI4N5hygnvObuV+Z+mzcn+Y/yFr/LnLPU/RuZc5a6Z+Y+5+2LrK1+K0q6CTIWWkx9OggbF+zaY+1Wk/766H46wF8ONFY+O8hBMEc7oc4Vdh+8JsE+PUSrVjr70Zz1+H56PH3o9sRR1ql5Ha8bUMQxpe89Tki8Sb0tE23cw3DcfEo+ugnj2G3WEmononVfoag71pVjR+EmAE53eT5tqYfEHl/7ThMusaI+St0jktFa9gKnreiQqCNpZ2mJdSkbaiK6DrovYR4/JhJfRsx5d5EVZnEIPetHnU5KynJPTSuCPuC0lOuXH7n1DNq7DpUtHbhM5lDA0c2bnDCJoOObMnyj+aPjPwx0yiDUxKKsg35VnRnBEVhonKwK5hOk5NttUrhr2+tMOXkPJb1RZ+iAelYjL2MuO3pGRQ78GdxwOOaTAcJZcewq7ilB1RJCSozUdSEdwVJVb6asiBsHH1Bqgbiv3Cmkkis6ktVnZGRRwMNJjUA3Ao2127YWdhAIblxF51hzMcZsVZc0r0dJo5Liqfn41Q+q193SGhhkMkgaLJRNnEpqBtyVvbcVffIk+LE9QPFBTMTQe0aWkMXMnx3dy5sfHreDE60Ql50E+SqRcmfK16L2p0Ol8JFATu3qASXy7SvmiGW2cdMBxsty44CvtLogfGlv7WkCSV0WId2270EaD5Ym40cs+SAwZuNjPSTywAvEfLmzQhtLDntfCnhl/fNmUNnzyA2g76Zn0SP+c+I6bCC0FONUQ4L50e95dif+DH/m9htQjBEhPPpOjYjmm2ChbfEMIUaYtAIxmWJHlilLU8ZRs9pCsHbDpFaRgZljz2QandjDIBPZDGTuoZW1KdlYh52ALzisKJRNWSQmLAWx8iv9mGttT15bBc2oxd57bZtVF98CYtK3UH22Yd/A7WaKa+ZjNTOXEzNhMJ5kmQOvfzsbxbZALJ2xwGBjX2HFQybhi7kpbA7DVpS3RxMJwFyHwGk5gs6a4lrRHVqhYT0QTJC9UZcC9Yrelkn6yXch68NKNtG7CiU3vf/zMZAYXPWdrR9XZ/ctMV1sJQ2wJEGxzaHs7LmmHIwnUwbwnNAapBY9xhE19DNJW3ua0dDk/AjwITacR0PqZxkbyJ+E5jYbxI84x1TBE+y90hwDCYZIM0tqAKPZfCzFrbH8kYCm3eqQkZ2+2GovcL8Suokyg8yyCJes6dcouSLiNSLb0ETJU+/N/WFsBBSOXBbm9Cwp4CzlOag7ro7R2vC19nSsCPmAjIEMiobFwaoVXhjTU2XMpgEsDH/L3Sx54OCTMUSXI/IIA2V4QcLQpwVz12pInI0bY56pIQ2BSGRLL+yLfZ7JkiimbK+aepsbwRStpokx5gCqe1hjdMAwcINbkk5jmedrNRAG5pUXPe0sZIoXy1h7lSDxApzheg24JeDNtDS1oBDBUC4iWZFilBPhZx0Kqx2lihpbG9q4sYidksCN4yRYhNM4nxfBbTi4E3AT6B3igbvs9Gv8ZkHsIfdlep+2HelEDbkJdNjqZQ90B7k6OIoFfkkPNoY+z0gzACa1f2qcBYxVJpT2QQgS19dKQlbC24S92xiEAFRKB5Uy1qrBgOtwIge55G0kRPfIytGx0tMOrGfrijB2FHOk/TKcMjDTMPeBo4FnXD5cQ8vtdgoAN0yuzZQHQI09wm/5vAB6RHyI9rYKiZ6YWC6rbaiLmDtoaToC1bViXQFNtgWsOfEEKCleC3GWPSfgQWRQWMgw/9FDgvOZrFAT3SmsA3DLbqlsSppQG5QeOjPXavUUkxF/qgLM05vW5o7UakuBqo2ZW8Nj0LB7imVJC9QSA+wd7RPztIUZ80xQZq0ROrc8CSVncWzkTA/RwmunldCPAQKjqVC7bhRuTIv0plbk7gOX4m5OAi2YesYZ0KBQRToG8iv9x8dgGtgECYRBeEU87OxoSc8epu+s7Mq/MN0VbBT19dii7ekO66UZwdAMtoAVQd13J5nwZe98OgGslmVqAGBkeLZNVNVlWpV18qihntXKnBZvrDIVgFpx4q5poLqREOVplMPSpTF2KvjBAzDpprkruXIaaUmUD4Xo2yrGWcYlixKIwRFjl0jPQhKznUXZAoSjlg9c/NwAI4p3Q/w5bCNfhUZS7bGfqesHqKAlyZZxZgNrhGevZXccaqBys4NEqB3Vqfptji9uUrhCL6yXFqxtm0hhLyYU3Tjd8I/HZaWD1oyVjnG5hhpCN5yHSf8BQUZlVNd00OP4M0TK+JSM7iqWi01SinFkCQXWxiZJLqqAHiEt3G3I2WYd46KU9pIJIOkoRQYCcEAAPguHo0Y4k8Hl6SW50MoW0uZU8jJOUghKo38Nl5ZSwsJNAUC2/lFZWkfMjrU8dFrTjHpJnUrLCILQIxINiYdQlDXaE/razQ4jjQluN5jW1Eh/S7yYvI5gigSjdLYU9TiFXAcHjISiLhQd9obb3OQmwY+YqVwiBMCkOGLXaK/ljBShh56c1g0uyIb2lBRKO7ZTAFncw5c5UGjGSy3CsI1Jt2mtruZkfhBZmbR+842Yu1eDiWEl0V6LZcGem6Ct+LW4Wy3oAjyNObazKBHomhJ3HMKEKHgiGksH+Ig1nTidfNMyA+oYHqVFaRGLiQreVLc9GvQgftKjW9cfUSKNYL80rqU7Um2rwqQJR1ai31Wq7vzKJEsFHDj0bAEMUKXgvfD5bWbaLPBTKz1Nk/Fg+GUZvUzFw80CLaKtPAACVAWrismh863FU4IJ0716SXBUNVb/SDMVvZgDt34CXoOq1JKvg0n08gPHTwXBNgD5W8pZZ8E9EVWcv1DZMB2NFysIwkqBSaH5QRmsAHdkHB+UANvLJvFpQKAahSmYTLEd2AFO+5rsqRRU6sVv5IP0wsSPLcWsbC1Y95mte71CUm6RJJWwkg6Q4k+xWMM0ByElJPQ6j2ED5hY42ALpZRytx9RlgQlJLijzhKi5eX5JBSIRGfo9o2xhd/0aWku8OS+4D9ZnovHDQMPaYo4qm2mlZbUnd7pR6oQj29Z2BqJ9n3LRT+MTLu3IR+ZP2TCPh3EDw8H1NHpoT7FibNYU8WHd9ESHcY12aDOQCUBddi4Ucp+4yuzz8ybcCCu1h8zvzXhDN4HYLq1R+U0xzUqg5QSA3iSBgdDouy55Ifx0DaeEhgezxBRGmoEJ6AJitVuzwtKPlUskHgU2F0LS7AFIwW5jPu0RUL7sp+fkNk0ee8P6uXYgl40WM+cdCOW21r13e0ivt0ff/mYcUfrQZWs2BiN6G+MDTGz1BKORmUTNQp9YGSHFxAeTkQrKd6FoVUogyytW25OLy3OpaO5oZCQp46aPzb5LnJiFEIwAKkmbYVYIjzVv3vj7rA6HignEeQAXTAHKDhoD7Uujh0QjtsB6fTP1NzO7T1Nzq4F1GnfHdXCG1Yxjwdtjf+PGRGTzEtEAUCz7KLfTdItLwCXuSOAzVjaZB6LvbUZhYGWmifSZlcMDnGHPd6gPeiK9erhpiw7ZP9ahTrMhFDa1J53m9ri2DloziqGETTcVSppCbTDDjExg6RrZ6cPEzB8XArEjQSB29odrUoLyoS/65RfM9fprGGjlHpbhGgbYD8MtmW1eFcAWX5dbcMHcl8sUI2k+H7GPW9VrArw3G+BefcCrCaAT/N53YLvP26Uy0kMFnDEZz0DJkmQqEOlL7SlKweYhH8gxpYeAYi0f9magqPbMYZuUI6007lSZQoyoGfYQHsNRzHXR3MMINTSMZpq1KD2A5MDJgtMLdRU6R4CEOJcKGiIJ7K6P/vAM6xpECHI8rRHsaEj6smkngAUjXTzrRoSI48ZpHOqgOY5OejKVdpnmiYUChQnVdIPa6ekGqRSRgEO119oDHOiIUQ5ciYVgaF1oG8Udo8WYtD+DEi8D/w8rAJE2k2PoyV0oMtpauxreaFjpujAvxFlwBhjuNqM9P0IfI5iD8Nh8y1kG4igjJkDNkOijnlLhItAd9lhRd670yNRTu95cR/Xuu0c5WO4DEFk5YQAPtLvU4TYPGRh4APPEDNiuuwR6SC21JoFbQBBMr+zJmT32QplNI6p16PbculN/pCX1wAyTWGTeJ774aln0gvQikw7TmkfsNbdQNs0adutYUDqNtGc0RqngUYdhUYuHSL1/eLrgvqDTC5neu++vufRkEgP9D2T64Kg/c4n+s7k3dDr3me8nOr0c72MRNmgF7D4WySPP0YAI/bI4eixwc7K13QiRiL85A8fnSsUj+mvTrsZtVUEQZ6sTpVafW8nYJZyaZS0U+0xIb6et9PhhtoObozQbjKAoDf6eiFgx1UUvpUYj1GweH0MNMrofhynfWn7+KYu7n5r83hN9aqm+6qjcH7dUlgvZVLV3xqq4fbP16qv+eofuTz43eomAqfS7GBAB9zEE31WJ37eVIPtdGN5A8nMYPvvLt8t2/V/6gM19G4g/hIL7UXf9JgbuLRZ+AoW//AzyMxTcWyz8BAruLRZ+AgX3r3y2+mT/PwfiN1DoVI+QT3CZDmvb8022JeYb6HiQPQpPPvboFB+i1MZdcqWZqthHmix6vttw0UAI1z8oEnGwVe++c7JamxslC+8xKJE41XJmug1npz+6CUAKyURd9gSxo+kWxvtZth848GBlws/0SKjYhmbZ9IiV+mcGBSdWHk8sqSr2zz5J7QME/0yD+z4Pe+JuGn1MV/vUyZwOHojWPlmPXgf9CuoeN9UAT+FGwaLg44v3dWe6QpvuL3Ln/p3k/2AgqNDcfwHgqUmIIqn+hwAAAAJiS0dEAACqjSMyAAAACXBIWXMAAAsSAAALEgHS3X78AAAAB3RJTUUH4wYRESAMujenGAAAB9FJREFUeNrtnWlsFVUUx899fS1gUoKioEY+WBRUEohGkUhAKxgEjSgGoRGB4AJCNKAIJBJZJSiyGYMKKkIoLlEUKhUraxFkKUE2kU1aCrRgW2jpg9f29R2/sBTo67v3zL2zvfP73MzM+XU6mf+5504BGIZhGIZhGIZhGIZhGMZGGq3JvSmR62++BXHH7Ylbf9ouRMT99yVq/e0PICIiHumUmPV3PooXOf5EItafXoCXOdUn8ep/pgjrUDY40ervX4JXUTEiocoXL5/FawiNEwlU/6hzeB3hqQljQIwJYT3UzEkQA2JiGOslsiAhDIgZ1RiD6NIEMBD8NIKxyQr6vv7FtdgQa31uILg0ig2zsZmv4//yePUj7rjNv/U3yUEJ/r7Xr/XfvBmlOPKwT+vfhpIUdvdj/Wm7UZpTz/mv/g4HUYGyQb5r/+SjEhXD/VV/j5OoSGisj16LRe9iVCY8xTcGxIulSKBmtk8MiKHlSMIn8ViMqkQivojHgfcuIJ0VAc/XPzmMVljrcQOBmdVojY1NvVx/8mcRtEqeh+NxypJatM6+ezxb/7Io6uBwR4/e/1moicJunvz956A2ip/1Xv3Nt6JGSgd6rf47/0KtlHssHrfZi5rxVDwWDx5C7XgoHotHC9AANbO8YqBXERohMt8bv/8X/kNDRDM9cA+IgWVojhWuNxAYXo4mWePyeBwYHUKz5Lo6HidNvICmybvVxfXPqEbz7Gvr2vrn1KAdHH7IpX//8yNoD8dcGY+TM6NoF26MxzLTL26Mx0majtM4q5ed7yhNulVsd5WAxqset/mGS6/d5CIBLXI62/7I6ZKyzjUC0rIfsP+hE3zkxt9c8vy7tPnJbiKfuyP+Xdn8ZDeuiMei+zF0juWOGyBNv+iMxw4bEBkl6CzOxmPx6ll0mryWDtb/ViU6z17H4rEYG0I3cMiheByYFEZ34Ew8Dn5UjW7BiXisY/rFDfGYmgWCCwcngXto0q08z1YBSUsy3NWgb5Qe2WSjgJRlfdy2RJPcNXm9bQIarexpsP5VdxHjcbMcm2Q3/5P64i71U8k/ELuLNsVjcct2cnST+rGg+Jo4XmhLPBZ376GOfoOkAIB5NWTHxuu/nzj9ElkA8gLgA+pLlvF43IU4/VI9G1QEAHnIPjfVaP1PnqRdVngKqAkActDMa2Hw/u9zijjjNg5UBcBr1FbD3jbG6h9QSruk8ovfyFESABnUWSNT8VgMI06/lF7aBqomAJ4n3m+G4nHgbeJfZfHljcCKAqDHcWo87m2g/gnE53LhlS+lqQqATv9S4/FL2u//qcT2T34XoAuAdvuJBspf11z/LOKbyYG6q4bqAqDVTqKByjFa21/U6ZfdaWBNADTdTDQQnqSv/pRMYjrZevVLCUUAiF+JBqpnaqv/J2I+zb3mxZwkAMTPDq8ep1A3P/1y3ZOEJABgiaPxuOnvxLN/B7oEwELq/sPl1utvSdz8VPsl6BMAn1AbBKut1t96F+3ENXOFTgFiehXRwAZL8Vi0JW5+qppW7+HIAgDGnyca2G4hHouOh2knvTARdAuAkedsj8cinTj9Ujka9AuAV87YHI/F08TNT2eHgQkB0I/aIDhGmuIU/YnnKxkAZgTAU8SGHC0eDyJufiqKfTKrAqBrPtFAiXo8HlFBO1VBA7ebZQHQifhUVo7H4p2QgQeOdQHQbp8t8Tg4idj+2dPgwJIGAdBqhw3xmDz9EuelQ4cASP3DeDwOziW+ecdbldEiACDbcDxOWkBs/8QNHpoEAPXjLNFMmfpv+IZ4+PjRU5cAWGwwHqcQNz/J2NUmAMgjavHjMfEPTGpvvz4BQH1MrzMkoHoW2CsAppEaBFskemQUA+HJYLcAeJfQINgpNVuvbiA0FuwXAG8qNwh2S07WqxqQ/saPXgEwRDGu7W8te2Q1A6XSH0HWLAD6nVa5zoPS9asZKJb/DLZuAdDzhPx1Hu2gkobkDRQq/J8w7QJAfstevuI3+WQN1F39dkAAtP9H7jpPdFVtiMgZOKC0Z9aAAEiT+mrbScLQjIyBXWngtABokRf/kKefonRF4xvYqrjmYEQApG6Md8SyvrS+eDwDG5QbzUYExL3QMxnUlZGGD5wFbhEADQ7YVwyhr401YCD6LbhHACyK3SA4N9TK6mhMA5EvwE0CYF6sBkFopLXl8exYq9/gLgHwYf3x+PxoqwMC9RoIvw9uE1D/gH3VeOsjItnSq9/OCqhvwL5qAoABA5XU28qsAHjj2tW8mukABgzEXP12WgAMvrpBEPkYwICB2KvfjguAvnUH7GvnARgwUGRhEt24gLoD9tGvAAwYKLDyySzzAqDzpQH76CIAAwYOWtqNYoMAaH9xwP57AAMG9ljbj2SHALhjJyLijwAGDGyzuCPNFgGQuhlxpfw1yR94dfAxi5cmojI/lRyx+rtaX9XDhADr2CVABc//JycWwAJYAAtgASyABbAAFsACWAALYAEsgAWwABbAAlgAC2ABLIAFsAAWwAJYAAtgASyABbAAFsACWAALYAEsgAWwABbAAlgAC2ABLIAFsAAWwAJYAAtgASyABbAAFsACWAALYAEsgAWwABbAAlgAC2ABLIAFsAAWwAJYAAtgASyABbAAFsACWIDToH8FyJUWtVWAALedDoFhGIZhGIZhGIZhGIYxyf+YwEMsIhMo/AAAAABJRU5ErkJggg==";var eT=new gn;function g4(r,t){let{nearRadius:e,farRadius:i,color:n,pulseColor:o,completeFraction:a}=t,u=!0,s=5,p=1e3,f=!1,m=!0,y=!0,x=!1,M=e/2+.15,g=0;r[0].z+=M;for(let tt=1;tt<r.length;++tt){r[tt].z+=M;let St=r[tt].x-r[tt-1].x,Gt=r[tt].y-r[tt-1].y,ie=r[tt].z-r[tt-1].z;g+=Math.sqrt(St*St+Gt*Gt+ie*ie)}let C=M-.1;r.push(r[r.length-1].clone().setZ(C)),r.unshift(r[0].clone().setZ(C));let I=new Um;x&&(I=eT.load(y4),I.colorSpace=mi);let w=new wt(n),T=new wt(o),L={vertexes:{type:"f",value:1},resolution:{type:"v2",value:new Z(1,1)},cameraParameters:{type:"v2",value:new Z(s,0)},complete:{type:"f",value:u?0:1},color:{type:"c",value:w},pathLength:{type:"f",value:g},nearRadius:{type:"f",value:e},farRadius:{type:"f",value:i},nearZoom:{type:"f",value:s},farZoom:{type:"f",value:p},pulseColor:{type:"c",value:T},pulse:{type:"f",value:0},pulseLength:{type:"f",value:.075},pathIsVertical:{type:"b",value:!1},arrowAnimationTimer:{type:"f",value:0},arrowTexture:{type:"t",value:I},displayArrowsOnPath:{type:"b",value:f},flattenFactor:{type:"f",value:m?.05:1},showPulse:{type:"b",value:y},opacityMultiplier:{type:"f",value:1}},D=new o1(r);D.curveType="catmullrom",D.tension=0;let R=30,F=8,N=R*r.length,H=new s1(D,N,e,F,!1),X=new Float32Array(H.attributes.position.count);for(let tt=r.length;tt<X.length;tt++)X[tt]=tt;H.setAttribute("vertexIndex",new Io(X,1));let $=new Float32Array(H.attributes.position.count),ct=new Io($,1);for(let tt=0;tt<=N;tt++)for(let St=0;St<=F;++St)ct.setX(tt*(F+1)+St,tt/N);H.setAttribute("pathDistance",ct);let yt=new Float32Array(H.attributes.normal.count*3),bt=new Io(yt,3);for(let tt=0;tt<N;tt++){let St=H.tangents[tt];for(let Gt=0;Gt<=F;++Gt)bt.setXYZ(tt*(F+1)+Gt,St.x,St.y,St.z)}H.setAttribute("pathTangent",bt);let kt=new Float32Array(H.attributes.normal.count*3),Me=new Io(kt,3);for(let tt=0;tt<N;tt++){let St=H.tangents[tt];var Ft,ht,xt;Ft=-St.x*St.z,ht=-St.y*St.z,xt=1-St.z*St.z;let Gt=Math.sqrt(Ft*Ft+ht*ht+xt*xt);Gt===0&&(Gt=1);let ie=Ft/Gt,cr=ht/Gt,dn=xt/Gt;for(let di=0;di<=F;++di)Me.setXYZ(tt*(F+1)+di,ie,cr,dn)}H.setAttribute("pathNormal",Me);let ur=new Eo({uniforms:L,vertexShader:gm,fragmentShader:vm});ur.transparent=!0,ur.alphaTest=.5,L.resolution.value.x=1,L.resolution.value.y=1,L.vertexes.value=X.length,L.arrowTexture.value.wrapS=He,L.arrowTexture.value.wrapT=He,L.arrowTexture.value.anisotropy=16,L.complete.value=a;let Pe=new Ut(H,ur),le=Pe.clone(),Zt={...L,opacityMultiplier:{type:"f",value:.25}};Zt.complete.value=1,le.material=new Eo({uniforms:Zt,vertexShader:gm,fragmentShader:vm}),le.material.transparent=!0,le.material.alphaTest=.5,le.material.depthWrite=!1,le.material.depthTest=!1,le.renderOrder=1,Zt.resolution.value.x=1,Zt.resolution.value.y=1,Zt.vertexes.value=X.length,Zt.arrowTexture.value.wrapS=He,Zt.arrowTexture.value.wrapT=He,Zt.arrowTexture.value.anisotropy=16,Zt.complete.value=a;let hi=t.mesh;hi.add(Pe),hi.add(le),H.computeBoundingBox();let hn=new j;return H.boundingBox.getCenter(hn),{mesh:hi,material:ur,center:hn}}l(g4,"buildPath");var bm=class bm{rendererState;convertTo3DMapPosition;constructor(t,e){this.rendererState=t,this.convertTo3DMapPosition=e}update(t,e,i){let n;for(let o of this.rendererState.threeDEntities)if(n=this.rendererState.entity3DMap.get(o),n&&n.type==="path"&&n.components[0].type==="path"){let a=n.components[0];if(a.dirty){a.mesh.parent!=null&&a.mesh.children.forEach(m=>{Re(m)});let u=a.feature.features.map(m=>m.geometry.coordinates).map(m=>this.convertTo3DMapPosition(m[1],m[0],m[2]||0)),{mesh:s,material:p,center:f}=g4(u,a);a.mesh=s,a.material=p,a.dirty=!1,a.position=f}a.material&&(a.material.uniforms.nearZoom.value=t,a.material.uniforms.farZoom.value=e,a.material.uniforms.cameraParameters.value.x=i,a.material.needsUpdate=!0)}}};l(bm,"PathSystem");var ps=bm;var v4=new Rr,Mm=18,Pm=0,Tm=0;var rT=it.radToDeg(.698132),se,Tt,hs,go,pi,on,an,sn,vo,ds,xm,A,lt,Ge,vt,ar,Se,_,fs,Ct,mt,vc,b4,bc,C4,Cc,x4,ln,ms,ys,bo,xc,gs,vs,bs,Co,fe,Fe,Cs,Sm,un,xs,ee,re,wm=class wm extends et{constructor(e,i={}){var y,x,S,M,g,C,I,w,T,L;super();P(this,ds);P(this,vc);P(this,bc);P(this,Cc);P(this,fe);P(this,Cs);v(this,"options");v(this,"container");P(this,se,void 0);P(this,Tt,void 0);P(this,hs,void 0);P(this,go,void 0);P(this,pi,void 0);P(this,on,void 0);P(this,an,void 0);P(this,sn,void 0);P(this,vo,void 0);v(this,"rendererDomElement");P(this,A,{entity3DMap:new Map,entity2DMap:new Map,entity2DIds:new Set,threeDEntities:[],entityScene:new Pt("__scene"),hoverColor:"red",insetsPadding:Yu,shouldMeasureCanvas:!0,pixelRatio:oi()});v(this,"camera");P(this,lt,void 0);P(this,Ge,void 0);P(this,vt,void 0);P(this,ar,void 0);P(this,Se,void 0);P(this,_,{});P(this,fs,window.matchMedia("screen and (min-resolution: 2dppx)"));v(this,"map");P(this,Ct,l(()=>{c(this,_).renderSystem.twoDdirty=!0},"#invalidate2DEntities"));P(this,mt,l(()=>{c(this,_).renderSystem.threeDdirty=!0},"#invalidate3DEntities"));P(this,ln,"standalone");P(this,ms,l(e=>Math.trunc(e*10)/10,"#round10"));P(this,ys,l(()=>{c(this,_).twoDDrawSystem.dirty=!0,W(this,ds,xm).call(this,oi()),c(this,_).watermarkSystem.dirty=!0,this.render()},"#handlePixelRatioChange"));P(this,bo,l(()=>{E(this,on,this.rendererDomElement.clientWidth),E(this,an,this.rendererDomElement.clientHeight),W(this,ds,xm).call(this,oi()),c(this,Co).call(this),W(this,Cc,x4).call(this),c(this,_).cameraSystem.resize(this.canvasWidth,this.canvasHeight),c(this,_).cameraSystem.dirty=!0,c(this,_).watermarkSystem.resize(this.canvasWidth,this.canvasHeight),c(this,_).htmlControlsSystem.resize(this.canvasWidth),this.render()},"#handleWindowResize"));P(this,xc,l(()=>{this.renderSync()},"#renderFull"));P(this,gs,new j);P(this,vs,l((e,i)=>{let n=this.mode==="standalone"?c(this,Tt):this.viewCamera;if(c(this,Tt).position.z+this.camera.elevation>i.z){c(this,gs).copy(i);let o=c(this,gs).project(n),a=(o.x+1)/2*this.canvasWidth-0/2,u=(-o.y+1)/2*this.canvasHeight-0/2,s=c(this,ms).call(this,a),p=c(this,ms).call(this,u);e.x=s,e.y=p}else e.x=-1e3,e.y=-1e3},"#project"));P(this,bs,l((e,i)=>{c(this,Se).setBufferSize(e,i),c(this,Tt).aspect=e/i,c(this,Tt).updateProjectionMatrix(),c(this,Tt).updateMatrixWorld(!0),c(this,go).x=e,c(this,go).y=i},"#setBufferSize"));P(this,Co,l(()=>{var a;let e=E(this,on,this.rendererDomElement.clientWidth),i=E(this,an,this.rendererDomElement.clientHeight),n=Math.floor(e*this.resolutionScale),o=Math.floor(i*this.resolutionScale);c(this,bs).call(this,n,o),(a=this.map)==null||a.resize(),c(this,A).shouldMeasureCanvas=!1},"#measureCanvas"));v(this,"showCollisionBoxes",()=>{c(this,_).collisionSystem.showCollisionBoxes(),this.render()});v(this,"hideCollisionBoxes",()=>{c(this,_).collisionSystem.hideCollisionBoxes(),this.render()});v(this,"projectScreenXYToCoordinate",(e,i)=>{var s;let n=e/this.canvasWidth*2-1,o=-(i/this.canvasHeight)*2+1,a=new Z(n,o);v4.setFromCamera(a,c(this,Tt).clone());let u=(s=v4.intersectObject(c(this,pi),!1)[0])==null?void 0:s.point;return u!=null?this.convert3DMapPositionToCoordinate(u):void 0});v(this,"projectCoordinateToScreenXY",e=>{let i=this.convertTo3DMapPosition(e[1],e[0],e[2]||0),n=new Z;return c(this,vs).call(this,n,i),{x:n.x,y:n.y}});v(this,"convert3DMapPositionToCoordinate",e=>{var o,a,u,s;let{lat:i,lon:n}=gu((a=(o=c(this,A).center)==null?void 0:o[1])!=null?a:0,(s=(u=c(this,A).center)==null?void 0:u[0])!=null?s:0,e.x,e.y);return[n,i]});v(this,"setBackgroundColor",(e,i)=>{c(this,Se).setBackgroundColor(e,i)});v(this,"hideOutdoorLayersUnderPoint",(e,i)=>{!this.map||(i==null?void 0:i.length)===0||(c(this,_).outdoorLayersSystem.hideLayersUnderPoint(e,i),this.render())});P(this,un,new t1);P(this,xs,new pr);v(this,"render",()=>{c(this,_).renderSystem!=null&&(this.map&&(this.mode==="outdoors-interleaved"||this.mode==="outdoors-overlay")?this.map.triggerRepaint():c(this,_).renderSystem.update())});v(this,"renderSync",()=>{c(this,_).renderSystem.update(!0)});P(this,ee,po(()=>{this.publish("user-interaction-start",void 0)},0,!0));P(this,re,po(()=>{this.publish("user-interaction-end",void 0)},0,!0));v(this,"on",(e,i)=>{super.on(e,i),["outdoor-view-loaded","outdoor-style-loaded"].includes(e)&&this.mode==="standalone"&&b.env.NODE_ENV!=="test"&&(G.warn(`"${e}" was subscribed to but outdoor view is disabled. The event has been triggered immediately. Enable outdoor view or remove the listener.`),this.publish(e))});v(this,"off",(e,i)=>{super.off(e,i)});v(this,"getCursor",()=>c(this,_).interactionSystem.getCursor());v(this,"destroy",()=>{c(this,_).cameraSystem.off("user-dolly-start",c(this,ee)),c(this,_).cameraSystem.off("user-pan-start",c(this,ee)),c(this,_).cameraSystem.off("user-rotate-start",c(this,ee)),c(this,_).cameraSystem.off("user-zoom-start",c(this,ee)),c(this,_).cameraSystem.off("user-tilt-start",c(this,ee)),c(this,_).cameraSystem.off("user-pedestal-start",c(this,ee)),c(this,_).cameraSystem.off("user-dolly-end",c(this,re)),c(this,_).cameraSystem.off("user-pan-end",c(this,re)),c(this,_).cameraSystem.off("user-rotate-end",c(this,re)),c(this,_).cameraSystem.off("user-zoom-end",c(this,re)),c(this,_).cameraSystem.off("user-tilt-end",c(this,re)),c(this,_).cameraSystem.off("user-pedestal-end",c(this,re)),c(this,_).renderSystem.off("measure-canvas",c(this,Co)),this.remove("__scene"),c(this,Ct).call(this),c(this,mt).call(this),this.renderSync(),c(this,_).renderSystem.destroy(),c(this,_).zoomInterpolationSystem.destroy(),c(this,_).renderSystem.destroy(),c(this,_).cameraSystem.off("change",this.render),c(this,_).cameraSystem.dispose(),c(this,_).exporterSystem.destroy(),c(this,_).outdoorLayersSystem.destroy(),c(this,_).drawSystem.destroy(),window.removeEventListener("resize",c(this,bo),!1),c(this,fs).removeEventListener("change",c(this,ys)),c(this,sn)&&c(this,sn).disconnect(),this._subscribers={},c(this,Se).destroy(),c(this,se).traverse(e=>{Re(e),"dispose"in e&&typeof e.dispose=="function"&&e.dispose()}),E(this,se,void 0),c(this,_).htmlControlsSystem.destroy(),c(this,_).collisionSystem.destroy(),c(this,_).domMutationSystem.destroy(),E(this,_,void 0),this.map&&(this.map.transform.getElevation=void 0,this.map.remove()),this.container.contains(this.rendererDomElement)&&this.container.removeChild(this.rendererDomElement),this.container.removeChild(c(this,ar)),this.container.removeChild(c(this,lt)),E(this,Se,void 0)});this.convertTo3DMapPosition=this.convertTo3DMapPosition.bind(this),(i.mode==="outdoors-interleaved"||i.mode==="outdoors-overlay")&&i.map&&(E(this,ln,i.mode),this.map=i.map),c(this,A).entityScene.addEventListener("childadded",()=>{c(this,mt).call(this),c(this,Ct).call(this)}),c(this,A).entityScene.addEventListener("childremoved",()=>{c(this,mt).call(this),c(this,Ct).call(this)}),c(this,A).entity3DMap.set(c(this,A).entityScene.userData.entityId,c(this,A).entityScene),i.center&&(c(this,A).center=i.center?[...i.center]:[0,0]),this.options=i,this.container=e,W(this,vc,b4).call(this),W(this,bc,C4).call(this),c(this,_).htmlControlsSystem=new fc(this.container),c(this,ln)!=="outdoors-overlay"&&c(this,_).htmlControlsSystem.addAttributionControl(this.options.attribution),window.MappedinDebug||(window.MappedinDebug={}),b.env.NODE_ENV==="test"&&(window.MappedinDebug.mapViewCoreInstance=this),E(this,Se,new mu({antialias:typeof i.antialias=="boolean"?i.antialias:!0,alpha:!1,canvas:this.mode!=="standalone"?(y=i.gl)==null?void 0:y.canvas:void 0,onWebGLContextCreationError:i.onWebGLContextCreationError,onWebGLContextLost:()=>{typeof i.onWebGLContextLost=="function"&&i.onWebGLContextLost()},onWebGLContextRestored:()=>{i.onWebGLContextRestored&&i.onWebGLContextRestored(),c(this,Ct).call(this),c(this,mt).call(this),this.render()},onWebGLRendererError:i.onWebGLRendererError,backgroundColor:i.backgroundColor||"#ffffff",backgroundAlpha:(x=i.backgroundAlpha)!=null?x:1})),E(this,se,new js),c(this,se).add(c(this,A).entityScene);let n=window.__THREE_DEVTOOLS__;b.env.NODE_ENV==="dev"&&typeof n<"u"&&(n.dispatchEvent(new CustomEvent("observe",{detail:c(this,se)})),n.dispatchEvent(new CustomEvent("observe",{detail:c(this,Se)}))),E(this,Tt,new Qm(rT,this.aspect,50,1e5)),E(this,hs,new Km),c(this,Tt).renderOrder=999;let o=new we;o.add(c(this,Tt)),E(this,vo,new we),c(this,vo).add(o),c(this,se).add(c(this,vo)),c(this,Tt).updateProjectionMatrix(),c(this,Tt).updateMatrixWorld(!0),this.referenceMap={scale:1,latitude:0,longitude:0,getNorth:()=>0,georeference:[{target:{x:0,y:0}},{target:{x:0,y:0}},{target:{x:0,y:0}},{target:{x:0,y:0}}]},this.rendererDomElement=c(this,Se).domElement(),E(this,go,new Z);let a=new mn(1e6,1e6),u=new kr({color:0,visible:!1});E(this,pi,new Ut(a,u)),c(this,se).add(c(this,pi)),(S=i.gl)!=null&&S.canvas||e.appendChild(this.rendererDomElement),window.addEventListener("resize",c(this,bo),!1),c(this,fs).addEventListener("change",c(this,ys)),typeof ResizeObserver=="function"&&((M=b.env)==null?void 0:M.NODE_ENV)!=="test"&&(E(this,sn,new ResizeObserver(po(()=>{c(this,bo).call(this)},0))),(g=c(this,sn))==null||g.observe(e)),e.classList.add("mappedin-map"),this.rendererDomElement.style.width=(C=globalThis.MappedinDebug)!=null&&C.TEST_IOS?"1080px":"100%",this.rendererDomElement.style.height=(I=globalThis.MappedinDebug)!=null&&I.TEST_IOS?"1920px":"100%",E(this,on,this.rendererDomElement.clientWidth),E(this,an,this.rendererDomElement.clientHeight),this.rendererDomElement.style.touchAction="manipulation";let s=this.canvasWidth,p=this.canvasHeight;c(this,_).watermarkSystem=new hc(c(this,Tt),s,p,c(this,A),i==null?void 0:i.watermark),c(this,A).shouldMeasureCanvas=!0,c(this,A).pixelRatio=this.resolutionScale,c(this,bs).call(this,Math.floor(s*this.resolutionScale),Math.floor(p*this.resolutionScale));let f=new Us(16777215,.3*Math.PI);f.position.set(-150,-150,350),c(this,se).add(f);let m=new u1(16777215,.741*Math.PI);c(this,se).add(m),c(this,_).cameraSystem=new as(c(this,Tt),c(this,se),c(this,Se).renderer,c(this,A),{mode:this.mode,canvasHeight:p,canvasWidth:s}),c(this,_).cameraSystem.on("user-dolly-start",c(this,ee)),c(this,_).cameraSystem.on("user-pan-start",c(this,ee)),c(this,_).cameraSystem.on("user-rotate-start",c(this,ee)),c(this,_).cameraSystem.on("user-zoom-start",c(this,ee)),c(this,_).cameraSystem.on("user-tilt-start",c(this,ee)),c(this,_).cameraSystem.on("user-pedestal-start",c(this,ee)),c(this,_).cameraSystem.on("user-dolly-end",c(this,re)),c(this,_).cameraSystem.on("user-pan-end",c(this,re)),c(this,_).cameraSystem.on("user-rotate-end",c(this,re)),c(this,_).cameraSystem.on("user-zoom-end",c(this,re)),c(this,_).cameraSystem.on("user-tilt-end",c(this,re)),c(this,_).cameraSystem.on("user-pedestal-end",c(this,re)),c(this,_).cameraSystem.on("change",()=>{this.publish("camera-change",this.camera),this.render()}),c(this,_).panBoundsSystem=new dc(c(this,A),c(this,_).cameraSystem),c(this,_).pathSystem=new ps(c(this,A),this.convertTo3DMapPosition),this.camera=new pc(this,c(this,_),c(this,A),c(this,pi)),this.camera.setZoomLevel((w=i.zoomLevel)!=null?w:Mm),this.camera.setBearing((T=i.bearing)!=null?T:Tm),this.camera.setPitch((L=i.pitch)!=null?L:Pm),this.camera.setMaxZoomLevel(22),c(this,_).domVisiblitySystem=new Ju(c(this,A),c(this,ar)),c(this,_).domMutationSystem=new cc(c(this,A),c(this,ar)),c(this,_).domMutationSystem.on("dimensions-update",()=>{c(this,_).collisionSystem.dirty=!0,this.render()}),c(this,_).domDrawSystem=new lc(c(this,A)),c(this,_).collisionSystem=new xu(c(this,Ge),c(this,A)),c(this,_).twoDDrawSystem=new Qu(c(this,A),c(this,vt)),c(this,_).interactionSystem=new Ra(this.rendererDomElement,c(this,A),c(this,Tt),c(this,pi)),c(this,_).interactionSystem.on("hover",this.render),c(this,_).interactionSystem.on("click",D=>{var R,F,N,H,X;if(((R=D.entity2D)==null?void 0:R.id)==="watermark"&&typeof c(this,_).watermarkSystem.options.onClick=="function"){c(this,_).watermarkSystem.options.onClick();return}this.publish("click",{coordinate:this.convert3DMapPositionToCoordinate(D.position),geometry:D.entity3D?[(F=D.entity3D)==null?void 0:F.id]:[],markers:((N=D.entity2D)==null?void 0:N.components[0])instanceof ve?[D.entity2D.id]:[],models:((H=D.entity3D)==null?void 0:H.components[0])instanceof ui?[D.entity3D.id]:[],labels:((X=D.entity2D)==null?void 0:X.components[0])instanceof rr?[D.entity2D.id]:[],containers:Array.isArray(D.groupContainers)?D.groupContainers.map($=>$.userData.entityId):[],pointerEvent:D.pointerEvent})}),c(this,_).interactionSystem.on("hover",D=>{var R,F,N,H,X;D.position&&((R=D.entity2D)==null?void 0:R.id)!=="watermark"&&this.publish("hover",{coordinate:this.convert3DMapPositionToCoordinate(D.position),geometry:D.entity3D?[(F=D.entity3D)==null?void 0:F.id]:[],markers:((N=D.entity2D)==null?void 0:N.components[0])instanceof ve?[D.entity2D.id]:[],models:((H=D.entity3D)==null?void 0:H.components[0])instanceof ui?[D.entity3D.id]:[],labels:((X=D.entity2D)==null?void 0:X.components[0])instanceof rr?[D.entity2D.id]:[],containers:Array.isArray(D.groupContainers)?D.groupContainers.map($=>$.userData.entityId):[]})}),c(this,_).twoDVisiblitySystem=new rc(c(this,A)),c(this,_).drawSystem=new ec(c(this,A)),c(this,_).drawSystem.on("texture-loaded",this.render),c(this,_).stackSystem=new oc(c(this,A)),c(this,_).twoDProjectionSystem=new Ku(c(this,A),c(this,vs)),c(this,_).zoomInterpolationSystem=new Nu,c(this,_).exporterSystem=new Wa(c(this,A)),c(this,_).meshOptimizationSystem=new $u(c(this,A),this.convertTo3DMapPosition),c(this,_).meshOptimizationSystem.on("model-loaded",this.render),c(this,_).customGeometrySystem=new mc(c(this,A)),c(this,_).outlineInterpolationSystem=new yc(c(this,A)),c(this,_).renderSystem=new ic(c(this,Se),c(this,A),this.mode,c(this,se),c(this,Tt),this.viewCamera,c(this,_)),c(this,_).renderSystem.on("measure-canvas",c(this,Co)),c(this,_).outdoorLayersSystem=new gc(this.map),c(this,xc).call(this)}get viewCamera(){return c(this,hs)}get canvasWidth(){return c(this,on)}get canvasHeight(){return c(this,an)}get resolutionScale(){var e,i;return(i=(e=this.map)==null?void 0:e.getPixelRatio())!=null?i:oi()}get aspect(){return this.canvasWidth/this.canvasHeight}get mode(){return c(this,ln)}addGroupContainer(e,i,n){var o;if(!c(this,A).entity3DMap.has(e)&&!c(this,A).entity2DMap.has(e)){let a=new Pt(e);a.addEventListener("childadded",()=>{c(this,mt).call(this),c(this,Ct).call(this)}),a.addEventListener("childremoved",()=>{c(this,mt).call(this),c(this,Ct).call(this)}),(i==null?void 0:i.visible)!==void 0&&(a.visible=i.visible),(i==null?void 0:i.altitude)!==void 0&&a.setAltitude(i.altitude),(i==null?void 0:i.interactive)!==void 0&&de(a,i.interactive,c(this,A)),c(this,A).entity3DMap.set(e,a),(o=W(this,fe,Fe).call(this,n))==null||o.addEntity(a),c(this,mt).call(this),this.render()}else G.error(`Group container with ID '${e}' already exists. The group container cannot be added.`);return{id:e,type:"group-container"}}addStackContainer(e,i,n){var o;if(c(this,A).entity3DMap.has(e))G.error(`Stack container with ID '${e}' already exists. The stack container cannot be added.`);else{let a=new Pt(e);a.addEventListener("childadded",()=>{c(this,mt).call(this),c(this,Ct).call(this)}),a.addEventListener("childremoved",()=>{c(this,mt).call(this),c(this,Ct).call(this)}),a.components[0]=new uc,(i==null?void 0:i.visible)!==void 0&&(a.visible=i.visible),c(this,A).entity3DMap.set(e,a),(o=W(this,fe,Fe).call(this,n))==null||o.addEntity(a)}return{id:e,type:"stack-container"}}addCustomGeometry(e,i,n,o,a){var u;if(c(this,A).entity3DMap.has(e))G.error(`Custom geometry with ID '${e}' already exists. The custom geometry cannot be added.`);else{let s=new yo(i,n),p=new dt(s,new ai(o));p.id=e,s.mesh.userData={entityId:e,type:"custom-geometry"},c(this,A).entity3DMap.set(p.id,p),(u=W(this,fe,Fe).call(this,a))==null||u.addEntity(p),this.render()}return{id:e,type:"custom-geometry"}}addGeometryGroup(e,i,n,o){var a,u;if(!c(this,A).entity3DMap.has(e)&&!c(this,A).entity2DMap.has(e)){let s=new Bt(e,new Yi(n));s.addEventListener("childadded",()=>{c(this,mt).call(this),c(this,Ct).call(this)}),s.addEventListener("childremoved",()=>{c(this,mt).call(this),c(this,Ct).call(this)}),s.userData.dirty=!0,c(this,A).entity3DMap.set(e,s);for(let p of i.features){if(!["Polygon","MultiPolygon","LineString","MultiLineString"].includes(p.geometry.type))continue;let f=p.id||p.properties.id||ut(),m=c(this,_).meshOptimizationSystem.createEntityFromFeature(f,p,n);c(this,A).entity3DMap.set(f,m),s.userData.entities3D.add(f)}s.setVisible((a=n==null?void 0:n.visible)!=null?a:!0),(u=W(this,fe,Fe).call(this,o))==null||u.addEntity(s),c(this,mt).call(this),this.render()}else G.error(`Geometry group with ID '${e}' already exists. The geometry group cannot be added.`);return c(this,_).outlineInterpolationSystem.dirty=!0,{id:e,type:"geometry-group"}}addModelGroup(e,i,n,o){var a;if(!c(this,A).entity3DMap.has(e)&&!c(this,A).entity2DMap.has(e)){let u=new Bt(e,new Yi(n));u.addEventListener("childadded",()=>{c(this,mt).call(this),c(this,Ct).call(this)}),u.addEventListener("childremoved",()=>{c(this,mt).call(this),c(this,Ct).call(this)}),c(this,A).entity3DMap.set(e,u),u.userData.dirty=!0,u.userData.modelURL=n.url;for(let s of i.features){let p=s.id||s.properties.id||ut(),f=c(this,_).meshOptimizationSystem.createModelFromFeature(p,s,n);s.properties.interactive!==void 0&&de(f,s.properties.interactive,c(this,A)),c(this,A).entity3DMap.set(p,f),u.userData.entities3D.add(p)}(a=W(this,fe,Fe).call(this,o))==null||a.addEntity(u),c(this,mt).call(this),this.render()}else G.error(`Model group with ID '${e}' already exists. The model group cannot be added.`);return{id:e,type:"geometry-group"}}addMarker2D(e,i,n,o){var u;let a=n==null?void 0:n.id;if(a===void 0||!c(this,A).entity2DMap.has(a)&&!c(this,A).entity3DMap.has(a)){let s=W(this,Cs,Sm).call(this,e,new ve(i,n));s.id=a||String(s.id),a=s.id,(n==null?void 0:n.interactive)!=null&&de(s,n==null?void 0:n.interactive,c(this,A)),(u=W(this,fe,Fe).call(this,o))==null||u.addEntity(s),this.render()}else G.error(`Marker2D with ID '${a}' already exists. The marker cannot be added.`);return{id:a,type:"marker"}}addLabel2D(e,i,n,o){var u;let a=n==null?void 0:n.id;if(a===void 0||!c(this,A).entity2DMap.has(a)&&!c(this,A).entity3DMap.has(a)){let s=W(this,Cs,Sm).call(this,e,new rr(i,n||{},c(this,A)));s.id=a||String(s.id),a=s.id,(n==null?void 0:n.interactive)!=null&&de(s,n==null?void 0:n.interactive,c(this,A)),(u=W(this,fe,Fe).call(this,o))==null||u.addEntity(s),c(this,Ct).call(this),this.render()}else G.error(`Label2D with ID '${a}' already exists. The label cannot be added.`);return{id:a,type:"label"}}addPath(e,i={},n){var u;let o=new nc(e,i),a=new dt(o,new ai);return a.id=(i==null?void 0:i.id)||ut(),o.mesh.userData={entityId:a.id,type:"path"},c(this,A).entity3DMap.set(a.id,a),(i==null?void 0:i.interactive)!=null&&de(a,i==null?void 0:i.interactive,c(this,A)),(u=W(this,fe,Fe).call(this,n))==null||u.addEntity(a),c(this,mt).call(this),this.render(),{id:a.id,type:"path"}}updateStackState(e,i){let n;(typeof e=="string"||typeof e=="number")&&(n=c(this,A).entity3DMap.get(e)),n!=null&&n.components[0]&&(typeof i.activeId<"u"&&(n.components[0].activeId=i.activeId),typeof i.expandedFactor<"u"&&(n.components[0].percentExpanded=i.expandedFactor),n.components[0].dirty=!0,this.render())}remove(e){var n;let i;if(typeof e=="string"||typeof e=="number"?(i=c(this,A).entity2DMap.get(e),i==null&&(i=c(this,A).entity3DMap.get(e))):typeof e.id=="string"||typeof e.id=="number"?(i=c(this,A).entity2DMap.get(e.id),i==null&&(i=c(this,A).entity3DMap.get(e.id))):i=e,i!=null){if(i.type==="custom-geometry")c(this,A).entity3DMap.delete(i.id),i.object3d&&Re(i.object3d);else if(i.type==="group-container"){c(this,A).entity3DMap.delete(i.userData.entityId);for(let o of i.childrenIds.values())this.remove(o),i.userData.entities2D.delete(o);Re(i)}else if(i.type==="geometry-group"){c(this,A).entity3DMap.delete(i.userData.entityId);for(let o of i.userData.entities3D.values())this.remove(o),i.userData.entities3D.delete(o);Re(i)}else i.type==="geometry"||i.type==="model"||i.type==="path"?(i.object3d&&(((n=i.parent)==null?void 0:n.type)==="geometry-group"&&i.parent.userData.entities3D.delete(i.id),Re(i.object3d)),i.components[0].outline&&Re(i.components[0].outline),c(this,A).entity3DMap.delete(i.id)):(i.type==="marker"||i.type==="label")&&(i.object3d&&Re(i.object3d),i.type==="label"&&delete c(this,_).twoDDrawSystem.textCache[i.id],c(this,A).entity2DMap.delete(i.id));c(this,mt).call(this),c(this,Ct).call(this),this.render()}}getScene(){return this.getState("__scene")}getCurrentSceneGLTF(e){return c(this,_).exporterSystem.getCurrentSceneGLTF(e)}getBoundingBox(e){if(this.renderSync(),e==null){let n=new Te;n.setFromObject(c(this,A).entityScene);let o=n.min,a=n.max;return[this.convert3DMapPositionToCoordinate(o),this.convert3DMapPositionToCoordinate(a)]}let i=ka(c(this,A),e);if((i==null?void 0:i.type)==="geometry"&&(i==null?void 0:i.object3d)!=null){let n=new Te;return n.setFromObject(i.object3d),[this.convert3DMapPositionToCoordinate(n.min),this.convert3DMapPositionToCoordinate(n.max)]}else if(((i==null?void 0:i.type)==="geometry-group"||(i==null?void 0:i.type)==="group-container")&&(i==null?void 0:i.userData.entityId)!=null){let n=new Te;return n.setFromObject(i),[this.convert3DMapPositionToCoordinate(n.min),this.convert3DMapPositionToCoordinate(n.max)]}}getState(e){var n;if(e==null)return{type:"map-view",hoverColor:c(this,A).hoverColor};let i=ka(c(this,A),e);if((i==null?void 0:i.type)==="custom-geometry"){let o=i.components[0],a=i.components[1];return{id:i.id,type:"custom-geometry",visible:a.visible,altitude:a.altitude,parent:(n=i.parent)==null?void 0:n.userData.entityId,position:this.convert3DMapPositionToCoordinate(o.position)}}else if((i==null?void 0:i.type)==="geometry-group"){let o=[];for(let u of i.userData.entities3D.values()){let s=this.getState(u);((s==null?void 0:s.type)==="geometry"||(s==null?void 0:s.type)==="model")&&o.push(s)}let a=i.components[0];return{id:i.userData.entityId,type:"geometry-group",visible:i.visible,opacity:a.opacity,color:a.color,topColor:a.topColor,outline:a.outline,shading:a.shading,interactive:Array.from(i.userData.entities3D.values()).map(u=>c(this,A).entity3DMap.get(u)).every(u=>u&&u.components[2]!=null),children:Array.from(i.userData.entities3D.values()).map(u=>this.getState(u)).filter(Boolean)}}else{if((i==null?void 0:i.type)==="group-container")return{id:i.userData.entityId,type:"group-container",visible:i.visible,altitude:i.altitude,interactive:!!i.components[1],children:Array.from(i.childrenIds.values()).map(o=>this.getState(o)).filter(Boolean)};if((i==null?void 0:i.type)==="label"){let o=i.components[0],a=i.object3d.parent,u=a==null?void 0:a.userData.entityId;return{id:i.id,type:"label",text:o.text||"",parent:{id:u,type:a==null?void 0:a.type},position:this.convert3DMapPositionToCoordinate(i.position),enabled:o.enabled,initialRank:Na(o.initialRank),options:{rank:Na(o.rank),appearance:o.appearance,interactive:i.components[1]!=null}}}else if((i==null?void 0:i.type)==="marker"){let o=i.components[0],a=i.object3d.parent,u=a==null?void 0:a.userData.entityId;return{id:i.id,type:"marker",enabled:o.enabled,parent:{id:u,type:a==null?void 0:a.type},position:this.convert3DMapPositionToCoordinate(i.position),element:o.containerEl,initialRank:Na(o.initialRank),options:{rank:Na(o.rank),interactive:i.components[1]!=null||!1}}}else if((i==null?void 0:i.type)==="geometry"){let{color:o,hoverColor:a,initialColor:u,topColor:s}=i.components[1],p=i.components[0],f=i.components[1];return{id:i.id,type:"geometry",color:o,topColor:s,initialColor:u,hoverColor:a,visible:f.visible,outline:f.outline,position:this.convert3DMapPositionToCoordinate(p.position),interactive:i.components[2]!=null}}else if((i==null?void 0:i.type)==="model"){let o=i.components[0],a=i.components[2];return{id:i.id,type:"model",position:this.convert3DMapPositionToCoordinate(o.position),interactive:a!=null}}else if((i==null?void 0:i.type)==="path"){let o=i.components[0],a=i.components[2],u=i.components[1];return{id:i.id,type:"path",position:this.convert3DMapPositionToCoordinate(o.position),visible:u.visible,interactive:a!=null,completeFraction:o.completeFraction}}else return}}setState(e,i){var o,a,u;if(typeof e=="object"&&"hoverColor"in e&&i==null){c(this,A).hoverColor=(o=e.hoverColor)!=null?o:c(this,A).hoverColor;return}let n=ka(c(this,A),e);if(n!=null){if(n.type==="custom-geometry"){let s=c(this,A).entity3DMap.get(n.id);if(s instanceof dt&&s.components[0]instanceof yo){let p=i;lo(n,p.visible),Ef(n,p.altitude),wf(n,p.position,this.convertTo3DMapPosition),If(n,W(this,fe,Fe).call(this,p.parent,!1))}}else if(n.type==="model"||n.type==="path"){let s=i;de(n,s.interactive,c(this,A))&&c(this,mt).call(this),n.type==="path"&&(s=s,xb(n,s),lo(n,s.visible))}else if(n.type==="group-container"){let s=i;lo(n,s.visible)&&(c(this,_).outlineInterpolationSystem.dirty=!0),de(n,s.interactive,c(this,A))&&c(this,mt).call(this),Ef(n,s.altitude)}else if(n.type==="geometry-group"){let s=i;lo(n,s.visible)&&(c(this,_).outlineInterpolationSystem.dirty=!0),gb(n,c(this,A),s)&&(c(this,_).outlineInterpolationSystem.dirty=!0),Lf(n,s.outline)&&(c(this,_).outlineInterpolationSystem.geometries3DDirty=!0),vb(n,s.shading),wb(n,c(this,A),s.opacity),de(n,s.interactive,c(this,A))&&(c(this,mt).call(this),c(this,Ct).call(this))}else if(n.type==="geometry"){if(n.components[0]instanceof Jt){let s=i;lo(n,s.visible)&&(c(this,_).outlineInterpolationSystem.geometries3DDirty=!0),Lf(n,s.outline)&&(c(this,_).outlineInterpolationSystem.geometries3DDirty=!0),bb(n,s),Tb(n,s.hoverColor),de(n,s.interactive,c(this,A))}c(this,mt).call(this)}else if(n.type==="label"||n.type==="marker"){let s=i;Pb(n,i),Sb(n,i)&&c(this,Ct).call(this),Mb(n,(a=s.options)==null?void 0:a.rank)&&c(this,Ct).call(this),wf(n,s.position,this.convertTo3DMapPosition),If(n,W(this,fe,Fe).call(this,s.parent,!1))&&(c(this,Ct).call(this),c(this,_).panBoundsSystem.dirty=!0),Cb(n,s.enabled),de(n,(u=s.options)==null?void 0:u.interactive,c(this,A))&&c(this,Ct).call(this)}this.render()}}convertTo3DMapPosition(e,i,n=0,o){var s,p,f,m;if(Array.isArray(e))return this.convertTo3DMapPosition(e[1],e[0],0,typeof i=="function"?i:void 0);if(typeof i!="number")throw new Error("convertTo3DMapPosition failed: longitude must be a number");let{x:a,y:u}=vu((p=(s=c(this,A).center)==null?void 0:s[1])!=null?p:0,(m=(f=c(this,A).center)==null?void 0:f[0])!=null?m:0,e,i);return o?(o.set(a,u,n),o):new j(a,u,n)}getCenter(e){let i=Array.isArray(e)?e:this.getBoundingBox(e);return i?mv(i):void 0}isInView(e){let i=ka(c(this,A),e);if(c(this,xs).identity().multiply(c(this,Tt).projectionMatrix).multiply(c(this,Tt).matrixWorldInverse),c(this,un).setFromProjectionMatrix(c(this,xs)),i instanceof ge)return c(this,un).containsPoint(i.position);if(i instanceof dt){let n=i==null?void 0:i.components[0];if(n instanceof yo||n instanceof ui)return c(this,un).containsPoint(this.convertTo3DMapPosition(n.feature.geometry.coordinates));if(n instanceof Jt){let o=new Te(this.convertTo3DMapPosition(n.featureBbox[1],n.featureBbox[0],0),this.convertTo3DMapPosition(n.featureBbox[3],n.featureBbox[2],0));return c(this,un).intersectsBox(o)}}return!1}getSystems(){return c(this,_)}getInternalState(){return c(this,A)}};se=new WeakMap,Tt=new WeakMap,hs=new WeakMap,go=new WeakMap,pi=new WeakMap,on=new WeakMap,an=new WeakMap,sn=new WeakMap,vo=new WeakMap,ds=new WeakSet,xm=l(function(e){var i;c(this,ln)!=="outdoors-overlay"&&((i=this.map)==null||i.setPixelRatio(e)),c(this,A).pixelRatio=this.resolutionScale},"#setResolutionScale"),A=new WeakMap,lt=new WeakMap,Ge=new WeakMap,vt=new WeakMap,ar=new WeakMap,Se=new WeakMap,_=new WeakMap,fs=new WeakMap,Ct=new WeakMap,mt=new WeakMap,vc=new WeakSet,b4=l(function(){E(this,lt,document.createElement("div")),c(this,lt).classList.add("mappedin__smart-collision-engine__container"),E(this,Ge,document.createElement("canvas")),c(this,Ge).classList.add("mappedin__smart-collision-engine-debug__container"),this.container.appendChild(c(this,lt)),E(this,vt,document.createElement("canvas")),c(this,vt).classList.add("mappedin__smart-collision-engine__container"),c(this,vt).width=c(this,lt).clientWidth*this.resolutionScale,c(this,vt).height=c(this,lt).clientHeight*this.resolutionScale,c(this,vt).style.width=c(this,lt).clientWidth+"px",c(this,vt).style.height=c(this,lt).clientHeight+"px",c(this,lt).appendChild(c(this,Ge)),c(this,lt).appendChild(c(this,vt)),c(this,Ge).width=c(this,lt).clientWidth,c(this,Ge).height=c(this,lt).clientHeight,c(this,vt).width=c(this,lt).clientWidth*this.resolutionScale,c(this,vt).height=c(this,lt).clientHeight*this.resolutionScale,c(this,vt).style.width=c(this,lt).clientWidth+"px",c(this,vt).style.height=c(this,lt).clientHeight+"px"},"#renderEntity2DContainer"),bc=new WeakSet,C4=l(function(){E(this,ar,document.createElement("div")),c(this,ar).classList.add("mappedin-2d-entities"),Object.assign(c(this,ar).style,{position:"absolute",top:"0",left:"0",bottom:"0",right:"0",pointerEvents:"none","z-index":1,"transform-style":"preserve-3d"}),this.container.appendChild(c(this,ar))},"#renderEntityDOMContainer"),Cc=new WeakSet,x4=l(function(){c(this,vt).width=c(this,lt).clientWidth*this.resolutionScale,c(this,vt).height=c(this,lt).clientHeight*this.resolutionScale,c(this,vt).style.width=c(this,lt).clientWidth+"px",c(this,vt).style.height=c(this,lt).clientHeight+"px",c(this,Ge).width=c(this,lt).clientWidth,c(this,Ge).height=c(this,lt).clientHeight,c(this,vt).width=c(this,lt).clientWidth*this.resolutionScale,c(this,vt).height=c(this,lt).clientHeight*this.resolutionScale,c(this,vt).style.width=c(this,lt).clientWidth+"px",c(this,vt).style.height=c(this,lt).clientHeight+"px",c(this,_).collisionSystem.dirty=!0},"#resizeCollisionCanvas"),ln=new WeakMap,ms=new WeakMap,ys=new WeakMap,bo=new WeakMap,xc=new WeakMap,gs=new WeakMap,vs=new WeakMap,bs=new WeakMap,Co=new WeakMap,fe=new WeakSet,Fe=l(function(e,i=!0){if(!e)return i?c(this,A).entityScene:void 0;if(typeof e=="string"||typeof e=="number"){let n=c(this,A).entity3DMap.get(e);return n instanceof Pt?n:(G.warn("Parent is not a valid container, adding to scene"),i?c(this,A).entityScene:void 0)}else if(e.type==="group-container"){let n=c(this,A).entity3DMap.get(e.id);if(n instanceof Pt)return n}return i?c(this,A).entityScene:void 0},"#getParentContainer"),Cs=new WeakSet,Sm=l(function(e,i,n){let o=new ge(i,this.convertTo3DMapPosition(e[1],e[0],e[2]||n||0));return c(this,A).entity2DMap.set(o.id,o),o},"#createEntity2D"),un=new WeakMap,xs=new WeakMap,ee=new WeakMap,re=new WeakMap,l(wm,"Core");var Cm=wm,Ss=Cm;d();function iT(r,t){nT(r,t)(r.getScene(),t),t.addFolder("Export").add({export:async()=>{let n=await r.getCurrentSceneGLTF({binary:!0}),o=new Blob([n],{type:"application/octet-stream"});var a=document.createElement("a");document.body.appendChild(a),a.style.display="none";let u=window.URL.createObjectURL(o);a.href=u,a.download="scene.glb",a.click(),window.URL.revokeObjectURL(u)}},"export")}l(iT,"mountSceneGraphVisualizer");function nT(r,t){let e=t;return l(function i(n,o){let a=o.addFolder(`${[n.type]} ${n.id.slice(0,16)}`);if(o.close(),n.type==="geometry"||n.type==="model"||n.type==="path"){let u={set visible(s){let p=r.getState(n.id);((p==null?void 0:p.type)==="geometry"||(p==null?void 0:p.type)==="path")&&r.setState(n,{visible:s})},get visible(){let s=r.getState(n.id);return(s==null?void 0:s.type)==="geometry"||(s==null?void 0:s.type)==="path"?s.visible:!1},set outline(s){let p=r.getState(n.id);(p==null?void 0:p.type)==="geometry"&&r.setState(n,{outline:s})},get outline(){let s=r.getState(n.id);return(s==null?void 0:s.type)==="geometry"?s.outline:!1},get color(){let s=r.getState(n.id);return(s==null?void 0:s.type)==="geometry"&&s.color?B(s.color).toHexString():"#ffffff"},set color(s){let p=r.getState(n.id);(p==null?void 0:p.type)==="geometry"&&r.setState(p,{color:s})},set interactive(s){let p=r.getState(n.id);((p==null?void 0:p.type)==="geometry"||(p==null?void 0:p.type)==="model"||(p==null?void 0:p.type)==="path")&&(r.setState(n,{interactive:s}),e.controllersRecursive().forEach(f=>f.updateDisplay()))},get interactive(){let s=r.getState(n.id);return(s==null?void 0:s.type)==="geometry"||(s==null?void 0:s.type)==="model"||(s==null?void 0:s.type)==="path"?s.interactive:!1},get completeFraction(){let s=r.getState(n.id);return(s==null?void 0:s.type)==="path"?s.completeFraction:1},set completeFraction(s){let p=r.getState(n.id);(p==null?void 0:p.type)==="path"&&r.setState(p,{completeFraction:s})},focus:()=>{}};a.add(u,"focus").onChange(()=>{let s=r.getState(n.id);(s==null?void 0:s.type)==="model"||(s==null?void 0:s.type)==="path"?r.camera.focusOn([s.position]):(s==null?void 0:s.type)==="geometry"&&r.camera.focusOn(r.getBoundingBox(s))}),a.add(u,"interactive"),n.type==="path"&&a.add(u,"completeFraction",0,1,.1),a.add(u,"visible"),n.type!=="model"&&(a.addColor(u,"color"),a.add(u,"outline"))}else if(n.type==="marker"){let u={get interactive(){var p;let s=r.getState(n.id);return(s==null?void 0:s.type)==="marker"?(p=s.options)==null?void 0:p.interactive:!1},set interactive(s){let p=r.getState(n.id);(p==null?void 0:p.type)==="marker"&&(r.setState(p,{options:{interactive:s}}),e.controllersRecursive().forEach(f=>f.updateDisplay()))},focus:()=>{}};a.add(u,"focus").onChange(()=>{let s=r.getState(n.id);(s==null?void 0:s.type)==="marker"&&r.camera.focusOn([s.position])}),a.add(u,"interactive")}else if(n.type==="label"){let u={get interactive(){var p;let s=r.getState(n.id);return(s==null?void 0:s.type)==="label"?(p=s.options)==null?void 0:p.interactive:!1},set interactive(s){let p=r.getState(n.id);(p==null?void 0:p.type)==="label"&&(r.setState(p,{options:{interactive:s}}),e.controllersRecursive().forEach(f=>f.updateDisplay()))},get text(){let s=r.getState(n.id);return(s==null?void 0:s.type)==="label"?s.text:""},set text(s){let p=r.getState(n.id);(p==null?void 0:p.type)==="label"&&r.setState(p,{text:s})},get"Text Color"(){var p,f;let s=r.getState(n.id);return(s==null?void 0:s.type)==="label"?(f=(p=s.options.appearance)==null?void 0:p.text)==null?void 0:f.foregroundColor:"#000000"},set"Text Color"(s){let p=r.getState(n.id);(p==null?void 0:p.type)==="label"&&r.setState(n.id,{text:u.text,options:{appearance:{text:{foregroundColor:s}}}})},get"Text Size"(){var p,f;let s=r.getState(n.id);return(s==null?void 0:s.type)==="label"?(f=(p=s.options.appearance)==null?void 0:p.text)==null?void 0:f.size:10},set"Text Size"(s){let p=r.getState(n.id);(p==null?void 0:p.type)==="label"&&r.setState(p,{text:u.text,options:{appearance:{text:{size:s}}}})},get"Icon Size"(){var p,f;let s=r.getState(n.id);return(s==null?void 0:s.type)==="label"?(f=(p=s.options.appearance)==null?void 0:p.marker)==null?void 0:f.iconSize:10},set"Icon Size"(s){let p=r.getState(n.id);(p==null?void 0:p.type)==="label"&&r.setState(p,{text:u.text,options:{appearance:{marker:{iconSize:s}}}})},get"Active Foreground Color"(){var p,f,m;let s=r.getState(n.id);return(s==null?void 0:s.type)==="label"?(m=(f=(p=s.options.appearance)==null?void 0:p.marker)==null?void 0:f.foregroundColor)==null?void 0:m.active:"#000000"},set"Active Foreground Color"(s){var f,m;let p=r.getState(n.id);(p==null?void 0:p.type)==="label"&&r.setState(p,{text:u.text,options:{appearance:{marker:{foregroundColor:{...(m=(f=p.options.appearance)==null?void 0:f.marker)==null?void 0:m.foregroundColor,active:s}}}}})},get"Inactive Foreground Color"(){var p,f,m;let s=r.getState(n.id);return(s==null?void 0:s.type)==="label"?(m=(f=(p=s.options.appearance)==null?void 0:p.marker)==null?void 0:f.foregroundColor)==null?void 0:m.inactive:"#000000"},set"Inactive Foreground Color"(s){var f,m;let p=r.getState(n.id);(p==null?void 0:p.type)==="label"&&r.setState(p,{text:u.text,options:{appearance:{marker:{foregroundColor:{...(m=(f=p.options.appearance)==null?void 0:f.marker)==null?void 0:m.foregroundColor,inactive:s}}}}})},get"Active Background Color"(){var p,f,m;let s=r.getState(n.id);return(s==null?void 0:s.type)==="label"?(m=(f=(p=s.options.appearance)==null?void 0:p.marker)==null?void 0:f.backgroundColor)==null?void 0:m.active:"#000000"},set"Active Background Color"(s){var f,m;let p=r.getState(n.id);(p==null?void 0:p.type)==="label"&&r.setState(p,{text:u.text,options:{appearance:{marker:{backgroundColor:{...(m=(f=p.options.appearance)==null?void 0:f.marker)==null?void 0:m.backgroundColor,active:s}}}}})},get"Inactive Background Color"(){var p,f,m;let s=r.getState(n.id);return(s==null?void 0:s.type)==="label"?(m=(f=(p=s.options.appearance)==null?void 0:p.marker)==null?void 0:f.backgroundColor)==null?void 0:m.inactive:"#000000"},set"Inactive Background Color"(s){var f,m;let p=r.getState(n.id);(p==null?void 0:p.type)==="label"&&r.setState(p,{text:u.text,options:{appearance:{marker:{backgroundColor:{...(m=(f=p.options.appearance)==null?void 0:f.marker)==null?void 0:m.backgroundColor,inactive:s}}}}})},focus:()=>{}};a.add(u,"focus").onChange(()=>{let s=r.getState(n.id);(s==null?void 0:s.type)==="label"&&r.camera.focusOn([s.position])}),a.add(u,"interactive"),a.add(u,"text"),a.add(u,"Text Size",10,50),a.add(u,"Icon Size",10,50),a.addColor(u,"Text Color"),a.addColor(u,"Active Background Color"),a.addColor(u,"Inactive Background Color"),a.addColor(u,"Active Foreground Color"),a.addColor(u,"Inactive Foreground Color")}else if(n.type==="geometry-group"){let u={get opacity(){let s=r.getState(n.id);return(s==null?void 0:s.type)==="geometry-group"?s.opacity:1},set opacity(s){let p=r.getState(n.id);(p==null?void 0:p.type)==="geometry-group"&&r.setState(n,{opacity:s})},set visible(s){let p=r.getState(n.id);(p==null?void 0:p.type)==="geometry-group"&&r.setState(n,{visible:s})},get visible(){let s=r.getState(n.id);return(s==null?void 0:s.type)==="geometry-group"?s.visible:!1},set outline(s){let p=r.getState(n.id);(p==null?void 0:p.type)==="geometry-group"&&r.setState(n,{outline:s})},get outline(){let s=r.getState(n.id);return(s==null?void 0:s.type)==="geometry-group"?s.outline:!1},set interactive(s){let p=r.getState(n.id);(p==null?void 0:p.type)==="geometry-group"&&(r.setState(n,{interactive:s}),e.controllersRecursive().forEach(f=>f.updateDisplay()))},get interactive(){let s=r.getState(n.id);return(s==null?void 0:s.type)==="geometry-group"?s.interactive:!1},get shadingStart(){var p,f;let s=r.getState(n.id);return(s==null?void 0:s.type)==="geometry-group"&&(f=(p=s.shading)==null?void 0:p.start)!=null?f:0},set shadingStart(s){let p=r.getState(n.id);(p==null?void 0:p.type)==="geometry-group"&&r.setState(p,{shading:{start:s}})},get shadingEnd(){var p,f;let s=r.getState(n.id);return(s==null?void 0:s.type)==="geometry-group"&&(f=(p=s.shading)==null?void 0:p.end)!=null?f:0},set shadingEnd(s){let p=r.getState(n.id);(p==null?void 0:p.type)==="geometry-group"&&r.setState(p,{shading:{end:s}})},get shadingIntensity(){var p,f;let s=r.getState(n.id);return(s==null?void 0:s.type)==="geometry-group"&&(f=(p=s.shading)==null?void 0:p.intensity)!=null?f:0},set shadingIntensity(s){let p=r.getState(n.id);(p==null?void 0:p.type)==="geometry-group"&&r.setState(p,{shading:{intensity:s}})}};a.add(u,"visible"),a.add(u,"opacity",0,1,.1),a.add(u,"interactive"),a.add(u,"outline"),a.add(u,"shadingStart",0,1,.1),a.add(u,"shadingEnd",0,1,.1),a.add(u,"shadingIntensity",0,1,.1)}else if(n.type==="group-container"){let u={set visible(s){let p=r.getState(n.id);(p==null?void 0:p.type)==="group-container"&&r.setState(n,{visible:s})},get visible(){let s=r.getState(n.id);return(s==null?void 0:s.type)==="group-container"?s.visible:!1},set interactive(s){let p=r.getState(n.id);(p==null?void 0:p.type)==="group-container"&&(r.setState(p,{interactive:s}),e.controllersRecursive().forEach(f=>f.updateDisplay()))},get interactive(){let s=r.getState(n.id);return(s==null?void 0:s.type)==="group-container"?s.interactive:!1}};a.add(u,"visible"),a.add(u,"interactive")}if(a.close(),n.children)for(let u of n.children.values())i(u,a)},"parseChild")}l(nT,"createParseChild");var S4="https://tiles-cdn.mappedin.com/styles/mappedin/style.json",oT="https://auth.mappedin.com/oauth2/token";async function M4(r,t){var e,i,n,o,a;if((e=t==null?void 0:t.outdoorView)!=null&&e.enabled&&((i=t==null?void 0:t.outdoorView)!=null&&i.headers)){let{Map:u,MercatorCoordinate:s}=await import("./outdoor-context-v4-DXJCYOAT.js"),p=t.outdoorView.headers;p==null&&(p=await dv(oT));let f=t.center||[0,0],m=new u({container:r,style:t.outdoorView.style||S4,center:f,attributionControl:!1,zoom:(n=t.zoomLevel)!=null?n:Mm,pitch:(o=t.pitch)!=null?o:Pm,bearing:(a=t.bearing)!=null?a:Tm,transformRequest:T=>{var L;return{url:T,headers:(L=t.outdoorView)==null?void 0:L.headers}},trackResize:!1,pixelRatio:oi(),antialias:typeof t.antialias=="boolean"?t.antialias:!0,boxZoom:!1,doubleClickZoom:!1,scrollZoom:!1,dragPan:!1,dragRotate:!1,keyboard:!1,touchZoomRotate:!1}),y=m.painter.context.gl,x=new Ss(r,{center:f,zoomLevel:m.getZoom(),pitch:m.getPitch(),bearing:m.getBearing(),gl:y,map:m,mode:"outdoors-interleaved",watermark:t.watermark,attribution:t.attribution,antialias:t.antialias}),S={center:m.getCenter().toArray(),zoom:m.getZoom(),bearing:m.getBearing(),pitch:m.getPitch()};m.setMinZoom(x.camera.minZoomLevel),m.setMaxZoom(x.camera.maxZoomLevel),x.on("camera-change",T=>{S.center=T.center,S.zoom=T.zoomLevel,S.bearing=-T.bearing,S.pitch=T.pitch,m.jumpTo(S)});let M=s.fromLngLat(f,0),g=bu(M,x.viewCamera,x.camera,()=>{x.renderSync()});m.on("style.load",async()=>{m&&(m.addLayer(g),x.renderSync())});let C=!1,I=!1;m.on("idle",()=>{m&&(C||(x.publish("outdoor-view-loaded"),C=!0),I||(x.publish("outdoor-style-loaded"),I=!0))});let w=l(T=>{T&&(T.sourceDataType==="metadata"||T.sourceDataType==="visibility"||T.dataType==="style"||T.type==="terrain")&&x.getSystems().htmlControlsSystem.updateData(m)},"updateData");return m.on("styledata",T=>{m&&T&&T.dataType==="style"&&T.type==="styledata"&&(I=!1),w(T)}),m.on("sourcedata",w),m.on("terrain",w),m.on("error",T=>{var L;if(((L=T.error)==null?void 0:L.url)===S4){G.error(`Failed to load outdoor view style, possibly due to invalid token "${p["x-mappedin-tiles-key"]}"`);return}G.warn(T)}),x}else return new Ss(r,t)}l(M4,"createRenderer");var Ms=Ar(Kn());var Sc=30,aT=1e3,xo,Ps,Im=class Im extends et{constructor(e,i){super();this.api=e;this.core=i;P(this,xo,void 0);P(this,Ps,0);v(this,"includedFloors",[]);v(this,"expanded",!1);i.on("camera-change",n=>{var u;let o=Math.floor(n.elevation/Sc),a=(u=this.includedFloors[o])==null?void 0:u.id;this.expanded&&a&&a!==this.api.currentFloorId&&(this.api.currentFloorId=this.includedFloors[o].id,this.api.publish("floor-change",{reason:"elevation-change",floorId:this.api.currentFloorId}))})}get percentExpanded(){return c(this,Ps)}set percentExpanded(e){let i=pe(e,0,1,0,Sc);this.includedFloors.forEach((n,o)=>{this.core.setState(n.containerId,{visible:!0,altitude:i*o})}),E(this,Ps,e)}animateToCurrentFloor(){let e=this.includedFloors.indexOf(this.api.currentFloor)*Sc;new Ms.default.Tween({elevation:this.core.camera.elevation}).to({elevation:e},1e3).easing(Ms.default.Easing.Quadratic.Out).onUpdate(({elevation:i})=>{this.core.camera.setElevation(i),this.core.render()}).onComplete(()=>{this.api.publish("floor-change",{reason:"",floorId:this.api.currentFloorId})}).start(),this.core.render()}expand(e){return this.includedFloors=this.api.floors.filter(i=>!(e!=null&&e.excludeFloorIds.includes(i.id))),this.includedFloors.length<=1?Promise.resolve():this.animate("expand")}collapse(){return this.expanded===!0?this.animate("collapse"):Promise.resolve()}animate(e){c(this,xo)&&c(this,xo).stop();let i=this.includedFloors.indexOf(this.api.currentFloor)*Sc;return new Promise(n=>{E(this,xo,new Ms.default.Tween({percentExpanded:this.percentExpanded}).to({percentExpanded:e==="expand"?1:"0"},aT).easing(Ms.default.Easing.Quadratic.Out).onUpdate(({percentExpanded:o})=>{this.core.camera.setElevation(i*o),this.percentExpanded=o,this.core.render()}).onComplete(()=>{this.expanded=e==="expand",this.includedFloors.forEach(o=>{this.core.setState(o.containerId,{visible:e==="collapse"?o.id===this.api.currentFloorId:!0})}),this.core.getSystems().cameraSystem.enablePedestal=e==="expand",this.core.getSystems().cameraSystem.enablePan=e==="collapse",n(),this.publish(e==="expand"?"expanded":"collapsed")}).onStart(()=>{this.includedFloors.forEach(o=>{this.core.setState(o.containerId,{visible:!0})})}).start()),this.core.render()})}};xo=new WeakMap,Ps=new WeakMap,l(Im,"StackedMaps");var Mc=Im;var sT={linear:cn.default.Easing.Linear.None,"ease-in":cn.default.Easing.Quadratic.In,"ease-out":cn.default.Easing.Quadratic.Out,"ease-in-out":cn.default.Easing.Quadratic.InOut},Em=class Em extends et{floors;currentFloorId="";id;renderer;mvf;styleMap;StackedMaps;animations=new Map;get currentFloor(){return this.floors.find(t=>t.id===this.currentFloorId)}setFloor(t,e){if(this.currentFloorId!==t){if(this.publish("floor-change-start",{floorId:t}),this.currentFloorId=t,this.StackedMaps.expanded)return this.StackedMaps.animateToCurrentFloor();this.floors.forEach(i=>{i.id===t?this.renderer.setState(i.containerId,{visible:!0}):this.renderer.setState(i.containerId,{visible:!1})}),this.publish("floor-change",{reason:e,floorId:this.currentFloor.id})}}cancelAnimation(t){let e=this.animations.get(t);e&&(e.tween.stop(),e.resolver(),this.animations.delete(t))}Models={add:(t,e,i)=>{let{floorId:n,...o}=i,a=i!=null&&i.floorId?this.floors.find(s=>s.id===i.floorId):this.floors[0],u=this.renderer.addModelGroup(t,{type:"FeatureCollection",features:e.map(s=>{var p;return{type:"Feature",properties:{id:ut(),rotation:(p=s.rotation)==null?void 0:p.map(f=>f*(Math.PI/180)),scale:s.scale,interactive:s.interactive},geometry:{type:"Point",coordinates:ri(s.target)}}})},{url:o.url},a.id);return this.renderer.getState(u).children},remove:(t,e)=>{this.renderer.remove(t),this.renderer.getState(e).children.length===0&&this.renderer.remove(e)}};Markers={add:(t,e,i={})=>{let{floorId:n,...o}=i,a=i!=null&&i.floorId?this.floors.find(u=>u.id===i.floorId):this.floors[0];return this.renderer.addMarker2D(t,e,o,a.id)},remove:t=>{this.renderer.remove(t)},getContentEl:t=>{let e=this.renderer.getState(t);if((e==null?void 0:e.type)==="marker")return e.element},removeAll:()=>{},setPosition:(t,e,i)=>{let n=this.renderer.getState(t);if(!n){G.error(`Failed to retrieve state for Marker with id "${t}".`);return}if(n.type!=="marker"){G.error(`Geometry with id "${t}" is not of type "marker".`);return}this.renderer.setState(n,{position:e,parent:i!=null?i:this.currentFloorId})},animateTo:(t,e,i,n)=>{let o=this.renderer.getState(t);if(!o)return G.error(`Failed to retrieve state for Marker with id "${t}".`),Promise.resolve();if(o.type!=="marker")return G.error(`Geometry with id "${t}" is not of type "marker".`),Promise.resolve();let a={duration:1e3,easing:"ease-in-out",...n};this.cancelAnimation(t);let u;new cn.default.Tween({lon:o.position[0],lat:o.position[1]}).to({lon:e[0],lat:e[1]},a.duration).easing(sT[a.easing]).onUpdate(({lon:p,lat:f})=>{this.Markers.setPosition(t,[p,f],i),this.renderer.render()}).onComplete(()=>{u()}).start();let s=new Promise(p=>{u=p});return this.renderer.render(),s}};Exporter={getCurrentSceneGLTF:async t=>this.renderer.getCurrentSceneGLTF(t)};CustomGeometries={add:(t,e,i)=>{let n=i!=null&&i.floorId?this.floors.find(a=>a.id===(i==null?void 0:i.floorId)):this.floors[0],o=ut();return this.renderer.addGeometryGroup(o,t,e,n.id),o},remove:t=>(this.renderer.remove(t.id),t.id)};Labels={all:({onCreate:t})=>{let e=0;for(let i of Object.entries(this.mvf.space)){let[n,o]=i;o&&(o.features.forEach(a=>{var f,m;let u=(f=this.styleMap[a.properties.id])==null?void 0:f.showImage,s=(m=a.properties.details)==null?void 0:m.images,p;if(u&&s&&s.length>0&&(p={marker:{icon:s[0].url}}),a.properties.center&&a.properties.externalId!==""){let y=this.renderer.addLabel2D(a.properties.center,a.properties.externalId,{id:a.properties.id+"-label",appearance:p},n);t(y.id,a.properties.externalId)}}),e++)}},add:(t,e,i={})=>{let{floorId:n,...o}=i,a=i!=null&&i.floorId?this.floors.find(s=>s.id===(i==null?void 0:i.floorId)):this.floors[0],u=this.renderer.addLabel2D(t,e,o,a.containerId);if(!u)throw new Error("label creating failed");return u},remove:t=>{this.renderer.remove(t)},removeAll:()=>{}};Paths={add:(t,e)=>new Promise(i=>{let n=[],o=t[0].floorId||"root",a=0;for(let s of t){let{floorId:p="root",latitude:f,longitude:m}=s;p!==o&&(a++,o=p),n[a]==null&&n.push({floorId:p,coordinates:[]}),n[a].coordinates.push([m,f])}let u=n.map(({floorId:s,coordinates:p})=>this.renderer.addPath({type:"FeatureCollection",features:p.map(f=>({type:"Feature",properties:{},geometry:{type:"Point",coordinates:f}}))},e,s));new cn.default.Tween({fraction:0}).to({fraction:1},(e==null?void 0:e.drawDuration)||1e3).onUpdate(({fraction:s})=>{u.forEach(p=>{this.renderer.setState(p.id,{completeFraction:s})})}).onComplete(()=>{i(u)}).start()}),remove:t=>{t.forEach(e=>{this.renderer.remove(e)})}};constructor(t,e,i,n={},o){super(),this.renderer=o,this.id=t,this.renderer.addGroupContainer(t,{},"root"),this.StackedMaps=new Mc(this,this.renderer),this.mvf=e,this.styleMap=i,this.floors=this.mvf["map.geojson"].sort((a,u)=>a.elevation-u.elevation).map(a=>{var s,p;if(t!=="outdoors-container"&&((s=e.space[a.id])==null?void 0:s.features.length)===0&&((p=e.obstruction[a.id])==null?void 0:p.features.length)===0)return;let u=new fu(t,a,this.renderer,n,e,i);return u.load(),u}).filter(Boolean),this.setFloor(this.floors[0].id)}};l(Em,"GeojsonApiMapObject");var Ts=Em;d();var Ve,Is,Lm=class Lm{constructor({currentMapGetter:t}){P(this,Ve,new Map);P(this,Is,void 0);E(this,Is,t)}get currentMap(){return c(this,Is).call(this)}getById(t){return c(this,Ve).get(t)}add(t,e,i){let n=$e(t);if(!n)throw new Error("get coordinate failed");let o=this.currentMap;if(!o)throw new Error("currentMap should exist");let{id:a}=o.Markers.add(ri(n),e,{...i,floorId:n.floorId,rank:(i==null?void 0:i.rank)||"medium",dynamicResize:(i==null?void 0:i.dynamicResize)||!1}),u=o.Markers.getContentEl(a.toString());if(!u)throw new Error("marker component should exist");let s=new Bi(a.toString(),u,()=>{});return c(this,Ve).set(s.id,{marker:s,entityId:a.toString()}),s}remove(t){var i;let e=c(this,Ve).get(t.id);e&&((i=this.currentMap)==null||i.Markers.remove(e.entityId),c(this,Ve).delete(t.id.toString()))}removeAll(){let t=[];return c(this,Ve).forEach(({marker:e})=>{this.remove(e),t.push(e),c(this,Ve).delete(e.id.toString())}),t}setPosition(t,e){var a;let i=$e(e);if(!i){G.error("Cannot determine coordinate from target.");return}let n=this.currentMap;if(!n){G.error("Cannot determine the current map.");return}let o=c(this,Ve).get(t.id);if(!o){G.error(`Cannot find the Marker with id "${t.id}".`);return}n.Markers.setPosition(o.entityId,ri(i),(a=i.floorId)!=null?a:n.currentFloorId)}animateTo(t,e,i){var u;let n=$e(e);if(!n)return G.error("Cannot determine coordinate from target."),Promise.resolve();let o=this.currentMap;if(!o)return G.error("Cannot determine the current map."),Promise.resolve();let a=c(this,Ve).get(t.id);return a?o.Markers.animateTo(a.entityId,ri(n),(u=n.floorId)!=null?u:o.currentFloorId,i):(G.error(`Cannot find the Marker with id "${t.id}".`),Promise.resolve())}};Ve=new WeakMap,Is=new WeakMap,l(Lm,"Markers");var ws=Lm;d();var sr,Ls,_m=class _m{constructor({currentMapGetter:t}){P(this,sr,new Map);P(this,Ls,void 0);E(this,Ls,t)}get currentMap(){return c(this,Ls).call(this)}getById(t){return c(this,sr).get(t)}add(t,e){let i=Array.isArray(t)?t:[t],n=i.reduce((u,s)=>{var f;let p=$e(s.target);return p?(u.has(p.floorId)||u.set(p.floorId,[]),(f=u.get(p.floorId))==null||f.push({...s,target:p}),u):(G.error("Cannot determine coordinate from options."),u)},new Map);if(!i.length)throw new Error("targets should not be empty when adding a model");let o=this.currentMap;if(!o)throw new Error("currentMap should exist");let a=[];return n.forEach((u,s)=>{let p=ut();o.Models.add(p,u,{...e,floorId:s}).forEach(({id:m})=>{let y=new ma(m.toString(),p);c(this,sr).set(y.id,{model:y,entityId:m.toString(),groupId:p}),a.push(y)})}),a}remove(t){var i;let e=c(this,sr).get(t.id);e&&((i=this.currentMap)==null||i.Models.remove(e.entityId,e.groupId),c(this,sr).delete(t.id.toString()))}removeAll(){let t=[];return c(this,sr).forEach(({model:e})=>{var n;let i=c(this,sr).get(e.id);i&&(t.push(e),(n=this.currentMap)==null||n.Models.remove(i.entityId,i.groupId),c(this,sr).delete(e.id.toString()))}),t}};sr=new WeakMap,Ls=new WeakMap,l(_m,"Models");var Es=_m;d();var Dr,Ds,Dm=class Dm{constructor({currentMapGetter:t}){P(this,Dr,new Map);P(this,Ds,void 0);E(this,Ds,t)}get currentMap(){return c(this,Ds).call(this)}getById(t){return c(this,Dr).get(t)}async add(t,e){let i=this.currentMap;if(!i)throw new Error("currentMap should exist");let n=await i.Paths.add(t,e),o=new ya(ut());return c(this,Dr).set(o.id,{path:o,entityIds:n.map(a=>a.id.toString())}),o}remove(t){var i;let e=c(this,Dr).get(t.id);e&&((i=this.currentMap)==null||i.Paths.remove(e.entityIds),c(this,Dr).delete(t.id.toString()))}removeAll(){let t=[];return c(this,Dr).forEach(({path:e})=>{this.remove(e),t.push(e),c(this,Dr).delete(e.id.toString())}),t}};Dr=new WeakMap,Ds=new WeakMap,l(Dm,"Paths");var _s=Dm;d();var Pc=Ar(Kn());d();var P4="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAkklEQVRoge3awQ3AIAxD0VAMYf+F0yUixbL8JshXuLSwIqJCwDc9QBeZEOy9p2doAQDTM7TQ2cg5Z3qGFjpHS2YjDiGDe+/0DC0cwkYpJKdnaIFMkY1kymzEIVQcwsYhbPDem56hhc5GHELGIWwcwsYhbJS+2R1CxSFsdH5iO4SMr97Y6FxPqxytVVV+HcTEIWx+9mcIqHSOm9QAAAAASUVORK5CYII=";d();var T4=l((r,t,e=0)=>{if(Math.abs(r)>=Math.PI)throw new Error("Sector angle too wide!");let i=e/Math.tan(r/2),n=e/Math.sin(r/2),o=n+t,a=10,u=new Xe;u.moveTo(n*Math.cos(r/2)-i,n*Math.sin(r/2));for(let s=0;s<a;s++)u.lineTo(o*Math.cos(r/2-r/a*s)-i,o*Math.sin(r/2-r/a*s));for(let s=0;s<a;s++)u.lineTo(e*Math.cos(Math.PI/-2+Math.PI/a*s),e*Math.sin(Math.PI/-2+Math.PI/a*s));return new Ye(u,{depth:.1,bevelEnabled:!1,UVGenerator:uT(t)})},"createSectorGeometry"),Om=l((r,t,e)=>{let n=Math.sqrt(Math.pow(r,2)+Math.pow(t,2))/e;return n>1?n=1:n<0&&(n=0),new Z(0,n)},"generateRadialUV"),uT=l(r=>({generateTopUV:(t,e,i,n,o)=>{let a=e[i*3],u=e[i*3+1],s=e[n*3],p=e[n*3+1],f=e[o*3],m=e[o*3+1];return[Om(a,u,r),Om(s,p,r),Om(f,m,r)]},generateSideWallUV:()=>[new Z(0,1),new Z(0,1),new Z(0,1),new Z(0,1)]}),"radialUVGenerator");var Am="#2266ff",cT=.7,pT=.3;function w4(){let r=new yn({color:Am,opacity:cT,transparent:!0,depthTest:!1,depthWrite:!1}),t=T4(Math.PI/6,L4,E4);new gn().load(P4,i=>{r.alphaMap=i,r.needsUpdate=!0});let e=new Ut(t,r);return e.position.z=-.05,e.renderOrder=3,e}l(w4,"createBearingCone");var I4=l(()=>{let r=new _c(.5,.5,.05,32),t=new yn({transparent:!0,color:Am,opacity:pT,depthTest:!1,depthWrite:!1}),e=new Ut(r,t);e.scale.set(0,0,.05),e.renderOrder=2;let i=new _c(km,km,.05,32),n=new yn({transparent:!0,color:Am,depthTest:!1,depthWrite:!1}),o=new Ut(i,n);return o.renderOrder=3,e.rotation.x=Math.PI/2,o.rotation.x=Math.PI/2,{baseMesh:e,middleMesh:o}},"createBlueDot");var hT={enableHighAccuracy:!0},dT=500,fT=150,mT=150,yT=0,gT=5,vT=5,bT=30,E4=.4,L4=1.25,km=.35,Nm=class Nm extends et{constructor(e,i){super();this.core=e;this.geoJSONApi=i}watcherId=null;geometry;currentGeolocation;positionAnimation;scaleAnimation;rotationAnimation;enable(){this.watcherId&&navigator.geolocation.clearWatch(this.watcherId),this.geometry=this.core.addCustomGeometry("blue-dot",{type:"Feature",properties:{},geometry:{type:"Point",coordinates:[-79.3935,43.6532]}},{setup:e=>{let{baseMesh:i,middleMesh:n}=I4(),o=w4();e.add(i),e.add(n),e.add(o)},update:this.updateGeometryPerFrame},{visible:!1},"outdoors-container"),this.watcherId=navigator.geolocation.watchPosition(this.onPositionUpdate,this.onPositionError,hT)}updateGeometryPerFrame=e=>{var s;let[i,n,o]=e.children,{accuracy:a,heading:u}=((s=this.currentGeolocation)==null?void 0:s.coords)||{};a!=null&&(this.scaleAnimation&&this.scaleAnimation.stop(),this.scaleAnimation=new Pc.default.Tween({scale:i.scale.x}).to({scale:pe(a,vT,bT,yT,gT)},fT).onUpdate(({scale:p})=>{i.scale.set(p,1,p)}).start()),u!=null?(o.visible=!0,this.rotationAnimation&&this.rotationAnimation.stop(),this.rotationAnimation=new Pc.default.Tween({rotation:i.scale.x}).to({rotation:it.degToRad(u)},mT).onUpdate(({rotation:p})=>{o.rotation.z=p}).start()):o.visible=!1};onPositionUpdate=e=>{var i;if(this.currentGeolocation=e,this.geometry){let n=this.core.getState(this.geometry);n.visible===!1&&this.core.setState(this.geometry,{position:[e.coords.longitude,e.coords.latitude],visible:!0}),this.positionAnimation&&this.positionAnimation.stop(),n=this.core.getState(this.geometry);let o;if(e.coords.floorLevel!==void 0){let a=(i=this.geoJSONApi.currentMap)==null?void 0:i.floors[e.coords.floorLevel];o=a==null?void 0:a.id}this.positionAnimation=new Pc.default.Tween(n.position).to([e.coords.longitude,e.coords.latitude],dT).onUpdate(a=>{if(this.geometry){let u={position:a};o==null&&n.parent!=="outdoors-container"?u.parent="outdoors-container":n.parent!==o&&(u.parent=o,this.publish("floor-change",{reason:"blue-dot-floor-change",floorId:o})),this.core.setState(this.geometry,u)}}).start(),this.core.render()}};onPositionError=e=>{switch(e.code){case e.PERMISSION_DENIED:G.error("Geolocation permission denied by the user.",e);break;case e.POSITION_UNAVAILABLE:G.error("Geolocation position unavailable.",e);break;case e.TIMEOUT:G.error("Geolocation request timed out.",e);break;default:G.error("An unknown geolocation error occurred.",e);break}this.disable()};disable(){this.watcherId&&navigator.geolocation.clearWatch(this.watcherId),this.geometry&&(this.core.remove(this.geometry.id),this.geometry=void 0),this.currentGeolocation=void 0}};l(Nm,"BlueDot");var Tc=Nm;d();var Or,Os,Rm=class Rm{constructor({currentMapGetter:t}){P(this,Or,new Map);P(this,Os,void 0);E(this,Os,t)}get currentMap(){return c(this,Os).call(this)}getById(t){return c(this,Or).get(t)}add(t,e,i){let n=this.currentMap;if(!n)throw new Error("currentMap should exist");let o=n.CustomGeometries.add(t,e||{},{floorId:i==null?void 0:i.id}),a=new va(o);return c(this,Or).set(a.id,a),a}remove(t){var i;c(this,Or).get(t.id)&&((i=this.currentMap)==null||i.CustomGeometries.remove(t),c(this,Or).delete(t.id.toString()))}removeAll(){let t=[];return c(this,Or).forEach(e=>{this.remove(e),t.push(e.id),c(this,Or).delete(e.id.toString())}),t}};Or=new WeakMap,Os=new WeakMap,l(Rm,"CustomGeometries");var wc=Rm;d();var ks,Bm=class Bm{constructor({currentMapGetter:t}){P(this,ks,void 0);E(this,ks,t)}get currentMap(){return c(this,ks).call(this)}setFromStyleCollection(t){var e,i,n;for(let o in t)for(let a of((e=this.currentMap)==null?void 0:e.floors)||[])if(t[o]!=null){if(a.layers.has(o)&&"color"in t[o]){let u=a.layers.get(o);(i=this.currentMap)==null||i.renderer.setState(u,{color:t[o].color})}if(o===du&&!(Xi in t)){let u=a.layers.get(Xi);u&&"color"in t[o]&&((n=this.currentMap)==null||n.renderer.setState(u,{color:t[o].color}))}}}};ks=new WeakMap,l(Bm,"Style");var As=Bm;d();var lr,Ns,Fm=class Fm{constructor(t,e){P(this,lr,void 0);P(this,Ns,void 0);E(this,lr,t),E(this,Ns,e||[])}setStyle(t){var e,i;if(c(this,lr).map){(e=c(this,lr).map)==null||e.setStyle(t),(i=c(this,lr).map)==null||i.moveLayer(Aa);for(let[n,o]of c(this,Ns)||[])c(this,lr).hideOutdoorLayersUnderPoint(n,o)}}get map(){return c(this,lr).map}get enabled(){return!!c(this,lr).map}};lr=new WeakMap,Ns=new WeakMap,l(Fm,"Outdoor");var So=Fm;var Gm=class Gm{core;outdoors;mapObjects=[];id;mapDataExternal={};mapsByFloorId={};mapData;currentMap;directions;hiddenOutdoorGeometries=[];mapView;Camera;Labels;Markers;Models;Paths;Exporter;Navigation;Outdoor;BlueDot;CustomGeometries;Style;constructor(t,e){this.core=t,this.mapView=e,this.Camera=new Sa(this.core),this.id=this.core.addGroupContainer("root").id.toString(),this.outdoors=new Ts("outdoors-container",{"map.geojson":[{id:"outdoors",externalId:"outdoors",elevation:0}],"styles.json":{},space:{},entrance:{},obstruction:{}},{},{},this.core),this.mapObjects.push(this.outdoors);let i=new ga(this.Camera);this.core.on("camera-change",()=>{this.mapView.publish("camera-change",i)});let n=l(u=>s=>{var g,C;let p=[],f=[],m=[];s.labels.forEach(I=>{let w=this.Labels.getById(I.toString());w&&p.push(w.label)}),s.markers.forEach(I=>{let w=this.Markers.getById(I.toString());w&&f.push(w.marker)}),s.models.forEach(I=>{let w=this.Models.getById(I.toString());w&&m.push(w.model)});let y=s.geometry[0],x;y&&(x=(g=this.getMapDataInternal())==null?void 0:g.getById("space",y)),x||(x=(C=this.getMapDataInternal())==null?void 0:C.getById("object",y));let S=s.containers.reduce((I,w)=>{var L;let T=(L=this.getMapDataInternal())==null?void 0:L.getById("floor",w);return T&&Nn.is(T)&&I.push(T),I},[]),M={coordinate:new K(s.coordinate[1],s.coordinate[0]),spaces:x&&_e.is(x)?[x]:[],objects:x&&De.is(x)?[x]:[],markers:f,labels:p,models:m,floors:S};"pointerEvent"in s&&(M.pointerEvent=s.pointerEvent),this.mapView.publish(u,M)},"createHandler");this.core.on("hover",n("hover")),this.core.on("click",n("click")),this.core.on("outdoor-view-loaded",()=>{this.mapView.publish("outdoor-view-loaded")}),this.core.on("outdoor-style-loaded",()=>{this.mapView.publish("outdoor-style-loaded")}),this.core.on("user-interaction-start",()=>{this.mapView.publish("user-interaction-start")}),this.core.on("user-interaction-end",()=>{this.mapView.publish("user-interaction-end")});let o=l(()=>this.currentMap,"currentMapGetter");this.Markers=new ws({currentMapGetter:o}),this.Models=new Es({currentMapGetter:o}),this.Labels=new Ea({currentMapGetter:o}),this.Exporter=new Ia({currentMapGetter:o}),this.Paths=new _s({currentMapGetter:o}),this.Navigation=new tu(e),this.BlueDot=new Tc(this.core,this),this.BlueDot.on("floor-change",u=>{this.setFloor(u.floorId,"blue-dot-floor-change")}),this.Outdoor=new So(this.core,this.hiddenOutdoorGeometries),this.CustomGeometries=new wc({currentMapGetter:o}),this.Style=new As({currentMapGetter:o});let a=new au(e,this.mapDataExternal);this.auto=a.auto}updateState(t,e){var n;if(t==="walls"){(n=this.currentMap)==null||n.floors.forEach(o=>{var s,p;let a=o.layers.get(du),u=o.layers.get(Xi);a&&((s=this.core.getState(a))==null||s.children.forEach(f=>{this.core.setState(f.id,e)})),u&&((p=this.core.getState(u))==null||p.children.forEach(f=>{this.core.setState(f.id,e)}))});return}let i=typeof t=="string"?this.getMapDataObject(t):t;if(i){if(Qr.is(i))return this.core.setState(i.id,q3({...e,type:"label"},this.core.getState(i.id)));if(Bi.is(i))return this.core.setState(i.id,$3({...e,type:"marker"},this.core.getState(i.id)));(_e.is(i)||De.is(i))&&this.core.setState(i.id,J3({...e,type:"geometry"},this.core.getState(i.id)))}}getMapDataObject(t){var e;return(e=this.getMapDataInternal())==null?void 0:e.getMapDataById(t)}update=()=>{this.core.render()};getMapDataInternal(){if(this.mapData)return qs.get(this.mapData)}getMapData(){return this.mapData}expand(t){var e;return(e=this.currentMap)==null?void 0:e.StackedMaps.expand({excludeFloorIds:(t==null?void 0:t.excludeFloors.map(i=>i.id))||[]})}collapse(){var t;return(t=this.currentMap)==null?void 0:t.StackedMaps.collapse()}addMap(t,e){return new Promise(i=>{var y,x,S;let n=qs.get(t);if(!n){G.error("error exists"),i(t);return}this.mapDataExternal[t.mapName]=t;let{mvf:o}=n,a=o["manifest.geojson"].features[0].geometry.coordinates;this.core.mode!=="outdoors-overlay"&&this.Camera.set({center:new K(a[0],a[1])});let u=tv(o["styles.json"]||{}),s=o["manifest.geojson"].features[0].properties.name,p=new Ts(`mapObject-${s}`,o,u,e,this.core),f=this.core.getBoundingBox(p.currentFloor.id),m=(x=(y=e==null?void 0:e.outdoorView)==null?void 0:y.layersHiddenByGeometry)!=null?x:[];if(m.length>0){let M=(S=this.core.getCenter(f))!=null?S:a;this.core.hideOutdoorLayersUnderPoint(M,m),this.hiddenOutdoorGeometries.push([M,m])}this.mapObjects.push(p),o["map.geojson"].forEach(M=>{this.mapsByFloorId[M.id]=p}),p.StackedMaps.on("expanded",()=>{this.mapView.publish("expanded")}),p.StackedMaps.on("collapsed",()=>{this.mapView.publish("collapsed")}),p.on("floor-change-start",()=>{this.mapView.publish("floor-change-start",{floor:this.currentFloor})}),p.on("floor-change",M=>{this.mapView.publish("floor-change",{reason:M.reason,floor:this.currentFloor})}),this.currentMap=p,this.mapData=t,this.directions=new cu({nodes:this.currentMap.mvf["node.geojson"],obstructions:this.currentMap.mvf.obstruction,connections:this.currentMap.mvf["connection.json"],groupBy:"map"}),e!=null&&e.zoomLevel||this.core.mode!=="outdoors-overlay"&&this.core.camera.focusOn(f,{duration:0,padding:{top:.05*this.core.canvasHeight,left:.05*this.core.canvasWidth,right:.05*this.core.canvasWidth,bottom:.05*this.core.canvasHeight}}),i(t)})}setFloor(t,e){if(!this.currentMap)throw new Error("mappObject should exist atm");this.currentMap.setFloor(typeof t=="string"?t:t.id,e)}get currentFloor(){var i,n;let t=(i=this.currentMap)==null?void 0:i.currentFloor.id;if(!t)throw new Error("Missing currentFloor object from GeoJsonApi");let e=(n=this.mapData)==null?void 0:n.getById("floor",t);if(!e)throw new Error("Missing currentFloor");return e}getState(t){var n;let e=typeof t=="string"?t:t.id,i=this.core.getState(e);if(i){if(i.type==="geometry")return{type:"geometry",interactive:i.interactive,hoverColor:i.hoverColor,color:i.color,visible:i.visible};if(i.type==="label"&&i.options.appearance&&i.options.rank!==void 0&&i.options.interactive!==void 0)return{type:"label",appearance:i.options.appearance,rank:i.options.rank,enabled:i.enabled,interactive:i.options.interactive};if(i.type==="marker"&&((n=i.options)==null?void 0:n.rank)!==void 0&&i.options.interactive!==void 0){let o=typeof i.parent=="object"?i.parent.id:i.parent;return{type:"marker",rank:i.options.rank,interactive:i.options.interactive,enabled:i.enabled,element:i.element,coordinate:new K(i.position[1],i.position[0],o.toString())}}else if(i.type==="model")return{type:"model"}}}setHoverColor(t){this.core.setState({hoverColor:t})}getHoverColor(){let t=this.core.getState();return(t==null?void 0:t.type)==="map-view"?t.hoverColor:void 0}getDirections=(t,e,i)=>{if(!this.directions)throw new Error("You have to call .addMap() before you can get directions");let n=this.getMapDataInternal();if(!n)throw new Error("getDirections failed due to missing mapData");let{accessible:o=!1,smoothing:a=!0}=i||{},u=Array.isArray(t)?t:[t],s=Array.isArray(e)?e:[e],p=typeof a=="object"?a.enabled:a,f=typeof a=="object"?a.radius:void 0,m={accessible:o,smoothing:{enabled:p!=null?p:!0,radius:f!=null?f:.75}};return this.directions.getDirections(u,s,m,n)};createCoordinate(t,e,i){return new K(t,e,(i==null?void 0:i.id)||this.currentFloor.id)}createCoordinateFromScreenCoordinate(t,e,i){let n=this.core.projectScreenXYToCoordinate(t,e);return n?new K(n[1],n[0],(i==null?void 0:i.id)||this.currentFloor.id):void 0}isInView(t){return this.core.isInView(typeof t=="string"?t:t.id)}auto(){this.Labels.all()}get __core(){return this.core}destroy(){this.core.destroy()}};l(Gm,"GeoJsonApi");var Rs=Gm;var Fs,Q,Vm=class Vm extends et{constructor(e){super();P(this,Fs,{});P(this,Q,void 0);v(this,"Camera");v(this,"Labels");v(this,"Markers");v(this,"Models");v(this,"Paths");v(this,"Exporter");v(this,"Navigation");v(this,"BlueDot");v(this,"Style");v(this,"CustomGeometries");v(this,"Outdoor");v(this,"update",()=>{c(this,Q).core.render()});v(this,"getDirections",(e,i,n)=>c(this,Q).getDirections(e,i,n));v(this,"on",(e,i)=>{super.on(e,i)});v(this,"off",(e,i)=>{super.off(e,i)});let i=new Rs(e,this);E(this,Q,i),this.Camera=c(this,Q).Camera,E(this,Fs,c(this,Q).mapDataExternal),this.Markers=c(this,Q).Markers,this.Models=c(this,Q).Models,this.Labels=c(this,Q).Labels,this.Exporter=c(this,Q).Exporter,this.Paths=c(this,Q).Paths,this.Navigation=c(this,Q).Navigation,this.BlueDot=c(this,Q).BlueDot,this.CustomGeometries=c(this,Q).CustomGeometries,this.Style=c(this,Q).Style,this.auto=c(this,Q).auto,this.Outdoor=c(this,Q).Outdoor}updateState(e,i){return c(this,Q).updateState(e,i)}getMapData(){return c(this,Fs)}expand(e){return c(this,Q).expand(e)}collapse(){return c(this,Q).collapse()}addMap(e,i){return c(this,Q).addMap(e,i)}setFloor(e){c(this,Q).setFloor(e)}get currentFloor(){return c(this,Q).currentFloor}getState(e){return c(this,Q).getState(e)}setHoverColor(e){c(this,Q).setHoverColor(e)}getHoverColor(){return c(this,Q).getHoverColor()}isInView(e){return c(this,Q).isInView(e)}createCoordinate(e,i,n){return c(this,Q).createCoordinate(e,i,n)}createCoordinateFromScreenCoordinate(e,i,n){return c(this,Q).createCoordinateFromScreenCoordinate(e,i,n)}auto(){this.Labels.all()}get __core(){return c(this,Q).core}destroy(){c(this,Q).destroy()}async enableDebug(){let{Inspector:e}=await import("./inspector-W2DIQK3R.js");await new e(this,c(this,Q)).enable()}};Fs=new WeakMap,Q=new WeakMap,l(Vm,"MapView");var Bs=Vm;d();var Hm=class Hm extends et{gl;el=document.createElement("div");core;origin;constructor(t){super(),this.origin=t}onAdd(t){this.origin=this.origin||t.getCenter().toArray(),this.gl=t.painter.context.gl,this.core=new Ss(t._container,{center:this.origin,zoomLevel:t.getZoom(),pitch:t.getPitch(),bearing:t.getBearing(),gl:this.gl,map:t,mode:"outdoors-overlay"}),this.core.camera.setMinZoomLevel(t.getMinZoom()),this.core.camera.setMaxZoomLevel(t.getMaxZoom()),this.core.camera.setMinPitch(t.getMinPitch()),this.core.camera.setMaxPitch(t.getMaxPitch()),t.on("error",n=>{G.warn(n)});let e=zs.fromLngLat(this.origin,0),i=bu(e,this.core.viewCamera,this.core.camera,()=>{this.core.renderSync()});return t.on("style.load",async()=>{t.addLayer(i),this.core.camera.setMinZoomLevel(t.getMinZoom()),this.core.camera.setMaxZoomLevel(t.getMaxZoom()),this.core.camera.setMinPitch(t.getMinPitch()),this.core.camera.setMaxPitch(t.getMaxPitch())}),t.on("move",()=>{let[n,o]=t.getCenter().toArray();this.core.getSystems().cameraSystem.setCenter(n,o),this.core.getSystems().cameraSystem.setZoomLevel(t.getZoom()),this.core.getSystems().cameraSystem.setRotation(it.degToRad(-t.getBearing())),this.core.getSystems().cameraSystem.setTilt(it.degToRad(t.getPitch()))}),this.el}onRemove(){}};l(Hm,"MapLibreOverlay");var Ic=Hm;d();function _4(r){var t,e;if((t=r.outdoorView)!=null&&t.enabled&&!((e=r.outdoorView)!=null&&e.token)){let i=new Error("Missing outdoorView token");throw i.name="MissingOutdoorViewToken",i}}l(_4,"validateOptions");function D4(r,t){var n,o,a,u;let e=((n=r==null?void 0:r.outdoorView)==null?void 0:n.token)||t.outdoorViewToken,i={..._a,...r!=null?r:{},outdoorView:{enabled:((o=r==null?void 0:r.outdoorView)==null?void 0:o.enabled)===void 0?!!e:(a=r==null?void 0:r.outdoorView)==null?void 0:a.enabled,layersHiddenByGeometry:(u=_a.outdoorView)==null?void 0:u.layersHiddenByGeometry,...r==null?void 0:r.outdoorView}};return e&&i.outdoorView&&(i.outdoorView.token=e),i}l(D4,"handleDefault");var Mq=l(async(r,t)=>{let e;if(t){let{access_token:o}=await $s(t);e=o}let i=new aa(r,e);return new Ac(i)},"hydrateMapDataFromMVF"),Pq=l(async r=>{let t={emitAnalyticsEvents:!0,...r},e;if("accessToken"in t)e=t.accessToken;else{let{access_token:s}=await $s(t);e=s}let i=await Rc(t,e),n=await Fc(i),o=Bc(n);typeof r.onMVFParsed=="function"&&r.onMVFParsed(o);let a=new aa(o,e);return new Ac(a)},"getMapData"),pn,Mo,Ec=class Ec extends Ic{constructor(e,i,n){super(e);P(this,pn,void 0);P(this,Mo,void 0);E(this,pn,i),E(this,Mo,n)}onAdd(e){var o,a;super.onAdd(e);let i={..._a,...(o=c(this,Mo))!=null?o:{},outdoorView:{token:c(this,pn).outdoorViewToken,...(a=c(this,Mo))==null?void 0:a.outdoorView}},n=new Bs(this.core);return n.addMap(c(this,pn),i).then(()=>{this.publish("loaded",{mapView:n,mapData:c(this,pn)})}),this.el}};pn=new WeakMap,Mo=new WeakMap,l(Ec,"MappedinMapLibreOverlay"),v(Ec,"instance");var Gs=Ec,Tq=l((r,t)=>{Gs.instance!=null&&G.warn("Only a single map venue is supported at this time.");let e=new Gs([r.mapCenter.longitude,r.mapCenter.latitude],r,t);return Gs.instance=e,e},"createMapLibreOverlay"),CT=l(async(r,t,e)=>{var a,u,s,p,f;let i=D4(e,t);try{e&&_4(e)}catch(m){if(m instanceof Error&&m.name==="MissingOutdoorViewToken")G.error("Enable outdoor view requires a token. Provide token in `options.outdoorView.token`");else throw m}let n=await M4(r,{center:[t.mapCenter.longitude,t.mapCenter.latitude],bearing:i.bearing,pitch:i.pitch,zoomLevel:i.zoomLevel,outdoorView:(a=i.outdoorView)!=null&&a.token?{headers:{"x-mappedin-tiles-key":(u=i.outdoorView)==null?void 0:u.token},style:(s=i.outdoorView)==null?void 0:s.style,enabled:!!((p=i.outdoorView)!=null&&p.enabled)}:void 0,watermark:i.watermark,attribution:i.attribution,antialias:typeof i.antialiasing=="boolean"?i.antialiasing:!!((f=i.antialiasing)!=null&&f.enabled)}),o=new Bs(n);return await o.addMap(t,i),o},"show3dMapGeojson"),wq=CT;export{Bc as a,Fc as b,K as c,Jl as d,Zr as e,_e as f,Nn as g,qr as h,De as i,Kl as j,zr as k,Rn as l,av as m,iT as n,Mq as o,Pq as p,Tq as q,CT as r,wq as s};
950
+ }`;var _4="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAAAAAB5Gfe6AAAQkHpUWHRSYXcgcHJvZmlsZSB0eXBlIGV4aWYAAHjarZpZciQ7rkT/uYpeAicQ5HI4mr0dvOX3ATOl0li3q3SVJkUqFMEBcHc4IuX2///fcf/hK7cSXRatpZXi+cott9h5U/3j63EMPt+fL1/h+fPdeff6NnJMHNPjD2U/7+qcl183aH6eH+/PO52PN7E+B3qZ+Tlgspkjb57X1edAKT7Oh+fvrj3v6/nNdp7ftd057abHnz78npVgLGG8FF3cKSTPz2oXJFaQWuocCz9D0mhnEu8Tx54k6dexc98F77vY+f48n96HwvnyvKB8iNHzfJCvY3cj9HZF4dfM7/6QZ4j+7deb2J2z6jn7sbueC5Eq7rmpl63cd1w4GCrd2wov5Vt4r/fVeFW2OMnYIpuD13ShhUi0T8hhhR5O2Pc4w2SJOe5IuGOMM6Z7rhL+FudNSrZXOFFJz3KpkqtJ1hKn4+tawp233flmqMy8AlfGwGCBOz693Fcn/+b1OtA5Bt0QfH2NFeuKFnCWYZmzn1xFQsJ5xlRufO/LvcGNf5PYRAblhrmywe7HY4gh4Re20s1z4jrx2fkHNYKu5wCEiLmFxYREBnwJSUIJXmPUEIhjJT+dlceU4yADQSSu4A65SamQnBptbu7RcK+NEh+nkRYSIZBGSQ0EIlk5C/jRXMFQlyTZiUgRlSpNekklFymlaDGN6po0q2hR1apNe001V6mlaq211d5iS0iYtNLUtdpa651JO0N37u5c0fuII408ZJSho442+gQ+M0+ZZeqss82+4koL+q+y1K262uo7bKC085Zdtu662+4HrJ108pFTjp562umvWXtm9X3WwofM/T5r4Zk1y1i+1+mvrHFa9WWIYHIiljMyFnMg42oZANDRcuZryDla5ixnvkVIIZGsBbHkrGAZI4N5hygnvObuV+Z+mzcn+Y/yFr/LnLPU/RuZc5a6Z+Y+5+2LrK1+K0q6CTIWWkx9OggbF+zaY+1Wk/766H46wF8ONFY+O8hBMEc7oc4Vdh+8JsE+PUSrVjr70Zz1+H56PH3o9sRR1ql5Ha8bUMQxpe89Tki8Sb0tE23cw3DcfEo+ugnj2G3WEmononVfoag71pVjR+EmAE53eT5tqYfEHl/7ThMusaI+St0jktFa9gKnreiQqCNpZ2mJdSkbaiK6DrovYR4/JhJfRsx5d5EVZnEIPetHnU5KynJPTSuCPuC0lOuXH7n1DNq7DpUtHbhM5lDA0c2bnDCJoOObMnyj+aPjPwx0yiDUxKKsg35VnRnBEVhonKwK5hOk5NttUrhr2+tMOXkPJb1RZ+iAelYjL2MuO3pGRQ78GdxwOOaTAcJZcewq7ilB1RJCSozUdSEdwVJVb6asiBsHH1Bqgbiv3Cmkkis6ktVnZGRRwMNJjUA3Ao2127YWdhAIblxF51hzMcZsVZc0r0dJo5Liqfn41Q+q193SGhhkMkgaLJRNnEpqBtyVvbcVffIk+LE9QPFBTMTQe0aWkMXMnx3dy5sfHreDE60Ql50E+SqRcmfK16L2p0Ol8JFATu3qASXy7SvmiGW2cdMBxsty44CvtLogfGlv7WkCSV0WId2270EaD5Ym40cs+SAwZuNjPSTywAvEfLmzQhtLDntfCnhl/fNmUNnzyA2g76Zn0SP+c+I6bCC0FONUQ4L50e95dif+DH/m9htQjBEhPPpOjYjmm2ChbfEMIUaYtAIxmWJHlilLU8ZRs9pCsHbDpFaRgZljz2QandjDIBPZDGTuoZW1KdlYh52ALzisKJRNWSQmLAWx8iv9mGttT15bBc2oxd57bZtVF98CYtK3UH22Yd/A7WaKa+ZjNTOXEzNhMJ5kmQOvfzsbxbZALJ2xwGBjX2HFQybhi7kpbA7DVpS3RxMJwFyHwGk5gs6a4lrRHVqhYT0QTJC9UZcC9Yrelkn6yXch68NKNtG7CiU3vf/zMZAYXPWdrR9XZ/ctMV1sJQ2wJEGxzaHs7LmmHIwnUwbwnNAapBY9xhE19DNJW3ua0dDk/AjwITacR0PqZxkbyJ+E5jYbxI84x1TBE+y90hwDCYZIM0tqAKPZfCzFrbH8kYCm3eqQkZ2+2GovcL8Suokyg8yyCJes6dcouSLiNSLb0ETJU+/N/WFsBBSOXBbm9Cwp4CzlOag7ro7R2vC19nSsCPmAjIEMiobFwaoVXhjTU2XMpgEsDH/L3Sx54OCTMUSXI/IIA2V4QcLQpwVz12pInI0bY56pIQ2BSGRLL+yLfZ7JkiimbK+aepsbwRStpokx5gCqe1hjdMAwcINbkk5jmedrNRAG5pUXPe0sZIoXy1h7lSDxApzheg24JeDNtDS1oBDBUC4iWZFilBPhZx0Kqx2lihpbG9q4sYidksCN4yRYhNM4nxfBbTi4E3AT6B3igbvs9Gv8ZkHsIfdlep+2HelEDbkJdNjqZQ90B7k6OIoFfkkPNoY+z0gzACa1f2qcBYxVJpT2QQgS19dKQlbC24S92xiEAFRKB5Uy1qrBgOtwIge55G0kRPfIytGx0tMOrGfrijB2FHOk/TKcMjDTMPeBo4FnXD5cQ8vtdgoAN0yuzZQHQI09wm/5vAB6RHyI9rYKiZ6YWC6rbaiLmDtoaToC1bViXQFNtgWsOfEEKCleC3GWPSfgQWRQWMgw/9FDgvOZrFAT3SmsA3DLbqlsSppQG5QeOjPXavUUkxF/qgLM05vW5o7UakuBqo2ZW8Nj0LB7imVJC9QSA+wd7RPztIUZ80xQZq0ROrc8CSVncWzkTA/RwmunldCPAQKjqVC7bhRuTIv0plbk7gOX4m5OAi2YesYZ0KBQRToG8iv9x8dgGtgECYRBeEU87OxoSc8epu+s7Mq/MN0VbBT19dii7ekO66UZwdAMtoAVQd13J5nwZe98OgGslmVqAGBkeLZNVNVlWpV18qihntXKnBZvrDIVgFpx4q5poLqREOVplMPSpTF2KvjBAzDpprkruXIaaUmUD4Xo2yrGWcYlixKIwRFjl0jPQhKznUXZAoSjlg9c/NwAI4p3Q/w5bCNfhUZS7bGfqesHqKAlyZZxZgNrhGevZXccaqBys4NEqB3Vqfptji9uUrhCL6yXFqxtm0hhLyYU3Tjd8I/HZaWD1oyVjnG5hhpCN5yHSf8BQUZlVNd00OP4M0TK+JSM7iqWi01SinFkCQXWxiZJLqqAHiEt3G3I2WYd46KU9pIJIOkoRQYCcEAAPguHo0Y4k8Hl6SW50MoW0uZU8jJOUghKo38Nl5ZSwsJNAUC2/lFZWkfMjrU8dFrTjHpJnUrLCILQIxINiYdQlDXaE/razQ4jjQluN5jW1Eh/S7yYvI5gigSjdLYU9TiFXAcHjISiLhQd9obb3OQmwY+YqVwiBMCkOGLXaK/ljBShh56c1g0uyIb2lBRKO7ZTAFncw5c5UGjGSy3CsI1Jt2mtruZkfhBZmbR+842Yu1eDiWEl0V6LZcGem6Ct+LW4Wy3oAjyNObazKBHomhJ3HMKEKHgiGksH+Ig1nTidfNMyA+oYHqVFaRGLiQreVLc9GvQgftKjW9cfUSKNYL80rqU7Um2rwqQJR1ai31Wq7vzKJEsFHDj0bAEMUKXgvfD5bWbaLPBTKz1Nk/Fg+GUZvUzFw80CLaKtPAACVAWrismh863FU4IJ0716SXBUNVb/SDMVvZgDt34CXoOq1JKvg0n08gPHTwXBNgD5W8pZZ8E9EVWcv1DZMB2NFysIwkqBSaH5QRmsAHdkHB+UANvLJvFpQKAahSmYTLEd2AFO+5rsqRRU6sVv5IP0wsSPLcWsbC1Y95mte71CUm6RJJWwkg6Q4k+xWMM0ByElJPQ6j2ED5hY42ALpZRytx9RlgQlJLijzhKi5eX5JBSIRGfo9o2xhd/0aWku8OS+4D9ZnovHDQMPaYo4qm2mlZbUnd7pR6oQj29Z2BqJ9n3LRT+MTLu3IR+ZP2TCPh3EDw8H1NHpoT7FibNYU8WHd9ESHcY12aDOQCUBddi4Ucp+4yuzz8ybcCCu1h8zvzXhDN4HYLq1R+U0xzUqg5QSA3iSBgdDouy55Ifx0DaeEhgezxBRGmoEJ6AJitVuzwtKPlUskHgU2F0LS7AFIwW5jPu0RUL7sp+fkNk0ee8P6uXYgl40WM+cdCOW21r13e0ivt0ff/mYcUfrQZWs2BiN6G+MDTGz1BKORmUTNQp9YGSHFxAeTkQrKd6FoVUogyytW25OLy3OpaO5oZCQp46aPzb5LnJiFEIwAKkmbYVYIjzVv3vj7rA6HignEeQAXTAHKDhoD7Uujh0QjtsB6fTP1NzO7T1Nzq4F1GnfHdXCG1Yxjwdtjf+PGRGTzEtEAUCz7KLfTdItLwCXuSOAzVjaZB6LvbUZhYGWmifSZlcMDnGHPd6gPeiK9erhpiw7ZP9ahTrMhFDa1J53m9ri2DloziqGETTcVSppCbTDDjExg6RrZ6cPEzB8XArEjQSB29odrUoLyoS/65RfM9fprGGjlHpbhGgbYD8MtmW1eFcAWX5dbcMHcl8sUI2k+H7GPW9VrArw3G+BefcCrCaAT/N53YLvP26Uy0kMFnDEZz0DJkmQqEOlL7SlKweYhH8gxpYeAYi0f9magqPbMYZuUI6007lSZQoyoGfYQHsNRzHXR3MMINTSMZpq1KD2A5MDJgtMLdRU6R4CEOJcKGiIJ7K6P/vAM6xpECHI8rRHsaEj6smkngAUjXTzrRoSI48ZpHOqgOY5OejKVdpnmiYUChQnVdIPa6ekGqRSRgEO119oDHOiIUQ5ciYVgaF1oG8Udo8WYtD+DEi8D/w8rAJE2k2PoyV0oMtpauxreaFjpujAvxFlwBhjuNqM9P0IfI5iD8Nh8y1kG4igjJkDNkOijnlLhItAd9lhRd670yNRTu95cR/Xuu0c5WO4DEFk5YQAPtLvU4TYPGRh4APPEDNiuuwR6SC21JoFbQBBMr+zJmT32QplNI6p16PbculN/pCX1wAyTWGTeJ774aln0gvQikw7TmkfsNbdQNs0adutYUDqNtGc0RqngUYdhUYuHSL1/eLrgvqDTC5neu++vufRkEgP9D2T64Kg/c4n+s7k3dDr3me8nOr0c72MRNmgF7D4WySPP0YAI/bI4eixwc7K13QiRiL85A8fnSsUj+mvTrsZtVUEQZ6sTpVafW8nYJZyaZS0U+0xIb6et9PhhtoObozQbjKAoDf6eiFgx1UUvpUYj1GweH0MNMrofhynfWn7+KYu7n5r83hN9aqm+6qjcH7dUlgvZVLV3xqq4fbP16qv+eofuTz43eomAqfS7GBAB9zEE31WJ37eVIPtdGN5A8nMYPvvLt8t2/V/6gM19G4g/hIL7UXf9JgbuLRZ+AoW//AzyMxTcWyz8BAruLRZ+AgX3r3y2+mT/PwfiN1DoVI+QT3CZDmvb8022JeYb6HiQPQpPPvboFB+i1MZdcqWZqthHmix6vttw0UAI1z8oEnGwVe++c7JamxslC+8xKJE41XJmug1npz+6CUAKyURd9gSxo+kWxvtZth848GBlws/0SKjYhmbZ9IiV+mcGBSdWHk8sqSr2zz5J7QME/0yD+z4Pe+JuGn1MV/vUyZwOHojWPlmPXgf9CuoeN9UAT+FGwaLg44v3dWe6QpvuL3Ln/p3k/2AgqNDcfwHgqUmIIqn+hwAAAAJiS0dEAACqjSMyAAAACXBIWXMAAAsSAAALEgHS3X78AAAAB3RJTUUH4wYRESAMujenGAAAB9FJREFUeNrtnWlsFVUUx899fS1gUoKioEY+WBRUEohGkUhAKxgEjSgGoRGB4AJCNKAIJBJZJSiyGYMKKkIoLlEUKhUraxFkKUE2kU1aCrRgW2jpg9f29R2/sBTo67v3zL2zvfP73MzM+XU6mf+5504BGIZhGIZhGIZhGIZhGMZGGq3JvSmR62++BXHH7Ylbf9ouRMT99yVq/e0PICIiHumUmPV3PooXOf5EItafXoCXOdUn8ep/pgjrUDY40ervX4JXUTEiocoXL5/FawiNEwlU/6hzeB3hqQljQIwJYT3UzEkQA2JiGOslsiAhDIgZ1RiD6NIEMBD8NIKxyQr6vv7FtdgQa31uILg0ig2zsZmv4//yePUj7rjNv/U3yUEJ/r7Xr/XfvBmlOPKwT+vfhpIUdvdj/Wm7UZpTz/mv/g4HUYGyQb5r/+SjEhXD/VV/j5OoSGisj16LRe9iVCY8xTcGxIulSKBmtk8MiKHlSMIn8ViMqkQivojHgfcuIJ0VAc/XPzmMVljrcQOBmdVojY1NvVx/8mcRtEqeh+NxypJatM6+ezxb/7Io6uBwR4/e/1moicJunvz956A2ip/1Xv3Nt6JGSgd6rf47/0KtlHssHrfZi5rxVDwWDx5C7XgoHotHC9AANbO8YqBXERohMt8bv/8X/kNDRDM9cA+IgWVojhWuNxAYXo4mWePyeBwYHUKz5Lo6HidNvICmybvVxfXPqEbz7Gvr2vrn1KAdHH7IpX//8yNoD8dcGY+TM6NoF26MxzLTL26Mx0majtM4q5ed7yhNulVsd5WAxqset/mGS6/d5CIBLXI62/7I6ZKyzjUC0rIfsP+hE3zkxt9c8vy7tPnJbiKfuyP+Xdn8ZDeuiMei+zF0juWOGyBNv+iMxw4bEBkl6CzOxmPx6ll0mryWDtb/ViU6z17H4rEYG0I3cMiheByYFEZ34Ew8Dn5UjW7BiXisY/rFDfGYmgWCCwcngXto0q08z1YBSUsy3NWgb5Qe2WSjgJRlfdy2RJPcNXm9bQIarexpsP5VdxHjcbMcm2Q3/5P64i71U8k/ELuLNsVjcct2cnST+rGg+Jo4XmhLPBZ376GOfoOkAIB5NWTHxuu/nzj9ElkA8gLgA+pLlvF43IU4/VI9G1QEAHnIPjfVaP1PnqRdVngKqAkActDMa2Hw/u9zijjjNg5UBcBr1FbD3jbG6h9QSruk8ovfyFESABnUWSNT8VgMI06/lF7aBqomAJ4n3m+G4nHgbeJfZfHljcCKAqDHcWo87m2g/gnE53LhlS+lqQqATv9S4/FL2u//qcT2T34XoAuAdvuJBspf11z/LOKbyYG6q4bqAqDVTqKByjFa21/U6ZfdaWBNADTdTDQQnqSv/pRMYjrZevVLCUUAiF+JBqpnaqv/J2I+zb3mxZwkAMTPDq8ep1A3P/1y3ZOEJABgiaPxuOnvxLN/B7oEwELq/sPl1utvSdz8VPsl6BMAn1AbBKut1t96F+3ENXOFTgFiehXRwAZL8Vi0JW5+qppW7+HIAgDGnyca2G4hHouOh2knvTARdAuAkedsj8cinTj9Ujka9AuAV87YHI/F08TNT2eHgQkB0I/aIDhGmuIU/YnnKxkAZgTAU8SGHC0eDyJufiqKfTKrAqBrPtFAiXo8HlFBO1VBA7ebZQHQifhUVo7H4p2QgQeOdQHQbp8t8Tg4idj+2dPgwJIGAdBqhw3xmDz9EuelQ4cASP3DeDwOziW+ecdbldEiACDbcDxOWkBs/8QNHpoEAPXjLNFMmfpv+IZ4+PjRU5cAWGwwHqcQNz/J2NUmAMgjavHjMfEPTGpvvz4BQH1MrzMkoHoW2CsAppEaBFskemQUA+HJYLcAeJfQINgpNVuvbiA0FuwXAG8qNwh2S07WqxqQ/saPXgEwRDGu7W8te2Q1A6XSH0HWLAD6nVa5zoPS9asZKJb/DLZuAdDzhPx1Hu2gkobkDRQq/J8w7QJAfstevuI3+WQN1F39dkAAtP9H7jpPdFVtiMgZOKC0Z9aAAEiT+mrbScLQjIyBXWngtABokRf/kKefonRF4xvYqrjmYEQApG6Md8SyvrS+eDwDG5QbzUYExL3QMxnUlZGGD5wFbhEADQ7YVwyhr401YCD6LbhHACyK3SA4N9TK6mhMA5EvwE0CYF6sBkFopLXl8exYq9/gLgHwYf3x+PxoqwMC9RoIvw9uE1D/gH3VeOsjItnSq9/OCqhvwL5qAoABA5XU28qsAHjj2tW8mukABgzEXP12WgAMvrpBEPkYwICB2KvfjguAvnUH7GvnARgwUGRhEt24gLoD9tGvAAwYKLDyySzzAqDzpQH76CIAAwYOWtqNYoMAaH9xwP57AAMG9ljbj2SHALhjJyLijwAGDGyzuCPNFgGQuhlxpfw1yR94dfAxi5cmojI/lRyx+rtaX9XDhADr2CVABc//JycWwAJYAAtgASyABbAAFsACWAALYAEsgAWwABbAAlgAC2ABLIAFsAAWwAJYAAtgASyABbAAFsACWAALYAEsgAWwABbAAlgAC2ABLIAFsAAWwAJYAAtgASyABbAAFsACWAALYAEsgAWwABbAAlgAC2ABLIAFsAAWwAJYAAtgASyABbAAFsACWIDToH8FyJUWtVWAALedDoFhGIZhGIZhGIZhGIYxyf+YwEMsIhMo/AAAAABJRU5ErkJggg==";var mw=new gn;function D4(r,t){let{nearRadius:e,farRadius:i,color:n,accentColor:o,completeFraction:a}=t,u=!0,s=5,p=1e3,f=t.displayArrowsOnPath,m=!0,y=!0,x=f,M=e/2+.15,g=0;r[0].z+=M;for(let et=1;et<r.length;++et){r[et].z+=M;let St=r[et].x-r[et-1].x,Gt=r[et].y-r[et-1].y,ie=r[et].z-r[et-1].z;g+=Math.sqrt(St*St+Gt*Gt+ie*ie)}let C=M-.1;r.push(r[r.length-1].clone().setZ(C)),r.unshift(r[0].clone().setZ(C));let I=new e1;x&&(I=mw.load(_4),I.colorSpace=mi);let T=new Tt(n),w=new Tt(o),L={vertexes:{type:"f",value:1},resolution:{type:"v2",value:new U(1,1)},cameraParameters:{type:"v2",value:new U(s,0)},complete:{type:"f",value:u?0:1},color:{type:"c",value:T},pathLength:{type:"f",value:g},nearRadius:{type:"f",value:e},farRadius:{type:"f",value:i},nearZoom:{type:"f",value:s},farZoom:{type:"f",value:p},pulseColor:{type:"c",value:w},pulse:{type:"f",value:0},pulseLength:{type:"f",value:.075},pathIsVertical:{type:"b",value:!1},arrowAnimationTimer:{type:"f",value:0},arrowTexture:{type:"t",value:I},displayArrowsOnPath:{type:"b",value:f},flattenFactor:{type:"f",value:m?.05:1},showPulse:{type:"b",value:y},opacityMultiplier:{type:"f",value:1}},D=new d1(r);D.curveType="catmullrom",D.tension=0;let R=30,F=8,k=R*r.length,H=new m1(D,k,e,F,!1),X=new Float32Array(H.attributes.position.count);for(let et=r.length;et<X.length;et++)X[et]=et;H.setAttribute("vertexIndex",new Io(X,1));let $=new Float32Array(H.attributes.position.count),ct=new Io($,1);for(let et=0;et<=k;et++)for(let St=0;St<=F;++St)ct.setX(et*(F+1)+St,et/k);H.setAttribute("pathDistance",ct);let yt=new Float32Array(H.attributes.normal.count*3),bt=new Io(yt,3);for(let et=0;et<k;et++){let St=H.tangents[et];for(let Gt=0;Gt<=F;++Gt)bt.setXYZ(et*(F+1)+Gt,St.x,St.y,St.z)}H.setAttribute("pathTangent",bt);let Nt=new Float32Array(H.attributes.normal.count*3),Me=new Io(Nt,3);for(let et=0;et<k;et++){let St=H.tangents[et];var Ft,ht,xt;Ft=-St.x*St.z,ht=-St.y*St.z,xt=1-St.z*St.z;let Gt=Math.sqrt(Ft*Ft+ht*ht+xt*xt);Gt===0&&(Gt=1);let ie=Ft/Gt,cr=ht/Gt,dn=xt/Gt;for(let di=0;di<=F;++di)Me.setXYZ(et*(F+1)+di,ie,cr,dn)}H.setAttribute("pathNormal",Me);let ur=new Eo({uniforms:L,vertexShader:wm,fragmentShader:Tm});ur.transparent=!0,ur.alphaTest=.5,L.resolution.value.x=1,L.resolution.value.y=1,L.vertexes.value=X.length,L.arrowTexture.value.wrapS=He,L.arrowTexture.value.wrapT=He,L.arrowTexture.value.anisotropy=16,L.complete.value=a;let Pe=new Zt(H,ur),le=Pe.clone(),Ut={...L,opacityMultiplier:{type:"f",value:.25}};Ut.complete.value=1,le.material=new Eo({uniforms:Ut,vertexShader:wm,fragmentShader:Tm}),le.material.transparent=!0,le.material.alphaTest=.5,le.material.depthWrite=!1,le.material.depthTest=!1,le.renderOrder=1,Ut.resolution.value.x=1,Ut.resolution.value.y=1,Ut.vertexes.value=X.length,Ut.arrowTexture.value.wrapS=He,Ut.arrowTexture.value.wrapT=He,Ut.arrowTexture.value.anisotropy=16,Ut.complete.value=a;let hi=t.mesh;hi.add(Pe),hi.add(le),H.computeBoundingBox();let hn=new W;return H.boundingBox.getCenter(hn),{mesh:hi,material:ur,center:hn}}l(D4,"buildPath");var Im=class Im extends J{rendererState;convertTo3DMapPosition;constructor(t,e){super(),this.rendererState=t,this.convertTo3DMapPosition=e}update(t,e,i){let n,o=!1;for(let a of this.rendererState.threeDEntities)if(n=this.rendererState.entity3DMap.get(a),n&&n.type==="path"&&n.components[0].type==="path"){let u=n.components[0];if(u.dirty){u.mesh.parent!=null&&u.mesh.children.forEach(y=>{Re(y)});let s=u.feature.features.map(y=>y.geometry.coordinates).map(y=>this.convertTo3DMapPosition(y[1],y[0],y[2]||0)),{mesh:p,material:f,center:m}=D4(s,u);u.mesh=p,u.material=f,u.dirty=!1,u.position=m}u.material&&(u.material.uniforms.nearZoom.value=t,u.material.uniforms.farZoom.value=e,u.material.uniforms.cameraParameters.value.x=i,u.displayArrowsOnPath&&u.animateArrowsOnPath&&(u.material.uniforms.arrowAnimationTimer.value=performance.now()/1e3,o=!0),u.material.needsUpdate=!0)}o&&this.publish("animate:path")}};l(Im,"PathSystem");var hs=Im;var O4=new Rr,Dm=18,Om=0,Am=0;var yw=it.radToDeg(.698132),se,wt,ds,go,pi,on,an,sn,vo,fs,Lm,A,lt,Ge,vt,ar,Se,_,ms,Ct,mt,wc,A4,Tc,N4,Ic,k4,ln,ys,gs,bo,Ec,vs,bs,Cs,Co,fe,Fe,xs,_m,un,Ss,ee,re,Nm=class Nm extends J{constructor(e,i={}){var y,x,S,M,g,C,I,T,w,L;super();P(this,fs);P(this,wc);P(this,Tc);P(this,Ic);P(this,fe);P(this,xs);v(this,"options");v(this,"container");P(this,se,void 0);P(this,wt,void 0);P(this,ds,void 0);P(this,go,void 0);P(this,pi,void 0);P(this,on,void 0);P(this,an,void 0);P(this,sn,void 0);P(this,vo,void 0);v(this,"rendererDomElement");P(this,A,{entity3DMap:new Map,entity2DMap:new Map,entity2DIds:new Set,threeDEntities:[],entityScene:new Pt("__scene"),hoverColor:"red",insetsPadding:$u,shouldMeasureCanvas:!0,pixelRatio:oi()});v(this,"camera");P(this,lt,void 0);P(this,Ge,void 0);P(this,vt,void 0);P(this,ar,void 0);P(this,Se,void 0);P(this,_,{});P(this,ms,window.matchMedia("screen and (min-resolution: 2dppx)"));v(this,"map");P(this,Ct,l(()=>{c(this,_).renderSystem.twoDdirty=!0},"#invalidate2DEntities"));P(this,mt,l(()=>{c(this,_).renderSystem.threeDdirty=!0},"#invalidate3DEntities"));P(this,ln,"standalone");P(this,ys,l(e=>Math.trunc(e*10)/10,"#round10"));P(this,gs,l(()=>{c(this,_).twoDDrawSystem.dirty=!0,Y(this,fs,Lm).call(this,oi()),c(this,_).watermarkSystem.dirty=!0,this.render()},"#handlePixelRatioChange"));P(this,bo,l(()=>{E(this,on,this.rendererDomElement.clientWidth),E(this,an,this.rendererDomElement.clientHeight),Y(this,fs,Lm).call(this,oi()),c(this,Co).call(this),Y(this,Ic,k4).call(this),c(this,_).cameraSystem.resize(this.canvasWidth,this.canvasHeight),c(this,_).cameraSystem.dirty=!0,c(this,_).watermarkSystem.resize(this.canvasWidth,this.canvasHeight),c(this,_).htmlControlsSystem.resize(this.canvasWidth),this.render()},"#handleWindowResize"));P(this,Ec,l(()=>{this.renderSync()},"#renderFull"));P(this,vs,new W);P(this,bs,l((e,i)=>{let n=this.mode==="standalone"?c(this,wt):this.viewCamera;if(c(this,wt).position.z+this.camera.elevation>i.z){c(this,vs).copy(i);let o=c(this,vs).project(n),a=(o.x+1)/2*this.canvasWidth-0/2,u=(-o.y+1)/2*this.canvasHeight-0/2,s=c(this,ys).call(this,a),p=c(this,ys).call(this,u);e.x=s,e.y=p}else e.x=-1e3,e.y=-1e3},"#project"));P(this,Cs,l((e,i)=>{c(this,Se).setBufferSize(e,i),c(this,wt).aspect=e/i,c(this,wt).updateProjectionMatrix(),c(this,wt).updateMatrixWorld(!0),c(this,go).x=e,c(this,go).y=i},"#setBufferSize"));P(this,Co,l(()=>{var a;let e=E(this,on,this.rendererDomElement.clientWidth),i=E(this,an,this.rendererDomElement.clientHeight),n=Math.floor(e*this.resolutionScale),o=Math.floor(i*this.resolutionScale);c(this,Cs).call(this,n,o),(a=this.map)==null||a.resize(),c(this,A).shouldMeasureCanvas=!1},"#measureCanvas"));v(this,"showCollisionBoxes",()=>{c(this,_).collisionSystem.showCollisionBoxes(),this.render()});v(this,"hideCollisionBoxes",()=>{c(this,_).collisionSystem.hideCollisionBoxes(),this.render()});v(this,"projectScreenXYToCoordinate",(e,i)=>{var s;let n=e/this.canvasWidth*2-1,o=-(i/this.canvasHeight)*2+1,a=new U(n,o);O4.setFromCamera(a,c(this,wt).clone());let u=(s=O4.intersectObject(c(this,pi),!1)[0])==null?void 0:s.point;return u!=null?this.convert3DMapPositionToCoordinate(u):void 0});v(this,"projectCoordinateToScreenXY",e=>{let i=this.convertTo3DMapPosition(e[1],e[0],e[2]||0),n=new U;return c(this,bs).call(this,n,i),{x:n.x,y:n.y}});v(this,"convert3DMapPositionToCoordinate",e=>{var o,a,u,s;let{lat:i,lon:n}=Pu((a=(o=c(this,A).center)==null?void 0:o[1])!=null?a:0,(s=(u=c(this,A).center)==null?void 0:u[0])!=null?s:0,e.x,e.y);return[n,i]});v(this,"setBackgroundColor",(e,i)=>{c(this,Se).setBackgroundColor(e,i)});v(this,"hideOutdoorLayersUnderPoint",(e,i)=>{!this.map||(i==null?void 0:i.length)===0||(c(this,_).outdoorLayersSystem.hideLayersUnderPoint(e,i),this.render())});P(this,un,new l1);P(this,Ss,new pr);v(this,"render",()=>{c(this,_).renderSystem!=null&&(this.map&&(this.mode==="outdoors-interleaved"||this.mode==="outdoors-overlay")?this.map.triggerRepaint():c(this,_).renderSystem.update())});v(this,"renderSync",()=>{c(this,_).renderSystem.update(!0)});P(this,ee,po(()=>{this.publish("user-interaction-start",void 0)},0,!0));P(this,re,po(()=>{this.publish("user-interaction-end",void 0)},0,!0));v(this,"on",(e,i)=>{super.on(e,i),["outdoor-view-loaded","outdoor-style-loaded"].includes(e)&&this.mode==="standalone"&&b.env.NODE_ENV!=="test"&&(G.warn(`"${e}" was subscribed to but outdoor view is disabled. The event has been triggered immediately. Enable outdoor view or remove the listener.`),this.publish(e))});v(this,"off",(e,i)=>{super.off(e,i)});v(this,"getCursor",()=>c(this,_).interactionSystem.getCursor());v(this,"destroy",()=>{c(this,_).cameraSystem.off("user-dolly-start",c(this,ee)),c(this,_).cameraSystem.off("user-pan-start",c(this,ee)),c(this,_).cameraSystem.off("user-rotate-start",c(this,ee)),c(this,_).cameraSystem.off("user-zoom-start",c(this,ee)),c(this,_).cameraSystem.off("user-tilt-start",c(this,ee)),c(this,_).cameraSystem.off("user-pedestal-start",c(this,ee)),c(this,_).cameraSystem.off("user-dolly-end",c(this,re)),c(this,_).cameraSystem.off("user-pan-end",c(this,re)),c(this,_).cameraSystem.off("user-rotate-end",c(this,re)),c(this,_).cameraSystem.off("user-zoom-end",c(this,re)),c(this,_).cameraSystem.off("user-tilt-end",c(this,re)),c(this,_).cameraSystem.off("user-pedestal-end",c(this,re)),c(this,_).renderSystem.off("measure-canvas",c(this,Co)),this.remove("__scene"),c(this,Ct).call(this),c(this,mt).call(this),this.renderSync(),c(this,_).renderSystem.destroy(),c(this,_).zoomInterpolationSystem.destroy(),c(this,_).renderSystem.destroy(),c(this,_).cameraSystem.off("change",this.render),c(this,_).pathSystem.off("animate:path",this.render),c(this,_).cameraSystem.dispose(),c(this,_).exporterSystem.destroy(),c(this,_).outdoorLayersSystem.destroy(),c(this,_).drawSystem.destroy(),window.removeEventListener("resize",c(this,bo),!1),c(this,ms).removeEventListener("change",c(this,gs)),c(this,sn)&&c(this,sn).disconnect(),this._subscribers={},c(this,Se).destroy(),c(this,se).traverse(e=>{Re(e),"dispose"in e&&typeof e.dispose=="function"&&e.dispose()}),E(this,se,void 0),c(this,_).htmlControlsSystem.destroy(),c(this,_).collisionSystem.destroy(),c(this,_).domMutationSystem.destroy(),E(this,_,void 0),this.map&&(this.map.transform.getElevation=void 0,this.map.remove()),this.container.contains(this.rendererDomElement)&&this.container.removeChild(this.rendererDomElement),this.container.removeChild(c(this,ar)),this.container.removeChild(c(this,lt)),E(this,Se,void 0)});this.convertTo3DMapPosition=this.convertTo3DMapPosition.bind(this),(i.mode==="outdoors-interleaved"||i.mode==="outdoors-overlay")&&i.map&&(E(this,ln,i.mode),this.map=i.map),c(this,A).entityScene.addEventListener("childadded",()=>{c(this,mt).call(this),c(this,Ct).call(this)}),c(this,A).entityScene.addEventListener("childremoved",()=>{c(this,mt).call(this),c(this,Ct).call(this)}),c(this,A).entity3DMap.set(c(this,A).entityScene.userData.entityId,c(this,A).entityScene),i.center&&(c(this,A).center=i.center?[...i.center]:[0,0]),this.options=i,this.container=e,Y(this,wc,A4).call(this),Y(this,Tc,N4).call(this),c(this,_).htmlControlsSystem=new xc(this.container),c(this,ln)!=="outdoors-overlay"&&c(this,_).htmlControlsSystem.addAttributionControl(this.options.attribution),window.MappedinDebug||(window.MappedinDebug={}),b.env.NODE_ENV==="test"&&(window.MappedinDebug.mapViewCoreInstance=this),E(this,Se,new Su({antialias:typeof i.antialias=="boolean"?i.antialias:!0,alpha:!1,canvas:this.mode!=="standalone"?(y=i.gl)==null?void 0:y.canvas:void 0,onWebGLContextCreationError:i.onWebGLContextCreationError,onWebGLContextLost:()=>{typeof i.onWebGLContextLost=="function"&&i.onWebGLContextLost()},onWebGLContextRestored:()=>{i.onWebGLContextRestored&&i.onWebGLContextRestored(),c(this,Ct).call(this),c(this,mt).call(this),this.render()},onWebGLRendererError:i.onWebGLRendererError,backgroundColor:i.backgroundColor||"#ffffff",backgroundAlpha:(x=i.backgroundAlpha)!=null?x:1})),E(this,se,new Ws),c(this,se).add(c(this,A).entityScene);let n=window.__THREE_DEVTOOLS__;b.env.NODE_ENV==="dev"&&typeof n<"u"&&(n.dispatchEvent(new CustomEvent("observe",{detail:c(this,se)})),n.dispatchEvent(new CustomEvent("observe",{detail:c(this,Se)}))),E(this,wt,new s1(yw,this.aspect,50,1e5)),E(this,ds,new a1),c(this,wt).renderOrder=999;let o=new Te;o.add(c(this,wt)),E(this,vo,new Te),c(this,vo).add(o),c(this,se).add(c(this,vo)),c(this,wt).updateProjectionMatrix(),c(this,wt).updateMatrixWorld(!0),this.referenceMap={scale:1,latitude:0,longitude:0,getNorth:()=>0,georeference:[{target:{x:0,y:0}},{target:{x:0,y:0}},{target:{x:0,y:0}},{target:{x:0,y:0}}]},this.rendererDomElement=c(this,Se).domElement(),E(this,go,new U);let a=new mn(1e6,1e6),u=new Nr({color:0,visible:!1});E(this,pi,new Zt(a,u)),c(this,se).add(c(this,pi)),(S=i.gl)!=null&&S.canvas||e.appendChild(this.rendererDomElement),window.addEventListener("resize",c(this,bo),!1),c(this,ms).addEventListener("change",c(this,gs)),typeof ResizeObserver=="function"&&((M=b.env)==null?void 0:M.NODE_ENV)!=="test"&&(E(this,sn,new ResizeObserver(po(()=>{c(this,bo).call(this)},0))),(g=c(this,sn))==null||g.observe(e)),e.classList.add("mappedin-map"),this.rendererDomElement.style.width=(C=globalThis.MappedinDebug)!=null&&C.TEST_IOS?"1080px":"100%",this.rendererDomElement.style.height=(I=globalThis.MappedinDebug)!=null&&I.TEST_IOS?"1920px":"100%",E(this,on,this.rendererDomElement.clientWidth),E(this,an,this.rendererDomElement.clientHeight),this.rendererDomElement.style.touchAction="manipulation";let s=this.canvasWidth,p=this.canvasHeight;c(this,_).watermarkSystem=new bc(c(this,wt),s,p,c(this,A),i==null?void 0:i.watermark),c(this,A).shouldMeasureCanvas=!0,c(this,A).pixelRatio=this.resolutionScale,c(this,Cs).call(this,Math.floor(s*this.resolutionScale),Math.floor(p*this.resolutionScale));let f=new zs(16777215,.3*Math.PI);f.position.set(-150,-150,350),c(this,se).add(f);let m=new g1(16777215,.741*Math.PI);c(this,se).add(m),c(this,_).cameraSystem=new ss(c(this,wt),c(this,se),c(this,Se).renderer,c(this,A),{mode:this.mode,canvasHeight:p,canvasWidth:s}),c(this,_).cameraSystem.on("user-dolly-start",c(this,ee)),c(this,_).cameraSystem.on("user-pan-start",c(this,ee)),c(this,_).cameraSystem.on("user-rotate-start",c(this,ee)),c(this,_).cameraSystem.on("user-zoom-start",c(this,ee)),c(this,_).cameraSystem.on("user-tilt-start",c(this,ee)),c(this,_).cameraSystem.on("user-pedestal-start",c(this,ee)),c(this,_).cameraSystem.on("user-dolly-end",c(this,re)),c(this,_).cameraSystem.on("user-pan-end",c(this,re)),c(this,_).cameraSystem.on("user-rotate-end",c(this,re)),c(this,_).cameraSystem.on("user-zoom-end",c(this,re)),c(this,_).cameraSystem.on("user-tilt-end",c(this,re)),c(this,_).cameraSystem.on("user-pedestal-end",c(this,re)),c(this,_).cameraSystem.on("change",()=>{this.publish("camera-change",this.camera),this.render()}),c(this,_).panBoundsSystem=new Cc(c(this,A),c(this,_).cameraSystem),c(this,_).pathSystem=new hs(c(this,A),this.convertTo3DMapPosition),c(this,_).pathSystem.on("animate:path",this.render),this.camera=new vc(this,c(this,_),c(this,A),c(this,pi)),this.camera.setZoomLevel((T=i.zoomLevel)!=null?T:Dm),this.camera.setBearing((w=i.bearing)!=null?w:Am),this.camera.setPitch((L=i.pitch)!=null?L:Om),this.camera.setMaxZoomLevel(22),c(this,_).domVisiblitySystem=new nc(c(this,A),c(this,ar)),c(this,_).domMutationSystem=new gc(c(this,A),c(this,ar)),c(this,_).domMutationSystem.on("dimensions-update",()=>{c(this,_).collisionSystem.dirty=!0,this.render()}),c(this,_).domDrawSystem=new mc(c(this,A)),c(this,_).collisionSystem=new Eu(c(this,Ge),c(this,A)),c(this,_).twoDDrawSystem=new ac(c(this,A),c(this,vt)),c(this,_).interactionSystem=new Ba(this.rendererDomElement,c(this,A),c(this,wt),c(this,pi)),c(this,_).interactionSystem.on("hover",this.render),c(this,_).interactionSystem.on("click",D=>{var R,F,k,H,X;if(((R=D.entity2D)==null?void 0:R.id)==="watermark"&&typeof c(this,_).watermarkSystem.options.onClick=="function"){c(this,_).watermarkSystem.options.onClick();return}this.publish("click",{coordinate:this.convert3DMapPositionToCoordinate(D.position),geometry:D.entity3D?[(F=D.entity3D)==null?void 0:F.id]:[],markers:((k=D.entity2D)==null?void 0:k.components[0])instanceof ve?[D.entity2D.id]:[],models:((H=D.entity3D)==null?void 0:H.components[0])instanceof ui?[D.entity3D.id]:[],labels:((X=D.entity2D)==null?void 0:X.components[0])instanceof rr?[D.entity2D.id]:[],containers:Array.isArray(D.groupContainers)?D.groupContainers.map($=>$.userData.entityId):[],pointerEvent:D.pointerEvent})}),c(this,_).interactionSystem.on("hover",D=>{var R,F,k,H,X;D.position&&((R=D.entity2D)==null?void 0:R.id)!=="watermark"&&this.publish("hover",{coordinate:this.convert3DMapPositionToCoordinate(D.position),geometry:D.entity3D?[(F=D.entity3D)==null?void 0:F.id]:[],markers:((k=D.entity2D)==null?void 0:k.components[0])instanceof ve?[D.entity2D.id]:[],models:((H=D.entity3D)==null?void 0:H.components[0])instanceof ui?[D.entity3D.id]:[],labels:((X=D.entity2D)==null?void 0:X.components[0])instanceof rr?[D.entity2D.id]:[],containers:Array.isArray(D.groupContainers)?D.groupContainers.map($=>$.userData.entityId):[]})}),c(this,_).twoDVisiblitySystem=new uc(c(this,A)),c(this,_).drawSystem=new lc(c(this,A)),c(this,_).drawSystem.on("texture-loaded",this.render),c(this,_).stackSystem=new hc(c(this,A)),c(this,_).twoDProjectionSystem=new oc(c(this,A),c(this,bs)),c(this,_).zoomInterpolationSystem=new Xu,c(this,_).exporterSystem=new Ua(c(this,A)),c(this,_).meshOptimizationSystem=new ic(c(this,A),this.convertTo3DMapPosition),c(this,_).meshOptimizationSystem.on("model-loaded",this.render),c(this,_).customGeometrySystem=new Sc(c(this,A)),c(this,_).outlineInterpolationSystem=new Mc(c(this,A)),c(this,_).renderSystem=new cc(c(this,Se),c(this,A),this.mode,c(this,se),c(this,wt),this.viewCamera,c(this,_)),c(this,_).renderSystem.on("measure-canvas",c(this,Co)),c(this,_).outdoorLayersSystem=new Pc(this.map),c(this,Ec).call(this)}get viewCamera(){return c(this,ds)}get canvasWidth(){return c(this,on)}get canvasHeight(){return c(this,an)}get resolutionScale(){var e,i;return(i=(e=this.map)==null?void 0:e.getPixelRatio())!=null?i:oi()}get aspect(){return this.canvasWidth/this.canvasHeight}get mode(){return c(this,ln)}addGroupContainer(e,i,n){var o;if(!c(this,A).entity3DMap.has(e)&&!c(this,A).entity2DMap.has(e)){let a=new Pt(e);a.addEventListener("childadded",()=>{c(this,mt).call(this),c(this,Ct).call(this)}),a.addEventListener("childremoved",()=>{c(this,mt).call(this),c(this,Ct).call(this)}),(i==null?void 0:i.visible)!==void 0&&(a.visible=i.visible),(i==null?void 0:i.altitude)!==void 0&&a.setAltitude(i.altitude),(i==null?void 0:i.interactive)!==void 0&&de(a,i.interactive,c(this,A)),c(this,A).entity3DMap.set(e,a),(o=Y(this,fe,Fe).call(this,n))==null||o.addEntity(a),c(this,mt).call(this),this.render()}else G.error(`Group container with ID '${e}' already exists. The group container cannot be added.`);return{id:e,type:"group-container"}}addStackContainer(e,i,n){var o;if(c(this,A).entity3DMap.has(e))G.error(`Stack container with ID '${e}' already exists. The stack container cannot be added.`);else{let a=new Pt(e);a.addEventListener("childadded",()=>{c(this,mt).call(this),c(this,Ct).call(this)}),a.addEventListener("childremoved",()=>{c(this,mt).call(this),c(this,Ct).call(this)}),a.components[0]=new yc,(i==null?void 0:i.visible)!==void 0&&(a.visible=i.visible),c(this,A).entity3DMap.set(e,a),(o=Y(this,fe,Fe).call(this,n))==null||o.addEntity(a)}return{id:e,type:"stack-container"}}addCustomGeometry(e,i,n,o,a){var u;if(c(this,A).entity3DMap.has(e))G.error(`Custom geometry with ID '${e}' already exists. The custom geometry cannot be added.`);else{let s=new yo(i,n),p=new dt(s,new ai(o));p.id=e,s.mesh.userData={entityId:e,type:"custom-geometry"},c(this,A).entity3DMap.set(p.id,p),(u=Y(this,fe,Fe).call(this,a))==null||u.addEntity(p),this.render()}return{id:e,type:"custom-geometry"}}addGeometryGroup(e,i,n,o){var a,u;if(!c(this,A).entity3DMap.has(e)&&!c(this,A).entity2DMap.has(e)){let s=new Bt(e,new Yi(n));s.addEventListener("childadded",()=>{c(this,mt).call(this),c(this,Ct).call(this)}),s.addEventListener("childremoved",()=>{c(this,mt).call(this),c(this,Ct).call(this)}),s.userData.dirty=!0,c(this,A).entity3DMap.set(e,s);for(let p of i.features){if(!["Polygon","MultiPolygon","LineString","MultiLineString"].includes(p.geometry.type))continue;let f=p.id||p.properties.id||ut(),m=c(this,_).meshOptimizationSystem.createEntityFromFeature(f,p,n);c(this,A).entity3DMap.set(f,m),s.userData.entities3D.add(f)}s.setVisible((a=n==null?void 0:n.visible)!=null?a:!0),(u=Y(this,fe,Fe).call(this,o))==null||u.addEntity(s),c(this,mt).call(this),this.render()}else G.error(`Geometry group with ID '${e}' already exists. The geometry group cannot be added.`);return c(this,_).outlineInterpolationSystem.dirty=!0,{id:e,type:"geometry-group"}}addModelGroup(e,i,n,o){var a;if(!c(this,A).entity3DMap.has(e)&&!c(this,A).entity2DMap.has(e)){let u=new Bt(e,new Yi(n));u.addEventListener("childadded",()=>{c(this,mt).call(this),c(this,Ct).call(this)}),u.addEventListener("childremoved",()=>{c(this,mt).call(this),c(this,Ct).call(this)}),c(this,A).entity3DMap.set(e,u),u.userData.dirty=!0,u.userData.modelURL=n.url;for(let s of i.features){let p=s.id||s.properties.id||ut(),f=c(this,_).meshOptimizationSystem.createModelFromFeature(p,s,n);s.properties.interactive!==void 0&&de(f,s.properties.interactive,c(this,A)),c(this,A).entity3DMap.set(p,f),u.userData.entities3D.add(p)}(a=Y(this,fe,Fe).call(this,o))==null||a.addEntity(u),c(this,mt).call(this),this.render()}else G.error(`Model group with ID '${e}' already exists. The model group cannot be added.`);return{id:e,type:"geometry-group"}}addMarker2D(e,i,n,o){var u;let a=n==null?void 0:n.id;if(a===void 0||!c(this,A).entity2DMap.has(a)&&!c(this,A).entity3DMap.has(a)){let s=Y(this,xs,_m).call(this,e,new ve(i,n));s.id=a||String(s.id),a=s.id,(n==null?void 0:n.interactive)!=null&&de(s,n==null?void 0:n.interactive,c(this,A)),(u=Y(this,fe,Fe).call(this,o))==null||u.addEntity(s),this.render()}else G.error(`Marker2D with ID '${a}' already exists. The marker cannot be added.`);return{id:a,type:"marker"}}addLabel2D(e,i,n,o){var u;let a=n==null?void 0:n.id;if(a===void 0||!c(this,A).entity2DMap.has(a)&&!c(this,A).entity3DMap.has(a)){let s=Y(this,xs,_m).call(this,e,new rr(i,n||{},c(this,A)));s.id=a||String(s.id),a=s.id,(n==null?void 0:n.interactive)!=null&&de(s,n==null?void 0:n.interactive,c(this,A)),(u=Y(this,fe,Fe).call(this,o))==null||u.addEntity(s),c(this,Ct).call(this),this.render()}else G.error(`Label2D with ID '${a}' already exists. The label cannot be added.`);return{id:a,type:"label"}}addPath(e,i={},n){var u;let o=new pc(e,i),a=new dt(o,new ai);return a.id=(i==null?void 0:i.id)||ut(),o.mesh.userData={entityId:a.id,type:"path"},c(this,A).entity3DMap.set(a.id,a),(i==null?void 0:i.interactive)!=null&&de(a,i==null?void 0:i.interactive,c(this,A)),(u=Y(this,fe,Fe).call(this,n))==null||u.addEntity(a),c(this,mt).call(this),this.render(),{id:a.id,type:"path"}}updateStackState(e,i){let n;(typeof e=="string"||typeof e=="number")&&(n=c(this,A).entity3DMap.get(e)),n!=null&&n.components[0]&&(typeof i.activeId<"u"&&(n.components[0].activeId=i.activeId),typeof i.expandedFactor<"u"&&(n.components[0].percentExpanded=i.expandedFactor),n.components[0].dirty=!0,this.render())}remove(e){var n;let i;if(typeof e=="string"||typeof e=="number"?(i=c(this,A).entity2DMap.get(e),i==null&&(i=c(this,A).entity3DMap.get(e))):typeof e.id=="string"||typeof e.id=="number"?(i=c(this,A).entity2DMap.get(e.id),i==null&&(i=c(this,A).entity3DMap.get(e.id))):i=e,i!=null){if(i.type==="custom-geometry")c(this,A).entity3DMap.delete(i.id),i.object3d&&Re(i.object3d);else if(i.type==="group-container"){c(this,A).entity3DMap.delete(i.userData.entityId);for(let o of i.childrenIds.values())this.remove(o),i.userData.entities2D.delete(o);Re(i)}else if(i.type==="geometry-group"){c(this,A).entity3DMap.delete(i.userData.entityId);for(let o of i.userData.entities3D.values())this.remove(o),i.userData.entities3D.delete(o);Re(i)}else i.type==="geometry"||i.type==="model"||i.type==="path"?(i.object3d&&(((n=i.parent)==null?void 0:n.type)==="geometry-group"&&i.parent.userData.entities3D.delete(i.id),Re(i.object3d)),i.components[0].outline&&Re(i.components[0].outline),c(this,A).entity3DMap.delete(i.id)):(i.type==="marker"||i.type==="label")&&(i.object3d&&Re(i.object3d),i.type==="label"&&delete c(this,_).twoDDrawSystem.textCache[i.id],c(this,A).entity2DMap.delete(i.id));c(this,mt).call(this),c(this,Ct).call(this),this.render()}}getScene(){return this.getState("__scene")}getCurrentSceneGLTF(e){return c(this,_).exporterSystem.getCurrentSceneGLTF(e)}getBoundingBox(e){if(this.renderSync(),e==null){let n=new we;n.setFromObject(c(this,A).entityScene);let o=n.min,a=n.max;return[this.convert3DMapPositionToCoordinate(o),this.convert3DMapPositionToCoordinate(a)]}let i=ka(c(this,A),e);if((i==null?void 0:i.type)==="geometry"&&(i==null?void 0:i.object3d)!=null){let n=new we;return n.setFromObject(i.object3d),[this.convert3DMapPositionToCoordinate(n.min),this.convert3DMapPositionToCoordinate(n.max)]}else if(((i==null?void 0:i.type)==="geometry-group"||(i==null?void 0:i.type)==="group-container")&&(i==null?void 0:i.userData.entityId)!=null){let n=new we;return n.setFromObject(i),[this.convert3DMapPositionToCoordinate(n.min),this.convert3DMapPositionToCoordinate(n.max)]}}getState(e){var n;if(e==null)return{type:"map-view",hoverColor:c(this,A).hoverColor};let i=ka(c(this,A),e);if((i==null?void 0:i.type)==="custom-geometry"){let o=i.components[0],a=i.components[1];return{id:i.id,type:"custom-geometry",visible:a.visible,altitude:a.altitude,parent:(n=i.parent)==null?void 0:n.userData.entityId,position:this.convert3DMapPositionToCoordinate(o.position)}}else if((i==null?void 0:i.type)==="geometry-group"){let o=[];for(let u of i.userData.entities3D.values()){let s=this.getState(u);((s==null?void 0:s.type)==="geometry"||(s==null?void 0:s.type)==="model")&&o.push(s)}let a=i.components[0];return{id:i.userData.entityId,type:"geometry-group",visible:i.visible,opacity:a.opacity,color:a.color,topColor:a.topColor,outline:a.outline,shading:a.shading,interactive:Array.from(i.userData.entities3D.values()).map(u=>c(this,A).entity3DMap.get(u)).every(u=>u&&u.components[2]!=null),children:Array.from(i.userData.entities3D.values()).map(u=>this.getState(u)).filter(Boolean)}}else{if((i==null?void 0:i.type)==="group-container")return{id:i.userData.entityId,type:"group-container",visible:i.visible,altitude:i.altitude,interactive:!!i.components[1],children:Array.from(i.childrenIds.values()).map(o=>this.getState(o)).filter(Boolean)};if((i==null?void 0:i.type)==="label"){let o=i.components[0],a=i.object3d.parent,u=a==null?void 0:a.userData.entityId;return{id:i.id,type:"label",text:o.text||"",parent:{id:u,type:a==null?void 0:a.type},position:this.convert3DMapPositionToCoordinate(i.position),enabled:o.enabled,initialRank:Ra(o.initialRank),options:{rank:Ra(o.rank),appearance:o.appearance,interactive:i.components[1]!=null}}}else if((i==null?void 0:i.type)==="marker"){let o=i.components[0],a=i.object3d.parent,u=a==null?void 0:a.userData.entityId;return{id:i.id,type:"marker",enabled:o.enabled,parent:{id:u,type:a==null?void 0:a.type},position:this.convert3DMapPositionToCoordinate(i.position),element:o.containerEl,initialRank:Ra(o.initialRank),options:{rank:Ra(o.rank),interactive:i.components[1]!=null||!1}}}else if((i==null?void 0:i.type)==="geometry"){let{color:o,hoverColor:a,initialColor:u,topColor:s}=i.components[1],p=i.components[0],f=i.components[1];return{id:i.id,type:"geometry",color:o,topColor:s,initialColor:u,hoverColor:a,visible:f.visible,outline:f.outline,position:this.convert3DMapPositionToCoordinate(p.position),interactive:i.components[2]!=null}}else if((i==null?void 0:i.type)==="model"){let o=i.components[0],a=i.components[2];return{id:i.id,type:"model",position:this.convert3DMapPositionToCoordinate(o.position),interactive:a!=null}}else if((i==null?void 0:i.type)==="path"){let o=i.components[0],a=i.components[2],u=i.components[1];return{id:i.id,type:"path",position:this.convert3DMapPositionToCoordinate(o.position),visible:u.visible,interactive:a!=null,completeFraction:o.completeFraction}}else return}}setState(e,i){var o,a,u;if(typeof e=="object"&&"hoverColor"in e&&i==null){c(this,A).hoverColor=(o=e.hoverColor)!=null?o:c(this,A).hoverColor;return}let n=ka(c(this,A),e);if(n!=null){if(n.type==="custom-geometry"){let s=c(this,A).entity3DMap.get(n.id);if(s instanceof dt&&s.components[0]instanceof yo){let p=i;lo(n,p.visible),Rf(n,p.altitude),Nf(n,p.position,this.convertTo3DMapPosition),kf(n,Y(this,fe,Fe).call(this,p.parent,!1))}}else if(n.type==="model"||n.type==="path"){let s=i;de(n,s.interactive,c(this,A))&&c(this,mt).call(this),n.type==="path"&&(s=s,kb(n,s),lo(n,s.visible))}else if(n.type==="group-container"){let s=i;lo(n,s.visible)&&(c(this,_).outlineInterpolationSystem.dirty=!0),de(n,s.interactive,c(this,A))&&c(this,mt).call(this),Rf(n,s.altitude)}else if(n.type==="geometry-group"){let s=i;lo(n,s.visible)&&(c(this,_).outlineInterpolationSystem.dirty=!0),Db(n,c(this,A),s)&&(c(this,_).outlineInterpolationSystem.dirty=!0),Bf(n,s.outline)&&(c(this,_).outlineInterpolationSystem.geometries3DDirty=!0),Ob(n,s.shading),Vb(n,c(this,A),s.opacity),de(n,s.interactive,c(this,A))&&(c(this,mt).call(this),c(this,Ct).call(this))}else if(n.type==="geometry"){if(n.components[0]instanceof Jt){let s=i;lo(n,s.visible)&&(c(this,_).outlineInterpolationSystem.geometries3DDirty=!0),Bf(n,s.outline)&&(c(this,_).outlineInterpolationSystem.geometries3DDirty=!0),Ab(n,s),Gb(n,s.hoverColor),de(n,s.interactive,c(this,A))}c(this,mt).call(this)}else if(n.type==="label"||n.type==="marker"){let s=i;Fb(n,i),Rb(n,i)&&c(this,Ct).call(this),Bb(n,(a=s.options)==null?void 0:a.rank)&&c(this,Ct).call(this),Nf(n,s.position,this.convertTo3DMapPosition),kf(n,Y(this,fe,Fe).call(this,s.parent,!1))&&(c(this,Ct).call(this),c(this,_).panBoundsSystem.dirty=!0),Nb(n,s.enabled),de(n,(u=s.options)==null?void 0:u.interactive,c(this,A))&&c(this,Ct).call(this)}this.render()}}convertTo3DMapPosition(e,i,n=0,o){var s,p,f,m;if(Array.isArray(e))return this.convertTo3DMapPosition(e[1],e[0],0,typeof i=="function"?i:void 0);if(typeof i!="number")throw new Error("convertTo3DMapPosition failed: longitude must be a number");let{x:a,y:u}=wu((p=(s=c(this,A).center)==null?void 0:s[1])!=null?p:0,(m=(f=c(this,A).center)==null?void 0:f[0])!=null?m:0,e,i);return o?(o.set(a,u,n),o):new W(a,u,n)}getCenter(e){let i=Array.isArray(e)?e:this.getBoundingBox(e);return i?Lv(i):void 0}isInView(e){let i=ka(c(this,A),e);if(c(this,Ss).identity().multiply(c(this,wt).projectionMatrix).multiply(c(this,wt).matrixWorldInverse),c(this,un).setFromProjectionMatrix(c(this,Ss)),i instanceof ge)return c(this,un).containsPoint(i.position);if(i instanceof dt){let n=i==null?void 0:i.components[0];if(n instanceof yo||n instanceof ui)return c(this,un).containsPoint(this.convertTo3DMapPosition(n.feature.geometry.coordinates));if(n instanceof Jt){let o=new we(this.convertTo3DMapPosition(n.featureBbox[1],n.featureBbox[0],0),this.convertTo3DMapPosition(n.featureBbox[3],n.featureBbox[2],0));return c(this,un).intersectsBox(o)}}return!1}getSystems(){return c(this,_)}getInternalState(){return c(this,A)}};se=new WeakMap,wt=new WeakMap,ds=new WeakMap,go=new WeakMap,pi=new WeakMap,on=new WeakMap,an=new WeakMap,sn=new WeakMap,vo=new WeakMap,fs=new WeakSet,Lm=l(function(e){var i;c(this,ln)!=="outdoors-overlay"&&((i=this.map)==null||i.setPixelRatio(e)),c(this,A).pixelRatio=this.resolutionScale},"#setResolutionScale"),A=new WeakMap,lt=new WeakMap,Ge=new WeakMap,vt=new WeakMap,ar=new WeakMap,Se=new WeakMap,_=new WeakMap,ms=new WeakMap,Ct=new WeakMap,mt=new WeakMap,wc=new WeakSet,A4=l(function(){E(this,lt,document.createElement("div")),c(this,lt).classList.add("mappedin__smart-collision-engine__container"),E(this,Ge,document.createElement("canvas")),c(this,Ge).classList.add("mappedin__smart-collision-engine-debug__container"),this.container.appendChild(c(this,lt)),E(this,vt,document.createElement("canvas")),c(this,vt).classList.add("mappedin__smart-collision-engine__container"),c(this,vt).width=c(this,lt).clientWidth*this.resolutionScale,c(this,vt).height=c(this,lt).clientHeight*this.resolutionScale,c(this,vt).style.width=c(this,lt).clientWidth+"px",c(this,vt).style.height=c(this,lt).clientHeight+"px",c(this,lt).appendChild(c(this,Ge)),c(this,lt).appendChild(c(this,vt)),c(this,Ge).width=c(this,lt).clientWidth,c(this,Ge).height=c(this,lt).clientHeight,c(this,vt).width=c(this,lt).clientWidth*this.resolutionScale,c(this,vt).height=c(this,lt).clientHeight*this.resolutionScale,c(this,vt).style.width=c(this,lt).clientWidth+"px",c(this,vt).style.height=c(this,lt).clientHeight+"px"},"#renderEntity2DContainer"),Tc=new WeakSet,N4=l(function(){E(this,ar,document.createElement("div")),c(this,ar).classList.add("mappedin-2d-entities"),Object.assign(c(this,ar).style,{position:"absolute",top:"0",left:"0",bottom:"0",right:"0",pointerEvents:"none","z-index":1,"transform-style":"preserve-3d"}),this.container.appendChild(c(this,ar))},"#renderEntityDOMContainer"),Ic=new WeakSet,k4=l(function(){c(this,vt).width=c(this,lt).clientWidth*this.resolutionScale,c(this,vt).height=c(this,lt).clientHeight*this.resolutionScale,c(this,vt).style.width=c(this,lt).clientWidth+"px",c(this,vt).style.height=c(this,lt).clientHeight+"px",c(this,Ge).width=c(this,lt).clientWidth,c(this,Ge).height=c(this,lt).clientHeight,c(this,vt).width=c(this,lt).clientWidth*this.resolutionScale,c(this,vt).height=c(this,lt).clientHeight*this.resolutionScale,c(this,vt).style.width=c(this,lt).clientWidth+"px",c(this,vt).style.height=c(this,lt).clientHeight+"px",c(this,_).collisionSystem.dirty=!0},"#resizeCollisionCanvas"),ln=new WeakMap,ys=new WeakMap,gs=new WeakMap,bo=new WeakMap,Ec=new WeakMap,vs=new WeakMap,bs=new WeakMap,Cs=new WeakMap,Co=new WeakMap,fe=new WeakSet,Fe=l(function(e,i=!0){if(!e)return i?c(this,A).entityScene:void 0;if(typeof e=="string"||typeof e=="number"){let n=c(this,A).entity3DMap.get(e);return n instanceof Pt?n:(G.warn("Parent is not a valid container, adding to scene"),i?c(this,A).entityScene:void 0)}else if(e.type==="group-container"){let n=c(this,A).entity3DMap.get(e.id);if(n instanceof Pt)return n}return i?c(this,A).entityScene:void 0},"#getParentContainer"),xs=new WeakSet,_m=l(function(e,i,n){let o=new ge(i,this.convertTo3DMapPosition(e[1],e[0],e[2]||n||0));return c(this,A).entity2DMap.set(o.id,o),o},"#createEntity2D"),un=new WeakMap,Ss=new WeakMap,ee=new WeakMap,re=new WeakMap,l(Nm,"Core");var Em=Nm,Ms=Em;d();function gw(r,t){vw(r,t)(r.getScene(),t),t.addFolder("Export").add({export:async()=>{let n=await r.getCurrentSceneGLTF({binary:!0}),o=new Blob([n],{type:"application/octet-stream"});var a=document.createElement("a");document.body.appendChild(a),a.style.display="none";let u=window.URL.createObjectURL(o);a.href=u,a.download="scene.glb",a.click(),window.URL.revokeObjectURL(u)}},"export")}l(gw,"mountSceneGraphVisualizer");function vw(r,t){let e=t;return l(function i(n,o){let a=o.addFolder(`${[n.type]} ${n.id.slice(0,16)}`);if(o.close(),n.type==="geometry"||n.type==="model"||n.type==="path"){let u={set visible(s){let p=r.getState(n.id);((p==null?void 0:p.type)==="geometry"||(p==null?void 0:p.type)==="path")&&r.setState(n,{visible:s})},get visible(){let s=r.getState(n.id);return(s==null?void 0:s.type)==="geometry"||(s==null?void 0:s.type)==="path"?s.visible:!1},set outline(s){let p=r.getState(n.id);(p==null?void 0:p.type)==="geometry"&&r.setState(n,{outline:s})},get outline(){let s=r.getState(n.id);return(s==null?void 0:s.type)==="geometry"?s.outline:!1},get color(){let s=r.getState(n.id);return(s==null?void 0:s.type)==="geometry"&&s.color?B(s.color).toHexString():"#ffffff"},set color(s){let p=r.getState(n.id);(p==null?void 0:p.type)==="geometry"&&r.setState(p,{color:s})},set interactive(s){let p=r.getState(n.id);((p==null?void 0:p.type)==="geometry"||(p==null?void 0:p.type)==="model"||(p==null?void 0:p.type)==="path")&&(r.setState(n,{interactive:s}),e.controllersRecursive().forEach(f=>f.updateDisplay()))},get interactive(){let s=r.getState(n.id);return(s==null?void 0:s.type)==="geometry"||(s==null?void 0:s.type)==="model"||(s==null?void 0:s.type)==="path"?s.interactive:!1},get completeFraction(){let s=r.getState(n.id);return(s==null?void 0:s.type)==="path"?s.completeFraction:1},set completeFraction(s){let p=r.getState(n.id);(p==null?void 0:p.type)==="path"&&r.setState(p,{completeFraction:s})},focus:()=>{}};a.add(u,"focus").onChange(()=>{let s=r.getState(n.id);(s==null?void 0:s.type)==="model"||(s==null?void 0:s.type)==="path"?r.camera.focusOn([s.position]):(s==null?void 0:s.type)==="geometry"&&r.camera.focusOn(r.getBoundingBox(s))}),a.add(u,"interactive"),n.type==="path"&&a.add(u,"completeFraction",0,1,.1),a.add(u,"visible"),n.type!=="model"&&(a.addColor(u,"color"),a.add(u,"outline"))}else if(n.type==="marker"){let u={get interactive(){var p;let s=r.getState(n.id);return(s==null?void 0:s.type)==="marker"?(p=s.options)==null?void 0:p.interactive:!1},set interactive(s){let p=r.getState(n.id);(p==null?void 0:p.type)==="marker"&&(r.setState(p,{options:{interactive:s}}),e.controllersRecursive().forEach(f=>f.updateDisplay()))},focus:()=>{}};a.add(u,"focus").onChange(()=>{let s=r.getState(n.id);(s==null?void 0:s.type)==="marker"&&r.camera.focusOn([s.position])}),a.add(u,"interactive")}else if(n.type==="label"){let u={get interactive(){var p;let s=r.getState(n.id);return(s==null?void 0:s.type)==="label"?(p=s.options)==null?void 0:p.interactive:!1},set interactive(s){let p=r.getState(n.id);(p==null?void 0:p.type)==="label"&&(r.setState(p,{options:{interactive:s}}),e.controllersRecursive().forEach(f=>f.updateDisplay()))},get text(){let s=r.getState(n.id);return(s==null?void 0:s.type)==="label"?s.text:""},set text(s){let p=r.getState(n.id);(p==null?void 0:p.type)==="label"&&r.setState(p,{text:s})},get"Text Color"(){var p,f;let s=r.getState(n.id);return(s==null?void 0:s.type)==="label"?(f=(p=s.options.appearance)==null?void 0:p.text)==null?void 0:f.foregroundColor:"#000000"},set"Text Color"(s){let p=r.getState(n.id);(p==null?void 0:p.type)==="label"&&r.setState(n.id,{text:u.text,options:{appearance:{text:{foregroundColor:s}}}})},get"Text Size"(){var p,f;let s=r.getState(n.id);return(s==null?void 0:s.type)==="label"?(f=(p=s.options.appearance)==null?void 0:p.text)==null?void 0:f.size:10},set"Text Size"(s){let p=r.getState(n.id);(p==null?void 0:p.type)==="label"&&r.setState(p,{text:u.text,options:{appearance:{text:{size:s}}}})},get"Icon Size"(){var p,f;let s=r.getState(n.id);return(s==null?void 0:s.type)==="label"?(f=(p=s.options.appearance)==null?void 0:p.marker)==null?void 0:f.iconSize:10},set"Icon Size"(s){let p=r.getState(n.id);(p==null?void 0:p.type)==="label"&&r.setState(p,{text:u.text,options:{appearance:{marker:{iconSize:s}}}})},get"Active Foreground Color"(){var p,f,m;let s=r.getState(n.id);return(s==null?void 0:s.type)==="label"?(m=(f=(p=s.options.appearance)==null?void 0:p.marker)==null?void 0:f.foregroundColor)==null?void 0:m.active:"#000000"},set"Active Foreground Color"(s){var f,m;let p=r.getState(n.id);(p==null?void 0:p.type)==="label"&&r.setState(p,{text:u.text,options:{appearance:{marker:{foregroundColor:{...(m=(f=p.options.appearance)==null?void 0:f.marker)==null?void 0:m.foregroundColor,active:s}}}}})},get"Inactive Foreground Color"(){var p,f,m;let s=r.getState(n.id);return(s==null?void 0:s.type)==="label"?(m=(f=(p=s.options.appearance)==null?void 0:p.marker)==null?void 0:f.foregroundColor)==null?void 0:m.inactive:"#000000"},set"Inactive Foreground Color"(s){var f,m;let p=r.getState(n.id);(p==null?void 0:p.type)==="label"&&r.setState(p,{text:u.text,options:{appearance:{marker:{foregroundColor:{...(m=(f=p.options.appearance)==null?void 0:f.marker)==null?void 0:m.foregroundColor,inactive:s}}}}})},get"Active Background Color"(){var p,f,m;let s=r.getState(n.id);return(s==null?void 0:s.type)==="label"?(m=(f=(p=s.options.appearance)==null?void 0:p.marker)==null?void 0:f.backgroundColor)==null?void 0:m.active:"#000000"},set"Active Background Color"(s){var f,m;let p=r.getState(n.id);(p==null?void 0:p.type)==="label"&&r.setState(p,{text:u.text,options:{appearance:{marker:{backgroundColor:{...(m=(f=p.options.appearance)==null?void 0:f.marker)==null?void 0:m.backgroundColor,active:s}}}}})},get"Inactive Background Color"(){var p,f,m;let s=r.getState(n.id);return(s==null?void 0:s.type)==="label"?(m=(f=(p=s.options.appearance)==null?void 0:p.marker)==null?void 0:f.backgroundColor)==null?void 0:m.inactive:"#000000"},set"Inactive Background Color"(s){var f,m;let p=r.getState(n.id);(p==null?void 0:p.type)==="label"&&r.setState(p,{text:u.text,options:{appearance:{marker:{backgroundColor:{...(m=(f=p.options.appearance)==null?void 0:f.marker)==null?void 0:m.backgroundColor,inactive:s}}}}})},focus:()=>{}};a.add(u,"focus").onChange(()=>{let s=r.getState(n.id);(s==null?void 0:s.type)==="label"&&r.camera.focusOn([s.position])}),a.add(u,"interactive"),a.add(u,"text"),a.add(u,"Text Size",10,50),a.add(u,"Icon Size",10,50),a.addColor(u,"Text Color"),a.addColor(u,"Active Background Color"),a.addColor(u,"Inactive Background Color"),a.addColor(u,"Active Foreground Color"),a.addColor(u,"Inactive Foreground Color")}else if(n.type==="geometry-group"){let u={get opacity(){let s=r.getState(n.id);return(s==null?void 0:s.type)==="geometry-group"?s.opacity:1},set opacity(s){let p=r.getState(n.id);(p==null?void 0:p.type)==="geometry-group"&&r.setState(n,{opacity:s})},set visible(s){let p=r.getState(n.id);(p==null?void 0:p.type)==="geometry-group"&&r.setState(n,{visible:s})},get visible(){let s=r.getState(n.id);return(s==null?void 0:s.type)==="geometry-group"?s.visible:!1},set outline(s){let p=r.getState(n.id);(p==null?void 0:p.type)==="geometry-group"&&r.setState(n,{outline:s})},get outline(){let s=r.getState(n.id);return(s==null?void 0:s.type)==="geometry-group"?s.outline:!1},set interactive(s){let p=r.getState(n.id);(p==null?void 0:p.type)==="geometry-group"&&(r.setState(n,{interactive:s}),e.controllersRecursive().forEach(f=>f.updateDisplay()))},get interactive(){let s=r.getState(n.id);return(s==null?void 0:s.type)==="geometry-group"?s.interactive:!1},get shadingStart(){var p,f;let s=r.getState(n.id);return(s==null?void 0:s.type)==="geometry-group"&&(f=(p=s.shading)==null?void 0:p.start)!=null?f:0},set shadingStart(s){let p=r.getState(n.id);(p==null?void 0:p.type)==="geometry-group"&&r.setState(p,{shading:{start:s}})},get shadingEnd(){var p,f;let s=r.getState(n.id);return(s==null?void 0:s.type)==="geometry-group"&&(f=(p=s.shading)==null?void 0:p.end)!=null?f:0},set shadingEnd(s){let p=r.getState(n.id);(p==null?void 0:p.type)==="geometry-group"&&r.setState(p,{shading:{end:s}})},get shadingIntensity(){var p,f;let s=r.getState(n.id);return(s==null?void 0:s.type)==="geometry-group"&&(f=(p=s.shading)==null?void 0:p.intensity)!=null?f:0},set shadingIntensity(s){let p=r.getState(n.id);(p==null?void 0:p.type)==="geometry-group"&&r.setState(p,{shading:{intensity:s}})}};a.add(u,"visible"),a.add(u,"opacity",0,1,.1),a.add(u,"interactive"),a.add(u,"outline"),a.add(u,"shadingStart",0,1,.1),a.add(u,"shadingEnd",0,1,.1),a.add(u,"shadingIntensity",0,1,.1)}else if(n.type==="group-container"){let u={set visible(s){let p=r.getState(n.id);(p==null?void 0:p.type)==="group-container"&&r.setState(n,{visible:s})},get visible(){let s=r.getState(n.id);return(s==null?void 0:s.type)==="group-container"?s.visible:!1},set interactive(s){let p=r.getState(n.id);(p==null?void 0:p.type)==="group-container"&&(r.setState(p,{interactive:s}),e.controllersRecursive().forEach(f=>f.updateDisplay()))},get interactive(){let s=r.getState(n.id);return(s==null?void 0:s.type)==="group-container"?s.interactive:!1}};a.add(u,"visible"),a.add(u,"interactive")}if(a.close(),n.children)for(let u of n.children.values())i(u,a)},"parseChild")}l(vw,"createParseChild");var R4="https://tiles-cdn.mappedin.com/styles/mappedin/style.json",bw="https://auth.mappedin.com/oauth2/token";async function B4(r,t){var e,i,n,o,a;if((e=t==null?void 0:t.outdoorView)!=null&&e.enabled&&((i=t==null?void 0:t.outdoorView)!=null&&i.headers)){let{Map:u,MercatorCoordinate:s}=await import("./outdoor-context-v4-56ZD4XF4.js"),p=t.outdoorView.headers;p==null&&(p=await Iv(bw));let f=t.center||[0,0],m=new u({container:r,style:t.outdoorView.style||R4,center:f,attributionControl:!1,zoom:(n=t.zoomLevel)!=null?n:Dm,pitch:(o=t.pitch)!=null?o:Om,bearing:(a=t.bearing)!=null?a:Am,transformRequest:w=>{var L;return{url:w,headers:(L=t.outdoorView)==null?void 0:L.headers}},trackResize:!1,pixelRatio:oi(),antialias:typeof t.antialias=="boolean"?t.antialias:!0,boxZoom:!1,doubleClickZoom:!1,scrollZoom:!1,dragPan:!1,dragRotate:!1,keyboard:!1,touchZoomRotate:!1}),y=m.painter.context.gl,x=new Ms(r,{center:f,zoomLevel:m.getZoom(),pitch:m.getPitch(),bearing:m.getBearing(),gl:y,map:m,mode:"outdoors-interleaved",watermark:t.watermark,attribution:t.attribution,antialias:t.antialias}),S={center:m.getCenter().toArray(),zoom:m.getZoom(),bearing:m.getBearing(),pitch:m.getPitch()};m.setMinZoom(x.camera.minZoomLevel),m.setMaxZoom(x.camera.maxZoomLevel),x.on("camera-change",w=>{S.center=w.center,S.zoom=w.zoomLevel,S.bearing=-w.bearing,S.pitch=w.pitch,m.jumpTo(S)});let M=s.fromLngLat(f,0),g=Tu(M,x.viewCamera,x.camera,()=>{x.renderSync()});m.on("style.load",async()=>{m&&(m.addLayer(g),x.renderSync())});let C=!1,I=!1;m.on("idle",()=>{m&&(C||(x.publish("outdoor-view-loaded"),C=!0),I||(x.publish("outdoor-style-loaded"),I=!0))});let T=l(w=>{w&&(w.sourceDataType==="metadata"||w.sourceDataType==="visibility"||w.dataType==="style"||w.type==="terrain")&&x.getSystems().htmlControlsSystem.updateData(m)},"updateData");return m.on("styledata",w=>{m&&w&&w.dataType==="style"&&w.type==="styledata"&&(I=!1),T(w)}),m.on("sourcedata",T),m.on("terrain",T),m.on("error",w=>{var L;if(((L=w.error)==null?void 0:L.url)===R4){G.error(`Failed to load outdoor view style, possibly due to invalid token "${p["x-mappedin-tiles-key"]}"`);return}G.warn(w)}),x}else return new Ms(r,t)}l(B4,"createRenderer");var Ps=Ar(Kn());var Lc=30,Cw=1e3,xo,ws,km=class km extends J{constructor(e,i){super();this.api=e;this.core=i;P(this,xo,void 0);P(this,ws,0);v(this,"includedFloors",[]);v(this,"expanded",!1);i.on("camera-change",n=>{var u;let o=Math.floor(n.elevation/Lc),a=(u=this.includedFloors[o])==null?void 0:u.id;this.expanded&&a&&a!==this.api.currentFloorId&&(this.api.currentFloorId=this.includedFloors[o].id,this.api.publish("floor-change",{reason:"elevation-change",floorId:this.api.currentFloorId}))})}get percentExpanded(){return c(this,ws)}set percentExpanded(e){let i=pe(e,0,1,0,Lc);this.includedFloors.forEach((n,o)=>{this.core.setState(n.containerId,{visible:!0,altitude:i*o})}),E(this,ws,e)}animateToCurrentFloor(){let e=this.includedFloors.indexOf(this.api.currentFloor)*Lc;new Ps.default.Tween({elevation:this.core.camera.elevation}).to({elevation:e},1e3).easing(Ps.default.Easing.Quadratic.Out).onUpdate(({elevation:i})=>{this.core.camera.setElevation(i),this.core.render()}).onComplete(()=>{this.api.publish("floor-change",{reason:"",floorId:this.api.currentFloorId})}).start(),this.core.render()}expand(e){return this.includedFloors=this.api.floors.filter(i=>!(e!=null&&e.excludeFloorIds.includes(i.id))),this.includedFloors.length<=1?Promise.resolve():this.animate("expand")}collapse(){return this.expanded===!0?this.animate("collapse"):Promise.resolve()}animate(e){c(this,xo)&&c(this,xo).stop();let i=this.includedFloors.indexOf(this.api.currentFloor)*Lc;return new Promise(n=>{E(this,xo,new Ps.default.Tween({percentExpanded:this.percentExpanded}).to({percentExpanded:e==="expand"?1:"0"},Cw).easing(Ps.default.Easing.Quadratic.Out).onUpdate(({percentExpanded:o})=>{this.core.camera.setElevation(i*o),this.percentExpanded=o,this.core.render()}).onComplete(()=>{this.expanded=e==="expand",this.includedFloors.forEach(o=>{this.core.setState(o.containerId,{visible:e==="collapse"?o.id===this.api.currentFloorId:!0})}),this.core.getSystems().cameraSystem.enablePedestal=e==="expand",this.core.getSystems().cameraSystem.enablePan=e==="collapse",n(),this.publish(e==="expand"?"expanded":"collapsed")}).onStart(()=>{this.includedFloors.forEach(o=>{this.core.setState(o.containerId,{visible:!0})})}).start()),this.core.render()})}};xo=new WeakMap,ws=new WeakMap,l(km,"StackedMaps");var _c=km;var xw={linear:cn.default.Easing.Linear.None,"ease-in":cn.default.Easing.Quadratic.In,"ease-out":cn.default.Easing.Quadratic.Out,"ease-in-out":cn.default.Easing.Quadratic.InOut},Rm=class Rm extends J{floors;currentFloorId="";id;renderer;mvf;styleMap;StackedMaps;animations=new Map;get currentFloor(){return this.floors.find(t=>t.id===this.currentFloorId)}setFloor(t,e){if(this.currentFloorId!==t){if(this.publish("floor-change-start",{floorId:t}),this.currentFloorId=t,this.StackedMaps.expanded)return this.StackedMaps.animateToCurrentFloor();this.floors.forEach(i=>{i.id===t?this.renderer.setState(i.containerId,{visible:!0}):this.renderer.setState(i.containerId,{visible:!1})}),this.publish("floor-change",{reason:e,floorId:this.currentFloor.id})}}cancelAnimation(t){let e=this.animations.get(t);e&&(e.tween.stop(),e.resolver(),this.animations.delete(t))}Models={add:(t,e,i)=>{let{floorId:n,...o}=i,a=i!=null&&i.floorId?this.floors.find(s=>s.id===i.floorId):this.floors[0],u=this.renderer.addModelGroup(t,{type:"FeatureCollection",features:e.map(s=>{var p;return{type:"Feature",properties:{id:ut(),rotation:(p=s.rotation)==null?void 0:p.map(f=>f*(Math.PI/180)),scale:s.scale,interactive:s.interactive},geometry:{type:"Point",coordinates:ri(s.target)}}})},{url:o.url},a.id);return this.renderer.getState(u).children},remove:(t,e)=>{this.renderer.remove(t),this.renderer.getState(e).children.length===0&&this.renderer.remove(e)}};Markers={add:(t,e,i={})=>{let{floorId:n,...o}=i,a=i!=null&&i.floorId?this.floors.find(u=>u.id===i.floorId):this.floors[0];return this.renderer.addMarker2D(t,e,o,a.id)},remove:t=>{this.renderer.remove(t)},getContentEl:t=>{let e=this.renderer.getState(t);if((e==null?void 0:e.type)==="marker")return e.element},removeAll:()=>{},setPosition:(t,e,i)=>{let n=this.renderer.getState(t);if(!n){G.error(`Failed to retrieve state for Marker with id "${t}".`);return}if(n.type!=="marker"){G.error(`Geometry with id "${t}" is not of type "marker".`);return}this.renderer.setState(n,{position:e,parent:i!=null?i:this.currentFloorId})},animateTo:(t,e,i,n)=>{let o=this.renderer.getState(t);if(!o)return G.error(`Failed to retrieve state for Marker with id "${t}".`),Promise.resolve();if(o.type!=="marker")return G.error(`Geometry with id "${t}" is not of type "marker".`),Promise.resolve();let a={duration:1e3,easing:"ease-in-out",...n};this.cancelAnimation(t);let u;new cn.default.Tween({lon:o.position[0],lat:o.position[1]}).to({lon:e[0],lat:e[1]},a.duration).easing(xw[a.easing]).onUpdate(({lon:p,lat:f})=>{this.Markers.setPosition(t,[p,f],i),this.renderer.render()}).onComplete(()=>{u()}).start();let s=new Promise(p=>{u=p});return this.renderer.render(),s}};Exporter={getCurrentSceneGLTF:async t=>this.renderer.getCurrentSceneGLTF(t)};CustomGeometries={add:(t,e,i)=>{let n=i!=null&&i.floorId?this.floors.find(a=>a.id===(i==null?void 0:i.floorId)):this.floors[0],o=ut();return this.renderer.addGeometryGroup(o,t,e,n.id),o},remove:t=>(this.renderer.remove(t.id),t.id)};Labels={all:({onCreate:t})=>{let e=0;for(let i of Object.entries(this.mvf.space)){let[n,o]=i;o&&(o.features.forEach(a=>{var f,m;let u=(f=this.styleMap[a.properties.id])==null?void 0:f.showImage,s=(m=a.properties.details)==null?void 0:m.images,p;if(u&&s&&s.length>0&&(p={marker:{icon:s[0].url}}),a.properties.center&&a.properties.externalId!==""){let y=this.renderer.addLabel2D(a.properties.center,a.properties.externalId,{id:a.properties.id+"-label",appearance:p},n);t(y.id,a.properties.externalId)}}),e++)}},add:(t,e,i={})=>{let{floorId:n,...o}=i,a=i!=null&&i.floorId?this.floors.find(s=>s.id===(i==null?void 0:i.floorId)):this.floors[0],u=this.renderer.addLabel2D(t,e,o,a.containerId);if(!u)throw new Error("label creating failed");return u},remove:t=>{this.renderer.remove(t)},removeAll:()=>{}};Paths={add:(t,e)=>new Promise(i=>{let n=[],o=t[0].floorId||"root",a=0;for(let s of t){let{floorId:p="root",latitude:f,longitude:m}=s;p!==o&&(a++,o=p),n[a]==null&&n.push({floorId:p,coordinates:[]}),n[a].coordinates.push([m,f])}let u=n.map(({floorId:s,coordinates:p})=>this.renderer.addPath({type:"FeatureCollection",features:p.map(f=>({type:"Feature",properties:{},geometry:{type:"Point",coordinates:f}}))},e,s));new cn.default.Tween({fraction:0}).to({fraction:1},(e==null?void 0:e.drawDuration)||1e3).onUpdate(({fraction:s})=>{u.forEach(p=>{this.renderer.setState(p.id,{completeFraction:s})})}).onComplete(()=>{i(u)}).start()}),remove:t=>{t.forEach(e=>{this.renderer.remove(e)})}};constructor(t,e,i,n={},o){super(),this.renderer=o,this.id=t,this.renderer.addGroupContainer(t,{},"root"),this.StackedMaps=new _c(this,this.renderer),this.mvf=e,this.styleMap=i,this.floors=this.mvf["map.geojson"].sort((a,u)=>a.elevation-u.elevation).map(a=>{var s,p;if(t!=="outdoors-container"&&((s=e.space[a.id])==null?void 0:s.features.length)===0&&((p=e.obstruction[a.id])==null?void 0:p.features.length)===0)return;let u=new xu(t,a,this.renderer,n,e,i);return u.load(),u}).filter(Boolean),this.setFloor(this.floors[0].id)}};l(Rm,"GeojsonApiMapObject");var Ts=Rm;d();var Ve,Es,Bm=class Bm{constructor({currentMapGetter:t}){P(this,Ve,new Map);P(this,Es,void 0);E(this,Es,t)}get currentMap(){return c(this,Es).call(this)}getById(t){return c(this,Ve).get(t)}add(t,e,i){let n=$e(t);if(!n)throw new Error("get coordinate failed");let o=this.currentMap;if(!o)throw new Error("currentMap should exist");let{id:a}=o.Markers.add(ri(n),e,{...i,floorId:n.floorId,rank:(i==null?void 0:i.rank)||"medium",dynamicResize:(i==null?void 0:i.dynamicResize)||!1}),u=o.Markers.getContentEl(a.toString());if(!u)throw new Error("marker component should exist");let s=new Bi(a.toString(),u,()=>{});return c(this,Ve).set(s.id,{marker:s,entityId:a.toString()}),s}remove(t){var i;let e=c(this,Ve).get(t.id);e&&((i=this.currentMap)==null||i.Markers.remove(e.entityId),c(this,Ve).delete(t.id.toString()))}removeAll(){let t=[];return c(this,Ve).forEach(({marker:e})=>{this.remove(e),t.push(e),c(this,Ve).delete(e.id.toString())}),t}setPosition(t,e){var a;let i=$e(e);if(!i){G.error("Cannot determine coordinate from target.");return}let n=this.currentMap;if(!n){G.error("Cannot determine the current map.");return}let o=c(this,Ve).get(t.id);if(!o){G.error(`Cannot find the Marker with id "${t.id}".`);return}n.Markers.setPosition(o.entityId,ri(i),(a=i.floorId)!=null?a:n.currentFloorId)}animateTo(t,e,i){var u;let n=$e(e);if(!n)return G.error("Cannot determine coordinate from target."),Promise.resolve();let o=this.currentMap;if(!o)return G.error("Cannot determine the current map."),Promise.resolve();let a=c(this,Ve).get(t.id);return a?o.Markers.animateTo(a.entityId,ri(n),(u=n.floorId)!=null?u:o.currentFloorId,i):(G.error(`Cannot find the Marker with id "${t.id}".`),Promise.resolve())}};Ve=new WeakMap,Es=new WeakMap,l(Bm,"Markers");var Is=Bm;d();var sr,_s,Fm=class Fm{constructor({currentMapGetter:t}){P(this,sr,new Map);P(this,_s,void 0);E(this,_s,t)}get currentMap(){return c(this,_s).call(this)}getById(t){return c(this,sr).get(t)}add(t,e){let i=Array.isArray(t)?t:[t],n=i.reduce((u,s)=>{var f;let p=$e(s.target);return p?(u.has(p.floorId)||u.set(p.floorId,[]),(f=u.get(p.floorId))==null||f.push({...s,target:p}),u):(G.error("Cannot determine coordinate from options."),u)},new Map);if(!i.length)throw new Error("targets should not be empty when adding a model");let o=this.currentMap;if(!o)throw new Error("currentMap should exist");let a=[];return n.forEach((u,s)=>{let p=ut();o.Models.add(p,u,{...e,floorId:s}).forEach(({id:m})=>{let y=new ma(m.toString(),p);c(this,sr).set(y.id,{model:y,entityId:m.toString(),groupId:p}),a.push(y)})}),a}remove(t){var i;let e=c(this,sr).get(t.id);e&&((i=this.currentMap)==null||i.Models.remove(e.entityId,e.groupId),c(this,sr).delete(t.id.toString()))}removeAll(){let t=[];return c(this,sr).forEach(({model:e})=>{var n;let i=c(this,sr).get(e.id);i&&(t.push(e),(n=this.currentMap)==null||n.Models.remove(i.entityId,i.groupId),c(this,sr).delete(e.id.toString()))}),t}};sr=new WeakMap,_s=new WeakMap,l(Fm,"Models");var Ls=Fm;d();var Dr,Os,Gm=class Gm{constructor({currentMapGetter:t}){P(this,Dr,new Map);P(this,Os,void 0);E(this,Os,t)}get currentMap(){return c(this,Os).call(this)}getById(t){return c(this,Dr).get(t)}async add(t,e){let i=this.currentMap;if(!i)throw new Error("currentMap should exist");let n=await i.Paths.add(t,e),o=new ya(ut());return c(this,Dr).set(o.id,{path:o,entityIds:n.map(a=>a.id.toString())}),o}remove(t){var i;let e=c(this,Dr).get(t.id);e&&((i=this.currentMap)==null||i.Paths.remove(e.entityIds),c(this,Dr).delete(t.id.toString()))}removeAll(){let t=[];return c(this,Dr).forEach(({path:e})=>{this.remove(e),t.push(e),c(this,Dr).delete(e.id.toString())}),t}};Dr=new WeakMap,Os=new WeakMap,l(Gm,"Paths");var Ds=Gm;d();var Dc=Ar(Kn());d();var F4="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAkklEQVRoge3awQ3AIAxD0VAMYf+F0yUixbL8JshXuLSwIqJCwDc9QBeZEOy9p2doAQDTM7TQ2cg5Z3qGFjpHS2YjDiGDe+/0DC0cwkYpJKdnaIFMkY1kymzEIVQcwsYhbPDem56hhc5GHELGIWwcwsYhbJS+2R1CxSFsdH5iO4SMr97Y6FxPqxytVVV+HcTEIWx+9mcIqHSOm9QAAAAASUVORK5CYII=";d();var G4=l((r,t,e=0)=>{if(Math.abs(r)>=Math.PI)throw new Error("Sector angle too wide!");let i=e/Math.tan(r/2),n=e/Math.sin(r/2),o=n+t,a=10,u=new Xe;u.moveTo(n*Math.cos(r/2)-i,n*Math.sin(r/2));for(let s=0;s<a;s++)u.lineTo(o*Math.cos(r/2-r/a*s)-i,o*Math.sin(r/2-r/a*s));for(let s=0;s<a;s++)u.lineTo(e*Math.cos(Math.PI/-2+Math.PI/a*s),e*Math.sin(Math.PI/-2+Math.PI/a*s));return new Ye(u,{depth:.1,bevelEnabled:!1,UVGenerator:Mw(t)})},"createSectorGeometry"),Vm=l((r,t,e)=>{let n=Math.sqrt(Math.pow(r,2)+Math.pow(t,2))/e;return n>1?n=1:n<0&&(n=0),new U(0,n)},"generateRadialUV"),Mw=l(r=>({generateTopUV:(t,e,i,n,o)=>{let a=e[i*3],u=e[i*3+1],s=e[n*3],p=e[n*3+1],f=e[o*3],m=e[o*3+1];return[Vm(a,u,r),Vm(s,p,r),Vm(f,m,r)]},generateSideWallUV:()=>[new U(0,1),new U(0,1),new U(0,1),new U(0,1)]}),"radialUVGenerator");var Hm="#2266ff",Pw=.7,ww=.3;function V4(){let r=new yn({color:Hm,opacity:Pw,transparent:!0,depthTest:!1,depthWrite:!1}),t=G4(Math.PI/6,Y4,X4);new gn().load(F4,i=>{r.alphaMap=i,r.needsUpdate=!0});let e=new Zt(t,r);return e.position.z=-.05,e.renderOrder=3,e}l(V4,"createBearingCone");var H4=l(()=>{let r=new Bc(.5,.5,.05,32),t=new yn({transparent:!0,color:Hm,opacity:ww,depthTest:!1,depthWrite:!1}),e=new Zt(r,t);e.scale.set(0,0,.05),e.renderOrder=2;let i=new Bc(Xm,Xm,.05,32),n=new yn({transparent:!0,color:Hm,depthTest:!1,depthWrite:!1}),o=new Zt(i,n);return o.renderOrder=3,e.rotation.x=Math.PI/2,o.rotation.x=Math.PI/2,{baseMesh:e,middleMesh:o}},"createBlueDot");var Tw={enableHighAccuracy:!0},Iw=500,Ew=150,Lw=150,_w=0,Dw=5,Ow=5,Aw=30,X4=.4,Y4=1.25,Xm=.35,Ym=class Ym extends J{constructor(e,i){super();this.core=e;this.geoJSONApi=i}watcherId=null;geometry;currentGeolocation;positionAnimation;scaleAnimation;rotationAnimation;enable(){this.watcherId&&navigator.geolocation.clearWatch(this.watcherId),this.geometry=this.core.addCustomGeometry("blue-dot",{type:"Feature",properties:{},geometry:{type:"Point",coordinates:[-79.3935,43.6532]}},{setup:e=>{let{baseMesh:i,middleMesh:n}=H4(),o=V4();e.add(i),e.add(n),e.add(o)},update:this.updateGeometryPerFrame},{visible:!1},"outdoors-container"),this.watcherId=navigator.geolocation.watchPosition(this.onPositionUpdate,this.onPositionError,Tw)}updateGeometryPerFrame=e=>{var s;let[i,n,o]=e.children,{accuracy:a,heading:u}=((s=this.currentGeolocation)==null?void 0:s.coords)||{};a!=null&&(this.scaleAnimation&&this.scaleAnimation.stop(),this.scaleAnimation=new Dc.default.Tween({scale:i.scale.x}).to({scale:pe(a,Ow,Aw,_w,Dw)},Ew).onUpdate(({scale:p})=>{i.scale.set(p,1,p)}).start()),u!=null?(o.visible=!0,this.rotationAnimation&&this.rotationAnimation.stop(),this.rotationAnimation=new Dc.default.Tween({rotation:i.scale.x}).to({rotation:it.degToRad(u)},Lw).onUpdate(({rotation:p})=>{o.rotation.z=p}).start()):o.visible=!1};onPositionUpdate=e=>{var i;if(this.currentGeolocation=e,this.geometry){let n=this.core.getState(this.geometry);n.visible===!1&&this.core.setState(this.geometry,{position:[e.coords.longitude,e.coords.latitude],visible:!0}),this.positionAnimation&&this.positionAnimation.stop(),n=this.core.getState(this.geometry);let o;if(e.coords.floorLevel!==void 0){let a=(i=this.geoJSONApi.currentMap)==null?void 0:i.floors[e.coords.floorLevel];o=a==null?void 0:a.id}this.positionAnimation=new Dc.default.Tween(n.position).to([e.coords.longitude,e.coords.latitude],Iw).onUpdate(a=>{if(this.geometry){let u={position:a};o==null&&n.parent!=="outdoors-container"?u.parent="outdoors-container":n.parent!==o&&(u.parent=o,this.publish("floor-change",{reason:"blue-dot-floor-change",floorId:o})),this.core.setState(this.geometry,u)}}).start(),this.core.render()}};onPositionError=e=>{switch(e.code){case e.PERMISSION_DENIED:G.error("Geolocation permission denied by the user.",e);break;case e.POSITION_UNAVAILABLE:G.error("Geolocation position unavailable.",e);break;case e.TIMEOUT:G.error("Geolocation request timed out.",e);break;default:G.error("An unknown geolocation error occurred.",e);break}this.disable()};disable(){this.watcherId&&navigator.geolocation.clearWatch(this.watcherId),this.geometry&&(this.core.remove(this.geometry.id),this.geometry=void 0),this.currentGeolocation=void 0}};l(Ym,"BlueDot");var Oc=Ym;d();var Or,As,jm=class jm{constructor({currentMapGetter:t}){P(this,Or,new Map);P(this,As,void 0);E(this,As,t)}get currentMap(){return c(this,As).call(this)}getById(t){return c(this,Or).get(t)}add(t,e,i){let n=this.currentMap;if(!n)throw new Error("currentMap should exist");let o=n.CustomGeometries.add(t,e||{},{floorId:i==null?void 0:i.id}),a=new va(o);return c(this,Or).set(a.id,a),a}remove(t){var i;c(this,Or).get(t.id)&&((i=this.currentMap)==null||i.CustomGeometries.remove(t),c(this,Or).delete(t.id.toString()))}removeAll(){let t=[];return c(this,Or).forEach(e=>{this.remove(e),t.push(e.id),c(this,Or).delete(e.id.toString())}),t}};Or=new WeakMap,As=new WeakMap,l(jm,"CustomGeometries");var Ac=jm;d();var ks,Wm=class Wm{constructor({currentMapGetter:t}){P(this,ks,void 0);E(this,ks,t)}get currentMap(){return c(this,ks).call(this)}setFromStyleCollection(t){var e,i,n;for(let o in t)for(let a of((e=this.currentMap)==null?void 0:e.floors)||[])if(t[o]!=null){if(a.layers.has(o)&&"color"in t[o]){let u=a.layers.get(o);(i=this.currentMap)==null||i.renderer.setState(u,{color:t[o].color})}if(o===Cu&&!(Xi in t)){let u=a.layers.get(Xi);u&&"color"in t[o]&&((n=this.currentMap)==null||n.renderer.setState(u,{color:t[o].color}))}}}};ks=new WeakMap,l(Wm,"Style");var Ns=Wm;d();var lr,Rs,Um=class Um{constructor(t,e){P(this,lr,void 0);P(this,Rs,void 0);E(this,lr,t),E(this,Rs,e||[])}setStyle(t){var e,i;if(c(this,lr).map){(e=c(this,lr).map)==null||e.setStyle(t),(i=c(this,lr).map)==null||i.moveLayer(Na);for(let[n,o]of c(this,Rs)||[])c(this,lr).hideOutdoorLayersUnderPoint(n,o)}}get map(){return c(this,lr).map}get enabled(){return!!c(this,lr).map}};lr=new WeakMap,Rs=new WeakMap,l(Um,"Outdoor");var So=Um;var Zm=class Zm{core;outdoors;mapObjects=[];id;mapDataExternal={};mapsByFloorId={};mapData;currentMap;directions;hiddenOutdoorGeometries=[];mapView;Camera;Labels;Markers;Models;Paths;Exporter;Navigation;Outdoor;BlueDot;CustomGeometries;Style;constructor(t,e){this.core=t,this.mapView=e,this.Camera=new Sa(this.core),this.id=this.core.addGroupContainer("root").id.toString(),this.outdoors=new Ts("outdoors-container",{"map.geojson":[{id:"outdoors",externalId:"outdoors",elevation:0}],"styles.json":{},space:{},entrance:{},obstruction:{}},{},{},this.core),this.mapObjects.push(this.outdoors);let i=new ga(this.Camera);this.core.on("camera-change",()=>{this.mapView.publish("camera-change",i)});let n=l(u=>s=>{var g,C;let p=[],f=[],m=[];s.labels.forEach(I=>{let T=this.Labels.getById(I.toString());T&&p.push(T.label)}),s.markers.forEach(I=>{let T=this.Markers.getById(I.toString());T&&f.push(T.marker)}),s.models.forEach(I=>{let T=this.Models.getById(I.toString());T&&m.push(T.model)});let y=s.geometry[0],x;y&&(x=(g=this.getMapDataInternal())==null?void 0:g.getById("space",y)),x||(x=(C=this.getMapDataInternal())==null?void 0:C.getById("object",y));let S=s.containers.reduce((I,T)=>{var L;let w=(L=this.getMapDataInternal())==null?void 0:L.getById("floor",T);return w&&kn.is(w)&&I.push(w),I},[]),M={coordinate:new Q(s.coordinate[1],s.coordinate[0]),spaces:x&&_e.is(x)?[x]:[],objects:x&&De.is(x)?[x]:[],markers:f,labels:p,models:m,floors:S};"pointerEvent"in s&&(M.pointerEvent=s.pointerEvent),this.mapView.publish(u,M)},"createHandler");this.core.on("hover",n("hover")),this.core.on("click",n("click")),this.core.on("outdoor-view-loaded",()=>{this.mapView.publish("outdoor-view-loaded")}),this.core.on("outdoor-style-loaded",()=>{this.mapView.publish("outdoor-style-loaded")}),this.core.on("user-interaction-start",()=>{this.mapView.publish("user-interaction-start")}),this.core.on("user-interaction-end",()=>{this.mapView.publish("user-interaction-end")});let o=l(()=>this.currentMap,"currentMapGetter");this.Markers=new Is({currentMapGetter:o}),this.Models=new Ls({currentMapGetter:o}),this.Labels=new La({currentMapGetter:o}),this.Exporter=new Ea({currentMapGetter:o}),this.Paths=new Ds({currentMapGetter:o}),this.Navigation=new eu(e),this.BlueDot=new Oc(this.core,this),this.BlueDot.on("floor-change",u=>{this.setFloor(u.floorId,"blue-dot-floor-change")}),this.Outdoor=new So(this.core,this.hiddenOutdoorGeometries),this.CustomGeometries=new Ac({currentMapGetter:o}),this.Style=new Ns({currentMapGetter:o});let a=new su(e,this.mapDataExternal);this.auto=a.auto}updateState(t,e){var n;if(t==="walls"){(n=this.currentMap)==null||n.floors.forEach(o=>{var s,p;let a=o.layers.get(Cu),u=o.layers.get(Xi);a&&((s=this.core.getState(a))==null||s.children.forEach(f=>{this.core.setState(f.id,e)})),u&&((p=this.core.getState(u))==null||p.children.forEach(f=>{this.core.setState(f.id,e)}))});return}let i=typeof t=="string"?this.getMapDataObject(t):t;if(i){if(Qr.is(i))return this.core.setState(i.id,uv({...e,type:"label"},this.core.getState(i.id)));if(Bi.is(i))return this.core.setState(i.id,cv({...e,type:"marker"},this.core.getState(i.id)));(_e.is(i)||De.is(i))&&this.core.setState(i.id,pv({...e,type:"geometry"},this.core.getState(i.id)))}}getMapDataObject(t){var e;return(e=this.getMapDataInternal())==null?void 0:e.getMapDataById(t)}update=()=>{this.core.render()};getMapDataInternal(){if(this.mapData)return $s.get(this.mapData)}getMapData(){return this.mapData}expand(t){var e;return(e=this.currentMap)==null?void 0:e.StackedMaps.expand({excludeFloorIds:(t==null?void 0:t.excludeFloors.map(i=>i.id))||[]})}collapse(){var t;return(t=this.currentMap)==null?void 0:t.StackedMaps.collapse()}addMap(t,e){return new Promise(i=>{var y,x,S;let n=$s.get(t);if(!n){G.error("error exists"),i(t);return}this.mapDataExternal[t.mapName]=t;let{mvf:o}=n,a=o["manifest.geojson"].features[0].geometry.coordinates;this.core.mode!=="outdoors-overlay"&&this.Camera.set({center:new Q(a[0],a[1])});let u=fv(o["styles.json"]||{}),s=o["manifest.geojson"].features[0].properties.name,p=new Ts(`mapObject-${s}`,o,u,e,this.core),f=this.core.getBoundingBox(p.currentFloor.id),m=(x=(y=e==null?void 0:e.outdoorView)==null?void 0:y.layersHiddenByGeometry)!=null?x:[];if(m.length>0){let M=(S=this.core.getCenter(f))!=null?S:a;this.core.hideOutdoorLayersUnderPoint(M,m),this.hiddenOutdoorGeometries.push([M,m])}this.mapObjects.push(p),o["map.geojson"].forEach(M=>{this.mapsByFloorId[M.id]=p}),p.StackedMaps.on("expanded",()=>{this.mapView.publish("expanded")}),p.StackedMaps.on("collapsed",()=>{this.mapView.publish("collapsed")}),p.on("floor-change-start",()=>{this.mapView.publish("floor-change-start",{floor:this.currentFloor})}),p.on("floor-change",M=>{this.mapView.publish("floor-change",{reason:M.reason,floor:this.currentFloor})}),this.currentMap=p,this.mapData=t,this.directions=new gu({nodes:this.currentMap.mvf["node.geojson"],obstructions:this.currentMap.mvf.obstruction,connections:this.currentMap.mvf["connection.json"],groupBy:"map"}),e!=null&&e.zoomLevel||this.core.mode!=="outdoors-overlay"&&this.core.camera.focusOn(f,{duration:0,padding:{top:.05*this.core.canvasHeight,left:.05*this.core.canvasWidth,right:.05*this.core.canvasWidth,bottom:.05*this.core.canvasHeight}}),i(t)})}setFloor(t,e){if(!this.currentMap)throw new Error("mappObject should exist atm");this.currentMap.setFloor(typeof t=="string"?t:t.id,e)}get currentFloor(){var i,n;let t=(i=this.currentMap)==null?void 0:i.currentFloor.id;if(!t)throw new Error("Missing currentFloor object from GeoJsonApi");let e=(n=this.mapData)==null?void 0:n.getById("floor",t);if(!e)throw new Error("Missing currentFloor");return e}getState(t){var n;let e=typeof t=="string"?t:t.id,i=this.core.getState(e);if(i){if(i.type==="geometry")return{type:"geometry",interactive:i.interactive,hoverColor:i.hoverColor,color:i.color,visible:i.visible};if(i.type==="label"&&i.options.appearance&&i.options.rank!==void 0&&i.options.interactive!==void 0)return{type:"label",appearance:i.options.appearance,rank:i.options.rank,enabled:i.enabled,interactive:i.options.interactive};if(i.type==="marker"&&((n=i.options)==null?void 0:n.rank)!==void 0&&i.options.interactive!==void 0){let o=typeof i.parent=="object"?i.parent.id:i.parent;return{type:"marker",rank:i.options.rank,interactive:i.options.interactive,enabled:i.enabled,element:i.element,coordinate:new Q(i.position[1],i.position[0],o.toString())}}else if(i.type==="model")return{type:"model"}}}setHoverColor(t){this.core.setState({hoverColor:t})}getHoverColor(){let t=this.core.getState();return(t==null?void 0:t.type)==="map-view"?t.hoverColor:void 0}getDirections=(t,e,i)=>{if(!this.directions)throw new Error("You have to call .addMap() before you can get directions");let n=this.getMapDataInternal();if(!n)throw new Error("getDirections failed due to missing mapData");let{accessible:o=!1,smoothing:a=!0}=i||{},u=Array.isArray(t)?t:[t],s=Array.isArray(e)?e:[e],p=typeof a=="object"?a.enabled:a,f=typeof a=="object"?a.radius:void 0,m={accessible:o,smoothing:{enabled:p!=null?p:!0,radius:f!=null?f:.75}};return this.directions.getDirections(u,s,m,n)};createCoordinate(t,e,i){return new Q(t,e,(i==null?void 0:i.id)||this.currentFloor.id)}createCoordinateFromScreenCoordinate(t,e,i){let n=this.core.projectScreenXYToCoordinate(t,e);return n?new Q(n[1],n[0],(i==null?void 0:i.id)||this.currentFloor.id):void 0}isInView(t){return this.core.isInView(typeof t=="string"?t:t.id)}auto(){this.Labels.all()}get __core(){return this.core}destroy(){this.core.destroy()}};l(Zm,"GeoJsonApi");var Bs=Zm;var Gs,tt,zm=class zm extends J{constructor(e){super();P(this,Gs,{});P(this,tt,void 0);v(this,"Camera");v(this,"Labels");v(this,"Markers");v(this,"Models");v(this,"Paths");v(this,"Exporter");v(this,"Navigation");v(this,"BlueDot");v(this,"Style");v(this,"CustomGeometries");v(this,"Outdoor");v(this,"update",()=>{c(this,tt).core.render()});v(this,"getDirections",(e,i,n)=>c(this,tt).getDirections(e,i,n));v(this,"on",(e,i)=>{super.on(e,i)});v(this,"off",(e,i)=>{super.off(e,i)});let i=new Bs(e,this);E(this,tt,i),this.Camera=c(this,tt).Camera,E(this,Gs,c(this,tt).mapDataExternal),this.Markers=c(this,tt).Markers,this.Models=c(this,tt).Models,this.Labels=c(this,tt).Labels,this.Exporter=c(this,tt).Exporter,this.Paths=c(this,tt).Paths,this.Navigation=c(this,tt).Navigation,this.BlueDot=c(this,tt).BlueDot,this.CustomGeometries=c(this,tt).CustomGeometries,this.Style=c(this,tt).Style,this.auto=c(this,tt).auto,this.Outdoor=c(this,tt).Outdoor}updateState(e,i){return c(this,tt).updateState(e,i)}getMapData(){return c(this,Gs)}expand(e){return c(this,tt).expand(e)}collapse(){return c(this,tt).collapse()}addMap(e,i){return c(this,tt).addMap(e,i)}setFloor(e){c(this,tt).setFloor(e)}get currentFloor(){return c(this,tt).currentFloor}getState(e){return c(this,tt).getState(e)}setHoverColor(e){c(this,tt).setHoverColor(e)}getHoverColor(){return c(this,tt).getHoverColor()}isInView(e){return c(this,tt).isInView(e)}createCoordinate(e,i,n){return c(this,tt).createCoordinate(e,i,n)}createCoordinateFromScreenCoordinate(e,i,n){return c(this,tt).createCoordinateFromScreenCoordinate(e,i,n)}auto(){this.Labels.all()}get __core(){return c(this,tt).core}destroy(){c(this,tt).destroy()}async enableDebug(){let{Inspector:e}=await import("./inspector-RBV6MS2D.js");await new e(this,c(this,tt)).enable()}};Gs=new WeakMap,tt=new WeakMap,l(zm,"MapView");var Fs=zm;d();var qm=class qm extends J{gl;el=document.createElement("div");core;origin;constructor(t){super(),this.origin=t}onAdd(t){this.origin=this.origin||t.getCenter().toArray(),this.gl=t.painter.context.gl,this.core=new Ms(t._container,{center:this.origin,zoomLevel:t.getZoom(),pitch:t.getPitch(),bearing:t.getBearing(),gl:this.gl,map:t,mode:"outdoors-overlay"}),this.core.camera.setMinZoomLevel(t.getMinZoom()),this.core.camera.setMaxZoomLevel(t.getMaxZoom()),this.core.camera.setMinPitch(t.getMinPitch()),this.core.camera.setMaxPitch(t.getMaxPitch()),t.on("error",n=>{G.warn(n)});let e=qs.fromLngLat(this.origin,0),i=Tu(e,this.core.viewCamera,this.core.camera,()=>{this.core.renderSync()});return t.on("style.load",async()=>{t.addLayer(i),this.core.camera.setMinZoomLevel(t.getMinZoom()),this.core.camera.setMaxZoomLevel(t.getMaxZoom()),this.core.camera.setMinPitch(t.getMinPitch()),this.core.camera.setMaxPitch(t.getMaxPitch())}),t.on("move",()=>{let[n,o]=t.getCenter().toArray();this.core.getSystems().cameraSystem.setCenter(n,o),this.core.getSystems().cameraSystem.setZoomLevel(t.getZoom()),this.core.getSystems().cameraSystem.setRotation(it.degToRad(-t.getBearing())),this.core.getSystems().cameraSystem.setTilt(it.degToRad(t.getPitch()))}),this.el}onRemove(){}};l(qm,"MapLibreOverlay");var Nc=qm;d();function j4(r){var t,e;if((t=r.outdoorView)!=null&&t.enabled&&!((e=r.outdoorView)!=null&&e.token)){let i=new Error("Missing outdoorView token");throw i.name="MissingOutdoorViewToken",i}}l(j4,"validateOptions");function W4(r,t){var n,o,a,u;let e=((n=r==null?void 0:r.outdoorView)==null?void 0:n.token)||t.outdoorViewToken,i={...Da,...r!=null?r:{},outdoorView:{enabled:((o=r==null?void 0:r.outdoorView)==null?void 0:o.enabled)===void 0?!!e:(a=r==null?void 0:r.outdoorView)==null?void 0:a.enabled,layersHiddenByGeometry:(u=Da.outdoorView)==null?void 0:u.layersHiddenByGeometry,...r==null?void 0:r.outdoorView}};return e&&i.outdoorView&&(i.outdoorView.token=e),i}l(W4,"handleDefault");var Fq=l(async(r,t)=>{let e;if(t){let{access_token:o}=await Js(t);e=o}let i=new aa(r,e);return new Vc(i)},"hydrateMapDataFromMVF"),Gq=l(async r=>{let t={emitAnalyticsEvents:!0,...r},e;if("accessToken"in t)e=t.accessToken;else{let{access_token:s}=await Js(t);e=s}let i=await Yc(t,e),n=await Wc(i),o=jc(n);typeof r.onMVFParsed=="function"&&r.onMVFParsed(o);let a=new aa(o,e);return new Vc(a)},"getMapData"),pn,Mo,kc=class kc extends Nc{constructor(e,i,n){super(e);P(this,pn,void 0);P(this,Mo,void 0);E(this,pn,i),E(this,Mo,n)}onAdd(e){var o,a;super.onAdd(e);let i={...Da,...(o=c(this,Mo))!=null?o:{},outdoorView:{token:c(this,pn).outdoorViewToken,...(a=c(this,Mo))==null?void 0:a.outdoorView}},n=new Fs(this.core);return n.addMap(c(this,pn),i).then(()=>{this.publish("loaded",{mapView:n,mapData:c(this,pn)})}),this.el}};pn=new WeakMap,Mo=new WeakMap,l(kc,"MappedinMapLibreOverlay"),v(kc,"instance");var Vs=kc,Vq=l((r,t)=>{Vs.instance!=null&&G.warn("Only a single map venue is supported at this time.");let e=new Vs([r.mapCenter.longitude,r.mapCenter.latitude],r,t);return Vs.instance=e,e},"createMapLibreOverlay"),Nw=l(async(r,t,e)=>{var a,u,s,p,f;let i=W4(e,t);try{e&&j4(e)}catch(m){if(m instanceof Error&&m.name==="MissingOutdoorViewToken")G.error("Enable outdoor view requires a token. Provide token in `options.outdoorView.token`");else throw m}let n=await B4(r,{center:[t.mapCenter.longitude,t.mapCenter.latitude],bearing:i.bearing,pitch:i.pitch,zoomLevel:i.zoomLevel,outdoorView:(a=i.outdoorView)!=null&&a.token?{headers:{"x-mappedin-tiles-key":(u=i.outdoorView)==null?void 0:u.token},style:(s=i.outdoorView)==null?void 0:s.style,enabled:!!((p=i.outdoorView)!=null&&p.enabled)}:void 0,watermark:i.watermark,attribution:i.attribution,antialias:typeof i.antialiasing=="boolean"?i.antialiasing:!!((f=i.antialiasing)!=null&&f.enabled)}),o=new Fs(n);return await o.addMap(t,i),o},"show3dMapGeojson"),Hq=Nw;export{jc as a,Wc as b,Q as c,Kl as d,Ur as e,_e as f,kn as g,qr as h,De as i,Ql as j,zr as k,Rn as l,Cv as m,gw as n,Fq as o,Gq as p,Vq as q,Nw as r,Hq as s};