@mappedin/mappedin-js 6.0.1-beta.2 → 6.0.1-beta.3

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 rp,i as X1,j as cl}from"./chunk-4GHXJDEX.js";import{a as Je}from"./chunk-BC5TNRJZ.js";import{A as P1,B as M1,C as w1,D as Y,E as yr,F as T1,G as gr,Ga as In,H as Pn,I as _e,J as It,Ja as ll,Ka as G1,L as Vr,M as Ho,Na as V1,O as Ft,P as I1,Q as Xo,Qa as $e,R as E1,Ra as H1,S as L1,T as D1,U as Mn,X as _1,Y as O1,Z as al,a as ol,c as Vo,ca as A1,d as ze,fa as sl,ga as wn,ha as k1,ja as Pi,m as x1,n as S1,pa as N1,qa as Hr,ra as ep,sa as R1,ta as Ze,u as Si,ua as qe,va as B1,w as ot,wa as F1,x as U,ya as Tn}from"./chunk-GQMFEIP3.js";import{a as l,b as k,d as Gr,e as v,f as u,g as P,h as E,i as X,j as d,k as b}from"./chunk-HGQSHE2E.js";var ay=k((up,pp)=>{d();(function(r,t){typeof up=="object"&&typeof pp<"u"?pp.exports=t():typeof define=="function"&&define.amd?define(t):(r=r||self).RBush=t()})(up,function(){"use strict";function r(g,C,I,T,w){l(function L(_,R,G,N,j){for(;N>G;){if(N-G>600){var H=N-G+1,J=R-G+1,ut=Math.log(H),yt=.5*Math.exp(2*ut/3),Ct=.5*Math.sqrt(ut*yt*(H-yt)/H)*(J-H/2<0?-1:1),Bt=Math.max(G,Math.floor(R-J*yt/H+Ct)),De=Math.min(N,Math.floor(R+(H-J)*yt/H+Ct));L(_,R,Bt,De,j)}var gt=_[R],kt=G,Pt=N;for(t(_,G,R),j(_[N],gt)>0&&t(_,G,N);kt<Pt;){for(t(_,kt,Pt),kt++,Pt--;j(_[kt],gt)<0;)kt++;for(;j(_[Pt],gt)>0;)Pt--}j(_[G],gt)===0?t(_,G,Pt):t(_,++Pt,N),Pt<=R&&(G=Pt+1),R<=Pt&&(N=Pt-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 _=g.children[L];c(w,g.leaf?T(_):_)}return w}l(a,"h");function c(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(c,"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 _=C+Math.ceil((I-C)/T/2)*T;r(g,_,C,I,w),L.push(C,_,_,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 _=C.children[L],R=C.leaf?T(_):_;x(g,R)&&(C.leaf?I.push(_):y(g,R)?this._all(_,I):w.push(_))}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,_=this.toBBox(g),R=[],G=[];L||R.length;){if(L||(L=R.pop(),T=R[R.length-1],I=G.pop(),w=!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}w||L.leaf||!y(L,_)?T?(I++,L=T.children[I],w=!1):L=null:(R.push(L),G.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,_=this._maxEntries;if(L<=_)return o(w=S(g.slice(C,I+1)),this.toBBox),w;T||(T=Math.ceil(Math.log(L)/Math.log(_)),_=Math.ceil(L/Math.pow(_,T-1))),(w=S([])).leaf=!1,w.height=T;var R=Math.ceil(L/_),G=R*Math.ceil(Math.sqrt(_));M(g,C,I,G,this.compareMinX);for(var N=C;N<=I;N+=G){var j=Math.min(N+G-1,I);M(g,N,j,R,this.compareMinY);for(var H=N;H<=j;H+=R){var J=Math.min(H+R-1,j);w.children.push(this._build(g,H,J,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,_=void 0,R=0;R<C.children.length;R++){var G=C.children[R],N=f(G),j=(H=g,J=G,(Math.max(J.maxX,H.maxX)-Math.min(J.minX,H.minX))*(Math.max(J.maxY,H.maxY)-Math.min(J.minY,H.minY))-N);j<L?(L=j,w=N<w?N:w,_=G):j===L&&N<w&&(w=N,_=G)}C=_||C.children[0]}var H,J;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),c(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),_=S(I.children.splice(L,I.children.length-L));_.height=I.height,_.leaf=I.leaf,o(I,this.toBBox),o(_,this.toBBox),C?g[C-1].children.push(_):this._splitRoot(I,_)},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,_,R,G,N,j=1/0,H=1/0,J=C;J<=I-C;J++){var ut=a(g,0,J,this.toBBox),yt=a(g,J,I,this.toBBox),Ct=(w=ut,L=yt,_=void 0,R=void 0,G=void 0,N=void 0,_=Math.max(w.minX,L.minX),R=Math.max(w.minY,L.minY),G=Math.min(w.maxX,L.maxX),N=Math.min(w.maxY,L.maxY),Math.max(0,G-_)*Math.max(0,N-R)),Bt=f(ut)+f(yt);Ct<j?(j=Ct,T=J,H=Bt<H?Bt:H):Ct===j&&Bt<H&&(H=Bt,T=J)}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),_=a(g,I-C,I,w),R=m(L)+m(_),G=C;G<I-C;G++){var N=g.children[G];c(L,g.leaf?w(N):N),R+=m(L)}for(var j=I-C-1;j>=C;j--){var H=g.children[j];c(_,g.leaf?w(H):H),R+=m(_)}return R},i.prototype._adjustParentBBoxes=function(g,C,I){for(var T=I;T>=0;T--)c(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 yp=k(W=>{"use strict";d();Object.defineProperty(W,"__esModule",{value:!0});W.earthRadius=63710088e-1;W.factors={centimeters:W.earthRadius*100,centimetres:W.earthRadius*100,degrees:W.earthRadius/111325,feet:W.earthRadius*3.28084,inches:W.earthRadius*39.37,kilometers:W.earthRadius/1e3,kilometres:W.earthRadius/1e3,meters:W.earthRadius,metres:W.earthRadius,miles:W.earthRadius/1609.344,millimeters:W.earthRadius*1e3,millimetres:W.earthRadius*1e3,nauticalmiles:W.earthRadius/1852,radians:1,yards:W.earthRadius*1.0936};W.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/W.earthRadius,yards:1.0936133};W.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 Wr(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(Wr,"feature");W.feature=Wr;function i7(r,t,e){switch(e===void 0&&(e={}),r){case"Point":return hp(t).geometry;case"LineString":return fp(t).geometry;case"Polygon":return dp(t).geometry;case"MultiPoint":return ly(t).geometry;case"MultiLineString":return sy(t).geometry;case"MultiPolygon":return cy(t).geometry;default:throw new Error(r+" is invalid")}}l(i7,"geometry");W.geometry=i7;function hp(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(!bl(r[0])||!bl(r[1]))throw new Error("coordinates must contain numbers");var i={type:"Point",coordinates:r};return Wr(i,t,e)}l(hp,"point");W.point=hp;function n7(r,t,e){return e===void 0&&(e={}),Cl(r.map(function(i){return hp(i,t)}),e)}l(n7,"points");W.points=n7;function dp(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 c={type:"Polygon",coordinates:r};return Wr(c,t,e)}l(dp,"polygon");W.polygon=dp;function o7(r,t,e){return e===void 0&&(e={}),Cl(r.map(function(i){return dp(i,t)}),e)}l(o7,"polygons");W.polygons=o7;function fp(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 Wr(i,t,e)}l(fp,"lineString");W.lineString=fp;function a7(r,t,e){return e===void 0&&(e={}),Cl(r.map(function(i){return fp(i,t)}),e)}l(a7,"lineStrings");W.lineStrings=a7;function Cl(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(Cl,"featureCollection");W.featureCollection=Cl;function sy(r,t,e){e===void 0&&(e={});var i={type:"MultiLineString",coordinates:r};return Wr(i,t,e)}l(sy,"multiLineString");W.multiLineString=sy;function ly(r,t,e){e===void 0&&(e={});var i={type:"MultiPoint",coordinates:r};return Wr(i,t,e)}l(ly,"multiPoint");W.multiPoint=ly;function cy(r,t,e){e===void 0&&(e={});var i={type:"MultiPolygon",coordinates:r};return Wr(i,t,e)}l(cy,"multiPolygon");W.multiPolygon=cy;function s7(r,t,e){e===void 0&&(e={});var i={type:"GeometryCollection",geometries:r};return Wr(i,t,e)}l(s7,"geometryCollection");W.geometryCollection=s7;function l7(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(l7,"round");W.round=l7;function uy(r,t){t===void 0&&(t="kilometers");var e=W.factors[t];if(!e)throw new Error(t+" units is invalid");return r*e}l(uy,"radiansToLength");W.radiansToLength=uy;function mp(r,t){t===void 0&&(t="kilometers");var e=W.factors[t];if(!e)throw new Error(t+" units is invalid");return r/e}l(mp,"lengthToRadians");W.lengthToRadians=mp;function c7(r,t){return py(mp(r,t))}l(c7,"lengthToDegrees");W.lengthToDegrees=c7;function u7(r){var t=r%360;return t<0&&(t+=360),t}l(u7,"bearingToAzimuth");W.bearingToAzimuth=u7;function py(r){var t=r%(2*Math.PI);return t*180/Math.PI}l(py,"radiansToDegrees");W.radiansToDegrees=py;function p7(r){var t=r%360;return t*Math.PI/180}l(p7,"degreesToRadians");W.degreesToRadians=p7;function h7(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 uy(mp(r,t),e)}l(h7,"convertLength");W.convertLength=h7;function d7(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=W.areaFactors[t];if(!i)throw new Error("invalid original units");var n=W.areaFactors[e];if(!n)throw new Error("invalid final units");return r/i*n}l(d7,"convertArea");W.convertArea=d7;function bl(r){return!isNaN(r)&&r!==null&&!Array.isArray(r)}l(bl,"isNumber");W.isNumber=bl;function f7(r){return!!r&&r.constructor===Object}l(f7,"isObject");W.isObject=f7;function m7(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(!bl(t))throw new Error("bbox must only contain numbers")})}l(m7,"validateBBox");W.validateBBox=m7;function y7(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(y7,"validateId");W.validateId=y7});var yy=k(Et=>{"use strict";d();Object.defineProperty(Et,"__esModule",{value:!0});var jt=yp();function zo(r,t,e){if(r!==null)for(var i,n,o,a,c,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,c=y?p.geometries.length:1;for(var I=0;I<c;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(zo(a.geometries[i],t,e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}l(zo,"coordEach");function g7(r,t,e,i){var n=e;return zo(r,function(o,a,c,s,p){a===0&&e===void 0?n=o:n=t(n,o,a,c,s,p)},i),n}l(g7,"coordReduce");function hy(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(hy,"propEach");function v7(r,t,e){var i=e;return hy(r,function(n,o){o===0&&e===void 0?i=n:i=t(i,n,o)}),i}l(v7,"propReduce");function dy(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(dy,"featureEach");function b7(r,t,e){var i=e;return dy(r,function(n,o){o===0&&e===void 0?i=n:i=t(i,n,o)}),i}l(b7,"featureReduce");function C7(r){var t=[];return zo(r,function(e){t.push(e)}),t}l(C7,"coordAll");function gp(r,t){var e,i,n,o,a,c,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(c=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=c?c.type==="GeometryCollection":!1,a=s?c.geometries.length:1,n=0;n<a;n++){if(o=s?c.geometries[n]:c,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(gp,"geomEach");function x7(r,t,e){var i=e;return gp(r,function(n,o,a,c,s){o===0&&e===void 0?i=n:i=t(i,n,o,a,c,s)}),i}l(x7,"geomReduce");function xl(r,t){gp(r,function(e,i,n,o,a){var c=e===null?null:e.type;switch(c){case null:case"Point":case"LineString":case"Polygon":return t(jt.feature(e,n,{bbox:o,id:a}),i,0)===!1?!1:void 0}var s;switch(c){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(jt.feature(m,n),i,p)===!1)return!1}})}l(xl,"flattenEach");function S7(r,t,e){var i=e;return xl(r,function(n,o,a){o===0&&a===0&&e===void 0?i=n:i=t(i,n,o,a)}),i}l(S7,"flattenReduce");function fy(r,t){xl(r,function(e,i,n){var o=0;if(e.geometry){var a=e.geometry.type;if(!(a==="Point"||a==="MultiPoint")){var c,s=0,p=0,f=0;if(zo(e,function(m,y,x,S,M){if(c===void 0||i>s||S>p||M>f){c=m,s=i,p=S,f=M,o=0;return}var g=jt.lineString([c,m],e.properties);if(t(g,i,n,M,o)===!1)return!1;o++,c=m})===!1)return!1}}})}l(fy,"segmentEach");function P7(r,t,e){var i=e,n=!1;return fy(r,function(o,a,c,s,p){n===!1&&e===void 0?i=o:i=t(i,o,a,c,s,p),n=!0}),i}l(P7,"segmentReduce");function my(r,t){if(!r)throw new Error("geojson is required");xl(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 c=0;c<a.length;c++)if(t(jt.lineString(a[c],e.properties),i,n,c)===!1)return!1;break}}})}l(my,"lineEach");function M7(r,t,e){var i=e;return my(r,function(n,o,a,c){o===0&&e===void 0?i=n:i=t(i,n,o,a,c)}),i}l(M7,"lineReduce");function w7(r,t){if(t=t||{},!jt.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,c;switch(r.type){case"FeatureCollection":e<0&&(e=r.features.length+e),a=a||r.features[e].properties,c=r.features[e].geometry;break;case"Feature":a=a||r.properties,c=r.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":c=r;break;default:throw new Error("geojson is invalid")}if(c===null)return null;var s=c.coordinates;switch(c.type){case"Point":case"MultiPoint":return null;case"LineString":return o<0&&(o=s.length+o-1),jt.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),jt.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),jt.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),jt.lineString([s[i][n][o],s[i][n][o+1]],a,t)}throw new Error("geojson is invalid")}l(w7,"findSegment");function T7(r,t){if(t=t||{},!jt.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,c;switch(r.type){case"FeatureCollection":e<0&&(e=r.features.length+e),a=a||r.features[e].properties,c=r.features[e].geometry;break;case"Feature":a=a||r.properties,c=r.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":c=r;break;default:throw new Error("geojson is invalid")}if(c===null)return null;var s=c.coordinates;switch(c.type){case"Point":return jt.point(s,a,t);case"MultiPoint":return i<0&&(i=s.length+i),jt.point(s[i],a,t);case"LineString":return o<0&&(o=s.length+o),jt.point(s[o],a,t);case"Polygon":return n<0&&(n=s.length+n),o<0&&(o=s[n].length+o),jt.point(s[n][o],a,t);case"MultiLineString":return i<0&&(i=s.length+i),o<0&&(o=s[i].length+o),jt.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),jt.point(s[i][n][o],a,t)}throw new Error("geojson is invalid")}l(T7,"findPoint");Et.coordAll=C7;Et.coordEach=zo;Et.coordReduce=g7;Et.featureEach=dy;Et.featureReduce=b7;Et.findPoint=T7;Et.findSegment=w7;Et.flattenEach=xl;Et.flattenReduce=S7;Et.geomEach=gp;Et.geomReduce=x7;Et.lineEach=my;Et.lineReduce=M7;Et.propEach=hy;Et.propReduce=v7;Et.segmentEach=fy;Et.segmentReduce=P7});var vp=k((rE,vy)=>{"use strict";d();var gy=Object.prototype.toString;vy.exports=l(function(t){var e=gy.call(t),i=e==="[object Arguments]";return i||(i=e!=="[object Array]"&&t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&gy.call(t.callee)==="[object Function]"),i},"isArguments")});var Iy=k((oE,Ty)=>{"use strict";d();var wy;Object.keys||(Zo=Object.prototype.hasOwnProperty,bp=Object.prototype.toString,by=vp(),Cp=Object.prototype.propertyIsEnumerable,Cy=!Cp.call({toString:null},"toString"),xy=Cp.call(function(){},"prototype"),qo=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],Sl=l(function(r){var t=r.constructor;return t&&t.prototype===r},"equalsConstructorPrototype"),Sy={$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},Py=function(){if(typeof window>"u")return!1;for(var r in window)try{if(!Sy["$"+r]&&Zo.call(window,r)&&window[r]!==null&&typeof window[r]=="object")try{Sl(window[r])}catch{return!0}}catch{return!0}return!1}(),My=l(function(r){if(typeof window>"u"||!Py)return Sl(r);try{return Sl(r)}catch{return!1}},"equalsConstructorPrototypeIfNotBuggy"),wy=l(function(t){var e=t!==null&&typeof t=="object",i=bp.call(t)==="[object Function]",n=by(t),o=e&&bp.call(t)==="[object String]",a=[];if(!e&&!i&&!n)throw new TypeError("Object.keys called on a non-object");var c=xy&&i;if(o&&t.length>0&&!Zo.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)!(c&&f==="prototype")&&Zo.call(t,f)&&a.push(String(f));if(Cy)for(var m=My(t),y=0;y<qo.length;++y)!(m&&qo[y]==="constructor")&&Zo.call(t,qo[y])&&a.push(qo[y]);return a},"keys"));var Zo,bp,by,Cp,Cy,xy,qo,Sl,Sy,Py,My;Ty.exports=wy});var Ml=k((lE,Dy)=>{"use strict";d();var I7=Array.prototype.slice,E7=vp(),Ey=Object.keys,Pl=Ey?l(function(t){return Ey(t)},"keys"):Iy(),Ly=Object.keys;Pl.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 E7(i)?Ly(I7.call(i)):Ly(i)},"keys"))}else Object.keys=Pl;return Object.keys||Pl},"shimObjectKeys");Dy.exports=Pl});var Oy=k((pE,_y)=>{"use strict";d();_y.exports=Error});var ky=k((dE,Ay)=>{"use strict";d();Ay.exports=EvalError});var Ry=k((mE,Ny)=>{"use strict";d();Ny.exports=RangeError});var Fy=k((gE,By)=>{"use strict";d();By.exports=ReferenceError});var xp=k((bE,Gy)=>{"use strict";d();Gy.exports=SyntaxError});var br=k((xE,Vy)=>{"use strict";d();Vy.exports=TypeError});var Xy=k((PE,Hy)=>{"use strict";d();Hy.exports=URIError});var $o=k((wE,jy)=>{"use strict";d();jy.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 wl=k((EE,Yy)=>{"use strict";d();var Wy=typeof Symbol<"u"&&Symbol,L7=$o();Yy.exports=l(function(){return typeof Wy!="function"||typeof Symbol!="function"||typeof Wy("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:L7()},"hasNativeSymbols")});var zy=k((_E,Uy)=>{"use strict";d();var Sp={__proto__:null,foo:{}},D7=Object;Uy.exports=l(function(){return{__proto__:Sp}.foo===Sp.foo&&!(Sp instanceof D7)},"hasProto")});var $y=k((kE,qy)=>{"use strict";d();var _7="Function.prototype.bind called on incompatible ",O7=Object.prototype.toString,A7=Math.max,k7="[object Function]",Zy=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"),N7=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"),R7=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");qy.exports=l(function(t){var e=this;if(typeof e!="function"||O7.apply(e)!==k7)throw new TypeError(_7+e);for(var i=N7(arguments,1),n,o=l(function(){if(this instanceof n){var f=e.apply(this,Zy(i,arguments));return Object(f)===f?f:this}return e.apply(t,Zy(i,arguments))},"binder"),a=A7(0,e.length-i.length),c=[],s=0;s<a;s++)c[s]="$"+s;if(n=Function("binder","return function ("+R7(c,",")+"){ 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 Tl=k((BE,Jy)=>{"use strict";d();var B7=$y();Jy.exports=Function.prototype.bind||B7});var Pp=k((GE,Ky)=>{"use strict";d();var F7=Function.prototype.call,G7=Object.prototype.hasOwnProperty,V7=Tl();Ky.exports=V7.call(F7,G7)});var Ae=k((HE,ig)=>{"use strict";d();var $,H7=Oy(),X7=ky(),j7=Ry(),W7=Fy(),_n=xp(),Dn=br(),Y7=Xy(),rg=Function,Mp=l(function(r){try{return rg('"use strict"; return ('+r+").constructor;")()}catch{}},"getEvalledConstructor"),wi=Object.getOwnPropertyDescriptor;if(wi)try{wi({},"")}catch{wi=null}var wp=l(function(){throw new Dn},"throwTypeError"),U7=wi?function(){try{return arguments.callee,wp}catch{try{return wi(arguments,"callee").get}catch{return wp}}}():wp,En=wl()(),z7=zy()(),Nt=Object.getPrototypeOf||(z7?function(r){return r.__proto__}:null),Ln={},Z7=typeof Uint8Array>"u"||!Nt?$:Nt(Uint8Array),Ti={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?$:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?$:ArrayBuffer,"%ArrayIteratorPrototype%":En&&Nt?Nt([][Symbol.iterator]()):$,"%AsyncFromSyncIteratorPrototype%":$,"%AsyncFunction%":Ln,"%AsyncGenerator%":Ln,"%AsyncGeneratorFunction%":Ln,"%AsyncIteratorPrototype%":Ln,"%Atomics%":typeof Atomics>"u"?$:Atomics,"%BigInt%":typeof BigInt>"u"?$:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?$:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?$:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?$:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":H7,"%eval%":eval,"%EvalError%":X7,"%Float32Array%":typeof Float32Array>"u"?$:Float32Array,"%Float64Array%":typeof Float64Array>"u"?$:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?$:FinalizationRegistry,"%Function%":rg,"%GeneratorFunction%":Ln,"%Int8Array%":typeof Int8Array>"u"?$:Int8Array,"%Int16Array%":typeof Int16Array>"u"?$:Int16Array,"%Int32Array%":typeof Int32Array>"u"?$:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":En&&Nt?Nt(Nt([][Symbol.iterator]())):$,"%JSON%":typeof JSON=="object"?JSON:$,"%Map%":typeof Map>"u"?$:Map,"%MapIteratorPrototype%":typeof Map>"u"||!En||!Nt?$:Nt(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?$:Promise,"%Proxy%":typeof Proxy>"u"?$:Proxy,"%RangeError%":j7,"%ReferenceError%":W7,"%Reflect%":typeof Reflect>"u"?$:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?$:Set,"%SetIteratorPrototype%":typeof Set>"u"||!En||!Nt?$:Nt(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?$:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":En&&Nt?Nt(""[Symbol.iterator]()):$,"%Symbol%":En?Symbol:$,"%SyntaxError%":_n,"%ThrowTypeError%":U7,"%TypedArray%":Z7,"%TypeError%":Dn,"%Uint8Array%":typeof Uint8Array>"u"?$:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?$:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?$:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?$:Uint32Array,"%URIError%":Y7,"%WeakMap%":typeof WeakMap>"u"?$:WeakMap,"%WeakRef%":typeof WeakRef>"u"?$:WeakRef,"%WeakSet%":typeof WeakSet>"u"?$:WeakSet};if(Nt)try{null.error}catch(r){Qy=Nt(Nt(r)),Ti["%Error.prototype%"]=Qy}var Qy,q7=l(function r(t){var e;if(t==="%AsyncFunction%")e=Mp("async function () {}");else if(t==="%GeneratorFunction%")e=Mp("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=Mp("async function* () {}");else if(t==="%AsyncGenerator%"){var i=r("%AsyncGeneratorFunction%");i&&(e=i.prototype)}else if(t==="%AsyncIteratorPrototype%"){var n=r("%AsyncGenerator%");n&&Nt&&(e=Nt(n.prototype))}return Ti[t]=e,e},"doEval"),tg={__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"]},Jo=Tl(),Il=Pp(),$7=Jo.call(Function.call,Array.prototype.concat),J7=Jo.call(Function.apply,Array.prototype.splice),eg=Jo.call(Function.call,String.prototype.replace),El=Jo.call(Function.call,String.prototype.slice),K7=Jo.call(Function.call,RegExp.prototype.exec),Q7=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,t6=/\\(\\)?/g,e6=l(function(t){var e=El(t,0,1),i=El(t,-1);if(e==="%"&&i!=="%")throw new _n("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&e!=="%")throw new _n("invalid intrinsic syntax, expected opening `%`");var n=[];return eg(t,Q7,function(o,a,c,s){n[n.length]=c?eg(s,t6,"$1"):a||o}),n},"stringToPath"),r6=l(function(t,e){var i=t,n;if(Il(tg,i)&&(n=tg[i],i="%"+n[0]+"%"),Il(Ti,i)){var o=Ti[i];if(o===Ln&&(o=q7(i)),typeof o>"u"&&!e)throw new Dn("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:n,name:i,value:o}}throw new _n("intrinsic "+t+" does not exist!")},"getBaseIntrinsic");ig.exports=l(function(t,e){if(typeof t!="string"||t.length===0)throw new Dn("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new Dn('"allowMissing" argument must be a boolean');if(K7(/^%?[^%]*%?$/,t)===null)throw new _n("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=e6(t),n=i.length>0?i[0]:"",o=r6("%"+n+"%",e),a=o.name,c=o.value,s=!1,p=o.alias;p&&(n=p[0],J7(i,$7([0,1],p)));for(var f=1,m=!0;f<i.length;f+=1){var y=i[f],x=El(y,0,1),S=El(y,-1);if((x==='"'||x==="'"||x==="`"||S==='"'||S==="'"||S==="`")&&x!==S)throw new _n("property names with quotes must have matching quotes");if((y==="constructor"||!m)&&(s=!0),n+="."+y,a="%"+n+"%",Il(Ti,a))c=Ti[a];else if(c!=null){if(!(y in c)){if(!e)throw new Dn("base intrinsic for "+t+" exists, but the property is not available.");return}if(wi&&f+1>=i.length){var M=wi(c,y);m=!!M,m&&"get"in M&&!("originalValue"in M.get)?c=M.get:c=c[y]}else m=Il(c,y),c=c[y];m&&!s&&(Ti[a]=c)}}return c},"GetIntrinsic")});var Dl=k((WE,ng)=>{"use strict";d();var i6=Ae(),Ll=i6("%Object.defineProperty%",!0)||!1;if(Ll)try{Ll({},"a",{value:1})}catch{Ll=!1}ng.exports=Ll});var Ol=k((UE,og)=>{"use strict";d();var n6=Ae(),_l=n6("%Object.getOwnPropertyDescriptor%",!0);if(_l)try{_l([],"length")}catch{_l=null}og.exports=_l});var Al=k((ZE,lg)=>{"use strict";d();var ag=Dl(),o6=xp(),On=br(),sg=Ol();lg.exports=l(function(t,e,i){if(!t||typeof t!="object"&&typeof t!="function")throw new On("`obj` must be an object or a function`");if(typeof e!="string"&&typeof e!="symbol")throw new On("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new On("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new On("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new On("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new On("`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,c=arguments.length>6?arguments[6]:!1,s=!!sg&&sg(t,e);if(ag)ag(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(c||!n&&!o&&!a)t[e]=i;else throw new o6("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},"defineDataProperty")});var kl=k((JE,ug)=>{"use strict";d();var Tp=Dl(),cg=l(function(){return!!Tp},"hasPropertyDescriptors");cg.hasArrayLengthDefineBug=l(function(){if(!Tp)return null;try{return Tp([],"length",{value:1}).length!==1}catch{return!0}},"hasArrayLengthDefineBug");ug.exports=cg});var Yr=k((tL,fg)=>{"use strict";d();var a6=Ml(),s6=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",l6=Object.prototype.toString,c6=Array.prototype.concat,pg=Al(),u6=l(function(r){return typeof r=="function"&&l6.call(r)==="[object Function]"},"isFunction"),hg=kl()(),p6=l(function(r,t,e,i){if(t in r){if(i===!0){if(r[t]===e)return}else if(!u6(i)||!i())return}hg?pg(r,t,e,!0):pg(r,t,e)},"defineProperty"),dg=l(function(r,t){var e=arguments.length>2?arguments[2]:{},i=a6(t);s6&&(i=c6.call(i,Object.getOwnPropertySymbols(t)));for(var n=0;n<i.length;n+=1)p6(r,i[n],t[i[n]],e[i[n]])},"defineProperties");dg.supportsDescriptors=!!hg;fg.exports=dg});var bg=k((iL,vg)=>{"use strict";d();var h6=Ae(),mg=Al(),d6=kl()(),yg=Ol(),gg=br(),f6=h6("%Math.floor%");vg.exports=l(function(t,e){if(typeof t!="function")throw new gg("`fn` is not a function");if(typeof e!="number"||e<0||e>4294967295||f6(e)!==e)throw new gg("`length` must be a positive 32-bit integer");var i=arguments.length>2&&!!arguments[2],n=!0,o=!0;if("length"in t&&yg){var a=yg(t,"length");a&&!a.configurable&&(n=!1),a&&!a.writable&&(o=!1)}return(n||o||!i)&&(d6?mg(t,"length",e,!0,!0):mg(t,"length",e)),t},"setFunctionLength")});var Ii=k((aL,Nl)=>{"use strict";d();var Ip=Tl(),Rl=Ae(),m6=bg(),y6=br(),Sg=Rl("%Function.prototype.apply%"),Pg=Rl("%Function.prototype.call%"),Mg=Rl("%Reflect.apply%",!0)||Ip.call(Pg,Sg),Cg=Dl(),g6=Rl("%Math.max%");Nl.exports=l(function(t){if(typeof t!="function")throw new y6("a function is required");var e=Mg(Ip,Pg,arguments);return m6(e,1+g6(0,t.length-(arguments.length-1)),!0)},"callBind");var xg=l(function(){return Mg(Ip,Sg,arguments)},"applyBind");Cg?Cg(Nl.exports,"apply",{value:xg}):Nl.exports.apply=xg});var he=k((cL,Ig)=>{"use strict";d();var wg=Ae(),Tg=Ii(),v6=Tg(wg("String.prototype.indexOf"));Ig.exports=l(function(t,e){var i=wg(t,!!e);return typeof i=="function"&&v6(t,".prototype.")>-1?Tg(i):i},"callBoundIntrinsic")});var Ep=k((hL,Og)=>{"use strict";d();var b6=Ml(),Dg=$o()(),_g=he(),Eg=Object,C6=_g("Array.prototype.push"),Lg=_g("Object.prototype.propertyIsEnumerable"),x6=Dg?Object.getOwnPropertySymbols:null;Og.exports=l(function(t,e){if(t==null)throw new TypeError("target must be an object");var i=Eg(t);if(arguments.length===1)return i;for(var n=1;n<arguments.length;++n){var o=Eg(arguments[n]),a=b6(o),c=Dg&&(Object.getOwnPropertySymbols||x6);if(c)for(var s=c(o),p=0;p<s.length;++p){var f=s[p];Lg(o,f)&&C6(a,f)}for(var m=0;m<a.length;++m){var y=a[m];if(Lg(o,y)){var x=o[y];i[y]=x}}}return i},"assign")});var Dp=k((mL,Ag)=>{"use strict";d();var Lp=Ep(),S6=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"),P6=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");Ag.exports=l(function(){return!Object.assign||S6()||P6()?Lp:Object.assign},"getPolyfill")});var Ng=k((vL,kg)=>{"use strict";d();var M6=Yr(),w6=Dp();kg.exports=l(function(){var t=w6();return M6(Object,{assign:t},{assign:function(){return Object.assign!==t}}),t},"shimAssign")});var Gg=k((xL,Fg)=>{"use strict";d();var T6=Yr(),I6=Ii(),E6=Ep(),Rg=Dp(),L6=Ng(),D6=I6.apply(Rg()),Bg=l(function(t,e){return D6(Object,arguments)},"assign");T6(Bg,{getPolyfill:Rg,implementation:E6,shim:L6});Fg.exports=Bg});var Hg=k((ML,Vg)=>{"use strict";d();var Qo=l(function(){return typeof l(function(){},"f").name=="string"},"functionsHaveNames"),Ko=Object.getOwnPropertyDescriptor;if(Ko)try{Ko([],"length")}catch{Ko=null}Qo.functionsHaveConfigurableNames=l(function(){if(!Qo()||!Ko)return!1;var t=Ko(function(){},"name");return!!t&&!!t.configurable},"functionsHaveConfigurableNames");var _6=Function.prototype.bind;Qo.boundFunctionsHaveNames=l(function(){return Qo()&&typeof _6=="function"&&l(function(){},"f").bind().name!==""},"boundFunctionsHaveNames");Vg.exports=Qo});var Wg=k((IL,jg)=>{"use strict";d();var Xg=Al(),O6=kl()(),A6=Hg().functionsHaveConfigurableNames(),k6=br();jg.exports=l(function(t,e){if(typeof t!="function")throw new k6("`fn` is not a function");var i=arguments.length>2&&!!arguments[2];return(!i||A6)&&(O6?Xg(t,"name",e,!0,!0):Xg(t,"name",e)),t},"setFunctionName")});var _p=k((DL,Yg)=>{"use strict";d();var N6=Wg(),R6=br(),B6=Object;Yg.exports=N6(l(function(){if(this==null||this!==B6(this))throw new R6("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 Op=k((AL,Ug)=>{"use strict";d();var F6=_p(),G6=Yr().supportsDescriptors,V6=Object.getOwnPropertyDescriptor;Ug.exports=l(function(){if(G6&&/a/mig.flags==="gim"){var t=V6(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 F6},"getPolyfill")});var qg=k((RL,Zg)=>{"use strict";d();var H6=Yr().supportsDescriptors,X6=Op(),j6=Object.getOwnPropertyDescriptor,W6=Object.defineProperty,Y6=TypeError,zg=Object.getPrototypeOf,U6=/a/;Zg.exports=l(function(){if(!H6||!zg)throw new Y6("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var t=X6(),e=zg(U6),i=j6(e,"flags");return(!i||i.get!==t)&&W6(e,"flags",{configurable:!0,enumerable:!1,get:t}),t},"shimFlags")});var Qg=k((GL,Kg)=>{"use strict";d();var z6=Yr(),Z6=Ii(),q6=_p(),$g=Op(),$6=qg(),Jg=Z6($g());z6(Jg,{getPolyfill:$g,implementation:q6,shim:$6});Kg.exports=Jg});var Ur=k((HL,t0)=>{"use strict";d();var J6=$o();t0.exports=l(function(){return J6()&&!!Symbol.toStringTag},"hasToStringTagShams")});var kp=k((WL,r0)=>{"use strict";d();var K6=Ur()(),Q6=he(),Ap=Q6("Object.prototype.toString"),Bl=l(function(t){return K6&&t&&typeof t=="object"&&Symbol.toStringTag in t?!1:Ap(t)==="[object Arguments]"},"isArguments"),e0=l(function(t){return Bl(t)?!0:t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&Ap(t)!=="[object Array]"&&Ap(t.callee)==="[object Function]"},"isArguments"),tC=function(){return Bl(arguments)}();Bl.isLegacyArguments=e0;r0.exports=tC?Bl:e0});var i0=k(()=>{d()});var P0=k(($L,S0)=>{d();var Wp=typeof Map=="function"&&Map.prototype,Np=Object.getOwnPropertyDescriptor&&Wp?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Gl=Wp&&Np&&typeof Np.get=="function"?Np.get:null,n0=Wp&&Map.prototype.forEach,Yp=typeof Set=="function"&&Set.prototype,Rp=Object.getOwnPropertyDescriptor&&Yp?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Vl=Yp&&Rp&&typeof Rp.get=="function"?Rp.get:null,o0=Yp&&Set.prototype.forEach,eC=typeof WeakMap=="function"&&WeakMap.prototype,ea=eC?WeakMap.prototype.has:null,rC=typeof WeakSet=="function"&&WeakSet.prototype,ra=rC?WeakSet.prototype.has:null,iC=typeof WeakRef=="function"&&WeakRef.prototype,a0=iC?WeakRef.prototype.deref:null,nC=Boolean.prototype.valueOf,oC=Object.prototype.toString,aC=Function.prototype.toString,sC=String.prototype.match,Up=String.prototype.slice,Zr=String.prototype.replace,lC=String.prototype.toUpperCase,s0=String.prototype.toLowerCase,y0=RegExp.prototype.test,l0=Array.prototype.concat,Ke=Array.prototype.join,cC=Array.prototype.slice,c0=Math.floor,Gp=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Bp=Object.getOwnPropertySymbols,Vp=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,An=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Wt=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===An||!0)?Symbol.toStringTag:null,g0=Object.prototype.propertyIsEnumerable,u0=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(r){return r.__proto__}:null);function p0(r,t){if(r===1/0||r===-1/0||r!==r||r&&r>-1e3&&r<1e3||y0.call(/e/,t))return t;var e=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof r=="number"){var i=r<0?-c0(-r):c0(r);if(i!==r){var n=String(i),o=Up.call(t,n.length+1);return Zr.call(n,e,"$&_")+"."+Zr.call(Zr.call(o,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Zr.call(t,e,"$&_")}l(p0,"addNumericSeparator");var Hp=i0(),h0=Hp.custom,d0=b0(h0)?h0:null;S0.exports=l(function r(t,e,i,n){var o=e||{};if(zr(o,"quoteStyle")&&o.quoteStyle!=="single"&&o.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(zr(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=zr(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(zr(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(zr(o,"numericSeparator")&&typeof o.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var c=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 x0(t,o);if(typeof t=="number"){if(t===0)return 1/0/t>0?"0":"-0";var s=String(t);return c?p0(t,s):s}if(typeof t=="bigint"){var p=String(t)+"n";return c?p0(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=IC(o,i);if(typeof n>"u")n=[];else if(C0(n,t)>=0)return"[Circular]";function y(ut,yt,Ct){if(yt&&(n=cC.call(n),n.push(yt)),Ct){var Bt={depth:o.depth};return zr(o,"quoteStyle")&&(Bt.quoteStyle=o.quoteStyle),r(ut,Bt,i+1,n)}return r(ut,o,i+1,n)}if(l(y,"inspect"),typeof t=="function"&&!f0(t)){var x=vC(t),S=Fl(t,y);return"[Function"+(x?": "+x:" (anonymous)")+"]"+(S.length>0?" { "+Ke.call(S,", ")+" }":"")}if(b0(t)){var M=An?Zr.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):Vp.call(t);return typeof t=="object"&&!An?ta(M):M}if(MC(t)){for(var g="<"+s0.call(String(t.nodeName)),C=t.attributes||[],I=0;I<C.length;I++)g+=" "+C[I].name+"="+v0(uC(C[I].value),"double",o);return g+=">",t.childNodes&&t.childNodes.length&&(g+="..."),g+="</"+s0.call(String(t.nodeName))+">",g}if(Xp(t)){if(t.length===0)return"[]";var T=Fl(t,y);return m&&!TC(T)?"["+jp(T,m)+"]":"[ "+Ke.call(T,", ")+" ]"}if(hC(t)){var w=Fl(t,y);return!("cause"in Error.prototype)&&"cause"in t&&!g0.call(t,"cause")?"{ ["+String(t)+"] "+Ke.call(l0.call("[cause]: "+y(t.cause),w),", ")+" }":w.length===0?"["+String(t)+"]":"{ ["+String(t)+"] "+Ke.call(w,", ")+" }"}if(typeof t=="object"&&a){if(d0&&typeof t[d0]=="function"&&Hp)return Hp(t,{depth:f-i});if(a!=="symbol"&&typeof t.inspect=="function")return t.inspect()}if(bC(t)){var L=[];return n0&&n0.call(t,function(ut,yt){L.push(y(yt,t,!0)+" => "+y(ut,t))}),m0("Map",Gl.call(t),L,m)}if(SC(t)){var _=[];return o0&&o0.call(t,function(ut){_.push(y(ut,t))}),m0("Set",Vl.call(t),_,m)}if(CC(t))return Fp("WeakMap");if(PC(t))return Fp("WeakSet");if(xC(t))return Fp("WeakRef");if(fC(t))return ta(y(Number(t)));if(yC(t))return ta(y(Gp.call(t)));if(mC(t))return ta(nC.call(t));if(dC(t))return ta(y(String(t)));if(typeof window<"u"&&t===window)return"{ [object Window] }";if(t===global)return"{ [object globalThis] }";if(!pC(t)&&!f0(t)){var R=Fl(t,y),G=u0?u0(t)===Object.prototype:t instanceof Object||t.constructor===Object,N=t instanceof Object?"":"null prototype",j=!G&&Wt&&Object(t)===t&&Wt in t?Up.call(qr(t),8,-1):N?"Object":"",H=G||typeof t.constructor!="function"?"":t.constructor.name?t.constructor.name+" ":"",J=H+(j||N?"["+Ke.call(l0.call([],j||[],N||[]),": ")+"] ":"");return R.length===0?J+"{}":m?J+"{"+jp(R,m)+"}":J+"{ "+Ke.call(R,", ")+" }"}return String(t)},"inspect_");function v0(r,t,e){var i=(e.quoteStyle||t)==="double"?'"':"'";return i+r+i}l(v0,"wrapQuotes");function uC(r){return Zr.call(String(r),/"/g,"&quot;")}l(uC,"quote");function Xp(r){return qr(r)==="[object Array]"&&(!Wt||!(typeof r=="object"&&Wt in r))}l(Xp,"isArray");function pC(r){return qr(r)==="[object Date]"&&(!Wt||!(typeof r=="object"&&Wt in r))}l(pC,"isDate");function f0(r){return qr(r)==="[object RegExp]"&&(!Wt||!(typeof r=="object"&&Wt in r))}l(f0,"isRegExp");function hC(r){return qr(r)==="[object Error]"&&(!Wt||!(typeof r=="object"&&Wt in r))}l(hC,"isError");function dC(r){return qr(r)==="[object String]"&&(!Wt||!(typeof r=="object"&&Wt in r))}l(dC,"isString");function fC(r){return qr(r)==="[object Number]"&&(!Wt||!(typeof r=="object"&&Wt in r))}l(fC,"isNumber");function mC(r){return qr(r)==="[object Boolean]"&&(!Wt||!(typeof r=="object"&&Wt in r))}l(mC,"isBoolean");function b0(r){if(An)return r&&typeof r=="object"&&r instanceof Symbol;if(typeof r=="symbol")return!0;if(!r||typeof r!="object"||!Vp)return!1;try{return Vp.call(r),!0}catch{}return!1}l(b0,"isSymbol");function yC(r){if(!r||typeof r!="object"||!Gp)return!1;try{return Gp.call(r),!0}catch{}return!1}l(yC,"isBigInt");var gC=Object.prototype.hasOwnProperty||function(r){return r in this};function zr(r,t){return gC.call(r,t)}l(zr,"has");function qr(r){return oC.call(r)}l(qr,"toStr");function vC(r){if(r.name)return r.name;var t=sC.call(aC.call(r),/^function\s*([\w$]+)/);return t?t[1]:null}l(vC,"nameOf");function C0(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(C0,"indexOf");function bC(r){if(!Gl||!r||typeof r!="object")return!1;try{Gl.call(r);try{Vl.call(r)}catch{return!0}return r instanceof Map}catch{}return!1}l(bC,"isMap");function CC(r){if(!ea||!r||typeof r!="object")return!1;try{ea.call(r,ea);try{ra.call(r,ra)}catch{return!0}return r instanceof WeakMap}catch{}return!1}l(CC,"isWeakMap");function xC(r){if(!a0||!r||typeof r!="object")return!1;try{return a0.call(r),!0}catch{}return!1}l(xC,"isWeakRef");function SC(r){if(!Vl||!r||typeof r!="object")return!1;try{Vl.call(r);try{Gl.call(r)}catch{return!0}return r instanceof Set}catch{}return!1}l(SC,"isSet");function PC(r){if(!ra||!r||typeof r!="object")return!1;try{ra.call(r,ra);try{ea.call(r,ea)}catch{return!0}return r instanceof WeakSet}catch{}return!1}l(PC,"isWeakSet");function MC(r){return!r||typeof r!="object"?!1:typeof HTMLElement<"u"&&r instanceof HTMLElement?!0:typeof r.nodeName=="string"&&typeof r.getAttribute=="function"}l(MC,"isElement");function x0(r,t){if(r.length>t.maxStringLength){var e=r.length-t.maxStringLength,i="... "+e+" more character"+(e>1?"s":"");return x0(Up.call(r,0,t.maxStringLength),t)+i}var n=Zr.call(Zr.call(r,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,wC);return v0(n,"single",t)}l(x0,"inspectString");function wC(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":"")+lC.call(t.toString(16))}l(wC,"lowbyte");function ta(r){return"Object("+r+")"}l(ta,"markBoxed");function Fp(r){return r+" { ? }"}l(Fp,"weakCollectionOf");function m0(r,t,e,i){var n=i?jp(e,i):Ke.call(e,", ");return r+" ("+t+") {"+n+"}"}l(m0,"collectionOf");function TC(r){for(var t=0;t<r.length;t++)if(C0(r[t],`
1
+ import{h as rp,i as X1,j as cl}from"./chunk-AIZ6PN4T.js";import{a as Je}from"./chunk-5TYPWFBI.js";import{A as P1,B as M1,C as w1,D as Y,E as yr,F as T1,G as gr,Ga as In,H as Pn,I as _e,J as It,Ja as ll,Ka as G1,L as Vr,M as Ho,Na as V1,O as Ft,P as I1,Q as Xo,Qa as $e,R as E1,Ra as H1,S as L1,T as D1,U as Mn,X as _1,Y as O1,Z as al,a as ol,c as Vo,ca as A1,d as ze,fa as sl,ga as wn,ha as k1,ja as Pi,m as x1,n as S1,pa as N1,qa as Hr,ra as ep,sa as R1,ta as Ze,u as Si,ua as qe,va as B1,w as ot,wa as F1,x as U,ya as Tn}from"./chunk-YPHGW2KF.js";import{a as l,b as k,d as Gr,e as v,f as u,g as P,h as E,i as X,j as d,k as b}from"./chunk-BCE6HB4T.js";var ay=k((up,pp)=>{d();(function(r,t){typeof up=="object"&&typeof pp<"u"?pp.exports=t():typeof define=="function"&&define.amd?define(t):(r=r||self).RBush=t()})(up,function(){"use strict";function r(g,C,I,T,w){l(function L(_,R,G,N,j){for(;N>G;){if(N-G>600){var H=N-G+1,J=R-G+1,ut=Math.log(H),yt=.5*Math.exp(2*ut/3),Ct=.5*Math.sqrt(ut*yt*(H-yt)/H)*(J-H/2<0?-1:1),Bt=Math.max(G,Math.floor(R-J*yt/H+Ct)),De=Math.min(N,Math.floor(R+(H-J)*yt/H+Ct));L(_,R,Bt,De,j)}var gt=_[R],kt=G,Pt=N;for(t(_,G,R),j(_[N],gt)>0&&t(_,G,N);kt<Pt;){for(t(_,kt,Pt),kt++,Pt--;j(_[kt],gt)<0;)kt++;for(;j(_[Pt],gt)>0;)Pt--}j(_[G],gt)===0?t(_,G,Pt):t(_,++Pt,N),Pt<=R&&(G=Pt+1),R<=Pt&&(N=Pt-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 _=g.children[L];c(w,g.leaf?T(_):_)}return w}l(a,"h");function c(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(c,"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 _=C+Math.ceil((I-C)/T/2)*T;r(g,_,C,I,w),L.push(C,_,_,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 _=C.children[L],R=C.leaf?T(_):_;x(g,R)&&(C.leaf?I.push(_):y(g,R)?this._all(_,I):w.push(_))}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,_=this.toBBox(g),R=[],G=[];L||R.length;){if(L||(L=R.pop(),T=R[R.length-1],I=G.pop(),w=!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}w||L.leaf||!y(L,_)?T?(I++,L=T.children[I],w=!1):L=null:(R.push(L),G.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,_=this._maxEntries;if(L<=_)return o(w=S(g.slice(C,I+1)),this.toBBox),w;T||(T=Math.ceil(Math.log(L)/Math.log(_)),_=Math.ceil(L/Math.pow(_,T-1))),(w=S([])).leaf=!1,w.height=T;var R=Math.ceil(L/_),G=R*Math.ceil(Math.sqrt(_));M(g,C,I,G,this.compareMinX);for(var N=C;N<=I;N+=G){var j=Math.min(N+G-1,I);M(g,N,j,R,this.compareMinY);for(var H=N;H<=j;H+=R){var J=Math.min(H+R-1,j);w.children.push(this._build(g,H,J,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,_=void 0,R=0;R<C.children.length;R++){var G=C.children[R],N=f(G),j=(H=g,J=G,(Math.max(J.maxX,H.maxX)-Math.min(J.minX,H.minX))*(Math.max(J.maxY,H.maxY)-Math.min(J.minY,H.minY))-N);j<L?(L=j,w=N<w?N:w,_=G):j===L&&N<w&&(w=N,_=G)}C=_||C.children[0]}var H,J;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),c(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),_=S(I.children.splice(L,I.children.length-L));_.height=I.height,_.leaf=I.leaf,o(I,this.toBBox),o(_,this.toBBox),C?g[C-1].children.push(_):this._splitRoot(I,_)},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,_,R,G,N,j=1/0,H=1/0,J=C;J<=I-C;J++){var ut=a(g,0,J,this.toBBox),yt=a(g,J,I,this.toBBox),Ct=(w=ut,L=yt,_=void 0,R=void 0,G=void 0,N=void 0,_=Math.max(w.minX,L.minX),R=Math.max(w.minY,L.minY),G=Math.min(w.maxX,L.maxX),N=Math.min(w.maxY,L.maxY),Math.max(0,G-_)*Math.max(0,N-R)),Bt=f(ut)+f(yt);Ct<j?(j=Ct,T=J,H=Bt<H?Bt:H):Ct===j&&Bt<H&&(H=Bt,T=J)}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),_=a(g,I-C,I,w),R=m(L)+m(_),G=C;G<I-C;G++){var N=g.children[G];c(L,g.leaf?w(N):N),R+=m(L)}for(var j=I-C-1;j>=C;j--){var H=g.children[j];c(_,g.leaf?w(H):H),R+=m(_)}return R},i.prototype._adjustParentBBoxes=function(g,C,I){for(var T=I;T>=0;T--)c(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 yp=k(W=>{"use strict";d();Object.defineProperty(W,"__esModule",{value:!0});W.earthRadius=63710088e-1;W.factors={centimeters:W.earthRadius*100,centimetres:W.earthRadius*100,degrees:W.earthRadius/111325,feet:W.earthRadius*3.28084,inches:W.earthRadius*39.37,kilometers:W.earthRadius/1e3,kilometres:W.earthRadius/1e3,meters:W.earthRadius,metres:W.earthRadius,miles:W.earthRadius/1609.344,millimeters:W.earthRadius*1e3,millimetres:W.earthRadius*1e3,nauticalmiles:W.earthRadius/1852,radians:1,yards:W.earthRadius*1.0936};W.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/W.earthRadius,yards:1.0936133};W.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 Wr(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(Wr,"feature");W.feature=Wr;function i7(r,t,e){switch(e===void 0&&(e={}),r){case"Point":return hp(t).geometry;case"LineString":return fp(t).geometry;case"Polygon":return dp(t).geometry;case"MultiPoint":return ly(t).geometry;case"MultiLineString":return sy(t).geometry;case"MultiPolygon":return cy(t).geometry;default:throw new Error(r+" is invalid")}}l(i7,"geometry");W.geometry=i7;function hp(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(!bl(r[0])||!bl(r[1]))throw new Error("coordinates must contain numbers");var i={type:"Point",coordinates:r};return Wr(i,t,e)}l(hp,"point");W.point=hp;function n7(r,t,e){return e===void 0&&(e={}),Cl(r.map(function(i){return hp(i,t)}),e)}l(n7,"points");W.points=n7;function dp(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 c={type:"Polygon",coordinates:r};return Wr(c,t,e)}l(dp,"polygon");W.polygon=dp;function o7(r,t,e){return e===void 0&&(e={}),Cl(r.map(function(i){return dp(i,t)}),e)}l(o7,"polygons");W.polygons=o7;function fp(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 Wr(i,t,e)}l(fp,"lineString");W.lineString=fp;function a7(r,t,e){return e===void 0&&(e={}),Cl(r.map(function(i){return fp(i,t)}),e)}l(a7,"lineStrings");W.lineStrings=a7;function Cl(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(Cl,"featureCollection");W.featureCollection=Cl;function sy(r,t,e){e===void 0&&(e={});var i={type:"MultiLineString",coordinates:r};return Wr(i,t,e)}l(sy,"multiLineString");W.multiLineString=sy;function ly(r,t,e){e===void 0&&(e={});var i={type:"MultiPoint",coordinates:r};return Wr(i,t,e)}l(ly,"multiPoint");W.multiPoint=ly;function cy(r,t,e){e===void 0&&(e={});var i={type:"MultiPolygon",coordinates:r};return Wr(i,t,e)}l(cy,"multiPolygon");W.multiPolygon=cy;function s7(r,t,e){e===void 0&&(e={});var i={type:"GeometryCollection",geometries:r};return Wr(i,t,e)}l(s7,"geometryCollection");W.geometryCollection=s7;function l7(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(l7,"round");W.round=l7;function uy(r,t){t===void 0&&(t="kilometers");var e=W.factors[t];if(!e)throw new Error(t+" units is invalid");return r*e}l(uy,"radiansToLength");W.radiansToLength=uy;function mp(r,t){t===void 0&&(t="kilometers");var e=W.factors[t];if(!e)throw new Error(t+" units is invalid");return r/e}l(mp,"lengthToRadians");W.lengthToRadians=mp;function c7(r,t){return py(mp(r,t))}l(c7,"lengthToDegrees");W.lengthToDegrees=c7;function u7(r){var t=r%360;return t<0&&(t+=360),t}l(u7,"bearingToAzimuth");W.bearingToAzimuth=u7;function py(r){var t=r%(2*Math.PI);return t*180/Math.PI}l(py,"radiansToDegrees");W.radiansToDegrees=py;function p7(r){var t=r%360;return t*Math.PI/180}l(p7,"degreesToRadians");W.degreesToRadians=p7;function h7(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 uy(mp(r,t),e)}l(h7,"convertLength");W.convertLength=h7;function d7(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=W.areaFactors[t];if(!i)throw new Error("invalid original units");var n=W.areaFactors[e];if(!n)throw new Error("invalid final units");return r/i*n}l(d7,"convertArea");W.convertArea=d7;function bl(r){return!isNaN(r)&&r!==null&&!Array.isArray(r)}l(bl,"isNumber");W.isNumber=bl;function f7(r){return!!r&&r.constructor===Object}l(f7,"isObject");W.isObject=f7;function m7(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(!bl(t))throw new Error("bbox must only contain numbers")})}l(m7,"validateBBox");W.validateBBox=m7;function y7(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(y7,"validateId");W.validateId=y7});var yy=k(Et=>{"use strict";d();Object.defineProperty(Et,"__esModule",{value:!0});var jt=yp();function zo(r,t,e){if(r!==null)for(var i,n,o,a,c,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,c=y?p.geometries.length:1;for(var I=0;I<c;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(zo(a.geometries[i],t,e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}l(zo,"coordEach");function g7(r,t,e,i){var n=e;return zo(r,function(o,a,c,s,p){a===0&&e===void 0?n=o:n=t(n,o,a,c,s,p)},i),n}l(g7,"coordReduce");function hy(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(hy,"propEach");function v7(r,t,e){var i=e;return hy(r,function(n,o){o===0&&e===void 0?i=n:i=t(i,n,o)}),i}l(v7,"propReduce");function dy(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(dy,"featureEach");function b7(r,t,e){var i=e;return dy(r,function(n,o){o===0&&e===void 0?i=n:i=t(i,n,o)}),i}l(b7,"featureReduce");function C7(r){var t=[];return zo(r,function(e){t.push(e)}),t}l(C7,"coordAll");function gp(r,t){var e,i,n,o,a,c,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(c=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=c?c.type==="GeometryCollection":!1,a=s?c.geometries.length:1,n=0;n<a;n++){if(o=s?c.geometries[n]:c,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(gp,"geomEach");function x7(r,t,e){var i=e;return gp(r,function(n,o,a,c,s){o===0&&e===void 0?i=n:i=t(i,n,o,a,c,s)}),i}l(x7,"geomReduce");function xl(r,t){gp(r,function(e,i,n,o,a){var c=e===null?null:e.type;switch(c){case null:case"Point":case"LineString":case"Polygon":return t(jt.feature(e,n,{bbox:o,id:a}),i,0)===!1?!1:void 0}var s;switch(c){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(jt.feature(m,n),i,p)===!1)return!1}})}l(xl,"flattenEach");function S7(r,t,e){var i=e;return xl(r,function(n,o,a){o===0&&a===0&&e===void 0?i=n:i=t(i,n,o,a)}),i}l(S7,"flattenReduce");function fy(r,t){xl(r,function(e,i,n){var o=0;if(e.geometry){var a=e.geometry.type;if(!(a==="Point"||a==="MultiPoint")){var c,s=0,p=0,f=0;if(zo(e,function(m,y,x,S,M){if(c===void 0||i>s||S>p||M>f){c=m,s=i,p=S,f=M,o=0;return}var g=jt.lineString([c,m],e.properties);if(t(g,i,n,M,o)===!1)return!1;o++,c=m})===!1)return!1}}})}l(fy,"segmentEach");function P7(r,t,e){var i=e,n=!1;return fy(r,function(o,a,c,s,p){n===!1&&e===void 0?i=o:i=t(i,o,a,c,s,p),n=!0}),i}l(P7,"segmentReduce");function my(r,t){if(!r)throw new Error("geojson is required");xl(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 c=0;c<a.length;c++)if(t(jt.lineString(a[c],e.properties),i,n,c)===!1)return!1;break}}})}l(my,"lineEach");function M7(r,t,e){var i=e;return my(r,function(n,o,a,c){o===0&&e===void 0?i=n:i=t(i,n,o,a,c)}),i}l(M7,"lineReduce");function w7(r,t){if(t=t||{},!jt.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,c;switch(r.type){case"FeatureCollection":e<0&&(e=r.features.length+e),a=a||r.features[e].properties,c=r.features[e].geometry;break;case"Feature":a=a||r.properties,c=r.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":c=r;break;default:throw new Error("geojson is invalid")}if(c===null)return null;var s=c.coordinates;switch(c.type){case"Point":case"MultiPoint":return null;case"LineString":return o<0&&(o=s.length+o-1),jt.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),jt.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),jt.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),jt.lineString([s[i][n][o],s[i][n][o+1]],a,t)}throw new Error("geojson is invalid")}l(w7,"findSegment");function T7(r,t){if(t=t||{},!jt.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,c;switch(r.type){case"FeatureCollection":e<0&&(e=r.features.length+e),a=a||r.features[e].properties,c=r.features[e].geometry;break;case"Feature":a=a||r.properties,c=r.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":c=r;break;default:throw new Error("geojson is invalid")}if(c===null)return null;var s=c.coordinates;switch(c.type){case"Point":return jt.point(s,a,t);case"MultiPoint":return i<0&&(i=s.length+i),jt.point(s[i],a,t);case"LineString":return o<0&&(o=s.length+o),jt.point(s[o],a,t);case"Polygon":return n<0&&(n=s.length+n),o<0&&(o=s[n].length+o),jt.point(s[n][o],a,t);case"MultiLineString":return i<0&&(i=s.length+i),o<0&&(o=s[i].length+o),jt.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),jt.point(s[i][n][o],a,t)}throw new Error("geojson is invalid")}l(T7,"findPoint");Et.coordAll=C7;Et.coordEach=zo;Et.coordReduce=g7;Et.featureEach=dy;Et.featureReduce=b7;Et.findPoint=T7;Et.findSegment=w7;Et.flattenEach=xl;Et.flattenReduce=S7;Et.geomEach=gp;Et.geomReduce=x7;Et.lineEach=my;Et.lineReduce=M7;Et.propEach=hy;Et.propReduce=v7;Et.segmentEach=fy;Et.segmentReduce=P7});var vp=k((rE,vy)=>{"use strict";d();var gy=Object.prototype.toString;vy.exports=l(function(t){var e=gy.call(t),i=e==="[object Arguments]";return i||(i=e!=="[object Array]"&&t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&gy.call(t.callee)==="[object Function]"),i},"isArguments")});var Iy=k((oE,Ty)=>{"use strict";d();var wy;Object.keys||(Zo=Object.prototype.hasOwnProperty,bp=Object.prototype.toString,by=vp(),Cp=Object.prototype.propertyIsEnumerable,Cy=!Cp.call({toString:null},"toString"),xy=Cp.call(function(){},"prototype"),qo=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],Sl=l(function(r){var t=r.constructor;return t&&t.prototype===r},"equalsConstructorPrototype"),Sy={$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},Py=function(){if(typeof window>"u")return!1;for(var r in window)try{if(!Sy["$"+r]&&Zo.call(window,r)&&window[r]!==null&&typeof window[r]=="object")try{Sl(window[r])}catch{return!0}}catch{return!0}return!1}(),My=l(function(r){if(typeof window>"u"||!Py)return Sl(r);try{return Sl(r)}catch{return!1}},"equalsConstructorPrototypeIfNotBuggy"),wy=l(function(t){var e=t!==null&&typeof t=="object",i=bp.call(t)==="[object Function]",n=by(t),o=e&&bp.call(t)==="[object String]",a=[];if(!e&&!i&&!n)throw new TypeError("Object.keys called on a non-object");var c=xy&&i;if(o&&t.length>0&&!Zo.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)!(c&&f==="prototype")&&Zo.call(t,f)&&a.push(String(f));if(Cy)for(var m=My(t),y=0;y<qo.length;++y)!(m&&qo[y]==="constructor")&&Zo.call(t,qo[y])&&a.push(qo[y]);return a},"keys"));var Zo,bp,by,Cp,Cy,xy,qo,Sl,Sy,Py,My;Ty.exports=wy});var Ml=k((lE,Dy)=>{"use strict";d();var I7=Array.prototype.slice,E7=vp(),Ey=Object.keys,Pl=Ey?l(function(t){return Ey(t)},"keys"):Iy(),Ly=Object.keys;Pl.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 E7(i)?Ly(I7.call(i)):Ly(i)},"keys"))}else Object.keys=Pl;return Object.keys||Pl},"shimObjectKeys");Dy.exports=Pl});var Oy=k((pE,_y)=>{"use strict";d();_y.exports=Error});var ky=k((dE,Ay)=>{"use strict";d();Ay.exports=EvalError});var Ry=k((mE,Ny)=>{"use strict";d();Ny.exports=RangeError});var Fy=k((gE,By)=>{"use strict";d();By.exports=ReferenceError});var xp=k((bE,Gy)=>{"use strict";d();Gy.exports=SyntaxError});var br=k((xE,Vy)=>{"use strict";d();Vy.exports=TypeError});var Xy=k((PE,Hy)=>{"use strict";d();Hy.exports=URIError});var $o=k((wE,jy)=>{"use strict";d();jy.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 wl=k((EE,Yy)=>{"use strict";d();var Wy=typeof Symbol<"u"&&Symbol,L7=$o();Yy.exports=l(function(){return typeof Wy!="function"||typeof Symbol!="function"||typeof Wy("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:L7()},"hasNativeSymbols")});var zy=k((_E,Uy)=>{"use strict";d();var Sp={__proto__:null,foo:{}},D7=Object;Uy.exports=l(function(){return{__proto__:Sp}.foo===Sp.foo&&!(Sp instanceof D7)},"hasProto")});var $y=k((kE,qy)=>{"use strict";d();var _7="Function.prototype.bind called on incompatible ",O7=Object.prototype.toString,A7=Math.max,k7="[object Function]",Zy=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"),N7=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"),R7=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");qy.exports=l(function(t){var e=this;if(typeof e!="function"||O7.apply(e)!==k7)throw new TypeError(_7+e);for(var i=N7(arguments,1),n,o=l(function(){if(this instanceof n){var f=e.apply(this,Zy(i,arguments));return Object(f)===f?f:this}return e.apply(t,Zy(i,arguments))},"binder"),a=A7(0,e.length-i.length),c=[],s=0;s<a;s++)c[s]="$"+s;if(n=Function("binder","return function ("+R7(c,",")+"){ 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 Tl=k((BE,Jy)=>{"use strict";d();var B7=$y();Jy.exports=Function.prototype.bind||B7});var Pp=k((GE,Ky)=>{"use strict";d();var F7=Function.prototype.call,G7=Object.prototype.hasOwnProperty,V7=Tl();Ky.exports=V7.call(F7,G7)});var Ae=k((HE,ig)=>{"use strict";d();var $,H7=Oy(),X7=ky(),j7=Ry(),W7=Fy(),_n=xp(),Dn=br(),Y7=Xy(),rg=Function,Mp=l(function(r){try{return rg('"use strict"; return ('+r+").constructor;")()}catch{}},"getEvalledConstructor"),wi=Object.getOwnPropertyDescriptor;if(wi)try{wi({},"")}catch{wi=null}var wp=l(function(){throw new Dn},"throwTypeError"),U7=wi?function(){try{return arguments.callee,wp}catch{try{return wi(arguments,"callee").get}catch{return wp}}}():wp,En=wl()(),z7=zy()(),Nt=Object.getPrototypeOf||(z7?function(r){return r.__proto__}:null),Ln={},Z7=typeof Uint8Array>"u"||!Nt?$:Nt(Uint8Array),Ti={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?$:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?$:ArrayBuffer,"%ArrayIteratorPrototype%":En&&Nt?Nt([][Symbol.iterator]()):$,"%AsyncFromSyncIteratorPrototype%":$,"%AsyncFunction%":Ln,"%AsyncGenerator%":Ln,"%AsyncGeneratorFunction%":Ln,"%AsyncIteratorPrototype%":Ln,"%Atomics%":typeof Atomics>"u"?$:Atomics,"%BigInt%":typeof BigInt>"u"?$:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?$:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?$:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?$:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":H7,"%eval%":eval,"%EvalError%":X7,"%Float32Array%":typeof Float32Array>"u"?$:Float32Array,"%Float64Array%":typeof Float64Array>"u"?$:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?$:FinalizationRegistry,"%Function%":rg,"%GeneratorFunction%":Ln,"%Int8Array%":typeof Int8Array>"u"?$:Int8Array,"%Int16Array%":typeof Int16Array>"u"?$:Int16Array,"%Int32Array%":typeof Int32Array>"u"?$:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":En&&Nt?Nt(Nt([][Symbol.iterator]())):$,"%JSON%":typeof JSON=="object"?JSON:$,"%Map%":typeof Map>"u"?$:Map,"%MapIteratorPrototype%":typeof Map>"u"||!En||!Nt?$:Nt(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?$:Promise,"%Proxy%":typeof Proxy>"u"?$:Proxy,"%RangeError%":j7,"%ReferenceError%":W7,"%Reflect%":typeof Reflect>"u"?$:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?$:Set,"%SetIteratorPrototype%":typeof Set>"u"||!En||!Nt?$:Nt(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?$:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":En&&Nt?Nt(""[Symbol.iterator]()):$,"%Symbol%":En?Symbol:$,"%SyntaxError%":_n,"%ThrowTypeError%":U7,"%TypedArray%":Z7,"%TypeError%":Dn,"%Uint8Array%":typeof Uint8Array>"u"?$:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?$:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?$:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?$:Uint32Array,"%URIError%":Y7,"%WeakMap%":typeof WeakMap>"u"?$:WeakMap,"%WeakRef%":typeof WeakRef>"u"?$:WeakRef,"%WeakSet%":typeof WeakSet>"u"?$:WeakSet};if(Nt)try{null.error}catch(r){Qy=Nt(Nt(r)),Ti["%Error.prototype%"]=Qy}var Qy,q7=l(function r(t){var e;if(t==="%AsyncFunction%")e=Mp("async function () {}");else if(t==="%GeneratorFunction%")e=Mp("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=Mp("async function* () {}");else if(t==="%AsyncGenerator%"){var i=r("%AsyncGeneratorFunction%");i&&(e=i.prototype)}else if(t==="%AsyncIteratorPrototype%"){var n=r("%AsyncGenerator%");n&&Nt&&(e=Nt(n.prototype))}return Ti[t]=e,e},"doEval"),tg={__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"]},Jo=Tl(),Il=Pp(),$7=Jo.call(Function.call,Array.prototype.concat),J7=Jo.call(Function.apply,Array.prototype.splice),eg=Jo.call(Function.call,String.prototype.replace),El=Jo.call(Function.call,String.prototype.slice),K7=Jo.call(Function.call,RegExp.prototype.exec),Q7=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,t6=/\\(\\)?/g,e6=l(function(t){var e=El(t,0,1),i=El(t,-1);if(e==="%"&&i!=="%")throw new _n("invalid intrinsic syntax, expected closing `%`");if(i==="%"&&e!=="%")throw new _n("invalid intrinsic syntax, expected opening `%`");var n=[];return eg(t,Q7,function(o,a,c,s){n[n.length]=c?eg(s,t6,"$1"):a||o}),n},"stringToPath"),r6=l(function(t,e){var i=t,n;if(Il(tg,i)&&(n=tg[i],i="%"+n[0]+"%"),Il(Ti,i)){var o=Ti[i];if(o===Ln&&(o=q7(i)),typeof o>"u"&&!e)throw new Dn("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:n,name:i,value:o}}throw new _n("intrinsic "+t+" does not exist!")},"getBaseIntrinsic");ig.exports=l(function(t,e){if(typeof t!="string"||t.length===0)throw new Dn("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new Dn('"allowMissing" argument must be a boolean');if(K7(/^%?[^%]*%?$/,t)===null)throw new _n("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var i=e6(t),n=i.length>0?i[0]:"",o=r6("%"+n+"%",e),a=o.name,c=o.value,s=!1,p=o.alias;p&&(n=p[0],J7(i,$7([0,1],p)));for(var f=1,m=!0;f<i.length;f+=1){var y=i[f],x=El(y,0,1),S=El(y,-1);if((x==='"'||x==="'"||x==="`"||S==='"'||S==="'"||S==="`")&&x!==S)throw new _n("property names with quotes must have matching quotes");if((y==="constructor"||!m)&&(s=!0),n+="."+y,a="%"+n+"%",Il(Ti,a))c=Ti[a];else if(c!=null){if(!(y in c)){if(!e)throw new Dn("base intrinsic for "+t+" exists, but the property is not available.");return}if(wi&&f+1>=i.length){var M=wi(c,y);m=!!M,m&&"get"in M&&!("originalValue"in M.get)?c=M.get:c=c[y]}else m=Il(c,y),c=c[y];m&&!s&&(Ti[a]=c)}}return c},"GetIntrinsic")});var Dl=k((WE,ng)=>{"use strict";d();var i6=Ae(),Ll=i6("%Object.defineProperty%",!0)||!1;if(Ll)try{Ll({},"a",{value:1})}catch{Ll=!1}ng.exports=Ll});var Ol=k((UE,og)=>{"use strict";d();var n6=Ae(),_l=n6("%Object.getOwnPropertyDescriptor%",!0);if(_l)try{_l([],"length")}catch{_l=null}og.exports=_l});var Al=k((ZE,lg)=>{"use strict";d();var ag=Dl(),o6=xp(),On=br(),sg=Ol();lg.exports=l(function(t,e,i){if(!t||typeof t!="object"&&typeof t!="function")throw new On("`obj` must be an object or a function`");if(typeof e!="string"&&typeof e!="symbol")throw new On("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new On("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new On("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new On("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new On("`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,c=arguments.length>6?arguments[6]:!1,s=!!sg&&sg(t,e);if(ag)ag(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(c||!n&&!o&&!a)t[e]=i;else throw new o6("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},"defineDataProperty")});var kl=k((JE,ug)=>{"use strict";d();var Tp=Dl(),cg=l(function(){return!!Tp},"hasPropertyDescriptors");cg.hasArrayLengthDefineBug=l(function(){if(!Tp)return null;try{return Tp([],"length",{value:1}).length!==1}catch{return!0}},"hasArrayLengthDefineBug");ug.exports=cg});var Yr=k((tL,fg)=>{"use strict";d();var a6=Ml(),s6=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",l6=Object.prototype.toString,c6=Array.prototype.concat,pg=Al(),u6=l(function(r){return typeof r=="function"&&l6.call(r)==="[object Function]"},"isFunction"),hg=kl()(),p6=l(function(r,t,e,i){if(t in r){if(i===!0){if(r[t]===e)return}else if(!u6(i)||!i())return}hg?pg(r,t,e,!0):pg(r,t,e)},"defineProperty"),dg=l(function(r,t){var e=arguments.length>2?arguments[2]:{},i=a6(t);s6&&(i=c6.call(i,Object.getOwnPropertySymbols(t)));for(var n=0;n<i.length;n+=1)p6(r,i[n],t[i[n]],e[i[n]])},"defineProperties");dg.supportsDescriptors=!!hg;fg.exports=dg});var bg=k((iL,vg)=>{"use strict";d();var h6=Ae(),mg=Al(),d6=kl()(),yg=Ol(),gg=br(),f6=h6("%Math.floor%");vg.exports=l(function(t,e){if(typeof t!="function")throw new gg("`fn` is not a function");if(typeof e!="number"||e<0||e>4294967295||f6(e)!==e)throw new gg("`length` must be a positive 32-bit integer");var i=arguments.length>2&&!!arguments[2],n=!0,o=!0;if("length"in t&&yg){var a=yg(t,"length");a&&!a.configurable&&(n=!1),a&&!a.writable&&(o=!1)}return(n||o||!i)&&(d6?mg(t,"length",e,!0,!0):mg(t,"length",e)),t},"setFunctionLength")});var Ii=k((aL,Nl)=>{"use strict";d();var Ip=Tl(),Rl=Ae(),m6=bg(),y6=br(),Sg=Rl("%Function.prototype.apply%"),Pg=Rl("%Function.prototype.call%"),Mg=Rl("%Reflect.apply%",!0)||Ip.call(Pg,Sg),Cg=Dl(),g6=Rl("%Math.max%");Nl.exports=l(function(t){if(typeof t!="function")throw new y6("a function is required");var e=Mg(Ip,Pg,arguments);return m6(e,1+g6(0,t.length-(arguments.length-1)),!0)},"callBind");var xg=l(function(){return Mg(Ip,Sg,arguments)},"applyBind");Cg?Cg(Nl.exports,"apply",{value:xg}):Nl.exports.apply=xg});var he=k((cL,Ig)=>{"use strict";d();var wg=Ae(),Tg=Ii(),v6=Tg(wg("String.prototype.indexOf"));Ig.exports=l(function(t,e){var i=wg(t,!!e);return typeof i=="function"&&v6(t,".prototype.")>-1?Tg(i):i},"callBoundIntrinsic")});var Ep=k((hL,Og)=>{"use strict";d();var b6=Ml(),Dg=$o()(),_g=he(),Eg=Object,C6=_g("Array.prototype.push"),Lg=_g("Object.prototype.propertyIsEnumerable"),x6=Dg?Object.getOwnPropertySymbols:null;Og.exports=l(function(t,e){if(t==null)throw new TypeError("target must be an object");var i=Eg(t);if(arguments.length===1)return i;for(var n=1;n<arguments.length;++n){var o=Eg(arguments[n]),a=b6(o),c=Dg&&(Object.getOwnPropertySymbols||x6);if(c)for(var s=c(o),p=0;p<s.length;++p){var f=s[p];Lg(o,f)&&C6(a,f)}for(var m=0;m<a.length;++m){var y=a[m];if(Lg(o,y)){var x=o[y];i[y]=x}}}return i},"assign")});var Dp=k((mL,Ag)=>{"use strict";d();var Lp=Ep(),S6=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"),P6=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");Ag.exports=l(function(){return!Object.assign||S6()||P6()?Lp:Object.assign},"getPolyfill")});var Ng=k((vL,kg)=>{"use strict";d();var M6=Yr(),w6=Dp();kg.exports=l(function(){var t=w6();return M6(Object,{assign:t},{assign:function(){return Object.assign!==t}}),t},"shimAssign")});var Gg=k((xL,Fg)=>{"use strict";d();var T6=Yr(),I6=Ii(),E6=Ep(),Rg=Dp(),L6=Ng(),D6=I6.apply(Rg()),Bg=l(function(t,e){return D6(Object,arguments)},"assign");T6(Bg,{getPolyfill:Rg,implementation:E6,shim:L6});Fg.exports=Bg});var Hg=k((ML,Vg)=>{"use strict";d();var Qo=l(function(){return typeof l(function(){},"f").name=="string"},"functionsHaveNames"),Ko=Object.getOwnPropertyDescriptor;if(Ko)try{Ko([],"length")}catch{Ko=null}Qo.functionsHaveConfigurableNames=l(function(){if(!Qo()||!Ko)return!1;var t=Ko(function(){},"name");return!!t&&!!t.configurable},"functionsHaveConfigurableNames");var _6=Function.prototype.bind;Qo.boundFunctionsHaveNames=l(function(){return Qo()&&typeof _6=="function"&&l(function(){},"f").bind().name!==""},"boundFunctionsHaveNames");Vg.exports=Qo});var Wg=k((IL,jg)=>{"use strict";d();var Xg=Al(),O6=kl()(),A6=Hg().functionsHaveConfigurableNames(),k6=br();jg.exports=l(function(t,e){if(typeof t!="function")throw new k6("`fn` is not a function");var i=arguments.length>2&&!!arguments[2];return(!i||A6)&&(O6?Xg(t,"name",e,!0,!0):Xg(t,"name",e)),t},"setFunctionName")});var _p=k((DL,Yg)=>{"use strict";d();var N6=Wg(),R6=br(),B6=Object;Yg.exports=N6(l(function(){if(this==null||this!==B6(this))throw new R6("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 Op=k((AL,Ug)=>{"use strict";d();var F6=_p(),G6=Yr().supportsDescriptors,V6=Object.getOwnPropertyDescriptor;Ug.exports=l(function(){if(G6&&/a/mig.flags==="gim"){var t=V6(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 F6},"getPolyfill")});var qg=k((RL,Zg)=>{"use strict";d();var H6=Yr().supportsDescriptors,X6=Op(),j6=Object.getOwnPropertyDescriptor,W6=Object.defineProperty,Y6=TypeError,zg=Object.getPrototypeOf,U6=/a/;Zg.exports=l(function(){if(!H6||!zg)throw new Y6("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var t=X6(),e=zg(U6),i=j6(e,"flags");return(!i||i.get!==t)&&W6(e,"flags",{configurable:!0,enumerable:!1,get:t}),t},"shimFlags")});var Qg=k((GL,Kg)=>{"use strict";d();var z6=Yr(),Z6=Ii(),q6=_p(),$g=Op(),$6=qg(),Jg=Z6($g());z6(Jg,{getPolyfill:$g,implementation:q6,shim:$6});Kg.exports=Jg});var Ur=k((HL,t0)=>{"use strict";d();var J6=$o();t0.exports=l(function(){return J6()&&!!Symbol.toStringTag},"hasToStringTagShams")});var kp=k((WL,r0)=>{"use strict";d();var K6=Ur()(),Q6=he(),Ap=Q6("Object.prototype.toString"),Bl=l(function(t){return K6&&t&&typeof t=="object"&&Symbol.toStringTag in t?!1:Ap(t)==="[object Arguments]"},"isArguments"),e0=l(function(t){return Bl(t)?!0:t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&Ap(t)!=="[object Array]"&&Ap(t.callee)==="[object Function]"},"isArguments"),tC=function(){return Bl(arguments)}();Bl.isLegacyArguments=e0;r0.exports=tC?Bl:e0});var i0=k(()=>{d()});var P0=k(($L,S0)=>{d();var Wp=typeof Map=="function"&&Map.prototype,Np=Object.getOwnPropertyDescriptor&&Wp?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Gl=Wp&&Np&&typeof Np.get=="function"?Np.get:null,n0=Wp&&Map.prototype.forEach,Yp=typeof Set=="function"&&Set.prototype,Rp=Object.getOwnPropertyDescriptor&&Yp?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Vl=Yp&&Rp&&typeof Rp.get=="function"?Rp.get:null,o0=Yp&&Set.prototype.forEach,eC=typeof WeakMap=="function"&&WeakMap.prototype,ea=eC?WeakMap.prototype.has:null,rC=typeof WeakSet=="function"&&WeakSet.prototype,ra=rC?WeakSet.prototype.has:null,iC=typeof WeakRef=="function"&&WeakRef.prototype,a0=iC?WeakRef.prototype.deref:null,nC=Boolean.prototype.valueOf,oC=Object.prototype.toString,aC=Function.prototype.toString,sC=String.prototype.match,Up=String.prototype.slice,Zr=String.prototype.replace,lC=String.prototype.toUpperCase,s0=String.prototype.toLowerCase,y0=RegExp.prototype.test,l0=Array.prototype.concat,Ke=Array.prototype.join,cC=Array.prototype.slice,c0=Math.floor,Gp=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Bp=Object.getOwnPropertySymbols,Vp=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,An=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Wt=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===An||!0)?Symbol.toStringTag:null,g0=Object.prototype.propertyIsEnumerable,u0=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(r){return r.__proto__}:null);function p0(r,t){if(r===1/0||r===-1/0||r!==r||r&&r>-1e3&&r<1e3||y0.call(/e/,t))return t;var e=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof r=="number"){var i=r<0?-c0(-r):c0(r);if(i!==r){var n=String(i),o=Up.call(t,n.length+1);return Zr.call(n,e,"$&_")+"."+Zr.call(Zr.call(o,/([0-9]{3})/g,"$&_"),/_$/,"")}}return Zr.call(t,e,"$&_")}l(p0,"addNumericSeparator");var Hp=i0(),h0=Hp.custom,d0=b0(h0)?h0:null;S0.exports=l(function r(t,e,i,n){var o=e||{};if(zr(o,"quoteStyle")&&o.quoteStyle!=="single"&&o.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(zr(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=zr(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(zr(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(zr(o,"numericSeparator")&&typeof o.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var c=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 x0(t,o);if(typeof t=="number"){if(t===0)return 1/0/t>0?"0":"-0";var s=String(t);return c?p0(t,s):s}if(typeof t=="bigint"){var p=String(t)+"n";return c?p0(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=IC(o,i);if(typeof n>"u")n=[];else if(C0(n,t)>=0)return"[Circular]";function y(ut,yt,Ct){if(yt&&(n=cC.call(n),n.push(yt)),Ct){var Bt={depth:o.depth};return zr(o,"quoteStyle")&&(Bt.quoteStyle=o.quoteStyle),r(ut,Bt,i+1,n)}return r(ut,o,i+1,n)}if(l(y,"inspect"),typeof t=="function"&&!f0(t)){var x=vC(t),S=Fl(t,y);return"[Function"+(x?": "+x:" (anonymous)")+"]"+(S.length>0?" { "+Ke.call(S,", ")+" }":"")}if(b0(t)){var M=An?Zr.call(String(t),/^(Symbol\(.*\))_[^)]*$/,"$1"):Vp.call(t);return typeof t=="object"&&!An?ta(M):M}if(MC(t)){for(var g="<"+s0.call(String(t.nodeName)),C=t.attributes||[],I=0;I<C.length;I++)g+=" "+C[I].name+"="+v0(uC(C[I].value),"double",o);return g+=">",t.childNodes&&t.childNodes.length&&(g+="..."),g+="</"+s0.call(String(t.nodeName))+">",g}if(Xp(t)){if(t.length===0)return"[]";var T=Fl(t,y);return m&&!TC(T)?"["+jp(T,m)+"]":"[ "+Ke.call(T,", ")+" ]"}if(hC(t)){var w=Fl(t,y);return!("cause"in Error.prototype)&&"cause"in t&&!g0.call(t,"cause")?"{ ["+String(t)+"] "+Ke.call(l0.call("[cause]: "+y(t.cause),w),", ")+" }":w.length===0?"["+String(t)+"]":"{ ["+String(t)+"] "+Ke.call(w,", ")+" }"}if(typeof t=="object"&&a){if(d0&&typeof t[d0]=="function"&&Hp)return Hp(t,{depth:f-i});if(a!=="symbol"&&typeof t.inspect=="function")return t.inspect()}if(bC(t)){var L=[];return n0&&n0.call(t,function(ut,yt){L.push(y(yt,t,!0)+" => "+y(ut,t))}),m0("Map",Gl.call(t),L,m)}if(SC(t)){var _=[];return o0&&o0.call(t,function(ut){_.push(y(ut,t))}),m0("Set",Vl.call(t),_,m)}if(CC(t))return Fp("WeakMap");if(PC(t))return Fp("WeakSet");if(xC(t))return Fp("WeakRef");if(fC(t))return ta(y(Number(t)));if(yC(t))return ta(y(Gp.call(t)));if(mC(t))return ta(nC.call(t));if(dC(t))return ta(y(String(t)));if(typeof window<"u"&&t===window)return"{ [object Window] }";if(t===global)return"{ [object globalThis] }";if(!pC(t)&&!f0(t)){var R=Fl(t,y),G=u0?u0(t)===Object.prototype:t instanceof Object||t.constructor===Object,N=t instanceof Object?"":"null prototype",j=!G&&Wt&&Object(t)===t&&Wt in t?Up.call(qr(t),8,-1):N?"Object":"",H=G||typeof t.constructor!="function"?"":t.constructor.name?t.constructor.name+" ":"",J=H+(j||N?"["+Ke.call(l0.call([],j||[],N||[]),": ")+"] ":"");return R.length===0?J+"{}":m?J+"{"+jp(R,m)+"}":J+"{ "+Ke.call(R,", ")+" }"}return String(t)},"inspect_");function v0(r,t,e){var i=(e.quoteStyle||t)==="double"?'"':"'";return i+r+i}l(v0,"wrapQuotes");function uC(r){return Zr.call(String(r),/"/g,"&quot;")}l(uC,"quote");function Xp(r){return qr(r)==="[object Array]"&&(!Wt||!(typeof r=="object"&&Wt in r))}l(Xp,"isArray");function pC(r){return qr(r)==="[object Date]"&&(!Wt||!(typeof r=="object"&&Wt in r))}l(pC,"isDate");function f0(r){return qr(r)==="[object RegExp]"&&(!Wt||!(typeof r=="object"&&Wt in r))}l(f0,"isRegExp");function hC(r){return qr(r)==="[object Error]"&&(!Wt||!(typeof r=="object"&&Wt in r))}l(hC,"isError");function dC(r){return qr(r)==="[object String]"&&(!Wt||!(typeof r=="object"&&Wt in r))}l(dC,"isString");function fC(r){return qr(r)==="[object Number]"&&(!Wt||!(typeof r=="object"&&Wt in r))}l(fC,"isNumber");function mC(r){return qr(r)==="[object Boolean]"&&(!Wt||!(typeof r=="object"&&Wt in r))}l(mC,"isBoolean");function b0(r){if(An)return r&&typeof r=="object"&&r instanceof Symbol;if(typeof r=="symbol")return!0;if(!r||typeof r!="object"||!Vp)return!1;try{return Vp.call(r),!0}catch{}return!1}l(b0,"isSymbol");function yC(r){if(!r||typeof r!="object"||!Gp)return!1;try{return Gp.call(r),!0}catch{}return!1}l(yC,"isBigInt");var gC=Object.prototype.hasOwnProperty||function(r){return r in this};function zr(r,t){return gC.call(r,t)}l(zr,"has");function qr(r){return oC.call(r)}l(qr,"toStr");function vC(r){if(r.name)return r.name;var t=sC.call(aC.call(r),/^function\s*([\w$]+)/);return t?t[1]:null}l(vC,"nameOf");function C0(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(C0,"indexOf");function bC(r){if(!Gl||!r||typeof r!="object")return!1;try{Gl.call(r);try{Vl.call(r)}catch{return!0}return r instanceof Map}catch{}return!1}l(bC,"isMap");function CC(r){if(!ea||!r||typeof r!="object")return!1;try{ea.call(r,ea);try{ra.call(r,ra)}catch{return!0}return r instanceof WeakMap}catch{}return!1}l(CC,"isWeakMap");function xC(r){if(!a0||!r||typeof r!="object")return!1;try{return a0.call(r),!0}catch{}return!1}l(xC,"isWeakRef");function SC(r){if(!Vl||!r||typeof r!="object")return!1;try{Vl.call(r);try{Gl.call(r)}catch{return!0}return r instanceof Set}catch{}return!1}l(SC,"isSet");function PC(r){if(!ra||!r||typeof r!="object")return!1;try{ra.call(r,ra);try{ea.call(r,ea)}catch{return!0}return r instanceof WeakSet}catch{}return!1}l(PC,"isWeakSet");function MC(r){return!r||typeof r!="object"?!1:typeof HTMLElement<"u"&&r instanceof HTMLElement?!0:typeof r.nodeName=="string"&&typeof r.getAttribute=="function"}l(MC,"isElement");function x0(r,t){if(r.length>t.maxStringLength){var e=r.length-t.maxStringLength,i="... "+e+" more character"+(e>1?"s":"");return x0(Up.call(r,0,t.maxStringLength),t)+i}var n=Zr.call(Zr.call(r,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,wC);return v0(n,"single",t)}l(x0,"inspectString");function wC(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":"")+lC.call(t.toString(16))}l(wC,"lowbyte");function ta(r){return"Object("+r+")"}l(ta,"markBoxed");function Fp(r){return r+" { ? }"}l(Fp,"weakCollectionOf");function m0(r,t,e,i){var n=i?jp(e,i):Ke.call(e,", ");return r+" ("+t+") {"+n+"}"}l(m0,"collectionOf");function TC(r){for(var t=0;t<r.length;t++)if(C0(r[t],`
2
2
  `)>=0)return!1;return!0}l(TC,"singleLineValues");function IC(r,t){var e;if(r.indent===" ")e=" ";else if(typeof r.indent=="number"&&r.indent>0)e=Ke.call(Array(r.indent+1)," ");else return null;return{base:e,prev:Ke.call(Array(t+1),e)}}l(IC,"getIndent");function jp(r,t){if(r.length===0)return"";var e=`
3
3
  `+t.prev+t.base;return e+Ke.call(r,","+e)+`
4
- `+t.prev}l(jp,"indentedJoin");function Fl(r,t){var e=Xp(r),i=[];if(e){i.length=r.length;for(var n=0;n<r.length;n++)i[n]=zr(r,n)?t(r[n],r):""}var o=typeof Bp=="function"?Bp(r):[],a;if(An){a={};for(var c=0;c<o.length;c++)a["$"+o[c]]=o[c]}for(var s in r)zr(r,s)&&(e&&String(Number(s))===s&&s<r.length||An&&a["$"+s]instanceof Symbol||(y0.call(/[^\w$]/,s)?i.push(t(s,r)+": "+t(r[s],r)):i.push(s+": "+t(r[s],r))));if(typeof Bp=="function")for(var p=0;p<o.length;p++)g0.call(r,o[p])&&i.push("["+t(o[p])+"]: "+t(r[o[p]],r));return i}l(Fl,"arrObjKeys")});var Zp=k((QL,w0)=>{"use strict";d();var M0=Ae(),kn=he(),EC=P0(),LC=br(),Hl=M0("%WeakMap%",!0),Xl=M0("%Map%",!0),DC=kn("WeakMap.prototype.get",!0),_C=kn("WeakMap.prototype.set",!0),OC=kn("WeakMap.prototype.has",!0),AC=kn("Map.prototype.get",!0),kC=kn("Map.prototype.set",!0),NC=kn("Map.prototype.has",!0),zp=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"),RC=l(function(r,t){var e=zp(r,t);return e&&e.value},"listGet"),BC=l(function(r,t,e){var i=zp(r,t);i?i.value=e:r.next={key:t,next:r.next,value:e}},"listSet"),FC=l(function(r,t){return!!zp(r,t)},"listHas");w0.exports=l(function(){var t,e,i,n={assert:function(o){if(!n.has(o))throw new LC("Side channel does not contain "+EC(o))},get:function(o){if(Hl&&o&&(typeof o=="object"||typeof o=="function")){if(t)return DC(t,o)}else if(Xl){if(e)return AC(e,o)}else if(i)return RC(i,o)},has:function(o){if(Hl&&o&&(typeof o=="object"||typeof o=="function")){if(t)return OC(t,o)}else if(Xl){if(e)return NC(e,o)}else if(i)return FC(i,o);return!1},set:function(o,a){Hl&&o&&(typeof o=="object"||typeof o=="function")?(t||(t=new Hl),_C(t,o,a)):Xl?(e||(e=new Xl),kC(e,o,a)):(i||(i={key:{},next:null}),BC(i,o,a))}};return n},"getSideChannel")});var I0=k((rD,T0)=>{"use strict";d();var GC=Pp(),ia=Zp()(),Cr=br(),qp={assert:function(r,t){if(!r||typeof r!="object"&&typeof r!="function")throw new Cr("`O` is not an object");if(typeof t!="string")throw new Cr("`slot` must be a string");if(ia.assert(r),!qp.has(r,t))throw new Cr("`"+t+"` is not present on `O`")},get:function(r,t){if(!r||typeof r!="object"&&typeof r!="function")throw new Cr("`O` is not an object");if(typeof t!="string")throw new Cr("`slot` must be a string");var e=ia.get(r);return e&&e["$"+t]},has:function(r,t){if(!r||typeof r!="object"&&typeof r!="function")throw new Cr("`O` is not an object");if(typeof t!="string")throw new Cr("`slot` must be a string");var e=ia.get(r);return!!e&&GC(e,"$"+t)},set:function(r,t,e){if(!r||typeof r!="object"&&typeof r!="function")throw new Cr("`O` is not an object");if(typeof t!="string")throw new Cr("`slot` must be a string");var i=ia.get(r);i||(i={},ia.set(r,i)),i["$"+t]=e}};Object.freeze&&Object.freeze(qp);T0.exports=qp});var D0=k((nD,L0)=>{"use strict";d();var na=I0(),VC=SyntaxError,E0=typeof StopIteration=="object"?StopIteration:null;L0.exports=l(function(t){if(!E0)throw new VC("this environment lacks StopIteration");na.set(t,"[[Done]]",!1);var e={next:l(function(){var n=na.get(this,"[[Iterator]]"),o=na.get(n,"[[Done]]");try{return{done:o,value:o?void 0:n.next()}}catch(a){if(na.set(n,"[[Done]]",!0),a!==E0)throw a;return{done:!0,value:void 0}}},"next")};return na.set(e,"[[Iterator]]",t),e},"getStopIterationIterator")});var $p=k((sD,_0)=>{d();var HC={}.toString;_0.exports=Array.isArray||function(r){return HC.call(r)=="[object Array]"}});var Jp=k((cD,O0)=>{"use strict";d();var XC=String.prototype.valueOf,jC=l(function(t){try{return XC.call(t),!0}catch{return!1}},"tryStringObject"),WC=Object.prototype.toString,YC="[object String]",UC=Ur()();O0.exports=l(function(t){return typeof t=="string"?!0:typeof t!="object"?!1:UC?jC(t):WC.call(t)===YC},"isString")});var Qp=k((hD,N0)=>{"use strict";d();var Kp=typeof Map=="function"&&Map.prototype?Map:null,zC=typeof Set=="function"&&Set.prototype?Set:null,jl;Kp||(jl=l(function(t){return!1},"isMap"));var k0=Kp?Map.prototype.has:null,A0=zC?Set.prototype.has:null;!jl&&!k0&&(jl=l(function(t){return!1},"isMap"));N0.exports=jl||l(function(t){if(!t||typeof t!="object")return!1;try{if(k0.call(t),A0)try{A0.call(t)}catch{return!0}return t instanceof Kp}catch{}return!1},"isMap")});var eh=k((mD,F0)=>{"use strict";d();var ZC=typeof Map=="function"&&Map.prototype?Map:null,th=typeof Set=="function"&&Set.prototype?Set:null,Wl;th||(Wl=l(function(t){return!1},"isSet"));var R0=ZC?Map.prototype.has:null,B0=th?Set.prototype.has:null;!Wl&&!B0&&(Wl=l(function(t){return!1},"isSet"));F0.exports=Wl||l(function(t){if(!t||typeof t!="object")return!1;try{if(B0.call(t),R0)try{R0.call(t)}catch{return!0}return t instanceof th}catch{}return!1},"isSet")});var $0=k((vD,zl)=>{"use strict";d();var G0=kp(),V0=D0();wl()()||$o()()?(Yl=Symbol.iterator,zl.exports=l(function(t){if(t!=null&&typeof t[Yl]<"u")return t[Yl]();if(G0(t))return Array.prototype[Yl].call(t)},"getIterator")):(H0=$p(),X0=Jp(),rh=Ae(),j0=rh("%Map%",!0),W0=rh("%Set%",!0),xe=he(),ih=xe("Array.prototype.push"),nh=xe("String.prototype.charCodeAt"),Y0=xe("String.prototype.slice"),U0=l(function(t,e){var i=t.length;if(e+1>=i)return e+1;var n=nh(t,e);if(n<55296||n>56319)return e+1;var o=nh(t,e+1);return o<56320||o>57343?e+1:e+2},"advanceStringIndex"),Ul=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"),oh=l(function(t,e){if(H0(t)||G0(t))return Ul(t);if(X0(t)){var i=0;return{next:l(function(){var o=U0(t,i),a=Y0(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"),!j0&&!W0?zl.exports=l(function(t){if(t!=null)return oh(t,!0)},"getIterator"):(z0=Qp(),Z0=eh(),ah=xe("Map.prototype.forEach",!0),sh=xe("Set.prototype.forEach",!0),(typeof b>"u"||!b.versions||!b.versions.node)&&(lh=xe("Map.prototype.iterator",!0),ch=xe("Set.prototype.iterator",!0)),uh=xe("Map.prototype.@@iterator",!0)||xe("Map.prototype._es6-shim iterator_",!0),ph=xe("Set.prototype.@@iterator",!0)||xe("Set.prototype._es6-shim iterator_",!0),q0=l(function(t){if(z0(t)){if(lh)return V0(lh(t));if(uh)return uh(t);if(ah){var e=[];return ah(t,function(n,o){ih(e,[o,n])}),Ul(e)}}if(Z0(t)){if(ch)return V0(ch(t));if(ph)return ph(t);if(sh){var i=[];return sh(t,function(n){ih(i,n)}),Ul(i)}}},"getCollectionIterator"),zl.exports=l(function(t){return q0(t)||oh(t)},"getIterator")));var Yl,H0,X0,rh,j0,W0,xe,ih,nh,Y0,U0,Ul,oh,z0,Z0,ah,sh,lh,ch,uh,ph,q0});var hh=k((xD,K0)=>{"use strict";d();var J0=l(function(r){return r!==r},"numberIsNaN");K0.exports=l(function(t,e){return t===0&&e===0?1/t===1/e:!!(t===e||J0(t)&&J0(e))},"is")});var dh=k((MD,Q0)=>{"use strict";d();var qC=hh();Q0.exports=l(function(){return typeof Object.is=="function"?Object.is:qC},"getPolyfill")});var e2=k((ID,t2)=>{"use strict";d();var $C=dh(),JC=Yr();t2.exports=l(function(){var t=$C();return JC(Object,{is:t},{is:l(function(){return Object.is!==t},"testObjectIs")}),t},"shimObjectIs")});var o2=k((DD,n2)=>{"use strict";d();var KC=Yr(),QC=Ii(),t8=hh(),r2=dh(),e8=e2(),i2=QC(r2(),Object);KC(i2,{getPolyfill:r2,implementation:t8,shim:e8});n2.exports=i2});var mh=k((OD,c2)=>{"use strict";d();var r8=Ii(),l2=he(),i8=Ae(),fh=i8("%ArrayBuffer%",!0),Zl=l2("ArrayBuffer.prototype.byteLength",!0),n8=l2("Object.prototype.toString"),a2=!!fh&&!Zl&&new fh(0).slice,s2=!!a2&&r8(a2);c2.exports=l(Zl||s2?function(t){if(!t||typeof t!="object")return!1;try{return Zl?Zl(t):s2(t,0),!0}catch{return!1}}:fh?function(t){return n8(t)==="[object ArrayBuffer]"}:function(t){return!1},"isArrayBuffer")});var p2=k((ND,u2)=>{"use strict";d();var o8=Date.prototype.getDay,a8=l(function(t){try{return o8.call(t),!0}catch{return!1}},"tryDateGetDayCall"),s8=Object.prototype.toString,l8="[object Date]",c8=Ur()();u2.exports=l(function(t){return typeof t!="object"||t===null?!1:c8?a8(t):s8.call(t)===l8},"isDateObject")});var y2=k((FD,m2)=>{"use strict";d();var yh=he(),h2=Ur()(),d2,f2,gh,vh;h2&&(d2=yh("Object.prototype.hasOwnProperty"),f2=yh("RegExp.prototype.exec"),gh={},ql=l(function(){throw gh},"throwRegexMarker"),vh={toString:ql,valueOf:ql},typeof Symbol.toPrimitive=="symbol"&&(vh[Symbol.toPrimitive]=ql));var ql,u8=yh("Object.prototype.toString"),p8=Object.getOwnPropertyDescriptor,h8="[object RegExp]";m2.exports=l(h2?function(t){if(!t||typeof t!="object")return!1;var e=p8(t,"lastIndex"),i=e&&d2(e,"value");if(!i)return!1;try{f2(t,vh)}catch(n){return n===gh}}:function(t){return!t||typeof t!="object"&&typeof t!="function"?!1:u8(t)===h8},"isRegex")});var b2=k((HD,v2)=>{"use strict";d();var d8=he(),g2=d8("SharedArrayBuffer.prototype.byteLength",!0);v2.exports=l(g2?function(t){if(!t||typeof t!="object")return!1;try{return g2(t),!0}catch{return!1}}:function(t){return!1},"isSharedArrayBuffer")});var x2=k((WD,C2)=>{"use strict";d();var f8=Number.prototype.toString,m8=l(function(t){try{return f8.call(t),!0}catch{return!1}},"tryNumberObject"),y8=Object.prototype.toString,g8="[object Number]",v8=Ur()();C2.exports=l(function(t){return typeof t=="number"?!0:typeof t!="object"?!1:v8?m8(t):y8.call(t)===g8},"isNumberObject")});var M2=k((zD,P2)=>{"use strict";d();var S2=he(),b8=S2("Boolean.prototype.toString"),C8=S2("Object.prototype.toString"),x8=l(function(t){try{return b8(t),!0}catch{return!1}},"booleanBrandCheck"),S8="[object Boolean]",P8=Ur()();P2.exports=l(function(t){return typeof t=="boolean"?!0:t===null||typeof t!="object"?!1:P8&&Symbol.toStringTag in t?x8(t):C8(t)===S8},"isBoolean")});var E2=k(($D,bh)=>{"use strict";d();var M8=Object.prototype.toString,w8=wl()();w8?(w2=Symbol.prototype.toString,T2=/^Symbol\(.*\)$/,I2=l(function(t){return typeof t.valueOf()!="symbol"?!1:T2.test(w2.call(t))},"isRealSymbolObject"),bh.exports=l(function(t){if(typeof t=="symbol")return!0;if(M8.call(t)!=="[object Symbol]")return!1;try{return I2(t)}catch{return!1}},"isSymbol")):bh.exports=l(function(t){return!1},"isSymbol");var w2,T2,I2});var _2=k((QD,D2)=>{"use strict";d();var L2=typeof BigInt<"u"&&BigInt;D2.exports=l(function(){return typeof L2=="function"&&typeof BigInt=="function"&&typeof L2(42)=="bigint"&&typeof BigInt(42)=="bigint"},"hasNativeBigInts")});var k2=k((r_,Ch)=>{"use strict";d();var T8=_2()();T8?(O2=BigInt.prototype.valueOf,A2=l(function(t){try{return O2.call(t),!0}catch{}return!1},"tryBigIntObject"),Ch.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:A2(t)},"isBigInt")):Ch.exports=l(function(t){return!1},"isBigInt");var O2,A2});var R2=k((o_,N2)=>{"use strict";d();var I8=Jp(),E8=x2(),L8=M2(),D8=E2(),_8=k2();N2.exports=l(function(t){if(t==null||typeof t!="object"&&typeof t!="function")return null;if(I8(t))return"String";if(E8(t))return"Number";if(L8(t))return"Boolean";if(D8(t))return"Symbol";if(_8(t))return"BigInt"},"whichBoxedPrimitive")});var G2=k((l_,F2)=>{"use strict";d();var $l=typeof WeakMap=="function"&&WeakMap.prototype?WeakMap:null,B2=typeof WeakSet=="function"&&WeakSet.prototype?WeakSet:null,Jl;$l||(Jl=l(function(t){return!1},"isWeakMap"));var Sh=$l?$l.prototype.has:null,xh=B2?B2.prototype.has:null;!Jl&&!Sh&&(Jl=l(function(t){return!1},"isWeakMap"));F2.exports=Jl||l(function(t){if(!t||typeof t!="object")return!1;try{if(Sh.call(t,Sh),xh)try{xh.call(t,xh)}catch{return!0}return t instanceof $l}catch{}return!1},"isWeakMap")});var H2=k((p_,Mh)=>{"use strict";d();var O8=Ae(),V2=he(),A8=O8("%WeakSet%",!0),Ph=V2("WeakSet.prototype.has",!0);Ph?(Kl=V2("WeakMap.prototype.has",!0),Mh.exports=l(function(t){if(!t||typeof t!="object")return!1;try{if(Ph(t,Ph),Kl)try{Kl(t,Kl)}catch{return!0}return t instanceof A8}catch{}return!1},"isWeakSet")):Mh.exports=l(function(t){return!1},"isWeakSet");var Kl});var j2=k((f_,X2)=>{"use strict";d();var k8=Qp(),N8=eh(),R8=G2(),B8=H2();X2.exports=l(function(t){if(t&&typeof t=="object"){if(k8(t))return"Map";if(N8(t))return"Set";if(R8(t))return"WeakMap";if(B8(t))return"WeakSet"}return!1},"whichCollection")});var z2=k((g_,U2)=>{"use strict";d();var Y2=Function.prototype.toString,Nn=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,Th,Ql;if(typeof Nn=="function"&&typeof Object.defineProperty=="function")try{Th=Object.defineProperty({},"length",{get:function(){throw Ql}}),Ql={},Nn(function(){throw 42},null,Th)}catch(r){r!==Ql&&(Nn=null)}else Nn=null;var F8=/^\s*class\b/,Ih=l(function(t){try{var e=Y2.call(t);return F8.test(e)}catch{return!1}},"isES6ClassFunction"),wh=l(function(t){try{return Ih(t)?!1:(Y2.call(t),!0)}catch{return!1}},"tryFunctionToStr"),tc=Object.prototype.toString,G8="[object Object]",V8="[object Function]",H8="[object GeneratorFunction]",X8="[object HTMLAllCollection]",j8="[object HTML document.all class]",W8="[object HTMLCollection]",Y8=typeof Symbol=="function"&&!!Symbol.toStringTag,U8=!(0 in[,]),Eh=l(function(){return!1},"isDocumentDotAll");typeof document=="object"&&(W2=document.all,tc.call(W2)===tc.call(document.all)&&(Eh=l(function(t){if((U8||!t)&&(typeof t>"u"||typeof t=="object"))try{var e=tc.call(t);return(e===X8||e===j8||e===W8||e===G8)&&t("")==null}catch{}return!1},"isDocumentDotAll")));var W2;U2.exports=l(Nn?function(t){if(Eh(t))return!0;if(!t||typeof t!="function"&&typeof t!="object")return!1;try{Nn(t,null,Th)}catch(e){if(e!==Ql)return!1}return!Ih(t)&&wh(t)}:function(t){if(Eh(t))return!0;if(!t||typeof t!="function"&&typeof t!="object")return!1;if(Y8)return wh(t);if(Ih(t))return!1;var e=tc.call(t);return e!==V8&&e!==H8&&!/^\[object HTML/.test(e)?!1:wh(t)},"isCallable")});var $2=k((C_,q2)=>{"use strict";d();var z8=z2(),Z8=Object.prototype.toString,Z2=Object.prototype.hasOwnProperty,q8=l(function(t,e,i){for(var n=0,o=t.length;n<o;n++)Z2.call(t,n)&&(i==null?e(t[n],n,t):e.call(i,t[n],n,t))},"forEachArray"),$8=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"),J8=l(function(t,e,i){for(var n in t)Z2.call(t,n)&&(i==null?e(t[n],n,t):e.call(i,t[n],n,t))},"forEachObject"),K8=l(function(t,e,i){if(!z8(e))throw new TypeError("iterator must be a function");var n;arguments.length>=3&&(n=i),Z8.call(t)==="[object Array]"?q8(t,e,n):typeof t=="string"?$8(t,e,n):J8(t,e,n)},"forEach");q2.exports=K8});var K2=k((P_,J2)=>{"use strict";d();J2.exports=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]});var tv=k((w_,Q2)=>{"use strict";d();var Lh=K2(),Q8=typeof globalThis>"u"?global:globalThis;Q2.exports=l(function(){for(var t=[],e=0;e<Lh.length;e++)typeof Q8[Lh[e]]=="function"&&(t[t.length]=Lh[e]);return t},"availableTypedArrays")});var ov=k((E_,nv)=>{"use strict";d();var rc=$2(),t9=tv(),ev=Ii(),Oh=he(),ec=Ol(),e9=Oh("Object.prototype.toString"),iv=Ur()(),rv=typeof globalThis>"u"?global:globalThis,_h=t9(),Ah=Oh("String.prototype.slice"),Dh=Object.getPrototypeOf,r9=Oh("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"),ic={__proto__:null};iv&&ec&&Dh?rc(_h,function(r){var t=new rv[r];if(Symbol.toStringTag in t){var e=Dh(t),i=ec(e,Symbol.toStringTag);if(!i){var n=Dh(e);i=ec(n,Symbol.toStringTag)}ic["$"+r]=ev(i.get)}}):rc(_h,function(r){var t=new rv[r],e=t.slice||t.set;e&&(ic["$"+r]=ev(e))});var i9=l(function(t){var e=!1;return rc(ic,function(i,n){if(!e)try{"$"+i(t)===n&&(e=Ah(n,1))}catch{}}),e},"tryAllTypedArrays"),n9=l(function(t){var e=!1;return rc(ic,function(i,n){if(!e)try{i(t),e=Ah(n,1)}catch{}}),e},"tryAllSlices");nv.exports=l(function(t){if(!t||typeof t!="object")return!1;if(!iv){var e=Ah(e9(t),8,-1);return r9(_h,e)>-1?e:e!=="Object"?!1:n9(t)}return ec?i9(t):null},"whichTypedArray")});var lv=k((__,sv)=>{"use strict";d();var o9=he(),av=o9("ArrayBuffer.prototype.byteLength",!0),a9=mh();sv.exports=l(function(t){return a9(t)?av?av(t):t.byteLength:NaN},"byteLength")});var Av=k((k_,Ov)=>{"use strict";d();var Lv=Gg(),Qe=he(),cv=Qg(),s9=Ae(),Rn=$0(),l9=Zp(),uv=o2(),pv=kp(),hv=$p(),dv=mh(),fv=p2(),mv=y2(),yv=b2(),gv=Ml(),vv=R2(),bv=j2(),Cv=ov(),xv=lv(),Sv=Qe("SharedArrayBuffer.prototype.byteLength",!0),Pv=Qe("Date.prototype.getTime"),kh=Object.getPrototypeOf,Mv=Qe("Object.prototype.toString"),oc=s9("%Set%",!0),Nh=Qe("Map.prototype.has",!0),ac=Qe("Map.prototype.get",!0),wv=Qe("Map.prototype.size",!0),sc=Qe("Set.prototype.add",!0),Dv=Qe("Set.prototype.delete",!0),lc=Qe("Set.prototype.has",!0),nc=Qe("Set.prototype.size",!0);function Tv(r,t,e,i){for(var n=Rn(r),o;(o=n.next())&&!o.done;)if(ke(t,o.value,e,i))return Dv(r,o.value),!0;return!1}l(Tv,"setHasEqualElement");function _v(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(_v,"findLooseMatchingPrimitives");function c9(r,t,e,i,n,o){var a=_v(e);if(a!=null)return a;var c=ac(t,a),s=Lv({},n,{strict:!1});return typeof c>"u"&&!Nh(t,a)||!ke(i,c,s,o)?!1:!Nh(r,a)&&ke(i,c,s,o)}l(c9,"mapMightHaveLoosePrim");function u9(r,t,e){var i=_v(e);return i!=null?i:lc(t,i)&&!lc(r,i)}l(u9,"setMightHaveLoosePrim");function Iv(r,t,e,i,n,o){for(var a=Rn(r),c,s;(c=a.next())&&!c.done;)if(s=c.value,ke(e,s,n,o)&&ke(i,ac(t,s),n,o))return Dv(r,s),!0;return!1}l(Iv,"mapHasEqualEntry");function ke(r,t,e,i){var n=e||{};if(n.strict?uv(r,t):r===t)return!0;var o=vv(r),a=vv(t);if(o!==a)return!1;if(!r||!t||typeof r!="object"&&typeof t!="object")return n.strict?uv(r,t):r==t;var c=i.has(r),s=i.has(t),p;if(c&&s){if(i.get(r)===i.get(t))return!0}else p={};return c||i.set(r,p),s||i.set(t,p),d9(r,t,n,i)}l(ke,"internalDeepEqual");function Ev(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(Ev,"isBuffer");function p9(r,t,e,i){if(nc(r)!==nc(t))return!1;for(var n=Rn(r),o=Rn(t),a,c,s;(a=n.next())&&!a.done;)if(a.value&&typeof a.value=="object")s||(s=new oc),sc(s,a.value);else if(!lc(t,a.value)){if(e.strict||!u9(r,t,a.value))return!1;s||(s=new oc),sc(s,a.value)}if(s){for(;(c=o.next())&&!c.done;)if(c.value&&typeof c.value=="object"){if(!Tv(s,c.value,e.strict,i))return!1}else if(!e.strict&&!lc(r,c.value)&&!Tv(s,c.value,e.strict,i))return!1;return nc(s)===0}return!0}l(p9,"setEquiv");function h9(r,t,e,i){if(wv(r)!==wv(t))return!1;for(var n=Rn(r),o=Rn(t),a,c,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 oc),sc(s,p);else if(m=ac(t,p),typeof m>"u"&&!Nh(t,p)||!ke(f,m,e,i)){if(e.strict||!c9(r,t,p,f,e,i))return!1;s||(s=new oc),sc(s,p)}if(s){for(;(c=o.next())&&!c.done;)if(p=c.value[0],m=c.value[1],p&&typeof p=="object"){if(!Iv(s,r,p,m,e,i))return!1}else if(!e.strict&&(!r.has(p)||!ke(ac(r,p),m,e,i))&&!Iv(s,r,p,m,Lv({},e,{strict:!1}),i))return!1;return nc(s)===0}return!0}l(h9,"mapEquiv");function d9(r,t,e,i){var n,o;if(typeof r!=typeof t||r==null||t==null||Mv(r)!==Mv(t)||pv(r)!==pv(t))return!1;var a=hv(r),c=hv(t);if(a!==c)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=mv(r),m=mv(t);if(f!==m||(f||m)&&(r.source!==t.source||cv(r)!==cv(t)))return!1;var y=fv(r),x=fv(t);if(y!==x||(y||x)&&Pv(r)!==Pv(t)||e.strict&&kh&&kh(r)!==kh(t))return!1;var S=Cv(r),M=Cv(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=Ev(r),C=Ev(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=dv(r),T=dv(t);if(I!==T)return!1;if(I||T)return xv(r)!==xv(t)?!1:typeof Uint8Array=="function"&&ke(new Uint8Array(r),new Uint8Array(t),e,i);var w=yv(r),L=yv(t);if(w!==L)return!1;if(w||L)return Sv(r)!==Sv(t)?!1:typeof Uint8Array=="function"&&ke(new Uint8Array(r),new Uint8Array(t),e,i);if(typeof r!=typeof t)return!1;var _=gv(r),R=gv(t);if(_.length!==R.length)return!1;for(_.sort(),R.sort(),n=_.length-1;n>=0;n--)if(_[n]!=R[n])return!1;for(n=_.length-1;n>=0;n--)if(o=_[n],!ke(r[o],t[o],e,i))return!1;var G=bv(r),N=bv(t);return G!==N?!1:G==="Set"||N==="Set"?p9(r,t,e,i):G==="Map"?h9(r,t,e,i):!0}l(d9,"objEquiv");Ov.exports=l(function(t,e,i){return ke(t,e,i,l9())},"deepEqual")});var qv=k(nt=>{"use strict";d();Object.defineProperty(nt,"__esModule",{value:!0});function f9(r){return r&&r.__esModule?r:{default:r}}l(f9,"_interopRequireDefault");var m9=Object.defineProperty,at=l((r,t)=>m9(r,"name",{value:t,configurable:!0}),"__name"),y9=Av(),g9=f9(y9),sa,kv=(sa=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||!oa(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=Rh(t),n=Rh(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(!oa(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 c=this.compareCoord(o[i],a[i]);return this.direction||c?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 oa(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?g9.default.call(void 0,t.properties,e.properties):!0)&&this.compareBBox(t,e)&&this.compare(t.geometry,e.geometry)}compareFeatureCollection(t,e){return oa(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(sa,"_GeojsonEquality"),sa);at(kv,"GeojsonEquality");var v9=kv;function oa(r,t){return r.coordinates?r.coordinates.length===t.coordinates.length:r.length===t.length}l(oa,"sameLength");at(oa,"sameLength");function Rh(r){return r.coordinates.map(t=>({type:r.type.replace("Multi",""),coordinates:t}))}l(Rh,"explode");at(Rh,"explode");var ne=63710088e-1,Fh={centimeters:ne*100,centimetres:ne*100,degrees:360/(2*Math.PI),feet:ne*3.28084,inches:ne*39.37,kilometers:ne/1e3,kilometres:ne/1e3,meters:ne,metres:ne,miles:ne/1609.344,millimeters:ne*1e3,millimetres:ne*1e3,nauticalmiles:ne/1852,radians:1,yards:ne*1.0936},Bh={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 xr(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(xr,"feature");at(xr,"feature");function Nv(r,t,e={}){switch(r){case"Point":return cc(t).geometry;case"LineString":return pc(t).geometry;case"Polygon":return uc(t).geometry;case"MultiPoint":return Vh(t).geometry;case"MultiLineString":return Gh(t).geometry;case"MultiPolygon":return Hh(t).geometry;default:throw new Error(r+" is invalid")}}l(Nv,"geometry");at(Nv,"geometry");function cc(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(!aa(r[0])||!aa(r[1]))throw new Error("coordinates must contain numbers");return xr({type:"Point",coordinates:r},t,e)}l(cc,"point");at(cc,"point");function Rv(r,t,e={}){return la(r.map(i=>cc(i,t)),e)}l(Rv,"points");at(Rv,"points");function uc(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 xr({type:"Polygon",coordinates:r},t,e)}l(uc,"polygon");at(uc,"polygon");function Bv(r,t,e={}){return la(r.map(i=>uc(i,t)),e)}l(Bv,"polygons");at(Bv,"polygons");function pc(r,t,e={}){if(r.length<2)throw new Error("coordinates must be an array of two or more positions");return xr({type:"LineString",coordinates:r},t,e)}l(pc,"lineString");at(pc,"lineString");function Fv(r,t,e={}){return la(r.map(i=>pc(i,t)),e)}l(Fv,"lineStrings");at(Fv,"lineStrings");function la(r,t={}){let e={type:"FeatureCollection"};return t.id&&(e.id=t.id),t.bbox&&(e.bbox=t.bbox),e.features=r,e}l(la,"featureCollection");at(la,"featureCollection");function Gh(r,t,e={}){return xr({type:"MultiLineString",coordinates:r},t,e)}l(Gh,"multiLineString");at(Gh,"multiLineString");function Vh(r,t,e={}){return xr({type:"MultiPoint",coordinates:r},t,e)}l(Vh,"multiPoint");at(Vh,"multiPoint");function Hh(r,t,e={}){return xr({type:"MultiPolygon",coordinates:r},t,e)}l(Hh,"multiPolygon");at(Hh,"multiPolygon");function Gv(r,t,e={}){return xr({type:"GeometryCollection",geometries:r},t,e)}l(Gv,"geometryCollection");at(Gv,"geometryCollection");function Vv(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(Vv,"round");at(Vv,"round");function Xh(r,t="kilometers"){let e=Fh[t];if(!e)throw new Error(t+" units is invalid");return r*e}l(Xh,"radiansToLength");at(Xh,"radiansToLength");function hc(r,t="kilometers"){let e=Fh[t];if(!e)throw new Error(t+" units is invalid");return r/e}l(hc,"lengthToRadians");at(hc,"lengthToRadians");function Hv(r,t){return jh(hc(r,t))}l(Hv,"lengthToDegrees");at(Hv,"lengthToDegrees");function Xv(r){let t=r%360;return t<0&&(t+=360),t}l(Xv,"bearingToAzimuth");at(Xv,"bearingToAzimuth");function jh(r){return r%(2*Math.PI)*180/Math.PI}l(jh,"radiansToDegrees");at(jh,"radiansToDegrees");function jv(r){return r%360*Math.PI/180}l(jv,"degreesToRadians");at(jv,"degreesToRadians");function Wv(r,t="kilometers",e="kilometers"){if(!(r>=0))throw new Error("length must be a positive number");return Xh(hc(r,t),e)}l(Wv,"convertLength");at(Wv,"convertLength");function Yv(r,t="meters",e="kilometers"){if(!(r>=0))throw new Error("area must be a positive number");let i=Bh[t];if(!i)throw new Error("invalid original units");let n=Bh[e];if(!n)throw new Error("invalid final units");return r/i*n}l(Yv,"convertArea");at(Yv,"convertArea");function aa(r){return!isNaN(r)&&r!==null&&!Array.isArray(r)}l(aa,"isNumber");at(aa,"isNumber");function Uv(r){return r!==null&&typeof r=="object"&&!Array.isArray(r)}l(Uv,"isObject");at(Uv,"isObject");function zv(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(!aa(t))throw new Error("bbox must only contain numbers")})}l(zv,"validateBBox");at(zv,"validateBBox");function Zv(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(Zv,"validateId");at(Zv,"validateId");nt.GeojsonEquality=v9;nt.areaFactors=Bh;nt.bearingToAzimuth=Xv;nt.convertArea=Yv;nt.convertLength=Wv;nt.degreesToRadians=jv;nt.earthRadius=ne;nt.factors=Fh;nt.feature=xr;nt.featureCollection=la;nt.geometry=Nv;nt.geometryCollection=Gv;nt.isNumber=aa;nt.isObject=Uv;nt.lengthToDegrees=Hv;nt.lengthToRadians=hc;nt.lineString=pc;nt.lineStrings=Fv;nt.multiLineString=Gh;nt.multiPoint=Vh;nt.multiPolygon=Hh;nt.point=cc;nt.points=Rv;nt.polygon=uc;nt.polygons=Bv;nt.radiansToDegrees=jh;nt.radiansToLength=Xh;nt.round=Vv;nt.validateBBox=zv;nt.validateId=Zv});var a3=k(Lt=>{"use strict";d();Object.defineProperty(Lt,"__esModule",{value:!0});var b9=Object.defineProperty,Gt=l((r,t)=>b9(r,"name",{value:t,configurable:!0}),"__name"),Yt=qv();function Bn(r,t,e){if(r!==null)for(var i,n,o,a,c,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,c=y?p.geometries.length:1;for(var I=0;I<c;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(Bn(a.geometries[i],t,e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}l(Bn,"coordEach");Gt(Bn,"coordEach");function $v(r,t,e,i){var n=e;return Bn(r,function(o,a,c,s,p){a===0&&e===void 0?n=o:n=t(n,o,a,c,s,p)},i),n}l($v,"coordReduce");Gt($v,"coordReduce");function Wh(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(Wh,"propEach");Gt(Wh,"propEach");function Jv(r,t,e){var i=e;return Wh(r,function(n,o){o===0&&e===void 0?i=n:i=t(i,n,o)}),i}l(Jv,"propReduce");Gt(Jv,"propReduce");function Yh(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(Yh,"featureEach");Gt(Yh,"featureEach");function Kv(r,t,e){var i=e;return Yh(r,function(n,o){o===0&&e===void 0?i=n:i=t(i,n,o)}),i}l(Kv,"featureReduce");Gt(Kv,"featureReduce");function Qv(r){var t=[];return Bn(r,function(e){t.push(e)}),t}l(Qv,"coordAll");Gt(Qv,"coordAll");function dc(r,t){var e,i,n,o,a,c,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(c=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=c?c.type==="GeometryCollection":!1,a=s?c.geometries.length:1,n=0;n<a;n++){if(o=s?c.geometries[n]:c,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(dc,"geomEach");Gt(dc,"geomEach");function t3(r,t,e){var i=e;return dc(r,function(n,o,a,c,s){o===0&&e===void 0?i=n:i=t(i,n,o,a,c,s)}),i}l(t3,"geomReduce");Gt(t3,"geomReduce");function ca(r,t){dc(r,function(e,i,n,o,a){var c=e===null?null:e.type;switch(c){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(c){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(ca,"flattenEach");Gt(ca,"flattenEach");function e3(r,t,e){var i=e;return ca(r,function(n,o,a){o===0&&a===0&&e===void 0?i=n:i=t(i,n,o,a)}),i}l(e3,"flattenReduce");Gt(e3,"flattenReduce");function Uh(r,t){ca(r,function(e,i,n){var o=0;if(e.geometry){var a=e.geometry.type;if(!(a==="Point"||a==="MultiPoint")){var c,s=0,p=0,f=0;if(Bn(e,function(m,y,x,S,M){if(c===void 0||i>s||S>p||M>f){c=m,s=i,p=S,f=M,o=0;return}var g=Yt.lineString.call(void 0,[c,m],e.properties);if(t(g,i,n,M,o)===!1)return!1;o++,c=m})===!1)return!1}}})}l(Uh,"segmentEach");Gt(Uh,"segmentEach");function r3(r,t,e){var i=e,n=!1;return Uh(r,function(o,a,c,s,p){n===!1&&e===void 0?i=o:i=t(i,o,a,c,s,p),n=!0}),i}l(r3,"segmentReduce");Gt(r3,"segmentReduce");function zh(r,t){if(!r)throw new Error("geojson is required");ca(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 c=0;c<a.length;c++)if(t(Yt.lineString.call(void 0,a[c],e.properties),i,n,c)===!1)return!1;break}}})}l(zh,"lineEach");Gt(zh,"lineEach");function i3(r,t,e){var i=e;return zh(r,function(n,o,a,c){o===0&&e===void 0?i=n:i=t(i,n,o,a,c)}),i}l(i3,"lineReduce");Gt(i3,"lineReduce");function n3(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,c;switch(r.type){case"FeatureCollection":e<0&&(e=r.features.length+e),a=a||r.features[e].properties,c=r.features[e].geometry;break;case"Feature":a=a||r.properties,c=r.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":c=r;break;default:throw new Error("geojson is invalid")}if(c===null)return null;var s=c.coordinates;switch(c.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(n3,"findSegment");Gt(n3,"findSegment");function o3(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,c;switch(r.type){case"FeatureCollection":e<0&&(e=r.features.length+e),a=a||r.features[e].properties,c=r.features[e].geometry;break;case"Feature":a=a||r.properties,c=r.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":c=r;break;default:throw new Error("geojson is invalid")}if(c===null)return null;var s=c.coordinates;switch(c.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(o3,"findPoint");Gt(o3,"findPoint");Lt.coordAll=Qv;Lt.coordEach=Bn;Lt.coordReduce=$v;Lt.featureEach=Yh;Lt.featureReduce=Kv;Lt.findPoint=o3;Lt.findSegment=n3;Lt.flattenEach=ca;Lt.flattenReduce=e3;Lt.geomEach=dc;Lt.geomReduce=t3;Lt.lineEach=zh;Lt.lineReduce=i3;Lt.propEach=Wh;Lt.propReduce=Jv;Lt.segmentEach=Uh;Lt.segmentReduce=r3});var s3=k(fc=>{"use strict";d();Object.defineProperty(fc,"__esModule",{value:!0});var C9=Object.defineProperty,x9=l((r,t)=>C9(r,"name",{value:t,configurable:!0}),"__name"),S9=a3();function Zh(r,t={}){if(r.bbox!=null&&t.recompute!==!0)return r.bbox;let e=[1/0,1/0,-1/0,-1/0];return S9.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(Zh,"bbox");x9(Zh,"bbox");var P9=Zh;fc.bbox=Zh;fc.default=P9});var h3=k((Z_,qh)=>{d();var tr=ay(),c3=yp(),u3=yy(),Fn=s3().default,M9=u3.featureEach,U_=u3.coordEach,z_=c3.polygon,l3=c3.featureCollection;function p3(r){var t=new tr(r);return t.insert=function(e){if(e.type!=="Feature")throw new Error("invalid feature");return e.bbox=e.bbox?e.bbox:Fn(e),tr.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:Fn(n),i.push(n)}):M9(e,function(n){if(n.type!=="Feature")throw new Error("invalid features");n.bbox=n.bbox?n.bbox:Fn(n),i.push(n)}),tr.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:Fn(e),tr.prototype.remove.call(this,e,i)},t.clear=function(){return tr.prototype.clear.call(this)},t.search=function(e){var i=tr.prototype.search.call(this,this.toBBox(e));return l3(i)},t.collides=function(e){return tr.prototype.collides.call(this,this.toBBox(e))},t.all=function(){var e=tr.prototype.all.call(this);return l3(e)},t.toJSON=function(){return tr.prototype.toJSON.call(this)},t.fromJSON=function(e){return tr.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=Fn(e);else if(e.type==="FeatureCollection")i=Fn(e);else throw new Error("invalid geojson");return{minX:i[0],minY:i[1],maxX:i[2],maxY:i[3]}},t}l(p3,"geojsonRbush");qh.exports=p3;qh.exports.default=p3});var po=k((nf,of)=>{d();var af=l(function(){this._tweens={},this._tweensAddedDuringUpdate={}},"_Group");af.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:lt.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 lt=new af;lt.Group=af;lt._nextId=0;lt.nextId=function(){return lt._nextId++};typeof self>"u"&&typeof b<"u"&&b.hrtime?lt.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?lt.now=self.performance.now.bind(self.performance):Date.now!==void 0?lt.now=Date.now:lt.now=function(){return new Date().getTime()};lt.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=lt.Easing.Linear.None,this._interpolationFunction=lt.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||lt,this._id=lt.nextId()};lt.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"?lt.now()+parseFloat(r):r:lt.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 c=0,s=this._chainedTweens.length;c<s;c++)this._chainedTweens[c].start(this._startTime+this._duration);return!1}return!0}};lt.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-lt.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?lt.Easing.Bounce.In(r*2)*.5:lt.Easing.Bounce.Out(r*2-1)*.5+.5}}};lt.Interpolation={Linear:function(r,t){var e=r.length-1,i=e*t,n=Math.floor(i),o=lt.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=lt.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=lt.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=lt.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,c=n*n,s=n*c;return(2*t-2*e+o+a)*s+(-3*t+3*e-2*o-a)*c+o*n+t}}};(function(r){typeof define=="function"&&define.amd?define([],function(){return lt}):typeof of<"u"&&typeof nf=="object"?of.exports=lt:r!==void 0&&(r.TWEEN=lt)})(nf)});var l4=k((Qa,yo)=>{d();var Dx=200,Hb="__lodash_hash_undefined__",_x=800,Ox=16,Xb=9007199254740991,jb="[object Arguments]",Ax="[object Array]",kx="[object AsyncFunction]",Nx="[object Boolean]",Rx="[object Date]",Bx="[object Error]",Wb="[object Function]",Fx="[object GeneratorFunction]",Gx="[object Map]",Vx="[object Number]",Hx="[object Null]",Yb="[object Object]",Xx="[object Proxy]",jx="[object RegExp]",Wx="[object Set]",Yx="[object String]",Ux="[object Undefined]",zx="[object WeakMap]",Zx="[object ArrayBuffer]",qx="[object DataView]",$x="[object Float32Array]",Jx="[object Float64Array]",Kx="[object Int8Array]",Qx="[object Int16Array]",tS="[object Int32Array]",eS="[object Uint8Array]",rS="[object Uint8ClampedArray]",iS="[object Uint16Array]",nS="[object Uint32Array]",oS=/[\\^$.*+?()[\]{}|]/g,aS=/^\[object .+?Constructor\]$/,sS=/^(?:0|[1-9]\d*)$/,ht={};ht[$x]=ht[Jx]=ht[Kx]=ht[Qx]=ht[tS]=ht[eS]=ht[rS]=ht[iS]=ht[nS]=!0;ht[jb]=ht[Ax]=ht[Zx]=ht[Nx]=ht[qx]=ht[Rx]=ht[Bx]=ht[Wb]=ht[Gx]=ht[Vx]=ht[Yb]=ht[jx]=ht[Wx]=ht[Yx]=ht[zx]=!1;var Ub=typeof global=="object"&&global&&global.Object===Object&&global,lS=typeof self=="object"&&self&&self.Object===Object&&self,rs=Ub||lS||Function("return this")(),zb=typeof Qa=="object"&&Qa&&!Qa.nodeType&&Qa,ts=zb&&typeof yo=="object"&&yo&&!yo.nodeType&&yo,Zb=ts&&ts.exports===zb,Af=Zb&&Ub.process,Ob=function(){try{var r=ts&&ts.require&&ts.require("util").types;return r||Af&&Af.binding&&Af.binding("util")}catch{}}(),Ab=Ob&&Ob.isTypedArray;function qb(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(qb,"apply");function cS(r,t){for(var e=-1,i=Array(r);++e<r;)i[e]=t(e);return i}l(cS,"baseTimes");function uS(r){return function(t){return r(t)}}l(uS,"baseUnary");function pS(r,t){return r==null?void 0:r[t]}l(pS,"getValue");function hS(r,t){return function(e){return r(t(e))}}l(hS,"overArg");var dS=Array.prototype,fS=Function.prototype,tu=Object.prototype,kf=rs["__core-js_shared__"],eu=fS.toString,Ar=tu.hasOwnProperty,kb=function(){var r=/[^.]+$/.exec(kf&&kf.keys&&kf.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""}(),$b=tu.toString,mS=eu.call(Object),yS=RegExp("^"+eu.call(Ar).replace(oS,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Kc=Zb?rs.Buffer:void 0,Nb=rs.Symbol,Rb=rs.Uint8Array,Bb=Kc?Kc.allocUnsafe:void 0,Jb=hS(Object.getPrototypeOf,Object),Fb=Object.create,gS=tu.propertyIsEnumerable,vS=dS.splice,en=Nb?Nb.toStringTag:void 0,Qc=function(){try{var r=Hf(Object,"defineProperty");return r({},"",{}),r}catch{}}(),bS=Kc?Kc.isBuffer:void 0,Gb=Math.max,CS=Date.now,Kb=Hf(rs,"Map"),es=Hf(Object,"create"),xS=function(){function r(){}return l(r,"object"),function(t){if(!Or(t))return{};if(Fb)return Fb(t);r.prototype=t;var e=new r;return r.prototype=void 0,e}}();function rn(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(rn,"Hash");function SS(){this.__data__=es?es(null):{},this.size=0}l(SS,"hashClear");function PS(r){var t=this.has(r)&&delete this.__data__[r];return this.size-=t?1:0,t}l(PS,"hashDelete");function MS(r){var t=this.__data__;if(es){var e=t[r];return e===Hb?void 0:e}return Ar.call(t,r)?t[r]:void 0}l(MS,"hashGet");function wS(r){var t=this.__data__;return es?t[r]!==void 0:Ar.call(t,r)}l(wS,"hashHas");function TS(r,t){var e=this.__data__;return this.size+=this.has(r)?0:1,e[r]=es&&t===void 0?Hb:t,this}l(TS,"hashSet");rn.prototype.clear=SS;rn.prototype.delete=PS;rn.prototype.get=MS;rn.prototype.has=wS;rn.prototype.set=TS;function kr(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(kr,"ListCache");function IS(){this.__data__=[],this.size=0}l(IS,"listCacheClear");function ES(r){var t=this.__data__,e=ru(t,r);if(e<0)return!1;var i=t.length-1;return e==i?t.pop():vS.call(t,e,1),--this.size,!0}l(ES,"listCacheDelete");function LS(r){var t=this.__data__,e=ru(t,r);return e<0?void 0:t[e][1]}l(LS,"listCacheGet");function DS(r){return ru(this.__data__,r)>-1}l(DS,"listCacheHas");function _S(r,t){var e=this.__data__,i=ru(e,r);return i<0?(++this.size,e.push([r,t])):e[i][1]=t,this}l(_S,"listCacheSet");kr.prototype.clear=IS;kr.prototype.delete=ES;kr.prototype.get=LS;kr.prototype.has=DS;kr.prototype.set=_S;function go(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(go,"MapCache");function OS(){this.size=0,this.__data__={hash:new rn,map:new(Kb||kr),string:new rn}}l(OS,"mapCacheClear");function AS(r){var t=nu(this,r).delete(r);return this.size-=t?1:0,t}l(AS,"mapCacheDelete");function kS(r){return nu(this,r).get(r)}l(kS,"mapCacheGet");function NS(r){return nu(this,r).has(r)}l(NS,"mapCacheHas");function RS(r,t){var e=nu(this,r),i=e.size;return e.set(r,t),this.size+=e.size==i?0:1,this}l(RS,"mapCacheSet");go.prototype.clear=OS;go.prototype.delete=AS;go.prototype.get=kS;go.prototype.has=NS;go.prototype.set=RS;function vo(r){var t=this.__data__=new kr(r);this.size=t.size}l(vo,"Stack");function BS(){this.__data__=new kr,this.size=0}l(BS,"stackClear");function FS(r){var t=this.__data__,e=t.delete(r);return this.size=t.size,e}l(FS,"stackDelete");function GS(r){return this.__data__.get(r)}l(GS,"stackGet");function VS(r){return this.__data__.has(r)}l(VS,"stackHas");function HS(r,t){var e=this.__data__;if(e instanceof kr){var i=e.__data__;if(!Kb||i.length<Dx-1)return i.push([r,t]),this.size=++e.size,this;e=this.__data__=new go(i)}return e.set(r,t),this.size=e.size,this}l(HS,"stackSet");vo.prototype.clear=BS;vo.prototype.delete=FS;vo.prototype.get=GS;vo.prototype.has=VS;vo.prototype.set=HS;function XS(r,t){var e=Ff(r),i=!e&&Bf(r),n=!e&&!i&&i4(r),o=!e&&!i&&!n&&o4(r),a=e||i||n||o,c=a?cS(r.length,String):[],s=c.length;for(var p in r)(t||Ar.call(r,p))&&!(a&&(p=="length"||n&&(p=="offset"||p=="parent")||o&&(p=="buffer"||p=="byteLength"||p=="byteOffset")||e4(p,s)))&&c.push(p);return c}l(XS,"arrayLikeKeys");function Nf(r,t,e){(e!==void 0&&!ou(r[t],e)||e===void 0&&!(t in r))&&Gf(r,t,e)}l(Nf,"assignMergeValue");function jS(r,t,e){var i=r[t];(!(Ar.call(r,t)&&ou(i,e))||e===void 0&&!(t in r))&&Gf(r,t,e)}l(jS,"assignValue");function ru(r,t){for(var e=r.length;e--;)if(ou(r[e][0],t))return e;return-1}l(ru,"assocIndexOf");function Gf(r,t,e){t=="__proto__"&&Qc?Qc(r,t,{configurable:!0,enumerable:!0,value:e,writable:!0}):r[t]=e}l(Gf,"baseAssignValue");var WS=rP();function iu(r){return r==null?r===void 0?Ux:Hx:en&&en in Object(r)?iP(r):cP(r)}l(iu,"baseGetTag");function Vb(r){return is(r)&&iu(r)==jb}l(Vb,"baseIsArguments");function YS(r){if(!Or(r)||sP(r))return!1;var t=jf(r)?yS:aS;return t.test(dP(r))}l(YS,"baseIsNative");function US(r){return is(r)&&n4(r.length)&&!!ht[iu(r)]}l(US,"baseIsTypedArray");function zS(r){if(!Or(r))return lP(r);var t=r4(r),e=[];for(var i in r)i=="constructor"&&(t||!Ar.call(r,i))||e.push(i);return e}l(zS,"baseKeysIn");function Vf(r,t,e,i,n){r!==t&&WS(t,function(o,a){if(n||(n=new vo),Or(o))ZS(r,t,a,e,Vf,i,n);else{var c=i?i(Rf(r,a),o,a+"",r,t,n):void 0;c===void 0&&(c=o),Nf(r,a,c)}},a4)}l(Vf,"baseMerge");function ZS(r,t,e,i,n,o,a){var c=Rf(r,e),s=Rf(t,e),p=a.get(s);if(p){Nf(r,e,p);return}var f=o?o(c,s,e+"",r,t,a):void 0,m=f===void 0;if(m){var y=Ff(s),x=!y&&i4(s),S=!y&&!x&&o4(s);f=s,y||x||S?Ff(c)?f=c:fP(c)?f=QS(c):x?(m=!1,f=$S(s,!0)):S?(m=!1,f=KS(s,!0)):f=[]:mP(s)||Bf(s)?(f=c,Bf(c)?f=yP(c):(!Or(c)||jf(c))&&(f=nP(s))):m=!1}m&&(a.set(s,f),n(f,s,i,o,a),a.delete(s)),Nf(r,e,f)}l(ZS,"baseMergeDeep");function Qb(r,t){return pP(uP(r,t,s4),r+"")}l(Qb,"baseRest");var qS=Qc?function(r,t){return Qc(r,"toString",{configurable:!0,enumerable:!1,value:bP(t),writable:!0})}:s4;function $S(r,t){if(t)return r.slice();var e=r.length,i=Bb?Bb(e):new r.constructor(e);return r.copy(i),i}l($S,"cloneBuffer");function JS(r){var t=new r.constructor(r.byteLength);return new Rb(t).set(new Rb(r)),t}l(JS,"cloneArrayBuffer");function KS(r,t){var e=t?JS(r.buffer):r.buffer;return new r.constructor(e,r.byteOffset,r.length)}l(KS,"cloneTypedArray");function QS(r,t){var e=-1,i=r.length;for(t||(t=Array(i));++e<i;)t[e]=r[e];return t}l(QS,"copyArray");function tP(r,t,e,i){var n=!e;e||(e={});for(var o=-1,a=t.length;++o<a;){var c=t[o],s=i?i(e[c],r[c],c,e,r):void 0;s===void 0&&(s=r[c]),n?Gf(e,c,s):jS(e,c,s)}return e}l(tP,"copyObject");function eP(r){return Qb(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&&oP(e[0],e[1],a)&&(o=n<3?void 0:o,n=1),t=Object(t);++i<n;){var c=e[i];c&&r(t,c,i,o)}return t})}l(eP,"createAssigner");function rP(r){return function(t,e,i){for(var n=-1,o=Object(t),a=i(t),c=a.length;c--;){var s=a[r?c:++n];if(e(o[s],s,o)===!1)break}return t}}l(rP,"createBaseFor");function t4(r,t,e,i,n,o){return Or(r)&&Or(t)&&(o.set(t,r),Vf(r,t,void 0,t4,o),o.delete(t)),r}l(t4,"customDefaultsMerge");function nu(r,t){var e=r.__data__;return aP(t)?e[typeof t=="string"?"string":"hash"]:e.map}l(nu,"getMapData");function Hf(r,t){var e=pS(r,t);return YS(e)?e:void 0}l(Hf,"getNative");function iP(r){var t=Ar.call(r,en),e=r[en];try{r[en]=void 0;var i=!0}catch{}var n=$b.call(r);return i&&(t?r[en]=e:delete r[en]),n}l(iP,"getRawTag");function nP(r){return typeof r.constructor=="function"&&!r4(r)?xS(Jb(r)):{}}l(nP,"initCloneObject");function e4(r,t){var e=typeof r;return t=t==null?Xb:t,!!t&&(e=="number"||e!="symbol"&&sS.test(r))&&r>-1&&r%1==0&&r<t}l(e4,"isIndex");function oP(r,t,e){if(!Or(e))return!1;var i=typeof t;return(i=="number"?Xf(e)&&e4(t,e.length):i=="string"&&t in e)?ou(e[t],r):!1}l(oP,"isIterateeCall");function aP(r){var t=typeof r;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?r!=="__proto__":r===null}l(aP,"isKeyable");function sP(r){return!!kb&&kb in r}l(sP,"isMasked");function r4(r){var t=r&&r.constructor,e=typeof t=="function"&&t.prototype||tu;return r===e}l(r4,"isPrototype");function lP(r){var t=[];if(r!=null)for(var e in Object(r))t.push(e);return t}l(lP,"nativeKeysIn");function cP(r){return $b.call(r)}l(cP,"objectToString");function uP(r,t,e){return t=Gb(t===void 0?r.length-1:t,0),function(){for(var i=arguments,n=-1,o=Gb(i.length-t,0),a=Array(o);++n<o;)a[n]=i[t+n];n=-1;for(var c=Array(t+1);++n<t;)c[n]=i[n];return c[t]=e(a),qb(r,this,c)}}l(uP,"overRest");function Rf(r,t){if(!(t==="constructor"&&typeof r[t]=="function")&&t!="__proto__")return r[t]}l(Rf,"safeGet");var pP=hP(qS);function hP(r){var t=0,e=0;return function(){var i=CS(),n=Ox-(i-e);if(e=i,n>0){if(++t>=_x)return arguments[0]}else t=0;return r.apply(void 0,arguments)}}l(hP,"shortOut");function dP(r){if(r!=null){try{return eu.call(r)}catch{}try{return r+""}catch{}}return""}l(dP,"toSource");function ou(r,t){return r===t||r!==r&&t!==t}l(ou,"eq");var Bf=Vb(function(){return arguments}())?Vb:function(r){return is(r)&&Ar.call(r,"callee")&&!gS.call(r,"callee")},Ff=Array.isArray;function Xf(r){return r!=null&&n4(r.length)&&!jf(r)}l(Xf,"isArrayLike");function fP(r){return is(r)&&Xf(r)}l(fP,"isArrayLikeObject");var i4=bS||CP;function jf(r){if(!Or(r))return!1;var t=iu(r);return t==Wb||t==Fx||t==kx||t==Xx}l(jf,"isFunction");function n4(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=Xb}l(n4,"isLength");function Or(r){var t=typeof r;return r!=null&&(t=="object"||t=="function")}l(Or,"isObject");function is(r){return r!=null&&typeof r=="object"}l(is,"isObjectLike");function mP(r){if(!is(r)||iu(r)!=Yb)return!1;var t=Jb(r);if(t===null)return!0;var e=Ar.call(t,"constructor")&&t.constructor;return typeof e=="function"&&e instanceof e&&eu.call(e)==mS}l(mP,"isPlainObject");var o4=Ab?uS(Ab):US;function yP(r){return tP(r,a4(r))}l(yP,"toPlainObject");var gP=Qb(function(r){return r.push(void 0,t4),qb(vP,void 0,r)});function a4(r){return Xf(r)?XS(r,!0):zS(r)}l(a4,"keysIn");var vP=eP(function(r,t,e,i){Vf(r,t,e,i)});function bP(r){return function(){return r}}l(bP,"constant");function s4(r){return r}l(s4,"identity");function CP(){return!1}l(CP,"stubFalse");yo.exports=gP});var X4=k((Bj,ps)=>{"use strict";d();var GP=!1,ln=!1,N4=!0,R4=!1,h={},B4=!1;typeof ps<"u"&&ps.exports?(ps.exports=h,B4=!0):typeof document<"u"?window.ClipperLib=h:self.ClipperLib=h;var gu;B4?(At="chrome",gu="Netscape"):(At=navigator.userAgent.toString().toLowerCase(),gu=navigator.appName);var At,q={};At.indexOf("chrome")!=-1&&At.indexOf("chromium")==-1?q.chrome=1:q.chrome=0;At.indexOf("chromium")!=-1?q.chromium=1:q.chromium=0;At.indexOf("safari")!=-1&&At.indexOf("chrome")==-1&&At.indexOf("chromium")==-1?q.safari=1:q.safari=0;At.indexOf("firefox")!=-1?q.firefox=1:q.firefox=0;At.indexOf("firefox/17")!=-1?q.firefox17=1:q.firefox17=0;At.indexOf("firefox/15")!=-1?q.firefox15=1:q.firefox15=0;At.indexOf("firefox/3")!=-1?q.firefox3=1:q.firefox3=0;At.indexOf("opera")!=-1?q.opera=1:q.opera=0;At.indexOf("msie 10")!=-1?q.msie10=1:q.msie10=0;At.indexOf("msie 9")!=-1?q.msie9=1:q.msie9=0;At.indexOf("msie 8")!=-1?q.msie8=1:q.msie8=0;At.indexOf("msie 7")!=-1?q.msie7=1:q.msie7=0;At.indexOf("msie ")!=-1?q.msie=1:q.msie=0;h.biginteger_used=null;var fi,VP=0xdeadbeefcafe,A4=(VP&16777215)==15715070;function A(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(A,"BigInteger");function K(){return new A(null)}l(K,"nbi");function HP(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(HP,"am1");function XP(r,t,e,i,n,o){for(var a=t&32767,c=t>>15;--o>=0;){var s=this[r]&32767,p=this[r++]>>15,f=c*s+p*a;s=a*s+((f&32767)<<15)+e[i]+(n&1073741823),n=(s>>>30)+(f>>>15)+c*p+(n>>>30),e[i++]=s&1073741823}return n}l(XP,"am2");function jP(r,t,e,i,n,o){for(var a=t&16383,c=t>>14;--o>=0;){var s=this[r]&16383,p=this[r++]>>14,f=c*s+p*a;s=a*s+((f&16383)<<14)+e[i]+n,n=(s>>28)+(f>>14)+c*p,e[i++]=s&268435455}return n}l(jP,"am3");A4&&gu=="Microsoft Internet Explorer"?(A.prototype.am=XP,fi=30):A4&&gu!="Netscape"?(A.prototype.am=HP,fi=26):(A.prototype.am=jP,fi=28);A.prototype.DB=fi;A.prototype.DM=(1<<fi)-1;A.prototype.DV=1<<fi;var am=52;A.prototype.FV=Math.pow(2,am);A.prototype.F1=am-fi;A.prototype.F2=2*fi-am;var WP="0123456789abcdefghijklmnopqrstuvwxyz",bu=new Array,Po,we;Po=48;for(we=0;we<=9;++we)bu[Po++]=we;Po=97;for(we=10;we<36;++we)bu[Po++]=we;Po=65;for(we=10;we<36;++we)bu[Po++]=we;function k4(r){return WP.charAt(r)}l(k4,"int2char");function F4(r,t){var e=bu[r.charCodeAt(t)];return e==null?-1:e}l(F4,"intAt");function YP(r){for(var t=this.t-1;t>=0;--t)r[t]=this[t];r.t=this.t,r.s=this.s}l(YP,"bnpCopyTo");function UP(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(UP,"bnpFromInt");function di(r){var t=K();return t.fromInt(r),t}l(di,"nbv");function zP(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:F4(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&&A.ZERO.subTo(this,this)}l(zP,"bnpFromString");function ZP(){for(var r=this.s&this.DM;this.t>0&&this[this.t-1]==r;)--this.t}l(ZP,"bnpClamp");function qP(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,c=this.DB-a*this.DB%t;if(a-- >0)for(c<this.DB&&(i=this[a]>>c)>0&&(n=!0,o=k4(i));a>=0;)c<t?(i=(this[a]&(1<<c)-1)<<t-c,i|=this[--a]>>(c+=this.DB-t)):(i=this[a]>>(c-=t)&e,c<=0&&(c+=this.DB,--a)),i>0&&(n=!0),n&&(o+=k4(i));return n?o:"0"}l(qP,"bnToString");function $P(){var r=K();return A.ZERO.subTo(this,r),r}l($P,"bnNegate");function JP(){return this.s<0?this.negate():this}l(JP,"bnAbs");function KP(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(KP,"bnCompareTo");function Cu(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(Cu,"nbits");function QP(){return this.t<=0?0:this.DB*(this.t-1)+Cu(this[this.t-1]^this.s&this.DM)}l(QP,"bnBitLength");function tM(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(tM,"bnpDLShiftTo");function eM(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(eM,"bnpDRShiftTo");function rM(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,c;for(c=this.t-1;c>=0;--c)t[c+o+1]=this[c]>>i|a,a=(this[c]&n)<<e;for(c=o-1;c>=0;--c)t[c]=0;t[o]=a,t.t=this.t+o+1,t.s=this.s,t.clamp()}l(rM,"bnpLShiftTo");function iM(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(iM,"bnpRShiftTo");function nM(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(nM,"bnpSubTo");function oM(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&&A.ZERO.subTo(t,t)}l(oM,"bnpMultiplyTo");function aM(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(aM,"bnpSquareTo");function sM(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,c=r.s,s=this.DB-Cu(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)),A.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!=c&&A.ZERO.subTo(t,t)),e.t=p,e.clamp(),s>0&&e.rShiftTo(s,e),a<0&&A.ZERO.subTo(e,e)}}}l(sM,"bnpDivRemTo");function lM(r){var t=K();return this.abs().divRemTo(r,null,t),this.s<0&&t.compareTo(A.ZERO)>0&&r.subTo(t,t),t}l(lM,"bnMod");function cn(r){this.m=r}l(cn,"Classic");function cM(r){return r.s<0||r.compareTo(this.m)>=0?r.mod(this.m):r}l(cM,"cConvert");function uM(r){return r}l(uM,"cRevert");function pM(r){r.divRemTo(this.m,null,r)}l(pM,"cReduce");function hM(r,t,e){r.multiplyTo(t,e),this.reduce(e)}l(hM,"cMulTo");function dM(r,t){r.squareTo(t),this.reduce(t)}l(dM,"cSqrTo");cn.prototype.convert=cM;cn.prototype.revert=uM;cn.prototype.reduce=pM;cn.prototype.mulTo=hM;cn.prototype.sqrTo=dM;function fM(){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(fM,"bnpInvDigit");function un(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(un,"Montgomery");function mM(r){var t=K();return r.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),r.s<0&&t.compareTo(A.ZERO)>0&&this.m.subTo(t,t),t}l(mM,"montConvert");function yM(r){var t=K();return r.copyTo(t),this.reduce(t),t}l(yM,"montRevert");function gM(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(gM,"montReduce");function vM(r,t){r.squareTo(t),this.reduce(t)}l(vM,"montSqrTo");function bM(r,t,e){r.multiplyTo(t,e),this.reduce(e)}l(bM,"montMulTo");un.prototype.convert=mM;un.prototype.revert=yM;un.prototype.reduce=gM;un.prototype.mulTo=bM;un.prototype.sqrTo=vM;function CM(){return(this.t>0?this[0]&1:this.s)==0}l(CM,"bnpIsEven");function xM(r,t){if(r>4294967295||r<1)return A.ONE;var e=K(),i=K(),n=t.convert(this),o=Cu(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(xM,"bnpExp");function SM(r,t){var e;return r<256||t.isEven()?e=new cn(t):e=new un(t),this.exp(r,e)}l(SM,"bnModPowInt");A.prototype.copyTo=YP;A.prototype.fromInt=UP;A.prototype.fromString=zP;A.prototype.clamp=ZP;A.prototype.dlShiftTo=tM;A.prototype.drShiftTo=eM;A.prototype.lShiftTo=rM;A.prototype.rShiftTo=iM;A.prototype.subTo=nM;A.prototype.multiplyTo=oM;A.prototype.squareTo=aM;A.prototype.divRemTo=sM;A.prototype.invDigit=fM;A.prototype.isEven=CM;A.prototype.exp=xM;A.prototype.toString=qP;A.prototype.negate=$P;A.prototype.abs=JP;A.prototype.compareTo=KP;A.prototype.bitLength=QP;A.prototype.mod=lM;A.prototype.modPowInt=SM;A.ZERO=di(0);A.ONE=di(1);function PM(){var r=K();return this.copyTo(r),r}l(PM,"bnClone");function MM(){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(MM,"bnIntValue");function wM(){return this.t==0?this.s:this[0]<<24>>24}l(wM,"bnByteValue");function TM(){return this.t==0?this.s:this[0]<<16>>16}l(TM,"bnShortValue");function IM(r){return Math.floor(Math.LN2*this.DB/Math.log(r))}l(IM,"bnpChunkSize");function EM(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1}l(EM,"bnSigNum");function LM(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=di(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(LM,"bnpToRadix");function DM(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,c=0;c<r.length;++c){var s=F4(r,c);if(s<0){r.charAt(c)=="-"&&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&&A.ZERO.subTo(this,this)}l(DM,"bnpFromRadix");function _M(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(A.ONE.shiftLeft(r-1),sm,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>r&&this.subTo(A.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(_M,"bnpFromNumber");function OM(){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(OM,"bnToByteArray");function AM(r){return this.compareTo(r)==0}l(AM,"bnEquals");function kM(r){return this.compareTo(r)<0?this:r}l(kM,"bnMin");function NM(r){return this.compareTo(r)>0?this:r}l(NM,"bnMax");function RM(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(RM,"bnpBitwiseTo");function BM(r,t){return r&t}l(BM,"op_and");function FM(r){var t=K();return this.bitwiseTo(r,BM,t),t}l(FM,"bnAnd");function sm(r,t){return r|t}l(sm,"op_or");function GM(r){var t=K();return this.bitwiseTo(r,sm,t),t}l(GM,"bnOr");function G4(r,t){return r^t}l(G4,"op_xor");function VM(r){var t=K();return this.bitwiseTo(r,G4,t),t}l(VM,"bnXor");function V4(r,t){return r&~t}l(V4,"op_andnot");function HM(r){var t=K();return this.bitwiseTo(r,V4,t),t}l(HM,"bnAndNot");function XM(){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(XM,"bnNot");function jM(r){var t=K();return r<0?this.rShiftTo(-r,t):this.lShiftTo(r,t),t}l(jM,"bnShiftLeft");function WM(r){var t=K();return r<0?this.lShiftTo(-r,t):this.rShiftTo(r,t),t}l(WM,"bnShiftRight");function YM(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(YM,"lbit");function UM(){for(var r=0;r<this.t;++r)if(this[r]!=0)return r*this.DB+YM(this[r]);return this.s<0?this.t*this.DB:-1}l(UM,"bnGetLowestSetBit");function zM(r){for(var t=0;r!=0;)r&=r-1,++t;return t}l(zM,"cbit");function ZM(){for(var r=0,t=this.s&this.DM,e=0;e<this.t;++e)r+=zM(this[e]^t);return r}l(ZM,"bnBitCount");function qM(r){var t=Math.floor(r/this.DB);return t>=this.t?this.s!=0:(this[t]&1<<r%this.DB)!=0}l(qM,"bnTestBit");function $M(r,t){var e=A.ONE.shiftLeft(r);return this.bitwiseTo(e,t,e),e}l($M,"bnpChangeBit");function JM(r){return this.changeBit(r,sm)}l(JM,"bnSetBit");function KM(r){return this.changeBit(r,V4)}l(KM,"bnClearBit");function QM(r){return this.changeBit(r,G4)}l(QM,"bnFlipBit");function tw(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(tw,"bnpAddTo");function ew(r){var t=K();return this.addTo(r,t),t}l(ew,"bnAdd");function rw(r){var t=K();return this.subTo(r,t),t}l(rw,"bnSubtract");function iw(r){var t=K();return this.multiplyTo(r,t),t}l(iw,"bnMultiply");function nw(){var r=K();return this.squareTo(r),r}l(nw,"bnSquare");function ow(r){var t=K();return this.divRemTo(r,t,null),t}l(ow,"bnDivide");function aw(r){var t=K();return this.divRemTo(r,null,t),t}l(aw,"bnRemainder");function sw(r){var t=K(),e=K();return this.divRemTo(r,t,e),new Array(t,e)}l(sw,"bnDivideAndRemainder");function lw(r){this[this.t]=this.am(0,r-1,this,0,0,this.t),++this.t,this.clamp()}l(lw,"bnpDMultiply");function cw(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(cw,"bnpDAddOffset");function hs(){}l(hs,"NullExp");function H4(r){return r}l(H4,"nNop");function uw(r,t,e){r.multiplyTo(t,e)}l(uw,"nMulTo");function pw(r,t){r.squareTo(t)}l(pw,"nSqrTo");hs.prototype.convert=H4;hs.prototype.revert=H4;hs.prototype.mulTo=uw;hs.prototype.sqrTo=pw;function hw(r){return this.exp(r,new hs)}l(hw,"bnPow");function dw(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(dw,"bnpMultiplyLowerTo");function fw(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(fw,"bnpMultiplyUpperTo");function Mo(r){this.r2=K(),this.q3=K(),A.ONE.dlShiftTo(2*r.t,this.r2),this.mu=this.r2.divide(r),this.m=r}l(Mo,"Barrett");function mw(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(mw,"barrettConvert");function yw(r){return r}l(yw,"barrettRevert");function gw(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(gw,"barrettReduce");function vw(r,t){r.squareTo(t),this.reduce(t)}l(vw,"barrettSqrTo");function bw(r,t,e){r.multiplyTo(t,e),this.reduce(e)}l(bw,"barrettMulTo");Mo.prototype.convert=mw;Mo.prototype.revert=yw;Mo.prototype.reduce=gw;Mo.prototype.mulTo=bw;Mo.prototype.sqrTo=vw;function Cw(r,t){var e=r.bitLength(),i,n=di(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 cn(t):t.isEven()?o=new Mo(t):o=new un(t);var a=new Array,c=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);c<=p;)a[c]=K(),o.mulTo(f,a[c-2],a[c]),c+=2}var m=r.t-1,y,x=!0,S=K(),M;for(e=Cu(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)),c=i;!(y&1);)y>>=1,--c;if((e-=c)<0&&(e+=this.DB,--m),x)a[y].copyTo(n),x=!1;else{for(;c>1;)o.sqrTo(n,S),o.sqrTo(S,n),c-=2;c>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(Cw,"bnModPow");function xw(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(xw,"bnGCD");function Sw(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(Sw,"bnpModInt");function Pw(r){var t=r.isEven();if(this.isEven()&&t||r.signum()==0)return A.ZERO;for(var e=r.clone(),i=this.clone(),n=di(1),o=di(0),a=di(0),c=di(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()||!c.isEven())&&(a.addTo(this,a),c.subTo(r,c)),a.rShiftTo(1,a)):c.isEven()||c.subTo(r,c),c.rShiftTo(1,c);e.compareTo(i)>=0?(e.subTo(i,e),t&&n.subTo(a,n),o.subTo(c,o)):(i.subTo(e,i),t&&a.subTo(n,a),c.subTo(o,c))}if(i.compareTo(A.ONE)!=0)return A.ZERO;if(c.compareTo(r)>=0)return c.subtract(r);if(c.signum()<0)c.addTo(r,c);else return c;return c.signum()<0?c.add(r):c}l(Pw,"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],Mw=(1<<26)/Kt[Kt.length-1];function ww(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<Mw;)i*=Kt[n++];for(i=e.modInt(i);t<n;)if(i%Kt[t++]==0)return!1}return e.millerRabin(r)}l(ww,"bnIsProbablePrime");function Tw(r){var t=this.subtract(A.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(A.ONE)!=0&&a.compareTo(t)!=0){for(var c=1;c++<e&&a.compareTo(t)!=0;)if(a=a.modPowInt(2,this),a.compareTo(A.ONE)==0)return!1;if(a.compareTo(t)!=0)return!1}}return!0}l(Tw,"bnpMillerRabin");A.prototype.chunkSize=IM;A.prototype.toRadix=LM;A.prototype.fromRadix=DM;A.prototype.fromNumber=_M;A.prototype.bitwiseTo=RM;A.prototype.changeBit=$M;A.prototype.addTo=tw;A.prototype.dMultiply=lw;A.prototype.dAddOffset=cw;A.prototype.multiplyLowerTo=dw;A.prototype.multiplyUpperTo=fw;A.prototype.modInt=Sw;A.prototype.millerRabin=Tw;A.prototype.clone=PM;A.prototype.intValue=MM;A.prototype.byteValue=wM;A.prototype.shortValue=TM;A.prototype.signum=EM;A.prototype.toByteArray=OM;A.prototype.equals=AM;A.prototype.min=kM;A.prototype.max=NM;A.prototype.and=FM;A.prototype.or=GM;A.prototype.xor=VM;A.prototype.andNot=HM;A.prototype.not=XM;A.prototype.shiftLeft=jM;A.prototype.shiftRight=WM;A.prototype.getLowestSetBit=UM;A.prototype.bitCount=ZM;A.prototype.testBit=qM;A.prototype.setBit=JM;A.prototype.clearBit=KM;A.prototype.flipBit=QM;A.prototype.add=ew;A.prototype.subtract=rw;A.prototype.multiply=iw;A.prototype.divide=ow;A.prototype.remainder=aw;A.prototype.divideAndRemainder=sw;A.prototype.modPow=Cw;A.prototype.modInverse=Pw;A.prototype.pow=hw;A.prototype.gcd=xw;A.prototype.isProbablePrime=ww;A.prototype.square=nw;var Z=A;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 vu>"u"&&(vu=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 vu;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};vu(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)};q.msie||q.opera||q.safari?h.Cast_Int32=function(r){return r|0}:h.Cast_Int32=function(r){return~~r};q.chrome?h.Cast_Int64=function(r){return r<-2147483648||r>2147483647?r<0?Math.ceil(r):Math.floor(r):~~r}:q.firefox&&typeof Number.toInteger=="function"?h.Cast_Int64=function(r){return Number.toInteger(r)}:q.msie7||q.msie8?h.Cast_Int64=function(r){return parseInt(r,10)}:q.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,ln)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};ln?(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};R4&&(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;GP?(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,c,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],c=r[3],s=r[4],s?Z.op_Equality(Z.Int128Mul(n.Y-o.Y,a.X-c.X),Z.Int128Mul(n.X-o.X,a.Y-c.Y)):h.Cast_Int64((n.Y-o.Y)*(a.X-c.X))-h.Cast_Int64((n.X-o.X)*(a.Y-c.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){N4?!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 c={Value:this.m_UseFullRange};this.RangeTest(r[0],c),this.m_UseFullRange=c.Value,c.Value=this.m_UseFullRange,this.RangeTest(r[i],c),this.m_UseFullRange=c.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)c.Value=this.m_UseFullRange,this.RangeTest(r[o],c),this.m_UseFullRange=c.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,ln&&(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,ln&&(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 c=this.ExecuteInternal();c&&this.BuildResult(n)}finally{this.DisposeAllPolyPts(),this.m_ExecuteLocked=!1}return c}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 c=this.ExecuteInternal();c&&this.BuildResult2(s)}finally{this.DisposeAllPolyPts(),this.m_ExecuteLocked=!1}return c}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)};ln&&(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 c=this.AddOutPt(t.PrevInAEL,t.Bot);this.AddJoin(i,c,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 c=this.AddOutPt(e.PrevInAEL,e.Bot);this.AddJoin(i,c,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),ln&&(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),ln&&(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,c=i.Pts,s=c.Prev,p;r.Side==h.EdgeSide.esLeft?(t.Side==h.EdgeSide.esLeft?(this.ReversePolyPtLinks(c),c.Next=o,o.Prev=c,a.Next=s,s.Prev=a,e.Pts=s):(s.Next=o,o.Prev=s,c.Prev=a,a.Next=c,e.Pts=c),p=h.EdgeSide.esLeft):(t.Side==h.EdgeSide.esRight?(this.ReversePolyPtLinks(c),a.Next=s,s.Prev=a,c.Next=o,o.Prev=c):(a.Next=c,c.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,c=t.OutIdx>=0;if(N4&&(r.WindDelta===0||t.WindDelta===0)){r.WindDelta===0&&t.WindDelta===0?(n||o)&&a&&c&&this.AddLocalMaxPoly(r,t,e):r.PolyTyp==t.PolyTyp&&r.WindDelta!=t.WindDelta&&this.m_ClipType==h.ClipType.ctUnion?r.WindDelta===0?c&&(this.AddOutPt(r,e),a&&(r.OutIdx=-1)):a&&(this.AddOutPt(t,e),c&&(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),c&&(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&&c)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(c)(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,c=null;a.NextInLML!==null&&h.ClipperBase.IsHorizontal(a.NextInLML);)a=a.NextInLML;for(a.NextInLML===null&&(c=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==c&&s){i==h.Direction.dLeftToRight?this.IntersectEdges(r,p,p.Top,!1):this.IntersectEdges(p,r,p.Top,!1),c.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 c!==null?c.OutIdx>=0?(i==h.Direction.dLeftToRight?this.IntersectEdges(r,c,r.Top,!1):this.IntersectEdges(c,r,r.Top,!1),c.OutIdx>=0&&h.Error("ProcessHorizontal error")):(this.DeleteFromAEL(r),this.DeleteFromAEL(c)):(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 Iw=l(function(r){return r<0?Math.ceil(r-.5):Math.round(r)},"R1"),Ew=l(function(r){return r<0?Math.ceil(r-.5):Math.floor(r+.5)},"R2"),Lw=l(function(r){return r<0?-Math.round(Math.abs(r)):Math.round(r)},"R3"),Dw=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");q.msie?h.Clipper.Round=Iw:q.chromium?h.Clipper.Round=Lw:q.safari?h.Clipper.Round=Dw:h.Clipper.Round=Ew;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,c=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(c!==null&&c.Curr.X==t.Bot.X&&c.Curr.Y==t.Bot.Y&&o!==null&&c.OutIdx>=0&&c.Curr.Y>c.Top.Y&&h.ClipperBase.SlopesEqual(t,c,this.m_UseFullRange)&&t.WindDelta!==0&&c.WindDelta!==0){var a=this.AddOutPt(c,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),c=0;c<o;c++)a[c]=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,c=0;c<n;c++)o.m_polygon[c]=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,c=e.Pt.X>i.Pt.X?h.Direction.dRightToLeft:h.Direction.dLeftToRight;if(a==c)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(c==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,c=r.OutPt1.Pt.Y==r.OffPt.Y;if(c&&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(c){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 c=(n.X-r.X)*(a.Y-r.Y)-(a.X-r.X)*(n.Y-r.Y);if(c==0)return-1;c>0==a.Y>n.Y&&(e=1-e)}else if(a.X>r.X){var c=(n.X-r.X)*(a.Y-r.Y)-(a.X-r.X)*(n.Y-r.Y);if(c==0)return-1;c>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,c=t.Next.Pt.Y;if(c==r.Y&&(a==r.X||o==r.Y&&a>r.X==n<r.X))return-1;if(o<r.Y!=c<r.Y){if(n>=r.X)if(a>r.X)e=1-e;else{var s=(n-r.X)*(c-r.Y)-(a-r.X)*(o-r.Y);if(s==0)return-1;s>0==c>o&&(e=1-e)}else if(a>r.X){var s=(n-r.X)*(c-r.Y)-(a-r.X)*(o-r.Y);if(s==0)return-1;s>0==c>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,c=this.m_PolyOuts.length;a<c-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};R4&&(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 c=new Array(e),n=0;n<e;++n)c[n]=new h.IntPoint(a.Pt),a=a.Next;return i=null,c};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,c=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);c.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);c.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(c[s%a][f%o]),S.push(c[(s+1)%a][f%o]),S.push(c[(s+1)%a][(f+1)%o]),S.push(c[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,c,h.PolyFillType.pftNonZero,h.PolyFillType.pftNonZero),c};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],c=new h.Clipper,s,p=0,f=o.length;p<f;++p){var s=h.Clipper.Minkowski(e,o[p],!0,n);c.AddPaths(s,h.PolyType.ptSubject,!0)}n&&c.AddPaths(o,h.PolyType.ptClip,!0);var m=new h.Paths;return c.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,c=o[n];n<a;n++,c=o[n])h.Clipper.AddPolyNodeToPaths(c,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};vu(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,c=1;c<=i;c++)h.IntPoint.op_Inequality(n.m_polygon[o],r[c])&&(o++,n.m_polygon.push(r[c]),(r[c].Y>n.m_polygon[a].Y||r[c].Y==n.m_polygon[a].Y&&r[c].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,c=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+c*r)));var p=a;a=a*this.m_cos-this.m_sin*c,c=p*this.m_sin+c*this.m_cos}else for(var a=-1,c=-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+c*r))),a<0?a=1:c<0?c=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 c=e.Childs()[0];e.Childs()[0]=c.Childs()[0];for(var s=1;s<c.ChildCount();s++)e.AddChild(c.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,c=0;c<i;++c)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,c,s,p,f,m,y=[],x=0;x<n;x++)if(a=i[x],o=a.length,o!==0){if(o<3){c=a,y.push(c);continue}for(c=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||(c[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&&c.splice(f,o-f),c.length&&y.push(c)}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,c=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};c[n]=a}return t||(c=c[0]),c};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,c,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],c=n.length,c!=0){for(o=0;o<1e6;o++){for(a=[],c=n.length,n[c-1].X!=n[0].X||n[c-1].Y!=n[0].Y?(x=1,n.push({X:n[0].X,Y:n[0].Y}),c=n.length):x=0,y=[],i=0;i<c-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<c-1;i++)y[i]||a.push({X:n[i].X,Y:n[i].Y});if(a.push({X:n[c-1].X,Y:n[c-1].Y}),x&&n.pop(),y.length)n=a;else break}c=a.length,a[c-1].X==a[0].X&&a[c-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,c=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],c=o.X,s=o.Y,a=r[m-1],p=a.X,f=a.Y,n+=i((c-p)*(c-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,c,s,p,f;for(c=0;c<n;c++)for(o=i[c],e.holes[c]=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};ps.exports=h});d();d();var ul=new WeakMap,Xt,np=class np{constructor(t){P(this,Xt,void 0);E(this,Xt,t),ul.set(this,t)}get mapName(){return u(this,Xt).mapName}get mapCenter(){return u(this,Xt).mapCenter}get organizationId(){return u(this,Xt).organizationId}get outdoorViewToken(){return u(this,Xt).outdoorViewToken}getByType(t){switch(t){case"space":return u(this,Xt).spaces;case"door":return u(this,Xt).doors;case"floor":return u(this,Xt).floors;case"connection":return u(this,Xt).connections;case"object":return u(this,Xt).objects;case"point-of-interest":return u(this,Xt).pointsOfInterest;case"annotation":return u(this,Xt).annotations;default:return[]}}getById(t,e){return u(this,Xt).getById(t,e)}};Xt=new WeakMap,l(np,"MapData");var ip=np,pl=ip;d();d();d();var j1=(n=>(n[n.LOG=0]="LOG",n[n.WARN=1]="WARN",n[n.ERROR=2]="ERROR",n[n.SILENT=3]="SILENT",n))(j1||{});function G5(r){0<=r&&r<=3&&(W1.logState=r)}l(G5,"setLoggerLevel");var W1={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)}},B=W1;var Y1=globalThis.fetch,U1,V5=(U1=b==null?void 0:b.env)==null?void 0:U1.npm_package_version,z1="https://app.mappedin.com/";function jo(){if(Y1==null)throw new Error("fetch is not available in your environment. Pass your own function into `setFetchFn` (node-fetch, etc)");return Y1}l(jo,"isomorphicFetch");var Z1={supplementaryUrl:"https://api-gateway.mappedin.com/analytics/",headers:{},accessToken:"",clientId:"",noAuth:!1,includeHidden:!0,clientSecret:"",apiGateway:"",authorization:"",perspective:"Website",language:"",venue:""};function q1(r){var e;let t={...Z1,...r};return t.headers={...t.headers,"mappedin-sdk-version":V5},t.things=[],"platformString"in r&&(t.headers={...t.headers,"mappedin-platform-version":r.platformString}),t.noAuth||(t.accessToken?t.authorization=`Bearer ${t.accessToken}`:t.clientId&&t.clientSecret&&(t.authorization=`Basic ${globalThis.btoa(`${t.clientId}:${t.clientSecret}`)}`)),t.language=(e=t.language)==null?void 0:e.toLowerCase(),t}l(q1,"parseOptions");function H5(r,t,e=!1){let i={language:r.language,clientId:r.clientId,clientSecret:r.clientSecret};e&&delete i.language,i.language&&(t+=`&lang=${encodeURIComponent(i.language)}`);let{headers:n}=r;n["Content-Type"]=n["Content-Type"]||"text/json",r.accessToken?n.Authorization=`Bearer ${r.accessToken}`:r.noAuth||r.clientId&&r.clientSecret&&(n["x-mappedin-key"]=btoa(r.clientId),n["x-mappedin-secret"]=btoa(r.clientSecret)),i.language&&(n["Accept-Language"]=i.language);let o={method:"GET",headers:n};return r.secure&&(t+="&withcdntoken"),{req:o,url:t}}l(H5,"constructParamsForRequest");async function X5(r,t,e=!1){let i=H5(r,t,e),n=await jo()(i.url,i.req);if(!n.ok)throw new Error(`${n.status} ${n.statusText}`);return n.json()}l(X5,"generateAPIRequest");async function j5(r,t="exports/mvf/1/bundle"){var o;let e=q1({baseUri:"https://api-gateway.mappedin.com/",...Z1,...r}),i=`${e.baseUri+t}?venue=${e.venue}&version=${(o=e.version)!=null?o:"2.0.0"}`;return e.headers["Content-Type"]="application/zip",await X5(e,i)}l(j5,"getVenueMVFURL");async function $1(r){return new Promise(async(t,e)=>{try{let{url:i}=await j5(r,"exports/mvf2/1/bundle"),n=await jo()(i).then(a=>a.arrayBuffer()),o=new Uint8Array(n);t(o)}catch(i){e(i)}})}l($1,"downloadVenueBundleMVFAPIGateway");async function op(r,t){return new Promise(async(e,i)=>{try{let{url:n}=await W5(r,t),o=await jo()(n).then(c=>c.arrayBuffer()),a=new Uint8Array(o);e(a)}catch(n){i(n)}})}l(op,"downloadMVF");function J1(r){return r.endsWith("/")?r:`${r}/`}l(J1,"normalizeUrl");async function W5(r,t){let e=`${r.baseUri?J1(r.baseUri):z1}api/venue/${r.mapId}/mvf${r.viewId?`?configId=${r.viewId}`:""}`,i=await jo()(e,{headers:{Authorization:`Bearer ${t}`}});if(!i.ok)throw new Error(`${i.status} ${i.statusText}`);return i.json()}l(W5,"getMakerBundleURL");async function hl(r){let t=`${r.baseUri?J1(r.baseUri):z1}api/api-key/token`,e=await jo()(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(hl,"getAccessToken");function dl(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 o=Object.keys(r.annotation);for(let a of o){let c=a.replace(/\.json|\.geojson/g,"");i.annotation[c]=JSON.parse(e(r.annotation[a]))}}let n=Object.keys(r.space);for(let o of n){let a=o.replace(/\.json|\.geojson/g,"");i.space[a]=JSON.parse(e(r.space[o]))}if(r.obstruction!=null){let o=Object.keys(r.obstruction);for(let a of o){let c=a.replace(/\.json|\.geojson/g,"");i.obstruction[c]=JSON.parse(e(r.obstruction[a]))}}else i.obstruction={};if(r.entrance!=null){let o=Object.keys(r.entrance);for(let a of o){let c=a.replace(/\.json|\.geojson/g,"");i.entrance[c]=JSON.parse(e(r.entrance[a]))}}else i.entrance={};return i}catch(i){throw B.error(i),new Error("MVF parsing failed! Probably encountered a bad file.")}}l(dl,"parseMVF");function Y5(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(Y5,"validateStaticMVFFiles");async function fl(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-YJRMCITR.js")).unzipSync(r);if(!Y5(n))throw new Error("MVF is missing some expect static files. Unzipping failed.");let o={},a=Object.keys(n);for(let c of a){if(n[c].length===0)continue;let s=c.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[c];continue}if(s[0]==="image"){B.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[c]}t(o)}catch(i){e(i)}})}l(fl,"unzipMVF");d();d();d();d();var qt=63710088e-1,K1={centimeters:qt*100,centimetres:qt*100,degrees:qt/111325,feet:qt*3.28084,inches:qt*39.37,kilometers:qt/1e3,kilometres:qt/1e3,meters:qt,metres:qt,miles:qt/1609.344,millimeters:qt*1e3,millimetres:qt*1e3,nauticalmiles:qt/1852,radians:1,yards:qt*1.0936},$T={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/qt,yards:1.0936133};function Xr(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(Xr,"feature");function Oe(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(!ap(r[0])||!ap(r[1]))throw new Error("coordinates must contain numbers");var i={type:"Point",coordinates:r};return Xr(i,t,e)}l(Oe,"point");function vr(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 Xr(i,t,e)}l(vr,"lineString");function Wo(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(Wo,"featureCollection");function Q1(r,t){t===void 0&&(t="kilometers");var e=K1[t];if(!e)throw new Error(t+" units is invalid");return r*e}l(Q1,"radiansToLength");function ty(r,t){t===void 0&&(t="kilometers");var e=K1[t];if(!e)throw new Error(t+" units is invalid");return r/e}l(ty,"lengthToRadians");function Yo(r){var t=r%(2*Math.PI);return t*180/Math.PI}l(Yo,"radiansToDegrees");function ie(r){var t=r%360;return t*Math.PI/180}l(ie,"degreesToRadians");function ap(r){return!isNaN(r)&&r!==null&&!Array.isArray(r)}l(ap,"isNumber");function Ce(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(Ce,"getCoord");function pe(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(pe,"getCoords");function ey(r){return r.type==="Feature"?r.geometry:r}l(ey,"getGeom");function ry(r,t){return r.type==="FeatureCollection"?"FeatureCollection":r.type==="GeometryCollection"?"GeometryCollection":r.type==="Feature"&&r.geometry!==null?r.geometry.type:r.type}l(ry,"getType");function U5(r,t,e){e===void 0&&(e={});for(var i=Ce(r),n=pe(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")),z5(n[o],n[o+1],i,a,typeof e.epsilon>"u"?null:e.epsilon))return!0}return!1}l(U5,"booleanPointOnLine");function z5(r,t,e,i,n){var o=e[0],a=e[1],c=r[0],s=r[1],p=t[0],f=t[1],m=e[0]-c,y=e[1]-s,x=p-c,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?c<o&&o<=p:p<=o&&o<c:S>0?s<a&&a<=f:f<=a&&a<s;if(i==="end")return Math.abs(x)>=Math.abs(S)?x>0?c<=o&&o<p:p<o&&o<=c:S>0?s<=a&&a<f:f<a&&a<=s;if(i==="both")return Math.abs(x)>=Math.abs(S)?x>0?c<o&&o<p:p<o&&o<c:S>0?s<a&&a<f:f<a&&a<s}else return Math.abs(x)>=Math.abs(S)?x>0?c<=o&&o<=p:p<=o&&o<=c:S>0?s<=a&&a<=f:f<=a&&a<=s;return!1}l(z5,"isPointOnLineSegment");var iy=U5;d();d();d();function ml(r,t,e){if(r!==null)for(var i,n,o,a,c,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,c=y?p.geometries.length:1;for(var I=0;I<c;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(ml(a.geometries[i],t,e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}l(ml,"coordEach");function sp(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(sp,"featureEach");function Z5(r,t){var e,i,n,o,a,c,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(c=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=c?c.type==="GeometryCollection":!1,a=s?c.geometries.length:1,n=0;n<a;n++){if(o=s?c.geometries[n]:c,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(Z5,"geomEach");function Uo(r,t){Z5(r,function(e,i,n,o,a){var c=e===null?null:e.type;switch(c){case null:case"Point":case"LineString":case"Polygon":return t(Xr(e,n,{bbox:o,id:a}),i,0)===!1?!1:void 0}var s;switch(c){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(Xr(m,n),i,p)===!1)return!1}})}l(Uo,"flattenEach");function q5(r,t){Uo(r,function(e,i,n){var o=0;if(e.geometry){var a=e.geometry.type;if(!(a==="Point"||a==="MultiPoint")){var c,s=0,p=0,f=0;if(ml(e,function(m,y,x,S,M){if(c===void 0||i>s||S>p||M>f){c=m,s=i,p=S,f=M,o=0;return}var g=vr([c,m],e.properties);if(t(g,i,n,M,o)===!1)return!1;o++,c=m})===!1)return!1}}})}l(q5,"segmentEach");function ny(r,t,e){var i=e,n=!1;return q5(r,function(o,a,c,s,p){n===!1&&e===void 0?i=o:i=t(i,o,a,c,s,p),n=!0}),i}l(ny,"segmentReduce");function lp(r){var t=[1/0,1/0,-1/0,-1/0];return ml(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(lp,"bbox");lp.default=lp;var yl=lp;function $5(r,t){t===void 0&&(t={});var e=yl(r),i=(e[0]+e[2])/2,n=(e[1]+e[3])/2;return Oe([i,n],t.properties,t)}l($5,"center");var oy=$5;d();d();function J5(r,t,e){e===void 0&&(e={});var i=Ce(r),n=Ce(t),o=ie(n[1]-i[1]),a=ie(n[0]-i[0]),c=ie(i[1]),s=ie(n[1]),p=Math.pow(Math.sin(o/2),2)+Math.pow(Math.sin(a/2),2)*Math.cos(c)*Math.cos(s);return Q1(2*Math.atan2(Math.sqrt(p),Math.sqrt(1-p)),e.units)}l(J5,"distance");var jr=J5;function gl(r,t){return t===void 0&&(t={}),ny(r,function(e,i){var n=i.geometry.coordinates;return e+jr(n[0],n[1],t)},0)}l(gl,"length");d();d();d();function vl(r,t,e){if(e===void 0&&(e={}),e.final===!0)return K5(r,t);var i=Ce(r),n=Ce(t),o=ie(i[0]),a=ie(n[0]),c=ie(i[1]),s=ie(n[1]),p=Math.sin(a-o)*Math.cos(s),f=Math.cos(c)*Math.sin(s)-Math.sin(c)*Math.cos(s)*Math.cos(a-o);return Yo(Math.atan2(p,f))}l(vl,"bearing");function K5(r,t){var e=vl(t,r);return e=(e+180)%360,e}l(K5,"calculateFinalBearing");d();function Mi(r,t,e,i){i===void 0&&(i={});var n=Ce(r),o=ie(n[0]),a=ie(n[1]),c=ie(e),s=ty(t,i.units),p=Math.asin(Math.sin(a)*Math.cos(s)+Math.cos(a)*Math.sin(s)*Math.cos(c)),f=o+Math.atan2(Math.sin(c)*Math.sin(s)*Math.cos(a),Math.cos(s)-Math.sin(a)*Math.sin(p)),m=Yo(f),y=Yo(p);return Oe([m,y],i.properties)}l(Mi,"destination");d();d();function Q5(r){if(!r)throw new Error("geojson is required");var t=[];return Uo(r,function(e){t7(e,t)}),Wo(t)}l(Q5,"lineSegment");function t7(r,t){var e=[],i=r.geometry;if(i!==null){switch(i.type){case"Polygon":e=pe(i);break;case"LineString":e=[pe(i)]}e.forEach(function(n){var o=e7(n,r.properties);o.forEach(function(a){a.id=t.length,t.push(a)})})}}l(t7,"lineSegmentFeature");function e7(r,t){var e=[];return r.reduce(function(i,n){var o=vr([i,n],t);return o.bbox=r7(i,n),e.push(o),n}),e}l(e7,"createSegments");function r7(r,t){var e=r[0],i=r[1],n=t[0],o=t[1],a=e<n?e:n,c=i<o?i:o,s=e>n?e:n,p=i>o?i:o;return[a,c,s,p]}l(r7,"bbox");var cp=Q5;var f3=Gr(h3(),1);function w9(r,t){var e={},i=[];if(r.type==="LineString"&&(r=Xr(r)),t.type==="LineString"&&(t=Xr(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=d3(r,t);return n&&i.push(n),Wo(i)}var o=(0,f3.default)();return o.load(cp(t)),sp(cp(r),function(a){sp(o.search(a),function(c){var s=d3(a,c);if(s){var p=pe(s).join(",");e[p]||(e[p]=!0,i.push(s))}})}),Wo(i)}l(w9,"lineIntersect");function d3(r,t){var e=pe(r),i=pe(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],c=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)*(c-o),x=(f-s)*(o-p)-(m-p)*(n-s),S=(a-n)*(o-p)-(c-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*(c-o);return Oe([C,I])}return null}l(d3,"intersects");var m3=w9;function T9(r,t,e){e===void 0&&(e={});var i=Oe([1/0,1/0],{dist:1/0}),n=0;return Uo(r,function(o){for(var a=pe(o),c=0;c<a.length-1;c++){var s=Oe(a[c]);s.properties.dist=jr(t,s,e);var p=Oe(a[c+1]);p.properties.dist=jr(t,p,e);var f=jr(s,p,e),m=Math.max(s.properties.dist,p.properties.dist),y=vl(s,p),x=Mi(t,m,y+90,e),S=Mi(t,m,y-90,e),M=m3(vr([x.geometry.coordinates,S.geometry.coordinates]),vr([s.geometry.coordinates,p.geometry.coordinates])),g=null;M.features.length>0&&(g=M.features[0],g.properties.dist=jr(t,g,e),g.properties.location=n+jr(s,g,e)),s.properties.dist<i.properties.dist&&(i=s,i.properties.index=c,i.properties.location=n),p.properties.dist<i.properties.dist&&(i=p,i.properties.index=c+1,i.properties.location=n+f),g&&g.properties.dist<i.properties.dist&&(i=g,i.properties.index=c),n+=f}}),i}l(T9,"nearestPointOnLine");var ua=T9;function I9(r,t,e){var i=pe(e);if(ry(e)!=="LineString")throw new Error("line must be a LineString");var n=ua(e,r),o=ua(e,t),a;n.properties.index<=o.properties.index?a=[n,o]:a=[o,n];for(var c=[a[0].geometry.coordinates],s=a[0].properties.index+1;s<a[1].properties.index+1;s++)c.push(i[s]);return c.push(a[1].geometry.coordinates),vr(c,e.properties)}l(I9,"lineSlice");var $h=I9;var E9=1e-7;function Jh(r){return{type:"Point",coordinates:r}}l(Jh,"point");function L9(r,t){let{coordinates:e}=t.geometry,{coordinates:i}=r.geometry,n=e.map(o=>ua(r,Jh(o)));return i.reduce((o,a)=>{let c=$h(Jh(a),n[0],r),s=$h(Jh(a),n[1],r),p=gl(c)<gl(s)?c:s;return p.properties={...r.properties,entrances:[]},o.concat([p])},[])}l(L9,"splitObstructionByEntrance");function Kh(r,t){return t.reduce((e,i)=>{let n={epsilon:E9},o=e.findIndex(c=>iy(oy(i),c,n)),a=e[o];if(a){let[c,s]=L9(a,i);e.splice(o,1,c,s)}return e},[r])}l(Kh,"splitObstructionByAllEntrances");d();d();d();d();var Qh=[0,4,6,8,10],tt=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],Qh.map((i,n)=>e.slice(i,n===Qh.length-1?void 0:Qh[n+1]).join("")).join("-")},"randomId");var Gn=class Gn{__type=Gn.__type;id=tt();latitude;longitude;floorId;static is(t){return t.__type===Gn.__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(Gn,"Coordinate"),v(Gn,"__type","coordinate");var td=Gn,et=td;d();d();d();d();var ed=class ed{id;constructor(t){this.id=t}};l(ed,"BaseMetaData");var Ei=ed;var ha,Vn,pa=class pa extends Ei{constructor(e){super(String(tt()));P(this,ha,{});P(this,Vn,void 0);E(this,Vn,e.mvfData)}static is(e){return e.__type===pa.__type}get url(){return u(this,Vn).url}get name(){return u(this,Vn).displayName}toJSON(){return{id:this.id,url:this.url,name:this.name}}destroy(){for(let e of globalThis.Object.keys(u(this,ha)))delete u(this,ha)[e]}};ha=new WeakMap,Vn=new WeakMap,l(pa,"Hyperlink"),v(pa,"__type","hyperlink");var rd=pa,mc=rd;var id=class id{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 mc({mvfData:o})))}links=[]};l(id,"BaseMapData");var Dt=id;var Li,Sr,Di,$r,Hn=class Hn extends Dt{constructor(e,i){super(i.mvfData.properties.id,i.mvfData.properties.details);v(this,"__type",Hn.__type);P(this,Li,void 0);P(this,Sr,void 0);P(this,Di,void 0);P(this,$r,void 0);E(this,Sr,{}),E(this,$r,i.mvfData),E(this,Li,e),E(this,Di,i.floorId)}static is(e){return e.__type===Hn.__type}get name(){var e,i;return(i=(e=u(this,$r).properties.details)==null?void 0:e.name)!=null?i:""}get description(){var e,i;return(i=(e=u(this,$r).properties.details)==null?void 0:e.description)!=null?i:""}get images(){var e,i;return(i=(e=u(this,$r).properties.details)==null?void 0:e.images)!=null?i:[]}get floor(){let e=u(this,Li).getById("floor",u(this,Di));if(e==null)throw new Error(`Floor ${u(this,Di)} not found!`);return e}get center(){if(u(this,Sr).center==null){let[[e,i],[n,o]]=u(this,$r).geometry.coordinates,a=(e+n)/2,c=(i+o)/2;u(this,Sr).center=new et(c,a,u(this,Di))}return u(this,Sr).center}get isExterior(){var n;let e=u(this,Li).obstructionIdByEntranceId[this.id],i=u(this,Li).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(u(this,Sr)))delete u(this,Sr)[e]}};Li=new WeakMap,Sr=new WeakMap,Di=new WeakMap,$r=new WeakMap,l(Hn,"Door"),v(Hn,"__type","door");var nd=Hn,Jr=nd;d();var jn,_i,Kr,er,Xn=class Xn extends Dt{constructor(e,i){super(i.mvfData.properties.id,i.mvfData.properties.details);v(this,"__type",Xn.__type);P(this,jn,void 0);P(this,_i,void 0);P(this,Kr,{});P(this,er,void 0);E(this,jn,e),E(this,_i,i.floorId),E(this,er,i.mvfData)}static is(e){return e.__type===Xn.__type}get name(){var i,n;let{properties:e}=u(this,er);return(n=(i=e.details)==null?void 0:i.name)!=null?n:e.externalId}get type(){return _9(u(this,er).properties.kind)}get description(){var e,i;return(i=(e=u(this,er).properties.details)==null?void 0:e.description)!=null?i:""}get images(){var e,i;return(i=(e=u(this,er).properties.details)==null?void 0:e.images)!=null?i:[]}get floor(){let e=u(this,jn).getById("floor",u(this,_i));if(e==null)throw new Error(`Floor ${u(this,_i)} not found!`);return e}get doors(){return u(this,er).properties.destinationNodes.reduce((e,i)=>{let n=u(this,jn).doorsByNodeId[i];return n&&e.push(n),e},[])}get center(){var e;if(u(this,Kr).center==null){let[i,n]=(e=u(this,er).properties.center)!=null?e:[0,0];u(this,Kr).center=new et(n,i,u(this,_i))}return u(this,Kr).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(u(this,Kr)))delete u(this,Kr)[e]}};jn=new WeakMap,_i=new WeakMap,Kr=new WeakMap,er=new WeakMap,l(Xn,"Space"),v(Xn,"__type","space");var od=Xn,D9=["room","hallway","exterior","void","connection.stairs","connection.elevator","poi"];function _9(r){if(r==null||r==="default")return"room";let t=r.toLowerCase();return D9.includes(t)?t:"room"}l(_9,"validateSpaceType");var de=od;d();var rr,vt,Yn,Wn=class Wn extends Dt{constructor(e,i){super(i.mvfData.id);v(this,"__type",Wn.__type);P(this,rr,void 0);P(this,vt,{});P(this,Yn,void 0);E(this,rr,e),E(this,Yn,i.mvfData)}static is(e){return e.__type===Wn.__type}get name(){return u(this,Yn).externalId}get elevation(){return u(this,Yn).elevation}get spaces(){if(u(this,vt).spaces==null){let e=u(this,rr).spaces.filter(i=>i.floor.id===this.id);u(this,vt).spaces=e}return u(this,vt).spaces}get objects(){if(u(this,vt).objects==null){let e=u(this,rr).objects.filter(i=>i.floor.id===this.id);u(this,vt).objects=e}return u(this,vt).objects}get connections(){if(u(this,vt).connections==null){let e=u(this,rr).connections.filter(i=>i.floors.includes(this));u(this,vt).connections=e}return u(this,vt).connections}get doors(){if(u(this,vt).doors==null){let e=u(this,rr).doors.filter(i=>i.floor.id===this.id);u(this,vt).doors=e}return u(this,vt).doors}get annotations(){if(u(this,vt).annotations==null){let e=u(this,rr).annotations.filter(i=>i.floor.id===this.id);u(this,vt).annotations=e}return u(this,vt).annotations}get pois(){if(u(this,vt).pois==null){let e=u(this,rr).pointsOfInterest.filter(i=>i.floor.id===this.id);u(this,vt).pois=e}return u(this,vt).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(u(this,vt)))delete u(this,vt)[e]}};rr=new WeakMap,vt=new WeakMap,Yn=new WeakMap,l(Wn,"Floor"),v(Wn,"__type","floor");var ad=Wn,Qr=ad;d();d();d();var da=l(r=>r!=null,"notNull");d();function y3(r){return typeof r=="string"?r:r.id}l(y3,"getId");d();function nr(r){let t;if(de.is(r)||Jr.is(r)||fe.is(r))t=r.center;else if(ti.is(r)||Un.is(r))t=r.coordinate;else if(et.is(r))t=r;else return;return t}l(nr,"getCoordinateFromStuffs");d();d();var fa={auto:!0,debug:!1,pitch:45,bearing:0,antialiasing:{enabled:!0},shadingAndOutlines:!0,outdoorView:{layersHiddenByGeometry:["building","building-top"]}},Oi="ExteriorWalls",yc="Walls",g3=0;function sd(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(sd,"validateOptions");function ld(r,t){var n,o,a,c;let e=((n=r==null?void 0:r.outdoorView)==null?void 0:n.token)||t.outdoorViewToken,i={...fa,...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:(c=fa.outdoorView)==null?void 0:c.layersHiddenByGeometry,...r==null?void 0:r.outdoorView}};return e&&i.outdoorView&&(i.outdoorView.token=e),i}l(ld,"handleDefault");var ma,Pr,Mr,zn=class zn extends Dt{constructor(e,i){let n=Object.values(i.mvfDataByFloorId)[0];super(n.properties.id,n.properties.details);v(this,"__type",zn.__type);P(this,ma,void 0);P(this,Pr,void 0);P(this,Mr,void 0);E(this,Pr,{}),E(this,ma,e),E(this,Mr,i.mvfDataByFloorId)}static is(e){return e.__type===zn.__type}get name(){var e,i;return(i=(e=Object.values(u(this,Mr))[0].properties.details)==null?void 0:e.name)!=null?i:""}get description(){var e,i;return(i=(e=Object.values(u(this,Mr))[0].properties.details)==null?void 0:e.description)!=null?i:""}get images(){var e,i;return(i=(e=Object.values(u(this,Mr))[0].properties.details)==null?void 0:e.images)!=null?i:[]}get type(){var e,i;return(i=(e=Object.values(u(this,Mr))[0].properties.kind)==null?void 0:e.split(".")[1])!=null?i:"unknown"}get coordinates(){return u(this,Pr).coordinates==null&&(u(this,Pr).coordinates=Object.entries(u(this,Mr)).map(([e,i])=>new et(i.geometry.coordinates[1],i.geometry.coordinates[0],e))),u(this,Pr).coordinates}get floors(){return this.coordinates.map(e=>e.floorId?u(this,ma).getById("floor",e.floorId):void 0).filter(da)}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(u(this,Pr)))delete u(this,Pr)[e]}};ma=new WeakMap,Pr=new WeakMap,Mr=new WeakMap,l(zn,"Connection"),v(zn,"__type","connection");var cd=zn,ei=cd;d();var ya,Ai,ri,wr,Zn=class Zn extends Dt{constructor(e,i){super(i.mvfData.properties.id,i.mvfData.properties.details);v(this,"__type",Zn.__type);P(this,ya,void 0);P(this,Ai,void 0);P(this,ri,{});P(this,wr,void 0);E(this,ya,e),E(this,Ai,i.floorId),E(this,wr,i.mvfData)}static is(e){return e.__type===Zn.__type}get name(){var e,i;return(i=(e=u(this,wr).properties.details)==null?void 0:e.name)!=null?i:""}get description(){var e,i;return(i=(e=u(this,wr).properties.details)==null?void 0:e.description)!=null?i:""}get images(){var e,i;return(i=(e=u(this,wr).properties.details)==null?void 0:e.images)!=null?i:[]}get type(){let e=u(this,wr).properties.kind;return e==null&&(e="object"),e==="Desks"&&(e="desk"),e.toLowerCase()}get floor(){let e=u(this,ya).getById("floor",u(this,Ai));if(e==null)throw new Error(`Floor ${u(this,Ai)} not found!`);return e}get center(){var e;if(u(this,ri).center==null){let[i,n]=(e=u(this,wr).properties.center)!=null?e:[0,0];u(this,ri).center=new et(n,i,u(this,Ai))}return u(this,ri).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(u(this,ri)))u(this,ri)[e]=null}};ya=new WeakMap,Ai=new WeakMap,ri=new WeakMap,wr=new WeakMap,l(Zn,"MapObject"),v(Zn,"__type","object");var ud=Zn,fe=ud;d();d();var va,qn,ga=class ga extends Ei{constructor(e){super(String(tt()));P(this,va,{});P(this,qn,void 0);E(this,qn,e.mvfData)}static is(e){return e.__type===ga.__type}get url(){return u(this,qn).url}get name(){return u(this,qn).altText}toJSON(){return{id:this.id,url:this.url,name:this.name}}destroy(){for(let e of globalThis.Object.keys(u(this,va)))delete u(this,va)[e]}};va=new WeakMap,qn=new WeakMap,l(ga,"Image"),v(ga,"__type","image");var pd=ga,gc=pd;var ba,ki,Ne,ii,$n=class $n extends Dt{constructor(e,i){super(i.mvfData.properties.id,i.mvfData.properties.details);v(this,"__type",$n.__type);P(this,ba,void 0);P(this,ki,void 0);P(this,Ne,{});P(this,ii,void 0);E(this,ba,e),E(this,ii,i.mvfData),E(this,ki,i.floorId)}static is(e){return e.__type===$n.__type}get name(){var e,i;return(i=(e=u(this,ii).properties.details)==null?void 0:e.name)!=null?i:""}get description(){var e,i;return(i=(e=u(this,ii).properties.details)==null?void 0:e.description)!=null?i:""}get images(){var e,i;if(u(this,Ne).images==null){let n=(i=(e=u(this,ii).properties.details)==null?void 0:e.images)!=null?i:[];u(this,Ne).images=n.map(o=>new gc({mvfData:o}))}return u(this,Ne).images}get floor(){let e=u(this,ba).getById("floor",u(this,ki));if(e==null)throw new Error(`Floor ${u(this,ki)} not found!`);return e}get coordinate(){var e;if(u(this,Ne).coordinate==null){let[i,n]=(e=u(this,ii).geometry.coordinates)!=null?e:[0,0];u(this,Ne).coordinate=new et(n,i,u(this,ki))}return u(this,Ne).coordinate}toJSON(){return{id:this.id,name:this.name,floor:this.floor.id,coordinate:this.coordinate.toJSON()}}destroy(){for(let e in u(this,Ne))u(this,Ne)[e]=null}};ba=new WeakMap,ki=new WeakMap,Ne=new WeakMap,ii=new WeakMap,l($n,"PointOfInterest"),v($n,"__type","point-of-interest");var hd=$n,ti=hd;d();var Ca,Ni,ni,Kn,xa,fd,Jn=class Jn extends Dt{constructor(e,i){super(i.mvfData.properties.id);P(this,xa);v(this,"__type",Jn.__type);P(this,Ca,void 0);P(this,Ni,void 0);P(this,ni,{});P(this,Kn,void 0);E(this,Ca,e),E(this,Ni,i.floorId),E(this,Kn,i.mvfData)}static is(e){return e.__type===Jn.__type}get group(){return X(this,xa,fd).call(this).group}get type(){return X(this,xa,fd).call(this).type}get coordinate(){if(u(this,ni).coordinate==null){let[e,i]=u(this,Kn).geometry.coordinates;u(this,ni).coordinate=new et(i,e,u(this,Ni))}return u(this,ni).coordinate}get floor(){let e=u(this,Ca).getById("floor",u(this,Ni));if(e==null)throw new Error(`Floor ${u(this,Ni)} 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(u(this,ni)))delete u(this,ni)[e]}};Ca=new WeakMap,Ni=new WeakMap,ni=new WeakMap,Kn=new WeakMap,xa=new WeakSet,fd=l(function(){let[e,i]=u(this,Kn).properties.symbolId.split("--");return{group:e,type:i}},"#getGroupAndTypeFromSymbolId"),l(Jn,"Annotation"),v(Jn,"__type","annotation");var dd=Jn,Un=dd;d();d();var to,Re,Ri,eo,Qn=class Qn extends Dt{constructor(e,i){super(i.mvfData.properties.id);v(this,"__type",Qn.__type);P(this,to,void 0);P(this,Re,{});P(this,Ri,void 0);P(this,eo,void 0);E(this,to,e),E(this,Ri,i.floorId),E(this,eo,i.mvfData)}static is(e){return e.__type===Qn.__type}get floor(){let e=u(this,to).getById("floor",u(this,Ri));if(e==null)throw new Error(`Floor ${u(this,Ri)} not found!`);return e}get coordinate(){if(u(this,Re).coordinate==null){let[e,i]=u(this,eo).geometry.coordinates;u(this,Re).coordinate=new et(i,e,u(this,Ri))}return u(this,Re).coordinate}get neighbors(){if(u(this,Re).neighbours==null){let e=u(this,eo).properties.neighbors.map(i=>{let n=u(this,to).getById("node",i.id);if(n==null)throw new Error(`Node ${i.id} not found!`);return n});u(this,Re).neighbours=e}return u(this,Re).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(u(this,Re)))delete u(this,Re)[e]}};to=new WeakMap,Re=new WeakMap,Ri=new WeakMap,eo=new WeakMap,l(Qn,"Node"),v(Qn,"__type","node");var md=Qn,v3=md;var O9=l((r,t)=>{var m,y;let e={},i={},n={},o={},a={},c={},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]}`;c[g]==null&&(c[g]=[]),c[g].push(M.properties.id);continue}if(M.properties.kind==="poi"){let g=new ti(t,{floorId:x,mvfData:M});i[M.properties.id]=g}else{let g=new de(t,{floorId:x,mvfData:M});e[M.properties.id]=g}}}}for(let x in c){let S=c[x],M={};for(let C of S){let I=p[C],T=a[C];M[I]=T}let g=new ei(t,{mvfDataByFloorId:M});s[g.id]=g}return{spacesById:e,poisById:i,connectionsById:s,spaceIdsByDestinationNodeId:n,objectEntranceNodeIdsByObstructionId:o,mvfSpacesById:a,connectionIdsByLatLon:c}},"processMVFSpaces"),A9=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"),k9=l((r,t)=>{let e={},i={},n={},o=globalThis.Object.keys(r.obstruction);for(let a of o){let c=r.obstruction[a];if(c!=null)for(let s of c.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 fe(t,{floorId:a,mvfData:s});e[s.properties.id]=p}}return{objectsById:e,mvfObstructionById:i,obstructionIdByEntranceId:n}},"processMVFObstructions"),N9=l((r,t)=>{let e={},i={};for(let n of r["map.geojson"]){i[n.id]=n;let o=new Qr(t,{mvfData:n});e[n.id]=o}return{floorsById:e,mvfMapsById:i}},"processMVFMaps"),R9=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"),B9=l((r,t)=>{let e={},i={},n={},o=globalThis.Object.keys(r.entrance);for(let a of o){let c=r.entrance[a];if(c!=null)for(let s of c.features){n[s.properties.id]=s;let p=new Jr(t,{floorId:a,mvfData:s});s.properties.node&&(i[s.properties.node]=p),e[s.properties.id]=p}}return{doorsById:e,doorsByNodeId:i,mvfEntrancesById:n}},"processMVFEntrances"),F9=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 c of a.features){i[c.properties.id]=c;let s=new Un(t,{floorId:o,mvfData:c});e[c.properties.id]=s}}return{annotationsById:e,mvfAnnotationsById:i}},"processMVFAnnotations"),b3=l((r,t)=>{let{spacesById:e,spaceIdsByDestinationNodeId:i,poisById:n,mvfSpacesById:o,objectEntranceNodeIdsByObstructionId:a,connectionsById:c,connectionIdsByLatLon:s}=O9(r,t),{nodesById:p,mvfNodesById:f}=A9(r,t),{objectsById:m,mvfObstructionById:y,obstructionIdByEntranceId:x}=k9(r,t),{floorsById:S,mvfMapsById:M}=N9(r,t),{mvfConnectionsById:g,mvfConnectionsByNodeId:C}=R9(r,t),{doorsById:I,doorsByNodeId:T,mvfEntrancesById:w}=B9(r,t),{annotationsById:L,mvfAnnotationsById:_}=F9(r,t);return{spacesById:e,nodesById:p,objectsById:m,floorsById:S,connectionsById:c,doorsById:I,doorsByNodeId:T,poisById:n,annotationsById:L,spaceIdsByDestinationNodeId:i,objectEntranceNodeIdsByObstructionId:a,obstructionIdByEntranceId:x,connectionIdsByLatLon:s,mvfSpacesById:o,mvfNodesById:f,mvfObstructionById:y,mvfMapsById:M,mvfConnectionsById:g,mvfConnectionsByNodeId:C,mvfEntrancesById:w,mvfAnnotationsById:_}},"createDataFromMVF");var st,Bi,Fi,Gi,Vi,Hi,Xi,ji,Wi,Sa,Pa,Ma,wa,Ta,Ia,Ea,La,yd=class yd{constructor(t,e){P(this,st,{});v(this,"mvf");v(this,"outdoorViewToken");v(this,"spaceIdsByDestinationNodeId");v(this,"objectEntranceNodeIdsByObstructionId");v(this,"obstructionIdByEntranceId");P(this,Bi,void 0);P(this,Fi,void 0);P(this,Gi,void 0);P(this,Vi,void 0);P(this,Hi,void 0);P(this,Xi,void 0);v(this,"doorsByNodeId");P(this,ji,void 0);P(this,Wi,void 0);P(this,Sa,void 0);P(this,Pa,void 0);P(this,Ma,void 0);P(this,wa,void 0);P(this,Ta,void 0);P(this,Ia,void 0);P(this,Ea,void 0);P(this,La,void 0);this.mvf=t,this.outdoorViewToken=e;let i=b3(t,this);E(this,Bi,i.nodesById),E(this,Fi,i.spacesById),E(this,Gi,i.floorsById),E(this,Vi,i.connectionsById),E(this,Hi,i.objectsById),E(this,Xi,i.doorsById),E(this,ji,i.poisById),E(this,Wi,i.annotationsById),E(this,Sa,i.mvfAnnotationsById),E(this,Pa,i.mvfConnectionsById),E(this,Ma,i.mvfConnectionsByNodeId),E(this,wa,i.mvfEntrancesById),E(this,Ta,i.mvfNodesById),E(this,Ia,i.mvfObstructionById),E(this,Ea,i.mvfSpacesById),E(this,La,i.mvfMapsById),this.doorsByNodeId=i.doorsByNodeId,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 et(this.mvf["manifest.geojson"].features[0].geometry.coordinates[1],this.mvf["manifest.geojson"].features[0].geometry.coordinates[0])}get spaces(){return u(this,st).spaces==null&&(u(this,st).spaces=globalThis.Object.values(u(this,Fi))),u(this,st).spaces}get objects(){return u(this,st).objects==null&&(u(this,st).objects=globalThis.Object.values(u(this,Hi))),u(this,st).objects}get connections(){return u(this,st).connections==null&&(u(this,st).connections=globalThis.Object.values(u(this,Vi))),u(this,st).connections}get floors(){return u(this,st).floors==null&&(u(this,st).floors=globalThis.Object.values(u(this,Gi))),u(this,st).floors}get doors(){return u(this,st).doors==null&&(u(this,st).doors=globalThis.Object.values(u(this,Xi))),u(this,st).doors}get pointsOfInterest(){return u(this,st).pointsOfInterest==null&&(u(this,st).pointsOfInterest=globalThis.Object.values(u(this,ji))),u(this,st).pointsOfInterest}get annotations(){return u(this,st).annotations==null&&(u(this,st).annotations=globalThis.Object.values(u(this,Wi))),u(this,st).annotations}get nodes(){return u(this,st).nodes==null&&(u(this,st).nodes=globalThis.Object.values(u(this,Bi))),u(this,st).nodes}getById(t,e){switch(t){case"space":return u(this,Fi)[e];case"floor":return u(this,Gi)[e];case"node":return u(this,Bi)[e];case"door":return u(this,Xi)[e];case"connection":return u(this,Vi)[e];case"object":return u(this,Hi)[e];case"point-of-interest":return u(this,ji)[e];case"annotation":return u(this,Wi)[e];default:throw new Error(`Unknown type: ${t}`)}}getMapDataById(t){var e,i,n,o,a,c,s;return(s=(c=(a=(o=(n=(i=(e=u(this,Fi)[t])!=null?e:u(this,Gi)[t])!=null?i:u(this,Bi)[t])!=null?n:u(this,Xi)[t])!=null?o:u(this,Vi)[t])!=null?a:u(this,Hi)[t])!=null?c:u(this,ji)[t])!=null?s:u(this,Wi)[t]}getMVFFeatureById(t,e){switch(t){case"space":return u(this,Ea)[e];case"node":return u(this,Ta)[e];case"obstruction":return u(this,Ia)[e];case"map":return u(this,La)[e];case"connection":return u(this,Pa)[e];case"entrance":return u(this,wa)[e];case"annotation":return u(this,Sa)[e];default:throw new Error(`Unknown MVF feature type: ${t}`)}}getMVFFeatureByNodeId(t,e){switch(t){case"connection":return u(this,Ma)[e];default:throw new Error(`Unsupported MVF feature type: ${t}`)}}destroy(){for(let t of globalThis.Object.keys(u(this,st)))u(this,st)[t]=null}};st=new WeakMap,Bi=new WeakMap,Fi=new WeakMap,Gi=new WeakMap,Vi=new WeakMap,Hi=new WeakMap,Xi=new WeakMap,ji=new WeakMap,Wi=new WeakMap,Sa=new WeakMap,Pa=new WeakMap,Ma=new WeakMap,wa=new WeakMap,Ta=new WeakMap,Ia=new WeakMap,Ea=new WeakMap,La=new WeakMap,l(yd,"MapDataInternal");var ro=yd;d();d();d();d();var gd=class gd{_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(gd,"PubSub");var z=gd;d();var C3="mi-session-data",x3="mi-local-data",Yi,Be,Fe,Da=class Da{constructor(){P(this,Be,void 0);P(this,Fe,void 0);try{let t=sessionStorage.getItem(C3);t?E(this,Be,JSON.parse(t)):E(this,Be,{id:tt()})}catch{E(this,Be,{id:tt()})}try{let t=localStorage.getItem(x3);t?E(this,Fe,JSON.parse(t)):E(this,Fe,{deviceId:tt()})}catch{E(this,Fe,{deviceId:tt()})}u(this,Be).id||(u(this,Be).id=tt()),u(this,Fe).deviceId||(u(this,Fe).deviceId=tt())}static getInstance(){return u(this,Yi)||E(this,Yi,new Da),u(this,Yi)}static ___clearInstance(){E(this,Yi,void 0)}saveSessionData(t,e){u(this,Be)[t]=e;try{return sessionStorage.setItem(C3,JSON.stringify(u(this,Be))),!0}catch{return!1}}loadSessionData(t){let e=u(this,Be)[t];if(e!=null)return e}saveLocalData(t,e){u(this,Fe)[t]=e;try{return localStorage.setItem(x3,JSON.stringify(u(this,Fe))),!0}catch{return!1}}loadLocalData(t){let e=u(this,Fe)[t];if(e!=null)return e}};Yi=new WeakMap,Be=new WeakMap,Fe=new WeakMap,l(Da,"SafeStorage"),P(Da,Yi,void 0);var io=Da;d();d();d();d();var no=class no{id;text;__type=no.__type;static is(t){return t.__type===no.__type}constructor(t,e){this.id=t,this.text=e}};l(no,"Label"),v(no,"__type","Label");var oi=no;d();var oo=class oo{id;__type=oo.__type;contentEl;static is(t){return t.__type===oo.__type}constructor(t,e){this.id=t,this.contentEl=e}};l(oo,"Marker"),v(oo,"__type","Marker");var Ui=oo;d();var ao=class ao{id;groupId;__type=ao.__type;static is(t){return t.__type===ao.__type}constructor(t,e){this.id=t,this.groupId=e}};l(ao,"Model"),v(ao,"__type","Model");var _a=ao;d();var vd=class vd{id;__type;constructor(t){this.id=t,this.__type="Path"}};l(vd,"Path");var Oa=vd;d();var ai,bd=class bd{constructor(t){P(this,ai,void 0);E(this,ai,t)}get center(){return u(this,ai).center}get bearing(){return u(this,ai).bearing}get pitch(){return u(this,ai).pitch}get zoomLevel(){return u(this,ai).zoomLevel}};ai=new WeakMap,l(bd,"CameraTransform");var Aa=bd;d();var so=class so{id;__type=so.__type;static is(t){return t.__type===so.__type}constructor(t){this.id=t}};l(so,"Shape"),v(so,"__type","Shape");var ka=so;d();d();d();var G9=new Map([["search-16x16",`<svg viewBox="0 0 16 16">
4
+ `+t.prev}l(jp,"indentedJoin");function Fl(r,t){var e=Xp(r),i=[];if(e){i.length=r.length;for(var n=0;n<r.length;n++)i[n]=zr(r,n)?t(r[n],r):""}var o=typeof Bp=="function"?Bp(r):[],a;if(An){a={};for(var c=0;c<o.length;c++)a["$"+o[c]]=o[c]}for(var s in r)zr(r,s)&&(e&&String(Number(s))===s&&s<r.length||An&&a["$"+s]instanceof Symbol||(y0.call(/[^\w$]/,s)?i.push(t(s,r)+": "+t(r[s],r)):i.push(s+": "+t(r[s],r))));if(typeof Bp=="function")for(var p=0;p<o.length;p++)g0.call(r,o[p])&&i.push("["+t(o[p])+"]: "+t(r[o[p]],r));return i}l(Fl,"arrObjKeys")});var Zp=k((QL,w0)=>{"use strict";d();var M0=Ae(),kn=he(),EC=P0(),LC=br(),Hl=M0("%WeakMap%",!0),Xl=M0("%Map%",!0),DC=kn("WeakMap.prototype.get",!0),_C=kn("WeakMap.prototype.set",!0),OC=kn("WeakMap.prototype.has",!0),AC=kn("Map.prototype.get",!0),kC=kn("Map.prototype.set",!0),NC=kn("Map.prototype.has",!0),zp=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"),RC=l(function(r,t){var e=zp(r,t);return e&&e.value},"listGet"),BC=l(function(r,t,e){var i=zp(r,t);i?i.value=e:r.next={key:t,next:r.next,value:e}},"listSet"),FC=l(function(r,t){return!!zp(r,t)},"listHas");w0.exports=l(function(){var t,e,i,n={assert:function(o){if(!n.has(o))throw new LC("Side channel does not contain "+EC(o))},get:function(o){if(Hl&&o&&(typeof o=="object"||typeof o=="function")){if(t)return DC(t,o)}else if(Xl){if(e)return AC(e,o)}else if(i)return RC(i,o)},has:function(o){if(Hl&&o&&(typeof o=="object"||typeof o=="function")){if(t)return OC(t,o)}else if(Xl){if(e)return NC(e,o)}else if(i)return FC(i,o);return!1},set:function(o,a){Hl&&o&&(typeof o=="object"||typeof o=="function")?(t||(t=new Hl),_C(t,o,a)):Xl?(e||(e=new Xl),kC(e,o,a)):(i||(i={key:{},next:null}),BC(i,o,a))}};return n},"getSideChannel")});var I0=k((rD,T0)=>{"use strict";d();var GC=Pp(),ia=Zp()(),Cr=br(),qp={assert:function(r,t){if(!r||typeof r!="object"&&typeof r!="function")throw new Cr("`O` is not an object");if(typeof t!="string")throw new Cr("`slot` must be a string");if(ia.assert(r),!qp.has(r,t))throw new Cr("`"+t+"` is not present on `O`")},get:function(r,t){if(!r||typeof r!="object"&&typeof r!="function")throw new Cr("`O` is not an object");if(typeof t!="string")throw new Cr("`slot` must be a string");var e=ia.get(r);return e&&e["$"+t]},has:function(r,t){if(!r||typeof r!="object"&&typeof r!="function")throw new Cr("`O` is not an object");if(typeof t!="string")throw new Cr("`slot` must be a string");var e=ia.get(r);return!!e&&GC(e,"$"+t)},set:function(r,t,e){if(!r||typeof r!="object"&&typeof r!="function")throw new Cr("`O` is not an object");if(typeof t!="string")throw new Cr("`slot` must be a string");var i=ia.get(r);i||(i={},ia.set(r,i)),i["$"+t]=e}};Object.freeze&&Object.freeze(qp);T0.exports=qp});var D0=k((nD,L0)=>{"use strict";d();var na=I0(),VC=SyntaxError,E0=typeof StopIteration=="object"?StopIteration:null;L0.exports=l(function(t){if(!E0)throw new VC("this environment lacks StopIteration");na.set(t,"[[Done]]",!1);var e={next:l(function(){var n=na.get(this,"[[Iterator]]"),o=na.get(n,"[[Done]]");try{return{done:o,value:o?void 0:n.next()}}catch(a){if(na.set(n,"[[Done]]",!0),a!==E0)throw a;return{done:!0,value:void 0}}},"next")};return na.set(e,"[[Iterator]]",t),e},"getStopIterationIterator")});var $p=k((sD,_0)=>{d();var HC={}.toString;_0.exports=Array.isArray||function(r){return HC.call(r)=="[object Array]"}});var Jp=k((cD,O0)=>{"use strict";d();var XC=String.prototype.valueOf,jC=l(function(t){try{return XC.call(t),!0}catch{return!1}},"tryStringObject"),WC=Object.prototype.toString,YC="[object String]",UC=Ur()();O0.exports=l(function(t){return typeof t=="string"?!0:typeof t!="object"?!1:UC?jC(t):WC.call(t)===YC},"isString")});var Qp=k((hD,N0)=>{"use strict";d();var Kp=typeof Map=="function"&&Map.prototype?Map:null,zC=typeof Set=="function"&&Set.prototype?Set:null,jl;Kp||(jl=l(function(t){return!1},"isMap"));var k0=Kp?Map.prototype.has:null,A0=zC?Set.prototype.has:null;!jl&&!k0&&(jl=l(function(t){return!1},"isMap"));N0.exports=jl||l(function(t){if(!t||typeof t!="object")return!1;try{if(k0.call(t),A0)try{A0.call(t)}catch{return!0}return t instanceof Kp}catch{}return!1},"isMap")});var eh=k((mD,F0)=>{"use strict";d();var ZC=typeof Map=="function"&&Map.prototype?Map:null,th=typeof Set=="function"&&Set.prototype?Set:null,Wl;th||(Wl=l(function(t){return!1},"isSet"));var R0=ZC?Map.prototype.has:null,B0=th?Set.prototype.has:null;!Wl&&!B0&&(Wl=l(function(t){return!1},"isSet"));F0.exports=Wl||l(function(t){if(!t||typeof t!="object")return!1;try{if(B0.call(t),R0)try{R0.call(t)}catch{return!0}return t instanceof th}catch{}return!1},"isSet")});var $0=k((vD,zl)=>{"use strict";d();var G0=kp(),V0=D0();wl()()||$o()()?(Yl=Symbol.iterator,zl.exports=l(function(t){if(t!=null&&typeof t[Yl]<"u")return t[Yl]();if(G0(t))return Array.prototype[Yl].call(t)},"getIterator")):(H0=$p(),X0=Jp(),rh=Ae(),j0=rh("%Map%",!0),W0=rh("%Set%",!0),xe=he(),ih=xe("Array.prototype.push"),nh=xe("String.prototype.charCodeAt"),Y0=xe("String.prototype.slice"),U0=l(function(t,e){var i=t.length;if(e+1>=i)return e+1;var n=nh(t,e);if(n<55296||n>56319)return e+1;var o=nh(t,e+1);return o<56320||o>57343?e+1:e+2},"advanceStringIndex"),Ul=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"),oh=l(function(t,e){if(H0(t)||G0(t))return Ul(t);if(X0(t)){var i=0;return{next:l(function(){var o=U0(t,i),a=Y0(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"),!j0&&!W0?zl.exports=l(function(t){if(t!=null)return oh(t,!0)},"getIterator"):(z0=Qp(),Z0=eh(),ah=xe("Map.prototype.forEach",!0),sh=xe("Set.prototype.forEach",!0),(typeof b>"u"||!b.versions||!b.versions.node)&&(lh=xe("Map.prototype.iterator",!0),ch=xe("Set.prototype.iterator",!0)),uh=xe("Map.prototype.@@iterator",!0)||xe("Map.prototype._es6-shim iterator_",!0),ph=xe("Set.prototype.@@iterator",!0)||xe("Set.prototype._es6-shim iterator_",!0),q0=l(function(t){if(z0(t)){if(lh)return V0(lh(t));if(uh)return uh(t);if(ah){var e=[];return ah(t,function(n,o){ih(e,[o,n])}),Ul(e)}}if(Z0(t)){if(ch)return V0(ch(t));if(ph)return ph(t);if(sh){var i=[];return sh(t,function(n){ih(i,n)}),Ul(i)}}},"getCollectionIterator"),zl.exports=l(function(t){return q0(t)||oh(t)},"getIterator")));var Yl,H0,X0,rh,j0,W0,xe,ih,nh,Y0,U0,Ul,oh,z0,Z0,ah,sh,lh,ch,uh,ph,q0});var hh=k((xD,K0)=>{"use strict";d();var J0=l(function(r){return r!==r},"numberIsNaN");K0.exports=l(function(t,e){return t===0&&e===0?1/t===1/e:!!(t===e||J0(t)&&J0(e))},"is")});var dh=k((MD,Q0)=>{"use strict";d();var qC=hh();Q0.exports=l(function(){return typeof Object.is=="function"?Object.is:qC},"getPolyfill")});var e2=k((ID,t2)=>{"use strict";d();var $C=dh(),JC=Yr();t2.exports=l(function(){var t=$C();return JC(Object,{is:t},{is:l(function(){return Object.is!==t},"testObjectIs")}),t},"shimObjectIs")});var o2=k((DD,n2)=>{"use strict";d();var KC=Yr(),QC=Ii(),t8=hh(),r2=dh(),e8=e2(),i2=QC(r2(),Object);KC(i2,{getPolyfill:r2,implementation:t8,shim:e8});n2.exports=i2});var mh=k((OD,c2)=>{"use strict";d();var r8=Ii(),l2=he(),i8=Ae(),fh=i8("%ArrayBuffer%",!0),Zl=l2("ArrayBuffer.prototype.byteLength",!0),n8=l2("Object.prototype.toString"),a2=!!fh&&!Zl&&new fh(0).slice,s2=!!a2&&r8(a2);c2.exports=l(Zl||s2?function(t){if(!t||typeof t!="object")return!1;try{return Zl?Zl(t):s2(t,0),!0}catch{return!1}}:fh?function(t){return n8(t)==="[object ArrayBuffer]"}:function(t){return!1},"isArrayBuffer")});var p2=k((ND,u2)=>{"use strict";d();var o8=Date.prototype.getDay,a8=l(function(t){try{return o8.call(t),!0}catch{return!1}},"tryDateGetDayCall"),s8=Object.prototype.toString,l8="[object Date]",c8=Ur()();u2.exports=l(function(t){return typeof t!="object"||t===null?!1:c8?a8(t):s8.call(t)===l8},"isDateObject")});var y2=k((FD,m2)=>{"use strict";d();var yh=he(),h2=Ur()(),d2,f2,gh,vh;h2&&(d2=yh("Object.prototype.hasOwnProperty"),f2=yh("RegExp.prototype.exec"),gh={},ql=l(function(){throw gh},"throwRegexMarker"),vh={toString:ql,valueOf:ql},typeof Symbol.toPrimitive=="symbol"&&(vh[Symbol.toPrimitive]=ql));var ql,u8=yh("Object.prototype.toString"),p8=Object.getOwnPropertyDescriptor,h8="[object RegExp]";m2.exports=l(h2?function(t){if(!t||typeof t!="object")return!1;var e=p8(t,"lastIndex"),i=e&&d2(e,"value");if(!i)return!1;try{f2(t,vh)}catch(n){return n===gh}}:function(t){return!t||typeof t!="object"&&typeof t!="function"?!1:u8(t)===h8},"isRegex")});var b2=k((HD,v2)=>{"use strict";d();var d8=he(),g2=d8("SharedArrayBuffer.prototype.byteLength",!0);v2.exports=l(g2?function(t){if(!t||typeof t!="object")return!1;try{return g2(t),!0}catch{return!1}}:function(t){return!1},"isSharedArrayBuffer")});var x2=k((WD,C2)=>{"use strict";d();var f8=Number.prototype.toString,m8=l(function(t){try{return f8.call(t),!0}catch{return!1}},"tryNumberObject"),y8=Object.prototype.toString,g8="[object Number]",v8=Ur()();C2.exports=l(function(t){return typeof t=="number"?!0:typeof t!="object"?!1:v8?m8(t):y8.call(t)===g8},"isNumberObject")});var M2=k((zD,P2)=>{"use strict";d();var S2=he(),b8=S2("Boolean.prototype.toString"),C8=S2("Object.prototype.toString"),x8=l(function(t){try{return b8(t),!0}catch{return!1}},"booleanBrandCheck"),S8="[object Boolean]",P8=Ur()();P2.exports=l(function(t){return typeof t=="boolean"?!0:t===null||typeof t!="object"?!1:P8&&Symbol.toStringTag in t?x8(t):C8(t)===S8},"isBoolean")});var E2=k(($D,bh)=>{"use strict";d();var M8=Object.prototype.toString,w8=wl()();w8?(w2=Symbol.prototype.toString,T2=/^Symbol\(.*\)$/,I2=l(function(t){return typeof t.valueOf()!="symbol"?!1:T2.test(w2.call(t))},"isRealSymbolObject"),bh.exports=l(function(t){if(typeof t=="symbol")return!0;if(M8.call(t)!=="[object Symbol]")return!1;try{return I2(t)}catch{return!1}},"isSymbol")):bh.exports=l(function(t){return!1},"isSymbol");var w2,T2,I2});var _2=k((QD,D2)=>{"use strict";d();var L2=typeof BigInt<"u"&&BigInt;D2.exports=l(function(){return typeof L2=="function"&&typeof BigInt=="function"&&typeof L2(42)=="bigint"&&typeof BigInt(42)=="bigint"},"hasNativeBigInts")});var k2=k((r_,Ch)=>{"use strict";d();var T8=_2()();T8?(O2=BigInt.prototype.valueOf,A2=l(function(t){try{return O2.call(t),!0}catch{}return!1},"tryBigIntObject"),Ch.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:A2(t)},"isBigInt")):Ch.exports=l(function(t){return!1},"isBigInt");var O2,A2});var R2=k((o_,N2)=>{"use strict";d();var I8=Jp(),E8=x2(),L8=M2(),D8=E2(),_8=k2();N2.exports=l(function(t){if(t==null||typeof t!="object"&&typeof t!="function")return null;if(I8(t))return"String";if(E8(t))return"Number";if(L8(t))return"Boolean";if(D8(t))return"Symbol";if(_8(t))return"BigInt"},"whichBoxedPrimitive")});var G2=k((l_,F2)=>{"use strict";d();var $l=typeof WeakMap=="function"&&WeakMap.prototype?WeakMap:null,B2=typeof WeakSet=="function"&&WeakSet.prototype?WeakSet:null,Jl;$l||(Jl=l(function(t){return!1},"isWeakMap"));var Sh=$l?$l.prototype.has:null,xh=B2?B2.prototype.has:null;!Jl&&!Sh&&(Jl=l(function(t){return!1},"isWeakMap"));F2.exports=Jl||l(function(t){if(!t||typeof t!="object")return!1;try{if(Sh.call(t,Sh),xh)try{xh.call(t,xh)}catch{return!0}return t instanceof $l}catch{}return!1},"isWeakMap")});var H2=k((p_,Mh)=>{"use strict";d();var O8=Ae(),V2=he(),A8=O8("%WeakSet%",!0),Ph=V2("WeakSet.prototype.has",!0);Ph?(Kl=V2("WeakMap.prototype.has",!0),Mh.exports=l(function(t){if(!t||typeof t!="object")return!1;try{if(Ph(t,Ph),Kl)try{Kl(t,Kl)}catch{return!0}return t instanceof A8}catch{}return!1},"isWeakSet")):Mh.exports=l(function(t){return!1},"isWeakSet");var Kl});var j2=k((f_,X2)=>{"use strict";d();var k8=Qp(),N8=eh(),R8=G2(),B8=H2();X2.exports=l(function(t){if(t&&typeof t=="object"){if(k8(t))return"Map";if(N8(t))return"Set";if(R8(t))return"WeakMap";if(B8(t))return"WeakSet"}return!1},"whichCollection")});var z2=k((g_,U2)=>{"use strict";d();var Y2=Function.prototype.toString,Nn=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,Th,Ql;if(typeof Nn=="function"&&typeof Object.defineProperty=="function")try{Th=Object.defineProperty({},"length",{get:function(){throw Ql}}),Ql={},Nn(function(){throw 42},null,Th)}catch(r){r!==Ql&&(Nn=null)}else Nn=null;var F8=/^\s*class\b/,Ih=l(function(t){try{var e=Y2.call(t);return F8.test(e)}catch{return!1}},"isES6ClassFunction"),wh=l(function(t){try{return Ih(t)?!1:(Y2.call(t),!0)}catch{return!1}},"tryFunctionToStr"),tc=Object.prototype.toString,G8="[object Object]",V8="[object Function]",H8="[object GeneratorFunction]",X8="[object HTMLAllCollection]",j8="[object HTML document.all class]",W8="[object HTMLCollection]",Y8=typeof Symbol=="function"&&!!Symbol.toStringTag,U8=!(0 in[,]),Eh=l(function(){return!1},"isDocumentDotAll");typeof document=="object"&&(W2=document.all,tc.call(W2)===tc.call(document.all)&&(Eh=l(function(t){if((U8||!t)&&(typeof t>"u"||typeof t=="object"))try{var e=tc.call(t);return(e===X8||e===j8||e===W8||e===G8)&&t("")==null}catch{}return!1},"isDocumentDotAll")));var W2;U2.exports=l(Nn?function(t){if(Eh(t))return!0;if(!t||typeof t!="function"&&typeof t!="object")return!1;try{Nn(t,null,Th)}catch(e){if(e!==Ql)return!1}return!Ih(t)&&wh(t)}:function(t){if(Eh(t))return!0;if(!t||typeof t!="function"&&typeof t!="object")return!1;if(Y8)return wh(t);if(Ih(t))return!1;var e=tc.call(t);return e!==V8&&e!==H8&&!/^\[object HTML/.test(e)?!1:wh(t)},"isCallable")});var $2=k((C_,q2)=>{"use strict";d();var z8=z2(),Z8=Object.prototype.toString,Z2=Object.prototype.hasOwnProperty,q8=l(function(t,e,i){for(var n=0,o=t.length;n<o;n++)Z2.call(t,n)&&(i==null?e(t[n],n,t):e.call(i,t[n],n,t))},"forEachArray"),$8=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"),J8=l(function(t,e,i){for(var n in t)Z2.call(t,n)&&(i==null?e(t[n],n,t):e.call(i,t[n],n,t))},"forEachObject"),K8=l(function(t,e,i){if(!z8(e))throw new TypeError("iterator must be a function");var n;arguments.length>=3&&(n=i),Z8.call(t)==="[object Array]"?q8(t,e,n):typeof t=="string"?$8(t,e,n):J8(t,e,n)},"forEach");q2.exports=K8});var K2=k((P_,J2)=>{"use strict";d();J2.exports=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]});var tv=k((w_,Q2)=>{"use strict";d();var Lh=K2(),Q8=typeof globalThis>"u"?global:globalThis;Q2.exports=l(function(){for(var t=[],e=0;e<Lh.length;e++)typeof Q8[Lh[e]]=="function"&&(t[t.length]=Lh[e]);return t},"availableTypedArrays")});var ov=k((E_,nv)=>{"use strict";d();var rc=$2(),t9=tv(),ev=Ii(),Oh=he(),ec=Ol(),e9=Oh("Object.prototype.toString"),iv=Ur()(),rv=typeof globalThis>"u"?global:globalThis,_h=t9(),Ah=Oh("String.prototype.slice"),Dh=Object.getPrototypeOf,r9=Oh("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"),ic={__proto__:null};iv&&ec&&Dh?rc(_h,function(r){var t=new rv[r];if(Symbol.toStringTag in t){var e=Dh(t),i=ec(e,Symbol.toStringTag);if(!i){var n=Dh(e);i=ec(n,Symbol.toStringTag)}ic["$"+r]=ev(i.get)}}):rc(_h,function(r){var t=new rv[r],e=t.slice||t.set;e&&(ic["$"+r]=ev(e))});var i9=l(function(t){var e=!1;return rc(ic,function(i,n){if(!e)try{"$"+i(t)===n&&(e=Ah(n,1))}catch{}}),e},"tryAllTypedArrays"),n9=l(function(t){var e=!1;return rc(ic,function(i,n){if(!e)try{i(t),e=Ah(n,1)}catch{}}),e},"tryAllSlices");nv.exports=l(function(t){if(!t||typeof t!="object")return!1;if(!iv){var e=Ah(e9(t),8,-1);return r9(_h,e)>-1?e:e!=="Object"?!1:n9(t)}return ec?i9(t):null},"whichTypedArray")});var lv=k((__,sv)=>{"use strict";d();var o9=he(),av=o9("ArrayBuffer.prototype.byteLength",!0),a9=mh();sv.exports=l(function(t){return a9(t)?av?av(t):t.byteLength:NaN},"byteLength")});var Av=k((k_,Ov)=>{"use strict";d();var Lv=Gg(),Qe=he(),cv=Qg(),s9=Ae(),Rn=$0(),l9=Zp(),uv=o2(),pv=kp(),hv=$p(),dv=mh(),fv=p2(),mv=y2(),yv=b2(),gv=Ml(),vv=R2(),bv=j2(),Cv=ov(),xv=lv(),Sv=Qe("SharedArrayBuffer.prototype.byteLength",!0),Pv=Qe("Date.prototype.getTime"),kh=Object.getPrototypeOf,Mv=Qe("Object.prototype.toString"),oc=s9("%Set%",!0),Nh=Qe("Map.prototype.has",!0),ac=Qe("Map.prototype.get",!0),wv=Qe("Map.prototype.size",!0),sc=Qe("Set.prototype.add",!0),Dv=Qe("Set.prototype.delete",!0),lc=Qe("Set.prototype.has",!0),nc=Qe("Set.prototype.size",!0);function Tv(r,t,e,i){for(var n=Rn(r),o;(o=n.next())&&!o.done;)if(ke(t,o.value,e,i))return Dv(r,o.value),!0;return!1}l(Tv,"setHasEqualElement");function _v(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(_v,"findLooseMatchingPrimitives");function c9(r,t,e,i,n,o){var a=_v(e);if(a!=null)return a;var c=ac(t,a),s=Lv({},n,{strict:!1});return typeof c>"u"&&!Nh(t,a)||!ke(i,c,s,o)?!1:!Nh(r,a)&&ke(i,c,s,o)}l(c9,"mapMightHaveLoosePrim");function u9(r,t,e){var i=_v(e);return i!=null?i:lc(t,i)&&!lc(r,i)}l(u9,"setMightHaveLoosePrim");function Iv(r,t,e,i,n,o){for(var a=Rn(r),c,s;(c=a.next())&&!c.done;)if(s=c.value,ke(e,s,n,o)&&ke(i,ac(t,s),n,o))return Dv(r,s),!0;return!1}l(Iv,"mapHasEqualEntry");function ke(r,t,e,i){var n=e||{};if(n.strict?uv(r,t):r===t)return!0;var o=vv(r),a=vv(t);if(o!==a)return!1;if(!r||!t||typeof r!="object"&&typeof t!="object")return n.strict?uv(r,t):r==t;var c=i.has(r),s=i.has(t),p;if(c&&s){if(i.get(r)===i.get(t))return!0}else p={};return c||i.set(r,p),s||i.set(t,p),d9(r,t,n,i)}l(ke,"internalDeepEqual");function Ev(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(Ev,"isBuffer");function p9(r,t,e,i){if(nc(r)!==nc(t))return!1;for(var n=Rn(r),o=Rn(t),a,c,s;(a=n.next())&&!a.done;)if(a.value&&typeof a.value=="object")s||(s=new oc),sc(s,a.value);else if(!lc(t,a.value)){if(e.strict||!u9(r,t,a.value))return!1;s||(s=new oc),sc(s,a.value)}if(s){for(;(c=o.next())&&!c.done;)if(c.value&&typeof c.value=="object"){if(!Tv(s,c.value,e.strict,i))return!1}else if(!e.strict&&!lc(r,c.value)&&!Tv(s,c.value,e.strict,i))return!1;return nc(s)===0}return!0}l(p9,"setEquiv");function h9(r,t,e,i){if(wv(r)!==wv(t))return!1;for(var n=Rn(r),o=Rn(t),a,c,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 oc),sc(s,p);else if(m=ac(t,p),typeof m>"u"&&!Nh(t,p)||!ke(f,m,e,i)){if(e.strict||!c9(r,t,p,f,e,i))return!1;s||(s=new oc),sc(s,p)}if(s){for(;(c=o.next())&&!c.done;)if(p=c.value[0],m=c.value[1],p&&typeof p=="object"){if(!Iv(s,r,p,m,e,i))return!1}else if(!e.strict&&(!r.has(p)||!ke(ac(r,p),m,e,i))&&!Iv(s,r,p,m,Lv({},e,{strict:!1}),i))return!1;return nc(s)===0}return!0}l(h9,"mapEquiv");function d9(r,t,e,i){var n,o;if(typeof r!=typeof t||r==null||t==null||Mv(r)!==Mv(t)||pv(r)!==pv(t))return!1;var a=hv(r),c=hv(t);if(a!==c)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=mv(r),m=mv(t);if(f!==m||(f||m)&&(r.source!==t.source||cv(r)!==cv(t)))return!1;var y=fv(r),x=fv(t);if(y!==x||(y||x)&&Pv(r)!==Pv(t)||e.strict&&kh&&kh(r)!==kh(t))return!1;var S=Cv(r),M=Cv(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=Ev(r),C=Ev(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=dv(r),T=dv(t);if(I!==T)return!1;if(I||T)return xv(r)!==xv(t)?!1:typeof Uint8Array=="function"&&ke(new Uint8Array(r),new Uint8Array(t),e,i);var w=yv(r),L=yv(t);if(w!==L)return!1;if(w||L)return Sv(r)!==Sv(t)?!1:typeof Uint8Array=="function"&&ke(new Uint8Array(r),new Uint8Array(t),e,i);if(typeof r!=typeof t)return!1;var _=gv(r),R=gv(t);if(_.length!==R.length)return!1;for(_.sort(),R.sort(),n=_.length-1;n>=0;n--)if(_[n]!=R[n])return!1;for(n=_.length-1;n>=0;n--)if(o=_[n],!ke(r[o],t[o],e,i))return!1;var G=bv(r),N=bv(t);return G!==N?!1:G==="Set"||N==="Set"?p9(r,t,e,i):G==="Map"?h9(r,t,e,i):!0}l(d9,"objEquiv");Ov.exports=l(function(t,e,i){return ke(t,e,i,l9())},"deepEqual")});var qv=k(nt=>{"use strict";d();Object.defineProperty(nt,"__esModule",{value:!0});function f9(r){return r&&r.__esModule?r:{default:r}}l(f9,"_interopRequireDefault");var m9=Object.defineProperty,at=l((r,t)=>m9(r,"name",{value:t,configurable:!0}),"__name"),y9=Av(),g9=f9(y9),sa,kv=(sa=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||!oa(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=Rh(t),n=Rh(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(!oa(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 c=this.compareCoord(o[i],a[i]);return this.direction||c?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 oa(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?g9.default.call(void 0,t.properties,e.properties):!0)&&this.compareBBox(t,e)&&this.compare(t.geometry,e.geometry)}compareFeatureCollection(t,e){return oa(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(sa,"_GeojsonEquality"),sa);at(kv,"GeojsonEquality");var v9=kv;function oa(r,t){return r.coordinates?r.coordinates.length===t.coordinates.length:r.length===t.length}l(oa,"sameLength");at(oa,"sameLength");function Rh(r){return r.coordinates.map(t=>({type:r.type.replace("Multi",""),coordinates:t}))}l(Rh,"explode");at(Rh,"explode");var ne=63710088e-1,Fh={centimeters:ne*100,centimetres:ne*100,degrees:360/(2*Math.PI),feet:ne*3.28084,inches:ne*39.37,kilometers:ne/1e3,kilometres:ne/1e3,meters:ne,metres:ne,miles:ne/1609.344,millimeters:ne*1e3,millimetres:ne*1e3,nauticalmiles:ne/1852,radians:1,yards:ne*1.0936},Bh={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 xr(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(xr,"feature");at(xr,"feature");function Nv(r,t,e={}){switch(r){case"Point":return cc(t).geometry;case"LineString":return pc(t).geometry;case"Polygon":return uc(t).geometry;case"MultiPoint":return Vh(t).geometry;case"MultiLineString":return Gh(t).geometry;case"MultiPolygon":return Hh(t).geometry;default:throw new Error(r+" is invalid")}}l(Nv,"geometry");at(Nv,"geometry");function cc(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(!aa(r[0])||!aa(r[1]))throw new Error("coordinates must contain numbers");return xr({type:"Point",coordinates:r},t,e)}l(cc,"point");at(cc,"point");function Rv(r,t,e={}){return la(r.map(i=>cc(i,t)),e)}l(Rv,"points");at(Rv,"points");function uc(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 xr({type:"Polygon",coordinates:r},t,e)}l(uc,"polygon");at(uc,"polygon");function Bv(r,t,e={}){return la(r.map(i=>uc(i,t)),e)}l(Bv,"polygons");at(Bv,"polygons");function pc(r,t,e={}){if(r.length<2)throw new Error("coordinates must be an array of two or more positions");return xr({type:"LineString",coordinates:r},t,e)}l(pc,"lineString");at(pc,"lineString");function Fv(r,t,e={}){return la(r.map(i=>pc(i,t)),e)}l(Fv,"lineStrings");at(Fv,"lineStrings");function la(r,t={}){let e={type:"FeatureCollection"};return t.id&&(e.id=t.id),t.bbox&&(e.bbox=t.bbox),e.features=r,e}l(la,"featureCollection");at(la,"featureCollection");function Gh(r,t,e={}){return xr({type:"MultiLineString",coordinates:r},t,e)}l(Gh,"multiLineString");at(Gh,"multiLineString");function Vh(r,t,e={}){return xr({type:"MultiPoint",coordinates:r},t,e)}l(Vh,"multiPoint");at(Vh,"multiPoint");function Hh(r,t,e={}){return xr({type:"MultiPolygon",coordinates:r},t,e)}l(Hh,"multiPolygon");at(Hh,"multiPolygon");function Gv(r,t,e={}){return xr({type:"GeometryCollection",geometries:r},t,e)}l(Gv,"geometryCollection");at(Gv,"geometryCollection");function Vv(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(Vv,"round");at(Vv,"round");function Xh(r,t="kilometers"){let e=Fh[t];if(!e)throw new Error(t+" units is invalid");return r*e}l(Xh,"radiansToLength");at(Xh,"radiansToLength");function hc(r,t="kilometers"){let e=Fh[t];if(!e)throw new Error(t+" units is invalid");return r/e}l(hc,"lengthToRadians");at(hc,"lengthToRadians");function Hv(r,t){return jh(hc(r,t))}l(Hv,"lengthToDegrees");at(Hv,"lengthToDegrees");function Xv(r){let t=r%360;return t<0&&(t+=360),t}l(Xv,"bearingToAzimuth");at(Xv,"bearingToAzimuth");function jh(r){return r%(2*Math.PI)*180/Math.PI}l(jh,"radiansToDegrees");at(jh,"radiansToDegrees");function jv(r){return r%360*Math.PI/180}l(jv,"degreesToRadians");at(jv,"degreesToRadians");function Wv(r,t="kilometers",e="kilometers"){if(!(r>=0))throw new Error("length must be a positive number");return Xh(hc(r,t),e)}l(Wv,"convertLength");at(Wv,"convertLength");function Yv(r,t="meters",e="kilometers"){if(!(r>=0))throw new Error("area must be a positive number");let i=Bh[t];if(!i)throw new Error("invalid original units");let n=Bh[e];if(!n)throw new Error("invalid final units");return r/i*n}l(Yv,"convertArea");at(Yv,"convertArea");function aa(r){return!isNaN(r)&&r!==null&&!Array.isArray(r)}l(aa,"isNumber");at(aa,"isNumber");function Uv(r){return r!==null&&typeof r=="object"&&!Array.isArray(r)}l(Uv,"isObject");at(Uv,"isObject");function zv(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(!aa(t))throw new Error("bbox must only contain numbers")})}l(zv,"validateBBox");at(zv,"validateBBox");function Zv(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(Zv,"validateId");at(Zv,"validateId");nt.GeojsonEquality=v9;nt.areaFactors=Bh;nt.bearingToAzimuth=Xv;nt.convertArea=Yv;nt.convertLength=Wv;nt.degreesToRadians=jv;nt.earthRadius=ne;nt.factors=Fh;nt.feature=xr;nt.featureCollection=la;nt.geometry=Nv;nt.geometryCollection=Gv;nt.isNumber=aa;nt.isObject=Uv;nt.lengthToDegrees=Hv;nt.lengthToRadians=hc;nt.lineString=pc;nt.lineStrings=Fv;nt.multiLineString=Gh;nt.multiPoint=Vh;nt.multiPolygon=Hh;nt.point=cc;nt.points=Rv;nt.polygon=uc;nt.polygons=Bv;nt.radiansToDegrees=jh;nt.radiansToLength=Xh;nt.round=Vv;nt.validateBBox=zv;nt.validateId=Zv});var a3=k(Lt=>{"use strict";d();Object.defineProperty(Lt,"__esModule",{value:!0});var b9=Object.defineProperty,Gt=l((r,t)=>b9(r,"name",{value:t,configurable:!0}),"__name"),Yt=qv();function Bn(r,t,e){if(r!==null)for(var i,n,o,a,c,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,c=y?p.geometries.length:1;for(var I=0;I<c;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(Bn(a.geometries[i],t,e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}l(Bn,"coordEach");Gt(Bn,"coordEach");function $v(r,t,e,i){var n=e;return Bn(r,function(o,a,c,s,p){a===0&&e===void 0?n=o:n=t(n,o,a,c,s,p)},i),n}l($v,"coordReduce");Gt($v,"coordReduce");function Wh(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(Wh,"propEach");Gt(Wh,"propEach");function Jv(r,t,e){var i=e;return Wh(r,function(n,o){o===0&&e===void 0?i=n:i=t(i,n,o)}),i}l(Jv,"propReduce");Gt(Jv,"propReduce");function Yh(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(Yh,"featureEach");Gt(Yh,"featureEach");function Kv(r,t,e){var i=e;return Yh(r,function(n,o){o===0&&e===void 0?i=n:i=t(i,n,o)}),i}l(Kv,"featureReduce");Gt(Kv,"featureReduce");function Qv(r){var t=[];return Bn(r,function(e){t.push(e)}),t}l(Qv,"coordAll");Gt(Qv,"coordAll");function dc(r,t){var e,i,n,o,a,c,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(c=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=c?c.type==="GeometryCollection":!1,a=s?c.geometries.length:1,n=0;n<a;n++){if(o=s?c.geometries[n]:c,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(dc,"geomEach");Gt(dc,"geomEach");function t3(r,t,e){var i=e;return dc(r,function(n,o,a,c,s){o===0&&e===void 0?i=n:i=t(i,n,o,a,c,s)}),i}l(t3,"geomReduce");Gt(t3,"geomReduce");function ca(r,t){dc(r,function(e,i,n,o,a){var c=e===null?null:e.type;switch(c){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(c){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(ca,"flattenEach");Gt(ca,"flattenEach");function e3(r,t,e){var i=e;return ca(r,function(n,o,a){o===0&&a===0&&e===void 0?i=n:i=t(i,n,o,a)}),i}l(e3,"flattenReduce");Gt(e3,"flattenReduce");function Uh(r,t){ca(r,function(e,i,n){var o=0;if(e.geometry){var a=e.geometry.type;if(!(a==="Point"||a==="MultiPoint")){var c,s=0,p=0,f=0;if(Bn(e,function(m,y,x,S,M){if(c===void 0||i>s||S>p||M>f){c=m,s=i,p=S,f=M,o=0;return}var g=Yt.lineString.call(void 0,[c,m],e.properties);if(t(g,i,n,M,o)===!1)return!1;o++,c=m})===!1)return!1}}})}l(Uh,"segmentEach");Gt(Uh,"segmentEach");function r3(r,t,e){var i=e,n=!1;return Uh(r,function(o,a,c,s,p){n===!1&&e===void 0?i=o:i=t(i,o,a,c,s,p),n=!0}),i}l(r3,"segmentReduce");Gt(r3,"segmentReduce");function zh(r,t){if(!r)throw new Error("geojson is required");ca(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 c=0;c<a.length;c++)if(t(Yt.lineString.call(void 0,a[c],e.properties),i,n,c)===!1)return!1;break}}})}l(zh,"lineEach");Gt(zh,"lineEach");function i3(r,t,e){var i=e;return zh(r,function(n,o,a,c){o===0&&e===void 0?i=n:i=t(i,n,o,a,c)}),i}l(i3,"lineReduce");Gt(i3,"lineReduce");function n3(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,c;switch(r.type){case"FeatureCollection":e<0&&(e=r.features.length+e),a=a||r.features[e].properties,c=r.features[e].geometry;break;case"Feature":a=a||r.properties,c=r.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":c=r;break;default:throw new Error("geojson is invalid")}if(c===null)return null;var s=c.coordinates;switch(c.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(n3,"findSegment");Gt(n3,"findSegment");function o3(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,c;switch(r.type){case"FeatureCollection":e<0&&(e=r.features.length+e),a=a||r.features[e].properties,c=r.features[e].geometry;break;case"Feature":a=a||r.properties,c=r.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":c=r;break;default:throw new Error("geojson is invalid")}if(c===null)return null;var s=c.coordinates;switch(c.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(o3,"findPoint");Gt(o3,"findPoint");Lt.coordAll=Qv;Lt.coordEach=Bn;Lt.coordReduce=$v;Lt.featureEach=Yh;Lt.featureReduce=Kv;Lt.findPoint=o3;Lt.findSegment=n3;Lt.flattenEach=ca;Lt.flattenReduce=e3;Lt.geomEach=dc;Lt.geomReduce=t3;Lt.lineEach=zh;Lt.lineReduce=i3;Lt.propEach=Wh;Lt.propReduce=Jv;Lt.segmentEach=Uh;Lt.segmentReduce=r3});var s3=k(fc=>{"use strict";d();Object.defineProperty(fc,"__esModule",{value:!0});var C9=Object.defineProperty,x9=l((r,t)=>C9(r,"name",{value:t,configurable:!0}),"__name"),S9=a3();function Zh(r,t={}){if(r.bbox!=null&&t.recompute!==!0)return r.bbox;let e=[1/0,1/0,-1/0,-1/0];return S9.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(Zh,"bbox");x9(Zh,"bbox");var P9=Zh;fc.bbox=Zh;fc.default=P9});var h3=k((Z_,qh)=>{d();var tr=ay(),c3=yp(),u3=yy(),Fn=s3().default,M9=u3.featureEach,U_=u3.coordEach,z_=c3.polygon,l3=c3.featureCollection;function p3(r){var t=new tr(r);return t.insert=function(e){if(e.type!=="Feature")throw new Error("invalid feature");return e.bbox=e.bbox?e.bbox:Fn(e),tr.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:Fn(n),i.push(n)}):M9(e,function(n){if(n.type!=="Feature")throw new Error("invalid features");n.bbox=n.bbox?n.bbox:Fn(n),i.push(n)}),tr.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:Fn(e),tr.prototype.remove.call(this,e,i)},t.clear=function(){return tr.prototype.clear.call(this)},t.search=function(e){var i=tr.prototype.search.call(this,this.toBBox(e));return l3(i)},t.collides=function(e){return tr.prototype.collides.call(this,this.toBBox(e))},t.all=function(){var e=tr.prototype.all.call(this);return l3(e)},t.toJSON=function(){return tr.prototype.toJSON.call(this)},t.fromJSON=function(e){return tr.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=Fn(e);else if(e.type==="FeatureCollection")i=Fn(e);else throw new Error("invalid geojson");return{minX:i[0],minY:i[1],maxX:i[2],maxY:i[3]}},t}l(p3,"geojsonRbush");qh.exports=p3;qh.exports.default=p3});var po=k((nf,of)=>{d();var af=l(function(){this._tweens={},this._tweensAddedDuringUpdate={}},"_Group");af.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:lt.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 lt=new af;lt.Group=af;lt._nextId=0;lt.nextId=function(){return lt._nextId++};typeof self>"u"&&typeof b<"u"&&b.hrtime?lt.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?lt.now=self.performance.now.bind(self.performance):Date.now!==void 0?lt.now=Date.now:lt.now=function(){return new Date().getTime()};lt.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=lt.Easing.Linear.None,this._interpolationFunction=lt.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||lt,this._id=lt.nextId()};lt.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"?lt.now()+parseFloat(r):r:lt.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 c=0,s=this._chainedTweens.length;c<s;c++)this._chainedTweens[c].start(this._startTime+this._duration);return!1}return!0}};lt.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-lt.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?lt.Easing.Bounce.In(r*2)*.5:lt.Easing.Bounce.Out(r*2-1)*.5+.5}}};lt.Interpolation={Linear:function(r,t){var e=r.length-1,i=e*t,n=Math.floor(i),o=lt.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=lt.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=lt.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=lt.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,c=n*n,s=n*c;return(2*t-2*e+o+a)*s+(-3*t+3*e-2*o-a)*c+o*n+t}}};(function(r){typeof define=="function"&&define.amd?define([],function(){return lt}):typeof of<"u"&&typeof nf=="object"?of.exports=lt:r!==void 0&&(r.TWEEN=lt)})(nf)});var l4=k((Qa,yo)=>{d();var Dx=200,Hb="__lodash_hash_undefined__",_x=800,Ox=16,Xb=9007199254740991,jb="[object Arguments]",Ax="[object Array]",kx="[object AsyncFunction]",Nx="[object Boolean]",Rx="[object Date]",Bx="[object Error]",Wb="[object Function]",Fx="[object GeneratorFunction]",Gx="[object Map]",Vx="[object Number]",Hx="[object Null]",Yb="[object Object]",Xx="[object Proxy]",jx="[object RegExp]",Wx="[object Set]",Yx="[object String]",Ux="[object Undefined]",zx="[object WeakMap]",Zx="[object ArrayBuffer]",qx="[object DataView]",$x="[object Float32Array]",Jx="[object Float64Array]",Kx="[object Int8Array]",Qx="[object Int16Array]",tS="[object Int32Array]",eS="[object Uint8Array]",rS="[object Uint8ClampedArray]",iS="[object Uint16Array]",nS="[object Uint32Array]",oS=/[\\^$.*+?()[\]{}|]/g,aS=/^\[object .+?Constructor\]$/,sS=/^(?:0|[1-9]\d*)$/,ht={};ht[$x]=ht[Jx]=ht[Kx]=ht[Qx]=ht[tS]=ht[eS]=ht[rS]=ht[iS]=ht[nS]=!0;ht[jb]=ht[Ax]=ht[Zx]=ht[Nx]=ht[qx]=ht[Rx]=ht[Bx]=ht[Wb]=ht[Gx]=ht[Vx]=ht[Yb]=ht[jx]=ht[Wx]=ht[Yx]=ht[zx]=!1;var Ub=typeof global=="object"&&global&&global.Object===Object&&global,lS=typeof self=="object"&&self&&self.Object===Object&&self,rs=Ub||lS||Function("return this")(),zb=typeof Qa=="object"&&Qa&&!Qa.nodeType&&Qa,ts=zb&&typeof yo=="object"&&yo&&!yo.nodeType&&yo,Zb=ts&&ts.exports===zb,Af=Zb&&Ub.process,Ob=function(){try{var r=ts&&ts.require&&ts.require("util").types;return r||Af&&Af.binding&&Af.binding("util")}catch{}}(),Ab=Ob&&Ob.isTypedArray;function qb(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(qb,"apply");function cS(r,t){for(var e=-1,i=Array(r);++e<r;)i[e]=t(e);return i}l(cS,"baseTimes");function uS(r){return function(t){return r(t)}}l(uS,"baseUnary");function pS(r,t){return r==null?void 0:r[t]}l(pS,"getValue");function hS(r,t){return function(e){return r(t(e))}}l(hS,"overArg");var dS=Array.prototype,fS=Function.prototype,tu=Object.prototype,kf=rs["__core-js_shared__"],eu=fS.toString,Ar=tu.hasOwnProperty,kb=function(){var r=/[^.]+$/.exec(kf&&kf.keys&&kf.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""}(),$b=tu.toString,mS=eu.call(Object),yS=RegExp("^"+eu.call(Ar).replace(oS,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Kc=Zb?rs.Buffer:void 0,Nb=rs.Symbol,Rb=rs.Uint8Array,Bb=Kc?Kc.allocUnsafe:void 0,Jb=hS(Object.getPrototypeOf,Object),Fb=Object.create,gS=tu.propertyIsEnumerable,vS=dS.splice,en=Nb?Nb.toStringTag:void 0,Qc=function(){try{var r=Hf(Object,"defineProperty");return r({},"",{}),r}catch{}}(),bS=Kc?Kc.isBuffer:void 0,Gb=Math.max,CS=Date.now,Kb=Hf(rs,"Map"),es=Hf(Object,"create"),xS=function(){function r(){}return l(r,"object"),function(t){if(!Or(t))return{};if(Fb)return Fb(t);r.prototype=t;var e=new r;return r.prototype=void 0,e}}();function rn(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(rn,"Hash");function SS(){this.__data__=es?es(null):{},this.size=0}l(SS,"hashClear");function PS(r){var t=this.has(r)&&delete this.__data__[r];return this.size-=t?1:0,t}l(PS,"hashDelete");function MS(r){var t=this.__data__;if(es){var e=t[r];return e===Hb?void 0:e}return Ar.call(t,r)?t[r]:void 0}l(MS,"hashGet");function wS(r){var t=this.__data__;return es?t[r]!==void 0:Ar.call(t,r)}l(wS,"hashHas");function TS(r,t){var e=this.__data__;return this.size+=this.has(r)?0:1,e[r]=es&&t===void 0?Hb:t,this}l(TS,"hashSet");rn.prototype.clear=SS;rn.prototype.delete=PS;rn.prototype.get=MS;rn.prototype.has=wS;rn.prototype.set=TS;function kr(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(kr,"ListCache");function IS(){this.__data__=[],this.size=0}l(IS,"listCacheClear");function ES(r){var t=this.__data__,e=ru(t,r);if(e<0)return!1;var i=t.length-1;return e==i?t.pop():vS.call(t,e,1),--this.size,!0}l(ES,"listCacheDelete");function LS(r){var t=this.__data__,e=ru(t,r);return e<0?void 0:t[e][1]}l(LS,"listCacheGet");function DS(r){return ru(this.__data__,r)>-1}l(DS,"listCacheHas");function _S(r,t){var e=this.__data__,i=ru(e,r);return i<0?(++this.size,e.push([r,t])):e[i][1]=t,this}l(_S,"listCacheSet");kr.prototype.clear=IS;kr.prototype.delete=ES;kr.prototype.get=LS;kr.prototype.has=DS;kr.prototype.set=_S;function go(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(go,"MapCache");function OS(){this.size=0,this.__data__={hash:new rn,map:new(Kb||kr),string:new rn}}l(OS,"mapCacheClear");function AS(r){var t=nu(this,r).delete(r);return this.size-=t?1:0,t}l(AS,"mapCacheDelete");function kS(r){return nu(this,r).get(r)}l(kS,"mapCacheGet");function NS(r){return nu(this,r).has(r)}l(NS,"mapCacheHas");function RS(r,t){var e=nu(this,r),i=e.size;return e.set(r,t),this.size+=e.size==i?0:1,this}l(RS,"mapCacheSet");go.prototype.clear=OS;go.prototype.delete=AS;go.prototype.get=kS;go.prototype.has=NS;go.prototype.set=RS;function vo(r){var t=this.__data__=new kr(r);this.size=t.size}l(vo,"Stack");function BS(){this.__data__=new kr,this.size=0}l(BS,"stackClear");function FS(r){var t=this.__data__,e=t.delete(r);return this.size=t.size,e}l(FS,"stackDelete");function GS(r){return this.__data__.get(r)}l(GS,"stackGet");function VS(r){return this.__data__.has(r)}l(VS,"stackHas");function HS(r,t){var e=this.__data__;if(e instanceof kr){var i=e.__data__;if(!Kb||i.length<Dx-1)return i.push([r,t]),this.size=++e.size,this;e=this.__data__=new go(i)}return e.set(r,t),this.size=e.size,this}l(HS,"stackSet");vo.prototype.clear=BS;vo.prototype.delete=FS;vo.prototype.get=GS;vo.prototype.has=VS;vo.prototype.set=HS;function XS(r,t){var e=Ff(r),i=!e&&Bf(r),n=!e&&!i&&i4(r),o=!e&&!i&&!n&&o4(r),a=e||i||n||o,c=a?cS(r.length,String):[],s=c.length;for(var p in r)(t||Ar.call(r,p))&&!(a&&(p=="length"||n&&(p=="offset"||p=="parent")||o&&(p=="buffer"||p=="byteLength"||p=="byteOffset")||e4(p,s)))&&c.push(p);return c}l(XS,"arrayLikeKeys");function Nf(r,t,e){(e!==void 0&&!ou(r[t],e)||e===void 0&&!(t in r))&&Gf(r,t,e)}l(Nf,"assignMergeValue");function jS(r,t,e){var i=r[t];(!(Ar.call(r,t)&&ou(i,e))||e===void 0&&!(t in r))&&Gf(r,t,e)}l(jS,"assignValue");function ru(r,t){for(var e=r.length;e--;)if(ou(r[e][0],t))return e;return-1}l(ru,"assocIndexOf");function Gf(r,t,e){t=="__proto__"&&Qc?Qc(r,t,{configurable:!0,enumerable:!0,value:e,writable:!0}):r[t]=e}l(Gf,"baseAssignValue");var WS=rP();function iu(r){return r==null?r===void 0?Ux:Hx:en&&en in Object(r)?iP(r):cP(r)}l(iu,"baseGetTag");function Vb(r){return is(r)&&iu(r)==jb}l(Vb,"baseIsArguments");function YS(r){if(!Or(r)||sP(r))return!1;var t=jf(r)?yS:aS;return t.test(dP(r))}l(YS,"baseIsNative");function US(r){return is(r)&&n4(r.length)&&!!ht[iu(r)]}l(US,"baseIsTypedArray");function zS(r){if(!Or(r))return lP(r);var t=r4(r),e=[];for(var i in r)i=="constructor"&&(t||!Ar.call(r,i))||e.push(i);return e}l(zS,"baseKeysIn");function Vf(r,t,e,i,n){r!==t&&WS(t,function(o,a){if(n||(n=new vo),Or(o))ZS(r,t,a,e,Vf,i,n);else{var c=i?i(Rf(r,a),o,a+"",r,t,n):void 0;c===void 0&&(c=o),Nf(r,a,c)}},a4)}l(Vf,"baseMerge");function ZS(r,t,e,i,n,o,a){var c=Rf(r,e),s=Rf(t,e),p=a.get(s);if(p){Nf(r,e,p);return}var f=o?o(c,s,e+"",r,t,a):void 0,m=f===void 0;if(m){var y=Ff(s),x=!y&&i4(s),S=!y&&!x&&o4(s);f=s,y||x||S?Ff(c)?f=c:fP(c)?f=QS(c):x?(m=!1,f=$S(s,!0)):S?(m=!1,f=KS(s,!0)):f=[]:mP(s)||Bf(s)?(f=c,Bf(c)?f=yP(c):(!Or(c)||jf(c))&&(f=nP(s))):m=!1}m&&(a.set(s,f),n(f,s,i,o,a),a.delete(s)),Nf(r,e,f)}l(ZS,"baseMergeDeep");function Qb(r,t){return pP(uP(r,t,s4),r+"")}l(Qb,"baseRest");var qS=Qc?function(r,t){return Qc(r,"toString",{configurable:!0,enumerable:!1,value:bP(t),writable:!0})}:s4;function $S(r,t){if(t)return r.slice();var e=r.length,i=Bb?Bb(e):new r.constructor(e);return r.copy(i),i}l($S,"cloneBuffer");function JS(r){var t=new r.constructor(r.byteLength);return new Rb(t).set(new Rb(r)),t}l(JS,"cloneArrayBuffer");function KS(r,t){var e=t?JS(r.buffer):r.buffer;return new r.constructor(e,r.byteOffset,r.length)}l(KS,"cloneTypedArray");function QS(r,t){var e=-1,i=r.length;for(t||(t=Array(i));++e<i;)t[e]=r[e];return t}l(QS,"copyArray");function tP(r,t,e,i){var n=!e;e||(e={});for(var o=-1,a=t.length;++o<a;){var c=t[o],s=i?i(e[c],r[c],c,e,r):void 0;s===void 0&&(s=r[c]),n?Gf(e,c,s):jS(e,c,s)}return e}l(tP,"copyObject");function eP(r){return Qb(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&&oP(e[0],e[1],a)&&(o=n<3?void 0:o,n=1),t=Object(t);++i<n;){var c=e[i];c&&r(t,c,i,o)}return t})}l(eP,"createAssigner");function rP(r){return function(t,e,i){for(var n=-1,o=Object(t),a=i(t),c=a.length;c--;){var s=a[r?c:++n];if(e(o[s],s,o)===!1)break}return t}}l(rP,"createBaseFor");function t4(r,t,e,i,n,o){return Or(r)&&Or(t)&&(o.set(t,r),Vf(r,t,void 0,t4,o),o.delete(t)),r}l(t4,"customDefaultsMerge");function nu(r,t){var e=r.__data__;return aP(t)?e[typeof t=="string"?"string":"hash"]:e.map}l(nu,"getMapData");function Hf(r,t){var e=pS(r,t);return YS(e)?e:void 0}l(Hf,"getNative");function iP(r){var t=Ar.call(r,en),e=r[en];try{r[en]=void 0;var i=!0}catch{}var n=$b.call(r);return i&&(t?r[en]=e:delete r[en]),n}l(iP,"getRawTag");function nP(r){return typeof r.constructor=="function"&&!r4(r)?xS(Jb(r)):{}}l(nP,"initCloneObject");function e4(r,t){var e=typeof r;return t=t==null?Xb:t,!!t&&(e=="number"||e!="symbol"&&sS.test(r))&&r>-1&&r%1==0&&r<t}l(e4,"isIndex");function oP(r,t,e){if(!Or(e))return!1;var i=typeof t;return(i=="number"?Xf(e)&&e4(t,e.length):i=="string"&&t in e)?ou(e[t],r):!1}l(oP,"isIterateeCall");function aP(r){var t=typeof r;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?r!=="__proto__":r===null}l(aP,"isKeyable");function sP(r){return!!kb&&kb in r}l(sP,"isMasked");function r4(r){var t=r&&r.constructor,e=typeof t=="function"&&t.prototype||tu;return r===e}l(r4,"isPrototype");function lP(r){var t=[];if(r!=null)for(var e in Object(r))t.push(e);return t}l(lP,"nativeKeysIn");function cP(r){return $b.call(r)}l(cP,"objectToString");function uP(r,t,e){return t=Gb(t===void 0?r.length-1:t,0),function(){for(var i=arguments,n=-1,o=Gb(i.length-t,0),a=Array(o);++n<o;)a[n]=i[t+n];n=-1;for(var c=Array(t+1);++n<t;)c[n]=i[n];return c[t]=e(a),qb(r,this,c)}}l(uP,"overRest");function Rf(r,t){if(!(t==="constructor"&&typeof r[t]=="function")&&t!="__proto__")return r[t]}l(Rf,"safeGet");var pP=hP(qS);function hP(r){var t=0,e=0;return function(){var i=CS(),n=Ox-(i-e);if(e=i,n>0){if(++t>=_x)return arguments[0]}else t=0;return r.apply(void 0,arguments)}}l(hP,"shortOut");function dP(r){if(r!=null){try{return eu.call(r)}catch{}try{return r+""}catch{}}return""}l(dP,"toSource");function ou(r,t){return r===t||r!==r&&t!==t}l(ou,"eq");var Bf=Vb(function(){return arguments}())?Vb:function(r){return is(r)&&Ar.call(r,"callee")&&!gS.call(r,"callee")},Ff=Array.isArray;function Xf(r){return r!=null&&n4(r.length)&&!jf(r)}l(Xf,"isArrayLike");function fP(r){return is(r)&&Xf(r)}l(fP,"isArrayLikeObject");var i4=bS||CP;function jf(r){if(!Or(r))return!1;var t=iu(r);return t==Wb||t==Fx||t==kx||t==Xx}l(jf,"isFunction");function n4(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=Xb}l(n4,"isLength");function Or(r){var t=typeof r;return r!=null&&(t=="object"||t=="function")}l(Or,"isObject");function is(r){return r!=null&&typeof r=="object"}l(is,"isObjectLike");function mP(r){if(!is(r)||iu(r)!=Yb)return!1;var t=Jb(r);if(t===null)return!0;var e=Ar.call(t,"constructor")&&t.constructor;return typeof e=="function"&&e instanceof e&&eu.call(e)==mS}l(mP,"isPlainObject");var o4=Ab?uS(Ab):US;function yP(r){return tP(r,a4(r))}l(yP,"toPlainObject");var gP=Qb(function(r){return r.push(void 0,t4),qb(vP,void 0,r)});function a4(r){return Xf(r)?XS(r,!0):zS(r)}l(a4,"keysIn");var vP=eP(function(r,t,e,i){Vf(r,t,e,i)});function bP(r){return function(){return r}}l(bP,"constant");function s4(r){return r}l(s4,"identity");function CP(){return!1}l(CP,"stubFalse");yo.exports=gP});var X4=k((Bj,ps)=>{"use strict";d();var GP=!1,ln=!1,N4=!0,R4=!1,h={},B4=!1;typeof ps<"u"&&ps.exports?(ps.exports=h,B4=!0):typeof document<"u"?window.ClipperLib=h:self.ClipperLib=h;var gu;B4?(At="chrome",gu="Netscape"):(At=navigator.userAgent.toString().toLowerCase(),gu=navigator.appName);var At,q={};At.indexOf("chrome")!=-1&&At.indexOf("chromium")==-1?q.chrome=1:q.chrome=0;At.indexOf("chromium")!=-1?q.chromium=1:q.chromium=0;At.indexOf("safari")!=-1&&At.indexOf("chrome")==-1&&At.indexOf("chromium")==-1?q.safari=1:q.safari=0;At.indexOf("firefox")!=-1?q.firefox=1:q.firefox=0;At.indexOf("firefox/17")!=-1?q.firefox17=1:q.firefox17=0;At.indexOf("firefox/15")!=-1?q.firefox15=1:q.firefox15=0;At.indexOf("firefox/3")!=-1?q.firefox3=1:q.firefox3=0;At.indexOf("opera")!=-1?q.opera=1:q.opera=0;At.indexOf("msie 10")!=-1?q.msie10=1:q.msie10=0;At.indexOf("msie 9")!=-1?q.msie9=1:q.msie9=0;At.indexOf("msie 8")!=-1?q.msie8=1:q.msie8=0;At.indexOf("msie 7")!=-1?q.msie7=1:q.msie7=0;At.indexOf("msie ")!=-1?q.msie=1:q.msie=0;h.biginteger_used=null;var fi,VP=0xdeadbeefcafe,A4=(VP&16777215)==15715070;function A(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(A,"BigInteger");function K(){return new A(null)}l(K,"nbi");function HP(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(HP,"am1");function XP(r,t,e,i,n,o){for(var a=t&32767,c=t>>15;--o>=0;){var s=this[r]&32767,p=this[r++]>>15,f=c*s+p*a;s=a*s+((f&32767)<<15)+e[i]+(n&1073741823),n=(s>>>30)+(f>>>15)+c*p+(n>>>30),e[i++]=s&1073741823}return n}l(XP,"am2");function jP(r,t,e,i,n,o){for(var a=t&16383,c=t>>14;--o>=0;){var s=this[r]&16383,p=this[r++]>>14,f=c*s+p*a;s=a*s+((f&16383)<<14)+e[i]+n,n=(s>>28)+(f>>14)+c*p,e[i++]=s&268435455}return n}l(jP,"am3");A4&&gu=="Microsoft Internet Explorer"?(A.prototype.am=XP,fi=30):A4&&gu!="Netscape"?(A.prototype.am=HP,fi=26):(A.prototype.am=jP,fi=28);A.prototype.DB=fi;A.prototype.DM=(1<<fi)-1;A.prototype.DV=1<<fi;var am=52;A.prototype.FV=Math.pow(2,am);A.prototype.F1=am-fi;A.prototype.F2=2*fi-am;var WP="0123456789abcdefghijklmnopqrstuvwxyz",bu=new Array,Po,we;Po=48;for(we=0;we<=9;++we)bu[Po++]=we;Po=97;for(we=10;we<36;++we)bu[Po++]=we;Po=65;for(we=10;we<36;++we)bu[Po++]=we;function k4(r){return WP.charAt(r)}l(k4,"int2char");function F4(r,t){var e=bu[r.charCodeAt(t)];return e==null?-1:e}l(F4,"intAt");function YP(r){for(var t=this.t-1;t>=0;--t)r[t]=this[t];r.t=this.t,r.s=this.s}l(YP,"bnpCopyTo");function UP(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(UP,"bnpFromInt");function di(r){var t=K();return t.fromInt(r),t}l(di,"nbv");function zP(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:F4(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&&A.ZERO.subTo(this,this)}l(zP,"bnpFromString");function ZP(){for(var r=this.s&this.DM;this.t>0&&this[this.t-1]==r;)--this.t}l(ZP,"bnpClamp");function qP(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,c=this.DB-a*this.DB%t;if(a-- >0)for(c<this.DB&&(i=this[a]>>c)>0&&(n=!0,o=k4(i));a>=0;)c<t?(i=(this[a]&(1<<c)-1)<<t-c,i|=this[--a]>>(c+=this.DB-t)):(i=this[a]>>(c-=t)&e,c<=0&&(c+=this.DB,--a)),i>0&&(n=!0),n&&(o+=k4(i));return n?o:"0"}l(qP,"bnToString");function $P(){var r=K();return A.ZERO.subTo(this,r),r}l($P,"bnNegate");function JP(){return this.s<0?this.negate():this}l(JP,"bnAbs");function KP(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(KP,"bnCompareTo");function Cu(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(Cu,"nbits");function QP(){return this.t<=0?0:this.DB*(this.t-1)+Cu(this[this.t-1]^this.s&this.DM)}l(QP,"bnBitLength");function tM(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(tM,"bnpDLShiftTo");function eM(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(eM,"bnpDRShiftTo");function rM(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,c;for(c=this.t-1;c>=0;--c)t[c+o+1]=this[c]>>i|a,a=(this[c]&n)<<e;for(c=o-1;c>=0;--c)t[c]=0;t[o]=a,t.t=this.t+o+1,t.s=this.s,t.clamp()}l(rM,"bnpLShiftTo");function iM(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(iM,"bnpRShiftTo");function nM(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(nM,"bnpSubTo");function oM(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&&A.ZERO.subTo(t,t)}l(oM,"bnpMultiplyTo");function aM(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(aM,"bnpSquareTo");function sM(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,c=r.s,s=this.DB-Cu(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)),A.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!=c&&A.ZERO.subTo(t,t)),e.t=p,e.clamp(),s>0&&e.rShiftTo(s,e),a<0&&A.ZERO.subTo(e,e)}}}l(sM,"bnpDivRemTo");function lM(r){var t=K();return this.abs().divRemTo(r,null,t),this.s<0&&t.compareTo(A.ZERO)>0&&r.subTo(t,t),t}l(lM,"bnMod");function cn(r){this.m=r}l(cn,"Classic");function cM(r){return r.s<0||r.compareTo(this.m)>=0?r.mod(this.m):r}l(cM,"cConvert");function uM(r){return r}l(uM,"cRevert");function pM(r){r.divRemTo(this.m,null,r)}l(pM,"cReduce");function hM(r,t,e){r.multiplyTo(t,e),this.reduce(e)}l(hM,"cMulTo");function dM(r,t){r.squareTo(t),this.reduce(t)}l(dM,"cSqrTo");cn.prototype.convert=cM;cn.prototype.revert=uM;cn.prototype.reduce=pM;cn.prototype.mulTo=hM;cn.prototype.sqrTo=dM;function fM(){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(fM,"bnpInvDigit");function un(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(un,"Montgomery");function mM(r){var t=K();return r.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),r.s<0&&t.compareTo(A.ZERO)>0&&this.m.subTo(t,t),t}l(mM,"montConvert");function yM(r){var t=K();return r.copyTo(t),this.reduce(t),t}l(yM,"montRevert");function gM(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(gM,"montReduce");function vM(r,t){r.squareTo(t),this.reduce(t)}l(vM,"montSqrTo");function bM(r,t,e){r.multiplyTo(t,e),this.reduce(e)}l(bM,"montMulTo");un.prototype.convert=mM;un.prototype.revert=yM;un.prototype.reduce=gM;un.prototype.mulTo=bM;un.prototype.sqrTo=vM;function CM(){return(this.t>0?this[0]&1:this.s)==0}l(CM,"bnpIsEven");function xM(r,t){if(r>4294967295||r<1)return A.ONE;var e=K(),i=K(),n=t.convert(this),o=Cu(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(xM,"bnpExp");function SM(r,t){var e;return r<256||t.isEven()?e=new cn(t):e=new un(t),this.exp(r,e)}l(SM,"bnModPowInt");A.prototype.copyTo=YP;A.prototype.fromInt=UP;A.prototype.fromString=zP;A.prototype.clamp=ZP;A.prototype.dlShiftTo=tM;A.prototype.drShiftTo=eM;A.prototype.lShiftTo=rM;A.prototype.rShiftTo=iM;A.prototype.subTo=nM;A.prototype.multiplyTo=oM;A.prototype.squareTo=aM;A.prototype.divRemTo=sM;A.prototype.invDigit=fM;A.prototype.isEven=CM;A.prototype.exp=xM;A.prototype.toString=qP;A.prototype.negate=$P;A.prototype.abs=JP;A.prototype.compareTo=KP;A.prototype.bitLength=QP;A.prototype.mod=lM;A.prototype.modPowInt=SM;A.ZERO=di(0);A.ONE=di(1);function PM(){var r=K();return this.copyTo(r),r}l(PM,"bnClone");function MM(){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(MM,"bnIntValue");function wM(){return this.t==0?this.s:this[0]<<24>>24}l(wM,"bnByteValue");function TM(){return this.t==0?this.s:this[0]<<16>>16}l(TM,"bnShortValue");function IM(r){return Math.floor(Math.LN2*this.DB/Math.log(r))}l(IM,"bnpChunkSize");function EM(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1}l(EM,"bnSigNum");function LM(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=di(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(LM,"bnpToRadix");function DM(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,c=0;c<r.length;++c){var s=F4(r,c);if(s<0){r.charAt(c)=="-"&&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&&A.ZERO.subTo(this,this)}l(DM,"bnpFromRadix");function _M(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(A.ONE.shiftLeft(r-1),sm,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>r&&this.subTo(A.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(_M,"bnpFromNumber");function OM(){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(OM,"bnToByteArray");function AM(r){return this.compareTo(r)==0}l(AM,"bnEquals");function kM(r){return this.compareTo(r)<0?this:r}l(kM,"bnMin");function NM(r){return this.compareTo(r)>0?this:r}l(NM,"bnMax");function RM(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(RM,"bnpBitwiseTo");function BM(r,t){return r&t}l(BM,"op_and");function FM(r){var t=K();return this.bitwiseTo(r,BM,t),t}l(FM,"bnAnd");function sm(r,t){return r|t}l(sm,"op_or");function GM(r){var t=K();return this.bitwiseTo(r,sm,t),t}l(GM,"bnOr");function G4(r,t){return r^t}l(G4,"op_xor");function VM(r){var t=K();return this.bitwiseTo(r,G4,t),t}l(VM,"bnXor");function V4(r,t){return r&~t}l(V4,"op_andnot");function HM(r){var t=K();return this.bitwiseTo(r,V4,t),t}l(HM,"bnAndNot");function XM(){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(XM,"bnNot");function jM(r){var t=K();return r<0?this.rShiftTo(-r,t):this.lShiftTo(r,t),t}l(jM,"bnShiftLeft");function WM(r){var t=K();return r<0?this.lShiftTo(-r,t):this.rShiftTo(r,t),t}l(WM,"bnShiftRight");function YM(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(YM,"lbit");function UM(){for(var r=0;r<this.t;++r)if(this[r]!=0)return r*this.DB+YM(this[r]);return this.s<0?this.t*this.DB:-1}l(UM,"bnGetLowestSetBit");function zM(r){for(var t=0;r!=0;)r&=r-1,++t;return t}l(zM,"cbit");function ZM(){for(var r=0,t=this.s&this.DM,e=0;e<this.t;++e)r+=zM(this[e]^t);return r}l(ZM,"bnBitCount");function qM(r){var t=Math.floor(r/this.DB);return t>=this.t?this.s!=0:(this[t]&1<<r%this.DB)!=0}l(qM,"bnTestBit");function $M(r,t){var e=A.ONE.shiftLeft(r);return this.bitwiseTo(e,t,e),e}l($M,"bnpChangeBit");function JM(r){return this.changeBit(r,sm)}l(JM,"bnSetBit");function KM(r){return this.changeBit(r,V4)}l(KM,"bnClearBit");function QM(r){return this.changeBit(r,G4)}l(QM,"bnFlipBit");function tw(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(tw,"bnpAddTo");function ew(r){var t=K();return this.addTo(r,t),t}l(ew,"bnAdd");function rw(r){var t=K();return this.subTo(r,t),t}l(rw,"bnSubtract");function iw(r){var t=K();return this.multiplyTo(r,t),t}l(iw,"bnMultiply");function nw(){var r=K();return this.squareTo(r),r}l(nw,"bnSquare");function ow(r){var t=K();return this.divRemTo(r,t,null),t}l(ow,"bnDivide");function aw(r){var t=K();return this.divRemTo(r,null,t),t}l(aw,"bnRemainder");function sw(r){var t=K(),e=K();return this.divRemTo(r,t,e),new Array(t,e)}l(sw,"bnDivideAndRemainder");function lw(r){this[this.t]=this.am(0,r-1,this,0,0,this.t),++this.t,this.clamp()}l(lw,"bnpDMultiply");function cw(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(cw,"bnpDAddOffset");function hs(){}l(hs,"NullExp");function H4(r){return r}l(H4,"nNop");function uw(r,t,e){r.multiplyTo(t,e)}l(uw,"nMulTo");function pw(r,t){r.squareTo(t)}l(pw,"nSqrTo");hs.prototype.convert=H4;hs.prototype.revert=H4;hs.prototype.mulTo=uw;hs.prototype.sqrTo=pw;function hw(r){return this.exp(r,new hs)}l(hw,"bnPow");function dw(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(dw,"bnpMultiplyLowerTo");function fw(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(fw,"bnpMultiplyUpperTo");function Mo(r){this.r2=K(),this.q3=K(),A.ONE.dlShiftTo(2*r.t,this.r2),this.mu=this.r2.divide(r),this.m=r}l(Mo,"Barrett");function mw(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(mw,"barrettConvert");function yw(r){return r}l(yw,"barrettRevert");function gw(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(gw,"barrettReduce");function vw(r,t){r.squareTo(t),this.reduce(t)}l(vw,"barrettSqrTo");function bw(r,t,e){r.multiplyTo(t,e),this.reduce(e)}l(bw,"barrettMulTo");Mo.prototype.convert=mw;Mo.prototype.revert=yw;Mo.prototype.reduce=gw;Mo.prototype.mulTo=bw;Mo.prototype.sqrTo=vw;function Cw(r,t){var e=r.bitLength(),i,n=di(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 cn(t):t.isEven()?o=new Mo(t):o=new un(t);var a=new Array,c=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);c<=p;)a[c]=K(),o.mulTo(f,a[c-2],a[c]),c+=2}var m=r.t-1,y,x=!0,S=K(),M;for(e=Cu(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)),c=i;!(y&1);)y>>=1,--c;if((e-=c)<0&&(e+=this.DB,--m),x)a[y].copyTo(n),x=!1;else{for(;c>1;)o.sqrTo(n,S),o.sqrTo(S,n),c-=2;c>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(Cw,"bnModPow");function xw(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(xw,"bnGCD");function Sw(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(Sw,"bnpModInt");function Pw(r){var t=r.isEven();if(this.isEven()&&t||r.signum()==0)return A.ZERO;for(var e=r.clone(),i=this.clone(),n=di(1),o=di(0),a=di(0),c=di(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()||!c.isEven())&&(a.addTo(this,a),c.subTo(r,c)),a.rShiftTo(1,a)):c.isEven()||c.subTo(r,c),c.rShiftTo(1,c);e.compareTo(i)>=0?(e.subTo(i,e),t&&n.subTo(a,n),o.subTo(c,o)):(i.subTo(e,i),t&&a.subTo(n,a),c.subTo(o,c))}if(i.compareTo(A.ONE)!=0)return A.ZERO;if(c.compareTo(r)>=0)return c.subtract(r);if(c.signum()<0)c.addTo(r,c);else return c;return c.signum()<0?c.add(r):c}l(Pw,"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],Mw=(1<<26)/Kt[Kt.length-1];function ww(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<Mw;)i*=Kt[n++];for(i=e.modInt(i);t<n;)if(i%Kt[t++]==0)return!1}return e.millerRabin(r)}l(ww,"bnIsProbablePrime");function Tw(r){var t=this.subtract(A.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(A.ONE)!=0&&a.compareTo(t)!=0){for(var c=1;c++<e&&a.compareTo(t)!=0;)if(a=a.modPowInt(2,this),a.compareTo(A.ONE)==0)return!1;if(a.compareTo(t)!=0)return!1}}return!0}l(Tw,"bnpMillerRabin");A.prototype.chunkSize=IM;A.prototype.toRadix=LM;A.prototype.fromRadix=DM;A.prototype.fromNumber=_M;A.prototype.bitwiseTo=RM;A.prototype.changeBit=$M;A.prototype.addTo=tw;A.prototype.dMultiply=lw;A.prototype.dAddOffset=cw;A.prototype.multiplyLowerTo=dw;A.prototype.multiplyUpperTo=fw;A.prototype.modInt=Sw;A.prototype.millerRabin=Tw;A.prototype.clone=PM;A.prototype.intValue=MM;A.prototype.byteValue=wM;A.prototype.shortValue=TM;A.prototype.signum=EM;A.prototype.toByteArray=OM;A.prototype.equals=AM;A.prototype.min=kM;A.prototype.max=NM;A.prototype.and=FM;A.prototype.or=GM;A.prototype.xor=VM;A.prototype.andNot=HM;A.prototype.not=XM;A.prototype.shiftLeft=jM;A.prototype.shiftRight=WM;A.prototype.getLowestSetBit=UM;A.prototype.bitCount=ZM;A.prototype.testBit=qM;A.prototype.setBit=JM;A.prototype.clearBit=KM;A.prototype.flipBit=QM;A.prototype.add=ew;A.prototype.subtract=rw;A.prototype.multiply=iw;A.prototype.divide=ow;A.prototype.remainder=aw;A.prototype.divideAndRemainder=sw;A.prototype.modPow=Cw;A.prototype.modInverse=Pw;A.prototype.pow=hw;A.prototype.gcd=xw;A.prototype.isProbablePrime=ww;A.prototype.square=nw;var Z=A;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 vu>"u"&&(vu=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 vu;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};vu(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)};q.msie||q.opera||q.safari?h.Cast_Int32=function(r){return r|0}:h.Cast_Int32=function(r){return~~r};q.chrome?h.Cast_Int64=function(r){return r<-2147483648||r>2147483647?r<0?Math.ceil(r):Math.floor(r):~~r}:q.firefox&&typeof Number.toInteger=="function"?h.Cast_Int64=function(r){return Number.toInteger(r)}:q.msie7||q.msie8?h.Cast_Int64=function(r){return parseInt(r,10)}:q.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,ln)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};ln?(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};R4&&(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;GP?(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,c,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],c=r[3],s=r[4],s?Z.op_Equality(Z.Int128Mul(n.Y-o.Y,a.X-c.X),Z.Int128Mul(n.X-o.X,a.Y-c.Y)):h.Cast_Int64((n.Y-o.Y)*(a.X-c.X))-h.Cast_Int64((n.X-o.X)*(a.Y-c.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){N4?!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 c={Value:this.m_UseFullRange};this.RangeTest(r[0],c),this.m_UseFullRange=c.Value,c.Value=this.m_UseFullRange,this.RangeTest(r[i],c),this.m_UseFullRange=c.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)c.Value=this.m_UseFullRange,this.RangeTest(r[o],c),this.m_UseFullRange=c.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,ln&&(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,ln&&(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 c=this.ExecuteInternal();c&&this.BuildResult(n)}finally{this.DisposeAllPolyPts(),this.m_ExecuteLocked=!1}return c}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 c=this.ExecuteInternal();c&&this.BuildResult2(s)}finally{this.DisposeAllPolyPts(),this.m_ExecuteLocked=!1}return c}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)};ln&&(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 c=this.AddOutPt(t.PrevInAEL,t.Bot);this.AddJoin(i,c,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 c=this.AddOutPt(e.PrevInAEL,e.Bot);this.AddJoin(i,c,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),ln&&(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),ln&&(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,c=i.Pts,s=c.Prev,p;r.Side==h.EdgeSide.esLeft?(t.Side==h.EdgeSide.esLeft?(this.ReversePolyPtLinks(c),c.Next=o,o.Prev=c,a.Next=s,s.Prev=a,e.Pts=s):(s.Next=o,o.Prev=s,c.Prev=a,a.Next=c,e.Pts=c),p=h.EdgeSide.esLeft):(t.Side==h.EdgeSide.esRight?(this.ReversePolyPtLinks(c),a.Next=s,s.Prev=a,c.Next=o,o.Prev=c):(a.Next=c,c.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,c=t.OutIdx>=0;if(N4&&(r.WindDelta===0||t.WindDelta===0)){r.WindDelta===0&&t.WindDelta===0?(n||o)&&a&&c&&this.AddLocalMaxPoly(r,t,e):r.PolyTyp==t.PolyTyp&&r.WindDelta!=t.WindDelta&&this.m_ClipType==h.ClipType.ctUnion?r.WindDelta===0?c&&(this.AddOutPt(r,e),a&&(r.OutIdx=-1)):a&&(this.AddOutPt(t,e),c&&(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),c&&(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&&c)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(c)(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,c=null;a.NextInLML!==null&&h.ClipperBase.IsHorizontal(a.NextInLML);)a=a.NextInLML;for(a.NextInLML===null&&(c=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==c&&s){i==h.Direction.dLeftToRight?this.IntersectEdges(r,p,p.Top,!1):this.IntersectEdges(p,r,p.Top,!1),c.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 c!==null?c.OutIdx>=0?(i==h.Direction.dLeftToRight?this.IntersectEdges(r,c,r.Top,!1):this.IntersectEdges(c,r,r.Top,!1),c.OutIdx>=0&&h.Error("ProcessHorizontal error")):(this.DeleteFromAEL(r),this.DeleteFromAEL(c)):(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 Iw=l(function(r){return r<0?Math.ceil(r-.5):Math.round(r)},"R1"),Ew=l(function(r){return r<0?Math.ceil(r-.5):Math.floor(r+.5)},"R2"),Lw=l(function(r){return r<0?-Math.round(Math.abs(r)):Math.round(r)},"R3"),Dw=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");q.msie?h.Clipper.Round=Iw:q.chromium?h.Clipper.Round=Lw:q.safari?h.Clipper.Round=Dw:h.Clipper.Round=Ew;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,c=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(c!==null&&c.Curr.X==t.Bot.X&&c.Curr.Y==t.Bot.Y&&o!==null&&c.OutIdx>=0&&c.Curr.Y>c.Top.Y&&h.ClipperBase.SlopesEqual(t,c,this.m_UseFullRange)&&t.WindDelta!==0&&c.WindDelta!==0){var a=this.AddOutPt(c,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),c=0;c<o;c++)a[c]=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,c=0;c<n;c++)o.m_polygon[c]=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,c=e.Pt.X>i.Pt.X?h.Direction.dRightToLeft:h.Direction.dLeftToRight;if(a==c)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(c==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,c=r.OutPt1.Pt.Y==r.OffPt.Y;if(c&&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(c){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 c=(n.X-r.X)*(a.Y-r.Y)-(a.X-r.X)*(n.Y-r.Y);if(c==0)return-1;c>0==a.Y>n.Y&&(e=1-e)}else if(a.X>r.X){var c=(n.X-r.X)*(a.Y-r.Y)-(a.X-r.X)*(n.Y-r.Y);if(c==0)return-1;c>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,c=t.Next.Pt.Y;if(c==r.Y&&(a==r.X||o==r.Y&&a>r.X==n<r.X))return-1;if(o<r.Y!=c<r.Y){if(n>=r.X)if(a>r.X)e=1-e;else{var s=(n-r.X)*(c-r.Y)-(a-r.X)*(o-r.Y);if(s==0)return-1;s>0==c>o&&(e=1-e)}else if(a>r.X){var s=(n-r.X)*(c-r.Y)-(a-r.X)*(o-r.Y);if(s==0)return-1;s>0==c>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,c=this.m_PolyOuts.length;a<c-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};R4&&(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 c=new Array(e),n=0;n<e;++n)c[n]=new h.IntPoint(a.Pt),a=a.Next;return i=null,c};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,c=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);c.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);c.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(c[s%a][f%o]),S.push(c[(s+1)%a][f%o]),S.push(c[(s+1)%a][(f+1)%o]),S.push(c[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,c,h.PolyFillType.pftNonZero,h.PolyFillType.pftNonZero),c};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],c=new h.Clipper,s,p=0,f=o.length;p<f;++p){var s=h.Clipper.Minkowski(e,o[p],!0,n);c.AddPaths(s,h.PolyType.ptSubject,!0)}n&&c.AddPaths(o,h.PolyType.ptClip,!0);var m=new h.Paths;return c.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,c=o[n];n<a;n++,c=o[n])h.Clipper.AddPolyNodeToPaths(c,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};vu(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,c=1;c<=i;c++)h.IntPoint.op_Inequality(n.m_polygon[o],r[c])&&(o++,n.m_polygon.push(r[c]),(r[c].Y>n.m_polygon[a].Y||r[c].Y==n.m_polygon[a].Y&&r[c].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,c=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+c*r)));var p=a;a=a*this.m_cos-this.m_sin*c,c=p*this.m_sin+c*this.m_cos}else for(var a=-1,c=-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+c*r))),a<0?a=1:c<0?c=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 c=e.Childs()[0];e.Childs()[0]=c.Childs()[0];for(var s=1;s<c.ChildCount();s++)e.AddChild(c.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,c=0;c<i;++c)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,c,s,p,f,m,y=[],x=0;x<n;x++)if(a=i[x],o=a.length,o!==0){if(o<3){c=a,y.push(c);continue}for(c=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||(c[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&&c.splice(f,o-f),c.length&&y.push(c)}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,c=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};c[n]=a}return t||(c=c[0]),c};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,c,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],c=n.length,c!=0){for(o=0;o<1e6;o++){for(a=[],c=n.length,n[c-1].X!=n[0].X||n[c-1].Y!=n[0].Y?(x=1,n.push({X:n[0].X,Y:n[0].Y}),c=n.length):x=0,y=[],i=0;i<c-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<c-1;i++)y[i]||a.push({X:n[i].X,Y:n[i].Y});if(a.push({X:n[c-1].X,Y:n[c-1].Y}),x&&n.pop(),y.length)n=a;else break}c=a.length,a[c-1].X==a[0].X&&a[c-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,c=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],c=o.X,s=o.Y,a=r[m-1],p=a.X,f=a.Y,n+=i((c-p)*(c-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,c,s,p,f;for(c=0;c<n;c++)for(o=i[c],e.holes[c]=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};ps.exports=h});d();d();var ul=new WeakMap,Xt,np=class np{constructor(t){P(this,Xt,void 0);E(this,Xt,t),ul.set(this,t)}get mapName(){return u(this,Xt).mapName}get mapCenter(){return u(this,Xt).mapCenter}get organizationId(){return u(this,Xt).organizationId}get outdoorViewToken(){return u(this,Xt).outdoorViewToken}getByType(t){switch(t){case"space":return u(this,Xt).spaces;case"door":return u(this,Xt).doors;case"floor":return u(this,Xt).floors;case"connection":return u(this,Xt).connections;case"object":return u(this,Xt).objects;case"point-of-interest":return u(this,Xt).pointsOfInterest;case"annotation":return u(this,Xt).annotations;default:return[]}}getById(t,e){return u(this,Xt).getById(t,e)}};Xt=new WeakMap,l(np,"MapData");var ip=np,pl=ip;d();d();d();var j1=(n=>(n[n.LOG=0]="LOG",n[n.WARN=1]="WARN",n[n.ERROR=2]="ERROR",n[n.SILENT=3]="SILENT",n))(j1||{});function G5(r){0<=r&&r<=3&&(W1.logState=r)}l(G5,"setLoggerLevel");var W1={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)}},B=W1;var Y1=globalThis.fetch,U1,V5=(U1=b==null?void 0:b.env)==null?void 0:U1.npm_package_version,z1="https://app.mappedin.com/";function jo(){if(Y1==null)throw new Error("fetch is not available in your environment. Pass your own function into `setFetchFn` (node-fetch, etc)");return Y1}l(jo,"isomorphicFetch");var Z1={supplementaryUrl:"https://api-gateway.mappedin.com/analytics/",headers:{},accessToken:"",clientId:"",noAuth:!1,includeHidden:!0,clientSecret:"",apiGateway:"",authorization:"",perspective:"Website",language:"",venue:""};function q1(r){var e;let t={...Z1,...r};return t.headers={...t.headers,"mappedin-sdk-version":V5},t.things=[],"platformString"in r&&(t.headers={...t.headers,"mappedin-platform-version":r.platformString}),t.noAuth||(t.accessToken?t.authorization=`Bearer ${t.accessToken}`:t.clientId&&t.clientSecret&&(t.authorization=`Basic ${globalThis.btoa(`${t.clientId}:${t.clientSecret}`)}`)),t.language=(e=t.language)==null?void 0:e.toLowerCase(),t}l(q1,"parseOptions");function H5(r,t,e=!1){let i={language:r.language,clientId:r.clientId,clientSecret:r.clientSecret};e&&delete i.language,i.language&&(t+=`&lang=${encodeURIComponent(i.language)}`);let{headers:n}=r;n["Content-Type"]=n["Content-Type"]||"text/json",r.accessToken?n.Authorization=`Bearer ${r.accessToken}`:r.noAuth||r.clientId&&r.clientSecret&&(n["x-mappedin-key"]=btoa(r.clientId),n["x-mappedin-secret"]=btoa(r.clientSecret)),i.language&&(n["Accept-Language"]=i.language);let o={method:"GET",headers:n};return r.secure&&(t+="&withcdntoken"),{req:o,url:t}}l(H5,"constructParamsForRequest");async function X5(r,t,e=!1){let i=H5(r,t,e),n=await jo()(i.url,i.req);if(!n.ok)throw new Error(`${n.status} ${n.statusText}`);return n.json()}l(X5,"generateAPIRequest");async function j5(r,t="exports/mvf/1/bundle"){var o;let e=q1({baseUri:"https://api-gateway.mappedin.com/",...Z1,...r}),i=`${e.baseUri+t}?venue=${e.venue}&version=${(o=e.version)!=null?o:"2.0.0"}`;return e.headers["Content-Type"]="application/zip",await X5(e,i)}l(j5,"getVenueMVFURL");async function $1(r){return new Promise(async(t,e)=>{try{let{url:i}=await j5(r,"exports/mvf2/1/bundle"),n=await jo()(i).then(a=>a.arrayBuffer()),o=new Uint8Array(n);t(o)}catch(i){e(i)}})}l($1,"downloadVenueBundleMVFAPIGateway");async function op(r,t){return new Promise(async(e,i)=>{try{let{url:n}=await W5(r,t),o=await jo()(n).then(c=>c.arrayBuffer()),a=new Uint8Array(o);e(a)}catch(n){i(n)}})}l(op,"downloadMVF");function J1(r){return r.endsWith("/")?r:`${r}/`}l(J1,"normalizeUrl");async function W5(r,t){let e=`${r.baseUri?J1(r.baseUri):z1}api/venue/${r.mapId}/mvf${r.viewId?`?configId=${r.viewId}`:""}`,i=await jo()(e,{headers:{Authorization:`Bearer ${t}`}});if(!i.ok)throw new Error(`${i.status} ${i.statusText}`);return i.json()}l(W5,"getMakerBundleURL");async function hl(r){let t=`${r.baseUri?J1(r.baseUri):z1}api/api-key/token`,e=await jo()(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(hl,"getAccessToken");function dl(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 o=Object.keys(r.annotation);for(let a of o){let c=a.replace(/\.json|\.geojson/g,"");i.annotation[c]=JSON.parse(e(r.annotation[a]))}}let n=Object.keys(r.space);for(let o of n){let a=o.replace(/\.json|\.geojson/g,"");i.space[a]=JSON.parse(e(r.space[o]))}if(r.obstruction!=null){let o=Object.keys(r.obstruction);for(let a of o){let c=a.replace(/\.json|\.geojson/g,"");i.obstruction[c]=JSON.parse(e(r.obstruction[a]))}}else i.obstruction={};if(r.entrance!=null){let o=Object.keys(r.entrance);for(let a of o){let c=a.replace(/\.json|\.geojson/g,"");i.entrance[c]=JSON.parse(e(r.entrance[a]))}}else i.entrance={};return i}catch(i){throw B.error(i),new Error("MVF parsing failed! Probably encountered a bad file.")}}l(dl,"parseMVF");function Y5(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(Y5,"validateStaticMVFFiles");async function fl(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-VJJYXKCR.js")).unzipSync(r);if(!Y5(n))throw new Error("MVF is missing some expect static files. Unzipping failed.");let o={},a=Object.keys(n);for(let c of a){if(n[c].length===0)continue;let s=c.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[c];continue}if(s[0]==="image"){B.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[c]}t(o)}catch(i){e(i)}})}l(fl,"unzipMVF");d();d();d();d();var qt=63710088e-1,K1={centimeters:qt*100,centimetres:qt*100,degrees:qt/111325,feet:qt*3.28084,inches:qt*39.37,kilometers:qt/1e3,kilometres:qt/1e3,meters:qt,metres:qt,miles:qt/1609.344,millimeters:qt*1e3,millimetres:qt*1e3,nauticalmiles:qt/1852,radians:1,yards:qt*1.0936},$T={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/qt,yards:1.0936133};function Xr(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(Xr,"feature");function Oe(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(!ap(r[0])||!ap(r[1]))throw new Error("coordinates must contain numbers");var i={type:"Point",coordinates:r};return Xr(i,t,e)}l(Oe,"point");function vr(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 Xr(i,t,e)}l(vr,"lineString");function Wo(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(Wo,"featureCollection");function Q1(r,t){t===void 0&&(t="kilometers");var e=K1[t];if(!e)throw new Error(t+" units is invalid");return r*e}l(Q1,"radiansToLength");function ty(r,t){t===void 0&&(t="kilometers");var e=K1[t];if(!e)throw new Error(t+" units is invalid");return r/e}l(ty,"lengthToRadians");function Yo(r){var t=r%(2*Math.PI);return t*180/Math.PI}l(Yo,"radiansToDegrees");function ie(r){var t=r%360;return t*Math.PI/180}l(ie,"degreesToRadians");function ap(r){return!isNaN(r)&&r!==null&&!Array.isArray(r)}l(ap,"isNumber");function Ce(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(Ce,"getCoord");function pe(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(pe,"getCoords");function ey(r){return r.type==="Feature"?r.geometry:r}l(ey,"getGeom");function ry(r,t){return r.type==="FeatureCollection"?"FeatureCollection":r.type==="GeometryCollection"?"GeometryCollection":r.type==="Feature"&&r.geometry!==null?r.geometry.type:r.type}l(ry,"getType");function U5(r,t,e){e===void 0&&(e={});for(var i=Ce(r),n=pe(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")),z5(n[o],n[o+1],i,a,typeof e.epsilon>"u"?null:e.epsilon))return!0}return!1}l(U5,"booleanPointOnLine");function z5(r,t,e,i,n){var o=e[0],a=e[1],c=r[0],s=r[1],p=t[0],f=t[1],m=e[0]-c,y=e[1]-s,x=p-c,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?c<o&&o<=p:p<=o&&o<c:S>0?s<a&&a<=f:f<=a&&a<s;if(i==="end")return Math.abs(x)>=Math.abs(S)?x>0?c<=o&&o<p:p<o&&o<=c:S>0?s<=a&&a<f:f<a&&a<=s;if(i==="both")return Math.abs(x)>=Math.abs(S)?x>0?c<o&&o<p:p<o&&o<c:S>0?s<a&&a<f:f<a&&a<s}else return Math.abs(x)>=Math.abs(S)?x>0?c<=o&&o<=p:p<=o&&o<=c:S>0?s<=a&&a<=f:f<=a&&a<=s;return!1}l(z5,"isPointOnLineSegment");var iy=U5;d();d();d();function ml(r,t,e){if(r!==null)for(var i,n,o,a,c,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,c=y?p.geometries.length:1;for(var I=0;I<c;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(ml(a.geometries[i],t,e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}l(ml,"coordEach");function sp(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(sp,"featureEach");function Z5(r,t){var e,i,n,o,a,c,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(c=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=c?c.type==="GeometryCollection":!1,a=s?c.geometries.length:1,n=0;n<a;n++){if(o=s?c.geometries[n]:c,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(Z5,"geomEach");function Uo(r,t){Z5(r,function(e,i,n,o,a){var c=e===null?null:e.type;switch(c){case null:case"Point":case"LineString":case"Polygon":return t(Xr(e,n,{bbox:o,id:a}),i,0)===!1?!1:void 0}var s;switch(c){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(Xr(m,n),i,p)===!1)return!1}})}l(Uo,"flattenEach");function q5(r,t){Uo(r,function(e,i,n){var o=0;if(e.geometry){var a=e.geometry.type;if(!(a==="Point"||a==="MultiPoint")){var c,s=0,p=0,f=0;if(ml(e,function(m,y,x,S,M){if(c===void 0||i>s||S>p||M>f){c=m,s=i,p=S,f=M,o=0;return}var g=vr([c,m],e.properties);if(t(g,i,n,M,o)===!1)return!1;o++,c=m})===!1)return!1}}})}l(q5,"segmentEach");function ny(r,t,e){var i=e,n=!1;return q5(r,function(o,a,c,s,p){n===!1&&e===void 0?i=o:i=t(i,o,a,c,s,p),n=!0}),i}l(ny,"segmentReduce");function lp(r){var t=[1/0,1/0,-1/0,-1/0];return ml(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(lp,"bbox");lp.default=lp;var yl=lp;function $5(r,t){t===void 0&&(t={});var e=yl(r),i=(e[0]+e[2])/2,n=(e[1]+e[3])/2;return Oe([i,n],t.properties,t)}l($5,"center");var oy=$5;d();d();function J5(r,t,e){e===void 0&&(e={});var i=Ce(r),n=Ce(t),o=ie(n[1]-i[1]),a=ie(n[0]-i[0]),c=ie(i[1]),s=ie(n[1]),p=Math.pow(Math.sin(o/2),2)+Math.pow(Math.sin(a/2),2)*Math.cos(c)*Math.cos(s);return Q1(2*Math.atan2(Math.sqrt(p),Math.sqrt(1-p)),e.units)}l(J5,"distance");var jr=J5;function gl(r,t){return t===void 0&&(t={}),ny(r,function(e,i){var n=i.geometry.coordinates;return e+jr(n[0],n[1],t)},0)}l(gl,"length");d();d();d();function vl(r,t,e){if(e===void 0&&(e={}),e.final===!0)return K5(r,t);var i=Ce(r),n=Ce(t),o=ie(i[0]),a=ie(n[0]),c=ie(i[1]),s=ie(n[1]),p=Math.sin(a-o)*Math.cos(s),f=Math.cos(c)*Math.sin(s)-Math.sin(c)*Math.cos(s)*Math.cos(a-o);return Yo(Math.atan2(p,f))}l(vl,"bearing");function K5(r,t){var e=vl(t,r);return e=(e+180)%360,e}l(K5,"calculateFinalBearing");d();function Mi(r,t,e,i){i===void 0&&(i={});var n=Ce(r),o=ie(n[0]),a=ie(n[1]),c=ie(e),s=ty(t,i.units),p=Math.asin(Math.sin(a)*Math.cos(s)+Math.cos(a)*Math.sin(s)*Math.cos(c)),f=o+Math.atan2(Math.sin(c)*Math.sin(s)*Math.cos(a),Math.cos(s)-Math.sin(a)*Math.sin(p)),m=Yo(f),y=Yo(p);return Oe([m,y],i.properties)}l(Mi,"destination");d();d();function Q5(r){if(!r)throw new Error("geojson is required");var t=[];return Uo(r,function(e){t7(e,t)}),Wo(t)}l(Q5,"lineSegment");function t7(r,t){var e=[],i=r.geometry;if(i!==null){switch(i.type){case"Polygon":e=pe(i);break;case"LineString":e=[pe(i)]}e.forEach(function(n){var o=e7(n,r.properties);o.forEach(function(a){a.id=t.length,t.push(a)})})}}l(t7,"lineSegmentFeature");function e7(r,t){var e=[];return r.reduce(function(i,n){var o=vr([i,n],t);return o.bbox=r7(i,n),e.push(o),n}),e}l(e7,"createSegments");function r7(r,t){var e=r[0],i=r[1],n=t[0],o=t[1],a=e<n?e:n,c=i<o?i:o,s=e>n?e:n,p=i>o?i:o;return[a,c,s,p]}l(r7,"bbox");var cp=Q5;var f3=Gr(h3(),1);function w9(r,t){var e={},i=[];if(r.type==="LineString"&&(r=Xr(r)),t.type==="LineString"&&(t=Xr(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=d3(r,t);return n&&i.push(n),Wo(i)}var o=(0,f3.default)();return o.load(cp(t)),sp(cp(r),function(a){sp(o.search(a),function(c){var s=d3(a,c);if(s){var p=pe(s).join(",");e[p]||(e[p]=!0,i.push(s))}})}),Wo(i)}l(w9,"lineIntersect");function d3(r,t){var e=pe(r),i=pe(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],c=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)*(c-o),x=(f-s)*(o-p)-(m-p)*(n-s),S=(a-n)*(o-p)-(c-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*(c-o);return Oe([C,I])}return null}l(d3,"intersects");var m3=w9;function T9(r,t,e){e===void 0&&(e={});var i=Oe([1/0,1/0],{dist:1/0}),n=0;return Uo(r,function(o){for(var a=pe(o),c=0;c<a.length-1;c++){var s=Oe(a[c]);s.properties.dist=jr(t,s,e);var p=Oe(a[c+1]);p.properties.dist=jr(t,p,e);var f=jr(s,p,e),m=Math.max(s.properties.dist,p.properties.dist),y=vl(s,p),x=Mi(t,m,y+90,e),S=Mi(t,m,y-90,e),M=m3(vr([x.geometry.coordinates,S.geometry.coordinates]),vr([s.geometry.coordinates,p.geometry.coordinates])),g=null;M.features.length>0&&(g=M.features[0],g.properties.dist=jr(t,g,e),g.properties.location=n+jr(s,g,e)),s.properties.dist<i.properties.dist&&(i=s,i.properties.index=c,i.properties.location=n),p.properties.dist<i.properties.dist&&(i=p,i.properties.index=c+1,i.properties.location=n+f),g&&g.properties.dist<i.properties.dist&&(i=g,i.properties.index=c),n+=f}}),i}l(T9,"nearestPointOnLine");var ua=T9;function I9(r,t,e){var i=pe(e);if(ry(e)!=="LineString")throw new Error("line must be a LineString");var n=ua(e,r),o=ua(e,t),a;n.properties.index<=o.properties.index?a=[n,o]:a=[o,n];for(var c=[a[0].geometry.coordinates],s=a[0].properties.index+1;s<a[1].properties.index+1;s++)c.push(i[s]);return c.push(a[1].geometry.coordinates),vr(c,e.properties)}l(I9,"lineSlice");var $h=I9;var E9=1e-7;function Jh(r){return{type:"Point",coordinates:r}}l(Jh,"point");function L9(r,t){let{coordinates:e}=t.geometry,{coordinates:i}=r.geometry,n=e.map(o=>ua(r,Jh(o)));return i.reduce((o,a)=>{let c=$h(Jh(a),n[0],r),s=$h(Jh(a),n[1],r),p=gl(c)<gl(s)?c:s;return p.properties={...r.properties,entrances:[]},o.concat([p])},[])}l(L9,"splitObstructionByEntrance");function Kh(r,t){return t.reduce((e,i)=>{let n={epsilon:E9},o=e.findIndex(c=>iy(oy(i),c,n)),a=e[o];if(a){let[c,s]=L9(a,i);e.splice(o,1,c,s)}return e},[r])}l(Kh,"splitObstructionByAllEntrances");d();d();d();d();var Qh=[0,4,6,8,10],tt=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],Qh.map((i,n)=>e.slice(i,n===Qh.length-1?void 0:Qh[n+1]).join("")).join("-")},"randomId");var Gn=class Gn{__type=Gn.__type;id=tt();latitude;longitude;floorId;static is(t){return t.__type===Gn.__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(Gn,"Coordinate"),v(Gn,"__type","coordinate");var td=Gn,et=td;d();d();d();d();var ed=class ed{id;constructor(t){this.id=t}};l(ed,"BaseMetaData");var Ei=ed;var ha,Vn,pa=class pa extends Ei{constructor(e){super(String(tt()));P(this,ha,{});P(this,Vn,void 0);E(this,Vn,e.mvfData)}static is(e){return e.__type===pa.__type}get url(){return u(this,Vn).url}get name(){return u(this,Vn).displayName}toJSON(){return{id:this.id,url:this.url,name:this.name}}destroy(){for(let e of globalThis.Object.keys(u(this,ha)))delete u(this,ha)[e]}};ha=new WeakMap,Vn=new WeakMap,l(pa,"Hyperlink"),v(pa,"__type","hyperlink");var rd=pa,mc=rd;var id=class id{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 mc({mvfData:o})))}links=[]};l(id,"BaseMapData");var Dt=id;var Li,Sr,Di,$r,Hn=class Hn extends Dt{constructor(e,i){super(i.mvfData.properties.id,i.mvfData.properties.details);v(this,"__type",Hn.__type);P(this,Li,void 0);P(this,Sr,void 0);P(this,Di,void 0);P(this,$r,void 0);E(this,Sr,{}),E(this,$r,i.mvfData),E(this,Li,e),E(this,Di,i.floorId)}static is(e){return e.__type===Hn.__type}get name(){var e,i;return(i=(e=u(this,$r).properties.details)==null?void 0:e.name)!=null?i:""}get description(){var e,i;return(i=(e=u(this,$r).properties.details)==null?void 0:e.description)!=null?i:""}get images(){var e,i;return(i=(e=u(this,$r).properties.details)==null?void 0:e.images)!=null?i:[]}get floor(){let e=u(this,Li).getById("floor",u(this,Di));if(e==null)throw new Error(`Floor ${u(this,Di)} not found!`);return e}get center(){if(u(this,Sr).center==null){let[[e,i],[n,o]]=u(this,$r).geometry.coordinates,a=(e+n)/2,c=(i+o)/2;u(this,Sr).center=new et(c,a,u(this,Di))}return u(this,Sr).center}get isExterior(){var n;let e=u(this,Li).obstructionIdByEntranceId[this.id],i=u(this,Li).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(u(this,Sr)))delete u(this,Sr)[e]}};Li=new WeakMap,Sr=new WeakMap,Di=new WeakMap,$r=new WeakMap,l(Hn,"Door"),v(Hn,"__type","door");var nd=Hn,Jr=nd;d();var jn,_i,Kr,er,Xn=class Xn extends Dt{constructor(e,i){super(i.mvfData.properties.id,i.mvfData.properties.details);v(this,"__type",Xn.__type);P(this,jn,void 0);P(this,_i,void 0);P(this,Kr,{});P(this,er,void 0);E(this,jn,e),E(this,_i,i.floorId),E(this,er,i.mvfData)}static is(e){return e.__type===Xn.__type}get name(){var i,n;let{properties:e}=u(this,er);return(n=(i=e.details)==null?void 0:i.name)!=null?n:e.externalId}get type(){return _9(u(this,er).properties.kind)}get description(){var e,i;return(i=(e=u(this,er).properties.details)==null?void 0:e.description)!=null?i:""}get images(){var e,i;return(i=(e=u(this,er).properties.details)==null?void 0:e.images)!=null?i:[]}get floor(){let e=u(this,jn).getById("floor",u(this,_i));if(e==null)throw new Error(`Floor ${u(this,_i)} not found!`);return e}get doors(){return u(this,er).properties.destinationNodes.reduce((e,i)=>{let n=u(this,jn).doorsByNodeId[i];return n&&e.push(n),e},[])}get center(){var e;if(u(this,Kr).center==null){let[i,n]=(e=u(this,er).properties.center)!=null?e:[0,0];u(this,Kr).center=new et(n,i,u(this,_i))}return u(this,Kr).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(u(this,Kr)))delete u(this,Kr)[e]}};jn=new WeakMap,_i=new WeakMap,Kr=new WeakMap,er=new WeakMap,l(Xn,"Space"),v(Xn,"__type","space");var od=Xn,D9=["room","hallway","exterior","void","connection.stairs","connection.elevator","poi"];function _9(r){if(r==null||r==="default")return"room";let t=r.toLowerCase();return D9.includes(t)?t:"room"}l(_9,"validateSpaceType");var de=od;d();var rr,vt,Yn,Wn=class Wn extends Dt{constructor(e,i){super(i.mvfData.id);v(this,"__type",Wn.__type);P(this,rr,void 0);P(this,vt,{});P(this,Yn,void 0);E(this,rr,e),E(this,Yn,i.mvfData)}static is(e){return e.__type===Wn.__type}get name(){return u(this,Yn).externalId}get elevation(){return u(this,Yn).elevation}get spaces(){if(u(this,vt).spaces==null){let e=u(this,rr).spaces.filter(i=>i.floor.id===this.id);u(this,vt).spaces=e}return u(this,vt).spaces}get objects(){if(u(this,vt).objects==null){let e=u(this,rr).objects.filter(i=>i.floor.id===this.id);u(this,vt).objects=e}return u(this,vt).objects}get connections(){if(u(this,vt).connections==null){let e=u(this,rr).connections.filter(i=>i.floors.includes(this));u(this,vt).connections=e}return u(this,vt).connections}get doors(){if(u(this,vt).doors==null){let e=u(this,rr).doors.filter(i=>i.floor.id===this.id);u(this,vt).doors=e}return u(this,vt).doors}get annotations(){if(u(this,vt).annotations==null){let e=u(this,rr).annotations.filter(i=>i.floor.id===this.id);u(this,vt).annotations=e}return u(this,vt).annotations}get pois(){if(u(this,vt).pois==null){let e=u(this,rr).pointsOfInterest.filter(i=>i.floor.id===this.id);u(this,vt).pois=e}return u(this,vt).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(u(this,vt)))delete u(this,vt)[e]}};rr=new WeakMap,vt=new WeakMap,Yn=new WeakMap,l(Wn,"Floor"),v(Wn,"__type","floor");var ad=Wn,Qr=ad;d();d();d();var da=l(r=>r!=null,"notNull");d();function y3(r){return typeof r=="string"?r:r.id}l(y3,"getId");d();function nr(r){let t;if(de.is(r)||Jr.is(r)||fe.is(r))t=r.center;else if(ti.is(r)||Un.is(r))t=r.coordinate;else if(et.is(r))t=r;else return;return t}l(nr,"getCoordinateFromStuffs");d();d();var fa={auto:!0,debug:!1,pitch:45,bearing:0,antialiasing:{enabled:!0},shadingAndOutlines:!0,outdoorView:{layersHiddenByGeometry:["building","building-top"]}},Oi="ExteriorWalls",yc="Walls",g3=0;function sd(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(sd,"validateOptions");function ld(r,t){var n,o,a,c;let e=((n=r==null?void 0:r.outdoorView)==null?void 0:n.token)||t.outdoorViewToken,i={...fa,...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:(c=fa.outdoorView)==null?void 0:c.layersHiddenByGeometry,...r==null?void 0:r.outdoorView}};return e&&i.outdoorView&&(i.outdoorView.token=e),i}l(ld,"handleDefault");var ma,Pr,Mr,zn=class zn extends Dt{constructor(e,i){let n=Object.values(i.mvfDataByFloorId)[0];super(n.properties.id,n.properties.details);v(this,"__type",zn.__type);P(this,ma,void 0);P(this,Pr,void 0);P(this,Mr,void 0);E(this,Pr,{}),E(this,ma,e),E(this,Mr,i.mvfDataByFloorId)}static is(e){return e.__type===zn.__type}get name(){var e,i;return(i=(e=Object.values(u(this,Mr))[0].properties.details)==null?void 0:e.name)!=null?i:""}get description(){var e,i;return(i=(e=Object.values(u(this,Mr))[0].properties.details)==null?void 0:e.description)!=null?i:""}get images(){var e,i;return(i=(e=Object.values(u(this,Mr))[0].properties.details)==null?void 0:e.images)!=null?i:[]}get type(){var e,i;return(i=(e=Object.values(u(this,Mr))[0].properties.kind)==null?void 0:e.split(".")[1])!=null?i:"unknown"}get coordinates(){return u(this,Pr).coordinates==null&&(u(this,Pr).coordinates=Object.entries(u(this,Mr)).map(([e,i])=>new et(i.geometry.coordinates[1],i.geometry.coordinates[0],e))),u(this,Pr).coordinates}get floors(){return this.coordinates.map(e=>e.floorId?u(this,ma).getById("floor",e.floorId):void 0).filter(da)}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(u(this,Pr)))delete u(this,Pr)[e]}};ma=new WeakMap,Pr=new WeakMap,Mr=new WeakMap,l(zn,"Connection"),v(zn,"__type","connection");var cd=zn,ei=cd;d();var ya,Ai,ri,wr,Zn=class Zn extends Dt{constructor(e,i){super(i.mvfData.properties.id,i.mvfData.properties.details);v(this,"__type",Zn.__type);P(this,ya,void 0);P(this,Ai,void 0);P(this,ri,{});P(this,wr,void 0);E(this,ya,e),E(this,Ai,i.floorId),E(this,wr,i.mvfData)}static is(e){return e.__type===Zn.__type}get name(){var e,i;return(i=(e=u(this,wr).properties.details)==null?void 0:e.name)!=null?i:""}get description(){var e,i;return(i=(e=u(this,wr).properties.details)==null?void 0:e.description)!=null?i:""}get images(){var e,i;return(i=(e=u(this,wr).properties.details)==null?void 0:e.images)!=null?i:[]}get type(){let e=u(this,wr).properties.kind;return e==null&&(e="object"),e==="Desks"&&(e="desk"),e.toLowerCase()}get floor(){let e=u(this,ya).getById("floor",u(this,Ai));if(e==null)throw new Error(`Floor ${u(this,Ai)} not found!`);return e}get center(){var e;if(u(this,ri).center==null){let[i,n]=(e=u(this,wr).properties.center)!=null?e:[0,0];u(this,ri).center=new et(n,i,u(this,Ai))}return u(this,ri).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(u(this,ri)))u(this,ri)[e]=null}};ya=new WeakMap,Ai=new WeakMap,ri=new WeakMap,wr=new WeakMap,l(Zn,"MapObject"),v(Zn,"__type","object");var ud=Zn,fe=ud;d();d();var va,qn,ga=class ga extends Ei{constructor(e){super(String(tt()));P(this,va,{});P(this,qn,void 0);E(this,qn,e.mvfData)}static is(e){return e.__type===ga.__type}get url(){return u(this,qn).url}get name(){return u(this,qn).altText}toJSON(){return{id:this.id,url:this.url,name:this.name}}destroy(){for(let e of globalThis.Object.keys(u(this,va)))delete u(this,va)[e]}};va=new WeakMap,qn=new WeakMap,l(ga,"Image"),v(ga,"__type","image");var pd=ga,gc=pd;var ba,ki,Ne,ii,$n=class $n extends Dt{constructor(e,i){super(i.mvfData.properties.id,i.mvfData.properties.details);v(this,"__type",$n.__type);P(this,ba,void 0);P(this,ki,void 0);P(this,Ne,{});P(this,ii,void 0);E(this,ba,e),E(this,ii,i.mvfData),E(this,ki,i.floorId)}static is(e){return e.__type===$n.__type}get name(){var e,i;return(i=(e=u(this,ii).properties.details)==null?void 0:e.name)!=null?i:""}get description(){var e,i;return(i=(e=u(this,ii).properties.details)==null?void 0:e.description)!=null?i:""}get images(){var e,i;if(u(this,Ne).images==null){let n=(i=(e=u(this,ii).properties.details)==null?void 0:e.images)!=null?i:[];u(this,Ne).images=n.map(o=>new gc({mvfData:o}))}return u(this,Ne).images}get floor(){let e=u(this,ba).getById("floor",u(this,ki));if(e==null)throw new Error(`Floor ${u(this,ki)} not found!`);return e}get coordinate(){var e;if(u(this,Ne).coordinate==null){let[i,n]=(e=u(this,ii).geometry.coordinates)!=null?e:[0,0];u(this,Ne).coordinate=new et(n,i,u(this,ki))}return u(this,Ne).coordinate}toJSON(){return{id:this.id,name:this.name,floor:this.floor.id,coordinate:this.coordinate.toJSON()}}destroy(){for(let e in u(this,Ne))u(this,Ne)[e]=null}};ba=new WeakMap,ki=new WeakMap,Ne=new WeakMap,ii=new WeakMap,l($n,"PointOfInterest"),v($n,"__type","point-of-interest");var hd=$n,ti=hd;d();var Ca,Ni,ni,Kn,xa,fd,Jn=class Jn extends Dt{constructor(e,i){super(i.mvfData.properties.id);P(this,xa);v(this,"__type",Jn.__type);P(this,Ca,void 0);P(this,Ni,void 0);P(this,ni,{});P(this,Kn,void 0);E(this,Ca,e),E(this,Ni,i.floorId),E(this,Kn,i.mvfData)}static is(e){return e.__type===Jn.__type}get group(){return X(this,xa,fd).call(this).group}get type(){return X(this,xa,fd).call(this).type}get coordinate(){if(u(this,ni).coordinate==null){let[e,i]=u(this,Kn).geometry.coordinates;u(this,ni).coordinate=new et(i,e,u(this,Ni))}return u(this,ni).coordinate}get floor(){let e=u(this,Ca).getById("floor",u(this,Ni));if(e==null)throw new Error(`Floor ${u(this,Ni)} 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(u(this,ni)))delete u(this,ni)[e]}};Ca=new WeakMap,Ni=new WeakMap,ni=new WeakMap,Kn=new WeakMap,xa=new WeakSet,fd=l(function(){let[e,i]=u(this,Kn).properties.symbolId.split("--");return{group:e,type:i}},"#getGroupAndTypeFromSymbolId"),l(Jn,"Annotation"),v(Jn,"__type","annotation");var dd=Jn,Un=dd;d();d();var to,Re,Ri,eo,Qn=class Qn extends Dt{constructor(e,i){super(i.mvfData.properties.id);v(this,"__type",Qn.__type);P(this,to,void 0);P(this,Re,{});P(this,Ri,void 0);P(this,eo,void 0);E(this,to,e),E(this,Ri,i.floorId),E(this,eo,i.mvfData)}static is(e){return e.__type===Qn.__type}get floor(){let e=u(this,to).getById("floor",u(this,Ri));if(e==null)throw new Error(`Floor ${u(this,Ri)} not found!`);return e}get coordinate(){if(u(this,Re).coordinate==null){let[e,i]=u(this,eo).geometry.coordinates;u(this,Re).coordinate=new et(i,e,u(this,Ri))}return u(this,Re).coordinate}get neighbors(){if(u(this,Re).neighbours==null){let e=u(this,eo).properties.neighbors.map(i=>{let n=u(this,to).getById("node",i.id);if(n==null)throw new Error(`Node ${i.id} not found!`);return n});u(this,Re).neighbours=e}return u(this,Re).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(u(this,Re)))delete u(this,Re)[e]}};to=new WeakMap,Re=new WeakMap,Ri=new WeakMap,eo=new WeakMap,l(Qn,"Node"),v(Qn,"__type","node");var md=Qn,v3=md;var O9=l((r,t)=>{var m,y;let e={},i={},n={},o={},a={},c={},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]}`;c[g]==null&&(c[g]=[]),c[g].push(M.properties.id);continue}if(M.properties.kind==="poi"){let g=new ti(t,{floorId:x,mvfData:M});i[M.properties.id]=g}else{let g=new de(t,{floorId:x,mvfData:M});e[M.properties.id]=g}}}}for(let x in c){let S=c[x],M={};for(let C of S){let I=p[C],T=a[C];M[I]=T}let g=new ei(t,{mvfDataByFloorId:M});s[g.id]=g}return{spacesById:e,poisById:i,connectionsById:s,spaceIdsByDestinationNodeId:n,objectEntranceNodeIdsByObstructionId:o,mvfSpacesById:a,connectionIdsByLatLon:c}},"processMVFSpaces"),A9=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"),k9=l((r,t)=>{let e={},i={},n={},o=globalThis.Object.keys(r.obstruction);for(let a of o){let c=r.obstruction[a];if(c!=null)for(let s of c.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 fe(t,{floorId:a,mvfData:s});e[s.properties.id]=p}}return{objectsById:e,mvfObstructionById:i,obstructionIdByEntranceId:n}},"processMVFObstructions"),N9=l((r,t)=>{let e={},i={};for(let n of r["map.geojson"]){i[n.id]=n;let o=new Qr(t,{mvfData:n});e[n.id]=o}return{floorsById:e,mvfMapsById:i}},"processMVFMaps"),R9=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"),B9=l((r,t)=>{let e={},i={},n={},o=globalThis.Object.keys(r.entrance);for(let a of o){let c=r.entrance[a];if(c!=null)for(let s of c.features){n[s.properties.id]=s;let p=new Jr(t,{floorId:a,mvfData:s});s.properties.node&&(i[s.properties.node]=p),e[s.properties.id]=p}}return{doorsById:e,doorsByNodeId:i,mvfEntrancesById:n}},"processMVFEntrances"),F9=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 c of a.features){i[c.properties.id]=c;let s=new Un(t,{floorId:o,mvfData:c});e[c.properties.id]=s}}return{annotationsById:e,mvfAnnotationsById:i}},"processMVFAnnotations"),b3=l((r,t)=>{let{spacesById:e,spaceIdsByDestinationNodeId:i,poisById:n,mvfSpacesById:o,objectEntranceNodeIdsByObstructionId:a,connectionsById:c,connectionIdsByLatLon:s}=O9(r,t),{nodesById:p,mvfNodesById:f}=A9(r,t),{objectsById:m,mvfObstructionById:y,obstructionIdByEntranceId:x}=k9(r,t),{floorsById:S,mvfMapsById:M}=N9(r,t),{mvfConnectionsById:g,mvfConnectionsByNodeId:C}=R9(r,t),{doorsById:I,doorsByNodeId:T,mvfEntrancesById:w}=B9(r,t),{annotationsById:L,mvfAnnotationsById:_}=F9(r,t);return{spacesById:e,nodesById:p,objectsById:m,floorsById:S,connectionsById:c,doorsById:I,doorsByNodeId:T,poisById:n,annotationsById:L,spaceIdsByDestinationNodeId:i,objectEntranceNodeIdsByObstructionId:a,obstructionIdByEntranceId:x,connectionIdsByLatLon:s,mvfSpacesById:o,mvfNodesById:f,mvfObstructionById:y,mvfMapsById:M,mvfConnectionsById:g,mvfConnectionsByNodeId:C,mvfEntrancesById:w,mvfAnnotationsById:_}},"createDataFromMVF");var st,Bi,Fi,Gi,Vi,Hi,Xi,ji,Wi,Sa,Pa,Ma,wa,Ta,Ia,Ea,La,yd=class yd{constructor(t,e){P(this,st,{});v(this,"mvf");v(this,"outdoorViewToken");v(this,"spaceIdsByDestinationNodeId");v(this,"objectEntranceNodeIdsByObstructionId");v(this,"obstructionIdByEntranceId");P(this,Bi,void 0);P(this,Fi,void 0);P(this,Gi,void 0);P(this,Vi,void 0);P(this,Hi,void 0);P(this,Xi,void 0);v(this,"doorsByNodeId");P(this,ji,void 0);P(this,Wi,void 0);P(this,Sa,void 0);P(this,Pa,void 0);P(this,Ma,void 0);P(this,wa,void 0);P(this,Ta,void 0);P(this,Ia,void 0);P(this,Ea,void 0);P(this,La,void 0);this.mvf=t,this.outdoorViewToken=e;let i=b3(t,this);E(this,Bi,i.nodesById),E(this,Fi,i.spacesById),E(this,Gi,i.floorsById),E(this,Vi,i.connectionsById),E(this,Hi,i.objectsById),E(this,Xi,i.doorsById),E(this,ji,i.poisById),E(this,Wi,i.annotationsById),E(this,Sa,i.mvfAnnotationsById),E(this,Pa,i.mvfConnectionsById),E(this,Ma,i.mvfConnectionsByNodeId),E(this,wa,i.mvfEntrancesById),E(this,Ta,i.mvfNodesById),E(this,Ia,i.mvfObstructionById),E(this,Ea,i.mvfSpacesById),E(this,La,i.mvfMapsById),this.doorsByNodeId=i.doorsByNodeId,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 et(this.mvf["manifest.geojson"].features[0].geometry.coordinates[1],this.mvf["manifest.geojson"].features[0].geometry.coordinates[0])}get spaces(){return u(this,st).spaces==null&&(u(this,st).spaces=globalThis.Object.values(u(this,Fi))),u(this,st).spaces}get objects(){return u(this,st).objects==null&&(u(this,st).objects=globalThis.Object.values(u(this,Hi))),u(this,st).objects}get connections(){return u(this,st).connections==null&&(u(this,st).connections=globalThis.Object.values(u(this,Vi))),u(this,st).connections}get floors(){return u(this,st).floors==null&&(u(this,st).floors=globalThis.Object.values(u(this,Gi))),u(this,st).floors}get doors(){return u(this,st).doors==null&&(u(this,st).doors=globalThis.Object.values(u(this,Xi))),u(this,st).doors}get pointsOfInterest(){return u(this,st).pointsOfInterest==null&&(u(this,st).pointsOfInterest=globalThis.Object.values(u(this,ji))),u(this,st).pointsOfInterest}get annotations(){return u(this,st).annotations==null&&(u(this,st).annotations=globalThis.Object.values(u(this,Wi))),u(this,st).annotations}get nodes(){return u(this,st).nodes==null&&(u(this,st).nodes=globalThis.Object.values(u(this,Bi))),u(this,st).nodes}getById(t,e){switch(t){case"space":return u(this,Fi)[e];case"floor":return u(this,Gi)[e];case"node":return u(this,Bi)[e];case"door":return u(this,Xi)[e];case"connection":return u(this,Vi)[e];case"object":return u(this,Hi)[e];case"point-of-interest":return u(this,ji)[e];case"annotation":return u(this,Wi)[e];default:throw new Error(`Unknown type: ${t}`)}}getMapDataById(t){var e,i,n,o,a,c,s;return(s=(c=(a=(o=(n=(i=(e=u(this,Fi)[t])!=null?e:u(this,Gi)[t])!=null?i:u(this,Bi)[t])!=null?n:u(this,Xi)[t])!=null?o:u(this,Vi)[t])!=null?a:u(this,Hi)[t])!=null?c:u(this,ji)[t])!=null?s:u(this,Wi)[t]}getMVFFeatureById(t,e){switch(t){case"space":return u(this,Ea)[e];case"node":return u(this,Ta)[e];case"obstruction":return u(this,Ia)[e];case"map":return u(this,La)[e];case"connection":return u(this,Pa)[e];case"entrance":return u(this,wa)[e];case"annotation":return u(this,Sa)[e];default:throw new Error(`Unknown MVF feature type: ${t}`)}}getMVFFeatureByNodeId(t,e){switch(t){case"connection":return u(this,Ma)[e];default:throw new Error(`Unsupported MVF feature type: ${t}`)}}destroy(){for(let t of globalThis.Object.keys(u(this,st)))u(this,st)[t]=null}};st=new WeakMap,Bi=new WeakMap,Fi=new WeakMap,Gi=new WeakMap,Vi=new WeakMap,Hi=new WeakMap,Xi=new WeakMap,ji=new WeakMap,Wi=new WeakMap,Sa=new WeakMap,Pa=new WeakMap,Ma=new WeakMap,wa=new WeakMap,Ta=new WeakMap,Ia=new WeakMap,Ea=new WeakMap,La=new WeakMap,l(yd,"MapDataInternal");var ro=yd;d();d();d();d();var gd=class gd{_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(gd,"PubSub");var z=gd;d();var C3="mi-session-data",x3="mi-local-data",Yi,Be,Fe,Da=class Da{constructor(){P(this,Be,void 0);P(this,Fe,void 0);try{let t=sessionStorage.getItem(C3);t?E(this,Be,JSON.parse(t)):E(this,Be,{id:tt()})}catch{E(this,Be,{id:tt()})}try{let t=localStorage.getItem(x3);t?E(this,Fe,JSON.parse(t)):E(this,Fe,{deviceId:tt()})}catch{E(this,Fe,{deviceId:tt()})}u(this,Be).id||(u(this,Be).id=tt()),u(this,Fe).deviceId||(u(this,Fe).deviceId=tt())}static getInstance(){return u(this,Yi)||E(this,Yi,new Da),u(this,Yi)}static ___clearInstance(){E(this,Yi,void 0)}saveSessionData(t,e){u(this,Be)[t]=e;try{return sessionStorage.setItem(C3,JSON.stringify(u(this,Be))),!0}catch{return!1}}loadSessionData(t){let e=u(this,Be)[t];if(e!=null)return e}saveLocalData(t,e){u(this,Fe)[t]=e;try{return localStorage.setItem(x3,JSON.stringify(u(this,Fe))),!0}catch{return!1}}loadLocalData(t){let e=u(this,Fe)[t];if(e!=null)return e}};Yi=new WeakMap,Be=new WeakMap,Fe=new WeakMap,l(Da,"SafeStorage"),P(Da,Yi,void 0);var io=Da;d();d();d();d();var no=class no{id;text;__type=no.__type;static is(t){return t.__type===no.__type}constructor(t,e){this.id=t,this.text=e}};l(no,"Label"),v(no,"__type","Label");var oi=no;d();var oo=class oo{id;__type=oo.__type;contentEl;static is(t){return t.__type===oo.__type}constructor(t,e){this.id=t,this.contentEl=e}};l(oo,"Marker"),v(oo,"__type","Marker");var Ui=oo;d();var ao=class ao{id;groupId;__type=ao.__type;static is(t){return t.__type===ao.__type}constructor(t,e){this.id=t,this.groupId=e}};l(ao,"Model"),v(ao,"__type","Model");var _a=ao;d();var vd=class vd{id;__type;constructor(t){this.id=t,this.__type="Path"}};l(vd,"Path");var Oa=vd;d();var ai,bd=class bd{constructor(t){P(this,ai,void 0);E(this,ai,t)}get center(){return u(this,ai).center}get bearing(){return u(this,ai).bearing}get pitch(){return u(this,ai).pitch}get zoomLevel(){return u(this,ai).zoomLevel}};ai=new WeakMap,l(bd,"CameraTransform");var Aa=bd;d();var so=class so{id;__type=so.__type;static is(t){return t.__type===so.__type}constructor(t){this.id=t}};l(so,"Shape"),v(so,"__type","Shape");var ka=so;d();d();d();var G9=new Map([["search-16x16",`<svg viewBox="0 0 16 16">
5
5
  <path
6
6
  fillRule="evenodd"
7
7
  clipRule="evenodd"
@@ -446,7 +446,7 @@ import{h as rp,i as X1,j as cl}from"./chunk-4GHXJDEX.js";import{a as Je}from"./c
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}};mo=new WeakMap,l(_f,"InteractionSystem");var Ja=_f;function Pb(r,t){let e=r.components[2];e&&(e.hover=t,e.dirty=!0)}l(Pb,"updateHover");function ox(r,t,e){return t?"grabbing":r?"pointer":e?"grabbing":"grab"}l(ox,"processCursor");d();d();d();function $c(r){"@babel/helpers - typeof";return $c=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},$c(r)}l($c,"_typeof");var ax=/^\s+/,sx=/\s+$/;function F(r,t){if(r=r||"",t=t||{},r instanceof F)return r;if(!(this instanceof F))return new F(r,t);var e=lx(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(F,"tinycolor");F.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,c;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?c=n/12.92:c=Math.pow((n+.055)/1.055,2.4),.2126*o+.7152*a+.0722*c},"getLuminance"),setAlpha:l(function(t){return this._a=Db(t),this._roundA=Math.round(100*this._a)/100,this},"setAlpha"),toHsv:l(function(){var t=wb(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=wb(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=Mb(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=Mb(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 Tb(this._r,this._g,this._b,t)},"toHex"),toHexString:l(function(t){return"#"+this.toHex(t)},"toHexString"),toHex8:l(function(t){return hx(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:Mx[Tb(this._r,this._g,this._b,!0)]||!1},"toName"),toFilter:l(function(t){var e="#"+Ib(this._r,this._g,this._b,this._a),i=e,n=this._gradientType?"GradientType = 1, ":"";if(t){var o=F(t);i="#"+Ib(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 F(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(yx,arguments)},"lighten"),brighten:l(function(){return this._applyModification(gx,arguments)},"brighten"),darken:l(function(){return this._applyModification(vx,arguments)},"darken"),desaturate:l(function(){return this._applyModification(dx,arguments)},"desaturate"),saturate:l(function(){return this._applyModification(fx,arguments)},"saturate"),greyscale:l(function(){return this._applyModification(mx,arguments)},"greyscale"),spin:l(function(){return this._applyModification(bx,arguments)},"spin"),_applyCombination:l(function(t,e){return t.apply(null,[this].concat([].slice.call(e)))},"_applyCombination"),analogous:l(function(){return this._applyCombination(Sx,arguments)},"analogous"),complement:l(function(){return this._applyCombination(Cx,arguments)},"complement"),monochromatic:l(function(){return this._applyCombination(Px,arguments)},"monochromatic"),splitcomplement:l(function(){return this._applyCombination(xx,arguments)},"splitcomplement"),triad:l(function(){return this._applyCombination(Eb,[3])},"triad"),tetrad:l(function(){return this._applyCombination(Eb,[4])},"tetrad")};F.fromRatio=function(r,t){if($c(r)=="object"){var e={};for(var i in r)r.hasOwnProperty(i)&&(i==="a"?e[i]=r[i]:e[i]=Ka(r[i]));r=e}return F(r,t)};function lx(r){var t={r:0,g:0,b:0},e=1,i=null,n=null,o=null,a=!1,c=!1;return typeof r=="string"&&(r=Ex(r)),$c(r)=="object"&&(_r(r.r)&&_r(r.g)&&_r(r.b)?(t=cx(r.r,r.g,r.b),a=!0,c=String(r.r).substr(-1)==="%"?"prgb":"rgb"):_r(r.h)&&_r(r.s)&&_r(r.v)?(i=Ka(r.s),n=Ka(r.v),t=px(r.h,i,n),a=!0,c="hsv"):_r(r.h)&&_r(r.s)&&_r(r.l)&&(i=Ka(r.s),o=Ka(r.l),t=ux(r.h,i,o),a=!0,c="hsl"),r.hasOwnProperty("a")&&(e=r.a)),e=Db(e),{ok:a,format:r.format||c,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(lx,"inputToRGB");function cx(r,t,e){return{r:ft(r,255)*255,g:ft(t,255)*255,b:ft(e,255)*255}}l(cx,"rgbToRgb");function Mb(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,c=(i+n)/2;if(i==n)o=a=0;else{var s=i-n;switch(a=c>.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:c}}l(Mb,"rgbToHsl");function ux(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 c=e<.5?e*(1+t):e+t-e*t,s=2*e-c;i=a(s,c,r+1/3),n=a(s,c,r),o=a(s,c,r-1/3)}return{r:i*255,g:n*255,b:o*255}}l(ux,"hslToRgb");function wb(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,c=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:c}}l(wb,"rgbToHsv");function px(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),c=e*(1-(1-n)*t),s=i%6,p=[e,a,o,o,c,e][s],f=[c,e,e,a,o,o][s],m=[o,o,c,e,e,a][s];return{r:p*255,g:f*255,b:m*255}}l(px,"hsvToRgb");function Tb(r,t,e,i){var n=[He(Math.round(r).toString(16)),He(Math.round(t).toString(16)),He(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(Tb,"rgbToHex");function hx(r,t,e,i,n){var o=[He(Math.round(r).toString(16)),He(Math.round(t).toString(16)),He(Math.round(e).toString(16)),He(_b(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(hx,"rgbaToHex");function Ib(r,t,e,i){var n=[He(_b(i)),He(Math.round(r).toString(16)),He(Math.round(t).toString(16)),He(Math.round(e).toString(16))];return n.join("")}l(Ib,"rgbaToArgbHex");F.equals=function(r,t){return!r||!t?!1:F(r).toRgbString()==F(t).toRgbString()};F.random=function(){return F.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function dx(r,t){t=t===0?0:t||10;var e=F(r).toHsl();return e.s-=t/100,e.s=Jc(e.s),F(e)}l(dx,"_desaturate");function fx(r,t){t=t===0?0:t||10;var e=F(r).toHsl();return e.s+=t/100,e.s=Jc(e.s),F(e)}l(fx,"_saturate");function mx(r){return F(r).desaturate(100)}l(mx,"_greyscale");function yx(r,t){t=t===0?0:t||10;var e=F(r).toHsl();return e.l+=t/100,e.l=Jc(e.l),F(e)}l(yx,"_lighten");function gx(r,t){t=t===0?0:t||10;var e=F(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)))),F(e)}l(gx,"_brighten");function vx(r,t){t=t===0?0:t||10;var e=F(r).toHsl();return e.l-=t/100,e.l=Jc(e.l),F(e)}l(vx,"_darken");function bx(r,t){var e=F(r).toHsl(),i=(e.h+t)%360;return e.h=i<0?360+i:i,F(e)}l(bx,"_spin");function Cx(r){var t=F(r).toHsl();return t.h=(t.h+180)%360,F(t)}l(Cx,"_complement");function Eb(r,t){if(isNaN(t)||t<=0)throw new Error("Argument to polyad must be a positive number");for(var e=F(r).toHsl(),i=[F(r)],n=360/t,o=1;o<t;o++)i.push(F({h:(e.h+o*n)%360,s:e.s,l:e.l}));return i}l(Eb,"polyad");function xx(r){var t=F(r).toHsl(),e=t.h;return[F(r),F({h:(e+72)%360,s:t.s,l:t.l}),F({h:(e+216)%360,s:t.s,l:t.l})]}l(xx,"_splitcomplement");function Sx(r,t,e){t=t||6,e=e||30;var i=F(r).toHsl(),n=360/e,o=[F(r)];for(i.h=(i.h-(n*t>>1)+720)%360;--t;)i.h=(i.h+n)%360,o.push(F(i));return o}l(Sx,"_analogous");function Px(r,t){t=t||6;for(var e=F(r).toHsv(),i=e.h,n=e.s,o=e.v,a=[],c=1/t;t--;)a.push(F({h:i,s:n,v:o})),o=(o+c)%1;return a}l(Px,"_monochromatic");F.mix=function(r,t,e){e=e===0?0:e||50;var i=F(r).toRgb(),n=F(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 F(a)};F.readability=function(r,t){var e=F(r),i=F(t);return(Math.max(e.getLuminance(),i.getLuminance())+.05)/(Math.min(e.getLuminance(),i.getLuminance())+.05)};F.isReadable=function(r,t,e){var i=F.readability(r,t),n,o;switch(o=!1,n=Lx(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};F.mostReadable=function(r,t,e){var i=null,n=0,o,a,c,s;e=e||{},a=e.includeFallbackColors,c=e.level,s=e.size;for(var p=0;p<t.length;p++)o=F.readability(r,t[p]),o>n&&(n=o,i=F(t[p]));return F.isReadable(r,i,{level:c,size:s})||!a?i:(e.includeFallbackColors=!1,F.mostReadable(r,["#fff","#000"],e))};var Of=F.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"},Mx=F.hexNames=wx(Of);function wx(r){var t={};for(var e in r)r.hasOwnProperty(e)&&(t[r[e]]=e);return t}l(wx,"flip");function Db(r){return r=parseFloat(r),(isNaN(r)||r<0||r>1)&&(r=1),r}l(Db,"boundAlpha");function ft(r,t){Tx(r)&&(r="100%");var e=Ix(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 Jc(r){return Math.min(1,Math.max(0,r))}l(Jc,"clamp01");function ye(r){return parseInt(r,16)}l(ye,"parseIntFromHex");function Tx(r){return typeof r=="string"&&r.indexOf(".")!=-1&&parseFloat(r)===1}l(Tx,"isOnePointZero");function Ix(r){return typeof r=="string"&&r.indexOf("%")!=-1}l(Ix,"isPercentage");function He(r){return r.length==1?"0"+r:""+r}l(He,"pad2");function Ka(r){return r<=1&&(r=r*100+"%"),r}l(Ka,"convertToPercentage");function _b(r){return Math.round(parseFloat(r)*255).toString(16)}l(_b,"convertDecimalToHex");function Lb(r){return ye(r)/255}l(Lb,"convertHexToDecimal");var Ve=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 _r(r){return!!Ve.CSS_UNIT.exec(r)}l(_r,"isValidCSSUnit");function Ex(r){r=r.replace(ax,"").replace(sx,"").toLowerCase();var t=!1;if(Of[r])r=Of[r],t=!0;else if(r=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var e;return(e=Ve.rgb.exec(r))?{r:e[1],g:e[2],b:e[3]}:(e=Ve.rgba.exec(r))?{r:e[1],g:e[2],b:e[3],a:e[4]}:(e=Ve.hsl.exec(r))?{h:e[1],s:e[2],l:e[3]}:(e=Ve.hsla.exec(r))?{h:e[1],s:e[2],l:e[3],a:e[4]}:(e=Ve.hsv.exec(r))?{h:e[1],s:e[2],v:e[3]}:(e=Ve.hsva.exec(r))?{h:e[1],s:e[2],v:e[3],a:e[4]}:(e=Ve.hex8.exec(r))?{r:ye(e[1]),g:ye(e[2]),b:ye(e[3]),a:Lb(e[4]),format:t?"name":"hex8"}:(e=Ve.hex6.exec(r))?{r:ye(e[1]),g:ye(e[2]),b:ye(e[3]),format:t?"name":"hex"}:(e=Ve.hex4.exec(r))?{r:ye(e[1]+""+e[1]),g:ye(e[2]+""+e[2]),b:ye(e[3]+""+e[3]),a:Lb(e[4]+""+e[4]),format:t?"name":"hex8"}:(e=Ve.hex3.exec(r))?{r:ye(e[1]+""+e[1]),g:ye(e[2]+""+e[2]),b:ye(e[3]+""+e[3]),format:t?"name":"hex"}:!1}l(Ex,"stringInputToObject");function Lx(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(Lx,"validateWCAG2Parms");var Wf=Gr(l4());var bo={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}}},xP={lightOnDark:{...bo,text:{...bo.text,foregroundColor:"white",backgroundColor:"#333"},marker:{...bo.marker,foregroundColor:{active:"white",inactive:void 0},backgroundColor:{active:"#333",inactive:void 0}}},darkOnLight:{...bo,text:{...bo.text,foregroundColor:"#333",backgroundColor:"white"},marker:{...bo.marker,foregroundColor:{active:"#333",inactive:void 0},backgroundColor:{active:"white",inactive:void 0}}}},SP="LOW_PRIORITY",c4=4,PP=6,MP=20,wP=2.5,TP=2,IP="cover",u4=.5,EP=6.5,p4={heightAbovePolygon:0,appearance:xP.darkOnLight};var nn=class nn{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:tt(),this.options=(0,Wf.default)({},e,p4),this.text=t,this.dp=(c=1)=>c*i.pixelRatio,typeof e.rank=="string")this.rank=fo(e.rank),this.initialRank=this.rank;else if(e.rank!=null&&e.rank>0)this.rank=e.rank,this.initialRank=e.rank;else{let c=Math.trunc(b.env.NODE_ENV==="test"?nn.testId:nn.testId*10)/10;nn.testId+=.001,this.rank=c,this.initialRank=c}let n=(0,Wf.default)({},this.options.appearance,p4.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||F(n.marker.foregroundColor.active).setAlpha(.5).toRgbString()},backgroundColor:{active:n.marker.backgroundColor.active,inactive:n.marker.backgroundColor.inactive||F(n.marker.backgroundColor.active).setAlpha(.5).toRgbString()},icon:n.marker.icon,iconSize:n.marker.iconSize||MP,iconPadding:(a=n.marker.iconPadding)!=null?a:TP,iconFit:n.marker.iconFit||IP,iconVisibilityThreshold:n.marker.iconVisibilityThreshold==null?u4:n.marker.iconVisibilityThreshold}},this.calculateMarkerSize()}calculateMarkerSize(){let{iconVisibilityThreshold:t=u4}=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(EP)),this.totalMarkerSize=Math.ceil((this.markerSize+wP)/e)}get strategies(){let{width:t,height:e}=this.dimensions,{margin:i}=this.appearance;this.calculateMarkerSize();let n=Math.max(PP,i),o=this.iconVisible?n/2:0,a=[{name:"RIGHT",getBoundingBox:()=>{let c=Math.max(this.totalMarkerSize,e);return[c/2+n,c/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+c4,this.newStyle.textLabelVisible=!0}},{name:"LEFT",getBoundingBox:()=>{let c=Math.max(this.totalMarkerSize,e);return[c/2+n,c/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-c4,this.newStyle.textLabelVisible=!0}},{name:"TOP",getBoundingBox:()=>{let c=this.dp();return[e+this.totalMarkerSize/2/c+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:SP,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(nn,"LabelComponent"),v(nn,"testId",0);var Yf=nn,ur=Yf;d();d();function h4(r){return yl(r)}l(h4,"getBoundingBoxFromFeature");var Uf=class Uf extends wn{userData={entities:{}}};l(Uf,"EntityBatchedMesh");var Co=Uf,ns,os,on,zf=class zf{constructor(t){v(this,"mesh");v(this,"focusMesh");v(this,"outline");v(this,"type","geometry");v(this,"instanceIndex",-1);v(this,"geometry");v(this,"material");v(this,"feature");v(this,"focusable",!1);v(this,"color",new It);v(this,"topColor",new It);v(this,"position",new Y);P(this,ns,0);P(this,os,1);P(this,on,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 u(this,ns)}set altitude(t){this.mesh&&(this.mesh.position.z=t,E(this,ns,t))}get opacity(){return u(this,os)}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,os,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 u(this,on)?u(this,on):(E(this,on,h4(this.feature)),u(this,on))}showTextures(){this.material&&(this.material.showTextures(this.instanceIndex),this.texturesVisible=!0)}hideTextures(){this.material&&(this.material.hideTextures(this.instanceIndex),this.texturesVisible=!1)}};ns=new WeakMap,os=new WeakMap,on=new WeakMap,l(zf,"MeshComponent");var Rt=zf;var Zf=class Zf extends z{constructor(){super()}interpolators=new Map;addEntity3D(t,e){let[i,n,o,a]=e[1];this.interpolators.set(t,c=>me(c,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 Rt?e.setOpacity(i(t)):e instanceof ur?e.enabled=i(t):i(t)};destroy(){this.interpolators.clear()}};l(Zf,"ZoomInterpolationSystem");var au=Zf;d();var an=class an{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)||tt(),this.options=e,typeof e.rank=="string")this.rank=fo(e.rank);else if(e.rank!=null&&e.rank>0)this.rank=e.rank;else{let n=Math.trunc(b.env.NODE_ENV==="test"?an.testId:an.testId*10)/10;an.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(an,"MarkerComponent"),v(an,"testId",0);var Me=an;d();d();d();d();d();var qf=class qf{hover=!1;dirty=!1};l(qf,"InteractionComponent");var xo=qf;function ge(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 Pe&&r.components[1]===void 0?(r.components[1]=new xo,r.components[1].dirty=!0):r instanceof dt&&r.components[2]===void 0?(r.components[2]=new xo,r.components[2].dirty=!0):r instanceof Tt&&r.components[1]===void 0&&(r.components[1]=new xo,r.components[1].dirty=!0),!0):(r instanceof Pe?r.components[1]=void 0:r instanceof dt?r.components[2]=void 0:r instanceof Tt&&(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),ge(i,t,e);return!0}}return!1}l(ge,"updateInteractivity");function d4(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(d4,"updateGroupColor");function f4(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(f4,"updateGroupShading");function m4(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(m4,"updateColor");function Jf(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(Jf,"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 Tt?((e=r.parent)==null||e.removeEntity(r),t.addEntity(r),!0):!1}l(Kf,"updateParent");function y4(r,t){t!==void 0&&(r.type==="marker"||r.type==="label")&&(r.components[0].enabled=t)}l(y4,"updateEnabled");function g4(r,t){if(t!==void 0&&r.type==="path"){let e=r.components[0];t.completeFraction!==void 0&&(e.completeFraction=t.completeFraction)}}l(g4,"updatePath");function v4(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(v4,"updateMarker");function b4(r,t){return t!==void 0&&(r.type==="marker"||r.type==="label")?(r.components[0].rank=fo(t),!0):!1}l(b4,"updateRank");function C4(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&&(Pf(o.appearance,((n=t.options)==null?void 0:n.appearance)||{}),o.dirty=!0)}}l(C4,"updateLabel");function x4(r,t){t!==void 0&&r.type==="geometry"&&(r.components[1].hoverColor=t,r.components[1].dirty=!0)}l(x4,"updateHoverColor");function So(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 Vt&&(e.userData.outlineDirty=!0)}else(r.type==="group-container"||r.type==="geometry-group")&&r.setVisible(t);return!0}return!1}l(So,"updateVisibility");function S4(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(S4,"updateOpacity");function Qf(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(Qf,"updateAltitude");function tm(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 Vt&&(e.userData.outlineDirty=!0)}return!0}return!1}l(tm,"updateOutline");var sn,pr,su,lu,P4,ss,cu,uu,M4,pu,w4,ls,hu,cs,us,du,rm=class rm{constructor(t){P(this,lu);P(this,uu);P(this,pu);P(this,sn,null);P(this,pr,void 0);v(this,"getCurrentSceneGLTF",async t=>{let e={onlyVisible:!0,binary:!0,light:!0,scale:1,...t},i=await X(this,lu,P4).call(this),n=u(this,su).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 c=JSON.stringify(o,null,2);a=new Blob([c],{type:"text/plain"})}return a});P(this,su,l(t=>{let{scale:e,light:i,onlyVisible:n}=t,o=new al,a=new yr().setFromObject(u(this,pr).entityScene);if(u(this,ss).call(this,u(this,pr).entityScene,o,n),i){let c=new ll(16777215,.3*Math.PI);c.position.set(0,Math.max(a.max.x,a.max.y)*e*.5,a.max.y*e*4),c.lookAt(0,0,-1),c.target.position.set(0,0,-1),c.add(c.target),o.add(c)}return o},"#getExportedScene"));P(this,ss,l((t,e,i)=>{t.material&&(t instanceof wn?X(this,uu,M4).call(this,t).forEach(n=>e.add(n)):t instanceof Pi&&e.add(X(this,pu,w4).call(this,t))),t.children.forEach(n=>{(!i||n.visible)&&u(this,ss).call(this,n,e,i)})},"#processObject3D"));P(this,cu,l((t,e,i)=>{let n=new F1({color:new It(t),metalness:0});return n.opacity=e,n.transparent=i,n},"#createStandardMaterial"));P(this,ls,l(t=>{let{geometry:e,material:i,position:n,rotation:o,quaternion:a,scale:c}=t;if(!(e!=null&&e.isBufferGeometry))return t;let s=e.attributes.position,p=e.attributes.normal,f=e.attributes.uv;return u(this,hu).call(this,s,p),u(this,us).call(this,n,c,o,a),f&&u(this,du).call(this,f),i!=null&&i.map&&e.type==="PlaneGeometry"&&(t.side=Vo),t},"#convertGeometry"));P(this,hu,l((t,e)=>{let i=new Y,n=new Y;for(let o=0;o<t.count;o++)i.fromBufferAttribute(t,o),u(this,cs).call(this,i),t.setXYZ(o,i.x,i.y,i.z),e&&(n.fromBufferAttribute(e,o),u(this,cs).call(this,n),e.setXYZ(o,n.x,n.y,n.z))},"#convertAttributes"));P(this,cs,l(t=>{let e=t.y;t.y=t.z,t.z=-e},"#convertVector"));P(this,us,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 Pn)i.order="YXZ",i.set(i.x,i.y,i.z,i.order);else{let c=n.y;n.set(n.x,n.z,-c,n.w)}},"#convertObjectProperties"));P(this,du,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,pr,t),u(this,pr).entityScene=t.entityScene,u(this,pr).entity3DMap=t.entity3DMap}destroy(){E(this,sn,null)}};sn=new WeakMap,pr=new WeakMap,su=new WeakMap,lu=new WeakSet,P4=l(async function(){if(!u(this,sn)){let{GLTFExporter:t}=await import("./GLTFExporter-KPBXVK2J.js");E(this,sn,new t)}return u(this,sn)},"#getGLTFExporter"),ss=new WeakMap,cu=new WeakMap,uu=new WeakSet,M4=l(function(t){var a,c;let e=[],n=((a=t.userData)!=null&&a.entities?Object.values((c=t.userData)==null?void 0:c.entities):[]).map(s=>u(this,pr).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||u(this,pr).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=u(this,cu).call(this,f,Number(m),t.material.transparent),M=Je(x,!0),g=new Ft(M,S);g.position.copy(t.position),g.rotation.copy(t.rotation),g.scale.copy(t.scale),g.visible=!!y,u(this,us).call(this,g.position,g.scale,g.rotation,g.quaternion),e.push(u(this,ls).call(this,g))}),e},"#processBatchedMesh"),pu=new WeakSet,w4=l(function(t){let e=t.geometry.clone(),i=t.material,n=new Vr({color:i.color,side:Vo});n.opacity=i.opacity,n.transparent=i.transparent;let o=new Pi(e,n);return o.position.copy(t.position),o.rotation.copy(t.rotation),o.scale.copy(t.scale),o.visible=t.visible,u(this,ls).call(this,o)},"#processLineSegments"),ls=new WeakMap,hu=new WeakMap,cs=new WeakMap,us=new WeakMap,du=new WeakMap,l(rm,"ExporterSystem");var as=rm;d();var T4="#ffffff";var im=class im{initialColor=T4;color=T4;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(im,"StyleComponent");var hi=im;d();d();d();d();var fu={top:0,bottom:0,left:0,right:0};d();d();d();d();var nm=class nm extends A1{_width;_height;_propertiesLength;constructor(t){let e=t,i=3,n=i*4;super(new Float32Array(t*n),i,t,S1,x1),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(nm,"BatchedPropertiesTexture");var mu=nm;var I4=`#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}};mo=new WeakMap,l(_f,"InteractionSystem");var Ja=_f;function Pb(r,t){let e=r.components[2];e&&(e.hover=t,e.dirty=!0)}l(Pb,"updateHover");function ox(r,t,e){return t?"grabbing":r?"pointer":e?"grabbing":"grab"}l(ox,"processCursor");d();d();d();function $c(r){"@babel/helpers - typeof";return $c=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},$c(r)}l($c,"_typeof");var ax=/^\s+/,sx=/\s+$/;function F(r,t){if(r=r||"",t=t||{},r instanceof F)return r;if(!(this instanceof F))return new F(r,t);var e=lx(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(F,"tinycolor");F.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,c;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?c=n/12.92:c=Math.pow((n+.055)/1.055,2.4),.2126*o+.7152*a+.0722*c},"getLuminance"),setAlpha:l(function(t){return this._a=Db(t),this._roundA=Math.round(100*this._a)/100,this},"setAlpha"),toHsv:l(function(){var t=wb(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=wb(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=Mb(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=Mb(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 Tb(this._r,this._g,this._b,t)},"toHex"),toHexString:l(function(t){return"#"+this.toHex(t)},"toHexString"),toHex8:l(function(t){return hx(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:Mx[Tb(this._r,this._g,this._b,!0)]||!1},"toName"),toFilter:l(function(t){var e="#"+Ib(this._r,this._g,this._b,this._a),i=e,n=this._gradientType?"GradientType = 1, ":"";if(t){var o=F(t);i="#"+Ib(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 F(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(yx,arguments)},"lighten"),brighten:l(function(){return this._applyModification(gx,arguments)},"brighten"),darken:l(function(){return this._applyModification(vx,arguments)},"darken"),desaturate:l(function(){return this._applyModification(dx,arguments)},"desaturate"),saturate:l(function(){return this._applyModification(fx,arguments)},"saturate"),greyscale:l(function(){return this._applyModification(mx,arguments)},"greyscale"),spin:l(function(){return this._applyModification(bx,arguments)},"spin"),_applyCombination:l(function(t,e){return t.apply(null,[this].concat([].slice.call(e)))},"_applyCombination"),analogous:l(function(){return this._applyCombination(Sx,arguments)},"analogous"),complement:l(function(){return this._applyCombination(Cx,arguments)},"complement"),monochromatic:l(function(){return this._applyCombination(Px,arguments)},"monochromatic"),splitcomplement:l(function(){return this._applyCombination(xx,arguments)},"splitcomplement"),triad:l(function(){return this._applyCombination(Eb,[3])},"triad"),tetrad:l(function(){return this._applyCombination(Eb,[4])},"tetrad")};F.fromRatio=function(r,t){if($c(r)=="object"){var e={};for(var i in r)r.hasOwnProperty(i)&&(i==="a"?e[i]=r[i]:e[i]=Ka(r[i]));r=e}return F(r,t)};function lx(r){var t={r:0,g:0,b:0},e=1,i=null,n=null,o=null,a=!1,c=!1;return typeof r=="string"&&(r=Ex(r)),$c(r)=="object"&&(_r(r.r)&&_r(r.g)&&_r(r.b)?(t=cx(r.r,r.g,r.b),a=!0,c=String(r.r).substr(-1)==="%"?"prgb":"rgb"):_r(r.h)&&_r(r.s)&&_r(r.v)?(i=Ka(r.s),n=Ka(r.v),t=px(r.h,i,n),a=!0,c="hsv"):_r(r.h)&&_r(r.s)&&_r(r.l)&&(i=Ka(r.s),o=Ka(r.l),t=ux(r.h,i,o),a=!0,c="hsl"),r.hasOwnProperty("a")&&(e=r.a)),e=Db(e),{ok:a,format:r.format||c,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(lx,"inputToRGB");function cx(r,t,e){return{r:ft(r,255)*255,g:ft(t,255)*255,b:ft(e,255)*255}}l(cx,"rgbToRgb");function Mb(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,c=(i+n)/2;if(i==n)o=a=0;else{var s=i-n;switch(a=c>.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:c}}l(Mb,"rgbToHsl");function ux(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 c=e<.5?e*(1+t):e+t-e*t,s=2*e-c;i=a(s,c,r+1/3),n=a(s,c,r),o=a(s,c,r-1/3)}return{r:i*255,g:n*255,b:o*255}}l(ux,"hslToRgb");function wb(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,c=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:c}}l(wb,"rgbToHsv");function px(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),c=e*(1-(1-n)*t),s=i%6,p=[e,a,o,o,c,e][s],f=[c,e,e,a,o,o][s],m=[o,o,c,e,e,a][s];return{r:p*255,g:f*255,b:m*255}}l(px,"hsvToRgb");function Tb(r,t,e,i){var n=[He(Math.round(r).toString(16)),He(Math.round(t).toString(16)),He(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(Tb,"rgbToHex");function hx(r,t,e,i,n){var o=[He(Math.round(r).toString(16)),He(Math.round(t).toString(16)),He(Math.round(e).toString(16)),He(_b(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(hx,"rgbaToHex");function Ib(r,t,e,i){var n=[He(_b(i)),He(Math.round(r).toString(16)),He(Math.round(t).toString(16)),He(Math.round(e).toString(16))];return n.join("")}l(Ib,"rgbaToArgbHex");F.equals=function(r,t){return!r||!t?!1:F(r).toRgbString()==F(t).toRgbString()};F.random=function(){return F.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function dx(r,t){t=t===0?0:t||10;var e=F(r).toHsl();return e.s-=t/100,e.s=Jc(e.s),F(e)}l(dx,"_desaturate");function fx(r,t){t=t===0?0:t||10;var e=F(r).toHsl();return e.s+=t/100,e.s=Jc(e.s),F(e)}l(fx,"_saturate");function mx(r){return F(r).desaturate(100)}l(mx,"_greyscale");function yx(r,t){t=t===0?0:t||10;var e=F(r).toHsl();return e.l+=t/100,e.l=Jc(e.l),F(e)}l(yx,"_lighten");function gx(r,t){t=t===0?0:t||10;var e=F(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)))),F(e)}l(gx,"_brighten");function vx(r,t){t=t===0?0:t||10;var e=F(r).toHsl();return e.l-=t/100,e.l=Jc(e.l),F(e)}l(vx,"_darken");function bx(r,t){var e=F(r).toHsl(),i=(e.h+t)%360;return e.h=i<0?360+i:i,F(e)}l(bx,"_spin");function Cx(r){var t=F(r).toHsl();return t.h=(t.h+180)%360,F(t)}l(Cx,"_complement");function Eb(r,t){if(isNaN(t)||t<=0)throw new Error("Argument to polyad must be a positive number");for(var e=F(r).toHsl(),i=[F(r)],n=360/t,o=1;o<t;o++)i.push(F({h:(e.h+o*n)%360,s:e.s,l:e.l}));return i}l(Eb,"polyad");function xx(r){var t=F(r).toHsl(),e=t.h;return[F(r),F({h:(e+72)%360,s:t.s,l:t.l}),F({h:(e+216)%360,s:t.s,l:t.l})]}l(xx,"_splitcomplement");function Sx(r,t,e){t=t||6,e=e||30;var i=F(r).toHsl(),n=360/e,o=[F(r)];for(i.h=(i.h-(n*t>>1)+720)%360;--t;)i.h=(i.h+n)%360,o.push(F(i));return o}l(Sx,"_analogous");function Px(r,t){t=t||6;for(var e=F(r).toHsv(),i=e.h,n=e.s,o=e.v,a=[],c=1/t;t--;)a.push(F({h:i,s:n,v:o})),o=(o+c)%1;return a}l(Px,"_monochromatic");F.mix=function(r,t,e){e=e===0?0:e||50;var i=F(r).toRgb(),n=F(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 F(a)};F.readability=function(r,t){var e=F(r),i=F(t);return(Math.max(e.getLuminance(),i.getLuminance())+.05)/(Math.min(e.getLuminance(),i.getLuminance())+.05)};F.isReadable=function(r,t,e){var i=F.readability(r,t),n,o;switch(o=!1,n=Lx(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};F.mostReadable=function(r,t,e){var i=null,n=0,o,a,c,s;e=e||{},a=e.includeFallbackColors,c=e.level,s=e.size;for(var p=0;p<t.length;p++)o=F.readability(r,t[p]),o>n&&(n=o,i=F(t[p]));return F.isReadable(r,i,{level:c,size:s})||!a?i:(e.includeFallbackColors=!1,F.mostReadable(r,["#fff","#000"],e))};var Of=F.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"},Mx=F.hexNames=wx(Of);function wx(r){var t={};for(var e in r)r.hasOwnProperty(e)&&(t[r[e]]=e);return t}l(wx,"flip");function Db(r){return r=parseFloat(r),(isNaN(r)||r<0||r>1)&&(r=1),r}l(Db,"boundAlpha");function ft(r,t){Tx(r)&&(r="100%");var e=Ix(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 Jc(r){return Math.min(1,Math.max(0,r))}l(Jc,"clamp01");function ye(r){return parseInt(r,16)}l(ye,"parseIntFromHex");function Tx(r){return typeof r=="string"&&r.indexOf(".")!=-1&&parseFloat(r)===1}l(Tx,"isOnePointZero");function Ix(r){return typeof r=="string"&&r.indexOf("%")!=-1}l(Ix,"isPercentage");function He(r){return r.length==1?"0"+r:""+r}l(He,"pad2");function Ka(r){return r<=1&&(r=r*100+"%"),r}l(Ka,"convertToPercentage");function _b(r){return Math.round(parseFloat(r)*255).toString(16)}l(_b,"convertDecimalToHex");function Lb(r){return ye(r)/255}l(Lb,"convertHexToDecimal");var Ve=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 _r(r){return!!Ve.CSS_UNIT.exec(r)}l(_r,"isValidCSSUnit");function Ex(r){r=r.replace(ax,"").replace(sx,"").toLowerCase();var t=!1;if(Of[r])r=Of[r],t=!0;else if(r=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var e;return(e=Ve.rgb.exec(r))?{r:e[1],g:e[2],b:e[3]}:(e=Ve.rgba.exec(r))?{r:e[1],g:e[2],b:e[3],a:e[4]}:(e=Ve.hsl.exec(r))?{h:e[1],s:e[2],l:e[3]}:(e=Ve.hsla.exec(r))?{h:e[1],s:e[2],l:e[3],a:e[4]}:(e=Ve.hsv.exec(r))?{h:e[1],s:e[2],v:e[3]}:(e=Ve.hsva.exec(r))?{h:e[1],s:e[2],v:e[3],a:e[4]}:(e=Ve.hex8.exec(r))?{r:ye(e[1]),g:ye(e[2]),b:ye(e[3]),a:Lb(e[4]),format:t?"name":"hex8"}:(e=Ve.hex6.exec(r))?{r:ye(e[1]),g:ye(e[2]),b:ye(e[3]),format:t?"name":"hex"}:(e=Ve.hex4.exec(r))?{r:ye(e[1]+""+e[1]),g:ye(e[2]+""+e[2]),b:ye(e[3]+""+e[3]),a:Lb(e[4]+""+e[4]),format:t?"name":"hex8"}:(e=Ve.hex3.exec(r))?{r:ye(e[1]+""+e[1]),g:ye(e[2]+""+e[2]),b:ye(e[3]+""+e[3]),format:t?"name":"hex"}:!1}l(Ex,"stringInputToObject");function Lx(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(Lx,"validateWCAG2Parms");var Wf=Gr(l4());var bo={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}}},xP={lightOnDark:{...bo,text:{...bo.text,foregroundColor:"white",backgroundColor:"#333"},marker:{...bo.marker,foregroundColor:{active:"white",inactive:void 0},backgroundColor:{active:"#333",inactive:void 0}}},darkOnLight:{...bo,text:{...bo.text,foregroundColor:"#333",backgroundColor:"white"},marker:{...bo.marker,foregroundColor:{active:"#333",inactive:void 0},backgroundColor:{active:"white",inactive:void 0}}}},SP="LOW_PRIORITY",c4=4,PP=6,MP=20,wP=2.5,TP=2,IP="cover",u4=.5,EP=6.5,p4={heightAbovePolygon:0,appearance:xP.darkOnLight};var nn=class nn{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:tt(),this.options=(0,Wf.default)({},e,p4),this.text=t,this.dp=(c=1)=>c*i.pixelRatio,typeof e.rank=="string")this.rank=fo(e.rank),this.initialRank=this.rank;else if(e.rank!=null&&e.rank>0)this.rank=e.rank,this.initialRank=e.rank;else{let c=Math.trunc(b.env.NODE_ENV==="test"?nn.testId:nn.testId*10)/10;nn.testId+=.001,this.rank=c,this.initialRank=c}let n=(0,Wf.default)({},this.options.appearance,p4.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||F(n.marker.foregroundColor.active).setAlpha(.5).toRgbString()},backgroundColor:{active:n.marker.backgroundColor.active,inactive:n.marker.backgroundColor.inactive||F(n.marker.backgroundColor.active).setAlpha(.5).toRgbString()},icon:n.marker.icon,iconSize:n.marker.iconSize||MP,iconPadding:(a=n.marker.iconPadding)!=null?a:TP,iconFit:n.marker.iconFit||IP,iconVisibilityThreshold:n.marker.iconVisibilityThreshold==null?u4:n.marker.iconVisibilityThreshold}},this.calculateMarkerSize()}calculateMarkerSize(){let{iconVisibilityThreshold:t=u4}=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(EP)),this.totalMarkerSize=Math.ceil((this.markerSize+wP)/e)}get strategies(){let{width:t,height:e}=this.dimensions,{margin:i}=this.appearance;this.calculateMarkerSize();let n=Math.max(PP,i),o=this.iconVisible?n/2:0,a=[{name:"RIGHT",getBoundingBox:()=>{let c=Math.max(this.totalMarkerSize,e);return[c/2+n,c/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+c4,this.newStyle.textLabelVisible=!0}},{name:"LEFT",getBoundingBox:()=>{let c=Math.max(this.totalMarkerSize,e);return[c/2+n,c/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-c4,this.newStyle.textLabelVisible=!0}},{name:"TOP",getBoundingBox:()=>{let c=this.dp();return[e+this.totalMarkerSize/2/c+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:SP,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(nn,"LabelComponent"),v(nn,"testId",0);var Yf=nn,ur=Yf;d();d();function h4(r){return yl(r)}l(h4,"getBoundingBoxFromFeature");var Uf=class Uf extends wn{userData={entities:{}}};l(Uf,"EntityBatchedMesh");var Co=Uf,ns,os,on,zf=class zf{constructor(t){v(this,"mesh");v(this,"focusMesh");v(this,"outline");v(this,"type","geometry");v(this,"instanceIndex",-1);v(this,"geometry");v(this,"material");v(this,"feature");v(this,"focusable",!1);v(this,"color",new It);v(this,"topColor",new It);v(this,"position",new Y);P(this,ns,0);P(this,os,1);P(this,on,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 u(this,ns)}set altitude(t){this.mesh&&(this.mesh.position.z=t,E(this,ns,t))}get opacity(){return u(this,os)}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,os,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 u(this,on)?u(this,on):(E(this,on,h4(this.feature)),u(this,on))}showTextures(){this.material&&(this.material.showTextures(this.instanceIndex),this.texturesVisible=!0)}hideTextures(){this.material&&(this.material.hideTextures(this.instanceIndex),this.texturesVisible=!1)}};ns=new WeakMap,os=new WeakMap,on=new WeakMap,l(zf,"MeshComponent");var Rt=zf;var Zf=class Zf extends z{constructor(){super()}interpolators=new Map;addEntity3D(t,e){let[i,n,o,a]=e[1];this.interpolators.set(t,c=>me(c,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 Rt?e.setOpacity(i(t)):e instanceof ur?e.enabled=i(t):i(t)};destroy(){this.interpolators.clear()}};l(Zf,"ZoomInterpolationSystem");var au=Zf;d();var an=class an{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)||tt(),this.options=e,typeof e.rank=="string")this.rank=fo(e.rank);else if(e.rank!=null&&e.rank>0)this.rank=e.rank;else{let n=Math.trunc(b.env.NODE_ENV==="test"?an.testId:an.testId*10)/10;an.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(an,"MarkerComponent"),v(an,"testId",0);var Me=an;d();d();d();d();d();var qf=class qf{hover=!1;dirty=!1};l(qf,"InteractionComponent");var xo=qf;function ge(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 Pe&&r.components[1]===void 0?(r.components[1]=new xo,r.components[1].dirty=!0):r instanceof dt&&r.components[2]===void 0?(r.components[2]=new xo,r.components[2].dirty=!0):r instanceof Tt&&r.components[1]===void 0&&(r.components[1]=new xo,r.components[1].dirty=!0),!0):(r instanceof Pe?r.components[1]=void 0:r instanceof dt?r.components[2]=void 0:r instanceof Tt&&(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),ge(i,t,e);return!0}}return!1}l(ge,"updateInteractivity");function d4(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(d4,"updateGroupColor");function f4(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(f4,"updateGroupShading");function m4(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(m4,"updateColor");function Jf(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(Jf,"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 Tt?((e=r.parent)==null||e.removeEntity(r),t.addEntity(r),!0):!1}l(Kf,"updateParent");function y4(r,t){t!==void 0&&(r.type==="marker"||r.type==="label")&&(r.components[0].enabled=t)}l(y4,"updateEnabled");function g4(r,t){if(t!==void 0&&r.type==="path"){let e=r.components[0];t.completeFraction!==void 0&&(e.completeFraction=t.completeFraction)}}l(g4,"updatePath");function v4(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(v4,"updateMarker");function b4(r,t){return t!==void 0&&(r.type==="marker"||r.type==="label")?(r.components[0].rank=fo(t),!0):!1}l(b4,"updateRank");function C4(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&&(Pf(o.appearance,((n=t.options)==null?void 0:n.appearance)||{}),o.dirty=!0)}}l(C4,"updateLabel");function x4(r,t){t!==void 0&&r.type==="geometry"&&(r.components[1].hoverColor=t,r.components[1].dirty=!0)}l(x4,"updateHoverColor");function So(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 Vt&&(e.userData.outlineDirty=!0)}else(r.type==="group-container"||r.type==="geometry-group")&&r.setVisible(t);return!0}return!1}l(So,"updateVisibility");function S4(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(S4,"updateOpacity");function Qf(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(Qf,"updateAltitude");function tm(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 Vt&&(e.userData.outlineDirty=!0)}return!0}return!1}l(tm,"updateOutline");var sn,pr,su,lu,P4,ss,cu,uu,M4,pu,w4,ls,hu,cs,us,du,rm=class rm{constructor(t){P(this,lu);P(this,uu);P(this,pu);P(this,sn,null);P(this,pr,void 0);v(this,"getCurrentSceneGLTF",async t=>{let e={onlyVisible:!0,binary:!0,light:!0,scale:1,...t},i=await X(this,lu,P4).call(this),n=u(this,su).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 c=JSON.stringify(o,null,2);a=new Blob([c],{type:"text/plain"})}return a});P(this,su,l(t=>{let{scale:e,light:i,onlyVisible:n}=t,o=new al,a=new yr().setFromObject(u(this,pr).entityScene);if(u(this,ss).call(this,u(this,pr).entityScene,o,n),i){let c=new ll(16777215,.3*Math.PI);c.position.set(0,Math.max(a.max.x,a.max.y)*e*.5,a.max.y*e*4),c.lookAt(0,0,-1),c.target.position.set(0,0,-1),c.add(c.target),o.add(c)}return o},"#getExportedScene"));P(this,ss,l((t,e,i)=>{t.material&&(t instanceof wn?X(this,uu,M4).call(this,t).forEach(n=>e.add(n)):t instanceof Pi&&e.add(X(this,pu,w4).call(this,t))),t.children.forEach(n=>{(!i||n.visible)&&u(this,ss).call(this,n,e,i)})},"#processObject3D"));P(this,cu,l((t,e,i)=>{let n=new F1({color:new It(t),metalness:0});return n.opacity=e,n.transparent=i,n},"#createStandardMaterial"));P(this,ls,l(t=>{let{geometry:e,material:i,position:n,rotation:o,quaternion:a,scale:c}=t;if(!(e!=null&&e.isBufferGeometry))return t;let s=e.attributes.position,p=e.attributes.normal,f=e.attributes.uv;return u(this,hu).call(this,s,p),u(this,us).call(this,n,c,o,a),f&&u(this,du).call(this,f),i!=null&&i.map&&e.type==="PlaneGeometry"&&(t.side=Vo),t},"#convertGeometry"));P(this,hu,l((t,e)=>{let i=new Y,n=new Y;for(let o=0;o<t.count;o++)i.fromBufferAttribute(t,o),u(this,cs).call(this,i),t.setXYZ(o,i.x,i.y,i.z),e&&(n.fromBufferAttribute(e,o),u(this,cs).call(this,n),e.setXYZ(o,n.x,n.y,n.z))},"#convertAttributes"));P(this,cs,l(t=>{let e=t.y;t.y=t.z,t.z=-e},"#convertVector"));P(this,us,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 Pn)i.order="YXZ",i.set(i.x,i.y,i.z,i.order);else{let c=n.y;n.set(n.x,n.z,-c,n.w)}},"#convertObjectProperties"));P(this,du,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,pr,t),u(this,pr).entityScene=t.entityScene,u(this,pr).entity3DMap=t.entity3DMap}destroy(){E(this,sn,null)}};sn=new WeakMap,pr=new WeakMap,su=new WeakMap,lu=new WeakSet,P4=l(async function(){if(!u(this,sn)){let{GLTFExporter:t}=await import("./GLTFExporter-DJTLMZRS.js");E(this,sn,new t)}return u(this,sn)},"#getGLTFExporter"),ss=new WeakMap,cu=new WeakMap,uu=new WeakSet,M4=l(function(t){var a,c;let e=[],n=((a=t.userData)!=null&&a.entities?Object.values((c=t.userData)==null?void 0:c.entities):[]).map(s=>u(this,pr).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||u(this,pr).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=u(this,cu).call(this,f,Number(m),t.material.transparent),M=Je(x,!0),g=new Ft(M,S);g.position.copy(t.position),g.rotation.copy(t.rotation),g.scale.copy(t.scale),g.visible=!!y,u(this,us).call(this,g.position,g.scale,g.rotation,g.quaternion),e.push(u(this,ls).call(this,g))}),e},"#processBatchedMesh"),pu=new WeakSet,w4=l(function(t){let e=t.geometry.clone(),i=t.material,n=new Vr({color:i.color,side:Vo});n.opacity=i.opacity,n.transparent=i.transparent;let o=new Pi(e,n);return o.position.copy(t.position),o.rotation.copy(t.rotation),o.scale.copy(t.scale),o.visible=t.visible,u(this,ls).call(this,o)},"#processLineSegments"),ls=new WeakMap,hu=new WeakMap,cs=new WeakMap,us=new WeakMap,du=new WeakMap,l(rm,"ExporterSystem");var as=rm;d();var T4="#ffffff";var im=class im{initialColor=T4;color=T4;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(im,"StyleComponent");var hi=im;d();d();d();d();var fu={top:0,bottom:0,left:0,right:0};d();d();d();d();var nm=class nm extends A1{_width;_height;_propertiesLength;constructor(t){let e=t,i=3,n=i*4;super(new Float32Array(t*n),i,t,S1,x1),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(nm,"BatchedPropertiesTexture");var mu=nm;var I4=`#define LAMBERT
450
450
  varying vec3 vViewPosition;
451
451
  varying vec4 vPosition;
452
452
  varying vec2 vUv;
@@ -608,7 +608,7 @@ void main() {
608
608
  #include <premultiplied_alpha_fragment>
609
609
  #include <dithering_fragment>
610
610
  }
611
- `;var _P=-.05,OP=1,om=class om extends Tn{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 mu(e),this.onBeforeCompile=i=>{let n=this.uniforms.uGradientIntensity,o=this.uniforms.uGradientEnd,a=this.uniforms.uGradientStart,c=this.uniforms.uTopTexture,s=this.uniforms.uTexture;this.uniforms=i.uniforms,i.vertexShader=I4,i.fragmentShader=E4,Object.assign(this.uniforms,{uGradientIntensity:n,uGradientEnd:o,uGradientStart:a,uMinSideAlpha:{value:_P},uMaxSideAlpha:{value:OP},uPropertiesTexture:{value:this.propertiesTexture},uTopTexture:c,uTexture:s})}}get texture(){return this.uniforms.uTexture.value}set texture(t){t.wrapS=ze,t.wrapT=ze,t.colorSpace=Si,this.uniforms.uTexture.value=t}get topTexture(){return this.uniforms.uTopTexture.value}set topTexture(t){t.wrapS=ze,t.wrapT=ze,t.colorSpace=Si,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(om,"BatchedStandardMaterial");var yu=om;d();var kP=80;function L4(r,t){var c,s;let e=0;for(let p of r)e+=((s=(c=p.components[0])==null?void 0:c.geometry)==null?void 0:s.attributes.position.count)||0;let i=new It(t.color),n=new yu({color:i,side:Vo,opacity:t.opacity||1,transparent:t.opacity!==void 0?t.opacity<1:!1},r.length),o=new Co(r.length,e,0,n),a;for(let p of r)a=p.components[0],!(!(a instanceof Rt)||!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 It(t.topColor):i));return o.perObjectFrustumCulled=!0,o.matrixAutoUpdate=!1,o}l(L4,"batchGeometries");function D4(r,t){t.polygonOffset=!0,t.polygonOffsetFactor=1,t.polygonOffsetUnits=1;let e=new R1(r,kP),i=F(t.color.getHexString()).darken(30).toRgbString(),n=new k1({linewidth:2,color:i,transparent:!0}),o=new Pi(e,n);return o.layers.set(1),o}l(D4,"createOutlines");d();var NP="gray",RP=.1;function _4(r,t,e){let{color:i=NP,opacity:n=1,altitude:o=0,height:a=RP}=e||{};Array.isArray(n)&&(n=1);let c={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 Ze,p=r.geometry.coordinates[0].map(x=>{let S=t(x[1],x[0]);return c.min.x=Math.min(c.min.x,S.x),c.min.y=Math.min(c.min.y,S.y),c.max.x=Math.max(c.max.x,S.x),c.max.y=Math.max(c.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 Hr;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 qe(s,m);return y.translate(0,0,o||0),y.userData={style:{color:i,opacity:n}},y}l(_4,"renderPolygonGeometry");d();var BP="gray",FP=.1;function O4(r,t,e){let{color:i=BP,opacity:n=1,altitude:o=0,height:a=FP}=e||{};Array.isArray(n)&&(n=1);let c={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 Ze,x=m[0].map(g=>{let C=t(g[1],g[0]);return c.min.x=Math.min(c.min.x,C.x),c.min.y=Math.min(c.min.y,C.y),c.max.x=Math.max(c.max.x,C.x),c.max.y=Math.max(c.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 Hr;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 qe(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(O4,"renderMultiPolygonGeometry");d();d();var lm=Gr(X4());function j4(r){this.name="JSClipperError",this.message=r,this.stack=new Error().stack}l(j4,"JSClipperError");j4.prototype=Error.prototype;lm.default.Error=function(r){throw new j4(r)};var oe=lm.default;var _w="gray",cm=new oe.ClipperOffset,Qt=100;function W4(r,t,e){let{color:i=_w,opacity:n=1,width:o=1,join:a="round",cap:c="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])}cm.AddPaths(f.map(M=>M.map(g=>({X:g.x*Qt,Y:g.y*Qt}))),a==="round"?oe.JoinType.jsRound:a==="miter"?oe.JoinType.jsMiter:oe.JoinType.jsSquare,c==="round"?oe.EndType.etOpenRound:c==="butt"?oe.EndType.etOpenButt:oe.EndType.etOpenSquare);let m=new oe.PolyTree;cm.Execute(m,o/2*Qt);let y=[],x={bevelEnabled:!1,depth:s};for(let M of m.m_AllPolys){let g=new Ze;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 Hr,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 qe(g,x))}let S=Je(y);return S.translate(0,0,p||0),S.userData={style:{color:i,opacity:n}},cm.Clear(),S}l(W4,"renderLineStringGeometry");d();var te=100,Ow=.22,Aw=.01;function Y4(r,t,e={}){let{width:i=Ow,height:n=Aw,color:o="gray",opacity:a=1,altitude:c=0}=e,s={min:{x:1/0,y:1/0,z:c},max:{x:-1/0,y:-1/0,z:c+n}},p={bevelEnabled:!1,depth:n},f=new oe.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}))),oe.JoinType.jsMiter,oe.EndType.etOpenRound);let y=new oe.PolyTree;f.Execute(y,i/2*te);let x=[];for(let M of y.m_AllPolys){let g=new Ze;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 Hr,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 qe(g,p))}let S=Je(x);return S.translate(0,0,c||0),S.userData={style:{color:o,opacity:a}},f.Clear(),S}l(Y4,"renderMultiLineStringGeometry");d();var ds,fs,um=class um{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 It);v(this,"position",new Y);P(this,ds,0);P(this,fs,1);this.feature=t}setOpacity(){}setColor(){}get altitude(){return u(this,ds)}set altitude(t){this.mesh&&(this.mesh.position.z=t,E(this,ds,t))}get opacity(){return u(this,fs)}set opacity(t){var e,i;if(this.mesh){for(let n of this.mesh.children)if(n instanceof sl){((e=n.userData)==null?void 0:e.originalOpacity)===void 0&&(n.userData.originalOpacity=n.material.opacity);let o=me(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,fs,t)}};ds=new WeakMap,fs=new WeakMap,l(um,"ModelComponent");var mi=um;function kw(r){let{color:t,opacity:e,topColor:i,texture:n,topTexture:o}=r;return`${t}${e}${i||""}${n||""}${o||""}`}l(kw,"generateIndex");var Nw=1e4,pm=class pm extends z{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-WY3JJZTH.js");this.loader=new t}createEntityFromFeature(t,e,i){let n=new Rt(e),o=new dt(n,new hi(i));return o.id=t,o}createModelFromFeature(t,e,i){let n=new mi(e),o=new dt(n,new hi(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 gr,o=new Pn,a=new w1,c=new Y,s=new sr;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 sl(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:_,z:R}=this.convertTo3DMapPosition(w.geometry.coordinates[1],w.geometry.coordinates[0],0);T.position.set(L,_,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),c.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,c),s.children.forEach(G=>{let N=G;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 Rt&&(i=o.components[0].feature,n=o.components[1],i.geometry.type==="Polygon"?(e=_4(i,this.convertTo3DMapPosition,n),this.populateEntityMesh(o,e)):i.geometry.type==="MultiPolygon"?(e=O4(i,this.convertTo3DMapPosition,n),this.populateEntityMesh(o,e)):i.geometry.type==="LineString"?(e=W4(i,this.convertTo3DMapPosition,n),this.populateEntityMesh(o,e)):i.geometry.type==="MultiLineString"&&(e=Y4(i,this.convertTo3DMapPosition,n),this.populateEntityMesh(o,e)));return t}optimize(t){if(t.visible&&(t instanceof Vt||t instanceof Tt)){for(let n of t.children)this.optimize(n);if(t instanceof Tt||t.userData.dirty===!1)return;let e={};if(!t.userData.modelURL&&t.userData.dirty)try{this.populateEntityGroup(t.userData.entities3D)}catch(n){B.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 c=o.components[0],s=o.components[1];if(c instanceof Rt){n++,n>=Nw&&(n=0,i++);let p=kw(s)+i;e[p]===void 0&&(e[p]={style:s,entities:[]}),e[p].entities.push(o)}else c.mesh&&c.mesh.parent!==t&&t.add(c.mesh)}for(let a in e){let c=L4(e[a].entities,e[a].style);t.add(c),t.userData.outlineDirty=!0,t.userData.dirty=!1}}}}update(){this.optimize(this.state.entityScene)}};l(pm,"MeshCreationAndOptimizationSystem");var xu=pm;d();var hm=class hm{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 Me&&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(hm,"DOMVisibilitySystem");var Su=hm;d();var dm=class dm{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(dm,"TwoDProjectionSystem");var Pu=dm;d();d();var Rw=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")(),U4=l(({text:r,size:t,maxWidth:e,pixelRatio:i,maxLines:n=2,lineHeight:o=1.2,options:a={strokeText:!0}})=>{let c=`bold ${t*i}px 'InterUI-Regular', Helvetica Neue, Arial, sans-serif`,{measureCanvasContext:s}=Rw(i);s.font=c;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 Bw=4.5,Fw=2.5,Gw=2,Vw=5,ms=2.5;var fm=class fm{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,c,s,p,f,m;for(let y of this.state.entity2DIds)if(m=this.state.entity2DMap.get(y),m!=null&&m.components[0]instanceof ur&&!m.disposed){if(f=m.components[0],c=f.appearance.marker.foregroundColor,s=f.appearance.marker.backgroundColor,p=f.markerSize,a=`${c.active}-${c.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:c,maxWidth:s,maxHeight:p}=U4({text:t,size:e,pixelRatio:a,maxWidth:i,maxLines:n,lineHeight:o});return{textDrawFn:c,width:s+ms*a*2,height:p+ms*a*2}};textToCanvas=(t,e,i,n,o,a,c)=>{let s=this.state.pixelRatio,p,f=n,m=o;window.OffscreenCanvas!=null&&!Cf()?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=ms*s,y.fillStyle=a,y.strokeStyle=c;let x=i==="left"?0:i==="center"?f/2:f-ms*s/2;return t(y,x,(m+ms*s/2)/2),p};cacheImage=t=>{if(!t.appearance.marker.icon)return;let e=cb(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(c=>n.toLowerCase().endsWith(c)),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,c=t.totalMarkerSize*2*a;window.OffscreenCanvas!=null?o=new OffscreenCanvas(c,c):(o=document.createElement("canvas"),o.width=c,o.height=c,o.style.width=c/a+"px",o.style.height=c/a+"px");let s=o.getContext("2d");return s.shadowColor="rgba(0,0,0,0.3)",s.shadowOffsetY=Gw*a,s.shadowBlur=Vw*a,s.beginPath(),s.arc(c/2,c/2,e/2+Fw*a/2,0,2*Math.PI),s.fillStyle=i,s.fill(),s.beginPath(),s.arc(c/2,c/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:Bw*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,c=t.style.pinVisibility===1?this.pinCache[e][0]:this.pinCache[e][1];if(i.drawImage(c,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(fm,"TwoDDrawSystem");var Mu=fm;d();d();var yi=class yi{loader;constructor(){this.loader=new In}static getInstance(){return yi.instance||(yi.instance=new yi),yi.instance}getLoader(){return this.loader}};l(yi,"TextureLoaderSingleton"),v(yi,"instance");var mm=yi,wu=mm.getInstance();function Hw(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(Hw,"processColor");var ys,ym,gm=class gm extends z{constructor(e){super();P(this,ys);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,c,s;let e,i,n,o;for(let p of this.state.threeDEntities)if(o=this.state.entity3DMap.get(p),o instanceof Vt&&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||(c=o.components[2])!=null&&c.dirty)){e=o.components[0],i=o.components[1],n=o.components[2];let f=Hw(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&&X(this,ys,ym).call(this,i.texture,e,"texture"),i.topTexture!==e.topTexture&&X(this,ys,ym).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()}};ys=new WeakSet,ym=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}wu.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,()=>{B.error(`Failed to load texture: ${e}`)})}},"#loadTexture"),l(gm,"DrawSystem");var Tu=gm;d();var vm=class vm extends z{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 ur&&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=me(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(vm,"TwoDVisibilitySystem");var Iu=vm;d();var bm=class bm extends z{state;renderer;mode;scene;cameraObject;viewCamera;systems;constructor(t,e,i,n,o,a,c){super(),this.renderer=t,this.state=e,this.mode=i,this.scene=n,this.cameraObject=o,this.viewCamera=a,this.systems=c,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(),Sf(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=[],xf(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.geometryInFocusSystem.focusablesDirty=!0),this.systems.meshOptimizationSystem.update(),this.systems.customGeometrySystem.update(),this.systems.panBoundsSystem.update(),this.systems.geometryInFocusSystem.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.watermarkSystem.width,this.systems.watermarkSystem.height)}),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(bm,"RenderSystem");var Eu=bm;d();var wo,gs,Cm=class Cm{constructor(t,e){v(this,"type","path");v(this,"mesh",new sr);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,wo,1);v(this,"altitudeAdjustment",1);v(this,"displayArrowsOnPath",!1);v(this,"animateArrowsOnPath",!1);v(this,"dirty",!0);v(this,"position",new Y);P(this,gs,0);var i,n,o,a,c,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=(c=e==null?void 0:e.displayArrowsOnPath)!=null?c:this.displayArrowsOnPath,this.animateArrowsOnPath=(s=e==null?void 0:e.animateArrowsOnPath)!=null?s:this.animateArrowsOnPath}setColor(){}setOpacity(){}set completeFraction(t){E(this,wo,t),this.mesh&&this.mesh.children.forEach(e=>{e.material.uniforms.complete.value=u(this,wo),e.material.needsUpdate=!0})}get completeFraction(){return u(this,wo)}set visible(t){this.mesh&&(this.mesh.visible=t)}get visible(){return this.mesh?this.mesh.visible:!1}get altitude(){return u(this,gs)}set altitude(t){this.mesh&&(this.mesh.position.z=t,E(this,gs,t))}set complete(t){this.material&&(this.material.uniforms.complete.value=t,this.material.needsUpdate=!0)}};wo=new WeakMap,gs=new WeakMap,l(Cm,"PathComponent");var Lu=Cm;d();var xm=class xm{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 Tt&&t.components[0]){let i=t.components[0];if(i.dirty){for(let n of t.children)(n instanceof Vt||n instanceof Tt)&&(n.userData.entityId!==t.components[0].activeId?n.setVisible(!1):n.setVisible(!0));i.dirty=!1}}}};l(xm,"StackSystem");var Du=xm;d();d();var Cs=Gr(po());d();d();d();var z4=l((r,t)=>(t-r+Math.PI)%(Math.PI*2)+Math.PI*2%(Math.PI*2)-Math.PI,"differenceBetweenAngles"),Z4=l((r,t)=>new U(r.clientX-t.offsetLeft,r.clientY-t.offsetTop),"getTouchPos"),Sm=l((r,t)=>Math.atan2(t.y-r.y,t.x-r.x),"angle"),vs=l((r,t)=>Math.sqrt((t.y-r.y)**2+(t.x-r.x)**2),"distance"),Pm=l((r,t)=>new U((r.x+t.x)/2,(r.y+t.y)/2),"average"),Mm=l(r=>{let t=0,{wheelDelta:e,detail:i}=r;return e!==void 0?t=e:i!==void 0&&(t=-i),t},"getScrollDelta");var wm=class wm{input1;input2;lastAngle;lastDistance;totalDistance;first;second;constructor(t,e){this.input1=t,this.input2=e,this.lastAngle=Sm(t,e),this.lastDistance=vs(t,e),this.totalDistance=0,this.first=t,this.second=e}update(t,e){let i=vs(t,e);this.input1=t,this.input2=e;let n=Sm(t,e);this.lastAngle=n,this.lastDistance=i,this.totalDistance+=(vs(this.first,t)+vs(this.second,e))/2,this.first=Pm(this.first,t),this.second=Pm(this.second,e)}};l(wm,"InputSet");var _u=wm;d();var Tm=class Tm{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 $e,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(Tm,"TouchAnchor");var bs=Tm;var pn,Ou,Im=class Im extends z{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",0);v(this,"maxZoomAltitude",1/0);v(this,"ignoreZoomLimits",!1);v(this,"zoomFactor",1);v(this,"panBounds",{min:new Y(1/0,1/0),max:new Y(-1/0,-1/0),center:new Y(0,0,0),radius:1/0});v(this,"minTilt",0);v(this,"maxTilt",1.2);v(this,"MOUSE_BUTTONS",{ORBIT:ol.RIGHT,ZOOM:ol.MIDDLE,PAN:ol.LEFT});v(this,"camera");v(this,"scene");v(this,"renderer");v(this,"elevation");v(this,"orbit");v(this,"cameraPlane");v(this,"raycaster",new $e);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 Y,panCameraStart:new Y,panEnd:new Y,panDelta:new Y,initialShiftPos:new U,initialPedestal:0,floorAnchor:new Y});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 Y});v(this,"isUserInteracting",()=>this.userInteracting);v(this,"getPosition",()=>new Y(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",()=>Cs.default.getAll().some(e=>e._mMapAnimation));v(this,"isCameraMoving",()=>this.state!==-1);v(this,"setPosition",(e,i)=>{e===void 0||i===void 0||isNaN(e)||isNaN(i)||(this.state===-1&&this.publish("pan-start"),this.updateCameraPosition(e,i),this.publish("position-updated"),this.publish("change"),this.state===-1&&this.publish("pan-end"),this.dirty=!0)});v(this,"updateCameraPosition",(e,i)=>{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 c=Math.atan2(o,n),s={x:Math.cos(c)*this.panBounds.radius+this.panBounds.center.x,y:Math.sin(c)*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});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,c)=>{let s={mode:ff.cancel,...c},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 _=L<0?1:-1;f.rotation=w+2*Math.PI*_}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 Cs.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===ff.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(Cs.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 c=!1;e!=null&&(e.x!==void 0&&!isNaN(e.x)&&e.y!==void 0&&!isNaN(e.y)&&(this.updateCameraPosition(e.x,e.y),c=!0),e.z!==void 0&&!isNaN(e.z)&&(this.setPedestal(e.z,!0),c=!0)),c&&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>Hc&&(this.camera.near=i-Hc,this.camera.far=i+Hc):(this.camera.near=i/za,this.camera.far=i*za),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%mf;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/za,this.camera.far=i*za,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)%mf;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,"getProjectionScaleFactor",(e,i,n)=>Mf(e,i,n));v(this,"update",()=>{Cs.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 vf)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 Vr({color:0,visible:!1}),n=new Ft(e,i);return this.scene.add(n),n});v(this,"addEventListeners",()=>{let{domElement:e}=this.renderer;for(let i of vf)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 _u(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 c=i.y<o.y&&n.y<a.y,s=i.y>o.y&&n.y>a.y;this.enableRotate&&this.state!==4&&(s||c)?(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 bs(this.touch.touches[0],this.camera,this.cameraPlane),this.touch.anchor2=new bs(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-Mm(e)*i/nb*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 Pn;i.setFromRotationMatrix(e,"ZYX");let n=(e.elements[14]-this.cameraPlane.position.z)/Math.cos(i.x),o=i.z,a=new Y(0,0,1);a.applyEuler(i),a.setLength(n);let c=new Y;c.setFromMatrixPosition(e),c.sub(a),this.enablePan&&this.setPosition(c.x,c.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,c=e.reUnproject(),s=i.reUnproject();if(!c||!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-c.x,M=s.y-c.y,g=Math.atan2(M,S),C=z4(x,g),I=new gr;I.makeRotationZ(-C);let T=I.clone();T.multiply(e.snapHolderMatrix);let w=l((R5,B5,F5)=>R5.elements[(B5-1)*4+F5-1],"m"),L=w(n,1,1)*w(T,1,1)-p.x*w(n,3,4)*w(T,3,1),_=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),G=o.x*L+o.y*_+o.z*R,N=w(n,2,2)*w(T,2,1)-p.y*w(n,3,4)*w(T,3,1),j=w(n,2,2)*w(T,2,2)-p.y*w(n,3,4)*w(T,3,2),H=w(n,2,2)*w(T,2,3)-p.y*w(n,3,4)*w(T,3,3),J=o.x*N+o.y*j+o.z*H,ut=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),Ct=w(n,1,1)*w(T,1,3)-f.x*w(n,3,4)*w(T,3,3),Bt=a.x*ut+a.y*yt+a.z*Ct,De=w(n,2,2)*w(T,2,1)-f.y*w(n,3,4)*w(T,3,1),gt=w(n,2,2)*w(T,2,2)-f.y*w(n,3,4)*w(T,3,2),kt=w(n,2,2)*w(T,2,3)-f.y*w(n,3,4)*w(T,3,3),Pt=a.x*De+a.y*gt+a.z*kt,le=Math.abs(ut-L),Fr=Math.abs(yt-_),ce=Math.abs(Ct-R),ue=Math.abs(ut-N),bi=Math.abs(yt-j),xn=Math.abs(Ct-H),it=Math.abs(De-L),Mt=Math.abs(gt-_),xt=Math.abs(kt-R),be=Math.abs(De-N),Sn=Math.abs(gt-j),Ro=Math.abs(kt-H),Ci=Math.min(le+Fr+ce,ue+bi+xn),Zt=Math.min(it+Mt+xt,be+Sn+Ro);Ci<Zt&&(ut=De,yt=gt,Ct=kt,Bt=Pt);let xi=N*R-L*H,Bo=j*R-_*H,il=J*R-G*H,Fo=ut*H-N*Ct,Go=yt*H-j*Ct,g1=Bt*H-J*Ct,_5=(g1*Bo-il*Go)/(Fo*Bo-xi*Go),O5=(g1*xi-il*Fo)/(Go*xi-Bo*Fo),v1=j*L-_*N,A5=H*L-R*N,k5=J*L-G*N,b1=yt*N-j*ut,N5=Ct*N-H*ut,C1=((Bt*N-J*ut)*v1-k5*b1)/(N5*v1-A5*b1),nl=T.clone();return nl.elements[12]=_5,nl.elements[13]=O5,nl.elements[14]=C1,C1>0?nl: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=Z4(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=Mm(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=Mf(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",lr(()=>{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(ot.degToRad(this.camera.fov)/2)/this.options.canvasHeight,a=Math.cos(ot.degToRad(i))*2*Math.PI*ui/o;return ot.clamp(Math.log2(a/512),yf,gf)});v(this,"convertZoomLevelToAltitude",e=>{let[,i]=this.center,n=ot.clamp(e,yf,gf),o=Math.pow(2,n),a=ot.clamp(i,rb,ib),c=o*512;return Math.cos(ot.degToRad(a))*Math.PI*2*ui/c*this.options.canvasHeight/2/Math.tan(ot.degToRad(this.camera.fov)/2)});v(this,"completeTween",e=>{e.isPlaying?e.stop():e.end(),this.tweens.delete(e)});P(this,pn,{PIXELS:"pixels",PORTIONS:"portions"});P(this,Ou,["top","bottom","left","right"]);v(this,"getCameraFrameForPoints",(e,i,n,o,{canvasWidth:a,canvasHeight:c},s=this.minZoomAltitude,p=this.maxZoomAltitude)=>{Number.isFinite(n)&&(n=1),Number.isFinite(i)&&(i=1),s=Math.max(this.cameraPlane.position.z,s);let f={position:this.getPosition(),zoom:s};if(e==null||e.length===0)return f;o||(o={top:0,bottom:0,left:0,right:0,type:u(this,pn).PIXELS});for(let Zt of u(this,Ou))typeof o[Zt]!="number"&&(o[Zt]=0);if(o.type||(o.type=u(this,pn).PIXELS),o.type===u(this,pn).PORTIONS&&(o={top:o.top*c,bottom:o.bottom*c,left:o.left*a,right:o.right*a,type:u(this,pn).PIXELS}),o.left+o.right>=a||o.top+o.bottom>=c)return f;this.orbit.updateMatrixWorld();let m=this.camera.matrixWorldInverse,y=this.camera.fov*(Math.PI/180)/2,x=y*n,M=Math.atan(Math.tan(y)*(a/c))*i;if(e.length===1){let Zt=e[0].clone();Zt.applyMatrix4(m);let xi=s*Math.tan(M)*2,Bo=s*Math.tan(x)*2,il=(o.left-o.right)/2/a,Fo=(o.top-o.bottom)/2/c,Go=new Y(-il*xi,Fo*Bo,0);return Zt.add(Go),Zt.applyMatrix4(this.camera.matrixWorld),f.position.x=Zt.x,f.position.y=Zt.y,f.position.z=Zt.z,f.zoom=Math.max(f.zoom,f.position.z),f}let g=new Y(1/0,1/0,1/0),C=new Y(-1/0,-1/0,-1/0),I=new yr().setFromPoints(e),T;for(let Zt=0,xi=e.length;Zt<xi;Zt++)T=e[Zt].clone(),T.applyMatrix4(m),g.min(T),C.max(T);let w=C.x-g.x,L=C.y-g.y,_=a-o.left-o.right,R=c-o.top-o.bottom,G=(C.x+g.x)/2,N=(C.y+g.y)/2,j=w/_,H=L/R,J=s,ut=p,yt=J*Math.tan(M)*2,Ct=ut*Math.tan(M)*2,Bt=yt/a,De=Ct/a,gt=Math.max(j,H);gt=ot.clamp(gt,Bt,De);let kt=_*gt,Pt=R*gt,le={min:{x:G-kt/2-o.left*gt,y:N-Pt/2-o.bottom*gt},max:{x:G+kt/2+o.right*gt,y:N+Pt/2+o.top*gt}},Fr=(le.min.x+le.max.x)/2,ce=(le.min.y+le.max.y)/2,ue=I.getCenter(new Y),bi=Math.abs(Fr-le.min.x),xn=Math.abs(ce-le.min.y),it=bi/Math.tan(M),Mt=xn/Math.tan(x),xt=new Y;xt.set(Fr,ce,C.z+Math.max(it,Mt)),xt.applyMatrix4(this.camera.matrixWorld);let be=new Y;be.set(Fr,ce,C.z),be.applyMatrix4(this.camera.matrixWorld);let Sn=new Y().subVectors(be,xt),Ro=(ue.z-xt.z)/Sn.z,Ci=new Y().copy(xt).add(Sn.clone().multiplyScalar(Ro));return f.position=Ci,be.set(f.position.x,f.position.y,f.position.z),xt.sub(be),f.zoom=xt.length(),f});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,c,s;let e=this.getPosition(),{lat:i,lon:n}=Xc((a=(o=this.rendererState.center)==null?void 0:o[1])!=null?a:0,(s=(c=this.rendererState.center)==null?void 0:c[0])!=null?s:0,e.x,e.y);return[n,i]}setCenter(e,i){var a,c,s,p;let{x:n,y:o}=jc((c=(a=this.rendererState.center)==null?void 0:a[1])!=null?c: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={}){let o=n.curve,a=1,c=1,s=n.callback,p=n.cancelledCallback,f=n.minZoom!==void 0?n.minZoom:this.minZoomAltitude,m=n.maxZoom!==void 0?n.maxZoom:this.maxZoomAltitude,y=this.options.canvasWidth,x=this.options.canvasHeight,S;if(n.duration!==void 0?S=n.duration:b.env.TESTING==="true"?S=0:S=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},S,o,()=>{let M=n.padding||i,g=this.getCameraFrameForPoints(e,a,c,M,{canvasWidth:y,canvasHeight:x},f,m);this.animateCamera({position:g.position,tilt:this.getTilt(),rotation:this.getRotation(),zoom:g.zoom},S,o,s,p)});else{let M=n.padding||i,g=this.getCameraFrameForPoints(e,a,c,M,{canvasWidth:y,canvasHeight:x},f,m);this.animateCamera({position:g.position,tilt:this.getTilt(),rotation:this.getRotation(),zoom:g.zoom},S,o,s,p)}else{let M=n.padding||i,g=this.getCameraFrameForPoints(e,a,c,M,{canvasHeight:x,canvasWidth:y},f,m);this.animateCamera({position:g.position,tilt:n.tilt,rotation:n.rotation,zoom:g.zoom},S,o,s,p)}}resize(e,i){this.options.canvasWidth=e,this.options.canvasHeight=i}};pn=new WeakMap,Ou=new WeakMap,l(Im,"CameraSystem");var xs=Im;d();var Xw=300,Em=class Em{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 Me&&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:Xw,easing:"ease-in-out",fill:"forwards"}),i.visibilityNeedsUpdate=!1)))}};l(Em,"DOMDrawSystem");var Au=Em;d();var Lm=class Lm{percentExpanded=0;activeId="";gap=20;dirty=!0};l(Lm,"StackComponent");var ku=Lm;d();var Dm=class Dm extends z{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 Me&&i.firstElementChild){let{width:a,height:c}=i.firstElementChild.getBoundingClientRect();o.components[0].updateDimensions(a,c)}}}),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 Nu=Dm;d();var Ss=Gr(po());var jw=0,Ww=22,Yw=0,Uw=90;function hn(r,t,e,i){return(r<t||r>e)&&B.warn(i),Math.min(e,Math.max(t,r))}l(hn,"clampWithWarning");var $4={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,rt,dn,Ps,_m=class _m{constructor(t,e,i,n){P(this,V,void 0);P(this,rt,void 0);P(this,dn,void 0);P(this,Ps,void 0);E(this,V,t),E(this,rt,e),E(this,dn,i),E(this,Ps,n),u(this,rt).cameraSystem.on("pedestal-change",({pedestal:o})=>{u(this,V).map&&(u(this,V).map.transform.elevation=o,u(this,V).map.transform.minElevationForCurrentTile=o,u(this,V).map.triggerRepaint()),u(this,rt).cameraSystem.setCameraPlaneElevation(o),u(this,Ps).position.z=o})}get center(){return u(this,V).mode==="outdoors-overlay"&&u(this,V).map?u(this,V).map.getCenter().toArray():u(this,rt).cameraSystem.center}setCenter(t){var e;if(u(this,V).mode==="outdoors-overlay"&&u(this,V).map){(e=u(this,V).map)==null||e.setCenter(t),u(this,rt).interactionSystem.handleHover();return}u(this,rt).cameraSystem.setCenter(t[0],t[1]),u(this,rt).interactionSystem.handleHover()}get zoomLevel(){var t;return u(this,V).mode==="outdoors-overlay"&&u(this,V).map?(t=u(this,V).map)==null?void 0:t.getZoom():u(this,rt).cameraSystem.getZoomLevel()}setZoomLevel(t){var e;u(this,V).mode==="outdoors-overlay"&&u(this,V).map&&((e=u(this,V).map)==null||e.setZoom(t)),u(this,rt).cameraSystem.setZoomLevel(hn(t,this.minZoomLevel,this.maxZoomLevel,"zoomLevel was clamped to minZoomLevel/maxZoomLevel bounds. Use mapView.Camera.setMinZoomLevel() and mapView.Camera.setMaxZoomLevel() to adjust limits."))}get maxZoomLevel(){return u(this,rt).cameraSystem.maxZoomLevel}get minZoomLevel(){return u(this,rt).cameraSystem.minZoomLevel}setMinZoomLevel(t){var i;let e=Math.max(jw,t);u(this,rt).cameraSystem.setMinZoomLevel(e),this.zoomLevel<e&&this.setZoomLevel(e),(i=u(this,V).map)==null||i.setMinZoom(e)}setMaxZoomLevel(t){var i;let e=Math.min(Ww,t);u(this,rt).cameraSystem.setMaxZoomLevel(e),this.zoomLevel>e&&this.setZoomLevel(e),(i=u(this,V).map)==null||i.setMaxZoom(e)}get maxPitch(){var t;return u(this,V).mode==="outdoors-overlay"&&u(this,V).map?(t=u(this,V).map)==null?void 0:t.getMaxPitch():ot.radToDeg(u(this,rt).cameraSystem.maxTilt)}get minPitch(){var t;return u(this,V).mode==="outdoors-overlay"&&u(this,V).map?(t=u(this,V).map)==null?void 0:t.getMinPitch():ot.radToDeg(u(this,rt).cameraSystem.minTilt)}setMinPitch(t){var i;let e=Math.max(Yw,t);(i=u(this,V).map)==null||i.setMinPitch(e),u(this,rt).cameraSystem.minTilt=ot.degToRad(e)}setMaxPitch(t){var i;let e=Math.min(Uw,t);(i=u(this,V).map)==null||i.setMaxPitch(e),u(this,rt).cameraSystem.maxTilt=ot.degToRad(e)}get bearing(){var t;return u(this,V).mode==="outdoors-overlay"&&u(this,V).map?(t=u(this,V).map)==null?void 0:t.getBearing():ot.radToDeg(u(this,rt).cameraSystem.getRotation())}setBearing(t){var e;if(u(this,V).mode==="outdoors-overlay"&&u(this,V).map){(e=u(this,V).map)==null||e.setBearing(t);return}u(this,rt).cameraSystem.setRotation(ot.degToRad(t))}get pitch(){var t;return u(this,V).mode==="outdoors-overlay"&&u(this,V).map?(t=u(this,V).map)==null?void 0:t.getPitch():ot.radToDeg(u(this,rt).cameraSystem.getTilt())}setPitch(t){var e;if(u(this,V).mode==="outdoors-overlay"&&u(this,V).map){(e=u(this,V).map)==null||e.setPitch(t);return}u(this,rt).cameraSystem.setTilt(ot.degToRad(hn(t,this.minPitch,this.maxPitch,"pitch was clamped to minPitch/maxPitch bounds. Use mapView.Camera.setMinPitch() and mapView.Camera.setMaxPitch() to adjust limits.")))}get elevation(){return u(this,rt).cameraSystem.getPedestal()}setElevation(t){u(this,rt).cameraSystem.setPedestal(t,!0)}get insetsPadding(){return u(this,dn).insetsPadding}setInsetPadding(t){u(this,dn).center&&(u(this,dn).insetsPadding=t?{...t}:fu)}animateTo(t){var a;if(u(this,V).mode==="outdoors-overlay"&&u(this,V).map)return(a=u(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?u(this,V).convertTo3DMapPosition(t.center[1],t.center[0],0):void 0,i=t.zoomLevel!==void 0?u(this,rt).cameraSystem.convertZoomLevelToAltitude(hn(t.zoomLevel,this.minZoomLevel,this.maxZoomLevel,"zoomLevel was clamped to minZoomLevel/maxZoomLevel bounds. Use mapView.Camera.setMinZoomLevel() and mapView.Camera.setMaxZoomLevel() to adjust limits.")):void 0,n=t.bearing!==void 0?ot.degToRad(t.bearing):void 0,o=t.pitch!==void 0?ot.degToRad(hn(t.pitch,this.minPitch,this.maxPitch,"pitch was clamped to minPitch/maxPitch bounds. Use mapView.Camera.setMinPitch() and mapView.Camera.setMaxPitch() to adjust limits.")):void 0;return new Promise(c=>{u(this,rt).cameraSystem.animateCamera({position:e,zoom:i,rotation:n,tilt:o},t.duration||0,$4[t.easing||"ease-in-out"],()=>{u(this,rt).interactionSystem.handleHover(),c()},c)})}focusOn(t,e){var i,n;return u(this,V).mode==="outdoors-overlay"&&u(this,V).map?(t.length===1?(i=u(this,V).map)==null||i.flyTo({center:t[0],duration:(e==null?void 0:e.duration)||u(this,V).map.getBearing(),animate:!0,bearing:(e==null?void 0:e.bearing)||u(this,V).map.getBearing(),pitch:(e==null?void 0:e.pitch)||u(this,V).map.getPitch(),zoom:(e==null?void 0:e.maxZoomLevel)||u(this,V).map.getMaxZoom()}):(n=u(this,V).map)==null||n.fitBounds(t,{duration:e==null?void 0:e.duration,animate:!0,bearing:(e==null?void 0:e.bearing)||u(this,V).map.getBearing(),pitch:(e==null?void 0:e.pitch)||u(this,V).map.getPitch(),zoom:(e==null?void 0:e.maxZoomLevel)||u(this,V).map.getMaxZoom()}),u(this,rt).interactionSystem.handleHover(),Promise.resolve()):new Promise(o=>{u(this,rt).cameraSystem.focusOn(t.map(a=>u(this,V).convertTo3DMapPosition(a[1],a[0],a[2]||0)),{insetsPadding:(e==null?void 0:e.padding)||this.insetsPadding},{minZoom:(e==null?void 0:e.maxZoomLevel)===void 0?void 0:u(this,rt).cameraSystem.convertZoomLevelToAltitude(hn(e.maxZoomLevel,this.minZoomLevel,this.maxZoomLevel,"maxZoomLevel was clamped to minZoomLevel/maxZoomLevel bounds. Use mapView.Camera.setMaxZoomLevel() to adjust limits.")),maxZoom:(e==null?void 0:e.minZoomLevel)===void 0?void 0:u(this,rt).cameraSystem.convertZoomLevelToAltitude(hn(e.minZoomLevel,this.minZoomLevel,this.maxZoomLevel,"minZoomLevel was clamped to minZoomLevel/maxZoomLevel bounds. Use mapView.Camera.setMinZoomLevel() to adjust limits.")),padding:(e==null?void 0:e.padding)||{top:0,left:0,bottom:0,right:0},curve:$4[(e==null?void 0:e.easing)||"ease-in-out"],rotation:e!=null&&e.bearing?ot.degToRad(e.bearing):void 0,tilt:(e==null?void 0:e.pitch)!==void 0?ot.degToRad(hn(e.pitch,this.minPitch,this.maxPitch,"pitch was clamped to minPitch/maxPitch bounds. Use mapView.Camera.setMinPitch() and mapView.Camera.setMaxPitch() to adjust limits.")):void 0,duration:e==null?void 0:e.duration,callback:()=>{u(this,rt).interactionSystem.handleHover(),o()},cancelledCallback:o})})}};V=new WeakMap,rt=new WeakMap,dn=new WeakMap,Ps=new WeakMap,l(_m,"Camera");var Ru=_m;d();function J4(r){r&&(r.map&&(r.map.dispose(),r.map=void 0),r.dispose())}l(J4,"scrubMaterial");function Te(r){for(let t=r.children.length-1;t>=0;t--)Te(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){J4(t)}):"material"in r&&typeof r.material<"u"&&J4(r.material)}l(Te,"destroyObject3D");d();var K4=`uniform vec4 uSize;
611
+ `;var _P=-.05,OP=1,om=class om extends Tn{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 mu(e),this.onBeforeCompile=i=>{let n=this.uniforms.uGradientIntensity,o=this.uniforms.uGradientEnd,a=this.uniforms.uGradientStart,c=this.uniforms.uTopTexture,s=this.uniforms.uTexture;this.uniforms=i.uniforms,i.vertexShader=I4,i.fragmentShader=E4,Object.assign(this.uniforms,{uGradientIntensity:n,uGradientEnd:o,uGradientStart:a,uMinSideAlpha:{value:_P},uMaxSideAlpha:{value:OP},uPropertiesTexture:{value:this.propertiesTexture},uTopTexture:c,uTexture:s})}}get texture(){return this.uniforms.uTexture.value}set texture(t){t.wrapS=ze,t.wrapT=ze,t.colorSpace=Si,this.uniforms.uTexture.value=t}get topTexture(){return this.uniforms.uTopTexture.value}set topTexture(t){t.wrapS=ze,t.wrapT=ze,t.colorSpace=Si,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(om,"BatchedStandardMaterial");var yu=om;d();var kP=80;function L4(r,t){var c,s;let e=0;for(let p of r)e+=((s=(c=p.components[0])==null?void 0:c.geometry)==null?void 0:s.attributes.position.count)||0;let i=new It(t.color),n=new yu({color:i,side:Vo,opacity:t.opacity||1,transparent:t.opacity!==void 0?t.opacity<1:!1},r.length),o=new Co(r.length,e,0,n),a;for(let p of r)a=p.components[0],!(!(a instanceof Rt)||!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 It(t.topColor):i));return o.perObjectFrustumCulled=!0,o.matrixAutoUpdate=!1,o}l(L4,"batchGeometries");function D4(r,t){t.polygonOffset=!0,t.polygonOffsetFactor=1,t.polygonOffsetUnits=1;let e=new R1(r,kP),i=F(t.color.getHexString()).darken(30).toRgbString(),n=new k1({linewidth:2,color:i,transparent:!0}),o=new Pi(e,n);return o.layers.set(1),o}l(D4,"createOutlines");d();var NP="gray",RP=.1;function _4(r,t,e){let{color:i=NP,opacity:n=1,altitude:o=0,height:a=RP}=e||{};Array.isArray(n)&&(n=1);let c={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 Ze,p=r.geometry.coordinates[0].map(x=>{let S=t(x[1],x[0]);return c.min.x=Math.min(c.min.x,S.x),c.min.y=Math.min(c.min.y,S.y),c.max.x=Math.max(c.max.x,S.x),c.max.y=Math.max(c.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 Hr;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 qe(s,m);return y.translate(0,0,o||0),y.userData={style:{color:i,opacity:n}},y}l(_4,"renderPolygonGeometry");d();var BP="gray",FP=.1;function O4(r,t,e){let{color:i=BP,opacity:n=1,altitude:o=0,height:a=FP}=e||{};Array.isArray(n)&&(n=1);let c={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 Ze,x=m[0].map(g=>{let C=t(g[1],g[0]);return c.min.x=Math.min(c.min.x,C.x),c.min.y=Math.min(c.min.y,C.y),c.max.x=Math.max(c.max.x,C.x),c.max.y=Math.max(c.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 Hr;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 qe(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(O4,"renderMultiPolygonGeometry");d();d();var lm=Gr(X4());function j4(r){this.name="JSClipperError",this.message=r,this.stack=new Error().stack}l(j4,"JSClipperError");j4.prototype=Error.prototype;lm.default.Error=function(r){throw new j4(r)};var oe=lm.default;var _w="gray",cm=new oe.ClipperOffset,Qt=100;function W4(r,t,e){let{color:i=_w,opacity:n=1,width:o=1,join:a="round",cap:c="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])}cm.AddPaths(f.map(M=>M.map(g=>({X:g.x*Qt,Y:g.y*Qt}))),a==="round"?oe.JoinType.jsRound:a==="miter"?oe.JoinType.jsMiter:oe.JoinType.jsSquare,c==="round"?oe.EndType.etOpenRound:c==="butt"?oe.EndType.etOpenButt:oe.EndType.etOpenSquare);let m=new oe.PolyTree;cm.Execute(m,o/2*Qt);let y=[],x={bevelEnabled:!1,depth:s};for(let M of m.m_AllPolys){let g=new Ze;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 Hr,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 qe(g,x))}let S=Je(y);return S.translate(0,0,p||0),S.userData={style:{color:i,opacity:n}},cm.Clear(),S}l(W4,"renderLineStringGeometry");d();var te=100,Ow=.22,Aw=.01;function Y4(r,t,e={}){let{width:i=Ow,height:n=Aw,color:o="gray",opacity:a=1,altitude:c=0}=e,s={min:{x:1/0,y:1/0,z:c},max:{x:-1/0,y:-1/0,z:c+n}},p={bevelEnabled:!1,depth:n},f=new oe.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}))),oe.JoinType.jsMiter,oe.EndType.etOpenRound);let y=new oe.PolyTree;f.Execute(y,i/2*te);let x=[];for(let M of y.m_AllPolys){let g=new Ze;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 Hr,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 qe(g,p))}let S=Je(x);return S.translate(0,0,c||0),S.userData={style:{color:o,opacity:a}},f.Clear(),S}l(Y4,"renderMultiLineStringGeometry");d();var ds,fs,um=class um{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 It);v(this,"position",new Y);P(this,ds,0);P(this,fs,1);this.feature=t}setOpacity(){}setColor(){}get altitude(){return u(this,ds)}set altitude(t){this.mesh&&(this.mesh.position.z=t,E(this,ds,t))}get opacity(){return u(this,fs)}set opacity(t){var e,i;if(this.mesh){for(let n of this.mesh.children)if(n instanceof sl){((e=n.userData)==null?void 0:e.originalOpacity)===void 0&&(n.userData.originalOpacity=n.material.opacity);let o=me(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,fs,t)}};ds=new WeakMap,fs=new WeakMap,l(um,"ModelComponent");var mi=um;function kw(r){let{color:t,opacity:e,topColor:i,texture:n,topTexture:o}=r;return`${t}${e}${i||""}${n||""}${o||""}`}l(kw,"generateIndex");var Nw=1e4,pm=class pm extends z{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-EMLQBTUW.js");this.loader=new t}createEntityFromFeature(t,e,i){let n=new Rt(e),o=new dt(n,new hi(i));return o.id=t,o}createModelFromFeature(t,e,i){let n=new mi(e),o=new dt(n,new hi(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 gr,o=new Pn,a=new w1,c=new Y,s=new sr;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 sl(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:_,z:R}=this.convertTo3DMapPosition(w.geometry.coordinates[1],w.geometry.coordinates[0],0);T.position.set(L,_,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),c.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,c),s.children.forEach(G=>{let N=G;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 Rt&&(i=o.components[0].feature,n=o.components[1],i.geometry.type==="Polygon"?(e=_4(i,this.convertTo3DMapPosition,n),this.populateEntityMesh(o,e)):i.geometry.type==="MultiPolygon"?(e=O4(i,this.convertTo3DMapPosition,n),this.populateEntityMesh(o,e)):i.geometry.type==="LineString"?(e=W4(i,this.convertTo3DMapPosition,n),this.populateEntityMesh(o,e)):i.geometry.type==="MultiLineString"&&(e=Y4(i,this.convertTo3DMapPosition,n),this.populateEntityMesh(o,e)));return t}optimize(t){if(t.visible&&(t instanceof Vt||t instanceof Tt)){for(let n of t.children)this.optimize(n);if(t instanceof Tt||t.userData.dirty===!1)return;let e={};if(!t.userData.modelURL&&t.userData.dirty)try{this.populateEntityGroup(t.userData.entities3D)}catch(n){B.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 c=o.components[0],s=o.components[1];if(c instanceof Rt){n++,n>=Nw&&(n=0,i++);let p=kw(s)+i;e[p]===void 0&&(e[p]={style:s,entities:[]}),e[p].entities.push(o)}else c.mesh&&c.mesh.parent!==t&&t.add(c.mesh)}for(let a in e){let c=L4(e[a].entities,e[a].style);t.add(c),t.userData.outlineDirty=!0,t.userData.dirty=!1}}}}update(){this.optimize(this.state.entityScene)}};l(pm,"MeshCreationAndOptimizationSystem");var xu=pm;d();var hm=class hm{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 Me&&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(hm,"DOMVisibilitySystem");var Su=hm;d();var dm=class dm{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(dm,"TwoDProjectionSystem");var Pu=dm;d();d();var Rw=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")(),U4=l(({text:r,size:t,maxWidth:e,pixelRatio:i,maxLines:n=2,lineHeight:o=1.2,options:a={strokeText:!0}})=>{let c=`bold ${t*i}px 'InterUI-Regular', Helvetica Neue, Arial, sans-serif`,{measureCanvasContext:s}=Rw(i);s.font=c;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 Bw=4.5,Fw=2.5,Gw=2,Vw=5,ms=2.5;var fm=class fm{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,c,s,p,f,m;for(let y of this.state.entity2DIds)if(m=this.state.entity2DMap.get(y),m!=null&&m.components[0]instanceof ur&&!m.disposed){if(f=m.components[0],c=f.appearance.marker.foregroundColor,s=f.appearance.marker.backgroundColor,p=f.markerSize,a=`${c.active}-${c.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:c,maxWidth:s,maxHeight:p}=U4({text:t,size:e,pixelRatio:a,maxWidth:i,maxLines:n,lineHeight:o});return{textDrawFn:c,width:s+ms*a*2,height:p+ms*a*2}};textToCanvas=(t,e,i,n,o,a,c)=>{let s=this.state.pixelRatio,p,f=n,m=o;window.OffscreenCanvas!=null&&!Cf()?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=ms*s,y.fillStyle=a,y.strokeStyle=c;let x=i==="left"?0:i==="center"?f/2:f-ms*s/2;return t(y,x,(m+ms*s/2)/2),p};cacheImage=t=>{if(!t.appearance.marker.icon)return;let e=cb(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(c=>n.toLowerCase().endsWith(c)),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,c=t.totalMarkerSize*2*a;window.OffscreenCanvas!=null?o=new OffscreenCanvas(c,c):(o=document.createElement("canvas"),o.width=c,o.height=c,o.style.width=c/a+"px",o.style.height=c/a+"px");let s=o.getContext("2d");return s.shadowColor="rgba(0,0,0,0.3)",s.shadowOffsetY=Gw*a,s.shadowBlur=Vw*a,s.beginPath(),s.arc(c/2,c/2,e/2+Fw*a/2,0,2*Math.PI),s.fillStyle=i,s.fill(),s.beginPath(),s.arc(c/2,c/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:Bw*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,c=t.style.pinVisibility===1?this.pinCache[e][0]:this.pinCache[e][1];if(i.drawImage(c,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(fm,"TwoDDrawSystem");var Mu=fm;d();d();var yi=class yi{loader;constructor(){this.loader=new In}static getInstance(){return yi.instance||(yi.instance=new yi),yi.instance}getLoader(){return this.loader}};l(yi,"TextureLoaderSingleton"),v(yi,"instance");var mm=yi,wu=mm.getInstance();function Hw(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(Hw,"processColor");var ys,ym,gm=class gm extends z{constructor(e){super();P(this,ys);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,c,s;let e,i,n,o;for(let p of this.state.threeDEntities)if(o=this.state.entity3DMap.get(p),o instanceof Vt&&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||(c=o.components[2])!=null&&c.dirty)){e=o.components[0],i=o.components[1],n=o.components[2];let f=Hw(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&&X(this,ys,ym).call(this,i.texture,e,"texture"),i.topTexture!==e.topTexture&&X(this,ys,ym).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()}};ys=new WeakSet,ym=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}wu.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,()=>{B.error(`Failed to load texture: ${e}`)})}},"#loadTexture"),l(gm,"DrawSystem");var Tu=gm;d();var vm=class vm extends z{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 ur&&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=me(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(vm,"TwoDVisibilitySystem");var Iu=vm;d();var bm=class bm extends z{state;renderer;mode;scene;cameraObject;viewCamera;systems;constructor(t,e,i,n,o,a,c){super(),this.renderer=t,this.state=e,this.mode=i,this.scene=n,this.cameraObject=o,this.viewCamera=a,this.systems=c,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(),Sf(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=[],xf(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.geometryInFocusSystem.focusablesDirty=!0),this.systems.meshOptimizationSystem.update(),this.systems.customGeometrySystem.update(),this.systems.panBoundsSystem.update(),this.systems.geometryInFocusSystem.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.watermarkSystem.width,this.systems.watermarkSystem.height)}),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(bm,"RenderSystem");var Eu=bm;d();var wo,gs,Cm=class Cm{constructor(t,e){v(this,"type","path");v(this,"mesh",new sr);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,wo,1);v(this,"altitudeAdjustment",1);v(this,"displayArrowsOnPath",!1);v(this,"animateArrowsOnPath",!1);v(this,"dirty",!0);v(this,"position",new Y);P(this,gs,0);var i,n,o,a,c,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=(c=e==null?void 0:e.displayArrowsOnPath)!=null?c:this.displayArrowsOnPath,this.animateArrowsOnPath=(s=e==null?void 0:e.animateArrowsOnPath)!=null?s:this.animateArrowsOnPath}setColor(){}setOpacity(){}set completeFraction(t){E(this,wo,t),this.mesh&&this.mesh.children.forEach(e=>{e.material.uniforms.complete.value=u(this,wo),e.material.needsUpdate=!0})}get completeFraction(){return u(this,wo)}set visible(t){this.mesh&&(this.mesh.visible=t)}get visible(){return this.mesh?this.mesh.visible:!1}get altitude(){return u(this,gs)}set altitude(t){this.mesh&&(this.mesh.position.z=t,E(this,gs,t))}set complete(t){this.material&&(this.material.uniforms.complete.value=t,this.material.needsUpdate=!0)}};wo=new WeakMap,gs=new WeakMap,l(Cm,"PathComponent");var Lu=Cm;d();var xm=class xm{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 Tt&&t.components[0]){let i=t.components[0];if(i.dirty){for(let n of t.children)(n instanceof Vt||n instanceof Tt)&&(n.userData.entityId!==t.components[0].activeId?n.setVisible(!1):n.setVisible(!0));i.dirty=!1}}}};l(xm,"StackSystem");var Du=xm;d();d();var Cs=Gr(po());d();d();d();var z4=l((r,t)=>(t-r+Math.PI)%(Math.PI*2)+Math.PI*2%(Math.PI*2)-Math.PI,"differenceBetweenAngles"),Z4=l((r,t)=>new U(r.clientX-t.offsetLeft,r.clientY-t.offsetTop),"getTouchPos"),Sm=l((r,t)=>Math.atan2(t.y-r.y,t.x-r.x),"angle"),vs=l((r,t)=>Math.sqrt((t.y-r.y)**2+(t.x-r.x)**2),"distance"),Pm=l((r,t)=>new U((r.x+t.x)/2,(r.y+t.y)/2),"average"),Mm=l(r=>{let t=0,{wheelDelta:e,detail:i}=r;return e!==void 0?t=e:i!==void 0&&(t=-i),t},"getScrollDelta");var wm=class wm{input1;input2;lastAngle;lastDistance;totalDistance;first;second;constructor(t,e){this.input1=t,this.input2=e,this.lastAngle=Sm(t,e),this.lastDistance=vs(t,e),this.totalDistance=0,this.first=t,this.second=e}update(t,e){let i=vs(t,e);this.input1=t,this.input2=e;let n=Sm(t,e);this.lastAngle=n,this.lastDistance=i,this.totalDistance+=(vs(this.first,t)+vs(this.second,e))/2,this.first=Pm(this.first,t),this.second=Pm(this.second,e)}};l(wm,"InputSet");var _u=wm;d();var Tm=class Tm{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 $e,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(Tm,"TouchAnchor");var bs=Tm;var pn,Ou,Im=class Im extends z{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",0);v(this,"maxZoomAltitude",1/0);v(this,"ignoreZoomLimits",!1);v(this,"zoomFactor",1);v(this,"panBounds",{min:new Y(1/0,1/0),max:new Y(-1/0,-1/0),center:new Y(0,0,0),radius:1/0});v(this,"minTilt",0);v(this,"maxTilt",1.2);v(this,"MOUSE_BUTTONS",{ORBIT:ol.RIGHT,ZOOM:ol.MIDDLE,PAN:ol.LEFT});v(this,"camera");v(this,"scene");v(this,"renderer");v(this,"elevation");v(this,"orbit");v(this,"cameraPlane");v(this,"raycaster",new $e);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 Y,panCameraStart:new Y,panEnd:new Y,panDelta:new Y,initialShiftPos:new U,initialPedestal:0,floorAnchor:new Y});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 Y});v(this,"isUserInteracting",()=>this.userInteracting);v(this,"getPosition",()=>new Y(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",()=>Cs.default.getAll().some(e=>e._mMapAnimation));v(this,"isCameraMoving",()=>this.state!==-1);v(this,"setPosition",(e,i)=>{e===void 0||i===void 0||isNaN(e)||isNaN(i)||(this.state===-1&&this.publish("pan-start"),this.updateCameraPosition(e,i),this.publish("position-updated"),this.publish("change"),this.state===-1&&this.publish("pan-end"),this.dirty=!0)});v(this,"updateCameraPosition",(e,i)=>{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 c=Math.atan2(o,n),s={x:Math.cos(c)*this.panBounds.radius+this.panBounds.center.x,y:Math.sin(c)*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});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,c)=>{let s={mode:ff.cancel,...c},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 _=L<0?1:-1;f.rotation=w+2*Math.PI*_}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 Cs.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===ff.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(Cs.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 c=!1;e!=null&&(e.x!==void 0&&!isNaN(e.x)&&e.y!==void 0&&!isNaN(e.y)&&(this.updateCameraPosition(e.x,e.y),c=!0),e.z!==void 0&&!isNaN(e.z)&&(this.setPedestal(e.z,!0),c=!0)),c&&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>Hc&&(this.camera.near=i-Hc,this.camera.far=i+Hc):(this.camera.near=i/za,this.camera.far=i*za),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%mf;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/za,this.camera.far=i*za,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)%mf;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,"getProjectionScaleFactor",(e,i,n)=>Mf(e,i,n));v(this,"update",()=>{Cs.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 vf)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 Vr({color:0,visible:!1}),n=new Ft(e,i);return this.scene.add(n),n});v(this,"addEventListeners",()=>{let{domElement:e}=this.renderer;for(let i of vf)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 _u(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 c=i.y<o.y&&n.y<a.y,s=i.y>o.y&&n.y>a.y;this.enableRotate&&this.state!==4&&(s||c)?(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 bs(this.touch.touches[0],this.camera,this.cameraPlane),this.touch.anchor2=new bs(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-Mm(e)*i/nb*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 Pn;i.setFromRotationMatrix(e,"ZYX");let n=(e.elements[14]-this.cameraPlane.position.z)/Math.cos(i.x),o=i.z,a=new Y(0,0,1);a.applyEuler(i),a.setLength(n);let c=new Y;c.setFromMatrixPosition(e),c.sub(a),this.enablePan&&this.setPosition(c.x,c.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,c=e.reUnproject(),s=i.reUnproject();if(!c||!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-c.x,M=s.y-c.y,g=Math.atan2(M,S),C=z4(x,g),I=new gr;I.makeRotationZ(-C);let T=I.clone();T.multiply(e.snapHolderMatrix);let w=l((R5,B5,F5)=>R5.elements[(B5-1)*4+F5-1],"m"),L=w(n,1,1)*w(T,1,1)-p.x*w(n,3,4)*w(T,3,1),_=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),G=o.x*L+o.y*_+o.z*R,N=w(n,2,2)*w(T,2,1)-p.y*w(n,3,4)*w(T,3,1),j=w(n,2,2)*w(T,2,2)-p.y*w(n,3,4)*w(T,3,2),H=w(n,2,2)*w(T,2,3)-p.y*w(n,3,4)*w(T,3,3),J=o.x*N+o.y*j+o.z*H,ut=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),Ct=w(n,1,1)*w(T,1,3)-f.x*w(n,3,4)*w(T,3,3),Bt=a.x*ut+a.y*yt+a.z*Ct,De=w(n,2,2)*w(T,2,1)-f.y*w(n,3,4)*w(T,3,1),gt=w(n,2,2)*w(T,2,2)-f.y*w(n,3,4)*w(T,3,2),kt=w(n,2,2)*w(T,2,3)-f.y*w(n,3,4)*w(T,3,3),Pt=a.x*De+a.y*gt+a.z*kt,le=Math.abs(ut-L),Fr=Math.abs(yt-_),ce=Math.abs(Ct-R),ue=Math.abs(ut-N),bi=Math.abs(yt-j),xn=Math.abs(Ct-H),it=Math.abs(De-L),Mt=Math.abs(gt-_),xt=Math.abs(kt-R),be=Math.abs(De-N),Sn=Math.abs(gt-j),Ro=Math.abs(kt-H),Ci=Math.min(le+Fr+ce,ue+bi+xn),Zt=Math.min(it+Mt+xt,be+Sn+Ro);Ci<Zt&&(ut=De,yt=gt,Ct=kt,Bt=Pt);let xi=N*R-L*H,Bo=j*R-_*H,il=J*R-G*H,Fo=ut*H-N*Ct,Go=yt*H-j*Ct,g1=Bt*H-J*Ct,_5=(g1*Bo-il*Go)/(Fo*Bo-xi*Go),O5=(g1*xi-il*Fo)/(Go*xi-Bo*Fo),v1=j*L-_*N,A5=H*L-R*N,k5=J*L-G*N,b1=yt*N-j*ut,N5=Ct*N-H*ut,C1=((Bt*N-J*ut)*v1-k5*b1)/(N5*v1-A5*b1),nl=T.clone();return nl.elements[12]=_5,nl.elements[13]=O5,nl.elements[14]=C1,C1>0?nl: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=Z4(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=Mm(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=Mf(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",lr(()=>{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(ot.degToRad(this.camera.fov)/2)/this.options.canvasHeight,a=Math.cos(ot.degToRad(i))*2*Math.PI*ui/o;return ot.clamp(Math.log2(a/512),yf,gf)});v(this,"convertZoomLevelToAltitude",e=>{let[,i]=this.center,n=ot.clamp(e,yf,gf),o=Math.pow(2,n),a=ot.clamp(i,rb,ib),c=o*512;return Math.cos(ot.degToRad(a))*Math.PI*2*ui/c*this.options.canvasHeight/2/Math.tan(ot.degToRad(this.camera.fov)/2)});v(this,"completeTween",e=>{e.isPlaying?e.stop():e.end(),this.tweens.delete(e)});P(this,pn,{PIXELS:"pixels",PORTIONS:"portions"});P(this,Ou,["top","bottom","left","right"]);v(this,"getCameraFrameForPoints",(e,i,n,o,{canvasWidth:a,canvasHeight:c},s=this.minZoomAltitude,p=this.maxZoomAltitude)=>{Number.isFinite(n)&&(n=1),Number.isFinite(i)&&(i=1),s=Math.max(this.cameraPlane.position.z,s);let f={position:this.getPosition(),zoom:s};if(e==null||e.length===0)return f;o||(o={top:0,bottom:0,left:0,right:0,type:u(this,pn).PIXELS});for(let Zt of u(this,Ou))typeof o[Zt]!="number"&&(o[Zt]=0);if(o.type||(o.type=u(this,pn).PIXELS),o.type===u(this,pn).PORTIONS&&(o={top:o.top*c,bottom:o.bottom*c,left:o.left*a,right:o.right*a,type:u(this,pn).PIXELS}),o.left+o.right>=a||o.top+o.bottom>=c)return f;this.orbit.updateMatrixWorld();let m=this.camera.matrixWorldInverse,y=this.camera.fov*(Math.PI/180)/2,x=y*n,M=Math.atan(Math.tan(y)*(a/c))*i;if(e.length===1){let Zt=e[0].clone();Zt.applyMatrix4(m);let xi=s*Math.tan(M)*2,Bo=s*Math.tan(x)*2,il=(o.left-o.right)/2/a,Fo=(o.top-o.bottom)/2/c,Go=new Y(-il*xi,Fo*Bo,0);return Zt.add(Go),Zt.applyMatrix4(this.camera.matrixWorld),f.position.x=Zt.x,f.position.y=Zt.y,f.position.z=Zt.z,f.zoom=Math.max(f.zoom,f.position.z),f}let g=new Y(1/0,1/0,1/0),C=new Y(-1/0,-1/0,-1/0),I=new yr().setFromPoints(e),T;for(let Zt=0,xi=e.length;Zt<xi;Zt++)T=e[Zt].clone(),T.applyMatrix4(m),g.min(T),C.max(T);let w=C.x-g.x,L=C.y-g.y,_=a-o.left-o.right,R=c-o.top-o.bottom,G=(C.x+g.x)/2,N=(C.y+g.y)/2,j=w/_,H=L/R,J=s,ut=p,yt=J*Math.tan(M)*2,Ct=ut*Math.tan(M)*2,Bt=yt/a,De=Ct/a,gt=Math.max(j,H);gt=ot.clamp(gt,Bt,De);let kt=_*gt,Pt=R*gt,le={min:{x:G-kt/2-o.left*gt,y:N-Pt/2-o.bottom*gt},max:{x:G+kt/2+o.right*gt,y:N+Pt/2+o.top*gt}},Fr=(le.min.x+le.max.x)/2,ce=(le.min.y+le.max.y)/2,ue=I.getCenter(new Y),bi=Math.abs(Fr-le.min.x),xn=Math.abs(ce-le.min.y),it=bi/Math.tan(M),Mt=xn/Math.tan(x),xt=new Y;xt.set(Fr,ce,C.z+Math.max(it,Mt)),xt.applyMatrix4(this.camera.matrixWorld);let be=new Y;be.set(Fr,ce,C.z),be.applyMatrix4(this.camera.matrixWorld);let Sn=new Y().subVectors(be,xt),Ro=(ue.z-xt.z)/Sn.z,Ci=new Y().copy(xt).add(Sn.clone().multiplyScalar(Ro));return f.position=Ci,be.set(f.position.x,f.position.y,f.position.z),xt.sub(be),f.zoom=xt.length(),f});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,c,s;let e=this.getPosition(),{lat:i,lon:n}=Xc((a=(o=this.rendererState.center)==null?void 0:o[1])!=null?a:0,(s=(c=this.rendererState.center)==null?void 0:c[0])!=null?s:0,e.x,e.y);return[n,i]}setCenter(e,i){var a,c,s,p;let{x:n,y:o}=jc((c=(a=this.rendererState.center)==null?void 0:a[1])!=null?c: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={}){let o=n.curve,a=1,c=1,s=n.callback,p=n.cancelledCallback,f=n.minZoom!==void 0?n.minZoom:this.minZoomAltitude,m=n.maxZoom!==void 0?n.maxZoom:this.maxZoomAltitude,y=this.options.canvasWidth,x=this.options.canvasHeight,S;if(n.duration!==void 0?S=n.duration:b.env.TESTING==="true"?S=0:S=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},S,o,()=>{let M=n.padding||i,g=this.getCameraFrameForPoints(e,a,c,M,{canvasWidth:y,canvasHeight:x},f,m);this.animateCamera({position:g.position,tilt:this.getTilt(),rotation:this.getRotation(),zoom:g.zoom},S,o,s,p)});else{let M=n.padding||i,g=this.getCameraFrameForPoints(e,a,c,M,{canvasWidth:y,canvasHeight:x},f,m);this.animateCamera({position:g.position,tilt:this.getTilt(),rotation:this.getRotation(),zoom:g.zoom},S,o,s,p)}else{let M=n.padding||i,g=this.getCameraFrameForPoints(e,a,c,M,{canvasHeight:x,canvasWidth:y},f,m);this.animateCamera({position:g.position,tilt:n.tilt,rotation:n.rotation,zoom:g.zoom},S,o,s,p)}}resize(e,i){this.options.canvasWidth=e,this.options.canvasHeight=i}};pn=new WeakMap,Ou=new WeakMap,l(Im,"CameraSystem");var xs=Im;d();var Xw=300,Em=class Em{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 Me&&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:Xw,easing:"ease-in-out",fill:"forwards"}),i.visibilityNeedsUpdate=!1)))}};l(Em,"DOMDrawSystem");var Au=Em;d();var Lm=class Lm{percentExpanded=0;activeId="";gap=20;dirty=!0};l(Lm,"StackComponent");var ku=Lm;d();var Dm=class Dm extends z{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 Me&&i.firstElementChild){let{width:a,height:c}=i.firstElementChild.getBoundingClientRect();o.components[0].updateDimensions(a,c)}}}),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 Nu=Dm;d();var Ss=Gr(po());var jw=0,Ww=22,Yw=0,Uw=90;function hn(r,t,e,i){return(r<t||r>e)&&B.warn(i),Math.min(e,Math.max(t,r))}l(hn,"clampWithWarning");var $4={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,rt,dn,Ps,_m=class _m{constructor(t,e,i,n){P(this,V,void 0);P(this,rt,void 0);P(this,dn,void 0);P(this,Ps,void 0);E(this,V,t),E(this,rt,e),E(this,dn,i),E(this,Ps,n),u(this,rt).cameraSystem.on("pedestal-change",({pedestal:o})=>{u(this,V).map&&(u(this,V).map.transform.elevation=o,u(this,V).map.transform.minElevationForCurrentTile=o,u(this,V).map.triggerRepaint()),u(this,rt).cameraSystem.setCameraPlaneElevation(o),u(this,Ps).position.z=o})}get center(){return u(this,V).mode==="outdoors-overlay"&&u(this,V).map?u(this,V).map.getCenter().toArray():u(this,rt).cameraSystem.center}setCenter(t){var e;if(u(this,V).mode==="outdoors-overlay"&&u(this,V).map){(e=u(this,V).map)==null||e.setCenter(t),u(this,rt).interactionSystem.handleHover();return}u(this,rt).cameraSystem.setCenter(t[0],t[1]),u(this,rt).interactionSystem.handleHover()}get zoomLevel(){var t;return u(this,V).mode==="outdoors-overlay"&&u(this,V).map?(t=u(this,V).map)==null?void 0:t.getZoom():u(this,rt).cameraSystem.getZoomLevel()}setZoomLevel(t){var e;u(this,V).mode==="outdoors-overlay"&&u(this,V).map&&((e=u(this,V).map)==null||e.setZoom(t)),u(this,rt).cameraSystem.setZoomLevel(hn(t,this.minZoomLevel,this.maxZoomLevel,"zoomLevel was clamped to minZoomLevel/maxZoomLevel bounds. Use mapView.Camera.setMinZoomLevel() and mapView.Camera.setMaxZoomLevel() to adjust limits."))}get maxZoomLevel(){return u(this,rt).cameraSystem.maxZoomLevel}get minZoomLevel(){return u(this,rt).cameraSystem.minZoomLevel}setMinZoomLevel(t){var i;let e=Math.max(jw,t);u(this,rt).cameraSystem.setMinZoomLevel(e),this.zoomLevel<e&&this.setZoomLevel(e),(i=u(this,V).map)==null||i.setMinZoom(e)}setMaxZoomLevel(t){var i;let e=Math.min(Ww,t);u(this,rt).cameraSystem.setMaxZoomLevel(e),this.zoomLevel>e&&this.setZoomLevel(e),(i=u(this,V).map)==null||i.setMaxZoom(e)}get maxPitch(){var t;return u(this,V).mode==="outdoors-overlay"&&u(this,V).map?(t=u(this,V).map)==null?void 0:t.getMaxPitch():ot.radToDeg(u(this,rt).cameraSystem.maxTilt)}get minPitch(){var t;return u(this,V).mode==="outdoors-overlay"&&u(this,V).map?(t=u(this,V).map)==null?void 0:t.getMinPitch():ot.radToDeg(u(this,rt).cameraSystem.minTilt)}setMinPitch(t){var i;let e=Math.max(Yw,t);(i=u(this,V).map)==null||i.setMinPitch(e),u(this,rt).cameraSystem.minTilt=ot.degToRad(e)}setMaxPitch(t){var i;let e=Math.min(Uw,t);(i=u(this,V).map)==null||i.setMaxPitch(e),u(this,rt).cameraSystem.maxTilt=ot.degToRad(e)}get bearing(){var t;return u(this,V).mode==="outdoors-overlay"&&u(this,V).map?(t=u(this,V).map)==null?void 0:t.getBearing():ot.radToDeg(u(this,rt).cameraSystem.getRotation())}setBearing(t){var e;if(u(this,V).mode==="outdoors-overlay"&&u(this,V).map){(e=u(this,V).map)==null||e.setBearing(t);return}u(this,rt).cameraSystem.setRotation(ot.degToRad(t))}get pitch(){var t;return u(this,V).mode==="outdoors-overlay"&&u(this,V).map?(t=u(this,V).map)==null?void 0:t.getPitch():ot.radToDeg(u(this,rt).cameraSystem.getTilt())}setPitch(t){var e;if(u(this,V).mode==="outdoors-overlay"&&u(this,V).map){(e=u(this,V).map)==null||e.setPitch(t);return}u(this,rt).cameraSystem.setTilt(ot.degToRad(hn(t,this.minPitch,this.maxPitch,"pitch was clamped to minPitch/maxPitch bounds. Use mapView.Camera.setMinPitch() and mapView.Camera.setMaxPitch() to adjust limits.")))}get elevation(){return u(this,rt).cameraSystem.getPedestal()}setElevation(t){u(this,rt).cameraSystem.setPedestal(t,!0)}get insetsPadding(){return u(this,dn).insetsPadding}setInsetPadding(t){u(this,dn).center&&(u(this,dn).insetsPadding=t?{...t}:fu)}animateTo(t){var a;if(u(this,V).mode==="outdoors-overlay"&&u(this,V).map)return(a=u(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?u(this,V).convertTo3DMapPosition(t.center[1],t.center[0],0):void 0,i=t.zoomLevel!==void 0?u(this,rt).cameraSystem.convertZoomLevelToAltitude(hn(t.zoomLevel,this.minZoomLevel,this.maxZoomLevel,"zoomLevel was clamped to minZoomLevel/maxZoomLevel bounds. Use mapView.Camera.setMinZoomLevel() and mapView.Camera.setMaxZoomLevel() to adjust limits.")):void 0,n=t.bearing!==void 0?ot.degToRad(t.bearing):void 0,o=t.pitch!==void 0?ot.degToRad(hn(t.pitch,this.minPitch,this.maxPitch,"pitch was clamped to minPitch/maxPitch bounds. Use mapView.Camera.setMinPitch() and mapView.Camera.setMaxPitch() to adjust limits.")):void 0;return new Promise(c=>{u(this,rt).cameraSystem.animateCamera({position:e,zoom:i,rotation:n,tilt:o},t.duration||0,$4[t.easing||"ease-in-out"],()=>{u(this,rt).interactionSystem.handleHover(),c()},c)})}focusOn(t,e){var i,n;return u(this,V).mode==="outdoors-overlay"&&u(this,V).map?(t.length===1?(i=u(this,V).map)==null||i.flyTo({center:t[0],duration:(e==null?void 0:e.duration)||u(this,V).map.getBearing(),animate:!0,bearing:(e==null?void 0:e.bearing)||u(this,V).map.getBearing(),pitch:(e==null?void 0:e.pitch)||u(this,V).map.getPitch(),zoom:(e==null?void 0:e.maxZoomLevel)||u(this,V).map.getMaxZoom()}):(n=u(this,V).map)==null||n.fitBounds(t,{duration:e==null?void 0:e.duration,animate:!0,bearing:(e==null?void 0:e.bearing)||u(this,V).map.getBearing(),pitch:(e==null?void 0:e.pitch)||u(this,V).map.getPitch(),zoom:(e==null?void 0:e.maxZoomLevel)||u(this,V).map.getMaxZoom()}),u(this,rt).interactionSystem.handleHover(),Promise.resolve()):new Promise(o=>{u(this,rt).cameraSystem.focusOn(t.map(a=>u(this,V).convertTo3DMapPosition(a[1],a[0],a[2]||0)),{insetsPadding:(e==null?void 0:e.padding)||this.insetsPadding},{minZoom:(e==null?void 0:e.maxZoomLevel)===void 0?void 0:u(this,rt).cameraSystem.convertZoomLevelToAltitude(hn(e.maxZoomLevel,this.minZoomLevel,this.maxZoomLevel,"maxZoomLevel was clamped to minZoomLevel/maxZoomLevel bounds. Use mapView.Camera.setMaxZoomLevel() to adjust limits.")),maxZoom:(e==null?void 0:e.minZoomLevel)===void 0?void 0:u(this,rt).cameraSystem.convertZoomLevelToAltitude(hn(e.minZoomLevel,this.minZoomLevel,this.maxZoomLevel,"minZoomLevel was clamped to minZoomLevel/maxZoomLevel bounds. Use mapView.Camera.setMinZoomLevel() to adjust limits.")),padding:(e==null?void 0:e.padding)||{top:0,left:0,bottom:0,right:0},curve:$4[(e==null?void 0:e.easing)||"ease-in-out"],rotation:e!=null&&e.bearing?ot.degToRad(e.bearing):void 0,tilt:(e==null?void 0:e.pitch)!==void 0?ot.degToRad(hn(e.pitch,this.minPitch,this.maxPitch,"pitch was clamped to minPitch/maxPitch bounds. Use mapView.Camera.setMinPitch() and mapView.Camera.setMaxPitch() to adjust limits.")):void 0,duration:e==null?void 0:e.duration,callback:()=>{u(this,rt).interactionSystem.handleHover(),o()},cancelledCallback:o})})}};V=new WeakMap,rt=new WeakMap,dn=new WeakMap,Ps=new WeakMap,l(_m,"Camera");var Ru=_m;d();function J4(r){r&&(r.map&&(r.map.dispose(),r.map=void 0),r.dispose())}l(J4,"scrubMaterial");function Te(r){for(let t=r.children.length-1;t>=0;t--)Te(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){J4(t)}):"material"in r&&typeof r.material<"u"&&J4(r.material)}l(Te,"destroyObject3D");d();var K4=`uniform vec4 uSize;
612
612
  varying vec2 vUv;
613
613
  void main() {
614
614
  vUv = uv;
@@ -947,4 +947,4 @@ void main(void) {
947
947
  gl_FragColor = vec4(color, opacity * opacityMultiplier);
948
948
  }
949
949
  #include <colorspace_fragment>
950
- }`;var p5="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 aT=new In;function h5(r,t){let{nearRadius:e,farRadius:i,color:n,accentColor:o,completeFraction:a}=t,c=!0,s=0,p=1/0,f=t.displayArrowsOnPath,m=!0,y=!0,x=f,M=e/2+.15,g=0;r[0].z+=M;for(let it=1;it<r.length;++it){r[it].z+=M;let Mt=r[it].x-r[it-1].x,xt=r[it].y-r[it-1].y,be=r[it].z-r[it-1].z;g+=Math.sqrt(Mt*Mt+xt*xt+be*be)}let C=M-.1;r.push(r[r.length-1].clone().setZ(C)),r.unshift(r[0].clone().setZ(C));let I=new P1;x&&(I=aT.load(p5),I.colorSpace=Si);let T=new It(n),w=new It(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:c?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}},_=new N1(r);_.curveType="catmullrom",_.tension=0;let R=30,G=8,N=R*r.length,j=new B1(_,N,e,G,!1),H=new Float32Array(j.attributes.position.count);for(let it=r.length;it<H.length;it++)H[it]=it;j.setAttribute("vertexIndex",new Ho(H,1));let J=new Float32Array(j.attributes.position.count),ut=new Ho(J,1);for(let it=0;it<=N;it++)for(let Mt=0;Mt<=G;++Mt)ut.setX(it*(G+1)+Mt,it/N);j.setAttribute("pathDistance",ut);let yt=new Float32Array(j.attributes.normal.count*3),Ct=new Ho(yt,3);for(let it=0;it<N;it++){let Mt=j.tangents[it];for(let xt=0;xt<=G;++xt)Ct.setXYZ(it*(G+1)+xt,Mt.x,Mt.y,Mt.z)}j.setAttribute("pathTangent",Ct);let Bt=new Float32Array(j.attributes.normal.count*3),De=new Ho(Bt,3);for(let it=0;it<N;it++){let Mt=j.tangents[it];var gt,kt,Pt;gt=-Mt.x*Mt.z,kt=-Mt.y*Mt.z,Pt=1-Mt.z*Mt.z;let xt=Math.sqrt(gt*gt+kt*kt+Pt*Pt);xt===0&&(xt=1);let be=gt/xt,Sn=kt/xt,Ro=Pt/xt;for(let Ci=0;Ci<=G;++Ci)De.setXYZ(it*(G+1)+Ci,be,Sn,Ro)}j.setAttribute("pathNormal",De);let le=new Xo({uniforms:L,vertexShader:jm,fragmentShader:Wm});le.transparent=!0,le.alphaTest=.5,L.resolution.value.x=1,L.resolution.value.y=1,L.vertexes.value=H.length,L.arrowTexture.value.wrapS=ze,L.arrowTexture.value.wrapT=ze,L.arrowTexture.value.anisotropy=16,L.complete.value=a;let Fr=new Ft(j,le),ce=Fr.clone(),ue={...L,opacityMultiplier:{type:"f",value:.25}};ue.complete.value=1,ce.material=new Xo({uniforms:ue,vertexShader:jm,fragmentShader:Wm}),ce.material.transparent=!0,ce.material.alphaTest=.5,ce.material.depthWrite=!1,ce.material.depthTest=!1,ce.renderOrder=1,ue.resolution.value.x=1,ue.resolution.value.y=1,ue.vertexes.value=H.length,ue.arrowTexture.value.wrapS=ze,ue.arrowTexture.value.wrapT=ze,ue.arrowTexture.value.anisotropy=16,ue.complete.value=a;let bi=t.mesh;bi.add(Fr),bi.add(ce),j.computeBoundingBox();let xn=new Y;return j.boundingBox.getCenter(xn),{mesh:bi,material:le,center:xn}}l(h5,"buildPath");var Ym=class Ym extends z{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 c=n.components[0];if(c.dirty){c.mesh.parent!=null&&c.mesh.children.forEach(y=>{Te(y)});let s=c.feature.features.map(y=>y.geometry.coordinates).map(y=>this.convertTo3DMapPosition(y[1],y[0],y[2]||0)),{mesh:p,material:f,center:m}=h5(s,c);c.mesh=p,c.material=f,c.dirty=!1,c.position=m}c.material&&(c.material.uniforms.nearZoom.value=t,c.material.uniforms.farZoom.value=e,c.material.uniforms.cameraParameters.value.x=i,c.displayArrowsOnPath&&c.animateArrowsOnPath&&(c.material.uniforms.arrowAnimationTimer.value=performance.now()/1e3,o=!0),c.material.needsUpdate=!0)}o&&this.publish("animate:path")}};l(Ym,"PathSystem");var Ts=Ym;var d5=new $e,qm=18,sT=12,lT=22,$m=0,Jm=0;var cT=ot.radToDeg(.698132),ae,wt,Is,Lo,vi,mn,Do,Es,zm,O,ct,Ye,bt,dr,Le,D,Ls,St,mt,Wu,f5,Yu,m5,Uu,y5,yn,Ds,_s,_o,zu,Os,As,ks,Oo,ve,We,Ns,Zm,gn,Rs,ee,re,Km=class Km extends z{constructor(e,i={}){var y,x,S,M,g,C,I,T,w,L;super();P(this,Es);P(this,Wu);P(this,Yu);P(this,Uu);P(this,ve);P(this,Ns);v(this,"options");v(this,"container");P(this,ae,void 0);P(this,wt,void 0);P(this,Is,void 0);P(this,Lo,void 0);P(this,vi,void 0);P(this,mn,void 0);P(this,Do,void 0);v(this,"rendererDomElement");P(this,O,{entity3DMap:new Map,entity2DMap:new Map,entity2DIds:new Set,threeDEntities:[],entityScene:new Tt("__scene"),hoverColor:"red",insetsPadding:fu,shouldMeasureCanvas:!0,pixelRatio:pi(),canvasWidth:0,canvasHeight:0});v(this,"camera");P(this,ct,void 0);P(this,Ye,void 0);P(this,bt,void 0);P(this,dr,void 0);P(this,Le,void 0);P(this,D,{});P(this,Ls,window.matchMedia("screen and (min-resolution: 2dppx)"));v(this,"map");P(this,St,l(()=>{u(this,D).renderSystem.twoDdirty=!0},"#invalidate2DEntities"));P(this,mt,l(()=>{u(this,D).renderSystem.threeDdirty=!0},"#invalidate3DEntities"));P(this,yn,"standalone");P(this,Ds,l(e=>Math.trunc(e*10)/10,"#round10"));P(this,_s,l(()=>{u(this,D).twoDDrawSystem.dirty=!0,X(this,Es,zm).call(this,pi()),u(this,D).watermarkSystem.dirty=!0,this.render()},"#handlePixelRatioChange"));P(this,_o,l(()=>{u(this,O).canvasWidth=this.rendererDomElement.clientWidth,u(this,O).canvasHeight=this.rendererDomElement.clientHeight,X(this,Es,zm).call(this,pi()),u(this,Oo).call(this),X(this,Uu,y5).call(this),u(this,D).cameraSystem.resize(this.canvasWidth,this.canvasHeight),u(this,D).cameraSystem.dirty=!0,u(this,D).watermarkSystem.resize(this.canvasWidth,this.canvasHeight),u(this,D).htmlControlsSystem.resize(this.canvasWidth),u(this,D).geometryInFocusSystem.resize(),this.render()},"#handleWindowResize"));P(this,zu,l(()=>{this.renderSync()},"#renderFull"));P(this,Os,new Y);P(this,As,l((e,i)=>{let n=this.mode==="standalone"?u(this,wt):this.viewCamera;if(u(this,wt).position.z+this.camera.elevation>i.z){u(this,Os).copy(i);let o=u(this,Os).project(n),a=(o.x+1)/2*this.canvasWidth-0/2,c=(-o.y+1)/2*this.canvasHeight-0/2,s=u(this,Ds).call(this,a),p=u(this,Ds).call(this,c);e.x=s,e.y=p}else e.x=-1e3,e.y=-1e3},"#project"));P(this,ks,l((e,i)=>{u(this,Le).setBufferSize(e,i),u(this,wt).aspect=e/i,u(this,wt).updateProjectionMatrix(),u(this,wt).updateMatrixWorld(!0),u(this,Lo).x=e,u(this,Lo).y=i},"#setBufferSize"));P(this,Oo,l(()=>{var a;let e=u(this,O).canvasWidth=this.rendererDomElement.clientWidth,i=u(this,O).canvasHeight=this.rendererDomElement.clientHeight,n=Math.floor(e*this.resolutionScale),o=Math.floor(i*this.resolutionScale);u(this,ks).call(this,n,o),(a=this.map)==null||a.resize(),u(this,O).shouldMeasureCanvas=!1},"#measureCanvas"));v(this,"showCollisionBoxes",()=>{u(this,D).collisionSystem.showCollisionBoxes(),this.render()});v(this,"hideCollisionBoxes",()=>{u(this,D).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);d5.setFromCamera(a,u(this,wt).clone());let c=(s=d5.intersectObject(u(this,vi),!1)[0])==null?void 0:s.point;return c!=null?this.convert3DMapPositionToCoordinate(c):void 0});v(this,"projectCoordinateToScreenXY",e=>{let i=this.convertTo3DMapPosition(e[1],e[0],e[2]||0),n=new U;return u(this,As).call(this,n,i),{x:n.x,y:n.y}});v(this,"convert3DMapPositionToCoordinate",e=>{var o,a,c,s;let{lat:i,lon:n}=Xc((a=(o=u(this,O).center)==null?void 0:o[1])!=null?a:0,(s=(c=u(this,O).center)==null?void 0:c[0])!=null?s:0,e.x,e.y);return[n,i]});v(this,"setBackgroundColor",(e,i)=>{u(this,Le).setBackgroundColor(e,i)});v(this,"hideOutdoorLayersUnderPoint",(e,i)=>{!this.map||(i==null?void 0:i.length)===0||(u(this,D).outdoorLayersSystem.hideLayersUnderPoint(e,i),this.render())});P(this,gn,new D1);P(this,Rs,new gr);v(this,"render",()=>{u(this,D).renderSystem!=null&&(this.map&&(this.mode==="outdoors-interleaved"||this.mode==="outdoors-overlay")?this.map.triggerRepaint():u(this,D).renderSystem.update())});v(this,"renderSync",()=>{u(this,D).renderSystem.update(!0)});P(this,ee,lr(()=>{this.publish("user-interaction-start",void 0)},0,!0));P(this,re,lr(()=>{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"&&(B.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",()=>u(this,D).interactionSystem.getCursor());v(this,"destroy",()=>{u(this,D).cameraSystem.off("user-dolly-start",u(this,ee)),u(this,D).cameraSystem.off("user-pan-start",u(this,ee)),u(this,D).cameraSystem.off("user-rotate-start",u(this,ee)),u(this,D).cameraSystem.off("user-zoom-start",u(this,ee)),u(this,D).cameraSystem.off("user-tilt-start",u(this,ee)),u(this,D).cameraSystem.off("user-pedestal-start",u(this,ee)),u(this,D).cameraSystem.off("user-dolly-end",u(this,re)),u(this,D).cameraSystem.off("user-pan-end",u(this,re)),u(this,D).cameraSystem.off("user-rotate-end",u(this,re)),u(this,D).cameraSystem.off("user-zoom-end",u(this,re)),u(this,D).cameraSystem.off("user-tilt-end",u(this,re)),u(this,D).cameraSystem.off("user-pedestal-end",u(this,re)),u(this,D).renderSystem.off("measure-canvas",u(this,Oo)),this.remove("__scene"),u(this,St).call(this),u(this,mt).call(this),this.renderSync(),u(this,D).renderSystem.destroy(),u(this,D).zoomInterpolationSystem.destroy(),u(this,D).renderSystem.destroy(),u(this,D).cameraSystem.off("change",this.render),u(this,D).pathSystem.off("animate:path",this.render),u(this,D).cameraSystem.dispose(),u(this,D).exporterSystem.destroy(),u(this,D).outdoorLayersSystem.destroy(),u(this,D).drawSystem.destroy(),window.removeEventListener("resize",u(this,_o),!1),u(this,Ls).removeEventListener("change",u(this,_s)),u(this,mn)&&u(this,mn).disconnect(),this._subscribers={},u(this,Le).destroy(),u(this,ae).traverse(e=>{Te(e),"dispose"in e&&typeof e.dispose=="function"&&e.dispose()}),E(this,ae,void 0),u(this,D).htmlControlsSystem.destroy(),u(this,D).collisionSystem.destroy(),u(this,D).domMutationSystem.destroy(),u(this,D).geometryInFocusSystem.destroy(),E(this,D,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(u(this,dr)),this.container.removeChild(u(this,ct)),E(this,Le,void 0)});this.convertTo3DMapPosition=this.convertTo3DMapPosition.bind(this),(i.mode==="outdoors-interleaved"||i.mode==="outdoors-overlay")&&i.map&&(E(this,yn,i.mode),this.map=i.map),u(this,O).entityScene.addEventListener("childadded",()=>{u(this,mt).call(this),u(this,St).call(this)}),u(this,O).entityScene.addEventListener("childremoved",()=>{u(this,mt).call(this),u(this,St).call(this)}),u(this,O).entity3DMap.set(u(this,O).entityScene.userData.entityId,u(this,O).entityScene),i.center&&(u(this,O).center=i.center?[...i.center]:[0,0]),this.options=i,this.container=e,X(this,Wu,f5).call(this),X(this,Yu,m5).call(this),u(this,D).htmlControlsSystem=new Gu(this.container),u(this,yn)!=="outdoors-overlay"&&u(this,D).htmlControlsSystem.addAttributionControl(this.options.attribution),window.MappedinDebug||(window.MappedinDebug={}),b.env.NODE_ENV==="test"&&(window.MappedinDebug.mapViewCoreInstance=this),E(this,Le,new Vc({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(),u(this,St).call(this),u(this,mt).call(this),this.render()},onWebGLRendererError:i.onWebGLRendererError,backgroundColor:i.backgroundColor||"#ffffff",backgroundAlpha:(x=i.backgroundAlpha)!=null?x:1})),E(this,ae,new al),u(this,ae).add(u(this,O).entityScene);let n=window.__THREE_DEVTOOLS__;b.env.NODE_ENV==="dev"&&typeof n<"u"&&(n.dispatchEvent(new CustomEvent("observe",{detail:u(this,ae)})),n.dispatchEvent(new CustomEvent("observe",{detail:u(this,Le)}))),E(this,wt,new L1(cT,this.aspect,50,1e5)),E(this,Is,new E1),u(this,wt).renderOrder=999;let o=new _e;o.add(u(this,wt)),E(this,Do,new _e),u(this,Do).add(o),u(this,ae).add(u(this,Do)),u(this,wt).updateProjectionMatrix(),u(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=u(this,Le).domElement(),E(this,Lo,new U);let a=new Mn(1e6,1e6),c=new Vr({color:0,visible:!1});E(this,vi,new Ft(a,c)),u(this,ae).add(u(this,vi)),(S=i.gl)!=null&&S.canvas||e.appendChild(this.rendererDomElement),window.addEventListener("resize",u(this,_o),!1),u(this,Ls).addEventListener("change",u(this,_s)),typeof ResizeObserver=="function"&&((M=b.env)==null?void 0:M.NODE_ENV)!=="test"&&(E(this,mn,new ResizeObserver(lr(()=>{u(this,_o).call(this)},0))),(g=u(this,mn))==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%",b.env.NODE_ENV==="test"&&this.rendererDomElement.setAttribute("data-testid","mappedin-canvas"),u(this,O).canvasWidth=this.rendererDomElement.clientWidth,u(this,O).canvasHeight=this.rendererDomElement.clientHeight,this.rendererDomElement.style.touchAction="manipulation";let s=this.canvasWidth,p=this.canvasHeight;u(this,D).watermarkSystem=new Bu(u(this,wt),s,p,u(this,O),i==null?void 0:i.watermark),u(this,D).watermarkSystem.on("texture-loaded",this.render),u(this,O).shouldMeasureCanvas=!0,u(this,O).pixelRatio=this.resolutionScale,u(this,ks).call(this,Math.floor(s*this.resolutionScale),Math.floor(p*this.resolutionScale));let f=new ll(16777215,.3*Math.PI);f.position.set(-150,-150,350),u(this,ae).add(f);let m=new G1(16777215,.741*Math.PI);u(this,ae).add(m),u(this,D).cameraSystem=new xs(u(this,wt),u(this,ae),u(this,Le).renderer,u(this,O),{mode:this.mode,canvasHeight:p,canvasWidth:s}),u(this,D).cameraSystem.on("user-dolly-start",u(this,ee)),u(this,D).cameraSystem.on("user-pan-start",u(this,ee)),u(this,D).cameraSystem.on("user-rotate-start",u(this,ee)),u(this,D).cameraSystem.on("user-zoom-start",u(this,ee)),u(this,D).cameraSystem.on("user-tilt-start",u(this,ee)),u(this,D).cameraSystem.on("user-pedestal-start",u(this,ee)),u(this,D).cameraSystem.on("user-dolly-end",u(this,re)),u(this,D).cameraSystem.on("user-pan-end",u(this,re)),u(this,D).cameraSystem.on("user-rotate-end",u(this,re)),u(this,D).cameraSystem.on("user-zoom-end",u(this,re)),u(this,D).cameraSystem.on("user-tilt-end",u(this,re)),u(this,D).cameraSystem.on("user-pedestal-end",u(this,re)),u(this,D).cameraSystem.on("change",()=>{this.publish("camera-change",this.camera),u(this,D).geometryInFocusSystem&&(u(this,D).geometryInFocusSystem.cameraDirty=!0),this.render()}),u(this,D).panBoundsSystem=new Fu(u(this,O),u(this,D).cameraSystem),u(this,D).pathSystem=new Ts(u(this,O),this.convertTo3DMapPosition),u(this,D).pathSystem.on("animate:path",this.render),this.camera=new Ru(this,u(this,D),u(this,O),u(this,vi)),this.camera.setZoomLevel((T=i.zoomLevel)!=null?T:qm),this.camera.setBearing((w=i.bearing)!=null?w:Jm),this.camera.setPitch((L=i.pitch)!=null?L:$m),this.camera.setMaxZoomLevel(lT),this.camera.setMinZoomLevel(sT),u(this,D).domVisiblitySystem=new Su(u(this,O),u(this,dr)),u(this,D).domMutationSystem=new Nu(u(this,O),u(this,dr)),u(this,D).domMutationSystem.on("dimensions-update",()=>{u(this,D).collisionSystem.dirty=!0,this.render()}),u(this,D).domDrawSystem=new Au(u(this,O)),u(this,D).collisionSystem=new Uc(u(this,Ye),u(this,O)),u(this,D).twoDDrawSystem=new Mu(u(this,O),u(this,bt)),u(this,D).interactionSystem=new Ja(this.rendererDomElement,u(this,O),u(this,wt),u(this,vi)),u(this,D).interactionSystem.on("hover",this.render),u(this,D).interactionSystem.on("click",_=>{var R,G,N,j,H;if(((R=_.entity2D)==null?void 0:R.id)==="watermark"&&typeof u(this,D).watermarkSystem.options.onClick=="function"){u(this,D).watermarkSystem.options.onClick();return}this.publish("click",{coordinate:this.convert3DMapPositionToCoordinate(_.position),geometry:_.entity3D?[(G=_.entity3D)==null?void 0:G.id]:[],markers:((N=_.entity2D)==null?void 0:N.components[0])instanceof Me?[_.entity2D.id]:[],models:((j=_.entity3D)==null?void 0:j.components[0])instanceof mi?[_.entity3D.id]:[],labels:((H=_.entity2D)==null?void 0:H.components[0])instanceof ur?[_.entity2D.id]:[],containers:Array.isArray(_.groupContainers)?_.groupContainers.map(J=>J.userData.entityId):[],pointerEvent:_.pointerEvent})}),u(this,D).interactionSystem.on("hover",_=>{var R,G,N,j,H;_.position&&((R=_.entity2D)==null?void 0:R.id)!=="watermark"&&this.publish("hover",{coordinate:this.convert3DMapPositionToCoordinate(_.position),geometry:_.entity3D?[(G=_.entity3D)==null?void 0:G.id]:[],markers:((N=_.entity2D)==null?void 0:N.components[0])instanceof Me?[_.entity2D.id]:[],models:((j=_.entity3D)==null?void 0:j.components[0])instanceof mi?[_.entity3D.id]:[],labels:((H=_.entity2D)==null?void 0:H.components[0])instanceof ur?[_.entity2D.id]:[],containers:Array.isArray(_.groupContainers)?_.groupContainers.map(J=>J.userData.entityId):[]})}),u(this,D).geometryInFocusSystem=new Xu(u(this,O),u(this,wt)),u(this,D).geometryInFocusSystem.on("geometry-in-focus",_=>{this.publish("geometry-in-focus",_)}),u(this,D).twoDVisiblitySystem=new Iu(u(this,O)),u(this,D).drawSystem=new Tu(u(this,O)),u(this,D).drawSystem.on("texture-loaded",this.render),u(this,D).stackSystem=new Du(u(this,O)),u(this,D).twoDProjectionSystem=new Pu(u(this,O),u(this,As)),u(this,D).zoomInterpolationSystem=new au,u(this,D).exporterSystem=new as(u(this,O)),u(this,D).meshOptimizationSystem=new xu(u(this,O),this.convertTo3DMapPosition),u(this,D).meshOptimizationSystem.on("model-loaded",this.render),u(this,D).customGeometrySystem=new Vu(u(this,O)),u(this,D).outlineInterpolationSystem=new Hu(u(this,O)),u(this,D).renderSystem=new Eu(u(this,Le),u(this,O),this.mode,u(this,ae),u(this,wt),this.viewCamera,u(this,D)),u(this,D).renderSystem.on("measure-canvas",u(this,Oo)),u(this,D).outdoorLayersSystem=new ju(this.map),u(this,zu).call(this)}get viewCamera(){return u(this,Is)}get canvasWidth(){return u(this,O).canvasWidth}get canvasHeight(){return u(this,O).canvasHeight}get resolutionScale(){var e,i;return(i=(e=this.map)==null?void 0:e.getPixelRatio())!=null?i:pi()}get aspect(){return this.canvasWidth/this.canvasHeight}get mode(){return u(this,yn)}addGroupContainer(e,i,n){var o;if(!u(this,O).entity3DMap.has(e)&&!u(this,O).entity2DMap.has(e)){let a=new Tt(e);a.addEventListener("childadded",()=>{u(this,mt).call(this),u(this,St).call(this)}),a.addEventListener("childremoved",()=>{u(this,mt).call(this),u(this,St).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&&ge(a,i.interactive,u(this,O)),u(this,O).entity3DMap.set(e,a),(o=X(this,ve,We).call(this,n))==null||o.addEntity(a),u(this,mt).call(this),this.render()}else B.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(u(this,O).entity3DMap.has(e))B.error(`Stack container with ID '${e}' already exists. The stack container cannot be added.`);else{let a=new Tt(e);a.addEventListener("childadded",()=>{u(this,mt).call(this),u(this,St).call(this)}),a.addEventListener("childremoved",()=>{u(this,mt).call(this),u(this,St).call(this)}),a.components[0]=new ku,(i==null?void 0:i.visible)!==void 0&&(a.visible=i.visible),u(this,O).entity3DMap.set(e,a),(o=X(this,ve,We).call(this,n))==null||o.addEntity(a)}return{id:e,type:"stack-container"}}addCustomGeometry(e,i,n,o,a){var c;if(u(this,O).entity3DMap.has(e))B.error(`Custom geometry with ID '${e}' already exists. The custom geometry cannot be added.`);else{let s=new Eo(i,n),p=new dt(s,new hi(o));p.id=e,s.mesh.userData={entityId:e,type:"custom-geometry"},u(this,O).entity3DMap.set(p.id,p),(c=X(this,ve,We).call(this,a))==null||c.addEntity(p),this.render()}return{id:e,type:"custom-geometry"}}addGeometryGroup(e,i,n,o){var a,c;if(!u(this,O).entity3DMap.has(e)&&!u(this,O).entity2DMap.has(e)){let s=new Vt(e,new Ki(n));s.addEventListener("childadded",()=>{u(this,mt).call(this),u(this,St).call(this)}),s.addEventListener("childremoved",()=>{u(this,mt).call(this),u(this,St).call(this)}),s.userData.dirty=!0,u(this,O).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||tt(),m=u(this,D).meshOptimizationSystem.createEntityFromFeature(f,p,n);u(this,O).entity3DMap.set(f,m),s.userData.entities3D.add(f)}s.setVisible((a=n==null?void 0:n.visible)!=null?a:!0),(c=X(this,ve,We).call(this,o))==null||c.addEntity(s),u(this,mt).call(this),this.render()}else B.error(`Geometry group with ID '${e}' already exists. The geometry group cannot be added.`);return u(this,D).outlineInterpolationSystem.dirty=!0,{id:e,type:"geometry-group"}}addModelGroup(e,i,n,o){var a;if(!u(this,O).entity3DMap.has(e)&&!u(this,O).entity2DMap.has(e)){let c=new Vt(e,new Ki(n));c.addEventListener("childadded",()=>{u(this,mt).call(this),u(this,St).call(this)}),c.addEventListener("childremoved",()=>{u(this,mt).call(this),u(this,St).call(this)}),u(this,O).entity3DMap.set(e,c),c.userData.dirty=!0,c.userData.modelURL=n.url;for(let s of i.features){let p=s.id||s.properties.id||tt(),f=u(this,D).meshOptimizationSystem.createModelFromFeature(p,s,n);s.properties.interactive!==void 0&&ge(f,s.properties.interactive,u(this,O)),u(this,O).entity3DMap.set(p,f),c.userData.entities3D.add(p)}(a=X(this,ve,We).call(this,o))==null||a.addEntity(c),u(this,mt).call(this),this.render()}else B.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 c;let a=n==null?void 0:n.id;if(a===void 0||!u(this,O).entity2DMap.has(a)&&!u(this,O).entity3DMap.has(a)){let s=X(this,Ns,Zm).call(this,e,new Me(i,n));s.id=a||String(s.id),a=s.id,(n==null?void 0:n.interactive)!=null&&ge(s,n==null?void 0:n.interactive,u(this,O)),(c=X(this,ve,We).call(this,o))==null||c.addEntity(s),this.render()}else B.error(`Marker2D with ID '${a}' already exists. The marker cannot be added.`);return{id:a,type:"marker"}}addLabel2D(e,i,n,o){var c;let a=n==null?void 0:n.id;if(a===void 0||!u(this,O).entity2DMap.has(a)&&!u(this,O).entity3DMap.has(a)){let s=X(this,Ns,Zm).call(this,e,new ur(i,n||{},u(this,O)));s.id=a||String(s.id),a=s.id,(n==null?void 0:n.interactive)!=null&&ge(s,n==null?void 0:n.interactive,u(this,O)),(c=X(this,ve,We).call(this,o))==null||c.addEntity(s),u(this,St).call(this),this.render()}else B.error(`Label2D with ID '${a}' already exists. The label cannot be added.`);return{id:a,type:"label"}}addPath(e,i={},n){var c;let o=new Lu(e,i),a=new dt(o,new hi);return a.id=(i==null?void 0:i.id)||tt(),o.mesh.userData={entityId:a.id,type:"path"},u(this,O).entity3DMap.set(a.id,a),(i==null?void 0:i.interactive)!=null&&ge(a,i==null?void 0:i.interactive,u(this,O)),(c=X(this,ve,We).call(this,n))==null||c.addEntity(a),u(this,mt).call(this),this.render(),{id:a.id,type:"path"}}updateWatermark(e){u(this,D).watermarkSystem.options=e,u(this,D).watermarkSystem.dirty=!0,this.render()}updateStackState(e,i){let n;(typeof e=="string"||typeof e=="number")&&(n=u(this,O).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=u(this,O).entity2DMap.get(e),i==null&&(i=u(this,O).entity3DMap.get(e))):typeof e.id=="string"||typeof e.id=="number"?(i=u(this,O).entity2DMap.get(e.id),i==null&&(i=u(this,O).entity3DMap.get(e.id))):i=e,i!=null){if(i.type==="custom-geometry")u(this,O).entity3DMap.delete(i.id),i.object3d&&Te(i.object3d);else if(i.type==="group-container"){u(this,O).entity3DMap.delete(i.userData.entityId);for(let o of i.childrenIds.values())this.remove(o),i.userData.entities2D.delete(o);Te(i)}else if(i.type==="geometry-group"){u(this,O).entity3DMap.delete(i.userData.entityId);for(let o of i.userData.entities3D.values())this.remove(o),i.userData.entities3D.delete(o);Te(i)}else if(i.type==="geometry"||i.type==="model"||i.type==="path"){let o=i.components[0];i.object3d&&(((n=i.parent)==null?void 0:n.type)==="geometry-group"&&i.parent.userData.entities3D.delete(i.id),Te(i.object3d)),o.outline&&Te(o.outline),"focusMesh"in o&&o.focusMesh!=null&&Te(o.focusMesh),u(this,O).entity3DMap.delete(i.id)}else(i.type==="marker"||i.type==="label")&&(i.object3d&&Te(i.object3d),i.type==="label"&&delete u(this,D).twoDDrawSystem.textCache[i.id],u(this,O).entity2DMap.delete(i.id));u(this,mt).call(this),u(this,St).call(this),this.render()}}getScene(){return this.getState("__scene")}getCurrentSceneGLTF(e){return u(this,D).exporterSystem.getCurrentSceneGLTF(e)}getBoundingArea(e){this.renderSync();let i=new yr;if(e==null)i.setFromObject(u(this,O).entityScene);else{let n=qa(u(this,O),e);if((n==null?void 0:n.type)==="geometry"&&(n==null?void 0:n.object3d)!=null){let o=n.components[0],a=o instanceof Rt?o.geometry:void 0;o.mesh instanceof wn&&a?(a.computeBoundingBox(),a.boundingBox&&i.union(a.boundingBox)):i.setFromObject(n.object3d)}else((n==null?void 0:n.type)==="geometry-group"||(n==null?void 0:n.type)==="group-container")&&(n==null?void 0:n.userData.entityId)!=null&&i.setFromObject(n)}if(pb(i))return bf(i).map(this.convert3DMapPositionToCoordinate)}getState(e){var n;if(e==null)return{type:"map-view",hoverColor:u(this,O).hoverColor};let i=qa(u(this,O),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 c of i.userData.entities3D.values()){let s=this.getState(c);((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(c=>u(this,O).entity3DMap.get(c)).every(c=>c&&c.components[2]!=null),children:Array.from(i.userData.entities3D.values()).map(c=>this.getState(c)).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,c=a==null?void 0:a.userData.entityId;return{id:i.id,type:"label",text:o.text||"",parent:{id:c,type:a==null?void 0:a.type},position:this.convert3DMapPositionToCoordinate(i.position),enabled:o.enabled,initialRank:$a(o.initialRank),options:{rank:$a(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,c=a==null?void 0:a.userData.entityId;return{id:i.id,type:"marker",enabled:o.enabled,parent:{id:c,type:a==null?void 0:a.type},position:this.convert3DMapPositionToCoordinate(i.position),element:o.containerEl,initialRank:$a(o.initialRank),options:{rank:$a(o.rank),interactive:i.components[1]!=null||!1}}}else if((i==null?void 0:i.type)==="geometry"){let{color:o,hoverColor:a,initialColor:c,topColor:s}=i.components[1],p=i.components[0],f=i.components[1];return{id:i.id,type:"geometry",color:o,focusable:p.focusable,topColor:s,initialColor:c,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],c=i.components[1];return{id:i.id,type:"path",position:this.convert3DMapPositionToCoordinate(o.position),visible:c.visible,interactive:a!=null,completeFraction:o.completeFraction}}else return}}setState(e,i){var o,a,c;if(typeof e=="object"&&"hoverColor"in e&&i==null){u(this,O).hoverColor=(o=e.hoverColor)!=null?o:u(this,O).hoverColor;return}let n=qa(u(this,O),e);if(n!=null){if(n.type==="custom-geometry"){let s=u(this,O).entity3DMap.get(n.id);if(s instanceof dt&&s.components[0]instanceof Eo){let p=i;So(n,p.visible),Qf(n,p.altitude),Jf(n,p.position,this.convertTo3DMapPosition),Kf(n,X(this,ve,We).call(this,p.parent,!1))}}else if(n.type==="model"||n.type==="path"){let s=i;ge(n,s.interactive,u(this,O))&&u(this,mt).call(this),n.type==="path"&&(s=s,g4(n,s),So(n,s.visible))}else if(n.type==="group-container"){let s=i;So(n,s.visible)&&(u(this,D).outlineInterpolationSystem.dirty=!0),ge(n,s.interactive,u(this,O))&&u(this,mt).call(this),Qf(n,s.altitude)}else if(n.type==="geometry-group"){let s=i;So(n,s.visible)&&(u(this,D).outlineInterpolationSystem.dirty=!0),d4(n,u(this,O),s)&&(u(this,D).outlineInterpolationSystem.dirty=!0),tm(n,s.outline)&&(u(this,D).outlineInterpolationSystem.geometries3DDirty=!0),f4(n,s.shading),S4(n,u(this,O),s.opacity),ge(n,s.interactive,u(this,O))&&(u(this,mt).call(this),u(this,St).call(this))}else if(n.type==="geometry"){if(n.components[0]instanceof Rt){let s=i;So(n,s.visible)&&(u(this,D).outlineInterpolationSystem.geometries3DDirty=!0),tm(n,s.outline)&&(u(this,D).outlineInterpolationSystem.geometries3DDirty=!0),s.focusable!=null&&(n.components[0].focusable=s.focusable,u(this,D).geometryInFocusSystem.focusablesDirty=!0),m4(n,s),x4(n,s.hoverColor),ge(n,s.interactive,u(this,O))}u(this,mt).call(this)}else if(n.type==="label"||n.type==="marker"){let s=i;C4(n,i),v4(n,i)&&u(this,St).call(this),b4(n,(a=s.options)==null?void 0:a.rank)&&u(this,St).call(this),Jf(n,s.position,this.convertTo3DMapPosition),Kf(n,X(this,ve,We).call(this,s.parent,!1))&&(u(this,St).call(this),u(this,D).panBoundsSystem.dirty=!0),y4(n,s.enabled),ge(n,(c=s.options)==null?void 0:c.interactive,u(this,O))&&u(this,St).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:c}=jc((p=(s=u(this,O).center)==null?void 0:s[1])!=null?p:0,(m=(f=u(this,O).center)==null?void 0:f[0])!=null?m:0,e,i);return o?(o.set(a,c,n),o):new Y(a,c,n)}getCenter(e){let i=Array.isArray(e)?e:this.getBoundingArea(e);return i?ub(i):void 0}isInView(e){let i=qa(u(this,O),e);if(u(this,Rs).identity().multiply(u(this,wt).projectionMatrix).multiply(u(this,wt).matrixWorldInverse),u(this,gn).setFromProjectionMatrix(u(this,Rs)),i instanceof Pe)return u(this,gn).containsPoint(i.position);if(i instanceof dt){let n=i==null?void 0:i.components[0];if(n instanceof Eo||n instanceof mi)return u(this,gn).containsPoint(this.convertTo3DMapPosition(n.feature.geometry.coordinates));if(n instanceof Rt){let o=new yr(this.convertTo3DMapPosition(n.featureBbox[1],n.featureBbox[0],0),this.convertTo3DMapPosition(n.featureBbox[3],n.featureBbox[2],0));return u(this,gn).intersectsBox(o)}}return!1}getSystems(){return u(this,D)}getInternalState(){return u(this,O)}};ae=new WeakMap,wt=new WeakMap,Is=new WeakMap,Lo=new WeakMap,vi=new WeakMap,mn=new WeakMap,Do=new WeakMap,Es=new WeakSet,zm=l(function(e){var i;u(this,yn)!=="outdoors-overlay"&&((i=this.map)==null||i.setPixelRatio(e)),u(this,O).pixelRatio=this.resolutionScale},"#setResolutionScale"),O=new WeakMap,ct=new WeakMap,Ye=new WeakMap,bt=new WeakMap,dr=new WeakMap,Le=new WeakMap,D=new WeakMap,Ls=new WeakMap,St=new WeakMap,mt=new WeakMap,Wu=new WeakSet,f5=l(function(){E(this,ct,document.createElement("div")),u(this,ct).classList.add("mappedin__smart-collision-engine__container"),E(this,Ye,document.createElement("canvas")),u(this,Ye).classList.add("mappedin__smart-collision-engine-debug__container"),this.container.appendChild(u(this,ct)),E(this,bt,document.createElement("canvas")),u(this,bt).classList.add("mappedin__smart-collision-engine__container"),u(this,bt).width=u(this,ct).clientWidth*this.resolutionScale,u(this,bt).height=u(this,ct).clientHeight*this.resolutionScale,u(this,bt).style.width=u(this,ct).clientWidth+"px",u(this,bt).style.height=u(this,ct).clientHeight+"px",u(this,ct).appendChild(u(this,Ye)),u(this,ct).appendChild(u(this,bt)),u(this,Ye).width=u(this,ct).clientWidth,u(this,Ye).height=u(this,ct).clientHeight,u(this,bt).width=u(this,ct).clientWidth*this.resolutionScale,u(this,bt).height=u(this,ct).clientHeight*this.resolutionScale,u(this,bt).style.width=u(this,ct).clientWidth+"px",u(this,bt).style.height=u(this,ct).clientHeight+"px"},"#renderEntity2DContainer"),Yu=new WeakSet,m5=l(function(){E(this,dr,document.createElement("div")),u(this,dr).classList.add("mappedin-2d-entities"),Object.assign(u(this,dr).style,{position:"absolute",top:"0",left:"0",bottom:"0",right:"0",pointerEvents:"none","transform-style":"preserve-3d"}),this.container.appendChild(u(this,dr))},"#renderEntityDOMContainer"),Uu=new WeakSet,y5=l(function(){u(this,bt).width=u(this,ct).clientWidth*this.resolutionScale,u(this,bt).height=u(this,ct).clientHeight*this.resolutionScale,u(this,bt).style.width=u(this,ct).clientWidth+"px",u(this,bt).style.height=u(this,ct).clientHeight+"px",u(this,Ye).width=u(this,ct).clientWidth,u(this,Ye).height=u(this,ct).clientHeight,u(this,bt).width=u(this,ct).clientWidth*this.resolutionScale,u(this,bt).height=u(this,ct).clientHeight*this.resolutionScale,u(this,bt).style.width=u(this,ct).clientWidth+"px",u(this,bt).style.height=u(this,ct).clientHeight+"px",u(this,D).collisionSystem.dirty=!0},"#resizeCollisionCanvas"),yn=new WeakMap,Ds=new WeakMap,_s=new WeakMap,_o=new WeakMap,zu=new WeakMap,Os=new WeakMap,As=new WeakMap,ks=new WeakMap,Oo=new WeakMap,ve=new WeakSet,We=l(function(e,i=!0){if(!e)return i?u(this,O).entityScene:void 0;if(typeof e=="string"||typeof e=="number"){let n=u(this,O).entity3DMap.get(e);return n instanceof Tt?n:(B.warn("Parent is not a valid container, adding to scene"),i?u(this,O).entityScene:void 0)}else if(e.type==="group-container"){let n=u(this,O).entity3DMap.get(e.id);if(n instanceof Tt)return n}return i?u(this,O).entityScene:void 0},"#getParentContainer"),Ns=new WeakSet,Zm=l(function(e,i,n){let o=new Pe(i,this.convertTo3DMapPosition(e[1],e[0],e[2]||n||0));return u(this,O).entity2DMap.set(o.id,o),o},"#createEntity2D"),gn=new WeakMap,Rs=new WeakMap,ee=new WeakMap,re=new WeakMap,l(Km,"Core");var Um=Km,Bs=Um;d();function uT(r,t){pT(r,t)(r.getScene(),t),hT(r,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 c=window.URL.createObjectURL(o);a.href=c,a.download="scene.glb",a.click(),window.URL.revokeObjectURL(c)}},"export")}l(uT,"mountSceneGraphVisualizer");function pT(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 c={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?F(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(c,"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.getBoundingArea(s))}),a.add(c,"interactive"),n.type==="path"&&a.add(c,"completeFraction",0,1,.1),a.add(c,"visible"),n.type!=="model"&&(a.addColor(c,"color"),a.add(c,"outline"))}else if(n.type==="marker"){let c={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(c,"focus").onChange(()=>{let s=r.getState(n.id);(s==null?void 0:s.type)==="marker"&&r.camera.focusOn([s.position])}),a.add(c,"interactive")}else if(n.type==="label"){let c={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:c.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:c.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:c.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:c.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:c.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:c.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:c.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(c,"focus").onChange(()=>{let s=r.getState(n.id);(s==null?void 0:s.type)==="label"&&r.camera.focusOn([s.position])}),a.add(c,"interactive"),a.add(c,"text"),a.add(c,"Text Size",10,50),a.add(c,"Icon Size",10,50),a.addColor(c,"Text Color"),a.addColor(c,"Active Background Color"),a.addColor(c,"Inactive Background Color"),a.addColor(c,"Active Foreground Color"),a.addColor(c,"Inactive Foreground Color")}else if(n.type==="geometry-group"){let c={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(c,"visible"),a.add(c,"opacity",0,1,.1),a.add(c,"interactive"),a.add(c,"outline"),a.add(c,"shadingStart",0,1,.1),a.add(c,"shadingEnd",0,1,.1),a.add(c,"shadingIntensity",0,1,.1)}else if(n.type==="group-container"){let c={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(c,"visible"),a.add(c,"interactive")}if(a.close(),n.children)for(let c of n.children.values())i(c,a)},"parseChild")}l(pT,"createParseChild");function hT(r,t){let e=t.addFolder("Watermark"),i={padding:16,iconOnly:!1,position:"bottom-left",color:"dark",scale:1};e.add(i,"padding",0,100,1),e.add(i,"scale",.5,1.5,.1),e.add(i,"color",["dark","light"]),e.add(i,"position",["top-left","top-right","bottom-left","bottom-right","center","top","bottom","left","right"]),e.add(i,"iconOnly"),e.onChange(()=>{r.updateWatermark(i)})}l(hT,"createWatermarkChild");var g5="https://tiles-cdn.mappedin.com/styles/mappedin/style.json",dT="https://auth.mappedin.com/oauth2/token";async function v5(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:c,MercatorCoordinate:s}=await import("./outdoor-context-v4-2EO5ZD2B.js"),p=t.outdoorView.headers;p==null&&(p=await lb(dT));let f=t.center||[0,0],m=new c({container:r,style:t.outdoorView.style||g5,center:f,attributionControl:!1,zoom:(n=t.zoomLevel)!=null?n:qm,pitch:(o=t.pitch)!=null?o:$m,bearing:(a=t.bearing)!=null?a:Jm,transformRequest:w=>{var L;return{url:w,headers:(L=t.outdoorView)==null?void 0:L.headers}},trackResize:!1,pixelRatio:pi(),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 Bs(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=Wc(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)===g5){B.error(`Failed to load outdoor view style, possibly due to invalid token "${p["x-mappedin-tiles-key"]}"`);return}B.warn(w)}),x}else return new Bs(r,t)}l(v5,"createRenderer");var Fs=Gr(po());var Zu=30,fT=1e3,Ao,Gs,Qm=class Qm extends z{constructor(e,i){super();this.api=e;this.core=i;P(this,Ao,void 0);P(this,Gs,0);v(this,"includedFloors",[]);v(this,"expanded",!1);i.on("camera-change",n=>{var c;let o=Math.floor(n.elevation/Zu),a=(c=this.includedFloors[o])==null?void 0:c.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 u(this,Gs)}set percentExpanded(e){let i=me(e,0,1,0,Zu);this.includedFloors.forEach((n,o)=>{this.core.setState(n.containerId,{visible:!0,altitude:i*o})}),E(this,Gs,e)}animateToCurrentFloor(){let e=this.includedFloors.indexOf(this.api.currentFloor)*Zu;new Fs.default.Tween({elevation:this.core.camera.elevation}).to({elevation:e},1e3).easing(Fs.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){u(this,Ao)&&u(this,Ao).stop();let i=this.includedFloors.indexOf(this.api.currentFloor)*Zu;return new Promise(n=>{E(this,Ao,new Fs.default.Tween({percentExpanded:this.percentExpanded}).to({percentExpanded:e==="expand"?1:"0"},fT).easing(Fs.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()})}};Ao=new WeakMap,Gs=new WeakMap,l(Qm,"StackedMaps");var qu=Qm;var mT={linear:vn.default.Easing.Linear.None,"ease-in":vn.default.Easing.Quadratic.In,"ease-out":vn.default.Easing.Quadratic.Out,"ease-in-out":vn.default.Easing.Quadratic.InOut},t1=class t1 extends z{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],c=this.renderer.addModelGroup(t,{type:"FeatureCollection",features:e.map(s=>{var p;return{type:"Feature",properties:{id:tt(),rotation:(p=s.rotation)==null?void 0:p.map(f=>f*(Math.PI/180)),scale:s.scale,interactive:s.interactive},geometry:{type:"Point",coordinates:li(s.target)}}})},{url:o.url},a.id);return this.renderer.getState(c).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(c=>c.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){B.error(`Failed to retrieve state for Marker with id "${t}".`);return}if(n.type!=="marker"){B.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 B.error(`Failed to retrieve state for Marker with id "${t}".`),Promise.resolve();if(o.type!=="marker")return B.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 c;new vn.default.Tween({lon:o.position[0],lat:o.position[1]}).to({lon:e[0],lat:e[1]},a.duration).easing(mT[a.easing]).onUpdate(({lon:p,lat:f})=>{this.Markers.setPosition(t,[p,f],i),this.renderer.render()}).onComplete(()=>{c()}).start();let s=new Promise(p=>{c=p});return this.renderer.render(),s}};Exporter={getCurrentSceneGLTF:async t=>this.renderer.getCurrentSceneGLTF(t)};Shapes={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=tt();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 c=(f=this.styleMap[a.properties.id])==null?void 0:f.showImage,s=(m=a.properties.details)==null?void 0:m.images,p;if(c&&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],c=this.renderer.addLabel2D(t,e,o,a.containerId);if(!c)throw new Error("label creating failed");return c},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 c=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 vn.default.Tween({fraction:0}).to({fraction:1},(e==null?void 0:e.drawDuration)||1e3).onUpdate(({fraction:s})=>{c.forEach(p=>{this.renderer.setState(p.id,{completeFraction:s})})}).onComplete(()=>{i(c)}).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 qu(this,this.renderer),this.mvf=e,this.styleMap=i,this.floors=this.mvf["map.geojson"].sort((a,c)=>a.elevation-c.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 c=new Gc(t,a,this.renderer,n,e,i);return c.load(),c}).filter(Boolean),this.setFloor(n.initialFloor?y3(n.initialFloor):this.floors[0].id)}};l(t1,"GeojsonApiMapObject");var Vs=t1;d();var Ue,Xs,e1=class e1{constructor({currentMapGetter:t}){P(this,Ue,new Map);P(this,Xs,void 0);E(this,Xs,t)}get currentMap(){return u(this,Xs).call(this)}getById(t){return u(this,Ue).get(t)}add(t,e,i){let n=nr(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(li(n),e,{...i,floorId:n.floorId,rank:(i==null?void 0:i.rank)||"medium",dynamicResize:(i==null?void 0:i.dynamicResize)||!1}),c=o.Markers.getContentEl(a.toString());if(!c)throw new Error("marker component should exist");let s=new Ui(a.toString(),c);return u(this,Ue).set(s.id,{marker:s,entityId:a.toString()}),s}remove(t){var i;let e=u(this,Ue).get(t.id);e&&((i=this.currentMap)==null||i.Markers.remove(e.entityId),u(this,Ue).delete(t.id.toString()))}removeAll(){let t=[];return u(this,Ue).forEach(({marker:e})=>{this.remove(e),t.push(e),u(this,Ue).delete(e.id.toString())}),t}setPosition(t,e){var a;let i=nr(e);if(!i){B.error("Cannot determine coordinate from target.");return}let n=this.currentMap;if(!n){B.error("Cannot determine the current map.");return}let o=u(this,Ue).get(t.id);if(!o){B.error(`Cannot find the Marker with id "${t.id}".`);return}n.Markers.setPosition(o.entityId,li(i),(a=i.floorId)!=null?a:n.currentFloorId)}animateTo(t,e,i){var c;let n=nr(e);if(!n)return B.error("Cannot determine coordinate from target."),Promise.resolve();let o=this.currentMap;if(!o)return B.error("Cannot determine the current map."),Promise.resolve();let a=u(this,Ue).get(t.id);return a?o.Markers.animateTo(a.entityId,li(n),(c=n.floorId)!=null?c:o.currentFloorId,i):(B.error(`Cannot find the Marker with id "${t.id}".`),Promise.resolve())}};Ue=new WeakMap,Xs=new WeakMap,l(e1,"Markers");var Hs=e1;d();var fr,Ws,r1=class r1{constructor({currentMapGetter:t}){P(this,fr,new Map);P(this,Ws,void 0);E(this,Ws,t)}get currentMap(){return u(this,Ws).call(this)}getById(t){return u(this,fr).get(t)}add(t,e){let i=Array.isArray(t)?t:[t],n=i.reduce((c,s)=>{var f;let p=nr(s.target);return p?(c.has(p.floorId)||c.set(p.floorId,[]),(f=c.get(p.floorId))==null||f.push({...s,target:p}),c):(B.error("Cannot determine coordinate from options."),c)},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((c,s)=>{let p=tt();o.Models.add(p,c,{...e,floorId:s}).forEach(({id:m})=>{let y=new _a(m.toString(),p);u(this,fr).set(y.id,{model:y,entityId:m.toString(),groupId:p}),a.push(y)})}),a}remove(t){var i;let e=u(this,fr).get(t.id);e&&((i=this.currentMap)==null||i.Models.remove(e.entityId,e.groupId),u(this,fr).delete(t.id.toString()))}removeAll(){let t=[];return u(this,fr).forEach(({model:e})=>{var n;let i=u(this,fr).get(e.id);i&&(t.push(e),(n=this.currentMap)==null||n.Models.remove(i.entityId,i.groupId),u(this,fr).delete(e.id.toString()))}),t}};fr=new WeakMap,Ws=new WeakMap,l(r1,"Models");var js=r1;d();var Nr,Us,i1=class i1{constructor({currentMapGetter:t}){P(this,Nr,new Map);P(this,Us,void 0);E(this,Us,t)}get currentMap(){return u(this,Us).call(this)}getById(t){return u(this,Nr).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 Oa(tt());return u(this,Nr).set(o.id,{path:o,entityIds:n.map(a=>a.id.toString())}),o}remove(t){var i;let e=u(this,Nr).get(t.id);e&&((i=this.currentMap)==null||i.Paths.remove(e.entityIds),u(this,Nr).delete(t.id.toString()))}removeAll(){let t=[];return u(this,Nr).forEach(({path:e})=>{this.remove(e),t.push(e),u(this,Nr).delete(e.id.toString())}),t}};Nr=new WeakMap,Us=new WeakMap,l(i1,"Paths");var Ys=i1;d();var $u=Gr(po());d();var b5="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAkklEQVRoge3awQ3AIAxD0VAMYf+F0yUixbL8JshXuLSwIqJCwDc9QBeZEOy9p2doAQDTM7TQ2cg5Z3qGFjpHS2YjDiGDe+/0DC0cwkYpJKdnaIFMkY1kymzEIVQcwsYhbPDem56hhc5GHELGIWwcwsYhbJS+2R1CxSFsdH5iO4SMr97Y6FxPqxytVVV+HcTEIWx+9mcIqHSOm9QAAAAASUVORK5CYII=";d();var C5=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,c=new Ze;c.moveTo(n*Math.cos(r/2)-i,n*Math.sin(r/2));for(let s=0;s<a;s++)c.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++)c.lineTo(e*Math.cos(Math.PI/-2+Math.PI/a*s),e*Math.sin(Math.PI/-2+Math.PI/a*s));return new qe(c,{depth:.1,bevelEnabled:!1,UVGenerator:gT(t)})},"createSectorGeometry"),n1=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"),gT=l(r=>({generateTopUV:(t,e,i,n,o)=>{let a=e[i*3],c=e[i*3+1],s=e[n*3],p=e[n*3+1],f=e[o*3],m=e[o*3+1];return[n1(a,c,r),n1(s,p,r),n1(f,m,r)]},generateSideWallUV:()=>[new U(0,1),new U(0,1),new U(0,1),new U(0,1)]}),"radialUVGenerator");var o1="#2266ff",vT=.7,bT=.3;function x5(){let r=new Tn({color:o1,opacity:vT,transparent:!0,depthTest:!1,depthWrite:!1}),t=C5(Math.PI/6,M5,P5);new In().load(b5,i=>{r.alphaMap=i,r.needsUpdate=!0});let e=new Ft(t,r);return e.position.z=-.05,e.renderOrder=3,e}l(x5,"createBearingCone");var S5=l(()=>{let r=new ep(.5,.5,.05,32),t=new Tn({transparent:!0,color:o1,opacity:bT,depthTest:!1,depthWrite:!1}),e=new Ft(r,t);e.scale.set(0,0,.05),e.renderOrder=2;let i=new ep(a1,a1,.05,32),n=new Tn({transparent:!0,color:o1,depthTest:!1,depthWrite:!1}),o=new Ft(i,n);return o.renderOrder=3,e.rotation.x=Math.PI/2,o.rotation.x=Math.PI/2,{baseMesh:e,middleMesh:o}},"createBlueDot");d();d();d();var CT=l(function(){let t=globalThis.fetch;return{fetch(...e){if(!da(t))throw new Error("fetch is not available in your environment. Pass your own function into `setFetchFn` (node-fetch, etc)");return t==null?void 0:t(...e)},setFetch(e){t=e}}},"createFetchControl")(),w5=CT.fetch;var E5=["websdk","web","webv2","kiosk-v2","mobile","iossdk","androidsdk","reactnativesdk"],xT=E5[0],ST="https://api-gateway.mappedin.com/track-analytics/a/",bn,Rr,zs,l1,c1=class c1{constructor(){P(this,zs);P(this,bn,Object.freeze({}));P(this,Rr,void 0);v(this,"sendGetDirectionsEvent",lr((t,e)=>this.sendAnalyticEvent("query-directions",{start:t,end:e,type:"location_to_location"}),2500));E(this,Rr,X(this,zs,l1).call(this,u(this,bn)))}init(t={}){this.reset(),this.updateStateWithOptions(t)}reset(){this.updateStateWithOptions({})}updateStateWithOptions(t={}){return E(this,bn,Object.freeze(Object.assign({},u(this,bn),t))),E(this,Rr,X(this,zs,l1).call(this,t)),u(this,Rr)}updateState(t){let i={...{...t}};i.mapId&&(i.baseUrl=T5({...u(this,Rr),mapId:i.mapId})),i.context&&(i.context=I5(i.context)),Object.assign(u(this,Rr),i)}get authReady(){let{key:t,secret:e,accessToken:i}=this.getState();return!!(t&&e)||!!i}getState(){return u(this,Rr)}getContext(){return this.getState().context||u(this,bn).context}sendAnalyticEvent(t,e={}){let i=this.getState(),n={...e,g:i.geolocationMode};i.userPosition&&(n={...n,...i.userPosition});let o=wT(i.baseUrl,t,n);if(i.logEvents&&B.log("Analytics.track",o),!i.sendEvents)return Promise.resolve();let a={"mi-context":this.getContext(),"mi-session":i.mi_session,"mi-device":i.mi_uuid,"mappedin-sdk-version":i.version,"mappedin-platform-version":i.platformString};return i.accessToken?a.Authorization=`Bearer ${i.accessToken}`:i.noAuth||i.secret&&i.key&&(a["x-mappedin-key"]=btoa(i.key),a["x-mappedin-secret"]=btoa(i.secret)),w5(o,{method:"GET",mode:"cors",headers:a})}capture(t,e){if(IT.includes(t))return B.warn(`${t} event is sent internally.`),Promise.resolve();let i=TT.includes(t)?t.slice(1):t;return this.sendAnalyticEvent(i,e)}sendGetMapDataEvent(t){return this.sendAnalyticEvent("load-mapdata",t)}sendWatchPositionDenied(){return this.sendAnalyticEvent("watch-position-denied")}sendMapViewLoadedEvent({firstRenderDuration:t,dimension:e}){return this.sendAnalyticEvent("load-mapview",{firstRenderDuration:t,url:window.location.href,width:e.width,height:e.height,devicePixelRatio:window.devicePixelRatio})}};bn=new WeakMap,Rr=new WeakMap,zs=new WeakSet,l1=l(function(t){var e,i,n;return{baseUrl:T5(t),version:((e=b==null?void 0:b.env)==null?void 0:e.npm_package_version)||"v6",mi_uuid:PT(),accessToken:t.accessToken,mapId:t.mapId,mi_session:MT(),platformString:t.platformString||"",context:I5(t.context)||xT,geolocationMode:!1,sendEvents:(i=t.sendEvents)!=null?i:!1,logEvents:(n=t.logEvents)!=null?n:!1,noAuth:t.noAuth||!1,key:t.key,secret:t.secret}},"#getStateWithOption"),l(c1,"CustomerAnalytics");var s1=c1;function T5(r){return`${ST}${r.mapId}/`}l(T5,"getBaseUrl");function PT(){return io.getInstance().loadLocalData("deviceId")}l(PT,"getDeviceID");function MT(){return io.getInstance().loadSessionData("id")}l(MT,"getSessionID");function wT(r,t,e){let i=new URLSearchParams;for(let[n,o]of Object.entries(e))o!=null&&i.append(n,o);return r+t+"?"+i.toString()}l(wT,"buildUrl");function I5(r){return E5.find(t=>t===r)}l(I5,"getValidContext");var TT=["$select-location","$select-category","$query-suggest","$query-search"],IT=["load-mapview","load-mapdata","query-directions","watch-position-denied"],se=new s1,L5={init(...r){return se.init(...r)},capture(...r){return se.capture(...r)},updateState(r){return se.updateState(r)}};var ET={enableHighAccuracy:!0},LT=500,DT=150,_T=150,OT=0,AT=5,kT=5,NT=30,P5=.4,M5=1.25,a1=.35,u1=class u1 extends z{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}=S5(),o=x5();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,ET)}updateGeometryPerFrame=e=>{var s;let[i,n,o]=e.children,{accuracy:a,heading:c}=((s=this.currentGeolocation)==null?void 0:s.coords)||{};a!=null&&(this.scaleAnimation&&this.scaleAnimation.stop(),this.scaleAnimation=new $u.default.Tween({scale:i.scale.x}).to({scale:me(a,kT,NT,OT,AT)},DT).onUpdate(({scale:p})=>{i.scale.set(p,1,p)}).start()),c!=null?(o.visible=!0,this.rotationAnimation&&this.rotationAnimation.stop(),this.rotationAnimation=new $u.default.Tween({rotation:i.scale.x}).to({rotation:ot.degToRad(c)},_T).onUpdate(({rotation:p})=>{o.rotation.z=p}).start()):o.visible=!1};onPositionUpdate=e=>{var i;if(this.currentGeolocation=e,se.updateState({userPosition:{bluedotTimestamp:Date.now(),latitude:e.coords.latitude,longitude:e.coords.longitude,floorLevel:e.coords.floorLevel,accuracy:e.coords.accuracy}}),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 $u.default.Tween(n.position).to([e.coords.longitude,e.coords.latitude],LT).onUpdate(a=>{if(this.geometry){let c={position:a};if(o==null&&n.parent!=="outdoors-container")c.parent="outdoors-container";else if(o!=null&&n.parent!==o){let s=o!=null?o:"outdoors-container";c.parent=s,this.publish("floor-change",{reason:"blue-dot-floor-change",floorId:s})}this.core.setState(this.geometry,c)}}).start(),this.core.render()}};onPositionError=e=>{switch(e.code){case e.PERMISSION_DENIED:B.error("Geolocation permission denied by the user.",e),se.sendWatchPositionDenied();break;case e.POSITION_UNAVAILABLE:B.error("Geolocation position unavailable.",e);break;case e.TIMEOUT:B.error("Geolocation request timed out.",e);break;default:B.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(u1,"BlueDot");var Ju=u1;d();var Br,qs,p1=class p1{constructor({currentMapGetter:t}){P(this,Br,new Map);P(this,qs,void 0);E(this,qs,t)}get currentMap(){return u(this,qs).call(this)}getById(t){return u(this,Br).get(t)}add(t,e,i){let n=this.currentMap;if(!n)throw new Error("currentMap should exist");let o=n.Shapes.add(t,e||{},{floorId:i==null?void 0:i.id}),a=new ka(o);return u(this,Br).set(a.id,a),a}remove(t){var i;u(this,Br).get(t.id)&&((i=this.currentMap)==null||i.Shapes.remove(t),u(this,Br).delete(t.id.toString()))}removeAll(){let t=[];return u(this,Br).forEach(e=>{this.remove(e),t.push(e.id),u(this,Br).delete(e.id.toString())}),t}};Br=new WeakMap,qs=new WeakMap,l(p1,"Shapes");var Zs=p1;d();var Js,h1=class h1{constructor({currentMapGetter:t}){P(this,Js,void 0);E(this,Js,t)}get currentMap(){return u(this,Js).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 c=a.layers.get(o);(i=this.currentMap)==null||i.renderer.setState(c,{color:t[o].color})}if(o===yc&&!(Oi in t)){let c=a.layers.get(Oi);c&&"color"in t[o]&&((n=this.currentMap)==null||n.renderer.setState(c,{color:t[o].color}))}}}};Js=new WeakMap,l(h1,"Style");var $s=h1;d();var mr,Ks,d1=class d1{constructor(t,e){P(this,mr,void 0);P(this,Ks,void 0);E(this,mr,t),E(this,Ks,e||[])}setStyle(t){var e,i;if(u(this,mr).map){(e=u(this,mr).map)==null||e.setStyle(t),(i=u(this,mr).map)==null||i.moveLayer(Za);for(let[n,o]of u(this,Ks)||[])u(this,mr).hideOutdoorLayersUnderPoint(n,o)}}get map(){return u(this,mr).map}get enabled(){return!!u(this,mr).map}};mr=new WeakMap,Ks=new WeakMap,l(d1,"Outdoor");var ko=d1;var Ku=.05,f1=class f1{core;outdoors;mapObjects=[];id;mapDataExternal={};mapsByFloorId={};mapData;currentMap;directions;hiddenOutdoorGeometries=[];mapView;Camera;Labels;Markers;Models;Paths;Exporter;Navigation;Outdoor;BlueDot;Shapes;Style;constructor(t,e){this.core=t,this.mapView=e,this.Camera=new Fa(this.core),this.id=this.core.addGroupContainer("root").id.toString(),this.outdoors=new Vs("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 Aa(this.Camera);this.core.on("camera-change",()=>{this.mapView.publish("camera-change",i)});let n=l(c=>s=>{var g,C,I;let p=[],f=[],m=[];s.labels.forEach(T=>{let w=this.Labels.getById(T.toString());w&&p.push(w.label)}),s.markers.forEach(T=>{let w=this.Markers.getById(T.toString());w&&f.push(w.marker)}),s.models.forEach(T=>{let w=this.Models.getById(T.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((T,w)=>{var _;let L=(_=this.getMapDataInternal())==null?void 0:_.getById("floor",w);return L&&Qr.is(L)&&T.push(L),T},[]),M={coordinate:new et(s.coordinate[1],s.coordinate[0],(I=S==null?void 0:S[0])==null?void 0:I.id),spaces:x&&de.is(x)?[x]:[],objects:x&&fe.is(x)?[x]:[],markers:f,labels:p,models:m,floors:S};"pointerEvent"in s&&(M.pointerEvent=s.pointerEvent),this.mapView.publish(c,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 Hs({currentMapGetter:o}),this.Models=new js({currentMapGetter:o}),this.Labels=new Wa({currentMapGetter:o}),this.Exporter=new ja({currentMapGetter:o}),this.Paths=new Ys({currentMapGetter:o}),this.Navigation=new bc(e),this.BlueDot=new Ju(this.core,this),this.BlueDot.on("floor-change",c=>{this.setFloor(c.floorId,"blue-dot-floor-change")}),this.Outdoor=new ko(this.core,this.hiddenOutdoorGeometries),this.Shapes=new Zs({currentMapGetter:o}),this.Style=new $s({currentMapGetter:o});let a=new wc(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(yc),c=o.layers.get(Oi);a&&((s=this.core.getState(a))==null||s.children.forEach(f=>{this.core.setState(f.id,e)})),c&&((p=this.core.getState(c))==null||p.children.forEach(f=>{this.core.setState(f.id,e)}))});return}let i=typeof t=="string"?this.getMapDataObject(t):t;if(i){if(oi.is(i))return this.core.setState(i.id,W3({...e,type:"label"},this.core.getState(i.id)));if(Ui.is(i))return this.core.setState(i.id,Y3({...e,type:"marker"},this.core.getState(i.id)));(de.is(i)||fe.is(i))&&this.core.setState(i.id,U3({...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 ul.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=ul.get(t);if(!n){B.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 et(a[1],a[0])});let c=q3(o["styles.json"]||{}),s=o["manifest.geojson"].features[0].properties.name,p=new Vs(`mapObject-${s}`,o,c,e,this.core),f=this.core.getBoundingArea(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 Rc({nodes:this.currentMap.mvf["node.geojson"],obstructions:this.currentMap.mvf.obstruction,connections:this.currentMap.mvf["connection.json"],groupBy:"map"}),(e==null?void 0:e.zoomLevel)!=null?(this.core.camera.setZoomLevel(e.zoomLevel),i(t)):this.core.mode!=="outdoors-overlay"?this.core.camera.focusOn(this.core.getBoundingArea(p.currentFloor.id),{duration:g3,padding:{top:Ku*this.core.canvasHeight,left:Ku*this.core.canvasWidth,right:Ku*this.core.canvasWidth,bottom:Ku*this.core.canvasHeight}}).then(()=>{i(t)}):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)}updateWatermark(t){this.core.updateWatermark(t)}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 et(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||{},c=Array.isArray(t)?t:[t],s=Array.isArray(e)?e:[e];se.sendGetDirectionsEvent(c[0].id,s[0].id);let p=typeof a=="object"?a.enabled:a,f=typeof a=="object"?a.radius:void 0,m=(i==null?void 0:i.zones)||[],y={accessible:o,zones:m,smoothing:{enabled:p!=null?p:!0,radius:f!=null?f:.75}};return this.directions.getDirections(c,s,y,n)};createCoordinate(t,e,i){return new et(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 et(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.Navigation.clear(),this.BlueDot.disable(),this.Shapes.removeAll(),this.Paths.removeAll(),this.Models.removeAll(),this.Markers.removeAll(),this.Labels.removeAll(),this.core.destroy()}};l(f1,"GeoJsonApi");var Qs=f1;var el,Q,m1=class m1 extends z{constructor(e){super();P(this,el,{});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,"Shapes");v(this,"Outdoor");v(this,"update",()=>{u(this,Q).core.render()});v(this,"getDirections",(e,i,n)=>u(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 Qs(e,this);E(this,Q,i),this.Camera=u(this,Q).Camera,E(this,el,u(this,Q).mapDataExternal),this.Markers=u(this,Q).Markers,this.Models=u(this,Q).Models,this.Labels=u(this,Q).Labels,this.Exporter=u(this,Q).Exporter,this.Paths=u(this,Q).Paths,this.Navigation=u(this,Q).Navigation,this.BlueDot=u(this,Q).BlueDot,this.Shapes=u(this,Q).Shapes,this.Style=u(this,Q).Style,this.auto=u(this,Q).auto,this.Outdoor=u(this,Q).Outdoor}updateState(e,i){return u(this,Q).updateState(e,i)}getMapData(){return u(this,el)}getDimensions(){return{width:this.__core.canvasWidth,height:this.__core.canvasHeight}}expand(e){return u(this,Q).expand(e)}collapse(){return u(this,Q).collapse()}addMap(e,i){return u(this,Q).addMap(e,i)}setFloor(e){u(this,Q).setFloor(e)}get currentFloor(){return u(this,Q).currentFloor}updateWatermark(e){u(this,Q).updateWatermark(e)}getState(e){return u(this,Q).getState(e)}setHoverColor(e){u(this,Q).setHoverColor(e)}getHoverColor(){return u(this,Q).getHoverColor()}isInView(e){return u(this,Q).isInView(e)}createCoordinate(e,i,n){return u(this,Q).createCoordinate(e,i,n)}createCoordinateFromScreenCoordinate(e,i,n){return u(this,Q).createCoordinateFromScreenCoordinate(e,i,n)}auto(){this.Labels.all()}get __core(){return u(this,Q).core}destroy(){u(this,Q).destroy()}async enableDebug(){let{Inspector:e}=await import("./inspector-HU2N2RIA.js");await new e(this,u(this,Q)).enable()}};el=new WeakMap,Q=new WeakMap,l(m1,"MapView");var tl=m1;d();var y1=class y1 extends z{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 Bs(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=>{B.warn(n)});let e=cl.fromLngLat(this.origin,0),i=Wc(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(ot.degToRad(-t.getBearing())),this.core.getSystems().cameraSystem.setTilt(ot.degToRad(t.getPitch()))}),this.el}onRemove(){}};l(y1,"MapLibreOverlay");var Qu=y1;var kJ=l(async(r,t)=>{let e;try{if(t){let{access_token:o}=await hl(t);e=o}}catch(o){B.warn("Getting access token failed. Outdoor map disabled.",o)}let i=new ro(r,e);return new pl(i)},"hydrateMapDataFromMVF");function RT(r,t,e){return fetch(r,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({grant_type:"client_credentials",client_id:t,client_secret:e})})}l(RT,"fetchOutdoorViewToken");var BT=l(async r=>{let t={emitAnalyticsEvents:!0,...r},e;if("accessToken"in t)e=t.accessToken;else if("key"in t&&"secret"in t){let p=await RT("https://auth.mappedin.com/oauth2/token",t.key,t.secret),{access_token:f}=await p.json();e=f}else throw new Error("No outdoor view token provided and key and secret missing.");let i={...t,venue:t.mapId,clientId:t.key,clientSecret:t.secret,version:"1.0.0"},n=await $1(i),o=await fl(n),a=dl(o);typeof r.onMVFParsed=="function"&&r.onMVFParsed(a);let c=new ro(a,e);return new pl(c)},"getMapDataEnterprise"),D5=!1;function NJ(r){D5=r}l(NJ,"setUseEnterpriseAPI");var RJ=l(async r=>{if(D5)return BT(r);let t={emitAnalyticsEvents:!1,...r},e;if("accessToken"in t)e=t.accessToken;else{let{access_token:m}=await hl(t);e=m}se.authReady||se.updateState({accessToken:e});let i=performance.now(),n=await op(t,e),o=performance.now(),a=await fl(n),c=dl(a),s=performance.now();typeof r.onMVFParsed=="function"&&r.onMVFParsed(c);let p=new ro(c,e),f=new pl(p);return se.sendGetMapDataEvent({parseDuration:(s-o).toFixed(2),downloadDuration:(o-i).toFixed(2),viewId:t.viewId}),f},"getMapData"),Cn,No,tp=class tp extends Qu{constructor(e,i,n){super(e);P(this,Cn,void 0);P(this,No,void 0);E(this,Cn,i),E(this,No,n)}onAdd(e){var o,a;super.onAdd(e);let i={...fa,...(o=u(this,No))!=null?o:{},outdoorView:{token:u(this,Cn).outdoorViewToken,...(a=u(this,No))==null?void 0:a.outdoorView}},n=new tl(this.core);return n.addMap(u(this,Cn),i).then(()=>{this.publish("loaded",{mapView:n,mapData:u(this,Cn)})}),this.el}};Cn=new WeakMap,No=new WeakMap,l(tp,"MappedinMapLibreOverlay"),v(tp,"instance");var rl=tp,BJ=l((r,t)=>{rl.instance!=null&&B.warn("Only a single map venue is supported at this time.");let e=new rl([r.mapCenter.longitude,r.mapCenter.latitude],r,t);return rl.instance=e,e},"createMapLibreOverlay"),FT=l(async(r,t,e)=>{var c,s,p,f,m;let i=performance.now(),n=ld(e,t);try{e&&sd(e)}catch(y){if(y instanceof Error&&y.name==="MissingOutdoorViewToken")B.error("Enable outdoor view requires a token. Provide token in `options.outdoorView.token`");else throw y}let o=await v5(r,{center:[t.mapCenter.longitude,t.mapCenter.latitude],bearing:n.bearing,pitch:n.pitch,zoomLevel:n.zoomLevel,outdoorView:(c=n.outdoorView)!=null&&c.token?{headers:{"x-mappedin-tiles-key":(s=n.outdoorView)==null?void 0:s.token},style:(p=n.outdoorView)==null?void 0:p.style,enabled:!!((f=n.outdoorView)!=null&&f.enabled)}:void 0,watermark:n.watermark,attribution:n.attribution,antialias:typeof n.antialiasing=="boolean"?n.antialiasing:!!((m=n.antialiasing)!=null&&m.enabled)}),a=new tl(o);return await a.addMap(t,n),se.sendMapViewLoadedEvent({firstRenderDuration:(performance.now()-i).toFixed(2),dimension:a.getDimensions()}),a},"show3dMapGeojson"),FJ=FT;export{j1 as a,G5 as b,dl as c,fl as d,et as e,mc as f,Jr as g,de as h,Qr as i,ei as j,fe as k,gc as l,ti as m,Un as n,eb as o,uT as p,se as q,L5 as r,kJ as s,BT as t,NJ as u,RJ as v,BJ as w,FT as x,FJ as y};
950
+ }`;var p5="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 aT=new In;function h5(r,t){let{nearRadius:e,farRadius:i,color:n,accentColor:o,completeFraction:a}=t,c=!0,s=0,p=1/0,f=t.displayArrowsOnPath,m=!0,y=!0,x=f,M=e/2+.15,g=0;r[0].z+=M;for(let it=1;it<r.length;++it){r[it].z+=M;let Mt=r[it].x-r[it-1].x,xt=r[it].y-r[it-1].y,be=r[it].z-r[it-1].z;g+=Math.sqrt(Mt*Mt+xt*xt+be*be)}let C=M-.1;r.push(r[r.length-1].clone().setZ(C)),r.unshift(r[0].clone().setZ(C));let I=new P1;x&&(I=aT.load(p5),I.colorSpace=Si);let T=new It(n),w=new It(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:c?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}},_=new N1(r);_.curveType="catmullrom",_.tension=0;let R=30,G=8,N=R*r.length,j=new B1(_,N,e,G,!1),H=new Float32Array(j.attributes.position.count);for(let it=r.length;it<H.length;it++)H[it]=it;j.setAttribute("vertexIndex",new Ho(H,1));let J=new Float32Array(j.attributes.position.count),ut=new Ho(J,1);for(let it=0;it<=N;it++)for(let Mt=0;Mt<=G;++Mt)ut.setX(it*(G+1)+Mt,it/N);j.setAttribute("pathDistance",ut);let yt=new Float32Array(j.attributes.normal.count*3),Ct=new Ho(yt,3);for(let it=0;it<N;it++){let Mt=j.tangents[it];for(let xt=0;xt<=G;++xt)Ct.setXYZ(it*(G+1)+xt,Mt.x,Mt.y,Mt.z)}j.setAttribute("pathTangent",Ct);let Bt=new Float32Array(j.attributes.normal.count*3),De=new Ho(Bt,3);for(let it=0;it<N;it++){let Mt=j.tangents[it];var gt,kt,Pt;gt=-Mt.x*Mt.z,kt=-Mt.y*Mt.z,Pt=1-Mt.z*Mt.z;let xt=Math.sqrt(gt*gt+kt*kt+Pt*Pt);xt===0&&(xt=1);let be=gt/xt,Sn=kt/xt,Ro=Pt/xt;for(let Ci=0;Ci<=G;++Ci)De.setXYZ(it*(G+1)+Ci,be,Sn,Ro)}j.setAttribute("pathNormal",De);let le=new Xo({uniforms:L,vertexShader:jm,fragmentShader:Wm});le.transparent=!0,le.alphaTest=.5,L.resolution.value.x=1,L.resolution.value.y=1,L.vertexes.value=H.length,L.arrowTexture.value.wrapS=ze,L.arrowTexture.value.wrapT=ze,L.arrowTexture.value.anisotropy=16,L.complete.value=a;let Fr=new Ft(j,le),ce=Fr.clone(),ue={...L,opacityMultiplier:{type:"f",value:.25}};ue.complete.value=1,ce.material=new Xo({uniforms:ue,vertexShader:jm,fragmentShader:Wm}),ce.material.transparent=!0,ce.material.alphaTest=.5,ce.material.depthWrite=!1,ce.material.depthTest=!1,ce.renderOrder=1,ue.resolution.value.x=1,ue.resolution.value.y=1,ue.vertexes.value=H.length,ue.arrowTexture.value.wrapS=ze,ue.arrowTexture.value.wrapT=ze,ue.arrowTexture.value.anisotropy=16,ue.complete.value=a;let bi=t.mesh;bi.add(Fr),bi.add(ce),j.computeBoundingBox();let xn=new Y;return j.boundingBox.getCenter(xn),{mesh:bi,material:le,center:xn}}l(h5,"buildPath");var Ym=class Ym extends z{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 c=n.components[0];if(c.dirty){c.mesh.parent!=null&&c.mesh.children.forEach(y=>{Te(y)});let s=c.feature.features.map(y=>y.geometry.coordinates).map(y=>this.convertTo3DMapPosition(y[1],y[0],y[2]||0)),{mesh:p,material:f,center:m}=h5(s,c);c.mesh=p,c.material=f,c.dirty=!1,c.position=m}c.material&&(c.material.uniforms.nearZoom.value=t,c.material.uniforms.farZoom.value=e,c.material.uniforms.cameraParameters.value.x=i,c.displayArrowsOnPath&&c.animateArrowsOnPath&&(c.material.uniforms.arrowAnimationTimer.value=performance.now()/1e3,o=!0),c.material.needsUpdate=!0)}o&&this.publish("animate:path")}};l(Ym,"PathSystem");var Ts=Ym;var d5=new $e,qm=18,sT=12,lT=22,$m=0,Jm=0;var cT=ot.radToDeg(.698132),ae,wt,Is,Lo,vi,mn,Do,Es,zm,O,ct,Ye,bt,dr,Le,D,Ls,St,mt,Wu,f5,Yu,m5,Uu,y5,yn,Ds,_s,_o,zu,Os,As,ks,Oo,ve,We,Ns,Zm,gn,Rs,ee,re,Km=class Km extends z{constructor(e,i={}){var y,x,S,M,g,C,I,T,w,L;super();P(this,Es);P(this,Wu);P(this,Yu);P(this,Uu);P(this,ve);P(this,Ns);v(this,"options");v(this,"container");P(this,ae,void 0);P(this,wt,void 0);P(this,Is,void 0);P(this,Lo,void 0);P(this,vi,void 0);P(this,mn,void 0);P(this,Do,void 0);v(this,"rendererDomElement");P(this,O,{entity3DMap:new Map,entity2DMap:new Map,entity2DIds:new Set,threeDEntities:[],entityScene:new Tt("__scene"),hoverColor:"red",insetsPadding:fu,shouldMeasureCanvas:!0,pixelRatio:pi(),canvasWidth:0,canvasHeight:0});v(this,"camera");P(this,ct,void 0);P(this,Ye,void 0);P(this,bt,void 0);P(this,dr,void 0);P(this,Le,void 0);P(this,D,{});P(this,Ls,window.matchMedia("screen and (min-resolution: 2dppx)"));v(this,"map");P(this,St,l(()=>{u(this,D).renderSystem.twoDdirty=!0},"#invalidate2DEntities"));P(this,mt,l(()=>{u(this,D).renderSystem.threeDdirty=!0},"#invalidate3DEntities"));P(this,yn,"standalone");P(this,Ds,l(e=>Math.trunc(e*10)/10,"#round10"));P(this,_s,l(()=>{u(this,D).twoDDrawSystem.dirty=!0,X(this,Es,zm).call(this,pi()),u(this,D).watermarkSystem.dirty=!0,this.render()},"#handlePixelRatioChange"));P(this,_o,l(()=>{u(this,O).canvasWidth=this.rendererDomElement.clientWidth,u(this,O).canvasHeight=this.rendererDomElement.clientHeight,X(this,Es,zm).call(this,pi()),u(this,Oo).call(this),X(this,Uu,y5).call(this),u(this,D).cameraSystem.resize(this.canvasWidth,this.canvasHeight),u(this,D).cameraSystem.dirty=!0,u(this,D).watermarkSystem.resize(this.canvasWidth,this.canvasHeight),u(this,D).htmlControlsSystem.resize(this.canvasWidth),u(this,D).geometryInFocusSystem.resize(),this.render()},"#handleWindowResize"));P(this,zu,l(()=>{this.renderSync()},"#renderFull"));P(this,Os,new Y);P(this,As,l((e,i)=>{let n=this.mode==="standalone"?u(this,wt):this.viewCamera;if(u(this,wt).position.z+this.camera.elevation>i.z){u(this,Os).copy(i);let o=u(this,Os).project(n),a=(o.x+1)/2*this.canvasWidth-0/2,c=(-o.y+1)/2*this.canvasHeight-0/2,s=u(this,Ds).call(this,a),p=u(this,Ds).call(this,c);e.x=s,e.y=p}else e.x=-1e3,e.y=-1e3},"#project"));P(this,ks,l((e,i)=>{u(this,Le).setBufferSize(e,i),u(this,wt).aspect=e/i,u(this,wt).updateProjectionMatrix(),u(this,wt).updateMatrixWorld(!0),u(this,Lo).x=e,u(this,Lo).y=i},"#setBufferSize"));P(this,Oo,l(()=>{var a;let e=u(this,O).canvasWidth=this.rendererDomElement.clientWidth,i=u(this,O).canvasHeight=this.rendererDomElement.clientHeight,n=Math.floor(e*this.resolutionScale),o=Math.floor(i*this.resolutionScale);u(this,ks).call(this,n,o),(a=this.map)==null||a.resize(),u(this,O).shouldMeasureCanvas=!1},"#measureCanvas"));v(this,"showCollisionBoxes",()=>{u(this,D).collisionSystem.showCollisionBoxes(),this.render()});v(this,"hideCollisionBoxes",()=>{u(this,D).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);d5.setFromCamera(a,u(this,wt).clone());let c=(s=d5.intersectObject(u(this,vi),!1)[0])==null?void 0:s.point;return c!=null?this.convert3DMapPositionToCoordinate(c):void 0});v(this,"projectCoordinateToScreenXY",e=>{let i=this.convertTo3DMapPosition(e[1],e[0],e[2]||0),n=new U;return u(this,As).call(this,n,i),{x:n.x,y:n.y}});v(this,"convert3DMapPositionToCoordinate",e=>{var o,a,c,s;let{lat:i,lon:n}=Xc((a=(o=u(this,O).center)==null?void 0:o[1])!=null?a:0,(s=(c=u(this,O).center)==null?void 0:c[0])!=null?s:0,e.x,e.y);return[n,i]});v(this,"setBackgroundColor",(e,i)=>{u(this,Le).setBackgroundColor(e,i)});v(this,"hideOutdoorLayersUnderPoint",(e,i)=>{!this.map||(i==null?void 0:i.length)===0||(u(this,D).outdoorLayersSystem.hideLayersUnderPoint(e,i),this.render())});P(this,gn,new D1);P(this,Rs,new gr);v(this,"render",()=>{u(this,D).renderSystem!=null&&(this.map&&(this.mode==="outdoors-interleaved"||this.mode==="outdoors-overlay")?this.map.triggerRepaint():u(this,D).renderSystem.update())});v(this,"renderSync",()=>{u(this,D).renderSystem.update(!0)});P(this,ee,lr(()=>{this.publish("user-interaction-start",void 0)},0,!0));P(this,re,lr(()=>{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"&&(B.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",()=>u(this,D).interactionSystem.getCursor());v(this,"destroy",()=>{u(this,D).cameraSystem.off("user-dolly-start",u(this,ee)),u(this,D).cameraSystem.off("user-pan-start",u(this,ee)),u(this,D).cameraSystem.off("user-rotate-start",u(this,ee)),u(this,D).cameraSystem.off("user-zoom-start",u(this,ee)),u(this,D).cameraSystem.off("user-tilt-start",u(this,ee)),u(this,D).cameraSystem.off("user-pedestal-start",u(this,ee)),u(this,D).cameraSystem.off("user-dolly-end",u(this,re)),u(this,D).cameraSystem.off("user-pan-end",u(this,re)),u(this,D).cameraSystem.off("user-rotate-end",u(this,re)),u(this,D).cameraSystem.off("user-zoom-end",u(this,re)),u(this,D).cameraSystem.off("user-tilt-end",u(this,re)),u(this,D).cameraSystem.off("user-pedestal-end",u(this,re)),u(this,D).renderSystem.off("measure-canvas",u(this,Oo)),this.remove("__scene"),u(this,St).call(this),u(this,mt).call(this),this.renderSync(),u(this,D).renderSystem.destroy(),u(this,D).zoomInterpolationSystem.destroy(),u(this,D).renderSystem.destroy(),u(this,D).cameraSystem.off("change",this.render),u(this,D).pathSystem.off("animate:path",this.render),u(this,D).cameraSystem.dispose(),u(this,D).exporterSystem.destroy(),u(this,D).outdoorLayersSystem.destroy(),u(this,D).drawSystem.destroy(),window.removeEventListener("resize",u(this,_o),!1),u(this,Ls).removeEventListener("change",u(this,_s)),u(this,mn)&&u(this,mn).disconnect(),this._subscribers={},u(this,Le).destroy(),u(this,ae).traverse(e=>{Te(e),"dispose"in e&&typeof e.dispose=="function"&&e.dispose()}),E(this,ae,void 0),u(this,D).htmlControlsSystem.destroy(),u(this,D).collisionSystem.destroy(),u(this,D).domMutationSystem.destroy(),u(this,D).geometryInFocusSystem.destroy(),E(this,D,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(u(this,dr)),this.container.removeChild(u(this,ct)),E(this,Le,void 0)});this.convertTo3DMapPosition=this.convertTo3DMapPosition.bind(this),(i.mode==="outdoors-interleaved"||i.mode==="outdoors-overlay")&&i.map&&(E(this,yn,i.mode),this.map=i.map),u(this,O).entityScene.addEventListener("childadded",()=>{u(this,mt).call(this),u(this,St).call(this)}),u(this,O).entityScene.addEventListener("childremoved",()=>{u(this,mt).call(this),u(this,St).call(this)}),u(this,O).entity3DMap.set(u(this,O).entityScene.userData.entityId,u(this,O).entityScene),i.center&&(u(this,O).center=i.center?[...i.center]:[0,0]),this.options=i,this.container=e,X(this,Wu,f5).call(this),X(this,Yu,m5).call(this),u(this,D).htmlControlsSystem=new Gu(this.container),u(this,yn)!=="outdoors-overlay"&&u(this,D).htmlControlsSystem.addAttributionControl(this.options.attribution),window.MappedinDebug||(window.MappedinDebug={}),b.env.NODE_ENV==="test"&&(window.MappedinDebug.mapViewCoreInstance=this),E(this,Le,new Vc({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(),u(this,St).call(this),u(this,mt).call(this),this.render()},onWebGLRendererError:i.onWebGLRendererError,backgroundColor:i.backgroundColor||"#ffffff",backgroundAlpha:(x=i.backgroundAlpha)!=null?x:1})),E(this,ae,new al),u(this,ae).add(u(this,O).entityScene);let n=window.__THREE_DEVTOOLS__;b.env.NODE_ENV==="dev"&&typeof n<"u"&&(n.dispatchEvent(new CustomEvent("observe",{detail:u(this,ae)})),n.dispatchEvent(new CustomEvent("observe",{detail:u(this,Le)}))),E(this,wt,new L1(cT,this.aspect,50,1e5)),E(this,Is,new E1),u(this,wt).renderOrder=999;let o=new _e;o.add(u(this,wt)),E(this,Do,new _e),u(this,Do).add(o),u(this,ae).add(u(this,Do)),u(this,wt).updateProjectionMatrix(),u(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=u(this,Le).domElement(),E(this,Lo,new U);let a=new Mn(1e6,1e6),c=new Vr({color:0,visible:!1});E(this,vi,new Ft(a,c)),u(this,ae).add(u(this,vi)),(S=i.gl)!=null&&S.canvas||e.appendChild(this.rendererDomElement),window.addEventListener("resize",u(this,_o),!1),u(this,Ls).addEventListener("change",u(this,_s)),typeof ResizeObserver=="function"&&((M=b.env)==null?void 0:M.NODE_ENV)!=="test"&&(E(this,mn,new ResizeObserver(lr(()=>{u(this,_o).call(this)},0))),(g=u(this,mn))==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%",b.env.NODE_ENV==="test"&&this.rendererDomElement.setAttribute("data-testid","mappedin-canvas"),u(this,O).canvasWidth=this.rendererDomElement.clientWidth,u(this,O).canvasHeight=this.rendererDomElement.clientHeight,this.rendererDomElement.style.touchAction="manipulation";let s=this.canvasWidth,p=this.canvasHeight;u(this,D).watermarkSystem=new Bu(u(this,wt),s,p,u(this,O),i==null?void 0:i.watermark),u(this,D).watermarkSystem.on("texture-loaded",this.render),u(this,O).shouldMeasureCanvas=!0,u(this,O).pixelRatio=this.resolutionScale,u(this,ks).call(this,Math.floor(s*this.resolutionScale),Math.floor(p*this.resolutionScale));let f=new ll(16777215,.3*Math.PI);f.position.set(-150,-150,350),u(this,ae).add(f);let m=new G1(16777215,.741*Math.PI);u(this,ae).add(m),u(this,D).cameraSystem=new xs(u(this,wt),u(this,ae),u(this,Le).renderer,u(this,O),{mode:this.mode,canvasHeight:p,canvasWidth:s}),u(this,D).cameraSystem.on("user-dolly-start",u(this,ee)),u(this,D).cameraSystem.on("user-pan-start",u(this,ee)),u(this,D).cameraSystem.on("user-rotate-start",u(this,ee)),u(this,D).cameraSystem.on("user-zoom-start",u(this,ee)),u(this,D).cameraSystem.on("user-tilt-start",u(this,ee)),u(this,D).cameraSystem.on("user-pedestal-start",u(this,ee)),u(this,D).cameraSystem.on("user-dolly-end",u(this,re)),u(this,D).cameraSystem.on("user-pan-end",u(this,re)),u(this,D).cameraSystem.on("user-rotate-end",u(this,re)),u(this,D).cameraSystem.on("user-zoom-end",u(this,re)),u(this,D).cameraSystem.on("user-tilt-end",u(this,re)),u(this,D).cameraSystem.on("user-pedestal-end",u(this,re)),u(this,D).cameraSystem.on("change",()=>{this.publish("camera-change",this.camera),u(this,D).geometryInFocusSystem&&(u(this,D).geometryInFocusSystem.cameraDirty=!0),this.render()}),u(this,D).panBoundsSystem=new Fu(u(this,O),u(this,D).cameraSystem),u(this,D).pathSystem=new Ts(u(this,O),this.convertTo3DMapPosition),u(this,D).pathSystem.on("animate:path",this.render),this.camera=new Ru(this,u(this,D),u(this,O),u(this,vi)),this.camera.setZoomLevel((T=i.zoomLevel)!=null?T:qm),this.camera.setBearing((w=i.bearing)!=null?w:Jm),this.camera.setPitch((L=i.pitch)!=null?L:$m),this.camera.setMaxZoomLevel(lT),this.camera.setMinZoomLevel(sT),u(this,D).domVisiblitySystem=new Su(u(this,O),u(this,dr)),u(this,D).domMutationSystem=new Nu(u(this,O),u(this,dr)),u(this,D).domMutationSystem.on("dimensions-update",()=>{u(this,D).collisionSystem.dirty=!0,this.render()}),u(this,D).domDrawSystem=new Au(u(this,O)),u(this,D).collisionSystem=new Uc(u(this,Ye),u(this,O)),u(this,D).twoDDrawSystem=new Mu(u(this,O),u(this,bt)),u(this,D).interactionSystem=new Ja(this.rendererDomElement,u(this,O),u(this,wt),u(this,vi)),u(this,D).interactionSystem.on("hover",this.render),u(this,D).interactionSystem.on("click",_=>{var R,G,N,j,H;if(((R=_.entity2D)==null?void 0:R.id)==="watermark"&&typeof u(this,D).watermarkSystem.options.onClick=="function"){u(this,D).watermarkSystem.options.onClick();return}this.publish("click",{coordinate:this.convert3DMapPositionToCoordinate(_.position),geometry:_.entity3D?[(G=_.entity3D)==null?void 0:G.id]:[],markers:((N=_.entity2D)==null?void 0:N.components[0])instanceof Me?[_.entity2D.id]:[],models:((j=_.entity3D)==null?void 0:j.components[0])instanceof mi?[_.entity3D.id]:[],labels:((H=_.entity2D)==null?void 0:H.components[0])instanceof ur?[_.entity2D.id]:[],containers:Array.isArray(_.groupContainers)?_.groupContainers.map(J=>J.userData.entityId):[],pointerEvent:_.pointerEvent})}),u(this,D).interactionSystem.on("hover",_=>{var R,G,N,j,H;_.position&&((R=_.entity2D)==null?void 0:R.id)!=="watermark"&&this.publish("hover",{coordinate:this.convert3DMapPositionToCoordinate(_.position),geometry:_.entity3D?[(G=_.entity3D)==null?void 0:G.id]:[],markers:((N=_.entity2D)==null?void 0:N.components[0])instanceof Me?[_.entity2D.id]:[],models:((j=_.entity3D)==null?void 0:j.components[0])instanceof mi?[_.entity3D.id]:[],labels:((H=_.entity2D)==null?void 0:H.components[0])instanceof ur?[_.entity2D.id]:[],containers:Array.isArray(_.groupContainers)?_.groupContainers.map(J=>J.userData.entityId):[]})}),u(this,D).geometryInFocusSystem=new Xu(u(this,O),u(this,wt)),u(this,D).geometryInFocusSystem.on("geometry-in-focus",_=>{this.publish("geometry-in-focus",_)}),u(this,D).twoDVisiblitySystem=new Iu(u(this,O)),u(this,D).drawSystem=new Tu(u(this,O)),u(this,D).drawSystem.on("texture-loaded",this.render),u(this,D).stackSystem=new Du(u(this,O)),u(this,D).twoDProjectionSystem=new Pu(u(this,O),u(this,As)),u(this,D).zoomInterpolationSystem=new au,u(this,D).exporterSystem=new as(u(this,O)),u(this,D).meshOptimizationSystem=new xu(u(this,O),this.convertTo3DMapPosition),u(this,D).meshOptimizationSystem.on("model-loaded",this.render),u(this,D).customGeometrySystem=new Vu(u(this,O)),u(this,D).outlineInterpolationSystem=new Hu(u(this,O)),u(this,D).renderSystem=new Eu(u(this,Le),u(this,O),this.mode,u(this,ae),u(this,wt),this.viewCamera,u(this,D)),u(this,D).renderSystem.on("measure-canvas",u(this,Oo)),u(this,D).outdoorLayersSystem=new ju(this.map),u(this,zu).call(this)}get viewCamera(){return u(this,Is)}get canvasWidth(){return u(this,O).canvasWidth}get canvasHeight(){return u(this,O).canvasHeight}get resolutionScale(){var e,i;return(i=(e=this.map)==null?void 0:e.getPixelRatio())!=null?i:pi()}get aspect(){return this.canvasWidth/this.canvasHeight}get mode(){return u(this,yn)}addGroupContainer(e,i,n){var o;if(!u(this,O).entity3DMap.has(e)&&!u(this,O).entity2DMap.has(e)){let a=new Tt(e);a.addEventListener("childadded",()=>{u(this,mt).call(this),u(this,St).call(this)}),a.addEventListener("childremoved",()=>{u(this,mt).call(this),u(this,St).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&&ge(a,i.interactive,u(this,O)),u(this,O).entity3DMap.set(e,a),(o=X(this,ve,We).call(this,n))==null||o.addEntity(a),u(this,mt).call(this),this.render()}else B.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(u(this,O).entity3DMap.has(e))B.error(`Stack container with ID '${e}' already exists. The stack container cannot be added.`);else{let a=new Tt(e);a.addEventListener("childadded",()=>{u(this,mt).call(this),u(this,St).call(this)}),a.addEventListener("childremoved",()=>{u(this,mt).call(this),u(this,St).call(this)}),a.components[0]=new ku,(i==null?void 0:i.visible)!==void 0&&(a.visible=i.visible),u(this,O).entity3DMap.set(e,a),(o=X(this,ve,We).call(this,n))==null||o.addEntity(a)}return{id:e,type:"stack-container"}}addCustomGeometry(e,i,n,o,a){var c;if(u(this,O).entity3DMap.has(e))B.error(`Custom geometry with ID '${e}' already exists. The custom geometry cannot be added.`);else{let s=new Eo(i,n),p=new dt(s,new hi(o));p.id=e,s.mesh.userData={entityId:e,type:"custom-geometry"},u(this,O).entity3DMap.set(p.id,p),(c=X(this,ve,We).call(this,a))==null||c.addEntity(p),this.render()}return{id:e,type:"custom-geometry"}}addGeometryGroup(e,i,n,o){var a,c;if(!u(this,O).entity3DMap.has(e)&&!u(this,O).entity2DMap.has(e)){let s=new Vt(e,new Ki(n));s.addEventListener("childadded",()=>{u(this,mt).call(this),u(this,St).call(this)}),s.addEventListener("childremoved",()=>{u(this,mt).call(this),u(this,St).call(this)}),s.userData.dirty=!0,u(this,O).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||tt(),m=u(this,D).meshOptimizationSystem.createEntityFromFeature(f,p,n);u(this,O).entity3DMap.set(f,m),s.userData.entities3D.add(f)}s.setVisible((a=n==null?void 0:n.visible)!=null?a:!0),(c=X(this,ve,We).call(this,o))==null||c.addEntity(s),u(this,mt).call(this),this.render()}else B.error(`Geometry group with ID '${e}' already exists. The geometry group cannot be added.`);return u(this,D).outlineInterpolationSystem.dirty=!0,{id:e,type:"geometry-group"}}addModelGroup(e,i,n,o){var a;if(!u(this,O).entity3DMap.has(e)&&!u(this,O).entity2DMap.has(e)){let c=new Vt(e,new Ki(n));c.addEventListener("childadded",()=>{u(this,mt).call(this),u(this,St).call(this)}),c.addEventListener("childremoved",()=>{u(this,mt).call(this),u(this,St).call(this)}),u(this,O).entity3DMap.set(e,c),c.userData.dirty=!0,c.userData.modelURL=n.url;for(let s of i.features){let p=s.id||s.properties.id||tt(),f=u(this,D).meshOptimizationSystem.createModelFromFeature(p,s,n);s.properties.interactive!==void 0&&ge(f,s.properties.interactive,u(this,O)),u(this,O).entity3DMap.set(p,f),c.userData.entities3D.add(p)}(a=X(this,ve,We).call(this,o))==null||a.addEntity(c),u(this,mt).call(this),this.render()}else B.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 c;let a=n==null?void 0:n.id;if(a===void 0||!u(this,O).entity2DMap.has(a)&&!u(this,O).entity3DMap.has(a)){let s=X(this,Ns,Zm).call(this,e,new Me(i,n));s.id=a||String(s.id),a=s.id,(n==null?void 0:n.interactive)!=null&&ge(s,n==null?void 0:n.interactive,u(this,O)),(c=X(this,ve,We).call(this,o))==null||c.addEntity(s),this.render()}else B.error(`Marker2D with ID '${a}' already exists. The marker cannot be added.`);return{id:a,type:"marker"}}addLabel2D(e,i,n,o){var c;let a=n==null?void 0:n.id;if(a===void 0||!u(this,O).entity2DMap.has(a)&&!u(this,O).entity3DMap.has(a)){let s=X(this,Ns,Zm).call(this,e,new ur(i,n||{},u(this,O)));s.id=a||String(s.id),a=s.id,(n==null?void 0:n.interactive)!=null&&ge(s,n==null?void 0:n.interactive,u(this,O)),(c=X(this,ve,We).call(this,o))==null||c.addEntity(s),u(this,St).call(this),this.render()}else B.error(`Label2D with ID '${a}' already exists. The label cannot be added.`);return{id:a,type:"label"}}addPath(e,i={},n){var c;let o=new Lu(e,i),a=new dt(o,new hi);return a.id=(i==null?void 0:i.id)||tt(),o.mesh.userData={entityId:a.id,type:"path"},u(this,O).entity3DMap.set(a.id,a),(i==null?void 0:i.interactive)!=null&&ge(a,i==null?void 0:i.interactive,u(this,O)),(c=X(this,ve,We).call(this,n))==null||c.addEntity(a),u(this,mt).call(this),this.render(),{id:a.id,type:"path"}}updateWatermark(e){u(this,D).watermarkSystem.options=e,u(this,D).watermarkSystem.dirty=!0,this.render()}updateStackState(e,i){let n;(typeof e=="string"||typeof e=="number")&&(n=u(this,O).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=u(this,O).entity2DMap.get(e),i==null&&(i=u(this,O).entity3DMap.get(e))):typeof e.id=="string"||typeof e.id=="number"?(i=u(this,O).entity2DMap.get(e.id),i==null&&(i=u(this,O).entity3DMap.get(e.id))):i=e,i!=null){if(i.type==="custom-geometry")u(this,O).entity3DMap.delete(i.id),i.object3d&&Te(i.object3d);else if(i.type==="group-container"){u(this,O).entity3DMap.delete(i.userData.entityId);for(let o of i.childrenIds.values())this.remove(o),i.userData.entities2D.delete(o);Te(i)}else if(i.type==="geometry-group"){u(this,O).entity3DMap.delete(i.userData.entityId);for(let o of i.userData.entities3D.values())this.remove(o),i.userData.entities3D.delete(o);Te(i)}else if(i.type==="geometry"||i.type==="model"||i.type==="path"){let o=i.components[0];i.object3d&&(((n=i.parent)==null?void 0:n.type)==="geometry-group"&&i.parent.userData.entities3D.delete(i.id),Te(i.object3d)),o.outline&&Te(o.outline),"focusMesh"in o&&o.focusMesh!=null&&Te(o.focusMesh),u(this,O).entity3DMap.delete(i.id)}else(i.type==="marker"||i.type==="label")&&(i.object3d&&Te(i.object3d),i.type==="label"&&delete u(this,D).twoDDrawSystem.textCache[i.id],u(this,O).entity2DMap.delete(i.id));u(this,mt).call(this),u(this,St).call(this),this.render()}}getScene(){return this.getState("__scene")}getCurrentSceneGLTF(e){return u(this,D).exporterSystem.getCurrentSceneGLTF(e)}getBoundingArea(e){this.renderSync();let i=new yr;if(e==null)i.setFromObject(u(this,O).entityScene);else{let n=qa(u(this,O),e);if((n==null?void 0:n.type)==="geometry"&&(n==null?void 0:n.object3d)!=null){let o=n.components[0],a=o instanceof Rt?o.geometry:void 0;o.mesh instanceof wn&&a?(a.computeBoundingBox(),a.boundingBox&&i.union(a.boundingBox)):i.setFromObject(n.object3d)}else((n==null?void 0:n.type)==="geometry-group"||(n==null?void 0:n.type)==="group-container")&&(n==null?void 0:n.userData.entityId)!=null&&i.setFromObject(n)}if(pb(i))return bf(i).map(this.convert3DMapPositionToCoordinate)}getState(e){var n;if(e==null)return{type:"map-view",hoverColor:u(this,O).hoverColor};let i=qa(u(this,O),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 c of i.userData.entities3D.values()){let s=this.getState(c);((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(c=>u(this,O).entity3DMap.get(c)).every(c=>c&&c.components[2]!=null),children:Array.from(i.userData.entities3D.values()).map(c=>this.getState(c)).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,c=a==null?void 0:a.userData.entityId;return{id:i.id,type:"label",text:o.text||"",parent:{id:c,type:a==null?void 0:a.type},position:this.convert3DMapPositionToCoordinate(i.position),enabled:o.enabled,initialRank:$a(o.initialRank),options:{rank:$a(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,c=a==null?void 0:a.userData.entityId;return{id:i.id,type:"marker",enabled:o.enabled,parent:{id:c,type:a==null?void 0:a.type},position:this.convert3DMapPositionToCoordinate(i.position),element:o.containerEl,initialRank:$a(o.initialRank),options:{rank:$a(o.rank),interactive:i.components[1]!=null||!1}}}else if((i==null?void 0:i.type)==="geometry"){let{color:o,hoverColor:a,initialColor:c,topColor:s}=i.components[1],p=i.components[0],f=i.components[1];return{id:i.id,type:"geometry",color:o,focusable:p.focusable,topColor:s,initialColor:c,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],c=i.components[1];return{id:i.id,type:"path",position:this.convert3DMapPositionToCoordinate(o.position),visible:c.visible,interactive:a!=null,completeFraction:o.completeFraction}}else return}}setState(e,i){var o,a,c;if(typeof e=="object"&&"hoverColor"in e&&i==null){u(this,O).hoverColor=(o=e.hoverColor)!=null?o:u(this,O).hoverColor;return}let n=qa(u(this,O),e);if(n!=null){if(n.type==="custom-geometry"){let s=u(this,O).entity3DMap.get(n.id);if(s instanceof dt&&s.components[0]instanceof Eo){let p=i;So(n,p.visible),Qf(n,p.altitude),Jf(n,p.position,this.convertTo3DMapPosition),Kf(n,X(this,ve,We).call(this,p.parent,!1))}}else if(n.type==="model"||n.type==="path"){let s=i;ge(n,s.interactive,u(this,O))&&u(this,mt).call(this),n.type==="path"&&(s=s,g4(n,s),So(n,s.visible))}else if(n.type==="group-container"){let s=i;So(n,s.visible)&&(u(this,D).outlineInterpolationSystem.dirty=!0),ge(n,s.interactive,u(this,O))&&u(this,mt).call(this),Qf(n,s.altitude)}else if(n.type==="geometry-group"){let s=i;So(n,s.visible)&&(u(this,D).outlineInterpolationSystem.dirty=!0),d4(n,u(this,O),s)&&(u(this,D).outlineInterpolationSystem.dirty=!0),tm(n,s.outline)&&(u(this,D).outlineInterpolationSystem.geometries3DDirty=!0),f4(n,s.shading),S4(n,u(this,O),s.opacity),ge(n,s.interactive,u(this,O))&&(u(this,mt).call(this),u(this,St).call(this))}else if(n.type==="geometry"){if(n.components[0]instanceof Rt){let s=i;So(n,s.visible)&&(u(this,D).outlineInterpolationSystem.geometries3DDirty=!0),tm(n,s.outline)&&(u(this,D).outlineInterpolationSystem.geometries3DDirty=!0),s.focusable!=null&&(n.components[0].focusable=s.focusable,u(this,D).geometryInFocusSystem.focusablesDirty=!0),m4(n,s),x4(n,s.hoverColor),ge(n,s.interactive,u(this,O))}u(this,mt).call(this)}else if(n.type==="label"||n.type==="marker"){let s=i;C4(n,i),v4(n,i)&&u(this,St).call(this),b4(n,(a=s.options)==null?void 0:a.rank)&&u(this,St).call(this),Jf(n,s.position,this.convertTo3DMapPosition),Kf(n,X(this,ve,We).call(this,s.parent,!1))&&(u(this,St).call(this),u(this,D).panBoundsSystem.dirty=!0),y4(n,s.enabled),ge(n,(c=s.options)==null?void 0:c.interactive,u(this,O))&&u(this,St).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:c}=jc((p=(s=u(this,O).center)==null?void 0:s[1])!=null?p:0,(m=(f=u(this,O).center)==null?void 0:f[0])!=null?m:0,e,i);return o?(o.set(a,c,n),o):new Y(a,c,n)}getCenter(e){let i=Array.isArray(e)?e:this.getBoundingArea(e);return i?ub(i):void 0}isInView(e){let i=qa(u(this,O),e);if(u(this,Rs).identity().multiply(u(this,wt).projectionMatrix).multiply(u(this,wt).matrixWorldInverse),u(this,gn).setFromProjectionMatrix(u(this,Rs)),i instanceof Pe)return u(this,gn).containsPoint(i.position);if(i instanceof dt){let n=i==null?void 0:i.components[0];if(n instanceof Eo||n instanceof mi)return u(this,gn).containsPoint(this.convertTo3DMapPosition(n.feature.geometry.coordinates));if(n instanceof Rt){let o=new yr(this.convertTo3DMapPosition(n.featureBbox[1],n.featureBbox[0],0),this.convertTo3DMapPosition(n.featureBbox[3],n.featureBbox[2],0));return u(this,gn).intersectsBox(o)}}return!1}getSystems(){return u(this,D)}getInternalState(){return u(this,O)}};ae=new WeakMap,wt=new WeakMap,Is=new WeakMap,Lo=new WeakMap,vi=new WeakMap,mn=new WeakMap,Do=new WeakMap,Es=new WeakSet,zm=l(function(e){var i;u(this,yn)!=="outdoors-overlay"&&((i=this.map)==null||i.setPixelRatio(e)),u(this,O).pixelRatio=this.resolutionScale},"#setResolutionScale"),O=new WeakMap,ct=new WeakMap,Ye=new WeakMap,bt=new WeakMap,dr=new WeakMap,Le=new WeakMap,D=new WeakMap,Ls=new WeakMap,St=new WeakMap,mt=new WeakMap,Wu=new WeakSet,f5=l(function(){E(this,ct,document.createElement("div")),u(this,ct).classList.add("mappedin__smart-collision-engine__container"),E(this,Ye,document.createElement("canvas")),u(this,Ye).classList.add("mappedin__smart-collision-engine-debug__container"),this.container.appendChild(u(this,ct)),E(this,bt,document.createElement("canvas")),u(this,bt).classList.add("mappedin__smart-collision-engine__container"),u(this,bt).width=u(this,ct).clientWidth*this.resolutionScale,u(this,bt).height=u(this,ct).clientHeight*this.resolutionScale,u(this,bt).style.width=u(this,ct).clientWidth+"px",u(this,bt).style.height=u(this,ct).clientHeight+"px",u(this,ct).appendChild(u(this,Ye)),u(this,ct).appendChild(u(this,bt)),u(this,Ye).width=u(this,ct).clientWidth,u(this,Ye).height=u(this,ct).clientHeight,u(this,bt).width=u(this,ct).clientWidth*this.resolutionScale,u(this,bt).height=u(this,ct).clientHeight*this.resolutionScale,u(this,bt).style.width=u(this,ct).clientWidth+"px",u(this,bt).style.height=u(this,ct).clientHeight+"px"},"#renderEntity2DContainer"),Yu=new WeakSet,m5=l(function(){E(this,dr,document.createElement("div")),u(this,dr).classList.add("mappedin-2d-entities"),Object.assign(u(this,dr).style,{position:"absolute",top:"0",left:"0",bottom:"0",right:"0",pointerEvents:"none","transform-style":"preserve-3d"}),this.container.appendChild(u(this,dr))},"#renderEntityDOMContainer"),Uu=new WeakSet,y5=l(function(){u(this,bt).width=u(this,ct).clientWidth*this.resolutionScale,u(this,bt).height=u(this,ct).clientHeight*this.resolutionScale,u(this,bt).style.width=u(this,ct).clientWidth+"px",u(this,bt).style.height=u(this,ct).clientHeight+"px",u(this,Ye).width=u(this,ct).clientWidth,u(this,Ye).height=u(this,ct).clientHeight,u(this,bt).width=u(this,ct).clientWidth*this.resolutionScale,u(this,bt).height=u(this,ct).clientHeight*this.resolutionScale,u(this,bt).style.width=u(this,ct).clientWidth+"px",u(this,bt).style.height=u(this,ct).clientHeight+"px",u(this,D).collisionSystem.dirty=!0},"#resizeCollisionCanvas"),yn=new WeakMap,Ds=new WeakMap,_s=new WeakMap,_o=new WeakMap,zu=new WeakMap,Os=new WeakMap,As=new WeakMap,ks=new WeakMap,Oo=new WeakMap,ve=new WeakSet,We=l(function(e,i=!0){if(!e)return i?u(this,O).entityScene:void 0;if(typeof e=="string"||typeof e=="number"){let n=u(this,O).entity3DMap.get(e);return n instanceof Tt?n:(B.warn("Parent is not a valid container, adding to scene"),i?u(this,O).entityScene:void 0)}else if(e.type==="group-container"){let n=u(this,O).entity3DMap.get(e.id);if(n instanceof Tt)return n}return i?u(this,O).entityScene:void 0},"#getParentContainer"),Ns=new WeakSet,Zm=l(function(e,i,n){let o=new Pe(i,this.convertTo3DMapPosition(e[1],e[0],e[2]||n||0));return u(this,O).entity2DMap.set(o.id,o),o},"#createEntity2D"),gn=new WeakMap,Rs=new WeakMap,ee=new WeakMap,re=new WeakMap,l(Km,"Core");var Um=Km,Bs=Um;d();function uT(r,t){pT(r,t)(r.getScene(),t),hT(r,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 c=window.URL.createObjectURL(o);a.href=c,a.download="scene.glb",a.click(),window.URL.revokeObjectURL(c)}},"export")}l(uT,"mountSceneGraphVisualizer");function pT(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 c={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?F(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(c,"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.getBoundingArea(s))}),a.add(c,"interactive"),n.type==="path"&&a.add(c,"completeFraction",0,1,.1),a.add(c,"visible"),n.type!=="model"&&(a.addColor(c,"color"),a.add(c,"outline"))}else if(n.type==="marker"){let c={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(c,"focus").onChange(()=>{let s=r.getState(n.id);(s==null?void 0:s.type)==="marker"&&r.camera.focusOn([s.position])}),a.add(c,"interactive")}else if(n.type==="label"){let c={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:c.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:c.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:c.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:c.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:c.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:c.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:c.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(c,"focus").onChange(()=>{let s=r.getState(n.id);(s==null?void 0:s.type)==="label"&&r.camera.focusOn([s.position])}),a.add(c,"interactive"),a.add(c,"text"),a.add(c,"Text Size",10,50),a.add(c,"Icon Size",10,50),a.addColor(c,"Text Color"),a.addColor(c,"Active Background Color"),a.addColor(c,"Inactive Background Color"),a.addColor(c,"Active Foreground Color"),a.addColor(c,"Inactive Foreground Color")}else if(n.type==="geometry-group"){let c={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(c,"visible"),a.add(c,"opacity",0,1,.1),a.add(c,"interactive"),a.add(c,"outline"),a.add(c,"shadingStart",0,1,.1),a.add(c,"shadingEnd",0,1,.1),a.add(c,"shadingIntensity",0,1,.1)}else if(n.type==="group-container"){let c={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(c,"visible"),a.add(c,"interactive")}if(a.close(),n.children)for(let c of n.children.values())i(c,a)},"parseChild")}l(pT,"createParseChild");function hT(r,t){let e=t.addFolder("Watermark"),i={padding:16,iconOnly:!1,position:"bottom-left",color:"dark",scale:1};e.add(i,"padding",0,100,1),e.add(i,"scale",.5,1.5,.1),e.add(i,"color",["dark","light"]),e.add(i,"position",["top-left","top-right","bottom-left","bottom-right","center","top","bottom","left","right"]),e.add(i,"iconOnly"),e.onChange(()=>{r.updateWatermark(i)})}l(hT,"createWatermarkChild");var g5="https://tiles-cdn.mappedin.com/styles/mappedin/style.json",dT="https://auth.mappedin.com/oauth2/token";async function v5(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:c,MercatorCoordinate:s}=await import("./outdoor-context-v4-DXPG5QBY.js"),p=t.outdoorView.headers;p==null&&(p=await lb(dT));let f=t.center||[0,0],m=new c({container:r,style:t.outdoorView.style||g5,center:f,attributionControl:!1,zoom:(n=t.zoomLevel)!=null?n:qm,pitch:(o=t.pitch)!=null?o:$m,bearing:(a=t.bearing)!=null?a:Jm,transformRequest:w=>{var L;return{url:w,headers:(L=t.outdoorView)==null?void 0:L.headers}},trackResize:!1,pixelRatio:pi(),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 Bs(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=Wc(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)===g5){B.error(`Failed to load outdoor view style, possibly due to invalid token "${p["x-mappedin-tiles-key"]}"`);return}B.warn(w)}),x}else return new Bs(r,t)}l(v5,"createRenderer");var Fs=Gr(po());var Zu=30,fT=1e3,Ao,Gs,Qm=class Qm extends z{constructor(e,i){super();this.api=e;this.core=i;P(this,Ao,void 0);P(this,Gs,0);v(this,"includedFloors",[]);v(this,"expanded",!1);i.on("camera-change",n=>{var c;let o=Math.floor(n.elevation/Zu),a=(c=this.includedFloors[o])==null?void 0:c.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 u(this,Gs)}set percentExpanded(e){let i=me(e,0,1,0,Zu);this.includedFloors.forEach((n,o)=>{this.core.setState(n.containerId,{visible:!0,altitude:i*o})}),E(this,Gs,e)}animateToCurrentFloor(){let e=this.includedFloors.indexOf(this.api.currentFloor)*Zu;new Fs.default.Tween({elevation:this.core.camera.elevation}).to({elevation:e},1e3).easing(Fs.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){u(this,Ao)&&u(this,Ao).stop();let i=this.includedFloors.indexOf(this.api.currentFloor)*Zu;return new Promise(n=>{E(this,Ao,new Fs.default.Tween({percentExpanded:this.percentExpanded}).to({percentExpanded:e==="expand"?1:"0"},fT).easing(Fs.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()})}};Ao=new WeakMap,Gs=new WeakMap,l(Qm,"StackedMaps");var qu=Qm;var mT={linear:vn.default.Easing.Linear.None,"ease-in":vn.default.Easing.Quadratic.In,"ease-out":vn.default.Easing.Quadratic.Out,"ease-in-out":vn.default.Easing.Quadratic.InOut},t1=class t1 extends z{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],c=this.renderer.addModelGroup(t,{type:"FeatureCollection",features:e.map(s=>{var p;return{type:"Feature",properties:{id:tt(),rotation:(p=s.rotation)==null?void 0:p.map(f=>f*(Math.PI/180)),scale:s.scale,interactive:s.interactive},geometry:{type:"Point",coordinates:li(s.target)}}})},{url:o.url},a.id);return this.renderer.getState(c).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(c=>c.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){B.error(`Failed to retrieve state for Marker with id "${t}".`);return}if(n.type!=="marker"){B.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 B.error(`Failed to retrieve state for Marker with id "${t}".`),Promise.resolve();if(o.type!=="marker")return B.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 c;new vn.default.Tween({lon:o.position[0],lat:o.position[1]}).to({lon:e[0],lat:e[1]},a.duration).easing(mT[a.easing]).onUpdate(({lon:p,lat:f})=>{this.Markers.setPosition(t,[p,f],i),this.renderer.render()}).onComplete(()=>{c()}).start();let s=new Promise(p=>{c=p});return this.renderer.render(),s}};Exporter={getCurrentSceneGLTF:async t=>this.renderer.getCurrentSceneGLTF(t)};Shapes={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=tt();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 c=(f=this.styleMap[a.properties.id])==null?void 0:f.showImage,s=(m=a.properties.details)==null?void 0:m.images,p;if(c&&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],c=this.renderer.addLabel2D(t,e,o,a.containerId);if(!c)throw new Error("label creating failed");return c},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 c=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 vn.default.Tween({fraction:0}).to({fraction:1},(e==null?void 0:e.drawDuration)||1e3).onUpdate(({fraction:s})=>{c.forEach(p=>{this.renderer.setState(p.id,{completeFraction:s})})}).onComplete(()=>{i(c)}).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 qu(this,this.renderer),this.mvf=e,this.styleMap=i,this.floors=this.mvf["map.geojson"].sort((a,c)=>a.elevation-c.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 c=new Gc(t,a,this.renderer,n,e,i);return c.load(),c}).filter(Boolean),this.setFloor(n.initialFloor?y3(n.initialFloor):this.floors[0].id)}};l(t1,"GeojsonApiMapObject");var Vs=t1;d();var Ue,Xs,e1=class e1{constructor({currentMapGetter:t}){P(this,Ue,new Map);P(this,Xs,void 0);E(this,Xs,t)}get currentMap(){return u(this,Xs).call(this)}getById(t){return u(this,Ue).get(t)}add(t,e,i){let n=nr(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(li(n),e,{...i,floorId:n.floorId,rank:(i==null?void 0:i.rank)||"medium",dynamicResize:(i==null?void 0:i.dynamicResize)||!1}),c=o.Markers.getContentEl(a.toString());if(!c)throw new Error("marker component should exist");let s=new Ui(a.toString(),c);return u(this,Ue).set(s.id,{marker:s,entityId:a.toString()}),s}remove(t){var i;let e=u(this,Ue).get(t.id);e&&((i=this.currentMap)==null||i.Markers.remove(e.entityId),u(this,Ue).delete(t.id.toString()))}removeAll(){let t=[];return u(this,Ue).forEach(({marker:e})=>{this.remove(e),t.push(e),u(this,Ue).delete(e.id.toString())}),t}setPosition(t,e){var a;let i=nr(e);if(!i){B.error("Cannot determine coordinate from target.");return}let n=this.currentMap;if(!n){B.error("Cannot determine the current map.");return}let o=u(this,Ue).get(t.id);if(!o){B.error(`Cannot find the Marker with id "${t.id}".`);return}n.Markers.setPosition(o.entityId,li(i),(a=i.floorId)!=null?a:n.currentFloorId)}animateTo(t,e,i){var c;let n=nr(e);if(!n)return B.error("Cannot determine coordinate from target."),Promise.resolve();let o=this.currentMap;if(!o)return B.error("Cannot determine the current map."),Promise.resolve();let a=u(this,Ue).get(t.id);return a?o.Markers.animateTo(a.entityId,li(n),(c=n.floorId)!=null?c:o.currentFloorId,i):(B.error(`Cannot find the Marker with id "${t.id}".`),Promise.resolve())}};Ue=new WeakMap,Xs=new WeakMap,l(e1,"Markers");var Hs=e1;d();var fr,Ws,r1=class r1{constructor({currentMapGetter:t}){P(this,fr,new Map);P(this,Ws,void 0);E(this,Ws,t)}get currentMap(){return u(this,Ws).call(this)}getById(t){return u(this,fr).get(t)}add(t,e){let i=Array.isArray(t)?t:[t],n=i.reduce((c,s)=>{var f;let p=nr(s.target);return p?(c.has(p.floorId)||c.set(p.floorId,[]),(f=c.get(p.floorId))==null||f.push({...s,target:p}),c):(B.error("Cannot determine coordinate from options."),c)},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((c,s)=>{let p=tt();o.Models.add(p,c,{...e,floorId:s}).forEach(({id:m})=>{let y=new _a(m.toString(),p);u(this,fr).set(y.id,{model:y,entityId:m.toString(),groupId:p}),a.push(y)})}),a}remove(t){var i;let e=u(this,fr).get(t.id);e&&((i=this.currentMap)==null||i.Models.remove(e.entityId,e.groupId),u(this,fr).delete(t.id.toString()))}removeAll(){let t=[];return u(this,fr).forEach(({model:e})=>{var n;let i=u(this,fr).get(e.id);i&&(t.push(e),(n=this.currentMap)==null||n.Models.remove(i.entityId,i.groupId),u(this,fr).delete(e.id.toString()))}),t}};fr=new WeakMap,Ws=new WeakMap,l(r1,"Models");var js=r1;d();var Nr,Us,i1=class i1{constructor({currentMapGetter:t}){P(this,Nr,new Map);P(this,Us,void 0);E(this,Us,t)}get currentMap(){return u(this,Us).call(this)}getById(t){return u(this,Nr).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 Oa(tt());return u(this,Nr).set(o.id,{path:o,entityIds:n.map(a=>a.id.toString())}),o}remove(t){var i;let e=u(this,Nr).get(t.id);e&&((i=this.currentMap)==null||i.Paths.remove(e.entityIds),u(this,Nr).delete(t.id.toString()))}removeAll(){let t=[];return u(this,Nr).forEach(({path:e})=>{this.remove(e),t.push(e),u(this,Nr).delete(e.id.toString())}),t}};Nr=new WeakMap,Us=new WeakMap,l(i1,"Paths");var Ys=i1;d();var $u=Gr(po());d();var b5="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAkklEQVRoge3awQ3AIAxD0VAMYf+F0yUixbL8JshXuLSwIqJCwDc9QBeZEOy9p2doAQDTM7TQ2cg5Z3qGFjpHS2YjDiGDe+/0DC0cwkYpJKdnaIFMkY1kymzEIVQcwsYhbPDem56hhc5GHELGIWwcwsYhbJS+2R1CxSFsdH5iO4SMr97Y6FxPqxytVVV+HcTEIWx+9mcIqHSOm9QAAAAASUVORK5CYII=";d();var C5=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,c=new Ze;c.moveTo(n*Math.cos(r/2)-i,n*Math.sin(r/2));for(let s=0;s<a;s++)c.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++)c.lineTo(e*Math.cos(Math.PI/-2+Math.PI/a*s),e*Math.sin(Math.PI/-2+Math.PI/a*s));return new qe(c,{depth:.1,bevelEnabled:!1,UVGenerator:gT(t)})},"createSectorGeometry"),n1=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"),gT=l(r=>({generateTopUV:(t,e,i,n,o)=>{let a=e[i*3],c=e[i*3+1],s=e[n*3],p=e[n*3+1],f=e[o*3],m=e[o*3+1];return[n1(a,c,r),n1(s,p,r),n1(f,m,r)]},generateSideWallUV:()=>[new U(0,1),new U(0,1),new U(0,1),new U(0,1)]}),"radialUVGenerator");var o1="#2266ff",vT=.7,bT=.3;function x5(){let r=new Tn({color:o1,opacity:vT,transparent:!0,depthTest:!1,depthWrite:!1}),t=C5(Math.PI/6,M5,P5);new In().load(b5,i=>{r.alphaMap=i,r.needsUpdate=!0});let e=new Ft(t,r);return e.position.z=-.05,e.renderOrder=3,e}l(x5,"createBearingCone");var S5=l(()=>{let r=new ep(.5,.5,.05,32),t=new Tn({transparent:!0,color:o1,opacity:bT,depthTest:!1,depthWrite:!1}),e=new Ft(r,t);e.scale.set(0,0,.05),e.renderOrder=2;let i=new ep(a1,a1,.05,32),n=new Tn({transparent:!0,color:o1,depthTest:!1,depthWrite:!1}),o=new Ft(i,n);return o.renderOrder=3,e.rotation.x=Math.PI/2,o.rotation.x=Math.PI/2,{baseMesh:e,middleMesh:o}},"createBlueDot");d();d();d();var CT=l(function(){let t=globalThis.fetch;return{fetch(...e){if(!da(t))throw new Error("fetch is not available in your environment. Pass your own function into `setFetchFn` (node-fetch, etc)");return t==null?void 0:t(...e)},setFetch(e){t=e}}},"createFetchControl")(),w5=CT.fetch;var E5=["websdk","web","webv2","kiosk-v2","mobile","iossdk","androidsdk","reactnativesdk"],xT=E5[0],ST="https://api-gateway.mappedin.com/track-analytics/a/",bn,Rr,zs,l1,c1=class c1{constructor(){P(this,zs);P(this,bn,Object.freeze({}));P(this,Rr,void 0);v(this,"sendGetDirectionsEvent",lr((t,e)=>this.sendAnalyticEvent("query-directions",{start:t,end:e,type:"location_to_location"}),2500));E(this,Rr,X(this,zs,l1).call(this,u(this,bn)))}init(t={}){this.reset(),this.updateStateWithOptions(t)}reset(){this.updateStateWithOptions({})}updateStateWithOptions(t={}){return E(this,bn,Object.freeze(Object.assign({},u(this,bn),t))),E(this,Rr,X(this,zs,l1).call(this,t)),u(this,Rr)}updateState(t){let i={...{...t}};i.mapId&&(i.baseUrl=T5({...u(this,Rr),mapId:i.mapId})),i.context&&(i.context=I5(i.context)),Object.assign(u(this,Rr),i)}get authReady(){let{key:t,secret:e,accessToken:i}=this.getState();return!!(t&&e)||!!i}getState(){return u(this,Rr)}getContext(){return this.getState().context||u(this,bn).context}sendAnalyticEvent(t,e={}){let i=this.getState(),n={...e,g:i.geolocationMode};i.userPosition&&(n={...n,...i.userPosition});let o=wT(i.baseUrl,t,n);if(i.logEvents&&B.log("Analytics.track",o),!i.sendEvents)return Promise.resolve();let a={"mi-context":this.getContext(),"mi-session":i.mi_session,"mi-device":i.mi_uuid,"mappedin-sdk-version":i.version,"mappedin-platform-version":i.platformString};return i.accessToken?a.Authorization=`Bearer ${i.accessToken}`:i.noAuth||i.secret&&i.key&&(a["x-mappedin-key"]=btoa(i.key),a["x-mappedin-secret"]=btoa(i.secret)),w5(o,{method:"GET",mode:"cors",headers:a})}capture(t,e){if(IT.includes(t))return B.warn(`${t} event is sent internally.`),Promise.resolve();let i=TT.includes(t)?t.slice(1):t;return this.sendAnalyticEvent(i,e)}sendGetMapDataEvent(t){return this.sendAnalyticEvent("load-mapdata",t)}sendWatchPositionDenied(){return this.sendAnalyticEvent("watch-position-denied")}sendMapViewLoadedEvent({firstRenderDuration:t,dimension:e}){return this.sendAnalyticEvent("load-mapview",{firstRenderDuration:t,url:window.location.href,width:e.width,height:e.height,devicePixelRatio:window.devicePixelRatio})}};bn=new WeakMap,Rr=new WeakMap,zs=new WeakSet,l1=l(function(t){var e,i,n;return{baseUrl:T5(t),version:((e=b==null?void 0:b.env)==null?void 0:e.npm_package_version)||"v6",mi_uuid:PT(),accessToken:t.accessToken,mapId:t.mapId,mi_session:MT(),platformString:t.platformString||"",context:I5(t.context)||xT,geolocationMode:!1,sendEvents:(i=t.sendEvents)!=null?i:!1,logEvents:(n=t.logEvents)!=null?n:!1,noAuth:t.noAuth||!1,key:t.key,secret:t.secret}},"#getStateWithOption"),l(c1,"CustomerAnalytics");var s1=c1;function T5(r){return`${ST}${r.mapId}/`}l(T5,"getBaseUrl");function PT(){return io.getInstance().loadLocalData("deviceId")}l(PT,"getDeviceID");function MT(){return io.getInstance().loadSessionData("id")}l(MT,"getSessionID");function wT(r,t,e){let i=new URLSearchParams;for(let[n,o]of Object.entries(e))o!=null&&i.append(n,o);return r+t+"?"+i.toString()}l(wT,"buildUrl");function I5(r){return E5.find(t=>t===r)}l(I5,"getValidContext");var TT=["$select-location","$select-category","$query-suggest","$query-search"],IT=["load-mapview","load-mapdata","query-directions","watch-position-denied"],se=new s1,L5={init(...r){return se.init(...r)},capture(...r){return se.capture(...r)},updateState(r){return se.updateState(r)}};var ET={enableHighAccuracy:!0},LT=500,DT=150,_T=150,OT=0,AT=5,kT=5,NT=30,P5=.4,M5=1.25,a1=.35,u1=class u1 extends z{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}=S5(),o=x5();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,ET)}updateGeometryPerFrame=e=>{var s;let[i,n,o]=e.children,{accuracy:a,heading:c}=((s=this.currentGeolocation)==null?void 0:s.coords)||{};a!=null&&(this.scaleAnimation&&this.scaleAnimation.stop(),this.scaleAnimation=new $u.default.Tween({scale:i.scale.x}).to({scale:me(a,kT,NT,OT,AT)},DT).onUpdate(({scale:p})=>{i.scale.set(p,1,p)}).start()),c!=null?(o.visible=!0,this.rotationAnimation&&this.rotationAnimation.stop(),this.rotationAnimation=new $u.default.Tween({rotation:i.scale.x}).to({rotation:ot.degToRad(c)},_T).onUpdate(({rotation:p})=>{o.rotation.z=p}).start()):o.visible=!1};onPositionUpdate=e=>{var i;if(this.currentGeolocation=e,se.updateState({userPosition:{bluedotTimestamp:Date.now(),latitude:e.coords.latitude,longitude:e.coords.longitude,floorLevel:e.coords.floorLevel,accuracy:e.coords.accuracy}}),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 $u.default.Tween(n.position).to([e.coords.longitude,e.coords.latitude],LT).onUpdate(a=>{if(this.geometry){let c={position:a};if(o==null&&n.parent!=="outdoors-container")c.parent="outdoors-container";else if(o!=null&&n.parent!==o){let s=o!=null?o:"outdoors-container";c.parent=s,this.publish("floor-change",{reason:"blue-dot-floor-change",floorId:s})}this.core.setState(this.geometry,c)}}).start(),this.core.render()}};onPositionError=e=>{switch(e.code){case e.PERMISSION_DENIED:B.error("Geolocation permission denied by the user.",e),se.sendWatchPositionDenied();break;case e.POSITION_UNAVAILABLE:B.error("Geolocation position unavailable.",e);break;case e.TIMEOUT:B.error("Geolocation request timed out.",e);break;default:B.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(u1,"BlueDot");var Ju=u1;d();var Br,qs,p1=class p1{constructor({currentMapGetter:t}){P(this,Br,new Map);P(this,qs,void 0);E(this,qs,t)}get currentMap(){return u(this,qs).call(this)}getById(t){return u(this,Br).get(t)}add(t,e,i){let n=this.currentMap;if(!n)throw new Error("currentMap should exist");let o=n.Shapes.add(t,e||{},{floorId:i==null?void 0:i.id}),a=new ka(o);return u(this,Br).set(a.id,a),a}remove(t){var i;u(this,Br).get(t.id)&&((i=this.currentMap)==null||i.Shapes.remove(t),u(this,Br).delete(t.id.toString()))}removeAll(){let t=[];return u(this,Br).forEach(e=>{this.remove(e),t.push(e.id),u(this,Br).delete(e.id.toString())}),t}};Br=new WeakMap,qs=new WeakMap,l(p1,"Shapes");var Zs=p1;d();var Js,h1=class h1{constructor({currentMapGetter:t}){P(this,Js,void 0);E(this,Js,t)}get currentMap(){return u(this,Js).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 c=a.layers.get(o);(i=this.currentMap)==null||i.renderer.setState(c,{color:t[o].color})}if(o===yc&&!(Oi in t)){let c=a.layers.get(Oi);c&&"color"in t[o]&&((n=this.currentMap)==null||n.renderer.setState(c,{color:t[o].color}))}}}};Js=new WeakMap,l(h1,"Style");var $s=h1;d();var mr,Ks,d1=class d1{constructor(t,e){P(this,mr,void 0);P(this,Ks,void 0);E(this,mr,t),E(this,Ks,e||[])}setStyle(t){var e,i;if(u(this,mr).map){(e=u(this,mr).map)==null||e.setStyle(t),(i=u(this,mr).map)==null||i.moveLayer(Za);for(let[n,o]of u(this,Ks)||[])u(this,mr).hideOutdoorLayersUnderPoint(n,o)}}get map(){return u(this,mr).map}get enabled(){return!!u(this,mr).map}};mr=new WeakMap,Ks=new WeakMap,l(d1,"Outdoor");var ko=d1;var Ku=.05,f1=class f1{core;outdoors;mapObjects=[];id;mapDataExternal={};mapsByFloorId={};mapData;currentMap;directions;hiddenOutdoorGeometries=[];mapView;Camera;Labels;Markers;Models;Paths;Exporter;Navigation;Outdoor;BlueDot;Shapes;Style;constructor(t,e){this.core=t,this.mapView=e,this.Camera=new Fa(this.core),this.id=this.core.addGroupContainer("root").id.toString(),this.outdoors=new Vs("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 Aa(this.Camera);this.core.on("camera-change",()=>{this.mapView.publish("camera-change",i)});let n=l(c=>s=>{var g,C,I;let p=[],f=[],m=[];s.labels.forEach(T=>{let w=this.Labels.getById(T.toString());w&&p.push(w.label)}),s.markers.forEach(T=>{let w=this.Markers.getById(T.toString());w&&f.push(w.marker)}),s.models.forEach(T=>{let w=this.Models.getById(T.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((T,w)=>{var _;let L=(_=this.getMapDataInternal())==null?void 0:_.getById("floor",w);return L&&Qr.is(L)&&T.push(L),T},[]),M={coordinate:new et(s.coordinate[1],s.coordinate[0],(I=S==null?void 0:S[0])==null?void 0:I.id),spaces:x&&de.is(x)?[x]:[],objects:x&&fe.is(x)?[x]:[],markers:f,labels:p,models:m,floors:S};"pointerEvent"in s&&(M.pointerEvent=s.pointerEvent),this.mapView.publish(c,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 Hs({currentMapGetter:o}),this.Models=new js({currentMapGetter:o}),this.Labels=new Wa({currentMapGetter:o}),this.Exporter=new ja({currentMapGetter:o}),this.Paths=new Ys({currentMapGetter:o}),this.Navigation=new bc(e),this.BlueDot=new Ju(this.core,this),this.BlueDot.on("floor-change",c=>{this.setFloor(c.floorId,"blue-dot-floor-change")}),this.Outdoor=new ko(this.core,this.hiddenOutdoorGeometries),this.Shapes=new Zs({currentMapGetter:o}),this.Style=new $s({currentMapGetter:o});let a=new wc(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(yc),c=o.layers.get(Oi);a&&((s=this.core.getState(a))==null||s.children.forEach(f=>{this.core.setState(f.id,e)})),c&&((p=this.core.getState(c))==null||p.children.forEach(f=>{this.core.setState(f.id,e)}))});return}let i=typeof t=="string"?this.getMapDataObject(t):t;if(i){if(oi.is(i))return this.core.setState(i.id,W3({...e,type:"label"},this.core.getState(i.id)));if(Ui.is(i))return this.core.setState(i.id,Y3({...e,type:"marker"},this.core.getState(i.id)));(de.is(i)||fe.is(i))&&this.core.setState(i.id,U3({...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 ul.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=ul.get(t);if(!n){B.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 et(a[1],a[0])});let c=q3(o["styles.json"]||{}),s=o["manifest.geojson"].features[0].properties.name,p=new Vs(`mapObject-${s}`,o,c,e,this.core),f=this.core.getBoundingArea(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 Rc({nodes:this.currentMap.mvf["node.geojson"],obstructions:this.currentMap.mvf.obstruction,connections:this.currentMap.mvf["connection.json"],groupBy:"map"}),(e==null?void 0:e.zoomLevel)!=null?(this.core.camera.setZoomLevel(e.zoomLevel),i(t)):this.core.mode!=="outdoors-overlay"?this.core.camera.focusOn(this.core.getBoundingArea(p.currentFloor.id),{duration:g3,padding:{top:Ku*this.core.canvasHeight,left:Ku*this.core.canvasWidth,right:Ku*this.core.canvasWidth,bottom:Ku*this.core.canvasHeight}}).then(()=>{i(t)}):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)}updateWatermark(t){this.core.updateWatermark(t)}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 et(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||{},c=Array.isArray(t)?t:[t],s=Array.isArray(e)?e:[e];se.sendGetDirectionsEvent(c[0].id,s[0].id);let p=typeof a=="object"?a.enabled:a,f=typeof a=="object"?a.radius:void 0,m=(i==null?void 0:i.zones)||[],y={accessible:o,zones:m,smoothing:{enabled:p!=null?p:!0,radius:f!=null?f:.75}};return this.directions.getDirections(c,s,y,n)};createCoordinate(t,e,i){return new et(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 et(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.Navigation.clear(),this.BlueDot.disable(),this.Shapes.removeAll(),this.Paths.removeAll(),this.Models.removeAll(),this.Markers.removeAll(),this.Labels.removeAll(),this.core.destroy()}};l(f1,"GeoJsonApi");var Qs=f1;var el,Q,m1=class m1 extends z{constructor(e){super();P(this,el,{});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,"Shapes");v(this,"Outdoor");v(this,"update",()=>{u(this,Q).core.render()});v(this,"getDirections",(e,i,n)=>u(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 Qs(e,this);E(this,Q,i),this.Camera=u(this,Q).Camera,E(this,el,u(this,Q).mapDataExternal),this.Markers=u(this,Q).Markers,this.Models=u(this,Q).Models,this.Labels=u(this,Q).Labels,this.Exporter=u(this,Q).Exporter,this.Paths=u(this,Q).Paths,this.Navigation=u(this,Q).Navigation,this.BlueDot=u(this,Q).BlueDot,this.Shapes=u(this,Q).Shapes,this.Style=u(this,Q).Style,this.auto=u(this,Q).auto,this.Outdoor=u(this,Q).Outdoor}updateState(e,i){return u(this,Q).updateState(e,i)}getMapData(){return u(this,el)}getDimensions(){return{width:this.__core.canvasWidth,height:this.__core.canvasHeight}}expand(e){return u(this,Q).expand(e)}collapse(){return u(this,Q).collapse()}addMap(e,i){return u(this,Q).addMap(e,i)}setFloor(e){u(this,Q).setFloor(e)}get currentFloor(){return u(this,Q).currentFloor}updateWatermark(e){u(this,Q).updateWatermark(e)}getState(e){return u(this,Q).getState(e)}setHoverColor(e){u(this,Q).setHoverColor(e)}getHoverColor(){return u(this,Q).getHoverColor()}isInView(e){return u(this,Q).isInView(e)}createCoordinate(e,i,n){return u(this,Q).createCoordinate(e,i,n)}createCoordinateFromScreenCoordinate(e,i,n){return u(this,Q).createCoordinateFromScreenCoordinate(e,i,n)}auto(){this.Labels.all()}get __core(){return u(this,Q).core}destroy(){u(this,Q).destroy()}async enableDebug(){let{Inspector:e}=await import("./inspector-GIOP4ZXY.js");await new e(this,u(this,Q)).enable()}};el=new WeakMap,Q=new WeakMap,l(m1,"MapView");var tl=m1;d();var y1=class y1 extends z{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 Bs(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=>{B.warn(n)});let e=cl.fromLngLat(this.origin,0),i=Wc(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(ot.degToRad(-t.getBearing())),this.core.getSystems().cameraSystem.setTilt(ot.degToRad(t.getPitch()))}),this.el}onRemove(){}};l(y1,"MapLibreOverlay");var Qu=y1;var kJ=l(async(r,t)=>{let e;try{if(t){let{access_token:o}=await hl(t);e=o}}catch(o){B.warn("Getting access token failed. Outdoor map disabled.",o)}let i=new ro(r,e);return new pl(i)},"hydrateMapDataFromMVF");function RT(r,t,e){return fetch(r,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({grant_type:"client_credentials",client_id:t,client_secret:e})})}l(RT,"fetchOutdoorViewToken");var BT=l(async r=>{let t={emitAnalyticsEvents:!0,...r},e;if("accessToken"in t)e=t.accessToken;else if("key"in t&&"secret"in t){let p=await RT("https://auth.mappedin.com/oauth2/token",t.key,t.secret),{access_token:f}=await p.json();e=f}else throw new Error("No outdoor view token provided and key and secret missing.");let i={...t,venue:t.mapId,clientId:t.key,clientSecret:t.secret,version:"1.0.0"},n=await $1(i),o=await fl(n),a=dl(o);typeof r.onMVFParsed=="function"&&r.onMVFParsed(a);let c=new ro(a,e);return new pl(c)},"getMapDataEnterprise"),D5=!1;function NJ(r){D5=r}l(NJ,"setUseEnterpriseAPI");var RJ=l(async r=>{if(D5)return BT(r);let t={emitAnalyticsEvents:!1,...r},e;if("accessToken"in t)e=t.accessToken;else{let{access_token:m}=await hl(t);e=m}se.authReady||se.updateState({accessToken:e});let i=performance.now(),n=await op(t,e),o=performance.now(),a=await fl(n),c=dl(a),s=performance.now();typeof r.onMVFParsed=="function"&&r.onMVFParsed(c);let p=new ro(c,e),f=new pl(p);return se.sendGetMapDataEvent({parseDuration:(s-o).toFixed(2),downloadDuration:(o-i).toFixed(2),viewId:t.viewId}),f},"getMapData"),Cn,No,tp=class tp extends Qu{constructor(e,i,n){super(e);P(this,Cn,void 0);P(this,No,void 0);E(this,Cn,i),E(this,No,n)}onAdd(e){var o,a;super.onAdd(e);let i={...fa,...(o=u(this,No))!=null?o:{},outdoorView:{token:u(this,Cn).outdoorViewToken,...(a=u(this,No))==null?void 0:a.outdoorView}},n=new tl(this.core);return n.addMap(u(this,Cn),i).then(()=>{this.publish("loaded",{mapView:n,mapData:u(this,Cn)})}),this.el}};Cn=new WeakMap,No=new WeakMap,l(tp,"MappedinMapLibreOverlay"),v(tp,"instance");var rl=tp,BJ=l((r,t)=>{rl.instance!=null&&B.warn("Only a single map venue is supported at this time.");let e=new rl([r.mapCenter.longitude,r.mapCenter.latitude],r,t);return rl.instance=e,e},"createMapLibreOverlay"),FT=l(async(r,t,e)=>{var c,s,p,f,m;let i=performance.now(),n=ld(e,t);try{e&&sd(e)}catch(y){if(y instanceof Error&&y.name==="MissingOutdoorViewToken")B.error("Enable outdoor view requires a token. Provide token in `options.outdoorView.token`");else throw y}let o=await v5(r,{center:[t.mapCenter.longitude,t.mapCenter.latitude],bearing:n.bearing,pitch:n.pitch,zoomLevel:n.zoomLevel,outdoorView:(c=n.outdoorView)!=null&&c.token?{headers:{"x-mappedin-tiles-key":(s=n.outdoorView)==null?void 0:s.token},style:(p=n.outdoorView)==null?void 0:p.style,enabled:!!((f=n.outdoorView)!=null&&f.enabled)}:void 0,watermark:n.watermark,attribution:n.attribution,antialias:typeof n.antialiasing=="boolean"?n.antialiasing:!!((m=n.antialiasing)!=null&&m.enabled)}),a=new tl(o);return await a.addMap(t,n),se.sendMapViewLoadedEvent({firstRenderDuration:(performance.now()-i).toFixed(2),dimension:a.getDimensions()}),a},"show3dMapGeojson"),FJ=FT;export{j1 as a,G5 as b,dl as c,fl as d,et as e,mc as f,Jr as g,de as h,Qr as i,ei as j,fe as k,gc as l,ti as m,Un as n,eb as o,uT as p,se as q,L5 as r,kJ as s,BT as t,NJ as u,RJ as v,BJ as w,FT as x,FJ as y};